UNPKG

218 kBJavaScriptView Raw
1/*!
2 * Vue.js v2.6.2
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 (res && !res._isVue && 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(normalSlots, key, 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(normalSlots, key, fn) {
3898 var normalized = function (scope) {
3899 if ( scope === void 0 ) scope = {};
3900
3901 var res = fn(scope);
3902 return res && typeof res === 'object' && !Array.isArray(res)
3903 ? [res] // single vnode
3904 : normalizeChildren(res)
3905 };
3906 // proxy scoped slots on normal $slots
3907 if (!hasOwn(normalSlots, key)) {
3908 Object.defineProperty(normalSlots, key, {
3909 get: normalized
3910 });
3911 }
3912 return normalized
3913}
3914
3915function proxyNormalSlot(slots, key) {
3916 return function () { return slots[key]; }
3917}
3918
3919/* */
3920
3921/**
3922 * Runtime helper for rendering v-for lists.
3923 */
3924function renderList (
3925 val,
3926 render
3927) {
3928 var ret, i, l, keys, key;
3929 if (Array.isArray(val) || typeof val === 'string') {
3930 ret = new Array(val.length);
3931 for (i = 0, l = val.length; i < l; i++) {
3932 ret[i] = render(val[i], i);
3933 }
3934 } else if (typeof val === 'number') {
3935 ret = new Array(val);
3936 for (i = 0; i < val; i++) {
3937 ret[i] = render(i + 1, i);
3938 }
3939 } else if (isObject(val)) {
3940 if (hasSymbol && val[Symbol.iterator]) {
3941 ret = [];
3942 var iterator = val[Symbol.iterator]();
3943 var result = iterator.next();
3944 while (!result.done) {
3945 ret.push(render(result.value, ret.length));
3946 result = iterator.next();
3947 }
3948 } else {
3949 keys = Object.keys(val);
3950 ret = new Array(keys.length);
3951 for (i = 0, l = keys.length; i < l; i++) {
3952 key = keys[i];
3953 ret[i] = render(val[key], key, i);
3954 }
3955 }
3956 }
3957 if (!isDef(ret)) {
3958 ret = [];
3959 }
3960 (ret)._isVList = true;
3961 return ret
3962}
3963
3964/* */
3965
3966/**
3967 * Runtime helper for rendering <slot>
3968 */
3969function renderSlot (
3970 name,
3971 fallback,
3972 props,
3973 bindObject
3974) {
3975 var scopedSlotFn = this.$scopedSlots[name];
3976 var nodes;
3977 if (scopedSlotFn) { // scoped slot
3978 props = props || {};
3979 if (bindObject) {
3980 if (!isObject(bindObject)) {
3981 warn(
3982 'slot v-bind without argument expects an Object',
3983 this
3984 );
3985 }
3986 props = extend(extend({}, bindObject), props);
3987 }
3988 nodes = scopedSlotFn(props) || fallback;
3989 } else {
3990 nodes = this.$slots[name] || fallback;
3991 }
3992
3993 var target = props && props.slot;
3994 if (target) {
3995 return this.$createElement('template', { slot: target }, nodes)
3996 } else {
3997 return nodes
3998 }
3999}
4000
4001/* */
4002
4003/**
4004 * Runtime helper for resolving filters
4005 */
4006function resolveFilter (id) {
4007 return resolveAsset(this.$options, 'filters', id, true) || identity
4008}
4009
4010/* */
4011
4012function isKeyNotMatch (expect, actual) {
4013 if (Array.isArray(expect)) {
4014 return expect.indexOf(actual) === -1
4015 } else {
4016 return expect !== actual
4017 }
4018}
4019
4020/**
4021 * Runtime helper for checking keyCodes from config.
4022 * exposed as Vue.prototype._k
4023 * passing in eventKeyName as last argument separately for backwards compat
4024 */
4025function checkKeyCodes (
4026 eventKeyCode,
4027 key,
4028 builtInKeyCode,
4029 eventKeyName,
4030 builtInKeyName
4031) {
4032 var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
4033 if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
4034 return isKeyNotMatch(builtInKeyName, eventKeyName)
4035 } else if (mappedKeyCode) {
4036 return isKeyNotMatch(mappedKeyCode, eventKeyCode)
4037 } else if (eventKeyName) {
4038 return hyphenate(eventKeyName) !== key
4039 }
4040}
4041
4042/* */
4043
4044/**
4045 * Runtime helper for merging v-bind="object" into a VNode's data.
4046 */
4047function bindObjectProps (
4048 data,
4049 tag,
4050 value,
4051 asProp,
4052 isSync
4053) {
4054 if (value) {
4055 if (!isObject(value)) {
4056 warn(
4057 'v-bind without argument expects an Object or Array value',
4058 this
4059 );
4060 } else {
4061 if (Array.isArray(value)) {
4062 value = toObject(value);
4063 }
4064 var hash;
4065 var loop = function ( key ) {
4066 if (
4067 key === 'class' ||
4068 key === 'style' ||
4069 isReservedAttribute(key)
4070 ) {
4071 hash = data;
4072 } else {
4073 var type = data.attrs && data.attrs.type;
4074 hash = asProp || config.mustUseProp(tag, type, key)
4075 ? data.domProps || (data.domProps = {})
4076 : data.attrs || (data.attrs = {});
4077 }
4078 var camelizedKey = camelize(key);
4079 if (!(key in hash) && !(camelizedKey in hash)) {
4080 hash[key] = value[key];
4081
4082 if (isSync) {
4083 var on = data.on || (data.on = {});
4084 on[("update:" + camelizedKey)] = function ($event) {
4085 value[key] = $event;
4086 };
4087 }
4088 }
4089 };
4090
4091 for (var key in value) loop( key );
4092 }
4093 }
4094 return data
4095}
4096
4097/* */
4098
4099/**
4100 * Runtime helper for rendering static trees.
4101 */
4102function renderStatic (
4103 index,
4104 isInFor
4105) {
4106 var cached = this._staticTrees || (this._staticTrees = []);
4107 var tree = cached[index];
4108 // if has already-rendered static tree and not inside v-for,
4109 // we can reuse the same tree.
4110 if (tree && !isInFor) {
4111 return tree
4112 }
4113 // otherwise, render a fresh tree.
4114 tree = cached[index] = this.$options.staticRenderFns[index].call(
4115 this._renderProxy,
4116 null,
4117 this // for render fns generated for functional component templates
4118 );
4119 markStatic(tree, ("__static__" + index), false);
4120 return tree
4121}
4122
4123/**
4124 * Runtime helper for v-once.
4125 * Effectively it means marking the node as static with a unique key.
4126 */
4127function markOnce (
4128 tree,
4129 index,
4130 key
4131) {
4132 markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
4133 return tree
4134}
4135
4136function markStatic (
4137 tree,
4138 key,
4139 isOnce
4140) {
4141 if (Array.isArray(tree)) {
4142 for (var i = 0; i < tree.length; i++) {
4143 if (tree[i] && typeof tree[i] !== 'string') {
4144 markStaticNode(tree[i], (key + "_" + i), isOnce);
4145 }
4146 }
4147 } else {
4148 markStaticNode(tree, key, isOnce);
4149 }
4150}
4151
4152function markStaticNode (node, key, isOnce) {
4153 node.isStatic = true;
4154 node.key = key;
4155 node.isOnce = isOnce;
4156}
4157
4158/* */
4159
4160function bindObjectListeners (data, value) {
4161 if (value) {
4162 if (!isPlainObject(value)) {
4163 warn(
4164 'v-on without argument expects an Object value',
4165 this
4166 );
4167 } else {
4168 var on = data.on = data.on ? extend({}, data.on) : {};
4169 for (var key in value) {
4170 var existing = on[key];
4171 var ours = value[key];
4172 on[key] = existing ? [].concat(existing, ours) : ours;
4173 }
4174 }
4175 }
4176 return data
4177}
4178
4179/* */
4180
4181function bindDynamicKeys (baseObj, values) {
4182 for (var i = 0; i < values.length; i += 2) {
4183 var key = values[i];
4184 if (typeof key === 'string' && key) {
4185 baseObj[values[i]] = values[i + 1];
4186 } else if (key !== '' && key !== null) {
4187 // null is a speical value for explicitly removing a binding
4188 warn(
4189 ("Invalid value for dynamic directive argument (expected string or null): " + key),
4190 this
4191 );
4192 }
4193 }
4194 return baseObj
4195}
4196
4197// helper to dynamically append modifier runtime markers to event names.
4198// ensure only append when value is already string, otherwise it will be cast
4199// to string and cause the type check to miss.
4200function prependModifier (value, symbol) {
4201 return typeof value === 'string' ? symbol + value : value
4202}
4203
4204/* */
4205
4206function installRenderHelpers (target) {
4207 target._o = markOnce;
4208 target._n = toNumber;
4209 target._s = toString;
4210 target._l = renderList;
4211 target._t = renderSlot;
4212 target._q = looseEqual;
4213 target._i = looseIndexOf;
4214 target._m = renderStatic;
4215 target._f = resolveFilter;
4216 target._k = checkKeyCodes;
4217 target._b = bindObjectProps;
4218 target._v = createTextVNode;
4219 target._e = createEmptyVNode;
4220 target._u = resolveScopedSlots;
4221 target._g = bindObjectListeners;
4222 target._d = bindDynamicKeys;
4223 target._p = prependModifier;
4224}
4225
4226/* */
4227
4228function FunctionalRenderContext (
4229 data,
4230 props,
4231 children,
4232 parent,
4233 Ctor
4234) {
4235 var options = Ctor.options;
4236 // ensure the createElement function in functional components
4237 // gets a unique context - this is necessary for correct named slot check
4238 var contextVm;
4239 if (hasOwn(parent, '_uid')) {
4240 contextVm = Object.create(parent);
4241 // $flow-disable-line
4242 contextVm._original = parent;
4243 } else {
4244 // the context vm passed in is a functional context as well.
4245 // in this case we want to make sure we are able to get a hold to the
4246 // real context instance.
4247 contextVm = parent;
4248 // $flow-disable-line
4249 parent = parent._original;
4250 }
4251 var isCompiled = isTrue(options._compiled);
4252 var needNormalization = !isCompiled;
4253
4254 this.data = data;
4255 this.props = props;
4256 this.children = children;
4257 this.parent = parent;
4258 this.listeners = data.on || emptyObject;
4259 this.injections = resolveInject(options.inject, parent);
4260 this.slots = function () { return resolveSlots(children, parent); };
4261
4262 Object.defineProperty(this, 'scopedSlots', ({
4263 enumerable: true,
4264 get: function get () {
4265 return normalizeScopedSlots(data.scopedSlots, this.slots())
4266 }
4267 }));
4268
4269 // support for compiled functional template
4270 if (isCompiled) {
4271 // exposing $options for renderStatic()
4272 this.$options = options;
4273 // pre-resolve slots for renderSlot()
4274 this.$slots = this.slots();
4275 this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
4276 }
4277
4278 if (options._scopeId) {
4279 this._c = function (a, b, c, d) {
4280 var vnode = createElement(contextVm, a, b, c, d, needNormalization);
4281 if (vnode && !Array.isArray(vnode)) {
4282 vnode.fnScopeId = options._scopeId;
4283 vnode.fnContext = parent;
4284 }
4285 return vnode
4286 };
4287 } else {
4288 this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
4289 }
4290}
4291
4292installRenderHelpers(FunctionalRenderContext.prototype);
4293
4294function createFunctionalComponent (
4295 Ctor,
4296 propsData,
4297 data,
4298 contextVm,
4299 children
4300) {
4301 var options = Ctor.options;
4302 var props = {};
4303 var propOptions = options.props;
4304 if (isDef(propOptions)) {
4305 for (var key in propOptions) {
4306 props[key] = validateProp(key, propOptions, propsData || emptyObject);
4307 }
4308 } else {
4309 if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
4310 if (isDef(data.props)) { mergeProps(props, data.props); }
4311 }
4312
4313 var renderContext = new FunctionalRenderContext(
4314 data,
4315 props,
4316 children,
4317 contextVm,
4318 Ctor
4319 );
4320
4321 var vnode = options.render.call(null, renderContext._c, renderContext);
4322
4323 if (vnode instanceof VNode) {
4324 return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
4325 } else if (Array.isArray(vnode)) {
4326 var vnodes = normalizeChildren(vnode) || [];
4327 var res = new Array(vnodes.length);
4328 for (var i = 0; i < vnodes.length; i++) {
4329 res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
4330 }
4331 return res
4332 }
4333}
4334
4335function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
4336 // #7817 clone node before setting fnContext, otherwise if the node is reused
4337 // (e.g. it was from a cached normal slot) the fnContext causes named slots
4338 // that should not be matched to match.
4339 var clone = cloneVNode(vnode);
4340 clone.fnContext = contextVm;
4341 clone.fnOptions = options;
4342 {
4343 (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
4344 }
4345 if (data.slot) {
4346 (clone.data || (clone.data = {})).slot = data.slot;
4347 }
4348 return clone
4349}
4350
4351function mergeProps (to, from) {
4352 for (var key in from) {
4353 to[camelize(key)] = from[key];
4354 }
4355}
4356
4357/* */
4358
4359/* */
4360
4361/* */
4362
4363/* */
4364
4365// inline hooks to be invoked on component VNodes during patch
4366var componentVNodeHooks = {
4367 init: function init (vnode, hydrating) {
4368 if (
4369 vnode.componentInstance &&
4370 !vnode.componentInstance._isDestroyed &&
4371 vnode.data.keepAlive
4372 ) {
4373 // kept-alive components, treat as a patch
4374 var mountedNode = vnode; // work around flow
4375 componentVNodeHooks.prepatch(mountedNode, mountedNode);
4376 } else {
4377 var child = vnode.componentInstance = createComponentInstanceForVnode(
4378 vnode,
4379 activeInstance
4380 );
4381 child.$mount(hydrating ? vnode.elm : undefined, hydrating);
4382 }
4383 },
4384
4385 prepatch: function prepatch (oldVnode, vnode) {
4386 var options = vnode.componentOptions;
4387 var child = vnode.componentInstance = oldVnode.componentInstance;
4388 updateChildComponent(
4389 child,
4390 options.propsData, // updated props
4391 options.listeners, // updated listeners
4392 vnode, // new parent vnode
4393 options.children // new children
4394 );
4395 },
4396
4397 insert: function insert (vnode) {
4398 var context = vnode.context;
4399 var componentInstance = vnode.componentInstance;
4400 if (!componentInstance._isMounted) {
4401 componentInstance._isMounted = true;
4402 callHook(componentInstance, 'mounted');
4403 }
4404 if (vnode.data.keepAlive) {
4405 if (context._isMounted) {
4406 // vue-router#1212
4407 // During updates, a kept-alive component's child components may
4408 // change, so directly walking the tree here may call activated hooks
4409 // on incorrect children. Instead we push them into a queue which will
4410 // be processed after the whole patch process ended.
4411 queueActivatedComponent(componentInstance);
4412 } else {
4413 activateChildComponent(componentInstance, true /* direct */);
4414 }
4415 }
4416 },
4417
4418 destroy: function destroy (vnode) {
4419 var componentInstance = vnode.componentInstance;
4420 if (!componentInstance._isDestroyed) {
4421 if (!vnode.data.keepAlive) {
4422 componentInstance.$destroy();
4423 } else {
4424 deactivateChildComponent(componentInstance, true /* direct */);
4425 }
4426 }
4427 }
4428};
4429
4430var hooksToMerge = Object.keys(componentVNodeHooks);
4431
4432function createComponent (
4433 Ctor,
4434 data,
4435 context,
4436 children,
4437 tag
4438) {
4439 if (isUndef(Ctor)) {
4440 return
4441 }
4442
4443 var baseCtor = context.$options._base;
4444
4445 // plain options object: turn it into a constructor
4446 if (isObject(Ctor)) {
4447 Ctor = baseCtor.extend(Ctor);
4448 }
4449
4450 // if at this stage it's not a constructor or an async component factory,
4451 // reject.
4452 if (typeof Ctor !== 'function') {
4453 {
4454 warn(("Invalid Component definition: " + (String(Ctor))), context);
4455 }
4456 return
4457 }
4458
4459 // async component
4460 var asyncFactory;
4461 if (isUndef(Ctor.cid)) {
4462 asyncFactory = Ctor;
4463 Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
4464 if (Ctor === undefined) {
4465 // return a placeholder node for async component, which is rendered
4466 // as a comment node but preserves all the raw information for the node.
4467 // the information will be used for async server-rendering and hydration.
4468 return createAsyncPlaceholder(
4469 asyncFactory,
4470 data,
4471 context,
4472 children,
4473 tag
4474 )
4475 }
4476 }
4477
4478 data = data || {};
4479
4480 // resolve constructor options in case global mixins are applied after
4481 // component constructor creation
4482 resolveConstructorOptions(Ctor);
4483
4484 // transform component v-model data into props & events
4485 if (isDef(data.model)) {
4486 transformModel(Ctor.options, data);
4487 }
4488
4489 // extract props
4490 var propsData = extractPropsFromVNodeData(data, Ctor, tag);
4491
4492 // functional component
4493 if (isTrue(Ctor.options.functional)) {
4494 return createFunctionalComponent(Ctor, propsData, data, context, children)
4495 }
4496
4497 // extract listeners, since these needs to be treated as
4498 // child component listeners instead of DOM listeners
4499 var listeners = data.on;
4500 // replace with listeners with .native modifier
4501 // so it gets processed during parent component patch.
4502 data.on = data.nativeOn;
4503
4504 if (isTrue(Ctor.options.abstract)) {
4505 // abstract components do not keep anything
4506 // other than props & listeners & slot
4507
4508 // work around flow
4509 var slot = data.slot;
4510 data = {};
4511 if (slot) {
4512 data.slot = slot;
4513 }
4514 }
4515
4516 // install component management hooks onto the placeholder node
4517 installComponentHooks(data);
4518
4519 // return a placeholder vnode
4520 var name = Ctor.options.name || tag;
4521 var vnode = new VNode(
4522 ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
4523 data, undefined, undefined, undefined, context,
4524 { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
4525 asyncFactory
4526 );
4527
4528 return vnode
4529}
4530
4531function createComponentInstanceForVnode (
4532 vnode, // we know it's MountedComponentVNode but flow doesn't
4533 parent // activeInstance in lifecycle state
4534) {
4535 var options = {
4536 _isComponent: true,
4537 _parentVnode: vnode,
4538 parent: parent
4539 };
4540 // check inline-template render functions
4541 var inlineTemplate = vnode.data.inlineTemplate;
4542 if (isDef(inlineTemplate)) {
4543 options.render = inlineTemplate.render;
4544 options.staticRenderFns = inlineTemplate.staticRenderFns;
4545 }
4546 return new vnode.componentOptions.Ctor(options)
4547}
4548
4549function installComponentHooks (data) {
4550 var hooks = data.hook || (data.hook = {});
4551 for (var i = 0; i < hooksToMerge.length; i++) {
4552 var key = hooksToMerge[i];
4553 var existing = hooks[key];
4554 var toMerge = componentVNodeHooks[key];
4555 if (existing !== toMerge && !(existing && existing._merged)) {
4556 hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
4557 }
4558 }
4559}
4560
4561function mergeHook$1 (f1, f2) {
4562 var merged = function (a, b) {
4563 // flow complains about extra args which is why we use any
4564 f1(a, b);
4565 f2(a, b);
4566 };
4567 merged._merged = true;
4568 return merged
4569}
4570
4571// transform component v-model info (value and callback) into
4572// prop and event handler respectively.
4573function transformModel (options, data) {
4574 var prop = (options.model && options.model.prop) || 'value';
4575 var event = (options.model && options.model.event) || 'input'
4576 ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
4577 var on = data.on || (data.on = {});
4578 var existing = on[event];
4579 var callback = data.model.callback;
4580 if (isDef(existing)) {
4581 if (
4582 Array.isArray(existing)
4583 ? existing.indexOf(callback) === -1
4584 : existing !== callback
4585 ) {
4586 on[event] = [callback].concat(existing);
4587 }
4588 } else {
4589 on[event] = callback;
4590 }
4591}
4592
4593/* */
4594
4595var SIMPLE_NORMALIZE = 1;
4596var ALWAYS_NORMALIZE = 2;
4597
4598// wrapper function for providing a more flexible interface
4599// without getting yelled at by flow
4600function createElement (
4601 context,
4602 tag,
4603 data,
4604 children,
4605 normalizationType,
4606 alwaysNormalize
4607) {
4608 if (Array.isArray(data) || isPrimitive(data)) {
4609 normalizationType = children;
4610 children = data;
4611 data = undefined;
4612 }
4613 if (isTrue(alwaysNormalize)) {
4614 normalizationType = ALWAYS_NORMALIZE;
4615 }
4616 return _createElement(context, tag, data, children, normalizationType)
4617}
4618
4619function _createElement (
4620 context,
4621 tag,
4622 data,
4623 children,
4624 normalizationType
4625) {
4626 if (isDef(data) && isDef((data).__ob__)) {
4627 warn(
4628 "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
4629 'Always create fresh vnode data objects in each render!',
4630 context
4631 );
4632 return createEmptyVNode()
4633 }
4634 // object syntax in v-bind
4635 if (isDef(data) && isDef(data.is)) {
4636 tag = data.is;
4637 }
4638 if (!tag) {
4639 // in case of component :is set to falsy value
4640 return createEmptyVNode()
4641 }
4642 // warn against non-primitive key
4643 if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
4644 ) {
4645 {
4646 warn(
4647 'Avoid using non-primitive value as key, ' +
4648 'use string/number value instead.',
4649 context
4650 );
4651 }
4652 }
4653 // support single function children as default scoped slot
4654 if (Array.isArray(children) &&
4655 typeof children[0] === 'function'
4656 ) {
4657 data = data || {};
4658 data.scopedSlots = { default: children[0] };
4659 children.length = 0;
4660 }
4661 if (normalizationType === ALWAYS_NORMALIZE) {
4662 children = normalizeChildren(children);
4663 } else if (normalizationType === SIMPLE_NORMALIZE) {
4664 children = simpleNormalizeChildren(children);
4665 }
4666 var vnode, ns;
4667 if (typeof tag === 'string') {
4668 var Ctor;
4669 ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
4670 if (config.isReservedTag(tag)) {
4671 // platform built-in elements
4672 vnode = new VNode(
4673 config.parsePlatformTagName(tag), data, children,
4674 undefined, undefined, context
4675 );
4676 } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
4677 // component
4678 vnode = createComponent(Ctor, data, context, children, tag);
4679 } else {
4680 // unknown or unlisted namespaced elements
4681 // check at runtime because it may get assigned a namespace when its
4682 // parent normalizes children
4683 vnode = new VNode(
4684 tag, data, children,
4685 undefined, undefined, context
4686 );
4687 }
4688 } else {
4689 // direct component options / constructor
4690 vnode = createComponent(tag, data, context, children);
4691 }
4692 if (Array.isArray(vnode)) {
4693 return vnode
4694 } else if (isDef(vnode)) {
4695 if (isDef(ns)) { applyNS(vnode, ns); }
4696 if (isDef(data)) { registerDeepBindings(data); }
4697 return vnode
4698 } else {
4699 return createEmptyVNode()
4700 }
4701}
4702
4703function applyNS (vnode, ns, force) {
4704 vnode.ns = ns;
4705 if (vnode.tag === 'foreignObject') {
4706 // use default namespace inside foreignObject
4707 ns = undefined;
4708 force = true;
4709 }
4710 if (isDef(vnode.children)) {
4711 for (var i = 0, l = vnode.children.length; i < l; i++) {
4712 var child = vnode.children[i];
4713 if (isDef(child.tag) && (
4714 isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
4715 applyNS(child, ns, force);
4716 }
4717 }
4718 }
4719}
4720
4721// ref #5318
4722// necessary to ensure parent re-render when deep bindings like :style and
4723// :class are used on slot nodes
4724function registerDeepBindings (data) {
4725 if (isObject(data.style)) {
4726 traverse(data.style);
4727 }
4728 if (isObject(data.class)) {
4729 traverse(data.class);
4730 }
4731}
4732
4733/* */
4734
4735function initRender (vm) {
4736 vm._vnode = null; // the root of the child tree
4737 vm._staticTrees = null; // v-once cached trees
4738 var options = vm.$options;
4739 var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
4740 var renderContext = parentVnode && parentVnode.context;
4741 vm.$slots = resolveSlots(options._renderChildren, renderContext);
4742 vm.$scopedSlots = emptyObject;
4743 // bind the createElement fn to this instance
4744 // so that we get proper render context inside it.
4745 // args order: tag, data, children, normalizationType, alwaysNormalize
4746 // internal version is used by render functions compiled from templates
4747 vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
4748 // normalization is always applied for the public version, used in
4749 // user-written render functions.
4750 vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
4751
4752 // $attrs & $listeners are exposed for easier HOC creation.
4753 // they need to be reactive so that HOCs using them are always updated
4754 var parentData = parentVnode && parentVnode.data;
4755
4756 /* istanbul ignore else */
4757 {
4758 defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
4759 !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
4760 }, true);
4761 defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
4762 !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
4763 }, true);
4764 }
4765}
4766
4767function renderMixin (Vue) {
4768 // install runtime convenience helpers
4769 installRenderHelpers(Vue.prototype);
4770
4771 Vue.prototype.$nextTick = function (fn) {
4772 return nextTick(fn, this)
4773 };
4774
4775 Vue.prototype._render = function () {
4776 var vm = this;
4777 var ref = vm.$options;
4778 var render = ref.render;
4779 var _parentVnode = ref._parentVnode;
4780
4781 if (_parentVnode) {
4782 vm.$scopedSlots = normalizeScopedSlots(
4783 _parentVnode.data.scopedSlots,
4784 vm.$slots
4785 );
4786 }
4787
4788 // set parent vnode. this allows render functions to have access
4789 // to the data on the placeholder node.
4790 vm.$vnode = _parentVnode;
4791 // render self
4792 var vnode;
4793 try {
4794 vnode = render.call(vm._renderProxy, vm.$createElement);
4795 } catch (e) {
4796 handleError(e, vm, "render");
4797 // return error render result,
4798 // or previous vnode to prevent render error causing blank component
4799 /* istanbul ignore else */
4800 if (vm.$options.renderError) {
4801 try {
4802 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
4803 } catch (e) {
4804 handleError(e, vm, "renderError");
4805 vnode = vm._vnode;
4806 }
4807 } else {
4808 vnode = vm._vnode;
4809 }
4810 }
4811 // if the returned array contains only a single node, allow it
4812 if (Array.isArray(vnode) && vnode.length === 1) {
4813 vnode = vnode[0];
4814 }
4815 // return empty vnode in case the render function errored out
4816 if (!(vnode instanceof VNode)) {
4817 if (Array.isArray(vnode)) {
4818 warn(
4819 'Multiple root nodes returned from render function. Render function ' +
4820 'should return a single root node.',
4821 vm
4822 );
4823 }
4824 vnode = createEmptyVNode();
4825 }
4826 // set parent
4827 vnode.parent = _parentVnode;
4828 return vnode
4829 };
4830}
4831
4832/* */
4833
4834var uid$3 = 0;
4835
4836function initMixin (Vue) {
4837 Vue.prototype._init = function (options) {
4838 var vm = this;
4839 // a uid
4840 vm._uid = uid$3++;
4841
4842 var startTag, endTag;
4843 /* istanbul ignore if */
4844 if (config.performance && mark) {
4845 startTag = "vue-perf-start:" + (vm._uid);
4846 endTag = "vue-perf-end:" + (vm._uid);
4847 mark(startTag);
4848 }
4849
4850 // a flag to avoid this being observed
4851 vm._isVue = true;
4852 // merge options
4853 if (options && options._isComponent) {
4854 // optimize internal component instantiation
4855 // since dynamic options merging is pretty slow, and none of the
4856 // internal component options needs special treatment.
4857 initInternalComponent(vm, options);
4858 } else {
4859 vm.$options = mergeOptions(
4860 resolveConstructorOptions(vm.constructor),
4861 options || {},
4862 vm
4863 );
4864 }
4865 /* istanbul ignore else */
4866 {
4867 initProxy(vm);
4868 }
4869 // expose real self
4870 vm._self = vm;
4871 initLifecycle(vm);
4872 initEvents(vm);
4873 initRender(vm);
4874 callHook(vm, 'beforeCreate');
4875 initInjections(vm); // resolve injections before data/props
4876 initState(vm);
4877 initProvide(vm); // resolve provide after data/props
4878 callHook(vm, 'created');
4879
4880 /* istanbul ignore if */
4881 if (config.performance && mark) {
4882 vm._name = formatComponentName(vm, false);
4883 mark(endTag);
4884 measure(("vue " + (vm._name) + " init"), startTag, endTag);
4885 }
4886
4887 if (vm.$options.el) {
4888 vm.$mount(vm.$options.el);
4889 }
4890 };
4891}
4892
4893function initInternalComponent (vm, options) {
4894 var opts = vm.$options = Object.create(vm.constructor.options);
4895 // doing this because it's faster than dynamic enumeration.
4896 var parentVnode = options._parentVnode;
4897 opts.parent = options.parent;
4898 opts._parentVnode = parentVnode;
4899
4900 var vnodeComponentOptions = parentVnode.componentOptions;
4901 opts.propsData = vnodeComponentOptions.propsData;
4902 opts._parentListeners = vnodeComponentOptions.listeners;
4903 opts._renderChildren = vnodeComponentOptions.children;
4904 opts._componentTag = vnodeComponentOptions.tag;
4905
4906 if (options.render) {
4907 opts.render = options.render;
4908 opts.staticRenderFns = options.staticRenderFns;
4909 }
4910}
4911
4912function resolveConstructorOptions (Ctor) {
4913 var options = Ctor.options;
4914 if (Ctor.super) {
4915 var superOptions = resolveConstructorOptions(Ctor.super);
4916 var cachedSuperOptions = Ctor.superOptions;
4917 if (superOptions !== cachedSuperOptions) {
4918 // super option changed,
4919 // need to resolve new options.
4920 Ctor.superOptions = superOptions;
4921 // check if there are any late-modified/attached options (#4976)
4922 var modifiedOptions = resolveModifiedOptions(Ctor);
4923 // update base extend options
4924 if (modifiedOptions) {
4925 extend(Ctor.extendOptions, modifiedOptions);
4926 }
4927 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
4928 if (options.name) {
4929 options.components[options.name] = Ctor;
4930 }
4931 }
4932 }
4933 return options
4934}
4935
4936function resolveModifiedOptions (Ctor) {
4937 var modified;
4938 var latest = Ctor.options;
4939 var sealed = Ctor.sealedOptions;
4940 for (var key in latest) {
4941 if (latest[key] !== sealed[key]) {
4942 if (!modified) { modified = {}; }
4943 modified[key] = latest[key];
4944 }
4945 }
4946 return modified
4947}
4948
4949function Vue (options) {
4950 if (!(this instanceof Vue)
4951 ) {
4952 warn('Vue is a constructor and should be called with the `new` keyword');
4953 }
4954 this._init(options);
4955}
4956
4957initMixin(Vue);
4958stateMixin(Vue);
4959eventsMixin(Vue);
4960lifecycleMixin(Vue);
4961renderMixin(Vue);
4962
4963/* */
4964
4965function initUse (Vue) {
4966 Vue.use = function (plugin) {
4967 var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
4968 if (installedPlugins.indexOf(plugin) > -1) {
4969 return this
4970 }
4971
4972 // additional parameters
4973 var args = toArray(arguments, 1);
4974 args.unshift(this);
4975 if (typeof plugin.install === 'function') {
4976 plugin.install.apply(plugin, args);
4977 } else if (typeof plugin === 'function') {
4978 plugin.apply(null, args);
4979 }
4980 installedPlugins.push(plugin);
4981 return this
4982 };
4983}
4984
4985/* */
4986
4987function initMixin$1 (Vue) {
4988 Vue.mixin = function (mixin) {
4989 this.options = mergeOptions(this.options, mixin);
4990 return this
4991 };
4992}
4993
4994/* */
4995
4996function initExtend (Vue) {
4997 /**
4998 * Each instance constructor, including Vue, has a unique
4999 * cid. This enables us to create wrapped "child
5000 * constructors" for prototypal inheritance and cache them.
5001 */
5002 Vue.cid = 0;
5003 var cid = 1;
5004
5005 /**
5006 * Class inheritance
5007 */
5008 Vue.extend = function (extendOptions) {
5009 extendOptions = extendOptions || {};
5010 var Super = this;
5011 var SuperId = Super.cid;
5012 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
5013 if (cachedCtors[SuperId]) {
5014 return cachedCtors[SuperId]
5015 }
5016
5017 var name = extendOptions.name || Super.options.name;
5018 if (name) {
5019 validateComponentName(name);
5020 }
5021
5022 var Sub = function VueComponent (options) {
5023 this._init(options);
5024 };
5025 Sub.prototype = Object.create(Super.prototype);
5026 Sub.prototype.constructor = Sub;
5027 Sub.cid = cid++;
5028 Sub.options = mergeOptions(
5029 Super.options,
5030 extendOptions
5031 );
5032 Sub['super'] = Super;
5033
5034 // For props and computed properties, we define the proxy getters on
5035 // the Vue instances at extension time, on the extended prototype. This
5036 // avoids Object.defineProperty calls for each instance created.
5037 if (Sub.options.props) {
5038 initProps$1(Sub);
5039 }
5040 if (Sub.options.computed) {
5041 initComputed$1(Sub);
5042 }
5043
5044 // allow further extension/mixin/plugin usage
5045 Sub.extend = Super.extend;
5046 Sub.mixin = Super.mixin;
5047 Sub.use = Super.use;
5048
5049 // create asset registers, so extended classes
5050 // can have their private assets too.
5051 ASSET_TYPES.forEach(function (type) {
5052 Sub[type] = Super[type];
5053 });
5054 // enable recursive self-lookup
5055 if (name) {
5056 Sub.options.components[name] = Sub;
5057 }
5058
5059 // keep a reference to the super options at extension time.
5060 // later at instantiation we can check if Super's options have
5061 // been updated.
5062 Sub.superOptions = Super.options;
5063 Sub.extendOptions = extendOptions;
5064 Sub.sealedOptions = extend({}, Sub.options);
5065
5066 // cache constructor
5067 cachedCtors[SuperId] = Sub;
5068 return Sub
5069 };
5070}
5071
5072function initProps$1 (Comp) {
5073 var props = Comp.options.props;
5074 for (var key in props) {
5075 proxy(Comp.prototype, "_props", key);
5076 }
5077}
5078
5079function initComputed$1 (Comp) {
5080 var computed = Comp.options.computed;
5081 for (var key in computed) {
5082 defineComputed(Comp.prototype, key, computed[key]);
5083 }
5084}
5085
5086/* */
5087
5088function initAssetRegisters (Vue) {
5089 /**
5090 * Create asset registration methods.
5091 */
5092 ASSET_TYPES.forEach(function (type) {
5093 Vue[type] = function (
5094 id,
5095 definition
5096 ) {
5097 if (!definition) {
5098 return this.options[type + 's'][id]
5099 } else {
5100 /* istanbul ignore if */
5101 if (type === 'component') {
5102 validateComponentName(id);
5103 }
5104 if (type === 'component' && isPlainObject(definition)) {
5105 definition.name = definition.name || id;
5106 definition = this.options._base.extend(definition);
5107 }
5108 if (type === 'directive' && typeof definition === 'function') {
5109 definition = { bind: definition, update: definition };
5110 }
5111 this.options[type + 's'][id] = definition;
5112 return definition
5113 }
5114 };
5115 });
5116}
5117
5118/* */
5119
5120
5121
5122function getComponentName (opts) {
5123 return opts && (opts.Ctor.options.name || opts.tag)
5124}
5125
5126function matches (pattern, name) {
5127 if (Array.isArray(pattern)) {
5128 return pattern.indexOf(name) > -1
5129 } else if (typeof pattern === 'string') {
5130 return pattern.split(',').indexOf(name) > -1
5131 } else if (isRegExp(pattern)) {
5132 return pattern.test(name)
5133 }
5134 /* istanbul ignore next */
5135 return false
5136}
5137
5138function pruneCache (keepAliveInstance, filter) {
5139 var cache = keepAliveInstance.cache;
5140 var keys = keepAliveInstance.keys;
5141 var _vnode = keepAliveInstance._vnode;
5142 for (var key in cache) {
5143 var cachedNode = cache[key];
5144 if (cachedNode) {
5145 var name = getComponentName(cachedNode.componentOptions);
5146 if (name && !filter(name)) {
5147 pruneCacheEntry(cache, key, keys, _vnode);
5148 }
5149 }
5150 }
5151}
5152
5153function pruneCacheEntry (
5154 cache,
5155 key,
5156 keys,
5157 current
5158) {
5159 var cached$$1 = cache[key];
5160 if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
5161 cached$$1.componentInstance.$destroy();
5162 }
5163 cache[key] = null;
5164 remove(keys, key);
5165}
5166
5167var patternTypes = [String, RegExp, Array];
5168
5169var KeepAlive = {
5170 name: 'keep-alive',
5171 abstract: true,
5172
5173 props: {
5174 include: patternTypes,
5175 exclude: patternTypes,
5176 max: [String, Number]
5177 },
5178
5179 created: function created () {
5180 this.cache = Object.create(null);
5181 this.keys = [];
5182 },
5183
5184 destroyed: function destroyed () {
5185 for (var key in this.cache) {
5186 pruneCacheEntry(this.cache, key, this.keys);
5187 }
5188 },
5189
5190 mounted: function mounted () {
5191 var this$1 = this;
5192
5193 this.$watch('include', function (val) {
5194 pruneCache(this$1, function (name) { return matches(val, name); });
5195 });
5196 this.$watch('exclude', function (val) {
5197 pruneCache(this$1, function (name) { return !matches(val, name); });
5198 });
5199 },
5200
5201 render: function render () {
5202 var slot = this.$slots.default;
5203 var vnode = getFirstComponentChild(slot);
5204 var componentOptions = vnode && vnode.componentOptions;
5205 if (componentOptions) {
5206 // check pattern
5207 var name = getComponentName(componentOptions);
5208 var ref = this;
5209 var include = ref.include;
5210 var exclude = ref.exclude;
5211 if (
5212 // not included
5213 (include && (!name || !matches(include, name))) ||
5214 // excluded
5215 (exclude && name && matches(exclude, name))
5216 ) {
5217 return vnode
5218 }
5219
5220 var ref$1 = this;
5221 var cache = ref$1.cache;
5222 var keys = ref$1.keys;
5223 var key = vnode.key == null
5224 // same constructor may get registered as different local components
5225 // so cid alone is not enough (#3269)
5226 ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
5227 : vnode.key;
5228 if (cache[key]) {
5229 vnode.componentInstance = cache[key].componentInstance;
5230 // make current key freshest
5231 remove(keys, key);
5232 keys.push(key);
5233 } else {
5234 cache[key] = vnode;
5235 keys.push(key);
5236 // prune oldest entry
5237 if (this.max && keys.length > parseInt(this.max)) {
5238 pruneCacheEntry(cache, keys[0], keys, this._vnode);
5239 }
5240 }
5241
5242 vnode.data.keepAlive = true;
5243 }
5244 return vnode || (slot && slot[0])
5245 }
5246};
5247
5248var builtInComponents = {
5249 KeepAlive: KeepAlive
5250};
5251
5252/* */
5253
5254function initGlobalAPI (Vue) {
5255 // config
5256 var configDef = {};
5257 configDef.get = function () { return config; };
5258 {
5259 configDef.set = function () {
5260 warn(
5261 'Do not replace the Vue.config object, set individual fields instead.'
5262 );
5263 };
5264 }
5265 Object.defineProperty(Vue, 'config', configDef);
5266
5267 // exposed util methods.
5268 // NOTE: these are not considered part of the public API - avoid relying on
5269 // them unless you are aware of the risk.
5270 Vue.util = {
5271 warn: warn,
5272 extend: extend,
5273 mergeOptions: mergeOptions,
5274 defineReactive: defineReactive$$1
5275 };
5276
5277 Vue.set = set;
5278 Vue.delete = del;
5279 Vue.nextTick = nextTick;
5280
5281 // 2.6 explicit observable API
5282 Vue.observable = function (obj) {
5283 observe(obj);
5284 return obj
5285 };
5286
5287 Vue.options = Object.create(null);
5288 ASSET_TYPES.forEach(function (type) {
5289 Vue.options[type + 's'] = Object.create(null);
5290 });
5291
5292 // this is used to identify the "base" constructor to extend all plain-object
5293 // components with in Weex's multi-instance scenarios.
5294 Vue.options._base = Vue;
5295
5296 extend(Vue.options.components, builtInComponents);
5297
5298 initUse(Vue);
5299 initMixin$1(Vue);
5300 initExtend(Vue);
5301 initAssetRegisters(Vue);
5302}
5303
5304initGlobalAPI(Vue);
5305
5306Object.defineProperty(Vue.prototype, '$isServer', {
5307 get: isServerRendering
5308});
5309
5310Object.defineProperty(Vue.prototype, '$ssrContext', {
5311 get: function get () {
5312 /* istanbul ignore next */
5313 return this.$vnode && this.$vnode.ssrContext
5314 }
5315});
5316
5317// expose FunctionalRenderContext for ssr runtime helper installation
5318Object.defineProperty(Vue, 'FunctionalRenderContext', {
5319 value: FunctionalRenderContext
5320});
5321
5322Vue.version = '2.6.2';
5323
5324/* */
5325
5326// these are reserved for web because they are directly compiled away
5327// during template compilation
5328var isReservedAttr = makeMap('style,class');
5329
5330// attributes that should be using props for binding
5331var acceptValue = makeMap('input,textarea,option,select,progress');
5332var mustUseProp = function (tag, type, attr) {
5333 return (
5334 (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
5335 (attr === 'selected' && tag === 'option') ||
5336 (attr === 'checked' && tag === 'input') ||
5337 (attr === 'muted' && tag === 'video')
5338 )
5339};
5340
5341var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
5342
5343var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
5344
5345var convertEnumeratedValue = function (key, value) {
5346 return isFalsyAttrValue(value) || value === 'false'
5347 ? 'false'
5348 // allow arbitrary string value for contenteditable
5349 : key === 'contenteditable' && isValidContentEditableValue(value)
5350 ? value
5351 : 'true'
5352};
5353
5354var isBooleanAttr = makeMap(
5355 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
5356 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
5357 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
5358 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
5359 'required,reversed,scoped,seamless,selected,sortable,translate,' +
5360 'truespeed,typemustmatch,visible'
5361);
5362
5363var xlinkNS = 'http://www.w3.org/1999/xlink';
5364
5365var isXlink = function (name) {
5366 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
5367};
5368
5369var getXlinkProp = function (name) {
5370 return isXlink(name) ? name.slice(6, name.length) : ''
5371};
5372
5373var isFalsyAttrValue = function (val) {
5374 return val == null || val === false
5375};
5376
5377/* */
5378
5379function genClassForVnode (vnode) {
5380 var data = vnode.data;
5381 var parentNode = vnode;
5382 var childNode = vnode;
5383 while (isDef(childNode.componentInstance)) {
5384 childNode = childNode.componentInstance._vnode;
5385 if (childNode && childNode.data) {
5386 data = mergeClassData(childNode.data, data);
5387 }
5388 }
5389 while (isDef(parentNode = parentNode.parent)) {
5390 if (parentNode && parentNode.data) {
5391 data = mergeClassData(data, parentNode.data);
5392 }
5393 }
5394 return renderClass(data.staticClass, data.class)
5395}
5396
5397function mergeClassData (child, parent) {
5398 return {
5399 staticClass: concat(child.staticClass, parent.staticClass),
5400 class: isDef(child.class)
5401 ? [child.class, parent.class]
5402 : parent.class
5403 }
5404}
5405
5406function renderClass (
5407 staticClass,
5408 dynamicClass
5409) {
5410 if (isDef(staticClass) || isDef(dynamicClass)) {
5411 return concat(staticClass, stringifyClass(dynamicClass))
5412 }
5413 /* istanbul ignore next */
5414 return ''
5415}
5416
5417function concat (a, b) {
5418 return a ? b ? (a + ' ' + b) : a : (b || '')
5419}
5420
5421function stringifyClass (value) {
5422 if (Array.isArray(value)) {
5423 return stringifyArray(value)
5424 }
5425 if (isObject(value)) {
5426 return stringifyObject(value)
5427 }
5428 if (typeof value === 'string') {
5429 return value
5430 }
5431 /* istanbul ignore next */
5432 return ''
5433}
5434
5435function stringifyArray (value) {
5436 var res = '';
5437 var stringified;
5438 for (var i = 0, l = value.length; i < l; i++) {
5439 if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
5440 if (res) { res += ' '; }
5441 res += stringified;
5442 }
5443 }
5444 return res
5445}
5446
5447function stringifyObject (value) {
5448 var res = '';
5449 for (var key in value) {
5450 if (value[key]) {
5451 if (res) { res += ' '; }
5452 res += key;
5453 }
5454 }
5455 return res
5456}
5457
5458/* */
5459
5460var namespaceMap = {
5461 svg: 'http://www.w3.org/2000/svg',
5462 math: 'http://www.w3.org/1998/Math/MathML'
5463};
5464
5465var isHTMLTag = makeMap(
5466 'html,body,base,head,link,meta,style,title,' +
5467 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
5468 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
5469 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
5470 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
5471 'embed,object,param,source,canvas,script,noscript,del,ins,' +
5472 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
5473 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
5474 'output,progress,select,textarea,' +
5475 'details,dialog,menu,menuitem,summary,' +
5476 'content,element,shadow,template,blockquote,iframe,tfoot'
5477);
5478
5479// this map is intentionally selective, only covering SVG elements that may
5480// contain child elements.
5481var isSVG = makeMap(
5482 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
5483 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
5484 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
5485 true
5486);
5487
5488var isReservedTag = function (tag) {
5489 return isHTMLTag(tag) || isSVG(tag)
5490};
5491
5492function getTagNamespace (tag) {
5493 if (isSVG(tag)) {
5494 return 'svg'
5495 }
5496 // basic support for MathML
5497 // note it doesn't support other MathML elements being component roots
5498 if (tag === 'math') {
5499 return 'math'
5500 }
5501}
5502
5503var unknownElementCache = Object.create(null);
5504function isUnknownElement (tag) {
5505 /* istanbul ignore if */
5506 if (!inBrowser) {
5507 return true
5508 }
5509 if (isReservedTag(tag)) {
5510 return false
5511 }
5512 tag = tag.toLowerCase();
5513 /* istanbul ignore if */
5514 if (unknownElementCache[tag] != null) {
5515 return unknownElementCache[tag]
5516 }
5517 var el = document.createElement(tag);
5518 if (tag.indexOf('-') > -1) {
5519 // http://stackoverflow.com/a/28210364/1070244
5520 return (unknownElementCache[tag] = (
5521 el.constructor === window.HTMLUnknownElement ||
5522 el.constructor === window.HTMLElement
5523 ))
5524 } else {
5525 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
5526 }
5527}
5528
5529var isTextInputType = makeMap('text,number,password,search,email,tel,url');
5530
5531/* */
5532
5533/**
5534 * Query an element selector if it's not an element already.
5535 */
5536function query (el) {
5537 if (typeof el === 'string') {
5538 var selected = document.querySelector(el);
5539 if (!selected) {
5540 warn(
5541 'Cannot find element: ' + el
5542 );
5543 return document.createElement('div')
5544 }
5545 return selected
5546 } else {
5547 return el
5548 }
5549}
5550
5551/* */
5552
5553function createElement$1 (tagName, vnode) {
5554 var elm = document.createElement(tagName);
5555 if (tagName !== 'select') {
5556 return elm
5557 }
5558 // false or null will remove the attribute but undefined will not
5559 if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
5560 elm.setAttribute('multiple', 'multiple');
5561 }
5562 return elm
5563}
5564
5565function createElementNS (namespace, tagName) {
5566 return document.createElementNS(namespaceMap[namespace], tagName)
5567}
5568
5569function createTextNode (text) {
5570 return document.createTextNode(text)
5571}
5572
5573function createComment (text) {
5574 return document.createComment(text)
5575}
5576
5577function insertBefore (parentNode, newNode, referenceNode) {
5578 parentNode.insertBefore(newNode, referenceNode);
5579}
5580
5581function removeChild (node, child) {
5582 node.removeChild(child);
5583}
5584
5585function appendChild (node, child) {
5586 node.appendChild(child);
5587}
5588
5589function parentNode (node) {
5590 return node.parentNode
5591}
5592
5593function nextSibling (node) {
5594 return node.nextSibling
5595}
5596
5597function tagName (node) {
5598 return node.tagName
5599}
5600
5601function setTextContent (node, text) {
5602 node.textContent = text;
5603}
5604
5605function setStyleScope (node, scopeId) {
5606 node.setAttribute(scopeId, '');
5607}
5608
5609var nodeOps = /*#__PURE__*/Object.freeze({
5610 createElement: createElement$1,
5611 createElementNS: createElementNS,
5612 createTextNode: createTextNode,
5613 createComment: createComment,
5614 insertBefore: insertBefore,
5615 removeChild: removeChild,
5616 appendChild: appendChild,
5617 parentNode: parentNode,
5618 nextSibling: nextSibling,
5619 tagName: tagName,
5620 setTextContent: setTextContent,
5621 setStyleScope: setStyleScope
5622});
5623
5624/* */
5625
5626var ref = {
5627 create: function create (_, vnode) {
5628 registerRef(vnode);
5629 },
5630 update: function update (oldVnode, vnode) {
5631 if (oldVnode.data.ref !== vnode.data.ref) {
5632 registerRef(oldVnode, true);
5633 registerRef(vnode);
5634 }
5635 },
5636 destroy: function destroy (vnode) {
5637 registerRef(vnode, true);
5638 }
5639};
5640
5641function registerRef (vnode, isRemoval) {
5642 var key = vnode.data.ref;
5643 if (!isDef(key)) { return }
5644
5645 var vm = vnode.context;
5646 var ref = vnode.componentInstance || vnode.elm;
5647 var refs = vm.$refs;
5648 if (isRemoval) {
5649 if (Array.isArray(refs[key])) {
5650 remove(refs[key], ref);
5651 } else if (refs[key] === ref) {
5652 refs[key] = undefined;
5653 }
5654 } else {
5655 if (vnode.data.refInFor) {
5656 if (!Array.isArray(refs[key])) {
5657 refs[key] = [ref];
5658 } else if (refs[key].indexOf(ref) < 0) {
5659 // $flow-disable-line
5660 refs[key].push(ref);
5661 }
5662 } else {
5663 refs[key] = ref;
5664 }
5665 }
5666}
5667
5668/**
5669 * Virtual DOM patching algorithm based on Snabbdom by
5670 * Simon Friis Vindum (@paldepind)
5671 * Licensed under the MIT License
5672 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
5673 *
5674 * modified by Evan You (@yyx990803)
5675 *
5676 * Not type-checking this because this file is perf-critical and the cost
5677 * of making flow understand it is not worth it.
5678 */
5679
5680var emptyNode = new VNode('', {}, []);
5681
5682var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
5683
5684function sameVnode (a, b) {
5685 return (
5686 a.key === b.key && (
5687 (
5688 a.tag === b.tag &&
5689 a.isComment === b.isComment &&
5690 isDef(a.data) === isDef(b.data) &&
5691 sameInputType(a, b)
5692 ) || (
5693 isTrue(a.isAsyncPlaceholder) &&
5694 a.asyncFactory === b.asyncFactory &&
5695 isUndef(b.asyncFactory.error)
5696 )
5697 )
5698 )
5699}
5700
5701function sameInputType (a, b) {
5702 if (a.tag !== 'input') { return true }
5703 var i;
5704 var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
5705 var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
5706 return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
5707}
5708
5709function createKeyToOldIdx (children, beginIdx, endIdx) {
5710 var i, key;
5711 var map = {};
5712 for (i = beginIdx; i <= endIdx; ++i) {
5713 key = children[i].key;
5714 if (isDef(key)) { map[key] = i; }
5715 }
5716 return map
5717}
5718
5719function createPatchFunction (backend) {
5720 var i, j;
5721 var cbs = {};
5722
5723 var modules = backend.modules;
5724 var nodeOps = backend.nodeOps;
5725
5726 for (i = 0; i < hooks.length; ++i) {
5727 cbs[hooks[i]] = [];
5728 for (j = 0; j < modules.length; ++j) {
5729 if (isDef(modules[j][hooks[i]])) {
5730 cbs[hooks[i]].push(modules[j][hooks[i]]);
5731 }
5732 }
5733 }
5734
5735 function emptyNodeAt (elm) {
5736 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
5737 }
5738
5739 function createRmCb (childElm, listeners) {
5740 function remove$$1 () {
5741 if (--remove$$1.listeners === 0) {
5742 removeNode(childElm);
5743 }
5744 }
5745 remove$$1.listeners = listeners;
5746 return remove$$1
5747 }
5748
5749 function removeNode (el) {
5750 var parent = nodeOps.parentNode(el);
5751 // element may have already been removed due to v-html / v-text
5752 if (isDef(parent)) {
5753 nodeOps.removeChild(parent, el);
5754 }
5755 }
5756
5757 function isUnknownElement$$1 (vnode, inVPre) {
5758 return (
5759 !inVPre &&
5760 !vnode.ns &&
5761 !(
5762 config.ignoredElements.length &&
5763 config.ignoredElements.some(function (ignore) {
5764 return isRegExp(ignore)
5765 ? ignore.test(vnode.tag)
5766 : ignore === vnode.tag
5767 })
5768 ) &&
5769 config.isUnknownElement(vnode.tag)
5770 )
5771 }
5772
5773 var creatingElmInVPre = 0;
5774
5775 function createElm (
5776 vnode,
5777 insertedVnodeQueue,
5778 parentElm,
5779 refElm,
5780 nested,
5781 ownerArray,
5782 index
5783 ) {
5784 if (isDef(vnode.elm) && isDef(ownerArray)) {
5785 // This vnode was used in a previous render!
5786 // now it's used as a new node, overwriting its elm would cause
5787 // potential patch errors down the road when it's used as an insertion
5788 // reference node. Instead, we clone the node on-demand before creating
5789 // associated DOM element for it.
5790 vnode = ownerArray[index] = cloneVNode(vnode);
5791 }
5792
5793 vnode.isRootInsert = !nested; // for transition enter check
5794 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
5795 return
5796 }
5797
5798 var data = vnode.data;
5799 var children = vnode.children;
5800 var tag = vnode.tag;
5801 if (isDef(tag)) {
5802 {
5803 if (data && data.pre) {
5804 creatingElmInVPre++;
5805 }
5806 if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
5807 warn(
5808 'Unknown custom element: <' + tag + '> - did you ' +
5809 'register the component correctly? For recursive components, ' +
5810 'make sure to provide the "name" option.',
5811 vnode.context
5812 );
5813 }
5814 }
5815
5816 vnode.elm = vnode.ns
5817 ? nodeOps.createElementNS(vnode.ns, tag)
5818 : nodeOps.createElement(tag, vnode);
5819 setScope(vnode);
5820
5821 /* istanbul ignore if */
5822 {
5823 createChildren(vnode, children, insertedVnodeQueue);
5824 if (isDef(data)) {
5825 invokeCreateHooks(vnode, insertedVnodeQueue);
5826 }
5827 insert(parentElm, vnode.elm, refElm);
5828 }
5829
5830 if (data && data.pre) {
5831 creatingElmInVPre--;
5832 }
5833 } else if (isTrue(vnode.isComment)) {
5834 vnode.elm = nodeOps.createComment(vnode.text);
5835 insert(parentElm, vnode.elm, refElm);
5836 } else {
5837 vnode.elm = nodeOps.createTextNode(vnode.text);
5838 insert(parentElm, vnode.elm, refElm);
5839 }
5840 }
5841
5842 function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5843 var i = vnode.data;
5844 if (isDef(i)) {
5845 var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
5846 if (isDef(i = i.hook) && isDef(i = i.init)) {
5847 i(vnode, false /* hydrating */);
5848 }
5849 // after calling the init hook, if the vnode is a child component
5850 // it should've created a child instance and mounted it. the child
5851 // component also has set the placeholder vnode's elm.
5852 // in that case we can just return the element and be done.
5853 if (isDef(vnode.componentInstance)) {
5854 initComponent(vnode, insertedVnodeQueue);
5855 insert(parentElm, vnode.elm, refElm);
5856 if (isTrue(isReactivated)) {
5857 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
5858 }
5859 return true
5860 }
5861 }
5862 }
5863
5864 function initComponent (vnode, insertedVnodeQueue) {
5865 if (isDef(vnode.data.pendingInsert)) {
5866 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
5867 vnode.data.pendingInsert = null;
5868 }
5869 vnode.elm = vnode.componentInstance.$el;
5870 if (isPatchable(vnode)) {
5871 invokeCreateHooks(vnode, insertedVnodeQueue);
5872 setScope(vnode);
5873 } else {
5874 // empty component root.
5875 // skip all element-related modules except for ref (#3455)
5876 registerRef(vnode);
5877 // make sure to invoke the insert hook
5878 insertedVnodeQueue.push(vnode);
5879 }
5880 }
5881
5882 function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5883 var i;
5884 // hack for #4339: a reactivated component with inner transition
5885 // does not trigger because the inner node's created hooks are not called
5886 // again. It's not ideal to involve module-specific logic in here but
5887 // there doesn't seem to be a better way to do it.
5888 var innerNode = vnode;
5889 while (innerNode.componentInstance) {
5890 innerNode = innerNode.componentInstance._vnode;
5891 if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
5892 for (i = 0; i < cbs.activate.length; ++i) {
5893 cbs.activate[i](emptyNode, innerNode);
5894 }
5895 insertedVnodeQueue.push(innerNode);
5896 break
5897 }
5898 }
5899 // unlike a newly created component,
5900 // a reactivated keep-alive component doesn't insert itself
5901 insert(parentElm, vnode.elm, refElm);
5902 }
5903
5904 function insert (parent, elm, ref$$1) {
5905 if (isDef(parent)) {
5906 if (isDef(ref$$1)) {
5907 if (nodeOps.parentNode(ref$$1) === parent) {
5908 nodeOps.insertBefore(parent, elm, ref$$1);
5909 }
5910 } else {
5911 nodeOps.appendChild(parent, elm);
5912 }
5913 }
5914 }
5915
5916 function createChildren (vnode, children, insertedVnodeQueue) {
5917 if (Array.isArray(children)) {
5918 {
5919 checkDuplicateKeys(children);
5920 }
5921 for (var i = 0; i < children.length; ++i) {
5922 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
5923 }
5924 } else if (isPrimitive(vnode.text)) {
5925 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
5926 }
5927 }
5928
5929 function isPatchable (vnode) {
5930 while (vnode.componentInstance) {
5931 vnode = vnode.componentInstance._vnode;
5932 }
5933 return isDef(vnode.tag)
5934 }
5935
5936 function invokeCreateHooks (vnode, insertedVnodeQueue) {
5937 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
5938 cbs.create[i$1](emptyNode, vnode);
5939 }
5940 i = vnode.data.hook; // Reuse variable
5941 if (isDef(i)) {
5942 if (isDef(i.create)) { i.create(emptyNode, vnode); }
5943 if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
5944 }
5945 }
5946
5947 // set scope id attribute for scoped CSS.
5948 // this is implemented as a special case to avoid the overhead
5949 // of going through the normal attribute patching process.
5950 function setScope (vnode) {
5951 var i;
5952 if (isDef(i = vnode.fnScopeId)) {
5953 nodeOps.setStyleScope(vnode.elm, i);
5954 } else {
5955 var ancestor = vnode;
5956 while (ancestor) {
5957 if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
5958 nodeOps.setStyleScope(vnode.elm, i);
5959 }
5960 ancestor = ancestor.parent;
5961 }
5962 }
5963 // for slot content they should also get the scopeId from the host instance.
5964 if (isDef(i = activeInstance) &&
5965 i !== vnode.context &&
5966 i !== vnode.fnContext &&
5967 isDef(i = i.$options._scopeId)
5968 ) {
5969 nodeOps.setStyleScope(vnode.elm, i);
5970 }
5971 }
5972
5973 function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
5974 for (; startIdx <= endIdx; ++startIdx) {
5975 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
5976 }
5977 }
5978
5979 function invokeDestroyHook (vnode) {
5980 var i, j;
5981 var data = vnode.data;
5982 if (isDef(data)) {
5983 if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
5984 for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
5985 }
5986 if (isDef(i = vnode.children)) {
5987 for (j = 0; j < vnode.children.length; ++j) {
5988 invokeDestroyHook(vnode.children[j]);
5989 }
5990 }
5991 }
5992
5993 function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
5994 for (; startIdx <= endIdx; ++startIdx) {
5995 var ch = vnodes[startIdx];
5996 if (isDef(ch)) {
5997 if (isDef(ch.tag)) {
5998 removeAndInvokeRemoveHook(ch);
5999 invokeDestroyHook(ch);
6000 } else { // Text node
6001 removeNode(ch.elm);
6002 }
6003 }
6004 }
6005 }
6006
6007 function removeAndInvokeRemoveHook (vnode, rm) {
6008 if (isDef(rm) || isDef(vnode.data)) {
6009 var i;
6010 var listeners = cbs.remove.length + 1;
6011 if (isDef(rm)) {
6012 // we have a recursively passed down rm callback
6013 // increase the listeners count
6014 rm.listeners += listeners;
6015 } else {
6016 // directly removing
6017 rm = createRmCb(vnode.elm, listeners);
6018 }
6019 // recursively invoke hooks on child component root node
6020 if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
6021 removeAndInvokeRemoveHook(i, rm);
6022 }
6023 for (i = 0; i < cbs.remove.length; ++i) {
6024 cbs.remove[i](vnode, rm);
6025 }
6026 if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
6027 i(vnode, rm);
6028 } else {
6029 rm();
6030 }
6031 } else {
6032 removeNode(vnode.elm);
6033 }
6034 }
6035
6036 function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
6037 var oldStartIdx = 0;
6038 var newStartIdx = 0;
6039 var oldEndIdx = oldCh.length - 1;
6040 var oldStartVnode = oldCh[0];
6041 var oldEndVnode = oldCh[oldEndIdx];
6042 var newEndIdx = newCh.length - 1;
6043 var newStartVnode = newCh[0];
6044 var newEndVnode = newCh[newEndIdx];
6045 var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
6046
6047 // removeOnly is a special flag used only by <transition-group>
6048 // to ensure removed elements stay in correct relative positions
6049 // during leaving transitions
6050 var canMove = !removeOnly;
6051
6052 {
6053 checkDuplicateKeys(newCh);
6054 }
6055
6056 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
6057 if (isUndef(oldStartVnode)) {
6058 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
6059 } else if (isUndef(oldEndVnode)) {
6060 oldEndVnode = oldCh[--oldEndIdx];
6061 } else if (sameVnode(oldStartVnode, newStartVnode)) {
6062 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6063 oldStartVnode = oldCh[++oldStartIdx];
6064 newStartVnode = newCh[++newStartIdx];
6065 } else if (sameVnode(oldEndVnode, newEndVnode)) {
6066 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6067 oldEndVnode = oldCh[--oldEndIdx];
6068 newEndVnode = newCh[--newEndIdx];
6069 } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
6070 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6071 canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
6072 oldStartVnode = oldCh[++oldStartIdx];
6073 newEndVnode = newCh[--newEndIdx];
6074 } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
6075 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6076 canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
6077 oldEndVnode = oldCh[--oldEndIdx];
6078 newStartVnode = newCh[++newStartIdx];
6079 } else {
6080 if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
6081 idxInOld = isDef(newStartVnode.key)
6082 ? oldKeyToIdx[newStartVnode.key]
6083 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
6084 if (isUndef(idxInOld)) { // New element
6085 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6086 } else {
6087 vnodeToMove = oldCh[idxInOld];
6088 if (sameVnode(vnodeToMove, newStartVnode)) {
6089 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6090 oldCh[idxInOld] = undefined;
6091 canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
6092 } else {
6093 // same key but different element. treat as new element
6094 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6095 }
6096 }
6097 newStartVnode = newCh[++newStartIdx];
6098 }
6099 }
6100 if (oldStartIdx > oldEndIdx) {
6101 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6102 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6103 } else if (newStartIdx > newEndIdx) {
6104 removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6105 }
6106 }
6107
6108 function checkDuplicateKeys (children) {
6109 var seenKeys = {};
6110 for (var i = 0; i < children.length; i++) {
6111 var vnode = children[i];
6112 var key = vnode.key;
6113 if (isDef(key)) {
6114 if (seenKeys[key]) {
6115 warn(
6116 ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
6117 vnode.context
6118 );
6119 } else {
6120 seenKeys[key] = true;
6121 }
6122 }
6123 }
6124 }
6125
6126 function findIdxInOld (node, oldCh, start, end) {
6127 for (var i = start; i < end; i++) {
6128 var c = oldCh[i];
6129 if (isDef(c) && sameVnode(node, c)) { return i }
6130 }
6131 }
6132
6133 function patchVnode (
6134 oldVnode,
6135 vnode,
6136 insertedVnodeQueue,
6137 ownerArray,
6138 index,
6139 removeOnly
6140 ) {
6141 if (oldVnode === vnode) {
6142 return
6143 }
6144
6145 if (isDef(vnode.elm) && isDef(ownerArray)) {
6146 // clone reused vnode
6147 vnode = ownerArray[index] = cloneVNode(vnode);
6148 }
6149
6150 var elm = vnode.elm = oldVnode.elm;
6151
6152 if (isTrue(oldVnode.isAsyncPlaceholder)) {
6153 if (isDef(vnode.asyncFactory.resolved)) {
6154 hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6155 } else {
6156 vnode.isAsyncPlaceholder = true;
6157 }
6158 return
6159 }
6160
6161 // reuse element for static trees.
6162 // note we only do this if the vnode is cloned -
6163 // if the new node is not cloned it means the render functions have been
6164 // reset by the hot-reload-api and we need to do a proper re-render.
6165 if (isTrue(vnode.isStatic) &&
6166 isTrue(oldVnode.isStatic) &&
6167 vnode.key === oldVnode.key &&
6168 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
6169 ) {
6170 vnode.componentInstance = oldVnode.componentInstance;
6171 return
6172 }
6173
6174 var i;
6175 var data = vnode.data;
6176 if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
6177 i(oldVnode, vnode);
6178 }
6179
6180 var oldCh = oldVnode.children;
6181 var ch = vnode.children;
6182 if (isDef(data) && isPatchable(vnode)) {
6183 for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
6184 if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
6185 }
6186 if (isUndef(vnode.text)) {
6187 if (isDef(oldCh) && isDef(ch)) {
6188 if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
6189 } else if (isDef(ch)) {
6190 {
6191 checkDuplicateKeys(ch);
6192 }
6193 if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6194 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6195 } else if (isDef(oldCh)) {
6196 removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6197 } else if (isDef(oldVnode.text)) {
6198 nodeOps.setTextContent(elm, '');
6199 }
6200 } else if (oldVnode.text !== vnode.text) {
6201 nodeOps.setTextContent(elm, vnode.text);
6202 }
6203 if (isDef(data)) {
6204 if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
6205 }
6206 }
6207
6208 function invokeInsertHook (vnode, queue, initial) {
6209 // delay insert hooks for component root nodes, invoke them after the
6210 // element is really inserted
6211 if (isTrue(initial) && isDef(vnode.parent)) {
6212 vnode.parent.data.pendingInsert = queue;
6213 } else {
6214 for (var i = 0; i < queue.length; ++i) {
6215 queue[i].data.hook.insert(queue[i]);
6216 }
6217 }
6218 }
6219
6220 var hydrationBailed = false;
6221 // list of modules that can skip create hook during hydration because they
6222 // are already rendered on the client or has no need for initialization
6223 // Note: style is excluded because it relies on initial clone for future
6224 // deep updates (#7063).
6225 var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
6226
6227 // Note: this is a browser-only function so we can assume elms are DOM nodes.
6228 function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
6229 var i;
6230 var tag = vnode.tag;
6231 var data = vnode.data;
6232 var children = vnode.children;
6233 inVPre = inVPre || (data && data.pre);
6234 vnode.elm = elm;
6235
6236 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
6237 vnode.isAsyncPlaceholder = true;
6238 return true
6239 }
6240 // assert node match
6241 {
6242 if (!assertNodeMatch(elm, vnode, inVPre)) {
6243 return false
6244 }
6245 }
6246 if (isDef(data)) {
6247 if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
6248 if (isDef(i = vnode.componentInstance)) {
6249 // child component. it should have hydrated its own tree.
6250 initComponent(vnode, insertedVnodeQueue);
6251 return true
6252 }
6253 }
6254 if (isDef(tag)) {
6255 if (isDef(children)) {
6256 // empty element, allow client to pick up and populate children
6257 if (!elm.hasChildNodes()) {
6258 createChildren(vnode, children, insertedVnodeQueue);
6259 } else {
6260 // v-html and domProps: innerHTML
6261 if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
6262 if (i !== elm.innerHTML) {
6263 /* istanbul ignore if */
6264 if (typeof console !== 'undefined' &&
6265 !hydrationBailed
6266 ) {
6267 hydrationBailed = true;
6268 console.warn('Parent: ', elm);
6269 console.warn('server innerHTML: ', i);
6270 console.warn('client innerHTML: ', elm.innerHTML);
6271 }
6272 return false
6273 }
6274 } else {
6275 // iterate and compare children lists
6276 var childrenMatch = true;
6277 var childNode = elm.firstChild;
6278 for (var i$1 = 0; i$1 < children.length; i$1++) {
6279 if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
6280 childrenMatch = false;
6281 break
6282 }
6283 childNode = childNode.nextSibling;
6284 }
6285 // if childNode is not null, it means the actual childNodes list is
6286 // longer than the virtual children list.
6287 if (!childrenMatch || childNode) {
6288 /* istanbul ignore if */
6289 if (typeof console !== 'undefined' &&
6290 !hydrationBailed
6291 ) {
6292 hydrationBailed = true;
6293 console.warn('Parent: ', elm);
6294 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
6295 }
6296 return false
6297 }
6298 }
6299 }
6300 }
6301 if (isDef(data)) {
6302 var fullInvoke = false;
6303 for (var key in data) {
6304 if (!isRenderedModule(key)) {
6305 fullInvoke = true;
6306 invokeCreateHooks(vnode, insertedVnodeQueue);
6307 break
6308 }
6309 }
6310 if (!fullInvoke && data['class']) {
6311 // ensure collecting deps for deep class bindings for future updates
6312 traverse(data['class']);
6313 }
6314 }
6315 } else if (elm.data !== vnode.text) {
6316 elm.data = vnode.text;
6317 }
6318 return true
6319 }
6320
6321 function assertNodeMatch (node, vnode, inVPre) {
6322 if (isDef(vnode.tag)) {
6323 return vnode.tag.indexOf('vue-component') === 0 || (
6324 !isUnknownElement$$1(vnode, inVPre) &&
6325 vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
6326 )
6327 } else {
6328 return node.nodeType === (vnode.isComment ? 8 : 3)
6329 }
6330 }
6331
6332 return function patch (oldVnode, vnode, hydrating, removeOnly) {
6333 if (isUndef(vnode)) {
6334 if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
6335 return
6336 }
6337
6338 var isInitialPatch = false;
6339 var insertedVnodeQueue = [];
6340
6341 if (isUndef(oldVnode)) {
6342 // empty mount (likely as component), create new root element
6343 isInitialPatch = true;
6344 createElm(vnode, insertedVnodeQueue);
6345 } else {
6346 var isRealElement = isDef(oldVnode.nodeType);
6347 if (!isRealElement && sameVnode(oldVnode, vnode)) {
6348 // patch existing root node
6349 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
6350 } else {
6351 if (isRealElement) {
6352 // mounting to a real element
6353 // check if this is server-rendered content and if we can perform
6354 // a successful hydration.
6355 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
6356 oldVnode.removeAttribute(SSR_ATTR);
6357 hydrating = true;
6358 }
6359 if (isTrue(hydrating)) {
6360 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
6361 invokeInsertHook(vnode, insertedVnodeQueue, true);
6362 return oldVnode
6363 } else {
6364 warn(
6365 'The client-side rendered virtual DOM tree is not matching ' +
6366 'server-rendered content. This is likely caused by incorrect ' +
6367 'HTML markup, for example nesting block-level elements inside ' +
6368 '<p>, or missing <tbody>. Bailing hydration and performing ' +
6369 'full client-side render.'
6370 );
6371 }
6372 }
6373 // either not server-rendered, or hydration failed.
6374 // create an empty node and replace it
6375 oldVnode = emptyNodeAt(oldVnode);
6376 }
6377
6378 // replacing existing element
6379 var oldElm = oldVnode.elm;
6380 var parentElm = nodeOps.parentNode(oldElm);
6381
6382 // create new node
6383 createElm(
6384 vnode,
6385 insertedVnodeQueue,
6386 // extremely rare edge case: do not insert if old element is in a
6387 // leaving transition. Only happens when combining transition +
6388 // keep-alive + HOCs. (#4590)
6389 oldElm._leaveCb ? null : parentElm,
6390 nodeOps.nextSibling(oldElm)
6391 );
6392
6393 // update parent placeholder node element, recursively
6394 if (isDef(vnode.parent)) {
6395 var ancestor = vnode.parent;
6396 var patchable = isPatchable(vnode);
6397 while (ancestor) {
6398 for (var i = 0; i < cbs.destroy.length; ++i) {
6399 cbs.destroy[i](ancestor);
6400 }
6401 ancestor.elm = vnode.elm;
6402 if (patchable) {
6403 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6404 cbs.create[i$1](emptyNode, ancestor);
6405 }
6406 // #6513
6407 // invoke insert hooks that may have been merged by create hooks.
6408 // e.g. for directives that uses the "inserted" hook.
6409 var insert = ancestor.data.hook.insert;
6410 if (insert.merged) {
6411 // start at index 1 to avoid re-invoking component mounted hook
6412 for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
6413 insert.fns[i$2]();
6414 }
6415 }
6416 } else {
6417 registerRef(ancestor);
6418 }
6419 ancestor = ancestor.parent;
6420 }
6421 }
6422
6423 // destroy old node
6424 if (isDef(parentElm)) {
6425 removeVnodes(parentElm, [oldVnode], 0, 0);
6426 } else if (isDef(oldVnode.tag)) {
6427 invokeDestroyHook(oldVnode);
6428 }
6429 }
6430 }
6431
6432 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
6433 return vnode.elm
6434 }
6435}
6436
6437/* */
6438
6439var directives = {
6440 create: updateDirectives,
6441 update: updateDirectives,
6442 destroy: function unbindDirectives (vnode) {
6443 updateDirectives(vnode, emptyNode);
6444 }
6445};
6446
6447function updateDirectives (oldVnode, vnode) {
6448 if (oldVnode.data.directives || vnode.data.directives) {
6449 _update(oldVnode, vnode);
6450 }
6451}
6452
6453function _update (oldVnode, vnode) {
6454 var isCreate = oldVnode === emptyNode;
6455 var isDestroy = vnode === emptyNode;
6456 var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
6457 var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
6458
6459 var dirsWithInsert = [];
6460 var dirsWithPostpatch = [];
6461
6462 var key, oldDir, dir;
6463 for (key in newDirs) {
6464 oldDir = oldDirs[key];
6465 dir = newDirs[key];
6466 if (!oldDir) {
6467 // new directive, bind
6468 callHook$1(dir, 'bind', vnode, oldVnode);
6469 if (dir.def && dir.def.inserted) {
6470 dirsWithInsert.push(dir);
6471 }
6472 } else {
6473 // existing directive, update
6474 dir.oldValue = oldDir.value;
6475 dir.oldArg = oldDir.arg;
6476 callHook$1(dir, 'update', vnode, oldVnode);
6477 if (dir.def && dir.def.componentUpdated) {
6478 dirsWithPostpatch.push(dir);
6479 }
6480 }
6481 }
6482
6483 if (dirsWithInsert.length) {
6484 var callInsert = function () {
6485 for (var i = 0; i < dirsWithInsert.length; i++) {
6486 callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
6487 }
6488 };
6489 if (isCreate) {
6490 mergeVNodeHook(vnode, 'insert', callInsert);
6491 } else {
6492 callInsert();
6493 }
6494 }
6495
6496 if (dirsWithPostpatch.length) {
6497 mergeVNodeHook(vnode, 'postpatch', function () {
6498 for (var i = 0; i < dirsWithPostpatch.length; i++) {
6499 callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
6500 }
6501 });
6502 }
6503
6504 if (!isCreate) {
6505 for (key in oldDirs) {
6506 if (!newDirs[key]) {
6507 // no longer present, unbind
6508 callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
6509 }
6510 }
6511 }
6512}
6513
6514var emptyModifiers = Object.create(null);
6515
6516function normalizeDirectives$1 (
6517 dirs,
6518 vm
6519) {
6520 var res = Object.create(null);
6521 if (!dirs) {
6522 // $flow-disable-line
6523 return res
6524 }
6525 var i, dir;
6526 for (i = 0; i < dirs.length; i++) {
6527 dir = dirs[i];
6528 if (!dir.modifiers) {
6529 // $flow-disable-line
6530 dir.modifiers = emptyModifiers;
6531 }
6532 res[getRawDirName(dir)] = dir;
6533 dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
6534 }
6535 // $flow-disable-line
6536 return res
6537}
6538
6539function getRawDirName (dir) {
6540 return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
6541}
6542
6543function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
6544 var fn = dir.def && dir.def[hook];
6545 if (fn) {
6546 try {
6547 fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
6548 } catch (e) {
6549 handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
6550 }
6551 }
6552}
6553
6554var baseModules = [
6555 ref,
6556 directives
6557];
6558
6559/* */
6560
6561function updateAttrs (oldVnode, vnode) {
6562 var opts = vnode.componentOptions;
6563 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
6564 return
6565 }
6566 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
6567 return
6568 }
6569 var key, cur, old;
6570 var elm = vnode.elm;
6571 var oldAttrs = oldVnode.data.attrs || {};
6572 var attrs = vnode.data.attrs || {};
6573 // clone observed objects, as the user probably wants to mutate it
6574 if (isDef(attrs.__ob__)) {
6575 attrs = vnode.data.attrs = extend({}, attrs);
6576 }
6577
6578 for (key in attrs) {
6579 cur = attrs[key];
6580 old = oldAttrs[key];
6581 if (old !== cur) {
6582 setAttr(elm, key, cur);
6583 }
6584 }
6585 // #4391: in IE9, setting type can reset value for input[type=radio]
6586 // #6666: IE/Edge forces progress value down to 1 before setting a max
6587 /* istanbul ignore if */
6588 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
6589 setAttr(elm, 'value', attrs.value);
6590 }
6591 for (key in oldAttrs) {
6592 if (isUndef(attrs[key])) {
6593 if (isXlink(key)) {
6594 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
6595 } else if (!isEnumeratedAttr(key)) {
6596 elm.removeAttribute(key);
6597 }
6598 }
6599 }
6600}
6601
6602function setAttr (el, key, value) {
6603 if (el.tagName.indexOf('-') > -1) {
6604 baseSetAttr(el, key, value);
6605 } else if (isBooleanAttr(key)) {
6606 // set attribute for blank value
6607 // e.g. <option disabled>Select one</option>
6608 if (isFalsyAttrValue(value)) {
6609 el.removeAttribute(key);
6610 } else {
6611 // technically allowfullscreen is a boolean attribute for <iframe>,
6612 // but Flash expects a value of "true" when used on <embed> tag
6613 value = key === 'allowfullscreen' && el.tagName === 'EMBED'
6614 ? 'true'
6615 : key;
6616 el.setAttribute(key, value);
6617 }
6618 } else if (isEnumeratedAttr(key)) {
6619 el.setAttribute(key, convertEnumeratedValue(key, value));
6620 } else if (isXlink(key)) {
6621 if (isFalsyAttrValue(value)) {
6622 el.removeAttributeNS(xlinkNS, getXlinkProp(key));
6623 } else {
6624 el.setAttributeNS(xlinkNS, key, value);
6625 }
6626 } else {
6627 baseSetAttr(el, key, value);
6628 }
6629}
6630
6631function baseSetAttr (el, key, value) {
6632 if (isFalsyAttrValue(value)) {
6633 el.removeAttribute(key);
6634 } else {
6635 // #7138: IE10 & 11 fires input event when setting placeholder on
6636 // <textarea>... block the first input event and remove the blocker
6637 // immediately.
6638 /* istanbul ignore if */
6639 if (
6640 isIE && !isIE9 &&
6641 el.tagName === 'TEXTAREA' &&
6642 key === 'placeholder' && value !== '' && !el.__ieph
6643 ) {
6644 var blocker = function (e) {
6645 e.stopImmediatePropagation();
6646 el.removeEventListener('input', blocker);
6647 };
6648 el.addEventListener('input', blocker);
6649 // $flow-disable-line
6650 el.__ieph = true; /* IE placeholder patched */
6651 }
6652 el.setAttribute(key, value);
6653 }
6654}
6655
6656var attrs = {
6657 create: updateAttrs,
6658 update: updateAttrs
6659};
6660
6661/* */
6662
6663function updateClass (oldVnode, vnode) {
6664 var el = vnode.elm;
6665 var data = vnode.data;
6666 var oldData = oldVnode.data;
6667 if (
6668 isUndef(data.staticClass) &&
6669 isUndef(data.class) && (
6670 isUndef(oldData) || (
6671 isUndef(oldData.staticClass) &&
6672 isUndef(oldData.class)
6673 )
6674 )
6675 ) {
6676 return
6677 }
6678
6679 var cls = genClassForVnode(vnode);
6680
6681 // handle transition classes
6682 var transitionClass = el._transitionClasses;
6683 if (isDef(transitionClass)) {
6684 cls = concat(cls, stringifyClass(transitionClass));
6685 }
6686
6687 // set the class
6688 if (cls !== el._prevClass) {
6689 el.setAttribute('class', cls);
6690 el._prevClass = cls;
6691 }
6692}
6693
6694var klass = {
6695 create: updateClass,
6696 update: updateClass
6697};
6698
6699/* */
6700
6701/* */
6702
6703/* */
6704
6705/* */
6706
6707// in some cases, the event used has to be determined at runtime
6708// so we used some reserved tokens during compile.
6709var RANGE_TOKEN = '__r';
6710var CHECKBOX_RADIO_TOKEN = '__c';
6711
6712/* */
6713
6714// normalize v-model event tokens that can only be determined at runtime.
6715// it's important to place the event as the first in the array because
6716// the whole point is ensuring the v-model callback gets called before
6717// user-attached handlers.
6718function normalizeEvents (on) {
6719 /* istanbul ignore if */
6720 if (isDef(on[RANGE_TOKEN])) {
6721 // IE input[type=range] only supports `change` event
6722 var event = isIE ? 'change' : 'input';
6723 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
6724 delete on[RANGE_TOKEN];
6725 }
6726 // This was originally intended to fix #4521 but no longer necessary
6727 // after 2.5. Keeping it for backwards compat with generated code from < 2.4
6728 /* istanbul ignore if */
6729 if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
6730 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
6731 delete on[CHECKBOX_RADIO_TOKEN];
6732 }
6733}
6734
6735var target$1;
6736
6737function createOnceHandler$1 (event, handler, capture) {
6738 var _target = target$1; // save current target element in closure
6739 return function onceHandler () {
6740 var res = handler.apply(null, arguments);
6741 if (res !== null) {
6742 remove$2(event, onceHandler, capture, _target);
6743 }
6744 }
6745}
6746
6747function add$1 (
6748 name,
6749 handler,
6750 capture,
6751 passive
6752) {
6753 // async edge case #6566: inner click event triggers patch, event handler
6754 // attached to outer element during patch, and triggered again. This
6755 // happens because browsers fire microtask ticks between event propagation.
6756 // the solution is simple: we save the timestamp when a handler is attached,
6757 // and the handler would only fire if the event passed to it was fired
6758 // AFTER it was attached.
6759 if (isUsingMicroTask) {
6760 var attachedTimestamp = currentFlushTimestamp;
6761 var original = handler;
6762 handler = original._wrapper = function (e) {
6763 if (e.timeStamp >= attachedTimestamp) {
6764 return original.apply(this, arguments)
6765 }
6766 };
6767 }
6768 target$1.addEventListener(
6769 name,
6770 handler,
6771 supportsPassive
6772 ? { capture: capture, passive: passive }
6773 : capture
6774 );
6775}
6776
6777function remove$2 (
6778 name,
6779 handler,
6780 capture,
6781 _target
6782) {
6783 (_target || target$1).removeEventListener(
6784 name,
6785 handler._wrapper || handler,
6786 capture
6787 );
6788}
6789
6790function updateDOMListeners (oldVnode, vnode) {
6791 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
6792 return
6793 }
6794 var on = vnode.data.on || {};
6795 var oldOn = oldVnode.data.on || {};
6796 target$1 = vnode.elm;
6797 normalizeEvents(on);
6798 updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
6799 target$1 = undefined;
6800}
6801
6802var events = {
6803 create: updateDOMListeners,
6804 update: updateDOMListeners
6805};
6806
6807/* */
6808
6809var svgContainer;
6810
6811function updateDOMProps (oldVnode, vnode) {
6812 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
6813 return
6814 }
6815 var key, cur;
6816 var elm = vnode.elm;
6817 var oldProps = oldVnode.data.domProps || {};
6818 var props = vnode.data.domProps || {};
6819 // clone observed objects, as the user probably wants to mutate it
6820 if (isDef(props.__ob__)) {
6821 props = vnode.data.domProps = extend({}, props);
6822 }
6823
6824 for (key in oldProps) {
6825 if (isUndef(props[key])) {
6826 elm[key] = '';
6827 }
6828 }
6829 for (key in props) {
6830 cur = props[key];
6831 // ignore children if the node has textContent or innerHTML,
6832 // as these will throw away existing DOM nodes and cause removal errors
6833 // on subsequent patches (#3360)
6834 if (key === 'textContent' || key === 'innerHTML') {
6835 if (vnode.children) { vnode.children.length = 0; }
6836 if (cur === oldProps[key]) { continue }
6837 // #6601 work around Chrome version <= 55 bug where single textNode
6838 // replaced by innerHTML/textContent retains its parentNode property
6839 if (elm.childNodes.length === 1) {
6840 elm.removeChild(elm.childNodes[0]);
6841 }
6842 }
6843
6844 // skip the update if old and new VDOM state is the same.
6845 // the only exception is `value` where the DOM value may be temporarily
6846 // out of sync with VDOM state due to focus, composition and modifiers.
6847 // This also covers #4521 by skipping the unnecesarry `checked` update.
6848 if (key !== 'value' && cur === oldProps[key]) {
6849 continue
6850 }
6851
6852 if (key === 'value') {
6853 // store value as _value as well since
6854 // non-string values will be stringified
6855 elm._value = cur;
6856 // avoid resetting cursor position when value is the same
6857 var strCur = isUndef(cur) ? '' : String(cur);
6858 if (shouldUpdateValue(elm, strCur)) {
6859 elm.value = strCur;
6860 }
6861 } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
6862 // IE doesn't support innerHTML for SVG elements
6863 svgContainer = svgContainer || document.createElement('div');
6864 svgContainer.innerHTML = "<svg>" + cur + "</svg>";
6865 var svg = svgContainer.firstChild;
6866 while (elm.firstChild) {
6867 elm.removeChild(elm.firstChild);
6868 }
6869 while (svg.firstChild) {
6870 elm.appendChild(svg.firstChild);
6871 }
6872 } else {
6873 elm[key] = cur;
6874 }
6875 }
6876}
6877
6878// check platforms/web/util/attrs.js acceptValue
6879
6880
6881function shouldUpdateValue (elm, checkVal) {
6882 return (!elm.composing && (
6883 elm.tagName === 'OPTION' ||
6884 isNotInFocusAndDirty(elm, checkVal) ||
6885 isDirtyWithModifiers(elm, checkVal)
6886 ))
6887}
6888
6889function isNotInFocusAndDirty (elm, checkVal) {
6890 // return true when textbox (.number and .trim) loses focus and its value is
6891 // not equal to the updated value
6892 var notInFocus = true;
6893 // #6157
6894 // work around IE bug when accessing document.activeElement in an iframe
6895 try { notInFocus = document.activeElement !== elm; } catch (e) {}
6896 return notInFocus && elm.value !== checkVal
6897}
6898
6899function isDirtyWithModifiers (elm, newVal) {
6900 var value = elm.value;
6901 var modifiers = elm._vModifiers; // injected by v-model runtime
6902 if (isDef(modifiers)) {
6903 if (modifiers.number) {
6904 return toNumber(value) !== toNumber(newVal)
6905 }
6906 if (modifiers.trim) {
6907 return value.trim() !== newVal.trim()
6908 }
6909 }
6910 return value !== newVal
6911}
6912
6913var domProps = {
6914 create: updateDOMProps,
6915 update: updateDOMProps
6916};
6917
6918/* */
6919
6920var parseStyleText = cached(function (cssText) {
6921 var res = {};
6922 var listDelimiter = /;(?![^(]*\))/g;
6923 var propertyDelimiter = /:(.+)/;
6924 cssText.split(listDelimiter).forEach(function (item) {
6925 if (item) {
6926 var tmp = item.split(propertyDelimiter);
6927 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
6928 }
6929 });
6930 return res
6931});
6932
6933// merge static and dynamic style data on the same vnode
6934function normalizeStyleData (data) {
6935 var style = normalizeStyleBinding(data.style);
6936 // static style is pre-processed into an object during compilation
6937 // and is always a fresh object, so it's safe to merge into it
6938 return data.staticStyle
6939 ? extend(data.staticStyle, style)
6940 : style
6941}
6942
6943// normalize possible array / string values into Object
6944function normalizeStyleBinding (bindingStyle) {
6945 if (Array.isArray(bindingStyle)) {
6946 return toObject(bindingStyle)
6947 }
6948 if (typeof bindingStyle === 'string') {
6949 return parseStyleText(bindingStyle)
6950 }
6951 return bindingStyle
6952}
6953
6954/**
6955 * parent component style should be after child's
6956 * so that parent component's style could override it
6957 */
6958function getStyle (vnode, checkChild) {
6959 var res = {};
6960 var styleData;
6961
6962 if (checkChild) {
6963 var childNode = vnode;
6964 while (childNode.componentInstance) {
6965 childNode = childNode.componentInstance._vnode;
6966 if (
6967 childNode && childNode.data &&
6968 (styleData = normalizeStyleData(childNode.data))
6969 ) {
6970 extend(res, styleData);
6971 }
6972 }
6973 }
6974
6975 if ((styleData = normalizeStyleData(vnode.data))) {
6976 extend(res, styleData);
6977 }
6978
6979 var parentNode = vnode;
6980 while ((parentNode = parentNode.parent)) {
6981 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
6982 extend(res, styleData);
6983 }
6984 }
6985 return res
6986}
6987
6988/* */
6989
6990var cssVarRE = /^--/;
6991var importantRE = /\s*!important$/;
6992var setProp = function (el, name, val) {
6993 /* istanbul ignore if */
6994 if (cssVarRE.test(name)) {
6995 el.style.setProperty(name, val);
6996 } else if (importantRE.test(val)) {
6997 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
6998 } else {
6999 var normalizedName = normalize(name);
7000 if (Array.isArray(val)) {
7001 // Support values array created by autoprefixer, e.g.
7002 // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
7003 // Set them one by one, and the browser will only set those it can recognize
7004 for (var i = 0, len = val.length; i < len; i++) {
7005 el.style[normalizedName] = val[i];
7006 }
7007 } else {
7008 el.style[normalizedName] = val;
7009 }
7010 }
7011};
7012
7013var vendorNames = ['Webkit', 'Moz', 'ms'];
7014
7015var emptyStyle;
7016var normalize = cached(function (prop) {
7017 emptyStyle = emptyStyle || document.createElement('div').style;
7018 prop = camelize(prop);
7019 if (prop !== 'filter' && (prop in emptyStyle)) {
7020 return prop
7021 }
7022 var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
7023 for (var i = 0; i < vendorNames.length; i++) {
7024 var name = vendorNames[i] + capName;
7025 if (name in emptyStyle) {
7026 return name
7027 }
7028 }
7029});
7030
7031function updateStyle (oldVnode, vnode) {
7032 var data = vnode.data;
7033 var oldData = oldVnode.data;
7034
7035 if (isUndef(data.staticStyle) && isUndef(data.style) &&
7036 isUndef(oldData.staticStyle) && isUndef(oldData.style)
7037 ) {
7038 return
7039 }
7040
7041 var cur, name;
7042 var el = vnode.elm;
7043 var oldStaticStyle = oldData.staticStyle;
7044 var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
7045
7046 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
7047 var oldStyle = oldStaticStyle || oldStyleBinding;
7048
7049 var style = normalizeStyleBinding(vnode.data.style) || {};
7050
7051 // store normalized style under a different key for next diff
7052 // make sure to clone it if it's reactive, since the user likely wants
7053 // to mutate it.
7054 vnode.data.normalizedStyle = isDef(style.__ob__)
7055 ? extend({}, style)
7056 : style;
7057
7058 var newStyle = getStyle(vnode, true);
7059
7060 for (name in oldStyle) {
7061 if (isUndef(newStyle[name])) {
7062 setProp(el, name, '');
7063 }
7064 }
7065 for (name in newStyle) {
7066 cur = newStyle[name];
7067 if (cur !== oldStyle[name]) {
7068 // ie9 setting to null has no effect, must use empty string
7069 setProp(el, name, cur == null ? '' : cur);
7070 }
7071 }
7072}
7073
7074var style = {
7075 create: updateStyle,
7076 update: updateStyle
7077};
7078
7079/* */
7080
7081var whitespaceRE = /\s+/;
7082
7083/**
7084 * Add class with compatibility for SVG since classList is not supported on
7085 * SVG elements in IE
7086 */
7087function addClass (el, cls) {
7088 /* istanbul ignore if */
7089 if (!cls || !(cls = cls.trim())) {
7090 return
7091 }
7092
7093 /* istanbul ignore else */
7094 if (el.classList) {
7095 if (cls.indexOf(' ') > -1) {
7096 cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
7097 } else {
7098 el.classList.add(cls);
7099 }
7100 } else {
7101 var cur = " " + (el.getAttribute('class') || '') + " ";
7102 if (cur.indexOf(' ' + cls + ' ') < 0) {
7103 el.setAttribute('class', (cur + cls).trim());
7104 }
7105 }
7106}
7107
7108/**
7109 * Remove class with compatibility for SVG since classList is not supported on
7110 * SVG elements in IE
7111 */
7112function removeClass (el, cls) {
7113 /* istanbul ignore if */
7114 if (!cls || !(cls = cls.trim())) {
7115 return
7116 }
7117
7118 /* istanbul ignore else */
7119 if (el.classList) {
7120 if (cls.indexOf(' ') > -1) {
7121 cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
7122 } else {
7123 el.classList.remove(cls);
7124 }
7125 if (!el.classList.length) {
7126 el.removeAttribute('class');
7127 }
7128 } else {
7129 var cur = " " + (el.getAttribute('class') || '') + " ";
7130 var tar = ' ' + cls + ' ';
7131 while (cur.indexOf(tar) >= 0) {
7132 cur = cur.replace(tar, ' ');
7133 }
7134 cur = cur.trim();
7135 if (cur) {
7136 el.setAttribute('class', cur);
7137 } else {
7138 el.removeAttribute('class');
7139 }
7140 }
7141}
7142
7143/* */
7144
7145function resolveTransition (def$$1) {
7146 if (!def$$1) {
7147 return
7148 }
7149 /* istanbul ignore else */
7150 if (typeof def$$1 === 'object') {
7151 var res = {};
7152 if (def$$1.css !== false) {
7153 extend(res, autoCssTransition(def$$1.name || 'v'));
7154 }
7155 extend(res, def$$1);
7156 return res
7157 } else if (typeof def$$1 === 'string') {
7158 return autoCssTransition(def$$1)
7159 }
7160}
7161
7162var autoCssTransition = cached(function (name) {
7163 return {
7164 enterClass: (name + "-enter"),
7165 enterToClass: (name + "-enter-to"),
7166 enterActiveClass: (name + "-enter-active"),
7167 leaveClass: (name + "-leave"),
7168 leaveToClass: (name + "-leave-to"),
7169 leaveActiveClass: (name + "-leave-active")
7170 }
7171});
7172
7173var hasTransition = inBrowser && !isIE9;
7174var TRANSITION = 'transition';
7175var ANIMATION = 'animation';
7176
7177// Transition property/event sniffing
7178var transitionProp = 'transition';
7179var transitionEndEvent = 'transitionend';
7180var animationProp = 'animation';
7181var animationEndEvent = 'animationend';
7182if (hasTransition) {
7183 /* istanbul ignore if */
7184 if (window.ontransitionend === undefined &&
7185 window.onwebkittransitionend !== undefined
7186 ) {
7187 transitionProp = 'WebkitTransition';
7188 transitionEndEvent = 'webkitTransitionEnd';
7189 }
7190 if (window.onanimationend === undefined &&
7191 window.onwebkitanimationend !== undefined
7192 ) {
7193 animationProp = 'WebkitAnimation';
7194 animationEndEvent = 'webkitAnimationEnd';
7195 }
7196}
7197
7198// binding to window is necessary to make hot reload work in IE in strict mode
7199var raf = inBrowser
7200 ? window.requestAnimationFrame
7201 ? window.requestAnimationFrame.bind(window)
7202 : setTimeout
7203 : /* istanbul ignore next */ function (fn) { return fn(); };
7204
7205function nextFrame (fn) {
7206 raf(function () {
7207 raf(fn);
7208 });
7209}
7210
7211function addTransitionClass (el, cls) {
7212 var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
7213 if (transitionClasses.indexOf(cls) < 0) {
7214 transitionClasses.push(cls);
7215 addClass(el, cls);
7216 }
7217}
7218
7219function removeTransitionClass (el, cls) {
7220 if (el._transitionClasses) {
7221 remove(el._transitionClasses, cls);
7222 }
7223 removeClass(el, cls);
7224}
7225
7226function whenTransitionEnds (
7227 el,
7228 expectedType,
7229 cb
7230) {
7231 var ref = getTransitionInfo(el, expectedType);
7232 var type = ref.type;
7233 var timeout = ref.timeout;
7234 var propCount = ref.propCount;
7235 if (!type) { return cb() }
7236 var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
7237 var ended = 0;
7238 var end = function () {
7239 el.removeEventListener(event, onEnd);
7240 cb();
7241 };
7242 var onEnd = function (e) {
7243 if (e.target === el) {
7244 if (++ended >= propCount) {
7245 end();
7246 }
7247 }
7248 };
7249 setTimeout(function () {
7250 if (ended < propCount) {
7251 end();
7252 }
7253 }, timeout + 1);
7254 el.addEventListener(event, onEnd);
7255}
7256
7257var transformRE = /\b(transform|all)(,|$)/;
7258
7259function getTransitionInfo (el, expectedType) {
7260 var styles = window.getComputedStyle(el);
7261 // JSDOM may return undefined for transition properties
7262 var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
7263 var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
7264 var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
7265 var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
7266 var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
7267 var animationTimeout = getTimeout(animationDelays, animationDurations);
7268
7269 var type;
7270 var timeout = 0;
7271 var propCount = 0;
7272 /* istanbul ignore if */
7273 if (expectedType === TRANSITION) {
7274 if (transitionTimeout > 0) {
7275 type = TRANSITION;
7276 timeout = transitionTimeout;
7277 propCount = transitionDurations.length;
7278 }
7279 } else if (expectedType === ANIMATION) {
7280 if (animationTimeout > 0) {
7281 type = ANIMATION;
7282 timeout = animationTimeout;
7283 propCount = animationDurations.length;
7284 }
7285 } else {
7286 timeout = Math.max(transitionTimeout, animationTimeout);
7287 type = timeout > 0
7288 ? transitionTimeout > animationTimeout
7289 ? TRANSITION
7290 : ANIMATION
7291 : null;
7292 propCount = type
7293 ? type === TRANSITION
7294 ? transitionDurations.length
7295 : animationDurations.length
7296 : 0;
7297 }
7298 var hasTransform =
7299 type === TRANSITION &&
7300 transformRE.test(styles[transitionProp + 'Property']);
7301 return {
7302 type: type,
7303 timeout: timeout,
7304 propCount: propCount,
7305 hasTransform: hasTransform
7306 }
7307}
7308
7309function getTimeout (delays, durations) {
7310 /* istanbul ignore next */
7311 while (delays.length < durations.length) {
7312 delays = delays.concat(delays);
7313 }
7314
7315 return Math.max.apply(null, durations.map(function (d, i) {
7316 return toMs(d) + toMs(delays[i])
7317 }))
7318}
7319
7320// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
7321// in a locale-dependent way, using a comma instead of a dot.
7322// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
7323// as a floor function) causing unexpected behaviors
7324function toMs (s) {
7325 return Number(s.slice(0, -1).replace(',', '.')) * 1000
7326}
7327
7328/* */
7329
7330function enter (vnode, toggleDisplay) {
7331 var el = vnode.elm;
7332
7333 // call leave callback now
7334 if (isDef(el._leaveCb)) {
7335 el._leaveCb.cancelled = true;
7336 el._leaveCb();
7337 }
7338
7339 var data = resolveTransition(vnode.data.transition);
7340 if (isUndef(data)) {
7341 return
7342 }
7343
7344 /* istanbul ignore if */
7345 if (isDef(el._enterCb) || el.nodeType !== 1) {
7346 return
7347 }
7348
7349 var css = data.css;
7350 var type = data.type;
7351 var enterClass = data.enterClass;
7352 var enterToClass = data.enterToClass;
7353 var enterActiveClass = data.enterActiveClass;
7354 var appearClass = data.appearClass;
7355 var appearToClass = data.appearToClass;
7356 var appearActiveClass = data.appearActiveClass;
7357 var beforeEnter = data.beforeEnter;
7358 var enter = data.enter;
7359 var afterEnter = data.afterEnter;
7360 var enterCancelled = data.enterCancelled;
7361 var beforeAppear = data.beforeAppear;
7362 var appear = data.appear;
7363 var afterAppear = data.afterAppear;
7364 var appearCancelled = data.appearCancelled;
7365 var duration = data.duration;
7366
7367 // activeInstance will always be the <transition> component managing this
7368 // transition. One edge case to check is when the <transition> is placed
7369 // as the root node of a child component. In that case we need to check
7370 // <transition>'s parent for appear check.
7371 var context = activeInstance;
7372 var transitionNode = activeInstance.$vnode;
7373 while (transitionNode && transitionNode.parent) {
7374 transitionNode = transitionNode.parent;
7375 context = transitionNode.context;
7376 }
7377
7378 var isAppear = !context._isMounted || !vnode.isRootInsert;
7379
7380 if (isAppear && !appear && appear !== '') {
7381 return
7382 }
7383
7384 var startClass = isAppear && appearClass
7385 ? appearClass
7386 : enterClass;
7387 var activeClass = isAppear && appearActiveClass
7388 ? appearActiveClass
7389 : enterActiveClass;
7390 var toClass = isAppear && appearToClass
7391 ? appearToClass
7392 : enterToClass;
7393
7394 var beforeEnterHook = isAppear
7395 ? (beforeAppear || beforeEnter)
7396 : beforeEnter;
7397 var enterHook = isAppear
7398 ? (typeof appear === 'function' ? appear : enter)
7399 : enter;
7400 var afterEnterHook = isAppear
7401 ? (afterAppear || afterEnter)
7402 : afterEnter;
7403 var enterCancelledHook = isAppear
7404 ? (appearCancelled || enterCancelled)
7405 : enterCancelled;
7406
7407 var explicitEnterDuration = toNumber(
7408 isObject(duration)
7409 ? duration.enter
7410 : duration
7411 );
7412
7413 if (explicitEnterDuration != null) {
7414 checkDuration(explicitEnterDuration, 'enter', vnode);
7415 }
7416
7417 var expectsCSS = css !== false && !isIE9;
7418 var userWantsControl = getHookArgumentsLength(enterHook);
7419
7420 var cb = el._enterCb = once(function () {
7421 if (expectsCSS) {
7422 removeTransitionClass(el, toClass);
7423 removeTransitionClass(el, activeClass);
7424 }
7425 if (cb.cancelled) {
7426 if (expectsCSS) {
7427 removeTransitionClass(el, startClass);
7428 }
7429 enterCancelledHook && enterCancelledHook(el);
7430 } else {
7431 afterEnterHook && afterEnterHook(el);
7432 }
7433 el._enterCb = null;
7434 });
7435
7436 if (!vnode.data.show) {
7437 // remove pending leave element on enter by injecting an insert hook
7438 mergeVNodeHook(vnode, 'insert', function () {
7439 var parent = el.parentNode;
7440 var pendingNode = parent && parent._pending && parent._pending[vnode.key];
7441 if (pendingNode &&
7442 pendingNode.tag === vnode.tag &&
7443 pendingNode.elm._leaveCb
7444 ) {
7445 pendingNode.elm._leaveCb();
7446 }
7447 enterHook && enterHook(el, cb);
7448 });
7449 }
7450
7451 // start enter transition
7452 beforeEnterHook && beforeEnterHook(el);
7453 if (expectsCSS) {
7454 addTransitionClass(el, startClass);
7455 addTransitionClass(el, activeClass);
7456 nextFrame(function () {
7457 removeTransitionClass(el, startClass);
7458 if (!cb.cancelled) {
7459 addTransitionClass(el, toClass);
7460 if (!userWantsControl) {
7461 if (isValidDuration(explicitEnterDuration)) {
7462 setTimeout(cb, explicitEnterDuration);
7463 } else {
7464 whenTransitionEnds(el, type, cb);
7465 }
7466 }
7467 }
7468 });
7469 }
7470
7471 if (vnode.data.show) {
7472 toggleDisplay && toggleDisplay();
7473 enterHook && enterHook(el, cb);
7474 }
7475
7476 if (!expectsCSS && !userWantsControl) {
7477 cb();
7478 }
7479}
7480
7481function leave (vnode, rm) {
7482 var el = vnode.elm;
7483
7484 // call enter callback now
7485 if (isDef(el._enterCb)) {
7486 el._enterCb.cancelled = true;
7487 el._enterCb();
7488 }
7489
7490 var data = resolveTransition(vnode.data.transition);
7491 if (isUndef(data) || el.nodeType !== 1) {
7492 return rm()
7493 }
7494
7495 /* istanbul ignore if */
7496 if (isDef(el._leaveCb)) {
7497 return
7498 }
7499
7500 var css = data.css;
7501 var type = data.type;
7502 var leaveClass = data.leaveClass;
7503 var leaveToClass = data.leaveToClass;
7504 var leaveActiveClass = data.leaveActiveClass;
7505 var beforeLeave = data.beforeLeave;
7506 var leave = data.leave;
7507 var afterLeave = data.afterLeave;
7508 var leaveCancelled = data.leaveCancelled;
7509 var delayLeave = data.delayLeave;
7510 var duration = data.duration;
7511
7512 var expectsCSS = css !== false && !isIE9;
7513 var userWantsControl = getHookArgumentsLength(leave);
7514
7515 var explicitLeaveDuration = toNumber(
7516 isObject(duration)
7517 ? duration.leave
7518 : duration
7519 );
7520
7521 if (isDef(explicitLeaveDuration)) {
7522 checkDuration(explicitLeaveDuration, 'leave', vnode);
7523 }
7524
7525 var cb = el._leaveCb = once(function () {
7526 if (el.parentNode && el.parentNode._pending) {
7527 el.parentNode._pending[vnode.key] = null;
7528 }
7529 if (expectsCSS) {
7530 removeTransitionClass(el, leaveToClass);
7531 removeTransitionClass(el, leaveActiveClass);
7532 }
7533 if (cb.cancelled) {
7534 if (expectsCSS) {
7535 removeTransitionClass(el, leaveClass);
7536 }
7537 leaveCancelled && leaveCancelled(el);
7538 } else {
7539 rm();
7540 afterLeave && afterLeave(el);
7541 }
7542 el._leaveCb = null;
7543 });
7544
7545 if (delayLeave) {
7546 delayLeave(performLeave);
7547 } else {
7548 performLeave();
7549 }
7550
7551 function performLeave () {
7552 // the delayed leave may have already been cancelled
7553 if (cb.cancelled) {
7554 return
7555 }
7556 // record leaving element
7557 if (!vnode.data.show && el.parentNode) {
7558 (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
7559 }
7560 beforeLeave && beforeLeave(el);
7561 if (expectsCSS) {
7562 addTransitionClass(el, leaveClass);
7563 addTransitionClass(el, leaveActiveClass);
7564 nextFrame(function () {
7565 removeTransitionClass(el, leaveClass);
7566 if (!cb.cancelled) {
7567 addTransitionClass(el, leaveToClass);
7568 if (!userWantsControl) {
7569 if (isValidDuration(explicitLeaveDuration)) {
7570 setTimeout(cb, explicitLeaveDuration);
7571 } else {
7572 whenTransitionEnds(el, type, cb);
7573 }
7574 }
7575 }
7576 });
7577 }
7578 leave && leave(el, cb);
7579 if (!expectsCSS && !userWantsControl) {
7580 cb();
7581 }
7582 }
7583}
7584
7585// only used in dev mode
7586function checkDuration (val, name, vnode) {
7587 if (typeof val !== 'number') {
7588 warn(
7589 "<transition> explicit " + name + " duration is not a valid number - " +
7590 "got " + (JSON.stringify(val)) + ".",
7591 vnode.context
7592 );
7593 } else if (isNaN(val)) {
7594 warn(
7595 "<transition> explicit " + name + " duration is NaN - " +
7596 'the duration expression might be incorrect.',
7597 vnode.context
7598 );
7599 }
7600}
7601
7602function isValidDuration (val) {
7603 return typeof val === 'number' && !isNaN(val)
7604}
7605
7606/**
7607 * Normalize a transition hook's argument length. The hook may be:
7608 * - a merged hook (invoker) with the original in .fns
7609 * - a wrapped component method (check ._length)
7610 * - a plain function (.length)
7611 */
7612function getHookArgumentsLength (fn) {
7613 if (isUndef(fn)) {
7614 return false
7615 }
7616 var invokerFns = fn.fns;
7617 if (isDef(invokerFns)) {
7618 // invoker
7619 return getHookArgumentsLength(
7620 Array.isArray(invokerFns)
7621 ? invokerFns[0]
7622 : invokerFns
7623 )
7624 } else {
7625 return (fn._length || fn.length) > 1
7626 }
7627}
7628
7629function _enter (_, vnode) {
7630 if (vnode.data.show !== true) {
7631 enter(vnode);
7632 }
7633}
7634
7635var transition = inBrowser ? {
7636 create: _enter,
7637 activate: _enter,
7638 remove: function remove$$1 (vnode, rm) {
7639 /* istanbul ignore else */
7640 if (vnode.data.show !== true) {
7641 leave(vnode, rm);
7642 } else {
7643 rm();
7644 }
7645 }
7646} : {};
7647
7648var platformModules = [
7649 attrs,
7650 klass,
7651 events,
7652 domProps,
7653 style,
7654 transition
7655];
7656
7657/* */
7658
7659// the directive module should be applied last, after all
7660// built-in modules have been applied.
7661var modules = platformModules.concat(baseModules);
7662
7663var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
7664
7665/**
7666 * Not type checking this file because flow doesn't like attaching
7667 * properties to Elements.
7668 */
7669
7670/* istanbul ignore if */
7671if (isIE9) {
7672 // http://www.matts411.com/post/internet-explorer-9-oninput/
7673 document.addEventListener('selectionchange', function () {
7674 var el = document.activeElement;
7675 if (el && el.vmodel) {
7676 trigger(el, 'input');
7677 }
7678 });
7679}
7680
7681var directive = {
7682 inserted: function inserted (el, binding, vnode, oldVnode) {
7683 if (vnode.tag === 'select') {
7684 // #6903
7685 if (oldVnode.elm && !oldVnode.elm._vOptions) {
7686 mergeVNodeHook(vnode, 'postpatch', function () {
7687 directive.componentUpdated(el, binding, vnode);
7688 });
7689 } else {
7690 setSelected(el, binding, vnode.context);
7691 }
7692 el._vOptions = [].map.call(el.options, getValue);
7693 } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
7694 el._vModifiers = binding.modifiers;
7695 if (!binding.modifiers.lazy) {
7696 el.addEventListener('compositionstart', onCompositionStart);
7697 el.addEventListener('compositionend', onCompositionEnd);
7698 // Safari < 10.2 & UIWebView doesn't fire compositionend when
7699 // switching focus before confirming composition choice
7700 // this also fixes the issue where some browsers e.g. iOS Chrome
7701 // fires "change" instead of "input" on autocomplete.
7702 el.addEventListener('change', onCompositionEnd);
7703 /* istanbul ignore if */
7704 if (isIE9) {
7705 el.vmodel = true;
7706 }
7707 }
7708 }
7709 },
7710
7711 componentUpdated: function componentUpdated (el, binding, vnode) {
7712 if (vnode.tag === 'select') {
7713 setSelected(el, binding, vnode.context);
7714 // in case the options rendered by v-for have changed,
7715 // it's possible that the value is out-of-sync with the rendered options.
7716 // detect such cases and filter out values that no longer has a matching
7717 // option in the DOM.
7718 var prevOptions = el._vOptions;
7719 var curOptions = el._vOptions = [].map.call(el.options, getValue);
7720 if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
7721 // trigger change event if
7722 // no matching option found for at least one value
7723 var needReset = el.multiple
7724 ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
7725 : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
7726 if (needReset) {
7727 trigger(el, 'change');
7728 }
7729 }
7730 }
7731 }
7732};
7733
7734function setSelected (el, binding, vm) {
7735 actuallySetSelected(el, binding, vm);
7736 /* istanbul ignore if */
7737 if (isIE || isEdge) {
7738 setTimeout(function () {
7739 actuallySetSelected(el, binding, vm);
7740 }, 0);
7741 }
7742}
7743
7744function actuallySetSelected (el, binding, vm) {
7745 var value = binding.value;
7746 var isMultiple = el.multiple;
7747 if (isMultiple && !Array.isArray(value)) {
7748 warn(
7749 "<select multiple v-model=\"" + (binding.expression) + "\"> " +
7750 "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
7751 vm
7752 );
7753 return
7754 }
7755 var selected, option;
7756 for (var i = 0, l = el.options.length; i < l; i++) {
7757 option = el.options[i];
7758 if (isMultiple) {
7759 selected = looseIndexOf(value, getValue(option)) > -1;
7760 if (option.selected !== selected) {
7761 option.selected = selected;
7762 }
7763 } else {
7764 if (looseEqual(getValue(option), value)) {
7765 if (el.selectedIndex !== i) {
7766 el.selectedIndex = i;
7767 }
7768 return
7769 }
7770 }
7771 }
7772 if (!isMultiple) {
7773 el.selectedIndex = -1;
7774 }
7775}
7776
7777function hasNoMatchingOption (value, options) {
7778 return options.every(function (o) { return !looseEqual(o, value); })
7779}
7780
7781function getValue (option) {
7782 return '_value' in option
7783 ? option._value
7784 : option.value
7785}
7786
7787function onCompositionStart (e) {
7788 e.target.composing = true;
7789}
7790
7791function onCompositionEnd (e) {
7792 // prevent triggering an input event for no reason
7793 if (!e.target.composing) { return }
7794 e.target.composing = false;
7795 trigger(e.target, 'input');
7796}
7797
7798function trigger (el, type) {
7799 var e = document.createEvent('HTMLEvents');
7800 e.initEvent(type, true, true);
7801 el.dispatchEvent(e);
7802}
7803
7804/* */
7805
7806// recursively search for possible transition defined inside the component root
7807function locateNode (vnode) {
7808 return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
7809 ? locateNode(vnode.componentInstance._vnode)
7810 : vnode
7811}
7812
7813var show = {
7814 bind: function bind (el, ref, vnode) {
7815 var value = ref.value;
7816
7817 vnode = locateNode(vnode);
7818 var transition$$1 = vnode.data && vnode.data.transition;
7819 var originalDisplay = el.__vOriginalDisplay =
7820 el.style.display === 'none' ? '' : el.style.display;
7821 if (value && transition$$1) {
7822 vnode.data.show = true;
7823 enter(vnode, function () {
7824 el.style.display = originalDisplay;
7825 });
7826 } else {
7827 el.style.display = value ? originalDisplay : 'none';
7828 }
7829 },
7830
7831 update: function update (el, ref, vnode) {
7832 var value = ref.value;
7833 var oldValue = ref.oldValue;
7834
7835 /* istanbul ignore if */
7836 if (!value === !oldValue) { return }
7837 vnode = locateNode(vnode);
7838 var transition$$1 = vnode.data && vnode.data.transition;
7839 if (transition$$1) {
7840 vnode.data.show = true;
7841 if (value) {
7842 enter(vnode, function () {
7843 el.style.display = el.__vOriginalDisplay;
7844 });
7845 } else {
7846 leave(vnode, function () {
7847 el.style.display = 'none';
7848 });
7849 }
7850 } else {
7851 el.style.display = value ? el.__vOriginalDisplay : 'none';
7852 }
7853 },
7854
7855 unbind: function unbind (
7856 el,
7857 binding,
7858 vnode,
7859 oldVnode,
7860 isDestroy
7861 ) {
7862 if (!isDestroy) {
7863 el.style.display = el.__vOriginalDisplay;
7864 }
7865 }
7866};
7867
7868var platformDirectives = {
7869 model: directive,
7870 show: show
7871};
7872
7873/* */
7874
7875var transitionProps = {
7876 name: String,
7877 appear: Boolean,
7878 css: Boolean,
7879 mode: String,
7880 type: String,
7881 enterClass: String,
7882 leaveClass: String,
7883 enterToClass: String,
7884 leaveToClass: String,
7885 enterActiveClass: String,
7886 leaveActiveClass: String,
7887 appearClass: String,
7888 appearActiveClass: String,
7889 appearToClass: String,
7890 duration: [Number, String, Object]
7891};
7892
7893// in case the child is also an abstract component, e.g. <keep-alive>
7894// we want to recursively retrieve the real component to be rendered
7895function getRealChild (vnode) {
7896 var compOptions = vnode && vnode.componentOptions;
7897 if (compOptions && compOptions.Ctor.options.abstract) {
7898 return getRealChild(getFirstComponentChild(compOptions.children))
7899 } else {
7900 return vnode
7901 }
7902}
7903
7904function extractTransitionData (comp) {
7905 var data = {};
7906 var options = comp.$options;
7907 // props
7908 for (var key in options.propsData) {
7909 data[key] = comp[key];
7910 }
7911 // events.
7912 // extract listeners and pass them directly to the transition methods
7913 var listeners = options._parentListeners;
7914 for (var key$1 in listeners) {
7915 data[camelize(key$1)] = listeners[key$1];
7916 }
7917 return data
7918}
7919
7920function placeholder (h, rawChild) {
7921 if (/\d-keep-alive$/.test(rawChild.tag)) {
7922 return h('keep-alive', {
7923 props: rawChild.componentOptions.propsData
7924 })
7925 }
7926}
7927
7928function hasParentTransition (vnode) {
7929 while ((vnode = vnode.parent)) {
7930 if (vnode.data.transition) {
7931 return true
7932 }
7933 }
7934}
7935
7936function isSameChild (child, oldChild) {
7937 return oldChild.key === child.key && oldChild.tag === child.tag
7938}
7939
7940var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
7941
7942var isVShowDirective = function (d) { return d.name === 'show'; };
7943
7944var Transition = {
7945 name: 'transition',
7946 props: transitionProps,
7947 abstract: true,
7948
7949 render: function render (h) {
7950 var this$1 = this;
7951
7952 var children = this.$slots.default;
7953 if (!children) {
7954 return
7955 }
7956
7957 // filter out text nodes (possible whitespaces)
7958 children = children.filter(isNotTextNode);
7959 /* istanbul ignore if */
7960 if (!children.length) {
7961 return
7962 }
7963
7964 // warn multiple elements
7965 if (children.length > 1) {
7966 warn(
7967 '<transition> can only be used on a single element. Use ' +
7968 '<transition-group> for lists.',
7969 this.$parent
7970 );
7971 }
7972
7973 var mode = this.mode;
7974
7975 // warn invalid mode
7976 if (mode && mode !== 'in-out' && mode !== 'out-in'
7977 ) {
7978 warn(
7979 'invalid <transition> mode: ' + mode,
7980 this.$parent
7981 );
7982 }
7983
7984 var rawChild = children[0];
7985
7986 // if this is a component root node and the component's
7987 // parent container node also has transition, skip.
7988 if (hasParentTransition(this.$vnode)) {
7989 return rawChild
7990 }
7991
7992 // apply transition data to child
7993 // use getRealChild() to ignore abstract components e.g. keep-alive
7994 var child = getRealChild(rawChild);
7995 /* istanbul ignore if */
7996 if (!child) {
7997 return rawChild
7998 }
7999
8000 if (this._leaving) {
8001 return placeholder(h, rawChild)
8002 }
8003
8004 // ensure a key that is unique to the vnode type and to this transition
8005 // component instance. This key will be used to remove pending leaving nodes
8006 // during entering.
8007 var id = "__transition-" + (this._uid) + "-";
8008 child.key = child.key == null
8009 ? child.isComment
8010 ? id + 'comment'
8011 : id + child.tag
8012 : isPrimitive(child.key)
8013 ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
8014 : child.key;
8015
8016 var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
8017 var oldRawChild = this._vnode;
8018 var oldChild = getRealChild(oldRawChild);
8019
8020 // mark v-show
8021 // so that the transition module can hand over the control to the directive
8022 if (child.data.directives && child.data.directives.some(isVShowDirective)) {
8023 child.data.show = true;
8024 }
8025
8026 if (
8027 oldChild &&
8028 oldChild.data &&
8029 !isSameChild(child, oldChild) &&
8030 !isAsyncPlaceholder(oldChild) &&
8031 // #6687 component root is a comment node
8032 !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
8033 ) {
8034 // replace old child transition data with fresh one
8035 // important for dynamic transitions!
8036 var oldData = oldChild.data.transition = extend({}, data);
8037 // handle transition mode
8038 if (mode === 'out-in') {
8039 // return placeholder node and queue update when leave finishes
8040 this._leaving = true;
8041 mergeVNodeHook(oldData, 'afterLeave', function () {
8042 this$1._leaving = false;
8043 this$1.$forceUpdate();
8044 });
8045 return placeholder(h, rawChild)
8046 } else if (mode === 'in-out') {
8047 if (isAsyncPlaceholder(child)) {
8048 return oldRawChild
8049 }
8050 var delayedLeave;
8051 var performLeave = function () { delayedLeave(); };
8052 mergeVNodeHook(data, 'afterEnter', performLeave);
8053 mergeVNodeHook(data, 'enterCancelled', performLeave);
8054 mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
8055 }
8056 }
8057
8058 return rawChild
8059 }
8060};
8061
8062/* */
8063
8064var props = extend({
8065 tag: String,
8066 moveClass: String
8067}, transitionProps);
8068
8069delete props.mode;
8070
8071var TransitionGroup = {
8072 props: props,
8073
8074 beforeMount: function beforeMount () {
8075 var this$1 = this;
8076
8077 var update = this._update;
8078 this._update = function (vnode, hydrating) {
8079 var restoreActiveInstance = setActiveInstance(this$1);
8080 // force removing pass
8081 this$1.__patch__(
8082 this$1._vnode,
8083 this$1.kept,
8084 false, // hydrating
8085 true // removeOnly (!important, avoids unnecessary moves)
8086 );
8087 this$1._vnode = this$1.kept;
8088 restoreActiveInstance();
8089 update.call(this$1, vnode, hydrating);
8090 };
8091 },
8092
8093 render: function render (h) {
8094 var tag = this.tag || this.$vnode.data.tag || 'span';
8095 var map = Object.create(null);
8096 var prevChildren = this.prevChildren = this.children;
8097 var rawChildren = this.$slots.default || [];
8098 var children = this.children = [];
8099 var transitionData = extractTransitionData(this);
8100
8101 for (var i = 0; i < rawChildren.length; i++) {
8102 var c = rawChildren[i];
8103 if (c.tag) {
8104 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
8105 children.push(c);
8106 map[c.key] = c
8107 ;(c.data || (c.data = {})).transition = transitionData;
8108 } else {
8109 var opts = c.componentOptions;
8110 var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
8111 warn(("<transition-group> children must be keyed: <" + name + ">"));
8112 }
8113 }
8114 }
8115
8116 if (prevChildren) {
8117 var kept = [];
8118 var removed = [];
8119 for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
8120 var c$1 = prevChildren[i$1];
8121 c$1.data.transition = transitionData;
8122 c$1.data.pos = c$1.elm.getBoundingClientRect();
8123 if (map[c$1.key]) {
8124 kept.push(c$1);
8125 } else {
8126 removed.push(c$1);
8127 }
8128 }
8129 this.kept = h(tag, null, kept);
8130 this.removed = removed;
8131 }
8132
8133 return h(tag, null, children)
8134 },
8135
8136 updated: function updated () {
8137 var children = this.prevChildren;
8138 var moveClass = this.moveClass || ((this.name || 'v') + '-move');
8139 if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
8140 return
8141 }
8142
8143 // we divide the work into three loops to avoid mixing DOM reads and writes
8144 // in each iteration - which helps prevent layout thrashing.
8145 children.forEach(callPendingCbs);
8146 children.forEach(recordPosition);
8147 children.forEach(applyTranslation);
8148
8149 // force reflow to put everything in position
8150 // assign to this to avoid being removed in tree-shaking
8151 // $flow-disable-line
8152 this._reflow = document.body.offsetHeight;
8153
8154 children.forEach(function (c) {
8155 if (c.data.moved) {
8156 var el = c.elm;
8157 var s = el.style;
8158 addTransitionClass(el, moveClass);
8159 s.transform = s.WebkitTransform = s.transitionDuration = '';
8160 el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
8161 if (e && e.target !== el) {
8162 return
8163 }
8164 if (!e || /transform$/.test(e.propertyName)) {
8165 el.removeEventListener(transitionEndEvent, cb);
8166 el._moveCb = null;
8167 removeTransitionClass(el, moveClass);
8168 }
8169 });
8170 }
8171 });
8172 },
8173
8174 methods: {
8175 hasMove: function hasMove (el, moveClass) {
8176 /* istanbul ignore if */
8177 if (!hasTransition) {
8178 return false
8179 }
8180 /* istanbul ignore if */
8181 if (this._hasMove) {
8182 return this._hasMove
8183 }
8184 // Detect whether an element with the move class applied has
8185 // CSS transitions. Since the element may be inside an entering
8186 // transition at this very moment, we make a clone of it and remove
8187 // all other transition classes applied to ensure only the move class
8188 // is applied.
8189 var clone = el.cloneNode();
8190 if (el._transitionClasses) {
8191 el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
8192 }
8193 addClass(clone, moveClass);
8194 clone.style.display = 'none';
8195 this.$el.appendChild(clone);
8196 var info = getTransitionInfo(clone);
8197 this.$el.removeChild(clone);
8198 return (this._hasMove = info.hasTransform)
8199 }
8200 }
8201};
8202
8203function callPendingCbs (c) {
8204 /* istanbul ignore if */
8205 if (c.elm._moveCb) {
8206 c.elm._moveCb();
8207 }
8208 /* istanbul ignore if */
8209 if (c.elm._enterCb) {
8210 c.elm._enterCb();
8211 }
8212}
8213
8214function recordPosition (c) {
8215 c.data.newPos = c.elm.getBoundingClientRect();
8216}
8217
8218function applyTranslation (c) {
8219 var oldPos = c.data.pos;
8220 var newPos = c.data.newPos;
8221 var dx = oldPos.left - newPos.left;
8222 var dy = oldPos.top - newPos.top;
8223 if (dx || dy) {
8224 c.data.moved = true;
8225 var s = c.elm.style;
8226 s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
8227 s.transitionDuration = '0s';
8228 }
8229}
8230
8231var platformComponents = {
8232 Transition: Transition,
8233 TransitionGroup: TransitionGroup
8234};
8235
8236/* */
8237
8238// install platform specific utils
8239Vue.config.mustUseProp = mustUseProp;
8240Vue.config.isReservedTag = isReservedTag;
8241Vue.config.isReservedAttr = isReservedAttr;
8242Vue.config.getTagNamespace = getTagNamespace;
8243Vue.config.isUnknownElement = isUnknownElement;
8244
8245// install platform runtime directives & components
8246extend(Vue.options.directives, platformDirectives);
8247extend(Vue.options.components, platformComponents);
8248
8249// install platform patch function
8250Vue.prototype.__patch__ = inBrowser ? patch : noop;
8251
8252// public mount method
8253Vue.prototype.$mount = function (
8254 el,
8255 hydrating
8256) {
8257 el = el && inBrowser ? query(el) : undefined;
8258 return mountComponent(this, el, hydrating)
8259};
8260
8261// devtools global hook
8262/* istanbul ignore next */
8263if (inBrowser) {
8264 setTimeout(function () {
8265 if (config.devtools) {
8266 if (devtools) {
8267 devtools.emit('init', Vue);
8268 } else {
8269 console[console.info ? 'info' : 'log'](
8270 'Download the Vue Devtools extension for a better development experience:\n' +
8271 'https://github.com/vuejs/vue-devtools'
8272 );
8273 }
8274 }
8275 if (config.productionTip !== false &&
8276 typeof console !== 'undefined'
8277 ) {
8278 console[console.info ? 'info' : 'log'](
8279 "You are running Vue in development mode.\n" +
8280 "Make sure to turn on production mode when deploying for production.\n" +
8281 "See more tips at https://vuejs.org/guide/deployment.html"
8282 );
8283 }
8284 }, 0);
8285}
8286
8287/* */
8288
8289module.exports = Vue;