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