UNPKG

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