UNPKG

312 kBJavaScriptView Raw
1/*!
2 * Vue.js v2.6.0
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 * Generate a string containing static keys from compiler modules.
281 */
282function genStaticKeys (modules) {
283 return modules.reduce(function (keys, m) {
284 return keys.concat(m.staticKeys || [])
285 }, []).join(',')
286}
287
288/**
289 * Check if two values are loosely equal - that is,
290 * if they are plain objects, do they have the same shape?
291 */
292function looseEqual (a, b) {
293 if (a === b) { return true }
294 var isObjectA = isObject(a);
295 var isObjectB = isObject(b);
296 if (isObjectA && isObjectB) {
297 try {
298 var isArrayA = Array.isArray(a);
299 var isArrayB = Array.isArray(b);
300 if (isArrayA && isArrayB) {
301 return a.length === b.length && a.every(function (e, i) {
302 return looseEqual(e, b[i])
303 })
304 } else if (a instanceof Date && b instanceof Date) {
305 return a.getTime() === b.getTime()
306 } else if (!isArrayA && !isArrayB) {
307 var keysA = Object.keys(a);
308 var keysB = Object.keys(b);
309 return keysA.length === keysB.length && keysA.every(function (key) {
310 return looseEqual(a[key], b[key])
311 })
312 } else {
313 /* istanbul ignore next */
314 return false
315 }
316 } catch (e) {
317 /* istanbul ignore next */
318 return false
319 }
320 } else if (!isObjectA && !isObjectB) {
321 return String(a) === String(b)
322 } else {
323 return false
324 }
325}
326
327/**
328 * Return the first index at which a loosely equal value can be
329 * found in the array (if value is a plain object, the array must
330 * contain an object of the same shape), or -1 if it is not present.
331 */
332function looseIndexOf (arr, val) {
333 for (var i = 0; i < arr.length; i++) {
334 if (looseEqual(arr[i], val)) { return i }
335 }
336 return -1
337}
338
339/**
340 * Ensure a function is called only once.
341 */
342function once (fn) {
343 var called = false;
344 return function () {
345 if (!called) {
346 called = true;
347 fn.apply(this, arguments);
348 }
349 }
350}
351
352var SSR_ATTR = 'data-server-rendered';
353
354var ASSET_TYPES = [
355 'component',
356 'directive',
357 'filter'
358];
359
360var LIFECYCLE_HOOKS = [
361 'beforeCreate',
362 'created',
363 'beforeMount',
364 'mounted',
365 'beforeUpdate',
366 'updated',
367 'beforeDestroy',
368 'destroyed',
369 'activated',
370 'deactivated',
371 'errorCaptured',
372 'serverPrefetch'
373];
374
375/* */
376
377
378
379var config = ({
380 /**
381 * Option merge strategies (used in core/util/options)
382 */
383 // $flow-disable-line
384 optionMergeStrategies: Object.create(null),
385
386 /**
387 * Whether to suppress warnings.
388 */
389 silent: false,
390
391 /**
392 * Show production mode tip message on boot?
393 */
394 productionTip: "development" !== 'production',
395
396 /**
397 * Whether to enable devtools
398 */
399 devtools: "development" !== 'production',
400
401 /**
402 * Whether to record perf
403 */
404 performance: false,
405
406 /**
407 * Error handler for watcher errors
408 */
409 errorHandler: null,
410
411 /**
412 * Warn handler for watcher warns
413 */
414 warnHandler: null,
415
416 /**
417 * Ignore certain custom elements
418 */
419 ignoredElements: [],
420
421 /**
422 * Custom user key aliases for v-on
423 */
424 // $flow-disable-line
425 keyCodes: Object.create(null),
426
427 /**
428 * Check if a tag is reserved so that it cannot be registered as a
429 * component. This is platform-dependent and may be overwritten.
430 */
431 isReservedTag: no,
432
433 /**
434 * Check if an attribute is reserved so that it cannot be used as a component
435 * prop. This is platform-dependent and may be overwritten.
436 */
437 isReservedAttr: no,
438
439 /**
440 * Check if a tag is an unknown element.
441 * Platform-dependent.
442 */
443 isUnknownElement: no,
444
445 /**
446 * Get the namespace of an element
447 */
448 getTagNamespace: noop,
449
450 /**
451 * Parse the real tag name for the specific platform.
452 */
453 parsePlatformTagName: identity,
454
455 /**
456 * Check if an attribute must be bound using property, e.g. value
457 * Platform-dependent.
458 */
459 mustUseProp: no,
460
461 /**
462 * Perform updates asynchronously. Intended to be used by Vue Test Utils
463 * This will significantly reduce performance if set to false.
464 */
465 async: true,
466
467 /**
468 * Exposed for legacy reasons
469 */
470 _lifecycleHooks: LIFECYCLE_HOOKS
471});
472
473/* */
474
475/**
476 * unicode letters used for parsing html tags, component names and property paths.
477 * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
478 * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
479 */
480var 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';
481
482/**
483 * Check if a string starts with $ or _
484 */
485function isReserved (str) {
486 var c = (str + '').charCodeAt(0);
487 return c === 0x24 || c === 0x5F
488}
489
490/**
491 * Define a property.
492 */
493function def (obj, key, val, enumerable) {
494 Object.defineProperty(obj, key, {
495 value: val,
496 enumerable: !!enumerable,
497 writable: true,
498 configurable: true
499 });
500}
501
502/**
503 * Parse simple path.
504 */
505var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
506function parsePath (path) {
507 if (bailRE.test(path)) {
508 return
509 }
510 var segments = path.split('.');
511 return function (obj) {
512 for (var i = 0; i < segments.length; i++) {
513 if (!obj) { return }
514 obj = obj[segments[i]];
515 }
516 return obj
517 }
518}
519
520/* */
521
522// can we use __proto__?
523var hasProto = '__proto__' in {};
524
525// Browser environment sniffing
526var inBrowser = typeof window !== 'undefined';
527var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
528var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
529var UA = inBrowser && window.navigator.userAgent.toLowerCase();
530var isIE = UA && /msie|trident/.test(UA);
531var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
532var isEdge = UA && UA.indexOf('edge/') > 0;
533var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
534var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
535var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
536var isPhantomJS = UA && /phantomjs/.test(UA);
537
538// Firefox has a "watch" function on Object.prototype...
539var nativeWatch = ({}).watch;
540
541var supportsPassive = false;
542if (inBrowser) {
543 try {
544 var opts = {};
545 Object.defineProperty(opts, 'passive', ({
546 get: function get () {
547 /* istanbul ignore next */
548 supportsPassive = true;
549 }
550 })); // https://github.com/facebook/flow/issues/285
551 window.addEventListener('test-passive', null, opts);
552 } catch (e) {}
553}
554
555// this needs to be lazy-evaled because vue may be required before
556// vue-server-renderer can set VUE_ENV
557var _isServer;
558var isServerRendering = function () {
559 if (_isServer === undefined) {
560 /* istanbul ignore if */
561 if (!inBrowser && !inWeex && typeof global !== 'undefined') {
562 // detect presence of vue-server-renderer and avoid
563 // Webpack shimming the process
564 _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
565 } else {
566 _isServer = false;
567 }
568 }
569 return _isServer
570};
571
572// detect devtools
573var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
574
575/* istanbul ignore next */
576function isNative (Ctor) {
577 return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
578}
579
580var hasSymbol =
581 typeof Symbol !== 'undefined' && isNative(Symbol) &&
582 typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
583
584var _Set;
585/* istanbul ignore if */ // $flow-disable-line
586if (typeof Set !== 'undefined' && isNative(Set)) {
587 // use native Set when available.
588 _Set = Set;
589} else {
590 // a non-standard Set polyfill that only works with primitive keys.
591 _Set = /*@__PURE__*/(function () {
592 function Set () {
593 this.set = Object.create(null);
594 }
595 Set.prototype.has = function has (key) {
596 return this.set[key] === true
597 };
598 Set.prototype.add = function add (key) {
599 this.set[key] = true;
600 };
601 Set.prototype.clear = function clear () {
602 this.set = Object.create(null);
603 };
604
605 return Set;
606 }());
607}
608
609/* */
610
611var warn = noop;
612var tip = noop;
613var generateComponentTrace = (noop); // work around flow check
614var formatComponentName = (noop);
615
616{
617 var hasConsole = typeof console !== 'undefined';
618 var classifyRE = /(?:^|[-_])(\w)/g;
619 var classify = function (str) { return str
620 .replace(classifyRE, function (c) { return c.toUpperCase(); })
621 .replace(/[-_]/g, ''); };
622
623 warn = function (msg, vm) {
624 var trace = vm ? generateComponentTrace(vm) : '';
625
626 if (config.warnHandler) {
627 config.warnHandler.call(null, msg, vm, trace);
628 } else if (hasConsole && (!config.silent)) {
629 console.error(("[Vue warn]: " + msg + trace));
630 }
631 };
632
633 tip = function (msg, vm) {
634 if (hasConsole && (!config.silent)) {
635 console.warn("[Vue tip]: " + msg + (
636 vm ? generateComponentTrace(vm) : ''
637 ));
638 }
639 };
640
641 formatComponentName = function (vm, includeFile) {
642 if (vm.$root === vm) {
643 return '<Root>'
644 }
645 var options = typeof vm === 'function' && vm.cid != null
646 ? vm.options
647 : vm._isVue
648 ? vm.$options || vm.constructor.options
649 : vm;
650 var name = options.name || options._componentTag;
651 var file = options.__file;
652 if (!name && file) {
653 var match = file.match(/([^/\\]+)\.vue$/);
654 name = match && match[1];
655 }
656
657 return (
658 (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
659 (file && includeFile !== false ? (" at " + file) : '')
660 )
661 };
662
663 var repeat = function (str, n) {
664 var res = '';
665 while (n) {
666 if (n % 2 === 1) { res += str; }
667 if (n > 1) { str += str; }
668 n >>= 1;
669 }
670 return res
671 };
672
673 generateComponentTrace = function (vm) {
674 if (vm._isVue && vm.$parent) {
675 var tree = [];
676 var currentRecursiveSequence = 0;
677 while (vm) {
678 if (tree.length > 0) {
679 var last = tree[tree.length - 1];
680 if (last.constructor === vm.constructor) {
681 currentRecursiveSequence++;
682 vm = vm.$parent;
683 continue
684 } else if (currentRecursiveSequence > 0) {
685 tree[tree.length - 1] = [last, currentRecursiveSequence];
686 currentRecursiveSequence = 0;
687 }
688 }
689 tree.push(vm);
690 vm = vm.$parent;
691 }
692 return '\n\nfound in\n\n' + tree
693 .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
694 ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
695 : formatComponentName(vm))); })
696 .join('\n')
697 } else {
698 return ("\n\n(found in " + (formatComponentName(vm)) + ")")
699 }
700 };
701}
702
703/* */
704
705var uid = 0;
706
707/**
708 * A dep is an observable that can have multiple
709 * directives subscribing to it.
710 */
711var Dep = function Dep () {
712 this.id = uid++;
713 this.subs = [];
714};
715
716Dep.prototype.addSub = function addSub (sub) {
717 this.subs.push(sub);
718};
719
720Dep.prototype.removeSub = function removeSub (sub) {
721 remove(this.subs, sub);
722};
723
724Dep.prototype.depend = function depend () {
725 if (Dep.target) {
726 Dep.target.addDep(this);
727 }
728};
729
730Dep.prototype.notify = function notify () {
731 // stabilize the subscriber list first
732 var subs = this.subs.slice();
733 if (!config.async) {
734 // subs aren't sorted in scheduler if not running async
735 // we need to sort them now to make sure they fire in correct
736 // order
737 subs.sort(function (a, b) { return a.id - b.id; });
738 }
739 for (var i = 0, l = subs.length; i < l; i++) {
740 subs[i].update();
741 }
742};
743
744// The current target watcher being evaluated.
745// This is globally unique because only one watcher
746// can be evaluated at a time.
747Dep.target = null;
748var targetStack = [];
749
750function pushTarget (target) {
751 targetStack.push(target);
752 Dep.target = target;
753}
754
755function popTarget () {
756 targetStack.pop();
757 Dep.target = targetStack[targetStack.length - 1];
758}
759
760/* */
761
762var VNode = function VNode (
763 tag,
764 data,
765 children,
766 text,
767 elm,
768 context,
769 componentOptions,
770 asyncFactory
771) {
772 this.tag = tag;
773 this.data = data;
774 this.children = children;
775 this.text = text;
776 this.elm = elm;
777 this.ns = undefined;
778 this.context = context;
779 this.fnContext = undefined;
780 this.fnOptions = undefined;
781 this.fnScopeId = undefined;
782 this.key = data && data.key;
783 this.componentOptions = componentOptions;
784 this.componentInstance = undefined;
785 this.parent = undefined;
786 this.raw = false;
787 this.isStatic = false;
788 this.isRootInsert = true;
789 this.isComment = false;
790 this.isCloned = false;
791 this.isOnce = false;
792 this.asyncFactory = asyncFactory;
793 this.asyncMeta = undefined;
794 this.isAsyncPlaceholder = false;
795};
796
797var prototypeAccessors = { child: { configurable: true } };
798
799// DEPRECATED: alias for componentInstance for backwards compat.
800/* istanbul ignore next */
801prototypeAccessors.child.get = function () {
802 return this.componentInstance
803};
804
805Object.defineProperties( VNode.prototype, prototypeAccessors );
806
807var createEmptyVNode = function (text) {
808 if ( text === void 0 ) text = '';
809
810 var node = new VNode();
811 node.text = text;
812 node.isComment = true;
813 return node
814};
815
816function createTextVNode (val) {
817 return new VNode(undefined, undefined, undefined, String(val))
818}
819
820// optimized shallow clone
821// used for static nodes and slot nodes because they may be reused across
822// multiple renders, cloning them avoids errors when DOM manipulations rely
823// on their elm reference.
824function cloneVNode (vnode) {
825 var cloned = new VNode(
826 vnode.tag,
827 vnode.data,
828 // #7975
829 // clone children array to avoid mutating original in case of cloning
830 // a child.
831 vnode.children && vnode.children.slice(),
832 vnode.text,
833 vnode.elm,
834 vnode.context,
835 vnode.componentOptions,
836 vnode.asyncFactory
837 );
838 cloned.ns = vnode.ns;
839 cloned.isStatic = vnode.isStatic;
840 cloned.key = vnode.key;
841 cloned.isComment = vnode.isComment;
842 cloned.fnContext = vnode.fnContext;
843 cloned.fnOptions = vnode.fnOptions;
844 cloned.fnScopeId = vnode.fnScopeId;
845 cloned.asyncMeta = vnode.asyncMeta;
846 cloned.isCloned = true;
847 return cloned
848}
849
850/*
851 * not type checking this file because flow doesn't play well with
852 * dynamically accessing methods on Array prototype
853 */
854
855var arrayProto = Array.prototype;
856var arrayMethods = Object.create(arrayProto);
857
858var methodsToPatch = [
859 'push',
860 'pop',
861 'shift',
862 'unshift',
863 'splice',
864 'sort',
865 'reverse'
866];
867
868/**
869 * Intercept mutating methods and emit events
870 */
871methodsToPatch.forEach(function (method) {
872 // cache original method
873 var original = arrayProto[method];
874 def(arrayMethods, method, function mutator () {
875 var args = [], len = arguments.length;
876 while ( len-- ) args[ len ] = arguments[ len ];
877
878 var result = original.apply(this, args);
879 var ob = this.__ob__;
880 var inserted;
881 switch (method) {
882 case 'push':
883 case 'unshift':
884 inserted = args;
885 break
886 case 'splice':
887 inserted = args.slice(2);
888 break
889 }
890 if (inserted) { ob.observeArray(inserted); }
891 // notify change
892 ob.dep.notify();
893 return result
894 });
895});
896
897/* */
898
899var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
900
901/**
902 * In some cases we may want to disable observation inside a component's
903 * update computation.
904 */
905var shouldObserve = true;
906
907function toggleObserving (value) {
908 shouldObserve = value;
909}
910
911/**
912 * Observer class that is attached to each observed
913 * object. Once attached, the observer converts the target
914 * object's property keys into getter/setters that
915 * collect dependencies and dispatch updates.
916 */
917var Observer = function Observer (value) {
918 this.value = value;
919 this.dep = new Dep();
920 this.vmCount = 0;
921 def(value, '__ob__', this);
922 if (Array.isArray(value)) {
923 if (hasProto) {
924 protoAugment(value, arrayMethods);
925 } else {
926 copyAugment(value, arrayMethods, arrayKeys);
927 }
928 this.observeArray(value);
929 } else {
930 this.walk(value);
931 }
932};
933
934/**
935 * Walk through all properties and convert them into
936 * getter/setters. This method should only be called when
937 * value type is Object.
938 */
939Observer.prototype.walk = function walk (obj) {
940 var keys = Object.keys(obj);
941 for (var i = 0; i < keys.length; i++) {
942 defineReactive$$1(obj, keys[i]);
943 }
944};
945
946/**
947 * Observe a list of Array items.
948 */
949Observer.prototype.observeArray = function observeArray (items) {
950 for (var i = 0, l = items.length; i < l; i++) {
951 observe(items[i]);
952 }
953};
954
955// helpers
956
957/**
958 * Augment a target Object or Array by intercepting
959 * the prototype chain using __proto__
960 */
961function protoAugment (target, src) {
962 /* eslint-disable no-proto */
963 target.__proto__ = src;
964 /* eslint-enable no-proto */
965}
966
967/**
968 * Augment a target Object or Array by defining
969 * hidden properties.
970 */
971/* istanbul ignore next */
972function copyAugment (target, src, keys) {
973 for (var i = 0, l = keys.length; i < l; i++) {
974 var key = keys[i];
975 def(target, key, src[key]);
976 }
977}
978
979/**
980 * Attempt to create an observer instance for a value,
981 * returns the new observer if successfully observed,
982 * or the existing observer if the value already has one.
983 */
984function observe (value, asRootData) {
985 if (!isObject(value) || value instanceof VNode) {
986 return
987 }
988 var ob;
989 if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
990 ob = value.__ob__;
991 } else if (
992 shouldObserve &&
993 !isServerRendering() &&
994 (Array.isArray(value) || isPlainObject(value)) &&
995 Object.isExtensible(value) &&
996 !value._isVue
997 ) {
998 ob = new Observer(value);
999 }
1000 if (asRootData && ob) {
1001 ob.vmCount++;
1002 }
1003 return ob
1004}
1005
1006/**
1007 * Define a reactive property on an Object.
1008 */
1009function defineReactive$$1 (
1010 obj,
1011 key,
1012 val,
1013 customSetter,
1014 shallow
1015) {
1016 var dep = new Dep();
1017
1018 var property = Object.getOwnPropertyDescriptor(obj, key);
1019 if (property && property.configurable === false) {
1020 return
1021 }
1022
1023 // cater for pre-defined getter/setters
1024 var getter = property && property.get;
1025 var setter = property && property.set;
1026 if ((!getter || setter) && arguments.length === 2) {
1027 val = obj[key];
1028 }
1029
1030 var childOb = !shallow && observe(val);
1031 Object.defineProperty(obj, key, {
1032 enumerable: true,
1033 configurable: true,
1034 get: function reactiveGetter () {
1035 var value = getter ? getter.call(obj) : val;
1036 if (Dep.target) {
1037 dep.depend();
1038 if (childOb) {
1039 childOb.dep.depend();
1040 if (Array.isArray(value)) {
1041 dependArray(value);
1042 }
1043 }
1044 }
1045 return value
1046 },
1047 set: function reactiveSetter (newVal) {
1048 var value = getter ? getter.call(obj) : val;
1049 /* eslint-disable no-self-compare */
1050 if (newVal === value || (newVal !== newVal && value !== value)) {
1051 return
1052 }
1053 /* eslint-enable no-self-compare */
1054 if (customSetter) {
1055 customSetter();
1056 }
1057 // #7981: for accessor properties without setter
1058 if (getter && !setter) { return }
1059 if (setter) {
1060 setter.call(obj, newVal);
1061 } else {
1062 val = newVal;
1063 }
1064 childOb = !shallow && observe(newVal);
1065 dep.notify();
1066 }
1067 });
1068}
1069
1070/**
1071 * Set a property on an object. Adds the new property and
1072 * triggers change notification if the property doesn't
1073 * already exist.
1074 */
1075function set (target, key, val) {
1076 if (isUndef(target) || isPrimitive(target)
1077 ) {
1078 warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
1079 }
1080 if (Array.isArray(target) && isValidArrayIndex(key)) {
1081 target.length = Math.max(target.length, key);
1082 target.splice(key, 1, val);
1083 return val
1084 }
1085 if (key in target && !(key in Object.prototype)) {
1086 target[key] = val;
1087 return val
1088 }
1089 var ob = (target).__ob__;
1090 if (target._isVue || (ob && ob.vmCount)) {
1091 warn(
1092 'Avoid adding reactive properties to a Vue instance or its root $data ' +
1093 'at runtime - declare it upfront in the data option.'
1094 );
1095 return val
1096 }
1097 if (!ob) {
1098 target[key] = val;
1099 return val
1100 }
1101 defineReactive$$1(ob.value, key, val);
1102 ob.dep.notify();
1103 return val
1104}
1105
1106/**
1107 * Delete a property and trigger change if necessary.
1108 */
1109function del (target, key) {
1110 if (isUndef(target) || isPrimitive(target)
1111 ) {
1112 warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
1113 }
1114 if (Array.isArray(target) && isValidArrayIndex(key)) {
1115 target.splice(key, 1);
1116 return
1117 }
1118 var ob = (target).__ob__;
1119 if (target._isVue || (ob && ob.vmCount)) {
1120 warn(
1121 'Avoid deleting properties on a Vue instance or its root $data ' +
1122 '- just set it to null.'
1123 );
1124 return
1125 }
1126 if (!hasOwn(target, key)) {
1127 return
1128 }
1129 delete target[key];
1130 if (!ob) {
1131 return
1132 }
1133 ob.dep.notify();
1134}
1135
1136/**
1137 * Collect dependencies on array elements when the array is touched, since
1138 * we cannot intercept array element access like property getters.
1139 */
1140function dependArray (value) {
1141 for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
1142 e = value[i];
1143 e && e.__ob__ && e.__ob__.dep.depend();
1144 if (Array.isArray(e)) {
1145 dependArray(e);
1146 }
1147 }
1148}
1149
1150/* */
1151
1152/**
1153 * Option overwriting strategies are functions that handle
1154 * how to merge a parent option value and a child option
1155 * value into the final value.
1156 */
1157var strats = config.optionMergeStrategies;
1158
1159/**
1160 * Options with restrictions
1161 */
1162{
1163 strats.el = strats.propsData = function (parent, child, vm, key) {
1164 if (!vm) {
1165 warn(
1166 "option \"" + key + "\" can only be used during instance " +
1167 'creation with the `new` keyword.'
1168 );
1169 }
1170 return defaultStrat(parent, child)
1171 };
1172}
1173
1174/**
1175 * Helper that recursively merges two data objects together.
1176 */
1177function mergeData (to, from) {
1178 if (!from) { return to }
1179 var key, toVal, fromVal;
1180
1181 var keys = hasSymbol
1182 ? Reflect.ownKeys(from)
1183 : Object.keys(from);
1184
1185 for (var i = 0; i < keys.length; i++) {
1186 key = keys[i];
1187 // in case the object is already observed...
1188 if (key === '__ob__') { continue }
1189 toVal = to[key];
1190 fromVal = from[key];
1191 if (!hasOwn(to, key)) {
1192 set(to, key, fromVal);
1193 } else if (
1194 toVal !== fromVal &&
1195 isPlainObject(toVal) &&
1196 isPlainObject(fromVal)
1197 ) {
1198 mergeData(toVal, fromVal);
1199 }
1200 }
1201 return to
1202}
1203
1204/**
1205 * Data
1206 */
1207function mergeDataOrFn (
1208 parentVal,
1209 childVal,
1210 vm
1211) {
1212 if (!vm) {
1213 // in a Vue.extend merge, both should be functions
1214 if (!childVal) {
1215 return parentVal
1216 }
1217 if (!parentVal) {
1218 return childVal
1219 }
1220 // when parentVal & childVal are both present,
1221 // we need to return a function that returns the
1222 // merged result of both functions... no need to
1223 // check if parentVal is a function here because
1224 // it has to be a function to pass previous merges.
1225 return function mergedDataFn () {
1226 return mergeData(
1227 typeof childVal === 'function' ? childVal.call(this, this) : childVal,
1228 typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
1229 )
1230 }
1231 } else {
1232 return function mergedInstanceDataFn () {
1233 // instance merge
1234 var instanceData = typeof childVal === 'function'
1235 ? childVal.call(vm, vm)
1236 : childVal;
1237 var defaultData = typeof parentVal === 'function'
1238 ? parentVal.call(vm, vm)
1239 : parentVal;
1240 if (instanceData) {
1241 return mergeData(instanceData, defaultData)
1242 } else {
1243 return defaultData
1244 }
1245 }
1246 }
1247}
1248
1249strats.data = function (
1250 parentVal,
1251 childVal,
1252 vm
1253) {
1254 if (!vm) {
1255 if (childVal && typeof childVal !== 'function') {
1256 warn(
1257 'The "data" option should be a function ' +
1258 'that returns a per-instance value in component ' +
1259 'definitions.',
1260 vm
1261 );
1262
1263 return parentVal
1264 }
1265 return mergeDataOrFn(parentVal, childVal)
1266 }
1267
1268 return mergeDataOrFn(parentVal, childVal, vm)
1269};
1270
1271/**
1272 * Hooks and props are merged as arrays.
1273 */
1274function mergeHook (
1275 parentVal,
1276 childVal
1277) {
1278 var res = childVal
1279 ? parentVal
1280 ? parentVal.concat(childVal)
1281 : Array.isArray(childVal)
1282 ? childVal
1283 : [childVal]
1284 : parentVal;
1285 return res
1286 ? dedupeHooks(res)
1287 : res
1288}
1289
1290function dedupeHooks (hooks) {
1291 var res = [];
1292 for (var i = 0; i < hooks.length; i++) {
1293 if (res.indexOf(hooks[i]) === -1) {
1294 res.push(hooks[i]);
1295 }
1296 }
1297 return res
1298}
1299
1300LIFECYCLE_HOOKS.forEach(function (hook) {
1301 strats[hook] = mergeHook;
1302});
1303
1304/**
1305 * Assets
1306 *
1307 * When a vm is present (instance creation), we need to do
1308 * a three-way merge between constructor options, instance
1309 * options and parent options.
1310 */
1311function mergeAssets (
1312 parentVal,
1313 childVal,
1314 vm,
1315 key
1316) {
1317 var res = Object.create(parentVal || null);
1318 if (childVal) {
1319 assertObjectType(key, childVal, vm);
1320 return extend(res, childVal)
1321 } else {
1322 return res
1323 }
1324}
1325
1326ASSET_TYPES.forEach(function (type) {
1327 strats[type + 's'] = mergeAssets;
1328});
1329
1330/**
1331 * Watchers.
1332 *
1333 * Watchers hashes should not overwrite one
1334 * another, so we merge them as arrays.
1335 */
1336strats.watch = function (
1337 parentVal,
1338 childVal,
1339 vm,
1340 key
1341) {
1342 // work around Firefox's Object.prototype.watch...
1343 if (parentVal === nativeWatch) { parentVal = undefined; }
1344 if (childVal === nativeWatch) { childVal = undefined; }
1345 /* istanbul ignore if */
1346 if (!childVal) { return Object.create(parentVal || null) }
1347 {
1348 assertObjectType(key, childVal, vm);
1349 }
1350 if (!parentVal) { return childVal }
1351 var ret = {};
1352 extend(ret, parentVal);
1353 for (var key$1 in childVal) {
1354 var parent = ret[key$1];
1355 var child = childVal[key$1];
1356 if (parent && !Array.isArray(parent)) {
1357 parent = [parent];
1358 }
1359 ret[key$1] = parent
1360 ? parent.concat(child)
1361 : Array.isArray(child) ? child : [child];
1362 }
1363 return ret
1364};
1365
1366/**
1367 * Other object hashes.
1368 */
1369strats.props =
1370strats.methods =
1371strats.inject =
1372strats.computed = function (
1373 parentVal,
1374 childVal,
1375 vm,
1376 key
1377) {
1378 if (childVal && "development" !== 'production') {
1379 assertObjectType(key, childVal, vm);
1380 }
1381 if (!parentVal) { return childVal }
1382 var ret = Object.create(null);
1383 extend(ret, parentVal);
1384 if (childVal) { extend(ret, childVal); }
1385 return ret
1386};
1387strats.provide = mergeDataOrFn;
1388
1389/**
1390 * Default strategy.
1391 */
1392var defaultStrat = function (parentVal, childVal) {
1393 return childVal === undefined
1394 ? parentVal
1395 : childVal
1396};
1397
1398/**
1399 * Validate component names
1400 */
1401function checkComponents (options) {
1402 for (var key in options.components) {
1403 validateComponentName(key);
1404 }
1405}
1406
1407function validateComponentName (name) {
1408 if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*$")).test(name)) {
1409 warn(
1410 'Invalid component name: "' + name + '". Component names ' +
1411 'should conform to valid custom element name in html5 specification.'
1412 );
1413 }
1414 if (isBuiltInTag(name) || config.isReservedTag(name)) {
1415 warn(
1416 'Do not use built-in or reserved HTML elements as component ' +
1417 'id: ' + name
1418 );
1419 }
1420}
1421
1422/**
1423 * Ensure all props option syntax are normalized into the
1424 * Object-based format.
1425 */
1426function normalizeProps (options, vm) {
1427 var props = options.props;
1428 if (!props) { return }
1429 var res = {};
1430 var i, val, name;
1431 if (Array.isArray(props)) {
1432 i = props.length;
1433 while (i--) {
1434 val = props[i];
1435 if (typeof val === 'string') {
1436 name = camelize(val);
1437 res[name] = { type: null };
1438 } else {
1439 warn('props must be strings when using array syntax.');
1440 }
1441 }
1442 } else if (isPlainObject(props)) {
1443 for (var key in props) {
1444 val = props[key];
1445 name = camelize(key);
1446 res[name] = isPlainObject(val)
1447 ? val
1448 : { type: val };
1449 }
1450 } else {
1451 warn(
1452 "Invalid value for option \"props\": expected an Array or an Object, " +
1453 "but got " + (toRawType(props)) + ".",
1454 vm
1455 );
1456 }
1457 options.props = res;
1458}
1459
1460/**
1461 * Normalize all injections into Object-based format
1462 */
1463function normalizeInject (options, vm) {
1464 var inject = options.inject;
1465 if (!inject) { return }
1466 var normalized = options.inject = {};
1467 if (Array.isArray(inject)) {
1468 for (var i = 0; i < inject.length; i++) {
1469 normalized[inject[i]] = { from: inject[i] };
1470 }
1471 } else if (isPlainObject(inject)) {
1472 for (var key in inject) {
1473 var val = inject[key];
1474 normalized[key] = isPlainObject(val)
1475 ? extend({ from: key }, val)
1476 : { from: val };
1477 }
1478 } else {
1479 warn(
1480 "Invalid value for option \"inject\": expected an Array or an Object, " +
1481 "but got " + (toRawType(inject)) + ".",
1482 vm
1483 );
1484 }
1485}
1486
1487/**
1488 * Normalize raw function directives into object format.
1489 */
1490function normalizeDirectives (options) {
1491 var dirs = options.directives;
1492 if (dirs) {
1493 for (var key in dirs) {
1494 var def$$1 = dirs[key];
1495 if (typeof def$$1 === 'function') {
1496 dirs[key] = { bind: def$$1, update: def$$1 };
1497 }
1498 }
1499 }
1500}
1501
1502function assertObjectType (name, value, vm) {
1503 if (!isPlainObject(value)) {
1504 warn(
1505 "Invalid value for option \"" + name + "\": expected an Object, " +
1506 "but got " + (toRawType(value)) + ".",
1507 vm
1508 );
1509 }
1510}
1511
1512/**
1513 * Merge two option objects into a new one.
1514 * Core utility used in both instantiation and inheritance.
1515 */
1516function mergeOptions (
1517 parent,
1518 child,
1519 vm
1520) {
1521 {
1522 checkComponents(child);
1523 }
1524
1525 if (typeof child === 'function') {
1526 child = child.options;
1527 }
1528
1529 normalizeProps(child, vm);
1530 normalizeInject(child, vm);
1531 normalizeDirectives(child);
1532
1533 // Apply extends and mixins on the child options,
1534 // but only if it is a raw options object that isn't
1535 // the result of another mergeOptions call.
1536 // Only merged options has the _base property.
1537 if (!child._base) {
1538 if (child.extends) {
1539 parent = mergeOptions(parent, child.extends, vm);
1540 }
1541 if (child.mixins) {
1542 for (var i = 0, l = child.mixins.length; i < l; i++) {
1543 parent = mergeOptions(parent, child.mixins[i], vm);
1544 }
1545 }
1546 }
1547
1548 var options = {};
1549 var key;
1550 for (key in parent) {
1551 mergeField(key);
1552 }
1553 for (key in child) {
1554 if (!hasOwn(parent, key)) {
1555 mergeField(key);
1556 }
1557 }
1558 function mergeField (key) {
1559 var strat = strats[key] || defaultStrat;
1560 options[key] = strat(parent[key], child[key], vm, key);
1561 }
1562 return options
1563}
1564
1565/**
1566 * Resolve an asset.
1567 * This function is used because child instances need access
1568 * to assets defined in its ancestor chain.
1569 */
1570function resolveAsset (
1571 options,
1572 type,
1573 id,
1574 warnMissing
1575) {
1576 /* istanbul ignore if */
1577 if (typeof id !== 'string') {
1578 return
1579 }
1580 var assets = options[type];
1581 // check local registration variations first
1582 if (hasOwn(assets, id)) { return assets[id] }
1583 var camelizedId = camelize(id);
1584 if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
1585 var PascalCaseId = capitalize(camelizedId);
1586 if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
1587 // fallback to prototype chain
1588 var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
1589 if (warnMissing && !res) {
1590 warn(
1591 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
1592 options
1593 );
1594 }
1595 return res
1596}
1597
1598/* */
1599
1600
1601
1602function validateProp (
1603 key,
1604 propOptions,
1605 propsData,
1606 vm
1607) {
1608 var prop = propOptions[key];
1609 var absent = !hasOwn(propsData, key);
1610 var value = propsData[key];
1611 // boolean casting
1612 var booleanIndex = getTypeIndex(Boolean, prop.type);
1613 if (booleanIndex > -1) {
1614 if (absent && !hasOwn(prop, 'default')) {
1615 value = false;
1616 } else if (value === '' || value === hyphenate(key)) {
1617 // only cast empty string / same name to boolean if
1618 // boolean has higher priority
1619 var stringIndex = getTypeIndex(String, prop.type);
1620 if (stringIndex < 0 || booleanIndex < stringIndex) {
1621 value = true;
1622 }
1623 }
1624 }
1625 // check default value
1626 if (value === undefined) {
1627 value = getPropDefaultValue(vm, prop, key);
1628 // since the default value is a fresh copy,
1629 // make sure to observe it.
1630 var prevShouldObserve = shouldObserve;
1631 toggleObserving(true);
1632 observe(value);
1633 toggleObserving(prevShouldObserve);
1634 }
1635 {
1636 assertProp(prop, key, value, vm, absent);
1637 }
1638 return value
1639}
1640
1641/**
1642 * Get the default value of a prop.
1643 */
1644function getPropDefaultValue (vm, prop, key) {
1645 // no default, return undefined
1646 if (!hasOwn(prop, 'default')) {
1647 return undefined
1648 }
1649 var def = prop.default;
1650 // warn against non-factory defaults for Object & Array
1651 if (isObject(def)) {
1652 warn(
1653 'Invalid default value for prop "' + key + '": ' +
1654 'Props with type Object/Array must use a factory function ' +
1655 'to return the default value.',
1656 vm
1657 );
1658 }
1659 // the raw prop value was also undefined from previous render,
1660 // return previous default value to avoid unnecessary watcher trigger
1661 if (vm && vm.$options.propsData &&
1662 vm.$options.propsData[key] === undefined &&
1663 vm._props[key] !== undefined
1664 ) {
1665 return vm._props[key]
1666 }
1667 // call factory function for non-Function types
1668 // a value is Function if its prototype is function even across different execution context
1669 return typeof def === 'function' && getType(prop.type) !== 'Function'
1670 ? def.call(vm)
1671 : def
1672}
1673
1674/**
1675 * Assert whether a prop is valid.
1676 */
1677function assertProp (
1678 prop,
1679 name,
1680 value,
1681 vm,
1682 absent
1683) {
1684 if (prop.required && absent) {
1685 warn(
1686 'Missing required prop: "' + name + '"',
1687 vm
1688 );
1689 return
1690 }
1691 if (value == null && !prop.required) {
1692 return
1693 }
1694 var type = prop.type;
1695 var valid = !type || type === true;
1696 var expectedTypes = [];
1697 if (type) {
1698 if (!Array.isArray(type)) {
1699 type = [type];
1700 }
1701 for (var i = 0; i < type.length && !valid; i++) {
1702 var assertedType = assertType(value, type[i]);
1703 expectedTypes.push(assertedType.expectedType || '');
1704 valid = assertedType.valid;
1705 }
1706 }
1707
1708 if (!valid) {
1709 warn(
1710 getInvalidTypeMessage(name, value, expectedTypes),
1711 vm
1712 );
1713 return
1714 }
1715 var validator = prop.validator;
1716 if (validator) {
1717 if (!validator(value)) {
1718 warn(
1719 'Invalid prop: custom validator check failed for prop "' + name + '".',
1720 vm
1721 );
1722 }
1723 }
1724}
1725
1726var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
1727
1728function assertType (value, type) {
1729 var valid;
1730 var expectedType = getType(type);
1731 if (simpleCheckRE.test(expectedType)) {
1732 var t = typeof value;
1733 valid = t === expectedType.toLowerCase();
1734 // for primitive wrapper objects
1735 if (!valid && t === 'object') {
1736 valid = value instanceof type;
1737 }
1738 } else if (expectedType === 'Object') {
1739 valid = isPlainObject(value);
1740 } else if (expectedType === 'Array') {
1741 valid = Array.isArray(value);
1742 } else {
1743 valid = value instanceof type;
1744 }
1745 return {
1746 valid: valid,
1747 expectedType: expectedType
1748 }
1749}
1750
1751/**
1752 * Use function string name to check built-in types,
1753 * because a simple equality check will fail when running
1754 * across different vms / iframes.
1755 */
1756function getType (fn) {
1757 var match = fn && fn.toString().match(/^\s*function (\w+)/);
1758 return match ? match[1] : ''
1759}
1760
1761function isSameType (a, b) {
1762 return getType(a) === getType(b)
1763}
1764
1765function getTypeIndex (type, expectedTypes) {
1766 if (!Array.isArray(expectedTypes)) {
1767 return isSameType(expectedTypes, type) ? 0 : -1
1768 }
1769 for (var i = 0, len = expectedTypes.length; i < len; i++) {
1770 if (isSameType(expectedTypes[i], type)) {
1771 return i
1772 }
1773 }
1774 return -1
1775}
1776
1777function getInvalidTypeMessage (name, value, expectedTypes) {
1778 var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
1779 " Expected " + (expectedTypes.map(capitalize).join(', '));
1780 var expectedType = expectedTypes[0];
1781 var receivedType = toRawType(value);
1782 var expectedValue = styleValue(value, expectedType);
1783 var receivedValue = styleValue(value, receivedType);
1784 // check if we need to specify expected value
1785 if (expectedTypes.length === 1 &&
1786 isExplicable(expectedType) &&
1787 !isBoolean(expectedType, receivedType)) {
1788 message += " with value " + expectedValue;
1789 }
1790 message += ", got " + receivedType + " ";
1791 // check if we need to specify received value
1792 if (isExplicable(receivedType)) {
1793 message += "with value " + receivedValue + ".";
1794 }
1795 return message
1796}
1797
1798function styleValue (value, type) {
1799 if (type === 'String') {
1800 return ("\"" + value + "\"")
1801 } else if (type === 'Number') {
1802 return ("" + (Number(value)))
1803 } else {
1804 return ("" + value)
1805 }
1806}
1807
1808function isExplicable (value) {
1809 var explicitTypes = ['string', 'number', 'boolean'];
1810 return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
1811}
1812
1813function isBoolean () {
1814 var args = [], len = arguments.length;
1815 while ( len-- ) args[ len ] = arguments[ len ];
1816
1817 return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
1818}
1819
1820/* */
1821
1822function handleError (err, vm, info) {
1823 if (vm) {
1824 var cur = vm;
1825 while ((cur = cur.$parent)) {
1826 var hooks = cur.$options.errorCaptured;
1827 if (hooks) {
1828 for (var i = 0; i < hooks.length; i++) {
1829 try {
1830 var capture = hooks[i].call(cur, err, vm, info) === false;
1831 if (capture) { return }
1832 } catch (e) {
1833 globalHandleError(e, cur, 'errorCaptured hook');
1834 }
1835 }
1836 }
1837 }
1838 }
1839 globalHandleError(err, vm, info);
1840}
1841
1842function invokeWithErrorHandling (
1843 handler,
1844 context,
1845 args,
1846 vm,
1847 info
1848) {
1849 var res;
1850 try {
1851 res = args ? handler.apply(context, args) : handler.call(context);
1852 if (isPromise(res)) {
1853 res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1854 }
1855 } catch (e) {
1856 handleError(e, vm, info);
1857 }
1858 return res
1859}
1860
1861function globalHandleError (err, vm, info) {
1862 if (config.errorHandler) {
1863 try {
1864 return config.errorHandler.call(null, err, vm, info)
1865 } catch (e) {
1866 logError(e, null, 'config.errorHandler');
1867 }
1868 }
1869 logError(err, vm, info);
1870}
1871
1872function logError (err, vm, info) {
1873 {
1874 warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
1875 }
1876 /* istanbul ignore else */
1877 if ((inBrowser || inWeex) && typeof console !== 'undefined') {
1878 console.error(err);
1879 } else {
1880 throw err
1881 }
1882}
1883
1884/* */
1885
1886var isUsingMicroTask = false;
1887
1888var callbacks = [];
1889var pending = false;
1890
1891function flushCallbacks () {
1892 pending = false;
1893 var copies = callbacks.slice(0);
1894 callbacks.length = 0;
1895 for (var i = 0; i < copies.length; i++) {
1896 copies[i]();
1897 }
1898}
1899
1900// Here we have async deferring wrappers using microtasks.
1901// In 2.5 we used (macro) tasks (in combination with microtasks).
1902// However, it has subtle problems when state is changed right before repaint
1903// (e.g. #6813, out-in transitions).
1904// Also, using (macro) tasks in event handler would cause some weird behaviors
1905// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
1906// So we now use microtasks everywhere, again.
1907// A major drawback of this tradeoff is that there are some scenarios
1908// where microtasks have too high a priority and fire in between supposedly
1909// sequential events (e.g. #4521, #6690, which have workarounds)
1910// or even between bubbling of the same event (#6566).
1911var timerFunc;
1912
1913// The nextTick behavior leverages the microtask queue, which can be accessed
1914// via either native Promise.then or MutationObserver.
1915// MutationObserver has wider support, however it is seriously bugged in
1916// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
1917// completely stops working after triggering a few times... so, if native
1918// Promise is available, we will use it:
1919/* istanbul ignore next, $flow-disable-line */
1920if (typeof Promise !== 'undefined' && isNative(Promise)) {
1921 var p = Promise.resolve();
1922 timerFunc = function () {
1923 p.then(flushCallbacks);
1924 // In problematic UIWebViews, Promise.then doesn't completely break, but
1925 // it can get stuck in a weird state where callbacks are pushed into the
1926 // microtask queue but the queue isn't being flushed, until the browser
1927 // needs to do some other work, e.g. handle a timer. Therefore we can
1928 // "force" the microtask queue to be flushed by adding an empty timer.
1929 if (isIOS) { setTimeout(noop); }
1930 };
1931 isUsingMicroTask = true;
1932} else if (!isIE && typeof MutationObserver !== 'undefined' && (
1933 isNative(MutationObserver) ||
1934 // PhantomJS and iOS 7.x
1935 MutationObserver.toString() === '[object MutationObserverConstructor]'
1936)) {
1937 // Use MutationObserver where native Promise is not available,
1938 // e.g. PhantomJS, iOS7, Android 4.4
1939 // (#6466 MutationObserver is unreliable in IE11)
1940 var counter = 1;
1941 var observer = new MutationObserver(flushCallbacks);
1942 var textNode = document.createTextNode(String(counter));
1943 observer.observe(textNode, {
1944 characterData: true
1945 });
1946 timerFunc = function () {
1947 counter = (counter + 1) % 2;
1948 textNode.data = String(counter);
1949 };
1950 isUsingMicroTask = true;
1951} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
1952 // Fallback to setImmediate.
1953 // Techinically it leverages the (macro) task queue,
1954 // but it is still a better choice than setTimeout.
1955 timerFunc = function () {
1956 setImmediate(flushCallbacks);
1957 };
1958} else {
1959 // Fallback to setTimeout.
1960 timerFunc = function () {
1961 setTimeout(flushCallbacks, 0);
1962 };
1963}
1964
1965function nextTick (cb, ctx) {
1966 var _resolve;
1967 callbacks.push(function () {
1968 if (cb) {
1969 try {
1970 cb.call(ctx);
1971 } catch (e) {
1972 handleError(e, ctx, 'nextTick');
1973 }
1974 } else if (_resolve) {
1975 _resolve(ctx);
1976 }
1977 });
1978 if (!pending) {
1979 pending = true;
1980 timerFunc();
1981 }
1982 // $flow-disable-line
1983 if (!cb && typeof Promise !== 'undefined') {
1984 return new Promise(function (resolve) {
1985 _resolve = resolve;
1986 })
1987 }
1988}
1989
1990/* */
1991
1992var mark;
1993var measure;
1994
1995{
1996 var perf = inBrowser && window.performance;
1997 /* istanbul ignore if */
1998 if (
1999 perf &&
2000 perf.mark &&
2001 perf.measure &&
2002 perf.clearMarks &&
2003 perf.clearMeasures
2004 ) {
2005 mark = function (tag) { return perf.mark(tag); };
2006 measure = function (name, startTag, endTag) {
2007 perf.measure(name, startTag, endTag);
2008 perf.clearMarks(startTag);
2009 perf.clearMarks(endTag);
2010 // perf.clearMeasures(name)
2011 };
2012 }
2013}
2014
2015/* not type checking this file because flow doesn't play well with Proxy */
2016
2017var initProxy;
2018
2019{
2020 var allowedGlobals = makeMap(
2021 'Infinity,undefined,NaN,isFinite,isNaN,' +
2022 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
2023 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
2024 'require' // for Webpack/Browserify
2025 );
2026
2027 var warnNonPresent = function (target, key) {
2028 warn(
2029 "Property or method \"" + key + "\" is not defined on the instance but " +
2030 'referenced during render. Make sure that this property is reactive, ' +
2031 'either in the data option, or for class-based components, by ' +
2032 'initializing the property. ' +
2033 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
2034 target
2035 );
2036 };
2037
2038 var warnReservedPrefix = function (target, key) {
2039 warn(
2040 "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
2041 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
2042 'prevent conflicts with Vue internals' +
2043 'See: https://vuejs.org/v2/api/#data',
2044 target
2045 );
2046 };
2047
2048 var hasProxy =
2049 typeof Proxy !== 'undefined' && isNative(Proxy);
2050
2051 if (hasProxy) {
2052 var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
2053 config.keyCodes = new Proxy(config.keyCodes, {
2054 set: function set (target, key, value) {
2055 if (isBuiltInModifier(key)) {
2056 warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
2057 return false
2058 } else {
2059 target[key] = value;
2060 return true
2061 }
2062 }
2063 });
2064 }
2065
2066 var hasHandler = {
2067 has: function has (target, key) {
2068 var has = key in target;
2069 var isAllowed = allowedGlobals(key) ||
2070 (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
2071 if (!has && !isAllowed) {
2072 if (key in target.$data) { warnReservedPrefix(target, key); }
2073 else { warnNonPresent(target, key); }
2074 }
2075 return has || !isAllowed
2076 }
2077 };
2078
2079 var getHandler = {
2080 get: function get (target, key) {
2081 if (typeof key === 'string' && !(key in target)) {
2082 if (key in target.$data) { warnReservedPrefix(target, key); }
2083 else { warnNonPresent(target, key); }
2084 }
2085 return target[key]
2086 }
2087 };
2088
2089 initProxy = function initProxy (vm) {
2090 if (hasProxy) {
2091 // determine which proxy handler to use
2092 var options = vm.$options;
2093 var handlers = options.render && options.render._withStripped
2094 ? getHandler
2095 : hasHandler;
2096 vm._renderProxy = new Proxy(vm, handlers);
2097 } else {
2098 vm._renderProxy = vm;
2099 }
2100 };
2101}
2102
2103/* */
2104
2105var seenObjects = new _Set();
2106
2107/**
2108 * Recursively traverse an object to evoke all converted
2109 * getters, so that every nested property inside the object
2110 * is collected as a "deep" dependency.
2111 */
2112function traverse (val) {
2113 _traverse(val, seenObjects);
2114 seenObjects.clear();
2115}
2116
2117function _traverse (val, seen) {
2118 var i, keys;
2119 var isA = Array.isArray(val);
2120 if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
2121 return
2122 }
2123 if (val.__ob__) {
2124 var depId = val.__ob__.dep.id;
2125 if (seen.has(depId)) {
2126 return
2127 }
2128 seen.add(depId);
2129 }
2130 if (isA) {
2131 i = val.length;
2132 while (i--) { _traverse(val[i], seen); }
2133 } else {
2134 keys = Object.keys(val);
2135 i = keys.length;
2136 while (i--) { _traverse(val[keys[i]], seen); }
2137 }
2138}
2139
2140/* */
2141
2142var normalizeEvent = cached(function (name) {
2143 var passive = name.charAt(0) === '&';
2144 name = passive ? name.slice(1) : name;
2145 var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
2146 name = once$$1 ? name.slice(1) : name;
2147 var capture = name.charAt(0) === '!';
2148 name = capture ? name.slice(1) : name;
2149 return {
2150 name: name,
2151 once: once$$1,
2152 capture: capture,
2153 passive: passive
2154 }
2155});
2156
2157function createFnInvoker (fns, vm) {
2158 function invoker () {
2159 var arguments$1 = arguments;
2160
2161 var fns = invoker.fns;
2162 if (Array.isArray(fns)) {
2163 var cloned = fns.slice();
2164 for (var i = 0; i < cloned.length; i++) {
2165 invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
2166 }
2167 } else {
2168 // return handler return value for single handlers
2169 return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
2170 }
2171 }
2172 invoker.fns = fns;
2173 return invoker
2174}
2175
2176function updateListeners (
2177 on,
2178 oldOn,
2179 add,
2180 remove$$1,
2181 createOnceHandler,
2182 vm
2183) {
2184 var name, def$$1, cur, old, event;
2185 for (name in on) {
2186 def$$1 = cur = on[name];
2187 old = oldOn[name];
2188 event = normalizeEvent(name);
2189 if (isUndef(cur)) {
2190 warn(
2191 "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
2192 vm
2193 );
2194 } else if (isUndef(old)) {
2195 if (isUndef(cur.fns)) {
2196 cur = on[name] = createFnInvoker(cur, vm);
2197 }
2198 if (isTrue(event.once)) {
2199 cur = on[name] = createOnceHandler(event.name, cur, event.capture);
2200 }
2201 add(event.name, cur, event.capture, event.passive, event.params);
2202 } else if (cur !== old) {
2203 old.fns = cur;
2204 on[name] = old;
2205 }
2206 }
2207 for (name in oldOn) {
2208 if (isUndef(on[name])) {
2209 event = normalizeEvent(name);
2210 remove$$1(event.name, oldOn[name], event.capture);
2211 }
2212 }
2213}
2214
2215/* */
2216
2217function mergeVNodeHook (def, hookKey, hook) {
2218 if (def instanceof VNode) {
2219 def = def.data.hook || (def.data.hook = {});
2220 }
2221 var invoker;
2222 var oldHook = def[hookKey];
2223
2224 function wrappedHook () {
2225 hook.apply(this, arguments);
2226 // important: remove merged hook to ensure it's called only once
2227 // and prevent memory leak
2228 remove(invoker.fns, wrappedHook);
2229 }
2230
2231 if (isUndef(oldHook)) {
2232 // no existing hook
2233 invoker = createFnInvoker([wrappedHook]);
2234 } else {
2235 /* istanbul ignore if */
2236 if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
2237 // already a merged invoker
2238 invoker = oldHook;
2239 invoker.fns.push(wrappedHook);
2240 } else {
2241 // existing plain hook
2242 invoker = createFnInvoker([oldHook, wrappedHook]);
2243 }
2244 }
2245
2246 invoker.merged = true;
2247 def[hookKey] = invoker;
2248}
2249
2250/* */
2251
2252function extractPropsFromVNodeData (
2253 data,
2254 Ctor,
2255 tag
2256) {
2257 // we are only extracting raw values here.
2258 // validation and default values are handled in the child
2259 // component itself.
2260 var propOptions = Ctor.options.props;
2261 if (isUndef(propOptions)) {
2262 return
2263 }
2264 var res = {};
2265 var attrs = data.attrs;
2266 var props = data.props;
2267 if (isDef(attrs) || isDef(props)) {
2268 for (var key in propOptions) {
2269 var altKey = hyphenate(key);
2270 {
2271 var keyInLowerCase = key.toLowerCase();
2272 if (
2273 key !== keyInLowerCase &&
2274 attrs && hasOwn(attrs, keyInLowerCase)
2275 ) {
2276 tip(
2277 "Prop \"" + keyInLowerCase + "\" is passed to component " +
2278 (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
2279 " \"" + key + "\". " +
2280 "Note that HTML attributes are case-insensitive and camelCased " +
2281 "props need to use their kebab-case equivalents when using in-DOM " +
2282 "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
2283 );
2284 }
2285 }
2286 checkProp(res, props, key, altKey, true) ||
2287 checkProp(res, attrs, key, altKey, false);
2288 }
2289 }
2290 return res
2291}
2292
2293function checkProp (
2294 res,
2295 hash,
2296 key,
2297 altKey,
2298 preserve
2299) {
2300 if (isDef(hash)) {
2301 if (hasOwn(hash, key)) {
2302 res[key] = hash[key];
2303 if (!preserve) {
2304 delete hash[key];
2305 }
2306 return true
2307 } else if (hasOwn(hash, altKey)) {
2308 res[key] = hash[altKey];
2309 if (!preserve) {
2310 delete hash[altKey];
2311 }
2312 return true
2313 }
2314 }
2315 return false
2316}
2317
2318/* */
2319
2320// The template compiler attempts to minimize the need for normalization by
2321// statically analyzing the template at compile time.
2322//
2323// For plain HTML markup, normalization can be completely skipped because the
2324// generated render function is guaranteed to return Array<VNode>. There are
2325// two cases where extra normalization is needed:
2326
2327// 1. When the children contains components - because a functional component
2328// may return an Array instead of a single root. In this case, just a simple
2329// normalization is needed - if any child is an Array, we flatten the whole
2330// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
2331// because functional components already normalize their own children.
2332function simpleNormalizeChildren (children) {
2333 for (var i = 0; i < children.length; i++) {
2334 if (Array.isArray(children[i])) {
2335 return Array.prototype.concat.apply([], children)
2336 }
2337 }
2338 return children
2339}
2340
2341// 2. When the children contains constructs that always generated nested Arrays,
2342// e.g. <template>, <slot>, v-for, or when the children is provided by user
2343// with hand-written render functions / JSX. In such cases a full normalization
2344// is needed to cater to all possible types of children values.
2345function normalizeChildren (children) {
2346 return isPrimitive(children)
2347 ? [createTextVNode(children)]
2348 : Array.isArray(children)
2349 ? normalizeArrayChildren(children)
2350 : undefined
2351}
2352
2353function isTextNode (node) {
2354 return isDef(node) && isDef(node.text) && isFalse(node.isComment)
2355}
2356
2357function normalizeArrayChildren (children, nestedIndex) {
2358 var res = [];
2359 var i, c, lastIndex, last;
2360 for (i = 0; i < children.length; i++) {
2361 c = children[i];
2362 if (isUndef(c) || typeof c === 'boolean') { continue }
2363 lastIndex = res.length - 1;
2364 last = res[lastIndex];
2365 // nested
2366 if (Array.isArray(c)) {
2367 if (c.length > 0) {
2368 c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
2369 // merge adjacent text nodes
2370 if (isTextNode(c[0]) && isTextNode(last)) {
2371 res[lastIndex] = createTextVNode(last.text + (c[0]).text);
2372 c.shift();
2373 }
2374 res.push.apply(res, c);
2375 }
2376 } else if (isPrimitive(c)) {
2377 if (isTextNode(last)) {
2378 // merge adjacent text nodes
2379 // this is necessary for SSR hydration because text nodes are
2380 // essentially merged when rendered to HTML strings
2381 res[lastIndex] = createTextVNode(last.text + c);
2382 } else if (c !== '') {
2383 // convert primitive to vnode
2384 res.push(createTextVNode(c));
2385 }
2386 } else {
2387 if (isTextNode(c) && isTextNode(last)) {
2388 // merge adjacent text nodes
2389 res[lastIndex] = createTextVNode(last.text + c.text);
2390 } else {
2391 // default key for nested array children (likely generated by v-for)
2392 if (isTrue(children._isVList) &&
2393 isDef(c.tag) &&
2394 isUndef(c.key) &&
2395 isDef(nestedIndex)) {
2396 c.key = "__vlist" + nestedIndex + "_" + i + "__";
2397 }
2398 res.push(c);
2399 }
2400 }
2401 }
2402 return res
2403}
2404
2405/* */
2406
2407function ensureCtor (comp, base) {
2408 if (
2409 comp.__esModule ||
2410 (hasSymbol && comp[Symbol.toStringTag] === 'Module')
2411 ) {
2412 comp = comp.default;
2413 }
2414 return isObject(comp)
2415 ? base.extend(comp)
2416 : comp
2417}
2418
2419function createAsyncPlaceholder (
2420 factory,
2421 data,
2422 context,
2423 children,
2424 tag
2425) {
2426 var node = createEmptyVNode();
2427 node.asyncFactory = factory;
2428 node.asyncMeta = { data: data, context: context, children: children, tag: tag };
2429 return node
2430}
2431
2432function resolveAsyncComponent (
2433 factory,
2434 baseCtor,
2435 context
2436) {
2437 if (isTrue(factory.error) && isDef(factory.errorComp)) {
2438 return factory.errorComp
2439 }
2440
2441 if (isDef(factory.resolved)) {
2442 return factory.resolved
2443 }
2444
2445 if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
2446 return factory.loadingComp
2447 }
2448
2449 if (isDef(factory.contexts)) {
2450 // already pending
2451 factory.contexts.push(context);
2452 } else {
2453 var contexts = factory.contexts = [context];
2454 var sync = true;
2455
2456 var forceRender = function (renderCompleted) {
2457 for (var i = 0, l = contexts.length; i < l; i++) {
2458 contexts[i].$forceUpdate();
2459 }
2460
2461 if (renderCompleted) {
2462 contexts.length = 0;
2463 }
2464 };
2465
2466 var resolve = once(function (res) {
2467 // cache resolved
2468 factory.resolved = ensureCtor(res, baseCtor);
2469 // invoke callbacks only if this is not a synchronous resolve
2470 // (async resolves are shimmed as synchronous during SSR)
2471 if (!sync) {
2472 forceRender(true);
2473 } else {
2474 contexts.length = 0;
2475 }
2476 });
2477
2478 var reject = once(function (reason) {
2479 warn(
2480 "Failed to resolve async component: " + (String(factory)) +
2481 (reason ? ("\nReason: " + reason) : '')
2482 );
2483 if (isDef(factory.errorComp)) {
2484 factory.error = true;
2485 forceRender(true);
2486 }
2487 });
2488
2489 var res = factory(resolve, reject);
2490
2491 if (isObject(res)) {
2492 if (isPromise(res)) {
2493 // () => Promise
2494 if (isUndef(factory.resolved)) {
2495 res.then(resolve, reject);
2496 }
2497 } else if (isPromise(res.component)) {
2498 res.component.then(resolve, reject);
2499
2500 if (isDef(res.error)) {
2501 factory.errorComp = ensureCtor(res.error, baseCtor);
2502 }
2503
2504 if (isDef(res.loading)) {
2505 factory.loadingComp = ensureCtor(res.loading, baseCtor);
2506 if (res.delay === 0) {
2507 factory.loading = true;
2508 } else {
2509 setTimeout(function () {
2510 if (isUndef(factory.resolved) && isUndef(factory.error)) {
2511 factory.loading = true;
2512 forceRender(false);
2513 }
2514 }, res.delay || 200);
2515 }
2516 }
2517
2518 if (isDef(res.timeout)) {
2519 setTimeout(function () {
2520 if (isUndef(factory.resolved)) {
2521 reject(
2522 "timeout (" + (res.timeout) + "ms)"
2523 );
2524 }
2525 }, res.timeout);
2526 }
2527 }
2528 }
2529
2530 sync = false;
2531 // return in case resolved synchronously
2532 return factory.loading
2533 ? factory.loadingComp
2534 : factory.resolved
2535 }
2536}
2537
2538/* */
2539
2540function isAsyncPlaceholder (node) {
2541 return node.isComment && node.asyncFactory
2542}
2543
2544/* */
2545
2546function getFirstComponentChild (children) {
2547 if (Array.isArray(children)) {
2548 for (var i = 0; i < children.length; i++) {
2549 var c = children[i];
2550 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
2551 return c
2552 }
2553 }
2554 }
2555}
2556
2557/* */
2558
2559/* */
2560
2561function initEvents (vm) {
2562 vm._events = Object.create(null);
2563 vm._hasHookEvent = false;
2564 // init parent attached events
2565 var listeners = vm.$options._parentListeners;
2566 if (listeners) {
2567 updateComponentListeners(vm, listeners);
2568 }
2569}
2570
2571var target;
2572
2573function add (event, fn) {
2574 target.$on(event, fn);
2575}
2576
2577function remove$1 (event, fn) {
2578 target.$off(event, fn);
2579}
2580
2581function createOnceHandler (event, fn) {
2582 var _target = target;
2583 return function onceHandler () {
2584 var res = fn.apply(null, arguments);
2585 if (res !== null) {
2586 _target.$off(event, onceHandler);
2587 }
2588 }
2589}
2590
2591function updateComponentListeners (
2592 vm,
2593 listeners,
2594 oldListeners
2595) {
2596 target = vm;
2597 updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
2598 target = undefined;
2599}
2600
2601function eventsMixin (Vue) {
2602 var hookRE = /^hook:/;
2603 Vue.prototype.$on = function (event, fn) {
2604 var vm = this;
2605 if (Array.isArray(event)) {
2606 for (var i = 0, l = event.length; i < l; i++) {
2607 vm.$on(event[i], fn);
2608 }
2609 } else {
2610 (vm._events[event] || (vm._events[event] = [])).push(fn);
2611 // optimize hook:event cost by using a boolean flag marked at registration
2612 // instead of a hash lookup
2613 if (hookRE.test(event)) {
2614 vm._hasHookEvent = true;
2615 }
2616 }
2617 return vm
2618 };
2619
2620 Vue.prototype.$once = function (event, fn) {
2621 var vm = this;
2622 function on () {
2623 vm.$off(event, on);
2624 fn.apply(vm, arguments);
2625 }
2626 on.fn = fn;
2627 vm.$on(event, on);
2628 return vm
2629 };
2630
2631 Vue.prototype.$off = function (event, fn) {
2632 var vm = this;
2633 // all
2634 if (!arguments.length) {
2635 vm._events = Object.create(null);
2636 return vm
2637 }
2638 // array of events
2639 if (Array.isArray(event)) {
2640 for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
2641 vm.$off(event[i$1], fn);
2642 }
2643 return vm
2644 }
2645 // specific event
2646 var cbs = vm._events[event];
2647 if (!cbs) {
2648 return vm
2649 }
2650 if (!fn) {
2651 vm._events[event] = null;
2652 return vm
2653 }
2654 // specific handler
2655 var cb;
2656 var i = cbs.length;
2657 while (i--) {
2658 cb = cbs[i];
2659 if (cb === fn || cb.fn === fn) {
2660 cbs.splice(i, 1);
2661 break
2662 }
2663 }
2664 return vm
2665 };
2666
2667 Vue.prototype.$emit = function (event) {
2668 var vm = this;
2669 {
2670 var lowerCaseEvent = event.toLowerCase();
2671 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
2672 tip(
2673 "Event \"" + lowerCaseEvent + "\" is emitted in component " +
2674 (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
2675 "Note that HTML attributes are case-insensitive and you cannot use " +
2676 "v-on to listen to camelCase events when using in-DOM templates. " +
2677 "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
2678 );
2679 }
2680 }
2681 var cbs = vm._events[event];
2682 if (cbs) {
2683 cbs = cbs.length > 1 ? toArray(cbs) : cbs;
2684 var args = toArray(arguments, 1);
2685 var info = "event handler for \"" + event + "\"";
2686 for (var i = 0, l = cbs.length; i < l; i++) {
2687 invokeWithErrorHandling(cbs[i], vm, args, vm, info);
2688 }
2689 }
2690 return vm
2691 };
2692}
2693
2694/* */
2695
2696
2697
2698/**
2699 * Runtime helper for resolving raw children VNodes into a slot object.
2700 */
2701function resolveSlots (
2702 children,
2703 context
2704) {
2705 if (!children || !children.length) {
2706 return {}
2707 }
2708 var slots = {};
2709 for (var i = 0, l = children.length; i < l; i++) {
2710 var child = children[i];
2711 var data = child.data;
2712 // remove slot attribute if the node is resolved as a Vue slot node
2713 if (data && data.attrs && data.attrs.slot) {
2714 delete data.attrs.slot;
2715 }
2716 // named slots should only be respected if the vnode was rendered in the
2717 // same context.
2718 if ((child.context === context || child.fnContext === context) &&
2719 data && data.slot != null
2720 ) {
2721 var name = data.slot;
2722 var slot = (slots[name] || (slots[name] = []));
2723 if (child.tag === 'template') {
2724 slot.push.apply(slot, child.children || []);
2725 } else {
2726 slot.push(child);
2727 }
2728 } else {
2729 (slots.default || (slots.default = [])).push(child);
2730 }
2731 }
2732 // ignore slots that contains only whitespace
2733 for (var name$1 in slots) {
2734 if (slots[name$1].every(isWhitespace)) {
2735 delete slots[name$1];
2736 }
2737 }
2738 return slots
2739}
2740
2741function isWhitespace (node) {
2742 return (node.isComment && !node.asyncFactory) || node.text === ' '
2743}
2744
2745function resolveScopedSlots (
2746 fns, // see flow/vnode
2747 hasDynamicKeys,
2748 res
2749) {
2750 res = res || { $stable: !hasDynamicKeys };
2751 for (var i = 0; i < fns.length; i++) {
2752 var slot = fns[i];
2753 if (Array.isArray(slot)) {
2754 resolveScopedSlots(slot, hasDynamicKeys, res);
2755 } else if (slot) {
2756 res[slot.key] = slot.fn;
2757 }
2758 }
2759 return res
2760}
2761
2762/* */
2763
2764var activeInstance = null;
2765var isUpdatingChildComponent = false;
2766
2767function setActiveInstance(vm) {
2768 var prevActiveInstance = activeInstance;
2769 activeInstance = vm;
2770 return function () {
2771 activeInstance = prevActiveInstance;
2772 }
2773}
2774
2775function initLifecycle (vm) {
2776 var options = vm.$options;
2777
2778 // locate first non-abstract parent
2779 var parent = options.parent;
2780 if (parent && !options.abstract) {
2781 while (parent.$options.abstract && parent.$parent) {
2782 parent = parent.$parent;
2783 }
2784 parent.$children.push(vm);
2785 }
2786
2787 vm.$parent = parent;
2788 vm.$root = parent ? parent.$root : vm;
2789
2790 vm.$children = [];
2791 vm.$refs = {};
2792
2793 vm._watcher = null;
2794 vm._inactive = null;
2795 vm._directInactive = false;
2796 vm._isMounted = false;
2797 vm._isDestroyed = false;
2798 vm._isBeingDestroyed = false;
2799}
2800
2801function lifecycleMixin (Vue) {
2802 Vue.prototype._update = function (vnode, hydrating) {
2803 var vm = this;
2804 var prevEl = vm.$el;
2805 var prevVnode = vm._vnode;
2806 var restoreActiveInstance = setActiveInstance(vm);
2807 vm._vnode = vnode;
2808 // Vue.prototype.__patch__ is injected in entry points
2809 // based on the rendering backend used.
2810 if (!prevVnode) {
2811 // initial render
2812 vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
2813 } else {
2814 // updates
2815 vm.$el = vm.__patch__(prevVnode, vnode);
2816 }
2817 restoreActiveInstance();
2818 // update __vue__ reference
2819 if (prevEl) {
2820 prevEl.__vue__ = null;
2821 }
2822 if (vm.$el) {
2823 vm.$el.__vue__ = vm;
2824 }
2825 // if parent is an HOC, update its $el as well
2826 if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
2827 vm.$parent.$el = vm.$el;
2828 }
2829 // updated hook is called by the scheduler to ensure that children are
2830 // updated in a parent's updated hook.
2831 };
2832
2833 Vue.prototype.$forceUpdate = function () {
2834 var vm = this;
2835 if (vm._watcher) {
2836 vm._watcher.update();
2837 }
2838 };
2839
2840 Vue.prototype.$destroy = function () {
2841 var vm = this;
2842 if (vm._isBeingDestroyed) {
2843 return
2844 }
2845 callHook(vm, 'beforeDestroy');
2846 vm._isBeingDestroyed = true;
2847 // remove self from parent
2848 var parent = vm.$parent;
2849 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
2850 remove(parent.$children, vm);
2851 }
2852 // teardown watchers
2853 if (vm._watcher) {
2854 vm._watcher.teardown();
2855 }
2856 var i = vm._watchers.length;
2857 while (i--) {
2858 vm._watchers[i].teardown();
2859 }
2860 // remove reference from data ob
2861 // frozen object may not have observer.
2862 if (vm._data.__ob__) {
2863 vm._data.__ob__.vmCount--;
2864 }
2865 // call the last hook...
2866 vm._isDestroyed = true;
2867 // invoke destroy hooks on current rendered tree
2868 vm.__patch__(vm._vnode, null);
2869 // fire destroyed hook
2870 callHook(vm, 'destroyed');
2871 // turn off all instance listeners.
2872 vm.$off();
2873 // remove __vue__ reference
2874 if (vm.$el) {
2875 vm.$el.__vue__ = null;
2876 }
2877 // release circular reference (#6759)
2878 if (vm.$vnode) {
2879 vm.$vnode.parent = null;
2880 }
2881 };
2882}
2883
2884function mountComponent (
2885 vm,
2886 el,
2887 hydrating
2888) {
2889 vm.$el = el;
2890 if (!vm.$options.render) {
2891 vm.$options.render = createEmptyVNode;
2892 {
2893 /* istanbul ignore if */
2894 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
2895 vm.$options.el || el) {
2896 warn(
2897 'You are using the runtime-only build of Vue where the template ' +
2898 'compiler is not available. Either pre-compile the templates into ' +
2899 'render functions, or use the compiler-included build.',
2900 vm
2901 );
2902 } else {
2903 warn(
2904 'Failed to mount component: template or render function not defined.',
2905 vm
2906 );
2907 }
2908 }
2909 }
2910 callHook(vm, 'beforeMount');
2911
2912 var updateComponent;
2913 /* istanbul ignore if */
2914 if (config.performance && mark) {
2915 updateComponent = function () {
2916 var name = vm._name;
2917 var id = vm._uid;
2918 var startTag = "vue-perf-start:" + id;
2919 var endTag = "vue-perf-end:" + id;
2920
2921 mark(startTag);
2922 var vnode = vm._render();
2923 mark(endTag);
2924 measure(("vue " + name + " render"), startTag, endTag);
2925
2926 mark(startTag);
2927 vm._update(vnode, hydrating);
2928 mark(endTag);
2929 measure(("vue " + name + " patch"), startTag, endTag);
2930 };
2931 } else {
2932 updateComponent = function () {
2933 vm._update(vm._render(), hydrating);
2934 };
2935 }
2936
2937 // we set this to vm._watcher inside the watcher's constructor
2938 // since the watcher's initial patch may call $forceUpdate (e.g. inside child
2939 // component's mounted hook), which relies on vm._watcher being already defined
2940 new Watcher(vm, updateComponent, noop, {
2941 before: function before () {
2942 if (vm._isMounted && !vm._isDestroyed) {
2943 callHook(vm, 'beforeUpdate');
2944 }
2945 }
2946 }, true /* isRenderWatcher */);
2947 hydrating = false;
2948
2949 // manually mounted instance, call mounted on self
2950 // mounted is called for render-created child components in its inserted hook
2951 if (vm.$vnode == null) {
2952 vm._isMounted = true;
2953 callHook(vm, 'mounted');
2954 }
2955 return vm
2956}
2957
2958function updateChildComponent (
2959 vm,
2960 propsData,
2961 listeners,
2962 parentVnode,
2963 renderChildren
2964) {
2965 {
2966 isUpdatingChildComponent = true;
2967 }
2968
2969 // determine whether component has slot children
2970 // we need to do this before overwriting $options._renderChildren.
2971
2972 // check if there are dynamic scopedSlots (hand-written or compiled but with
2973 // dynamic slot names). Static scoped slots compiled from template has the
2974 // "$stable" marker.
2975 var hasDynamicScopedSlot = !!(
2976 (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
2977 (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
2978 );
2979 // Any static slot children from the parent may have changed during parent's
2980 // update. Dynamic scoped slots may also have changed. In such cases, a forced
2981 // update is necessary to ensure correctness.
2982 var needsForceUpdate = !!(
2983 renderChildren || // has new static slots
2984 vm.$options._renderChildren || // has old static slots
2985 hasDynamicScopedSlot
2986 );
2987
2988 vm.$options._parentVnode = parentVnode;
2989 vm.$vnode = parentVnode; // update vm's placeholder node without re-render
2990
2991 if (vm._vnode) { // update child tree's parent
2992 vm._vnode.parent = parentVnode;
2993 }
2994 vm.$options._renderChildren = renderChildren;
2995
2996 // update $attrs and $listeners hash
2997 // these are also reactive so they may trigger child update if the child
2998 // used them during render
2999 vm.$attrs = parentVnode.data.attrs || emptyObject;
3000 vm.$listeners = listeners || emptyObject;
3001
3002 // update props
3003 if (propsData && vm.$options.props) {
3004 toggleObserving(false);
3005 var props = vm._props;
3006 var propKeys = vm.$options._propKeys || [];
3007 for (var i = 0; i < propKeys.length; i++) {
3008 var key = propKeys[i];
3009 var propOptions = vm.$options.props; // wtf flow?
3010 props[key] = validateProp(key, propOptions, propsData, vm);
3011 }
3012 toggleObserving(true);
3013 // keep a copy of raw propsData
3014 vm.$options.propsData = propsData;
3015 }
3016
3017 // update listeners
3018 listeners = listeners || emptyObject;
3019 var oldListeners = vm.$options._parentListeners;
3020 vm.$options._parentListeners = listeners;
3021 updateComponentListeners(vm, listeners, oldListeners);
3022
3023 // resolve slots + force update if has children
3024 if (needsForceUpdate) {
3025 vm.$slots = resolveSlots(renderChildren, parentVnode.context);
3026 vm.$forceUpdate();
3027 }
3028
3029 {
3030 isUpdatingChildComponent = false;
3031 }
3032}
3033
3034function isInInactiveTree (vm) {
3035 while (vm && (vm = vm.$parent)) {
3036 if (vm._inactive) { return true }
3037 }
3038 return false
3039}
3040
3041function activateChildComponent (vm, direct) {
3042 if (direct) {
3043 vm._directInactive = false;
3044 if (isInInactiveTree(vm)) {
3045 return
3046 }
3047 } else if (vm._directInactive) {
3048 return
3049 }
3050 if (vm._inactive || vm._inactive === null) {
3051 vm._inactive = false;
3052 for (var i = 0; i < vm.$children.length; i++) {
3053 activateChildComponent(vm.$children[i]);
3054 }
3055 callHook(vm, 'activated');
3056 }
3057}
3058
3059function deactivateChildComponent (vm, direct) {
3060 if (direct) {
3061 vm._directInactive = true;
3062 if (isInInactiveTree(vm)) {
3063 return
3064 }
3065 }
3066 if (!vm._inactive) {
3067 vm._inactive = true;
3068 for (var i = 0; i < vm.$children.length; i++) {
3069 deactivateChildComponent(vm.$children[i]);
3070 }
3071 callHook(vm, 'deactivated');
3072 }
3073}
3074
3075function callHook (vm, hook) {
3076 // #7573 disable dep collection when invoking lifecycle hooks
3077 pushTarget();
3078 var handlers = vm.$options[hook];
3079 var info = hook + " hook";
3080 if (handlers) {
3081 for (var i = 0, j = handlers.length; i < j; i++) {
3082 invokeWithErrorHandling(handlers[i], vm, null, vm, info);
3083 }
3084 }
3085 if (vm._hasHookEvent) {
3086 vm.$emit('hook:' + hook);
3087 }
3088 popTarget();
3089}
3090
3091/* */
3092
3093var MAX_UPDATE_COUNT = 100;
3094
3095var queue = [];
3096var activatedChildren = [];
3097var has = {};
3098var circular = {};
3099var waiting = false;
3100var flushing = false;
3101var index = 0;
3102
3103/**
3104 * Reset the scheduler's state.
3105 */
3106function resetSchedulerState () {
3107 index = queue.length = activatedChildren.length = 0;
3108 has = {};
3109 {
3110 circular = {};
3111 }
3112 waiting = flushing = false;
3113}
3114
3115// Async edge case #6566 requires saving the timestamp when event listeners are
3116// attached. However, calling performance.now() has a perf overhead especially
3117// if the page has thousands of event listeners. Instead, we take a timestamp
3118// every time the scheduler flushes and use that for all event listeners
3119// attached during that flush.
3120var currentFlushTimestamp = 0;
3121
3122// Async edge case fix requires storing an event listener's attach timestamp.
3123var getNow = Date.now;
3124
3125// Determine what event timestamp the browser is using. Annoyingly, the
3126// timestamp can either be hi-res ( relative to poge load) or low-res
3127// (relative to UNIX epoch), so in order to compare time we have to use the
3128// same timestamp type when saving the flush timestamp.
3129if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
3130 // if the low-res timestamp which is bigger than the event timestamp
3131 // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
3132 // and we need to use the hi-res version for event listeners as well.
3133 getNow = function () { return performance.now(); };
3134}
3135
3136/**
3137 * Flush both queues and run the watchers.
3138 */
3139function flushSchedulerQueue () {
3140 currentFlushTimestamp = getNow();
3141 flushing = true;
3142 var watcher, id;
3143
3144 // Sort queue before flush.
3145 // This ensures that:
3146 // 1. Components are updated from parent to child. (because parent is always
3147 // created before the child)
3148 // 2. A component's user watchers are run before its render watcher (because
3149 // user watchers are created before the render watcher)
3150 // 3. If a component is destroyed during a parent component's watcher run,
3151 // its watchers can be skipped.
3152 queue.sort(function (a, b) { return a.id - b.id; });
3153
3154 // do not cache length because more watchers might be pushed
3155 // as we run existing watchers
3156 for (index = 0; index < queue.length; index++) {
3157 watcher = queue[index];
3158 if (watcher.before) {
3159 watcher.before();
3160 }
3161 id = watcher.id;
3162 has[id] = null;
3163 watcher.run();
3164 // in dev build, check and stop circular updates.
3165 if (has[id] != null) {
3166 circular[id] = (circular[id] || 0) + 1;
3167 if (circular[id] > MAX_UPDATE_COUNT) {
3168 warn(
3169 'You may have an infinite update loop ' + (
3170 watcher.user
3171 ? ("in watcher with expression \"" + (watcher.expression) + "\"")
3172 : "in a component render function."
3173 ),
3174 watcher.vm
3175 );
3176 break
3177 }
3178 }
3179 }
3180
3181 // keep copies of post queues before resetting state
3182 var activatedQueue = activatedChildren.slice();
3183 var updatedQueue = queue.slice();
3184
3185 resetSchedulerState();
3186
3187 // call component updated and activated hooks
3188 callActivatedHooks(activatedQueue);
3189 callUpdatedHooks(updatedQueue);
3190
3191 // devtool hook
3192 /* istanbul ignore if */
3193 if (devtools && config.devtools) {
3194 devtools.emit('flush');
3195 }
3196}
3197
3198function callUpdatedHooks (queue) {
3199 var i = queue.length;
3200 while (i--) {
3201 var watcher = queue[i];
3202 var vm = watcher.vm;
3203 if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
3204 callHook(vm, 'updated');
3205 }
3206 }
3207}
3208
3209/**
3210 * Queue a kept-alive component that was activated during patch.
3211 * The queue will be processed after the entire tree has been patched.
3212 */
3213function queueActivatedComponent (vm) {
3214 // setting _inactive to false here so that a render function can
3215 // rely on checking whether it's in an inactive tree (e.g. router-view)
3216 vm._inactive = false;
3217 activatedChildren.push(vm);
3218}
3219
3220function callActivatedHooks (queue) {
3221 for (var i = 0; i < queue.length; i++) {
3222 queue[i]._inactive = true;
3223 activateChildComponent(queue[i], true /* true */);
3224 }
3225}
3226
3227/**
3228 * Push a watcher into the watcher queue.
3229 * Jobs with duplicate IDs will be skipped unless it's
3230 * pushed when the queue is being flushed.
3231 */
3232function queueWatcher (watcher) {
3233 var id = watcher.id;
3234 if (has[id] == null) {
3235 has[id] = true;
3236 if (!flushing) {
3237 queue.push(watcher);
3238 } else {
3239 // if already flushing, splice the watcher based on its id
3240 // if already past its id, it will be run next immediately.
3241 var i = queue.length - 1;
3242 while (i > index && queue[i].id > watcher.id) {
3243 i--;
3244 }
3245 queue.splice(i + 1, 0, watcher);
3246 }
3247 // queue the flush
3248 if (!waiting) {
3249 waiting = true;
3250
3251 if (!config.async) {
3252 flushSchedulerQueue();
3253 return
3254 }
3255 nextTick(flushSchedulerQueue);
3256 }
3257 }
3258}
3259
3260/* */
3261
3262
3263
3264var uid$1 = 0;
3265
3266/**
3267 * A watcher parses an expression, collects dependencies,
3268 * and fires callback when the expression value changes.
3269 * This is used for both the $watch() api and directives.
3270 */
3271var Watcher = function Watcher (
3272 vm,
3273 expOrFn,
3274 cb,
3275 options,
3276 isRenderWatcher
3277) {
3278 this.vm = vm;
3279 if (isRenderWatcher) {
3280 vm._watcher = this;
3281 }
3282 vm._watchers.push(this);
3283 // options
3284 if (options) {
3285 this.deep = !!options.deep;
3286 this.user = !!options.user;
3287 this.lazy = !!options.lazy;
3288 this.sync = !!options.sync;
3289 this.before = options.before;
3290 } else {
3291 this.deep = this.user = this.lazy = this.sync = false;
3292 }
3293 this.cb = cb;
3294 this.id = ++uid$1; // uid for batching
3295 this.active = true;
3296 this.dirty = this.lazy; // for lazy watchers
3297 this.deps = [];
3298 this.newDeps = [];
3299 this.depIds = new _Set();
3300 this.newDepIds = new _Set();
3301 this.expression = expOrFn.toString();
3302 // parse expression for getter
3303 if (typeof expOrFn === 'function') {
3304 this.getter = expOrFn;
3305 } else {
3306 this.getter = parsePath(expOrFn);
3307 if (!this.getter) {
3308 this.getter = noop;
3309 warn(
3310 "Failed watching path: \"" + expOrFn + "\" " +
3311 'Watcher only accepts simple dot-delimited paths. ' +
3312 'For full control, use a function instead.',
3313 vm
3314 );
3315 }
3316 }
3317 this.value = this.lazy
3318 ? undefined
3319 : this.get();
3320};
3321
3322/**
3323 * Evaluate the getter, and re-collect dependencies.
3324 */
3325Watcher.prototype.get = function get () {
3326 pushTarget(this);
3327 var value;
3328 var vm = this.vm;
3329 try {
3330 value = this.getter.call(vm, vm);
3331 } catch (e) {
3332 if (this.user) {
3333 handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
3334 } else {
3335 throw e
3336 }
3337 } finally {
3338 // "touch" every property so they are all tracked as
3339 // dependencies for deep watching
3340 if (this.deep) {
3341 traverse(value);
3342 }
3343 popTarget();
3344 this.cleanupDeps();
3345 }
3346 return value
3347};
3348
3349/**
3350 * Add a dependency to this directive.
3351 */
3352Watcher.prototype.addDep = function addDep (dep) {
3353 var id = dep.id;
3354 if (!this.newDepIds.has(id)) {
3355 this.newDepIds.add(id);
3356 this.newDeps.push(dep);
3357 if (!this.depIds.has(id)) {
3358 dep.addSub(this);
3359 }
3360 }
3361};
3362
3363/**
3364 * Clean up for dependency collection.
3365 */
3366Watcher.prototype.cleanupDeps = function cleanupDeps () {
3367 var i = this.deps.length;
3368 while (i--) {
3369 var dep = this.deps[i];
3370 if (!this.newDepIds.has(dep.id)) {
3371 dep.removeSub(this);
3372 }
3373 }
3374 var tmp = this.depIds;
3375 this.depIds = this.newDepIds;
3376 this.newDepIds = tmp;
3377 this.newDepIds.clear();
3378 tmp = this.deps;
3379 this.deps = this.newDeps;
3380 this.newDeps = tmp;
3381 this.newDeps.length = 0;
3382};
3383
3384/**
3385 * Subscriber interface.
3386 * Will be called when a dependency changes.
3387 */
3388Watcher.prototype.update = function update () {
3389 /* istanbul ignore else */
3390 if (this.lazy) {
3391 this.dirty = true;
3392 } else if (this.sync) {
3393 this.run();
3394 } else {
3395 queueWatcher(this);
3396 }
3397};
3398
3399/**
3400 * Scheduler job interface.
3401 * Will be called by the scheduler.
3402 */
3403Watcher.prototype.run = function run () {
3404 if (this.active) {
3405 var value = this.get();
3406 if (
3407 value !== this.value ||
3408 // Deep watchers and watchers on Object/Arrays should fire even
3409 // when the value is the same, because the value may
3410 // have mutated.
3411 isObject(value) ||
3412 this.deep
3413 ) {
3414 // set new value
3415 var oldValue = this.value;
3416 this.value = value;
3417 if (this.user) {
3418 try {
3419 this.cb.call(this.vm, value, oldValue);
3420 } catch (e) {
3421 handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
3422 }
3423 } else {
3424 this.cb.call(this.vm, value, oldValue);
3425 }
3426 }
3427 }
3428};
3429
3430/**
3431 * Evaluate the value of the watcher.
3432 * This only gets called for lazy watchers.
3433 */
3434Watcher.prototype.evaluate = function evaluate () {
3435 this.value = this.get();
3436 this.dirty = false;
3437};
3438
3439/**
3440 * Depend on all deps collected by this watcher.
3441 */
3442Watcher.prototype.depend = function depend () {
3443 var i = this.deps.length;
3444 while (i--) {
3445 this.deps[i].depend();
3446 }
3447};
3448
3449/**
3450 * Remove self from all dependencies' subscriber list.
3451 */
3452Watcher.prototype.teardown = function teardown () {
3453 if (this.active) {
3454 // remove self from vm's watcher list
3455 // this is a somewhat expensive operation so we skip it
3456 // if the vm is being destroyed.
3457 if (!this.vm._isBeingDestroyed) {
3458 remove(this.vm._watchers, this);
3459 }
3460 var i = this.deps.length;
3461 while (i--) {
3462 this.deps[i].removeSub(this);
3463 }
3464 this.active = false;
3465 }
3466};
3467
3468/* */
3469
3470var sharedPropertyDefinition = {
3471 enumerable: true,
3472 configurable: true,
3473 get: noop,
3474 set: noop
3475};
3476
3477function proxy (target, sourceKey, key) {
3478 sharedPropertyDefinition.get = function proxyGetter () {
3479 return this[sourceKey][key]
3480 };
3481 sharedPropertyDefinition.set = function proxySetter (val) {
3482 this[sourceKey][key] = val;
3483 };
3484 Object.defineProperty(target, key, sharedPropertyDefinition);
3485}
3486
3487function initState (vm) {
3488 vm._watchers = [];
3489 var opts = vm.$options;
3490 if (opts.props) { initProps(vm, opts.props); }
3491 if (opts.methods) { initMethods(vm, opts.methods); }
3492 if (opts.data) {
3493 initData(vm);
3494 } else {
3495 observe(vm._data = {}, true /* asRootData */);
3496 }
3497 if (opts.computed) { initComputed(vm, opts.computed); }
3498 if (opts.watch && opts.watch !== nativeWatch) {
3499 initWatch(vm, opts.watch);
3500 }
3501}
3502
3503function initProps (vm, propsOptions) {
3504 var propsData = vm.$options.propsData || {};
3505 var props = vm._props = {};
3506 // cache prop keys so that future props updates can iterate using Array
3507 // instead of dynamic object key enumeration.
3508 var keys = vm.$options._propKeys = [];
3509 var isRoot = !vm.$parent;
3510 // root instance props should be converted
3511 if (!isRoot) {
3512 toggleObserving(false);
3513 }
3514 var loop = function ( key ) {
3515 keys.push(key);
3516 var value = validateProp(key, propsOptions, propsData, vm);
3517 /* istanbul ignore else */
3518 {
3519 var hyphenatedKey = hyphenate(key);
3520 if (isReservedAttribute(hyphenatedKey) ||
3521 config.isReservedAttr(hyphenatedKey)) {
3522 warn(
3523 ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
3524 vm
3525 );
3526 }
3527 defineReactive$$1(props, key, value, function () {
3528 if (!isRoot && !isUpdatingChildComponent) {
3529 warn(
3530 "Avoid mutating a prop directly since the value will be " +
3531 "overwritten whenever the parent component re-renders. " +
3532 "Instead, use a data or computed property based on the prop's " +
3533 "value. Prop being mutated: \"" + key + "\"",
3534 vm
3535 );
3536 }
3537 });
3538 }
3539 // static props are already proxied on the component's prototype
3540 // during Vue.extend(). We only need to proxy props defined at
3541 // instantiation here.
3542 if (!(key in vm)) {
3543 proxy(vm, "_props", key);
3544 }
3545 };
3546
3547 for (var key in propsOptions) loop( key );
3548 toggleObserving(true);
3549}
3550
3551function initData (vm) {
3552 var data = vm.$options.data;
3553 data = vm._data = typeof data === 'function'
3554 ? getData(data, vm)
3555 : data || {};
3556 if (!isPlainObject(data)) {
3557 data = {};
3558 warn(
3559 'data functions should return an object:\n' +
3560 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
3561 vm
3562 );
3563 }
3564 // proxy data on instance
3565 var keys = Object.keys(data);
3566 var props = vm.$options.props;
3567 var methods = vm.$options.methods;
3568 var i = keys.length;
3569 while (i--) {
3570 var key = keys[i];
3571 {
3572 if (methods && hasOwn(methods, key)) {
3573 warn(
3574 ("Method \"" + key + "\" has already been defined as a data property."),
3575 vm
3576 );
3577 }
3578 }
3579 if (props && hasOwn(props, key)) {
3580 warn(
3581 "The data property \"" + key + "\" is already declared as a prop. " +
3582 "Use prop default value instead.",
3583 vm
3584 );
3585 } else if (!isReserved(key)) {
3586 proxy(vm, "_data", key);
3587 }
3588 }
3589 // observe data
3590 observe(data, true /* asRootData */);
3591}
3592
3593function getData (data, vm) {
3594 // #7573 disable dep collection when invoking data getters
3595 pushTarget();
3596 try {
3597 return data.call(vm, vm)
3598 } catch (e) {
3599 handleError(e, vm, "data()");
3600 return {}
3601 } finally {
3602 popTarget();
3603 }
3604}
3605
3606var computedWatcherOptions = { lazy: true };
3607
3608function initComputed (vm, computed) {
3609 // $flow-disable-line
3610 var watchers = vm._computedWatchers = Object.create(null);
3611 // computed properties are just getters during SSR
3612 var isSSR = isServerRendering();
3613
3614 for (var key in computed) {
3615 var userDef = computed[key];
3616 var getter = typeof userDef === 'function' ? userDef : userDef.get;
3617 if (getter == null) {
3618 warn(
3619 ("Getter is missing for computed property \"" + key + "\"."),
3620 vm
3621 );
3622 }
3623
3624 if (!isSSR) {
3625 // create internal watcher for the computed property.
3626 watchers[key] = new Watcher(
3627 vm,
3628 getter || noop,
3629 noop,
3630 computedWatcherOptions
3631 );
3632 }
3633
3634 // component-defined computed properties are already defined on the
3635 // component prototype. We only need to define computed properties defined
3636 // at instantiation here.
3637 if (!(key in vm)) {
3638 defineComputed(vm, key, userDef);
3639 } else {
3640 if (key in vm.$data) {
3641 warn(("The computed property \"" + key + "\" is already defined in data."), vm);
3642 } else if (vm.$options.props && key in vm.$options.props) {
3643 warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
3644 }
3645 }
3646 }
3647}
3648
3649function defineComputed (
3650 target,
3651 key,
3652 userDef
3653) {
3654 var shouldCache = !isServerRendering();
3655 if (typeof userDef === 'function') {
3656 sharedPropertyDefinition.get = shouldCache
3657 ? createComputedGetter(key)
3658 : createGetterInvoker(userDef);
3659 sharedPropertyDefinition.set = noop;
3660 } else {
3661 sharedPropertyDefinition.get = userDef.get
3662 ? shouldCache && userDef.cache !== false
3663 ? createComputedGetter(key)
3664 : createGetterInvoker(userDef.get)
3665 : noop;
3666 sharedPropertyDefinition.set = userDef.set || noop;
3667 }
3668 if (sharedPropertyDefinition.set === noop) {
3669 sharedPropertyDefinition.set = function () {
3670 warn(
3671 ("Computed property \"" + key + "\" was assigned to but it has no setter."),
3672 this
3673 );
3674 };
3675 }
3676 Object.defineProperty(target, key, sharedPropertyDefinition);
3677}
3678
3679function createComputedGetter (key) {
3680 return function computedGetter () {
3681 var watcher = this._computedWatchers && this._computedWatchers[key];
3682 if (watcher) {
3683 if (watcher.dirty) {
3684 watcher.evaluate();
3685 }
3686 if (Dep.target) {
3687 watcher.depend();
3688 }
3689 return watcher.value
3690 }
3691 }
3692}
3693
3694function createGetterInvoker(fn) {
3695 return function computedGetter () {
3696 return fn.call(this, this)
3697 }
3698}
3699
3700function initMethods (vm, methods) {
3701 var props = vm.$options.props;
3702 for (var key in methods) {
3703 {
3704 if (typeof methods[key] !== 'function') {
3705 warn(
3706 "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
3707 "Did you reference the function correctly?",
3708 vm
3709 );
3710 }
3711 if (props && hasOwn(props, key)) {
3712 warn(
3713 ("Method \"" + key + "\" has already been defined as a prop."),
3714 vm
3715 );
3716 }
3717 if ((key in vm) && isReserved(key)) {
3718 warn(
3719 "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
3720 "Avoid defining component methods that start with _ or $."
3721 );
3722 }
3723 }
3724 vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
3725 }
3726}
3727
3728function initWatch (vm, watch) {
3729 for (var key in watch) {
3730 var handler = watch[key];
3731 if (Array.isArray(handler)) {
3732 for (var i = 0; i < handler.length; i++) {
3733 createWatcher(vm, key, handler[i]);
3734 }
3735 } else {
3736 createWatcher(vm, key, handler);
3737 }
3738 }
3739}
3740
3741function createWatcher (
3742 vm,
3743 expOrFn,
3744 handler,
3745 options
3746) {
3747 if (isPlainObject(handler)) {
3748 options = handler;
3749 handler = handler.handler;
3750 }
3751 if (typeof handler === 'string') {
3752 handler = vm[handler];
3753 }
3754 return vm.$watch(expOrFn, handler, options)
3755}
3756
3757function stateMixin (Vue) {
3758 // flow somehow has problems with directly declared definition object
3759 // when using Object.defineProperty, so we have to procedurally build up
3760 // the object here.
3761 var dataDef = {};
3762 dataDef.get = function () { return this._data };
3763 var propsDef = {};
3764 propsDef.get = function () { return this._props };
3765 {
3766 dataDef.set = function () {
3767 warn(
3768 'Avoid replacing instance root $data. ' +
3769 'Use nested data properties instead.',
3770 this
3771 );
3772 };
3773 propsDef.set = function () {
3774 warn("$props is readonly.", this);
3775 };
3776 }
3777 Object.defineProperty(Vue.prototype, '$data', dataDef);
3778 Object.defineProperty(Vue.prototype, '$props', propsDef);
3779
3780 Vue.prototype.$set = set;
3781 Vue.prototype.$delete = del;
3782
3783 Vue.prototype.$watch = function (
3784 expOrFn,
3785 cb,
3786 options
3787 ) {
3788 var vm = this;
3789 if (isPlainObject(cb)) {
3790 return createWatcher(vm, expOrFn, cb, options)
3791 }
3792 options = options || {};
3793 options.user = true;
3794 var watcher = new Watcher(vm, expOrFn, cb, options);
3795 if (options.immediate) {
3796 try {
3797 cb.call(vm, watcher.value);
3798 } catch (error) {
3799 handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
3800 }
3801 }
3802 return function unwatchFn () {
3803 watcher.teardown();
3804 }
3805 };
3806}
3807
3808/* */
3809
3810function initProvide (vm) {
3811 var provide = vm.$options.provide;
3812 if (provide) {
3813 vm._provided = typeof provide === 'function'
3814 ? provide.call(vm)
3815 : provide;
3816 }
3817}
3818
3819function initInjections (vm) {
3820 var result = resolveInject(vm.$options.inject, vm);
3821 if (result) {
3822 toggleObserving(false);
3823 Object.keys(result).forEach(function (key) {
3824 /* istanbul ignore else */
3825 {
3826 defineReactive$$1(vm, key, result[key], function () {
3827 warn(
3828 "Avoid mutating an injected value directly since the changes will be " +
3829 "overwritten whenever the provided component re-renders. " +
3830 "injection being mutated: \"" + key + "\"",
3831 vm
3832 );
3833 });
3834 }
3835 });
3836 toggleObserving(true);
3837 }
3838}
3839
3840function resolveInject (inject, vm) {
3841 if (inject) {
3842 // inject is :any because flow is not smart enough to figure out cached
3843 var result = Object.create(null);
3844 var keys = hasSymbol
3845 ? Reflect.ownKeys(inject)
3846 : Object.keys(inject);
3847
3848 for (var i = 0; i < keys.length; i++) {
3849 var key = keys[i];
3850 // #6574 in case the inject object is observed...
3851 if (key === '__ob__') { continue }
3852 var provideKey = inject[key].from;
3853 var source = vm;
3854 while (source) {
3855 if (source._provided && hasOwn(source._provided, provideKey)) {
3856 result[key] = source._provided[provideKey];
3857 break
3858 }
3859 source = source.$parent;
3860 }
3861 if (!source) {
3862 if ('default' in inject[key]) {
3863 var provideDefault = inject[key].default;
3864 result[key] = typeof provideDefault === 'function'
3865 ? provideDefault.call(vm)
3866 : provideDefault;
3867 } else {
3868 warn(("Injection \"" + key + "\" not found"), vm);
3869 }
3870 }
3871 }
3872 return result
3873 }
3874}
3875
3876/* */
3877
3878function normalizeScopedSlots (
3879 slots,
3880 normalSlots
3881) {
3882 var res;
3883 if (!slots) {
3884 res = {};
3885 } else if (slots._normalized) {
3886 return slots
3887 } else {
3888 res = {};
3889 for (var key in slots) {
3890 if (slots[key] && key[0] !== '$') {
3891 res[key] = normalizeScopedSlot(slots[key]);
3892 }
3893 }
3894 }
3895 // expose normal slots on scopedSlots
3896 for (var key$1 in normalSlots) {
3897 if (!(key$1 in res)) {
3898 res[key$1] = proxyNormalSlot(normalSlots, key$1);
3899 }
3900 }
3901 res._normalized = true;
3902 res.$stable = slots ? slots.$stable : true;
3903 return res
3904}
3905
3906function normalizeScopedSlot(fn) {
3907 return function (scope) {
3908 var res = fn(scope);
3909 return res && typeof res === 'object' && !Array.isArray(res)
3910 ? [res] // single vnode
3911 : normalizeChildren(res)
3912 }
3913}
3914
3915function proxyNormalSlot(slots, key) {
3916 return function () { return slots[key]; }
3917}
3918
3919/* */
3920
3921/**
3922 * Runtime helper for rendering v-for lists.
3923 */
3924function renderList (
3925 val,
3926 render
3927) {
3928 var ret, i, l, keys, key;
3929 if (Array.isArray(val) || typeof val === 'string') {
3930 ret = new Array(val.length);
3931 for (i = 0, l = val.length; i < l; i++) {
3932 ret[i] = render(val[i], i);
3933 }
3934 } else if (typeof val === 'number') {
3935 ret = new Array(val);
3936 for (i = 0; i < val; i++) {
3937 ret[i] = render(i + 1, i);
3938 }
3939 } else if (isObject(val)) {
3940 if (hasSymbol && val[Symbol.iterator]) {
3941 ret = [];
3942 var iterator = val[Symbol.iterator]();
3943 var result = iterator.next();
3944 while (!result.done) {
3945 ret.push(render(result.value, ret.length));
3946 result = iterator.next();
3947 }
3948 } else {
3949 keys = Object.keys(val);
3950 ret = new Array(keys.length);
3951 for (i = 0, l = keys.length; i < l; i++) {
3952 key = keys[i];
3953 ret[i] = render(val[key], key, i);
3954 }
3955 }
3956 }
3957 if (!isDef(ret)) {
3958 ret = [];
3959 }
3960 (ret)._isVList = true;
3961 return ret
3962}
3963
3964/* */
3965
3966/**
3967 * Runtime helper for rendering <slot>
3968 */
3969function renderSlot (
3970 name,
3971 fallback,
3972 props,
3973 bindObject
3974) {
3975 var scopedSlotFn = this.$scopedSlots[name];
3976 var nodes;
3977 if (scopedSlotFn) { // scoped slot
3978 props = props || {};
3979 if (bindObject) {
3980 if (!isObject(bindObject)) {
3981 warn(
3982 'slot v-bind without argument expects an Object',
3983 this
3984 );
3985 }
3986 props = extend(extend({}, bindObject), props);
3987 }
3988 nodes = scopedSlotFn(props) || fallback;
3989 } else {
3990 nodes = this.$slots[name] || fallback;
3991 }
3992
3993 var target = props && props.slot;
3994 if (target) {
3995 return this.$createElement('template', { slot: target }, nodes)
3996 } else {
3997 return nodes
3998 }
3999}
4000
4001/* */
4002
4003/**
4004 * Runtime helper for resolving filters
4005 */
4006function resolveFilter (id) {
4007 return resolveAsset(this.$options, 'filters', id, true) || identity
4008}
4009
4010/* */
4011
4012function isKeyNotMatch (expect, actual) {
4013 if (Array.isArray(expect)) {
4014 return expect.indexOf(actual) === -1
4015 } else {
4016 return expect !== actual
4017 }
4018}
4019
4020/**
4021 * Runtime helper for checking keyCodes from config.
4022 * exposed as Vue.prototype._k
4023 * passing in eventKeyName as last argument separately for backwards compat
4024 */
4025function checkKeyCodes (
4026 eventKeyCode,
4027 key,
4028 builtInKeyCode,
4029 eventKeyName,
4030 builtInKeyName
4031) {
4032 var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
4033 if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
4034 return isKeyNotMatch(builtInKeyName, eventKeyName)
4035 } else if (mappedKeyCode) {
4036 return isKeyNotMatch(mappedKeyCode, eventKeyCode)
4037 } else if (eventKeyName) {
4038 return hyphenate(eventKeyName) !== key
4039 }
4040}
4041
4042/* */
4043
4044/**
4045 * Runtime helper for merging v-bind="object" into a VNode's data.
4046 */
4047function bindObjectProps (
4048 data,
4049 tag,
4050 value,
4051 asProp,
4052 isSync
4053) {
4054 if (value) {
4055 if (!isObject(value)) {
4056 warn(
4057 'v-bind without argument expects an Object or Array value',
4058 this
4059 );
4060 } else {
4061 if (Array.isArray(value)) {
4062 value = toObject(value);
4063 }
4064 var hash;
4065 var loop = function ( key ) {
4066 if (
4067 key === 'class' ||
4068 key === 'style' ||
4069 isReservedAttribute(key)
4070 ) {
4071 hash = data;
4072 } else {
4073 var type = data.attrs && data.attrs.type;
4074 hash = asProp || config.mustUseProp(tag, type, key)
4075 ? data.domProps || (data.domProps = {})
4076 : data.attrs || (data.attrs = {});
4077 }
4078 var camelizedKey = camelize(key);
4079 if (!(key in hash) && !(camelizedKey in hash)) {
4080 hash[key] = value[key];
4081
4082 if (isSync) {
4083 var on = data.on || (data.on = {});
4084 on[("update:" + camelizedKey)] = function ($event) {
4085 value[key] = $event;
4086 };
4087 }
4088 }
4089 };
4090
4091 for (var key in value) loop( key );
4092 }
4093 }
4094 return data
4095}
4096
4097/* */
4098
4099/**
4100 * Runtime helper for rendering static trees.
4101 */
4102function renderStatic (
4103 index,
4104 isInFor
4105) {
4106 var cached = this._staticTrees || (this._staticTrees = []);
4107 var tree = cached[index];
4108 // if has already-rendered static tree and not inside v-for,
4109 // we can reuse the same tree.
4110 if (tree && !isInFor) {
4111 return tree
4112 }
4113 // otherwise, render a fresh tree.
4114 tree = cached[index] = this.$options.staticRenderFns[index].call(
4115 this._renderProxy,
4116 null,
4117 this // for render fns generated for functional component templates
4118 );
4119 markStatic(tree, ("__static__" + index), false);
4120 return tree
4121}
4122
4123/**
4124 * Runtime helper for v-once.
4125 * Effectively it means marking the node as static with a unique key.
4126 */
4127function markOnce (
4128 tree,
4129 index,
4130 key
4131) {
4132 markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
4133 return tree
4134}
4135
4136function markStatic (
4137 tree,
4138 key,
4139 isOnce
4140) {
4141 if (Array.isArray(tree)) {
4142 for (var i = 0; i < tree.length; i++) {
4143 if (tree[i] && typeof tree[i] !== 'string') {
4144 markStaticNode(tree[i], (key + "_" + i), isOnce);
4145 }
4146 }
4147 } else {
4148 markStaticNode(tree, key, isOnce);
4149 }
4150}
4151
4152function markStaticNode (node, key, isOnce) {
4153 node.isStatic = true;
4154 node.key = key;
4155 node.isOnce = isOnce;
4156}
4157
4158/* */
4159
4160function bindObjectListeners (data, value) {
4161 if (value) {
4162 if (!isPlainObject(value)) {
4163 warn(
4164 'v-on without argument expects an Object value',
4165 this
4166 );
4167 } else {
4168 var on = data.on = data.on ? extend({}, data.on) : {};
4169 for (var key in value) {
4170 var existing = on[key];
4171 var ours = value[key];
4172 on[key] = existing ? [].concat(existing, ours) : ours;
4173 }
4174 }
4175 }
4176 return data
4177}
4178
4179/* */
4180
4181function bindDynamicKeys (baseObj, values) {
4182 for (var i = 0; i < values.length; i += 2) {
4183 var key = values[i];
4184 if (typeof key === 'string' && key) {
4185 baseObj[values[i]] = values[i + 1];
4186 } else if (key !== '' && key !== null) {
4187 // null is a speical value for explicitly removing a binding
4188 warn(
4189 ("Invalid value for dynamic directive argument (expected string or null): " + key),
4190 this
4191 );
4192 }
4193 }
4194 return baseObj
4195}
4196
4197// helper to dynamically append modifier runtime markers to event names.
4198// ensure only append when value is already string, otherwise it will be cast
4199// to string and cause the type check to miss.
4200function prependModifier (value, symbol) {
4201 return typeof value === 'string' ? symbol + value : value
4202}
4203
4204/* */
4205
4206function installRenderHelpers (target) {
4207 target._o = markOnce;
4208 target._n = toNumber;
4209 target._s = toString;
4210 target._l = renderList;
4211 target._t = renderSlot;
4212 target._q = looseEqual;
4213 target._i = looseIndexOf;
4214 target._m = renderStatic;
4215 target._f = resolveFilter;
4216 target._k = checkKeyCodes;
4217 target._b = bindObjectProps;
4218 target._v = createTextVNode;
4219 target._e = createEmptyVNode;
4220 target._u = resolveScopedSlots;
4221 target._g = bindObjectListeners;
4222 target._d = bindDynamicKeys;
4223 target._p = prependModifier;
4224}
4225
4226/* */
4227
4228function FunctionalRenderContext (
4229 data,
4230 props,
4231 children,
4232 parent,
4233 Ctor
4234) {
4235 var options = Ctor.options;
4236 // ensure the createElement function in functional components
4237 // gets a unique context - this is necessary for correct named slot check
4238 var contextVm;
4239 if (hasOwn(parent, '_uid')) {
4240 contextVm = Object.create(parent);
4241 // $flow-disable-line
4242 contextVm._original = parent;
4243 } else {
4244 // the context vm passed in is a functional context as well.
4245 // in this case we want to make sure we are able to get a hold to the
4246 // real context instance.
4247 contextVm = parent;
4248 // $flow-disable-line
4249 parent = parent._original;
4250 }
4251 var isCompiled = isTrue(options._compiled);
4252 var needNormalization = !isCompiled;
4253
4254 this.data = data;
4255 this.props = props;
4256 this.children = children;
4257 this.parent = parent;
4258 this.listeners = data.on || emptyObject;
4259 this.injections = resolveInject(options.inject, parent);
4260 this.slots = function () { return resolveSlots(children, parent); };
4261
4262 Object.defineProperty(this, 'scopedSlots', ({
4263 enumerable: true,
4264 get: function get () {
4265 return normalizeScopedSlots(data.scopedSlots, this.slots())
4266 }
4267 }));
4268
4269 // support for compiled functional template
4270 if (isCompiled) {
4271 // exposing $options for renderStatic()
4272 this.$options = options;
4273 // pre-resolve slots for renderSlot()
4274 this.$slots = this.slots();
4275 this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
4276 }
4277
4278 if (options._scopeId) {
4279 this._c = function (a, b, c, d) {
4280 var vnode = createElement(contextVm, a, b, c, d, needNormalization);
4281 if (vnode && !Array.isArray(vnode)) {
4282 vnode.fnScopeId = options._scopeId;
4283 vnode.fnContext = parent;
4284 }
4285 return vnode
4286 };
4287 } else {
4288 this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
4289 }
4290}
4291
4292installRenderHelpers(FunctionalRenderContext.prototype);
4293
4294function createFunctionalComponent (
4295 Ctor,
4296 propsData,
4297 data,
4298 contextVm,
4299 children
4300) {
4301 var options = Ctor.options;
4302 var props = {};
4303 var propOptions = options.props;
4304 if (isDef(propOptions)) {
4305 for (var key in propOptions) {
4306 props[key] = validateProp(key, propOptions, propsData || emptyObject);
4307 }
4308 } else {
4309 if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
4310 if (isDef(data.props)) { mergeProps(props, data.props); }
4311 }
4312
4313 var renderContext = new FunctionalRenderContext(
4314 data,
4315 props,
4316 children,
4317 contextVm,
4318 Ctor
4319 );
4320
4321 var vnode = options.render.call(null, renderContext._c, renderContext);
4322
4323 if (vnode instanceof VNode) {
4324 return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
4325 } else if (Array.isArray(vnode)) {
4326 var vnodes = normalizeChildren(vnode) || [];
4327 var res = new Array(vnodes.length);
4328 for (var i = 0; i < vnodes.length; i++) {
4329 res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
4330 }
4331 return res
4332 }
4333}
4334
4335function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
4336 // #7817 clone node before setting fnContext, otherwise if the node is reused
4337 // (e.g. it was from a cached normal slot) the fnContext causes named slots
4338 // that should not be matched to match.
4339 var clone = cloneVNode(vnode);
4340 clone.fnContext = contextVm;
4341 clone.fnOptions = options;
4342 {
4343 (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
4344 }
4345 if (data.slot) {
4346 (clone.data || (clone.data = {})).slot = data.slot;
4347 }
4348 return clone
4349}
4350
4351function mergeProps (to, from) {
4352 for (var key in from) {
4353 to[camelize(key)] = from[key];
4354 }
4355}
4356
4357/* */
4358
4359/* */
4360
4361/* */
4362
4363/* */
4364
4365// inline hooks to be invoked on component VNodes during patch
4366var componentVNodeHooks = {
4367 init: function init (vnode, hydrating) {
4368 if (
4369 vnode.componentInstance &&
4370 !vnode.componentInstance._isDestroyed &&
4371 vnode.data.keepAlive
4372 ) {
4373 // kept-alive components, treat as a patch
4374 var mountedNode = vnode; // work around flow
4375 componentVNodeHooks.prepatch(mountedNode, mountedNode);
4376 } else {
4377 var child = vnode.componentInstance = createComponentInstanceForVnode(
4378 vnode,
4379 activeInstance
4380 );
4381 child.$mount(hydrating ? vnode.elm : undefined, hydrating);
4382 }
4383 },
4384
4385 prepatch: function prepatch (oldVnode, vnode) {
4386 var options = vnode.componentOptions;
4387 var child = vnode.componentInstance = oldVnode.componentInstance;
4388 updateChildComponent(
4389 child,
4390 options.propsData, // updated props
4391 options.listeners, // updated listeners
4392 vnode, // new parent vnode
4393 options.children // new children
4394 );
4395 },
4396
4397 insert: function insert (vnode) {
4398 var context = vnode.context;
4399 var componentInstance = vnode.componentInstance;
4400 if (!componentInstance._isMounted) {
4401 componentInstance._isMounted = true;
4402 callHook(componentInstance, 'mounted');
4403 }
4404 if (vnode.data.keepAlive) {
4405 if (context._isMounted) {
4406 // vue-router#1212
4407 // During updates, a kept-alive component's child components may
4408 // change, so directly walking the tree here may call activated hooks
4409 // on incorrect children. Instead we push them into a queue which will
4410 // be processed after the whole patch process ended.
4411 queueActivatedComponent(componentInstance);
4412 } else {
4413 activateChildComponent(componentInstance, true /* direct */);
4414 }
4415 }
4416 },
4417
4418 destroy: function destroy (vnode) {
4419 var componentInstance = vnode.componentInstance;
4420 if (!componentInstance._isDestroyed) {
4421 if (!vnode.data.keepAlive) {
4422 componentInstance.$destroy();
4423 } else {
4424 deactivateChildComponent(componentInstance, true /* direct */);
4425 }
4426 }
4427 }
4428};
4429
4430var hooksToMerge = Object.keys(componentVNodeHooks);
4431
4432function createComponent (
4433 Ctor,
4434 data,
4435 context,
4436 children,
4437 tag
4438) {
4439 if (isUndef(Ctor)) {
4440 return
4441 }
4442
4443 var baseCtor = context.$options._base;
4444
4445 // plain options object: turn it into a constructor
4446 if (isObject(Ctor)) {
4447 Ctor = baseCtor.extend(Ctor);
4448 }
4449
4450 // if at this stage it's not a constructor or an async component factory,
4451 // reject.
4452 if (typeof Ctor !== 'function') {
4453 {
4454 warn(("Invalid Component definition: " + (String(Ctor))), context);
4455 }
4456 return
4457 }
4458
4459 // async component
4460 var asyncFactory;
4461 if (isUndef(Ctor.cid)) {
4462 asyncFactory = Ctor;
4463 Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
4464 if (Ctor === undefined) {
4465 // return a placeholder node for async component, which is rendered
4466 // as a comment node but preserves all the raw information for the node.
4467 // the information will be used for async server-rendering and hydration.
4468 return createAsyncPlaceholder(
4469 asyncFactory,
4470 data,
4471 context,
4472 children,
4473 tag
4474 )
4475 }
4476 }
4477
4478 data = data || {};
4479
4480 // resolve constructor options in case global mixins are applied after
4481 // component constructor creation
4482 resolveConstructorOptions(Ctor);
4483
4484 // transform component v-model data into props & events
4485 if (isDef(data.model)) {
4486 transformModel(Ctor.options, data);
4487 }
4488
4489 // extract props
4490 var propsData = extractPropsFromVNodeData(data, Ctor, tag);
4491
4492 // functional component
4493 if (isTrue(Ctor.options.functional)) {
4494 return createFunctionalComponent(Ctor, propsData, data, context, children)
4495 }
4496
4497 // extract listeners, since these needs to be treated as
4498 // child component listeners instead of DOM listeners
4499 var listeners = data.on;
4500 // replace with listeners with .native modifier
4501 // so it gets processed during parent component patch.
4502 data.on = data.nativeOn;
4503
4504 if (isTrue(Ctor.options.abstract)) {
4505 // abstract components do not keep anything
4506 // other than props & listeners & slot
4507
4508 // work around flow
4509 var slot = data.slot;
4510 data = {};
4511 if (slot) {
4512 data.slot = slot;
4513 }
4514 }
4515
4516 // install component management hooks onto the placeholder node
4517 installComponentHooks(data);
4518
4519 // return a placeholder vnode
4520 var name = Ctor.options.name || tag;
4521 var vnode = new VNode(
4522 ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
4523 data, undefined, undefined, undefined, context,
4524 { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
4525 asyncFactory
4526 );
4527
4528 return vnode
4529}
4530
4531function createComponentInstanceForVnode (
4532 vnode, // we know it's MountedComponentVNode but flow doesn't
4533 parent // activeInstance in lifecycle state
4534) {
4535 var options = {
4536 _isComponent: true,
4537 _parentVnode: vnode,
4538 parent: parent
4539 };
4540 // check inline-template render functions
4541 var inlineTemplate = vnode.data.inlineTemplate;
4542 if (isDef(inlineTemplate)) {
4543 options.render = inlineTemplate.render;
4544 options.staticRenderFns = inlineTemplate.staticRenderFns;
4545 }
4546 return new vnode.componentOptions.Ctor(options)
4547}
4548
4549function installComponentHooks (data) {
4550 var hooks = data.hook || (data.hook = {});
4551 for (var i = 0; i < hooksToMerge.length; i++) {
4552 var key = hooksToMerge[i];
4553 var existing = hooks[key];
4554 var toMerge = componentVNodeHooks[key];
4555 if (existing !== toMerge && !(existing && existing._merged)) {
4556 hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
4557 }
4558 }
4559}
4560
4561function mergeHook$1 (f1, f2) {
4562 var merged = function (a, b) {
4563 // flow complains about extra args which is why we use any
4564 f1(a, b);
4565 f2(a, b);
4566 };
4567 merged._merged = true;
4568 return merged
4569}
4570
4571// transform component v-model info (value and callback) into
4572// prop and event handler respectively.
4573function transformModel (options, data) {
4574 var prop = (options.model && options.model.prop) || 'value';
4575 var event = (options.model && options.model.event) || 'input'
4576 ;(data.props || (data.props = {}))[prop] = data.model.value;
4577 var on = data.on || (data.on = {});
4578 var existing = on[event];
4579 var callback = data.model.callback;
4580 if (isDef(existing)) {
4581 if (
4582 Array.isArray(existing)
4583 ? existing.indexOf(callback) === -1
4584 : existing !== callback
4585 ) {
4586 on[event] = [callback].concat(existing);
4587 }
4588 } else {
4589 on[event] = callback;
4590 }
4591}
4592
4593/* */
4594
4595var SIMPLE_NORMALIZE = 1;
4596var ALWAYS_NORMALIZE = 2;
4597
4598// wrapper function for providing a more flexible interface
4599// without getting yelled at by flow
4600function createElement (
4601 context,
4602 tag,
4603 data,
4604 children,
4605 normalizationType,
4606 alwaysNormalize
4607) {
4608 if (Array.isArray(data) || isPrimitive(data)) {
4609 normalizationType = children;
4610 children = data;
4611 data = undefined;
4612 }
4613 if (isTrue(alwaysNormalize)) {
4614 normalizationType = ALWAYS_NORMALIZE;
4615 }
4616 return _createElement(context, tag, data, children, normalizationType)
4617}
4618
4619function _createElement (
4620 context,
4621 tag,
4622 data,
4623 children,
4624 normalizationType
4625) {
4626 if (isDef(data) && isDef((data).__ob__)) {
4627 warn(
4628 "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
4629 'Always create fresh vnode data objects in each render!',
4630 context
4631 );
4632 return createEmptyVNode()
4633 }
4634 // object syntax in v-bind
4635 if (isDef(data) && isDef(data.is)) {
4636 tag = data.is;
4637 }
4638 if (!tag) {
4639 // in case of component :is set to falsy value
4640 return createEmptyVNode()
4641 }
4642 // warn against non-primitive key
4643 if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
4644 ) {
4645 {
4646 warn(
4647 'Avoid using non-primitive value as key, ' +
4648 'use string/number value instead.',
4649 context
4650 );
4651 }
4652 }
4653 // support single function children as default scoped slot
4654 if (Array.isArray(children) &&
4655 typeof children[0] === 'function'
4656 ) {
4657 data = data || {};
4658 data.scopedSlots = { default: children[0] };
4659 children.length = 0;
4660 }
4661 if (normalizationType === ALWAYS_NORMALIZE) {
4662 children = normalizeChildren(children);
4663 } else if (normalizationType === SIMPLE_NORMALIZE) {
4664 children = simpleNormalizeChildren(children);
4665 }
4666 var vnode, ns;
4667 if (typeof tag === 'string') {
4668 var Ctor;
4669 ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
4670 if (config.isReservedTag(tag)) {
4671 // platform built-in elements
4672 vnode = new VNode(
4673 config.parsePlatformTagName(tag), data, children,
4674 undefined, undefined, context
4675 );
4676 } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
4677 // component
4678 vnode = createComponent(Ctor, data, context, children, tag);
4679 } else {
4680 // unknown or unlisted namespaced elements
4681 // check at runtime because it may get assigned a namespace when its
4682 // parent normalizes children
4683 vnode = new VNode(
4684 tag, data, children,
4685 undefined, undefined, context
4686 );
4687 }
4688 } else {
4689 // direct component options / constructor
4690 vnode = createComponent(tag, data, context, children);
4691 }
4692 if (Array.isArray(vnode)) {
4693 return vnode
4694 } else if (isDef(vnode)) {
4695 if (isDef(ns)) { applyNS(vnode, ns); }
4696 if (isDef(data)) { registerDeepBindings(data); }
4697 return vnode
4698 } else {
4699 return createEmptyVNode()
4700 }
4701}
4702
4703function applyNS (vnode, ns, force) {
4704 vnode.ns = ns;
4705 if (vnode.tag === 'foreignObject') {
4706 // use default namespace inside foreignObject
4707 ns = undefined;
4708 force = true;
4709 }
4710 if (isDef(vnode.children)) {
4711 for (var i = 0, l = vnode.children.length; i < l; i++) {
4712 var child = vnode.children[i];
4713 if (isDef(child.tag) && (
4714 isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
4715 applyNS(child, ns, force);
4716 }
4717 }
4718 }
4719}
4720
4721// ref #5318
4722// necessary to ensure parent re-render when deep bindings like :style and
4723// :class are used on slot nodes
4724function registerDeepBindings (data) {
4725 if (isObject(data.style)) {
4726 traverse(data.style);
4727 }
4728 if (isObject(data.class)) {
4729 traverse(data.class);
4730 }
4731}
4732
4733/* */
4734
4735function initRender (vm) {
4736 vm._vnode = null; // the root of the child tree
4737 vm._staticTrees = null; // v-once cached trees
4738 var options = vm.$options;
4739 var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
4740 var renderContext = parentVnode && parentVnode.context;
4741 vm.$slots = resolveSlots(options._renderChildren, renderContext);
4742 vm.$scopedSlots = emptyObject;
4743 // bind the createElement fn to this instance
4744 // so that we get proper render context inside it.
4745 // args order: tag, data, children, normalizationType, alwaysNormalize
4746 // internal version is used by render functions compiled from templates
4747 vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
4748 // normalization is always applied for the public version, used in
4749 // user-written render functions.
4750 vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
4751
4752 // $attrs & $listeners are exposed for easier HOC creation.
4753 // they need to be reactive so that HOCs using them are always updated
4754 var parentData = parentVnode && parentVnode.data;
4755
4756 /* istanbul ignore else */
4757 {
4758 defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
4759 !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
4760 }, true);
4761 defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
4762 !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
4763 }, true);
4764 }
4765}
4766
4767function renderMixin (Vue) {
4768 // install runtime convenience helpers
4769 installRenderHelpers(Vue.prototype);
4770
4771 Vue.prototype.$nextTick = function (fn) {
4772 return nextTick(fn, this)
4773 };
4774
4775 Vue.prototype._render = function () {
4776 var vm = this;
4777 var ref = vm.$options;
4778 var render = ref.render;
4779 var _parentVnode = ref._parentVnode;
4780
4781 if (_parentVnode) {
4782 vm.$scopedSlots = normalizeScopedSlots(
4783 _parentVnode.data.scopedSlots,
4784 vm.$slots
4785 );
4786 }
4787
4788 // set parent vnode. this allows render functions to have access
4789 // to the data on the placeholder node.
4790 vm.$vnode = _parentVnode;
4791 // render self
4792 var vnode;
4793 try {
4794 vnode = render.call(vm._renderProxy, vm.$createElement);
4795 } catch (e) {
4796 handleError(e, vm, "render");
4797 // return error render result,
4798 // or previous vnode to prevent render error causing blank component
4799 /* istanbul ignore else */
4800 if (vm.$options.renderError) {
4801 try {
4802 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
4803 } catch (e) {
4804 handleError(e, vm, "renderError");
4805 vnode = vm._vnode;
4806 }
4807 } else {
4808 vnode = vm._vnode;
4809 }
4810 }
4811 // if the returned array contains only a single node, allow it
4812 if (Array.isArray(vnode) && vnode.length === 1) {
4813 vnode = vnode[0];
4814 }
4815 // return empty vnode in case the render function errored out
4816 if (!(vnode instanceof VNode)) {
4817 if (Array.isArray(vnode)) {
4818 warn(
4819 'Multiple root nodes returned from render function. Render function ' +
4820 'should return a single root node.',
4821 vm
4822 );
4823 }
4824 vnode = createEmptyVNode();
4825 }
4826 // set parent
4827 vnode.parent = _parentVnode;
4828 return vnode
4829 };
4830}
4831
4832/* */
4833
4834var uid$3 = 0;
4835
4836function initMixin (Vue) {
4837 Vue.prototype._init = function (options) {
4838 var vm = this;
4839 // a uid
4840 vm._uid = uid$3++;
4841
4842 var startTag, endTag;
4843 /* istanbul ignore if */
4844 if (config.performance && mark) {
4845 startTag = "vue-perf-start:" + (vm._uid);
4846 endTag = "vue-perf-end:" + (vm._uid);
4847 mark(startTag);
4848 }
4849
4850 // a flag to avoid this being observed
4851 vm._isVue = true;
4852 // merge options
4853 if (options && options._isComponent) {
4854 // optimize internal component instantiation
4855 // since dynamic options merging is pretty slow, and none of the
4856 // internal component options needs special treatment.
4857 initInternalComponent(vm, options);
4858 } else {
4859 vm.$options = mergeOptions(
4860 resolveConstructorOptions(vm.constructor),
4861 options || {},
4862 vm
4863 );
4864 }
4865 /* istanbul ignore else */
4866 {
4867 initProxy(vm);
4868 }
4869 // expose real self
4870 vm._self = vm;
4871 initLifecycle(vm);
4872 initEvents(vm);
4873 initRender(vm);
4874 callHook(vm, 'beforeCreate');
4875 initInjections(vm); // resolve injections before data/props
4876 initState(vm);
4877 initProvide(vm); // resolve provide after data/props
4878 callHook(vm, 'created');
4879
4880 /* istanbul ignore if */
4881 if (config.performance && mark) {
4882 vm._name = formatComponentName(vm, false);
4883 mark(endTag);
4884 measure(("vue " + (vm._name) + " init"), startTag, endTag);
4885 }
4886
4887 if (vm.$options.el) {
4888 vm.$mount(vm.$options.el);
4889 }
4890 };
4891}
4892
4893function initInternalComponent (vm, options) {
4894 var opts = vm.$options = Object.create(vm.constructor.options);
4895 // doing this because it's faster than dynamic enumeration.
4896 var parentVnode = options._parentVnode;
4897 opts.parent = options.parent;
4898 opts._parentVnode = parentVnode;
4899
4900 var vnodeComponentOptions = parentVnode.componentOptions;
4901 opts.propsData = vnodeComponentOptions.propsData;
4902 opts._parentListeners = vnodeComponentOptions.listeners;
4903 opts._renderChildren = vnodeComponentOptions.children;
4904 opts._componentTag = vnodeComponentOptions.tag;
4905
4906 if (options.render) {
4907 opts.render = options.render;
4908 opts.staticRenderFns = options.staticRenderFns;
4909 }
4910}
4911
4912function resolveConstructorOptions (Ctor) {
4913 var options = Ctor.options;
4914 if (Ctor.super) {
4915 var superOptions = resolveConstructorOptions(Ctor.super);
4916 var cachedSuperOptions = Ctor.superOptions;
4917 if (superOptions !== cachedSuperOptions) {
4918 // super option changed,
4919 // need to resolve new options.
4920 Ctor.superOptions = superOptions;
4921 // check if there are any late-modified/attached options (#4976)
4922 var modifiedOptions = resolveModifiedOptions(Ctor);
4923 // update base extend options
4924 if (modifiedOptions) {
4925 extend(Ctor.extendOptions, modifiedOptions);
4926 }
4927 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
4928 if (options.name) {
4929 options.components[options.name] = Ctor;
4930 }
4931 }
4932 }
4933 return options
4934}
4935
4936function resolveModifiedOptions (Ctor) {
4937 var modified;
4938 var latest = Ctor.options;
4939 var sealed = Ctor.sealedOptions;
4940 for (var key in latest) {
4941 if (latest[key] !== sealed[key]) {
4942 if (!modified) { modified = {}; }
4943 modified[key] = latest[key];
4944 }
4945 }
4946 return modified
4947}
4948
4949function Vue (options) {
4950 if (!(this instanceof Vue)
4951 ) {
4952 warn('Vue is a constructor and should be called with the `new` keyword');
4953 }
4954 this._init(options);
4955}
4956
4957initMixin(Vue);
4958stateMixin(Vue);
4959eventsMixin(Vue);
4960lifecycleMixin(Vue);
4961renderMixin(Vue);
4962
4963/* */
4964
4965function initUse (Vue) {
4966 Vue.use = function (plugin) {
4967 var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
4968 if (installedPlugins.indexOf(plugin) > -1) {
4969 return this
4970 }
4971
4972 // additional parameters
4973 var args = toArray(arguments, 1);
4974 args.unshift(this);
4975 if (typeof plugin.install === 'function') {
4976 plugin.install.apply(plugin, args);
4977 } else if (typeof plugin === 'function') {
4978 plugin.apply(null, args);
4979 }
4980 installedPlugins.push(plugin);
4981 return this
4982 };
4983}
4984
4985/* */
4986
4987function initMixin$1 (Vue) {
4988 Vue.mixin = function (mixin) {
4989 this.options = mergeOptions(this.options, mixin);
4990 return this
4991 };
4992}
4993
4994/* */
4995
4996function initExtend (Vue) {
4997 /**
4998 * Each instance constructor, including Vue, has a unique
4999 * cid. This enables us to create wrapped "child
5000 * constructors" for prototypal inheritance and cache them.
5001 */
5002 Vue.cid = 0;
5003 var cid = 1;
5004
5005 /**
5006 * Class inheritance
5007 */
5008 Vue.extend = function (extendOptions) {
5009 extendOptions = extendOptions || {};
5010 var Super = this;
5011 var SuperId = Super.cid;
5012 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
5013 if (cachedCtors[SuperId]) {
5014 return cachedCtors[SuperId]
5015 }
5016
5017 var name = extendOptions.name || Super.options.name;
5018 if (name) {
5019 validateComponentName(name);
5020 }
5021
5022 var Sub = function VueComponent (options) {
5023 this._init(options);
5024 };
5025 Sub.prototype = Object.create(Super.prototype);
5026 Sub.prototype.constructor = Sub;
5027 Sub.cid = cid++;
5028 Sub.options = mergeOptions(
5029 Super.options,
5030 extendOptions
5031 );
5032 Sub['super'] = Super;
5033
5034 // For props and computed properties, we define the proxy getters on
5035 // the Vue instances at extension time, on the extended prototype. This
5036 // avoids Object.defineProperty calls for each instance created.
5037 if (Sub.options.props) {
5038 initProps$1(Sub);
5039 }
5040 if (Sub.options.computed) {
5041 initComputed$1(Sub);
5042 }
5043
5044 // allow further extension/mixin/plugin usage
5045 Sub.extend = Super.extend;
5046 Sub.mixin = Super.mixin;
5047 Sub.use = Super.use;
5048
5049 // create asset registers, so extended classes
5050 // can have their private assets too.
5051 ASSET_TYPES.forEach(function (type) {
5052 Sub[type] = Super[type];
5053 });
5054 // enable recursive self-lookup
5055 if (name) {
5056 Sub.options.components[name] = Sub;
5057 }
5058
5059 // keep a reference to the super options at extension time.
5060 // later at instantiation we can check if Super's options have
5061 // been updated.
5062 Sub.superOptions = Super.options;
5063 Sub.extendOptions = extendOptions;
5064 Sub.sealedOptions = extend({}, Sub.options);
5065
5066 // cache constructor
5067 cachedCtors[SuperId] = Sub;
5068 return Sub
5069 };
5070}
5071
5072function initProps$1 (Comp) {
5073 var props = Comp.options.props;
5074 for (var key in props) {
5075 proxy(Comp.prototype, "_props", key);
5076 }
5077}
5078
5079function initComputed$1 (Comp) {
5080 var computed = Comp.options.computed;
5081 for (var key in computed) {
5082 defineComputed(Comp.prototype, key, computed[key]);
5083 }
5084}
5085
5086/* */
5087
5088function initAssetRegisters (Vue) {
5089 /**
5090 * Create asset registration methods.
5091 */
5092 ASSET_TYPES.forEach(function (type) {
5093 Vue[type] = function (
5094 id,
5095 definition
5096 ) {
5097 if (!definition) {
5098 return this.options[type + 's'][id]
5099 } else {
5100 /* istanbul ignore if */
5101 if (type === 'component') {
5102 validateComponentName(id);
5103 }
5104 if (type === 'component' && isPlainObject(definition)) {
5105 definition.name = definition.name || id;
5106 definition = this.options._base.extend(definition);
5107 }
5108 if (type === 'directive' && typeof definition === 'function') {
5109 definition = { bind: definition, update: definition };
5110 }
5111 this.options[type + 's'][id] = definition;
5112 return definition
5113 }
5114 };
5115 });
5116}
5117
5118/* */
5119
5120
5121
5122function getComponentName (opts) {
5123 return opts && (opts.Ctor.options.name || opts.tag)
5124}
5125
5126function matches (pattern, name) {
5127 if (Array.isArray(pattern)) {
5128 return pattern.indexOf(name) > -1
5129 } else if (typeof pattern === 'string') {
5130 return pattern.split(',').indexOf(name) > -1
5131 } else if (isRegExp(pattern)) {
5132 return pattern.test(name)
5133 }
5134 /* istanbul ignore next */
5135 return false
5136}
5137
5138function pruneCache (keepAliveInstance, filter) {
5139 var cache = keepAliveInstance.cache;
5140 var keys = keepAliveInstance.keys;
5141 var _vnode = keepAliveInstance._vnode;
5142 for (var key in cache) {
5143 var cachedNode = cache[key];
5144 if (cachedNode) {
5145 var name = getComponentName(cachedNode.componentOptions);
5146 if (name && !filter(name)) {
5147 pruneCacheEntry(cache, key, keys, _vnode);
5148 }
5149 }
5150 }
5151}
5152
5153function pruneCacheEntry (
5154 cache,
5155 key,
5156 keys,
5157 current
5158) {
5159 var cached$$1 = cache[key];
5160 if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
5161 cached$$1.componentInstance.$destroy();
5162 }
5163 cache[key] = null;
5164 remove(keys, key);
5165}
5166
5167var patternTypes = [String, RegExp, Array];
5168
5169var KeepAlive = {
5170 name: 'keep-alive',
5171 abstract: true,
5172
5173 props: {
5174 include: patternTypes,
5175 exclude: patternTypes,
5176 max: [String, Number]
5177 },
5178
5179 created: function created () {
5180 this.cache = Object.create(null);
5181 this.keys = [];
5182 },
5183
5184 destroyed: function destroyed () {
5185 for (var key in this.cache) {
5186 pruneCacheEntry(this.cache, key, this.keys);
5187 }
5188 },
5189
5190 mounted: function mounted () {
5191 var this$1 = this;
5192
5193 this.$watch('include', function (val) {
5194 pruneCache(this$1, function (name) { return matches(val, name); });
5195 });
5196 this.$watch('exclude', function (val) {
5197 pruneCache(this$1, function (name) { return !matches(val, name); });
5198 });
5199 },
5200
5201 render: function render () {
5202 var slot = this.$slots.default;
5203 var vnode = getFirstComponentChild(slot);
5204 var componentOptions = vnode && vnode.componentOptions;
5205 if (componentOptions) {
5206 // check pattern
5207 var name = getComponentName(componentOptions);
5208 var ref = this;
5209 var include = ref.include;
5210 var exclude = ref.exclude;
5211 if (
5212 // not included
5213 (include && (!name || !matches(include, name))) ||
5214 // excluded
5215 (exclude && name && matches(exclude, name))
5216 ) {
5217 return vnode
5218 }
5219
5220 var ref$1 = this;
5221 var cache = ref$1.cache;
5222 var keys = ref$1.keys;
5223 var key = vnode.key == null
5224 // same constructor may get registered as different local components
5225 // so cid alone is not enough (#3269)
5226 ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
5227 : vnode.key;
5228 if (cache[key]) {
5229 vnode.componentInstance = cache[key].componentInstance;
5230 // make current key freshest
5231 remove(keys, key);
5232 keys.push(key);
5233 } else {
5234 cache[key] = vnode;
5235 keys.push(key);
5236 // prune oldest entry
5237 if (this.max && keys.length > parseInt(this.max)) {
5238 pruneCacheEntry(cache, keys[0], keys, this._vnode);
5239 }
5240 }
5241
5242 vnode.data.keepAlive = true;
5243 }
5244 return vnode || (slot && slot[0])
5245 }
5246};
5247
5248var builtInComponents = {
5249 KeepAlive: KeepAlive
5250};
5251
5252/* */
5253
5254function initGlobalAPI (Vue) {
5255 // config
5256 var configDef = {};
5257 configDef.get = function () { return config; };
5258 {
5259 configDef.set = function () {
5260 warn(
5261 'Do not replace the Vue.config object, set individual fields instead.'
5262 );
5263 };
5264 }
5265 Object.defineProperty(Vue, 'config', configDef);
5266
5267 // exposed util methods.
5268 // NOTE: these are not considered part of the public API - avoid relying on
5269 // them unless you are aware of the risk.
5270 Vue.util = {
5271 warn: warn,
5272 extend: extend,
5273 mergeOptions: mergeOptions,
5274 defineReactive: defineReactive$$1
5275 };
5276
5277 Vue.set = set;
5278 Vue.delete = del;
5279 Vue.nextTick = nextTick;
5280
5281 // 2.6 explicit observable API
5282 Vue.observable = function (obj) {
5283 observe(obj);
5284 return obj
5285 };
5286
5287 Vue.options = Object.create(null);
5288 ASSET_TYPES.forEach(function (type) {
5289 Vue.options[type + 's'] = Object.create(null);
5290 });
5291
5292 // this is used to identify the "base" constructor to extend all plain-object
5293 // components with in Weex's multi-instance scenarios.
5294 Vue.options._base = Vue;
5295
5296 extend(Vue.options.components, builtInComponents);
5297
5298 initUse(Vue);
5299 initMixin$1(Vue);
5300 initExtend(Vue);
5301 initAssetRegisters(Vue);
5302}
5303
5304initGlobalAPI(Vue);
5305
5306Object.defineProperty(Vue.prototype, '$isServer', {
5307 get: isServerRendering
5308});
5309
5310Object.defineProperty(Vue.prototype, '$ssrContext', {
5311 get: function get () {
5312 /* istanbul ignore next */
5313 return this.$vnode && this.$vnode.ssrContext
5314 }
5315});
5316
5317// expose FunctionalRenderContext for ssr runtime helper installation
5318Object.defineProperty(Vue, 'FunctionalRenderContext', {
5319 value: FunctionalRenderContext
5320});
5321
5322Vue.version = '2.6.0';
5323
5324/* */
5325
5326// these are reserved for web because they are directly compiled away
5327// during template compilation
5328var isReservedAttr = makeMap('style,class');
5329
5330// attributes that should be using props for binding
5331var acceptValue = makeMap('input,textarea,option,select,progress');
5332var mustUseProp = function (tag, type, attr) {
5333 return (
5334 (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
5335 (attr === 'selected' && tag === 'option') ||
5336 (attr === 'checked' && tag === 'input') ||
5337 (attr === 'muted' && tag === 'video')
5338 )
5339};
5340
5341var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
5342
5343var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
5344
5345var convertEnumeratedValue = function (key, value) {
5346 return isFalsyAttrValue(value) || value === 'false'
5347 ? 'false'
5348 // allow arbitrary string value for contenteditable
5349 : key === 'contenteditable' && isValidContentEditableValue(value)
5350 ? value
5351 : 'true'
5352};
5353
5354var isBooleanAttr = makeMap(
5355 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
5356 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
5357 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
5358 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
5359 'required,reversed,scoped,seamless,selected,sortable,translate,' +
5360 'truespeed,typemustmatch,visible'
5361);
5362
5363var xlinkNS = 'http://www.w3.org/1999/xlink';
5364
5365var isXlink = function (name) {
5366 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
5367};
5368
5369var getXlinkProp = function (name) {
5370 return isXlink(name) ? name.slice(6, name.length) : ''
5371};
5372
5373var isFalsyAttrValue = function (val) {
5374 return val == null || val === false
5375};
5376
5377/* */
5378
5379function genClassForVnode (vnode) {
5380 var data = vnode.data;
5381 var parentNode = vnode;
5382 var childNode = vnode;
5383 while (isDef(childNode.componentInstance)) {
5384 childNode = childNode.componentInstance._vnode;
5385 if (childNode && childNode.data) {
5386 data = mergeClassData(childNode.data, data);
5387 }
5388 }
5389 while (isDef(parentNode = parentNode.parent)) {
5390 if (parentNode && parentNode.data) {
5391 data = mergeClassData(data, parentNode.data);
5392 }
5393 }
5394 return renderClass(data.staticClass, data.class)
5395}
5396
5397function mergeClassData (child, parent) {
5398 return {
5399 staticClass: concat(child.staticClass, parent.staticClass),
5400 class: isDef(child.class)
5401 ? [child.class, parent.class]
5402 : parent.class
5403 }
5404}
5405
5406function renderClass (
5407 staticClass,
5408 dynamicClass
5409) {
5410 if (isDef(staticClass) || isDef(dynamicClass)) {
5411 return concat(staticClass, stringifyClass(dynamicClass))
5412 }
5413 /* istanbul ignore next */
5414 return ''
5415}
5416
5417function concat (a, b) {
5418 return a ? b ? (a + ' ' + b) : a : (b || '')
5419}
5420
5421function stringifyClass (value) {
5422 if (Array.isArray(value)) {
5423 return stringifyArray(value)
5424 }
5425 if (isObject(value)) {
5426 return stringifyObject(value)
5427 }
5428 if (typeof value === 'string') {
5429 return value
5430 }
5431 /* istanbul ignore next */
5432 return ''
5433}
5434
5435function stringifyArray (value) {
5436 var res = '';
5437 var stringified;
5438 for (var i = 0, l = value.length; i < l; i++) {
5439 if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
5440 if (res) { res += ' '; }
5441 res += stringified;
5442 }
5443 }
5444 return res
5445}
5446
5447function stringifyObject (value) {
5448 var res = '';
5449 for (var key in value) {
5450 if (value[key]) {
5451 if (res) { res += ' '; }
5452 res += key;
5453 }
5454 }
5455 return res
5456}
5457
5458/* */
5459
5460var namespaceMap = {
5461 svg: 'http://www.w3.org/2000/svg',
5462 math: 'http://www.w3.org/1998/Math/MathML'
5463};
5464
5465var isHTMLTag = makeMap(
5466 'html,body,base,head,link,meta,style,title,' +
5467 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
5468 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
5469 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
5470 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
5471 'embed,object,param,source,canvas,script,noscript,del,ins,' +
5472 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
5473 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
5474 'output,progress,select,textarea,' +
5475 'details,dialog,menu,menuitem,summary,' +
5476 'content,element,shadow,template,blockquote,iframe,tfoot'
5477);
5478
5479// this map is intentionally selective, only covering SVG elements that may
5480// contain child elements.
5481var isSVG = makeMap(
5482 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
5483 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
5484 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
5485 true
5486);
5487
5488var isPreTag = function (tag) { return tag === 'pre'; };
5489
5490var isReservedTag = function (tag) {
5491 return isHTMLTag(tag) || isSVG(tag)
5492};
5493
5494function getTagNamespace (tag) {
5495 if (isSVG(tag)) {
5496 return 'svg'
5497 }
5498 // basic support for MathML
5499 // note it doesn't support other MathML elements being component roots
5500 if (tag === 'math') {
5501 return 'math'
5502 }
5503}
5504
5505var unknownElementCache = Object.create(null);
5506function isUnknownElement (tag) {
5507 /* istanbul ignore if */
5508 if (!inBrowser) {
5509 return true
5510 }
5511 if (isReservedTag(tag)) {
5512 return false
5513 }
5514 tag = tag.toLowerCase();
5515 /* istanbul ignore if */
5516 if (unknownElementCache[tag] != null) {
5517 return unknownElementCache[tag]
5518 }
5519 var el = document.createElement(tag);
5520 if (tag.indexOf('-') > -1) {
5521 // http://stackoverflow.com/a/28210364/1070244
5522 return (unknownElementCache[tag] = (
5523 el.constructor === window.HTMLUnknownElement ||
5524 el.constructor === window.HTMLElement
5525 ))
5526 } else {
5527 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
5528 }
5529}
5530
5531var isTextInputType = makeMap('text,number,password,search,email,tel,url');
5532
5533/* */
5534
5535/**
5536 * Query an element selector if it's not an element already.
5537 */
5538function query (el) {
5539 if (typeof el === 'string') {
5540 var selected = document.querySelector(el);
5541 if (!selected) {
5542 warn(
5543 'Cannot find element: ' + el
5544 );
5545 return document.createElement('div')
5546 }
5547 return selected
5548 } else {
5549 return el
5550 }
5551}
5552
5553/* */
5554
5555function createElement$1 (tagName, vnode) {
5556 var elm = document.createElement(tagName);
5557 if (tagName !== 'select') {
5558 return elm
5559 }
5560 // false or null will remove the attribute but undefined will not
5561 if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
5562 elm.setAttribute('multiple', 'multiple');
5563 }
5564 return elm
5565}
5566
5567function createElementNS (namespace, tagName) {
5568 return document.createElementNS(namespaceMap[namespace], tagName)
5569}
5570
5571function createTextNode (text) {
5572 return document.createTextNode(text)
5573}
5574
5575function createComment (text) {
5576 return document.createComment(text)
5577}
5578
5579function insertBefore (parentNode, newNode, referenceNode) {
5580 parentNode.insertBefore(newNode, referenceNode);
5581}
5582
5583function removeChild (node, child) {
5584 node.removeChild(child);
5585}
5586
5587function appendChild (node, child) {
5588 node.appendChild(child);
5589}
5590
5591function parentNode (node) {
5592 return node.parentNode
5593}
5594
5595function nextSibling (node) {
5596 return node.nextSibling
5597}
5598
5599function tagName (node) {
5600 return node.tagName
5601}
5602
5603function setTextContent (node, text) {
5604 node.textContent = text;
5605}
5606
5607function setStyleScope (node, scopeId) {
5608 node.setAttribute(scopeId, '');
5609}
5610
5611var nodeOps = /*#__PURE__*/Object.freeze({
5612 createElement: createElement$1,
5613 createElementNS: createElementNS,
5614 createTextNode: createTextNode,
5615 createComment: createComment,
5616 insertBefore: insertBefore,
5617 removeChild: removeChild,
5618 appendChild: appendChild,
5619 parentNode: parentNode,
5620 nextSibling: nextSibling,
5621 tagName: tagName,
5622 setTextContent: setTextContent,
5623 setStyleScope: setStyleScope
5624});
5625
5626/* */
5627
5628var ref = {
5629 create: function create (_, vnode) {
5630 registerRef(vnode);
5631 },
5632 update: function update (oldVnode, vnode) {
5633 if (oldVnode.data.ref !== vnode.data.ref) {
5634 registerRef(oldVnode, true);
5635 registerRef(vnode);
5636 }
5637 },
5638 destroy: function destroy (vnode) {
5639 registerRef(vnode, true);
5640 }
5641};
5642
5643function registerRef (vnode, isRemoval) {
5644 var key = vnode.data.ref;
5645 if (!isDef(key)) { return }
5646
5647 var vm = vnode.context;
5648 var ref = vnode.componentInstance || vnode.elm;
5649 var refs = vm.$refs;
5650 if (isRemoval) {
5651 if (Array.isArray(refs[key])) {
5652 remove(refs[key], ref);
5653 } else if (refs[key] === ref) {
5654 refs[key] = undefined;
5655 }
5656 } else {
5657 if (vnode.data.refInFor) {
5658 if (!Array.isArray(refs[key])) {
5659 refs[key] = [ref];
5660 } else if (refs[key].indexOf(ref) < 0) {
5661 // $flow-disable-line
5662 refs[key].push(ref);
5663 }
5664 } else {
5665 refs[key] = ref;
5666 }
5667 }
5668}
5669
5670/**
5671 * Virtual DOM patching algorithm based on Snabbdom by
5672 * Simon Friis Vindum (@paldepind)
5673 * Licensed under the MIT License
5674 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
5675 *
5676 * modified by Evan You (@yyx990803)
5677 *
5678 * Not type-checking this because this file is perf-critical and the cost
5679 * of making flow understand it is not worth it.
5680 */
5681
5682var emptyNode = new VNode('', {}, []);
5683
5684var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
5685
5686function sameVnode (a, b) {
5687 return (
5688 a.key === b.key && (
5689 (
5690 a.tag === b.tag &&
5691 a.isComment === b.isComment &&
5692 isDef(a.data) === isDef(b.data) &&
5693 sameInputType(a, b)
5694 ) || (
5695 isTrue(a.isAsyncPlaceholder) &&
5696 a.asyncFactory === b.asyncFactory &&
5697 isUndef(b.asyncFactory.error)
5698 )
5699 )
5700 )
5701}
5702
5703function sameInputType (a, b) {
5704 if (a.tag !== 'input') { return true }
5705 var i;
5706 var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
5707 var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
5708 return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
5709}
5710
5711function createKeyToOldIdx (children, beginIdx, endIdx) {
5712 var i, key;
5713 var map = {};
5714 for (i = beginIdx; i <= endIdx; ++i) {
5715 key = children[i].key;
5716 if (isDef(key)) { map[key] = i; }
5717 }
5718 return map
5719}
5720
5721function createPatchFunction (backend) {
5722 var i, j;
5723 var cbs = {};
5724
5725 var modules = backend.modules;
5726 var nodeOps = backend.nodeOps;
5727
5728 for (i = 0; i < hooks.length; ++i) {
5729 cbs[hooks[i]] = [];
5730 for (j = 0; j < modules.length; ++j) {
5731 if (isDef(modules[j][hooks[i]])) {
5732 cbs[hooks[i]].push(modules[j][hooks[i]]);
5733 }
5734 }
5735 }
5736
5737 function emptyNodeAt (elm) {
5738 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
5739 }
5740
5741 function createRmCb (childElm, listeners) {
5742 function remove$$1 () {
5743 if (--remove$$1.listeners === 0) {
5744 removeNode(childElm);
5745 }
5746 }
5747 remove$$1.listeners = listeners;
5748 return remove$$1
5749 }
5750
5751 function removeNode (el) {
5752 var parent = nodeOps.parentNode(el);
5753 // element may have already been removed due to v-html / v-text
5754 if (isDef(parent)) {
5755 nodeOps.removeChild(parent, el);
5756 }
5757 }
5758
5759 function isUnknownElement$$1 (vnode, inVPre) {
5760 return (
5761 !inVPre &&
5762 !vnode.ns &&
5763 !(
5764 config.ignoredElements.length &&
5765 config.ignoredElements.some(function (ignore) {
5766 return isRegExp(ignore)
5767 ? ignore.test(vnode.tag)
5768 : ignore === vnode.tag
5769 })
5770 ) &&
5771 config.isUnknownElement(vnode.tag)
5772 )
5773 }
5774
5775 var creatingElmInVPre = 0;
5776
5777 function createElm (
5778 vnode,
5779 insertedVnodeQueue,
5780 parentElm,
5781 refElm,
5782 nested,
5783 ownerArray,
5784 index
5785 ) {
5786 if (isDef(vnode.elm) && isDef(ownerArray)) {
5787 // This vnode was used in a previous render!
5788 // now it's used as a new node, overwriting its elm would cause
5789 // potential patch errors down the road when it's used as an insertion
5790 // reference node. Instead, we clone the node on-demand before creating
5791 // associated DOM element for it.
5792 vnode = ownerArray[index] = cloneVNode(vnode);
5793 }
5794
5795 vnode.isRootInsert = !nested; // for transition enter check
5796 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
5797 return
5798 }
5799
5800 var data = vnode.data;
5801 var children = vnode.children;
5802 var tag = vnode.tag;
5803 if (isDef(tag)) {
5804 {
5805 if (data && data.pre) {
5806 creatingElmInVPre++;
5807 }
5808 if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
5809 warn(
5810 'Unknown custom element: <' + tag + '> - did you ' +
5811 'register the component correctly? For recursive components, ' +
5812 'make sure to provide the "name" option.',
5813 vnode.context
5814 );
5815 }
5816 }
5817
5818 vnode.elm = vnode.ns
5819 ? nodeOps.createElementNS(vnode.ns, tag)
5820 : nodeOps.createElement(tag, vnode);
5821 setScope(vnode);
5822
5823 /* istanbul ignore if */
5824 {
5825 createChildren(vnode, children, insertedVnodeQueue);
5826 if (isDef(data)) {
5827 invokeCreateHooks(vnode, insertedVnodeQueue);
5828 }
5829 insert(parentElm, vnode.elm, refElm);
5830 }
5831
5832 if (data && data.pre) {
5833 creatingElmInVPre--;
5834 }
5835 } else if (isTrue(vnode.isComment)) {
5836 vnode.elm = nodeOps.createComment(vnode.text);
5837 insert(parentElm, vnode.elm, refElm);
5838 } else {
5839 vnode.elm = nodeOps.createTextNode(vnode.text);
5840 insert(parentElm, vnode.elm, refElm);
5841 }
5842 }
5843
5844 function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5845 var i = vnode.data;
5846 if (isDef(i)) {
5847 var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
5848 if (isDef(i = i.hook) && isDef(i = i.init)) {
5849 i(vnode, false /* hydrating */);
5850 }
5851 // after calling the init hook, if the vnode is a child component
5852 // it should've created a child instance and mounted it. the child
5853 // component also has set the placeholder vnode's elm.
5854 // in that case we can just return the element and be done.
5855 if (isDef(vnode.componentInstance)) {
5856 initComponent(vnode, insertedVnodeQueue);
5857 insert(parentElm, vnode.elm, refElm);
5858 if (isTrue(isReactivated)) {
5859 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
5860 }
5861 return true
5862 }
5863 }
5864 }
5865
5866 function initComponent (vnode, insertedVnodeQueue) {
5867 if (isDef(vnode.data.pendingInsert)) {
5868 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
5869 vnode.data.pendingInsert = null;
5870 }
5871 vnode.elm = vnode.componentInstance.$el;
5872 if (isPatchable(vnode)) {
5873 invokeCreateHooks(vnode, insertedVnodeQueue);
5874 setScope(vnode);
5875 } else {
5876 // empty component root.
5877 // skip all element-related modules except for ref (#3455)
5878 registerRef(vnode);
5879 // make sure to invoke the insert hook
5880 insertedVnodeQueue.push(vnode);
5881 }
5882 }
5883
5884 function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5885 var i;
5886 // hack for #4339: a reactivated component with inner transition
5887 // does not trigger because the inner node's created hooks are not called
5888 // again. It's not ideal to involve module-specific logic in here but
5889 // there doesn't seem to be a better way to do it.
5890 var innerNode = vnode;
5891 while (innerNode.componentInstance) {
5892 innerNode = innerNode.componentInstance._vnode;
5893 if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
5894 for (i = 0; i < cbs.activate.length; ++i) {
5895 cbs.activate[i](emptyNode, innerNode);
5896 }
5897 insertedVnodeQueue.push(innerNode);
5898 break
5899 }
5900 }
5901 // unlike a newly created component,
5902 // a reactivated keep-alive component doesn't insert itself
5903 insert(parentElm, vnode.elm, refElm);
5904 }
5905
5906 function insert (parent, elm, ref$$1) {
5907 if (isDef(parent)) {
5908 if (isDef(ref$$1)) {
5909 if (nodeOps.parentNode(ref$$1) === parent) {
5910 nodeOps.insertBefore(parent, elm, ref$$1);
5911 }
5912 } else {
5913 nodeOps.appendChild(parent, elm);
5914 }
5915 }
5916 }
5917
5918 function createChildren (vnode, children, insertedVnodeQueue) {
5919 if (Array.isArray(children)) {
5920 {
5921 checkDuplicateKeys(children);
5922 }
5923 for (var i = 0; i < children.length; ++i) {
5924 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
5925 }
5926 } else if (isPrimitive(vnode.text)) {
5927 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
5928 }
5929 }
5930
5931 function isPatchable (vnode) {
5932 while (vnode.componentInstance) {
5933 vnode = vnode.componentInstance._vnode;
5934 }
5935 return isDef(vnode.tag)
5936 }
5937
5938 function invokeCreateHooks (vnode, insertedVnodeQueue) {
5939 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
5940 cbs.create[i$1](emptyNode, vnode);
5941 }
5942 i = vnode.data.hook; // Reuse variable
5943 if (isDef(i)) {
5944 if (isDef(i.create)) { i.create(emptyNode, vnode); }
5945 if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
5946 }
5947 }
5948
5949 // set scope id attribute for scoped CSS.
5950 // this is implemented as a special case to avoid the overhead
5951 // of going through the normal attribute patching process.
5952 function setScope (vnode) {
5953 var i;
5954 if (isDef(i = vnode.fnScopeId)) {
5955 nodeOps.setStyleScope(vnode.elm, i);
5956 } else {
5957 var ancestor = vnode;
5958 while (ancestor) {
5959 if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
5960 nodeOps.setStyleScope(vnode.elm, i);
5961 }
5962 ancestor = ancestor.parent;
5963 }
5964 }
5965 // for slot content they should also get the scopeId from the host instance.
5966 if (isDef(i = activeInstance) &&
5967 i !== vnode.context &&
5968 i !== vnode.fnContext &&
5969 isDef(i = i.$options._scopeId)
5970 ) {
5971 nodeOps.setStyleScope(vnode.elm, i);
5972 }
5973 }
5974
5975 function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
5976 for (; startIdx <= endIdx; ++startIdx) {
5977 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
5978 }
5979 }
5980
5981 function invokeDestroyHook (vnode) {
5982 var i, j;
5983 var data = vnode.data;
5984 if (isDef(data)) {
5985 if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
5986 for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
5987 }
5988 if (isDef(i = vnode.children)) {
5989 for (j = 0; j < vnode.children.length; ++j) {
5990 invokeDestroyHook(vnode.children[j]);
5991 }
5992 }
5993 }
5994
5995 function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
5996 for (; startIdx <= endIdx; ++startIdx) {
5997 var ch = vnodes[startIdx];
5998 if (isDef(ch)) {
5999 if (isDef(ch.tag)) {
6000 removeAndInvokeRemoveHook(ch);
6001 invokeDestroyHook(ch);
6002 } else { // Text node
6003 removeNode(ch.elm);
6004 }
6005 }
6006 }
6007 }
6008
6009 function removeAndInvokeRemoveHook (vnode, rm) {
6010 if (isDef(rm) || isDef(vnode.data)) {
6011 var i;
6012 var listeners = cbs.remove.length + 1;
6013 if (isDef(rm)) {
6014 // we have a recursively passed down rm callback
6015 // increase the listeners count
6016 rm.listeners += listeners;
6017 } else {
6018 // directly removing
6019 rm = createRmCb(vnode.elm, listeners);
6020 }
6021 // recursively invoke hooks on child component root node
6022 if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
6023 removeAndInvokeRemoveHook(i, rm);
6024 }
6025 for (i = 0; i < cbs.remove.length; ++i) {
6026 cbs.remove[i](vnode, rm);
6027 }
6028 if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
6029 i(vnode, rm);
6030 } else {
6031 rm();
6032 }
6033 } else {
6034 removeNode(vnode.elm);
6035 }
6036 }
6037
6038 function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
6039 var oldStartIdx = 0;
6040 var newStartIdx = 0;
6041 var oldEndIdx = oldCh.length - 1;
6042 var oldStartVnode = oldCh[0];
6043 var oldEndVnode = oldCh[oldEndIdx];
6044 var newEndIdx = newCh.length - 1;
6045 var newStartVnode = newCh[0];
6046 var newEndVnode = newCh[newEndIdx];
6047 var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
6048
6049 // removeOnly is a special flag used only by <transition-group>
6050 // to ensure removed elements stay in correct relative positions
6051 // during leaving transitions
6052 var canMove = !removeOnly;
6053
6054 {
6055 checkDuplicateKeys(newCh);
6056 }
6057
6058 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
6059 if (isUndef(oldStartVnode)) {
6060 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
6061 } else if (isUndef(oldEndVnode)) {
6062 oldEndVnode = oldCh[--oldEndIdx];
6063 } else if (sameVnode(oldStartVnode, newStartVnode)) {
6064 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6065 oldStartVnode = oldCh[++oldStartIdx];
6066 newStartVnode = newCh[++newStartIdx];
6067 } else if (sameVnode(oldEndVnode, newEndVnode)) {
6068 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6069 oldEndVnode = oldCh[--oldEndIdx];
6070 newEndVnode = newCh[--newEndIdx];
6071 } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
6072 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6073 canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
6074 oldStartVnode = oldCh[++oldStartIdx];
6075 newEndVnode = newCh[--newEndIdx];
6076 } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
6077 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6078 canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
6079 oldEndVnode = oldCh[--oldEndIdx];
6080 newStartVnode = newCh[++newStartIdx];
6081 } else {
6082 if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
6083 idxInOld = isDef(newStartVnode.key)
6084 ? oldKeyToIdx[newStartVnode.key]
6085 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
6086 if (isUndef(idxInOld)) { // New element
6087 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6088 } else {
6089 vnodeToMove = oldCh[idxInOld];
6090 if (sameVnode(vnodeToMove, newStartVnode)) {
6091 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6092 oldCh[idxInOld] = undefined;
6093 canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
6094 } else {
6095 // same key but different element. treat as new element
6096 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6097 }
6098 }
6099 newStartVnode = newCh[++newStartIdx];
6100 }
6101 }
6102 if (oldStartIdx > oldEndIdx) {
6103 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6104 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6105 } else if (newStartIdx > newEndIdx) {
6106 removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6107 }
6108 }
6109
6110 function checkDuplicateKeys (children) {
6111 var seenKeys = {};
6112 for (var i = 0; i < children.length; i++) {
6113 var vnode = children[i];
6114 var key = vnode.key;
6115 if (isDef(key)) {
6116 if (seenKeys[key]) {
6117 warn(
6118 ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
6119 vnode.context
6120 );
6121 } else {
6122 seenKeys[key] = true;
6123 }
6124 }
6125 }
6126 }
6127
6128 function findIdxInOld (node, oldCh, start, end) {
6129 for (var i = start; i < end; i++) {
6130 var c = oldCh[i];
6131 if (isDef(c) && sameVnode(node, c)) { return i }
6132 }
6133 }
6134
6135 function patchVnode (
6136 oldVnode,
6137 vnode,
6138 insertedVnodeQueue,
6139 ownerArray,
6140 index,
6141 removeOnly
6142 ) {
6143 if (oldVnode === vnode) {
6144 return
6145 }
6146
6147 if (isDef(vnode.elm) && isDef(ownerArray)) {
6148 // clone reused vnode
6149 vnode = ownerArray[index] = cloneVNode(vnode);
6150 }
6151
6152 var elm = vnode.elm = oldVnode.elm;
6153
6154 if (isTrue(oldVnode.isAsyncPlaceholder)) {
6155 if (isDef(vnode.asyncFactory.resolved)) {
6156 hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6157 } else {
6158 vnode.isAsyncPlaceholder = true;
6159 }
6160 return
6161 }
6162
6163 // reuse element for static trees.
6164 // note we only do this if the vnode is cloned -
6165 // if the new node is not cloned it means the render functions have been
6166 // reset by the hot-reload-api and we need to do a proper re-render.
6167 if (isTrue(vnode.isStatic) &&
6168 isTrue(oldVnode.isStatic) &&
6169 vnode.key === oldVnode.key &&
6170 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
6171 ) {
6172 vnode.componentInstance = oldVnode.componentInstance;
6173 return
6174 }
6175
6176 var i;
6177 var data = vnode.data;
6178 if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
6179 i(oldVnode, vnode);
6180 }
6181
6182 var oldCh = oldVnode.children;
6183 var ch = vnode.children;
6184 if (isDef(data) && isPatchable(vnode)) {
6185 for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
6186 if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
6187 }
6188 if (isUndef(vnode.text)) {
6189 if (isDef(oldCh) && isDef(ch)) {
6190 if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
6191 } else if (isDef(ch)) {
6192 {
6193 checkDuplicateKeys(ch);
6194 }
6195 if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6196 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6197 } else if (isDef(oldCh)) {
6198 removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6199 } else if (isDef(oldVnode.text)) {
6200 nodeOps.setTextContent(elm, '');
6201 }
6202 } else if (oldVnode.text !== vnode.text) {
6203 nodeOps.setTextContent(elm, vnode.text);
6204 }
6205 if (isDef(data)) {
6206 if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
6207 }
6208 }
6209
6210 function invokeInsertHook (vnode, queue, initial) {
6211 // delay insert hooks for component root nodes, invoke them after the
6212 // element is really inserted
6213 if (isTrue(initial) && isDef(vnode.parent)) {
6214 vnode.parent.data.pendingInsert = queue;
6215 } else {
6216 for (var i = 0; i < queue.length; ++i) {
6217 queue[i].data.hook.insert(queue[i]);
6218 }
6219 }
6220 }
6221
6222 var hydrationBailed = false;
6223 // list of modules that can skip create hook during hydration because they
6224 // are already rendered on the client or has no need for initialization
6225 // Note: style is excluded because it relies on initial clone for future
6226 // deep updates (#7063).
6227 var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
6228
6229 // Note: this is a browser-only function so we can assume elms are DOM nodes.
6230 function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
6231 var i;
6232 var tag = vnode.tag;
6233 var data = vnode.data;
6234 var children = vnode.children;
6235 inVPre = inVPre || (data && data.pre);
6236 vnode.elm = elm;
6237
6238 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
6239 vnode.isAsyncPlaceholder = true;
6240 return true
6241 }
6242 // assert node match
6243 {
6244 if (!assertNodeMatch(elm, vnode, inVPre)) {
6245 return false
6246 }
6247 }
6248 if (isDef(data)) {
6249 if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
6250 if (isDef(i = vnode.componentInstance)) {
6251 // child component. it should have hydrated its own tree.
6252 initComponent(vnode, insertedVnodeQueue);
6253 return true
6254 }
6255 }
6256 if (isDef(tag)) {
6257 if (isDef(children)) {
6258 // empty element, allow client to pick up and populate children
6259 if (!elm.hasChildNodes()) {
6260 createChildren(vnode, children, insertedVnodeQueue);
6261 } else {
6262 // v-html and domProps: innerHTML
6263 if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
6264 if (i !== elm.innerHTML) {
6265 /* istanbul ignore if */
6266 if (typeof console !== 'undefined' &&
6267 !hydrationBailed
6268 ) {
6269 hydrationBailed = true;
6270 console.warn('Parent: ', elm);
6271 console.warn('server innerHTML: ', i);
6272 console.warn('client innerHTML: ', elm.innerHTML);
6273 }
6274 return false
6275 }
6276 } else {
6277 // iterate and compare children lists
6278 var childrenMatch = true;
6279 var childNode = elm.firstChild;
6280 for (var i$1 = 0; i$1 < children.length; i$1++) {
6281 if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
6282 childrenMatch = false;
6283 break
6284 }
6285 childNode = childNode.nextSibling;
6286 }
6287 // if childNode is not null, it means the actual childNodes list is
6288 // longer than the virtual children list.
6289 if (!childrenMatch || childNode) {
6290 /* istanbul ignore if */
6291 if (typeof console !== 'undefined' &&
6292 !hydrationBailed
6293 ) {
6294 hydrationBailed = true;
6295 console.warn('Parent: ', elm);
6296 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
6297 }
6298 return false
6299 }
6300 }
6301 }
6302 }
6303 if (isDef(data)) {
6304 var fullInvoke = false;
6305 for (var key in data) {
6306 if (!isRenderedModule(key)) {
6307 fullInvoke = true;
6308 invokeCreateHooks(vnode, insertedVnodeQueue);
6309 break
6310 }
6311 }
6312 if (!fullInvoke && data['class']) {
6313 // ensure collecting deps for deep class bindings for future updates
6314 traverse(data['class']);
6315 }
6316 }
6317 } else if (elm.data !== vnode.text) {
6318 elm.data = vnode.text;
6319 }
6320 return true
6321 }
6322
6323 function assertNodeMatch (node, vnode, inVPre) {
6324 if (isDef(vnode.tag)) {
6325 return vnode.tag.indexOf('vue-component') === 0 || (
6326 !isUnknownElement$$1(vnode, inVPre) &&
6327 vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
6328 )
6329 } else {
6330 return node.nodeType === (vnode.isComment ? 8 : 3)
6331 }
6332 }
6333
6334 return function patch (oldVnode, vnode, hydrating, removeOnly) {
6335 if (isUndef(vnode)) {
6336 if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
6337 return
6338 }
6339
6340 var isInitialPatch = false;
6341 var insertedVnodeQueue = [];
6342
6343 if (isUndef(oldVnode)) {
6344 // empty mount (likely as component), create new root element
6345 isInitialPatch = true;
6346 createElm(vnode, insertedVnodeQueue);
6347 } else {
6348 var isRealElement = isDef(oldVnode.nodeType);
6349 if (!isRealElement && sameVnode(oldVnode, vnode)) {
6350 // patch existing root node
6351 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
6352 } else {
6353 if (isRealElement) {
6354 // mounting to a real element
6355 // check if this is server-rendered content and if we can perform
6356 // a successful hydration.
6357 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
6358 oldVnode.removeAttribute(SSR_ATTR);
6359 hydrating = true;
6360 }
6361 if (isTrue(hydrating)) {
6362 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
6363 invokeInsertHook(vnode, insertedVnodeQueue, true);
6364 return oldVnode
6365 } else {
6366 warn(
6367 'The client-side rendered virtual DOM tree is not matching ' +
6368 'server-rendered content. This is likely caused by incorrect ' +
6369 'HTML markup, for example nesting block-level elements inside ' +
6370 '<p>, or missing <tbody>. Bailing hydration and performing ' +
6371 'full client-side render.'
6372 );
6373 }
6374 }
6375 // either not server-rendered, or hydration failed.
6376 // create an empty node and replace it
6377 oldVnode = emptyNodeAt(oldVnode);
6378 }
6379
6380 // replacing existing element
6381 var oldElm = oldVnode.elm;
6382 var parentElm = nodeOps.parentNode(oldElm);
6383
6384 // create new node
6385 createElm(
6386 vnode,
6387 insertedVnodeQueue,
6388 // extremely rare edge case: do not insert if old element is in a
6389 // leaving transition. Only happens when combining transition +
6390 // keep-alive + HOCs. (#4590)
6391 oldElm._leaveCb ? null : parentElm,
6392 nodeOps.nextSibling(oldElm)
6393 );
6394
6395 // update parent placeholder node element, recursively
6396 if (isDef(vnode.parent)) {
6397 var ancestor = vnode.parent;
6398 var patchable = isPatchable(vnode);
6399 while (ancestor) {
6400 for (var i = 0; i < cbs.destroy.length; ++i) {
6401 cbs.destroy[i](ancestor);
6402 }
6403 ancestor.elm = vnode.elm;
6404 if (patchable) {
6405 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6406 cbs.create[i$1](emptyNode, ancestor);
6407 }
6408 // #6513
6409 // invoke insert hooks that may have been merged by create hooks.
6410 // e.g. for directives that uses the "inserted" hook.
6411 var insert = ancestor.data.hook.insert;
6412 if (insert.merged) {
6413 // start at index 1 to avoid re-invoking component mounted hook
6414 for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
6415 insert.fns[i$2]();
6416 }
6417 }
6418 } else {
6419 registerRef(ancestor);
6420 }
6421 ancestor = ancestor.parent;
6422 }
6423 }
6424
6425 // destroy old node
6426 if (isDef(parentElm)) {
6427 removeVnodes(parentElm, [oldVnode], 0, 0);
6428 } else if (isDef(oldVnode.tag)) {
6429 invokeDestroyHook(oldVnode);
6430 }
6431 }
6432 }
6433
6434 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
6435 return vnode.elm
6436 }
6437}
6438
6439/* */
6440
6441var directives = {
6442 create: updateDirectives,
6443 update: updateDirectives,
6444 destroy: function unbindDirectives (vnode) {
6445 updateDirectives(vnode, emptyNode);
6446 }
6447};
6448
6449function updateDirectives (oldVnode, vnode) {
6450 if (oldVnode.data.directives || vnode.data.directives) {
6451 _update(oldVnode, vnode);
6452 }
6453}
6454
6455function _update (oldVnode, vnode) {
6456 var isCreate = oldVnode === emptyNode;
6457 var isDestroy = vnode === emptyNode;
6458 var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
6459 var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
6460
6461 var dirsWithInsert = [];
6462 var dirsWithPostpatch = [];
6463
6464 var key, oldDir, dir;
6465 for (key in newDirs) {
6466 oldDir = oldDirs[key];
6467 dir = newDirs[key];
6468 if (!oldDir) {
6469 // new directive, bind
6470 callHook$1(dir, 'bind', vnode, oldVnode);
6471 if (dir.def && dir.def.inserted) {
6472 dirsWithInsert.push(dir);
6473 }
6474 } else {
6475 // existing directive, update
6476 dir.oldValue = oldDir.value;
6477 dir.oldArg = oldDir.arg;
6478 callHook$1(dir, 'update', vnode, oldVnode);
6479 if (dir.def && dir.def.componentUpdated) {
6480 dirsWithPostpatch.push(dir);
6481 }
6482 }
6483 }
6484
6485 if (dirsWithInsert.length) {
6486 var callInsert = function () {
6487 for (var i = 0; i < dirsWithInsert.length; i++) {
6488 callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
6489 }
6490 };
6491 if (isCreate) {
6492 mergeVNodeHook(vnode, 'insert', callInsert);
6493 } else {
6494 callInsert();
6495 }
6496 }
6497
6498 if (dirsWithPostpatch.length) {
6499 mergeVNodeHook(vnode, 'postpatch', function () {
6500 for (var i = 0; i < dirsWithPostpatch.length; i++) {
6501 callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
6502 }
6503 });
6504 }
6505
6506 if (!isCreate) {
6507 for (key in oldDirs) {
6508 if (!newDirs[key]) {
6509 // no longer present, unbind
6510 callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
6511 }
6512 }
6513 }
6514}
6515
6516var emptyModifiers = Object.create(null);
6517
6518function normalizeDirectives$1 (
6519 dirs,
6520 vm
6521) {
6522 var res = Object.create(null);
6523 if (!dirs) {
6524 // $flow-disable-line
6525 return res
6526 }
6527 var i, dir;
6528 for (i = 0; i < dirs.length; i++) {
6529 dir = dirs[i];
6530 if (!dir.modifiers) {
6531 // $flow-disable-line
6532 dir.modifiers = emptyModifiers;
6533 }
6534 res[getRawDirName(dir)] = dir;
6535 dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
6536 }
6537 // $flow-disable-line
6538 return res
6539}
6540
6541function getRawDirName (dir) {
6542 return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
6543}
6544
6545function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
6546 var fn = dir.def && dir.def[hook];
6547 if (fn) {
6548 try {
6549 fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
6550 } catch (e) {
6551 handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
6552 }
6553 }
6554}
6555
6556var baseModules = [
6557 ref,
6558 directives
6559];
6560
6561/* */
6562
6563function updateAttrs (oldVnode, vnode) {
6564 var opts = vnode.componentOptions;
6565 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
6566 return
6567 }
6568 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
6569 return
6570 }
6571 var key, cur, old;
6572 var elm = vnode.elm;
6573 var oldAttrs = oldVnode.data.attrs || {};
6574 var attrs = vnode.data.attrs || {};
6575 // clone observed objects, as the user probably wants to mutate it
6576 if (isDef(attrs.__ob__)) {
6577 attrs = vnode.data.attrs = extend({}, attrs);
6578 }
6579
6580 for (key in attrs) {
6581 cur = attrs[key];
6582 old = oldAttrs[key];
6583 if (old !== cur) {
6584 setAttr(elm, key, cur);
6585 }
6586 }
6587 // #4391: in IE9, setting type can reset value for input[type=radio]
6588 // #6666: IE/Edge forces progress value down to 1 before setting a max
6589 /* istanbul ignore if */
6590 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
6591 setAttr(elm, 'value', attrs.value);
6592 }
6593 for (key in oldAttrs) {
6594 if (isUndef(attrs[key])) {
6595 if (isXlink(key)) {
6596 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
6597 } else if (!isEnumeratedAttr(key)) {
6598 elm.removeAttribute(key);
6599 }
6600 }
6601 }
6602}
6603
6604function setAttr (el, key, value) {
6605 if (el.tagName.indexOf('-') > -1) {
6606 baseSetAttr(el, key, value);
6607 } else if (isBooleanAttr(key)) {
6608 // set attribute for blank value
6609 // e.g. <option disabled>Select one</option>
6610 if (isFalsyAttrValue(value)) {
6611 el.removeAttribute(key);
6612 } else {
6613 // technically allowfullscreen is a boolean attribute for <iframe>,
6614 // but Flash expects a value of "true" when used on <embed> tag
6615 value = key === 'allowfullscreen' && el.tagName === 'EMBED'
6616 ? 'true'
6617 : key;
6618 el.setAttribute(key, value);
6619 }
6620 } else if (isEnumeratedAttr(key)) {
6621 el.setAttribute(key, convertEnumeratedValue(key, value));
6622 } else if (isXlink(key)) {
6623 if (isFalsyAttrValue(value)) {
6624 el.removeAttributeNS(xlinkNS, getXlinkProp(key));
6625 } else {
6626 el.setAttributeNS(xlinkNS, key, value);
6627 }
6628 } else {
6629 baseSetAttr(el, key, value);
6630 }
6631}
6632
6633function baseSetAttr (el, key, value) {
6634 if (isFalsyAttrValue(value)) {
6635 el.removeAttribute(key);
6636 } else {
6637 // #7138: IE10 & 11 fires input event when setting placeholder on
6638 // <textarea>... block the first input event and remove the blocker
6639 // immediately.
6640 /* istanbul ignore if */
6641 if (
6642 isIE && !isIE9 &&
6643 (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT') &&
6644 key === 'placeholder' && !el.__ieph
6645 ) {
6646 var blocker = function (e) {
6647 e.stopImmediatePropagation();
6648 el.removeEventListener('input', blocker);
6649 };
6650 el.addEventListener('input', blocker);
6651 // $flow-disable-line
6652 el.__ieph = true; /* IE placeholder patched */
6653 }
6654 el.setAttribute(key, value);
6655 }
6656}
6657
6658var attrs = {
6659 create: updateAttrs,
6660 update: updateAttrs
6661};
6662
6663/* */
6664
6665function updateClass (oldVnode, vnode) {
6666 var el = vnode.elm;
6667 var data = vnode.data;
6668 var oldData = oldVnode.data;
6669 if (
6670 isUndef(data.staticClass) &&
6671 isUndef(data.class) && (
6672 isUndef(oldData) || (
6673 isUndef(oldData.staticClass) &&
6674 isUndef(oldData.class)
6675 )
6676 )
6677 ) {
6678 return
6679 }
6680
6681 var cls = genClassForVnode(vnode);
6682
6683 // handle transition classes
6684 var transitionClass = el._transitionClasses;
6685 if (isDef(transitionClass)) {
6686 cls = concat(cls, stringifyClass(transitionClass));
6687 }
6688
6689 // set the class
6690 if (cls !== el._prevClass) {
6691 el.setAttribute('class', cls);
6692 el._prevClass = cls;
6693 }
6694}
6695
6696var klass = {
6697 create: updateClass,
6698 update: updateClass
6699};
6700
6701/* */
6702
6703var validDivisionCharRE = /[\w).+\-_$\]]/;
6704
6705function parseFilters (exp) {
6706 var inSingle = false;
6707 var inDouble = false;
6708 var inTemplateString = false;
6709 var inRegex = false;
6710 var curly = 0;
6711 var square = 0;
6712 var paren = 0;
6713 var lastFilterIndex = 0;
6714 var c, prev, i, expression, filters;
6715
6716 for (i = 0; i < exp.length; i++) {
6717 prev = c;
6718 c = exp.charCodeAt(i);
6719 if (inSingle) {
6720 if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
6721 } else if (inDouble) {
6722 if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
6723 } else if (inTemplateString) {
6724 if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
6725 } else if (inRegex) {
6726 if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
6727 } else if (
6728 c === 0x7C && // pipe
6729 exp.charCodeAt(i + 1) !== 0x7C &&
6730 exp.charCodeAt(i - 1) !== 0x7C &&
6731 !curly && !square && !paren
6732 ) {
6733 if (expression === undefined) {
6734 // first filter, end of expression
6735 lastFilterIndex = i + 1;
6736 expression = exp.slice(0, i).trim();
6737 } else {
6738 pushFilter();
6739 }
6740 } else {
6741 switch (c) {
6742 case 0x22: inDouble = true; break // "
6743 case 0x27: inSingle = true; break // '
6744 case 0x60: inTemplateString = true; break // `
6745 case 0x28: paren++; break // (
6746 case 0x29: paren--; break // )
6747 case 0x5B: square++; break // [
6748 case 0x5D: square--; break // ]
6749 case 0x7B: curly++; break // {
6750 case 0x7D: curly--; break // }
6751 }
6752 if (c === 0x2f) { // /
6753 var j = i - 1;
6754 var p = (void 0);
6755 // find first non-whitespace prev char
6756 for (; j >= 0; j--) {
6757 p = exp.charAt(j);
6758 if (p !== ' ') { break }
6759 }
6760 if (!p || !validDivisionCharRE.test(p)) {
6761 inRegex = true;
6762 }
6763 }
6764 }
6765 }
6766
6767 if (expression === undefined) {
6768 expression = exp.slice(0, i).trim();
6769 } else if (lastFilterIndex !== 0) {
6770 pushFilter();
6771 }
6772
6773 function pushFilter () {
6774 (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
6775 lastFilterIndex = i + 1;
6776 }
6777
6778 if (filters) {
6779 for (i = 0; i < filters.length; i++) {
6780 expression = wrapFilter(expression, filters[i]);
6781 }
6782 }
6783
6784 return expression
6785}
6786
6787function wrapFilter (exp, filter) {
6788 var i = filter.indexOf('(');
6789 if (i < 0) {
6790 // _f: resolveFilter
6791 return ("_f(\"" + filter + "\")(" + exp + ")")
6792 } else {
6793 var name = filter.slice(0, i);
6794 var args = filter.slice(i + 1);
6795 return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
6796 }
6797}
6798
6799/* */
6800
6801
6802
6803/* eslint-disable no-unused-vars */
6804function baseWarn (msg, range) {
6805 console.error(("[Vue compiler]: " + msg));
6806}
6807/* eslint-enable no-unused-vars */
6808
6809function pluckModuleFunction (
6810 modules,
6811 key
6812) {
6813 return modules
6814 ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
6815 : []
6816}
6817
6818function addProp (el, name, value, range, dynamic) {
6819 (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
6820 el.plain = false;
6821}
6822
6823function addAttr (el, name, value, range, dynamic) {
6824 var attrs = dynamic
6825 ? (el.dynamicAttrs || (el.dynamicAttrs = []))
6826 : (el.attrs || (el.attrs = []));
6827 attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
6828 el.plain = false;
6829}
6830
6831// add a raw attr (use this in preTransforms)
6832function addRawAttr (el, name, value, range) {
6833 el.attrsMap[name] = value;
6834 el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
6835}
6836
6837function addDirective (
6838 el,
6839 name,
6840 rawName,
6841 value,
6842 arg,
6843 isDynamicArg,
6844 modifiers,
6845 range
6846) {
6847 (el.directives || (el.directives = [])).push(rangeSetItem({
6848 name: name,
6849 rawName: rawName,
6850 value: value,
6851 arg: arg,
6852 isDynamicArg: isDynamicArg,
6853 modifiers: modifiers
6854 }, range));
6855 el.plain = false;
6856}
6857
6858function prependModifierMarker (symbol, name, dynamic) {
6859 return dynamic
6860 ? ("_p(" + name + ",\"" + symbol + "\")")
6861 : symbol + name // mark the event as captured
6862}
6863
6864function addHandler (
6865 el,
6866 name,
6867 value,
6868 modifiers,
6869 important,
6870 warn,
6871 range,
6872 dynamic
6873) {
6874 modifiers = modifiers || emptyObject;
6875 // warn prevent and passive modifier
6876 /* istanbul ignore if */
6877 if (
6878 warn &&
6879 modifiers.prevent && modifiers.passive
6880 ) {
6881 warn(
6882 'passive and prevent can\'t be used together. ' +
6883 'Passive handler can\'t prevent default event.',
6884 range
6885 );
6886 }
6887
6888 // normalize click.right and click.middle since they don't actually fire
6889 // this is technically browser-specific, but at least for now browsers are
6890 // the only target envs that have right/middle clicks.
6891 if (modifiers.right) {
6892 if (dynamic) {
6893 name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
6894 } else if (name === 'click') {
6895 name = 'contextmenu';
6896 delete modifiers.right;
6897 }
6898 } else if (modifiers.middle) {
6899 if (dynamic) {
6900 name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
6901 } else if (name === 'click') {
6902 name = 'mouseup';
6903 }
6904 }
6905
6906 // check capture modifier
6907 if (modifiers.capture) {
6908 delete modifiers.capture;
6909 name = prependModifierMarker('!', name, dynamic);
6910 }
6911 if (modifiers.once) {
6912 delete modifiers.once;
6913 name = prependModifierMarker('~', name, dynamic);
6914 }
6915 /* istanbul ignore if */
6916 if (modifiers.passive) {
6917 delete modifiers.passive;
6918 name = prependModifierMarker('&', name, dynamic);
6919 }
6920
6921 var events;
6922 if (modifiers.native) {
6923 delete modifiers.native;
6924 events = el.nativeEvents || (el.nativeEvents = {});
6925 } else {
6926 events = el.events || (el.events = {});
6927 }
6928
6929 var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
6930 if (modifiers !== emptyObject) {
6931 newHandler.modifiers = modifiers;
6932 }
6933
6934 var handlers = events[name];
6935 /* istanbul ignore if */
6936 if (Array.isArray(handlers)) {
6937 important ? handlers.unshift(newHandler) : handlers.push(newHandler);
6938 } else if (handlers) {
6939 events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
6940 } else {
6941 events[name] = newHandler;
6942 }
6943
6944 el.plain = false;
6945}
6946
6947function getRawBindingAttr (
6948 el,
6949 name
6950) {
6951 return el.rawAttrsMap[':' + name] ||
6952 el.rawAttrsMap['v-bind:' + name] ||
6953 el.rawAttrsMap[name]
6954}
6955
6956function getBindingAttr (
6957 el,
6958 name,
6959 getStatic
6960) {
6961 var dynamicValue =
6962 getAndRemoveAttr(el, ':' + name) ||
6963 getAndRemoveAttr(el, 'v-bind:' + name);
6964 if (dynamicValue != null) {
6965 return parseFilters(dynamicValue)
6966 } else if (getStatic !== false) {
6967 var staticValue = getAndRemoveAttr(el, name);
6968 if (staticValue != null) {
6969 return JSON.stringify(staticValue)
6970 }
6971 }
6972}
6973
6974// note: this only removes the attr from the Array (attrsList) so that it
6975// doesn't get processed by processAttrs.
6976// By default it does NOT remove it from the map (attrsMap) because the map is
6977// needed during codegen.
6978function getAndRemoveAttr (
6979 el,
6980 name,
6981 removeFromMap
6982) {
6983 var val;
6984 if ((val = el.attrsMap[name]) != null) {
6985 var list = el.attrsList;
6986 for (var i = 0, l = list.length; i < l; i++) {
6987 if (list[i].name === name) {
6988 list.splice(i, 1);
6989 break
6990 }
6991 }
6992 }
6993 if (removeFromMap) {
6994 delete el.attrsMap[name];
6995 }
6996 return val
6997}
6998
6999function getAndRemoveAttrByRegex (
7000 el,
7001 name
7002) {
7003 var list = el.attrsList;
7004 for (var i = 0, l = list.length; i < l; i++) {
7005 var attr = list[i];
7006 if (name.test(attr.name)) {
7007 list.splice(i, 1);
7008 return attr
7009 }
7010 }
7011}
7012
7013function rangeSetItem (
7014 item,
7015 range
7016) {
7017 if (range) {
7018 if (range.start != null) {
7019 item.start = range.start;
7020 }
7021 if (range.end != null) {
7022 item.end = range.end;
7023 }
7024 }
7025 return item
7026}
7027
7028/* */
7029
7030/**
7031 * Cross-platform code generation for component v-model
7032 */
7033function genComponentModel (
7034 el,
7035 value,
7036 modifiers
7037) {
7038 var ref = modifiers || {};
7039 var number = ref.number;
7040 var trim = ref.trim;
7041
7042 var baseValueExpression = '$$v';
7043 var valueExpression = baseValueExpression;
7044 if (trim) {
7045 valueExpression =
7046 "(typeof " + baseValueExpression + " === 'string'" +
7047 "? " + baseValueExpression + ".trim()" +
7048 ": " + baseValueExpression + ")";
7049 }
7050 if (number) {
7051 valueExpression = "_n(" + valueExpression + ")";
7052 }
7053 var assignment = genAssignmentCode(value, valueExpression);
7054
7055 el.model = {
7056 value: ("(" + value + ")"),
7057 expression: JSON.stringify(value),
7058 callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
7059 };
7060}
7061
7062/**
7063 * Cross-platform codegen helper for generating v-model value assignment code.
7064 */
7065function genAssignmentCode (
7066 value,
7067 assignment
7068) {
7069 var res = parseModel(value);
7070 if (res.key === null) {
7071 return (value + "=" + assignment)
7072 } else {
7073 return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
7074 }
7075}
7076
7077/**
7078 * Parse a v-model expression into a base path and a final key segment.
7079 * Handles both dot-path and possible square brackets.
7080 *
7081 * Possible cases:
7082 *
7083 * - test
7084 * - test[key]
7085 * - test[test1[key]]
7086 * - test["a"][key]
7087 * - xxx.test[a[a].test1[key]]
7088 * - test.xxx.a["asa"][test1[key]]
7089 *
7090 */
7091
7092var len, str, chr, index$1, expressionPos, expressionEndPos;
7093
7094
7095
7096function parseModel (val) {
7097 // Fix https://github.com/vuejs/vue/pull/7730
7098 // allow v-model="obj.val " (trailing whitespace)
7099 val = val.trim();
7100 len = val.length;
7101
7102 if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
7103 index$1 = val.lastIndexOf('.');
7104 if (index$1 > -1) {
7105 return {
7106 exp: val.slice(0, index$1),
7107 key: '"' + val.slice(index$1 + 1) + '"'
7108 }
7109 } else {
7110 return {
7111 exp: val,
7112 key: null
7113 }
7114 }
7115 }
7116
7117 str = val;
7118 index$1 = expressionPos = expressionEndPos = 0;
7119
7120 while (!eof()) {
7121 chr = next();
7122 /* istanbul ignore if */
7123 if (isStringStart(chr)) {
7124 parseString(chr);
7125 } else if (chr === 0x5B) {
7126 parseBracket(chr);
7127 }
7128 }
7129
7130 return {
7131 exp: val.slice(0, expressionPos),
7132 key: val.slice(expressionPos + 1, expressionEndPos)
7133 }
7134}
7135
7136function next () {
7137 return str.charCodeAt(++index$1)
7138}
7139
7140function eof () {
7141 return index$1 >= len
7142}
7143
7144function isStringStart (chr) {
7145 return chr === 0x22 || chr === 0x27
7146}
7147
7148function parseBracket (chr) {
7149 var inBracket = 1;
7150 expressionPos = index$1;
7151 while (!eof()) {
7152 chr = next();
7153 if (isStringStart(chr)) {
7154 parseString(chr);
7155 continue
7156 }
7157 if (chr === 0x5B) { inBracket++; }
7158 if (chr === 0x5D) { inBracket--; }
7159 if (inBracket === 0) {
7160 expressionEndPos = index$1;
7161 break
7162 }
7163 }
7164}
7165
7166function parseString (chr) {
7167 var stringQuote = chr;
7168 while (!eof()) {
7169 chr = next();
7170 if (chr === stringQuote) {
7171 break
7172 }
7173 }
7174}
7175
7176/* */
7177
7178var warn$1;
7179
7180// in some cases, the event used has to be determined at runtime
7181// so we used some reserved tokens during compile.
7182var RANGE_TOKEN = '__r';
7183var CHECKBOX_RADIO_TOKEN = '__c';
7184
7185function model (
7186 el,
7187 dir,
7188 _warn
7189) {
7190 warn$1 = _warn;
7191 var value = dir.value;
7192 var modifiers = dir.modifiers;
7193 var tag = el.tag;
7194 var type = el.attrsMap.type;
7195
7196 {
7197 // inputs with type="file" are read only and setting the input's
7198 // value will throw an error.
7199 if (tag === 'input' && type === 'file') {
7200 warn$1(
7201 "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
7202 "File inputs are read only. Use a v-on:change listener instead.",
7203 el.rawAttrsMap['v-model']
7204 );
7205 }
7206 }
7207
7208 if (el.component) {
7209 genComponentModel(el, value, modifiers);
7210 // component v-model doesn't need extra runtime
7211 return false
7212 } else if (tag === 'select') {
7213 genSelect(el, value, modifiers);
7214 } else if (tag === 'input' && type === 'checkbox') {
7215 genCheckboxModel(el, value, modifiers);
7216 } else if (tag === 'input' && type === 'radio') {
7217 genRadioModel(el, value, modifiers);
7218 } else if (tag === 'input' || tag === 'textarea') {
7219 genDefaultModel(el, value, modifiers);
7220 } else if (!config.isReservedTag(tag)) {
7221 genComponentModel(el, value, modifiers);
7222 // component v-model doesn't need extra runtime
7223 return false
7224 } else {
7225 warn$1(
7226 "<" + (el.tag) + " v-model=\"" + value + "\">: " +
7227 "v-model is not supported on this element type. " +
7228 'If you are working with contenteditable, it\'s recommended to ' +
7229 'wrap a library dedicated for that purpose inside a custom component.',
7230 el.rawAttrsMap['v-model']
7231 );
7232 }
7233
7234 // ensure runtime directive metadata
7235 return true
7236}
7237
7238function genCheckboxModel (
7239 el,
7240 value,
7241 modifiers
7242) {
7243 var number = modifiers && modifiers.number;
7244 var valueBinding = getBindingAttr(el, 'value') || 'null';
7245 var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
7246 var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
7247 addProp(el, 'checked',
7248 "Array.isArray(" + value + ")" +
7249 "?_i(" + value + "," + valueBinding + ")>-1" + (
7250 trueValueBinding === 'true'
7251 ? (":(" + value + ")")
7252 : (":_q(" + value + "," + trueValueBinding + ")")
7253 )
7254 );
7255 addHandler(el, 'change',
7256 "var $$a=" + value + "," +
7257 '$$el=$event.target,' +
7258 "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
7259 'if(Array.isArray($$a)){' +
7260 "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
7261 '$$i=_i($$a,$$v);' +
7262 "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
7263 "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
7264 "}else{" + (genAssignmentCode(value, '$$c')) + "}",
7265 null, true
7266 );
7267}
7268
7269function genRadioModel (
7270 el,
7271 value,
7272 modifiers
7273) {
7274 var number = modifiers && modifiers.number;
7275 var valueBinding = getBindingAttr(el, 'value') || 'null';
7276 valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
7277 addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
7278 addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
7279}
7280
7281function genSelect (
7282 el,
7283 value,
7284 modifiers
7285) {
7286 var number = modifiers && modifiers.number;
7287 var selectedVal = "Array.prototype.filter" +
7288 ".call($event.target.options,function(o){return o.selected})" +
7289 ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
7290 "return " + (number ? '_n(val)' : 'val') + "})";
7291
7292 var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
7293 var code = "var $$selectedVal = " + selectedVal + ";";
7294 code = code + " " + (genAssignmentCode(value, assignment));
7295 addHandler(el, 'change', code, null, true);
7296}
7297
7298function genDefaultModel (
7299 el,
7300 value,
7301 modifiers
7302) {
7303 var type = el.attrsMap.type;
7304
7305 // warn if v-bind:value conflicts with v-model
7306 // except for inputs with v-bind:type
7307 {
7308 var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
7309 var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
7310 if (value$1 && !typeBinding) {
7311 var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
7312 warn$1(
7313 binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
7314 'because the latter already expands to a value binding internally',
7315 el.rawAttrsMap[binding]
7316 );
7317 }
7318 }
7319
7320 var ref = modifiers || {};
7321 var lazy = ref.lazy;
7322 var number = ref.number;
7323 var trim = ref.trim;
7324 var needCompositionGuard = !lazy && type !== 'range';
7325 var event = lazy
7326 ? 'change'
7327 : type === 'range'
7328 ? RANGE_TOKEN
7329 : 'input';
7330
7331 var valueExpression = '$event.target.value';
7332 if (trim) {
7333 valueExpression = "$event.target.value.trim()";
7334 }
7335 if (number) {
7336 valueExpression = "_n(" + valueExpression + ")";
7337 }
7338
7339 var code = genAssignmentCode(value, valueExpression);
7340 if (needCompositionGuard) {
7341 code = "if($event.target.composing)return;" + code;
7342 }
7343
7344 addProp(el, 'value', ("(" + value + ")"));
7345 addHandler(el, event, code, null, true);
7346 if (trim || number) {
7347 addHandler(el, 'blur', '$forceUpdate()');
7348 }
7349}
7350
7351/* */
7352
7353// normalize v-model event tokens that can only be determined at runtime.
7354// it's important to place the event as the first in the array because
7355// the whole point is ensuring the v-model callback gets called before
7356// user-attached handlers.
7357function normalizeEvents (on) {
7358 /* istanbul ignore if */
7359 if (isDef(on[RANGE_TOKEN])) {
7360 // IE input[type=range] only supports `change` event
7361 var event = isIE ? 'change' : 'input';
7362 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
7363 delete on[RANGE_TOKEN];
7364 }
7365 // This was originally intended to fix #4521 but no longer necessary
7366 // after 2.5. Keeping it for backwards compat with generated code from < 2.4
7367 /* istanbul ignore if */
7368 if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
7369 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
7370 delete on[CHECKBOX_RADIO_TOKEN];
7371 }
7372}
7373
7374var target$1;
7375
7376function createOnceHandler$1 (event, handler, capture) {
7377 var _target = target$1; // save current target element in closure
7378 return function onceHandler () {
7379 var res = handler.apply(null, arguments);
7380 if (res !== null) {
7381 remove$2(event, onceHandler, capture, _target);
7382 }
7383 }
7384}
7385
7386function add$1 (
7387 name,
7388 handler,
7389 capture,
7390 passive
7391) {
7392 // async edge case #6566: inner click event triggers patch, event handler
7393 // attached to outer element during patch, and triggered again. This
7394 // happens because browsers fire microtask ticks between event propagation.
7395 // the solution is simple: we save the timestamp when a handler is attached,
7396 // and the handler would only fire if the event passed to it was fired
7397 // AFTER it was attached.
7398 if (isUsingMicroTask) {
7399 var attachedTimestamp = currentFlushTimestamp;
7400 var original = handler;
7401 handler = original._wrapper = function (e) {
7402 if (e.timeStamp >= attachedTimestamp) {
7403 return original.apply(this, arguments)
7404 }
7405 };
7406 }
7407 target$1.addEventListener(
7408 name,
7409 handler,
7410 supportsPassive
7411 ? { capture: capture, passive: passive }
7412 : capture
7413 );
7414}
7415
7416function remove$2 (
7417 name,
7418 handler,
7419 capture,
7420 _target
7421) {
7422 (_target || target$1).removeEventListener(
7423 name,
7424 handler._wrapper || handler,
7425 capture
7426 );
7427}
7428
7429function updateDOMListeners (oldVnode, vnode) {
7430 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
7431 return
7432 }
7433 var on = vnode.data.on || {};
7434 var oldOn = oldVnode.data.on || {};
7435 target$1 = vnode.elm;
7436 normalizeEvents(on);
7437 updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
7438 target$1 = undefined;
7439}
7440
7441var events = {
7442 create: updateDOMListeners,
7443 update: updateDOMListeners
7444};
7445
7446/* */
7447
7448var svgContainer;
7449
7450function updateDOMProps (oldVnode, vnode) {
7451 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
7452 return
7453 }
7454 var key, cur;
7455 var elm = vnode.elm;
7456 var oldProps = oldVnode.data.domProps || {};
7457 var props = vnode.data.domProps || {};
7458 // clone observed objects, as the user probably wants to mutate it
7459 if (isDef(props.__ob__)) {
7460 props = vnode.data.domProps = extend({}, props);
7461 }
7462
7463 for (key in oldProps) {
7464 if (isUndef(props[key])) {
7465 elm[key] = '';
7466 }
7467 }
7468 for (key in props) {
7469 cur = props[key];
7470 // ignore children if the node has textContent or innerHTML,
7471 // as these will throw away existing DOM nodes and cause removal errors
7472 // on subsequent patches (#3360)
7473 if (key === 'textContent' || key === 'innerHTML') {
7474 if (vnode.children) { vnode.children.length = 0; }
7475 if (cur === oldProps[key]) { continue }
7476 // #6601 work around Chrome version <= 55 bug where single textNode
7477 // replaced by innerHTML/textContent retains its parentNode property
7478 if (elm.childNodes.length === 1) {
7479 elm.removeChild(elm.childNodes[0]);
7480 }
7481 }
7482
7483 // skip the update if old and new VDOM state is the same.
7484 // the only exception is `value` where the DOM value may be temporarily
7485 // out of sync with VDOM state due to focus, composition and modifiers.
7486 // This also covers #4521 by skipping the unnecesarry `checked` update.
7487 if (key !== 'value' && cur === oldProps[key]) {
7488 continue
7489 }
7490
7491 if (key === 'value') {
7492 // store value as _value as well since
7493 // non-string values will be stringified
7494 elm._value = cur;
7495 // avoid resetting cursor position when value is the same
7496 var strCur = isUndef(cur) ? '' : String(cur);
7497 if (shouldUpdateValue(elm, strCur)) {
7498 elm.value = strCur;
7499 }
7500 } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
7501 // IE doesn't support innerHTML for SVG elements
7502 svgContainer = svgContainer || document.createElement('div');
7503 svgContainer.innerHTML = "<svg>" + cur + "</svg>";
7504 var svg = svgContainer.firstChild;
7505 while (elm.firstChild) {
7506 elm.removeChild(elm.firstChild);
7507 }
7508 while (svg.firstChild) {
7509 elm.appendChild(svg.firstChild);
7510 }
7511 } else {
7512 elm[key] = cur;
7513 }
7514 }
7515}
7516
7517// check platforms/web/util/attrs.js acceptValue
7518
7519
7520function shouldUpdateValue (elm, checkVal) {
7521 return (!elm.composing && (
7522 elm.tagName === 'OPTION' ||
7523 isNotInFocusAndDirty(elm, checkVal) ||
7524 isDirtyWithModifiers(elm, checkVal)
7525 ))
7526}
7527
7528function isNotInFocusAndDirty (elm, checkVal) {
7529 // return true when textbox (.number and .trim) loses focus and its value is
7530 // not equal to the updated value
7531 var notInFocus = true;
7532 // #6157
7533 // work around IE bug when accessing document.activeElement in an iframe
7534 try { notInFocus = document.activeElement !== elm; } catch (e) {}
7535 return notInFocus && elm.value !== checkVal
7536}
7537
7538function isDirtyWithModifiers (elm, newVal) {
7539 var value = elm.value;
7540 var modifiers = elm._vModifiers; // injected by v-model runtime
7541 if (isDef(modifiers)) {
7542 if (modifiers.number) {
7543 return toNumber(value) !== toNumber(newVal)
7544 }
7545 if (modifiers.trim) {
7546 return value.trim() !== newVal.trim()
7547 }
7548 }
7549 return value !== newVal
7550}
7551
7552var domProps = {
7553 create: updateDOMProps,
7554 update: updateDOMProps
7555};
7556
7557/* */
7558
7559var parseStyleText = cached(function (cssText) {
7560 var res = {};
7561 var listDelimiter = /;(?![^(]*\))/g;
7562 var propertyDelimiter = /:(.+)/;
7563 cssText.split(listDelimiter).forEach(function (item) {
7564 if (item) {
7565 var tmp = item.split(propertyDelimiter);
7566 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
7567 }
7568 });
7569 return res
7570});
7571
7572// merge static and dynamic style data on the same vnode
7573function normalizeStyleData (data) {
7574 var style = normalizeStyleBinding(data.style);
7575 // static style is pre-processed into an object during compilation
7576 // and is always a fresh object, so it's safe to merge into it
7577 return data.staticStyle
7578 ? extend(data.staticStyle, style)
7579 : style
7580}
7581
7582// normalize possible array / string values into Object
7583function normalizeStyleBinding (bindingStyle) {
7584 if (Array.isArray(bindingStyle)) {
7585 return toObject(bindingStyle)
7586 }
7587 if (typeof bindingStyle === 'string') {
7588 return parseStyleText(bindingStyle)
7589 }
7590 return bindingStyle
7591}
7592
7593/**
7594 * parent component style should be after child's
7595 * so that parent component's style could override it
7596 */
7597function getStyle (vnode, checkChild) {
7598 var res = {};
7599 var styleData;
7600
7601 if (checkChild) {
7602 var childNode = vnode;
7603 while (childNode.componentInstance) {
7604 childNode = childNode.componentInstance._vnode;
7605 if (
7606 childNode && childNode.data &&
7607 (styleData = normalizeStyleData(childNode.data))
7608 ) {
7609 extend(res, styleData);
7610 }
7611 }
7612 }
7613
7614 if ((styleData = normalizeStyleData(vnode.data))) {
7615 extend(res, styleData);
7616 }
7617
7618 var parentNode = vnode;
7619 while ((parentNode = parentNode.parent)) {
7620 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
7621 extend(res, styleData);
7622 }
7623 }
7624 return res
7625}
7626
7627/* */
7628
7629var cssVarRE = /^--/;
7630var importantRE = /\s*!important$/;
7631var setProp = function (el, name, val) {
7632 /* istanbul ignore if */
7633 if (cssVarRE.test(name)) {
7634 el.style.setProperty(name, val);
7635 } else if (importantRE.test(val)) {
7636 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
7637 } else {
7638 var normalizedName = normalize(name);
7639 if (Array.isArray(val)) {
7640 // Support values array created by autoprefixer, e.g.
7641 // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
7642 // Set them one by one, and the browser will only set those it can recognize
7643 for (var i = 0, len = val.length; i < len; i++) {
7644 el.style[normalizedName] = val[i];
7645 }
7646 } else {
7647 el.style[normalizedName] = val;
7648 }
7649 }
7650};
7651
7652var vendorNames = ['Webkit', 'Moz', 'ms'];
7653
7654var emptyStyle;
7655var normalize = cached(function (prop) {
7656 emptyStyle = emptyStyle || document.createElement('div').style;
7657 prop = camelize(prop);
7658 if (prop !== 'filter' && (prop in emptyStyle)) {
7659 return prop
7660 }
7661 var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
7662 for (var i = 0; i < vendorNames.length; i++) {
7663 var name = vendorNames[i] + capName;
7664 if (name in emptyStyle) {
7665 return name
7666 }
7667 }
7668});
7669
7670function updateStyle (oldVnode, vnode) {
7671 var data = vnode.data;
7672 var oldData = oldVnode.data;
7673
7674 if (isUndef(data.staticStyle) && isUndef(data.style) &&
7675 isUndef(oldData.staticStyle) && isUndef(oldData.style)
7676 ) {
7677 return
7678 }
7679
7680 var cur, name;
7681 var el = vnode.elm;
7682 var oldStaticStyle = oldData.staticStyle;
7683 var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
7684
7685 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
7686 var oldStyle = oldStaticStyle || oldStyleBinding;
7687
7688 var style = normalizeStyleBinding(vnode.data.style) || {};
7689
7690 // store normalized style under a different key for next diff
7691 // make sure to clone it if it's reactive, since the user likely wants
7692 // to mutate it.
7693 vnode.data.normalizedStyle = isDef(style.__ob__)
7694 ? extend({}, style)
7695 : style;
7696
7697 var newStyle = getStyle(vnode, true);
7698
7699 for (name in oldStyle) {
7700 if (isUndef(newStyle[name])) {
7701 setProp(el, name, '');
7702 }
7703 }
7704 for (name in newStyle) {
7705 cur = newStyle[name];
7706 if (cur !== oldStyle[name]) {
7707 // ie9 setting to null has no effect, must use empty string
7708 setProp(el, name, cur == null ? '' : cur);
7709 }
7710 }
7711}
7712
7713var style = {
7714 create: updateStyle,
7715 update: updateStyle
7716};
7717
7718/* */
7719
7720var whitespaceRE = /\s+/;
7721
7722/**
7723 * Add class with compatibility for SVG since classList is not supported on
7724 * SVG elements in IE
7725 */
7726function addClass (el, cls) {
7727 /* istanbul ignore if */
7728 if (!cls || !(cls = cls.trim())) {
7729 return
7730 }
7731
7732 /* istanbul ignore else */
7733 if (el.classList) {
7734 if (cls.indexOf(' ') > -1) {
7735 cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
7736 } else {
7737 el.classList.add(cls);
7738 }
7739 } else {
7740 var cur = " " + (el.getAttribute('class') || '') + " ";
7741 if (cur.indexOf(' ' + cls + ' ') < 0) {
7742 el.setAttribute('class', (cur + cls).trim());
7743 }
7744 }
7745}
7746
7747/**
7748 * Remove class with compatibility for SVG since classList is not supported on
7749 * SVG elements in IE
7750 */
7751function removeClass (el, cls) {
7752 /* istanbul ignore if */
7753 if (!cls || !(cls = cls.trim())) {
7754 return
7755 }
7756
7757 /* istanbul ignore else */
7758 if (el.classList) {
7759 if (cls.indexOf(' ') > -1) {
7760 cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
7761 } else {
7762 el.classList.remove(cls);
7763 }
7764 if (!el.classList.length) {
7765 el.removeAttribute('class');
7766 }
7767 } else {
7768 var cur = " " + (el.getAttribute('class') || '') + " ";
7769 var tar = ' ' + cls + ' ';
7770 while (cur.indexOf(tar) >= 0) {
7771 cur = cur.replace(tar, ' ');
7772 }
7773 cur = cur.trim();
7774 if (cur) {
7775 el.setAttribute('class', cur);
7776 } else {
7777 el.removeAttribute('class');
7778 }
7779 }
7780}
7781
7782/* */
7783
7784function resolveTransition (def$$1) {
7785 if (!def$$1) {
7786 return
7787 }
7788 /* istanbul ignore else */
7789 if (typeof def$$1 === 'object') {
7790 var res = {};
7791 if (def$$1.css !== false) {
7792 extend(res, autoCssTransition(def$$1.name || 'v'));
7793 }
7794 extend(res, def$$1);
7795 return res
7796 } else if (typeof def$$1 === 'string') {
7797 return autoCssTransition(def$$1)
7798 }
7799}
7800
7801var autoCssTransition = cached(function (name) {
7802 return {
7803 enterClass: (name + "-enter"),
7804 enterToClass: (name + "-enter-to"),
7805 enterActiveClass: (name + "-enter-active"),
7806 leaveClass: (name + "-leave"),
7807 leaveToClass: (name + "-leave-to"),
7808 leaveActiveClass: (name + "-leave-active")
7809 }
7810});
7811
7812var hasTransition = inBrowser && !isIE9;
7813var TRANSITION = 'transition';
7814var ANIMATION = 'animation';
7815
7816// Transition property/event sniffing
7817var transitionProp = 'transition';
7818var transitionEndEvent = 'transitionend';
7819var animationProp = 'animation';
7820var animationEndEvent = 'animationend';
7821if (hasTransition) {
7822 /* istanbul ignore if */
7823 if (window.ontransitionend === undefined &&
7824 window.onwebkittransitionend !== undefined
7825 ) {
7826 transitionProp = 'WebkitTransition';
7827 transitionEndEvent = 'webkitTransitionEnd';
7828 }
7829 if (window.onanimationend === undefined &&
7830 window.onwebkitanimationend !== undefined
7831 ) {
7832 animationProp = 'WebkitAnimation';
7833 animationEndEvent = 'webkitAnimationEnd';
7834 }
7835}
7836
7837// binding to window is necessary to make hot reload work in IE in strict mode
7838var raf = inBrowser
7839 ? window.requestAnimationFrame
7840 ? window.requestAnimationFrame.bind(window)
7841 : setTimeout
7842 : /* istanbul ignore next */ function (fn) { return fn(); };
7843
7844function nextFrame (fn) {
7845 raf(function () {
7846 raf(fn);
7847 });
7848}
7849
7850function addTransitionClass (el, cls) {
7851 var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
7852 if (transitionClasses.indexOf(cls) < 0) {
7853 transitionClasses.push(cls);
7854 addClass(el, cls);
7855 }
7856}
7857
7858function removeTransitionClass (el, cls) {
7859 if (el._transitionClasses) {
7860 remove(el._transitionClasses, cls);
7861 }
7862 removeClass(el, cls);
7863}
7864
7865function whenTransitionEnds (
7866 el,
7867 expectedType,
7868 cb
7869) {
7870 var ref = getTransitionInfo(el, expectedType);
7871 var type = ref.type;
7872 var timeout = ref.timeout;
7873 var propCount = ref.propCount;
7874 if (!type) { return cb() }
7875 var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
7876 var ended = 0;
7877 var end = function () {
7878 el.removeEventListener(event, onEnd);
7879 cb();
7880 };
7881 var onEnd = function (e) {
7882 if (e.target === el) {
7883 if (++ended >= propCount) {
7884 end();
7885 }
7886 }
7887 };
7888 setTimeout(function () {
7889 if (ended < propCount) {
7890 end();
7891 }
7892 }, timeout + 1);
7893 el.addEventListener(event, onEnd);
7894}
7895
7896var transformRE = /\b(transform|all)(,|$)/;
7897
7898function getTransitionInfo (el, expectedType) {
7899 var styles = window.getComputedStyle(el);
7900 // JSDOM may return undefined for transition properties
7901 var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
7902 var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
7903 var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
7904 var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
7905 var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
7906 var animationTimeout = getTimeout(animationDelays, animationDurations);
7907
7908 var type;
7909 var timeout = 0;
7910 var propCount = 0;
7911 /* istanbul ignore if */
7912 if (expectedType === TRANSITION) {
7913 if (transitionTimeout > 0) {
7914 type = TRANSITION;
7915 timeout = transitionTimeout;
7916 propCount = transitionDurations.length;
7917 }
7918 } else if (expectedType === ANIMATION) {
7919 if (animationTimeout > 0) {
7920 type = ANIMATION;
7921 timeout = animationTimeout;
7922 propCount = animationDurations.length;
7923 }
7924 } else {
7925 timeout = Math.max(transitionTimeout, animationTimeout);
7926 type = timeout > 0
7927 ? transitionTimeout > animationTimeout
7928 ? TRANSITION
7929 : ANIMATION
7930 : null;
7931 propCount = type
7932 ? type === TRANSITION
7933 ? transitionDurations.length
7934 : animationDurations.length
7935 : 0;
7936 }
7937 var hasTransform =
7938 type === TRANSITION &&
7939 transformRE.test(styles[transitionProp + 'Property']);
7940 return {
7941 type: type,
7942 timeout: timeout,
7943 propCount: propCount,
7944 hasTransform: hasTransform
7945 }
7946}
7947
7948function getTimeout (delays, durations) {
7949 /* istanbul ignore next */
7950 while (delays.length < durations.length) {
7951 delays = delays.concat(delays);
7952 }
7953
7954 return Math.max.apply(null, durations.map(function (d, i) {
7955 return toMs(d) + toMs(delays[i])
7956 }))
7957}
7958
7959// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
7960// in a locale-dependent way, using a comma instead of a dot.
7961// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
7962// as a floor function) causing unexpected behaviors
7963function toMs (s) {
7964 return Number(s.slice(0, -1).replace(',', '.')) * 1000
7965}
7966
7967/* */
7968
7969function enter (vnode, toggleDisplay) {
7970 var el = vnode.elm;
7971
7972 // call leave callback now
7973 if (isDef(el._leaveCb)) {
7974 el._leaveCb.cancelled = true;
7975 el._leaveCb();
7976 }
7977
7978 var data = resolveTransition(vnode.data.transition);
7979 if (isUndef(data)) {
7980 return
7981 }
7982
7983 /* istanbul ignore if */
7984 if (isDef(el._enterCb) || el.nodeType !== 1) {
7985 return
7986 }
7987
7988 var css = data.css;
7989 var type = data.type;
7990 var enterClass = data.enterClass;
7991 var enterToClass = data.enterToClass;
7992 var enterActiveClass = data.enterActiveClass;
7993 var appearClass = data.appearClass;
7994 var appearToClass = data.appearToClass;
7995 var appearActiveClass = data.appearActiveClass;
7996 var beforeEnter = data.beforeEnter;
7997 var enter = data.enter;
7998 var afterEnter = data.afterEnter;
7999 var enterCancelled = data.enterCancelled;
8000 var beforeAppear = data.beforeAppear;
8001 var appear = data.appear;
8002 var afterAppear = data.afterAppear;
8003 var appearCancelled = data.appearCancelled;
8004 var duration = data.duration;
8005
8006 // activeInstance will always be the <transition> component managing this
8007 // transition. One edge case to check is when the <transition> is placed
8008 // as the root node of a child component. In that case we need to check
8009 // <transition>'s parent for appear check.
8010 var context = activeInstance;
8011 var transitionNode = activeInstance.$vnode;
8012 while (transitionNode && transitionNode.parent) {
8013 transitionNode = transitionNode.parent;
8014 context = transitionNode.context;
8015 }
8016
8017 var isAppear = !context._isMounted || !vnode.isRootInsert;
8018
8019 if (isAppear && !appear && appear !== '') {
8020 return
8021 }
8022
8023 var startClass = isAppear && appearClass
8024 ? appearClass
8025 : enterClass;
8026 var activeClass = isAppear && appearActiveClass
8027 ? appearActiveClass
8028 : enterActiveClass;
8029 var toClass = isAppear && appearToClass
8030 ? appearToClass
8031 : enterToClass;
8032
8033 var beforeEnterHook = isAppear
8034 ? (beforeAppear || beforeEnter)
8035 : beforeEnter;
8036 var enterHook = isAppear
8037 ? (typeof appear === 'function' ? appear : enter)
8038 : enter;
8039 var afterEnterHook = isAppear
8040 ? (afterAppear || afterEnter)
8041 : afterEnter;
8042 var enterCancelledHook = isAppear
8043 ? (appearCancelled || enterCancelled)
8044 : enterCancelled;
8045
8046 var explicitEnterDuration = toNumber(
8047 isObject(duration)
8048 ? duration.enter
8049 : duration
8050 );
8051
8052 if (explicitEnterDuration != null) {
8053 checkDuration(explicitEnterDuration, 'enter', vnode);
8054 }
8055
8056 var expectsCSS = css !== false && !isIE9;
8057 var userWantsControl = getHookArgumentsLength(enterHook);
8058
8059 var cb = el._enterCb = once(function () {
8060 if (expectsCSS) {
8061 removeTransitionClass(el, toClass);
8062 removeTransitionClass(el, activeClass);
8063 }
8064 if (cb.cancelled) {
8065 if (expectsCSS) {
8066 removeTransitionClass(el, startClass);
8067 }
8068 enterCancelledHook && enterCancelledHook(el);
8069 } else {
8070 afterEnterHook && afterEnterHook(el);
8071 }
8072 el._enterCb = null;
8073 });
8074
8075 if (!vnode.data.show) {
8076 // remove pending leave element on enter by injecting an insert hook
8077 mergeVNodeHook(vnode, 'insert', function () {
8078 var parent = el.parentNode;
8079 var pendingNode = parent && parent._pending && parent._pending[vnode.key];
8080 if (pendingNode &&
8081 pendingNode.tag === vnode.tag &&
8082 pendingNode.elm._leaveCb
8083 ) {
8084 pendingNode.elm._leaveCb();
8085 }
8086 enterHook && enterHook(el, cb);
8087 });
8088 }
8089
8090 // start enter transition
8091 beforeEnterHook && beforeEnterHook(el);
8092 if (expectsCSS) {
8093 addTransitionClass(el, startClass);
8094 addTransitionClass(el, activeClass);
8095 nextFrame(function () {
8096 removeTransitionClass(el, startClass);
8097 if (!cb.cancelled) {
8098 addTransitionClass(el, toClass);
8099 if (!userWantsControl) {
8100 if (isValidDuration(explicitEnterDuration)) {
8101 setTimeout(cb, explicitEnterDuration);
8102 } else {
8103 whenTransitionEnds(el, type, cb);
8104 }
8105 }
8106 }
8107 });
8108 }
8109
8110 if (vnode.data.show) {
8111 toggleDisplay && toggleDisplay();
8112 enterHook && enterHook(el, cb);
8113 }
8114
8115 if (!expectsCSS && !userWantsControl) {
8116 cb();
8117 }
8118}
8119
8120function leave (vnode, rm) {
8121 var el = vnode.elm;
8122
8123 // call enter callback now
8124 if (isDef(el._enterCb)) {
8125 el._enterCb.cancelled = true;
8126 el._enterCb();
8127 }
8128
8129 var data = resolveTransition(vnode.data.transition);
8130 if (isUndef(data) || el.nodeType !== 1) {
8131 return rm()
8132 }
8133
8134 /* istanbul ignore if */
8135 if (isDef(el._leaveCb)) {
8136 return
8137 }
8138
8139 var css = data.css;
8140 var type = data.type;
8141 var leaveClass = data.leaveClass;
8142 var leaveToClass = data.leaveToClass;
8143 var leaveActiveClass = data.leaveActiveClass;
8144 var beforeLeave = data.beforeLeave;
8145 var leave = data.leave;
8146 var afterLeave = data.afterLeave;
8147 var leaveCancelled = data.leaveCancelled;
8148 var delayLeave = data.delayLeave;
8149 var duration = data.duration;
8150
8151 var expectsCSS = css !== false && !isIE9;
8152 var userWantsControl = getHookArgumentsLength(leave);
8153
8154 var explicitLeaveDuration = toNumber(
8155 isObject(duration)
8156 ? duration.leave
8157 : duration
8158 );
8159
8160 if (isDef(explicitLeaveDuration)) {
8161 checkDuration(explicitLeaveDuration, 'leave', vnode);
8162 }
8163
8164 var cb = el._leaveCb = once(function () {
8165 if (el.parentNode && el.parentNode._pending) {
8166 el.parentNode._pending[vnode.key] = null;
8167 }
8168 if (expectsCSS) {
8169 removeTransitionClass(el, leaveToClass);
8170 removeTransitionClass(el, leaveActiveClass);
8171 }
8172 if (cb.cancelled) {
8173 if (expectsCSS) {
8174 removeTransitionClass(el, leaveClass);
8175 }
8176 leaveCancelled && leaveCancelled(el);
8177 } else {
8178 rm();
8179 afterLeave && afterLeave(el);
8180 }
8181 el._leaveCb = null;
8182 });
8183
8184 if (delayLeave) {
8185 delayLeave(performLeave);
8186 } else {
8187 performLeave();
8188 }
8189
8190 function performLeave () {
8191 // the delayed leave may have already been cancelled
8192 if (cb.cancelled) {
8193 return
8194 }
8195 // record leaving element
8196 if (!vnode.data.show && el.parentNode) {
8197 (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
8198 }
8199 beforeLeave && beforeLeave(el);
8200 if (expectsCSS) {
8201 addTransitionClass(el, leaveClass);
8202 addTransitionClass(el, leaveActiveClass);
8203 nextFrame(function () {
8204 removeTransitionClass(el, leaveClass);
8205 if (!cb.cancelled) {
8206 addTransitionClass(el, leaveToClass);
8207 if (!userWantsControl) {
8208 if (isValidDuration(explicitLeaveDuration)) {
8209 setTimeout(cb, explicitLeaveDuration);
8210 } else {
8211 whenTransitionEnds(el, type, cb);
8212 }
8213 }
8214 }
8215 });
8216 }
8217 leave && leave(el, cb);
8218 if (!expectsCSS && !userWantsControl) {
8219 cb();
8220 }
8221 }
8222}
8223
8224// only used in dev mode
8225function checkDuration (val, name, vnode) {
8226 if (typeof val !== 'number') {
8227 warn(
8228 "<transition> explicit " + name + " duration is not a valid number - " +
8229 "got " + (JSON.stringify(val)) + ".",
8230 vnode.context
8231 );
8232 } else if (isNaN(val)) {
8233 warn(
8234 "<transition> explicit " + name + " duration is NaN - " +
8235 'the duration expression might be incorrect.',
8236 vnode.context
8237 );
8238 }
8239}
8240
8241function isValidDuration (val) {
8242 return typeof val === 'number' && !isNaN(val)
8243}
8244
8245/**
8246 * Normalize a transition hook's argument length. The hook may be:
8247 * - a merged hook (invoker) with the original in .fns
8248 * - a wrapped component method (check ._length)
8249 * - a plain function (.length)
8250 */
8251function getHookArgumentsLength (fn) {
8252 if (isUndef(fn)) {
8253 return false
8254 }
8255 var invokerFns = fn.fns;
8256 if (isDef(invokerFns)) {
8257 // invoker
8258 return getHookArgumentsLength(
8259 Array.isArray(invokerFns)
8260 ? invokerFns[0]
8261 : invokerFns
8262 )
8263 } else {
8264 return (fn._length || fn.length) > 1
8265 }
8266}
8267
8268function _enter (_, vnode) {
8269 if (vnode.data.show !== true) {
8270 enter(vnode);
8271 }
8272}
8273
8274var transition = inBrowser ? {
8275 create: _enter,
8276 activate: _enter,
8277 remove: function remove$$1 (vnode, rm) {
8278 /* istanbul ignore else */
8279 if (vnode.data.show !== true) {
8280 leave(vnode, rm);
8281 } else {
8282 rm();
8283 }
8284 }
8285} : {};
8286
8287var platformModules = [
8288 attrs,
8289 klass,
8290 events,
8291 domProps,
8292 style,
8293 transition
8294];
8295
8296/* */
8297
8298// the directive module should be applied last, after all
8299// built-in modules have been applied.
8300var modules = platformModules.concat(baseModules);
8301
8302var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
8303
8304/**
8305 * Not type checking this file because flow doesn't like attaching
8306 * properties to Elements.
8307 */
8308
8309/* istanbul ignore if */
8310if (isIE9) {
8311 // http://www.matts411.com/post/internet-explorer-9-oninput/
8312 document.addEventListener('selectionchange', function () {
8313 var el = document.activeElement;
8314 if (el && el.vmodel) {
8315 trigger(el, 'input');
8316 }
8317 });
8318}
8319
8320var directive = {
8321 inserted: function inserted (el, binding, vnode, oldVnode) {
8322 if (vnode.tag === 'select') {
8323 // #6903
8324 if (oldVnode.elm && !oldVnode.elm._vOptions) {
8325 mergeVNodeHook(vnode, 'postpatch', function () {
8326 directive.componentUpdated(el, binding, vnode);
8327 });
8328 } else {
8329 setSelected(el, binding, vnode.context);
8330 }
8331 el._vOptions = [].map.call(el.options, getValue);
8332 } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
8333 el._vModifiers = binding.modifiers;
8334 if (!binding.modifiers.lazy) {
8335 el.addEventListener('compositionstart', onCompositionStart);
8336 el.addEventListener('compositionend', onCompositionEnd);
8337 // Safari < 10.2 & UIWebView doesn't fire compositionend when
8338 // switching focus before confirming composition choice
8339 // this also fixes the issue where some browsers e.g. iOS Chrome
8340 // fires "change" instead of "input" on autocomplete.
8341 el.addEventListener('change', onCompositionEnd);
8342 /* istanbul ignore if */
8343 if (isIE9) {
8344 el.vmodel = true;
8345 }
8346 }
8347 }
8348 },
8349
8350 componentUpdated: function componentUpdated (el, binding, vnode) {
8351 if (vnode.tag === 'select') {
8352 setSelected(el, binding, vnode.context);
8353 // in case the options rendered by v-for have changed,
8354 // it's possible that the value is out-of-sync with the rendered options.
8355 // detect such cases and filter out values that no longer has a matching
8356 // option in the DOM.
8357 var prevOptions = el._vOptions;
8358 var curOptions = el._vOptions = [].map.call(el.options, getValue);
8359 if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
8360 // trigger change event if
8361 // no matching option found for at least one value
8362 var needReset = el.multiple
8363 ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
8364 : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
8365 if (needReset) {
8366 trigger(el, 'change');
8367 }
8368 }
8369 }
8370 }
8371};
8372
8373function setSelected (el, binding, vm) {
8374 actuallySetSelected(el, binding, vm);
8375 /* istanbul ignore if */
8376 if (isIE || isEdge) {
8377 setTimeout(function () {
8378 actuallySetSelected(el, binding, vm);
8379 }, 0);
8380 }
8381}
8382
8383function actuallySetSelected (el, binding, vm) {
8384 var value = binding.value;
8385 var isMultiple = el.multiple;
8386 if (isMultiple && !Array.isArray(value)) {
8387 warn(
8388 "<select multiple v-model=\"" + (binding.expression) + "\"> " +
8389 "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
8390 vm
8391 );
8392 return
8393 }
8394 var selected, option;
8395 for (var i = 0, l = el.options.length; i < l; i++) {
8396 option = el.options[i];
8397 if (isMultiple) {
8398 selected = looseIndexOf(value, getValue(option)) > -1;
8399 if (option.selected !== selected) {
8400 option.selected = selected;
8401 }
8402 } else {
8403 if (looseEqual(getValue(option), value)) {
8404 if (el.selectedIndex !== i) {
8405 el.selectedIndex = i;
8406 }
8407 return
8408 }
8409 }
8410 }
8411 if (!isMultiple) {
8412 el.selectedIndex = -1;
8413 }
8414}
8415
8416function hasNoMatchingOption (value, options) {
8417 return options.every(function (o) { return !looseEqual(o, value); })
8418}
8419
8420function getValue (option) {
8421 return '_value' in option
8422 ? option._value
8423 : option.value
8424}
8425
8426function onCompositionStart (e) {
8427 e.target.composing = true;
8428}
8429
8430function onCompositionEnd (e) {
8431 // prevent triggering an input event for no reason
8432 if (!e.target.composing) { return }
8433 e.target.composing = false;
8434 trigger(e.target, 'input');
8435}
8436
8437function trigger (el, type) {
8438 var e = document.createEvent('HTMLEvents');
8439 e.initEvent(type, true, true);
8440 el.dispatchEvent(e);
8441}
8442
8443/* */
8444
8445// recursively search for possible transition defined inside the component root
8446function locateNode (vnode) {
8447 return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
8448 ? locateNode(vnode.componentInstance._vnode)
8449 : vnode
8450}
8451
8452var show = {
8453 bind: function bind (el, ref, vnode) {
8454 var value = ref.value;
8455
8456 vnode = locateNode(vnode);
8457 var transition$$1 = vnode.data && vnode.data.transition;
8458 var originalDisplay = el.__vOriginalDisplay =
8459 el.style.display === 'none' ? '' : el.style.display;
8460 if (value && transition$$1) {
8461 vnode.data.show = true;
8462 enter(vnode, function () {
8463 el.style.display = originalDisplay;
8464 });
8465 } else {
8466 el.style.display = value ? originalDisplay : 'none';
8467 }
8468 },
8469
8470 update: function update (el, ref, vnode) {
8471 var value = ref.value;
8472 var oldValue = ref.oldValue;
8473
8474 /* istanbul ignore if */
8475 if (!value === !oldValue) { return }
8476 vnode = locateNode(vnode);
8477 var transition$$1 = vnode.data && vnode.data.transition;
8478 if (transition$$1) {
8479 vnode.data.show = true;
8480 if (value) {
8481 enter(vnode, function () {
8482 el.style.display = el.__vOriginalDisplay;
8483 });
8484 } else {
8485 leave(vnode, function () {
8486 el.style.display = 'none';
8487 });
8488 }
8489 } else {
8490 el.style.display = value ? el.__vOriginalDisplay : 'none';
8491 }
8492 },
8493
8494 unbind: function unbind (
8495 el,
8496 binding,
8497 vnode,
8498 oldVnode,
8499 isDestroy
8500 ) {
8501 if (!isDestroy) {
8502 el.style.display = el.__vOriginalDisplay;
8503 }
8504 }
8505};
8506
8507var platformDirectives = {
8508 model: directive,
8509 show: show
8510};
8511
8512/* */
8513
8514var transitionProps = {
8515 name: String,
8516 appear: Boolean,
8517 css: Boolean,
8518 mode: String,
8519 type: String,
8520 enterClass: String,
8521 leaveClass: String,
8522 enterToClass: String,
8523 leaveToClass: String,
8524 enterActiveClass: String,
8525 leaveActiveClass: String,
8526 appearClass: String,
8527 appearActiveClass: String,
8528 appearToClass: String,
8529 duration: [Number, String, Object]
8530};
8531
8532// in case the child is also an abstract component, e.g. <keep-alive>
8533// we want to recursively retrieve the real component to be rendered
8534function getRealChild (vnode) {
8535 var compOptions = vnode && vnode.componentOptions;
8536 if (compOptions && compOptions.Ctor.options.abstract) {
8537 return getRealChild(getFirstComponentChild(compOptions.children))
8538 } else {
8539 return vnode
8540 }
8541}
8542
8543function extractTransitionData (comp) {
8544 var data = {};
8545 var options = comp.$options;
8546 // props
8547 for (var key in options.propsData) {
8548 data[key] = comp[key];
8549 }
8550 // events.
8551 // extract listeners and pass them directly to the transition methods
8552 var listeners = options._parentListeners;
8553 for (var key$1 in listeners) {
8554 data[camelize(key$1)] = listeners[key$1];
8555 }
8556 return data
8557}
8558
8559function placeholder (h, rawChild) {
8560 if (/\d-keep-alive$/.test(rawChild.tag)) {
8561 return h('keep-alive', {
8562 props: rawChild.componentOptions.propsData
8563 })
8564 }
8565}
8566
8567function hasParentTransition (vnode) {
8568 while ((vnode = vnode.parent)) {
8569 if (vnode.data.transition) {
8570 return true
8571 }
8572 }
8573}
8574
8575function isSameChild (child, oldChild) {
8576 return oldChild.key === child.key && oldChild.tag === child.tag
8577}
8578
8579var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
8580
8581var isVShowDirective = function (d) { return d.name === 'show'; };
8582
8583var Transition = {
8584 name: 'transition',
8585 props: transitionProps,
8586 abstract: true,
8587
8588 render: function render (h) {
8589 var this$1 = this;
8590
8591 var children = this.$slots.default;
8592 if (!children) {
8593 return
8594 }
8595
8596 // filter out text nodes (possible whitespaces)
8597 children = children.filter(isNotTextNode);
8598 /* istanbul ignore if */
8599 if (!children.length) {
8600 return
8601 }
8602
8603 // warn multiple elements
8604 if (children.length > 1) {
8605 warn(
8606 '<transition> can only be used on a single element. Use ' +
8607 '<transition-group> for lists.',
8608 this.$parent
8609 );
8610 }
8611
8612 var mode = this.mode;
8613
8614 // warn invalid mode
8615 if (mode && mode !== 'in-out' && mode !== 'out-in'
8616 ) {
8617 warn(
8618 'invalid <transition> mode: ' + mode,
8619 this.$parent
8620 );
8621 }
8622
8623 var rawChild = children[0];
8624
8625 // if this is a component root node and the component's
8626 // parent container node also has transition, skip.
8627 if (hasParentTransition(this.$vnode)) {
8628 return rawChild
8629 }
8630
8631 // apply transition data to child
8632 // use getRealChild() to ignore abstract components e.g. keep-alive
8633 var child = getRealChild(rawChild);
8634 /* istanbul ignore if */
8635 if (!child) {
8636 return rawChild
8637 }
8638
8639 if (this._leaving) {
8640 return placeholder(h, rawChild)
8641 }
8642
8643 // ensure a key that is unique to the vnode type and to this transition
8644 // component instance. This key will be used to remove pending leaving nodes
8645 // during entering.
8646 var id = "__transition-" + (this._uid) + "-";
8647 child.key = child.key == null
8648 ? child.isComment
8649 ? id + 'comment'
8650 : id + child.tag
8651 : isPrimitive(child.key)
8652 ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
8653 : child.key;
8654
8655 var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
8656 var oldRawChild = this._vnode;
8657 var oldChild = getRealChild(oldRawChild);
8658
8659 // mark v-show
8660 // so that the transition module can hand over the control to the directive
8661 if (child.data.directives && child.data.directives.some(isVShowDirective)) {
8662 child.data.show = true;
8663 }
8664
8665 if (
8666 oldChild &&
8667 oldChild.data &&
8668 !isSameChild(child, oldChild) &&
8669 !isAsyncPlaceholder(oldChild) &&
8670 // #6687 component root is a comment node
8671 !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
8672 ) {
8673 // replace old child transition data with fresh one
8674 // important for dynamic transitions!
8675 var oldData = oldChild.data.transition = extend({}, data);
8676 // handle transition mode
8677 if (mode === 'out-in') {
8678 // return placeholder node and queue update when leave finishes
8679 this._leaving = true;
8680 mergeVNodeHook(oldData, 'afterLeave', function () {
8681 this$1._leaving = false;
8682 this$1.$forceUpdate();
8683 });
8684 return placeholder(h, rawChild)
8685 } else if (mode === 'in-out') {
8686 if (isAsyncPlaceholder(child)) {
8687 return oldRawChild
8688 }
8689 var delayedLeave;
8690 var performLeave = function () { delayedLeave(); };
8691 mergeVNodeHook(data, 'afterEnter', performLeave);
8692 mergeVNodeHook(data, 'enterCancelled', performLeave);
8693 mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
8694 }
8695 }
8696
8697 return rawChild
8698 }
8699};
8700
8701/* */
8702
8703var props = extend({
8704 tag: String,
8705 moveClass: String
8706}, transitionProps);
8707
8708delete props.mode;
8709
8710var TransitionGroup = {
8711 props: props,
8712
8713 beforeMount: function beforeMount () {
8714 var this$1 = this;
8715
8716 var update = this._update;
8717 this._update = function (vnode, hydrating) {
8718 var restoreActiveInstance = setActiveInstance(this$1);
8719 // force removing pass
8720 this$1.__patch__(
8721 this$1._vnode,
8722 this$1.kept,
8723 false, // hydrating
8724 true // removeOnly (!important, avoids unnecessary moves)
8725 );
8726 this$1._vnode = this$1.kept;
8727 restoreActiveInstance();
8728 update.call(this$1, vnode, hydrating);
8729 };
8730 },
8731
8732 render: function render (h) {
8733 var tag = this.tag || this.$vnode.data.tag || 'span';
8734 var map = Object.create(null);
8735 var prevChildren = this.prevChildren = this.children;
8736 var rawChildren = this.$slots.default || [];
8737 var children = this.children = [];
8738 var transitionData = extractTransitionData(this);
8739
8740 for (var i = 0; i < rawChildren.length; i++) {
8741 var c = rawChildren[i];
8742 if (c.tag) {
8743 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
8744 children.push(c);
8745 map[c.key] = c
8746 ;(c.data || (c.data = {})).transition = transitionData;
8747 } else {
8748 var opts = c.componentOptions;
8749 var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
8750 warn(("<transition-group> children must be keyed: <" + name + ">"));
8751 }
8752 }
8753 }
8754
8755 if (prevChildren) {
8756 var kept = [];
8757 var removed = [];
8758 for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
8759 var c$1 = prevChildren[i$1];
8760 c$1.data.transition = transitionData;
8761 c$1.data.pos = c$1.elm.getBoundingClientRect();
8762 if (map[c$1.key]) {
8763 kept.push(c$1);
8764 } else {
8765 removed.push(c$1);
8766 }
8767 }
8768 this.kept = h(tag, null, kept);
8769 this.removed = removed;
8770 }
8771
8772 return h(tag, null, children)
8773 },
8774
8775 updated: function updated () {
8776 var children = this.prevChildren;
8777 var moveClass = this.moveClass || ((this.name || 'v') + '-move');
8778 if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
8779 return
8780 }
8781
8782 // we divide the work into three loops to avoid mixing DOM reads and writes
8783 // in each iteration - which helps prevent layout thrashing.
8784 children.forEach(callPendingCbs);
8785 children.forEach(recordPosition);
8786 children.forEach(applyTranslation);
8787
8788 // force reflow to put everything in position
8789 // assign to this to avoid being removed in tree-shaking
8790 // $flow-disable-line
8791 this._reflow = document.body.offsetHeight;
8792
8793 children.forEach(function (c) {
8794 if (c.data.moved) {
8795 var el = c.elm;
8796 var s = el.style;
8797 addTransitionClass(el, moveClass);
8798 s.transform = s.WebkitTransform = s.transitionDuration = '';
8799 el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
8800 if (e && e.target !== el) {
8801 return
8802 }
8803 if (!e || /transform$/.test(e.propertyName)) {
8804 el.removeEventListener(transitionEndEvent, cb);
8805 el._moveCb = null;
8806 removeTransitionClass(el, moveClass);
8807 }
8808 });
8809 }
8810 });
8811 },
8812
8813 methods: {
8814 hasMove: function hasMove (el, moveClass) {
8815 /* istanbul ignore if */
8816 if (!hasTransition) {
8817 return false
8818 }
8819 /* istanbul ignore if */
8820 if (this._hasMove) {
8821 return this._hasMove
8822 }
8823 // Detect whether an element with the move class applied has
8824 // CSS transitions. Since the element may be inside an entering
8825 // transition at this very moment, we make a clone of it and remove
8826 // all other transition classes applied to ensure only the move class
8827 // is applied.
8828 var clone = el.cloneNode();
8829 if (el._transitionClasses) {
8830 el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
8831 }
8832 addClass(clone, moveClass);
8833 clone.style.display = 'none';
8834 this.$el.appendChild(clone);
8835 var info = getTransitionInfo(clone);
8836 this.$el.removeChild(clone);
8837 return (this._hasMove = info.hasTransform)
8838 }
8839 }
8840};
8841
8842function callPendingCbs (c) {
8843 /* istanbul ignore if */
8844 if (c.elm._moveCb) {
8845 c.elm._moveCb();
8846 }
8847 /* istanbul ignore if */
8848 if (c.elm._enterCb) {
8849 c.elm._enterCb();
8850 }
8851}
8852
8853function recordPosition (c) {
8854 c.data.newPos = c.elm.getBoundingClientRect();
8855}
8856
8857function applyTranslation (c) {
8858 var oldPos = c.data.pos;
8859 var newPos = c.data.newPos;
8860 var dx = oldPos.left - newPos.left;
8861 var dy = oldPos.top - newPos.top;
8862 if (dx || dy) {
8863 c.data.moved = true;
8864 var s = c.elm.style;
8865 s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
8866 s.transitionDuration = '0s';
8867 }
8868}
8869
8870var platformComponents = {
8871 Transition: Transition,
8872 TransitionGroup: TransitionGroup
8873};
8874
8875/* */
8876
8877// install platform specific utils
8878Vue.config.mustUseProp = mustUseProp;
8879Vue.config.isReservedTag = isReservedTag;
8880Vue.config.isReservedAttr = isReservedAttr;
8881Vue.config.getTagNamespace = getTagNamespace;
8882Vue.config.isUnknownElement = isUnknownElement;
8883
8884// install platform runtime directives & components
8885extend(Vue.options.directives, platformDirectives);
8886extend(Vue.options.components, platformComponents);
8887
8888// install platform patch function
8889Vue.prototype.__patch__ = inBrowser ? patch : noop;
8890
8891// public mount method
8892Vue.prototype.$mount = function (
8893 el,
8894 hydrating
8895) {
8896 el = el && inBrowser ? query(el) : undefined;
8897 return mountComponent(this, el, hydrating)
8898};
8899
8900// devtools global hook
8901/* istanbul ignore next */
8902if (inBrowser) {
8903 setTimeout(function () {
8904 if (config.devtools) {
8905 if (devtools) {
8906 devtools.emit('init', Vue);
8907 } else {
8908 console[console.info ? 'info' : 'log'](
8909 'Download the Vue Devtools extension for a better development experience:\n' +
8910 'https://github.com/vuejs/vue-devtools'
8911 );
8912 }
8913 }
8914 if (config.productionTip !== false &&
8915 typeof console !== 'undefined'
8916 ) {
8917 console[console.info ? 'info' : 'log'](
8918 "You are running Vue in development mode.\n" +
8919 "Make sure to turn on production mode when deploying for production.\n" +
8920 "See more tips at https://vuejs.org/guide/deployment.html"
8921 );
8922 }
8923 }, 0);
8924}
8925
8926/* */
8927
8928var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
8929var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
8930
8931var buildRegex = cached(function (delimiters) {
8932 var open = delimiters[0].replace(regexEscapeRE, '\\$&');
8933 var close = delimiters[1].replace(regexEscapeRE, '\\$&');
8934 return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
8935});
8936
8937
8938
8939function parseText (
8940 text,
8941 delimiters
8942) {
8943 var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
8944 if (!tagRE.test(text)) {
8945 return
8946 }
8947 var tokens = [];
8948 var rawTokens = [];
8949 var lastIndex = tagRE.lastIndex = 0;
8950 var match, index, tokenValue;
8951 while ((match = tagRE.exec(text))) {
8952 index = match.index;
8953 // push text token
8954 if (index > lastIndex) {
8955 rawTokens.push(tokenValue = text.slice(lastIndex, index));
8956 tokens.push(JSON.stringify(tokenValue));
8957 }
8958 // tag token
8959 var exp = parseFilters(match[1].trim());
8960 tokens.push(("_s(" + exp + ")"));
8961 rawTokens.push({ '@binding': exp });
8962 lastIndex = index + match[0].length;
8963 }
8964 if (lastIndex < text.length) {
8965 rawTokens.push(tokenValue = text.slice(lastIndex));
8966 tokens.push(JSON.stringify(tokenValue));
8967 }
8968 return {
8969 expression: tokens.join('+'),
8970 tokens: rawTokens
8971 }
8972}
8973
8974/* */
8975
8976function transformNode (el, options) {
8977 var warn = options.warn || baseWarn;
8978 var staticClass = getAndRemoveAttr(el, 'class');
8979 if (staticClass) {
8980 var res = parseText(staticClass, options.delimiters);
8981 if (res) {
8982 warn(
8983 "class=\"" + staticClass + "\": " +
8984 'Interpolation inside attributes has been removed. ' +
8985 'Use v-bind or the colon shorthand instead. For example, ' +
8986 'instead of <div class="{{ val }}">, use <div :class="val">.',
8987 el.rawAttrsMap['class']
8988 );
8989 }
8990 }
8991 if (staticClass) {
8992 el.staticClass = JSON.stringify(staticClass);
8993 }
8994 var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
8995 if (classBinding) {
8996 el.classBinding = classBinding;
8997 }
8998}
8999
9000function genData (el) {
9001 var data = '';
9002 if (el.staticClass) {
9003 data += "staticClass:" + (el.staticClass) + ",";
9004 }
9005 if (el.classBinding) {
9006 data += "class:" + (el.classBinding) + ",";
9007 }
9008 return data
9009}
9010
9011var klass$1 = {
9012 staticKeys: ['staticClass'],
9013 transformNode: transformNode,
9014 genData: genData
9015};
9016
9017/* */
9018
9019function transformNode$1 (el, options) {
9020 var warn = options.warn || baseWarn;
9021 var staticStyle = getAndRemoveAttr(el, 'style');
9022 if (staticStyle) {
9023 /* istanbul ignore if */
9024 {
9025 var res = parseText(staticStyle, options.delimiters);
9026 if (res) {
9027 warn(
9028 "style=\"" + staticStyle + "\": " +
9029 'Interpolation inside attributes has been removed. ' +
9030 'Use v-bind or the colon shorthand instead. For example, ' +
9031 'instead of <div style="{{ val }}">, use <div :style="val">.',
9032 el.rawAttrsMap['style']
9033 );
9034 }
9035 }
9036 el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
9037 }
9038
9039 var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
9040 if (styleBinding) {
9041 el.styleBinding = styleBinding;
9042 }
9043}
9044
9045function genData$1 (el) {
9046 var data = '';
9047 if (el.staticStyle) {
9048 data += "staticStyle:" + (el.staticStyle) + ",";
9049 }
9050 if (el.styleBinding) {
9051 data += "style:(" + (el.styleBinding) + "),";
9052 }
9053 return data
9054}
9055
9056var style$1 = {
9057 staticKeys: ['staticStyle'],
9058 transformNode: transformNode$1,
9059 genData: genData$1
9060};
9061
9062/* */
9063
9064var decoder;
9065
9066var he = {
9067 decode: function decode (html) {
9068 decoder = decoder || document.createElement('div');
9069 decoder.innerHTML = html;
9070 return decoder.textContent
9071 }
9072};
9073
9074/* */
9075
9076var isUnaryTag = makeMap(
9077 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
9078 'link,meta,param,source,track,wbr'
9079);
9080
9081// Elements that you can, intentionally, leave open
9082// (and which close themselves)
9083var canBeLeftOpenTag = makeMap(
9084 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
9085);
9086
9087// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
9088// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
9089var isNonPhrasingTag = makeMap(
9090 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
9091 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
9092 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
9093 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
9094 'title,tr,track'
9095);
9096
9097/**
9098 * Not type-checking this file because it's mostly vendor code.
9099 */
9100
9101// Regular Expressions for parsing tags and attributes
9102var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9103var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9104var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + unicodeLetters + "]*";
9105var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
9106var startTagOpen = new RegExp(("^<" + qnameCapture));
9107var startTagClose = /^\s*(\/?)>/;
9108var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
9109var doctype = /^<!DOCTYPE [^>]+>/i;
9110// #7298: escape - to avoid being pased as HTML comment when inlined in page
9111var comment = /^<!\--/;
9112var conditionalComment = /^<!\[/;
9113
9114// Special Elements (can contain anything)
9115var isPlainTextElement = makeMap('script,style,textarea', true);
9116var reCache = {};
9117
9118var decodingMap = {
9119 '&lt;': '<',
9120 '&gt;': '>',
9121 '&quot;': '"',
9122 '&amp;': '&',
9123 '&#10;': '\n',
9124 '&#9;': '\t'
9125};
9126var encodedAttr = /&(?:lt|gt|quot|amp);/g;
9127var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10|#9);/g;
9128
9129// #5992
9130var isIgnoreNewlineTag = makeMap('pre,textarea', true);
9131var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
9132
9133function decodeAttr (value, shouldDecodeNewlines) {
9134 var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
9135 return value.replace(re, function (match) { return decodingMap[match]; })
9136}
9137
9138function parseHTML (html, options) {
9139 var stack = [];
9140 var expectHTML = options.expectHTML;
9141 var isUnaryTag$$1 = options.isUnaryTag || no;
9142 var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
9143 var index = 0;
9144 var last, lastTag;
9145 while (html) {
9146 last = html;
9147 // Make sure we're not in a plaintext content element like script/style
9148 if (!lastTag || !isPlainTextElement(lastTag)) {
9149 var textEnd = html.indexOf('<');
9150 if (textEnd === 0) {
9151 // Comment:
9152 if (comment.test(html)) {
9153 var commentEnd = html.indexOf('-->');
9154
9155 if (commentEnd >= 0) {
9156 if (options.shouldKeepComment) {
9157 options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
9158 }
9159 advance(commentEnd + 3);
9160 continue
9161 }
9162 }
9163
9164 // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
9165 if (conditionalComment.test(html)) {
9166 var conditionalEnd = html.indexOf(']>');
9167
9168 if (conditionalEnd >= 0) {
9169 advance(conditionalEnd + 2);
9170 continue
9171 }
9172 }
9173
9174 // Doctype:
9175 var doctypeMatch = html.match(doctype);
9176 if (doctypeMatch) {
9177 advance(doctypeMatch[0].length);
9178 continue
9179 }
9180
9181 // End tag:
9182 var endTagMatch = html.match(endTag);
9183 if (endTagMatch) {
9184 var curIndex = index;
9185 advance(endTagMatch[0].length);
9186 parseEndTag(endTagMatch[1], curIndex, index);
9187 continue
9188 }
9189
9190 // Start tag:
9191 var startTagMatch = parseStartTag();
9192 if (startTagMatch) {
9193 handleStartTag(startTagMatch);
9194 if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
9195 advance(1);
9196 }
9197 continue
9198 }
9199 }
9200
9201 var text = (void 0), rest = (void 0), next = (void 0);
9202 if (textEnd >= 0) {
9203 rest = html.slice(textEnd);
9204 while (
9205 !endTag.test(rest) &&
9206 !startTagOpen.test(rest) &&
9207 !comment.test(rest) &&
9208 !conditionalComment.test(rest)
9209 ) {
9210 // < in plain text, be forgiving and treat it as text
9211 next = rest.indexOf('<', 1);
9212 if (next < 0) { break }
9213 textEnd += next;
9214 rest = html.slice(textEnd);
9215 }
9216 text = html.substring(0, textEnd);
9217 }
9218
9219 if (textEnd < 0) {
9220 text = html;
9221 }
9222
9223 if (text) {
9224 advance(text.length);
9225 }
9226
9227 if (options.chars && text) {
9228 options.chars(text, index - text.length, index);
9229 }
9230 } else {
9231 var endTagLength = 0;
9232 var stackedTag = lastTag.toLowerCase();
9233 var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
9234 var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
9235 endTagLength = endTag.length;
9236 if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
9237 text = text
9238 .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
9239 .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
9240 }
9241 if (shouldIgnoreFirstNewline(stackedTag, text)) {
9242 text = text.slice(1);
9243 }
9244 if (options.chars) {
9245 options.chars(text);
9246 }
9247 return ''
9248 });
9249 index += html.length - rest$1.length;
9250 html = rest$1;
9251 parseEndTag(stackedTag, index - endTagLength, index);
9252 }
9253
9254 if (html === last) {
9255 options.chars && options.chars(html);
9256 if (!stack.length && options.warn) {
9257 options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
9258 }
9259 break
9260 }
9261 }
9262
9263 // Clean up any remaining tags
9264 parseEndTag();
9265
9266 function advance (n) {
9267 index += n;
9268 html = html.substring(n);
9269 }
9270
9271 function parseStartTag () {
9272 var start = html.match(startTagOpen);
9273 if (start) {
9274 var match = {
9275 tagName: start[1],
9276 attrs: [],
9277 start: index
9278 };
9279 advance(start[0].length);
9280 var end, attr;
9281 while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
9282 attr.start = index;
9283 advance(attr[0].length);
9284 attr.end = index;
9285 match.attrs.push(attr);
9286 }
9287 if (end) {
9288 match.unarySlash = end[1];
9289 advance(end[0].length);
9290 match.end = index;
9291 return match
9292 }
9293 }
9294 }
9295
9296 function handleStartTag (match) {
9297 var tagName = match.tagName;
9298 var unarySlash = match.unarySlash;
9299
9300 if (expectHTML) {
9301 if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
9302 parseEndTag(lastTag);
9303 }
9304 if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
9305 parseEndTag(tagName);
9306 }
9307 }
9308
9309 var unary = isUnaryTag$$1(tagName) || !!unarySlash;
9310
9311 var l = match.attrs.length;
9312 var attrs = new Array(l);
9313 for (var i = 0; i < l; i++) {
9314 var args = match.attrs[i];
9315 var value = args[3] || args[4] || args[5] || '';
9316 var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
9317 ? options.shouldDecodeNewlinesForHref
9318 : options.shouldDecodeNewlines;
9319 attrs[i] = {
9320 name: args[1],
9321 value: decodeAttr(value, shouldDecodeNewlines)
9322 };
9323 if (options.outputSourceRange) {
9324 attrs[i].start = args.start + args[0].match(/^\s*/).length;
9325 attrs[i].end = args.end;
9326 }
9327 }
9328
9329 if (!unary) {
9330 stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
9331 lastTag = tagName;
9332 }
9333
9334 if (options.start) {
9335 options.start(tagName, attrs, unary, match.start, match.end);
9336 }
9337 }
9338
9339 function parseEndTag (tagName, start, end) {
9340 var pos, lowerCasedTagName;
9341 if (start == null) { start = index; }
9342 if (end == null) { end = index; }
9343
9344 // Find the closest opened tag of the same type
9345 if (tagName) {
9346 lowerCasedTagName = tagName.toLowerCase();
9347 for (pos = stack.length - 1; pos >= 0; pos--) {
9348 if (stack[pos].lowerCasedTag === lowerCasedTagName) {
9349 break
9350 }
9351 }
9352 } else {
9353 // If no tag name is provided, clean shop
9354 pos = 0;
9355 }
9356
9357 if (pos >= 0) {
9358 // Close all the open elements, up the stack
9359 for (var i = stack.length - 1; i >= pos; i--) {
9360 if (i > pos || !tagName &&
9361 options.warn
9362 ) {
9363 options.warn(
9364 ("tag <" + (stack[i].tag) + "> has no matching end tag."),
9365 { start: stack[i].start }
9366 );
9367 }
9368 if (options.end) {
9369 options.end(stack[i].tag, start, end);
9370 }
9371 }
9372
9373 // Remove the open elements from the stack
9374 stack.length = pos;
9375 lastTag = pos && stack[pos - 1].tag;
9376 } else if (lowerCasedTagName === 'br') {
9377 if (options.start) {
9378 options.start(tagName, [], true, start, end);
9379 }
9380 } else if (lowerCasedTagName === 'p') {
9381 if (options.start) {
9382 options.start(tagName, [], false, start, end);
9383 }
9384 if (options.end) {
9385 options.end(tagName, start, end);
9386 }
9387 }
9388 }
9389}
9390
9391/* */
9392
9393var onRE = /^@|^v-on:/;
9394var dirRE = /^v-|^@|^:/;
9395var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
9396var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
9397var stripParensRE = /^\(|\)$/g;
9398var dynamicArgRE = /^\[.*\]$/;
9399
9400var argRE = /:(.*)$/;
9401var bindRE = /^:|^\.|^v-bind:/;
9402var modifierRE = /\.[^.]+/g;
9403
9404var slotRE = /^v-slot(:|$)|^#/;
9405
9406var lineBreakRE = /[\r\n]/;
9407var whitespaceRE$1 = /\s+/g;
9408
9409var invalidAttributeRE = /[\s"'<>\/=]/;
9410
9411var decodeHTMLCached = cached(he.decode);
9412
9413// configurable state
9414var warn$2;
9415var delimiters;
9416var transforms;
9417var preTransforms;
9418var postTransforms;
9419var platformIsPreTag;
9420var platformMustUseProp;
9421var platformGetTagNamespace;
9422var maybeComponent;
9423
9424function createASTElement (
9425 tag,
9426 attrs,
9427 parent
9428) {
9429 return {
9430 type: 1,
9431 tag: tag,
9432 attrsList: attrs,
9433 attrsMap: makeAttrsMap(attrs),
9434 rawAttrsMap: {},
9435 parent: parent,
9436 children: []
9437 }
9438}
9439
9440/**
9441 * Convert HTML string to AST.
9442 */
9443function parse (
9444 template,
9445 options
9446) {
9447 warn$2 = options.warn || baseWarn;
9448
9449 platformIsPreTag = options.isPreTag || no;
9450 platformMustUseProp = options.mustUseProp || no;
9451 platformGetTagNamespace = options.getTagNamespace || no;
9452 var isReservedTag = options.isReservedTag || no;
9453 maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
9454
9455 transforms = pluckModuleFunction(options.modules, 'transformNode');
9456 preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
9457 postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
9458
9459 delimiters = options.delimiters;
9460
9461 var stack = [];
9462 var preserveWhitespace = options.preserveWhitespace !== false;
9463 var whitespaceOption = options.whitespace;
9464 var root;
9465 var currentParent;
9466 var inVPre = false;
9467 var inPre = false;
9468 var warned = false;
9469
9470 function warnOnce (msg, range) {
9471 if (!warned) {
9472 warned = true;
9473 warn$2(msg, range);
9474 }
9475 }
9476
9477 function closeElement (element) {
9478 trimEndingWhitespace(element);
9479 if (!inVPre && !element.processed) {
9480 element = processElement(element, options);
9481 }
9482 // tree management
9483 if (!stack.length && element !== root) {
9484 // allow root elements with v-if, v-else-if and v-else
9485 if (root.if && (element.elseif || element.else)) {
9486 {
9487 checkRootConstraints(element);
9488 }
9489 addIfCondition(root, {
9490 exp: element.elseif,
9491 block: element
9492 });
9493 } else {
9494 warnOnce(
9495 "Component template should contain exactly one root element. " +
9496 "If you are using v-if on multiple elements, " +
9497 "use v-else-if to chain them instead.",
9498 { start: element.start }
9499 );
9500 }
9501 }
9502 if (currentParent && !element.forbidden) {
9503 if (element.elseif || element.else) {
9504 processIfConditions(element, currentParent);
9505 } else {
9506 if (element.slotScope) {
9507 // scoped slot
9508 // keep it in the children list so that v-else(-if) conditions can
9509 // find it as the prev node.
9510 var name = element.slotTarget || '"default"'
9511 ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
9512 }
9513 currentParent.children.push(element);
9514 element.parent = currentParent;
9515 }
9516 }
9517
9518 // final children cleanup
9519 // filter out scoped slots
9520 element.children = element.children.filter(function (c) { return !(c).slotScope; });
9521 // remove trailing whitespace node again
9522 trimEndingWhitespace(element);
9523
9524 // check pre state
9525 if (element.pre) {
9526 inVPre = false;
9527 }
9528 if (platformIsPreTag(element.tag)) {
9529 inPre = false;
9530 }
9531 // apply post-transforms
9532 for (var i = 0; i < postTransforms.length; i++) {
9533 postTransforms[i](element, options);
9534 }
9535 }
9536
9537 function trimEndingWhitespace (el) {
9538 // remove trailing whitespace node
9539 if (!inPre) {
9540 var lastNode;
9541 while (
9542 (lastNode = el.children[el.children.length - 1]) &&
9543 lastNode.type === 3 &&
9544 lastNode.text === ' '
9545 ) {
9546 el.children.pop();
9547 }
9548 }
9549 }
9550
9551 function checkRootConstraints (el) {
9552 if (el.tag === 'slot' || el.tag === 'template') {
9553 warnOnce(
9554 "Cannot use <" + (el.tag) + "> as component root element because it may " +
9555 'contain multiple nodes.',
9556 { start: el.start }
9557 );
9558 }
9559 if (el.attrsMap.hasOwnProperty('v-for')) {
9560 warnOnce(
9561 'Cannot use v-for on stateful component root element because ' +
9562 'it renders multiple elements.',
9563 el.rawAttrsMap['v-for']
9564 );
9565 }
9566 }
9567
9568 parseHTML(template, {
9569 warn: warn$2,
9570 expectHTML: options.expectHTML,
9571 isUnaryTag: options.isUnaryTag,
9572 canBeLeftOpenTag: options.canBeLeftOpenTag,
9573 shouldDecodeNewlines: options.shouldDecodeNewlines,
9574 shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
9575 shouldKeepComment: options.comments,
9576 outputSourceRange: options.outputSourceRange,
9577 start: function start (tag, attrs, unary, start$1) {
9578 // check namespace.
9579 // inherit parent ns if there is one
9580 var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
9581
9582 // handle IE svg bug
9583 /* istanbul ignore if */
9584 if (isIE && ns === 'svg') {
9585 attrs = guardIESVGBug(attrs);
9586 }
9587
9588 var element = createASTElement(tag, attrs, currentParent);
9589 if (ns) {
9590 element.ns = ns;
9591 }
9592
9593 {
9594 if (options.outputSourceRange) {
9595 element.start = start$1;
9596 element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
9597 cumulated[attr.name] = attr;
9598 return cumulated
9599 }, {});
9600 }
9601 attrs.forEach(function (attr) {
9602 if (invalidAttributeRE.test(attr.name)) {
9603 warn$2(
9604 "Invalid dynamic argument expression: attribute names cannot contain " +
9605 "spaces, quotes, <, >, / or =.",
9606 {
9607 start: attr.start + attr.name.indexOf("["),
9608 end: attr.start + attr.name.length
9609 }
9610 );
9611 }
9612 });
9613 }
9614
9615 if (isForbiddenTag(element) && !isServerRendering()) {
9616 element.forbidden = true;
9617 warn$2(
9618 'Templates should only be responsible for mapping the state to the ' +
9619 'UI. Avoid placing tags with side-effects in your templates, such as ' +
9620 "<" + tag + ">" + ', as they will not be parsed.',
9621 { start: element.start }
9622 );
9623 }
9624
9625 // apply pre-transforms
9626 for (var i = 0; i < preTransforms.length; i++) {
9627 element = preTransforms[i](element, options) || element;
9628 }
9629
9630 if (!inVPre) {
9631 processPre(element);
9632 if (element.pre) {
9633 inVPre = true;
9634 }
9635 }
9636 if (platformIsPreTag(element.tag)) {
9637 inPre = true;
9638 }
9639 if (inVPre) {
9640 processRawAttrs(element);
9641 } else if (!element.processed) {
9642 // structural directives
9643 processFor(element);
9644 processIf(element);
9645 processOnce(element);
9646 }
9647
9648 if (!root) {
9649 root = element;
9650 {
9651 checkRootConstraints(root);
9652 }
9653 }
9654
9655 if (!unary) {
9656 currentParent = element;
9657 stack.push(element);
9658 } else {
9659 closeElement(element);
9660 }
9661 },
9662
9663 end: function end (tag, start, end$1) {
9664 var element = stack[stack.length - 1];
9665 // pop stack
9666 stack.length -= 1;
9667 currentParent = stack[stack.length - 1];
9668 if (options.outputSourceRange) {
9669 element.end = end$1;
9670 }
9671 closeElement(element);
9672 },
9673
9674 chars: function chars (text, start, end) {
9675 if (!currentParent) {
9676 {
9677 if (text === template) {
9678 warnOnce(
9679 'Component template requires a root element, rather than just text.',
9680 { start: start }
9681 );
9682 } else if ((text = text.trim())) {
9683 warnOnce(
9684 ("text \"" + text + "\" outside root element will be ignored."),
9685 { start: start }
9686 );
9687 }
9688 }
9689 return
9690 }
9691 // IE textarea placeholder bug
9692 /* istanbul ignore if */
9693 if (isIE &&
9694 currentParent.tag === 'textarea' &&
9695 currentParent.attrsMap.placeholder === text
9696 ) {
9697 return
9698 }
9699 var children = currentParent.children;
9700 if (inPre || text.trim()) {
9701 text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
9702 } else if (!children.length) {
9703 // remove the whitespace-only node right after an opening tag
9704 text = '';
9705 } else if (whitespaceOption) {
9706 if (whitespaceOption === 'condense') {
9707 // in condense mode, remove the whitespace node if it contains
9708 // line break, otherwise condense to a single space
9709 text = lineBreakRE.test(text) ? '' : ' ';
9710 } else {
9711 text = ' ';
9712 }
9713 } else {
9714 text = preserveWhitespace ? ' ' : '';
9715 }
9716 if (text) {
9717 if (whitespaceOption === 'condense') {
9718 // condense consecutive whitespaces into single space
9719 text = text.replace(whitespaceRE$1, ' ');
9720 }
9721 var res;
9722 var child;
9723 if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
9724 child = {
9725 type: 2,
9726 expression: res.expression,
9727 tokens: res.tokens,
9728 text: text
9729 };
9730 } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
9731 child = {
9732 type: 3,
9733 text: text
9734 };
9735 }
9736 if (child) {
9737 if (options.outputSourceRange) {
9738 child.start = start;
9739 child.end = end;
9740 }
9741 children.push(child);
9742 }
9743 }
9744 },
9745 comment: function comment (text, start, end) {
9746 var child = {
9747 type: 3,
9748 text: text,
9749 isComment: true
9750 };
9751 if (options.outputSourceRange) {
9752 child.start = start;
9753 child.end = end;
9754 }
9755 currentParent.children.push(child);
9756 }
9757 });
9758 return root
9759}
9760
9761function processPre (el) {
9762 if (getAndRemoveAttr(el, 'v-pre') != null) {
9763 el.pre = true;
9764 }
9765}
9766
9767function processRawAttrs (el) {
9768 var list = el.attrsList;
9769 var len = list.length;
9770 if (len) {
9771 var attrs = el.attrs = new Array(len);
9772 for (var i = 0; i < len; i++) {
9773 attrs[i] = {
9774 name: list[i].name,
9775 value: JSON.stringify(list[i].value)
9776 };
9777 if (list[i].start != null) {
9778 attrs[i].start = list[i].start;
9779 attrs[i].end = list[i].end;
9780 }
9781 }
9782 } else if (!el.pre) {
9783 // non root node in pre blocks with no attributes
9784 el.plain = true;
9785 }
9786}
9787
9788function processElement (
9789 element,
9790 options
9791) {
9792 processKey(element);
9793
9794 // determine whether this is a plain element after
9795 // removing structural attributes
9796 element.plain = (
9797 !element.key &&
9798 !element.scopedSlots &&
9799 !element.attrsList.length
9800 );
9801
9802 processRef(element);
9803 processSlotContent(element);
9804 processSlotOutlet(element);
9805 processComponent(element);
9806 for (var i = 0; i < transforms.length; i++) {
9807 element = transforms[i](element, options) || element;
9808 }
9809 processAttrs(element);
9810 return element
9811}
9812
9813function processKey (el) {
9814 var exp = getBindingAttr(el, 'key');
9815 if (exp) {
9816 {
9817 if (el.tag === 'template') {
9818 warn$2(
9819 "<template> cannot be keyed. Place the key on real elements instead.",
9820 getRawBindingAttr(el, 'key')
9821 );
9822 }
9823 if (el.for) {
9824 var iterator = el.iterator2 || el.iterator1;
9825 var parent = el.parent;
9826 if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
9827 warn$2(
9828 "Do not use v-for index as key on <transition-group> children, " +
9829 "this is the same as not using keys.",
9830 getRawBindingAttr(el, 'key'),
9831 true /* tip */
9832 );
9833 }
9834 }
9835 }
9836 el.key = exp;
9837 }
9838}
9839
9840function processRef (el) {
9841 var ref = getBindingAttr(el, 'ref');
9842 if (ref) {
9843 el.ref = ref;
9844 el.refInFor = checkInFor(el);
9845 }
9846}
9847
9848function processFor (el) {
9849 var exp;
9850 if ((exp = getAndRemoveAttr(el, 'v-for'))) {
9851 var res = parseFor(exp);
9852 if (res) {
9853 extend(el, res);
9854 } else {
9855 warn$2(
9856 ("Invalid v-for expression: " + exp),
9857 el.rawAttrsMap['v-for']
9858 );
9859 }
9860 }
9861}
9862
9863
9864
9865function parseFor (exp) {
9866 var inMatch = exp.match(forAliasRE);
9867 if (!inMatch) { return }
9868 var res = {};
9869 res.for = inMatch[2].trim();
9870 var alias = inMatch[1].trim().replace(stripParensRE, '');
9871 var iteratorMatch = alias.match(forIteratorRE);
9872 if (iteratorMatch) {
9873 res.alias = alias.replace(forIteratorRE, '').trim();
9874 res.iterator1 = iteratorMatch[1].trim();
9875 if (iteratorMatch[2]) {
9876 res.iterator2 = iteratorMatch[2].trim();
9877 }
9878 } else {
9879 res.alias = alias;
9880 }
9881 return res
9882}
9883
9884function processIf (el) {
9885 var exp = getAndRemoveAttr(el, 'v-if');
9886 if (exp) {
9887 el.if = exp;
9888 addIfCondition(el, {
9889 exp: exp,
9890 block: el
9891 });
9892 } else {
9893 if (getAndRemoveAttr(el, 'v-else') != null) {
9894 el.else = true;
9895 }
9896 var elseif = getAndRemoveAttr(el, 'v-else-if');
9897 if (elseif) {
9898 el.elseif = elseif;
9899 }
9900 }
9901}
9902
9903function processIfConditions (el, parent) {
9904 var prev = findPrevElement(parent.children);
9905 if (prev && prev.if) {
9906 addIfCondition(prev, {
9907 exp: el.elseif,
9908 block: el
9909 });
9910 } else {
9911 warn$2(
9912 "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
9913 "used on element <" + (el.tag) + "> without corresponding v-if.",
9914 el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
9915 );
9916 }
9917}
9918
9919function findPrevElement (children) {
9920 var i = children.length;
9921 while (i--) {
9922 if (children[i].type === 1) {
9923 return children[i]
9924 } else {
9925 if (children[i].text !== ' ') {
9926 warn$2(
9927 "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
9928 "will be ignored.",
9929 children[i]
9930 );
9931 }
9932 children.pop();
9933 }
9934 }
9935}
9936
9937function addIfCondition (el, condition) {
9938 if (!el.ifConditions) {
9939 el.ifConditions = [];
9940 }
9941 el.ifConditions.push(condition);
9942}
9943
9944function processOnce (el) {
9945 var once$$1 = getAndRemoveAttr(el, 'v-once');
9946 if (once$$1 != null) {
9947 el.once = true;
9948 }
9949}
9950
9951// handle content being passed to a component as slot,
9952// e.g. <template slot="xxx">, <div slot-scope="xxx">
9953function processSlotContent (el) {
9954 var slotScope;
9955 if (el.tag === 'template') {
9956 slotScope = getAndRemoveAttr(el, 'scope');
9957 /* istanbul ignore if */
9958 if (slotScope) {
9959 warn$2(
9960 "the \"scope\" attribute for scoped slots have been deprecated and " +
9961 "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
9962 "can also be used on plain elements in addition to <template> to " +
9963 "denote scoped slots.",
9964 el.rawAttrsMap['scope'],
9965 true
9966 );
9967 }
9968 el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
9969 } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
9970 /* istanbul ignore if */
9971 if (el.attrsMap['v-for']) {
9972 warn$2(
9973 "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
9974 "(v-for takes higher priority). Use a wrapper <template> for the " +
9975 "scoped slot to make it clearer.",
9976 el.rawAttrsMap['slot-scope'],
9977 true
9978 );
9979 }
9980 el.slotScope = slotScope;
9981 }
9982
9983 // slot="xxx"
9984 var slotTarget = getBindingAttr(el, 'slot');
9985 if (slotTarget) {
9986 el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
9987 el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
9988 // preserve slot as an attribute for native shadow DOM compat
9989 // only for non-scoped slots.
9990 if (el.tag !== 'template' && !el.slotScope) {
9991 addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
9992 }
9993 }
9994
9995 // 2.6 v-slot syntax
9996 {
9997 if (el.tag === 'template') {
9998 // v-slot on <template>
9999 var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
10000 if (slotBinding) {
10001 {
10002 if (el.slotTarget || el.slotScope) {
10003 warn$2(
10004 "Unexpected mixed usage of different slot syntaxes.",
10005 el
10006 );
10007 }
10008 if (el.parent && !maybeComponent(el.parent)) {
10009 warn$2(
10010 "<template v-slot> can only appear at the root level inside " +
10011 "the receiving the component",
10012 el
10013 );
10014 }
10015 }
10016 var ref = getSlotName(slotBinding);
10017 var name = ref.name;
10018 var dynamic = ref.dynamic;
10019 el.slotTarget = name;
10020 el.slotTargetDynamic = dynamic;
10021 el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf
10022 }
10023 } else {
10024 // v-slot on component, denotes default slot
10025 var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
10026 if (slotBinding$1) {
10027 {
10028 if (!maybeComponent(el)) {
10029 warn$2(
10030 "v-slot can only be used on components or <template>.",
10031 slotBinding$1
10032 );
10033 }
10034 if (el.slotScope || el.slotTarget) {
10035 warn$2(
10036 "Unexpected mixed usage of different slot syntaxes.",
10037 el
10038 );
10039 }
10040 if (el.scopedSlots) {
10041 warn$2(
10042 "To avoid scope ambiguity, the default slot should also use " +
10043 "<template> syntax when there are other named slots.",
10044 slotBinding$1
10045 );
10046 }
10047 }
10048 // add the component's children to its default slot
10049 var slots = el.scopedSlots || (el.scopedSlots = {});
10050 var ref$1 = getSlotName(slotBinding$1);
10051 var name$1 = ref$1.name;
10052 var dynamic$1 = ref$1.dynamic;
10053 var slotContainer = slots[name$1] = createASTElement('template', [], el);
10054 slotContainer.slotTarget = name$1;
10055 slotContainer.slotTargetDynamic = dynamic$1;
10056 slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; });
10057 slotContainer.slotScope = slotBinding$1.value || "_";
10058 // remove children as they are returned from scopedSlots now
10059 el.children = [];
10060 // mark el non-plain so data gets generated
10061 el.plain = false;
10062 }
10063 }
10064 }
10065}
10066
10067function getSlotName (binding) {
10068 var name = binding.name.replace(slotRE, '');
10069 if (!name) {
10070 if (binding.name[0] !== '#') {
10071 name = 'default';
10072 } else {
10073 warn$2(
10074 "v-slot shorthand syntax requires a slot name.",
10075 binding
10076 );
10077 }
10078 }
10079 return dynamicArgRE.test(name)
10080 // dynamic [name]
10081 ? { name: name.slice(1, -1), dynamic: true }
10082 // static name
10083 : { name: ("\"" + name + "\""), dynamic: false }
10084}
10085
10086// handle <slot/> outlets
10087function processSlotOutlet (el) {
10088 if (el.tag === 'slot') {
10089 el.slotName = getBindingAttr(el, 'name');
10090 if (el.key) {
10091 warn$2(
10092 "`key` does not work on <slot> because slots are abstract outlets " +
10093 "and can possibly expand into multiple elements. " +
10094 "Use the key on a wrapping element instead.",
10095 getRawBindingAttr(el, 'key')
10096 );
10097 }
10098 }
10099}
10100
10101function processComponent (el) {
10102 var binding;
10103 if ((binding = getBindingAttr(el, 'is'))) {
10104 el.component = binding;
10105 }
10106 if (getAndRemoveAttr(el, 'inline-template') != null) {
10107 el.inlineTemplate = true;
10108 }
10109}
10110
10111function processAttrs (el) {
10112 var list = el.attrsList;
10113 var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
10114 for (i = 0, l = list.length; i < l; i++) {
10115 name = rawName = list[i].name;
10116 value = list[i].value;
10117 if (dirRE.test(name)) {
10118 // mark element as dynamic
10119 el.hasBindings = true;
10120 // modifiers
10121 modifiers = parseModifiers(name.replace(dirRE, ''));
10122 // support .foo shorthand syntax for the .prop modifier
10123 if (modifiers) {
10124 name = name.replace(modifierRE, '');
10125 }
10126 if (bindRE.test(name)) { // v-bind
10127 name = name.replace(bindRE, '');
10128 value = parseFilters(value);
10129 isDynamic = dynamicArgRE.test(name);
10130 if (isDynamic) {
10131 name = name.slice(1, -1);
10132 }
10133 if (
10134 value.trim().length === 0
10135 ) {
10136 warn$2(
10137 ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
10138 );
10139 }
10140 if (modifiers) {
10141 if (modifiers.prop && !isDynamic) {
10142 name = camelize(name);
10143 if (name === 'innerHtml') { name = 'innerHTML'; }
10144 }
10145 if (modifiers.camel && !isDynamic) {
10146 name = camelize(name);
10147 }
10148 if (modifiers.sync) {
10149 syncGen = genAssignmentCode(value, "$event");
10150 if (!isDynamic) {
10151 addHandler(
10152 el,
10153 ("update:" + (camelize(name))),
10154 syncGen,
10155 null,
10156 false,
10157 warn$2,
10158 list[i]
10159 );
10160 if (hyphenate(name) !== camelize(name)) {
10161 addHandler(
10162 el,
10163 ("update:" + (hyphenate(name))),
10164 syncGen,
10165 null,
10166 false,
10167 warn$2,
10168 list[i]
10169 );
10170 }
10171 } else {
10172 // handler w/ dynamic event name
10173 addHandler(
10174 el,
10175 ("\"update:\"+(" + name + ")"),
10176 syncGen,
10177 null,
10178 false,
10179 warn$2,
10180 list[i],
10181 true // dynamic
10182 );
10183 }
10184 }
10185 }
10186 if ((modifiers && modifiers.prop) || (
10187 !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
10188 )) {
10189 addProp(el, name, value, list[i], isDynamic);
10190 } else {
10191 addAttr(el, name, value, list[i], isDynamic);
10192 }
10193 } else if (onRE.test(name)) { // v-on
10194 name = name.replace(onRE, '');
10195 isDynamic = dynamicArgRE.test(name);
10196 if (isDynamic) {
10197 name = name.slice(1, -1);
10198 }
10199 addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
10200 } else { // normal directives
10201 name = name.replace(dirRE, '');
10202 // parse arg
10203 var argMatch = name.match(argRE);
10204 var arg = argMatch && argMatch[1];
10205 isDynamic = false;
10206 if (arg) {
10207 name = name.slice(0, -(arg.length + 1));
10208 if (dynamicArgRE.test(arg)) {
10209 arg = arg.slice(1, -1);
10210 isDynamic = true;
10211 }
10212 }
10213 addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
10214 if (name === 'model') {
10215 checkForAliasModel(el, value);
10216 }
10217 }
10218 } else {
10219 // literal attribute
10220 {
10221 var res = parseText(value, delimiters);
10222 if (res) {
10223 warn$2(
10224 name + "=\"" + value + "\": " +
10225 'Interpolation inside attributes has been removed. ' +
10226 'Use v-bind or the colon shorthand instead. For example, ' +
10227 'instead of <div id="{{ val }}">, use <div :id="val">.',
10228 list[i]
10229 );
10230 }
10231 }
10232 addAttr(el, name, JSON.stringify(value), list[i]);
10233 // #6887 firefox doesn't update muted state if set via attribute
10234 // even immediately after element creation
10235 if (!el.component &&
10236 name === 'muted' &&
10237 platformMustUseProp(el.tag, el.attrsMap.type, name)) {
10238 addProp(el, name, 'true', list[i]);
10239 }
10240 }
10241 }
10242}
10243
10244function checkInFor (el) {
10245 var parent = el;
10246 while (parent) {
10247 if (parent.for !== undefined) {
10248 return true
10249 }
10250 parent = parent.parent;
10251 }
10252 return false
10253}
10254
10255function parseModifiers (name) {
10256 var match = name.match(modifierRE);
10257 if (match) {
10258 var ret = {};
10259 match.forEach(function (m) { ret[m.slice(1)] = true; });
10260 return ret
10261 }
10262}
10263
10264function makeAttrsMap (attrs) {
10265 var map = {};
10266 for (var i = 0, l = attrs.length; i < l; i++) {
10267 if (
10268 map[attrs[i].name] && !isIE && !isEdge
10269 ) {
10270 warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
10271 }
10272 map[attrs[i].name] = attrs[i].value;
10273 }
10274 return map
10275}
10276
10277// for script (e.g. type="x/template") or style, do not decode content
10278function isTextTag (el) {
10279 return el.tag === 'script' || el.tag === 'style'
10280}
10281
10282function isForbiddenTag (el) {
10283 return (
10284 el.tag === 'style' ||
10285 (el.tag === 'script' && (
10286 !el.attrsMap.type ||
10287 el.attrsMap.type === 'text/javascript'
10288 ))
10289 )
10290}
10291
10292var ieNSBug = /^xmlns:NS\d+/;
10293var ieNSPrefix = /^NS\d+:/;
10294
10295/* istanbul ignore next */
10296function guardIESVGBug (attrs) {
10297 var res = [];
10298 for (var i = 0; i < attrs.length; i++) {
10299 var attr = attrs[i];
10300 if (!ieNSBug.test(attr.name)) {
10301 attr.name = attr.name.replace(ieNSPrefix, '');
10302 res.push(attr);
10303 }
10304 }
10305 return res
10306}
10307
10308function checkForAliasModel (el, value) {
10309 var _el = el;
10310 while (_el) {
10311 if (_el.for && _el.alias === value) {
10312 warn$2(
10313 "<" + (el.tag) + " v-model=\"" + value + "\">: " +
10314 "You are binding v-model directly to a v-for iteration alias. " +
10315 "This will not be able to modify the v-for source array because " +
10316 "writing to the alias is like modifying a function local variable. " +
10317 "Consider using an array of objects and use v-model on an object property instead.",
10318 el.rawAttrsMap['v-model']
10319 );
10320 }
10321 _el = _el.parent;
10322 }
10323}
10324
10325/* */
10326
10327function preTransformNode (el, options) {
10328 if (el.tag === 'input') {
10329 var map = el.attrsMap;
10330 if (!map['v-model']) {
10331 return
10332 }
10333
10334 var typeBinding;
10335 if (map[':type'] || map['v-bind:type']) {
10336 typeBinding = getBindingAttr(el, 'type');
10337 }
10338 if (!map.type && !typeBinding && map['v-bind']) {
10339 typeBinding = "(" + (map['v-bind']) + ").type";
10340 }
10341
10342 if (typeBinding) {
10343 var ifCondition = getAndRemoveAttr(el, 'v-if', true);
10344 var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
10345 var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
10346 var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
10347 // 1. checkbox
10348 var branch0 = cloneASTElement(el);
10349 // process for on the main node
10350 processFor(branch0);
10351 addRawAttr(branch0, 'type', 'checkbox');
10352 processElement(branch0, options);
10353 branch0.processed = true; // prevent it from double-processed
10354 branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
10355 addIfCondition(branch0, {
10356 exp: branch0.if,
10357 block: branch0
10358 });
10359 // 2. add radio else-if condition
10360 var branch1 = cloneASTElement(el);
10361 getAndRemoveAttr(branch1, 'v-for', true);
10362 addRawAttr(branch1, 'type', 'radio');
10363 processElement(branch1, options);
10364 addIfCondition(branch0, {
10365 exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
10366 block: branch1
10367 });
10368 // 3. other
10369 var branch2 = cloneASTElement(el);
10370 getAndRemoveAttr(branch2, 'v-for', true);
10371 addRawAttr(branch2, ':type', typeBinding);
10372 processElement(branch2, options);
10373 addIfCondition(branch0, {
10374 exp: ifCondition,
10375 block: branch2
10376 });
10377
10378 if (hasElse) {
10379 branch0.else = true;
10380 } else if (elseIfCondition) {
10381 branch0.elseif = elseIfCondition;
10382 }
10383
10384 return branch0
10385 }
10386 }
10387}
10388
10389function cloneASTElement (el) {
10390 return createASTElement(el.tag, el.attrsList.slice(), el.parent)
10391}
10392
10393var model$1 = {
10394 preTransformNode: preTransformNode
10395};
10396
10397var modules$1 = [
10398 klass$1,
10399 style$1,
10400 model$1
10401];
10402
10403/* */
10404
10405function text (el, dir) {
10406 if (dir.value) {
10407 addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
10408 }
10409}
10410
10411/* */
10412
10413function html (el, dir) {
10414 if (dir.value) {
10415 addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
10416 }
10417}
10418
10419var directives$1 = {
10420 model: model,
10421 text: text,
10422 html: html
10423};
10424
10425/* */
10426
10427var baseOptions = {
10428 expectHTML: true,
10429 modules: modules$1,
10430 directives: directives$1,
10431 isPreTag: isPreTag,
10432 isUnaryTag: isUnaryTag,
10433 mustUseProp: mustUseProp,
10434 canBeLeftOpenTag: canBeLeftOpenTag,
10435 isReservedTag: isReservedTag,
10436 getTagNamespace: getTagNamespace,
10437 staticKeys: genStaticKeys(modules$1)
10438};
10439
10440/* */
10441
10442var isStaticKey;
10443var isPlatformReservedTag;
10444
10445var genStaticKeysCached = cached(genStaticKeys$1);
10446
10447/**
10448 * Goal of the optimizer: walk the generated template AST tree
10449 * and detect sub-trees that are purely static, i.e. parts of
10450 * the DOM that never needs to change.
10451 *
10452 * Once we detect these sub-trees, we can:
10453 *
10454 * 1. Hoist them into constants, so that we no longer need to
10455 * create fresh nodes for them on each re-render;
10456 * 2. Completely skip them in the patching process.
10457 */
10458function optimize (root, options) {
10459 if (!root) { return }
10460 isStaticKey = genStaticKeysCached(options.staticKeys || '');
10461 isPlatformReservedTag = options.isReservedTag || no;
10462 // first pass: mark all non-static nodes.
10463 markStatic$1(root);
10464 // second pass: mark static roots.
10465 markStaticRoots(root, false);
10466}
10467
10468function genStaticKeys$1 (keys) {
10469 return makeMap(
10470 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
10471 (keys ? ',' + keys : '')
10472 )
10473}
10474
10475function markStatic$1 (node) {
10476 node.static = isStatic(node);
10477 if (node.type === 1) {
10478 // do not make component slot content static. this avoids
10479 // 1. components not able to mutate slot nodes
10480 // 2. static slot content fails for hot-reloading
10481 if (
10482 !isPlatformReservedTag(node.tag) &&
10483 node.tag !== 'slot' &&
10484 node.attrsMap['inline-template'] == null
10485 ) {
10486 return
10487 }
10488 for (var i = 0, l = node.children.length; i < l; i++) {
10489 var child = node.children[i];
10490 markStatic$1(child);
10491 if (!child.static) {
10492 node.static = false;
10493 }
10494 }
10495 if (node.ifConditions) {
10496 for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
10497 var block = node.ifConditions[i$1].block;
10498 markStatic$1(block);
10499 if (!block.static) {
10500 node.static = false;
10501 }
10502 }
10503 }
10504 }
10505}
10506
10507function markStaticRoots (node, isInFor) {
10508 if (node.type === 1) {
10509 if (node.static || node.once) {
10510 node.staticInFor = isInFor;
10511 }
10512 // For a node to qualify as a static root, it should have children that
10513 // are not just static text. Otherwise the cost of hoisting out will
10514 // outweigh the benefits and it's better off to just always render it fresh.
10515 if (node.static && node.children.length && !(
10516 node.children.length === 1 &&
10517 node.children[0].type === 3
10518 )) {
10519 node.staticRoot = true;
10520 return
10521 } else {
10522 node.staticRoot = false;
10523 }
10524 if (node.children) {
10525 for (var i = 0, l = node.children.length; i < l; i++) {
10526 markStaticRoots(node.children[i], isInFor || !!node.for);
10527 }
10528 }
10529 if (node.ifConditions) {
10530 for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
10531 markStaticRoots(node.ifConditions[i$1].block, isInFor);
10532 }
10533 }
10534 }
10535}
10536
10537function isStatic (node) {
10538 if (node.type === 2) { // expression
10539 return false
10540 }
10541 if (node.type === 3) { // text
10542 return true
10543 }
10544 return !!(node.pre || (
10545 !node.hasBindings && // no dynamic bindings
10546 !node.if && !node.for && // not v-if or v-for or v-else
10547 !isBuiltInTag(node.tag) && // not a built-in
10548 isPlatformReservedTag(node.tag) && // not a component
10549 !isDirectChildOfTemplateFor(node) &&
10550 Object.keys(node).every(isStaticKey)
10551 ))
10552}
10553
10554function isDirectChildOfTemplateFor (node) {
10555 while (node.parent) {
10556 node = node.parent;
10557 if (node.tag !== 'template') {
10558 return false
10559 }
10560 if (node.for) {
10561 return true
10562 }
10563 }
10564 return false
10565}
10566
10567/* */
10568
10569var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
10570var fnInvokeRE = /\([^)]*?\);*$/;
10571var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
10572
10573// KeyboardEvent.keyCode aliases
10574var keyCodes = {
10575 esc: 27,
10576 tab: 9,
10577 enter: 13,
10578 space: 32,
10579 up: 38,
10580 left: 37,
10581 right: 39,
10582 down: 40,
10583 'delete': [8, 46]
10584};
10585
10586// KeyboardEvent.key aliases
10587var keyNames = {
10588 // #7880: IE11 and Edge use `Esc` for Escape key name.
10589 esc: ['Esc', 'Escape'],
10590 tab: 'Tab',
10591 enter: 'Enter',
10592 // #9112: IE11 uses `Spacebar` for Space key name.
10593 space: [' ', 'Spacebar'],
10594 // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
10595 up: ['Up', 'ArrowUp'],
10596 left: ['Left', 'ArrowLeft'],
10597 right: ['Right', 'ArrowRight'],
10598 down: ['Down', 'ArrowDown'],
10599 // #9112: IE11 uses `Del` for Delete key name.
10600 'delete': ['Backspace', 'Delete', 'Del']
10601};
10602
10603// #4868: modifiers that prevent the execution of the listener
10604// need to explicitly return null so that we can determine whether to remove
10605// the listener for .once
10606var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
10607
10608var modifierCode = {
10609 stop: '$event.stopPropagation();',
10610 prevent: '$event.preventDefault();',
10611 self: genGuard("$event.target !== $event.currentTarget"),
10612 ctrl: genGuard("!$event.ctrlKey"),
10613 shift: genGuard("!$event.shiftKey"),
10614 alt: genGuard("!$event.altKey"),
10615 meta: genGuard("!$event.metaKey"),
10616 left: genGuard("'button' in $event && $event.button !== 0"),
10617 middle: genGuard("'button' in $event && $event.button !== 1"),
10618 right: genGuard("'button' in $event && $event.button !== 2")
10619};
10620
10621function genHandlers (
10622 events,
10623 isNative
10624) {
10625 var prefix = isNative ? 'nativeOn:' : 'on:';
10626 var staticHandlers = "";
10627 var dynamicHandlers = "";
10628 for (var name in events) {
10629 var handlerCode = genHandler(events[name]);
10630 if (events[name] && events[name].dynamic) {
10631 dynamicHandlers += name + "," + handlerCode + ",";
10632 } else {
10633 staticHandlers += "\"" + name + "\":" + handlerCode + ",";
10634 }
10635 }
10636 staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
10637 if (dynamicHandlers) {
10638 return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
10639 } else {
10640 return prefix + staticHandlers
10641 }
10642}
10643
10644function genHandler (handler) {
10645 if (!handler) {
10646 return 'function(){}'
10647 }
10648
10649 if (Array.isArray(handler)) {
10650 return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
10651 }
10652
10653 var isMethodPath = simplePathRE.test(handler.value);
10654 var isFunctionExpression = fnExpRE.test(handler.value);
10655 var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
10656
10657 if (!handler.modifiers) {
10658 if (isMethodPath || isFunctionExpression) {
10659 return handler.value
10660 }
10661 return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
10662 } else {
10663 var code = '';
10664 var genModifierCode = '';
10665 var keys = [];
10666 for (var key in handler.modifiers) {
10667 if (modifierCode[key]) {
10668 genModifierCode += modifierCode[key];
10669 // left/right
10670 if (keyCodes[key]) {
10671 keys.push(key);
10672 }
10673 } else if (key === 'exact') {
10674 var modifiers = (handler.modifiers);
10675 genModifierCode += genGuard(
10676 ['ctrl', 'shift', 'alt', 'meta']
10677 .filter(function (keyModifier) { return !modifiers[keyModifier]; })
10678 .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
10679 .join('||')
10680 );
10681 } else {
10682 keys.push(key);
10683 }
10684 }
10685 if (keys.length) {
10686 code += genKeyFilter(keys);
10687 }
10688 // Make sure modifiers like prevent and stop get executed after key filtering
10689 if (genModifierCode) {
10690 code += genModifierCode;
10691 }
10692 var handlerCode = isMethodPath
10693 ? ("return " + (handler.value) + "($event)")
10694 : isFunctionExpression
10695 ? ("return (" + (handler.value) + ")($event)")
10696 : isFunctionInvocation
10697 ? ("return " + (handler.value))
10698 : handler.value;
10699 return ("function($event){" + code + handlerCode + "}")
10700 }
10701}
10702
10703function genKeyFilter (keys) {
10704 return ("if(('keyCode' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
10705}
10706
10707function genFilterCode (key) {
10708 var keyVal = parseInt(key, 10);
10709 if (keyVal) {
10710 return ("$event.keyCode!==" + keyVal)
10711 }
10712 var keyCode = keyCodes[key];
10713 var keyName = keyNames[key];
10714 return (
10715 "_k($event.keyCode," +
10716 (JSON.stringify(key)) + "," +
10717 (JSON.stringify(keyCode)) + "," +
10718 "$event.key," +
10719 "" + (JSON.stringify(keyName)) +
10720 ")"
10721 )
10722}
10723
10724/* */
10725
10726function on (el, dir) {
10727 if (dir.modifiers) {
10728 warn("v-on without argument does not support modifiers.");
10729 }
10730 el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
10731}
10732
10733/* */
10734
10735function bind$1 (el, dir) {
10736 el.wrapData = function (code) {
10737 return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
10738 };
10739}
10740
10741/* */
10742
10743var baseDirectives = {
10744 on: on,
10745 bind: bind$1,
10746 cloak: noop
10747};
10748
10749/* */
10750
10751
10752
10753
10754
10755var CodegenState = function CodegenState (options) {
10756 this.options = options;
10757 this.warn = options.warn || baseWarn;
10758 this.transforms = pluckModuleFunction(options.modules, 'transformCode');
10759 this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
10760 this.directives = extend(extend({}, baseDirectives), options.directives);
10761 var isReservedTag = options.isReservedTag || no;
10762 this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
10763 this.onceId = 0;
10764 this.staticRenderFns = [];
10765 this.pre = false;
10766};
10767
10768
10769
10770function generate (
10771 ast,
10772 options
10773) {
10774 var state = new CodegenState(options);
10775 var code = ast ? genElement(ast, state) : '_c("div")';
10776 return {
10777 render: ("with(this){return " + code + "}"),
10778 staticRenderFns: state.staticRenderFns
10779 }
10780}
10781
10782function genElement (el, state) {
10783 if (el.parent) {
10784 el.pre = el.pre || el.parent.pre;
10785 }
10786
10787 if (el.staticRoot && !el.staticProcessed) {
10788 return genStatic(el, state)
10789 } else if (el.once && !el.onceProcessed) {
10790 return genOnce(el, state)
10791 } else if (el.for && !el.forProcessed) {
10792 return genFor(el, state)
10793 } else if (el.if && !el.ifProcessed) {
10794 return genIf(el, state)
10795 } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
10796 return genChildren(el, state) || 'void 0'
10797 } else if (el.tag === 'slot') {
10798 return genSlot(el, state)
10799 } else {
10800 // component or element
10801 var code;
10802 if (el.component) {
10803 code = genComponent(el.component, el, state);
10804 } else {
10805 var data;
10806 if (!el.plain || (el.pre && state.maybeComponent(el))) {
10807 data = genData$2(el, state);
10808 }
10809
10810 var children = el.inlineTemplate ? null : genChildren(el, state, true);
10811 code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
10812 }
10813 // module transforms
10814 for (var i = 0; i < state.transforms.length; i++) {
10815 code = state.transforms[i](el, code);
10816 }
10817 return code
10818 }
10819}
10820
10821// hoist static sub-trees out
10822function genStatic (el, state) {
10823 el.staticProcessed = true;
10824 // Some elements (templates) need to behave differently inside of a v-pre
10825 // node. All pre nodes are static roots, so we can use this as a location to
10826 // wrap a state change and reset it upon exiting the pre node.
10827 var originalPreState = state.pre;
10828 if (el.pre) {
10829 state.pre = el.pre;
10830 }
10831 state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
10832 state.pre = originalPreState;
10833 return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
10834}
10835
10836// v-once
10837function genOnce (el, state) {
10838 el.onceProcessed = true;
10839 if (el.if && !el.ifProcessed) {
10840 return genIf(el, state)
10841 } else if (el.staticInFor) {
10842 var key = '';
10843 var parent = el.parent;
10844 while (parent) {
10845 if (parent.for) {
10846 key = parent.key;
10847 break
10848 }
10849 parent = parent.parent;
10850 }
10851 if (!key) {
10852 state.warn(
10853 "v-once can only be used inside v-for that is keyed. ",
10854 el.rawAttrsMap['v-once']
10855 );
10856 return genElement(el, state)
10857 }
10858 return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
10859 } else {
10860 return genStatic(el, state)
10861 }
10862}
10863
10864function genIf (
10865 el,
10866 state,
10867 altGen,
10868 altEmpty
10869) {
10870 el.ifProcessed = true; // avoid recursion
10871 return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
10872}
10873
10874function genIfConditions (
10875 conditions,
10876 state,
10877 altGen,
10878 altEmpty
10879) {
10880 if (!conditions.length) {
10881 return altEmpty || '_e()'
10882 }
10883
10884 var condition = conditions.shift();
10885 if (condition.exp) {
10886 return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
10887 } else {
10888 return ("" + (genTernaryExp(condition.block)))
10889 }
10890
10891 // v-if with v-once should generate code like (a)?_m(0):_m(1)
10892 function genTernaryExp (el) {
10893 return altGen
10894 ? altGen(el, state)
10895 : el.once
10896 ? genOnce(el, state)
10897 : genElement(el, state)
10898 }
10899}
10900
10901function genFor (
10902 el,
10903 state,
10904 altGen,
10905 altHelper
10906) {
10907 var exp = el.for;
10908 var alias = el.alias;
10909 var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
10910 var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
10911
10912 if (state.maybeComponent(el) &&
10913 el.tag !== 'slot' &&
10914 el.tag !== 'template' &&
10915 !el.key
10916 ) {
10917 state.warn(
10918 "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
10919 "v-for should have explicit keys. " +
10920 "See https://vuejs.org/guide/list.html#key for more info.",
10921 el.rawAttrsMap['v-for'],
10922 true /* tip */
10923 );
10924 }
10925
10926 el.forProcessed = true; // avoid recursion
10927 return (altHelper || '_l') + "((" + exp + ")," +
10928 "function(" + alias + iterator1 + iterator2 + "){" +
10929 "return " + ((altGen || genElement)(el, state)) +
10930 '})'
10931}
10932
10933function genData$2 (el, state) {
10934 var data = '{';
10935
10936 // directives first.
10937 // directives may mutate the el's other properties before they are generated.
10938 var dirs = genDirectives(el, state);
10939 if (dirs) { data += dirs + ','; }
10940
10941 // key
10942 if (el.key) {
10943 data += "key:" + (el.key) + ",";
10944 }
10945 // ref
10946 if (el.ref) {
10947 data += "ref:" + (el.ref) + ",";
10948 }
10949 if (el.refInFor) {
10950 data += "refInFor:true,";
10951 }
10952 // pre
10953 if (el.pre) {
10954 data += "pre:true,";
10955 }
10956 // record original tag name for components using "is" attribute
10957 if (el.component) {
10958 data += "tag:\"" + (el.tag) + "\",";
10959 }
10960 // module data generation functions
10961 for (var i = 0; i < state.dataGenFns.length; i++) {
10962 data += state.dataGenFns[i](el);
10963 }
10964 // attributes
10965 if (el.attrs) {
10966 data += "attrs:" + (genProps(el.attrs)) + ",";
10967 }
10968 // DOM props
10969 if (el.props) {
10970 data += "domProps:" + (genProps(el.props)) + ",";
10971 }
10972 // event handlers
10973 if (el.events) {
10974 data += (genHandlers(el.events, false)) + ",";
10975 }
10976 if (el.nativeEvents) {
10977 data += (genHandlers(el.nativeEvents, true)) + ",";
10978 }
10979 // slot target
10980 // only for non-scoped slots
10981 if (el.slotTarget && !el.slotScope) {
10982 data += "slot:" + (el.slotTarget) + ",";
10983 }
10984 // scoped slots
10985 if (el.scopedSlots) {
10986 data += (genScopedSlots(el.scopedSlots, state)) + ",";
10987 }
10988 // component v-model
10989 if (el.model) {
10990 data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
10991 }
10992 // inline-template
10993 if (el.inlineTemplate) {
10994 var inlineTemplate = genInlineTemplate(el, state);
10995 if (inlineTemplate) {
10996 data += inlineTemplate + ",";
10997 }
10998 }
10999 data = data.replace(/,$/, '') + '}';
11000 // v-bind dynamic argument wrap
11001 // v-bind with dynamic arguments must be applied using the same v-bind object
11002 // merge helper so that class/style/mustUseProp attrs are handled correctly.
11003 if (el.dynamicAttrs) {
11004 data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
11005 }
11006 // v-bind data wrap
11007 if (el.wrapData) {
11008 data = el.wrapData(data);
11009 }
11010 // v-on data wrap
11011 if (el.wrapListeners) {
11012 data = el.wrapListeners(data);
11013 }
11014 return data
11015}
11016
11017function genDirectives (el, state) {
11018 var dirs = el.directives;
11019 if (!dirs) { return }
11020 var res = 'directives:[';
11021 var hasRuntime = false;
11022 var i, l, dir, needRuntime;
11023 for (i = 0, l = dirs.length; i < l; i++) {
11024 dir = dirs[i];
11025 needRuntime = true;
11026 var gen = state.directives[dir.name];
11027 if (gen) {
11028 // compile-time directive that manipulates AST.
11029 // returns true if it also needs a runtime counterpart.
11030 needRuntime = !!gen(el, dir, state.warn);
11031 }
11032 if (needRuntime) {
11033 hasRuntime = true;
11034 res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
11035 }
11036 }
11037 if (hasRuntime) {
11038 return res.slice(0, -1) + ']'
11039 }
11040}
11041
11042function genInlineTemplate (el, state) {
11043 var ast = el.children[0];
11044 if (el.children.length !== 1 || ast.type !== 1) {
11045 state.warn(
11046 'Inline-template components must have exactly one child element.',
11047 { start: el.start }
11048 );
11049 }
11050 if (ast.type === 1) {
11051 var inlineRenderFns = generate(ast, state.options);
11052 return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
11053 }
11054}
11055
11056function genScopedSlots (
11057 slots,
11058 state
11059) {
11060 var hasDynamicKeys = Object.keys(slots).some(function (key) {
11061 var slot = slots[key];
11062 return slot.slotTargetDynamic || slot.if || slot.for
11063 });
11064 return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
11065 return genScopedSlot(slots[key], state)
11066 }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
11067}
11068
11069function genScopedSlot (
11070 el,
11071 state
11072) {
11073 if (el.if && !el.ifProcessed) {
11074 return genIf(el, state, genScopedSlot, "null")
11075 }
11076 if (el.for && !el.forProcessed) {
11077 return genFor(el, state, genScopedSlot)
11078 }
11079 var fn = "function(" + (String(el.slotScope)) + "){" +
11080 "return " + (el.tag === 'template'
11081 ? genChildren(el, state) || 'undefined'
11082 : genElement(el, state)) + "}";
11083 return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + "}")
11084}
11085
11086function genChildren (
11087 el,
11088 state,
11089 checkSkip,
11090 altGenElement,
11091 altGenNode
11092) {
11093 var children = el.children;
11094 if (children.length) {
11095 var el$1 = children[0];
11096 // optimize single v-for
11097 if (children.length === 1 &&
11098 el$1.for &&
11099 el$1.tag !== 'template' &&
11100 el$1.tag !== 'slot'
11101 ) {
11102 var normalizationType = checkSkip
11103 ? state.maybeComponent(el$1) ? ",1" : ",0"
11104 : "";
11105 return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
11106 }
11107 var normalizationType$1 = checkSkip
11108 ? getNormalizationType(children, state.maybeComponent)
11109 : 0;
11110 var gen = altGenNode || genNode;
11111 return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
11112 }
11113}
11114
11115// determine the normalization needed for the children array.
11116// 0: no normalization needed
11117// 1: simple normalization needed (possible 1-level deep nested array)
11118// 2: full normalization needed
11119function getNormalizationType (
11120 children,
11121 maybeComponent
11122) {
11123 var res = 0;
11124 for (var i = 0; i < children.length; i++) {
11125 var el = children[i];
11126 if (el.type !== 1) {
11127 continue
11128 }
11129 if (needsNormalization(el) ||
11130 (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
11131 res = 2;
11132 break
11133 }
11134 if (maybeComponent(el) ||
11135 (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
11136 res = 1;
11137 }
11138 }
11139 return res
11140}
11141
11142function needsNormalization (el) {
11143 return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
11144}
11145
11146function genNode (node, state) {
11147 if (node.type === 1) {
11148 return genElement(node, state)
11149 } else if (node.type === 3 && node.isComment) {
11150 return genComment(node)
11151 } else {
11152 return genText(node)
11153 }
11154}
11155
11156function genText (text) {
11157 return ("_v(" + (text.type === 2
11158 ? text.expression // no need for () because already wrapped in _s()
11159 : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
11160}
11161
11162function genComment (comment) {
11163 return ("_e(" + (JSON.stringify(comment.text)) + ")")
11164}
11165
11166function genSlot (el, state) {
11167 var slotName = el.slotName || '"default"';
11168 var children = genChildren(el, state);
11169 var res = "_t(" + slotName + (children ? ("," + children) : '');
11170 var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
11171 var bind$$1 = el.attrsMap['v-bind'];
11172 if ((attrs || bind$$1) && !children) {
11173 res += ",null";
11174 }
11175 if (attrs) {
11176 res += "," + attrs;
11177 }
11178 if (bind$$1) {
11179 res += (attrs ? '' : ',null') + "," + bind$$1;
11180 }
11181 return res + ')'
11182}
11183
11184// componentName is el.component, take it as argument to shun flow's pessimistic refinement
11185function genComponent (
11186 componentName,
11187 el,
11188 state
11189) {
11190 var children = el.inlineTemplate ? null : genChildren(el, state, true);
11191 return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
11192}
11193
11194function genProps (props) {
11195 var staticProps = "";
11196 var dynamicProps = "";
11197 for (var i = 0; i < props.length; i++) {
11198 var prop = props[i];
11199 var value = transformSpecialNewlines(prop.value);
11200 if (prop.dynamic) {
11201 dynamicProps += (prop.name) + "," + value + ",";
11202 } else {
11203 staticProps += "\"" + (prop.name) + "\":" + value + ",";
11204 }
11205 }
11206 staticProps = "{" + (staticProps.slice(0, -1)) + "}";
11207 if (dynamicProps) {
11208 return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
11209 } else {
11210 return staticProps
11211 }
11212}
11213
11214// #3895, #4268
11215function transformSpecialNewlines (text) {
11216 return text
11217 .replace(/\u2028/g, '\\u2028')
11218 .replace(/\u2029/g, '\\u2029')
11219}
11220
11221/* */
11222
11223
11224
11225// these keywords should not appear inside expressions, but operators like
11226// typeof, instanceof and in are allowed
11227var prohibitedKeywordRE = new RegExp('\\b' + (
11228 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
11229 'super,throw,while,yield,delete,export,import,return,switch,default,' +
11230 'extends,finally,continue,debugger,function,arguments'
11231).split(',').join('\\b|\\b') + '\\b');
11232
11233// these unary operators should not be used as property/method names
11234var unaryOperatorsRE = new RegExp('\\b' + (
11235 'delete,typeof,void'
11236).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
11237
11238// strip strings in expressions
11239var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
11240
11241// detect problematic expressions in a template
11242function detectErrors (ast, warn) {
11243 if (ast) {
11244 checkNode(ast, warn);
11245 }
11246}
11247
11248function checkNode (node, warn) {
11249 if (node.type === 1) {
11250 for (var name in node.attrsMap) {
11251 if (dirRE.test(name)) {
11252 var value = node.attrsMap[name];
11253 if (value) {
11254 var range = node.rawAttrsMap[name];
11255 if (name === 'v-for') {
11256 checkFor(node, ("v-for=\"" + value + "\""), warn, range);
11257 } else if (onRE.test(name)) {
11258 checkEvent(value, (name + "=\"" + value + "\""), warn, range);
11259 } else {
11260 checkExpression(value, (name + "=\"" + value + "\""), warn, range);
11261 }
11262 }
11263 }
11264 }
11265 if (node.children) {
11266 for (var i = 0; i < node.children.length; i++) {
11267 checkNode(node.children[i], warn);
11268 }
11269 }
11270 } else if (node.type === 2) {
11271 checkExpression(node.expression, node.text, warn, node);
11272 }
11273}
11274
11275function checkEvent (exp, text, warn, range) {
11276 var stipped = exp.replace(stripStringRE, '');
11277 var keywordMatch = stipped.match(unaryOperatorsRE);
11278 if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
11279 warn(
11280 "avoid using JavaScript unary operator as property name: " +
11281 "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
11282 range
11283 );
11284 }
11285 checkExpression(exp, text, warn, range);
11286}
11287
11288function checkFor (node, text, warn, range) {
11289 checkExpression(node.for || '', text, warn, range);
11290 checkIdentifier(node.alias, 'v-for alias', text, warn, range);
11291 checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
11292 checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
11293}
11294
11295function checkIdentifier (
11296 ident,
11297 type,
11298 text,
11299 warn,
11300 range
11301) {
11302 if (typeof ident === 'string') {
11303 try {
11304 new Function(("var " + ident + "=_"));
11305 } catch (e) {
11306 warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
11307 }
11308 }
11309}
11310
11311function checkExpression (exp, text, warn, range) {
11312 try {
11313 new Function(("return " + exp));
11314 } catch (e) {
11315 var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
11316 if (keywordMatch) {
11317 warn(
11318 "avoid using JavaScript keyword as property name: " +
11319 "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
11320 range
11321 );
11322 } else {
11323 warn(
11324 "invalid expression: " + (e.message) + " in\n\n" +
11325 " " + exp + "\n\n" +
11326 " Raw expression: " + (text.trim()) + "\n",
11327 range
11328 );
11329 }
11330 }
11331}
11332
11333/* */
11334
11335var range = 2;
11336
11337function generateCodeFrame (
11338 source,
11339 start,
11340 end
11341) {
11342 if ( start === void 0 ) start = 0;
11343 if ( end === void 0 ) end = source.length;
11344
11345 var lines = source.split(/\r?\n/);
11346 var count = 0;
11347 var res = [];
11348 for (var i = 0; i < lines.length; i++) {
11349 count += lines[i].length + 1;
11350 if (count >= start) {
11351 for (var j = i - range; j <= i + range || end > count; j++) {
11352 if (j < 0 || j >= lines.length) { continue }
11353 res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
11354 var lineLength = lines[j].length;
11355 if (j === i) {
11356 // push underline
11357 var pad = start - (count - lineLength) + 1;
11358 var length = end > count ? lineLength - pad : end - start;
11359 res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
11360 } else if (j > i) {
11361 if (end > count) {
11362 var length$1 = Math.min(end - count, lineLength);
11363 res.push(" | " + repeat$1("^", length$1));
11364 }
11365 count += lineLength + 1;
11366 }
11367 }
11368 break
11369 }
11370 }
11371 return res.join('\n')
11372}
11373
11374function repeat$1 (str, n) {
11375 var result = '';
11376 while (true) { // eslint-disable-line
11377 if (n & 1) { result += str; }
11378 n >>>= 1;
11379 if (n <= 0) { break }
11380 str += str;
11381 }
11382 return result
11383}
11384
11385/* */
11386
11387
11388
11389function createFunction (code, errors) {
11390 try {
11391 return new Function(code)
11392 } catch (err) {
11393 errors.push({ err: err, code: code });
11394 return noop
11395 }
11396}
11397
11398function createCompileToFunctionFn (compile) {
11399 var cache = Object.create(null);
11400
11401 return function compileToFunctions (
11402 template,
11403 options,
11404 vm
11405 ) {
11406 options = extend({}, options);
11407 var warn$$1 = options.warn || warn;
11408 delete options.warn;
11409
11410 /* istanbul ignore if */
11411 {
11412 // detect possible CSP restriction
11413 try {
11414 new Function('return 1');
11415 } catch (e) {
11416 if (e.toString().match(/unsafe-eval|CSP/)) {
11417 warn$$1(
11418 'It seems you are using the standalone build of Vue.js in an ' +
11419 'environment with Content Security Policy that prohibits unsafe-eval. ' +
11420 'The template compiler cannot work in this environment. Consider ' +
11421 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
11422 'templates into render functions.'
11423 );
11424 }
11425 }
11426 }
11427
11428 // check cache
11429 var key = options.delimiters
11430 ? String(options.delimiters) + template
11431 : template;
11432 if (cache[key]) {
11433 return cache[key]
11434 }
11435
11436 // compile
11437 var compiled = compile(template, options);
11438
11439 // check compilation errors/tips
11440 {
11441 if (compiled.errors && compiled.errors.length) {
11442 if (options.outputSourceRange) {
11443 compiled.errors.forEach(function (e) {
11444 warn$$1(
11445 "Error compiling template:\n\n" + (e.msg) + "\n\n" +
11446 generateCodeFrame(template, e.start, e.end),
11447 vm
11448 );
11449 });
11450 } else {
11451 warn$$1(
11452 "Error compiling template:\n\n" + template + "\n\n" +
11453 compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
11454 vm
11455 );
11456 }
11457 }
11458 if (compiled.tips && compiled.tips.length) {
11459 if (options.outputSourceRange) {
11460 compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
11461 } else {
11462 compiled.tips.forEach(function (msg) { return tip(msg, vm); });
11463 }
11464 }
11465 }
11466
11467 // turn code into functions
11468 var res = {};
11469 var fnGenErrors = [];
11470 res.render = createFunction(compiled.render, fnGenErrors);
11471 res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
11472 return createFunction(code, fnGenErrors)
11473 });
11474
11475 // check function generation errors.
11476 // this should only happen if there is a bug in the compiler itself.
11477 // mostly for codegen development use
11478 /* istanbul ignore if */
11479 {
11480 if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
11481 warn$$1(
11482 "Failed to generate render function:\n\n" +
11483 fnGenErrors.map(function (ref) {
11484 var err = ref.err;
11485 var code = ref.code;
11486
11487 return ((err.toString()) + " in\n\n" + code + "\n");
11488 }).join('\n'),
11489 vm
11490 );
11491 }
11492 }
11493
11494 return (cache[key] = res)
11495 }
11496}
11497
11498/* */
11499
11500function createCompilerCreator (baseCompile) {
11501 return function createCompiler (baseOptions) {
11502 function compile (
11503 template,
11504 options
11505 ) {
11506 var finalOptions = Object.create(baseOptions);
11507 var errors = [];
11508 var tips = [];
11509
11510 var warn = function (msg, range, tip) {
11511 (tip ? tips : errors).push(msg);
11512 };
11513
11514 if (options) {
11515 if (options.outputSourceRange) {
11516 // $flow-disable-line
11517 var leadingSpaceLength = template.match(/^\s*/)[0].length;
11518
11519 warn = function (msg, range, tip) {
11520 var data = { msg: msg };
11521 if (range) {
11522 if (range.start != null) {
11523 data.start = range.start + leadingSpaceLength;
11524 }
11525 if (range.end != null) {
11526 data.end = range.end + leadingSpaceLength;
11527 }
11528 }
11529 (tip ? tips : errors).push(data);
11530 };
11531 }
11532 // merge custom modules
11533 if (options.modules) {
11534 finalOptions.modules =
11535 (baseOptions.modules || []).concat(options.modules);
11536 }
11537 // merge custom directives
11538 if (options.directives) {
11539 finalOptions.directives = extend(
11540 Object.create(baseOptions.directives || null),
11541 options.directives
11542 );
11543 }
11544 // copy other options
11545 for (var key in options) {
11546 if (key !== 'modules' && key !== 'directives') {
11547 finalOptions[key] = options[key];
11548 }
11549 }
11550 }
11551
11552 finalOptions.warn = warn;
11553
11554 var compiled = baseCompile(template.trim(), finalOptions);
11555 {
11556 detectErrors(compiled.ast, warn);
11557 }
11558 compiled.errors = errors;
11559 compiled.tips = tips;
11560 return compiled
11561 }
11562
11563 return {
11564 compile: compile,
11565 compileToFunctions: createCompileToFunctionFn(compile)
11566 }
11567 }
11568}
11569
11570/* */
11571
11572// `createCompilerCreator` allows creating compilers that use alternative
11573// parser/optimizer/codegen, e.g the SSR optimizing compiler.
11574// Here we just export a default compiler using the default parts.
11575var createCompiler = createCompilerCreator(function baseCompile (
11576 template,
11577 options
11578) {
11579 var ast = parse(template.trim(), options);
11580 if (options.optimize !== false) {
11581 optimize(ast, options);
11582 }
11583 var code = generate(ast, options);
11584 return {
11585 ast: ast,
11586 render: code.render,
11587 staticRenderFns: code.staticRenderFns
11588 }
11589});
11590
11591/* */
11592
11593var ref$1 = createCompiler(baseOptions);
11594var compile = ref$1.compile;
11595var compileToFunctions = ref$1.compileToFunctions;
11596
11597/* */
11598
11599// check whether current browser encodes a char inside attribute values
11600var div;
11601function getShouldDecode (href) {
11602 div = div || document.createElement('div');
11603 div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
11604 return div.innerHTML.indexOf('&#10;') > 0
11605}
11606
11607// #3663: IE encodes newlines inside attribute values while other browsers don't
11608var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
11609// #6828: chrome encodes content in a[href]
11610var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
11611
11612/* */
11613
11614var idToTemplate = cached(function (id) {
11615 var el = query(id);
11616 return el && el.innerHTML
11617});
11618
11619var mount = Vue.prototype.$mount;
11620Vue.prototype.$mount = function (
11621 el,
11622 hydrating
11623) {
11624 el = el && query(el);
11625
11626 /* istanbul ignore if */
11627 if (el === document.body || el === document.documentElement) {
11628 warn(
11629 "Do not mount Vue to <html> or <body> - mount to normal elements instead."
11630 );
11631 return this
11632 }
11633
11634 var options = this.$options;
11635 // resolve template/el and convert to render function
11636 if (!options.render) {
11637 var template = options.template;
11638 if (template) {
11639 if (typeof template === 'string') {
11640 if (template.charAt(0) === '#') {
11641 template = idToTemplate(template);
11642 /* istanbul ignore if */
11643 if (!template) {
11644 warn(
11645 ("Template element not found or is empty: " + (options.template)),
11646 this
11647 );
11648 }
11649 }
11650 } else if (template.nodeType) {
11651 template = template.innerHTML;
11652 } else {
11653 {
11654 warn('invalid template option:' + template, this);
11655 }
11656 return this
11657 }
11658 } else if (el) {
11659 template = getOuterHTML(el);
11660 }
11661 if (template) {
11662 /* istanbul ignore if */
11663 if (config.performance && mark) {
11664 mark('compile');
11665 }
11666
11667 var ref = compileToFunctions(template, {
11668 outputSourceRange: "development" !== 'production',
11669 shouldDecodeNewlines: shouldDecodeNewlines,
11670 shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
11671 delimiters: options.delimiters,
11672 comments: options.comments
11673 }, this);
11674 var render = ref.render;
11675 var staticRenderFns = ref.staticRenderFns;
11676 options.render = render;
11677 options.staticRenderFns = staticRenderFns;
11678
11679 /* istanbul ignore if */
11680 if (config.performance && mark) {
11681 mark('compile end');
11682 measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
11683 }
11684 }
11685 }
11686 return mount.call(this, el, hydrating)
11687};
11688
11689/**
11690 * Get outerHTML of elements, taking care
11691 * of SVG elements in IE as well.
11692 */
11693function getOuterHTML (el) {
11694 if (el.outerHTML) {
11695 return el.outerHTML
11696 } else {
11697 var container = document.createElement('div');
11698 container.appendChild(el.cloneNode(true));
11699 return container.innerHTML
11700 }
11701}
11702
11703Vue.compile = compileToFunctions;
11704
11705module.exports = Vue;