1 | var Vue = (function (exports) {
|
2 | 'use strict';
|
3 |
|
4 | |
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | function makeMap(str, expectsLowerCase) {
|
12 | const map = Object.create(null);
|
13 | const list = str.split(',');
|
14 | for (let i = 0; i < list.length; i++) {
|
15 | map[list[i]] = true;
|
16 | }
|
17 | return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
|
18 | }
|
19 |
|
20 | const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
21 | 'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
|
22 | 'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
|
23 | const isGloballyWhitelisted = makeMap(GLOBALS_WHITE_LISTED);
|
24 |
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
37 | const isSpecialBooleanAttr = makeMap(specialBooleanAttrs);
|
38 |
|
39 | function normalizeStyle(value) {
|
40 | if (isArray(value)) {
|
41 | const res = {};
|
42 | for (let i = 0; i < value.length; i++) {
|
43 | const item = value[i];
|
44 | const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
|
45 | if (normalized) {
|
46 | for (const key in normalized) {
|
47 | res[key] = normalized[key];
|
48 | }
|
49 | }
|
50 | }
|
51 | return res;
|
52 | }
|
53 | else if (isObject(value)) {
|
54 | return value;
|
55 | }
|
56 | }
|
57 | const listDelimiterRE = /;(?![^(]*\))/g;
|
58 | const propertyDelimiterRE = /:(.+)/;
|
59 | function parseStringStyle(cssText) {
|
60 | const ret = {};
|
61 | cssText.split(listDelimiterRE).forEach(item => {
|
62 | if (item) {
|
63 | const tmp = item.split(propertyDelimiterRE);
|
64 | tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
65 | }
|
66 | });
|
67 | return ret;
|
68 | }
|
69 | function normalizeClass(value) {
|
70 | let res = '';
|
71 | if (isString(value)) {
|
72 | res = value;
|
73 | }
|
74 | else if (isArray(value)) {
|
75 | for (let i = 0; i < value.length; i++) {
|
76 | const normalized = normalizeClass(value[i]);
|
77 | if (normalized) {
|
78 | res += normalized + ' ';
|
79 | }
|
80 | }
|
81 | }
|
82 | else if (isObject(value)) {
|
83 | for (const name in value) {
|
84 | if (value[name]) {
|
85 | res += name + ' ';
|
86 | }
|
87 | }
|
88 | }
|
89 | return res.trim();
|
90 | }
|
91 |
|
92 |
|
93 |
|
94 | const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
95 | 'header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,' +
|
96 | 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
97 | 'data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,' +
|
98 | 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
99 | 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
100 | 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
101 | 'option,output,progress,select,textarea,details,dialog,menu,' +
|
102 | 'summary,template,blockquote,iframe,tfoot';
|
103 |
|
104 | const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
105 | 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
106 | 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
107 | 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
108 | 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
109 | 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
110 | 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
111 | 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
112 | 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
113 | 'text,textPath,title,tspan,unknown,use,view';
|
114 | const isHTMLTag = makeMap(HTML_TAGS);
|
115 | const isSVGTag = makeMap(SVG_TAGS);
|
116 |
|
117 | function looseCompareArrays(a, b) {
|
118 | if (a.length !== b.length)
|
119 | return false;
|
120 | let equal = true;
|
121 | for (let i = 0; equal && i < a.length; i++) {
|
122 | equal = looseEqual(a[i], b[i]);
|
123 | }
|
124 | return equal;
|
125 | }
|
126 | function looseEqual(a, b) {
|
127 | if (a === b)
|
128 | return true;
|
129 | let aValidType = isDate(a);
|
130 | let bValidType = isDate(b);
|
131 | if (aValidType || bValidType) {
|
132 | return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
133 | }
|
134 | aValidType = isArray(a);
|
135 | bValidType = isArray(b);
|
136 | if (aValidType || bValidType) {
|
137 | return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
138 | }
|
139 | aValidType = isObject(a);
|
140 | bValidType = isObject(b);
|
141 | if (aValidType || bValidType) {
|
142 |
|
143 | if (!aValidType || !bValidType) {
|
144 | return false;
|
145 | }
|
146 | const aKeysCount = Object.keys(a).length;
|
147 | const bKeysCount = Object.keys(b).length;
|
148 | if (aKeysCount !== bKeysCount) {
|
149 | return false;
|
150 | }
|
151 | for (const key in a) {
|
152 | const aHasKey = a.hasOwnProperty(key);
|
153 | const bHasKey = b.hasOwnProperty(key);
|
154 | if ((aHasKey && !bHasKey) ||
|
155 | (!aHasKey && bHasKey) ||
|
156 | !looseEqual(a[key], b[key])) {
|
157 | return false;
|
158 | }
|
159 | }
|
160 | }
|
161 | return String(a) === String(b);
|
162 | }
|
163 | function looseIndexOf(arr, val) {
|
164 | return arr.findIndex(item => looseEqual(item, val));
|
165 | }
|
166 |
|
167 | |
168 |
|
169 |
|
170 |
|
171 | const toDisplayString = (val) => {
|
172 | return val == null
|
173 | ? ''
|
174 | : isObject(val)
|
175 | ? JSON.stringify(val, replacer, 2)
|
176 | : String(val);
|
177 | };
|
178 | const replacer = (_key, val) => {
|
179 | if (isMap(val)) {
|
180 | return {
|
181 | [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
182 | entries[`${key} =>`] = val;
|
183 | return entries;
|
184 | }, {})
|
185 | };
|
186 | }
|
187 | else if (isSet(val)) {
|
188 | return {
|
189 | [`Set(${val.size})`]: [...val.values()]
|
190 | };
|
191 | }
|
192 | else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
193 | return String(val);
|
194 | }
|
195 | return val;
|
196 | };
|
197 |
|
198 | const EMPTY_OBJ = Object.freeze({})
|
199 | ;
|
200 | const EMPTY_ARR = Object.freeze([]) ;
|
201 | const NOOP = () => { };
|
202 | |
203 |
|
204 |
|
205 | const NO = () => false;
|
206 | const onRE = /^on[^a-z]/;
|
207 | const isOn = (key) => onRE.test(key);
|
208 | const isModelListener = (key) => key.startsWith('onUpdate:');
|
209 | const extend = Object.assign;
|
210 | const remove = (arr, el) => {
|
211 | const i = arr.indexOf(el);
|
212 | if (i > -1) {
|
213 | arr.splice(i, 1);
|
214 | }
|
215 | };
|
216 | const hasOwnProperty = Object.prototype.hasOwnProperty;
|
217 | const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
218 | const isArray = Array.isArray;
|
219 | const isMap = (val) => toTypeString(val) === '[object Map]';
|
220 | const isSet = (val) => toTypeString(val) === '[object Set]';
|
221 | const isDate = (val) => val instanceof Date;
|
222 | const isFunction = (val) => typeof val === 'function';
|
223 | const isString = (val) => typeof val === 'string';
|
224 | const isSymbol = (val) => typeof val === 'symbol';
|
225 | const isObject = (val) => val !== null && typeof val === 'object';
|
226 | const isPromise = (val) => {
|
227 | return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
228 | };
|
229 | const objectToString = Object.prototype.toString;
|
230 | const toTypeString = (value) => objectToString.call(value);
|
231 | const toRawType = (value) => {
|
232 |
|
233 | return toTypeString(value).slice(8, -1);
|
234 | };
|
235 | const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
236 | const isIntegerKey = (key) => isString(key) &&
|
237 | key !== 'NaN' &&
|
238 | key[0] !== '-' &&
|
239 | '' + parseInt(key, 10) === key;
|
240 | const isReservedProp = makeMap(
|
241 |
|
242 | ',key,ref,' +
|
243 | 'onVnodeBeforeMount,onVnodeMounted,' +
|
244 | 'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
245 | 'onVnodeBeforeUnmount,onVnodeUnmounted');
|
246 | const cacheStringFunction = (fn) => {
|
247 | const cache = Object.create(null);
|
248 | return ((str) => {
|
249 | const hit = cache[str];
|
250 | return hit || (cache[str] = fn(str));
|
251 | });
|
252 | };
|
253 | const camelizeRE = /-(\w)/g;
|
254 | |
255 |
|
256 |
|
257 | const camelize = cacheStringFunction((str) => {
|
258 | return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
259 | });
|
260 | const hyphenateRE = /\B([A-Z])/g;
|
261 | |
262 |
|
263 |
|
264 | const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
|
265 | |
266 |
|
267 |
|
268 | const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
269 | |
270 |
|
271 |
|
272 | const toHandlerKey = cacheStringFunction((str) => (str ? `on${capitalize(str)}` : ``));
|
273 |
|
274 | const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
|
275 | const invokeArrayFns = (fns, arg) => {
|
276 | for (let i = 0; i < fns.length; i++) {
|
277 | fns[i](arg);
|
278 | }
|
279 | };
|
280 | const def = (obj, key, value) => {
|
281 | Object.defineProperty(obj, key, {
|
282 | configurable: true,
|
283 | enumerable: false,
|
284 | value
|
285 | });
|
286 | };
|
287 | const toNumber = (val) => {
|
288 | const n = parseFloat(val);
|
289 | return isNaN(n) ? val : n;
|
290 | };
|
291 | let _globalThis;
|
292 | const getGlobalThis = () => {
|
293 | return (_globalThis ||
|
294 | (_globalThis =
|
295 | typeof globalThis !== 'undefined'
|
296 | ? globalThis
|
297 | : typeof self !== 'undefined'
|
298 | ? self
|
299 | : typeof window !== 'undefined'
|
300 | ? window
|
301 | : typeof global !== 'undefined'
|
302 | ? global
|
303 | : {}));
|
304 | };
|
305 |
|
306 | const targetMap = new WeakMap();
|
307 | const effectStack = [];
|
308 | let activeEffect;
|
309 | const ITERATE_KEY = Symbol('iterate' );
|
310 | const MAP_KEY_ITERATE_KEY = Symbol('Map key iterate' );
|
311 | function isEffect(fn) {
|
312 | return fn && fn._isEffect === true;
|
313 | }
|
314 | function effect(fn, options = EMPTY_OBJ) {
|
315 | if (isEffect(fn)) {
|
316 | fn = fn.raw;
|
317 | }
|
318 | const effect = createReactiveEffect(fn, options);
|
319 | if (!options.lazy) {
|
320 | effect();
|
321 | }
|
322 | return effect;
|
323 | }
|
324 | function stop(effect) {
|
325 | if (effect.active) {
|
326 | cleanup(effect);
|
327 | if (effect.options.onStop) {
|
328 | effect.options.onStop();
|
329 | }
|
330 | effect.active = false;
|
331 | }
|
332 | }
|
333 | let uid = 0;
|
334 | function createReactiveEffect(fn, options) {
|
335 | const effect = function reactiveEffect() {
|
336 | if (!effect.active) {
|
337 | return fn();
|
338 | }
|
339 | if (!effectStack.includes(effect)) {
|
340 | cleanup(effect);
|
341 | try {
|
342 | enableTracking();
|
343 | effectStack.push(effect);
|
344 | activeEffect = effect;
|
345 | return fn();
|
346 | }
|
347 | finally {
|
348 | effectStack.pop();
|
349 | resetTracking();
|
350 | activeEffect = effectStack[effectStack.length - 1];
|
351 | }
|
352 | }
|
353 | };
|
354 | effect.id = uid++;
|
355 | effect.allowRecurse = !!options.allowRecurse;
|
356 | effect._isEffect = true;
|
357 | effect.active = true;
|
358 | effect.raw = fn;
|
359 | effect.deps = [];
|
360 | effect.options = options;
|
361 | return effect;
|
362 | }
|
363 | function cleanup(effect) {
|
364 | const { deps } = effect;
|
365 | if (deps.length) {
|
366 | for (let i = 0; i < deps.length; i++) {
|
367 | deps[i].delete(effect);
|
368 | }
|
369 | deps.length = 0;
|
370 | }
|
371 | }
|
372 | let shouldTrack = true;
|
373 | const trackStack = [];
|
374 | function pauseTracking() {
|
375 | trackStack.push(shouldTrack);
|
376 | shouldTrack = false;
|
377 | }
|
378 | function enableTracking() {
|
379 | trackStack.push(shouldTrack);
|
380 | shouldTrack = true;
|
381 | }
|
382 | function resetTracking() {
|
383 | const last = trackStack.pop();
|
384 | shouldTrack = last === undefined ? true : last;
|
385 | }
|
386 | function track(target, type, key) {
|
387 | if (!shouldTrack || activeEffect === undefined) {
|
388 | return;
|
389 | }
|
390 | let depsMap = targetMap.get(target);
|
391 | if (!depsMap) {
|
392 | targetMap.set(target, (depsMap = new Map()));
|
393 | }
|
394 | let dep = depsMap.get(key);
|
395 | if (!dep) {
|
396 | depsMap.set(key, (dep = new Set()));
|
397 | }
|
398 | if (!dep.has(activeEffect)) {
|
399 | dep.add(activeEffect);
|
400 | activeEffect.deps.push(dep);
|
401 | if (activeEffect.options.onTrack) {
|
402 | activeEffect.options.onTrack({
|
403 | effect: activeEffect,
|
404 | target,
|
405 | type,
|
406 | key
|
407 | });
|
408 | }
|
409 | }
|
410 | }
|
411 | function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
412 | const depsMap = targetMap.get(target);
|
413 | if (!depsMap) {
|
414 |
|
415 | return;
|
416 | }
|
417 | const effects = new Set();
|
418 | const add = (effectsToAdd) => {
|
419 | if (effectsToAdd) {
|
420 | effectsToAdd.forEach(effect => {
|
421 | if (effect !== activeEffect || effect.allowRecurse) {
|
422 | effects.add(effect);
|
423 | }
|
424 | });
|
425 | }
|
426 | };
|
427 | if (type === "clear" ) {
|
428 |
|
429 |
|
430 | depsMap.forEach(add);
|
431 | }
|
432 | else if (key === 'length' && isArray(target)) {
|
433 | depsMap.forEach((dep, key) => {
|
434 | if (key === 'length' || key >= newValue) {
|
435 | add(dep);
|
436 | }
|
437 | });
|
438 | }
|
439 | else {
|
440 |
|
441 | if (key !== void 0) {
|
442 | add(depsMap.get(key));
|
443 | }
|
444 |
|
445 | switch (type) {
|
446 | case "add" :
|
447 | if (!isArray(target)) {
|
448 | add(depsMap.get(ITERATE_KEY));
|
449 | if (isMap(target)) {
|
450 | add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
451 | }
|
452 | }
|
453 | else if (isIntegerKey(key)) {
|
454 |
|
455 | add(depsMap.get('length'));
|
456 | }
|
457 | break;
|
458 | case "delete" :
|
459 | if (!isArray(target)) {
|
460 | add(depsMap.get(ITERATE_KEY));
|
461 | if (isMap(target)) {
|
462 | add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
463 | }
|
464 | }
|
465 | break;
|
466 | case "set" :
|
467 | if (isMap(target)) {
|
468 | add(depsMap.get(ITERATE_KEY));
|
469 | }
|
470 | break;
|
471 | }
|
472 | }
|
473 | const run = (effect) => {
|
474 | if (effect.options.onTrigger) {
|
475 | effect.options.onTrigger({
|
476 | effect,
|
477 | target,
|
478 | key,
|
479 | type,
|
480 | newValue,
|
481 | oldValue,
|
482 | oldTarget
|
483 | });
|
484 | }
|
485 | if (effect.options.scheduler) {
|
486 | effect.options.scheduler(effect);
|
487 | }
|
488 | else {
|
489 | effect();
|
490 | }
|
491 | };
|
492 | effects.forEach(run);
|
493 | }
|
494 |
|
495 | const isNonTrackableKeys = makeMap(`__proto__,__v_isRef,__isVue`);
|
496 | const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
|
497 | .map(key => Symbol[key])
|
498 | .filter(isSymbol));
|
499 | const get = /*#__PURE__*/ createGetter();
|
500 | const shallowGet = /*#__PURE__*/ createGetter(false, true);
|
501 | const readonlyGet = /*#__PURE__*/ createGetter(true);
|
502 | const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
|
503 | const arrayInstrumentations = {};
|
504 | ['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
|
505 | const method = Array.prototype[key];
|
506 | arrayInstrumentations[key] = function (...args) {
|
507 | const arr = toRaw(this);
|
508 | for (let i = 0, l = this.length; i < l; i++) {
|
509 | track(arr, "get" , i + '');
|
510 | }
|
511 |
|
512 | const res = method.apply(arr, args);
|
513 | if (res === -1 || res === false) {
|
514 |
|
515 | return method.apply(arr, args.map(toRaw));
|
516 | }
|
517 | else {
|
518 | return res;
|
519 | }
|
520 | };
|
521 | });
|
522 | ['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
|
523 | const method = Array.prototype[key];
|
524 | arrayInstrumentations[key] = function (...args) {
|
525 | pauseTracking();
|
526 | const res = method.apply(this, args);
|
527 | resetTracking();
|
528 | return res;
|
529 | };
|
530 | });
|
531 | function createGetter(isReadonly = false, shallow = false) {
|
532 | return function get(target, key, receiver) {
|
533 | if (key === "__v_isReactive" ) {
|
534 | return !isReadonly;
|
535 | }
|
536 | else if (key === "__v_isReadonly" ) {
|
537 | return isReadonly;
|
538 | }
|
539 | else if (key === "__v_raw" &&
|
540 | receiver ===
|
541 | (isReadonly
|
542 | ? shallow
|
543 | ? shallowReadonlyMap
|
544 | : readonlyMap
|
545 | : shallow
|
546 | ? shallowReactiveMap
|
547 | : reactiveMap).get(target)) {
|
548 | return target;
|
549 | }
|
550 | const targetIsArray = isArray(target);
|
551 | if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
552 | return Reflect.get(arrayInstrumentations, key, receiver);
|
553 | }
|
554 | const res = Reflect.get(target, key, receiver);
|
555 | if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
556 | return res;
|
557 | }
|
558 | if (!isReadonly) {
|
559 | track(target, "get" , key);
|
560 | }
|
561 | if (shallow) {
|
562 | return res;
|
563 | }
|
564 | if (isRef(res)) {
|
565 |
|
566 | const shouldUnwrap = !targetIsArray || !isIntegerKey(key);
|
567 | return shouldUnwrap ? res.value : res;
|
568 | }
|
569 | if (isObject(res)) {
|
570 |
|
571 |
|
572 |
|
573 | return isReadonly ? readonly(res) : reactive(res);
|
574 | }
|
575 | return res;
|
576 | };
|
577 | }
|
578 | const set = /*#__PURE__*/ createSetter();
|
579 | const shallowSet = /*#__PURE__*/ createSetter(true);
|
580 | function createSetter(shallow = false) {
|
581 | return function set(target, key, value, receiver) {
|
582 | let oldValue = target[key];
|
583 | if (!shallow) {
|
584 | value = toRaw(value);
|
585 | oldValue = toRaw(oldValue);
|
586 | if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
587 | oldValue.value = value;
|
588 | return true;
|
589 | }
|
590 | }
|
591 | const hadKey = isArray(target) && isIntegerKey(key)
|
592 | ? Number(key) < target.length
|
593 | : hasOwn(target, key);
|
594 | const result = Reflect.set(target, key, value, receiver);
|
595 |
|
596 | if (target === toRaw(receiver)) {
|
597 | if (!hadKey) {
|
598 | trigger(target, "add" , key, value);
|
599 | }
|
600 | else if (hasChanged(value, oldValue)) {
|
601 | trigger(target, "set" , key, value, oldValue);
|
602 | }
|
603 | }
|
604 | return result;
|
605 | };
|
606 | }
|
607 | function deleteProperty(target, key) {
|
608 | const hadKey = hasOwn(target, key);
|
609 | const oldValue = target[key];
|
610 | const result = Reflect.deleteProperty(target, key);
|
611 | if (result && hadKey) {
|
612 | trigger(target, "delete" , key, undefined, oldValue);
|
613 | }
|
614 | return result;
|
615 | }
|
616 | function has(target, key) {
|
617 | const result = Reflect.has(target, key);
|
618 | if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
619 | track(target, "has" , key);
|
620 | }
|
621 | return result;
|
622 | }
|
623 | function ownKeys(target) {
|
624 | track(target, "iterate" , isArray(target) ? 'length' : ITERATE_KEY);
|
625 | return Reflect.ownKeys(target);
|
626 | }
|
627 | const mutableHandlers = {
|
628 | get,
|
629 | set,
|
630 | deleteProperty,
|
631 | has,
|
632 | ownKeys
|
633 | };
|
634 | const readonlyHandlers = {
|
635 | get: readonlyGet,
|
636 | set(target, key) {
|
637 | {
|
638 | console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
639 | }
|
640 | return true;
|
641 | },
|
642 | deleteProperty(target, key) {
|
643 | {
|
644 | console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
645 | }
|
646 | return true;
|
647 | }
|
648 | };
|
649 | const shallowReactiveHandlers = extend({}, mutableHandlers, {
|
650 | get: shallowGet,
|
651 | set: shallowSet
|
652 | });
|
653 | // Props handlers are special in the sense that it should not unwrap top-level
|
654 | // refs (in order to allow refs to be explicitly passed down), but should
|
655 | // retain the reactivity of the normal readonly object.
|
656 | const shallowReadonlyHandlers = extend({}, readonlyHandlers, {
|
657 | get: shallowReadonlyGet
|
658 | });
|
659 |
|
660 | const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
661 | const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
662 | const toShallow = (value) => value;
|
663 | const getProto = (v) => Reflect.getPrototypeOf(v);
|
664 | function get$1(target, key, isReadonly = false, isShallow = false) {
|
665 |
|
666 |
|
667 | target = target["__v_raw" ];
|
668 | const rawTarget = toRaw(target);
|
669 | const rawKey = toRaw(key);
|
670 | if (key !== rawKey) {
|
671 | !isReadonly && track(rawTarget, "get" , key);
|
672 | }
|
673 | !isReadonly && track(rawTarget, "get" , rawKey);
|
674 | const { has } = getProto(rawTarget);
|
675 | const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
676 | if (has.call(rawTarget, key)) {
|
677 | return wrap(target.get(key));
|
678 | }
|
679 | else if (has.call(rawTarget, rawKey)) {
|
680 | return wrap(target.get(rawKey));
|
681 | }
|
682 | else if (target !== rawTarget) {
|
683 |
|
684 |
|
685 | target.get(key);
|
686 | }
|
687 | }
|
688 | function has$1(key, isReadonly = false) {
|
689 | const target = this["__v_raw" ];
|
690 | const rawTarget = toRaw(target);
|
691 | const rawKey = toRaw(key);
|
692 | if (key !== rawKey) {
|
693 | !isReadonly && track(rawTarget, "has" , key);
|
694 | }
|
695 | !isReadonly && track(rawTarget, "has" , rawKey);
|
696 | return key === rawKey
|
697 | ? target.has(key)
|
698 | : target.has(key) || target.has(rawKey);
|
699 | }
|
700 | function size(target, isReadonly = false) {
|
701 | target = target["__v_raw" ];
|
702 | !isReadonly && track(toRaw(target), "iterate" , ITERATE_KEY);
|
703 | return Reflect.get(target, 'size', target);
|
704 | }
|
705 | function add(value) {
|
706 | value = toRaw(value);
|
707 | const target = toRaw(this);
|
708 | const proto = getProto(target);
|
709 | const hadKey = proto.has.call(target, value);
|
710 | if (!hadKey) {
|
711 | target.add(value);
|
712 | trigger(target, "add" , value, value);
|
713 | }
|
714 | return this;
|
715 | }
|
716 | function set$1(key, value) {
|
717 | value = toRaw(value);
|
718 | const target = toRaw(this);
|
719 | const { has, get } = getProto(target);
|
720 | let hadKey = has.call(target, key);
|
721 | if (!hadKey) {
|
722 | key = toRaw(key);
|
723 | hadKey = has.call(target, key);
|
724 | }
|
725 | else {
|
726 | checkIdentityKeys(target, has, key);
|
727 | }
|
728 | const oldValue = get.call(target, key);
|
729 | target.set(key, value);
|
730 | if (!hadKey) {
|
731 | trigger(target, "add" , key, value);
|
732 | }
|
733 | else if (hasChanged(value, oldValue)) {
|
734 | trigger(target, "set" , key, value, oldValue);
|
735 | }
|
736 | return this;
|
737 | }
|
738 | function deleteEntry(key) {
|
739 | const target = toRaw(this);
|
740 | const { has, get } = getProto(target);
|
741 | let hadKey = has.call(target, key);
|
742 | if (!hadKey) {
|
743 | key = toRaw(key);
|
744 | hadKey = has.call(target, key);
|
745 | }
|
746 | else {
|
747 | checkIdentityKeys(target, has, key);
|
748 | }
|
749 | const oldValue = get ? get.call(target, key) : undefined;
|
750 | // forward the operation before queueing reactions
|
751 | const result = target.delete(key);
|
752 | if (hadKey) {
|
753 | trigger(target, "delete" , key, undefined, oldValue);
|
754 | }
|
755 | return result;
|
756 | }
|
757 | function clear() {
|
758 | const target = toRaw(this);
|
759 | const hadItems = target.size !== 0;
|
760 | const oldTarget = isMap(target)
|
761 | ? new Map(target)
|
762 | : new Set(target)
|
763 | ;
|
764 |
|
765 | const result = target.clear();
|
766 | if (hadItems) {
|
767 | trigger(target, "clear" , undefined, undefined, oldTarget);
|
768 | }
|
769 | return result;
|
770 | }
|
771 | function createForEach(isReadonly, isShallow) {
|
772 | return function forEach(callback, thisArg) {
|
773 | const observed = this;
|
774 | const target = observed["__v_raw" ];
|
775 | const rawTarget = toRaw(target);
|
776 | const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
777 | !isReadonly && track(rawTarget, "iterate" , ITERATE_KEY);
|
778 | return target.forEach((value, key) => {
|
779 |
|
780 |
|
781 |
|
782 | return callback.call(thisArg, wrap(value), wrap(key), observed);
|
783 | });
|
784 | };
|
785 | }
|
786 | function createIterableMethod(method, isReadonly, isShallow) {
|
787 | return function (...args) {
|
788 | const target = this["__v_raw" ];
|
789 | const rawTarget = toRaw(target);
|
790 | const targetIsMap = isMap(rawTarget);
|
791 | const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
|
792 | const isKeyOnly = method === 'keys' && targetIsMap;
|
793 | const innerIterator = target[method](...args);
|
794 | const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
795 | !isReadonly &&
|
796 | track(rawTarget, "iterate" , isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
797 |
|
798 |
|
799 | return {
|
800 |
|
801 | next() {
|
802 | const { value, done } = innerIterator.next();
|
803 | return done
|
804 | ? { value, done }
|
805 | : {
|
806 | value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
807 | done
|
808 | };
|
809 | },
|
810 |
|
811 | [Symbol.iterator]() {
|
812 | return this;
|
813 | }
|
814 | };
|
815 | };
|
816 | }
|
817 | function createReadonlyMethod(type) {
|
818 | return function (...args) {
|
819 | {
|
820 | const key = args[0] ? `on key "${args[0]}" ` : ``;
|
821 | console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
822 | }
|
823 | return type === "delete" ? false : this;
|
824 | };
|
825 | }
|
826 | const mutableInstrumentations = {
|
827 | get(key) {
|
828 | return get$1(this, key);
|
829 | },
|
830 | get size() {
|
831 | return size(this);
|
832 | },
|
833 | has: has$1,
|
834 | add,
|
835 | set: set$1,
|
836 | delete: deleteEntry,
|
837 | clear,
|
838 | forEach: createForEach(false, false)
|
839 | };
|
840 | const shallowInstrumentations = {
|
841 | get(key) {
|
842 | return get$1(this, key, false, true);
|
843 | },
|
844 | get size() {
|
845 | return size(this);
|
846 | },
|
847 | has: has$1,
|
848 | add,
|
849 | set: set$1,
|
850 | delete: deleteEntry,
|
851 | clear,
|
852 | forEach: createForEach(false, true)
|
853 | };
|
854 | const readonlyInstrumentations = {
|
855 | get(key) {
|
856 | return get$1(this, key, true);
|
857 | },
|
858 | get size() {
|
859 | return size(this, true);
|
860 | },
|
861 | has(key) {
|
862 | return has$1.call(this, key, true);
|
863 | },
|
864 | add: createReadonlyMethod("add" ),
|
865 | set: createReadonlyMethod("set" /* SET */),
|
866 | delete: createReadonlyMethod("delete" /* DELETE */),
|
867 | clear: createReadonlyMethod("clear" /* CLEAR */),
|
868 | forEach: createForEach(true, false)
|
869 | };
|
870 | const shallowReadonlyInstrumentations = {
|
871 | get(key) {
|
872 | return get$1(this, key, true, true);
|
873 | },
|
874 | get size() {
|
875 | return size(this, true);
|
876 | },
|
877 | has(key) {
|
878 | return has$1.call(this, key, true);
|
879 | },
|
880 | add: createReadonlyMethod("add" ),
|
881 | set: createReadonlyMethod("set" /* SET */),
|
882 | delete: createReadonlyMethod("delete" /* DELETE */),
|
883 | clear: createReadonlyMethod("clear" /* CLEAR */),
|
884 | forEach: createForEach(true, true)
|
885 | };
|
886 | const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
|
887 | iteratorMethods.forEach(method => {
|
888 | mutableInstrumentations[method] = createIterableMethod(method, false, false);
|
889 | readonlyInstrumentations[method] = createIterableMethod(method, true, false);
|
890 | shallowInstrumentations[method] = createIterableMethod(method, false, true);
|
891 | shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
|
892 | });
|
893 | function createInstrumentationGetter(isReadonly, shallow) {
|
894 | const instrumentations = shallow
|
895 | ? isReadonly
|
896 | ? shallowReadonlyInstrumentations
|
897 | : shallowInstrumentations
|
898 | : isReadonly
|
899 | ? readonlyInstrumentations
|
900 | : mutableInstrumentations;
|
901 | return (target, key, receiver) => {
|
902 | if (key === "__v_isReactive" ) {
|
903 | return !isReadonly;
|
904 | }
|
905 | else if (key === "__v_isReadonly" ) {
|
906 | return isReadonly;
|
907 | }
|
908 | else if (key === "__v_raw" ) {
|
909 | return target;
|
910 | }
|
911 | return Reflect.get(hasOwn(instrumentations, key) && key in target
|
912 | ? instrumentations
|
913 | : target, key, receiver);
|
914 | };
|
915 | }
|
916 | const mutableCollectionHandlers = {
|
917 | get: createInstrumentationGetter(false, false)
|
918 | };
|
919 | const shallowCollectionHandlers = {
|
920 | get: createInstrumentationGetter(false, true)
|
921 | };
|
922 | const readonlyCollectionHandlers = {
|
923 | get: createInstrumentationGetter(true, false)
|
924 | };
|
925 | const shallowReadonlyCollectionHandlers = {
|
926 | get: createInstrumentationGetter(true, true)
|
927 | };
|
928 | function checkIdentityKeys(target, has, key) {
|
929 | const rawKey = toRaw(key);
|
930 | if (rawKey !== key && has.call(target, rawKey)) {
|
931 | const type = toRawType(target);
|
932 | console.warn(`Reactive ${type} contains both the raw and reactive ` +
|
933 | `versions of the same object${type === `Map` ? ` as keys` : ``}, ` +
|
934 | `which can lead to inconsistencies. ` +
|
935 | `Avoid differentiating between the raw and reactive versions ` +
|
936 | `of an object and only use the reactive version if possible.`);
|
937 | }
|
938 | }
|
939 |
|
940 | const reactiveMap = new WeakMap();
|
941 | const shallowReactiveMap = new WeakMap();
|
942 | const readonlyMap = new WeakMap();
|
943 | const shallowReadonlyMap = new WeakMap();
|
944 | function targetTypeMap(rawType) {
|
945 | switch (rawType) {
|
946 | case 'Object':
|
947 | case 'Array':
|
948 | return 1 ;
|
949 | case 'Map':
|
950 | case 'Set':
|
951 | case 'WeakMap':
|
952 | case 'WeakSet':
|
953 | return 2 ;
|
954 | default:
|
955 | return 0 ;
|
956 | }
|
957 | }
|
958 | function getTargetType(value) {
|
959 | return value["__v_skip" ] || !Object.isExtensible(value)
|
960 | ? 0
|
961 | : targetTypeMap(toRawType(value));
|
962 | }
|
963 | function reactive(target) {
|
964 |
|
965 | if (target && target["__v_isReadonly" ]) {
|
966 | return target;
|
967 | }
|
968 | return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
969 | }
|
970 | |
971 |
|
972 |
|
973 |
|
974 |
|
975 | function shallowReactive(target) {
|
976 | return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
|
977 | }
|
978 | |
979 |
|
980 |
|
981 |
|
982 | function readonly(target) {
|
983 | return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
984 | }
|
985 | |
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 | function shallowReadonly(target) {
|
992 | return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
993 | }
|
994 | function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
|
995 | if (!isObject(target)) {
|
996 | {
|
997 | console.warn(`value cannot be made reactive: ${String(target)}`);
|
998 | }
|
999 | return target;
|
1000 | }
|
1001 |
|
1002 |
|
1003 | if (target["__v_raw" ] &&
|
1004 | !(isReadonly && target["__v_isReactive" ])) {
|
1005 | return target;
|
1006 | }
|
1007 |
|
1008 | const existingProxy = proxyMap.get(target);
|
1009 | if (existingProxy) {
|
1010 | return existingProxy;
|
1011 | }
|
1012 |
|
1013 | const targetType = getTargetType(target);
|
1014 | if (targetType === 0 ) {
|
1015 | return target;
|
1016 | }
|
1017 | const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
1018 | proxyMap.set(target, proxy);
|
1019 | return proxy;
|
1020 | }
|
1021 | function isReactive(value) {
|
1022 | if (isReadonly(value)) {
|
1023 | return isReactive(value["__v_raw" ]);
|
1024 | }
|
1025 | return !!(value && value["__v_isReactive" ]);
|
1026 | }
|
1027 | function isReadonly(value) {
|
1028 | return !!(value && value["__v_isReadonly" ]);
|
1029 | }
|
1030 | function isProxy(value) {
|
1031 | return isReactive(value) || isReadonly(value);
|
1032 | }
|
1033 | function toRaw(observed) {
|
1034 | return ((observed && toRaw(observed["__v_raw" ])) || observed);
|
1035 | }
|
1036 | function markRaw(value) {
|
1037 | def(value, "__v_skip" , true);
|
1038 | return value;
|
1039 | }
|
1040 |
|
1041 | const convert = (val) => isObject(val) ? reactive(val) : val;
|
1042 | function isRef(r) {
|
1043 | return Boolean(r && r.__v_isRef === true);
|
1044 | }
|
1045 | function ref(value) {
|
1046 | return createRef(value);
|
1047 | }
|
1048 | function shallowRef(value) {
|
1049 | return createRef(value, true);
|
1050 | }
|
1051 | class RefImpl {
|
1052 | constructor(_rawValue, _shallow = false) {
|
1053 | this._rawValue = _rawValue;
|
1054 | this._shallow = _shallow;
|
1055 | this.__v_isRef = true;
|
1056 | this._value = _shallow ? _rawValue : convert(_rawValue);
|
1057 | }
|
1058 | get value() {
|
1059 | track(toRaw(this), "get" , 'value');
|
1060 | return this._value;
|
1061 | }
|
1062 | set value(newVal) {
|
1063 | if (hasChanged(toRaw(newVal), this._rawValue)) {
|
1064 | this._rawValue = newVal;
|
1065 | this._value = this._shallow ? newVal : convert(newVal);
|
1066 | trigger(toRaw(this), "set" , 'value', newVal);
|
1067 | }
|
1068 | }
|
1069 | }
|
1070 | function createRef(rawValue, shallow = false) {
|
1071 | if (isRef(rawValue)) {
|
1072 | return rawValue;
|
1073 | }
|
1074 | return new RefImpl(rawValue, shallow);
|
1075 | }
|
1076 | function triggerRef(ref) {
|
1077 | trigger(toRaw(ref), "set" , 'value', ref.value );
|
1078 | }
|
1079 | function unref(ref) {
|
1080 | return isRef(ref) ? ref.value : ref;
|
1081 | }
|
1082 | const shallowUnwrapHandlers = {
|
1083 | get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
1084 | set: (target, key, value, receiver) => {
|
1085 | const oldValue = target[key];
|
1086 | if (isRef(oldValue) && !isRef(value)) {
|
1087 | oldValue.value = value;
|
1088 | return true;
|
1089 | }
|
1090 | else {
|
1091 | return Reflect.set(target, key, value, receiver);
|
1092 | }
|
1093 | }
|
1094 | };
|
1095 | function proxyRefs(objectWithRefs) {
|
1096 | return isReactive(objectWithRefs)
|
1097 | ? objectWithRefs
|
1098 | : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
1099 | }
|
1100 | class CustomRefImpl {
|
1101 | constructor(factory) {
|
1102 | this.__v_isRef = true;
|
1103 | const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
1104 | this._get = get;
|
1105 | this._set = set;
|
1106 | }
|
1107 | get value() {
|
1108 | return this._get();
|
1109 | }
|
1110 | set value(newVal) {
|
1111 | this._set(newVal);
|
1112 | }
|
1113 | }
|
1114 | function customRef(factory) {
|
1115 | return new CustomRefImpl(factory);
|
1116 | }
|
1117 | function toRefs(object) {
|
1118 | if (!isProxy(object)) {
|
1119 | console.warn(`toRefs() expects a reactive object but received a plain one.`);
|
1120 | }
|
1121 | const ret = isArray(object) ? new Array(object.length) : {};
|
1122 | for (const key in object) {
|
1123 | ret[key] = toRef(object, key);
|
1124 | }
|
1125 | return ret;
|
1126 | }
|
1127 | class ObjectRefImpl {
|
1128 | constructor(_object, _key) {
|
1129 | this._object = _object;
|
1130 | this._key = _key;
|
1131 | this.__v_isRef = true;
|
1132 | }
|
1133 | get value() {
|
1134 | return this._object[this._key];
|
1135 | }
|
1136 | set value(newVal) {
|
1137 | this._object[this._key] = newVal;
|
1138 | }
|
1139 | }
|
1140 | function toRef(object, key) {
|
1141 | return isRef(object[key])
|
1142 | ? object[key]
|
1143 | : new ObjectRefImpl(object, key);
|
1144 | }
|
1145 |
|
1146 | class ComputedRefImpl {
|
1147 | constructor(getter, _setter, isReadonly) {
|
1148 | this._setter = _setter;
|
1149 | this._dirty = true;
|
1150 | this.__v_isRef = true;
|
1151 | this.effect = effect(getter, {
|
1152 | lazy: true,
|
1153 | scheduler: () => {
|
1154 | if (!this._dirty) {
|
1155 | this._dirty = true;
|
1156 | trigger(toRaw(this), "set" , 'value');
|
1157 | }
|
1158 | }
|
1159 | });
|
1160 | this["__v_isReadonly" ] = isReadonly;
|
1161 | }
|
1162 | get value() {
|
1163 |
|
1164 | const self = toRaw(this);
|
1165 | if (self._dirty) {
|
1166 | self._value = this.effect();
|
1167 | self._dirty = false;
|
1168 | }
|
1169 | track(self, "get" , 'value');
|
1170 | return self._value;
|
1171 | }
|
1172 | set value(newValue) {
|
1173 | this._setter(newValue);
|
1174 | }
|
1175 | }
|
1176 | function computed(getterOrOptions) {
|
1177 | let getter;
|
1178 | let setter;
|
1179 | if (isFunction(getterOrOptions)) {
|
1180 | getter = getterOrOptions;
|
1181 | setter = () => {
|
1182 | console.warn('Write operation failed: computed value is readonly');
|
1183 | }
|
1184 | ;
|
1185 | }
|
1186 | else {
|
1187 | getter = getterOrOptions.get;
|
1188 | setter = getterOrOptions.set;
|
1189 | }
|
1190 | return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
|
1191 | }
|
1192 |
|
1193 | const stack = [];
|
1194 | function pushWarningContext(vnode) {
|
1195 | stack.push(vnode);
|
1196 | }
|
1197 | function popWarningContext() {
|
1198 | stack.pop();
|
1199 | }
|
1200 | function warn(msg, ...args) {
|
1201 |
|
1202 |
|
1203 | pauseTracking();
|
1204 | const instance = stack.length ? stack[stack.length - 1].component : null;
|
1205 | const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
1206 | const trace = getComponentTrace();
|
1207 | if (appWarnHandler) {
|
1208 | callWithErrorHandling(appWarnHandler, instance, 11 , [
|
1209 | msg + args.join(''),
|
1210 | instance && instance.proxy,
|
1211 | trace
|
1212 | .map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`)
|
1213 | .join('\n'),
|
1214 | trace
|
1215 | ]);
|
1216 | }
|
1217 | else {
|
1218 | const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
1219 |
|
1220 | if (trace.length &&
|
1221 |
|
1222 | !false) {
|
1223 | warnArgs.push(`\n`, ...formatTrace(trace));
|
1224 | }
|
1225 | console.warn(...warnArgs);
|
1226 | }
|
1227 | resetTracking();
|
1228 | }
|
1229 | function getComponentTrace() {
|
1230 | let currentVNode = stack[stack.length - 1];
|
1231 | if (!currentVNode) {
|
1232 | return [];
|
1233 | }
|
1234 |
|
1235 |
|
1236 |
|
1237 | const normalizedStack = [];
|
1238 | while (currentVNode) {
|
1239 | const last = normalizedStack[0];
|
1240 | if (last && last.vnode === currentVNode) {
|
1241 | last.recurseCount++;
|
1242 | }
|
1243 | else {
|
1244 | normalizedStack.push({
|
1245 | vnode: currentVNode,
|
1246 | recurseCount: 0
|
1247 | });
|
1248 | }
|
1249 | const parentInstance = currentVNode.component && currentVNode.component.parent;
|
1250 | currentVNode = parentInstance && parentInstance.vnode;
|
1251 | }
|
1252 | return normalizedStack;
|
1253 | }
|
1254 |
|
1255 | function formatTrace(trace) {
|
1256 | const logs = [];
|
1257 | trace.forEach((entry, i) => {
|
1258 | logs.push(...(i === 0 ? [] : [`\n`]), ...formatTraceEntry(entry));
|
1259 | });
|
1260 | return logs;
|
1261 | }
|
1262 | function formatTraceEntry({ vnode, recurseCount }) {
|
1263 | const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
1264 | const isRoot = vnode.component ? vnode.component.parent == null : false;
|
1265 | const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;
|
1266 | const close = `>` + postfix;
|
1267 | return vnode.props
|
1268 | ? [open, ...formatProps(vnode.props), close]
|
1269 | : [open + close];
|
1270 | }
|
1271 |
|
1272 | function formatProps(props) {
|
1273 | const res = [];
|
1274 | const keys = Object.keys(props);
|
1275 | keys.slice(0, 3).forEach(key => {
|
1276 | res.push(...formatProp(key, props[key]));
|
1277 | });
|
1278 | if (keys.length > 3) {
|
1279 | res.push(` ...`);
|
1280 | }
|
1281 | return res;
|
1282 | }
|
1283 |
|
1284 | function formatProp(key, value, raw) {
|
1285 | if (isString(value)) {
|
1286 | value = JSON.stringify(value);
|
1287 | return raw ? value : [`${key}=${value}`];
|
1288 | }
|
1289 | else if (typeof value === 'number' ||
|
1290 | typeof value === 'boolean' ||
|
1291 | value == null) {
|
1292 | return raw ? value : [`${key}=${value}`];
|
1293 | }
|
1294 | else if (isRef(value)) {
|
1295 | value = formatProp(key, toRaw(value.value), true);
|
1296 | return raw ? value : [`${key}=Ref<`, value, `>`];
|
1297 | }
|
1298 | else if (isFunction(value)) {
|
1299 | return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
1300 | }
|
1301 | else {
|
1302 | value = toRaw(value);
|
1303 | return raw ? value : [`${key}=`, value];
|
1304 | }
|
1305 | }
|
1306 |
|
1307 | const ErrorTypeStrings = {
|
1308 | ["bc" ]: 'beforeCreate hook',
|
1309 | ["c" ]: 'created hook',
|
1310 | ["bm" ]: 'beforeMount hook',
|
1311 | ["m" ]: 'mounted hook',
|
1312 | ["bu" ]: 'beforeUpdate hook',
|
1313 | ["u" ]: 'updated',
|
1314 | ["bum" ]: 'beforeUnmount hook',
|
1315 | ["um" ]: 'unmounted hook',
|
1316 | ["a" ]: 'activated hook',
|
1317 | ["da" ]: 'deactivated hook',
|
1318 | ["ec" ]: 'errorCaptured hook',
|
1319 | ["rtc" ]: 'renderTracked hook',
|
1320 | ["rtg" ]: 'renderTriggered hook',
|
1321 | [0 ]: 'setup function',
|
1322 | [1 ]: 'render function',
|
1323 | [2 ]: 'watcher getter',
|
1324 | [3 ]: 'watcher callback',
|
1325 | [4 ]: 'watcher cleanup function',
|
1326 | [5 ]: 'native event handler',
|
1327 | [6 ]: 'component event handler',
|
1328 | [7 ]: 'vnode hook',
|
1329 | [8 ]: 'directive hook',
|
1330 | [9 ]: 'transition hook',
|
1331 | [10 ]: 'app errorHandler',
|
1332 | [11 ]: 'app warnHandler',
|
1333 | [12 ]: 'ref function',
|
1334 | [13 ]: 'async component loader',
|
1335 | [14 ]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
1336 | 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next'
|
1337 | };
|
1338 | function callWithErrorHandling(fn, instance, type, args) {
|
1339 | let res;
|
1340 | try {
|
1341 | res = args ? fn(...args) : fn();
|
1342 | }
|
1343 | catch (err) {
|
1344 | handleError(err, instance, type);
|
1345 | }
|
1346 | return res;
|
1347 | }
|
1348 | function callWithAsyncErrorHandling(fn, instance, type, args) {
|
1349 | if (isFunction(fn)) {
|
1350 | const res = callWithErrorHandling(fn, instance, type, args);
|
1351 | if (res && isPromise(res)) {
|
1352 | res.catch(err => {
|
1353 | handleError(err, instance, type);
|
1354 | });
|
1355 | }
|
1356 | return res;
|
1357 | }
|
1358 | const values = [];
|
1359 | for (let i = 0; i < fn.length; i++) {
|
1360 | values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
1361 | }
|
1362 | return values;
|
1363 | }
|
1364 | function handleError(err, instance, type, throwInDev = true) {
|
1365 | const contextVNode = instance ? instance.vnode : null;
|
1366 | if (instance) {
|
1367 | let cur = instance.parent;
|
1368 |
|
1369 | const exposedInstance = instance.proxy;
|
1370 |
|
1371 | const errorInfo = ErrorTypeStrings[type] ;
|
1372 | while (cur) {
|
1373 | const errorCapturedHooks = cur.ec;
|
1374 | if (errorCapturedHooks) {
|
1375 | for (let i = 0; i < errorCapturedHooks.length; i++) {
|
1376 | if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
1377 | return;
|
1378 | }
|
1379 | }
|
1380 | }
|
1381 | cur = cur.parent;
|
1382 | }
|
1383 |
|
1384 | const appErrorHandler = instance.appContext.config.errorHandler;
|
1385 | if (appErrorHandler) {
|
1386 | callWithErrorHandling(appErrorHandler, null, 10 , [err, exposedInstance, errorInfo]);
|
1387 | return;
|
1388 | }
|
1389 | }
|
1390 | logError(err, type, contextVNode, throwInDev);
|
1391 | }
|
1392 | function logError(err, type, contextVNode, throwInDev = true) {
|
1393 | {
|
1394 | const info = ErrorTypeStrings[type];
|
1395 | if (contextVNode) {
|
1396 | pushWarningContext(contextVNode);
|
1397 | }
|
1398 | warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
1399 | if (contextVNode) {
|
1400 | popWarningContext();
|
1401 | }
|
1402 |
|
1403 | if (throwInDev) {
|
1404 | throw err;
|
1405 | }
|
1406 | else {
|
1407 | console.error(err);
|
1408 | }
|
1409 | }
|
1410 | }
|
1411 |
|
1412 | let isFlushing = false;
|
1413 | let isFlushPending = false;
|
1414 | const queue = [];
|
1415 | let flushIndex = 0;
|
1416 | const pendingPreFlushCbs = [];
|
1417 | let activePreFlushCbs = null;
|
1418 | let preFlushIndex = 0;
|
1419 | const pendingPostFlushCbs = [];
|
1420 | let activePostFlushCbs = null;
|
1421 | let postFlushIndex = 0;
|
1422 | const resolvedPromise = Promise.resolve();
|
1423 | let currentFlushPromise = null;
|
1424 | let currentPreFlushParentJob = null;
|
1425 | const RECURSION_LIMIT = 100;
|
1426 | function nextTick(fn) {
|
1427 | const p = currentFlushPromise || resolvedPromise;
|
1428 | return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
1429 | }
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 | function findInsertionIndex(job) {
|
1435 |
|
1436 | let start = flushIndex + 1;
|
1437 | let end = queue.length;
|
1438 | const jobId = getId(job);
|
1439 | while (start < end) {
|
1440 | const middle = (start + end) >>> 1;
|
1441 | const middleJobId = getId(queue[middle]);
|
1442 | middleJobId < jobId ? (start = middle + 1) : (end = middle);
|
1443 | }
|
1444 | return start;
|
1445 | }
|
1446 | function queueJob(job) {
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 | if ((!queue.length ||
|
1454 | !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) &&
|
1455 | job !== currentPreFlushParentJob) {
|
1456 | const pos = findInsertionIndex(job);
|
1457 | if (pos > -1) {
|
1458 | queue.splice(pos, 0, job);
|
1459 | }
|
1460 | else {
|
1461 | queue.push(job);
|
1462 | }
|
1463 | queueFlush();
|
1464 | }
|
1465 | }
|
1466 | function queueFlush() {
|
1467 | if (!isFlushing && !isFlushPending) {
|
1468 | isFlushPending = true;
|
1469 | currentFlushPromise = resolvedPromise.then(flushJobs);
|
1470 | }
|
1471 | }
|
1472 | function invalidateJob(job) {
|
1473 | const i = queue.indexOf(job);
|
1474 | if (i > flushIndex) {
|
1475 | queue.splice(i, 1);
|
1476 | }
|
1477 | }
|
1478 | function queueCb(cb, activeQueue, pendingQueue, index) {
|
1479 | if (!isArray(cb)) {
|
1480 | if (!activeQueue ||
|
1481 | !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
|
1482 | pendingQueue.push(cb);
|
1483 | }
|
1484 | }
|
1485 | else {
|
1486 |
|
1487 |
|
1488 |
|
1489 | pendingQueue.push(...cb);
|
1490 | }
|
1491 | queueFlush();
|
1492 | }
|
1493 | function queuePreFlushCb(cb) {
|
1494 | queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
|
1495 | }
|
1496 | function queuePostFlushCb(cb) {
|
1497 | queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
|
1498 | }
|
1499 | function flushPreFlushCbs(seen, parentJob = null) {
|
1500 | if (pendingPreFlushCbs.length) {
|
1501 | currentPreFlushParentJob = parentJob;
|
1502 | activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
|
1503 | pendingPreFlushCbs.length = 0;
|
1504 | {
|
1505 | seen = seen || new Map();
|
1506 | }
|
1507 | for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
|
1508 | if (checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex])) {
|
1509 | continue;
|
1510 | }
|
1511 | activePreFlushCbs[preFlushIndex]();
|
1512 | }
|
1513 | activePreFlushCbs = null;
|
1514 | preFlushIndex = 0;
|
1515 | currentPreFlushParentJob = null;
|
1516 |
|
1517 | flushPreFlushCbs(seen, parentJob);
|
1518 | }
|
1519 | }
|
1520 | function flushPostFlushCbs(seen) {
|
1521 | if (pendingPostFlushCbs.length) {
|
1522 | const deduped = [...new Set(pendingPostFlushCbs)];
|
1523 | pendingPostFlushCbs.length = 0;
|
1524 |
|
1525 | if (activePostFlushCbs) {
|
1526 | activePostFlushCbs.push(...deduped);
|
1527 | return;
|
1528 | }
|
1529 | activePostFlushCbs = deduped;
|
1530 | {
|
1531 | seen = seen || new Map();
|
1532 | }
|
1533 | activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
|
1534 | for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
1535 | if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
|
1536 | continue;
|
1537 | }
|
1538 | activePostFlushCbs[postFlushIndex]();
|
1539 | }
|
1540 | activePostFlushCbs = null;
|
1541 | postFlushIndex = 0;
|
1542 | }
|
1543 | }
|
1544 | const getId = (job) => job.id == null ? Infinity : job.id;
|
1545 | function flushJobs(seen) {
|
1546 | isFlushPending = false;
|
1547 | isFlushing = true;
|
1548 | {
|
1549 | seen = seen || new Map();
|
1550 | }
|
1551 | flushPreFlushCbs(seen);
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 | queue.sort((a, b) => getId(a) - getId(b));
|
1560 | try {
|
1561 | for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
1562 | const job = queue[flushIndex];
|
1563 | if (job && job.active !== false) {
|
1564 | if (true && checkRecursiveUpdates(seen, job)) {
|
1565 | continue;
|
1566 | }
|
1567 | callWithErrorHandling(job, null, 14 );
|
1568 | }
|
1569 | }
|
1570 | }
|
1571 | finally {
|
1572 | flushIndex = 0;
|
1573 | queue.length = 0;
|
1574 | flushPostFlushCbs(seen);
|
1575 | isFlushing = false;
|
1576 | currentFlushPromise = null;
|
1577 |
|
1578 |
|
1579 | if (queue.length ||
|
1580 | pendingPreFlushCbs.length ||
|
1581 | pendingPostFlushCbs.length) {
|
1582 | flushJobs(seen);
|
1583 | }
|
1584 | }
|
1585 | }
|
1586 | function checkRecursiveUpdates(seen, fn) {
|
1587 | if (!seen.has(fn)) {
|
1588 | seen.set(fn, 1);
|
1589 | }
|
1590 | else {
|
1591 | const count = seen.get(fn);
|
1592 | if (count > RECURSION_LIMIT) {
|
1593 | const instance = fn.ownerInstance;
|
1594 | const componentName = instance && getComponentName(instance.type);
|
1595 | warn(`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. ` +
|
1596 | `This means you have a reactive effect that is mutating its own ` +
|
1597 | `dependencies and thus recursively triggering itself. Possible sources ` +
|
1598 | `include component template, render function, updated hook or ` +
|
1599 | `watcher source function.`);
|
1600 | return true;
|
1601 | }
|
1602 | else {
|
1603 | seen.set(fn, count + 1);
|
1604 | }
|
1605 | }
|
1606 | }
|
1607 |
|
1608 |
|
1609 | let isHmrUpdating = false;
|
1610 | const hmrDirtyComponents = new Set();
|
1611 |
|
1612 |
|
1613 |
|
1614 |
|
1615 |
|
1616 | {
|
1617 | const globalObject = typeof global !== 'undefined'
|
1618 | ? global
|
1619 | : typeof self !== 'undefined'
|
1620 | ? self
|
1621 | : typeof window !== 'undefined'
|
1622 | ? window
|
1623 | : {};
|
1624 | globalObject.__VUE_HMR_RUNTIME__ = {
|
1625 | createRecord: tryWrap(createRecord),
|
1626 | rerender: tryWrap(rerender),
|
1627 | reload: tryWrap(reload)
|
1628 | };
|
1629 | }
|
1630 | const map = new Map();
|
1631 | function registerHMR(instance) {
|
1632 | const id = instance.type.__hmrId;
|
1633 | let record = map.get(id);
|
1634 | if (!record) {
|
1635 | createRecord(id, instance.type);
|
1636 | record = map.get(id);
|
1637 | }
|
1638 | record.instances.add(instance);
|
1639 | }
|
1640 | function unregisterHMR(instance) {
|
1641 | map.get(instance.type.__hmrId).instances.delete(instance);
|
1642 | }
|
1643 | function createRecord(id, component) {
|
1644 | if (!component) {
|
1645 | warn(`HMR API usage is out of date.\n` +
|
1646 | `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
|
1647 | `dependency that handles Vue SFC compilation.`);
|
1648 | component = {};
|
1649 | }
|
1650 | if (map.has(id)) {
|
1651 | return false;
|
1652 | }
|
1653 | map.set(id, {
|
1654 | component: isClassComponent(component) ? component.__vccOpts : component,
|
1655 | instances: new Set()
|
1656 | });
|
1657 | return true;
|
1658 | }
|
1659 | function rerender(id, newRender) {
|
1660 | const record = map.get(id);
|
1661 | if (!record)
|
1662 | return;
|
1663 | if (newRender)
|
1664 | record.component.render = newRender;
|
1665 |
|
1666 |
|
1667 | Array.from(record.instances).forEach(instance => {
|
1668 | if (newRender) {
|
1669 | instance.render = newRender;
|
1670 | }
|
1671 | instance.renderCache = [];
|
1672 |
|
1673 | isHmrUpdating = true;
|
1674 | instance.update();
|
1675 | isHmrUpdating = false;
|
1676 | });
|
1677 | }
|
1678 | function reload(id, newComp) {
|
1679 | const record = map.get(id);
|
1680 | if (!record)
|
1681 | return;
|
1682 |
|
1683 |
|
1684 | const { component, instances } = record;
|
1685 | if (!hmrDirtyComponents.has(component)) {
|
1686 |
|
1687 | newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;
|
1688 | extend(component, newComp);
|
1689 | for (const key in component) {
|
1690 | if (key !== '__file' && !(key in newComp)) {
|
1691 | delete component[key];
|
1692 | }
|
1693 | }
|
1694 |
|
1695 |
|
1696 | hmrDirtyComponents.add(component);
|
1697 |
|
1698 | queuePostFlushCb(() => {
|
1699 | hmrDirtyComponents.delete(component);
|
1700 | });
|
1701 | }
|
1702 | Array.from(instances).forEach(instance => {
|
1703 | if (instance.parent) {
|
1704 |
|
1705 |
|
1706 |
|
1707 | queueJob(instance.parent.update);
|
1708 | }
|
1709 | else if (instance.appContext.reload) {
|
1710 |
|
1711 | instance.appContext.reload();
|
1712 | }
|
1713 | else if (typeof window !== 'undefined') {
|
1714 |
|
1715 | window.location.reload();
|
1716 | }
|
1717 | else {
|
1718 | console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
|
1719 | }
|
1720 | });
|
1721 | }
|
1722 | function tryWrap(fn) {
|
1723 | return (id, arg) => {
|
1724 | try {
|
1725 | return fn(id, arg);
|
1726 | }
|
1727 | catch (e) {
|
1728 | console.error(e);
|
1729 | console.warn(`[HMR] Something went wrong during Vue component hot-reload. ` +
|
1730 | `Full reload required.`);
|
1731 | }
|
1732 | };
|
1733 | }
|
1734 |
|
1735 | function setDevtoolsHook(hook) {
|
1736 | exports.devtools = hook;
|
1737 | }
|
1738 | function devtoolsInitApp(app, version) {
|
1739 |
|
1740 | if (!exports.devtools)
|
1741 | return;
|
1742 | exports.devtools.emit("app:init" , app, version, {
|
1743 | Fragment,
|
1744 | Text,
|
1745 | Comment: Comment$1,
|
1746 | Static
|
1747 | });
|
1748 | }
|
1749 | function devtoolsUnmountApp(app) {
|
1750 | if (!exports.devtools)
|
1751 | return;
|
1752 | exports.devtools.emit("app:unmount" , app);
|
1753 | }
|
1754 | const devtoolsComponentAdded = createDevtoolsComponentHook("component:added" );
|
1755 | const devtoolsComponentUpdated = createDevtoolsComponentHook("component:updated" );
|
1756 | const devtoolsComponentRemoved = createDevtoolsComponentHook("component:removed" );
|
1757 | function createDevtoolsComponentHook(hook) {
|
1758 | return (component) => {
|
1759 | if (!exports.devtools)
|
1760 | return;
|
1761 | exports.devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
|
1762 | };
|
1763 | }
|
1764 | const devtoolsPerfStart = createDevtoolsPerformanceHook("perf:start" );
|
1765 | const devtoolsPerfEnd = createDevtoolsPerformanceHook("perf:end" );
|
1766 | function createDevtoolsPerformanceHook(hook) {
|
1767 | return (component, type, time) => {
|
1768 | if (!exports.devtools)
|
1769 | return;
|
1770 | exports.devtools.emit(hook, component.appContext.app, component.uid, component, type, time);
|
1771 | };
|
1772 | }
|
1773 | function devtoolsComponentEmit(component, event, params) {
|
1774 | if (!exports.devtools)
|
1775 | return;
|
1776 | exports.devtools.emit("component:emit" , component.appContext.app, component, event, params);
|
1777 | }
|
1778 |
|
1779 | const deprecationData = {
|
1780 | ["GLOBAL_MOUNT" ]: {
|
1781 | message: `The global app bootstrapping API has changed: vm.$mount() and the "el" ` +
|
1782 | `option have been removed. Use createApp(RootComponent).mount() instead.`,
|
1783 | link: `https://v3.vuejs.org/guide/migration/global-api.html#mounting-app-instance`
|
1784 | },
|
1785 | ["GLOBAL_MOUNT_CONTAINER" ]: {
|
1786 | message: `Vue detected directives on the mount container. ` +
|
1787 | `In Vue 3, the container is no longer considered part of the template ` +
|
1788 | `and will not be processed/replaced.`,
|
1789 | link: `https://v3.vuejs.org/guide/migration/mount-changes.html`
|
1790 | },
|
1791 | ["GLOBAL_EXTEND" ]: {
|
1792 | message: `Vue.extend() has been removed in Vue 3. ` +
|
1793 | `Use defineComponent() instead.`,
|
1794 | link: `https://v3.vuejs.org/api/global-api.html#definecomponent`
|
1795 | },
|
1796 | ["GLOBAL_PROTOTYPE" ]: {
|
1797 | message: `Vue.prototype is no longer available in Vue 3. ` +
|
1798 | `Use app.config.globalProperties instead.`,
|
1799 | link: `https://v3.vuejs.org/guide/migration/global-api.html#vue-prototype-replaced-by-config-globalproperties`
|
1800 | },
|
1801 | ["GLOBAL_SET" ]: {
|
1802 | message: `Vue.set() has been removed as it is no longer needed in Vue 3. ` +
|
1803 | `Simply use native JavaScript mutations.`
|
1804 | },
|
1805 | ["GLOBAL_DELETE" ]: {
|
1806 | message: `Vue.delete() has been removed as it is no longer needed in Vue 3. ` +
|
1807 | `Simply use native JavaScript mutations.`
|
1808 | },
|
1809 | ["GLOBAL_OBSERVABLE" ]: {
|
1810 | message: `Vue.observable() has been removed. ` +
|
1811 | `Use \`import { reactive } from "vue"\` from Composition API instead.`,
|
1812 | link: `https://v3.vuejs.org/api/basic-reactivity.html`
|
1813 | },
|
1814 | ["GLOBAL_PRIVATE_UTIL" ]: {
|
1815 | message: `Vue.util has been removed. Please refactor to avoid its usage ` +
|
1816 | `since it was an internal API even in Vue 2.`
|
1817 | },
|
1818 | ["CONFIG_SILENT" ]: {
|
1819 | message: `config.silent has been removed because it is not good practice to ` +
|
1820 | `intentionally suppress warnings. You can use your browser console's ` +
|
1821 | `filter features to focus on relevant messages.`
|
1822 | },
|
1823 | ["CONFIG_DEVTOOLS" ]: {
|
1824 | message: `config.devtools has been removed. To enable devtools for ` +
|
1825 | `production, configure the __VUE_PROD_DEVTOOLS__ compile-time flag.`,
|
1826 | link: `https://github.com/vuejs/vue-next/tree/master/packages/vue#bundler-build-feature-flags`
|
1827 | },
|
1828 | ["CONFIG_KEY_CODES" ]: {
|
1829 | message: `config.keyCodes has been removed. ` +
|
1830 | `In Vue 3, you can directly use the kebab-case key names as v-on modifiers.`,
|
1831 | link: `https://v3.vuejs.org/guide/migration/keycode-modifiers.html`
|
1832 | },
|
1833 | ["CONFIG_PRODUCTION_TIP" ]: {
|
1834 | message: `config.productionTip has been removed.`,
|
1835 | link: `https://v3.vuejs.org/guide/migration/global-api.html#config-productiontip-removed`
|
1836 | },
|
1837 | ["CONFIG_IGNORED_ELEMENTS" ]: {
|
1838 | message: () => {
|
1839 | let msg = `config.ignoredElements has been removed.`;
|
1840 | if (isRuntimeOnly()) {
|
1841 | msg += ` Pass the "isCustomElement" option to @vue/compiler-dom instead.`;
|
1842 | }
|
1843 | else {
|
1844 | msg += ` Use config.isCustomElement instead.`;
|
1845 | }
|
1846 | return msg;
|
1847 | },
|
1848 | link: `https://v3.vuejs.org/guide/migration/global-api.html#config-ignoredelements-is-now-config-iscustomelement`
|
1849 | },
|
1850 | ["CONFIG_WHITESPACE" ]: {
|
1851 |
|
1852 |
|
1853 | message: `Vue 3 compiler's whitespace option will default to "condense" instead of ` +
|
1854 | `"preserve". To suppress this warning, provide an explicit value for ` +
|
1855 | `\`config.compilerOptions.whitespace\`.`
|
1856 | },
|
1857 | ["CONFIG_OPTION_MERGE_STRATS" ]: {
|
1858 | message: `config.optionMergeStrategies no longer exposes internal strategies. ` +
|
1859 | `Use custom merge functions instead.`
|
1860 | },
|
1861 | ["INSTANCE_SET" ]: {
|
1862 | message: `vm.$set() has been removed as it is no longer needed in Vue 3. ` +
|
1863 | `Simply use native JavaScript mutations.`
|
1864 | },
|
1865 | ["INSTANCE_DELETE" ]: {
|
1866 | message: `vm.$delete() has been removed as it is no longer needed in Vue 3. ` +
|
1867 | `Simply use native JavaScript mutations.`
|
1868 | },
|
1869 | ["INSTANCE_DESTROY" ]: {
|
1870 | message: `vm.$destroy() has been removed. Use app.unmount() instead.`,
|
1871 | link: `https://v3.vuejs.org/api/application-api.html#unmount`
|
1872 | },
|
1873 | ["INSTANCE_EVENT_EMITTER" ]: {
|
1874 | message: `vm.$on/$once/$off() have been removed. ` +
|
1875 | `Use an external event emitter library instead.`,
|
1876 | link: `https://v3.vuejs.org/guide/migration/events-api.html`
|
1877 | },
|
1878 | ["INSTANCE_EVENT_HOOKS" ]: {
|
1879 | message: event => `"${event}" lifecycle events are no longer supported. From templates, ` +
|
1880 | `use the "vnode" prefix instead of "hook:". For example, @${event} ` +
|
1881 | `should be changed to @vnode-${event.slice(5)}. ` +
|
1882 | `From JavaScript, use Composition API to dynamically register lifecycle ` +
|
1883 | `hooks.`,
|
1884 | link: `https://v3.vuejs.org/guide/migration/vnode-lifecycle-events.html`
|
1885 | },
|
1886 | ["INSTANCE_CHILDREN" ]: {
|
1887 | message: `vm.$children has been removed. Consider refactoring your logic ` +
|
1888 | `to avoid relying on direct access to child components.`,
|
1889 | link: `https://v3.vuejs.org/guide/migration/children.html`
|
1890 | },
|
1891 | ["INSTANCE_LISTENERS" ]: {
|
1892 | message: `vm.$listeners has been removed. In Vue 3, parent v-on listeners are ` +
|
1893 | `included in vm.$attrs and it is no longer necessary to separately use ` +
|
1894 | `v-on="$listeners" if you are already using v-bind="$attrs". ` +
|
1895 | `(Note: the Vue 3 behavior only applies if this compat config is disabled)`,
|
1896 | link: `https://v3.vuejs.org/guide/migration/listeners-removed.html`
|
1897 | },
|
1898 | ["INSTANCE_SCOPED_SLOTS" ]: {
|
1899 | message: `vm.$scopedSlots has been removed. Use vm.$slots instead.`,
|
1900 | link: `https://v3.vuejs.org/guide/migration/slots-unification.html`
|
1901 | },
|
1902 | ["INSTANCE_ATTRS_CLASS_STYLE" ]: {
|
1903 | message: componentName => `Component <${componentName ||
|
1904 | 'Anonymous'}> has \`inheritAttrs: false\` but is ` +
|
1905 | `relying on class/style fallthrough from parent. In Vue 3, class/style ` +
|
1906 | `are now included in $attrs and will no longer fallthrough when ` +
|
1907 | `inheritAttrs is false. If you are already using v-bind="$attrs" on ` +
|
1908 | `component root it should render the same end result. ` +
|
1909 | `If you are binding $attrs to a non-root element and expecting ` +
|
1910 | `class/style to fallthrough on root, you will need to now manually bind ` +
|
1911 | `them on root via :class="$attrs.class".`,
|
1912 | link: `https://v3.vuejs.org/guide/migration/attrs-includes-class-style.html`
|
1913 | },
|
1914 | ["OPTIONS_DATA_FN" ]: {
|
1915 | message: `The "data" option can no longer be a plain object. ` +
|
1916 | `Always use a function.`,
|
1917 | link: `https://v3.vuejs.org/guide/migration/data-option.html`
|
1918 | },
|
1919 | ["OPTIONS_DATA_MERGE" ]: {
|
1920 | message: (key) => `Detected conflicting key "${key}" when merging data option values. ` +
|
1921 | `In Vue 3, data keys are merged shallowly and will override one another.`,
|
1922 | link: `https://v3.vuejs.org/guide/migration/data-option.html#mixin-merge-behavior-change`
|
1923 | },
|
1924 | ["OPTIONS_BEFORE_DESTROY" ]: {
|
1925 | message: `\`beforeDestroy\` has been renamed to \`beforeUnmount\`.`
|
1926 | },
|
1927 | ["OPTIONS_DESTROYED" ]: {
|
1928 | message: `\`destroyed\` has been renamed to \`unmounted\`.`
|
1929 | },
|
1930 | ["WATCH_ARRAY" ]: {
|
1931 | message: `"watch" option or vm.$watch on an array value will no longer ` +
|
1932 | `trigger on array mutation unless the "deep" option is specified. ` +
|
1933 | `If current usage is intended, you can disable the compat behavior and ` +
|
1934 | `suppress this warning with:` +
|
1935 | `\n\n configureCompat({ ${"WATCH_ARRAY" /* WATCH_ARRAY */}: false })\n`,
|
1936 | link: `https://v3.vuejs.org/guide/migration/watch.html`
|
1937 | },
|
1938 | ["PROPS_DEFAULT_THIS" ]: {
|
1939 | message: (key) => `props default value function no longer has access to "this". The compat ` +
|
1940 | `build only offers access to this.$options.` +
|
1941 | `(found in prop "${key}")`,
|
1942 | link: `https://v3.vuejs.org/guide/migration/props-default-this.html`
|
1943 | },
|
1944 | ["CUSTOM_DIR" ]: {
|
1945 | message: (legacyHook, newHook) => `Custom directive hook "${legacyHook}" has been removed. ` +
|
1946 | `Use "${newHook}" instead.`,
|
1947 | link: `https://v3.vuejs.org/guide/migration/custom-directives.html`
|
1948 | },
|
1949 | ["V_FOR_REF" ]: {
|
1950 | message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
|
1951 | `Consider using function refs or refactor to avoid ref usage altogether.`,
|
1952 | link: `https://v3.vuejs.org/guide/migration/array-refs.html`
|
1953 | },
|
1954 | ["V_ON_KEYCODE_MODIFIER" ]: {
|
1955 | message: `Using keyCode as v-on modifier is no longer supported. ` +
|
1956 | `Use kebab-case key name modifiers instead.`,
|
1957 | link: `https://v3.vuejs.org/guide/migration/keycode-modifiers.html`
|
1958 | },
|
1959 | ["ATTR_FALSE_VALUE" ]: {
|
1960 | message: (name) => `Attribute "${name}" with v-bind value \`false\` will render ` +
|
1961 | `${name}="false" instead of removing it in Vue 3. To remove the attribute, ` +
|
1962 | `use \`null\` or \`undefined\` instead. If the usage is intended, ` +
|
1963 | `you can disable the compat behavior and suppress this warning with:` +
|
1964 | `\n\n configureCompat({ ${"ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */}: false })\n`,
|
1965 | link: `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
|
1966 | },
|
1967 | ["ATTR_ENUMERATED_COERCION" ]: {
|
1968 | message: (name, value, coerced) => `Enumerated attribute "${name}" with v-bind value \`${value}\` will ` +
|
1969 | `${value === null ? `be removed` : `render the value as-is`} instead of coercing the value to "${coerced}" in Vue 3. ` +
|
1970 | `Always use explicit "true" or "false" values for enumerated attributes. ` +
|
1971 | `If the usage is intended, ` +
|
1972 | `you can disable the compat behavior and suppress this warning with:` +
|
1973 | `\n\n configureCompat({ ${"ATTR_ENUMERATED_COERCION" /* ATTR_ENUMERATED_COERCION */}: false })\n`,
|
1974 | link: `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
|
1975 | },
|
1976 | ["TRANSITION_CLASSES" ]: {
|
1977 | message: ``
|
1978 | },
|
1979 | ["TRANSITION_GROUP_ROOT" ]: {
|
1980 | message: `<TransitionGroup> no longer renders a root <span> element by ` +
|
1981 | `default if no "tag" prop is specified. If you do not rely on the span ` +
|
1982 | `for styling, you can disable the compat behavior and suppress this ` +
|
1983 | `warning with:` +
|
1984 | `\n\n configureCompat({ ${"TRANSITION_GROUP_ROOT" /* TRANSITION_GROUP_ROOT */}: false })\n`,
|
1985 | link: `https://v3.vuejs.org/guide/migration/transition-group.html`
|
1986 | },
|
1987 | ["COMPONENT_ASYNC" ]: {
|
1988 | message: (comp) => {
|
1989 | const name = getComponentName(comp);
|
1990 | return (`Async component${name ? ` <${name}>` : `s`} should be explicitly created via \`defineAsyncComponent()\` ` +
|
1991 | `in Vue 3. Plain functions will be treated as functional components in ` +
|
1992 | `non-compat build. If you have already migrated all async component ` +
|
1993 | `usage and intend to use plain functions for functional components, ` +
|
1994 | `you can disable the compat behavior and suppress this ` +
|
1995 | `warning with:` +
|
1996 | `\n\n configureCompat({ ${"COMPONENT_ASYNC" /* COMPONENT_ASYNC */}: false })\n`);
|
1997 | },
|
1998 | link: `https://v3.vuejs.org/guide/migration/async-components.html`
|
1999 | },
|
2000 | ["COMPONENT_FUNCTIONAL" ]: {
|
2001 | message: (comp) => {
|
2002 | const name = getComponentName(comp);
|
2003 | return (`Functional component${name ? ` <${name}>` : `s`} should be defined as a plain function in Vue 3. The "functional" ` +
|
2004 | `option has been removed. NOTE: Before migrating to use plain ` +
|
2005 | `functions for functional components, first make sure that all async ` +
|
2006 | `components usage have been migrated and its compat behavior has ` +
|
2007 | `been disabled.`);
|
2008 | },
|
2009 | link: `https://v3.vuejs.org/guide/migration/functional-components.html`
|
2010 | },
|
2011 | ["COMPONENT_V_MODEL" ]: {
|
2012 | message: (comp) => {
|
2013 | const configMsg = `opt-in to ` +
|
2014 | `Vue 3 behavior on a per-component basis with \`compatConfig: { ${"COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */}: false }\`.`;
|
2015 | if (comp.props && isArray(comp.props)
|
2016 | ? comp.props.includes('modelValue')
|
2017 | : hasOwn(comp.props, 'modelValue')) {
|
2018 | return (`Component delcares "modelValue" prop, which is Vue 3 usage, but ` +
|
2019 | `is running under Vue 2 compat v-model behavior. You can ${configMsg}`);
|
2020 | }
|
2021 | return (`v-model usage on component has changed in Vue 3. Component that expects ` +
|
2022 | `to work with v-model should now use the "modelValue" prop and emit the ` +
|
2023 | `"update:modelValue" event. You can update the usage and then ${configMsg}`);
|
2024 | },
|
2025 | link: `https://v3.vuejs.org/guide/migration/v-model.html`
|
2026 | },
|
2027 | ["RENDER_FUNCTION" ]: {
|
2028 | message: `Vue 3's render function API has changed. ` +
|
2029 | `You can opt-in to the new API with:` +
|
2030 | `\n\n configureCompat({ ${"RENDER_FUNCTION" /* RENDER_FUNCTION */}: false })\n` +
|
2031 | `\n (This can also be done per-component via the "compatConfig" option.)`,
|
2032 | link: `https://v3.vuejs.org/guide/migration/render-function-api.html`
|
2033 | },
|
2034 | ["FILTERS" ]: {
|
2035 | message: `filters have been removed in Vue 3. ` +
|
2036 | `The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
|
2037 | `Use method calls or computed properties instead.`,
|
2038 | link: `https://v3.vuejs.org/guide/migration/filters.html`
|
2039 | },
|
2040 | ["PRIVATE_APIS" ]: {
|
2041 | message: name => `"${name}" is a Vue 2 private API that no longer exists in Vue 3. ` +
|
2042 | `If you are seeing this warning only due to a dependency, you can ` +
|
2043 | `suppress this warning via { PRIVATE_APIS: 'supress-warning' }.`
|
2044 | }
|
2045 | };
|
2046 | const instanceWarned = Object.create(null);
|
2047 | const warnCount = Object.create(null);
|
2048 | function warnDeprecation(key, instance, ...args) {
|
2049 | instance = instance || getCurrentInstance();
|
2050 |
|
2051 | const config = getCompatConfigForKey(key, instance);
|
2052 | if (config === 'suppress-warning') {
|
2053 | return;
|
2054 | }
|
2055 | const dupKey = key + args.join('');
|
2056 | let compId = instance && formatComponentName(instance, instance.type);
|
2057 | if (compId === 'Anonymous' && instance) {
|
2058 | compId = instance.uid;
|
2059 | }
|
2060 |
|
2061 | const componentDupKey = dupKey + compId;
|
2062 | if (componentDupKey in instanceWarned) {
|
2063 | return;
|
2064 | }
|
2065 | instanceWarned[componentDupKey] = true;
|
2066 |
|
2067 |
|
2068 | if (dupKey in warnCount) {
|
2069 | warn(`(deprecation ${key}) (${++warnCount[dupKey] + 1})`);
|
2070 | return;
|
2071 | }
|
2072 | warnCount[dupKey] = 0;
|
2073 | const { message, link } = deprecationData[key];
|
2074 | warn(`(deprecation ${key}) ${typeof message === 'function' ? message(...args) : message}${link ? `\n Details: ${link}` : ``}`);
|
2075 | if (!isCompatEnabled(key, instance, true)) {
|
2076 | console.error(`^ The above deprecation's compat behavior is disabled and will likely ` +
|
2077 | `lead to runtime errors.`);
|
2078 | }
|
2079 | }
|
2080 | const globalCompatConfig = {
|
2081 | MODE: 2
|
2082 | };
|
2083 | function getCompatConfigForKey(key, instance) {
|
2084 | const instanceConfig = instance && instance.type.compatConfig;
|
2085 | if (instanceConfig && key in instanceConfig) {
|
2086 | return instanceConfig[key];
|
2087 | }
|
2088 | return globalCompatConfig[key];
|
2089 | }
|
2090 | function isCompatEnabled(key, instance, enableForBuiltIn = false) {
|
2091 |
|
2092 | if (!enableForBuiltIn && instance && instance.type.__isBuiltIn) {
|
2093 | return false;
|
2094 | }
|
2095 | const rawMode = getCompatConfigForKey('MODE', instance) || 2;
|
2096 | const val = getCompatConfigForKey(key, instance);
|
2097 | const mode = isFunction(rawMode)
|
2098 | ? rawMode(instance && instance.type)
|
2099 | : rawMode;
|
2100 | if (mode === 2) {
|
2101 | return val !== false;
|
2102 | }
|
2103 | else {
|
2104 | return val === true || val === 'suppress-warning';
|
2105 | }
|
2106 | }
|
2107 |
|
2108 | function emit(instance, event, ...rawArgs) {
|
2109 | const props = instance.vnode.props || EMPTY_OBJ;
|
2110 | {
|
2111 | const { emitsOptions, propsOptions: [propsOptions] } = instance;
|
2112 | if (emitsOptions) {
|
2113 | if (!(event in emitsOptions) &&
|
2114 | !(false )) {
|
2115 | if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
|
2116 | warn(`Component emitted event "${event}" but it is neither declared in ` +
|
2117 | `the emits option nor as an "${toHandlerKey(event)}" prop.`);
|
2118 | }
|
2119 | }
|
2120 | else {
|
2121 | const validator = emitsOptions[event];
|
2122 | if (isFunction(validator)) {
|
2123 | const isValid = validator(...rawArgs);
|
2124 | if (!isValid) {
|
2125 | warn(`Invalid event arguments: event validation failed for event "${event}".`);
|
2126 | }
|
2127 | }
|
2128 | }
|
2129 | }
|
2130 | }
|
2131 | let args = rawArgs;
|
2132 | const isModelListener = event.startsWith('update:');
|
2133 |
|
2134 | const modelArg = isModelListener && event.slice(7);
|
2135 | if (modelArg && modelArg in props) {
|
2136 | const modifiersKey = `${modelArg === 'modelValue' ? 'model' : modelArg}Modifiers`;
|
2137 | const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
|
2138 | if (trim) {
|
2139 | args = rawArgs.map(a => a.trim());
|
2140 | }
|
2141 | else if (number) {
|
2142 | args = rawArgs.map(toNumber);
|
2143 | }
|
2144 | }
|
2145 | {
|
2146 | devtoolsComponentEmit(instance, event, args);
|
2147 | }
|
2148 | {
|
2149 | const lowerCaseEvent = event.toLowerCase();
|
2150 | if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
|
2151 | warn(`Event "${lowerCaseEvent}" is emitted in component ` +
|
2152 | `${formatComponentName(instance, instance.type)} but the handler is registered for "${event}". ` +
|
2153 | `Note that HTML attributes are case-insensitive and you cannot use ` +
|
2154 | `v-on to listen to camelCase events when using in-DOM templates. ` +
|
2155 | `You should probably use "${hyphenate(event)}" instead of "${event}".`);
|
2156 | }
|
2157 | }
|
2158 | let handlerName;
|
2159 | let handler = props[(handlerName = toHandlerKey(event))] ||
|
2160 |
|
2161 | props[(handlerName = toHandlerKey(camelize(event)))];
|
2162 |
|
2163 |
|
2164 | if (!handler && isModelListener) {
|
2165 | handler = props[(handlerName = toHandlerKey(hyphenate(event)))];
|
2166 | }
|
2167 | if (handler) {
|
2168 | callWithAsyncErrorHandling(handler, instance, 6 , args);
|
2169 | }
|
2170 | const onceHandler = props[handlerName + `Once`];
|
2171 | if (onceHandler) {
|
2172 | if (!instance.emitted) {
|
2173 | (instance.emitted = {})[handlerName] = true;
|
2174 | }
|
2175 | else if (instance.emitted[handlerName]) {
|
2176 | return;
|
2177 | }
|
2178 | callWithAsyncErrorHandling(onceHandler, instance, 6 , args);
|
2179 | }
|
2180 | }
|
2181 | function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
2182 | const cache = appContext.emitsCache;
|
2183 | const cached = cache.get(comp);
|
2184 | if (cached !== undefined) {
|
2185 | return cached;
|
2186 | }
|
2187 | const raw = comp.emits;
|
2188 | let normalized = {};
|
2189 |
|
2190 | let hasExtends = false;
|
2191 | if (!isFunction(comp)) {
|
2192 | const extendEmits = (raw) => {
|
2193 | const normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true);
|
2194 | if (normalizedFromExtend) {
|
2195 | hasExtends = true;
|
2196 | extend(normalized, normalizedFromExtend);
|
2197 | }
|
2198 | };
|
2199 | if (!asMixin && appContext.mixins.length) {
|
2200 | appContext.mixins.forEach(extendEmits);
|
2201 | }
|
2202 | if (comp.extends) {
|
2203 | extendEmits(comp.extends);
|
2204 | }
|
2205 | if (comp.mixins) {
|
2206 | comp.mixins.forEach(extendEmits);
|
2207 | }
|
2208 | }
|
2209 | if (!raw && !hasExtends) {
|
2210 | cache.set(comp, null);
|
2211 | return null;
|
2212 | }
|
2213 | if (isArray(raw)) {
|
2214 | raw.forEach(key => (normalized[key] = null));
|
2215 | }
|
2216 | else {
|
2217 | extend(normalized, raw);
|
2218 | }
|
2219 | cache.set(comp, normalized);
|
2220 | return normalized;
|
2221 | }
|
2222 |
|
2223 |
|
2224 |
|
2225 | function isEmitListener(options, key) {
|
2226 | if (!options || !isOn(key)) {
|
2227 | return false;
|
2228 | }
|
2229 | key = key.slice(2).replace(/Once$/, '');
|
2230 | return (hasOwn(options, key[0].toLowerCase() + key.slice(1)) ||
|
2231 | hasOwn(options, hyphenate(key)) ||
|
2232 | hasOwn(options, key));
|
2233 | }
|
2234 |
|
2235 | |
2236 |
|
2237 |
|
2238 |
|
2239 | let currentRenderingInstance = null;
|
2240 | let currentScopeId = null;
|
2241 | |
2242 |
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 |
|
2248 |
|
2249 |
|
2250 |
|
2251 | function setCurrentRenderingInstance(instance) {
|
2252 | const prev = currentRenderingInstance;
|
2253 | currentRenderingInstance = instance;
|
2254 | currentScopeId = (instance && instance.type.__scopeId) || null;
|
2255 | return prev;
|
2256 | }
|
2257 | |
2258 |
|
2259 |
|
2260 |
|
2261 | function pushScopeId(id) {
|
2262 | currentScopeId = id;
|
2263 | }
|
2264 | |
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 | function popScopeId() {
|
2270 | currentScopeId = null;
|
2271 | }
|
2272 | |
2273 |
|
2274 |
|
2275 |
|
2276 | const withScopeId = (_id) => withCtx;
|
2277 | |
2278 |
|
2279 |
|
2280 |
|
2281 | function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // false only
|
2282 | ) {
|
2283 | if (!ctx)
|
2284 | return fn;
|
2285 |
|
2286 | if (fn._n) {
|
2287 | return fn;
|
2288 | }
|
2289 | const renderFnWithContext = (...args) => {
|
2290 |
|
2291 |
|
2292 |
|
2293 |
|
2294 |
|
2295 | if (renderFnWithContext._d) {
|
2296 | setBlockTracking(-1);
|
2297 | }
|
2298 | const prevInstance = setCurrentRenderingInstance(ctx);
|
2299 | const res = fn(...args);
|
2300 | setCurrentRenderingInstance(prevInstance);
|
2301 | if (renderFnWithContext._d) {
|
2302 | setBlockTracking(1);
|
2303 | }
|
2304 | {
|
2305 | devtoolsComponentUpdated(ctx);
|
2306 | }
|
2307 | return res;
|
2308 | };
|
2309 |
|
2310 | renderFnWithContext._n = true;
|
2311 |
|
2312 |
|
2313 |
|
2314 | renderFnWithContext._c = true;
|
2315 |
|
2316 | renderFnWithContext._d = true;
|
2317 | return renderFnWithContext;
|
2318 | }
|
2319 |
|
2320 | |
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 | let accessedAttrs = false;
|
2326 | function markAttrsAccessed() {
|
2327 | accessedAttrs = true;
|
2328 | }
|
2329 | function renderComponentRoot(instance) {
|
2330 | const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
|
2331 | let result;
|
2332 | const prev = setCurrentRenderingInstance(instance);
|
2333 | {
|
2334 | accessedAttrs = false;
|
2335 | }
|
2336 | try {
|
2337 | let fallthroughAttrs;
|
2338 | if (vnode.shapeFlag & 4 ) {
|
2339 |
|
2340 |
|
2341 | const proxyToUse = withProxy || proxy;
|
2342 | result = normalizeVNode(render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));
|
2343 | fallthroughAttrs = attrs;
|
2344 | }
|
2345 | else {
|
2346 |
|
2347 | const render = Component;
|
2348 |
|
2349 | if (true && attrs === props) {
|
2350 | markAttrsAccessed();
|
2351 | }
|
2352 | result = normalizeVNode(render.length > 1
|
2353 | ? render(props, true
|
2354 | ? {
|
2355 | get attrs() {
|
2356 | markAttrsAccessed();
|
2357 | return attrs;
|
2358 | },
|
2359 | slots,
|
2360 | emit
|
2361 | }
|
2362 | : { attrs, slots, emit })
|
2363 | : render(props, null ));
|
2364 | fallthroughAttrs = Component.props
|
2365 | ? attrs
|
2366 | : getFunctionalFallthrough(attrs);
|
2367 | }
|
2368 |
|
2369 |
|
2370 |
|
2371 | let root = result;
|
2372 | let setRoot = undefined;
|
2373 | if (true &&
|
2374 | result.patchFlag > 0 &&
|
2375 | result.patchFlag & 2048 ) {
|
2376 | ;
|
2377 | [root, setRoot] = getChildRoot(result);
|
2378 | }
|
2379 | if (fallthroughAttrs && inheritAttrs !== false) {
|
2380 | const keys = Object.keys(fallthroughAttrs);
|
2381 | const { shapeFlag } = root;
|
2382 | if (keys.length) {
|
2383 | if (shapeFlag & 1 ||
|
2384 | shapeFlag & 6 ) {
|
2385 | if (propsOptions && keys.some(isModelListener)) {
|
2386 |
|
2387 |
|
2388 |
|
2389 |
|
2390 | fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
|
2391 | }
|
2392 | root = cloneVNode(root, fallthroughAttrs);
|
2393 | }
|
2394 | else if (true && !accessedAttrs && root.type !== Comment$1) {
|
2395 | const allAttrs = Object.keys(attrs);
|
2396 | const eventAttrs = [];
|
2397 | const extraAttrs = [];
|
2398 | for (let i = 0, l = allAttrs.length; i < l; i++) {
|
2399 | const key = allAttrs[i];
|
2400 | if (isOn(key)) {
|
2401 |
|
2402 | if (!isModelListener(key)) {
|
2403 |
|
2404 |
|
2405 | eventAttrs.push(key[2].toLowerCase() + key.slice(3));
|
2406 | }
|
2407 | }
|
2408 | else {
|
2409 | extraAttrs.push(key);
|
2410 | }
|
2411 | }
|
2412 | if (extraAttrs.length) {
|
2413 | warn(`Extraneous non-props attributes (` +
|
2414 | `${extraAttrs.join(', ')}) ` +
|
2415 | `were passed to component but could not be automatically inherited ` +
|
2416 | `because component renders fragment or text root nodes.`);
|
2417 | }
|
2418 | if (eventAttrs.length) {
|
2419 | warn(`Extraneous non-emits event listeners (` +
|
2420 | `${eventAttrs.join(', ')}) ` +
|
2421 | `were passed to component but could not be automatically inherited ` +
|
2422 | `because component renders fragment or text root nodes. ` +
|
2423 | `If the listener is intended to be a component custom event listener only, ` +
|
2424 | `declare it using the "emits" option.`);
|
2425 | }
|
2426 | }
|
2427 | }
|
2428 | }
|
2429 | if (false &&
|
2430 | isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" , instance) &&
|
2431 | vnode.shapeFlag & 4 &&
|
2432 | (root.shapeFlag & 1 ||
|
2433 | root.shapeFlag & 6 )) ;
|
2434 |
|
2435 | if (vnode.dirs) {
|
2436 | if (true && !isElementRoot(root)) {
|
2437 | warn(`Runtime directive used on component with non-element root node. ` +
|
2438 | `The directives will not function as intended.`);
|
2439 | }
|
2440 | root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
2441 | }
|
2442 |
|
2443 | if (vnode.transition) {
|
2444 | if (true && !isElementRoot(root)) {
|
2445 | warn(`Component inside <Transition> renders non-element root node ` +
|
2446 | `that cannot be animated.`);
|
2447 | }
|
2448 | root.transition = vnode.transition;
|
2449 | }
|
2450 | if (true && setRoot) {
|
2451 | setRoot(root);
|
2452 | }
|
2453 | else {
|
2454 | result = root;
|
2455 | }
|
2456 | }
|
2457 | catch (err) {
|
2458 | blockStack.length = 0;
|
2459 | handleError(err, instance, 1 );
|
2460 | result = createVNode(Comment$1);
|
2461 | }
|
2462 | setCurrentRenderingInstance(prev);
|
2463 | return result;
|
2464 | }
|
2465 | |
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 | const getChildRoot = (vnode) => {
|
2472 | const rawChildren = vnode.children;
|
2473 | const dynamicChildren = vnode.dynamicChildren;
|
2474 | const childRoot = filterSingleRoot(rawChildren);
|
2475 | if (!childRoot) {
|
2476 | return [vnode, undefined];
|
2477 | }
|
2478 | const index = rawChildren.indexOf(childRoot);
|
2479 | const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
|
2480 | const setRoot = (updatedRoot) => {
|
2481 | rawChildren[index] = updatedRoot;
|
2482 | if (dynamicChildren) {
|
2483 | if (dynamicIndex > -1) {
|
2484 | dynamicChildren[dynamicIndex] = updatedRoot;
|
2485 | }
|
2486 | else if (updatedRoot.patchFlag > 0) {
|
2487 | vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
|
2488 | }
|
2489 | }
|
2490 | };
|
2491 | return [normalizeVNode(childRoot), setRoot];
|
2492 | };
|
2493 | function filterSingleRoot(children) {
|
2494 | let singleRoot;
|
2495 | for (let i = 0; i < children.length; i++) {
|
2496 | const child = children[i];
|
2497 | if (isVNode(child)) {
|
2498 |
|
2499 | if (child.type !== Comment$1 || child.children === 'v-if') {
|
2500 | if (singleRoot) {
|
2501 |
|
2502 | return;
|
2503 | }
|
2504 | else {
|
2505 | singleRoot = child;
|
2506 | }
|
2507 | }
|
2508 | }
|
2509 | else {
|
2510 | return;
|
2511 | }
|
2512 | }
|
2513 | return singleRoot;
|
2514 | }
|
2515 | const getFunctionalFallthrough = (attrs) => {
|
2516 | let res;
|
2517 | for (const key in attrs) {
|
2518 | if (key === 'class' || key === 'style' || isOn(key)) {
|
2519 | (res || (res = {}))[key] = attrs[key];
|
2520 | }
|
2521 | }
|
2522 | return res;
|
2523 | };
|
2524 | const filterModelListeners = (attrs, props) => {
|
2525 | const res = {};
|
2526 | for (const key in attrs) {
|
2527 | if (!isModelListener(key) || !(key.slice(9) in props)) {
|
2528 | res[key] = attrs[key];
|
2529 | }
|
2530 | }
|
2531 | return res;
|
2532 | };
|
2533 | const isElementRoot = (vnode) => {
|
2534 | return (vnode.shapeFlag & 6 ||
|
2535 | vnode.shapeFlag & 1 ||
|
2536 | vnode.type === Comment$1
|
2537 | );
|
2538 | };
|
2539 | function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
2540 | const { props: prevProps, children: prevChildren, component } = prevVNode;
|
2541 | const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
|
2542 | const emits = component.emitsOptions;
|
2543 |
|
2544 |
|
2545 |
|
2546 | if ((prevChildren || nextChildren) && isHmrUpdating) {
|
2547 | return true;
|
2548 | }
|
2549 |
|
2550 | if (nextVNode.dirs || nextVNode.transition) {
|
2551 | return true;
|
2552 | }
|
2553 | if (optimized && patchFlag >= 0) {
|
2554 | if (patchFlag & 1024 ) {
|
2555 |
|
2556 |
|
2557 | return true;
|
2558 | }
|
2559 | if (patchFlag & 16 ) {
|
2560 | if (!prevProps) {
|
2561 | return !!nextProps;
|
2562 | }
|
2563 |
|
2564 | return hasPropsChanged(prevProps, nextProps, emits);
|
2565 | }
|
2566 | else if (patchFlag & 8 ) {
|
2567 | const dynamicProps = nextVNode.dynamicProps;
|
2568 | for (let i = 0; i < dynamicProps.length; i++) {
|
2569 | const key = dynamicProps[i];
|
2570 | if (nextProps[key] !== prevProps[key] &&
|
2571 | !isEmitListener(emits, key)) {
|
2572 | return true;
|
2573 | }
|
2574 | }
|
2575 | }
|
2576 | }
|
2577 | else {
|
2578 |
|
2579 |
|
2580 | if (prevChildren || nextChildren) {
|
2581 | if (!nextChildren || !nextChildren.$stable) {
|
2582 | return true;
|
2583 | }
|
2584 | }
|
2585 | if (prevProps === nextProps) {
|
2586 | return false;
|
2587 | }
|
2588 | if (!prevProps) {
|
2589 | return !!nextProps;
|
2590 | }
|
2591 | if (!nextProps) {
|
2592 | return true;
|
2593 | }
|
2594 | return hasPropsChanged(prevProps, nextProps, emits);
|
2595 | }
|
2596 | return false;
|
2597 | }
|
2598 | function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
2599 | const nextKeys = Object.keys(nextProps);
|
2600 | if (nextKeys.length !== Object.keys(prevProps).length) {
|
2601 | return true;
|
2602 | }
|
2603 | for (let i = 0; i < nextKeys.length; i++) {
|
2604 | const key = nextKeys[i];
|
2605 | if (nextProps[key] !== prevProps[key] &&
|
2606 | !isEmitListener(emitsOptions, key)) {
|
2607 | return true;
|
2608 | }
|
2609 | }
|
2610 | return false;
|
2611 | }
|
2612 | function updateHOCHostEl({ vnode, parent }, el // HostNode
|
2613 | ) {
|
2614 | while (parent && parent.subTree === vnode) {
|
2615 | (vnode = parent.vnode).el = el;
|
2616 | parent = parent.parent;
|
2617 | }
|
2618 | }
|
2619 |
|
2620 | const isSuspense = (type) => type.__isSuspense;
|
2621 |
|
2622 |
|
2623 |
|
2624 | const SuspenseImpl = {
|
2625 | name: 'Suspense',
|
2626 |
|
2627 |
|
2628 |
|
2629 |
|
2630 | __isSuspense: true,
|
2631 | process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized,
|
2632 |
|
2633 | rendererInternals) {
|
2634 | if (n1 == null) {
|
2635 | mountSuspense(n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals);
|
2636 | }
|
2637 | else {
|
2638 | patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, rendererInternals);
|
2639 | }
|
2640 | },
|
2641 | hydrate: hydrateSuspense,
|
2642 | create: createSuspenseBoundary,
|
2643 | normalize: normalizeSuspenseChildren
|
2644 | };
|
2645 |
|
2646 | const Suspense = (SuspenseImpl
|
2647 | );
|
2648 | function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
|
2649 | const { p: patch, o: { createElement } } = rendererInternals;
|
2650 | const hiddenContainer = createElement('div');
|
2651 | const suspense = (vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals));
|
2652 |
|
2653 | patch(null, (suspense.pendingBranch = vnode.ssContent), hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds);
|
2654 |
|
2655 | if (suspense.deps > 0) {
|
2656 |
|
2657 |
|
2658 | patch(null, vnode.ssFallback, container, anchor, parentComponent, null,
|
2659 | isSVG, slotScopeIds);
|
2660 | setActiveBranch(suspense, vnode.ssFallback);
|
2661 | }
|
2662 | else {
|
2663 |
|
2664 | suspense.resolve();
|
2665 | }
|
2666 | }
|
2667 | function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
|
2668 | const suspense = (n2.suspense = n1.suspense);
|
2669 | suspense.vnode = n2;
|
2670 | n2.el = n1.el;
|
2671 | const newBranch = n2.ssContent;
|
2672 | const newFallback = n2.ssFallback;
|
2673 | const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
|
2674 | if (pendingBranch) {
|
2675 | suspense.pendingBranch = newBranch;
|
2676 | if (isSameVNodeType(newBranch, pendingBranch)) {
|
2677 |
|
2678 | patch(pendingBranch, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
|
2679 | if (suspense.deps <= 0) {
|
2680 | suspense.resolve();
|
2681 | }
|
2682 | else if (isInFallback) {
|
2683 | patch(activeBranch, newFallback, container, anchor, parentComponent, null,
|
2684 | isSVG, slotScopeIds, optimized);
|
2685 | setActiveBranch(suspense, newFallback);
|
2686 | }
|
2687 | }
|
2688 | else {
|
2689 |
|
2690 | suspense.pendingId++;
|
2691 | if (isHydrating) {
|
2692 |
|
2693 |
|
2694 |
|
2695 | suspense.isHydrating = false;
|
2696 | suspense.activeBranch = pendingBranch;
|
2697 | }
|
2698 | else {
|
2699 | unmount(pendingBranch, parentComponent, suspense);
|
2700 | }
|
2701 |
|
2702 |
|
2703 | suspense.deps = 0;
|
2704 |
|
2705 | suspense.effects.length = 0;
|
2706 |
|
2707 | suspense.hiddenContainer = createElement('div');
|
2708 | if (isInFallback) {
|
2709 |
|
2710 | patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
|
2711 | if (suspense.deps <= 0) {
|
2712 | suspense.resolve();
|
2713 | }
|
2714 | else {
|
2715 | patch(activeBranch, newFallback, container, anchor, parentComponent, null,
|
2716 | isSVG, slotScopeIds, optimized);
|
2717 | setActiveBranch(suspense, newFallback);
|
2718 | }
|
2719 | }
|
2720 | else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
2721 |
|
2722 | patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG, slotScopeIds, optimized);
|
2723 |
|
2724 | suspense.resolve(true);
|
2725 | }
|
2726 | else {
|
2727 |
|
2728 | patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
|
2729 | if (suspense.deps <= 0) {
|
2730 | suspense.resolve();
|
2731 | }
|
2732 | }
|
2733 | }
|
2734 | }
|
2735 | else {
|
2736 | if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
2737 |
|
2738 | patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG, slotScopeIds, optimized);
|
2739 | setActiveBranch(suspense, newBranch);
|
2740 | }
|
2741 | else {
|
2742 |
|
2743 |
|
2744 | const onPending = n2.props && n2.props.onPending;
|
2745 | if (isFunction(onPending)) {
|
2746 | onPending();
|
2747 | }
|
2748 |
|
2749 | suspense.pendingBranch = newBranch;
|
2750 | suspense.pendingId++;
|
2751 | patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
|
2752 | if (suspense.deps <= 0) {
|
2753 |
|
2754 | suspense.resolve();
|
2755 | }
|
2756 | else {
|
2757 | const { timeout, pendingId } = suspense;
|
2758 | if (timeout > 0) {
|
2759 | setTimeout(() => {
|
2760 | if (suspense.pendingId === pendingId) {
|
2761 | suspense.fallback(newFallback);
|
2762 | }
|
2763 | }, timeout);
|
2764 | }
|
2765 | else if (timeout === 0) {
|
2766 | suspense.fallback(newFallback);
|
2767 | }
|
2768 | }
|
2769 | }
|
2770 | }
|
2771 | }
|
2772 | let hasWarned = false;
|
2773 | function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
|
2774 |
|
2775 | if (!hasWarned) {
|
2776 | hasWarned = true;
|
2777 |
|
2778 | console[console.info ? 'info' : 'log'](`<Suspense> is an experimental feature and its API will likely change.`);
|
2779 | }
|
2780 | const { p: patch, m: move, um: unmount, n: next, o: { parentNode, remove } } = rendererInternals;
|
2781 | const timeout = toNumber(vnode.props && vnode.props.timeout);
|
2782 | const suspense = {
|
2783 | vnode,
|
2784 | parent,
|
2785 | parentComponent,
|
2786 | isSVG,
|
2787 | container,
|
2788 | hiddenContainer,
|
2789 | anchor,
|
2790 | deps: 0,
|
2791 | pendingId: 0,
|
2792 | timeout: typeof timeout === 'number' ? timeout : -1,
|
2793 | activeBranch: null,
|
2794 | pendingBranch: null,
|
2795 | isInFallback: true,
|
2796 | isHydrating,
|
2797 | isUnmounted: false,
|
2798 | effects: [],
|
2799 | resolve(resume = false) {
|
2800 | {
|
2801 | if (!resume && !suspense.pendingBranch) {
|
2802 | throw new Error(`suspense.resolve() is called without a pending branch.`);
|
2803 | }
|
2804 | if (suspense.isUnmounted) {
|
2805 | throw new Error(`suspense.resolve() is called on an already unmounted suspense boundary.`);
|
2806 | }
|
2807 | }
|
2808 | const { vnode, activeBranch, pendingBranch, pendingId, effects, parentComponent, container } = suspense;
|
2809 | if (suspense.isHydrating) {
|
2810 | suspense.isHydrating = false;
|
2811 | }
|
2812 | else if (!resume) {
|
2813 | const delayEnter = activeBranch &&
|
2814 | pendingBranch.transition &&
|
2815 | pendingBranch.transition.mode === 'out-in';
|
2816 | if (delayEnter) {
|
2817 | activeBranch.transition.afterLeave = () => {
|
2818 | if (pendingId === suspense.pendingId) {
|
2819 | move(pendingBranch, container, anchor, 0 );
|
2820 | }
|
2821 | };
|
2822 | }
|
2823 |
|
2824 | let { anchor } = suspense;
|
2825 |
|
2826 | if (activeBranch) {
|
2827 |
|
2828 |
|
2829 | anchor = next(activeBranch);
|
2830 | unmount(activeBranch, parentComponent, suspense, true);
|
2831 | }
|
2832 | if (!delayEnter) {
|
2833 |
|
2834 | move(pendingBranch, container, anchor, 0 );
|
2835 | }
|
2836 | }
|
2837 | setActiveBranch(suspense, pendingBranch);
|
2838 | suspense.pendingBranch = null;
|
2839 | suspense.isInFallback = false;
|
2840 |
|
2841 |
|
2842 | let parent = suspense.parent;
|
2843 | let hasUnresolvedAncestor = false;
|
2844 | while (parent) {
|
2845 | if (parent.pendingBranch) {
|
2846 |
|
2847 |
|
2848 | parent.effects.push(...effects);
|
2849 | hasUnresolvedAncestor = true;
|
2850 | break;
|
2851 | }
|
2852 | parent = parent.parent;
|
2853 | }
|
2854 |
|
2855 | if (!hasUnresolvedAncestor) {
|
2856 | queuePostFlushCb(effects);
|
2857 | }
|
2858 | suspense.effects = [];
|
2859 |
|
2860 | const onResolve = vnode.props && vnode.props.onResolve;
|
2861 | if (isFunction(onResolve)) {
|
2862 | onResolve();
|
2863 | }
|
2864 | },
|
2865 | fallback(fallbackVNode) {
|
2866 | if (!suspense.pendingBranch) {
|
2867 | return;
|
2868 | }
|
2869 | const { vnode, activeBranch, parentComponent, container, isSVG } = suspense;
|
2870 |
|
2871 | const onFallback = vnode.props && vnode.props.onFallback;
|
2872 | if (isFunction(onFallback)) {
|
2873 | onFallback();
|
2874 | }
|
2875 | const anchor = next(activeBranch);
|
2876 | const mountFallback = () => {
|
2877 | if (!suspense.isInFallback) {
|
2878 | return;
|
2879 | }
|
2880 |
|
2881 | patch(null, fallbackVNode, container, anchor, parentComponent, null,
|
2882 | isSVG, slotScopeIds, optimized);
|
2883 | setActiveBranch(suspense, fallbackVNode);
|
2884 | };
|
2885 | const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === 'out-in';
|
2886 | if (delayEnter) {
|
2887 | activeBranch.transition.afterLeave = mountFallback;
|
2888 | }
|
2889 |
|
2890 | unmount(activeBranch, parentComponent, null,
|
2891 | true
|
2892 | );
|
2893 | suspense.isInFallback = true;
|
2894 | if (!delayEnter) {
|
2895 | mountFallback();
|
2896 | }
|
2897 | },
|
2898 | move(container, anchor, type) {
|
2899 | suspense.activeBranch &&
|
2900 | move(suspense.activeBranch, container, anchor, type);
|
2901 | suspense.container = container;
|
2902 | },
|
2903 | next() {
|
2904 | return suspense.activeBranch && next(suspense.activeBranch);
|
2905 | },
|
2906 | registerDep(instance, setupRenderEffect) {
|
2907 | const isInPendingSuspense = !!suspense.pendingBranch;
|
2908 | if (isInPendingSuspense) {
|
2909 | suspense.deps++;
|
2910 | }
|
2911 | const hydratedEl = instance.vnode.el;
|
2912 | instance
|
2913 | .asyncDep.catch(err => {
|
2914 | handleError(err, instance, 0 );
|
2915 | })
|
2916 | .then(asyncSetupResult => {
|
2917 |
|
2918 |
|
2919 | if (instance.isUnmounted ||
|
2920 | suspense.isUnmounted ||
|
2921 | suspense.pendingId !== instance.suspenseId) {
|
2922 | return;
|
2923 | }
|
2924 |
|
2925 | instance.asyncResolved = true;
|
2926 | const { vnode } = instance;
|
2927 | {
|
2928 | pushWarningContext(vnode);
|
2929 | }
|
2930 | handleSetupResult(instance, asyncSetupResult, false);
|
2931 | if (hydratedEl) {
|
2932 |
|
2933 |
|
2934 | vnode.el = hydratedEl;
|
2935 | }
|
2936 | const placeholder = !hydratedEl && instance.subTree.el;
|
2937 | setupRenderEffect(instance, vnode,
|
2938 |
|
2939 |
|
2940 |
|
2941 | parentNode(hydratedEl || instance.subTree.el),
|
2942 |
|
2943 |
|
2944 | hydratedEl ? null : next(instance.subTree), suspense, isSVG, optimized);
|
2945 | if (placeholder) {
|
2946 | remove(placeholder);
|
2947 | }
|
2948 | updateHOCHostEl(instance, vnode.el);
|
2949 | {
|
2950 | popWarningContext();
|
2951 | }
|
2952 |
|
2953 | if (isInPendingSuspense && --suspense.deps === 0) {
|
2954 | suspense.resolve();
|
2955 | }
|
2956 | });
|
2957 | },
|
2958 | unmount(parentSuspense, doRemove) {
|
2959 | suspense.isUnmounted = true;
|
2960 | if (suspense.activeBranch) {
|
2961 | unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove);
|
2962 | }
|
2963 | if (suspense.pendingBranch) {
|
2964 | unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove);
|
2965 | }
|
2966 | }
|
2967 | };
|
2968 | return suspense;
|
2969 | }
|
2970 | function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
|
2971 |
|
2972 | const suspense = (vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, node.parentNode, document.createElement('div'), null, isSVG, slotScopeIds, optimized, rendererInternals, true ));
|
2973 |
|
2974 |
|
2975 |
|
2976 |
|
2977 |
|
2978 |
|
2979 | const result = hydrateNode(node, (suspense.pendingBranch = vnode.ssContent), parentComponent, suspense, slotScopeIds, optimized);
|
2980 | if (suspense.deps === 0) {
|
2981 | suspense.resolve();
|
2982 | }
|
2983 | return result;
|
2984 |
|
2985 | }
|
2986 | function normalizeSuspenseChildren(vnode) {
|
2987 | const { shapeFlag, children } = vnode;
|
2988 | const isSlotChildren = shapeFlag & 32 ;
|
2989 | vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
|
2990 | vnode.ssFallback = isSlotChildren
|
2991 | ? normalizeSuspenseSlot(children.fallback)
|
2992 | : createVNode(Comment);
|
2993 | }
|
2994 | function normalizeSuspenseSlot(s) {
|
2995 | let block;
|
2996 | if (isFunction(s)) {
|
2997 | const isCompiledSlot = s._c;
|
2998 | if (isCompiledSlot) {
|
2999 |
|
3000 |
|
3001 |
|
3002 | s._d = false;
|
3003 | openBlock();
|
3004 | }
|
3005 | s = s();
|
3006 | if (isCompiledSlot) {
|
3007 | s._d = true;
|
3008 | block = currentBlock;
|
3009 | closeBlock();
|
3010 | }
|
3011 | }
|
3012 | if (isArray(s)) {
|
3013 | const singleChild = filterSingleRoot(s);
|
3014 | if (!singleChild) {
|
3015 | warn(`<Suspense> slots expect a single root node.`);
|
3016 | }
|
3017 | s = singleChild;
|
3018 | }
|
3019 | s = normalizeVNode(s);
|
3020 | if (block) {
|
3021 | s.dynamicChildren = block.filter(c => c !== s);
|
3022 | }
|
3023 | return s;
|
3024 | }
|
3025 | function queueEffectWithSuspense(fn, suspense) {
|
3026 | if (suspense && suspense.pendingBranch) {
|
3027 | if (isArray(fn)) {
|
3028 | suspense.effects.push(...fn);
|
3029 | }
|
3030 | else {
|
3031 | suspense.effects.push(fn);
|
3032 | }
|
3033 | }
|
3034 | else {
|
3035 | queuePostFlushCb(fn);
|
3036 | }
|
3037 | }
|
3038 | function setActiveBranch(suspense, branch) {
|
3039 | suspense.activeBranch = branch;
|
3040 | const { vnode, parentComponent } = suspense;
|
3041 | const el = (vnode.el = branch.el);
|
3042 |
|
3043 |
|
3044 | if (parentComponent && parentComponent.subTree === vnode) {
|
3045 | parentComponent.vnode.el = el;
|
3046 | updateHOCHostEl(parentComponent, el);
|
3047 | }
|
3048 | }
|
3049 |
|
3050 | function provide(key, value) {
|
3051 | if (!currentInstance) {
|
3052 | {
|
3053 | warn(`provide() can only be used inside setup().`);
|
3054 | }
|
3055 | }
|
3056 | else {
|
3057 | let provides = currentInstance.provides;
|
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 |
|
3063 | const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
3064 | if (parentProvides === provides) {
|
3065 | provides = currentInstance.provides = Object.create(parentProvides);
|
3066 | }
|
3067 |
|
3068 | provides[key] = value;
|
3069 | }
|
3070 | }
|
3071 | function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
3072 |
|
3073 |
|
3074 | const instance = currentInstance || currentRenderingInstance;
|
3075 | if (instance) {
|
3076 |
|
3077 |
|
3078 |
|
3079 | const provides = instance.parent == null
|
3080 | ? instance.vnode.appContext && instance.vnode.appContext.provides
|
3081 | : instance.parent.provides;
|
3082 | if (provides && key in provides) {
|
3083 |
|
3084 | return provides[key];
|
3085 | }
|
3086 | else if (arguments.length > 1) {
|
3087 | return treatDefaultAsFactory && isFunction(defaultValue)
|
3088 | ? defaultValue()
|
3089 | : defaultValue;
|
3090 | }
|
3091 | else {
|
3092 | warn(`injection "${String(key)}" not found.`);
|
3093 | }
|
3094 | }
|
3095 | else {
|
3096 | warn(`inject() can only be used inside setup() or functional components.`);
|
3097 | }
|
3098 | }
|
3099 |
|
3100 |
|
3101 | function watchEffect(effect, options) {
|
3102 | return doWatch(effect, null, options);
|
3103 | }
|
3104 |
|
3105 | const INITIAL_WATCHER_VALUE = {};
|
3106 |
|
3107 | function watch(source, cb, options) {
|
3108 | if (!isFunction(cb)) {
|
3109 | warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
|
3110 | `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
|
3111 | `supports \`watch(source, cb, options?) signature.`);
|
3112 | }
|
3113 | return doWatch(source, cb, options);
|
3114 | }
|
3115 | function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ, instance = currentInstance) {
|
3116 | if (!cb) {
|
3117 | if (immediate !== undefined) {
|
3118 | warn(`watch() "immediate" option is only respected when using the ` +
|
3119 | `watch(source, callback, options?) signature.`);
|
3120 | }
|
3121 | if (deep !== undefined) {
|
3122 | warn(`watch() "deep" option is only respected when using the ` +
|
3123 | `watch(source, callback, options?) signature.`);
|
3124 | }
|
3125 | }
|
3126 | const warnInvalidSource = (s) => {
|
3127 | warn(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, ` +
|
3128 | `a reactive object, or an array of these types.`);
|
3129 | };
|
3130 | let getter;
|
3131 | let forceTrigger = false;
|
3132 | let isMultiSource = false;
|
3133 | if (isRef(source)) {
|
3134 | getter = () => source.value;
|
3135 | forceTrigger = !!source._shallow;
|
3136 | }
|
3137 | else if (isReactive(source)) {
|
3138 | getter = () => source;
|
3139 | deep = true;
|
3140 | }
|
3141 | else if (isArray(source)) {
|
3142 | isMultiSource = true;
|
3143 | forceTrigger = source.some(isReactive);
|
3144 | getter = () => source.map(s => {
|
3145 | if (isRef(s)) {
|
3146 | return s.value;
|
3147 | }
|
3148 | else if (isReactive(s)) {
|
3149 | return traverse(s);
|
3150 | }
|
3151 | else if (isFunction(s)) {
|
3152 | return callWithErrorHandling(s, instance, 2 );
|
3153 | }
|
3154 | else {
|
3155 | warnInvalidSource(s);
|
3156 | }
|
3157 | });
|
3158 | }
|
3159 | else if (isFunction(source)) {
|
3160 | if (cb) {
|
3161 |
|
3162 | getter = () => callWithErrorHandling(source, instance, 2 );
|
3163 | }
|
3164 | else {
|
3165 |
|
3166 | getter = () => {
|
3167 | if (instance && instance.isUnmounted) {
|
3168 | return;
|
3169 | }
|
3170 | if (cleanup) {
|
3171 | cleanup();
|
3172 | }
|
3173 | return callWithAsyncErrorHandling(source, instance, 3 , [onInvalidate]);
|
3174 | };
|
3175 | }
|
3176 | }
|
3177 | else {
|
3178 | getter = NOOP;
|
3179 | warnInvalidSource(source);
|
3180 | }
|
3181 | if (cb && deep) {
|
3182 | const baseGetter = getter;
|
3183 | getter = () => traverse(baseGetter());
|
3184 | }
|
3185 | let cleanup;
|
3186 | let onInvalidate = (fn) => {
|
3187 | cleanup = runner.options.onStop = () => {
|
3188 | callWithErrorHandling(fn, instance, 4 );
|
3189 | };
|
3190 | };
|
3191 | let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
|
3192 | const job = () => {
|
3193 | if (!runner.active) {
|
3194 | return;
|
3195 | }
|
3196 | if (cb) {
|
3197 |
|
3198 | const newValue = runner();
|
3199 | if (deep ||
|
3200 | forceTrigger ||
|
3201 | (isMultiSource
|
3202 | ? newValue.some((v, i) => hasChanged(v, oldValue[i]))
|
3203 | : hasChanged(newValue, oldValue)) ||
|
3204 | (false )) {
|
3205 |
|
3206 | if (cleanup) {
|
3207 | cleanup();
|
3208 | }
|
3209 | callWithAsyncErrorHandling(cb, instance, 3 , [
|
3210 | newValue,
|
3211 |
|
3212 | oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
|
3213 | onInvalidate
|
3214 | ]);
|
3215 | oldValue = newValue;
|
3216 | }
|
3217 | }
|
3218 | else {
|
3219 |
|
3220 | runner();
|
3221 | }
|
3222 | };
|
3223 |
|
3224 |
|
3225 | job.allowRecurse = !!cb;
|
3226 | let scheduler;
|
3227 | if (flush === 'sync') {
|
3228 | scheduler = job;
|
3229 | }
|
3230 | else if (flush === 'post') {
|
3231 | scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
3232 | }
|
3233 | else {
|
3234 |
|
3235 | scheduler = () => {
|
3236 | if (!instance || instance.isMounted) {
|
3237 | queuePreFlushCb(job);
|
3238 | }
|
3239 | else {
|
3240 |
|
3241 |
|
3242 | job();
|
3243 | }
|
3244 | };
|
3245 | }
|
3246 | const runner = effect(getter, {
|
3247 | lazy: true,
|
3248 | onTrack,
|
3249 | onTrigger,
|
3250 | scheduler
|
3251 | });
|
3252 | recordInstanceBoundEffect(runner, instance);
|
3253 |
|
3254 | if (cb) {
|
3255 | if (immediate) {
|
3256 | job();
|
3257 | }
|
3258 | else {
|
3259 | oldValue = runner();
|
3260 | }
|
3261 | }
|
3262 | else if (flush === 'post') {
|
3263 | queuePostRenderEffect(runner, instance && instance.suspense);
|
3264 | }
|
3265 | else {
|
3266 | runner();
|
3267 | }
|
3268 | return () => {
|
3269 | stop(runner);
|
3270 | if (instance) {
|
3271 | remove(instance.effects, runner);
|
3272 | }
|
3273 | };
|
3274 | }
|
3275 |
|
3276 | function instanceWatch(source, value, options) {
|
3277 | const publicThis = this.proxy;
|
3278 | const getter = isString(source)
|
3279 | ? source.includes('.')
|
3280 | ? createPathGetter(publicThis, source)
|
3281 | : () => publicThis[source]
|
3282 | : source.bind(publicThis, publicThis);
|
3283 | let cb;
|
3284 | if (isFunction(value)) {
|
3285 | cb = value;
|
3286 | }
|
3287 | else {
|
3288 | cb = value.handler;
|
3289 | options = value;
|
3290 | }
|
3291 | return doWatch(getter, cb.bind(publicThis), options, this);
|
3292 | }
|
3293 | function createPathGetter(ctx, path) {
|
3294 | const segments = path.split('.');
|
3295 | return () => {
|
3296 | let cur = ctx;
|
3297 | for (let i = 0; i < segments.length && cur; i++) {
|
3298 | cur = cur[segments[i]];
|
3299 | }
|
3300 | return cur;
|
3301 | };
|
3302 | }
|
3303 | function traverse(value, seen = new Set()) {
|
3304 | if (!isObject(value) ||
|
3305 | seen.has(value) ||
|
3306 | value["__v_skip" ]) {
|
3307 | return value;
|
3308 | }
|
3309 | seen.add(value);
|
3310 | if (isRef(value)) {
|
3311 | traverse(value.value, seen);
|
3312 | }
|
3313 | else if (isArray(value)) {
|
3314 | for (let i = 0; i < value.length; i++) {
|
3315 | traverse(value[i], seen);
|
3316 | }
|
3317 | }
|
3318 | else if (isSet(value) || isMap(value)) {
|
3319 | value.forEach((v) => {
|
3320 | traverse(v, seen);
|
3321 | });
|
3322 | }
|
3323 | else if (isPlainObject(value)) {
|
3324 | for (const key in value) {
|
3325 | traverse(value[key], seen);
|
3326 | }
|
3327 | }
|
3328 | return value;
|
3329 | }
|
3330 |
|
3331 | function useTransitionState() {
|
3332 | const state = {
|
3333 | isMounted: false,
|
3334 | isLeaving: false,
|
3335 | isUnmounting: false,
|
3336 | leavingVNodes: new Map()
|
3337 | };
|
3338 | onMounted(() => {
|
3339 | state.isMounted = true;
|
3340 | });
|
3341 | onBeforeUnmount(() => {
|
3342 | state.isUnmounting = true;
|
3343 | });
|
3344 | return state;
|
3345 | }
|
3346 | const TransitionHookValidator = [Function, Array];
|
3347 | const BaseTransitionImpl = {
|
3348 | name: `BaseTransition`,
|
3349 | props: {
|
3350 | mode: String,
|
3351 | appear: Boolean,
|
3352 | persisted: Boolean,
|
3353 |
|
3354 | onBeforeEnter: TransitionHookValidator,
|
3355 | onEnter: TransitionHookValidator,
|
3356 | onAfterEnter: TransitionHookValidator,
|
3357 | onEnterCancelled: TransitionHookValidator,
|
3358 |
|
3359 | onBeforeLeave: TransitionHookValidator,
|
3360 | onLeave: TransitionHookValidator,
|
3361 | onAfterLeave: TransitionHookValidator,
|
3362 | onLeaveCancelled: TransitionHookValidator,
|
3363 |
|
3364 | onBeforeAppear: TransitionHookValidator,
|
3365 | onAppear: TransitionHookValidator,
|
3366 | onAfterAppear: TransitionHookValidator,
|
3367 | onAppearCancelled: TransitionHookValidator
|
3368 | },
|
3369 | setup(props, { slots }) {
|
3370 | const instance = getCurrentInstance();
|
3371 | const state = useTransitionState();
|
3372 | let prevTransitionKey;
|
3373 | return () => {
|
3374 | const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
3375 | if (!children || !children.length) {
|
3376 | return;
|
3377 | }
|
3378 |
|
3379 | if (children.length > 1) {
|
3380 | warn('<transition> can only be used on a single element or component. Use ' +
|
3381 | '<transition-group> for lists.');
|
3382 | }
|
3383 |
|
3384 |
|
3385 | const rawProps = toRaw(props);
|
3386 | const { mode } = rawProps;
|
3387 |
|
3388 | if (mode && !['in-out', 'out-in', 'default'].includes(mode)) {
|
3389 | warn(`invalid <transition> mode: ${mode}`);
|
3390 | }
|
3391 |
|
3392 | const child = children[0];
|
3393 | if (state.isLeaving) {
|
3394 | return emptyPlaceholder(child);
|
3395 | }
|
3396 |
|
3397 |
|
3398 | const innerChild = getKeepAliveChild(child);
|
3399 | if (!innerChild) {
|
3400 | return emptyPlaceholder(child);
|
3401 | }
|
3402 | const enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance);
|
3403 | setTransitionHooks(innerChild, enterHooks);
|
3404 | const oldChild = instance.subTree;
|
3405 | const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
|
3406 | let transitionKeyChanged = false;
|
3407 | const { getTransitionKey } = innerChild.type;
|
3408 | if (getTransitionKey) {
|
3409 | const key = getTransitionKey();
|
3410 | if (prevTransitionKey === undefined) {
|
3411 | prevTransitionKey = key;
|
3412 | }
|
3413 | else if (key !== prevTransitionKey) {
|
3414 | prevTransitionKey = key;
|
3415 | transitionKeyChanged = true;
|
3416 | }
|
3417 | }
|
3418 |
|
3419 | if (oldInnerChild &&
|
3420 | oldInnerChild.type !== Comment$1 &&
|
3421 | (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
|
3422 | const leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
|
3423 |
|
3424 | setTransitionHooks(oldInnerChild, leavingHooks);
|
3425 |
|
3426 | if (mode === 'out-in') {
|
3427 | state.isLeaving = true;
|
3428 |
|
3429 | leavingHooks.afterLeave = () => {
|
3430 | state.isLeaving = false;
|
3431 | instance.update();
|
3432 | };
|
3433 | return emptyPlaceholder(child);
|
3434 | }
|
3435 | else if (mode === 'in-out' && innerChild.type !== Comment$1) {
|
3436 | leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
3437 | const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
|
3438 | leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
3439 |
|
3440 | el._leaveCb = () => {
|
3441 | earlyRemove();
|
3442 | el._leaveCb = undefined;
|
3443 | delete enterHooks.delayedLeave;
|
3444 | };
|
3445 | enterHooks.delayedLeave = delayedLeave;
|
3446 | };
|
3447 | }
|
3448 | }
|
3449 | return child;
|
3450 | };
|
3451 | }
|
3452 | };
|
3453 |
|
3454 |
|
3455 | const BaseTransition = BaseTransitionImpl;
|
3456 | function getLeavingNodesForType(state, vnode) {
|
3457 | const { leavingVNodes } = state;
|
3458 | let leavingVNodesCache = leavingVNodes.get(vnode.type);
|
3459 | if (!leavingVNodesCache) {
|
3460 | leavingVNodesCache = Object.create(null);
|
3461 | leavingVNodes.set(vnode.type, leavingVNodesCache);
|
3462 | }
|
3463 | return leavingVNodesCache;
|
3464 | }
|
3465 |
|
3466 |
|
3467 | function resolveTransitionHooks(vnode, props, state, instance) {
|
3468 | const { appear, mode, persisted = false, onBeforeEnter, onEnter, onAfterEnter, onEnterCancelled, onBeforeLeave, onLeave, onAfterLeave, onLeaveCancelled, onBeforeAppear, onAppear, onAfterAppear, onAppearCancelled } = props;
|
3469 | const key = String(vnode.key);
|
3470 | const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
3471 | const callHook = (hook, args) => {
|
3472 | hook &&
|
3473 | callWithAsyncErrorHandling(hook, instance, 9 , args);
|
3474 | };
|
3475 | const hooks = {
|
3476 | mode,
|
3477 | persisted,
|
3478 | beforeEnter(el) {
|
3479 | let hook = onBeforeEnter;
|
3480 | if (!state.isMounted) {
|
3481 | if (appear) {
|
3482 | hook = onBeforeAppear || onBeforeEnter;
|
3483 | }
|
3484 | else {
|
3485 | return;
|
3486 | }
|
3487 | }
|
3488 |
|
3489 | if (el._leaveCb) {
|
3490 | el._leaveCb(true );
|
3491 | }
|
3492 |
|
3493 | const leavingVNode = leavingVNodesCache[key];
|
3494 | if (leavingVNode &&
|
3495 | isSameVNodeType(vnode, leavingVNode) &&
|
3496 | leavingVNode.el._leaveCb) {
|
3497 |
|
3498 | leavingVNode.el._leaveCb();
|
3499 | }
|
3500 | callHook(hook, [el]);
|
3501 | },
|
3502 | enter(el) {
|
3503 | let hook = onEnter;
|
3504 | let afterHook = onAfterEnter;
|
3505 | let cancelHook = onEnterCancelled;
|
3506 | if (!state.isMounted) {
|
3507 | if (appear) {
|
3508 | hook = onAppear || onEnter;
|
3509 | afterHook = onAfterAppear || onAfterEnter;
|
3510 | cancelHook = onAppearCancelled || onEnterCancelled;
|
3511 | }
|
3512 | else {
|
3513 | return;
|
3514 | }
|
3515 | }
|
3516 | let called = false;
|
3517 | const done = (el._enterCb = (cancelled) => {
|
3518 | if (called)
|
3519 | return;
|
3520 | called = true;
|
3521 | if (cancelled) {
|
3522 | callHook(cancelHook, [el]);
|
3523 | }
|
3524 | else {
|
3525 | callHook(afterHook, [el]);
|
3526 | }
|
3527 | if (hooks.delayedLeave) {
|
3528 | hooks.delayedLeave();
|
3529 | }
|
3530 | el._enterCb = undefined;
|
3531 | });
|
3532 | if (hook) {
|
3533 | hook(el, done);
|
3534 | if (hook.length <= 1) {
|
3535 | done();
|
3536 | }
|
3537 | }
|
3538 | else {
|
3539 | done();
|
3540 | }
|
3541 | },
|
3542 | leave(el, remove) {
|
3543 | const key = String(vnode.key);
|
3544 | if (el._enterCb) {
|
3545 | el._enterCb(true );
|
3546 | }
|
3547 | if (state.isUnmounting) {
|
3548 | return remove();
|
3549 | }
|
3550 | callHook(onBeforeLeave, [el]);
|
3551 | let called = false;
|
3552 | const done = (el._leaveCb = (cancelled) => {
|
3553 | if (called)
|
3554 | return;
|
3555 | called = true;
|
3556 | remove();
|
3557 | if (cancelled) {
|
3558 | callHook(onLeaveCancelled, [el]);
|
3559 | }
|
3560 | else {
|
3561 | callHook(onAfterLeave, [el]);
|
3562 | }
|
3563 | el._leaveCb = undefined;
|
3564 | if (leavingVNodesCache[key] === vnode) {
|
3565 | delete leavingVNodesCache[key];
|
3566 | }
|
3567 | });
|
3568 | leavingVNodesCache[key] = vnode;
|
3569 | if (onLeave) {
|
3570 | onLeave(el, done);
|
3571 | if (onLeave.length <= 1) {
|
3572 | done();
|
3573 | }
|
3574 | }
|
3575 | else {
|
3576 | done();
|
3577 | }
|
3578 | },
|
3579 | clone(vnode) {
|
3580 | return resolveTransitionHooks(vnode, props, state, instance);
|
3581 | }
|
3582 | };
|
3583 | return hooks;
|
3584 | }
|
3585 |
|
3586 |
|
3587 |
|
3588 |
|
3589 | function emptyPlaceholder(vnode) {
|
3590 | if (isKeepAlive(vnode)) {
|
3591 | vnode = cloneVNode(vnode);
|
3592 | vnode.children = null;
|
3593 | return vnode;
|
3594 | }
|
3595 | }
|
3596 | function getKeepAliveChild(vnode) {
|
3597 | return isKeepAlive(vnode)
|
3598 | ? vnode.children
|
3599 | ? vnode.children[0]
|
3600 | : undefined
|
3601 | : vnode;
|
3602 | }
|
3603 | function setTransitionHooks(vnode, hooks) {
|
3604 | if (vnode.shapeFlag & 6 && vnode.component) {
|
3605 | setTransitionHooks(vnode.component.subTree, hooks);
|
3606 | }
|
3607 | else if (vnode.shapeFlag & 128 ) {
|
3608 | vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
3609 | vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
3610 | }
|
3611 | else {
|
3612 | vnode.transition = hooks;
|
3613 | }
|
3614 | }
|
3615 | function getTransitionRawChildren(children, keepComment = false) {
|
3616 | let ret = [];
|
3617 | let keyedFragmentCount = 0;
|
3618 | for (let i = 0; i < children.length; i++) {
|
3619 | const child = children[i];
|
3620 |
|
3621 | if (child.type === Fragment) {
|
3622 | if (child.patchFlag & 128 )
|
3623 | keyedFragmentCount++;
|
3624 | ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
|
3625 | }
|
3626 |
|
3627 | else if (keepComment || child.type !== Comment$1) {
|
3628 | ret.push(child);
|
3629 | }
|
3630 | }
|
3631 |
|
3632 |
|
3633 |
|
3634 |
|
3635 | if (keyedFragmentCount > 1) {
|
3636 | for (let i = 0; i < ret.length; i++) {
|
3637 | ret[i].patchFlag = -2 ;
|
3638 | }
|
3639 | }
|
3640 | return ret;
|
3641 | }
|
3642 |
|
3643 |
|
3644 | function defineComponent(options) {
|
3645 | return isFunction(options) ? { setup: options, name: options.name } : options;
|
3646 | }
|
3647 |
|
3648 | const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
3649 | function defineAsyncComponent(source) {
|
3650 | if (isFunction(source)) {
|
3651 | source = { loader: source };
|
3652 | }
|
3653 | const { loader, loadingComponent, errorComponent, delay = 200, timeout,
|
3654 | suspensible = true, onError: userOnError } = source;
|
3655 | let pendingRequest = null;
|
3656 | let resolvedComp;
|
3657 | let retries = 0;
|
3658 | const retry = () => {
|
3659 | retries++;
|
3660 | pendingRequest = null;
|
3661 | return load();
|
3662 | };
|
3663 | const load = () => {
|
3664 | let thisRequest;
|
3665 | return (pendingRequest ||
|
3666 | (thisRequest = pendingRequest = loader()
|
3667 | .catch(err => {
|
3668 | err = err instanceof Error ? err : new Error(String(err));
|
3669 | if (userOnError) {
|
3670 | return new Promise((resolve, reject) => {
|
3671 | const userRetry = () => resolve(retry());
|
3672 | const userFail = () => reject(err);
|
3673 | userOnError(err, userRetry, userFail, retries + 1);
|
3674 | });
|
3675 | }
|
3676 | else {
|
3677 | throw err;
|
3678 | }
|
3679 | })
|
3680 | .then((comp) => {
|
3681 | if (thisRequest !== pendingRequest && pendingRequest) {
|
3682 | return pendingRequest;
|
3683 | }
|
3684 | if (!comp) {
|
3685 | warn(`Async component loader resolved to undefined. ` +
|
3686 | `If you are using retry(), make sure to return its return value.`);
|
3687 | }
|
3688 |
|
3689 | if (comp &&
|
3690 | (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
|
3691 | comp = comp.default;
|
3692 | }
|
3693 | if (comp && !isObject(comp) && !isFunction(comp)) {
|
3694 | throw new Error(`Invalid async component load result: ${comp}`);
|
3695 | }
|
3696 | resolvedComp = comp;
|
3697 | return comp;
|
3698 | })));
|
3699 | };
|
3700 | return defineComponent({
|
3701 | name: 'AsyncComponentWrapper',
|
3702 | __asyncLoader: load,
|
3703 | get __asyncResolved() {
|
3704 | return resolvedComp;
|
3705 | },
|
3706 | setup() {
|
3707 | const instance = currentInstance;
|
3708 |
|
3709 | if (resolvedComp) {
|
3710 | return () => createInnerComp(resolvedComp, instance);
|
3711 | }
|
3712 | const onError = (err) => {
|
3713 | pendingRequest = null;
|
3714 | handleError(err, instance, 13 , !errorComponent );
|
3715 | };
|
3716 |
|
3717 | if ((suspensible && instance.suspense) ||
|
3718 | (false )) {
|
3719 | return load()
|
3720 | .then(comp => {
|
3721 | return () => createInnerComp(comp, instance);
|
3722 | })
|
3723 | .catch(err => {
|
3724 | onError(err);
|
3725 | return () => errorComponent
|
3726 | ? createVNode(errorComponent, {
|
3727 | error: err
|
3728 | })
|
3729 | : null;
|
3730 | });
|
3731 | }
|
3732 | const loaded = ref(false);
|
3733 | const error = ref();
|
3734 | const delayed = ref(!!delay);
|
3735 | if (delay) {
|
3736 | setTimeout(() => {
|
3737 | delayed.value = false;
|
3738 | }, delay);
|
3739 | }
|
3740 | if (timeout != null) {
|
3741 | setTimeout(() => {
|
3742 | if (!loaded.value && !error.value) {
|
3743 | const err = new Error(`Async component timed out after ${timeout}ms.`);
|
3744 | onError(err);
|
3745 | error.value = err;
|
3746 | }
|
3747 | }, timeout);
|
3748 | }
|
3749 | load()
|
3750 | .then(() => {
|
3751 | loaded.value = true;
|
3752 | if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
3753 |
|
3754 |
|
3755 | queueJob(instance.parent.update);
|
3756 | }
|
3757 | })
|
3758 | .catch(err => {
|
3759 | onError(err);
|
3760 | error.value = err;
|
3761 | });
|
3762 | return () => {
|
3763 | if (loaded.value && resolvedComp) {
|
3764 | return createInnerComp(resolvedComp, instance);
|
3765 | }
|
3766 | else if (error.value && errorComponent) {
|
3767 | return createVNode(errorComponent, {
|
3768 | error: error.value
|
3769 | });
|
3770 | }
|
3771 | else if (loadingComponent && !delayed.value) {
|
3772 | return createVNode(loadingComponent);
|
3773 | }
|
3774 | };
|
3775 | }
|
3776 | });
|
3777 | }
|
3778 | function createInnerComp(comp, { vnode: { ref, props, children } }) {
|
3779 | const vnode = createVNode(comp, props, children);
|
3780 |
|
3781 | vnode.ref = ref;
|
3782 | return vnode;
|
3783 | }
|
3784 |
|
3785 | const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
3786 | const KeepAliveImpl = {
|
3787 | name: `KeepAlive`,
|
3788 |
|
3789 |
|
3790 |
|
3791 | __isKeepAlive: true,
|
3792 | props: {
|
3793 | include: [String, RegExp, Array],
|
3794 | exclude: [String, RegExp, Array],
|
3795 | max: [String, Number]
|
3796 | },
|
3797 | setup(props, { slots }) {
|
3798 | const instance = getCurrentInstance();
|
3799 |
|
3800 |
|
3801 |
|
3802 |
|
3803 |
|
3804 | const sharedContext = instance.ctx;
|
3805 |
|
3806 |
|
3807 | if (!sharedContext.renderer) {
|
3808 | return slots.default;
|
3809 | }
|
3810 | const cache = new Map();
|
3811 | const keys = new Set();
|
3812 | let current = null;
|
3813 | {
|
3814 | instance.__v_cache = cache;
|
3815 | }
|
3816 | const parentSuspense = instance.suspense;
|
3817 | const { renderer: { p: patch, m: move, um: _unmount, o: { createElement } } } = sharedContext;
|
3818 | const storageContainer = createElement('div');
|
3819 | sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
|
3820 | const instance = vnode.component;
|
3821 | move(vnode, container, anchor, 0 , parentSuspense);
|
3822 |
|
3823 | patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, vnode.slotScopeIds, optimized);
|
3824 | queuePostRenderEffect(() => {
|
3825 | instance.isDeactivated = false;
|
3826 | if (instance.a) {
|
3827 | invokeArrayFns(instance.a);
|
3828 | }
|
3829 | const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
3830 | if (vnodeHook) {
|
3831 | invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
3832 | }
|
3833 | }, parentSuspense);
|
3834 | {
|
3835 |
|
3836 | devtoolsComponentAdded(instance);
|
3837 | }
|
3838 | };
|
3839 | sharedContext.deactivate = (vnode) => {
|
3840 | const instance = vnode.component;
|
3841 | move(vnode, storageContainer, null, 1 , parentSuspense);
|
3842 | queuePostRenderEffect(() => {
|
3843 | if (instance.da) {
|
3844 | invokeArrayFns(instance.da);
|
3845 | }
|
3846 | const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
3847 | if (vnodeHook) {
|
3848 | invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
3849 | }
|
3850 | instance.isDeactivated = true;
|
3851 | }, parentSuspense);
|
3852 | {
|
3853 |
|
3854 | devtoolsComponentAdded(instance);
|
3855 | }
|
3856 | };
|
3857 | function unmount(vnode) {
|
3858 |
|
3859 | resetShapeFlag(vnode);
|
3860 | _unmount(vnode, instance, parentSuspense);
|
3861 | }
|
3862 | function pruneCache(filter) {
|
3863 | cache.forEach((vnode, key) => {
|
3864 | const name = getComponentName(vnode.type);
|
3865 | if (name && (!filter || !filter(name))) {
|
3866 | pruneCacheEntry(key);
|
3867 | }
|
3868 | });
|
3869 | }
|
3870 | function pruneCacheEntry(key) {
|
3871 | const cached = cache.get(key);
|
3872 | if (!current || cached.type !== current.type) {
|
3873 | unmount(cached);
|
3874 | }
|
3875 | else if (current) {
|
3876 |
|
3877 |
|
3878 | resetShapeFlag(current);
|
3879 | }
|
3880 | cache.delete(key);
|
3881 | keys.delete(key);
|
3882 | }
|
3883 |
|
3884 | watch(() => [props.include, props.exclude], ([include, exclude]) => {
|
3885 | include && pruneCache(name => matches(include, name));
|
3886 | exclude && pruneCache(name => !matches(exclude, name));
|
3887 | },
|
3888 |
|
3889 | { flush: 'post', deep: true });
|
3890 |
|
3891 | let pendingCacheKey = null;
|
3892 | const cacheSubtree = () => {
|
3893 |
|
3894 | if (pendingCacheKey != null) {
|
3895 | cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
3896 | }
|
3897 | };
|
3898 | onMounted(cacheSubtree);
|
3899 | onUpdated(cacheSubtree);
|
3900 | onBeforeUnmount(() => {
|
3901 | cache.forEach(cached => {
|
3902 | const { subTree, suspense } = instance;
|
3903 | const vnode = getInnerChild(subTree);
|
3904 | if (cached.type === vnode.type) {
|
3905 |
|
3906 | resetShapeFlag(vnode);
|
3907 |
|
3908 | const da = vnode.component.da;
|
3909 | da && queuePostRenderEffect(da, suspense);
|
3910 | return;
|
3911 | }
|
3912 | unmount(cached);
|
3913 | });
|
3914 | });
|
3915 | return () => {
|
3916 | pendingCacheKey = null;
|
3917 | if (!slots.default) {
|
3918 | return null;
|
3919 | }
|
3920 | const children = slots.default();
|
3921 | const rawVNode = children[0];
|
3922 | if (children.length > 1) {
|
3923 | {
|
3924 | warn(`KeepAlive should contain exactly one component child.`);
|
3925 | }
|
3926 | current = null;
|
3927 | return children;
|
3928 | }
|
3929 | else if (!isVNode(rawVNode) ||
|
3930 | (!(rawVNode.shapeFlag & 4 ) &&
|
3931 | !(rawVNode.shapeFlag & 128 ))) {
|
3932 | current = null;
|
3933 | return rawVNode;
|
3934 | }
|
3935 | let vnode = getInnerChild(rawVNode);
|
3936 | const comp = vnode.type;
|
3937 |
|
3938 |
|
3939 | const name = getComponentName(isAsyncWrapper(vnode)
|
3940 | ? vnode.type.__asyncResolved || {}
|
3941 | : comp);
|
3942 | const { include, exclude, max } = props;
|
3943 | if ((include && (!name || !matches(include, name))) ||
|
3944 | (exclude && name && matches(exclude, name))) {
|
3945 | current = vnode;
|
3946 | return rawVNode;
|
3947 | }
|
3948 | const key = vnode.key == null ? comp : vnode.key;
|
3949 | const cachedVNode = cache.get(key);
|
3950 |
|
3951 | if (vnode.el) {
|
3952 | vnode = cloneVNode(vnode);
|
3953 | if (rawVNode.shapeFlag & 128 ) {
|
3954 | rawVNode.ssContent = vnode;
|
3955 | }
|
3956 | }
|
3957 |
|
3958 |
|
3959 |
|
3960 |
|
3961 |
|
3962 | pendingCacheKey = key;
|
3963 | if (cachedVNode) {
|
3964 |
|
3965 | vnode.el = cachedVNode.el;
|
3966 | vnode.component = cachedVNode.component;
|
3967 | if (vnode.transition) {
|
3968 |
|
3969 | setTransitionHooks(vnode, vnode.transition);
|
3970 | }
|
3971 |
|
3972 | vnode.shapeFlag |= 512 ;
|
3973 |
|
3974 | keys.delete(key);
|
3975 | keys.add(key);
|
3976 | }
|
3977 | else {
|
3978 | keys.add(key);
|
3979 |
|
3980 | if (max && keys.size > parseInt(max, 10)) {
|
3981 | pruneCacheEntry(keys.values().next().value);
|
3982 | }
|
3983 | }
|
3984 |
|
3985 | vnode.shapeFlag |= 256 ;
|
3986 | current = vnode;
|
3987 | return rawVNode;
|
3988 | };
|
3989 | }
|
3990 | };
|
3991 |
|
3992 |
|
3993 | const KeepAlive = KeepAliveImpl;
|
3994 | function matches(pattern, name) {
|
3995 | if (isArray(pattern)) {
|
3996 | return pattern.some((p) => matches(p, name));
|
3997 | }
|
3998 | else if (isString(pattern)) {
|
3999 | return pattern.split(',').indexOf(name) > -1;
|
4000 | }
|
4001 | else if (pattern.test) {
|
4002 | return pattern.test(name);
|
4003 | }
|
4004 |
|
4005 | return false;
|
4006 | }
|
4007 | function onActivated(hook, target) {
|
4008 | registerKeepAliveHook(hook, "a" , target);
|
4009 | }
|
4010 | function onDeactivated(hook, target) {
|
4011 | registerKeepAliveHook(hook, "da" , target);
|
4012 | }
|
4013 | function registerKeepAliveHook(hook, type, target = currentInstance) {
|
4014 |
|
4015 |
|
4016 |
|
4017 | const wrappedHook = hook.__wdc ||
|
4018 | (hook.__wdc = () => {
|
4019 |
|
4020 | let current = target;
|
4021 | while (current) {
|
4022 | if (current.isDeactivated) {
|
4023 | return;
|
4024 | }
|
4025 | current = current.parent;
|
4026 | }
|
4027 | hook();
|
4028 | });
|
4029 | injectHook(type, wrappedHook, target);
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 | if (target) {
|
4036 | let current = target.parent;
|
4037 | while (current && current.parent) {
|
4038 | if (isKeepAlive(current.parent.vnode)) {
|
4039 | injectToKeepAliveRoot(wrappedHook, type, target, current);
|
4040 | }
|
4041 | current = current.parent;
|
4042 | }
|
4043 | }
|
4044 | }
|
4045 | function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
4046 |
|
4047 |
|
4048 | const injected = injectHook(type, hook, keepAliveRoot, true );
|
4049 | onUnmounted(() => {
|
4050 | remove(keepAliveRoot[type], injected);
|
4051 | }, target);
|
4052 | }
|
4053 | function resetShapeFlag(vnode) {
|
4054 | let shapeFlag = vnode.shapeFlag;
|
4055 | if (shapeFlag & 256 ) {
|
4056 | shapeFlag -= 256 ;
|
4057 | }
|
4058 | if (shapeFlag & 512 ) {
|
4059 | shapeFlag -= 512 ;
|
4060 | }
|
4061 | vnode.shapeFlag = shapeFlag;
|
4062 | }
|
4063 | function getInnerChild(vnode) {
|
4064 | return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
4065 | }
|
4066 |
|
4067 | function injectHook(type, hook, target = currentInstance, prepend = false) {
|
4068 | if (target) {
|
4069 | const hooks = target[type] || (target[type] = []);
|
4070 |
|
4071 |
|
4072 |
|
4073 | const wrappedHook = hook.__weh ||
|
4074 | (hook.__weh = (...args) => {
|
4075 | if (target.isUnmounted) {
|
4076 | return;
|
4077 | }
|
4078 |
|
4079 |
|
4080 | pauseTracking();
|
4081 |
|
4082 |
|
4083 |
|
4084 | setCurrentInstance(target);
|
4085 | const res = callWithAsyncErrorHandling(hook, target, type, args);
|
4086 | setCurrentInstance(null);
|
4087 | resetTracking();
|
4088 | return res;
|
4089 | });
|
4090 | if (prepend) {
|
4091 | hooks.unshift(wrappedHook);
|
4092 | }
|
4093 | else {
|
4094 | hooks.push(wrappedHook);
|
4095 | }
|
4096 | return wrappedHook;
|
4097 | }
|
4098 | else {
|
4099 | const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ''));
|
4100 | warn(`${apiName} is called when there is no active component instance to be ` +
|
4101 | `associated with. ` +
|
4102 | `Lifecycle injection APIs can only be used during execution of setup().` +
|
4103 | (` If you are using async setup(), make sure to register lifecycle ` +
|
4104 | `hooks before the first await statement.`
|
4105 | ));
|
4106 | }
|
4107 | }
|
4108 | const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
4109 |
|
4110 | (!isInSSRComponentSetup || lifecycle === "sp" ) &&
|
4111 | injectHook(lifecycle, hook, target);
|
4112 | const onBeforeMount = createHook("bm" );
|
4113 | const onMounted = createHook("m" );
|
4114 | const onBeforeUpdate = createHook("bu" );
|
4115 | const onUpdated = createHook("u" );
|
4116 | const onBeforeUnmount = createHook("bum" );
|
4117 | const onUnmounted = createHook("um" );
|
4118 | const onServerPrefetch = createHook("sp" );
|
4119 | const onRenderTriggered = createHook("rtg" );
|
4120 | const onRenderTracked = createHook("rtc" );
|
4121 | function onErrorCaptured(hook, target = currentInstance) {
|
4122 | injectHook("ec" , hook, target);
|
4123 | }
|
4124 |
|
4125 | function createDuplicateChecker() {
|
4126 | const cache = Object.create(null);
|
4127 | return (type, key) => {
|
4128 | if (cache[key]) {
|
4129 | warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
4130 | }
|
4131 | else {
|
4132 | cache[key] = type;
|
4133 | }
|
4134 | };
|
4135 | }
|
4136 | let shouldCacheAccess = true;
|
4137 | function applyOptions(instance) {
|
4138 | const options = resolveMergedOptions(instance);
|
4139 | const publicThis = instance.proxy;
|
4140 | const ctx = instance.ctx;
|
4141 |
|
4142 | shouldCacheAccess = false;
|
4143 |
|
4144 |
|
4145 | if (options.beforeCreate) {
|
4146 | callHook(options.beforeCreate, instance, "bc" );
|
4147 | }
|
4148 | const {
|
4149 |
|
4150 | data: dataOptions, computed: computedOptions, methods, watch: watchOptions, provide: provideOptions, inject: injectOptions,
|
4151 |
|
4152 | created, beforeMount, mounted, beforeUpdate, updated, activated, deactivated, beforeDestroy, beforeUnmount, destroyed, unmounted, render, renderTracked, renderTriggered, errorCaptured, serverPrefetch,
|
4153 |
|
4154 | expose, inheritAttrs,
|
4155 |
|
4156 | components, directives, filters } = options;
|
4157 | const checkDuplicateProperties = createDuplicateChecker() ;
|
4158 | {
|
4159 | const [propsOptions] = instance.propsOptions;
|
4160 | if (propsOptions) {
|
4161 | for (const key in propsOptions) {
|
4162 | checkDuplicateProperties("Props" , key);
|
4163 | }
|
4164 | }
|
4165 | }
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 |
|
4171 |
|
4172 |
|
4173 | if (injectOptions) {
|
4174 | resolveInjections(injectOptions, ctx, checkDuplicateProperties);
|
4175 | }
|
4176 | if (methods) {
|
4177 | for (const key in methods) {
|
4178 | const methodHandler = methods[key];
|
4179 | if (isFunction(methodHandler)) {
|
4180 |
|
4181 |
|
4182 | {
|
4183 | Object.defineProperty(ctx, key, {
|
4184 | value: methodHandler.bind(publicThis),
|
4185 | configurable: true,
|
4186 | enumerable: true,
|
4187 | writable: true
|
4188 | });
|
4189 | }
|
4190 | {
|
4191 | checkDuplicateProperties("Methods" , key);
|
4192 | }
|
4193 | }
|
4194 | else {
|
4195 | warn(`Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
|
4196 | `Did you reference the function correctly?`);
|
4197 | }
|
4198 | }
|
4199 | }
|
4200 | if (dataOptions) {
|
4201 | if (!isFunction(dataOptions)) {
|
4202 | warn(`The data option must be a function. ` +
|
4203 | `Plain object usage is no longer supported.`);
|
4204 | }
|
4205 | const data = dataOptions.call(publicThis, publicThis);
|
4206 | if (isPromise(data)) {
|
4207 | warn(`data() returned a Promise - note data() cannot be async; If you ` +
|
4208 | `intend to perform data fetching before component renders, use ` +
|
4209 | `async setup() + <Suspense>.`);
|
4210 | }
|
4211 | if (!isObject(data)) {
|
4212 | warn(`data() should return an object.`);
|
4213 | }
|
4214 | else {
|
4215 | instance.data = reactive(data);
|
4216 | {
|
4217 | for (const key in data) {
|
4218 | checkDuplicateProperties("Data" , key);
|
4219 |
|
4220 | if (key[0] !== '$' && key[0] !== '_') {
|
4221 | Object.defineProperty(ctx, key, {
|
4222 | configurable: true,
|
4223 | enumerable: true,
|
4224 | get: () => data[key],
|
4225 | set: NOOP
|
4226 | });
|
4227 | }
|
4228 | }
|
4229 | }
|
4230 | }
|
4231 | }
|
4232 | // state initialization complete at this point - start caching access
|
4233 | shouldCacheAccess = true;
|
4234 | if (computedOptions) {
|
4235 | for (const key in computedOptions) {
|
4236 | const opt = computedOptions[key];
|
4237 | const get = isFunction(opt)
|
4238 | ? opt.bind(publicThis, publicThis)
|
4239 | : isFunction(opt.get)
|
4240 | ? opt.get.bind(publicThis, publicThis)
|
4241 | : NOOP;
|
4242 | if (get === NOOP) {
|
4243 | warn(`Computed property "${key}" has no getter.`);
|
4244 | }
|
4245 | const set = !isFunction(opt) && isFunction(opt.set)
|
4246 | ? opt.set.bind(publicThis)
|
4247 | : () => {
|
4248 | warn(`Write operation failed: computed property "${key}" is readonly.`);
|
4249 | }
|
4250 | ;
|
4251 | const c = computed$1({
|
4252 | get,
|
4253 | set
|
4254 | });
|
4255 | Object.defineProperty(ctx, key, {
|
4256 | enumerable: true,
|
4257 | configurable: true,
|
4258 | get: () => c.value,
|
4259 | set: v => (c.value = v)
|
4260 | });
|
4261 | {
|
4262 | checkDuplicateProperties("Computed" , key);
|
4263 | }
|
4264 | }
|
4265 | }
|
4266 | if (watchOptions) {
|
4267 | for (const key in watchOptions) {
|
4268 | createWatcher(watchOptions[key], ctx, publicThis, key);
|
4269 | }
|
4270 | }
|
4271 | if (provideOptions) {
|
4272 | const provides = isFunction(provideOptions)
|
4273 | ? provideOptions.call(publicThis)
|
4274 | : provideOptions;
|
4275 | Reflect.ownKeys(provides).forEach(key => {
|
4276 | provide(key, provides[key]);
|
4277 | });
|
4278 | }
|
4279 | if (created) {
|
4280 | callHook(created, instance, "c" );
|
4281 | }
|
4282 | function registerLifecycleHook(register, hook) {
|
4283 | if (isArray(hook)) {
|
4284 | hook.forEach(_hook => register(_hook.bind(publicThis)));
|
4285 | }
|
4286 | else if (hook) {
|
4287 | register(hook.bind(publicThis));
|
4288 | }
|
4289 | }
|
4290 | registerLifecycleHook(onBeforeMount, beforeMount);
|
4291 | registerLifecycleHook(onMounted, mounted);
|
4292 | registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
4293 | registerLifecycleHook(onUpdated, updated);
|
4294 | registerLifecycleHook(onActivated, activated);
|
4295 | registerLifecycleHook(onDeactivated, deactivated);
|
4296 | registerLifecycleHook(onErrorCaptured, errorCaptured);
|
4297 | registerLifecycleHook(onRenderTracked, renderTracked);
|
4298 | registerLifecycleHook(onRenderTriggered, renderTriggered);
|
4299 | registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
4300 | registerLifecycleHook(onUnmounted, unmounted);
|
4301 | registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
4302 | if (isArray(expose)) {
|
4303 | if (expose.length) {
|
4304 | const exposed = instance.exposed || (instance.exposed = proxyRefs({}));
|
4305 | expose.forEach(key => {
|
4306 | exposed[key] = toRef(publicThis, key);
|
4307 | });
|
4308 | }
|
4309 | else if (!instance.exposed) {
|
4310 | instance.exposed = EMPTY_OBJ;
|
4311 | }
|
4312 | }
|
4313 |
|
4314 |
|
4315 | if (render && instance.render === NOOP) {
|
4316 | instance.render = render;
|
4317 | }
|
4318 | if (inheritAttrs != null) {
|
4319 | instance.inheritAttrs = inheritAttrs;
|
4320 | }
|
4321 |
|
4322 | if (components)
|
4323 | instance.components = components;
|
4324 | if (directives)
|
4325 | instance.directives = directives;
|
4326 | }
|
4327 | function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
|
4328 | if (isArray(injectOptions)) {
|
4329 | injectOptions = normalizeInject(injectOptions);
|
4330 | }
|
4331 | for (const key in injectOptions) {
|
4332 | const opt = injectOptions[key];
|
4333 | if (isObject(opt)) {
|
4334 | if ('default' in opt) {
|
4335 | ctx[key] = inject(opt.from || key, opt.default, true );
|
4336 | }
|
4337 | else {
|
4338 | ctx[key] = inject(opt.from || key);
|
4339 | }
|
4340 | }
|
4341 | else {
|
4342 | ctx[key] = inject(opt);
|
4343 | }
|
4344 | {
|
4345 | checkDuplicateProperties("Inject" , key);
|
4346 | }
|
4347 | }
|
4348 | }
|
4349 | function callHook(hook, instance, type) {
|
4350 | callWithAsyncErrorHandling(isArray(hook)
|
4351 | ? hook.map(h => h.bind(instance.proxy))
|
4352 | : hook.bind(instance.proxy), instance, type);
|
4353 | }
|
4354 | function createWatcher(raw, ctx, publicThis, key) {
|
4355 | const getter = key.includes('.')
|
4356 | ? createPathGetter(publicThis, key)
|
4357 | : () => publicThis[key];
|
4358 | if (isString(raw)) {
|
4359 | const handler = ctx[raw];
|
4360 | if (isFunction(handler)) {
|
4361 | watch(getter, handler);
|
4362 | }
|
4363 | else {
|
4364 | warn(`Invalid watch handler specified by key "${raw}"`, handler);
|
4365 | }
|
4366 | }
|
4367 | else if (isFunction(raw)) {
|
4368 | watch(getter, raw.bind(publicThis));
|
4369 | }
|
4370 | else if (isObject(raw)) {
|
4371 | if (isArray(raw)) {
|
4372 | raw.forEach(r => createWatcher(r, ctx, publicThis, key));
|
4373 | }
|
4374 | else {
|
4375 | const handler = isFunction(raw.handler)
|
4376 | ? raw.handler.bind(publicThis)
|
4377 | : ctx[raw.handler];
|
4378 | if (isFunction(handler)) {
|
4379 | watch(getter, handler, raw);
|
4380 | }
|
4381 | else {
|
4382 | warn(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
4383 | }
|
4384 | }
|
4385 | }
|
4386 | else {
|
4387 | warn(`Invalid watch option: "${key}"`, raw);
|
4388 | }
|
4389 | }
|
4390 | |
4391 |
|
4392 |
|
4393 |
|
4394 |
|
4395 | function resolveMergedOptions(instance) {
|
4396 | const base = instance.type;
|
4397 | const { mixins, extends: extendsOptions } = base;
|
4398 | const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;
|
4399 | const cached = cache.get(base);
|
4400 | let resolved;
|
4401 | if (cached) {
|
4402 | resolved = cached;
|
4403 | }
|
4404 | else if (!globalMixins.length && !mixins && !extendsOptions) {
|
4405 | {
|
4406 | resolved = base;
|
4407 | }
|
4408 | }
|
4409 | else {
|
4410 | resolved = {};
|
4411 | if (globalMixins.length) {
|
4412 | globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
|
4413 | }
|
4414 | mergeOptions(resolved, base, optionMergeStrategies);
|
4415 | }
|
4416 | cache.set(base, resolved);
|
4417 | return resolved;
|
4418 | }
|
4419 | function mergeOptions(to, from, strats, asMixin = false) {
|
4420 | const { mixins, extends: extendsOptions } = from;
|
4421 | if (extendsOptions) {
|
4422 | mergeOptions(to, extendsOptions, strats, true);
|
4423 | }
|
4424 | if (mixins) {
|
4425 | mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
4426 | }
|
4427 | for (const key in from) {
|
4428 | if (asMixin && key === 'expose') {
|
4429 | warn(`"expose" option is ignored when declared in mixins or extends. ` +
|
4430 | `It should only be declared in the base component itself.`);
|
4431 | }
|
4432 | else {
|
4433 | const strat = internalOptionMergeStrats[key] || (strats && strats[key]);
|
4434 | to[key] = strat ? strat(to[key], from[key]) : from[key];
|
4435 | }
|
4436 | }
|
4437 | return to;
|
4438 | }
|
4439 | const internalOptionMergeStrats = {
|
4440 | data: mergeDataFn,
|
4441 | props: mergeObjectOptions,
|
4442 | emits: mergeObjectOptions,
|
4443 |
|
4444 | methods: mergeObjectOptions,
|
4445 | computed: mergeObjectOptions,
|
4446 |
|
4447 | beforeCreate: mergeHook,
|
4448 | created: mergeHook,
|
4449 | beforeMount: mergeHook,
|
4450 | mounted: mergeHook,
|
4451 | beforeUpdate: mergeHook,
|
4452 | updated: mergeHook,
|
4453 | beforeDestroy: mergeHook,
|
4454 | destroyed: mergeHook,
|
4455 | activated: mergeHook,
|
4456 | deactivated: mergeHook,
|
4457 | errorCaptured: mergeHook,
|
4458 | serverPrefetch: mergeHook,
|
4459 |
|
4460 | components: mergeObjectOptions,
|
4461 | directives: mergeObjectOptions,
|
4462 |
|
4463 |
|
4464 |
|
4465 | watch: mergeObjectOptions,
|
4466 |
|
4467 | provide: mergeDataFn,
|
4468 | inject: mergeInject
|
4469 | };
|
4470 | function mergeDataFn(to, from) {
|
4471 | if (!from) {
|
4472 | return to;
|
4473 | }
|
4474 | if (!to) {
|
4475 | return from;
|
4476 | }
|
4477 | return function mergedDataFn() {
|
4478 | return (extend)(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
|
4479 | };
|
4480 | }
|
4481 | function mergeInject(to, from) {
|
4482 | return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
4483 | }
|
4484 | function normalizeInject(raw) {
|
4485 | if (isArray(raw)) {
|
4486 | const res = {};
|
4487 | for (let i = 0; i < raw.length; i++) {
|
4488 | res[raw[i]] = raw[i];
|
4489 | }
|
4490 | return res;
|
4491 | }
|
4492 | return raw;
|
4493 | }
|
4494 | function mergeHook(to, from) {
|
4495 | return to ? [...new Set([].concat(to, from))] : from;
|
4496 | }
|
4497 | function mergeObjectOptions(to, from) {
|
4498 | return to ? extend(extend(Object.create(null), to), from) : from;
|
4499 | }
|
4500 |
|
4501 | function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
|
4502 | isSSR = false) {
|
4503 | const props = {};
|
4504 | const attrs = {};
|
4505 | def(attrs, InternalObjectKey, 1);
|
4506 | instance.propsDefaults = Object.create(null);
|
4507 | setFullProps(instance, rawProps, props, attrs);
|
4508 |
|
4509 | for (const key in instance.propsOptions[0]) {
|
4510 | if (!(key in props)) {
|
4511 | props[key] = undefined;
|
4512 | }
|
4513 | }
|
4514 |
|
4515 | {
|
4516 | validateProps(rawProps || {}, props, instance);
|
4517 | }
|
4518 | if (isStateful) {
|
4519 |
|
4520 | instance.props = isSSR ? props : shallowReactive(props);
|
4521 | }
|
4522 | else {
|
4523 | if (!instance.type.props) {
|
4524 |
|
4525 | instance.props = attrs;
|
4526 | }
|
4527 | else {
|
4528 |
|
4529 | instance.props = props;
|
4530 | }
|
4531 | }
|
4532 | instance.attrs = attrs;
|
4533 | }
|
4534 | function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
4535 | const { props, attrs, vnode: { patchFlag } } = instance;
|
4536 | const rawCurrentProps = toRaw(props);
|
4537 | const [options] = instance.propsOptions;
|
4538 | let hasAttrsChanged = false;
|
4539 | if (
|
4540 |
|
4541 |
|
4542 |
|
4543 | !((instance.type.__hmrId ||
|
4544 | (instance.parent && instance.parent.type.__hmrId))) &&
|
4545 | (optimized || patchFlag > 0) &&
|
4546 | !(patchFlag & 16 )) {
|
4547 | if (patchFlag & 8 ) {
|
4548 |
|
4549 |
|
4550 | const propsToUpdate = instance.vnode.dynamicProps;
|
4551 | for (let i = 0; i < propsToUpdate.length; i++) {
|
4552 | let key = propsToUpdate[i];
|
4553 |
|
4554 | const value = rawProps[key];
|
4555 | if (options) {
|
4556 |
|
4557 |
|
4558 | if (hasOwn(attrs, key)) {
|
4559 | if (value !== attrs[key]) {
|
4560 | attrs[key] = value;
|
4561 | hasAttrsChanged = true;
|
4562 | }
|
4563 | }
|
4564 | else {
|
4565 | const camelizedKey = camelize(key);
|
4566 | props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false );
|
4567 | }
|
4568 | }
|
4569 | else {
|
4570 | if (value !== attrs[key]) {
|
4571 | attrs[key] = value;
|
4572 | hasAttrsChanged = true;
|
4573 | }
|
4574 | }
|
4575 | }
|
4576 | }
|
4577 | }
|
4578 | else {
|
4579 |
|
4580 | if (setFullProps(instance, rawProps, props, attrs)) {
|
4581 | hasAttrsChanged = true;
|
4582 | }
|
4583 |
|
4584 |
|
4585 | let kebabKey;
|
4586 | for (const key in rawCurrentProps) {
|
4587 | if (!rawProps ||
|
4588 |
|
4589 | (!hasOwn(rawProps, key) &&
|
4590 |
|
4591 |
|
4592 | ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {
|
4593 | if (options) {
|
4594 | if (rawPrevProps &&
|
4595 |
|
4596 | (rawPrevProps[key] !== undefined ||
|
4597 |
|
4598 | rawPrevProps[kebabKey] !== undefined)) {
|
4599 | props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true );
|
4600 | }
|
4601 | }
|
4602 | else {
|
4603 | delete props[key];
|
4604 | }
|
4605 | }
|
4606 | }
|
4607 |
|
4608 |
|
4609 | if (attrs !== rawCurrentProps) {
|
4610 | for (const key in attrs) {
|
4611 | if (!rawProps || !hasOwn(rawProps, key)) {
|
4612 | delete attrs[key];
|
4613 | hasAttrsChanged = true;
|
4614 | }
|
4615 | }
|
4616 | }
|
4617 | }
|
4618 |
|
4619 | if (hasAttrsChanged) {
|
4620 | trigger(instance, "set" , '$attrs');
|
4621 | }
|
4622 | {
|
4623 | validateProps(rawProps || {}, props, instance);
|
4624 | }
|
4625 | }
|
4626 | function setFullProps(instance, rawProps, props, attrs) {
|
4627 | const [options, needCastKeys] = instance.propsOptions;
|
4628 | let hasAttrsChanged = false;
|
4629 | let rawCastValues;
|
4630 | if (rawProps) {
|
4631 | for (let key in rawProps) {
|
4632 |
|
4633 | if (isReservedProp(key)) {
|
4634 | continue;
|
4635 | }
|
4636 | const value = rawProps[key];
|
4637 |
|
4638 |
|
4639 | let camelKey;
|
4640 | if (options && hasOwn(options, (camelKey = camelize(key)))) {
|
4641 | if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
4642 | props[camelKey] = value;
|
4643 | }
|
4644 | else {
|
4645 | (rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
4646 | }
|
4647 | }
|
4648 | else if (!isEmitListener(instance.emitsOptions, key)) {
|
4649 | if (value !== attrs[key]) {
|
4650 | attrs[key] = value;
|
4651 | hasAttrsChanged = true;
|
4652 | }
|
4653 | }
|
4654 | }
|
4655 | }
|
4656 | if (needCastKeys) {
|
4657 | const rawCurrentProps = toRaw(props);
|
4658 | const castValues = rawCastValues || EMPTY_OBJ;
|
4659 | for (let i = 0; i < needCastKeys.length; i++) {
|
4660 | const key = needCastKeys[i];
|
4661 | props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key));
|
4662 | }
|
4663 | }
|
4664 | return hasAttrsChanged;
|
4665 | }
|
4666 | function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
4667 | const opt = options[key];
|
4668 | if (opt != null) {
|
4669 | const hasDefault = hasOwn(opt, 'default');
|
4670 |
|
4671 | if (hasDefault && value === undefined) {
|
4672 | const defaultValue = opt.default;
|
4673 | if (opt.type !== Function && isFunction(defaultValue)) {
|
4674 | const { propsDefaults } = instance;
|
4675 | if (key in propsDefaults) {
|
4676 | value = propsDefaults[key];
|
4677 | }
|
4678 | else {
|
4679 | setCurrentInstance(instance);
|
4680 | value = propsDefaults[key] = defaultValue.call(null, props);
|
4681 | setCurrentInstance(null);
|
4682 | }
|
4683 | }
|
4684 | else {
|
4685 | value = defaultValue;
|
4686 | }
|
4687 | }
|
4688 |
|
4689 | if (opt[0 ]) {
|
4690 | if (isAbsent && !hasDefault) {
|
4691 | value = false;
|
4692 | }
|
4693 | else if (opt[1 ] &&
|
4694 | (value === '' || value === hyphenate(key))) {
|
4695 | value = true;
|
4696 | }
|
4697 | }
|
4698 | }
|
4699 | return value;
|
4700 | }
|
4701 | function normalizePropsOptions(comp, appContext, asMixin = false) {
|
4702 | const cache = appContext.propsCache;
|
4703 | const cached = cache.get(comp);
|
4704 | if (cached) {
|
4705 | return cached;
|
4706 | }
|
4707 | const raw = comp.props;
|
4708 | const normalized = {};
|
4709 | const needCastKeys = [];
|
4710 |
|
4711 | let hasExtends = false;
|
4712 | if (!isFunction(comp)) {
|
4713 | const extendProps = (raw) => {
|
4714 | hasExtends = true;
|
4715 | const [props, keys] = normalizePropsOptions(raw, appContext, true);
|
4716 | extend(normalized, props);
|
4717 | if (keys)
|
4718 | needCastKeys.push(...keys);
|
4719 | };
|
4720 | if (!asMixin && appContext.mixins.length) {
|
4721 | appContext.mixins.forEach(extendProps);
|
4722 | }
|
4723 | if (comp.extends) {
|
4724 | extendProps(comp.extends);
|
4725 | }
|
4726 | if (comp.mixins) {
|
4727 | comp.mixins.forEach(extendProps);
|
4728 | }
|
4729 | }
|
4730 | if (!raw && !hasExtends) {
|
4731 | cache.set(comp, EMPTY_ARR);
|
4732 | return EMPTY_ARR;
|
4733 | }
|
4734 | if (isArray(raw)) {
|
4735 | for (let i = 0; i < raw.length; i++) {
|
4736 | if (!isString(raw[i])) {
|
4737 | warn(`props must be strings when using array syntax.`, raw[i]);
|
4738 | }
|
4739 | const normalizedKey = camelize(raw[i]);
|
4740 | if (validatePropName(normalizedKey)) {
|
4741 | normalized[normalizedKey] = EMPTY_OBJ;
|
4742 | }
|
4743 | }
|
4744 | }
|
4745 | else if (raw) {
|
4746 | if (!isObject(raw)) {
|
4747 | warn(`invalid props options`, raw);
|
4748 | }
|
4749 | for (const key in raw) {
|
4750 | const normalizedKey = camelize(key);
|
4751 | if (validatePropName(normalizedKey)) {
|
4752 | const opt = raw[key];
|
4753 | const prop = (normalized[normalizedKey] =
|
4754 | isArray(opt) || isFunction(opt) ? { type: opt } : opt);
|
4755 | if (prop) {
|
4756 | const booleanIndex = getTypeIndex(Boolean, prop.type);
|
4757 | const stringIndex = getTypeIndex(String, prop.type);
|
4758 | prop[0 ] = booleanIndex > -1;
|
4759 | prop[1 ] =
|
4760 | stringIndex < 0 || booleanIndex < stringIndex;
|
4761 |
|
4762 | if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
4763 | needCastKeys.push(normalizedKey);
|
4764 | }
|
4765 | }
|
4766 | }
|
4767 | }
|
4768 | }
|
4769 | const res = [normalized, needCastKeys];
|
4770 | cache.set(comp, res);
|
4771 | return res;
|
4772 | }
|
4773 | function validatePropName(key) {
|
4774 | if (key[0] !== '$') {
|
4775 | return true;
|
4776 | }
|
4777 | else {
|
4778 | warn(`Invalid prop name: "${key}" is a reserved property.`);
|
4779 | }
|
4780 | return false;
|
4781 | }
|
4782 |
|
4783 |
|
4784 | function getType(ctor) {
|
4785 | const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
4786 | return match ? match[1] : '';
|
4787 | }
|
4788 | function isSameType(a, b) {
|
4789 | return getType(a) === getType(b);
|
4790 | }
|
4791 | function getTypeIndex(type, expectedTypes) {
|
4792 | if (isArray(expectedTypes)) {
|
4793 | return expectedTypes.findIndex(t => isSameType(t, type));
|
4794 | }
|
4795 | else if (isFunction(expectedTypes)) {
|
4796 | return isSameType(expectedTypes, type) ? 0 : -1;
|
4797 | }
|
4798 | return -1;
|
4799 | }
|
4800 | |
4801 |
|
4802 |
|
4803 | function validateProps(rawProps, props, instance) {
|
4804 | const resolvedValues = toRaw(props);
|
4805 | const options = instance.propsOptions[0];
|
4806 | for (const key in options) {
|
4807 | let opt = options[key];
|
4808 | if (opt == null)
|
4809 | continue;
|
4810 | validateProp(key, resolvedValues[key], opt, !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)));
|
4811 | }
|
4812 | }
|
4813 | |
4814 |
|
4815 |
|
4816 | function validateProp(name, value, prop, isAbsent) {
|
4817 | const { type, required, validator } = prop;
|
4818 |
|
4819 | if (required && isAbsent) {
|
4820 | warn('Missing required prop: "' + name + '"');
|
4821 | return;
|
4822 | }
|
4823 |
|
4824 | if (value == null && !prop.required) {
|
4825 | return;
|
4826 | }
|
4827 |
|
4828 | if (type != null && type !== true) {
|
4829 | let isValid = false;
|
4830 | const types = isArray(type) ? type : [type];
|
4831 | const expectedTypes = [];
|
4832 |
|
4833 | for (let i = 0; i < types.length && !isValid; i++) {
|
4834 | const { valid, expectedType } = assertType(value, types[i]);
|
4835 | expectedTypes.push(expectedType || '');
|
4836 | isValid = valid;
|
4837 | }
|
4838 | if (!isValid) {
|
4839 | warn(getInvalidTypeMessage(name, value, expectedTypes));
|
4840 | return;
|
4841 | }
|
4842 | }
|
4843 |
|
4844 | if (validator && !validator(value)) {
|
4845 | warn('Invalid prop: custom validator check failed for prop "' + name + '".');
|
4846 | }
|
4847 | }
|
4848 | const isSimpleType = makeMap('String,Number,Boolean,Function,Symbol,BigInt');
|
4849 | |
4850 |
|
4851 |
|
4852 | function assertType(value, type) {
|
4853 | let valid;
|
4854 | const expectedType = getType(type);
|
4855 | if (isSimpleType(expectedType)) {
|
4856 | const t = typeof value;
|
4857 | valid = t === expectedType.toLowerCase();
|
4858 |
|
4859 | if (!valid && t === 'object') {
|
4860 | valid = value instanceof type;
|
4861 | }
|
4862 | }
|
4863 | else if (expectedType === 'Object') {
|
4864 | valid = isObject(value);
|
4865 | }
|
4866 | else if (expectedType === 'Array') {
|
4867 | valid = isArray(value);
|
4868 | }
|
4869 | else {
|
4870 | valid = value instanceof type;
|
4871 | }
|
4872 | return {
|
4873 | valid,
|
4874 | expectedType
|
4875 | };
|
4876 | }
|
4877 | |
4878 |
|
4879 |
|
4880 | function getInvalidTypeMessage(name, value, expectedTypes) {
|
4881 | let message = `Invalid prop: type check failed for prop "${name}".` +
|
4882 | ` Expected ${expectedTypes.map(capitalize).join(', ')}`;
|
4883 | const expectedType = expectedTypes[0];
|
4884 | const receivedType = toRawType(value);
|
4885 | const expectedValue = styleValue(value, expectedType);
|
4886 | const receivedValue = styleValue(value, receivedType);
|
4887 |
|
4888 | if (expectedTypes.length === 1 &&
|
4889 | isExplicable(expectedType) &&
|
4890 | !isBoolean(expectedType, receivedType)) {
|
4891 | message += ` with value ${expectedValue}`;
|
4892 | }
|
4893 | message += `, got ${receivedType} `;
|
4894 |
|
4895 | if (isExplicable(receivedType)) {
|
4896 | message += `with value ${receivedValue}.`;
|
4897 | }
|
4898 | return message;
|
4899 | }
|
4900 | |
4901 |
|
4902 |
|
4903 | function styleValue(value, type) {
|
4904 | if (type === 'String') {
|
4905 | return `"${value}"`;
|
4906 | }
|
4907 | else if (type === 'Number') {
|
4908 | return `${Number(value)}`;
|
4909 | }
|
4910 | else {
|
4911 | return `${value}`;
|
4912 | }
|
4913 | }
|
4914 | |
4915 |
|
4916 |
|
4917 | function isExplicable(type) {
|
4918 | const explicitTypes = ['string', 'number', 'boolean'];
|
4919 | return explicitTypes.some(elem => type.toLowerCase() === elem);
|
4920 | }
|
4921 | |
4922 |
|
4923 |
|
4924 | function isBoolean(...args) {
|
4925 | return args.some(elem => elem.toLowerCase() === 'boolean');
|
4926 | }
|
4927 |
|
4928 | const isInternalKey = (key) => key[0] === '_' || key === '$stable';
|
4929 | const normalizeSlotValue = (value) => isArray(value)
|
4930 | ? value.map(normalizeVNode)
|
4931 | : [normalizeVNode(value)];
|
4932 | const normalizeSlot = (key, rawSlot, ctx) => {
|
4933 | const normalized = withCtx((props) => {
|
4934 | if (currentInstance) {
|
4935 | warn(`Slot "${key}" invoked outside of the render function: ` +
|
4936 | `this will not track dependencies used in the slot. ` +
|
4937 | `Invoke the slot function inside the render function instead.`);
|
4938 | }
|
4939 | return normalizeSlotValue(rawSlot(props));
|
4940 | }, ctx);
|
4941 | normalized._c = false;
|
4942 | return normalized;
|
4943 | };
|
4944 | const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
4945 | const ctx = rawSlots._ctx;
|
4946 | for (const key in rawSlots) {
|
4947 | if (isInternalKey(key))
|
4948 | continue;
|
4949 | const value = rawSlots[key];
|
4950 | if (isFunction(value)) {
|
4951 | slots[key] = normalizeSlot(key, value, ctx);
|
4952 | }
|
4953 | else if (value != null) {
|
4954 | {
|
4955 | warn(`Non-function value encountered for slot "${key}". ` +
|
4956 | `Prefer function slots for better performance.`);
|
4957 | }
|
4958 | const normalized = normalizeSlotValue(value);
|
4959 | slots[key] = () => normalized;
|
4960 | }
|
4961 | }
|
4962 | };
|
4963 | const normalizeVNodeSlots = (instance, children) => {
|
4964 | if (!isKeepAlive(instance.vnode) &&
|
4965 | !(false )) {
|
4966 | warn(`Non-function value encountered for default slot. ` +
|
4967 | `Prefer function slots for better performance.`);
|
4968 | }
|
4969 | const normalized = normalizeSlotValue(children);
|
4970 | instance.slots.default = () => normalized;
|
4971 | };
|
4972 | const initSlots = (instance, children) => {
|
4973 | if (instance.vnode.shapeFlag & 32 ) {
|
4974 | const type = children._;
|
4975 | if (type) {
|
4976 |
|
4977 |
|
4978 | instance.slots = toRaw(children);
|
4979 |
|
4980 | def(children, '_', type);
|
4981 | }
|
4982 | else {
|
4983 | normalizeObjectSlots(children, (instance.slots = {}));
|
4984 | }
|
4985 | }
|
4986 | else {
|
4987 | instance.slots = {};
|
4988 | if (children) {
|
4989 | normalizeVNodeSlots(instance, children);
|
4990 | }
|
4991 | }
|
4992 | def(instance.slots, InternalObjectKey, 1);
|
4993 | };
|
4994 | const updateSlots = (instance, children, optimized) => {
|
4995 | const { vnode, slots } = instance;
|
4996 | let needDeletionCheck = true;
|
4997 | let deletionComparisonTarget = EMPTY_OBJ;
|
4998 | if (vnode.shapeFlag & 32 ) {
|
4999 | const type = children._;
|
5000 | if (type) {
|
5001 |
|
5002 | if (isHmrUpdating) {
|
5003 |
|
5004 |
|
5005 | extend(slots, children);
|
5006 | }
|
5007 | else if (optimized && type === 1 ) {
|
5008 |
|
5009 |
|
5010 | needDeletionCheck = false;
|
5011 | }
|
5012 | else {
|
5013 |
|
5014 |
|
5015 | extend(slots, children);
|
5016 |
|
5017 |
|
5018 |
|
5019 |
|
5020 | if (!optimized && type === 1 ) {
|
5021 | delete slots._;
|
5022 | }
|
5023 | }
|
5024 | }
|
5025 | else {
|
5026 | needDeletionCheck = !children.$stable;
|
5027 | normalizeObjectSlots(children, slots);
|
5028 | }
|
5029 | deletionComparisonTarget = children;
|
5030 | }
|
5031 | else if (children) {
|
5032 |
|
5033 | normalizeVNodeSlots(instance, children);
|
5034 | deletionComparisonTarget = { default: 1 };
|
5035 | }
|
5036 |
|
5037 | if (needDeletionCheck) {
|
5038 | for (const key in slots) {
|
5039 | if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
|
5040 | delete slots[key];
|
5041 | }
|
5042 | }
|
5043 | }
|
5044 | };
|
5045 |
|
5046 | |
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 |
|
5052 |
|
5053 |
|
5054 |
|
5055 |
|
5056 |
|
5057 |
|
5058 | const isBuiltInDirective = makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
|
5059 | function validateDirectiveName(name) {
|
5060 | if (isBuiltInDirective(name)) {
|
5061 | warn('Do not use built-in directive ids as custom directive id: ' + name);
|
5062 | }
|
5063 | }
|
5064 | |
5065 |
|
5066 |
|
5067 | function withDirectives(vnode, directives) {
|
5068 | const internalInstance = currentRenderingInstance;
|
5069 | if (internalInstance === null) {
|
5070 | warn(`withDirectives can only be used inside render functions.`);
|
5071 | return vnode;
|
5072 | }
|
5073 | const instance = internalInstance.proxy;
|
5074 | const bindings = vnode.dirs || (vnode.dirs = []);
|
5075 | for (let i = 0; i < directives.length; i++) {
|
5076 | let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
5077 | if (isFunction(dir)) {
|
5078 | dir = {
|
5079 | mounted: dir,
|
5080 | updated: dir
|
5081 | };
|
5082 | }
|
5083 | bindings.push({
|
5084 | dir,
|
5085 | instance,
|
5086 | value,
|
5087 | oldValue: void 0,
|
5088 | arg,
|
5089 | modifiers
|
5090 | });
|
5091 | }
|
5092 | return vnode;
|
5093 | }
|
5094 | function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
5095 | const bindings = vnode.dirs;
|
5096 | const oldBindings = prevVNode && prevVNode.dirs;
|
5097 | for (let i = 0; i < bindings.length; i++) {
|
5098 | const binding = bindings[i];
|
5099 | if (oldBindings) {
|
5100 | binding.oldValue = oldBindings[i].value;
|
5101 | }
|
5102 | let hook = binding.dir[name];
|
5103 | if (hook) {
|
5104 |
|
5105 |
|
5106 | pauseTracking();
|
5107 | callWithAsyncErrorHandling(hook, instance, 8 , [
|
5108 | vnode.el,
|
5109 | binding,
|
5110 | vnode,
|
5111 | prevVNode
|
5112 | ]);
|
5113 | resetTracking();
|
5114 | }
|
5115 | }
|
5116 | }
|
5117 |
|
5118 | function createAppContext() {
|
5119 | return {
|
5120 | app: null,
|
5121 | config: {
|
5122 | isNativeTag: NO,
|
5123 | performance: false,
|
5124 | globalProperties: {},
|
5125 | optionMergeStrategies: {},
|
5126 | errorHandler: undefined,
|
5127 | warnHandler: undefined,
|
5128 | compilerOptions: {}
|
5129 | },
|
5130 | mixins: [],
|
5131 | components: {},
|
5132 | directives: {},
|
5133 | provides: Object.create(null),
|
5134 | optionsCache: new WeakMap(),
|
5135 | propsCache: new WeakMap(),
|
5136 | emitsCache: new WeakMap()
|
5137 | };
|
5138 | }
|
5139 | let uid$1 = 0;
|
5140 | function createAppAPI(render, hydrate) {
|
5141 | return function createApp(rootComponent, rootProps = null) {
|
5142 | if (rootProps != null && !isObject(rootProps)) {
|
5143 | warn(`root props passed to app.mount() must be an object.`);
|
5144 | rootProps = null;
|
5145 | }
|
5146 | const context = createAppContext();
|
5147 | const installedPlugins = new Set();
|
5148 | let isMounted = false;
|
5149 | const app = (context.app = {
|
5150 | _uid: uid$1++,
|
5151 | _component: rootComponent,
|
5152 | _props: rootProps,
|
5153 | _container: null,
|
5154 | _context: context,
|
5155 | version,
|
5156 | get config() {
|
5157 | return context.config;
|
5158 | },
|
5159 | set config(v) {
|
5160 | {
|
5161 | warn(`app.config cannot be replaced. Modify individual options instead.`);
|
5162 | }
|
5163 | },
|
5164 | use(plugin, ...options) {
|
5165 | if (installedPlugins.has(plugin)) {
|
5166 | warn(`Plugin has already been applied to target app.`);
|
5167 | }
|
5168 | else if (plugin && isFunction(plugin.install)) {
|
5169 | installedPlugins.add(plugin);
|
5170 | plugin.install(app, ...options);
|
5171 | }
|
5172 | else if (isFunction(plugin)) {
|
5173 | installedPlugins.add(plugin);
|
5174 | plugin(app, ...options);
|
5175 | }
|
5176 | else {
|
5177 | warn(`A plugin must either be a function or an object with an "install" ` +
|
5178 | `function.`);
|
5179 | }
|
5180 | return app;
|
5181 | },
|
5182 | mixin(mixin) {
|
5183 | {
|
5184 | if (!context.mixins.includes(mixin)) {
|
5185 | context.mixins.push(mixin);
|
5186 | }
|
5187 | else {
|
5188 | warn('Mixin has already been applied to target app' +
|
5189 | (mixin.name ? `: ${mixin.name}` : ''));
|
5190 | }
|
5191 | }
|
5192 | return app;
|
5193 | },
|
5194 | component(name, component) {
|
5195 | {
|
5196 | validateComponentName(name, context.config);
|
5197 | }
|
5198 | if (!component) {
|
5199 | return context.components[name];
|
5200 | }
|
5201 | if (context.components[name]) {
|
5202 | warn(`Component "${name}" has already been registered in target app.`);
|
5203 | }
|
5204 | context.components[name] = component;
|
5205 | return app;
|
5206 | },
|
5207 | directive(name, directive) {
|
5208 | {
|
5209 | validateDirectiveName(name);
|
5210 | }
|
5211 | if (!directive) {
|
5212 | return context.directives[name];
|
5213 | }
|
5214 | if (context.directives[name]) {
|
5215 | warn(`Directive "${name}" has already been registered in target app.`);
|
5216 | }
|
5217 | context.directives[name] = directive;
|
5218 | return app;
|
5219 | },
|
5220 | mount(rootContainer, isHydrate, isSVG) {
|
5221 | if (!isMounted) {
|
5222 | const vnode = createVNode(rootComponent, rootProps);
|
5223 |
|
5224 |
|
5225 | vnode.appContext = context;
|
5226 |
|
5227 | {
|
5228 | context.reload = () => {
|
5229 | render(cloneVNode(vnode), rootContainer, isSVG);
|
5230 | };
|
5231 | }
|
5232 | if (isHydrate && hydrate) {
|
5233 | hydrate(vnode, rootContainer);
|
5234 | }
|
5235 | else {
|
5236 | render(vnode, rootContainer, isSVG);
|
5237 | }
|
5238 | isMounted = true;
|
5239 | app._container = rootContainer;
|
5240 | rootContainer.__vue_app__ = app;
|
5241 | {
|
5242 | devtoolsInitApp(app, version);
|
5243 | }
|
5244 | return vnode.component.proxy;
|
5245 | }
|
5246 | else {
|
5247 | warn(`App has already been mounted.\n` +
|
5248 | `If you want to remount the same app, move your app creation logic ` +
|
5249 | `into a factory function and create fresh app instances for each ` +
|
5250 | `mount - e.g. \`const createMyApp = () => createApp(App)\``);
|
5251 | }
|
5252 | },
|
5253 | unmount() {
|
5254 | if (isMounted) {
|
5255 | render(null, app._container);
|
5256 | {
|
5257 | devtoolsUnmountApp(app);
|
5258 | }
|
5259 | delete app._container.__vue_app__;
|
5260 | }
|
5261 | else {
|
5262 | warn(`Cannot unmount an app that is not mounted.`);
|
5263 | }
|
5264 | },
|
5265 | provide(key, value) {
|
5266 | if (key in context.provides) {
|
5267 | warn(`App already provides property with key "${String(key)}". ` +
|
5268 | `It will be overwritten with the new value.`);
|
5269 | }
|
5270 |
|
5271 |
|
5272 | context.provides[key] = value;
|
5273 | return app;
|
5274 | }
|
5275 | });
|
5276 | return app;
|
5277 | };
|
5278 | }
|
5279 |
|
5280 | let hasMismatch = false;
|
5281 | const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
5282 | const isComment = (node) => node.nodeType === 8 ;
|
5283 |
|
5284 |
|
5285 |
|
5286 |
|
5287 |
|
5288 | function createHydrationFunctions(rendererInternals) {
|
5289 | const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
|
5290 | const hydrate = (vnode, container) => {
|
5291 | if (!container.hasChildNodes()) {
|
5292 | warn(`Attempting to hydrate existing markup but container is empty. ` +
|
5293 | `Performing full mount instead.`);
|
5294 | patch(null, vnode, container);
|
5295 | return;
|
5296 | }
|
5297 | hasMismatch = false;
|
5298 | hydrateNode(container.firstChild, vnode, null, null, null);
|
5299 | flushPostFlushCbs();
|
5300 | if (hasMismatch && !false) {
|
5301 |
|
5302 | console.error(`Hydration completed but contains mismatches.`);
|
5303 | }
|
5304 | };
|
5305 | const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
5306 | const isFragmentStart = isComment(node) && node.data === '[';
|
5307 | const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
5308 | const { type, ref, shapeFlag } = vnode;
|
5309 | const domType = node.nodeType;
|
5310 | vnode.el = node;
|
5311 | let nextNode = null;
|
5312 | switch (type) {
|
5313 | case Text:
|
5314 | if (domType !== 3 ) {
|
5315 | nextNode = onMismatch();
|
5316 | }
|
5317 | else {
|
5318 | if (node.data !== vnode.children) {
|
5319 | hasMismatch = true;
|
5320 | warn(`Hydration text mismatch:` +
|
5321 | `\n- Client: ${JSON.stringify(node.data)}` +
|
5322 | `\n- Server: ${JSON.stringify(vnode.children)}`);
|
5323 | node.data = vnode.children;
|
5324 | }
|
5325 | nextNode = nextSibling(node);
|
5326 | }
|
5327 | break;
|
5328 | case Comment$1:
|
5329 | if (domType !== 8 || isFragmentStart) {
|
5330 | nextNode = onMismatch();
|
5331 | }
|
5332 | else {
|
5333 | nextNode = nextSibling(node);
|
5334 | }
|
5335 | break;
|
5336 | case Static:
|
5337 | if (domType !== 1 ) {
|
5338 | nextNode = onMismatch();
|
5339 | }
|
5340 | else {
|
5341 |
|
5342 | nextNode = node;
|
5343 |
|
5344 |
|
5345 | const needToAdoptContent = !vnode.children.length;
|
5346 | for (let i = 0; i < vnode.staticCount; i++) {
|
5347 | if (needToAdoptContent)
|
5348 | vnode.children += nextNode.outerHTML;
|
5349 | if (i === vnode.staticCount - 1) {
|
5350 | vnode.anchor = nextNode;
|
5351 | }
|
5352 | nextNode = nextSibling(nextNode);
|
5353 | }
|
5354 | return nextNode;
|
5355 | }
|
5356 | break;
|
5357 | case Fragment:
|
5358 | if (!isFragmentStart) {
|
5359 | nextNode = onMismatch();
|
5360 | }
|
5361 | else {
|
5362 | nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
5363 | }
|
5364 | break;
|
5365 | default:
|
5366 | if (shapeFlag & 1 ) {
|
5367 | if (domType !== 1 ||
|
5368 | vnode.type.toLowerCase() !==
|
5369 | node.tagName.toLowerCase()) {
|
5370 | nextNode = onMismatch();
|
5371 | }
|
5372 | else {
|
5373 | nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
5374 | }
|
5375 | }
|
5376 | else if (shapeFlag & 6 ) {
|
5377 |
|
5378 |
|
5379 |
|
5380 | vnode.slotScopeIds = slotScopeIds;
|
5381 | const container = parentNode(node);
|
5382 | mountComponent(vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container), optimized);
|
5383 |
|
5384 |
|
5385 |
|
5386 | nextNode = isFragmentStart
|
5387 | ? locateClosingAsyncAnchor(node)
|
5388 | : nextSibling(node);
|
5389 |
|
5390 |
|
5391 |
|
5392 |
|
5393 | if (isAsyncWrapper(vnode)) {
|
5394 | let subTree;
|
5395 | if (isFragmentStart) {
|
5396 | subTree = createVNode(Fragment);
|
5397 | subTree.anchor = nextNode
|
5398 | ? nextNode.previousSibling
|
5399 | : container.lastChild;
|
5400 | }
|
5401 | else {
|
5402 | subTree =
|
5403 | node.nodeType === 3 ? createTextVNode('') : createVNode('div');
|
5404 | }
|
5405 | subTree.el = node;
|
5406 | vnode.component.subTree = subTree;
|
5407 | }
|
5408 | }
|
5409 | else if (shapeFlag & 64 ) {
|
5410 | if (domType !== 8 ) {
|
5411 | nextNode = onMismatch();
|
5412 | }
|
5413 | else {
|
5414 | nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
5415 | }
|
5416 | }
|
5417 | else if (shapeFlag & 128 ) {
|
5418 | nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
|
5419 | }
|
5420 | else {
|
5421 | warn('Invalid HostVNode type:', type, `(${typeof type})`);
|
5422 | }
|
5423 | }
|
5424 | if (ref != null) {
|
5425 | setRef(ref, null, parentSuspense, vnode);
|
5426 | }
|
5427 | return nextNode;
|
5428 | };
|
5429 | const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
5430 | optimized = optimized || !!vnode.dynamicChildren;
|
5431 | const { props, patchFlag, shapeFlag, dirs } = vnode;
|
5432 |
|
5433 | if (patchFlag !== -1 ) {
|
5434 | if (dirs) {
|
5435 | invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
5436 | }
|
5437 |
|
5438 | if (props) {
|
5439 | if (!optimized ||
|
5440 | (patchFlag & 16 ||
|
5441 | patchFlag & 32 )) {
|
5442 | for (const key in props) {
|
5443 | if (!isReservedProp(key) && isOn(key)) {
|
5444 | patchProp(el, key, null, props[key]);
|
5445 | }
|
5446 | }
|
5447 | }
|
5448 | else if (props.onClick) {
|
5449 |
|
5450 |
|
5451 | patchProp(el, 'onClick', null, props.onClick);
|
5452 | }
|
5453 | }
|
5454 |
|
5455 | let vnodeHooks;
|
5456 | if ((vnodeHooks = props && props.onVnodeBeforeMount)) {
|
5457 | invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
5458 | }
|
5459 | if (dirs) {
|
5460 | invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');
|
5461 | }
|
5462 | if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
|
5463 | queueEffectWithSuspense(() => {
|
5464 | vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
5465 | dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted');
|
5466 | }, parentSuspense);
|
5467 | }
|
5468 |
|
5469 | if (shapeFlag & 16 &&
|
5470 |
|
5471 | !(props && (props.innerHTML || props.textContent))) {
|
5472 | let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
5473 | let hasWarned = false;
|
5474 | while (next) {
|
5475 | hasMismatch = true;
|
5476 | if (!hasWarned) {
|
5477 | warn(`Hydration children mismatch in <${vnode.type}>: ` +
|
5478 | `server rendered element contains more child nodes than client vdom.`);
|
5479 | hasWarned = true;
|
5480 | }
|
5481 |
|
5482 | const cur = next;
|
5483 | next = next.nextSibling;
|
5484 | remove(cur);
|
5485 | }
|
5486 | }
|
5487 | else if (shapeFlag & 8 ) {
|
5488 | if (el.textContent !== vnode.children) {
|
5489 | hasMismatch = true;
|
5490 | warn(`Hydration text content mismatch in <${vnode.type}>:\n` +
|
5491 | `- Client: ${el.textContent}\n` +
|
5492 | `- Server: ${vnode.children}`);
|
5493 | el.textContent = vnode.children;
|
5494 | }
|
5495 | }
|
5496 | }
|
5497 | return el.nextSibling;
|
5498 | };
|
5499 | const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
5500 | optimized = optimized || !!parentVNode.dynamicChildren;
|
5501 | const children = parentVNode.children;
|
5502 | const l = children.length;
|
5503 | let hasWarned = false;
|
5504 | for (let i = 0; i < l; i++) {
|
5505 | const vnode = optimized
|
5506 | ? children[i]
|
5507 | : (children[i] = normalizeVNode(children[i]));
|
5508 | if (node) {
|
5509 | node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
5510 | }
|
5511 | else if (vnode.type === Text && !vnode.children) {
|
5512 | continue;
|
5513 | }
|
5514 | else {
|
5515 | hasMismatch = true;
|
5516 | if (!hasWarned) {
|
5517 | warn(`Hydration children mismatch in <${container.tagName.toLowerCase()}>: ` +
|
5518 | `server rendered element contains fewer child nodes than client vdom.`);
|
5519 | hasWarned = true;
|
5520 | }
|
5521 |
|
5522 | patch(null, vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container), slotScopeIds);
|
5523 | }
|
5524 | }
|
5525 | return node;
|
5526 | };
|
5527 | const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
5528 | const { slotScopeIds: fragmentSlotScopeIds } = vnode;
|
5529 | if (fragmentSlotScopeIds) {
|
5530 | slotScopeIds = slotScopeIds
|
5531 | ? slotScopeIds.concat(fragmentSlotScopeIds)
|
5532 | : fragmentSlotScopeIds;
|
5533 | }
|
5534 | const container = parentNode(node);
|
5535 | const next = hydrateChildren(nextSibling(node), vnode, container, parentComponent, parentSuspense, slotScopeIds, optimized);
|
5536 | if (next && isComment(next) && next.data === ']') {
|
5537 | return nextSibling((vnode.anchor = next));
|
5538 | }
|
5539 | else {
|
5540 |
|
5541 |
|
5542 | hasMismatch = true;
|
5543 |
|
5544 | insert((vnode.anchor = createComment(`]`)), container, next);
|
5545 | return next;
|
5546 | }
|
5547 | };
|
5548 | const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
5549 | hasMismatch = true;
|
5550 | warn(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3
|
5551 | ? `(text)`
|
5552 | : isComment(node) && node.data === '['
|
5553 | ? `(start of fragment)`
|
5554 | : ``);
|
5555 | vnode.el = null;
|
5556 | if (isFragment) {
|
5557 |
|
5558 | const end = locateClosingAsyncAnchor(node);
|
5559 | while (true) {
|
5560 | const next = nextSibling(node);
|
5561 | if (next && next !== end) {
|
5562 | remove(next);
|
5563 | }
|
5564 | else {
|
5565 | break;
|
5566 | }
|
5567 | }
|
5568 | }
|
5569 | const next = nextSibling(node);
|
5570 | const container = parentNode(node);
|
5571 | remove(node);
|
5572 | patch(null, vnode, container, next, parentComponent, parentSuspense, isSVGContainer(container), slotScopeIds);
|
5573 | return next;
|
5574 | };
|
5575 | const locateClosingAsyncAnchor = (node) => {
|
5576 | let match = 0;
|
5577 | while (node) {
|
5578 | node = nextSibling(node);
|
5579 | if (node && isComment(node)) {
|
5580 | if (node.data === '[')
|
5581 | match++;
|
5582 | if (node.data === ']') {
|
5583 | if (match === 0) {
|
5584 | return nextSibling(node);
|
5585 | }
|
5586 | else {
|
5587 | match--;
|
5588 | }
|
5589 | }
|
5590 | }
|
5591 | }
|
5592 | return node;
|
5593 | };
|
5594 | return [hydrate, hydrateNode];
|
5595 | }
|
5596 |
|
5597 | let supported;
|
5598 | let perf;
|
5599 | function startMeasure(instance, type) {
|
5600 | if (instance.appContext.config.performance && isSupported()) {
|
5601 | perf.mark(`vue-${type}-${instance.uid}`);
|
5602 | }
|
5603 | {
|
5604 | devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
|
5605 | }
|
5606 | }
|
5607 | function endMeasure(instance, type) {
|
5608 | if (instance.appContext.config.performance && isSupported()) {
|
5609 | const startTag = `vue-${type}-${instance.uid}`;
|
5610 | const endTag = startTag + `:end`;
|
5611 | perf.mark(endTag);
|
5612 | perf.measure(`<${formatComponentName(instance, instance.type)}> ${type}`, startTag, endTag);
|
5613 | perf.clearMarks(startTag);
|
5614 | perf.clearMarks(endTag);
|
5615 | }
|
5616 | {
|
5617 | devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
|
5618 | }
|
5619 | }
|
5620 | function isSupported() {
|
5621 | if (supported !== undefined) {
|
5622 | return supported;
|
5623 | }
|
5624 |
|
5625 | if (typeof window !== 'undefined' && window.performance) {
|
5626 | supported = true;
|
5627 | perf = window.performance;
|
5628 | }
|
5629 | else {
|
5630 | supported = false;
|
5631 | }
|
5632 |
|
5633 | return supported;
|
5634 | }
|
5635 |
|
5636 | function createDevEffectOptions(instance) {
|
5637 | return {
|
5638 | scheduler: queueJob,
|
5639 | allowRecurse: true,
|
5640 | onTrack: instance.rtc ? e => invokeArrayFns(instance.rtc, e) : void 0,
|
5641 | onTrigger: instance.rtg ? e => invokeArrayFns(instance.rtg, e) : void 0
|
5642 | };
|
5643 | }
|
5644 | const queuePostRenderEffect = queueEffectWithSuspense
|
5645 | ;
|
5646 | const setRef = (rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) => {
|
5647 | if (isArray(rawRef)) {
|
5648 | rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
5649 | return;
|
5650 | }
|
5651 | if (isAsyncWrapper(vnode) && !isUnmount) {
|
5652 |
|
5653 |
|
5654 | return;
|
5655 | }
|
5656 | const refValue = vnode.shapeFlag & 4
|
5657 | ? vnode.component.exposed || vnode.component.proxy
|
5658 | : vnode.el;
|
5659 | const value = isUnmount ? null : refValue;
|
5660 | const { i: owner, r: ref } = rawRef;
|
5661 | if (!owner) {
|
5662 | warn(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
5663 | `A vnode with ref must be created inside the render function.`);
|
5664 | return;
|
5665 | }
|
5666 | const oldRef = oldRawRef && oldRawRef.r;
|
5667 | const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
5668 | const setupState = owner.setupState;
|
5669 |
|
5670 | if (oldRef != null && oldRef !== ref) {
|
5671 | if (isString(oldRef)) {
|
5672 | refs[oldRef] = null;
|
5673 | if (hasOwn(setupState, oldRef)) {
|
5674 | setupState[oldRef] = null;
|
5675 | }
|
5676 | }
|
5677 | else if (isRef(oldRef)) {
|
5678 | oldRef.value = null;
|
5679 | }
|
5680 | }
|
5681 | if (isString(ref)) {
|
5682 | const doSet = () => {
|
5683 | {
|
5684 | refs[ref] = value;
|
5685 | }
|
5686 | if (hasOwn(setupState, ref)) {
|
5687 | setupState[ref] = value;
|
5688 | }
|
5689 | };
|
5690 |
|
5691 |
|
5692 |
|
5693 | if (value) {
|
5694 | doSet.id = -1;
|
5695 | queuePostRenderEffect(doSet, parentSuspense);
|
5696 | }
|
5697 | else {
|
5698 | doSet();
|
5699 | }
|
5700 | }
|
5701 | else if (isRef(ref)) {
|
5702 | const doSet = () => {
|
5703 | ref.value = value;
|
5704 | };
|
5705 | if (value) {
|
5706 | doSet.id = -1;
|
5707 | queuePostRenderEffect(doSet, parentSuspense);
|
5708 | }
|
5709 | else {
|
5710 | doSet();
|
5711 | }
|
5712 | }
|
5713 | else if (isFunction(ref)) {
|
5714 | callWithErrorHandling(ref, owner, 12 , [value, refs]);
|
5715 | }
|
5716 | else {
|
5717 | warn('Invalid template ref type:', value, `(${typeof value})`);
|
5718 | }
|
5719 | };
|
5720 | |
5721 |
|
5722 |
|
5723 |
|
5724 |
|
5725 |
|
5726 |
|
5727 |
|
5728 |
|
5729 |
|
5730 |
|
5731 |
|
5732 |
|
5733 |
|
5734 |
|
5735 | function createRenderer(options) {
|
5736 | return baseCreateRenderer(options);
|
5737 | }
|
5738 |
|
5739 |
|
5740 |
|
5741 | function createHydrationRenderer(options) {
|
5742 | return baseCreateRenderer(options, createHydrationFunctions);
|
5743 | }
|
5744 |
|
5745 | function baseCreateRenderer(options, createHydrationFns) {
|
5746 | {
|
5747 | const target = getGlobalThis();
|
5748 | target.__VUE__ = true;
|
5749 | setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);
|
5750 | }
|
5751 | const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, forcePatchProp: hostForcePatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, cloneNode: hostCloneNode, insertStaticContent: hostInsertStaticContent } = options;
|
5752 |
|
5753 |
|
5754 | const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = false) => {
|
5755 |
|
5756 | if (n1 && !isSameVNodeType(n1, n2)) {
|
5757 | anchor = getNextHostNode(n1);
|
5758 | unmount(n1, parentComponent, parentSuspense, true);
|
5759 | n1 = null;
|
5760 | }
|
5761 | if (n2.patchFlag === -2 ) {
|
5762 | optimized = false;
|
5763 | n2.dynamicChildren = null;
|
5764 | }
|
5765 | const { type, ref, shapeFlag } = n2;
|
5766 | switch (type) {
|
5767 | case Text:
|
5768 | processText(n1, n2, container, anchor);
|
5769 | break;
|
5770 | case Comment$1:
|
5771 | processCommentNode(n1, n2, container, anchor);
|
5772 | break;
|
5773 | case Static:
|
5774 | if (n1 == null) {
|
5775 | mountStaticNode(n2, container, anchor, isSVG);
|
5776 | }
|
5777 | else {
|
5778 | patchStaticNode(n1, n2, container, isSVG);
|
5779 | }
|
5780 | break;
|
5781 | case Fragment:
|
5782 | processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
5783 | break;
|
5784 | default:
|
5785 | if (shapeFlag & 1 ) {
|
5786 | processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
5787 | }
|
5788 | else if (shapeFlag & 6 ) {
|
5789 | processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
5790 | }
|
5791 | else if (shapeFlag & 64 ) {
|
5792 | type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
5793 | }
|
5794 | else if (shapeFlag & 128 ) {
|
5795 | type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
5796 | }
|
5797 | else {
|
5798 | warn('Invalid VNode type:', type, `(${typeof type})`);
|
5799 | }
|
5800 | }
|
5801 |
|
5802 | if (ref != null && parentComponent) {
|
5803 | setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
|
5804 | }
|
5805 | };
|
5806 | const processText = (n1, n2, container, anchor) => {
|
5807 | if (n1 == null) {
|
5808 | hostInsert((n2.el = hostCreateText(n2.children)), container, anchor);
|
5809 | }
|
5810 | else {
|
5811 | const el = (n2.el = n1.el);
|
5812 | if (n2.children !== n1.children) {
|
5813 | hostSetText(el, n2.children);
|
5814 | }
|
5815 | }
|
5816 | };
|
5817 | const processCommentNode = (n1, n2, container, anchor) => {
|
5818 | if (n1 == null) {
|
5819 | hostInsert((n2.el = hostCreateComment(n2.children || '')), container, anchor);
|
5820 | }
|
5821 | else {
|
5822 |
|
5823 | n2.el = n1.el;
|
5824 | }
|
5825 | };
|
5826 | const mountStaticNode = (n2, container, anchor, isSVG) => {
|
5827 | [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);
|
5828 | };
|
5829 | |
5830 |
|
5831 |
|
5832 | const patchStaticNode = (n1, n2, container, isSVG) => {
|
5833 |
|
5834 | if (n2.children !== n1.children) {
|
5835 | const anchor = hostNextSibling(n1.anchor);
|
5836 |
|
5837 | removeStaticNode(n1);
|
5838 | [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);
|
5839 | }
|
5840 | else {
|
5841 | n2.el = n1.el;
|
5842 | n2.anchor = n1.anchor;
|
5843 | }
|
5844 | };
|
5845 | const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
|
5846 | let next;
|
5847 | while (el && el !== anchor) {
|
5848 | next = hostNextSibling(el);
|
5849 | hostInsert(el, container, nextSibling);
|
5850 | el = next;
|
5851 | }
|
5852 | hostInsert(anchor, container, nextSibling);
|
5853 | };
|
5854 | const removeStaticNode = ({ el, anchor }) => {
|
5855 | let next;
|
5856 | while (el && el !== anchor) {
|
5857 | next = hostNextSibling(el);
|
5858 | hostRemove(el);
|
5859 | el = next;
|
5860 | }
|
5861 | hostRemove(anchor);
|
5862 | };
|
5863 | const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
5864 | isSVG = isSVG || n2.type === 'svg';
|
5865 | if (n1 == null) {
|
5866 | mountElement(n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
5867 | }
|
5868 | else {
|
5869 | patchElement(n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
5870 | }
|
5871 | };
|
5872 | const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
5873 | let el;
|
5874 | let vnodeHook;
|
5875 | const { type, props, shapeFlag, transition, patchFlag, dirs } = vnode;
|
5876 | {
|
5877 | el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
5878 |
|
5879 |
|
5880 | if (shapeFlag & 8 ) {
|
5881 | hostSetElementText(el, vnode.children);
|
5882 | }
|
5883 | else if (shapeFlag & 16 ) {
|
5884 | mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized || !!vnode.dynamicChildren);
|
5885 | }
|
5886 | if (dirs) {
|
5887 | invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
5888 | }
|
5889 |
|
5890 | if (props) {
|
5891 | for (const key in props) {
|
5892 | if (!isReservedProp(key)) {
|
5893 | hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
5894 | }
|
5895 | }
|
5896 | if ((vnodeHook = props.onVnodeBeforeMount)) {
|
5897 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
5898 | }
|
5899 | }
|
5900 |
|
5901 | setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
5902 | }
|
5903 | {
|
5904 | Object.defineProperty(el, '__vnode', {
|
5905 | value: vnode,
|
5906 | enumerable: false
|
5907 | });
|
5908 | Object.defineProperty(el, '__vueParentComponent', {
|
5909 | value: parentComponent,
|
5910 | enumerable: false
|
5911 | });
|
5912 | }
|
5913 | if (dirs) {
|
5914 | invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');
|
5915 | }
|
5916 |
|
5917 |
|
5918 | const needCallTransitionHooks = (!parentSuspense || (parentSuspense && !parentSuspense.pendingBranch)) &&
|
5919 | transition &&
|
5920 | !transition.persisted;
|
5921 | if (needCallTransitionHooks) {
|
5922 | transition.beforeEnter(el);
|
5923 | }
|
5924 | hostInsert(el, container, anchor);
|
5925 | if ((vnodeHook = props && props.onVnodeMounted) ||
|
5926 | needCallTransitionHooks ||
|
5927 | dirs) {
|
5928 | queuePostRenderEffect(() => {
|
5929 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
5930 | needCallTransitionHooks && transition.enter(el);
|
5931 | dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted');
|
5932 | }, parentSuspense);
|
5933 | }
|
5934 | };
|
5935 | const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
5936 | if (scopeId) {
|
5937 | hostSetScopeId(el, scopeId);
|
5938 | }
|
5939 | if (slotScopeIds) {
|
5940 | for (let i = 0; i < slotScopeIds.length; i++) {
|
5941 | hostSetScopeId(el, slotScopeIds[i]);
|
5942 | }
|
5943 | }
|
5944 | if (parentComponent) {
|
5945 | let subTree = parentComponent.subTree;
|
5946 | if (subTree.patchFlag > 0 &&
|
5947 | subTree.patchFlag & 2048 ) {
|
5948 | subTree =
|
5949 | filterSingleRoot(subTree.children) || subTree;
|
5950 | }
|
5951 | if (vnode === subTree) {
|
5952 | const parentVNode = parentComponent.vnode;
|
5953 | setScopeId(el, parentVNode, parentVNode.scopeId, parentVNode.slotScopeIds, parentComponent.parent);
|
5954 | }
|
5955 | }
|
5956 | };
|
5957 | const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
|
5958 | for (let i = start; i < children.length; i++) {
|
5959 | const child = (children[i] = optimized
|
5960 | ? cloneIfMounted(children[i])
|
5961 | : normalizeVNode(children[i]));
|
5962 | patch(null, child, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
5963 | }
|
5964 | };
|
5965 | const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
5966 | const el = (n2.el = n1.el);
|
5967 | let { patchFlag, dynamicChildren, dirs } = n2;
|
5968 |
|
5969 |
|
5970 | patchFlag |= n1.patchFlag & 16 ;
|
5971 | const oldProps = n1.props || EMPTY_OBJ;
|
5972 | const newProps = n2.props || EMPTY_OBJ;
|
5973 | let vnodeHook;
|
5974 | if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
5975 | invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
5976 | }
|
5977 | if (dirs) {
|
5978 | invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
5979 | }
|
5980 | if (isHmrUpdating) {
|
5981 |
|
5982 | patchFlag = 0;
|
5983 | optimized = false;
|
5984 | dynamicChildren = null;
|
5985 | }
|
5986 | if (patchFlag > 0) {
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 | if (patchFlag & 16 ) {
|
5992 |
|
5993 | patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
5994 | }
|
5995 | else {
|
5996 |
|
5997 |
|
5998 | if (patchFlag & 2 ) {
|
5999 | if (oldProps.class !== newProps.class) {
|
6000 | hostPatchProp(el, 'class', null, newProps.class, isSVG);
|
6001 | }
|
6002 | }
|
6003 |
|
6004 |
|
6005 | if (patchFlag & 4 ) {
|
6006 | hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
|
6007 | }
|
6008 |
|
6009 |
|
6010 |
|
6011 |
|
6012 |
|
6013 |
|
6014 | if (patchFlag & 8 ) {
|
6015 |
|
6016 | const propsToUpdate = n2.dynamicProps;
|
6017 | for (let i = 0; i < propsToUpdate.length; i++) {
|
6018 | const key = propsToUpdate[i];
|
6019 | const prev = oldProps[key];
|
6020 | const next = newProps[key];
|
6021 | if (next !== prev ||
|
6022 | (hostForcePatchProp && hostForcePatchProp(el, key))) {
|
6023 | hostPatchProp(el, key, prev, next, isSVG, n1.children, parentComponent, parentSuspense, unmountChildren);
|
6024 | }
|
6025 | }
|
6026 | }
|
6027 | }
|
6028 |
|
6029 |
|
6030 | if (patchFlag & 1 ) {
|
6031 | if (n1.children !== n2.children) {
|
6032 | hostSetElementText(el, n2.children);
|
6033 | }
|
6034 | }
|
6035 | }
|
6036 | else if (!optimized && dynamicChildren == null) {
|
6037 |
|
6038 | patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
6039 | }
|
6040 | const areChildrenSVG = isSVG && n2.type !== 'foreignObject';
|
6041 | if (dynamicChildren) {
|
6042 | patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, areChildrenSVG, slotScopeIds);
|
6043 | if (parentComponent && parentComponent.type.__hmrId) {
|
6044 | traverseStaticChildren(n1, n2);
|
6045 | }
|
6046 | }
|
6047 | else if (!optimized) {
|
6048 |
|
6049 | patchChildren(n1, n2, el, null, parentComponent, parentSuspense, areChildrenSVG, slotScopeIds, false);
|
6050 | }
|
6051 | if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
6052 | queuePostRenderEffect(() => {
|
6053 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
6054 | dirs && invokeDirectiveHook(n2, n1, parentComponent, 'updated');
|
6055 | }, parentSuspense);
|
6056 | }
|
6057 | };
|
6058 |
|
6059 | const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
|
6060 | for (let i = 0; i < newChildren.length; i++) {
|
6061 | const oldVNode = oldChildren[i];
|
6062 | const newVNode = newChildren[i];
|
6063 |
|
6064 | const container =
|
6065 |
|
6066 |
|
6067 | oldVNode.el &&
|
6068 |
|
6069 |
|
6070 | (oldVNode.type === Fragment ||
|
6071 |
|
6072 |
|
6073 | !isSameVNodeType(oldVNode, newVNode) ||
|
6074 |
|
6075 | oldVNode.shapeFlag & 6 ||
|
6076 | oldVNode.shapeFlag & 64 )
|
6077 | ? hostParentNode(oldVNode.el)
|
6078 | :
|
6079 |
|
6080 | fallbackContainer;
|
6081 | patch(oldVNode, newVNode, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, true);
|
6082 | }
|
6083 | };
|
6084 | const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
|
6085 | if (oldProps !== newProps) {
|
6086 | for (const key in newProps) {
|
6087 |
|
6088 | if (isReservedProp(key))
|
6089 | continue;
|
6090 | const next = newProps[key];
|
6091 | const prev = oldProps[key];
|
6092 | if (next !== prev ||
|
6093 | (hostForcePatchProp && hostForcePatchProp(el, key))) {
|
6094 | hostPatchProp(el, key, prev, next, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
6095 | }
|
6096 | }
|
6097 | if (oldProps !== EMPTY_OBJ) {
|
6098 | for (const key in oldProps) {
|
6099 | if (!isReservedProp(key) && !(key in newProps)) {
|
6100 | hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
6101 | }
|
6102 | }
|
6103 | }
|
6104 | }
|
6105 | };
|
6106 | const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
6107 | const fragmentStartAnchor = (n2.el = n1 ? n1.el : hostCreateText(''));
|
6108 | const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
|
6109 | let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
6110 | if (dynamicChildren) {
|
6111 | optimized = true;
|
6112 | }
|
6113 |
|
6114 | if (fragmentSlotScopeIds) {
|
6115 | slotScopeIds = slotScopeIds
|
6116 | ? slotScopeIds.concat(fragmentSlotScopeIds)
|
6117 | : fragmentSlotScopeIds;
|
6118 | }
|
6119 | if (isHmrUpdating) {
|
6120 |
|
6121 | patchFlag = 0;
|
6122 | optimized = false;
|
6123 | dynamicChildren = null;
|
6124 | }
|
6125 | if (n1 == null) {
|
6126 | hostInsert(fragmentStartAnchor, container, anchor);
|
6127 | hostInsert(fragmentEndAnchor, container, anchor);
|
6128 |
|
6129 |
|
6130 |
|
6131 | mountChildren(n2.children, container, fragmentEndAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6132 | }
|
6133 | else {
|
6134 | if (patchFlag > 0 &&
|
6135 | patchFlag & 64 &&
|
6136 | dynamicChildren &&
|
6137 |
|
6138 |
|
6139 | n1.dynamicChildren) {
|
6140 |
|
6141 |
|
6142 | patchBlockChildren(n1.dynamicChildren, dynamicChildren, container, parentComponent, parentSuspense, isSVG, slotScopeIds);
|
6143 | if (parentComponent && parentComponent.type.__hmrId) {
|
6144 | traverseStaticChildren(n1, n2);
|
6145 | }
|
6146 | else if (
|
6147 |
|
6148 |
|
6149 |
|
6150 |
|
6151 | n2.key != null ||
|
6152 | (parentComponent && n2 === parentComponent.subTree)) {
|
6153 | traverseStaticChildren(n1, n2, true );
|
6154 | }
|
6155 | }
|
6156 | else {
|
6157 |
|
6158 |
|
6159 |
|
6160 |
|
6161 | patchChildren(n1, n2, container, fragmentEndAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6162 | }
|
6163 | }
|
6164 | };
|
6165 | const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
6166 | n2.slotScopeIds = slotScopeIds;
|
6167 | if (n1 == null) {
|
6168 | if (n2.shapeFlag & 512 ) {
|
6169 | parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
|
6170 | }
|
6171 | else {
|
6172 | mountComponent(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
|
6173 | }
|
6174 | }
|
6175 | else {
|
6176 | updateComponent(n1, n2, optimized);
|
6177 | }
|
6178 | };
|
6179 | const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
|
6180 | const instance = (initialVNode.component = createComponentInstance(initialVNode, parentComponent, parentSuspense));
|
6181 | if (instance.type.__hmrId) {
|
6182 | registerHMR(instance);
|
6183 | }
|
6184 | {
|
6185 | pushWarningContext(initialVNode);
|
6186 | startMeasure(instance, `mount`);
|
6187 | }
|
6188 |
|
6189 | if (isKeepAlive(initialVNode)) {
|
6190 | instance.ctx.renderer = internals;
|
6191 | }
|
6192 |
|
6193 | {
|
6194 | {
|
6195 | startMeasure(instance, `init`);
|
6196 | }
|
6197 | setupComponent(instance);
|
6198 | {
|
6199 | endMeasure(instance, `init`);
|
6200 | }
|
6201 | }
|
6202 |
|
6203 |
|
6204 | if (instance.asyncDep) {
|
6205 | parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
|
6206 |
|
6207 |
|
6208 | if (!initialVNode.el) {
|
6209 | const placeholder = (instance.subTree = createVNode(Comment$1));
|
6210 | processCommentNode(null, placeholder, container, anchor);
|
6211 | }
|
6212 | return;
|
6213 | }
|
6214 | setupRenderEffect(instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized);
|
6215 | {
|
6216 | popWarningContext();
|
6217 | endMeasure(instance, `mount`);
|
6218 | }
|
6219 | };
|
6220 | const updateComponent = (n1, n2, optimized) => {
|
6221 | const instance = (n2.component = n1.component);
|
6222 | if (shouldUpdateComponent(n1, n2, optimized)) {
|
6223 | if (instance.asyncDep &&
|
6224 | !instance.asyncResolved) {
|
6225 |
|
6226 |
|
6227 | {
|
6228 | pushWarningContext(n2);
|
6229 | }
|
6230 | updateComponentPreRender(instance, n2, optimized);
|
6231 | {
|
6232 | popWarningContext();
|
6233 | }
|
6234 | return;
|
6235 | }
|
6236 | else {
|
6237 |
|
6238 | instance.next = n2;
|
6239 |
|
6240 |
|
6241 | invalidateJob(instance.update);
|
6242 |
|
6243 | instance.update();
|
6244 | }
|
6245 | }
|
6246 | else {
|
6247 |
|
6248 | n2.component = n1.component;
|
6249 | n2.el = n1.el;
|
6250 | instance.vnode = n2;
|
6251 | }
|
6252 | };
|
6253 | const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
|
6254 |
|
6255 | instance.update = effect(function componentEffect() {
|
6256 | if (!instance.isMounted) {
|
6257 | let vnodeHook;
|
6258 | const { el, props } = initialVNode;
|
6259 | const { bm, m, parent } = instance;
|
6260 |
|
6261 | if (bm) {
|
6262 | invokeArrayFns(bm);
|
6263 | }
|
6264 |
|
6265 | if ((vnodeHook = props && props.onVnodeBeforeMount)) {
|
6266 | invokeVNodeHook(vnodeHook, parent, initialVNode);
|
6267 | }
|
6268 | if (el && hydrateNode) {
|
6269 |
|
6270 | const hydrateSubTree = () => {
|
6271 | {
|
6272 | startMeasure(instance, `render`);
|
6273 | }
|
6274 | instance.subTree = renderComponentRoot(instance);
|
6275 | {
|
6276 | endMeasure(instance, `render`);
|
6277 | }
|
6278 | {
|
6279 | startMeasure(instance, `hydrate`);
|
6280 | }
|
6281 | hydrateNode(el, instance.subTree, instance, parentSuspense, null);
|
6282 | {
|
6283 | endMeasure(instance, `hydrate`);
|
6284 | }
|
6285 | };
|
6286 | if (isAsyncWrapper(initialVNode)) {
|
6287 | initialVNode.type.__asyncLoader().then(
|
6288 |
|
6289 |
|
6290 |
|
6291 |
|
6292 | () => !instance.isUnmounted && hydrateSubTree());
|
6293 | }
|
6294 | else {
|
6295 | hydrateSubTree();
|
6296 | }
|
6297 | }
|
6298 | else {
|
6299 | {
|
6300 | startMeasure(instance, `render`);
|
6301 | }
|
6302 | const subTree = (instance.subTree = renderComponentRoot(instance));
|
6303 | {
|
6304 | endMeasure(instance, `render`);
|
6305 | }
|
6306 | {
|
6307 | startMeasure(instance, `patch`);
|
6308 | }
|
6309 | patch(null, subTree, container, anchor, instance, parentSuspense, isSVG);
|
6310 | {
|
6311 | endMeasure(instance, `patch`);
|
6312 | }
|
6313 | initialVNode.el = subTree.el;
|
6314 | }
|
6315 |
|
6316 | if (m) {
|
6317 | queuePostRenderEffect(m, parentSuspense);
|
6318 | }
|
6319 |
|
6320 | if ((vnodeHook = props && props.onVnodeMounted)) {
|
6321 | const scopedInitialVNode = initialVNode;
|
6322 | queuePostRenderEffect(() => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), parentSuspense);
|
6323 | }
|
6324 |
|
6325 |
|
6326 |
|
6327 | if (initialVNode.shapeFlag & 256 ) {
|
6328 | instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
6329 | }
|
6330 | instance.isMounted = true;
|
6331 | {
|
6332 | devtoolsComponentAdded(instance);
|
6333 | }
|
6334 |
|
6335 | initialVNode = container = anchor = null;
|
6336 | }
|
6337 | else {
|
6338 |
|
6339 |
|
6340 |
|
6341 | let { next, bu, u, parent, vnode } = instance;
|
6342 | let originNext = next;
|
6343 | let vnodeHook;
|
6344 | {
|
6345 | pushWarningContext(next || instance.vnode);
|
6346 | }
|
6347 | if (next) {
|
6348 | next.el = vnode.el;
|
6349 | updateComponentPreRender(instance, next, optimized);
|
6350 | }
|
6351 | else {
|
6352 | next = vnode;
|
6353 | }
|
6354 |
|
6355 | if (bu) {
|
6356 | invokeArrayFns(bu);
|
6357 | }
|
6358 |
|
6359 | if ((vnodeHook = next.props && next.props.onVnodeBeforeUpdate)) {
|
6360 | invokeVNodeHook(vnodeHook, parent, next, vnode);
|
6361 | }
|
6362 |
|
6363 | {
|
6364 | startMeasure(instance, `render`);
|
6365 | }
|
6366 | const nextTree = renderComponentRoot(instance);
|
6367 | {
|
6368 | endMeasure(instance, `render`);
|
6369 | }
|
6370 | const prevTree = instance.subTree;
|
6371 | instance.subTree = nextTree;
|
6372 | {
|
6373 | startMeasure(instance, `patch`);
|
6374 | }
|
6375 | patch(prevTree, nextTree,
|
6376 |
|
6377 | hostParentNode(prevTree.el),
|
6378 |
|
6379 | getNextHostNode(prevTree), instance, parentSuspense, isSVG);
|
6380 | {
|
6381 | endMeasure(instance, `patch`);
|
6382 | }
|
6383 | next.el = nextTree.el;
|
6384 | if (originNext === null) {
|
6385 |
|
6386 |
|
6387 |
|
6388 | updateHOCHostEl(instance, nextTree.el);
|
6389 | }
|
6390 |
|
6391 | if (u) {
|
6392 | queuePostRenderEffect(u, parentSuspense);
|
6393 | }
|
6394 |
|
6395 | if ((vnodeHook = next.props && next.props.onVnodeUpdated)) {
|
6396 | queuePostRenderEffect(() => invokeVNodeHook(vnodeHook, parent, next, vnode), parentSuspense);
|
6397 | }
|
6398 | {
|
6399 | devtoolsComponentUpdated(instance);
|
6400 | }
|
6401 | {
|
6402 | popWarningContext();
|
6403 | }
|
6404 | }
|
6405 | }, createDevEffectOptions(instance) );
|
6406 | {
|
6407 |
|
6408 | instance.update.ownerInstance = instance;
|
6409 | }
|
6410 | };
|
6411 | const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
6412 | nextVNode.component = instance;
|
6413 | const prevProps = instance.vnode.props;
|
6414 | instance.vnode = nextVNode;
|
6415 | instance.next = null;
|
6416 | updateProps(instance, nextVNode.props, prevProps, optimized);
|
6417 | updateSlots(instance, nextVNode.children, optimized);
|
6418 | pauseTracking();
|
6419 |
|
6420 |
|
6421 | flushPreFlushCbs(undefined, instance.update);
|
6422 | resetTracking();
|
6423 | };
|
6424 | const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
|
6425 | const c1 = n1 && n1.children;
|
6426 | const prevShapeFlag = n1 ? n1.shapeFlag : 0;
|
6427 | const c2 = n2.children;
|
6428 | const { patchFlag, shapeFlag } = n2;
|
6429 |
|
6430 | if (patchFlag > 0) {
|
6431 | if (patchFlag & 128 ) {
|
6432 |
|
6433 |
|
6434 | patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6435 | return;
|
6436 | }
|
6437 | else if (patchFlag & 256 ) {
|
6438 |
|
6439 | patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6440 | return;
|
6441 | }
|
6442 | }
|
6443 |
|
6444 | if (shapeFlag & 8 ) {
|
6445 |
|
6446 | if (prevShapeFlag & 16 ) {
|
6447 | unmountChildren(c1, parentComponent, parentSuspense);
|
6448 | }
|
6449 | if (c2 !== c1) {
|
6450 | hostSetElementText(container, c2);
|
6451 | }
|
6452 | }
|
6453 | else {
|
6454 | if (prevShapeFlag & 16 ) {
|
6455 |
|
6456 | if (shapeFlag & 16 ) {
|
6457 |
|
6458 | patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6459 | }
|
6460 | else {
|
6461 |
|
6462 | unmountChildren(c1, parentComponent, parentSuspense, true);
|
6463 | }
|
6464 | }
|
6465 | else {
|
6466 |
|
6467 |
|
6468 | if (prevShapeFlag & 8 ) {
|
6469 | hostSetElementText(container, '');
|
6470 | }
|
6471 |
|
6472 | if (shapeFlag & 16 ) {
|
6473 | mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6474 | }
|
6475 | }
|
6476 | }
|
6477 | };
|
6478 | const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
6479 | c1 = c1 || EMPTY_ARR;
|
6480 | c2 = c2 || EMPTY_ARR;
|
6481 | const oldLength = c1.length;
|
6482 | const newLength = c2.length;
|
6483 | const commonLength = Math.min(oldLength, newLength);
|
6484 | let i;
|
6485 | for (i = 0; i < commonLength; i++) {
|
6486 | const nextChild = (c2[i] = optimized
|
6487 | ? cloneIfMounted(c2[i])
|
6488 | : normalizeVNode(c2[i]));
|
6489 | patch(c1[i], nextChild, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6490 | }
|
6491 | if (oldLength > newLength) {
|
6492 |
|
6493 | unmountChildren(c1, parentComponent, parentSuspense, true, false, commonLength);
|
6494 | }
|
6495 | else {
|
6496 |
|
6497 | mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, commonLength);
|
6498 | }
|
6499 | };
|
6500 |
|
6501 | const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
6502 | let i = 0;
|
6503 | const l2 = c2.length;
|
6504 | let e1 = c1.length - 1;
|
6505 | let e2 = l2 - 1;
|
6506 |
|
6507 |
|
6508 |
|
6509 | while (i <= e1 && i <= e2) {
|
6510 | const n1 = c1[i];
|
6511 | const n2 = (c2[i] = optimized
|
6512 | ? cloneIfMounted(c2[i])
|
6513 | : normalizeVNode(c2[i]));
|
6514 | if (isSameVNodeType(n1, n2)) {
|
6515 | patch(n1, n2, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6516 | }
|
6517 | else {
|
6518 | break;
|
6519 | }
|
6520 | i++;
|
6521 | }
|
6522 |
|
6523 |
|
6524 |
|
6525 | while (i <= e1 && i <= e2) {
|
6526 | const n1 = c1[e1];
|
6527 | const n2 = (c2[e2] = optimized
|
6528 | ? cloneIfMounted(c2[e2])
|
6529 | : normalizeVNode(c2[e2]));
|
6530 | if (isSameVNodeType(n1, n2)) {
|
6531 | patch(n1, n2, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6532 | }
|
6533 | else {
|
6534 | break;
|
6535 | }
|
6536 | e1--;
|
6537 | e2--;
|
6538 | }
|
6539 |
|
6540 |
|
6541 |
|
6542 |
|
6543 |
|
6544 |
|
6545 |
|
6546 | if (i > e1) {
|
6547 | if (i <= e2) {
|
6548 | const nextPos = e2 + 1;
|
6549 | const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
|
6550 | while (i <= e2) {
|
6551 | patch(null, (c2[i] = optimized
|
6552 | ? cloneIfMounted(c2[i])
|
6553 | : normalizeVNode(c2[i])), container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6554 | i++;
|
6555 | }
|
6556 | }
|
6557 | }
|
6558 |
|
6559 |
|
6560 |
|
6561 |
|
6562 |
|
6563 |
|
6564 |
|
6565 | else if (i > e2) {
|
6566 | while (i <= e1) {
|
6567 | unmount(c1[i], parentComponent, parentSuspense, true);
|
6568 | i++;
|
6569 | }
|
6570 | }
|
6571 |
|
6572 |
|
6573 |
|
6574 |
|
6575 | else {
|
6576 | const s1 = i;
|
6577 | const s2 = i;
|
6578 |
|
6579 | const keyToNewIndexMap = new Map();
|
6580 | for (i = s2; i <= e2; i++) {
|
6581 | const nextChild = (c2[i] = optimized
|
6582 | ? cloneIfMounted(c2[i])
|
6583 | : normalizeVNode(c2[i]));
|
6584 | if (nextChild.key != null) {
|
6585 | if (keyToNewIndexMap.has(nextChild.key)) {
|
6586 | warn(`Duplicate keys found during update:`, JSON.stringify(nextChild.key), `Make sure keys are unique.`);
|
6587 | }
|
6588 | keyToNewIndexMap.set(nextChild.key, i);
|
6589 | }
|
6590 | }
|
6591 |
|
6592 |
|
6593 | let j;
|
6594 | let patched = 0;
|
6595 | const toBePatched = e2 - s2 + 1;
|
6596 | let moved = false;
|
6597 |
|
6598 | let maxNewIndexSoFar = 0;
|
6599 |
|
6600 |
|
6601 |
|
6602 |
|
6603 |
|
6604 | const newIndexToOldIndexMap = new Array(toBePatched);
|
6605 | for (i = 0; i < toBePatched; i++)
|
6606 | newIndexToOldIndexMap[i] = 0;
|
6607 | for (i = s1; i <= e1; i++) {
|
6608 | const prevChild = c1[i];
|
6609 | if (patched >= toBePatched) {
|
6610 |
|
6611 | unmount(prevChild, parentComponent, parentSuspense, true);
|
6612 | continue;
|
6613 | }
|
6614 | let newIndex;
|
6615 | if (prevChild.key != null) {
|
6616 | newIndex = keyToNewIndexMap.get(prevChild.key);
|
6617 | }
|
6618 | else {
|
6619 |
|
6620 | for (j = s2; j <= e2; j++) {
|
6621 | if (newIndexToOldIndexMap[j - s2] === 0 &&
|
6622 | isSameVNodeType(prevChild, c2[j])) {
|
6623 | newIndex = j;
|
6624 | break;
|
6625 | }
|
6626 | }
|
6627 | }
|
6628 | if (newIndex === undefined) {
|
6629 | unmount(prevChild, parentComponent, parentSuspense, true);
|
6630 | }
|
6631 | else {
|
6632 | newIndexToOldIndexMap[newIndex - s2] = i + 1;
|
6633 | if (newIndex >= maxNewIndexSoFar) {
|
6634 | maxNewIndexSoFar = newIndex;
|
6635 | }
|
6636 | else {
|
6637 | moved = true;
|
6638 | }
|
6639 | patch(prevChild, c2[newIndex], container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6640 | patched++;
|
6641 | }
|
6642 | }
|
6643 |
|
6644 |
|
6645 | const increasingNewIndexSequence = moved
|
6646 | ? getSequence(newIndexToOldIndexMap)
|
6647 | : EMPTY_ARR;
|
6648 | j = increasingNewIndexSequence.length - 1;
|
6649 |
|
6650 | for (i = toBePatched - 1; i >= 0; i--) {
|
6651 | const nextIndex = s2 + i;
|
6652 | const nextChild = c2[nextIndex];
|
6653 | const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
|
6654 | if (newIndexToOldIndexMap[i] === 0) {
|
6655 |
|
6656 | patch(null, nextChild, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
6657 | }
|
6658 | else if (moved) {
|
6659 |
|
6660 |
|
6661 |
|
6662 | if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
6663 | move(nextChild, container, anchor, 2 );
|
6664 | }
|
6665 | else {
|
6666 | j--;
|
6667 | }
|
6668 | }
|
6669 | }
|
6670 | }
|
6671 | };
|
6672 | const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
6673 | const { el, type, transition, children, shapeFlag } = vnode;
|
6674 | if (shapeFlag & 6 ) {
|
6675 | move(vnode.component.subTree, container, anchor, moveType);
|
6676 | return;
|
6677 | }
|
6678 | if (shapeFlag & 128 ) {
|
6679 | vnode.suspense.move(container, anchor, moveType);
|
6680 | return;
|
6681 | }
|
6682 | if (shapeFlag & 64 ) {
|
6683 | type.move(vnode, container, anchor, internals);
|
6684 | return;
|
6685 | }
|
6686 | if (type === Fragment) {
|
6687 | hostInsert(el, container, anchor);
|
6688 | for (let i = 0; i < children.length; i++) {
|
6689 | move(children[i], container, anchor, moveType);
|
6690 | }
|
6691 | hostInsert(vnode.anchor, container, anchor);
|
6692 | return;
|
6693 | }
|
6694 | if (type === Static) {
|
6695 | moveStaticNode(vnode, container, anchor);
|
6696 | return;
|
6697 | }
|
6698 |
|
6699 | const needTransition = moveType !== 2 &&
|
6700 | shapeFlag & 1 &&
|
6701 | transition;
|
6702 | if (needTransition) {
|
6703 | if (moveType === 0 ) {
|
6704 | transition.beforeEnter(el);
|
6705 | hostInsert(el, container, anchor);
|
6706 | queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
6707 | }
|
6708 | else {
|
6709 | const { leave, delayLeave, afterLeave } = transition;
|
6710 | const remove = () => hostInsert(el, container, anchor);
|
6711 | const performLeave = () => {
|
6712 | leave(el, () => {
|
6713 | remove();
|
6714 | afterLeave && afterLeave();
|
6715 | });
|
6716 | };
|
6717 | if (delayLeave) {
|
6718 | delayLeave(el, remove, performLeave);
|
6719 | }
|
6720 | else {
|
6721 | performLeave();
|
6722 | }
|
6723 | }
|
6724 | }
|
6725 | else {
|
6726 | hostInsert(el, container, anchor);
|
6727 | }
|
6728 | };
|
6729 | const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
|
6730 | const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs } = vnode;
|
6731 |
|
6732 | if (ref != null) {
|
6733 | setRef(ref, null, parentSuspense, vnode, true);
|
6734 | }
|
6735 | if (shapeFlag & 256 ) {
|
6736 | parentComponent.ctx.deactivate(vnode);
|
6737 | return;
|
6738 | }
|
6739 | const shouldInvokeDirs = shapeFlag & 1 && dirs;
|
6740 | let vnodeHook;
|
6741 | if ((vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
6742 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
6743 | }
|
6744 | if (shapeFlag & 6 ) {
|
6745 | unmountComponent(vnode.component, parentSuspense, doRemove);
|
6746 | }
|
6747 | else {
|
6748 | if (shapeFlag & 128 ) {
|
6749 | vnode.suspense.unmount(parentSuspense, doRemove);
|
6750 | return;
|
6751 | }
|
6752 | if (shouldInvokeDirs) {
|
6753 | invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
|
6754 | }
|
6755 | if (shapeFlag & 64 ) {
|
6756 | vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
|
6757 | }
|
6758 | else if (dynamicChildren &&
|
6759 |
|
6760 | (type !== Fragment ||
|
6761 | (patchFlag > 0 && patchFlag & 64 ))) {
|
6762 |
|
6763 | unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
6764 | }
|
6765 | else if ((type === Fragment &&
|
6766 | (patchFlag & 128 ||
|
6767 | patchFlag & 256 )) ||
|
6768 | (!optimized && shapeFlag & 16 )) {
|
6769 | unmountChildren(children, parentComponent, parentSuspense);
|
6770 | }
|
6771 | if (doRemove) {
|
6772 | remove(vnode);
|
6773 | }
|
6774 | }
|
6775 | if ((vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
|
6776 | queuePostRenderEffect(() => {
|
6777 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
6778 | shouldInvokeDirs &&
|
6779 | invokeDirectiveHook(vnode, null, parentComponent, 'unmounted');
|
6780 | }, parentSuspense);
|
6781 | }
|
6782 | };
|
6783 | const remove = vnode => {
|
6784 | const { type, el, anchor, transition } = vnode;
|
6785 | if (type === Fragment) {
|
6786 | removeFragment(el, anchor);
|
6787 | return;
|
6788 | }
|
6789 | if (type === Static) {
|
6790 | removeStaticNode(vnode);
|
6791 | return;
|
6792 | }
|
6793 | const performRemove = () => {
|
6794 | hostRemove(el);
|
6795 | if (transition && !transition.persisted && transition.afterLeave) {
|
6796 | transition.afterLeave();
|
6797 | }
|
6798 | };
|
6799 | if (vnode.shapeFlag & 1 &&
|
6800 | transition &&
|
6801 | !transition.persisted) {
|
6802 | const { leave, delayLeave } = transition;
|
6803 | const performLeave = () => leave(el, performRemove);
|
6804 | if (delayLeave) {
|
6805 | delayLeave(vnode.el, performRemove, performLeave);
|
6806 | }
|
6807 | else {
|
6808 | performLeave();
|
6809 | }
|
6810 | }
|
6811 | else {
|
6812 | performRemove();
|
6813 | }
|
6814 | };
|
6815 | const removeFragment = (cur, end) => {
|
6816 |
|
6817 |
|
6818 | let next;
|
6819 | while (cur !== end) {
|
6820 | next = hostNextSibling(cur);
|
6821 | hostRemove(cur);
|
6822 | cur = next;
|
6823 | }
|
6824 | hostRemove(end);
|
6825 | };
|
6826 | const unmountComponent = (instance, parentSuspense, doRemove) => {
|
6827 | if (instance.type.__hmrId) {
|
6828 | unregisterHMR(instance);
|
6829 | }
|
6830 | const { bum, effects, update, subTree, um } = instance;
|
6831 |
|
6832 | if (bum) {
|
6833 | invokeArrayFns(bum);
|
6834 | }
|
6835 | if (effects) {
|
6836 | for (let i = 0; i < effects.length; i++) {
|
6837 | stop(effects[i]);
|
6838 | }
|
6839 | }
|
6840 |
|
6841 |
|
6842 | if (update) {
|
6843 | stop(update);
|
6844 | unmount(subTree, instance, parentSuspense, doRemove);
|
6845 | }
|
6846 |
|
6847 | if (um) {
|
6848 | queuePostRenderEffect(um, parentSuspense);
|
6849 | }
|
6850 | queuePostRenderEffect(() => {
|
6851 | instance.isUnmounted = true;
|
6852 | }, parentSuspense);
|
6853 |
|
6854 |
|
6855 |
|
6856 | if (parentSuspense &&
|
6857 | parentSuspense.pendingBranch &&
|
6858 | !parentSuspense.isUnmounted &&
|
6859 | instance.asyncDep &&
|
6860 | !instance.asyncResolved &&
|
6861 | instance.suspenseId === parentSuspense.pendingId) {
|
6862 | parentSuspense.deps--;
|
6863 | if (parentSuspense.deps === 0) {
|
6864 | parentSuspense.resolve();
|
6865 | }
|
6866 | }
|
6867 | {
|
6868 | devtoolsComponentRemoved(instance);
|
6869 | }
|
6870 | };
|
6871 | const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
|
6872 | for (let i = start; i < children.length; i++) {
|
6873 | unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
|
6874 | }
|
6875 | };
|
6876 | const getNextHostNode = vnode => {
|
6877 | if (vnode.shapeFlag & 6 ) {
|
6878 | return getNextHostNode(vnode.component.subTree);
|
6879 | }
|
6880 | if (vnode.shapeFlag & 128 ) {
|
6881 | return vnode.suspense.next();
|
6882 | }
|
6883 | return hostNextSibling((vnode.anchor || vnode.el));
|
6884 | };
|
6885 | const render = (vnode, container, isSVG) => {
|
6886 | if (vnode == null) {
|
6887 | if (container._vnode) {
|
6888 | unmount(container._vnode, null, null, true);
|
6889 | }
|
6890 | }
|
6891 | else {
|
6892 | patch(container._vnode || null, vnode, container, null, null, null, isSVG);
|
6893 | }
|
6894 | flushPostFlushCbs();
|
6895 | container._vnode = vnode;
|
6896 | };
|
6897 | const internals = {
|
6898 | p: patch,
|
6899 | um: unmount,
|
6900 | m: move,
|
6901 | r: remove,
|
6902 | mt: mountComponent,
|
6903 | mc: mountChildren,
|
6904 | pc: patchChildren,
|
6905 | pbc: patchBlockChildren,
|
6906 | n: getNextHostNode,
|
6907 | o: options
|
6908 | };
|
6909 | let hydrate;
|
6910 | let hydrateNode;
|
6911 | if (createHydrationFns) {
|
6912 | [hydrate, hydrateNode] = createHydrationFns(internals);
|
6913 | }
|
6914 | return {
|
6915 | render,
|
6916 | hydrate,
|
6917 | createApp: createAppAPI(render, hydrate)
|
6918 | };
|
6919 | }
|
6920 | function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
6921 | callWithAsyncErrorHandling(hook, instance, 7 , [
|
6922 | vnode,
|
6923 | prevVNode
|
6924 | ]);
|
6925 | }
|
6926 | |
6927 |
|
6928 |
|
6929 |
|
6930 |
|
6931 |
|
6932 |
|
6933 |
|
6934 |
|
6935 |
|
6936 |
|
6937 | function traverseStaticChildren(n1, n2, shallow = false) {
|
6938 | const ch1 = n1.children;
|
6939 | const ch2 = n2.children;
|
6940 | if (isArray(ch1) && isArray(ch2)) {
|
6941 | for (let i = 0; i < ch1.length; i++) {
|
6942 |
|
6943 |
|
6944 | const c1 = ch1[i];
|
6945 | let c2 = ch2[i];
|
6946 | if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
|
6947 | if (c2.patchFlag <= 0 || c2.patchFlag === 32 ) {
|
6948 | c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
6949 | c2.el = c1.el;
|
6950 | }
|
6951 | if (!shallow)
|
6952 | traverseStaticChildren(c1, c2);
|
6953 | }
|
6954 |
|
6955 |
|
6956 | if (c2.type === Comment$1 && !c2.el) {
|
6957 | c2.el = c1.el;
|
6958 | }
|
6959 | }
|
6960 | }
|
6961 | }
|
6962 |
|
6963 | function getSequence(arr) {
|
6964 | const p = arr.slice();
|
6965 | const result = [0];
|
6966 | let i, j, u, v, c;
|
6967 | const len = arr.length;
|
6968 | for (i = 0; i < len; i++) {
|
6969 | const arrI = arr[i];
|
6970 | if (arrI !== 0) {
|
6971 | j = result[result.length - 1];
|
6972 | if (arr[j] < arrI) {
|
6973 | p[i] = j;
|
6974 | result.push(i);
|
6975 | continue;
|
6976 | }
|
6977 | u = 0;
|
6978 | v = result.length - 1;
|
6979 | while (u < v) {
|
6980 | c = ((u + v) / 2) | 0;
|
6981 | if (arr[result[c]] < arrI) {
|
6982 | u = c + 1;
|
6983 | }
|
6984 | else {
|
6985 | v = c;
|
6986 | }
|
6987 | }
|
6988 | if (arrI < arr[result[u]]) {
|
6989 | if (u > 0) {
|
6990 | p[i] = result[u - 1];
|
6991 | }
|
6992 | result[u] = i;
|
6993 | }
|
6994 | }
|
6995 | }
|
6996 | u = result.length;
|
6997 | v = result[u - 1];
|
6998 | while (u-- > 0) {
|
6999 | result[u] = v;
|
7000 | v = p[v];
|
7001 | }
|
7002 | return result;
|
7003 | }
|
7004 |
|
7005 | const isTeleport = (type) => type.__isTeleport;
|
7006 | const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === '');
|
7007 | const isTargetSVG = (target) => typeof SVGElement !== 'undefined' && target instanceof SVGElement;
|
7008 | const resolveTarget = (props, select) => {
|
7009 | const targetSelector = props && props.to;
|
7010 | if (isString(targetSelector)) {
|
7011 | if (!select) {
|
7012 | warn(`Current renderer does not support string target for Teleports. ` +
|
7013 | `(missing querySelector renderer option)`);
|
7014 | return null;
|
7015 | }
|
7016 | else {
|
7017 | const target = select(targetSelector);
|
7018 | if (!target) {
|
7019 | warn(`Failed to locate Teleport target with selector "${targetSelector}". ` +
|
7020 | `Note the target element must exist before the component is mounted - ` +
|
7021 | `i.e. the target cannot be rendered by the component itself, and ` +
|
7022 | `ideally should be outside of the entire Vue component tree.`);
|
7023 | }
|
7024 | return target;
|
7025 | }
|
7026 | }
|
7027 | else {
|
7028 | if (!targetSelector && !isTeleportDisabled(props)) {
|
7029 | warn(`Invalid Teleport target: ${targetSelector}`);
|
7030 | }
|
7031 | return targetSelector;
|
7032 | }
|
7033 | };
|
7034 | const TeleportImpl = {
|
7035 | __isTeleport: true,
|
7036 | process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
|
7037 | const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
|
7038 | const disabled = isTeleportDisabled(n2.props);
|
7039 | let { shapeFlag, children, dynamicChildren } = n2;
|
7040 |
|
7041 |
|
7042 | if (isHmrUpdating) {
|
7043 | optimized = false;
|
7044 | dynamicChildren = null;
|
7045 | }
|
7046 | if (n1 == null) {
|
7047 |
|
7048 | const placeholder = (n2.el = createComment('teleport start')
|
7049 | );
|
7050 | const mainAnchor = (n2.anchor = createComment('teleport end')
|
7051 | );
|
7052 | insert(placeholder, container, anchor);
|
7053 | insert(mainAnchor, container, anchor);
|
7054 | const target = (n2.target = resolveTarget(n2.props, querySelector));
|
7055 | const targetAnchor = (n2.targetAnchor = createText(''));
|
7056 | if (target) {
|
7057 | insert(targetAnchor, target);
|
7058 |
|
7059 | isSVG = isSVG || isTargetSVG(target);
|
7060 | }
|
7061 | else if (!disabled) {
|
7062 | warn('Invalid Teleport target on mount:', target, `(${typeof target})`);
|
7063 | }
|
7064 | const mount = (container, anchor) => {
|
7065 |
|
7066 |
|
7067 | if (shapeFlag & 16 ) {
|
7068 | mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
7069 | }
|
7070 | };
|
7071 | if (disabled) {
|
7072 | mount(container, mainAnchor);
|
7073 | }
|
7074 | else if (target) {
|
7075 | mount(target, targetAnchor);
|
7076 | }
|
7077 | }
|
7078 | else {
|
7079 |
|
7080 | n2.el = n1.el;
|
7081 | const mainAnchor = (n2.anchor = n1.anchor);
|
7082 | const target = (n2.target = n1.target);
|
7083 | const targetAnchor = (n2.targetAnchor = n1.targetAnchor);
|
7084 | const wasDisabled = isTeleportDisabled(n1.props);
|
7085 | const currentContainer = wasDisabled ? container : target;
|
7086 | const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
7087 | isSVG = isSVG || isTargetSVG(target);
|
7088 | if (dynamicChildren) {
|
7089 |
|
7090 | patchBlockChildren(n1.dynamicChildren, dynamicChildren, currentContainer, parentComponent, parentSuspense, isSVG, slotScopeIds);
|
7091 |
|
7092 |
|
7093 |
|
7094 | traverseStaticChildren(n1, n2, true);
|
7095 | }
|
7096 | else if (!optimized) {
|
7097 | patchChildren(n1, n2, currentContainer, currentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, false);
|
7098 | }
|
7099 | if (disabled) {
|
7100 | if (!wasDisabled) {
|
7101 |
|
7102 |
|
7103 | moveTeleport(n2, container, mainAnchor, internals, 1 );
|
7104 | }
|
7105 | }
|
7106 | else {
|
7107 |
|
7108 | if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
7109 | const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
|
7110 | if (nextTarget) {
|
7111 | moveTeleport(n2, nextTarget, null, internals, 0 );
|
7112 | }
|
7113 | else {
|
7114 | warn('Invalid Teleport target on update:', target, `(${typeof target})`);
|
7115 | }
|
7116 | }
|
7117 | else if (wasDisabled) {
|
7118 |
|
7119 |
|
7120 | moveTeleport(n2, target, targetAnchor, internals, 1 );
|
7121 | }
|
7122 | }
|
7123 | }
|
7124 | },
|
7125 | remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
7126 | const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
|
7127 | if (target) {
|
7128 | hostRemove(targetAnchor);
|
7129 | }
|
7130 |
|
7131 | if (doRemove || !isTeleportDisabled(props)) {
|
7132 | hostRemove(anchor);
|
7133 | if (shapeFlag & 16 ) {
|
7134 | for (let i = 0; i < children.length; i++) {
|
7135 | const child = children[i];
|
7136 | unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
|
7137 | }
|
7138 | }
|
7139 | }
|
7140 | },
|
7141 | move: moveTeleport,
|
7142 | hydrate: hydrateTeleport
|
7143 | };
|
7144 | function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* REORDER */) {
|
7145 |
|
7146 | if (moveType === 0 ) {
|
7147 | insert(vnode.targetAnchor, container, parentAnchor);
|
7148 | }
|
7149 | const { el, anchor, shapeFlag, children, props } = vnode;
|
7150 | const isReorder = moveType === 2 ;
|
7151 |
|
7152 | if (isReorder) {
|
7153 | insert(el, container, parentAnchor);
|
7154 | }
|
7155 |
|
7156 |
|
7157 |
|
7158 | if (!isReorder || isTeleportDisabled(props)) {
|
7159 |
|
7160 | if (shapeFlag & 16 ) {
|
7161 | for (let i = 0; i < children.length; i++) {
|
7162 | move(children[i], container, parentAnchor, 2 );
|
7163 | }
|
7164 | }
|
7165 | }
|
7166 |
|
7167 | if (isReorder) {
|
7168 | insert(anchor, container, parentAnchor);
|
7169 | }
|
7170 | }
|
7171 | function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, { o: { nextSibling, parentNode, querySelector } }, hydrateChildren) {
|
7172 | const target = (vnode.target = resolveTarget(vnode.props, querySelector));
|
7173 | if (target) {
|
7174 |
|
7175 |
|
7176 | const targetNode = target._lpa || target.firstChild;
|
7177 | if (vnode.shapeFlag & 16 ) {
|
7178 | if (isTeleportDisabled(vnode.props)) {
|
7179 | vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
7180 | vnode.targetAnchor = targetNode;
|
7181 | }
|
7182 | else {
|
7183 | vnode.anchor = nextSibling(node);
|
7184 | vnode.targetAnchor = hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
7185 | }
|
7186 | target._lpa =
|
7187 | vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
7188 | }
|
7189 | }
|
7190 | return vnode.anchor && nextSibling(vnode.anchor);
|
7191 | }
|
7192 |
|
7193 | const Teleport = TeleportImpl;
|
7194 |
|
7195 | const COMPONENTS = 'components';
|
7196 | const DIRECTIVES = 'directives';
|
7197 | |
7198 |
|
7199 |
|
7200 | function resolveComponent(name, maybeSelfReference) {
|
7201 | return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
7202 | }
|
7203 | const NULL_DYNAMIC_COMPONENT = Symbol();
|
7204 | |
7205 |
|
7206 |
|
7207 | function resolveDynamicComponent(component) {
|
7208 | if (isString(component)) {
|
7209 | return resolveAsset(COMPONENTS, component, false) || component;
|
7210 | }
|
7211 | else {
|
7212 |
|
7213 | return (component || NULL_DYNAMIC_COMPONENT);
|
7214 | }
|
7215 | }
|
7216 | |
7217 |
|
7218 |
|
7219 | function resolveDirective(name) {
|
7220 | return resolveAsset(DIRECTIVES, name);
|
7221 | }
|
7222 |
|
7223 | function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
7224 | const instance = currentRenderingInstance || currentInstance;
|
7225 | if (instance) {
|
7226 | const Component = instance.type;
|
7227 |
|
7228 | if (type === COMPONENTS) {
|
7229 | const selfName = getComponentName(Component);
|
7230 | if (selfName &&
|
7231 | (selfName === name ||
|
7232 | selfName === camelize(name) ||
|
7233 | selfName === capitalize(camelize(name)))) {
|
7234 | return Component;
|
7235 | }
|
7236 | }
|
7237 | const res =
|
7238 |
|
7239 |
|
7240 | resolve(instance[type] || Component[type], name) ||
|
7241 |
|
7242 | resolve(instance.appContext[type], name);
|
7243 | if (!res && maybeSelfReference) {
|
7244 |
|
7245 | return Component;
|
7246 | }
|
7247 | if (warnMissing && !res) {
|
7248 | warn(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
|
7249 | }
|
7250 | return res;
|
7251 | }
|
7252 | else {
|
7253 | warn(`resolve${capitalize(type.slice(0, -1))} ` +
|
7254 | `can only be used in render() or setup().`);
|
7255 | }
|
7256 | }
|
7257 | function resolve(registry, name) {
|
7258 | return (registry &&
|
7259 | (registry[name] ||
|
7260 | registry[camelize(name)] ||
|
7261 | registry[capitalize(camelize(name))]));
|
7262 | }
|
7263 |
|
7264 | const Fragment = Symbol('Fragment' );
|
7265 | const Text = Symbol('Text' );
|
7266 | const Comment$1 = Symbol('Comment' );
|
7267 | const Static = Symbol('Static' );
|
7268 |
|
7269 |
|
7270 |
|
7271 |
|
7272 |
|
7273 | const blockStack = [];
|
7274 | let currentBlock = null;
|
7275 | |
7276 |
|
7277 |
|
7278 |
|
7279 |
|
7280 |
|
7281 |
|
7282 |
|
7283 |
|
7284 |
|
7285 |
|
7286 |
|
7287 |
|
7288 |
|
7289 |
|
7290 |
|
7291 | function openBlock(disableTracking = false) {
|
7292 | blockStack.push((currentBlock = disableTracking ? null : []));
|
7293 | }
|
7294 | function closeBlock() {
|
7295 | blockStack.pop();
|
7296 | currentBlock = blockStack[blockStack.length - 1] || null;
|
7297 | }
|
7298 |
|
7299 |
|
7300 |
|
7301 |
|
7302 | let isBlockTreeEnabled = 1;
|
7303 | |
7304 |
|
7305 |
|
7306 |
|
7307 |
|
7308 |
|
7309 |
|
7310 |
|
7311 |
|
7312 |
|
7313 |
|
7314 |
|
7315 |
|
7316 |
|
7317 |
|
7318 |
|
7319 | function setBlockTracking(value) {
|
7320 | isBlockTreeEnabled += value;
|
7321 | }
|
7322 | |
7323 |
|
7324 |
|
7325 |
|
7326 |
|
7327 |
|
7328 |
|
7329 | function createBlock(type, props, children, patchFlag, dynamicProps) {
|
7330 | const vnode = createVNode(type, props, children, patchFlag, dynamicProps, true );
|
7331 |
|
7332 | vnode.dynamicChildren =
|
7333 | isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
|
7334 |
|
7335 | closeBlock();
|
7336 |
|
7337 |
|
7338 | if (isBlockTreeEnabled > 0 && currentBlock) {
|
7339 | currentBlock.push(vnode);
|
7340 | }
|
7341 | return vnode;
|
7342 | }
|
7343 | function isVNode(value) {
|
7344 | return value ? value.__v_isVNode === true : false;
|
7345 | }
|
7346 | function isSameVNodeType(n1, n2) {
|
7347 | if (n2.shapeFlag & 6 &&
|
7348 | hmrDirtyComponents.has(n2.type)) {
|
7349 |
|
7350 | return false;
|
7351 | }
|
7352 | return n1.type === n2.type && n1.key === n2.key;
|
7353 | }
|
7354 | let vnodeArgsTransformer;
|
7355 | |
7356 |
|
7357 |
|
7358 |
|
7359 |
|
7360 |
|
7361 | function transformVNodeArgs(transformer) {
|
7362 | vnodeArgsTransformer = transformer;
|
7363 | }
|
7364 | const createVNodeWithArgsTransform = (...args) => {
|
7365 | return _createVNode(...(vnodeArgsTransformer
|
7366 | ? vnodeArgsTransformer(args, currentRenderingInstance)
|
7367 | : args));
|
7368 | };
|
7369 | const InternalObjectKey = `__vInternal`;
|
7370 | const normalizeKey = ({ key }) => key != null ? key : null;
|
7371 | const normalizeRef = ({ ref }) => {
|
7372 | return (ref != null
|
7373 | ? isString(ref) || isRef(ref) || isFunction(ref)
|
7374 | ? { i: currentRenderingInstance, r: ref }
|
7375 | : ref
|
7376 | : null);
|
7377 | };
|
7378 | const createVNode = (createVNodeWithArgsTransform
|
7379 | );
|
7380 | function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
7381 | if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
7382 | if (!type) {
|
7383 | warn(`Invalid vnode type when creating vnode: ${type}.`);
|
7384 | }
|
7385 | type = Comment$1;
|
7386 | }
|
7387 | if (isVNode(type)) {
|
7388 |
|
7389 |
|
7390 |
|
7391 | const cloned = cloneVNode(type, props, true );
|
7392 | if (children) {
|
7393 | normalizeChildren(cloned, children);
|
7394 | }
|
7395 | return cloned;
|
7396 | }
|
7397 |
|
7398 | if (isClassComponent(type)) {
|
7399 | type = type.__vccOpts;
|
7400 | }
|
7401 |
|
7402 | if (props) {
|
7403 |
|
7404 | if (isProxy(props) || InternalObjectKey in props) {
|
7405 | props = extend({}, props);
|
7406 | }
|
7407 | let { class: klass, style } = props;
|
7408 | if (klass && !isString(klass)) {
|
7409 | props.class = normalizeClass(klass);
|
7410 | }
|
7411 | if (isObject(style)) {
|
7412 |
|
7413 |
|
7414 | if (isProxy(style) && !isArray(style)) {
|
7415 | style = extend({}, style);
|
7416 | }
|
7417 | props.style = normalizeStyle(style);
|
7418 | }
|
7419 | }
|
7420 |
|
7421 | const shapeFlag = isString(type)
|
7422 | ? 1
|
7423 | : isSuspense(type)
|
7424 | ? 128
|
7425 | : isTeleport(type)
|
7426 | ? 64
|
7427 | : isObject(type)
|
7428 | ? 4
|
7429 | : isFunction(type)
|
7430 | ? 2
|
7431 | : 0;
|
7432 | if (shapeFlag & 4 && isProxy(type)) {
|
7433 | type = toRaw(type);
|
7434 | warn(`Vue received a Component which was made a reactive object. This can ` +
|
7435 | `lead to unnecessary performance overhead, and should be avoided by ` +
|
7436 | `marking the component with \`markRaw\` or using \`shallowRef\` ` +
|
7437 | `instead of \`ref\`.`, `\nComponent that was made reactive: `, type);
|
7438 | }
|
7439 | const vnode = {
|
7440 | __v_isVNode: true,
|
7441 | __v_skip: true,
|
7442 | type,
|
7443 | props,
|
7444 | key: props && normalizeKey(props),
|
7445 | ref: props && normalizeRef(props),
|
7446 | scopeId: currentScopeId,
|
7447 | slotScopeIds: null,
|
7448 | children: null,
|
7449 | component: null,
|
7450 | suspense: null,
|
7451 | ssContent: null,
|
7452 | ssFallback: null,
|
7453 | dirs: null,
|
7454 | transition: null,
|
7455 | el: null,
|
7456 | anchor: null,
|
7457 | target: null,
|
7458 | targetAnchor: null,
|
7459 | staticCount: 0,
|
7460 | shapeFlag,
|
7461 | patchFlag,
|
7462 | dynamicProps,
|
7463 | dynamicChildren: null,
|
7464 | appContext: null
|
7465 | };
|
7466 |
|
7467 | if (vnode.key !== vnode.key) {
|
7468 | warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
7469 | }
|
7470 | normalizeChildren(vnode, children);
|
7471 |
|
7472 | if (shapeFlag & 128 ) {
|
7473 | type.normalize(vnode);
|
7474 | }
|
7475 | if (isBlockTreeEnabled > 0 &&
|
7476 |
|
7477 | !isBlockNode &&
|
7478 |
|
7479 | currentBlock &&
|
7480 |
|
7481 |
|
7482 |
|
7483 |
|
7484 | (patchFlag > 0 || shapeFlag & 6 ) &&
|
7485 |
|
7486 |
|
7487 | patchFlag !== 32 ) {
|
7488 | currentBlock.push(vnode);
|
7489 | }
|
7490 | return vnode;
|
7491 | }
|
7492 | function cloneVNode(vnode, extraProps, mergeRef = false) {
|
7493 |
|
7494 |
|
7495 | const { props, ref, patchFlag, children } = vnode;
|
7496 | const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
7497 | const cloned = {
|
7498 | __v_isVNode: true,
|
7499 | __v_skip: true,
|
7500 | type: vnode.type,
|
7501 | props: mergedProps,
|
7502 | key: mergedProps && normalizeKey(mergedProps),
|
7503 | ref: extraProps && extraProps.ref
|
7504 | ?
|
7505 |
|
7506 |
|
7507 | mergeRef && ref
|
7508 | ? isArray(ref)
|
7509 | ? ref.concat(normalizeRef(extraProps))
|
7510 | : [ref, normalizeRef(extraProps)]
|
7511 | : normalizeRef(extraProps)
|
7512 | : ref,
|
7513 | scopeId: vnode.scopeId,
|
7514 | slotScopeIds: vnode.slotScopeIds,
|
7515 | children: patchFlag === -1 && isArray(children)
|
7516 | ? children.map(deepCloneVNode)
|
7517 | : children,
|
7518 | target: vnode.target,
|
7519 | targetAnchor: vnode.targetAnchor,
|
7520 | staticCount: vnode.staticCount,
|
7521 | shapeFlag: vnode.shapeFlag,
|
7522 |
|
7523 |
|
7524 |
|
7525 |
|
7526 | patchFlag: extraProps && vnode.type !== Fragment
|
7527 | ? patchFlag === -1
|
7528 | ? 16
|
7529 | : patchFlag | 16
|
7530 | : patchFlag,
|
7531 | dynamicProps: vnode.dynamicProps,
|
7532 | dynamicChildren: vnode.dynamicChildren,
|
7533 | appContext: vnode.appContext,
|
7534 | dirs: vnode.dirs,
|
7535 | transition: vnode.transition,
|
7536 |
|
7537 |
|
7538 |
|
7539 |
|
7540 | component: vnode.component,
|
7541 | suspense: vnode.suspense,
|
7542 | ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
7543 | ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
7544 | el: vnode.el,
|
7545 | anchor: vnode.anchor
|
7546 | };
|
7547 | return cloned;
|
7548 | }
|
7549 | |
7550 |
|
7551 |
|
7552 |
|
7553 | function deepCloneVNode(vnode) {
|
7554 | const cloned = cloneVNode(vnode);
|
7555 | if (isArray(vnode.children)) {
|
7556 | cloned.children = vnode.children.map(deepCloneVNode);
|
7557 | }
|
7558 | return cloned;
|
7559 | }
|
7560 | |
7561 |
|
7562 |
|
7563 | function createTextVNode(text = ' ', flag = 0) {
|
7564 | return createVNode(Text, null, text, flag);
|
7565 | }
|
7566 | |
7567 |
|
7568 |
|
7569 | function createStaticVNode(content, numberOfNodes) {
|
7570 |
|
7571 |
|
7572 | const vnode = createVNode(Static, null, content);
|
7573 | vnode.staticCount = numberOfNodes;
|
7574 | return vnode;
|
7575 | }
|
7576 | |
7577 |
|
7578 |
|
7579 | function createCommentVNode(text = '',
|
7580 | // when used as the v-else branch, the comment node must be created as a
|
7581 | // block to ensure correct updates.
|
7582 | asBlock = false) {
|
7583 | return asBlock
|
7584 | ? (openBlock(), createBlock(Comment$1, null, text))
|
7585 | : createVNode(Comment$1, null, text);
|
7586 | }
|
7587 | function normalizeVNode(child) {
|
7588 | if (child == null || typeof child === 'boolean') {
|
7589 |
|
7590 | return createVNode(Comment$1);
|
7591 | }
|
7592 | else if (isArray(child)) {
|
7593 |
|
7594 | return createVNode(Fragment, null,
|
7595 |
|
7596 | child.slice());
|
7597 | }
|
7598 | else if (typeof child === 'object') {
|
7599 |
|
7600 |
|
7601 | return cloneIfMounted(child);
|
7602 | }
|
7603 | else {
|
7604 |
|
7605 | return createVNode(Text, null, String(child));
|
7606 | }
|
7607 | }
|
7608 |
|
7609 | function cloneIfMounted(child) {
|
7610 | return child.el === null ? child : cloneVNode(child);
|
7611 | }
|
7612 | function normalizeChildren(vnode, children) {
|
7613 | let type = 0;
|
7614 | const { shapeFlag } = vnode;
|
7615 | if (children == null) {
|
7616 | children = null;
|
7617 | }
|
7618 | else if (isArray(children)) {
|
7619 | type = 16 ;
|
7620 | }
|
7621 | else if (typeof children === 'object') {
|
7622 | if (shapeFlag & 1 || shapeFlag & 64 ) {
|
7623 |
|
7624 | const slot = children.default;
|
7625 | if (slot) {
|
7626 |
|
7627 | slot._c && (slot._d = false);
|
7628 | normalizeChildren(vnode, slot());
|
7629 | slot._c && (slot._d = true);
|
7630 | }
|
7631 | return;
|
7632 | }
|
7633 | else {
|
7634 | type = 32 ;
|
7635 | const slotFlag = children._;
|
7636 | if (!slotFlag && !(InternalObjectKey in children)) {
|
7637 | children._ctx = currentRenderingInstance;
|
7638 | }
|
7639 | else if (slotFlag === 3 && currentRenderingInstance) {
|
7640 |
|
7641 |
|
7642 | if (currentRenderingInstance.slots._ === 1 ) {
|
7643 | children._ = 1 ;
|
7644 | }
|
7645 | else {
|
7646 | children._ = 2 ;
|
7647 | vnode.patchFlag |= 1024 ;
|
7648 | }
|
7649 | }
|
7650 | }
|
7651 | }
|
7652 | else if (isFunction(children)) {
|
7653 | children = { default: children, _ctx: currentRenderingInstance };
|
7654 | type = 32 ;
|
7655 | }
|
7656 | else {
|
7657 | children = String(children);
|
7658 |
|
7659 | if (shapeFlag & 64 ) {
|
7660 | type = 16 ;
|
7661 | children = [createTextVNode(children)];
|
7662 | }
|
7663 | else {
|
7664 | type = 8 ;
|
7665 | }
|
7666 | }
|
7667 | vnode.children = children;
|
7668 | vnode.shapeFlag |= type;
|
7669 | }
|
7670 | function mergeProps(...args) {
|
7671 | const ret = extend({}, args[0]);
|
7672 | for (let i = 1; i < args.length; i++) {
|
7673 | const toMerge = args[i];
|
7674 | for (const key in toMerge) {
|
7675 | if (key === 'class') {
|
7676 | if (ret.class !== toMerge.class) {
|
7677 | ret.class = normalizeClass([ret.class, toMerge.class]);
|
7678 | }
|
7679 | }
|
7680 | else if (key === 'style') {
|
7681 | ret.style = normalizeStyle([ret.style, toMerge.style]);
|
7682 | }
|
7683 | else if (isOn(key)) {
|
7684 | const existing = ret[key];
|
7685 | const incoming = toMerge[key];
|
7686 | if (existing !== incoming) {
|
7687 | ret[key] = existing
|
7688 | ? [].concat(existing, incoming)
|
7689 | : incoming;
|
7690 | }
|
7691 | }
|
7692 | else if (key !== '') {
|
7693 | ret[key] = toMerge[key];
|
7694 | }
|
7695 | }
|
7696 | }
|
7697 | return ret;
|
7698 | }
|
7699 |
|
7700 | |
7701 |
|
7702 |
|
7703 | function renderList(source, renderItem) {
|
7704 | let ret;
|
7705 | if (isArray(source) || isString(source)) {
|
7706 | ret = new Array(source.length);
|
7707 | for (let i = 0, l = source.length; i < l; i++) {
|
7708 | ret[i] = renderItem(source[i], i);
|
7709 | }
|
7710 | }
|
7711 | else if (typeof source === 'number') {
|
7712 | if (!Number.isInteger(source)) {
|
7713 | warn(`The v-for range expect an integer value but got ${source}.`);
|
7714 | return [];
|
7715 | }
|
7716 | ret = new Array(source);
|
7717 | for (let i = 0; i < source; i++) {
|
7718 | ret[i] = renderItem(i + 1, i);
|
7719 | }
|
7720 | }
|
7721 | else if (isObject(source)) {
|
7722 | if (source[Symbol.iterator]) {
|
7723 | ret = Array.from(source, renderItem);
|
7724 | }
|
7725 | else {
|
7726 | const keys = Object.keys(source);
|
7727 | ret = new Array(keys.length);
|
7728 | for (let i = 0, l = keys.length; i < l; i++) {
|
7729 | const key = keys[i];
|
7730 | ret[i] = renderItem(source[key], key, i);
|
7731 | }
|
7732 | }
|
7733 | }
|
7734 | else {
|
7735 | ret = [];
|
7736 | }
|
7737 | return ret;
|
7738 | }
|
7739 |
|
7740 | |
7741 |
|
7742 |
|
7743 |
|
7744 | function createSlots(slots, dynamicSlots) {
|
7745 | for (let i = 0; i < dynamicSlots.length; i++) {
|
7746 | const slot = dynamicSlots[i];
|
7747 |
|
7748 | if (isArray(slot)) {
|
7749 | for (let j = 0; j < slot.length; j++) {
|
7750 | slots[slot[j].name] = slot[j].fn;
|
7751 | }
|
7752 | }
|
7753 | else if (slot) {
|
7754 |
|
7755 | slots[slot.name] = slot.fn;
|
7756 | }
|
7757 | }
|
7758 | return slots;
|
7759 | }
|
7760 |
|
7761 | |
7762 |
|
7763 |
|
7764 |
|
7765 | function renderSlot(slots, name, props = {},
|
7766 | // this is not a user-facing function, so the fallback is always generated by
|
7767 | // the compiler and guaranteed to be a function returning an array
|
7768 | fallback, noSlotted) {
|
7769 | let slot = slots[name];
|
7770 | if (slot && slot.length > 1) {
|
7771 | warn(`SSR-optimized slot function detected in a non-SSR-optimized render ` +
|
7772 | `function. You need to mark this component with $dynamic-slots in the ` +
|
7773 | `parent template.`);
|
7774 | slot = () => [];
|
7775 | }
|
7776 |
|
7777 |
|
7778 |
|
7779 |
|
7780 | if (slot && slot._c) {
|
7781 | slot._d = false;
|
7782 | }
|
7783 | openBlock();
|
7784 | const validSlotContent = slot && ensureValidVNode(slot(props));
|
7785 | const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1
|
7786 | ? 64
|
7787 | : -2 );
|
7788 | if (!noSlotted && rendered.scopeId) {
|
7789 | rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
7790 | }
|
7791 | if (slot && slot._c) {
|
7792 | slot._d = true;
|
7793 | }
|
7794 | return rendered;
|
7795 | }
|
7796 | function ensureValidVNode(vnodes) {
|
7797 | return vnodes.some(child => {
|
7798 | if (!isVNode(child))
|
7799 | return true;
|
7800 | if (child.type === Comment$1)
|
7801 | return false;
|
7802 | if (child.type === Fragment &&
|
7803 | !ensureValidVNode(child.children))
|
7804 | return false;
|
7805 | return true;
|
7806 | })
|
7807 | ? vnodes
|
7808 | : null;
|
7809 | }
|
7810 |
|
7811 | |
7812 |
|
7813 |
|
7814 |
|
7815 | function toHandlers(obj) {
|
7816 | const ret = {};
|
7817 | if (!isObject(obj)) {
|
7818 | warn(`v-on with no argument expects an object value.`);
|
7819 | return ret;
|
7820 | }
|
7821 | for (const key in obj) {
|
7822 | ret[toHandlerKey(key)] = obj[key];
|
7823 | }
|
7824 | return ret;
|
7825 | }
|
7826 |
|
7827 | |
7828 |
|
7829 |
|
7830 |
|
7831 |
|
7832 | const getPublicInstance = (i) => {
|
7833 | if (!i)
|
7834 | return null;
|
7835 | if (isStatefulComponent(i))
|
7836 | return i.exposed ? i.exposed : i.proxy;
|
7837 | return getPublicInstance(i.parent);
|
7838 | };
|
7839 | const publicPropertiesMap = extend(Object.create(null), {
|
7840 | $: i => i,
|
7841 | $el: i => i.vnode.el,
|
7842 | $data: i => i.data,
|
7843 | $props: i => (shallowReadonly(i.props) ),
|
7844 | $attrs: i => (shallowReadonly(i.attrs) ),
|
7845 | $slots: i => (shallowReadonly(i.slots) ),
|
7846 | $refs: i => (shallowReadonly(i.refs) ),
|
7847 | $parent: i => getPublicInstance(i.parent),
|
7848 | $root: i => getPublicInstance(i.root),
|
7849 | $emit: i => i.emit,
|
7850 | $options: i => (resolveMergedOptions(i) ),
|
7851 | $forceUpdate: i => () => queueJob(i.update),
|
7852 | $nextTick: i => nextTick.bind(i.proxy),
|
7853 | $watch: i => (instanceWatch.bind(i) )
|
7854 | });
|
7855 | const PublicInstanceProxyHandlers = {
|
7856 | get({ _: instance }, key) {
|
7857 | const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
7858 |
|
7859 | if (key === "__v_skip" ) {
|
7860 | return true;
|
7861 | }
|
7862 |
|
7863 | if (key === '__isVue') {
|
7864 | return true;
|
7865 | }
|
7866 |
|
7867 |
|
7868 |
|
7869 |
|
7870 |
|
7871 |
|
7872 | let normalizedProps;
|
7873 | if (key[0] !== '$') {
|
7874 | const n = accessCache[key];
|
7875 | if (n !== undefined) {
|
7876 | switch (n) {
|
7877 | case 0 :
|
7878 | return setupState[key];
|
7879 | case 1 :
|
7880 | return data[key];
|
7881 | case 3 :
|
7882 | return ctx[key];
|
7883 | case 2 :
|
7884 | return props[key];
|
7885 |
|
7886 | }
|
7887 | }
|
7888 | else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
7889 | accessCache[key] = 0 ;
|
7890 | return setupState[key];
|
7891 | }
|
7892 | else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
7893 | accessCache[key] = 1 ;
|
7894 | return data[key];
|
7895 | }
|
7896 | else if (
|
7897 |
|
7898 |
|
7899 | (normalizedProps = instance.propsOptions[0]) &&
|
7900 | hasOwn(normalizedProps, key)) {
|
7901 | accessCache[key] = 2 ;
|
7902 | return props[key];
|
7903 | }
|
7904 | else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
7905 | accessCache[key] = 3 ;
|
7906 | return ctx[key];
|
7907 | }
|
7908 | else if (shouldCacheAccess) {
|
7909 | accessCache[key] = 4 ;
|
7910 | }
|
7911 | }
|
7912 | const publicGetter = publicPropertiesMap[key];
|
7913 | let cssModule, globalProperties;
|
7914 |
|
7915 | if (publicGetter) {
|
7916 | if (key === '$attrs') {
|
7917 | track(instance, "get" , key);
|
7918 | markAttrsAccessed();
|
7919 | }
|
7920 | return publicGetter(instance);
|
7921 | }
|
7922 | else if (
|
7923 |
|
7924 | (cssModule = type.__cssModules) &&
|
7925 | (cssModule = cssModule[key])) {
|
7926 | return cssModule;
|
7927 | }
|
7928 | else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
7929 |
|
7930 | accessCache[key] = 3 ;
|
7931 | return ctx[key];
|
7932 | }
|
7933 | else if (
|
7934 |
|
7935 | ((globalProperties = appContext.config.globalProperties),
|
7936 | hasOwn(globalProperties, key))) {
|
7937 | {
|
7938 | return globalProperties[key];
|
7939 | }
|
7940 | }
|
7941 | else if (currentRenderingInstance &&
|
7942 | (!isString(key) ||
|
7943 |
|
7944 |
|
7945 | key.indexOf('__v') !== 0)) {
|
7946 | if (data !== EMPTY_OBJ &&
|
7947 | (key[0] === '$' || key[0] === '_') &&
|
7948 | hasOwn(data, key)) {
|
7949 | warn(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
|
7950 | `character ("$" or "_") and is not proxied on the render context.`);
|
7951 | }
|
7952 | else if (instance === currentRenderingInstance) {
|
7953 | warn(`Property ${JSON.stringify(key)} was accessed during render ` +
|
7954 | `but is not defined on instance.`);
|
7955 | }
|
7956 | }
|
7957 | },
|
7958 | set({ _: instance }, key, value) {
|
7959 | const { data, setupState, ctx } = instance;
|
7960 | if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
7961 | setupState[key] = value;
|
7962 | }
|
7963 | else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
7964 | data[key] = value;
|
7965 | }
|
7966 | else if (hasOwn(instance.props, key)) {
|
7967 | warn(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
7968 | return false;
|
7969 | }
|
7970 | if (key[0] === '$' && key.slice(1) in instance) {
|
7971 | warn(`Attempting to mutate public property "${key}". ` +
|
7972 | `Properties starting with $ are reserved and readonly.`, instance);
|
7973 | return false;
|
7974 | }
|
7975 | else {
|
7976 | if (key in instance.appContext.config.globalProperties) {
|
7977 | Object.defineProperty(ctx, key, {
|
7978 | enumerable: true,
|
7979 | configurable: true,
|
7980 | value
|
7981 | });
|
7982 | }
|
7983 | else {
|
7984 | ctx[key] = value;
|
7985 | }
|
7986 | }
|
7987 | return true;
|
7988 | },
|
7989 | has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
7990 | let normalizedProps;
|
7991 | return (accessCache[key] !== undefined ||
|
7992 | (data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
7993 | (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
7994 | ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
7995 | hasOwn(ctx, key) ||
|
7996 | hasOwn(publicPropertiesMap, key) ||
|
7997 | hasOwn(appContext.config.globalProperties, key));
|
7998 | }
|
7999 | };
|
8000 | {
|
8001 | PublicInstanceProxyHandlers.ownKeys = (target) => {
|
8002 | warn(`Avoid app logic that relies on enumerating keys on a component instance. ` +
|
8003 | `The keys will be empty in production mode to avoid performance overhead.`);
|
8004 | return Reflect.ownKeys(target);
|
8005 | };
|
8006 | }
|
8007 | const RuntimeCompiledPublicInstanceProxyHandlers = extend({}, PublicInstanceProxyHandlers, {
|
8008 | get(target, key) {
|
8009 |
|
8010 | if (key === Symbol.unscopables) {
|
8011 | return;
|
8012 | }
|
8013 | return PublicInstanceProxyHandlers.get(target, key, target);
|
8014 | },
|
8015 | has(_, key) {
|
8016 | const has = key[0] !== '_' && !isGloballyWhitelisted(key);
|
8017 | if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
8018 | warn(`Property ${JSON.stringify(key)} should not start with _ which is a reserved prefix for Vue internals.`);
|
8019 | }
|
8020 | return has;
|
8021 | }
|
8022 | });
|
8023 |
|
8024 |
|
8025 |
|
8026 | function createRenderContext(instance) {
|
8027 | const target = {};
|
8028 |
|
8029 | Object.defineProperty(target, `_`, {
|
8030 | configurable: true,
|
8031 | enumerable: false,
|
8032 | get: () => instance
|
8033 | });
|
8034 | // expose public properties
|
8035 | Object.keys(publicPropertiesMap).forEach(key => {
|
8036 | Object.defineProperty(target, key, {
|
8037 | configurable: true,
|
8038 | enumerable: false,
|
8039 | get: () => publicPropertiesMap[key](instance),
|
8040 | // intercepted by the proxy so no need for implementation,
|
8041 | // but needed to prevent set errors
|
8042 | set: NOOP
|
8043 | });
|
8044 | });
|
8045 | return target;
|
8046 | }
|
8047 | // dev only
|
8048 | function exposePropsOnRenderContext(instance) {
|
8049 | const { ctx, propsOptions: [propsOptions] } = instance;
|
8050 | if (propsOptions) {
|
8051 | Object.keys(propsOptions).forEach(key => {
|
8052 | Object.defineProperty(ctx, key, {
|
8053 | enumerable: true,
|
8054 | configurable: true,
|
8055 | get: () => instance.props[key],
|
8056 | set: NOOP
|
8057 | });
|
8058 | });
|
8059 | }
|
8060 | }
|
8061 | // dev only
|
8062 | function exposeSetupStateOnRenderContext(instance) {
|
8063 | const { ctx, setupState } = instance;
|
8064 | Object.keys(toRaw(setupState)).forEach(key => {
|
8065 | if (key[0] === '$' || key[0] === '_') {
|
8066 | warn(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
|
8067 | `which are reserved prefixes for Vue internals.`);
|
8068 | return;
|
8069 | }
|
8070 | Object.defineProperty(ctx, key, {
|
8071 | enumerable: true,
|
8072 | configurable: true,
|
8073 | get: () => setupState[key],
|
8074 | set: NOOP
|
8075 | });
|
8076 | });
|
8077 | }
|
8078 |
|
8079 | const emptyAppContext = createAppContext();
|
8080 | let uid$2 = 0;
|
8081 | function createComponentInstance(vnode, parent, suspense) {
|
8082 | const type = vnode.type;
|
8083 |
|
8084 | const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
|
8085 | const instance = {
|
8086 | uid: uid$2++,
|
8087 | vnode,
|
8088 | type,
|
8089 | parent,
|
8090 | appContext,
|
8091 | root: null,
|
8092 | next: null,
|
8093 | subTree: null,
|
8094 | update: null,
|
8095 | render: null,
|
8096 | proxy: null,
|
8097 | exposed: null,
|
8098 | withProxy: null,
|
8099 | effects: null,
|
8100 | provides: parent ? parent.provides : Object.create(appContext.provides),
|
8101 | accessCache: null,
|
8102 | renderCache: [],
|
8103 |
|
8104 | components: null,
|
8105 | directives: null,
|
8106 |
|
8107 | propsOptions: normalizePropsOptions(type, appContext),
|
8108 | emitsOptions: normalizeEmitsOptions(type, appContext),
|
8109 |
|
8110 | emit: null,
|
8111 | emitted: null,
|
8112 |
|
8113 | propsDefaults: EMPTY_OBJ,
|
8114 |
|
8115 | inheritAttrs: type.inheritAttrs,
|
8116 |
|
8117 | ctx: EMPTY_OBJ,
|
8118 | data: EMPTY_OBJ,
|
8119 | props: EMPTY_OBJ,
|
8120 | attrs: EMPTY_OBJ,
|
8121 | slots: EMPTY_OBJ,
|
8122 | refs: EMPTY_OBJ,
|
8123 | setupState: EMPTY_OBJ,
|
8124 | setupContext: null,
|
8125 |
|
8126 | suspense,
|
8127 | suspenseId: suspense ? suspense.pendingId : 0,
|
8128 | asyncDep: null,
|
8129 | asyncResolved: false,
|
8130 |
|
8131 |
|
8132 | isMounted: false,
|
8133 | isUnmounted: false,
|
8134 | isDeactivated: false,
|
8135 | bc: null,
|
8136 | c: null,
|
8137 | bm: null,
|
8138 | m: null,
|
8139 | bu: null,
|
8140 | u: null,
|
8141 | um: null,
|
8142 | bum: null,
|
8143 | da: null,
|
8144 | a: null,
|
8145 | rtg: null,
|
8146 | rtc: null,
|
8147 | ec: null,
|
8148 | sp: null
|
8149 | };
|
8150 | {
|
8151 | instance.ctx = createRenderContext(instance);
|
8152 | }
|
8153 | instance.root = parent ? parent.root : instance;
|
8154 | instance.emit = emit.bind(null, instance);
|
8155 | return instance;
|
8156 | }
|
8157 | let currentInstance = null;
|
8158 | const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
8159 | const setCurrentInstance = (instance) => {
|
8160 | currentInstance = instance;
|
8161 | };
|
8162 | const isBuiltInTag = makeMap('slot,component');
|
8163 | function validateComponentName(name, config) {
|
8164 | const appIsNativeTag = config.isNativeTag || NO;
|
8165 | if (isBuiltInTag(name) || appIsNativeTag(name)) {
|
8166 | warn('Do not use built-in or reserved HTML elements as component id: ' + name);
|
8167 | }
|
8168 | }
|
8169 | function isStatefulComponent(instance) {
|
8170 | return instance.vnode.shapeFlag & 4 ;
|
8171 | }
|
8172 | let isInSSRComponentSetup = false;
|
8173 | function setupComponent(instance, isSSR = false) {
|
8174 | isInSSRComponentSetup = isSSR;
|
8175 | const { props, children } = instance.vnode;
|
8176 | const isStateful = isStatefulComponent(instance);
|
8177 | initProps(instance, props, isStateful, isSSR);
|
8178 | initSlots(instance, children);
|
8179 | const setupResult = isStateful
|
8180 | ? setupStatefulComponent(instance, isSSR)
|
8181 | : undefined;
|
8182 | isInSSRComponentSetup = false;
|
8183 | return setupResult;
|
8184 | }
|
8185 | function setupStatefulComponent(instance, isSSR) {
|
8186 | const Component = instance.type;
|
8187 | {
|
8188 | if (Component.name) {
|
8189 | validateComponentName(Component.name, instance.appContext.config);
|
8190 | }
|
8191 | if (Component.components) {
|
8192 | const names = Object.keys(Component.components);
|
8193 | for (let i = 0; i < names.length; i++) {
|
8194 | validateComponentName(names[i], instance.appContext.config);
|
8195 | }
|
8196 | }
|
8197 | if (Component.directives) {
|
8198 | const names = Object.keys(Component.directives);
|
8199 | for (let i = 0; i < names.length; i++) {
|
8200 | validateDirectiveName(names[i]);
|
8201 | }
|
8202 | }
|
8203 | if (Component.compilerOptions && isRuntimeOnly()) {
|
8204 | warn(`"compilerOptions" is only supported when using a build of Vue that ` +
|
8205 | `includes the runtime compiler. Since you are using a runtime-only ` +
|
8206 | `build, the options should be passed via your build tool config instead.`);
|
8207 | }
|
8208 | }
|
8209 |
|
8210 | instance.accessCache = Object.create(null);
|
8211 |
|
8212 |
|
8213 | instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
|
8214 | {
|
8215 | exposePropsOnRenderContext(instance);
|
8216 | }
|
8217 |
|
8218 | const { setup } = Component;
|
8219 | if (setup) {
|
8220 | const setupContext = (instance.setupContext =
|
8221 | setup.length > 1 ? createSetupContext(instance) : null);
|
8222 | currentInstance = instance;
|
8223 | pauseTracking();
|
8224 | const setupResult = callWithErrorHandling(setup, instance, 0 , [shallowReadonly(instance.props) , setupContext]);
|
8225 | resetTracking();
|
8226 | currentInstance = null;
|
8227 | if (isPromise(setupResult)) {
|
8228 | if (isSSR) {
|
8229 |
|
8230 | return setupResult
|
8231 | .then((resolvedResult) => {
|
8232 | handleSetupResult(instance, resolvedResult, isSSR);
|
8233 | })
|
8234 | .catch(e => {
|
8235 | handleError(e, instance, 0 );
|
8236 | });
|
8237 | }
|
8238 | else {
|
8239 |
|
8240 |
|
8241 | instance.asyncDep = setupResult;
|
8242 | }
|
8243 | }
|
8244 | else {
|
8245 | handleSetupResult(instance, setupResult, isSSR);
|
8246 | }
|
8247 | }
|
8248 | else {
|
8249 | finishComponentSetup(instance, isSSR);
|
8250 | }
|
8251 | }
|
8252 | function handleSetupResult(instance, setupResult, isSSR) {
|
8253 | if (isFunction(setupResult)) {
|
8254 |
|
8255 | {
|
8256 | instance.render = setupResult;
|
8257 | }
|
8258 | }
|
8259 | else if (isObject(setupResult)) {
|
8260 | if (isVNode(setupResult)) {
|
8261 | warn(`setup() should not return VNodes directly - ` +
|
8262 | `return a render function instead.`);
|
8263 | }
|
8264 |
|
8265 |
|
8266 | {
|
8267 | instance.devtoolsRawSetupState = setupResult;
|
8268 | }
|
8269 | instance.setupState = proxyRefs(setupResult);
|
8270 | {
|
8271 | exposeSetupStateOnRenderContext(instance);
|
8272 | }
|
8273 | }
|
8274 | else if (setupResult !== undefined) {
|
8275 | warn(`setup() should return an object. Received: ${setupResult === null ? 'null' : typeof setupResult}`);
|
8276 | }
|
8277 | finishComponentSetup(instance, isSSR);
|
8278 | }
|
8279 | let compile;
|
8280 |
|
8281 | const isRuntimeOnly = () => !compile;
|
8282 | |
8283 |
|
8284 |
|
8285 |
|
8286 | function registerRuntimeCompiler(_compile) {
|
8287 | compile = _compile;
|
8288 | }
|
8289 | function finishComponentSetup(instance, isSSR, skipOptions) {
|
8290 | const Component = instance.type;
|
8291 |
|
8292 | if (!instance.render) {
|
8293 |
|
8294 | if (compile && !Component.render) {
|
8295 | const template = Component.template;
|
8296 | if (template) {
|
8297 | {
|
8298 | startMeasure(instance, `compile`);
|
8299 | }
|
8300 | const { isCustomElement, compilerOptions } = instance.appContext.config;
|
8301 | const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
8302 | const finalCompilerOptions = extend(extend({
|
8303 | isCustomElement,
|
8304 | delimiters
|
8305 | }, compilerOptions), componentCompilerOptions);
|
8306 | Component.render = compile(template, finalCompilerOptions);
|
8307 | {
|
8308 | endMeasure(instance, `compile`);
|
8309 | }
|
8310 | }
|
8311 | }
|
8312 | instance.render = (Component.render || NOOP);
|
8313 |
|
8314 |
|
8315 |
|
8316 | if (instance.render._rc) {
|
8317 | instance.withProxy = new Proxy(instance.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
|
8318 | }
|
8319 | }
|
8320 |
|
8321 | {
|
8322 | currentInstance = instance;
|
8323 | pauseTracking();
|
8324 | applyOptions(instance);
|
8325 | resetTracking();
|
8326 | currentInstance = null;
|
8327 | }
|
8328 |
|
8329 |
|
8330 | if (!Component.render && instance.render === NOOP && !isSSR) {
|
8331 |
|
8332 | if (!compile && Component.template) {
|
8333 | warn(`Component provided template option but ` +
|
8334 | `runtime compilation is not supported in this build of Vue.` +
|
8335 | (` Use "vue.global.js" instead.`
|
8336 | ) );
|
8337 | }
|
8338 | else {
|
8339 | warn(`Component is missing template or render function.`);
|
8340 | }
|
8341 | }
|
8342 | }
|
8343 | const attrHandlers = {
|
8344 | get: (target, key) => {
|
8345 | {
|
8346 | markAttrsAccessed();
|
8347 | }
|
8348 | return target[key];
|
8349 | },
|
8350 | set: () => {
|
8351 | warn(`setupContext.attrs is readonly.`);
|
8352 | return false;
|
8353 | },
|
8354 | deleteProperty: () => {
|
8355 | warn(`setupContext.attrs is readonly.`);
|
8356 | return false;
|
8357 | }
|
8358 | };
|
8359 | function createSetupContext(instance) {
|
8360 | const expose = exposed => {
|
8361 | if (instance.exposed) {
|
8362 | warn(`expose() should be called only once per setup().`);
|
8363 | }
|
8364 | instance.exposed = proxyRefs(exposed);
|
8365 | };
|
8366 | {
|
8367 |
|
8368 |
|
8369 | return Object.freeze({
|
8370 | get attrs() {
|
8371 | return new Proxy(instance.attrs, attrHandlers);
|
8372 | },
|
8373 | get slots() {
|
8374 | return shallowReadonly(instance.slots);
|
8375 | },
|
8376 | get emit() {
|
8377 | return (event, ...args) => instance.emit(event, ...args);
|
8378 | },
|
8379 | expose
|
8380 | });
|
8381 | }
|
8382 | }
|
8383 |
|
8384 |
|
8385 | function recordInstanceBoundEffect(effect, instance = currentInstance) {
|
8386 | if (instance) {
|
8387 | (instance.effects || (instance.effects = [])).push(effect);
|
8388 | }
|
8389 | }
|
8390 | const classifyRE = /(?:^|[-_])(\w)/g;
|
8391 | const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
8392 | function getComponentName(Component) {
|
8393 | return isFunction(Component)
|
8394 | ? Component.displayName || Component.name
|
8395 | : Component.name;
|
8396 | }
|
8397 |
|
8398 | function formatComponentName(instance, Component, isRoot = false) {
|
8399 | let name = getComponentName(Component);
|
8400 | if (!name && Component.__file) {
|
8401 | const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
8402 | if (match) {
|
8403 | name = match[1];
|
8404 | }
|
8405 | }
|
8406 | if (!name && instance && instance.parent) {
|
8407 |
|
8408 | const inferFromRegistry = (registry) => {
|
8409 | for (const key in registry) {
|
8410 | if (registry[key] === Component) {
|
8411 | return key;
|
8412 | }
|
8413 | }
|
8414 | };
|
8415 | name =
|
8416 | inferFromRegistry(instance.components ||
|
8417 | instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
|
8418 | }
|
8419 | return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
8420 | }
|
8421 | function isClassComponent(value) {
|
8422 | return isFunction(value) && '__vccOpts' in value;
|
8423 | }
|
8424 |
|
8425 | function computed$1(getterOrOptions) {
|
8426 | const c = computed(getterOrOptions);
|
8427 | recordInstanceBoundEffect(c.effect);
|
8428 | return c;
|
8429 | }
|
8430 |
|
8431 |
|
8432 | function defineProps() {
|
8433 | {
|
8434 | warn(`defineProps() is a compiler-hint helper that is only usable inside ` +
|
8435 | `<script setup> of a single file component. Its arguments should be ` +
|
8436 | `compiled away and passing it at runtime has no effect.`);
|
8437 | }
|
8438 | return null;
|
8439 | }
|
8440 |
|
8441 | function defineEmit() {
|
8442 | {
|
8443 | warn(`defineEmit() is a compiler-hint helper that is only usable inside ` +
|
8444 | `<script setup> of a single file component. Its arguments should be ` +
|
8445 | `compiled away and passing it at runtime has no effect.`);
|
8446 | }
|
8447 | return null;
|
8448 | }
|
8449 | function useContext() {
|
8450 | const i = getCurrentInstance();
|
8451 | if (!i) {
|
8452 | warn(`useContext() called without active instance.`);
|
8453 | }
|
8454 | return i.setupContext || (i.setupContext = createSetupContext(i));
|
8455 | }
|
8456 |
|
8457 |
|
8458 | function h(type, propsOrChildren, children) {
|
8459 | const l = arguments.length;
|
8460 | if (l === 2) {
|
8461 | if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
8462 |
|
8463 | if (isVNode(propsOrChildren)) {
|
8464 | return createVNode(type, null, [propsOrChildren]);
|
8465 | }
|
8466 |
|
8467 | return createVNode(type, propsOrChildren);
|
8468 | }
|
8469 | else {
|
8470 |
|
8471 | return createVNode(type, null, propsOrChildren);
|
8472 | }
|
8473 | }
|
8474 | else {
|
8475 | if (l > 3) {
|
8476 | children = Array.prototype.slice.call(arguments, 2);
|
8477 | }
|
8478 | else if (l === 3 && isVNode(children)) {
|
8479 | children = [children];
|
8480 | }
|
8481 | return createVNode(type, propsOrChildren, children);
|
8482 | }
|
8483 | }
|
8484 |
|
8485 | const ssrContextKey = Symbol(`ssrContext` );
|
8486 | const useSSRContext = () => {
|
8487 | {
|
8488 | warn(`useSSRContext() is not supported in the global build.`);
|
8489 | }
|
8490 | };
|
8491 |
|
8492 | function initCustomFormatter() {
|
8493 |
|
8494 | if (typeof window === 'undefined') {
|
8495 | return;
|
8496 | }
|
8497 | const vueStyle = { style: 'color:#3ba776' };
|
8498 | const numberStyle = { style: 'color:#0b1bc9' };
|
8499 | const stringStyle = { style: 'color:#b62e24' };
|
8500 | const keywordStyle = { style: 'color:#9d288c' };
|
8501 |
|
8502 |
|
8503 | const formatter = {
|
8504 | header(obj) {
|
8505 |
|
8506 | if (!isObject(obj)) {
|
8507 | return null;
|
8508 | }
|
8509 | if (obj.__isVue) {
|
8510 | return ['div', vueStyle, `VueInstance`];
|
8511 | }
|
8512 | else if (isRef(obj)) {
|
8513 | return [
|
8514 | 'div',
|
8515 | {},
|
8516 | ['span', vueStyle, genRefFlag(obj)],
|
8517 | '<',
|
8518 | formatValue(obj.value),
|
8519 | `>`
|
8520 | ];
|
8521 | }
|
8522 | else if (isReactive(obj)) {
|
8523 | return [
|
8524 | 'div',
|
8525 | {},
|
8526 | ['span', vueStyle, 'Reactive'],
|
8527 | '<',
|
8528 | formatValue(obj),
|
8529 | `>${isReadonly(obj) ? ` (readonly)` : ``}`
|
8530 | ];
|
8531 | }
|
8532 | else if (isReadonly(obj)) {
|
8533 | return [
|
8534 | 'div',
|
8535 | {},
|
8536 | ['span', vueStyle, 'Readonly'],
|
8537 | '<',
|
8538 | formatValue(obj),
|
8539 | '>'
|
8540 | ];
|
8541 | }
|
8542 | return null;
|
8543 | },
|
8544 | hasBody(obj) {
|
8545 | return obj && obj.__isVue;
|
8546 | },
|
8547 | body(obj) {
|
8548 | if (obj && obj.__isVue) {
|
8549 | return [
|
8550 | 'div',
|
8551 | {},
|
8552 | ...formatInstance(obj.$)
|
8553 | ];
|
8554 | }
|
8555 | }
|
8556 | };
|
8557 | function formatInstance(instance) {
|
8558 | const blocks = [];
|
8559 | if (instance.type.props && instance.props) {
|
8560 | blocks.push(createInstanceBlock('props', toRaw(instance.props)));
|
8561 | }
|
8562 | if (instance.setupState !== EMPTY_OBJ) {
|
8563 | blocks.push(createInstanceBlock('setup', instance.setupState));
|
8564 | }
|
8565 | if (instance.data !== EMPTY_OBJ) {
|
8566 | blocks.push(createInstanceBlock('data', toRaw(instance.data)));
|
8567 | }
|
8568 | const computed = extractKeys(instance, 'computed');
|
8569 | if (computed) {
|
8570 | blocks.push(createInstanceBlock('computed', computed));
|
8571 | }
|
8572 | const injected = extractKeys(instance, 'inject');
|
8573 | if (injected) {
|
8574 | blocks.push(createInstanceBlock('injected', injected));
|
8575 | }
|
8576 | blocks.push([
|
8577 | 'div',
|
8578 | {},
|
8579 | [
|
8580 | 'span',
|
8581 | {
|
8582 | style: keywordStyle.style + ';opacity:0.66'
|
8583 | },
|
8584 | '$ (internal): '
|
8585 | ],
|
8586 | ['object', { object: instance }]
|
8587 | ]);
|
8588 | return blocks;
|
8589 | }
|
8590 | function createInstanceBlock(type, target) {
|
8591 | target = extend({}, target);
|
8592 | if (!Object.keys(target).length) {
|
8593 | return ['span', {}];
|
8594 | }
|
8595 | return [
|
8596 | 'div',
|
8597 | { style: 'line-height:1.25em;margin-bottom:0.6em' },
|
8598 | [
|
8599 | 'div',
|
8600 | {
|
8601 | style: 'color:#476582'
|
8602 | },
|
8603 | type
|
8604 | ],
|
8605 | [
|
8606 | 'div',
|
8607 | {
|
8608 | style: 'padding-left:1.25em'
|
8609 | },
|
8610 | ...Object.keys(target).map(key => {
|
8611 | return [
|
8612 | 'div',
|
8613 | {},
|
8614 | ['span', keywordStyle, key + ': '],
|
8615 | formatValue(target[key], false)
|
8616 | ];
|
8617 | })
|
8618 | ]
|
8619 | ];
|
8620 | }
|
8621 | function formatValue(v, asRaw = true) {
|
8622 | if (typeof v === 'number') {
|
8623 | return ['span', numberStyle, v];
|
8624 | }
|
8625 | else if (typeof v === 'string') {
|
8626 | return ['span', stringStyle, JSON.stringify(v)];
|
8627 | }
|
8628 | else if (typeof v === 'boolean') {
|
8629 | return ['span', keywordStyle, v];
|
8630 | }
|
8631 | else if (isObject(v)) {
|
8632 | return ['object', { object: asRaw ? toRaw(v) : v }];
|
8633 | }
|
8634 | else {
|
8635 | return ['span', stringStyle, String(v)];
|
8636 | }
|
8637 | }
|
8638 | function extractKeys(instance, type) {
|
8639 | const Comp = instance.type;
|
8640 | if (isFunction(Comp)) {
|
8641 | return;
|
8642 | }
|
8643 | const extracted = {};
|
8644 | for (const key in instance.ctx) {
|
8645 | if (isKeyOfType(Comp, key, type)) {
|
8646 | extracted[key] = instance.ctx[key];
|
8647 | }
|
8648 | }
|
8649 | return extracted;
|
8650 | }
|
8651 | function isKeyOfType(Comp, key, type) {
|
8652 | const opts = Comp[type];
|
8653 | if ((isArray(opts) && opts.includes(key)) ||
|
8654 | (isObject(opts) && key in opts)) {
|
8655 | return true;
|
8656 | }
|
8657 | if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
|
8658 | return true;
|
8659 | }
|
8660 | if (Comp.mixins && Comp.mixins.some(m => isKeyOfType(m, key, type))) {
|
8661 | return true;
|
8662 | }
|
8663 | }
|
8664 | function genRefFlag(v) {
|
8665 | if (v._shallow) {
|
8666 | return `ShallowRef`;
|
8667 | }
|
8668 | if (v.effect) {
|
8669 | return `ComputedRef`;
|
8670 | }
|
8671 | return `Ref`;
|
8672 | }
|
8673 | if (window.devtoolsFormatters) {
|
8674 | window.devtoolsFormatters.push(formatter);
|
8675 | }
|
8676 | else {
|
8677 | window.devtoolsFormatters = [formatter];
|
8678 | }
|
8679 | }
|
8680 |
|
8681 |
|
8682 | const version = "3.1.1";
|
8683 | |
8684 |
|
8685 |
|
8686 |
|
8687 | const ssrUtils = (null);
|
8688 | |
8689 |
|
8690 |
|
8691 | const resolveFilter = null;
|
8692 | |
8693 |
|
8694 |
|
8695 | const compatUtils = (null);
|
8696 |
|
8697 | const svgNS = 'http://www.w3.org/2000/svg';
|
8698 | const doc = (typeof document !== 'undefined' ? document : null);
|
8699 | let tempContainer;
|
8700 | let tempSVGContainer;
|
8701 | const nodeOps = {
|
8702 | insert: (child, parent, anchor) => {
|
8703 | parent.insertBefore(child, anchor || null);
|
8704 | },
|
8705 | remove: child => {
|
8706 | const parent = child.parentNode;
|
8707 | if (parent) {
|
8708 | parent.removeChild(child);
|
8709 | }
|
8710 | },
|
8711 | createElement: (tag, isSVG, is, props) => {
|
8712 | const el = isSVG
|
8713 | ? doc.createElementNS(svgNS, tag)
|
8714 | : doc.createElement(tag, is ? { is } : undefined);
|
8715 | if (tag === 'select' && props && props.multiple != null) {
|
8716 | el.setAttribute('multiple', props.multiple);
|
8717 | }
|
8718 | return el;
|
8719 | },
|
8720 | createText: text => doc.createTextNode(text),
|
8721 | createComment: text => doc.createComment(text),
|
8722 | setText: (node, text) => {
|
8723 | node.nodeValue = text;
|
8724 | },
|
8725 | setElementText: (el, text) => {
|
8726 | el.textContent = text;
|
8727 | },
|
8728 | parentNode: node => node.parentNode,
|
8729 | nextSibling: node => node.nextSibling,
|
8730 | querySelector: selector => doc.querySelector(selector),
|
8731 | setScopeId(el, id) {
|
8732 | el.setAttribute(id, '');
|
8733 | },
|
8734 | cloneNode(el) {
|
8735 | const cloned = el.cloneNode(true);
|
8736 |
|
8737 |
|
8738 |
|
8739 |
|
8740 |
|
8741 |
|
8742 |
|
8743 |
|
8744 |
|
8745 | if (`_value` in el) {
|
8746 | cloned._value = el._value;
|
8747 | }
|
8748 | return cloned;
|
8749 | },
|
8750 |
|
8751 |
|
8752 |
|
8753 |
|
8754 | insertStaticContent(content, parent, anchor, isSVG) {
|
8755 | const temp = isSVG
|
8756 | ? tempSVGContainer ||
|
8757 | (tempSVGContainer = doc.createElementNS(svgNS, 'svg'))
|
8758 | : tempContainer || (tempContainer = doc.createElement('div'));
|
8759 | temp.innerHTML = content;
|
8760 | const first = temp.firstChild;
|
8761 | let node = first;
|
8762 | let last = node;
|
8763 | while (node) {
|
8764 | last = node;
|
8765 | nodeOps.insert(node, parent, anchor);
|
8766 | node = temp.firstChild;
|
8767 | }
|
8768 | return [first, last];
|
8769 | }
|
8770 | };
|
8771 |
|
8772 |
|
8773 |
|
8774 | function patchClass(el, value, isSVG) {
|
8775 | if (value == null) {
|
8776 | value = '';
|
8777 | }
|
8778 | if (isSVG) {
|
8779 | el.setAttribute('class', value);
|
8780 | }
|
8781 | else {
|
8782 |
|
8783 |
|
8784 |
|
8785 | const transitionClasses = el._vtc;
|
8786 | if (transitionClasses) {
|
8787 | value = (value
|
8788 | ? [value, ...transitionClasses]
|
8789 | : [...transitionClasses]).join(' ');
|
8790 | }
|
8791 | el.className = value;
|
8792 | }
|
8793 | }
|
8794 |
|
8795 | function patchStyle(el, prev, next) {
|
8796 | const style = el.style;
|
8797 | if (!next) {
|
8798 | el.removeAttribute('style');
|
8799 | }
|
8800 | else if (isString(next)) {
|
8801 | if (prev !== next) {
|
8802 | const current = style.display;
|
8803 | style.cssText = next;
|
8804 |
|
8805 |
|
8806 |
|
8807 | if ('_vod' in el) {
|
8808 | style.display = current;
|
8809 | }
|
8810 | }
|
8811 | }
|
8812 | else {
|
8813 | for (const key in next) {
|
8814 | setStyle(style, key, next[key]);
|
8815 | }
|
8816 | if (prev && !isString(prev)) {
|
8817 | for (const key in prev) {
|
8818 | if (next[key] == null) {
|
8819 | setStyle(style, key, '');
|
8820 | }
|
8821 | }
|
8822 | }
|
8823 | }
|
8824 | }
|
8825 | const importantRE = /\s*!important$/;
|
8826 | function setStyle(style, name, val) {
|
8827 | if (isArray(val)) {
|
8828 | val.forEach(v => setStyle(style, name, v));
|
8829 | }
|
8830 | else {
|
8831 | if (name.startsWith('--')) {
|
8832 |
|
8833 | style.setProperty(name, val);
|
8834 | }
|
8835 | else {
|
8836 | const prefixed = autoPrefix(style, name);
|
8837 | if (importantRE.test(val)) {
|
8838 |
|
8839 | style.setProperty(hyphenate(prefixed), val.replace(importantRE, ''), 'important');
|
8840 | }
|
8841 | else {
|
8842 | style[prefixed] = val;
|
8843 | }
|
8844 | }
|
8845 | }
|
8846 | }
|
8847 | const prefixes = ['Webkit', 'Moz', 'ms'];
|
8848 | const prefixCache = {};
|
8849 | function autoPrefix(style, rawName) {
|
8850 | const cached = prefixCache[rawName];
|
8851 | if (cached) {
|
8852 | return cached;
|
8853 | }
|
8854 | let name = camelize(rawName);
|
8855 | if (name !== 'filter' && name in style) {
|
8856 | return (prefixCache[rawName] = name);
|
8857 | }
|
8858 | name = capitalize(name);
|
8859 | for (let i = 0; i < prefixes.length; i++) {
|
8860 | const prefixed = prefixes[i] + name;
|
8861 | if (prefixed in style) {
|
8862 | return (prefixCache[rawName] = prefixed);
|
8863 | }
|
8864 | }
|
8865 | return rawName;
|
8866 | }
|
8867 |
|
8868 | const xlinkNS = 'http://www.w3.org/1999/xlink';
|
8869 | function patchAttr(el, key, value, isSVG, instance) {
|
8870 | if (isSVG && key.startsWith('xlink:')) {
|
8871 | if (value == null) {
|
8872 | el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
8873 | }
|
8874 | else {
|
8875 | el.setAttributeNS(xlinkNS, key, value);
|
8876 | }
|
8877 | }
|
8878 | else {
|
8879 |
|
8880 |
|
8881 | const isBoolean = isSpecialBooleanAttr(key);
|
8882 | if (value == null || (isBoolean && value === false)) {
|
8883 | el.removeAttribute(key);
|
8884 | }
|
8885 | else {
|
8886 | el.setAttribute(key, isBoolean ? '' : value);
|
8887 | }
|
8888 | }
|
8889 | }
|
8890 |
|
8891 |
|
8892 |
|
8893 | function patchDOMProp(el, key, value,
|
8894 | // the following args are passed only due to potential innerHTML/textContent
|
8895 |
|
8896 |
|
8897 | prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
8898 | if (key === 'innerHTML' || key === 'textContent') {
|
8899 | if (prevChildren) {
|
8900 | unmountChildren(prevChildren, parentComponent, parentSuspense);
|
8901 | }
|
8902 | el[key] = value == null ? '' : value;
|
8903 | return;
|
8904 | }
|
8905 | if (key === 'value' && el.tagName !== 'PROGRESS') {
|
8906 |
|
8907 |
|
8908 | el._value = value;
|
8909 | const newValue = value == null ? '' : value;
|
8910 | if (el.value !== newValue) {
|
8911 | el.value = newValue;
|
8912 | }
|
8913 | if (value == null) {
|
8914 | el.removeAttribute(key);
|
8915 | }
|
8916 | return;
|
8917 | }
|
8918 | if (value === '' || value == null) {
|
8919 | const type = typeof el[key];
|
8920 | if (value === '' && type === 'boolean') {
|
8921 |
|
8922 | el[key] = true;
|
8923 | return;
|
8924 | }
|
8925 | else if (value == null && type === 'string') {
|
8926 |
|
8927 | el[key] = '';
|
8928 | el.removeAttribute(key);
|
8929 | return;
|
8930 | }
|
8931 | else if (type === 'number') {
|
8932 |
|
8933 | el[key] = 0;
|
8934 | el.removeAttribute(key);
|
8935 | return;
|
8936 | }
|
8937 | }
|
8938 |
|
8939 | try {
|
8940 | el[key] = value;
|
8941 | }
|
8942 | catch (e) {
|
8943 | {
|
8944 | warn(`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
|
8945 | `value ${value} is invalid.`, e);
|
8946 | }
|
8947 | }
|
8948 | }
|
8949 |
|
8950 |
|
8951 | let _getNow = Date.now;
|
8952 | let skipTimestampCheck = false;
|
8953 | if (typeof window !== 'undefined') {
|
8954 |
|
8955 |
|
8956 |
|
8957 |
|
8958 | if (_getNow() > document.createEvent('Event').timeStamp) {
|
8959 |
|
8960 |
|
8961 |
|
8962 | _getNow = () => performance.now();
|
8963 | }
|
8964 |
|
8965 |
|
8966 | const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
|
8967 | skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
|
8968 | }
|
8969 |
|
8970 |
|
8971 | let cachedNow = 0;
|
8972 | const p = Promise.resolve();
|
8973 | const reset = () => {
|
8974 | cachedNow = 0;
|
8975 | };
|
8976 | const getNow = () => cachedNow || (p.then(reset), (cachedNow = _getNow()));
|
8977 | function addEventListener(el, event, handler, options) {
|
8978 | el.addEventListener(event, handler, options);
|
8979 | }
|
8980 | function removeEventListener(el, event, handler, options) {
|
8981 | el.removeEventListener(event, handler, options);
|
8982 | }
|
8983 | function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
8984 |
|
8985 | const invokers = el._vei || (el._vei = {});
|
8986 | const existingInvoker = invokers[rawName];
|
8987 | if (nextValue && existingInvoker) {
|
8988 |
|
8989 | existingInvoker.value = nextValue;
|
8990 | }
|
8991 | else {
|
8992 | const [name, options] = parseName(rawName);
|
8993 | if (nextValue) {
|
8994 |
|
8995 | const invoker = (invokers[rawName] = createInvoker(nextValue, instance));
|
8996 | addEventListener(el, name, invoker, options);
|
8997 | }
|
8998 | else if (existingInvoker) {
|
8999 |
|
9000 | removeEventListener(el, name, existingInvoker, options);
|
9001 | invokers[rawName] = undefined;
|
9002 | }
|
9003 | }
|
9004 | }
|
9005 | const optionsModifierRE = /(?:Once|Passive|Capture)$/;
|
9006 | function parseName(name) {
|
9007 | let options;
|
9008 | if (optionsModifierRE.test(name)) {
|
9009 | options = {};
|
9010 | let m;
|
9011 | while ((m = name.match(optionsModifierRE))) {
|
9012 | name = name.slice(0, name.length - m[0].length);
|
9013 | options[m[0].toLowerCase()] = true;
|
9014 | }
|
9015 | }
|
9016 | return [hyphenate(name.slice(2)), options];
|
9017 | }
|
9018 | function createInvoker(initialValue, instance) {
|
9019 | const invoker = (e) => {
|
9020 |
|
9021 |
|
9022 |
|
9023 |
|
9024 |
|
9025 |
|
9026 | const timeStamp = e.timeStamp || _getNow();
|
9027 | if (skipTimestampCheck || timeStamp >= invoker.attached - 1) {
|
9028 | callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 , [e]);
|
9029 | }
|
9030 | };
|
9031 | invoker.value = initialValue;
|
9032 | invoker.attached = getNow();
|
9033 | return invoker;
|
9034 | }
|
9035 | function patchStopImmediatePropagation(e, value) {
|
9036 | if (isArray(value)) {
|
9037 | const originalStop = e.stopImmediatePropagation;
|
9038 | e.stopImmediatePropagation = () => {
|
9039 | originalStop.call(e);
|
9040 | e._stopped = true;
|
9041 | };
|
9042 | return value.map(fn => (e) => !e._stopped && fn(e));
|
9043 | }
|
9044 | else {
|
9045 | return value;
|
9046 | }
|
9047 | }
|
9048 |
|
9049 | const nativeOnRE = /^on[a-z]/;
|
9050 | const forcePatchProp = (_, key) => key === 'value';
|
9051 | const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
|
9052 | switch (key) {
|
9053 |
|
9054 | case 'class':
|
9055 | patchClass(el, nextValue, isSVG);
|
9056 | break;
|
9057 | case 'style':
|
9058 | patchStyle(el, prevValue, nextValue);
|
9059 | break;
|
9060 | default:
|
9061 | if (isOn(key)) {
|
9062 |
|
9063 | if (!isModelListener(key)) {
|
9064 | patchEvent(el, key, prevValue, nextValue, parentComponent);
|
9065 | }
|
9066 | }
|
9067 | else if (shouldSetAsProp(el, key, nextValue, isSVG)) {
|
9068 | patchDOMProp(el, key, nextValue, prevChildren, parentComponent, parentSuspense, unmountChildren);
|
9069 | }
|
9070 | else {
|
9071 |
|
9072 |
|
9073 |
|
9074 |
|
9075 | if (key === 'true-value') {
|
9076 | el._trueValue = nextValue;
|
9077 | }
|
9078 | else if (key === 'false-value') {
|
9079 | el._falseValue = nextValue;
|
9080 | }
|
9081 | patchAttr(el, key, nextValue, isSVG);
|
9082 | }
|
9083 | break;
|
9084 | }
|
9085 | };
|
9086 | function shouldSetAsProp(el, key, value, isSVG) {
|
9087 | if (isSVG) {
|
9088 |
|
9089 |
|
9090 | if (key === 'innerHTML') {
|
9091 | return true;
|
9092 | }
|
9093 |
|
9094 | if (key in el && nativeOnRE.test(key) && isFunction(value)) {
|
9095 | return true;
|
9096 | }
|
9097 | return false;
|
9098 | }
|
9099 |
|
9100 |
|
9101 |
|
9102 |
|
9103 |
|
9104 |
|
9105 | if (key === 'spellcheck' || key === 'draggable') {
|
9106 | return false;
|
9107 | }
|
9108 |
|
9109 |
|
9110 | if (key === 'form') {
|
9111 | return false;
|
9112 | }
|
9113 |
|
9114 | if (key === 'list' && el.tagName === 'INPUT') {
|
9115 | return false;
|
9116 | }
|
9117 |
|
9118 | if (key === 'type' && el.tagName === 'TEXTAREA') {
|
9119 | return false;
|
9120 | }
|
9121 |
|
9122 | if (nativeOnRE.test(key) && isString(value)) {
|
9123 | return false;
|
9124 | }
|
9125 | return key in el;
|
9126 | }
|
9127 |
|
9128 | function useCssModule(name = '$style') {
|
9129 |
|
9130 | {
|
9131 | {
|
9132 | warn(`useCssModule() is not supported in the global build.`);
|
9133 | }
|
9134 | return EMPTY_OBJ;
|
9135 | }
|
9136 | }
|
9137 |
|
9138 | |
9139 |
|
9140 |
|
9141 |
|
9142 | function useCssVars(getter) {
|
9143 | const instance = getCurrentInstance();
|
9144 |
|
9145 | if (!instance) {
|
9146 | warn(`useCssVars is called without current active component instance.`);
|
9147 | return;
|
9148 | }
|
9149 | const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy));
|
9150 | onMounted(() => watchEffect(setVars, { flush: 'post' }));
|
9151 | onUpdated(setVars);
|
9152 | }
|
9153 | function setVarsOnVNode(vnode, vars) {
|
9154 | if (vnode.shapeFlag & 128 ) {
|
9155 | const suspense = vnode.suspense;
|
9156 | vnode = suspense.activeBranch;
|
9157 | if (suspense.pendingBranch && !suspense.isHydrating) {
|
9158 | suspense.effects.push(() => {
|
9159 | setVarsOnVNode(suspense.activeBranch, vars);
|
9160 | });
|
9161 | }
|
9162 | }
|
9163 |
|
9164 | while (vnode.component) {
|
9165 | vnode = vnode.component.subTree;
|
9166 | }
|
9167 | if (vnode.shapeFlag & 1 && vnode.el) {
|
9168 | const style = vnode.el.style;
|
9169 | for (const key in vars) {
|
9170 | style.setProperty(`--${key}`, vars[key]);
|
9171 | }
|
9172 | }
|
9173 | else if (vnode.type === Fragment) {
|
9174 | vnode.children.forEach(c => setVarsOnVNode(c, vars));
|
9175 | }
|
9176 | }
|
9177 |
|
9178 | const TRANSITION = 'transition';
|
9179 | const ANIMATION = 'animation';
|
9180 |
|
9181 |
|
9182 | const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
|
9183 | Transition.displayName = 'Transition';
|
9184 | const DOMTransitionPropsValidators = {
|
9185 | name: String,
|
9186 | type: String,
|
9187 | css: {
|
9188 | type: Boolean,
|
9189 | default: true
|
9190 | },
|
9191 | duration: [String, Number, Object],
|
9192 | enterFromClass: String,
|
9193 | enterActiveClass: String,
|
9194 | enterToClass: String,
|
9195 | appearFromClass: String,
|
9196 | appearActiveClass: String,
|
9197 | appearToClass: String,
|
9198 | leaveFromClass: String,
|
9199 | leaveActiveClass: String,
|
9200 | leaveToClass: String
|
9201 | };
|
9202 | const TransitionPropsValidators = (Transition.props = extend({}, BaseTransition.props, DOMTransitionPropsValidators));
|
9203 | |
9204 |
|
9205 |
|
9206 |
|
9207 | const callHook$1 = (hook, args = []) => {
|
9208 | if (isArray(hook)) {
|
9209 | hook.forEach(h => h(...args));
|
9210 | }
|
9211 | else if (hook) {
|
9212 | hook(...args);
|
9213 | }
|
9214 | };
|
9215 | |
9216 |
|
9217 |
|
9218 |
|
9219 | const hasExplicitCallback = (hook) => {
|
9220 | return hook
|
9221 | ? isArray(hook)
|
9222 | ? hook.some(h => h.length > 1)
|
9223 | : hook.length > 1
|
9224 | : false;
|
9225 | };
|
9226 | function resolveTransitionProps(rawProps) {
|
9227 | const baseProps = {};
|
9228 | for (const key in rawProps) {
|
9229 | if (!(key in DOMTransitionPropsValidators)) {
|
9230 | baseProps[key] = rawProps[key];
|
9231 | }
|
9232 | }
|
9233 | if (rawProps.css === false) {
|
9234 | return baseProps;
|
9235 | }
|
9236 | const { name = 'v', type, duration, enterFromClass = `${name}-enter-from`, enterActiveClass = `${name}-enter-active`, enterToClass = `${name}-enter-to`, appearFromClass = enterFromClass, appearActiveClass = enterActiveClass, appearToClass = enterToClass, leaveFromClass = `${name}-leave-from`, leaveActiveClass = `${name}-leave-active`, leaveToClass = `${name}-leave-to` } = rawProps;
|
9237 | const durations = normalizeDuration(duration);
|
9238 | const enterDuration = durations && durations[0];
|
9239 | const leaveDuration = durations && durations[1];
|
9240 | const { onBeforeEnter, onEnter, onEnterCancelled, onLeave, onLeaveCancelled, onBeforeAppear = onBeforeEnter, onAppear = onEnter, onAppearCancelled = onEnterCancelled } = baseProps;
|
9241 | const finishEnter = (el, isAppear, done) => {
|
9242 | removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
9243 | removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
9244 | done && done();
|
9245 | };
|
9246 | const finishLeave = (el, done) => {
|
9247 | removeTransitionClass(el, leaveToClass);
|
9248 | removeTransitionClass(el, leaveActiveClass);
|
9249 | done && done();
|
9250 | };
|
9251 | const makeEnterHook = (isAppear) => {
|
9252 | return (el, done) => {
|
9253 | const hook = isAppear ? onAppear : onEnter;
|
9254 | const resolve = () => finishEnter(el, isAppear, done);
|
9255 | callHook$1(hook, [el, resolve]);
|
9256 | nextFrame(() => {
|
9257 | removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
9258 | addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
9259 | if (!hasExplicitCallback(hook)) {
|
9260 | whenTransitionEnds(el, type, enterDuration, resolve);
|
9261 | }
|
9262 | });
|
9263 | };
|
9264 | };
|
9265 | return extend(baseProps, {
|
9266 | onBeforeEnter(el) {
|
9267 | callHook$1(onBeforeEnter, [el]);
|
9268 | addTransitionClass(el, enterFromClass);
|
9269 | addTransitionClass(el, enterActiveClass);
|
9270 | },
|
9271 | onBeforeAppear(el) {
|
9272 | callHook$1(onBeforeAppear, [el]);
|
9273 | addTransitionClass(el, appearFromClass);
|
9274 | addTransitionClass(el, appearActiveClass);
|
9275 | },
|
9276 | onEnter: makeEnterHook(false),
|
9277 | onAppear: makeEnterHook(true),
|
9278 | onLeave(el, done) {
|
9279 | const resolve = () => finishLeave(el, done);
|
9280 | addTransitionClass(el, leaveFromClass);
|
9281 |
|
9282 | forceReflow();
|
9283 | addTransitionClass(el, leaveActiveClass);
|
9284 | nextFrame(() => {
|
9285 | removeTransitionClass(el, leaveFromClass);
|
9286 | addTransitionClass(el, leaveToClass);
|
9287 | if (!hasExplicitCallback(onLeave)) {
|
9288 | whenTransitionEnds(el, type, leaveDuration, resolve);
|
9289 | }
|
9290 | });
|
9291 | callHook$1(onLeave, [el, resolve]);
|
9292 | },
|
9293 | onEnterCancelled(el) {
|
9294 | finishEnter(el, false);
|
9295 | callHook$1(onEnterCancelled, [el]);
|
9296 | },
|
9297 | onAppearCancelled(el) {
|
9298 | finishEnter(el, true);
|
9299 | callHook$1(onAppearCancelled, [el]);
|
9300 | },
|
9301 | onLeaveCancelled(el) {
|
9302 | finishLeave(el);
|
9303 | callHook$1(onLeaveCancelled, [el]);
|
9304 | }
|
9305 | });
|
9306 | }
|
9307 | function normalizeDuration(duration) {
|
9308 | if (duration == null) {
|
9309 | return null;
|
9310 | }
|
9311 | else if (isObject(duration)) {
|
9312 | return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
9313 | }
|
9314 | else {
|
9315 | const n = NumberOf(duration);
|
9316 | return [n, n];
|
9317 | }
|
9318 | }
|
9319 | function NumberOf(val) {
|
9320 | const res = toNumber(val);
|
9321 | validateDuration(res);
|
9322 | return res;
|
9323 | }
|
9324 | function validateDuration(val) {
|
9325 | if (typeof val !== 'number') {
|
9326 | warn(`<transition> explicit duration is not a valid number - ` +
|
9327 | `got ${JSON.stringify(val)}.`);
|
9328 | }
|
9329 | else if (isNaN(val)) {
|
9330 | warn(`<transition> explicit duration is NaN - ` +
|
9331 | 'the duration expression might be incorrect.');
|
9332 | }
|
9333 | }
|
9334 | function addTransitionClass(el, cls) {
|
9335 | cls.split(/\s+/).forEach(c => c && el.classList.add(c));
|
9336 | (el._vtc ||
|
9337 | (el._vtc = new Set())).add(cls);
|
9338 | }
|
9339 | function removeTransitionClass(el, cls) {
|
9340 | cls.split(/\s+/).forEach(c => c && el.classList.remove(c));
|
9341 | const { _vtc } = el;
|
9342 | if (_vtc) {
|
9343 | _vtc.delete(cls);
|
9344 | if (!_vtc.size) {
|
9345 | el._vtc = undefined;
|
9346 | }
|
9347 | }
|
9348 | }
|
9349 | function nextFrame(cb) {
|
9350 | requestAnimationFrame(() => {
|
9351 | requestAnimationFrame(cb);
|
9352 | });
|
9353 | }
|
9354 | let endId = 0;
|
9355 | function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
|
9356 | const id = (el._endId = ++endId);
|
9357 | const resolveIfNotStale = () => {
|
9358 | if (id === el._endId) {
|
9359 | resolve();
|
9360 | }
|
9361 | };
|
9362 | if (explicitTimeout) {
|
9363 | return setTimeout(resolveIfNotStale, explicitTimeout);
|
9364 | }
|
9365 | const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
|
9366 | if (!type) {
|
9367 | return resolve();
|
9368 | }
|
9369 | const endEvent = type + 'end';
|
9370 | let ended = 0;
|
9371 | const end = () => {
|
9372 | el.removeEventListener(endEvent, onEnd);
|
9373 | resolveIfNotStale();
|
9374 | };
|
9375 | const onEnd = (e) => {
|
9376 | if (e.target === el && ++ended >= propCount) {
|
9377 | end();
|
9378 | }
|
9379 | };
|
9380 | setTimeout(() => {
|
9381 | if (ended < propCount) {
|
9382 | end();
|
9383 | }
|
9384 | }, timeout + 1);
|
9385 | el.addEventListener(endEvent, onEnd);
|
9386 | }
|
9387 | function getTransitionInfo(el, expectedType) {
|
9388 | const styles = window.getComputedStyle(el);
|
9389 |
|
9390 | const getStyleProperties = (key) => (styles[key] || '').split(', ');
|
9391 | const transitionDelays = getStyleProperties(TRANSITION + 'Delay');
|
9392 | const transitionDurations = getStyleProperties(TRANSITION + 'Duration');
|
9393 | const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
9394 | const animationDelays = getStyleProperties(ANIMATION + 'Delay');
|
9395 | const animationDurations = getStyleProperties(ANIMATION + 'Duration');
|
9396 | const animationTimeout = getTimeout(animationDelays, animationDurations);
|
9397 | let type = null;
|
9398 | let timeout = 0;
|
9399 | let propCount = 0;
|
9400 |
|
9401 | if (expectedType === TRANSITION) {
|
9402 | if (transitionTimeout > 0) {
|
9403 | type = TRANSITION;
|
9404 | timeout = transitionTimeout;
|
9405 | propCount = transitionDurations.length;
|
9406 | }
|
9407 | }
|
9408 | else if (expectedType === ANIMATION) {
|
9409 | if (animationTimeout > 0) {
|
9410 | type = ANIMATION;
|
9411 | timeout = animationTimeout;
|
9412 | propCount = animationDurations.length;
|
9413 | }
|
9414 | }
|
9415 | else {
|
9416 | timeout = Math.max(transitionTimeout, animationTimeout);
|
9417 | type =
|
9418 | timeout > 0
|
9419 | ? transitionTimeout > animationTimeout
|
9420 | ? TRANSITION
|
9421 | : ANIMATION
|
9422 | : null;
|
9423 | propCount = type
|
9424 | ? type === TRANSITION
|
9425 | ? transitionDurations.length
|
9426 | : animationDurations.length
|
9427 | : 0;
|
9428 | }
|
9429 | const hasTransform = type === TRANSITION &&
|
9430 | /\b(transform|all)(,|$)/.test(styles[TRANSITION + 'Property']);
|
9431 | return {
|
9432 | type,
|
9433 | timeout,
|
9434 | propCount,
|
9435 | hasTransform
|
9436 | };
|
9437 | }
|
9438 | function getTimeout(delays, durations) {
|
9439 | while (delays.length < durations.length) {
|
9440 | delays = delays.concat(delays);
|
9441 | }
|
9442 | return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
9443 | }
|
9444 |
|
9445 |
|
9446 |
|
9447 |
|
9448 | function toMs(s) {
|
9449 | return Number(s.slice(0, -1).replace(',', '.')) * 1000;
|
9450 | }
|
9451 |
|
9452 | function forceReflow() {
|
9453 | return document.body.offsetHeight;
|
9454 | }
|
9455 |
|
9456 | const positionMap = new WeakMap();
|
9457 | const newPositionMap = new WeakMap();
|
9458 | const TransitionGroupImpl = {
|
9459 | name: 'TransitionGroup',
|
9460 | props: extend({}, TransitionPropsValidators, {
|
9461 | tag: String,
|
9462 | moveClass: String
|
9463 | }),
|
9464 | setup(props, { slots }) {
|
9465 | const instance = getCurrentInstance();
|
9466 | const state = useTransitionState();
|
9467 | let prevChildren;
|
9468 | let children;
|
9469 | onUpdated(() => {
|
9470 |
|
9471 | if (!prevChildren.length) {
|
9472 | return;
|
9473 | }
|
9474 | const moveClass = props.moveClass || `${props.name || 'v'}-move`;
|
9475 | if (!hasCSSTransform(prevChildren[0].el, instance.vnode.el, moveClass)) {
|
9476 | return;
|
9477 | }
|
9478 |
|
9479 |
|
9480 | prevChildren.forEach(callPendingCbs);
|
9481 | prevChildren.forEach(recordPosition);
|
9482 | const movedChildren = prevChildren.filter(applyTranslation);
|
9483 |
|
9484 | forceReflow();
|
9485 | movedChildren.forEach(c => {
|
9486 | const el = c.el;
|
9487 | const style = el.style;
|
9488 | addTransitionClass(el, moveClass);
|
9489 | style.transform = style.webkitTransform = style.transitionDuration = '';
|
9490 | const cb = (el._moveCb = (e) => {
|
9491 | if (e && e.target !== el) {
|
9492 | return;
|
9493 | }
|
9494 | if (!e || /transform$/.test(e.propertyName)) {
|
9495 | el.removeEventListener('transitionend', cb);
|
9496 | el._moveCb = null;
|
9497 | removeTransitionClass(el, moveClass);
|
9498 | }
|
9499 | });
|
9500 | el.addEventListener('transitionend', cb);
|
9501 | });
|
9502 | });
|
9503 | return () => {
|
9504 | const rawProps = toRaw(props);
|
9505 | const cssTransitionProps = resolveTransitionProps(rawProps);
|
9506 | let tag = rawProps.tag || Fragment;
|
9507 | prevChildren = children;
|
9508 | children = slots.default ? getTransitionRawChildren(slots.default()) : [];
|
9509 | for (let i = 0; i < children.length; i++) {
|
9510 | const child = children[i];
|
9511 | if (child.key != null) {
|
9512 | setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
9513 | }
|
9514 | else {
|
9515 | warn(`<TransitionGroup> children must be keyed.`);
|
9516 | }
|
9517 | }
|
9518 | if (prevChildren) {
|
9519 | for (let i = 0; i < prevChildren.length; i++) {
|
9520 | const child = prevChildren[i];
|
9521 | setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
9522 | positionMap.set(child, child.el.getBoundingClientRect());
|
9523 | }
|
9524 | }
|
9525 | return createVNode(tag, null, children);
|
9526 | };
|
9527 | }
|
9528 | };
|
9529 | const TransitionGroup = TransitionGroupImpl;
|
9530 | function callPendingCbs(c) {
|
9531 | const el = c.el;
|
9532 | if (el._moveCb) {
|
9533 | el._moveCb();
|
9534 | }
|
9535 | if (el._enterCb) {
|
9536 | el._enterCb();
|
9537 | }
|
9538 | }
|
9539 | function recordPosition(c) {
|
9540 | newPositionMap.set(c, c.el.getBoundingClientRect());
|
9541 | }
|
9542 | function applyTranslation(c) {
|
9543 | const oldPos = positionMap.get(c);
|
9544 | const newPos = newPositionMap.get(c);
|
9545 | const dx = oldPos.left - newPos.left;
|
9546 | const dy = oldPos.top - newPos.top;
|
9547 | if (dx || dy) {
|
9548 | const s = c.el.style;
|
9549 | s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
|
9550 | s.transitionDuration = '0s';
|
9551 | return c;
|
9552 | }
|
9553 | }
|
9554 | function hasCSSTransform(el, root, moveClass) {
|
9555 |
|
9556 |
|
9557 |
|
9558 |
|
9559 |
|
9560 | const clone = el.cloneNode();
|
9561 | if (el._vtc) {
|
9562 | el._vtc.forEach(cls => {
|
9563 | cls.split(/\s+/).forEach(c => c && clone.classList.remove(c));
|
9564 | });
|
9565 | }
|
9566 | moveClass.split(/\s+/).forEach(c => c && clone.classList.add(c));
|
9567 | clone.style.display = 'none';
|
9568 | const container = (root.nodeType === 1
|
9569 | ? root
|
9570 | : root.parentNode);
|
9571 | container.appendChild(clone);
|
9572 | const { hasTransform } = getTransitionInfo(clone);
|
9573 | container.removeChild(clone);
|
9574 | return hasTransform;
|
9575 | }
|
9576 |
|
9577 | const getModelAssigner = (vnode) => {
|
9578 | const fn = vnode.props['onUpdate:modelValue'];
|
9579 | return isArray(fn) ? value => invokeArrayFns(fn, value) : fn;
|
9580 | };
|
9581 | function onCompositionStart(e) {
|
9582 | e.target.composing = true;
|
9583 | }
|
9584 | function onCompositionEnd(e) {
|
9585 | const target = e.target;
|
9586 | if (target.composing) {
|
9587 | target.composing = false;
|
9588 | trigger$1(target, 'input');
|
9589 | }
|
9590 | }
|
9591 | function trigger$1(el, type) {
|
9592 | const e = document.createEvent('HTMLEvents');
|
9593 | e.initEvent(type, true, true);
|
9594 | el.dispatchEvent(e);
|
9595 | }
|
9596 |
|
9597 |
|
9598 | const vModelText = {
|
9599 | created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
9600 | el._assign = getModelAssigner(vnode);
|
9601 | const castToNumber = number || el.type === 'number';
|
9602 | addEventListener(el, lazy ? 'change' : 'input', e => {
|
9603 | if (e.target.composing)
|
9604 | return;
|
9605 | let domValue = el.value;
|
9606 | if (trim) {
|
9607 | domValue = domValue.trim();
|
9608 | }
|
9609 | else if (castToNumber) {
|
9610 | domValue = toNumber(domValue);
|
9611 | }
|
9612 | el._assign(domValue);
|
9613 | });
|
9614 | if (trim) {
|
9615 | addEventListener(el, 'change', () => {
|
9616 | el.value = el.value.trim();
|
9617 | });
|
9618 | }
|
9619 | if (!lazy) {
|
9620 | addEventListener(el, 'compositionstart', onCompositionStart);
|
9621 | addEventListener(el, 'compositionend', onCompositionEnd);
|
9622 |
|
9623 |
|
9624 |
|
9625 |
|
9626 | addEventListener(el, 'change', onCompositionEnd);
|
9627 | }
|
9628 | },
|
9629 |
|
9630 | mounted(el, { value }) {
|
9631 | el.value = value == null ? '' : value;
|
9632 | },
|
9633 | beforeUpdate(el, { value, modifiers: { trim, number } }, vnode) {
|
9634 | el._assign = getModelAssigner(vnode);
|
9635 |
|
9636 | if (el.composing)
|
9637 | return;
|
9638 | if (document.activeElement === el) {
|
9639 | if (trim && el.value.trim() === value) {
|
9640 | return;
|
9641 | }
|
9642 | if ((number || el.type === 'number') && toNumber(el.value) === value) {
|
9643 | return;
|
9644 | }
|
9645 | }
|
9646 | const newValue = value == null ? '' : value;
|
9647 | if (el.value !== newValue) {
|
9648 | el.value = newValue;
|
9649 | }
|
9650 | }
|
9651 | };
|
9652 | const vModelCheckbox = {
|
9653 | created(el, _, vnode) {
|
9654 | el._assign = getModelAssigner(vnode);
|
9655 | addEventListener(el, 'change', () => {
|
9656 | const modelValue = el._modelValue;
|
9657 | const elementValue = getValue(el);
|
9658 | const checked = el.checked;
|
9659 | const assign = el._assign;
|
9660 | if (isArray(modelValue)) {
|
9661 | const index = looseIndexOf(modelValue, elementValue);
|
9662 | const found = index !== -1;
|
9663 | if (checked && !found) {
|
9664 | assign(modelValue.concat(elementValue));
|
9665 | }
|
9666 | else if (!checked && found) {
|
9667 | const filtered = [...modelValue];
|
9668 | filtered.splice(index, 1);
|
9669 | assign(filtered);
|
9670 | }
|
9671 | }
|
9672 | else if (isSet(modelValue)) {
|
9673 | const cloned = new Set(modelValue);
|
9674 | if (checked) {
|
9675 | cloned.add(elementValue);
|
9676 | }
|
9677 | else {
|
9678 | cloned.delete(elementValue);
|
9679 | }
|
9680 | assign(cloned);
|
9681 | }
|
9682 | else {
|
9683 | assign(getCheckboxValue(el, checked));
|
9684 | }
|
9685 | });
|
9686 | },
|
9687 |
|
9688 | mounted: setChecked,
|
9689 | beforeUpdate(el, binding, vnode) {
|
9690 | el._assign = getModelAssigner(vnode);
|
9691 | setChecked(el, binding, vnode);
|
9692 | }
|
9693 | };
|
9694 | function setChecked(el, { value, oldValue }, vnode) {
|
9695 | el._modelValue = value;
|
9696 | if (isArray(value)) {
|
9697 | el.checked = looseIndexOf(value, vnode.props.value) > -1;
|
9698 | }
|
9699 | else if (isSet(value)) {
|
9700 | el.checked = value.has(vnode.props.value);
|
9701 | }
|
9702 | else if (value !== oldValue) {
|
9703 | el.checked = looseEqual(value, getCheckboxValue(el, true));
|
9704 | }
|
9705 | }
|
9706 | const vModelRadio = {
|
9707 | created(el, { value }, vnode) {
|
9708 | el.checked = looseEqual(value, vnode.props.value);
|
9709 | el._assign = getModelAssigner(vnode);
|
9710 | addEventListener(el, 'change', () => {
|
9711 | el._assign(getValue(el));
|
9712 | });
|
9713 | },
|
9714 | beforeUpdate(el, { value, oldValue }, vnode) {
|
9715 | el._assign = getModelAssigner(vnode);
|
9716 | if (value !== oldValue) {
|
9717 | el.checked = looseEqual(value, vnode.props.value);
|
9718 | }
|
9719 | }
|
9720 | };
|
9721 | const vModelSelect = {
|
9722 | created(el, { value, modifiers: { number } }, vnode) {
|
9723 | const isSetModel = isSet(value);
|
9724 | addEventListener(el, 'change', () => {
|
9725 | const selectedVal = Array.prototype.filter
|
9726 | .call(el.options, (o) => o.selected)
|
9727 | .map((o) => number ? toNumber(getValue(o)) : getValue(o));
|
9728 | el._assign(el.multiple
|
9729 | ? isSetModel
|
9730 | ? new Set(selectedVal)
|
9731 | : selectedVal
|
9732 | : selectedVal[0]);
|
9733 | });
|
9734 | el._assign = getModelAssigner(vnode);
|
9735 | },
|
9736 |
|
9737 |
|
9738 | mounted(el, { value }) {
|
9739 | setSelected(el, value);
|
9740 | },
|
9741 | beforeUpdate(el, _binding, vnode) {
|
9742 | el._assign = getModelAssigner(vnode);
|
9743 | },
|
9744 | updated(el, { value }) {
|
9745 | setSelected(el, value);
|
9746 | }
|
9747 | };
|
9748 | function setSelected(el, value) {
|
9749 | const isMultiple = el.multiple;
|
9750 | if (isMultiple && !isArray(value) && !isSet(value)) {
|
9751 | warn(`<select multiple v-model> expects an Array or Set value for its binding, ` +
|
9752 | `but got ${Object.prototype.toString.call(value).slice(8, -1)}.`);
|
9753 | return;
|
9754 | }
|
9755 | for (let i = 0, l = el.options.length; i < l; i++) {
|
9756 | const option = el.options[i];
|
9757 | const optionValue = getValue(option);
|
9758 | if (isMultiple) {
|
9759 | if (isArray(value)) {
|
9760 | option.selected = looseIndexOf(value, optionValue) > -1;
|
9761 | }
|
9762 | else {
|
9763 | option.selected = value.has(optionValue);
|
9764 | }
|
9765 | }
|
9766 | else {
|
9767 | if (looseEqual(getValue(option), value)) {
|
9768 | if (el.selectedIndex !== i)
|
9769 | el.selectedIndex = i;
|
9770 | return;
|
9771 | }
|
9772 | }
|
9773 | }
|
9774 | if (!isMultiple && el.selectedIndex !== -1) {
|
9775 | el.selectedIndex = -1;
|
9776 | }
|
9777 | }
|
9778 |
|
9779 | function getValue(el) {
|
9780 | return '_value' in el ? el._value : el.value;
|
9781 | }
|
9782 |
|
9783 | function getCheckboxValue(el, checked) {
|
9784 | const key = checked ? '_trueValue' : '_falseValue';
|
9785 | return key in el ? el[key] : checked;
|
9786 | }
|
9787 | const vModelDynamic = {
|
9788 | created(el, binding, vnode) {
|
9789 | callModelHook(el, binding, vnode, null, 'created');
|
9790 | },
|
9791 | mounted(el, binding, vnode) {
|
9792 | callModelHook(el, binding, vnode, null, 'mounted');
|
9793 | },
|
9794 | beforeUpdate(el, binding, vnode, prevVNode) {
|
9795 | callModelHook(el, binding, vnode, prevVNode, 'beforeUpdate');
|
9796 | },
|
9797 | updated(el, binding, vnode, prevVNode) {
|
9798 | callModelHook(el, binding, vnode, prevVNode, 'updated');
|
9799 | }
|
9800 | };
|
9801 | function callModelHook(el, binding, vnode, prevVNode, hook) {
|
9802 | let modelToUse;
|
9803 | switch (el.tagName) {
|
9804 | case 'SELECT':
|
9805 | modelToUse = vModelSelect;
|
9806 | break;
|
9807 | case 'TEXTAREA':
|
9808 | modelToUse = vModelText;
|
9809 | break;
|
9810 | default:
|
9811 | switch (vnode.props && vnode.props.type) {
|
9812 | case 'checkbox':
|
9813 | modelToUse = vModelCheckbox;
|
9814 | break;
|
9815 | case 'radio':
|
9816 | modelToUse = vModelRadio;
|
9817 | break;
|
9818 | default:
|
9819 | modelToUse = vModelText;
|
9820 | }
|
9821 | }
|
9822 | const fn = modelToUse[hook];
|
9823 | fn && fn(el, binding, vnode, prevVNode);
|
9824 | }
|
9825 |
|
9826 | const systemModifiers = ['ctrl', 'shift', 'alt', 'meta'];
|
9827 | const modifierGuards = {
|
9828 | stop: e => e.stopPropagation(),
|
9829 | prevent: e => e.preventDefault(),
|
9830 | self: e => e.target !== e.currentTarget,
|
9831 | ctrl: e => !e.ctrlKey,
|
9832 | shift: e => !e.shiftKey,
|
9833 | alt: e => !e.altKey,
|
9834 | meta: e => !e.metaKey,
|
9835 | left: e => 'button' in e && e.button !== 0,
|
9836 | middle: e => 'button' in e && e.button !== 1,
|
9837 | right: e => 'button' in e && e.button !== 2,
|
9838 | exact: (e, modifiers) => systemModifiers.some(m => e[`${m}Key`] && !modifiers.includes(m))
|
9839 | };
|
9840 | |
9841 |
|
9842 |
|
9843 | const withModifiers = (fn, modifiers) => {
|
9844 | return (event, ...args) => {
|
9845 | for (let i = 0; i < modifiers.length; i++) {
|
9846 | const guard = modifierGuards[modifiers[i]];
|
9847 | if (guard && guard(event, modifiers))
|
9848 | return;
|
9849 | }
|
9850 | return fn(event, ...args);
|
9851 | };
|
9852 | };
|
9853 |
|
9854 |
|
9855 | const keyNames = {
|
9856 | esc: 'escape',
|
9857 | space: ' ',
|
9858 | up: 'arrow-up',
|
9859 | left: 'arrow-left',
|
9860 | right: 'arrow-right',
|
9861 | down: 'arrow-down',
|
9862 | delete: 'backspace'
|
9863 | };
|
9864 | |
9865 |
|
9866 |
|
9867 | const withKeys = (fn, modifiers) => {
|
9868 | return (event) => {
|
9869 | if (!('key' in event)) {
|
9870 | return;
|
9871 | }
|
9872 | const eventKey = hyphenate(event.key);
|
9873 | if (modifiers.some(k => k === eventKey || keyNames[k] === eventKey)) {
|
9874 | return fn(event);
|
9875 | }
|
9876 | };
|
9877 | };
|
9878 |
|
9879 | const vShow = {
|
9880 | beforeMount(el, { value }, { transition }) {
|
9881 | el._vod = el.style.display === 'none' ? '' : el.style.display;
|
9882 | if (transition && value) {
|
9883 | transition.beforeEnter(el);
|
9884 | }
|
9885 | else {
|
9886 | setDisplay(el, value);
|
9887 | }
|
9888 | },
|
9889 | mounted(el, { value }, { transition }) {
|
9890 | if (transition && value) {
|
9891 | transition.enter(el);
|
9892 | }
|
9893 | },
|
9894 | updated(el, { value, oldValue }, { transition }) {
|
9895 | if (!value === !oldValue)
|
9896 | return;
|
9897 | if (transition) {
|
9898 | if (value) {
|
9899 | transition.beforeEnter(el);
|
9900 | setDisplay(el, true);
|
9901 | transition.enter(el);
|
9902 | }
|
9903 | else {
|
9904 | transition.leave(el, () => {
|
9905 | setDisplay(el, false);
|
9906 | });
|
9907 | }
|
9908 | }
|
9909 | else {
|
9910 | setDisplay(el, value);
|
9911 | }
|
9912 | },
|
9913 | beforeUnmount(el, { value }) {
|
9914 | setDisplay(el, value);
|
9915 | }
|
9916 | };
|
9917 | function setDisplay(el, value) {
|
9918 | el.style.display = value ? el._vod : 'none';
|
9919 | }
|
9920 |
|
9921 | const rendererOptions = extend({ patchProp, forcePatchProp }, nodeOps);
|
9922 |
|
9923 |
|
9924 | let renderer;
|
9925 | let enabledHydration = false;
|
9926 | function ensureRenderer() {
|
9927 | return renderer || (renderer = createRenderer(rendererOptions));
|
9928 | }
|
9929 | function ensureHydrationRenderer() {
|
9930 | renderer = enabledHydration
|
9931 | ? renderer
|
9932 | : createHydrationRenderer(rendererOptions);
|
9933 | enabledHydration = true;
|
9934 | return renderer;
|
9935 | }
|
9936 |
|
9937 | const render = ((...args) => {
|
9938 | ensureRenderer().render(...args);
|
9939 | });
|
9940 | const hydrate = ((...args) => {
|
9941 | ensureHydrationRenderer().hydrate(...args);
|
9942 | });
|
9943 | const createApp = ((...args) => {
|
9944 | const app = ensureRenderer().createApp(...args);
|
9945 | {
|
9946 | injectNativeTagCheck(app);
|
9947 | injectCompilerOptionsCheck(app);
|
9948 | }
|
9949 | const { mount } = app;
|
9950 | app.mount = (containerOrSelector) => {
|
9951 | const container = normalizeContainer(containerOrSelector);
|
9952 | if (!container)
|
9953 | return;
|
9954 | const component = app._component;
|
9955 | if (!isFunction(component) && !component.render && !component.template) {
|
9956 |
|
9957 |
|
9958 |
|
9959 |
|
9960 | component.template = container.innerHTML;
|
9961 | }
|
9962 |
|
9963 | container.innerHTML = '';
|
9964 | const proxy = mount(container, false, container instanceof SVGElement);
|
9965 | if (container instanceof Element) {
|
9966 | container.removeAttribute('v-cloak');
|
9967 | container.setAttribute('data-v-app', '');
|
9968 | }
|
9969 | return proxy;
|
9970 | };
|
9971 | return app;
|
9972 | });
|
9973 | const createSSRApp = ((...args) => {
|
9974 | const app = ensureHydrationRenderer().createApp(...args);
|
9975 | {
|
9976 | injectNativeTagCheck(app);
|
9977 | injectCompilerOptionsCheck(app);
|
9978 | }
|
9979 | const { mount } = app;
|
9980 | app.mount = (containerOrSelector) => {
|
9981 | const container = normalizeContainer(containerOrSelector);
|
9982 | if (container) {
|
9983 | return mount(container, true, container instanceof SVGElement);
|
9984 | }
|
9985 | };
|
9986 | return app;
|
9987 | });
|
9988 | function injectNativeTagCheck(app) {
|
9989 |
|
9990 |
|
9991 | Object.defineProperty(app.config, 'isNativeTag', {
|
9992 | value: (tag) => isHTMLTag(tag) || isSVGTag(tag),
|
9993 | writable: false
|
9994 | });
|
9995 | }
|
9996 |
|
9997 | function injectCompilerOptionsCheck(app) {
|
9998 | if (isRuntimeOnly()) {
|
9999 | const isCustomElement = app.config.isCustomElement;
|
10000 | Object.defineProperty(app.config, 'isCustomElement', {
|
10001 | get() {
|
10002 | return isCustomElement;
|
10003 | },
|
10004 | set() {
|
10005 | warn(`The \`isCustomElement\` config option is deprecated. Use ` +
|
10006 | `\`compilerOptions.isCustomElement\` instead.`);
|
10007 | }
|
10008 | });
|
10009 | const compilerOptions = app.config.compilerOptions;
|
10010 | const msg = `The \`compilerOptions\` config option is only respected when using ` +
|
10011 | `a build of Vue.js that includes the runtime compiler (aka "full build"). ` +
|
10012 | `Since you are using the runtime-only build, \`compilerOptions\` ` +
|
10013 | `must be passed to \`@vue/compiler-dom\` in the build setup instead.\n` +
|
10014 | `- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.\n` +
|
10015 | `- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader\n` +
|
10016 | `- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-dom`;
|
10017 | Object.defineProperty(app.config, 'compilerOptions', {
|
10018 | get() {
|
10019 | warn(msg);
|
10020 | return compilerOptions;
|
10021 | },
|
10022 | set() {
|
10023 | warn(msg);
|
10024 | }
|
10025 | });
|
10026 | }
|
10027 | }
|
10028 | function normalizeContainer(container) {
|
10029 | if (isString(container)) {
|
10030 | const res = document.querySelector(container);
|
10031 | if (!res) {
|
10032 | warn(`Failed to mount app: mount target selector "${container}" returned null.`);
|
10033 | }
|
10034 | return res;
|
10035 | }
|
10036 | if (container instanceof window.ShadowRoot &&
|
10037 | container.mode === 'closed') {
|
10038 | warn(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
|
10039 | }
|
10040 | return container;
|
10041 | }
|
10042 |
|
10043 | function initDev() {
|
10044 | {
|
10045 | {
|
10046 | console.info(`You are running a development build of Vue.\n` +
|
10047 | `Make sure to use the production build (*.prod.js) when deploying for production.`);
|
10048 | }
|
10049 | initCustomFormatter();
|
10050 | }
|
10051 | }
|
10052 |
|
10053 |
|
10054 | {
|
10055 | initDev();
|
10056 | }
|
10057 | const compile$1 = () => {
|
10058 | {
|
10059 | warn(`Runtime compilation is not supported in this build of Vue.` +
|
10060 | (` Use "vue.global.js" instead.`
|
10061 | ) );
|
10062 | }
|
10063 | };
|
10064 |
|
10065 | exports.BaseTransition = BaseTransition;
|
10066 | exports.Comment = Comment$1;
|
10067 | exports.Fragment = Fragment;
|
10068 | exports.KeepAlive = KeepAlive;
|
10069 | exports.Static = Static;
|
10070 | exports.Suspense = Suspense;
|
10071 | exports.Teleport = Teleport;
|
10072 | exports.Text = Text;
|
10073 | exports.Transition = Transition;
|
10074 | exports.TransitionGroup = TransitionGroup;
|
10075 | exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
|
10076 | exports.callWithErrorHandling = callWithErrorHandling;
|
10077 | exports.camelize = camelize;
|
10078 | exports.capitalize = capitalize;
|
10079 | exports.cloneVNode = cloneVNode;
|
10080 | exports.compatUtils = compatUtils;
|
10081 | exports.compile = compile$1;
|
10082 | exports.computed = computed$1;
|
10083 | exports.createApp = createApp;
|
10084 | exports.createBlock = createBlock;
|
10085 | exports.createCommentVNode = createCommentVNode;
|
10086 | exports.createHydrationRenderer = createHydrationRenderer;
|
10087 | exports.createRenderer = createRenderer;
|
10088 | exports.createSSRApp = createSSRApp;
|
10089 | exports.createSlots = createSlots;
|
10090 | exports.createStaticVNode = createStaticVNode;
|
10091 | exports.createTextVNode = createTextVNode;
|
10092 | exports.createVNode = createVNode;
|
10093 | exports.customRef = customRef;
|
10094 | exports.defineAsyncComponent = defineAsyncComponent;
|
10095 | exports.defineComponent = defineComponent;
|
10096 | exports.defineEmit = defineEmit;
|
10097 | exports.defineProps = defineProps;
|
10098 | exports.getCurrentInstance = getCurrentInstance;
|
10099 | exports.getTransitionRawChildren = getTransitionRawChildren;
|
10100 | exports.h = h;
|
10101 | exports.handleError = handleError;
|
10102 | exports.hydrate = hydrate;
|
10103 | exports.initCustomFormatter = initCustomFormatter;
|
10104 | exports.inject = inject;
|
10105 | exports.isProxy = isProxy;
|
10106 | exports.isReactive = isReactive;
|
10107 | exports.isReadonly = isReadonly;
|
10108 | exports.isRef = isRef;
|
10109 | exports.isRuntimeOnly = isRuntimeOnly;
|
10110 | exports.isVNode = isVNode;
|
10111 | exports.markRaw = markRaw;
|
10112 | exports.mergeProps = mergeProps;
|
10113 | exports.nextTick = nextTick;
|
10114 | exports.onActivated = onActivated;
|
10115 | exports.onBeforeMount = onBeforeMount;
|
10116 | exports.onBeforeUnmount = onBeforeUnmount;
|
10117 | exports.onBeforeUpdate = onBeforeUpdate;
|
10118 | exports.onDeactivated = onDeactivated;
|
10119 | exports.onErrorCaptured = onErrorCaptured;
|
10120 | exports.onMounted = onMounted;
|
10121 | exports.onRenderTracked = onRenderTracked;
|
10122 | exports.onRenderTriggered = onRenderTriggered;
|
10123 | exports.onServerPrefetch = onServerPrefetch;
|
10124 | exports.onUnmounted = onUnmounted;
|
10125 | exports.onUpdated = onUpdated;
|
10126 | exports.openBlock = openBlock;
|
10127 | exports.popScopeId = popScopeId;
|
10128 | exports.provide = provide;
|
10129 | exports.proxyRefs = proxyRefs;
|
10130 | exports.pushScopeId = pushScopeId;
|
10131 | exports.queuePostFlushCb = queuePostFlushCb;
|
10132 | exports.reactive = reactive;
|
10133 | exports.readonly = readonly;
|
10134 | exports.ref = ref;
|
10135 | exports.registerRuntimeCompiler = registerRuntimeCompiler;
|
10136 | exports.render = render;
|
10137 | exports.renderList = renderList;
|
10138 | exports.renderSlot = renderSlot;
|
10139 | exports.resolveComponent = resolveComponent;
|
10140 | exports.resolveDirective = resolveDirective;
|
10141 | exports.resolveDynamicComponent = resolveDynamicComponent;
|
10142 | exports.resolveFilter = resolveFilter;
|
10143 | exports.resolveTransitionHooks = resolveTransitionHooks;
|
10144 | exports.setBlockTracking = setBlockTracking;
|
10145 | exports.setDevtoolsHook = setDevtoolsHook;
|
10146 | exports.setTransitionHooks = setTransitionHooks;
|
10147 | exports.shallowReactive = shallowReactive;
|
10148 | exports.shallowReadonly = shallowReadonly;
|
10149 | exports.shallowRef = shallowRef;
|
10150 | exports.ssrContextKey = ssrContextKey;
|
10151 | exports.ssrUtils = ssrUtils;
|
10152 | exports.toDisplayString = toDisplayString;
|
10153 | exports.toHandlerKey = toHandlerKey;
|
10154 | exports.toHandlers = toHandlers;
|
10155 | exports.toRaw = toRaw;
|
10156 | exports.toRef = toRef;
|
10157 | exports.toRefs = toRefs;
|
10158 | exports.transformVNodeArgs = transformVNodeArgs;
|
10159 | exports.triggerRef = triggerRef;
|
10160 | exports.unref = unref;
|
10161 | exports.useContext = useContext;
|
10162 | exports.useCssModule = useCssModule;
|
10163 | exports.useCssVars = useCssVars;
|
10164 | exports.useSSRContext = useSSRContext;
|
10165 | exports.useTransitionState = useTransitionState;
|
10166 | exports.vModelCheckbox = vModelCheckbox;
|
10167 | exports.vModelDynamic = vModelDynamic;
|
10168 | exports.vModelRadio = vModelRadio;
|
10169 | exports.vModelSelect = vModelSelect;
|
10170 | exports.vModelText = vModelText;
|
10171 | exports.vShow = vShow;
|
10172 | exports.version = version;
|
10173 | exports.warn = warn;
|
10174 | exports.watch = watch;
|
10175 | exports.watchEffect = watchEffect;
|
10176 | exports.withCtx = withCtx;
|
10177 | exports.withDirectives = withDirectives;
|
10178 | exports.withKeys = withKeys;
|
10179 | exports.withModifiers = withModifiers;
|
10180 | exports.withScopeId = withScopeId;
|
10181 |
|
10182 | Object.defineProperty(exports, '__esModule', { value: true });
|
10183 |
|
10184 | return exports;
|
10185 |
|
10186 | }({}));
|