superdoc 0.34.6-RC1 → 0.34.7

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.
Files changed (45) hide show
  1. package/dist/chunks/{PdfViewer-Cdq6hWaP.cjs → PdfViewer-C8xLNe_n.cjs} +2 -2
  2. package/dist/chunks/{PdfViewer-Yy390Dyv.es.js → PdfViewer-WfRCZj-e.es.js} +2 -2
  3. package/dist/chunks/{eventemitter3-CFCpOk3d.cjs → eventemitter3-DmHNHvFX.cjs} +1 -1
  4. package/dist/chunks/{eventemitter3-BZXKb7j7.es.js → eventemitter3-hYlnBzSA.es.js} +1 -1
  5. package/dist/chunks/{index-_8cQcYzu-Dj8Emsl2.es.js → index-BENzx4z6-DdFuGCwa.es.js} +1 -1
  6. package/dist/chunks/{index-_8cQcYzu-CB4RkW2W.cjs → index-BENzx4z6-Ds8akndA.cjs} +1 -1
  7. package/dist/chunks/{index-QkGtTLUE.cjs → index-CIQILa8l.cjs} +7 -12
  8. package/dist/chunks/{index-M9d0bJ9k.es.js → index-wZJgMVEg.es.js} +7 -12
  9. package/dist/chunks/{jszip-B99MTu59.cjs → jszip-BP2FTbpi.cjs} +1 -1
  10. package/dist/chunks/{jszip-Duxs2YMV.es.js → jszip-jKrsZoMS.es.js} +1 -1
  11. package/dist/chunks/{super-editor.es-kNY6AOSu.es.js → super-editor.es-B21z_KOS.es.js} +626 -727
  12. package/dist/chunks/{super-editor.es-C-hpEM8j.cjs → super-editor.es-BVJ4WHrZ.cjs} +673 -774
  13. package/dist/chunks/{vue-B5QAf5pA.es.js → vue-CKmzTNVs.es.js} +1379 -1420
  14. package/dist/chunks/{vue-ARQSyfaw.cjs → vue-Cwv-wUpm.cjs} +1379 -1420
  15. package/dist/chunks/xml-js-BSDu25I7.cjs +3 -0
  16. package/dist/chunks/xml-js-CBrRls0f.es.js +2 -0
  17. package/dist/packages/superdoc/src/components/CommentsLayer/use-comment.d.ts.map +1 -1
  18. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  19. package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
  20. package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -1
  21. package/dist/super-editor/ai-writer.es.js +2 -2
  22. package/dist/super-editor/chunks/{converter-Ddl2ZmKy.js → converter-BItdKEMN.js} +301 -394
  23. package/dist/super-editor/chunks/{docx-zipper-D1BgiAWm.js → docx-zipper-Brh1H7kE.js} +1 -1
  24. package/dist/super-editor/chunks/{editor-B2T2u3JG.js → editor-BwXcd5wT.js} +59 -67
  25. package/dist/super-editor/chunks/{index-_8cQcYzu.js → index-BENzx4z6.js} +1 -1
  26. package/dist/super-editor/chunks/{toolbar-hyRTdNjv.js → toolbar-CiQKWEEf.js} +2 -2
  27. package/dist/super-editor/converter.es.js +1 -1
  28. package/dist/super-editor/docx-zipper.es.js +2 -2
  29. package/dist/super-editor/editor.es.js +3 -3
  30. package/dist/super-editor/file-zipper.es.js +1 -1
  31. package/dist/super-editor/super-editor/src/core/super-converter/v2/exporter/commentsExporter.d.ts.map +1 -1
  32. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/r/r-translator.d.ts.map +1 -1
  33. package/dist/super-editor/super-editor/src/extensions/collaboration/collaboration-helpers.d.ts.map +1 -1
  34. package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts.map +1 -1
  35. package/dist/super-editor/super-editor.es.js +6 -6
  36. package/dist/super-editor/toolbar.es.js +2 -2
  37. package/dist/super-editor.cjs +2 -2
  38. package/dist/super-editor.es.js +2 -2
  39. package/dist/superdoc.cjs +2 -2
  40. package/dist/superdoc.es.js +2 -2
  41. package/dist/superdoc.umd.js +975 -1121
  42. package/dist/superdoc.umd.js.map +1 -1
  43. package/package.json +1 -1
  44. package/dist/chunks/xml-js-CVyfrKaV.es.js +0 -2
  45. package/dist/chunks/xml-js-DQa4Ye5C.cjs +0 -3
