UNPKG

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