UNPKG

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