UNPKG

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