UNPKG

227 kBJavaScriptView Raw
1/*!
2 * Vue.js v2.6.10
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 unicodeRegExp = /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(("[^" + (unicodeRegExp.source) + ".$_\\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_" + (unicodeRegExp.source) + "]*$")).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 // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
1820 // See: https://github.com/vuejs/vuex/issues/1505
1821 pushTarget();
1822 try {
1823 if (vm) {
1824 var cur = vm;
1825 while ((cur = cur.$parent)) {
1826 var hooks = cur.$options.errorCaptured;
1827 if (hooks) {
1828 for (var i = 0; i < hooks.length; i++) {
1829 try {
1830 var capture = hooks[i].call(cur, err, vm, info) === false;
1831 if (capture) { return }
1832 } catch (e) {
1833 globalHandleError(e, cur, 'errorCaptured hook');
1834 }
1835 }
1836 }
1837 }
1838 }
1839 globalHandleError(err, vm, info);
1840 } finally {
1841 popTarget();
1842 }
1843}
1844
1845function invokeWithErrorHandling (
1846 handler,
1847 context,
1848 args,
1849 vm,
1850 info
1851) {
1852 var res;
1853 try {
1854 res = args ? handler.apply(context, args) : handler.call(context);
1855 if (res && !res._isVue && isPromise(res) && !res._handled) {
1856 res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1857 // issue #9511
1858 // avoid catch triggering multiple times when nested calls
1859 res._handled = true;
1860 }
1861 } catch (e) {
1862 handleError(e, vm, info);
1863 }
1864 return res
1865}
1866
1867function globalHandleError (err, vm, info) {
1868 if (config.errorHandler) {
1869 try {
1870 return config.errorHandler.call(null, err, vm, info)
1871 } catch (e) {
1872 // if the user intentionally throws the original error in the handler,
1873 // do not log it twice
1874 if (e !== err) {
1875 logError(e, null, 'config.errorHandler');
1876 }
1877 }
1878 }
1879 logError(err, vm, info);
1880}
1881
1882function logError (err, vm, info) {
1883 if (process.env.NODE_ENV !== 'production') {
1884 warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
1885 }
1886 /* istanbul ignore else */
1887 if ((inBrowser || inWeex) && typeof console !== 'undefined') {
1888 console.error(err);
1889 } else {
1890 throw err
1891 }
1892}
1893
1894/* */
1895
1896var isUsingMicroTask = false;
1897
1898var callbacks = [];
1899var pending = false;
1900
1901function flushCallbacks () {
1902 pending = false;
1903 var copies = callbacks.slice(0);
1904 callbacks.length = 0;
1905 for (var i = 0; i < copies.length; i++) {
1906 copies[i]();
1907 }
1908}
1909
1910// Here we have async deferring wrappers using microtasks.
1911// In 2.5 we used (macro) tasks (in combination with microtasks).
1912// However, it has subtle problems when state is changed right before repaint
1913// (e.g. #6813, out-in transitions).
1914// Also, using (macro) tasks in event handler would cause some weird behaviors
1915// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
1916// So we now use microtasks everywhere, again.
1917// A major drawback of this tradeoff is that there are some scenarios
1918// where microtasks have too high a priority and fire in between supposedly
1919// sequential events (e.g. #4521, #6690, which have workarounds)
1920// or even between bubbling of the same event (#6566).
1921var timerFunc;
1922
1923// The nextTick behavior leverages the microtask queue, which can be accessed
1924// via either native Promise.then or MutationObserver.
1925// MutationObserver has wider support, however it is seriously bugged in
1926// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
1927// completely stops working after triggering a few times... so, if native
1928// Promise is available, we will use it:
1929/* istanbul ignore next, $flow-disable-line */
1930if (typeof Promise !== 'undefined' && isNative(Promise)) {
1931 var p = Promise.resolve();
1932 timerFunc = function () {
1933 p.then(flushCallbacks);
1934 // In problematic UIWebViews, Promise.then doesn't completely break, but
1935 // it can get stuck in a weird state where callbacks are pushed into the
1936 // microtask queue but the queue isn't being flushed, until the browser
1937 // needs to do some other work, e.g. handle a timer. Therefore we can
1938 // "force" the microtask queue to be flushed by adding an empty timer.
1939 if (isIOS) { setTimeout(noop); }
1940 };
1941 isUsingMicroTask = true;
1942} else if (!isIE && typeof MutationObserver !== 'undefined' && (
1943 isNative(MutationObserver) ||
1944 // PhantomJS and iOS 7.x
1945 MutationObserver.toString() === '[object MutationObserverConstructor]'
1946)) {
1947 // Use MutationObserver where native Promise is not available,
1948 // e.g. PhantomJS, iOS7, Android 4.4
1949 // (#6466 MutationObserver is unreliable in IE11)
1950 var counter = 1;
1951 var observer = new MutationObserver(flushCallbacks);
1952 var textNode = document.createTextNode(String(counter));
1953 observer.observe(textNode, {
1954 characterData: true
1955 });
1956 timerFunc = function () {
1957 counter = (counter + 1) % 2;
1958 textNode.data = String(counter);
1959 };
1960 isUsingMicroTask = true;
1961} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
1962 // Fallback to setImmediate.
1963 // Techinically it leverages the (macro) task queue,
1964 // but it is still a better choice than setTimeout.
1965 timerFunc = function () {
1966 setImmediate(flushCallbacks);
1967 };
1968} else {
1969 // Fallback to setTimeout.
1970 timerFunc = function () {
1971 setTimeout(flushCallbacks, 0);
1972 };
1973}
1974
1975function nextTick (cb, ctx) {
1976 var _resolve;
1977 callbacks.push(function () {
1978 if (cb) {
1979 try {
1980 cb.call(ctx);
1981 } catch (e) {
1982 handleError(e, ctx, 'nextTick');
1983 }
1984 } else if (_resolve) {
1985 _resolve(ctx);
1986 }
1987 });
1988 if (!pending) {
1989 pending = true;
1990 timerFunc();
1991 }
1992 // $flow-disable-line
1993 if (!cb && typeof Promise !== 'undefined') {
1994 return new Promise(function (resolve) {
1995 _resolve = resolve;
1996 })
1997 }
1998}
1999
2000/* */
2001
2002/* not type checking this file because flow doesn't play well with Proxy */
2003
2004var initProxy;
2005
2006if (process.env.NODE_ENV !== 'production') {
2007 var allowedGlobals = makeMap(
2008 'Infinity,undefined,NaN,isFinite,isNaN,' +
2009 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
2010 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
2011 'require' // for Webpack/Browserify
2012 );
2013
2014 var warnNonPresent = function (target, key) {
2015 warn(
2016 "Property or method \"" + key + "\" is not defined on the instance but " +
2017 'referenced during render. Make sure that this property is reactive, ' +
2018 'either in the data option, or for class-based components, by ' +
2019 'initializing the property. ' +
2020 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
2021 target
2022 );
2023 };
2024
2025 var warnReservedPrefix = function (target, key) {
2026 warn(
2027 "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
2028 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
2029 'prevent conflicts with Vue internals' +
2030 'See: https://vuejs.org/v2/api/#data',
2031 target
2032 );
2033 };
2034
2035 var hasProxy =
2036 typeof Proxy !== 'undefined' && isNative(Proxy);
2037
2038 if (hasProxy) {
2039 var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
2040 config.keyCodes = new Proxy(config.keyCodes, {
2041 set: function set (target, key, value) {
2042 if (isBuiltInModifier(key)) {
2043 warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
2044 return false
2045 } else {
2046 target[key] = value;
2047 return true
2048 }
2049 }
2050 });
2051 }
2052
2053 var hasHandler = {
2054 has: function has (target, key) {
2055 var has = key in target;
2056 var isAllowed = allowedGlobals(key) ||
2057 (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
2058 if (!has && !isAllowed) {
2059 if (key in target.$data) { warnReservedPrefix(target, key); }
2060 else { warnNonPresent(target, key); }
2061 }
2062 return has || !isAllowed
2063 }
2064 };
2065
2066 var getHandler = {
2067 get: function get (target, key) {
2068 if (typeof key === 'string' && !(key in target)) {
2069 if (key in target.$data) { warnReservedPrefix(target, key); }
2070 else { warnNonPresent(target, key); }
2071 }
2072 return target[key]
2073 }
2074 };
2075
2076 initProxy = function initProxy (vm) {
2077 if (hasProxy) {
2078 // determine which proxy handler to use
2079 var options = vm.$options;
2080 var handlers = options.render && options.render._withStripped
2081 ? getHandler
2082 : hasHandler;
2083 vm._renderProxy = new Proxy(vm, handlers);
2084 } else {
2085 vm._renderProxy = vm;
2086 }
2087 };
2088}
2089
2090/* */
2091
2092var seenObjects = new _Set();
2093
2094/**
2095 * Recursively traverse an object to evoke all converted
2096 * getters, so that every nested property inside the object
2097 * is collected as a "deep" dependency.
2098 */
2099function traverse (val) {
2100 _traverse(val, seenObjects);
2101 seenObjects.clear();
2102}
2103
2104function _traverse (val, seen) {
2105 var i, keys;
2106 var isA = Array.isArray(val);
2107 if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
2108 return
2109 }
2110 if (val.__ob__) {
2111 var depId = val.__ob__.dep.id;
2112 if (seen.has(depId)) {
2113 return
2114 }
2115 seen.add(depId);
2116 }
2117 if (isA) {
2118 i = val.length;
2119 while (i--) { _traverse(val[i], seen); }
2120 } else {
2121 keys = Object.keys(val);
2122 i = keys.length;
2123 while (i--) { _traverse(val[keys[i]], seen); }
2124 }
2125}
2126
2127var mark;
2128var measure;
2129
2130if (process.env.NODE_ENV !== 'production') {
2131 var perf = inBrowser && window.performance;
2132 /* istanbul ignore if */
2133 if (
2134 perf &&
2135 perf.mark &&
2136 perf.measure &&
2137 perf.clearMarks &&
2138 perf.clearMeasures
2139 ) {
2140 mark = function (tag) { return perf.mark(tag); };
2141 measure = function (name, startTag, endTag) {
2142 perf.measure(name, startTag, endTag);
2143 perf.clearMarks(startTag);
2144 perf.clearMarks(endTag);
2145 // perf.clearMeasures(name)
2146 };
2147 }
2148}
2149
2150/* */
2151
2152var normalizeEvent = cached(function (name) {
2153 var passive = name.charAt(0) === '&';
2154 name = passive ? name.slice(1) : name;
2155 var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
2156 name = once$$1 ? name.slice(1) : name;
2157 var capture = name.charAt(0) === '!';
2158 name = capture ? name.slice(1) : name;
2159 return {
2160 name: name,
2161 once: once$$1,
2162 capture: capture,
2163 passive: passive
2164 }
2165});
2166
2167function createFnInvoker (fns, vm) {
2168 function invoker () {
2169 var arguments$1 = arguments;
2170
2171 var fns = invoker.fns;
2172 if (Array.isArray(fns)) {
2173 var cloned = fns.slice();
2174 for (var i = 0; i < cloned.length; i++) {
2175 invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
2176 }
2177 } else {
2178 // return handler return value for single handlers
2179 return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
2180 }
2181 }
2182 invoker.fns = fns;
2183 return invoker
2184}
2185
2186function updateListeners (
2187 on,
2188 oldOn,
2189 add,
2190 remove$$1,
2191 createOnceHandler,
2192 vm
2193) {
2194 var name, def$$1, cur, old, event;
2195 for (name in on) {
2196 def$$1 = cur = on[name];
2197 old = oldOn[name];
2198 event = normalizeEvent(name);
2199 if (isUndef(cur)) {
2200 process.env.NODE_ENV !== 'production' && warn(
2201 "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
2202 vm
2203 );
2204 } else if (isUndef(old)) {
2205 if (isUndef(cur.fns)) {
2206 cur = on[name] = createFnInvoker(cur, vm);
2207 }
2208 if (isTrue(event.once)) {
2209 cur = on[name] = createOnceHandler(event.name, cur, event.capture);
2210 }
2211 add(event.name, cur, event.capture, event.passive, event.params);
2212 } else if (cur !== old) {
2213 old.fns = cur;
2214 on[name] = old;
2215 }
2216 }
2217 for (name in oldOn) {
2218 if (isUndef(on[name])) {
2219 event = normalizeEvent(name);
2220 remove$$1(event.name, oldOn[name], event.capture);
2221 }
2222 }
2223}
2224
2225/* */
2226
2227function mergeVNodeHook (def, hookKey, hook) {
2228 if (def instanceof VNode) {
2229 def = def.data.hook || (def.data.hook = {});
2230 }
2231 var invoker;
2232 var oldHook = def[hookKey];
2233
2234 function wrappedHook () {
2235 hook.apply(this, arguments);
2236 // important: remove merged hook to ensure it's called only once
2237 // and prevent memory leak
2238 remove(invoker.fns, wrappedHook);
2239 }
2240
2241 if (isUndef(oldHook)) {
2242 // no existing hook
2243 invoker = createFnInvoker([wrappedHook]);
2244 } else {
2245 /* istanbul ignore if */
2246 if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
2247 // already a merged invoker
2248 invoker = oldHook;
2249 invoker.fns.push(wrappedHook);
2250 } else {
2251 // existing plain hook
2252 invoker = createFnInvoker([oldHook, wrappedHook]);
2253 }
2254 }
2255
2256 invoker.merged = true;
2257 def[hookKey] = invoker;
2258}
2259
2260/* */
2261
2262function extractPropsFromVNodeData (
2263 data,
2264 Ctor,
2265 tag
2266) {
2267 // we are only extracting raw values here.
2268 // validation and default values are handled in the child
2269 // component itself.
2270 var propOptions = Ctor.options.props;
2271 if (isUndef(propOptions)) {
2272 return
2273 }
2274 var res = {};
2275 var attrs = data.attrs;
2276 var props = data.props;
2277 if (isDef(attrs) || isDef(props)) {
2278 for (var key in propOptions) {
2279 var altKey = hyphenate(key);
2280 if (process.env.NODE_ENV !== 'production') {
2281 var keyInLowerCase = key.toLowerCase();
2282 if (
2283 key !== keyInLowerCase &&
2284 attrs && hasOwn(attrs, keyInLowerCase)
2285 ) {
2286 tip(
2287 "Prop \"" + keyInLowerCase + "\" is passed to component " +
2288 (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
2289 " \"" + key + "\". " +
2290 "Note that HTML attributes are case-insensitive and camelCased " +
2291 "props need to use their kebab-case equivalents when using in-DOM " +
2292 "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
2293 );
2294 }
2295 }
2296 checkProp(res, props, key, altKey, true) ||
2297 checkProp(res, attrs, key, altKey, false);
2298 }
2299 }
2300 return res
2301}
2302
2303function checkProp (
2304 res,
2305 hash,
2306 key,
2307 altKey,
2308 preserve
2309) {
2310 if (isDef(hash)) {
2311 if (hasOwn(hash, key)) {
2312 res[key] = hash[key];
2313 if (!preserve) {
2314 delete hash[key];
2315 }
2316 return true
2317 } else if (hasOwn(hash, altKey)) {
2318 res[key] = hash[altKey];
2319 if (!preserve) {
2320 delete hash[altKey];
2321 }
2322 return true
2323 }
2324 }
2325 return false
2326}
2327
2328/* */
2329
2330// The template compiler attempts to minimize the need for normalization by
2331// statically analyzing the template at compile time.
2332//
2333// For plain HTML markup, normalization can be completely skipped because the
2334// generated render function is guaranteed to return Array<VNode>. There are
2335// two cases where extra normalization is needed:
2336
2337// 1. When the children contains components - because a functional component
2338// may return an Array instead of a single root. In this case, just a simple
2339// normalization is needed - if any child is an Array, we flatten the whole
2340// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
2341// because functional components already normalize their own children.
2342function simpleNormalizeChildren (children) {
2343 for (var i = 0; i < children.length; i++) {
2344 if (Array.isArray(children[i])) {
2345 return Array.prototype.concat.apply([], children)
2346 }
2347 }
2348 return children
2349}
2350
2351// 2. When the children contains constructs that always generated nested Arrays,
2352// e.g. <template>, <slot>, v-for, or when the children is provided by user
2353// with hand-written render functions / JSX. In such cases a full normalization
2354// is needed to cater to all possible types of children values.
2355function normalizeChildren (children) {
2356 return isPrimitive(children)
2357 ? [createTextVNode(children)]
2358 : Array.isArray(children)
2359 ? normalizeArrayChildren(children)
2360 : undefined
2361}
2362
2363function isTextNode (node) {
2364 return isDef(node) && isDef(node.text) && isFalse(node.isComment)
2365}
2366
2367function normalizeArrayChildren (children, nestedIndex) {
2368 var res = [];
2369 var i, c, lastIndex, last;
2370 for (i = 0; i < children.length; i++) {
2371 c = children[i];
2372 if (isUndef(c) || typeof c === 'boolean') { continue }
2373 lastIndex = res.length - 1;
2374 last = res[lastIndex];
2375 // nested
2376 if (Array.isArray(c)) {
2377 if (c.length > 0) {
2378 c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
2379 // merge adjacent text nodes
2380 if (isTextNode(c[0]) && isTextNode(last)) {
2381 res[lastIndex] = createTextVNode(last.text + (c[0]).text);
2382 c.shift();
2383 }
2384 res.push.apply(res, c);
2385 }
2386 } else if (isPrimitive(c)) {
2387 if (isTextNode(last)) {
2388 // merge adjacent text nodes
2389 // this is necessary for SSR hydration because text nodes are
2390 // essentially merged when rendered to HTML strings
2391 res[lastIndex] = createTextVNode(last.text + c);
2392 } else if (c !== '') {
2393 // convert primitive to vnode
2394 res.push(createTextVNode(c));
2395 }
2396 } else {
2397 if (isTextNode(c) && isTextNode(last)) {
2398 // merge adjacent text nodes
2399 res[lastIndex] = createTextVNode(last.text + c.text);
2400 } else {
2401 // default key for nested array children (likely generated by v-for)
2402 if (isTrue(children._isVList) &&
2403 isDef(c.tag) &&
2404 isUndef(c.key) &&
2405 isDef(nestedIndex)) {
2406 c.key = "__vlist" + nestedIndex + "_" + i + "__";
2407 }
2408 res.push(c);
2409 }
2410 }
2411 }
2412 return res
2413}
2414
2415/* */
2416
2417function initProvide (vm) {
2418 var provide = vm.$options.provide;
2419 if (provide) {
2420 vm._provided = typeof provide === 'function'
2421 ? provide.call(vm)
2422 : provide;
2423 }
2424}
2425
2426function initInjections (vm) {
2427 var result = resolveInject(vm.$options.inject, vm);
2428 if (result) {
2429 toggleObserving(false);
2430 Object.keys(result).forEach(function (key) {
2431 /* istanbul ignore else */
2432 if (process.env.NODE_ENV !== 'production') {
2433 defineReactive$$1(vm, key, result[key], function () {
2434 warn(
2435 "Avoid mutating an injected value directly since the changes will be " +
2436 "overwritten whenever the provided component re-renders. " +
2437 "injection being mutated: \"" + key + "\"",
2438 vm
2439 );
2440 });
2441 } else {
2442 defineReactive$$1(vm, key, result[key]);
2443 }
2444 });
2445 toggleObserving(true);
2446 }
2447}
2448
2449function resolveInject (inject, vm) {
2450 if (inject) {
2451 // inject is :any because flow is not smart enough to figure out cached
2452 var result = Object.create(null);
2453 var keys = hasSymbol
2454 ? Reflect.ownKeys(inject)
2455 : Object.keys(inject);
2456
2457 for (var i = 0; i < keys.length; i++) {
2458 var key = keys[i];
2459 // #6574 in case the inject object is observed...
2460 if (key === '__ob__') { continue }
2461 var provideKey = inject[key].from;
2462 var source = vm;
2463 while (source) {
2464 if (source._provided && hasOwn(source._provided, provideKey)) {
2465 result[key] = source._provided[provideKey];
2466 break
2467 }
2468 source = source.$parent;
2469 }
2470 if (!source) {
2471 if ('default' in inject[key]) {
2472 var provideDefault = inject[key].default;
2473 result[key] = typeof provideDefault === 'function'
2474 ? provideDefault.call(vm)
2475 : provideDefault;
2476 } else if (process.env.NODE_ENV !== 'production') {
2477 warn(("Injection \"" + key + "\" not found"), vm);
2478 }
2479 }
2480 }
2481 return result
2482 }
2483}
2484
2485/* */
2486
2487
2488
2489/**
2490 * Runtime helper for resolving raw children VNodes into a slot object.
2491 */
2492function resolveSlots (
2493 children,
2494 context
2495) {
2496 if (!children || !children.length) {
2497 return {}
2498 }
2499 var slots = {};
2500 for (var i = 0, l = children.length; i < l; i++) {
2501 var child = children[i];
2502 var data = child.data;
2503 // remove slot attribute if the node is resolved as a Vue slot node
2504 if (data && data.attrs && data.attrs.slot) {
2505 delete data.attrs.slot;
2506 }
2507 // named slots should only be respected if the vnode was rendered in the
2508 // same context.
2509 if ((child.context === context || child.fnContext === context) &&
2510 data && data.slot != null
2511 ) {
2512 var name = data.slot;
2513 var slot = (slots[name] || (slots[name] = []));
2514 if (child.tag === 'template') {
2515 slot.push.apply(slot, child.children || []);
2516 } else {
2517 slot.push(child);
2518 }
2519 } else {
2520 (slots.default || (slots.default = [])).push(child);
2521 }
2522 }
2523 // ignore slots that contains only whitespace
2524 for (var name$1 in slots) {
2525 if (slots[name$1].every(isWhitespace)) {
2526 delete slots[name$1];
2527 }
2528 }
2529 return slots
2530}
2531
2532function isWhitespace (node) {
2533 return (node.isComment && !node.asyncFactory) || node.text === ' '
2534}
2535
2536/* */
2537
2538function normalizeScopedSlots (
2539 slots,
2540 normalSlots,
2541 prevSlots
2542) {
2543 var res;
2544 var hasNormalSlots = Object.keys(normalSlots).length > 0;
2545 var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2546 var key = slots && slots.$key;
2547 if (!slots) {
2548 res = {};
2549 } else if (slots._normalized) {
2550 // fast path 1: child component re-render only, parent did not change
2551 return slots._normalized
2552 } else if (
2553 isStable &&
2554 prevSlots &&
2555 prevSlots !== emptyObject &&
2556 key === prevSlots.$key &&
2557 !hasNormalSlots &&
2558 !prevSlots.$hasNormal
2559 ) {
2560 // fast path 2: stable scoped slots w/ no normal slots to proxy,
2561 // only need to normalize once
2562 return prevSlots
2563 } else {
2564 res = {};
2565 for (var key$1 in slots) {
2566 if (slots[key$1] && key$1[0] !== '$') {
2567 res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
2568 }
2569 }
2570 }
2571 // expose normal slots on scopedSlots
2572 for (var key$2 in normalSlots) {
2573 if (!(key$2 in res)) {
2574 res[key$2] = proxyNormalSlot(normalSlots, key$2);
2575 }
2576 }
2577 // avoriaz seems to mock a non-extensible $scopedSlots object
2578 // and when that is passed down this would cause an error
2579 if (slots && Object.isExtensible(slots)) {
2580 (slots)._normalized = res;
2581 }
2582 def(res, '$stable', isStable);
2583 def(res, '$key', key);
2584 def(res, '$hasNormal', hasNormalSlots);
2585 return res
2586}
2587
2588function normalizeScopedSlot(normalSlots, key, fn) {
2589 var normalized = function () {
2590 var res = arguments.length ? fn.apply(null, arguments) : fn({});
2591 res = res && typeof res === 'object' && !Array.isArray(res)
2592 ? [res] // single vnode
2593 : normalizeChildren(res);
2594 return res && (
2595 res.length === 0 ||
2596 (res.length === 1 && res[0].isComment) // #9658
2597 ) ? undefined
2598 : res
2599 };
2600 // this is a slot using the new v-slot syntax without scope. although it is
2601 // compiled as a scoped slot, render fn users would expect it to be present
2602 // on this.$slots because the usage is semantically a normal slot.
2603 if (fn.proxy) {
2604 Object.defineProperty(normalSlots, key, {
2605 get: normalized,
2606 enumerable: true,
2607 configurable: true
2608 });
2609 }
2610 return normalized
2611}
2612
2613function proxyNormalSlot(slots, key) {
2614 return function () { return slots[key]; }
2615}
2616
2617/* */
2618
2619/**
2620 * Runtime helper for rendering v-for lists.
2621 */
2622function renderList (
2623 val,
2624 render
2625) {
2626 var ret, i, l, keys, key;
2627 if (Array.isArray(val) || typeof val === 'string') {
2628 ret = new Array(val.length);
2629 for (i = 0, l = val.length; i < l; i++) {
2630 ret[i] = render(val[i], i);
2631 }
2632 } else if (typeof val === 'number') {
2633 ret = new Array(val);
2634 for (i = 0; i < val; i++) {
2635 ret[i] = render(i + 1, i);
2636 }
2637 } else if (isObject(val)) {
2638 if (hasSymbol && val[Symbol.iterator]) {
2639 ret = [];
2640 var iterator = val[Symbol.iterator]();
2641 var result = iterator.next();
2642 while (!result.done) {
2643 ret.push(render(result.value, ret.length));
2644 result = iterator.next();
2645 }
2646 } else {
2647 keys = Object.keys(val);
2648 ret = new Array(keys.length);
2649 for (i = 0, l = keys.length; i < l; i++) {
2650 key = keys[i];
2651 ret[i] = render(val[key], key, i);
2652 }
2653 }
2654 }
2655 if (!isDef(ret)) {
2656 ret = [];
2657 }
2658 (ret)._isVList = true;
2659 return ret
2660}
2661
2662/* */
2663
2664/**
2665 * Runtime helper for rendering <slot>
2666 */
2667function renderSlot (
2668 name,
2669 fallback,
2670 props,
2671 bindObject
2672) {
2673 var scopedSlotFn = this.$scopedSlots[name];
2674 var nodes;
2675 if (scopedSlotFn) { // scoped slot
2676 props = props || {};
2677 if (bindObject) {
2678 if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
2679 warn(
2680 'slot v-bind without argument expects an Object',
2681 this
2682 );
2683 }
2684 props = extend(extend({}, bindObject), props);
2685 }
2686 nodes = scopedSlotFn(props) || fallback;
2687 } else {
2688 nodes = this.$slots[name] || fallback;
2689 }
2690
2691 var target = props && props.slot;
2692 if (target) {
2693 return this.$createElement('template', { slot: target }, nodes)
2694 } else {
2695 return nodes
2696 }
2697}
2698
2699/* */
2700
2701/**
2702 * Runtime helper for resolving filters
2703 */
2704function resolveFilter (id) {
2705 return resolveAsset(this.$options, 'filters', id, true) || identity
2706}
2707
2708/* */
2709
2710function isKeyNotMatch (expect, actual) {
2711 if (Array.isArray(expect)) {
2712 return expect.indexOf(actual) === -1
2713 } else {
2714 return expect !== actual
2715 }
2716}
2717
2718/**
2719 * Runtime helper for checking keyCodes from config.
2720 * exposed as Vue.prototype._k
2721 * passing in eventKeyName as last argument separately for backwards compat
2722 */
2723function checkKeyCodes (
2724 eventKeyCode,
2725 key,
2726 builtInKeyCode,
2727 eventKeyName,
2728 builtInKeyName
2729) {
2730 var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
2731 if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
2732 return isKeyNotMatch(builtInKeyName, eventKeyName)
2733 } else if (mappedKeyCode) {
2734 return isKeyNotMatch(mappedKeyCode, eventKeyCode)
2735 } else if (eventKeyName) {
2736 return hyphenate(eventKeyName) !== key
2737 }
2738}
2739
2740/* */
2741
2742/**
2743 * Runtime helper for merging v-bind="object" into a VNode's data.
2744 */
2745function bindObjectProps (
2746 data,
2747 tag,
2748 value,
2749 asProp,
2750 isSync
2751) {
2752 if (value) {
2753 if (!isObject(value)) {
2754 process.env.NODE_ENV !== 'production' && warn(
2755 'v-bind without argument expects an Object or Array value',
2756 this
2757 );
2758 } else {
2759 if (Array.isArray(value)) {
2760 value = toObject(value);
2761 }
2762 var hash;
2763 var loop = function ( key ) {
2764 if (
2765 key === 'class' ||
2766 key === 'style' ||
2767 isReservedAttribute(key)
2768 ) {
2769 hash = data;
2770 } else {
2771 var type = data.attrs && data.attrs.type;
2772 hash = asProp || config.mustUseProp(tag, type, key)
2773 ? data.domProps || (data.domProps = {})
2774 : data.attrs || (data.attrs = {});
2775 }
2776 var camelizedKey = camelize(key);
2777 var hyphenatedKey = hyphenate(key);
2778 if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2779 hash[key] = value[key];
2780
2781 if (isSync) {
2782 var on = data.on || (data.on = {});
2783 on[("update:" + key)] = function ($event) {
2784 value[key] = $event;
2785 };
2786 }
2787 }
2788 };
2789
2790 for (var key in value) loop( key );
2791 }
2792 }
2793 return data
2794}
2795
2796/* */
2797
2798/**
2799 * Runtime helper for rendering static trees.
2800 */
2801function renderStatic (
2802 index,
2803 isInFor
2804) {
2805 var cached = this._staticTrees || (this._staticTrees = []);
2806 var tree = cached[index];
2807 // if has already-rendered static tree and not inside v-for,
2808 // we can reuse the same tree.
2809 if (tree && !isInFor) {
2810 return tree
2811 }
2812 // otherwise, render a fresh tree.
2813 tree = cached[index] = this.$options.staticRenderFns[index].call(
2814 this._renderProxy,
2815 null,
2816 this // for render fns generated for functional component templates
2817 );
2818 markStatic(tree, ("__static__" + index), false);
2819 return tree
2820}
2821
2822/**
2823 * Runtime helper for v-once.
2824 * Effectively it means marking the node as static with a unique key.
2825 */
2826function markOnce (
2827 tree,
2828 index,
2829 key
2830) {
2831 markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
2832 return tree
2833}
2834
2835function markStatic (
2836 tree,
2837 key,
2838 isOnce
2839) {
2840 if (Array.isArray(tree)) {
2841 for (var i = 0; i < tree.length; i++) {
2842 if (tree[i] && typeof tree[i] !== 'string') {
2843 markStaticNode(tree[i], (key + "_" + i), isOnce);
2844 }
2845 }
2846 } else {
2847 markStaticNode(tree, key, isOnce);
2848 }
2849}
2850
2851function markStaticNode (node, key, isOnce) {
2852 node.isStatic = true;
2853 node.key = key;
2854 node.isOnce = isOnce;
2855}
2856
2857/* */
2858
2859function bindObjectListeners (data, value) {
2860 if (value) {
2861 if (!isPlainObject(value)) {
2862 process.env.NODE_ENV !== 'production' && warn(
2863 'v-on without argument expects an Object value',
2864 this
2865 );
2866 } else {
2867 var on = data.on = data.on ? extend({}, data.on) : {};
2868 for (var key in value) {
2869 var existing = on[key];
2870 var ours = value[key];
2871 on[key] = existing ? [].concat(existing, ours) : ours;
2872 }
2873 }
2874 }
2875 return data
2876}
2877
2878/* */
2879
2880function resolveScopedSlots (
2881 fns, // see flow/vnode
2882 res,
2883 // the following are added in 2.6
2884 hasDynamicKeys,
2885 contentHashKey
2886) {
2887 res = res || { $stable: !hasDynamicKeys };
2888 for (var i = 0; i < fns.length; i++) {
2889 var slot = fns[i];
2890 if (Array.isArray(slot)) {
2891 resolveScopedSlots(slot, res, hasDynamicKeys);
2892 } else if (slot) {
2893 // marker for reverse proxying v-slot without scope on this.$slots
2894 if (slot.proxy) {
2895 slot.fn.proxy = true;
2896 }
2897 res[slot.key] = slot.fn;
2898 }
2899 }
2900 if (contentHashKey) {
2901 (res).$key = contentHashKey;
2902 }
2903 return res
2904}
2905
2906/* */
2907
2908function bindDynamicKeys (baseObj, values) {
2909 for (var i = 0; i < values.length; i += 2) {
2910 var key = values[i];
2911 if (typeof key === 'string' && key) {
2912 baseObj[values[i]] = values[i + 1];
2913 } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
2914 // null is a speical value for explicitly removing a binding
2915 warn(
2916 ("Invalid value for dynamic directive argument (expected string or null): " + key),
2917 this
2918 );
2919 }
2920 }
2921 return baseObj
2922}
2923
2924// helper to dynamically append modifier runtime markers to event names.
2925// ensure only append when value is already string, otherwise it will be cast
2926// to string and cause the type check to miss.
2927function prependModifier (value, symbol) {
2928 return typeof value === 'string' ? symbol + value : value
2929}
2930
2931/* */
2932
2933function installRenderHelpers (target) {
2934 target._o = markOnce;
2935 target._n = toNumber;
2936 target._s = toString;
2937 target._l = renderList;
2938 target._t = renderSlot;
2939 target._q = looseEqual;
2940 target._i = looseIndexOf;
2941 target._m = renderStatic;
2942 target._f = resolveFilter;
2943 target._k = checkKeyCodes;
2944 target._b = bindObjectProps;
2945 target._v = createTextVNode;
2946 target._e = createEmptyVNode;
2947 target._u = resolveScopedSlots;
2948 target._g = bindObjectListeners;
2949 target._d = bindDynamicKeys;
2950 target._p = prependModifier;
2951}
2952
2953/* */
2954
2955function FunctionalRenderContext (
2956 data,
2957 props,
2958 children,
2959 parent,
2960 Ctor
2961) {
2962 var this$1 = this;
2963
2964 var options = Ctor.options;
2965 // ensure the createElement function in functional components
2966 // gets a unique context - this is necessary for correct named slot check
2967 var contextVm;
2968 if (hasOwn(parent, '_uid')) {
2969 contextVm = Object.create(parent);
2970 // $flow-disable-line
2971 contextVm._original = parent;
2972 } else {
2973 // the context vm passed in is a functional context as well.
2974 // in this case we want to make sure we are able to get a hold to the
2975 // real context instance.
2976 contextVm = parent;
2977 // $flow-disable-line
2978 parent = parent._original;
2979 }
2980 var isCompiled = isTrue(options._compiled);
2981 var needNormalization = !isCompiled;
2982
2983 this.data = data;
2984 this.props = props;
2985 this.children = children;
2986 this.parent = parent;
2987 this.listeners = data.on || emptyObject;
2988 this.injections = resolveInject(options.inject, parent);
2989 this.slots = function () {
2990 if (!this$1.$slots) {
2991 normalizeScopedSlots(
2992 data.scopedSlots,
2993 this$1.$slots = resolveSlots(children, parent)
2994 );
2995 }
2996 return this$1.$slots
2997 };
2998
2999 Object.defineProperty(this, 'scopedSlots', ({
3000 enumerable: true,
3001 get: function get () {
3002 return normalizeScopedSlots(data.scopedSlots, this.slots())
3003 }
3004 }));
3005
3006 // support for compiled functional template
3007 if (isCompiled) {
3008 // exposing $options for renderStatic()
3009 this.$options = options;
3010 // pre-resolve slots for renderSlot()
3011 this.$slots = this.slots();
3012 this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
3013 }
3014
3015 if (options._scopeId) {
3016 this._c = function (a, b, c, d) {
3017 var vnode = createElement(contextVm, a, b, c, d, needNormalization);
3018 if (vnode && !Array.isArray(vnode)) {
3019 vnode.fnScopeId = options._scopeId;
3020 vnode.fnContext = parent;
3021 }
3022 return vnode
3023 };
3024 } else {
3025 this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
3026 }
3027}
3028
3029installRenderHelpers(FunctionalRenderContext.prototype);
3030
3031function createFunctionalComponent (
3032 Ctor,
3033 propsData,
3034 data,
3035 contextVm,
3036 children
3037) {
3038 var options = Ctor.options;
3039 var props = {};
3040 var propOptions = options.props;
3041 if (isDef(propOptions)) {
3042 for (var key in propOptions) {
3043 props[key] = validateProp(key, propOptions, propsData || emptyObject);
3044 }
3045 } else {
3046 if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
3047 if (isDef(data.props)) { mergeProps(props, data.props); }
3048 }
3049
3050 var renderContext = new FunctionalRenderContext(
3051 data,
3052 props,
3053 children,
3054 contextVm,
3055 Ctor
3056 );
3057
3058 var vnode = options.render.call(null, renderContext._c, renderContext);
3059
3060 if (vnode instanceof VNode) {
3061 return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
3062 } else if (Array.isArray(vnode)) {
3063 var vnodes = normalizeChildren(vnode) || [];
3064 var res = new Array(vnodes.length);
3065 for (var i = 0; i < vnodes.length; i++) {
3066 res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
3067 }
3068 return res
3069 }
3070}
3071
3072function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
3073 // #7817 clone node before setting fnContext, otherwise if the node is reused
3074 // (e.g. it was from a cached normal slot) the fnContext causes named slots
3075 // that should not be matched to match.
3076 var clone = cloneVNode(vnode);
3077 clone.fnContext = contextVm;
3078 clone.fnOptions = options;
3079 if (process.env.NODE_ENV !== 'production') {
3080 (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
3081 }
3082 if (data.slot) {
3083 (clone.data || (clone.data = {})).slot = data.slot;
3084 }
3085 return clone
3086}
3087
3088function mergeProps (to, from) {
3089 for (var key in from) {
3090 to[camelize(key)] = from[key];
3091 }
3092}
3093
3094/* */
3095
3096/* */
3097
3098/* */
3099
3100/* */
3101
3102// inline hooks to be invoked on component VNodes during patch
3103var componentVNodeHooks = {
3104 init: function init (vnode, hydrating) {
3105 if (
3106 vnode.componentInstance &&
3107 !vnode.componentInstance._isDestroyed &&
3108 vnode.data.keepAlive
3109 ) {
3110 // kept-alive components, treat as a patch
3111 var mountedNode = vnode; // work around flow
3112 componentVNodeHooks.prepatch(mountedNode, mountedNode);
3113 } else {
3114 var child = vnode.componentInstance = createComponentInstanceForVnode(
3115 vnode,
3116 activeInstance
3117 );
3118 child.$mount(hydrating ? vnode.elm : undefined, hydrating);
3119 }
3120 },
3121
3122 prepatch: function prepatch (oldVnode, vnode) {
3123 var options = vnode.componentOptions;
3124 var child = vnode.componentInstance = oldVnode.componentInstance;
3125 updateChildComponent(
3126 child,
3127 options.propsData, // updated props
3128 options.listeners, // updated listeners
3129 vnode, // new parent vnode
3130 options.children // new children
3131 );
3132 },
3133
3134 insert: function insert (vnode) {
3135 var context = vnode.context;
3136 var componentInstance = vnode.componentInstance;
3137 if (!componentInstance._isMounted) {
3138 componentInstance._isMounted = true;
3139 callHook(componentInstance, 'mounted');
3140 }
3141 if (vnode.data.keepAlive) {
3142 if (context._isMounted) {
3143 // vue-router#1212
3144 // During updates, a kept-alive component's child components may
3145 // change, so directly walking the tree here may call activated hooks
3146 // on incorrect children. Instead we push them into a queue which will
3147 // be processed after the whole patch process ended.
3148 queueActivatedComponent(componentInstance);
3149 } else {
3150 activateChildComponent(componentInstance, true /* direct */);
3151 }
3152 }
3153 },
3154
3155 destroy: function destroy (vnode) {
3156 var componentInstance = vnode.componentInstance;
3157 if (!componentInstance._isDestroyed) {
3158 if (!vnode.data.keepAlive) {
3159 componentInstance.$destroy();
3160 } else {
3161 deactivateChildComponent(componentInstance, true /* direct */);
3162 }
3163 }
3164 }
3165};
3166
3167var hooksToMerge = Object.keys(componentVNodeHooks);
3168
3169function createComponent (
3170 Ctor,
3171 data,
3172 context,
3173 children,
3174 tag
3175) {
3176 if (isUndef(Ctor)) {
3177 return
3178 }
3179
3180 var baseCtor = context.$options._base;
3181
3182 // plain options object: turn it into a constructor
3183 if (isObject(Ctor)) {
3184 Ctor = baseCtor.extend(Ctor);
3185 }
3186
3187 // if at this stage it's not a constructor or an async component factory,
3188 // reject.
3189 if (typeof Ctor !== 'function') {
3190 if (process.env.NODE_ENV !== 'production') {
3191 warn(("Invalid Component definition: " + (String(Ctor))), context);
3192 }
3193 return
3194 }
3195
3196 // async component
3197 var asyncFactory;
3198 if (isUndef(Ctor.cid)) {
3199 asyncFactory = Ctor;
3200 Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
3201 if (Ctor === undefined) {
3202 // return a placeholder node for async component, which is rendered
3203 // as a comment node but preserves all the raw information for the node.
3204 // the information will be used for async server-rendering and hydration.
3205 return createAsyncPlaceholder(
3206 asyncFactory,
3207 data,
3208 context,
3209 children,
3210 tag
3211 )
3212 }
3213 }
3214
3215 data = data || {};
3216
3217 // resolve constructor options in case global mixins are applied after
3218 // component constructor creation
3219 resolveConstructorOptions(Ctor);
3220
3221 // transform component v-model data into props & events
3222 if (isDef(data.model)) {
3223 transformModel(Ctor.options, data);
3224 }
3225
3226 // extract props
3227 var propsData = extractPropsFromVNodeData(data, Ctor, tag);
3228
3229 // functional component
3230 if (isTrue(Ctor.options.functional)) {
3231 return createFunctionalComponent(Ctor, propsData, data, context, children)
3232 }
3233
3234 // extract listeners, since these needs to be treated as
3235 // child component listeners instead of DOM listeners
3236 var listeners = data.on;
3237 // replace with listeners with .native modifier
3238 // so it gets processed during parent component patch.
3239 data.on = data.nativeOn;
3240
3241 if (isTrue(Ctor.options.abstract)) {
3242 // abstract components do not keep anything
3243 // other than props & listeners & slot
3244
3245 // work around flow
3246 var slot = data.slot;
3247 data = {};
3248 if (slot) {
3249 data.slot = slot;
3250 }
3251 }
3252
3253 // install component management hooks onto the placeholder node
3254 installComponentHooks(data);
3255
3256 // return a placeholder vnode
3257 var name = Ctor.options.name || tag;
3258 var vnode = new VNode(
3259 ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
3260 data, undefined, undefined, undefined, context,
3261 { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
3262 asyncFactory
3263 );
3264
3265 return vnode
3266}
3267
3268function createComponentInstanceForVnode (
3269 vnode, // we know it's MountedComponentVNode but flow doesn't
3270 parent // activeInstance in lifecycle state
3271) {
3272 var options = {
3273 _isComponent: true,
3274 _parentVnode: vnode,
3275 parent: parent
3276 };
3277 // check inline-template render functions
3278 var inlineTemplate = vnode.data.inlineTemplate;
3279 if (isDef(inlineTemplate)) {
3280 options.render = inlineTemplate.render;
3281 options.staticRenderFns = inlineTemplate.staticRenderFns;
3282 }
3283 return new vnode.componentOptions.Ctor(options)
3284}
3285
3286function installComponentHooks (data) {
3287 var hooks = data.hook || (data.hook = {});
3288 for (var i = 0; i < hooksToMerge.length; i++) {
3289 var key = hooksToMerge[i];
3290 var existing = hooks[key];
3291 var toMerge = componentVNodeHooks[key];
3292 if (existing !== toMerge && !(existing && existing._merged)) {
3293 hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
3294 }
3295 }
3296}
3297
3298function mergeHook$1 (f1, f2) {
3299 var merged = function (a, b) {
3300 // flow complains about extra args which is why we use any
3301 f1(a, b);
3302 f2(a, b);
3303 };
3304 merged._merged = true;
3305 return merged
3306}
3307
3308// transform component v-model info (value and callback) into
3309// prop and event handler respectively.
3310function transformModel (options, data) {
3311 var prop = (options.model && options.model.prop) || 'value';
3312 var event = (options.model && options.model.event) || 'input'
3313 ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
3314 var on = data.on || (data.on = {});
3315 var existing = on[event];
3316 var callback = data.model.callback;
3317 if (isDef(existing)) {
3318 if (
3319 Array.isArray(existing)
3320 ? existing.indexOf(callback) === -1
3321 : existing !== callback
3322 ) {
3323 on[event] = [callback].concat(existing);
3324 }
3325 } else {
3326 on[event] = callback;
3327 }
3328}
3329
3330/* */
3331
3332var SIMPLE_NORMALIZE = 1;
3333var ALWAYS_NORMALIZE = 2;
3334
3335// wrapper function for providing a more flexible interface
3336// without getting yelled at by flow
3337function createElement (
3338 context,
3339 tag,
3340 data,
3341 children,
3342 normalizationType,
3343 alwaysNormalize
3344) {
3345 if (Array.isArray(data) || isPrimitive(data)) {
3346 normalizationType = children;
3347 children = data;
3348 data = undefined;
3349 }
3350 if (isTrue(alwaysNormalize)) {
3351 normalizationType = ALWAYS_NORMALIZE;
3352 }
3353 return _createElement(context, tag, data, children, normalizationType)
3354}
3355
3356function _createElement (
3357 context,
3358 tag,
3359 data,
3360 children,
3361 normalizationType
3362) {
3363 if (isDef(data) && isDef((data).__ob__)) {
3364 process.env.NODE_ENV !== 'production' && warn(
3365 "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
3366 'Always create fresh vnode data objects in each render!',
3367 context
3368 );
3369 return createEmptyVNode()
3370 }
3371 // object syntax in v-bind
3372 if (isDef(data) && isDef(data.is)) {
3373 tag = data.is;
3374 }
3375 if (!tag) {
3376 // in case of component :is set to falsy value
3377 return createEmptyVNode()
3378 }
3379 // warn against non-primitive key
3380 if (process.env.NODE_ENV !== 'production' &&
3381 isDef(data) && isDef(data.key) && !isPrimitive(data.key)
3382 ) {
3383 {
3384 warn(
3385 'Avoid using non-primitive value as key, ' +
3386 'use string/number value instead.',
3387 context
3388 );
3389 }
3390 }
3391 // support single function children as default scoped slot
3392 if (Array.isArray(children) &&
3393 typeof children[0] === 'function'
3394 ) {
3395 data = data || {};
3396 data.scopedSlots = { default: children[0] };
3397 children.length = 0;
3398 }
3399 if (normalizationType === ALWAYS_NORMALIZE) {
3400 children = normalizeChildren(children);
3401 } else if (normalizationType === SIMPLE_NORMALIZE) {
3402 children = simpleNormalizeChildren(children);
3403 }
3404 var vnode, ns;
3405 if (typeof tag === 'string') {
3406 var Ctor;
3407 ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
3408 if (config.isReservedTag(tag)) {
3409 // platform built-in elements
3410 vnode = new VNode(
3411 config.parsePlatformTagName(tag), data, children,
3412 undefined, undefined, context
3413 );
3414 } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
3415 // component
3416 vnode = createComponent(Ctor, data, context, children, tag);
3417 } else {
3418 // unknown or unlisted namespaced elements
3419 // check at runtime because it may get assigned a namespace when its
3420 // parent normalizes children
3421 vnode = new VNode(
3422 tag, data, children,
3423 undefined, undefined, context
3424 );
3425 }
3426 } else {
3427 // direct component options / constructor
3428 vnode = createComponent(tag, data, context, children);
3429 }
3430 if (Array.isArray(vnode)) {
3431 return vnode
3432 } else if (isDef(vnode)) {
3433 if (isDef(ns)) { applyNS(vnode, ns); }
3434 if (isDef(data)) { registerDeepBindings(data); }
3435 return vnode
3436 } else {
3437 return createEmptyVNode()
3438 }
3439}
3440
3441function applyNS (vnode, ns, force) {
3442 vnode.ns = ns;
3443 if (vnode.tag === 'foreignObject') {
3444 // use default namespace inside foreignObject
3445 ns = undefined;
3446 force = true;
3447 }
3448 if (isDef(vnode.children)) {
3449 for (var i = 0, l = vnode.children.length; i < l; i++) {
3450 var child = vnode.children[i];
3451 if (isDef(child.tag) && (
3452 isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
3453 applyNS(child, ns, force);
3454 }
3455 }
3456 }
3457}
3458
3459// ref #5318
3460// necessary to ensure parent re-render when deep bindings like :style and
3461// :class are used on slot nodes
3462function registerDeepBindings (data) {
3463 if (isObject(data.style)) {
3464 traverse(data.style);
3465 }
3466 if (isObject(data.class)) {
3467 traverse(data.class);
3468 }
3469}
3470
3471/* */
3472
3473function initRender (vm) {
3474 vm._vnode = null; // the root of the child tree
3475 vm._staticTrees = null; // v-once cached trees
3476 var options = vm.$options;
3477 var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
3478 var renderContext = parentVnode && parentVnode.context;
3479 vm.$slots = resolveSlots(options._renderChildren, renderContext);
3480 vm.$scopedSlots = emptyObject;
3481 // bind the createElement fn to this instance
3482 // so that we get proper render context inside it.
3483 // args order: tag, data, children, normalizationType, alwaysNormalize
3484 // internal version is used by render functions compiled from templates
3485 vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
3486 // normalization is always applied for the public version, used in
3487 // user-written render functions.
3488 vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
3489
3490 // $attrs & $listeners are exposed for easier HOC creation.
3491 // they need to be reactive so that HOCs using them are always updated
3492 var parentData = parentVnode && parentVnode.data;
3493
3494 /* istanbul ignore else */
3495 if (process.env.NODE_ENV !== 'production') {
3496 defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
3497 !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
3498 }, true);
3499 defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
3500 !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
3501 }, true);
3502 } else {
3503 defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
3504 defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
3505 }
3506}
3507
3508var currentRenderingInstance = null;
3509
3510function renderMixin (Vue) {
3511 // install runtime convenience helpers
3512 installRenderHelpers(Vue.prototype);
3513
3514 Vue.prototype.$nextTick = function (fn) {
3515 return nextTick(fn, this)
3516 };
3517
3518 Vue.prototype._render = function () {
3519 var vm = this;
3520 var ref = vm.$options;
3521 var render = ref.render;
3522 var _parentVnode = ref._parentVnode;
3523
3524 if (_parentVnode) {
3525 vm.$scopedSlots = normalizeScopedSlots(
3526 _parentVnode.data.scopedSlots,
3527 vm.$slots,
3528 vm.$scopedSlots
3529 );
3530 }
3531
3532 // set parent vnode. this allows render functions to have access
3533 // to the data on the placeholder node.
3534 vm.$vnode = _parentVnode;
3535 // render self
3536 var vnode;
3537 try {
3538 // There's no need to maintain a stack becaues all render fns are called
3539 // separately from one another. Nested component's render fns are called
3540 // when parent component is patched.
3541 currentRenderingInstance = vm;
3542 vnode = render.call(vm._renderProxy, vm.$createElement);
3543 } catch (e) {
3544 handleError(e, vm, "render");
3545 // return error render result,
3546 // or previous vnode to prevent render error causing blank component
3547 /* istanbul ignore else */
3548 if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {
3549 try {
3550 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
3551 } catch (e) {
3552 handleError(e, vm, "renderError");
3553 vnode = vm._vnode;
3554 }
3555 } else {
3556 vnode = vm._vnode;
3557 }
3558 } finally {
3559 currentRenderingInstance = null;
3560 }
3561 // if the returned array contains only a single node, allow it
3562 if (Array.isArray(vnode) && vnode.length === 1) {
3563 vnode = vnode[0];
3564 }
3565 // return empty vnode in case the render function errored out
3566 if (!(vnode instanceof VNode)) {
3567 if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
3568 warn(
3569 'Multiple root nodes returned from render function. Render function ' +
3570 'should return a single root node.',
3571 vm
3572 );
3573 }
3574 vnode = createEmptyVNode();
3575 }
3576 // set parent
3577 vnode.parent = _parentVnode;
3578 return vnode
3579 };
3580}
3581
3582/* */
3583
3584function ensureCtor (comp, base) {
3585 if (
3586 comp.__esModule ||
3587 (hasSymbol && comp[Symbol.toStringTag] === 'Module')
3588 ) {
3589 comp = comp.default;
3590 }
3591 return isObject(comp)
3592 ? base.extend(comp)
3593 : comp
3594}
3595
3596function createAsyncPlaceholder (
3597 factory,
3598 data,
3599 context,
3600 children,
3601 tag
3602) {
3603 var node = createEmptyVNode();
3604 node.asyncFactory = factory;
3605 node.asyncMeta = { data: data, context: context, children: children, tag: tag };
3606 return node
3607}
3608
3609function resolveAsyncComponent (
3610 factory,
3611 baseCtor
3612) {
3613 if (isTrue(factory.error) && isDef(factory.errorComp)) {
3614 return factory.errorComp
3615 }
3616
3617 if (isDef(factory.resolved)) {
3618 return factory.resolved
3619 }
3620
3621 var owner = currentRenderingInstance;
3622 if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3623 // already pending
3624 factory.owners.push(owner);
3625 }
3626
3627 if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3628 return factory.loadingComp
3629 }
3630
3631 if (owner && !isDef(factory.owners)) {
3632 var owners = factory.owners = [owner];
3633 var sync = true;
3634 var timerLoading = null;
3635 var timerTimeout = null
3636
3637 ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3638
3639 var forceRender = function (renderCompleted) {
3640 for (var i = 0, l = owners.length; i < l; i++) {
3641 (owners[i]).$forceUpdate();
3642 }
3643
3644 if (renderCompleted) {
3645 owners.length = 0;
3646 if (timerLoading !== null) {
3647 clearTimeout(timerLoading);
3648 timerLoading = null;
3649 }
3650 if (timerTimeout !== null) {
3651 clearTimeout(timerTimeout);
3652 timerTimeout = null;
3653 }
3654 }
3655 };
3656
3657 var resolve = once(function (res) {
3658 // cache resolved
3659 factory.resolved = ensureCtor(res, baseCtor);
3660 // invoke callbacks only if this is not a synchronous resolve
3661 // (async resolves are shimmed as synchronous during SSR)
3662 if (!sync) {
3663 forceRender(true);
3664 } else {
3665 owners.length = 0;
3666 }
3667 });
3668
3669 var reject = once(function (reason) {
3670 process.env.NODE_ENV !== 'production' && warn(
3671 "Failed to resolve async component: " + (String(factory)) +
3672 (reason ? ("\nReason: " + reason) : '')
3673 );
3674 if (isDef(factory.errorComp)) {
3675 factory.error = true;
3676 forceRender(true);
3677 }
3678 });
3679
3680 var res = factory(resolve, reject);
3681
3682 if (isObject(res)) {
3683 if (isPromise(res)) {
3684 // () => Promise
3685 if (isUndef(factory.resolved)) {
3686 res.then(resolve, reject);
3687 }
3688 } else if (isPromise(res.component)) {
3689 res.component.then(resolve, reject);
3690
3691 if (isDef(res.error)) {
3692 factory.errorComp = ensureCtor(res.error, baseCtor);
3693 }
3694
3695 if (isDef(res.loading)) {
3696 factory.loadingComp = ensureCtor(res.loading, baseCtor);
3697 if (res.delay === 0) {
3698 factory.loading = true;
3699 } else {
3700 timerLoading = setTimeout(function () {
3701 timerLoading = null;
3702 if (isUndef(factory.resolved) && isUndef(factory.error)) {
3703 factory.loading = true;
3704 forceRender(false);
3705 }
3706 }, res.delay || 200);
3707 }
3708 }
3709
3710 if (isDef(res.timeout)) {
3711 timerTimeout = setTimeout(function () {
3712 timerTimeout = null;
3713 if (isUndef(factory.resolved)) {
3714 reject(
3715 process.env.NODE_ENV !== 'production'
3716 ? ("timeout (" + (res.timeout) + "ms)")
3717 : null
3718 );
3719 }
3720 }, res.timeout);
3721 }
3722 }
3723 }
3724
3725 sync = false;
3726 // return in case resolved synchronously
3727 return factory.loading
3728 ? factory.loadingComp
3729 : factory.resolved
3730 }
3731}
3732
3733/* */
3734
3735function isAsyncPlaceholder (node) {
3736 return node.isComment && node.asyncFactory
3737}
3738
3739/* */
3740
3741function getFirstComponentChild (children) {
3742 if (Array.isArray(children)) {
3743 for (var i = 0; i < children.length; i++) {
3744 var c = children[i];
3745 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
3746 return c
3747 }
3748 }
3749 }
3750}
3751
3752/* */
3753
3754/* */
3755
3756function initEvents (vm) {
3757 vm._events = Object.create(null);
3758 vm._hasHookEvent = false;
3759 // init parent attached events
3760 var listeners = vm.$options._parentListeners;
3761 if (listeners) {
3762 updateComponentListeners(vm, listeners);
3763 }
3764}
3765
3766var target;
3767
3768function add (event, fn) {
3769 target.$on(event, fn);
3770}
3771
3772function remove$1 (event, fn) {
3773 target.$off(event, fn);
3774}
3775
3776function createOnceHandler (event, fn) {
3777 var _target = target;
3778 return function onceHandler () {
3779 var res = fn.apply(null, arguments);
3780 if (res !== null) {
3781 _target.$off(event, onceHandler);
3782 }
3783 }
3784}
3785
3786function updateComponentListeners (
3787 vm,
3788 listeners,
3789 oldListeners
3790) {
3791 target = vm;
3792 updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
3793 target = undefined;
3794}
3795
3796function eventsMixin (Vue) {
3797 var hookRE = /^hook:/;
3798 Vue.prototype.$on = function (event, fn) {
3799 var vm = this;
3800 if (Array.isArray(event)) {
3801 for (var i = 0, l = event.length; i < l; i++) {
3802 vm.$on(event[i], fn);
3803 }
3804 } else {
3805 (vm._events[event] || (vm._events[event] = [])).push(fn);
3806 // optimize hook:event cost by using a boolean flag marked at registration
3807 // instead of a hash lookup
3808 if (hookRE.test(event)) {
3809 vm._hasHookEvent = true;
3810 }
3811 }
3812 return vm
3813 };
3814
3815 Vue.prototype.$once = function (event, fn) {
3816 var vm = this;
3817 function on () {
3818 vm.$off(event, on);
3819 fn.apply(vm, arguments);
3820 }
3821 on.fn = fn;
3822 vm.$on(event, on);
3823 return vm
3824 };
3825
3826 Vue.prototype.$off = function (event, fn) {
3827 var vm = this;
3828 // all
3829 if (!arguments.length) {
3830 vm._events = Object.create(null);
3831 return vm
3832 }
3833 // array of events
3834 if (Array.isArray(event)) {
3835 for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
3836 vm.$off(event[i$1], fn);
3837 }
3838 return vm
3839 }
3840 // specific event
3841 var cbs = vm._events[event];
3842 if (!cbs) {
3843 return vm
3844 }
3845 if (!fn) {
3846 vm._events[event] = null;
3847 return vm
3848 }
3849 // specific handler
3850 var cb;
3851 var i = cbs.length;
3852 while (i--) {
3853 cb = cbs[i];
3854 if (cb === fn || cb.fn === fn) {
3855 cbs.splice(i, 1);
3856 break
3857 }
3858 }
3859 return vm
3860 };
3861
3862 Vue.prototype.$emit = function (event) {
3863 var vm = this;
3864 if (process.env.NODE_ENV !== 'production') {
3865 var lowerCaseEvent = event.toLowerCase();
3866 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
3867 tip(
3868 "Event \"" + lowerCaseEvent + "\" is emitted in component " +
3869 (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
3870 "Note that HTML attributes are case-insensitive and you cannot use " +
3871 "v-on to listen to camelCase events when using in-DOM templates. " +
3872 "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
3873 );
3874 }
3875 }
3876 var cbs = vm._events[event];
3877 if (cbs) {
3878 cbs = cbs.length > 1 ? toArray(cbs) : cbs;
3879 var args = toArray(arguments, 1);
3880 var info = "event handler for \"" + event + "\"";
3881 for (var i = 0, l = cbs.length; i < l; i++) {
3882 invokeWithErrorHandling(cbs[i], vm, args, vm, info);
3883 }
3884 }
3885 return vm
3886 };
3887}
3888
3889/* */
3890
3891var activeInstance = null;
3892var isUpdatingChildComponent = false;
3893
3894function setActiveInstance(vm) {
3895 var prevActiveInstance = activeInstance;
3896 activeInstance = vm;
3897 return function () {
3898 activeInstance = prevActiveInstance;
3899 }
3900}
3901
3902function initLifecycle (vm) {
3903 var options = vm.$options;
3904
3905 // locate first non-abstract parent
3906 var parent = options.parent;
3907 if (parent && !options.abstract) {
3908 while (parent.$options.abstract && parent.$parent) {
3909 parent = parent.$parent;
3910 }
3911 parent.$children.push(vm);
3912 }
3913
3914 vm.$parent = parent;
3915 vm.$root = parent ? parent.$root : vm;
3916
3917 vm.$children = [];
3918 vm.$refs = {};
3919
3920 vm._watcher = null;
3921 vm._inactive = null;
3922 vm._directInactive = false;
3923 vm._isMounted = false;
3924 vm._isDestroyed = false;
3925 vm._isBeingDestroyed = false;
3926}
3927
3928function lifecycleMixin (Vue) {
3929 Vue.prototype._update = function (vnode, hydrating) {
3930 var vm = this;
3931 var prevEl = vm.$el;
3932 var prevVnode = vm._vnode;
3933 var restoreActiveInstance = setActiveInstance(vm);
3934 vm._vnode = vnode;
3935 // Vue.prototype.__patch__ is injected in entry points
3936 // based on the rendering backend used.
3937 if (!prevVnode) {
3938 // initial render
3939 vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
3940 } else {
3941 // updates
3942 vm.$el = vm.__patch__(prevVnode, vnode);
3943 }
3944 restoreActiveInstance();
3945 // update __vue__ reference
3946 if (prevEl) {
3947 prevEl.__vue__ = null;
3948 }
3949 if (vm.$el) {
3950 vm.$el.__vue__ = vm;
3951 }
3952 // if parent is an HOC, update its $el as well
3953 if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
3954 vm.$parent.$el = vm.$el;
3955 }
3956 // updated hook is called by the scheduler to ensure that children are
3957 // updated in a parent's updated hook.
3958 };
3959
3960 Vue.prototype.$forceUpdate = function () {
3961 var vm = this;
3962 if (vm._watcher) {
3963 vm._watcher.update();
3964 }
3965 };
3966
3967 Vue.prototype.$destroy = function () {
3968 var vm = this;
3969 if (vm._isBeingDestroyed) {
3970 return
3971 }
3972 callHook(vm, 'beforeDestroy');
3973 vm._isBeingDestroyed = true;
3974 // remove self from parent
3975 var parent = vm.$parent;
3976 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
3977 remove(parent.$children, vm);
3978 }
3979 // teardown watchers
3980 if (vm._watcher) {
3981 vm._watcher.teardown();
3982 }
3983 var i = vm._watchers.length;
3984 while (i--) {
3985 vm._watchers[i].teardown();
3986 }
3987 // remove reference from data ob
3988 // frozen object may not have observer.
3989 if (vm._data.__ob__) {
3990 vm._data.__ob__.vmCount--;
3991 }
3992 // call the last hook...
3993 vm._isDestroyed = true;
3994 // invoke destroy hooks on current rendered tree
3995 vm.__patch__(vm._vnode, null);
3996 // fire destroyed hook
3997 callHook(vm, 'destroyed');
3998 // turn off all instance listeners.
3999 vm.$off();
4000 // remove __vue__ reference
4001 if (vm.$el) {
4002 vm.$el.__vue__ = null;
4003 }
4004 // release circular reference (#6759)
4005 if (vm.$vnode) {
4006 vm.$vnode.parent = null;
4007 }
4008 };
4009}
4010
4011function mountComponent (
4012 vm,
4013 el,
4014 hydrating
4015) {
4016 vm.$el = el;
4017 if (!vm.$options.render) {
4018 vm.$options.render = createEmptyVNode;
4019 if (process.env.NODE_ENV !== 'production') {
4020 /* istanbul ignore if */
4021 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
4022 vm.$options.el || el) {
4023 warn(
4024 'You are using the runtime-only build of Vue where the template ' +
4025 'compiler is not available. Either pre-compile the templates into ' +
4026 'render functions, or use the compiler-included build.',
4027 vm
4028 );
4029 } else {
4030 warn(
4031 'Failed to mount component: template or render function not defined.',
4032 vm
4033 );
4034 }
4035 }
4036 }
4037 callHook(vm, 'beforeMount');
4038
4039 var updateComponent;
4040 /* istanbul ignore if */
4041 if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
4042 updateComponent = function () {
4043 var name = vm._name;
4044 var id = vm._uid;
4045 var startTag = "vue-perf-start:" + id;
4046 var endTag = "vue-perf-end:" + id;
4047
4048 mark(startTag);
4049 var vnode = vm._render();
4050 mark(endTag);
4051 measure(("vue " + name + " render"), startTag, endTag);
4052
4053 mark(startTag);
4054 vm._update(vnode, hydrating);
4055 mark(endTag);
4056 measure(("vue " + name + " patch"), startTag, endTag);
4057 };
4058 } else {
4059 updateComponent = function () {
4060 vm._update(vm._render(), hydrating);
4061 };
4062 }
4063
4064 // we set this to vm._watcher inside the watcher's constructor
4065 // since the watcher's initial patch may call $forceUpdate (e.g. inside child
4066 // component's mounted hook), which relies on vm._watcher being already defined
4067 new Watcher(vm, updateComponent, noop, {
4068 before: function before () {
4069 if (vm._isMounted && !vm._isDestroyed) {
4070 callHook(vm, 'beforeUpdate');
4071 }
4072 }
4073 }, true /* isRenderWatcher */);
4074 hydrating = false;
4075
4076 // manually mounted instance, call mounted on self
4077 // mounted is called for render-created child components in its inserted hook
4078 if (vm.$vnode == null) {
4079 vm._isMounted = true;
4080 callHook(vm, 'mounted');
4081 }
4082 return vm
4083}
4084
4085function updateChildComponent (
4086 vm,
4087 propsData,
4088 listeners,
4089 parentVnode,
4090 renderChildren
4091) {
4092 if (process.env.NODE_ENV !== 'production') {
4093 isUpdatingChildComponent = true;
4094 }
4095
4096 // determine whether component has slot children
4097 // we need to do this before overwriting $options._renderChildren.
4098
4099 // check if there are dynamic scopedSlots (hand-written or compiled but with
4100 // dynamic slot names). Static scoped slots compiled from template has the
4101 // "$stable" marker.
4102 var newScopedSlots = parentVnode.data.scopedSlots;
4103 var oldScopedSlots = vm.$scopedSlots;
4104 var hasDynamicScopedSlot = !!(
4105 (newScopedSlots && !newScopedSlots.$stable) ||
4106 (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4107 (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
4108 );
4109
4110 // Any static slot children from the parent may have changed during parent's
4111 // update. Dynamic scoped slots may also have changed. In such cases, a forced
4112 // update is necessary to ensure correctness.
4113 var needsForceUpdate = !!(
4114 renderChildren || // has new static slots
4115 vm.$options._renderChildren || // has old static slots
4116 hasDynamicScopedSlot
4117 );
4118
4119 vm.$options._parentVnode = parentVnode;
4120 vm.$vnode = parentVnode; // update vm's placeholder node without re-render
4121
4122 if (vm._vnode) { // update child tree's parent
4123 vm._vnode.parent = parentVnode;
4124 }
4125 vm.$options._renderChildren = renderChildren;
4126
4127 // update $attrs and $listeners hash
4128 // these are also reactive so they may trigger child update if the child
4129 // used them during render
4130 vm.$attrs = parentVnode.data.attrs || emptyObject;
4131 vm.$listeners = listeners || emptyObject;
4132
4133 // update props
4134 if (propsData && vm.$options.props) {
4135 toggleObserving(false);
4136 var props = vm._props;
4137 var propKeys = vm.$options._propKeys || [];
4138 for (var i = 0; i < propKeys.length; i++) {
4139 var key = propKeys[i];
4140 var propOptions = vm.$options.props; // wtf flow?
4141 props[key] = validateProp(key, propOptions, propsData, vm);
4142 }
4143 toggleObserving(true);
4144 // keep a copy of raw propsData
4145 vm.$options.propsData = propsData;
4146 }
4147
4148 // update listeners
4149 listeners = listeners || emptyObject;
4150 var oldListeners = vm.$options._parentListeners;
4151 vm.$options._parentListeners = listeners;
4152 updateComponentListeners(vm, listeners, oldListeners);
4153
4154 // resolve slots + force update if has children
4155 if (needsForceUpdate) {
4156 vm.$slots = resolveSlots(renderChildren, parentVnode.context);
4157 vm.$forceUpdate();
4158 }
4159
4160 if (process.env.NODE_ENV !== 'production') {
4161 isUpdatingChildComponent = false;
4162 }
4163}
4164
4165function isInInactiveTree (vm) {
4166 while (vm && (vm = vm.$parent)) {
4167 if (vm._inactive) { return true }
4168 }
4169 return false
4170}
4171
4172function activateChildComponent (vm, direct) {
4173 if (direct) {
4174 vm._directInactive = false;
4175 if (isInInactiveTree(vm)) {
4176 return
4177 }
4178 } else if (vm._directInactive) {
4179 return
4180 }
4181 if (vm._inactive || vm._inactive === null) {
4182 vm._inactive = false;
4183 for (var i = 0; i < vm.$children.length; i++) {
4184 activateChildComponent(vm.$children[i]);
4185 }
4186 callHook(vm, 'activated');
4187 }
4188}
4189
4190function deactivateChildComponent (vm, direct) {
4191 if (direct) {
4192 vm._directInactive = true;
4193 if (isInInactiveTree(vm)) {
4194 return
4195 }
4196 }
4197 if (!vm._inactive) {
4198 vm._inactive = true;
4199 for (var i = 0; i < vm.$children.length; i++) {
4200 deactivateChildComponent(vm.$children[i]);
4201 }
4202 callHook(vm, 'deactivated');
4203 }
4204}
4205
4206function callHook (vm, hook) {
4207 // #7573 disable dep collection when invoking lifecycle hooks
4208 pushTarget();
4209 var handlers = vm.$options[hook];
4210 var info = hook + " hook";
4211 if (handlers) {
4212 for (var i = 0, j = handlers.length; i < j; i++) {
4213 invokeWithErrorHandling(handlers[i], vm, null, vm, info);
4214 }
4215 }
4216 if (vm._hasHookEvent) {
4217 vm.$emit('hook:' + hook);
4218 }
4219 popTarget();
4220}
4221
4222/* */
4223
4224var MAX_UPDATE_COUNT = 100;
4225
4226var queue = [];
4227var activatedChildren = [];
4228var has = {};
4229var circular = {};
4230var waiting = false;
4231var flushing = false;
4232var index = 0;
4233
4234/**
4235 * Reset the scheduler's state.
4236 */
4237function resetSchedulerState () {
4238 index = queue.length = activatedChildren.length = 0;
4239 has = {};
4240 if (process.env.NODE_ENV !== 'production') {
4241 circular = {};
4242 }
4243 waiting = flushing = false;
4244}
4245
4246// Async edge case #6566 requires saving the timestamp when event listeners are
4247// attached. However, calling performance.now() has a perf overhead especially
4248// if the page has thousands of event listeners. Instead, we take a timestamp
4249// every time the scheduler flushes and use that for all event listeners
4250// attached during that flush.
4251var currentFlushTimestamp = 0;
4252
4253// Async edge case fix requires storing an event listener's attach timestamp.
4254var getNow = Date.now;
4255
4256// Determine what event timestamp the browser is using. Annoyingly, the
4257// timestamp can either be hi-res (relative to page load) or low-res
4258// (relative to UNIX epoch), so in order to compare time we have to use the
4259// same timestamp type when saving the flush timestamp.
4260// All IE versions use low-res event timestamps, and have problematic clock
4261// implementations (#9632)
4262if (inBrowser && !isIE) {
4263 var performance = window.performance;
4264 if (
4265 performance &&
4266 typeof performance.now === 'function' &&
4267 getNow() > document.createEvent('Event').timeStamp
4268 ) {
4269 // if the event timestamp, although evaluated AFTER the Date.now(), is
4270 // smaller than it, it means the event is using a hi-res timestamp,
4271 // and we need to use the hi-res version for event listener timestamps as
4272 // well.
4273 getNow = function () { return performance.now(); };
4274 }
4275}
4276
4277/**
4278 * Flush both queues and run the watchers.
4279 */
4280function flushSchedulerQueue () {
4281 currentFlushTimestamp = getNow();
4282 flushing = true;
4283 var watcher, id;
4284
4285 // Sort queue before flush.
4286 // This ensures that:
4287 // 1. Components are updated from parent to child. (because parent is always
4288 // created before the child)
4289 // 2. A component's user watchers are run before its render watcher (because
4290 // user watchers are created before the render watcher)
4291 // 3. If a component is destroyed during a parent component's watcher run,
4292 // its watchers can be skipped.
4293 queue.sort(function (a, b) { return a.id - b.id; });
4294
4295 // do not cache length because more watchers might be pushed
4296 // as we run existing watchers
4297 for (index = 0; index < queue.length; index++) {
4298 watcher = queue[index];
4299 if (watcher.before) {
4300 watcher.before();
4301 }
4302 id = watcher.id;
4303 has[id] = null;
4304 watcher.run();
4305 // in dev build, check and stop circular updates.
4306 if (process.env.NODE_ENV !== 'production' && has[id] != null) {
4307 circular[id] = (circular[id] || 0) + 1;
4308 if (circular[id] > MAX_UPDATE_COUNT) {
4309 warn(
4310 'You may have an infinite update loop ' + (
4311 watcher.user
4312 ? ("in watcher with expression \"" + (watcher.expression) + "\"")
4313 : "in a component render function."
4314 ),
4315 watcher.vm
4316 );
4317 break
4318 }
4319 }
4320 }
4321
4322 // keep copies of post queues before resetting state
4323 var activatedQueue = activatedChildren.slice();
4324 var updatedQueue = queue.slice();
4325
4326 resetSchedulerState();
4327
4328 // call component updated and activated hooks
4329 callActivatedHooks(activatedQueue);
4330 callUpdatedHooks(updatedQueue);
4331
4332 // devtool hook
4333 /* istanbul ignore if */
4334 if (devtools && config.devtools) {
4335 devtools.emit('flush');
4336 }
4337}
4338
4339function callUpdatedHooks (queue) {
4340 var i = queue.length;
4341 while (i--) {
4342 var watcher = queue[i];
4343 var vm = watcher.vm;
4344 if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
4345 callHook(vm, 'updated');
4346 }
4347 }
4348}
4349
4350/**
4351 * Queue a kept-alive component that was activated during patch.
4352 * The queue will be processed after the entire tree has been patched.
4353 */
4354function queueActivatedComponent (vm) {
4355 // setting _inactive to false here so that a render function can
4356 // rely on checking whether it's in an inactive tree (e.g. router-view)
4357 vm._inactive = false;
4358 activatedChildren.push(vm);
4359}
4360
4361function callActivatedHooks (queue) {
4362 for (var i = 0; i < queue.length; i++) {
4363 queue[i]._inactive = true;
4364 activateChildComponent(queue[i], true /* true */);
4365 }
4366}
4367
4368/**
4369 * Push a watcher into the watcher queue.
4370 * Jobs with duplicate IDs will be skipped unless it's
4371 * pushed when the queue is being flushed.
4372 */
4373function queueWatcher (watcher) {
4374 var id = watcher.id;
4375 if (has[id] == null) {
4376 has[id] = true;
4377 if (!flushing) {
4378 queue.push(watcher);
4379 } else {
4380 // if already flushing, splice the watcher based on its id
4381 // if already past its id, it will be run next immediately.
4382 var i = queue.length - 1;
4383 while (i > index && queue[i].id > watcher.id) {
4384 i--;
4385 }
4386 queue.splice(i + 1, 0, watcher);
4387 }
4388 // queue the flush
4389 if (!waiting) {
4390 waiting = true;
4391
4392 if (process.env.NODE_ENV !== 'production' && !config.async) {
4393 flushSchedulerQueue();
4394 return
4395 }
4396 nextTick(flushSchedulerQueue);
4397 }
4398 }
4399}
4400
4401/* */
4402
4403
4404
4405var uid$2 = 0;
4406
4407/**
4408 * A watcher parses an expression, collects dependencies,
4409 * and fires callback when the expression value changes.
4410 * This is used for both the $watch() api and directives.
4411 */
4412var Watcher = function Watcher (
4413 vm,
4414 expOrFn,
4415 cb,
4416 options,
4417 isRenderWatcher
4418) {
4419 this.vm = vm;
4420 if (isRenderWatcher) {
4421 vm._watcher = this;
4422 }
4423 vm._watchers.push(this);
4424 // options
4425 if (options) {
4426 this.deep = !!options.deep;
4427 this.user = !!options.user;
4428 this.lazy = !!options.lazy;
4429 this.sync = !!options.sync;
4430 this.before = options.before;
4431 } else {
4432 this.deep = this.user = this.lazy = this.sync = false;
4433 }
4434 this.cb = cb;
4435 this.id = ++uid$2; // uid for batching
4436 this.active = true;
4437 this.dirty = this.lazy; // for lazy watchers
4438 this.deps = [];
4439 this.newDeps = [];
4440 this.depIds = new _Set();
4441 this.newDepIds = new _Set();
4442 this.expression = process.env.NODE_ENV !== 'production'
4443 ? expOrFn.toString()
4444 : '';
4445 // parse expression for getter
4446 if (typeof expOrFn === 'function') {
4447 this.getter = expOrFn;
4448 } else {
4449 this.getter = parsePath(expOrFn);
4450 if (!this.getter) {
4451 this.getter = noop;
4452 process.env.NODE_ENV !== 'production' && warn(
4453 "Failed watching path: \"" + expOrFn + "\" " +
4454 'Watcher only accepts simple dot-delimited paths. ' +
4455 'For full control, use a function instead.',
4456 vm
4457 );
4458 }
4459 }
4460 this.value = this.lazy
4461 ? undefined
4462 : this.get();
4463};
4464
4465/**
4466 * Evaluate the getter, and re-collect dependencies.
4467 */
4468Watcher.prototype.get = function get () {
4469 pushTarget(this);
4470 var value;
4471 var vm = this.vm;
4472 try {
4473 value = this.getter.call(vm, vm);
4474 } catch (e) {
4475 if (this.user) {
4476 handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
4477 } else {
4478 throw e
4479 }
4480 } finally {
4481 // "touch" every property so they are all tracked as
4482 // dependencies for deep watching
4483 if (this.deep) {
4484 traverse(value);
4485 }
4486 popTarget();
4487 this.cleanupDeps();
4488 }
4489 return value
4490};
4491
4492/**
4493 * Add a dependency to this directive.
4494 */
4495Watcher.prototype.addDep = function addDep (dep) {
4496 var id = dep.id;
4497 if (!this.newDepIds.has(id)) {
4498 this.newDepIds.add(id);
4499 this.newDeps.push(dep);
4500 if (!this.depIds.has(id)) {
4501 dep.addSub(this);
4502 }
4503 }
4504};
4505
4506/**
4507 * Clean up for dependency collection.
4508 */
4509Watcher.prototype.cleanupDeps = function cleanupDeps () {
4510 var i = this.deps.length;
4511 while (i--) {
4512 var dep = this.deps[i];
4513 if (!this.newDepIds.has(dep.id)) {
4514 dep.removeSub(this);
4515 }
4516 }
4517 var tmp = this.depIds;
4518 this.depIds = this.newDepIds;
4519 this.newDepIds = tmp;
4520 this.newDepIds.clear();
4521 tmp = this.deps;
4522 this.deps = this.newDeps;
4523 this.newDeps = tmp;
4524 this.newDeps.length = 0;
4525};
4526
4527/**
4528 * Subscriber interface.
4529 * Will be called when a dependency changes.
4530 */
4531Watcher.prototype.update = function update () {
4532 /* istanbul ignore else */
4533 if (this.lazy) {
4534 this.dirty = true;
4535 } else if (this.sync) {
4536 this.run();
4537 } else {
4538 queueWatcher(this);
4539 }
4540};
4541
4542/**
4543 * Scheduler job interface.
4544 * Will be called by the scheduler.
4545 */
4546Watcher.prototype.run = function run () {
4547 if (this.active) {
4548 var value = this.get();
4549 if (
4550 value !== this.value ||
4551 // Deep watchers and watchers on Object/Arrays should fire even
4552 // when the value is the same, because the value may
4553 // have mutated.
4554 isObject(value) ||
4555 this.deep
4556 ) {
4557 // set new value
4558 var oldValue = this.value;
4559 this.value = value;
4560 if (this.user) {
4561 try {
4562 this.cb.call(this.vm, value, oldValue);
4563 } catch (e) {
4564 handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
4565 }
4566 } else {
4567 this.cb.call(this.vm, value, oldValue);
4568 }
4569 }
4570 }
4571};
4572
4573/**
4574 * Evaluate the value of the watcher.
4575 * This only gets called for lazy watchers.
4576 */
4577Watcher.prototype.evaluate = function evaluate () {
4578 this.value = this.get();
4579 this.dirty = false;
4580};
4581
4582/**
4583 * Depend on all deps collected by this watcher.
4584 */
4585Watcher.prototype.depend = function depend () {
4586 var i = this.deps.length;
4587 while (i--) {
4588 this.deps[i].depend();
4589 }
4590};
4591
4592/**
4593 * Remove self from all dependencies' subscriber list.
4594 */
4595Watcher.prototype.teardown = function teardown () {
4596 if (this.active) {
4597 // remove self from vm's watcher list
4598 // this is a somewhat expensive operation so we skip it
4599 // if the vm is being destroyed.
4600 if (!this.vm._isBeingDestroyed) {
4601 remove(this.vm._watchers, this);
4602 }
4603 var i = this.deps.length;
4604 while (i--) {
4605 this.deps[i].removeSub(this);
4606 }
4607 this.active = false;
4608 }
4609};
4610
4611/* */
4612
4613var sharedPropertyDefinition = {
4614 enumerable: true,
4615 configurable: true,
4616 get: noop,
4617 set: noop
4618};
4619
4620function proxy (target, sourceKey, key) {
4621 sharedPropertyDefinition.get = function proxyGetter () {
4622 return this[sourceKey][key]
4623 };
4624 sharedPropertyDefinition.set = function proxySetter (val) {
4625 this[sourceKey][key] = val;
4626 };
4627 Object.defineProperty(target, key, sharedPropertyDefinition);
4628}
4629
4630function initState (vm) {
4631 vm._watchers = [];
4632 var opts = vm.$options;
4633 if (opts.props) { initProps(vm, opts.props); }
4634 if (opts.methods) { initMethods(vm, opts.methods); }
4635 if (opts.data) {
4636 initData(vm);
4637 } else {
4638 observe(vm._data = {}, true /* asRootData */);
4639 }
4640 if (opts.computed) { initComputed(vm, opts.computed); }
4641 if (opts.watch && opts.watch !== nativeWatch) {
4642 initWatch(vm, opts.watch);
4643 }
4644}
4645
4646function initProps (vm, propsOptions) {
4647 var propsData = vm.$options.propsData || {};
4648 var props = vm._props = {};
4649 // cache prop keys so that future props updates can iterate using Array
4650 // instead of dynamic object key enumeration.
4651 var keys = vm.$options._propKeys = [];
4652 var isRoot = !vm.$parent;
4653 // root instance props should be converted
4654 if (!isRoot) {
4655 toggleObserving(false);
4656 }
4657 var loop = function ( key ) {
4658 keys.push(key);
4659 var value = validateProp(key, propsOptions, propsData, vm);
4660 /* istanbul ignore else */
4661 if (process.env.NODE_ENV !== 'production') {
4662 var hyphenatedKey = hyphenate(key);
4663 if (isReservedAttribute(hyphenatedKey) ||
4664 config.isReservedAttr(hyphenatedKey)) {
4665 warn(
4666 ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
4667 vm
4668 );
4669 }
4670 defineReactive$$1(props, key, value, function () {
4671 if (!isRoot && !isUpdatingChildComponent) {
4672 warn(
4673 "Avoid mutating a prop directly since the value will be " +
4674 "overwritten whenever the parent component re-renders. " +
4675 "Instead, use a data or computed property based on the prop's " +
4676 "value. Prop being mutated: \"" + key + "\"",
4677 vm
4678 );
4679 }
4680 });
4681 } else {
4682 defineReactive$$1(props, key, value);
4683 }
4684 // static props are already proxied on the component's prototype
4685 // during Vue.extend(). We only need to proxy props defined at
4686 // instantiation here.
4687 if (!(key in vm)) {
4688 proxy(vm, "_props", key);
4689 }
4690 };
4691
4692 for (var key in propsOptions) loop( key );
4693 toggleObserving(true);
4694}
4695
4696function initData (vm) {
4697 var data = vm.$options.data;
4698 data = vm._data = typeof data === 'function'
4699 ? getData(data, vm)
4700 : data || {};
4701 if (!isPlainObject(data)) {
4702 data = {};
4703 process.env.NODE_ENV !== 'production' && warn(
4704 'data functions should return an object:\n' +
4705 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
4706 vm
4707 );
4708 }
4709 // proxy data on instance
4710 var keys = Object.keys(data);
4711 var props = vm.$options.props;
4712 var methods = vm.$options.methods;
4713 var i = keys.length;
4714 while (i--) {
4715 var key = keys[i];
4716 if (process.env.NODE_ENV !== 'production') {
4717 if (methods && hasOwn(methods, key)) {
4718 warn(
4719 ("Method \"" + key + "\" has already been defined as a data property."),
4720 vm
4721 );
4722 }
4723 }
4724 if (props && hasOwn(props, key)) {
4725 process.env.NODE_ENV !== 'production' && warn(
4726 "The data property \"" + key + "\" is already declared as a prop. " +
4727 "Use prop default value instead.",
4728 vm
4729 );
4730 } else if (!isReserved(key)) {
4731 proxy(vm, "_data", key);
4732 }
4733 }
4734 // observe data
4735 observe(data, true /* asRootData */);
4736}
4737
4738function getData (data, vm) {
4739 // #7573 disable dep collection when invoking data getters
4740 pushTarget();
4741 try {
4742 return data.call(vm, vm)
4743 } catch (e) {
4744 handleError(e, vm, "data()");
4745 return {}
4746 } finally {
4747 popTarget();
4748 }
4749}
4750
4751var computedWatcherOptions = { lazy: true };
4752
4753function initComputed (vm, computed) {
4754 // $flow-disable-line
4755 var watchers = vm._computedWatchers = Object.create(null);
4756 // computed properties are just getters during SSR
4757 var isSSR = isServerRendering();
4758
4759 for (var key in computed) {
4760 var userDef = computed[key];
4761 var getter = typeof userDef === 'function' ? userDef : userDef.get;
4762 if (process.env.NODE_ENV !== 'production' && getter == null) {
4763 warn(
4764 ("Getter is missing for computed property \"" + key + "\"."),
4765 vm
4766 );
4767 }
4768
4769 if (!isSSR) {
4770 // create internal watcher for the computed property.
4771 watchers[key] = new Watcher(
4772 vm,
4773 getter || noop,
4774 noop,
4775 computedWatcherOptions
4776 );
4777 }
4778
4779 // component-defined computed properties are already defined on the
4780 // component prototype. We only need to define computed properties defined
4781 // at instantiation here.
4782 if (!(key in vm)) {
4783 defineComputed(vm, key, userDef);
4784 } else if (process.env.NODE_ENV !== 'production') {
4785 if (key in vm.$data) {
4786 warn(("The computed property \"" + key + "\" is already defined in data."), vm);
4787 } else if (vm.$options.props && key in vm.$options.props) {
4788 warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
4789 }
4790 }
4791 }
4792}
4793
4794function defineComputed (
4795 target,
4796 key,
4797 userDef
4798) {
4799 var shouldCache = !isServerRendering();
4800 if (typeof userDef === 'function') {
4801 sharedPropertyDefinition.get = shouldCache
4802 ? createComputedGetter(key)
4803 : createGetterInvoker(userDef);
4804 sharedPropertyDefinition.set = noop;
4805 } else {
4806 sharedPropertyDefinition.get = userDef.get
4807 ? shouldCache && userDef.cache !== false
4808 ? createComputedGetter(key)
4809 : createGetterInvoker(userDef.get)
4810 : noop;
4811 sharedPropertyDefinition.set = userDef.set || noop;
4812 }
4813 if (process.env.NODE_ENV !== 'production' &&
4814 sharedPropertyDefinition.set === noop) {
4815 sharedPropertyDefinition.set = function () {
4816 warn(
4817 ("Computed property \"" + key + "\" was assigned to but it has no setter."),
4818 this
4819 );
4820 };
4821 }
4822 Object.defineProperty(target, key, sharedPropertyDefinition);
4823}
4824
4825function createComputedGetter (key) {
4826 return function computedGetter () {
4827 var watcher = this._computedWatchers && this._computedWatchers[key];
4828 if (watcher) {
4829 if (watcher.dirty) {
4830 watcher.evaluate();
4831 }
4832 if (Dep.target) {
4833 watcher.depend();
4834 }
4835 return watcher.value
4836 }
4837 }
4838}
4839
4840function createGetterInvoker(fn) {
4841 return function computedGetter () {
4842 return fn.call(this, this)
4843 }
4844}
4845
4846function initMethods (vm, methods) {
4847 var props = vm.$options.props;
4848 for (var key in methods) {
4849 if (process.env.NODE_ENV !== 'production') {
4850 if (typeof methods[key] !== 'function') {
4851 warn(
4852 "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
4853 "Did you reference the function correctly?",
4854 vm
4855 );
4856 }
4857 if (props && hasOwn(props, key)) {
4858 warn(
4859 ("Method \"" + key + "\" has already been defined as a prop."),
4860 vm
4861 );
4862 }
4863 if ((key in vm) && isReserved(key)) {
4864 warn(
4865 "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
4866 "Avoid defining component methods that start with _ or $."
4867 );
4868 }
4869 }
4870 vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
4871 }
4872}
4873
4874function initWatch (vm, watch) {
4875 for (var key in watch) {
4876 var handler = watch[key];
4877 if (Array.isArray(handler)) {
4878 for (var i = 0; i < handler.length; i++) {
4879 createWatcher(vm, key, handler[i]);
4880 }
4881 } else {
4882 createWatcher(vm, key, handler);
4883 }
4884 }
4885}
4886
4887function createWatcher (
4888 vm,
4889 expOrFn,
4890 handler,
4891 options
4892) {
4893 if (isPlainObject(handler)) {
4894 options = handler;
4895 handler = handler.handler;
4896 }
4897 if (typeof handler === 'string') {
4898 handler = vm[handler];
4899 }
4900 return vm.$watch(expOrFn, handler, options)
4901}
4902
4903function stateMixin (Vue) {
4904 // flow somehow has problems with directly declared definition object
4905 // when using Object.defineProperty, so we have to procedurally build up
4906 // the object here.
4907 var dataDef = {};
4908 dataDef.get = function () { return this._data };
4909 var propsDef = {};
4910 propsDef.get = function () { return this._props };
4911 if (process.env.NODE_ENV !== 'production') {
4912 dataDef.set = function () {
4913 warn(
4914 'Avoid replacing instance root $data. ' +
4915 'Use nested data properties instead.',
4916 this
4917 );
4918 };
4919 propsDef.set = function () {
4920 warn("$props is readonly.", this);
4921 };
4922 }
4923 Object.defineProperty(Vue.prototype, '$data', dataDef);
4924 Object.defineProperty(Vue.prototype, '$props', propsDef);
4925
4926 Vue.prototype.$set = set;
4927 Vue.prototype.$delete = del;
4928
4929 Vue.prototype.$watch = function (
4930 expOrFn,
4931 cb,
4932 options
4933 ) {
4934 var vm = this;
4935 if (isPlainObject(cb)) {
4936 return createWatcher(vm, expOrFn, cb, options)
4937 }
4938 options = options || {};
4939 options.user = true;
4940 var watcher = new Watcher(vm, expOrFn, cb, options);
4941 if (options.immediate) {
4942 try {
4943 cb.call(vm, watcher.value);
4944 } catch (error) {
4945 handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
4946 }
4947 }
4948 return function unwatchFn () {
4949 watcher.teardown();
4950 }
4951 };
4952}
4953
4954/* */
4955
4956var uid$3 = 0;
4957
4958function initMixin (Vue) {
4959 Vue.prototype._init = function (options) {
4960 var vm = this;
4961 // a uid
4962 vm._uid = uid$3++;
4963
4964 var startTag, endTag;
4965 /* istanbul ignore if */
4966 if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
4967 startTag = "vue-perf-start:" + (vm._uid);
4968 endTag = "vue-perf-end:" + (vm._uid);
4969 mark(startTag);
4970 }
4971
4972 // a flag to avoid this being observed
4973 vm._isVue = true;
4974 // merge options
4975 if (options && options._isComponent) {
4976 // optimize internal component instantiation
4977 // since dynamic options merging is pretty slow, and none of the
4978 // internal component options needs special treatment.
4979 initInternalComponent(vm, options);
4980 } else {
4981 vm.$options = mergeOptions(
4982 resolveConstructorOptions(vm.constructor),
4983 options || {},
4984 vm
4985 );
4986 }
4987 /* istanbul ignore else */
4988 if (process.env.NODE_ENV !== 'production') {
4989 initProxy(vm);
4990 } else {
4991 vm._renderProxy = vm;
4992 }
4993 // expose real self
4994 vm._self = vm;
4995 initLifecycle(vm);
4996 initEvents(vm);
4997 initRender(vm);
4998 callHook(vm, 'beforeCreate');
4999 initInjections(vm); // resolve injections before data/props
5000 initState(vm);
5001 initProvide(vm); // resolve provide after data/props
5002 callHook(vm, 'created');
5003
5004 /* istanbul ignore if */
5005 if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
5006 vm._name = formatComponentName(vm, false);
5007 mark(endTag);
5008 measure(("vue " + (vm._name) + " init"), startTag, endTag);
5009 }
5010
5011 if (vm.$options.el) {
5012 vm.$mount(vm.$options.el);
5013 }
5014 };
5015}
5016
5017function initInternalComponent (vm, options) {
5018 var opts = vm.$options = Object.create(vm.constructor.options);
5019 // doing this because it's faster than dynamic enumeration.
5020 var parentVnode = options._parentVnode;
5021 opts.parent = options.parent;
5022 opts._parentVnode = parentVnode;
5023
5024 var vnodeComponentOptions = parentVnode.componentOptions;
5025 opts.propsData = vnodeComponentOptions.propsData;
5026 opts._parentListeners = vnodeComponentOptions.listeners;
5027 opts._renderChildren = vnodeComponentOptions.children;
5028 opts._componentTag = vnodeComponentOptions.tag;
5029
5030 if (options.render) {
5031 opts.render = options.render;
5032 opts.staticRenderFns = options.staticRenderFns;
5033 }
5034}
5035
5036function resolveConstructorOptions (Ctor) {
5037 var options = Ctor.options;
5038 if (Ctor.super) {
5039 var superOptions = resolveConstructorOptions(Ctor.super);
5040 var cachedSuperOptions = Ctor.superOptions;
5041 if (superOptions !== cachedSuperOptions) {
5042 // super option changed,
5043 // need to resolve new options.
5044 Ctor.superOptions = superOptions;
5045 // check if there are any late-modified/attached options (#4976)
5046 var modifiedOptions = resolveModifiedOptions(Ctor);
5047 // update base extend options
5048 if (modifiedOptions) {
5049 extend(Ctor.extendOptions, modifiedOptions);
5050 }
5051 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
5052 if (options.name) {
5053 options.components[options.name] = Ctor;
5054 }
5055 }
5056 }
5057 return options
5058}
5059
5060function resolveModifiedOptions (Ctor) {
5061 var modified;
5062 var latest = Ctor.options;
5063 var sealed = Ctor.sealedOptions;
5064 for (var key in latest) {
5065 if (latest[key] !== sealed[key]) {
5066 if (!modified) { modified = {}; }
5067 modified[key] = latest[key];
5068 }
5069 }
5070 return modified
5071}
5072
5073function Vue (options) {
5074 if (process.env.NODE_ENV !== 'production' &&
5075 !(this instanceof Vue)
5076 ) {
5077 warn('Vue is a constructor and should be called with the `new` keyword');
5078 }
5079 this._init(options);
5080}
5081
5082initMixin(Vue);
5083stateMixin(Vue);
5084eventsMixin(Vue);
5085lifecycleMixin(Vue);
5086renderMixin(Vue);
5087
5088/* */
5089
5090function initUse (Vue) {
5091 Vue.use = function (plugin) {
5092 var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
5093 if (installedPlugins.indexOf(plugin) > -1) {
5094 return this
5095 }
5096
5097 // additional parameters
5098 var args = toArray(arguments, 1);
5099 args.unshift(this);
5100 if (typeof plugin.install === 'function') {
5101 plugin.install.apply(plugin, args);
5102 } else if (typeof plugin === 'function') {
5103 plugin.apply(null, args);
5104 }
5105 installedPlugins.push(plugin);
5106 return this
5107 };
5108}
5109
5110/* */
5111
5112function initMixin$1 (Vue) {
5113 Vue.mixin = function (mixin) {
5114 this.options = mergeOptions(this.options, mixin);
5115 return this
5116 };
5117}
5118
5119/* */
5120
5121function initExtend (Vue) {
5122 /**
5123 * Each instance constructor, including Vue, has a unique
5124 * cid. This enables us to create wrapped "child
5125 * constructors" for prototypal inheritance and cache them.
5126 */
5127 Vue.cid = 0;
5128 var cid = 1;
5129
5130 /**
5131 * Class inheritance
5132 */
5133 Vue.extend = function (extendOptions) {
5134 extendOptions = extendOptions || {};
5135 var Super = this;
5136 var SuperId = Super.cid;
5137 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
5138 if (cachedCtors[SuperId]) {
5139 return cachedCtors[SuperId]
5140 }
5141
5142 var name = extendOptions.name || Super.options.name;
5143 if (process.env.NODE_ENV !== 'production' && name) {
5144 validateComponentName(name);
5145 }
5146
5147 var Sub = function VueComponent (options) {
5148 this._init(options);
5149 };
5150 Sub.prototype = Object.create(Super.prototype);
5151 Sub.prototype.constructor = Sub;
5152 Sub.cid = cid++;
5153 Sub.options = mergeOptions(
5154 Super.options,
5155 extendOptions
5156 );
5157 Sub['super'] = Super;
5158
5159 // For props and computed properties, we define the proxy getters on
5160 // the Vue instances at extension time, on the extended prototype. This
5161 // avoids Object.defineProperty calls for each instance created.
5162 if (Sub.options.props) {
5163 initProps$1(Sub);
5164 }
5165 if (Sub.options.computed) {
5166 initComputed$1(Sub);
5167 }
5168
5169 // allow further extension/mixin/plugin usage
5170 Sub.extend = Super.extend;
5171 Sub.mixin = Super.mixin;
5172 Sub.use = Super.use;
5173
5174 // create asset registers, so extended classes
5175 // can have their private assets too.
5176 ASSET_TYPES.forEach(function (type) {
5177 Sub[type] = Super[type];
5178 });
5179 // enable recursive self-lookup
5180 if (name) {
5181 Sub.options.components[name] = Sub;
5182 }
5183
5184 // keep a reference to the super options at extension time.
5185 // later at instantiation we can check if Super's options have
5186 // been updated.
5187 Sub.superOptions = Super.options;
5188 Sub.extendOptions = extendOptions;
5189 Sub.sealedOptions = extend({}, Sub.options);
5190
5191 // cache constructor
5192 cachedCtors[SuperId] = Sub;
5193 return Sub
5194 };
5195}
5196
5197function initProps$1 (Comp) {
5198 var props = Comp.options.props;
5199 for (var key in props) {
5200 proxy(Comp.prototype, "_props", key);
5201 }
5202}
5203
5204function initComputed$1 (Comp) {
5205 var computed = Comp.options.computed;
5206 for (var key in computed) {
5207 defineComputed(Comp.prototype, key, computed[key]);
5208 }
5209}
5210
5211/* */
5212
5213function initAssetRegisters (Vue) {
5214 /**
5215 * Create asset registration methods.
5216 */
5217 ASSET_TYPES.forEach(function (type) {
5218 Vue[type] = function (
5219 id,
5220 definition
5221 ) {
5222 if (!definition) {
5223 return this.options[type + 's'][id]
5224 } else {
5225 /* istanbul ignore if */
5226 if (process.env.NODE_ENV !== 'production' && type === 'component') {
5227 validateComponentName(id);
5228 }
5229 if (type === 'component' && isPlainObject(definition)) {
5230 definition.name = definition.name || id;
5231 definition = this.options._base.extend(definition);
5232 }
5233 if (type === 'directive' && typeof definition === 'function') {
5234 definition = { bind: definition, update: definition };
5235 }
5236 this.options[type + 's'][id] = definition;
5237 return definition
5238 }
5239 };
5240 });
5241}
5242
5243/* */
5244
5245
5246
5247function getComponentName (opts) {
5248 return opts && (opts.Ctor.options.name || opts.tag)
5249}
5250
5251function matches (pattern, name) {
5252 if (Array.isArray(pattern)) {
5253 return pattern.indexOf(name) > -1
5254 } else if (typeof pattern === 'string') {
5255 return pattern.split(',').indexOf(name) > -1
5256 } else if (isRegExp(pattern)) {
5257 return pattern.test(name)
5258 }
5259 /* istanbul ignore next */
5260 return false
5261}
5262
5263function pruneCache (keepAliveInstance, filter) {
5264 var cache = keepAliveInstance.cache;
5265 var keys = keepAliveInstance.keys;
5266 var _vnode = keepAliveInstance._vnode;
5267 for (var key in cache) {
5268 var cachedNode = cache[key];
5269 if (cachedNode) {
5270 var name = getComponentName(cachedNode.componentOptions);
5271 if (name && !filter(name)) {
5272 pruneCacheEntry(cache, key, keys, _vnode);
5273 }
5274 }
5275 }
5276}
5277
5278function pruneCacheEntry (
5279 cache,
5280 key,
5281 keys,
5282 current
5283) {
5284 var cached$$1 = cache[key];
5285 if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
5286 cached$$1.componentInstance.$destroy();
5287 }
5288 cache[key] = null;
5289 remove(keys, key);
5290}
5291
5292var patternTypes = [String, RegExp, Array];
5293
5294var KeepAlive = {
5295 name: 'keep-alive',
5296 abstract: true,
5297
5298 props: {
5299 include: patternTypes,
5300 exclude: patternTypes,
5301 max: [String, Number]
5302 },
5303
5304 created: function created () {
5305 this.cache = Object.create(null);
5306 this.keys = [];
5307 },
5308
5309 destroyed: function destroyed () {
5310 for (var key in this.cache) {
5311 pruneCacheEntry(this.cache, key, this.keys);
5312 }
5313 },
5314
5315 mounted: function mounted () {
5316 var this$1 = this;
5317
5318 this.$watch('include', function (val) {
5319 pruneCache(this$1, function (name) { return matches(val, name); });
5320 });
5321 this.$watch('exclude', function (val) {
5322 pruneCache(this$1, function (name) { return !matches(val, name); });
5323 });
5324 },
5325
5326 render: function render () {
5327 var slot = this.$slots.default;
5328 var vnode = getFirstComponentChild(slot);
5329 var componentOptions = vnode && vnode.componentOptions;
5330 if (componentOptions) {
5331 // check pattern
5332 var name = getComponentName(componentOptions);
5333 var ref = this;
5334 var include = ref.include;
5335 var exclude = ref.exclude;
5336 if (
5337 // not included
5338 (include && (!name || !matches(include, name))) ||
5339 // excluded
5340 (exclude && name && matches(exclude, name))
5341 ) {
5342 return vnode
5343 }
5344
5345 var ref$1 = this;
5346 var cache = ref$1.cache;
5347 var keys = ref$1.keys;
5348 var key = vnode.key == null
5349 // same constructor may get registered as different local components
5350 // so cid alone is not enough (#3269)
5351 ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
5352 : vnode.key;
5353 if (cache[key]) {
5354 vnode.componentInstance = cache[key].componentInstance;
5355 // make current key freshest
5356 remove(keys, key);
5357 keys.push(key);
5358 } else {
5359 cache[key] = vnode;
5360 keys.push(key);
5361 // prune oldest entry
5362 if (this.max && keys.length > parseInt(this.max)) {
5363 pruneCacheEntry(cache, keys[0], keys, this._vnode);
5364 }
5365 }
5366
5367 vnode.data.keepAlive = true;
5368 }
5369 return vnode || (slot && slot[0])
5370 }
5371};
5372
5373var builtInComponents = {
5374 KeepAlive: KeepAlive
5375};
5376
5377/* */
5378
5379function initGlobalAPI (Vue) {
5380 // config
5381 var configDef = {};
5382 configDef.get = function () { return config; };
5383 if (process.env.NODE_ENV !== 'production') {
5384 configDef.set = function () {
5385 warn(
5386 'Do not replace the Vue.config object, set individual fields instead.'
5387 );
5388 };
5389 }
5390 Object.defineProperty(Vue, 'config', configDef);
5391
5392 // exposed util methods.
5393 // NOTE: these are not considered part of the public API - avoid relying on
5394 // them unless you are aware of the risk.
5395 Vue.util = {
5396 warn: warn,
5397 extend: extend,
5398 mergeOptions: mergeOptions,
5399 defineReactive: defineReactive$$1
5400 };
5401
5402 Vue.set = set;
5403 Vue.delete = del;
5404 Vue.nextTick = nextTick;
5405
5406 // 2.6 explicit observable API
5407 Vue.observable = function (obj) {
5408 observe(obj);
5409 return obj
5410 };
5411
5412 Vue.options = Object.create(null);
5413 ASSET_TYPES.forEach(function (type) {
5414 Vue.options[type + 's'] = Object.create(null);
5415 });
5416
5417 // this is used to identify the "base" constructor to extend all plain-object
5418 // components with in Weex's multi-instance scenarios.
5419 Vue.options._base = Vue;
5420
5421 extend(Vue.options.components, builtInComponents);
5422
5423 initUse(Vue);
5424 initMixin$1(Vue);
5425 initExtend(Vue);
5426 initAssetRegisters(Vue);
5427}
5428
5429initGlobalAPI(Vue);
5430
5431Object.defineProperty(Vue.prototype, '$isServer', {
5432 get: isServerRendering
5433});
5434
5435Object.defineProperty(Vue.prototype, '$ssrContext', {
5436 get: function get () {
5437 /* istanbul ignore next */
5438 return this.$vnode && this.$vnode.ssrContext
5439 }
5440});
5441
5442// expose FunctionalRenderContext for ssr runtime helper installation
5443Object.defineProperty(Vue, 'FunctionalRenderContext', {
5444 value: FunctionalRenderContext
5445});
5446
5447Vue.version = '2.6.10';
5448
5449/* */
5450
5451// these are reserved for web because they are directly compiled away
5452// during template compilation
5453var isReservedAttr = makeMap('style,class');
5454
5455// attributes that should be using props for binding
5456var acceptValue = makeMap('input,textarea,option,select,progress');
5457var mustUseProp = function (tag, type, attr) {
5458 return (
5459 (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
5460 (attr === 'selected' && tag === 'option') ||
5461 (attr === 'checked' && tag === 'input') ||
5462 (attr === 'muted' && tag === 'video')
5463 )
5464};
5465
5466var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
5467
5468var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
5469
5470var convertEnumeratedValue = function (key, value) {
5471 return isFalsyAttrValue(value) || value === 'false'
5472 ? 'false'
5473 // allow arbitrary string value for contenteditable
5474 : key === 'contenteditable' && isValidContentEditableValue(value)
5475 ? value
5476 : 'true'
5477};
5478
5479var isBooleanAttr = makeMap(
5480 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
5481 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
5482 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
5483 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
5484 'required,reversed,scoped,seamless,selected,sortable,translate,' +
5485 'truespeed,typemustmatch,visible'
5486);
5487
5488var xlinkNS = 'http://www.w3.org/1999/xlink';
5489
5490var isXlink = function (name) {
5491 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
5492};
5493
5494var getXlinkProp = function (name) {
5495 return isXlink(name) ? name.slice(6, name.length) : ''
5496};
5497
5498var isFalsyAttrValue = function (val) {
5499 return val == null || val === false
5500};
5501
5502/* */
5503
5504function genClassForVnode (vnode) {
5505 var data = vnode.data;
5506 var parentNode = vnode;
5507 var childNode = vnode;
5508 while (isDef(childNode.componentInstance)) {
5509 childNode = childNode.componentInstance._vnode;
5510 if (childNode && childNode.data) {
5511 data = mergeClassData(childNode.data, data);
5512 }
5513 }
5514 while (isDef(parentNode = parentNode.parent)) {
5515 if (parentNode && parentNode.data) {
5516 data = mergeClassData(data, parentNode.data);
5517 }
5518 }
5519 return renderClass(data.staticClass, data.class)
5520}
5521
5522function mergeClassData (child, parent) {
5523 return {
5524 staticClass: concat(child.staticClass, parent.staticClass),
5525 class: isDef(child.class)
5526 ? [child.class, parent.class]
5527 : parent.class
5528 }
5529}
5530
5531function renderClass (
5532 staticClass,
5533 dynamicClass
5534) {
5535 if (isDef(staticClass) || isDef(dynamicClass)) {
5536 return concat(staticClass, stringifyClass(dynamicClass))
5537 }
5538 /* istanbul ignore next */
5539 return ''
5540}
5541
5542function concat (a, b) {
5543 return a ? b ? (a + ' ' + b) : a : (b || '')
5544}
5545
5546function stringifyClass (value) {
5547 if (Array.isArray(value)) {
5548 return stringifyArray(value)
5549 }
5550 if (isObject(value)) {
5551 return stringifyObject(value)
5552 }
5553 if (typeof value === 'string') {
5554 return value
5555 }
5556 /* istanbul ignore next */
5557 return ''
5558}
5559
5560function stringifyArray (value) {
5561 var res = '';
5562 var stringified;
5563 for (var i = 0, l = value.length; i < l; i++) {
5564 if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
5565 if (res) { res += ' '; }
5566 res += stringified;
5567 }
5568 }
5569 return res
5570}
5571
5572function stringifyObject (value) {
5573 var res = '';
5574 for (var key in value) {
5575 if (value[key]) {
5576 if (res) { res += ' '; }
5577 res += key;
5578 }
5579 }
5580 return res
5581}
5582
5583/* */
5584
5585var namespaceMap = {
5586 svg: 'http://www.w3.org/2000/svg',
5587 math: 'http://www.w3.org/1998/Math/MathML'
5588};
5589
5590var isHTMLTag = makeMap(
5591 'html,body,base,head,link,meta,style,title,' +
5592 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
5593 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
5594 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
5595 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
5596 'embed,object,param,source,canvas,script,noscript,del,ins,' +
5597 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
5598 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
5599 'output,progress,select,textarea,' +
5600 'details,dialog,menu,menuitem,summary,' +
5601 'content,element,shadow,template,blockquote,iframe,tfoot'
5602);
5603
5604// this map is intentionally selective, only covering SVG elements that may
5605// contain child elements.
5606var isSVG = makeMap(
5607 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
5608 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
5609 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
5610 true
5611);
5612
5613var isReservedTag = function (tag) {
5614 return isHTMLTag(tag) || isSVG(tag)
5615};
5616
5617function getTagNamespace (tag) {
5618 if (isSVG(tag)) {
5619 return 'svg'
5620 }
5621 // basic support for MathML
5622 // note it doesn't support other MathML elements being component roots
5623 if (tag === 'math') {
5624 return 'math'
5625 }
5626}
5627
5628var unknownElementCache = Object.create(null);
5629function isUnknownElement (tag) {
5630 /* istanbul ignore if */
5631 if (!inBrowser) {
5632 return true
5633 }
5634 if (isReservedTag(tag)) {
5635 return false
5636 }
5637 tag = tag.toLowerCase();
5638 /* istanbul ignore if */
5639 if (unknownElementCache[tag] != null) {
5640 return unknownElementCache[tag]
5641 }
5642 var el = document.createElement(tag);
5643 if (tag.indexOf('-') > -1) {
5644 // http://stackoverflow.com/a/28210364/1070244
5645 return (unknownElementCache[tag] = (
5646 el.constructor === window.HTMLUnknownElement ||
5647 el.constructor === window.HTMLElement
5648 ))
5649 } else {
5650 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
5651 }
5652}
5653
5654var isTextInputType = makeMap('text,number,password,search,email,tel,url');
5655
5656/* */
5657
5658/**
5659 * Query an element selector if it's not an element already.
5660 */
5661function query (el) {
5662 if (typeof el === 'string') {
5663 var selected = document.querySelector(el);
5664 if (!selected) {
5665 process.env.NODE_ENV !== 'production' && warn(
5666 'Cannot find element: ' + el
5667 );
5668 return document.createElement('div')
5669 }
5670 return selected
5671 } else {
5672 return el
5673 }
5674}
5675
5676/* */
5677
5678function createElement$1 (tagName, vnode) {
5679 var elm = document.createElement(tagName);
5680 if (tagName !== 'select') {
5681 return elm
5682 }
5683 // false or null will remove the attribute but undefined will not
5684 if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
5685 elm.setAttribute('multiple', 'multiple');
5686 }
5687 return elm
5688}
5689
5690function createElementNS (namespace, tagName) {
5691 return document.createElementNS(namespaceMap[namespace], tagName)
5692}
5693
5694function createTextNode (text) {
5695 return document.createTextNode(text)
5696}
5697
5698function createComment (text) {
5699 return document.createComment(text)
5700}
5701
5702function insertBefore (parentNode, newNode, referenceNode) {
5703 parentNode.insertBefore(newNode, referenceNode);
5704}
5705
5706function removeChild (node, child) {
5707 node.removeChild(child);
5708}
5709
5710function appendChild (node, child) {
5711 node.appendChild(child);
5712}
5713
5714function parentNode (node) {
5715 return node.parentNode
5716}
5717
5718function nextSibling (node) {
5719 return node.nextSibling
5720}
5721
5722function tagName (node) {
5723 return node.tagName
5724}
5725
5726function setTextContent (node, text) {
5727 node.textContent = text;
5728}
5729
5730function setStyleScope (node, scopeId) {
5731 node.setAttribute(scopeId, '');
5732}
5733
5734var nodeOps = /*#__PURE__*/Object.freeze({
5735 createElement: createElement$1,
5736 createElementNS: createElementNS,
5737 createTextNode: createTextNode,
5738 createComment: createComment,
5739 insertBefore: insertBefore,
5740 removeChild: removeChild,
5741 appendChild: appendChild,
5742 parentNode: parentNode,
5743 nextSibling: nextSibling,
5744 tagName: tagName,
5745 setTextContent: setTextContent,
5746 setStyleScope: setStyleScope
5747});
5748
5749/* */
5750
5751var ref = {
5752 create: function create (_, vnode) {
5753 registerRef(vnode);
5754 },
5755 update: function update (oldVnode, vnode) {
5756 if (oldVnode.data.ref !== vnode.data.ref) {
5757 registerRef(oldVnode, true);
5758 registerRef(vnode);
5759 }
5760 },
5761 destroy: function destroy (vnode) {
5762 registerRef(vnode, true);
5763 }
5764};
5765
5766function registerRef (vnode, isRemoval) {
5767 var key = vnode.data.ref;
5768 if (!isDef(key)) { return }
5769
5770 var vm = vnode.context;
5771 var ref = vnode.componentInstance || vnode.elm;
5772 var refs = vm.$refs;
5773 if (isRemoval) {
5774 if (Array.isArray(refs[key])) {
5775 remove(refs[key], ref);
5776 } else if (refs[key] === ref) {
5777 refs[key] = undefined;
5778 }
5779 } else {
5780 if (vnode.data.refInFor) {
5781 if (!Array.isArray(refs[key])) {
5782 refs[key] = [ref];
5783 } else if (refs[key].indexOf(ref) < 0) {
5784 // $flow-disable-line
5785 refs[key].push(ref);
5786 }
5787 } else {
5788 refs[key] = ref;
5789 }
5790 }
5791}
5792
5793/**
5794 * Virtual DOM patching algorithm based on Snabbdom by
5795 * Simon Friis Vindum (@paldepind)
5796 * Licensed under the MIT License
5797 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
5798 *
5799 * modified by Evan You (@yyx990803)
5800 *
5801 * Not type-checking this because this file is perf-critical and the cost
5802 * of making flow understand it is not worth it.
5803 */
5804
5805var emptyNode = new VNode('', {}, []);
5806
5807var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
5808
5809function sameVnode (a, b) {
5810 return (
5811 a.key === b.key && (
5812 (
5813 a.tag === b.tag &&
5814 a.isComment === b.isComment &&
5815 isDef(a.data) === isDef(b.data) &&
5816 sameInputType(a, b)
5817 ) || (
5818 isTrue(a.isAsyncPlaceholder) &&
5819 a.asyncFactory === b.asyncFactory &&
5820 isUndef(b.asyncFactory.error)
5821 )
5822 )
5823 )
5824}
5825
5826function sameInputType (a, b) {
5827 if (a.tag !== 'input') { return true }
5828 var i;
5829 var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
5830 var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
5831 return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
5832}
5833
5834function createKeyToOldIdx (children, beginIdx, endIdx) {
5835 var i, key;
5836 var map = {};
5837 for (i = beginIdx; i <= endIdx; ++i) {
5838 key = children[i].key;
5839 if (isDef(key)) { map[key] = i; }
5840 }
5841 return map
5842}
5843
5844function createPatchFunction (backend) {
5845 var i, j;
5846 var cbs = {};
5847
5848 var modules = backend.modules;
5849 var nodeOps = backend.nodeOps;
5850
5851 for (i = 0; i < hooks.length; ++i) {
5852 cbs[hooks[i]] = [];
5853 for (j = 0; j < modules.length; ++j) {
5854 if (isDef(modules[j][hooks[i]])) {
5855 cbs[hooks[i]].push(modules[j][hooks[i]]);
5856 }
5857 }
5858 }
5859
5860 function emptyNodeAt (elm) {
5861 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
5862 }
5863
5864 function createRmCb (childElm, listeners) {
5865 function remove$$1 () {
5866 if (--remove$$1.listeners === 0) {
5867 removeNode(childElm);
5868 }
5869 }
5870 remove$$1.listeners = listeners;
5871 return remove$$1
5872 }
5873
5874 function removeNode (el) {
5875 var parent = nodeOps.parentNode(el);
5876 // element may have already been removed due to v-html / v-text
5877 if (isDef(parent)) {
5878 nodeOps.removeChild(parent, el);
5879 }
5880 }
5881
5882 function isUnknownElement$$1 (vnode, inVPre) {
5883 return (
5884 !inVPre &&
5885 !vnode.ns &&
5886 !(
5887 config.ignoredElements.length &&
5888 config.ignoredElements.some(function (ignore) {
5889 return isRegExp(ignore)
5890 ? ignore.test(vnode.tag)
5891 : ignore === vnode.tag
5892 })
5893 ) &&
5894 config.isUnknownElement(vnode.tag)
5895 )
5896 }
5897
5898 var creatingElmInVPre = 0;
5899
5900 function createElm (
5901 vnode,
5902 insertedVnodeQueue,
5903 parentElm,
5904 refElm,
5905 nested,
5906 ownerArray,
5907 index
5908 ) {
5909 if (isDef(vnode.elm) && isDef(ownerArray)) {
5910 // This vnode was used in a previous render!
5911 // now it's used as a new node, overwriting its elm would cause
5912 // potential patch errors down the road when it's used as an insertion
5913 // reference node. Instead, we clone the node on-demand before creating
5914 // associated DOM element for it.
5915 vnode = ownerArray[index] = cloneVNode(vnode);
5916 }
5917
5918 vnode.isRootInsert = !nested; // for transition enter check
5919 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
5920 return
5921 }
5922
5923 var data = vnode.data;
5924 var children = vnode.children;
5925 var tag = vnode.tag;
5926 if (isDef(tag)) {
5927 if (process.env.NODE_ENV !== 'production') {
5928 if (data && data.pre) {
5929 creatingElmInVPre++;
5930 }
5931 if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
5932 warn(
5933 'Unknown custom element: <' + tag + '> - did you ' +
5934 'register the component correctly? For recursive components, ' +
5935 'make sure to provide the "name" option.',
5936 vnode.context
5937 );
5938 }
5939 }
5940
5941 vnode.elm = vnode.ns
5942 ? nodeOps.createElementNS(vnode.ns, tag)
5943 : nodeOps.createElement(tag, vnode);
5944 setScope(vnode);
5945
5946 /* istanbul ignore if */
5947 {
5948 createChildren(vnode, children, insertedVnodeQueue);
5949 if (isDef(data)) {
5950 invokeCreateHooks(vnode, insertedVnodeQueue);
5951 }
5952 insert(parentElm, vnode.elm, refElm);
5953 }
5954
5955 if (process.env.NODE_ENV !== 'production' && data && data.pre) {
5956 creatingElmInVPre--;
5957 }
5958 } else if (isTrue(vnode.isComment)) {
5959 vnode.elm = nodeOps.createComment(vnode.text);
5960 insert(parentElm, vnode.elm, refElm);
5961 } else {
5962 vnode.elm = nodeOps.createTextNode(vnode.text);
5963 insert(parentElm, vnode.elm, refElm);
5964 }
5965 }
5966
5967 function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5968 var i = vnode.data;
5969 if (isDef(i)) {
5970 var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
5971 if (isDef(i = i.hook) && isDef(i = i.init)) {
5972 i(vnode, false /* hydrating */);
5973 }
5974 // after calling the init hook, if the vnode is a child component
5975 // it should've created a child instance and mounted it. the child
5976 // component also has set the placeholder vnode's elm.
5977 // in that case we can just return the element and be done.
5978 if (isDef(vnode.componentInstance)) {
5979 initComponent(vnode, insertedVnodeQueue);
5980 insert(parentElm, vnode.elm, refElm);
5981 if (isTrue(isReactivated)) {
5982 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
5983 }
5984 return true
5985 }
5986 }
5987 }
5988
5989 function initComponent (vnode, insertedVnodeQueue) {
5990 if (isDef(vnode.data.pendingInsert)) {
5991 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
5992 vnode.data.pendingInsert = null;
5993 }
5994 vnode.elm = vnode.componentInstance.$el;
5995 if (isPatchable(vnode)) {
5996 invokeCreateHooks(vnode, insertedVnodeQueue);
5997 setScope(vnode);
5998 } else {
5999 // empty component root.
6000 // skip all element-related modules except for ref (#3455)
6001 registerRef(vnode);
6002 // make sure to invoke the insert hook
6003 insertedVnodeQueue.push(vnode);
6004 }
6005 }
6006
6007 function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
6008 var i;
6009 // hack for #4339: a reactivated component with inner transition
6010 // does not trigger because the inner node's created hooks are not called
6011 // again. It's not ideal to involve module-specific logic in here but
6012 // there doesn't seem to be a better way to do it.
6013 var innerNode = vnode;
6014 while (innerNode.componentInstance) {
6015 innerNode = innerNode.componentInstance._vnode;
6016 if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
6017 for (i = 0; i < cbs.activate.length; ++i) {
6018 cbs.activate[i](emptyNode, innerNode);
6019 }
6020 insertedVnodeQueue.push(innerNode);
6021 break
6022 }
6023 }
6024 // unlike a newly created component,
6025 // a reactivated keep-alive component doesn't insert itself
6026 insert(parentElm, vnode.elm, refElm);
6027 }
6028
6029 function insert (parent, elm, ref$$1) {
6030 if (isDef(parent)) {
6031 if (isDef(ref$$1)) {
6032 if (nodeOps.parentNode(ref$$1) === parent) {
6033 nodeOps.insertBefore(parent, elm, ref$$1);
6034 }
6035 } else {
6036 nodeOps.appendChild(parent, elm);
6037 }
6038 }
6039 }
6040
6041 function createChildren (vnode, children, insertedVnodeQueue) {
6042 if (Array.isArray(children)) {
6043 if (process.env.NODE_ENV !== 'production') {
6044 checkDuplicateKeys(children);
6045 }
6046 for (var i = 0; i < children.length; ++i) {
6047 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
6048 }
6049 } else if (isPrimitive(vnode.text)) {
6050 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
6051 }
6052 }
6053
6054 function isPatchable (vnode) {
6055 while (vnode.componentInstance) {
6056 vnode = vnode.componentInstance._vnode;
6057 }
6058 return isDef(vnode.tag)
6059 }
6060
6061 function invokeCreateHooks (vnode, insertedVnodeQueue) {
6062 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6063 cbs.create[i$1](emptyNode, vnode);
6064 }
6065 i = vnode.data.hook; // Reuse variable
6066 if (isDef(i)) {
6067 if (isDef(i.create)) { i.create(emptyNode, vnode); }
6068 if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
6069 }
6070 }
6071
6072 // set scope id attribute for scoped CSS.
6073 // this is implemented as a special case to avoid the overhead
6074 // of going through the normal attribute patching process.
6075 function setScope (vnode) {
6076 var i;
6077 if (isDef(i = vnode.fnScopeId)) {
6078 nodeOps.setStyleScope(vnode.elm, i);
6079 } else {
6080 var ancestor = vnode;
6081 while (ancestor) {
6082 if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
6083 nodeOps.setStyleScope(vnode.elm, i);
6084 }
6085 ancestor = ancestor.parent;
6086 }
6087 }
6088 // for slot content they should also get the scopeId from the host instance.
6089 if (isDef(i = activeInstance) &&
6090 i !== vnode.context &&
6091 i !== vnode.fnContext &&
6092 isDef(i = i.$options._scopeId)
6093 ) {
6094 nodeOps.setStyleScope(vnode.elm, i);
6095 }
6096 }
6097
6098 function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
6099 for (; startIdx <= endIdx; ++startIdx) {
6100 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
6101 }
6102 }
6103
6104 function invokeDestroyHook (vnode) {
6105 var i, j;
6106 var data = vnode.data;
6107 if (isDef(data)) {
6108 if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
6109 for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
6110 }
6111 if (isDef(i = vnode.children)) {
6112 for (j = 0; j < vnode.children.length; ++j) {
6113 invokeDestroyHook(vnode.children[j]);
6114 }
6115 }
6116 }
6117
6118 function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
6119 for (; startIdx <= endIdx; ++startIdx) {
6120 var ch = vnodes[startIdx];
6121 if (isDef(ch)) {
6122 if (isDef(ch.tag)) {
6123 removeAndInvokeRemoveHook(ch);
6124 invokeDestroyHook(ch);
6125 } else { // Text node
6126 removeNode(ch.elm);
6127 }
6128 }
6129 }
6130 }
6131
6132 function removeAndInvokeRemoveHook (vnode, rm) {
6133 if (isDef(rm) || isDef(vnode.data)) {
6134 var i;
6135 var listeners = cbs.remove.length + 1;
6136 if (isDef(rm)) {
6137 // we have a recursively passed down rm callback
6138 // increase the listeners count
6139 rm.listeners += listeners;
6140 } else {
6141 // directly removing
6142 rm = createRmCb(vnode.elm, listeners);
6143 }
6144 // recursively invoke hooks on child component root node
6145 if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
6146 removeAndInvokeRemoveHook(i, rm);
6147 }
6148 for (i = 0; i < cbs.remove.length; ++i) {
6149 cbs.remove[i](vnode, rm);
6150 }
6151 if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
6152 i(vnode, rm);
6153 } else {
6154 rm();
6155 }
6156 } else {
6157 removeNode(vnode.elm);
6158 }
6159 }
6160
6161 function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
6162 var oldStartIdx = 0;
6163 var newStartIdx = 0;
6164 var oldEndIdx = oldCh.length - 1;
6165 var oldStartVnode = oldCh[0];
6166 var oldEndVnode = oldCh[oldEndIdx];
6167 var newEndIdx = newCh.length - 1;
6168 var newStartVnode = newCh[0];
6169 var newEndVnode = newCh[newEndIdx];
6170 var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
6171
6172 // removeOnly is a special flag used only by <transition-group>
6173 // to ensure removed elements stay in correct relative positions
6174 // during leaving transitions
6175 var canMove = !removeOnly;
6176
6177 if (process.env.NODE_ENV !== 'production') {
6178 checkDuplicateKeys(newCh);
6179 }
6180
6181 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
6182 if (isUndef(oldStartVnode)) {
6183 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
6184 } else if (isUndef(oldEndVnode)) {
6185 oldEndVnode = oldCh[--oldEndIdx];
6186 } else if (sameVnode(oldStartVnode, newStartVnode)) {
6187 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6188 oldStartVnode = oldCh[++oldStartIdx];
6189 newStartVnode = newCh[++newStartIdx];
6190 } else if (sameVnode(oldEndVnode, newEndVnode)) {
6191 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6192 oldEndVnode = oldCh[--oldEndIdx];
6193 newEndVnode = newCh[--newEndIdx];
6194 } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
6195 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6196 canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
6197 oldStartVnode = oldCh[++oldStartIdx];
6198 newEndVnode = newCh[--newEndIdx];
6199 } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
6200 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6201 canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
6202 oldEndVnode = oldCh[--oldEndIdx];
6203 newStartVnode = newCh[++newStartIdx];
6204 } else {
6205 if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
6206 idxInOld = isDef(newStartVnode.key)
6207 ? oldKeyToIdx[newStartVnode.key]
6208 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
6209 if (isUndef(idxInOld)) { // New element
6210 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6211 } else {
6212 vnodeToMove = oldCh[idxInOld];
6213 if (sameVnode(vnodeToMove, newStartVnode)) {
6214 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6215 oldCh[idxInOld] = undefined;
6216 canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
6217 } else {
6218 // same key but different element. treat as new element
6219 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6220 }
6221 }
6222 newStartVnode = newCh[++newStartIdx];
6223 }
6224 }
6225 if (oldStartIdx > oldEndIdx) {
6226 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6227 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6228 } else if (newStartIdx > newEndIdx) {
6229 removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6230 }
6231 }
6232
6233 function checkDuplicateKeys (children) {
6234 var seenKeys = {};
6235 for (var i = 0; i < children.length; i++) {
6236 var vnode = children[i];
6237 var key = vnode.key;
6238 if (isDef(key)) {
6239 if (seenKeys[key]) {
6240 warn(
6241 ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
6242 vnode.context
6243 );
6244 } else {
6245 seenKeys[key] = true;
6246 }
6247 }
6248 }
6249 }
6250
6251 function findIdxInOld (node, oldCh, start, end) {
6252 for (var i = start; i < end; i++) {
6253 var c = oldCh[i];
6254 if (isDef(c) && sameVnode(node, c)) { return i }
6255 }
6256 }
6257
6258 function patchVnode (
6259 oldVnode,
6260 vnode,
6261 insertedVnodeQueue,
6262 ownerArray,
6263 index,
6264 removeOnly
6265 ) {
6266 if (oldVnode === vnode) {
6267 return
6268 }
6269
6270 if (isDef(vnode.elm) && isDef(ownerArray)) {
6271 // clone reused vnode
6272 vnode = ownerArray[index] = cloneVNode(vnode);
6273 }
6274
6275 var elm = vnode.elm = oldVnode.elm;
6276
6277 if (isTrue(oldVnode.isAsyncPlaceholder)) {
6278 if (isDef(vnode.asyncFactory.resolved)) {
6279 hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6280 } else {
6281 vnode.isAsyncPlaceholder = true;
6282 }
6283 return
6284 }
6285
6286 // reuse element for static trees.
6287 // note we only do this if the vnode is cloned -
6288 // if the new node is not cloned it means the render functions have been
6289 // reset by the hot-reload-api and we need to do a proper re-render.
6290 if (isTrue(vnode.isStatic) &&
6291 isTrue(oldVnode.isStatic) &&
6292 vnode.key === oldVnode.key &&
6293 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
6294 ) {
6295 vnode.componentInstance = oldVnode.componentInstance;
6296 return
6297 }
6298
6299 var i;
6300 var data = vnode.data;
6301 if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
6302 i(oldVnode, vnode);
6303 }
6304
6305 var oldCh = oldVnode.children;
6306 var ch = vnode.children;
6307 if (isDef(data) && isPatchable(vnode)) {
6308 for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
6309 if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
6310 }
6311 if (isUndef(vnode.text)) {
6312 if (isDef(oldCh) && isDef(ch)) {
6313 if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
6314 } else if (isDef(ch)) {
6315 if (process.env.NODE_ENV !== 'production') {
6316 checkDuplicateKeys(ch);
6317 }
6318 if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6319 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6320 } else if (isDef(oldCh)) {
6321 removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6322 } else if (isDef(oldVnode.text)) {
6323 nodeOps.setTextContent(elm, '');
6324 }
6325 } else if (oldVnode.text !== vnode.text) {
6326 nodeOps.setTextContent(elm, vnode.text);
6327 }
6328 if (isDef(data)) {
6329 if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
6330 }
6331 }
6332
6333 function invokeInsertHook (vnode, queue, initial) {
6334 // delay insert hooks for component root nodes, invoke them after the
6335 // element is really inserted
6336 if (isTrue(initial) && isDef(vnode.parent)) {
6337 vnode.parent.data.pendingInsert = queue;
6338 } else {
6339 for (var i = 0; i < queue.length; ++i) {
6340 queue[i].data.hook.insert(queue[i]);
6341 }
6342 }
6343 }
6344
6345 var hydrationBailed = false;
6346 // list of modules that can skip create hook during hydration because they
6347 // are already rendered on the client or has no need for initialization
6348 // Note: style is excluded because it relies on initial clone for future
6349 // deep updates (#7063).
6350 var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
6351
6352 // Note: this is a browser-only function so we can assume elms are DOM nodes.
6353 function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
6354 var i;
6355 var tag = vnode.tag;
6356 var data = vnode.data;
6357 var children = vnode.children;
6358 inVPre = inVPre || (data && data.pre);
6359 vnode.elm = elm;
6360
6361 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
6362 vnode.isAsyncPlaceholder = true;
6363 return true
6364 }
6365 // assert node match
6366 if (process.env.NODE_ENV !== 'production') {
6367 if (!assertNodeMatch(elm, vnode, inVPre)) {
6368 return false
6369 }
6370 }
6371 if (isDef(data)) {
6372 if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
6373 if (isDef(i = vnode.componentInstance)) {
6374 // child component. it should have hydrated its own tree.
6375 initComponent(vnode, insertedVnodeQueue);
6376 return true
6377 }
6378 }
6379 if (isDef(tag)) {
6380 if (isDef(children)) {
6381 // empty element, allow client to pick up and populate children
6382 if (!elm.hasChildNodes()) {
6383 createChildren(vnode, children, insertedVnodeQueue);
6384 } else {
6385 // v-html and domProps: innerHTML
6386 if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
6387 if (i !== elm.innerHTML) {
6388 /* istanbul ignore if */
6389 if (process.env.NODE_ENV !== 'production' &&
6390 typeof console !== 'undefined' &&
6391 !hydrationBailed
6392 ) {
6393 hydrationBailed = true;
6394 console.warn('Parent: ', elm);
6395 console.warn('server innerHTML: ', i);
6396 console.warn('client innerHTML: ', elm.innerHTML);
6397 }
6398 return false
6399 }
6400 } else {
6401 // iterate and compare children lists
6402 var childrenMatch = true;
6403 var childNode = elm.firstChild;
6404 for (var i$1 = 0; i$1 < children.length; i$1++) {
6405 if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
6406 childrenMatch = false;
6407 break
6408 }
6409 childNode = childNode.nextSibling;
6410 }
6411 // if childNode is not null, it means the actual childNodes list is
6412 // longer than the virtual children list.
6413 if (!childrenMatch || childNode) {
6414 /* istanbul ignore if */
6415 if (process.env.NODE_ENV !== 'production' &&
6416 typeof console !== 'undefined' &&
6417 !hydrationBailed
6418 ) {
6419 hydrationBailed = true;
6420 console.warn('Parent: ', elm);
6421 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
6422 }
6423 return false
6424 }
6425 }
6426 }
6427 }
6428 if (isDef(data)) {
6429 var fullInvoke = false;
6430 for (var key in data) {
6431 if (!isRenderedModule(key)) {
6432 fullInvoke = true;
6433 invokeCreateHooks(vnode, insertedVnodeQueue);
6434 break
6435 }
6436 }
6437 if (!fullInvoke && data['class']) {
6438 // ensure collecting deps for deep class bindings for future updates
6439 traverse(data['class']);
6440 }
6441 }
6442 } else if (elm.data !== vnode.text) {
6443 elm.data = vnode.text;
6444 }
6445 return true
6446 }
6447
6448 function assertNodeMatch (node, vnode, inVPre) {
6449 if (isDef(vnode.tag)) {
6450 return vnode.tag.indexOf('vue-component') === 0 || (
6451 !isUnknownElement$$1(vnode, inVPre) &&
6452 vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
6453 )
6454 } else {
6455 return node.nodeType === (vnode.isComment ? 8 : 3)
6456 }
6457 }
6458
6459 return function patch (oldVnode, vnode, hydrating, removeOnly) {
6460 if (isUndef(vnode)) {
6461 if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
6462 return
6463 }
6464
6465 var isInitialPatch = false;
6466 var insertedVnodeQueue = [];
6467
6468 if (isUndef(oldVnode)) {
6469 // empty mount (likely as component), create new root element
6470 isInitialPatch = true;
6471 createElm(vnode, insertedVnodeQueue);
6472 } else {
6473 var isRealElement = isDef(oldVnode.nodeType);
6474 if (!isRealElement && sameVnode(oldVnode, vnode)) {
6475 // patch existing root node
6476 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
6477 } else {
6478 if (isRealElement) {
6479 // mounting to a real element
6480 // check if this is server-rendered content and if we can perform
6481 // a successful hydration.
6482 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
6483 oldVnode.removeAttribute(SSR_ATTR);
6484 hydrating = true;
6485 }
6486 if (isTrue(hydrating)) {
6487 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
6488 invokeInsertHook(vnode, insertedVnodeQueue, true);
6489 return oldVnode
6490 } else if (process.env.NODE_ENV !== 'production') {
6491 warn(
6492 'The client-side rendered virtual DOM tree is not matching ' +
6493 'server-rendered content. This is likely caused by incorrect ' +
6494 'HTML markup, for example nesting block-level elements inside ' +
6495 '<p>, or missing <tbody>. Bailing hydration and performing ' +
6496 'full client-side render.'
6497 );
6498 }
6499 }
6500 // either not server-rendered, or hydration failed.
6501 // create an empty node and replace it
6502 oldVnode = emptyNodeAt(oldVnode);
6503 }
6504
6505 // replacing existing element
6506 var oldElm = oldVnode.elm;
6507 var parentElm = nodeOps.parentNode(oldElm);
6508
6509 // create new node
6510 createElm(
6511 vnode,
6512 insertedVnodeQueue,
6513 // extremely rare edge case: do not insert if old element is in a
6514 // leaving transition. Only happens when combining transition +
6515 // keep-alive + HOCs. (#4590)
6516 oldElm._leaveCb ? null : parentElm,
6517 nodeOps.nextSibling(oldElm)
6518 );
6519
6520 // update parent placeholder node element, recursively
6521 if (isDef(vnode.parent)) {
6522 var ancestor = vnode.parent;
6523 var patchable = isPatchable(vnode);
6524 while (ancestor) {
6525 for (var i = 0; i < cbs.destroy.length; ++i) {
6526 cbs.destroy[i](ancestor);
6527 }
6528 ancestor.elm = vnode.elm;
6529 if (patchable) {
6530 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6531 cbs.create[i$1](emptyNode, ancestor);
6532 }
6533 // #6513
6534 // invoke insert hooks that may have been merged by create hooks.
6535 // e.g. for directives that uses the "inserted" hook.
6536 var insert = ancestor.data.hook.insert;
6537 if (insert.merged) {
6538 // start at index 1 to avoid re-invoking component mounted hook
6539 for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
6540 insert.fns[i$2]();
6541 }
6542 }
6543 } else {
6544 registerRef(ancestor);
6545 }
6546 ancestor = ancestor.parent;
6547 }
6548 }
6549
6550 // destroy old node
6551 if (isDef(parentElm)) {
6552 removeVnodes(parentElm, [oldVnode], 0, 0);
6553 } else if (isDef(oldVnode.tag)) {
6554 invokeDestroyHook(oldVnode);
6555 }
6556 }
6557 }
6558
6559 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
6560 return vnode.elm
6561 }
6562}
6563
6564/* */
6565
6566var directives = {
6567 create: updateDirectives,
6568 update: updateDirectives,
6569 destroy: function unbindDirectives (vnode) {
6570 updateDirectives(vnode, emptyNode);
6571 }
6572};
6573
6574function updateDirectives (oldVnode, vnode) {
6575 if (oldVnode.data.directives || vnode.data.directives) {
6576 _update(oldVnode, vnode);
6577 }
6578}
6579
6580function _update (oldVnode, vnode) {
6581 var isCreate = oldVnode === emptyNode;
6582 var isDestroy = vnode === emptyNode;
6583 var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
6584 var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
6585
6586 var dirsWithInsert = [];
6587 var dirsWithPostpatch = [];
6588
6589 var key, oldDir, dir;
6590 for (key in newDirs) {
6591 oldDir = oldDirs[key];
6592 dir = newDirs[key];
6593 if (!oldDir) {
6594 // new directive, bind
6595 callHook$1(dir, 'bind', vnode, oldVnode);
6596 if (dir.def && dir.def.inserted) {
6597 dirsWithInsert.push(dir);
6598 }
6599 } else {
6600 // existing directive, update
6601 dir.oldValue = oldDir.value;
6602 dir.oldArg = oldDir.arg;
6603 callHook$1(dir, 'update', vnode, oldVnode);
6604 if (dir.def && dir.def.componentUpdated) {
6605 dirsWithPostpatch.push(dir);
6606 }
6607 }
6608 }
6609
6610 if (dirsWithInsert.length) {
6611 var callInsert = function () {
6612 for (var i = 0; i < dirsWithInsert.length; i++) {
6613 callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
6614 }
6615 };
6616 if (isCreate) {
6617 mergeVNodeHook(vnode, 'insert', callInsert);
6618 } else {
6619 callInsert();
6620 }
6621 }
6622
6623 if (dirsWithPostpatch.length) {
6624 mergeVNodeHook(vnode, 'postpatch', function () {
6625 for (var i = 0; i < dirsWithPostpatch.length; i++) {
6626 callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
6627 }
6628 });
6629 }
6630
6631 if (!isCreate) {
6632 for (key in oldDirs) {
6633 if (!newDirs[key]) {
6634 // no longer present, unbind
6635 callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
6636 }
6637 }
6638 }
6639}
6640
6641var emptyModifiers = Object.create(null);
6642
6643function normalizeDirectives$1 (
6644 dirs,
6645 vm
6646) {
6647 var res = Object.create(null);
6648 if (!dirs) {
6649 // $flow-disable-line
6650 return res
6651 }
6652 var i, dir;
6653 for (i = 0; i < dirs.length; i++) {
6654 dir = dirs[i];
6655 if (!dir.modifiers) {
6656 // $flow-disable-line
6657 dir.modifiers = emptyModifiers;
6658 }
6659 res[getRawDirName(dir)] = dir;
6660 dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
6661 }
6662 // $flow-disable-line
6663 return res
6664}
6665
6666function getRawDirName (dir) {
6667 return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
6668}
6669
6670function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
6671 var fn = dir.def && dir.def[hook];
6672 if (fn) {
6673 try {
6674 fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
6675 } catch (e) {
6676 handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
6677 }
6678 }
6679}
6680
6681var baseModules = [
6682 ref,
6683 directives
6684];
6685
6686/* */
6687
6688function updateAttrs (oldVnode, vnode) {
6689 var opts = vnode.componentOptions;
6690 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
6691 return
6692 }
6693 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
6694 return
6695 }
6696 var key, cur, old;
6697 var elm = vnode.elm;
6698 var oldAttrs = oldVnode.data.attrs || {};
6699 var attrs = vnode.data.attrs || {};
6700 // clone observed objects, as the user probably wants to mutate it
6701 if (isDef(attrs.__ob__)) {
6702 attrs = vnode.data.attrs = extend({}, attrs);
6703 }
6704
6705 for (key in attrs) {
6706 cur = attrs[key];
6707 old = oldAttrs[key];
6708 if (old !== cur) {
6709 setAttr(elm, key, cur);
6710 }
6711 }
6712 // #4391: in IE9, setting type can reset value for input[type=radio]
6713 // #6666: IE/Edge forces progress value down to 1 before setting a max
6714 /* istanbul ignore if */
6715 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
6716 setAttr(elm, 'value', attrs.value);
6717 }
6718 for (key in oldAttrs) {
6719 if (isUndef(attrs[key])) {
6720 if (isXlink(key)) {
6721 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
6722 } else if (!isEnumeratedAttr(key)) {
6723 elm.removeAttribute(key);
6724 }
6725 }
6726 }
6727}
6728
6729function setAttr (el, key, value) {
6730 if (el.tagName.indexOf('-') > -1) {
6731 baseSetAttr(el, key, value);
6732 } else if (isBooleanAttr(key)) {
6733 // set attribute for blank value
6734 // e.g. <option disabled>Select one</option>
6735 if (isFalsyAttrValue(value)) {
6736 el.removeAttribute(key);
6737 } else {
6738 // technically allowfullscreen is a boolean attribute for <iframe>,
6739 // but Flash expects a value of "true" when used on <embed> tag
6740 value = key === 'allowfullscreen' && el.tagName === 'EMBED'
6741 ? 'true'
6742 : key;
6743 el.setAttribute(key, value);
6744 }
6745 } else if (isEnumeratedAttr(key)) {
6746 el.setAttribute(key, convertEnumeratedValue(key, value));
6747 } else if (isXlink(key)) {
6748 if (isFalsyAttrValue(value)) {
6749 el.removeAttributeNS(xlinkNS, getXlinkProp(key));
6750 } else {
6751 el.setAttributeNS(xlinkNS, key, value);
6752 }
6753 } else {
6754 baseSetAttr(el, key, value);
6755 }
6756}
6757
6758function baseSetAttr (el, key, value) {
6759 if (isFalsyAttrValue(value)) {
6760 el.removeAttribute(key);
6761 } else {
6762 // #7138: IE10 & 11 fires input event when setting placeholder on
6763 // <textarea>... block the first input event and remove the blocker
6764 // immediately.
6765 /* istanbul ignore if */
6766 if (
6767 isIE && !isIE9 &&
6768 el.tagName === 'TEXTAREA' &&
6769 key === 'placeholder' && value !== '' && !el.__ieph
6770 ) {
6771 var blocker = function (e) {
6772 e.stopImmediatePropagation();
6773 el.removeEventListener('input', blocker);
6774 };
6775 el.addEventListener('input', blocker);
6776 // $flow-disable-line
6777 el.__ieph = true; /* IE placeholder patched */
6778 }
6779 el.setAttribute(key, value);
6780 }
6781}
6782
6783var attrs = {
6784 create: updateAttrs,
6785 update: updateAttrs
6786};
6787
6788/* */
6789
6790function updateClass (oldVnode, vnode) {
6791 var el = vnode.elm;
6792 var data = vnode.data;
6793 var oldData = oldVnode.data;
6794 if (
6795 isUndef(data.staticClass) &&
6796 isUndef(data.class) && (
6797 isUndef(oldData) || (
6798 isUndef(oldData.staticClass) &&
6799 isUndef(oldData.class)
6800 )
6801 )
6802 ) {
6803 return
6804 }
6805
6806 var cls = genClassForVnode(vnode);
6807
6808 // handle transition classes
6809 var transitionClass = el._transitionClasses;
6810 if (isDef(transitionClass)) {
6811 cls = concat(cls, stringifyClass(transitionClass));
6812 }
6813
6814 // set the class
6815 if (cls !== el._prevClass) {
6816 el.setAttribute('class', cls);
6817 el._prevClass = cls;
6818 }
6819}
6820
6821var klass = {
6822 create: updateClass,
6823 update: updateClass
6824};
6825
6826/* */
6827
6828/* */
6829
6830/* */
6831
6832/* */
6833
6834// in some cases, the event used has to be determined at runtime
6835// so we used some reserved tokens during compile.
6836var RANGE_TOKEN = '__r';
6837var CHECKBOX_RADIO_TOKEN = '__c';
6838
6839/* */
6840
6841// normalize v-model event tokens that can only be determined at runtime.
6842// it's important to place the event as the first in the array because
6843// the whole point is ensuring the v-model callback gets called before
6844// user-attached handlers.
6845function normalizeEvents (on) {
6846 /* istanbul ignore if */
6847 if (isDef(on[RANGE_TOKEN])) {
6848 // IE input[type=range] only supports `change` event
6849 var event = isIE ? 'change' : 'input';
6850 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
6851 delete on[RANGE_TOKEN];
6852 }
6853 // This was originally intended to fix #4521 but no longer necessary
6854 // after 2.5. Keeping it for backwards compat with generated code from < 2.4
6855 /* istanbul ignore if */
6856 if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
6857 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
6858 delete on[CHECKBOX_RADIO_TOKEN];
6859 }
6860}
6861
6862var target$1;
6863
6864function createOnceHandler$1 (event, handler, capture) {
6865 var _target = target$1; // save current target element in closure
6866 return function onceHandler () {
6867 var res = handler.apply(null, arguments);
6868 if (res !== null) {
6869 remove$2(event, onceHandler, capture, _target);
6870 }
6871 }
6872}
6873
6874// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
6875// implementation and does not fire microtasks in between event propagation, so
6876// safe to exclude.
6877var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
6878
6879function add$1 (
6880 name,
6881 handler,
6882 capture,
6883 passive
6884) {
6885 // async edge case #6566: inner click event triggers patch, event handler
6886 // attached to outer element during patch, and triggered again. This
6887 // happens because browsers fire microtask ticks between event propagation.
6888 // the solution is simple: we save the timestamp when a handler is attached,
6889 // and the handler would only fire if the event passed to it was fired
6890 // AFTER it was attached.
6891 if (useMicrotaskFix) {
6892 var attachedTimestamp = currentFlushTimestamp;
6893 var original = handler;
6894 handler = original._wrapper = function (e) {
6895 if (
6896 // no bubbling, should always fire.
6897 // this is just a safety net in case event.timeStamp is unreliable in
6898 // certain weird environments...
6899 e.target === e.currentTarget ||
6900 // event is fired after handler attachment
6901 e.timeStamp >= attachedTimestamp ||
6902 // bail for environments that have buggy event.timeStamp implementations
6903 // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
6904 // #9681 QtWebEngine event.timeStamp is negative value
6905 e.timeStamp <= 0 ||
6906 // #9448 bail if event is fired in another document in a multi-page
6907 // electron/nw.js app, since event.timeStamp will be using a different
6908 // starting reference
6909 e.target.ownerDocument !== document
6910 ) {
6911 return original.apply(this, arguments)
6912 }
6913 };
6914 }
6915 target$1.addEventListener(
6916 name,
6917 handler,
6918 supportsPassive
6919 ? { capture: capture, passive: passive }
6920 : capture
6921 );
6922}
6923
6924function remove$2 (
6925 name,
6926 handler,
6927 capture,
6928 _target
6929) {
6930 (_target || target$1).removeEventListener(
6931 name,
6932 handler._wrapper || handler,
6933 capture
6934 );
6935}
6936
6937function updateDOMListeners (oldVnode, vnode) {
6938 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
6939 return
6940 }
6941 var on = vnode.data.on || {};
6942 var oldOn = oldVnode.data.on || {};
6943 target$1 = vnode.elm;
6944 normalizeEvents(on);
6945 updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
6946 target$1 = undefined;
6947}
6948
6949var events = {
6950 create: updateDOMListeners,
6951 update: updateDOMListeners
6952};
6953
6954/* */
6955
6956var svgContainer;
6957
6958function updateDOMProps (oldVnode, vnode) {
6959 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
6960 return
6961 }
6962 var key, cur;
6963 var elm = vnode.elm;
6964 var oldProps = oldVnode.data.domProps || {};
6965 var props = vnode.data.domProps || {};
6966 // clone observed objects, as the user probably wants to mutate it
6967 if (isDef(props.__ob__)) {
6968 props = vnode.data.domProps = extend({}, props);
6969 }
6970
6971 for (key in oldProps) {
6972 if (!(key in props)) {
6973 elm[key] = '';
6974 }
6975 }
6976
6977 for (key in props) {
6978 cur = props[key];
6979 // ignore children if the node has textContent or innerHTML,
6980 // as these will throw away existing DOM nodes and cause removal errors
6981 // on subsequent patches (#3360)
6982 if (key === 'textContent' || key === 'innerHTML') {
6983 if (vnode.children) { vnode.children.length = 0; }
6984 if (cur === oldProps[key]) { continue }
6985 // #6601 work around Chrome version <= 55 bug where single textNode
6986 // replaced by innerHTML/textContent retains its parentNode property
6987 if (elm.childNodes.length === 1) {
6988 elm.removeChild(elm.childNodes[0]);
6989 }
6990 }
6991
6992 if (key === 'value' && elm.tagName !== 'PROGRESS') {
6993 // store value as _value as well since
6994 // non-string values will be stringified
6995 elm._value = cur;
6996 // avoid resetting cursor position when value is the same
6997 var strCur = isUndef(cur) ? '' : String(cur);
6998 if (shouldUpdateValue(elm, strCur)) {
6999 elm.value = strCur;
7000 }
7001 } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
7002 // IE doesn't support innerHTML for SVG elements
7003 svgContainer = svgContainer || document.createElement('div');
7004 svgContainer.innerHTML = "<svg>" + cur + "</svg>";
7005 var svg = svgContainer.firstChild;
7006 while (elm.firstChild) {
7007 elm.removeChild(elm.firstChild);
7008 }
7009 while (svg.firstChild) {
7010 elm.appendChild(svg.firstChild);
7011 }
7012 } else if (
7013 // skip the update if old and new VDOM state is the same.
7014 // `value` is handled separately because the DOM value may be temporarily
7015 // out of sync with VDOM state due to focus, composition and modifiers.
7016 // This #4521 by skipping the unnecesarry `checked` update.
7017 cur !== oldProps[key]
7018 ) {
7019 // some property updates can throw
7020 // e.g. `value` on <progress> w/ non-finite value
7021 try {
7022 elm[key] = cur;
7023 } catch (e) {}
7024 }
7025 }
7026}
7027
7028// check platforms/web/util/attrs.js acceptValue
7029
7030
7031function shouldUpdateValue (elm, checkVal) {
7032 return (!elm.composing && (
7033 elm.tagName === 'OPTION' ||
7034 isNotInFocusAndDirty(elm, checkVal) ||
7035 isDirtyWithModifiers(elm, checkVal)
7036 ))
7037}
7038
7039function isNotInFocusAndDirty (elm, checkVal) {
7040 // return true when textbox (.number and .trim) loses focus and its value is
7041 // not equal to the updated value
7042 var notInFocus = true;
7043 // #6157
7044 // work around IE bug when accessing document.activeElement in an iframe
7045 try { notInFocus = document.activeElement !== elm; } catch (e) {}
7046 return notInFocus && elm.value !== checkVal
7047}
7048
7049function isDirtyWithModifiers (elm, newVal) {
7050 var value = elm.value;
7051 var modifiers = elm._vModifiers; // injected by v-model runtime
7052 if (isDef(modifiers)) {
7053 if (modifiers.number) {
7054 return toNumber(value) !== toNumber(newVal)
7055 }
7056 if (modifiers.trim) {
7057 return value.trim() !== newVal.trim()
7058 }
7059 }
7060 return value !== newVal
7061}
7062
7063var domProps = {
7064 create: updateDOMProps,
7065 update: updateDOMProps
7066};
7067
7068/* */
7069
7070var parseStyleText = cached(function (cssText) {
7071 var res = {};
7072 var listDelimiter = /;(?![^(]*\))/g;
7073 var propertyDelimiter = /:(.+)/;
7074 cssText.split(listDelimiter).forEach(function (item) {
7075 if (item) {
7076 var tmp = item.split(propertyDelimiter);
7077 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
7078 }
7079 });
7080 return res
7081});
7082
7083// merge static and dynamic style data on the same vnode
7084function normalizeStyleData (data) {
7085 var style = normalizeStyleBinding(data.style);
7086 // static style is pre-processed into an object during compilation
7087 // and is always a fresh object, so it's safe to merge into it
7088 return data.staticStyle
7089 ? extend(data.staticStyle, style)
7090 : style
7091}
7092
7093// normalize possible array / string values into Object
7094function normalizeStyleBinding (bindingStyle) {
7095 if (Array.isArray(bindingStyle)) {
7096 return toObject(bindingStyle)
7097 }
7098 if (typeof bindingStyle === 'string') {
7099 return parseStyleText(bindingStyle)
7100 }
7101 return bindingStyle
7102}
7103
7104/**
7105 * parent component style should be after child's
7106 * so that parent component's style could override it
7107 */
7108function getStyle (vnode, checkChild) {
7109 var res = {};
7110 var styleData;
7111
7112 if (checkChild) {
7113 var childNode = vnode;
7114 while (childNode.componentInstance) {
7115 childNode = childNode.componentInstance._vnode;
7116 if (
7117 childNode && childNode.data &&
7118 (styleData = normalizeStyleData(childNode.data))
7119 ) {
7120 extend(res, styleData);
7121 }
7122 }
7123 }
7124
7125 if ((styleData = normalizeStyleData(vnode.data))) {
7126 extend(res, styleData);
7127 }
7128
7129 var parentNode = vnode;
7130 while ((parentNode = parentNode.parent)) {
7131 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
7132 extend(res, styleData);
7133 }
7134 }
7135 return res
7136}
7137
7138/* */
7139
7140var cssVarRE = /^--/;
7141var importantRE = /\s*!important$/;
7142var setProp = function (el, name, val) {
7143 /* istanbul ignore if */
7144 if (cssVarRE.test(name)) {
7145 el.style.setProperty(name, val);
7146 } else if (importantRE.test(val)) {
7147 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
7148 } else {
7149 var normalizedName = normalize(name);
7150 if (Array.isArray(val)) {
7151 // Support values array created by autoprefixer, e.g.
7152 // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
7153 // Set them one by one, and the browser will only set those it can recognize
7154 for (var i = 0, len = val.length; i < len; i++) {
7155 el.style[normalizedName] = val[i];
7156 }
7157 } else {
7158 el.style[normalizedName] = val;
7159 }
7160 }
7161};
7162
7163var vendorNames = ['Webkit', 'Moz', 'ms'];
7164
7165var emptyStyle;
7166var normalize = cached(function (prop) {
7167 emptyStyle = emptyStyle || document.createElement('div').style;
7168 prop = camelize(prop);
7169 if (prop !== 'filter' && (prop in emptyStyle)) {
7170 return prop
7171 }
7172 var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
7173 for (var i = 0; i < vendorNames.length; i++) {
7174 var name = vendorNames[i] + capName;
7175 if (name in emptyStyle) {
7176 return name
7177 }
7178 }
7179});
7180
7181function updateStyle (oldVnode, vnode) {
7182 var data = vnode.data;
7183 var oldData = oldVnode.data;
7184
7185 if (isUndef(data.staticStyle) && isUndef(data.style) &&
7186 isUndef(oldData.staticStyle) && isUndef(oldData.style)
7187 ) {
7188 return
7189 }
7190
7191 var cur, name;
7192 var el = vnode.elm;
7193 var oldStaticStyle = oldData.staticStyle;
7194 var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
7195
7196 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
7197 var oldStyle = oldStaticStyle || oldStyleBinding;
7198
7199 var style = normalizeStyleBinding(vnode.data.style) || {};
7200
7201 // store normalized style under a different key for next diff
7202 // make sure to clone it if it's reactive, since the user likely wants
7203 // to mutate it.
7204 vnode.data.normalizedStyle = isDef(style.__ob__)
7205 ? extend({}, style)
7206 : style;
7207
7208 var newStyle = getStyle(vnode, true);
7209
7210 for (name in oldStyle) {
7211 if (isUndef(newStyle[name])) {
7212 setProp(el, name, '');
7213 }
7214 }
7215 for (name in newStyle) {
7216 cur = newStyle[name];
7217 if (cur !== oldStyle[name]) {
7218 // ie9 setting to null has no effect, must use empty string
7219 setProp(el, name, cur == null ? '' : cur);
7220 }
7221 }
7222}
7223
7224var style = {
7225 create: updateStyle,
7226 update: updateStyle
7227};
7228
7229/* */
7230
7231var whitespaceRE = /\s+/;
7232
7233/**
7234 * Add class with compatibility for SVG since classList is not supported on
7235 * SVG elements in IE
7236 */
7237function addClass (el, cls) {
7238 /* istanbul ignore if */
7239 if (!cls || !(cls = cls.trim())) {
7240 return
7241 }
7242
7243 /* istanbul ignore else */
7244 if (el.classList) {
7245 if (cls.indexOf(' ') > -1) {
7246 cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
7247 } else {
7248 el.classList.add(cls);
7249 }
7250 } else {
7251 var cur = " " + (el.getAttribute('class') || '') + " ";
7252 if (cur.indexOf(' ' + cls + ' ') < 0) {
7253 el.setAttribute('class', (cur + cls).trim());
7254 }
7255 }
7256}
7257
7258/**
7259 * Remove class with compatibility for SVG since classList is not supported on
7260 * SVG elements in IE
7261 */
7262function removeClass (el, cls) {
7263 /* istanbul ignore if */
7264 if (!cls || !(cls = cls.trim())) {
7265 return
7266 }
7267
7268 /* istanbul ignore else */
7269 if (el.classList) {
7270 if (cls.indexOf(' ') > -1) {
7271 cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
7272 } else {
7273 el.classList.remove(cls);
7274 }
7275 if (!el.classList.length) {
7276 el.removeAttribute('class');
7277 }
7278 } else {
7279 var cur = " " + (el.getAttribute('class') || '') + " ";
7280 var tar = ' ' + cls + ' ';
7281 while (cur.indexOf(tar) >= 0) {
7282 cur = cur.replace(tar, ' ');
7283 }
7284 cur = cur.trim();
7285 if (cur) {
7286 el.setAttribute('class', cur);
7287 } else {
7288 el.removeAttribute('class');
7289 }
7290 }
7291}
7292
7293/* */
7294
7295function resolveTransition (def$$1) {
7296 if (!def$$1) {
7297 return
7298 }
7299 /* istanbul ignore else */
7300 if (typeof def$$1 === 'object') {
7301 var res = {};
7302 if (def$$1.css !== false) {
7303 extend(res, autoCssTransition(def$$1.name || 'v'));
7304 }
7305 extend(res, def$$1);
7306 return res
7307 } else if (typeof def$$1 === 'string') {
7308 return autoCssTransition(def$$1)
7309 }
7310}
7311
7312var autoCssTransition = cached(function (name) {
7313 return {
7314 enterClass: (name + "-enter"),
7315 enterToClass: (name + "-enter-to"),
7316 enterActiveClass: (name + "-enter-active"),
7317 leaveClass: (name + "-leave"),
7318 leaveToClass: (name + "-leave-to"),
7319 leaveActiveClass: (name + "-leave-active")
7320 }
7321});
7322
7323var hasTransition = inBrowser && !isIE9;
7324var TRANSITION = 'transition';
7325var ANIMATION = 'animation';
7326
7327// Transition property/event sniffing
7328var transitionProp = 'transition';
7329var transitionEndEvent = 'transitionend';
7330var animationProp = 'animation';
7331var animationEndEvent = 'animationend';
7332if (hasTransition) {
7333 /* istanbul ignore if */
7334 if (window.ontransitionend === undefined &&
7335 window.onwebkittransitionend !== undefined
7336 ) {
7337 transitionProp = 'WebkitTransition';
7338 transitionEndEvent = 'webkitTransitionEnd';
7339 }
7340 if (window.onanimationend === undefined &&
7341 window.onwebkitanimationend !== undefined
7342 ) {
7343 animationProp = 'WebkitAnimation';
7344 animationEndEvent = 'webkitAnimationEnd';
7345 }
7346}
7347
7348// binding to window is necessary to make hot reload work in IE in strict mode
7349var raf = inBrowser
7350 ? window.requestAnimationFrame
7351 ? window.requestAnimationFrame.bind(window)
7352 : setTimeout
7353 : /* istanbul ignore next */ function (fn) { return fn(); };
7354
7355function nextFrame (fn) {
7356 raf(function () {
7357 raf(fn);
7358 });
7359}
7360
7361function addTransitionClass (el, cls) {
7362 var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
7363 if (transitionClasses.indexOf(cls) < 0) {
7364 transitionClasses.push(cls);
7365 addClass(el, cls);
7366 }
7367}
7368
7369function removeTransitionClass (el, cls) {
7370 if (el._transitionClasses) {
7371 remove(el._transitionClasses, cls);
7372 }
7373 removeClass(el, cls);
7374}
7375
7376function whenTransitionEnds (
7377 el,
7378 expectedType,
7379 cb
7380) {
7381 var ref = getTransitionInfo(el, expectedType);
7382 var type = ref.type;
7383 var timeout = ref.timeout;
7384 var propCount = ref.propCount;
7385 if (!type) { return cb() }
7386 var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
7387 var ended = 0;
7388 var end = function () {
7389 el.removeEventListener(event, onEnd);
7390 cb();
7391 };
7392 var onEnd = function (e) {
7393 if (e.target === el) {
7394 if (++ended >= propCount) {
7395 end();
7396 }
7397 }
7398 };
7399 setTimeout(function () {
7400 if (ended < propCount) {
7401 end();
7402 }
7403 }, timeout + 1);
7404 el.addEventListener(event, onEnd);
7405}
7406
7407var transformRE = /\b(transform|all)(,|$)/;
7408
7409function getTransitionInfo (el, expectedType) {
7410 var styles = window.getComputedStyle(el);
7411 // JSDOM may return undefined for transition properties
7412 var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
7413 var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
7414 var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
7415 var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
7416 var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
7417 var animationTimeout = getTimeout(animationDelays, animationDurations);
7418
7419 var type;
7420 var timeout = 0;
7421 var propCount = 0;
7422 /* istanbul ignore if */
7423 if (expectedType === TRANSITION) {
7424 if (transitionTimeout > 0) {
7425 type = TRANSITION;
7426 timeout = transitionTimeout;
7427 propCount = transitionDurations.length;
7428 }
7429 } else if (expectedType === ANIMATION) {
7430 if (animationTimeout > 0) {
7431 type = ANIMATION;
7432 timeout = animationTimeout;
7433 propCount = animationDurations.length;
7434 }
7435 } else {
7436 timeout = Math.max(transitionTimeout, animationTimeout);
7437 type = timeout > 0
7438 ? transitionTimeout > animationTimeout
7439 ? TRANSITION
7440 : ANIMATION
7441 : null;
7442 propCount = type
7443 ? type === TRANSITION
7444 ? transitionDurations.length
7445 : animationDurations.length
7446 : 0;
7447 }
7448 var hasTransform =
7449 type === TRANSITION &&
7450 transformRE.test(styles[transitionProp + 'Property']);
7451 return {
7452 type: type,
7453 timeout: timeout,
7454 propCount: propCount,
7455 hasTransform: hasTransform
7456 }
7457}
7458
7459function getTimeout (delays, durations) {
7460 /* istanbul ignore next */
7461 while (delays.length < durations.length) {
7462 delays = delays.concat(delays);
7463 }
7464
7465 return Math.max.apply(null, durations.map(function (d, i) {
7466 return toMs(d) + toMs(delays[i])
7467 }))
7468}
7469
7470// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
7471// in a locale-dependent way, using a comma instead of a dot.
7472// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
7473// as a floor function) causing unexpected behaviors
7474function toMs (s) {
7475 return Number(s.slice(0, -1).replace(',', '.')) * 1000
7476}
7477
7478/* */
7479
7480function enter (vnode, toggleDisplay) {
7481 var el = vnode.elm;
7482
7483 // call leave callback now
7484 if (isDef(el._leaveCb)) {
7485 el._leaveCb.cancelled = true;
7486 el._leaveCb();
7487 }
7488
7489 var data = resolveTransition(vnode.data.transition);
7490 if (isUndef(data)) {
7491 return
7492 }
7493
7494 /* istanbul ignore if */
7495 if (isDef(el._enterCb) || el.nodeType !== 1) {
7496 return
7497 }
7498
7499 var css = data.css;
7500 var type = data.type;
7501 var enterClass = data.enterClass;
7502 var enterToClass = data.enterToClass;
7503 var enterActiveClass = data.enterActiveClass;
7504 var appearClass = data.appearClass;
7505 var appearToClass = data.appearToClass;
7506 var appearActiveClass = data.appearActiveClass;
7507 var beforeEnter = data.beforeEnter;
7508 var enter = data.enter;
7509 var afterEnter = data.afterEnter;
7510 var enterCancelled = data.enterCancelled;
7511 var beforeAppear = data.beforeAppear;
7512 var appear = data.appear;
7513 var afterAppear = data.afterAppear;
7514 var appearCancelled = data.appearCancelled;
7515 var duration = data.duration;
7516
7517 // activeInstance will always be the <transition> component managing this
7518 // transition. One edge case to check is when the <transition> is placed
7519 // as the root node of a child component. In that case we need to check
7520 // <transition>'s parent for appear check.
7521 var context = activeInstance;
7522 var transitionNode = activeInstance.$vnode;
7523 while (transitionNode && transitionNode.parent) {
7524 context = transitionNode.context;
7525 transitionNode = transitionNode.parent;
7526 }
7527
7528 var isAppear = !context._isMounted || !vnode.isRootInsert;
7529
7530 if (isAppear && !appear && appear !== '') {
7531 return
7532 }
7533
7534 var startClass = isAppear && appearClass
7535 ? appearClass
7536 : enterClass;
7537 var activeClass = isAppear && appearActiveClass
7538 ? appearActiveClass
7539 : enterActiveClass;
7540 var toClass = isAppear && appearToClass
7541 ? appearToClass
7542 : enterToClass;
7543
7544 var beforeEnterHook = isAppear
7545 ? (beforeAppear || beforeEnter)
7546 : beforeEnter;
7547 var enterHook = isAppear
7548 ? (typeof appear === 'function' ? appear : enter)
7549 : enter;
7550 var afterEnterHook = isAppear
7551 ? (afterAppear || afterEnter)
7552 : afterEnter;
7553 var enterCancelledHook = isAppear
7554 ? (appearCancelled || enterCancelled)
7555 : enterCancelled;
7556
7557 var explicitEnterDuration = toNumber(
7558 isObject(duration)
7559 ? duration.enter
7560 : duration
7561 );
7562
7563 if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
7564 checkDuration(explicitEnterDuration, 'enter', vnode);
7565 }
7566
7567 var expectsCSS = css !== false && !isIE9;
7568 var userWantsControl = getHookArgumentsLength(enterHook);
7569
7570 var cb = el._enterCb = once(function () {
7571 if (expectsCSS) {
7572 removeTransitionClass(el, toClass);
7573 removeTransitionClass(el, activeClass);
7574 }
7575 if (cb.cancelled) {
7576 if (expectsCSS) {
7577 removeTransitionClass(el, startClass);
7578 }
7579 enterCancelledHook && enterCancelledHook(el);
7580 } else {
7581 afterEnterHook && afterEnterHook(el);
7582 }
7583 el._enterCb = null;
7584 });
7585
7586 if (!vnode.data.show) {
7587 // remove pending leave element on enter by injecting an insert hook
7588 mergeVNodeHook(vnode, 'insert', function () {
7589 var parent = el.parentNode;
7590 var pendingNode = parent && parent._pending && parent._pending[vnode.key];
7591 if (pendingNode &&
7592 pendingNode.tag === vnode.tag &&
7593 pendingNode.elm._leaveCb
7594 ) {
7595 pendingNode.elm._leaveCb();
7596 }
7597 enterHook && enterHook(el, cb);
7598 });
7599 }
7600
7601 // start enter transition
7602 beforeEnterHook && beforeEnterHook(el);
7603 if (expectsCSS) {
7604 addTransitionClass(el, startClass);
7605 addTransitionClass(el, activeClass);
7606 nextFrame(function () {
7607 removeTransitionClass(el, startClass);
7608 if (!cb.cancelled) {
7609 addTransitionClass(el, toClass);
7610 if (!userWantsControl) {
7611 if (isValidDuration(explicitEnterDuration)) {
7612 setTimeout(cb, explicitEnterDuration);
7613 } else {
7614 whenTransitionEnds(el, type, cb);
7615 }
7616 }
7617 }
7618 });
7619 }
7620
7621 if (vnode.data.show) {
7622 toggleDisplay && toggleDisplay();
7623 enterHook && enterHook(el, cb);
7624 }
7625
7626 if (!expectsCSS && !userWantsControl) {
7627 cb();
7628 }
7629}
7630
7631function leave (vnode, rm) {
7632 var el = vnode.elm;
7633
7634 // call enter callback now
7635 if (isDef(el._enterCb)) {
7636 el._enterCb.cancelled = true;
7637 el._enterCb();
7638 }
7639
7640 var data = resolveTransition(vnode.data.transition);
7641 if (isUndef(data) || el.nodeType !== 1) {
7642 return rm()
7643 }
7644
7645 /* istanbul ignore if */
7646 if (isDef(el._leaveCb)) {
7647 return
7648 }
7649
7650 var css = data.css;
7651 var type = data.type;
7652 var leaveClass = data.leaveClass;
7653 var leaveToClass = data.leaveToClass;
7654 var leaveActiveClass = data.leaveActiveClass;
7655 var beforeLeave = data.beforeLeave;
7656 var leave = data.leave;
7657 var afterLeave = data.afterLeave;
7658 var leaveCancelled = data.leaveCancelled;
7659 var delayLeave = data.delayLeave;
7660 var duration = data.duration;
7661
7662 var expectsCSS = css !== false && !isIE9;
7663 var userWantsControl = getHookArgumentsLength(leave);
7664
7665 var explicitLeaveDuration = toNumber(
7666 isObject(duration)
7667 ? duration.leave
7668 : duration
7669 );
7670
7671 if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
7672 checkDuration(explicitLeaveDuration, 'leave', vnode);
7673 }
7674
7675 var cb = el._leaveCb = once(function () {
7676 if (el.parentNode && el.parentNode._pending) {
7677 el.parentNode._pending[vnode.key] = null;
7678 }
7679 if (expectsCSS) {
7680 removeTransitionClass(el, leaveToClass);
7681 removeTransitionClass(el, leaveActiveClass);
7682 }
7683 if (cb.cancelled) {
7684 if (expectsCSS) {
7685 removeTransitionClass(el, leaveClass);
7686 }
7687 leaveCancelled && leaveCancelled(el);
7688 } else {
7689 rm();
7690 afterLeave && afterLeave(el);
7691 }
7692 el._leaveCb = null;
7693 });
7694
7695 if (delayLeave) {
7696 delayLeave(performLeave);
7697 } else {
7698 performLeave();
7699 }
7700
7701 function performLeave () {
7702 // the delayed leave may have already been cancelled
7703 if (cb.cancelled) {
7704 return
7705 }
7706 // record leaving element
7707 if (!vnode.data.show && el.parentNode) {
7708 (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
7709 }
7710 beforeLeave && beforeLeave(el);
7711 if (expectsCSS) {
7712 addTransitionClass(el, leaveClass);
7713 addTransitionClass(el, leaveActiveClass);
7714 nextFrame(function () {
7715 removeTransitionClass(el, leaveClass);
7716 if (!cb.cancelled) {
7717 addTransitionClass(el, leaveToClass);
7718 if (!userWantsControl) {
7719 if (isValidDuration(explicitLeaveDuration)) {
7720 setTimeout(cb, explicitLeaveDuration);
7721 } else {
7722 whenTransitionEnds(el, type, cb);
7723 }
7724 }
7725 }
7726 });
7727 }
7728 leave && leave(el, cb);
7729 if (!expectsCSS && !userWantsControl) {
7730 cb();
7731 }
7732 }
7733}
7734
7735// only used in dev mode
7736function checkDuration (val, name, vnode) {
7737 if (typeof val !== 'number') {
7738 warn(
7739 "<transition> explicit " + name + " duration is not a valid number - " +
7740 "got " + (JSON.stringify(val)) + ".",
7741 vnode.context
7742 );
7743 } else if (isNaN(val)) {
7744 warn(
7745 "<transition> explicit " + name + " duration is NaN - " +
7746 'the duration expression might be incorrect.',
7747 vnode.context
7748 );
7749 }
7750}
7751
7752function isValidDuration (val) {
7753 return typeof val === 'number' && !isNaN(val)
7754}
7755
7756/**
7757 * Normalize a transition hook's argument length. The hook may be:
7758 * - a merged hook (invoker) with the original in .fns
7759 * - a wrapped component method (check ._length)
7760 * - a plain function (.length)
7761 */
7762function getHookArgumentsLength (fn) {
7763 if (isUndef(fn)) {
7764 return false
7765 }
7766 var invokerFns = fn.fns;
7767 if (isDef(invokerFns)) {
7768 // invoker
7769 return getHookArgumentsLength(
7770 Array.isArray(invokerFns)
7771 ? invokerFns[0]
7772 : invokerFns
7773 )
7774 } else {
7775 return (fn._length || fn.length) > 1
7776 }
7777}
7778
7779function _enter (_, vnode) {
7780 if (vnode.data.show !== true) {
7781 enter(vnode);
7782 }
7783}
7784
7785var transition = inBrowser ? {
7786 create: _enter,
7787 activate: _enter,
7788 remove: function remove$$1 (vnode, rm) {
7789 /* istanbul ignore else */
7790 if (vnode.data.show !== true) {
7791 leave(vnode, rm);
7792 } else {
7793 rm();
7794 }
7795 }
7796} : {};
7797
7798var platformModules = [
7799 attrs,
7800 klass,
7801 events,
7802 domProps,
7803 style,
7804 transition
7805];
7806
7807/* */
7808
7809// the directive module should be applied last, after all
7810// built-in modules have been applied.
7811var modules = platformModules.concat(baseModules);
7812
7813var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
7814
7815/**
7816 * Not type checking this file because flow doesn't like attaching
7817 * properties to Elements.
7818 */
7819
7820/* istanbul ignore if */
7821if (isIE9) {
7822 // http://www.matts411.com/post/internet-explorer-9-oninput/
7823 document.addEventListener('selectionchange', function () {
7824 var el = document.activeElement;
7825 if (el && el.vmodel) {
7826 trigger(el, 'input');
7827 }
7828 });
7829}
7830
7831var directive = {
7832 inserted: function inserted (el, binding, vnode, oldVnode) {
7833 if (vnode.tag === 'select') {
7834 // #6903
7835 if (oldVnode.elm && !oldVnode.elm._vOptions) {
7836 mergeVNodeHook(vnode, 'postpatch', function () {
7837 directive.componentUpdated(el, binding, vnode);
7838 });
7839 } else {
7840 setSelected(el, binding, vnode.context);
7841 }
7842 el._vOptions = [].map.call(el.options, getValue);
7843 } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
7844 el._vModifiers = binding.modifiers;
7845 if (!binding.modifiers.lazy) {
7846 el.addEventListener('compositionstart', onCompositionStart);
7847 el.addEventListener('compositionend', onCompositionEnd);
7848 // Safari < 10.2 & UIWebView doesn't fire compositionend when
7849 // switching focus before confirming composition choice
7850 // this also fixes the issue where some browsers e.g. iOS Chrome
7851 // fires "change" instead of "input" on autocomplete.
7852 el.addEventListener('change', onCompositionEnd);
7853 /* istanbul ignore if */
7854 if (isIE9) {
7855 el.vmodel = true;
7856 }
7857 }
7858 }
7859 },
7860
7861 componentUpdated: function componentUpdated (el, binding, vnode) {
7862 if (vnode.tag === 'select') {
7863 setSelected(el, binding, vnode.context);
7864 // in case the options rendered by v-for have changed,
7865 // it's possible that the value is out-of-sync with the rendered options.
7866 // detect such cases and filter out values that no longer has a matching
7867 // option in the DOM.
7868 var prevOptions = el._vOptions;
7869 var curOptions = el._vOptions = [].map.call(el.options, getValue);
7870 if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
7871 // trigger change event if
7872 // no matching option found for at least one value
7873 var needReset = el.multiple
7874 ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
7875 : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
7876 if (needReset) {
7877 trigger(el, 'change');
7878 }
7879 }
7880 }
7881 }
7882};
7883
7884function setSelected (el, binding, vm) {
7885 actuallySetSelected(el, binding, vm);
7886 /* istanbul ignore if */
7887 if (isIE || isEdge) {
7888 setTimeout(function () {
7889 actuallySetSelected(el, binding, vm);
7890 }, 0);
7891 }
7892}
7893
7894function actuallySetSelected (el, binding, vm) {
7895 var value = binding.value;
7896 var isMultiple = el.multiple;
7897 if (isMultiple && !Array.isArray(value)) {
7898 process.env.NODE_ENV !== 'production' && warn(
7899 "<select multiple v-model=\"" + (binding.expression) + "\"> " +
7900 "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
7901 vm
7902 );
7903 return
7904 }
7905 var selected, option;
7906 for (var i = 0, l = el.options.length; i < l; i++) {
7907 option = el.options[i];
7908 if (isMultiple) {
7909 selected = looseIndexOf(value, getValue(option)) > -1;
7910 if (option.selected !== selected) {
7911 option.selected = selected;
7912 }
7913 } else {
7914 if (looseEqual(getValue(option), value)) {
7915 if (el.selectedIndex !== i) {
7916 el.selectedIndex = i;
7917 }
7918 return
7919 }
7920 }
7921 }
7922 if (!isMultiple) {
7923 el.selectedIndex = -1;
7924 }
7925}
7926
7927function hasNoMatchingOption (value, options) {
7928 return options.every(function (o) { return !looseEqual(o, value); })
7929}
7930
7931function getValue (option) {
7932 return '_value' in option
7933 ? option._value
7934 : option.value
7935}
7936
7937function onCompositionStart (e) {
7938 e.target.composing = true;
7939}
7940
7941function onCompositionEnd (e) {
7942 // prevent triggering an input event for no reason
7943 if (!e.target.composing) { return }
7944 e.target.composing = false;
7945 trigger(e.target, 'input');
7946}
7947
7948function trigger (el, type) {
7949 var e = document.createEvent('HTMLEvents');
7950 e.initEvent(type, true, true);
7951 el.dispatchEvent(e);
7952}
7953
7954/* */
7955
7956// recursively search for possible transition defined inside the component root
7957function locateNode (vnode) {
7958 return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
7959 ? locateNode(vnode.componentInstance._vnode)
7960 : vnode
7961}
7962
7963var show = {
7964 bind: function bind (el, ref, vnode) {
7965 var value = ref.value;
7966
7967 vnode = locateNode(vnode);
7968 var transition$$1 = vnode.data && vnode.data.transition;
7969 var originalDisplay = el.__vOriginalDisplay =
7970 el.style.display === 'none' ? '' : el.style.display;
7971 if (value && transition$$1) {
7972 vnode.data.show = true;
7973 enter(vnode, function () {
7974 el.style.display = originalDisplay;
7975 });
7976 } else {
7977 el.style.display = value ? originalDisplay : 'none';
7978 }
7979 },
7980
7981 update: function update (el, ref, vnode) {
7982 var value = ref.value;
7983 var oldValue = ref.oldValue;
7984
7985 /* istanbul ignore if */
7986 if (!value === !oldValue) { return }
7987 vnode = locateNode(vnode);
7988 var transition$$1 = vnode.data && vnode.data.transition;
7989 if (transition$$1) {
7990 vnode.data.show = true;
7991 if (value) {
7992 enter(vnode, function () {
7993 el.style.display = el.__vOriginalDisplay;
7994 });
7995 } else {
7996 leave(vnode, function () {
7997 el.style.display = 'none';
7998 });
7999 }
8000 } else {
8001 el.style.display = value ? el.__vOriginalDisplay : 'none';
8002 }
8003 },
8004
8005 unbind: function unbind (
8006 el,
8007 binding,
8008 vnode,
8009 oldVnode,
8010 isDestroy
8011 ) {
8012 if (!isDestroy) {
8013 el.style.display = el.__vOriginalDisplay;
8014 }
8015 }
8016};
8017
8018var platformDirectives = {
8019 model: directive,
8020 show: show
8021};
8022
8023/* */
8024
8025var transitionProps = {
8026 name: String,
8027 appear: Boolean,
8028 css: Boolean,
8029 mode: String,
8030 type: String,
8031 enterClass: String,
8032 leaveClass: String,
8033 enterToClass: String,
8034 leaveToClass: String,
8035 enterActiveClass: String,
8036 leaveActiveClass: String,
8037 appearClass: String,
8038 appearActiveClass: String,
8039 appearToClass: String,
8040 duration: [Number, String, Object]
8041};
8042
8043// in case the child is also an abstract component, e.g. <keep-alive>
8044// we want to recursively retrieve the real component to be rendered
8045function getRealChild (vnode) {
8046 var compOptions = vnode && vnode.componentOptions;
8047 if (compOptions && compOptions.Ctor.options.abstract) {
8048 return getRealChild(getFirstComponentChild(compOptions.children))
8049 } else {
8050 return vnode
8051 }
8052}
8053
8054function extractTransitionData (comp) {
8055 var data = {};
8056 var options = comp.$options;
8057 // props
8058 for (var key in options.propsData) {
8059 data[key] = comp[key];
8060 }
8061 // events.
8062 // extract listeners and pass them directly to the transition methods
8063 var listeners = options._parentListeners;
8064 for (var key$1 in listeners) {
8065 data[camelize(key$1)] = listeners[key$1];
8066 }
8067 return data
8068}
8069
8070function placeholder (h, rawChild) {
8071 if (/\d-keep-alive$/.test(rawChild.tag)) {
8072 return h('keep-alive', {
8073 props: rawChild.componentOptions.propsData
8074 })
8075 }
8076}
8077
8078function hasParentTransition (vnode) {
8079 while ((vnode = vnode.parent)) {
8080 if (vnode.data.transition) {
8081 return true
8082 }
8083 }
8084}
8085
8086function isSameChild (child, oldChild) {
8087 return oldChild.key === child.key && oldChild.tag === child.tag
8088}
8089
8090var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
8091
8092var isVShowDirective = function (d) { return d.name === 'show'; };
8093
8094var Transition = {
8095 name: 'transition',
8096 props: transitionProps,
8097 abstract: true,
8098
8099 render: function render (h) {
8100 var this$1 = this;
8101
8102 var children = this.$slots.default;
8103 if (!children) {
8104 return
8105 }
8106
8107 // filter out text nodes (possible whitespaces)
8108 children = children.filter(isNotTextNode);
8109 /* istanbul ignore if */
8110 if (!children.length) {
8111 return
8112 }
8113
8114 // warn multiple elements
8115 if (process.env.NODE_ENV !== 'production' && children.length > 1) {
8116 warn(
8117 '<transition> can only be used on a single element. Use ' +
8118 '<transition-group> for lists.',
8119 this.$parent
8120 );
8121 }
8122
8123 var mode = this.mode;
8124
8125 // warn invalid mode
8126 if (process.env.NODE_ENV !== 'production' &&
8127 mode && mode !== 'in-out' && mode !== 'out-in'
8128 ) {
8129 warn(
8130 'invalid <transition> mode: ' + mode,
8131 this.$parent
8132 );
8133 }
8134
8135 var rawChild = children[0];
8136
8137 // if this is a component root node and the component's
8138 // parent container node also has transition, skip.
8139 if (hasParentTransition(this.$vnode)) {
8140 return rawChild
8141 }
8142
8143 // apply transition data to child
8144 // use getRealChild() to ignore abstract components e.g. keep-alive
8145 var child = getRealChild(rawChild);
8146 /* istanbul ignore if */
8147 if (!child) {
8148 return rawChild
8149 }
8150
8151 if (this._leaving) {
8152 return placeholder(h, rawChild)
8153 }
8154
8155 // ensure a key that is unique to the vnode type and to this transition
8156 // component instance. This key will be used to remove pending leaving nodes
8157 // during entering.
8158 var id = "__transition-" + (this._uid) + "-";
8159 child.key = child.key == null
8160 ? child.isComment
8161 ? id + 'comment'
8162 : id + child.tag
8163 : isPrimitive(child.key)
8164 ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
8165 : child.key;
8166
8167 var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
8168 var oldRawChild = this._vnode;
8169 var oldChild = getRealChild(oldRawChild);
8170
8171 // mark v-show
8172 // so that the transition module can hand over the control to the directive
8173 if (child.data.directives && child.data.directives.some(isVShowDirective)) {
8174 child.data.show = true;
8175 }
8176
8177 if (
8178 oldChild &&
8179 oldChild.data &&
8180 !isSameChild(child, oldChild) &&
8181 !isAsyncPlaceholder(oldChild) &&
8182 // #6687 component root is a comment node
8183 !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
8184 ) {
8185 // replace old child transition data with fresh one
8186 // important for dynamic transitions!
8187 var oldData = oldChild.data.transition = extend({}, data);
8188 // handle transition mode
8189 if (mode === 'out-in') {
8190 // return placeholder node and queue update when leave finishes
8191 this._leaving = true;
8192 mergeVNodeHook(oldData, 'afterLeave', function () {
8193 this$1._leaving = false;
8194 this$1.$forceUpdate();
8195 });
8196 return placeholder(h, rawChild)
8197 } else if (mode === 'in-out') {
8198 if (isAsyncPlaceholder(child)) {
8199 return oldRawChild
8200 }
8201 var delayedLeave;
8202 var performLeave = function () { delayedLeave(); };
8203 mergeVNodeHook(data, 'afterEnter', performLeave);
8204 mergeVNodeHook(data, 'enterCancelled', performLeave);
8205 mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
8206 }
8207 }
8208
8209 return rawChild
8210 }
8211};
8212
8213/* */
8214
8215var props = extend({
8216 tag: String,
8217 moveClass: String
8218}, transitionProps);
8219
8220delete props.mode;
8221
8222var TransitionGroup = {
8223 props: props,
8224
8225 beforeMount: function beforeMount () {
8226 var this$1 = this;
8227
8228 var update = this._update;
8229 this._update = function (vnode, hydrating) {
8230 var restoreActiveInstance = setActiveInstance(this$1);
8231 // force removing pass
8232 this$1.__patch__(
8233 this$1._vnode,
8234 this$1.kept,
8235 false, // hydrating
8236 true // removeOnly (!important, avoids unnecessary moves)
8237 );
8238 this$1._vnode = this$1.kept;
8239 restoreActiveInstance();
8240 update.call(this$1, vnode, hydrating);
8241 };
8242 },
8243
8244 render: function render (h) {
8245 var tag = this.tag || this.$vnode.data.tag || 'span';
8246 var map = Object.create(null);
8247 var prevChildren = this.prevChildren = this.children;
8248 var rawChildren = this.$slots.default || [];
8249 var children = this.children = [];
8250 var transitionData = extractTransitionData(this);
8251
8252 for (var i = 0; i < rawChildren.length; i++) {
8253 var c = rawChildren[i];
8254 if (c.tag) {
8255 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
8256 children.push(c);
8257 map[c.key] = c
8258 ;(c.data || (c.data = {})).transition = transitionData;
8259 } else if (process.env.NODE_ENV !== 'production') {
8260 var opts = c.componentOptions;
8261 var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
8262 warn(("<transition-group> children must be keyed: <" + name + ">"));
8263 }
8264 }
8265 }
8266
8267 if (prevChildren) {
8268 var kept = [];
8269 var removed = [];
8270 for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
8271 var c$1 = prevChildren[i$1];
8272 c$1.data.transition = transitionData;
8273 c$1.data.pos = c$1.elm.getBoundingClientRect();
8274 if (map[c$1.key]) {
8275 kept.push(c$1);
8276 } else {
8277 removed.push(c$1);
8278 }
8279 }
8280 this.kept = h(tag, null, kept);
8281 this.removed = removed;
8282 }
8283
8284 return h(tag, null, children)
8285 },
8286
8287 updated: function updated () {
8288 var children = this.prevChildren;
8289 var moveClass = this.moveClass || ((this.name || 'v') + '-move');
8290 if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
8291 return
8292 }
8293
8294 // we divide the work into three loops to avoid mixing DOM reads and writes
8295 // in each iteration - which helps prevent layout thrashing.
8296 children.forEach(callPendingCbs);
8297 children.forEach(recordPosition);
8298 children.forEach(applyTranslation);
8299
8300 // force reflow to put everything in position
8301 // assign to this to avoid being removed in tree-shaking
8302 // $flow-disable-line
8303 this._reflow = document.body.offsetHeight;
8304
8305 children.forEach(function (c) {
8306 if (c.data.moved) {
8307 var el = c.elm;
8308 var s = el.style;
8309 addTransitionClass(el, moveClass);
8310 s.transform = s.WebkitTransform = s.transitionDuration = '';
8311 el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
8312 if (e && e.target !== el) {
8313 return
8314 }
8315 if (!e || /transform$/.test(e.propertyName)) {
8316 el.removeEventListener(transitionEndEvent, cb);
8317 el._moveCb = null;
8318 removeTransitionClass(el, moveClass);
8319 }
8320 });
8321 }
8322 });
8323 },
8324
8325 methods: {
8326 hasMove: function hasMove (el, moveClass) {
8327 /* istanbul ignore if */
8328 if (!hasTransition) {
8329 return false
8330 }
8331 /* istanbul ignore if */
8332 if (this._hasMove) {
8333 return this._hasMove
8334 }
8335 // Detect whether an element with the move class applied has
8336 // CSS transitions. Since the element may be inside an entering
8337 // transition at this very moment, we make a clone of it and remove
8338 // all other transition classes applied to ensure only the move class
8339 // is applied.
8340 var clone = el.cloneNode();
8341 if (el._transitionClasses) {
8342 el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
8343 }
8344 addClass(clone, moveClass);
8345 clone.style.display = 'none';
8346 this.$el.appendChild(clone);
8347 var info = getTransitionInfo(clone);
8348 this.$el.removeChild(clone);
8349 return (this._hasMove = info.hasTransform)
8350 }
8351 }
8352};
8353
8354function callPendingCbs (c) {
8355 /* istanbul ignore if */
8356 if (c.elm._moveCb) {
8357 c.elm._moveCb();
8358 }
8359 /* istanbul ignore if */
8360 if (c.elm._enterCb) {
8361 c.elm._enterCb();
8362 }
8363}
8364
8365function recordPosition (c) {
8366 c.data.newPos = c.elm.getBoundingClientRect();
8367}
8368
8369function applyTranslation (c) {
8370 var oldPos = c.data.pos;
8371 var newPos = c.data.newPos;
8372 var dx = oldPos.left - newPos.left;
8373 var dy = oldPos.top - newPos.top;
8374 if (dx || dy) {
8375 c.data.moved = true;
8376 var s = c.elm.style;
8377 s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
8378 s.transitionDuration = '0s';
8379 }
8380}
8381
8382var platformComponents = {
8383 Transition: Transition,
8384 TransitionGroup: TransitionGroup
8385};
8386
8387/* */
8388
8389// install platform specific utils
8390Vue.config.mustUseProp = mustUseProp;
8391Vue.config.isReservedTag = isReservedTag;
8392Vue.config.isReservedAttr = isReservedAttr;
8393Vue.config.getTagNamespace = getTagNamespace;
8394Vue.config.isUnknownElement = isUnknownElement;
8395
8396// install platform runtime directives & components
8397extend(Vue.options.directives, platformDirectives);
8398extend(Vue.options.components, platformComponents);
8399
8400// install platform patch function
8401Vue.prototype.__patch__ = inBrowser ? patch : noop;
8402
8403// public mount method
8404Vue.prototype.$mount = function (
8405 el,
8406 hydrating
8407) {
8408 el = el && inBrowser ? query(el) : undefined;
8409 return mountComponent(this, el, hydrating)
8410};
8411
8412// devtools global hook
8413/* istanbul ignore next */
8414if (inBrowser) {
8415 setTimeout(function () {
8416 if (config.devtools) {
8417 if (devtools) {
8418 devtools.emit('init', Vue);
8419 } else if (
8420 process.env.NODE_ENV !== 'production' &&
8421 process.env.NODE_ENV !== 'test'
8422 ) {
8423 console[console.info ? 'info' : 'log'](
8424 'Download the Vue Devtools extension for a better development experience:\n' +
8425 'https://github.com/vuejs/vue-devtools'
8426 );
8427 }
8428 }
8429 if (process.env.NODE_ENV !== 'production' &&
8430 process.env.NODE_ENV !== 'test' &&
8431 config.productionTip !== false &&
8432 typeof console !== 'undefined'
8433 ) {
8434 console[console.info ? 'info' : 'log'](
8435 "You are running Vue in development mode.\n" +
8436 "Make sure to turn on production mode when deploying for production.\n" +
8437 "See more tips at https://vuejs.org/guide/deployment.html"
8438 );
8439 }
8440 }, 0);
8441}
8442
8443/* */
8444
8445export default Vue;