UNPKG

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