UNPKG

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