UNPKG

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