@vue/runtime-dom 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/runtime-dom v3.5.16
2
+ * @vue/runtime-dom v3.6.0-alpha.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -21,6 +21,8 @@ var VueRuntimeDOM = (function (exports) {
21
21
  const NO = () => false;
22
22
  const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
23
23
  (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
24
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
25
+ key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
24
26
  const isModelListener = (key) => key.startsWith("onUpdate:");
25
27
  const extend = Object.assign;
26
28
  const remove = (arr, el) => {
@@ -54,6 +56,7 @@ var VueRuntimeDOM = (function (exports) {
54
56
  // the leading comma is intentional so empty string "" is also included
55
57
  ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
56
58
  );
59
+ const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
57
60
  const isBuiltInDirective = /* @__PURE__ */ makeMap(
58
61
  "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
59
62
  );
@@ -65,10 +68,9 @@ var VueRuntimeDOM = (function (exports) {
65
68
  };
66
69
  };
67
70
  const camelizeRE = /-(\w)/g;
71
+ const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
68
72
  const camelize = cacheStringFunction(
69
- (str) => {
70
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
71
- }
73
+ (str) => str.replace(camelizeRE, camelizeReplacer)
72
74
  );
73
75
  const hyphenateRE = /\B([A-Z])/g;
74
76
  const hyphenate = cacheStringFunction(
@@ -109,6 +111,10 @@ var VueRuntimeDOM = (function (exports) {
109
111
  const getGlobalThis = () => {
110
112
  return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
111
113
  };
114
+ function canSetValueDirectly(tagName) {
115
+ return tagName !== "PROGRESS" && // custom elements may use _value internally
116
+ !tagName.includes("-");
117
+ }
112
118
 
113
119
  const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
114
120
  const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
@@ -216,6 +222,24 @@ var VueRuntimeDOM = (function (exports) {
216
222
  const type = typeof value;
217
223
  return type === "string" || type === "number" || type === "boolean";
218
224
  }
225
+ function shouldSetAsAttr(tagName, key) {
226
+ if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
227
+ return true;
228
+ }
229
+ if (key === "form") {
230
+ return true;
231
+ }
232
+ if (key === "list" && tagName === "INPUT") {
233
+ return true;
234
+ }
235
+ if (key === "type" && tagName === "TEXTAREA") {
236
+ return true;
237
+ }
238
+ if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
239
+ return true;
240
+ }
241
+ return false;
242
+ }
219
243
 
220
244
  const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
221
245
  function getEscapedCssVarName(key, doubleEscape) {
@@ -279,7 +303,20 @@ var VueRuntimeDOM = (function (exports) {
279
303
  return !!(val && val["__v_isRef"] === true);
280
304
  };
281
305
  const toDisplayString = (val) => {
282
- 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);
306
+ switch (typeof val) {
307
+ case "string":
308
+ return val;
309
+ case "object":
310
+ if (val) {
311
+ if (isRef$1(val)) {
312
+ return toDisplayString(val.value);
313
+ } else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
314
+ return JSON.stringify(val, replacer, 2);
315
+ }
316
+ }
317
+ default:
318
+ return val == null ? "" : String(val);
319
+ }
283
320
  };
284
321
  const replacer = (_key, val) => {
285
322
  if (isRef$1(val)) {
@@ -314,599 +351,407 @@ var VueRuntimeDOM = (function (exports) {
314
351
  );
315
352
  };
316
353
 
317
- function warn$2(msg, ...args) {
318
- console.warn(`[Vue warn] ${msg}`, ...args);
319
- }
320
-
321
- let activeEffectScope;
322
- class EffectScope {
323
- constructor(detached = false) {
324
- this.detached = detached;
325
- /**
326
- * @internal
327
- */
328
- this._active = true;
329
- /**
330
- * @internal track `on` calls, allow `on` call multiple times
331
- */
332
- this._on = 0;
333
- /**
334
- * @internal
335
- */
336
- this.effects = [];
337
- /**
338
- * @internal
339
- */
340
- this.cleanups = [];
341
- this._isPaused = false;
342
- this.parent = activeEffectScope;
343
- if (!detached && activeEffectScope) {
344
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
345
- this
346
- ) - 1;
347
- }
348
- }
349
- get active() {
350
- return this._active;
351
- }
352
- pause() {
353
- if (this._active) {
354
- this._isPaused = true;
355
- let i, l;
356
- if (this.scopes) {
357
- for (i = 0, l = this.scopes.length; i < l; i++) {
358
- this.scopes[i].pause();
359
- }
360
- }
361
- for (i = 0, l = this.effects.length; i < l; i++) {
362
- this.effects[i].pause();
363
- }
364
- }
365
- }
366
- /**
367
- * Resumes the effect scope, including all child scopes and effects.
368
- */
369
- resume() {
370
- if (this._active) {
371
- if (this._isPaused) {
372
- this._isPaused = false;
373
- let i, l;
374
- if (this.scopes) {
375
- for (i = 0, l = this.scopes.length; i < l; i++) {
376
- this.scopes[i].resume();
377
- }
378
- }
379
- for (i = 0, l = this.effects.length; i < l; i++) {
380
- this.effects[i].resume();
381
- }
382
- }
383
- }
384
- }
385
- run(fn) {
386
- if (this._active) {
387
- const currentEffectScope = activeEffectScope;
388
- try {
389
- activeEffectScope = this;
390
- return fn();
391
- } finally {
392
- activeEffectScope = currentEffectScope;
393
- }
394
- } else {
395
- warn$2(`cannot run an inactive effect scope.`);
396
- }
397
- }
398
- /**
399
- * This should only be called on non-detached scopes
400
- * @internal
401
- */
402
- on() {
403
- if (++this._on === 1) {
404
- this.prevScope = activeEffectScope;
405
- activeEffectScope = this;
406
- }
407
- }
408
- /**
409
- * This should only be called on non-detached scopes
410
- * @internal
411
- */
412
- off() {
413
- if (this._on > 0 && --this._on === 0) {
414
- activeEffectScope = this.prevScope;
415
- this.prevScope = void 0;
416
- }
417
- }
418
- stop(fromParent) {
419
- if (this._active) {
420
- this._active = false;
421
- let i, l;
422
- for (i = 0, l = this.effects.length; i < l; i++) {
423
- this.effects[i].stop();
424
- }
425
- this.effects.length = 0;
426
- for (i = 0, l = this.cleanups.length; i < l; i++) {
427
- this.cleanups[i]();
354
+ function getSequence(arr) {
355
+ const p = arr.slice();
356
+ const result = [0];
357
+ let i, j, u, v, c;
358
+ const len = arr.length;
359
+ for (i = 0; i < len; i++) {
360
+ const arrI = arr[i];
361
+ if (arrI !== 0) {
362
+ j = result[result.length - 1];
363
+ if (arr[j] < arrI) {
364
+ p[i] = j;
365
+ result.push(i);
366
+ continue;
428
367
  }
429
- this.cleanups.length = 0;
430
- if (this.scopes) {
431
- for (i = 0, l = this.scopes.length; i < l; i++) {
432
- this.scopes[i].stop(true);
368
+ u = 0;
369
+ v = result.length - 1;
370
+ while (u < v) {
371
+ c = u + v >> 1;
372
+ if (arr[result[c]] < arrI) {
373
+ u = c + 1;
374
+ } else {
375
+ v = c;
433
376
  }
434
- this.scopes.length = 0;
435
377
  }
436
- if (!this.detached && this.parent && !fromParent) {
437
- const last = this.parent.scopes.pop();
438
- if (last && last !== this) {
439
- this.parent.scopes[this.index] = last;
440
- last.index = this.index;
378
+ if (arrI < arr[result[u]]) {
379
+ if (u > 0) {
380
+ p[i] = result[u - 1];
441
381
  }
382
+ result[u] = i;
442
383
  }
443
- this.parent = void 0;
444
384
  }
445
385
  }
446
- }
447
- function effectScope(detached) {
448
- return new EffectScope(detached);
449
- }
450
- function getCurrentScope() {
451
- return activeEffectScope;
452
- }
453
- function onScopeDispose(fn, failSilently = false) {
454
- if (activeEffectScope) {
455
- activeEffectScope.cleanups.push(fn);
456
- } else if (!failSilently) {
457
- warn$2(
458
- `onScopeDispose() is called when there is no active effect scope to be associated with.`
459
- );
386
+ u = result.length;
387
+ v = result[u - 1];
388
+ while (u-- > 0) {
389
+ result[u] = v;
390
+ v = p[v];
460
391
  }
392
+ return result;
461
393
  }
462
394
 
463
- let activeSub;
464
- const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
465
- class ReactiveEffect {
466
- constructor(fn) {
467
- this.fn = fn;
468
- /**
469
- * @internal
470
- */
471
- this.deps = void 0;
472
- /**
473
- * @internal
474
- */
475
- this.depsTail = void 0;
476
- /**
477
- * @internal
478
- */
479
- this.flags = 1 | 4;
480
- /**
481
- * @internal
482
- */
483
- this.next = void 0;
484
- /**
485
- * @internal
486
- */
487
- this.cleanup = void 0;
488
- this.scheduler = void 0;
489
- if (activeEffectScope && activeEffectScope.active) {
490
- activeEffectScope.effects.push(this);
491
- }
492
- }
493
- pause() {
494
- this.flags |= 64;
495
- }
496
- resume() {
497
- if (this.flags & 64) {
498
- this.flags &= -65;
499
- if (pausedQueueEffects.has(this)) {
500
- pausedQueueEffects.delete(this);
501
- this.trigger();
502
- }
503
- }
504
- }
505
- /**
506
- * @internal
507
- */
508
- notify() {
509
- if (this.flags & 2 && !(this.flags & 32)) {
510
- return;
511
- }
512
- if (!(this.flags & 8)) {
513
- batch(this);
514
- }
515
- }
516
- run() {
517
- if (!(this.flags & 1)) {
518
- return this.fn();
519
- }
520
- this.flags |= 2;
521
- cleanupEffect(this);
522
- prepareDeps(this);
523
- const prevEffect = activeSub;
524
- const prevShouldTrack = shouldTrack;
525
- activeSub = this;
526
- shouldTrack = true;
527
- try {
528
- return this.fn();
529
- } finally {
530
- if (activeSub !== this) {
531
- warn$2(
532
- "Active effect was not restored correctly - this is likely a Vue internal bug."
533
- );
534
- }
535
- cleanupDeps(this);
536
- activeSub = prevEffect;
537
- shouldTrack = prevShouldTrack;
538
- this.flags &= -3;
539
- }
540
- }
541
- stop() {
542
- if (this.flags & 1) {
543
- for (let link = this.deps; link; link = link.nextDep) {
544
- removeSub(link);
545
- }
546
- this.deps = this.depsTail = void 0;
547
- cleanupEffect(this);
548
- this.onStop && this.onStop();
549
- this.flags &= -2;
550
- }
395
+ function normalizeCssVarValue(value) {
396
+ if (value == null) {
397
+ return "initial";
551
398
  }
552
- trigger() {
553
- if (this.flags & 64) {
554
- pausedQueueEffects.add(this);
555
- } else if (this.scheduler) {
556
- this.scheduler();
557
- } else {
558
- this.runIfDirty();
559
- }
399
+ if (typeof value === "string") {
400
+ return value === "" ? " " : value;
560
401
  }
561
- /**
562
- * @internal
563
- */
564
- runIfDirty() {
565
- if (isDirty(this)) {
566
- this.run();
402
+ if (typeof value !== "number" || !Number.isFinite(value)) {
403
+ {
404
+ console.warn(
405
+ "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
406
+ value
407
+ );
567
408
  }
568
409
  }
569
- get dirty() {
570
- return isDirty(this);
571
- }
410
+ return String(value);
411
+ }
412
+
413
+ function warn$2(msg, ...args) {
414
+ console.warn(`[Vue warn] ${msg}`, ...args);
572
415
  }
416
+
417
+ var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
418
+ ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
419
+ ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
420
+ ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
421
+ ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
422
+ ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
423
+ ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
424
+ ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
425
+ return ReactiveFlags2;
426
+ })(ReactiveFlags || {});
427
+ const notifyBuffer = [];
573
428
  let batchDepth = 0;
574
- let batchedSub;
575
- let batchedComputed;
576
- function batch(sub, isComputed = false) {
577
- sub.flags |= 8;
578
- if (isComputed) {
579
- sub.next = batchedComputed;
580
- batchedComputed = sub;
581
- return;
429
+ let activeSub = void 0;
430
+ let notifyIndex = 0;
431
+ let notifyBufferLength = 0;
432
+ function setActiveSub(sub) {
433
+ try {
434
+ return activeSub;
435
+ } finally {
436
+ activeSub = sub;
582
437
  }
583
- sub.next = batchedSub;
584
- batchedSub = sub;
585
438
  }
586
439
  function startBatch() {
587
- batchDepth++;
440
+ ++batchDepth;
588
441
  }
589
442
  function endBatch() {
590
- if (--batchDepth > 0) {
591
- return;
592
- }
593
- if (batchedComputed) {
594
- let e = batchedComputed;
595
- batchedComputed = void 0;
596
- while (e) {
597
- const next = e.next;
598
- e.next = void 0;
599
- e.flags &= -9;
600
- e = next;
601
- }
602
- }
603
- let error;
604
- while (batchedSub) {
605
- let e = batchedSub;
606
- batchedSub = void 0;
607
- while (e) {
608
- const next = e.next;
609
- e.next = void 0;
610
- e.flags &= -9;
611
- if (e.flags & 1) {
612
- try {
613
- ;
614
- e.trigger();
615
- } catch (err) {
616
- if (!error) error = err;
617
- }
618
- }
619
- e = next;
620
- }
621
- }
622
- if (error) throw error;
623
- }
624
- function prepareDeps(sub) {
625
- for (let link = sub.deps; link; link = link.nextDep) {
626
- link.version = -1;
627
- link.prevActiveLink = link.dep.activeLink;
628
- link.dep.activeLink = link;
443
+ if (!--batchDepth && notifyBufferLength) {
444
+ flush();
629
445
  }
630
446
  }
631
- function cleanupDeps(sub) {
632
- let head;
633
- let tail = sub.depsTail;
634
- let link = tail;
635
- while (link) {
636
- const prev = link.prevDep;
637
- if (link.version === -1) {
638
- if (link === tail) tail = prev;
639
- removeSub(link);
640
- removeDep(link);
641
- } else {
642
- head = link;
643
- }
644
- link.dep.activeLink = link.prevActiveLink;
645
- link.prevActiveLink = void 0;
646
- link = prev;
447
+ function link(dep, sub) {
448
+ const prevDep = sub.depsTail;
449
+ if (prevDep !== void 0 && prevDep.dep === dep) {
450
+ return;
647
451
  }
648
- sub.deps = head;
649
- sub.depsTail = tail;
650
- }
651
- function isDirty(sub) {
652
- for (let link = sub.deps; link; link = link.nextDep) {
653
- if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
654
- return true;
452
+ let nextDep = void 0;
453
+ const recursedCheck = sub.flags & 4 /* RecursedCheck */;
454
+ if (recursedCheck) {
455
+ nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
456
+ if (nextDep !== void 0 && nextDep.dep === dep) {
457
+ sub.depsTail = nextDep;
458
+ return;
655
459
  }
656
460
  }
657
- if (sub._dirty) {
658
- return true;
659
- }
660
- return false;
661
- }
662
- function refreshComputed(computed) {
663
- if (computed.flags & 4 && !(computed.flags & 16)) {
461
+ const prevSub = dep.subsTail;
462
+ if (prevSub !== void 0 && prevSub.sub === sub && (!recursedCheck || isValidLink(prevSub, sub))) {
664
463
  return;
665
464
  }
666
- computed.flags &= -17;
667
- if (computed.globalVersion === globalVersion) {
668
- return;
465
+ const newLink = sub.depsTail = dep.subsTail = {
466
+ dep,
467
+ sub,
468
+ prevDep,
469
+ nextDep,
470
+ prevSub,
471
+ nextSub: void 0
472
+ };
473
+ if (nextDep !== void 0) {
474
+ nextDep.prevDep = newLink;
669
475
  }
670
- computed.globalVersion = globalVersion;
671
- if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
672
- return;
476
+ if (prevDep !== void 0) {
477
+ prevDep.nextDep = newLink;
478
+ } else {
479
+ sub.deps = newLink;
673
480
  }
674
- computed.flags |= 2;
675
- const dep = computed.dep;
676
- const prevSub = activeSub;
677
- const prevShouldTrack = shouldTrack;
678
- activeSub = computed;
679
- shouldTrack = true;
680
- try {
681
- prepareDeps(computed);
682
- const value = computed.fn(computed._value);
683
- if (dep.version === 0 || hasChanged(value, computed._value)) {
684
- computed.flags |= 128;
685
- computed._value = value;
686
- dep.version++;
687
- }
688
- } catch (err) {
689
- dep.version++;
690
- throw err;
691
- } finally {
692
- activeSub = prevSub;
693
- shouldTrack = prevShouldTrack;
694
- cleanupDeps(computed);
695
- computed.flags &= -3;
481
+ if (prevSub !== void 0) {
482
+ prevSub.nextSub = newLink;
483
+ } else {
484
+ dep.subs = newLink;
696
485
  }
697
486
  }
698
- function removeSub(link, soft = false) {
699
- const { dep, prevSub, nextSub } = link;
700
- if (prevSub) {
701
- prevSub.nextSub = nextSub;
702
- link.prevSub = void 0;
487
+ function unlink(link2, sub = link2.sub) {
488
+ const dep = link2.dep;
489
+ const prevDep = link2.prevDep;
490
+ const nextDep = link2.nextDep;
491
+ const nextSub = link2.nextSub;
492
+ const prevSub = link2.prevSub;
493
+ if (nextDep !== void 0) {
494
+ nextDep.prevDep = prevDep;
495
+ } else {
496
+ sub.depsTail = prevDep;
703
497
  }
704
- if (nextSub) {
705
- nextSub.prevSub = prevSub;
706
- link.nextSub = void 0;
498
+ if (prevDep !== void 0) {
499
+ prevDep.nextDep = nextDep;
500
+ } else {
501
+ sub.deps = nextDep;
707
502
  }
708
- if (dep.subsHead === link) {
709
- dep.subsHead = nextSub;
503
+ if (nextSub !== void 0) {
504
+ nextSub.prevSub = prevSub;
505
+ } else {
506
+ dep.subsTail = prevSub;
710
507
  }
711
- if (dep.subs === link) {
712
- dep.subs = prevSub;
713
- if (!prevSub && dep.computed) {
714
- dep.computed.flags &= -5;
715
- for (let l = dep.computed.deps; l; l = l.nextDep) {
716
- removeSub(l, true);
508
+ if (prevSub !== void 0) {
509
+ prevSub.nextSub = nextSub;
510
+ } else if ((dep.subs = nextSub) === void 0) {
511
+ let toRemove = dep.deps;
512
+ if (toRemove !== void 0) {
513
+ do {
514
+ toRemove = unlink(toRemove, dep);
515
+ } while (toRemove !== void 0);
516
+ dep.flags |= 16 /* Dirty */;
517
+ }
518
+ }
519
+ return nextDep;
520
+ }
521
+ function propagate(link2) {
522
+ let next = link2.nextSub;
523
+ let stack;
524
+ top: do {
525
+ const sub = link2.sub;
526
+ let flags = sub.flags;
527
+ if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
528
+ if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
529
+ sub.flags = flags | 32 /* Pending */;
530
+ } else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
531
+ flags = 0 /* None */;
532
+ } else if (!(flags & 4 /* RecursedCheck */)) {
533
+ sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
534
+ } else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
535
+ sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
536
+ flags &= 1 /* Mutable */;
537
+ } else {
538
+ flags = 0 /* None */;
539
+ }
540
+ if (flags & 2 /* Watching */) {
541
+ notifyBuffer[notifyBufferLength++] = sub;
542
+ }
543
+ if (flags & 1 /* Mutable */) {
544
+ const subSubs = sub.subs;
545
+ if (subSubs !== void 0) {
546
+ link2 = subSubs;
547
+ if (subSubs.nextSub !== void 0) {
548
+ stack = { value: next, prev: stack };
549
+ next = link2.nextSub;
550
+ }
551
+ continue;
552
+ }
717
553
  }
718
554
  }
719
- }
720
- if (!soft && !--dep.sc && dep.map) {
721
- dep.map.delete(dep.key);
722
- }
555
+ if ((link2 = next) !== void 0) {
556
+ next = link2.nextSub;
557
+ continue;
558
+ }
559
+ while (stack !== void 0) {
560
+ link2 = stack.value;
561
+ stack = stack.prev;
562
+ if (link2 !== void 0) {
563
+ next = link2.nextSub;
564
+ continue top;
565
+ }
566
+ }
567
+ break;
568
+ } while (true);
723
569
  }
724
- function removeDep(link) {
725
- const { prevDep, nextDep } = link;
726
- if (prevDep) {
727
- prevDep.nextDep = nextDep;
728
- link.prevDep = void 0;
729
- }
730
- if (nextDep) {
731
- nextDep.prevDep = prevDep;
732
- link.nextDep = void 0;
733
- }
570
+ function startTracking(sub) {
571
+ sub.depsTail = void 0;
572
+ sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
573
+ return setActiveSub(sub);
734
574
  }
735
- function effect(fn, options) {
736
- if (fn.effect instanceof ReactiveEffect) {
737
- fn = fn.effect.fn;
738
- }
739
- const e = new ReactiveEffect(fn);
740
- if (options) {
741
- extend(e, options);
575
+ function endTracking(sub, prevSub) {
576
+ if (activeSub !== sub) {
577
+ warn$2(
578
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
579
+ );
742
580
  }
743
- try {
744
- e.run();
745
- } catch (err) {
746
- e.stop();
747
- throw err;
748
- }
749
- const runner = e.run.bind(e);
750
- runner.effect = e;
751
- return runner;
752
- }
753
- function stop(runner) {
754
- runner.effect.stop();
755
- }
756
- let shouldTrack = true;
757
- const trackStack = [];
758
- function pauseTracking() {
759
- trackStack.push(shouldTrack);
760
- shouldTrack = false;
761
- }
762
- function resetTracking() {
763
- const last = trackStack.pop();
764
- shouldTrack = last === void 0 ? true : last;
765
- }
766
- function cleanupEffect(e) {
767
- const { cleanup } = e;
768
- e.cleanup = void 0;
769
- if (cleanup) {
770
- const prevSub = activeSub;
771
- activeSub = void 0;
772
- try {
773
- cleanup();
774
- } finally {
775
- activeSub = prevSub;
776
- }
581
+ activeSub = prevSub;
582
+ const depsTail = sub.depsTail;
583
+ let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
584
+ while (toRemove !== void 0) {
585
+ toRemove = unlink(toRemove, sub);
586
+ }
587
+ sub.flags &= -5 /* RecursedCheck */;
588
+ }
589
+ function flush() {
590
+ while (notifyIndex < notifyBufferLength) {
591
+ const effect = notifyBuffer[notifyIndex];
592
+ notifyBuffer[notifyIndex++] = void 0;
593
+ effect.notify();
594
+ }
595
+ notifyIndex = 0;
596
+ notifyBufferLength = 0;
597
+ }
598
+ function checkDirty(link2, sub) {
599
+ let stack;
600
+ let checkDepth = 0;
601
+ top: do {
602
+ const dep = link2.dep;
603
+ const depFlags = dep.flags;
604
+ let dirty = false;
605
+ if (sub.flags & 16 /* Dirty */) {
606
+ dirty = true;
607
+ } else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
608
+ if (dep.update()) {
609
+ const subs = dep.subs;
610
+ if (subs.nextSub !== void 0) {
611
+ shallowPropagate(subs);
612
+ }
613
+ dirty = true;
614
+ }
615
+ } else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
616
+ if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
617
+ stack = { value: link2, prev: stack };
618
+ }
619
+ link2 = dep.deps;
620
+ sub = dep;
621
+ ++checkDepth;
622
+ continue;
623
+ }
624
+ if (!dirty && link2.nextDep !== void 0) {
625
+ link2 = link2.nextDep;
626
+ continue;
627
+ }
628
+ while (checkDepth) {
629
+ --checkDepth;
630
+ const firstSub = sub.subs;
631
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
632
+ if (hasMultipleSubs) {
633
+ link2 = stack.value;
634
+ stack = stack.prev;
635
+ } else {
636
+ link2 = firstSub;
637
+ }
638
+ if (dirty) {
639
+ if (sub.update()) {
640
+ if (hasMultipleSubs) {
641
+ shallowPropagate(firstSub);
642
+ }
643
+ sub = link2.sub;
644
+ continue;
645
+ }
646
+ } else {
647
+ sub.flags &= -33 /* Pending */;
648
+ }
649
+ sub = link2.sub;
650
+ if (link2.nextDep !== void 0) {
651
+ link2 = link2.nextDep;
652
+ continue top;
653
+ }
654
+ dirty = false;
655
+ }
656
+ return dirty;
657
+ } while (true);
658
+ }
659
+ function shallowPropagate(link2) {
660
+ do {
661
+ const sub = link2.sub;
662
+ const nextSub = link2.nextSub;
663
+ const subFlags = sub.flags;
664
+ if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
665
+ sub.flags = subFlags | 16 /* Dirty */;
666
+ }
667
+ link2 = nextSub;
668
+ } while (link2 !== void 0);
669
+ }
670
+ function isValidLink(checkLink, sub) {
671
+ const depsTail = sub.depsTail;
672
+ if (depsTail !== void 0) {
673
+ let link2 = sub.deps;
674
+ do {
675
+ if (link2 === checkLink) {
676
+ return true;
677
+ }
678
+ if (link2 === depsTail) {
679
+ break;
680
+ }
681
+ link2 = link2.nextDep;
682
+ } while (link2 !== void 0);
777
683
  }
684
+ return false;
778
685
  }
779
686
 
780
- let globalVersion = 0;
781
- class Link {
782
- constructor(sub, dep) {
783
- this.sub = sub;
784
- this.dep = dep;
785
- this.version = dep.version;
786
- this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
687
+ const triggerEventInfos = [];
688
+ function onTrack(sub, debugInfo) {
689
+ if (sub.onTrack) {
690
+ sub.onTrack(
691
+ extend(
692
+ {
693
+ effect: sub
694
+ },
695
+ debugInfo
696
+ )
697
+ );
787
698
  }
788
699
  }
789
- class Dep {
790
- constructor(computed) {
791
- this.computed = computed;
792
- this.version = 0;
793
- /**
794
- * Link between this dep and the current active effect
795
- */
796
- this.activeLink = void 0;
797
- /**
798
- * Doubly linked list representing the subscribing effects (tail)
799
- */
800
- this.subs = void 0;
801
- /**
802
- * For object property deps cleanup
803
- */
804
- this.map = void 0;
805
- this.key = void 0;
806
- /**
807
- * Subscriber counter
808
- */
809
- this.sc = 0;
810
- {
811
- this.subsHead = void 0;
812
- }
813
- }
814
- track(debugInfo) {
815
- if (!activeSub || !shouldTrack || activeSub === this.computed) {
816
- return;
817
- }
818
- let link = this.activeLink;
819
- if (link === void 0 || link.sub !== activeSub) {
820
- link = this.activeLink = new Link(activeSub, this);
821
- if (!activeSub.deps) {
822
- activeSub.deps = activeSub.depsTail = link;
823
- } else {
824
- link.prevDep = activeSub.depsTail;
825
- activeSub.depsTail.nextDep = link;
826
- activeSub.depsTail = link;
827
- }
828
- addSub(link);
829
- } else if (link.version === -1) {
830
- link.version = this.version;
831
- if (link.nextDep) {
832
- const next = link.nextDep;
833
- next.prevDep = link.prevDep;
834
- if (link.prevDep) {
835
- link.prevDep.nextDep = next;
836
- }
837
- link.prevDep = activeSub.depsTail;
838
- link.nextDep = void 0;
839
- activeSub.depsTail.nextDep = link;
840
- activeSub.depsTail = link;
841
- if (activeSub.deps === link) {
842
- activeSub.deps = next;
843
- }
844
- }
845
- }
846
- if (activeSub.onTrack) {
847
- activeSub.onTrack(
848
- extend(
849
- {
850
- effect: activeSub
851
- },
852
- debugInfo
853
- )
854
- );
855
- }
856
- return link;
857
- }
858
- trigger(debugInfo) {
859
- this.version++;
860
- globalVersion++;
861
- this.notify(debugInfo);
700
+ function onTrigger(sub) {
701
+ if (sub.onTrigger) {
702
+ const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
703
+ sub.onTrigger(
704
+ extend(
705
+ {
706
+ effect: sub
707
+ },
708
+ debugInfo
709
+ )
710
+ );
862
711
  }
863
- notify(debugInfo) {
864
- startBatch();
865
- try {
866
- if (true) {
867
- for (let head = this.subsHead; head; head = head.nextSub) {
868
- if (head.sub.onTrigger && !(head.sub.flags & 8)) {
869
- head.sub.onTrigger(
870
- extend(
871
- {
872
- effect: head.sub
873
- },
874
- debugInfo
875
- )
876
- );
877
- }
878
- }
879
- }
880
- for (let link = this.subs; link; link = link.prevSub) {
881
- if (link.sub.notify()) {
882
- ;
883
- link.sub.dep.notify();
884
- }
885
- }
886
- } finally {
887
- endBatch();
712
+ }
713
+ function setupOnTrigger(target) {
714
+ Object.defineProperty(target.prototype, "onTrigger", {
715
+ get() {
716
+ return this._onTrigger;
717
+ },
718
+ set(val) {
719
+ if (val && !this._onTrigger) setupFlagsHandler(this);
720
+ this._onTrigger = val;
888
721
  }
889
- }
722
+ });
890
723
  }
891
- function addSub(link) {
892
- link.dep.sc++;
893
- if (link.sub.flags & 4) {
894
- const computed = link.dep.computed;
895
- if (computed && !link.dep.subs) {
896
- computed.flags |= 4 | 16;
897
- for (let l = computed.deps; l; l = l.nextDep) {
898
- addSub(l);
724
+ function setupFlagsHandler(target) {
725
+ target._flags = target.flags;
726
+ Object.defineProperty(target, "flags", {
727
+ get() {
728
+ return target._flags;
729
+ },
730
+ set(value) {
731
+ if (!(target._flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && !!(value & (ReactiveFlags.Dirty | ReactiveFlags.Pending))) {
732
+ onTrigger(this);
899
733
  }
734
+ target._flags = value;
900
735
  }
901
- const currentTail = link.dep.subs;
902
- if (currentTail !== link) {
903
- link.prevSub = currentTail;
904
- if (currentTail) currentTail.nextSub = link;
905
- }
906
- if (link.dep.subsHead === void 0) {
907
- link.dep.subsHead = link;
736
+ });
737
+ }
738
+
739
+ class Dep {
740
+ constructor(map, key) {
741
+ this.map = map;
742
+ this.key = key;
743
+ this._subs = void 0;
744
+ this.subsTail = void 0;
745
+ this.flags = ReactiveFlags.None;
746
+ }
747
+ get subs() {
748
+ return this._subs;
749
+ }
750
+ set subs(value) {
751
+ this._subs = value;
752
+ if (value === void 0) {
753
+ this.map.delete(this.key);
908
754
  }
909
- link.dep.subs = link;
910
755
  }
911
756
  }
912
757
  const targetMap = /* @__PURE__ */ new WeakMap();
@@ -920,36 +765,34 @@ var VueRuntimeDOM = (function (exports) {
920
765
  "Array iterate"
921
766
  );
922
767
  function track(target, type, key) {
923
- if (shouldTrack && activeSub) {
768
+ if (activeSub !== void 0) {
924
769
  let depsMap = targetMap.get(target);
925
770
  if (!depsMap) {
926
771
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
927
772
  }
928
773
  let dep = depsMap.get(key);
929
774
  if (!dep) {
930
- depsMap.set(key, dep = new Dep());
931
- dep.map = depsMap;
932
- dep.key = key;
775
+ depsMap.set(key, dep = new Dep(depsMap, key));
933
776
  }
934
777
  {
935
- dep.track({
778
+ onTrack(activeSub, {
936
779
  target,
937
780
  type,
938
781
  key
939
782
  });
940
783
  }
784
+ link(dep, activeSub);
941
785
  }
942
786
  }
943
787
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
944
788
  const depsMap = targetMap.get(target);
945
789
  if (!depsMap) {
946
- globalVersion++;
947
790
  return;
948
791
  }
949
792
  const run = (dep) => {
950
- if (dep) {
793
+ if (dep !== void 0 && dep.subs !== void 0) {
951
794
  {
952
- dep.trigger({
795
+ triggerEventInfos.push({
953
796
  target,
954
797
  type,
955
798
  key,
@@ -958,6 +801,11 @@ var VueRuntimeDOM = (function (exports) {
958
801
  oldTarget
959
802
  });
960
803
  }
804
+ propagate(dep.subs);
805
+ shallowPropagate(dep.subs);
806
+ {
807
+ triggerEventInfos.pop();
808
+ }
961
809
  }
962
810
  };
963
811
  startBatch();
@@ -1182,11 +1030,11 @@ var VueRuntimeDOM = (function (exports) {
1182
1030
  return res;
1183
1031
  }
1184
1032
  function noTracking(self, method, args = []) {
1185
- pauseTracking();
1186
1033
  startBatch();
1034
+ const prevSub = setActiveSub();
1187
1035
  const res = toRaw(self)[method].apply(self, args);
1036
+ setActiveSub(prevSub);
1188
1037
  endBatch();
1189
- resetTracking();
1190
1038
  return res;
1191
1039
  }
1192
1040
 
@@ -1232,14 +1080,18 @@ var VueRuntimeDOM = (function (exports) {
1232
1080
  return hasOwnProperty;
1233
1081
  }
1234
1082
  }
1083
+ const wasRef = isRef(target);
1235
1084
  const res = Reflect.get(
1236
1085
  target,
1237
1086
  key,
1238
1087
  // if this is a proxy wrapping a ref, return methods using the raw ref
1239
1088
  // as receiver so that we don't have to call `toRaw` on the ref in all
1240
1089
  // its class methods
1241
- isRef(target) ? target : receiver
1090
+ wasRef ? target : receiver
1242
1091
  );
1092
+ if (wasRef && key !== "value") {
1093
+ return res;
1094
+ }
1243
1095
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1244
1096
  return res;
1245
1097
  }
@@ -1691,33 +1543,47 @@ var VueRuntimeDOM = (function (exports) {
1691
1543
  return r ? r["__v_isRef"] === true : false;
1692
1544
  }
1693
1545
  function ref(value) {
1694
- return createRef(value, false);
1546
+ return createRef(value, toReactive);
1695
1547
  }
1696
1548
  function shallowRef(value) {
1697
- return createRef(value, true);
1549
+ return createRef(value);
1698
1550
  }
1699
- function createRef(rawValue, shallow) {
1551
+ function createRef(rawValue, wrap) {
1700
1552
  if (isRef(rawValue)) {
1701
1553
  return rawValue;
1702
1554
  }
1703
- return new RefImpl(rawValue, shallow);
1555
+ return new RefImpl(rawValue, wrap);
1704
1556
  }
1705
1557
  class RefImpl {
1706
- constructor(value, isShallow2) {
1707
- this.dep = new Dep();
1708
- this["__v_isRef"] = true;
1709
- this["__v_isShallow"] = false;
1710
- this._rawValue = isShallow2 ? value : toRaw(value);
1711
- this._value = isShallow2 ? value : toReactive(value);
1712
- this["__v_isShallow"] = isShallow2;
1558
+ // TODO isolatedDeclarations "__v_isShallow"
1559
+ constructor(value, wrap) {
1560
+ this.subs = void 0;
1561
+ this.subsTail = void 0;
1562
+ this.flags = ReactiveFlags.Mutable;
1563
+ /**
1564
+ * @internal
1565
+ */
1566
+ this.__v_isRef = true;
1567
+ // TODO isolatedDeclarations "__v_isRef"
1568
+ /**
1569
+ * @internal
1570
+ */
1571
+ this.__v_isShallow = false;
1572
+ this._oldValue = this._rawValue = wrap ? toRaw(value) : value;
1573
+ this._value = wrap ? wrap(value) : value;
1574
+ this._wrap = wrap;
1575
+ this["__v_isShallow"] = !wrap;
1576
+ }
1577
+ get dep() {
1578
+ return this;
1713
1579
  }
1714
1580
  get value() {
1715
- {
1716
- this.dep.track({
1717
- target: this,
1718
- type: "get",
1719
- key: "value"
1720
- });
1581
+ trackRef(this);
1582
+ if (this.flags & ReactiveFlags.Dirty && this.update()) {
1583
+ const subs = this.subs;
1584
+ if (subs !== void 0) {
1585
+ shallowPropagate(subs);
1586
+ }
1721
1587
  }
1722
1588
  return this._value;
1723
1589
  }
@@ -1726,30 +1592,55 @@ var VueRuntimeDOM = (function (exports) {
1726
1592
  const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1727
1593
  newValue = useDirectValue ? newValue : toRaw(newValue);
1728
1594
  if (hasChanged(newValue, oldValue)) {
1595
+ this.flags |= ReactiveFlags.Dirty;
1729
1596
  this._rawValue = newValue;
1730
- this._value = useDirectValue ? newValue : toReactive(newValue);
1731
- {
1732
- this.dep.trigger({
1733
- target: this,
1734
- type: "set",
1735
- key: "value",
1736
- newValue,
1737
- oldValue
1738
- });
1597
+ this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
1598
+ const subs = this.subs;
1599
+ if (subs !== void 0) {
1600
+ {
1601
+ triggerEventInfos.push({
1602
+ target: this,
1603
+ type: "set",
1604
+ key: "value",
1605
+ newValue,
1606
+ oldValue
1607
+ });
1608
+ }
1609
+ propagate(subs);
1610
+ if (!batchDepth) {
1611
+ flush();
1612
+ }
1613
+ {
1614
+ triggerEventInfos.pop();
1615
+ }
1739
1616
  }
1740
1617
  }
1741
1618
  }
1619
+ update() {
1620
+ this.flags &= ~ReactiveFlags.Dirty;
1621
+ return hasChanged(this._oldValue, this._oldValue = this._rawValue);
1622
+ }
1742
1623
  }
1743
1624
  function triggerRef(ref2) {
1744
- if (ref2.dep) {
1625
+ const dep = ref2.dep;
1626
+ if (dep !== void 0 && dep.subs !== void 0) {
1627
+ propagate(dep.subs);
1628
+ shallowPropagate(dep.subs);
1629
+ if (!batchDepth) {
1630
+ flush();
1631
+ }
1632
+ }
1633
+ }
1634
+ function trackRef(dep) {
1635
+ if (activeSub !== void 0) {
1745
1636
  {
1746
- ref2.dep.trigger({
1747
- target: ref2,
1748
- type: "set",
1749
- key: "value",
1750
- newValue: ref2._value
1637
+ onTrack(activeSub, {
1638
+ target: dep,
1639
+ type: "get",
1640
+ key: "value"
1751
1641
  });
1752
1642
  }
1643
+ link(dep, activeSub);
1753
1644
  }
1754
1645
  }
1755
1646
  function unref(ref2) {
@@ -1775,13 +1666,21 @@ var VueRuntimeDOM = (function (exports) {
1775
1666
  }
1776
1667
  class CustomRefImpl {
1777
1668
  constructor(factory) {
1669
+ this.subs = void 0;
1670
+ this.subsTail = void 0;
1671
+ this.flags = ReactiveFlags.None;
1778
1672
  this["__v_isRef"] = true;
1779
1673
  this._value = void 0;
1780
- const dep = this.dep = new Dep();
1781
- const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1674
+ const { get, set } = factory(
1675
+ () => trackRef(this),
1676
+ () => triggerRef(this)
1677
+ );
1782
1678
  this._get = get;
1783
1679
  this._set = set;
1784
1680
  }
1681
+ get dep() {
1682
+ return this;
1683
+ }
1785
1684
  get value() {
1786
1685
  return this._value = this._get();
1787
1686
  }
@@ -1793,9 +1692,6 @@ var VueRuntimeDOM = (function (exports) {
1793
1692
  return new CustomRefImpl(factory);
1794
1693
  }
1795
1694
  function toRefs(object) {
1796
- if (!isProxy(object)) {
1797
- warn$2(`toRefs() expects a reactive object but received a plain one.`);
1798
- }
1799
1695
  const ret = isArray(object) ? new Array(object.length) : {};
1800
1696
  for (const key in object) {
1801
1697
  ret[key] = propertyToRef(object, key);
@@ -1848,69 +1744,333 @@ var VueRuntimeDOM = (function (exports) {
1848
1744
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1849
1745
  }
1850
1746
 
1851
- class ComputedRefImpl {
1852
- constructor(fn, setter, isSSR) {
1853
- this.fn = fn;
1854
- this.setter = setter;
1855
- /**
1856
- * @internal
1857
- */
1858
- this._value = void 0;
1859
- /**
1860
- * @internal
1861
- */
1862
- this.dep = new Dep(this);
1747
+ class ReactiveEffect {
1748
+ constructor(fn) {
1749
+ this.deps = void 0;
1750
+ this.depsTail = void 0;
1751
+ this.subs = void 0;
1752
+ this.subsTail = void 0;
1753
+ this.flags = ReactiveFlags.Watching | ReactiveFlags.Dirty;
1863
1754
  /**
1864
1755
  * @internal
1865
1756
  */
1866
- this.__v_isRef = true;
1867
- // TODO isolatedDeclarations "__v_isReadonly"
1868
- // A computed is also a subscriber that tracks other deps
1757
+ this.cleanups = [];
1869
1758
  /**
1870
1759
  * @internal
1871
1760
  */
1761
+ this.cleanupsLength = 0;
1762
+ if (fn !== void 0) {
1763
+ this.fn = fn;
1764
+ }
1765
+ if (activeEffectScope) {
1766
+ link(this, activeEffectScope);
1767
+ }
1768
+ }
1769
+ // @ts-expect-error
1770
+ fn() {
1771
+ }
1772
+ get active() {
1773
+ return !(this.flags & 1024);
1774
+ }
1775
+ pause() {
1776
+ this.flags |= 256;
1777
+ }
1778
+ resume() {
1779
+ const flags = this.flags &= -257;
1780
+ if (flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) {
1781
+ this.notify();
1782
+ }
1783
+ }
1784
+ notify() {
1785
+ if (!(this.flags & 256) && this.dirty) {
1786
+ this.run();
1787
+ }
1788
+ }
1789
+ run() {
1790
+ if (!this.active) {
1791
+ return this.fn();
1792
+ }
1793
+ cleanup(this);
1794
+ const prevSub = startTracking(this);
1795
+ try {
1796
+ return this.fn();
1797
+ } finally {
1798
+ endTracking(this, prevSub);
1799
+ const flags = this.flags;
1800
+ if ((flags & (ReactiveFlags.Recursed | 128)) === (ReactiveFlags.Recursed | 128)) {
1801
+ this.flags = flags & ~ReactiveFlags.Recursed;
1802
+ this.notify();
1803
+ }
1804
+ }
1805
+ }
1806
+ stop() {
1807
+ if (!this.active) {
1808
+ return;
1809
+ }
1810
+ this.flags = 1024;
1811
+ let dep = this.deps;
1812
+ while (dep !== void 0) {
1813
+ dep = unlink(dep, this);
1814
+ }
1815
+ const sub = this.subs;
1816
+ if (sub !== void 0) {
1817
+ unlink(sub);
1818
+ }
1819
+ cleanup(this);
1820
+ }
1821
+ get dirty() {
1822
+ const flags = this.flags;
1823
+ if (flags & ReactiveFlags.Dirty) {
1824
+ return true;
1825
+ }
1826
+ if (flags & ReactiveFlags.Pending) {
1827
+ if (checkDirty(this.deps, this)) {
1828
+ this.flags = flags | ReactiveFlags.Dirty;
1829
+ return true;
1830
+ } else {
1831
+ this.flags = flags & ~ReactiveFlags.Pending;
1832
+ }
1833
+ }
1834
+ return false;
1835
+ }
1836
+ }
1837
+ {
1838
+ setupOnTrigger(ReactiveEffect);
1839
+ }
1840
+ function effect(fn, options) {
1841
+ if (fn.effect instanceof ReactiveEffect) {
1842
+ fn = fn.effect.fn;
1843
+ }
1844
+ const e = new ReactiveEffect(fn);
1845
+ if (options) {
1846
+ const { onStop, scheduler } = options;
1847
+ if (onStop) {
1848
+ options.onStop = void 0;
1849
+ const stop2 = e.stop.bind(e);
1850
+ e.stop = () => {
1851
+ stop2();
1852
+ onStop();
1853
+ };
1854
+ }
1855
+ if (scheduler) {
1856
+ options.scheduler = void 0;
1857
+ e.notify = () => {
1858
+ if (!(e.flags & 256)) {
1859
+ scheduler();
1860
+ }
1861
+ };
1862
+ }
1863
+ extend(e, options);
1864
+ }
1865
+ try {
1866
+ e.run();
1867
+ } catch (err) {
1868
+ e.stop();
1869
+ throw err;
1870
+ }
1871
+ const runner = e.run.bind(e);
1872
+ runner.effect = e;
1873
+ return runner;
1874
+ }
1875
+ function stop(runner) {
1876
+ runner.effect.stop();
1877
+ }
1878
+ function cleanup(sub) {
1879
+ const l = sub.cleanupsLength;
1880
+ if (l) {
1881
+ for (let i = 0; i < l; i++) {
1882
+ sub.cleanups[i]();
1883
+ }
1884
+ sub.cleanupsLength = 0;
1885
+ }
1886
+ }
1887
+
1888
+ let activeEffectScope;
1889
+ class EffectScope {
1890
+ constructor(detached = false) {
1872
1891
  this.deps = void 0;
1892
+ this.depsTail = void 0;
1893
+ this.subs = void 0;
1894
+ this.subsTail = void 0;
1895
+ this.flags = 0;
1873
1896
  /**
1874
1897
  * @internal
1875
1898
  */
1876
- this.depsTail = void 0;
1899
+ this.cleanups = [];
1877
1900
  /**
1878
1901
  * @internal
1879
1902
  */
1880
- this.flags = 16;
1903
+ this.cleanupsLength = 0;
1904
+ if (!detached && activeEffectScope) {
1905
+ link(this, activeEffectScope);
1906
+ }
1907
+ }
1908
+ get active() {
1909
+ return !(this.flags & 1024);
1910
+ }
1911
+ pause() {
1912
+ if (!(this.flags & 256)) {
1913
+ this.flags |= 256;
1914
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1915
+ const dep = link2.dep;
1916
+ if ("pause" in dep) {
1917
+ dep.pause();
1918
+ }
1919
+ }
1920
+ }
1921
+ }
1922
+ /**
1923
+ * Resumes the effect scope, including all child scopes and effects.
1924
+ */
1925
+ resume() {
1926
+ const flags = this.flags;
1927
+ if (flags & 256) {
1928
+ this.flags = flags & -257;
1929
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1930
+ const dep = link2.dep;
1931
+ if ("resume" in dep) {
1932
+ dep.resume();
1933
+ }
1934
+ }
1935
+ }
1936
+ }
1937
+ run(fn) {
1938
+ const prevSub = setActiveSub();
1939
+ const prevScope = activeEffectScope;
1940
+ try {
1941
+ activeEffectScope = this;
1942
+ return fn();
1943
+ } finally {
1944
+ activeEffectScope = prevScope;
1945
+ setActiveSub(prevSub);
1946
+ }
1947
+ }
1948
+ stop() {
1949
+ if (!this.active) {
1950
+ return;
1951
+ }
1952
+ this.flags = 1024;
1953
+ let dep = this.deps;
1954
+ while (dep !== void 0) {
1955
+ const node = dep.dep;
1956
+ if ("stop" in node) {
1957
+ dep = dep.nextDep;
1958
+ node.stop();
1959
+ } else {
1960
+ dep = unlink(dep, this);
1961
+ }
1962
+ }
1963
+ const sub = this.subs;
1964
+ if (sub !== void 0) {
1965
+ unlink(sub);
1966
+ }
1967
+ cleanup(this);
1968
+ }
1969
+ }
1970
+ function effectScope(detached) {
1971
+ return new EffectScope(detached);
1972
+ }
1973
+ function getCurrentScope() {
1974
+ return activeEffectScope;
1975
+ }
1976
+ function setCurrentScope(scope) {
1977
+ try {
1978
+ return activeEffectScope;
1979
+ } finally {
1980
+ activeEffectScope = scope;
1981
+ }
1982
+ }
1983
+ function onScopeDispose(fn, failSilently = false) {
1984
+ if (activeEffectScope !== void 0) {
1985
+ activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
1986
+ } else if (!failSilently) {
1987
+ warn$2(
1988
+ `onScopeDispose() is called when there is no active effect scope to be associated with.`
1989
+ );
1990
+ }
1991
+ }
1992
+
1993
+ class ComputedRefImpl {
1994
+ constructor(fn, setter) {
1995
+ this.fn = fn;
1996
+ this.setter = setter;
1881
1997
  /**
1882
1998
  * @internal
1883
1999
  */
1884
- this.globalVersion = globalVersion - 1;
2000
+ this._value = void 0;
2001
+ this.subs = void 0;
2002
+ this.subsTail = void 0;
2003
+ this.deps = void 0;
2004
+ this.depsTail = void 0;
2005
+ this.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
1885
2006
  /**
1886
2007
  * @internal
1887
2008
  */
1888
- this.next = void 0;
1889
- // for backwards compat
1890
- this.effect = this;
2009
+ this.__v_isRef = true;
1891
2010
  this["__v_isReadonly"] = !setter;
1892
- this.isSSR = isSSR;
2011
+ }
2012
+ // TODO isolatedDeclarations "__v_isReadonly"
2013
+ // for backwards compat
2014
+ get effect() {
2015
+ return this;
2016
+ }
2017
+ // for backwards compat
2018
+ get dep() {
2019
+ return this;
1893
2020
  }
1894
2021
  /**
1895
2022
  * @internal
2023
+ * for backwards compat
1896
2024
  */
1897
- notify() {
1898
- this.flags |= 16;
1899
- if (!(this.flags & 8) && // avoid infinite self recursion
1900
- activeSub !== this) {
1901
- batch(this, true);
2025
+ get _dirty() {
2026
+ const flags = this.flags;
2027
+ if (flags & ReactiveFlags.Dirty) {
1902
2028
  return true;
1903
2029
  }
2030
+ if (flags & ReactiveFlags.Pending) {
2031
+ if (checkDirty(this.deps, this)) {
2032
+ this.flags = flags | ReactiveFlags.Dirty;
2033
+ return true;
2034
+ } else {
2035
+ this.flags = flags & ~ReactiveFlags.Pending;
2036
+ }
2037
+ }
2038
+ return false;
2039
+ }
2040
+ /**
2041
+ * @internal
2042
+ * for backwards compat
2043
+ */
2044
+ set _dirty(v) {
2045
+ if (v) {
2046
+ this.flags |= ReactiveFlags.Dirty;
2047
+ } else {
2048
+ this.flags &= ~(ReactiveFlags.Dirty | ReactiveFlags.Pending);
2049
+ }
1904
2050
  }
1905
2051
  get value() {
1906
- const link = this.dep.track({
1907
- target: this,
1908
- type: "get",
1909
- key: "value"
1910
- }) ;
1911
- refreshComputed(this);
1912
- if (link) {
1913
- link.version = this.dep.version;
2052
+ const flags = this.flags;
2053
+ if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) {
2054
+ if (this.update()) {
2055
+ const subs = this.subs;
2056
+ if (subs !== void 0) {
2057
+ shallowPropagate(subs);
2058
+ }
2059
+ }
2060
+ } else if (flags & ReactiveFlags.Pending) {
2061
+ this.flags = flags & ~ReactiveFlags.Pending;
2062
+ }
2063
+ if (activeSub !== void 0) {
2064
+ {
2065
+ onTrack(activeSub, {
2066
+ target: this,
2067
+ type: "get",
2068
+ key: "value"
2069
+ });
2070
+ }
2071
+ link(this, activeSub);
2072
+ } else if (activeEffectScope !== void 0) {
2073
+ link(this, activeEffectScope);
1914
2074
  }
1915
2075
  return this._value;
1916
2076
  }
@@ -1921,6 +2081,23 @@ var VueRuntimeDOM = (function (exports) {
1921
2081
  warn$2("Write operation failed: computed value is readonly");
1922
2082
  }
1923
2083
  }
2084
+ update() {
2085
+ const prevSub = startTracking(this);
2086
+ try {
2087
+ const oldValue = this._value;
2088
+ const newValue = this.fn(oldValue);
2089
+ if (hasChanged(oldValue, newValue)) {
2090
+ this._value = newValue;
2091
+ return true;
2092
+ }
2093
+ return false;
2094
+ } finally {
2095
+ endTracking(this, prevSub);
2096
+ }
2097
+ }
2098
+ }
2099
+ {
2100
+ setupOnTrigger(ComputedRefImpl);
1924
2101
  }
1925
2102
  function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1926
2103
  let getter;
@@ -1931,7 +2108,7 @@ var VueRuntimeDOM = (function (exports) {
1931
2108
  getter = getterOrOptions.get;
1932
2109
  setter = getterOrOptions.set;
1933
2110
  }
1934
- const cRef = new ComputedRefImpl(getter, setter, isSSR);
2111
+ const cRef = new ComputedRefImpl(getter, setter);
1935
2112
  if (debugOptions && !isSSR) {
1936
2113
  cRef.onTrack = debugOptions.onTrack;
1937
2114
  cRef.onTrigger = debugOptions.onTrigger;
@@ -1952,177 +2129,146 @@ var VueRuntimeDOM = (function (exports) {
1952
2129
  };
1953
2130
 
1954
2131
  const INITIAL_WATCHER_VALUE = {};
1955
- const cleanupMap = /* @__PURE__ */ new WeakMap();
1956
2132
  let activeWatcher = void 0;
1957
2133
  function getCurrentWatcher() {
1958
2134
  return activeWatcher;
1959
2135
  }
1960
2136
  function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1961
2137
  if (owner) {
1962
- let cleanups = cleanupMap.get(owner);
1963
- if (!cleanups) cleanupMap.set(owner, cleanups = []);
1964
- cleanups.push(cleanupFn);
2138
+ const { call } = owner.options;
2139
+ if (call) {
2140
+ owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
2141
+ } else {
2142
+ owner.cleanups[owner.cleanupsLength++] = cleanupFn;
2143
+ }
1965
2144
  } else if (!failSilently) {
1966
2145
  warn$2(
1967
2146
  `onWatcherCleanup() was called when there was no active watcher to associate with.`
1968
2147
  );
1969
2148
  }
1970
2149
  }
1971
- function watch$1(source, cb, options = EMPTY_OBJ) {
1972
- const { immediate, deep, once, scheduler, augmentJob, call } = options;
1973
- const warnInvalidSource = (s) => {
1974
- (options.onWarn || warn$2)(
1975
- `Invalid watch source: `,
1976
- s,
1977
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1978
- );
1979
- };
1980
- const reactiveGetter = (source2) => {
1981
- if (deep) return source2;
1982
- if (isShallow(source2) || deep === false || deep === 0)
1983
- return traverse(source2, 1);
1984
- return traverse(source2);
1985
- };
1986
- let effect;
1987
- let getter;
1988
- let cleanup;
1989
- let boundCleanup;
1990
- let forceTrigger = false;
1991
- let isMultiSource = false;
1992
- if (isRef(source)) {
1993
- getter = () => source.value;
1994
- forceTrigger = isShallow(source);
1995
- } else if (isReactive(source)) {
1996
- getter = () => reactiveGetter(source);
1997
- forceTrigger = true;
1998
- } else if (isArray(source)) {
1999
- isMultiSource = true;
2000
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
2001
- getter = () => source.map((s) => {
2002
- if (isRef(s)) {
2003
- return s.value;
2004
- } else if (isReactive(s)) {
2005
- return reactiveGetter(s);
2006
- } else if (isFunction(s)) {
2007
- return call ? call(s, 2) : s();
2150
+ class WatcherEffect extends ReactiveEffect {
2151
+ constructor(source, cb, options = EMPTY_OBJ) {
2152
+ const { deep, once, call, onWarn } = options;
2153
+ let getter;
2154
+ let forceTrigger = false;
2155
+ let isMultiSource = false;
2156
+ if (isRef(source)) {
2157
+ getter = () => source.value;
2158
+ forceTrigger = isShallow(source);
2159
+ } else if (isReactive(source)) {
2160
+ getter = () => reactiveGetter(source, deep);
2161
+ forceTrigger = true;
2162
+ } else if (isArray(source)) {
2163
+ isMultiSource = true;
2164
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
2165
+ getter = () => source.map((s) => {
2166
+ if (isRef(s)) {
2167
+ return s.value;
2168
+ } else if (isReactive(s)) {
2169
+ return reactiveGetter(s, deep);
2170
+ } else if (isFunction(s)) {
2171
+ return call ? call(s, 2) : s();
2172
+ } else {
2173
+ warnInvalidSource(s, onWarn);
2174
+ }
2175
+ });
2176
+ } else if (isFunction(source)) {
2177
+ if (cb) {
2178
+ getter = call ? () => call(source, 2) : source;
2008
2179
  } else {
2009
- warnInvalidSource(s);
2010
- }
2011
- });
2012
- } else if (isFunction(source)) {
2013
- if (cb) {
2014
- getter = call ? () => call(source, 2) : source;
2015
- } else {
2016
- getter = () => {
2017
- if (cleanup) {
2018
- pauseTracking();
2180
+ getter = () => {
2181
+ if (this.cleanupsLength) {
2182
+ const prevSub = setActiveSub();
2183
+ try {
2184
+ cleanup(this);
2185
+ } finally {
2186
+ setActiveSub(prevSub);
2187
+ }
2188
+ }
2189
+ const currentEffect = activeWatcher;
2190
+ activeWatcher = this;
2019
2191
  try {
2020
- cleanup();
2192
+ return call ? call(source, 3, [
2193
+ this.boundCleanup
2194
+ ]) : source(this.boundCleanup);
2021
2195
  } finally {
2022
- resetTracking();
2196
+ activeWatcher = currentEffect;
2023
2197
  }
2024
- }
2025
- const currentEffect = activeWatcher;
2026
- activeWatcher = effect;
2027
- try {
2028
- return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
2029
- } finally {
2030
- activeWatcher = currentEffect;
2031
- }
2198
+ };
2199
+ }
2200
+ } else {
2201
+ getter = NOOP;
2202
+ warnInvalidSource(source, onWarn);
2203
+ }
2204
+ if (cb && deep) {
2205
+ const baseGetter = getter;
2206
+ const depth = deep === true ? Infinity : deep;
2207
+ getter = () => traverse(baseGetter(), depth);
2208
+ }
2209
+ super(getter);
2210
+ this.cb = cb;
2211
+ this.options = options;
2212
+ this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
2213
+ this.forceTrigger = forceTrigger;
2214
+ this.isMultiSource = isMultiSource;
2215
+ if (once && cb) {
2216
+ const _cb = cb;
2217
+ cb = (...args) => {
2218
+ _cb(...args);
2219
+ this.stop();
2032
2220
  };
2033
2221
  }
2034
- } else {
2035
- getter = NOOP;
2036
- warnInvalidSource(source);
2037
- }
2038
- if (cb && deep) {
2039
- const baseGetter = getter;
2040
- const depth = deep === true ? Infinity : deep;
2041
- getter = () => traverse(baseGetter(), depth);
2042
- }
2043
- const scope = getCurrentScope();
2044
- const watchHandle = () => {
2045
- effect.stop();
2046
- if (scope && scope.active) {
2047
- remove(scope.effects, effect);
2222
+ this.cb = cb;
2223
+ this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2224
+ {
2225
+ this.onTrack = options.onTrack;
2226
+ this.onTrigger = options.onTrigger;
2048
2227
  }
2049
- };
2050
- if (once && cb) {
2051
- const _cb = cb;
2052
- cb = (...args) => {
2053
- _cb(...args);
2054
- watchHandle();
2055
- };
2056
2228
  }
2057
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2058
- const job = (immediateFirstRun) => {
2059
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2229
+ run(initialRun = false) {
2230
+ const oldValue = this.oldValue;
2231
+ const newValue = this.oldValue = super.run();
2232
+ if (!this.cb) {
2060
2233
  return;
2061
2234
  }
2062
- if (cb) {
2063
- const newValue = effect.run();
2064
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2065
- if (cleanup) {
2066
- cleanup();
2067
- }
2068
- const currentWatcher = activeWatcher;
2069
- activeWatcher = effect;
2070
- try {
2071
- const args = [
2072
- newValue,
2073
- // pass undefined as the old value when it's changed for the first time
2074
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2075
- boundCleanup
2076
- ];
2077
- oldValue = newValue;
2078
- call ? call(cb, 3, args) : (
2079
- // @ts-expect-error
2080
- cb(...args)
2081
- );
2082
- } finally {
2083
- activeWatcher = currentWatcher;
2084
- }
2085
- }
2086
- } else {
2087
- effect.run();
2235
+ const { immediate, deep, call } = this.options;
2236
+ if (initialRun && !immediate) {
2237
+ return;
2088
2238
  }
2089
- };
2090
- if (augmentJob) {
2091
- augmentJob(job);
2092
- }
2093
- effect = new ReactiveEffect(getter);
2094
- effect.scheduler = scheduler ? () => scheduler(job, false) : job;
2095
- boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
2096
- cleanup = effect.onStop = () => {
2097
- const cleanups = cleanupMap.get(effect);
2098
- if (cleanups) {
2099
- if (call) {
2100
- call(cleanups, 4);
2101
- } else {
2102
- for (const cleanup2 of cleanups) cleanup2();
2239
+ if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2240
+ cleanup(this);
2241
+ const currentWatcher = activeWatcher;
2242
+ activeWatcher = this;
2243
+ try {
2244
+ const args = [
2245
+ newValue,
2246
+ // pass undefined as the old value when it's changed for the first time
2247
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2248
+ this.boundCleanup
2249
+ ];
2250
+ call ? call(this.cb, 3, args) : (
2251
+ // @ts-expect-error
2252
+ this.cb(...args)
2253
+ );
2254
+ } finally {
2255
+ activeWatcher = currentWatcher;
2103
2256
  }
2104
- cleanupMap.delete(effect);
2105
- }
2106
- };
2107
- {
2108
- effect.onTrack = options.onTrack;
2109
- effect.onTrigger = options.onTrigger;
2110
- }
2111
- if (cb) {
2112
- if (immediate) {
2113
- job(true);
2114
- } else {
2115
- oldValue = effect.run();
2116
2257
  }
2117
- } else if (scheduler) {
2118
- scheduler(job.bind(null, true), true);
2119
- } else {
2120
- effect.run();
2121
2258
  }
2122
- watchHandle.pause = effect.pause.bind(effect);
2123
- watchHandle.resume = effect.resume.bind(effect);
2124
- watchHandle.stop = watchHandle;
2125
- return watchHandle;
2259
+ }
2260
+ function reactiveGetter(source, deep) {
2261
+ if (deep) return source;
2262
+ if (isShallow(source) || deep === false || deep === 0)
2263
+ return traverse(source, 1);
2264
+ return traverse(source);
2265
+ }
2266
+ function warnInvalidSource(s, onWarn) {
2267
+ (onWarn || warn$2)(
2268
+ `Invalid watch source: `,
2269
+ s,
2270
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
2271
+ );
2126
2272
  }
2127
2273
  function traverse(value, depth = Infinity, seen) {
2128
2274
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
@@ -2158,8 +2304,8 @@ var VueRuntimeDOM = (function (exports) {
2158
2304
  }
2159
2305
 
2160
2306
  const stack = [];
2161
- function pushWarningContext(vnode) {
2162
- stack.push(vnode);
2307
+ function pushWarningContext(ctx) {
2308
+ stack.push(ctx);
2163
2309
  }
2164
2310
  function popWarningContext() {
2165
2311
  stack.pop();
@@ -2168,8 +2314,9 @@ var VueRuntimeDOM = (function (exports) {
2168
2314
  function warn$1(msg, ...args) {
2169
2315
  if (isWarning) return;
2170
2316
  isWarning = true;
2171
- pauseTracking();
2172
- const instance = stack.length ? stack[stack.length - 1].component : null;
2317
+ const prevSub = setActiveSub();
2318
+ const entry = stack.length ? stack[stack.length - 1] : null;
2319
+ const instance = isVNode(entry) ? entry.component : entry;
2173
2320
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
2174
2321
  const trace = getComponentTrace();
2175
2322
  if (appWarnHandler) {
@@ -2183,9 +2330,9 @@ var VueRuntimeDOM = (function (exports) {
2183
2330
  var _a, _b;
2184
2331
  return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
2185
2332
  }).join(""),
2186
- instance && instance.proxy,
2333
+ instance && instance.proxy || instance,
2187
2334
  trace.map(
2188
- ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
2335
+ ({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
2189
2336
  ).join("\n"),
2190
2337
  trace
2191
2338
  ]
@@ -2199,27 +2346,31 @@ var VueRuntimeDOM = (function (exports) {
2199
2346
  }
2200
2347
  console.warn(...warnArgs);
2201
2348
  }
2202
- resetTracking();
2349
+ setActiveSub(prevSub);
2203
2350
  isWarning = false;
2204
2351
  }
2205
2352
  function getComponentTrace() {
2206
- let currentVNode = stack[stack.length - 1];
2207
- if (!currentVNode) {
2353
+ let currentCtx = stack[stack.length - 1];
2354
+ if (!currentCtx) {
2208
2355
  return [];
2209
2356
  }
2210
2357
  const normalizedStack = [];
2211
- while (currentVNode) {
2358
+ while (currentCtx) {
2212
2359
  const last = normalizedStack[0];
2213
- if (last && last.vnode === currentVNode) {
2360
+ if (last && last.ctx === currentCtx) {
2214
2361
  last.recurseCount++;
2215
2362
  } else {
2216
2363
  normalizedStack.push({
2217
- vnode: currentVNode,
2364
+ ctx: currentCtx,
2218
2365
  recurseCount: 0
2219
2366
  });
2220
2367
  }
2221
- const parentInstance = currentVNode.component && currentVNode.component.parent;
2222
- currentVNode = parentInstance && parentInstance.vnode;
2368
+ if (isVNode(currentCtx)) {
2369
+ const parent = currentCtx.component && currentCtx.component.parent;
2370
+ currentCtx = parent && parent.vnode || parent;
2371
+ } else {
2372
+ currentCtx = currentCtx.parent;
2373
+ }
2223
2374
  }
2224
2375
  return normalizedStack;
2225
2376
  }
@@ -2231,16 +2382,13 @@ var VueRuntimeDOM = (function (exports) {
2231
2382
  });
2232
2383
  return logs;
2233
2384
  }
2234
- function formatTraceEntry({ vnode, recurseCount }) {
2385
+ function formatTraceEntry({ ctx, recurseCount }) {
2235
2386
  const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
2236
- const isRoot = vnode.component ? vnode.component.parent == null : false;
2237
- const open = ` at <${formatComponentName(
2238
- vnode.component,
2239
- vnode.type,
2240
- isRoot
2241
- )}`;
2387
+ const instance = isVNode(ctx) ? ctx.component : ctx;
2388
+ const isRoot = instance ? instance.parent == null : false;
2389
+ const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
2242
2390
  const close = `>` + postfix;
2243
- return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
2391
+ return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
2244
2392
  }
2245
2393
  function formatProps(props) {
2246
2394
  const res = [];
@@ -2372,11 +2520,10 @@ var VueRuntimeDOM = (function (exports) {
2372
2520
  }
2373
2521
  }
2374
2522
  function handleError(err, instance, type, throwInDev = true) {
2375
- const contextVNode = instance ? instance.vnode : null;
2376
2523
  const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
2377
2524
  if (instance) {
2378
2525
  let cur = instance.parent;
2379
- const exposedInstance = instance.proxy;
2526
+ const exposedInstance = instance.proxy || instance;
2380
2527
  const errorInfo = ErrorTypeStrings$1[type] ;
2381
2528
  while (cur) {
2382
2529
  const errorCapturedHooks = cur.ec;
@@ -2390,26 +2537,26 @@ var VueRuntimeDOM = (function (exports) {
2390
2537
  cur = cur.parent;
2391
2538
  }
2392
2539
  if (errorHandler) {
2393
- pauseTracking();
2540
+ const prevSub = setActiveSub();
2394
2541
  callWithErrorHandling(errorHandler, null, 10, [
2395
2542
  err,
2396
2543
  exposedInstance,
2397
2544
  errorInfo
2398
2545
  ]);
2399
- resetTracking();
2546
+ setActiveSub(prevSub);
2400
2547
  return;
2401
2548
  }
2402
2549
  }
2403
- logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
2550
+ logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
2404
2551
  }
2405
- function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
2552
+ function logError(err, type, instance, throwInDev = true, throwInProd = false) {
2406
2553
  {
2407
2554
  const info = ErrorTypeStrings$1[type];
2408
- if (contextVNode) {
2409
- pushWarningContext(contextVNode);
2555
+ if (instance) {
2556
+ pushWarningContext(instance);
2410
2557
  }
2411
2558
  warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
2412
- if (contextVNode) {
2559
+ if (instance) {
2413
2560
  popWarningContext();
2414
2561
  }
2415
2562
  if (throwInDev) {
@@ -2420,26 +2567,23 @@ var VueRuntimeDOM = (function (exports) {
2420
2567
  }
2421
2568
  }
2422
2569
 
2423
- const queue = [];
2424
- let flushIndex = -1;
2425
- const pendingPostFlushCbs = [];
2426
- let activePostFlushCbs = null;
2570
+ const jobs = [];
2571
+ let postJobs = [];
2572
+ let activePostJobs = null;
2573
+ let currentFlushPromise = null;
2574
+ let jobsLength = 0;
2575
+ let flushIndex = 0;
2427
2576
  let postFlushIndex = 0;
2428
2577
  const resolvedPromise = /* @__PURE__ */ Promise.resolve();
2429
- let currentFlushPromise = null;
2430
2578
  const RECURSION_LIMIT = 100;
2431
2579
  function nextTick(fn) {
2432
2580
  const p = currentFlushPromise || resolvedPromise;
2433
2581
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2434
2582
  }
2435
- function findInsertionIndex(id) {
2436
- let start = flushIndex + 1;
2437
- let end = queue.length;
2583
+ function findInsertionIndex(order, queue, start, end) {
2438
2584
  while (start < end) {
2439
2585
  const middle = start + end >>> 1;
2440
- const middleJob = queue[middle];
2441
- const middleJobId = getId(middleJob);
2442
- if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
2586
+ if (queue[middle].order <= order) {
2443
2587
  start = middle + 1;
2444
2588
  } else {
2445
2589
  end = middle;
@@ -2447,130 +2591,168 @@ var VueRuntimeDOM = (function (exports) {
2447
2591
  }
2448
2592
  return start;
2449
2593
  }
2450
- function queueJob(job) {
2451
- if (!(job.flags & 1)) {
2452
- const jobId = getId(job);
2453
- const lastJob = queue[queue.length - 1];
2454
- if (!lastJob || // fast path when the job id is larger than the tail
2455
- !(job.flags & 2) && jobId >= getId(lastJob)) {
2456
- queue.push(job);
2594
+ function queueJob(job, id, isPre = false) {
2595
+ if (queueJobWorker(
2596
+ job,
2597
+ id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1,
2598
+ jobs,
2599
+ jobsLength,
2600
+ flushIndex
2601
+ )) {
2602
+ jobsLength++;
2603
+ queueFlush();
2604
+ }
2605
+ }
2606
+ function queueJobWorker(job, order, queue, length, flushIndex2) {
2607
+ const flags = job.flags;
2608
+ if (!(flags & 1)) {
2609
+ job.flags = flags | 1;
2610
+ job.order = order;
2611
+ if (flushIndex2 === length || // fast path when the job id is larger than the tail
2612
+ order >= queue[length - 1].order) {
2613
+ queue[length] = job;
2457
2614
  } else {
2458
- queue.splice(findInsertionIndex(jobId), 0, job);
2615
+ queue.splice(findInsertionIndex(order, queue, flushIndex2, length), 0, job);
2459
2616
  }
2460
- job.flags |= 1;
2461
- queueFlush();
2617
+ return true;
2462
2618
  }
2619
+ return false;
2463
2620
  }
2621
+ const doFlushJobs = () => {
2622
+ try {
2623
+ flushJobs();
2624
+ } catch (e) {
2625
+ currentFlushPromise = null;
2626
+ throw e;
2627
+ }
2628
+ };
2464
2629
  function queueFlush() {
2465
2630
  if (!currentFlushPromise) {
2466
- currentFlushPromise = resolvedPromise.then(flushJobs);
2631
+ currentFlushPromise = resolvedPromise.then(doFlushJobs);
2467
2632
  }
2468
2633
  }
2469
- function queuePostFlushCb(cb) {
2470
- if (!isArray(cb)) {
2471
- if (activePostFlushCbs && cb.id === -1) {
2472
- activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2473
- } else if (!(cb.flags & 1)) {
2474
- pendingPostFlushCbs.push(cb);
2475
- cb.flags |= 1;
2634
+ function queuePostFlushCb(jobs2, id = Infinity) {
2635
+ if (!isArray(jobs2)) {
2636
+ if (activePostJobs && id === -1) {
2637
+ activePostJobs.splice(postFlushIndex, 0, jobs2);
2638
+ } else {
2639
+ queueJobWorker(jobs2, id, postJobs, postJobs.length, 0);
2476
2640
  }
2477
2641
  } else {
2478
- pendingPostFlushCbs.push(...cb);
2642
+ for (const job of jobs2) {
2643
+ queueJobWorker(job, id, postJobs, postJobs.length, 0);
2644
+ }
2479
2645
  }
2480
2646
  queueFlush();
2481
2647
  }
2482
- function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2648
+ function flushPreFlushCbs(instance, seen) {
2483
2649
  {
2484
2650
  seen = seen || /* @__PURE__ */ new Map();
2485
2651
  }
2486
- for (; i < queue.length; i++) {
2487
- const cb = queue[i];
2488
- if (cb && cb.flags & 2) {
2489
- if (instance && cb.id !== instance.uid) {
2490
- continue;
2491
- }
2492
- if (checkRecursiveUpdates(seen, cb)) {
2493
- continue;
2494
- }
2495
- queue.splice(i, 1);
2496
- i--;
2497
- if (cb.flags & 4) {
2498
- cb.flags &= -2;
2499
- }
2500
- cb();
2501
- if (!(cb.flags & 4)) {
2502
- cb.flags &= -2;
2503
- }
2652
+ for (let i = flushIndex; i < jobsLength; i++) {
2653
+ const cb = jobs[i];
2654
+ if (cb.order & 1 || cb.order === Infinity) {
2655
+ continue;
2656
+ }
2657
+ if (instance && cb.order !== instance.uid * 2) {
2658
+ continue;
2659
+ }
2660
+ if (checkRecursiveUpdates(seen, cb)) {
2661
+ continue;
2662
+ }
2663
+ jobs.splice(i, 1);
2664
+ i--;
2665
+ jobsLength--;
2666
+ if (cb.flags & 2) {
2667
+ cb.flags &= -2;
2668
+ }
2669
+ cb();
2670
+ if (!(cb.flags & 2)) {
2671
+ cb.flags &= -2;
2504
2672
  }
2505
2673
  }
2506
2674
  }
2507
2675
  function flushPostFlushCbs(seen) {
2508
- if (pendingPostFlushCbs.length) {
2509
- const deduped = [...new Set(pendingPostFlushCbs)].sort(
2510
- (a, b) => getId(a) - getId(b)
2511
- );
2512
- pendingPostFlushCbs.length = 0;
2513
- if (activePostFlushCbs) {
2514
- activePostFlushCbs.push(...deduped);
2676
+ if (postJobs.length) {
2677
+ if (activePostJobs) {
2678
+ activePostJobs.push(...postJobs);
2679
+ postJobs.length = 0;
2515
2680
  return;
2516
2681
  }
2517
- activePostFlushCbs = deduped;
2682
+ activePostJobs = postJobs;
2683
+ postJobs = [];
2518
2684
  {
2519
2685
  seen = seen || /* @__PURE__ */ new Map();
2520
2686
  }
2521
- for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
2522
- const cb = activePostFlushCbs[postFlushIndex];
2687
+ while (postFlushIndex < activePostJobs.length) {
2688
+ const cb = activePostJobs[postFlushIndex++];
2523
2689
  if (checkRecursiveUpdates(seen, cb)) {
2524
2690
  continue;
2525
2691
  }
2526
- if (cb.flags & 4) {
2692
+ if (cb.flags & 2) {
2527
2693
  cb.flags &= -2;
2528
2694
  }
2529
- if (!(cb.flags & 8)) cb();
2530
- cb.flags &= -2;
2695
+ if (!(cb.flags & 4)) {
2696
+ try {
2697
+ cb();
2698
+ } finally {
2699
+ cb.flags &= -2;
2700
+ }
2701
+ }
2531
2702
  }
2532
- activePostFlushCbs = null;
2703
+ activePostJobs = null;
2533
2704
  postFlushIndex = 0;
2534
2705
  }
2535
2706
  }
2536
- const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2707
+ let isFlushing = false;
2708
+ function flushOnAppMount() {
2709
+ if (!isFlushing) {
2710
+ isFlushing = true;
2711
+ flushPreFlushCbs();
2712
+ flushPostFlushCbs();
2713
+ isFlushing = false;
2714
+ }
2715
+ }
2537
2716
  function flushJobs(seen) {
2538
2717
  {
2539
- seen = seen || /* @__PURE__ */ new Map();
2718
+ seen || (seen = /* @__PURE__ */ new Map());
2540
2719
  }
2541
- const check = (job) => checkRecursiveUpdates(seen, job) ;
2542
2720
  try {
2543
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
2544
- const job = queue[flushIndex];
2545
- if (job && !(job.flags & 8)) {
2546
- if (check(job)) {
2721
+ while (flushIndex < jobsLength) {
2722
+ const job = jobs[flushIndex];
2723
+ jobs[flushIndex++] = void 0;
2724
+ if (!(job.flags & 4)) {
2725
+ if (checkRecursiveUpdates(seen, job)) {
2547
2726
  continue;
2548
2727
  }
2549
- if (job.flags & 4) {
2728
+ if (job.flags & 2) {
2550
2729
  job.flags &= ~1;
2551
2730
  }
2552
- callWithErrorHandling(
2553
- job,
2554
- job.i,
2555
- job.i ? 15 : 14
2556
- );
2557
- if (!(job.flags & 4)) {
2558
- job.flags &= ~1;
2731
+ try {
2732
+ job();
2733
+ } catch (err) {
2734
+ handleError(
2735
+ err,
2736
+ job.i,
2737
+ job.i ? 15 : 14
2738
+ );
2739
+ } finally {
2740
+ if (!(job.flags & 2)) {
2741
+ job.flags &= ~1;
2742
+ }
2559
2743
  }
2560
2744
  }
2561
2745
  }
2562
2746
  } finally {
2563
- for (; flushIndex < queue.length; flushIndex++) {
2564
- const job = queue[flushIndex];
2565
- if (job) {
2566
- job.flags &= -2;
2567
- }
2747
+ while (flushIndex < jobsLength) {
2748
+ jobs[flushIndex].flags &= -2;
2749
+ jobs[flushIndex++] = void 0;
2568
2750
  }
2569
- flushIndex = -1;
2570
- queue.length = 0;
2751
+ flushIndex = 0;
2752
+ jobsLength = 0;
2571
2753
  flushPostFlushCbs(seen);
2572
2754
  currentFlushPromise = null;
2573
- if (queue.length || pendingPostFlushCbs.length) {
2755
+ if (jobsLength || postJobs.length) {
2574
2756
  flushJobs(seen);
2575
2757
  }
2576
2758
  }
@@ -2637,10 +2819,17 @@ var VueRuntimeDOM = (function (exports) {
2637
2819
  instance.render = newRender;
2638
2820
  normalizeClassComponent(instance.type).render = newRender;
2639
2821
  }
2640
- instance.renderCache = [];
2641
2822
  isHmrUpdating = true;
2642
- instance.update();
2643
- isHmrUpdating = false;
2823
+ if (instance.vapor) {
2824
+ instance.hmrRerender();
2825
+ } else {
2826
+ const i = instance;
2827
+ i.renderCache = [];
2828
+ i.effect.run();
2829
+ }
2830
+ nextTick(() => {
2831
+ isHmrUpdating = false;
2832
+ });
2644
2833
  });
2645
2834
  }
2646
2835
  function reload(id, newComp) {
@@ -2649,42 +2838,54 @@ var VueRuntimeDOM = (function (exports) {
2649
2838
  newComp = normalizeClassComponent(newComp);
2650
2839
  updateComponentDef(record.initialDef, newComp);
2651
2840
  const instances = [...record.instances];
2652
- for (let i = 0; i < instances.length; i++) {
2653
- const instance = instances[i];
2654
- const oldComp = normalizeClassComponent(instance.type);
2655
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2656
- if (!dirtyInstances) {
2657
- if (oldComp !== record.initialDef) {
2658
- updateComponentDef(oldComp, newComp);
2659
- }
2660
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2661
- }
2662
- dirtyInstances.add(instance);
2663
- instance.appContext.propsCache.delete(instance.type);
2664
- instance.appContext.emitsCache.delete(instance.type);
2665
- instance.appContext.optionsCache.delete(instance.type);
2666
- if (instance.ceReload) {
2841
+ if (newComp.vapor) {
2842
+ for (const instance of instances) {
2843
+ instance.hmrReload(newComp);
2844
+ }
2845
+ } else {
2846
+ for (const instance of instances) {
2847
+ const oldComp = normalizeClassComponent(instance.type);
2848
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2849
+ if (!dirtyInstances) {
2850
+ if (oldComp !== record.initialDef) {
2851
+ updateComponentDef(oldComp, newComp);
2852
+ }
2853
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2854
+ }
2667
2855
  dirtyInstances.add(instance);
2668
- instance.ceReload(newComp.styles);
2669
- dirtyInstances.delete(instance);
2670
- } else if (instance.parent) {
2671
- queueJob(() => {
2672
- isHmrUpdating = true;
2673
- instance.parent.update();
2674
- isHmrUpdating = false;
2856
+ instance.appContext.propsCache.delete(instance.type);
2857
+ instance.appContext.emitsCache.delete(instance.type);
2858
+ instance.appContext.optionsCache.delete(instance.type);
2859
+ if (instance.ceReload) {
2860
+ dirtyInstances.add(instance);
2861
+ instance.ceReload(newComp.styles);
2675
2862
  dirtyInstances.delete(instance);
2676
- });
2677
- } else if (instance.appContext.reload) {
2678
- instance.appContext.reload();
2679
- } else if (typeof window !== "undefined") {
2680
- window.location.reload();
2681
- } else {
2682
- console.warn(
2683
- "[HMR] Root or manually mounted instance modified. Full reload required."
2684
- );
2685
- }
2686
- if (instance.root.ce && instance !== instance.root) {
2687
- instance.root.ce._removeChildStyle(oldComp);
2863
+ } else if (instance.parent) {
2864
+ queueJob(() => {
2865
+ isHmrUpdating = true;
2866
+ const parent = instance.parent;
2867
+ if (parent.vapor) {
2868
+ parent.hmrRerender();
2869
+ } else {
2870
+ parent.effect.run();
2871
+ }
2872
+ nextTick(() => {
2873
+ isHmrUpdating = false;
2874
+ });
2875
+ dirtyInstances.delete(instance);
2876
+ });
2877
+ } else if (instance.appContext.reload) {
2878
+ instance.appContext.reload();
2879
+ } else if (typeof window !== "undefined") {
2880
+ window.location.reload();
2881
+ } else {
2882
+ console.warn(
2883
+ "[HMR] Root or manually mounted instance modified. Full reload required."
2884
+ );
2885
+ }
2886
+ if (instance.root.ce && instance !== instance.root) {
2887
+ instance.root.ce._removeChildStyle(oldComp);
2888
+ }
2688
2889
  }
2689
2890
  }
2690
2891
  queuePostFlushCb(() => {
@@ -2897,14 +3098,14 @@ var VueRuntimeDOM = (function (exports) {
2897
3098
  }
2898
3099
  let hook = binding.dir[name];
2899
3100
  if (hook) {
2900
- pauseTracking();
3101
+ const prevSub = setActiveSub();
2901
3102
  callWithAsyncErrorHandling(hook, instance, 8, [
2902
3103
  vnode.el,
2903
3104
  binding,
2904
3105
  vnode,
2905
3106
  prevVNode
2906
3107
  ]);
2907
- resetTracking();
3108
+ setActiveSub(prevSub);
2908
3109
  }
2909
3110
  }
2910
3111
  }
@@ -3004,29 +3205,37 @@ var VueRuntimeDOM = (function (exports) {
3004
3205
  }
3005
3206
  if (isTeleportDeferred(n2.props)) {
3006
3207
  n2.el.__isMounted = false;
3007
- queuePostRenderEffect(() => {
3008
- mountToTarget();
3009
- delete n2.el.__isMounted;
3010
- }, parentSuspense);
3208
+ queuePostRenderEffect(
3209
+ () => {
3210
+ mountToTarget();
3211
+ delete n2.el.__isMounted;
3212
+ },
3213
+ void 0,
3214
+ parentSuspense
3215
+ );
3011
3216
  } else {
3012
3217
  mountToTarget();
3013
3218
  }
3014
3219
  } else {
3015
3220
  if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
3016
- queuePostRenderEffect(() => {
3017
- TeleportImpl.process(
3018
- n1,
3019
- n2,
3020
- container,
3021
- anchor,
3022
- parentComponent,
3023
- parentSuspense,
3024
- namespace,
3025
- slotScopeIds,
3026
- optimized,
3027
- internals
3028
- );
3029
- }, parentSuspense);
3221
+ queuePostRenderEffect(
3222
+ () => {
3223
+ TeleportImpl.process(
3224
+ n1,
3225
+ n2,
3226
+ container,
3227
+ anchor,
3228
+ parentComponent,
3229
+ parentSuspense,
3230
+ namespace,
3231
+ slotScopeIds,
3232
+ optimized,
3233
+ internals
3234
+ );
3235
+ },
3236
+ void 0,
3237
+ parentSuspense
3238
+ );
3030
3239
  return;
3031
3240
  }
3032
3241
  n2.el = n1.el;
@@ -3073,6 +3282,7 @@ var VueRuntimeDOM = (function (exports) {
3073
3282
  container,
3074
3283
  mainAnchor,
3075
3284
  internals,
3285
+ parentComponent,
3076
3286
  1
3077
3287
  );
3078
3288
  } else {
@@ -3092,6 +3302,7 @@ var VueRuntimeDOM = (function (exports) {
3092
3302
  nextTarget,
3093
3303
  null,
3094
3304
  internals,
3305
+ parentComponent,
3095
3306
  0
3096
3307
  );
3097
3308
  } else {
@@ -3107,6 +3318,7 @@ var VueRuntimeDOM = (function (exports) {
3107
3318
  target,
3108
3319
  targetAnchor,
3109
3320
  internals,
3321
+ parentComponent,
3110
3322
  1
3111
3323
  );
3112
3324
  }
@@ -3146,7 +3358,7 @@ var VueRuntimeDOM = (function (exports) {
3146
3358
  move: moveTeleport,
3147
3359
  hydrate: hydrateTeleport
3148
3360
  };
3149
- function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
3361
+ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, parentComponent, moveType = 2) {
3150
3362
  if (moveType === 0) {
3151
3363
  insert(vnode.targetAnchor, container, parentAnchor);
3152
3364
  }
@@ -3162,7 +3374,8 @@ var VueRuntimeDOM = (function (exports) {
3162
3374
  children[i],
3163
3375
  container,
3164
3376
  parentAnchor,
3165
- 2
3377
+ 2,
3378
+ parentComponent
3166
3379
  );
3167
3380
  }
3168
3381
  }
@@ -3347,7 +3560,7 @@ var VueRuntimeDOM = (function (exports) {
3347
3560
  state.isLeaving = true;
3348
3561
  leavingHooks.afterLeave = () => {
3349
3562
  state.isLeaving = false;
3350
- if (!(instance.job.flags & 8)) {
3563
+ if (!(instance.job.flags & 4)) {
3351
3564
  instance.update();
3352
3565
  }
3353
3566
  delete leavingHooks.afterLeave;
@@ -3626,7 +3839,7 @@ var VueRuntimeDOM = (function (exports) {
3626
3839
  }
3627
3840
 
3628
3841
  function useId() {
3629
- const i = getCurrentInstance();
3842
+ const i = getCurrentGenericInstance();
3630
3843
  if (i) {
3631
3844
  return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
3632
3845
  } else {
@@ -3642,7 +3855,7 @@ var VueRuntimeDOM = (function (exports) {
3642
3855
 
3643
3856
  const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
3644
3857
  function useTemplateRef(key) {
3645
- const i = getCurrentInstance();
3858
+ const i = getCurrentGenericInstance();
3646
3859
  const r = shallowRef(null);
3647
3860
  if (i) {
3648
3861
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
@@ -3762,8 +3975,7 @@ var VueRuntimeDOM = (function (exports) {
3762
3975
  }
3763
3976
  };
3764
3977
  if (value) {
3765
- doSet.id = -1;
3766
- queuePostRenderEffect(doSet, parentSuspense);
3978
+ queuePostRenderEffect(doSet, -1, parentSuspense);
3767
3979
  } else {
3768
3980
  doSet();
3769
3981
  }
@@ -3931,6 +4143,9 @@ var VueRuntimeDOM = (function (exports) {
3931
4143
  );
3932
4144
  }
3933
4145
  } else if (shapeFlag & 6) {
4146
+ if (vnode.type.__vapor) {
4147
+ throw new Error("Vapor component hydration is not supported yet.");
4148
+ }
3934
4149
  vnode.slotScopeIds = slotScopeIds;
3935
4150
  const container = parentNode(node);
3936
4151
  if (isFragmentStart) {
@@ -4092,11 +4307,15 @@ Server rendered element contains more child nodes than client vdom.`
4092
4307
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4093
4308
  }
4094
4309
  if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
4095
- queueEffectWithSuspense(() => {
4096
- vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4097
- needCallTransitionHooks && transition.enter(el);
4098
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4099
- }, parentSuspense);
4310
+ queueEffectWithSuspense(
4311
+ () => {
4312
+ vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4313
+ needCallTransitionHooks && transition.enter(el);
4314
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4315
+ },
4316
+ void 0,
4317
+ parentSuspense
4318
+ );
4100
4319
  }
4101
4320
  }
4102
4321
  return el.nextSibling;
@@ -4376,14 +4595,16 @@ Server rendered element contains fewer child nodes than client vdom.`
4376
4595
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4377
4596
  const cssVars = instance.getCssVars();
4378
4597
  for (const key in cssVars) {
4379
- expectedMap.set(
4380
- `--${getEscapedCssVarName(key)}`,
4381
- String(cssVars[key])
4382
- );
4598
+ const value = normalizeCssVarValue(cssVars[key]);
4599
+ expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
4383
4600
  }
4384
4601
  }
4385
4602
  if (vnode === root && instance.parent) {
4386
- resolveCssVars(instance.parent, instance.vnode, expectedMap);
4603
+ resolveCssVars(
4604
+ instance.parent,
4605
+ instance.vnode,
4606
+ expectedMap
4607
+ );
4387
4608
  }
4388
4609
  }
4389
4610
  const allowMismatchAttr = "data-allow-mismatch";
@@ -4410,7 +4631,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4410
4631
  if (allowedType === 0 /* TEXT */ && list.includes("children")) {
4411
4632
  return true;
4412
4633
  }
4413
- return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
4634
+ return list.includes(MismatchTypeString[allowedType]);
4414
4635
  }
4415
4636
  }
4416
4637
 
@@ -4642,7 +4863,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4642
4863
  }
4643
4864
  load().then(() => {
4644
4865
  loaded.value = true;
4645
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4866
+ if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
4646
4867
  instance.parent.update();
4647
4868
  }
4648
4869
  }).catch((err) => {
@@ -4685,15 +4906,15 @@ Server rendered element contains fewer child nodes than client vdom.`
4685
4906
  max: [String, Number]
4686
4907
  },
4687
4908
  setup(props, { slots }) {
4688
- const instance = getCurrentInstance();
4689
- const sharedContext = instance.ctx;
4909
+ const keepAliveInstance = getCurrentInstance();
4910
+ const sharedContext = keepAliveInstance.ctx;
4690
4911
  const cache = /* @__PURE__ */ new Map();
4691
4912
  const keys = /* @__PURE__ */ new Set();
4692
4913
  let current = null;
4693
4914
  {
4694
- instance.__v_cache = cache;
4915
+ keepAliveInstance.__v_cache = cache;
4695
4916
  }
4696
- const parentSuspense = instance.suspense;
4917
+ const parentSuspense = keepAliveInstance.suspense;
4697
4918
  const {
4698
4919
  renderer: {
4699
4920
  p: patch,
@@ -4704,58 +4925,80 @@ Server rendered element contains fewer child nodes than client vdom.`
4704
4925
  } = sharedContext;
4705
4926
  const storageContainer = createElement("div");
4706
4927
  sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
4707
- const instance2 = vnode.component;
4708
- move(vnode, container, anchor, 0, parentSuspense);
4928
+ const instance = vnode.component;
4929
+ move(
4930
+ vnode,
4931
+ container,
4932
+ anchor,
4933
+ 0,
4934
+ keepAliveInstance,
4935
+ parentSuspense
4936
+ );
4709
4937
  patch(
4710
- instance2.vnode,
4938
+ instance.vnode,
4711
4939
  vnode,
4712
4940
  container,
4713
4941
  anchor,
4714
- instance2,
4942
+ instance,
4715
4943
  parentSuspense,
4716
4944
  namespace,
4717
4945
  vnode.slotScopeIds,
4718
4946
  optimized
4719
4947
  );
4720
- queuePostRenderEffect(() => {
4721
- instance2.isDeactivated = false;
4722
- if (instance2.a) {
4723
- invokeArrayFns(instance2.a);
4724
- }
4725
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4726
- if (vnodeHook) {
4727
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4728
- }
4729
- }, parentSuspense);
4948
+ queuePostRenderEffect(
4949
+ () => {
4950
+ instance.isDeactivated = false;
4951
+ if (instance.a) {
4952
+ invokeArrayFns(instance.a);
4953
+ }
4954
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4955
+ if (vnodeHook) {
4956
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
4957
+ }
4958
+ },
4959
+ void 0,
4960
+ parentSuspense
4961
+ );
4730
4962
  {
4731
- devtoolsComponentAdded(instance2);
4963
+ devtoolsComponentAdded(instance);
4732
4964
  }
4733
4965
  };
4734
4966
  sharedContext.deactivate = (vnode) => {
4735
- const instance2 = vnode.component;
4736
- invalidateMount(instance2.m);
4737
- invalidateMount(instance2.a);
4738
- move(vnode, storageContainer, null, 1, parentSuspense);
4739
- queuePostRenderEffect(() => {
4740
- if (instance2.da) {
4741
- invokeArrayFns(instance2.da);
4742
- }
4743
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4744
- if (vnodeHook) {
4745
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4746
- }
4747
- instance2.isDeactivated = true;
4748
- }, parentSuspense);
4967
+ const instance = vnode.component;
4968
+ invalidateMount(instance.m);
4969
+ invalidateMount(instance.a);
4970
+ move(
4971
+ vnode,
4972
+ storageContainer,
4973
+ null,
4974
+ 1,
4975
+ keepAliveInstance,
4976
+ parentSuspense
4977
+ );
4978
+ queuePostRenderEffect(
4979
+ () => {
4980
+ if (instance.da) {
4981
+ invokeArrayFns(instance.da);
4982
+ }
4983
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4984
+ if (vnodeHook) {
4985
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
4986
+ }
4987
+ instance.isDeactivated = true;
4988
+ },
4989
+ void 0,
4990
+ parentSuspense
4991
+ );
4749
4992
  {
4750
- devtoolsComponentAdded(instance2);
4993
+ devtoolsComponentAdded(instance);
4751
4994
  }
4752
4995
  {
4753
- instance2.__keepAliveStorageContainer = storageContainer;
4996
+ instance.__keepAliveStorageContainer = storageContainer;
4754
4997
  }
4755
4998
  };
4756
4999
  function unmount(vnode) {
4757
5000
  resetShapeFlag(vnode);
4758
- _unmount(vnode, instance, parentSuspense, true);
5001
+ _unmount(vnode, keepAliveInstance, parentSuspense, true);
4759
5002
  }
4760
5003
  function pruneCache(filter) {
4761
5004
  cache.forEach((vnode, key) => {
@@ -4787,12 +5030,19 @@ Server rendered element contains fewer child nodes than client vdom.`
4787
5030
  let pendingCacheKey = null;
4788
5031
  const cacheSubtree = () => {
4789
5032
  if (pendingCacheKey != null) {
4790
- if (isSuspense(instance.subTree.type)) {
4791
- queuePostRenderEffect(() => {
4792
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4793
- }, instance.subTree.suspense);
5033
+ if (isSuspense(keepAliveInstance.subTree.type)) {
5034
+ queuePostRenderEffect(
5035
+ () => {
5036
+ cache.set(
5037
+ pendingCacheKey,
5038
+ getInnerChild(keepAliveInstance.subTree)
5039
+ );
5040
+ },
5041
+ void 0,
5042
+ keepAliveInstance.subTree.suspense
5043
+ );
4794
5044
  } else {
4795
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5045
+ cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
4796
5046
  }
4797
5047
  }
4798
5048
  };
@@ -4800,12 +5050,12 @@ Server rendered element contains fewer child nodes than client vdom.`
4800
5050
  onUpdated(cacheSubtree);
4801
5051
  onBeforeUnmount(() => {
4802
5052
  cache.forEach((cached) => {
4803
- const { subTree, suspense } = instance;
5053
+ const { subTree, suspense } = keepAliveInstance;
4804
5054
  const vnode = getInnerChild(subTree);
4805
5055
  if (cached.type === vnode.type && cached.key === vnode.key) {
4806
5056
  resetShapeFlag(vnode);
4807
5057
  const da = vnode.component.da;
4808
- da && queuePostRenderEffect(da, suspense);
5058
+ da && queuePostRenderEffect(da, void 0, suspense);
4809
5059
  return;
4810
5060
  }
4811
5061
  unmount(cached);
@@ -4891,7 +5141,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4891
5141
  function onDeactivated(hook, target) {
4892
5142
  registerKeepAliveHook(hook, "da", target);
4893
5143
  }
4894
- function registerKeepAliveHook(hook, type, target = currentInstance) {
5144
+ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
4895
5145
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
4896
5146
  let current = target;
4897
5147
  while (current) {
@@ -4905,7 +5155,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4905
5155
  injectHook(type, wrappedHook, target);
4906
5156
  if (target) {
4907
5157
  let current = target.parent;
4908
- while (current && current.parent) {
5158
+ while (current && current.parent && current.parent.vnode) {
4909
5159
  if (isKeepAlive(current.parent.vnode)) {
4910
5160
  injectToKeepAliveRoot(wrappedHook, type, target, current);
4911
5161
  }
@@ -4937,12 +5187,14 @@ Server rendered element contains fewer child nodes than client vdom.`
4937
5187
  if (target) {
4938
5188
  const hooks = target[type] || (target[type] = []);
4939
5189
  const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
4940
- pauseTracking();
4941
- const reset = setCurrentInstance(target);
4942
- const res = callWithAsyncErrorHandling(hook, target, type, args);
4943
- reset();
4944
- resetTracking();
4945
- return res;
5190
+ const prevSub = setActiveSub();
5191
+ const prev = setCurrentInstance(target);
5192
+ try {
5193
+ return callWithAsyncErrorHandling(hook, target, type, args);
5194
+ } finally {
5195
+ setCurrentInstance(...prev);
5196
+ setActiveSub(prevSub);
5197
+ }
4946
5198
  });
4947
5199
  if (prepend) {
4948
5200
  hooks.unshift(wrappedHook);
@@ -5013,7 +5265,11 @@ Server rendered element contains fewer child nodes than client vdom.`
5013
5265
  const res = (
5014
5266
  // local registration
5015
5267
  // check instance[type] first which is resolved for options API
5016
- resolve(instance[type] || Component[type], name) || // global registration
5268
+ resolve(
5269
+ instance[type] || Component[type],
5270
+ name
5271
+ ) || // global registration
5272
+ // @ts-expect-error filters only exist in compat mode
5017
5273
  resolve(instance.appContext[type], name)
5018
5274
  );
5019
5275
  if (!res && maybeSelfReference) {
@@ -5107,7 +5363,13 @@ If this is a native custom element, make sure to exclude it from component resol
5107
5363
  }
5108
5364
 
5109
5365
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5110
- if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5366
+ let slot = slots[name];
5367
+ if (slot && slot.__vapor) {
5368
+ const ret = (openBlock(), createBlock(VaporSlot, props));
5369
+ ret.vs = { slot, fallback };
5370
+ return ret;
5371
+ }
5372
+ if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
5111
5373
  if (name !== "default") props.name = name;
5112
5374
  return openBlock(), createBlock(
5113
5375
  Fragment,
@@ -5116,7 +5378,6 @@ If this is a native custom element, make sure to exclude it from component resol
5116
5378
  64
5117
5379
  );
5118
5380
  }
5119
- let slot = slots[name];
5120
5381
  if (slot && slot.length > 1) {
5121
5382
  warn$1(
5122
5383
  `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`
@@ -5171,8 +5432,9 @@ If this is a native custom element, make sure to exclude it from component resol
5171
5432
  }
5172
5433
 
5173
5434
  const getPublicInstance = (i) => {
5174
- if (!i) return null;
5175
- if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5435
+ if (!i || i.vapor) return null;
5436
+ if (isStatefulComponent(i))
5437
+ return getComponentPublicInstance(i);
5176
5438
  return getPublicInstance(i.parent);
5177
5439
  };
5178
5440
  const publicPropertiesMap = (
@@ -5465,11 +5727,16 @@ If this is a native custom element, make sure to exclude it from component resol
5465
5727
  return getContext().attrs;
5466
5728
  }
5467
5729
  function getContext() {
5468
- const i = getCurrentInstance();
5730
+ const i = getCurrentGenericInstance();
5469
5731
  if (!i) {
5470
5732
  warn$1(`useContext() called without active instance.`);
5471
5733
  }
5472
- return i.setupContext || (i.setupContext = createSetupContext(i));
5734
+ if (i.vapor) {
5735
+ return i;
5736
+ } else {
5737
+ const ii = i;
5738
+ return ii.setupContext || (ii.setupContext = createSetupContext(ii));
5739
+ }
5473
5740
  }
5474
5741
  function normalizePropsOrEmits(props) {
5475
5742
  return isArray(props) ? props.reduce(
@@ -5517,14 +5784,14 @@ If this is a native custom element, make sure to exclude it from component resol
5517
5784
  return ret;
5518
5785
  }
5519
5786
  function withAsyncContext(getAwaitable) {
5520
- const ctx = getCurrentInstance();
5787
+ const ctx = getCurrentGenericInstance();
5521
5788
  if (!ctx) {
5522
5789
  warn$1(
5523
5790
  `withAsyncContext called without active current instance. This is likely a bug.`
5524
5791
  );
5525
5792
  }
5526
5793
  let awaitable = getAwaitable();
5527
- unsetCurrentInstance();
5794
+ setCurrentInstance(null, void 0);
5528
5795
  if (isPromise(awaitable)) {
5529
5796
  awaitable = awaitable.catch((e) => {
5530
5797
  setCurrentInstance(ctx);
@@ -5968,7 +6235,7 @@ If this is a native custom element, make sure to exclude it from component resol
5968
6235
  };
5969
6236
  }
5970
6237
  let uid$1 = 0;
5971
- function createAppAPI(render, hydrate) {
6238
+ function createAppAPI(mount, unmount, getPublicInstance, render) {
5972
6239
  return function createApp(rootComponent, rootProps = null) {
5973
6240
  if (!isFunction(rootComponent)) {
5974
6241
  rootComponent = extend({}, rootComponent);
@@ -6061,33 +6328,15 @@ If this is a native custom element, make sure to exclude it from component resol
6061
6328
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6062
6329
  );
6063
6330
  }
6064
- const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
6065
- vnode.appContext = context;
6066
- if (namespace === true) {
6067
- namespace = "svg";
6068
- } else if (namespace === false) {
6069
- namespace = void 0;
6070
- }
6331
+ const instance = mount(app, rootContainer, isHydrate, namespace);
6071
6332
  {
6072
- context.reload = () => {
6073
- const cloned = cloneVNode(vnode);
6074
- cloned.el = null;
6075
- render(cloned, rootContainer, namespace);
6076
- };
6077
- }
6078
- if (isHydrate && hydrate) {
6079
- hydrate(vnode, rootContainer);
6080
- } else {
6081
- render(vnode, rootContainer, namespace);
6333
+ app._instance = instance;
6334
+ devtoolsInitApp(app, version);
6082
6335
  }
6083
6336
  isMounted = true;
6084
6337
  app._container = rootContainer;
6085
6338
  rootContainer.__vue_app__ = app;
6086
- {
6087
- app._instance = vnode.component;
6088
- devtoolsInitApp(app, version);
6089
- }
6090
- return getComponentPublicInstance(vnode.component);
6339
+ return getPublicInstance(instance);
6091
6340
  } else {
6092
6341
  warn$1(
6093
6342
  `App has already been mounted.
@@ -6110,7 +6359,7 @@ If you want to remount the same app, move your app creation logic into a factory
6110
6359
  app._instance,
6111
6360
  16
6112
6361
  );
6113
- render(null, app._container);
6362
+ unmount(app);
6114
6363
  {
6115
6364
  app._instance = null;
6116
6365
  devtoolsUnmountApp(app);
@@ -6151,6 +6400,7 @@ If you want to remount the same app, move your app creation logic into a factory
6151
6400
  let currentApp = null;
6152
6401
 
6153
6402
  function provide(key, value) {
6403
+ const currentInstance = getCurrentGenericInstance();
6154
6404
  if (!currentInstance) {
6155
6405
  {
6156
6406
  warn$1(`provide() can only be used inside setup().`);
@@ -6165,9 +6415,9 @@ If you want to remount the same app, move your app creation logic into a factory
6165
6415
  }
6166
6416
  }
6167
6417
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
6168
- const instance = currentInstance || currentRenderingInstance;
6418
+ const instance = getCurrentGenericInstance();
6169
6419
  if (instance || currentApp) {
6170
- let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
6420
+ let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.appContext && instance.appContext.provides : instance.parent.provides : void 0;
6171
6421
  if (provides && key in provides) {
6172
6422
  return provides[key];
6173
6423
  } else if (arguments.length > 1) {
@@ -6180,7 +6430,7 @@ If you want to remount the same app, move your app creation logic into a factory
6180
6430
  }
6181
6431
  }
6182
6432
  function hasInjectionContext() {
6183
- return !!(currentInstance || currentRenderingInstance || currentApp);
6433
+ return !!(getCurrentGenericInstance() || currentApp);
6184
6434
  }
6185
6435
 
6186
6436
  const internalObjectProto = {};
@@ -6188,7 +6438,7 @@ If you want to remount the same app, move your app creation logic into a factory
6188
6438
  const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
6189
6439
 
6190
6440
  function initProps(instance, rawProps, isStateful, isSSR = false) {
6191
- const props = {};
6441
+ const props = instance.props = {};
6192
6442
  const attrs = createInternalObject();
6193
6443
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6194
6444
  setFullProps(instance, rawProps, props, attrs);
@@ -6198,7 +6448,7 @@ If you want to remount the same app, move your app creation logic into a factory
6198
6448
  }
6199
6449
  }
6200
6450
  {
6201
- validateProps(rawProps || {}, props, instance);
6451
+ validateProps(rawProps || {}, props, instance.propsOptions[0]);
6202
6452
  }
6203
6453
  if (isStateful) {
6204
6454
  instance.props = isSSR ? props : shallowReactive(props);
@@ -6250,11 +6500,10 @@ If you want to remount the same app, move your app creation logic into a factory
6250
6500
  const camelizedKey = camelize(key);
6251
6501
  props[camelizedKey] = resolvePropValue(
6252
6502
  options,
6253
- rawCurrentProps,
6254
6503
  camelizedKey,
6255
6504
  value,
6256
6505
  instance,
6257
- false
6506
+ baseResolveDefault
6258
6507
  );
6259
6508
  }
6260
6509
  } else {
@@ -6281,10 +6530,10 @@ If you want to remount the same app, move your app creation logic into a factory
6281
6530
  rawPrevProps[kebabKey] !== void 0)) {
6282
6531
  props[key] = resolvePropValue(
6283
6532
  options,
6284
- rawCurrentProps,
6285
6533
  key,
6286
6534
  void 0,
6287
6535
  instance,
6536
+ baseResolveDefault,
6288
6537
  true
6289
6538
  );
6290
6539
  }
@@ -6306,7 +6555,7 @@ If you want to remount the same app, move your app creation logic into a factory
6306
6555
  trigger(instance.attrs, "set", "");
6307
6556
  }
6308
6557
  {
6309
- validateProps(rawProps || {}, props, instance);
6558
+ validateProps(rawProps || {}, props, instance.propsOptions[0]);
6310
6559
  }
6311
6560
  }
6312
6561
  function setFullProps(instance, rawProps, props, attrs) {
@@ -6335,39 +6584,37 @@ If you want to remount the same app, move your app creation logic into a factory
6335
6584
  }
6336
6585
  }
6337
6586
  if (needCastKeys) {
6338
- const rawCurrentProps = toRaw(props);
6339
6587
  const castValues = rawCastValues || EMPTY_OBJ;
6340
6588
  for (let i = 0; i < needCastKeys.length; i++) {
6341
6589
  const key = needCastKeys[i];
6342
6590
  props[key] = resolvePropValue(
6343
6591
  options,
6344
- rawCurrentProps,
6345
6592
  key,
6346
6593
  castValues[key],
6347
6594
  instance,
6595
+ baseResolveDefault,
6348
6596
  !hasOwn(castValues, key)
6349
6597
  );
6350
6598
  }
6351
6599
  }
6352
6600
  return hasAttrsChanged;
6353
6601
  }
6354
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6602
+ function resolvePropValue(options, key, value, instance, resolveDefault, isAbsent = false) {
6355
6603
  const opt = options[key];
6356
6604
  if (opt != null) {
6357
6605
  const hasDefault = hasOwn(opt, "default");
6358
6606
  if (hasDefault && value === void 0) {
6359
6607
  const defaultValue = opt.default;
6360
6608
  if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6361
- const { propsDefaults } = instance;
6362
- if (key in propsDefaults) {
6363
- value = propsDefaults[key];
6609
+ const cachedDefaults = instance.propsDefaults || (instance.propsDefaults = {});
6610
+ if (hasOwn(cachedDefaults, key)) {
6611
+ value = cachedDefaults[key];
6364
6612
  } else {
6365
- const reset = setCurrentInstance(instance);
6366
- value = propsDefaults[key] = defaultValue.call(
6367
- null,
6368
- props
6613
+ value = cachedDefaults[key] = resolveDefault(
6614
+ defaultValue,
6615
+ instance,
6616
+ key
6369
6617
  );
6370
- reset();
6371
6618
  }
6372
6619
  } else {
6373
6620
  value = defaultValue;
@@ -6386,6 +6633,17 @@ If you want to remount the same app, move your app creation logic into a factory
6386
6633
  }
6387
6634
  return value;
6388
6635
  }
6636
+ function baseResolveDefault(factory, instance, key) {
6637
+ let value;
6638
+ const prev = setCurrentInstance(instance);
6639
+ const props = toRaw(instance.props);
6640
+ value = factory.call(
6641
+ null,
6642
+ props
6643
+ );
6644
+ setCurrentInstance(...prev);
6645
+ return value;
6646
+ }
6389
6647
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
6390
6648
  function normalizePropsOptions(comp, appContext, asMixin = false) {
6391
6649
  const cache = asMixin ? mixinPropsCache : appContext.propsCache;
@@ -6420,6 +6678,14 @@ If you want to remount the same app, move your app creation logic into a factory
6420
6678
  }
6421
6679
  return EMPTY_ARR;
6422
6680
  }
6681
+ baseNormalizePropsOptions(raw, normalized, needCastKeys);
6682
+ const res = [normalized, needCastKeys];
6683
+ if (isObject(comp)) {
6684
+ cache.set(comp, res);
6685
+ }
6686
+ return res;
6687
+ }
6688
+ function baseNormalizePropsOptions(raw, normalized, needCastKeys) {
6423
6689
  if (isArray(raw)) {
6424
6690
  for (let i = 0; i < raw.length; i++) {
6425
6691
  if (!isString(raw[i])) {
@@ -6464,11 +6730,6 @@ If you want to remount the same app, move your app creation logic into a factory
6464
6730
  }
6465
6731
  }
6466
6732
  }
6467
- const res = [normalized, needCastKeys];
6468
- if (isObject(comp)) {
6469
- cache.set(comp, res);
6470
- }
6471
- return res;
6472
6733
  }
6473
6734
  function validatePropName(key) {
6474
6735
  if (key[0] !== "$" && !isReservedProp(key)) {
@@ -6490,26 +6751,26 @@ If you want to remount the same app, move your app creation logic into a factory
6490
6751
  }
6491
6752
  return "";
6492
6753
  }
6493
- function validateProps(rawProps, props, instance) {
6494
- const resolvedValues = toRaw(props);
6495
- const options = instance.propsOptions[0];
6754
+ function validateProps(rawProps, resolvedProps, options) {
6755
+ resolvedProps = toRaw(resolvedProps);
6496
6756
  const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
6497
6757
  for (const key in options) {
6498
- let opt = options[key];
6499
- if (opt == null) continue;
6500
- validateProp(
6501
- key,
6502
- resolvedValues[key],
6503
- opt,
6504
- shallowReadonly(resolvedValues) ,
6505
- !camelizePropsKey.includes(key)
6506
- );
6758
+ const opt = options[key];
6759
+ if (opt != null) {
6760
+ validateProp(
6761
+ key,
6762
+ resolvedProps[key],
6763
+ opt,
6764
+ resolvedProps,
6765
+ !camelizePropsKey.includes(key)
6766
+ );
6767
+ }
6507
6768
  }
6508
6769
  }
6509
- function validateProp(name, value, prop, props, isAbsent) {
6510
- const { type, required, validator, skipCheck } = prop;
6770
+ function validateProp(key, value, propOptions, resolvedProps, isAbsent) {
6771
+ const { type, required, validator, skipCheck } = propOptions;
6511
6772
  if (required && isAbsent) {
6512
- warn$1('Missing required prop: "' + name + '"');
6773
+ warn$1('Missing required prop: "' + key + '"');
6513
6774
  return;
6514
6775
  }
6515
6776
  if (value == null && !required) {
@@ -6525,12 +6786,12 @@ If you want to remount the same app, move your app creation logic into a factory
6525
6786
  isValid = valid;
6526
6787
  }
6527
6788
  if (!isValid) {
6528
- warn$1(getInvalidTypeMessage(name, value, expectedTypes));
6789
+ warn$1(getInvalidTypeMessage(key, value, expectedTypes));
6529
6790
  return;
6530
6791
  }
6531
6792
  }
6532
- if (validator && !validator(value, props)) {
6533
- warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
6793
+ if (validator && !validator(value, shallowReadonly(resolvedProps) )) {
6794
+ warn$1('Invalid prop: custom validator check failed for prop "' + key + '".');
6534
6795
  }
6535
6796
  }
6536
6797
  const isSimpleType = /* @__PURE__ */ makeMap(
@@ -6601,7 +6862,7 @@ If you want to remount the same app, move your app creation logic into a factory
6601
6862
  return rawSlot;
6602
6863
  }
6603
6864
  const normalized = withCtx((...args) => {
6604
- if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
6865
+ if (currentInstance && !currentInstance.vapor && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
6605
6866
  warn$1(
6606
6867
  `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.`
6607
6868
  );
@@ -6648,6 +6909,8 @@ If you want to remount the same app, move your app creation logic into a factory
6648
6909
  const initSlots = (instance, children, optimized) => {
6649
6910
  const slots = instance.slots = createInternalObject();
6650
6911
  if (instance.vnode.shapeFlag & 32) {
6912
+ const cacheIndexes = children.__;
6913
+ if (cacheIndexes) def(slots, "__", cacheIndexes, true);
6651
6914
  const type = children._;
6652
6915
  if (type) {
6653
6916
  assignSlots(slots, children, optimized);
@@ -6696,12 +6959,15 @@ If you want to remount the same app, move your app creation logic into a factory
6696
6959
 
6697
6960
  let supported;
6698
6961
  let perf;
6962
+ let cachedNow$1 = 0;
6963
+ const p$1 = /* @__PURE__ */ Promise.resolve();
6964
+ const getNow$1 = () => cachedNow$1 || (p$1.then(() => cachedNow$1 = 0), cachedNow$1 = isSupported() ? perf.now() : Date.now());
6699
6965
  function startMeasure(instance, type) {
6700
6966
  if (instance.appContext.config.performance && isSupported()) {
6701
6967
  perf.mark(`vue-${type}-${instance.uid}`);
6702
6968
  }
6703
6969
  {
6704
- devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
6970
+ devtoolsPerfStart(instance, type, getNow$1());
6705
6971
  }
6706
6972
  }
6707
6973
  function endMeasure(instance, type) {
@@ -6718,7 +6984,7 @@ If you want to remount the same app, move your app creation logic into a factory
6718
6984
  perf.clearMarks(endTag);
6719
6985
  }
6720
6986
  {
6721
- devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
6987
+ devtoolsPerfEnd(instance, type, getNow$1());
6722
6988
  }
6723
6989
  }
6724
6990
  function isSupported() {
@@ -6802,6 +7068,9 @@ If you want to remount the same app, move your app creation logic into a factory
6802
7068
  optimized
6803
7069
  );
6804
7070
  break;
7071
+ case VaporSlot:
7072
+ getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
7073
+ break;
6805
7074
  default:
6806
7075
  if (shapeFlag & 1) {
6807
7076
  processElement(
@@ -6859,6 +7128,8 @@ If you want to remount the same app, move your app creation logic into a factory
6859
7128
  }
6860
7129
  if (ref != null && parentComponent) {
6861
7130
  setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
7131
+ } else if (ref == null && n1 && n1.ref != null) {
7132
+ setRef(n1.ref, null, parentSuspense, n1, true);
6862
7133
  }
6863
7134
  };
6864
7135
  const processText = (n1, n2, container, anchor) => {
@@ -7012,11 +7283,15 @@ If you want to remount the same app, move your app creation logic into a factory
7012
7283
  }
7013
7284
  hostInsert(el, container, anchor);
7014
7285
  if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
7015
- queuePostRenderEffect(() => {
7016
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7017
- needCallTransitionHooks && transition.enter(el);
7018
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7019
- }, parentSuspense);
7286
+ queuePostRenderEffect(
7287
+ () => {
7288
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7289
+ needCallTransitionHooks && transition.enter(el);
7290
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7291
+ },
7292
+ void 0,
7293
+ parentSuspense
7294
+ );
7020
7295
  }
7021
7296
  };
7022
7297
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
@@ -7028,8 +7303,8 @@ If you want to remount the same app, move your app creation logic into a factory
7028
7303
  hostSetScopeId(el, slotScopeIds[i]);
7029
7304
  }
7030
7305
  }
7031
- if (parentComponent) {
7032
- let subTree = parentComponent.subTree;
7306
+ let subTree = parentComponent && parentComponent.subTree;
7307
+ if (subTree) {
7033
7308
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
7034
7309
  subTree = filterSingleRoot(subTree.children) || subTree;
7035
7310
  }
@@ -7146,10 +7421,14 @@ If you want to remount the same app, move your app creation logic into a factory
7146
7421
  patchProps(el, oldProps, newProps, parentComponent, namespace);
7147
7422
  }
7148
7423
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
7149
- queuePostRenderEffect(() => {
7150
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7151
- dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
7152
- }, parentSuspense);
7424
+ queuePostRenderEffect(
7425
+ () => {
7426
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7427
+ dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
7428
+ },
7429
+ void 0,
7430
+ parentSuspense
7431
+ );
7153
7432
  }
7154
7433
  };
7155
7434
  const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
@@ -7277,7 +7556,22 @@ If you want to remount the same app, move your app creation logic into a factory
7277
7556
  };
7278
7557
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7279
7558
  n2.slotScopeIds = slotScopeIds;
7280
- if (n1 == null) {
7559
+ if (n2.type.__vapor) {
7560
+ if (n1 == null) {
7561
+ getVaporInterface(parentComponent, n2).mount(
7562
+ n2,
7563
+ container,
7564
+ anchor,
7565
+ parentComponent
7566
+ );
7567
+ } else {
7568
+ getVaporInterface(parentComponent, n2).update(
7569
+ n1,
7570
+ n2,
7571
+ shouldUpdateComponent(n1, n2, optimized)
7572
+ );
7573
+ }
7574
+ } else if (n1 == null) {
7281
7575
  if (n2.shapeFlag & 512) {
7282
7576
  parentComponent.ctx.activate(
7283
7577
  n2,
@@ -7363,15 +7657,52 @@ If you want to remount the same app, move your app creation logic into a factory
7363
7657
  return;
7364
7658
  } else {
7365
7659
  instance.next = n2;
7366
- instance.update();
7660
+ instance.effect.run();
7367
7661
  }
7368
7662
  } else {
7369
7663
  n2.el = n1.el;
7370
7664
  instance.vnode = n2;
7371
7665
  }
7372
7666
  };
7373
- const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
7374
- const componentUpdateFn = () => {
7667
+ class SetupRenderEffect extends ReactiveEffect {
7668
+ constructor(instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) {
7669
+ const prevScope = setCurrentScope(instance.scope);
7670
+ super();
7671
+ this.instance = instance;
7672
+ this.initialVNode = initialVNode;
7673
+ this.container = container;
7674
+ this.anchor = anchor;
7675
+ this.parentSuspense = parentSuspense;
7676
+ this.namespace = namespace;
7677
+ this.optimized = optimized;
7678
+ setCurrentScope(prevScope);
7679
+ this.job = instance.job = () => {
7680
+ if (this.dirty) {
7681
+ this.run();
7682
+ }
7683
+ };
7684
+ this.job.i = instance;
7685
+ {
7686
+ this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
7687
+ this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
7688
+ }
7689
+ }
7690
+ notify() {
7691
+ if (!(this.flags & 256)) {
7692
+ const job = this.job;
7693
+ queueJob(job, job.i.uid);
7694
+ }
7695
+ }
7696
+ fn() {
7697
+ const {
7698
+ instance,
7699
+ initialVNode,
7700
+ container,
7701
+ anchor,
7702
+ parentSuspense,
7703
+ namespace,
7704
+ optimized
7705
+ } = this;
7375
7706
  if (!instance.isMounted) {
7376
7707
  let vnodeHook;
7377
7708
  const { el, props } = initialVNode;
@@ -7418,7 +7749,8 @@ If you want to remount the same app, move your app creation logic into a factory
7418
7749
  hydrateSubTree();
7419
7750
  }
7420
7751
  } else {
7421
- if (root.ce) {
7752
+ if (root.ce && // @ts-expect-error _def is private
7753
+ root.ce._def.shadowRoot !== false) {
7422
7754
  root.ce._injectChildStyle(type);
7423
7755
  }
7424
7756
  {
@@ -7446,23 +7778,24 @@ If you want to remount the same app, move your app creation logic into a factory
7446
7778
  initialVNode.el = subTree.el;
7447
7779
  }
7448
7780
  if (m) {
7449
- queuePostRenderEffect(m, parentSuspense);
7781
+ queuePostRenderEffect(m, void 0, parentSuspense);
7450
7782
  }
7451
7783
  if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
7452
7784
  const scopedInitialVNode = initialVNode;
7453
7785
  queuePostRenderEffect(
7454
7786
  () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
7787
+ void 0,
7455
7788
  parentSuspense
7456
7789
  );
7457
7790
  }
7458
- if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
7459
- instance.a && queuePostRenderEffect(instance.a, parentSuspense);
7791
+ if (initialVNode.shapeFlag & 256 || parent && parent.vnode && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
7792
+ instance.a && queuePostRenderEffect(instance.a, void 0, parentSuspense);
7460
7793
  }
7461
7794
  instance.isMounted = true;
7462
7795
  {
7463
7796
  devtoolsComponentAdded(instance);
7464
7797
  }
7465
- initialVNode = container = anchor = null;
7798
+ this.initialVNode = this.container = this.anchor = null;
7466
7799
  } else {
7467
7800
  let { next, bu, u, parent, vnode } = instance;
7468
7801
  {
@@ -7474,7 +7807,7 @@ If you want to remount the same app, move your app creation logic into a factory
7474
7807
  }
7475
7808
  nonHydratedAsyncRoot.asyncDep.then(() => {
7476
7809
  if (!instance.isUnmounted) {
7477
- componentUpdateFn();
7810
+ this.fn();
7478
7811
  }
7479
7812
  });
7480
7813
  return;
@@ -7530,11 +7863,12 @@ If you want to remount the same app, move your app creation logic into a factory
7530
7863
  updateHOCHostEl(instance, nextTree.el);
7531
7864
  }
7532
7865
  if (u) {
7533
- queuePostRenderEffect(u, parentSuspense);
7866
+ queuePostRenderEffect(u, void 0, parentSuspense);
7534
7867
  }
7535
7868
  if (vnodeHook = next.props && next.props.onVnodeUpdated) {
7536
7869
  queuePostRenderEffect(
7537
7870
  () => invokeVNodeHook(vnodeHook, parent, next, vnode),
7871
+ void 0,
7538
7872
  parentSuspense
7539
7873
  );
7540
7874
  }
@@ -7545,21 +7879,21 @@ If you want to remount the same app, move your app creation logic into a factory
7545
7879
  popWarningContext();
7546
7880
  }
7547
7881
  }
7548
- };
7549
- instance.scope.on();
7550
- const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
7551
- instance.scope.off();
7552
- const update = instance.update = effect.run.bind(effect);
7553
- const job = instance.job = effect.runIfDirty.bind(effect);
7554
- job.i = instance;
7555
- job.id = instance.uid;
7556
- effect.scheduler = () => queueJob(job);
7557
- toggleRecurse(instance, true);
7558
- {
7559
- effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
7560
- effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
7561
7882
  }
7562
- update();
7883
+ }
7884
+ const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
7885
+ const effect = instance.effect = new SetupRenderEffect(
7886
+ instance,
7887
+ initialVNode,
7888
+ container,
7889
+ anchor,
7890
+ parentSuspense,
7891
+ namespace,
7892
+ optimized
7893
+ );
7894
+ instance.update = effect.run.bind(effect);
7895
+ toggleRecurse(instance, true);
7896
+ effect.run();
7563
7897
  };
7564
7898
  const updateComponentPreRender = (instance, nextVNode, optimized) => {
7565
7899
  nextVNode.component = instance;
@@ -7568,9 +7902,9 @@ If you want to remount the same app, move your app creation logic into a factory
7568
7902
  instance.next = null;
7569
7903
  updateProps(instance, nextVNode.props, prevProps, optimized);
7570
7904
  updateSlots(instance, nextVNode.children, optimized);
7571
- pauseTracking();
7905
+ const prevSub = setActiveSub();
7572
7906
  flushPreFlushCbs(instance);
7573
- resetTracking();
7907
+ setActiveSub(prevSub);
7574
7908
  };
7575
7909
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
7576
7910
  const c1 = n1 && n1.children;
@@ -7847,7 +8181,13 @@ If you want to remount the same app, move your app creation logic into a factory
7847
8181
  );
7848
8182
  } else if (moved) {
7849
8183
  if (j < 0 || i !== increasingNewIndexSequence[j]) {
7850
- move(nextChild, container, anchor, 2);
8184
+ move(
8185
+ nextChild,
8186
+ container,
8187
+ anchor,
8188
+ 2,
8189
+ parentComponent
8190
+ );
7851
8191
  } else {
7852
8192
  j--;
7853
8193
  }
@@ -7855,10 +8195,20 @@ If you want to remount the same app, move your app creation logic into a factory
7855
8195
  }
7856
8196
  }
7857
8197
  };
7858
- const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
8198
+ const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
7859
8199
  const { el, type, transition, children, shapeFlag } = vnode;
7860
8200
  if (shapeFlag & 6) {
7861
- move(vnode.component.subTree, container, anchor, moveType);
8201
+ if (type.__vapor) {
8202
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
8203
+ } else {
8204
+ move(
8205
+ vnode.component.subTree,
8206
+ container,
8207
+ anchor,
8208
+ moveType,
8209
+ parentComponent
8210
+ );
8211
+ }
7862
8212
  return;
7863
8213
  }
7864
8214
  if (shapeFlag & 128) {
@@ -7866,13 +8216,25 @@ If you want to remount the same app, move your app creation logic into a factory
7866
8216
  return;
7867
8217
  }
7868
8218
  if (shapeFlag & 64) {
7869
- type.move(vnode, container, anchor, internals);
8219
+ type.move(
8220
+ vnode,
8221
+ container,
8222
+ anchor,
8223
+ internals,
8224
+ parentComponent
8225
+ );
7870
8226
  return;
7871
8227
  }
7872
8228
  if (type === Fragment) {
7873
8229
  hostInsert(el, container, anchor);
7874
8230
  for (let i = 0; i < children.length; i++) {
7875
- move(children[i], container, anchor, moveType);
8231
+ move(
8232
+ children[i],
8233
+ container,
8234
+ anchor,
8235
+ moveType,
8236
+ parentComponent
8237
+ );
7876
8238
  }
7877
8239
  hostInsert(vnode.anchor, container, anchor);
7878
8240
  return;
@@ -7886,7 +8248,11 @@ If you want to remount the same app, move your app creation logic into a factory
7886
8248
  if (moveType === 0) {
7887
8249
  transition.beforeEnter(el);
7888
8250
  hostInsert(el, container, anchor);
7889
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
8251
+ queuePostRenderEffect(
8252
+ () => transition.enter(el),
8253
+ void 0,
8254
+ parentSuspense
8255
+ );
7890
8256
  } else {
7891
8257
  const { leave, delayLeave, afterLeave } = transition;
7892
8258
  const remove2 = () => {
@@ -7928,9 +8294,9 @@ If you want to remount the same app, move your app creation logic into a factory
7928
8294
  optimized = false;
7929
8295
  }
7930
8296
  if (ref != null) {
7931
- pauseTracking();
8297
+ const prevSub = setActiveSub();
7932
8298
  setRef(ref, null, parentSuspense, vnode, true);
7933
- resetTracking();
8299
+ setActiveSub(prevSub);
7934
8300
  }
7935
8301
  if (cacheIndex != null) {
7936
8302
  parentComponent.renderCache[cacheIndex] = void 0;
@@ -7946,7 +8312,12 @@ If you want to remount the same app, move your app creation logic into a factory
7946
8312
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
7947
8313
  }
7948
8314
  if (shapeFlag & 6) {
7949
- unmountComponent(vnode.component, parentSuspense, doRemove);
8315
+ if (type.__vapor) {
8316
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8317
+ return;
8318
+ } else {
8319
+ unmountComponent(vnode.component, parentSuspense, doRemove);
8320
+ }
7950
8321
  } else {
7951
8322
  if (shapeFlag & 128) {
7952
8323
  vnode.suspense.unmount(parentSuspense, doRemove);
@@ -7980,15 +8351,23 @@ If you want to remount the same app, move your app creation logic into a factory
7980
8351
  } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
7981
8352
  unmountChildren(children, parentComponent, parentSuspense);
7982
8353
  }
8354
+ if (type === VaporSlot) {
8355
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8356
+ return;
8357
+ }
7983
8358
  if (doRemove) {
7984
8359
  remove(vnode);
7985
8360
  }
7986
8361
  }
7987
8362
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
7988
- queuePostRenderEffect(() => {
7989
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7990
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
7991
- }, parentSuspense);
8363
+ queuePostRenderEffect(
8364
+ () => {
8365
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
8366
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8367
+ },
8368
+ void 0,
8369
+ parentSuspense
8370
+ );
7992
8371
  }
7993
8372
  };
7994
8373
  const remove = (vnode) => {
@@ -8045,7 +8424,7 @@ If you want to remount the same app, move your app creation logic into a factory
8045
8424
  const {
8046
8425
  bum,
8047
8426
  scope,
8048
- job,
8427
+ effect,
8049
8428
  subTree,
8050
8429
  um,
8051
8430
  m,
@@ -8064,16 +8443,18 @@ If you want to remount the same app, move your app creation logic into a factory
8064
8443
  });
8065
8444
  }
8066
8445
  scope.stop();
8067
- if (job) {
8068
- job.flags |= 8;
8446
+ if (effect) {
8447
+ effect.stop();
8069
8448
  unmount(subTree, instance, parentSuspense, doRemove);
8070
8449
  }
8071
8450
  if (um) {
8072
- queuePostRenderEffect(um, parentSuspense);
8451
+ queuePostRenderEffect(um, void 0, parentSuspense);
8073
8452
  }
8074
- queuePostRenderEffect(() => {
8075
- instance.isUnmounted = true;
8076
- }, parentSuspense);
8453
+ queuePostRenderEffect(
8454
+ () => instance.isUnmounted = true,
8455
+ void 0,
8456
+ parentSuspense
8457
+ );
8077
8458
  if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8078
8459
  parentSuspense.deps--;
8079
8460
  if (parentSuspense.deps === 0) {
@@ -8091,6 +8472,9 @@ If you want to remount the same app, move your app creation logic into a factory
8091
8472
  };
8092
8473
  const getNextHostNode = (vnode) => {
8093
8474
  if (vnode.shapeFlag & 6) {
8475
+ if (vnode.type.__vapor) {
8476
+ return hostNextSibling(vnode.component.block);
8477
+ }
8094
8478
  return getNextHostNode(vnode.component.subTree);
8095
8479
  }
8096
8480
  if (vnode.shapeFlag & 128) {
@@ -8100,7 +8484,6 @@ If you want to remount the same app, move your app creation logic into a factory
8100
8484
  const teleportEnd = el && el[TeleportEndKey];
8101
8485
  return teleportEnd ? hostNextSibling(teleportEnd) : el;
8102
8486
  };
8103
- let isFlushing = false;
8104
8487
  const render = (vnode, container, namespace) => {
8105
8488
  if (vnode == null) {
8106
8489
  if (container._vnode) {
@@ -8118,12 +8501,7 @@ If you want to remount the same app, move your app creation logic into a factory
8118
8501
  );
8119
8502
  }
8120
8503
  container._vnode = vnode;
8121
- if (!isFlushing) {
8122
- isFlushing = true;
8123
- flushPreFlushCbs();
8124
- flushPostFlushCbs();
8125
- isFlushing = false;
8126
- }
8504
+ flushOnAppMount();
8127
8505
  };
8128
8506
  const internals = {
8129
8507
  p: patch,
@@ -8131,6 +8509,7 @@ If you want to remount the same app, move your app creation logic into a factory
8131
8509
  m: move,
8132
8510
  r: remove,
8133
8511
  mt: mountComponent,
8512
+ umt: unmountComponent,
8134
8513
  mc: mountChildren,
8135
8514
  pc: patchChildren,
8136
8515
  pbc: patchBlockChildren,
@@ -8144,22 +8523,53 @@ If you want to remount the same app, move your app creation logic into a factory
8144
8523
  internals
8145
8524
  );
8146
8525
  }
8526
+ const mountApp = (app, container, isHydrate, namespace) => {
8527
+ const vnode = app._ceVNode || createVNode(app._component, app._props);
8528
+ vnode.appContext = app._context;
8529
+ if (namespace === true) {
8530
+ namespace = "svg";
8531
+ } else if (namespace === false) {
8532
+ namespace = void 0;
8533
+ }
8534
+ {
8535
+ app._context.reload = () => {
8536
+ const cloned = cloneVNode(vnode);
8537
+ cloned.el = null;
8538
+ render(cloned, container, namespace);
8539
+ };
8540
+ }
8541
+ if (isHydrate && hydrate) {
8542
+ hydrate(vnode, container);
8543
+ } else {
8544
+ render(vnode, container, namespace);
8545
+ }
8546
+ return vnode.component;
8547
+ };
8548
+ const unmountApp = (app) => {
8549
+ render(null, app._container);
8550
+ };
8147
8551
  return {
8148
8552
  render,
8149
8553
  hydrate,
8150
- createApp: createAppAPI(render, hydrate)
8554
+ internals,
8555
+ createApp: createAppAPI(
8556
+ mountApp,
8557
+ unmountApp,
8558
+ getComponentPublicInstance)
8151
8559
  };
8152
8560
  }
8153
8561
  function resolveChildrenNamespace({ type, props }, currentNamespace) {
8154
8562
  return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
8155
8563
  }
8156
- function toggleRecurse({ effect, job }, allowed) {
8157
- if (allowed) {
8158
- effect.flags |= 32;
8159
- job.flags |= 4;
8160
- } else {
8161
- effect.flags &= -33;
8162
- job.flags &= -5;
8564
+ function toggleRecurse({ effect, job, vapor }, allowed) {
8565
+ if (!vapor) {
8566
+ if (allowed) {
8567
+ effect.flags |= 128;
8568
+ job.flags |= 2;
8569
+ } else {
8570
+ effect.flags &= -129;
8571
+ job.flags &= -3;
8572
+ }
8163
8573
  }
8164
8574
  }
8165
8575
  function needTransition(parentSuspense, transition) {
@@ -8192,46 +8602,6 @@ If you want to remount the same app, move your app creation logic into a factory
8192
8602
  }
8193
8603
  }
8194
8604
  }
8195
- function getSequence(arr) {
8196
- const p = arr.slice();
8197
- const result = [0];
8198
- let i, j, u, v, c;
8199
- const len = arr.length;
8200
- for (i = 0; i < len; i++) {
8201
- const arrI = arr[i];
8202
- if (arrI !== 0) {
8203
- j = result[result.length - 1];
8204
- if (arr[j] < arrI) {
8205
- p[i] = j;
8206
- result.push(i);
8207
- continue;
8208
- }
8209
- u = 0;
8210
- v = result.length - 1;
8211
- while (u < v) {
8212
- c = u + v >> 1;
8213
- if (arr[result[c]] < arrI) {
8214
- u = c + 1;
8215
- } else {
8216
- v = c;
8217
- }
8218
- }
8219
- if (arrI < arr[result[u]]) {
8220
- if (u > 0) {
8221
- p[i] = result[u - 1];
8222
- }
8223
- result[u] = i;
8224
- }
8225
- }
8226
- }
8227
- u = result.length;
8228
- v = result[u - 1];
8229
- while (u-- > 0) {
8230
- result[u] = v;
8231
- v = p[v];
8232
- }
8233
- return result;
8234
- }
8235
8605
  function locateNonHydratedAsyncRoot(instance) {
8236
8606
  const subComponent = instance.subTree.component;
8237
8607
  if (subComponent) {
@@ -8245,8 +8615,22 @@ If you want to remount the same app, move your app creation logic into a factory
8245
8615
  function invalidateMount(hooks) {
8246
8616
  if (hooks) {
8247
8617
  for (let i = 0; i < hooks.length; i++)
8248
- hooks[i].flags |= 8;
8618
+ hooks[i].flags |= 4;
8619
+ }
8620
+ }
8621
+ function getVaporInterface(instance, vnode) {
8622
+ const ctx = instance ? instance.appContext : vnode.appContext;
8623
+ const res = ctx && ctx.vapor;
8624
+ if (!res) {
8625
+ warn$1(
8626
+ `Vapor component found in vdom tree but vapor-in-vdom interop was not installed. Make sure to install it:
8627
+ \`\`\`
8628
+ import { vaporInteropPlugin } from 'vue'
8629
+ app.use(vaporInteropPlugin)
8630
+ \`\`\``
8631
+ );
8249
8632
  }
8633
+ return res;
8250
8634
  }
8251
8635
 
8252
8636
  const ssrContextKey = Symbol.for("v-scx");
@@ -8281,8 +8665,41 @@ If you want to remount the same app, move your app creation logic into a factory
8281
8665
  }
8282
8666
  return doWatch(source, cb, options);
8283
8667
  }
8668
+ class RenderWatcherEffect extends WatcherEffect {
8669
+ constructor(instance, source, cb, options, flush) {
8670
+ super(source, cb, options);
8671
+ this.flush = flush;
8672
+ const job = () => {
8673
+ if (this.dirty) {
8674
+ this.run();
8675
+ }
8676
+ };
8677
+ if (cb) {
8678
+ this.flags |= 128;
8679
+ job.flags |= 2;
8680
+ }
8681
+ if (instance) {
8682
+ job.i = instance;
8683
+ }
8684
+ this.job = job;
8685
+ }
8686
+ notify() {
8687
+ const flags = this.flags;
8688
+ if (!(flags & 256)) {
8689
+ const flush = this.flush;
8690
+ const job = this.job;
8691
+ if (flush === "post") {
8692
+ queuePostRenderEffect(job, void 0, job.i ? job.i.suspense : null);
8693
+ } else if (flush === "pre") {
8694
+ queueJob(job, job.i ? job.i.uid : void 0, true);
8695
+ } else {
8696
+ job();
8697
+ }
8698
+ }
8699
+ }
8700
+ }
8284
8701
  function doWatch(source, cb, options = EMPTY_OBJ) {
8285
- const { immediate, deep, flush, once } = options;
8702
+ const { immediate, deep, flush = "pre", once } = options;
8286
8703
  if (!cb) {
8287
8704
  if (immediate !== void 0) {
8288
8705
  warn$1(
@@ -8304,35 +8721,25 @@ If you want to remount the same app, move your app creation logic into a factory
8304
8721
  baseWatchOptions.onWarn = warn$1;
8305
8722
  const instance = currentInstance;
8306
8723
  baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
8307
- let isPre = false;
8308
- if (flush === "post") {
8309
- baseWatchOptions.scheduler = (job) => {
8310
- queuePostRenderEffect(job, instance && instance.suspense);
8311
- };
8312
- } else if (flush !== "sync") {
8313
- isPre = true;
8314
- baseWatchOptions.scheduler = (job, isFirstRun) => {
8315
- if (isFirstRun) {
8316
- job();
8317
- } else {
8318
- queueJob(job);
8319
- }
8320
- };
8724
+ const effect = new RenderWatcherEffect(
8725
+ instance,
8726
+ source,
8727
+ cb,
8728
+ baseWatchOptions,
8729
+ flush
8730
+ );
8731
+ if (cb) {
8732
+ effect.run(true);
8733
+ } else if (flush === "post") {
8734
+ queuePostRenderEffect(effect.job, void 0, instance && instance.suspense);
8735
+ } else {
8736
+ effect.run(true);
8321
8737
  }
8322
- baseWatchOptions.augmentJob = (job) => {
8323
- if (cb) {
8324
- job.flags |= 4;
8325
- }
8326
- if (isPre) {
8327
- job.flags |= 2;
8328
- if (instance) {
8329
- job.id = instance.uid;
8330
- job.i = instance;
8331
- }
8332
- }
8333
- };
8334
- const watchHandle = watch$1(source, cb, baseWatchOptions);
8335
- return watchHandle;
8738
+ const stop = effect.stop.bind(effect);
8739
+ stop.pause = effect.pause.bind(effect);
8740
+ stop.resume = effect.resume.bind(effect);
8741
+ stop.stop = stop;
8742
+ return stop;
8336
8743
  }
8337
8744
  function instanceWatch(source, value, options) {
8338
8745
  const publicThis = this.proxy;
@@ -8344,9 +8751,9 @@ If you want to remount the same app, move your app creation logic into a factory
8344
8751
  cb = value.handler;
8345
8752
  options = value;
8346
8753
  }
8347
- const reset = setCurrentInstance(this);
8754
+ const prev = setCurrentInstance(this);
8348
8755
  const res = doWatch(getter, cb.bind(publicThis), options);
8349
- reset();
8756
+ setCurrentInstance(...prev);
8350
8757
  return res;
8351
8758
  }
8352
8759
  function createPathGetter(ctx, path) {
@@ -8361,7 +8768,7 @@ If you want to remount the same app, move your app creation logic into a factory
8361
8768
  }
8362
8769
 
8363
8770
  function useModel(props, name, options = EMPTY_OBJ) {
8364
- const i = getCurrentInstance();
8771
+ const i = getCurrentGenericInstance();
8365
8772
  if (!i) {
8366
8773
  warn$1(`useModel() called without active instance.`);
8367
8774
  return ref();
@@ -8372,7 +8779,7 @@ If you want to remount the same app, move your app creation logic into a factory
8372
8779
  return ref();
8373
8780
  }
8374
8781
  const hyphenatedName = hyphenate(name);
8375
- const modifiers = getModelModifiers(props, camelizedName);
8782
+ const modifiers = getModelModifiers(props, camelizedName, defaultPropGetter);
8376
8783
  const res = customRef((track, trigger) => {
8377
8784
  let localValue;
8378
8785
  let prevSetValue = EMPTY_OBJ;
@@ -8394,9 +8801,25 @@ If you want to remount the same app, move your app creation logic into a factory
8394
8801
  if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
8395
8802
  return;
8396
8803
  }
8397
- const rawProps = i.vnode.props;
8398
- if (!(rawProps && // check if parent has passed v-model
8399
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
8804
+ let rawPropKeys;
8805
+ let parentPassedModelValue = false;
8806
+ let parentPassedModelUpdater = false;
8807
+ if (i.rawKeys) {
8808
+ rawPropKeys = i.rawKeys();
8809
+ } else {
8810
+ const rawProps = i.vnode.props;
8811
+ rawPropKeys = rawProps && Object.keys(rawProps);
8812
+ }
8813
+ if (rawPropKeys) {
8814
+ for (const key of rawPropKeys) {
8815
+ if (key === name || key === camelizedName || key === hyphenatedName) {
8816
+ parentPassedModelValue = true;
8817
+ } else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) {
8818
+ parentPassedModelUpdater = true;
8819
+ }
8820
+ }
8821
+ }
8822
+ if (!parentPassedModelValue || !parentPassedModelUpdater) {
8400
8823
  localValue = value;
8401
8824
  trigger();
8402
8825
  }
@@ -8423,21 +8846,26 @@ If you want to remount the same app, move your app creation logic into a factory
8423
8846
  };
8424
8847
  return res;
8425
8848
  }
8426
- const getModelModifiers = (props, modelName) => {
8427
- return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
8849
+ const getModelModifiers = (props, modelName, getter) => {
8850
+ return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
8428
8851
  };
8429
8852
 
8430
8853
  function emit(instance, event, ...rawArgs) {
8854
+ return baseEmit(
8855
+ instance,
8856
+ instance.vnode.props || EMPTY_OBJ,
8857
+ defaultPropGetter,
8858
+ event,
8859
+ ...rawArgs
8860
+ );
8861
+ }
8862
+ function baseEmit(instance, props, getter, event, ...rawArgs) {
8431
8863
  if (instance.isUnmounted) return;
8432
- const props = instance.vnode.props || EMPTY_OBJ;
8433
8864
  {
8434
- const {
8435
- emitsOptions,
8436
- propsOptions: [propsOptions]
8437
- } = instance;
8865
+ const { emitsOptions, propsOptions } = instance;
8438
8866
  if (emitsOptions) {
8439
8867
  if (!(event in emitsOptions) && true) {
8440
- if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
8868
+ if (!propsOptions || !propsOptions[0] || !(toHandlerKey(camelize(event)) in propsOptions[0])) {
8441
8869
  warn$1(
8442
8870
  `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
8443
8871
  );
@@ -8457,7 +8885,7 @@ If you want to remount the same app, move your app creation logic into a factory
8457
8885
  }
8458
8886
  let args = rawArgs;
8459
8887
  const isModelListener = event.startsWith("update:");
8460
- const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
8888
+ const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
8461
8889
  if (modifiers) {
8462
8890
  if (modifiers.trim) {
8463
8891
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
@@ -8471,7 +8899,7 @@ If you want to remount the same app, move your app creation logic into a factory
8471
8899
  }
8472
8900
  {
8473
8901
  const lowerCaseEvent = event.toLowerCase();
8474
- if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
8902
+ if (lowerCaseEvent !== event && getter(props, toHandlerKey(lowerCaseEvent))) {
8475
8903
  warn$1(
8476
8904
  `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
8477
8905
  instance,
@@ -8483,10 +8911,10 @@ If you want to remount the same app, move your app creation logic into a factory
8483
8911
  }
8484
8912
  }
8485
8913
  let handlerName;
8486
- let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
8487
- props[handlerName = toHandlerKey(camelize(event))];
8914
+ let handler = getter(props, handlerName = toHandlerKey(event)) || // also try camelCase event handler (#2249)
8915
+ getter(props, handlerName = toHandlerKey(camelize(event)));
8488
8916
  if (!handler && isModelListener) {
8489
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
8917
+ handler = getter(props, handlerName = toHandlerKey(hyphenate(event)));
8490
8918
  }
8491
8919
  if (handler) {
8492
8920
  callWithAsyncErrorHandling(
@@ -8496,7 +8924,7 @@ If you want to remount the same app, move your app creation logic into a factory
8496
8924
  args
8497
8925
  );
8498
8926
  }
8499
- const onceHandler = props[handlerName + `Once`];
8927
+ const onceHandler = getter(props, handlerName + `Once`);
8500
8928
  if (onceHandler) {
8501
8929
  if (!instance.emitted) {
8502
8930
  instance.emitted = {};
@@ -8512,6 +8940,9 @@ If you want to remount the same app, move your app creation logic into a factory
8512
8940
  );
8513
8941
  }
8514
8942
  }
8943
+ function defaultPropGetter(props, key) {
8944
+ return props[key];
8945
+ }
8515
8946
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
8516
8947
  const cache = appContext.emitsCache;
8517
8948
  const cached = cache.get(comp);
@@ -8839,7 +9270,7 @@ If you want to remount the same app, move your app creation logic into a factory
8839
9270
  return false;
8840
9271
  }
8841
9272
  function updateHOCHostEl({ vnode, parent }, el) {
8842
- while (parent) {
9273
+ while (parent && !parent.vapor) {
8843
9274
  const root = parent.subTree;
8844
9275
  if (root.suspense && root.suspense.activeBranch === vnode) {
8845
9276
  root.el = vnode.el;
@@ -9190,7 +9621,8 @@ If you want to remount the same app, move your app creation logic into a factory
9190
9621
  pendingBranch,
9191
9622
  container2,
9192
9623
  anchor === initialAnchor ? next(activeBranch) : anchor,
9193
- 0
9624
+ 0,
9625
+ parentComponent2
9194
9626
  );
9195
9627
  queuePostFlushCb(effects);
9196
9628
  }
@@ -9203,7 +9635,13 @@ If you want to remount the same app, move your app creation logic into a factory
9203
9635
  unmount(activeBranch, parentComponent2, suspense, true);
9204
9636
  }
9205
9637
  if (!delayEnter) {
9206
- move(pendingBranch, container2, anchor, 0);
9638
+ move(
9639
+ pendingBranch,
9640
+ container2,
9641
+ anchor,
9642
+ 0,
9643
+ parentComponent2
9644
+ );
9207
9645
  }
9208
9646
  }
9209
9647
  setActiveBranch(suspense, pendingBranch);
@@ -9276,7 +9714,7 @@ If you want to remount the same app, move your app creation logic into a factory
9276
9714
  }
9277
9715
  },
9278
9716
  move(container2, anchor2, type) {
9279
- suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
9717
+ suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type, parentComponent);
9280
9718
  suspense.container = container2;
9281
9719
  },
9282
9720
  next() {
@@ -9416,7 +9854,7 @@ If you want to remount the same app, move your app creation logic into a factory
9416
9854
  }
9417
9855
  return s;
9418
9856
  }
9419
- function queueEffectWithSuspense(fn, suspense) {
9857
+ function queueEffectWithSuspense(fn, id, suspense) {
9420
9858
  if (suspense && suspense.pendingBranch) {
9421
9859
  if (isArray(fn)) {
9422
9860
  suspense.effects.push(...fn);
@@ -9424,7 +9862,7 @@ If you want to remount the same app, move your app creation logic into a factory
9424
9862
  suspense.effects.push(fn);
9425
9863
  }
9426
9864
  } else {
9427
- queuePostFlushCb(fn);
9865
+ queuePostFlushCb(fn, id);
9428
9866
  }
9429
9867
  }
9430
9868
  function setActiveBranch(suspense, branch) {
@@ -9450,6 +9888,7 @@ If you want to remount the same app, move your app creation logic into a factory
9450
9888
  const Text = Symbol.for("v-txt");
9451
9889
  const Comment = Symbol.for("v-cmt");
9452
9890
  const Static = Symbol.for("v-stc");
9891
+ const VaporSlot = Symbol.for("v-vps");
9453
9892
  const blockStack = [];
9454
9893
  let currentBlock = null;
9455
9894
  function openBlock(disableTracking = false) {
@@ -9823,6 +10262,28 @@ Component that was made reactive: `,
9823
10262
  ]);
9824
10263
  }
9825
10264
 
10265
+ let currentInstance = null;
10266
+ const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
10267
+ const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
10268
+ let isInSSRComponentSetup = false;
10269
+ let setInSSRSetupState;
10270
+ let simpleSetCurrentInstance;
10271
+ {
10272
+ simpleSetCurrentInstance = (i) => {
10273
+ currentInstance = i;
10274
+ };
10275
+ setInSSRSetupState = (v) => {
10276
+ isInSSRComponentSetup = v;
10277
+ };
10278
+ }
10279
+ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope : void 0) => {
10280
+ try {
10281
+ return [currentInstance, setCurrentScope(scope)];
10282
+ } finally {
10283
+ simpleSetCurrentInstance(instance);
10284
+ }
10285
+ };
10286
+
9826
10287
  const emptyAppContext = createAppContext();
9827
10288
  let uid = 0;
9828
10289
  function createComponentInstance(vnode, parent, suspense) {
@@ -9867,7 +10328,7 @@ Component that was made reactive: `,
9867
10328
  // to be set immediately
9868
10329
  emitted: null,
9869
10330
  // props default value
9870
- propsDefaults: EMPTY_OBJ,
10331
+ propsDefaults: null,
9871
10332
  // inheritAttrs
9872
10333
  inheritAttrs: type.inheritAttrs,
9873
10334
  // state
@@ -9914,32 +10375,6 @@ Component that was made reactive: `,
9914
10375
  }
9915
10376
  return instance;
9916
10377
  }
9917
- let currentInstance = null;
9918
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
9919
- let internalSetCurrentInstance;
9920
- let setInSSRSetupState;
9921
- {
9922
- internalSetCurrentInstance = (i) => {
9923
- currentInstance = i;
9924
- };
9925
- setInSSRSetupState = (v) => {
9926
- isInSSRComponentSetup = v;
9927
- };
9928
- }
9929
- const setCurrentInstance = (instance) => {
9930
- const prev = currentInstance;
9931
- internalSetCurrentInstance(instance);
9932
- instance.scope.on();
9933
- return () => {
9934
- instance.scope.off();
9935
- internalSetCurrentInstance(prev);
9936
- };
9937
- };
9938
- const unsetCurrentInstance = () => {
9939
- currentInstance && currentInstance.scope.off();
9940
- internalSetCurrentInstance(null);
9941
- };
9942
- const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
9943
10378
  function validateComponentName(name, { isNativeTag }) {
9944
10379
  if (isBuiltInTag(name) || isNativeTag(name)) {
9945
10380
  warn$1(
@@ -9950,13 +10385,16 @@ Component that was made reactive: `,
9950
10385
  function isStatefulComponent(instance) {
9951
10386
  return instance.vnode.shapeFlag & 4;
9952
10387
  }
9953
- let isInSSRComponentSetup = false;
9954
10388
  function setupComponent(instance, isSSR = false, optimized = false) {
9955
10389
  isSSR && setInSSRSetupState(isSSR);
9956
- const { props, children } = instance.vnode;
10390
+ const { props, children, vi } = instance.vnode;
9957
10391
  const isStateful = isStatefulComponent(instance);
9958
- initProps(instance, props, isStateful, isSSR);
9959
- initSlots(instance, children, optimized || isSSR);
10392
+ if (vi) {
10393
+ vi(instance);
10394
+ } else {
10395
+ initProps(instance, props, isStateful, isSSR);
10396
+ initSlots(instance, children, optimized || isSSR);
10397
+ }
9960
10398
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
9961
10399
  isSSR && setInSSRSetupState(false);
9962
10400
  return setupResult;
@@ -9993,9 +10431,9 @@ Component that was made reactive: `,
9993
10431
  }
9994
10432
  const { setup } = Component;
9995
10433
  if (setup) {
9996
- pauseTracking();
10434
+ const prevSub = setActiveSub();
9997
10435
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
9998
- const reset = setCurrentInstance(instance);
10436
+ const prev = setCurrentInstance(instance);
9999
10437
  const setupResult = callWithErrorHandling(
10000
10438
  setup,
10001
10439
  instance,
@@ -10006,12 +10444,15 @@ Component that was made reactive: `,
10006
10444
  ]
10007
10445
  );
10008
10446
  const isAsyncSetup = isPromise(setupResult);
10009
- resetTracking();
10010
- reset();
10447
+ setActiveSub(prevSub);
10448
+ setCurrentInstance(...prev);
10011
10449
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
10012
10450
  markAsyncBoundary(instance);
10013
10451
  }
10014
10452
  if (isAsyncSetup) {
10453
+ const unsetCurrentInstance = () => {
10454
+ setCurrentInstance(null, void 0);
10455
+ };
10015
10456
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10016
10457
  if (isSSR) {
10017
10458
  return setupResult.then((resolvedResult) => {
@@ -10104,13 +10545,13 @@ Component that was made reactive: `,
10104
10545
  }
10105
10546
  }
10106
10547
  {
10107
- const reset = setCurrentInstance(instance);
10108
- pauseTracking();
10548
+ const prevInstance = setCurrentInstance(instance);
10549
+ const prevSub = setActiveSub();
10109
10550
  try {
10110
10551
  applyOptions(instance);
10111
10552
  } finally {
10112
- resetTracking();
10113
- reset();
10553
+ setActiveSub(prevSub);
10554
+ setCurrentInstance(...prevInstance);
10114
10555
  }
10115
10556
  }
10116
10557
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -10147,29 +10588,6 @@ Component that was made reactive: `,
10147
10588
  });
10148
10589
  }
10149
10590
  function createSetupContext(instance) {
10150
- const expose = (exposed) => {
10151
- {
10152
- if (instance.exposed) {
10153
- warn$1(`expose() should be called only once per setup().`);
10154
- }
10155
- if (exposed != null) {
10156
- let exposedType = typeof exposed;
10157
- if (exposedType === "object") {
10158
- if (isArray(exposed)) {
10159
- exposedType = "array";
10160
- } else if (isRef(exposed)) {
10161
- exposedType = "ref";
10162
- }
10163
- }
10164
- if (exposedType !== "object") {
10165
- warn$1(
10166
- `expose() should be passed a plain object, received ${exposedType}.`
10167
- );
10168
- }
10169
- }
10170
- }
10171
- instance.exposed = exposed || {};
10172
- };
10173
10591
  {
10174
10592
  let attrsProxy;
10175
10593
  let slotsProxy;
@@ -10183,10 +10601,33 @@ Component that was made reactive: `,
10183
10601
  get emit() {
10184
10602
  return (event, ...args) => instance.emit(event, ...args);
10185
10603
  },
10186
- expose
10604
+ expose: (exposed) => expose(instance, exposed)
10187
10605
  });
10188
10606
  }
10189
10607
  }
10608
+ function expose(instance, exposed) {
10609
+ {
10610
+ if (instance.exposed) {
10611
+ warn$1(`expose() should be called only once per setup().`);
10612
+ }
10613
+ if (exposed != null) {
10614
+ let exposedType = typeof exposed;
10615
+ if (exposedType === "object") {
10616
+ if (isArray(exposed)) {
10617
+ exposedType = "array";
10618
+ } else if (isRef(exposed)) {
10619
+ exposedType = "ref";
10620
+ }
10621
+ }
10622
+ if (exposedType !== "object") {
10623
+ warn$1(
10624
+ `expose() should be passed a plain object, received ${exposedType}.`
10625
+ );
10626
+ }
10627
+ }
10628
+ }
10629
+ instance.exposed = exposed || {};
10630
+ }
10190
10631
  function getComponentPublicInstance(instance) {
10191
10632
  if (instance.exposed) {
10192
10633
  return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
@@ -10194,7 +10635,9 @@ Component that was made reactive: `,
10194
10635
  if (key in target) {
10195
10636
  return target[key];
10196
10637
  } else if (key in publicPropertiesMap) {
10197
- return publicPropertiesMap[key](instance);
10638
+ return publicPropertiesMap[key](
10639
+ instance
10640
+ );
10198
10641
  }
10199
10642
  },
10200
10643
  has(target, key) {
@@ -10237,14 +10680,7 @@ Component that was made reactive: `,
10237
10680
  }
10238
10681
 
10239
10682
  const computed = (getterOrOptions, debugOptions) => {
10240
- const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10241
- {
10242
- const i = getCurrentInstance();
10243
- if (i && i.appContext.config.warnRecursiveComputed) {
10244
- c._warnRecursive = true;
10245
- }
10246
- }
10247
- return c;
10683
+ return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10248
10684
  };
10249
10685
 
10250
10686
  function h(type, propsOrChildren, children) {
@@ -10285,9 +10721,9 @@ Component that was made reactive: `,
10285
10721
  if (obj.__isVue) {
10286
10722
  return ["div", vueStyle, `VueInstance`];
10287
10723
  } else if (isRef(obj)) {
10288
- pauseTracking();
10724
+ const prevSub = setActiveSub();
10289
10725
  const value = obj.value;
10290
- resetTracking();
10726
+ setActiveSub(prevSub);
10291
10727
  return [
10292
10728
  "div",
10293
10729
  {},
@@ -10474,7 +10910,7 @@ Component that was made reactive: `,
10474
10910
  return true;
10475
10911
  }
10476
10912
 
10477
- const version = "3.5.16";
10913
+ const version = "3.6.0-alpha.1";
10478
10914
  const warn = warn$1 ;
10479
10915
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10480
10916
  const devtools = devtools$1 ;
@@ -10968,8 +11404,9 @@ Component that was made reactive: `,
10968
11404
  const style = el.style;
10969
11405
  let cssText = "";
10970
11406
  for (const key in vars) {
10971
- style.setProperty(`--${key}`, vars[key]);
10972
- cssText += `--${key}: ${vars[key]};`;
11407
+ const value = normalizeCssVarValue(vars[key]);
11408
+ style.setProperty(`--${key}`, value);
11409
+ cssText += `--${key}: ${value};`;
10973
11410
  }
10974
11411
  style[CSS_VAR_TEXT] = cssText;
10975
11412
  }
@@ -11026,11 +11463,11 @@ Component that was made reactive: `,
11026
11463
  }
11027
11464
  const semicolonRE = /[^\\];\s*$/;
11028
11465
  const importantRE = /\s*!important$/;
11029
- function setStyle(style, name, val) {
11030
- if (isArray(val)) {
11031
- val.forEach((v) => setStyle(style, name, v));
11466
+ function setStyle(style, name, rawVal) {
11467
+ if (isArray(rawVal)) {
11468
+ rawVal.forEach((v) => setStyle(style, name, v));
11032
11469
  } else {
11033
- if (val == null) val = "";
11470
+ const val = rawVal == null ? "" : String(rawVal);
11034
11471
  {
11035
11472
  if (semicolonRE.test(val)) {
11036
11473
  warn(
@@ -11103,8 +11540,7 @@ Component that was made reactive: `,
11103
11540
  return;
11104
11541
  }
11105
11542
  const tag = el.tagName;
11106
- if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11107
- !tag.includes("-")) {
11543
+ if (key === "value" && canSetValueDirectly(tag)) {
11108
11544
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
11109
11545
  const newValue = value == null ? (
11110
11546
  // #11647: value should be set as empty string for null and undefined,
@@ -11232,8 +11668,6 @@ Expected function or array of functions, received type ${typeof value}.`
11232
11668
  }
11233
11669
  }
11234
11670
 
11235
- const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
11236
- key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
11237
11671
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
11238
11672
  const isSVG = namespace === "svg";
11239
11673
  if (key === "class") {
@@ -11273,24 +11707,9 @@ Expected function or array of functions, received type ${typeof value}.`
11273
11707
  }
11274
11708
  return false;
11275
11709
  }
11276
- if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
11277
- return false;
11278
- }
11279
- if (key === "form") {
11280
- return false;
11281
- }
11282
- if (key === "list" && el.tagName === "INPUT") {
11283
- return false;
11284
- }
11285
- if (key === "type" && el.tagName === "TEXTAREA") {
11710
+ if (shouldSetAsAttr(el.tagName, key)) {
11286
11711
  return false;
11287
11712
  }
11288
- if (key === "width" || key === "height") {
11289
- const tag = el.tagName;
11290
- if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
11291
- return false;
11292
- }
11293
- }
11294
11713
  if (isNativeOn(key) && isString(value)) {
11295
11714
  return false;
11296
11715
  }
@@ -11458,9 +11877,10 @@ Expected function or array of functions, received type ${typeof value}.`
11458
11877
  };
11459
11878
  const asyncDef = this._def.__asyncLoader;
11460
11879
  if (asyncDef) {
11461
- this._pendingResolve = asyncDef().then(
11462
- (def) => resolve(this._def = def, true)
11463
- );
11880
+ this._pendingResolve = asyncDef().then((def) => {
11881
+ def.configureApp = this._def.configureApp;
11882
+ resolve(this._def = def, true);
11883
+ });
11464
11884
  } else {
11465
11885
  resolve(this._def);
11466
11886
  }
@@ -11883,28 +12303,12 @@ Expected function or array of functions, received type ${typeof value}.`
11883
12303
  const vModelText = {
11884
12304
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
11885
12305
  el[assignKey] = getModelAssigner(vnode);
11886
- const castToNumber = number || vnode.props && vnode.props.type === "number";
11887
- addEventListener(el, lazy ? "change" : "input", (e) => {
11888
- if (e.target.composing) return;
11889
- let domValue = el.value;
11890
- if (trim) {
11891
- domValue = domValue.trim();
11892
- }
11893
- if (castToNumber) {
11894
- domValue = looseToNumber(domValue);
11895
- }
11896
- el[assignKey](domValue);
11897
- });
11898
- if (trim) {
11899
- addEventListener(el, "change", () => {
11900
- el.value = el.value.trim();
11901
- });
11902
- }
11903
- if (!lazy) {
11904
- addEventListener(el, "compositionstart", onCompositionStart);
11905
- addEventListener(el, "compositionend", onCompositionEnd);
11906
- addEventListener(el, "change", onCompositionEnd);
11907
- }
12306
+ vModelTextInit(
12307
+ el,
12308
+ trim,
12309
+ number || !!(vnode.props && vnode.props.type === "number"),
12310
+ lazy
12311
+ );
11908
12312
  },
11909
12313
  // set value on mounted so it's after min/max for type="range"
11910
12314
  mounted(el, { value }) {
@@ -11912,70 +12316,111 @@ Expected function or array of functions, received type ${typeof value}.`
11912
12316
  },
11913
12317
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
11914
12318
  el[assignKey] = getModelAssigner(vnode);
11915
- if (el.composing) return;
11916
- const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
11917
- const newValue = value == null ? "" : value;
11918
- if (elValue === newValue) {
12319
+ vModelTextUpdate(el, oldValue, value, trim, number, lazy);
12320
+ }
12321
+ };
12322
+ const vModelTextInit = (el, trim, number, lazy, set) => {
12323
+ addEventListener(el, lazy ? "change" : "input", (e) => {
12324
+ if (e.target.composing) return;
12325
+ let domValue = el.value;
12326
+ if (trim) {
12327
+ domValue = domValue.trim();
12328
+ }
12329
+ if (number || el.type === "number") {
12330
+ domValue = looseToNumber(domValue);
12331
+ }
12332
+ (0, el[assignKey])(domValue);
12333
+ });
12334
+ if (trim) {
12335
+ addEventListener(el, "change", () => {
12336
+ el.value = el.value.trim();
12337
+ });
12338
+ }
12339
+ if (!lazy) {
12340
+ addEventListener(el, "compositionstart", onCompositionStart);
12341
+ addEventListener(el, "compositionend", onCompositionEnd);
12342
+ addEventListener(el, "change", onCompositionEnd);
12343
+ }
12344
+ };
12345
+ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
12346
+ if (el.composing) return;
12347
+ const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
12348
+ const newValue = value == null ? "" : value;
12349
+ if (elValue === newValue) {
12350
+ return;
12351
+ }
12352
+ if (document.activeElement === el && el.type !== "range") {
12353
+ if (lazy && value === oldValue) {
11919
12354
  return;
11920
12355
  }
11921
- if (document.activeElement === el && el.type !== "range") {
11922
- if (lazy && value === oldValue) {
11923
- return;
11924
- }
11925
- if (trim && el.value.trim() === newValue) {
11926
- return;
11927
- }
12356
+ if (trim && el.value.trim() === newValue) {
12357
+ return;
11928
12358
  }
11929
- el.value = newValue;
11930
12359
  }
12360
+ el.value = newValue;
11931
12361
  };
11932
12362
  const vModelCheckbox = {
11933
12363
  // #4096 array checkboxes need to be deep traversed
11934
12364
  deep: true,
11935
12365
  created(el, _, vnode) {
11936
12366
  el[assignKey] = getModelAssigner(vnode);
11937
- addEventListener(el, "change", () => {
11938
- const modelValue = el._modelValue;
11939
- const elementValue = getValue(el);
11940
- const checked = el.checked;
11941
- const assign = el[assignKey];
11942
- if (isArray(modelValue)) {
11943
- const index = looseIndexOf(modelValue, elementValue);
11944
- const found = index !== -1;
11945
- if (checked && !found) {
11946
- assign(modelValue.concat(elementValue));
11947
- } else if (!checked && found) {
11948
- const filtered = [...modelValue];
11949
- filtered.splice(index, 1);
11950
- assign(filtered);
11951
- }
11952
- } else if (isSet(modelValue)) {
11953
- const cloned = new Set(modelValue);
11954
- if (checked) {
11955
- cloned.add(elementValue);
11956
- } else {
11957
- cloned.delete(elementValue);
11958
- }
11959
- assign(cloned);
11960
- } else {
11961
- assign(getCheckboxValue(el, checked));
11962
- }
11963
- });
12367
+ vModelCheckboxInit(el);
11964
12368
  },
11965
12369
  // set initial checked on mount to wait for true-value/false-value
11966
- mounted: setChecked,
12370
+ mounted(el, binding, vnode) {
12371
+ vModelCheckboxUpdate(
12372
+ el,
12373
+ binding.oldValue,
12374
+ binding.value,
12375
+ vnode.props.value
12376
+ );
12377
+ },
11967
12378
  beforeUpdate(el, binding, vnode) {
11968
12379
  el[assignKey] = getModelAssigner(vnode);
11969
- setChecked(el, binding, vnode);
12380
+ vModelCheckboxUpdate(
12381
+ el,
12382
+ binding.oldValue,
12383
+ binding.value,
12384
+ vnode.props.value
12385
+ );
11970
12386
  }
11971
12387
  };
11972
- function setChecked(el, { value, oldValue }, vnode) {
12388
+ const vModelCheckboxInit = (el, set) => {
12389
+ addEventListener(el, "change", () => {
12390
+ const assign = el[assignKey];
12391
+ const modelValue = el._modelValue;
12392
+ const elementValue = getValue(el);
12393
+ const checked = el.checked;
12394
+ if (isArray(modelValue)) {
12395
+ const index = looseIndexOf(modelValue, elementValue);
12396
+ const found = index !== -1;
12397
+ if (checked && !found) {
12398
+ assign(modelValue.concat(elementValue));
12399
+ } else if (!checked && found) {
12400
+ const filtered = [...modelValue];
12401
+ filtered.splice(index, 1);
12402
+ assign(filtered);
12403
+ }
12404
+ } else if (isSet(modelValue)) {
12405
+ const cloned = new Set(modelValue);
12406
+ if (checked) {
12407
+ cloned.add(elementValue);
12408
+ } else {
12409
+ cloned.delete(elementValue);
12410
+ }
12411
+ assign(cloned);
12412
+ } else {
12413
+ assign(getCheckboxValue(el, checked));
12414
+ }
12415
+ });
12416
+ };
12417
+ const vModelCheckboxUpdate = (el, oldValue, value, rawValue = getValue(el)) => {
11973
12418
  el._modelValue = value;
11974
12419
  let checked;
11975
12420
  if (isArray(value)) {
11976
- checked = looseIndexOf(value, vnode.props.value) > -1;
12421
+ checked = looseIndexOf(value, rawValue) > -1;
11977
12422
  } else if (isSet(value)) {
11978
- checked = value.has(vnode.props.value);
12423
+ checked = value.has(rawValue);
11979
12424
  } else {
11980
12425
  if (value === oldValue) return;
11981
12426
  checked = looseEqual(value, getCheckboxValue(el, true));
@@ -11983,7 +12428,7 @@ Expected function or array of functions, received type ${typeof value}.`
11983
12428
  if (el.checked !== checked) {
11984
12429
  el.checked = checked;
11985
12430
  }
11986
- }
12431
+ };
11987
12432
  const vModelRadio = {
11988
12433
  created(el, { value }, vnode) {
11989
12434
  el.checked = looseEqual(value, vnode.props.value);
@@ -12003,36 +12448,38 @@ Expected function or array of functions, received type ${typeof value}.`
12003
12448
  // <select multiple> value need to be deep traversed
12004
12449
  deep: true,
12005
12450
  created(el, { value, modifiers: { number } }, vnode) {
12006
- const isSetModel = isSet(value);
12007
- addEventListener(el, "change", () => {
12008
- const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12009
- (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12010
- );
12011
- el[assignKey](
12012
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12013
- );
12014
- el._assigning = true;
12015
- nextTick(() => {
12016
- el._assigning = false;
12017
- });
12018
- });
12451
+ vModelSelectInit(el, value, number);
12019
12452
  el[assignKey] = getModelAssigner(vnode);
12020
12453
  },
12021
12454
  // set value in mounted & updated because <select> relies on its children
12022
12455
  // <option>s.
12023
12456
  mounted(el, { value }) {
12024
- setSelected(el, value);
12457
+ vModelSetSelected(el, value);
12025
12458
  },
12026
12459
  beforeUpdate(el, _binding, vnode) {
12027
12460
  el[assignKey] = getModelAssigner(vnode);
12028
12461
  },
12029
12462
  updated(el, { value }) {
12030
- if (!el._assigning) {
12031
- setSelected(el, value);
12032
- }
12463
+ vModelSetSelected(el, value);
12033
12464
  }
12034
12465
  };
12035
- function setSelected(el, value) {
12466
+ const vModelSelectInit = (el, value, number, set) => {
12467
+ const isSetModel = isSet(value);
12468
+ addEventListener(el, "change", () => {
12469
+ const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12470
+ (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12471
+ );
12472
+ (0, el[assignKey])(
12473
+ el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12474
+ );
12475
+ el._assigning = true;
12476
+ nextTick(() => {
12477
+ el._assigning = false;
12478
+ });
12479
+ });
12480
+ };
12481
+ const vModelSetSelected = (el, value) => {
12482
+ if (el._assigning) return;
12036
12483
  const isMultiple = el.multiple;
12037
12484
  const isArrayValue = isArray(value);
12038
12485
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12063,13 +12510,20 @@ Expected function or array of functions, received type ${typeof value}.`
12063
12510
  if (!isMultiple && el.selectedIndex !== -1) {
12064
12511
  el.selectedIndex = -1;
12065
12512
  }
12066
- }
12513
+ };
12067
12514
  function getValue(el) {
12068
12515
  return "_value" in el ? el._value : el.value;
12069
12516
  }
12070
12517
  function getCheckboxValue(el, checked) {
12071
12518
  const key = checked ? "_trueValue" : "_falseValue";
12072
- return key in el ? el[key] : checked;
12519
+ if (key in el) {
12520
+ return el[key];
12521
+ }
12522
+ const attr = checked ? "true-value" : "false-value";
12523
+ if (el.hasAttribute(attr)) {
12524
+ return el.getAttribute(attr);
12525
+ }
12526
+ return checked;
12073
12527
  }
12074
12528
  const vModelDynamic = {
12075
12529
  created(el, binding, vnode) {