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