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