@vue/compat 3.3.0-alpha.8 → 3.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -97,7 +97,7 @@ const getGlobalThis = () => {
97
97
  return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
98
98
  };
99
99
 
100
- const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt";
100
+ const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
101
101
  const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
102
102
 
103
103
  function normalizeStyle(value) {
@@ -1870,6 +1870,8 @@ function reload(id, newComp) {
1870
1870
  }
1871
1871
  hmrDirtyComponents.add(oldComp);
1872
1872
  }
1873
+ instance.appContext.propsCache.delete(instance.type);
1874
+ instance.appContext.emitsCache.delete(instance.type);
1873
1875
  instance.appContext.optionsCache.delete(instance.type);
1874
1876
  if (instance.ceReload) {
1875
1877
  hmrDirtyComponents.add(oldComp);
@@ -3188,7 +3190,8 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
3188
3190
  }
3189
3191
  }
3190
3192
  let hasWarned = false;
3191
- function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3193
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3194
+ var _a;
3192
3195
  if (process.env.NODE_ENV !== "production" && true && !hasWarned) {
3193
3196
  hasWarned = true;
3194
3197
  console[console.info ? "info" : "log"](
@@ -3202,13 +3205,21 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3202
3205
  n: next,
3203
3206
  o: { parentNode, remove }
3204
3207
  } = rendererInternals;
3208
+ let parentSuspenseId;
3209
+ const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3210
+ if (isSuspensible) {
3211
+ if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3212
+ parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
3213
+ parentSuspense.deps++;
3214
+ }
3215
+ }
3205
3216
  const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
3206
3217
  if (process.env.NODE_ENV !== "production") {
3207
3218
  assertNumber(timeout, `Suspense timeout`);
3208
3219
  }
3209
3220
  const suspense = {
3210
3221
  vnode,
3211
- parent,
3222
+ parent: parentSuspense,
3212
3223
  parentComponent,
3213
3224
  isSVG,
3214
3225
  container,
@@ -3268,20 +3279,28 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3268
3279
  setActiveBranch(suspense, pendingBranch);
3269
3280
  suspense.pendingBranch = null;
3270
3281
  suspense.isInFallback = false;
3271
- let parent2 = suspense.parent;
3282
+ let parent = suspense.parent;
3272
3283
  let hasUnresolvedAncestor = false;
3273
- while (parent2) {
3274
- if (parent2.pendingBranch) {
3275
- parent2.effects.push(...effects);
3284
+ while (parent) {
3285
+ if (parent.pendingBranch) {
3286
+ parent.effects.push(...effects);
3276
3287
  hasUnresolvedAncestor = true;
3277
3288
  break;
3278
3289
  }
3279
- parent2 = parent2.parent;
3290
+ parent = parent.parent;
3280
3291
  }
3281
3292
  if (!hasUnresolvedAncestor) {
3282
3293
  queuePostFlushCb(effects);
3283
3294
  }
3284
3295
  suspense.effects = [];
3296
+ if (isSuspensible) {
3297
+ if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
3298
+ parentSuspense.deps--;
3299
+ if (parentSuspense.deps === 0) {
3300
+ parentSuspense.resolve();
3301
+ }
3302
+ }
3303
+ }
3285
3304
  triggerEvent(vnode2, "onResolve");
3286
3305
  },
3287
3306
  fallback(fallbackVNode) {
@@ -3381,13 +3400,13 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3381
3400
  }
3382
3401
  });
3383
3402
  },
3384
- unmount(parentSuspense, doRemove) {
3403
+ unmount(parentSuspense2, doRemove) {
3385
3404
  suspense.isUnmounted = true;
3386
3405
  if (suspense.activeBranch) {
3387
3406
  unmount(
3388
3407
  suspense.activeBranch,
3389
3408
  parentComponent,
3390
- parentSuspense,
3409
+ parentSuspense2,
3391
3410
  doRemove
3392
3411
  );
3393
3412
  }
@@ -3395,7 +3414,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3395
3414
  unmount(
3396
3415
  suspense.pendingBranch,
3397
3416
  parentComponent,
3398
- parentSuspense,
3417
+ parentSuspense2,
3399
3418
  doRemove
3400
3419
  );
3401
3420
  }
@@ -3488,33 +3507,41 @@ function setActiveBranch(suspense, branch) {
3488
3507
  }
3489
3508
  }
3490
3509
 
