UNPKG

435 kBJavaScriptView Raw
1/*!
2 * Vue.js v2.7.16
3 * (c) 2014-2023 Evan You
4 * Released under the MIT License.
5 */
6(function (global, factory) {
7 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
8 typeof define === 'function' && define.amd ? define(factory) :
9 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Vue = factory());
10})(this, (function () { 'use strict';
11
12 var emptyObject = Object.freeze({});
13 var isArray = Array.isArray;
14 // These helpers produce better VM code in JS engines due to their
15 // explicitness and function inlining.
16 function isUndef(v) {
17 return v === undefined || v === null;
18 }
19 function isDef(v) {
20 return v !== undefined && v !== null;
21 }
22 function isTrue(v) {
23 return v === true;
24 }
25 function isFalse(v) {
26 return v === false;
27 }
28 /**
29 * Check if value is primitive.
30 */
31 function isPrimitive(value) {
32 return (typeof value === 'string' ||
33 typeof value === 'number' ||
34 // $flow-disable-line
35 typeof value === 'symbol' ||
36 typeof value === 'boolean');
37 }
38 function isFunction(value) {
39 return typeof value === 'function';
40 }
41 /**
42 * Quick object check - this is primarily used to tell
43 * objects from primitive values when we know the value
44 * is a JSON-compliant type.
45 */
46 function isObject(obj) {
47 return obj !== null && typeof obj === 'object';
48 }
49 /**
50 * Get the raw type string of a value, e.g., [object Object].
51 */
52 var _toString = Object.prototype.toString;
53 function toRawType(value) {
54 return _toString.call(value).slice(8, -1);
55 }
56 /**
57 * Strict object type check. Only returns true
58 * for plain JavaScript objects.
59 */
60 function isPlainObject(obj) {
61 return _toString.call(obj) === '[object Object]';
62 }
63 function isRegExp(v) {
64 return _toString.call(v) === '[object RegExp]';
65 }
66 /**
67 * Check if val is a valid array index.
68 */
69 function isValidArrayIndex(val) {
70 var n = parseFloat(String(val));
71 return n >= 0 && Math.floor(n) === n && isFinite(val);
72 }
73 function isPromise(val) {
74 return (isDef(val) &&
75 typeof val.then === 'function' &&
76 typeof val.catch === 'function');
77 }
78 /**
79 * Convert a value to a string that is actually rendered.
80 */
81 function toString(val) {
82 return val == null
83 ? ''
84 : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
85 ? JSON.stringify(val, replacer, 2)
86 : String(val);
87 }
88 function replacer(_key, val) {
89 // avoid circular deps from v3
90 if (val && val.__v_isRef) {
91 return val.value;
92 }
93 return val;
94 }
95 /**
96 * Convert an input value to a number for persistence.
97 * If the conversion fails, return original string.
98 */
99 function toNumber(val) {
100 var n = parseFloat(val);
101 return isNaN(n) ? val : n;
102 }
103 /**
104 * Make a map and return a function for checking if a key
105 * is in that map.
106 */
107 function makeMap(str, expectsLowerCase) {
108 var map = Object.create(null);
109 var list = str.split(',');
110 for (var i = 0; i < list.length; i++) {
111 map[list[i]] = true;
112 }
113 return expectsLowerCase ? function (val) { return map[val.toLowerCase()]; } : function (val) { return map[val]; };
114 }
115 /**
116 * Check if a tag is a built-in tag.
117 */
118 var isBuiltInTag = makeMap('slot,component', true);
119 /**
120 * Check if an attribute is a reserved attribute.
121 */
122 var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
123 /**
124 * Remove an item from an array.
125 */
126 function remove$2(arr, item) {
127 var len = arr.length;
128 if (len) {
129 // fast path for the only / last item
130 if (item === arr[len - 1]) {
131 arr.length = len - 1;
132 return;
133 }
134 var index = arr.indexOf(item);
135 if (index > -1) {
136 return arr.splice(index, 1);
137 }
138 }
139 }
140 /**
141 * Check whether an object has the property.
142 */
143 var hasOwnProperty = Object.prototype.hasOwnProperty;
144 function hasOwn(obj, key) {
145 return hasOwnProperty.call(obj, key);
146 }
147 /**
148 * Create a cached version of a pure function.
149 */
150 function cached(fn) {
151 var cache = Object.create(null);
152 return function cachedFn(str) {
153 var hit = cache[str];
154 return hit || (cache[str] = fn(str));
155 };
156 }
157 /**
158 * Camelize a hyphen-delimited string.
159 */
160 var camelizeRE = /-(\w)/g;
161 var camelize = cached(function (str) {
162 return str.replace(camelizeRE, function (_, c) { return (c ? c.toUpperCase() : ''); });
163 });
164 /**
165 * Capitalize a string.
166 */
167 var capitalize = cached(function (str) {
168 return str.charAt(0).toUpperCase() + str.slice(1);
169 });
170 /**
171 * Hyphenate a camelCase string.
172 */
173 var hyphenateRE = /\B([A-Z])/g;
174 var hyphenate = cached(function (str) {
175 return str.replace(hyphenateRE, '-$1').toLowerCase();
176 });
177 /**
178 * Simple bind polyfill for environments that do not support it,
179 * e.g., PhantomJS 1.x. Technically, we don't need this anymore
180 * since native bind is now performant enough in most browsers.
181 * But removing it would mean breaking code that was able to run in
182 * PhantomJS 1.x, so this must be kept for backward compatibility.
183 */
184 /* istanbul ignore next */
185 function polyfillBind(fn, ctx) {
186 function boundFn(a) {
187 var l = arguments.length;
188 return l
189 ? l > 1
190 ? fn.apply(ctx, arguments)
191 : fn.call(ctx, a)
192 : fn.call(ctx);
193 }
194 boundFn._length = fn.length;
195 return boundFn;
196 }
197 function nativeBind(fn, ctx) {
198 return fn.bind(ctx);
199 }
200 // @ts-expect-error bind cannot be `undefined`
201 var bind$1 = Function.prototype.bind ? nativeBind : polyfillBind;
202 /**
203 * Convert an Array-like object to a real Array.
204 */
205 function toArray(list, start) {
206 start = start || 0;
207 var i = list.length - start;
208 var ret = new Array(i);
209 while (i--) {
210 ret[i] = list[i + start];
211 }
212 return ret;
213 }
214 /**
215 * Mix properties into target object.
216 */
217 function extend(to, _from) {
218 for (var key in _from) {
219 to[key] = _from[key];
220 }
221 return to;
222 }
223 /**
224 * Merge an Array of Objects into a single Object.
225 */
226 function toObject(arr) {
227 var res = {};
228 for (var i = 0; i < arr.length; i++) {
229 if (arr[i]) {
230 extend(res, arr[i]);
231 }
232 }
233 return res;
234 }
235 /* eslint-disable no-unused-vars */
236 /**
237 * Perform no operation.
238 * Stubbing args to make Flow happy without leaving useless transpiled code
239 * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
240 */
241 function noop(a, b, c) { }
242 /**
243 * Always return false.
244 */
245 var no = function (a, b, c) { return false; };
246 /* eslint-enable no-unused-vars */
247 /**
248 * Return the same value.
249 */
250 var identity = function (_) { return _; };
251 /**
252 * Generate a string containing static keys from compiler modules.
253 */
254 function genStaticKeys$1(modules) {
255 return modules
256 .reduce(function (keys, m) { return keys.concat(m.staticKeys || []); }, [])
257 .join(',');
258 }
259 /**
260 * Check if two values are loosely equal - that is,
261 * if they are plain objects, do they have the same shape?
262 */
263 function looseEqual(a, b) {
264 if (a === b)
265 return true;
266 var isObjectA = isObject(a);
267 var isObjectB = isObject(b);
268 if (isObjectA && isObjectB) {
269 try {
270 var isArrayA = Array.isArray(a);
271 var isArrayB = Array.isArray(b);
272 if (isArrayA && isArrayB) {
273 return (a.length === b.length &&
274 a.every(function (e, i) {
275 return looseEqual(e, b[i]);
276 }));
277 }
278 else if (a instanceof Date && b instanceof Date) {
279 return a.getTime() === b.getTime();
280 }
281 else if (!isArrayA && !isArrayB) {
282 var keysA = Object.keys(a);
283 var keysB = Object.keys(b);
284 return (keysA.length === keysB.length &&
285 keysA.every(function (key) {
286 return looseEqual(a[key], b[key]);
287 }));
288 }
289 else {
290 /* istanbul ignore next */
291 return false;
292 }
293 }
294 catch (e) {
295 /* istanbul ignore next */
296 return false;
297 }
298 }
299 else if (!isObjectA && !isObjectB) {
300 return String(a) === String(b);
301 }
302 else {
303 return false;
304 }
305 }
306 /**
307 * Return the first index at which a loosely equal value can be
308 * found in the array (if value is a plain object, the array must
309 * contain an object of the same shape), or -1 if it is not present.
310 */
311 function looseIndexOf(arr, val) {
312 for (var i = 0; i < arr.length; i++) {
313 if (looseEqual(arr[i], val))
314 return i;
315 }
316 return -1;
317 }
318 /**
319 * Ensure a function is called only once.
320 */
321 function once(fn) {
322 var called = false;
323 return function () {
324 if (!called) {
325 called = true;
326 fn.apply(this, arguments);
327 }
328 };
329 }
330 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill
331 function hasChanged(x, y) {
332 if (x === y) {
333 return x === 0 && 1 / x !== 1 / y;
334 }
335 else {
336 return x === x || y === y;
337 }
338 }
339
340 var SSR_ATTR = 'data-server-rendered';
341 var ASSET_TYPES = ['component', 'directive', 'filter'];
342 var LIFECYCLE_HOOKS = [
343 'beforeCreate',
344 'created',
345 'beforeMount',
346 'mounted',
347 'beforeUpdate',
348 'updated',
349 'beforeDestroy',
350 'destroyed',
351 'activated',
352 'deactivated',
353 'errorCaptured',
354 'serverPrefetch',
355 'renderTracked',
356 'renderTriggered'
357 ];
358
359 var config = {
360 /**
361 * Option merge strategies (used in core/util/options)
362 */
363 // $flow-disable-line
364 optionMergeStrategies: Object.create(null),
365 /**
366 * Whether to suppress warnings.
367 */
368 silent: false,
369 /**
370 * Show production mode tip message on boot?
371 */
372 productionTip: true,
373 /**
374 * Whether to enable devtools
375 */
376 devtools: true,
377 /**
378 * Whether to record perf
379 */
380 performance: false,
381 /**
382 * Error handler for watcher errors
383 */
384 errorHandler: null,
385 /**
386 * Warn handler for watcher warns
387 */
388 warnHandler: null,
389 /**
390 * Ignore certain custom elements
391 */
392 ignoredElements: [],
393 /**
394 * Custom user key aliases for v-on
395 */
396 // $flow-disable-line
397 keyCodes: Object.create(null),
398 /**
399 * Check if a tag is reserved so that it cannot be registered as a
400 * component. This is platform-dependent and may be overwritten.
401 */
402 isReservedTag: no,
403 /**
404 * Check if an attribute is reserved so that it cannot be used as a component
405 * prop. This is platform-dependent and may be overwritten.
406 */
407 isReservedAttr: no,
408 /**
409 * Check if a tag is an unknown element.
410 * Platform-dependent.
411 */
412 isUnknownElement: no,
413 /**
414 * Get the namespace of an element
415 */
416 getTagNamespace: noop,
417 /**
418 * Parse the real tag name for the specific platform.
419 */
420 parsePlatformTagName: identity,
421 /**
422 * Check if an attribute must be bound using property, e.g. value
423 * Platform-dependent.
424 */
425 mustUseProp: no,
426 /**
427 * Perform updates asynchronously. Intended to be used by Vue Test Utils
428 * This will significantly reduce performance if set to false.
429 */
430 async: true,
431 /**
432 * Exposed for legacy reasons
433 */
434 _lifecycleHooks: LIFECYCLE_HOOKS
435 };
436
437 /**
438 * unicode letters used for parsing html tags, component names and property paths.
439 * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
440 * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
441 */
442 var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
443 /**
444 * Check if a string starts with $ or _
445 */
446 function isReserved(str) {
447 var c = (str + '').charCodeAt(0);
448 return c === 0x24 || c === 0x5f;
449 }
450 /**
451 * Define a property.
452 */
453 function def(obj, key, val, enumerable) {
454 Object.defineProperty(obj, key, {
455 value: val,
456 enumerable: !!enumerable,
457 writable: true,
458 configurable: true
459 });
460 }
461 /**
462 * Parse simple path.
463 */
464 var bailRE = new RegExp("[^".concat(unicodeRegExp.source, ".$_\\d]"));
465 function parsePath(path) {
466 if (bailRE.test(path)) {
467 return;
468 }
469 var segments = path.split('.');
470 return function (obj) {
471 for (var i = 0; i < segments.length; i++) {
472 if (!obj)
473 return;
474 obj = obj[segments[i]];
475 }
476 return obj;
477 };
478 }
479
480 // can we use __proto__?
481 var hasProto = '__proto__' in {};
482 // Browser environment sniffing
483 var inBrowser = typeof window !== 'undefined';
484 var UA = inBrowser && window.navigator.userAgent.toLowerCase();
485 var isIE = UA && /msie|trident/.test(UA);
486 var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
487 var isEdge = UA && UA.indexOf('edge/') > 0;
488 UA && UA.indexOf('android') > 0;
489 var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
490 UA && /chrome\/\d+/.test(UA) && !isEdge;
491 UA && /phantomjs/.test(UA);
492 var isFF = UA && UA.match(/firefox\/(\d+)/);
493 // Firefox has a "watch" function on Object.prototype...
494 // @ts-expect-error firebox support
495 var nativeWatch = {}.watch;
496 var supportsPassive = false;
497 if (inBrowser) {
498 try {
499 var opts = {};
500 Object.defineProperty(opts, 'passive', {
501 get: function () {
502 /* istanbul ignore next */
503 supportsPassive = true;
504 }
505 }); // https://github.com/facebook/flow/issues/285
506 window.addEventListener('test-passive', null, opts);
507 }
508 catch (e) { }
509 }
510 // this needs to be lazy-evaled because vue may be required before
511 // vue-server-renderer can set VUE_ENV
512 var _isServer;
513 var isServerRendering = function () {
514 if (_isServer === undefined) {
515 /* istanbul ignore if */
516 if (!inBrowser && typeof global !== 'undefined') {
517 // detect presence of vue-server-renderer and avoid
518 // Webpack shimming the process
519 _isServer =
520 global['process'] && global['process'].env.VUE_ENV === 'server';
521 }
522 else {
523 _isServer = false;
524 }
525 }
526 return _isServer;
527 };
528 // detect devtools
529 var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
530 /* istanbul ignore next */
531 function isNative(Ctor) {
532 return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
533 }
534 var hasSymbol = typeof Symbol !== 'undefined' &&
535 isNative(Symbol) &&
536 typeof Reflect !== 'undefined' &&
537 isNative(Reflect.ownKeys);
538 var _Set; // $flow-disable-line
539 /* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) {
540 // use native Set when available.
541 _Set = Set;
542 }
543 else {
544 // a non-standard Set polyfill that only works with primitive keys.
545 _Set = /** @class */ (function () {
546 function Set() {
547 this.set = Object.create(null);
548 }
549 Set.prototype.has = function (key) {
550 return this.set[key] === true;
551 };
552 Set.prototype.add = function (key) {
553 this.set[key] = true;
554 };
555 Set.prototype.clear = function () {
556 this.set = Object.create(null);
557 };
558 return Set;
559 }());
560 }
561
562 var currentInstance = null;
563 /**
564 * This is exposed for compatibility with v3 (e.g. some functions in VueUse
565 * relies on it). Do not use this internally, just use `currentInstance`.
566 *
567 * @internal this function needs manual type declaration because it relies
568 * on previously manually authored types from Vue 2
569 */
570 function getCurrentInstance() {
571 return currentInstance && { proxy: currentInstance };
572 }
573 /**
574 * @internal
575 */
576 function setCurrentInstance(vm) {
577 if (vm === void 0) { vm = null; }
578 if (!vm)
579 currentInstance && currentInstance._scope.off();
580 currentInstance = vm;
581 vm && vm._scope.on();
582 }
583
584 /**
585 * @internal
586 */
587 var VNode = /** @class */ (function () {
588 function VNode(tag, data, children, text, elm, context, componentOptions, asyncFactory) {
589 this.tag = tag;
590 this.data = data;
591 this.children = children;
592 this.text = text;
593 this.elm = elm;
594 this.ns = undefined;
595 this.context = context;
596 this.fnContext = undefined;
597 this.fnOptions = undefined;
598 this.fnScopeId = undefined;
599 this.key = data && data.key;
600 this.componentOptions = componentOptions;
601 this.componentInstance = undefined;
602 this.parent = undefined;
603 this.raw = false;
604 this.isStatic = false;
605 this.isRootInsert = true;
606 this.isComment = false;
607 this.isCloned = false;
608 this.isOnce = false;
609 this.asyncFactory = asyncFactory;
610 this.asyncMeta = undefined;
611 this.isAsyncPlaceholder = false;
612 }
613 Object.defineProperty(VNode.prototype, "child", {
614 // DEPRECATED: alias for componentInstance for backwards compat.
615 /* istanbul ignore next */
616 get: function () {
617 return this.componentInstance;
618 },
619 enumerable: false,
620 configurable: true
621 });
622 return VNode;
623 }());
624 var createEmptyVNode = function (text) {
625 if (text === void 0) { text = ''; }
626 var node = new VNode();
627 node.text = text;
628 node.isComment = true;
629 return node;
630 };
631 function createTextVNode(val) {
632 return new VNode(undefined, undefined, undefined, String(val));
633 }
634 // optimized shallow clone
635 // used for static nodes and slot nodes because they may be reused across
636 // multiple renders, cloning them avoids errors when DOM manipulations rely
637 // on their elm reference.
638 function cloneVNode(vnode) {
639 var cloned = new VNode(vnode.tag, vnode.data,
640 // #7975
641 // clone children array to avoid mutating original in case of cloning
642 // a child.
643 vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);
644 cloned.ns = vnode.ns;
645 cloned.isStatic = vnode.isStatic;
646 cloned.key = vnode.key;
647 cloned.isComment = vnode.isComment;
648 cloned.fnContext = vnode.fnContext;
649 cloned.fnOptions = vnode.fnOptions;
650 cloned.fnScopeId = vnode.fnScopeId;
651 cloned.asyncMeta = vnode.asyncMeta;
652 cloned.isCloned = true;
653 return cloned;
654 }
655
656 /* not type checking this file because flow doesn't play well with Proxy */
657 var initProxy;
658 {
659 var allowedGlobals_1 = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' +
660 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
661 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
662 'require' // for Webpack/Browserify
663 );
664 var warnNonPresent_1 = function (target, key) {
665 warn$2("Property or method \"".concat(key, "\" is not defined on the instance but ") +
666 'referenced during render. Make sure that this property is reactive, ' +
667 'either in the data option, or for class-based components, by ' +
668 'initializing the property. ' +
669 'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
670 };
671 var warnReservedPrefix_1 = function (target, key) {
672 warn$2("Property \"".concat(key, "\" must be accessed with \"$data.").concat(key, "\" because ") +
673 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
674 'prevent conflicts with Vue internals. ' +
675 'See: https://v2.vuejs.org/v2/api/#data', target);
676 };
677 var hasProxy_1 = typeof Proxy !== 'undefined' && isNative(Proxy);
678 if (hasProxy_1) {
679 var isBuiltInModifier_1 = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
680 config.keyCodes = new Proxy(config.keyCodes, {
681 set: function (target, key, value) {
682 if (isBuiltInModifier_1(key)) {
683 warn$2("Avoid overwriting built-in modifier in config.keyCodes: .".concat(key));
684 return false;
685 }
686 else {
687 target[key] = value;
688 return true;
689 }
690 }
691 });
692 }
693 var hasHandler_1 = {
694 has: function (target, key) {
695 var has = key in target;
696 var isAllowed = allowedGlobals_1(key) ||
697 (typeof key === 'string' &&
698 key.charAt(0) === '_' &&
699 !(key in target.$data));
700 if (!has && !isAllowed) {
701 if (key in target.$data)
702 warnReservedPrefix_1(target, key);
703 else
704 warnNonPresent_1(target, key);
705 }
706 return has || !isAllowed;
707 }
708 };
709 var getHandler_1 = {
710 get: function (target, key) {
711 if (typeof key === 'string' && !(key in target)) {
712 if (key in target.$data)
713 warnReservedPrefix_1(target, key);
714 else
715 warnNonPresent_1(target, key);
716 }
717 return target[key];
718 }
719 };
720 initProxy = function initProxy(vm) {
721 if (hasProxy_1) {
722 // determine which proxy handler to use
723 var options = vm.$options;
724 var handlers = options.render && options.render._withStripped ? getHandler_1 : hasHandler_1;
725 vm._renderProxy = new Proxy(vm, handlers);
726 }
727 else {
728 vm._renderProxy = vm;
729 }
730 };
731 }
732
733 /******************************************************************************
734 Copyright (c) Microsoft Corporation.
735
736 Permission to use, copy, modify, and/or distribute this software for any
737 purpose with or without fee is hereby granted.
738
739 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
740 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
741 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
742 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
743 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
744 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
745 PERFORMANCE OF THIS SOFTWARE.
746 ***************************************************************************** */
747
748 var __assign = function() {
749 __assign = Object.assign || function __assign(t) {
750 for (var s, i = 1, n = arguments.length; i < n; i++) {
751 s = arguments[i];
752 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
753 }
754 return t;
755 };
756 return __assign.apply(this, arguments);
757 };
758
759 typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
760 var e = new Error(message);
761 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
762 };
763
764 var uid$2 = 0;
765 var pendingCleanupDeps = [];
766 var cleanupDeps = function () {
767 for (var i = 0; i < pendingCleanupDeps.length; i++) {
768 var dep = pendingCleanupDeps[i];
769 dep.subs = dep.subs.filter(function (s) { return s; });
770 dep._pending = false;
771 }
772 pendingCleanupDeps.length = 0;
773 };
774 /**
775 * A dep is an observable that can have multiple
776 * directives subscribing to it.
777 * @internal
778 */
779 var Dep = /** @class */ (function () {
780 function Dep() {
781 // pending subs cleanup
782 this._pending = false;
783 this.id = uid$2++;
784 this.subs = [];
785 }
786 Dep.prototype.addSub = function (sub) {
787 this.subs.push(sub);
788 };
789 Dep.prototype.removeSub = function (sub) {
790 // #12696 deps with massive amount of subscribers are extremely slow to
791 // clean up in Chromium
792 // to workaround this, we unset the sub for now, and clear them on
793 // next scheduler flush.
794 this.subs[this.subs.indexOf(sub)] = null;
795 if (!this._pending) {
796 this._pending = true;
797 pendingCleanupDeps.push(this);
798 }
799 };
800 Dep.prototype.depend = function (info) {
801 if (Dep.target) {
802 Dep.target.addDep(this);
803 if (info && Dep.target.onTrack) {
804 Dep.target.onTrack(__assign({ effect: Dep.target }, info));
805 }
806 }
807 };
808 Dep.prototype.notify = function (info) {
809 // stabilize the subscriber list first
810 var subs = this.subs.filter(function (s) { return s; });
811 if (!config.async) {
812 // subs aren't sorted in scheduler if not running async
813 // we need to sort them now to make sure they fire in correct
814 // order
815 subs.sort(function (a, b) { return a.id - b.id; });
816 }
817 for (var i = 0, l = subs.length; i < l; i++) {
818 var sub = subs[i];
819 if (info) {
820 sub.onTrigger &&
821 sub.onTrigger(__assign({ effect: subs[i] }, info));
822 }
823 sub.update();
824 }
825 };
826 return Dep;
827 }());
828 // The current target watcher being evaluated.
829 // This is globally unique because only one watcher
830 // can be evaluated at a time.
831 Dep.target = null;
832 var targetStack = [];
833 function pushTarget(target) {
834 targetStack.push(target);
835 Dep.target = target;
836 }
837 function popTarget() {
838 targetStack.pop();
839 Dep.target = targetStack[targetStack.length - 1];
840 }
841
842 /*
843 * not type checking this file because flow doesn't play well with
844 * dynamically accessing methods on Array prototype
845 */
846 var arrayProto = Array.prototype;
847 var arrayMethods = Object.create(arrayProto);
848 var methodsToPatch = [
849 'push',
850 'pop',
851 'shift',
852 'unshift',
853 'splice',
854 'sort',
855 'reverse'
856 ];
857 /**
858 * Intercept mutating methods and emit events
859 */
860 methodsToPatch.forEach(function (method) {
861 // cache original method
862 var original = arrayProto[method];
863 def(arrayMethods, method, function mutator() {
864 var args = [];
865 for (var _i = 0; _i < arguments.length; _i++) {
866 args[_i] = arguments[_i];
867 }
868 var result = original.apply(this, args);
869 var ob = this.__ob__;
870 var inserted;
871 switch (method) {
872 case 'push':
873 case 'unshift':
874 inserted = args;
875 break;
876 case 'splice':
877 inserted = args.slice(2);
878 break;
879 }
880 if (inserted)
881 ob.observeArray(inserted);
882 // notify change
883 {
884 ob.dep.notify({
885 type: "array mutation" /* TriggerOpTypes.ARRAY_MUTATION */,
886 target: this,
887 key: method
888 });
889 }
890 return result;
891 });
892 });
893
894 var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
895 var NO_INITIAL_VALUE = {};
896 /**
897 * In some cases we may want to disable observation inside a component's
898 * update computation.
899 */
900 var shouldObserve = true;
901 function toggleObserving(value) {
902 shouldObserve = value;
903 }
904 // ssr mock dep
905 var mockDep = {
906 notify: noop,
907 depend: noop,
908 addSub: noop,
909 removeSub: noop
910 };
911 /**
912 * Observer class that is attached to each observed
913 * object. Once attached, the observer converts the target
914 * object's property keys into getter/setters that
915 * collect dependencies and dispatch updates.
916 */
917 var Observer = /** @class */ (function () {
918 function Observer(value, shallow, mock) {
919 if (shallow === void 0) { shallow = false; }
920 if (mock === void 0) { mock = false; }
921 this.value = value;
922 this.shallow = shallow;
923 this.mock = mock;
924 // this.value = value
925 this.dep = mock ? mockDep : new Dep();
926 this.vmCount = 0;
927 def(value, '__ob__', this);
928 if (isArray(value)) {
929 if (!mock) {
930 if (hasProto) {
931 value.__proto__ = arrayMethods;
932 /* eslint-enable no-proto */
933 }
934 else {
935 for (var i = 0, l = arrayKeys.length; i < l; i++) {
936 var key = arrayKeys[i];
937 def(value, key, arrayMethods[key]);
938 }
939 }
940 }
941 if (!shallow) {
942 this.observeArray(value);
943 }
944 }
945 else {
946 /**
947 * Walk through all properties and convert them into
948 * getter/setters. This method should only be called when
949 * value type is Object.
950 */
951 var keys = Object.keys(value);
952 for (var i = 0; i < keys.length; i++) {
953 var key = keys[i];
954 defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock);
955 }
956 }
957 }
958 /**
959 * Observe a list of Array items.
960 */
961 Observer.prototype.observeArray = function (value) {
962 for (var i = 0, l = value.length; i < l; i++) {
963 observe(value[i], false, this.mock);
964 }
965 };
966 return Observer;
967 }());
968 // helpers
969 /**
970 * Attempt to create an observer instance for a value,
971 * returns the new observer if successfully observed,
972 * or the existing observer if the value already has one.
973 */
974 function observe(value, shallow, ssrMockReactivity) {
975 if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
976 return value.__ob__;
977 }
978 if (shouldObserve &&
979 (ssrMockReactivity || !isServerRendering()) &&
980 (isArray(value) || isPlainObject(value)) &&
981 Object.isExtensible(value) &&
982 !value.__v_skip /* ReactiveFlags.SKIP */ &&
983 !isRef(value) &&
984 !(value instanceof VNode)) {
985 return new Observer(value, shallow, ssrMockReactivity);
986 }
987 }
988 /**
989 * Define a reactive property on an Object.
990 */
991 function defineReactive(obj, key, val, customSetter, shallow, mock, observeEvenIfShallow) {
992 if (observeEvenIfShallow === void 0) { observeEvenIfShallow = false; }
993 var dep = new Dep();
994 var property = Object.getOwnPropertyDescriptor(obj, key);
995 if (property && property.configurable === false) {
996 return;
997 }
998 // cater for pre-defined getter/setters
999 var getter = property && property.get;
1000 var setter = property && property.set;
1001 if ((!getter || setter) &&
1002 (val === NO_INITIAL_VALUE || arguments.length === 2)) {
1003 val = obj[key];
1004 }
1005 var childOb = shallow ? val && val.__ob__ : observe(val, false, mock);
1006 Object.defineProperty(obj, key, {
1007 enumerable: true,
1008 configurable: true,
1009 get: function reactiveGetter() {
1010 var value = getter ? getter.call(obj) : val;
1011 if (Dep.target) {
1012 {
1013 dep.depend({
1014 target: obj,
1015 type: "get" /* TrackOpTypes.GET */,
1016 key: key
1017 });
1018 }
1019 if (childOb) {
1020 childOb.dep.depend();
1021 if (isArray(value)) {
1022 dependArray(value);
1023 }
1024 }
1025 }
1026 return isRef(value) && !shallow ? value.value : value;
1027 },
1028 set: function reactiveSetter(newVal) {
1029 var value = getter ? getter.call(obj) : val;
1030 if (!hasChanged(value, newVal)) {
1031 return;
1032 }
1033 if (customSetter) {
1034 customSetter();
1035 }
1036 if (setter) {
1037 setter.call(obj, newVal);
1038 }
1039 else if (getter) {
1040 // #7981: for accessor properties without setter
1041 return;
1042 }
1043 else if (!shallow && isRef(value) && !isRef(newVal)) {
1044 value.value = newVal;
1045 return;
1046 }
1047 else {
1048 val = newVal;
1049 }
1050 childOb = shallow ? newVal && newVal.__ob__ : observe(newVal, false, mock);
1051 {
1052 dep.notify({
1053 type: "set" /* TriggerOpTypes.SET */,
1054 target: obj,
1055 key: key,
1056 newValue: newVal,
1057 oldValue: value
1058 });
1059 }
1060 }
1061 });
1062 return dep;
1063 }
1064 function set(target, key, val) {
1065 if ((isUndef(target) || isPrimitive(target))) {
1066 warn$2("Cannot set reactive property on undefined, null, or primitive value: ".concat(target));
1067 }
1068 if (isReadonly(target)) {
1069 warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
1070 return;
1071 }
1072 var ob = target.__ob__;
1073 if (isArray(target) && isValidArrayIndex(key)) {
1074 target.length = Math.max(target.length, key);
1075 target.splice(key, 1, val);
1076 // when mocking for SSR, array methods are not hijacked
1077 if (ob && !ob.shallow && ob.mock) {
1078 observe(val, false, true);
1079 }
1080 return val;
1081 }
1082 if (key in target && !(key in Object.prototype)) {
1083 target[key] = val;
1084 return val;
1085 }
1086 if (target._isVue || (ob && ob.vmCount)) {
1087 warn$2('Avoid adding reactive properties to a Vue instance or its root $data ' +
1088 'at runtime - declare it upfront in the data option.');
1089 return val;
1090 }
1091 if (!ob) {
1092 target[key] = val;
1093 return val;
1094 }
1095 defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock);
1096 {
1097 ob.dep.notify({
1098 type: "add" /* TriggerOpTypes.ADD */,
1099 target: target,
1100 key: key,
1101 newValue: val,
1102 oldValue: undefined
1103 });
1104 }
1105 return val;
1106 }
1107 function del(target, key) {
1108 if ((isUndef(target) || isPrimitive(target))) {
1109 warn$2("Cannot delete reactive property on undefined, null, or primitive value: ".concat(target));
1110 }
1111 if (isArray(target) && isValidArrayIndex(key)) {
1112 target.splice(key, 1);
1113 return;
1114 }
1115 var ob = target.__ob__;
1116 if (target._isVue || (ob && ob.vmCount)) {
1117 warn$2('Avoid deleting properties on a Vue instance or its root $data ' +
1118 '- just set it to null.');
1119 return;
1120 }
1121 if (isReadonly(target)) {
1122 warn$2("Delete operation on key \"".concat(key, "\" failed: target is readonly."));
1123 return;
1124 }
1125 if (!hasOwn(target, key)) {
1126 return;
1127 }
1128 delete target[key];
1129 if (!ob) {
1130 return;
1131 }
1132 {
1133 ob.dep.notify({
1134 type: "delete" /* TriggerOpTypes.DELETE */,
1135 target: target,
1136 key: key
1137 });
1138 }
1139 }
1140 /**
1141 * Collect dependencies on array elements when the array is touched, since
1142 * we cannot intercept array element access like property getters.
1143 */
1144 function dependArray(value) {
1145 for (var e = void 0, i = 0, l = value.length; i < l; i++) {
1146 e = value[i];
1147 if (e && e.__ob__) {
1148 e.__ob__.dep.depend();
1149 }
1150 if (isArray(e)) {
1151 dependArray(e);
1152 }
1153 }
1154 }
1155
1156 function reactive(target) {
1157 makeReactive(target, false);
1158 return target;
1159 }
1160 /**
1161 * Return a shallowly-reactive copy of the original object, where only the root
1162 * level properties are reactive. It also does not auto-unwrap refs (even at the
1163 * root level).
1164 */
1165 function shallowReactive(target) {
1166 makeReactive(target, true);
1167 def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
1168 return target;
1169 }
1170 function makeReactive(target, shallow) {
1171 // if trying to observe a readonly proxy, return the readonly version.
1172 if (!isReadonly(target)) {
1173 {
1174 if (isArray(target)) {
1175 warn$2("Avoid using Array as root value for ".concat(shallow ? "shallowReactive()" : "reactive()", " as it cannot be tracked in watch() or watchEffect(). Use ").concat(shallow ? "shallowRef()" : "ref()", " instead. This is a Vue-2-only limitation."));
1176 }
1177 var existingOb = target && target.__ob__;
1178 if (existingOb && existingOb.shallow !== shallow) {
1179 warn$2("Target is already a ".concat(existingOb.shallow ? "" : "non-", "shallow reactive object, and cannot be converted to ").concat(shallow ? "" : "non-", "shallow."));
1180 }
1181 }
1182 var ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
1183 if (!ob) {
1184 if (target == null || isPrimitive(target)) {
1185 warn$2("value cannot be made reactive: ".concat(String(target)));
1186 }
1187 if (isCollectionType(target)) {
1188 warn$2("Vue 2 does not support reactive collection types such as Map or Set.");
1189 }
1190 }
1191 }
1192 }
1193 function isReactive(value) {
1194 if (isReadonly(value)) {
1195 return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
1196 }
1197 return !!(value && value.__ob__);
1198 }
1199 function isShallow(value) {
1200 return !!(value && value.__v_isShallow);
1201 }
1202 function isReadonly(value) {
1203 return !!(value && value.__v_isReadonly);
1204 }
1205 function isProxy(value) {
1206 return isReactive(value) || isReadonly(value);
1207 }
1208 function toRaw(observed) {
1209 var raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
1210 return raw ? toRaw(raw) : observed;
1211 }
1212 function markRaw(value) {
1213 // non-extensible objects won't be observed anyway
1214 if (Object.isExtensible(value)) {
1215 def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
1216 }
1217 return value;
1218 }
1219 /**
1220 * @internal
1221 */
1222 function isCollectionType(value) {
1223 var type = toRawType(value);
1224 return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
1225 }
1226
1227 /**
1228 * @internal
1229 */
1230 var RefFlag = "__v_isRef";
1231 function isRef(r) {
1232 return !!(r && r.__v_isRef === true);
1233 }
1234 function ref$1(value) {
1235 return createRef(value, false);
1236 }
1237 function shallowRef(value) {
1238 return createRef(value, true);
1239 }
1240 function createRef(rawValue, shallow) {
1241 if (isRef(rawValue)) {
1242 return rawValue;
1243 }
1244 var ref = {};
1245 def(ref, RefFlag, true);
1246 def(ref, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, shallow);
1247 def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering()));
1248 return ref;
1249 }
1250 function triggerRef(ref) {
1251 if (!ref.dep) {
1252 warn$2("received object is not a triggerable ref.");
1253 }
1254 {
1255 ref.dep &&
1256 ref.dep.notify({
1257 type: "set" /* TriggerOpTypes.SET */,
1258 target: ref,
1259 key: 'value'
1260 });
1261 }
1262 }
1263 function unref(ref) {
1264 return isRef(ref) ? ref.value : ref;
1265 }
1266 function proxyRefs(objectWithRefs) {
1267 if (isReactive(objectWithRefs)) {
1268 return objectWithRefs;
1269 }
1270 var proxy = {};
1271 var keys = Object.keys(objectWithRefs);
1272 for (var i = 0; i < keys.length; i++) {
1273 proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]);
1274 }
1275 return proxy;
1276 }
1277 function proxyWithRefUnwrap(target, source, key) {
1278 Object.defineProperty(target, key, {
1279 enumerable: true,
1280 configurable: true,
1281 get: function () {
1282 var val = source[key];
1283 if (isRef(val)) {
1284 return val.value;
1285 }
1286 else {
1287 var ob = val && val.__ob__;
1288 if (ob)
1289 ob.dep.depend();
1290 return val;
1291 }
1292 },
1293 set: function (value) {
1294 var oldValue = source[key];
1295 if (isRef(oldValue) && !isRef(value)) {
1296 oldValue.value = value;
1297 }
1298 else {
1299 source[key] = value;
1300 }
1301 }
1302 });
1303 }
1304 function customRef(factory) {
1305 var dep = new Dep();
1306 var _a = factory(function () {
1307 {
1308 dep.depend({
1309 target: ref,
1310 type: "get" /* TrackOpTypes.GET */,
1311 key: 'value'
1312 });
1313 }
1314 }, function () {
1315 {
1316 dep.notify({
1317 target: ref,
1318 type: "set" /* TriggerOpTypes.SET */,
1319 key: 'value'
1320 });
1321 }
1322 }), get = _a.get, set = _a.set;
1323 var ref = {
1324 get value() {
1325 return get();
1326 },
1327 set value(newVal) {
1328 set(newVal);
1329 }
1330 };
1331 def(ref, RefFlag, true);
1332 return ref;
1333 }
1334 function toRefs(object) {
1335 if (!isReactive(object)) {
1336 warn$2("toRefs() expects a reactive object but received a plain one.");
1337 }
1338 var ret = isArray(object) ? new Array(object.length) : {};
1339 for (var key in object) {
1340 ret[key] = toRef(object, key);
1341 }
1342 return ret;
1343 }
1344 function toRef(object, key, defaultValue) {
1345 var val = object[key];
1346 if (isRef(val)) {
1347 return val;
1348 }
1349 var ref = {
1350 get value() {
1351 var val = object[key];
1352 return val === undefined ? defaultValue : val;
1353 },
1354 set value(newVal) {
1355 object[key] = newVal;
1356 }
1357 };
1358 def(ref, RefFlag, true);
1359 return ref;
1360 }
1361
1362 var rawToReadonlyFlag = "__v_rawToReadonly";
1363 var rawToShallowReadonlyFlag = "__v_rawToShallowReadonly";
1364 function readonly(target) {
1365 return createReadonly(target, false);
1366 }
1367 function createReadonly(target, shallow) {
1368 if (!isPlainObject(target)) {
1369 {
1370 if (isArray(target)) {
1371 warn$2("Vue 2 does not support readonly arrays.");
1372 }
1373 else if (isCollectionType(target)) {
1374 warn$2("Vue 2 does not support readonly collection types such as Map or Set.");
1375 }
1376 else {
1377 warn$2("value cannot be made readonly: ".concat(typeof target));
1378 }
1379 }
1380 return target;
1381 }
1382 if (!Object.isExtensible(target)) {
1383 warn$2("Vue 2 does not support creating readonly proxy for non-extensible object.");
1384 }
1385 // already a readonly object
1386 if (isReadonly(target)) {
1387 return target;
1388 }
1389 // already has a readonly proxy
1390 var existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;
1391 var existingProxy = target[existingFlag];
1392 if (existingProxy) {
1393 return existingProxy;
1394 }
1395 var proxy = Object.create(Object.getPrototypeOf(target));
1396 def(target, existingFlag, proxy);
1397 def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true);
1398 def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target);
1399 if (isRef(target)) {
1400 def(proxy, RefFlag, true);
1401 }
1402 if (shallow || isShallow(target)) {
1403 def(proxy, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
1404 }
1405 var keys = Object.keys(target);
1406 for (var i = 0; i < keys.length; i++) {
1407 defineReadonlyProperty(proxy, target, keys[i], shallow);
1408 }
1409 return proxy;
1410 }
1411 function defineReadonlyProperty(proxy, target, key, shallow) {
1412 Object.defineProperty(proxy, key, {
1413 enumerable: true,
1414 configurable: true,
1415 get: function () {
1416 var val = target[key];
1417 return shallow || !isPlainObject(val) ? val : readonly(val);
1418 },
1419 set: function () {
1420 warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
1421 }
1422 });
1423 }
1424 /**
1425 * Returns a reactive-copy of the original object, where only the root level
1426 * properties are readonly, and does NOT unwrap refs nor recursively convert
1427 * returned properties.
1428 * This is used for creating the props proxy object for stateful components.
1429 */
1430 function shallowReadonly(target) {
1431 return createReadonly(target, true);
1432 }
1433
1434 function computed(getterOrOptions, debugOptions) {
1435 var getter;
1436 var setter;
1437 var onlyGetter = isFunction(getterOrOptions);
1438 if (onlyGetter) {
1439 getter = getterOrOptions;
1440 setter = function () {
1441 warn$2('Write operation failed: computed value is readonly');
1442 }
1443 ;
1444 }
1445 else {
1446 getter = getterOrOptions.get;
1447 setter = getterOrOptions.set;
1448 }
1449 var watcher = isServerRendering()
1450 ? null
1451 : new Watcher(currentInstance, getter, noop, { lazy: true });
1452 if (watcher && debugOptions) {
1453 watcher.onTrack = debugOptions.onTrack;
1454 watcher.onTrigger = debugOptions.onTrigger;
1455 }
1456 var ref = {
1457 // some libs rely on the presence effect for checking computed refs
1458 // from normal refs, but the implementation doesn't matter
1459 effect: watcher,
1460 get value() {
1461 if (watcher) {
1462 if (watcher.dirty) {
1463 watcher.evaluate();
1464 }
1465 if (Dep.target) {
1466 if (Dep.target.onTrack) {
1467 Dep.target.onTrack({
1468 effect: Dep.target,
1469 target: ref,
1470 type: "get" /* TrackOpTypes.GET */,
1471 key: 'value'
1472 });
1473 }
1474 watcher.depend();
1475 }
1476 return watcher.value;
1477 }
1478 else {
1479 return getter();
1480 }
1481 },
1482 set value(newVal) {
1483 setter(newVal);
1484 }
1485 };
1486 def(ref, RefFlag, true);
1487 def(ref, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, onlyGetter);
1488 return ref;
1489 }
1490
1491 var mark;
1492 var measure;
1493 {
1494 var perf_1 = inBrowser && window.performance;
1495 /* istanbul ignore if */
1496 if (perf_1 &&
1497 // @ts-ignore
1498 perf_1.mark &&
1499 // @ts-ignore
1500 perf_1.measure &&
1501 // @ts-ignore
1502 perf_1.clearMarks &&
1503 // @ts-ignore
1504 perf_1.clearMeasures) {
1505 mark = function (tag) { return perf_1.mark(tag); };
1506 measure = function (name, startTag, endTag) {
1507 perf_1.measure(name, startTag, endTag);
1508 perf_1.clearMarks(startTag);
1509 perf_1.clearMarks(endTag);
1510 // perf.clearMeasures(name)
1511 };
1512 }
1513 }
1514
1515 var normalizeEvent = cached(function (name) {
1516 var passive = name.charAt(0) === '&';
1517 name = passive ? name.slice(1) : name;
1518 var once = name.charAt(0) === '~'; // Prefixed last, checked first
1519 name = once ? name.slice(1) : name;
1520 var capture = name.charAt(0) === '!';
1521 name = capture ? name.slice(1) : name;
1522 return {
1523 name: name,
1524 once: once,
1525 capture: capture,
1526 passive: passive
1527 };
1528 });
1529 function createFnInvoker(fns, vm) {
1530 function invoker() {
1531 var fns = invoker.fns;
1532 if (isArray(fns)) {
1533 var cloned = fns.slice();
1534 for (var i = 0; i < cloned.length; i++) {
1535 invokeWithErrorHandling(cloned[i], null, arguments, vm, "v-on handler");
1536 }
1537 }
1538 else {
1539 // return handler return value for single handlers
1540 return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler");
1541 }
1542 }
1543 invoker.fns = fns;
1544 return invoker;
1545 }
1546 function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
1547 var name, cur, old, event;
1548 for (name in on) {
1549 cur = on[name];
1550 old = oldOn[name];
1551 event = normalizeEvent(name);
1552 if (isUndef(cur)) {
1553 warn$2("Invalid handler for event \"".concat(event.name, "\": got ") + String(cur), vm);
1554 }
1555 else if (isUndef(old)) {
1556 if (isUndef(cur.fns)) {
1557 cur = on[name] = createFnInvoker(cur, vm);
1558 }
1559 if (isTrue(event.once)) {
1560 cur = on[name] = createOnceHandler(event.name, cur, event.capture);
1561 }
1562 add(event.name, cur, event.capture, event.passive, event.params);
1563 }
1564 else if (cur !== old) {
1565 old.fns = cur;
1566 on[name] = old;
1567 }
1568 }
1569 for (name in oldOn) {
1570 if (isUndef(on[name])) {
1571 event = normalizeEvent(name);
1572 remove(event.name, oldOn[name], event.capture);
1573 }
1574 }
1575 }
1576
1577 function mergeVNodeHook(def, hookKey, hook) {
1578 if (def instanceof VNode) {
1579 def = def.data.hook || (def.data.hook = {});
1580 }
1581 var invoker;
1582 var oldHook = def[hookKey];
1583 function wrappedHook() {
1584 hook.apply(this, arguments);
1585 // important: remove merged hook to ensure it's called only once
1586 // and prevent memory leak
1587 remove$2(invoker.fns, wrappedHook);
1588 }
1589 if (isUndef(oldHook)) {
1590 // no existing hook
1591 invoker = createFnInvoker([wrappedHook]);
1592 }
1593 else {
1594 /* istanbul ignore if */
1595 if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
1596 // already a merged invoker
1597 invoker = oldHook;
1598 invoker.fns.push(wrappedHook);
1599 }
1600 else {
1601 // existing plain hook
1602 invoker = createFnInvoker([oldHook, wrappedHook]);
1603 }
1604 }
1605 invoker.merged = true;
1606 def[hookKey] = invoker;
1607 }
1608
1609 function extractPropsFromVNodeData(data, Ctor, tag) {
1610 // we are only extracting raw values here.
1611 // validation and default values are handled in the child
1612 // component itself.
1613 var propOptions = Ctor.options.props;
1614 if (isUndef(propOptions)) {
1615 return;
1616 }
1617 var res = {};
1618 var attrs = data.attrs, props = data.props;
1619 if (isDef(attrs) || isDef(props)) {
1620 for (var key in propOptions) {
1621 var altKey = hyphenate(key);
1622 {
1623 var keyInLowerCase = key.toLowerCase();
1624 if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {
1625 tip("Prop \"".concat(keyInLowerCase, "\" is passed to component ") +
1626 "".concat(formatComponentName(
1627 // @ts-expect-error tag is string
1628 tag || Ctor), ", but the declared prop name is") +
1629 " \"".concat(key, "\". ") +
1630 "Note that HTML attributes are case-insensitive and camelCased " +
1631 "props need to use their kebab-case equivalents when using in-DOM " +
1632 "templates. You should probably use \"".concat(altKey, "\" instead of \"").concat(key, "\"."));
1633 }
1634 }
1635 checkProp(res, props, key, altKey, true) ||
1636 checkProp(res, attrs, key, altKey, false);
1637 }
1638 }
1639 return res;
1640 }
1641 function checkProp(res, hash, key, altKey, preserve) {
1642 if (isDef(hash)) {
1643 if (hasOwn(hash, key)) {
1644 res[key] = hash[key];
1645 if (!preserve) {
1646 delete hash[key];
1647 }
1648 return true;
1649 }
1650 else if (hasOwn(hash, altKey)) {
1651 res[key] = hash[altKey];
1652 if (!preserve) {
1653 delete hash[altKey];
1654 }
1655 return true;
1656 }
1657 }
1658 return false;
1659 }
1660
1661 // The template compiler attempts to minimize the need for normalization by
1662 // statically analyzing the template at compile time.
1663 //
1664 // For plain HTML markup, normalization can be completely skipped because the
1665 // generated render function is guaranteed to return Array<VNode>. There are
1666 // two cases where extra normalization is needed:
1667 // 1. When the children contains components - because a functional component
1668 // may return an Array instead of a single root. In this case, just a simple
1669 // normalization is needed - if any child is an Array, we flatten the whole
1670 // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
1671 // because functional components already normalize their own children.
1672 function simpleNormalizeChildren(children) {
1673 for (var i = 0; i < children.length; i++) {
1674 if (isArray(children[i])) {
1675 return Array.prototype.concat.apply([], children);
1676 }
1677 }
1678 return children;
1679 }
1680 // 2. When the children contains constructs that always generated nested Arrays,
1681 // e.g. <template>, <slot>, v-for, or when the children is provided by user
1682 // with hand-written render functions / JSX. In such cases a full normalization
1683 // is needed to cater to all possible types of children values.
1684 function normalizeChildren(children) {
1685 return isPrimitive(children)
1686 ? [createTextVNode(children)]
1687 : isArray(children)
1688 ? normalizeArrayChildren(children)
1689 : undefined;
1690 }
1691 function isTextNode(node) {
1692 return isDef(node) && isDef(node.text) && isFalse(node.isComment);
1693 }
1694 function normalizeArrayChildren(children, nestedIndex) {
1695 var res = [];
1696 var i, c, lastIndex, last;
1697 for (i = 0; i < children.length; i++) {
1698 c = children[i];
1699 if (isUndef(c) || typeof c === 'boolean')
1700 continue;
1701 lastIndex = res.length - 1;
1702 last = res[lastIndex];
1703 // nested
1704 if (isArray(c)) {
1705 if (c.length > 0) {
1706 c = normalizeArrayChildren(c, "".concat(nestedIndex || '', "_").concat(i));
1707 // merge adjacent text nodes
1708 if (isTextNode(c[0]) && isTextNode(last)) {
1709 res[lastIndex] = createTextVNode(last.text + c[0].text);
1710 c.shift();
1711 }
1712 res.push.apply(res, c);
1713 }
1714 }
1715 else if (isPrimitive(c)) {
1716 if (isTextNode(last)) {
1717 // merge adjacent text nodes
1718 // this is necessary for SSR hydration because text nodes are
1719 // essentially merged when rendered to HTML strings
1720 res[lastIndex] = createTextVNode(last.text + c);
1721 }
1722 else if (c !== '') {
1723 // convert primitive to vnode
1724 res.push(createTextVNode(c));
1725 }
1726 }
1727 else {
1728 if (isTextNode(c) && isTextNode(last)) {
1729 // merge adjacent text nodes
1730 res[lastIndex] = createTextVNode(last.text + c.text);
1731 }
1732 else {
1733 // default key for nested array children (likely generated by v-for)
1734 if (isTrue(children._isVList) &&
1735 isDef(c.tag) &&
1736 isUndef(c.key) &&
1737 isDef(nestedIndex)) {
1738 c.key = "__vlist".concat(nestedIndex, "_").concat(i, "__");
1739 }
1740 res.push(c);
1741 }
1742 }
1743 }
1744 return res;
1745 }
1746
1747 var SIMPLE_NORMALIZE = 1;
1748 var ALWAYS_NORMALIZE = 2;
1749 // wrapper function for providing a more flexible interface
1750 // without getting yelled at by flow
1751 function createElement$1(context, tag, data, children, normalizationType, alwaysNormalize) {
1752 if (isArray(data) || isPrimitive(data)) {
1753 normalizationType = children;
1754 children = data;
1755 data = undefined;
1756 }
1757 if (isTrue(alwaysNormalize)) {
1758 normalizationType = ALWAYS_NORMALIZE;
1759 }
1760 return _createElement(context, tag, data, children, normalizationType);
1761 }
1762 function _createElement(context, tag, data, children, normalizationType) {
1763 if (isDef(data) && isDef(data.__ob__)) {
1764 warn$2("Avoid using observed data object as vnode data: ".concat(JSON.stringify(data), "\n") + 'Always create fresh vnode data objects in each render!', context);
1765 return createEmptyVNode();
1766 }
1767 // object syntax in v-bind
1768 if (isDef(data) && isDef(data.is)) {
1769 tag = data.is;
1770 }
1771 if (!tag) {
1772 // in case of component :is set to falsy value
1773 return createEmptyVNode();
1774 }
1775 // warn against non-primitive key
1776 if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
1777 warn$2('Avoid using non-primitive value as key, ' +
1778 'use string/number value instead.', context);
1779 }
1780 // support single function children as default scoped slot
1781 if (isArray(children) && isFunction(children[0])) {
1782 data = data || {};
1783 data.scopedSlots = { default: children[0] };
1784 children.length = 0;
1785 }
1786 if (normalizationType === ALWAYS_NORMALIZE) {
1787 children = normalizeChildren(children);
1788 }
1789 else if (normalizationType === SIMPLE_NORMALIZE) {
1790 children = simpleNormalizeChildren(children);
1791 }
1792 var vnode, ns;
1793 if (typeof tag === 'string') {
1794 var Ctor = void 0;
1795 ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
1796 if (config.isReservedTag(tag)) {
1797 // platform built-in elements
1798 if (isDef(data) &&
1799 isDef(data.nativeOn) &&
1800 data.tag !== 'component') {
1801 warn$2("The .native modifier for v-on is only valid on components but it was used on <".concat(tag, ">."), context);
1802 }
1803 vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context);
1804 }
1805 else if ((!data || !data.pre) &&
1806 isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
1807 // component
1808 vnode = createComponent(Ctor, data, context, children, tag);
1809 }
1810 else {
1811 // unknown or unlisted namespaced elements
1812 // check at runtime because it may get assigned a namespace when its
1813 // parent normalizes children
1814 vnode = new VNode(tag, data, children, undefined, undefined, context);
1815 }
1816 }
1817 else {
1818 // direct component options / constructor
1819 vnode = createComponent(tag, data, context, children);
1820 }
1821 if (isArray(vnode)) {
1822 return vnode;
1823 }
1824 else if (isDef(vnode)) {
1825 if (isDef(ns))
1826 applyNS(vnode, ns);
1827 if (isDef(data))
1828 registerDeepBindings(data);
1829 return vnode;
1830 }
1831 else {
1832 return createEmptyVNode();
1833 }
1834 }
1835 function applyNS(vnode, ns, force) {
1836 vnode.ns = ns;
1837 if (vnode.tag === 'foreignObject') {
1838 // use default namespace inside foreignObject
1839 ns = undefined;
1840 force = true;
1841 }
1842 if (isDef(vnode.children)) {
1843 for (var i = 0, l = vnode.children.length; i < l; i++) {
1844 var child = vnode.children[i];
1845 if (isDef(child.tag) &&
1846 (isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
1847 applyNS(child, ns, force);
1848 }
1849 }
1850 }
1851 }
1852 // ref #5318
1853 // necessary to ensure parent re-render when deep bindings like :style and
1854 // :class are used on slot nodes
1855 function registerDeepBindings(data) {
1856 if (isObject(data.style)) {
1857 traverse(data.style);
1858 }
1859 if (isObject(data.class)) {
1860 traverse(data.class);
1861 }
1862 }
1863
1864 /**
1865 * Runtime helper for rendering v-for lists.
1866 */
1867 function renderList(val, render) {
1868 var ret = null, i, l, keys, key;
1869 if (isArray(val) || typeof val === 'string') {
1870 ret = new Array(val.length);
1871 for (i = 0, l = val.length; i < l; i++) {
1872 ret[i] = render(val[i], i);
1873 }
1874 }
1875 else if (typeof val === 'number') {
1876 ret = new Array(val);
1877 for (i = 0; i < val; i++) {
1878 ret[i] = render(i + 1, i);
1879 }
1880 }
1881 else if (isObject(val)) {
1882 if (hasSymbol && val[Symbol.iterator]) {
1883 ret = [];
1884 var iterator = val[Symbol.iterator]();
1885 var result = iterator.next();
1886 while (!result.done) {
1887 ret.push(render(result.value, ret.length));
1888 result = iterator.next();
1889 }
1890 }
1891 else {
1892 keys = Object.keys(val);
1893 ret = new Array(keys.length);
1894 for (i = 0, l = keys.length; i < l; i++) {
1895 key = keys[i];
1896 ret[i] = render(val[key], key, i);
1897 }
1898 }
1899 }
1900 if (!isDef(ret)) {
1901 ret = [];
1902 }
1903 ret._isVList = true;
1904 return ret;
1905 }
1906
1907 /**
1908 * Runtime helper for rendering <slot>
1909 */
1910 function renderSlot(name, fallbackRender, props, bindObject) {
1911 var scopedSlotFn = this.$scopedSlots[name];
1912 var nodes;
1913 if (scopedSlotFn) {
1914 // scoped slot
1915 props = props || {};
1916 if (bindObject) {
1917 if (!isObject(bindObject)) {
1918 warn$2('slot v-bind without argument expects an Object', this);
1919 }
1920 props = extend(extend({}, bindObject), props);
1921 }
1922 nodes =
1923 scopedSlotFn(props) ||
1924 (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
1925 }
1926 else {
1927 nodes =
1928 this.$slots[name] ||
1929 (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
1930 }
1931 var target = props && props.slot;
1932 if (target) {
1933 return this.$createElement('template', { slot: target }, nodes);
1934 }
1935 else {
1936 return nodes;
1937 }
1938 }
1939
1940 /**
1941 * Runtime helper for resolving filters
1942 */
1943 function resolveFilter(id) {
1944 return resolveAsset(this.$options, 'filters', id, true) || identity;
1945 }
1946
1947 function isKeyNotMatch(expect, actual) {
1948 if (isArray(expect)) {
1949 return expect.indexOf(actual) === -1;
1950 }
1951 else {
1952 return expect !== actual;
1953 }
1954 }
1955 /**
1956 * Runtime helper for checking keyCodes from config.
1957 * exposed as Vue.prototype._k
1958 * passing in eventKeyName as last argument separately for backwards compat
1959 */
1960 function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {
1961 var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
1962 if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
1963 return isKeyNotMatch(builtInKeyName, eventKeyName);
1964 }
1965 else if (mappedKeyCode) {
1966 return isKeyNotMatch(mappedKeyCode, eventKeyCode);
1967 }
1968 else if (eventKeyName) {
1969 return hyphenate(eventKeyName) !== key;
1970 }
1971 return eventKeyCode === undefined;
1972 }
1973
1974 /**
1975 * Runtime helper for merging v-bind="object" into a VNode's data.
1976 */
1977 function bindObjectProps(data, tag, value, asProp, isSync) {
1978 if (value) {
1979 if (!isObject(value)) {
1980 warn$2('v-bind without argument expects an Object or Array value', this);
1981 }
1982 else {
1983 if (isArray(value)) {
1984 value = toObject(value);
1985 }
1986 var hash = void 0;
1987 var _loop_1 = function (key) {
1988 if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
1989 hash = data;
1990 }
1991 else {
1992 var type = data.attrs && data.attrs.type;
1993 hash =
1994 asProp || config.mustUseProp(tag, type, key)
1995 ? data.domProps || (data.domProps = {})
1996 : data.attrs || (data.attrs = {});
1997 }
1998 var camelizedKey = camelize(key);
1999 var hyphenatedKey = hyphenate(key);
2000 if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2001 hash[key] = value[key];
2002 if (isSync) {
2003 var on = data.on || (data.on = {});
2004 on["update:".concat(key)] = function ($event) {
2005 value[key] = $event;
2006 };
2007 }
2008 }
2009 };
2010 for (var key in value) {
2011 _loop_1(key);
2012 }
2013 }
2014 }
2015 return data;
2016 }
2017
2018 /**
2019 * Runtime helper for rendering static trees.
2020 */
2021 function renderStatic(index, isInFor) {
2022 var cached = this._staticTrees || (this._staticTrees = []);
2023 var tree = cached[index];
2024 // if has already-rendered static tree and not inside v-for,
2025 // we can reuse the same tree.
2026 if (tree && !isInFor) {
2027 return tree;
2028 }
2029 // otherwise, render a fresh tree.
2030 tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
2031 );
2032 markStatic$1(tree, "__static__".concat(index), false);
2033 return tree;
2034 }
2035 /**
2036 * Runtime helper for v-once.
2037 * Effectively it means marking the node as static with a unique key.
2038 */
2039 function markOnce(tree, index, key) {
2040 markStatic$1(tree, "__once__".concat(index).concat(key ? "_".concat(key) : ""), true);
2041 return tree;
2042 }
2043 function markStatic$1(tree, key, isOnce) {
2044 if (isArray(tree)) {
2045 for (var i = 0; i < tree.length; i++) {
2046 if (tree[i] && typeof tree[i] !== 'string') {
2047 markStaticNode(tree[i], "".concat(key, "_").concat(i), isOnce);
2048 }
2049 }
2050 }
2051 else {
2052 markStaticNode(tree, key, isOnce);
2053 }
2054 }
2055 function markStaticNode(node, key, isOnce) {
2056 node.isStatic = true;
2057 node.key = key;
2058 node.isOnce = isOnce;
2059 }
2060
2061 function bindObjectListeners(data, value) {
2062 if (value) {
2063 if (!isPlainObject(value)) {
2064 warn$2('v-on without argument expects an Object value', this);
2065 }
2066 else {
2067 var on = (data.on = data.on ? extend({}, data.on) : {});
2068 for (var key in value) {
2069 var existing = on[key];
2070 var ours = value[key];
2071 on[key] = existing ? [].concat(existing, ours) : ours;
2072 }
2073 }
2074 }
2075 return data;
2076 }
2077
2078 function resolveScopedSlots(fns, res,
2079 // the following are added in 2.6
2080 hasDynamicKeys, contentHashKey) {
2081 res = res || { $stable: !hasDynamicKeys };
2082 for (var i = 0; i < fns.length; i++) {
2083 var slot = fns[i];
2084 if (isArray(slot)) {
2085 resolveScopedSlots(slot, res, hasDynamicKeys);
2086 }
2087 else if (slot) {
2088 // marker for reverse proxying v-slot without scope on this.$slots
2089 // @ts-expect-error
2090 if (slot.proxy) {
2091 // @ts-expect-error
2092 slot.fn.proxy = true;
2093 }
2094 res[slot.key] = slot.fn;
2095 }
2096 }
2097 if (contentHashKey) {
2098 res.$key = contentHashKey;
2099 }
2100 return res;
2101 }
2102
2103 // helper to process dynamic keys for dynamic arguments in v-bind and v-on.
2104 function bindDynamicKeys(baseObj, values) {
2105 for (var i = 0; i < values.length; i += 2) {
2106 var key = values[i];
2107 if (typeof key === 'string' && key) {
2108 baseObj[values[i]] = values[i + 1];
2109 }
2110 else if (key !== '' && key !== null) {
2111 // null is a special value for explicitly removing a binding
2112 warn$2("Invalid value for dynamic directive argument (expected string or null): ".concat(key), this);
2113 }
2114 }
2115 return baseObj;
2116 }
2117 // helper to dynamically append modifier runtime markers to event names.
2118 // ensure only append when value is already string, otherwise it will be cast
2119 // to string and cause the type check to miss.
2120 function prependModifier(value, symbol) {
2121 return typeof value === 'string' ? symbol + value : value;
2122 }
2123
2124 function installRenderHelpers(target) {
2125 target._o = markOnce;
2126 target._n = toNumber;
2127 target._s = toString;
2128 target._l = renderList;
2129 target._t = renderSlot;
2130 target._q = looseEqual;
2131 target._i = looseIndexOf;
2132 target._m = renderStatic;
2133 target._f = resolveFilter;
2134 target._k = checkKeyCodes;
2135 target._b = bindObjectProps;
2136 target._v = createTextVNode;
2137 target._e = createEmptyVNode;
2138 target._u = resolveScopedSlots;
2139 target._g = bindObjectListeners;
2140 target._d = bindDynamicKeys;
2141 target._p = prependModifier;
2142 }
2143
2144 /**
2145 * Runtime helper for resolving raw children VNodes into a slot object.
2146 */
2147 function resolveSlots(children, context) {
2148 if (!children || !children.length) {
2149 return {};
2150 }
2151 var slots = {};
2152 for (var i = 0, l = children.length; i < l; i++) {
2153 var child = children[i];
2154 var data = child.data;
2155 // remove slot attribute if the node is resolved as a Vue slot node
2156 if (data && data.attrs && data.attrs.slot) {
2157 delete data.attrs.slot;
2158 }
2159 // named slots should only be respected if the vnode was rendered in the
2160 // same context.
2161 if ((child.context === context || child.fnContext === context) &&
2162 data &&
2163 data.slot != null) {
2164 var name_1 = data.slot;
2165 var slot = slots[name_1] || (slots[name_1] = []);
2166 if (child.tag === 'template') {
2167 slot.push.apply(slot, child.children || []);
2168 }
2169 else {
2170 slot.push(child);
2171 }
2172 }
2173 else {
2174 (slots.default || (slots.default = [])).push(child);
2175 }
2176 }
2177 // ignore slots that contains only whitespace
2178 for (var name_2 in slots) {
2179 if (slots[name_2].every(isWhitespace)) {
2180 delete slots[name_2];
2181 }
2182 }
2183 return slots;
2184 }
2185 function isWhitespace(node) {
2186 return (node.isComment && !node.asyncFactory) || node.text === ' ';
2187 }
2188
2189 function isAsyncPlaceholder(node) {
2190 // @ts-expect-error not really boolean type
2191 return node.isComment && node.asyncFactory;
2192 }
2193
2194 function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
2195 var res;
2196 var hasNormalSlots = Object.keys(normalSlots).length > 0;
2197 var isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
2198 var key = scopedSlots && scopedSlots.$key;
2199 if (!scopedSlots) {
2200 res = {};
2201 }
2202 else if (scopedSlots._normalized) {
2203 // fast path 1: child component re-render only, parent did not change
2204 return scopedSlots._normalized;
2205 }
2206 else if (isStable &&
2207 prevScopedSlots &&
2208 prevScopedSlots !== emptyObject &&
2209 key === prevScopedSlots.$key &&
2210 !hasNormalSlots &&
2211 !prevScopedSlots.$hasNormal) {
2212 // fast path 2: stable scoped slots w/ no normal slots to proxy,
2213 // only need to normalize once
2214 return prevScopedSlots;
2215 }
2216 else {
2217 res = {};
2218 for (var key_1 in scopedSlots) {
2219 if (scopedSlots[key_1] && key_1[0] !== '$') {
2220 res[key_1] = normalizeScopedSlot(ownerVm, normalSlots, key_1, scopedSlots[key_1]);
2221 }
2222 }
2223 }
2224 // expose normal slots on scopedSlots
2225 for (var key_2 in normalSlots) {
2226 if (!(key_2 in res)) {
2227 res[key_2] = proxyNormalSlot(normalSlots, key_2);
2228 }
2229 }
2230 // avoriaz seems to mock a non-extensible $scopedSlots object
2231 // and when that is passed down this would cause an error
2232 if (scopedSlots && Object.isExtensible(scopedSlots)) {
2233 scopedSlots._normalized = res;
2234 }
2235 def(res, '$stable', isStable);
2236 def(res, '$key', key);
2237 def(res, '$hasNormal', hasNormalSlots);
2238 return res;
2239 }
2240 function normalizeScopedSlot(vm, normalSlots, key, fn) {
2241 var normalized = function () {
2242 var cur = currentInstance;
2243 setCurrentInstance(vm);
2244 var res = arguments.length ? fn.apply(null, arguments) : fn({});
2245 res =
2246 res && typeof res === 'object' && !isArray(res)
2247 ? [res] // single vnode
2248 : normalizeChildren(res);
2249 var vnode = res && res[0];
2250 setCurrentInstance(cur);
2251 return res &&
2252 (!vnode ||
2253 (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
2254 ? undefined
2255 : res;
2256 };
2257 // this is a slot using the new v-slot syntax without scope. although it is
2258 // compiled as a scoped slot, render fn users would expect it to be present
2259 // on this.$slots because the usage is semantically a normal slot.
2260 if (fn.proxy) {
2261 Object.defineProperty(normalSlots, key, {
2262 get: normalized,
2263 enumerable: true,
2264 configurable: true
2265 });
2266 }
2267 return normalized;
2268 }
2269 function proxyNormalSlot(slots, key) {
2270 return function () { return slots[key]; };
2271 }
2272
2273 function initSetup(vm) {
2274 var options = vm.$options;
2275 var setup = options.setup;
2276 if (setup) {
2277 var ctx = (vm._setupContext = createSetupContext(vm));
2278 setCurrentInstance(vm);
2279 pushTarget();
2280 var setupResult = invokeWithErrorHandling(setup, null, [vm._props || shallowReactive({}), ctx], vm, "setup");
2281 popTarget();
2282 setCurrentInstance();
2283 if (isFunction(setupResult)) {
2284 // render function
2285 // @ts-ignore
2286 options.render = setupResult;
2287 }
2288 else if (isObject(setupResult)) {
2289 // bindings
2290 if (setupResult instanceof VNode) {
2291 warn$2("setup() should not return VNodes directly - " +
2292 "return a render function instead.");
2293 }
2294 vm._setupState = setupResult;
2295 // __sfc indicates compiled bindings from <script setup>
2296 if (!setupResult.__sfc) {
2297 for (var key in setupResult) {
2298 if (!isReserved(key)) {
2299 proxyWithRefUnwrap(vm, setupResult, key);
2300 }
2301 else {
2302 warn$2("Avoid using variables that start with _ or $ in setup().");
2303 }
2304 }
2305 }
2306 else {
2307 // exposed for compiled render fn
2308 var proxy = (vm._setupProxy = {});
2309 for (var key in setupResult) {
2310 if (key !== '__sfc') {
2311 proxyWithRefUnwrap(proxy, setupResult, key);
2312 }
2313 }
2314 }
2315 }
2316 else if (setupResult !== undefined) {
2317 warn$2("setup() should return an object. Received: ".concat(setupResult === null ? 'null' : typeof setupResult));
2318 }
2319 }
2320 }
2321 function createSetupContext(vm) {
2322 var exposeCalled = false;
2323 return {
2324 get attrs() {
2325 if (!vm._attrsProxy) {
2326 var proxy = (vm._attrsProxy = {});
2327 def(proxy, '_v_attr_proxy', true);
2328 syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
2329 }
2330 return vm._attrsProxy;
2331 },
2332 get listeners() {
2333 if (!vm._listenersProxy) {
2334 var proxy = (vm._listenersProxy = {});
2335 syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
2336 }
2337 return vm._listenersProxy;
2338 },
2339 get slots() {
2340 return initSlotsProxy(vm);
2341 },
2342 emit: bind$1(vm.$emit, vm),
2343 expose: function (exposed) {
2344 {
2345 if (exposeCalled) {
2346 warn$2("expose() should be called only once per setup().", vm);
2347 }
2348 exposeCalled = true;
2349 }
2350 if (exposed) {
2351 Object.keys(exposed).forEach(function (key) {
2352 return proxyWithRefUnwrap(vm, exposed, key);
2353 });
2354 }
2355 }
2356 };
2357 }
2358 function syncSetupProxy(to, from, prev, instance, type) {
2359 var changed = false;
2360 for (var key in from) {
2361 if (!(key in to)) {
2362 changed = true;
2363 defineProxyAttr(to, key, instance, type);
2364 }
2365 else if (from[key] !== prev[key]) {
2366 changed = true;
2367 }
2368 }
2369 for (var key in to) {
2370 if (!(key in from)) {
2371 changed = true;
2372 delete to[key];
2373 }
2374 }
2375 return changed;
2376 }
2377 function defineProxyAttr(proxy, key, instance, type) {
2378 Object.defineProperty(proxy, key, {
2379 enumerable: true,
2380 configurable: true,
2381 get: function () {
2382 return instance[type][key];
2383 }
2384 });
2385 }
2386 function initSlotsProxy(vm) {
2387 if (!vm._slotsProxy) {
2388 syncSetupSlots((vm._slotsProxy = {}), vm.$scopedSlots);
2389 }
2390 return vm._slotsProxy;
2391 }
2392 function syncSetupSlots(to, from) {
2393 for (var key in from) {
2394 to[key] = from[key];
2395 }
2396 for (var key in to) {
2397 if (!(key in from)) {
2398 delete to[key];
2399 }
2400 }
2401 }
2402 /**
2403 * @internal use manual type def because public setup context type relies on
2404 * legacy VNode types
2405 */
2406 function useSlots() {
2407 return getContext().slots;
2408 }
2409 /**
2410 * @internal use manual type def because public setup context type relies on
2411 * legacy VNode types
2412 */
2413 function useAttrs() {
2414 return getContext().attrs;
2415 }
2416 /**
2417 * Vue 2 only
2418 * @internal use manual type def because public setup context type relies on
2419 * legacy VNode types
2420 */
2421 function useListeners() {
2422 return getContext().listeners;
2423 }
2424 function getContext() {
2425 if (!currentInstance) {
2426 warn$2("useContext() called without active instance.");
2427 }
2428 var vm = currentInstance;
2429 return vm._setupContext || (vm._setupContext = createSetupContext(vm));
2430 }
2431 /**
2432 * Runtime helper for merging default declarations. Imported by compiled code
2433 * only.
2434 * @internal
2435 */
2436 function mergeDefaults(raw, defaults) {
2437 var props = isArray(raw)
2438 ? raw.reduce(function (normalized, p) { return ((normalized[p] = {}), normalized); }, {})
2439 : raw;
2440 for (var key in defaults) {
2441 var opt = props[key];
2442 if (opt) {
2443 if (isArray(opt) || isFunction(opt)) {
2444 props[key] = { type: opt, default: defaults[key] };
2445 }
2446 else {
2447 opt.default = defaults[key];
2448 }
2449 }
2450 else if (opt === null) {
2451 props[key] = { default: defaults[key] };
2452 }
2453 else {
2454 warn$2("props default key \"".concat(key, "\" has no corresponding declaration."));
2455 }
2456 }
2457 return props;
2458 }
2459
2460 function initRender(vm) {
2461 vm._vnode = null; // the root of the child tree
2462 vm._staticTrees = null; // v-once cached trees
2463 var options = vm.$options;
2464 var parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
2465 var renderContext = parentVnode && parentVnode.context;
2466 vm.$slots = resolveSlots(options._renderChildren, renderContext);
2467 vm.$scopedSlots = parentVnode
2468 ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
2469 : emptyObject;
2470 // bind the createElement fn to this instance
2471 // so that we get proper render context inside it.
2472 // args order: tag, data, children, normalizationType, alwaysNormalize
2473 // internal version is used by render functions compiled from templates
2474 // @ts-expect-error
2475 vm._c = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, false); };
2476 // normalization is always applied for the public version, used in
2477 // user-written render functions.
2478 // @ts-expect-error
2479 vm.$createElement = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, true); };
2480 // $attrs & $listeners are exposed for easier HOC creation.
2481 // they need to be reactive so that HOCs using them are always updated
2482 var parentData = parentVnode && parentVnode.data;
2483 /* istanbul ignore else */
2484 {
2485 defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, function () {
2486 !isUpdatingChildComponent && warn$2("$attrs is readonly.", vm);
2487 }, true);
2488 defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
2489 !isUpdatingChildComponent && warn$2("$listeners is readonly.", vm);
2490 }, true);
2491 }
2492 }
2493 var currentRenderingInstance = null;
2494 function renderMixin(Vue) {
2495 // install runtime convenience helpers
2496 installRenderHelpers(Vue.prototype);
2497 Vue.prototype.$nextTick = function (fn) {
2498 return nextTick(fn, this);
2499 };
2500 Vue.prototype._render = function () {
2501 var vm = this;
2502 var _a = vm.$options, render = _a.render, _parentVnode = _a._parentVnode;
2503 if (_parentVnode && vm._isMounted) {
2504 vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
2505 if (vm._slotsProxy) {
2506 syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
2507 }
2508 }
2509 // set parent vnode. this allows render functions to have access
2510 // to the data on the placeholder node.
2511 vm.$vnode = _parentVnode;
2512 // render self
2513 var prevInst = currentInstance;
2514 var prevRenderInst = currentRenderingInstance;
2515 var vnode;
2516 try {
2517 setCurrentInstance(vm);
2518 currentRenderingInstance = vm;
2519 vnode = render.call(vm._renderProxy, vm.$createElement);
2520 }
2521 catch (e) {
2522 handleError(e, vm, "render");
2523 // return error render result,
2524 // or previous vnode to prevent render error causing blank component
2525 /* istanbul ignore else */
2526 if (vm.$options.renderError) {
2527 try {
2528 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
2529 }
2530 catch (e) {
2531 handleError(e, vm, "renderError");
2532 vnode = vm._vnode;
2533 }
2534 }
2535 else {
2536 vnode = vm._vnode;
2537 }
2538 }
2539 finally {
2540 currentRenderingInstance = prevRenderInst;
2541 setCurrentInstance(prevInst);
2542 }
2543 // if the returned array contains only a single node, allow it
2544 if (isArray(vnode) && vnode.length === 1) {
2545 vnode = vnode[0];
2546 }
2547 // return empty vnode in case the render function errored out
2548 if (!(vnode instanceof VNode)) {
2549 if (isArray(vnode)) {
2550 warn$2('Multiple root nodes returned from render function. Render function ' +
2551 'should return a single root node.', vm);
2552 }
2553 vnode = createEmptyVNode();
2554 }
2555 // set parent
2556 vnode.parent = _parentVnode;
2557 return vnode;
2558 };
2559 }
2560
2561 function ensureCtor(comp, base) {
2562 if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
2563 comp = comp.default;
2564 }
2565 return isObject(comp) ? base.extend(comp) : comp;
2566 }
2567 function createAsyncPlaceholder(factory, data, context, children, tag) {
2568 var node = createEmptyVNode();
2569 node.asyncFactory = factory;
2570 node.asyncMeta = { data: data, context: context, children: children, tag: tag };
2571 return node;
2572 }
2573 function resolveAsyncComponent(factory, baseCtor) {
2574 if (isTrue(factory.error) && isDef(factory.errorComp)) {
2575 return factory.errorComp;
2576 }
2577 if (isDef(factory.resolved)) {
2578 return factory.resolved;
2579 }
2580 var owner = currentRenderingInstance;
2581 if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
2582 // already pending
2583 factory.owners.push(owner);
2584 }
2585 if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
2586 return factory.loadingComp;
2587 }
2588 if (owner && !isDef(factory.owners)) {
2589 var owners_1 = (factory.owners = [owner]);
2590 var sync_1 = true;
2591 var timerLoading_1 = null;
2592 var timerTimeout_1 = null;
2593 owner.$on('hook:destroyed', function () { return remove$2(owners_1, owner); });
2594 var forceRender_1 = function (renderCompleted) {
2595 for (var i = 0, l = owners_1.length; i < l; i++) {
2596 owners_1[i].$forceUpdate();
2597 }
2598 if (renderCompleted) {
2599 owners_1.length = 0;
2600 if (timerLoading_1 !== null) {
2601 clearTimeout(timerLoading_1);
2602 timerLoading_1 = null;
2603 }
2604 if (timerTimeout_1 !== null) {
2605 clearTimeout(timerTimeout_1);
2606 timerTimeout_1 = null;
2607 }
2608 }
2609 };
2610 var resolve = once(function (res) {
2611 // cache resolved
2612 factory.resolved = ensureCtor(res, baseCtor);
2613 // invoke callbacks only if this is not a synchronous resolve
2614 // (async resolves are shimmed as synchronous during SSR)
2615 if (!sync_1) {
2616 forceRender_1(true);
2617 }
2618 else {
2619 owners_1.length = 0;
2620 }
2621 });
2622 var reject_1 = once(function (reason) {
2623 warn$2("Failed to resolve async component: ".concat(String(factory)) +
2624 (reason ? "\nReason: ".concat(reason) : ''));
2625 if (isDef(factory.errorComp)) {
2626 factory.error = true;
2627 forceRender_1(true);
2628 }
2629 });
2630 var res_1 = factory(resolve, reject_1);
2631 if (isObject(res_1)) {
2632 if (isPromise(res_1)) {
2633 // () => Promise
2634 if (isUndef(factory.resolved)) {
2635 res_1.then(resolve, reject_1);
2636 }
2637 }
2638 else if (isPromise(res_1.component)) {
2639 res_1.component.then(resolve, reject_1);
2640 if (isDef(res_1.error)) {
2641 factory.errorComp = ensureCtor(res_1.error, baseCtor);
2642 }
2643 if (isDef(res_1.loading)) {
2644 factory.loadingComp = ensureCtor(res_1.loading, baseCtor);
2645 if (res_1.delay === 0) {
2646 factory.loading = true;
2647 }
2648 else {
2649 // @ts-expect-error NodeJS timeout type
2650 timerLoading_1 = setTimeout(function () {
2651 timerLoading_1 = null;
2652 if (isUndef(factory.resolved) && isUndef(factory.error)) {
2653 factory.loading = true;
2654 forceRender_1(false);
2655 }
2656 }, res_1.delay || 200);
2657 }
2658 }
2659 if (isDef(res_1.timeout)) {
2660 // @ts-expect-error NodeJS timeout type
2661 timerTimeout_1 = setTimeout(function () {
2662 timerTimeout_1 = null;
2663 if (isUndef(factory.resolved)) {
2664 reject_1("timeout (".concat(res_1.timeout, "ms)") );
2665 }
2666 }, res_1.timeout);
2667 }
2668 }
2669 }
2670 sync_1 = false;
2671 // return in case resolved synchronously
2672 return factory.loading ? factory.loadingComp : factory.resolved;
2673 }
2674 }
2675
2676 function getFirstComponentChild(children) {
2677 if (isArray(children)) {
2678 for (var i = 0; i < children.length; i++) {
2679 var c = children[i];
2680 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
2681 return c;
2682 }
2683 }
2684 }
2685 }
2686
2687 function initEvents(vm) {
2688 vm._events = Object.create(null);
2689 vm._hasHookEvent = false;
2690 // init parent attached events
2691 var listeners = vm.$options._parentListeners;
2692 if (listeners) {
2693 updateComponentListeners(vm, listeners);
2694 }
2695 }
2696 var target$1;
2697 function add$1(event, fn) {
2698 target$1.$on(event, fn);
2699 }
2700 function remove$1(event, fn) {
2701 target$1.$off(event, fn);
2702 }
2703 function createOnceHandler$1(event, fn) {
2704 var _target = target$1;
2705 return function onceHandler() {
2706 var res = fn.apply(null, arguments);
2707 if (res !== null) {
2708 _target.$off(event, onceHandler);
2709 }
2710 };
2711 }
2712 function updateComponentListeners(vm, listeners, oldListeners) {
2713 target$1 = vm;
2714 updateListeners(listeners, oldListeners || {}, add$1, remove$1, createOnceHandler$1, vm);
2715 target$1 = undefined;
2716 }
2717 function eventsMixin(Vue) {
2718 var hookRE = /^hook:/;
2719 Vue.prototype.$on = function (event, fn) {
2720 var vm = this;
2721 if (isArray(event)) {
2722 for (var i = 0, l = event.length; i < l; i++) {
2723 vm.$on(event[i], fn);
2724 }
2725 }
2726 else {
2727 (vm._events[event] || (vm._events[event] = [])).push(fn);
2728 // optimize hook:event cost by using a boolean flag marked at registration
2729 // instead of a hash lookup
2730 if (hookRE.test(event)) {
2731 vm._hasHookEvent = true;
2732 }
2733 }
2734 return vm;
2735 };
2736 Vue.prototype.$once = function (event, fn) {
2737 var vm = this;
2738 function on() {
2739 vm.$off(event, on);
2740 fn.apply(vm, arguments);
2741 }
2742 on.fn = fn;
2743 vm.$on(event, on);
2744 return vm;
2745 };
2746 Vue.prototype.$off = function (event, fn) {
2747 var vm = this;
2748 // all
2749 if (!arguments.length) {
2750 vm._events = Object.create(null);
2751 return vm;
2752 }
2753 // array of events
2754 if (isArray(event)) {
2755 for (var i_1 = 0, l = event.length; i_1 < l; i_1++) {
2756 vm.$off(event[i_1], fn);
2757 }
2758 return vm;
2759 }
2760 // specific event
2761 var cbs = vm._events[event];
2762 if (!cbs) {
2763 return vm;
2764 }
2765 if (!fn) {
2766 vm._events[event] = null;
2767 return vm;
2768 }
2769 // specific handler
2770 var cb;
2771 var i = cbs.length;
2772 while (i--) {
2773 cb = cbs[i];
2774 if (cb === fn || cb.fn === fn) {
2775 cbs.splice(i, 1);
2776 break;
2777 }
2778 }
2779 return vm;
2780 };
2781 Vue.prototype.$emit = function (event) {
2782 var vm = this;
2783 {
2784 var lowerCaseEvent = event.toLowerCase();
2785 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
2786 tip("Event \"".concat(lowerCaseEvent, "\" is emitted in component ") +
2787 "".concat(formatComponentName(vm), " but the handler is registered for \"").concat(event, "\". ") +
2788 "Note that HTML attributes are case-insensitive and you cannot use " +
2789 "v-on to listen to camelCase events when using in-DOM templates. " +
2790 "You should probably use \"".concat(hyphenate(event), "\" instead of \"").concat(event, "\"."));
2791 }
2792 }
2793 var cbs = vm._events[event];
2794 if (cbs) {
2795 cbs = cbs.length > 1 ? toArray(cbs) : cbs;
2796 var args = toArray(arguments, 1);
2797 var info = "event handler for \"".concat(event, "\"");
2798 for (var i = 0, l = cbs.length; i < l; i++) {
2799 invokeWithErrorHandling(cbs[i], vm, args, vm, info);
2800 }
2801 }
2802 return vm;
2803 };
2804 }
2805
2806 var activeEffectScope;
2807 var EffectScope = /** @class */ (function () {
2808 function EffectScope(detached) {
2809 if (detached === void 0) { detached = false; }
2810 this.detached = detached;
2811 /**
2812 * @internal
2813 */
2814 this.active = true;
2815 /**
2816 * @internal
2817 */
2818 this.effects = [];
2819 /**
2820 * @internal
2821 */
2822 this.cleanups = [];
2823 this.parent = activeEffectScope;
2824 if (!detached && activeEffectScope) {
2825 this.index =
2826 (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
2827 }
2828 }
2829 EffectScope.prototype.run = function (fn) {
2830 if (this.active) {
2831 var currentEffectScope = activeEffectScope;
2832 try {
2833 activeEffectScope = this;
2834 return fn();
2835 }
2836 finally {
2837 activeEffectScope = currentEffectScope;
2838 }
2839 }
2840 else {
2841 warn$2("cannot run an inactive effect scope.");
2842 }
2843 };
2844 /**
2845 * This should only be called on non-detached scopes
2846 * @internal
2847 */
2848 EffectScope.prototype.on = function () {
2849 activeEffectScope = this;
2850 };
2851 /**
2852 * This should only be called on non-detached scopes
2853 * @internal
2854 */
2855 EffectScope.prototype.off = function () {
2856 activeEffectScope = this.parent;
2857 };
2858 EffectScope.prototype.stop = function (fromParent) {
2859 if (this.active) {
2860 var i = void 0, l = void 0;
2861 for (i = 0, l = this.effects.length; i < l; i++) {
2862 this.effects[i].teardown();
2863 }
2864 for (i = 0, l = this.cleanups.length; i < l; i++) {
2865 this.cleanups[i]();
2866 }
2867 if (this.scopes) {
2868 for (i = 0, l = this.scopes.length; i < l; i++) {
2869 this.scopes[i].stop(true);
2870 }
2871 }
2872 // nested scope, dereference from parent to avoid memory leaks
2873 if (!this.detached && this.parent && !fromParent) {
2874 // optimized O(1) removal
2875 var last = this.parent.scopes.pop();
2876 if (last && last !== this) {
2877 this.parent.scopes[this.index] = last;
2878 last.index = this.index;
2879 }
2880 }
2881 this.parent = undefined;
2882 this.active = false;
2883 }
2884 };
2885 return EffectScope;
2886 }());
2887 function effectScope(detached) {
2888 return new EffectScope(detached);
2889 }
2890 /**
2891 * @internal
2892 */
2893 function recordEffectScope(effect, scope) {
2894 if (scope === void 0) { scope = activeEffectScope; }
2895 if (scope && scope.active) {
2896 scope.effects.push(effect);
2897 }
2898 }
2899 function getCurrentScope() {
2900 return activeEffectScope;
2901 }
2902 function onScopeDispose(fn) {
2903 if (activeEffectScope) {
2904 activeEffectScope.cleanups.push(fn);
2905 }
2906 else {
2907 warn$2("onScopeDispose() is called when there is no active effect scope" +
2908 " to be associated with.");
2909 }
2910 }
2911
2912 var activeInstance = null;
2913 var isUpdatingChildComponent = false;
2914 function setActiveInstance(vm) {
2915 var prevActiveInstance = activeInstance;
2916 activeInstance = vm;
2917 return function () {
2918 activeInstance = prevActiveInstance;
2919 };
2920 }
2921 function initLifecycle(vm) {
2922 var options = vm.$options;
2923 // locate first non-abstract parent
2924 var parent = options.parent;
2925 if (parent && !options.abstract) {
2926 while (parent.$options.abstract && parent.$parent) {
2927 parent = parent.$parent;
2928 }
2929 parent.$children.push(vm);
2930 }
2931 vm.$parent = parent;
2932 vm.$root = parent ? parent.$root : vm;
2933 vm.$children = [];
2934 vm.$refs = {};
2935 vm._provided = parent ? parent._provided : Object.create(null);
2936 vm._watcher = null;
2937 vm._inactive = null;
2938 vm._directInactive = false;
2939 vm._isMounted = false;
2940 vm._isDestroyed = false;
2941 vm._isBeingDestroyed = false;
2942 }
2943 function lifecycleMixin(Vue) {
2944 Vue.prototype._update = function (vnode, hydrating) {
2945 var vm = this;
2946 var prevEl = vm.$el;
2947 var prevVnode = vm._vnode;
2948 var restoreActiveInstance = setActiveInstance(vm);
2949 vm._vnode = vnode;
2950 // Vue.prototype.__patch__ is injected in entry points
2951 // based on the rendering backend used.
2952 if (!prevVnode) {
2953 // initial render
2954 vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
2955 }
2956 else {
2957 // updates
2958 vm.$el = vm.__patch__(prevVnode, vnode);
2959 }
2960 restoreActiveInstance();
2961 // update __vue__ reference
2962 if (prevEl) {
2963 prevEl.__vue__ = null;
2964 }
2965 if (vm.$el) {
2966 vm.$el.__vue__ = vm;
2967 }
2968 // if parent is an HOC, update its $el as well
2969 var wrapper = vm;
2970 while (wrapper &&
2971 wrapper.$vnode &&
2972 wrapper.$parent &&
2973 wrapper.$vnode === wrapper.$parent._vnode) {
2974 wrapper.$parent.$el = wrapper.$el;
2975 wrapper = wrapper.$parent;
2976 }
2977 // updated hook is called by the scheduler to ensure that children are
2978 // updated in a parent's updated hook.
2979 };
2980 Vue.prototype.$forceUpdate = function () {
2981 var vm = this;
2982 if (vm._watcher) {
2983 vm._watcher.update();
2984 }
2985 };
2986 Vue.prototype.$destroy = function () {
2987 var vm = this;
2988 if (vm._isBeingDestroyed) {
2989 return;
2990 }
2991 callHook$1(vm, 'beforeDestroy');
2992 vm._isBeingDestroyed = true;
2993 // remove self from parent
2994 var parent = vm.$parent;
2995 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
2996 remove$2(parent.$children, vm);
2997 }
2998 // teardown scope. this includes both the render watcher and other
2999 // watchers created
3000 vm._scope.stop();
3001 // remove reference from data ob
3002 // frozen object may not have observer.
3003 if (vm._data.__ob__) {
3004 vm._data.__ob__.vmCount--;
3005 }
3006 // call the last hook...
3007 vm._isDestroyed = true;
3008 // invoke destroy hooks on current rendered tree
3009 vm.__patch__(vm._vnode, null);
3010 // fire destroyed hook
3011 callHook$1(vm, 'destroyed');
3012 // turn off all instance listeners.
3013 vm.$off();
3014 // remove __vue__ reference
3015 if (vm.$el) {
3016 vm.$el.__vue__ = null;
3017 }
3018 // release circular reference (#6759)
3019 if (vm.$vnode) {
3020 vm.$vnode.parent = null;
3021 }
3022 };
3023 }
3024 function mountComponent(vm, el, hydrating) {
3025 vm.$el = el;
3026 if (!vm.$options.render) {
3027 // @ts-expect-error invalid type
3028 vm.$options.render = createEmptyVNode;
3029 {
3030 /* istanbul ignore if */
3031 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
3032 vm.$options.el ||
3033 el) {
3034 warn$2('You are using the runtime-only build of Vue where the template ' +
3035 'compiler is not available. Either pre-compile the templates into ' +
3036 'render functions, or use the compiler-included build.', vm);
3037 }
3038 else {
3039 warn$2('Failed to mount component: template or render function not defined.', vm);
3040 }
3041 }
3042 }
3043 callHook$1(vm, 'beforeMount');
3044 var updateComponent;
3045 /* istanbul ignore if */
3046 if (config.performance && mark) {
3047 updateComponent = function () {
3048 var name = vm._name;
3049 var id = vm._uid;
3050 var startTag = "vue-perf-start:".concat(id);
3051 var endTag = "vue-perf-end:".concat(id);
3052 mark(startTag);
3053 var vnode = vm._render();
3054 mark(endTag);
3055 measure("vue ".concat(name, " render"), startTag, endTag);
3056 mark(startTag);
3057 vm._update(vnode, hydrating);
3058 mark(endTag);
3059 measure("vue ".concat(name, " patch"), startTag, endTag);
3060 };
3061 }
3062 else {
3063 updateComponent = function () {
3064 vm._update(vm._render(), hydrating);
3065 };
3066 }
3067 var watcherOptions = {
3068 before: function () {
3069 if (vm._isMounted && !vm._isDestroyed) {
3070 callHook$1(vm, 'beforeUpdate');
3071 }
3072 }
3073 };
3074 {
3075 watcherOptions.onTrack = function (e) { return callHook$1(vm, 'renderTracked', [e]); };
3076 watcherOptions.onTrigger = function (e) { return callHook$1(vm, 'renderTriggered', [e]); };
3077 }
3078 // we set this to vm._watcher inside the watcher's constructor
3079 // since the watcher's initial patch may call $forceUpdate (e.g. inside child
3080 // component's mounted hook), which relies on vm._watcher being already defined
3081 new Watcher(vm, updateComponent, noop, watcherOptions, true /* isRenderWatcher */);
3082 hydrating = false;
3083 // flush buffer for flush: "pre" watchers queued in setup()
3084 var preWatchers = vm._preWatchers;
3085 if (preWatchers) {
3086 for (var i = 0; i < preWatchers.length; i++) {
3087 preWatchers[i].run();
3088 }
3089 }
3090 // manually mounted instance, call mounted on self
3091 // mounted is called for render-created child components in its inserted hook
3092 if (vm.$vnode == null) {
3093 vm._isMounted = true;
3094 callHook$1(vm, 'mounted');
3095 }
3096 return vm;
3097 }
3098 function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
3099 {
3100 isUpdatingChildComponent = true;
3101 }
3102 // determine whether component has slot children
3103 // we need to do this before overwriting $options._renderChildren.
3104 // check if there are dynamic scopedSlots (hand-written or compiled but with
3105 // dynamic slot names). Static scoped slots compiled from template has the
3106 // "$stable" marker.
3107 var newScopedSlots = parentVnode.data.scopedSlots;
3108 var oldScopedSlots = vm.$scopedSlots;
3109 var hasDynamicScopedSlot = !!((newScopedSlots && !newScopedSlots.$stable) ||
3110 (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
3111 (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
3112 (!newScopedSlots && vm.$scopedSlots.$key));
3113 // Any static slot children from the parent may have changed during parent's
3114 // update. Dynamic scoped slots may also have changed. In such cases, a forced
3115 // update is necessary to ensure correctness.
3116 var needsForceUpdate = !!(renderChildren || // has new static slots
3117 vm.$options._renderChildren || // has old static slots
3118 hasDynamicScopedSlot);
3119 var prevVNode = vm.$vnode;
3120 vm.$options._parentVnode = parentVnode;
3121 vm.$vnode = parentVnode; // update vm's placeholder node without re-render
3122 if (vm._vnode) {
3123 // update child tree's parent
3124 vm._vnode.parent = parentVnode;
3125 }
3126 vm.$options._renderChildren = renderChildren;
3127 // update $attrs and $listeners hash
3128 // these are also reactive so they may trigger child update if the child
3129 // used them during render
3130 var attrs = parentVnode.data.attrs || emptyObject;
3131 if (vm._attrsProxy) {
3132 // force update if attrs are accessed and has changed since it may be
3133 // passed to a child component.
3134 if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
3135 needsForceUpdate = true;
3136 }
3137 }
3138 vm.$attrs = attrs;
3139 // update listeners
3140 listeners = listeners || emptyObject;
3141 var prevListeners = vm.$options._parentListeners;
3142 if (vm._listenersProxy) {
3143 syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
3144 }
3145 vm.$listeners = vm.$options._parentListeners = listeners;
3146 updateComponentListeners(vm, listeners, prevListeners);
3147 // update props
3148 if (propsData && vm.$options.props) {
3149 toggleObserving(false);
3150 var props = vm._props;
3151 var propKeys = vm.$options._propKeys || [];
3152 for (var i = 0; i < propKeys.length; i++) {
3153 var key = propKeys[i];
3154 var propOptions = vm.$options.props; // wtf flow?
3155 props[key] = validateProp(key, propOptions, propsData, vm);
3156 }
3157 toggleObserving(true);
3158 // keep a copy of raw propsData
3159 vm.$options.propsData = propsData;
3160 }
3161 // resolve slots + force update if has children
3162 if (needsForceUpdate) {
3163 vm.$slots = resolveSlots(renderChildren, parentVnode.context);
3164 vm.$forceUpdate();
3165 }
3166 {
3167 isUpdatingChildComponent = false;
3168 }
3169 }
3170 function isInInactiveTree(vm) {
3171 while (vm && (vm = vm.$parent)) {
3172 if (vm._inactive)
3173 return true;
3174 }
3175 return false;
3176 }
3177 function activateChildComponent(vm, direct) {
3178 if (direct) {
3179 vm._directInactive = false;
3180 if (isInInactiveTree(vm)) {
3181 return;
3182 }
3183 }
3184 else if (vm._directInactive) {
3185 return;
3186 }
3187 if (vm._inactive || vm._inactive === null) {
3188 vm._inactive = false;
3189 for (var i = 0; i < vm.$children.length; i++) {
3190 activateChildComponent(vm.$children[i]);
3191 }
3192 callHook$1(vm, 'activated');
3193 }
3194 }
3195 function deactivateChildComponent(vm, direct) {
3196 if (direct) {
3197 vm._directInactive = true;
3198 if (isInInactiveTree(vm)) {
3199 return;
3200 }
3201 }
3202 if (!vm._inactive) {
3203 vm._inactive = true;
3204 for (var i = 0; i < vm.$children.length; i++) {
3205 deactivateChildComponent(vm.$children[i]);
3206 }
3207 callHook$1(vm, 'deactivated');
3208 }
3209 }
3210 function callHook$1(vm, hook, args, setContext) {
3211 if (setContext === void 0) { setContext = true; }
3212 // #7573 disable dep collection when invoking lifecycle hooks
3213 pushTarget();
3214 var prevInst = currentInstance;
3215 var prevScope = getCurrentScope();
3216 setContext && setCurrentInstance(vm);
3217 var handlers = vm.$options[hook];
3218 var info = "".concat(hook, " hook");
3219 if (handlers) {
3220 for (var i = 0, j = handlers.length; i < j; i++) {
3221 invokeWithErrorHandling(handlers[i], vm, args || null, vm, info);
3222 }
3223 }
3224 if (vm._hasHookEvent) {
3225 vm.$emit('hook:' + hook);
3226 }
3227 if (setContext) {
3228 setCurrentInstance(prevInst);
3229 prevScope && prevScope.on();
3230 }
3231 popTarget();
3232 }
3233
3234 var MAX_UPDATE_COUNT = 100;
3235 var queue = [];
3236 var activatedChildren = [];
3237 var has = {};
3238 var circular = {};
3239 var waiting = false;
3240 var flushing = false;
3241 var index$1 = 0;
3242 /**
3243 * Reset the scheduler's state.
3244 */
3245 function resetSchedulerState() {
3246 index$1 = queue.length = activatedChildren.length = 0;
3247 has = {};
3248 {
3249 circular = {};
3250 }
3251 waiting = flushing = false;
3252 }
3253 // Async edge case #6566 requires saving the timestamp when event listeners are
3254 // attached. However, calling performance.now() has a perf overhead especially
3255 // if the page has thousands of event listeners. Instead, we take a timestamp
3256 // every time the scheduler flushes and use that for all event listeners
3257 // attached during that flush.
3258 var currentFlushTimestamp = 0;
3259 // Async edge case fix requires storing an event listener's attach timestamp.
3260 var getNow = Date.now;
3261 // Determine what event timestamp the browser is using. Annoyingly, the
3262 // timestamp can either be hi-res (relative to page load) or low-res
3263 // (relative to UNIX epoch), so in order to compare time we have to use the
3264 // same timestamp type when saving the flush timestamp.
3265 // All IE versions use low-res event timestamps, and have problematic clock
3266 // implementations (#9632)
3267 if (inBrowser && !isIE) {
3268 var performance_1 = window.performance;
3269 if (performance_1 &&
3270 typeof performance_1.now === 'function' &&
3271 getNow() > document.createEvent('Event').timeStamp) {
3272 // if the event timestamp, although evaluated AFTER the Date.now(), is
3273 // smaller than it, it means the event is using a hi-res timestamp,
3274 // and we need to use the hi-res version for event listener timestamps as
3275 // well.
3276 getNow = function () { return performance_1.now(); };
3277 }
3278 }
3279 var sortCompareFn = function (a, b) {
3280 if (a.post) {
3281 if (!b.post)
3282 return 1;
3283 }
3284 else if (b.post) {
3285 return -1;
3286 }
3287 return a.id - b.id;
3288 };
3289 /**
3290 * Flush both queues and run the watchers.
3291 */
3292 function flushSchedulerQueue() {
3293 currentFlushTimestamp = getNow();
3294 flushing = true;
3295 var watcher, id;
3296 // Sort queue before flush.
3297 // This ensures that:
3298 // 1. Components are updated from parent to child. (because parent is always
3299 // created before the child)
3300 // 2. A component's user watchers are run before its render watcher (because
3301 // user watchers are created before the render watcher)
3302 // 3. If a component is destroyed during a parent component's watcher run,
3303 // its watchers can be skipped.
3304 queue.sort(sortCompareFn);
3305 // do not cache length because more watchers might be pushed
3306 // as we run existing watchers
3307 for (index$1 = 0; index$1 < queue.length; index$1++) {
3308 watcher = queue[index$1];
3309 if (watcher.before) {
3310 watcher.before();
3311 }
3312 id = watcher.id;
3313 has[id] = null;
3314 watcher.run();
3315 // in dev build, check and stop circular updates.
3316 if (has[id] != null) {
3317 circular[id] = (circular[id] || 0) + 1;
3318 if (circular[id] > MAX_UPDATE_COUNT) {
3319 warn$2('You may have an infinite update loop ' +
3320 (watcher.user
3321 ? "in watcher with expression \"".concat(watcher.expression, "\"")
3322 : "in a component render function."), watcher.vm);
3323 break;
3324 }
3325 }
3326 }
3327 // keep copies of post queues before resetting state
3328 var activatedQueue = activatedChildren.slice();
3329 var updatedQueue = queue.slice();
3330 resetSchedulerState();
3331 // call component updated and activated hooks
3332 callActivatedHooks(activatedQueue);
3333 callUpdatedHooks(updatedQueue);
3334 cleanupDeps();
3335 // devtool hook
3336 /* istanbul ignore if */
3337 if (devtools && config.devtools) {
3338 devtools.emit('flush');
3339 }
3340 }
3341 function callUpdatedHooks(queue) {
3342 var i = queue.length;
3343 while (i--) {
3344 var watcher = queue[i];
3345 var vm = watcher.vm;
3346 if (vm && vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
3347 callHook$1(vm, 'updated');
3348 }
3349 }
3350 }
3351 /**
3352 * Queue a kept-alive component that was activated during patch.
3353 * The queue will be processed after the entire tree has been patched.
3354 */
3355 function queueActivatedComponent(vm) {
3356 // setting _inactive to false here so that a render function can
3357 // rely on checking whether it's in an inactive tree (e.g. router-view)
3358 vm._inactive = false;
3359 activatedChildren.push(vm);
3360 }
3361 function callActivatedHooks(queue) {
3362 for (var i = 0; i < queue.length; i++) {
3363 queue[i]._inactive = true;
3364 activateChildComponent(queue[i], true /* true */);
3365 }
3366 }
3367 /**
3368 * Push a watcher into the watcher queue.
3369 * Jobs with duplicate IDs will be skipped unless it's
3370 * pushed when the queue is being flushed.
3371 */
3372 function queueWatcher(watcher) {
3373 var id = watcher.id;
3374 if (has[id] != null) {
3375 return;
3376 }
3377 if (watcher === Dep.target && watcher.noRecurse) {
3378 return;
3379 }
3380 has[id] = true;
3381 if (!flushing) {
3382 queue.push(watcher);
3383 }
3384 else {
3385 // if already flushing, splice the watcher based on its id
3386 // if already past its id, it will be run next immediately.
3387 var i = queue.length - 1;
3388 while (i > index$1 && queue[i].id > watcher.id) {
3389 i--;
3390 }
3391 queue.splice(i + 1, 0, watcher);
3392 }
3393 // queue the flush
3394 if (!waiting) {
3395 waiting = true;
3396 if (!config.async) {
3397 flushSchedulerQueue();
3398 return;
3399 }
3400 nextTick(flushSchedulerQueue);
3401 }
3402 }
3403
3404 var WATCHER = "watcher";
3405 var WATCHER_CB = "".concat(WATCHER, " callback");
3406 var WATCHER_GETTER = "".concat(WATCHER, " getter");
3407 var WATCHER_CLEANUP = "".concat(WATCHER, " cleanup");
3408 // Simple effect.
3409 function watchEffect(effect, options) {
3410 return doWatch(effect, null, options);
3411 }
3412 function watchPostEffect(effect, options) {
3413 return doWatch(effect, null, (__assign(__assign({}, options), { flush: 'post' }) ));
3414 }
3415 function watchSyncEffect(effect, options) {
3416 return doWatch(effect, null, (__assign(__assign({}, options), { flush: 'sync' }) ));
3417 }
3418 // initial value for watchers to trigger on undefined initial values
3419 var INITIAL_WATCHER_VALUE = {};
3420 // implementation
3421 function watch(source, cb, options) {
3422 if (typeof cb !== 'function') {
3423 warn$2("`watch(fn, options?)` signature has been moved to a separate API. " +
3424 "Use `watchEffect(fn, options?)` instead. `watch` now only " +
3425 "supports `watch(source, cb, options?) signature.");
3426 }
3427 return doWatch(source, cb, options);
3428 }
3429 function doWatch(source, cb, _a) {
3430 var _b = _a === void 0 ? emptyObject : _a, immediate = _b.immediate, deep = _b.deep, _c = _b.flush, flush = _c === void 0 ? 'pre' : _c, onTrack = _b.onTrack, onTrigger = _b.onTrigger;
3431 if (!cb) {
3432 if (immediate !== undefined) {
3433 warn$2("watch() \"immediate\" option is only respected when using the " +
3434 "watch(source, callback, options?) signature.");
3435 }
3436 if (deep !== undefined) {
3437 warn$2("watch() \"deep\" option is only respected when using the " +
3438 "watch(source, callback, options?) signature.");
3439 }
3440 }
3441 var warnInvalidSource = function (s) {
3442 warn$2("Invalid watch source: ".concat(s, ". A watch source can only be a getter/effect ") +
3443 "function, a ref, a reactive object, or an array of these types.");
3444 };
3445 var instance = currentInstance;
3446 var call = function (fn, type, args) {
3447 if (args === void 0) { args = null; }
3448 var res = invokeWithErrorHandling(fn, null, args, instance, type);
3449 if (deep && res && res.__ob__)
3450 res.__ob__.dep.depend();
3451 return res;
3452 };
3453 var getter;
3454 var forceTrigger = false;
3455 var isMultiSource = false;
3456 if (isRef(source)) {
3457 getter = function () { return source.value; };
3458 forceTrigger = isShallow(source);
3459 }
3460 else if (isReactive(source)) {
3461 getter = function () {
3462 source.__ob__.dep.depend();
3463 return source;
3464 };
3465 deep = true;
3466 }
3467 else if (isArray(source)) {
3468 isMultiSource = true;
3469 forceTrigger = source.some(function (s) { return isReactive(s) || isShallow(s); });
3470 getter = function () {
3471 return source.map(function (s) {
3472 if (isRef(s)) {
3473 return s.value;
3474 }
3475 else if (isReactive(s)) {
3476 s.__ob__.dep.depend();
3477 return traverse(s);
3478 }
3479 else if (isFunction(s)) {
3480 return call(s, WATCHER_GETTER);
3481 }
3482 else {
3483 warnInvalidSource(s);
3484 }
3485 });
3486 };
3487 }
3488 else if (isFunction(source)) {
3489 if (cb) {
3490 // getter with cb
3491 getter = function () { return call(source, WATCHER_GETTER); };
3492 }
3493 else {
3494 // no cb -> simple effect
3495 getter = function () {
3496 if (instance && instance._isDestroyed) {
3497 return;
3498 }
3499 if (cleanup) {
3500 cleanup();
3501 }
3502 return call(source, WATCHER, [onCleanup]);
3503 };
3504 }
3505 }
3506 else {
3507 getter = noop;
3508 warnInvalidSource(source);
3509 }
3510 if (cb && deep) {
3511 var baseGetter_1 = getter;
3512 getter = function () { return traverse(baseGetter_1()); };
3513 }
3514 var cleanup;
3515 var onCleanup = function (fn) {
3516 cleanup = watcher.onStop = function () {
3517 call(fn, WATCHER_CLEANUP);
3518 };
3519 };
3520 // in SSR there is no need to setup an actual effect, and it should be noop
3521 // unless it's eager
3522 if (isServerRendering()) {
3523 // we will also not call the invalidate callback (+ runner is not set up)
3524 onCleanup = noop;
3525 if (!cb) {
3526 getter();
3527 }
3528 else if (immediate) {
3529 call(cb, WATCHER_CB, [
3530 getter(),
3531 isMultiSource ? [] : undefined,
3532 onCleanup
3533 ]);
3534 }
3535 return noop;
3536 }
3537 var watcher = new Watcher(currentInstance, getter, noop, {
3538 lazy: true
3539 });
3540 watcher.noRecurse = !cb;
3541 var oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
3542 // overwrite default run
3543 watcher.run = function () {
3544 if (!watcher.active) {
3545 return;
3546 }
3547 if (cb) {
3548 // watch(source, cb)
3549 var newValue = watcher.get();
3550 if (deep ||
3551 forceTrigger ||
3552 (isMultiSource
3553 ? newValue.some(function (v, i) {
3554 return hasChanged(v, oldValue[i]);
3555 })
3556 : hasChanged(newValue, oldValue))) {
3557 // cleanup before running cb again
3558 if (cleanup) {
3559 cleanup();
3560 }
3561 call(cb, WATCHER_CB, [
3562 newValue,
3563 // pass undefined as the old value when it's changed for the first time
3564 oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
3565 onCleanup
3566 ]);
3567 oldValue = newValue;
3568 }
3569 }
3570 else {
3571 // watchEffect
3572 watcher.get();
3573 }
3574 };
3575 if (flush === 'sync') {
3576 watcher.update = watcher.run;
3577 }
3578 else if (flush === 'post') {
3579 watcher.post = true;
3580 watcher.update = function () { return queueWatcher(watcher); };
3581 }
3582 else {
3583 // pre
3584 watcher.update = function () {
3585 if (instance && instance === currentInstance && !instance._isMounted) {
3586 // pre-watcher triggered before
3587 var buffer = instance._preWatchers || (instance._preWatchers = []);
3588 if (buffer.indexOf(watcher) < 0)
3589 buffer.push(watcher);
3590 }
3591 else {
3592 queueWatcher(watcher);
3593 }
3594 };
3595 }
3596 {
3597 watcher.onTrack = onTrack;
3598 watcher.onTrigger = onTrigger;
3599 }
3600 // initial run
3601 if (cb) {
3602 if (immediate) {
3603 watcher.run();
3604 }
3605 else {
3606 oldValue = watcher.get();
3607 }
3608 }
3609 else if (flush === 'post' && instance) {
3610 instance.$once('hook:mounted', function () { return watcher.get(); });
3611 }
3612 else {
3613 watcher.get();
3614 }
3615 return function () {
3616 watcher.teardown();
3617 };
3618 }
3619
3620 function provide(key, value) {
3621 if (!currentInstance) {
3622 {
3623 warn$2("provide() can only be used inside setup().");
3624 }
3625 }
3626 else {
3627 // TS doesn't allow symbol as index type
3628 resolveProvided(currentInstance)[key] = value;
3629 }
3630 }
3631 function resolveProvided(vm) {
3632 // by default an instance inherits its parent's provides object
3633 // but when it needs to provide values of its own, it creates its
3634 // own provides object using parent provides object as prototype.
3635 // this way in `inject` we can simply look up injections from direct
3636 // parent and let the prototype chain do the work.
3637 var existing = vm._provided;
3638 var parentProvides = vm.$parent && vm.$parent._provided;
3639 if (parentProvides === existing) {
3640 return (vm._provided = Object.create(parentProvides));
3641 }
3642 else {
3643 return existing;
3644 }
3645 }
3646 function inject(key, defaultValue, treatDefaultAsFactory) {
3647 if (treatDefaultAsFactory === void 0) { treatDefaultAsFactory = false; }
3648 // fallback to `currentRenderingInstance` so that this can be called in
3649 // a functional component
3650 var instance = currentInstance;
3651 if (instance) {
3652 // #2400
3653 // to support `app.use` plugins,
3654 // fallback to appContext's `provides` if the instance is at root
3655 var provides = instance.$parent && instance.$parent._provided;
3656 if (provides && key in provides) {
3657 // TS doesn't allow symbol as index type
3658 return provides[key];
3659 }
3660 else if (arguments.length > 1) {
3661 return treatDefaultAsFactory && isFunction(defaultValue)
3662 ? defaultValue.call(instance)
3663 : defaultValue;
3664 }
3665 else {
3666 warn$2("injection \"".concat(String(key), "\" not found."));
3667 }
3668 }
3669 else {
3670 warn$2("inject() can only be used inside setup() or functional components.");
3671 }
3672 }
3673
3674 /**
3675 * @internal this function needs manual public type declaration because it relies
3676 * on previously manually authored types from Vue 2
3677 */
3678 function h(type, props, children) {
3679 if (!currentInstance) {
3680 warn$2("globally imported h() can only be invoked when there is an active " +
3681 "component instance, e.g. synchronously in a component's render or setup function.");
3682 }
3683 return createElement$1(currentInstance, type, props, children, 2, true);
3684 }
3685
3686 function handleError(err, vm, info) {
3687 // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
3688 // See: https://github.com/vuejs/vuex/issues/1505
3689 pushTarget();
3690 try {
3691 if (vm) {
3692 var cur = vm;
3693 while ((cur = cur.$parent)) {
3694 var hooks = cur.$options.errorCaptured;
3695 if (hooks) {
3696 for (var i = 0; i < hooks.length; i++) {
3697 try {
3698 var capture = hooks[i].call(cur, err, vm, info) === false;
3699 if (capture)
3700 return;
3701 }
3702 catch (e) {
3703 globalHandleError(e, cur, 'errorCaptured hook');
3704 }
3705 }
3706 }
3707 }
3708 }
3709 globalHandleError(err, vm, info);
3710 }
3711 finally {
3712 popTarget();
3713 }
3714 }
3715 function invokeWithErrorHandling(handler, context, args, vm, info) {
3716 var res;
3717 try {
3718 res = args ? handler.apply(context, args) : handler.call(context);
3719 if (res && !res._isVue && isPromise(res) && !res._handled) {
3720 res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
3721 res._handled = true;
3722 }
3723 }
3724 catch (e) {
3725 handleError(e, vm, info);
3726 }
3727 return res;
3728 }
3729 function globalHandleError(err, vm, info) {
3730 if (config.errorHandler) {
3731 try {
3732 return config.errorHandler.call(null, err, vm, info);
3733 }
3734 catch (e) {
3735 // if the user intentionally throws the original error in the handler,
3736 // do not log it twice
3737 if (e !== err) {
3738 logError(e, null, 'config.errorHandler');
3739 }
3740 }
3741 }
3742 logError(err, vm, info);
3743 }
3744 function logError(err, vm, info) {
3745 {
3746 warn$2("Error in ".concat(info, ": \"").concat(err.toString(), "\""), vm);
3747 }
3748 /* istanbul ignore else */
3749 if (inBrowser && typeof console !== 'undefined') {
3750 console.error(err);
3751 }
3752 else {
3753 throw err;
3754 }
3755 }
3756
3757 /* globals MutationObserver */
3758 var isUsingMicroTask = false;
3759 var callbacks = [];
3760 var pending = false;
3761 function flushCallbacks() {
3762 pending = false;
3763 var copies = callbacks.slice(0);
3764 callbacks.length = 0;
3765 for (var i = 0; i < copies.length; i++) {
3766 copies[i]();
3767 }
3768 }
3769 // Here we have async deferring wrappers using microtasks.
3770 // In 2.5 we used (macro) tasks (in combination with microtasks).
3771 // However, it has subtle problems when state is changed right before repaint
3772 // (e.g. #6813, out-in transitions).
3773 // Also, using (macro) tasks in event handler would cause some weird behaviors
3774 // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
3775 // So we now use microtasks everywhere, again.
3776 // A major drawback of this tradeoff is that there are some scenarios
3777 // where microtasks have too high a priority and fire in between supposedly
3778 // sequential events (e.g. #4521, #6690, which have workarounds)
3779 // or even between bubbling of the same event (#6566).
3780 var timerFunc;
3781 // The nextTick behavior leverages the microtask queue, which can be accessed
3782 // via either native Promise.then or MutationObserver.
3783 // MutationObserver has wider support, however it is seriously bugged in
3784 // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
3785 // completely stops working after triggering a few times... so, if native
3786 // Promise is available, we will use it:
3787 /* istanbul ignore next, $flow-disable-line */
3788 if (typeof Promise !== 'undefined' && isNative(Promise)) {
3789 var p_1 = Promise.resolve();
3790 timerFunc = function () {
3791 p_1.then(flushCallbacks);
3792 // In problematic UIWebViews, Promise.then doesn't completely break, but
3793 // it can get stuck in a weird state where callbacks are pushed into the
3794 // microtask queue but the queue isn't being flushed, until the browser
3795 // needs to do some other work, e.g. handle a timer. Therefore we can
3796 // "force" the microtask queue to be flushed by adding an empty timer.
3797 if (isIOS)
3798 setTimeout(noop);
3799 };
3800 isUsingMicroTask = true;
3801 }
3802 else if (!isIE &&
3803 typeof MutationObserver !== 'undefined' &&
3804 (isNative(MutationObserver) ||
3805 // PhantomJS and iOS 7.x
3806 MutationObserver.toString() === '[object MutationObserverConstructor]')) {
3807 // Use MutationObserver where native Promise is not available,
3808 // e.g. PhantomJS, iOS7, Android 4.4
3809 // (#6466 MutationObserver is unreliable in IE11)
3810 var counter_1 = 1;
3811 var observer = new MutationObserver(flushCallbacks);
3812 var textNode_1 = document.createTextNode(String(counter_1));
3813 observer.observe(textNode_1, {
3814 characterData: true
3815 });
3816 timerFunc = function () {
3817 counter_1 = (counter_1 + 1) % 2;
3818 textNode_1.data = String(counter_1);
3819 };
3820 isUsingMicroTask = true;
3821 }
3822 else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
3823 // Fallback to setImmediate.
3824 // Technically it leverages the (macro) task queue,
3825 // but it is still a better choice than setTimeout.
3826 timerFunc = function () {
3827 setImmediate(flushCallbacks);
3828 };
3829 }
3830 else {
3831 // Fallback to setTimeout.
3832 timerFunc = function () {
3833 setTimeout(flushCallbacks, 0);
3834 };
3835 }
3836 /**
3837 * @internal
3838 */
3839 function nextTick(cb, ctx) {
3840 var _resolve;
3841 callbacks.push(function () {
3842 if (cb) {
3843 try {
3844 cb.call(ctx);
3845 }
3846 catch (e) {
3847 handleError(e, ctx, 'nextTick');
3848 }
3849 }
3850 else if (_resolve) {
3851 _resolve(ctx);
3852 }
3853 });
3854 if (!pending) {
3855 pending = true;
3856 timerFunc();
3857 }
3858 // $flow-disable-line
3859 if (!cb && typeof Promise !== 'undefined') {
3860 return new Promise(function (resolve) {
3861 _resolve = resolve;
3862 });
3863 }
3864 }
3865
3866 function useCssModule(name) {
3867 /* istanbul ignore else */
3868 {
3869 {
3870 warn$2("useCssModule() is not supported in the global build.");
3871 }
3872 return emptyObject;
3873 }
3874 }
3875
3876 /**
3877 * Runtime helper for SFC's CSS variable injection feature.
3878 * @private
3879 */
3880 function useCssVars(getter) {
3881 if (!inBrowser && !false)
3882 return;
3883 var instance = currentInstance;
3884 if (!instance) {
3885 warn$2("useCssVars is called without current active component instance.");
3886 return;
3887 }
3888 watchPostEffect(function () {
3889 var el = instance.$el;
3890 var vars = getter(instance, instance._setupProxy);
3891 if (el && el.nodeType === 1) {
3892 var style = el.style;
3893 for (var key in vars) {
3894 style.setProperty("--".concat(key), vars[key]);
3895 }
3896 }
3897 });
3898 }
3899
3900 /**
3901 * v3-compatible async component API.
3902 * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
3903 * because it relies on existing manual types
3904 */
3905 function defineAsyncComponent(source) {
3906 if (isFunction(source)) {
3907 source = { loader: source };
3908 }
3909 var loader = source.loader, loadingComponent = source.loadingComponent, errorComponent = source.errorComponent, _a = source.delay, delay = _a === void 0 ? 200 : _a, timeout = source.timeout, // undefined = never times out
3910 _b = source.suspensible, // undefined = never times out
3911 suspensible = _b === void 0 ? false : _b, // in Vue 3 default is true
3912 userOnError = source.onError;
3913 if (suspensible) {
3914 warn$2("The suspensible option for async components is not supported in Vue2. It is ignored.");
3915 }
3916 var pendingRequest = null;
3917 var retries = 0;
3918 var retry = function () {
3919 retries++;
3920 pendingRequest = null;
3921 return load();
3922 };
3923 var load = function () {
3924 var thisRequest;
3925 return (pendingRequest ||
3926 (thisRequest = pendingRequest =
3927 loader()
3928 .catch(function (err) {
3929 err = err instanceof Error ? err : new Error(String(err));
3930 if (userOnError) {
3931 return new Promise(function (resolve, reject) {
3932 var userRetry = function () { return resolve(retry()); };
3933 var userFail = function () { return reject(err); };
3934 userOnError(err, userRetry, userFail, retries + 1);
3935 });
3936 }
3937 else {
3938 throw err;
3939 }
3940 })
3941 .then(function (comp) {
3942 if (thisRequest !== pendingRequest && pendingRequest) {
3943 return pendingRequest;
3944 }
3945 if (!comp) {
3946 warn$2("Async component loader resolved to undefined. " +
3947 "If you are using retry(), make sure to return its return value.");
3948 }
3949 // interop module default
3950 if (comp &&
3951 (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
3952 comp = comp.default;
3953 }
3954 if (comp && !isObject(comp) && !isFunction(comp)) {
3955 throw new Error("Invalid async component load result: ".concat(comp));
3956 }
3957 return comp;
3958 })));
3959 };
3960 return function () {
3961 var component = load();
3962 return {
3963 component: component,
3964 delay: delay,
3965 timeout: timeout,
3966 error: errorComponent,
3967 loading: loadingComponent
3968 };
3969 };
3970 }
3971
3972 function createLifeCycle(hookName) {
3973 return function (fn, target) {
3974 if (target === void 0) { target = currentInstance; }
3975 if (!target) {
3976 warn$2("".concat(formatName(hookName), " is called when there is no active component instance to be ") +
3977 "associated with. " +
3978 "Lifecycle injection APIs can only be used during execution of setup().");
3979 return;
3980 }
3981 return injectHook(target, hookName, fn);
3982 };
3983 }
3984 function formatName(name) {
3985 if (name === 'beforeDestroy') {
3986 name = 'beforeUnmount';
3987 }
3988 else if (name === 'destroyed') {
3989 name = 'unmounted';
3990 }
3991 return "on".concat(name[0].toUpperCase() + name.slice(1));
3992 }
3993 function injectHook(instance, hookName, fn) {
3994 var options = instance.$options;
3995 options[hookName] = mergeLifecycleHook(options[hookName], fn);
3996 }
3997 var onBeforeMount = createLifeCycle('beforeMount');
3998 var onMounted = createLifeCycle('mounted');
3999 var onBeforeUpdate = createLifeCycle('beforeUpdate');
4000 var onUpdated = createLifeCycle('updated');
4001 var onBeforeUnmount = createLifeCycle('beforeDestroy');
4002 var onUnmounted = createLifeCycle('destroyed');
4003 var onActivated = createLifeCycle('activated');
4004 var onDeactivated = createLifeCycle('deactivated');
4005 var onServerPrefetch = createLifeCycle('serverPrefetch');
4006 var onRenderTracked = createLifeCycle('renderTracked');
4007 var onRenderTriggered = createLifeCycle('renderTriggered');
4008 var injectErrorCapturedHook = createLifeCycle('errorCaptured');
4009 function onErrorCaptured(hook, target) {
4010 if (target === void 0) { target = currentInstance; }
4011 injectErrorCapturedHook(hook, target);
4012 }
4013
4014 /**
4015 * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
4016 */
4017 var version = '2.7.16';
4018 /**
4019 * @internal type is manually declared in <root>/types/v3-define-component.d.ts
4020 */
4021 function defineComponent(options) {
4022 return options;
4023 }
4024
4025 var vca = /*#__PURE__*/Object.freeze({
4026 __proto__: null,
4027 version: version,
4028 defineComponent: defineComponent,
4029 ref: ref$1,
4030 shallowRef: shallowRef,
4031 isRef: isRef,
4032 toRef: toRef,
4033 toRefs: toRefs,
4034 unref: unref,
4035 proxyRefs: proxyRefs,
4036 customRef: customRef,
4037 triggerRef: triggerRef,
4038 reactive: reactive,
4039 isReactive: isReactive,
4040 isReadonly: isReadonly,
4041 isShallow: isShallow,
4042 isProxy: isProxy,
4043 shallowReactive: shallowReactive,
4044 markRaw: markRaw,
4045 toRaw: toRaw,
4046 readonly: readonly,
4047 shallowReadonly: shallowReadonly,
4048 computed: computed,
4049 watch: watch,
4050 watchEffect: watchEffect,
4051 watchPostEffect: watchPostEffect,
4052 watchSyncEffect: watchSyncEffect,
4053 EffectScope: EffectScope,
4054 effectScope: effectScope,
4055 onScopeDispose: onScopeDispose,
4056 getCurrentScope: getCurrentScope,
4057 provide: provide,
4058 inject: inject,
4059 h: h,
4060 getCurrentInstance: getCurrentInstance,
4061 useSlots: useSlots,
4062 useAttrs: useAttrs,
4063 useListeners: useListeners,
4064 mergeDefaults: mergeDefaults,
4065 nextTick: nextTick,
4066 set: set,
4067 del: del,
4068 useCssModule: useCssModule,
4069 useCssVars: useCssVars,
4070 defineAsyncComponent: defineAsyncComponent,
4071 onBeforeMount: onBeforeMount,
4072 onMounted: onMounted,
4073 onBeforeUpdate: onBeforeUpdate,
4074 onUpdated: onUpdated,
4075 onBeforeUnmount: onBeforeUnmount,
4076 onUnmounted: onUnmounted,
4077 onActivated: onActivated,
4078 onDeactivated: onDeactivated,
4079 onServerPrefetch: onServerPrefetch,
4080 onRenderTracked: onRenderTracked,
4081 onRenderTriggered: onRenderTriggered,
4082 onErrorCaptured: onErrorCaptured
4083 });
4084
4085 var seenObjects = new _Set();
4086 /**
4087 * Recursively traverse an object to evoke all converted
4088 * getters, so that every nested property inside the object
4089 * is collected as a "deep" dependency.
4090 */
4091 function traverse(val) {
4092 _traverse(val, seenObjects);
4093 seenObjects.clear();
4094 return val;
4095 }
4096 function _traverse(val, seen) {
4097 var i, keys;
4098 var isA = isArray(val);
4099 if ((!isA && !isObject(val)) ||
4100 val.__v_skip /* ReactiveFlags.SKIP */ ||
4101 Object.isFrozen(val) ||
4102 val instanceof VNode) {
4103 return;
4104 }
4105 if (val.__ob__) {
4106 var depId = val.__ob__.dep.id;
4107 if (seen.has(depId)) {
4108 return;
4109 }
4110 seen.add(depId);
4111 }
4112 if (isA) {
4113 i = val.length;
4114 while (i--)
4115 _traverse(val[i], seen);
4116 }
4117 else if (isRef(val)) {
4118 _traverse(val.value, seen);
4119 }
4120 else {
4121 keys = Object.keys(val);
4122 i = keys.length;
4123 while (i--)
4124 _traverse(val[keys[i]], seen);
4125 }
4126 }
4127
4128 var uid$1 = 0;
4129 /**
4130 * A watcher parses an expression, collects dependencies,
4131 * and fires callback when the expression value changes.
4132 * This is used for both the $watch() api and directives.
4133 * @internal
4134 */
4135 var Watcher = /** @class */ (function () {
4136 function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {
4137 recordEffectScope(this,
4138 // if the active effect scope is manually created (not a component scope),
4139 // prioritize it
4140 activeEffectScope && !activeEffectScope._vm
4141 ? activeEffectScope
4142 : vm
4143 ? vm._scope
4144 : undefined);
4145 if ((this.vm = vm) && isRenderWatcher) {
4146 vm._watcher = this;
4147 }
4148 // options
4149 if (options) {
4150 this.deep = !!options.deep;
4151 this.user = !!options.user;
4152 this.lazy = !!options.lazy;
4153 this.sync = !!options.sync;
4154 this.before = options.before;
4155 {
4156 this.onTrack = options.onTrack;
4157 this.onTrigger = options.onTrigger;
4158 }
4159 }
4160 else {
4161 this.deep = this.user = this.lazy = this.sync = false;
4162 }
4163 this.cb = cb;
4164 this.id = ++uid$1; // uid for batching
4165 this.active = true;
4166 this.post = false;
4167 this.dirty = this.lazy; // for lazy watchers
4168 this.deps = [];
4169 this.newDeps = [];
4170 this.depIds = new _Set();
4171 this.newDepIds = new _Set();
4172 this.expression = expOrFn.toString() ;
4173 // parse expression for getter
4174 if (isFunction(expOrFn)) {
4175 this.getter = expOrFn;
4176 }
4177 else {
4178 this.getter = parsePath(expOrFn);
4179 if (!this.getter) {
4180 this.getter = noop;
4181 warn$2("Failed watching path: \"".concat(expOrFn, "\" ") +
4182 'Watcher only accepts simple dot-delimited paths. ' +
4183 'For full control, use a function instead.', vm);
4184 }
4185 }
4186 this.value = this.lazy ? undefined : this.get();
4187 }
4188 /**
4189 * Evaluate the getter, and re-collect dependencies.
4190 */
4191 Watcher.prototype.get = function () {
4192 pushTarget(this);
4193 var value;
4194 var vm = this.vm;
4195 try {
4196 value = this.getter.call(vm, vm);
4197 }
4198 catch (e) {
4199 if (this.user) {
4200 handleError(e, vm, "getter for watcher \"".concat(this.expression, "\""));
4201 }
4202 else {
4203 throw e;
4204 }
4205 }
4206 finally {
4207 // "touch" every property so they are all tracked as
4208 // dependencies for deep watching
4209 if (this.deep) {
4210 traverse(value);
4211 }
4212 popTarget();
4213 this.cleanupDeps();
4214 }
4215 return value;
4216 };
4217 /**
4218 * Add a dependency to this directive.
4219 */
4220 Watcher.prototype.addDep = function (dep) {
4221 var id = dep.id;
4222 if (!this.newDepIds.has(id)) {
4223 this.newDepIds.add(id);
4224 this.newDeps.push(dep);
4225 if (!this.depIds.has(id)) {
4226 dep.addSub(this);
4227 }
4228 }
4229 };
4230 /**
4231 * Clean up for dependency collection.
4232 */
4233 Watcher.prototype.cleanupDeps = function () {
4234 var i = this.deps.length;
4235 while (i--) {
4236 var dep = this.deps[i];
4237 if (!this.newDepIds.has(dep.id)) {
4238 dep.removeSub(this);
4239 }
4240 }
4241 var tmp = this.depIds;
4242 this.depIds = this.newDepIds;
4243 this.newDepIds = tmp;
4244 this.newDepIds.clear();
4245 tmp = this.deps;
4246 this.deps = this.newDeps;
4247 this.newDeps = tmp;
4248 this.newDeps.length = 0;
4249 };
4250 /**
4251 * Subscriber interface.
4252 * Will be called when a dependency changes.
4253 */
4254 Watcher.prototype.update = function () {
4255 /* istanbul ignore else */
4256 if (this.lazy) {
4257 this.dirty = true;
4258 }
4259 else if (this.sync) {
4260 this.run();
4261 }
4262 else {
4263 queueWatcher(this);
4264 }
4265 };
4266 /**
4267 * Scheduler job interface.
4268 * Will be called by the scheduler.
4269 */
4270 Watcher.prototype.run = function () {
4271 if (this.active) {
4272 var value = this.get();
4273 if (value !== this.value ||
4274 // Deep watchers and watchers on Object/Arrays should fire even
4275 // when the value is the same, because the value may
4276 // have mutated.
4277 isObject(value) ||
4278 this.deep) {
4279 // set new value
4280 var oldValue = this.value;
4281 this.value = value;
4282 if (this.user) {
4283 var info = "callback for watcher \"".concat(this.expression, "\"");
4284 invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
4285 }
4286 else {
4287 this.cb.call(this.vm, value, oldValue);
4288 }
4289 }
4290 }
4291 };
4292 /**
4293 * Evaluate the value of the watcher.
4294 * This only gets called for lazy watchers.
4295 */
4296 Watcher.prototype.evaluate = function () {
4297 this.value = this.get();
4298 this.dirty = false;
4299 };
4300 /**
4301 * Depend on all deps collected by this watcher.
4302 */
4303 Watcher.prototype.depend = function () {
4304 var i = this.deps.length;
4305 while (i--) {
4306 this.deps[i].depend();
4307 }
4308 };
4309 /**
4310 * Remove self from all dependencies' subscriber list.
4311 */
4312 Watcher.prototype.teardown = function () {
4313 if (this.vm && !this.vm._isBeingDestroyed) {
4314 remove$2(this.vm._scope.effects, this);
4315 }
4316 if (this.active) {
4317 var i = this.deps.length;
4318 while (i--) {
4319 this.deps[i].removeSub(this);
4320 }
4321 this.active = false;
4322 if (this.onStop) {
4323 this.onStop();
4324 }
4325 }
4326 };
4327 return Watcher;
4328 }());
4329
4330 var sharedPropertyDefinition = {
4331 enumerable: true,
4332 configurable: true,
4333 get: noop,
4334 set: noop
4335 };
4336 function proxy(target, sourceKey, key) {
4337 sharedPropertyDefinition.get = function proxyGetter() {
4338 return this[sourceKey][key];
4339 };
4340 sharedPropertyDefinition.set = function proxySetter(val) {
4341 this[sourceKey][key] = val;
4342 };
4343 Object.defineProperty(target, key, sharedPropertyDefinition);
4344 }
4345 function initState(vm) {
4346 var opts = vm.$options;
4347 if (opts.props)
4348 initProps$1(vm, opts.props);
4349 // Composition API
4350 initSetup(vm);
4351 if (opts.methods)
4352 initMethods(vm, opts.methods);
4353 if (opts.data) {
4354 initData(vm);
4355 }
4356 else {
4357 var ob = observe((vm._data = {}));
4358 ob && ob.vmCount++;
4359 }
4360 if (opts.computed)
4361 initComputed$1(vm, opts.computed);
4362 if (opts.watch && opts.watch !== nativeWatch) {
4363 initWatch(vm, opts.watch);
4364 }
4365 }
4366 function initProps$1(vm, propsOptions) {
4367 var propsData = vm.$options.propsData || {};
4368 var props = (vm._props = shallowReactive({}));
4369 // cache prop keys so that future props updates can iterate using Array
4370 // instead of dynamic object key enumeration.
4371 var keys = (vm.$options._propKeys = []);
4372 var isRoot = !vm.$parent;
4373 // root instance props should be converted
4374 if (!isRoot) {
4375 toggleObserving(false);
4376 }
4377 var _loop_1 = function (key) {
4378 keys.push(key);
4379 var value = validateProp(key, propsOptions, propsData, vm);
4380 /* istanbul ignore else */
4381 {
4382 var hyphenatedKey = hyphenate(key);
4383 if (isReservedAttribute(hyphenatedKey) ||
4384 config.isReservedAttr(hyphenatedKey)) {
4385 warn$2("\"".concat(hyphenatedKey, "\" is a reserved attribute and cannot be used as component prop."), vm);
4386 }
4387 defineReactive(props, key, value, function () {
4388 if (!isRoot && !isUpdatingChildComponent) {
4389 warn$2("Avoid mutating a prop directly since the value will be " +
4390 "overwritten whenever the parent component re-renders. " +
4391 "Instead, use a data or computed property based on the prop's " +
4392 "value. Prop being mutated: \"".concat(key, "\""), vm);
4393 }
4394 }, true /* shallow */);
4395 }
4396 // static props are already proxied on the component's prototype
4397 // during Vue.extend(). We only need to proxy props defined at
4398 // instantiation here.
4399 if (!(key in vm)) {
4400 proxy(vm, "_props", key);
4401 }
4402 };
4403 for (var key in propsOptions) {
4404 _loop_1(key);
4405 }
4406 toggleObserving(true);
4407 }
4408 function initData(vm) {
4409 var data = vm.$options.data;
4410 data = vm._data = isFunction(data) ? getData(data, vm) : data || {};
4411 if (!isPlainObject(data)) {
4412 data = {};
4413 warn$2('data functions should return an object:\n' +
4414 'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
4415 }
4416 // proxy data on instance
4417 var keys = Object.keys(data);
4418 var props = vm.$options.props;
4419 var methods = vm.$options.methods;
4420 var i = keys.length;
4421 while (i--) {
4422 var key = keys[i];
4423 {
4424 if (methods && hasOwn(methods, key)) {
4425 warn$2("Method \"".concat(key, "\" has already been defined as a data property."), vm);
4426 }
4427 }
4428 if (props && hasOwn(props, key)) {
4429 warn$2("The data property \"".concat(key, "\" is already declared as a prop. ") +
4430 "Use prop default value instead.", vm);
4431 }
4432 else if (!isReserved(key)) {
4433 proxy(vm, "_data", key);
4434 }
4435 }
4436 // observe data
4437 var ob = observe(data);
4438 ob && ob.vmCount++;
4439 }
4440 function getData(data, vm) {
4441 // #7573 disable dep collection when invoking data getters
4442 pushTarget();
4443 try {
4444 return data.call(vm, vm);
4445 }
4446 catch (e) {
4447 handleError(e, vm, "data()");
4448 return {};
4449 }
4450 finally {
4451 popTarget();
4452 }
4453 }
4454 var computedWatcherOptions = { lazy: true };
4455 function initComputed$1(vm, computed) {
4456 // $flow-disable-line
4457 var watchers = (vm._computedWatchers = Object.create(null));
4458 // computed properties are just getters during SSR
4459 var isSSR = isServerRendering();
4460 for (var key in computed) {
4461 var userDef = computed[key];
4462 var getter = isFunction(userDef) ? userDef : userDef.get;
4463 if (getter == null) {
4464 warn$2("Getter is missing for computed property \"".concat(key, "\"."), vm);
4465 }
4466 if (!isSSR) {
4467 // create internal watcher for the computed property.
4468 watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
4469 }
4470 // component-defined computed properties are already defined on the
4471 // component prototype. We only need to define computed properties defined
4472 // at instantiation here.
4473 if (!(key in vm)) {
4474 defineComputed(vm, key, userDef);
4475 }
4476 else {
4477 if (key in vm.$data) {
4478 warn$2("The computed property \"".concat(key, "\" is already defined in data."), vm);
4479 }
4480 else if (vm.$options.props && key in vm.$options.props) {
4481 warn$2("The computed property \"".concat(key, "\" is already defined as a prop."), vm);
4482 }
4483 else if (vm.$options.methods && key in vm.$options.methods) {
4484 warn$2("The computed property \"".concat(key, "\" is already defined as a method."), vm);
4485 }
4486 }
4487 }
4488 }
4489 function defineComputed(target, key, userDef) {
4490 var shouldCache = !isServerRendering();
4491 if (isFunction(userDef)) {
4492 sharedPropertyDefinition.get = shouldCache
4493 ? createComputedGetter(key)
4494 : createGetterInvoker(userDef);
4495 sharedPropertyDefinition.set = noop;
4496 }
4497 else {
4498 sharedPropertyDefinition.get = userDef.get
4499 ? shouldCache && userDef.cache !== false
4500 ? createComputedGetter(key)
4501 : createGetterInvoker(userDef.get)
4502 : noop;
4503 sharedPropertyDefinition.set = userDef.set || noop;
4504 }
4505 if (sharedPropertyDefinition.set === noop) {
4506 sharedPropertyDefinition.set = function () {
4507 warn$2("Computed property \"".concat(key, "\" was assigned to but it has no setter."), this);
4508 };
4509 }
4510 Object.defineProperty(target, key, sharedPropertyDefinition);
4511 }
4512 function createComputedGetter(key) {
4513 return function computedGetter() {
4514 var watcher = this._computedWatchers && this._computedWatchers[key];
4515 if (watcher) {
4516 if (watcher.dirty) {
4517 watcher.evaluate();
4518 }
4519 if (Dep.target) {
4520 if (Dep.target.onTrack) {
4521 Dep.target.onTrack({
4522 effect: Dep.target,
4523 target: this,
4524 type: "get" /* TrackOpTypes.GET */,
4525 key: key
4526 });
4527 }
4528 watcher.depend();
4529 }
4530 return watcher.value;
4531 }
4532 };
4533 }
4534 function createGetterInvoker(fn) {
4535 return function computedGetter() {
4536 return fn.call(this, this);
4537 };
4538 }
4539 function initMethods(vm, methods) {
4540 var props = vm.$options.props;
4541 for (var key in methods) {
4542 {
4543 if (typeof methods[key] !== 'function') {
4544 warn$2("Method \"".concat(key, "\" has type \"").concat(typeof methods[key], "\" in the component definition. ") +
4545 "Did you reference the function correctly?", vm);
4546 }
4547 if (props && hasOwn(props, key)) {
4548 warn$2("Method \"".concat(key, "\" has already been defined as a prop."), vm);
4549 }
4550 if (key in vm && isReserved(key)) {
4551 warn$2("Method \"".concat(key, "\" conflicts with an existing Vue instance method. ") +
4552 "Avoid defining component methods that start with _ or $.");
4553 }
4554 }
4555 vm[key] = typeof methods[key] !== 'function' ? noop : bind$1(methods[key], vm);
4556 }
4557 }
4558 function initWatch(vm, watch) {
4559 for (var key in watch) {
4560 var handler = watch[key];
4561 if (isArray(handler)) {
4562 for (var i = 0; i < handler.length; i++) {
4563 createWatcher(vm, key, handler[i]);
4564 }
4565 }
4566 else {
4567 createWatcher(vm, key, handler);
4568 }
4569 }
4570 }
4571 function createWatcher(vm, expOrFn, handler, options) {
4572 if (isPlainObject(handler)) {
4573 options = handler;
4574 handler = handler.handler;
4575 }
4576 if (typeof handler === 'string') {
4577 handler = vm[handler];
4578 }
4579 return vm.$watch(expOrFn, handler, options);
4580 }
4581 function stateMixin(Vue) {
4582 // flow somehow has problems with directly declared definition object
4583 // when using Object.defineProperty, so we have to procedurally build up
4584 // the object here.
4585 var dataDef = {};
4586 dataDef.get = function () {
4587 return this._data;
4588 };
4589 var propsDef = {};
4590 propsDef.get = function () {
4591 return this._props;
4592 };
4593 {
4594 dataDef.set = function () {
4595 warn$2('Avoid replacing instance root $data. ' +
4596 'Use nested data properties instead.', this);
4597 };
4598 propsDef.set = function () {
4599 warn$2("$props is readonly.", this);
4600 };
4601 }
4602 Object.defineProperty(Vue.prototype, '$data', dataDef);
4603 Object.defineProperty(Vue.prototype, '$props', propsDef);
4604 Vue.prototype.$set = set;
4605 Vue.prototype.$delete = del;
4606 Vue.prototype.$watch = function (expOrFn, cb, options) {
4607 var vm = this;
4608 if (isPlainObject(cb)) {
4609 return createWatcher(vm, expOrFn, cb, options);
4610 }
4611 options = options || {};
4612 options.user = true;
4613 var watcher = new Watcher(vm, expOrFn, cb, options);
4614 if (options.immediate) {
4615 var info = "callback for immediate watcher \"".concat(watcher.expression, "\"");
4616 pushTarget();
4617 invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
4618 popTarget();
4619 }
4620 return function unwatchFn() {
4621 watcher.teardown();
4622 };
4623 };
4624 }
4625
4626 function initProvide(vm) {
4627 var provideOption = vm.$options.provide;
4628 if (provideOption) {
4629 var provided = isFunction(provideOption)
4630 ? provideOption.call(vm)
4631 : provideOption;
4632 if (!isObject(provided)) {
4633 return;
4634 }
4635 var source = resolveProvided(vm);
4636 // IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
4637 // iterate the keys ourselves.
4638 var keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
4639 for (var i = 0; i < keys.length; i++) {
4640 var key = keys[i];
4641 Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
4642 }
4643 }
4644 }
4645 function initInjections(vm) {
4646 var result = resolveInject(vm.$options.inject, vm);
4647 if (result) {
4648 toggleObserving(false);
4649 Object.keys(result).forEach(function (key) {
4650 /* istanbul ignore else */
4651 {
4652 defineReactive(vm, key, result[key], function () {
4653 warn$2("Avoid mutating an injected value directly since the changes will be " +
4654 "overwritten whenever the provided component re-renders. " +
4655 "injection being mutated: \"".concat(key, "\""), vm);
4656 });
4657 }
4658 });
4659 toggleObserving(true);
4660 }
4661 }
4662 function resolveInject(inject, vm) {
4663 if (inject) {
4664 // inject is :any because flow is not smart enough to figure out cached
4665 var result = Object.create(null);
4666 var keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
4667 for (var i = 0; i < keys.length; i++) {
4668 var key = keys[i];
4669 // #6574 in case the inject object is observed...
4670 if (key === '__ob__')
4671 continue;
4672 var provideKey = inject[key].from;
4673 if (provideKey in vm._provided) {
4674 result[key] = vm._provided[provideKey];
4675 }
4676 else if ('default' in inject[key]) {
4677 var provideDefault = inject[key].default;
4678 result[key] = isFunction(provideDefault)
4679 ? provideDefault.call(vm)
4680 : provideDefault;
4681 }
4682 else {
4683 warn$2("Injection \"".concat(key, "\" not found"), vm);
4684 }
4685 }
4686 return result;
4687 }
4688 }
4689
4690 var uid = 0;
4691 function initMixin$1(Vue) {
4692 Vue.prototype._init = function (options) {
4693 var vm = this;
4694 // a uid
4695 vm._uid = uid++;
4696 var startTag, endTag;
4697 /* istanbul ignore if */
4698 if (config.performance && mark) {
4699 startTag = "vue-perf-start:".concat(vm._uid);
4700 endTag = "vue-perf-end:".concat(vm._uid);
4701 mark(startTag);
4702 }
4703 // a flag to mark this as a Vue instance without having to do instanceof
4704 // check
4705 vm._isVue = true;
4706 // avoid instances from being observed
4707 vm.__v_skip = true;
4708 // effect scope
4709 vm._scope = new EffectScope(true /* detached */);
4710 // #13134 edge case where a child component is manually created during the
4711 // render of a parent component
4712 vm._scope.parent = undefined;
4713 vm._scope._vm = true;
4714 // merge options
4715 if (options && options._isComponent) {
4716 // optimize internal component instantiation
4717 // since dynamic options merging is pretty slow, and none of the
4718 // internal component options needs special treatment.
4719 initInternalComponent(vm, options);
4720 }
4721 else {
4722 vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm);
4723 }
4724 /* istanbul ignore else */
4725 {
4726 initProxy(vm);
4727 }
4728 // expose real self
4729 vm._self = vm;
4730 initLifecycle(vm);
4731 initEvents(vm);
4732 initRender(vm);
4733 callHook$1(vm, 'beforeCreate', undefined, false /* setContext */);
4734 initInjections(vm); // resolve injections before data/props
4735 initState(vm);
4736 initProvide(vm); // resolve provide after data/props
4737 callHook$1(vm, 'created');
4738 /* istanbul ignore if */
4739 if (config.performance && mark) {
4740 vm._name = formatComponentName(vm, false);
4741 mark(endTag);
4742 measure("vue ".concat(vm._name, " init"), startTag, endTag);
4743 }
4744 if (vm.$options.el) {
4745 vm.$mount(vm.$options.el);
4746 }
4747 };
4748 }
4749 function initInternalComponent(vm, options) {
4750 var opts = (vm.$options = Object.create(vm.constructor.options));
4751 // doing this because it's faster than dynamic enumeration.
4752 var parentVnode = options._parentVnode;
4753 opts.parent = options.parent;
4754 opts._parentVnode = parentVnode;
4755 var vnodeComponentOptions = parentVnode.componentOptions;
4756 opts.propsData = vnodeComponentOptions.propsData;
4757 opts._parentListeners = vnodeComponentOptions.listeners;
4758 opts._renderChildren = vnodeComponentOptions.children;
4759 opts._componentTag = vnodeComponentOptions.tag;
4760 if (options.render) {
4761 opts.render = options.render;
4762 opts.staticRenderFns = options.staticRenderFns;
4763 }
4764 }
4765 function resolveConstructorOptions(Ctor) {
4766 var options = Ctor.options;
4767 if (Ctor.super) {
4768 var superOptions = resolveConstructorOptions(Ctor.super);
4769 var cachedSuperOptions = Ctor.superOptions;
4770 if (superOptions !== cachedSuperOptions) {
4771 // super option changed,
4772 // need to resolve new options.
4773 Ctor.superOptions = superOptions;
4774 // check if there are any late-modified/attached options (#4976)
4775 var modifiedOptions = resolveModifiedOptions(Ctor);
4776 // update base extend options
4777 if (modifiedOptions) {
4778 extend(Ctor.extendOptions, modifiedOptions);
4779 }
4780 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
4781 if (options.name) {
4782 options.components[options.name] = Ctor;
4783 }
4784 }
4785 }
4786 return options;
4787 }
4788 function resolveModifiedOptions(Ctor) {
4789 var modified;
4790 var latest = Ctor.options;
4791 var sealed = Ctor.sealedOptions;
4792 for (var key in latest) {
4793 if (latest[key] !== sealed[key]) {
4794 if (!modified)
4795 modified = {};
4796 modified[key] = latest[key];
4797 }
4798 }
4799 return modified;
4800 }
4801
4802 function FunctionalRenderContext(data, props, children, parent, Ctor) {
4803 var _this = this;
4804 var options = Ctor.options;
4805 // ensure the createElement function in functional components
4806 // gets a unique context - this is necessary for correct named slot check
4807 var contextVm;
4808 if (hasOwn(parent, '_uid')) {
4809 contextVm = Object.create(parent);
4810 contextVm._original = parent;
4811 }
4812 else {
4813 // the context vm passed in is a functional context as well.
4814 // in this case we want to make sure we are able to get a hold to the
4815 // real context instance.
4816 contextVm = parent;
4817 // @ts-ignore
4818 parent = parent._original;
4819 }
4820 var isCompiled = isTrue(options._compiled);
4821 var needNormalization = !isCompiled;
4822 this.data = data;
4823 this.props = props;
4824 this.children = children;
4825 this.parent = parent;
4826 this.listeners = data.on || emptyObject;
4827 this.injections = resolveInject(options.inject, parent);
4828 this.slots = function () {
4829 if (!_this.$slots) {
4830 normalizeScopedSlots(parent, data.scopedSlots, (_this.$slots = resolveSlots(children, parent)));
4831 }
4832 return _this.$slots;
4833 };
4834 Object.defineProperty(this, 'scopedSlots', {
4835 enumerable: true,
4836 get: function () {
4837 return normalizeScopedSlots(parent, data.scopedSlots, this.slots());
4838 }
4839 });
4840 // support for compiled functional template
4841 if (isCompiled) {
4842 // exposing $options for renderStatic()
4843 this.$options = options;
4844 // pre-resolve slots for renderSlot()
4845 this.$slots = this.slots();
4846 this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots);
4847 }
4848 if (options._scopeId) {
4849 this._c = function (a, b, c, d) {
4850 var vnode = createElement$1(contextVm, a, b, c, d, needNormalization);
4851 if (vnode && !isArray(vnode)) {
4852 vnode.fnScopeId = options._scopeId;
4853 vnode.fnContext = parent;
4854 }
4855 return vnode;
4856 };
4857 }
4858 else {
4859 this._c = function (a, b, c, d) {
4860 return createElement$1(contextVm, a, b, c, d, needNormalization);
4861 };
4862 }
4863 }
4864 installRenderHelpers(FunctionalRenderContext.prototype);
4865 function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
4866 var options = Ctor.options;
4867 var props = {};
4868 var propOptions = options.props;
4869 if (isDef(propOptions)) {
4870 for (var key in propOptions) {
4871 props[key] = validateProp(key, propOptions, propsData || emptyObject);
4872 }
4873 }
4874 else {
4875 if (isDef(data.attrs))
4876 mergeProps(props, data.attrs);
4877 if (isDef(data.props))
4878 mergeProps(props, data.props);
4879 }
4880 var renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
4881 var vnode = options.render.call(null, renderContext._c, renderContext);
4882 if (vnode instanceof VNode) {
4883 return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
4884 }
4885 else if (isArray(vnode)) {
4886 var vnodes = normalizeChildren(vnode) || [];
4887 var res = new Array(vnodes.length);
4888 for (var i = 0; i < vnodes.length; i++) {
4889 res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
4890 }
4891 return res;
4892 }
4893 }
4894 function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
4895 // #7817 clone node before setting fnContext, otherwise if the node is reused
4896 // (e.g. it was from a cached normal slot) the fnContext causes named slots
4897 // that should not be matched to match.
4898 var clone = cloneVNode(vnode);
4899 clone.fnContext = contextVm;
4900 clone.fnOptions = options;
4901 {
4902 (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
4903 renderContext;
4904 }
4905 if (data.slot) {
4906 (clone.data || (clone.data = {})).slot = data.slot;
4907 }
4908 return clone;
4909 }
4910 function mergeProps(to, from) {
4911 for (var key in from) {
4912 to[camelize(key)] = from[key];
4913 }
4914 }
4915
4916 function getComponentName(options) {
4917 return options.name || options.__name || options._componentTag;
4918 }
4919 // inline hooks to be invoked on component VNodes during patch
4920 var componentVNodeHooks = {
4921 init: function (vnode, hydrating) {
4922 if (vnode.componentInstance &&
4923 !vnode.componentInstance._isDestroyed &&
4924 vnode.data.keepAlive) {
4925 // kept-alive components, treat as a patch
4926 var mountedNode = vnode; // work around flow
4927 componentVNodeHooks.prepatch(mountedNode, mountedNode);
4928 }
4929 else {
4930 var child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance));
4931 child.$mount(hydrating ? vnode.elm : undefined, hydrating);
4932 }
4933 },
4934 prepatch: function (oldVnode, vnode) {
4935 var options = vnode.componentOptions;
4936 var child = (vnode.componentInstance = oldVnode.componentInstance);
4937 updateChildComponent(child, options.propsData, // updated props
4938 options.listeners, // updated listeners
4939 vnode, // new parent vnode
4940 options.children // new children
4941 );
4942 },
4943 insert: function (vnode) {
4944 var context = vnode.context, componentInstance = vnode.componentInstance;
4945 if (!componentInstance._isMounted) {
4946 componentInstance._isMounted = true;
4947 callHook$1(componentInstance, 'mounted');
4948 }
4949 if (vnode.data.keepAlive) {
4950 if (context._isMounted) {
4951 // vue-router#1212
4952 // During updates, a kept-alive component's child components may
4953 // change, so directly walking the tree here may call activated hooks
4954 // on incorrect children. Instead we push them into a queue which will
4955 // be processed after the whole patch process ended.
4956 queueActivatedComponent(componentInstance);
4957 }
4958 else {
4959 activateChildComponent(componentInstance, true /* direct */);
4960 }
4961 }
4962 },
4963 destroy: function (vnode) {
4964 var componentInstance = vnode.componentInstance;
4965 if (!componentInstance._isDestroyed) {
4966 if (!vnode.data.keepAlive) {
4967 componentInstance.$destroy();
4968 }
4969 else {
4970 deactivateChildComponent(componentInstance, true /* direct */);
4971 }
4972 }
4973 }
4974 };
4975 var hooksToMerge = Object.keys(componentVNodeHooks);
4976 function createComponent(Ctor, data, context, children, tag) {
4977 if (isUndef(Ctor)) {
4978 return;
4979 }
4980 var baseCtor = context.$options._base;
4981 // plain options object: turn it into a constructor
4982 if (isObject(Ctor)) {
4983 Ctor = baseCtor.extend(Ctor);
4984 }
4985 // if at this stage it's not a constructor or an async component factory,
4986 // reject.
4987 if (typeof Ctor !== 'function') {
4988 {
4989 warn$2("Invalid Component definition: ".concat(String(Ctor)), context);
4990 }
4991 return;
4992 }
4993 // async component
4994 var asyncFactory;
4995 // @ts-expect-error
4996 if (isUndef(Ctor.cid)) {
4997 asyncFactory = Ctor;
4998 Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
4999 if (Ctor === undefined) {
5000 // return a placeholder node for async component, which is rendered
5001 // as a comment node but preserves all the raw information for the node.
5002 // the information will be used for async server-rendering and hydration.
5003 return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
5004 }
5005 }
5006 data = data || {};
5007 // resolve constructor options in case global mixins are applied after
5008 // component constructor creation
5009 resolveConstructorOptions(Ctor);
5010 // transform component v-model data into props & events
5011 if (isDef(data.model)) {
5012 // @ts-expect-error
5013 transformModel(Ctor.options, data);
5014 }
5015 // extract props
5016 // @ts-expect-error
5017 var propsData = extractPropsFromVNodeData(data, Ctor, tag);
5018 // functional component
5019 // @ts-expect-error
5020 if (isTrue(Ctor.options.functional)) {
5021 return createFunctionalComponent(Ctor, propsData, data, context, children);
5022 }
5023 // extract listeners, since these needs to be treated as
5024 // child component listeners instead of DOM listeners
5025 var listeners = data.on;
5026 // replace with listeners with .native modifier
5027 // so it gets processed during parent component patch.
5028 data.on = data.nativeOn;
5029 // @ts-expect-error
5030 if (isTrue(Ctor.options.abstract)) {
5031 // abstract components do not keep anything
5032 // other than props & listeners & slot
5033 // work around flow
5034 var slot = data.slot;
5035 data = {};
5036 if (slot) {
5037 data.slot = slot;
5038 }
5039 }
5040 // install component management hooks onto the placeholder node
5041 installComponentHooks(data);
5042 // return a placeholder vnode
5043 // @ts-expect-error
5044 var name = getComponentName(Ctor.options) || tag;
5045 var vnode = new VNode(
5046 // @ts-expect-error
5047 "vue-component-".concat(Ctor.cid).concat(name ? "-".concat(name) : ''), data, undefined, undefined, undefined, context,
5048 // @ts-expect-error
5049 { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, asyncFactory);
5050 return vnode;
5051 }
5052 function createComponentInstanceForVnode(
5053 // we know it's MountedComponentVNode but flow doesn't
5054 vnode,
5055 // activeInstance in lifecycle state
5056 parent) {
5057 var options = {
5058 _isComponent: true,
5059 _parentVnode: vnode,
5060 parent: parent
5061 };
5062 // check inline-template render functions
5063 var inlineTemplate = vnode.data.inlineTemplate;
5064 if (isDef(inlineTemplate)) {
5065 options.render = inlineTemplate.render;
5066 options.staticRenderFns = inlineTemplate.staticRenderFns;
5067 }
5068 return new vnode.componentOptions.Ctor(options);
5069 }
5070 function installComponentHooks(data) {
5071 var hooks = data.hook || (data.hook = {});
5072 for (var i = 0; i < hooksToMerge.length; i++) {
5073 var key = hooksToMerge[i];
5074 var existing = hooks[key];
5075 var toMerge = componentVNodeHooks[key];
5076 // @ts-expect-error
5077 if (existing !== toMerge && !(existing && existing._merged)) {
5078 hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge;
5079 }
5080 }
5081 }
5082 function mergeHook(f1, f2) {
5083 var merged = function (a, b) {
5084 // flow complains about extra args which is why we use any
5085 f1(a, b);
5086 f2(a, b);
5087 };
5088 merged._merged = true;
5089 return merged;
5090 }
5091 // transform component v-model info (value and callback) into
5092 // prop and event handler respectively.
5093 function transformModel(options, data) {
5094 var prop = (options.model && options.model.prop) || 'value';
5095 var event = (options.model && options.model.event) || 'input';
5096 (data.attrs || (data.attrs = {}))[prop] = data.model.value;
5097 var on = data.on || (data.on = {});
5098 var existing = on[event];
5099 var callback = data.model.callback;
5100 if (isDef(existing)) {
5101 if (isArray(existing)
5102 ? existing.indexOf(callback) === -1
5103 : existing !== callback) {
5104 on[event] = [callback].concat(existing);
5105 }
5106 }
5107 else {
5108 on[event] = callback;
5109 }
5110 }
5111
5112 var warn$2 = noop;
5113 var tip = noop;
5114 var generateComponentTrace; // work around flow check
5115 var formatComponentName;
5116 {
5117 var hasConsole_1 = typeof console !== 'undefined';
5118 var classifyRE_1 = /(?:^|[-_])(\w)/g;
5119 var classify_1 = function (str) {
5120 return str.replace(classifyRE_1, function (c) { return c.toUpperCase(); }).replace(/[-_]/g, '');
5121 };
5122 warn$2 = function (msg, vm) {
5123 if (vm === void 0) { vm = currentInstance; }
5124 var trace = vm ? generateComponentTrace(vm) : '';
5125 if (config.warnHandler) {
5126 config.warnHandler.call(null, msg, vm, trace);
5127 }
5128 else if (hasConsole_1 && !config.silent) {
5129 console.error("[Vue warn]: ".concat(msg).concat(trace));
5130 }
5131 };
5132 tip = function (msg, vm) {
5133 if (hasConsole_1 && !config.silent) {
5134 console.warn("[Vue tip]: ".concat(msg) + (vm ? generateComponentTrace(vm) : ''));
5135 }
5136 };
5137 formatComponentName = function (vm, includeFile) {
5138 if (vm.$root === vm) {
5139 return '<Root>';
5140 }
5141 var options = isFunction(vm) && vm.cid != null
5142 ? vm.options
5143 : vm._isVue
5144 ? vm.$options || vm.constructor.options
5145 : vm;
5146 var name = getComponentName(options);
5147 var file = options.__file;
5148 if (!name && file) {
5149 var match = file.match(/([^/\\]+)\.vue$/);
5150 name = match && match[1];
5151 }
5152 return ((name ? "<".concat(classify_1(name), ">") : "<Anonymous>") +
5153 (file && includeFile !== false ? " at ".concat(file) : ''));
5154 };
5155 var repeat_1 = function (str, n) {
5156 var res = '';
5157 while (n) {
5158 if (n % 2 === 1)
5159 res += str;
5160 if (n > 1)
5161 str += str;
5162 n >>= 1;
5163 }
5164 return res;
5165 };
5166 generateComponentTrace = function (vm) {
5167 if (vm._isVue && vm.$parent) {
5168 var tree = [];
5169 var currentRecursiveSequence = 0;
5170 while (vm) {
5171 if (tree.length > 0) {
5172 var last = tree[tree.length - 1];
5173 if (last.constructor === vm.constructor) {
5174 currentRecursiveSequence++;
5175 vm = vm.$parent;
5176 continue;
5177 }
5178 else if (currentRecursiveSequence > 0) {
5179 tree[tree.length - 1] = [last, currentRecursiveSequence];
5180 currentRecursiveSequence = 0;
5181 }
5182 }
5183 tree.push(vm);
5184 vm = vm.$parent;
5185 }
5186 return ('\n\nfound in\n\n' +
5187 tree
5188 .map(function (vm, i) {
5189 return "".concat(i === 0 ? '---> ' : repeat_1(' ', 5 + i * 2)).concat(isArray(vm)
5190 ? "".concat(formatComponentName(vm[0]), "... (").concat(vm[1], " recursive calls)")
5191 : formatComponentName(vm));
5192 })
5193 .join('\n'));
5194 }
5195 else {
5196 return "\n\n(found in ".concat(formatComponentName(vm), ")");
5197 }
5198 };
5199 }
5200
5201 /**
5202 * Option overwriting strategies are functions that handle
5203 * how to merge a parent option value and a child option
5204 * value into the final value.
5205 */
5206 var strats = config.optionMergeStrategies;
5207 /**
5208 * Options with restrictions
5209 */
5210 {
5211 strats.el = strats.propsData = function (parent, child, vm, key) {
5212 if (!vm) {
5213 warn$2("option \"".concat(key, "\" can only be used during instance ") +
5214 'creation with the `new` keyword.');
5215 }
5216 return defaultStrat(parent, child);
5217 };
5218 }
5219 /**
5220 * Helper that recursively merges two data objects together.
5221 */
5222 function mergeData(to, from, recursive) {
5223 if (recursive === void 0) { recursive = true; }
5224 if (!from)
5225 return to;
5226 var key, toVal, fromVal;
5227 var keys = hasSymbol
5228 ? Reflect.ownKeys(from)
5229 : Object.keys(from);
5230 for (var i = 0; i < keys.length; i++) {
5231 key = keys[i];
5232 // in case the object is already observed...
5233 if (key === '__ob__')
5234 continue;
5235 toVal = to[key];
5236 fromVal = from[key];
5237 if (!recursive || !hasOwn(to, key)) {
5238 set(to, key, fromVal);
5239 }
5240 else if (toVal !== fromVal &&
5241 isPlainObject(toVal) &&
5242 isPlainObject(fromVal)) {
5243 mergeData(toVal, fromVal);
5244 }
5245 }
5246 return to;
5247 }
5248 /**
5249 * Data
5250 */
5251 function mergeDataOrFn(parentVal, childVal, vm) {
5252 if (!vm) {
5253 // in a Vue.extend merge, both should be functions
5254 if (!childVal) {
5255 return parentVal;
5256 }
5257 if (!parentVal) {
5258 return childVal;
5259 }
5260 // when parentVal & childVal are both present,
5261 // we need to return a function that returns the
5262 // merged result of both functions... no need to
5263 // check if parentVal is a function here because
5264 // it has to be a function to pass previous merges.
5265 return function mergedDataFn() {
5266 return mergeData(isFunction(childVal) ? childVal.call(this, this) : childVal, isFunction(parentVal) ? parentVal.call(this, this) : parentVal);
5267 };
5268 }
5269 else {
5270 return function mergedInstanceDataFn() {
5271 // instance merge
5272 var instanceData = isFunction(childVal)
5273 ? childVal.call(vm, vm)
5274 : childVal;
5275 var defaultData = isFunction(parentVal)
5276 ? parentVal.call(vm, vm)
5277 : parentVal;
5278 if (instanceData) {
5279 return mergeData(instanceData, defaultData);
5280 }
5281 else {
5282 return defaultData;
5283 }
5284 };
5285 }
5286 }
5287 strats.data = function (parentVal, childVal, vm) {
5288 if (!vm) {
5289 if (childVal && typeof childVal !== 'function') {
5290 warn$2('The "data" option should be a function ' +
5291 'that returns a per-instance value in component ' +
5292 'definitions.', vm);
5293 return parentVal;
5294 }
5295 return mergeDataOrFn(parentVal, childVal);
5296 }
5297 return mergeDataOrFn(parentVal, childVal, vm);
5298 };
5299 /**
5300 * Hooks and props are merged as arrays.
5301 */
5302 function mergeLifecycleHook(parentVal, childVal) {
5303 var res = childVal
5304 ? parentVal
5305 ? parentVal.concat(childVal)
5306 : isArray(childVal)
5307 ? childVal
5308 : [childVal]
5309 : parentVal;
5310 return res ? dedupeHooks(res) : res;
5311 }
5312 function dedupeHooks(hooks) {
5313 var res = [];
5314 for (var i = 0; i < hooks.length; i++) {
5315 if (res.indexOf(hooks[i]) === -1) {
5316 res.push(hooks[i]);
5317 }
5318 }
5319 return res;
5320 }
5321 LIFECYCLE_HOOKS.forEach(function (hook) {
5322 strats[hook] = mergeLifecycleHook;
5323 });
5324 /**
5325 * Assets
5326 *
5327 * When a vm is present (instance creation), we need to do
5328 * a three-way merge between constructor options, instance
5329 * options and parent options.
5330 */
5331 function mergeAssets(parentVal, childVal, vm, key) {
5332 var res = Object.create(parentVal || null);
5333 if (childVal) {
5334 assertObjectType(key, childVal, vm);
5335 return extend(res, childVal);
5336 }
5337 else {
5338 return res;
5339 }
5340 }
5341 ASSET_TYPES.forEach(function (type) {
5342 strats[type + 's'] = mergeAssets;
5343 });
5344 /**
5345 * Watchers.
5346 *
5347 * Watchers hashes should not overwrite one
5348 * another, so we merge them as arrays.
5349 */
5350 strats.watch = function (parentVal, childVal, vm, key) {
5351 // work around Firefox's Object.prototype.watch...
5352 //@ts-expect-error work around
5353 if (parentVal === nativeWatch)
5354 parentVal = undefined;
5355 //@ts-expect-error work around
5356 if (childVal === nativeWatch)
5357 childVal = undefined;
5358 /* istanbul ignore if */
5359 if (!childVal)
5360 return Object.create(parentVal || null);
5361 {
5362 assertObjectType(key, childVal, vm);
5363 }
5364 if (!parentVal)
5365 return childVal;
5366 var ret = {};
5367 extend(ret, parentVal);
5368 for (var key_1 in childVal) {
5369 var parent_1 = ret[key_1];
5370 var child = childVal[key_1];
5371 if (parent_1 && !isArray(parent_1)) {
5372 parent_1 = [parent_1];
5373 }
5374 ret[key_1] = parent_1 ? parent_1.concat(child) : isArray(child) ? child : [child];
5375 }
5376 return ret;
5377 };
5378 /**
5379 * Other object hashes.
5380 */
5381 strats.props =
5382 strats.methods =
5383 strats.inject =
5384 strats.computed =
5385 function (parentVal, childVal, vm, key) {
5386 if (childVal && true) {
5387 assertObjectType(key, childVal, vm);
5388 }
5389 if (!parentVal)
5390 return childVal;
5391 var ret = Object.create(null);
5392 extend(ret, parentVal);
5393 if (childVal)
5394 extend(ret, childVal);
5395 return ret;
5396 };
5397 strats.provide = function (parentVal, childVal) {
5398 if (!parentVal)
5399 return childVal;
5400 return function () {
5401 var ret = Object.create(null);
5402 mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal);
5403 if (childVal) {
5404 mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive
5405 );
5406 }
5407 return ret;
5408 };
5409 };
5410 /**
5411 * Default strategy.
5412 */
5413 var defaultStrat = function (parentVal, childVal) {
5414 return childVal === undefined ? parentVal : childVal;
5415 };
5416 /**
5417 * Validate component names
5418 */
5419 function checkComponents(options) {
5420 for (var key in options.components) {
5421 validateComponentName(key);
5422 }
5423 }
5424 function validateComponentName(name) {
5425 if (!new RegExp("^[a-zA-Z][\\-\\.0-9_".concat(unicodeRegExp.source, "]*$")).test(name)) {
5426 warn$2('Invalid component name: "' +
5427 name +
5428 '". Component names ' +
5429 'should conform to valid custom element name in html5 specification.');
5430 }
5431 if (isBuiltInTag(name) || config.isReservedTag(name)) {
5432 warn$2('Do not use built-in or reserved HTML elements as component ' +
5433 'id: ' +
5434 name);
5435 }
5436 }
5437 /**
5438 * Ensure all props option syntax are normalized into the
5439 * Object-based format.
5440 */
5441 function normalizeProps(options, vm) {
5442 var props = options.props;
5443 if (!props)
5444 return;
5445 var res = {};
5446 var i, val, name;
5447 if (isArray(props)) {
5448 i = props.length;
5449 while (i--) {
5450 val = props[i];
5451 if (typeof val === 'string') {
5452 name = camelize(val);
5453 res[name] = { type: null };
5454 }
5455 else {
5456 warn$2('props must be strings when using array syntax.');
5457 }
5458 }
5459 }
5460 else if (isPlainObject(props)) {
5461 for (var key in props) {
5462 val = props[key];
5463 name = camelize(key);
5464 res[name] = isPlainObject(val) ? val : { type: val };
5465 }
5466 }
5467 else {
5468 warn$2("Invalid value for option \"props\": expected an Array or an Object, " +
5469 "but got ".concat(toRawType(props), "."), vm);
5470 }
5471 options.props = res;
5472 }
5473 /**
5474 * Normalize all injections into Object-based format
5475 */
5476 function normalizeInject(options, vm) {
5477 var inject = options.inject;
5478 if (!inject)
5479 return;
5480 var normalized = (options.inject = {});
5481 if (isArray(inject)) {
5482 for (var i = 0; i < inject.length; i++) {
5483 normalized[inject[i]] = { from: inject[i] };
5484 }
5485 }
5486 else if (isPlainObject(inject)) {
5487 for (var key in inject) {
5488 var val = inject[key];
5489 normalized[key] = isPlainObject(val)
5490 ? extend({ from: key }, val)
5491 : { from: val };
5492 }
5493 }
5494 else {
5495 warn$2("Invalid value for option \"inject\": expected an Array or an Object, " +
5496 "but got ".concat(toRawType(inject), "."), vm);
5497 }
5498 }
5499 /**
5500 * Normalize raw function directives into object format.
5501 */
5502 function normalizeDirectives$1(options) {
5503 var dirs = options.directives;
5504 if (dirs) {
5505 for (var key in dirs) {
5506 var def = dirs[key];
5507 if (isFunction(def)) {
5508 dirs[key] = { bind: def, update: def };
5509 }
5510 }
5511 }
5512 }
5513 function assertObjectType(name, value, vm) {
5514 if (!isPlainObject(value)) {
5515 warn$2("Invalid value for option \"".concat(name, "\": expected an Object, ") +
5516 "but got ".concat(toRawType(value), "."), vm);
5517 }
5518 }
5519 /**
5520 * Merge two option objects into a new one.
5521 * Core utility used in both instantiation and inheritance.
5522 */
5523 function mergeOptions(parent, child, vm) {
5524 {
5525 checkComponents(child);
5526 }
5527 if (isFunction(child)) {
5528 // @ts-expect-error
5529 child = child.options;
5530 }
5531 normalizeProps(child, vm);
5532 normalizeInject(child, vm);
5533 normalizeDirectives$1(child);
5534 // Apply extends and mixins on the child options,
5535 // but only if it is a raw options object that isn't
5536 // the result of another mergeOptions call.
5537 // Only merged options has the _base property.
5538 if (!child._base) {
5539 if (child.extends) {
5540 parent = mergeOptions(parent, child.extends, vm);
5541 }
5542 if (child.mixins) {
5543 for (var i = 0, l = child.mixins.length; i < l; i++) {
5544 parent = mergeOptions(parent, child.mixins[i], vm);
5545 }
5546 }
5547 }
5548 var options = {};
5549 var key;
5550 for (key in parent) {
5551 mergeField(key);
5552 }
5553 for (key in child) {
5554 if (!hasOwn(parent, key)) {
5555 mergeField(key);
5556 }
5557 }
5558 function mergeField(key) {
5559 var strat = strats[key] || defaultStrat;
5560 options[key] = strat(parent[key], child[key], vm, key);
5561 }
5562 return options;
5563 }
5564 /**
5565 * Resolve an asset.
5566 * This function is used because child instances need access
5567 * to assets defined in its ancestor chain.
5568 */
5569 function resolveAsset(options, type, id, warnMissing) {
5570 /* istanbul ignore if */
5571 if (typeof id !== 'string') {
5572 return;
5573 }
5574 var assets = options[type];
5575 // check local registration variations first
5576 if (hasOwn(assets, id))
5577 return assets[id];
5578 var camelizedId = camelize(id);
5579 if (hasOwn(assets, camelizedId))
5580 return assets[camelizedId];
5581 var PascalCaseId = capitalize(camelizedId);
5582 if (hasOwn(assets, PascalCaseId))
5583 return assets[PascalCaseId];
5584 // fallback to prototype chain
5585 var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
5586 if (warnMissing && !res) {
5587 warn$2('Failed to resolve ' + type.slice(0, -1) + ': ' + id);
5588 }
5589 return res;
5590 }
5591
5592 function validateProp(key, propOptions, propsData, vm) {
5593 var prop = propOptions[key];
5594 var absent = !hasOwn(propsData, key);
5595 var value = propsData[key];
5596 // boolean casting
5597 var booleanIndex = getTypeIndex(Boolean, prop.type);
5598 if (booleanIndex > -1) {
5599 if (absent && !hasOwn(prop, 'default')) {
5600 value = false;
5601 }
5602 else if (value === '' || value === hyphenate(key)) {
5603 // only cast empty string / same name to boolean if
5604 // boolean has higher priority
5605 var stringIndex = getTypeIndex(String, prop.type);
5606 if (stringIndex < 0 || booleanIndex < stringIndex) {
5607 value = true;
5608 }
5609 }
5610 }
5611 // check default value
5612 if (value === undefined) {
5613 value = getPropDefaultValue(vm, prop, key);
5614 // since the default value is a fresh copy,
5615 // make sure to observe it.
5616 var prevShouldObserve = shouldObserve;
5617 toggleObserving(true);
5618 observe(value);
5619 toggleObserving(prevShouldObserve);
5620 }
5621 {
5622 assertProp(prop, key, value, vm, absent);
5623 }
5624 return value;
5625 }
5626 /**
5627 * Get the default value of a prop.
5628 */
5629 function getPropDefaultValue(vm, prop, key) {
5630 // no default, return undefined
5631 if (!hasOwn(prop, 'default')) {
5632 return undefined;
5633 }
5634 var def = prop.default;
5635 // warn against non-factory defaults for Object & Array
5636 if (isObject(def)) {
5637 warn$2('Invalid default value for prop "' +
5638 key +
5639 '": ' +
5640 'Props with type Object/Array must use a factory function ' +
5641 'to return the default value.', vm);
5642 }
5643 // the raw prop value was also undefined from previous render,
5644 // return previous default value to avoid unnecessary watcher trigger
5645 if (vm &&
5646 vm.$options.propsData &&
5647 vm.$options.propsData[key] === undefined &&
5648 vm._props[key] !== undefined) {
5649 return vm._props[key];
5650 }
5651 // call factory function for non-Function types
5652 // a value is Function if its prototype is function even across different execution context
5653 return isFunction(def) && getType(prop.type) !== 'Function'
5654 ? def.call(vm)
5655 : def;
5656 }
5657 /**
5658 * Assert whether a prop is valid.
5659 */
5660 function assertProp(prop, name, value, vm, absent) {
5661 if (prop.required && absent) {
5662 warn$2('Missing required prop: "' + name + '"', vm);
5663 return;
5664 }
5665 if (value == null && !prop.required) {
5666 return;
5667 }
5668 var type = prop.type;
5669 var valid = !type || type === true;
5670 var expectedTypes = [];
5671 if (type) {
5672 if (!isArray(type)) {
5673 type = [type];
5674 }
5675 for (var i = 0; i < type.length && !valid; i++) {
5676 var assertedType = assertType(value, type[i], vm);
5677 expectedTypes.push(assertedType.expectedType || '');
5678 valid = assertedType.valid;
5679 }
5680 }
5681 var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
5682 if (!valid && haveExpectedTypes) {
5683 warn$2(getInvalidTypeMessage(name, value, expectedTypes), vm);
5684 return;
5685 }
5686 var validator = prop.validator;
5687 if (validator) {
5688 if (!validator(value)) {
5689 warn$2('Invalid prop: custom validator check failed for prop "' + name + '".', vm);
5690 }
5691 }
5692 }
5693 var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
5694 function assertType(value, type, vm) {
5695 var valid;
5696 var expectedType = getType(type);
5697 if (simpleCheckRE.test(expectedType)) {
5698 var t = typeof value;
5699 valid = t === expectedType.toLowerCase();
5700 // for primitive wrapper objects
5701 if (!valid && t === 'object') {
5702 valid = value instanceof type;
5703 }
5704 }
5705 else if (expectedType === 'Object') {
5706 valid = isPlainObject(value);
5707 }
5708 else if (expectedType === 'Array') {
5709 valid = isArray(value);
5710 }
5711 else {
5712 try {
5713 valid = value instanceof type;
5714 }
5715 catch (e) {
5716 warn$2('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
5717 valid = false;
5718 }
5719 }
5720 return {
5721 valid: valid,
5722 expectedType: expectedType
5723 };
5724 }
5725 var functionTypeCheckRE = /^\s*function (\w+)/;
5726 /**
5727 * Use function string name to check built-in types,
5728 * because a simple equality check will fail when running
5729 * across different vms / iframes.
5730 */
5731 function getType(fn) {
5732 var match = fn && fn.toString().match(functionTypeCheckRE);
5733 return match ? match[1] : '';
5734 }
5735 function isSameType(a, b) {
5736 return getType(a) === getType(b);
5737 }
5738 function getTypeIndex(type, expectedTypes) {
5739 if (!isArray(expectedTypes)) {
5740 return isSameType(expectedTypes, type) ? 0 : -1;
5741 }
5742 for (var i = 0, len = expectedTypes.length; i < len; i++) {
5743 if (isSameType(expectedTypes[i], type)) {
5744 return i;
5745 }
5746 }
5747 return -1;
5748 }
5749 function getInvalidTypeMessage(name, value, expectedTypes) {
5750 var message = "Invalid prop: type check failed for prop \"".concat(name, "\".") +
5751 " Expected ".concat(expectedTypes.map(capitalize).join(', '));
5752 var expectedType = expectedTypes[0];
5753 var receivedType = toRawType(value);
5754 // check if we need to specify expected value
5755 if (expectedTypes.length === 1 &&
5756 isExplicable(expectedType) &&
5757 isExplicable(typeof value) &&
5758 !isBoolean(expectedType, receivedType)) {
5759 message += " with value ".concat(styleValue(value, expectedType));
5760 }
5761 message += ", got ".concat(receivedType, " ");
5762 // check if we need to specify received value
5763 if (isExplicable(receivedType)) {
5764 message += "with value ".concat(styleValue(value, receivedType), ".");
5765 }
5766 return message;
5767 }
5768 function styleValue(value, type) {
5769 if (type === 'String') {
5770 return "\"".concat(value, "\"");
5771 }
5772 else if (type === 'Number') {
5773 return "".concat(Number(value));
5774 }
5775 else {
5776 return "".concat(value);
5777 }
5778 }
5779 var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
5780 function isExplicable(value) {
5781 return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; });
5782 }
5783 function isBoolean() {
5784 var args = [];
5785 for (var _i = 0; _i < arguments.length; _i++) {
5786 args[_i] = arguments[_i];
5787 }
5788 return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; });
5789 }
5790
5791 function Vue(options) {
5792 if (!(this instanceof Vue)) {
5793 warn$2('Vue is a constructor and should be called with the `new` keyword');
5794 }
5795 this._init(options);
5796 }
5797 //@ts-expect-error Vue has function type
5798 initMixin$1(Vue);
5799 //@ts-expect-error Vue has function type
5800 stateMixin(Vue);
5801 //@ts-expect-error Vue has function type
5802 eventsMixin(Vue);
5803 //@ts-expect-error Vue has function type
5804 lifecycleMixin(Vue);
5805 //@ts-expect-error Vue has function type
5806 renderMixin(Vue);
5807
5808 function initUse(Vue) {
5809 Vue.use = function (plugin) {
5810 var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
5811 if (installedPlugins.indexOf(plugin) > -1) {
5812 return this;
5813 }
5814 // additional parameters
5815 var args = toArray(arguments, 1);
5816 args.unshift(this);
5817 if (isFunction(plugin.install)) {
5818 plugin.install.apply(plugin, args);
5819 }
5820 else if (isFunction(plugin)) {
5821 plugin.apply(null, args);
5822 }
5823 installedPlugins.push(plugin);
5824 return this;
5825 };
5826 }
5827
5828 function initMixin(Vue) {
5829 Vue.mixin = function (mixin) {
5830 this.options = mergeOptions(this.options, mixin);
5831 return this;
5832 };
5833 }
5834
5835 function initExtend(Vue) {
5836 /**
5837 * Each instance constructor, including Vue, has a unique
5838 * cid. This enables us to create wrapped "child
5839 * constructors" for prototypal inheritance and cache them.
5840 */
5841 Vue.cid = 0;
5842 var cid = 1;
5843 /**
5844 * Class inheritance
5845 */
5846 Vue.extend = function (extendOptions) {
5847 extendOptions = extendOptions || {};
5848 var Super = this;
5849 var SuperId = Super.cid;
5850 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
5851 if (cachedCtors[SuperId]) {
5852 return cachedCtors[SuperId];
5853 }
5854 var name = getComponentName(extendOptions) || getComponentName(Super.options);
5855 if (name) {
5856 validateComponentName(name);
5857 }
5858 var Sub = function VueComponent(options) {
5859 this._init(options);
5860 };
5861 Sub.prototype = Object.create(Super.prototype);
5862 Sub.prototype.constructor = Sub;
5863 Sub.cid = cid++;
5864 Sub.options = mergeOptions(Super.options, extendOptions);
5865 Sub['super'] = Super;
5866 // For props and computed properties, we define the proxy getters on
5867 // the Vue instances at extension time, on the extended prototype. This
5868 // avoids Object.defineProperty calls for each instance created.
5869 if (Sub.options.props) {
5870 initProps(Sub);
5871 }
5872 if (Sub.options.computed) {
5873 initComputed(Sub);
5874 }
5875 // allow further extension/mixin/plugin usage
5876 Sub.extend = Super.extend;
5877 Sub.mixin = Super.mixin;
5878 Sub.use = Super.use;
5879 // create asset registers, so extended classes
5880 // can have their private assets too.
5881 ASSET_TYPES.forEach(function (type) {
5882 Sub[type] = Super[type];
5883 });
5884 // enable recursive self-lookup
5885 if (name) {
5886 Sub.options.components[name] = Sub;
5887 }
5888 // keep a reference to the super options at extension time.
5889 // later at instantiation we can check if Super's options have
5890 // been updated.
5891 Sub.superOptions = Super.options;
5892 Sub.extendOptions = extendOptions;
5893 Sub.sealedOptions = extend({}, Sub.options);
5894 // cache constructor
5895 cachedCtors[SuperId] = Sub;
5896 return Sub;
5897 };
5898 }
5899 function initProps(Comp) {
5900 var props = Comp.options.props;
5901 for (var key in props) {
5902 proxy(Comp.prototype, "_props", key);
5903 }
5904 }
5905 function initComputed(Comp) {
5906 var computed = Comp.options.computed;
5907 for (var key in computed) {
5908 defineComputed(Comp.prototype, key, computed[key]);
5909 }
5910 }
5911
5912 function initAssetRegisters(Vue) {
5913 /**
5914 * Create asset registration methods.
5915 */
5916 ASSET_TYPES.forEach(function (type) {
5917 // @ts-expect-error function is not exact same type
5918 Vue[type] = function (id, definition) {
5919 if (!definition) {
5920 return this.options[type + 's'][id];
5921 }
5922 else {
5923 /* istanbul ignore if */
5924 if (type === 'component') {
5925 validateComponentName(id);
5926 }
5927 if (type === 'component' && isPlainObject(definition)) {
5928 // @ts-expect-error
5929 definition.name = definition.name || id;
5930 definition = this.options._base.extend(definition);
5931 }
5932 if (type === 'directive' && isFunction(definition)) {
5933 definition = { bind: definition, update: definition };
5934 }
5935 this.options[type + 's'][id] = definition;
5936 return definition;
5937 }
5938 };
5939 });
5940 }
5941
5942 function _getComponentName(opts) {
5943 return opts && (getComponentName(opts.Ctor.options) || opts.tag);
5944 }
5945 function matches(pattern, name) {
5946 if (isArray(pattern)) {
5947 return pattern.indexOf(name) > -1;
5948 }
5949 else if (typeof pattern === 'string') {
5950 return pattern.split(',').indexOf(name) > -1;
5951 }
5952 else if (isRegExp(pattern)) {
5953 return pattern.test(name);
5954 }
5955 /* istanbul ignore next */
5956 return false;
5957 }
5958 function pruneCache(keepAliveInstance, filter) {
5959 var cache = keepAliveInstance.cache, keys = keepAliveInstance.keys, _vnode = keepAliveInstance._vnode, $vnode = keepAliveInstance.$vnode;
5960 for (var key in cache) {
5961 var entry = cache[key];
5962 if (entry) {
5963 var name_1 = entry.name;
5964 if (name_1 && !filter(name_1)) {
5965 pruneCacheEntry(cache, key, keys, _vnode);
5966 }
5967 }
5968 }
5969 $vnode.componentOptions.children = undefined;
5970 }
5971 function pruneCacheEntry(cache, key, keys, current) {
5972 var entry = cache[key];
5973 if (entry && (!current || entry.tag !== current.tag)) {
5974 // @ts-expect-error can be undefined
5975 entry.componentInstance.$destroy();
5976 }
5977 cache[key] = null;
5978 remove$2(keys, key);
5979 }
5980 var patternTypes = [String, RegExp, Array];
5981 // TODO defineComponent
5982 var KeepAlive = {
5983 name: 'keep-alive',
5984 abstract: true,
5985 props: {
5986 include: patternTypes,
5987 exclude: patternTypes,
5988 max: [String, Number]
5989 },
5990 methods: {
5991 cacheVNode: function () {
5992 var _a = this, cache = _a.cache, keys = _a.keys, vnodeToCache = _a.vnodeToCache, keyToCache = _a.keyToCache;
5993 if (vnodeToCache) {
5994 var tag = vnodeToCache.tag, componentInstance = vnodeToCache.componentInstance, componentOptions = vnodeToCache.componentOptions;
5995 cache[keyToCache] = {
5996 name: _getComponentName(componentOptions),
5997 tag: tag,
5998 componentInstance: componentInstance
5999 };
6000 keys.push(keyToCache);
6001 // prune oldest entry
6002 if (this.max && keys.length > parseInt(this.max)) {
6003 pruneCacheEntry(cache, keys[0], keys, this._vnode);
6004 }
6005 this.vnodeToCache = null;
6006 }
6007 }
6008 },
6009 created: function () {
6010 this.cache = Object.create(null);
6011 this.keys = [];
6012 },
6013 destroyed: function () {
6014 for (var key in this.cache) {
6015 pruneCacheEntry(this.cache, key, this.keys);
6016 }
6017 },
6018 mounted: function () {
6019 var _this = this;
6020 this.cacheVNode();
6021 this.$watch('include', function (val) {
6022 pruneCache(_this, function (name) { return matches(val, name); });
6023 });
6024 this.$watch('exclude', function (val) {
6025 pruneCache(_this, function (name) { return !matches(val, name); });
6026 });
6027 },
6028 updated: function () {
6029 this.cacheVNode();
6030 },
6031 render: function () {
6032 var slot = this.$slots.default;
6033 var vnode = getFirstComponentChild(slot);
6034 var componentOptions = vnode && vnode.componentOptions;
6035 if (componentOptions) {
6036 // check pattern
6037 var name_2 = _getComponentName(componentOptions);
6038 var _a = this, include = _a.include, exclude = _a.exclude;
6039 if (
6040 // not included
6041 (include && (!name_2 || !matches(include, name_2))) ||
6042 // excluded
6043 (exclude && name_2 && matches(exclude, name_2))) {
6044 return vnode;
6045 }
6046 var _b = this, cache = _b.cache, keys = _b.keys;
6047 var key = vnode.key == null
6048 ? // same constructor may get registered as different local components
6049 // so cid alone is not enough (#3269)
6050 componentOptions.Ctor.cid +
6051 (componentOptions.tag ? "::".concat(componentOptions.tag) : '')
6052 : vnode.key;
6053 if (cache[key]) {
6054 vnode.componentInstance = cache[key].componentInstance;
6055 // make current key freshest
6056 remove$2(keys, key);
6057 keys.push(key);
6058 }
6059 else {
6060 // delay setting the cache until update
6061 this.vnodeToCache = vnode;
6062 this.keyToCache = key;
6063 }
6064 // @ts-expect-error can vnode.data can be undefined
6065 vnode.data.keepAlive = true;
6066 }
6067 return vnode || (slot && slot[0]);
6068 }
6069 };
6070
6071 var builtInComponents = {
6072 KeepAlive: KeepAlive
6073 };
6074
6075 function initGlobalAPI(Vue) {
6076 // config
6077 var configDef = {};
6078 configDef.get = function () { return config; };
6079 {
6080 configDef.set = function () {
6081 warn$2('Do not replace the Vue.config object, set individual fields instead.');
6082 };
6083 }
6084 Object.defineProperty(Vue, 'config', configDef);
6085 // exposed util methods.
6086 // NOTE: these are not considered part of the public API - avoid relying on
6087 // them unless you are aware of the risk.
6088 Vue.util = {
6089 warn: warn$2,
6090 extend: extend,
6091 mergeOptions: mergeOptions,
6092 defineReactive: defineReactive
6093 };
6094 Vue.set = set;
6095 Vue.delete = del;
6096 Vue.nextTick = nextTick;
6097 // 2.6 explicit observable API
6098 Vue.observable = function (obj) {
6099 observe(obj);
6100 return obj;
6101 };
6102 Vue.options = Object.create(null);
6103 ASSET_TYPES.forEach(function (type) {
6104 Vue.options[type + 's'] = Object.create(null);
6105 });
6106 // this is used to identify the "base" constructor to extend all plain-object
6107 // components with in Weex's multi-instance scenarios.
6108 Vue.options._base = Vue;
6109 extend(Vue.options.components, builtInComponents);
6110 initUse(Vue);
6111 initMixin(Vue);
6112 initExtend(Vue);
6113 initAssetRegisters(Vue);
6114 }
6115
6116 initGlobalAPI(Vue);
6117 Object.defineProperty(Vue.prototype, '$isServer', {
6118 get: isServerRendering
6119 });
6120 Object.defineProperty(Vue.prototype, '$ssrContext', {
6121 get: function () {
6122 /* istanbul ignore next */
6123 return this.$vnode && this.$vnode.ssrContext;
6124 }
6125 });
6126 // expose FunctionalRenderContext for ssr runtime helper installation
6127 Object.defineProperty(Vue, 'FunctionalRenderContext', {
6128 value: FunctionalRenderContext
6129 });
6130 Vue.version = version;
6131
6132 // these are reserved for web because they are directly compiled away
6133 // during template compilation
6134 var isReservedAttr = makeMap('style,class');
6135 // attributes that should be using props for binding
6136 var acceptValue = makeMap('input,textarea,option,select,progress');
6137 var mustUseProp = function (tag, type, attr) {
6138 return ((attr === 'value' && acceptValue(tag) && type !== 'button') ||
6139 (attr === 'selected' && tag === 'option') ||
6140 (attr === 'checked' && tag === 'input') ||
6141 (attr === 'muted' && tag === 'video'));
6142 };
6143 var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
6144 var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
6145 var convertEnumeratedValue = function (key, value) {
6146 return isFalsyAttrValue(value) || value === 'false'
6147 ? 'false'
6148 : // allow arbitrary string value for contenteditable
6149 key === 'contenteditable' && isValidContentEditableValue(value)
6150 ? value
6151 : 'true';
6152 };
6153 var isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
6154 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
6155 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
6156 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
6157 'required,reversed,scoped,seamless,selected,sortable,' +
6158 'truespeed,typemustmatch,visible');
6159 var xlinkNS = 'http://www.w3.org/1999/xlink';
6160 var isXlink = function (name) {
6161 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink';
6162 };
6163 var getXlinkProp = function (name) {
6164 return isXlink(name) ? name.slice(6, name.length) : '';
6165 };
6166 var isFalsyAttrValue = function (val) {
6167 return val == null || val === false;
6168 };
6169
6170 function genClassForVnode(vnode) {
6171 var data = vnode.data;
6172 var parentNode = vnode;
6173 var childNode = vnode;
6174 while (isDef(childNode.componentInstance)) {
6175 childNode = childNode.componentInstance._vnode;
6176 if (childNode && childNode.data) {
6177 data = mergeClassData(childNode.data, data);
6178 }
6179 }
6180 // @ts-expect-error parentNode.parent not VNodeWithData
6181 while (isDef((parentNode = parentNode.parent))) {
6182 if (parentNode && parentNode.data) {
6183 data = mergeClassData(data, parentNode.data);
6184 }
6185 }
6186 return renderClass(data.staticClass, data.class);
6187 }
6188 function mergeClassData(child, parent) {
6189 return {
6190 staticClass: concat(child.staticClass, parent.staticClass),
6191 class: isDef(child.class) ? [child.class, parent.class] : parent.class
6192 };
6193 }
6194 function renderClass(staticClass, dynamicClass) {
6195 if (isDef(staticClass) || isDef(dynamicClass)) {
6196 return concat(staticClass, stringifyClass(dynamicClass));
6197 }
6198 /* istanbul ignore next */
6199 return '';
6200 }
6201 function concat(a, b) {
6202 return a ? (b ? a + ' ' + b : a) : b || '';
6203 }
6204 function stringifyClass(value) {
6205 if (Array.isArray(value)) {
6206 return stringifyArray(value);
6207 }
6208 if (isObject(value)) {
6209 return stringifyObject(value);
6210 }
6211 if (typeof value === 'string') {
6212 return value;
6213 }
6214 /* istanbul ignore next */
6215 return '';
6216 }
6217 function stringifyArray(value) {
6218 var res = '';
6219 var stringified;
6220 for (var i = 0, l = value.length; i < l; i++) {
6221 if (isDef((stringified = stringifyClass(value[i]))) && stringified !== '') {
6222 if (res)
6223 res += ' ';
6224 res += stringified;
6225 }
6226 }
6227 return res;
6228 }
6229 function stringifyObject(value) {
6230 var res = '';
6231 for (var key in value) {
6232 if (value[key]) {
6233 if (res)
6234 res += ' ';
6235 res += key;
6236 }
6237 }
6238 return res;
6239 }
6240
6241 var namespaceMap = {
6242 svg: 'http://www.w3.org/2000/svg',
6243 math: 'http://www.w3.org/1998/Math/MathML'
6244 };
6245 var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
6246 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
6247 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
6248 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
6249 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
6250 'embed,object,param,source,canvas,script,noscript,del,ins,' +
6251 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
6252 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
6253 'output,progress,select,textarea,' +
6254 'details,dialog,menu,menuitem,summary,' +
6255 'content,element,shadow,template,blockquote,iframe,tfoot');
6256 // this map is intentionally selective, only covering SVG elements that may
6257 // contain child elements.
6258 var isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
6259 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
6260 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);
6261 var isPreTag = function (tag) { return tag === 'pre'; };
6262 var isReservedTag = function (tag) {
6263 return isHTMLTag(tag) || isSVG(tag);
6264 };
6265 function getTagNamespace(tag) {
6266 if (isSVG(tag)) {
6267 return 'svg';
6268 }
6269 // basic support for MathML
6270 // note it doesn't support other MathML elements being component roots
6271 if (tag === 'math') {
6272 return 'math';
6273 }
6274 }
6275 var unknownElementCache = Object.create(null);
6276 function isUnknownElement(tag) {
6277 /* istanbul ignore if */
6278 if (!inBrowser) {
6279 return true;
6280 }
6281 if (isReservedTag(tag)) {
6282 return false;
6283 }
6284 tag = tag.toLowerCase();
6285 /* istanbul ignore if */
6286 if (unknownElementCache[tag] != null) {
6287 return unknownElementCache[tag];
6288 }
6289 var el = document.createElement(tag);
6290 if (tag.indexOf('-') > -1) {
6291 // https://stackoverflow.com/a/28210364/1070244
6292 return (unknownElementCache[tag] =
6293 el.constructor === window.HTMLUnknownElement ||
6294 el.constructor === window.HTMLElement);
6295 }
6296 else {
6297 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()));
6298 }
6299 }
6300 var isTextInputType = makeMap('text,number,password,search,email,tel,url');
6301
6302 /**
6303 * Query an element selector if it's not an element already.
6304 */
6305 function query(el) {
6306 if (typeof el === 'string') {
6307 var selected = document.querySelector(el);
6308 if (!selected) {
6309 warn$2('Cannot find element: ' + el);
6310 return document.createElement('div');
6311 }
6312 return selected;
6313 }
6314 else {
6315 return el;
6316 }
6317 }
6318
6319 function createElement(tagName, vnode) {
6320 var elm = document.createElement(tagName);
6321 if (tagName !== 'select') {
6322 return elm;
6323 }
6324 // false or null will remove the attribute but undefined will not
6325 if (vnode.data &&
6326 vnode.data.attrs &&
6327 vnode.data.attrs.multiple !== undefined) {
6328 elm.setAttribute('multiple', 'multiple');
6329 }
6330 return elm;
6331 }
6332 function createElementNS(namespace, tagName) {
6333 return document.createElementNS(namespaceMap[namespace], tagName);
6334 }
6335 function createTextNode(text) {
6336 return document.createTextNode(text);
6337 }
6338 function createComment(text) {
6339 return document.createComment(text);
6340 }
6341 function insertBefore(parentNode, newNode, referenceNode) {
6342 parentNode.insertBefore(newNode, referenceNode);
6343 }
6344 function removeChild(node, child) {
6345 node.removeChild(child);
6346 }
6347 function appendChild(node, child) {
6348 node.appendChild(child);
6349 }
6350 function parentNode(node) {
6351 return node.parentNode;
6352 }
6353 function nextSibling(node) {
6354 return node.nextSibling;
6355 }
6356 function tagName(node) {
6357 return node.tagName;
6358 }
6359 function setTextContent(node, text) {
6360 node.textContent = text;
6361 }
6362 function setStyleScope(node, scopeId) {
6363 node.setAttribute(scopeId, '');
6364 }
6365
6366 var nodeOps = /*#__PURE__*/Object.freeze({
6367 __proto__: null,
6368 createElement: createElement,
6369 createElementNS: createElementNS,
6370 createTextNode: createTextNode,
6371 createComment: createComment,
6372 insertBefore: insertBefore,
6373 removeChild: removeChild,
6374 appendChild: appendChild,
6375 parentNode: parentNode,
6376 nextSibling: nextSibling,
6377 tagName: tagName,
6378 setTextContent: setTextContent,
6379 setStyleScope: setStyleScope
6380 });
6381
6382 var ref = {
6383 create: function (_, vnode) {
6384 registerRef(vnode);
6385 },
6386 update: function (oldVnode, vnode) {
6387 if (oldVnode.data.ref !== vnode.data.ref) {
6388 registerRef(oldVnode, true);
6389 registerRef(vnode);
6390 }
6391 },
6392 destroy: function (vnode) {
6393 registerRef(vnode, true);
6394 }
6395 };
6396 function registerRef(vnode, isRemoval) {
6397 var ref = vnode.data.ref;
6398 if (!isDef(ref))
6399 return;
6400 var vm = vnode.context;
6401 var refValue = vnode.componentInstance || vnode.elm;
6402 var value = isRemoval ? null : refValue;
6403 var $refsValue = isRemoval ? undefined : refValue;
6404 if (isFunction(ref)) {
6405 invokeWithErrorHandling(ref, vm, [value], vm, "template ref function");
6406 return;
6407 }
6408 var isFor = vnode.data.refInFor;
6409 var _isString = typeof ref === 'string' || typeof ref === 'number';
6410 var _isRef = isRef(ref);
6411 var refs = vm.$refs;
6412 if (_isString || _isRef) {
6413 if (isFor) {
6414 var existing = _isString ? refs[ref] : ref.value;
6415 if (isRemoval) {
6416 isArray(existing) && remove$2(existing, refValue);
6417 }
6418 else {
6419 if (!isArray(existing)) {
6420 if (_isString) {
6421 refs[ref] = [refValue];
6422 setSetupRef(vm, ref, refs[ref]);
6423 }
6424 else {
6425 ref.value = [refValue];
6426 }
6427 }
6428 else if (!existing.includes(refValue)) {
6429 existing.push(refValue);
6430 }
6431 }
6432 }
6433 else if (_isString) {
6434 if (isRemoval && refs[ref] !== refValue) {
6435 return;
6436 }
6437 refs[ref] = $refsValue;
6438 setSetupRef(vm, ref, value);
6439 }
6440 else if (_isRef) {
6441 if (isRemoval && ref.value !== refValue) {
6442 return;
6443 }
6444 ref.value = value;
6445 }
6446 else {
6447 warn$2("Invalid template ref type: ".concat(typeof ref));
6448 }
6449 }
6450 }
6451 function setSetupRef(_a, key, val) {
6452 var _setupState = _a._setupState;
6453 if (_setupState && hasOwn(_setupState, key)) {
6454 if (isRef(_setupState[key])) {
6455 _setupState[key].value = val;
6456 }
6457 else {
6458 _setupState[key] = val;
6459 }
6460 }
6461 }
6462
6463 /**
6464 * Virtual DOM patching algorithm based on Snabbdom by
6465 * Simon Friis Vindum (@paldepind)
6466 * Licensed under the MIT License
6467 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
6468 *
6469 * modified by Evan You (@yyx990803)
6470 *
6471 * Not type-checking this because this file is perf-critical and the cost
6472 * of making flow understand it is not worth it.
6473 */
6474 var emptyNode = new VNode('', {}, []);
6475 var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
6476 function sameVnode(a, b) {
6477 return (a.key === b.key &&
6478 a.asyncFactory === b.asyncFactory &&
6479 ((a.tag === b.tag &&
6480 a.isComment === b.isComment &&
6481 isDef(a.data) === isDef(b.data) &&
6482 sameInputType(a, b)) ||
6483 (isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error))));
6484 }
6485 function sameInputType(a, b) {
6486 if (a.tag !== 'input')
6487 return true;
6488 var i;
6489 var typeA = isDef((i = a.data)) && isDef((i = i.attrs)) && i.type;
6490 var typeB = isDef((i = b.data)) && isDef((i = i.attrs)) && i.type;
6491 return typeA === typeB || (isTextInputType(typeA) && isTextInputType(typeB));
6492 }
6493 function createKeyToOldIdx(children, beginIdx, endIdx) {
6494 var i, key;
6495 var map = {};
6496 for (i = beginIdx; i <= endIdx; ++i) {
6497 key = children[i].key;
6498 if (isDef(key))
6499 map[key] = i;
6500 }
6501 return map;
6502 }
6503 function createPatchFunction(backend) {
6504 var i, j;
6505 var cbs = {};
6506 var modules = backend.modules, nodeOps = backend.nodeOps;
6507 for (i = 0; i < hooks.length; ++i) {
6508 cbs[hooks[i]] = [];
6509 for (j = 0; j < modules.length; ++j) {
6510 if (isDef(modules[j][hooks[i]])) {
6511 cbs[hooks[i]].push(modules[j][hooks[i]]);
6512 }
6513 }
6514 }
6515 function emptyNodeAt(elm) {
6516 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm);
6517 }
6518 function createRmCb(childElm, listeners) {
6519 function remove() {
6520 if (--remove.listeners === 0) {
6521 removeNode(childElm);
6522 }
6523 }
6524 remove.listeners = listeners;
6525 return remove;
6526 }
6527 function removeNode(el) {
6528 var parent = nodeOps.parentNode(el);
6529 // element may have already been removed due to v-html / v-text
6530 if (isDef(parent)) {
6531 nodeOps.removeChild(parent, el);
6532 }
6533 }
6534 function isUnknownElement(vnode, inVPre) {
6535 return (!inVPre &&
6536 !vnode.ns &&
6537 !(config.ignoredElements.length &&
6538 config.ignoredElements.some(function (ignore) {
6539 return isRegExp(ignore)
6540 ? ignore.test(vnode.tag)
6541 : ignore === vnode.tag;
6542 })) &&
6543 config.isUnknownElement(vnode.tag));
6544 }
6545 var creatingElmInVPre = 0;
6546 function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) {
6547 if (isDef(vnode.elm) && isDef(ownerArray)) {
6548 // This vnode was used in a previous render!
6549 // now it's used as a new node, overwriting its elm would cause
6550 // potential patch errors down the road when it's used as an insertion
6551 // reference node. Instead, we clone the node on-demand before creating
6552 // associated DOM element for it.
6553 vnode = ownerArray[index] = cloneVNode(vnode);
6554 }
6555 vnode.isRootInsert = !nested; // for transition enter check
6556 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
6557 return;
6558 }
6559 var data = vnode.data;
6560 var children = vnode.children;
6561 var tag = vnode.tag;
6562 if (isDef(tag)) {
6563 {
6564 if (data && data.pre) {
6565 creatingElmInVPre++;
6566 }
6567 if (isUnknownElement(vnode, creatingElmInVPre)) {
6568 warn$2('Unknown custom element: <' +
6569 tag +
6570 '> - did you ' +
6571 'register the component correctly? For recursive components, ' +
6572 'make sure to provide the "name" option.', vnode.context);
6573 }
6574 }
6575 vnode.elm = vnode.ns
6576 ? nodeOps.createElementNS(vnode.ns, tag)
6577 : nodeOps.createElement(tag, vnode);
6578 setScope(vnode);
6579 createChildren(vnode, children, insertedVnodeQueue);
6580 if (isDef(data)) {
6581 invokeCreateHooks(vnode, insertedVnodeQueue);
6582 }
6583 insert(parentElm, vnode.elm, refElm);
6584 if (data && data.pre) {
6585 creatingElmInVPre--;
6586 }
6587 }
6588 else if (isTrue(vnode.isComment)) {
6589 vnode.elm = nodeOps.createComment(vnode.text);
6590 insert(parentElm, vnode.elm, refElm);
6591 }
6592 else {
6593 vnode.elm = nodeOps.createTextNode(vnode.text);
6594 insert(parentElm, vnode.elm, refElm);
6595 }
6596 }
6597 function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
6598 var i = vnode.data;
6599 if (isDef(i)) {
6600 var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
6601 if (isDef((i = i.hook)) && isDef((i = i.init))) {
6602 i(vnode, false /* hydrating */);
6603 }
6604 // after calling the init hook, if the vnode is a child component
6605 // it should've created a child instance and mounted it. the child
6606 // component also has set the placeholder vnode's elm.
6607 // in that case we can just return the element and be done.
6608 if (isDef(vnode.componentInstance)) {
6609 initComponent(vnode, insertedVnodeQueue);
6610 insert(parentElm, vnode.elm, refElm);
6611 if (isTrue(isReactivated)) {
6612 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
6613 }
6614 return true;
6615 }
6616 }
6617 }
6618 function initComponent(vnode, insertedVnodeQueue) {
6619 if (isDef(vnode.data.pendingInsert)) {
6620 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
6621 vnode.data.pendingInsert = null;
6622 }
6623 vnode.elm = vnode.componentInstance.$el;
6624 if (isPatchable(vnode)) {
6625 invokeCreateHooks(vnode, insertedVnodeQueue);
6626 setScope(vnode);
6627 }
6628 else {
6629 // empty component root.
6630 // skip all element-related modules except for ref (#3455)
6631 registerRef(vnode);
6632 // make sure to invoke the insert hook
6633 insertedVnodeQueue.push(vnode);
6634 }
6635 }
6636 function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
6637 var i;
6638 // hack for #4339: a reactivated component with inner transition
6639 // does not trigger because the inner node's created hooks are not called
6640 // again. It's not ideal to involve module-specific logic in here but
6641 // there doesn't seem to be a better way to do it.
6642 var innerNode = vnode;
6643 while (innerNode.componentInstance) {
6644 innerNode = innerNode.componentInstance._vnode;
6645 if (isDef((i = innerNode.data)) && isDef((i = i.transition))) {
6646 for (i = 0; i < cbs.activate.length; ++i) {
6647 cbs.activate[i](emptyNode, innerNode);
6648 }
6649 insertedVnodeQueue.push(innerNode);
6650 break;
6651 }
6652 }
6653 // unlike a newly created component,
6654 // a reactivated keep-alive component doesn't insert itself
6655 insert(parentElm, vnode.elm, refElm);
6656 }
6657 function insert(parent, elm, ref) {
6658 if (isDef(parent)) {
6659 if (isDef(ref)) {
6660 if (nodeOps.parentNode(ref) === parent) {
6661 nodeOps.insertBefore(parent, elm, ref);
6662 }
6663 }
6664 else {
6665 nodeOps.appendChild(parent, elm);
6666 }
6667 }
6668 }
6669 function createChildren(vnode, children, insertedVnodeQueue) {
6670 if (isArray(children)) {
6671 {
6672 checkDuplicateKeys(children);
6673 }
6674 for (var i_1 = 0; i_1 < children.length; ++i_1) {
6675 createElm(children[i_1], insertedVnodeQueue, vnode.elm, null, true, children, i_1);
6676 }
6677 }
6678 else if (isPrimitive(vnode.text)) {
6679 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
6680 }
6681 }
6682 function isPatchable(vnode) {
6683 while (vnode.componentInstance) {
6684 vnode = vnode.componentInstance._vnode;
6685 }
6686 return isDef(vnode.tag);
6687 }
6688 function invokeCreateHooks(vnode, insertedVnodeQueue) {
6689 for (var i_2 = 0; i_2 < cbs.create.length; ++i_2) {
6690 cbs.create[i_2](emptyNode, vnode);
6691 }
6692 i = vnode.data.hook; // Reuse variable
6693 if (isDef(i)) {
6694 if (isDef(i.create))
6695 i.create(emptyNode, vnode);
6696 if (isDef(i.insert))
6697 insertedVnodeQueue.push(vnode);
6698 }
6699 }
6700 // set scope id attribute for scoped CSS.
6701 // this is implemented as a special case to avoid the overhead
6702 // of going through the normal attribute patching process.
6703 function setScope(vnode) {
6704 var i;
6705 if (isDef((i = vnode.fnScopeId))) {
6706 nodeOps.setStyleScope(vnode.elm, i);
6707 }
6708 else {
6709 var ancestor = vnode;
6710 while (ancestor) {
6711 if (isDef((i = ancestor.context)) && isDef((i = i.$options._scopeId))) {
6712 nodeOps.setStyleScope(vnode.elm, i);
6713 }
6714 ancestor = ancestor.parent;
6715 }
6716 }
6717 // for slot content they should also get the scopeId from the host instance.
6718 if (isDef((i = activeInstance)) &&
6719 i !== vnode.context &&
6720 i !== vnode.fnContext &&
6721 isDef((i = i.$options._scopeId))) {
6722 nodeOps.setStyleScope(vnode.elm, i);
6723 }
6724 }
6725 function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
6726 for (; startIdx <= endIdx; ++startIdx) {
6727 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
6728 }
6729 }
6730 function invokeDestroyHook(vnode) {
6731 var i, j;
6732 var data = vnode.data;
6733 if (isDef(data)) {
6734 if (isDef((i = data.hook)) && isDef((i = i.destroy)))
6735 i(vnode);
6736 for (i = 0; i < cbs.destroy.length; ++i)
6737 cbs.destroy[i](vnode);
6738 }
6739 if (isDef((i = vnode.children))) {
6740 for (j = 0; j < vnode.children.length; ++j) {
6741 invokeDestroyHook(vnode.children[j]);
6742 }
6743 }
6744 }
6745 function removeVnodes(vnodes, startIdx, endIdx) {
6746 for (; startIdx <= endIdx; ++startIdx) {
6747 var ch = vnodes[startIdx];
6748 if (isDef(ch)) {
6749 if (isDef(ch.tag)) {
6750 removeAndInvokeRemoveHook(ch);
6751 invokeDestroyHook(ch);
6752 }
6753 else {
6754 // Text node
6755 removeNode(ch.elm);
6756 }
6757 }
6758 }
6759 }
6760 function removeAndInvokeRemoveHook(vnode, rm) {
6761 if (isDef(rm) || isDef(vnode.data)) {
6762 var i_3;
6763 var listeners = cbs.remove.length + 1;
6764 if (isDef(rm)) {
6765 // we have a recursively passed down rm callback
6766 // increase the listeners count
6767 rm.listeners += listeners;
6768 }
6769 else {
6770 // directly removing
6771 rm = createRmCb(vnode.elm, listeners);
6772 }
6773 // recursively invoke hooks on child component root node
6774 if (isDef((i_3 = vnode.componentInstance)) &&
6775 isDef((i_3 = i_3._vnode)) &&
6776 isDef(i_3.data)) {
6777 removeAndInvokeRemoveHook(i_3, rm);
6778 }
6779 for (i_3 = 0; i_3 < cbs.remove.length; ++i_3) {
6780 cbs.remove[i_3](vnode, rm);
6781 }
6782 if (isDef((i_3 = vnode.data.hook)) && isDef((i_3 = i_3.remove))) {
6783 i_3(vnode, rm);
6784 }
6785 else {
6786 rm();
6787 }
6788 }
6789 else {
6790 removeNode(vnode.elm);
6791 }
6792 }
6793 function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
6794 var oldStartIdx = 0;
6795 var newStartIdx = 0;
6796 var oldEndIdx = oldCh.length - 1;
6797 var oldStartVnode = oldCh[0];
6798 var oldEndVnode = oldCh[oldEndIdx];
6799 var newEndIdx = newCh.length - 1;
6800 var newStartVnode = newCh[0];
6801 var newEndVnode = newCh[newEndIdx];
6802 var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
6803 // removeOnly is a special flag used only by <transition-group>
6804 // to ensure removed elements stay in correct relative positions
6805 // during leaving transitions
6806 var canMove = !removeOnly;
6807 {
6808 checkDuplicateKeys(newCh);
6809 }
6810 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
6811 if (isUndef(oldStartVnode)) {
6812 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
6813 }
6814 else if (isUndef(oldEndVnode)) {
6815 oldEndVnode = oldCh[--oldEndIdx];
6816 }
6817 else if (sameVnode(oldStartVnode, newStartVnode)) {
6818 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6819 oldStartVnode = oldCh[++oldStartIdx];
6820 newStartVnode = newCh[++newStartIdx];
6821 }
6822 else if (sameVnode(oldEndVnode, newEndVnode)) {
6823 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6824 oldEndVnode = oldCh[--oldEndIdx];
6825 newEndVnode = newCh[--newEndIdx];
6826 }
6827 else if (sameVnode(oldStartVnode, newEndVnode)) {
6828 // Vnode moved right
6829 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6830 canMove &&
6831 nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
6832 oldStartVnode = oldCh[++oldStartIdx];
6833 newEndVnode = newCh[--newEndIdx];
6834 }
6835 else if (sameVnode(oldEndVnode, newStartVnode)) {
6836 // Vnode moved left
6837 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6838 canMove &&
6839 nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
6840 oldEndVnode = oldCh[--oldEndIdx];
6841 newStartVnode = newCh[++newStartIdx];
6842 }
6843 else {
6844 if (isUndef(oldKeyToIdx))
6845 oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
6846 idxInOld = isDef(newStartVnode.key)
6847 ? oldKeyToIdx[newStartVnode.key]
6848 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
6849 if (isUndef(idxInOld)) {
6850 // New element
6851 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6852 }
6853 else {
6854 vnodeToMove = oldCh[idxInOld];
6855 if (sameVnode(vnodeToMove, newStartVnode)) {
6856 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6857 oldCh[idxInOld] = undefined;
6858 canMove &&
6859 nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
6860 }
6861 else {
6862 // same key but different element. treat as new element
6863 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6864 }
6865 }
6866 newStartVnode = newCh[++newStartIdx];
6867 }
6868 }
6869 if (oldStartIdx > oldEndIdx) {
6870 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6871 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6872 }
6873 else if (newStartIdx > newEndIdx) {
6874 removeVnodes(oldCh, oldStartIdx, oldEndIdx);
6875 }
6876 }
6877 function checkDuplicateKeys(children) {
6878 var seenKeys = {};
6879 for (var i_4 = 0; i_4 < children.length; i_4++) {
6880 var vnode = children[i_4];
6881 var key = vnode.key;
6882 if (isDef(key)) {
6883 if (seenKeys[key]) {
6884 warn$2("Duplicate keys detected: '".concat(key, "'. This may cause an update error."), vnode.context);
6885 }
6886 else {
6887 seenKeys[key] = true;
6888 }
6889 }
6890 }
6891 }
6892 function findIdxInOld(node, oldCh, start, end) {
6893 for (var i_5 = start; i_5 < end; i_5++) {
6894 var c = oldCh[i_5];
6895 if (isDef(c) && sameVnode(node, c))
6896 return i_5;
6897 }
6898 }
6899 function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) {
6900 if (oldVnode === vnode) {
6901 return;
6902 }
6903 if (isDef(vnode.elm) && isDef(ownerArray)) {
6904 // clone reused vnode
6905 vnode = ownerArray[index] = cloneVNode(vnode);
6906 }
6907 var elm = (vnode.elm = oldVnode.elm);
6908 if (isTrue(oldVnode.isAsyncPlaceholder)) {
6909 if (isDef(vnode.asyncFactory.resolved)) {
6910 hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6911 }
6912 else {
6913 vnode.isAsyncPlaceholder = true;
6914 }
6915 return;
6916 }
6917 // reuse element for static trees.
6918 // note we only do this if the vnode is cloned -
6919 // if the new node is not cloned it means the render functions have been
6920 // reset by the hot-reload-api and we need to do a proper re-render.
6921 if (isTrue(vnode.isStatic) &&
6922 isTrue(oldVnode.isStatic) &&
6923 vnode.key === oldVnode.key &&
6924 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
6925 vnode.componentInstance = oldVnode.componentInstance;
6926 return;
6927 }
6928 var i;
6929 var data = vnode.data;
6930 if (isDef(data) && isDef((i = data.hook)) && isDef((i = i.prepatch))) {
6931 i(oldVnode, vnode);
6932 }
6933 var oldCh = oldVnode.children;
6934 var ch = vnode.children;
6935 if (isDef(data) && isPatchable(vnode)) {
6936 for (i = 0; i < cbs.update.length; ++i)
6937 cbs.update[i](oldVnode, vnode);
6938 if (isDef((i = data.hook)) && isDef((i = i.update)))
6939 i(oldVnode, vnode);
6940 }
6941 if (isUndef(vnode.text)) {
6942 if (isDef(oldCh) && isDef(ch)) {
6943 if (oldCh !== ch)
6944 updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);
6945 }
6946 else if (isDef(ch)) {
6947 {
6948 checkDuplicateKeys(ch);
6949 }
6950 if (isDef(oldVnode.text))
6951 nodeOps.setTextContent(elm, '');
6952 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6953 }
6954 else if (isDef(oldCh)) {
6955 removeVnodes(oldCh, 0, oldCh.length - 1);
6956 }
6957 else if (isDef(oldVnode.text)) {
6958 nodeOps.setTextContent(elm, '');
6959 }
6960 }
6961 else if (oldVnode.text !== vnode.text) {
6962 nodeOps.setTextContent(elm, vnode.text);
6963 }
6964 if (isDef(data)) {
6965 if (isDef((i = data.hook)) && isDef((i = i.postpatch)))
6966 i(oldVnode, vnode);
6967 }
6968 }
6969 function invokeInsertHook(vnode, queue, initial) {
6970 // delay insert hooks for component root nodes, invoke them after the
6971 // element is really inserted
6972 if (isTrue(initial) && isDef(vnode.parent)) {
6973 vnode.parent.data.pendingInsert = queue;
6974 }
6975 else {
6976 for (var i_6 = 0; i_6 < queue.length; ++i_6) {
6977 queue[i_6].data.hook.insert(queue[i_6]);
6978 }
6979 }
6980 }
6981 var hydrationBailed = false;
6982 // list of modules that can skip create hook during hydration because they
6983 // are already rendered on the client or has no need for initialization
6984 // Note: style is excluded because it relies on initial clone for future
6985 // deep updates (#7063).
6986 var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
6987 // Note: this is a browser-only function so we can assume elms are DOM nodes.
6988 function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {
6989 var i;
6990 var tag = vnode.tag, data = vnode.data, children = vnode.children;
6991 inVPre = inVPre || (data && data.pre);
6992 vnode.elm = elm;
6993 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
6994 vnode.isAsyncPlaceholder = true;
6995 return true;
6996 }
6997 // assert node match
6998 {
6999 if (!assertNodeMatch(elm, vnode, inVPre)) {
7000 return false;
7001 }
7002 }
7003 if (isDef(data)) {
7004 if (isDef((i = data.hook)) && isDef((i = i.init)))
7005 i(vnode, true /* hydrating */);
7006 if (isDef((i = vnode.componentInstance))) {
7007 // child component. it should have hydrated its own tree.
7008 initComponent(vnode, insertedVnodeQueue);
7009 return true;
7010 }
7011 }
7012 if (isDef(tag)) {
7013 if (isDef(children)) {
7014 // empty element, allow client to pick up and populate children
7015 if (!elm.hasChildNodes()) {
7016 createChildren(vnode, children, insertedVnodeQueue);
7017 }
7018 else {
7019 // v-html and domProps: innerHTML
7020 if (isDef((i = data)) &&
7021 isDef((i = i.domProps)) &&
7022 isDef((i = i.innerHTML))) {
7023 if (i !== elm.innerHTML) {
7024 /* istanbul ignore if */
7025 if (typeof console !== 'undefined' &&
7026 !hydrationBailed) {
7027 hydrationBailed = true;
7028 console.warn('Parent: ', elm);
7029 console.warn('server innerHTML: ', i);
7030 console.warn('client innerHTML: ', elm.innerHTML);
7031 }
7032 return false;
7033 }
7034 }
7035 else {
7036 // iterate and compare children lists
7037 var childrenMatch = true;
7038 var childNode = elm.firstChild;
7039 for (var i_7 = 0; i_7 < children.length; i_7++) {
7040 if (!childNode ||
7041 !hydrate(childNode, children[i_7], insertedVnodeQueue, inVPre)) {
7042 childrenMatch = false;
7043 break;
7044 }
7045 childNode = childNode.nextSibling;
7046 }
7047 // if childNode is not null, it means the actual childNodes list is
7048 // longer than the virtual children list.
7049 if (!childrenMatch || childNode) {
7050 /* istanbul ignore if */
7051 if (typeof console !== 'undefined' &&
7052 !hydrationBailed) {
7053 hydrationBailed = true;
7054 console.warn('Parent: ', elm);
7055 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
7056 }
7057 return false;
7058 }
7059 }
7060 }
7061 }
7062 if (isDef(data)) {
7063 var fullInvoke = false;
7064 for (var key in data) {
7065 if (!isRenderedModule(key)) {
7066 fullInvoke = true;
7067 invokeCreateHooks(vnode, insertedVnodeQueue);
7068 break;
7069 }
7070 }
7071 if (!fullInvoke && data['class']) {
7072 // ensure collecting deps for deep class bindings for future updates
7073 traverse(data['class']);
7074 }
7075 }
7076 }
7077 else if (elm.data !== vnode.text) {
7078 elm.data = vnode.text;
7079 }
7080 return true;
7081 }
7082 function assertNodeMatch(node, vnode, inVPre) {
7083 if (isDef(vnode.tag)) {
7084 return (vnode.tag.indexOf('vue-component') === 0 ||
7085 (!isUnknownElement(vnode, inVPre) &&
7086 vnode.tag.toLowerCase() ===
7087 (node.tagName && node.tagName.toLowerCase())));
7088 }
7089 else {
7090 return node.nodeType === (vnode.isComment ? 8 : 3);
7091 }
7092 }
7093 return function patch(oldVnode, vnode, hydrating, removeOnly) {
7094 if (isUndef(vnode)) {
7095 if (isDef(oldVnode))
7096 invokeDestroyHook(oldVnode);
7097 return;
7098 }
7099 var isInitialPatch = false;
7100 var insertedVnodeQueue = [];
7101 if (isUndef(oldVnode)) {
7102 // empty mount (likely as component), create new root element
7103 isInitialPatch = true;
7104 createElm(vnode, insertedVnodeQueue);
7105 }
7106 else {
7107 var isRealElement = isDef(oldVnode.nodeType);
7108 if (!isRealElement && sameVnode(oldVnode, vnode)) {
7109 // patch existing root node
7110 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
7111 }
7112 else {
7113 if (isRealElement) {
7114 // mounting to a real element
7115 // check if this is server-rendered content and if we can perform
7116 // a successful hydration.
7117 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
7118 oldVnode.removeAttribute(SSR_ATTR);
7119 hydrating = true;
7120 }
7121 if (isTrue(hydrating)) {
7122 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
7123 invokeInsertHook(vnode, insertedVnodeQueue, true);
7124 return oldVnode;
7125 }
7126 else {
7127 warn$2('The client-side rendered virtual DOM tree is not matching ' +
7128 'server-rendered content. This is likely caused by incorrect ' +
7129 'HTML markup, for example nesting block-level elements inside ' +
7130 '<p>, or missing <tbody>. Bailing hydration and performing ' +
7131 'full client-side render.');
7132 }
7133 }
7134 // either not server-rendered, or hydration failed.
7135 // create an empty node and replace it
7136 oldVnode = emptyNodeAt(oldVnode);
7137 }
7138 // replacing existing element
7139 var oldElm = oldVnode.elm;
7140 var parentElm = nodeOps.parentNode(oldElm);
7141 // create new node
7142 createElm(vnode, insertedVnodeQueue,
7143 // extremely rare edge case: do not insert if old element is in a
7144 // leaving transition. Only happens when combining transition +
7145 // keep-alive + HOCs. (#4590)
7146 oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm));
7147 // update parent placeholder node element, recursively
7148 if (isDef(vnode.parent)) {
7149 var ancestor = vnode.parent;
7150 var patchable = isPatchable(vnode);
7151 while (ancestor) {
7152 for (var i_8 = 0; i_8 < cbs.destroy.length; ++i_8) {
7153 cbs.destroy[i_8](ancestor);
7154 }
7155 ancestor.elm = vnode.elm;
7156 if (patchable) {
7157 for (var i_9 = 0; i_9 < cbs.create.length; ++i_9) {
7158 cbs.create[i_9](emptyNode, ancestor);
7159 }
7160 // #6513
7161 // invoke insert hooks that may have been merged by create hooks.
7162 // e.g. for directives that uses the "inserted" hook.
7163 var insert_1 = ancestor.data.hook.insert;
7164 if (insert_1.merged) {
7165 // start at index 1 to avoid re-invoking component mounted hook
7166 // clone insert hooks to avoid being mutated during iteration.
7167 // e.g. for customed directives under transition group.
7168 var cloned = insert_1.fns.slice(1);
7169 for (var i_10 = 0; i_10 < cloned.length; i_10++) {
7170 cloned[i_10]();
7171 }
7172 }
7173 }
7174 else {
7175 registerRef(ancestor);
7176 }
7177 ancestor = ancestor.parent;
7178 }
7179 }
7180 // destroy old node
7181 if (isDef(parentElm)) {
7182 removeVnodes([oldVnode], 0, 0);
7183 }
7184 else if (isDef(oldVnode.tag)) {
7185 invokeDestroyHook(oldVnode);
7186 }
7187 }
7188 }
7189 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
7190 return vnode.elm;
7191 };
7192 }
7193
7194 var directives$1 = {
7195 create: updateDirectives,
7196 update: updateDirectives,
7197 destroy: function unbindDirectives(vnode) {
7198 // @ts-expect-error emptyNode is not VNodeWithData
7199 updateDirectives(vnode, emptyNode);
7200 }
7201 };
7202 function updateDirectives(oldVnode, vnode) {
7203 if (oldVnode.data.directives || vnode.data.directives) {
7204 _update(oldVnode, vnode);
7205 }
7206 }
7207 function _update(oldVnode, vnode) {
7208 var isCreate = oldVnode === emptyNode;
7209 var isDestroy = vnode === emptyNode;
7210 var oldDirs = normalizeDirectives(oldVnode.data.directives, oldVnode.context);
7211 var newDirs = normalizeDirectives(vnode.data.directives, vnode.context);
7212 var dirsWithInsert = [];
7213 var dirsWithPostpatch = [];
7214 var key, oldDir, dir;
7215 for (key in newDirs) {
7216 oldDir = oldDirs[key];
7217 dir = newDirs[key];
7218 if (!oldDir) {
7219 // new directive, bind
7220 callHook(dir, 'bind', vnode, oldVnode);
7221 if (dir.def && dir.def.inserted) {
7222 dirsWithInsert.push(dir);
7223 }
7224 }
7225 else {
7226 // existing directive, update
7227 dir.oldValue = oldDir.value;
7228 dir.oldArg = oldDir.arg;
7229 callHook(dir, 'update', vnode, oldVnode);
7230 if (dir.def && dir.def.componentUpdated) {
7231 dirsWithPostpatch.push(dir);
7232 }
7233 }
7234 }
7235 if (dirsWithInsert.length) {
7236 var callInsert = function () {
7237 for (var i = 0; i < dirsWithInsert.length; i++) {
7238 callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode);
7239 }
7240 };
7241 if (isCreate) {
7242 mergeVNodeHook(vnode, 'insert', callInsert);
7243 }
7244 else {
7245 callInsert();
7246 }
7247 }
7248 if (dirsWithPostpatch.length) {
7249 mergeVNodeHook(vnode, 'postpatch', function () {
7250 for (var i = 0; i < dirsWithPostpatch.length; i++) {
7251 callHook(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
7252 }
7253 });
7254 }
7255 if (!isCreate) {
7256 for (key in oldDirs) {
7257 if (!newDirs[key]) {
7258 // no longer present, unbind
7259 callHook(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
7260 }
7261 }
7262 }
7263 }
7264 var emptyModifiers = Object.create(null);
7265 function normalizeDirectives(dirs, vm) {
7266 var res = Object.create(null);
7267 if (!dirs) {
7268 // $flow-disable-line
7269 return res;
7270 }
7271 var i, dir;
7272 for (i = 0; i < dirs.length; i++) {
7273 dir = dirs[i];
7274 if (!dir.modifiers) {
7275 // $flow-disable-line
7276 dir.modifiers = emptyModifiers;
7277 }
7278 res[getRawDirName(dir)] = dir;
7279 if (vm._setupState && vm._setupState.__sfc) {
7280 var setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
7281 if (typeof setupDef === 'function') {
7282 dir.def = {
7283 bind: setupDef,
7284 update: setupDef,
7285 };
7286 }
7287 else {
7288 dir.def = setupDef;
7289 }
7290 }
7291 dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
7292 }
7293 // $flow-disable-line
7294 return res;
7295 }
7296 function getRawDirName(dir) {
7297 return (dir.rawName || "".concat(dir.name, ".").concat(Object.keys(dir.modifiers || {}).join('.')));
7298 }
7299 function callHook(dir, hook, vnode, oldVnode, isDestroy) {
7300 var fn = dir.def && dir.def[hook];
7301 if (fn) {
7302 try {
7303 fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
7304 }
7305 catch (e) {
7306 handleError(e, vnode.context, "directive ".concat(dir.name, " ").concat(hook, " hook"));
7307 }
7308 }
7309 }
7310
7311 var baseModules = [ref, directives$1];
7312
7313 function updateAttrs(oldVnode, vnode) {
7314 var opts = vnode.componentOptions;
7315 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
7316 return;
7317 }
7318 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
7319 return;
7320 }
7321 var key, cur, old;
7322 var elm = vnode.elm;
7323 var oldAttrs = oldVnode.data.attrs || {};
7324 var attrs = vnode.data.attrs || {};
7325 // clone observed objects, as the user probably wants to mutate it
7326 if (isDef(attrs.__ob__) || isTrue(attrs._v_attr_proxy)) {
7327 attrs = vnode.data.attrs = extend({}, attrs);
7328 }
7329 for (key in attrs) {
7330 cur = attrs[key];
7331 old = oldAttrs[key];
7332 if (old !== cur) {
7333 setAttr(elm, key, cur, vnode.data.pre);
7334 }
7335 }
7336 // #4391: in IE9, setting type can reset value for input[type=radio]
7337 // #6666: IE/Edge forces progress value down to 1 before setting a max
7338 /* istanbul ignore if */
7339 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
7340 setAttr(elm, 'value', attrs.value);
7341 }
7342 for (key in oldAttrs) {
7343 if (isUndef(attrs[key])) {
7344 if (isXlink(key)) {
7345 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
7346 }
7347 else if (!isEnumeratedAttr(key)) {
7348 elm.removeAttribute(key);
7349 }
7350 }
7351 }
7352 }
7353 function setAttr(el, key, value, isInPre) {
7354 if (isInPre || el.tagName.indexOf('-') > -1) {
7355 baseSetAttr(el, key, value);
7356 }
7357 else if (isBooleanAttr(key)) {
7358 // set attribute for blank value
7359 // e.g. <option disabled>Select one</option>
7360 if (isFalsyAttrValue(value)) {
7361 el.removeAttribute(key);
7362 }
7363 else {
7364 // technically allowfullscreen is a boolean attribute for <iframe>,
7365 // but Flash expects a value of "true" when used on <embed> tag
7366 value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key;
7367 el.setAttribute(key, value);
7368 }
7369 }
7370 else if (isEnumeratedAttr(key)) {
7371 el.setAttribute(key, convertEnumeratedValue(key, value));
7372 }
7373 else if (isXlink(key)) {
7374 if (isFalsyAttrValue(value)) {
7375 el.removeAttributeNS(xlinkNS, getXlinkProp(key));
7376 }
7377 else {
7378 el.setAttributeNS(xlinkNS, key, value);
7379 }
7380 }
7381 else {
7382 baseSetAttr(el, key, value);
7383 }
7384 }
7385 function baseSetAttr(el, key, value) {
7386 if (isFalsyAttrValue(value)) {
7387 el.removeAttribute(key);
7388 }
7389 else {
7390 // #7138: IE10 & 11 fires input event when setting placeholder on
7391 // <textarea>... block the first input event and remove the blocker
7392 // immediately.
7393 /* istanbul ignore if */
7394 if (isIE &&
7395 !isIE9 &&
7396 el.tagName === 'TEXTAREA' &&
7397 key === 'placeholder' &&
7398 value !== '' &&
7399 !el.__ieph) {
7400 var blocker_1 = function (e) {
7401 e.stopImmediatePropagation();
7402 el.removeEventListener('input', blocker_1);
7403 };
7404 el.addEventListener('input', blocker_1);
7405 // $flow-disable-line
7406 el.__ieph = true; /* IE placeholder patched */
7407 }
7408 el.setAttribute(key, value);
7409 }
7410 }
7411 var attrs = {
7412 create: updateAttrs,
7413 update: updateAttrs
7414 };
7415
7416 function updateClass(oldVnode, vnode) {
7417 var el = vnode.elm;
7418 var data = vnode.data;
7419 var oldData = oldVnode.data;
7420 if (isUndef(data.staticClass) &&
7421 isUndef(data.class) &&
7422 (isUndef(oldData) ||
7423 (isUndef(oldData.staticClass) && isUndef(oldData.class)))) {
7424 return;
7425 }
7426 var cls = genClassForVnode(vnode);
7427 // handle transition classes
7428 var transitionClass = el._transitionClasses;
7429 if (isDef(transitionClass)) {
7430 cls = concat(cls, stringifyClass(transitionClass));
7431 }
7432 // set the class
7433 if (cls !== el._prevClass) {
7434 el.setAttribute('class', cls);
7435 el._prevClass = cls;
7436 }
7437 }
7438 var klass$1 = {
7439 create: updateClass,
7440 update: updateClass
7441 };
7442
7443 var validDivisionCharRE = /[\w).+\-_$\]]/;
7444 function parseFilters(exp) {
7445 var inSingle = false;
7446 var inDouble = false;
7447 var inTemplateString = false;
7448 var inRegex = false;
7449 var curly = 0;
7450 var square = 0;
7451 var paren = 0;
7452 var lastFilterIndex = 0;
7453 var c, prev, i, expression, filters;
7454 for (i = 0; i < exp.length; i++) {
7455 prev = c;
7456 c = exp.charCodeAt(i);
7457 if (inSingle) {
7458 if (c === 0x27 && prev !== 0x5c)
7459 inSingle = false;
7460 }
7461 else if (inDouble) {
7462 if (c === 0x22 && prev !== 0x5c)
7463 inDouble = false;
7464 }
7465 else if (inTemplateString) {
7466 if (c === 0x60 && prev !== 0x5c)
7467 inTemplateString = false;
7468 }
7469 else if (inRegex) {
7470 if (c === 0x2f && prev !== 0x5c)
7471 inRegex = false;
7472 }
7473 else if (c === 0x7c && // pipe
7474 exp.charCodeAt(i + 1) !== 0x7c &&
7475 exp.charCodeAt(i - 1) !== 0x7c &&
7476 !curly &&
7477 !square &&
7478 !paren) {
7479 if (expression === undefined) {
7480 // first filter, end of expression
7481 lastFilterIndex = i + 1;
7482 expression = exp.slice(0, i).trim();
7483 }
7484 else {
7485 pushFilter();
7486 }
7487 }
7488 else {
7489 switch (c) {
7490 case 0x22:
7491 inDouble = true;
7492 break; // "
7493 case 0x27:
7494 inSingle = true;
7495 break; // '
7496 case 0x60:
7497 inTemplateString = true;
7498 break; // `
7499 case 0x28:
7500 paren++;
7501 break; // (
7502 case 0x29:
7503 paren--;
7504 break; // )
7505 case 0x5b:
7506 square++;
7507 break; // [
7508 case 0x5d:
7509 square--;
7510 break; // ]
7511 case 0x7b:
7512 curly++;
7513 break; // {
7514 case 0x7d:
7515 curly--;
7516 break; // }
7517 }
7518 if (c === 0x2f) {
7519 // /
7520 var j = i - 1;
7521 var p
7522 // find first non-whitespace prev char
7523 = void 0;
7524 // find first non-whitespace prev char
7525 for (; j >= 0; j--) {
7526 p = exp.charAt(j);
7527 if (p !== ' ')
7528 break;
7529 }
7530 if (!p || !validDivisionCharRE.test(p)) {
7531 inRegex = true;
7532 }
7533 }
7534 }
7535 }
7536 if (expression === undefined) {
7537 expression = exp.slice(0, i).trim();
7538 }
7539 else if (lastFilterIndex !== 0) {
7540 pushFilter();
7541 }
7542 function pushFilter() {
7543 (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
7544 lastFilterIndex = i + 1;
7545 }
7546 if (filters) {
7547 for (i = 0; i < filters.length; i++) {
7548 expression = wrapFilter(expression, filters[i]);
7549 }
7550 }
7551 return expression;
7552 }
7553 function wrapFilter(exp, filter) {
7554 var i = filter.indexOf('(');
7555 if (i < 0) {
7556 // _f: resolveFilter
7557 return "_f(\"".concat(filter, "\")(").concat(exp, ")");
7558 }
7559 else {
7560 var name_1 = filter.slice(0, i);
7561 var args = filter.slice(i + 1);
7562 return "_f(\"".concat(name_1, "\")(").concat(exp).concat(args !== ')' ? ',' + args : args);
7563 }
7564 }
7565
7566 /* eslint-disable no-unused-vars */
7567 function baseWarn(msg, range) {
7568 console.error("[Vue compiler]: ".concat(msg));
7569 }
7570 /* eslint-enable no-unused-vars */
7571 function pluckModuleFunction(modules, key) {
7572 return modules ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; }) : [];
7573 }
7574 function addProp(el, name, value, range, dynamic) {
7575 (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
7576 el.plain = false;
7577 }
7578 function addAttr(el, name, value, range, dynamic) {
7579 var attrs = dynamic
7580 ? el.dynamicAttrs || (el.dynamicAttrs = [])
7581 : el.attrs || (el.attrs = []);
7582 attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
7583 el.plain = false;
7584 }
7585 // add a raw attr (use this in preTransforms)
7586 function addRawAttr(el, name, value, range) {
7587 el.attrsMap[name] = value;
7588 el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
7589 }
7590 function addDirective(el, name, rawName, value, arg, isDynamicArg, modifiers, range) {
7591 (el.directives || (el.directives = [])).push(rangeSetItem({
7592 name: name,
7593 rawName: rawName,
7594 value: value,
7595 arg: arg,
7596 isDynamicArg: isDynamicArg,
7597 modifiers: modifiers
7598 }, range));
7599 el.plain = false;
7600 }
7601 function prependModifierMarker(symbol, name, dynamic) {
7602 return dynamic ? "_p(".concat(name, ",\"").concat(symbol, "\")") : symbol + name; // mark the event as captured
7603 }
7604 function addHandler(el, name, value, modifiers, important, warn, range, dynamic) {
7605 modifiers = modifiers || emptyObject;
7606 // warn prevent and passive modifier
7607 /* istanbul ignore if */
7608 if (warn && modifiers.prevent && modifiers.passive) {
7609 warn("passive and prevent can't be used together. " +
7610 "Passive handler can't prevent default event.", range);
7611 }
7612 // normalize click.right and click.middle since they don't actually fire
7613 // this is technically browser-specific, but at least for now browsers are
7614 // the only target envs that have right/middle clicks.
7615 if (modifiers.right) {
7616 if (dynamic) {
7617 name = "(".concat(name, ")==='click'?'contextmenu':(").concat(name, ")");
7618 }
7619 else if (name === 'click') {
7620 name = 'contextmenu';
7621 delete modifiers.right;
7622 }
7623 }
7624 else if (modifiers.middle) {
7625 if (dynamic) {
7626 name = "(".concat(name, ")==='click'?'mouseup':(").concat(name, ")");
7627 }
7628 else if (name === 'click') {
7629 name = 'mouseup';
7630 }
7631 }
7632 // check capture modifier
7633 if (modifiers.capture) {
7634 delete modifiers.capture;
7635 name = prependModifierMarker('!', name, dynamic);
7636 }
7637 if (modifiers.once) {
7638 delete modifiers.once;
7639 name = prependModifierMarker('~', name, dynamic);
7640 }
7641 /* istanbul ignore if */
7642 if (modifiers.passive) {
7643 delete modifiers.passive;
7644 name = prependModifierMarker('&', name, dynamic);
7645 }
7646 var events;
7647 if (modifiers.native) {
7648 delete modifiers.native;
7649 events = el.nativeEvents || (el.nativeEvents = {});
7650 }
7651 else {
7652 events = el.events || (el.events = {});
7653 }
7654 var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
7655 if (modifiers !== emptyObject) {
7656 newHandler.modifiers = modifiers;
7657 }
7658 var handlers = events[name];
7659 /* istanbul ignore if */
7660 if (Array.isArray(handlers)) {
7661 important ? handlers.unshift(newHandler) : handlers.push(newHandler);
7662 }
7663 else if (handlers) {
7664 events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
7665 }
7666 else {
7667 events[name] = newHandler;
7668 }
7669 el.plain = false;
7670 }
7671 function getRawBindingAttr(el, name) {
7672 return (el.rawAttrsMap[':' + name] ||
7673 el.rawAttrsMap['v-bind:' + name] ||
7674 el.rawAttrsMap[name]);
7675 }
7676 function getBindingAttr(el, name, getStatic) {
7677 var dynamicValue = getAndRemoveAttr(el, ':' + name) || getAndRemoveAttr(el, 'v-bind:' + name);
7678 if (dynamicValue != null) {
7679 return parseFilters(dynamicValue);
7680 }
7681 else if (getStatic !== false) {
7682 var staticValue = getAndRemoveAttr(el, name);
7683 if (staticValue != null) {
7684 return JSON.stringify(staticValue);
7685 }
7686 }
7687 }
7688 // note: this only removes the attr from the Array (attrsList) so that it
7689 // doesn't get processed by processAttrs.
7690 // By default it does NOT remove it from the map (attrsMap) because the map is
7691 // needed during codegen.
7692 function getAndRemoveAttr(el, name, removeFromMap) {
7693 var val;
7694 if ((val = el.attrsMap[name]) != null) {
7695 var list = el.attrsList;
7696 for (var i = 0, l = list.length; i < l; i++) {
7697 if (list[i].name === name) {
7698 list.splice(i, 1);
7699 break;
7700 }
7701 }
7702 }
7703 if (removeFromMap) {
7704 delete el.attrsMap[name];
7705 }
7706 return val;
7707 }
7708 function getAndRemoveAttrByRegex(el, name) {
7709 var list = el.attrsList;
7710 for (var i = 0, l = list.length; i < l; i++) {
7711 var attr = list[i];
7712 if (name.test(attr.name)) {
7713 list.splice(i, 1);
7714 return attr;
7715 }
7716 }
7717 }
7718 function rangeSetItem(item, range) {
7719 if (range) {
7720 if (range.start != null) {
7721 item.start = range.start;
7722 }
7723 if (range.end != null) {
7724 item.end = range.end;
7725 }
7726 }
7727 return item;
7728 }
7729
7730 /**
7731 * Cross-platform code generation for component v-model
7732 */
7733 function genComponentModel(el, value, modifiers) {
7734 var _a = modifiers || {}, number = _a.number, trim = _a.trim;
7735 var baseValueExpression = '$$v';
7736 var valueExpression = baseValueExpression;
7737 if (trim) {
7738 valueExpression =
7739 "(typeof ".concat(baseValueExpression, " === 'string'") +
7740 "? ".concat(baseValueExpression, ".trim()") +
7741 ": ".concat(baseValueExpression, ")");
7742 }
7743 if (number) {
7744 valueExpression = "_n(".concat(valueExpression, ")");
7745 }
7746 var assignment = genAssignmentCode(value, valueExpression);
7747 el.model = {
7748 value: "(".concat(value, ")"),
7749 expression: JSON.stringify(value),
7750 callback: "function (".concat(baseValueExpression, ") {").concat(assignment, "}")
7751 };
7752 }
7753 /**
7754 * Cross-platform codegen helper for generating v-model value assignment code.
7755 */
7756 function genAssignmentCode(value, assignment) {
7757 var res = parseModel(value);
7758 if (res.key === null) {
7759 return "".concat(value, "=").concat(assignment);
7760 }
7761 else {
7762 return "$set(".concat(res.exp, ", ").concat(res.key, ", ").concat(assignment, ")");
7763 }
7764 }
7765 /**
7766 * Parse a v-model expression into a base path and a final key segment.
7767 * Handles both dot-path and possible square brackets.
7768 *
7769 * Possible cases:
7770 *
7771 * - test
7772 * - test[key]
7773 * - test[test1[key]]
7774 * - test["a"][key]
7775 * - xxx.test[a[a].test1[key]]
7776 * - test.xxx.a["asa"][test1[key]]
7777 *
7778 */
7779 var len, str, chr, index, expressionPos, expressionEndPos;
7780 function parseModel(val) {
7781 // Fix https://github.com/vuejs/vue/pull/7730
7782 // allow v-model="obj.val " (trailing whitespace)
7783 val = val.trim();
7784 len = val.length;
7785 if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
7786 index = val.lastIndexOf('.');
7787 if (index > -1) {
7788 return {
7789 exp: val.slice(0, index),
7790 key: '"' + val.slice(index + 1) + '"'
7791 };
7792 }
7793 else {
7794 return {
7795 exp: val,
7796 key: null
7797 };
7798 }
7799 }
7800 str = val;
7801 index = expressionPos = expressionEndPos = 0;
7802 while (!eof()) {
7803 chr = next();
7804 /* istanbul ignore if */
7805 if (isStringStart(chr)) {
7806 parseString(chr);
7807 }
7808 else if (chr === 0x5b) {
7809 parseBracket(chr);
7810 }
7811 }
7812 return {
7813 exp: val.slice(0, expressionPos),
7814 key: val.slice(expressionPos + 1, expressionEndPos)
7815 };
7816 }
7817 function next() {
7818 return str.charCodeAt(++index);
7819 }
7820 function eof() {
7821 return index >= len;
7822 }
7823 function isStringStart(chr) {
7824 return chr === 0x22 || chr === 0x27;
7825 }
7826 function parseBracket(chr) {
7827 var inBracket = 1;
7828 expressionPos = index;
7829 while (!eof()) {
7830 chr = next();
7831 if (isStringStart(chr)) {
7832 parseString(chr);
7833 continue;
7834 }
7835 if (chr === 0x5b)
7836 inBracket++;
7837 if (chr === 0x5d)
7838 inBracket--;
7839 if (inBracket === 0) {
7840 expressionEndPos = index;
7841 break;
7842 }
7843 }
7844 }
7845 function parseString(chr) {
7846 var stringQuote = chr;
7847 while (!eof()) {
7848 chr = next();
7849 if (chr === stringQuote) {
7850 break;
7851 }
7852 }
7853 }
7854
7855 var warn$1;
7856 // in some cases, the event used has to be determined at runtime
7857 // so we used some reserved tokens during compile.
7858 var RANGE_TOKEN = '__r';
7859 var CHECKBOX_RADIO_TOKEN = '__c';
7860 function model$1(el, dir, _warn) {
7861 warn$1 = _warn;
7862 var value = dir.value;
7863 var modifiers = dir.modifiers;
7864 var tag = el.tag;
7865 var type = el.attrsMap.type;
7866 {
7867 // inputs with type="file" are read only and setting the input's
7868 // value will throw an error.
7869 if (tag === 'input' && type === 'file') {
7870 warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\" type=\"file\">:\n") +
7871 "File inputs are read only. Use a v-on:change listener instead.", el.rawAttrsMap['v-model']);
7872 }
7873 }
7874 if (el.component) {
7875 genComponentModel(el, value, modifiers);
7876 // component v-model doesn't need extra runtime
7877 return false;
7878 }
7879 else if (tag === 'select') {
7880 genSelect(el, value, modifiers);
7881 }
7882 else if (tag === 'input' && type === 'checkbox') {
7883 genCheckboxModel(el, value, modifiers);
7884 }
7885 else if (tag === 'input' && type === 'radio') {
7886 genRadioModel(el, value, modifiers);
7887 }
7888 else if (tag === 'input' || tag === 'textarea') {
7889 genDefaultModel(el, value, modifiers);
7890 }
7891 else if (!config.isReservedTag(tag)) {
7892 genComponentModel(el, value, modifiers);
7893 // component v-model doesn't need extra runtime
7894 return false;
7895 }
7896 else {
7897 warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
7898 "v-model is not supported on this element type. " +
7899 "If you are working with contenteditable, it's recommended to " +
7900 'wrap a library dedicated for that purpose inside a custom component.', el.rawAttrsMap['v-model']);
7901 }
7902 // ensure runtime directive metadata
7903 return true;
7904 }
7905 function genCheckboxModel(el, value, modifiers) {
7906 var number = modifiers && modifiers.number;
7907 var valueBinding = getBindingAttr(el, 'value') || 'null';
7908 var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
7909 var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
7910 addProp(el, 'checked', "Array.isArray(".concat(value, ")") +
7911 "?_i(".concat(value, ",").concat(valueBinding, ")>-1") +
7912 (trueValueBinding === 'true'
7913 ? ":(".concat(value, ")")
7914 : ":_q(".concat(value, ",").concat(trueValueBinding, ")")));
7915 addHandler(el, 'change', "var $$a=".concat(value, ",") +
7916 '$$el=$event.target,' +
7917 "$$c=$$el.checked?(".concat(trueValueBinding, "):(").concat(falseValueBinding, ");") +
7918 'if(Array.isArray($$a)){' +
7919 "var $$v=".concat(number ? '_n(' + valueBinding + ')' : valueBinding, ",") +
7920 '$$i=_i($$a,$$v);' +
7921 "if($$el.checked){$$i<0&&(".concat(genAssignmentCode(value, '$$a.concat([$$v])'), ")}") +
7922 "else{$$i>-1&&(".concat(genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))'), ")}") +
7923 "}else{".concat(genAssignmentCode(value, '$$c'), "}"), null, true);
7924 }
7925 function genRadioModel(el, value, modifiers) {
7926 var number = modifiers && modifiers.number;
7927 var valueBinding = getBindingAttr(el, 'value') || 'null';
7928 valueBinding = number ? "_n(".concat(valueBinding, ")") : valueBinding;
7929 addProp(el, 'checked', "_q(".concat(value, ",").concat(valueBinding, ")"));
7930 addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
7931 }
7932 function genSelect(el, value, modifiers) {
7933 var number = modifiers && modifiers.number;
7934 var selectedVal = "Array.prototype.filter" +
7935 ".call($event.target.options,function(o){return o.selected})" +
7936 ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
7937 "return ".concat(number ? '_n(val)' : 'val', "})");
7938 var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
7939 var code = "var $$selectedVal = ".concat(selectedVal, ";");
7940 code = "".concat(code, " ").concat(genAssignmentCode(value, assignment));
7941 addHandler(el, 'change', code, null, true);
7942 }
7943 function genDefaultModel(el, value, modifiers) {
7944 var type = el.attrsMap.type;
7945 // warn if v-bind:value conflicts with v-model
7946 // except for inputs with v-bind:type
7947 {
7948 var value_1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
7949 var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
7950 if (value_1 && !typeBinding) {
7951 var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
7952 warn$1("".concat(binding, "=\"").concat(value_1, "\" conflicts with v-model on the same element ") +
7953 'because the latter already expands to a value binding internally', el.rawAttrsMap[binding]);
7954 }
7955 }
7956 var _a = modifiers || {}, lazy = _a.lazy, number = _a.number, trim = _a.trim;
7957 var needCompositionGuard = !lazy && type !== 'range';
7958 var event = lazy ? 'change' : type === 'range' ? RANGE_TOKEN : 'input';
7959 var valueExpression = '$event.target.value';
7960 if (trim) {
7961 valueExpression = "$event.target.value.trim()";
7962 }
7963 if (number) {
7964 valueExpression = "_n(".concat(valueExpression, ")");
7965 }
7966 var code = genAssignmentCode(value, valueExpression);
7967 if (needCompositionGuard) {
7968 code = "if($event.target.composing)return;".concat(code);
7969 }
7970 addProp(el, 'value', "(".concat(value, ")"));
7971 addHandler(el, event, code, null, true);
7972 if (trim || number) {
7973 addHandler(el, 'blur', '$forceUpdate()');
7974 }
7975 }
7976
7977 // normalize v-model event tokens that can only be determined at runtime.
7978 // it's important to place the event as the first in the array because
7979 // the whole point is ensuring the v-model callback gets called before
7980 // user-attached handlers.
7981 function normalizeEvents(on) {
7982 /* istanbul ignore if */
7983 if (isDef(on[RANGE_TOKEN])) {
7984 // IE input[type=range] only supports `change` event
7985 var event_1 = isIE ? 'change' : 'input';
7986 on[event_1] = [].concat(on[RANGE_TOKEN], on[event_1] || []);
7987 delete on[RANGE_TOKEN];
7988 }
7989 // This was originally intended to fix #4521 but no longer necessary
7990 // after 2.5. Keeping it for backwards compat with generated code from < 2.4
7991 /* istanbul ignore if */
7992 if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
7993 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
7994 delete on[CHECKBOX_RADIO_TOKEN];
7995 }
7996 }
7997 var target;
7998 function createOnceHandler(event, handler, capture) {
7999 var _target = target; // save current target element in closure
8000 return function onceHandler() {
8001 var res = handler.apply(null, arguments);
8002 if (res !== null) {
8003 remove(event, onceHandler, capture, _target);
8004 }
8005 };
8006 }
8007 // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
8008 // implementation and does not fire microtasks in between event propagation, so
8009 // safe to exclude.
8010 var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
8011 function add(name, handler, capture, passive) {
8012 // async edge case #6566: inner click event triggers patch, event handler
8013 // attached to outer element during patch, and triggered again. This
8014 // happens because browsers fire microtask ticks between event propagation.
8015 // the solution is simple: we save the timestamp when a handler is attached,
8016 // and the handler would only fire if the event passed to it was fired
8017 // AFTER it was attached.
8018 if (useMicrotaskFix) {
8019 var attachedTimestamp_1 = currentFlushTimestamp;
8020 var original_1 = handler;
8021 //@ts-expect-error
8022 handler = original_1._wrapper = function (e) {
8023 if (
8024 // no bubbling, should always fire.
8025 // this is just a safety net in case event.timeStamp is unreliable in
8026 // certain weird environments...
8027 e.target === e.currentTarget ||
8028 // event is fired after handler attachment
8029 e.timeStamp >= attachedTimestamp_1 ||
8030 // bail for environments that have buggy event.timeStamp implementations
8031 // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
8032 // #9681 QtWebEngine event.timeStamp is negative value
8033 e.timeStamp <= 0 ||
8034 // #9448 bail if event is fired in another document in a multi-page
8035 // electron/nw.js app, since event.timeStamp will be using a different
8036 // starting reference
8037 e.target.ownerDocument !== document) {
8038 return original_1.apply(this, arguments);
8039 }
8040 };
8041 }
8042 target.addEventListener(name, handler, supportsPassive ? { capture: capture, passive: passive } : capture);
8043 }
8044 function remove(name, handler, capture, _target) {
8045 (_target || target).removeEventListener(name,
8046 //@ts-expect-error
8047 handler._wrapper || handler, capture);
8048 }
8049 function updateDOMListeners(oldVnode, vnode) {
8050 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
8051 return;
8052 }
8053 var on = vnode.data.on || {};
8054 var oldOn = oldVnode.data.on || {};
8055 // vnode is empty when removing all listeners,
8056 // and use old vnode dom element
8057 target = vnode.elm || oldVnode.elm;
8058 normalizeEvents(on);
8059 updateListeners(on, oldOn, add, remove, createOnceHandler, vnode.context);
8060 target = undefined;
8061 }
8062 var events = {
8063 create: updateDOMListeners,
8064 update: updateDOMListeners,
8065 // @ts-expect-error emptyNode has actually data
8066 destroy: function (vnode) { return updateDOMListeners(vnode, emptyNode); }
8067 };
8068
8069 var svgContainer;
8070 function updateDOMProps(oldVnode, vnode) {
8071 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
8072 return;
8073 }
8074 var key, cur;
8075 var elm = vnode.elm;
8076 var oldProps = oldVnode.data.domProps || {};
8077 var props = vnode.data.domProps || {};
8078 // clone observed objects, as the user probably wants to mutate it
8079 if (isDef(props.__ob__) || isTrue(props._v_attr_proxy)) {
8080 props = vnode.data.domProps = extend({}, props);
8081 }
8082 for (key in oldProps) {
8083 if (!(key in props)) {
8084 elm[key] = '';
8085 }
8086 }
8087 for (key in props) {
8088 cur = props[key];
8089 // ignore children if the node has textContent or innerHTML,
8090 // as these will throw away existing DOM nodes and cause removal errors
8091 // on subsequent patches (#3360)
8092 if (key === 'textContent' || key === 'innerHTML') {
8093 if (vnode.children)
8094 vnode.children.length = 0;
8095 if (cur === oldProps[key])
8096 continue;
8097 // #6601 work around Chrome version <= 55 bug where single textNode
8098 // replaced by innerHTML/textContent retains its parentNode property
8099 if (elm.childNodes.length === 1) {
8100 elm.removeChild(elm.childNodes[0]);
8101 }
8102 }
8103 if (key === 'value' && elm.tagName !== 'PROGRESS') {
8104 // store value as _value as well since
8105 // non-string values will be stringified
8106 elm._value = cur;
8107 // avoid resetting cursor position when value is the same
8108 var strCur = isUndef(cur) ? '' : String(cur);
8109 if (shouldUpdateValue(elm, strCur)) {
8110 elm.value = strCur;
8111 }
8112 }
8113 else if (key === 'innerHTML' &&
8114 isSVG(elm.tagName) &&
8115 isUndef(elm.innerHTML)) {
8116 // IE doesn't support innerHTML for SVG elements
8117 svgContainer = svgContainer || document.createElement('div');
8118 svgContainer.innerHTML = "<svg>".concat(cur, "</svg>");
8119 var svg = svgContainer.firstChild;
8120 while (elm.firstChild) {
8121 elm.removeChild(elm.firstChild);
8122 }
8123 while (svg.firstChild) {
8124 elm.appendChild(svg.firstChild);
8125 }
8126 }
8127 else if (
8128 // skip the update if old and new VDOM state is the same.
8129 // `value` is handled separately because the DOM value may be temporarily
8130 // out of sync with VDOM state due to focus, composition and modifiers.
8131 // This #4521 by skipping the unnecessary `checked` update.
8132 cur !== oldProps[key]) {
8133 // some property updates can throw
8134 // e.g. `value` on <progress> w/ non-finite value
8135 try {
8136 elm[key] = cur;
8137 }
8138 catch (e) { }
8139 }
8140 }
8141 }
8142 function shouldUpdateValue(elm, checkVal) {
8143 return (
8144 //@ts-expect-error
8145 !elm.composing &&
8146 (elm.tagName === 'OPTION' ||
8147 isNotInFocusAndDirty(elm, checkVal) ||
8148 isDirtyWithModifiers(elm, checkVal)));
8149 }
8150 function isNotInFocusAndDirty(elm, checkVal) {
8151 // return true when textbox (.number and .trim) loses focus and its value is
8152 // not equal to the updated value
8153 var notInFocus = true;
8154 // #6157
8155 // work around IE bug when accessing document.activeElement in an iframe
8156 try {
8157 notInFocus = document.activeElement !== elm;
8158 }
8159 catch (e) { }
8160 return notInFocus && elm.value !== checkVal;
8161 }
8162 function isDirtyWithModifiers(elm, newVal) {
8163 var value = elm.value;
8164 var modifiers = elm._vModifiers; // injected by v-model runtime
8165 if (isDef(modifiers)) {
8166 if (modifiers.number) {
8167 return toNumber(value) !== toNumber(newVal);
8168 }
8169 if (modifiers.trim) {
8170 return value.trim() !== newVal.trim();
8171 }
8172 }
8173 return value !== newVal;
8174 }
8175 var domProps = {
8176 create: updateDOMProps,
8177 update: updateDOMProps
8178 };
8179
8180 var parseStyleText = cached(function (cssText) {
8181 var res = {};
8182 var listDelimiter = /;(?![^(]*\))/g;
8183 var propertyDelimiter = /:(.+)/;
8184 cssText.split(listDelimiter).forEach(function (item) {
8185 if (item) {
8186 var tmp = item.split(propertyDelimiter);
8187 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
8188 }
8189 });
8190 return res;
8191 });
8192 // merge static and dynamic style data on the same vnode
8193 function normalizeStyleData(data) {
8194 var style = normalizeStyleBinding(data.style);
8195 // static style is pre-processed into an object during compilation
8196 // and is always a fresh object, so it's safe to merge into it
8197 return data.staticStyle ? extend(data.staticStyle, style) : style;
8198 }
8199 // normalize possible array / string values into Object
8200 function normalizeStyleBinding(bindingStyle) {
8201 if (Array.isArray(bindingStyle)) {
8202 return toObject(bindingStyle);
8203 }
8204 if (typeof bindingStyle === 'string') {
8205 return parseStyleText(bindingStyle);
8206 }
8207 return bindingStyle;
8208 }
8209 /**
8210 * parent component style should be after child's
8211 * so that parent component's style could override it
8212 */
8213 function getStyle(vnode, checkChild) {
8214 var res = {};
8215 var styleData;
8216 if (checkChild) {
8217 var childNode = vnode;
8218 while (childNode.componentInstance) {
8219 childNode = childNode.componentInstance._vnode;
8220 if (childNode &&
8221 childNode.data &&
8222 (styleData = normalizeStyleData(childNode.data))) {
8223 extend(res, styleData);
8224 }
8225 }
8226 }
8227 if ((styleData = normalizeStyleData(vnode.data))) {
8228 extend(res, styleData);
8229 }
8230 var parentNode = vnode;
8231 // @ts-expect-error parentNode.parent not VNodeWithData
8232 while ((parentNode = parentNode.parent)) {
8233 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
8234 extend(res, styleData);
8235 }
8236 }
8237 return res;
8238 }
8239
8240 var cssVarRE = /^--/;
8241 var importantRE = /\s*!important$/;
8242 var setProp = function (el, name, val) {
8243 /* istanbul ignore if */
8244 if (cssVarRE.test(name)) {
8245 el.style.setProperty(name, val);
8246 }
8247 else if (importantRE.test(val)) {
8248 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
8249 }
8250 else {
8251 var normalizedName = normalize(name);
8252 if (Array.isArray(val)) {
8253 // Support values array created by autoprefixer, e.g.
8254 // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
8255 // Set them one by one, and the browser will only set those it can recognize
8256 for (var i = 0, len = val.length; i < len; i++) {
8257 el.style[normalizedName] = val[i];
8258 }
8259 }
8260 else {
8261 el.style[normalizedName] = val;
8262 }
8263 }
8264 };
8265 var vendorNames = ['Webkit', 'Moz', 'ms'];
8266 var emptyStyle;
8267 var normalize = cached(function (prop) {
8268 emptyStyle = emptyStyle || document.createElement('div').style;
8269 prop = camelize(prop);
8270 if (prop !== 'filter' && prop in emptyStyle) {
8271 return prop;
8272 }
8273 var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
8274 for (var i = 0; i < vendorNames.length; i++) {
8275 var name_1 = vendorNames[i] + capName;
8276 if (name_1 in emptyStyle) {
8277 return name_1;
8278 }
8279 }
8280 });
8281 function updateStyle(oldVnode, vnode) {
8282 var data = vnode.data;
8283 var oldData = oldVnode.data;
8284 if (isUndef(data.staticStyle) &&
8285 isUndef(data.style) &&
8286 isUndef(oldData.staticStyle) &&
8287 isUndef(oldData.style)) {
8288 return;
8289 }
8290 var cur, name;
8291 var el = vnode.elm;
8292 var oldStaticStyle = oldData.staticStyle;
8293 var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
8294 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
8295 var oldStyle = oldStaticStyle || oldStyleBinding;
8296 var style = normalizeStyleBinding(vnode.data.style) || {};
8297 // store normalized style under a different key for next diff
8298 // make sure to clone it if it's reactive, since the user likely wants
8299 // to mutate it.
8300 vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style;
8301 var newStyle = getStyle(vnode, true);
8302 for (name in oldStyle) {
8303 if (isUndef(newStyle[name])) {
8304 setProp(el, name, '');
8305 }
8306 }
8307 for (name in newStyle) {
8308 cur = newStyle[name];
8309 // ie9 setting to null has no effect, must use empty string
8310 setProp(el, name, cur == null ? '' : cur);
8311 }
8312 }
8313 var style$1 = {
8314 create: updateStyle,
8315 update: updateStyle
8316 };
8317
8318 var whitespaceRE$1 = /\s+/;
8319 /**
8320 * Add class with compatibility for SVG since classList is not supported on
8321 * SVG elements in IE
8322 */
8323 function addClass(el, cls) {
8324 /* istanbul ignore if */
8325 if (!cls || !(cls = cls.trim())) {
8326 return;
8327 }
8328 /* istanbul ignore else */
8329 if (el.classList) {
8330 if (cls.indexOf(' ') > -1) {
8331 cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.add(c); });
8332 }
8333 else {
8334 el.classList.add(cls);
8335 }
8336 }
8337 else {
8338 var cur = " ".concat(el.getAttribute('class') || '', " ");
8339 if (cur.indexOf(' ' + cls + ' ') < 0) {
8340 el.setAttribute('class', (cur + cls).trim());
8341 }
8342 }
8343 }
8344 /**
8345 * Remove class with compatibility for SVG since classList is not supported on
8346 * SVG elements in IE
8347 */
8348 function removeClass(el, cls) {
8349 /* istanbul ignore if */
8350 if (!cls || !(cls = cls.trim())) {
8351 return;
8352 }
8353 /* istanbul ignore else */
8354 if (el.classList) {
8355 if (cls.indexOf(' ') > -1) {
8356 cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.remove(c); });
8357 }
8358 else {
8359 el.classList.remove(cls);
8360 }
8361 if (!el.classList.length) {
8362 el.removeAttribute('class');
8363 }
8364 }
8365 else {
8366 var cur = " ".concat(el.getAttribute('class') || '', " ");
8367 var tar = ' ' + cls + ' ';
8368 while (cur.indexOf(tar) >= 0) {
8369 cur = cur.replace(tar, ' ');
8370 }
8371 cur = cur.trim();
8372 if (cur) {
8373 el.setAttribute('class', cur);
8374 }
8375 else {
8376 el.removeAttribute('class');
8377 }
8378 }
8379 }
8380
8381 function resolveTransition(def) {
8382 if (!def) {
8383 return;
8384 }
8385 /* istanbul ignore else */
8386 if (typeof def === 'object') {
8387 var res = {};
8388 if (def.css !== false) {
8389 extend(res, autoCssTransition(def.name || 'v'));
8390 }
8391 extend(res, def);
8392 return res;
8393 }
8394 else if (typeof def === 'string') {
8395 return autoCssTransition(def);
8396 }
8397 }
8398 var autoCssTransition = cached(function (name) {
8399 return {
8400 enterClass: "".concat(name, "-enter"),
8401 enterToClass: "".concat(name, "-enter-to"),
8402 enterActiveClass: "".concat(name, "-enter-active"),
8403 leaveClass: "".concat(name, "-leave"),
8404 leaveToClass: "".concat(name, "-leave-to"),
8405 leaveActiveClass: "".concat(name, "-leave-active")
8406 };
8407 });
8408 var hasTransition = inBrowser && !isIE9;
8409 var TRANSITION = 'transition';
8410 var ANIMATION = 'animation';
8411 // Transition property/event sniffing
8412 var transitionProp = 'transition';
8413 var transitionEndEvent = 'transitionend';
8414 var animationProp = 'animation';
8415 var animationEndEvent = 'animationend';
8416 if (hasTransition) {
8417 /* istanbul ignore if */
8418 if (window.ontransitionend === undefined &&
8419 window.onwebkittransitionend !== undefined) {
8420 transitionProp = 'WebkitTransition';
8421 transitionEndEvent = 'webkitTransitionEnd';
8422 }
8423 if (window.onanimationend === undefined &&
8424 window.onwebkitanimationend !== undefined) {
8425 animationProp = 'WebkitAnimation';
8426 animationEndEvent = 'webkitAnimationEnd';
8427 }
8428 }
8429 // binding to window is necessary to make hot reload work in IE in strict mode
8430 var raf = inBrowser
8431 ? window.requestAnimationFrame
8432 ? window.requestAnimationFrame.bind(window)
8433 : setTimeout
8434 : /* istanbul ignore next */ function (/* istanbul ignore next */ fn) { return fn(); };
8435 function nextFrame(fn) {
8436 raf(function () {
8437 // @ts-expect-error
8438 raf(fn);
8439 });
8440 }
8441 function addTransitionClass(el, cls) {
8442 var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
8443 if (transitionClasses.indexOf(cls) < 0) {
8444 transitionClasses.push(cls);
8445 addClass(el, cls);
8446 }
8447 }
8448 function removeTransitionClass(el, cls) {
8449 if (el._transitionClasses) {
8450 remove$2(el._transitionClasses, cls);
8451 }
8452 removeClass(el, cls);
8453 }
8454 function whenTransitionEnds(el, expectedType, cb) {
8455 var _a = getTransitionInfo(el, expectedType), type = _a.type, timeout = _a.timeout, propCount = _a.propCount;
8456 if (!type)
8457 return cb();
8458 var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
8459 var ended = 0;
8460 var end = function () {
8461 el.removeEventListener(event, onEnd);
8462 cb();
8463 };
8464 var onEnd = function (e) {
8465 if (e.target === el) {
8466 if (++ended >= propCount) {
8467 end();
8468 }
8469 }
8470 };
8471 setTimeout(function () {
8472 if (ended < propCount) {
8473 end();
8474 }
8475 }, timeout + 1);
8476 el.addEventListener(event, onEnd);
8477 }
8478 var transformRE = /\b(transform|all)(,|$)/;
8479 function getTransitionInfo(el, expectedType) {
8480 var styles = window.getComputedStyle(el);
8481 // JSDOM may return undefined for transition properties
8482 var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
8483 var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
8484 var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
8485 var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
8486 var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
8487 var animationTimeout = getTimeout(animationDelays, animationDurations);
8488 var type;
8489 var timeout = 0;
8490 var propCount = 0;
8491 /* istanbul ignore if */
8492 if (expectedType === TRANSITION) {
8493 if (transitionTimeout > 0) {
8494 type = TRANSITION;
8495 timeout = transitionTimeout;
8496 propCount = transitionDurations.length;
8497 }
8498 }
8499 else if (expectedType === ANIMATION) {
8500 if (animationTimeout > 0) {
8501 type = ANIMATION;
8502 timeout = animationTimeout;
8503 propCount = animationDurations.length;
8504 }
8505 }
8506 else {
8507 timeout = Math.max(transitionTimeout, animationTimeout);
8508 type =
8509 timeout > 0
8510 ? transitionTimeout > animationTimeout
8511 ? TRANSITION
8512 : ANIMATION
8513 : null;
8514 propCount = type
8515 ? type === TRANSITION
8516 ? transitionDurations.length
8517 : animationDurations.length
8518 : 0;
8519 }
8520 var hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
8521 return {
8522 type: type,
8523 timeout: timeout,
8524 propCount: propCount,
8525 hasTransform: hasTransform
8526 };
8527 }
8528 function getTimeout(delays, durations) {
8529 /* istanbul ignore next */
8530 while (delays.length < durations.length) {
8531 delays = delays.concat(delays);
8532 }
8533 return Math.max.apply(null, durations.map(function (d, i) {
8534 return toMs(d) + toMs(delays[i]);
8535 }));
8536 }
8537 // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
8538 // in a locale-dependent way, using a comma instead of a dot.
8539 // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
8540 // as a floor function) causing unexpected behaviors
8541 function toMs(s) {
8542 return Number(s.slice(0, -1).replace(',', '.')) * 1000;
8543 }
8544
8545 function enter(vnode, toggleDisplay) {
8546 var el = vnode.elm;
8547 // call leave callback now
8548 if (isDef(el._leaveCb)) {
8549 el._leaveCb.cancelled = true;
8550 el._leaveCb();
8551 }
8552 var data = resolveTransition(vnode.data.transition);
8553 if (isUndef(data)) {
8554 return;
8555 }
8556 /* istanbul ignore if */
8557 if (isDef(el._enterCb) || el.nodeType !== 1) {
8558 return;
8559 }
8560 var css = data.css, type = data.type, enterClass = data.enterClass, enterToClass = data.enterToClass, enterActiveClass = data.enterActiveClass, appearClass = data.appearClass, appearToClass = data.appearToClass, appearActiveClass = data.appearActiveClass, beforeEnter = data.beforeEnter, enter = data.enter, afterEnter = data.afterEnter, enterCancelled = data.enterCancelled, beforeAppear = data.beforeAppear, appear = data.appear, afterAppear = data.afterAppear, appearCancelled = data.appearCancelled, duration = data.duration;
8561 // activeInstance will always be the <transition> component managing this
8562 // transition. One edge case to check is when the <transition> is placed
8563 // as the root node of a child component. In that case we need to check
8564 // <transition>'s parent for appear check.
8565 var context = activeInstance;
8566 var transitionNode = activeInstance.$vnode;
8567 while (transitionNode && transitionNode.parent) {
8568 context = transitionNode.context;
8569 transitionNode = transitionNode.parent;
8570 }
8571 var isAppear = !context._isMounted || !vnode.isRootInsert;
8572 if (isAppear && !appear && appear !== '') {
8573 return;
8574 }
8575 var startClass = isAppear && appearClass ? appearClass : enterClass;
8576 var activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass;
8577 var toClass = isAppear && appearToClass ? appearToClass : enterToClass;
8578 var beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter;
8579 var enterHook = isAppear ? (isFunction(appear) ? appear : enter) : enter;
8580 var afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter;
8581 var enterCancelledHook = isAppear
8582 ? appearCancelled || enterCancelled
8583 : enterCancelled;
8584 var explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration);
8585 if (explicitEnterDuration != null) {
8586 checkDuration(explicitEnterDuration, 'enter', vnode);
8587 }
8588 var expectsCSS = css !== false && !isIE9;
8589 var userWantsControl = getHookArgumentsLength(enterHook);
8590 var cb = (el._enterCb = once(function () {
8591 if (expectsCSS) {
8592 removeTransitionClass(el, toClass);
8593 removeTransitionClass(el, activeClass);
8594 }
8595 // @ts-expect-error
8596 if (cb.cancelled) {
8597 if (expectsCSS) {
8598 removeTransitionClass(el, startClass);
8599 }
8600 enterCancelledHook && enterCancelledHook(el);
8601 }
8602 else {
8603 afterEnterHook && afterEnterHook(el);
8604 }
8605 el._enterCb = null;
8606 }));
8607 if (!vnode.data.show) {
8608 // remove pending leave element on enter by injecting an insert hook
8609 mergeVNodeHook(vnode, 'insert', function () {
8610 var parent = el.parentNode;
8611 var pendingNode = parent && parent._pending && parent._pending[vnode.key];
8612 if (pendingNode &&
8613 pendingNode.tag === vnode.tag &&
8614 pendingNode.elm._leaveCb) {
8615 pendingNode.elm._leaveCb();
8616 }
8617 enterHook && enterHook(el, cb);
8618 });
8619 }
8620 // start enter transition
8621 beforeEnterHook && beforeEnterHook(el);
8622 if (expectsCSS) {
8623 addTransitionClass(el, startClass);
8624 addTransitionClass(el, activeClass);
8625 nextFrame(function () {
8626 removeTransitionClass(el, startClass);
8627 // @ts-expect-error
8628 if (!cb.cancelled) {
8629 addTransitionClass(el, toClass);
8630 if (!userWantsControl) {
8631 if (isValidDuration(explicitEnterDuration)) {
8632 setTimeout(cb, explicitEnterDuration);
8633 }
8634 else {
8635 whenTransitionEnds(el, type, cb);
8636 }
8637 }
8638 }
8639 });
8640 }
8641 if (vnode.data.show) {
8642 toggleDisplay && toggleDisplay();
8643 enterHook && enterHook(el, cb);
8644 }
8645 if (!expectsCSS && !userWantsControl) {
8646 cb();
8647 }
8648 }
8649 function leave(vnode, rm) {
8650 var el = vnode.elm;
8651 // call enter callback now
8652 if (isDef(el._enterCb)) {
8653 el._enterCb.cancelled = true;
8654 el._enterCb();
8655 }
8656 var data = resolveTransition(vnode.data.transition);
8657 if (isUndef(data) || el.nodeType !== 1) {
8658 return rm();
8659 }
8660 /* istanbul ignore if */
8661 if (isDef(el._leaveCb)) {
8662 return;
8663 }
8664 var css = data.css, type = data.type, leaveClass = data.leaveClass, leaveToClass = data.leaveToClass, leaveActiveClass = data.leaveActiveClass, beforeLeave = data.beforeLeave, leave = data.leave, afterLeave = data.afterLeave, leaveCancelled = data.leaveCancelled, delayLeave = data.delayLeave, duration = data.duration;
8665 var expectsCSS = css !== false && !isIE9;
8666 var userWantsControl = getHookArgumentsLength(leave);
8667 var explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration);
8668 if (isDef(explicitLeaveDuration)) {
8669 checkDuration(explicitLeaveDuration, 'leave', vnode);
8670 }
8671 var cb = (el._leaveCb = once(function () {
8672 if (el.parentNode && el.parentNode._pending) {
8673 el.parentNode._pending[vnode.key] = null;
8674 }
8675 if (expectsCSS) {
8676 removeTransitionClass(el, leaveToClass);
8677 removeTransitionClass(el, leaveActiveClass);
8678 }
8679 // @ts-expect-error
8680 if (cb.cancelled) {
8681 if (expectsCSS) {
8682 removeTransitionClass(el, leaveClass);
8683 }
8684 leaveCancelled && leaveCancelled(el);
8685 }
8686 else {
8687 rm();
8688 afterLeave && afterLeave(el);
8689 }
8690 el._leaveCb = null;
8691 }));
8692 if (delayLeave) {
8693 delayLeave(performLeave);
8694 }
8695 else {
8696 performLeave();
8697 }
8698 function performLeave() {
8699 // the delayed leave may have already been cancelled
8700 // @ts-expect-error
8701 if (cb.cancelled) {
8702 return;
8703 }
8704 // record leaving element
8705 if (!vnode.data.show && el.parentNode) {
8706 (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] =
8707 vnode;
8708 }
8709 beforeLeave && beforeLeave(el);
8710 if (expectsCSS) {
8711 addTransitionClass(el, leaveClass);
8712 addTransitionClass(el, leaveActiveClass);
8713 nextFrame(function () {
8714 removeTransitionClass(el, leaveClass);
8715 // @ts-expect-error
8716 if (!cb.cancelled) {
8717 addTransitionClass(el, leaveToClass);
8718 if (!userWantsControl) {
8719 if (isValidDuration(explicitLeaveDuration)) {
8720 setTimeout(cb, explicitLeaveDuration);
8721 }
8722 else {
8723 whenTransitionEnds(el, type, cb);
8724 }
8725 }
8726 }
8727 });
8728 }
8729 leave && leave(el, cb);
8730 if (!expectsCSS && !userWantsControl) {
8731 cb();
8732 }
8733 }
8734 }
8735 // only used in dev mode
8736 function checkDuration(val, name, vnode) {
8737 if (typeof val !== 'number') {
8738 warn$2("<transition> explicit ".concat(name, " duration is not a valid number - ") +
8739 "got ".concat(JSON.stringify(val), "."), vnode.context);
8740 }
8741 else if (isNaN(val)) {
8742 warn$2("<transition> explicit ".concat(name, " duration is NaN - ") +
8743 'the duration expression might be incorrect.', vnode.context);
8744 }
8745 }
8746 function isValidDuration(val) {
8747 return typeof val === 'number' && !isNaN(val);
8748 }
8749 /**
8750 * Normalize a transition hook's argument length. The hook may be:
8751 * - a merged hook (invoker) with the original in .fns
8752 * - a wrapped component method (check ._length)
8753 * - a plain function (.length)
8754 */
8755 function getHookArgumentsLength(fn) {
8756 if (isUndef(fn)) {
8757 return false;
8758 }
8759 // @ts-expect-error
8760 var invokerFns = fn.fns;
8761 if (isDef(invokerFns)) {
8762 // invoker
8763 return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns);
8764 }
8765 else {
8766 // @ts-expect-error
8767 return (fn._length || fn.length) > 1;
8768 }
8769 }
8770 function _enter(_, vnode) {
8771 if (vnode.data.show !== true) {
8772 enter(vnode);
8773 }
8774 }
8775 var transition = inBrowser
8776 ? {
8777 create: _enter,
8778 activate: _enter,
8779 remove: function (vnode, rm) {
8780 /* istanbul ignore else */
8781 if (vnode.data.show !== true) {
8782 // @ts-expect-error
8783 leave(vnode, rm);
8784 }
8785 else {
8786 rm();
8787 }
8788 }
8789 }
8790 : {};
8791
8792 var platformModules = [attrs, klass$1, events, domProps, style$1, transition];
8793
8794 // the directive module should be applied last, after all
8795 // built-in modules have been applied.
8796 var modules$1 = platformModules.concat(baseModules);
8797 var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules$1 });
8798
8799 /**
8800 * Not type checking this file because flow doesn't like attaching
8801 * properties to Elements.
8802 */
8803 /* istanbul ignore if */
8804 if (isIE9) {
8805 // http://www.matts411.com/post/internet-explorer-9-oninput/
8806 document.addEventListener('selectionchange', function () {
8807 var el = document.activeElement;
8808 // @ts-expect-error
8809 if (el && el.vmodel) {
8810 trigger(el, 'input');
8811 }
8812 });
8813 }
8814 var directive = {
8815 inserted: function (el, binding, vnode, oldVnode) {
8816 if (vnode.tag === 'select') {
8817 // #6903
8818 if (oldVnode.elm && !oldVnode.elm._vOptions) {
8819 mergeVNodeHook(vnode, 'postpatch', function () {
8820 directive.componentUpdated(el, binding, vnode);
8821 });
8822 }
8823 else {
8824 setSelected(el, binding, vnode.context);
8825 }
8826 el._vOptions = [].map.call(el.options, getValue);
8827 }
8828 else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
8829 el._vModifiers = binding.modifiers;
8830 if (!binding.modifiers.lazy) {
8831 el.addEventListener('compositionstart', onCompositionStart);
8832 el.addEventListener('compositionend', onCompositionEnd);
8833 // Safari < 10.2 & UIWebView doesn't fire compositionend when
8834 // switching focus before confirming composition choice
8835 // this also fixes the issue where some browsers e.g. iOS Chrome
8836 // fires "change" instead of "input" on autocomplete.
8837 el.addEventListener('change', onCompositionEnd);
8838 /* istanbul ignore if */
8839 if (isIE9) {
8840 el.vmodel = true;
8841 }
8842 }
8843 }
8844 },
8845 componentUpdated: function (el, binding, vnode) {
8846 if (vnode.tag === 'select') {
8847 setSelected(el, binding, vnode.context);
8848 // in case the options rendered by v-for have changed,
8849 // it's possible that the value is out-of-sync with the rendered options.
8850 // detect such cases and filter out values that no longer has a matching
8851 // option in the DOM.
8852 var prevOptions_1 = el._vOptions;
8853 var curOptions_1 = (el._vOptions = [].map.call(el.options, getValue));
8854 if (curOptions_1.some(function (o, i) { return !looseEqual(o, prevOptions_1[i]); })) {
8855 // trigger change event if
8856 // no matching option found for at least one value
8857 var needReset = el.multiple
8858 ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions_1); })
8859 : binding.value !== binding.oldValue &&
8860 hasNoMatchingOption(binding.value, curOptions_1);
8861 if (needReset) {
8862 trigger(el, 'change');
8863 }
8864 }
8865 }
8866 }
8867 };
8868 function setSelected(el, binding, vm) {
8869 actuallySetSelected(el, binding, vm);
8870 /* istanbul ignore if */
8871 if (isIE || isEdge) {
8872 setTimeout(function () {
8873 actuallySetSelected(el, binding, vm);
8874 }, 0);
8875 }
8876 }
8877 function actuallySetSelected(el, binding, vm) {
8878 var value = binding.value;
8879 var isMultiple = el.multiple;
8880 if (isMultiple && !Array.isArray(value)) {
8881 warn$2("<select multiple v-model=\"".concat(binding.expression, "\"> ") +
8882 "expects an Array value for its binding, but got ".concat(Object.prototype.toString
8883 .call(value)
8884 .slice(8, -1)), vm);
8885 return;
8886 }
8887 var selected, option;
8888 for (var i = 0, l = el.options.length; i < l; i++) {
8889 option = el.options[i];
8890 if (isMultiple) {
8891 selected = looseIndexOf(value, getValue(option)) > -1;
8892 if (option.selected !== selected) {
8893 option.selected = selected;
8894 }
8895 }
8896 else {
8897 if (looseEqual(getValue(option), value)) {
8898 if (el.selectedIndex !== i) {
8899 el.selectedIndex = i;
8900 }
8901 return;
8902 }
8903 }
8904 }
8905 if (!isMultiple) {
8906 el.selectedIndex = -1;
8907 }
8908 }
8909 function hasNoMatchingOption(value, options) {
8910 return options.every(function (o) { return !looseEqual(o, value); });
8911 }
8912 function getValue(option) {
8913 return '_value' in option ? option._value : option.value;
8914 }
8915 function onCompositionStart(e) {
8916 e.target.composing = true;
8917 }
8918 function onCompositionEnd(e) {
8919 // prevent triggering an input event for no reason
8920 if (!e.target.composing)
8921 return;
8922 e.target.composing = false;
8923 trigger(e.target, 'input');
8924 }
8925 function trigger(el, type) {
8926 var e = document.createEvent('HTMLEvents');
8927 e.initEvent(type, true, true);
8928 el.dispatchEvent(e);
8929 }
8930
8931 // recursively search for possible transition defined inside the component root
8932 function locateNode(vnode) {
8933 // @ts-expect-error
8934 return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
8935 ? locateNode(vnode.componentInstance._vnode)
8936 : vnode;
8937 }
8938 var show = {
8939 bind: function (el, _a, vnode) {
8940 var value = _a.value;
8941 vnode = locateNode(vnode);
8942 var transition = vnode.data && vnode.data.transition;
8943 var originalDisplay = (el.__vOriginalDisplay =
8944 el.style.display === 'none' ? '' : el.style.display);
8945 if (value && transition) {
8946 vnode.data.show = true;
8947 enter(vnode, function () {
8948 el.style.display = originalDisplay;
8949 });
8950 }
8951 else {
8952 el.style.display = value ? originalDisplay : 'none';
8953 }
8954 },
8955 update: function (el, _a, vnode) {
8956 var value = _a.value, oldValue = _a.oldValue;
8957 /* istanbul ignore if */
8958 if (!value === !oldValue)
8959 return;
8960 vnode = locateNode(vnode);
8961 var transition = vnode.data && vnode.data.transition;
8962 if (transition) {
8963 vnode.data.show = true;
8964 if (value) {
8965 enter(vnode, function () {
8966 el.style.display = el.__vOriginalDisplay;
8967 });
8968 }
8969 else {
8970 leave(vnode, function () {
8971 el.style.display = 'none';
8972 });
8973 }
8974 }
8975 else {
8976 el.style.display = value ? el.__vOriginalDisplay : 'none';
8977 }
8978 },
8979 unbind: function (el, binding, vnode, oldVnode, isDestroy) {
8980 if (!isDestroy) {
8981 el.style.display = el.__vOriginalDisplay;
8982 }
8983 }
8984 };
8985
8986 var platformDirectives = {
8987 model: directive,
8988 show: show
8989 };
8990
8991 // Provides transition support for a single element/component.
8992 var transitionProps = {
8993 name: String,
8994 appear: Boolean,
8995 css: Boolean,
8996 mode: String,
8997 type: String,
8998 enterClass: String,
8999 leaveClass: String,
9000 enterToClass: String,
9001 leaveToClass: String,
9002 enterActiveClass: String,
9003 leaveActiveClass: String,
9004 appearClass: String,
9005 appearActiveClass: String,
9006 appearToClass: String,
9007 duration: [Number, String, Object]
9008 };
9009 // in case the child is also an abstract component, e.g. <keep-alive>
9010 // we want to recursively retrieve the real component to be rendered
9011 function getRealChild(vnode) {
9012 var compOptions = vnode && vnode.componentOptions;
9013 if (compOptions && compOptions.Ctor.options.abstract) {
9014 return getRealChild(getFirstComponentChild(compOptions.children));
9015 }
9016 else {
9017 return vnode;
9018 }
9019 }
9020 function extractTransitionData(comp) {
9021 var data = {};
9022 var options = comp.$options;
9023 // props
9024 for (var key in options.propsData) {
9025 data[key] = comp[key];
9026 }
9027 // events.
9028 // extract listeners and pass them directly to the transition methods
9029 var listeners = options._parentListeners;
9030 for (var key in listeners) {
9031 data[camelize(key)] = listeners[key];
9032 }
9033 return data;
9034 }
9035 function placeholder(h, rawChild) {
9036 // @ts-expect-error
9037 if (/\d-keep-alive$/.test(rawChild.tag)) {
9038 return h('keep-alive', {
9039 props: rawChild.componentOptions.propsData
9040 });
9041 }
9042 }
9043 function hasParentTransition(vnode) {
9044 while ((vnode = vnode.parent)) {
9045 if (vnode.data.transition) {
9046 return true;
9047 }
9048 }
9049 }
9050 function isSameChild(child, oldChild) {
9051 return oldChild.key === child.key && oldChild.tag === child.tag;
9052 }
9053 var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
9054 var isVShowDirective = function (d) { return d.name === 'show'; };
9055 var Transition = {
9056 name: 'transition',
9057 props: transitionProps,
9058 abstract: true,
9059 render: function (h) {
9060 var _this = this;
9061 var children = this.$slots.default;
9062 if (!children) {
9063 return;
9064 }
9065 // filter out text nodes (possible whitespaces)
9066 children = children.filter(isNotTextNode);
9067 /* istanbul ignore if */
9068 if (!children.length) {
9069 return;
9070 }
9071 // warn multiple elements
9072 if (children.length > 1) {
9073 warn$2('<transition> can only be used on a single element. Use ' +
9074 '<transition-group> for lists.', this.$parent);
9075 }
9076 var mode = this.mode;
9077 // warn invalid mode
9078 if (mode && mode !== 'in-out' && mode !== 'out-in') {
9079 warn$2('invalid <transition> mode: ' + mode, this.$parent);
9080 }
9081 var rawChild = children[0];
9082 // if this is a component root node and the component's
9083 // parent container node also has transition, skip.
9084 if (hasParentTransition(this.$vnode)) {
9085 return rawChild;
9086 }
9087 // apply transition data to child
9088 // use getRealChild() to ignore abstract components e.g. keep-alive
9089 var child = getRealChild(rawChild);
9090 /* istanbul ignore if */
9091 if (!child) {
9092 return rawChild;
9093 }
9094 if (this._leaving) {
9095 return placeholder(h, rawChild);
9096 }
9097 // ensure a key that is unique to the vnode type and to this transition
9098 // component instance. This key will be used to remove pending leaving nodes
9099 // during entering.
9100 var id = "__transition-".concat(this._uid, "-");
9101 child.key =
9102 child.key == null
9103 ? child.isComment
9104 ? id + 'comment'
9105 : id + child.tag
9106 : isPrimitive(child.key)
9107 ? String(child.key).indexOf(id) === 0
9108 ? child.key
9109 : id + child.key
9110 : child.key;
9111 var data = ((child.data || (child.data = {})).transition =
9112 extractTransitionData(this));
9113 var oldRawChild = this._vnode;
9114 var oldChild = getRealChild(oldRawChild);
9115 // mark v-show
9116 // so that the transition module can hand over the control to the directive
9117 if (child.data.directives && child.data.directives.some(isVShowDirective)) {
9118 child.data.show = true;
9119 }
9120 if (oldChild &&
9121 oldChild.data &&
9122 !isSameChild(child, oldChild) &&
9123 !isAsyncPlaceholder(oldChild) &&
9124 // #6687 component root is a comment node
9125 !(oldChild.componentInstance &&
9126 oldChild.componentInstance._vnode.isComment)) {
9127 // replace old child transition data with fresh one
9128 // important for dynamic transitions!
9129 var oldData = (oldChild.data.transition = extend({}, data));
9130 // handle transition mode
9131 if (mode === 'out-in') {
9132 // return placeholder node and queue update when leave finishes
9133 this._leaving = true;
9134 mergeVNodeHook(oldData, 'afterLeave', function () {
9135 _this._leaving = false;
9136 _this.$forceUpdate();
9137 });
9138 return placeholder(h, rawChild);
9139 }
9140 else if (mode === 'in-out') {
9141 if (isAsyncPlaceholder(child)) {
9142 return oldRawChild;
9143 }
9144 var delayedLeave_1;
9145 var performLeave = function () {
9146 delayedLeave_1();
9147 };
9148 mergeVNodeHook(data, 'afterEnter', performLeave);
9149 mergeVNodeHook(data, 'enterCancelled', performLeave);
9150 mergeVNodeHook(oldData, 'delayLeave', function (leave) {
9151 delayedLeave_1 = leave;
9152 });
9153 }
9154 }
9155 return rawChild;
9156 }
9157 };
9158
9159 // Provides transition support for list items.
9160 var props = extend({
9161 tag: String,
9162 moveClass: String
9163 }, transitionProps);
9164 delete props.mode;
9165 var TransitionGroup = {
9166 props: props,
9167 beforeMount: function () {
9168 var _this = this;
9169 var update = this._update;
9170 this._update = function (vnode, hydrating) {
9171 var restoreActiveInstance = setActiveInstance(_this);
9172 // force removing pass
9173 _this.__patch__(_this._vnode, _this.kept, false, // hydrating
9174 true // removeOnly (!important, avoids unnecessary moves)
9175 );
9176 _this._vnode = _this.kept;
9177 restoreActiveInstance();
9178 update.call(_this, vnode, hydrating);
9179 };
9180 },
9181 render: function (h) {
9182 var tag = this.tag || this.$vnode.data.tag || 'span';
9183 var map = Object.create(null);
9184 var prevChildren = (this.prevChildren = this.children);
9185 var rawChildren = this.$slots.default || [];
9186 var children = (this.children = []);
9187 var transitionData = extractTransitionData(this);
9188 for (var i = 0; i < rawChildren.length; i++) {
9189 var c = rawChildren[i];
9190 if (c.tag) {
9191 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
9192 children.push(c);
9193 map[c.key] = c;
9194 (c.data || (c.data = {})).transition = transitionData;
9195 }
9196 else {
9197 var opts = c.componentOptions;
9198 var name_1 = opts
9199 ? getComponentName(opts.Ctor.options) || opts.tag || ''
9200 : c.tag;
9201 warn$2("<transition-group> children must be keyed: <".concat(name_1, ">"));
9202 }
9203 }
9204 }
9205 if (prevChildren) {
9206 var kept = [];
9207 var removed = [];
9208 for (var i = 0; i < prevChildren.length; i++) {
9209 var c = prevChildren[i];
9210 c.data.transition = transitionData;
9211 // @ts-expect-error .getBoundingClientRect is not typed in Node
9212 c.data.pos = c.elm.getBoundingClientRect();
9213 if (map[c.key]) {
9214 kept.push(c);
9215 }
9216 else {
9217 removed.push(c);
9218 }
9219 }
9220 this.kept = h(tag, null, kept);
9221 this.removed = removed;
9222 }
9223 return h(tag, null, children);
9224 },
9225 updated: function () {
9226 var children = this.prevChildren;
9227 var moveClass = this.moveClass || (this.name || 'v') + '-move';
9228 if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
9229 return;
9230 }
9231 // we divide the work into three loops to avoid mixing DOM reads and writes
9232 // in each iteration - which helps prevent layout thrashing.
9233 children.forEach(callPendingCbs);
9234 children.forEach(recordPosition);
9235 children.forEach(applyTranslation);
9236 // force reflow to put everything in position
9237 // assign to this to avoid being removed in tree-shaking
9238 // $flow-disable-line
9239 this._reflow = document.body.offsetHeight;
9240 children.forEach(function (c) {
9241 if (c.data.moved) {
9242 var el_1 = c.elm;
9243 var s = el_1.style;
9244 addTransitionClass(el_1, moveClass);
9245 s.transform = s.WebkitTransform = s.transitionDuration = '';
9246 el_1.addEventListener(transitionEndEvent, (el_1._moveCb = function cb(e) {
9247 if (e && e.target !== el_1) {
9248 return;
9249 }
9250 if (!e || /transform$/.test(e.propertyName)) {
9251 el_1.removeEventListener(transitionEndEvent, cb);
9252 el_1._moveCb = null;
9253 removeTransitionClass(el_1, moveClass);
9254 }
9255 }));
9256 }
9257 });
9258 },
9259 methods: {
9260 hasMove: function (el, moveClass) {
9261 /* istanbul ignore if */
9262 if (!hasTransition) {
9263 return false;
9264 }
9265 /* istanbul ignore if */
9266 if (this._hasMove) {
9267 return this._hasMove;
9268 }
9269 // Detect whether an element with the move class applied has
9270 // CSS transitions. Since the element may be inside an entering
9271 // transition at this very moment, we make a clone of it and remove
9272 // all other transition classes applied to ensure only the move class
9273 // is applied.
9274 var clone = el.cloneNode();
9275 if (el._transitionClasses) {
9276 el._transitionClasses.forEach(function (cls) {
9277 removeClass(clone, cls);
9278 });
9279 }
9280 addClass(clone, moveClass);
9281 clone.style.display = 'none';
9282 this.$el.appendChild(clone);
9283 var info = getTransitionInfo(clone);
9284 this.$el.removeChild(clone);
9285 return (this._hasMove = info.hasTransform);
9286 }
9287 }
9288 };
9289 function callPendingCbs(c) {
9290 /* istanbul ignore if */
9291 if (c.elm._moveCb) {
9292 c.elm._moveCb();
9293 }
9294 /* istanbul ignore if */
9295 if (c.elm._enterCb) {
9296 c.elm._enterCb();
9297 }
9298 }
9299 function recordPosition(c) {
9300 c.data.newPos = c.elm.getBoundingClientRect();
9301 }
9302 function applyTranslation(c) {
9303 var oldPos = c.data.pos;
9304 var newPos = c.data.newPos;
9305 var dx = oldPos.left - newPos.left;
9306 var dy = oldPos.top - newPos.top;
9307 if (dx || dy) {
9308 c.data.moved = true;
9309 var s = c.elm.style;
9310 s.transform = s.WebkitTransform = "translate(".concat(dx, "px,").concat(dy, "px)");
9311 s.transitionDuration = '0s';
9312 }
9313 }
9314
9315 var platformComponents = {
9316 Transition: Transition,
9317 TransitionGroup: TransitionGroup
9318 };
9319
9320 // install platform specific utils
9321 Vue.config.mustUseProp = mustUseProp;
9322 Vue.config.isReservedTag = isReservedTag;
9323 Vue.config.isReservedAttr = isReservedAttr;
9324 Vue.config.getTagNamespace = getTagNamespace;
9325 Vue.config.isUnknownElement = isUnknownElement;
9326 // install platform runtime directives & components
9327 extend(Vue.options.directives, platformDirectives);
9328 extend(Vue.options.components, platformComponents);
9329 // install platform patch function
9330 Vue.prototype.__patch__ = inBrowser ? patch : noop;
9331 // public mount method
9332 Vue.prototype.$mount = function (el, hydrating) {
9333 el = el && inBrowser ? query(el) : undefined;
9334 return mountComponent(this, el, hydrating);
9335 };
9336 // devtools global hook
9337 /* istanbul ignore next */
9338 if (inBrowser) {
9339 setTimeout(function () {
9340 if (config.devtools) {
9341 if (devtools) {
9342 devtools.emit('init', Vue);
9343 }
9344 else {
9345 // @ts-expect-error
9346 console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' +
9347 'https://github.com/vuejs/vue-devtools');
9348 }
9349 }
9350 if (config.productionTip !== false &&
9351 typeof console !== 'undefined') {
9352 // @ts-expect-error
9353 console[console.info ? 'info' : 'log']("You are running Vue in development mode.\n" +
9354 "Make sure to turn on production mode when deploying for production.\n" +
9355 "See more tips at https://vuejs.org/guide/deployment.html");
9356 }
9357 }, 0);
9358 }
9359
9360 var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
9361 var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
9362 var buildRegex = cached(function (delimiters) {
9363 var open = delimiters[0].replace(regexEscapeRE, '\\$&');
9364 var close = delimiters[1].replace(regexEscapeRE, '\\$&');
9365 return new RegExp(open + '((?:.|\\n)+?)' + close, 'g');
9366 });
9367 function parseText(text, delimiters) {
9368 //@ts-expect-error
9369 var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
9370 if (!tagRE.test(text)) {
9371 return;
9372 }
9373 var tokens = [];
9374 var rawTokens = [];
9375 var lastIndex = (tagRE.lastIndex = 0);
9376 var match, index, tokenValue;
9377 while ((match = tagRE.exec(text))) {
9378 index = match.index;
9379 // push text token
9380 if (index > lastIndex) {
9381 rawTokens.push((tokenValue = text.slice(lastIndex, index)));
9382 tokens.push(JSON.stringify(tokenValue));
9383 }
9384 // tag token
9385 var exp = parseFilters(match[1].trim());
9386 tokens.push("_s(".concat(exp, ")"));
9387 rawTokens.push({ '@binding': exp });
9388 lastIndex = index + match[0].length;
9389 }
9390 if (lastIndex < text.length) {
9391 rawTokens.push((tokenValue = text.slice(lastIndex)));
9392 tokens.push(JSON.stringify(tokenValue));
9393 }
9394 return {
9395 expression: tokens.join('+'),
9396 tokens: rawTokens
9397 };
9398 }
9399
9400 function transformNode$1(el, options) {
9401 var warn = options.warn || baseWarn;
9402 var staticClass = getAndRemoveAttr(el, 'class');
9403 if (staticClass) {
9404 var res = parseText(staticClass, options.delimiters);
9405 if (res) {
9406 warn("class=\"".concat(staticClass, "\": ") +
9407 'Interpolation inside attributes has been removed. ' +
9408 'Use v-bind or the colon shorthand instead. For example, ' +
9409 'instead of <div class="{{ val }}">, use <div :class="val">.', el.rawAttrsMap['class']);
9410 }
9411 }
9412 if (staticClass) {
9413 el.staticClass = JSON.stringify(staticClass.replace(/\s+/g, ' ').trim());
9414 }
9415 var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
9416 if (classBinding) {
9417 el.classBinding = classBinding;
9418 }
9419 }
9420 function genData$2(el) {
9421 var data = '';
9422 if (el.staticClass) {
9423 data += "staticClass:".concat(el.staticClass, ",");
9424 }
9425 if (el.classBinding) {
9426 data += "class:".concat(el.classBinding, ",");
9427 }
9428 return data;
9429 }
9430 var klass = {
9431 staticKeys: ['staticClass'],
9432 transformNode: transformNode$1,
9433 genData: genData$2
9434 };
9435
9436 function transformNode(el, options) {
9437 var warn = options.warn || baseWarn;
9438 var staticStyle = getAndRemoveAttr(el, 'style');
9439 if (staticStyle) {
9440 /* istanbul ignore if */
9441 {
9442 var res = parseText(staticStyle, options.delimiters);
9443 if (res) {
9444 warn("style=\"".concat(staticStyle, "\": ") +
9445 'Interpolation inside attributes has been removed. ' +
9446 'Use v-bind or the colon shorthand instead. For example, ' +
9447 'instead of <div style="{{ val }}">, use <div :style="val">.', el.rawAttrsMap['style']);
9448 }
9449 }
9450 el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
9451 }
9452 var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
9453 if (styleBinding) {
9454 el.styleBinding = styleBinding;
9455 }
9456 }
9457 function genData$1(el) {
9458 var data = '';
9459 if (el.staticStyle) {
9460 data += "staticStyle:".concat(el.staticStyle, ",");
9461 }
9462 if (el.styleBinding) {
9463 data += "style:(".concat(el.styleBinding, "),");
9464 }
9465 return data;
9466 }
9467 var style = {
9468 staticKeys: ['staticStyle'],
9469 transformNode: transformNode,
9470 genData: genData$1
9471 };
9472
9473 var decoder;
9474 var he = {
9475 decode: function (html) {
9476 decoder = decoder || document.createElement('div');
9477 decoder.innerHTML = html;
9478 return decoder.textContent;
9479 }
9480 };
9481
9482 var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
9483 'link,meta,param,source,track,wbr');
9484 // Elements that you can, intentionally, leave open
9485 // (and which close themselves)
9486 var canBeLeftOpenTag = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source');
9487 // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
9488 // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
9489 var isNonPhrasingTag = makeMap('address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
9490 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
9491 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
9492 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
9493 'title,tr,track');
9494
9495 /**
9496 * Not type-checking this file because it's mostly vendor code.
9497 */
9498 // Regular Expressions for parsing tags and attributes
9499 var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9500 var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9501 var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z".concat(unicodeRegExp.source, "]*");
9502 var qnameCapture = "((?:".concat(ncname, "\\:)?").concat(ncname, ")");
9503 var startTagOpen = new RegExp("^<".concat(qnameCapture));
9504 var startTagClose = /^\s*(\/?)>/;
9505 var endTag = new RegExp("^<\\/".concat(qnameCapture, "[^>]*>"));
9506 var doctype = /^<!DOCTYPE [^>]+>/i;
9507 // #7298: escape - to avoid being passed as HTML comment when inlined in page
9508 var comment = /^<!\--/;
9509 var conditionalComment = /^<!\[/;
9510 // Special Elements (can contain anything)
9511 var isPlainTextElement = makeMap('script,style,textarea', true);
9512 var reCache = {};
9513 var decodingMap = {
9514 '&lt;': '<',
9515 '&gt;': '>',
9516 '&quot;': '"',
9517 '&amp;': '&',
9518 '&#10;': '\n',
9519 '&#9;': '\t',
9520 '&#39;': "'"
9521 };
9522 var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
9523 var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
9524 // #5992
9525 var isIgnoreNewlineTag = makeMap('pre,textarea', true);
9526 var shouldIgnoreFirstNewline = function (tag, html) {
9527 return tag && isIgnoreNewlineTag(tag) && html[0] === '\n';
9528 };
9529 function decodeAttr(value, shouldDecodeNewlines) {
9530 var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
9531 return value.replace(re, function (match) { return decodingMap[match]; });
9532 }
9533 function parseHTML(html, options) {
9534 var stack = [];
9535 var expectHTML = options.expectHTML;
9536 var isUnaryTag = options.isUnaryTag || no;
9537 var canBeLeftOpenTag = options.canBeLeftOpenTag || no;
9538 var index = 0;
9539 var last, lastTag;
9540 var _loop_1 = function () {
9541 last = html;
9542 // Make sure we're not in a plaintext content element like script/style
9543 if (!lastTag || !isPlainTextElement(lastTag)) {
9544 var textEnd = html.indexOf('<');
9545 if (textEnd === 0) {
9546 // Comment:
9547 if (comment.test(html)) {
9548 var commentEnd = html.indexOf('-->');
9549 if (commentEnd >= 0) {
9550 if (options.shouldKeepComment && options.comment) {
9551 options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
9552 }
9553 advance(commentEnd + 3);
9554 return "continue";
9555 }
9556 }
9557 // https://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
9558 if (conditionalComment.test(html)) {
9559 var conditionalEnd = html.indexOf(']>');
9560 if (conditionalEnd >= 0) {
9561 advance(conditionalEnd + 2);
9562 return "continue";
9563 }
9564 }
9565 // Doctype:
9566 var doctypeMatch = html.match(doctype);
9567 if (doctypeMatch) {
9568 advance(doctypeMatch[0].length);
9569 return "continue";
9570 }
9571 // End tag:
9572 var endTagMatch = html.match(endTag);
9573 if (endTagMatch) {
9574 var curIndex = index;
9575 advance(endTagMatch[0].length);
9576 parseEndTag(endTagMatch[1], curIndex, index);
9577 return "continue";
9578 }
9579 // Start tag:
9580 var startTagMatch = parseStartTag();
9581 if (startTagMatch) {
9582 handleStartTag(startTagMatch);
9583 if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
9584 advance(1);
9585 }
9586 return "continue";
9587 }
9588 }
9589 var text = void 0, rest = void 0, next = void 0;
9590 if (textEnd >= 0) {
9591 rest = html.slice(textEnd);
9592 while (!endTag.test(rest) &&
9593 !startTagOpen.test(rest) &&
9594 !comment.test(rest) &&
9595 !conditionalComment.test(rest)) {
9596 // < in plain text, be forgiving and treat it as text
9597 next = rest.indexOf('<', 1);
9598 if (next < 0)
9599 break;
9600 textEnd += next;
9601 rest = html.slice(textEnd);
9602 }
9603 text = html.substring(0, textEnd);
9604 }
9605 if (textEnd < 0) {
9606 text = html;
9607 }
9608 if (text) {
9609 advance(text.length);
9610 }
9611 if (options.chars && text) {
9612 options.chars(text, index - text.length, index);
9613 }
9614 }
9615 else {
9616 var endTagLength_1 = 0;
9617 var stackedTag_1 = lastTag.toLowerCase();
9618 var reStackedTag = reCache[stackedTag_1] ||
9619 (reCache[stackedTag_1] = new RegExp('([\\s\\S]*?)(</' + stackedTag_1 + '[^>]*>)', 'i'));
9620 var rest = html.replace(reStackedTag, function (all, text, endTag) {
9621 endTagLength_1 = endTag.length;
9622 if (!isPlainTextElement(stackedTag_1) && stackedTag_1 !== 'noscript') {
9623 text = text
9624 .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
9625 .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
9626 }
9627 if (shouldIgnoreFirstNewline(stackedTag_1, text)) {
9628 text = text.slice(1);
9629 }
9630 if (options.chars) {
9631 options.chars(text);
9632 }
9633 return '';
9634 });
9635 index += html.length - rest.length;
9636 html = rest;
9637 parseEndTag(stackedTag_1, index - endTagLength_1, index);
9638 }
9639 if (html === last) {
9640 options.chars && options.chars(html);
9641 if (!stack.length && options.warn) {
9642 options.warn("Mal-formatted tag at end of template: \"".concat(html, "\""), {
9643 start: index + html.length
9644 });
9645 }
9646 return "break";
9647 }
9648 };
9649 while (html) {
9650 var state_1 = _loop_1();
9651 if (state_1 === "break")
9652 break;
9653 }
9654 // Clean up any remaining tags
9655 parseEndTag();
9656 function advance(n) {
9657 index += n;
9658 html = html.substring(n);
9659 }
9660 function parseStartTag() {
9661 var start = html.match(startTagOpen);
9662 if (start) {
9663 var match = {
9664 tagName: start[1],
9665 attrs: [],
9666 start: index
9667 };
9668 advance(start[0].length);
9669 var end = void 0, attr = void 0;
9670 while (!(end = html.match(startTagClose)) &&
9671 (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
9672 attr.start = index;
9673 advance(attr[0].length);
9674 attr.end = index;
9675 match.attrs.push(attr);
9676 }
9677 if (end) {
9678 match.unarySlash = end[1];
9679 advance(end[0].length);
9680 match.end = index;
9681 return match;
9682 }
9683 }
9684 }
9685 function handleStartTag(match) {
9686 var tagName = match.tagName;
9687 var unarySlash = match.unarySlash;
9688 if (expectHTML) {
9689 if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
9690 parseEndTag(lastTag);
9691 }
9692 if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
9693 parseEndTag(tagName);
9694 }
9695 }
9696 var unary = isUnaryTag(tagName) || !!unarySlash;
9697 var l = match.attrs.length;
9698 var attrs = new Array(l);
9699 for (var i = 0; i < l; i++) {
9700 var args = match.attrs[i];
9701 var value = args[3] || args[4] || args[5] || '';
9702 var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
9703 ? options.shouldDecodeNewlinesForHref
9704 : options.shouldDecodeNewlines;
9705 attrs[i] = {
9706 name: args[1],
9707 value: decodeAttr(value, shouldDecodeNewlines)
9708 };
9709 if (options.outputSourceRange) {
9710 attrs[i].start = args.start + args[0].match(/^\s*/).length;
9711 attrs[i].end = args.end;
9712 }
9713 }
9714 if (!unary) {
9715 stack.push({
9716 tag: tagName,
9717 lowerCasedTag: tagName.toLowerCase(),
9718 attrs: attrs,
9719 start: match.start,
9720 end: match.end
9721 });
9722 lastTag = tagName;
9723 }
9724 if (options.start) {
9725 options.start(tagName, attrs, unary, match.start, match.end);
9726 }
9727 }
9728 function parseEndTag(tagName, start, end) {
9729 var pos, lowerCasedTagName;
9730 if (start == null)
9731 start = index;
9732 if (end == null)
9733 end = index;
9734 // Find the closest opened tag of the same type
9735 if (tagName) {
9736 lowerCasedTagName = tagName.toLowerCase();
9737 for (pos = stack.length - 1; pos >= 0; pos--) {
9738 if (stack[pos].lowerCasedTag === lowerCasedTagName) {
9739 break;
9740 }
9741 }
9742 }
9743 else {
9744 // If no tag name is provided, clean shop
9745 pos = 0;
9746 }
9747 if (pos >= 0) {
9748 // Close all the open elements, up the stack
9749 for (var i = stack.length - 1; i >= pos; i--) {
9750 if ((i > pos || !tagName) && options.warn) {
9751 options.warn("tag <".concat(stack[i].tag, "> has no matching end tag."), {
9752 start: stack[i].start,
9753 end: stack[i].end
9754 });
9755 }
9756 if (options.end) {
9757 options.end(stack[i].tag, start, end);
9758 }
9759 }
9760 // Remove the open elements from the stack
9761 stack.length = pos;
9762 lastTag = pos && stack[pos - 1].tag;
9763 }
9764 else if (lowerCasedTagName === 'br') {
9765 if (options.start) {
9766 options.start(tagName, [], true, start, end);
9767 }
9768 }
9769 else if (lowerCasedTagName === 'p') {
9770 if (options.start) {
9771 options.start(tagName, [], false, start, end);
9772 }
9773 if (options.end) {
9774 options.end(tagName, start, end);
9775 }
9776 }
9777 }
9778 }
9779
9780 var onRE = /^@|^v-on:/;
9781 var dirRE = /^v-|^@|^:|^#/;
9782 var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
9783 var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
9784 var stripParensRE = /^\(|\)$/g;
9785 var dynamicArgRE = /^\[.*\]$/;
9786 var argRE = /:(.*)$/;
9787 var bindRE = /^:|^\.|^v-bind:/;
9788 var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
9789 var slotRE = /^v-slot(:|$)|^#/;
9790 var lineBreakRE = /[\r\n]/;
9791 var whitespaceRE = /[ \f\t\r\n]+/g;
9792 var invalidAttributeRE = /[\s"'<>\/=]/;
9793 var decodeHTMLCached = cached(he.decode);
9794 var emptySlotScopeToken = "_empty_";
9795 // configurable state
9796 var warn;
9797 var delimiters;
9798 var transforms;
9799 var preTransforms;
9800 var postTransforms;
9801 var platformIsPreTag;
9802 var platformMustUseProp;
9803 var platformGetTagNamespace;
9804 var maybeComponent;
9805 function createASTElement(tag, attrs, parent) {
9806 return {
9807 type: 1,
9808 tag: tag,
9809 attrsList: attrs,
9810 attrsMap: makeAttrsMap(attrs),
9811 rawAttrsMap: {},
9812 parent: parent,
9813 children: []
9814 };
9815 }
9816 /**
9817 * Convert HTML string to AST.
9818 */
9819 function parse(template, options) {
9820 warn = options.warn || baseWarn;
9821 platformIsPreTag = options.isPreTag || no;
9822 platformMustUseProp = options.mustUseProp || no;
9823 platformGetTagNamespace = options.getTagNamespace || no;
9824 var isReservedTag = options.isReservedTag || no;
9825 maybeComponent = function (el) {
9826 return !!(el.component ||
9827 el.attrsMap[':is'] ||
9828 el.attrsMap['v-bind:is'] ||
9829 !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)));
9830 };
9831 transforms = pluckModuleFunction(options.modules, 'transformNode');
9832 preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
9833 postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
9834 delimiters = options.delimiters;
9835 var stack = [];
9836 var preserveWhitespace = options.preserveWhitespace !== false;
9837 var whitespaceOption = options.whitespace;
9838 var root;
9839 var currentParent;
9840 var inVPre = false;
9841 var inPre = false;
9842 var warned = false;
9843 function warnOnce(msg, range) {
9844 if (!warned) {
9845 warned = true;
9846 warn(msg, range);
9847 }
9848 }
9849 function closeElement(element) {
9850 trimEndingWhitespace(element);
9851 if (!inVPre && !element.processed) {
9852 element = processElement(element, options);
9853 }
9854 // tree management
9855 if (!stack.length && element !== root) {
9856 // allow root elements with v-if, v-else-if and v-else
9857 if (root.if && (element.elseif || element.else)) {
9858 {
9859 checkRootConstraints(element);
9860 }
9861 addIfCondition(root, {
9862 exp: element.elseif,
9863 block: element
9864 });
9865 }
9866 else {
9867 warnOnce("Component template should contain exactly one root element. " +
9868 "If you are using v-if on multiple elements, " +
9869 "use v-else-if to chain them instead.", { start: element.start });
9870 }
9871 }
9872 if (currentParent && !element.forbidden) {
9873 if (element.elseif || element.else) {
9874 processIfConditions(element, currentParent);
9875 }
9876 else {
9877 if (element.slotScope) {
9878 // scoped slot
9879 // keep it in the children list so that v-else(-if) conditions can
9880 // find it as the prev node.
9881 var name_1 = element.slotTarget || '"default"';
9882 (currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name_1] = element;
9883 }
9884 currentParent.children.push(element);
9885 element.parent = currentParent;
9886 }
9887 }
9888 // final children cleanup
9889 // filter out scoped slots
9890 element.children = element.children.filter(function (c) { return !c.slotScope; });
9891 // remove trailing whitespace node again
9892 trimEndingWhitespace(element);
9893 // check pre state
9894 if (element.pre) {
9895 inVPre = false;
9896 }
9897 if (platformIsPreTag(element.tag)) {
9898 inPre = false;
9899 }
9900 // apply post-transforms
9901 for (var i = 0; i < postTransforms.length; i++) {
9902 postTransforms[i](element, options);
9903 }
9904 }
9905 function trimEndingWhitespace(el) {
9906 // remove trailing whitespace node
9907 if (!inPre) {
9908 var lastNode = void 0;
9909 while ((lastNode = el.children[el.children.length - 1]) &&
9910 lastNode.type === 3 &&
9911 lastNode.text === ' ') {
9912 el.children.pop();
9913 }
9914 }
9915 }
9916 function checkRootConstraints(el) {
9917 if (el.tag === 'slot' || el.tag === 'template') {
9918 warnOnce("Cannot use <".concat(el.tag, "> as component root element because it may ") +
9919 'contain multiple nodes.', { start: el.start });
9920 }
9921 if (el.attrsMap.hasOwnProperty('v-for')) {
9922 warnOnce('Cannot use v-for on stateful component root element because ' +
9923 'it renders multiple elements.', el.rawAttrsMap['v-for']);
9924 }
9925 }
9926 parseHTML(template, {
9927 warn: warn,
9928 expectHTML: options.expectHTML,
9929 isUnaryTag: options.isUnaryTag,
9930 canBeLeftOpenTag: options.canBeLeftOpenTag,
9931 shouldDecodeNewlines: options.shouldDecodeNewlines,
9932 shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
9933 shouldKeepComment: options.comments,
9934 outputSourceRange: options.outputSourceRange,
9935 start: function (tag, attrs, unary, start, end) {
9936 // check namespace.
9937 // inherit parent ns if there is one
9938 var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
9939 // handle IE svg bug
9940 /* istanbul ignore if */
9941 if (isIE && ns === 'svg') {
9942 attrs = guardIESVGBug(attrs);
9943 }
9944 var element = createASTElement(tag, attrs, currentParent);
9945 if (ns) {
9946 element.ns = ns;
9947 }
9948 {
9949 if (options.outputSourceRange) {
9950 element.start = start;
9951 element.end = end;
9952 element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
9953 cumulated[attr.name] = attr;
9954 return cumulated;
9955 }, {});
9956 }
9957 attrs.forEach(function (attr) {
9958 if (invalidAttributeRE.test(attr.name)) {
9959 warn("Invalid dynamic argument expression: attribute names cannot contain " +
9960 "spaces, quotes, <, >, / or =.", options.outputSourceRange
9961 ? {
9962 start: attr.start + attr.name.indexOf("["),
9963 end: attr.start + attr.name.length
9964 }
9965 : undefined);
9966 }
9967 });
9968 }
9969 if (isForbiddenTag(element) && !isServerRendering()) {
9970 element.forbidden = true;
9971 warn('Templates should only be responsible for mapping the state to the ' +
9972 'UI. Avoid placing tags with side-effects in your templates, such as ' +
9973 "<".concat(tag, ">") +
9974 ', as they will not be parsed.', { start: element.start });
9975 }
9976 // apply pre-transforms
9977 for (var i = 0; i < preTransforms.length; i++) {
9978 element = preTransforms[i](element, options) || element;
9979 }
9980 if (!inVPre) {
9981 processPre(element);
9982 if (element.pre) {
9983 inVPre = true;
9984 }
9985 }
9986 if (platformIsPreTag(element.tag)) {
9987 inPre = true;
9988 }
9989 if (inVPre) {
9990 processRawAttrs(element);
9991 }
9992 else if (!element.processed) {
9993 // structural directives
9994 processFor(element);
9995 processIf(element);
9996 processOnce(element);
9997 }
9998 if (!root) {
9999 root = element;
10000 {
10001 checkRootConstraints(root);
10002 }
10003 }
10004 if (!unary) {
10005 currentParent = element;
10006 stack.push(element);
10007 }
10008 else {
10009 closeElement(element);
10010 }
10011 },
10012 end: function (tag, start, end) {
10013 var element = stack[stack.length - 1];
10014 // pop stack
10015 stack.length -= 1;
10016 currentParent = stack[stack.length - 1];
10017 if (options.outputSourceRange) {
10018 element.end = end;
10019 }
10020 closeElement(element);
10021 },
10022 chars: function (text, start, end) {
10023 if (!currentParent) {
10024 {
10025 if (text === template) {
10026 warnOnce('Component template requires a root element, rather than just text.', { start: start });
10027 }
10028 else if ((text = text.trim())) {
10029 warnOnce("text \"".concat(text, "\" outside root element will be ignored."), {
10030 start: start
10031 });
10032 }
10033 }
10034 return;
10035 }
10036 // IE textarea placeholder bug
10037 /* istanbul ignore if */
10038 if (isIE &&
10039 currentParent.tag === 'textarea' &&
10040 currentParent.attrsMap.placeholder === text) {
10041 return;
10042 }
10043 var children = currentParent.children;
10044 if (inPre || text.trim()) {
10045 text = isTextTag(currentParent)
10046 ? text
10047 : decodeHTMLCached(text);
10048 }
10049 else if (!children.length) {
10050 // remove the whitespace-only node right after an opening tag
10051 text = '';
10052 }
10053 else if (whitespaceOption) {
10054 if (whitespaceOption === 'condense') {
10055 // in condense mode, remove the whitespace node if it contains
10056 // line break, otherwise condense to a single space
10057 text = lineBreakRE.test(text) ? '' : ' ';
10058 }
10059 else {
10060 text = ' ';
10061 }
10062 }
10063 else {
10064 text = preserveWhitespace ? ' ' : '';
10065 }
10066 if (text) {
10067 if (!inPre && whitespaceOption === 'condense') {
10068 // condense consecutive whitespaces into single space
10069 text = text.replace(whitespaceRE, ' ');
10070 }
10071 var res = void 0;
10072 var child = void 0;
10073 if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
10074 child = {
10075 type: 2,
10076 expression: res.expression,
10077 tokens: res.tokens,
10078 text: text
10079 };
10080 }
10081 else if (text !== ' ' ||
10082 !children.length ||
10083 children[children.length - 1].text !== ' ') {
10084 child = {
10085 type: 3,
10086 text: text
10087 };
10088 }
10089 if (child) {
10090 if (options.outputSourceRange) {
10091 child.start = start;
10092 child.end = end;
10093 }
10094 children.push(child);
10095 }
10096 }
10097 },
10098 comment: function (text, start, end) {
10099 // adding anything as a sibling to the root node is forbidden
10100 // comments should still be allowed, but ignored
10101 if (currentParent) {
10102 var child = {
10103 type: 3,
10104 text: text,
10105 isComment: true
10106 };
10107 if (options.outputSourceRange) {
10108 child.start = start;
10109 child.end = end;
10110 }
10111 currentParent.children.push(child);
10112 }
10113 }
10114 });
10115 return root;
10116 }
10117 function processPre(el) {
10118 if (getAndRemoveAttr(el, 'v-pre') != null) {
10119 el.pre = true;
10120 }
10121 }
10122 function processRawAttrs(el) {
10123 var list = el.attrsList;
10124 var len = list.length;
10125 if (len) {
10126 var attrs = (el.attrs = new Array(len));
10127 for (var i = 0; i < len; i++) {
10128 attrs[i] = {
10129 name: list[i].name,
10130 value: JSON.stringify(list[i].value)
10131 };
10132 if (list[i].start != null) {
10133 attrs[i].start = list[i].start;
10134 attrs[i].end = list[i].end;
10135 }
10136 }
10137 }
10138 else if (!el.pre) {
10139 // non root node in pre blocks with no attributes
10140 el.plain = true;
10141 }
10142 }
10143 function processElement(element, options) {
10144 processKey(element);
10145 // determine whether this is a plain element after
10146 // removing structural attributes
10147 element.plain =
10148 !element.key && !element.scopedSlots && !element.attrsList.length;
10149 processRef(element);
10150 processSlotContent(element);
10151 processSlotOutlet(element);
10152 processComponent(element);
10153 for (var i = 0; i < transforms.length; i++) {
10154 element = transforms[i](element, options) || element;
10155 }
10156 processAttrs(element);
10157 return element;
10158 }
10159 function processKey(el) {
10160 var exp = getBindingAttr(el, 'key');
10161 if (exp) {
10162 {
10163 if (el.tag === 'template') {
10164 warn("<template> cannot be keyed. Place the key on real elements instead.", getRawBindingAttr(el, 'key'));
10165 }
10166 if (el.for) {
10167 var iterator = el.iterator2 || el.iterator1;
10168 var parent_1 = el.parent;
10169 if (iterator &&
10170 iterator === exp &&
10171 parent_1 &&
10172 parent_1.tag === 'transition-group') {
10173 warn("Do not use v-for index as key on <transition-group> children, " +
10174 "this is the same as not using keys.", getRawBindingAttr(el, 'key'), true /* tip */);
10175 }
10176 }
10177 }
10178 el.key = exp;
10179 }
10180 }
10181 function processRef(el) {
10182 var ref = getBindingAttr(el, 'ref');
10183 if (ref) {
10184 el.ref = ref;
10185 el.refInFor = checkInFor(el);
10186 }
10187 }
10188 function processFor(el) {
10189 var exp;
10190 if ((exp = getAndRemoveAttr(el, 'v-for'))) {
10191 var res = parseFor(exp);
10192 if (res) {
10193 extend(el, res);
10194 }
10195 else {
10196 warn("Invalid v-for expression: ".concat(exp), el.rawAttrsMap['v-for']);
10197 }
10198 }
10199 }
10200 function parseFor(exp) {
10201 var inMatch = exp.match(forAliasRE);
10202 if (!inMatch)
10203 return;
10204 var res = {};
10205 res.for = inMatch[2].trim();
10206 var alias = inMatch[1].trim().replace(stripParensRE, '');
10207 var iteratorMatch = alias.match(forIteratorRE);
10208 if (iteratorMatch) {
10209 res.alias = alias.replace(forIteratorRE, '').trim();
10210 res.iterator1 = iteratorMatch[1].trim();
10211 if (iteratorMatch[2]) {
10212 res.iterator2 = iteratorMatch[2].trim();
10213 }
10214 }
10215 else {
10216 res.alias = alias;
10217 }
10218 return res;
10219 }
10220 function processIf(el) {
10221 var exp = getAndRemoveAttr(el, 'v-if');
10222 if (exp) {
10223 el.if = exp;
10224 addIfCondition(el, {
10225 exp: exp,
10226 block: el
10227 });
10228 }
10229 else {
10230 if (getAndRemoveAttr(el, 'v-else') != null) {
10231 el.else = true;
10232 }
10233 var elseif = getAndRemoveAttr(el, 'v-else-if');
10234 if (elseif) {
10235 el.elseif = elseif;
10236 }
10237 }
10238 }
10239 function processIfConditions(el, parent) {
10240 var prev = findPrevElement(parent.children);
10241 if (prev && prev.if) {
10242 addIfCondition(prev, {
10243 exp: el.elseif,
10244 block: el
10245 });
10246 }
10247 else {
10248 warn("v-".concat(el.elseif ? 'else-if="' + el.elseif + '"' : 'else', " ") +
10249 "used on element <".concat(el.tag, "> without corresponding v-if."), el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']);
10250 }
10251 }
10252 function findPrevElement(children) {
10253 var i = children.length;
10254 while (i--) {
10255 if (children[i].type === 1) {
10256 return children[i];
10257 }
10258 else {
10259 if (children[i].text !== ' ') {
10260 warn("text \"".concat(children[i].text.trim(), "\" between v-if and v-else(-if) ") +
10261 "will be ignored.", children[i]);
10262 }
10263 children.pop();
10264 }
10265 }
10266 }
10267 function addIfCondition(el, condition) {
10268 if (!el.ifConditions) {
10269 el.ifConditions = [];
10270 }
10271 el.ifConditions.push(condition);
10272 }
10273 function processOnce(el) {
10274 var once = getAndRemoveAttr(el, 'v-once');
10275 if (once != null) {
10276 el.once = true;
10277 }
10278 }
10279 // handle content being passed to a component as slot,
10280 // e.g. <template slot="xxx">, <div slot-scope="xxx">
10281 function processSlotContent(el) {
10282 var slotScope;
10283 if (el.tag === 'template') {
10284 slotScope = getAndRemoveAttr(el, 'scope');
10285 /* istanbul ignore if */
10286 if (slotScope) {
10287 warn("the \"scope\" attribute for scoped slots have been deprecated and " +
10288 "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
10289 "can also be used on plain elements in addition to <template> to " +
10290 "denote scoped slots.", el.rawAttrsMap['scope'], true);
10291 }
10292 el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
10293 }
10294 else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
10295 /* istanbul ignore if */
10296 if (el.attrsMap['v-for']) {
10297 warn("Ambiguous combined usage of slot-scope and v-for on <".concat(el.tag, "> ") +
10298 "(v-for takes higher priority). Use a wrapper <template> for the " +
10299 "scoped slot to make it clearer.", el.rawAttrsMap['slot-scope'], true);
10300 }
10301 el.slotScope = slotScope;
10302 }
10303 // slot="xxx"
10304 var slotTarget = getBindingAttr(el, 'slot');
10305 if (slotTarget) {
10306 el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
10307 el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
10308 // preserve slot as an attribute for native shadow DOM compat
10309 // only for non-scoped slots.
10310 if (el.tag !== 'template' && !el.slotScope) {
10311 addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
10312 }
10313 }
10314 // 2.6 v-slot syntax
10315 {
10316 if (el.tag === 'template') {
10317 // v-slot on <template>
10318 var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
10319 if (slotBinding) {
10320 {
10321 if (el.slotTarget || el.slotScope) {
10322 warn("Unexpected mixed usage of different slot syntaxes.", el);
10323 }
10324 if (el.parent && !maybeComponent(el.parent)) {
10325 warn("<template v-slot> can only appear at the root level inside " +
10326 "the receiving component", el);
10327 }
10328 }
10329 var _a = getSlotName(slotBinding), name_2 = _a.name, dynamic = _a.dynamic;
10330 el.slotTarget = name_2;
10331 el.slotTargetDynamic = dynamic;
10332 el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
10333 }
10334 }
10335 else {
10336 // v-slot on component, denotes default slot
10337 var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
10338 if (slotBinding) {
10339 {
10340 if (!maybeComponent(el)) {
10341 warn("v-slot can only be used on components or <template>.", slotBinding);
10342 }
10343 if (el.slotScope || el.slotTarget) {
10344 warn("Unexpected mixed usage of different slot syntaxes.", el);
10345 }
10346 if (el.scopedSlots) {
10347 warn("To avoid scope ambiguity, the default slot should also use " +
10348 "<template> syntax when there are other named slots.", slotBinding);
10349 }
10350 }
10351 // add the component's children to its default slot
10352 var slots = el.scopedSlots || (el.scopedSlots = {});
10353 var _b = getSlotName(slotBinding), name_3 = _b.name, dynamic = _b.dynamic;
10354 var slotContainer_1 = (slots[name_3] = createASTElement('template', [], el));
10355 slotContainer_1.slotTarget = name_3;
10356 slotContainer_1.slotTargetDynamic = dynamic;
10357 slotContainer_1.children = el.children.filter(function (c) {
10358 if (!c.slotScope) {
10359 c.parent = slotContainer_1;
10360 return true;
10361 }
10362 });
10363 slotContainer_1.slotScope = slotBinding.value || emptySlotScopeToken;
10364 // remove children as they are returned from scopedSlots now
10365 el.children = [];
10366 // mark el non-plain so data gets generated
10367 el.plain = false;
10368 }
10369 }
10370 }
10371 }
10372 function getSlotName(binding) {
10373 var name = binding.name.replace(slotRE, '');
10374 if (!name) {
10375 if (binding.name[0] !== '#') {
10376 name = 'default';
10377 }
10378 else {
10379 warn("v-slot shorthand syntax requires a slot name.", binding);
10380 }
10381 }
10382 return dynamicArgRE.test(name)
10383 ? // dynamic [name]
10384 { name: name.slice(1, -1), dynamic: true }
10385 : // static name
10386 { name: "\"".concat(name, "\""), dynamic: false };
10387 }
10388 // handle <slot/> outlets
10389 function processSlotOutlet(el) {
10390 if (el.tag === 'slot') {
10391 el.slotName = getBindingAttr(el, 'name');
10392 if (el.key) {
10393 warn("`key` does not work on <slot> because slots are abstract outlets " +
10394 "and can possibly expand into multiple elements. " +
10395 "Use the key on a wrapping element instead.", getRawBindingAttr(el, 'key'));
10396 }
10397 }
10398 }
10399 function processComponent(el) {
10400 var binding;
10401 if ((binding = getBindingAttr(el, 'is'))) {
10402 el.component = binding;
10403 }
10404 if (getAndRemoveAttr(el, 'inline-template') != null) {
10405 el.inlineTemplate = true;
10406 }
10407 }
10408 function processAttrs(el) {
10409 var list = el.attrsList;
10410 var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
10411 for (i = 0, l = list.length; i < l; i++) {
10412 name = rawName = list[i].name;
10413 value = list[i].value;
10414 if (dirRE.test(name)) {
10415 // mark element as dynamic
10416 el.hasBindings = true;
10417 // modifiers
10418 modifiers = parseModifiers(name.replace(dirRE, ''));
10419 // support .foo shorthand syntax for the .prop modifier
10420 if (modifiers) {
10421 name = name.replace(modifierRE, '');
10422 }
10423 if (bindRE.test(name)) {
10424 // v-bind
10425 name = name.replace(bindRE, '');
10426 value = parseFilters(value);
10427 isDynamic = dynamicArgRE.test(name);
10428 if (isDynamic) {
10429 name = name.slice(1, -1);
10430 }
10431 if (value.trim().length === 0) {
10432 warn("The value for a v-bind expression cannot be empty. Found in \"v-bind:".concat(name, "\""));
10433 }
10434 if (modifiers) {
10435 if (modifiers.prop && !isDynamic) {
10436 name = camelize(name);
10437 if (name === 'innerHtml')
10438 name = 'innerHTML';
10439 }
10440 if (modifiers.camel && !isDynamic) {
10441 name = camelize(name);
10442 }
10443 if (modifiers.sync) {
10444 syncGen = genAssignmentCode(value, "$event");
10445 if (!isDynamic) {
10446 addHandler(el, "update:".concat(camelize(name)), syncGen, null, false, warn, list[i]);
10447 if (hyphenate(name) !== camelize(name)) {
10448 addHandler(el, "update:".concat(hyphenate(name)), syncGen, null, false, warn, list[i]);
10449 }
10450 }
10451 else {
10452 // handler w/ dynamic event name
10453 addHandler(el, "\"update:\"+(".concat(name, ")"), syncGen, null, false, warn, list[i], true // dynamic
10454 );
10455 }
10456 }
10457 }
10458 if ((modifiers && modifiers.prop) ||
10459 (!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name))) {
10460 addProp(el, name, value, list[i], isDynamic);
10461 }
10462 else {
10463 addAttr(el, name, value, list[i], isDynamic);
10464 }
10465 }
10466 else if (onRE.test(name)) {
10467 // v-on
10468 name = name.replace(onRE, '');
10469 isDynamic = dynamicArgRE.test(name);
10470 if (isDynamic) {
10471 name = name.slice(1, -1);
10472 }
10473 addHandler(el, name, value, modifiers, false, warn, list[i], isDynamic);
10474 }
10475 else {
10476 // normal directives
10477 name = name.replace(dirRE, '');
10478 // parse arg
10479 var argMatch = name.match(argRE);
10480 var arg = argMatch && argMatch[1];
10481 isDynamic = false;
10482 if (arg) {
10483 name = name.slice(0, -(arg.length + 1));
10484 if (dynamicArgRE.test(arg)) {
10485 arg = arg.slice(1, -1);
10486 isDynamic = true;
10487 }
10488 }
10489 addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
10490 if (name === 'model') {
10491 checkForAliasModel(el, value);
10492 }
10493 }
10494 }
10495 else {
10496 // literal attribute
10497 {
10498 var res = parseText(value, delimiters);
10499 if (res) {
10500 warn("".concat(name, "=\"").concat(value, "\": ") +
10501 'Interpolation inside attributes has been removed. ' +
10502 'Use v-bind or the colon shorthand instead. For example, ' +
10503 'instead of <div id="{{ val }}">, use <div :id="val">.', list[i]);
10504 }
10505 }
10506 addAttr(el, name, JSON.stringify(value), list[i]);
10507 // #6887 firefox doesn't update muted state if set via attribute
10508 // even immediately after element creation
10509 if (!el.component &&
10510 name === 'muted' &&
10511 platformMustUseProp(el.tag, el.attrsMap.type, name)) {
10512 addProp(el, name, 'true', list[i]);
10513 }
10514 }
10515 }
10516 }
10517 function checkInFor(el) {
10518 var parent = el;
10519 while (parent) {
10520 if (parent.for !== undefined) {
10521 return true;
10522 }
10523 parent = parent.parent;
10524 }
10525 return false;
10526 }
10527 function parseModifiers(name) {
10528 var match = name.match(modifierRE);
10529 if (match) {
10530 var ret_1 = {};
10531 match.forEach(function (m) {
10532 ret_1[m.slice(1)] = true;
10533 });
10534 return ret_1;
10535 }
10536 }
10537 function makeAttrsMap(attrs) {
10538 var map = {};
10539 for (var i = 0, l = attrs.length; i < l; i++) {
10540 if (map[attrs[i].name] && !isIE && !isEdge) {
10541 warn('duplicate attribute: ' + attrs[i].name, attrs[i]);
10542 }
10543 map[attrs[i].name] = attrs[i].value;
10544 }
10545 return map;
10546 }
10547 // for script (e.g. type="x/template") or style, do not decode content
10548 function isTextTag(el) {
10549 return el.tag === 'script' || el.tag === 'style';
10550 }
10551 function isForbiddenTag(el) {
10552 return (el.tag === 'style' ||
10553 (el.tag === 'script' &&
10554 (!el.attrsMap.type || el.attrsMap.type === 'text/javascript')));
10555 }
10556 var ieNSBug = /^xmlns:NS\d+/;
10557 var ieNSPrefix = /^NS\d+:/;
10558 /* istanbul ignore next */
10559 function guardIESVGBug(attrs) {
10560 var res = [];
10561 for (var i = 0; i < attrs.length; i++) {
10562 var attr = attrs[i];
10563 if (!ieNSBug.test(attr.name)) {
10564 attr.name = attr.name.replace(ieNSPrefix, '');
10565 res.push(attr);
10566 }
10567 }
10568 return res;
10569 }
10570 function checkForAliasModel(el, value) {
10571 var _el = el;
10572 while (_el) {
10573 if (_el.for && _el.alias === value) {
10574 warn("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
10575 "You are binding v-model directly to a v-for iteration alias. " +
10576 "This will not be able to modify the v-for source array because " +
10577 "writing to the alias is like modifying a function local variable. " +
10578 "Consider using an array of objects and use v-model on an object property instead.", el.rawAttrsMap['v-model']);
10579 }
10580 _el = _el.parent;
10581 }
10582 }
10583
10584 /**
10585 * Expand input[v-model] with dynamic type bindings into v-if-else chains
10586 * Turn this:
10587 * <input v-model="data[type]" :type="type">
10588 * into this:
10589 * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
10590 * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
10591 * <input v-else :type="type" v-model="data[type]">
10592 */
10593 function preTransformNode(el, options) {
10594 if (el.tag === 'input') {
10595 var map = el.attrsMap;
10596 if (!map['v-model']) {
10597 return;
10598 }
10599 var typeBinding = void 0;
10600 if (map[':type'] || map['v-bind:type']) {
10601 typeBinding = getBindingAttr(el, 'type');
10602 }
10603 if (!map.type && !typeBinding && map['v-bind']) {
10604 typeBinding = "(".concat(map['v-bind'], ").type");
10605 }
10606 if (typeBinding) {
10607 var ifCondition = getAndRemoveAttr(el, 'v-if', true);
10608 var ifConditionExtra = ifCondition ? "&&(".concat(ifCondition, ")") : "";
10609 var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
10610 var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
10611 // 1. checkbox
10612 var branch0 = cloneASTElement(el);
10613 // process for on the main node
10614 processFor(branch0);
10615 addRawAttr(branch0, 'type', 'checkbox');
10616 processElement(branch0, options);
10617 branch0.processed = true; // prevent it from double-processed
10618 branch0.if = "(".concat(typeBinding, ")==='checkbox'") + ifConditionExtra;
10619 addIfCondition(branch0, {
10620 exp: branch0.if,
10621 block: branch0
10622 });
10623 // 2. add radio else-if condition
10624 var branch1 = cloneASTElement(el);
10625 getAndRemoveAttr(branch1, 'v-for', true);
10626 addRawAttr(branch1, 'type', 'radio');
10627 processElement(branch1, options);
10628 addIfCondition(branch0, {
10629 exp: "(".concat(typeBinding, ")==='radio'") + ifConditionExtra,
10630 block: branch1
10631 });
10632 // 3. other
10633 var branch2 = cloneASTElement(el);
10634 getAndRemoveAttr(branch2, 'v-for', true);
10635 addRawAttr(branch2, ':type', typeBinding);
10636 processElement(branch2, options);
10637 addIfCondition(branch0, {
10638 exp: ifCondition,
10639 block: branch2
10640 });
10641 if (hasElse) {
10642 branch0.else = true;
10643 }
10644 else if (elseIfCondition) {
10645 branch0.elseif = elseIfCondition;
10646 }
10647 return branch0;
10648 }
10649 }
10650 }
10651 function cloneASTElement(el) {
10652 return createASTElement(el.tag, el.attrsList.slice(), el.parent);
10653 }
10654 var model = {
10655 preTransformNode: preTransformNode
10656 };
10657
10658 var modules = [klass, style, model];
10659
10660 function text(el, dir) {
10661 if (dir.value) {
10662 addProp(el, 'textContent', "_s(".concat(dir.value, ")"), dir);
10663 }
10664 }
10665
10666 function html(el, dir) {
10667 if (dir.value) {
10668 addProp(el, 'innerHTML', "_s(".concat(dir.value, ")"), dir);
10669 }
10670 }
10671
10672 var directives = {
10673 model: model$1,
10674 text: text,
10675 html: html
10676 };
10677
10678 var baseOptions = {
10679 expectHTML: true,
10680 modules: modules,
10681 directives: directives,
10682 isPreTag: isPreTag,
10683 isUnaryTag: isUnaryTag,
10684 mustUseProp: mustUseProp,
10685 canBeLeftOpenTag: canBeLeftOpenTag,
10686 isReservedTag: isReservedTag,
10687 getTagNamespace: getTagNamespace,
10688 staticKeys: genStaticKeys$1(modules)
10689 };
10690
10691 var isStaticKey;
10692 var isPlatformReservedTag;
10693 var genStaticKeysCached = cached(genStaticKeys);
10694 /**
10695 * Goal of the optimizer: walk the generated template AST tree
10696 * and detect sub-trees that are purely static, i.e. parts of
10697 * the DOM that never needs to change.
10698 *
10699 * Once we detect these sub-trees, we can:
10700 *
10701 * 1. Hoist them into constants, so that we no longer need to
10702 * create fresh nodes for them on each re-render;
10703 * 2. Completely skip them in the patching process.
10704 */
10705 function optimize(root, options) {
10706 if (!root)
10707 return;
10708 isStaticKey = genStaticKeysCached(options.staticKeys || '');
10709 isPlatformReservedTag = options.isReservedTag || no;
10710 // first pass: mark all non-static nodes.
10711 markStatic(root);
10712 // second pass: mark static roots.
10713 markStaticRoots(root, false);
10714 }
10715 function genStaticKeys(keys) {
10716 return makeMap('type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
10717 (keys ? ',' + keys : ''));
10718 }
10719 function markStatic(node) {
10720 node.static = isStatic(node);
10721 if (node.type === 1) {
10722 // do not make component slot content static. this avoids
10723 // 1. components not able to mutate slot nodes
10724 // 2. static slot content fails for hot-reloading
10725 if (!isPlatformReservedTag(node.tag) &&
10726 node.tag !== 'slot' &&
10727 node.attrsMap['inline-template'] == null) {
10728 return;
10729 }
10730 for (var i = 0, l = node.children.length; i < l; i++) {
10731 var child = node.children[i];
10732 markStatic(child);
10733 if (!child.static) {
10734 node.static = false;
10735 }
10736 }
10737 if (node.ifConditions) {
10738 for (var i = 1, l = node.ifConditions.length; i < l; i++) {
10739 var block = node.ifConditions[i].block;
10740 markStatic(block);
10741 if (!block.static) {
10742 node.static = false;
10743 }
10744 }
10745 }
10746 }
10747 }
10748 function markStaticRoots(node, isInFor) {
10749 if (node.type === 1) {
10750 if (node.static || node.once) {
10751 node.staticInFor = isInFor;
10752 }
10753 // For a node to qualify as a static root, it should have children that
10754 // are not just static text. Otherwise the cost of hoisting out will
10755 // outweigh the benefits and it's better off to just always render it fresh.
10756 if (node.static &&
10757 node.children.length &&
10758 !(node.children.length === 1 && node.children[0].type === 3)) {
10759 node.staticRoot = true;
10760 return;
10761 }
10762 else {
10763 node.staticRoot = false;
10764 }
10765 if (node.children) {
10766 for (var i = 0, l = node.children.length; i < l; i++) {
10767 markStaticRoots(node.children[i], isInFor || !!node.for);
10768 }
10769 }
10770 if (node.ifConditions) {
10771 for (var i = 1, l = node.ifConditions.length; i < l; i++) {
10772 markStaticRoots(node.ifConditions[i].block, isInFor);
10773 }
10774 }
10775 }
10776 }
10777 function isStatic(node) {
10778 if (node.type === 2) {
10779 // expression
10780 return false;
10781 }
10782 if (node.type === 3) {
10783 // text
10784 return true;
10785 }
10786 return !!(node.pre ||
10787 (!node.hasBindings && // no dynamic bindings
10788 !node.if &&
10789 !node.for && // not v-if or v-for or v-else
10790 !isBuiltInTag(node.tag) && // not a built-in
10791 isPlatformReservedTag(node.tag) && // not a component
10792 !isDirectChildOfTemplateFor(node) &&
10793 Object.keys(node).every(isStaticKey)));
10794 }
10795 function isDirectChildOfTemplateFor(node) {
10796 while (node.parent) {
10797 node = node.parent;
10798 if (node.tag !== 'template') {
10799 return false;
10800 }
10801 if (node.for) {
10802 return true;
10803 }
10804 }
10805 return false;
10806 }
10807
10808 var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
10809 var fnInvokeRE = /\([^)]*?\);*$/;
10810 var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
10811 // KeyboardEvent.keyCode aliases
10812 var keyCodes = {
10813 esc: 27,
10814 tab: 9,
10815 enter: 13,
10816 space: 32,
10817 up: 38,
10818 left: 37,
10819 right: 39,
10820 down: 40,
10821 delete: [8, 46]
10822 };
10823 // KeyboardEvent.key aliases
10824 var keyNames = {
10825 // #7880: IE11 and Edge use `Esc` for Escape key name.
10826 esc: ['Esc', 'Escape'],
10827 tab: 'Tab',
10828 enter: 'Enter',
10829 // #9112: IE11 uses `Spacebar` for Space key name.
10830 space: [' ', 'Spacebar'],
10831 // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
10832 up: ['Up', 'ArrowUp'],
10833 left: ['Left', 'ArrowLeft'],
10834 right: ['Right', 'ArrowRight'],
10835 down: ['Down', 'ArrowDown'],
10836 // #9112: IE11 uses `Del` for Delete key name.
10837 delete: ['Backspace', 'Delete', 'Del']
10838 };
10839 // #4868: modifiers that prevent the execution of the listener
10840 // need to explicitly return null so that we can determine whether to remove
10841 // the listener for .once
10842 var genGuard = function (condition) { return "if(".concat(condition, ")return null;"); };
10843 var modifierCode = {
10844 stop: '$event.stopPropagation();',
10845 prevent: '$event.preventDefault();',
10846 self: genGuard("$event.target !== $event.currentTarget"),
10847 ctrl: genGuard("!$event.ctrlKey"),
10848 shift: genGuard("!$event.shiftKey"),
10849 alt: genGuard("!$event.altKey"),
10850 meta: genGuard("!$event.metaKey"),
10851 left: genGuard("'button' in $event && $event.button !== 0"),
10852 middle: genGuard("'button' in $event && $event.button !== 1"),
10853 right: genGuard("'button' in $event && $event.button !== 2")
10854 };
10855 function genHandlers(events, isNative) {
10856 var prefix = isNative ? 'nativeOn:' : 'on:';
10857 var staticHandlers = "";
10858 var dynamicHandlers = "";
10859 for (var name_1 in events) {
10860 var handlerCode = genHandler(events[name_1]);
10861 //@ts-expect-error
10862 if (events[name_1] && events[name_1].dynamic) {
10863 dynamicHandlers += "".concat(name_1, ",").concat(handlerCode, ",");
10864 }
10865 else {
10866 staticHandlers += "\"".concat(name_1, "\":").concat(handlerCode, ",");
10867 }
10868 }
10869 staticHandlers = "{".concat(staticHandlers.slice(0, -1), "}");
10870 if (dynamicHandlers) {
10871 return prefix + "_d(".concat(staticHandlers, ",[").concat(dynamicHandlers.slice(0, -1), "])");
10872 }
10873 else {
10874 return prefix + staticHandlers;
10875 }
10876 }
10877 function genHandler(handler) {
10878 if (!handler) {
10879 return 'function(){}';
10880 }
10881 if (Array.isArray(handler)) {
10882 return "[".concat(handler.map(function (handler) { return genHandler(handler); }).join(','), "]");
10883 }
10884 var isMethodPath = simplePathRE.test(handler.value);
10885 var isFunctionExpression = fnExpRE.test(handler.value);
10886 var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
10887 if (!handler.modifiers) {
10888 if (isMethodPath || isFunctionExpression) {
10889 return handler.value;
10890 }
10891 return "function($event){".concat(isFunctionInvocation ? "return ".concat(handler.value) : handler.value, "}"); // inline statement
10892 }
10893 else {
10894 var code = '';
10895 var genModifierCode = '';
10896 var keys = [];
10897 var _loop_1 = function (key) {
10898 if (modifierCode[key]) {
10899 genModifierCode += modifierCode[key];
10900 // left/right
10901 if (keyCodes[key]) {
10902 keys.push(key);
10903 }
10904 }
10905 else if (key === 'exact') {
10906 var modifiers_1 = handler.modifiers;
10907 genModifierCode += genGuard(['ctrl', 'shift', 'alt', 'meta']
10908 .filter(function (keyModifier) { return !modifiers_1[keyModifier]; })
10909 .map(function (keyModifier) { return "$event.".concat(keyModifier, "Key"); })
10910 .join('||'));
10911 }
10912 else {
10913 keys.push(key);
10914 }
10915 };
10916 for (var key in handler.modifiers) {
10917 _loop_1(key);
10918 }
10919 if (keys.length) {
10920 code += genKeyFilter(keys);
10921 }
10922 // Make sure modifiers like prevent and stop get executed after key filtering
10923 if (genModifierCode) {
10924 code += genModifierCode;
10925 }
10926 var handlerCode = isMethodPath
10927 ? "return ".concat(handler.value, ".apply(null, arguments)")
10928 : isFunctionExpression
10929 ? "return (".concat(handler.value, ").apply(null, arguments)")
10930 : isFunctionInvocation
10931 ? "return ".concat(handler.value)
10932 : handler.value;
10933 return "function($event){".concat(code).concat(handlerCode, "}");
10934 }
10935 }
10936 function genKeyFilter(keys) {
10937 return (
10938 // make sure the key filters only apply to KeyboardEvents
10939 // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
10940 // key events that do not have keyCode property...
10941 "if(!$event.type.indexOf('key')&&" +
10942 "".concat(keys.map(genFilterCode).join('&&'), ")return null;"));
10943 }
10944 function genFilterCode(key) {
10945 var keyVal = parseInt(key, 10);
10946 if (keyVal) {
10947 return "$event.keyCode!==".concat(keyVal);
10948 }
10949 var keyCode = keyCodes[key];
10950 var keyName = keyNames[key];
10951 return ("_k($event.keyCode," +
10952 "".concat(JSON.stringify(key), ",") +
10953 "".concat(JSON.stringify(keyCode), ",") +
10954 "$event.key," +
10955 "".concat(JSON.stringify(keyName)) +
10956 ")");
10957 }
10958
10959 function on(el, dir) {
10960 if (dir.modifiers) {
10961 warn$2("v-on without argument does not support modifiers.");
10962 }
10963 el.wrapListeners = function (code) { return "_g(".concat(code, ",").concat(dir.value, ")"); };
10964 }
10965
10966 function bind(el, dir) {
10967 el.wrapData = function (code) {
10968 return "_b(".concat(code, ",'").concat(el.tag, "',").concat(dir.value, ",").concat(dir.modifiers && dir.modifiers.prop ? 'true' : 'false').concat(dir.modifiers && dir.modifiers.sync ? ',true' : '', ")");
10969 };
10970 }
10971
10972 var baseDirectives = {
10973 on: on,
10974 bind: bind,
10975 cloak: noop
10976 };
10977
10978 var CodegenState = /** @class */ (function () {
10979 function CodegenState(options) {
10980 this.options = options;
10981 this.warn = options.warn || baseWarn;
10982 this.transforms = pluckModuleFunction(options.modules, 'transformCode');
10983 this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
10984 this.directives = extend(extend({}, baseDirectives), options.directives);
10985 var isReservedTag = options.isReservedTag || no;
10986 this.maybeComponent = function (el) {
10987 return !!el.component || !isReservedTag(el.tag);
10988 };
10989 this.onceId = 0;
10990 this.staticRenderFns = [];
10991 this.pre = false;
10992 }
10993 return CodegenState;
10994 }());
10995 function generate(ast, options) {
10996 var state = new CodegenState(options);
10997 // fix #11483, Root level <script> tags should not be rendered.
10998 var code = ast
10999 ? ast.tag === 'script'
11000 ? 'null'
11001 : genElement(ast, state)
11002 : '_c("div")';
11003 return {
11004 render: "with(this){return ".concat(code, "}"),
11005 staticRenderFns: state.staticRenderFns
11006 };
11007 }
11008 function genElement(el, state) {
11009 if (el.parent) {
11010 el.pre = el.pre || el.parent.pre;
11011 }
11012 if (el.staticRoot && !el.staticProcessed) {
11013 return genStatic(el, state);
11014 }
11015 else if (el.once && !el.onceProcessed) {
11016 return genOnce(el, state);
11017 }
11018 else if (el.for && !el.forProcessed) {
11019 return genFor(el, state);
11020 }
11021 else if (el.if && !el.ifProcessed) {
11022 return genIf(el, state);
11023 }
11024 else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
11025 return genChildren(el, state) || 'void 0';
11026 }
11027 else if (el.tag === 'slot') {
11028 return genSlot(el, state);
11029 }
11030 else {
11031 // component or element
11032 var code = void 0;
11033 if (el.component) {
11034 code = genComponent(el.component, el, state);
11035 }
11036 else {
11037 var data = void 0;
11038 var maybeComponent = state.maybeComponent(el);
11039 if (!el.plain || (el.pre && maybeComponent)) {
11040 data = genData(el, state);
11041 }
11042 var tag
11043 // check if this is a component in <script setup>
11044 = void 0;
11045 // check if this is a component in <script setup>
11046 var bindings = state.options.bindings;
11047 if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
11048 tag = checkBindingType(bindings, el.tag);
11049 }
11050 if (!tag)
11051 tag = "'".concat(el.tag, "'");
11052 var children = el.inlineTemplate ? null : genChildren(el, state, true);
11053 code = "_c(".concat(tag).concat(data ? ",".concat(data) : '' // data
11054 ).concat(children ? ",".concat(children) : '' // children
11055 , ")");
11056 }
11057 // module transforms
11058 for (var i = 0; i < state.transforms.length; i++) {
11059 code = state.transforms[i](el, code);
11060 }
11061 return code;
11062 }
11063 }
11064 function checkBindingType(bindings, key) {
11065 var camelName = camelize(key);
11066 var PascalName = capitalize(camelName);
11067 var checkType = function (type) {
11068 if (bindings[key] === type) {
11069 return key;
11070 }
11071 if (bindings[camelName] === type) {
11072 return camelName;
11073 }
11074 if (bindings[PascalName] === type) {
11075 return PascalName;
11076 }
11077 };
11078 var fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
11079 checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
11080 if (fromConst) {
11081 return fromConst;
11082 }
11083 var fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
11084 checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
11085 checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
11086 if (fromMaybeRef) {
11087 return fromMaybeRef;
11088 }
11089 }
11090 // hoist static sub-trees out
11091 function genStatic(el, state) {
11092 el.staticProcessed = true;
11093 // Some elements (templates) need to behave differently inside of a v-pre
11094 // node. All pre nodes are static roots, so we can use this as a location to
11095 // wrap a state change and reset it upon exiting the pre node.
11096 var originalPreState = state.pre;
11097 if (el.pre) {
11098 state.pre = el.pre;
11099 }
11100 state.staticRenderFns.push("with(this){return ".concat(genElement(el, state), "}"));
11101 state.pre = originalPreState;
11102 return "_m(".concat(state.staticRenderFns.length - 1).concat(el.staticInFor ? ',true' : '', ")");
11103 }
11104 // v-once
11105 function genOnce(el, state) {
11106 el.onceProcessed = true;
11107 if (el.if && !el.ifProcessed) {
11108 return genIf(el, state);
11109 }
11110 else if (el.staticInFor) {
11111 var key = '';
11112 var parent_1 = el.parent;
11113 while (parent_1) {
11114 if (parent_1.for) {
11115 key = parent_1.key;
11116 break;
11117 }
11118 parent_1 = parent_1.parent;
11119 }
11120 if (!key) {
11121 state.warn("v-once can only be used inside v-for that is keyed. ", el.rawAttrsMap['v-once']);
11122 return genElement(el, state);
11123 }
11124 return "_o(".concat(genElement(el, state), ",").concat(state.onceId++, ",").concat(key, ")");
11125 }
11126 else {
11127 return genStatic(el, state);
11128 }
11129 }
11130 function genIf(el, state, altGen, altEmpty) {
11131 el.ifProcessed = true; // avoid recursion
11132 return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty);
11133 }
11134 function genIfConditions(conditions, state, altGen, altEmpty) {
11135 if (!conditions.length) {
11136 return altEmpty || '_e()';
11137 }
11138 var condition = conditions.shift();
11139 if (condition.exp) {
11140 return "(".concat(condition.exp, ")?").concat(genTernaryExp(condition.block), ":").concat(genIfConditions(conditions, state, altGen, altEmpty));
11141 }
11142 else {
11143 return "".concat(genTernaryExp(condition.block));
11144 }
11145 // v-if with v-once should generate code like (a)?_m(0):_m(1)
11146 function genTernaryExp(el) {
11147 return altGen
11148 ? altGen(el, state)
11149 : el.once
11150 ? genOnce(el, state)
11151 : genElement(el, state);
11152 }
11153 }
11154 function genFor(el, state, altGen, altHelper) {
11155 var exp = el.for;
11156 var alias = el.alias;
11157 var iterator1 = el.iterator1 ? ",".concat(el.iterator1) : '';
11158 var iterator2 = el.iterator2 ? ",".concat(el.iterator2) : '';
11159 if (state.maybeComponent(el) &&
11160 el.tag !== 'slot' &&
11161 el.tag !== 'template' &&
11162 !el.key) {
11163 state.warn("<".concat(el.tag, " v-for=\"").concat(alias, " in ").concat(exp, "\">: component lists rendered with ") +
11164 "v-for should have explicit keys. " +
11165 "See https://v2.vuejs.org/v2/guide/list.html#key for more info.", el.rawAttrsMap['v-for'], true /* tip */);
11166 }
11167 el.forProcessed = true; // avoid recursion
11168 return ("".concat(altHelper || '_l', "((").concat(exp, "),") +
11169 "function(".concat(alias).concat(iterator1).concat(iterator2, "){") +
11170 "return ".concat((altGen || genElement)(el, state)) +
11171 '})');
11172 }
11173 function genData(el, state) {
11174 var data = '{';
11175 // directives first.
11176 // directives may mutate the el's other properties before they are generated.
11177 var dirs = genDirectives(el, state);
11178 if (dirs)
11179 data += dirs + ',';
11180 // key
11181 if (el.key) {
11182 data += "key:".concat(el.key, ",");
11183 }
11184 // ref
11185 if (el.ref) {
11186 data += "ref:".concat(el.ref, ",");
11187 }
11188 if (el.refInFor) {
11189 data += "refInFor:true,";
11190 }
11191 // pre
11192 if (el.pre) {
11193 data += "pre:true,";
11194 }
11195 // record original tag name for components using "is" attribute
11196 if (el.component) {
11197 data += "tag:\"".concat(el.tag, "\",");
11198 }
11199 // module data generation functions
11200 for (var i = 0; i < state.dataGenFns.length; i++) {
11201 data += state.dataGenFns[i](el);
11202 }
11203 // attributes
11204 if (el.attrs) {
11205 data += "attrs:".concat(genProps(el.attrs), ",");
11206 }
11207 // DOM props
11208 if (el.props) {
11209 data += "domProps:".concat(genProps(el.props), ",");
11210 }
11211 // event handlers
11212 if (el.events) {
11213 data += "".concat(genHandlers(el.events, false), ",");
11214 }
11215 if (el.nativeEvents) {
11216 data += "".concat(genHandlers(el.nativeEvents, true), ",");
11217 }
11218 // slot target
11219 // only for non-scoped slots
11220 if (el.slotTarget && !el.slotScope) {
11221 data += "slot:".concat(el.slotTarget, ",");
11222 }
11223 // scoped slots
11224 if (el.scopedSlots) {
11225 data += "".concat(genScopedSlots(el, el.scopedSlots, state), ",");
11226 }
11227 // component v-model
11228 if (el.model) {
11229 data += "model:{value:".concat(el.model.value, ",callback:").concat(el.model.callback, ",expression:").concat(el.model.expression, "},");
11230 }
11231 // inline-template
11232 if (el.inlineTemplate) {
11233 var inlineTemplate = genInlineTemplate(el, state);
11234 if (inlineTemplate) {
11235 data += "".concat(inlineTemplate, ",");
11236 }
11237 }
11238 data = data.replace(/,$/, '') + '}';
11239 // v-bind dynamic argument wrap
11240 // v-bind with dynamic arguments must be applied using the same v-bind object
11241 // merge helper so that class/style/mustUseProp attrs are handled correctly.
11242 if (el.dynamicAttrs) {
11243 data = "_b(".concat(data, ",\"").concat(el.tag, "\",").concat(genProps(el.dynamicAttrs), ")");
11244 }
11245 // v-bind data wrap
11246 if (el.wrapData) {
11247 data = el.wrapData(data);
11248 }
11249 // v-on data wrap
11250 if (el.wrapListeners) {
11251 data = el.wrapListeners(data);
11252 }
11253 return data;
11254 }
11255 function genDirectives(el, state) {
11256 var dirs = el.directives;
11257 if (!dirs)
11258 return;
11259 var res = 'directives:[';
11260 var hasRuntime = false;
11261 var i, l, dir, needRuntime;
11262 for (i = 0, l = dirs.length; i < l; i++) {
11263 dir = dirs[i];
11264 needRuntime = true;
11265 var gen = state.directives[dir.name];
11266 if (gen) {
11267 // compile-time directive that manipulates AST.
11268 // returns true if it also needs a runtime counterpart.
11269 needRuntime = !!gen(el, dir, state.warn);
11270 }
11271 if (needRuntime) {
11272 hasRuntime = true;
11273 res += "{name:\"".concat(dir.name, "\",rawName:\"").concat(dir.rawName, "\"").concat(dir.value
11274 ? ",value:(".concat(dir.value, "),expression:").concat(JSON.stringify(dir.value))
11275 : '').concat(dir.arg ? ",arg:".concat(dir.isDynamicArg ? dir.arg : "\"".concat(dir.arg, "\"")) : '').concat(dir.modifiers ? ",modifiers:".concat(JSON.stringify(dir.modifiers)) : '', "},");
11276 }
11277 }
11278 if (hasRuntime) {
11279 return res.slice(0, -1) + ']';
11280 }
11281 }
11282 function genInlineTemplate(el, state) {
11283 var ast = el.children[0];
11284 if ((el.children.length !== 1 || ast.type !== 1)) {
11285 state.warn('Inline-template components must have exactly one child element.', { start: el.start });
11286 }
11287 if (ast && ast.type === 1) {
11288 var inlineRenderFns = generate(ast, state.options);
11289 return "inlineTemplate:{render:function(){".concat(inlineRenderFns.render, "},staticRenderFns:[").concat(inlineRenderFns.staticRenderFns
11290 .map(function (code) { return "function(){".concat(code, "}"); })
11291 .join(','), "]}");
11292 }
11293 }
11294 function genScopedSlots(el, slots, state) {
11295 // by default scoped slots are considered "stable", this allows child
11296 // components with only scoped slots to skip forced updates from parent.
11297 // but in some cases we have to bail-out of this optimization
11298 // for example if the slot contains dynamic names, has v-if or v-for on them...
11299 var needsForceUpdate = el.for ||
11300 Object.keys(slots).some(function (key) {
11301 var slot = slots[key];
11302 return (slot.slotTargetDynamic || slot.if || slot.for || containsSlotChild(slot) // is passing down slot from parent which may be dynamic
11303 );
11304 });
11305 // #9534: if a component with scoped slots is inside a conditional branch,
11306 // it's possible for the same component to be reused but with different
11307 // compiled slot content. To avoid that, we generate a unique key based on
11308 // the generated code of all the slot contents.
11309 var needsKey = !!el.if;
11310 // OR when it is inside another scoped slot or v-for (the reactivity may be
11311 // disconnected due to the intermediate scope variable)
11312 // #9438, #9506
11313 // TODO: this can be further optimized by properly analyzing in-scope bindings
11314 // and skip force updating ones that do not actually use scope variables.
11315 if (!needsForceUpdate) {
11316 var parent_2 = el.parent;
11317 while (parent_2) {
11318 if ((parent_2.slotScope && parent_2.slotScope !== emptySlotScopeToken) ||
11319 parent_2.for) {
11320 needsForceUpdate = true;
11321 break;
11322 }
11323 if (parent_2.if) {
11324 needsKey = true;
11325 }
11326 parent_2 = parent_2.parent;
11327 }
11328 }
11329 var generatedSlots = Object.keys(slots)
11330 .map(function (key) { return genScopedSlot(slots[key], state); })
11331 .join(',');
11332 return "scopedSlots:_u([".concat(generatedSlots, "]").concat(needsForceUpdate ? ",null,true" : "").concat(!needsForceUpdate && needsKey ? ",null,false,".concat(hash(generatedSlots)) : "", ")");
11333 }
11334 function hash(str) {
11335 var hash = 5381;
11336 var i = str.length;
11337 while (i) {
11338 hash = (hash * 33) ^ str.charCodeAt(--i);
11339 }
11340 return hash >>> 0;
11341 }
11342 function containsSlotChild(el) {
11343 if (el.type === 1) {
11344 if (el.tag === 'slot') {
11345 return true;
11346 }
11347 return el.children.some(containsSlotChild);
11348 }
11349 return false;
11350 }
11351 function genScopedSlot(el, state) {
11352 var isLegacySyntax = el.attrsMap['slot-scope'];
11353 if (el.if && !el.ifProcessed && !isLegacySyntax) {
11354 return genIf(el, state, genScopedSlot, "null");
11355 }
11356 if (el.for && !el.forProcessed) {
11357 return genFor(el, state, genScopedSlot);
11358 }
11359 var slotScope = el.slotScope === emptySlotScopeToken ? "" : String(el.slotScope);
11360 var fn = "function(".concat(slotScope, "){") +
11361 "return ".concat(el.tag === 'template'
11362 ? el.if && isLegacySyntax
11363 ? "(".concat(el.if, ")?").concat(genChildren(el, state) || 'undefined', ":undefined")
11364 : genChildren(el, state) || 'undefined'
11365 : genElement(el, state), "}");
11366 // reverse proxy v-slot without scope on this.$slots
11367 var reverseProxy = slotScope ? "" : ",proxy:true";
11368 return "{key:".concat(el.slotTarget || "\"default\"", ",fn:").concat(fn).concat(reverseProxy, "}");
11369 }
11370 function genChildren(el, state, checkSkip, altGenElement, altGenNode) {
11371 var children = el.children;
11372 if (children.length) {
11373 var el_1 = children[0];
11374 // optimize single v-for
11375 if (children.length === 1 &&
11376 el_1.for &&
11377 el_1.tag !== 'template' &&
11378 el_1.tag !== 'slot') {
11379 var normalizationType_1 = checkSkip
11380 ? state.maybeComponent(el_1)
11381 ? ",1"
11382 : ",0"
11383 : "";
11384 return "".concat((altGenElement || genElement)(el_1, state)).concat(normalizationType_1);
11385 }
11386 var normalizationType = checkSkip
11387 ? getNormalizationType(children, state.maybeComponent)
11388 : 0;
11389 var gen_1 = altGenNode || genNode;
11390 return "[".concat(children.map(function (c) { return gen_1(c, state); }).join(','), "]").concat(normalizationType ? ",".concat(normalizationType) : '');
11391 }
11392 }
11393 // determine the normalization needed for the children array.
11394 // 0: no normalization needed
11395 // 1: simple normalization needed (possible 1-level deep nested array)
11396 // 2: full normalization needed
11397 function getNormalizationType(children, maybeComponent) {
11398 var res = 0;
11399 for (var i = 0; i < children.length; i++) {
11400 var el = children[i];
11401 if (el.type !== 1) {
11402 continue;
11403 }
11404 if (needsNormalization(el) ||
11405 (el.ifConditions &&
11406 el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
11407 res = 2;
11408 break;
11409 }
11410 if (maybeComponent(el) ||
11411 (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
11412 res = 1;
11413 }
11414 }
11415 return res;
11416 }
11417 function needsNormalization(el) {
11418 return el.for !== undefined || el.tag === 'template' || el.tag === 'slot';
11419 }
11420 function genNode(node, state) {
11421 if (node.type === 1) {
11422 return genElement(node, state);
11423 }
11424 else if (node.type === 3 && node.isComment) {
11425 return genComment(node);
11426 }
11427 else {
11428 return genText(node);
11429 }
11430 }
11431 function genText(text) {
11432 return "_v(".concat(text.type === 2
11433 ? text.expression // no need for () because already wrapped in _s()
11434 : transformSpecialNewlines(JSON.stringify(text.text)), ")");
11435 }
11436 function genComment(comment) {
11437 return "_e(".concat(JSON.stringify(comment.text), ")");
11438 }
11439 function genSlot(el, state) {
11440 var slotName = el.slotName || '"default"';
11441 var children = genChildren(el, state);
11442 var res = "_t(".concat(slotName).concat(children ? ",function(){return ".concat(children, "}") : '');
11443 var attrs = el.attrs || el.dynamicAttrs
11444 ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
11445 // slot props are camelized
11446 name: camelize(attr.name),
11447 value: attr.value,
11448 dynamic: attr.dynamic
11449 }); }))
11450 : null;
11451 var bind = el.attrsMap['v-bind'];
11452 if ((attrs || bind) && !children) {
11453 res += ",null";
11454 }
11455 if (attrs) {
11456 res += ",".concat(attrs);
11457 }
11458 if (bind) {
11459 res += "".concat(attrs ? '' : ',null', ",").concat(bind);
11460 }
11461 return res + ')';
11462 }
11463 // componentName is el.component, take it as argument to shun flow's pessimistic refinement
11464 function genComponent(componentName, el, state) {
11465 var children = el.inlineTemplate ? null : genChildren(el, state, true);
11466 return "_c(".concat(componentName, ",").concat(genData(el, state)).concat(children ? ",".concat(children) : '', ")");
11467 }
11468 function genProps(props) {
11469 var staticProps = "";
11470 var dynamicProps = "";
11471 for (var i = 0; i < props.length; i++) {
11472 var prop = props[i];
11473 var value = transformSpecialNewlines(prop.value);
11474 if (prop.dynamic) {
11475 dynamicProps += "".concat(prop.name, ",").concat(value, ",");
11476 }
11477 else {
11478 staticProps += "\"".concat(prop.name, "\":").concat(value, ",");
11479 }
11480 }
11481 staticProps = "{".concat(staticProps.slice(0, -1), "}");
11482 if (dynamicProps) {
11483 return "_d(".concat(staticProps, ",[").concat(dynamicProps.slice(0, -1), "])");
11484 }
11485 else {
11486 return staticProps;
11487 }
11488 }
11489 // #3895, #4268
11490 function transformSpecialNewlines(text) {
11491 return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
11492 }
11493
11494 // these keywords should not appear inside expressions, but operators like
11495 // typeof, instanceof and in are allowed
11496 var prohibitedKeywordRE = new RegExp('\\b' +
11497 ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
11498 'super,throw,while,yield,delete,export,import,return,switch,default,' +
11499 'extends,finally,continue,debugger,function,arguments')
11500 .split(',')
11501 .join('\\b|\\b') +
11502 '\\b');
11503 // these unary operators should not be used as property/method names
11504 var unaryOperatorsRE = new RegExp('\\b' +
11505 'delete,typeof,void'.split(',').join('\\s*\\([^\\)]*\\)|\\b') +
11506 '\\s*\\([^\\)]*\\)');
11507 // strip strings in expressions
11508 var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
11509 // detect problematic expressions in a template
11510 function detectErrors(ast, warn) {
11511 if (ast) {
11512 checkNode(ast, warn);
11513 }
11514 }
11515 function checkNode(node, warn) {
11516 if (node.type === 1) {
11517 for (var name_1 in node.attrsMap) {
11518 if (dirRE.test(name_1)) {
11519 var value = node.attrsMap[name_1];
11520 if (value) {
11521 var range = node.rawAttrsMap[name_1];
11522 if (name_1 === 'v-for') {
11523 checkFor(node, "v-for=\"".concat(value, "\""), warn, range);
11524 }
11525 else if (name_1 === 'v-slot' || name_1[0] === '#') {
11526 checkFunctionParameterExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
11527 }
11528 else if (onRE.test(name_1)) {
11529 checkEvent(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
11530 }
11531 else {
11532 checkExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
11533 }
11534 }
11535 }
11536 }
11537 if (node.children) {
11538 for (var i = 0; i < node.children.length; i++) {
11539 checkNode(node.children[i], warn);
11540 }
11541 }
11542 }
11543 else if (node.type === 2) {
11544 checkExpression(node.expression, node.text, warn, node);
11545 }
11546 }
11547 function checkEvent(exp, text, warn, range) {
11548 var stripped = exp.replace(stripStringRE, '');
11549 var keywordMatch = stripped.match(unaryOperatorsRE);
11550 if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
11551 warn("avoid using JavaScript unary operator as property name: " +
11552 "\"".concat(keywordMatch[0], "\" in expression ").concat(text.trim()), range);
11553 }
11554 checkExpression(exp, text, warn, range);
11555 }
11556 function checkFor(node, text, warn, range) {
11557 checkExpression(node.for || '', text, warn, range);
11558 checkIdentifier(node.alias, 'v-for alias', text, warn, range);
11559 checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
11560 checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
11561 }
11562 function checkIdentifier(ident, type, text, warn, range) {
11563 if (typeof ident === 'string') {
11564 try {
11565 new Function("var ".concat(ident, "=_"));
11566 }
11567 catch (e) {
11568 warn("invalid ".concat(type, " \"").concat(ident, "\" in expression: ").concat(text.trim()), range);
11569 }
11570 }
11571 }
11572 function checkExpression(exp, text, warn, range) {
11573 try {
11574 new Function("return ".concat(exp));
11575 }
11576 catch (e) {
11577 var keywordMatch = exp
11578 .replace(stripStringRE, '')
11579 .match(prohibitedKeywordRE);
11580 if (keywordMatch) {
11581 warn("avoid using JavaScript keyword as property name: " +
11582 "\"".concat(keywordMatch[0], "\"\n Raw expression: ").concat(text.trim()), range);
11583 }
11584 else {
11585 warn("invalid expression: ".concat(e.message, " in\n\n") +
11586 " ".concat(exp, "\n\n") +
11587 " Raw expression: ".concat(text.trim(), "\n"), range);
11588 }
11589 }
11590 }
11591 function checkFunctionParameterExpression(exp, text, warn, range) {
11592 try {
11593 new Function(exp, '');
11594 }
11595 catch (e) {
11596 warn("invalid function parameter expression: ".concat(e.message, " in\n\n") +
11597 " ".concat(exp, "\n\n") +
11598 " Raw expression: ".concat(text.trim(), "\n"), range);
11599 }
11600 }
11601
11602 var range = 2;
11603 function generateCodeFrame(source, start, end) {
11604 if (start === void 0) { start = 0; }
11605 if (end === void 0) { end = source.length; }
11606 var lines = source.split(/\r?\n/);
11607 var count = 0;
11608 var res = [];
11609 for (var i = 0; i < lines.length; i++) {
11610 count += lines[i].length + 1;
11611 if (count >= start) {
11612 for (var j = i - range; j <= i + range || end > count; j++) {
11613 if (j < 0 || j >= lines.length)
11614 continue;
11615 res.push("".concat(j + 1).concat(repeat(" ", 3 - String(j + 1).length), "| ").concat(lines[j]));
11616 var lineLength = lines[j].length;
11617 if (j === i) {
11618 // push underline
11619 var pad = start - (count - lineLength) + 1;
11620 var length_1 = end > count ? lineLength - pad : end - start;
11621 res.push(" | " + repeat(" ", pad) + repeat("^", length_1));
11622 }
11623 else if (j > i) {
11624 if (end > count) {
11625 var length_2 = Math.min(end - count, lineLength);
11626 res.push(" | " + repeat("^", length_2));
11627 }
11628 count += lineLength + 1;
11629 }
11630 }
11631 break;
11632 }
11633 }
11634 return res.join('\n');
11635 }
11636 function repeat(str, n) {
11637 var result = '';
11638 if (n > 0) {
11639 // eslint-disable-next-line no-constant-condition
11640 while (true) {
11641 // eslint-disable-line
11642 if (n & 1)
11643 result += str;
11644 n >>>= 1;
11645 if (n <= 0)
11646 break;
11647 str += str;
11648 }
11649 }
11650 return result;
11651 }
11652
11653 function createFunction(code, errors) {
11654 try {
11655 return new Function(code);
11656 }
11657 catch (err) {
11658 errors.push({ err: err, code: code });
11659 return noop;
11660 }
11661 }
11662 function createCompileToFunctionFn(compile) {
11663 var cache = Object.create(null);
11664 return function compileToFunctions(template, options, vm) {
11665 options = extend({}, options);
11666 var warn = options.warn || warn$2;
11667 delete options.warn;
11668 /* istanbul ignore if */
11669 {
11670 // detect possible CSP restriction
11671 try {
11672 new Function('return 1');
11673 }
11674 catch (e) {
11675 if (e.toString().match(/unsafe-eval|CSP/)) {
11676 warn('It seems you are using the standalone build of Vue.js in an ' +
11677 'environment with Content Security Policy that prohibits unsafe-eval. ' +
11678 'The template compiler cannot work in this environment. Consider ' +
11679 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
11680 'templates into render functions.');
11681 }
11682 }
11683 }
11684 // check cache
11685 var key = options.delimiters
11686 ? String(options.delimiters) + template
11687 : template;
11688 if (cache[key]) {
11689 return cache[key];
11690 }
11691 // compile
11692 var compiled = compile(template, options);
11693 // check compilation errors/tips
11694 {
11695 if (compiled.errors && compiled.errors.length) {
11696 if (options.outputSourceRange) {
11697 compiled.errors.forEach(function (e) {
11698 warn("Error compiling template:\n\n".concat(e.msg, "\n\n") +
11699 generateCodeFrame(template, e.start, e.end), vm);
11700 });
11701 }
11702 else {
11703 warn("Error compiling template:\n\n".concat(template, "\n\n") +
11704 compiled.errors.map(function (e) { return "- ".concat(e); }).join('\n') +
11705 '\n', vm);
11706 }
11707 }
11708 if (compiled.tips && compiled.tips.length) {
11709 if (options.outputSourceRange) {
11710 compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
11711 }
11712 else {
11713 compiled.tips.forEach(function (msg) { return tip(msg, vm); });
11714 }
11715 }
11716 }
11717 // turn code into functions
11718 var res = {};
11719 var fnGenErrors = [];
11720 res.render = createFunction(compiled.render, fnGenErrors);
11721 res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
11722 return createFunction(code, fnGenErrors);
11723 });
11724 // check function generation errors.
11725 // this should only happen if there is a bug in the compiler itself.
11726 // mostly for codegen development use
11727 /* istanbul ignore if */
11728 {
11729 if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
11730 warn("Failed to generate render function:\n\n" +
11731 fnGenErrors
11732 .map(function (_a) {
11733 var err = _a.err, code = _a.code;
11734 return "".concat(err.toString(), " in\n\n").concat(code, "\n");
11735 })
11736 .join('\n'), vm);
11737 }
11738 }
11739 return (cache[key] = res);
11740 };
11741 }
11742
11743 function createCompilerCreator(baseCompile) {
11744 return function createCompiler(baseOptions) {
11745 function compile(template, options) {
11746 var finalOptions = Object.create(baseOptions);
11747 var errors = [];
11748 var tips = [];
11749 var warn = function (msg, range, tip) {
11750 (tip ? tips : errors).push(msg);
11751 };
11752 if (options) {
11753 if (options.outputSourceRange) {
11754 // $flow-disable-line
11755 var leadingSpaceLength_1 = template.match(/^\s*/)[0].length;
11756 warn = function (msg, range, tip) {
11757 var data = typeof msg === 'string' ? { msg: msg } : msg;
11758 if (range) {
11759 if (range.start != null) {
11760 data.start = range.start + leadingSpaceLength_1;
11761 }
11762 if (range.end != null) {
11763 data.end = range.end + leadingSpaceLength_1;
11764 }
11765 }
11766 (tip ? tips : errors).push(data);
11767 };
11768 }
11769 // merge custom modules
11770 if (options.modules) {
11771 finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
11772 }
11773 // merge custom directives
11774 if (options.directives) {
11775 finalOptions.directives = extend(Object.create(baseOptions.directives || null), options.directives);
11776 }
11777 // copy other options
11778 for (var key in options) {
11779 if (key !== 'modules' && key !== 'directives') {
11780 finalOptions[key] = options[key];
11781 }
11782 }
11783 }
11784 finalOptions.warn = warn;
11785 var compiled = baseCompile(template.trim(), finalOptions);
11786 {
11787 detectErrors(compiled.ast, warn);
11788 }
11789 compiled.errors = errors;
11790 compiled.tips = tips;
11791 return compiled;
11792 }
11793 return {
11794 compile: compile,
11795 compileToFunctions: createCompileToFunctionFn(compile)
11796 };
11797 };
11798 }
11799
11800 // `createCompilerCreator` allows creating compilers that use alternative
11801 // parser/optimizer/codegen, e.g the SSR optimizing compiler.
11802 // Here we just export a default compiler using the default parts.
11803 var createCompiler = createCompilerCreator(function baseCompile(template, options) {
11804 var ast = parse(template.trim(), options);
11805 if (options.optimize !== false) {
11806 optimize(ast, options);
11807 }
11808 var code = generate(ast, options);
11809 return {
11810 ast: ast,
11811 render: code.render,
11812 staticRenderFns: code.staticRenderFns
11813 };
11814 });
11815
11816 var _a = createCompiler(baseOptions), compileToFunctions = _a.compileToFunctions;
11817
11818 // check whether current browser encodes a char inside attribute values
11819 var div;
11820 function getShouldDecode(href) {
11821 div = div || document.createElement('div');
11822 div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
11823 return div.innerHTML.indexOf('&#10;') > 0;
11824 }
11825 // #3663: IE encodes newlines inside attribute values while other browsers don't
11826 var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
11827 // #6828: chrome encodes content in a[href]
11828 var shouldDecodeNewlinesForHref = inBrowser
11829 ? getShouldDecode(true)
11830 : false;
11831
11832 var idToTemplate = cached(function (id) {
11833 var el = query(id);
11834 return el && el.innerHTML;
11835 });
11836 var mount = Vue.prototype.$mount;
11837 Vue.prototype.$mount = function (el, hydrating) {
11838 el = el && query(el);
11839 /* istanbul ignore if */
11840 if (el === document.body || el === document.documentElement) {
11841 warn$2("Do not mount Vue to <html> or <body> - mount to normal elements instead.");
11842 return this;
11843 }
11844 var options = this.$options;
11845 // resolve template/el and convert to render function
11846 if (!options.render) {
11847 var template = options.template;
11848 if (template) {
11849 if (typeof template === 'string') {
11850 if (template.charAt(0) === '#') {
11851 template = idToTemplate(template);
11852 /* istanbul ignore if */
11853 if (!template) {
11854 warn$2("Template element not found or is empty: ".concat(options.template), this);
11855 }
11856 }
11857 }
11858 else if (template.nodeType) {
11859 template = template.innerHTML;
11860 }
11861 else {
11862 {
11863 warn$2('invalid template option:' + template, this);
11864 }
11865 return this;
11866 }
11867 }
11868 else if (el) {
11869 // @ts-expect-error
11870 template = getOuterHTML(el);
11871 }
11872 if (template) {
11873 /* istanbul ignore if */
11874 if (config.performance && mark) {
11875 mark('compile');
11876 }
11877 var _a = compileToFunctions(template, {
11878 outputSourceRange: true,
11879 shouldDecodeNewlines: shouldDecodeNewlines,
11880 shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
11881 delimiters: options.delimiters,
11882 comments: options.comments
11883 }, this), render = _a.render, staticRenderFns = _a.staticRenderFns;
11884 options.render = render;
11885 options.staticRenderFns = staticRenderFns;
11886 /* istanbul ignore if */
11887 if (config.performance && mark) {
11888 mark('compile end');
11889 measure("vue ".concat(this._name, " compile"), 'compile', 'compile end');
11890 }
11891 }
11892 }
11893 return mount.call(this, el, hydrating);
11894 };
11895 /**
11896 * Get outerHTML of elements, taking care
11897 * of SVG elements in IE as well.
11898 */
11899 function getOuterHTML(el) {
11900 if (el.outerHTML) {
11901 return el.outerHTML;
11902 }
11903 else {
11904 var container = document.createElement('div');
11905 container.appendChild(el.cloneNode(true));
11906 return container.innerHTML;
11907 }
11908 }
11909 Vue.compile = compileToFunctions;
11910
11911 // export type EffectScheduler = (...args: any[]) => any
11912 /**
11913 * @internal since we are not exposing this in Vue 2, it's used only for
11914 * internal testing.
11915 */
11916 function effect(fn, scheduler) {
11917 var watcher = new Watcher(currentInstance, fn, noop, {
11918 sync: true
11919 });
11920 if (scheduler) {
11921 watcher.update = function () {
11922 scheduler(function () { return watcher.run(); });
11923 };
11924 }
11925 }
11926
11927 extend(Vue, vca);
11928 Vue.effect = effect;
11929
11930 return Vue;
11931
11932}));