UNPKG

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