UNPKG

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