UNPKG

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