UNPKG

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