UNPKG

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