UNPKG

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