UNPKG

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