UNPKG

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