UNPKG

240 kBJavaScriptView Raw
1/*!
2 * Vue.js v2.6.14
3 * (c) 2014-2021 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 = global || self, global.Vue = factory());
10}(this, function () { 'use strict';
11
12 /* */
13
14 var emptyObject = Object.freeze({});
15
16 // These helpers produce better VM code in JS engines due to their
17 // explicitness and function inlining.
18 function isUndef (v) {
19 return v === undefined || v === null
20 }
21
22 function isDef (v) {
23 return v !== undefined && v !== null
24 }
25
26 function isTrue (v) {
27 return v === true
28 }
29
30 function isFalse (v) {
31 return v === false
32 }
33
34 /**
35 * Check if value is primitive.
36 */
37 function isPrimitive (value) {
38 return (
39 typeof value === 'string' ||
40 typeof value === 'number' ||
41 // $flow-disable-line
42 typeof value === 'symbol' ||
43 typeof value === 'boolean'
44 )
45 }
46
47 /**
48 * Quick object check - this is primarily used to tell
49 * Objects from primitive values when we know the value
50 * is a JSON-compliant type.
51 */
52 function isObject (obj) {
53 return obj !== null && typeof obj === 'object'
54 }
55
56 /**
57 * Get the raw type string of a value, e.g., [object Object].
58 */
59 var _toString = Object.prototype.toString;
60
61 function toRawType (value) {
62 return _toString.call(value).slice(8, -1)
63 }
64
65 /**
66 * Strict object type check. Only returns true
67 * for plain JavaScript objects.
68 */
69 function isPlainObject (obj) {
70 return _toString.call(obj) === '[object Object]'
71 }
72
73 function isRegExp (v) {
74 return _toString.call(v) === '[object RegExp]'
75 }
76
77 /**
78 * Check if val is a valid array index.
79 */
80 function isValidArrayIndex (val) {
81 var n = parseFloat(String(val));
82 return n >= 0 && Math.floor(n) === n && isFinite(val)
83 }
84
85 function isPromise (val) {
86 return (
87 isDef(val) &&
88 typeof val.then === 'function' &&
89 typeof val.catch === 'function'
90 )
91 }
92
93 /**
94 * Convert a value to a string that is actually rendered.
95 */
96 function toString (val) {
97 return val == null
98 ? ''
99 : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
100 ? JSON.stringify(val, null, 2)
101 : String(val)
102 }
103
104 /**
105 * Convert an input value to a number for persistence.
106 * If the conversion fails, return original string.
107 */
108 function toNumber (val) {
109 var n = parseFloat(val);
110 return isNaN(n) ? val : n
111 }
112
113 /**
114 * Make a map and return a function for checking if a key
115 * is in that map.
116 */
117 function makeMap (
118 str,
119 expectsLowerCase
120 ) {
121 var map = Object.create(null);
122 var list = str.split(',');
123 for (var i = 0; i < list.length; i++) {
124 map[list[i]] = true;
125 }
126 return expectsLowerCase
127 ? function (val) { return map[val.toLowerCase()]; }
128 : function (val) { return map[val]; }
129 }
130
131 /**
132 * Check if a tag is a built-in tag.
133 */
134 var isBuiltInTag = makeMap('slot,component', true);
135
136 /**
137 * Check if an attribute is a reserved attribute.
138 */
139 var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
140
141 /**
142 * Remove an item from an array.
143 */
144 function remove (arr, item) {
145 if (arr.length) {
146 var index = arr.indexOf(item);
147 if (index > -1) {
148 return arr.splice(index, 1)
149 }
150 }
151 }
152
153 /**
154 * Check whether an object has the property.
155 */
156 var hasOwnProperty = Object.prototype.hasOwnProperty;
157 function hasOwn (obj, key) {
158 return hasOwnProperty.call(obj, key)
159 }
160
161 /**
162 * Create a cached version of a pure function.
163 */
164 function cached (fn) {
165 var cache = Object.create(null);
166 return (function cachedFn (str) {
167 var hit = cache[str];
168 return hit || (cache[str] = fn(str))
169 })
170 }
171
172 /**
173 * Camelize a hyphen-delimited string.
174 */
175 var camelizeRE = /-(\w)/g;
176 var camelize = cached(function (str) {
177 return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
178 });
179
180 /**
181 * Capitalize a string.
182 */
183 var capitalize = cached(function (str) {
184 return str.charAt(0).toUpperCase() + str.slice(1)
185 });
186
187 /**
188 * Hyphenate a camelCase string.
189 */
190 var hyphenateRE = /\B([A-Z])/g;
191 var hyphenate = cached(function (str) {
192 return str.replace(hyphenateRE, '-$1').toLowerCase()
193 });
194
195 /**
196 * Simple bind polyfill for environments that do not support it,
197 * e.g., PhantomJS 1.x. Technically, we don't need this anymore
198 * since native bind is now performant enough in most browsers.
199 * But removing it would mean breaking code that was able to run in
200 * PhantomJS 1.x, so this must be kept for backward compatibility.
201 */
202
203 /* istanbul ignore next */
204 function polyfillBind (fn, ctx) {
205 function boundFn (a) {
206 var l = arguments.length;
207 return l
208 ? l > 1
209 ? fn.apply(ctx, arguments)
210 : fn.call(ctx, a)
211 : fn.call(ctx)
212 }
213
214 boundFn._length = fn.length;
215 return boundFn
216 }
217
218 function nativeBind (fn, ctx) {
219 return fn.bind(ctx)
220 }
221
222 var bind = Function.prototype.bind
223 ? nativeBind
224 : polyfillBind;
225
226 /**
227 * Convert an Array-like object to a real Array.
228 */
229 function toArray (list, start) {
230 start = start || 0;
231 var i = list.length - start;
232 var ret = new Array(i);
233 while (i--) {
234 ret[i] = list[i + start];
235 }
236 return ret
237 }
238
239 /**
240 * Mix properties into target object.
241 */
242 function extend (to, _from) {
243 for (var key in _from) {
244 to[key] = _from[key];
245 }
246 return to
247 }
248
249 /**
250 * Merge an Array of Objects into a single Object.
251 */
252 function toObject (arr) {
253 var res = {};
254 for (var i = 0; i < arr.length; i++) {
255 if (arr[i]) {
256 extend(res, arr[i]);
257 }
258 }
259 return res
260 }
261
262 /* eslint-disable no-unused-vars */
263
264 /**
265 * Perform no operation.
266 * Stubbing args to make Flow happy without leaving useless transpiled code
267 * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
268 */
269 function noop (a, b, c) {}
270
271 /**
272 * Always return false.
273 */
274 var no = function (a, b, c) { return false; };
275
276 /* eslint-enable no-unused-vars */
277
278 /**
279 * Return the same value.
280 */
281 var identity = function (_) { return _; };
282
283 /**
284 * Check if two values are loosely equal - that is,
285 * if they are plain objects, do they have the same shape?
286 */
287 function looseEqual (a, b) {
288 if (a === b) { return true }
289 var isObjectA = isObject(a);
290 var isObjectB = isObject(b);
291 if (isObjectA && isObjectB) {
292 try {
293 var isArrayA = Array.isArray(a);
294 var isArrayB = Array.isArray(b);
295 if (isArrayA && isArrayB) {
296 return a.length === b.length && a.every(function (e, i) {
297 return looseEqual(e, b[i])
298 })
299 } else if (a instanceof Date && b instanceof Date) {
300 return a.getTime() === b.getTime()
301 } else if (!isArrayA && !isArrayB) {
302 var keysA = Object.keys(a);
303 var keysB = Object.keys(b);
304 return keysA.length === keysB.length && keysA.every(function (key) {
305 return looseEqual(a[key], b[key])
306 })
307 } else {
308 /* istanbul ignore next */
309 return false
310 }
311 } catch (e) {
312 /* istanbul ignore next */
313 return false
314 }
315 } else if (!isObjectA && !isObjectB) {
316 return String(a) === String(b)
317 } else {
318 return false
319 }
320 }
321
322 /**
323 * Return the first index at which a loosely equal value can be
324 * found in the array (if value is a plain object, the array must
325 * contain an object of the same shape), or -1 if it is not present.
326 */
327 function looseIndexOf (arr, val) {
328 for (var i = 0; i < arr.length; i++) {
329 if (looseEqual(arr[i], val)) { return i }
330 }
331 return -1
332 }
333
334 /**
335 * Ensure a function is called only once.
336 */
337 function once (fn) {
338 var called = false;
339 return function () {
340 if (!called) {
341 called = true;
342 fn.apply(this, arguments);
343 }
344 }
345 }
346
347 var SSR_ATTR = 'data-server-rendered';
348
349 var ASSET_TYPES = [
350 'component',
351 'directive',
352 'filter'
353 ];
354
355 var LIFECYCLE_HOOKS = [
356 'beforeCreate',
357 'created',
358 'beforeMount',
359 'mounted',
360 'beforeUpdate',
361 'updated',
362 'beforeDestroy',
363 'destroyed',
364 'activated',
365 'deactivated',
366 'errorCaptured',
367 'serverPrefetch'
368 ];
369
370 /* */
371
372
373
374 var config = ({
375 /**
376 * Option merge strategies (used in core/util/options)
377 */
378 // $flow-disable-line
379 optionMergeStrategies: Object.create(null),
380
381 /**
382 * Whether to suppress warnings.
383 */
384 silent: false,
385
386 /**
387 * Show production mode tip message on boot?
388 */
389 productionTip: "development" !== 'production',
390
391 /**
392 * Whether to enable devtools
393 */
394 devtools: "development" !== 'production',
395
396 /**
397 * Whether to record perf
398 */
399 performance: false,
400
401 /**
402 * Error handler for watcher errors
403 */
404 errorHandler: null,
405
406 /**
407 * Warn handler for watcher warns
408 */
409 warnHandler: null,
410
411 /**
412 * Ignore certain custom elements
413 */
414 ignoredElements: [],
415
416 /**
417 * Custom user key aliases for v-on
418 */
419 // $flow-disable-line
420 keyCodes: Object.create(null),
421
422 /**
423 * Check if a tag is reserved so that it cannot be registered as a
424 * component. This is platform-dependent and may be overwritten.
425 */
426 isReservedTag: no,
427
428 /**
429 * Check if an attribute is reserved so that it cannot be used as a component
430 * prop. This is platform-dependent and may be overwritten.
431 */
432 isReservedAttr: no,
433
434 /**
435 * Check if a tag is an unknown element.
436 * Platform-dependent.
437 */
438 isUnknownElement: no,
439
440 /**
441 * Get the namespace of an element
442 */
443 getTagNamespace: noop,
444
445 /**
446 * Parse the real tag name for the specific platform.
447 */
448 parsePlatformTagName: identity,
449
450 /**
451 * Check if an attribute must be bound using property, e.g. value
452 * Platform-dependent.
453 */
454 mustUseProp: no,
455
456 /**
457 * Perform updates asynchronously. Intended to be used by Vue Test Utils
458 * This will significantly reduce performance if set to false.
459 */
460 async: true,
461
462 /**
463 * Exposed for legacy reasons
464 */
465 _lifecycleHooks: LIFECYCLE_HOOKS
466 });
467
468 /* */
469
470 /**
471 * unicode letters used for parsing html tags, component names and property paths.
472 * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
473 * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
474 */
475 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/;
476
477 /**
478 * Check if a string starts with $ or _
479 */
480 function isReserved (str) {
481 var c = (str + '').charCodeAt(0);
482 return c === 0x24 || c === 0x5F
483 }
484
485 /**
486 * Define a property.
487 */
488 function def (obj, key, val, enumerable) {
489 Object.defineProperty(obj, key, {
490 value: val,
491 enumerable: !!enumerable,
492 writable: true,
493 configurable: true
494 });
495 }
496
497 /**
498 * Parse simple path.
499 */
500 var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
501 function parsePath (path) {
502 if (bailRE.test(path)) {
503 return
504 }
505 var segments = path.split('.');
506 return function (obj) {
507 for (var i = 0; i < segments.length; i++) {
508 if (!obj) { return }
509 obj = obj[segments[i]];
510 }
511 return obj
512 }
513 }
514
515 /* */
516
517 // can we use __proto__?
518 var hasProto = '__proto__' in {};
519
520 // Browser environment sniffing
521 var inBrowser = typeof window !== 'undefined';
522 var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
523 var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
524 var UA = inBrowser && window.navigator.userAgent.toLowerCase();
525 var isIE = UA && /msie|trident/.test(UA);
526 var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
527 var isEdge = UA && UA.indexOf('edge/') > 0;
528 var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
529 var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
530 var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
531 var isPhantomJS = UA && /phantomjs/.test(UA);
532 var isFF = UA && UA.match(/firefox\/(\d+)/);
533
534 // Firefox has a "watch" function on Object.prototype...
535 var nativeWatch = ({}).watch;
536
537 var supportsPassive = false;
538 if (inBrowser) {
539 try {
540 var opts = {};
541 Object.defineProperty(opts, 'passive', ({
542 get: function get () {
543 /* istanbul ignore next */
544 supportsPassive = true;
545 }
546 })); // https://github.com/facebook/flow/issues/285
547 window.addEventListener('test-passive', null, opts);
548 } catch (e) {}
549 }
550
551 // this needs to be lazy-evaled because vue may be required before
552 // vue-server-renderer can set VUE_ENV
553 var _isServer;
554 var isServerRendering = function () {
555 if (_isServer === undefined) {
556 /* istanbul ignore if */
557 if (!inBrowser && !inWeex && typeof global !== 'undefined') {
558 // detect presence of vue-server-renderer and avoid
559 // Webpack shimming the process
560 _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
561 } else {
562 _isServer = false;
563 }
564 }
565 return _isServer
566 };
567
568 // detect devtools
569 var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
570
571 /* istanbul ignore next */
572 function isNative (Ctor) {
573 return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
574 }
575
576 var hasSymbol =
577 typeof Symbol !== 'undefined' && isNative(Symbol) &&
578 typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
579
580 var _Set;
581 /* istanbul ignore if */ // $flow-disable-line
582 if (typeof Set !== 'undefined' && isNative(Set)) {
583 // use native Set when available.
584 _Set = Set;
585 } else {
586 // a non-standard Set polyfill that only works with primitive keys.
587 _Set = /*@__PURE__*/(function () {
588 function Set () {
589 this.set = Object.create(null);
590 }
591 Set.prototype.has = function has (key) {
592 return this.set[key] === true
593 };
594 Set.prototype.add = function add (key) {
595 this.set[key] = true;
596 };
597 Set.prototype.clear = function clear () {
598 this.set = Object.create(null);
599 };
600
601 return Set;
602 }());
603 }
604
605 /* */
606
607 var warn = noop;
608 var tip = noop;
609 var generateComponentTrace = (noop); // work around flow check
610 var formatComponentName = (noop);
611
612 {
613 var hasConsole = typeof console !== 'undefined';
614 var classifyRE = /(?:^|[-_])(\w)/g;
615 var classify = function (str) { return str
616 .replace(classifyRE, function (c) { return c.toUpperCase(); })
617 .replace(/[-_]/g, ''); };
618
619 warn = function (msg, vm) {
620 var trace = vm ? generateComponentTrace(vm) : '';
621
622 if (config.warnHandler) {
623 config.warnHandler.call(null, msg, vm, trace);
624 } else if (hasConsole && (!config.silent)) {
625 console.error(("[Vue warn]: " + msg + trace));
626 }
627 };
628
629 tip = function (msg, vm) {
630 if (hasConsole && (!config.silent)) {
631 console.warn("[Vue tip]: " + msg + (
632 vm ? generateComponentTrace(vm) : ''
633 ));
634 }
635 };
636
637 formatComponentName = function (vm, includeFile) {
638 if (vm.$root === vm) {
639 return '<Root>'
640 }
641 var options = typeof vm === 'function' && vm.cid != null
642 ? vm.options
643 : vm._isVue
644 ? vm.$options || vm.constructor.options
645 : vm;
646 var name = options.name || options._componentTag;
647 var file = options.__file;
648 if (!name && file) {
649 var match = file.match(/([^/\\]+)\.vue$/);
650 name = match && match[1];
651 }
652
653 return (
654 (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
655 (file && includeFile !== false ? (" at " + file) : '')
656 )
657 };
658
659 var repeat = function (str, n) {
660 var res = '';
661 while (n) {
662 if (n % 2 === 1) { res += str; }
663 if (n > 1) { str += str; }
664 n >>= 1;
665 }
666 return res
667 };
668
669 generateComponentTrace = function (vm) {
670 if (vm._isVue && vm.$parent) {
671 var tree = [];
672 var currentRecursiveSequence = 0;
673 while (vm) {
674 if (tree.length > 0) {
675 var last = tree[tree.length - 1];
676 if (last.constructor === vm.constructor) {
677 currentRecursiveSequence++;
678 vm = vm.$parent;
679 continue
680 } else if (currentRecursiveSequence > 0) {
681 tree[tree.length - 1] = [last, currentRecursiveSequence];
682 currentRecursiveSequence = 0;
683 }
684 }
685 tree.push(vm);
686 vm = vm.$parent;
687 }
688 return '\n\nfound in\n\n' + tree
689 .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
690 ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
691 : formatComponentName(vm))); })
692 .join('\n')
693 } else {
694 return ("\n\n(found in " + (formatComponentName(vm)) + ")")
695 }
696 };
697 }
698
699 /* */
700
701 var uid = 0;
702
703 /**
704 * A dep is an observable that can have multiple
705 * directives subscribing to it.
706 */
707 var Dep = function Dep () {
708 this.id = uid++;
709 this.subs = [];
710 };
711
712 Dep.prototype.addSub = function addSub (sub) {
713 this.subs.push(sub);
714 };
715
716 Dep.prototype.removeSub = function removeSub (sub) {
717 remove(this.subs, sub);
718 };
719
720 Dep.prototype.depend = function depend () {
721 if (Dep.target) {
722 Dep.target.addDep(this);
723 }
724 };
725
726 Dep.prototype.notify = function notify () {
727 // stabilize the subscriber list first
728 var subs = this.subs.slice();
729 if (!config.async) {
730 // subs aren't sorted in scheduler if not running async
731 // we need to sort them now to make sure they fire in correct
732 // order
733 subs.sort(function (a, b) { return a.id - b.id; });
734 }
735 for (var i = 0, l = subs.length; i < l; i++) {
736 subs[i].update();
737 }
738 };
739
740 // The current target watcher being evaluated.
741 // This is globally unique because only one watcher
742 // can be evaluated at a time.
743 Dep.target = null;
744 var targetStack = [];
745
746 function pushTarget (target) {
747 targetStack.push(target);
748 Dep.target = target;
749 }
750
751 function popTarget () {
752 targetStack.pop();
753 Dep.target = targetStack[targetStack.length - 1];
754 }
755
756 /* */
757
758 var VNode = function VNode (
759 tag,
760 data,
761 children,
762 text,
763 elm,
764 context,
765 componentOptions,
766 asyncFactory
767 ) {
768 this.tag = tag;
769 this.data = data;
770 this.children = children;
771 this.text = text;
772 this.elm = elm;
773 this.ns = undefined;
774 this.context = context;
775 this.fnContext = undefined;
776 this.fnOptions = undefined;
777 this.fnScopeId = undefined;
778 this.key = data && data.key;
779 this.componentOptions = componentOptions;
780 this.componentInstance = undefined;
781 this.parent = undefined;
782 this.raw = false;
783 this.isStatic = false;
784 this.isRootInsert = true;
785 this.isComment = false;
786 this.isCloned = false;
787 this.isOnce = false;
788 this.asyncFactory = asyncFactory;
789 this.asyncMeta = undefined;
790 this.isAsyncPlaceholder = false;
791 };
792
793 var prototypeAccessors = { child: { configurable: true } };
794
795 // DEPRECATED: alias for componentInstance for backwards compat.
796 /* istanbul ignore next */
797 prototypeAccessors.child.get = function () {
798 return this.componentInstance
799 };
800
801 Object.defineProperties( VNode.prototype, prototypeAccessors );
802
803 var createEmptyVNode = function (text) {
804 if ( text === void 0 ) text = '';
805
806 var node = new VNode();
807 node.text = text;
808 node.isComment = true;
809 return node
810 };
811
812 function createTextVNode (val) {
813 return new VNode(undefined, undefined, undefined, String(val))
814 }
815
816 // optimized shallow clone
817 // used for static nodes and slot nodes because they may be reused across
818 // multiple renders, cloning them avoids errors when DOM manipulations rely
819 // on their elm reference.
820 function cloneVNode (vnode) {
821 var cloned = new VNode(
822 vnode.tag,
823 vnode.data,
824 // #7975
825 // clone children array to avoid mutating original in case of cloning
826 // a child.
827 vnode.children && vnode.children.slice(),
828 vnode.text,
829 vnode.elm,
830 vnode.context,
831 vnode.componentOptions,
832 vnode.asyncFactory
833 );
834 cloned.ns = vnode.ns;
835 cloned.isStatic = vnode.isStatic;
836 cloned.key = vnode.key;
837 cloned.isComment = vnode.isComment;
838 cloned.fnContext = vnode.fnContext;
839 cloned.fnOptions = vnode.fnOptions;
840 cloned.fnScopeId = vnode.fnScopeId;
841 cloned.asyncMeta = vnode.asyncMeta;
842 cloned.isCloned = true;
843 return cloned
844 }
845
846 /*
847 * not type checking this file because flow doesn't play well with
848 * dynamically accessing methods on Array prototype
849 */
850
851 var arrayProto = Array.prototype;
852 var arrayMethods = Object.create(arrayProto);
853
854 var methodsToPatch = [
855 'push',
856 'pop',
857 'shift',
858 'unshift',
859 'splice',
860 'sort',
861 'reverse'
862 ];
863
864 /**
865 * Intercept mutating methods and emit events
866 */
867 methodsToPatch.forEach(function (method) {
868 // cache original method
869 var original = arrayProto[method];
870 def(arrayMethods, method, function mutator () {
871 var args = [], len = arguments.length;
872 while ( len-- ) args[ len ] = arguments[ len ];
873
874 var result = original.apply(this, args);
875 var ob = this.__ob__;
876 var inserted;
877 switch (method) {
878 case 'push':
879 case 'unshift':
880 inserted = args;
881 break
882 case 'splice':
883 inserted = args.slice(2);
884 break
885 }
886 if (inserted) { ob.observeArray(inserted); }
887 // notify change
888 ob.dep.notify();
889 return result
890 });
891 });
892
893 /* */
894
895 var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
896
897 /**
898 * In some cases we may want to disable observation inside a component's
899 * update computation.
900 */
901 var shouldObserve = true;
902
903 function toggleObserving (value) {
904 shouldObserve = value;
905 }
906
907 /**
908 * Observer class that is attached to each observed
909 * object. Once attached, the observer converts the target
910 * object's property keys into getter/setters that
911 * collect dependencies and dispatch updates.
912 */
913 var Observer = function Observer (value) {
914 this.value = value;
915 this.dep = new Dep();
916 this.vmCount = 0;
917 def(value, '__ob__', this);
918 if (Array.isArray(value)) {
919 if (hasProto) {
920 protoAugment(value, arrayMethods);
921 } else {
922 copyAugment(value, arrayMethods, arrayKeys);
923 }
924 this.observeArray(value);
925 } else {
926 this.walk(value);
927 }
928 };
929
930 /**
931 * Walk through all properties and convert them into
932 * getter/setters. This method should only be called when
933 * value type is Object.
934 */
935 Observer.prototype.walk = function walk (obj) {
936 var keys = Object.keys(obj);
937 for (var i = 0; i < keys.length; i++) {
938 defineReactive$$1(obj, keys[i]);
939 }
940 };
941
942 /**
943 * Observe a list of Array items.
944 */
945 Observer.prototype.observeArray = function observeArray (items) {
946 for (var i = 0, l = items.length; i < l; i++) {
947 observe(items[i]);
948 }
949 };
950
951 // helpers
952
953 /**
954 * Augment a target Object or Array by intercepting
955 * the prototype chain using __proto__
956 */
957 function protoAugment (target, src) {
958 /* eslint-disable no-proto */
959 target.__proto__ = src;
960 /* eslint-enable no-proto */
961 }
962
963 /**
964 * Augment a target Object or Array by defining
965 * hidden properties.
966 */
967 /* istanbul ignore next */
968 function copyAugment (target, src, keys) {
969 for (var i = 0, l = keys.length; i < l; i++) {
970 var key = keys[i];
971 def(target, key, src[key]);
972 }
973 }
974
975 /**
976 * Attempt to create an observer instance for a value,
977 * returns the new observer if successfully observed,
978 * or the existing observer if the value already has one.
979 */
980 function observe (value, asRootData) {
981 if (!isObject(value) || value instanceof VNode) {
982 return
983 }
984 var ob;
985 if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
986 ob = value.__ob__;
987 } else if (
988 shouldObserve &&
989 !isServerRendering() &&
990 (Array.isArray(value) || isPlainObject(value)) &&
991 Object.isExtensible(value) &&
992 !value._isVue
993 ) {
994 ob = new Observer(value);
995 }
996 if (asRootData && ob) {
997 ob.vmCount++;
998 }
999 return ob
1000 }
1001
1002 /**
1003 * Define a reactive property on an Object.
1004 */
1005 function defineReactive$$1 (
1006 obj,
1007 key,
1008 val,
1009 customSetter,
1010 shallow
1011 ) {
1012 var dep = new Dep();
1013
1014 var property = Object.getOwnPropertyDescriptor(obj, key);
1015 if (property && property.configurable === false) {
1016 return
1017 }
1018
1019 // cater for pre-defined getter/setters
1020 var getter = property && property.get;
1021 var setter = property && property.set;
1022 if ((!getter || setter) && arguments.length === 2) {
1023 val = obj[key];
1024 }
1025
1026 var childOb = !shallow && observe(val);
1027 Object.defineProperty(obj, key, {
1028 enumerable: true,
1029 configurable: true,
1030 get: function reactiveGetter () {
1031 var value = getter ? getter.call(obj) : val;
1032 if (Dep.target) {
1033 dep.depend();
1034 if (childOb) {
1035 childOb.dep.depend();
1036 if (Array.isArray(value)) {
1037 dependArray(value);
1038 }
1039 }
1040 }
1041 return value
1042 },
1043 set: function reactiveSetter (newVal) {
1044 var value = getter ? getter.call(obj) : val;
1045 /* eslint-disable no-self-compare */
1046 if (newVal === value || (newVal !== newVal && value !== value)) {
1047 return
1048 }
1049 /* eslint-enable no-self-compare */
1050 if (customSetter) {
1051 customSetter();
1052 }
1053 // #7981: for accessor properties without setter
1054 if (getter && !setter) { return }
1055 if (setter) {
1056 setter.call(obj, newVal);
1057 } else {
1058 val = newVal;
1059 }
1060 childOb = !shallow && observe(newVal);
1061 dep.notify();
1062 }
1063 });
1064 }
1065
1066 /**
1067 * Set a property on an object. Adds the new property and
1068 * triggers change notification if the property doesn't
1069 * already exist.
1070 */
1071 function set (target, key, val) {
1072 if (isUndef(target) || isPrimitive(target)
1073 ) {
1074 warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
1075 }
1076 if (Array.isArray(target) && isValidArrayIndex(key)) {
1077 target.length = Math.max(target.length, key);
1078 target.splice(key, 1, val);
1079 return val
1080 }
1081 if (key in target && !(key in Object.prototype)) {
1082 target[key] = val;
1083 return val
1084 }
1085 var ob = (target).__ob__;
1086 if (target._isVue || (ob && ob.vmCount)) {
1087 warn(
1088 'Avoid adding reactive properties to a Vue instance or its root $data ' +
1089 'at runtime - declare it upfront in the data option.'
1090 );
1091 return val
1092 }
1093 if (!ob) {
1094 target[key] = val;
1095 return val
1096 }
1097 defineReactive$$1(ob.value, key, val);
1098 ob.dep.notify();
1099 return val
1100 }
1101
1102 /**
1103 * Delete a property and trigger change if necessary.
1104 */
1105 function del (target, key) {
1106 if (isUndef(target) || isPrimitive(target)
1107 ) {
1108 warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
1109 }
1110 if (Array.isArray(target) && isValidArrayIndex(key)) {
1111 target.splice(key, 1);
1112 return
1113 }
1114 var ob = (target).__ob__;
1115 if (target._isVue || (ob && ob.vmCount)) {
1116 warn(
1117 'Avoid deleting properties on a Vue instance or its root $data ' +
1118 '- just set it to null.'
1119 );
1120 return
1121 }
1122 if (!hasOwn(target, key)) {
1123 return
1124 }
1125 delete target[key];
1126 if (!ob) {
1127 return
1128 }
1129 ob.dep.notify();
1130 }
1131
1132 /**
1133 * Collect dependencies on array elements when the array is touched, since
1134 * we cannot intercept array element access like property getters.
1135 */
1136 function dependArray (value) {
1137 for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
1138 e = value[i];
1139 e && e.__ob__ && e.__ob__.dep.depend();
1140 if (Array.isArray(e)) {
1141 dependArray(e);
1142 }
1143 }
1144 }
1145
1146 /* */
1147
1148 /**
1149 * Option overwriting strategies are functions that handle
1150 * how to merge a parent option value and a child option
1151 * value into the final value.
1152 */
1153 var strats = config.optionMergeStrategies;
1154
1155 /**
1156 * Options with restrictions
1157 */
1158 {
1159 strats.el = strats.propsData = function (parent, child, vm, key) {
1160 if (!vm) {
1161 warn(
1162 "option \"" + key + "\" can only be used during instance " +
1163 'creation with the `new` keyword.'
1164 );
1165 }
1166 return defaultStrat(parent, child)
1167 };
1168 }
1169
1170 /**
1171 * Helper that recursively merges two data objects together.
1172 */
1173 function mergeData (to, from) {
1174 if (!from) { return to }
1175 var key, toVal, fromVal;
1176
1177 var keys = hasSymbol
1178 ? Reflect.ownKeys(from)
1179 : Object.keys(from);
1180
1181 for (var i = 0; i < keys.length; i++) {
1182 key = keys[i];
1183 // in case the object is already observed...
1184 if (key === '__ob__') { continue }
1185 toVal = to[key];
1186 fromVal = from[key];
1187 if (!hasOwn(to, key)) {
1188 set(to, key, fromVal);
1189 } else if (
1190 toVal !== fromVal &&
1191 isPlainObject(toVal) &&
1192 isPlainObject(fromVal)
1193 ) {
1194 mergeData(toVal, fromVal);
1195 }
1196 }
1197 return to
1198 }
1199
1200 /**
1201 * Data
1202 */
1203 function mergeDataOrFn (
1204 parentVal,
1205 childVal,
1206 vm
1207 ) {
1208 if (!vm) {
1209 // in a Vue.extend merge, both should be functions
1210 if (!childVal) {
1211 return parentVal
1212 }
1213 if (!parentVal) {
1214 return childVal
1215 }
1216 // when parentVal & childVal are both present,
1217 // we need to return a function that returns the
1218 // merged result of both functions... no need to
1219 // check if parentVal is a function here because
1220 // it has to be a function to pass previous merges.
1221 return function mergedDataFn () {
1222 return mergeData(
1223 typeof childVal === 'function' ? childVal.call(this, this) : childVal,
1224 typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
1225 )
1226 }
1227 } else {
1228 return function mergedInstanceDataFn () {
1229 // instance merge
1230 var instanceData = typeof childVal === 'function'
1231 ? childVal.call(vm, vm)
1232 : childVal;
1233 var defaultData = typeof parentVal === 'function'
1234 ? parentVal.call(vm, vm)
1235 : parentVal;
1236 if (instanceData) {
1237 return mergeData(instanceData, defaultData)
1238 } else {
1239 return defaultData
1240 }
1241 }
1242 }
1243 }
1244
1245 strats.data = function (
1246 parentVal,
1247 childVal,
1248 vm
1249 ) {
1250 if (!vm) {
1251 if (childVal && typeof childVal !== 'function') {
1252 warn(
1253 'The "data" option should be a function ' +
1254 'that returns a per-instance value in component ' +
1255 'definitions.',
1256 vm
1257 );
1258
1259 return parentVal
1260 }
1261 return mergeDataOrFn(parentVal, childVal)
1262 }
1263
1264 return mergeDataOrFn(parentVal, childVal, vm)
1265 };
1266
1267 /**
1268 * Hooks and props are merged as arrays.
1269 */
1270 function mergeHook (
1271 parentVal,
1272 childVal
1273 ) {
1274 var res = childVal
1275 ? parentVal
1276 ? parentVal.concat(childVal)
1277 : Array.isArray(childVal)
1278 ? childVal
1279 : [childVal]
1280 : parentVal;
1281 return res
1282 ? dedupeHooks(res)
1283 : res
1284 }
1285
1286 function dedupeHooks (hooks) {
1287 var res = [];
1288 for (var i = 0; i < hooks.length; i++) {
1289 if (res.indexOf(hooks[i]) === -1) {
1290 res.push(hooks[i]);
1291 }
1292 }
1293 return res
1294 }
1295
1296 LIFECYCLE_HOOKS.forEach(function (hook) {
1297 strats[hook] = mergeHook;
1298 });
1299
1300 /**
1301 * Assets
1302 *
1303 * When a vm is present (instance creation), we need to do
1304 * a three-way merge between constructor options, instance
1305 * options and parent options.
1306 */
1307 function mergeAssets (
1308 parentVal,
1309 childVal,
1310 vm,
1311 key
1312 ) {
1313 var res = Object.create(parentVal || null);
1314 if (childVal) {
1315 assertObjectType(key, childVal, vm);
1316 return extend(res, childVal)
1317 } else {
1318 return res
1319 }
1320 }
1321
1322 ASSET_TYPES.forEach(function (type) {
1323 strats[type + 's'] = mergeAssets;
1324 });
1325
1326 /**
1327 * Watchers.
1328 *
1329 * Watchers hashes should not overwrite one
1330 * another, so we merge them as arrays.
1331 */
1332 strats.watch = function (
1333 parentVal,
1334 childVal,
1335 vm,
1336 key
1337 ) {
1338 // work around Firefox's Object.prototype.watch...
1339 if (parentVal === nativeWatch) { parentVal = undefined; }
1340 if (childVal === nativeWatch) { childVal = undefined; }
1341 /* istanbul ignore if */
1342 if (!childVal) { return Object.create(parentVal || null) }
1343 {
1344 assertObjectType(key, childVal, vm);
1345 }
1346 if (!parentVal) { return childVal }
1347 var ret = {};
1348 extend(ret, parentVal);
1349 for (var key$1 in childVal) {
1350 var parent = ret[key$1];
1351 var child = childVal[key$1];
1352 if (parent && !Array.isArray(parent)) {
1353 parent = [parent];
1354 }
1355 ret[key$1] = parent
1356 ? parent.concat(child)
1357 : Array.isArray(child) ? child : [child];
1358 }
1359 return ret
1360 };
1361
1362 /**
1363 * Other object hashes.
1364 */
1365 strats.props =
1366 strats.methods =
1367 strats.inject =
1368 strats.computed = function (
1369 parentVal,
1370 childVal,
1371 vm,
1372 key
1373 ) {
1374 if (childVal && "development" !== 'production') {
1375 assertObjectType(key, childVal, vm);
1376 }
1377 if (!parentVal) { return childVal }
1378 var ret = Object.create(null);
1379 extend(ret, parentVal);
1380 if (childVal) { extend(ret, childVal); }
1381 return ret
1382 };
1383 strats.provide = mergeDataOrFn;
1384
1385 /**
1386 * Default strategy.
1387 */
1388 var defaultStrat = function (parentVal, childVal) {
1389 return childVal === undefined
1390 ? parentVal
1391 : childVal
1392 };
1393
1394 /**
1395 * Validate component names
1396 */
1397 function checkComponents (options) {
1398 for (var key in options.components) {
1399 validateComponentName(key);
1400 }
1401 }
1402
1403 function validateComponentName (name) {
1404 if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
1405 warn(
1406 'Invalid component name: "' + name + '". Component names ' +
1407 'should conform to valid custom element name in html5 specification.'
1408 );
1409 }
1410 if (isBuiltInTag(name) || config.isReservedTag(name)) {
1411 warn(
1412 'Do not use built-in or reserved HTML elements as component ' +
1413 'id: ' + name
1414 );
1415 }
1416 }
1417
1418 /**
1419 * Ensure all props option syntax are normalized into the
1420 * Object-based format.
1421 */
1422 function normalizeProps (options, vm) {
1423 var props = options.props;
1424 if (!props) { return }
1425 var res = {};
1426 var i, val, name;
1427 if (Array.isArray(props)) {
1428 i = props.length;
1429 while (i--) {
1430 val = props[i];
1431 if (typeof val === 'string') {
1432 name = camelize(val);
1433 res[name] = { type: null };
1434 } else {
1435 warn('props must be strings when using array syntax.');
1436 }
1437 }
1438 } else if (isPlainObject(props)) {
1439 for (var key in props) {
1440 val = props[key];
1441 name = camelize(key);
1442 res[name] = isPlainObject(val)
1443 ? val
1444 : { type: val };
1445 }
1446 } else {
1447 warn(
1448 "Invalid value for option \"props\": expected an Array or an Object, " +
1449 "but got " + (toRawType(props)) + ".",
1450 vm
1451 );
1452 }
1453 options.props = res;
1454 }
1455
1456 /**
1457 * Normalize all injections into Object-based format
1458 */
1459 function normalizeInject (options, vm) {
1460 var inject = options.inject;
1461 if (!inject) { return }
1462 var normalized = options.inject = {};
1463 if (Array.isArray(inject)) {
1464 for (var i = 0; i < inject.length; i++) {
1465 normalized[inject[i]] = { from: inject[i] };
1466 }
1467 } else if (isPlainObject(inject)) {
1468 for (var key in inject) {
1469 var val = inject[key];
1470 normalized[key] = isPlainObject(val)
1471 ? extend({ from: key }, val)
1472 : { from: val };
1473 }
1474 } else {
1475 warn(
1476 "Invalid value for option \"inject\": expected an Array or an Object, " +
1477 "but got " + (toRawType(inject)) + ".",
1478 vm
1479 );
1480 }
1481 }
1482
1483 /**
1484 * Normalize raw function directives into object format.
1485 */
1486 function normalizeDirectives (options) {
1487 var dirs = options.directives;
1488 if (dirs) {
1489 for (var key in dirs) {
1490 var def$$1 = dirs[key];
1491 if (typeof def$$1 === 'function') {
1492 dirs[key] = { bind: def$$1, update: def$$1 };
1493 }
1494 }
1495 }
1496 }
1497
1498 function assertObjectType (name, value, vm) {
1499 if (!isPlainObject(value)) {
1500 warn(
1501 "Invalid value for option \"" + name + "\": expected an Object, " +
1502 "but got " + (toRawType(value)) + ".",
1503 vm
1504 );
1505 }
1506 }
1507
1508 /**
1509 * Merge two option objects into a new one.
1510 * Core utility used in both instantiation and inheritance.
1511 */
1512 function mergeOptions (
1513 parent,
1514 child,
1515 vm
1516 ) {
1517 {
1518 checkComponents(child);
1519 }
1520
1521 if (typeof child === 'function') {
1522 child = child.options;
1523 }
1524
1525 normalizeProps(child, vm);
1526 normalizeInject(child, vm);
1527 normalizeDirectives(child);
1528
1529 // Apply extends and mixins on the child options,
1530 // but only if it is a raw options object that isn't
1531 // the result of another mergeOptions call.
1532 // Only merged options has the _base property.
1533 if (!child._base) {
1534 if (child.extends) {
1535 parent = mergeOptions(parent, child.extends, vm);
1536 }
1537 if (child.mixins) {
1538 for (var i = 0, l = child.mixins.length; i < l; i++) {
1539 parent = mergeOptions(parent, child.mixins[i], vm);
1540 }
1541 }
1542 }
1543
1544 var options = {};
1545 var key;
1546 for (key in parent) {
1547 mergeField(key);
1548 }
1549 for (key in child) {
1550 if (!hasOwn(parent, key)) {
1551 mergeField(key);
1552 }
1553 }
1554 function mergeField (key) {
1555 var strat = strats[key] || defaultStrat;
1556 options[key] = strat(parent[key], child[key], vm, key);
1557 }
1558 return options
1559 }
1560
1561 /**
1562 * Resolve an asset.
1563 * This function is used because child instances need access
1564 * to assets defined in its ancestor chain.
1565 */
1566 function resolveAsset (
1567 options,
1568 type,
1569 id,
1570 warnMissing
1571 ) {
1572 /* istanbul ignore if */
1573 if (typeof id !== 'string') {
1574 return
1575 }
1576 var assets = options[type];
1577 // check local registration variations first
1578 if (hasOwn(assets, id)) { return assets[id] }
1579 var camelizedId = camelize(id);
1580 if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
1581 var PascalCaseId = capitalize(camelizedId);
1582 if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
1583 // fallback to prototype chain
1584 var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
1585 if (warnMissing && !res) {
1586 warn(
1587 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
1588 options
1589 );
1590 }
1591 return res
1592 }
1593
1594 /* */
1595
1596
1597
1598 function validateProp (
1599 key,
1600 propOptions,
1601 propsData,
1602 vm
1603 ) {
1604 var prop = propOptions[key];
1605 var absent = !hasOwn(propsData, key);
1606 var value = propsData[key];
1607 // boolean casting
1608 var booleanIndex = getTypeIndex(Boolean, prop.type);
1609 if (booleanIndex > -1) {
1610 if (absent && !hasOwn(prop, 'default')) {
1611 value = false;
1612 } else if (value === '' || value === hyphenate(key)) {
1613 // only cast empty string / same name to boolean if
1614 // boolean has higher priority
1615 var stringIndex = getTypeIndex(String, prop.type);
1616 if (stringIndex < 0 || booleanIndex < stringIndex) {
1617 value = true;
1618 }
1619 }
1620 }
1621 // check default value
1622 if (value === undefined) {
1623 value = getPropDefaultValue(vm, prop, key);
1624 // since the default value is a fresh copy,
1625 // make sure to observe it.
1626 var prevShouldObserve = shouldObserve;
1627 toggleObserving(true);
1628 observe(value);
1629 toggleObserving(prevShouldObserve);
1630 }
1631 {
1632 assertProp(prop, key, value, vm, absent);
1633 }
1634 return value
1635 }
1636
1637 /**
1638 * Get the default value of a prop.
1639 */
1640 function getPropDefaultValue (vm, prop, key) {
1641 // no default, return undefined
1642 if (!hasOwn(prop, 'default')) {
1643 return undefined
1644 }
1645 var def = prop.default;
1646 // warn against non-factory defaults for Object & Array
1647 if (isObject(def)) {
1648 warn(
1649 'Invalid default value for prop "' + key + '": ' +
1650 'Props with type Object/Array must use a factory function ' +
1651 'to return the default value.',
1652 vm
1653 );
1654 }
1655 // the raw prop value was also undefined from previous render,
1656 // return previous default value to avoid unnecessary watcher trigger
1657 if (vm && vm.$options.propsData &&
1658 vm.$options.propsData[key] === undefined &&
1659 vm._props[key] !== undefined
1660 ) {
1661 return vm._props[key]
1662 }
1663 // call factory function for non-Function types
1664 // a value is Function if its prototype is function even across different execution context
1665 return typeof def === 'function' && getType(prop.type) !== 'Function'
1666 ? def.call(vm)
1667 : def
1668 }
1669
1670 /**
1671 * Assert whether a prop is valid.
1672 */
1673 function assertProp (
1674 prop,
1675 name,
1676 value,
1677 vm,
1678 absent
1679 ) {
1680 if (prop.required && absent) {
1681 warn(
1682 'Missing required prop: "' + name + '"',
1683 vm
1684 );
1685 return
1686 }
1687 if (value == null && !prop.required) {
1688 return
1689 }
1690 var type = prop.type;
1691 var valid = !type || type === true;
1692 var expectedTypes = [];
1693 if (type) {
1694 if (!Array.isArray(type)) {
1695 type = [type];
1696 }
1697 for (var i = 0; i < type.length && !valid; i++) {
1698 var assertedType = assertType(value, type[i], vm);
1699 expectedTypes.push(assertedType.expectedType || '');
1700 valid = assertedType.valid;
1701 }
1702 }
1703
1704 var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
1705 if (!valid && haveExpectedTypes) {
1706 warn(
1707 getInvalidTypeMessage(name, value, expectedTypes),
1708 vm
1709 );
1710 return
1711 }
1712 var validator = prop.validator;
1713 if (validator) {
1714 if (!validator(value)) {
1715 warn(
1716 'Invalid prop: custom validator check failed for prop "' + name + '".',
1717 vm
1718 );
1719 }
1720 }
1721 }
1722
1723 var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
1724
1725 function assertType (value, type, vm) {
1726 var valid;
1727 var expectedType = getType(type);
1728 if (simpleCheckRE.test(expectedType)) {
1729 var t = typeof value;
1730 valid = t === expectedType.toLowerCase();
1731 // for primitive wrapper objects
1732 if (!valid && t === 'object') {
1733 valid = value instanceof type;
1734 }
1735 } else if (expectedType === 'Object') {
1736 valid = isPlainObject(value);
1737 } else if (expectedType === 'Array') {
1738 valid = Array.isArray(value);
1739 } else {
1740 try {
1741 valid = value instanceof type;
1742 } catch (e) {
1743 warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
1744 valid = false;
1745 }
1746 }
1747 return {
1748 valid: valid,
1749 expectedType: expectedType
1750 }
1751 }
1752
1753 var functionTypeCheckRE = /^\s*function (\w+)/;
1754
1755 /**
1756 * Use function string name to check built-in types,
1757 * because a simple equality check will fail when running
1758 * across different vms / iframes.
1759 */
1760 function getType (fn) {
1761 var match = fn && fn.toString().match(functionTypeCheckRE);
1762 return match ? match[1] : ''
1763 }
1764
1765 function isSameType (a, b) {
1766 return getType(a) === getType(b)
1767 }
1768
1769 function getTypeIndex (type, expectedTypes) {
1770 if (!Array.isArray(expectedTypes)) {
1771 return isSameType(expectedTypes, type) ? 0 : -1
1772 }
1773 for (var i = 0, len = expectedTypes.length; i < len; i++) {
1774 if (isSameType(expectedTypes[i], type)) {
1775 return i
1776 }
1777 }
1778 return -1
1779 }
1780
1781 function getInvalidTypeMessage (name, value, expectedTypes) {
1782 var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
1783 " Expected " + (expectedTypes.map(capitalize).join(', '));
1784 var expectedType = expectedTypes[0];
1785 var receivedType = toRawType(value);
1786 // check if we need to specify expected value
1787 if (
1788 expectedTypes.length === 1 &&
1789 isExplicable(expectedType) &&
1790 isExplicable(typeof value) &&
1791 !isBoolean(expectedType, receivedType)
1792 ) {
1793 message += " with value " + (styleValue(value, expectedType));
1794 }
1795 message += ", got " + receivedType + " ";
1796 // check if we need to specify received value
1797 if (isExplicable(receivedType)) {
1798 message += "with value " + (styleValue(value, receivedType)) + ".";
1799 }
1800 return message
1801 }
1802
1803 function styleValue (value, type) {
1804 if (type === 'String') {
1805 return ("\"" + value + "\"")
1806 } else if (type === 'Number') {
1807 return ("" + (Number(value)))
1808 } else {
1809 return ("" + value)
1810 }
1811 }
1812
1813 var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
1814 function isExplicable (value) {
1815 return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; })
1816 }
1817
1818 function isBoolean () {
1819 var args = [], len = arguments.length;
1820 while ( len-- ) args[ len ] = arguments[ len ];
1821
1822 return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
1823 }
1824
1825 /* */
1826
1827 function handleError (err, vm, info) {
1828 // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
1829 // See: https://github.com/vuejs/vuex/issues/1505
1830 pushTarget();
1831 try {
1832 if (vm) {
1833 var cur = vm;
1834 while ((cur = cur.$parent)) {
1835 var hooks = cur.$options.errorCaptured;
1836 if (hooks) {
1837 for (var i = 0; i < hooks.length; i++) {
1838 try {
1839 var capture = hooks[i].call(cur, err, vm, info) === false;
1840 if (capture) { return }
1841 } catch (e) {
1842 globalHandleError(e, cur, 'errorCaptured hook');
1843 }
1844 }
1845 }
1846 }
1847 }
1848 globalHandleError(err, vm, info);
1849 } finally {
1850 popTarget();
1851 }
1852 }
1853
1854 function invokeWithErrorHandling (
1855 handler,
1856 context,
1857 args,
1858 vm,
1859 info
1860 ) {
1861 var res;
1862 try {
1863 res = args ? handler.apply(context, args) : handler.call(context);
1864 if (res && !res._isVue && isPromise(res) && !res._handled) {
1865 res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1866 // issue #9511
1867 // avoid catch triggering multiple times when nested calls
1868 res._handled = true;
1869 }
1870 } catch (e) {
1871 handleError(e, vm, info);
1872 }
1873 return res
1874 }
1875
1876 function globalHandleError (err, vm, info) {
1877 if (config.errorHandler) {
1878 try {
1879 return config.errorHandler.call(null, err, vm, info)
1880 } catch (e) {
1881 // if the user intentionally throws the original error in the handler,
1882 // do not log it twice
1883 if (e !== err) {
1884 logError(e, null, 'config.errorHandler');
1885 }
1886 }
1887 }
1888 logError(err, vm, info);
1889 }
1890
1891 function logError (err, vm, info) {
1892 {
1893 warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
1894 }
1895 /* istanbul ignore else */
1896 if ((inBrowser || inWeex) && typeof console !== 'undefined') {
1897 console.error(err);
1898 } else {
1899 throw err
1900 }
1901 }
1902
1903 /* */
1904
1905 var isUsingMicroTask = false;
1906
1907 var callbacks = [];
1908 var pending = false;
1909
1910 function flushCallbacks () {
1911 pending = false;
1912 var copies = callbacks.slice(0);
1913 callbacks.length = 0;
1914 for (var i = 0; i < copies.length; i++) {
1915 copies[i]();
1916 }
1917 }
1918
1919 // Here we have async deferring wrappers using microtasks.
1920 // In 2.5 we used (macro) tasks (in combination with microtasks).
1921 // However, it has subtle problems when state is changed right before repaint
1922 // (e.g. #6813, out-in transitions).
1923 // Also, using (macro) tasks in event handler would cause some weird behaviors
1924 // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
1925 // So we now use microtasks everywhere, again.
1926 // A major drawback of this tradeoff is that there are some scenarios
1927 // where microtasks have too high a priority and fire in between supposedly
1928 // sequential events (e.g. #4521, #6690, which have workarounds)
1929 // or even between bubbling of the same event (#6566).
1930 var timerFunc;
1931
1932 // The nextTick behavior leverages the microtask queue, which can be accessed
1933 // via either native Promise.then or MutationObserver.
1934 // MutationObserver has wider support, however it is seriously bugged in
1935 // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
1936 // completely stops working after triggering a few times... so, if native
1937 // Promise is available, we will use it:
1938 /* istanbul ignore next, $flow-disable-line */
1939 if (typeof Promise !== 'undefined' && isNative(Promise)) {
1940 var p = Promise.resolve();
1941 timerFunc = function () {
1942 p.then(flushCallbacks);
1943 // In problematic UIWebViews, Promise.then doesn't completely break, but
1944 // it can get stuck in a weird state where callbacks are pushed into the
1945 // microtask queue but the queue isn't being flushed, until the browser
1946 // needs to do some other work, e.g. handle a timer. Therefore we can
1947 // "force" the microtask queue to be flushed by adding an empty timer.
1948 if (isIOS) { setTimeout(noop); }
1949 };
1950 isUsingMicroTask = true;
1951 } else if (!isIE && typeof MutationObserver !== 'undefined' && (
1952 isNative(MutationObserver) ||
1953 // PhantomJS and iOS 7.x
1954 MutationObserver.toString() === '[object MutationObserverConstructor]'
1955 )) {
1956 // Use MutationObserver where native Promise is not available,
1957 // e.g. PhantomJS, iOS7, Android 4.4
1958 // (#6466 MutationObserver is unreliable in IE11)
1959 var counter = 1;
1960 var observer = new MutationObserver(flushCallbacks);
1961 var textNode = document.createTextNode(String(counter));
1962 observer.observe(textNode, {
1963 characterData: true
1964 });
1965 timerFunc = function () {
1966 counter = (counter + 1) % 2;
1967 textNode.data = String(counter);
1968 };
1969 isUsingMicroTask = true;
1970 } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
1971 // Fallback to setImmediate.
1972 // Technically it leverages the (macro) task queue,
1973 // but it is still a better choice than setTimeout.
1974 timerFunc = function () {
1975 setImmediate(flushCallbacks);
1976 };
1977 } else {
1978 // Fallback to setTimeout.
1979 timerFunc = function () {
1980 setTimeout(flushCallbacks, 0);
1981 };
1982 }
1983
1984 function nextTick (cb, ctx) {
1985 var _resolve;
1986 callbacks.push(function () {
1987 if (cb) {
1988 try {
1989 cb.call(ctx);
1990 } catch (e) {
1991 handleError(e, ctx, 'nextTick');
1992 }
1993 } else if (_resolve) {
1994 _resolve(ctx);
1995 }
1996 });
1997 if (!pending) {
1998 pending = true;
1999 timerFunc();
2000 }
2001 // $flow-disable-line
2002 if (!cb && typeof Promise !== 'undefined') {
2003 return new Promise(function (resolve) {
2004 _resolve = resolve;
2005 })
2006 }
2007 }
2008
2009 /* */
2010
2011 /* not type checking this file because flow doesn't play well with Proxy */
2012
2013 var initProxy;
2014
2015 {
2016 var allowedGlobals = makeMap(
2017 'Infinity,undefined,NaN,isFinite,isNaN,' +
2018 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
2019 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
2020 'require' // for Webpack/Browserify
2021 );
2022
2023 var warnNonPresent = function (target, key) {
2024 warn(
2025 "Property or method \"" + key + "\" is not defined on the instance but " +
2026 'referenced during render. Make sure that this property is reactive, ' +
2027 'either in the data option, or for class-based components, by ' +
2028 'initializing the property. ' +
2029 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
2030 target
2031 );
2032 };
2033
2034 var warnReservedPrefix = function (target, key) {
2035 warn(
2036 "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
2037 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
2038 'prevent conflicts with Vue internals. ' +
2039 'See: https://vuejs.org/v2/api/#data',
2040 target
2041 );
2042 };
2043
2044 var hasProxy =
2045 typeof Proxy !== 'undefined' && isNative(Proxy);
2046
2047 if (hasProxy) {
2048 var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
2049 config.keyCodes = new Proxy(config.keyCodes, {
2050 set: function set (target, key, value) {
2051 if (isBuiltInModifier(key)) {
2052 warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
2053 return false
2054 } else {
2055 target[key] = value;
2056 return true
2057 }
2058 }
2059 });
2060 }
2061
2062 var hasHandler = {
2063 has: function has (target, key) {
2064 var has = key in target;
2065 var isAllowed = allowedGlobals(key) ||
2066 (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
2067 if (!has && !isAllowed) {
2068 if (key in target.$data) { warnReservedPrefix(target, key); }
2069 else { warnNonPresent(target, key); }
2070 }
2071 return has || !isAllowed
2072 }
2073 };
2074
2075 var getHandler = {
2076 get: function get (target, key) {
2077 if (typeof key === 'string' && !(key in target)) {
2078 if (key in target.$data) { warnReservedPrefix(target, key); }
2079 else { warnNonPresent(target, key); }
2080 }
2081 return target[key]
2082 }
2083 };
2084
2085 initProxy = function initProxy (vm) {
2086 if (hasProxy) {
2087 // determine which proxy handler to use
2088 var options = vm.$options;
2089 var handlers = options.render && options.render._withStripped
2090 ? getHandler
2091 : hasHandler;
2092 vm._renderProxy = new Proxy(vm, handlers);
2093 } else {
2094 vm._renderProxy = vm;
2095 }
2096 };
2097 }
2098
2099 /* */
2100
2101 var seenObjects = new _Set();
2102
2103 /**
2104 * Recursively traverse an object to evoke all converted
2105 * getters, so that every nested property inside the object
2106 * is collected as a "deep" dependency.
2107 */
2108 function traverse (val) {
2109 _traverse(val, seenObjects);
2110 seenObjects.clear();
2111 }
2112
2113 function _traverse (val, seen) {
2114 var i, keys;
2115 var isA = Array.isArray(val);
2116 if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
2117 return
2118 }
2119 if (val.__ob__) {
2120 var depId = val.__ob__.dep.id;
2121 if (seen.has(depId)) {
2122 return
2123 }
2124 seen.add(depId);
2125 }
2126 if (isA) {
2127 i = val.length;
2128 while (i--) { _traverse(val[i], seen); }
2129 } else {
2130 keys = Object.keys(val);
2131 i = keys.length;
2132 while (i--) { _traverse(val[keys[i]], seen); }
2133 }
2134 }
2135
2136 var mark;
2137 var measure;
2138
2139 {
2140 var perf = inBrowser && window.performance;
2141 /* istanbul ignore if */
2142 if (
2143 perf &&
2144 perf.mark &&
2145 perf.measure &&
2146 perf.clearMarks &&
2147 perf.clearMeasures
2148 ) {
2149 mark = function (tag) { return perf.mark(tag); };
2150 measure = function (name, startTag, endTag) {
2151 perf.measure(name, startTag, endTag);
2152 perf.clearMarks(startTag);
2153 perf.clearMarks(endTag);
2154 // perf.clearMeasures(name)
2155 };
2156 }
2157 }
2158
2159 /* */
2160
2161 var normalizeEvent = cached(function (name) {
2162 var passive = name.charAt(0) === '&';
2163 name = passive ? name.slice(1) : name;
2164 var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
2165 name = once$$1 ? name.slice(1) : name;
2166 var capture = name.charAt(0) === '!';
2167 name = capture ? name.slice(1) : name;
2168 return {
2169 name: name,
2170 once: once$$1,
2171 capture: capture,
2172 passive: passive
2173 }
2174 });
2175
2176 function createFnInvoker (fns, vm) {
2177 function invoker () {
2178 var arguments$1 = arguments;
2179
2180 var fns = invoker.fns;
2181 if (Array.isArray(fns)) {
2182 var cloned = fns.slice();
2183 for (var i = 0; i < cloned.length; i++) {
2184 invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
2185 }
2186 } else {
2187 // return handler return value for single handlers
2188 return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
2189 }
2190 }
2191 invoker.fns = fns;
2192 return invoker
2193 }
2194
2195 function updateListeners (
2196 on,
2197 oldOn,
2198 add,
2199 remove$$1,
2200 createOnceHandler,
2201 vm
2202 ) {
2203 var name, def$$1, cur, old, event;
2204 for (name in on) {
2205 def$$1 = cur = on[name];
2206 old = oldOn[name];
2207 event = normalizeEvent(name);
2208 if (isUndef(cur)) {
2209 warn(
2210 "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
2211 vm
2212 );
2213 } else if (isUndef(old)) {
2214 if (isUndef(cur.fns)) {
2215 cur = on[name] = createFnInvoker(cur, vm);
2216 }
2217 if (isTrue(event.once)) {
2218 cur = on[name] = createOnceHandler(event.name, cur, event.capture);
2219 }
2220 add(event.name, cur, event.capture, event.passive, event.params);
2221 } else if (cur !== old) {
2222 old.fns = cur;
2223 on[name] = old;
2224 }
2225 }
2226 for (name in oldOn) {
2227 if (isUndef(on[name])) {
2228 event = normalizeEvent(name);
2229 remove$$1(event.name, oldOn[name], event.capture);
2230 }
2231 }
2232 }
2233
2234 /* */
2235
2236 function mergeVNodeHook (def, hookKey, hook) {
2237 if (def instanceof VNode) {
2238 def = def.data.hook || (def.data.hook = {});
2239 }
2240 var invoker;
2241 var oldHook = def[hookKey];
2242
2243 function wrappedHook () {
2244 hook.apply(this, arguments);
2245 // important: remove merged hook to ensure it's called only once
2246 // and prevent memory leak
2247 remove(invoker.fns, wrappedHook);
2248 }
2249
2250 if (isUndef(oldHook)) {
2251 // no existing hook
2252 invoker = createFnInvoker([wrappedHook]);
2253 } else {
2254 /* istanbul ignore if */
2255 if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
2256 // already a merged invoker
2257 invoker = oldHook;
2258 invoker.fns.push(wrappedHook);
2259 } else {
2260 // existing plain hook
2261 invoker = createFnInvoker([oldHook, wrappedHook]);
2262 }
2263 }
2264
2265 invoker.merged = true;
2266 def[hookKey] = invoker;
2267 }
2268
2269 /* */
2270
2271 function extractPropsFromVNodeData (
2272 data,
2273 Ctor,
2274 tag
2275 ) {
2276 // we are only extracting raw values here.
2277 // validation and default values are handled in the child
2278 // component itself.
2279 var propOptions = Ctor.options.props;
2280 if (isUndef(propOptions)) {
2281 return
2282 }
2283 var res = {};
2284 var attrs = data.attrs;
2285 var props = data.props;
2286 if (isDef(attrs) || isDef(props)) {
2287 for (var key in propOptions) {
2288 var altKey = hyphenate(key);
2289 {
2290 var keyInLowerCase = key.toLowerCase();
2291 if (
2292 key !== keyInLowerCase &&
2293 attrs && hasOwn(attrs, keyInLowerCase)
2294 ) {
2295 tip(
2296 "Prop \"" + keyInLowerCase + "\" is passed to component " +
2297 (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
2298 " \"" + key + "\". " +
2299 "Note that HTML attributes are case-insensitive and camelCased " +
2300 "props need to use their kebab-case equivalents when using in-DOM " +
2301 "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
2302 );
2303 }
2304 }
2305 checkProp(res, props, key, altKey, true) ||
2306 checkProp(res, attrs, key, altKey, false);
2307 }
2308 }
2309 return res
2310 }
2311
2312 function checkProp (
2313 res,
2314 hash,
2315 key,
2316 altKey,
2317 preserve
2318 ) {
2319 if (isDef(hash)) {
2320 if (hasOwn(hash, key)) {
2321 res[key] = hash[key];
2322 if (!preserve) {
2323 delete hash[key];
2324 }
2325 return true
2326 } else if (hasOwn(hash, altKey)) {
2327 res[key] = hash[altKey];
2328 if (!preserve) {
2329 delete hash[altKey];
2330 }
2331 return true
2332 }
2333 }
2334 return false
2335 }
2336
2337 /* */
2338
2339 // The template compiler attempts to minimize the need for normalization by
2340 // statically analyzing the template at compile time.
2341 //
2342 // For plain HTML markup, normalization can be completely skipped because the
2343 // generated render function is guaranteed to return Array<VNode>. There are
2344 // two cases where extra normalization is needed:
2345
2346 // 1. When the children contains components - because a functional component
2347 // may return an Array instead of a single root. In this case, just a simple
2348 // normalization is needed - if any child is an Array, we flatten the whole
2349 // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
2350 // because functional components already normalize their own children.
2351 function simpleNormalizeChildren (children) {
2352 for (var i = 0; i < children.length; i++) {
2353 if (Array.isArray(children[i])) {
2354 return Array.prototype.concat.apply([], children)
2355 }
2356 }
2357 return children
2358 }
2359
2360 // 2. When the children contains constructs that always generated nested Arrays,
2361 // e.g. <template>, <slot>, v-for, or when the children is provided by user
2362 // with hand-written render functions / JSX. In such cases a full normalization
2363 // is needed to cater to all possible types of children values.
2364 function normalizeChildren (children) {
2365 return isPrimitive(children)
2366 ? [createTextVNode(children)]
2367 : Array.isArray(children)
2368 ? normalizeArrayChildren(children)
2369 : undefined
2370 }
2371
2372 function isTextNode (node) {
2373 return isDef(node) && isDef(node.text) && isFalse(node.isComment)
2374 }
2375
2376 function normalizeArrayChildren (children, nestedIndex) {
2377 var res = [];
2378 var i, c, lastIndex, last;
2379 for (i = 0; i < children.length; i++) {
2380 c = children[i];
2381 if (isUndef(c) || typeof c === 'boolean') { continue }
2382 lastIndex = res.length - 1;
2383 last = res[lastIndex];
2384 // nested
2385 if (Array.isArray(c)) {
2386 if (c.length > 0) {
2387 c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
2388 // merge adjacent text nodes
2389 if (isTextNode(c[0]) && isTextNode(last)) {
2390 res[lastIndex] = createTextVNode(last.text + (c[0]).text);
2391 c.shift();
2392 }
2393 res.push.apply(res, c);
2394 }
2395 } else if (isPrimitive(c)) {
2396 if (isTextNode(last)) {
2397 // merge adjacent text nodes
2398 // this is necessary for SSR hydration because text nodes are
2399 // essentially merged when rendered to HTML strings
2400 res[lastIndex] = createTextVNode(last.text + c);
2401 } else if (c !== '') {
2402 // convert primitive to vnode
2403 res.push(createTextVNode(c));
2404 }
2405 } else {
2406 if (isTextNode(c) && isTextNode(last)) {
2407 // merge adjacent text nodes
2408 res[lastIndex] = createTextVNode(last.text + c.text);
2409 } else {
2410 // default key for nested array children (likely generated by v-for)
2411 if (isTrue(children._isVList) &&
2412 isDef(c.tag) &&
2413 isUndef(c.key) &&
2414 isDef(nestedIndex)) {
2415 c.key = "__vlist" + nestedIndex + "_" + i + "__";
2416 }
2417 res.push(c);
2418 }
2419 }
2420 }
2421 return res
2422 }
2423
2424 /* */
2425
2426 function initProvide (vm) {
2427 var provide = vm.$options.provide;
2428 if (provide) {
2429 vm._provided = typeof provide === 'function'
2430 ? provide.call(vm)
2431 : provide;
2432 }
2433 }
2434
2435 function initInjections (vm) {
2436 var result = resolveInject(vm.$options.inject, vm);
2437 if (result) {
2438 toggleObserving(false);
2439 Object.keys(result).forEach(function (key) {
2440 /* istanbul ignore else */
2441 {
2442 defineReactive$$1(vm, key, result[key], function () {
2443 warn(
2444 "Avoid mutating an injected value directly since the changes will be " +
2445 "overwritten whenever the provided component re-renders. " +
2446 "injection being mutated: \"" + key + "\"",
2447 vm
2448 );
2449 });
2450 }
2451 });
2452 toggleObserving(true);
2453 }
2454 }
2455
2456 function resolveInject (inject, vm) {
2457 if (inject) {
2458 // inject is :any because flow is not smart enough to figure out cached
2459 var result = Object.create(null);
2460 var keys = hasSymbol
2461 ? Reflect.ownKeys(inject)
2462 : Object.keys(inject);
2463
2464 for (var i = 0; i < keys.length; i++) {
2465 var key = keys[i];
2466 // #6574 in case the inject object is observed...
2467 if (key === '__ob__') { continue }
2468 var provideKey = inject[key].from;
2469 var source = vm;
2470 while (source) {
2471 if (source._provided && hasOwn(source._provided, provideKey)) {
2472 result[key] = source._provided[provideKey];
2473 break
2474 }
2475 source = source.$parent;
2476 }
2477 if (!source) {
2478 if ('default' in inject[key]) {
2479 var provideDefault = inject[key].default;
2480 result[key] = typeof provideDefault === 'function'
2481 ? provideDefault.call(vm)
2482 : provideDefault;
2483 } else {
2484 warn(("Injection \"" + key + "\" not found"), vm);
2485 }
2486 }
2487 }
2488 return result
2489 }
2490 }
2491
2492 /* */
2493
2494
2495
2496 /**
2497 * Runtime helper for resolving raw children VNodes into a slot object.
2498 */
2499 function resolveSlots (
2500 children,
2501 context
2502 ) {
2503 if (!children || !children.length) {
2504 return {}
2505 }
2506 var slots = {};
2507 for (var i = 0, l = children.length; i < l; i++) {
2508 var child = children[i];
2509 var data = child.data;
2510 // remove slot attribute if the node is resolved as a Vue slot node
2511 if (data && data.attrs && data.attrs.slot) {
2512 delete data.attrs.slot;
2513 }
2514 // named slots should only be respected if the vnode was rendered in the
2515 // same context.
2516 if ((child.context === context || child.fnContext === context) &&
2517 data && data.slot != null
2518 ) {
2519 var name = data.slot;
2520 var slot = (slots[name] || (slots[name] = []));
2521 if (child.tag === 'template') {
2522 slot.push.apply(slot, child.children || []);
2523 } else {
2524 slot.push(child);
2525 }
2526 } else {
2527 (slots.default || (slots.default = [])).push(child);
2528 }
2529 }
2530 // ignore slots that contains only whitespace
2531 for (var name$1 in slots) {
2532 if (slots[name$1].every(isWhitespace)) {
2533 delete slots[name$1];
2534 }
2535 }
2536 return slots
2537 }
2538
2539 function isWhitespace (node) {
2540 return (node.isComment && !node.asyncFactory) || node.text === ' '
2541 }
2542
2543 /* */
2544
2545 function isAsyncPlaceholder (node) {
2546 return node.isComment && node.asyncFactory
2547 }
2548
2549 /* */
2550
2551 function normalizeScopedSlots (
2552 slots,
2553 normalSlots,
2554 prevSlots
2555 ) {
2556 var res;
2557 var hasNormalSlots = Object.keys(normalSlots).length > 0;
2558 var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2559 var key = slots && slots.$key;
2560 if (!slots) {
2561 res = {};
2562 } else if (slots._normalized) {
2563 // fast path 1: child component re-render only, parent did not change
2564 return slots._normalized
2565 } else if (
2566 isStable &&
2567 prevSlots &&
2568 prevSlots !== emptyObject &&
2569 key === prevSlots.$key &&
2570 !hasNormalSlots &&
2571 !prevSlots.$hasNormal
2572 ) {
2573 // fast path 2: stable scoped slots w/ no normal slots to proxy,
2574 // only need to normalize once
2575 return prevSlots
2576 } else {
2577 res = {};
2578 for (var key$1 in slots) {
2579 if (slots[key$1] && key$1[0] !== '$') {
2580 res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
2581 }
2582 }
2583 }
2584 // expose normal slots on scopedSlots
2585 for (var key$2 in normalSlots) {
2586 if (!(key$2 in res)) {
2587 res[key$2] = proxyNormalSlot(normalSlots, key$2);
2588 }
2589 }
2590 // avoriaz seems to mock a non-extensible $scopedSlots object
2591 // and when that is passed down this would cause an error
2592 if (slots && Object.isExtensible(slots)) {
2593 (slots)._normalized = res;
2594 }
2595 def(res, '$stable', isStable);
2596 def(res, '$key', key);
2597 def(res, '$hasNormal', hasNormalSlots);
2598 return res
2599 }
2600
2601 function normalizeScopedSlot(normalSlots, key, fn) {
2602 var normalized = function () {
2603 var res = arguments.length ? fn.apply(null, arguments) : fn({});
2604 res = res && typeof res === 'object' && !Array.isArray(res)
2605 ? [res] // single vnode
2606 : normalizeChildren(res);
2607 var vnode = res && res[0];
2608 return res && (
2609 !vnode ||
2610 (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
2611 ) ? undefined
2612 : res
2613 };
2614 // this is a slot using the new v-slot syntax without scope. although it is
2615 // compiled as a scoped slot, render fn users would expect it to be present
2616 // on this.$slots because the usage is semantically a normal slot.
2617 if (fn.proxy) {
2618 Object.defineProperty(normalSlots, key, {
2619 get: normalized,
2620 enumerable: true,
2621 configurable: true
2622 });
2623 }
2624 return normalized
2625 }
2626
2627 function proxyNormalSlot(slots, key) {
2628 return function () { return slots[key]; }
2629 }
2630
2631 /* */
2632
2633 /**
2634 * Runtime helper for rendering v-for lists.
2635 */
2636 function renderList (
2637 val,
2638 render
2639 ) {
2640 var ret, i, l, keys, key;
2641 if (Array.isArray(val) || typeof val === 'string') {
2642 ret = new Array(val.length);
2643 for (i = 0, l = val.length; i < l; i++) {
2644 ret[i] = render(val[i], i);
2645 }
2646 } else if (typeof val === 'number') {
2647 ret = new Array(val);
2648 for (i = 0; i < val; i++) {
2649 ret[i] = render(i + 1, i);
2650 }
2651 } else if (isObject(val)) {
2652 if (hasSymbol && val[Symbol.iterator]) {
2653 ret = [];
2654 var iterator = val[Symbol.iterator]();
2655 var result = iterator.next();
2656 while (!result.done) {
2657 ret.push(render(result.value, ret.length));
2658 result = iterator.next();
2659 }
2660 } else {
2661 keys = Object.keys(val);
2662 ret = new Array(keys.length);
2663 for (i = 0, l = keys.length; i < l; i++) {
2664 key = keys[i];
2665 ret[i] = render(val[key], key, i);
2666 }
2667 }
2668 }
2669 if (!isDef(ret)) {
2670 ret = [];
2671 }
2672 (ret)._isVList = true;
2673 return ret
2674 }
2675
2676 /* */
2677
2678 /**
2679 * Runtime helper for rendering <slot>
2680 */
2681 function renderSlot (
2682 name,
2683 fallbackRender,
2684 props,
2685 bindObject
2686 ) {
2687 var scopedSlotFn = this.$scopedSlots[name];
2688 var nodes;
2689 if (scopedSlotFn) {
2690 // scoped slot
2691 props = props || {};
2692 if (bindObject) {
2693 if (!isObject(bindObject)) {
2694 warn('slot v-bind without argument expects an Object', this);
2695 }
2696 props = extend(extend({}, bindObject), props);
2697 }
2698 nodes =
2699 scopedSlotFn(props) ||
2700 (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
2701 } else {
2702 nodes =
2703 this.$slots[name] ||
2704 (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
2705 }
2706
2707 var target = props && props.slot;
2708 if (target) {
2709 return this.$createElement('template', { slot: target }, nodes)
2710 } else {
2711 return nodes
2712 }
2713 }
2714
2715 /* */
2716
2717 /**
2718 * Runtime helper for resolving filters
2719 */
2720 function resolveFilter (id) {
2721 return resolveAsset(this.$options, 'filters', id, true) || identity
2722 }
2723
2724 /* */
2725
2726 function isKeyNotMatch (expect, actual) {
2727 if (Array.isArray(expect)) {
2728 return expect.indexOf(actual) === -1
2729 } else {
2730 return expect !== actual
2731 }
2732 }
2733
2734 /**
2735 * Runtime helper for checking keyCodes from config.
2736 * exposed as Vue.prototype._k
2737 * passing in eventKeyName as last argument separately for backwards compat
2738 */
2739 function checkKeyCodes (
2740 eventKeyCode,
2741 key,
2742 builtInKeyCode,
2743 eventKeyName,
2744 builtInKeyName
2745 ) {
2746 var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
2747 if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
2748 return isKeyNotMatch(builtInKeyName, eventKeyName)
2749 } else if (mappedKeyCode) {
2750 return isKeyNotMatch(mappedKeyCode, eventKeyCode)
2751 } else if (eventKeyName) {
2752 return hyphenate(eventKeyName) !== key
2753 }
2754 return eventKeyCode === undefined
2755 }
2756
2757 /* */
2758
2759 /**
2760 * Runtime helper for merging v-bind="object" into a VNode's data.
2761 */
2762 function bindObjectProps (
2763 data,
2764 tag,
2765 value,
2766 asProp,
2767 isSync
2768 ) {
2769 if (value) {
2770 if (!isObject(value)) {
2771 warn(
2772 'v-bind without argument expects an Object or Array value',
2773 this
2774 );
2775 } else {
2776 if (Array.isArray(value)) {
2777 value = toObject(value);
2778 }
2779 var hash;
2780 var loop = function ( key ) {
2781 if (
2782 key === 'class' ||
2783 key === 'style' ||
2784 isReservedAttribute(key)
2785 ) {
2786 hash = data;
2787 } else {
2788 var type = data.attrs && data.attrs.type;
2789 hash = asProp || config.mustUseProp(tag, type, key)
2790 ? data.domProps || (data.domProps = {})
2791 : data.attrs || (data.attrs = {});
2792 }
2793 var camelizedKey = camelize(key);
2794 var hyphenatedKey = hyphenate(key);
2795 if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2796 hash[key] = value[key];
2797
2798 if (isSync) {
2799 var on = data.on || (data.on = {});
2800 on[("update:" + key)] = function ($event) {
2801 value[key] = $event;
2802 };
2803 }
2804 }
2805 };
2806
2807 for (var key in value) loop( key );
2808 }
2809 }
2810 return data
2811 }
2812
2813 /* */
2814
2815 /**
2816 * Runtime helper for rendering static trees.
2817 */
2818 function renderStatic (
2819 index,
2820 isInFor
2821 ) {
2822 var cached = this._staticTrees || (this._staticTrees = []);
2823 var tree = cached[index];
2824 // if has already-rendered static tree and not inside v-for,
2825 // we can reuse the same tree.
2826 if (tree && !isInFor) {
2827 return tree
2828 }
2829 // otherwise, render a fresh tree.
2830 tree = cached[index] = this.$options.staticRenderFns[index].call(
2831 this._renderProxy,
2832 null,
2833 this // for render fns generated for functional component templates
2834 );
2835 markStatic(tree, ("__static__" + index), false);
2836 return tree
2837 }
2838
2839 /**
2840 * Runtime helper for v-once.
2841 * Effectively it means marking the node as static with a unique key.
2842 */
2843 function markOnce (
2844 tree,
2845 index,
2846 key
2847 ) {
2848 markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
2849 return tree
2850 }
2851
2852 function markStatic (
2853 tree,
2854 key,
2855 isOnce
2856 ) {
2857 if (Array.isArray(tree)) {
2858 for (var i = 0; i < tree.length; i++) {
2859 if (tree[i] && typeof tree[i] !== 'string') {
2860 markStaticNode(tree[i], (key + "_" + i), isOnce);
2861 }
2862 }
2863 } else {
2864 markStaticNode(tree, key, isOnce);
2865 }
2866 }
2867
2868 function markStaticNode (node, key, isOnce) {
2869 node.isStatic = true;
2870 node.key = key;
2871 node.isOnce = isOnce;
2872 }
2873
2874 /* */
2875
2876 function bindObjectListeners (data, value) {
2877 if (value) {
2878 if (!isPlainObject(value)) {
2879 warn(
2880 'v-on without argument expects an Object value',
2881 this
2882 );
2883 } else {
2884 var on = data.on = data.on ? extend({}, data.on) : {};
2885 for (var key in value) {
2886 var existing = on[key];
2887 var ours = value[key];
2888 on[key] = existing ? [].concat(existing, ours) : ours;
2889 }
2890 }
2891 }
2892 return data
2893 }
2894
2895 /* */
2896
2897 function resolveScopedSlots (
2898 fns, // see flow/vnode
2899 res,
2900 // the following are added in 2.6
2901 hasDynamicKeys,
2902 contentHashKey
2903 ) {
2904 res = res || { $stable: !hasDynamicKeys };
2905 for (var i = 0; i < fns.length; i++) {
2906 var slot = fns[i];
2907 if (Array.isArray(slot)) {
2908 resolveScopedSlots(slot, res, hasDynamicKeys);
2909 } else if (slot) {
2910 // marker for reverse proxying v-slot without scope on this.$slots
2911 if (slot.proxy) {
2912 slot.fn.proxy = true;
2913 }
2914 res[slot.key] = slot.fn;
2915 }
2916 }
2917 if (contentHashKey) {
2918 (res).$key = contentHashKey;
2919 }
2920 return res
2921 }
2922
2923 /* */
2924
2925 function bindDynamicKeys (baseObj, values) {
2926 for (var i = 0; i < values.length; i += 2) {
2927 var key = values[i];
2928 if (typeof key === 'string' && key) {
2929 baseObj[values[i]] = values[i + 1];
2930 } else if (key !== '' && key !== null) {
2931 // null is a special value for explicitly removing a binding
2932 warn(
2933 ("Invalid value for dynamic directive argument (expected string or null): " + key),
2934 this
2935 );
2936 }
2937 }
2938 return baseObj
2939 }
2940
2941 // helper to dynamically append modifier runtime markers to event names.
2942 // ensure only append when value is already string, otherwise it will be cast
2943 // to string and cause the type check to miss.
2944 function prependModifier (value, symbol) {
2945 return typeof value === 'string' ? symbol + value : value
2946 }
2947
2948 /* */
2949
2950 function installRenderHelpers (target) {
2951 target._o = markOnce;
2952 target._n = toNumber;
2953 target._s = toString;
2954 target._l = renderList;
2955 target._t = renderSlot;
2956 target._q = looseEqual;
2957 target._i = looseIndexOf;
2958 target._m = renderStatic;
2959 target._f = resolveFilter;
2960 target._k = checkKeyCodes;
2961 target._b = bindObjectProps;
2962 target._v = createTextVNode;
2963 target._e = createEmptyVNode;
2964 target._u = resolveScopedSlots;
2965 target._g = bindObjectListeners;
2966 target._d = bindDynamicKeys;
2967 target._p = prependModifier;
2968 }
2969
2970 /* */
2971
2972 function FunctionalRenderContext (
2973 data,
2974 props,
2975 children,
2976 parent,
2977 Ctor
2978 ) {
2979 var this$1 = this;
2980
2981 var options = Ctor.options;
2982 // ensure the createElement function in functional components
2983 // gets a unique context - this is necessary for correct named slot check
2984 var contextVm;
2985 if (hasOwn(parent, '_uid')) {
2986 contextVm = Object.create(parent);
2987 // $flow-disable-line
2988 contextVm._original = parent;
2989 } else {
2990 // the context vm passed in is a functional context as well.
2991 // in this case we want to make sure we are able to get a hold to the
2992 // real context instance.
2993 contextVm = parent;
2994 // $flow-disable-line
2995 parent = parent._original;
2996 }
2997 var isCompiled = isTrue(options._compiled);
2998 var needNormalization = !isCompiled;
2999
3000 this.data = data;
3001 this.props = props;
3002 this.children = children;
3003 this.parent = parent;
3004 this.listeners = data.on || emptyObject;
3005 this.injections = resolveInject(options.inject, parent);
3006 this.slots = function () {
3007 if (!this$1.$slots) {
3008 normalizeScopedSlots(
3009 data.scopedSlots,
3010 this$1.$slots = resolveSlots(children, parent)
3011 );
3012 }
3013 return this$1.$slots
3014 };
3015
3016 Object.defineProperty(this, 'scopedSlots', ({
3017 enumerable: true,
3018 get: function get () {
3019 return normalizeScopedSlots(data.scopedSlots, this.slots())
3020 }
3021 }));
3022
3023 // support for compiled functional template
3024 if (isCompiled) {
3025 // exposing $options for renderStatic()
3026 this.$options = options;
3027 // pre-resolve slots for renderSlot()
3028 this.$slots = this.slots();
3029 this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
3030 }
3031
3032 if (options._scopeId) {
3033 this._c = function (a, b, c, d) {
3034 var vnode = createElement(contextVm, a, b, c, d, needNormalization);
3035 if (vnode && !Array.isArray(vnode)) {
3036 vnode.fnScopeId = options._scopeId;
3037 vnode.fnContext = parent;
3038 }
3039 return vnode
3040 };
3041 } else {
3042 this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
3043 }
3044 }
3045
3046 installRenderHelpers(FunctionalRenderContext.prototype);
3047
3048 function createFunctionalComponent (
3049 Ctor,
3050 propsData,
3051 data,
3052 contextVm,
3053 children
3054 ) {
3055 var options = Ctor.options;
3056 var props = {};
3057 var propOptions = options.props;
3058 if (isDef(propOptions)) {
3059 for (var key in propOptions) {
3060 props[key] = validateProp(key, propOptions, propsData || emptyObject);
3061 }
3062 } else {
3063 if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
3064 if (isDef(data.props)) { mergeProps(props, data.props); }
3065 }
3066
3067 var renderContext = new FunctionalRenderContext(
3068 data,
3069 props,
3070 children,
3071 contextVm,
3072 Ctor
3073 );
3074
3075 var vnode = options.render.call(null, renderContext._c, renderContext);
3076
3077 if (vnode instanceof VNode) {
3078 return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
3079 } else if (Array.isArray(vnode)) {
3080 var vnodes = normalizeChildren(vnode) || [];
3081 var res = new Array(vnodes.length);
3082 for (var i = 0; i < vnodes.length; i++) {
3083 res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
3084 }
3085 return res
3086 }
3087 }
3088
3089 function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
3090 // #7817 clone node before setting fnContext, otherwise if the node is reused
3091 // (e.g. it was from a cached normal slot) the fnContext causes named slots
3092 // that should not be matched to match.
3093 var clone = cloneVNode(vnode);
3094 clone.fnContext = contextVm;
3095 clone.fnOptions = options;
3096 {
3097 (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
3098 }
3099 if (data.slot) {
3100 (clone.data || (clone.data = {})).slot = data.slot;
3101 }
3102 return clone
3103 }
3104
3105 function mergeProps (to, from) {
3106 for (var key in from) {
3107 to[camelize(key)] = from[key];
3108 }
3109 }
3110
3111 /* */
3112
3113 /* */
3114
3115 /* */
3116
3117 /* */
3118
3119 // inline hooks to be invoked on component VNodes during patch
3120 var componentVNodeHooks = {
3121 init: function init (vnode, hydrating) {
3122 if (
3123 vnode.componentInstance &&
3124 !vnode.componentInstance._isDestroyed &&
3125 vnode.data.keepAlive
3126 ) {
3127 // kept-alive components, treat as a patch
3128 var mountedNode = vnode; // work around flow
3129 componentVNodeHooks.prepatch(mountedNode, mountedNode);
3130 } else {
3131 var child = vnode.componentInstance = createComponentInstanceForVnode(
3132 vnode,
3133 activeInstance
3134 );
3135 child.$mount(hydrating ? vnode.elm : undefined, hydrating);
3136 }
3137 },
3138
3139 prepatch: function prepatch (oldVnode, vnode) {
3140 var options = vnode.componentOptions;
3141 var child = vnode.componentInstance = oldVnode.componentInstance;
3142 updateChildComponent(
3143 child,
3144 options.propsData, // updated props
3145 options.listeners, // updated listeners
3146 vnode, // new parent vnode
3147 options.children // new children
3148 );
3149 },
3150
3151 insert: function insert (vnode) {
3152 var context = vnode.context;
3153 var componentInstance = vnode.componentInstance;
3154 if (!componentInstance._isMounted) {
3155 componentInstance._isMounted = true;
3156 callHook(componentInstance, 'mounted');
3157 }
3158 if (vnode.data.keepAlive) {
3159 if (context._isMounted) {
3160 // vue-router#1212
3161 // During updates, a kept-alive component's child components may
3162 // change, so directly walking the tree here may call activated hooks
3163 // on incorrect children. Instead we push them into a queue which will
3164 // be processed after the whole patch process ended.
3165 queueActivatedComponent(componentInstance);
3166 } else {
3167 activateChildComponent(componentInstance, true /* direct */);
3168 }
3169 }
3170 },
3171
3172 destroy: function destroy (vnode) {
3173 var componentInstance = vnode.componentInstance;
3174 if (!componentInstance._isDestroyed) {
3175 if (!vnode.data.keepAlive) {
3176 componentInstance.$destroy();
3177 } else {
3178 deactivateChildComponent(componentInstance, true /* direct */);
3179 }
3180 }
3181 }
3182 };
3183
3184 var hooksToMerge = Object.keys(componentVNodeHooks);
3185
3186 function createComponent (
3187 Ctor,
3188 data,
3189 context,
3190 children,
3191 tag
3192 ) {
3193 if (isUndef(Ctor)) {
3194 return
3195 }
3196
3197 var baseCtor = context.$options._base;
3198
3199 // plain options object: turn it into a constructor
3200 if (isObject(Ctor)) {
3201 Ctor = baseCtor.extend(Ctor);
3202 }
3203
3204 // if at this stage it's not a constructor or an async component factory,
3205 // reject.
3206 if (typeof Ctor !== 'function') {
3207 {
3208 warn(("Invalid Component definition: " + (String(Ctor))), context);
3209 }
3210 return
3211 }
3212
3213 // async component
3214 var asyncFactory;
3215 if (isUndef(Ctor.cid)) {
3216 asyncFactory = Ctor;
3217 Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
3218 if (Ctor === undefined) {
3219 // return a placeholder node for async component, which is rendered
3220 // as a comment node but preserves all the raw information for the node.
3221 // the information will be used for async server-rendering and hydration.
3222 return createAsyncPlaceholder(
3223 asyncFactory,
3224 data,
3225 context,
3226 children,
3227 tag
3228 )
3229 }
3230 }
3231
3232 data = data || {};
3233
3234 // resolve constructor options in case global mixins are applied after
3235 // component constructor creation
3236 resolveConstructorOptions(Ctor);
3237
3238 // transform component v-model data into props & events
3239 if (isDef(data.model)) {
3240 transformModel(Ctor.options, data);
3241 }
3242
3243 // extract props
3244 var propsData = extractPropsFromVNodeData(data, Ctor, tag);
3245
3246 // functional component
3247 if (isTrue(Ctor.options.functional)) {
3248 return createFunctionalComponent(Ctor, propsData, data, context, children)
3249 }
3250
3251 // extract listeners, since these needs to be treated as
3252 // child component listeners instead of DOM listeners
3253 var listeners = data.on;
3254 // replace with listeners with .native modifier
3255 // so it gets processed during parent component patch.
3256 data.on = data.nativeOn;
3257
3258 if (isTrue(Ctor.options.abstract)) {
3259 // abstract components do not keep anything
3260 // other than props & listeners & slot
3261
3262 // work around flow
3263 var slot = data.slot;
3264 data = {};
3265 if (slot) {
3266 data.slot = slot;
3267 }
3268 }
3269
3270 // install component management hooks onto the placeholder node
3271 installComponentHooks(data);
3272
3273 // return a placeholder vnode
3274 var name = Ctor.options.name || tag;
3275 var vnode = new VNode(
3276 ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
3277 data, undefined, undefined, undefined, context,
3278 { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
3279 asyncFactory
3280 );
3281
3282 return vnode
3283 }
3284
3285 function createComponentInstanceForVnode (
3286 // we know it's MountedComponentVNode but flow doesn't
3287 vnode,
3288 // activeInstance in lifecycle state
3289 parent
3290 ) {
3291 var options = {
3292 _isComponent: true,
3293 _parentVnode: vnode,
3294 parent: parent
3295 };
3296 // check inline-template render functions
3297 var inlineTemplate = vnode.data.inlineTemplate;
3298 if (isDef(inlineTemplate)) {
3299 options.render = inlineTemplate.render;
3300 options.staticRenderFns = inlineTemplate.staticRenderFns;
3301 }
3302 return new vnode.componentOptions.Ctor(options)
3303 }
3304
3305 function installComponentHooks (data) {
3306 var hooks = data.hook || (data.hook = {});
3307 for (var i = 0; i < hooksToMerge.length; i++) {
3308 var key = hooksToMerge[i];
3309 var existing = hooks[key];
3310 var toMerge = componentVNodeHooks[key];
3311 if (existing !== toMerge && !(existing && existing._merged)) {
3312 hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
3313 }
3314 }
3315 }
3316
3317 function mergeHook$1 (f1, f2) {
3318 var merged = function (a, b) {
3319 // flow complains about extra args which is why we use any
3320 f1(a, b);
3321 f2(a, b);
3322 };
3323 merged._merged = true;
3324 return merged
3325 }
3326
3327 // transform component v-model info (value and callback) into
3328 // prop and event handler respectively.
3329 function transformModel (options, data) {
3330 var prop = (options.model && options.model.prop) || 'value';
3331 var event = (options.model && options.model.event) || 'input'
3332 ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
3333 var on = data.on || (data.on = {});
3334 var existing = on[event];
3335 var callback = data.model.callback;
3336 if (isDef(existing)) {
3337 if (
3338 Array.isArray(existing)
3339 ? existing.indexOf(callback) === -1
3340 : existing !== callback
3341 ) {
3342 on[event] = [callback].concat(existing);
3343 }
3344 } else {
3345 on[event] = callback;
3346 }
3347 }
3348
3349 /* */
3350
3351 var SIMPLE_NORMALIZE = 1;
3352 var ALWAYS_NORMALIZE = 2;
3353
3354 // wrapper function for providing a more flexible interface
3355 // without getting yelled at by flow
3356 function createElement (
3357 context,
3358 tag,
3359 data,
3360 children,
3361 normalizationType,
3362 alwaysNormalize
3363 ) {
3364 if (Array.isArray(data) || isPrimitive(data)) {
3365 normalizationType = children;
3366 children = data;
3367 data = undefined;
3368 }
3369 if (isTrue(alwaysNormalize)) {
3370 normalizationType = ALWAYS_NORMALIZE;
3371 }
3372 return _createElement(context, tag, data, children, normalizationType)
3373 }
3374
3375 function _createElement (
3376 context,
3377 tag,
3378 data,
3379 children,
3380 normalizationType
3381 ) {
3382 if (isDef(data) && isDef((data).__ob__)) {
3383 warn(
3384 "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
3385 'Always create fresh vnode data objects in each render!',
3386 context
3387 );
3388 return createEmptyVNode()
3389 }
3390 // object syntax in v-bind
3391 if (isDef(data) && isDef(data.is)) {
3392 tag = data.is;
3393 }
3394 if (!tag) {
3395 // in case of component :is set to falsy value
3396 return createEmptyVNode()
3397 }
3398 // warn against non-primitive key
3399 if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
3400 ) {
3401 {
3402 warn(
3403 'Avoid using non-primitive value as key, ' +
3404 'use string/number value instead.',
3405 context
3406 );
3407 }
3408 }
3409 // support single function children as default scoped slot
3410 if (Array.isArray(children) &&
3411 typeof children[0] === 'function'
3412 ) {
3413 data = data || {};
3414 data.scopedSlots = { default: children[0] };
3415 children.length = 0;
3416 }
3417 if (normalizationType === ALWAYS_NORMALIZE) {
3418 children = normalizeChildren(children);
3419 } else if (normalizationType === SIMPLE_NORMALIZE) {
3420 children = simpleNormalizeChildren(children);
3421 }
3422 var vnode, ns;
3423 if (typeof tag === 'string') {
3424 var Ctor;
3425 ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
3426 if (config.isReservedTag(tag)) {
3427 // platform built-in elements
3428 if (isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {
3429 warn(
3430 ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
3431 context
3432 );
3433 }
3434 vnode = new VNode(
3435 config.parsePlatformTagName(tag), data, children,
3436 undefined, undefined, context
3437 );
3438 } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
3439 // component
3440 vnode = createComponent(Ctor, data, context, children, tag);
3441 } else {
3442 // unknown or unlisted namespaced elements
3443 // check at runtime because it may get assigned a namespace when its
3444 // parent normalizes children
3445 vnode = new VNode(
3446 tag, data, children,
3447 undefined, undefined, context
3448 );
3449 }
3450 } else {
3451 // direct component options / constructor
3452 vnode = createComponent(tag, data, context, children);
3453 }
3454 if (Array.isArray(vnode)) {
3455 return vnode
3456 } else if (isDef(vnode)) {
3457 if (isDef(ns)) { applyNS(vnode, ns); }
3458 if (isDef(data)) { registerDeepBindings(data); }
3459 return vnode
3460 } else {
3461 return createEmptyVNode()
3462 }
3463 }
3464
3465 function applyNS (vnode, ns, force) {
3466 vnode.ns = ns;
3467 if (vnode.tag === 'foreignObject') {
3468 // use default namespace inside foreignObject
3469 ns = undefined;
3470 force = true;
3471 }
3472 if (isDef(vnode.children)) {
3473 for (var i = 0, l = vnode.children.length; i < l; i++) {
3474 var child = vnode.children[i];
3475 if (isDef(child.tag) && (
3476 isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
3477 applyNS(child, ns, force);
3478 }
3479 }
3480 }
3481 }
3482
3483 // ref #5318
3484 // necessary to ensure parent re-render when deep bindings like :style and
3485 // :class are used on slot nodes
3486 function registerDeepBindings (data) {
3487 if (isObject(data.style)) {
3488 traverse(data.style);
3489 }
3490 if (isObject(data.class)) {
3491 traverse(data.class);
3492 }
3493 }
3494
3495 /* */
3496
3497 function initRender (vm) {
3498 vm._vnode = null; // the root of the child tree
3499 vm._staticTrees = null; // v-once cached trees
3500 var options = vm.$options;
3501 var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
3502 var renderContext = parentVnode && parentVnode.context;
3503 vm.$slots = resolveSlots(options._renderChildren, renderContext);
3504 vm.$scopedSlots = emptyObject;
3505 // bind the createElement fn to this instance
3506 // so that we get proper render context inside it.
3507 // args order: tag, data, children, normalizationType, alwaysNormalize
3508 // internal version is used by render functions compiled from templates
3509 vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
3510 // normalization is always applied for the public version, used in
3511 // user-written render functions.
3512 vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
3513
3514 // $attrs & $listeners are exposed for easier HOC creation.
3515 // they need to be reactive so that HOCs using them are always updated
3516 var parentData = parentVnode && parentVnode.data;
3517
3518 /* istanbul ignore else */
3519 {
3520 defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
3521 !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
3522 }, true);
3523 defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
3524 !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
3525 }, true);
3526 }
3527 }
3528
3529 var currentRenderingInstance = null;
3530
3531 function renderMixin (Vue) {
3532 // install runtime convenience helpers
3533 installRenderHelpers(Vue.prototype);
3534
3535 Vue.prototype.$nextTick = function (fn) {
3536 return nextTick(fn, this)
3537 };
3538
3539 Vue.prototype._render = function () {
3540 var vm = this;
3541 var ref = vm.$options;
3542 var render = ref.render;
3543 var _parentVnode = ref._parentVnode;
3544
3545 if (_parentVnode) {
3546 vm.$scopedSlots = normalizeScopedSlots(
3547 _parentVnode.data.scopedSlots,
3548 vm.$slots,
3549 vm.$scopedSlots
3550 );
3551 }
3552
3553 // set parent vnode. this allows render functions to have access
3554 // to the data on the placeholder node.
3555 vm.$vnode = _parentVnode;
3556 // render self
3557 var vnode;
3558 try {
3559 // There's no need to maintain a stack because all render fns are called
3560 // separately from one another. Nested component's render fns are called
3561 // when parent component is patched.
3562 currentRenderingInstance = vm;
3563 vnode = render.call(vm._renderProxy, vm.$createElement);
3564 } catch (e) {
3565 handleError(e, vm, "render");
3566 // return error render result,
3567 // or previous vnode to prevent render error causing blank component
3568 /* istanbul ignore else */
3569 if (vm.$options.renderError) {
3570 try {
3571 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
3572 } catch (e) {
3573 handleError(e, vm, "renderError");
3574 vnode = vm._vnode;
3575 }
3576 } else {
3577 vnode = vm._vnode;
3578 }
3579 } finally {
3580 currentRenderingInstance = null;
3581 }
3582 // if the returned array contains only a single node, allow it
3583 if (Array.isArray(vnode) && vnode.length === 1) {
3584 vnode = vnode[0];
3585 }
3586 // return empty vnode in case the render function errored out
3587 if (!(vnode instanceof VNode)) {
3588 if (Array.isArray(vnode)) {
3589 warn(
3590 'Multiple root nodes returned from render function. Render function ' +
3591 'should return a single root node.',
3592 vm
3593 );
3594 }
3595 vnode = createEmptyVNode();
3596 }
3597 // set parent
3598 vnode.parent = _parentVnode;
3599 return vnode
3600 };
3601 }
3602
3603 /* */
3604
3605 function ensureCtor (comp, base) {
3606 if (
3607 comp.__esModule ||
3608 (hasSymbol && comp[Symbol.toStringTag] === 'Module')
3609 ) {
3610 comp = comp.default;
3611 }
3612 return isObject(comp)
3613 ? base.extend(comp)
3614 : comp
3615 }
3616
3617 function createAsyncPlaceholder (
3618 factory,
3619 data,
3620 context,
3621 children,
3622 tag
3623 ) {
3624 var node = createEmptyVNode();
3625 node.asyncFactory = factory;
3626 node.asyncMeta = { data: data, context: context, children: children, tag: tag };
3627 return node
3628 }
3629
3630 function resolveAsyncComponent (
3631 factory,
3632 baseCtor
3633 ) {
3634 if (isTrue(factory.error) && isDef(factory.errorComp)) {
3635 return factory.errorComp
3636 }
3637
3638 if (isDef(factory.resolved)) {
3639 return factory.resolved
3640 }
3641
3642 var owner = currentRenderingInstance;
3643 if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3644 // already pending
3645 factory.owners.push(owner);
3646 }
3647
3648 if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3649 return factory.loadingComp
3650 }
3651
3652 if (owner && !isDef(factory.owners)) {
3653 var owners = factory.owners = [owner];
3654 var sync = true;
3655 var timerLoading = null;
3656 var timerTimeout = null
3657
3658 ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3659
3660 var forceRender = function (renderCompleted) {
3661 for (var i = 0, l = owners.length; i < l; i++) {
3662 (owners[i]).$forceUpdate();
3663 }
3664
3665 if (renderCompleted) {
3666 owners.length = 0;
3667 if (timerLoading !== null) {
3668 clearTimeout(timerLoading);
3669 timerLoading = null;
3670 }
3671 if (timerTimeout !== null) {
3672 clearTimeout(timerTimeout);
3673 timerTimeout = null;
3674 }
3675 }
3676 };
3677
3678 var resolve = once(function (res) {
3679 // cache resolved
3680 factory.resolved = ensureCtor(res, baseCtor);
3681 // invoke callbacks only if this is not a synchronous resolve
3682 // (async resolves are shimmed as synchronous during SSR)
3683 if (!sync) {
3684 forceRender(true);
3685 } else {
3686 owners.length = 0;
3687 }
3688 });
3689
3690 var reject = once(function (reason) {
3691 warn(
3692 "Failed to resolve async component: " + (String(factory)) +
3693 (reason ? ("\nReason: " + reason) : '')
3694 );
3695 if (isDef(factory.errorComp)) {
3696 factory.error = true;
3697 forceRender(true);
3698 }
3699 });
3700
3701 var res = factory(resolve, reject);
3702
3703 if (isObject(res)) {
3704 if (isPromise(res)) {
3705 // () => Promise
3706 if (isUndef(factory.resolved)) {
3707 res.then(resolve, reject);
3708 }
3709 } else if (isPromise(res.component)) {
3710 res.component.then(resolve, reject);
3711
3712 if (isDef(res.error)) {
3713 factory.errorComp = ensureCtor(res.error, baseCtor);
3714 }
3715
3716 if (isDef(res.loading)) {
3717 factory.loadingComp = ensureCtor(res.loading, baseCtor);
3718 if (res.delay === 0) {
3719 factory.loading = true;
3720 } else {
3721 timerLoading = setTimeout(function () {
3722 timerLoading = null;
3723 if (isUndef(factory.resolved) && isUndef(factory.error)) {
3724 factory.loading = true;
3725 forceRender(false);
3726 }
3727 }, res.delay || 200);
3728 }
3729 }
3730
3731 if (isDef(res.timeout)) {
3732 timerTimeout = setTimeout(function () {
3733 timerTimeout = null;
3734 if (isUndef(factory.resolved)) {
3735 reject(
3736 "timeout (" + (res.timeout) + "ms)"
3737 );
3738 }
3739 }, res.timeout);
3740 }
3741 }
3742 }
3743
3744 sync = false;
3745 // return in case resolved synchronously
3746 return factory.loading
3747 ? factory.loadingComp
3748 : factory.resolved
3749 }
3750 }
3751
3752 /* */
3753
3754 function getFirstComponentChild (children) {
3755 if (Array.isArray(children)) {
3756 for (var i = 0; i < children.length; i++) {
3757 var c = children[i];
3758 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
3759 return c
3760 }
3761 }
3762 }
3763 }
3764
3765 /* */
3766
3767 /* */
3768
3769 function initEvents (vm) {
3770 vm._events = Object.create(null);
3771 vm._hasHookEvent = false;
3772 // init parent attached events
3773 var listeners = vm.$options._parentListeners;
3774 if (listeners) {
3775 updateComponentListeners(vm, listeners);
3776 }
3777 }
3778
3779 var target;
3780
3781 function add (event, fn) {
3782 target.$on(event, fn);
3783 }
3784
3785 function remove$1 (event, fn) {
3786 target.$off(event, fn);
3787 }
3788
3789 function createOnceHandler (event, fn) {
3790 var _target = target;
3791 return function onceHandler () {
3792 var res = fn.apply(null, arguments);
3793 if (res !== null) {
3794 _target.$off(event, onceHandler);
3795 }
3796 }
3797 }
3798
3799 function updateComponentListeners (
3800 vm,
3801 listeners,
3802 oldListeners
3803 ) {
3804 target = vm;
3805 updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
3806 target = undefined;
3807 }
3808
3809 function eventsMixin (Vue) {
3810 var hookRE = /^hook:/;
3811 Vue.prototype.$on = function (event, fn) {
3812 var vm = this;
3813 if (Array.isArray(event)) {
3814 for (var i = 0, l = event.length; i < l; i++) {
3815 vm.$on(event[i], fn);
3816 }
3817 } else {
3818 (vm._events[event] || (vm._events[event] = [])).push(fn);
3819 // optimize hook:event cost by using a boolean flag marked at registration
3820 // instead of a hash lookup
3821 if (hookRE.test(event)) {
3822 vm._hasHookEvent = true;
3823 }
3824 }
3825 return vm
3826 };
3827
3828 Vue.prototype.$once = function (event, fn) {
3829 var vm = this;
3830 function on () {
3831 vm.$off(event, on);
3832 fn.apply(vm, arguments);
3833 }
3834 on.fn = fn;
3835 vm.$on(event, on);
3836 return vm
3837 };
3838
3839 Vue.prototype.$off = function (event, fn) {
3840 var vm = this;
3841 // all
3842 if (!arguments.length) {
3843 vm._events = Object.create(null);
3844 return vm
3845 }
3846 // array of events
3847 if (Array.isArray(event)) {
3848 for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
3849 vm.$off(event[i$1], fn);
3850 }
3851 return vm
3852 }
3853 // specific event
3854 var cbs = vm._events[event];
3855 if (!cbs) {
3856 return vm
3857 }
3858 if (!fn) {
3859 vm._events[event] = null;
3860 return vm
3861 }
3862 // specific handler
3863 var cb;
3864 var i = cbs.length;
3865 while (i--) {
3866 cb = cbs[i];
3867 if (cb === fn || cb.fn === fn) {
3868 cbs.splice(i, 1);
3869 break
3870 }
3871 }
3872 return vm
3873 };
3874
3875 Vue.prototype.$emit = function (event) {
3876 var vm = this;
3877 {
3878 var lowerCaseEvent = event.toLowerCase();
3879 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
3880 tip(
3881 "Event \"" + lowerCaseEvent + "\" is emitted in component " +
3882 (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
3883 "Note that HTML attributes are case-insensitive and you cannot use " +
3884 "v-on to listen to camelCase events when using in-DOM templates. " +
3885 "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
3886 );
3887 }
3888 }
3889 var cbs = vm._events[event];
3890 if (cbs) {
3891 cbs = cbs.length > 1 ? toArray(cbs) : cbs;
3892 var args = toArray(arguments, 1);
3893 var info = "event handler for \"" + event + "\"";
3894 for (var i = 0, l = cbs.length; i < l; i++) {
3895 invokeWithErrorHandling(cbs[i], vm, args, vm, info);
3896 }
3897 }
3898 return vm
3899 };
3900 }
3901
3902 /* */
3903
3904 var activeInstance = null;
3905 var isUpdatingChildComponent = false;
3906
3907 function setActiveInstance(vm) {
3908 var prevActiveInstance = activeInstance;
3909 activeInstance = vm;
3910 return function () {
3911 activeInstance = prevActiveInstance;
3912 }
3913 }
3914
3915 function initLifecycle (vm) {
3916 var options = vm.$options;
3917
3918 // locate first non-abstract parent
3919 var parent = options.parent;
3920 if (parent && !options.abstract) {
3921 while (parent.$options.abstract && parent.$parent) {
3922 parent = parent.$parent;
3923 }
3924 parent.$children.push(vm);
3925 }
3926
3927 vm.$parent = parent;
3928 vm.$root = parent ? parent.$root : vm;
3929
3930 vm.$children = [];
3931 vm.$refs = {};
3932
3933 vm._watcher = null;
3934 vm._inactive = null;
3935 vm._directInactive = false;
3936 vm._isMounted = false;
3937 vm._isDestroyed = false;
3938 vm._isBeingDestroyed = false;
3939 }
3940
3941 function lifecycleMixin (Vue) {
3942 Vue.prototype._update = function (vnode, hydrating) {
3943 var vm = this;
3944 var prevEl = vm.$el;
3945 var prevVnode = vm._vnode;
3946 var restoreActiveInstance = setActiveInstance(vm);
3947 vm._vnode = vnode;
3948 // Vue.prototype.__patch__ is injected in entry points
3949 // based on the rendering backend used.
3950 if (!prevVnode) {
3951 // initial render
3952 vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
3953 } else {
3954 // updates
3955 vm.$el = vm.__patch__(prevVnode, vnode);
3956 }
3957 restoreActiveInstance();
3958 // update __vue__ reference
3959 if (prevEl) {
3960 prevEl.__vue__ = null;
3961 }
3962 if (vm.$el) {
3963 vm.$el.__vue__ = vm;
3964 }
3965 // if parent is an HOC, update its $el as well
3966 if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
3967 vm.$parent.$el = vm.$el;
3968 }
3969 // updated hook is called by the scheduler to ensure that children are
3970 // updated in a parent's updated hook.
3971 };
3972
3973 Vue.prototype.$forceUpdate = function () {
3974 var vm = this;
3975 if (vm._watcher) {
3976 vm._watcher.update();
3977 }
3978 };
3979
3980 Vue.prototype.$destroy = function () {
3981 var vm = this;
3982 if (vm._isBeingDestroyed) {
3983 return
3984 }
3985 callHook(vm, 'beforeDestroy');
3986 vm._isBeingDestroyed = true;
3987 // remove self from parent
3988 var parent = vm.$parent;
3989 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
3990 remove(parent.$children, vm);
3991 }
3992 // teardown watchers
3993 if (vm._watcher) {
3994 vm._watcher.teardown();
3995 }
3996 var i = vm._watchers.length;
3997 while (i--) {
3998 vm._watchers[i].teardown();
3999 }
4000 // remove reference from data ob
4001 // frozen object may not have observer.
4002 if (vm._data.__ob__) {
4003 vm._data.__ob__.vmCount--;
4004 }
4005 // call the last hook...
4006 vm._isDestroyed = true;
4007 // invoke destroy hooks on current rendered tree
4008 vm.__patch__(vm._vnode, null);
4009 // fire destroyed hook
4010 callHook(vm, 'destroyed');
4011 // turn off all instance listeners.
4012 vm.$off();
4013 // remove __vue__ reference
4014 if (vm.$el) {
4015 vm.$el.__vue__ = null;
4016 }
4017 // release circular reference (#6759)
4018 if (vm.$vnode) {
4019 vm.$vnode.parent = null;
4020 }
4021 };
4022 }
4023
4024 function mountComponent (
4025 vm,
4026 el,
4027 hydrating
4028 ) {
4029 vm.$el = el;
4030 if (!vm.$options.render) {
4031 vm.$options.render = createEmptyVNode;
4032 {
4033 /* istanbul ignore if */
4034 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
4035 vm.$options.el || el) {
4036 warn(
4037 'You are using the runtime-only build of Vue where the template ' +
4038 'compiler is not available. Either pre-compile the templates into ' +
4039 'render functions, or use the compiler-included build.',
4040 vm
4041 );
4042 } else {
4043 warn(
4044 'Failed to mount component: template or render function not defined.',
4045 vm
4046 );
4047 }
4048 }
4049 }
4050 callHook(vm, 'beforeMount');
4051
4052 var updateComponent;
4053 /* istanbul ignore if */
4054 if (config.performance && mark) {
4055 updateComponent = function () {
4056 var name = vm._name;
4057 var id = vm._uid;
4058 var startTag = "vue-perf-start:" + id;
4059 var endTag = "vue-perf-end:" + id;
4060
4061 mark(startTag);
4062 var vnode = vm._render();
4063 mark(endTag);
4064 measure(("vue " + name + " render"), startTag, endTag);
4065
4066 mark(startTag);
4067 vm._update(vnode, hydrating);
4068 mark(endTag);
4069 measure(("vue " + name + " patch"), startTag, endTag);
4070 };
4071 } else {
4072 updateComponent = function () {
4073 vm._update(vm._render(), hydrating);
4074 };
4075 }
4076
4077 // we set this to vm._watcher inside the watcher's constructor
4078 // since the watcher's initial patch may call $forceUpdate (e.g. inside child
4079 // component's mounted hook), which relies on vm._watcher being already defined
4080 new Watcher(vm, updateComponent, noop, {
4081 before: function before () {
4082 if (vm._isMounted && !vm._isDestroyed) {
4083 callHook(vm, 'beforeUpdate');
4084 }
4085 }
4086 }, true /* isRenderWatcher */);
4087 hydrating = false;
4088
4089 // manually mounted instance, call mounted on self
4090 // mounted is called for render-created child components in its inserted hook
4091 if (vm.$vnode == null) {
4092 vm._isMounted = true;
4093 callHook(vm, 'mounted');
4094 }
4095 return vm
4096 }
4097
4098 function updateChildComponent (
4099 vm,
4100 propsData,
4101 listeners,
4102 parentVnode,
4103 renderChildren
4104 ) {
4105 {
4106 isUpdatingChildComponent = true;
4107 }
4108
4109 // determine whether component has slot children
4110 // we need to do this before overwriting $options._renderChildren.
4111
4112 // check if there are dynamic scopedSlots (hand-written or compiled but with
4113 // dynamic slot names). Static scoped slots compiled from template has the
4114 // "$stable" marker.
4115 var newScopedSlots = parentVnode.data.scopedSlots;
4116 var oldScopedSlots = vm.$scopedSlots;
4117 var hasDynamicScopedSlot = !!(
4118 (newScopedSlots && !newScopedSlots.$stable) ||
4119 (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4120 (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
4121 (!newScopedSlots && vm.$scopedSlots.$key)
4122 );
4123
4124 // Any static slot children from the parent may have changed during parent's
4125 // update. Dynamic scoped slots may also have changed. In such cases, a forced
4126 // update is necessary to ensure correctness.
4127 var needsForceUpdate = !!(
4128 renderChildren || // has new static slots
4129 vm.$options._renderChildren || // has old static slots
4130 hasDynamicScopedSlot
4131 );
4132
4133 vm.$options._parentVnode = parentVnode;
4134 vm.$vnode = parentVnode; // update vm's placeholder node without re-render
4135
4136 if (vm._vnode) { // update child tree's parent
4137 vm._vnode.parent = parentVnode;
4138 }
4139 vm.$options._renderChildren = renderChildren;
4140
4141 // update $attrs and $listeners hash
4142 // these are also reactive so they may trigger child update if the child
4143 // used them during render
4144 vm.$attrs = parentVnode.data.attrs || emptyObject;
4145 vm.$listeners = listeners || emptyObject;
4146
4147 // update props
4148 if (propsData && vm.$options.props) {
4149 toggleObserving(false);
4150 var props = vm._props;
4151 var propKeys = vm.$options._propKeys || [];
4152 for (var i = 0; i < propKeys.length; i++) {
4153 var key = propKeys[i];
4154 var propOptions = vm.$options.props; // wtf flow?
4155 props[key] = validateProp(key, propOptions, propsData, vm);
4156 }
4157 toggleObserving(true);
4158 // keep a copy of raw propsData
4159 vm.$options.propsData = propsData;
4160 }
4161
4162 // update listeners
4163 listeners = listeners || emptyObject;
4164 var oldListeners = vm.$options._parentListeners;
4165 vm.$options._parentListeners = listeners;
4166 updateComponentListeners(vm, listeners, oldListeners);
4167
4168 // resolve slots + force update if has children
4169 if (needsForceUpdate) {
4170 vm.$slots = resolveSlots(renderChildren, parentVnode.context);
4171 vm.$forceUpdate();
4172 }
4173
4174 {
4175 isUpdatingChildComponent = false;
4176 }
4177 }
4178
4179 function isInInactiveTree (vm) {
4180 while (vm && (vm = vm.$parent)) {
4181 if (vm._inactive) { return true }
4182 }
4183 return false
4184 }
4185
4186 function activateChildComponent (vm, direct) {
4187 if (direct) {
4188 vm._directInactive = false;
4189 if (isInInactiveTree(vm)) {
4190 return
4191 }
4192 } else if (vm._directInactive) {
4193 return
4194 }
4195 if (vm._inactive || vm._inactive === null) {
4196 vm._inactive = false;
4197 for (var i = 0; i < vm.$children.length; i++) {
4198 activateChildComponent(vm.$children[i]);
4199 }
4200 callHook(vm, 'activated');
4201 }
4202 }
4203
4204 function deactivateChildComponent (vm, direct) {
4205 if (direct) {
4206 vm._directInactive = true;
4207 if (isInInactiveTree(vm)) {
4208 return
4209 }
4210 }
4211 if (!vm._inactive) {
4212 vm._inactive = true;
4213 for (var i = 0; i < vm.$children.length; i++) {
4214 deactivateChildComponent(vm.$children[i]);
4215 }
4216 callHook(vm, 'deactivated');
4217 }
4218 }
4219
4220 function callHook (vm, hook) {
4221 // #7573 disable dep collection when invoking lifecycle hooks
4222 pushTarget();
4223 var handlers = vm.$options[hook];
4224 var info = hook + " hook";
4225 if (handlers) {
4226 for (var i = 0, j = handlers.length; i < j; i++) {
4227 invokeWithErrorHandling(handlers[i], vm, null, vm, info);
4228 }
4229 }
4230 if (vm._hasHookEvent) {
4231 vm.$emit('hook:' + hook);
4232 }
4233 popTarget();
4234 }
4235
4236 /* */
4237
4238 var MAX_UPDATE_COUNT = 100;
4239
4240 var queue = [];
4241 var activatedChildren = [];
4242 var has = {};
4243 var circular = {};
4244 var waiting = false;
4245 var flushing = false;
4246 var index = 0;
4247
4248 /**
4249 * Reset the scheduler's state.
4250 */
4251 function resetSchedulerState () {
4252 index = queue.length = activatedChildren.length = 0;
4253 has = {};
4254 {
4255 circular = {};
4256 }
4257 waiting = flushing = false;
4258 }
4259
4260 // Async edge case #6566 requires saving the timestamp when event listeners are
4261 // attached. However, calling performance.now() has a perf overhead especially
4262 // if the page has thousands of event listeners. Instead, we take a timestamp
4263 // every time the scheduler flushes and use that for all event listeners
4264 // attached during that flush.
4265 var currentFlushTimestamp = 0;
4266
4267 // Async edge case fix requires storing an event listener's attach timestamp.
4268 var getNow = Date.now;
4269
4270 // Determine what event timestamp the browser is using. Annoyingly, the
4271 // timestamp can either be hi-res (relative to page load) or low-res
4272 // (relative to UNIX epoch), so in order to compare time we have to use the
4273 // same timestamp type when saving the flush timestamp.
4274 // All IE versions use low-res event timestamps, and have problematic clock
4275 // implementations (#9632)
4276 if (inBrowser && !isIE) {
4277 var performance = window.performance;
4278 if (
4279 performance &&
4280 typeof performance.now === 'function' &&
4281 getNow() > document.createEvent('Event').timeStamp
4282 ) {
4283 // if the event timestamp, although evaluated AFTER the Date.now(), is
4284 // smaller than it, it means the event is using a hi-res timestamp,
4285 // and we need to use the hi-res version for event listener timestamps as
4286 // well.
4287 getNow = function () { return performance.now(); };
4288 }
4289 }
4290
4291 /**
4292 * Flush both queues and run the watchers.
4293 */
4294 function flushSchedulerQueue () {
4295 currentFlushTimestamp = getNow();
4296 flushing = true;
4297 var watcher, id;
4298
4299 // Sort queue before flush.
4300 // This ensures that:
4301 // 1. Components are updated from parent to child. (because parent is always
4302 // created before the child)
4303 // 2. A component's user watchers are run before its render watcher (because
4304 // user watchers are created before the render watcher)
4305 // 3. If a component is destroyed during a parent component's watcher run,
4306 // its watchers can be skipped.
4307 queue.sort(function (a, b) { return a.id - b.id; });
4308
4309 // do not cache length because more watchers might be pushed
4310 // as we run existing watchers
4311 for (index = 0; index < queue.length; index++) {
4312 watcher = queue[index];
4313 if (watcher.before) {
4314 watcher.before();
4315 }
4316 id = watcher.id;
4317 has[id] = null;
4318 watcher.run();
4319 // in dev build, check and stop circular updates.
4320 if (has[id] != null) {
4321 circular[id] = (circular[id] || 0) + 1;
4322 if (circular[id] > MAX_UPDATE_COUNT) {
4323 warn(
4324 'You may have an infinite update loop ' + (
4325 watcher.user
4326 ? ("in watcher with expression \"" + (watcher.expression) + "\"")
4327 : "in a component render function."
4328 ),
4329 watcher.vm
4330 );
4331 break
4332 }
4333 }
4334 }
4335
4336 // keep copies of post queues before resetting state
4337 var activatedQueue = activatedChildren.slice();
4338 var updatedQueue = queue.slice();
4339
4340 resetSchedulerState();
4341
4342 // call component updated and activated hooks
4343 callActivatedHooks(activatedQueue);
4344 callUpdatedHooks(updatedQueue);
4345
4346 // devtool hook
4347 /* istanbul ignore if */
4348 if (devtools && config.devtools) {
4349 devtools.emit('flush');
4350 }
4351 }
4352
4353 function callUpdatedHooks (queue) {
4354 var i = queue.length;
4355 while (i--) {
4356 var watcher = queue[i];
4357 var vm = watcher.vm;
4358 if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
4359 callHook(vm, 'updated');
4360 }
4361 }
4362 }
4363
4364 /**
4365 * Queue a kept-alive component that was activated during patch.
4366 * The queue will be processed after the entire tree has been patched.
4367 */
4368 function queueActivatedComponent (vm) {
4369 // setting _inactive to false here so that a render function can
4370 // rely on checking whether it's in an inactive tree (e.g. router-view)
4371 vm._inactive = false;
4372 activatedChildren.push(vm);
4373 }
4374
4375 function callActivatedHooks (queue) {
4376 for (var i = 0; i < queue.length; i++) {
4377 queue[i]._inactive = true;
4378 activateChildComponent(queue[i], true /* true */);
4379 }
4380 }
4381
4382 /**
4383 * Push a watcher into the watcher queue.
4384 * Jobs with duplicate IDs will be skipped unless it's
4385 * pushed when the queue is being flushed.
4386 */
4387 function queueWatcher (watcher) {
4388 var id = watcher.id;
4389 if (has[id] == null) {
4390 has[id] = true;
4391 if (!flushing) {
4392 queue.push(watcher);
4393 } else {
4394 // if already flushing, splice the watcher based on its id
4395 // if already past its id, it will be run next immediately.
4396 var i = queue.length - 1;
4397 while (i > index && queue[i].id > watcher.id) {
4398 i--;
4399 }
4400 queue.splice(i + 1, 0, watcher);
4401 }
4402 // queue the flush
4403 if (!waiting) {
4404 waiting = true;
4405
4406 if (!config.async) {
4407 flushSchedulerQueue();
4408 return
4409 }
4410 nextTick(flushSchedulerQueue);
4411 }
4412 }
4413 }
4414
4415 /* */
4416
4417
4418
4419 var uid$2 = 0;
4420
4421 /**
4422 * A watcher parses an expression, collects dependencies,
4423 * and fires callback when the expression value changes.
4424 * This is used for both the $watch() api and directives.
4425 */
4426 var Watcher = function Watcher (
4427 vm,
4428 expOrFn,
4429 cb,
4430 options,
4431 isRenderWatcher
4432 ) {
4433 this.vm = vm;
4434 if (isRenderWatcher) {
4435 vm._watcher = this;
4436 }
4437 vm._watchers.push(this);
4438 // options
4439 if (options) {
4440 this.deep = !!options.deep;
4441 this.user = !!options.user;
4442 this.lazy = !!options.lazy;
4443 this.sync = !!options.sync;
4444 this.before = options.before;
4445 } else {
4446 this.deep = this.user = this.lazy = this.sync = false;
4447 }
4448 this.cb = cb;
4449 this.id = ++uid$2; // uid for batching
4450 this.active = true;
4451 this.dirty = this.lazy; // for lazy watchers
4452 this.deps = [];
4453 this.newDeps = [];
4454 this.depIds = new _Set();
4455 this.newDepIds = new _Set();
4456 this.expression = expOrFn.toString();
4457 // parse expression for getter
4458 if (typeof expOrFn === 'function') {
4459 this.getter = expOrFn;
4460 } else {
4461 this.getter = parsePath(expOrFn);
4462 if (!this.getter) {
4463 this.getter = noop;
4464 warn(
4465 "Failed watching path: \"" + expOrFn + "\" " +
4466 'Watcher only accepts simple dot-delimited paths. ' +
4467 'For full control, use a function instead.',
4468 vm
4469 );
4470 }
4471 }
4472 this.value = this.lazy
4473 ? undefined
4474 : this.get();
4475 };
4476
4477 /**
4478 * Evaluate the getter, and re-collect dependencies.
4479 */
4480 Watcher.prototype.get = function get () {
4481 pushTarget(this);
4482 var value;
4483 var vm = this.vm;
4484 try {
4485 value = this.getter.call(vm, vm);
4486 } catch (e) {
4487 if (this.user) {
4488 handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
4489 } else {
4490 throw e
4491 }
4492 } finally {
4493 // "touch" every property so they are all tracked as
4494 // dependencies for deep watching
4495 if (this.deep) {
4496 traverse(value);
4497 }
4498 popTarget();
4499 this.cleanupDeps();
4500 }
4501 return value
4502 };
4503
4504 /**
4505 * Add a dependency to this directive.
4506 */
4507 Watcher.prototype.addDep = function addDep (dep) {
4508 var id = dep.id;
4509 if (!this.newDepIds.has(id)) {
4510 this.newDepIds.add(id);
4511 this.newDeps.push(dep);
4512 if (!this.depIds.has(id)) {
4513 dep.addSub(this);
4514 }
4515 }
4516 };
4517
4518 /**
4519 * Clean up for dependency collection.
4520 */
4521 Watcher.prototype.cleanupDeps = function cleanupDeps () {
4522 var i = this.deps.length;
4523 while (i--) {
4524 var dep = this.deps[i];
4525 if (!this.newDepIds.has(dep.id)) {
4526 dep.removeSub(this);
4527 }
4528 }
4529 var tmp = this.depIds;
4530 this.depIds = this.newDepIds;
4531 this.newDepIds = tmp;
4532 this.newDepIds.clear();
4533 tmp = this.deps;
4534 this.deps = this.newDeps;
4535 this.newDeps = tmp;
4536 this.newDeps.length = 0;
4537 };
4538
4539 /**
4540 * Subscriber interface.
4541 * Will be called when a dependency changes.
4542 */
4543 Watcher.prototype.update = function update () {
4544 /* istanbul ignore else */
4545 if (this.lazy) {
4546 this.dirty = true;
4547 } else if (this.sync) {
4548 this.run();
4549 } else {
4550 queueWatcher(this);
4551 }
4552 };
4553
4554 /**
4555 * Scheduler job interface.
4556 * Will be called by the scheduler.
4557 */
4558 Watcher.prototype.run = function run () {
4559 if (this.active) {
4560 var value = this.get();
4561 if (
4562 value !== this.value ||
4563 // Deep watchers and watchers on Object/Arrays should fire even
4564 // when the value is the same, because the value may
4565 // have mutated.
4566 isObject(value) ||
4567 this.deep
4568 ) {
4569 // set new value
4570 var oldValue = this.value;
4571 this.value = value;
4572 if (this.user) {
4573 var info = "callback for watcher \"" + (this.expression) + "\"";
4574 invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
4575 } else {
4576 this.cb.call(this.vm, value, oldValue);
4577 }
4578 }
4579 }
4580 };
4581
4582 /**
4583 * Evaluate the value of the watcher.
4584 * This only gets called for lazy watchers.
4585 */
4586 Watcher.prototype.evaluate = function evaluate () {
4587 this.value = this.get();
4588 this.dirty = false;
4589 };
4590
4591 /**
4592 * Depend on all deps collected by this watcher.
4593 */
4594 Watcher.prototype.depend = function depend () {
4595 var i = this.deps.length;
4596 while (i--) {
4597 this.deps[i].depend();
4598 }
4599 };
4600
4601 /**
4602 * Remove self from all dependencies' subscriber list.
4603 */
4604 Watcher.prototype.teardown = function teardown () {
4605 if (this.active) {
4606 // remove self from vm's watcher list
4607 // this is a somewhat expensive operation so we skip it
4608 // if the vm is being destroyed.
4609 if (!this.vm._isBeingDestroyed) {
4610 remove(this.vm._watchers, this);
4611 }
4612 var i = this.deps.length;
4613 while (i--) {
4614 this.deps[i].removeSub(this);
4615 }
4616 this.active = false;
4617 }
4618 };
4619
4620 /* */
4621
4622 var sharedPropertyDefinition = {
4623 enumerable: true,
4624 configurable: true,
4625 get: noop,
4626 set: noop
4627 };
4628
4629 function proxy (target, sourceKey, key) {
4630 sharedPropertyDefinition.get = function proxyGetter () {
4631 return this[sourceKey][key]
4632 };
4633 sharedPropertyDefinition.set = function proxySetter (val) {
4634 this[sourceKey][key] = val;
4635 };
4636 Object.defineProperty(target, key, sharedPropertyDefinition);
4637 }
4638
4639 function initState (vm) {
4640 vm._watchers = [];
4641 var opts = vm.$options;
4642 if (opts.props) { initProps(vm, opts.props); }
4643 if (opts.methods) { initMethods(vm, opts.methods); }
4644 if (opts.data) {
4645 initData(vm);
4646 } else {
4647 observe(vm._data = {}, true /* asRootData */);
4648 }
4649 if (opts.computed) { initComputed(vm, opts.computed); }
4650 if (opts.watch && opts.watch !== nativeWatch) {
4651 initWatch(vm, opts.watch);
4652 }
4653 }
4654
4655 function initProps (vm, propsOptions) {
4656 var propsData = vm.$options.propsData || {};
4657 var props = vm._props = {};
4658 // cache prop keys so that future props updates can iterate using Array
4659 // instead of dynamic object key enumeration.
4660 var keys = vm.$options._propKeys = [];
4661 var isRoot = !vm.$parent;
4662 // root instance props should be converted
4663 if (!isRoot) {
4664 toggleObserving(false);
4665 }
4666 var loop = function ( key ) {
4667 keys.push(key);
4668 var value = validateProp(key, propsOptions, propsData, vm);
4669 /* istanbul ignore else */
4670 {
4671 var hyphenatedKey = hyphenate(key);
4672 if (isReservedAttribute(hyphenatedKey) ||
4673 config.isReservedAttr(hyphenatedKey)) {
4674 warn(
4675 ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
4676 vm
4677 );
4678 }
4679 defineReactive$$1(props, key, value, function () {
4680 if (!isRoot && !isUpdatingChildComponent) {
4681 warn(
4682 "Avoid mutating a prop directly since the value will be " +
4683 "overwritten whenever the parent component re-renders. " +
4684 "Instead, use a data or computed property based on the prop's " +
4685 "value. Prop being mutated: \"" + key + "\"",
4686 vm
4687 );
4688 }
4689 });
4690 }
4691 // static props are already proxied on the component's prototype
4692 // during Vue.extend(). We only need to proxy props defined at
4693 // instantiation here.
4694 if (!(key in vm)) {
4695 proxy(vm, "_props", key);
4696 }
4697 };
4698
4699 for (var key in propsOptions) loop( key );
4700 toggleObserving(true);
4701 }
4702
4703 function initData (vm) {
4704 var data = vm.$options.data;
4705 data = vm._data = typeof data === 'function'
4706 ? getData(data, vm)
4707 : data || {};
4708 if (!isPlainObject(data)) {
4709 data = {};
4710 warn(
4711 'data functions should return an object:\n' +
4712 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
4713 vm
4714 );
4715 }
4716 // proxy data on instance
4717 var keys = Object.keys(data);
4718 var props = vm.$options.props;
4719 var methods = vm.$options.methods;
4720 var i = keys.length;
4721 while (i--) {
4722 var key = keys[i];
4723 {
4724 if (methods && hasOwn(methods, key)) {
4725 warn(
4726 ("Method \"" + key + "\" has already been defined as a data property."),
4727 vm
4728 );
4729 }
4730 }
4731 if (props && hasOwn(props, key)) {
4732 warn(
4733 "The data property \"" + key + "\" is already declared as a prop. " +
4734 "Use prop default value instead.",
4735 vm
4736 );
4737 } else if (!isReserved(key)) {
4738 proxy(vm, "_data", key);
4739 }
4740 }
4741 // observe data
4742 observe(data, true /* asRootData */);
4743 }
4744
4745 function getData (data, vm) {
4746 // #7573 disable dep collection when invoking data getters
4747 pushTarget();
4748 try {
4749 return data.call(vm, vm)
4750 } catch (e) {
4751 handleError(e, vm, "data()");
4752 return {}
4753 } finally {
4754 popTarget();
4755 }
4756 }
4757
4758 var computedWatcherOptions = { lazy: true };
4759
4760 function initComputed (vm, computed) {
4761 // $flow-disable-line
4762 var watchers = vm._computedWatchers = Object.create(null);
4763 // computed properties are just getters during SSR
4764 var isSSR = isServerRendering();
4765
4766 for (var key in computed) {
4767 var userDef = computed[key];
4768 var getter = typeof userDef === 'function' ? userDef : userDef.get;
4769 if (getter == null) {
4770 warn(
4771 ("Getter is missing for computed property \"" + key + "\"."),
4772 vm
4773 );
4774 }
4775
4776 if (!isSSR) {
4777 // create internal watcher for the computed property.
4778 watchers[key] = new Watcher(
4779 vm,
4780 getter || noop,
4781 noop,
4782 computedWatcherOptions
4783 );
4784 }
4785
4786 // component-defined computed properties are already defined on the
4787 // component prototype. We only need to define computed properties defined
4788 // at instantiation here.
4789 if (!(key in vm)) {
4790 defineComputed(vm, key, userDef);
4791 } else {
4792 if (key in vm.$data) {
4793 warn(("The computed property \"" + key + "\" is already defined in data."), vm);
4794 } else if (vm.$options.props && key in vm.$options.props) {
4795 warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
4796 } else if (vm.$options.methods && key in vm.$options.methods) {
4797 warn(("The computed property \"" + key + "\" is already defined as a method."), vm);
4798 }
4799 }
4800 }
4801 }
4802
4803 function defineComputed (
4804 target,
4805 key,
4806 userDef
4807 ) {
4808 var shouldCache = !isServerRendering();
4809 if (typeof userDef === 'function') {
4810 sharedPropertyDefinition.get = shouldCache
4811 ? createComputedGetter(key)
4812 : createGetterInvoker(userDef);
4813 sharedPropertyDefinition.set = noop;
4814 } else {
4815 sharedPropertyDefinition.get = userDef.get
4816 ? shouldCache && userDef.cache !== false
4817 ? createComputedGetter(key)
4818 : createGetterInvoker(userDef.get)
4819 : noop;
4820 sharedPropertyDefinition.set = userDef.set || noop;
4821 }
4822 if (sharedPropertyDefinition.set === noop) {
4823 sharedPropertyDefinition.set = function () {
4824 warn(
4825 ("Computed property \"" + key + "\" was assigned to but it has no setter."),
4826 this
4827 );
4828 };
4829 }
4830 Object.defineProperty(target, key, sharedPropertyDefinition);
4831 }
4832
4833 function createComputedGetter (key) {
4834 return function computedGetter () {
4835 var watcher = this._computedWatchers && this._computedWatchers[key];
4836 if (watcher) {
4837 if (watcher.dirty) {
4838 watcher.evaluate();
4839 }
4840 if (Dep.target) {
4841 watcher.depend();
4842 }
4843 return watcher.value
4844 }
4845 }
4846 }
4847
4848 function createGetterInvoker(fn) {
4849 return function computedGetter () {
4850 return fn.call(this, this)
4851 }
4852 }
4853
4854 function initMethods (vm, methods) {
4855 var props = vm.$options.props;
4856 for (var key in methods) {
4857 {
4858 if (typeof methods[key] !== 'function') {
4859 warn(
4860 "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
4861 "Did you reference the function correctly?",
4862 vm
4863 );
4864 }
4865 if (props && hasOwn(props, key)) {
4866 warn(
4867 ("Method \"" + key + "\" has already been defined as a prop."),
4868 vm
4869 );
4870 }
4871 if ((key in vm) && isReserved(key)) {
4872 warn(
4873 "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
4874 "Avoid defining component methods that start with _ or $."
4875 );
4876 }
4877 }
4878 vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
4879 }
4880 }
4881
4882 function initWatch (vm, watch) {
4883 for (var key in watch) {
4884 var handler = watch[key];
4885 if (Array.isArray(handler)) {
4886 for (var i = 0; i < handler.length; i++) {
4887 createWatcher(vm, key, handler[i]);
4888 }
4889 } else {
4890 createWatcher(vm, key, handler);
4891 }
4892 }
4893 }
4894
4895 function createWatcher (
4896 vm,
4897 expOrFn,
4898 handler,
4899 options
4900 ) {
4901 if (isPlainObject(handler)) {
4902 options = handler;
4903 handler = handler.handler;
4904 }
4905 if (typeof handler === 'string') {
4906 handler = vm[handler];
4907 }
4908 return vm.$watch(expOrFn, handler, options)
4909 }
4910
4911 function stateMixin (Vue) {
4912 // flow somehow has problems with directly declared definition object
4913 // when using Object.defineProperty, so we have to procedurally build up
4914 // the object here.
4915 var dataDef = {};
4916 dataDef.get = function () { return this._data };
4917 var propsDef = {};
4918 propsDef.get = function () { return this._props };
4919 {
4920 dataDef.set = function () {
4921 warn(
4922 'Avoid replacing instance root $data. ' +
4923 'Use nested data properties instead.',
4924 this
4925 );
4926 };
4927 propsDef.set = function () {
4928 warn("$props is readonly.", this);
4929 };
4930 }
4931 Object.defineProperty(Vue.prototype, '$data', dataDef);
4932 Object.defineProperty(Vue.prototype, '$props', propsDef);
4933
4934 Vue.prototype.$set = set;
4935 Vue.prototype.$delete = del;
4936
4937 Vue.prototype.$watch = function (
4938 expOrFn,
4939 cb,
4940 options
4941 ) {
4942 var vm = this;
4943 if (isPlainObject(cb)) {
4944 return createWatcher(vm, expOrFn, cb, options)
4945 }
4946 options = options || {};
4947 options.user = true;
4948 var watcher = new Watcher(vm, expOrFn, cb, options);
4949 if (options.immediate) {
4950 var info = "callback for immediate watcher \"" + (watcher.expression) + "\"";
4951 pushTarget();
4952 invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
4953 popTarget();
4954 }
4955 return function unwatchFn () {
4956 watcher.teardown();
4957 }
4958 };
4959 }
4960
4961 /* */
4962
4963 var uid$3 = 0;
4964
4965 function initMixin (Vue) {
4966 Vue.prototype._init = function (options) {
4967 var vm = this;
4968 // a uid
4969 vm._uid = uid$3++;
4970
4971 var startTag, endTag;
4972 /* istanbul ignore if */
4973 if (config.performance && mark) {
4974 startTag = "vue-perf-start:" + (vm._uid);
4975 endTag = "vue-perf-end:" + (vm._uid);
4976 mark(startTag);
4977 }
4978
4979 // a flag to avoid this being observed
4980 vm._isVue = true;
4981 // merge options
4982 if (options && options._isComponent) {
4983 // optimize internal component instantiation
4984 // since dynamic options merging is pretty slow, and none of the
4985 // internal component options needs special treatment.
4986 initInternalComponent(vm, options);
4987 } else {
4988 vm.$options = mergeOptions(
4989 resolveConstructorOptions(vm.constructor),
4990 options || {},
4991 vm
4992 );
4993 }
4994 /* istanbul ignore else */
4995 {
4996 initProxy(vm);
4997 }
4998 // expose real self
4999 vm._self = vm;
5000 initLifecycle(vm);
5001 initEvents(vm);
5002 initRender(vm);
5003 callHook(vm, 'beforeCreate');
5004 initInjections(vm); // resolve injections before data/props
5005 initState(vm);
5006 initProvide(vm); // resolve provide after data/props
5007 callHook(vm, 'created');
5008
5009 /* istanbul ignore if */
5010 if (config.performance && mark) {
5011 vm._name = formatComponentName(vm, false);
5012 mark(endTag);
5013 measure(("vue " + (vm._name) + " init"), startTag, endTag);
5014 }
5015
5016 if (vm.$options.el) {
5017 vm.$mount(vm.$options.el);
5018 }
5019 };
5020 }
5021
5022 function initInternalComponent (vm, options) {
5023 var opts = vm.$options = Object.create(vm.constructor.options);
5024 // doing this because it's faster than dynamic enumeration.
5025 var parentVnode = options._parentVnode;
5026 opts.parent = options.parent;
5027 opts._parentVnode = parentVnode;
5028
5029 var vnodeComponentOptions = parentVnode.componentOptions;
5030 opts.propsData = vnodeComponentOptions.propsData;
5031 opts._parentListeners = vnodeComponentOptions.listeners;
5032 opts._renderChildren = vnodeComponentOptions.children;
5033 opts._componentTag = vnodeComponentOptions.tag;
5034
5035 if (options.render) {
5036 opts.render = options.render;
5037 opts.staticRenderFns = options.staticRenderFns;
5038 }
5039 }
5040
5041 function resolveConstructorOptions (Ctor) {
5042 var options = Ctor.options;
5043 if (Ctor.super) {
5044 var superOptions = resolveConstructorOptions(Ctor.super);
5045 var cachedSuperOptions = Ctor.superOptions;
5046 if (superOptions !== cachedSuperOptions) {
5047 // super option changed,
5048 // need to resolve new options.
5049 Ctor.superOptions = superOptions;
5050 // check if there are any late-modified/attached options (#4976)
5051 var modifiedOptions = resolveModifiedOptions(Ctor);
5052 // update base extend options
5053 if (modifiedOptions) {
5054 extend(Ctor.extendOptions, modifiedOptions);
5055 }
5056 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
5057 if (options.name) {
5058 options.components[options.name] = Ctor;
5059 }
5060 }
5061 }
5062 return options
5063 }
5064
5065 function resolveModifiedOptions (Ctor) {
5066 var modified;
5067 var latest = Ctor.options;
5068 var sealed = Ctor.sealedOptions;
5069 for (var key in latest) {
5070 if (latest[key] !== sealed[key]) {
5071 if (!modified) { modified = {}; }
5072 modified[key] = latest[key];
5073 }
5074 }
5075 return modified
5076 }
5077
5078 function Vue (options) {
5079 if (!(this instanceof Vue)
5080 ) {
5081 warn('Vue is a constructor and should be called with the `new` keyword');
5082 }
5083 this._init(options);
5084 }
5085
5086 initMixin(Vue);
5087 stateMixin(Vue);
5088 eventsMixin(Vue);
5089 lifecycleMixin(Vue);
5090 renderMixin(Vue);
5091
5092 /* */
5093
5094 function initUse (Vue) {
5095 Vue.use = function (plugin) {
5096 var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
5097 if (installedPlugins.indexOf(plugin) > -1) {
5098 return this
5099 }
5100
5101 // additional parameters
5102 var args = toArray(arguments, 1);
5103 args.unshift(this);
5104 if (typeof plugin.install === 'function') {
5105 plugin.install.apply(plugin, args);
5106 } else if (typeof plugin === 'function') {
5107 plugin.apply(null, args);
5108 }
5109 installedPlugins.push(plugin);
5110 return this
5111 };
5112 }
5113
5114 /* */
5115
5116 function initMixin$1 (Vue) {
5117 Vue.mixin = function (mixin) {
5118 this.options = mergeOptions(this.options, mixin);
5119 return this
5120 };
5121 }
5122
5123 /* */
5124
5125 function initExtend (Vue) {
5126 /**
5127 * Each instance constructor, including Vue, has a unique
5128 * cid. This enables us to create wrapped "child
5129 * constructors" for prototypal inheritance and cache them.
5130 */
5131 Vue.cid = 0;
5132 var cid = 1;
5133
5134 /**
5135 * Class inheritance
5136 */
5137 Vue.extend = function (extendOptions) {
5138 extendOptions = extendOptions || {};
5139 var Super = this;
5140 var SuperId = Super.cid;
5141 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
5142 if (cachedCtors[SuperId]) {
5143 return cachedCtors[SuperId]
5144 }
5145
5146 var name = extendOptions.name || Super.options.name;
5147 if (name) {
5148 validateComponentName(name);
5149 }
5150
5151 var Sub = function VueComponent (options) {
5152 this._init(options);
5153 };
5154 Sub.prototype = Object.create(Super.prototype);
5155 Sub.prototype.constructor = Sub;
5156 Sub.cid = cid++;
5157 Sub.options = mergeOptions(
5158 Super.options,
5159 extendOptions
5160 );
5161 Sub['super'] = Super;
5162
5163 // For props and computed properties, we define the proxy getters on
5164 // the Vue instances at extension time, on the extended prototype. This
5165 // avoids Object.defineProperty calls for each instance created.
5166 if (Sub.options.props) {
5167 initProps$1(Sub);
5168 }
5169 if (Sub.options.computed) {
5170 initComputed$1(Sub);
5171 }
5172
5173 // allow further extension/mixin/plugin usage
5174 Sub.extend = Super.extend;
5175 Sub.mixin = Super.mixin;
5176 Sub.use = Super.use;
5177
5178 // create asset registers, so extended classes
5179 // can have their private assets too.
5180 ASSET_TYPES.forEach(function (type) {
5181 Sub[type] = Super[type];
5182 });
5183 // enable recursive self-lookup
5184 if (name) {
5185 Sub.options.components[name] = Sub;
5186 }
5187
5188 // keep a reference to the super options at extension time.
5189 // later at instantiation we can check if Super's options have
5190 // been updated.
5191 Sub.superOptions = Super.options;
5192 Sub.extendOptions = extendOptions;
5193 Sub.sealedOptions = extend({}, Sub.options);
5194
5195 // cache constructor
5196 cachedCtors[SuperId] = Sub;
5197 return Sub
5198 };
5199 }
5200
5201 function initProps$1 (Comp) {
5202 var props = Comp.options.props;
5203 for (var key in props) {
5204 proxy(Comp.prototype, "_props", key);
5205 }
5206 }
5207
5208 function initComputed$1 (Comp) {
5209 var computed = Comp.options.computed;
5210 for (var key in computed) {
5211 defineComputed(Comp.prototype, key, computed[key]);
5212 }
5213 }
5214
5215 /* */
5216
5217 function initAssetRegisters (Vue) {
5218 /**
5219 * Create asset registration methods.
5220 */
5221 ASSET_TYPES.forEach(function (type) {
5222 Vue[type] = function (
5223 id,
5224 definition
5225 ) {
5226 if (!definition) {
5227 return this.options[type + 's'][id]
5228 } else {
5229 /* istanbul ignore if */
5230 if (type === 'component') {
5231 validateComponentName(id);
5232 }
5233 if (type === 'component' && isPlainObject(definition)) {
5234 definition.name = definition.name || id;
5235 definition = this.options._base.extend(definition);
5236 }
5237 if (type === 'directive' && typeof definition === 'function') {
5238 definition = { bind: definition, update: definition };
5239 }
5240 this.options[type + 's'][id] = definition;
5241 return definition
5242 }
5243 };
5244 });
5245 }
5246
5247 /* */
5248
5249
5250
5251
5252
5253 function getComponentName (opts) {
5254 return opts && (opts.Ctor.options.name || opts.tag)
5255 }
5256
5257 function matches (pattern, name) {
5258 if (Array.isArray(pattern)) {
5259 return pattern.indexOf(name) > -1
5260 } else if (typeof pattern === 'string') {
5261 return pattern.split(',').indexOf(name) > -1
5262 } else if (isRegExp(pattern)) {
5263 return pattern.test(name)
5264 }
5265 /* istanbul ignore next */
5266 return false
5267 }
5268
5269 function pruneCache (keepAliveInstance, filter) {
5270 var cache = keepAliveInstance.cache;
5271 var keys = keepAliveInstance.keys;
5272 var _vnode = keepAliveInstance._vnode;
5273 for (var key in cache) {
5274 var entry = cache[key];
5275 if (entry) {
5276 var name = entry.name;
5277 if (name && !filter(name)) {
5278 pruneCacheEntry(cache, key, keys, _vnode);
5279 }
5280 }
5281 }
5282 }
5283
5284 function pruneCacheEntry (
5285 cache,
5286 key,
5287 keys,
5288 current
5289 ) {
5290 var entry = cache[key];
5291 if (entry && (!current || entry.tag !== current.tag)) {
5292 entry.componentInstance.$destroy();
5293 }
5294 cache[key] = null;
5295 remove(keys, key);
5296 }
5297
5298 var patternTypes = [String, RegExp, Array];
5299
5300 var KeepAlive = {
5301 name: 'keep-alive',
5302 abstract: true,
5303
5304 props: {
5305 include: patternTypes,
5306 exclude: patternTypes,
5307 max: [String, Number]
5308 },
5309
5310 methods: {
5311 cacheVNode: function cacheVNode() {
5312 var ref = this;
5313 var cache = ref.cache;
5314 var keys = ref.keys;
5315 var vnodeToCache = ref.vnodeToCache;
5316 var keyToCache = ref.keyToCache;
5317 if (vnodeToCache) {
5318 var tag = vnodeToCache.tag;
5319 var componentInstance = vnodeToCache.componentInstance;
5320 var componentOptions = vnodeToCache.componentOptions;
5321 cache[keyToCache] = {
5322 name: getComponentName(componentOptions),
5323 tag: tag,
5324 componentInstance: componentInstance,
5325 };
5326 keys.push(keyToCache);
5327 // prune oldest entry
5328 if (this.max && keys.length > parseInt(this.max)) {
5329 pruneCacheEntry(cache, keys[0], keys, this._vnode);
5330 }
5331 this.vnodeToCache = null;
5332 }
5333 }
5334 },
5335
5336 created: function created () {
5337 this.cache = Object.create(null);
5338 this.keys = [];
5339 },
5340
5341 destroyed: function destroyed () {
5342 for (var key in this.cache) {
5343 pruneCacheEntry(this.cache, key, this.keys);
5344 }
5345 },
5346
5347 mounted: function mounted () {
5348 var this$1 = this;
5349
5350 this.cacheVNode();
5351 this.$watch('include', function (val) {
5352 pruneCache(this$1, function (name) { return matches(val, name); });
5353 });
5354 this.$watch('exclude', function (val) {
5355 pruneCache(this$1, function (name) { return !matches(val, name); });
5356 });
5357 },
5358
5359 updated: function updated () {
5360 this.cacheVNode();
5361 },
5362
5363 render: function render () {
5364 var slot = this.$slots.default;
5365 var vnode = getFirstComponentChild(slot);
5366 var componentOptions = vnode && vnode.componentOptions;
5367 if (componentOptions) {
5368 // check pattern
5369 var name = getComponentName(componentOptions);
5370 var ref = this;
5371 var include = ref.include;
5372 var exclude = ref.exclude;
5373 if (
5374 // not included
5375 (include && (!name || !matches(include, name))) ||
5376 // excluded
5377 (exclude && name && matches(exclude, name))
5378 ) {
5379 return vnode
5380 }
5381
5382 var ref$1 = this;
5383 var cache = ref$1.cache;
5384 var keys = ref$1.keys;
5385 var key = vnode.key == null
5386 // same constructor may get registered as different local components
5387 // so cid alone is not enough (#3269)
5388 ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
5389 : vnode.key;
5390 if (cache[key]) {
5391 vnode.componentInstance = cache[key].componentInstance;
5392 // make current key freshest
5393 remove(keys, key);
5394 keys.push(key);
5395 } else {
5396 // delay setting the cache until update
5397 this.vnodeToCache = vnode;
5398 this.keyToCache = key;
5399 }
5400
5401 vnode.data.keepAlive = true;
5402 }
5403 return vnode || (slot && slot[0])
5404 }
5405 };
5406
5407 var builtInComponents = {
5408 KeepAlive: KeepAlive
5409 };
5410
5411 /* */
5412
5413 function initGlobalAPI (Vue) {
5414 // config
5415 var configDef = {};
5416 configDef.get = function () { return config; };
5417 {
5418 configDef.set = function () {
5419 warn(
5420 'Do not replace the Vue.config object, set individual fields instead.'
5421 );
5422 };
5423 }
5424 Object.defineProperty(Vue, 'config', configDef);
5425
5426 // exposed util methods.
5427 // NOTE: these are not considered part of the public API - avoid relying on
5428 // them unless you are aware of the risk.
5429 Vue.util = {
5430 warn: warn,
5431 extend: extend,
5432 mergeOptions: mergeOptions,
5433 defineReactive: defineReactive$$1
5434 };
5435
5436 Vue.set = set;
5437 Vue.delete = del;
5438 Vue.nextTick = nextTick;
5439
5440 // 2.6 explicit observable API
5441 Vue.observable = function (obj) {
5442 observe(obj);
5443 return obj
5444 };
5445
5446 Vue.options = Object.create(null);
5447 ASSET_TYPES.forEach(function (type) {
5448 Vue.options[type + 's'] = Object.create(null);
5449 });
5450
5451 // this is used to identify the "base" constructor to extend all plain-object
5452 // components with in Weex's multi-instance scenarios.
5453 Vue.options._base = Vue;
5454
5455 extend(Vue.options.components, builtInComponents);
5456
5457 initUse(Vue);
5458 initMixin$1(Vue);
5459 initExtend(Vue);
5460 initAssetRegisters(Vue);
5461 }
5462
5463 initGlobalAPI(Vue);
5464
5465 Object.defineProperty(Vue.prototype, '$isServer', {
5466 get: isServerRendering
5467 });
5468
5469 Object.defineProperty(Vue.prototype, '$ssrContext', {
5470 get: function get () {
5471 /* istanbul ignore next */
5472 return this.$vnode && this.$vnode.ssrContext
5473 }
5474 });
5475
5476 // expose FunctionalRenderContext for ssr runtime helper installation
5477 Object.defineProperty(Vue, 'FunctionalRenderContext', {
5478 value: FunctionalRenderContext
5479 });
5480
5481 Vue.version = '2.6.14';
5482
5483 /* */
5484
5485 // these are reserved for web because they are directly compiled away
5486 // during template compilation
5487 var isReservedAttr = makeMap('style,class');
5488
5489 // attributes that should be using props for binding
5490 var acceptValue = makeMap('input,textarea,option,select,progress');
5491 var mustUseProp = function (tag, type, attr) {
5492 return (
5493 (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
5494 (attr === 'selected' && tag === 'option') ||
5495 (attr === 'checked' && tag === 'input') ||
5496 (attr === 'muted' && tag === 'video')
5497 )
5498 };
5499
5500 var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
5501
5502 var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
5503
5504 var convertEnumeratedValue = function (key, value) {
5505 return isFalsyAttrValue(value) || value === 'false'
5506 ? 'false'
5507 // allow arbitrary string value for contenteditable
5508 : key === 'contenteditable' && isValidContentEditableValue(value)
5509 ? value
5510 : 'true'
5511 };
5512
5513 var isBooleanAttr = makeMap(
5514 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
5515 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
5516 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
5517 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
5518 'required,reversed,scoped,seamless,selected,sortable,' +
5519 'truespeed,typemustmatch,visible'
5520 );
5521
5522 var xlinkNS = 'http://www.w3.org/1999/xlink';
5523
5524 var isXlink = function (name) {
5525 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
5526 };
5527
5528 var getXlinkProp = function (name) {
5529 return isXlink(name) ? name.slice(6, name.length) : ''
5530 };
5531
5532 var isFalsyAttrValue = function (val) {
5533 return val == null || val === false
5534 };
5535
5536 /* */
5537
5538 function genClassForVnode (vnode) {
5539 var data = vnode.data;
5540 var parentNode = vnode;
5541 var childNode = vnode;
5542 while (isDef(childNode.componentInstance)) {
5543 childNode = childNode.componentInstance._vnode;
5544 if (childNode && childNode.data) {
5545 data = mergeClassData(childNode.data, data);
5546 }
5547 }
5548 while (isDef(parentNode = parentNode.parent)) {
5549 if (parentNode && parentNode.data) {
5550 data = mergeClassData(data, parentNode.data);
5551 }
5552 }
5553 return renderClass(data.staticClass, data.class)
5554 }
5555
5556 function mergeClassData (child, parent) {
5557 return {
5558 staticClass: concat(child.staticClass, parent.staticClass),
5559 class: isDef(child.class)
5560 ? [child.class, parent.class]
5561 : parent.class
5562 }
5563 }
5564
5565 function renderClass (
5566 staticClass,
5567 dynamicClass
5568 ) {
5569 if (isDef(staticClass) || isDef(dynamicClass)) {
5570 return concat(staticClass, stringifyClass(dynamicClass))
5571 }
5572 /* istanbul ignore next */
5573 return ''
5574 }
5575
5576 function concat (a, b) {
5577 return a ? b ? (a + ' ' + b) : a : (b || '')
5578 }
5579
5580 function stringifyClass (value) {
5581 if (Array.isArray(value)) {
5582 return stringifyArray(value)
5583 }
5584 if (isObject(value)) {
5585 return stringifyObject(value)
5586 }
5587 if (typeof value === 'string') {
5588 return value
5589 }
5590 /* istanbul ignore next */
5591 return ''
5592 }
5593
5594 function stringifyArray (value) {
5595 var res = '';
5596 var stringified;
5597 for (var i = 0, l = value.length; i < l; i++) {
5598 if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
5599 if (res) { res += ' '; }
5600 res += stringified;
5601 }
5602 }
5603 return res
5604 }
5605
5606 function stringifyObject (value) {
5607 var res = '';
5608 for (var key in value) {
5609 if (value[key]) {
5610 if (res) { res += ' '; }
5611 res += key;
5612 }
5613 }
5614 return res
5615 }
5616
5617 /* */
5618
5619 var namespaceMap = {
5620 svg: 'http://www.w3.org/2000/svg',
5621 math: 'http://www.w3.org/1998/Math/MathML'
5622 };
5623
5624 var isHTMLTag = makeMap(
5625 'html,body,base,head,link,meta,style,title,' +
5626 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
5627 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
5628 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
5629 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
5630 'embed,object,param,source,canvas,script,noscript,del,ins,' +
5631 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
5632 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
5633 'output,progress,select,textarea,' +
5634 'details,dialog,menu,menuitem,summary,' +
5635 'content,element,shadow,template,blockquote,iframe,tfoot'
5636 );
5637
5638 // this map is intentionally selective, only covering SVG elements that may
5639 // contain child elements.
5640 var isSVG = makeMap(
5641 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
5642 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
5643 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
5644 true
5645 );
5646
5647 var isReservedTag = function (tag) {
5648 return isHTMLTag(tag) || isSVG(tag)
5649 };
5650
5651 function getTagNamespace (tag) {
5652 if (isSVG(tag)) {
5653 return 'svg'
5654 }
5655 // basic support for MathML
5656 // note it doesn't support other MathML elements being component roots
5657 if (tag === 'math') {
5658 return 'math'
5659 }
5660 }
5661
5662 var unknownElementCache = Object.create(null);
5663 function isUnknownElement (tag) {
5664 /* istanbul ignore if */
5665 if (!inBrowser) {
5666 return true
5667 }
5668 if (isReservedTag(tag)) {
5669 return false
5670 }
5671 tag = tag.toLowerCase();
5672 /* istanbul ignore if */
5673 if (unknownElementCache[tag] != null) {
5674 return unknownElementCache[tag]
5675 }
5676 var el = document.createElement(tag);
5677 if (tag.indexOf('-') > -1) {
5678 // http://stackoverflow.com/a/28210364/1070244
5679 return (unknownElementCache[tag] = (
5680 el.constructor === window.HTMLUnknownElement ||
5681 el.constructor === window.HTMLElement
5682 ))
5683 } else {
5684 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
5685 }
5686 }
5687
5688 var isTextInputType = makeMap('text,number,password,search,email,tel,url');
5689
5690 /* */
5691
5692 /**
5693 * Query an element selector if it's not an element already.
5694 */
5695 function query (el) {
5696 if (typeof el === 'string') {
5697 var selected = document.querySelector(el);
5698 if (!selected) {
5699 warn(
5700 'Cannot find element: ' + el
5701 );
5702 return document.createElement('div')
5703 }
5704 return selected
5705 } else {
5706 return el
5707 }
5708 }
5709
5710 /* */
5711
5712 function createElement$1 (tagName, vnode) {
5713 var elm = document.createElement(tagName);
5714 if (tagName !== 'select') {
5715 return elm
5716 }
5717 // false or null will remove the attribute but undefined will not
5718 if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
5719 elm.setAttribute('multiple', 'multiple');
5720 }
5721 return elm
5722 }
5723
5724 function createElementNS (namespace, tagName) {
5725 return document.createElementNS(namespaceMap[namespace], tagName)
5726 }
5727
5728 function createTextNode (text) {
5729 return document.createTextNode(text)
5730 }
5731
5732 function createComment (text) {
5733 return document.createComment(text)
5734 }
5735
5736 function insertBefore (parentNode, newNode, referenceNode) {
5737 parentNode.insertBefore(newNode, referenceNode);
5738 }
5739
5740 function removeChild (node, child) {
5741 node.removeChild(child);
5742 }
5743
5744 function appendChild (node, child) {
5745 node.appendChild(child);
5746 }
5747
5748 function parentNode (node) {
5749 return node.parentNode
5750 }
5751
5752 function nextSibling (node) {
5753 return node.nextSibling
5754 }
5755
5756 function tagName (node) {
5757 return node.tagName
5758 }
5759
5760 function setTextContent (node, text) {
5761 node.textContent = text;
5762 }
5763
5764 function setStyleScope (node, scopeId) {
5765 node.setAttribute(scopeId, '');
5766 }
5767
5768 var nodeOps = /*#__PURE__*/Object.freeze({
5769 createElement: createElement$1,
5770 createElementNS: createElementNS,
5771 createTextNode: createTextNode,
5772 createComment: createComment,
5773 insertBefore: insertBefore,
5774 removeChild: removeChild,
5775 appendChild: appendChild,
5776 parentNode: parentNode,
5777 nextSibling: nextSibling,
5778 tagName: tagName,
5779 setTextContent: setTextContent,
5780 setStyleScope: setStyleScope
5781 });
5782
5783 /* */
5784
5785 var ref = {
5786 create: function create (_, vnode) {
5787 registerRef(vnode);
5788 },
5789 update: function update (oldVnode, vnode) {
5790 if (oldVnode.data.ref !== vnode.data.ref) {
5791 registerRef(oldVnode, true);
5792 registerRef(vnode);
5793 }
5794 },
5795 destroy: function destroy (vnode) {
5796 registerRef(vnode, true);
5797 }
5798 };
5799
5800 function registerRef (vnode, isRemoval) {
5801 var key = vnode.data.ref;
5802 if (!isDef(key)) { return }
5803
5804 var vm = vnode.context;
5805 var ref = vnode.componentInstance || vnode.elm;
5806 var refs = vm.$refs;
5807 if (isRemoval) {
5808 if (Array.isArray(refs[key])) {
5809 remove(refs[key], ref);
5810 } else if (refs[key] === ref) {
5811 refs[key] = undefined;
5812 }
5813 } else {
5814 if (vnode.data.refInFor) {
5815 if (!Array.isArray(refs[key])) {
5816 refs[key] = [ref];
5817 } else if (refs[key].indexOf(ref) < 0) {
5818 // $flow-disable-line
5819 refs[key].push(ref);
5820 }
5821 } else {
5822 refs[key] = ref;
5823 }
5824 }
5825 }
5826
5827 /**
5828 * Virtual DOM patching algorithm based on Snabbdom by
5829 * Simon Friis Vindum (@paldepind)
5830 * Licensed under the MIT License
5831 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
5832 *
5833 * modified by Evan You (@yyx990803)
5834 *
5835 * Not type-checking this because this file is perf-critical and the cost
5836 * of making flow understand it is not worth it.
5837 */
5838
5839 var emptyNode = new VNode('', {}, []);
5840
5841 var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
5842
5843 function sameVnode (a, b) {
5844 return (
5845 a.key === b.key &&
5846 a.asyncFactory === b.asyncFactory && (
5847 (
5848 a.tag === b.tag &&
5849 a.isComment === b.isComment &&
5850 isDef(a.data) === isDef(b.data) &&
5851 sameInputType(a, b)
5852 ) || (
5853 isTrue(a.isAsyncPlaceholder) &&
5854 isUndef(b.asyncFactory.error)
5855 )
5856 )
5857 )
5858 }
5859
5860 function sameInputType (a, b) {
5861 if (a.tag !== 'input') { return true }
5862 var i;
5863 var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
5864 var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
5865 return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
5866 }
5867
5868 function createKeyToOldIdx (children, beginIdx, endIdx) {
5869 var i, key;
5870 var map = {};
5871 for (i = beginIdx; i <= endIdx; ++i) {
5872 key = children[i].key;
5873 if (isDef(key)) { map[key] = i; }
5874 }
5875 return map
5876 }
5877
5878 function createPatchFunction (backend) {
5879 var i, j;
5880 var cbs = {};
5881
5882 var modules = backend.modules;
5883 var nodeOps = backend.nodeOps;
5884
5885 for (i = 0; i < hooks.length; ++i) {
5886 cbs[hooks[i]] = [];
5887 for (j = 0; j < modules.length; ++j) {
5888 if (isDef(modules[j][hooks[i]])) {
5889 cbs[hooks[i]].push(modules[j][hooks[i]]);
5890 }
5891 }
5892 }
5893
5894 function emptyNodeAt (elm) {
5895 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
5896 }
5897
5898 function createRmCb (childElm, listeners) {
5899 function remove$$1 () {
5900 if (--remove$$1.listeners === 0) {
5901 removeNode(childElm);
5902 }
5903 }
5904 remove$$1.listeners = listeners;
5905 return remove$$1
5906 }
5907
5908 function removeNode (el) {
5909 var parent = nodeOps.parentNode(el);
5910 // element may have already been removed due to v-html / v-text
5911 if (isDef(parent)) {
5912 nodeOps.removeChild(parent, el);
5913 }
5914 }
5915
5916 function isUnknownElement$$1 (vnode, inVPre) {
5917 return (
5918 !inVPre &&
5919 !vnode.ns &&
5920 !(
5921 config.ignoredElements.length &&
5922 config.ignoredElements.some(function (ignore) {
5923 return isRegExp(ignore)
5924 ? ignore.test(vnode.tag)
5925 : ignore === vnode.tag
5926 })
5927 ) &&
5928 config.isUnknownElement(vnode.tag)
5929 )
5930 }
5931
5932 var creatingElmInVPre = 0;
5933
5934 function createElm (
5935 vnode,
5936 insertedVnodeQueue,
5937 parentElm,
5938 refElm,
5939 nested,
5940 ownerArray,
5941 index
5942 ) {
5943 if (isDef(vnode.elm) && isDef(ownerArray)) {
5944 // This vnode was used in a previous render!
5945 // now it's used as a new node, overwriting its elm would cause
5946 // potential patch errors down the road when it's used as an insertion
5947 // reference node. Instead, we clone the node on-demand before creating
5948 // associated DOM element for it.
5949 vnode = ownerArray[index] = cloneVNode(vnode);
5950 }
5951
5952 vnode.isRootInsert = !nested; // for transition enter check
5953 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
5954 return
5955 }
5956
5957 var data = vnode.data;
5958 var children = vnode.children;
5959 var tag = vnode.tag;
5960 if (isDef(tag)) {
5961 {
5962 if (data && data.pre) {
5963 creatingElmInVPre++;
5964 }
5965 if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
5966 warn(
5967 'Unknown custom element: <' + tag + '> - did you ' +
5968 'register the component correctly? For recursive components, ' +
5969 'make sure to provide the "name" option.',
5970 vnode.context
5971 );
5972 }
5973 }
5974
5975 vnode.elm = vnode.ns
5976 ? nodeOps.createElementNS(vnode.ns, tag)
5977 : nodeOps.createElement(tag, vnode);
5978 setScope(vnode);
5979
5980 /* istanbul ignore if */
5981 {
5982 createChildren(vnode, children, insertedVnodeQueue);
5983 if (isDef(data)) {
5984 invokeCreateHooks(vnode, insertedVnodeQueue);
5985 }
5986 insert(parentElm, vnode.elm, refElm);
5987 }
5988
5989 if (data && data.pre) {
5990 creatingElmInVPre--;
5991 }
5992 } else if (isTrue(vnode.isComment)) {
5993 vnode.elm = nodeOps.createComment(vnode.text);
5994 insert(parentElm, vnode.elm, refElm);
5995 } else {
5996 vnode.elm = nodeOps.createTextNode(vnode.text);
5997 insert(parentElm, vnode.elm, refElm);
5998 }
5999 }
6000
6001 function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
6002 var i = vnode.data;
6003 if (isDef(i)) {
6004 var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
6005 if (isDef(i = i.hook) && isDef(i = i.init)) {
6006 i(vnode, false /* hydrating */);
6007 }
6008 // after calling the init hook, if the vnode is a child component
6009 // it should've created a child instance and mounted it. the child
6010 // component also has set the placeholder vnode's elm.
6011 // in that case we can just return the element and be done.
6012 if (isDef(vnode.componentInstance)) {
6013 initComponent(vnode, insertedVnodeQueue);
6014 insert(parentElm, vnode.elm, refElm);
6015 if (isTrue(isReactivated)) {
6016 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
6017 }
6018 return true
6019 }
6020 }
6021 }
6022
6023 function initComponent (vnode, insertedVnodeQueue) {
6024 if (isDef(vnode.data.pendingInsert)) {
6025 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
6026 vnode.data.pendingInsert = null;
6027 }
6028 vnode.elm = vnode.componentInstance.$el;
6029 if (isPatchable(vnode)) {
6030 invokeCreateHooks(vnode, insertedVnodeQueue);
6031 setScope(vnode);
6032 } else {
6033 // empty component root.
6034 // skip all element-related modules except for ref (#3455)
6035 registerRef(vnode);
6036 // make sure to invoke the insert hook
6037 insertedVnodeQueue.push(vnode);
6038 }
6039 }
6040
6041 function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
6042 var i;
6043 // hack for #4339: a reactivated component with inner transition
6044 // does not trigger because the inner node's created hooks are not called
6045 // again. It's not ideal to involve module-specific logic in here but
6046 // there doesn't seem to be a better way to do it.
6047 var innerNode = vnode;
6048 while (innerNode.componentInstance) {
6049 innerNode = innerNode.componentInstance._vnode;
6050 if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
6051 for (i = 0; i < cbs.activate.length; ++i) {
6052 cbs.activate[i](emptyNode, innerNode);
6053 }
6054 insertedVnodeQueue.push(innerNode);
6055 break
6056 }
6057 }
6058 // unlike a newly created component,
6059 // a reactivated keep-alive component doesn't insert itself
6060 insert(parentElm, vnode.elm, refElm);
6061 }
6062
6063 function insert (parent, elm, ref$$1) {
6064 if (isDef(parent)) {
6065 if (isDef(ref$$1)) {
6066 if (nodeOps.parentNode(ref$$1) === parent) {
6067 nodeOps.insertBefore(parent, elm, ref$$1);
6068 }
6069 } else {
6070 nodeOps.appendChild(parent, elm);
6071 }
6072 }
6073 }
6074
6075 function createChildren (vnode, children, insertedVnodeQueue) {
6076 if (Array.isArray(children)) {
6077 {
6078 checkDuplicateKeys(children);
6079 }
6080 for (var i = 0; i < children.length; ++i) {
6081 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
6082 }
6083 } else if (isPrimitive(vnode.text)) {
6084 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
6085 }
6086 }
6087
6088 function isPatchable (vnode) {
6089 while (vnode.componentInstance) {
6090 vnode = vnode.componentInstance._vnode;
6091 }
6092 return isDef(vnode.tag)
6093 }
6094
6095 function invokeCreateHooks (vnode, insertedVnodeQueue) {
6096 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6097 cbs.create[i$1](emptyNode, vnode);
6098 }
6099 i = vnode.data.hook; // Reuse variable
6100 if (isDef(i)) {
6101 if (isDef(i.create)) { i.create(emptyNode, vnode); }
6102 if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
6103 }
6104 }
6105
6106 // set scope id attribute for scoped CSS.
6107 // this is implemented as a special case to avoid the overhead
6108 // of going through the normal attribute patching process.
6109 function setScope (vnode) {
6110 var i;
6111 if (isDef(i = vnode.fnScopeId)) {
6112 nodeOps.setStyleScope(vnode.elm, i);
6113 } else {
6114 var ancestor = vnode;
6115 while (ancestor) {
6116 if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
6117 nodeOps.setStyleScope(vnode.elm, i);
6118 }
6119 ancestor = ancestor.parent;
6120 }
6121 }
6122 // for slot content they should also get the scopeId from the host instance.
6123 if (isDef(i = activeInstance) &&
6124 i !== vnode.context &&
6125 i !== vnode.fnContext &&
6126 isDef(i = i.$options._scopeId)
6127 ) {
6128 nodeOps.setStyleScope(vnode.elm, i);
6129 }
6130 }
6131
6132 function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
6133 for (; startIdx <= endIdx; ++startIdx) {
6134 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
6135 }
6136 }
6137
6138 function invokeDestroyHook (vnode) {
6139 var i, j;
6140 var data = vnode.data;
6141 if (isDef(data)) {
6142 if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
6143 for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
6144 }
6145 if (isDef(i = vnode.children)) {
6146 for (j = 0; j < vnode.children.length; ++j) {
6147 invokeDestroyHook(vnode.children[j]);
6148 }
6149 }
6150 }
6151
6152 function removeVnodes (vnodes, startIdx, endIdx) {
6153 for (; startIdx <= endIdx; ++startIdx) {
6154 var ch = vnodes[startIdx];
6155 if (isDef(ch)) {
6156 if (isDef(ch.tag)) {
6157 removeAndInvokeRemoveHook(ch);
6158 invokeDestroyHook(ch);
6159 } else { // Text node
6160 removeNode(ch.elm);
6161 }
6162 }
6163 }
6164 }
6165
6166 function removeAndInvokeRemoveHook (vnode, rm) {
6167 if (isDef(rm) || isDef(vnode.data)) {
6168 var i;
6169 var listeners = cbs.remove.length + 1;
6170 if (isDef(rm)) {
6171 // we have a recursively passed down rm callback
6172 // increase the listeners count
6173 rm.listeners += listeners;
6174 } else {
6175 // directly removing
6176 rm = createRmCb(vnode.elm, listeners);
6177 }
6178 // recursively invoke hooks on child component root node
6179 if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
6180 removeAndInvokeRemoveHook(i, rm);
6181 }
6182 for (i = 0; i < cbs.remove.length; ++i) {
6183 cbs.remove[i](vnode, rm);
6184 }
6185 if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
6186 i(vnode, rm);
6187 } else {
6188 rm();
6189 }
6190 } else {
6191 removeNode(vnode.elm);
6192 }
6193 }
6194
6195 function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
6196 var oldStartIdx = 0;
6197 var newStartIdx = 0;
6198 var oldEndIdx = oldCh.length - 1;
6199 var oldStartVnode = oldCh[0];
6200 var oldEndVnode = oldCh[oldEndIdx];
6201 var newEndIdx = newCh.length - 1;
6202 var newStartVnode = newCh[0];
6203 var newEndVnode = newCh[newEndIdx];
6204 var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
6205
6206 // removeOnly is a special flag used only by <transition-group>
6207 // to ensure removed elements stay in correct relative positions
6208 // during leaving transitions
6209 var canMove = !removeOnly;
6210
6211 {
6212 checkDuplicateKeys(newCh);
6213 }
6214
6215 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
6216 if (isUndef(oldStartVnode)) {
6217 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
6218 } else if (isUndef(oldEndVnode)) {
6219 oldEndVnode = oldCh[--oldEndIdx];
6220 } else if (sameVnode(oldStartVnode, newStartVnode)) {
6221 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6222 oldStartVnode = oldCh[++oldStartIdx];
6223 newStartVnode = newCh[++newStartIdx];
6224 } else if (sameVnode(oldEndVnode, newEndVnode)) {
6225 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6226 oldEndVnode = oldCh[--oldEndIdx];
6227 newEndVnode = newCh[--newEndIdx];
6228 } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
6229 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6230 canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
6231 oldStartVnode = oldCh[++oldStartIdx];
6232 newEndVnode = newCh[--newEndIdx];
6233 } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
6234 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6235 canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
6236 oldEndVnode = oldCh[--oldEndIdx];
6237 newStartVnode = newCh[++newStartIdx];
6238 } else {
6239 if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
6240 idxInOld = isDef(newStartVnode.key)
6241 ? oldKeyToIdx[newStartVnode.key]
6242 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
6243 if (isUndef(idxInOld)) { // New element
6244 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6245 } else {
6246 vnodeToMove = oldCh[idxInOld];
6247 if (sameVnode(vnodeToMove, newStartVnode)) {
6248 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6249 oldCh[idxInOld] = undefined;
6250 canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
6251 } else {
6252 // same key but different element. treat as new element
6253 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6254 }
6255 }
6256 newStartVnode = newCh[++newStartIdx];
6257 }
6258 }
6259 if (oldStartIdx > oldEndIdx) {
6260 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6261 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6262 } else if (newStartIdx > newEndIdx) {
6263 removeVnodes(oldCh, oldStartIdx, oldEndIdx);
6264 }
6265 }
6266
6267 function checkDuplicateKeys (children) {
6268 var seenKeys = {};
6269 for (var i = 0; i < children.length; i++) {
6270 var vnode = children[i];
6271 var key = vnode.key;
6272 if (isDef(key)) {
6273 if (seenKeys[key]) {
6274 warn(
6275 ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
6276 vnode.context
6277 );
6278 } else {
6279 seenKeys[key] = true;
6280 }
6281 }
6282 }
6283 }
6284
6285 function findIdxInOld (node, oldCh, start, end) {
6286 for (var i = start; i < end; i++) {
6287 var c = oldCh[i];
6288 if (isDef(c) && sameVnode(node, c)) { return i }
6289 }
6290 }
6291
6292 function patchVnode (
6293 oldVnode,
6294 vnode,
6295 insertedVnodeQueue,
6296 ownerArray,
6297 index,
6298 removeOnly
6299 ) {
6300 if (oldVnode === vnode) {
6301 return
6302 }
6303
6304 if (isDef(vnode.elm) && isDef(ownerArray)) {
6305 // clone reused vnode
6306 vnode = ownerArray[index] = cloneVNode(vnode);
6307 }
6308
6309 var elm = vnode.elm = oldVnode.elm;
6310
6311 if (isTrue(oldVnode.isAsyncPlaceholder)) {
6312 if (isDef(vnode.asyncFactory.resolved)) {
6313 hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6314 } else {
6315 vnode.isAsyncPlaceholder = true;
6316 }
6317 return
6318 }
6319
6320 // reuse element for static trees.
6321 // note we only do this if the vnode is cloned -
6322 // if the new node is not cloned it means the render functions have been
6323 // reset by the hot-reload-api and we need to do a proper re-render.
6324 if (isTrue(vnode.isStatic) &&
6325 isTrue(oldVnode.isStatic) &&
6326 vnode.key === oldVnode.key &&
6327 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
6328 ) {
6329 vnode.componentInstance = oldVnode.componentInstance;
6330 return
6331 }
6332
6333 var i;
6334 var data = vnode.data;
6335 if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
6336 i(oldVnode, vnode);
6337 }
6338
6339 var oldCh = oldVnode.children;
6340 var ch = vnode.children;
6341 if (isDef(data) && isPatchable(vnode)) {
6342 for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
6343 if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
6344 }
6345 if (isUndef(vnode.text)) {
6346 if (isDef(oldCh) && isDef(ch)) {
6347 if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
6348 } else if (isDef(ch)) {
6349 {
6350 checkDuplicateKeys(ch);
6351 }
6352 if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6353 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6354 } else if (isDef(oldCh)) {
6355 removeVnodes(oldCh, 0, oldCh.length - 1);
6356 } else if (isDef(oldVnode.text)) {
6357 nodeOps.setTextContent(elm, '');
6358 }
6359 } else if (oldVnode.text !== vnode.text) {
6360 nodeOps.setTextContent(elm, vnode.text);
6361 }
6362 if (isDef(data)) {
6363 if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
6364 }
6365 }
6366
6367 function invokeInsertHook (vnode, queue, initial) {
6368 // delay insert hooks for component root nodes, invoke them after the
6369 // element is really inserted
6370 if (isTrue(initial) && isDef(vnode.parent)) {
6371 vnode.parent.data.pendingInsert = queue;
6372 } else {
6373 for (var i = 0; i < queue.length; ++i) {
6374 queue[i].data.hook.insert(queue[i]);
6375 }
6376 }
6377 }
6378
6379 var hydrationBailed = false;
6380 // list of modules that can skip create hook during hydration because they
6381 // are already rendered on the client or has no need for initialization
6382 // Note: style is excluded because it relies on initial clone for future
6383 // deep updates (#7063).
6384 var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
6385
6386 // Note: this is a browser-only function so we can assume elms are DOM nodes.
6387 function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
6388 var i;
6389 var tag = vnode.tag;
6390 var data = vnode.data;
6391 var children = vnode.children;
6392 inVPre = inVPre || (data && data.pre);
6393 vnode.elm = elm;
6394
6395 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
6396 vnode.isAsyncPlaceholder = true;
6397 return true
6398 }
6399 // assert node match
6400 {
6401 if (!assertNodeMatch(elm, vnode, inVPre)) {
6402 return false
6403 }
6404 }
6405 if (isDef(data)) {
6406 if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
6407 if (isDef(i = vnode.componentInstance)) {
6408 // child component. it should have hydrated its own tree.
6409 initComponent(vnode, insertedVnodeQueue);
6410 return true
6411 }
6412 }
6413 if (isDef(tag)) {
6414 if (isDef(children)) {
6415 // empty element, allow client to pick up and populate children
6416 if (!elm.hasChildNodes()) {
6417 createChildren(vnode, children, insertedVnodeQueue);
6418 } else {
6419 // v-html and domProps: innerHTML
6420 if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
6421 if (i !== elm.innerHTML) {
6422 /* istanbul ignore if */
6423 if (typeof console !== 'undefined' &&
6424 !hydrationBailed
6425 ) {
6426 hydrationBailed = true;
6427 console.warn('Parent: ', elm);
6428 console.warn('server innerHTML: ', i);
6429 console.warn('client innerHTML: ', elm.innerHTML);
6430 }
6431 return false
6432 }
6433 } else {
6434 // iterate and compare children lists
6435 var childrenMatch = true;
6436 var childNode = elm.firstChild;
6437 for (var i$1 = 0; i$1 < children.length; i$1++) {
6438 if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
6439 childrenMatch = false;
6440 break
6441 }
6442 childNode = childNode.nextSibling;
6443 }
6444 // if childNode is not null, it means the actual childNodes list is
6445 // longer than the virtual children list.
6446 if (!childrenMatch || childNode) {
6447 /* istanbul ignore if */
6448 if (typeof console !== 'undefined' &&
6449 !hydrationBailed
6450 ) {
6451 hydrationBailed = true;
6452 console.warn('Parent: ', elm);
6453 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
6454 }
6455 return false
6456 }
6457 }
6458 }
6459 }
6460 if (isDef(data)) {
6461 var fullInvoke = false;
6462 for (var key in data) {
6463 if (!isRenderedModule(key)) {
6464 fullInvoke = true;
6465 invokeCreateHooks(vnode, insertedVnodeQueue);
6466 break
6467 }
6468 }
6469 if (!fullInvoke && data['class']) {
6470 // ensure collecting deps for deep class bindings for future updates
6471 traverse(data['class']);
6472 }
6473 }
6474 } else if (elm.data !== vnode.text) {
6475 elm.data = vnode.text;
6476 }
6477 return true
6478 }
6479
6480 function assertNodeMatch (node, vnode, inVPre) {
6481 if (isDef(vnode.tag)) {
6482 return vnode.tag.indexOf('vue-component') === 0 || (
6483 !isUnknownElement$$1(vnode, inVPre) &&
6484 vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
6485 )
6486 } else {
6487 return node.nodeType === (vnode.isComment ? 8 : 3)
6488 }
6489 }
6490
6491 return function patch (oldVnode, vnode, hydrating, removeOnly) {
6492 if (isUndef(vnode)) {
6493 if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
6494 return
6495 }
6496
6497 var isInitialPatch = false;
6498 var insertedVnodeQueue = [];
6499
6500 if (isUndef(oldVnode)) {
6501 // empty mount (likely as component), create new root element
6502 isInitialPatch = true;
6503 createElm(vnode, insertedVnodeQueue);
6504 } else {
6505 var isRealElement = isDef(oldVnode.nodeType);
6506 if (!isRealElement && sameVnode(oldVnode, vnode)) {
6507 // patch existing root node
6508 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
6509 } else {
6510 if (isRealElement) {
6511 // mounting to a real element
6512 // check if this is server-rendered content and if we can perform
6513 // a successful hydration.
6514 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
6515 oldVnode.removeAttribute(SSR_ATTR);
6516 hydrating = true;
6517 }
6518 if (isTrue(hydrating)) {
6519 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
6520 invokeInsertHook(vnode, insertedVnodeQueue, true);
6521 return oldVnode
6522 } else {
6523 warn(
6524 'The client-side rendered virtual DOM tree is not matching ' +
6525 'server-rendered content. This is likely caused by incorrect ' +
6526 'HTML markup, for example nesting block-level elements inside ' +
6527 '<p>, or missing <tbody>. Bailing hydration and performing ' +
6528 'full client-side render.'
6529 );
6530 }
6531 }
6532 // either not server-rendered, or hydration failed.
6533 // create an empty node and replace it
6534 oldVnode = emptyNodeAt(oldVnode);
6535 }
6536
6537 // replacing existing element
6538 var oldElm = oldVnode.elm;
6539 var parentElm = nodeOps.parentNode(oldElm);
6540
6541 // create new node
6542 createElm(
6543 vnode,
6544 insertedVnodeQueue,
6545 // extremely rare edge case: do not insert if old element is in a
6546 // leaving transition. Only happens when combining transition +
6547 // keep-alive + HOCs. (#4590)
6548 oldElm._leaveCb ? null : parentElm,
6549 nodeOps.nextSibling(oldElm)
6550 );
6551
6552 // update parent placeholder node element, recursively
6553 if (isDef(vnode.parent)) {
6554 var ancestor = vnode.parent;
6555 var patchable = isPatchable(vnode);
6556 while (ancestor) {
6557 for (var i = 0; i < cbs.destroy.length; ++i) {
6558 cbs.destroy[i](ancestor);
6559 }
6560 ancestor.elm = vnode.elm;
6561 if (patchable) {
6562 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6563 cbs.create[i$1](emptyNode, ancestor);
6564 }
6565 // #6513
6566 // invoke insert hooks that may have been merged by create hooks.
6567 // e.g. for directives that uses the "inserted" hook.
6568 var insert = ancestor.data.hook.insert;
6569 if (insert.merged) {
6570 // start at index 1 to avoid re-invoking component mounted hook
6571 for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
6572 insert.fns[i$2]();
6573 }
6574 }
6575 } else {
6576 registerRef(ancestor);
6577 }
6578 ancestor = ancestor.parent;
6579 }
6580 }
6581
6582 // destroy old node
6583 if (isDef(parentElm)) {
6584 removeVnodes([oldVnode], 0, 0);
6585 } else if (isDef(oldVnode.tag)) {
6586 invokeDestroyHook(oldVnode);
6587 }
6588 }
6589 }
6590
6591 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
6592 return vnode.elm
6593 }
6594 }
6595
6596 /* */
6597
6598 var directives = {
6599 create: updateDirectives,
6600 update: updateDirectives,
6601 destroy: function unbindDirectives (vnode) {
6602 updateDirectives(vnode, emptyNode);
6603 }
6604 };
6605
6606 function updateDirectives (oldVnode, vnode) {
6607 if (oldVnode.data.directives || vnode.data.directives) {
6608 _update(oldVnode, vnode);
6609 }
6610 }
6611
6612 function _update (oldVnode, vnode) {
6613 var isCreate = oldVnode === emptyNode;
6614 var isDestroy = vnode === emptyNode;
6615 var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
6616 var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
6617
6618 var dirsWithInsert = [];
6619 var dirsWithPostpatch = [];
6620
6621 var key, oldDir, dir;
6622 for (key in newDirs) {
6623 oldDir = oldDirs[key];
6624 dir = newDirs[key];
6625 if (!oldDir) {
6626 // new directive, bind
6627 callHook$1(dir, 'bind', vnode, oldVnode);
6628 if (dir.def && dir.def.inserted) {
6629 dirsWithInsert.push(dir);
6630 }
6631 } else {
6632 // existing directive, update
6633 dir.oldValue = oldDir.value;
6634 dir.oldArg = oldDir.arg;
6635 callHook$1(dir, 'update', vnode, oldVnode);
6636 if (dir.def && dir.def.componentUpdated) {
6637 dirsWithPostpatch.push(dir);
6638 }
6639 }
6640 }
6641
6642 if (dirsWithInsert.length) {
6643 var callInsert = function () {
6644 for (var i = 0; i < dirsWithInsert.length; i++) {
6645 callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
6646 }
6647 };
6648 if (isCreate) {
6649 mergeVNodeHook(vnode, 'insert', callInsert);
6650 } else {
6651 callInsert();
6652 }
6653 }
6654
6655 if (dirsWithPostpatch.length) {
6656 mergeVNodeHook(vnode, 'postpatch', function () {
6657 for (var i = 0; i < dirsWithPostpatch.length; i++) {
6658 callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
6659 }
6660 });
6661 }
6662
6663 if (!isCreate) {
6664 for (key in oldDirs) {
6665 if (!newDirs[key]) {
6666 // no longer present, unbind
6667 callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
6668 }
6669 }
6670 }
6671 }
6672
6673 var emptyModifiers = Object.create(null);
6674
6675 function normalizeDirectives$1 (
6676 dirs,
6677 vm
6678 ) {
6679 var res = Object.create(null);
6680 if (!dirs) {
6681 // $flow-disable-line
6682 return res
6683 }
6684 var i, dir;
6685 for (i = 0; i < dirs.length; i++) {
6686 dir = dirs[i];
6687 if (!dir.modifiers) {
6688 // $flow-disable-line
6689 dir.modifiers = emptyModifiers;
6690 }
6691 res[getRawDirName(dir)] = dir;
6692 dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
6693 }
6694 // $flow-disable-line
6695 return res
6696 }
6697
6698 function getRawDirName (dir) {
6699 return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
6700 }
6701
6702 function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
6703 var fn = dir.def && dir.def[hook];
6704 if (fn) {
6705 try {
6706 fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
6707 } catch (e) {
6708 handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
6709 }
6710 }
6711 }
6712
6713 var baseModules = [
6714 ref,
6715 directives
6716 ];
6717
6718 /* */
6719
6720 function updateAttrs (oldVnode, vnode) {
6721 var opts = vnode.componentOptions;
6722 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
6723 return
6724 }
6725 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
6726 return
6727 }
6728 var key, cur, old;
6729 var elm = vnode.elm;
6730 var oldAttrs = oldVnode.data.attrs || {};
6731 var attrs = vnode.data.attrs || {};
6732 // clone observed objects, as the user probably wants to mutate it
6733 if (isDef(attrs.__ob__)) {
6734 attrs = vnode.data.attrs = extend({}, attrs);
6735 }
6736
6737 for (key in attrs) {
6738 cur = attrs[key];
6739 old = oldAttrs[key];
6740 if (old !== cur) {
6741 setAttr(elm, key, cur, vnode.data.pre);
6742 }
6743 }
6744 // #4391: in IE9, setting type can reset value for input[type=radio]
6745 // #6666: IE/Edge forces progress value down to 1 before setting a max
6746 /* istanbul ignore if */
6747 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
6748 setAttr(elm, 'value', attrs.value);
6749 }
6750 for (key in oldAttrs) {
6751 if (isUndef(attrs[key])) {
6752 if (isXlink(key)) {
6753 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
6754 } else if (!isEnumeratedAttr(key)) {
6755 elm.removeAttribute(key);
6756 }
6757 }
6758 }
6759 }
6760
6761 function setAttr (el, key, value, isInPre) {
6762 if (isInPre || el.tagName.indexOf('-') > -1) {
6763 baseSetAttr(el, key, value);
6764 } else if (isBooleanAttr(key)) {
6765 // set attribute for blank value
6766 // e.g. <option disabled>Select one</option>
6767 if (isFalsyAttrValue(value)) {
6768 el.removeAttribute(key);
6769 } else {
6770 // technically allowfullscreen is a boolean attribute for <iframe>,
6771 // but Flash expects a value of "true" when used on <embed> tag
6772 value = key === 'allowfullscreen' && el.tagName === 'EMBED'
6773 ? 'true'
6774 : key;
6775 el.setAttribute(key, value);
6776 }
6777 } else if (isEnumeratedAttr(key)) {
6778 el.setAttribute(key, convertEnumeratedValue(key, value));
6779 } else if (isXlink(key)) {
6780 if (isFalsyAttrValue(value)) {
6781 el.removeAttributeNS(xlinkNS, getXlinkProp(key));
6782 } else {
6783 el.setAttributeNS(xlinkNS, key, value);
6784 }
6785 } else {
6786 baseSetAttr(el, key, value);
6787 }
6788 }
6789
6790 function baseSetAttr (el, key, value) {
6791 if (isFalsyAttrValue(value)) {
6792 el.removeAttribute(key);
6793 } else {
6794 // #7138: IE10 & 11 fires input event when setting placeholder on
6795 // <textarea>... block the first input event and remove the blocker
6796 // immediately.
6797 /* istanbul ignore if */
6798 if (
6799 isIE && !isIE9 &&
6800 el.tagName === 'TEXTAREA' &&
6801 key === 'placeholder' && value !== '' && !el.__ieph
6802 ) {
6803 var blocker = function (e) {
6804 e.stopImmediatePropagation();
6805 el.removeEventListener('input', blocker);
6806 };
6807 el.addEventListener('input', blocker);
6808 // $flow-disable-line
6809 el.__ieph = true; /* IE placeholder patched */
6810 }
6811 el.setAttribute(key, value);
6812 }
6813 }
6814
6815 var attrs = {
6816 create: updateAttrs,
6817 update: updateAttrs
6818 };
6819
6820 /* */
6821
6822 function updateClass (oldVnode, vnode) {
6823 var el = vnode.elm;
6824 var data = vnode.data;
6825 var oldData = oldVnode.data;
6826 if (
6827 isUndef(data.staticClass) &&
6828 isUndef(data.class) && (
6829 isUndef(oldData) || (
6830 isUndef(oldData.staticClass) &&
6831 isUndef(oldData.class)
6832 )
6833 )
6834 ) {
6835 return
6836 }
6837
6838 var cls = genClassForVnode(vnode);
6839
6840 // handle transition classes
6841 var transitionClass = el._transitionClasses;
6842 if (isDef(transitionClass)) {
6843 cls = concat(cls, stringifyClass(transitionClass));
6844 }
6845
6846 // set the class
6847 if (cls !== el._prevClass) {
6848 el.setAttribute('class', cls);
6849 el._prevClass = cls;
6850 }
6851 }
6852
6853 var klass = {
6854 create: updateClass,
6855 update: updateClass
6856 };
6857
6858 /* */
6859
6860 /* */
6861
6862 /* */
6863
6864 /* */
6865
6866 // in some cases, the event used has to be determined at runtime
6867 // so we used some reserved tokens during compile.
6868 var RANGE_TOKEN = '__r';
6869 var CHECKBOX_RADIO_TOKEN = '__c';
6870
6871 /* */
6872
6873 // normalize v-model event tokens that can only be determined at runtime.
6874 // it's important to place the event as the first in the array because
6875 // the whole point is ensuring the v-model callback gets called before
6876 // user-attached handlers.
6877 function normalizeEvents (on) {
6878 /* istanbul ignore if */
6879 if (isDef(on[RANGE_TOKEN])) {
6880 // IE input[type=range] only supports `change` event
6881 var event = isIE ? 'change' : 'input';
6882 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
6883 delete on[RANGE_TOKEN];
6884 }
6885 // This was originally intended to fix #4521 but no longer necessary
6886 // after 2.5. Keeping it for backwards compat with generated code from < 2.4
6887 /* istanbul ignore if */
6888 if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
6889 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
6890 delete on[CHECKBOX_RADIO_TOKEN];
6891 }
6892 }
6893
6894 var target$1;
6895
6896 function createOnceHandler$1 (event, handler, capture) {
6897 var _target = target$1; // save current target element in closure
6898 return function onceHandler () {
6899 var res = handler.apply(null, arguments);
6900 if (res !== null) {
6901 remove$2(event, onceHandler, capture, _target);
6902 }
6903 }
6904 }
6905
6906 // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
6907 // implementation and does not fire microtasks in between event propagation, so
6908 // safe to exclude.
6909 var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
6910
6911 function add$1 (
6912 name,
6913 handler,
6914 capture,
6915 passive
6916 ) {
6917 // async edge case #6566: inner click event triggers patch, event handler
6918 // attached to outer element during patch, and triggered again. This
6919 // happens because browsers fire microtask ticks between event propagation.
6920 // the solution is simple: we save the timestamp when a handler is attached,
6921 // and the handler would only fire if the event passed to it was fired
6922 // AFTER it was attached.
6923 if (useMicrotaskFix) {
6924 var attachedTimestamp = currentFlushTimestamp;
6925 var original = handler;
6926 handler = original._wrapper = function (e) {
6927 if (
6928 // no bubbling, should always fire.
6929 // this is just a safety net in case event.timeStamp is unreliable in
6930 // certain weird environments...
6931 e.target === e.currentTarget ||
6932 // event is fired after handler attachment
6933 e.timeStamp >= attachedTimestamp ||
6934 // bail for environments that have buggy event.timeStamp implementations
6935 // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
6936 // #9681 QtWebEngine event.timeStamp is negative value
6937 e.timeStamp <= 0 ||
6938 // #9448 bail if event is fired in another document in a multi-page
6939 // electron/nw.js app, since event.timeStamp will be using a different
6940 // starting reference
6941 e.target.ownerDocument !== document
6942 ) {
6943 return original.apply(this, arguments)
6944 }
6945 };
6946 }
6947 target$1.addEventListener(
6948 name,
6949 handler,
6950 supportsPassive
6951 ? { capture: capture, passive: passive }
6952 : capture
6953 );
6954 }
6955
6956 function remove$2 (
6957 name,
6958 handler,
6959 capture,
6960 _target
6961 ) {
6962 (_target || target$1).removeEventListener(
6963 name,
6964 handler._wrapper || handler,
6965 capture
6966 );
6967 }
6968
6969 function updateDOMListeners (oldVnode, vnode) {
6970 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
6971 return
6972 }
6973 var on = vnode.data.on || {};
6974 var oldOn = oldVnode.data.on || {};
6975 target$1 = vnode.elm;
6976 normalizeEvents(on);
6977 updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
6978 target$1 = undefined;
6979 }
6980
6981 var events = {
6982 create: updateDOMListeners,
6983 update: updateDOMListeners
6984 };
6985
6986 /* */
6987
6988 var svgContainer;
6989
6990 function updateDOMProps (oldVnode, vnode) {
6991 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
6992 return
6993 }
6994 var key, cur;
6995 var elm = vnode.elm;
6996 var oldProps = oldVnode.data.domProps || {};
6997 var props = vnode.data.domProps || {};
6998 // clone observed objects, as the user probably wants to mutate it
6999 if (isDef(props.__ob__)) {
7000 props = vnode.data.domProps = extend({}, props);
7001 }
7002
7003 for (key in oldProps) {
7004 if (!(key in props)) {
7005 elm[key] = '';
7006 }
7007 }
7008
7009 for (key in props) {
7010 cur = props[key];
7011 // ignore children if the node has textContent or innerHTML,
7012 // as these will throw away existing DOM nodes and cause removal errors
7013 // on subsequent patches (#3360)
7014 if (key === 'textContent' || key === 'innerHTML') {
7015 if (vnode.children) { vnode.children.length = 0; }
7016 if (cur === oldProps[key]) { continue }
7017 // #6601 work around Chrome version <= 55 bug where single textNode
7018 // replaced by innerHTML/textContent retains its parentNode property
7019 if (elm.childNodes.length === 1) {
7020 elm.removeChild(elm.childNodes[0]);
7021 }
7022 }
7023
7024 if (key === 'value' && elm.tagName !== 'PROGRESS') {
7025 // store value as _value as well since
7026 // non-string values will be stringified
7027 elm._value = cur;
7028 // avoid resetting cursor position when value is the same
7029 var strCur = isUndef(cur) ? '' : String(cur);
7030 if (shouldUpdateValue(elm, strCur)) {
7031 elm.value = strCur;
7032 }
7033 } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
7034 // IE doesn't support innerHTML for SVG elements
7035 svgContainer = svgContainer || document.createElement('div');
7036 svgContainer.innerHTML = "<svg>" + cur + "</svg>";
7037 var svg = svgContainer.firstChild;
7038 while (elm.firstChild) {
7039 elm.removeChild(elm.firstChild);
7040 }
7041 while (svg.firstChild) {
7042 elm.appendChild(svg.firstChild);
7043 }
7044 } else if (
7045 // skip the update if old and new VDOM state is the same.
7046 // `value` is handled separately because the DOM value may be temporarily
7047 // out of sync with VDOM state due to focus, composition and modifiers.
7048 // This #4521 by skipping the unnecessary `checked` update.
7049 cur !== oldProps[key]
7050 ) {
7051 // some property updates can throw
7052 // e.g. `value` on <progress> w/ non-finite value
7053 try {
7054 elm[key] = cur;
7055 } catch (e) {}
7056 }
7057 }
7058 }
7059
7060 // check platforms/web/util/attrs.js acceptValue
7061
7062
7063 function shouldUpdateValue (elm, checkVal) {
7064 return (!elm.composing && (
7065 elm.tagName === 'OPTION' ||
7066 isNotInFocusAndDirty(elm, checkVal) ||
7067 isDirtyWithModifiers(elm, checkVal)
7068 ))
7069 }
7070
7071 function isNotInFocusAndDirty (elm, checkVal) {
7072 // return true when textbox (.number and .trim) loses focus and its value is
7073 // not equal to the updated value
7074 var notInFocus = true;
7075 // #6157
7076 // work around IE bug when accessing document.activeElement in an iframe
7077 try { notInFocus = document.activeElement !== elm; } catch (e) {}
7078 return notInFocus && elm.value !== checkVal
7079 }
7080
7081 function isDirtyWithModifiers (elm, newVal) {
7082 var value = elm.value;
7083 var modifiers = elm._vModifiers; // injected by v-model runtime
7084 if (isDef(modifiers)) {
7085 if (modifiers.number) {
7086 return toNumber(value) !== toNumber(newVal)
7087 }
7088 if (modifiers.trim) {
7089 return value.trim() !== newVal.trim()
7090 }
7091 }
7092 return value !== newVal
7093 }
7094
7095 var domProps = {
7096 create: updateDOMProps,
7097 update: updateDOMProps
7098 };
7099
7100 /* */
7101
7102 var parseStyleText = cached(function (cssText) {
7103 var res = {};
7104 var listDelimiter = /;(?![^(]*\))/g;
7105 var propertyDelimiter = /:(.+)/;
7106 cssText.split(listDelimiter).forEach(function (item) {
7107 if (item) {
7108 var tmp = item.split(propertyDelimiter);
7109 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
7110 }
7111 });
7112 return res
7113 });
7114
7115 // merge static and dynamic style data on the same vnode
7116 function normalizeStyleData (data) {
7117 var style = normalizeStyleBinding(data.style);
7118 // static style is pre-processed into an object during compilation
7119 // and is always a fresh object, so it's safe to merge into it
7120 return data.staticStyle
7121 ? extend(data.staticStyle, style)
7122 : style
7123 }
7124
7125 // normalize possible array / string values into Object
7126 function normalizeStyleBinding (bindingStyle) {
7127 if (Array.isArray(bindingStyle)) {
7128 return toObject(bindingStyle)
7129 }
7130 if (typeof bindingStyle === 'string') {
7131 return parseStyleText(bindingStyle)
7132 }
7133 return bindingStyle
7134 }
7135
7136 /**
7137 * parent component style should be after child's
7138 * so that parent component's style could override it
7139 */
7140 function getStyle (vnode, checkChild) {
7141 var res = {};
7142 var styleData;
7143
7144 if (checkChild) {
7145 var childNode = vnode;
7146 while (childNode.componentInstance) {
7147 childNode = childNode.componentInstance._vnode;
7148 if (
7149 childNode && childNode.data &&
7150 (styleData = normalizeStyleData(childNode.data))
7151 ) {
7152 extend(res, styleData);
7153 }
7154 }
7155 }
7156
7157 if ((styleData = normalizeStyleData(vnode.data))) {
7158 extend(res, styleData);
7159 }
7160
7161 var parentNode = vnode;
7162 while ((parentNode = parentNode.parent)) {
7163 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
7164 extend(res, styleData);
7165 }
7166 }
7167 return res
7168 }
7169
7170 /* */
7171
7172 var cssVarRE = /^--/;
7173 var importantRE = /\s*!important$/;
7174 var setProp = function (el, name, val) {
7175 /* istanbul ignore if */
7176 if (cssVarRE.test(name)) {
7177 el.style.setProperty(name, val);
7178 } else if (importantRE.test(val)) {
7179 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
7180 } else {
7181 var normalizedName = normalize(name);
7182 if (Array.isArray(val)) {
7183 // Support values array created by autoprefixer, e.g.
7184 // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
7185 // Set them one by one, and the browser will only set those it can recognize
7186 for (var i = 0, len = val.length; i < len; i++) {
7187 el.style[normalizedName] = val[i];
7188 }
7189 } else {
7190 el.style[normalizedName] = val;
7191 }
7192 }
7193 };
7194
7195 var vendorNames = ['Webkit', 'Moz', 'ms'];
7196
7197 var emptyStyle;
7198 var normalize = cached(function (prop) {
7199 emptyStyle = emptyStyle || document.createElement('div').style;
7200 prop = camelize(prop);
7201 if (prop !== 'filter' && (prop in emptyStyle)) {
7202 return prop
7203 }
7204 var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
7205 for (var i = 0; i < vendorNames.length; i++) {
7206 var name = vendorNames[i] + capName;
7207 if (name in emptyStyle) {
7208 return name
7209 }
7210 }
7211 });
7212
7213 function updateStyle (oldVnode, vnode) {
7214 var data = vnode.data;
7215 var oldData = oldVnode.data;
7216
7217 if (isUndef(data.staticStyle) && isUndef(data.style) &&
7218 isUndef(oldData.staticStyle) && isUndef(oldData.style)
7219 ) {
7220 return
7221 }
7222
7223 var cur, name;
7224 var el = vnode.elm;
7225 var oldStaticStyle = oldData.staticStyle;
7226 var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
7227
7228 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
7229 var oldStyle = oldStaticStyle || oldStyleBinding;
7230
7231 var style = normalizeStyleBinding(vnode.data.style) || {};
7232
7233 // store normalized style under a different key for next diff
7234 // make sure to clone it if it's reactive, since the user likely wants
7235 // to mutate it.
7236 vnode.data.normalizedStyle = isDef(style.__ob__)
7237 ? extend({}, style)
7238 : style;
7239
7240 var newStyle = getStyle(vnode, true);
7241
7242 for (name in oldStyle) {
7243 if (isUndef(newStyle[name])) {
7244 setProp(el, name, '');
7245 }
7246 }
7247 for (name in newStyle) {
7248 cur = newStyle[name];
7249 if (cur !== oldStyle[name]) {
7250 // ie9 setting to null has no effect, must use empty string
7251 setProp(el, name, cur == null ? '' : cur);
7252 }
7253 }
7254 }
7255
7256 var style = {
7257 create: updateStyle,
7258 update: updateStyle
7259 };
7260
7261 /* */
7262
7263 var whitespaceRE = /\s+/;
7264
7265 /**
7266 * Add class with compatibility for SVG since classList is not supported on
7267 * SVG elements in IE
7268 */
7269 function addClass (el, cls) {
7270 /* istanbul ignore if */
7271 if (!cls || !(cls = cls.trim())) {
7272 return
7273 }
7274
7275 /* istanbul ignore else */
7276 if (el.classList) {
7277 if (cls.indexOf(' ') > -1) {
7278 cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
7279 } else {
7280 el.classList.add(cls);
7281 }
7282 } else {
7283 var cur = " " + (el.getAttribute('class') || '') + " ";
7284 if (cur.indexOf(' ' + cls + ' ') < 0) {
7285 el.setAttribute('class', (cur + cls).trim());
7286 }
7287 }
7288 }
7289
7290 /**
7291 * Remove class with compatibility for SVG since classList is not supported on
7292 * SVG elements in IE
7293 */
7294 function removeClass (el, cls) {
7295 /* istanbul ignore if */
7296 if (!cls || !(cls = cls.trim())) {
7297 return
7298 }
7299
7300 /* istanbul ignore else */
7301 if (el.classList) {
7302 if (cls.indexOf(' ') > -1) {
7303 cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
7304 } else {
7305 el.classList.remove(cls);
7306 }
7307 if (!el.classList.length) {
7308 el.removeAttribute('class');
7309 }
7310 } else {
7311 var cur = " " + (el.getAttribute('class') || '') + " ";
7312 var tar = ' ' + cls + ' ';
7313 while (cur.indexOf(tar) >= 0) {
7314 cur = cur.replace(tar, ' ');
7315 }
7316 cur = cur.trim();
7317 if (cur) {
7318 el.setAttribute('class', cur);
7319 } else {
7320 el.removeAttribute('class');
7321 }
7322 }
7323 }
7324
7325 /* */
7326
7327 function resolveTransition (def$$1) {
7328 if (!def$$1) {
7329 return
7330 }
7331 /* istanbul ignore else */
7332 if (typeof def$$1 === 'object') {
7333 var res = {};
7334 if (def$$1.css !== false) {
7335 extend(res, autoCssTransition(def$$1.name || 'v'));
7336 }
7337 extend(res, def$$1);
7338 return res
7339 } else if (typeof def$$1 === 'string') {
7340 return autoCssTransition(def$$1)
7341 }
7342 }
7343
7344 var autoCssTransition = cached(function (name) {
7345 return {
7346 enterClass: (name + "-enter"),
7347 enterToClass: (name + "-enter-to"),
7348 enterActiveClass: (name + "-enter-active"),
7349 leaveClass: (name + "-leave"),
7350 leaveToClass: (name + "-leave-to"),
7351 leaveActiveClass: (name + "-leave-active")
7352 }
7353 });
7354
7355 var hasTransition = inBrowser && !isIE9;
7356 var TRANSITION = 'transition';
7357 var ANIMATION = 'animation';
7358
7359 // Transition property/event sniffing
7360 var transitionProp = 'transition';
7361 var transitionEndEvent = 'transitionend';
7362 var animationProp = 'animation';
7363 var animationEndEvent = 'animationend';
7364 if (hasTransition) {
7365 /* istanbul ignore if */
7366 if (window.ontransitionend === undefined &&
7367 window.onwebkittransitionend !== undefined
7368 ) {
7369 transitionProp = 'WebkitTransition';
7370 transitionEndEvent = 'webkitTransitionEnd';
7371 }
7372 if (window.onanimationend === undefined &&
7373 window.onwebkitanimationend !== undefined
7374 ) {
7375 animationProp = 'WebkitAnimation';
7376 animationEndEvent = 'webkitAnimationEnd';
7377 }
7378 }
7379
7380 // binding to window is necessary to make hot reload work in IE in strict mode
7381 var raf = inBrowser
7382 ? window.requestAnimationFrame
7383 ? window.requestAnimationFrame.bind(window)
7384 : setTimeout
7385 : /* istanbul ignore next */ function (fn) { return fn(); };
7386
7387 function nextFrame (fn) {
7388 raf(function () {
7389 raf(fn);
7390 });
7391 }
7392
7393 function addTransitionClass (el, cls) {
7394 var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
7395 if (transitionClasses.indexOf(cls) < 0) {
7396 transitionClasses.push(cls);
7397 addClass(el, cls);
7398 }
7399 }
7400
7401 function removeTransitionClass (el, cls) {
7402 if (el._transitionClasses) {
7403 remove(el._transitionClasses, cls);
7404 }
7405 removeClass(el, cls);
7406 }
7407
7408 function whenTransitionEnds (
7409 el,
7410 expectedType,
7411 cb
7412 ) {
7413 var ref = getTransitionInfo(el, expectedType);
7414 var type = ref.type;
7415 var timeout = ref.timeout;
7416 var propCount = ref.propCount;
7417 if (!type) { return cb() }
7418 var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
7419 var ended = 0;
7420 var end = function () {
7421 el.removeEventListener(event, onEnd);
7422 cb();
7423 };
7424 var onEnd = function (e) {
7425 if (e.target === el) {
7426 if (++ended >= propCount) {
7427 end();
7428 }
7429 }
7430 };
7431 setTimeout(function () {
7432 if (ended < propCount) {
7433 end();
7434 }
7435 }, timeout + 1);
7436 el.addEventListener(event, onEnd);
7437 }
7438
7439 var transformRE = /\b(transform|all)(,|$)/;
7440
7441 function getTransitionInfo (el, expectedType) {
7442 var styles = window.getComputedStyle(el);
7443 // JSDOM may return undefined for transition properties
7444 var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
7445 var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
7446 var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
7447 var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
7448 var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
7449 var animationTimeout = getTimeout(animationDelays, animationDurations);
7450
7451 var type;
7452 var timeout = 0;
7453 var propCount = 0;
7454 /* istanbul ignore if */
7455 if (expectedType === TRANSITION) {
7456 if (transitionTimeout > 0) {
7457 type = TRANSITION;
7458 timeout = transitionTimeout;
7459 propCount = transitionDurations.length;
7460 }
7461 } else if (expectedType === ANIMATION) {
7462 if (animationTimeout > 0) {
7463 type = ANIMATION;
7464 timeout = animationTimeout;
7465 propCount = animationDurations.length;
7466 }
7467 } else {
7468 timeout = Math.max(transitionTimeout, animationTimeout);
7469 type = timeout > 0
7470 ? transitionTimeout > animationTimeout
7471 ? TRANSITION
7472 : ANIMATION
7473 : null;
7474 propCount = type
7475 ? type === TRANSITION
7476 ? transitionDurations.length
7477 : animationDurations.length
7478 : 0;
7479 }
7480 var hasTransform =
7481 type === TRANSITION &&
7482 transformRE.test(styles[transitionProp + 'Property']);
7483 return {
7484 type: type,
7485 timeout: timeout,
7486 propCount: propCount,
7487 hasTransform: hasTransform
7488 }
7489 }
7490
7491 function getTimeout (delays, durations) {
7492 /* istanbul ignore next */
7493 while (delays.length < durations.length) {
7494 delays = delays.concat(delays);
7495 }
7496
7497 return Math.max.apply(null, durations.map(function (d, i) {
7498 return toMs(d) + toMs(delays[i])
7499 }))
7500 }
7501
7502 // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
7503 // in a locale-dependent way, using a comma instead of a dot.
7504 // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
7505 // as a floor function) causing unexpected behaviors
7506 function toMs (s) {
7507 return Number(s.slice(0, -1).replace(',', '.')) * 1000
7508 }
7509
7510 /* */
7511
7512 function enter (vnode, toggleDisplay) {
7513 var el = vnode.elm;
7514
7515 // call leave callback now
7516 if (isDef(el._leaveCb)) {
7517 el._leaveCb.cancelled = true;
7518 el._leaveCb();
7519 }
7520
7521 var data = resolveTransition(vnode.data.transition);
7522 if (isUndef(data)) {
7523 return
7524 }
7525
7526 /* istanbul ignore if */
7527 if (isDef(el._enterCb) || el.nodeType !== 1) {
7528 return
7529 }
7530
7531 var css = data.css;
7532 var type = data.type;
7533 var enterClass = data.enterClass;
7534 var enterToClass = data.enterToClass;
7535 var enterActiveClass = data.enterActiveClass;
7536 var appearClass = data.appearClass;
7537 var appearToClass = data.appearToClass;
7538 var appearActiveClass = data.appearActiveClass;
7539 var beforeEnter = data.beforeEnter;
7540 var enter = data.enter;
7541 var afterEnter = data.afterEnter;
7542 var enterCancelled = data.enterCancelled;
7543 var beforeAppear = data.beforeAppear;
7544 var appear = data.appear;
7545 var afterAppear = data.afterAppear;
7546 var appearCancelled = data.appearCancelled;
7547 var duration = data.duration;
7548
7549 // activeInstance will always be the <transition> component managing this
7550 // transition. One edge case to check is when the <transition> is placed
7551 // as the root node of a child component. In that case we need to check
7552 // <transition>'s parent for appear check.
7553 var context = activeInstance;
7554 var transitionNode = activeInstance.$vnode;
7555 while (transitionNode && transitionNode.parent) {
7556 context = transitionNode.context;
7557 transitionNode = transitionNode.parent;
7558 }
7559
7560 var isAppear = !context._isMounted || !vnode.isRootInsert;
7561
7562 if (isAppear && !appear && appear !== '') {
7563 return
7564 }
7565
7566 var startClass = isAppear && appearClass
7567 ? appearClass
7568 : enterClass;
7569 var activeClass = isAppear && appearActiveClass
7570 ? appearActiveClass
7571 : enterActiveClass;
7572 var toClass = isAppear && appearToClass
7573 ? appearToClass
7574 : enterToClass;
7575
7576 var beforeEnterHook = isAppear
7577 ? (beforeAppear || beforeEnter)
7578 : beforeEnter;
7579 var enterHook = isAppear
7580 ? (typeof appear === 'function' ? appear : enter)
7581 : enter;
7582 var afterEnterHook = isAppear
7583 ? (afterAppear || afterEnter)
7584 : afterEnter;
7585 var enterCancelledHook = isAppear
7586 ? (appearCancelled || enterCancelled)
7587 : enterCancelled;
7588
7589 var explicitEnterDuration = toNumber(
7590 isObject(duration)
7591 ? duration.enter
7592 : duration
7593 );
7594
7595 if (explicitEnterDuration != null) {
7596 checkDuration(explicitEnterDuration, 'enter', vnode);
7597 }
7598
7599 var expectsCSS = css !== false && !isIE9;
7600 var userWantsControl = getHookArgumentsLength(enterHook);
7601
7602 var cb = el._enterCb = once(function () {
7603 if (expectsCSS) {
7604 removeTransitionClass(el, toClass);
7605 removeTransitionClass(el, activeClass);
7606 }
7607 if (cb.cancelled) {
7608 if (expectsCSS) {
7609 removeTransitionClass(el, startClass);
7610 }
7611 enterCancelledHook && enterCancelledHook(el);
7612 } else {
7613 afterEnterHook && afterEnterHook(el);
7614 }
7615 el._enterCb = null;
7616 });
7617
7618 if (!vnode.data.show) {
7619 // remove pending leave element on enter by injecting an insert hook
7620 mergeVNodeHook(vnode, 'insert', function () {
7621 var parent = el.parentNode;
7622 var pendingNode = parent && parent._pending && parent._pending[vnode.key];
7623 if (pendingNode &&
7624 pendingNode.tag === vnode.tag &&
7625 pendingNode.elm._leaveCb
7626 ) {
7627 pendingNode.elm._leaveCb();
7628 }
7629 enterHook && enterHook(el, cb);
7630 });
7631 }
7632
7633 // start enter transition
7634 beforeEnterHook && beforeEnterHook(el);
7635 if (expectsCSS) {
7636 addTransitionClass(el, startClass);
7637 addTransitionClass(el, activeClass);
7638 nextFrame(function () {
7639 removeTransitionClass(el, startClass);
7640 if (!cb.cancelled) {
7641 addTransitionClass(el, toClass);
7642 if (!userWantsControl) {
7643 if (isValidDuration(explicitEnterDuration)) {
7644 setTimeout(cb, explicitEnterDuration);
7645 } else {
7646 whenTransitionEnds(el, type, cb);
7647 }
7648 }
7649 }
7650 });
7651 }
7652
7653 if (vnode.data.show) {
7654 toggleDisplay && toggleDisplay();
7655 enterHook && enterHook(el, cb);
7656 }
7657
7658 if (!expectsCSS && !userWantsControl) {
7659 cb();
7660 }
7661 }
7662
7663 function leave (vnode, rm) {
7664 var el = vnode.elm;
7665
7666 // call enter callback now
7667 if (isDef(el._enterCb)) {
7668 el._enterCb.cancelled = true;
7669 el._enterCb();
7670 }
7671
7672 var data = resolveTransition(vnode.data.transition);
7673 if (isUndef(data) || el.nodeType !== 1) {
7674 return rm()
7675 }
7676
7677 /* istanbul ignore if */
7678 if (isDef(el._leaveCb)) {
7679 return
7680 }
7681
7682 var css = data.css;
7683 var type = data.type;
7684 var leaveClass = data.leaveClass;
7685 var leaveToClass = data.leaveToClass;
7686 var leaveActiveClass = data.leaveActiveClass;
7687 var beforeLeave = data.beforeLeave;
7688 var leave = data.leave;
7689 var afterLeave = data.afterLeave;
7690 var leaveCancelled = data.leaveCancelled;
7691 var delayLeave = data.delayLeave;
7692 var duration = data.duration;
7693
7694 var expectsCSS = css !== false && !isIE9;
7695 var userWantsControl = getHookArgumentsLength(leave);
7696
7697 var explicitLeaveDuration = toNumber(
7698 isObject(duration)
7699 ? duration.leave
7700 : duration
7701 );
7702
7703 if (isDef(explicitLeaveDuration)) {
7704 checkDuration(explicitLeaveDuration, 'leave', vnode);
7705 }
7706
7707 var cb = el._leaveCb = once(function () {
7708 if (el.parentNode && el.parentNode._pending) {
7709 el.parentNode._pending[vnode.key] = null;
7710 }
7711 if (expectsCSS) {
7712 removeTransitionClass(el, leaveToClass);
7713 removeTransitionClass(el, leaveActiveClass);
7714 }
7715 if (cb.cancelled) {
7716 if (expectsCSS) {
7717 removeTransitionClass(el, leaveClass);
7718 }
7719 leaveCancelled && leaveCancelled(el);
7720 } else {
7721 rm();
7722 afterLeave && afterLeave(el);
7723 }
7724 el._leaveCb = null;
7725 });
7726
7727 if (delayLeave) {
7728 delayLeave(performLeave);
7729 } else {
7730 performLeave();
7731 }
7732
7733 function performLeave () {
7734 // the delayed leave may have already been cancelled
7735 if (cb.cancelled) {
7736 return
7737 }
7738 // record leaving element
7739 if (!vnode.data.show && el.parentNode) {
7740 (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
7741 }
7742 beforeLeave && beforeLeave(el);
7743 if (expectsCSS) {
7744 addTransitionClass(el, leaveClass);
7745 addTransitionClass(el, leaveActiveClass);
7746 nextFrame(function () {
7747 removeTransitionClass(el, leaveClass);
7748 if (!cb.cancelled) {
7749 addTransitionClass(el, leaveToClass);
7750 if (!userWantsControl) {
7751 if (isValidDuration(explicitLeaveDuration)) {
7752 setTimeout(cb, explicitLeaveDuration);
7753 } else {
7754 whenTransitionEnds(el, type, cb);
7755 }
7756 }
7757 }
7758 });
7759 }
7760 leave && leave(el, cb);
7761 if (!expectsCSS && !userWantsControl) {
7762 cb();
7763 }
7764 }
7765 }
7766
7767 // only used in dev mode
7768 function checkDuration (val, name, vnode) {
7769 if (typeof val !== 'number') {
7770 warn(
7771 "<transition> explicit " + name + " duration is not a valid number - " +
7772 "got " + (JSON.stringify(val)) + ".",
7773 vnode.context
7774 );
7775 } else if (isNaN(val)) {
7776 warn(
7777 "<transition> explicit " + name + " duration is NaN - " +
7778 'the duration expression might be incorrect.',
7779 vnode.context
7780 );
7781 }
7782 }
7783
7784 function isValidDuration (val) {
7785 return typeof val === 'number' && !isNaN(val)
7786 }
7787
7788 /**
7789 * Normalize a transition hook's argument length. The hook may be:
7790 * - a merged hook (invoker) with the original in .fns
7791 * - a wrapped component method (check ._length)
7792 * - a plain function (.length)
7793 */
7794 function getHookArgumentsLength (fn) {
7795 if (isUndef(fn)) {
7796 return false
7797 }
7798 var invokerFns = fn.fns;
7799 if (isDef(invokerFns)) {
7800 // invoker
7801 return getHookArgumentsLength(
7802 Array.isArray(invokerFns)
7803 ? invokerFns[0]
7804 : invokerFns
7805 )
7806 } else {
7807 return (fn._length || fn.length) > 1
7808 }
7809 }
7810
7811 function _enter (_, vnode) {
7812 if (vnode.data.show !== true) {
7813 enter(vnode);
7814 }
7815 }
7816
7817 var transition = inBrowser ? {
7818 create: _enter,
7819 activate: _enter,
7820 remove: function remove$$1 (vnode, rm) {
7821 /* istanbul ignore else */
7822 if (vnode.data.show !== true) {
7823 leave(vnode, rm);
7824 } else {
7825 rm();
7826 }
7827 }
7828 } : {};
7829
7830 var platformModules = [
7831 attrs,
7832 klass,
7833 events,
7834 domProps,
7835 style,
7836 transition
7837 ];
7838
7839 /* */
7840
7841 // the directive module should be applied last, after all
7842 // built-in modules have been applied.
7843 var modules = platformModules.concat(baseModules);
7844
7845 var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
7846
7847 /**
7848 * Not type checking this file because flow doesn't like attaching
7849 * properties to Elements.
7850 */
7851
7852 /* istanbul ignore if */
7853 if (isIE9) {
7854 // http://www.matts411.com/post/internet-explorer-9-oninput/
7855 document.addEventListener('selectionchange', function () {
7856 var el = document.activeElement;
7857 if (el && el.vmodel) {
7858 trigger(el, 'input');
7859 }
7860 });
7861 }
7862
7863 var directive = {
7864 inserted: function inserted (el, binding, vnode, oldVnode) {
7865 if (vnode.tag === 'select') {
7866 // #6903
7867 if (oldVnode.elm && !oldVnode.elm._vOptions) {
7868 mergeVNodeHook(vnode, 'postpatch', function () {
7869 directive.componentUpdated(el, binding, vnode);
7870 });
7871 } else {
7872 setSelected(el, binding, vnode.context);
7873 }
7874 el._vOptions = [].map.call(el.options, getValue);
7875 } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
7876 el._vModifiers = binding.modifiers;
7877 if (!binding.modifiers.lazy) {
7878 el.addEventListener('compositionstart', onCompositionStart);
7879 el.addEventListener('compositionend', onCompositionEnd);
7880 // Safari < 10.2 & UIWebView doesn't fire compositionend when
7881 // switching focus before confirming composition choice
7882 // this also fixes the issue where some browsers e.g. iOS Chrome
7883 // fires "change" instead of "input" on autocomplete.
7884 el.addEventListener('change', onCompositionEnd);
7885 /* istanbul ignore if */
7886 if (isIE9) {
7887 el.vmodel = true;
7888 }
7889 }
7890 }
7891 },
7892
7893 componentUpdated: function componentUpdated (el, binding, vnode) {
7894 if (vnode.tag === 'select') {
7895 setSelected(el, binding, vnode.context);
7896 // in case the options rendered by v-for have changed,
7897 // it's possible that the value is out-of-sync with the rendered options.
7898 // detect such cases and filter out values that no longer has a matching
7899 // option in the DOM.
7900 var prevOptions = el._vOptions;
7901 var curOptions = el._vOptions = [].map.call(el.options, getValue);
7902 if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
7903 // trigger change event if
7904 // no matching option found for at least one value
7905 var needReset = el.multiple
7906 ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
7907 : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
7908 if (needReset) {
7909 trigger(el, 'change');
7910 }
7911 }
7912 }
7913 }
7914 };
7915
7916 function setSelected (el, binding, vm) {
7917 actuallySetSelected(el, binding, vm);
7918 /* istanbul ignore if */
7919 if (isIE || isEdge) {
7920 setTimeout(function () {
7921 actuallySetSelected(el, binding, vm);
7922 }, 0);
7923 }
7924 }
7925
7926 function actuallySetSelected (el, binding, vm) {
7927 var value = binding.value;
7928 var isMultiple = el.multiple;
7929 if (isMultiple && !Array.isArray(value)) {
7930 warn(
7931 "<select multiple v-model=\"" + (binding.expression) + "\"> " +
7932 "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
7933 vm
7934 );
7935 return
7936 }
7937 var selected, option;
7938 for (var i = 0, l = el.options.length; i < l; i++) {
7939 option = el.options[i];
7940 if (isMultiple) {
7941 selected = looseIndexOf(value, getValue(option)) > -1;
7942 if (option.selected !== selected) {
7943 option.selected = selected;
7944 }
7945 } else {
7946 if (looseEqual(getValue(option), value)) {
7947 if (el.selectedIndex !== i) {
7948 el.selectedIndex = i;
7949 }
7950 return
7951 }
7952 }
7953 }
7954 if (!isMultiple) {
7955 el.selectedIndex = -1;
7956 }
7957 }
7958
7959 function hasNoMatchingOption (value, options) {
7960 return options.every(function (o) { return !looseEqual(o, value); })
7961 }
7962
7963 function getValue (option) {
7964 return '_value' in option
7965 ? option._value
7966 : option.value
7967 }
7968
7969 function onCompositionStart (e) {
7970 e.target.composing = true;
7971 }
7972
7973 function onCompositionEnd (e) {
7974 // prevent triggering an input event for no reason
7975 if (!e.target.composing) { return }
7976 e.target.composing = false;
7977 trigger(e.target, 'input');
7978 }
7979
7980 function trigger (el, type) {
7981 var e = document.createEvent('HTMLEvents');
7982 e.initEvent(type, true, true);
7983 el.dispatchEvent(e);
7984 }
7985
7986 /* */
7987
7988 // recursively search for possible transition defined inside the component root
7989 function locateNode (vnode) {
7990 return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
7991 ? locateNode(vnode.componentInstance._vnode)
7992 : vnode
7993 }
7994
7995 var show = {
7996 bind: function bind (el, ref, vnode) {
7997 var value = ref.value;
7998
7999 vnode = locateNode(vnode);
8000 var transition$$1 = vnode.data && vnode.data.transition;
8001 var originalDisplay = el.__vOriginalDisplay =
8002 el.style.display === 'none' ? '' : el.style.display;
8003 if (value && transition$$1) {
8004 vnode.data.show = true;
8005 enter(vnode, function () {
8006 el.style.display = originalDisplay;
8007 });
8008 } else {
8009 el.style.display = value ? originalDisplay : 'none';
8010 }
8011 },
8012
8013 update: function update (el, ref, vnode) {
8014 var value = ref.value;
8015 var oldValue = ref.oldValue;
8016
8017 /* istanbul ignore if */
8018 if (!value === !oldValue) { return }
8019 vnode = locateNode(vnode);
8020 var transition$$1 = vnode.data && vnode.data.transition;
8021 if (transition$$1) {
8022 vnode.data.show = true;
8023 if (value) {
8024 enter(vnode, function () {
8025 el.style.display = el.__vOriginalDisplay;
8026 });
8027 } else {
8028 leave(vnode, function () {
8029 el.style.display = 'none';
8030 });
8031 }
8032 } else {
8033 el.style.display = value ? el.__vOriginalDisplay : 'none';
8034 }
8035 },
8036
8037 unbind: function unbind (
8038 el,
8039 binding,
8040 vnode,
8041 oldVnode,
8042 isDestroy
8043 ) {
8044 if (!isDestroy) {
8045 el.style.display = el.__vOriginalDisplay;
8046 }
8047 }
8048 };
8049
8050 var platformDirectives = {
8051 model: directive,
8052 show: show
8053 };
8054
8055 /* */
8056
8057 var transitionProps = {
8058 name: String,
8059 appear: Boolean,
8060 css: Boolean,
8061 mode: String,
8062 type: String,
8063 enterClass: String,
8064 leaveClass: String,
8065 enterToClass: String,
8066 leaveToClass: String,
8067 enterActiveClass: String,
8068 leaveActiveClass: String,
8069 appearClass: String,
8070 appearActiveClass: String,
8071 appearToClass: String,
8072 duration: [Number, String, Object]
8073 };
8074
8075 // in case the child is also an abstract component, e.g. <keep-alive>
8076 // we want to recursively retrieve the real component to be rendered
8077 function getRealChild (vnode) {
8078 var compOptions = vnode && vnode.componentOptions;
8079 if (compOptions && compOptions.Ctor.options.abstract) {
8080 return getRealChild(getFirstComponentChild(compOptions.children))
8081 } else {
8082 return vnode
8083 }
8084 }
8085
8086 function extractTransitionData (comp) {
8087 var data = {};
8088 var options = comp.$options;
8089 // props
8090 for (var key in options.propsData) {
8091 data[key] = comp[key];
8092 }
8093 // events.
8094 // extract listeners and pass them directly to the transition methods
8095 var listeners = options._parentListeners;
8096 for (var key$1 in listeners) {
8097 data[camelize(key$1)] = listeners[key$1];
8098 }
8099 return data
8100 }
8101
8102 function placeholder (h, rawChild) {
8103 if (/\d-keep-alive$/.test(rawChild.tag)) {
8104 return h('keep-alive', {
8105 props: rawChild.componentOptions.propsData
8106 })
8107 }
8108 }
8109
8110 function hasParentTransition (vnode) {
8111 while ((vnode = vnode.parent)) {
8112 if (vnode.data.transition) {
8113 return true
8114 }
8115 }
8116 }
8117
8118 function isSameChild (child, oldChild) {
8119 return oldChild.key === child.key && oldChild.tag === child.tag
8120 }
8121
8122 var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
8123
8124 var isVShowDirective = function (d) { return d.name === 'show'; };
8125
8126 var Transition = {
8127 name: 'transition',
8128 props: transitionProps,
8129 abstract: true,
8130
8131 render: function render (h) {
8132 var this$1 = this;
8133
8134 var children = this.$slots.default;
8135 if (!children) {
8136 return
8137 }
8138
8139 // filter out text nodes (possible whitespaces)
8140 children = children.filter(isNotTextNode);
8141 /* istanbul ignore if */
8142 if (!children.length) {
8143 return
8144 }
8145
8146 // warn multiple elements
8147 if (children.length > 1) {
8148 warn(
8149 '<transition> can only be used on a single element. Use ' +
8150 '<transition-group> for lists.',
8151 this.$parent
8152 );
8153 }
8154
8155 var mode = this.mode;
8156
8157 // warn invalid mode
8158 if (mode && mode !== 'in-out' && mode !== 'out-in'
8159 ) {
8160 warn(
8161 'invalid <transition> mode: ' + mode,
8162 this.$parent
8163 );
8164 }
8165
8166 var rawChild = children[0];
8167
8168 // if this is a component root node and the component's
8169 // parent container node also has transition, skip.
8170 if (hasParentTransition(this.$vnode)) {
8171 return rawChild
8172 }
8173
8174 // apply transition data to child
8175 // use getRealChild() to ignore abstract components e.g. keep-alive
8176 var child = getRealChild(rawChild);
8177 /* istanbul ignore if */
8178 if (!child) {
8179 return rawChild
8180 }
8181
8182 if (this._leaving) {
8183 return placeholder(h, rawChild)
8184 }
8185
8186 // ensure a key that is unique to the vnode type and to this transition
8187 // component instance. This key will be used to remove pending leaving nodes
8188 // during entering.
8189 var id = "__transition-" + (this._uid) + "-";
8190 child.key = child.key == null
8191 ? child.isComment
8192 ? id + 'comment'
8193 : id + child.tag
8194 : isPrimitive(child.key)
8195 ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
8196 : child.key;
8197
8198 var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
8199 var oldRawChild = this._vnode;
8200 var oldChild = getRealChild(oldRawChild);
8201
8202 // mark v-show
8203 // so that the transition module can hand over the control to the directive
8204 if (child.data.directives && child.data.directives.some(isVShowDirective)) {
8205 child.data.show = true;
8206 }
8207
8208 if (
8209 oldChild &&
8210 oldChild.data &&
8211 !isSameChild(child, oldChild) &&
8212 !isAsyncPlaceholder(oldChild) &&
8213 // #6687 component root is a comment node
8214 !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
8215 ) {
8216 // replace old child transition data with fresh one
8217 // important for dynamic transitions!
8218 var oldData = oldChild.data.transition = extend({}, data);
8219 // handle transition mode
8220 if (mode === 'out-in') {
8221 // return placeholder node and queue update when leave finishes
8222 this._leaving = true;
8223 mergeVNodeHook(oldData, 'afterLeave', function () {
8224 this$1._leaving = false;
8225 this$1.$forceUpdate();
8226 });
8227 return placeholder(h, rawChild)
8228 } else if (mode === 'in-out') {
8229 if (isAsyncPlaceholder(child)) {
8230 return oldRawChild
8231 }
8232 var delayedLeave;
8233 var performLeave = function () { delayedLeave(); };
8234 mergeVNodeHook(data, 'afterEnter', performLeave);
8235 mergeVNodeHook(data, 'enterCancelled', performLeave);
8236 mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
8237 }
8238 }
8239
8240 return rawChild
8241 }
8242 };
8243
8244 /* */
8245
8246 var props = extend({
8247 tag: String,
8248 moveClass: String
8249 }, transitionProps);
8250
8251 delete props.mode;
8252
8253 var TransitionGroup = {
8254 props: props,
8255
8256 beforeMount: function beforeMount () {
8257 var this$1 = this;
8258
8259 var update = this._update;
8260 this._update = function (vnode, hydrating) {
8261 var restoreActiveInstance = setActiveInstance(this$1);
8262 // force removing pass
8263 this$1.__patch__(
8264 this$1._vnode,
8265 this$1.kept,
8266 false, // hydrating
8267 true // removeOnly (!important, avoids unnecessary moves)
8268 );
8269 this$1._vnode = this$1.kept;
8270 restoreActiveInstance();
8271 update.call(this$1, vnode, hydrating);
8272 };
8273 },
8274
8275 render: function render (h) {
8276 var tag = this.tag || this.$vnode.data.tag || 'span';
8277 var map = Object.create(null);
8278 var prevChildren = this.prevChildren = this.children;
8279 var rawChildren = this.$slots.default || [];
8280 var children = this.children = [];
8281 var transitionData = extractTransitionData(this);
8282
8283 for (var i = 0; i < rawChildren.length; i++) {
8284 var c = rawChildren[i];
8285 if (c.tag) {
8286 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
8287 children.push(c);
8288 map[c.key] = c
8289 ;(c.data || (c.data = {})).transition = transitionData;
8290 } else {
8291 var opts = c.componentOptions;
8292 var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
8293 warn(("<transition-group> children must be keyed: <" + name + ">"));
8294 }
8295 }
8296 }
8297
8298 if (prevChildren) {
8299 var kept = [];
8300 var removed = [];
8301 for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
8302 var c$1 = prevChildren[i$1];
8303 c$1.data.transition = transitionData;
8304 c$1.data.pos = c$1.elm.getBoundingClientRect();
8305 if (map[c$1.key]) {
8306 kept.push(c$1);
8307 } else {
8308 removed.push(c$1);
8309 }
8310 }
8311 this.kept = h(tag, null, kept);
8312 this.removed = removed;
8313 }
8314
8315 return h(tag, null, children)
8316 },
8317
8318 updated: function updated () {
8319 var children = this.prevChildren;
8320 var moveClass = this.moveClass || ((this.name || 'v') + '-move');
8321 if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
8322 return
8323 }
8324
8325 // we divide the work into three loops to avoid mixing DOM reads and writes
8326 // in each iteration - which helps prevent layout thrashing.
8327 children.forEach(callPendingCbs);
8328 children.forEach(recordPosition);
8329 children.forEach(applyTranslation);
8330
8331 // force reflow to put everything in position
8332 // assign to this to avoid being removed in tree-shaking
8333 // $flow-disable-line
8334 this._reflow = document.body.offsetHeight;
8335
8336 children.forEach(function (c) {
8337 if (c.data.moved) {
8338 var el = c.elm;
8339 var s = el.style;
8340 addTransitionClass(el, moveClass);
8341 s.transform = s.WebkitTransform = s.transitionDuration = '';
8342 el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
8343 if (e && e.target !== el) {
8344 return
8345 }
8346 if (!e || /transform$/.test(e.propertyName)) {
8347 el.removeEventListener(transitionEndEvent, cb);
8348 el._moveCb = null;
8349 removeTransitionClass(el, moveClass);
8350 }
8351 });
8352 }
8353 });
8354 },
8355
8356 methods: {
8357 hasMove: function hasMove (el, moveClass) {
8358 /* istanbul ignore if */
8359 if (!hasTransition) {
8360 return false
8361 }
8362 /* istanbul ignore if */
8363 if (this._hasMove) {
8364 return this._hasMove
8365 }
8366 // Detect whether an element with the move class applied has
8367 // CSS transitions. Since the element may be inside an entering
8368 // transition at this very moment, we make a clone of it and remove
8369 // all other transition classes applied to ensure only the move class
8370 // is applied.
8371 var clone = el.cloneNode();
8372 if (el._transitionClasses) {
8373 el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
8374 }
8375 addClass(clone, moveClass);
8376 clone.style.display = 'none';
8377 this.$el.appendChild(clone);
8378 var info = getTransitionInfo(clone);
8379 this.$el.removeChild(clone);
8380 return (this._hasMove = info.hasTransform)
8381 }
8382 }
8383 };
8384
8385 function callPendingCbs (c) {
8386 /* istanbul ignore if */
8387 if (c.elm._moveCb) {
8388 c.elm._moveCb();
8389 }
8390 /* istanbul ignore if */
8391 if (c.elm._enterCb) {
8392 c.elm._enterCb();
8393 }
8394 }
8395
8396 function recordPosition (c) {
8397 c.data.newPos = c.elm.getBoundingClientRect();
8398 }
8399
8400 function applyTranslation (c) {
8401 var oldPos = c.data.pos;
8402 var newPos = c.data.newPos;
8403 var dx = oldPos.left - newPos.left;
8404 var dy = oldPos.top - newPos.top;
8405 if (dx || dy) {
8406 c.data.moved = true;
8407 var s = c.elm.style;
8408 s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
8409 s.transitionDuration = '0s';
8410 }
8411 }
8412
8413 var platformComponents = {
8414 Transition: Transition,
8415 TransitionGroup: TransitionGroup
8416 };
8417
8418 /* */
8419
8420 // install platform specific utils
8421 Vue.config.mustUseProp = mustUseProp;
8422 Vue.config.isReservedTag = isReservedTag;
8423 Vue.config.isReservedAttr = isReservedAttr;
8424 Vue.config.getTagNamespace = getTagNamespace;
8425 Vue.config.isUnknownElement = isUnknownElement;
8426
8427 // install platform runtime directives & components
8428 extend(Vue.options.directives, platformDirectives);
8429 extend(Vue.options.components, platformComponents);
8430
8431 // install platform patch function
8432 Vue.prototype.__patch__ = inBrowser ? patch : noop;
8433
8434 // public mount method
8435 Vue.prototype.$mount = function (
8436 el,
8437 hydrating
8438 ) {
8439 el = el && inBrowser ? query(el) : undefined;
8440 return mountComponent(this, el, hydrating)
8441 };
8442
8443 // devtools global hook
8444 /* istanbul ignore next */
8445 if (inBrowser) {
8446 setTimeout(function () {
8447 if (config.devtools) {
8448 if (devtools) {
8449 devtools.emit('init', Vue);
8450 } else {
8451 console[console.info ? 'info' : 'log'](
8452 'Download the Vue Devtools extension for a better development experience:\n' +
8453 'https://github.com/vuejs/vue-devtools'
8454 );
8455 }
8456 }
8457 if (config.productionTip !== false &&
8458 typeof console !== 'undefined'
8459 ) {
8460 console[console.info ? 'info' : 'log'](
8461 "You are running Vue in development mode.\n" +
8462 "Make sure to turn on production mode when deploying for production.\n" +
8463 "See more tips at https://vuejs.org/guide/deployment.html"
8464 );
8465 }
8466 }, 0);
8467 }
8468
8469 /* */
8470
8471 return Vue;
8472
8473}));