UNPKG

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