@@ -163,7 +163,7 @@ process.umask = function() {
163
163
  var browserExports = browser.exports;
164
164
  const process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
165
165
  /**
166
- * @vue/shared v3.5.25
166
+ * @vue/shared v3.5.24
167
167
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
168
168
  * @license MIT
169
169
  **/
@@ -1028,16 +1028,10 @@ function shallowReadArray(arr) {
1028
1028
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
1029
1029
  return arr;
1030
1030
  }
1031
- function toWrapped(target, item) {
1032
- if (isReadonly(target)) {
1033
- return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
1034
- }
1035
- return toReactive(item);
1036
- }
1037
1031
  const arrayInstrumentations = {
1038
1032
  __proto__: null,
1039
1033
  [Symbol.iterator]() {
1040
- return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
1034
+ return iterator(this, Symbol.iterator, toReactive);
1041
1035
  },
1042
1036
  concat(...args) {
1043
1037
  return reactiveReadArray(this).concat(
@@ -1046,7 +1040,7 @@ const arrayInstrumentations = {
1046
1040
  },
1047
1041
  entries() {
1048
1042
  return iterator(this, "entries", (value) => {
1049
- value[1] = toWrapped(this, value[1]);
1043
+ value[1] = toReactive(value[1]);
1050
1044
  return value;
1051
1045
  });
1052
1046
  },
@@ -1054,37 +1048,16 @@ const arrayInstrumentations = {
1054
1048
  return apply(this, "every", fn, thisArg, void 0, arguments);
1055
1049
  },
1056
1050
  filter(fn, thisArg) {
1057
- return apply(
1058
- this,
1059
- "filter",
1060
- fn,
1061
- thisArg,
1062
- (v) => v.map((item) => toWrapped(this, item)),
1063
- arguments
1064
- );
1051
+ return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
1065
1052
  },
1066
1053
  find(fn, thisArg) {
1067
- return apply(
1068
- this,
1069
- "find",
1070
- fn,
1071
- thisArg,
1072
- (item) => toWrapped(this, item),
1073
- arguments
1074
- );
1054
+ return apply(this, "find", fn, thisArg, toReactive, arguments);
1075
1055
  },
1076
1056
  findIndex(fn, thisArg) {
1077
1057
  return apply(this, "findIndex", fn, thisArg, void 0, arguments);
1078
1058
  },
1079
1059
  findLast(fn, thisArg) {
1080
- return apply(
1081
- this,
1082
- "findLast",
1083
- fn,
1084
- thisArg,
1085
- (item) => toWrapped(this, item),
1086
- arguments
1087
- );
1060
+ return apply(this, "findLast", fn, thisArg, toReactive, arguments);
1088
1061
  },
1089
1062
  findLastIndex(fn, thisArg) {
1090
1063
  return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
@@ -1144,7 +1117,7 @@ const arrayInstrumentations = {
1144
1117
  return noTracking(this, "unshift", args);
1145
1118
  },
1146
1119
  values() {
1147
- return iterator(this, "values", (item) => toWrapped(this, item));
1120
+ return iterator(this, "values", toReactive);
1148
1121
  }
1149
1122
  };
1150
1123
  function iterator(self2, method, wrapValue) {
@@ -1175,7 +1148,7 @@ function apply(self2, method, fn, thisArg, wrappedRetFn, args) {
1175
1148
  if (arr !== self2) {
1176
1149
  if (needsWrap) {
1177
1150
  wrappedFn = function(item, index) {
1178
- return fn.call(this, toWrapped(self2, item), index, self2);
1151
+ return fn.call(this, toReactive(item), index, self2);
1179
1152
  };
1180
1153
  } else if (fn.length > 2) {
1181
1154
  wrappedFn = function(item, index) {
@@ -1192,7 +1165,7 @@ function reduce(self2, method, fn, args) {
1192
1165
  if (arr !== self2) {
1193
1166
  if (!isShallow(self2)) {
1194
1167
  wrappedFn = function(acc, item, index) {
1195
- return fn.call(this, acc, toWrapped(self2, item), index, self2);
1168
+ return fn.call(this, acc, toReactive(item), index, self2);
1196
1169
  };
1197
1170
  } else if (fn.length > 3) {
1198
1171
  wrappedFn = function(acc, item, index) {
@@ -1295,14 +1268,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1295
1268
  }
1296
1269
  set(target, key, value, receiver) {
1297
1270
  let oldValue = target[key];
1298
- const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);
1299
1271
  if (!this._isShallow) {
1300
1272
  const isOldValueReadonly = isReadonly(oldValue);
1301
1273
  if (!isShallow(value) && !isReadonly(value)) {
1302
1274
  oldValue = toRaw(oldValue);
1303
1275
  value = toRaw(value);
1304
1276
  }
1305
- if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
1277
+ if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1306
1278
  if (isOldValueReadonly) {
1307
1279
  if (!!(process$1.env.NODE_ENV !== "production")) {
1308
1280
  warn$2(
@@ -1317,7 +1289,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1317
1289
  }
1318
1290
  }
1319
1291
  }
1320
- const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
1292
+ const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1321
1293
  const result = Reflect.set(
1322
1294
  target,
1323
1295
  key,
@@ -1814,35 +1786,16 @@ class ObjectRefImpl {
1814
1786
  this._defaultValue = _defaultValue;
1815
1787
  this["__v_isRef"] = true;
1816
1788
  this._value = void 0;
1817
- this._raw = toRaw(_object);
1818
- let shallow = true;
1819
- let obj = _object;
1820
- if (!isArray(_object) || !isIntegerKey(String(_key))) {
1821
- do {
1822
- shallow = !isProxy(obj) || isShallow(obj);
1823
- } while (shallow && (obj = obj["__v_raw"]));
1824
- }
1825
- this._shallow = shallow;
1826
1789
  }
1827
1790
  get value() {
1828
- let val = this._object[this._key];
1829
- if (this._shallow) {
1830
- val = unref(val);
1831
- }
1791
+ const val = this._object[this._key];
1832
1792
  return this._value = val === void 0 ? this._defaultValue : val;
1833
1793
  }
1834
1794
  set value(newVal) {
1835
- if (this._shallow && isRef(this._raw[this._key])) {
1836
- const nestedRef = this._object[this._key];
1837
- if (isRef(nestedRef)) {
1838
- nestedRef.value = newVal;
1839
- return;
1840
- }
1841
- }
1842
1795
  this._object[this._key] = newVal;
1843
1796
  }
1844
1797
  get dep() {
1845
- return getDepFromReactive(this._raw, this._key);
1798
+ return getDepFromReactive(toRaw(this._object), this._key);
1846
1799
  }
1847
1800
  }
1848
1801
  class GetterRefImpl {
@@ -1868,7 +1821,8 @@ function toRef(source, key, defaultValue) {
1868
1821
  }
1869
1822
  }
1870
1823
  function propertyToRef(source, key, defaultValue) {
1871
- return new ObjectRefImpl(source, key, defaultValue);
1824
+ const val = source[key];
1825
+ return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1872
1826
  }
1873
1827
  class ComputedRefImpl {
1874
1828
  constructor(fn, setter, isSSR) {
@@ -4194,6 +4148,7 @@ const PublicInstanceProxyHandlers = {
4194
4148
  if (!!(process$1.env.NODE_ENV !== "production") && key === "__isVue") {
4195
4149
  return true;
4196
4150
  }
4151
+ let normalizedProps;
4197
4152
  if (key[0] !== "$") {
4198
4153
  const n = accessCache[key];
4199
4154
  if (n !== void 0) {
@@ -4213,7 +4168,11 @@ const PublicInstanceProxyHandlers = {
4213
4168
  } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
4214
4169
  accessCache[key] = 2;
4215
4170
  return data[key];
4216
- } else if (hasOwn(props, key)) {
4171
+ } else if (
4172
+ // only cache other properties when instance has declared (thus stable)
4173
+ // props
4174
+ (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
4175
+ ) {
4217
4176
  accessCache[key] = 3;
4218
4177
  return props[key];
4219
4178
  } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
@@ -4298,10 +4257,10 @@ const PublicInstanceProxyHandlers = {
4298
4257
  return true;
4299
4258
  },
4300
4259
  has({
4301
- _: { data, setupState, accessCache, ctx, appContext, props, type }
4260
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
4302
4261
  }, key) {
4303
- let cssModules;
4304
- return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || hasOwn(props, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
4262
+ let normalizedProps, cssModules;
4263
+ return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
4305
4264
  },
4306
4265
  defineProperty(target, key, descriptor) {
4307
4266
  if (descriptor.get != null) {
@@ -5001,12 +4960,11 @@ If you want to remount the same app, move your app creation logic into a factory
5001
4960
  }
5002
4961
  let currentApp = null;
5003
4962
  function provide(key, value) {
5004
- if (!!(process$1.env.NODE_ENV !== "production")) {
5005
- if (!currentInstance || currentInstance.isMounted) {
4963
+ if (!currentInstance) {
4964
+ if (!!(process$1.env.NODE_ENV !== "production")) {
5006
4965
  warn$1(`provide() can only be used inside setup().`);
5007
4966
  }
5008
- }
5009
- if (currentInstance) {
4967
+ } else {
5010
4968
  let provides = currentInstance.provides;
5011
4969
  const parentProvides = currentInstance.parent && currentInstance.parent.provides;
5012
4970
  if (parentProvides === provides) {
@@ -5033,1138 +4991,587 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
5033
4991
  function hasInjectionContext() {
5034
4992
  return !!(getCurrentInstance() || currentApp);
5035
4993
  }
5036
- const ssrContextKey = Symbol.for("v-scx");
5037
- const useSSRContext = () => {
5038
- {
5039
- const ctx = inject(ssrContextKey);
5040
- if (!ctx) {
5041
- !!(process$1.env.NODE_ENV !== "production") && warn$1(
5042
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
5043
- );
5044
- }
5045
- return ctx;
5046
- }
5047
- };
5048
- function watchEffect(effect2, options) {
5049
- return doWatch(effect2, null, options);
5050
- }
5051
- function watch(source, cb, options) {
5052
- if (!!(process$1.env.NODE_ENV !== "production") && !isFunction(cb)) {
5053
- warn$1(
5054
- `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
5055
- );
5056
- }
5057
- return doWatch(source, cb, options);
5058
- }
5059
- function doWatch(source, cb, options = EMPTY_OBJ) {
5060
- const { immediate, deep, flush, once } = options;
5061
- if (!!(process$1.env.NODE_ENV !== "production") && !cb) {
5062
- if (immediate !== void 0) {
5063
- warn$1(
5064
- `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
5065
- );
5066
- }
5067
- if (deep !== void 0) {
5068
- warn$1(
5069
- `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
5070
- );
5071
- }
5072
- if (once !== void 0) {
5073
- warn$1(
5074
- `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
5075
- );
5076
- }
5077
- }
5078
- const baseWatchOptions = extend({}, options);
5079
- if (!!(process$1.env.NODE_ENV !== "production")) baseWatchOptions.onWarn = warn$1;
5080
- const runsImmediately = cb && immediate || !cb && flush !== "post";
5081
- let ssrCleanup;
5082
- if (isInSSRComponentSetup) {
5083
- if (flush === "sync") {
5084
- const ctx = useSSRContext();
5085
- ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
5086
- } else if (!runsImmediately) {
5087
- const watchStopHandle = () => {
5088
- };
5089
- watchStopHandle.stop = NOOP;
5090
- watchStopHandle.resume = NOOP;
5091
- watchStopHandle.pause = NOOP;
5092
- return watchStopHandle;
4994
+ const internalObjectProto = {};
4995
+ const createInternalObject = () => Object.create(internalObjectProto);
4996
+ const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
4997
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
4998
+ const props = {};
4999
+ const attrs = createInternalObject();
5000
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5001
+ setFullProps(instance, rawProps, props, attrs);
5002
+ for (const key in instance.propsOptions[0]) {
5003
+ if (!(key in props)) {
5004
+ props[key] = void 0;
5093
5005
  }
5094
5006
  }
5095
- const instance = currentInstance;
5096
- baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
5097
- let isPre = false;
5098
- if (flush === "post") {
5099
- baseWatchOptions.scheduler = (job) => {
5100
- queuePostRenderEffect(job, instance && instance.suspense);
5101
- };
5102
- } else if (flush !== "sync") {
5103
- isPre = true;
5104
- baseWatchOptions.scheduler = (job, isFirstRun) => {
5105
- if (isFirstRun) {
5106
- job();
5107
- } else {
5108
- queueJob(job);
5109
- }
5110
- };
5007
+ if (!!(process$1.env.NODE_ENV !== "production")) {
5008
+ validateProps(rawProps || {}, props, instance);
5111
5009
  }
5112
- baseWatchOptions.augmentJob = (job) => {
5113
- if (cb) {
5114
- job.flags |= 4;
5115
- }
5116
- if (isPre) {
5117
- job.flags |= 2;
5118
- if (instance) {
5119
- job.id = instance.uid;
5120
- job.i = instance;
5121
- }
5122
- }
5123
- };
5124
- const watchHandle = watch$1(source, cb, baseWatchOptions);
5125
- if (isInSSRComponentSetup) {
5126
- if (ssrCleanup) {
5127
- ssrCleanup.push(watchHandle);
5128
- } else if (runsImmediately) {
5129
- watchHandle();
5010
+ if (isStateful) {
5011
+ instance.props = isSSR ? props : shallowReactive(props);
5012
+ } else {
5013
+ if (!instance.type.props) {
5014
+ instance.props = attrs;
5015
+ } else {
5016
+ instance.props = props;
5130
5017
  }
5131
5018
  }
5132
- return watchHandle;
5019
+ instance.attrs = attrs;
5133
5020
  }
5134
- function instanceWatch(source, value, options) {
5135
- const publicThis = this.proxy;
5136
- const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
5137
- let cb;
5138
- if (isFunction(value)) {
5139
- cb = value;
5140
- } else {
5141
- cb = value.handler;
5142
- options = value;
5021
+ function isInHmrContext(instance) {
5022
+ while (instance) {
5023
+ if (instance.type.__hmrId) return true;
5024
+ instance = instance.parent;
5143
5025
  }
5144
- const reset = setCurrentInstance(this);
5145
- const res = doWatch(getter, cb.bind(publicThis), options);
5146
- reset();
5147
- return res;
5148
- }
5149
- function createPathGetter(ctx, path) {
5150
- const segments = path.split(".");
5151
- return () => {
5152
- let cur = ctx;
5153
- for (let i = 0; i < segments.length && cur; i++) {
5154
- cur = cur[segments[i]];
5155
- }
5156
- return cur;
5157
- };
5158
5026
  }
5159
- const getModelModifiers = (props, modelName) => {
5160
- return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
5161
- };
5162
- function emit(instance, event, ...rawArgs) {
5163
- if (instance.isUnmounted) return;
5164
- const props = instance.vnode.props || EMPTY_OBJ;
5165
- if (!!(process$1.env.NODE_ENV !== "production")) {
5166
- const {
5167
- emitsOptions,
5168
- propsOptions: [propsOptions]
5169
- } = instance;
5170
- if (emitsOptions) {
5171
- if (!(event in emitsOptions) && true) {
5172
- if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
5173
- warn$1(
5174
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
5175
- );
5027
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5028
+ const {
5029
+ props,
5030
+ attrs,
5031
+ vnode: { patchFlag }
5032
+ } = instance;
5033
+ const rawCurrentProps = toRaw(props);
5034
+ const [options] = instance.propsOptions;
5035
+ let hasAttrsChanged = false;
5036
+ if (
5037
+ // always force full diff in dev
5038
+ // - #1942 if hmr is enabled with sfc component
5039
+ // - vite#872 non-sfc component used by sfc component
5040
+ !(!!(process$1.env.NODE_ENV !== "production") && isInHmrContext(instance)) && (optimized || patchFlag > 0) && !(patchFlag & 16)
5041
+ ) {
5042
+ if (patchFlag & 8) {
5043
+ const propsToUpdate = instance.vnode.dynamicProps;
5044
+ for (let i = 0; i < propsToUpdate.length; i++) {
5045
+ let key = propsToUpdate[i];
5046
+ if (isEmitListener(instance.emitsOptions, key)) {
5047
+ continue;
5176
5048
  }
5177
- } else {
5178
- const validator = emitsOptions[event];
5179
- if (isFunction(validator)) {
5180
- const isValid = validator(...rawArgs);
5181
- if (!isValid) {
5182
- warn$1(
5183
- `Invalid event arguments: event validation failed for event "${event}".`
5049
+ const value = rawProps[key];
5050
+ if (options) {
5051
+ if (hasOwn(attrs, key)) {
5052
+ if (value !== attrs[key]) {
5053
+ attrs[key] = value;
5054
+ hasAttrsChanged = true;
5055
+ }
5056
+ } else {
5057
+ const camelizedKey = camelize(key);
5058
+ props[camelizedKey] = resolvePropValue(
5059
+ options,
5060
+ rawCurrentProps,
5061
+ camelizedKey,
5062
+ value,
5063
+ instance,
5064
+ false
5184
5065
  );
5185
5066
  }
5067
+ } else {
5068
+ if (value !== attrs[key]) {
5069
+ attrs[key] = value;
5070
+ hasAttrsChanged = true;
5071
+ }
5186
5072
  }
5187
5073
  }
5188
5074
  }
5189
- }
5190
- let args = rawArgs;
5191
- const isModelListener2 = event.startsWith("update:");
5192
- const modifiers = isModelListener2 && getModelModifiers(props, event.slice(7));
5193
- if (modifiers) {
5194
- if (modifiers.trim) {
5195
- args = rawArgs.map((a) => isString(a) ? a.trim() : a);
5075
+ } else {
5076
+ if (setFullProps(instance, rawProps, props, attrs)) {
5077
+ hasAttrsChanged = true;
5196
5078
  }
5197
- if (modifiers.number) {
5198
- args = rawArgs.map(looseToNumber);
5079
+ let kebabKey;
5080
+ for (const key in rawCurrentProps) {
5081
+ if (!rawProps || // for camelCase
5082
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
5083
+ // and converted to camelCase (#955)
5084
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
5085
+ if (options) {
5086
+ if (rawPrevProps && // for camelCase
5087
+ (rawPrevProps[key] !== void 0 || // for kebab-case
5088
+ rawPrevProps[kebabKey] !== void 0)) {
5089
+ props[key] = resolvePropValue(
5090
+ options,
5091
+ rawCurrentProps,
5092
+ key,
5093
+ void 0,
5094
+ instance,
5095
+ true
5096
+ );
5097
+ }
5098
+ } else {
5099
+ delete props[key];
5100
+ }
5101
+ }
5102
+ }
5103
+ if (attrs !== rawCurrentProps) {
5104
+ for (const key in attrs) {
5105
+ if (!rawProps || !hasOwn(rawProps, key) && true) {
5106
+ delete attrs[key];
5107
+ hasAttrsChanged = true;
5108
+ }
5109
+ }
5199
5110
  }
5200
5111
  }
5201
- if (!!(process$1.env.NODE_ENV !== "production") || false) {
5202
- devtoolsComponentEmit(instance, event, args);
5112
+ if (hasAttrsChanged) {
5113
+ trigger(instance.attrs, "set", "");
5203
5114
  }
5204
5115
  if (!!(process$1.env.NODE_ENV !== "production")) {
5205
- const lowerCaseEvent = event.toLowerCase();
5206
- if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
5207
- warn$1(
5208
- `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
5209
- instance,
5210
- instance.type
5211
- )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
5212
- event
5213
- )}" instead of "${event}".`
5214
- );
5215
- }
5116
+ validateProps(rawProps || {}, props, instance);
5216
5117
  }
5217
- let handlerName;
5218
- let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
5219
- props[handlerName = toHandlerKey(camelize(event))];
5220
- if (!handler && isModelListener2) {
5221
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
5118
+ }
5119
+ function setFullProps(instance, rawProps, props, attrs) {
5120
+ const [options, needCastKeys] = instance.propsOptions;
5121
+ let hasAttrsChanged = false;
5122
+ let rawCastValues;
5123
+ if (rawProps) {
5124
+ for (let key in rawProps) {
5125
+ if (isReservedProp(key)) {
5126
+ continue;
5127
+ }
5128
+ const value = rawProps[key];
5129
+ let camelKey;
5130
+ if (options && hasOwn(options, camelKey = camelize(key))) {
5131
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
5132
+ props[camelKey] = value;
5133
+ } else {
5134
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
5135
+ }
5136
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
5137
+ if (!(key in attrs) || value !== attrs[key]) {
5138
+ attrs[key] = value;
5139
+ hasAttrsChanged = true;
5140
+ }
5141
+ }
5142
+ }
5222
5143
  }
5223
- if (handler) {
5224
- callWithAsyncErrorHandling(
5225
- handler,
5226
- instance,
5227
- 6,
5228
- args
5229
- );
5144
+ if (needCastKeys) {
5145
+ const rawCurrentProps = toRaw(props);
5146
+ const castValues = rawCastValues || EMPTY_OBJ;
5147
+ for (let i = 0; i < needCastKeys.length; i++) {
5148
+ const key = needCastKeys[i];
5149
+ props[key] = resolvePropValue(
5150
+ options,
5151
+ rawCurrentProps,
5152
+ key,
5153
+ castValues[key],
5154
+ instance,
5155
+ !hasOwn(castValues, key)
5156
+ );
5157
+ }
5230
5158
  }
5231
- const onceHandler = props[handlerName + `Once`];
5232
- if (onceHandler) {
5233
- if (!instance.emitted) {
5234
- instance.emitted = {};
5235
- } else if (instance.emitted[handlerName]) {
5236
- return;
5159
+ return hasAttrsChanged;
5160
+ }
5161
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
5162
+ const opt = options[key];
5163
+ if (opt != null) {
5164
+ const hasDefault = hasOwn(opt, "default");
5165
+ if (hasDefault && value === void 0) {
5166
+ const defaultValue = opt.default;
5167
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
5168
+ const { propsDefaults } = instance;
5169
+ if (key in propsDefaults) {
5170
+ value = propsDefaults[key];
5171
+ } else {
5172
+ const reset = setCurrentInstance(instance);
5173
+ value = propsDefaults[key] = defaultValue.call(
5174
+ null,
5175
+ props
5176
+ );
5177
+ reset();
5178
+ }
5179
+ } else {
5180
+ value = defaultValue;
5181
+ }
5182
+ if (instance.ce) {
5183
+ instance.ce._setProp(key, value);
5184
+ }
5185
+ }
5186
+ if (opt[
5187
+ 0
5188
+ /* shouldCast */
5189
+ ]) {
5190
+ if (isAbsent && !hasDefault) {
5191
+ value = false;
5192
+ } else if (opt[
5193
+ 1
5194
+ /* shouldCastTrue */
5195
+ ] && (value === "" || value === hyphenate(key))) {
5196
+ value = true;
5197
+ }
5237
5198
  }
5238
- instance.emitted[handlerName] = true;
5239
- callWithAsyncErrorHandling(
5240
- onceHandler,
5241
- instance,
5242
- 6,
5243
- args
5244
- );
5245
5199
  }
5200
+ return value;
5246
5201
  }
5247
- const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
5248
- function normalizeEmitsOptions(comp, appContext, asMixin = false) {
5249
- const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
5202
+ const mixinPropsCache = /* @__PURE__ */ new WeakMap();
5203
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
5204
+ const cache = asMixin ? mixinPropsCache : appContext.propsCache;
5250
5205
  const cached = cache.get(comp);
5251
- if (cached !== void 0) {
5206
+ if (cached) {
5252
5207
  return cached;
5253
5208
  }
5254
- const raw = comp.emits;
5255
- let normalized = {};
5209
+ const raw = comp.props;
5210
+ const normalized = {};
5211
+ const needCastKeys = [];
5256
5212
  let hasExtends = false;
5257
5213
  if (!isFunction(comp)) {
5258
- const extendEmits = (raw2) => {
5259
- const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
5260
- if (normalizedFromExtend) {
5261
- hasExtends = true;
5262
- extend(normalized, normalizedFromExtend);
5263
- }
5214
+ const extendProps = (raw2) => {
5215
+ hasExtends = true;
5216
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
5217
+ extend(normalized, props);
5218
+ if (keys) needCastKeys.push(...keys);
5264
5219
  };
5265
5220
  if (!asMixin && appContext.mixins.length) {
5266
- appContext.mixins.forEach(extendEmits);
5221
+ appContext.mixins.forEach(extendProps);
5267
5222
  }
5268
5223
  if (comp.extends) {
5269
- extendEmits(comp.extends);
5224
+ extendProps(comp.extends);
5270
5225
  }
5271
5226
  if (comp.mixins) {
5272
- comp.mixins.forEach(extendEmits);
5227
+ comp.mixins.forEach(extendProps);
5273
5228
  }
5274
5229
  }
5275
5230
  if (!raw && !hasExtends) {
5276
5231
  if (isObject(comp)) {
5277
- cache.set(comp, null);
5232
+ cache.set(comp, EMPTY_ARR);
5278
5233
  }
5279
- return null;
5234
+ return EMPTY_ARR;
5280
5235
  }
5281
5236
  if (isArray(raw)) {
5282
- raw.forEach((key) => normalized[key] = null);
5283
- } else {
5284
- extend(normalized, raw);
5237
+ for (let i = 0; i < raw.length; i++) {
5238
+ if (!!(process$1.env.NODE_ENV !== "production") && !isString(raw[i])) {
5239
+ warn$1(`props must be strings when using array syntax.`, raw[i]);
5240
+ }
5241
+ const normalizedKey = camelize(raw[i]);
5242
+ if (validatePropName(normalizedKey)) {
5243
+ normalized[normalizedKey] = EMPTY_OBJ;
5244
+ }
5245
+ }
5246
+ } else if (raw) {
5247
+ if (!!(process$1.env.NODE_ENV !== "production") && !isObject(raw)) {
5248
+ warn$1(`invalid props options`, raw);
5249
+ }
5250
+ for (const key in raw) {
5251
+ const normalizedKey = camelize(key);
5252
+ if (validatePropName(normalizedKey)) {
5253
+ const opt = raw[key];
5254
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
5255
+ const propType = prop.type;
5256
+ let shouldCast = false;
5257
+ let shouldCastTrue = true;
5258
+ if (isArray(propType)) {
5259
+ for (let index = 0; index < propType.length; ++index) {
5260
+ const type = propType[index];
5261
+ const typeName = isFunction(type) && type.name;
5262
+ if (typeName === "Boolean") {
5263
+ shouldCast = true;
5264
+ break;
5265
+ } else if (typeName === "String") {
5266
+ shouldCastTrue = false;
5267
+ }
5268
+ }
5269
+ } else {
5270
+ shouldCast = isFunction(propType) && propType.name === "Boolean";
5271
+ }
5272
+ prop[
5273
+ 0
5274
+ /* shouldCast */
5275
+ ] = shouldCast;
5276
+ prop[
5277
+ 1
5278
+ /* shouldCastTrue */
5279
+ ] = shouldCastTrue;
5280
+ if (shouldCast || hasOwn(prop, "default")) {
5281
+ needCastKeys.push(normalizedKey);
5282
+ }
5283
+ }
5284
+ }
5285
5285
  }
5286
+ const res = [normalized, needCastKeys];
5286
5287
  if (isObject(comp)) {
5287
- cache.set(comp, normalized);
5288
+ cache.set(comp, res);
5288
5289
  }
5289
- return normalized;
5290
+ return res;
5290
5291
  }
5291
- function isEmitListener(options, key) {
5292
- if (!options || !isOn(key)) {
5293
- return false;
5292
+ function validatePropName(key) {
5293
+ if (key[0] !== "$" && !isReservedProp(key)) {
5294
+ return true;
5295
+ } else if (!!(process$1.env.NODE_ENV !== "production")) {
5296
+ warn$1(`Invalid prop name: "${key}" is a reserved property.`);
5294
5297
  }
5295
- key = key.slice(2).replace(/Once$/, "");
5296
- return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
5298
+ return false;
5297
5299
  }
5298
- let accessedAttrs = false;
5299
- function markAttrsAccessed() {
5300
- accessedAttrs = true;
5300
+ function getType(ctor) {
5301
+ if (ctor === null) {
5302
+ return "null";
5303
+ }
5304
+ if (typeof ctor === "function") {
5305
+ return ctor.name || "";
5306
+ } else if (typeof ctor === "object") {
5307
+ const name = ctor.constructor && ctor.constructor.name;
5308
+ return name || "";
5309
+ }
5310
+ return "";
5301
5311
  }
5302
- function renderComponentRoot(instance) {
5303
- const {
5304
- type: Component,
5305
- vnode,
5306
- proxy,
5307
- withProxy,
5308
- propsOptions: [propsOptions],
5309
- slots,
5310
- attrs,
5311
- emit: emit2,
5312
- render,
5313
- renderCache,
5314
- props,
5315
- data,
5316
- setupState,
5317
- ctx,
5318
- inheritAttrs
5319
- } = instance;
5320
- const prev = setCurrentRenderingInstance(instance);
5321
- let result;
5322
- let fallthroughAttrs;
5323
- if (!!(process$1.env.NODE_ENV !== "production")) {
5324
- accessedAttrs = false;
5312
+ function validateProps(rawProps, props, instance) {
5313
+ const resolvedValues = toRaw(props);
5314
+ const options = instance.propsOptions[0];
5315
+ const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
5316
+ for (const key in options) {
5317
+ let opt = options[key];
5318
+ if (opt == null) continue;
5319
+ validateProp(
5320
+ key,
5321
+ resolvedValues[key],
5322
+ opt,
5323
+ !!(process$1.env.NODE_ENV !== "production") ? shallowReadonly(resolvedValues) : resolvedValues,
5324
+ !camelizePropsKey.includes(key)
5325
+ );
5325
5326
  }
5326
- try {
5327
- if (vnode.shapeFlag & 4) {
5328
- const proxyToUse = withProxy || proxy;
5329
- const thisProxy = !!(process$1.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
5330
- get(target, key, receiver) {
5331
- warn$1(
5332
- `Property '${String(
5333
- key
5334
- )}' was accessed via 'this'. Avoid using 'this' in templates.`
5335
- );
5336
- return Reflect.get(target, key, receiver);
5337
- }
5338
- }) : proxyToUse;
5339
- result = normalizeVNode(
5340
- render.call(
5341
- thisProxy,
5342
- proxyToUse,
5343
- renderCache,
5344
- !!(process$1.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
5345
- setupState,
5346
- data,
5347
- ctx
5348
- )
5349
- );
5350
- fallthroughAttrs = attrs;
5351
- } else {
5352
- const render2 = Component;
5353
- if (!!(process$1.env.NODE_ENV !== "production") && attrs === props) {
5354
- markAttrsAccessed();
5355
- }
5356
- result = normalizeVNode(
5357
- render2.length > 1 ? render2(
5358
- !!(process$1.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
5359
- !!(process$1.env.NODE_ENV !== "production") ? {
5360
- get attrs() {
5361
- markAttrsAccessed();
5362
- return shallowReadonly(attrs);
5363
- },
5364
- slots,
5365
- emit: emit2
5366
- } : { attrs, slots, emit: emit2 }
5367
- ) : render2(
5368
- !!(process$1.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
5369
- null
5370
- )
5371
- );
5372
- fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
5373
- }
5374
- } catch (err) {
5375
- blockStack.length = 0;
5376
- handleError(err, instance, 1);
5377
- result = createVNode(Comment);
5327
+ }
5328
+ function validateProp(name, value, prop, props, isAbsent) {
5329
+ const { type, required, validator, skipCheck } = prop;
5330
+ if (required && isAbsent) {
5331
+ warn$1('Missing required prop: "' + name + '"');
5332
+ return;
5378
5333
  }
5379
- let root = result;
5380
- let setRoot = void 0;
5381
- if (!!(process$1.env.NODE_ENV !== "production") && result.patchFlag > 0 && result.patchFlag & 2048) {
5382
- [root, setRoot] = getChildRoot(result);
5334
+ if (value == null && !required) {
5335
+ return;
5383
5336
  }
5384
- if (fallthroughAttrs && inheritAttrs !== false) {
5385
- const keys = Object.keys(fallthroughAttrs);
5386
- const { shapeFlag } = root;
5387
- if (keys.length) {
5388
- if (shapeFlag & (1 | 6)) {
5389
- if (propsOptions && keys.some(isModelListener)) {
5390
- fallthroughAttrs = filterModelListeners(
5391
- fallthroughAttrs,
5392
- propsOptions
5393
- );
5394
- }
5395
- root = cloneVNode(root, fallthroughAttrs, false, true);
5396
- } else if (!!(process$1.env.NODE_ENV !== "production") && !accessedAttrs && root.type !== Comment) {
5397
- const allAttrs = Object.keys(attrs);
5398
- const eventAttrs = [];
5399
- const extraAttrs = [];
5400
- for (let i = 0, l = allAttrs.length; i < l; i++) {
5401
- const key = allAttrs[i];
5402
- if (isOn(key)) {
5403
- if (!isModelListener(key)) {
5404
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
5405
- }
5406
- } else {
5407
- extraAttrs.push(key);
5408
- }
5409
- }
5410
- if (extraAttrs.length) {
5411
- warn$1(
5412
- `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
5413
- );
5414
- }
5415
- if (eventAttrs.length) {
5416
- warn$1(
5417
- `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
5418
- );
5419
- }
5420
- }
5337
+ if (type != null && type !== true && !skipCheck) {
5338
+ let isValid = false;
5339
+ const types = isArray(type) ? type : [type];
5340
+ const expectedTypes = [];
5341
+ for (let i = 0; i < types.length && !isValid; i++) {
5342
+ const { valid, expectedType } = assertType(value, types[i]);
5343
+ expectedTypes.push(expectedType || "");
5344
+ isValid = valid;
5421
5345
  }
5422
- }
5423
- if (vnode.dirs) {
5424
- if (!!(process$1.env.NODE_ENV !== "production") && !isElementRoot(root)) {
5425
- warn$1(
5426
- `Runtime directive used on component with non-element root node. The directives will not function as intended.`
5427
- );
5346
+ if (!isValid) {
5347
+ warn$1(getInvalidTypeMessage(name, value, expectedTypes));
5348
+ return;
5428
5349
  }
5429
- root = cloneVNode(root, null, false, true);
5430
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
5431
5350
  }
5432
- if (vnode.transition) {
5433
- if (!!(process$1.env.NODE_ENV !== "production") && !isElementRoot(root)) {
5434
- warn$1(
5435
- `Component inside <Transition> renders non-element root node that cannot be animated.`
5436
- );
5437
- }
5438
- setTransitionHooks(root, vnode.transition);
5351
+ if (validator && !validator(value, props)) {
5352
+ warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
5439
5353
  }
5440
- if (!!(process$1.env.NODE_ENV !== "production") && setRoot) {
5441
- setRoot(root);
5354
+ }
5355
+ const isSimpleType = /* @__PURE__ */ makeMap(
5356
+ "String,Number,Boolean,Function,Symbol,BigInt"
5357
+ );
5358
+ function assertType(value, type) {
5359
+ let valid;
5360
+ const expectedType = getType(type);
5361
+ if (expectedType === "null") {
5362
+ valid = value === null;
5363
+ } else if (isSimpleType(expectedType)) {
5364
+ const t = typeof value;
5365
+ valid = t === expectedType.toLowerCase();
5366
+ if (!valid && t === "object") {
5367
+ valid = value instanceof type;
5368
+ }
5369
+ } else if (expectedType === "Object") {
5370
+ valid = isObject(value);
5371
+ } else if (expectedType === "Array") {
5372
+ valid = isArray(value);
5442
5373
  } else {
5443
- result = root;
5374
+ valid = value instanceof type;
5444
5375
  }
5445
- setCurrentRenderingInstance(prev);
5446
- return result;
5376
+ return {
5377
+ valid,
5378
+ expectedType
5379
+ };
5447
5380
  }
5448
- const getChildRoot = (vnode) => {
5449
- const rawChildren = vnode.children;
5450
- const dynamicChildren = vnode.dynamicChildren;
5451
- const childRoot = filterSingleRoot(rawChildren, false);
5452
- if (!childRoot) {
5453
- return [vnode, void 0];
5454
- } else if (!!(process$1.env.NODE_ENV !== "production") && childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
5455
- return getChildRoot(childRoot);
5381
+ function getInvalidTypeMessage(name, value, expectedTypes) {
5382
+ if (expectedTypes.length === 0) {
5383
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
5456
5384
  }
5457
- const index = rawChildren.indexOf(childRoot);
5458
- const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
5459
- const setRoot = (updatedRoot) => {
5460
- rawChildren[index] = updatedRoot;
5461
- if (dynamicChildren) {
5462
- if (dynamicIndex > -1) {
5463
- dynamicChildren[dynamicIndex] = updatedRoot;
5464
- } else if (updatedRoot.patchFlag > 0) {
5465
- vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
5466
- }
5467
- }
5468
- };
5469
- return [normalizeVNode(childRoot), setRoot];
5470
- };
5471
- function filterSingleRoot(children, recurse = true) {
5472
- let singleRoot;
5473
- for (let i = 0; i < children.length; i++) {
5474
- const child = children[i];
5475
- if (isVNode(child)) {
5476
- if (child.type !== Comment || child.children === "v-if") {
5477
- if (singleRoot) {
5478
- return;
5479
- } else {
5480
- singleRoot = child;
5481
- if (!!(process$1.env.NODE_ENV !== "production") && recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
5482
- return filterSingleRoot(singleRoot.children);
5483
- }
5484
- }
5485
- }
5486
- } else {
5487
- return;
5488
- }
5385
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
5386
+ const expectedType = expectedTypes[0];
5387
+ const receivedType = toRawType(value);
5388
+ const expectedValue = styleValue(value, expectedType);
5389
+ const receivedValue = styleValue(value, receivedType);
5390
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
5391
+ message += ` with value ${expectedValue}`;
5489
5392
  }
5490
- return singleRoot;
5393
+ message += `, got ${receivedType} `;
5394
+ if (isExplicable(receivedType)) {
5395
+ message += `with value ${receivedValue}.`;
5396
+ }
5397
+ return message;
5491
5398
  }
5492
- const getFunctionalFallthrough = (attrs) => {
5493
- let res;
5494
- for (const key in attrs) {
5495
- if (key === "class" || key === "style" || isOn(key)) {
5496
- (res || (res = {}))[key] = attrs[key];
5497
- }
5399
+ function styleValue(value, type) {
5400
+ if (type === "String") {
5401
+ return `"${value}"`;
5402
+ } else if (type === "Number") {
5403
+ return `${Number(value)}`;
5404
+ } else {
5405
+ return `${value}`;
5498
5406
  }
5499
- return res;
5500
- };
5501
- const filterModelListeners = (attrs, props) => {
5502
- const res = {};
5503
- for (const key in attrs) {
5504
- if (!isModelListener(key) || !(key.slice(9) in props)) {
5505
- res[key] = attrs[key];
5506
- }
5407
+ }
5408
+ function isExplicable(type) {
5409
+ const explicitTypes = ["string", "number", "boolean"];
5410
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
5411
+ }
5412
+ function isBoolean(...args) {
5413
+ return args.some((elem) => elem.toLowerCase() === "boolean");
5414
+ }
5415
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
5416
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
5417
+ const normalizeSlot = (key, rawSlot, ctx) => {
5418
+ if (rawSlot._n) {
5419
+ return rawSlot;
5507
5420
  }
5508
- return res;
5509
- };
5510
- const isElementRoot = (vnode) => {
5511
- return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
5421
+ const normalized = withCtx((...args) => {
5422
+ if (!!(process$1.env.NODE_ENV !== "production") && currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
5423
+ warn$1(
5424
+ `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.`
5425
+ );
5426
+ }
5427
+ return normalizeSlotValue(rawSlot(...args));
5428
+ }, ctx);
5429
+ normalized._c = false;
5430
+ return normalized;
5512
5431
  };
5513
- function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
5514
- const { props: prevProps, children: prevChildren, component } = prevVNode;
5515
- const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
5516
- const emits = component.emitsOptions;
5517
- if (!!(process$1.env.NODE_ENV !== "production") && (prevChildren || nextChildren) && isHmrUpdating) {
5518
- return true;
5432
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
5433
+ const ctx = rawSlots._ctx;
5434
+ for (const key in rawSlots) {
5435
+ if (isInternalKey(key)) continue;
5436
+ const value = rawSlots[key];
5437
+ if (isFunction(value)) {
5438
+ slots[key] = normalizeSlot(key, value, ctx);
5439
+ } else if (value != null) {
5440
+ if (!!(process$1.env.NODE_ENV !== "production") && true) {
5441
+ warn$1(
5442
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
5443
+ );
5444
+ }
5445
+ const normalized = normalizeSlotValue(value);
5446
+ slots[key] = () => normalized;
5447
+ }
5519
5448
  }
5520
- if (nextVNode.dirs || nextVNode.transition) {
5521
- return true;
5449
+ };
5450
+ const normalizeVNodeSlots = (instance, children) => {
5451
+ if (!!(process$1.env.NODE_ENV !== "production") && !isKeepAlive(instance.vnode) && true) {
5452
+ warn$1(
5453
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
5454
+ );
5522
5455
  }
5523
- if (optimized && patchFlag >= 0) {
5524
- if (patchFlag & 1024) {
5525
- return true;
5456
+ const normalized = normalizeSlotValue(children);
5457
+ instance.slots.default = () => normalized;
5458
+ };
5459
+ const assignSlots = (slots, children, optimized) => {
5460
+ for (const key in children) {
5461
+ if (optimized || !isInternalKey(key)) {
5462
+ slots[key] = children[key];
5526
5463
  }
5527
- if (patchFlag & 16) {
5528
- if (!prevProps) {
5529
- return !!nextProps;
5530
- }
5531
- return hasPropsChanged(prevProps, nextProps, emits);
5532
- } else if (patchFlag & 8) {
5533
- const dynamicProps = nextVNode.dynamicProps;
5534
- for (let i = 0; i < dynamicProps.length; i++) {
5535
- const key = dynamicProps[i];
5536
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
5537
- return true;
5538
- }
5464
+ }
5465
+ };
5466
+ const initSlots = (instance, children, optimized) => {
5467
+ const slots = instance.slots = createInternalObject();
5468
+ if (instance.vnode.shapeFlag & 32) {
5469
+ const type = children._;
5470
+ if (type) {
5471
+ assignSlots(slots, children, optimized);
5472
+ if (optimized) {
5473
+ def(slots, "_", type, true);
5539
5474
  }
5475
+ } else {
5476
+ normalizeObjectSlots(children, slots);
5540
5477
  }
5541
- } else {
5542
- if (prevChildren || nextChildren) {
5543
- if (!nextChildren || !nextChildren.$stable) {
5544
- return true;
5478
+ } else if (children) {
5479
+ normalizeVNodeSlots(instance, children);
5480
+ }
5481
+ };
5482
+ const updateSlots = (instance, children, optimized) => {
5483
+ const { vnode, slots } = instance;
5484
+ let needDeletionCheck = true;
5485
+ let deletionComparisonTarget = EMPTY_OBJ;
5486
+ if (vnode.shapeFlag & 32) {
5487
+ const type = children._;
5488
+ if (type) {
5489
+ if (!!(process$1.env.NODE_ENV !== "production") && isHmrUpdating) {
5490
+ assignSlots(slots, children, optimized);
5491
+ trigger(instance, "set", "$slots");
5492
+ } else if (optimized && type === 1) {
5493
+ needDeletionCheck = false;
5494
+ } else {
5495
+ assignSlots(slots, children, optimized);
5545
5496
  }
5497
+ } else {
5498
+ needDeletionCheck = !children.$stable;
5499
+ normalizeObjectSlots(children, slots);
5546
5500
  }
5547
- if (prevProps === nextProps) {
5548
- return false;
5549
- }
5550
- if (!prevProps) {
5551
- return !!nextProps;
5552
- }
5553
- if (!nextProps) {
5554
- return true;
5501
+ deletionComparisonTarget = children;
5502
+ } else if (children) {
5503
+ normalizeVNodeSlots(instance, children);
5504
+ deletionComparisonTarget = { default: 1 };
5505
+ }
5506
+ if (needDeletionCheck) {
5507
+ for (const key in slots) {
5508
+ if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
5509
+ delete slots[key];
5510
+ }
5555
5511
  }
5556
- return hasPropsChanged(prevProps, nextProps, emits);
5557
5512
  }
5558
- return false;
5559
- }
5560
- function hasPropsChanged(prevProps, nextProps, emitsOptions) {
5561
- const nextKeys = Object.keys(nextProps);
5562
- if (nextKeys.length !== Object.keys(prevProps).length) {
5563
- return true;
5513
+ };
5514
+ let supported;
5515
+ let perf;
5516
+ function startMeasure(instance, type) {
5517
+ if (instance.appContext.config.performance && isSupported()) {
5518
+ perf.mark(`vue-${type}-${instance.uid}`);
5564
5519
  }
5565
- for (let i = 0; i < nextKeys.length; i++) {
5566
- const key = nextKeys[i];
5567
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
5568
- return true;
5569
- }
5520
+ if (!!(process$1.env.NODE_ENV !== "production") || false) {
5521
+ devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
5570
5522
  }
5571
- return false;
5572
5523
  }
5573
- function updateHOCHostEl({ vnode, parent }, el) {
5574
- while (parent) {
5575
- const root = parent.subTree;
5576
- if (root.suspense && root.suspense.activeBranch === vnode) {
5577
- root.el = vnode.el;
5578
- }
5579
- if (root === vnode) {
5580
- (vnode = parent.vnode).el = el;
5581
- parent = parent.parent;
5582
- } else {
5583
- break;
5584
- }
5524
+ function endMeasure(instance, type) {
5525
+ if (instance.appContext.config.performance && isSupported()) {
5526
+ const startTag = `vue-${type}-${instance.uid}`;
5527
+ const endTag = startTag + `:end`;
5528
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
5529
+ perf.mark(endTag);
5530
+ perf.measure(measureName, startTag, endTag);
5531
+ perf.clearMeasures(measureName);
5532
+ perf.clearMarks(startTag);
5533
+ perf.clearMarks(endTag);
5585
5534
  }
5586
- }
5587
- const internalObjectProto = {};
5588
- const createInternalObject = () => Object.create(internalObjectProto);
5589
- const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
5590
- function initProps(instance, rawProps, isStateful, isSSR = false) {
5591
- const props = {};
5592
- const attrs = createInternalObject();
5593
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5594
- setFullProps(instance, rawProps, props, attrs);
5595
- for (const key in instance.propsOptions[0]) {
5596
- if (!(key in props)) {
5597
- props[key] = void 0;
5598
- }
5535
+ if (!!(process$1.env.NODE_ENV !== "production") || false) {
5536
+ devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
5599
5537
  }
5600
- if (!!(process$1.env.NODE_ENV !== "production")) {
5601
- validateProps(rawProps || {}, props, instance);
5538
+ }
5539
+ function isSupported() {
5540
+ if (supported !== void 0) {
5541
+ return supported;
5602
5542
  }
5603
- if (isStateful) {
5604
- instance.props = isSSR ? props : shallowReactive(props);
5543
+ if (typeof window !== "undefined" && window.performance) {
5544
+ supported = true;
5545
+ perf = window.performance;
5605
5546
  } else {
5606
- if (!instance.type.props) {
5607
- instance.props = attrs;
5608
- } else {
5609
- instance.props = props;
5610
- }
5547
+ supported = false;
5611
5548
  }
5612
- instance.attrs = attrs;
5549
+ return supported;
5613
5550
  }
5614
- function isInHmrContext(instance) {
5615
- while (instance) {
5616
- if (instance.type.__hmrId) return true;
5617
- instance = instance.parent;
5551
+ function initFeatureFlags() {
5552
+ const needWarn = [];
5553
+ if (!!(process$1.env.NODE_ENV !== "production") && needWarn.length) {
5554
+ const multi = needWarn.length > 1;
5555
+ console.warn(
5556
+ `Feature flag${multi ? `s` : ``} ${needWarn.join(", ")} ${multi ? `are` : `is`} not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.
5557
+
5558
+ For more details, see https://link.vuejs.org/feature-flags.`
5559
+ );
5618
5560
  }
5619
5561
  }
5620
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
5621
- const {
5622
- props,
5623
- attrs,
5624
- vnode: { patchFlag }
5625
- } = instance;
5626
- const rawCurrentProps = toRaw(props);
5627
- const [options] = instance.propsOptions;
5628
- let hasAttrsChanged = false;
5629
- if (
5630
- // always force full diff in dev
5631
- // - #1942 if hmr is enabled with sfc component
5632
- // - vite#872 non-sfc component used by sfc component
5633
- !(!!(process$1.env.NODE_ENV !== "production") && isInHmrContext(instance)) && (optimized || patchFlag > 0) && !(patchFlag & 16)
5634
- ) {
5635
- if (patchFlag & 8) {
5636
- const propsToUpdate = instance.vnode.dynamicProps;
5637
- for (let i = 0; i < propsToUpdate.length; i++) {
5638
- let key = propsToUpdate[i];
5639
- if (isEmitListener(instance.emitsOptions, key)) {
5640
- continue;
5641
- }
5642
- const value = rawProps[key];
5643
- if (options) {
5644
- if (hasOwn(attrs, key)) {
5645
- if (value !== attrs[key]) {
5646
- attrs[key] = value;
5647
- hasAttrsChanged = true;
5648
- }
5649
- } else {
5650
- const camelizedKey = camelize(key);
5651
- props[camelizedKey] = resolvePropValue(
5652
- options,
5653
- rawCurrentProps,
5654
- camelizedKey,
5655
- value,
5656
- instance,
5657
- false
5658
- );
5659
- }
5660
- } else {
5661
- if (value !== attrs[key]) {
5662
- attrs[key] = value;
5663
- hasAttrsChanged = true;
5664
- }
5665
- }
5666
- }
5667
- }
5668
- } else {
5669
- if (setFullProps(instance, rawProps, props, attrs)) {
5670
- hasAttrsChanged = true;
5671
- }
5672
- let kebabKey;
5673
- for (const key in rawCurrentProps) {
5674
- if (!rawProps || // for camelCase
5675
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
5676
- // and converted to camelCase (#955)
5677
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
5678
- if (options) {
5679
- if (rawPrevProps && // for camelCase
5680
- (rawPrevProps[key] !== void 0 || // for kebab-case
5681
- rawPrevProps[kebabKey] !== void 0)) {
5682
- props[key] = resolvePropValue(
5683
- options,
5684
- rawCurrentProps,
5685
- key,
5686
- void 0,
5687
- instance,
5688
- true
5689
- );
5690
- }
5691
- } else {
5692
- delete props[key];
5693
- }
5694
- }
5695
- }
5696
- if (attrs !== rawCurrentProps) {
5697
- for (const key in attrs) {
5698
- if (!rawProps || !hasOwn(rawProps, key) && true) {
5699
- delete attrs[key];
5700
- hasAttrsChanged = true;
5701
- }
5702
- }
5703
- }
5704
- }
5705
- if (hasAttrsChanged) {
5706
- trigger(instance.attrs, "set", "");
5707
- }
5708
- if (!!(process$1.env.NODE_ENV !== "production")) {
5709
- validateProps(rawProps || {}, props, instance);
5710
- }
5711
- }
5712
- function setFullProps(instance, rawProps, props, attrs) {
5713
- const [options, needCastKeys] = instance.propsOptions;
5714
- let hasAttrsChanged = false;
5715
- let rawCastValues;
5716
- if (rawProps) {
5717
- for (let key in rawProps) {
5718
- if (isReservedProp(key)) {
5719
- continue;
5720
- }
5721
- const value = rawProps[key];
5722
- let camelKey;
5723
- if (options && hasOwn(options, camelKey = camelize(key))) {
5724
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
5725
- props[camelKey] = value;
5726
- } else {
5727
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
5728
- }
5729
- } else if (!isEmitListener(instance.emitsOptions, key)) {
5730
- if (!(key in attrs) || value !== attrs[key]) {
5731
- attrs[key] = value;
5732
- hasAttrsChanged = true;
5733
- }
5734
- }
5735
- }
5736
- }
5737
- if (needCastKeys) {
5738
- const rawCurrentProps = toRaw(props);
5739
- const castValues = rawCastValues || EMPTY_OBJ;
5740
- for (let i = 0; i < needCastKeys.length; i++) {
5741
- const key = needCastKeys[i];
5742
- props[key] = resolvePropValue(
5743
- options,
5744
- rawCurrentProps,
5745
- key,
5746
- castValues[key],
5747
- instance,
5748
- !hasOwn(castValues, key)
5749
- );
5750
- }
5751
- }
5752
- return hasAttrsChanged;
5753
- }
5754
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
5755
- const opt = options[key];
5756
- if (opt != null) {
5757
- const hasDefault = hasOwn(opt, "default");
5758
- if (hasDefault && value === void 0) {
5759
- const defaultValue = opt.default;
5760
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
5761
- const { propsDefaults } = instance;
5762
- if (key in propsDefaults) {
5763
- value = propsDefaults[key];
5764
- } else {
5765
- const reset = setCurrentInstance(instance);
5766
- value = propsDefaults[key] = defaultValue.call(
5767
- null,
5768
- props
5769
- );
5770
- reset();
5771
- }
5772
- } else {
5773
- value = defaultValue;
5774
- }
5775
- if (instance.ce) {
5776
- instance.ce._setProp(key, value);
5777
- }
5778
- }
5779
- if (opt[
5780
- 0
5781
- /* shouldCast */
5782
- ]) {
5783
- if (isAbsent && !hasDefault) {
5784
- value = false;
5785
- } else if (opt[
5786
- 1
5787
- /* shouldCastTrue */
5788
- ] && (value === "" || value === hyphenate(key))) {
5789
- value = true;
5790
- }
5791
- }
5792
- }
5793
- return value;
5794
- }
5795
- const mixinPropsCache = /* @__PURE__ */ new WeakMap();
5796
- function normalizePropsOptions(comp, appContext, asMixin = false) {
5797
- const cache = asMixin ? mixinPropsCache : appContext.propsCache;
5798
- const cached = cache.get(comp);
5799
- if (cached) {
5800
- return cached;
5801
- }
5802
- const raw = comp.props;
5803
- const normalized = {};
5804
- const needCastKeys = [];
5805
- let hasExtends = false;
5806
- if (!isFunction(comp)) {
5807
- const extendProps = (raw2) => {
5808
- hasExtends = true;
5809
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
5810
- extend(normalized, props);
5811
- if (keys) needCastKeys.push(...keys);
5812
- };
5813
- if (!asMixin && appContext.mixins.length) {
5814
- appContext.mixins.forEach(extendProps);
5815
- }
5816
- if (comp.extends) {
5817
- extendProps(comp.extends);
5818
- }
5819
- if (comp.mixins) {
5820
- comp.mixins.forEach(extendProps);
5821
- }
5822
- }
5823
- if (!raw && !hasExtends) {
5824
- if (isObject(comp)) {
5825
- cache.set(comp, EMPTY_ARR);
5826
- }
5827
- return EMPTY_ARR;
5828
- }
5829
- if (isArray(raw)) {
5830
- for (let i = 0; i < raw.length; i++) {
5831
- if (!!(process$1.env.NODE_ENV !== "production") && !isString(raw[i])) {
5832
- warn$1(`props must be strings when using array syntax.`, raw[i]);
5833
- }
5834
- const normalizedKey = camelize(raw[i]);
5835
- if (validatePropName(normalizedKey)) {
5836
- normalized[normalizedKey] = EMPTY_OBJ;
5837
- }
5838
- }
5839
- } else if (raw) {
5840
- if (!!(process$1.env.NODE_ENV !== "production") && !isObject(raw)) {
5841
- warn$1(`invalid props options`, raw);
5842
- }
5843
- for (const key in raw) {
5844
- const normalizedKey = camelize(key);
5845
- if (validatePropName(normalizedKey)) {
5846
- const opt = raw[key];
5847
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
5848
- const propType = prop.type;
5849
- let shouldCast = false;
5850
- let shouldCastTrue = true;
5851
- if (isArray(propType)) {
5852
- for (let index = 0; index < propType.length; ++index) {
5853
- const type = propType[index];
5854
- const typeName = isFunction(type) && type.name;
5855
- if (typeName === "Boolean") {
5856
- shouldCast = true;
5857
- break;
5858
- } else if (typeName === "String") {
5859
- shouldCastTrue = false;
5860
- }
5861
- }
5862
- } else {
5863
- shouldCast = isFunction(propType) && propType.name === "Boolean";
5864
- }
5865
- prop[
5866
- 0
5867
- /* shouldCast */
5868
- ] = shouldCast;
5869
- prop[
5870
- 1
5871
- /* shouldCastTrue */
5872
- ] = shouldCastTrue;
5873
- if (shouldCast || hasOwn(prop, "default")) {
5874
- needCastKeys.push(normalizedKey);
5875
- }
5876
- }
5877
- }
5878
- }
5879
- const res = [normalized, needCastKeys];
5880
- if (isObject(comp)) {
5881
- cache.set(comp, res);
5882
- }
5883
- return res;
5884
- }
5885
- function validatePropName(key) {
5886
- if (key[0] !== "$" && !isReservedProp(key)) {
5887
- return true;
5888
- } else if (!!(process$1.env.NODE_ENV !== "production")) {
5889
- warn$1(`Invalid prop name: "${key}" is a reserved property.`);
5890
- }
5891
- return false;
5892
- }
5893
- function getType(ctor) {
5894
- if (ctor === null) {
5895
- return "null";
5896
- }
5897
- if (typeof ctor === "function") {
5898
- return ctor.name || "";
5899
- } else if (typeof ctor === "object") {
5900
- const name = ctor.constructor && ctor.constructor.name;
5901
- return name || "";
5902
- }
5903
- return "";
5904
- }
5905
- function validateProps(rawProps, props, instance) {
5906
- const resolvedValues = toRaw(props);
5907
- const options = instance.propsOptions[0];
5908
- const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
5909
- for (const key in options) {
5910
- let opt = options[key];
5911
- if (opt == null) continue;
5912
- validateProp(
5913
- key,
5914
- resolvedValues[key],
5915
- opt,
5916
- !!(process$1.env.NODE_ENV !== "production") ? shallowReadonly(resolvedValues) : resolvedValues,
5917
- !camelizePropsKey.includes(key)
5918
- );
5919
- }
5920
- }
5921
- function validateProp(name, value, prop, props, isAbsent) {
5922
- const { type, required, validator, skipCheck } = prop;
5923
- if (required && isAbsent) {
5924
- warn$1('Missing required prop: "' + name + '"');
5925
- return;
5926
- }
5927
- if (value == null && !required) {
5928
- return;
5929
- }
5930
- if (type != null && type !== true && !skipCheck) {
5931
- let isValid = false;
5932
- const types = isArray(type) ? type : [type];
5933
- const expectedTypes = [];
5934
- for (let i = 0; i < types.length && !isValid; i++) {
5935
- const { valid, expectedType } = assertType(value, types[i]);
5936
- expectedTypes.push(expectedType || "");
5937
- isValid = valid;
5938
- }
5939
- if (!isValid) {
5940
- warn$1(getInvalidTypeMessage(name, value, expectedTypes));
5941
- return;
5942
- }
5943
- }
5944
- if (validator && !validator(value, props)) {
5945
- warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
5946
- }
5947
- }
5948
- const isSimpleType = /* @__PURE__ */ makeMap(
5949
- "String,Number,Boolean,Function,Symbol,BigInt"
5950
- );
5951
- function assertType(value, type) {
5952
- let valid;
5953
- const expectedType = getType(type);
5954
- if (expectedType === "null") {
5955
- valid = value === null;
5956
- } else if (isSimpleType(expectedType)) {
5957
- const t = typeof value;
5958
- valid = t === expectedType.toLowerCase();
5959
- if (!valid && t === "object") {
5960
- valid = value instanceof type;
5961
- }
5962
- } else if (expectedType === "Object") {
5963
- valid = isObject(value);
5964
- } else if (expectedType === "Array") {
5965
- valid = isArray(value);
5966
- } else {
5967
- valid = value instanceof type;
5968
- }
5969
- return {
5970
- valid,
5971
- expectedType
5972
- };
5973
- }
5974
- function getInvalidTypeMessage(name, value, expectedTypes) {
5975
- if (expectedTypes.length === 0) {
5976
- return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
5977
- }
5978
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
5979
- const expectedType = expectedTypes[0];
5980
- const receivedType = toRawType(value);
5981
- const expectedValue = styleValue(value, expectedType);
5982
- const receivedValue = styleValue(value, receivedType);
5983
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
5984
- message += ` with value ${expectedValue}`;
5985
- }
5986
- message += `, got ${receivedType} `;
5987
- if (isExplicable(receivedType)) {
5988
- message += `with value ${receivedValue}.`;
5989
- }
5990
- return message;
5991
- }
5992
- function styleValue(value, type) {
5993
- if (type === "String") {
5994
- return `"${value}"`;
5995
- } else if (type === "Number") {
5996
- return `${Number(value)}`;
5997
- } else {
5998
- return `${value}`;
5999
- }
6000
- }
6001
- function isExplicable(type) {
6002
- const explicitTypes = ["string", "number", "boolean"];
6003
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
6004
- }
6005
- function isBoolean(...args) {
6006
- return args.some((elem) => elem.toLowerCase() === "boolean");
6007
- }
6008
- const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
6009
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6010
- const normalizeSlot = (key, rawSlot, ctx) => {
6011
- if (rawSlot._n) {
6012
- return rawSlot;
6013
- }
6014
- const normalized = withCtx((...args) => {
6015
- if (!!(process$1.env.NODE_ENV !== "production") && currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
6016
- warn$1(
6017
- `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.`
6018
- );
6019
- }
6020
- return normalizeSlotValue(rawSlot(...args));
6021
- }, ctx);
6022
- normalized._c = false;
6023
- return normalized;
6024
- };
6025
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
6026
- const ctx = rawSlots._ctx;
6027
- for (const key in rawSlots) {
6028
- if (isInternalKey(key)) continue;
6029
- const value = rawSlots[key];
6030
- if (isFunction(value)) {
6031
- slots[key] = normalizeSlot(key, value, ctx);
6032
- } else if (value != null) {
6033
- if (!!(process$1.env.NODE_ENV !== "production") && true) {
6034
- warn$1(
6035
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6036
- );
6037
- }
6038
- const normalized = normalizeSlotValue(value);
6039
- slots[key] = () => normalized;
6040
- }
6041
- }
6042
- };
6043
- const normalizeVNodeSlots = (instance, children) => {
6044
- if (!!(process$1.env.NODE_ENV !== "production") && !isKeepAlive(instance.vnode) && true) {
6045
- warn$1(
6046
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
6047
- );
6048
- }
6049
- const normalized = normalizeSlotValue(children);
6050
- instance.slots.default = () => normalized;
6051
- };
6052
- const assignSlots = (slots, children, optimized) => {
6053
- for (const key in children) {
6054
- if (optimized || !isInternalKey(key)) {
6055
- slots[key] = children[key];
6056
- }
6057
- }
6058
- };
6059
- const initSlots = (instance, children, optimized) => {
6060
- const slots = instance.slots = createInternalObject();
6061
- if (instance.vnode.shapeFlag & 32) {
6062
- const type = children._;
6063
- if (type) {
6064
- assignSlots(slots, children, optimized);
6065
- if (optimized) {
6066
- def(slots, "_", type, true);
6067
- }
6068
- } else {
6069
- normalizeObjectSlots(children, slots);
6070
- }
6071
- } else if (children) {
6072
- normalizeVNodeSlots(instance, children);
6073
- }
6074
- };
6075
- const updateSlots = (instance, children, optimized) => {
6076
- const { vnode, slots } = instance;
6077
- let needDeletionCheck = true;
6078
- let deletionComparisonTarget = EMPTY_OBJ;
6079
- if (vnode.shapeFlag & 32) {
6080
- const type = children._;
6081
- if (type) {
6082
- if (!!(process$1.env.NODE_ENV !== "production") && isHmrUpdating) {
6083
- assignSlots(slots, children, optimized);
6084
- trigger(instance, "set", "$slots");
6085
- } else if (optimized && type === 1) {
6086
- needDeletionCheck = false;
6087
- } else {
6088
- assignSlots(slots, children, optimized);
6089
- }
6090
- } else {
6091
- needDeletionCheck = !children.$stable;
6092
- normalizeObjectSlots(children, slots);
6093
- }
6094
- deletionComparisonTarget = children;
6095
- } else if (children) {
6096
- normalizeVNodeSlots(instance, children);
6097
- deletionComparisonTarget = { default: 1 };
6098
- }
6099
- if (needDeletionCheck) {
6100
- for (const key in slots) {
6101
- if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
6102
- delete slots[key];
6103
- }
6104
- }
6105
- }
6106
- };
6107
- let supported;
6108
- let perf;
6109
- function startMeasure(instance, type) {
6110
- if (instance.appContext.config.performance && isSupported()) {
6111
- perf.mark(`vue-${type}-${instance.uid}`);
6112
- }
6113
- if (!!(process$1.env.NODE_ENV !== "production") || false) {
6114
- devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
6115
- }
6116
- }
6117
- function endMeasure(instance, type) {
6118
- if (instance.appContext.config.performance && isSupported()) {
6119
- const startTag = `vue-${type}-${instance.uid}`;
6120
- const endTag = startTag + `:end`;
6121
- const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
6122
- perf.mark(endTag);
6123
- perf.measure(measureName, startTag, endTag);
6124
- perf.clearMeasures(measureName);
6125
- perf.clearMarks(startTag);
6126
- perf.clearMarks(endTag);
6127
- }
6128
- if (!!(process$1.env.NODE_ENV !== "production") || false) {
6129
- devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
6130
- }
6131
- }
6132
- function isSupported() {
6133
- if (supported !== void 0) {
6134
- return supported;
6135
- }
6136
- if (typeof window !== "undefined" && window.performance) {
6137
- supported = true;
6138
- perf = window.performance;
6139
- } else {
6140
- supported = false;
6141
- }
6142
- return supported;
6143
- }
6144
- function initFeatureFlags() {
6145
- const needWarn = [];
6146
- if (!!(process$1.env.NODE_ENV !== "production") && needWarn.length) {
6147
- const multi = needWarn.length > 1;
6148
- console.warn(
6149
- `Feature flag${multi ? `s` : ``} ${needWarn.join(", ")} ${multi ? `are` : `is`} not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.
6150
-
6151
- For more details, see https://link.vuejs.org/feature-flags.`
6152
- );
6153
- }
6154
- }
6155
- const queuePostRenderEffect = queueEffectWithSuspense;
6156
- function createRenderer(options) {
6157
- return baseCreateRenderer(options);
6158
- }
6159
- function baseCreateRenderer(options, createHydrationFns) {
6160
- {
6161
- initFeatureFlags();
6162
- }
6163
- const target = getGlobalThis();
6164
- target.__VUE__ = true;
6165
- if (!!(process$1.env.NODE_ENV !== "production") || false) {
6166
- setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
6167
- }
5562
+ const queuePostRenderEffect = queueEffectWithSuspense;
5563
+ function createRenderer(options) {
5564
+ return baseCreateRenderer(options);
5565
+ }
5566
+ function baseCreateRenderer(options, createHydrationFns) {
5567
+ {
5568
+ initFeatureFlags();
5569
+ }
5570
+ const target = getGlobalThis();
5571
+ target.__VUE__ = true;
5572
+ if (!!(process$1.env.NODE_ENV !== "production") || false) {
5573
+ setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
5574
+ }
6168
5575
  const {
6169
5576
  insert: hostInsert,
6170
5577
  remove: hostRemove,
@@ -7285,362 +6692,913 @@ function baseCreateRenderer(options, createHydrationFns) {
7285
6692
  return;
7286
6693
  }
7287
6694
  if (type === Fragment) {
7288
- hostInsert(el, container, anchor);
7289
- for (let i = 0; i < children.length; i++) {
7290
- move(children[i], container, anchor, moveType);
6695
+ hostInsert(el, container, anchor);
6696
+ for (let i = 0; i < children.length; i++) {
6697
+ move(children[i], container, anchor, moveType);
6698
+ }
6699
+ hostInsert(vnode.anchor, container, anchor);
6700
+ return;
6701
+ }
6702
+ if (type === Static) {
6703
+ moveStaticNode(vnode, container, anchor);
6704
+ return;
6705
+ }
6706
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
6707
+ if (needTransition2) {
6708
+ if (moveType === 0) {
6709
+ transition.beforeEnter(el);
6710
+ hostInsert(el, container, anchor);
6711
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
6712
+ } else {
6713
+ const { leave, delayLeave, afterLeave } = transition;
6714
+ const remove22 = () => {
6715
+ if (vnode.ctx.isUnmounted) {
6716
+ hostRemove(el);
6717
+ } else {
6718
+ hostInsert(el, container, anchor);
6719
+ }
6720
+ };
6721
+ const performLeave = () => {
6722
+ if (el._isLeaving) {
6723
+ el[leaveCbKey](
6724
+ true
6725
+ /* cancelled */
6726
+ );
6727
+ }
6728
+ leave(el, () => {
6729
+ remove22();
6730
+ afterLeave && afterLeave();
6731
+ });
6732
+ };
6733
+ if (delayLeave) {
6734
+ delayLeave(el, remove22, performLeave);
6735
+ } else {
6736
+ performLeave();
6737
+ }
6738
+ }
6739
+ } else {
6740
+ hostInsert(el, container, anchor);
6741
+ }
6742
+ };
6743
+ const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
6744
+ const {
6745
+ type,
6746
+ props,
6747
+ ref: ref3,
6748
+ children,
6749
+ dynamicChildren,
6750
+ shapeFlag,
6751
+ patchFlag,
6752
+ dirs,
6753
+ cacheIndex
6754
+ } = vnode;
6755
+ if (patchFlag === -2) {
6756
+ optimized = false;
6757
+ }
6758
+ if (ref3 != null) {
6759
+ pauseTracking();
6760
+ setRef(ref3, null, parentSuspense, vnode, true);
6761
+ resetTracking();
6762
+ }
6763
+ if (cacheIndex != null) {
6764
+ parentComponent.renderCache[cacheIndex] = void 0;
6765
+ }
6766
+ if (shapeFlag & 256) {
6767
+ parentComponent.ctx.deactivate(vnode);
6768
+ return;
6769
+ }
6770
+ const shouldInvokeDirs = shapeFlag & 1 && dirs;
6771
+ const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
6772
+ let vnodeHook;
6773
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
6774
+ invokeVNodeHook(vnodeHook, parentComponent, vnode);
6775
+ }
6776
+ if (shapeFlag & 6) {
6777
+ unmountComponent(vnode.component, parentSuspense, doRemove);
6778
+ } else {
6779
+ if (shapeFlag & 128) {
6780
+ vnode.suspense.unmount(parentSuspense, doRemove);
6781
+ return;
6782
+ }
6783
+ if (shouldInvokeDirs) {
6784
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
6785
+ }
6786
+ if (shapeFlag & 64) {
6787
+ vnode.type.remove(
6788
+ vnode,
6789
+ parentComponent,
6790
+ parentSuspense,
6791
+ internals,
6792
+ doRemove
6793
+ );
6794
+ } else if (dynamicChildren && // #5154
6795
+ // when v-once is used inside a block, setBlockTracking(-1) marks the
6796
+ // parent block with hasOnce: true
6797
+ // so that it doesn't take the fast path during unmount - otherwise
6798
+ // components nested in v-once are never unmounted.
6799
+ !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
6800
+ (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
6801
+ unmountChildren(
6802
+ dynamicChildren,
6803
+ parentComponent,
6804
+ parentSuspense,
6805
+ false,
6806
+ true
6807
+ );
6808
+ } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
6809
+ unmountChildren(children, parentComponent, parentSuspense);
6810
+ }
6811
+ if (doRemove) {
6812
+ remove2(vnode);
6813
+ }
6814
+ }
6815
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
6816
+ queuePostRenderEffect(() => {
6817
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6818
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
6819
+ }, parentSuspense);
6820
+ }
6821
+ };
6822
+ const remove2 = (vnode) => {
6823
+ const { type, el, anchor, transition } = vnode;
6824
+ if (type === Fragment) {
6825
+ if (!!(process$1.env.NODE_ENV !== "production") && vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
6826
+ vnode.children.forEach((child) => {
6827
+ if (child.type === Comment) {
6828
+ hostRemove(child.el);
6829
+ } else {
6830
+ remove2(child);
6831
+ }
6832
+ });
6833
+ } else {
6834
+ removeFragment(el, anchor);
7291
6835
  }
7292
- hostInsert(vnode.anchor, container, anchor);
7293
6836
  return;
7294
6837
  }
7295
6838
  if (type === Static) {
7296
- moveStaticNode(vnode, container, anchor);
6839
+ removeStaticNode(vnode);
7297
6840
  return;
7298
6841
  }
7299
- const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
7300
- if (needTransition2) {
7301
- if (moveType === 0) {
7302
- transition.beforeEnter(el);
7303
- hostInsert(el, container, anchor);
7304
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
6842
+ const performRemove = () => {
6843
+ hostRemove(el);
6844
+ if (transition && !transition.persisted && transition.afterLeave) {
6845
+ transition.afterLeave();
6846
+ }
6847
+ };
6848
+ if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
6849
+ const { leave, delayLeave } = transition;
6850
+ const performLeave = () => leave(el, performRemove);
6851
+ if (delayLeave) {
6852
+ delayLeave(vnode.el, performRemove, performLeave);
7305
6853
  } else {
7306
- const { leave, delayLeave, afterLeave } = transition;
7307
- const remove22 = () => {
7308
- if (vnode.ctx.isUnmounted) {
7309
- hostRemove(el);
7310
- } else {
7311
- hostInsert(el, container, anchor);
7312
- }
7313
- };
7314
- const performLeave = () => {
7315
- if (el._isLeaving) {
7316
- el[leaveCbKey](
7317
- true
7318
- /* cancelled */
7319
- );
7320
- }
7321
- leave(el, () => {
7322
- remove22();
7323
- afterLeave && afterLeave();
7324
- });
7325
- };
7326
- if (delayLeave) {
7327
- delayLeave(el, remove22, performLeave);
7328
- } else {
7329
- performLeave();
7330
- }
6854
+ performLeave();
7331
6855
  }
7332
6856
  } else {
7333
- hostInsert(el, container, anchor);
6857
+ performRemove();
7334
6858
  }
7335
6859
  };
7336
- const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
7337
- const {
7338
- type,
7339
- props,
7340
- ref: ref3,
7341
- children,
7342
- dynamicChildren,
7343
- shapeFlag,
7344
- patchFlag,
7345
- dirs,
7346
- cacheIndex
7347
- } = vnode;
7348
- if (patchFlag === -2) {
7349
- optimized = false;
6860
+ const removeFragment = (cur, end) => {
6861
+ let next;
6862
+ while (cur !== end) {
6863
+ next = hostNextSibling(cur);
6864
+ hostRemove(cur);
6865
+ cur = next;
7350
6866
  }
7351
- if (ref3 != null) {
7352
- pauseTracking();
7353
- setRef(ref3, null, parentSuspense, vnode, true);
7354
- resetTracking();
6867
+ hostRemove(end);
6868
+ };
6869
+ const unmountComponent = (instance, parentSuspense, doRemove) => {
6870
+ if (!!(process$1.env.NODE_ENV !== "production") && instance.type.__hmrId) {
6871
+ unregisterHMR(instance);
6872
+ }
6873
+ const { bum, scope, job, subTree, um, m, a } = instance;
6874
+ invalidateMount(m);
6875
+ invalidateMount(a);
6876
+ if (bum) {
6877
+ invokeArrayFns(bum);
6878
+ }
6879
+ scope.stop();
6880
+ if (job) {
6881
+ job.flags |= 8;
6882
+ unmount(subTree, instance, parentSuspense, doRemove);
6883
+ }
6884
+ if (um) {
6885
+ queuePostRenderEffect(um, parentSuspense);
6886
+ }
6887
+ queuePostRenderEffect(() => {
6888
+ instance.isUnmounted = true;
6889
+ }, parentSuspense);
6890
+ if (!!(process$1.env.NODE_ENV !== "production") || false) {
6891
+ devtoolsComponentRemoved(instance);
6892
+ }
6893
+ };
6894
+ const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
6895
+ for (let i = start; i < children.length; i++) {
6896
+ unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
6897
+ }
6898
+ };
6899
+ const getNextHostNode = (vnode) => {
6900
+ if (vnode.shapeFlag & 6) {
6901
+ return getNextHostNode(vnode.component.subTree);
6902
+ }
6903
+ if (vnode.shapeFlag & 128) {
6904
+ return vnode.suspense.next();
6905
+ }
6906
+ const el = hostNextSibling(vnode.anchor || vnode.el);
6907
+ const teleportEnd = el && el[TeleportEndKey];
6908
+ return teleportEnd ? hostNextSibling(teleportEnd) : el;
6909
+ };
6910
+ let isFlushing = false;
6911
+ const render = (vnode, container, namespace) => {
6912
+ if (vnode == null) {
6913
+ if (container._vnode) {
6914
+ unmount(container._vnode, null, null, true);
6915
+ }
6916
+ } else {
6917
+ patch(
6918
+ container._vnode || null,
6919
+ vnode,
6920
+ container,
6921
+ null,
6922
+ null,
6923
+ null,
6924
+ namespace
6925
+ );
6926
+ }
6927
+ container._vnode = vnode;
6928
+ if (!isFlushing) {
6929
+ isFlushing = true;
6930
+ flushPreFlushCbs();
6931
+ flushPostFlushCbs();
6932
+ isFlushing = false;
6933
+ }
6934
+ };
6935
+ const internals = {
6936
+ p: patch,
6937
+ um: unmount,
6938
+ m: move,
6939
+ r: remove2,
6940
+ mt: mountComponent,
6941
+ mc: mountChildren,
6942
+ pc: patchChildren,
6943
+ pbc: patchBlockChildren,
6944
+ n: getNextHostNode,
6945
+ o: options
6946
+ };
6947
+ let hydrate;
6948
+ return {
6949
+ render,
6950
+ hydrate,
6951
+ createApp: createAppAPI(render)
6952
+ };
6953
+ }
6954
+ function resolveChildrenNamespace({ type, props }, currentNamespace) {
6955
+ return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
6956
+ }
6957
+ function toggleRecurse({ effect: effect2, job }, allowed) {
6958
+ if (allowed) {
6959
+ effect2.flags |= 32;
6960
+ job.flags |= 4;
6961
+ } else {
6962
+ effect2.flags &= -33;
6963
+ job.flags &= -5;
6964
+ }
6965
+ }
6966
+ function needTransition(parentSuspense, transition) {
6967
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
6968
+ }
6969
+ function traverseStaticChildren(n1, n2, shallow = false) {
6970
+ const ch1 = n1.children;
6971
+ const ch2 = n2.children;
6972
+ if (isArray(ch1) && isArray(ch2)) {
6973
+ for (let i = 0; i < ch1.length; i++) {
6974
+ const c1 = ch1[i];
6975
+ let c2 = ch2[i];
6976
+ if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
6977
+ if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
6978
+ c2 = ch2[i] = cloneIfMounted(ch2[i]);
6979
+ c2.el = c1.el;
6980
+ }
6981
+ if (!shallow && c2.patchFlag !== -2)
6982
+ traverseStaticChildren(c1, c2);
6983
+ }
6984
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
6985
+ c2.patchFlag !== -1) {
6986
+ c2.el = c1.el;
6987
+ }
6988
+ if (c2.type === Comment && !c2.el) {
6989
+ c2.el = c1.el;
6990
+ }
6991
+ if (!!(process$1.env.NODE_ENV !== "production")) {
6992
+ c2.el && (c2.el.__vnode = c2);
6993
+ }
6994
+ }
6995
+ }
6996
+ }
6997
+ function getSequence(arr) {
6998
+ const p2 = arr.slice();
6999
+ const result = [0];
7000
+ let i, j, u, v, c;
7001
+ const len = arr.length;
7002
+ for (i = 0; i < len; i++) {
7003
+ const arrI = arr[i];
7004
+ if (arrI !== 0) {
7005
+ j = result[result.length - 1];
7006
+ if (arr[j] < arrI) {
7007
+ p2[i] = j;
7008
+ result.push(i);
7009
+ continue;
7010
+ }
7011
+ u = 0;
7012
+ v = result.length - 1;
7013
+ while (u < v) {
7014
+ c = u + v >> 1;
7015
+ if (arr[result[c]] < arrI) {
7016
+ u = c + 1;
7017
+ } else {
7018
+ v = c;
7019
+ }
7020
+ }
7021
+ if (arrI < arr[result[u]]) {
7022
+ if (u > 0) {
7023
+ p2[i] = result[u - 1];
7024
+ }
7025
+ result[u] = i;
7026
+ }
7027
+ }
7028
+ }
7029
+ u = result.length;
7030
+ v = result[u - 1];
7031
+ while (u-- > 0) {
7032
+ result[u] = v;
7033
+ v = p2[v];
7034
+ }
7035
+ return result;
7036
+ }
7037
+ function locateNonHydratedAsyncRoot(instance) {
7038
+ const subComponent = instance.subTree.component;
7039
+ if (subComponent) {
7040
+ if (subComponent.asyncDep && !subComponent.asyncResolved) {
7041
+ return subComponent;
7042
+ } else {
7043
+ return locateNonHydratedAsyncRoot(subComponent);
7355
7044
  }
7356
- if (cacheIndex != null) {
7357
- parentComponent.renderCache[cacheIndex] = void 0;
7045
+ }
7046
+ }
7047
+ function invalidateMount(hooks) {
7048
+ if (hooks) {
7049
+ for (let i = 0; i < hooks.length; i++)
7050
+ hooks[i].flags |= 8;
7051
+ }
7052
+ }
7053
+ const ssrContextKey = Symbol.for("v-scx");
7054
+ const useSSRContext = () => {
7055
+ {
7056
+ const ctx = inject(ssrContextKey);
7057
+ if (!ctx) {
7058
+ !!(process$1.env.NODE_ENV !== "production") && warn$1(
7059
+ `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
7060
+ );
7358
7061
  }
7359
- if (shapeFlag & 256) {
7360
- parentComponent.ctx.deactivate(vnode);
7361
- return;
7062
+ return ctx;
7063
+ }
7064
+ };
7065
+ function watchEffect(effect2, options) {
7066
+ return doWatch(effect2, null, options);
7067
+ }
7068
+ function watch(source, cb, options) {
7069
+ if (!!(process$1.env.NODE_ENV !== "production") && !isFunction(cb)) {
7070
+ warn$1(
7071
+ `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
7072
+ );
7073
+ }
7074
+ return doWatch(source, cb, options);
7075
+ }
7076
+ function doWatch(source, cb, options = EMPTY_OBJ) {
7077
+ const { immediate, deep, flush, once } = options;
7078
+ if (!!(process$1.env.NODE_ENV !== "production") && !cb) {
7079
+ if (immediate !== void 0) {
7080
+ warn$1(
7081
+ `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
7082
+ );
7362
7083
  }
7363
- const shouldInvokeDirs = shapeFlag & 1 && dirs;
7364
- const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
7365
- let vnodeHook;
7366
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
7367
- invokeVNodeHook(vnodeHook, parentComponent, vnode);
7084
+ if (deep !== void 0) {
7085
+ warn$1(
7086
+ `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
7087
+ );
7368
7088
  }
7369
- if (shapeFlag & 6) {
7370
- unmountComponent(vnode.component, parentSuspense, doRemove);
7371
- } else {
7372
- if (shapeFlag & 128) {
7373
- vnode.suspense.unmount(parentSuspense, doRemove);
7374
- return;
7375
- }
7376
- if (shouldInvokeDirs) {
7377
- invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
7378
- }
7379
- if (shapeFlag & 64) {
7380
- vnode.type.remove(
7381
- vnode,
7382
- parentComponent,
7383
- parentSuspense,
7384
- internals,
7385
- doRemove
7386
- );
7387
- } else if (dynamicChildren && // #5154
7388
- // when v-once is used inside a block, setBlockTracking(-1) marks the
7389
- // parent block with hasOnce: true
7390
- // so that it doesn't take the fast path during unmount - otherwise
7391
- // components nested in v-once are never unmounted.
7392
- !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
7393
- (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
7394
- unmountChildren(
7395
- dynamicChildren,
7396
- parentComponent,
7397
- parentSuspense,
7398
- false,
7399
- true
7400
- );
7401
- } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
7402
- unmountChildren(children, parentComponent, parentSuspense);
7403
- }
7404
- if (doRemove) {
7405
- remove2(vnode);
7406
- }
7089
+ if (once !== void 0) {
7090
+ warn$1(
7091
+ `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
7092
+ );
7407
7093
  }
7408
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
7409
- queuePostRenderEffect(() => {
7410
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7411
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
7412
- }, parentSuspense);
7094
+ }
7095
+ const baseWatchOptions = extend({}, options);
7096
+ if (!!(process$1.env.NODE_ENV !== "production")) baseWatchOptions.onWarn = warn$1;
7097
+ const runsImmediately = cb && immediate || !cb && flush !== "post";
7098
+ let ssrCleanup;
7099
+ if (isInSSRComponentSetup) {
7100
+ if (flush === "sync") {
7101
+ const ctx = useSSRContext();
7102
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
7103
+ } else if (!runsImmediately) {
7104
+ const watchStopHandle = () => {
7105
+ };
7106
+ watchStopHandle.stop = NOOP;
7107
+ watchStopHandle.resume = NOOP;
7108
+ watchStopHandle.pause = NOOP;
7109
+ return watchStopHandle;
7413
7110
  }
7414
- };
7415
- const remove2 = (vnode) => {
7416
- const { type, el, anchor, transition } = vnode;
7417
- if (type === Fragment) {
7418
- if (!!(process$1.env.NODE_ENV !== "production") && vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
7419
- vnode.children.forEach((child) => {
7420
- if (child.type === Comment) {
7421
- hostRemove(child.el);
7422
- } else {
7423
- remove2(child);
7424
- }
7425
- });
7111
+ }
7112
+ const instance = currentInstance;
7113
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
7114
+ let isPre = false;
7115
+ if (flush === "post") {
7116
+ baseWatchOptions.scheduler = (job) => {
7117
+ queuePostRenderEffect(job, instance && instance.suspense);
7118
+ };
7119
+ } else if (flush !== "sync") {
7120
+ isPre = true;
7121
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
7122
+ if (isFirstRun) {
7123
+ job();
7426
7124
  } else {
7427
- removeFragment(el, anchor);
7428
- }
7429
- return;
7430
- }
7431
- if (type === Static) {
7432
- removeStaticNode(vnode);
7433
- return;
7434
- }
7435
- const performRemove = () => {
7436
- hostRemove(el);
7437
- if (transition && !transition.persisted && transition.afterLeave) {
7438
- transition.afterLeave();
7125
+ queueJob(job);
7439
7126
  }
7440
7127
  };
7441
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
7442
- const { leave, delayLeave } = transition;
7443
- const performLeave = () => leave(el, performRemove);
7444
- if (delayLeave) {
7445
- delayLeave(vnode.el, performRemove, performLeave);
7446
- } else {
7447
- performLeave();
7128
+ }
7129
+ baseWatchOptions.augmentJob = (job) => {
7130
+ if (cb) {
7131
+ job.flags |= 4;
7132
+ }
7133
+ if (isPre) {
7134
+ job.flags |= 2;
7135
+ if (instance) {
7136
+ job.id = instance.uid;
7137
+ job.i = instance;
7448
7138
  }
7449
- } else {
7450
- performRemove();
7451
7139
  }
7452
7140
  };
7453
- const removeFragment = (cur, end) => {
7454
- let next;
7455
- while (cur !== end) {
7456
- next = hostNextSibling(cur);
7457
- hostRemove(cur);
7458
- cur = next;
7141
+ const watchHandle = watch$1(source, cb, baseWatchOptions);
7142
+ if (isInSSRComponentSetup) {
7143
+ if (ssrCleanup) {
7144
+ ssrCleanup.push(watchHandle);
7145
+ } else if (runsImmediately) {
7146
+ watchHandle();
7459
7147
  }
7460
- hostRemove(end);
7148
+ }
7149
+ return watchHandle;
7150
+ }
7151
+ function instanceWatch(source, value, options) {
7152
+ const publicThis = this.proxy;
7153
+ const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
7154
+ let cb;
7155
+ if (isFunction(value)) {
7156
+ cb = value;
7157
+ } else {
7158
+ cb = value.handler;
7159
+ options = value;
7160
+ }
7161
+ const reset = setCurrentInstance(this);
7162
+ const res = doWatch(getter, cb.bind(publicThis), options);
7163
+ reset();
7164
+ return res;
7165
+ }
7166
+ function createPathGetter(ctx, path) {
7167
+ const segments = path.split(".");
7168
+ return () => {
7169
+ let cur = ctx;
7170
+ for (let i = 0; i < segments.length && cur; i++) {
7171
+ cur = cur[segments[i]];
7172
+ }
7173
+ return cur;
7461
7174
  };
7462
- const unmountComponent = (instance, parentSuspense, doRemove) => {
7463
- if (!!(process$1.env.NODE_ENV !== "production") && instance.type.__hmrId) {
7464
- unregisterHMR(instance);
7175
+ }
7176
+ const getModelModifiers = (props, modelName) => {
7177
+ return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
7178
+ };
7179
+ function emit(instance, event, ...rawArgs) {
7180
+ if (instance.isUnmounted) return;
7181
+ const props = instance.vnode.props || EMPTY_OBJ;
7182
+ if (!!(process$1.env.NODE_ENV !== "production")) {
7183
+ const {
7184
+ emitsOptions,
7185
+ propsOptions: [propsOptions]
7186
+ } = instance;
7187
+ if (emitsOptions) {
7188
+ if (!(event in emitsOptions) && true) {
7189
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
7190
+ warn$1(
7191
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
7192
+ );
7193
+ }
7194
+ } else {
7195
+ const validator = emitsOptions[event];
7196
+ if (isFunction(validator)) {
7197
+ const isValid = validator(...rawArgs);
7198
+ if (!isValid) {
7199
+ warn$1(
7200
+ `Invalid event arguments: event validation failed for event "${event}".`
7201
+ );
7202
+ }
7203
+ }
7204
+ }
7205
+ }
7206
+ }
7207
+ let args = rawArgs;
7208
+ const isModelListener2 = event.startsWith("update:");
7209
+ const modifiers = isModelListener2 && getModelModifiers(props, event.slice(7));
7210
+ if (modifiers) {
7211
+ if (modifiers.trim) {
7212
+ args = rawArgs.map((a) => isString(a) ? a.trim() : a);
7465
7213
  }
7466
- const { bum, scope, job, subTree, um, m, a } = instance;
7467
- invalidateMount(m);
7468
- invalidateMount(a);
7469
- if (bum) {
7470
- invokeArrayFns(bum);
7214
+ if (modifiers.number) {
7215
+ args = rawArgs.map(looseToNumber);
7471
7216
  }
7472
- scope.stop();
7473
- if (job) {
7474
- job.flags |= 8;
7475
- unmount(subTree, instance, parentSuspense, doRemove);
7217
+ }
7218
+ if (!!(process$1.env.NODE_ENV !== "production") || false) {
7219
+ devtoolsComponentEmit(instance, event, args);
7220
+ }
7221
+ if (!!(process$1.env.NODE_ENV !== "production")) {
7222
+ const lowerCaseEvent = event.toLowerCase();
7223
+ if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
7224
+ warn$1(
7225
+ `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
7226
+ instance,
7227
+ instance.type
7228
+ )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
7229
+ event
7230
+ )}" instead of "${event}".`
7231
+ );
7476
7232
  }
7477
- if (um) {
7478
- queuePostRenderEffect(um, parentSuspense);
7233
+ }
7234
+ let handlerName;
7235
+ let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
7236
+ props[handlerName = toHandlerKey(camelize(event))];
7237
+ if (!handler && isModelListener2) {
7238
+ handler = props[handlerName = toHandlerKey(hyphenate(event))];
7239
+ }
7240
+ if (handler) {
7241
+ callWithAsyncErrorHandling(
7242
+ handler,
7243
+ instance,
7244
+ 6,
7245
+ args
7246
+ );
7247
+ }
7248
+ const onceHandler = props[handlerName + `Once`];
7249
+ if (onceHandler) {
7250
+ if (!instance.emitted) {
7251
+ instance.emitted = {};
7252
+ } else if (instance.emitted[handlerName]) {
7253
+ return;
7479
7254
  }
7480
- queuePostRenderEffect(() => {
7481
- instance.isUnmounted = true;
7482
- }, parentSuspense);
7483
- if (!!(process$1.env.NODE_ENV !== "production") || false) {
7484
- devtoolsComponentRemoved(instance);
7255
+ instance.emitted[handlerName] = true;
7256
+ callWithAsyncErrorHandling(
7257
+ onceHandler,
7258
+ instance,
7259
+ 6,
7260
+ args
7261
+ );
7262
+ }
7263
+ }
7264
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
7265
+ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
7266
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
7267
+ const cached = cache.get(comp);
7268
+ if (cached !== void 0) {
7269
+ return cached;
7270
+ }
7271
+ const raw = comp.emits;
7272
+ let normalized = {};
7273
+ let hasExtends = false;
7274
+ if (!isFunction(comp)) {
7275
+ const extendEmits = (raw2) => {
7276
+ const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
7277
+ if (normalizedFromExtend) {
7278
+ hasExtends = true;
7279
+ extend(normalized, normalizedFromExtend);
7280
+ }
7281
+ };
7282
+ if (!asMixin && appContext.mixins.length) {
7283
+ appContext.mixins.forEach(extendEmits);
7485
7284
  }
7486
- };
7487
- const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
7488
- for (let i = start; i < children.length; i++) {
7489
- unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
7285
+ if (comp.extends) {
7286
+ extendEmits(comp.extends);
7490
7287
  }
7491
- };
7492
- const getNextHostNode = (vnode) => {
7493
- if (vnode.shapeFlag & 6) {
7494
- return getNextHostNode(vnode.component.subTree);
7288
+ if (comp.mixins) {
7289
+ comp.mixins.forEach(extendEmits);
7495
7290
  }
7496
- if (vnode.shapeFlag & 128) {
7497
- return vnode.suspense.next();
7291
+ }
7292
+ if (!raw && !hasExtends) {
7293
+ if (isObject(comp)) {
7294
+ cache.set(comp, null);
7498
7295
  }
7499
- const el = hostNextSibling(vnode.anchor || vnode.el);
7500
- const teleportEnd = el && el[TeleportEndKey];
7501
- return teleportEnd ? hostNextSibling(teleportEnd) : el;
7502
- };
7503
- let isFlushing = false;
7504
- const render = (vnode, container, namespace) => {
7505
- if (vnode == null) {
7506
- if (container._vnode) {
7507
- unmount(container._vnode, null, null, true);
7508
- }
7296
+ return null;
7297
+ }
7298
+ if (isArray(raw)) {
7299
+ raw.forEach((key) => normalized[key] = null);
7300
+ } else {
7301
+ extend(normalized, raw);
7302
+ }
7303
+ if (isObject(comp)) {
7304
+ cache.set(comp, normalized);
7305
+ }
7306
+ return normalized;
7307
+ }
7308
+ function isEmitListener(options, key) {
7309
+ if (!options || !isOn(key)) {
7310
+ return false;
7311
+ }
7312
+ key = key.slice(2).replace(/Once$/, "");
7313
+ return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
7314
+ }
7315
+ let accessedAttrs = false;
7316
+ function markAttrsAccessed() {
7317
+ accessedAttrs = true;
7318
+ }
7319
+ function renderComponentRoot(instance) {
7320
+ const {
7321
+ type: Component,
7322
+ vnode,
7323
+ proxy,
7324
+ withProxy,
7325
+ propsOptions: [propsOptions],
7326
+ slots,
7327
+ attrs,
7328
+ emit: emit2,
7329
+ render,
7330
+ renderCache,
7331
+ props,
7332
+ data,
7333
+ setupState,
7334
+ ctx,
7335
+ inheritAttrs
7336
+ } = instance;
7337
+ const prev = setCurrentRenderingInstance(instance);
7338
+ let result;
7339
+ let fallthroughAttrs;
7340
+ if (!!(process$1.env.NODE_ENV !== "production")) {
7341
+ accessedAttrs = false;
7342
+ }
7343
+ try {
7344
+ if (vnode.shapeFlag & 4) {
7345
+ const proxyToUse = withProxy || proxy;
7346
+ const thisProxy = !!(process$1.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
7347
+ get(target, key, receiver) {
7348
+ warn$1(
7349
+ `Property '${String(
7350
+ key
7351
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
7352
+ );
7353
+ return Reflect.get(target, key, receiver);
7354
+ }
7355
+ }) : proxyToUse;
7356
+ result = normalizeVNode(
7357
+ render.call(
7358
+ thisProxy,
7359
+ proxyToUse,
7360
+ renderCache,
7361
+ !!(process$1.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
7362
+ setupState,
7363
+ data,
7364
+ ctx
7365
+ )
7366
+ );
7367
+ fallthroughAttrs = attrs;
7509
7368
  } else {
7510
- patch(
7511
- container._vnode || null,
7512
- vnode,
7513
- container,
7514
- null,
7515
- null,
7516
- null,
7517
- namespace
7369
+ const render2 = Component;
7370
+ if (!!(process$1.env.NODE_ENV !== "production") && attrs === props) {
7371
+ markAttrsAccessed();
7372
+ }
7373
+ result = normalizeVNode(
7374
+ render2.length > 1 ? render2(
7375
+ !!(process$1.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
7376
+ !!(process$1.env.NODE_ENV !== "production") ? {
7377
+ get attrs() {
7378
+ markAttrsAccessed();
7379
+ return shallowReadonly(attrs);
7380
+ },
7381
+ slots,
7382
+ emit: emit2
7383
+ } : { attrs, slots, emit: emit2 }
7384
+ ) : render2(
7385
+ !!(process$1.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
7386
+ null
7387
+ )
7388
+ );
7389
+ fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
7390
+ }
7391
+ } catch (err) {
7392
+ blockStack.length = 0;
7393
+ handleError(err, instance, 1);
7394
+ result = createVNode(Comment);
7395
+ }
7396
+ let root = result;
7397
+ let setRoot = void 0;
7398
+ if (!!(process$1.env.NODE_ENV !== "production") && result.patchFlag > 0 && result.patchFlag & 2048) {
7399
+ [root, setRoot] = getChildRoot(result);
7400
+ }
7401
+ if (fallthroughAttrs && inheritAttrs !== false) {
7402
+ const keys = Object.keys(fallthroughAttrs);
7403
+ const { shapeFlag } = root;
7404
+ if (keys.length) {
7405
+ if (shapeFlag & (1 | 6)) {
7406
+ if (propsOptions && keys.some(isModelListener)) {
7407
+ fallthroughAttrs = filterModelListeners(
7408
+ fallthroughAttrs,
7409
+ propsOptions
7410
+ );
7411
+ }
7412
+ root = cloneVNode(root, fallthroughAttrs, false, true);
7413
+ } else if (!!(process$1.env.NODE_ENV !== "production") && !accessedAttrs && root.type !== Comment) {
7414
+ const allAttrs = Object.keys(attrs);
7415
+ const eventAttrs = [];
7416
+ const extraAttrs = [];
7417
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
7418
+ const key = allAttrs[i];
7419
+ if (isOn(key)) {
7420
+ if (!isModelListener(key)) {
7421
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
7422
+ }
7423
+ } else {
7424
+ extraAttrs.push(key);
7425
+ }
7426
+ }
7427
+ if (extraAttrs.length) {
7428
+ warn$1(
7429
+ `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
7430
+ );
7431
+ }
7432
+ if (eventAttrs.length) {
7433
+ warn$1(
7434
+ `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
7435
+ );
7436
+ }
7437
+ }
7438
+ }
7439
+ }
7440
+ if (vnode.dirs) {
7441
+ if (!!(process$1.env.NODE_ENV !== "production") && !isElementRoot(root)) {
7442
+ warn$1(
7443
+ `Runtime directive used on component with non-element root node. The directives will not function as intended.`
7518
7444
  );
7519
7445
  }
7520
- container._vnode = vnode;
7521
- if (!isFlushing) {
7522
- isFlushing = true;
7523
- flushPreFlushCbs();
7524
- flushPostFlushCbs();
7525
- isFlushing = false;
7446
+ root = cloneVNode(root, null, false, true);
7447
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
7448
+ }
7449
+ if (vnode.transition) {
7450
+ if (!!(process$1.env.NODE_ENV !== "production") && !isElementRoot(root)) {
7451
+ warn$1(
7452
+ `Component inside <Transition> renders non-element root node that cannot be animated.`
7453
+ );
7526
7454
  }
7527
- };
7528
- const internals = {
7529
- p: patch,
7530
- um: unmount,
7531
- m: move,
7532
- r: remove2,
7533
- mt: mountComponent,
7534
- mc: mountChildren,
7535
- pc: patchChildren,
7536
- pbc: patchBlockChildren,
7537
- n: getNextHostNode,
7538
- o: options
7539
- };
7540
- let hydrate;
7541
- return {
7542
- render,
7543
- hydrate,
7544
- createApp: createAppAPI(render)
7545
- };
7546
- }
7547
- function resolveChildrenNamespace({ type, props }, currentNamespace) {
7548
- return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
7549
- }
7550
- function toggleRecurse({ effect: effect2, job }, allowed) {
7551
- if (allowed) {
7552
- effect2.flags |= 32;
7553
- job.flags |= 4;
7455
+ setTransitionHooks(root, vnode.transition);
7456
+ }
7457
+ if (!!(process$1.env.NODE_ENV !== "production") && setRoot) {
7458
+ setRoot(root);
7554
7459
  } else {
7555
- effect2.flags &= -33;
7556
- job.flags &= -5;
7460
+ result = root;
7557
7461
  }
7462
+ setCurrentRenderingInstance(prev);
7463
+ return result;
7558
7464
  }
7559
- function needTransition(parentSuspense, transition) {
7560
- return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
7561
- }
7562
- function traverseStaticChildren(n1, n2, shallow = false) {
7563
- const ch1 = n1.children;
7564
- const ch2 = n2.children;
7565
- if (isArray(ch1) && isArray(ch2)) {
7566
- for (let i = 0; i < ch1.length; i++) {
7567
- const c1 = ch1[i];
7568
- let c2 = ch2[i];
7569
- if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
7570
- if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
7571
- c2 = ch2[i] = cloneIfMounted(ch2[i]);
7572
- c2.el = c1.el;
7573
- }
7574
- if (!shallow && c2.patchFlag !== -2)
7575
- traverseStaticChildren(c1, c2);
7576
- }
7577
- if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
7578
- c2.patchFlag !== -1) {
7579
- c2.el = c1.el;
7580
- }
7581
- if (c2.type === Comment && !c2.el) {
7582
- c2.el = c1.el;
7465
+ const getChildRoot = (vnode) => {
7466
+ const rawChildren = vnode.children;
7467
+ const dynamicChildren = vnode.dynamicChildren;
7468
+ const childRoot = filterSingleRoot(rawChildren, false);
7469
+ if (!childRoot) {
7470
+ return [vnode, void 0];
7471
+ } else if (!!(process$1.env.NODE_ENV !== "production") && childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
7472
+ return getChildRoot(childRoot);
7473
+ }
7474
+ const index = rawChildren.indexOf(childRoot);
7475
+ const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
7476
+ const setRoot = (updatedRoot) => {
7477
+ rawChildren[index] = updatedRoot;
7478
+ if (dynamicChildren) {
7479
+ if (dynamicIndex > -1) {
7480
+ dynamicChildren[dynamicIndex] = updatedRoot;
7481
+ } else if (updatedRoot.patchFlag > 0) {
7482
+ vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
7583
7483
  }
7584
- if (!!(process$1.env.NODE_ENV !== "production")) {
7585
- c2.el && (c2.el.__vnode = c2);
7484
+ }
7485
+ };
7486
+ return [normalizeVNode(childRoot), setRoot];
7487
+ };
7488
+ function filterSingleRoot(children, recurse = true) {
7489
+ let singleRoot;
7490
+ for (let i = 0; i < children.length; i++) {
7491
+ const child = children[i];
7492
+ if (isVNode(child)) {
7493
+ if (child.type !== Comment || child.children === "v-if") {
7494
+ if (singleRoot) {
7495
+ return;
7496
+ } else {
7497
+ singleRoot = child;
7498
+ if (!!(process$1.env.NODE_ENV !== "production") && recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
7499
+ return filterSingleRoot(singleRoot.children);
7500
+ }
7501
+ }
7586
7502
  }
7503
+ } else {
7504
+ return;
7587
7505
  }
7588
7506
  }
7507
+ return singleRoot;
7589
7508
  }
7590
- function getSequence(arr) {
7591
- const p2 = arr.slice();
7592
- const result = [0];
7593
- let i, j, u, v, c;
7594
- const len = arr.length;
7595
- for (i = 0; i < len; i++) {
7596
- const arrI = arr[i];
7597
- if (arrI !== 0) {
7598
- j = result[result.length - 1];
7599
- if (arr[j] < arrI) {
7600
- p2[i] = j;
7601
- result.push(i);
7602
- continue;
7509
+ const getFunctionalFallthrough = (attrs) => {
7510
+ let res;
7511
+ for (const key in attrs) {
7512
+ if (key === "class" || key === "style" || isOn(key)) {
7513
+ (res || (res = {}))[key] = attrs[key];
7514
+ }
7515
+ }
7516
+ return res;
7517
+ };
7518
+ const filterModelListeners = (attrs, props) => {
7519
+ const res = {};
7520
+ for (const key in attrs) {
7521
+ if (!isModelListener(key) || !(key.slice(9) in props)) {
7522
+ res[key] = attrs[key];
7523
+ }
7524
+ }
7525
+ return res;
7526
+ };
7527
+ const isElementRoot = (vnode) => {
7528
+ return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
7529
+ };
7530
+ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
7531
+ const { props: prevProps, children: prevChildren, component } = prevVNode;
7532
+ const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
7533
+ const emits = component.emitsOptions;
7534
+ if (!!(process$1.env.NODE_ENV !== "production") && (prevChildren || nextChildren) && isHmrUpdating) {
7535
+ return true;
7536
+ }
7537
+ if (nextVNode.dirs || nextVNode.transition) {
7538
+ return true;
7539
+ }
7540
+ if (optimized && patchFlag >= 0) {
7541
+ if (patchFlag & 1024) {
7542
+ return true;
7543
+ }
7544
+ if (patchFlag & 16) {
7545
+ if (!prevProps) {
7546
+ return !!nextProps;
7603
7547
  }
7604
- u = 0;
7605
- v = result.length - 1;
7606
- while (u < v) {
7607
- c = u + v >> 1;
7608
- if (arr[result[c]] < arrI) {
7609
- u = c + 1;
7610
- } else {
7611
- v = c;
7548
+ return hasPropsChanged(prevProps, nextProps, emits);
7549
+ } else if (patchFlag & 8) {
7550
+ const dynamicProps = nextVNode.dynamicProps;
7551
+ for (let i = 0; i < dynamicProps.length; i++) {
7552
+ const key = dynamicProps[i];
7553
+ if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
7554
+ return true;
7612
7555
  }
7613
7556
  }
7614
- if (arrI < arr[result[u]]) {
7615
- if (u > 0) {
7616
- p2[i] = result[u - 1];
7617
- }
7618
- result[u] = i;
7557
+ }
7558
+ } else {
7559
+ if (prevChildren || nextChildren) {
7560
+ if (!nextChildren || !nextChildren.$stable) {
7561
+ return true;
7619
7562
  }
7620
7563
  }
7564
+ if (prevProps === nextProps) {
7565
+ return false;
7566
+ }
7567
+ if (!prevProps) {
7568
+ return !!nextProps;
7569
+ }
7570
+ if (!nextProps) {
7571
+ return true;
7572
+ }
7573
+ return hasPropsChanged(prevProps, nextProps, emits);
7621
7574
  }
7622
- u = result.length;
7623
- v = result[u - 1];
7624
- while (u-- > 0) {
7625
- result[u] = v;
7626
- v = p2[v];
7627
- }
7628
- return result;
7575
+ return false;
7629
7576
  }
7630
- function locateNonHydratedAsyncRoot(instance) {
7631
- const subComponent = instance.subTree.component;
7632
- if (subComponent) {
7633
- if (subComponent.asyncDep && !subComponent.asyncResolved) {
7634
- return subComponent;
7635
- } else {
7636
- return locateNonHydratedAsyncRoot(subComponent);
7577
+ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
7578
+ const nextKeys = Object.keys(nextProps);
7579
+ if (nextKeys.length !== Object.keys(prevProps).length) {
7580
+ return true;
7581
+ }
7582
+ for (let i = 0; i < nextKeys.length; i++) {
7583
+ const key = nextKeys[i];
7584
+ if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
7585
+ return true;
7637
7586
  }
7638
7587
  }
7588
+ return false;
7639
7589
  }
7640
- function invalidateMount(hooks) {
7641
- if (hooks) {
7642
- for (let i = 0; i < hooks.length; i++)
7643
- hooks[i].flags |= 8;
7590
+ function updateHOCHostEl({ vnode, parent }, el) {
7591
+ while (parent) {
7592
+ const root = parent.subTree;
7593
+ if (root.suspense && root.suspense.activeBranch === vnode) {
7594
+ root.el = vnode.el;
7595
+ }
7596
+ if (root === vnode) {
7597
+ (vnode = parent.vnode).el = el;
7598
+ parent = parent.parent;
7599
+ } else {
7600
+ break;
7601
+ }
7644
7602
  }
7645
7603
  }
7646
7604
  const isSuspense = (type) => type.__isSuspense;
@@ -8176,6 +8134,7 @@ function setupComponent(instance, isSSR = false, optimized = false) {
8176
8134
  return setupResult;
8177
8135
  }
8178
8136
  function setupStatefulComponent(instance, isSSR) {
8137
+ var _a;
8179
8138
  const Component = instance.type;
8180
8139
  if (!!(process$1.env.NODE_ENV !== "production")) {
8181
8140
  if (Component.name) {
@@ -8235,7 +8194,7 @@ function setupStatefulComponent(instance, isSSR) {
8235
8194
  } else {
8236
8195
  instance.asyncDep = setupResult;
8237
8196
  if (!!(process$1.env.NODE_ENV !== "production") && !instance.suspense) {
8238
- const name = formatComponentName(instance, Component);
8197
+ const name = (_a = Component.name) != null ? _a : "Anonymous";
8239
8198
  warn$1(
8240
8199
  `Component <${name}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`
8241
8200
  );
@@ -8408,7 +8367,7 @@ function formatComponentName(instance, Component, isRoot = false) {
8408
8367
  name = match[1];
8409
8368
  }
8410
8369
  }
8411
- if (!name && instance) {
8370
+ if (!name && instance && instance.parent) {
8412
8371
  const inferFromRegistry = (registry) => {
8413
8372
  for (const key in registry) {
8414
8373
  if (registry[key] === Component) {
@@ -8416,8 +8375,8 @@ function formatComponentName(instance, Component, isRoot = false) {
8416
8375
  }
8417
8376
  }
8418
8377
  };
8419
- name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry(
8420
- instance.parent.type.components
8378
+ name = inferFromRegistry(
8379
+ instance.components || instance.parent.type.components
8421
8380
  ) || inferFromRegistry(instance.appContext.components);
8422
8381
  }
8423
8382
  return name ? classify(name) : isRoot ? `App` : `Anonymous`;
@@ -8639,7 +8598,7 @@ function initCustomFormatter() {
8639
8598
  window.devtoolsFormatters = [formatter];
8640
8599
  }
8641
8600
  }
8642
- const version = "3.5.25";
8601
+ const version = "3.5.24";
8643
8602
  const warn = !!(process$1.env.NODE_ENV !== "production") ? warn$1 : NOOP;
8644
8603
  !!(process$1.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
8645
8604
  !!(process$1.env.NODE_ENV !== "production") || true ? setDevtoolsHook$1 : NOOP;