UNPKG

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