UNPKG

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