UNPKG

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