UNPKG

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