@vue/server-renderer 3.4.28 → 3.4.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/server-renderer v3.4.28
2
+ * @vue/server-renderer v3.4.30
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -180,3019 +180,6 @@ function ssrInterpolate(value) {
180
180
  return shared.escapeHtml(shared.toDisplayString(value));
181
181
  }
182
182
 
183
- let activeEffectScope;
184
- class EffectScope {
185
- constructor(detached = false) {
186
- this.detached = detached;
187
- /**
188
- * @internal
189
- */
190
- this._active = true;
191
- /**
192
- * @internal
193
- */
194
- this.effects = [];
195
- /**
196
- * @internal
197
- */
198
- this.cleanups = [];
199
- this.parent = activeEffectScope;
200
- if (!detached && activeEffectScope) {
201
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
202
- this
203
- ) - 1;
204
- }
205
- }
206
- get active() {
207
- return this._active;
208
- }
209
- run(fn) {
210
- if (this._active) {
211
- const currentEffectScope = activeEffectScope;
212
- try {
213
- activeEffectScope = this;
214
- return fn();
215
- } finally {
216
- activeEffectScope = currentEffectScope;
217
- }
218
- }
219
- }
220
- /**
221
- * This should only be called on non-detached scopes
222
- * @internal
223
- */
224
- on() {
225
- activeEffectScope = this;
226
- }
227
- /**
228
- * This should only be called on non-detached scopes
229
- * @internal
230
- */
231
- off() {
232
- activeEffectScope = this.parent;
233
- }
234
- stop(fromParent) {
235
- if (this._active) {
236
- let i, l;
237
- for (i = 0, l = this.effects.length; i < l; i++) {
238
- this.effects[i].stop();
239
- }
240
- for (i = 0, l = this.cleanups.length; i < l; i++) {
241
- this.cleanups[i]();
242
- }
243
- if (this.scopes) {
244
- for (i = 0, l = this.scopes.length; i < l; i++) {
245
- this.scopes[i].stop(true);
246
- }
247
- }
248
- if (!this.detached && this.parent && !fromParent) {
249
- const last = this.parent.scopes.pop();
250
- if (last && last !== this) {
251
- this.parent.scopes[this.index] = last;
252
- last.index = this.index;
253
- }
254
- }
255
- this.parent = void 0;
256
- this._active = false;
257
- }
258
- }
259
- }
260
- function recordEffectScope(effect, scope = activeEffectScope) {
261
- if (scope && scope.active) {
262
- scope.effects.push(effect);
263
- }
264
- }
265
- function getCurrentScope() {
266
- return activeEffectScope;
267
- }
268
-
269
- let activeEffect;
270
- class ReactiveEffect {
271
- constructor(fn, trigger, scheduler, scope) {
272
- this.fn = fn;
273
- this.trigger = trigger;
274
- this.scheduler = scheduler;
275
- this.active = true;
276
- this.deps = [];
277
- /**
278
- * @internal
279
- */
280
- this._dirtyLevel = 4;
281
- /**
282
- * @internal
283
- */
284
- this._trackId = 0;
285
- /**
286
- * @internal
287
- */
288
- this._runnings = 0;
289
- /**
290
- * @internal
291
- */
292
- this._shouldSchedule = false;
293
- /**
294
- * @internal
295
- */
296
- this._depsLength = 0;
297
- recordEffectScope(this, scope);
298
- }
299
- get dirty() {
300
- if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
301
- this._dirtyLevel = 1;
302
- pauseTracking();
303
- for (let i = 0; i < this._depsLength; i++) {
304
- const dep = this.deps[i];
305
- if (dep.computed) {
306
- triggerComputed(dep.computed);
307
- if (this._dirtyLevel >= 4) {
308
- break;
309
- }
310
- }
311
- }
312
- if (this._dirtyLevel === 1) {
313
- this._dirtyLevel = 0;
314
- }
315
- resetTracking();
316
- }
317
- return this._dirtyLevel >= 4;
318
- }
319
- set dirty(v) {
320
- this._dirtyLevel = v ? 4 : 0;
321
- }
322
- run() {
323
- this._dirtyLevel = 0;
324
- if (!this.active) {
325
- return this.fn();
326
- }
327
- let lastShouldTrack = shouldTrack;
328
- let lastEffect = activeEffect;
329
- try {
330
- shouldTrack = true;
331
- activeEffect = this;
332
- this._runnings++;
333
- preCleanupEffect(this);
334
- return this.fn();
335
- } finally {
336
- postCleanupEffect(this);
337
- this._runnings--;
338
- activeEffect = lastEffect;
339
- shouldTrack = lastShouldTrack;
340
- }
341
- }
342
- stop() {
343
- if (this.active) {
344
- preCleanupEffect(this);
345
- postCleanupEffect(this);
346
- this.onStop && this.onStop();
347
- this.active = false;
348
- }
349
- }
350
- }
351
- function triggerComputed(computed) {
352
- return computed.value;
353
- }
354
- function preCleanupEffect(effect2) {
355
- effect2._trackId++;
356
- effect2._depsLength = 0;
357
- }
358
- function postCleanupEffect(effect2) {
359
- if (effect2.deps.length > effect2._depsLength) {
360
- for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
361
- cleanupDepEffect(effect2.deps[i], effect2);
362
- }
363
- effect2.deps.length = effect2._depsLength;
364
- }
365
- }
366
- function cleanupDepEffect(dep, effect2) {
367
- const trackId = dep.get(effect2);
368
- if (trackId !== void 0 && effect2._trackId !== trackId) {
369
- dep.delete(effect2);
370
- if (dep.size === 0) {
371
- dep.cleanup();
372
- }
373
- }
374
- }
375
- let shouldTrack = true;
376
- let pauseScheduleStack = 0;
377
- const trackStack = [];
378
- function pauseTracking() {
379
- trackStack.push(shouldTrack);
380
- shouldTrack = false;
381
- }
382
- function resetTracking() {
383
- const last = trackStack.pop();
384
- shouldTrack = last === void 0 ? true : last;
385
- }
386
- function pauseScheduling() {
387
- pauseScheduleStack++;
388
- }
389
- function resetScheduling() {
390
- pauseScheduleStack--;
391
- while (!pauseScheduleStack && queueEffectSchedulers.length) {
392
- queueEffectSchedulers.shift()();
393
- }
394
- }
395
- function trackEffect(effect2, dep, debuggerEventExtraInfo) {
396
- if (dep.get(effect2) !== effect2._trackId) {
397
- dep.set(effect2, effect2._trackId);
398
- const oldDep = effect2.deps[effect2._depsLength];
399
- if (oldDep !== dep) {
400
- if (oldDep) {
401
- cleanupDepEffect(oldDep, effect2);
402
- }
403
- effect2.deps[effect2._depsLength++] = dep;
404
- } else {
405
- effect2._depsLength++;
406
- }
407
- }
408
- }
409
- const queueEffectSchedulers = [];
410
- function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
411
- pauseScheduling();
412
- for (const effect2 of dep.keys()) {
413
- let tracking;
414
- if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
415
- effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
416
- effect2._dirtyLevel = dirtyLevel;
417
- }
418
- if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
419
- effect2.trigger();
420
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
421
- effect2._shouldSchedule = false;
422
- if (effect2.scheduler) {
423
- queueEffectSchedulers.push(effect2.scheduler);
424
- }
425
- }
426
- }
427
- }
428
- resetScheduling();
429
- }
430
-
431
- const createDep = (cleanup, computed) => {
432
- const dep = /* @__PURE__ */ new Map();
433
- dep.cleanup = cleanup;
434
- dep.computed = computed;
435
- return dep;
436
- };
437
-
438
- const targetMap = /* @__PURE__ */ new WeakMap();
439
- const ITERATE_KEY = Symbol("");
440
- const MAP_KEY_ITERATE_KEY = Symbol("");
441
- function track(target, type, key) {
442
- if (shouldTrack && activeEffect) {
443
- let depsMap = targetMap.get(target);
444
- if (!depsMap) {
445
- targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
446
- }
447
- let dep = depsMap.get(key);
448
- if (!dep) {
449
- depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
450
- }
451
- trackEffect(
452
- activeEffect,
453
- dep);
454
- }
455
- }
456
- function trigger(target, type, key, newValue, oldValue, oldTarget) {
457
- const depsMap = targetMap.get(target);
458
- if (!depsMap) {
459
- return;
460
- }
461
- let deps = [];
462
- if (type === "clear") {
463
- deps = [...depsMap.values()];
464
- } else if (key === "length" && shared.isArray(target)) {
465
- const newLength = Number(newValue);
466
- depsMap.forEach((dep, key2) => {
467
- if (key2 === "length" || !shared.isSymbol(key2) && key2 >= newLength) {
468
- deps.push(dep);
469
- }
470
- });
471
- } else {
472
- if (key !== void 0) {
473
- deps.push(depsMap.get(key));
474
- }
475
- switch (type) {
476
- case "add":
477
- if (!shared.isArray(target)) {
478
- deps.push(depsMap.get(ITERATE_KEY));
479
- if (shared.isMap(target)) {
480
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
481
- }
482
- } else if (shared.isIntegerKey(key)) {
483
- deps.push(depsMap.get("length"));
484
- }
485
- break;
486
- case "delete":
487
- if (!shared.isArray(target)) {
488
- deps.push(depsMap.get(ITERATE_KEY));
489
- if (shared.isMap(target)) {
490
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
491
- }
492
- }
493
- break;
494
- case "set":
495
- if (shared.isMap(target)) {
496
- deps.push(depsMap.get(ITERATE_KEY));
497
- }
498
- break;
499
- }
500
- }
501
- pauseScheduling();
502
- for (const dep of deps) {
503
- if (dep) {
504
- triggerEffects(
505
- dep,
506
- 4);
507
- }
508
- }
509
- resetScheduling();
510
- }
511
-
512
- const isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,__isVue`);
513
- const builtInSymbols = new Set(
514
- /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(shared.isSymbol)
515
- );
516
- const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
517
- function createArrayInstrumentations() {
518
- const instrumentations = {};
519
- ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
520
- instrumentations[key] = function(...args) {
521
- const arr = toRaw(this);
522
- for (let i = 0, l = this.length; i < l; i++) {
523
- track(arr, "get", i + "");
524
- }
525
- const res = arr[key](...args);
526
- if (res === -1 || res === false) {
527
- return arr[key](...args.map(toRaw));
528
- } else {
529
- return res;
530
- }
531
- };
532
- });
533
- ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
534
- instrumentations[key] = function(...args) {
535
- pauseTracking();
536
- pauseScheduling();
537
- const res = toRaw(this)[key].apply(this, args);
538
- resetScheduling();
539
- resetTracking();
540
- return res;
541
- };
542
- });
543
- return instrumentations;
544
- }
545
- function hasOwnProperty(key) {
546
- if (!shared.isSymbol(key)) key = String(key);
547
- const obj = toRaw(this);
548
- track(obj, "has", key);
549
- return obj.hasOwnProperty(key);
550
- }
551
- class BaseReactiveHandler {
552
- constructor(_isReadonly = false, _isShallow = false) {
553
- this._isReadonly = _isReadonly;
554
- this._isShallow = _isShallow;
555
- }
556
- get(target, key, receiver) {
557
- const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
558
- if (key === "__v_isReactive") {
559
- return !isReadonly2;
560
- } else if (key === "__v_isReadonly") {
561
- return isReadonly2;
562
- } else if (key === "__v_isShallow") {
563
- return isShallow2;
564
- } else if (key === "__v_raw") {
565
- if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
566
- // this means the reciever is a user proxy of the reactive proxy
567
- Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
568
- return target;
569
- }
570
- return;
571
- }
572
- const targetIsArray = shared.isArray(target);
573
- if (!isReadonly2) {
574
- if (targetIsArray && shared.hasOwn(arrayInstrumentations, key)) {
575
- return Reflect.get(arrayInstrumentations, key, receiver);
576
- }
577
- if (key === "hasOwnProperty") {
578
- return hasOwnProperty;
579
- }
580
- }
581
- const res = Reflect.get(target, key, receiver);
582
- if (shared.isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
583
- return res;
584
- }
585
- if (!isReadonly2) {
586
- track(target, "get", key);
587
- }
588
- if (isShallow2) {
589
- return res;
590
- }
591
- if (isRef(res)) {
592
- return targetIsArray && shared.isIntegerKey(key) ? res : res.value;
593
- }
594
- if (shared.isObject(res)) {
595
- return isReadonly2 ? readonly(res) : reactive(res);
596
- }
597
- return res;
598
- }
599
- }
600
- class MutableReactiveHandler extends BaseReactiveHandler {
601
- constructor(isShallow2 = false) {
602
- super(false, isShallow2);
603
- }
604
- set(target, key, value, receiver) {
605
- let oldValue = target[key];
606
- if (!this._isShallow) {
607
- const isOldValueReadonly = isReadonly(oldValue);
608
- if (!isShallow(value) && !isReadonly(value)) {
609
- oldValue = toRaw(oldValue);
610
- value = toRaw(value);
611
- }
612
- if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
613
- if (isOldValueReadonly) {
614
- return false;
615
- } else {
616
- oldValue.value = value;
617
- return true;
618
- }
619
- }
620
- }
621
- const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key);
622
- const result = Reflect.set(target, key, value, receiver);
623
- if (target === toRaw(receiver)) {
624
- if (!hadKey) {
625
- trigger(target, "add", key, value);
626
- } else if (shared.hasChanged(value, oldValue)) {
627
- trigger(target, "set", key, value);
628
- }
629
- }
630
- return result;
631
- }
632
- deleteProperty(target, key) {
633
- const hadKey = shared.hasOwn(target, key);
634
- target[key];
635
- const result = Reflect.deleteProperty(target, key);
636
- if (result && hadKey) {
637
- trigger(target, "delete", key, void 0);
638
- }
639
- return result;
640
- }
641
- has(target, key) {
642
- const result = Reflect.has(target, key);
643
- if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
644
- track(target, "has", key);
645
- }
646
- return result;
647
- }
648
- ownKeys(target) {
649
- track(
650
- target,
651
- "iterate",
652
- shared.isArray(target) ? "length" : ITERATE_KEY
653
- );
654
- return Reflect.ownKeys(target);
655
- }
656
- }
657
- class ReadonlyReactiveHandler extends BaseReactiveHandler {
658
- constructor(isShallow2 = false) {
659
- super(true, isShallow2);
660
- }
661
- set(target, key) {
662
- return true;
663
- }
664
- deleteProperty(target, key) {
665
- return true;
666
- }
667
- }
668
- const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
669
- const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
670
- const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
671
- true
672
- );
673
-
674
- const toShallow = (value) => value;
675
- const getProto = (v) => Reflect.getPrototypeOf(v);
676
- function get(target, key, isReadonly = false, isShallow = false) {
677
- target = target["__v_raw"];
678
- const rawTarget = toRaw(target);
679
- const rawKey = toRaw(key);
680
- if (!isReadonly) {
681
- if (shared.hasChanged(key, rawKey)) {
682
- track(rawTarget, "get", key);
683
- }
684
- track(rawTarget, "get", rawKey);
685
- }
686
- const { has: has2 } = getProto(rawTarget);
687
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
688
- if (has2.call(rawTarget, key)) {
689
- return wrap(target.get(key));
690
- } else if (has2.call(rawTarget, rawKey)) {
691
- return wrap(target.get(rawKey));
692
- } else if (target !== rawTarget) {
693
- target.get(key);
694
- }
695
- }
696
- function has(key, isReadonly = false) {
697
- const target = this["__v_raw"];
698
- const rawTarget = toRaw(target);
699
- const rawKey = toRaw(key);
700
- if (!isReadonly) {
701
- if (shared.hasChanged(key, rawKey)) {
702
- track(rawTarget, "has", key);
703
- }
704
- track(rawTarget, "has", rawKey);
705
- }
706
- return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
707
- }
708
- function size(target, isReadonly = false) {
709
- target = target["__v_raw"];
710
- !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
711
- return Reflect.get(target, "size", target);
712
- }
713
- function add(value) {
714
- value = toRaw(value);
715
- const target = toRaw(this);
716
- const proto = getProto(target);
717
- const hadKey = proto.has.call(target, value);
718
- if (!hadKey) {
719
- target.add(value);
720
- trigger(target, "add", value, value);
721
- }
722
- return this;
723
- }
724
- function set(key, value) {
725
- value = toRaw(value);
726
- const target = toRaw(this);
727
- const { has: has2, get: get2 } = getProto(target);
728
- let hadKey = has2.call(target, key);
729
- if (!hadKey) {
730
- key = toRaw(key);
731
- hadKey = has2.call(target, key);
732
- }
733
- const oldValue = get2.call(target, key);
734
- target.set(key, value);
735
- if (!hadKey) {
736
- trigger(target, "add", key, value);
737
- } else if (shared.hasChanged(value, oldValue)) {
738
- trigger(target, "set", key, value);
739
- }
740
- return this;
741
- }
742
- function deleteEntry(key) {
743
- const target = toRaw(this);
744
- const { has: has2, get: get2 } = getProto(target);
745
- let hadKey = has2.call(target, key);
746
- if (!hadKey) {
747
- key = toRaw(key);
748
- hadKey = has2.call(target, key);
749
- }
750
- get2 ? get2.call(target, key) : void 0;
751
- const result = target.delete(key);
752
- if (hadKey) {
753
- trigger(target, "delete", key, void 0);
754
- }
755
- return result;
756
- }
757
- function clear() {
758
- const target = toRaw(this);
759
- const hadItems = target.size !== 0;
760
- const result = target.clear();
761
- if (hadItems) {
762
- trigger(target, "clear", void 0, void 0);
763
- }
764
- return result;
765
- }
766
- function createForEach(isReadonly, isShallow) {
767
- return function forEach(callback, thisArg) {
768
- const observed = this;
769
- const target = observed["__v_raw"];
770
- const rawTarget = toRaw(target);
771
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
772
- !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
773
- return target.forEach((value, key) => {
774
- return callback.call(thisArg, wrap(value), wrap(key), observed);
775
- });
776
- };
777
- }
778
- function createIterableMethod(method, isReadonly, isShallow) {
779
- return function(...args) {
780
- const target = this["__v_raw"];
781
- const rawTarget = toRaw(target);
782
- const targetIsMap = shared.isMap(rawTarget);
783
- const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
784
- const isKeyOnly = method === "keys" && targetIsMap;
785
- const innerIterator = target[method](...args);
786
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
787
- !isReadonly && track(
788
- rawTarget,
789
- "iterate",
790
- isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
791
- );
792
- return {
793
- // iterator protocol
794
- next() {
795
- const { value, done } = innerIterator.next();
796
- return done ? { value, done } : {
797
- value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
798
- done
799
- };
800
- },
801
- // iterable protocol
802
- [Symbol.iterator]() {
803
- return this;
804
- }
805
- };
806
- };
807
- }
808
- function createReadonlyMethod(type) {
809
- return function(...args) {
810
- return type === "delete" ? false : type === "clear" ? void 0 : this;
811
- };
812
- }
813
- function createInstrumentations() {
814
- const mutableInstrumentations2 = {
815
- get(key) {
816
- return get(this, key);
817
- },
818
- get size() {
819
- return size(this);
820
- },
821
- has,
822
- add,
823
- set,
824
- delete: deleteEntry,
825
- clear,
826
- forEach: createForEach(false, false)
827
- };
828
- const shallowInstrumentations2 = {
829
- get(key) {
830
- return get(this, key, false, true);
831
- },
832
- get size() {
833
- return size(this);
834
- },
835
- has,
836
- add,
837
- set,
838
- delete: deleteEntry,
839
- clear,
840
- forEach: createForEach(false, true)
841
- };
842
- const readonlyInstrumentations2 = {
843
- get(key) {
844
- return get(this, key, true);
845
- },
846
- get size() {
847
- return size(this, true);
848
- },
849
- has(key) {
850
- return has.call(this, key, true);
851
- },
852
- add: createReadonlyMethod("add"),
853
- set: createReadonlyMethod("set"),
854
- delete: createReadonlyMethod("delete"),
855
- clear: createReadonlyMethod("clear"),
856
- forEach: createForEach(true, false)
857
- };
858
- const shallowReadonlyInstrumentations2 = {
859
- get(key) {
860
- return get(this, key, true, true);
861
- },
862
- get size() {
863
- return size(this, true);
864
- },
865
- has(key) {
866
- return has.call(this, key, true);
867
- },
868
- add: createReadonlyMethod("add"),
869
- set: createReadonlyMethod("set"),
870
- delete: createReadonlyMethod("delete"),
871
- clear: createReadonlyMethod("clear"),
872
- forEach: createForEach(true, true)
873
- };
874
- const iteratorMethods = [
875
- "keys",
876
- "values",
877
- "entries",
878
- Symbol.iterator
879
- ];
880
- iteratorMethods.forEach((method) => {
881
- mutableInstrumentations2[method] = createIterableMethod(method, false, false);
882
- readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
883
- shallowInstrumentations2[method] = createIterableMethod(method, false, true);
884
- shallowReadonlyInstrumentations2[method] = createIterableMethod(
885
- method,
886
- true,
887
- true
888
- );
889
- });
890
- return [
891
- mutableInstrumentations2,
892
- readonlyInstrumentations2,
893
- shallowInstrumentations2,
894
- shallowReadonlyInstrumentations2
895
- ];
896
- }
897
- const [
898
- mutableInstrumentations,
899
- readonlyInstrumentations,
900
- shallowInstrumentations,
901
- shallowReadonlyInstrumentations
902
- ] = /* @__PURE__ */ createInstrumentations();
903
- function createInstrumentationGetter(isReadonly, shallow) {
904
- const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
905
- return (target, key, receiver) => {
906
- if (key === "__v_isReactive") {
907
- return !isReadonly;
908
- } else if (key === "__v_isReadonly") {
909
- return isReadonly;
910
- } else if (key === "__v_raw") {
911
- return target;
912
- }
913
- return Reflect.get(
914
- shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target,
915
- key,
916
- receiver
917
- );
918
- };
919
- }
920
- const mutableCollectionHandlers = {
921
- get: /* @__PURE__ */ createInstrumentationGetter(false, false)
922
- };
923
- const shallowCollectionHandlers = {
924
- get: /* @__PURE__ */ createInstrumentationGetter(false, true)
925
- };
926
- const readonlyCollectionHandlers = {
927
- get: /* @__PURE__ */ createInstrumentationGetter(true, false)
928
- };
929
-
930
- const reactiveMap = /* @__PURE__ */ new WeakMap();
931
- const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
932
- const readonlyMap = /* @__PURE__ */ new WeakMap();
933
- const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
934
- function targetTypeMap(rawType) {
935
- switch (rawType) {
936
- case "Object":
937
- case "Array":
938
- return 1 /* COMMON */;
939
- case "Map":
940
- case "Set":
941
- case "WeakMap":
942
- case "WeakSet":
943
- return 2 /* COLLECTION */;
944
- default:
945
- return 0 /* INVALID */;
946
- }
947
- }
948
- function getTargetType(value) {
949
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(shared.toRawType(value));
950
- }
951
- function reactive(target) {
952
- if (isReadonly(target)) {
953
- return target;
954
- }
955
- return createReactiveObject(
956
- target,
957
- false,
958
- mutableHandlers,
959
- mutableCollectionHandlers,
960
- reactiveMap
961
- );
962
- }
963
- function shallowReactive(target) {
964
- return createReactiveObject(
965
- target,
966
- false,
967
- shallowReactiveHandlers,
968
- shallowCollectionHandlers,
969
- shallowReactiveMap
970
- );
971
- }
972
- function readonly(target) {
973
- return createReactiveObject(
974
- target,
975
- true,
976
- readonlyHandlers,
977
- readonlyCollectionHandlers,
978
- readonlyMap
979
- );
980
- }
981
- function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
982
- if (!shared.isObject(target)) {
983
- return target;
984
- }
985
- if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
986
- return target;
987
- }
988
- const existingProxy = proxyMap.get(target);
989
- if (existingProxy) {
990
- return existingProxy;
991
- }
992
- const targetType = getTargetType(target);
993
- if (targetType === 0 /* INVALID */) {
994
- return target;
995
- }
996
- const proxy = new Proxy(
997
- target,
998
- targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
999
- );
1000
- proxyMap.set(target, proxy);
1001
- return proxy;
1002
- }
1003
- function isReactive(value) {
1004
- if (isReadonly(value)) {
1005
- return isReactive(value["__v_raw"]);
1006
- }
1007
- return !!(value && value["__v_isReactive"]);
1008
- }
1009
- function isReadonly(value) {
1010
- return !!(value && value["__v_isReadonly"]);
1011
- }
1012
- function isShallow(value) {
1013
- return !!(value && value["__v_isShallow"]);
1014
- }
1015
- function isProxy(value) {
1016
- return value ? !!value["__v_raw"] : false;
1017
- }
1018
- function toRaw(observed) {
1019
- const raw = observed && observed["__v_raw"];
1020
- return raw ? toRaw(raw) : observed;
1021
- }
1022
- function markRaw(value) {
1023
- if (Object.isExtensible(value)) {
1024
- shared.def(value, "__v_skip", true);
1025
- }
1026
- return value;
1027
- }
1028
- const toReactive = (value) => shared.isObject(value) ? reactive(value) : value;
1029
- const toReadonly = (value) => shared.isObject(value) ? readonly(value) : value;
1030
-
1031
- class ComputedRefImpl {
1032
- constructor(getter, _setter, isReadonly, isSSR) {
1033
- this.getter = getter;
1034
- this._setter = _setter;
1035
- this.dep = void 0;
1036
- this.__v_isRef = true;
1037
- this["__v_isReadonly"] = false;
1038
- this.effect = new ReactiveEffect(
1039
- () => getter(this._value),
1040
- () => triggerRefValue(
1041
- this,
1042
- this.effect._dirtyLevel === 2 ? 2 : 3
1043
- )
1044
- );
1045
- this.effect.computed = this;
1046
- this.effect.active = this._cacheable = !isSSR;
1047
- this["__v_isReadonly"] = isReadonly;
1048
- }
1049
- get value() {
1050
- const self = toRaw(this);
1051
- if ((!self._cacheable || self.effect.dirty) && shared.hasChanged(self._value, self._value = self.effect.run())) {
1052
- triggerRefValue(self, 4);
1053
- }
1054
- trackRefValue(self);
1055
- if (self.effect._dirtyLevel >= 2) {
1056
- triggerRefValue(self, 2);
1057
- }
1058
- return self._value;
1059
- }
1060
- set value(newValue) {
1061
- this._setter(newValue);
1062
- }
1063
- // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
1064
- get _dirty() {
1065
- return this.effect.dirty;
1066
- }
1067
- set _dirty(v) {
1068
- this.effect.dirty = v;
1069
- }
1070
- // #endregion
1071
- }
1072
- function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1073
- let getter;
1074
- let setter;
1075
- const onlyGetter = shared.isFunction(getterOrOptions);
1076
- if (onlyGetter) {
1077
- getter = getterOrOptions;
1078
- setter = shared.NOOP;
1079
- } else {
1080
- getter = getterOrOptions.get;
1081
- setter = getterOrOptions.set;
1082
- }
1083
- const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1084
- return cRef;
1085
- }
1086
-
1087
- function trackRefValue(ref2) {
1088
- var _a;
1089
- if (shouldTrack && activeEffect) {
1090
- ref2 = toRaw(ref2);
1091
- trackEffect(
1092
- activeEffect,
1093
- (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1094
- () => ref2.dep = void 0,
1095
- ref2 instanceof ComputedRefImpl ? ref2 : void 0
1096
- ));
1097
- }
1098
- }
1099
- function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
1100
- ref2 = toRaw(ref2);
1101
- const dep = ref2.dep;
1102
- if (dep) {
1103
- triggerEffects(
1104
- dep,
1105
- dirtyLevel);
1106
- }
1107
- }
1108
- function isRef(r) {
1109
- return !!(r && r.__v_isRef === true);
1110
- }
1111
- function unref(ref2) {
1112
- return isRef(ref2) ? ref2.value : ref2;
1113
- }
1114
- const shallowUnwrapHandlers = {
1115
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1116
- set: (target, key, value, receiver) => {
1117
- const oldValue = target[key];
1118
- if (isRef(oldValue) && !isRef(value)) {
1119
- oldValue.value = value;
1120
- return true;
1121
- } else {
1122
- return Reflect.set(target, key, value, receiver);
1123
- }
1124
- }
1125
- };
1126
- function proxyRefs(objectWithRefs) {
1127
- return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1128
- }
1129
-
1130
- function callWithErrorHandling(fn, instance, type, args) {
1131
- try {
1132
- return args ? fn(...args) : fn();
1133
- } catch (err) {
1134
- handleError(err, instance, type);
1135
- }
1136
- }
1137
- function callWithAsyncErrorHandling(fn, instance, type, args) {
1138
- if (shared.isFunction(fn)) {
1139
- const res = callWithErrorHandling(fn, instance, type, args);
1140
- if (res && shared.isPromise(res)) {
1141
- res.catch((err) => {
1142
- handleError(err, instance, type);
1143
- });
1144
- }
1145
- return res;
1146
- }
1147
- if (shared.isArray(fn)) {
1148
- const values = [];
1149
- for (let i = 0; i < fn.length; i++) {
1150
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1151
- }
1152
- return values;
1153
- }
1154
- }
1155
- function handleError(err, instance, type, throwInDev = true) {
1156
- const contextVNode = instance ? instance.vnode : null;
1157
- if (instance) {
1158
- let cur = instance.parent;
1159
- const exposedInstance = instance.proxy;
1160
- const errorInfo = `https://vuejs.org/error-reference/#runtime-${type}`;
1161
- while (cur) {
1162
- const errorCapturedHooks = cur.ec;
1163
- if (errorCapturedHooks) {
1164
- for (let i = 0; i < errorCapturedHooks.length; i++) {
1165
- if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
1166
- return;
1167
- }
1168
- }
1169
- }
1170
- cur = cur.parent;
1171
- }
1172
- const appErrorHandler = instance.appContext.config.errorHandler;
1173
- if (appErrorHandler) {
1174
- pauseTracking();
1175
- callWithErrorHandling(
1176
- appErrorHandler,
1177
- null,
1178
- 10,
1179
- [err, exposedInstance, errorInfo]
1180
- );
1181
- resetTracking();
1182
- return;
1183
- }
1184
- }
1185
- logError(err, type, contextVNode, throwInDev);
1186
- }
1187
- function logError(err, type, contextVNode, throwInDev = true) {
1188
- {
1189
- console.error(err);
1190
- }
1191
- }
1192
-
1193
- let isFlushing = false;
1194
- let isFlushPending = false;
1195
- const queue = [];
1196
- let flushIndex = 0;
1197
- const pendingPostFlushCbs = [];
1198
- let activePostFlushCbs = null;
1199
- let postFlushIndex = 0;
1200
- const resolvedPromise = /* @__PURE__ */ Promise.resolve();
1201
- let currentFlushPromise = null;
1202
- function nextTick(fn) {
1203
- const p = currentFlushPromise || resolvedPromise;
1204
- return fn ? p.then(this ? fn.bind(this) : fn) : p;
1205
- }
1206
- function findInsertionIndex(id) {
1207
- let start = flushIndex + 1;
1208
- let end = queue.length;
1209
- while (start < end) {
1210
- const middle = start + end >>> 1;
1211
- const middleJob = queue[middle];
1212
- const middleJobId = getId(middleJob);
1213
- if (middleJobId < id || middleJobId === id && middleJob.pre) {
1214
- start = middle + 1;
1215
- } else {
1216
- end = middle;
1217
- }
1218
- }
1219
- return start;
1220
- }
1221
- function queueJob(job) {
1222
- if (!queue.length || !queue.includes(
1223
- job,
1224
- isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
1225
- )) {
1226
- if (job.id == null) {
1227
- queue.push(job);
1228
- } else {
1229
- queue.splice(findInsertionIndex(job.id), 0, job);
1230
- }
1231
- queueFlush();
1232
- }
1233
- }
1234
- function queueFlush() {
1235
- if (!isFlushing && !isFlushPending) {
1236
- isFlushPending = true;
1237
- currentFlushPromise = resolvedPromise.then(flushJobs);
1238
- }
1239
- }
1240
- function queuePostFlushCb(cb) {
1241
- if (!shared.isArray(cb)) {
1242
- if (!activePostFlushCbs || !activePostFlushCbs.includes(
1243
- cb,
1244
- cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
1245
- )) {
1246
- pendingPostFlushCbs.push(cb);
1247
- }
1248
- } else {
1249
- pendingPostFlushCbs.push(...cb);
1250
- }
1251
- queueFlush();
1252
- }
1253
- function flushPostFlushCbs(seen) {
1254
- if (pendingPostFlushCbs.length) {
1255
- const deduped = [...new Set(pendingPostFlushCbs)].sort(
1256
- (a, b) => getId(a) - getId(b)
1257
- );
1258
- pendingPostFlushCbs.length = 0;
1259
- if (activePostFlushCbs) {
1260
- activePostFlushCbs.push(...deduped);
1261
- return;
1262
- }
1263
- activePostFlushCbs = deduped;
1264
- for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1265
- const cb = activePostFlushCbs[postFlushIndex];
1266
- if (cb.active !== false) cb();
1267
- }
1268
- activePostFlushCbs = null;
1269
- postFlushIndex = 0;
1270
- }
1271
- }
1272
- const getId = (job) => job.id == null ? Infinity : job.id;
1273
- const comparator = (a, b) => {
1274
- const diff = getId(a) - getId(b);
1275
- if (diff === 0) {
1276
- if (a.pre && !b.pre) return -1;
1277
- if (b.pre && !a.pre) return 1;
1278
- }
1279
- return diff;
1280
- };
1281
- function flushJobs(seen) {
1282
- isFlushPending = false;
1283
- isFlushing = true;
1284
- queue.sort(comparator);
1285
- try {
1286
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
1287
- const job = queue[flushIndex];
1288
- if (job && job.active !== false) {
1289
- if (false) ;
1290
- callWithErrorHandling(job, null, 14);
1291
- }
1292
- }
1293
- } finally {
1294
- flushIndex = 0;
1295
- queue.length = 0;
1296
- flushPostFlushCbs();
1297
- isFlushing = false;
1298
- currentFlushPromise = null;
1299
- if (queue.length || pendingPostFlushCbs.length) {
1300
- flushJobs();
1301
- }
1302
- }
1303
- }
1304
-
1305
- function emit(instance, event, ...rawArgs) {
1306
- if (instance.isUnmounted) return;
1307
- const props = instance.vnode.props || shared.EMPTY_OBJ;
1308
- let args = rawArgs;
1309
- const isModelListener = event.startsWith("update:");
1310
- const modelArg = isModelListener && event.slice(7);
1311
- if (modelArg && modelArg in props) {
1312
- const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
1313
- const { number, trim } = props[modifiersKey] || shared.EMPTY_OBJ;
1314
- if (trim) {
1315
- args = rawArgs.map((a) => shared.isString(a) ? a.trim() : a);
1316
- }
1317
- if (number) {
1318
- args = rawArgs.map(shared.looseToNumber);
1319
- }
1320
- }
1321
- let handlerName;
1322
- let handler = props[handlerName = shared.toHandlerKey(event)] || // also try camelCase event handler (#2249)
1323
- props[handlerName = shared.toHandlerKey(shared.camelize(event))];
1324
- if (!handler && isModelListener) {
1325
- handler = props[handlerName = shared.toHandlerKey(shared.hyphenate(event))];
1326
- }
1327
- if (handler) {
1328
- callWithAsyncErrorHandling(
1329
- handler,
1330
- instance,
1331
- 6,
1332
- args
1333
- );
1334
- }
1335
- const onceHandler = props[handlerName + `Once`];
1336
- if (onceHandler) {
1337
- if (!instance.emitted) {
1338
- instance.emitted = {};
1339
- } else if (instance.emitted[handlerName]) {
1340
- return;
1341
- }
1342
- instance.emitted[handlerName] = true;
1343
- callWithAsyncErrorHandling(
1344
- onceHandler,
1345
- instance,
1346
- 6,
1347
- args
1348
- );
1349
- }
1350
- }
1351
- function normalizeEmitsOptions(comp, appContext, asMixin = false) {
1352
- const cache = appContext.emitsCache;
1353
- const cached = cache.get(comp);
1354
- if (cached !== void 0) {
1355
- return cached;
1356
- }
1357
- const raw = comp.emits;
1358
- let normalized = {};
1359
- let hasExtends = false;
1360
- if (!shared.isFunction(comp)) {
1361
- const extendEmits = (raw2) => {
1362
- const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
1363
- if (normalizedFromExtend) {
1364
- hasExtends = true;
1365
- shared.extend(normalized, normalizedFromExtend);
1366
- }
1367
- };
1368
- if (!asMixin && appContext.mixins.length) {
1369
- appContext.mixins.forEach(extendEmits);
1370
- }
1371
- if (comp.extends) {
1372
- extendEmits(comp.extends);
1373
- }
1374
- if (comp.mixins) {
1375
- comp.mixins.forEach(extendEmits);
1376
- }
1377
- }
1378
- if (!raw && !hasExtends) {
1379
- if (shared.isObject(comp)) {
1380
- cache.set(comp, null);
1381
- }
1382
- return null;
1383
- }
1384
- if (shared.isArray(raw)) {
1385
- raw.forEach((key) => normalized[key] = null);
1386
- } else {
1387
- shared.extend(normalized, raw);
1388
- }
1389
- if (shared.isObject(comp)) {
1390
- cache.set(comp, normalized);
1391
- }
1392
- return normalized;
1393
- }
1394
- function isEmitListener(options, key) {
1395
- if (!options || !shared.isOn(key)) {
1396
- return false;
1397
- }
1398
- key = key.slice(2).replace(/Once$/, "");
1399
- return shared.hasOwn(options, key[0].toLowerCase() + key.slice(1)) || shared.hasOwn(options, shared.hyphenate(key)) || shared.hasOwn(options, key);
1400
- }
1401
-
1402
- let currentRenderingInstance = null;
1403
- let currentScopeId = null;
1404
- function setCurrentRenderingInstance$1(instance) {
1405
- const prev = currentRenderingInstance;
1406
- currentRenderingInstance = instance;
1407
- currentScopeId = instance && instance.type.__scopeId || null;
1408
- return prev;
1409
- }
1410
- function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
1411
- if (!ctx) return fn;
1412
- if (fn._n) {
1413
- return fn;
1414
- }
1415
- const renderFnWithContext = (...args) => {
1416
- if (renderFnWithContext._d) {
1417
- setBlockTracking(-1);
1418
- }
1419
- const prevInstance = setCurrentRenderingInstance$1(ctx);
1420
- let res;
1421
- try {
1422
- res = fn(...args);
1423
- } finally {
1424
- setCurrentRenderingInstance$1(prevInstance);
1425
- if (renderFnWithContext._d) {
1426
- setBlockTracking(1);
1427
- }
1428
- }
1429
- return res;
1430
- };
1431
- renderFnWithContext._n = true;
1432
- renderFnWithContext._c = true;
1433
- renderFnWithContext._d = true;
1434
- return renderFnWithContext;
1435
- }
1436
-
1437
- function markAttrsAccessed() {
1438
- }
1439
- function renderComponentRoot$1(instance) {
1440
- const {
1441
- type: Component,
1442
- vnode,
1443
- proxy,
1444
- withProxy,
1445
- propsOptions: [propsOptions],
1446
- slots,
1447
- attrs,
1448
- emit,
1449
- render,
1450
- renderCache,
1451
- props,
1452
- data,
1453
- setupState,
1454
- ctx,
1455
- inheritAttrs
1456
- } = instance;
1457
- const prev = setCurrentRenderingInstance$1(instance);
1458
- let result;
1459
- let fallthroughAttrs;
1460
- try {
1461
- if (vnode.shapeFlag & 4) {
1462
- const proxyToUse = withProxy || proxy;
1463
- const thisProxy = false ? new Proxy(proxyToUse, {
1464
- get(target, key, receiver) {
1465
- warn(
1466
- `Property '${String(
1467
- key
1468
- )}' was accessed via 'this'. Avoid using 'this' in templates.`
1469
- );
1470
- return Reflect.get(target, key, receiver);
1471
- }
1472
- }) : proxyToUse;
1473
- result = normalizeVNode$1(
1474
- render.call(
1475
- thisProxy,
1476
- proxyToUse,
1477
- renderCache,
1478
- false ? shallowReadonly(props) : props,
1479
- setupState,
1480
- data,
1481
- ctx
1482
- )
1483
- );
1484
- fallthroughAttrs = attrs;
1485
- } else {
1486
- const render2 = Component;
1487
- if (false) ;
1488
- result = normalizeVNode$1(
1489
- render2.length > 1 ? render2(
1490
- false ? shallowReadonly(props) : props,
1491
- false ? {
1492
- get attrs() {
1493
- markAttrsAccessed();
1494
- return shallowReadonly(attrs);
1495
- },
1496
- slots,
1497
- emit
1498
- } : { attrs, slots, emit }
1499
- ) : render2(
1500
- false ? shallowReadonly(props) : props,
1501
- null
1502
- )
1503
- );
1504
- fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
1505
- }
1506
- } catch (err) {
1507
- handleError(err, instance, 1);
1508
- result = createVNode(Comment);
1509
- }
1510
- let root = result;
1511
- if (fallthroughAttrs && inheritAttrs !== false) {
1512
- const keys = Object.keys(fallthroughAttrs);
1513
- const { shapeFlag } = root;
1514
- if (keys.length) {
1515
- if (shapeFlag & (1 | 6)) {
1516
- if (propsOptions && keys.some(shared.isModelListener)) {
1517
- fallthroughAttrs = filterModelListeners(
1518
- fallthroughAttrs,
1519
- propsOptions
1520
- );
1521
- }
1522
- root = cloneVNode(root, fallthroughAttrs, false, true);
1523
- }
1524
- }
1525
- }
1526
- if (vnode.dirs) {
1527
- root = cloneVNode(root, null, false, true);
1528
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
1529
- }
1530
- if (vnode.transition) {
1531
- root.transition = vnode.transition;
1532
- }
1533
- {
1534
- result = root;
1535
- }
1536
- setCurrentRenderingInstance$1(prev);
1537
- return result;
1538
- }
1539
- const getFunctionalFallthrough = (attrs) => {
1540
- let res;
1541
- for (const key in attrs) {
1542
- if (key === "class" || key === "style" || shared.isOn(key)) {
1543
- (res || (res = {}))[key] = attrs[key];
1544
- }
1545
- }
1546
- return res;
1547
- };
1548
- const filterModelListeners = (attrs, props) => {
1549
- const res = {};
1550
- for (const key in attrs) {
1551
- if (!shared.isModelListener(key) || !(key.slice(9) in props)) {
1552
- res[key] = attrs[key];
1553
- }
1554
- }
1555
- return res;
1556
- };
1557
-
1558
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
1559
-
1560
- const isSuspense = (type) => type.__isSuspense;
1561
- function queueEffectWithSuspense(fn, suspense) {
1562
- if (suspense && suspense.pendingBranch) {
1563
- if (shared.isArray(fn)) {
1564
- suspense.effects.push(...fn);
1565
- } else {
1566
- suspense.effects.push(fn);
1567
- }
1568
- } else {
1569
- queuePostFlushCb(fn);
1570
- }
1571
- }
1572
-
1573
- function injectHook(type, hook, target = currentInstance, prepend = false) {
1574
- if (target) {
1575
- const hooks = target[type] || (target[type] = []);
1576
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
1577
- pauseTracking();
1578
- const reset = setCurrentInstance(target);
1579
- const res = callWithAsyncErrorHandling(hook, target, type, args);
1580
- reset();
1581
- resetTracking();
1582
- return res;
1583
- });
1584
- if (prepend) {
1585
- hooks.unshift(wrappedHook);
1586
- } else {
1587
- hooks.push(wrappedHook);
1588
- }
1589
- return wrappedHook;
1590
- }
1591
- }
1592
- const createHook = (lifecycle) => (hook, target = currentInstance) => {
1593
- if (!isInSSRComponentSetup || lifecycle === "sp") {
1594
- injectHook(lifecycle, (...args) => hook(...args), target);
1595
- }
1596
- };
1597
- const onBeforeMount = createHook("bm");
1598
- const onMounted = createHook("m");
1599
- const onBeforeUpdate = createHook("bu");
1600
- const onUpdated = createHook("u");
1601
- const onBeforeUnmount = createHook("bum");
1602
- const onUnmounted = createHook("um");
1603
- const onServerPrefetch = createHook("sp");
1604
- const onRenderTriggered = createHook(
1605
- "rtg"
1606
- );
1607
- const onRenderTracked = createHook(
1608
- "rtc"
1609
- );
1610
- function onErrorCaptured(hook, target = currentInstance) {
1611
- injectHook("ec", hook, target);
1612
- }
1613
-
1614
- const getPublicInstance = (i) => {
1615
- if (!i) return null;
1616
- if (isStatefulComponent(i)) return getComponentPublicInstance(i);
1617
- return getPublicInstance(i.parent);
1618
- };
1619
- const publicPropertiesMap = (
1620
- // Move PURE marker to new line to workaround compiler discarding it
1621
- // due to type annotation
1622
- /* @__PURE__ */ shared.extend(/* @__PURE__ */ Object.create(null), {
1623
- $: (i) => i,
1624
- $el: (i) => i.vnode.el,
1625
- $data: (i) => i.data,
1626
- $props: (i) => i.props,
1627
- $attrs: (i) => i.attrs,
1628
- $slots: (i) => i.slots,
1629
- $refs: (i) => i.refs,
1630
- $parent: (i) => getPublicInstance(i.parent),
1631
- $root: (i) => getPublicInstance(i.root),
1632
- $emit: (i) => i.emit,
1633
- $options: (i) => resolveMergedOptions(i) ,
1634
- $forceUpdate: (i) => i.f || (i.f = () => {
1635
- i.effect.dirty = true;
1636
- queueJob(i.update);
1637
- }),
1638
- $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
1639
- $watch: (i) => instanceWatch.bind(i)
1640
- })
1641
- );
1642
- const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
1643
- const PublicInstanceProxyHandlers = {
1644
- get({ _: instance }, key) {
1645
- if (key === "__v_skip") {
1646
- return true;
1647
- }
1648
- const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
1649
- let normalizedProps;
1650
- if (key[0] !== "$") {
1651
- const n = accessCache[key];
1652
- if (n !== void 0) {
1653
- switch (n) {
1654
- case 1 /* SETUP */:
1655
- return setupState[key];
1656
- case 2 /* DATA */:
1657
- return data[key];
1658
- case 4 /* CONTEXT */:
1659
- return ctx[key];
1660
- case 3 /* PROPS */:
1661
- return props[key];
1662
- }
1663
- } else if (hasSetupBinding(setupState, key)) {
1664
- accessCache[key] = 1 /* SETUP */;
1665
- return setupState[key];
1666
- } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
1667
- accessCache[key] = 2 /* DATA */;
1668
- return data[key];
1669
- } else if (
1670
- // only cache other properties when instance has declared (thus stable)
1671
- // props
1672
- (normalizedProps = instance.propsOptions[0]) && shared.hasOwn(normalizedProps, key)
1673
- ) {
1674
- accessCache[key] = 3 /* PROPS */;
1675
- return props[key];
1676
- } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
1677
- accessCache[key] = 4 /* CONTEXT */;
1678
- return ctx[key];
1679
- } else if (shouldCacheAccess) {
1680
- accessCache[key] = 0 /* OTHER */;
1681
- }
1682
- }
1683
- const publicGetter = publicPropertiesMap[key];
1684
- let cssModule, globalProperties;
1685
- if (publicGetter) {
1686
- if (key === "$attrs") {
1687
- track(instance.attrs, "get", "");
1688
- }
1689
- return publicGetter(instance);
1690
- } else if (
1691
- // css module (injected by vue-loader)
1692
- (cssModule = type.__cssModules) && (cssModule = cssModule[key])
1693
- ) {
1694
- return cssModule;
1695
- } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
1696
- accessCache[key] = 4 /* CONTEXT */;
1697
- return ctx[key];
1698
- } else if (
1699
- // global properties
1700
- globalProperties = appContext.config.globalProperties, shared.hasOwn(globalProperties, key)
1701
- ) {
1702
- {
1703
- return globalProperties[key];
1704
- }
1705
- } else ;
1706
- },
1707
- set({ _: instance }, key, value) {
1708
- const { data, setupState, ctx } = instance;
1709
- if (hasSetupBinding(setupState, key)) {
1710
- setupState[key] = value;
1711
- return true;
1712
- } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
1713
- data[key] = value;
1714
- return true;
1715
- } else if (shared.hasOwn(instance.props, key)) {
1716
- return false;
1717
- }
1718
- if (key[0] === "$" && key.slice(1) in instance) {
1719
- return false;
1720
- } else {
1721
- {
1722
- ctx[key] = value;
1723
- }
1724
- }
1725
- return true;
1726
- },
1727
- has({
1728
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
1729
- }, key) {
1730
- let normalizedProps;
1731
- return !!accessCache[key] || data !== shared.EMPTY_OBJ && shared.hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key) || shared.hasOwn(ctx, key) || shared.hasOwn(publicPropertiesMap, key) || shared.hasOwn(appContext.config.globalProperties, key);
1732
- },
1733
- defineProperty(target, key, descriptor) {
1734
- if (descriptor.get != null) {
1735
- target._.accessCache[key] = 0;
1736
- } else if (shared.hasOwn(descriptor, "value")) {
1737
- this.set(target, key, descriptor.value, null);
1738
- }
1739
- return Reflect.defineProperty(target, key, descriptor);
1740
- }
1741
- };
1742
-
1743
- function normalizePropsOrEmits(props) {
1744
- return shared.isArray(props) ? props.reduce(
1745
- (normalized, p) => (normalized[p] = null, normalized),
1746
- {}
1747
- ) : props;
1748
- }
1749
-
1750
- let shouldCacheAccess = true;
1751
- function applyOptions(instance) {
1752
- const options = resolveMergedOptions(instance);
1753
- const publicThis = instance.proxy;
1754
- const ctx = instance.ctx;
1755
- shouldCacheAccess = false;
1756
- if (options.beforeCreate) {
1757
- callHook(options.beforeCreate, instance, "bc");
1758
- }
1759
- const {
1760
- // state
1761
- data: dataOptions,
1762
- computed: computedOptions,
1763
- methods,
1764
- watch: watchOptions,
1765
- provide: provideOptions,
1766
- inject: injectOptions,
1767
- // lifecycle
1768
- created,
1769
- beforeMount,
1770
- mounted,
1771
- beforeUpdate,
1772
- updated,
1773
- activated,
1774
- deactivated,
1775
- beforeDestroy,
1776
- beforeUnmount,
1777
- destroyed,
1778
- unmounted,
1779
- render,
1780
- renderTracked,
1781
- renderTriggered,
1782
- errorCaptured,
1783
- serverPrefetch,
1784
- // public API
1785
- expose,
1786
- inheritAttrs,
1787
- // assets
1788
- components,
1789
- directives,
1790
- filters
1791
- } = options;
1792
- const checkDuplicateProperties = null;
1793
- if (injectOptions) {
1794
- resolveInjections(injectOptions, ctx, checkDuplicateProperties);
1795
- }
1796
- if (methods) {
1797
- for (const key in methods) {
1798
- const methodHandler = methods[key];
1799
- if (shared.isFunction(methodHandler)) {
1800
- {
1801
- ctx[key] = methodHandler.bind(publicThis);
1802
- }
1803
- }
1804
- }
1805
- }
1806
- if (dataOptions) {
1807
- const data = dataOptions.call(publicThis, publicThis);
1808
- if (!shared.isObject(data)) ; else {
1809
- instance.data = reactive(data);
1810
- }
1811
- }
1812
- shouldCacheAccess = true;
1813
- if (computedOptions) {
1814
- for (const key in computedOptions) {
1815
- const opt = computedOptions[key];
1816
- const get = shared.isFunction(opt) ? opt.bind(publicThis, publicThis) : shared.isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : shared.NOOP;
1817
- const set = !shared.isFunction(opt) && shared.isFunction(opt.set) ? opt.set.bind(publicThis) : shared.NOOP;
1818
- const c = computed({
1819
- get,
1820
- set
1821
- });
1822
- Object.defineProperty(ctx, key, {
1823
- enumerable: true,
1824
- configurable: true,
1825
- get: () => c.value,
1826
- set: (v) => c.value = v
1827
- });
1828
- }
1829
- }
1830
- if (watchOptions) {
1831
- for (const key in watchOptions) {
1832
- createWatcher(watchOptions[key], ctx, publicThis, key);
1833
- }
1834
- }
1835
- if (provideOptions) {
1836
- const provides = shared.isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
1837
- Reflect.ownKeys(provides).forEach((key) => {
1838
- provide(key, provides[key]);
1839
- });
1840
- }
1841
- if (created) {
1842
- callHook(created, instance, "c");
1843
- }
1844
- function registerLifecycleHook(register, hook) {
1845
- if (shared.isArray(hook)) {
1846
- hook.forEach((_hook) => register(_hook.bind(publicThis)));
1847
- } else if (hook) {
1848
- register(hook.bind(publicThis));
1849
- }
1850
- }
1851
- registerLifecycleHook(onBeforeMount, beforeMount);
1852
- registerLifecycleHook(onMounted, mounted);
1853
- registerLifecycleHook(onBeforeUpdate, beforeUpdate);
1854
- registerLifecycleHook(onUpdated, updated);
1855
- registerLifecycleHook(onActivated, activated);
1856
- registerLifecycleHook(onDeactivated, deactivated);
1857
- registerLifecycleHook(onErrorCaptured, errorCaptured);
1858
- registerLifecycleHook(onRenderTracked, renderTracked);
1859
- registerLifecycleHook(onRenderTriggered, renderTriggered);
1860
- registerLifecycleHook(onBeforeUnmount, beforeUnmount);
1861
- registerLifecycleHook(onUnmounted, unmounted);
1862
- registerLifecycleHook(onServerPrefetch, serverPrefetch);
1863
- if (shared.isArray(expose)) {
1864
- if (expose.length) {
1865
- const exposed = instance.exposed || (instance.exposed = {});
1866
- expose.forEach((key) => {
1867
- Object.defineProperty(exposed, key, {
1868
- get: () => publicThis[key],
1869
- set: (val) => publicThis[key] = val
1870
- });
1871
- });
1872
- } else if (!instance.exposed) {
1873
- instance.exposed = {};
1874
- }
1875
- }
1876
- if (render && instance.render === shared.NOOP) {
1877
- instance.render = render;
1878
- }
1879
- if (inheritAttrs != null) {
1880
- instance.inheritAttrs = inheritAttrs;
1881
- }
1882
- if (components) instance.components = components;
1883
- if (directives) instance.directives = directives;
1884
- }
1885
- function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
1886
- if (shared.isArray(injectOptions)) {
1887
- injectOptions = normalizeInject(injectOptions);
1888
- }
1889
- for (const key in injectOptions) {
1890
- const opt = injectOptions[key];
1891
- let injected;
1892
- if (shared.isObject(opt)) {
1893
- if ("default" in opt) {
1894
- injected = inject(
1895
- opt.from || key,
1896
- opt.default,
1897
- true
1898
- );
1899
- } else {
1900
- injected = inject(opt.from || key);
1901
- }
1902
- } else {
1903
- injected = inject(opt);
1904
- }
1905
- if (isRef(injected)) {
1906
- Object.defineProperty(ctx, key, {
1907
- enumerable: true,
1908
- configurable: true,
1909
- get: () => injected.value,
1910
- set: (v) => injected.value = v
1911
- });
1912
- } else {
1913
- ctx[key] = injected;
1914
- }
1915
- }
1916
- }
1917
- function callHook(hook, instance, type) {
1918
- callWithAsyncErrorHandling(
1919
- shared.isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
1920
- instance,
1921
- type
1922
- );
1923
- }
1924
- function createWatcher(raw, ctx, publicThis, key) {
1925
- const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
1926
- if (shared.isString(raw)) {
1927
- const handler = ctx[raw];
1928
- if (shared.isFunction(handler)) {
1929
- watch(getter, handler);
1930
- }
1931
- } else if (shared.isFunction(raw)) {
1932
- watch(getter, raw.bind(publicThis));
1933
- } else if (shared.isObject(raw)) {
1934
- if (shared.isArray(raw)) {
1935
- raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
1936
- } else {
1937
- const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
1938
- if (shared.isFunction(handler)) {
1939
- watch(getter, handler, raw);
1940
- }
1941
- }
1942
- } else ;
1943
- }
1944
- function resolveMergedOptions(instance) {
1945
- const base = instance.type;
1946
- const { mixins, extends: extendsOptions } = base;
1947
- const {
1948
- mixins: globalMixins,
1949
- optionsCache: cache,
1950
- config: { optionMergeStrategies }
1951
- } = instance.appContext;
1952
- const cached = cache.get(base);
1953
- let resolved;
1954
- if (cached) {
1955
- resolved = cached;
1956
- } else if (!globalMixins.length && !mixins && !extendsOptions) {
1957
- {
1958
- resolved = base;
1959
- }
1960
- } else {
1961
- resolved = {};
1962
- if (globalMixins.length) {
1963
- globalMixins.forEach(
1964
- (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
1965
- );
1966
- }
1967
- mergeOptions(resolved, base, optionMergeStrategies);
1968
- }
1969
- if (shared.isObject(base)) {
1970
- cache.set(base, resolved);
1971
- }
1972
- return resolved;
1973
- }
1974
- function mergeOptions(to, from, strats, asMixin = false) {
1975
- const { mixins, extends: extendsOptions } = from;
1976
- if (extendsOptions) {
1977
- mergeOptions(to, extendsOptions, strats, true);
1978
- }
1979
- if (mixins) {
1980
- mixins.forEach(
1981
- (m) => mergeOptions(to, m, strats, true)
1982
- );
1983
- }
1984
- for (const key in from) {
1985
- if (asMixin && key === "expose") ; else {
1986
- const strat = internalOptionMergeStrats[key] || strats && strats[key];
1987
- to[key] = strat ? strat(to[key], from[key]) : from[key];
1988
- }
1989
- }
1990
- return to;
1991
- }
1992
- const internalOptionMergeStrats = {
1993
- data: mergeDataFn,
1994
- props: mergeEmitsOrPropsOptions,
1995
- emits: mergeEmitsOrPropsOptions,
1996
- // objects
1997
- methods: mergeObjectOptions,
1998
- computed: mergeObjectOptions,
1999
- // lifecycle
2000
- beforeCreate: mergeAsArray,
2001
- created: mergeAsArray,
2002
- beforeMount: mergeAsArray,
2003
- mounted: mergeAsArray,
2004
- beforeUpdate: mergeAsArray,
2005
- updated: mergeAsArray,
2006
- beforeDestroy: mergeAsArray,
2007
- beforeUnmount: mergeAsArray,
2008
- destroyed: mergeAsArray,
2009
- unmounted: mergeAsArray,
2010
- activated: mergeAsArray,
2011
- deactivated: mergeAsArray,
2012
- errorCaptured: mergeAsArray,
2013
- serverPrefetch: mergeAsArray,
2014
- // assets
2015
- components: mergeObjectOptions,
2016
- directives: mergeObjectOptions,
2017
- // watch
2018
- watch: mergeWatchOptions,
2019
- // provide / inject
2020
- provide: mergeDataFn,
2021
- inject: mergeInject
2022
- };
2023
- function mergeDataFn(to, from) {
2024
- if (!from) {
2025
- return to;
2026
- }
2027
- if (!to) {
2028
- return from;
2029
- }
2030
- return function mergedDataFn() {
2031
- return (shared.extend)(
2032
- shared.isFunction(to) ? to.call(this, this) : to,
2033
- shared.isFunction(from) ? from.call(this, this) : from
2034
- );
2035
- };
2036
- }
2037
- function mergeInject(to, from) {
2038
- return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
2039
- }
2040
- function normalizeInject(raw) {
2041
- if (shared.isArray(raw)) {
2042
- const res = {};
2043
- for (let i = 0; i < raw.length; i++) {
2044
- res[raw[i]] = raw[i];
2045
- }
2046
- return res;
2047
- }
2048
- return raw;
2049
- }
2050
- function mergeAsArray(to, from) {
2051
- return to ? [...new Set([].concat(to, from))] : from;
2052
- }
2053
- function mergeObjectOptions(to, from) {
2054
- return to ? shared.extend(/* @__PURE__ */ Object.create(null), to, from) : from;
2055
- }
2056
- function mergeEmitsOrPropsOptions(to, from) {
2057
- if (to) {
2058
- if (shared.isArray(to) && shared.isArray(from)) {
2059
- return [.../* @__PURE__ */ new Set([...to, ...from])];
2060
- }
2061
- return shared.extend(
2062
- /* @__PURE__ */ Object.create(null),
2063
- normalizePropsOrEmits(to),
2064
- normalizePropsOrEmits(from != null ? from : {})
2065
- );
2066
- } else {
2067
- return from;
2068
- }
2069
- }
2070
- function mergeWatchOptions(to, from) {
2071
- if (!to) return from;
2072
- if (!from) return to;
2073
- const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
2074
- for (const key in from) {
2075
- merged[key] = mergeAsArray(to[key], from[key]);
2076
- }
2077
- return merged;
2078
- }
2079
-
2080
- function createAppContext() {
2081
- return {
2082
- app: null,
2083
- config: {
2084
- isNativeTag: shared.NO,
2085
- performance: false,
2086
- globalProperties: {},
2087
- optionMergeStrategies: {},
2088
- errorHandler: void 0,
2089
- warnHandler: void 0,
2090
- compilerOptions: {}
2091
- },
2092
- mixins: [],
2093
- components: {},
2094
- directives: {},
2095
- provides: /* @__PURE__ */ Object.create(null),
2096
- optionsCache: /* @__PURE__ */ new WeakMap(),
2097
- propsCache: /* @__PURE__ */ new WeakMap(),
2098
- emitsCache: /* @__PURE__ */ new WeakMap()
2099
- };
2100
- }
2101
- let currentApp = null;
2102
-
2103
- function provide(key, value) {
2104
- if (!currentInstance) ; else {
2105
- let provides = currentInstance.provides;
2106
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
2107
- if (parentProvides === provides) {
2108
- provides = currentInstance.provides = Object.create(parentProvides);
2109
- }
2110
- provides[key] = value;
2111
- }
2112
- }
2113
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
2114
- const instance = currentInstance || currentRenderingInstance;
2115
- if (instance || currentApp) {
2116
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
2117
- if (provides && key in provides) {
2118
- return provides[key];
2119
- } else if (arguments.length > 1) {
2120
- return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
2121
- } else ;
2122
- }
2123
- }
2124
-
2125
- const internalObjectProto = {};
2126
- const createInternalObject = () => Object.create(internalObjectProto);
2127
- const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
2128
-
2129
- function initProps(instance, rawProps, isStateful, isSSR = false) {
2130
- const props = {};
2131
- const attrs = createInternalObject();
2132
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
2133
- setFullProps(instance, rawProps, props, attrs);
2134
- for (const key in instance.propsOptions[0]) {
2135
- if (!(key in props)) {
2136
- props[key] = void 0;
2137
- }
2138
- }
2139
- if (isStateful) {
2140
- instance.props = isSSR ? props : shallowReactive(props);
2141
- } else {
2142
- if (!instance.type.props) {
2143
- instance.props = attrs;
2144
- } else {
2145
- instance.props = props;
2146
- }
2147
- }
2148
- instance.attrs = attrs;
2149
- }
2150
- function setFullProps(instance, rawProps, props, attrs) {
2151
- const [options, needCastKeys] = instance.propsOptions;
2152
- let hasAttrsChanged = false;
2153
- let rawCastValues;
2154
- if (rawProps) {
2155
- for (let key in rawProps) {
2156
- if (shared.isReservedProp(key)) {
2157
- continue;
2158
- }
2159
- const value = rawProps[key];
2160
- let camelKey;
2161
- if (options && shared.hasOwn(options, camelKey = shared.camelize(key))) {
2162
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
2163
- props[camelKey] = value;
2164
- } else {
2165
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
2166
- }
2167
- } else if (!isEmitListener(instance.emitsOptions, key)) {
2168
- if (!(key in attrs) || value !== attrs[key]) {
2169
- attrs[key] = value;
2170
- hasAttrsChanged = true;
2171
- }
2172
- }
2173
- }
2174
- }
2175
- if (needCastKeys) {
2176
- const rawCurrentProps = toRaw(props);
2177
- const castValues = rawCastValues || shared.EMPTY_OBJ;
2178
- for (let i = 0; i < needCastKeys.length; i++) {
2179
- const key = needCastKeys[i];
2180
- props[key] = resolvePropValue(
2181
- options,
2182
- rawCurrentProps,
2183
- key,
2184
- castValues[key],
2185
- instance,
2186
- !shared.hasOwn(castValues, key)
2187
- );
2188
- }
2189
- }
2190
- return hasAttrsChanged;
2191
- }
2192
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
2193
- const opt = options[key];
2194
- if (opt != null) {
2195
- const hasDefault = shared.hasOwn(opt, "default");
2196
- if (hasDefault && value === void 0) {
2197
- const defaultValue = opt.default;
2198
- if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
2199
- const { propsDefaults } = instance;
2200
- if (key in propsDefaults) {
2201
- value = propsDefaults[key];
2202
- } else {
2203
- const reset = setCurrentInstance(instance);
2204
- value = propsDefaults[key] = defaultValue.call(
2205
- null,
2206
- props
2207
- );
2208
- reset();
2209
- }
2210
- } else {
2211
- value = defaultValue;
2212
- }
2213
- }
2214
- if (opt[0 /* shouldCast */]) {
2215
- if (isAbsent && !hasDefault) {
2216
- value = false;
2217
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === shared.hyphenate(key))) {
2218
- value = true;
2219
- }
2220
- }
2221
- }
2222
- return value;
2223
- }
2224
- function normalizePropsOptions(comp, appContext, asMixin = false) {
2225
- const cache = appContext.propsCache;
2226
- const cached = cache.get(comp);
2227
- if (cached) {
2228
- return cached;
2229
- }
2230
- const raw = comp.props;
2231
- const normalized = {};
2232
- const needCastKeys = [];
2233
- let hasExtends = false;
2234
- if (!shared.isFunction(comp)) {
2235
- const extendProps = (raw2) => {
2236
- hasExtends = true;
2237
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
2238
- shared.extend(normalized, props);
2239
- if (keys) needCastKeys.push(...keys);
2240
- };
2241
- if (!asMixin && appContext.mixins.length) {
2242
- appContext.mixins.forEach(extendProps);
2243
- }
2244
- if (comp.extends) {
2245
- extendProps(comp.extends);
2246
- }
2247
- if (comp.mixins) {
2248
- comp.mixins.forEach(extendProps);
2249
- }
2250
- }
2251
- if (!raw && !hasExtends) {
2252
- if (shared.isObject(comp)) {
2253
- cache.set(comp, shared.EMPTY_ARR);
2254
- }
2255
- return shared.EMPTY_ARR;
2256
- }
2257
- if (shared.isArray(raw)) {
2258
- for (let i = 0; i < raw.length; i++) {
2259
- const normalizedKey = shared.camelize(raw[i]);
2260
- if (validatePropName(normalizedKey)) {
2261
- normalized[normalizedKey] = shared.EMPTY_OBJ;
2262
- }
2263
- }
2264
- } else if (raw) {
2265
- for (const key in raw) {
2266
- const normalizedKey = shared.camelize(key);
2267
- if (validatePropName(normalizedKey)) {
2268
- const opt = raw[key];
2269
- const prop = normalized[normalizedKey] = shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : shared.extend({}, opt);
2270
- if (prop) {
2271
- const booleanIndex = getTypeIndex(Boolean, prop.type);
2272
- const stringIndex = getTypeIndex(String, prop.type);
2273
- prop[0 /* shouldCast */] = booleanIndex > -1;
2274
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
2275
- if (booleanIndex > -1 || shared.hasOwn(prop, "default")) {
2276
- needCastKeys.push(normalizedKey);
2277
- }
2278
- }
2279
- }
2280
- }
2281
- }
2282
- const res = [normalized, needCastKeys];
2283
- if (shared.isObject(comp)) {
2284
- cache.set(comp, res);
2285
- }
2286
- return res;
2287
- }
2288
- function validatePropName(key) {
2289
- if (key[0] !== "$" && !shared.isReservedProp(key)) {
2290
- return true;
2291
- }
2292
- return false;
2293
- }
2294
- function getType(ctor) {
2295
- if (ctor === null) {
2296
- return "null";
2297
- }
2298
- if (typeof ctor === "function") {
2299
- return ctor.name || "";
2300
- } else if (typeof ctor === "object") {
2301
- const name = ctor.constructor && ctor.constructor.name;
2302
- return name || "";
2303
- }
2304
- return "";
2305
- }
2306
- function isSameType(a, b) {
2307
- return getType(a) === getType(b);
2308
- }
2309
- function getTypeIndex(type, expectedTypes) {
2310
- if (shared.isArray(expectedTypes)) {
2311
- return expectedTypes.findIndex((t) => isSameType(t, type));
2312
- } else if (shared.isFunction(expectedTypes)) {
2313
- return isSameType(expectedTypes, type) ? 0 : -1;
2314
- }
2315
- return -1;
2316
- }
2317
-
2318
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
2319
- const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode$1) : [normalizeVNode$1(value)];
2320
- const normalizeSlot = (key, rawSlot, ctx) => {
2321
- if (rawSlot._n) {
2322
- return rawSlot;
2323
- }
2324
- const normalized = withCtx((...args) => {
2325
- if (false) ;
2326
- return normalizeSlotValue(rawSlot(...args));
2327
- }, ctx);
2328
- normalized._c = false;
2329
- return normalized;
2330
- };
2331
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
2332
- const ctx = rawSlots._ctx;
2333
- for (const key in rawSlots) {
2334
- if (isInternalKey(key)) continue;
2335
- const value = rawSlots[key];
2336
- if (shared.isFunction(value)) {
2337
- slots[key] = normalizeSlot(key, value, ctx);
2338
- } else if (value != null) {
2339
- const normalized = normalizeSlotValue(value);
2340
- slots[key] = () => normalized;
2341
- }
2342
- }
2343
- };
2344
- const normalizeVNodeSlots = (instance, children) => {
2345
- const normalized = normalizeSlotValue(children);
2346
- instance.slots.default = () => normalized;
2347
- };
2348
- const initSlots = (instance, children) => {
2349
- const slots = instance.slots = createInternalObject();
2350
- if (instance.vnode.shapeFlag & 32) {
2351
- const type = children._;
2352
- if (type) {
2353
- shared.extend(slots, children);
2354
- shared.def(slots, "_", type, true);
2355
- } else {
2356
- normalizeObjectSlots(children, slots);
2357
- }
2358
- } else if (children) {
2359
- normalizeVNodeSlots(instance, children);
2360
- }
2361
- };
2362
-
2363
- const queuePostRenderEffect = queueEffectWithSuspense ;
2364
-
2365
- const ssrContextKey = Symbol.for("v-scx");
2366
- const useSSRContext = () => {
2367
- {
2368
- const ctx = inject(ssrContextKey);
2369
- return ctx;
2370
- }
2371
- };
2372
-
2373
- const INITIAL_WATCHER_VALUE = {};
2374
- function watch(source, cb, options) {
2375
- return doWatch(source, cb, options);
2376
- }
2377
- function doWatch(source, cb, {
2378
- immediate,
2379
- deep,
2380
- flush,
2381
- once,
2382
- onTrack,
2383
- onTrigger
2384
- } = shared.EMPTY_OBJ) {
2385
- if (cb && once) {
2386
- const _cb = cb;
2387
- cb = (...args) => {
2388
- _cb(...args);
2389
- unwatch();
2390
- };
2391
- }
2392
- const instance = currentInstance;
2393
- const reactiveGetter = (source2) => deep === true ? source2 : (
2394
- // for deep: false, only traverse root-level properties
2395
- traverse(source2, deep === false ? 1 : void 0)
2396
- );
2397
- let getter;
2398
- let forceTrigger = false;
2399
- let isMultiSource = false;
2400
- if (isRef(source)) {
2401
- getter = () => source.value;
2402
- forceTrigger = isShallow(source);
2403
- } else if (isReactive(source)) {
2404
- getter = () => reactiveGetter(source);
2405
- forceTrigger = true;
2406
- } else if (shared.isArray(source)) {
2407
- isMultiSource = true;
2408
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
2409
- getter = () => source.map((s) => {
2410
- if (isRef(s)) {
2411
- return s.value;
2412
- } else if (isReactive(s)) {
2413
- return reactiveGetter(s);
2414
- } else if (shared.isFunction(s)) {
2415
- return callWithErrorHandling(s, instance, 2);
2416
- } else ;
2417
- });
2418
- } else if (shared.isFunction(source)) {
2419
- if (cb) {
2420
- getter = () => callWithErrorHandling(source, instance, 2);
2421
- } else {
2422
- getter = () => {
2423
- if (cleanup) {
2424
- cleanup();
2425
- }
2426
- return callWithAsyncErrorHandling(
2427
- source,
2428
- instance,
2429
- 3,
2430
- [onCleanup]
2431
- );
2432
- };
2433
- }
2434
- } else {
2435
- getter = shared.NOOP;
2436
- }
2437
- if (cb && deep) {
2438
- const baseGetter = getter;
2439
- getter = () => traverse(baseGetter());
2440
- }
2441
- let cleanup;
2442
- let onCleanup = (fn) => {
2443
- cleanup = effect.onStop = () => {
2444
- callWithErrorHandling(fn, instance, 4);
2445
- cleanup = effect.onStop = void 0;
2446
- };
2447
- };
2448
- let ssrCleanup;
2449
- if (isInSSRComponentSetup) {
2450
- onCleanup = shared.NOOP;
2451
- if (!cb) {
2452
- getter();
2453
- } else if (immediate) {
2454
- callWithAsyncErrorHandling(cb, instance, 3, [
2455
- getter(),
2456
- isMultiSource ? [] : void 0,
2457
- onCleanup
2458
- ]);
2459
- }
2460
- if (flush === "sync") {
2461
- const ctx = useSSRContext();
2462
- ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
2463
- } else {
2464
- return shared.NOOP;
2465
- }
2466
- }
2467
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2468
- const job = () => {
2469
- if (!effect.active || !effect.dirty) {
2470
- return;
2471
- }
2472
- if (cb) {
2473
- const newValue = effect.run();
2474
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue)) || false) {
2475
- if (cleanup) {
2476
- cleanup();
2477
- }
2478
- callWithAsyncErrorHandling(cb, instance, 3, [
2479
- newValue,
2480
- // pass undefined as the old value when it's changed for the first time
2481
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2482
- onCleanup
2483
- ]);
2484
- oldValue = newValue;
2485
- }
2486
- } else {
2487
- effect.run();
2488
- }
2489
- };
2490
- job.allowRecurse = !!cb;
2491
- let scheduler;
2492
- if (flush === "sync") {
2493
- scheduler = job;
2494
- } else if (flush === "post") {
2495
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
2496
- } else {
2497
- job.pre = true;
2498
- if (instance) job.id = instance.uid;
2499
- scheduler = () => queueJob(job);
2500
- }
2501
- const effect = new ReactiveEffect(getter, shared.NOOP, scheduler);
2502
- const scope = getCurrentScope();
2503
- const unwatch = () => {
2504
- effect.stop();
2505
- if (scope) {
2506
- shared.remove(scope.effects, effect);
2507
- }
2508
- };
2509
- if (cb) {
2510
- if (immediate) {
2511
- job();
2512
- } else {
2513
- oldValue = effect.run();
2514
- }
2515
- } else if (flush === "post") {
2516
- queuePostRenderEffect(
2517
- effect.run.bind(effect),
2518
- instance && instance.suspense
2519
- );
2520
- } else {
2521
- effect.run();
2522
- }
2523
- if (ssrCleanup) ssrCleanup.push(unwatch);
2524
- return unwatch;
2525
- }
2526
- function instanceWatch(source, value, options) {
2527
- const publicThis = this.proxy;
2528
- const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
2529
- let cb;
2530
- if (shared.isFunction(value)) {
2531
- cb = value;
2532
- } else {
2533
- cb = value.handler;
2534
- options = value;
2535
- }
2536
- const reset = setCurrentInstance(this);
2537
- const res = doWatch(getter, cb.bind(publicThis), options);
2538
- reset();
2539
- return res;
2540
- }
2541
- function createPathGetter(ctx, path) {
2542
- const segments = path.split(".");
2543
- return () => {
2544
- let cur = ctx;
2545
- for (let i = 0; i < segments.length && cur; i++) {
2546
- cur = cur[segments[i]];
2547
- }
2548
- return cur;
2549
- };
2550
- }
2551
- function traverse(value, depth = Infinity, seen) {
2552
- if (depth <= 0 || !shared.isObject(value) || value["__v_skip"]) {
2553
- return value;
2554
- }
2555
- seen = seen || /* @__PURE__ */ new Set();
2556
- if (seen.has(value)) {
2557
- return value;
2558
- }
2559
- seen.add(value);
2560
- depth--;
2561
- if (isRef(value)) {
2562
- traverse(value.value, depth, seen);
2563
- } else if (shared.isArray(value)) {
2564
- for (let i = 0; i < value.length; i++) {
2565
- traverse(value[i], depth, seen);
2566
- }
2567
- } else if (shared.isSet(value) || shared.isMap(value)) {
2568
- value.forEach((v) => {
2569
- traverse(v, depth, seen);
2570
- });
2571
- } else if (shared.isPlainObject(value)) {
2572
- for (const key in value) {
2573
- traverse(value[key], depth, seen);
2574
- }
2575
- for (const key of Object.getOwnPropertySymbols(value)) {
2576
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
2577
- traverse(value[key], depth, seen);
2578
- }
2579
- }
2580
- }
2581
- return value;
2582
- }
2583
-
2584
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
2585
- function onActivated(hook, target) {
2586
- registerKeepAliveHook(hook, "a", target);
2587
- }
2588
- function onDeactivated(hook, target) {
2589
- registerKeepAliveHook(hook, "da", target);
2590
- }
2591
- function registerKeepAliveHook(hook, type, target = currentInstance) {
2592
- const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2593
- let current = target;
2594
- while (current) {
2595
- if (current.isDeactivated) {
2596
- return;
2597
- }
2598
- current = current.parent;
2599
- }
2600
- return hook();
2601
- });
2602
- injectHook(type, wrappedHook, target);
2603
- if (target) {
2604
- let current = target.parent;
2605
- while (current && current.parent) {
2606
- if (isKeepAlive(current.parent.vnode)) {
2607
- injectToKeepAliveRoot(wrappedHook, type, target, current);
2608
- }
2609
- current = current.parent;
2610
- }
2611
- }
2612
- }
2613
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2614
- const injected = injectHook(
2615
- type,
2616
- hook,
2617
- keepAliveRoot,
2618
- true
2619
- /* prepend */
2620
- );
2621
- onUnmounted(() => {
2622
- shared.remove(keepAliveRoot[type], injected);
2623
- }, target);
2624
- }
2625
-
2626
- function setTransitionHooks(vnode, hooks) {
2627
- if (vnode.shapeFlag & 6 && vnode.component) {
2628
- setTransitionHooks(vnode.component.subTree, hooks);
2629
- } else if (vnode.shapeFlag & 128) {
2630
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
2631
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
2632
- } else {
2633
- vnode.transition = hooks;
2634
- }
2635
- }
2636
-
2637
- const isTeleport = (type) => type.__isTeleport;
2638
-
2639
- const Fragment = Symbol.for("v-fgt");
2640
- const Text = Symbol.for("v-txt");
2641
- const Comment = Symbol.for("v-cmt");
2642
- let currentBlock = null;
2643
- let isBlockTreeEnabled = 1;
2644
- function setBlockTracking(value) {
2645
- isBlockTreeEnabled += value;
2646
- }
2647
- function isVNode$2(value) {
2648
- return value ? value.__v_isVNode === true : false;
2649
- }
2650
- const normalizeKey = ({ key }) => key != null ? key : null;
2651
- const normalizeRef = ({
2652
- ref,
2653
- ref_key,
2654
- ref_for
2655
- }) => {
2656
- if (typeof ref === "number") {
2657
- ref = "" + ref;
2658
- }
2659
- return ref != null ? shared.isString(ref) || isRef(ref) || shared.isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
2660
- };
2661
- function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
2662
- const vnode = {
2663
- __v_isVNode: true,
2664
- __v_skip: true,
2665
- type,
2666
- props,
2667
- key: props && normalizeKey(props),
2668
- ref: props && normalizeRef(props),
2669
- scopeId: currentScopeId,
2670
- slotScopeIds: null,
2671
- children,
2672
- component: null,
2673
- suspense: null,
2674
- ssContent: null,
2675
- ssFallback: null,
2676
- dirs: null,
2677
- transition: null,
2678
- el: null,
2679
- anchor: null,
2680
- target: null,
2681
- targetAnchor: null,
2682
- staticCount: 0,
2683
- shapeFlag,
2684
- patchFlag,
2685
- dynamicProps,
2686
- dynamicChildren: null,
2687
- appContext: null,
2688
- ctx: currentRenderingInstance
2689
- };
2690
- if (needFullChildrenNormalization) {
2691
- normalizeChildren(vnode, children);
2692
- if (shapeFlag & 128) {
2693
- type.normalize(vnode);
2694
- }
2695
- } else if (children) {
2696
- vnode.shapeFlag |= shared.isString(children) ? 8 : 16;
2697
- }
2698
- if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
2699
- !isBlockNode && // has current parent block
2700
- currentBlock && // presence of a patch flag indicates this node needs patching on updates.
2701
- // component nodes also should always be patched, because even if the
2702
- // component doesn't need to update, it needs to persist the instance on to
2703
- // the next vnode so that it can be properly unmounted later.
2704
- (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
2705
- // vnode should not be considered dynamic due to handler caching.
2706
- vnode.patchFlag !== 32) {
2707
- currentBlock.push(vnode);
2708
- }
2709
- return vnode;
2710
- }
2711
- const createVNode = _createVNode;
2712
- function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
2713
- if (!type || type === NULL_DYNAMIC_COMPONENT) {
2714
- type = Comment;
2715
- }
2716
- if (isVNode$2(type)) {
2717
- const cloned = cloneVNode(
2718
- type,
2719
- props,
2720
- true
2721
- /* mergeRef: true */
2722
- );
2723
- if (children) {
2724
- normalizeChildren(cloned, children);
2725
- }
2726
- if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
2727
- if (cloned.shapeFlag & 6) {
2728
- currentBlock[currentBlock.indexOf(type)] = cloned;
2729
- } else {
2730
- currentBlock.push(cloned);
2731
- }
2732
- }
2733
- cloned.patchFlag = -2;
2734
- return cloned;
2735
- }
2736
- if (isClassComponent(type)) {
2737
- type = type.__vccOpts;
2738
- }
2739
- if (props) {
2740
- props = guardReactiveProps(props);
2741
- let { class: klass, style } = props;
2742
- if (klass && !shared.isString(klass)) {
2743
- props.class = shared.normalizeClass(klass);
2744
- }
2745
- if (shared.isObject(style)) {
2746
- if (isProxy(style) && !shared.isArray(style)) {
2747
- style = shared.extend({}, style);
2748
- }
2749
- props.style = shared.normalizeStyle(style);
2750
- }
2751
- }
2752
- const shapeFlag = shared.isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : shared.isObject(type) ? 4 : shared.isFunction(type) ? 2 : 0;
2753
- return createBaseVNode(
2754
- type,
2755
- props,
2756
- children,
2757
- patchFlag,
2758
- dynamicProps,
2759
- shapeFlag,
2760
- isBlockNode,
2761
- true
2762
- );
2763
- }
2764
- function guardReactiveProps(props) {
2765
- if (!props) return null;
2766
- return isProxy(props) || isInternalObject(props) ? shared.extend({}, props) : props;
2767
- }
2768
- function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
2769
- const { props, ref, patchFlag, children, transition } = vnode;
2770
- const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
2771
- const cloned = {
2772
- __v_isVNode: true,
2773
- __v_skip: true,
2774
- type: vnode.type,
2775
- props: mergedProps,
2776
- key: mergedProps && normalizeKey(mergedProps),
2777
- ref: extraProps && extraProps.ref ? (
2778
- // #2078 in the case of <component :is="vnode" ref="extra"/>
2779
- // if the vnode itself already has a ref, cloneVNode will need to merge
2780
- // the refs so the single vnode can be set on multiple refs
2781
- mergeRef && ref ? shared.isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
2782
- ) : ref,
2783
- scopeId: vnode.scopeId,
2784
- slotScopeIds: vnode.slotScopeIds,
2785
- children: children,
2786
- target: vnode.target,
2787
- targetAnchor: vnode.targetAnchor,
2788
- staticCount: vnode.staticCount,
2789
- shapeFlag: vnode.shapeFlag,
2790
- // if the vnode is cloned with extra props, we can no longer assume its
2791
- // existing patch flag to be reliable and need to add the FULL_PROPS flag.
2792
- // note: preserve flag for fragments since they use the flag for children
2793
- // fast paths only.
2794
- patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
2795
- dynamicProps: vnode.dynamicProps,
2796
- dynamicChildren: vnode.dynamicChildren,
2797
- appContext: vnode.appContext,
2798
- dirs: vnode.dirs,
2799
- transition,
2800
- // These should technically only be non-null on mounted VNodes. However,
2801
- // they *should* be copied for kept-alive vnodes. So we just always copy
2802
- // them since them being non-null during a mount doesn't affect the logic as
2803
- // they will simply be overwritten.
2804
- component: vnode.component,
2805
- suspense: vnode.suspense,
2806
- ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
2807
- ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
2808
- el: vnode.el,
2809
- anchor: vnode.anchor,
2810
- ctx: vnode.ctx,
2811
- ce: vnode.ce
2812
- };
2813
- if (transition && cloneTransition) {
2814
- setTransitionHooks(
2815
- cloned,
2816
- transition.clone(cloned)
2817
- );
2818
- }
2819
- return cloned;
2820
- }
2821
- function createTextVNode(text = " ", flag = 0) {
2822
- return createVNode(Text, null, text, flag);
2823
- }
2824
- function normalizeVNode$1(child) {
2825
- if (child == null || typeof child === "boolean") {
2826
- return createVNode(Comment);
2827
- } else if (shared.isArray(child)) {
2828
- return createVNode(
2829
- Fragment,
2830
- null,
2831
- // #3666, avoid reference pollution when reusing vnode
2832
- child.slice()
2833
- );
2834
- } else if (typeof child === "object") {
2835
- return cloneIfMounted(child);
2836
- } else {
2837
- return createVNode(Text, null, String(child));
2838
- }
2839
- }
2840
- function cloneIfMounted(child) {
2841
- return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
2842
- }
2843
- function normalizeChildren(vnode, children) {
2844
- let type = 0;
2845
- const { shapeFlag } = vnode;
2846
- if (children == null) {
2847
- children = null;
2848
- } else if (shared.isArray(children)) {
2849
- type = 16;
2850
- } else if (typeof children === "object") {
2851
- if (shapeFlag & (1 | 64)) {
2852
- const slot = children.default;
2853
- if (slot) {
2854
- slot._c && (slot._d = false);
2855
- normalizeChildren(vnode, slot());
2856
- slot._c && (slot._d = true);
2857
- }
2858
- return;
2859
- } else {
2860
- type = 32;
2861
- const slotFlag = children._;
2862
- if (!slotFlag && !isInternalObject(children)) {
2863
- children._ctx = currentRenderingInstance;
2864
- } else if (slotFlag === 3 && currentRenderingInstance) {
2865
- if (currentRenderingInstance.slots._ === 1) {
2866
- children._ = 1;
2867
- } else {
2868
- children._ = 2;
2869
- vnode.patchFlag |= 1024;
2870
- }
2871
- }
2872
- }
2873
- } else if (shared.isFunction(children)) {
2874
- children = { default: children, _ctx: currentRenderingInstance };
2875
- type = 32;
2876
- } else {
2877
- children = String(children);
2878
- if (shapeFlag & 64) {
2879
- type = 16;
2880
- children = [createTextVNode(children)];
2881
- } else {
2882
- type = 8;
2883
- }
2884
- }
2885
- vnode.children = children;
2886
- vnode.shapeFlag |= type;
2887
- }
2888
- function mergeProps(...args) {
2889
- const ret = {};
2890
- for (let i = 0; i < args.length; i++) {
2891
- const toMerge = args[i];
2892
- for (const key in toMerge) {
2893
- if (key === "class") {
2894
- if (ret.class !== toMerge.class) {
2895
- ret.class = shared.normalizeClass([ret.class, toMerge.class]);
2896
- }
2897
- } else if (key === "style") {
2898
- ret.style = shared.normalizeStyle([ret.style, toMerge.style]);
2899
- } else if (shared.isOn(key)) {
2900
- const existing = ret[key];
2901
- const incoming = toMerge[key];
2902
- if (incoming && existing !== incoming && !(shared.isArray(existing) && existing.includes(incoming))) {
2903
- ret[key] = existing ? [].concat(existing, incoming) : incoming;
2904
- }
2905
- } else if (key !== "") {
2906
- ret[key] = toMerge[key];
2907
- }
2908
- }
2909
- }
2910
- return ret;
2911
- }
2912
-
2913
- const emptyAppContext = createAppContext();
2914
- let uid = 0;
2915
- function createComponentInstance$1(vnode, parent, suspense) {
2916
- const type = vnode.type;
2917
- const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
2918
- const instance = {
2919
- uid: uid++,
2920
- vnode,
2921
- type,
2922
- parent,
2923
- appContext,
2924
- root: null,
2925
- // to be immediately set
2926
- next: null,
2927
- subTree: null,
2928
- // will be set synchronously right after creation
2929
- effect: null,
2930
- update: null,
2931
- // will be set synchronously right after creation
2932
- scope: new EffectScope(
2933
- true
2934
- /* detached */
2935
- ),
2936
- render: null,
2937
- proxy: null,
2938
- exposed: null,
2939
- exposeProxy: null,
2940
- withProxy: null,
2941
- provides: parent ? parent.provides : Object.create(appContext.provides),
2942
- accessCache: null,
2943
- renderCache: [],
2944
- // local resolved assets
2945
- components: null,
2946
- directives: null,
2947
- // resolved props and emits options
2948
- propsOptions: normalizePropsOptions(type, appContext),
2949
- emitsOptions: normalizeEmitsOptions(type, appContext),
2950
- // emit
2951
- emit: null,
2952
- // to be set immediately
2953
- emitted: null,
2954
- // props default value
2955
- propsDefaults: shared.EMPTY_OBJ,
2956
- // inheritAttrs
2957
- inheritAttrs: type.inheritAttrs,
2958
- // state
2959
- ctx: shared.EMPTY_OBJ,
2960
- data: shared.EMPTY_OBJ,
2961
- props: shared.EMPTY_OBJ,
2962
- attrs: shared.EMPTY_OBJ,
2963
- slots: shared.EMPTY_OBJ,
2964
- refs: shared.EMPTY_OBJ,
2965
- setupState: shared.EMPTY_OBJ,
2966
- setupContext: null,
2967
- attrsProxy: null,
2968
- slotsProxy: null,
2969
- // suspense related
2970
- suspense,
2971
- suspenseId: suspense ? suspense.pendingId : 0,
2972
- asyncDep: null,
2973
- asyncResolved: false,
2974
- // lifecycle hooks
2975
- // not using enums here because it results in computed properties
2976
- isMounted: false,
2977
- isUnmounted: false,
2978
- isDeactivated: false,
2979
- bc: null,
2980
- c: null,
2981
- bm: null,
2982
- m: null,
2983
- bu: null,
2984
- u: null,
2985
- um: null,
2986
- bum: null,
2987
- da: null,
2988
- a: null,
2989
- rtg: null,
2990
- rtc: null,
2991
- ec: null,
2992
- sp: null
2993
- };
2994
- {
2995
- instance.ctx = { _: instance };
2996
- }
2997
- instance.root = parent ? parent.root : instance;
2998
- instance.emit = emit.bind(null, instance);
2999
- if (vnode.ce) {
3000
- vnode.ce(instance);
3001
- }
3002
- return instance;
3003
- }
3004
- let currentInstance = null;
3005
- let internalSetCurrentInstance;
3006
- let setInSSRSetupState;
3007
- {
3008
- const g = shared.getGlobalThis();
3009
- const registerGlobalSetter = (key, setter) => {
3010
- let setters;
3011
- if (!(setters = g[key])) setters = g[key] = [];
3012
- setters.push(setter);
3013
- return (v) => {
3014
- if (setters.length > 1) setters.forEach((set) => set(v));
3015
- else setters[0](v);
3016
- };
3017
- };
3018
- internalSetCurrentInstance = registerGlobalSetter(
3019
- `__VUE_INSTANCE_SETTERS__`,
3020
- (v) => currentInstance = v
3021
- );
3022
- setInSSRSetupState = registerGlobalSetter(
3023
- `__VUE_SSR_SETTERS__`,
3024
- (v) => isInSSRComponentSetup = v
3025
- );
3026
- }
3027
- const setCurrentInstance = (instance) => {
3028
- const prev = currentInstance;
3029
- internalSetCurrentInstance(instance);
3030
- instance.scope.on();
3031
- return () => {
3032
- instance.scope.off();
3033
- internalSetCurrentInstance(prev);
3034
- };
3035
- };
3036
- const unsetCurrentInstance = () => {
3037
- currentInstance && currentInstance.scope.off();
3038
- internalSetCurrentInstance(null);
3039
- };
3040
- function isStatefulComponent(instance) {
3041
- return instance.vnode.shapeFlag & 4;
3042
- }
3043
- let isInSSRComponentSetup = false;
3044
- function setupComponent$1(instance, isSSR = false) {
3045
- isSSR && setInSSRSetupState(isSSR);
3046
- const { props, children } = instance.vnode;
3047
- const isStateful = isStatefulComponent(instance);
3048
- initProps(instance, props, isStateful, isSSR);
3049
- initSlots(instance, children);
3050
- const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
3051
- isSSR && setInSSRSetupState(false);
3052
- return setupResult;
3053
- }
3054
- function setupStatefulComponent(instance, isSSR) {
3055
- const Component = instance.type;
3056
- instance.accessCache = /* @__PURE__ */ Object.create(null);
3057
- instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
3058
- const { setup } = Component;
3059
- if (setup) {
3060
- const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
3061
- const reset = setCurrentInstance(instance);
3062
- pauseTracking();
3063
- const setupResult = callWithErrorHandling(
3064
- setup,
3065
- instance,
3066
- 0,
3067
- [
3068
- instance.props,
3069
- setupContext
3070
- ]
3071
- );
3072
- resetTracking();
3073
- reset();
3074
- if (shared.isPromise(setupResult)) {
3075
- setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
3076
- if (isSSR) {
3077
- return setupResult.then((resolvedResult) => {
3078
- handleSetupResult(instance, resolvedResult, isSSR);
3079
- }).catch((e) => {
3080
- handleError(e, instance, 0);
3081
- });
3082
- } else {
3083
- instance.asyncDep = setupResult;
3084
- }
3085
- } else {
3086
- handleSetupResult(instance, setupResult, isSSR);
3087
- }
3088
- } else {
3089
- finishComponentSetup(instance, isSSR);
3090
- }
3091
- }
3092
- function handleSetupResult(instance, setupResult, isSSR) {
3093
- if (shared.isFunction(setupResult)) {
3094
- if (instance.type.__ssrInlineRender) {
3095
- instance.ssrRender = setupResult;
3096
- } else {
3097
- instance.render = setupResult;
3098
- }
3099
- } else if (shared.isObject(setupResult)) {
3100
- instance.setupState = proxyRefs(setupResult);
3101
- } else ;
3102
- finishComponentSetup(instance, isSSR);
3103
- }
3104
- let compile;
3105
- function finishComponentSetup(instance, isSSR, skipOptions) {
3106
- const Component = instance.type;
3107
- if (!instance.render) {
3108
- if (!isSSR && compile && !Component.render) {
3109
- const template = Component.template || resolveMergedOptions(instance).template;
3110
- if (template) {
3111
- const { isCustomElement, compilerOptions } = instance.appContext.config;
3112
- const { delimiters, compilerOptions: componentCompilerOptions } = Component;
3113
- const finalCompilerOptions = shared.extend(
3114
- shared.extend(
3115
- {
3116
- isCustomElement,
3117
- delimiters
3118
- },
3119
- compilerOptions
3120
- ),
3121
- componentCompilerOptions
3122
- );
3123
- Component.render = compile(template, finalCompilerOptions);
3124
- }
3125
- }
3126
- instance.render = Component.render || shared.NOOP;
3127
- }
3128
- {
3129
- const reset = setCurrentInstance(instance);
3130
- pauseTracking();
3131
- try {
3132
- applyOptions(instance);
3133
- } finally {
3134
- resetTracking();
3135
- reset();
3136
- }
3137
- }
3138
- }
3139
- const attrsProxyHandlers = {
3140
- get(target, key) {
3141
- track(target, "get", "");
3142
- return target[key];
3143
- }
3144
- };
3145
- function createSetupContext(instance) {
3146
- const expose = (exposed) => {
3147
- instance.exposed = exposed || {};
3148
- };
3149
- {
3150
- return {
3151
- attrs: new Proxy(instance.attrs, attrsProxyHandlers),
3152
- slots: instance.slots,
3153
- emit: instance.emit,
3154
- expose
3155
- };
3156
- }
3157
- }
3158
- function getComponentPublicInstance(instance) {
3159
- if (instance.exposed) {
3160
- return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
3161
- get(target, key) {
3162
- if (key in target) {
3163
- return target[key];
3164
- } else if (key in publicPropertiesMap) {
3165
- return publicPropertiesMap[key](instance);
3166
- }
3167
- },
3168
- has(target, key) {
3169
- return key in target || key in publicPropertiesMap;
3170
- }
3171
- }));
3172
- } else {
3173
- return instance.proxy;
3174
- }
3175
- }
3176
- function isClassComponent(value) {
3177
- return shared.isFunction(value) && "__vccOpts" in value;
3178
- }
3179
-
3180
- const computed = (getterOrOptions, debugOptions) => {
3181
- const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
3182
- return c;
3183
- };
3184
-
3185
- const _ssrUtils = {
3186
- createComponentInstance: createComponentInstance$1,
3187
- setupComponent: setupComponent$1,
3188
- renderComponentRoot: renderComponentRoot$1,
3189
- setCurrentRenderingInstance: setCurrentRenderingInstance$1,
3190
- isVNode: isVNode$2,
3191
- normalizeVNode: normalizeVNode$1,
3192
- getComponentPublicInstance
3193
- };
3194
- const ssrUtils = _ssrUtils ;
3195
-
3196
183
  function ssrRenderList(source, renderItem) {
3197
184
  if (shared.isArray(source) || shared.isString(source)) {
3198
185
  for (let i = 0, l = source.length; i < l; i++) {
@@ -3231,7 +218,7 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
3231
218
  return dir.getSSRProps(
3232
219
  {
3233
220
  dir,
3234
- instance: ssrUtils.getComponentPublicInstance(instance.$),
221
+ instance: Vue.ssrUtils.getComponentPublicInstance(instance.$),
3235
222
  value,
3236
223
  oldValue: void 0,
3237
224
  arg,