3491
- function provide(key, value) {
3492
- if (!currentInstance) {
3493
- if (process.env.NODE_ENV !== "production") {
3494
- warn(`provide() can only be used inside setup().`);
3495
- }
3496
- } else {
3497
- let provides = currentInstance.provides;
3498
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
3499
- if (parentProvides === provides) {
3500
- provides = currentInstance.provides = Object.create(parentProvides);
3501
- }
3502
- provides[key] = value;
3503
- }
3504
- }
3505
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
3506
- const instance = currentInstance || currentRenderingInstance;
3507
- if (instance) {
3508
- const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
3509
- if (provides && key in provides) {
3510
- return provides[key];
3511
- } else if (arguments.length > 1) {
3512
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
3513
- } else if (process.env.NODE_ENV !== "production") {
3514
- warn(`injection "${String(key)}" not found.`);
3510
+ const legacyDirectiveHookMap = {
3511
+ beforeMount: "bind",
3512
+ mounted: "inserted",
3513
+ updated: ["update", "componentUpdated"],
3514
+ unmounted: "unbind"
3515
+ };
3516
+ function mapCompatDirectiveHook(name, dir, instance) {
3517
+ const mappedName = legacyDirectiveHookMap[name];
3518
+ if (mappedName) {
3519
+ if (isArray(mappedName)) {
3520
+ const hook = [];
3521
+ mappedName.forEach((mapped) => {
3522
+ const mappedHook = dir[mapped];
3523
+ if (mappedHook) {
3524
+ softAssertCompatEnabled(
3525
+ "CUSTOM_DIR",
3526
+ instance,
3527
+ mapped,
3528
+ name
3529
+ );
3530
+ hook.push(mappedHook);
3531
+ }
3532
+ });
3533
+ return hook.length ? hook : void 0;
3534
+ } else {
3535
+ if (dir[mappedName]) {
3536
+ softAssertCompatEnabled(
3537
+ "CUSTOM_DIR",
3538
+ instance,
3539
+ mappedName,
3540
+ name
3541
+ );
3542
+ }
3543
+ return dir[mappedName];
3515
3544
  }
3516
- } else if (process.env.NODE_ENV !== "production") {
3517
- warn(`inject() can only be used inside setup() or functional components.`);
3518
3545
  }
3519
3546
  }
3520
3547
 
@@ -3774,6 +3801,68 @@ function traverse(value, seen) {
3774
3801
  return value;
3775
3802
  }
3776
3803
 
3804
+ function validateDirectiveName(name) {
3805
+ if (isBuiltInDirective(name)) {
3806
+ warn("Do not use built-in directive ids as custom directive id: " + name);
3807
+ }
3808
+ }
3809
+ function withDirectives(vnode, directives) {
3810
+ const internalInstance = currentRenderingInstance;
3811
+ if (internalInstance === null) {
3812
+ process.env.NODE_ENV !== "production" && warn(`withDirectives can only be used inside render functions.`);
3813
+ return vnode;
3814
+ }
3815
+ const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3816
+ const bindings = vnode.dirs || (vnode.dirs = []);
3817
+ for (let i = 0; i < directives.length; i++) {
3818
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3819
+ if (dir) {
3820
+ if (isFunction(dir)) {
3821
+ dir = {
3822
+ mounted: dir,
3823
+ updated: dir
3824
+ };
3825
+ }
3826
+ if (dir.deep) {
3827
+ traverse(value);
3828
+ }
3829
+ bindings.push({
3830
+ dir,
3831
+ instance,
3832
+ value,
3833
+ oldValue: void 0,
3834
+ arg,
3835
+ modifiers
3836
+ });
3837
+ }
3838
+ }
3839
+ return vnode;
3840
+ }
3841
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3842
+ const bindings = vnode.dirs;
3843
+ const oldBindings = prevVNode && prevVNode.dirs;
3844
+ for (let i = 0; i < bindings.length; i++) {
3845
+ const binding = bindings[i];
3846
+ if (oldBindings) {
3847
+ binding.oldValue = oldBindings[i].value;
3848
+ }
3849
+ let hook = binding.dir[name];
3850
+ if (!hook) {
3851
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
3852
+ }
3853
+ if (hook) {
3854
+ pauseTracking();
3855
+ callWithAsyncErrorHandling(hook, instance, 8, [
3856
+ vnode.el,
3857
+ binding,
3858
+ vnode,
3859
+ prevVNode
3860
+ ]);
3861
+ resetTracking();
3862
+ }
3863
+ }
3864
+ }
3865
+
3777
3866
  function useTransitionState() {
3778
3867
  const state = {
3779
3868
  isMounted: false,
@@ -4580,106 +4669,6 @@ function getCompatListeners(instance) {
4580
4669
  return listeners;
4581
4670
  }
4582
4671
 
4583
- const legacyDirectiveHookMap = {
4584
- beforeMount: "bind",
4585
- mounted: "inserted",
4586
- updated: ["update", "componentUpdated"],
4587
- unmounted: "unbind"
4588
- };
4589
- function mapCompatDirectiveHook(name, dir, instance) {
4590
- const mappedName = legacyDirectiveHookMap[name];
4591
- if (mappedName) {
4592
- if (isArray(mappedName)) {
4593
- const hook = [];
4594
- mappedName.forEach((mapped) => {
4595
- const mappedHook = dir[mapped];
4596
- if (mappedHook) {
4597
- softAssertCompatEnabled(
4598
- "CUSTOM_DIR",
4599
- instance,
4600
- mapped,
4601
- name
4602
- );
4603
- hook.push(mappedHook);
4604
- }
4605
- });
4606
- return hook.length ? hook : void 0;
4607
- } else {
4608
- if (dir[mappedName]) {
4609
- softAssertCompatEnabled(
4610
- "CUSTOM_DIR",
4611
- instance,
4612
- mappedName,
4613
- name
4614
- );
4615
- }
4616
- return dir[mappedName];
4617
- }
4618
- }
4619
- }
4620
-
4621
- function validateDirectiveName(name) {
4622
- if (isBuiltInDirective(name)) {
4623
- warn("Do not use built-in directive ids as custom directive id: " + name);
4624
- }
4625
- }
4626
- function withDirectives(vnode, directives) {
4627
- const internalInstance = currentRenderingInstance;
4628
- if (internalInstance === null) {
4629
- process.env.NODE_ENV !== "production" && warn(`withDirectives can only be used inside render functions.`);
4630
- return vnode;
4631
- }
4632
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4633
- const bindings = vnode.dirs || (vnode.dirs = []);
4634
- for (let i = 0; i < directives.length; i++) {
4635
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4636
- if (dir) {
4637
- if (isFunction(dir)) {
4638
- dir = {
4639
- mounted: dir,
4640
- updated: dir
4641
- };
4642
- }
4643
- if (dir.deep) {
4644
- traverse(value);
4645
- }
4646
- bindings.push({
4647
- dir,
4648
- instance,
4649
- value,
4650
- oldValue: void 0,
4651
- arg,
4652
- modifiers
4653
- });
4654
- }
4655
- }
4656
- return vnode;
4657
- }
4658
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4659
- const bindings = vnode.dirs;
4660
- const oldBindings = prevVNode && prevVNode.dirs;
4661
- for (let i = 0; i < bindings.length; i++) {
4662
- const binding = bindings[i];
4663
- if (oldBindings) {
4664
- binding.oldValue = oldBindings[i].value;
4665
- }
4666
- let hook = binding.dir[name];
4667
- if (!hook) {
4668
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
4669
- }
4670
- if (hook) {
4671
- pauseTracking();
4672
- callWithAsyncErrorHandling(hook, instance, 8, [
4673
- vnode.el,
4674
- binding,
4675
- vnode,
4676
- prevVNode
4677
- ]);
4678
- resetTracking();
4679
- }
4680
- }
4681
- }
4682
-
4683
4672
  const COMPONENTS = "components";
4684
4673
  const DIRECTIVES = "directives";
4685
4674
  const FILTERS = "filters";
@@ -5395,6 +5384,8 @@ const PublicInstanceProxyHandlers = {
5395
5384
  if (key === "$attrs") {
5396
5385
  track(instance, "get", key);
5397
5386
  process.env.NODE_ENV !== "production" && markAttrsAccessed();
5387
+ } else if (process.env.NODE_ENV !== "production" && key === "$slots") {
5388
+ track(instance, "get", key);
5398
5389
  }
5399
5390
  return publicGetter(instance);
5400
5391
  } else if (
@@ -5584,27 +5575,182 @@ function deepMergeData(to, from) {
5584
5575
  return to;
5585
5576
  }
5586
5577
 
5587
- function createDuplicateChecker() {
5588
- const cache = /* @__PURE__ */ Object.create(null);
5589
- return (type, key) => {
5590
- if (cache[key]) {
5591
- warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
5592
- } else {
5593
- cache[key] = type;
5594
- }
5595
- };
5596
- }
5597
- let shouldCacheAccess = true;
5598
- function applyOptions(instance) {
5599
- const options = resolveMergedOptions(instance);
5600
- const publicThis = instance.proxy;
5601
- const ctx = instance.ctx;
5602
- shouldCacheAccess = false;
5603
- if (options.beforeCreate) {
5604
- callHook$1(options.beforeCreate, instance, "bc");
5578
+ const warnRuntimeUsage = (method) => warn(
5579
+ `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
5580
+ );
5581
+ function defineProps() {
5582
+ if (process.env.NODE_ENV !== "production") {
5583
+ warnRuntimeUsage(`defineProps`);
5605
5584
  }
5606
- const {
5607
- // state
5585
+ return null;
5586
+ }
5587
+ function defineEmits() {
5588
+ if (process.env.NODE_ENV !== "production") {
5589
+ warnRuntimeUsage(`defineEmits`);
5590
+ }
5591
+ return null;
5592
+ }
5593
+ function defineExpose(exposed) {
5594
+ if (process.env.NODE_ENV !== "production") {
5595
+ warnRuntimeUsage(`defineExpose`);
5596
+ }
5597
+ }
5598
+ function defineOptions(options) {
5599
+ if (process.env.NODE_ENV !== "production") {
5600
+ warnRuntimeUsage(`defineOptions`);
5601
+ }
5602
+ }
5603
+ function defineSlots() {
5604
+ if (process.env.NODE_ENV !== "production") {
5605
+ warnRuntimeUsage(`defineSlots`);
5606
+ }
5607
+ return null;
5608
+ }
5609
+ function defineModel() {
5610
+ if (process.env.NODE_ENV !== "production") {
5611
+ warnRuntimeUsage("defineModel");
5612
+ }
5613
+ }
5614
+ function withDefaults(props, defaults) {
5615
+ if (process.env.NODE_ENV !== "production") {
5616
+ warnRuntimeUsage(`withDefaults`);
5617
+ }
5618
+ return null;
5619
+ }
5620
+ function useSlots() {
5621
+ return getContext().slots;
5622
+ }
5623
+ function useAttrs() {
5624
+ return getContext().attrs;
5625
+ }
5626
+ function useModel(props, name, options) {
5627
+ const i = getCurrentInstance();
5628
+ if (process.env.NODE_ENV !== "production" && !i) {
5629
+ warn(`useModel() called without active instance.`);
5630
+ return ref();
5631
+ }
5632
+ if (process.env.NODE_ENV !== "production" && !i.propsOptions[0][name]) {
5633
+ warn(`useModel() called with prop "${name}" which is not declared.`);
5634
+ return ref();
5635
+ }
5636
+ if (options && options.local) {
5637
+ const proxy = ref(props[name]);
5638
+ watch(
5639
+ () => props[name],
5640
+ (v) => proxy.value = v
5641
+ );
5642
+ watch(proxy, (value) => {
5643
+ if (value !== props[name]) {
5644
+ i.emit(`update:${name}`, value);
5645
+ }
5646
+ });
5647
+ return proxy;
5648
+ } else {
5649
+ return {
5650
+ __v_isRef: true,
5651
+ get value() {
5652
+ return props[name];
5653
+ },
5654
+ set value(value) {
5655
+ i.emit(`update:${name}`, value);
5656
+ }
5657
+ };
5658
+ }
5659
+ }
5660
+ function getContext() {
5661
+ const i = getCurrentInstance();
5662
+ if (process.env.NODE_ENV !== "production" && !i) {
5663
+ warn(`useContext() called without active instance.`);
5664
+ }
5665
+ return i.setupContext || (i.setupContext = createSetupContext(i));
5666
+ }
5667
+ function normalizePropsOrEmits(props) {
5668
+ return isArray(props) ? props.reduce(
5669
+ (normalized, p) => (normalized[p] = null, normalized),
5670
+ {}
5671
+ ) : props;
5672
+ }
5673
+ function mergeDefaults(raw, defaults) {
5674
+ const props = normalizePropsOrEmits(raw);
5675
+ for (const key in defaults) {
5676
+ if (key.startsWith("__skip"))
5677
+ continue;
5678
+ let opt = props[key];
5679
+ if (opt) {
5680
+ if (isArray(opt) || isFunction(opt)) {
5681
+ opt = props[key] = { type: opt, default: defaults[key] };
5682
+ } else {
5683
+ opt.default = defaults[key];
5684
+ }
5685
+ } else if (opt === null) {
5686
+ opt = props[key] = { default: defaults[key] };
5687
+ } else if (process.env.NODE_ENV !== "production") {
5688
+ warn(`props default key "${key}" has no corresponding declaration.`);
5689
+ }
5690
+ if (opt && defaults[`__skip_${key}`]) {
5691
+ opt.skipFactory = true;
5692
+ }
5693
+ }
5694
+ return props;
5695
+ }
5696
+ function mergeModels(a, b) {
5697
+ if (!a || !b)
5698
+ return a || b;
5699
+ if (isArray(a) && isArray(b))
5700
+ return a.concat(b);
5701
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
5702
+ }
5703
+ function createPropsRestProxy(props, excludedKeys) {
5704
+ const ret = {};
5705
+ for (const key in props) {
5706
+ if (!excludedKeys.includes(key)) {
5707
+ Object.defineProperty(ret, key, {
5708
+ enumerable: true,
5709
+ get: () => props[key]
5710
+ });
5711
+ }
5712
+ }
5713
+ return ret;
5714
+ }
5715
+ function withAsyncContext(getAwaitable) {
5716
+ const ctx = getCurrentInstance();
5717
+ if (process.env.NODE_ENV !== "production" && !ctx) {
5718
+ warn(
5719
+ `withAsyncContext called without active current instance. This is likely a bug.`
5720
+ );
5721
+ }
5722
+ let awaitable = getAwaitable();
5723
+ unsetCurrentInstance();
5724
+ if (isPromise(awaitable)) {
5725
+ awaitable = awaitable.catch((e) => {
5726
+ setCurrentInstance(ctx);
5727
+ throw e;
5728
+ });
5729
+ }
5730
+ return [awaitable, () => setCurrentInstance(ctx)];
5731
+ }
5732
+
5733
+ function createDuplicateChecker() {
5734
+ const cache = /* @__PURE__ */ Object.create(null);
5735
+ return (type, key) => {
5736
+ if (cache[key]) {
5737
+ warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
5738
+ } else {
5739
+ cache[key] = type;
5740
+ }
5741
+ };
5742
+ }
5743
+ let shouldCacheAccess = true;
5744
+ function applyOptions(instance) {
5745
+ const options = resolveMergedOptions(instance);
5746
+ const publicThis = instance.proxy;
5747
+ const ctx = instance.ctx;
5748
+ shouldCacheAccess = false;
5749
+ if (options.beforeCreate) {
5750
+ callHook$1(options.beforeCreate, instance, "bc");
5751
+ }
5752
+ const {
5753
+ // state
5608
5754
  data: dataOptions,
5609
5755
  computed: computedOptions,
5610
5756
  methods,
@@ -5646,12 +5792,7 @@ function applyOptions(instance) {
5646
5792
  }
5647
5793
  }
5648
5794
  if (injectOptions) {
5649
- resolveInjections(
5650
- injectOptions,
5651
- ctx,
5652
- checkDuplicateProperties,
5653
- instance.appContext.config.unwrapInjectedRef
5654
- );
5795
+ resolveInjections(injectOptions, ctx, checkDuplicateProperties);
5655
5796
  }
5656
5797
  if (methods) {
5657
5798
  for (const key in methods) {
@@ -5804,7 +5945,7 @@ function applyOptions(instance) {
5804
5945
  instance.filters = filters;
5805
5946
  }
5806
5947
  }
5807
- function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
5948
+ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
5808
5949
  if (isArray(injectOptions)) {
5809
5950
  injectOptions = normalizeInject(injectOptions);
5810
5951
  }
@@ -5826,21 +5967,12 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
5826
5967
  injected = inject(opt);
5827
5968
  }
5828
5969
  if (isRef(injected)) {
5829
- if (unwrapRef) {
5830
- Object.defineProperty(ctx, key, {
5831
- enumerable: true,
5832
- configurable: true,
5833
- get: () => injected.value,
5834
- set: (v) => injected.value = v
5835
- });
5836
- } else {
5837
- if (process.env.NODE_ENV !== "production") {
5838
- warn(
5839
- `injected property "${key}" is a ref and will be auto-unwrapped and no longer needs \`.value\` in the next minor release. To opt-in to the new behavior now, set \`app.config.unwrapInjectedRef = true\` (this config is temporary and will not be needed in the future.)`
5840
- );
5841
- }
5842
- ctx[key] = injected;
5843
- }
5970
+ Object.defineProperty(ctx, key, {
5971
+ enumerable: true,
5972
+ configurable: true,
5973
+ get: () => injected.value,
5974
+ set: (v) => injected.value = v
5975
+ });
5844
5976
  } else {
5845
5977
  ctx[key] = injected;
5846
5978
  }
@@ -5943,10 +6075,8 @@ function mergeOptions(to, from, strats, asMixin = false) {
5943
6075
  }
5944
6076
  const internalOptionMergeStrats = {
5945
6077
  data: mergeDataFn,
5946
- props: mergeObjectOptions,
5947
- // TODO
5948
- emits: mergeObjectOptions,
5949
- // TODO
6078
+ props: mergeEmitsOrPropsOptions,
6079
+ emits: mergeEmitsOrPropsOptions,
5950
6080
  // objects
5951
6081
  methods: mergeObjectOptions,
5952
6082
  computed: mergeObjectOptions,
@@ -6008,7 +6138,21 @@ function mergeAsArray(to, from) {
6008
6138
  return to ? [...new Set([].concat(to, from))] : from;
6009
6139
  }
6010
6140
  function mergeObjectOptions(to, from) {
6011
- return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
6141
+ return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
6142
+ }
6143
+ function mergeEmitsOrPropsOptions(to, from) {
6144
+ if (to) {
6145
+ if (isArray(to) && isArray(from)) {
6146
+ return [.../* @__PURE__ */ new Set([...to, ...from])];
6147
+ }
6148
+ return extend(
6149
+ /* @__PURE__ */ Object.create(null),
6150
+ normalizePropsOrEmits(to),
6151
+ normalizePropsOrEmits(from != null ? from : {})
6152
+ );
6153
+ } else {
6154
+ return from;
6155
+ }
6012
6156
  }
6013
6157
  function mergeWatchOptions(to, from) {
6014
6158
  if (!to)
@@ -6022,1182 +6166,1237 @@ function mergeWatchOptions(to, from) {
6022
6166
  return merged;
6023
6167
  }
6024
6168
 
6025
- function createPropsDefaultThis(instance, rawProps, propKey) {
6026
- return new Proxy(
6027
- {},
6028
- {
6029
- get(_, key) {
6030
- process.env.NODE_ENV !== "production" && warnDeprecation("PROPS_DEFAULT_THIS", null, propKey);
6031
- if (key === "$options") {
6032
- return resolveMergedOptions(instance);
6033
- }
6034
- if (key in rawProps) {
6035
- return rawProps[key];
6036
- }
6037
- const injections = instance.type.inject;
6038
- if (injections) {
6039
- if (isArray(injections)) {
6040
- if (injections.includes(key)) {
6041
- return inject(key);
6042
- }
6043
- } else if (key in injections) {
6044
- return inject(key);
6045
- }
6169
+ function installLegacyConfigWarnings(config) {
6170
+ const legacyConfigOptions = {
6171
+ silent: "CONFIG_SILENT",
6172
+ devtools: "CONFIG_DEVTOOLS",
6173
+ ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6174
+ keyCodes: "CONFIG_KEY_CODES",
6175
+ productionTip: "CONFIG_PRODUCTION_TIP"
6176
+ };
6177
+ Object.keys(legacyConfigOptions).forEach((key) => {
6178
+ let val = config[key];
6179
+ Object.defineProperty(config, key, {
6180
+ enumerable: true,
6181
+ get() {
6182
+ return val;
6183
+ },
6184
+ set(newVal) {
6185
+ if (!isCopyingConfig) {
6186
+ warnDeprecation(legacyConfigOptions[key], null);
6046
6187
  }
6188
+ val = newVal;
6047
6189
  }
6048
- }
6049
- );
6190
+ });
6191
+ });
6050
6192
  }
6051
-
6052
- function shouldSkipAttr(key, instance) {
6053
- if (key === "is") {
6054
- return true;
6055
- }
6056
- if ((key === "class" || key === "style") && isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6057
- return true;
6058
- }
6059
- if (isOn(key) && isCompatEnabled("INSTANCE_LISTENERS", instance)) {
6060
- return true;
6061
- }
6062
- if (key.startsWith("routerView") || key === "registerRouteInstance") {
6063
- return true;
6064
- }
6065
- return false;
6193
+ function installLegacyOptionMergeStrats(config) {
6194
+ config.optionMergeStrategies = new Proxy({}, {
6195
+ get(target, key) {
6196
+ if (key in target) {
6197
+ return target[key];
6198
+ }
6199
+ if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6200
+ "CONFIG_OPTION_MERGE_STRATS",
6201
+ null
6202
+ )) {
6203
+ return internalOptionMergeStrats[key];
6204
+ }
6205
+ }
6206
+ });
6066
6207
  }
6067
6208
 
6068
- function initProps(instance, rawProps, isStateful, isSSR = false) {
6069
- const props = {};
6070
- const attrs = {};
6071
- def(attrs, InternalObjectKey, 1);
6072
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6073
- setFullProps(instance, rawProps, props, attrs);
6074
- for (const key in instance.propsOptions[0]) {
6075
- if (!(key in props)) {
6076
- props[key] = void 0;
6209
+ let isCopyingConfig = false;
6210
+ let singletonApp;
6211
+ let singletonCtor;
6212
+ function createCompatVue$1(createApp, createSingletonApp) {
6213
+ singletonApp = createSingletonApp({});
6214
+ const Vue = singletonCtor = function Vue2(options = {}) {
6215
+ return createCompatApp(options, Vue2);
6216
+ };
6217
+ function createCompatApp(options = {}, Ctor) {
6218
+ assertCompatEnabled("GLOBAL_MOUNT", null);
6219
+ const { data } = options;
6220
+ if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6221
+ options.data = () => data;
6077
6222
  }
6078
- }
6079
- if (process.env.NODE_ENV !== "production") {
6080
- validateProps(rawProps || {}, props, instance);
6081
- }
6082
- if (isStateful) {
6083
- instance.props = isSSR ? props : shallowReactive(props);
6084
- } else {
6085
- if (!instance.type.props) {
6086
- instance.props = attrs;
6223
+ const app = createApp(options);
6224
+ if (Ctor !== Vue) {
6225
+ applySingletonPrototype(app, Ctor);
6226
+ }
6227
+ const vm = app._createRoot(options);
6228
+ if (options.el) {
6229
+ return vm.$mount(options.el);
6087
6230
  } else {
6088
- instance.props = props;
6231
+ return vm;
6089
6232
  }
6090
6233
  }
6091
- instance.attrs = attrs;
6092
- }
6093
- function isInHmrContext(instance) {
6094
- while (instance) {
6095
- if (instance.type.__hmrId)
6096
- return true;
6097
- instance = instance.parent;
6098
- }
6099
- }
6100
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
6101
- const {
6102
- props,
6103
- attrs,
6104
- vnode: { patchFlag }
6105
- } = instance;
6106
- const rawCurrentProps = toRaw(props);
6107
- const [options] = instance.propsOptions;
6108
- let hasAttrsChanged = false;
6109
- if (
6110
- // always force full diff in dev
6111
- // - #1942 if hmr is enabled with sfc component
6112
- // - vite#872 non-sfc component used by sfc component
6113
- !(process.env.NODE_ENV !== "production" && isInHmrContext(instance)) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6114
- ) {
6115
- if (patchFlag & 8) {
6116
- const propsToUpdate = instance.vnode.dynamicProps;
6117
- for (let i = 0; i < propsToUpdate.length; i++) {
6118
- let key = propsToUpdate[i];
6119
- if (isEmitListener(instance.emitsOptions, key)) {
6120
- continue;
6121
- }
6122
- const value = rawProps[key];
6123
- if (options) {
6124
- if (hasOwn(attrs, key)) {
6125
- if (value !== attrs[key]) {
6126
- attrs[key] = value;
6127
- hasAttrsChanged = true;
6128
- }
6129
- } else {
6130
- const camelizedKey = camelize(key);
6131
- props[camelizedKey] = resolvePropValue(
6132
- options,
6133
- rawCurrentProps,
6134
- camelizedKey,
6135
- value,
6136
- instance,
6137
- false
6138
- /* isAbsent */
6139
- );
6140
- }
6141
- } else {
6142
- {
6143
- if (isOn(key) && key.endsWith("Native")) {
6144
- key = key.slice(0, -6);
6145
- } else if (shouldSkipAttr(key, instance)) {
6146
- continue;
6147
- }
6148
- }
6149
- if (value !== attrs[key]) {
6150
- attrs[key] = value;
6151
- hasAttrsChanged = true;
6152
- }
6153
- }
6154
- }
6155
- }
6156
- } else {
6157
- if (setFullProps(instance, rawProps, props, attrs)) {
6158
- hasAttrsChanged = true;
6234
+ Vue.version = `2.6.14-compat:${"3.3.0-beta.1"}`;
6235
+ Vue.config = singletonApp.config;
6236
+ Vue.use = (p, ...options) => {
6237
+ if (p && isFunction(p.install)) {
6238
+ p.install(Vue, ...options);
6239
+ } else if (isFunction(p)) {
6240
+ p(Vue, ...options);
6159
6241
  }
6160
- let kebabKey;
6161
- for (const key in rawCurrentProps) {
6162
- if (!rawProps || // for camelCase
6163
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6164
- // and converted to camelCase (#955)
6165
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6166
- if (options) {
6167
- if (rawPrevProps && // for camelCase
6168
- (rawPrevProps[key] !== void 0 || // for kebab-case
6169
- rawPrevProps[kebabKey] !== void 0)) {
6170
- props[key] = resolvePropValue(
6171
- options,
6172
- rawCurrentProps,
6173
- key,
6174
- void 0,
6175
- instance,
6176
- true
6177
- /* isAbsent */
6178
- );
6179
- }
6180
- } else {
6181
- delete props[key];
6182
- }
6183
- }
6242
+ return Vue;
6243
+ };
6244
+ Vue.mixin = (m) => {
6245
+ singletonApp.mixin(m);
6246
+ return Vue;
6247
+ };
6248
+ Vue.component = (name, comp) => {
6249
+ if (comp) {
6250
+ singletonApp.component(name, comp);
6251
+ return Vue;
6252
+ } else {
6253
+ return singletonApp.component(name);
6184
6254
  }
6185
- if (attrs !== rawCurrentProps) {
6186
- for (const key in attrs) {
6187
- if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6188
- delete attrs[key];
6189
- hasAttrsChanged = true;
6190
- }
6191
- }
6255
+ };
6256
+ Vue.directive = (name, dir) => {
6257
+ if (dir) {
6258
+ singletonApp.directive(name, dir);
6259
+ return Vue;
6260
+ } else {
6261
+ return singletonApp.directive(name);
6192
6262
  }
6193
- }
6194
- if (hasAttrsChanged) {
6195
- trigger(instance, "set", "$attrs");
6196
- }
6197
- if (process.env.NODE_ENV !== "production") {
6198
- validateProps(rawProps || {}, props, instance);
6199
- }
6200
- }
6201
- function setFullProps(instance, rawProps, props, attrs) {
6202
- const [options, needCastKeys] = instance.propsOptions;
6203
- let hasAttrsChanged = false;
6204
- let rawCastValues;
6205
- if (rawProps) {
6206
- for (let key in rawProps) {
6207
- if (isReservedProp(key)) {
6208
- continue;
6209
- }
6210
- {
6211
- if (key.startsWith("onHook:")) {
6212
- softAssertCompatEnabled(
6213
- "INSTANCE_EVENT_HOOKS",
6214
- instance,
6215
- key.slice(2).toLowerCase()
6216
- );
6217
- }
6218
- if (key === "inline-template") {
6219
- continue;
6220
- }
6221
- }
6222
- const value = rawProps[key];
6223
- let camelKey;
6224
- if (options && hasOwn(options, camelKey = camelize(key))) {
6225
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6226
- props[camelKey] = value;
6227
- } else {
6228
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6229
- }
6230
- } else if (!isEmitListener(instance.emitsOptions, key)) {
6231
- {
6232
- if (isOn(key) && key.endsWith("Native")) {
6233
- key = key.slice(0, -6);
6234
- } else if (shouldSkipAttr(key, instance)) {
6235
- continue;
6236
- }
6237
- }
6238
- if (!(key in attrs) || value !== attrs[key]) {
6239
- attrs[key] = value;
6240
- hasAttrsChanged = true;
6241
- }
6242
- }
6263
+ };
6264
+ Vue.options = { _base: Vue };
6265
+ let cid = 1;
6266
+ Vue.cid = cid;
6267
+ Vue.nextTick = nextTick;
6268
+ const extendCache = /* @__PURE__ */ new WeakMap();
6269
+ function extendCtor(extendOptions = {}) {
6270
+ assertCompatEnabled("GLOBAL_EXTEND", null);
6271
+ if (isFunction(extendOptions)) {
6272
+ extendOptions = extendOptions.options;
6243
6273
  }
6244
- }
6245
- if (needCastKeys) {
6246
- const rawCurrentProps = toRaw(props);
6247
- const castValues = rawCastValues || EMPTY_OBJ;
6248
- for (let i = 0; i < needCastKeys.length; i++) {
6249
- const key = needCastKeys[i];
6250
- props[key] = resolvePropValue(
6251
- options,
6252
- rawCurrentProps,
6253
- key,
6254
- castValues[key],
6255
- instance,
6256
- !hasOwn(castValues, key)
6257
- );
6274
+ if (extendCache.has(extendOptions)) {
6275
+ return extendCache.get(extendOptions);
6258
6276
  }
6259
- }
6260
- return hasAttrsChanged;
6261
- }
6262
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6263
- const opt = options[key];
6264
- if (opt != null) {
6265
- const hasDefault = hasOwn(opt, "default");
6266
- if (hasDefault && value === void 0) {
6267
- const defaultValue = opt.default;
6268
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6269
- const { propsDefaults } = instance;
6270
- if (key in propsDefaults) {
6271
- value = propsDefaults[key];
6272
- } else {
6273
- setCurrentInstance(instance);
6274
- value = propsDefaults[key] = defaultValue.call(
6275
- isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6276
- props
6277
- );
6278
- unsetCurrentInstance();
6279
- }
6277
+ const Super = this;
6278
+ function SubVue(inlineOptions) {
6279
+ if (!inlineOptions) {
6280
+ return createCompatApp(SubVue.options, SubVue);
6280
6281
  } else {
6281
- value = defaultValue;
6282
+ return createCompatApp(
6283
+ mergeOptions(
6284
+ extend({}, SubVue.options),
6285
+ inlineOptions,
6286
+ internalOptionMergeStrats
6287
+ ),
6288
+ SubVue
6289
+ );
6282
6290
  }
6283
6291
  }
6284
- if (opt[0 /* shouldCast */]) {
6285
- if (isAbsent && !hasDefault) {
6286
- value = false;
6287
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6288
- value = true;
6289
- }
6292
+ SubVue.super = Super;
6293
+ SubVue.prototype = Object.create(Vue.prototype);
6294
+ SubVue.prototype.constructor = SubVue;
6295
+ const mergeBase = {};
6296
+ for (const key in Super.options) {
6297
+ const superValue = Super.options[key];
6298
+ mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6290
6299
  }
6300
+ SubVue.options = mergeOptions(
6301
+ mergeBase,
6302
+ extendOptions,
6303
+ internalOptionMergeStrats
6304
+ );
6305
+ SubVue.options._base = SubVue;
6306
+ SubVue.extend = extendCtor.bind(SubVue);
6307
+ SubVue.mixin = Super.mixin;
6308
+ SubVue.use = Super.use;
6309
+ SubVue.cid = ++cid;
6310
+ extendCache.set(extendOptions, SubVue);
6311
+ return SubVue;
6291
6312
  }
6292
- return value;
6293
- }
6294
- function normalizePropsOptions(comp, appContext, asMixin = false) {
6295
- const cache = appContext.propsCache;
6296
- const cached = cache.get(comp);
6297
- if (cached) {
6298
- return cached;
6299
- }
6300
- const raw = comp.props;
6301
- const normalized = {};
6302
- const needCastKeys = [];
6303
- let hasExtends = false;
6304
- if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
6305
- const extendProps = (raw2) => {
6306
- if (isFunction(raw2)) {
6307
- raw2 = raw2.options;
6308
- }
6309
- hasExtends = true;
6310
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6311
- extend(normalized, props);
6312
- if (keys)
6313
- needCastKeys.push(...keys);
6314
- };
6315
- if (!asMixin && appContext.mixins.length) {
6316
- appContext.mixins.forEach(extendProps);
6317
- }
6318
- if (comp.extends) {
6319
- extendProps(comp.extends);
6313
+ Vue.extend = extendCtor.bind(Vue);
6314
+ Vue.set = (target, key, value) => {
6315
+ assertCompatEnabled("GLOBAL_SET", null);
6316
+ target[key] = value;
6317
+ };
6318
+ Vue.delete = (target, key) => {
6319
+ assertCompatEnabled("GLOBAL_DELETE", null);
6320
+ delete target[key];
6321
+ };
6322
+ Vue.observable = (target) => {
6323
+ assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6324
+ return reactive(target);
6325
+ };
6326
+ Vue.filter = (name, filter) => {
6327
+ if (filter) {
6328
+ singletonApp.filter(name, filter);
6329
+ return Vue;
6330
+ } else {
6331
+ return singletonApp.filter(name);
6320
6332
  }
6321
- if (comp.mixins) {
6322
- comp.mixins.forEach(extendProps);
6333
+ };
6334
+ const util = {
6335
+ warn: process.env.NODE_ENV !== "production" ? warn : NOOP,
6336
+ extend,
6337
+ mergeOptions: (parent, child, vm) => mergeOptions(
6338
+ parent,
6339
+ child,
6340
+ vm ? void 0 : internalOptionMergeStrats
6341
+ ),
6342
+ defineReactive
6343
+ };
6344
+ Object.defineProperty(Vue, "util", {
6345
+ get() {
6346
+ assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6347
+ return util;
6323
6348
  }
6349
+ });
6350
+ Vue.configureCompat = configureCompat$1;
6351
+ return Vue;
6352
+ }
6353
+ function installAppCompatProperties(app, context, render) {
6354
+ installFilterMethod(app, context);
6355
+ installLegacyOptionMergeStrats(app.config);
6356
+ if (!singletonApp) {
6357
+ return;
6324
6358
  }
6325
- if (!raw && !hasExtends) {
6326
- if (isObject(comp)) {
6327
- cache.set(comp, EMPTY_ARR);
6359
+ installCompatMount(app, context, render);
6360
+ installLegacyAPIs(app);
6361
+ applySingletonAppMutations(app);
6362
+ if (process.env.NODE_ENV !== "production")
6363
+ installLegacyConfigWarnings(app.config);
6364
+ }
6365
+ function installFilterMethod(app, context) {
6366
+ context.filters = {};
6367
+ app.filter = (name, filter) => {
6368
+ assertCompatEnabled("FILTERS", null);
6369
+ if (!filter) {
6370
+ return context.filters[name];
6328
6371
  }
6329
- return EMPTY_ARR;
6330
- }
6331
- if (isArray(raw)) {
6332
- for (let i = 0; i < raw.length; i++) {
6333
- if (process.env.NODE_ENV !== "production" && !isString(raw[i])) {
6334
- warn(`props must be strings when using array syntax.`, raw[i]);
6372
+ if (process.env.NODE_ENV !== "production" && context.filters[name]) {
6373
+ warn(`Filter "${name}" has already been registered.`);
6374
+ }
6375
+ context.filters[name] = filter;
6376
+ return app;
6377
+ };
6378
+ }
6379
+ function installLegacyAPIs(app) {
6380
+ Object.defineProperties(app, {
6381
+ // so that app.use() can work with legacy plugins that extend prototypes
6382
+ prototype: {
6383
+ get() {
6384
+ process.env.NODE_ENV !== "production" && warnDeprecation("GLOBAL_PROTOTYPE", null);
6385
+ return app.config.globalProperties;
6335
6386
  }
6336
- const normalizedKey = camelize(raw[i]);
6337
- if (validatePropName(normalizedKey)) {
6338
- normalized[normalizedKey] = EMPTY_OBJ;
6387
+ },
6388
+ nextTick: { value: nextTick },
6389
+ extend: { value: singletonCtor.extend },
6390
+ set: { value: singletonCtor.set },
6391
+ delete: { value: singletonCtor.delete },
6392
+ observable: { value: singletonCtor.observable },
6393
+ util: {
6394
+ get() {
6395
+ return singletonCtor.util;
6339
6396
  }
6340
6397
  }
6341
- } else if (raw) {
6342
- if (process.env.NODE_ENV !== "production" && !isObject(raw)) {
6343
- warn(`invalid props options`, raw);
6398
+ });
6399
+ }
6400
+ function applySingletonAppMutations(app) {
6401
+ app._context.mixins = [...singletonApp._context.mixins];
6402
+ ["components", "directives", "filters"].forEach((key) => {
6403
+ app._context[key] = Object.create(singletonApp._context[key]);
6404
+ });
6405
+ isCopyingConfig = true;
6406
+ for (const key in singletonApp.config) {
6407
+ if (key === "isNativeTag")
6408
+ continue;
6409
+ if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6410
+ continue;
6344
6411
  }
6345
- for (const key in raw) {
6346
- const normalizedKey = camelize(key);
6347
- if (validatePropName(normalizedKey)) {
6348
- const opt = raw[key];
6349
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6350
- if (prop) {
6351
- const booleanIndex = getTypeIndex(Boolean, prop.type);
6352
- const stringIndex = getTypeIndex(String, prop.type);
6353
- prop[0 /* shouldCast */] = booleanIndex > -1;
6354
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6355
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
6356
- needCastKeys.push(normalizedKey);
6357
- }
6358
- }
6359
- }
6412
+ const val = singletonApp.config[key];
6413
+ app.config[key] = isObject(val) ? Object.create(val) : val;
6414
+ if (key === "ignoredElements" && isCompatEnabled("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6415
+ app.config.compilerOptions.isCustomElement = (tag) => {
6416
+ return val.some((v) => isString(v) ? v === tag : v.test(tag));
6417
+ };
6360
6418
  }
6361
6419
  }
6362
- const res = [normalized, needCastKeys];
6363
- if (isObject(comp)) {
6364
- cache.set(comp, res);
6365
- }
6366
- return res;
6420
+ isCopyingConfig = false;
6421
+ applySingletonPrototype(app, singletonCtor);
6367
6422
  }
6368
- function validatePropName(key) {
6369
- if (key[0] !== "$") {
6370
- return true;
6371
- } else if (process.env.NODE_ENV !== "production") {
6372
- warn(`Invalid prop name: "${key}" is a reserved property.`);
6423
+ function applySingletonPrototype(app, Ctor) {
6424
+ const enabled = isCompatEnabled("GLOBAL_PROTOTYPE", null);
6425
+ if (enabled) {
6426
+ app.config.globalProperties = Object.create(Ctor.prototype);
6373
6427
  }
6374
- return false;
6375
- }
6376
- function getType(ctor) {
6377
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
6378
- return match ? match[2] : ctor === null ? "null" : "";
6379
- }
6380
- function isSameType(a, b) {
6381
- return getType(a) === getType(b);
6382
- }
6383
- function getTypeIndex(type, expectedTypes) {
6384
- if (isArray(expectedTypes)) {
6385
- return expectedTypes.findIndex((t) => isSameType(t, type));
6386
- } else if (isFunction(expectedTypes)) {
6387
- return isSameType(expectedTypes, type) ? 0 : -1;
6428
+ let hasPrototypeAugmentations = false;
6429
+ const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6430
+ for (const key in descriptors) {
6431
+ if (key !== "constructor") {
6432
+ hasPrototypeAugmentations = true;
6433
+ if (enabled) {
6434
+ Object.defineProperty(
6435
+ app.config.globalProperties,
6436
+ key,
6437
+ descriptors[key]
6438
+ );
6439
+ }
6440
+ }
6388
6441
  }
6389
- return -1;
6390
- }
6391
- function validateProps(rawProps, props, instance) {
6392
- const resolvedValues = toRaw(props);
6393
- const options = instance.propsOptions[0];
6394
- for (const key in options) {
6395
- let opt = options[key];
6396
- if (opt == null)
6397
- continue;
6398
- validateProp(
6399
- key,
6400
- resolvedValues[key],
6401
- opt,
6402
- !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6403
- );
6442
+ if (process.env.NODE_ENV !== "production" && hasPrototypeAugmentations) {
6443
+ warnDeprecation("GLOBAL_PROTOTYPE", null);
6404
6444
  }
6405
6445
  }
6406
- function validateProp(name, value, prop, isAbsent) {
6407
- const { type, required, validator, skipCheck } = prop;
6408
- if (required && isAbsent) {
6409
- warn('Missing required prop: "' + name + '"');
6410
- return;
6411
- }
6412
- if (value == null && !prop.required) {
6413
- return;
6414
- }
6415
- if (type != null && type !== true && !skipCheck) {
6416
- let isValid = false;
6417
- const types = isArray(type) ? type : [type];
6418
- const expectedTypes = [];
6419
- for (let i = 0; i < types.length && !isValid; i++) {
6420
- const { valid, expectedType } = assertType(value, types[i]);
6421
- expectedTypes.push(expectedType || "");
6422
- isValid = valid;
6423
- }
6424
- if (!isValid) {
6425
- warn(getInvalidTypeMessage(name, value, expectedTypes));
6426
- return;
6427
- }
6428
- }
6429
- if (validator && !validator(value)) {
6430
- warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6431
- }
6432
- }
6433
- const isSimpleType = /* @__PURE__ */ makeMap(
6434
- "String,Number,Boolean,Function,Symbol,BigInt"
6435
- );
6436
- function assertType(value, type) {
6437
- let valid;
6438
- const expectedType = getType(type);
6439
- if (isSimpleType(expectedType)) {
6440
- const t = typeof value;
6441
- valid = t === expectedType.toLowerCase();
6442
- if (!valid && t === "object") {
6443
- valid = value instanceof type;
6446
+ function installCompatMount(app, context, render) {
6447
+ let isMounted = false;
6448
+ app._createRoot = (options) => {
6449
+ const component = app._component;
6450
+ const vnode = createVNode(component, options.propsData || null);
6451
+ vnode.appContext = context;
6452
+ const hasNoRender = !isFunction(component) && !component.render && !component.template;
6453
+ const emptyRender = () => {
6454
+ };
6455
+ const instance = createComponentInstance(vnode, null, null);
6456
+ if (hasNoRender) {
6457
+ instance.render = emptyRender;
6444
6458
  }
6445
- } else if (expectedType === "Object") {
6446
- valid = isObject(value);
6447
- } else if (expectedType === "Array") {
6448
- valid = isArray(value);
6449
- } else if (expectedType === "null") {
6450
- valid = value === null;
6451
- } else {
6452
- valid = value instanceof type;
6453
- }
6454
- return {
6455
- valid,
6456
- expectedType
6459
+ setupComponent(instance);
6460
+ vnode.component = instance;
6461
+ vnode.isCompatRoot = true;
6462
+ instance.ctx._compat_mount = (selectorOrEl) => {
6463
+ if (isMounted) {
6464
+ process.env.NODE_ENV !== "production" && warn(`Root instance is already mounted.`);
6465
+ return;
6466
+ }
6467
+ let container;
6468
+ if (typeof selectorOrEl === "string") {
6469
+ const result = document.querySelector(selectorOrEl);
6470
+ if (!result) {
6471
+ process.env.NODE_ENV !== "production" && warn(
6472
+ `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6473
+ );
6474
+ return;
6475
+ }
6476
+ container = result;
6477
+ } else {
6478
+ container = selectorOrEl || document.createElement("div");
6479
+ }
6480
+ const isSVG = container instanceof SVGElement;
6481
+ if (process.env.NODE_ENV !== "production") {
6482
+ context.reload = () => {
6483
+ const cloned = cloneVNode(vnode);
6484
+ cloned.component = null;
6485
+ render(cloned, container, isSVG);
6486
+ };
6487
+ }
6488
+ if (hasNoRender && instance.render === emptyRender) {
6489
+ if (process.env.NODE_ENV !== "production") {
6490
+ for (let i = 0; i < container.attributes.length; i++) {
6491
+ const attr = container.attributes[i];
6492
+ if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6493
+ warnDeprecation("GLOBAL_MOUNT_CONTAINER", null);
6494
+ break;
6495
+ }
6496
+ }
6497
+ }
6498
+ instance.render = null;
6499
+ component.template = container.innerHTML;
6500
+ finishComponentSetup(
6501
+ instance,
6502
+ false,
6503
+ true
6504
+ /* skip options */
6505
+ );
6506
+ }
6507
+ container.innerHTML = "";
6508
+ render(vnode, container, isSVG);
6509
+ if (container instanceof Element) {
6510
+ container.removeAttribute("v-cloak");
6511
+ container.setAttribute("data-v-app", "");
6512
+ }
6513
+ isMounted = true;
6514
+ app._container = container;
6515
+ container.__vue_app__ = app;
6516
+ if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
6517
+ devtoolsInitApp(app, version);
6518
+ }
6519
+ return instance.proxy;
6520
+ };
6521
+ instance.ctx._compat_destroy = () => {
6522
+ if (isMounted) {
6523
+ render(null, app._container);
6524
+ if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
6525
+ devtoolsUnmountApp(app);
6526
+ }
6527
+ delete app._container.__vue_app__;
6528
+ } else {
6529
+ const { bum, scope, um } = instance;
6530
+ if (bum) {
6531
+ invokeArrayFns(bum);
6532
+ }
6533
+ if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6534
+ instance.emit("hook:beforeDestroy");
6535
+ }
6536
+ if (scope) {
6537
+ scope.stop();
6538
+ }
6539
+ if (um) {
6540
+ invokeArrayFns(um);
6541
+ }
6542
+ if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6543
+ instance.emit("hook:destroyed");
6544
+ }
6545
+ }
6546
+ };
6547
+ return instance.proxy;
6457
6548
  };
6458
6549
  }
6459
- function getInvalidTypeMessage(name, value, expectedTypes) {
6460
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
6461
- const expectedType = expectedTypes[0];
6462
- const receivedType = toRawType(value);
6463
- const expectedValue = styleValue(value, expectedType);
6464
- const receivedValue = styleValue(value, receivedType);
6465
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
6466
- message += ` with value ${expectedValue}`;
6467
- }
6468
- message += `, got ${receivedType} `;
6469
- if (isExplicable(receivedType)) {
6470
- message += `with value ${receivedValue}.`;
6550
+ const methodsToPatch = [
6551
+ "push",
6552
+ "pop",
6553
+ "shift",
6554
+ "unshift",
6555
+ "splice",
6556
+ "sort",
6557
+ "reverse"
6558
+ ];
6559
+ const patched = /* @__PURE__ */ new WeakSet();
6560
+ function defineReactive(obj, key, val) {
6561
+ if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6562
+ const reactiveVal = reactive(val);
6563
+ if (isArray(val)) {
6564
+ methodsToPatch.forEach((m) => {
6565
+ val[m] = (...args) => {
6566
+ Array.prototype[m].call(reactiveVal, ...args);
6567
+ };
6568
+ });
6569
+ } else {
6570
+ Object.keys(val).forEach((key2) => {
6571
+ try {
6572
+ defineReactiveSimple(val, key2, val[key2]);
6573
+ } catch (e) {
6574
+ }
6575
+ });
6576
+ }
6471
6577
  }
6472
- return message;
6473
- }
6474
- function styleValue(value, type) {
6475
- if (type === "String") {
6476
- return `"${value}"`;
6477
- } else if (type === "Number") {
6478
- return `${Number(value)}`;
6578
+ const i = obj.$;
6579
+ if (i && obj === i.proxy) {
6580
+ defineReactiveSimple(i.ctx, key, val);
6581
+ i.accessCache = /* @__PURE__ */ Object.create(null);
6582
+ } else if (isReactive(obj)) {
6583
+ obj[key] = val;
6479
6584
  } else {
6480
- return `${value}`;
6585
+ defineReactiveSimple(obj, key, val);
6481
6586
  }
6482
6587
  }
6483
- function isExplicable(type) {
6484
- const explicitTypes = ["string", "number", "boolean"];
6485
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
6486
- }
6487
- function isBoolean(...args) {
6488
- return args.some((elem) => elem.toLowerCase() === "boolean");
6588
+ function defineReactiveSimple(obj, key, val) {
6589
+ val = isObject(val) ? reactive(val) : val;
6590
+ Object.defineProperty(obj, key, {
6591
+ enumerable: true,
6592
+ configurable: true,
6593
+ get() {
6594
+ track(obj, "get", key);
6595
+ return val;
6596
+ },
6597
+ set(newVal) {
6598
+ val = isObject(newVal) ? reactive(newVal) : newVal;
6599
+ trigger(obj, "set", key, newVal);
6600
+ }
6601
+ });
6489
6602
  }
6490
6603
 
6491
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6492
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6493
- const normalizeSlot = (key, rawSlot, ctx) => {
6494
- if (rawSlot._n) {
6495
- return rawSlot;
6496
- }
6497
- const normalized = withCtx((...args) => {
6498
- if (process.env.NODE_ENV !== "production" && currentInstance) {
6499
- warn(
6500
- `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
6501
- );
6604
+ function createAppContext() {
6605
+ return {
6606
+ app: null,
6607
+ config: {
6608
+ isNativeTag: NO,
6609
+ performance: false,
6610
+ globalProperties: {},
6611
+ optionMergeStrategies: {},
6612
+ errorHandler: void 0,
6613
+ warnHandler: void 0,
6614
+ compilerOptions: {}
6615
+ },
6616
+ mixins: [],
6617
+ components: {},
6618
+ directives: {},
6619
+ provides: /* @__PURE__ */ Object.create(null),
6620
+ optionsCache: /* @__PURE__ */ new WeakMap(),
6621
+ propsCache: /* @__PURE__ */ new WeakMap(),
6622
+ emitsCache: /* @__PURE__ */ new WeakMap()
6623
+ };
6624
+ }
6625
+ let uid$1 = 0;
6626
+ function createAppAPI(render, hydrate) {
6627
+ return function createApp(rootComponent, rootProps = null) {
6628
+ if (!isFunction(rootComponent)) {
6629
+ rootComponent = extend({}, rootComponent);
6502
6630
  }
6503
- return normalizeSlotValue(rawSlot(...args));
6504
- }, ctx);
6505
- normalized._c = false;
6506
- return normalized;
6507
- };
6508
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
6509
- const ctx = rawSlots._ctx;
6510
- for (const key in rawSlots) {
6511
- if (isInternalKey(key))
6512
- continue;
6513
- const value = rawSlots[key];
6514
- if (isFunction(value)) {
6515
- slots[key] = normalizeSlot(key, value, ctx);
6516
- } else if (value != null) {
6517
- if (process.env.NODE_ENV !== "production" && !isCompatEnabled("RENDER_FUNCTION", instance)) {
6518
- warn(
6519
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6520
- );
6521
- }
6522
- const normalized = normalizeSlotValue(value);
6523
- slots[key] = () => normalized;
6524
- }
6525
- }
6526
- };
6527
- const normalizeVNodeSlots = (instance, children) => {
6528
- if (process.env.NODE_ENV !== "production" && !isKeepAlive(instance.vnode) && !isCompatEnabled("RENDER_FUNCTION", instance)) {
6529
- warn(
6530
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
6531
- );
6532
- }
6533
- const normalized = normalizeSlotValue(children);
6534
- instance.slots.default = () => normalized;
6535
- };
6536
- const initSlots = (instance, children) => {
6537
- if (instance.vnode.shapeFlag & 32) {
6538
- const type = children._;
6539
- if (type) {
6540
- instance.slots = toRaw(children);
6541
- def(children, "_", type);
6542
- } else {
6543
- normalizeObjectSlots(
6544
- children,
6545
- instance.slots = {},
6546
- instance
6547
- );
6548
- }
6549
- } else {
6550
- instance.slots = {};
6551
- if (children) {
6552
- normalizeVNodeSlots(instance, children);
6631
+ if (rootProps != null && !isObject(rootProps)) {
6632
+ process.env.NODE_ENV !== "production" && warn(`root props passed to app.mount() must be an object.`);
6633
+ rootProps = null;
6553
6634
  }
6554
- }
6555
- def(instance.slots, InternalObjectKey, 1);
6556
- };
6557
- const updateSlots = (instance, children, optimized) => {
6558
- const { vnode, slots } = instance;
6559
- let needDeletionCheck = true;
6560
- let deletionComparisonTarget = EMPTY_OBJ;
6561
- if (vnode.shapeFlag & 32) {
6562
- const type = children._;
6563
- if (type) {
6564
- if (process.env.NODE_ENV !== "production" && isHmrUpdating) {
6565
- extend(slots, children);
6566
- } else if (optimized && type === 1) {
6567
- needDeletionCheck = false;
6568
- } else {
6569
- extend(slots, children);
6570
- if (!optimized && type === 1) {
6571
- delete slots._;
6635
+ const context = createAppContext();
6636
+ if (process.env.NODE_ENV !== "production") {
6637
+ Object.defineProperty(context.config, "unwrapInjectedRef", {
6638
+ get() {
6639
+ return true;
6640
+ },
6641
+ set() {
6642
+ warn(
6643
+ `app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
6644
+ );
6572
6645
  }
6573
- }
6574
- } else {
6575
- needDeletionCheck = !children.$stable;
6576
- normalizeObjectSlots(children, slots, instance);
6577
- }
6578
- deletionComparisonTarget = children;
6579
- } else if (children) {
6580
- normalizeVNodeSlots(instance, children);
6581
- deletionComparisonTarget = { default: 1 };
6582
- }
6583
- if (needDeletionCheck) {
6584
- for (const key in slots) {
6585
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
6586
- delete slots[key];
6587
- }
6646
+ });
6588
6647
  }
6589
- }
6590
- };
6591
-
6592
- function installLegacyConfigWarnings(config) {
6593
- const legacyConfigOptions = {
6594
- silent: "CONFIG_SILENT",
6595
- devtools: "CONFIG_DEVTOOLS",
6596
- ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6597
- keyCodes: "CONFIG_KEY_CODES",
6598
- productionTip: "CONFIG_PRODUCTION_TIP"
6599
- };
6600
- Object.keys(legacyConfigOptions).forEach((key) => {
6601
- let val = config[key];
6602
- Object.defineProperty(config, key, {
6603
- enumerable: true,
6604
- get() {
6605
- return val;
6648
+ const installedPlugins = /* @__PURE__ */ new Set();
6649
+ let isMounted = false;
6650
+ const app = context.app = {
6651
+ _uid: uid$1++,
6652
+ _component: rootComponent,
6653
+ _props: rootProps,
6654
+ _container: null,
6655
+ _context: context,
6656
+ _instance: null,
6657
+ version,
6658
+ get config() {
6659
+ return context.config;
6606
6660
  },
6607
- set(newVal) {
6608
- if (!isCopyingConfig) {
6609
- warnDeprecation(legacyConfigOptions[key], null);
6661
+ set config(v) {
6662
+ if (process.env.NODE_ENV !== "production") {
6663
+ warn(
6664
+ `app.config cannot be replaced. Modify individual options instead.`
6665
+ );
6666
+ }
6667
+ },
6668
+ use(plugin, ...options) {
6669
+ if (installedPlugins.has(plugin)) {
6670
+ process.env.NODE_ENV !== "production" && warn(`Plugin has already been applied to target app.`);
6671
+ } else if (plugin && isFunction(plugin.install)) {
6672
+ installedPlugins.add(plugin);
6673
+ plugin.install(app, ...options);
6674
+ } else if (isFunction(plugin)) {
6675
+ installedPlugins.add(plugin);
6676
+ plugin(app, ...options);
6677
+ } else if (process.env.NODE_ENV !== "production") {
6678
+ warn(
6679
+ `A plugin must either be a function or an object with an "install" function.`
6680
+ );
6681
+ }
6682
+ return app;
6683
+ },
6684
+ mixin(mixin) {
6685
+ if (__VUE_OPTIONS_API__) {
6686
+ if (!context.mixins.includes(mixin)) {
6687
+ context.mixins.push(mixin);
6688
+ } else if (process.env.NODE_ENV !== "production") {
6689
+ warn(
6690
+ "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
6691
+ );
6692
+ }
6693
+ } else if (process.env.NODE_ENV !== "production") {
6694
+ warn("Mixins are only available in builds supporting Options API");
6695
+ }
6696
+ return app;
6697
+ },
6698
+ component(name, component) {
6699
+ if (process.env.NODE_ENV !== "production") {
6700
+ validateComponentName(name, context.config);
6701
+ }
6702
+ if (!component) {
6703
+ return context.components[name];
6704
+ }
6705
+ if (process.env.NODE_ENV !== "production" && context.components[name]) {
6706
+ warn(`Component "${name}" has already been registered in target app.`);
6707
+ }
6708
+ context.components[name] = component;
6709
+ return app;
6710
+ },
6711
+ directive(name, directive) {
6712
+ if (process.env.NODE_ENV !== "production") {
6713
+ validateDirectiveName(name);
6714
+ }
6715
+ if (!directive) {
6716
+ return context.directives[name];
6717
+ }
6718
+ if (process.env.NODE_ENV !== "production" && context.directives[name]) {
6719
+ warn(`Directive "${name}" has already been registered in target app.`);
6720
+ }
6721
+ context.directives[name] = directive;
6722
+ return app;
6723
+ },
6724
+ mount(rootContainer, isHydrate, isSVG) {
6725
+ if (!isMounted) {
6726
+ if (process.env.NODE_ENV !== "production" && rootContainer.__vue_app__) {
6727
+ warn(
6728
+ `There is already an app instance mounted on the host container.
6729
+ If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6730
+ );
6731
+ }
6732
+ const vnode = createVNode(
6733
+ rootComponent,
6734
+ rootProps
6735
+ );
6736
+ vnode.appContext = context;
6737
+ if (process.env.NODE_ENV !== "production") {
6738
+ context.reload = () => {
6739
+ render(cloneVNode(vnode), rootContainer, isSVG);
6740
+ };
6741
+ }
6742
+ if (isHydrate && hydrate) {
6743
+ hydrate(vnode, rootContainer);
6744
+ } else {
6745
+ render(vnode, rootContainer, isSVG);
6746
+ }
6747
+ isMounted = true;
6748
+ app._container = rootContainer;
6749
+ rootContainer.__vue_app__ = app;
6750
+ if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
6751
+ app._instance = vnode.component;
6752
+ devtoolsInitApp(app, version);
6753
+ }
6754
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
6755
+ } else if (process.env.NODE_ENV !== "production") {
6756
+ warn(
6757
+ `App has already been mounted.
6758
+ If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\``
6759
+ );
6760
+ }
6761
+ },
6762
+ unmount() {
6763
+ if (isMounted) {
6764
+ render(null, app._container);
6765
+ if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
6766
+ app._instance = null;
6767
+ devtoolsUnmountApp(app);
6768
+ }
6769
+ delete app._container.__vue_app__;
6770
+ } else if (process.env.NODE_ENV !== "production") {
6771
+ warn(`Cannot unmount an app that is not mounted.`);
6772
+ }
6773
+ },
6774
+ provide(key, value) {
6775
+ if (process.env.NODE_ENV !== "production" && key in context.provides) {
6776
+ warn(
6777
+ `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
6778
+ );
6779
+ }
6780
+ context.provides[key] = value;
6781
+ return app;
6782
+ },
6783
+ runWithContext(fn) {
6784
+ currentApp = app;
6785
+ try {
6786
+ return fn();
6787
+ } finally {
6788
+ currentApp = null;
6610
6789
  }
6611
- val = newVal;
6612
- }
6613
- });
6614
- });
6615
- }
6616
- function installLegacyOptionMergeStrats(config) {
6617
- config.optionMergeStrategies = new Proxy({}, {
6618
- get(target, key) {
6619
- if (key in target) {
6620
- return target[key];
6621
- }
6622
- if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6623
- "CONFIG_OPTION_MERGE_STRATS",
6624
- null
6625
- )) {
6626
- return internalOptionMergeStrats[key];
6627
6790
  }
6791
+ };
6792
+ {
6793
+ installAppCompatProperties(app, context, render);
6628
6794
  }
6629
- });
6795
+ return app;
6796
+ };
6630
6797
  }
6798
+ let currentApp = null;
6631
6799
 
6632
- let isCopyingConfig = false;
6633
- let singletonApp;
6634
- let singletonCtor;
6635
- function createCompatVue$1(createApp, createSingletonApp) {
6636
- singletonApp = createSingletonApp({});
6637
- const Vue = singletonCtor = function Vue2(options = {}) {
6638
- return createCompatApp(options, Vue2);
6639
- };
6640
- function createCompatApp(options = {}, Ctor) {
6641
- assertCompatEnabled("GLOBAL_MOUNT", null);
6642
- const { data } = options;
6643
- if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6644
- options.data = () => data;
6645
- }
6646
- const app = createApp(options);
6647
- if (Ctor !== Vue) {
6648
- applySingletonPrototype(app, Ctor);
6800
+ function provide(key, value) {
6801
+ if (!currentInstance) {
6802
+ if (process.env.NODE_ENV !== "production") {
6803
+ warn(`provide() can only be used inside setup().`);
6649
6804
  }
6650
- const vm = app._createRoot(options);
6651
- if (options.el) {
6652
- return vm.$mount(options.el);
6653
- } else {
6654
- return vm;
6805
+ } else {
6806
+ let provides = currentInstance.provides;
6807
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6808
+ if (parentProvides === provides) {
6809
+ provides = currentInstance.provides = Object.create(parentProvides);
6655
6810
  }
6811
+ provides[key] = value;
6656
6812
  }
6657
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.8"}`;
6658
- Vue.config = singletonApp.config;
6659
- Vue.use = (p, ...options) => {
6660
- if (p && isFunction(p.install)) {
6661
- p.install(Vue, ...options);
6662
- } else if (isFunction(p)) {
6663
- p(Vue, ...options);
6664
- }
6665
- return Vue;
6666
- };
6667
- Vue.mixin = (m) => {
6668
- singletonApp.mixin(m);
6669
- return Vue;
6670
- };
6671
- Vue.component = (name, comp) => {
6672
- if (comp) {
6673
- singletonApp.component(name, comp);
6674
- return Vue;
6675
- } else {
6676
- return singletonApp.component(name);
6677
- }
6678
- };
6679
- Vue.directive = (name, dir) => {
6680
- if (dir) {
6681
- singletonApp.directive(name, dir);
6682
- return Vue;
6683
- } else {
6684
- return singletonApp.directive(name);
6685
- }
6686
- };
6687
- Vue.options = { _base: Vue };
6688
- let cid = 1;
6689
- Vue.cid = cid;
6690
- Vue.nextTick = nextTick;
6691
- const extendCache = /* @__PURE__ */ new WeakMap();
6692
- function extendCtor(extendOptions = {}) {
6693
- assertCompatEnabled("GLOBAL_EXTEND", null);
6694
- if (isFunction(extendOptions)) {
6695
- extendOptions = extendOptions.options;
6696
- }
6697
- if (extendCache.has(extendOptions)) {
6698
- return extendCache.get(extendOptions);
6813
+ }
6814
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6815
+ const instance = currentInstance || currentRenderingInstance;
6816
+ if (instance || currentApp) {
6817
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
6818
+ if (provides && key in provides) {
6819
+ return provides[key];
6820
+ } else if (arguments.length > 1) {
6821
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
6822
+ } else if (process.env.NODE_ENV !== "production") {
6823
+ warn(`injection "${String(key)}" not found.`);
6699
6824
  }
6700
- const Super = this;
6701
- function SubVue(inlineOptions) {
6702
- if (!inlineOptions) {
6703
- return createCompatApp(SubVue.options, SubVue);
6704
- } else {
6705
- return createCompatApp(
6706
- mergeOptions(
6707
- extend({}, SubVue.options),
6708
- inlineOptions,
6709
- internalOptionMergeStrats
6710
- ),
6711
- SubVue
6712
- );
6825
+ } else if (process.env.NODE_ENV !== "production") {
6826
+ warn(`inject() can only be used inside setup() or functional components.`);
6827
+ }
6828
+ }
6829
+ function hasInjectionContext() {
6830
+ return !!(currentInstance || currentRenderingInstance || currentApp);
6831
+ }
6832
+
6833
+ function createPropsDefaultThis(instance, rawProps, propKey) {
6834
+ return new Proxy(
6835
+ {},
6836
+ {
6837
+ get(_, key) {
6838
+ process.env.NODE_ENV !== "production" && warnDeprecation("PROPS_DEFAULT_THIS", null, propKey);
6839
+ if (key === "$options") {
6840
+ return resolveMergedOptions(instance);
6841
+ }
6842
+ if (key in rawProps) {
6843
+ return rawProps[key];
6844
+ }
6845
+ const injections = instance.type.inject;
6846
+ if (injections) {
6847
+ if (isArray(injections)) {
6848
+ if (injections.includes(key)) {
6849
+ return inject(key);
6850
+ }
6851
+ } else if (key in injections) {
6852
+ return inject(key);
6853
+ }
6854
+ }
6713
6855
  }
6714
6856
  }
6715
- SubVue.super = Super;
6716
- SubVue.prototype = Object.create(Vue.prototype);
6717
- SubVue.prototype.constructor = SubVue;
6718
- const mergeBase = {};
6719
- for (const key in Super.options) {
6720
- const superValue = Super.options[key];
6721
- mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6857
+ );
6858
+ }
6859
+
6860
+ function shouldSkipAttr(key, instance) {
6861
+ if (key === "is") {
6862
+ return true;
6863
+ }
6864
+ if ((key === "class" || key === "style") && isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6865
+ return true;
6866
+ }
6867
+ if (isOn(key) && isCompatEnabled("INSTANCE_LISTENERS", instance)) {
6868
+ return true;
6869
+ }
6870
+ if (key.startsWith("routerView") || key === "registerRouteInstance") {
6871
+ return true;
6872
+ }
6873
+ return false;
6874
+ }
6875
+
6876
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
6877
+ const props = {};
6878
+ const attrs = {};
6879
+ def(attrs, InternalObjectKey, 1);
6880
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6881
+ setFullProps(instance, rawProps, props, attrs);
6882
+ for (const key in instance.propsOptions[0]) {
6883
+ if (!(key in props)) {
6884
+ props[key] = void 0;
6722
6885
  }
6723
- SubVue.options = mergeOptions(
6724
- mergeBase,
6725
- extendOptions,
6726
- internalOptionMergeStrats
6727
- );
6728
- SubVue.options._base = SubVue;
6729
- SubVue.extend = extendCtor.bind(SubVue);
6730
- SubVue.mixin = Super.mixin;
6731
- SubVue.use = Super.use;
6732
- SubVue.cid = ++cid;
6733
- extendCache.set(extendOptions, SubVue);
6734
- return SubVue;
6735
6886
  }
6736
- Vue.extend = extendCtor.bind(Vue);
6737
- Vue.set = (target, key, value) => {
6738
- assertCompatEnabled("GLOBAL_SET", null);
6739
- target[key] = value;
6740
- };
6741
- Vue.delete = (target, key) => {
6742
- assertCompatEnabled("GLOBAL_DELETE", null);
6743
- delete target[key];
6744
- };
6745
- Vue.observable = (target) => {
6746
- assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6747
- return reactive(target);
6748
- };
6749
- Vue.filter = (name, filter) => {
6750
- if (filter) {
6751
- singletonApp.filter(name, filter);
6752
- return Vue;
6887
+ if (process.env.NODE_ENV !== "production") {
6888
+ validateProps(rawProps || {}, props, instance);
6889
+ }
6890
+ if (isStateful) {
6891
+ instance.props = isSSR ? props : shallowReactive(props);
6892
+ } else {
6893
+ if (!instance.type.props) {
6894
+ instance.props = attrs;
6753
6895
  } else {
6754
- return singletonApp.filter(name);
6755
- }
6756
- };
6757
- const util = {
6758
- warn: process.env.NODE_ENV !== "production" ? warn : NOOP,
6759
- extend,
6760
- mergeOptions: (parent, child, vm) => mergeOptions(
6761
- parent,
6762
- child,
6763
- vm ? void 0 : internalOptionMergeStrats
6764
- ),
6765
- defineReactive
6766
- };
6767
- Object.defineProperty(Vue, "util", {
6768
- get() {
6769
- assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6770
- return util;
6896
+ instance.props = props;
6771
6897
  }
6772
- });
6773
- Vue.configureCompat = configureCompat$1;
6774
- return Vue;
6775
- }
6776
- function installAppCompatProperties(app, context, render) {
6777
- installFilterMethod(app, context);
6778
- installLegacyOptionMergeStrats(app.config);
6779
- if (!singletonApp) {
6780
- return;
6781
6898
  }
6782
- installCompatMount(app, context, render);
6783
- installLegacyAPIs(app);
6784
- applySingletonAppMutations(app);
6785
- if (process.env.NODE_ENV !== "production")
6786
- installLegacyConfigWarnings(app.config);
6899
+ instance.attrs = attrs;
6787
6900
  }
6788
- function installFilterMethod(app, context) {
6789
- context.filters = {};
6790
- app.filter = (name, filter) => {
6791
- assertCompatEnabled("FILTERS", null);
6792
- if (!filter) {
6793
- return context.filters[name];
6794
- }
6795
- if (process.env.NODE_ENV !== "production" && context.filters[name]) {
6796
- warn(`Filter "${name}" has already been registered.`);
6797
- }
6798
- context.filters[name] = filter;
6799
- return app;
6800
- };
6901
+ function isInHmrContext(instance) {
6902
+ while (instance) {
6903
+ if (instance.type.__hmrId)
6904
+ return true;
6905
+ instance = instance.parent;
6906
+ }
6801
6907
  }
6802
- function installLegacyAPIs(app) {
6803
- Object.defineProperties(app, {
6804
- // so that app.use() can work with legacy plugins that extend prototypes
6805
- prototype: {
6806
- get() {
6807
- process.env.NODE_ENV !== "production" && warnDeprecation("GLOBAL_PROTOTYPE", null);
6808
- return app.config.globalProperties;
6809
- }
6810
- },
6811
- nextTick: { value: nextTick },
6812
- extend: { value: singletonCtor.extend },
6813
- set: { value: singletonCtor.set },
6814
- delete: { value: singletonCtor.delete },
6815
- observable: { value: singletonCtor.observable },
6816
- util: {
6817
- get() {
6818
- return singletonCtor.util;
6908
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
6909
+ const {
6910
+ props,
6911
+ attrs,
6912
+ vnode: { patchFlag }
6913
+ } = instance;
6914
+ const rawCurrentProps = toRaw(props);
6915
+ const [options] = instance.propsOptions;
6916
+ let hasAttrsChanged = false;
6917
+ if (
6918
+ // always force full diff in dev
6919
+ // - #1942 if hmr is enabled with sfc component
6920
+ // - vite#872 non-sfc component used by sfc component
6921
+ !(process.env.NODE_ENV !== "production" && isInHmrContext(instance)) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6922
+ ) {
6923
+ if (patchFlag & 8) {
6924
+ const propsToUpdate = instance.vnode.dynamicProps;
6925
+ for (let i = 0; i < propsToUpdate.length; i++) {
6926
+ let key = propsToUpdate[i];
6927
+ if (isEmitListener(instance.emitsOptions, key)) {
6928
+ continue;
6929
+ }
6930
+ const value = rawProps[key];
6931
+ if (options) {
6932
+ if (hasOwn(attrs, key)) {
6933
+ if (value !== attrs[key]) {
6934
+ attrs[key] = value;
6935
+ hasAttrsChanged = true;
6936
+ }
6937
+ } else {
6938
+ const camelizedKey = camelize(key);
6939
+ props[camelizedKey] = resolvePropValue(
6940
+ options,
6941
+ rawCurrentProps,
6942
+ camelizedKey,
6943
+ value,
6944
+ instance,
6945
+ false
6946
+ /* isAbsent */
6947
+ );
6948
+ }
6949
+ } else {
6950
+ {
6951
+ if (isOn(key) && key.endsWith("Native")) {
6952
+ key = key.slice(0, -6);
6953
+ } else if (shouldSkipAttr(key, instance)) {
6954
+ continue;
6955
+ }
6956
+ }
6957
+ if (value !== attrs[key]) {
6958
+ attrs[key] = value;
6959
+ hasAttrsChanged = true;
6960
+ }
6961
+ }
6819
6962
  }
6820
6963
  }
6821
- });
6822
- }
6823
- function applySingletonAppMutations(app) {
6824
- app._context.mixins = [...singletonApp._context.mixins];
6825
- ["components", "directives", "filters"].forEach((key) => {
6826
- app._context[key] = Object.create(singletonApp._context[key]);
6827
- });
6828
- isCopyingConfig = true;
6829
- for (const key in singletonApp.config) {
6830
- if (key === "isNativeTag")
6831
- continue;
6832
- if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6833
- continue;
6964
+ } else {
6965
+ if (setFullProps(instance, rawProps, props, attrs)) {
6966
+ hasAttrsChanged = true;
6834
6967
  }
6835
- const val = singletonApp.config[key];
6836
- app.config[key] = isObject(val) ? Object.create(val) : val;
6837
- if (key === "ignoredElements" && isCompatEnabled("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6838
- app.config.compilerOptions.isCustomElement = (tag) => {
6839
- return val.some((v) => isString(v) ? v === tag : v.test(tag));
6840
- };
6968
+ let kebabKey;
6969
+ for (const key in rawCurrentProps) {
6970
+ if (!rawProps || // for camelCase
6971
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6972
+ // and converted to camelCase (#955)
6973
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6974
+ if (options) {
6975
+ if (rawPrevProps && // for camelCase
6976
+ (rawPrevProps[key] !== void 0 || // for kebab-case
6977
+ rawPrevProps[kebabKey] !== void 0)) {
6978
+ props[key] = resolvePropValue(
6979
+ options,
6980
+ rawCurrentProps,
6981
+ key,
6982
+ void 0,
6983
+ instance,
6984
+ true
6985
+ /* isAbsent */
6986
+ );
6987
+ }
6988
+ } else {
6989
+ delete props[key];
6990
+ }
6991
+ }
6841
6992
  }
6842
- }
6843
- isCopyingConfig = false;
6844
- applySingletonPrototype(app, singletonCtor);
6845
- }
6846
- function applySingletonPrototype(app, Ctor) {
6847
- const enabled = isCompatEnabled("GLOBAL_PROTOTYPE", null);
6848
- if (enabled) {
6849
- app.config.globalProperties = Object.create(Ctor.prototype);
6850
- }
6851
- let hasPrototypeAugmentations = false;
6852
- const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6853
- for (const key in descriptors) {
6854
- if (key !== "constructor") {
6855
- hasPrototypeAugmentations = true;
6856
- if (enabled) {
6857
- Object.defineProperty(
6858
- app.config.globalProperties,
6859
- key,
6860
- descriptors[key]
6861
- );
6993
+ if (attrs !== rawCurrentProps) {
6994
+ for (const key in attrs) {
6995
+ if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6996
+ delete attrs[key];
6997
+ hasAttrsChanged = true;
6998
+ }
6862
6999
  }
6863
7000
  }
6864
7001
  }
6865
- if (process.env.NODE_ENV !== "production" && hasPrototypeAugmentations) {
6866
- warnDeprecation("GLOBAL_PROTOTYPE", null);
7002
+ if (hasAttrsChanged) {
7003
+ trigger(instance, "set", "$attrs");
7004
+ }
7005
+ if (process.env.NODE_ENV !== "production") {
7006
+ validateProps(rawProps || {}, props, instance);
6867
7007
  }
6868
7008
  }
6869
- function installCompatMount(app, context, render) {
6870
- let isMounted = false;
6871
- app._createRoot = (options) => {
6872
- const component = app._component;
6873
- const vnode = createVNode(component, options.propsData || null);
6874
- vnode.appContext = context;
6875
- const hasNoRender = !isFunction(component) && !component.render && !component.template;
6876
- const emptyRender = () => {
6877
- };
6878
- const instance = createComponentInstance(vnode, null, null);
6879
- if (hasNoRender) {
6880
- instance.render = emptyRender;
6881
- }
6882
- setupComponent(instance);
6883
- vnode.component = instance;
6884
- vnode.isCompatRoot = true;
6885
- instance.ctx._compat_mount = (selectorOrEl) => {
6886
- if (isMounted) {
6887
- process.env.NODE_ENV !== "production" && warn(`Root instance is already mounted.`);
6888
- return;
7009
+ function setFullProps(instance, rawProps, props, attrs) {
7010
+ const [options, needCastKeys] = instance.propsOptions;
7011
+ let hasAttrsChanged = false;
7012
+ let rawCastValues;
7013
+ if (rawProps) {
7014
+ for (let key in rawProps) {
7015
+ if (isReservedProp(key)) {
7016
+ continue;
6889
7017
  }
6890
- let container;
6891
- if (typeof selectorOrEl === "string") {
6892
- const result = document.querySelector(selectorOrEl);
6893
- if (!result) {
6894
- process.env.NODE_ENV !== "production" && warn(
6895
- `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
7018
+ {
7019
+ if (key.startsWith("onHook:")) {
7020
+ softAssertCompatEnabled(
7021
+ "INSTANCE_EVENT_HOOKS",
7022
+ instance,
7023
+ key.slice(2).toLowerCase()
6896
7024
  );
6897
- return;
6898
7025
  }
6899
- container = result;
6900
- } else {
6901
- container = selectorOrEl || document.createElement("div");
6902
- }
6903
- const isSVG = container instanceof SVGElement;
6904
- if (process.env.NODE_ENV !== "production") {
6905
- context.reload = () => {
6906
- const cloned = cloneVNode(vnode);
6907
- cloned.component = null;
6908
- render(cloned, container, isSVG);
6909
- };
6910
- }
6911
- if (hasNoRender && instance.render === emptyRender) {
6912
- if (process.env.NODE_ENV !== "production") {
6913
- for (let i = 0; i < container.attributes.length; i++) {
6914
- const attr = container.attributes[i];
6915
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6916
- warnDeprecation("GLOBAL_MOUNT_CONTAINER", null);
6917
- break;
6918
- }
6919
- }
7026
+ if (key === "inline-template") {
7027
+ continue;
6920
7028
  }
6921
- instance.render = null;
6922
- component.template = container.innerHTML;
6923
- finishComponentSetup(
6924
- instance,
6925
- false,
6926
- true
6927
- /* skip options */
6928
- );
6929
- }
6930
- container.innerHTML = "";
6931
- render(vnode, container, isSVG);
6932
- if (container instanceof Element) {
6933
- container.removeAttribute("v-cloak");
6934
- container.setAttribute("data-v-app", "");
6935
- }
6936
- isMounted = true;
6937
- app._container = container;
6938
- container.__vue_app__ = app;
6939
- if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
6940
- devtoolsInitApp(app, version);
6941
7029
  }
6942
- return instance.proxy;
6943
- };
6944
- instance.ctx._compat_destroy = () => {
6945
- if (isMounted) {
6946
- render(null, app._container);
6947
- if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
6948
- devtoolsUnmountApp(app);
7030
+ const value = rawProps[key];
7031
+ let camelKey;
7032
+ if (options && hasOwn(options, camelKey = camelize(key))) {
7033
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
7034
+ props[camelKey] = value;
7035
+ } else {
7036
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6949
7037
  }
6950
- delete app._container.__vue_app__;
6951
- } else {
6952
- const { bum, scope, um } = instance;
6953
- if (bum) {
6954
- invokeArrayFns(bum);
7038
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
7039
+ {
7040
+ if (isOn(key) && key.endsWith("Native")) {
7041
+ key = key.slice(0, -6);
7042
+ } else if (shouldSkipAttr(key, instance)) {
7043
+ continue;
7044
+ }
6955
7045
  }
6956
- if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6957
- instance.emit("hook:beforeDestroy");
7046
+ if (!(key in attrs) || value !== attrs[key]) {
7047
+ attrs[key] = value;
7048
+ hasAttrsChanged = true;
6958
7049
  }
6959
- if (scope) {
6960
- scope.stop();
6961
- }
6962
- if (um) {
6963
- invokeArrayFns(um);
6964
- }
6965
- if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6966
- instance.emit("hook:destroyed");
7050
+ }
7051
+ }
7052
+ }
7053
+ if (needCastKeys) {
7054
+ const rawCurrentProps = toRaw(props);
7055
+ const castValues = rawCastValues || EMPTY_OBJ;
7056
+ for (let i = 0; i < needCastKeys.length; i++) {
7057
+ const key = needCastKeys[i];
7058
+ props[key] = resolvePropValue(
7059
+ options,
7060
+ rawCurrentProps,
7061
+ key,
7062
+ castValues[key],
7063
+ instance,
7064
+ !hasOwn(castValues, key)
7065
+ );
7066
+ }
7067
+ }
7068
+ return hasAttrsChanged;
7069
+ }
7070
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7071
+ const opt = options[key];
7072
+ if (opt != null) {
7073
+ const hasDefault = hasOwn(opt, "default");
7074
+ if (hasDefault && value === void 0) {
7075
+ const defaultValue = opt.default;
7076
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
7077
+ const { propsDefaults } = instance;
7078
+ if (key in propsDefaults) {
7079
+ value = propsDefaults[key];
7080
+ } else {
7081
+ setCurrentInstance(instance);
7082
+ value = propsDefaults[key] = defaultValue.call(
7083
+ isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7084
+ props
7085
+ );
7086
+ unsetCurrentInstance();
6967
7087
  }
7088
+ } else {
7089
+ value = defaultValue;
6968
7090
  }
6969
- };
6970
- return instance.proxy;
6971
- };
7091
+ }
7092
+ if (opt[0 /* shouldCast */]) {
7093
+ if (isAbsent && !hasDefault) {
7094
+ value = false;
7095
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
7096
+ value = true;
7097
+ }
7098
+ }
7099
+ }
7100
+ return value;
6972
7101
  }
6973
- const methodsToPatch = [
6974
- "push",
6975
- "pop",
6976
- "shift",
6977
- "unshift",
6978
- "splice",
6979
- "sort",
6980
- "reverse"
6981
- ];
6982
- const patched = /* @__PURE__ */ new WeakSet();
6983
- function defineReactive(obj, key, val) {
6984
- if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6985
- const reactiveVal = reactive(val);
6986
- if (isArray(val)) {
6987
- methodsToPatch.forEach((m) => {
6988
- val[m] = (...args) => {
6989
- Array.prototype[m].call(reactiveVal, ...args);
6990
- };
6991
- });
6992
- } else {
6993
- Object.keys(val).forEach((key2) => {
6994
- try {
6995
- defineReactiveSimple(val, key2, val[key2]);
6996
- } catch (e) {
7102
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
7103
+ const cache = appContext.propsCache;
7104
+ const cached = cache.get(comp);
7105
+ if (cached) {
7106
+ return cached;
7107
+ }
7108
+ const raw = comp.props;
7109
+ const normalized = {};
7110
+ const needCastKeys = [];
7111
+ let hasExtends = false;
7112
+ if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
7113
+ const extendProps = (raw2) => {
7114
+ if (isFunction(raw2)) {
7115
+ raw2 = raw2.options;
7116
+ }
7117
+ hasExtends = true;
7118
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
7119
+ extend(normalized, props);
7120
+ if (keys)
7121
+ needCastKeys.push(...keys);
7122
+ };
7123
+ if (!asMixin && appContext.mixins.length) {
7124
+ appContext.mixins.forEach(extendProps);
7125
+ }
7126
+ if (comp.extends) {
7127
+ extendProps(comp.extends);
7128
+ }
7129
+ if (comp.mixins) {
7130
+ comp.mixins.forEach(extendProps);
7131
+ }
7132
+ }
7133
+ if (!raw && !hasExtends) {
7134
+ if (isObject(comp)) {
7135
+ cache.set(comp, EMPTY_ARR);
7136
+ }
7137
+ return EMPTY_ARR;
7138
+ }
7139
+ if (isArray(raw)) {
7140
+ for (let i = 0; i < raw.length; i++) {
7141
+ if (process.env.NODE_ENV !== "production" && !isString(raw[i])) {
7142
+ warn(`props must be strings when using array syntax.`, raw[i]);
7143
+ }
7144
+ const normalizedKey = camelize(raw[i]);
7145
+ if (validatePropName(normalizedKey)) {
7146
+ normalized[normalizedKey] = EMPTY_OBJ;
7147
+ }
7148
+ }
7149
+ } else if (raw) {
7150
+ if (process.env.NODE_ENV !== "production" && !isObject(raw)) {
7151
+ warn(`invalid props options`, raw);
7152
+ }
7153
+ for (const key in raw) {
7154
+ const normalizedKey = camelize(key);
7155
+ if (validatePropName(normalizedKey)) {
7156
+ const opt = raw[key];
7157
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
7158
+ if (prop) {
7159
+ const booleanIndex = getTypeIndex(Boolean, prop.type);
7160
+ const stringIndex = getTypeIndex(String, prop.type);
7161
+ prop[0 /* shouldCast */] = booleanIndex > -1;
7162
+ prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
7163
+ if (booleanIndex > -1 || hasOwn(prop, "default")) {
7164
+ needCastKeys.push(normalizedKey);
7165
+ }
6997
7166
  }
6998
- });
7167
+ }
6999
7168
  }
7000
7169
  }
7001
- const i = obj.$;
7002
- if (i && obj === i.proxy) {
7003
- defineReactiveSimple(i.ctx, key, val);
7004
- i.accessCache = /* @__PURE__ */ Object.create(null);
7005
- } else if (isReactive(obj)) {
7006
- obj[key] = val;
7007
- } else {
7008
- defineReactiveSimple(obj, key, val);
7170
+ const res = [normalized, needCastKeys];
7171
+ if (isObject(comp)) {
7172
+ cache.set(comp, res);
7009
7173
  }
7174
+ return res;
7010
7175
  }
7011
- function defineReactiveSimple(obj, key, val) {
7012
- val = isObject(val) ? reactive(val) : val;
7013
- Object.defineProperty(obj, key, {
7014
- enumerable: true,
7015
- configurable: true,
7016
- get() {
7017
- track(obj, "get", key);
7018
- return val;
7019
- },
7020
- set(newVal) {
7021
- val = isObject(newVal) ? reactive(newVal) : newVal;
7022
- trigger(obj, "set", key, newVal);
7023
- }
7024
- });
7176
+ function validatePropName(key) {
7177
+ if (key[0] !== "$") {
7178
+ return true;
7179
+ } else if (process.env.NODE_ENV !== "production") {
7180
+ warn(`Invalid prop name: "${key}" is a reserved property.`);
7181
+ }
7182
+ return false;
7025
7183
  }
7026
-
7027
- function createAppContext() {
7028
- return {
7029
- app: null,
7030
- config: {
7031
- isNativeTag: NO,
7032
- performance: false,
7033
- globalProperties: {},
7034
- optionMergeStrategies: {},
7035
- errorHandler: void 0,
7036
- warnHandler: void 0,
7037
- compilerOptions: {}
7038
- },
7039
- mixins: [],
7040
- components: {},
7041
- directives: {},
7042
- provides: /* @__PURE__ */ Object.create(null),
7043
- optionsCache: /* @__PURE__ */ new WeakMap(),
7044
- propsCache: /* @__PURE__ */ new WeakMap(),
7045
- emitsCache: /* @__PURE__ */ new WeakMap()
7046
- };
7184
+ function getType(ctor) {
7185
+ const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7186
+ return match ? match[2] : ctor === null ? "null" : "";
7047
7187
  }
7048
- let uid$1 = 0;
7049
- function createAppAPI(render, hydrate) {
7050
- return function createApp(rootComponent, rootProps = null) {
7051
- if (!isFunction(rootComponent)) {
7052
- rootComponent = extend({}, rootComponent);
7188
+ function isSameType(a, b) {
7189
+ return getType(a) === getType(b);
7190
+ }
7191
+ function getTypeIndex(type, expectedTypes) {
7192
+ if (isArray(expectedTypes)) {
7193
+ return expectedTypes.findIndex((t) => isSameType(t, type));
7194
+ } else if (isFunction(expectedTypes)) {
7195
+ return isSameType(expectedTypes, type) ? 0 : -1;
7196
+ }
7197
+ return -1;
7198
+ }
7199
+ function validateProps(rawProps, props, instance) {
7200
+ const resolvedValues = toRaw(props);
7201
+ const options = instance.propsOptions[0];
7202
+ for (const key in options) {
7203
+ let opt = options[key];
7204
+ if (opt == null)
7205
+ continue;
7206
+ validateProp(
7207
+ key,
7208
+ resolvedValues[key],
7209
+ opt,
7210
+ !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
7211
+ );
7212
+ }
7213
+ }
7214
+ function validateProp(name, value, prop, isAbsent) {
7215
+ const { type, required, validator, skipCheck } = prop;
7216
+ if (required && isAbsent) {
7217
+ warn('Missing required prop: "' + name + '"');
7218
+ return;
7219
+ }
7220
+ if (value == null && !required) {
7221
+ return;
7222
+ }
7223
+ if (type != null && type !== true && !skipCheck) {
7224
+ let isValid = false;
7225
+ const types = isArray(type) ? type : [type];
7226
+ const expectedTypes = [];
7227
+ for (let i = 0; i < types.length && !isValid; i++) {
7228
+ const { valid, expectedType } = assertType(value, types[i]);
7229
+ expectedTypes.push(expectedType || "");
7230
+ isValid = valid;
7053
7231
  }
7054
- if (rootProps != null && !isObject(rootProps)) {
7055
- process.env.NODE_ENV !== "production" && warn(`root props passed to app.mount() must be an object.`);
7056
- rootProps = null;
7232
+ if (!isValid) {
7233
+ warn(getInvalidTypeMessage(name, value, expectedTypes));
7234
+ return;
7057
7235
  }
7058
- const context = createAppContext();
7059
- const installedPlugins = /* @__PURE__ */ new Set();
7060
- let isMounted = false;
7061
- const app = context.app = {
7062
- _uid: uid$1++,
7063
- _component: rootComponent,
7064
- _props: rootProps,
7065
- _container: null,
7066
- _context: context,
7067
- _instance: null,
7068
- version,
7069
- get config() {
7070
- return context.config;
7071
- },
7072
- set config(v) {
7073
- if (process.env.NODE_ENV !== "production") {
7074
- warn(
7075
- `app.config cannot be replaced. Modify individual options instead.`
7076
- );
7077
- }
7078
- },
7079
- use(plugin, ...options) {
7080
- if (installedPlugins.has(plugin)) {
7081
- process.env.NODE_ENV !== "production" && warn(`Plugin has already been applied to target app.`);
7082
- } else if (plugin && isFunction(plugin.install)) {
7083
- installedPlugins.add(plugin);
7084
- plugin.install(app, ...options);
7085
- } else if (isFunction(plugin)) {
7086
- installedPlugins.add(plugin);
7087
- plugin(app, ...options);
7088
- } else if (process.env.NODE_ENV !== "production") {
7089
- warn(
7090
- `A plugin must either be a function or an object with an "install" function.`
7091
- );
7092
- }
7093
- return app;
7094
- },
7095
- mixin(mixin) {
7096
- if (__VUE_OPTIONS_API__) {
7097
- if (!context.mixins.includes(mixin)) {
7098
- context.mixins.push(mixin);
7099
- } else if (process.env.NODE_ENV !== "production") {
7100
- warn(
7101
- "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
7102
- );
7103
- }
7104
- } else if (process.env.NODE_ENV !== "production") {
7105
- warn("Mixins are only available in builds supporting Options API");
7106
- }
7107
- return app;
7108
- },
7109
- component(name, component) {
7110
- if (process.env.NODE_ENV !== "production") {
7111
- validateComponentName(name, context.config);
7112
- }
7113
- if (!component) {
7114
- return context.components[name];
7115
- }
7116
- if (process.env.NODE_ENV !== "production" && context.components[name]) {
7117
- warn(`Component "${name}" has already been registered in target app.`);
7118
- }
7119
- context.components[name] = component;
7120
- return app;
7121
- },
7122
- directive(name, directive) {
7123
- if (process.env.NODE_ENV !== "production") {
7124
- validateDirectiveName(name);
7125
- }
7126
- if (!directive) {
7127
- return context.directives[name];
7128
- }
7129
- if (process.env.NODE_ENV !== "production" && context.directives[name]) {
7130
- warn(`Directive "${name}" has already been registered in target app.`);
7131
- }
7132
- context.directives[name] = directive;
7133
- return app;
7134
- },
7135
- mount(rootContainer, isHydrate, isSVG) {
7136
- if (!isMounted) {
7137
- if (process.env.NODE_ENV !== "production" && rootContainer.__vue_app__) {
7138
- warn(
7139
- `There is already an app instance mounted on the host container.
7140
- If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7141
- );
7142
- }
7143
- const vnode = createVNode(
7144
- rootComponent,
7145
- rootProps
7146
- );
7147
- vnode.appContext = context;
7148
- if (process.env.NODE_ENV !== "production") {
7149
- context.reload = () => {
7150
- render(cloneVNode(vnode), rootContainer, isSVG);
7151
- };
7152
- }
7153
- if (isHydrate && hydrate) {
7154
- hydrate(vnode, rootContainer);
7155
- } else {
7156
- render(vnode, rootContainer, isSVG);
7157
- }
7158
- isMounted = true;
7159
- app._container = rootContainer;
7160
- rootContainer.__vue_app__ = app;
7161
- if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
7162
- app._instance = vnode.component;
7163
- devtoolsInitApp(app, version);
7164
- }
7165
- return getExposeProxy(vnode.component) || vnode.component.proxy;
7166
- } else if (process.env.NODE_ENV !== "production") {
7167
- warn(
7168
- `App has already been mounted.
7169
- If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\``
7170
- );
7171
- }
7172
- },
7173
- unmount() {
7174
- if (isMounted) {
7175
- render(null, app._container);
7176
- if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
7177
- app._instance = null;
7178
- devtoolsUnmountApp(app);
7179
- }
7180
- delete app._container.__vue_app__;
7181
- } else if (process.env.NODE_ENV !== "production") {
7182
- warn(`Cannot unmount an app that is not mounted.`);
7183
- }
7184
- },
7185
- provide(key, value) {
7186
- if (process.env.NODE_ENV !== "production" && key in context.provides) {
7187
- warn(
7188
- `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
7189
- );
7236
+ }
7237
+ if (validator && !validator(value)) {
7238
+ warn('Invalid prop: custom validator check failed for prop "' + name + '".');
7239
+ }
7240
+ }
7241
+ const isSimpleType = /* @__PURE__ */ makeMap(
7242
+ "String,Number,Boolean,Function,Symbol,BigInt"
7243
+ );
7244
+ function assertType(value, type) {
7245
+ let valid;
7246
+ const expectedType = getType(type);
7247
+ if (isSimpleType(expectedType)) {
7248
+ const t = typeof value;
7249
+ valid = t === expectedType.toLowerCase();
7250
+ if (!valid && t === "object") {
7251
+ valid = value instanceof type;
7252
+ }
7253
+ } else if (expectedType === "Object") {
7254
+ valid = isObject(value);
7255
+ } else if (expectedType === "Array") {
7256
+ valid = isArray(value);
7257
+ } else if (expectedType === "null") {
7258
+ valid = value === null;
7259
+ } else {
7260
+ valid = value instanceof type;
7261
+ }
7262
+ return {
7263
+ valid,
7264
+ expectedType
7265
+ };
7266
+ }
7267
+ function getInvalidTypeMessage(name, value, expectedTypes) {
7268
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7269
+ const expectedType = expectedTypes[0];
7270
+ const receivedType = toRawType(value);
7271
+ const expectedValue = styleValue(value, expectedType);
7272
+ const receivedValue = styleValue(value, receivedType);
7273
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
7274
+ message += ` with value ${expectedValue}`;
7275
+ }
7276
+ message += `, got ${receivedType} `;
7277
+ if (isExplicable(receivedType)) {
7278
+ message += `with value ${receivedValue}.`;
7279
+ }
7280
+ return message;
7281
+ }
7282
+ function styleValue(value, type) {
7283
+ if (type === "String") {
7284
+ return `"${value}"`;
7285
+ } else if (type === "Number") {
7286
+ return `${Number(value)}`;
7287
+ } else {
7288
+ return `${value}`;
7289
+ }
7290
+ }
7291
+ function isExplicable(type) {
7292
+ const explicitTypes = ["string", "number", "boolean"];
7293
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
7294
+ }
7295
+ function isBoolean(...args) {
7296
+ return args.some((elem) => elem.toLowerCase() === "boolean");
7297
+ }
7298
+
7299
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
7300
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
7301
+ const normalizeSlot = (key, rawSlot, ctx) => {
7302
+ if (rawSlot._n) {
7303
+ return rawSlot;
7304
+ }
7305
+ const normalized = withCtx((...args) => {
7306
+ if (process.env.NODE_ENV !== "production" && currentInstance) {
7307
+ warn(
7308
+ `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
7309
+ );
7310
+ }
7311
+ return normalizeSlotValue(rawSlot(...args));
7312
+ }, ctx);
7313
+ normalized._c = false;
7314
+ return normalized;
7315
+ };
7316
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
7317
+ const ctx = rawSlots._ctx;
7318
+ for (const key in rawSlots) {
7319
+ if (isInternalKey(key))
7320
+ continue;
7321
+ const value = rawSlots[key];
7322
+ if (isFunction(value)) {
7323
+ slots[key] = normalizeSlot(key, value, ctx);
7324
+ } else if (value != null) {
7325
+ if (process.env.NODE_ENV !== "production" && !isCompatEnabled("RENDER_FUNCTION", instance)) {
7326
+ warn(
7327
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
7328
+ );
7329
+ }
7330
+ const normalized = normalizeSlotValue(value);
7331
+ slots[key] = () => normalized;
7332
+ }
7333
+ }
7334
+ };
7335
+ const normalizeVNodeSlots = (instance, children) => {
7336
+ if (process.env.NODE_ENV !== "production" && !isKeepAlive(instance.vnode) && !isCompatEnabled("RENDER_FUNCTION", instance)) {
7337
+ warn(
7338
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
7339
+ );
7340
+ }
7341
+ const normalized = normalizeSlotValue(children);
7342
+ instance.slots.default = () => normalized;
7343
+ };
7344
+ const initSlots = (instance, children) => {
7345
+ if (instance.vnode.shapeFlag & 32) {
7346
+ const type = children._;
7347
+ if (type) {
7348
+ instance.slots = toRaw(children);
7349
+ def(children, "_", type);
7350
+ } else {
7351
+ normalizeObjectSlots(
7352
+ children,
7353
+ instance.slots = {},
7354
+ instance
7355
+ );
7356
+ }
7357
+ } else {
7358
+ instance.slots = {};
7359
+ if (children) {
7360
+ normalizeVNodeSlots(instance, children);
7361
+ }
7362
+ }
7363
+ def(instance.slots, InternalObjectKey, 1);
7364
+ };
7365
+ const updateSlots = (instance, children, optimized) => {
7366
+ const { vnode, slots } = instance;
7367
+ let needDeletionCheck = true;
7368
+ let deletionComparisonTarget = EMPTY_OBJ;
7369
+ if (vnode.shapeFlag & 32) {
7370
+ const type = children._;
7371
+ if (type) {
7372
+ if (process.env.NODE_ENV !== "production" && isHmrUpdating) {
7373
+ extend(slots, children);
7374
+ trigger(instance, "set", "$slots");
7375
+ } else if (optimized && type === 1) {
7376
+ needDeletionCheck = false;
7377
+ } else {
7378
+ extend(slots, children);
7379
+ if (!optimized && type === 1) {
7380
+ delete slots._;
7190
7381
  }
7191
- context.provides[key] = value;
7192
- return app;
7193
7382
  }
7194
- };
7195
- {
7196
- installAppCompatProperties(app, context, render);
7383
+ } else {
7384
+ needDeletionCheck = !children.$stable;
7385
+ normalizeObjectSlots(children, slots, instance);
7197
7386
  }
7198
- return app;
7199
- };
7200
- }
7387
+ deletionComparisonTarget = children;
7388
+ } else if (children) {
7389
+ normalizeVNodeSlots(instance, children);
7390
+ deletionComparisonTarget = { default: 1 };
7391
+ }
7392
+ if (needDeletionCheck) {
7393
+ for (const key in slots) {
7394
+ if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7395
+ delete slots[key];
7396
+ }
7397
+ }
7398
+ }
7399
+ };
7201
7400
 
7202
7401
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7203
7402
  if (isArray(rawRef)) {
@@ -8124,7 +8323,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8124
8323
  areChildrenSVG,
8125
8324
  slotScopeIds
8126
8325
  );
8127
- if (process.env.NODE_ENV !== "production" && parentComponent && parentComponent.type.__hmrId) {
8326
+ if (process.env.NODE_ENV !== "production") {
8128
8327
  traverseStaticChildren(n1, n2);
8129
8328
  }
8130
8329
  } else if (!optimized) {
@@ -8318,7 +8517,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8318
8517
  isSVG,
8319
8518
  slotScopeIds
8320
8519
  );
8321
- if (process.env.NODE_ENV !== "production" && parentComponent && parentComponent.type.__hmrId) {
8520
+ if (process.env.NODE_ENV !== "production") {
8322
8521
  traverseStaticChildren(n1, n2);
8323
8522
  } else if (
8324
8523
  // #2080 if the stable fragment has a key, it's a <template v-for> that may
@@ -10001,6 +10200,8 @@ function createComponentInstance(vnode, parent, suspense) {
10001
10200
  refs: EMPTY_OBJ,
10002
10201
  setupState: EMPTY_OBJ,
10003
10202
  setupContext: null,
10203
+ attrsProxy: null,
10204
+ slotsProxy: null,
10004
10205
  // suspense related
10005
10206
  suspense,
10006
10207
  suspenseId: suspense ? suspense.pendingId : 0,
@@ -10254,8 +10455,8 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10254
10455
  }
10255
10456
  }
10256
10457
  }
10257
- function createAttrsProxy(instance) {
10258
- return new Proxy(
10458
+ function getAttrsProxy(instance) {
10459
+ return instance.attrsProxy || (instance.attrsProxy = new Proxy(
10259
10460
  instance.attrs,
10260
10461
  process.env.NODE_ENV !== "production" ? {
10261
10462
  get(target, key) {
@@ -10277,7 +10478,23 @@ function createAttrsProxy(instance) {
10277
10478
  return target[key];
10278
10479
  }
10279
10480
  }
10280
- );
10481
+ ));
10482
+ }
10483
+ function getSlotsProxy(instance) {
10484
+ return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
10485
+ get(target, key) {
10486
+ track(instance, "get", "$slots");
10487
+ return target[key];
10488
+ },
10489
+ set() {
10490
+ warn(`setupContext.slots is readonly.`);
10491
+ return false;
10492
+ },
10493
+ deleteProperty() {
10494
+ warn(`setupContext.slots is readonly.`);
10495
+ return false;
10496
+ }
10497
+ }));
10281
10498
  }
10282
10499
  function createSetupContext(instance) {
10283
10500
  const expose = (exposed) => {
@@ -10303,14 +10520,13 @@ function createSetupContext(instance) {
10303
10520
  }
10304
10521
  instance.exposed = exposed || {};
10305
10522
  };
10306
- let attrs;
10307
10523
  if (process.env.NODE_ENV !== "production") {
10308
10524
  return Object.freeze({
10309
10525
  get attrs() {
10310
- return attrs || (attrs = createAttrsProxy(instance));
10526
+ return getAttrsProxy(instance);
10311
10527
  },
10312
10528
  get slots() {
10313
- return shallowReadonly(instance.slots);
10529
+ return getSlotsProxy(instance);
10314
10530
  },
10315
10531
  get emit() {
10316
10532
  return (event, ...args) => instance.emit(event, ...args);
@@ -10320,7 +10536,7 @@ function createSetupContext(instance) {
10320
10536
  } else {
10321
10537
  return {
10322
10538
  get attrs() {
10323
- return attrs || (attrs = createAttrsProxy(instance));
10539
+ return getAttrsProxy(instance);
10324
10540
  },
10325
10541
  slots: instance.slots,
10326
10542
  emit: instance.emit,
@@ -10379,111 +10595,6 @@ const computed = (getterOrOptions, debugOptions) => {
10379
10595
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10380
10596
  };
10381
10597
 
10382
- const warnRuntimeUsage = (method) => warn(
10383
- `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
10384
- );
10385
- function defineProps() {
10386
- if (process.env.NODE_ENV !== "production") {
10387
- warnRuntimeUsage(`defineProps`);
10388
- }
10389
- return null;
10390
- }
10391
- function defineEmits() {
10392
- if (process.env.NODE_ENV !== "production") {
10393
- warnRuntimeUsage(`defineEmits`);
10394
- }
10395
- return null;
10396
- }
10397
- function defineExpose(exposed) {
10398
- if (process.env.NODE_ENV !== "production") {
10399
- warnRuntimeUsage(`defineExpose`);
10400
- }
10401
- }
10402
- function defineOptions(options) {
10403
- if (process.env.NODE_ENV !== "production") {
10404
- warnRuntimeUsage(`defineOptions`);
10405
- }
10406
- }
10407
- function defineSlots() {
10408
- if (process.env.NODE_ENV !== "production") {
10409
- warnRuntimeUsage(`defineSlots`);
10410
- }
10411
- }
10412
- function withDefaults(props, defaults) {
10413
- if (process.env.NODE_ENV !== "production") {
10414
- warnRuntimeUsage(`withDefaults`);
10415
- }
10416
- return null;
10417
- }
10418
- function useSlots() {
10419
- return getContext().slots;
10420
- }
10421
- function useAttrs() {
10422
- return getContext().attrs;
10423
- }
10424
- function getContext() {
10425
- const i = getCurrentInstance();
10426
- if (process.env.NODE_ENV !== "production" && !i) {
10427
- warn(`useContext() called without active instance.`);
10428
- }
10429
- return i.setupContext || (i.setupContext = createSetupContext(i));
10430
- }
10431
- function mergeDefaults(raw, defaults) {
10432
- const props = isArray(raw) ? raw.reduce(
10433
- (normalized, p) => (normalized[p] = {}, normalized),
10434
- {}
10435
- ) : raw;
10436
- for (const key in defaults) {
10437
- if (key.startsWith("__skip"))
10438
- continue;
10439
- let opt = props[key];
10440
- if (opt) {
10441
- if (isArray(opt) || isFunction(opt)) {
10442
- opt = props[key] = { type: opt, default: defaults[key] };
10443
- } else {
10444
- opt.default = defaults[key];
10445
- }
10446
- } else if (opt === null) {
10447
- opt = props[key] = { default: defaults[key] };
10448
- } else if (process.env.NODE_ENV !== "production") {
10449
- warn(`props default key "${key}" has no corresponding declaration.`);
10450
- }
10451
- if (opt && defaults[`__skip_${key}`]) {
10452
- opt.skipFactory = true;
10453
- }
10454
- }
10455
- return props;
10456
- }
10457
- function createPropsRestProxy(props, excludedKeys) {
10458
- const ret = {};
10459
- for (const key in props) {
10460
- if (!excludedKeys.includes(key)) {
10461
- Object.defineProperty(ret, key, {
10462
- enumerable: true,
10463
- get: () => props[key]
10464
- });
10465
- }
10466
- }
10467
- return ret;
10468
- }
10469
- function withAsyncContext(getAwaitable) {
10470
- const ctx = getCurrentInstance();
10471
- if (process.env.NODE_ENV !== "production" && !ctx) {
10472
- warn(
10473
- `withAsyncContext called without active current instance. This is likely a bug.`
10474
- );
10475
- }
10476
- let awaitable = getAwaitable();
10477
- unsetCurrentInstance();
10478
- if (isPromise(awaitable)) {
10479
- awaitable = awaitable.catch((e) => {
10480
- setCurrentInstance(ctx);
10481
- throw e;
10482
- });
10483
- }
10484
- return [awaitable, () => setCurrentInstance(ctx)];
10485
- }
10486
-
10487
10598
  function h(type, propsOrChildren, children) {
10488
10599
  const l = arguments.length;
10489
10600
  if (l === 2) {
@@ -10719,7 +10830,7 @@ function isMemoSame(cached, memo) {
10719
10830
  return true;
10720
10831
  }
10721
10832
 
10722
- const version = "3.3.0-alpha.8";
10833
+ const version = "3.3.0-beta.1";
10723
10834
  const _ssrUtils = {
10724
10835
  createComponentInstance,
10725
10836
  setupComponent,
@@ -12431,6 +12542,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12431
12542
  defineCustomElement: defineCustomElement,
12432
12543
  defineEmits: defineEmits,
12433
12544
  defineExpose: defineExpose,
12545
+ defineModel: defineModel,
12434
12546
  defineOptions: defineOptions,
12435
12547
  defineProps: defineProps,
12436
12548
  defineSSRCustomElement: defineSSRCustomElement,
@@ -12444,6 +12556,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12444
12556
  guardReactiveProps: guardReactiveProps,
12445
12557
  h: h,
12446
12558
  handleError: handleError,
12559
+ hasInjectionContext: hasInjectionContext,
12447
12560
  hydrate: hydrate,
12448
12561
  initCustomFormatter: initCustomFormatter,
12449
12562
  initDirectivesForSSR: initDirectivesForSSR,
@@ -12458,6 +12571,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12458
12571
  isVNode: isVNode,
12459
12572
  markRaw: markRaw,
12460
12573
  mergeDefaults: mergeDefaults,
12574
+ mergeModels: mergeModels,
12461
12575
  mergeProps: mergeProps,
12462
12576
  nextTick: nextTick,
12463
12577
  normalizeClass: normalizeClass,
@@ -12516,6 +12630,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12516
12630
  useAttrs: useAttrs,
12517
12631
  useCssModule: useCssModule,
12518
12632
  useCssVars: useCssVars,
12633
+ useModel: useModel,
12519
12634
  useSSRContext: useSSRContext,
12520
12635
  useSlots: useSlots,
12521
12636
  useTransitionState: useTransitionState,
@@ -12580,4 +12695,4 @@ var Vue$1 = Vue;
12580
12695
 
12581
12696
  const { configureCompat } = Vue$1;
12582
12697
 
12583
- export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
12698
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };