diff --git a/dist/vue.common.dev.js b/dist/vue.common.dev.js index 619ed40d9fe..36780a616ed 100644 --- a/dist/vue.common.dev.js +++ b/dist/vue.common.dev.js @@ -1,5 +1,5 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ @@ -534,6 +534,7 @@ var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android' var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; var isPhantomJS = UA && /phantomjs/.test(UA); +var isFF = UA && UA.match(/firefox\/(\d+)/); // Firefox has a "watch" function on Object.prototype... var nativeWatch = ({}).watch; @@ -2404,2437 +2405,2439 @@ function normalizeArrayChildren (children, nestedIndex) { /* */ -function ensureCtor (comp, base) { - if ( - comp.__esModule || - (hasSymbol && comp[Symbol.toStringTag] === 'Module') - ) { - comp = comp.default; +function initProvide (vm) { + var provide = vm.$options.provide; + if (provide) { + vm._provided = typeof provide === 'function' + ? provide.call(vm) + : provide; } - return isObject(comp) - ? base.extend(comp) - : comp -} - -function createAsyncPlaceholder ( - factory, - data, - context, - children, - tag -) { - var node = createEmptyVNode(); - node.asyncFactory = factory; - node.asyncMeta = { data: data, context: context, children: children, tag: tag }; - return node } -function resolveAsyncComponent ( - factory, - baseCtor, - context -) { - if (isTrue(factory.error) && isDef(factory.errorComp)) { - return factory.errorComp - } - - if (isDef(factory.resolved)) { - return factory.resolved - } - - if (isTrue(factory.loading) && isDef(factory.loadingComp)) { - return factory.loadingComp - } - - if (isDef(factory.contexts)) { - // already pending - factory.contexts.push(context); - } else { - var contexts = factory.contexts = [context]; - var sync = true; - - var forceRender = function (renderCompleted) { - for (var i = 0, l = contexts.length; i < l; i++) { - contexts[i].$forceUpdate(); - } - - if (renderCompleted) { - contexts.length = 0; - } - }; - - var resolve = once(function (res) { - // cache resolved - factory.resolved = ensureCtor(res, baseCtor); - // invoke callbacks only if this is not a synchronous resolve - // (async resolves are shimmed as synchronous during SSR) - if (!sync) { - forceRender(true); - } else { - contexts.length = 0; - } - }); - - var reject = once(function (reason) { - warn( - "Failed to resolve async component: " + (String(factory)) + - (reason ? ("\nReason: " + reason) : '') - ); - if (isDef(factory.errorComp)) { - factory.error = true; - forceRender(true); +function initInjections (vm) { + var result = resolveInject(vm.$options.inject, vm); + if (result) { + toggleObserving(false); + Object.keys(result).forEach(function (key) { + /* istanbul ignore else */ + { + defineReactive$$1(vm, key, result[key], function () { + warn( + "Avoid mutating an injected value directly since the changes will be " + + "overwritten whenever the provided component re-renders. " + + "injection being mutated: \"" + key + "\"", + vm + ); + }); } }); + toggleObserving(true); + } +} - var res = factory(resolve, reject); - - if (isObject(res)) { - if (isPromise(res)) { - // () => Promise - if (isUndef(factory.resolved)) { - res.then(resolve, reject); - } - } else if (isPromise(res.component)) { - res.component.then(resolve, reject); - - if (isDef(res.error)) { - factory.errorComp = ensureCtor(res.error, baseCtor); - } +function resolveInject (inject, vm) { + if (inject) { + // inject is :any because flow is not smart enough to figure out cached + var result = Object.create(null); + var keys = hasSymbol + ? Reflect.ownKeys(inject) + : Object.keys(inject); - if (isDef(res.loading)) { - factory.loadingComp = ensureCtor(res.loading, baseCtor); - if (res.delay === 0) { - factory.loading = true; - } else { - setTimeout(function () { - if (isUndef(factory.resolved) && isUndef(factory.error)) { - factory.loading = true; - forceRender(false); - } - }, res.delay || 200); - } + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + // #6574 in case the inject object is observed... + if (key === '__ob__') { continue } + var provideKey = inject[key].from; + var source = vm; + while (source) { + if (source._provided && hasOwn(source._provided, provideKey)) { + result[key] = source._provided[provideKey]; + break } - - if (isDef(res.timeout)) { - setTimeout(function () { - if (isUndef(factory.resolved)) { - reject( - "timeout (" + (res.timeout) + "ms)" - ); - } - }, res.timeout); + source = source.$parent; + } + if (!source) { + if ('default' in inject[key]) { + var provideDefault = inject[key].default; + result[key] = typeof provideDefault === 'function' + ? provideDefault.call(vm) + : provideDefault; + } else { + warn(("Injection \"" + key + "\" not found"), vm); } } } - - sync = false; - // return in case resolved synchronously - return factory.loading - ? factory.loadingComp - : factory.resolved + return result } } /* */ -function isAsyncPlaceholder (node) { - return node.isComment && node.asyncFactory -} -/* */ -function getFirstComponentChild (children) { - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - var c = children[i]; - if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { - return c +/** + * Runtime helper for resolving raw children VNodes into a slot object. + */ +function resolveSlots ( + children, + context +) { + if (!children || !children.length) { + return {} + } + var slots = {}; + for (var i = 0, l = children.length; i < l; i++) { + var child = children[i]; + var data = child.data; + // remove slot attribute if the node is resolved as a Vue slot node + if (data && data.attrs && data.attrs.slot) { + delete data.attrs.slot; + } + // named slots should only be respected if the vnode was rendered in the + // same context. + if ((child.context === context || child.fnContext === context) && + data && data.slot != null + ) { + var name = data.slot; + var slot = (slots[name] || (slots[name] = [])); + if (child.tag === 'template') { + slot.push.apply(slot, child.children || []); + } else { + slot.push(child); } + } else { + (slots.default || (slots.default = [])).push(child); + } + } + // ignore slots that contains only whitespace + for (var name$1 in slots) { + if (slots[name$1].every(isWhitespace)) { + delete slots[name$1]; } } + return slots } -/* */ +function isWhitespace (node) { + return (node.isComment && !node.asyncFactory) || node.text === ' ' +} /* */ -function initEvents (vm) { - vm._events = Object.create(null); - vm._hasHookEvent = false; - // init parent attached events - var listeners = vm.$options._parentListeners; - if (listeners) { - updateComponentListeners(vm, listeners); +function normalizeScopedSlots ( + slots, + normalSlots +) { + var res; + if (!slots) { + res = {}; + } else if (slots._normalized) { + return slots + } else { + res = {}; + for (var key in slots) { + if (slots[key] && key[0] !== '$') { + res[key] = normalizeScopedSlot(slots[key]); + } + } + } + // expose normal slots on scopedSlots + for (var key$1 in normalSlots) { + if (!(key$1 in res)) { + res[key$1] = proxyNormalSlot(normalSlots, key$1); + } } + def(res, '_normalized', true); + def(res, '$stable', slots ? !!slots.$stable : true); + return res } -var target; - -function add (event, fn) { - target.$on(event, fn); +function normalizeScopedSlot(fn) { + return function (scope) { + var res = fn(scope); + return res && typeof res === 'object' && !Array.isArray(res) + ? [res] // single vnode + : normalizeChildren(res) + } } -function remove$1 (event, fn) { - target.$off(event, fn); +function proxyNormalSlot(slots, key) { + return function () { return slots[key]; } } -function createOnceHandler (event, fn) { - var _target = target; - return function onceHandler () { - var res = fn.apply(null, arguments); - if (res !== null) { - _target.$off(event, onceHandler); - } - } -} +/* */ -function updateComponentListeners ( - vm, - listeners, - oldListeners +/** + * Runtime helper for rendering v-for lists. + */ +function renderList ( + val, + render ) { - target = vm; - updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); - target = undefined; -} - -function eventsMixin (Vue) { - var hookRE = /^hook:/; - Vue.prototype.$on = function (event, fn) { - var vm = this; - if (Array.isArray(event)) { - for (var i = 0, l = event.length; i < l; i++) { - vm.$on(event[i], fn); - } - } else { - (vm._events[event] || (vm._events[event] = [])).push(fn); - // optimize hook:event cost by using a boolean flag marked at registration - // instead of a hash lookup - if (hookRE.test(event)) { - vm._hasHookEvent = true; - } - } - return vm - }; - - Vue.prototype.$once = function (event, fn) { - var vm = this; - function on () { - vm.$off(event, on); - fn.apply(vm, arguments); - } - on.fn = fn; - vm.$on(event, on); - return vm - }; - - Vue.prototype.$off = function (event, fn) { - var vm = this; - // all - if (!arguments.length) { - vm._events = Object.create(null); - return vm - } - // array of events - if (Array.isArray(event)) { - for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { - vm.$off(event[i$1], fn); - } - return vm - } - // specific event - var cbs = vm._events[event]; - if (!cbs) { - return vm - } - if (!fn) { - vm._events[event] = null; - return vm + var ret, i, l, keys, key; + if (Array.isArray(val) || typeof val === 'string') { + ret = new Array(val.length); + for (i = 0, l = val.length; i < l; i++) { + ret[i] = render(val[i], i); } - // specific handler - var cb; - var i = cbs.length; - while (i--) { - cb = cbs[i]; - if (cb === fn || cb.fn === fn) { - cbs.splice(i, 1); - break - } + } else if (typeof val === 'number') { + ret = new Array(val); + for (i = 0; i < val; i++) { + ret[i] = render(i + 1, i); } - return vm - }; - - Vue.prototype.$emit = function (event) { - var vm = this; - { - var lowerCaseEvent = event.toLowerCase(); - if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { - tip( - "Event \"" + lowerCaseEvent + "\" is emitted in component " + - (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + - "Note that HTML attributes are case-insensitive and you cannot use " + - "v-on to listen to camelCase events when using in-DOM templates. " + - "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." - ); + } else if (isObject(val)) { + if (hasSymbol && val[Symbol.iterator]) { + ret = []; + var iterator = val[Symbol.iterator](); + var result = iterator.next(); + while (!result.done) { + ret.push(render(result.value, ret.length)); + result = iterator.next(); } - } - var cbs = vm._events[event]; - if (cbs) { - cbs = cbs.length > 1 ? toArray(cbs) : cbs; - var args = toArray(arguments, 1); - var info = "event handler for \"" + event + "\""; - for (var i = 0, l = cbs.length; i < l; i++) { - invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } else { + keys = Object.keys(val); + ret = new Array(keys.length); + for (i = 0, l = keys.length; i < l; i++) { + key = keys[i]; + ret[i] = render(val[key], key, i); } } - return vm - }; + } + if (!isDef(ret)) { + ret = []; + } + (ret)._isVList = true; + return ret } /* */ - - /** - * Runtime helper for resolving raw children VNodes into a slot object. + * Runtime helper for rendering */ -function resolveSlots ( - children, - context +function renderSlot ( + name, + fallback, + props, + bindObject ) { - if (!children || !children.length) { - return {} - } - var slots = {}; - for (var i = 0, l = children.length; i < l; i++) { - var child = children[i]; - var data = child.data; - // remove slot attribute if the node is resolved as a Vue slot node - if (data && data.attrs && data.attrs.slot) { - delete data.attrs.slot; - } - // named slots should only be respected if the vnode was rendered in the - // same context. - if ((child.context === context || child.fnContext === context) && - data && data.slot != null - ) { - var name = data.slot; - var slot = (slots[name] || (slots[name] = [])); - if (child.tag === 'template') { - slot.push.apply(slot, child.children || []); - } else { - slot.push(child); + var scopedSlotFn = this.$scopedSlots[name]; + var nodes; + if (scopedSlotFn) { // scoped slot + props = props || {}; + if (bindObject) { + if (!isObject(bindObject)) { + warn( + 'slot v-bind without argument expects an Object', + this + ); } - } else { - (slots.default || (slots.default = [])).push(child); - } - } - // ignore slots that contains only whitespace - for (var name$1 in slots) { - if (slots[name$1].every(isWhitespace)) { - delete slots[name$1]; + props = extend(extend({}, bindObject), props); } + nodes = scopedSlotFn(props) || fallback; + } else { + nodes = this.$slots[name] || fallback; } - return slots -} - -function isWhitespace (node) { - return (node.isComment && !node.asyncFactory) || node.text === ' ' -} -function resolveScopedSlots ( - fns, // see flow/vnode - hasDynamicKeys, - res -) { - res = res || { $stable: !hasDynamicKeys }; - for (var i = 0; i < fns.length; i++) { - var slot = fns[i]; - if (Array.isArray(slot)) { - resolveScopedSlots(slot, hasDynamicKeys, res); - } else if (slot) { - res[slot.key] = slot.fn; - } + var target = props && props.slot; + if (target) { + return this.$createElement('template', { slot: target }, nodes) + } else { + return nodes } - return res } /* */ -var activeInstance = null; -var isUpdatingChildComponent = false; - -function setActiveInstance(vm) { - var prevActiveInstance = activeInstance; - activeInstance = vm; - return function () { - activeInstance = prevActiveInstance; - } +/** + * Runtime helper for resolving filters + */ +function resolveFilter (id) { + return resolveAsset(this.$options, 'filters', id, true) || identity } -function initLifecycle (vm) { - var options = vm.$options; +/* */ - // locate first non-abstract parent - var parent = options.parent; - if (parent && !options.abstract) { - while (parent.$options.abstract && parent.$parent) { - parent = parent.$parent; - } - parent.$children.push(vm); +function isKeyNotMatch (expect, actual) { + if (Array.isArray(expect)) { + return expect.indexOf(actual) === -1 + } else { + return expect !== actual } +} - vm.$parent = parent; - vm.$root = parent ? parent.$root : vm; - - vm.$children = []; - vm.$refs = {}; - - vm._watcher = null; - vm._inactive = null; - vm._directInactive = false; - vm._isMounted = false; - vm._isDestroyed = false; - vm._isBeingDestroyed = false; +/** + * Runtime helper for checking keyCodes from config. + * exposed as Vue.prototype._k + * passing in eventKeyName as last argument separately for backwards compat + */ +function checkKeyCodes ( + eventKeyCode, + key, + builtInKeyCode, + eventKeyName, + builtInKeyName +) { + var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; + if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { + return isKeyNotMatch(builtInKeyName, eventKeyName) + } else if (mappedKeyCode) { + return isKeyNotMatch(mappedKeyCode, eventKeyCode) + } else if (eventKeyName) { + return hyphenate(eventKeyName) !== key + } } -function lifecycleMixin (Vue) { - Vue.prototype._update = function (vnode, hydrating) { - var vm = this; - var prevEl = vm.$el; - var prevVnode = vm._vnode; - var restoreActiveInstance = setActiveInstance(vm); - vm._vnode = vnode; - // Vue.prototype.__patch__ is injected in entry points - // based on the rendering backend used. - if (!prevVnode) { - // initial render - vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); +/* */ + +/** + * Runtime helper for merging v-bind="object" into a VNode's data. + */ +function bindObjectProps ( + data, + tag, + value, + asProp, + isSync +) { + if (value) { + if (!isObject(value)) { + warn( + 'v-bind without argument expects an Object or Array value', + this + ); } else { - // updates - vm.$el = vm.__patch__(prevVnode, vnode); - } - restoreActiveInstance(); - // update __vue__ reference - if (prevEl) { - prevEl.__vue__ = null; - } - if (vm.$el) { - vm.$el.__vue__ = vm; - } - // if parent is an HOC, update its $el as well - if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { - vm.$parent.$el = vm.$el; - } - // updated hook is called by the scheduler to ensure that children are - // updated in a parent's updated hook. - }; + if (Array.isArray(value)) { + value = toObject(value); + } + var hash; + var loop = function ( key ) { + if ( + key === 'class' || + key === 'style' || + isReservedAttribute(key) + ) { + hash = data; + } else { + var type = data.attrs && data.attrs.type; + hash = asProp || config.mustUseProp(tag, type, key) + ? data.domProps || (data.domProps = {}) + : data.attrs || (data.attrs = {}); + } + var camelizedKey = camelize(key); + if (!(key in hash) && !(camelizedKey in hash)) { + hash[key] = value[key]; - Vue.prototype.$forceUpdate = function () { - var vm = this; - if (vm._watcher) { - vm._watcher.update(); - } - }; + if (isSync) { + var on = data.on || (data.on = {}); + on[("update:" + camelizedKey)] = function ($event) { + value[key] = $event; + }; + } + } + }; - Vue.prototype.$destroy = function () { - var vm = this; - if (vm._isBeingDestroyed) { - return - } - callHook(vm, 'beforeDestroy'); - vm._isBeingDestroyed = true; - // remove self from parent - var parent = vm.$parent; - if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { - remove(parent.$children, vm); - } - // teardown watchers - if (vm._watcher) { - vm._watcher.teardown(); - } - var i = vm._watchers.length; - while (i--) { - vm._watchers[i].teardown(); - } - // remove reference from data ob - // frozen object may not have observer. - if (vm._data.__ob__) { - vm._data.__ob__.vmCount--; - } - // call the last hook... - vm._isDestroyed = true; - // invoke destroy hooks on current rendered tree - vm.__patch__(vm._vnode, null); - // fire destroyed hook - callHook(vm, 'destroyed'); - // turn off all instance listeners. - vm.$off(); - // remove __vue__ reference - if (vm.$el) { - vm.$el.__vue__ = null; - } - // release circular reference (#6759) - if (vm.$vnode) { - vm.$vnode.parent = null; + for (var key in value) loop( key ); } - }; + } + return data } -function mountComponent ( - vm, - el, - hydrating +/* */ + +/** + * Runtime helper for rendering static trees. + */ +function renderStatic ( + index, + isInFor ) { - vm.$el = el; - if (!vm.$options.render) { - vm.$options.render = createEmptyVNode; - { - /* istanbul ignore if */ - if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || - vm.$options.el || el) { - warn( - 'You are using the runtime-only build of Vue where the template ' + - 'compiler is not available. Either pre-compile the templates into ' + - 'render functions, or use the compiler-included build.', - vm - ); - } else { - warn( - 'Failed to mount component: template or render function not defined.', - vm - ); - } - } + var cached = this._staticTrees || (this._staticTrees = []); + var tree = cached[index]; + // if has already-rendered static tree and not inside v-for, + // we can reuse the same tree. + if (tree && !isInFor) { + return tree } - callHook(vm, 'beforeMount'); - - var updateComponent; - /* istanbul ignore if */ - if (config.performance && mark) { - updateComponent = function () { - var name = vm._name; - var id = vm._uid; - var startTag = "vue-perf-start:" + id; - var endTag = "vue-perf-end:" + id; + // otherwise, render a fresh tree. + tree = cached[index] = this.$options.staticRenderFns[index].call( + this._renderProxy, + null, + this // for render fns generated for functional component templates + ); + markStatic(tree, ("__static__" + index), false); + return tree +} - mark(startTag); - var vnode = vm._render(); - mark(endTag); - measure(("vue " + name + " render"), startTag, endTag); +/** + * Runtime helper for v-once. + * Effectively it means marking the node as static with a unique key. + */ +function markOnce ( + tree, + index, + key +) { + markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); + return tree +} - mark(startTag); - vm._update(vnode, hydrating); - mark(endTag); - measure(("vue " + name + " patch"), startTag, endTag); - }; +function markStatic ( + tree, + key, + isOnce +) { + if (Array.isArray(tree)) { + for (var i = 0; i < tree.length; i++) { + if (tree[i] && typeof tree[i] !== 'string') { + markStaticNode(tree[i], (key + "_" + i), isOnce); + } + } } else { - updateComponent = function () { - vm._update(vm._render(), hydrating); - }; + markStaticNode(tree, key, isOnce); } +} - // we set this to vm._watcher inside the watcher's constructor - // since the watcher's initial patch may call $forceUpdate (e.g. inside child - // component's mounted hook), which relies on vm._watcher being already defined - new Watcher(vm, updateComponent, noop, { - before: function before () { - if (vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'beforeUpdate'); +function markStaticNode (node, key, isOnce) { + node.isStatic = true; + node.key = key; + node.isOnce = isOnce; +} + +/* */ + +function bindObjectListeners (data, value) { + if (value) { + if (!isPlainObject(value)) { + warn( + 'v-on without argument expects an Object value', + this + ); + } else { + var on = data.on = data.on ? extend({}, data.on) : {}; + for (var key in value) { + var existing = on[key]; + var ours = value[key]; + on[key] = existing ? [].concat(existing, ours) : ours; } } - }, true /* isRenderWatcher */); - hydrating = false; - - // manually mounted instance, call mounted on self - // mounted is called for render-created child components in its inserted hook - if (vm.$vnode == null) { - vm._isMounted = true; - callHook(vm, 'mounted'); } - return vm + return data } -function updateChildComponent ( - vm, - propsData, - listeners, - parentVnode, - renderChildren +/* */ + +function resolveScopedSlots ( + fns, // see flow/vnode + hasDynamicKeys, + res ) { - { - isUpdatingChildComponent = true; + res = res || { $stable: !hasDynamicKeys }; + for (var i = 0; i < fns.length; i++) { + var slot = fns[i]; + if (Array.isArray(slot)) { + resolveScopedSlots(slot, hasDynamicKeys, res); + } else if (slot) { + res[slot.key] = slot.fn; + } } + return res +} - // determine whether component has slot children - // we need to do this before overwriting $options._renderChildren. +/* */ - // check if there are dynamic scopedSlots (hand-written or compiled but with - // dynamic slot names). Static scoped slots compiled from template has the - // "$stable" marker. - var hasDynamicScopedSlot = !!( - (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || - (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) - ); - // Any static slot children from the parent may have changed during parent's - // update. Dynamic scoped slots may also have changed. In such cases, a forced - // update is necessary to ensure correctness. - var needsForceUpdate = !!( - renderChildren || // has new static slots - vm.$options._renderChildren || // has old static slots - hasDynamicScopedSlot - ); +function bindDynamicKeys (baseObj, values) { + for (var i = 0; i < values.length; i += 2) { + var key = values[i]; + if (typeof key === 'string' && key) { + baseObj[values[i]] = values[i + 1]; + } else if (key !== '' && key !== null) { + // null is a speical value for explicitly removing a binding + warn( + ("Invalid value for dynamic directive argument (expected string or null): " + key), + this + ); + } + } + return baseObj +} - vm.$options._parentVnode = parentVnode; - vm.$vnode = parentVnode; // update vm's placeholder node without re-render +// helper to dynamically append modifier runtime markers to event names. +// ensure only append when value is already string, otherwise it will be cast +// to string and cause the type check to miss. +function prependModifier (value, symbol) { + return typeof value === 'string' ? symbol + value : value +} - if (vm._vnode) { // update child tree's parent - vm._vnode.parent = parentVnode; - } - vm.$options._renderChildren = renderChildren; +/* */ - // update $attrs and $listeners hash - // these are also reactive so they may trigger child update if the child - // used them during render - vm.$attrs = parentVnode.data.attrs || emptyObject; - vm.$listeners = listeners || emptyObject; +function installRenderHelpers (target) { + target._o = markOnce; + target._n = toNumber; + target._s = toString; + target._l = renderList; + target._t = renderSlot; + target._q = looseEqual; + target._i = looseIndexOf; + target._m = renderStatic; + target._f = resolveFilter; + target._k = checkKeyCodes; + target._b = bindObjectProps; + target._v = createTextVNode; + target._e = createEmptyVNode; + target._u = resolveScopedSlots; + target._g = bindObjectListeners; + target._d = bindDynamicKeys; + target._p = prependModifier; +} - // update props - if (propsData && vm.$options.props) { - toggleObserving(false); - var props = vm._props; - var propKeys = vm.$options._propKeys || []; - for (var i = 0; i < propKeys.length; i++) { - var key = propKeys[i]; - var propOptions = vm.$options.props; // wtf flow? - props[key] = validateProp(key, propOptions, propsData, vm); - } - toggleObserving(true); - // keep a copy of raw propsData - vm.$options.propsData = propsData; +/* */ + +function FunctionalRenderContext ( + data, + props, + children, + parent, + Ctor +) { + var options = Ctor.options; + // ensure the createElement function in functional components + // gets a unique context - this is necessary for correct named slot check + var contextVm; + if (hasOwn(parent, '_uid')) { + contextVm = Object.create(parent); + // $flow-disable-line + contextVm._original = parent; + } else { + // the context vm passed in is a functional context as well. + // in this case we want to make sure we are able to get a hold to the + // real context instance. + contextVm = parent; + // $flow-disable-line + parent = parent._original; } + var isCompiled = isTrue(options._compiled); + var needNormalization = !isCompiled; - // update listeners - listeners = listeners || emptyObject; - var oldListeners = vm.$options._parentListeners; - vm.$options._parentListeners = listeners; - updateComponentListeners(vm, listeners, oldListeners); + this.data = data; + this.props = props; + this.children = children; + this.parent = parent; + this.listeners = data.on || emptyObject; + this.injections = resolveInject(options.inject, parent); + this.slots = function () { return resolveSlots(children, parent); }; - // resolve slots + force update if has children - if (needsForceUpdate) { - vm.$slots = resolveSlots(renderChildren, parentVnode.context); - vm.$forceUpdate(); - } + Object.defineProperty(this, 'scopedSlots', ({ + enumerable: true, + get: function get () { + return normalizeScopedSlots(data.scopedSlots, this.slots()) + } + })); - { - isUpdatingChildComponent = false; + // support for compiled functional template + if (isCompiled) { + // exposing $options for renderStatic() + this.$options = options; + // pre-resolve slots for renderSlot() + this.$slots = this.slots(); + this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); } -} -function isInInactiveTree (vm) { - while (vm && (vm = vm.$parent)) { - if (vm._inactive) { return true } + if (options._scopeId) { + this._c = function (a, b, c, d) { + var vnode = createElement(contextVm, a, b, c, d, needNormalization); + if (vnode && !Array.isArray(vnode)) { + vnode.fnScopeId = options._scopeId; + vnode.fnContext = parent; + } + return vnode + }; + } else { + this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; } - return false } -function activateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = false; - if (isInInactiveTree(vm)) { - return +installRenderHelpers(FunctionalRenderContext.prototype); + +function createFunctionalComponent ( + Ctor, + propsData, + data, + contextVm, + children +) { + var options = Ctor.options; + var props = {}; + var propOptions = options.props; + if (isDef(propOptions)) { + for (var key in propOptions) { + props[key] = validateProp(key, propOptions, propsData || emptyObject); } - } else if (vm._directInactive) { - return + } else { + if (isDef(data.attrs)) { mergeProps(props, data.attrs); } + if (isDef(data.props)) { mergeProps(props, data.props); } } - if (vm._inactive || vm._inactive === null) { - vm._inactive = false; - for (var i = 0; i < vm.$children.length; i++) { - activateChildComponent(vm.$children[i]); + + var renderContext = new FunctionalRenderContext( + data, + props, + children, + contextVm, + Ctor + ); + + var vnode = options.render.call(null, renderContext._c, renderContext); + + if (vnode instanceof VNode) { + return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) + } else if (Array.isArray(vnode)) { + var vnodes = normalizeChildren(vnode) || []; + var res = new Array(vnodes.length); + for (var i = 0; i < vnodes.length; i++) { + res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); } - callHook(vm, 'activated'); + return res } } -function deactivateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = true; - if (isInInactiveTree(vm)) { - return - } +function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { + // #7817 clone node before setting fnContext, otherwise if the node is reused + // (e.g. it was from a cached normal slot) the fnContext causes named slots + // that should not be matched to match. + var clone = cloneVNode(vnode); + clone.fnContext = contextVm; + clone.fnOptions = options; + { + (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; } - if (!vm._inactive) { - vm._inactive = true; - for (var i = 0; i < vm.$children.length; i++) { - deactivateChildComponent(vm.$children[i]); - } - callHook(vm, 'deactivated'); + if (data.slot) { + (clone.data || (clone.data = {})).slot = data.slot; } + return clone } -function callHook (vm, hook) { - // #7573 disable dep collection when invoking lifecycle hooks - pushTarget(); - var handlers = vm.$options[hook]; - var info = hook + " hook"; - if (handlers) { - for (var i = 0, j = handlers.length; i < j; i++) { - invokeWithErrorHandling(handlers[i], vm, null, vm, info); - } - } - if (vm._hasHookEvent) { - vm.$emit('hook:' + hook); +function mergeProps (to, from) { + for (var key in from) { + to[camelize(key)] = from[key]; } - popTarget(); } /* */ -var MAX_UPDATE_COUNT = 100; +/* */ -var queue = []; -var activatedChildren = []; -var has = {}; -var circular = {}; -var waiting = false; -var flushing = false; -var index = 0; +/* */ -/** - * Reset the scheduler's state. - */ -function resetSchedulerState () { - index = queue.length = activatedChildren.length = 0; - has = {}; - { - circular = {}; - } - waiting = flushing = false; -} +/* */ -// Async edge case #6566 requires saving the timestamp when event listeners are -// attached. However, calling performance.now() has a perf overhead especially -// if the page has thousands of event listeners. Instead, we take a timestamp -// every time the scheduler flushes and use that for all event listeners -// attached during that flush. -var currentFlushTimestamp = 0; +// inline hooks to be invoked on component VNodes during patch +var componentVNodeHooks = { + init: function init (vnode, hydrating) { + if ( + vnode.componentInstance && + !vnode.componentInstance._isDestroyed && + vnode.data.keepAlive + ) { + // kept-alive components, treat as a patch + var mountedNode = vnode; // work around flow + componentVNodeHooks.prepatch(mountedNode, mountedNode); + } else { + var child = vnode.componentInstance = createComponentInstanceForVnode( + vnode, + activeInstance + ); + child.$mount(hydrating ? vnode.elm : undefined, hydrating); + } + }, -// Async edge case fix requires storing an event listener's attach timestamp. -var getNow = Date.now; + prepatch: function prepatch (oldVnode, vnode) { + var options = vnode.componentOptions; + var child = vnode.componentInstance = oldVnode.componentInstance; + updateChildComponent( + child, + options.propsData, // updated props + options.listeners, // updated listeners + vnode, // new parent vnode + options.children // new children + ); + }, -// Determine what event timestamp the browser is using. Annoyingly, the -// timestamp can either be hi-res ( relative to poge load) or low-res -// (relative to UNIX epoch), so in order to compare time we have to use the -// same timestamp type when saving the flush timestamp. -if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { - // if the low-res timestamp which is bigger than the event timestamp - // (which is evaluated AFTER) it means the event is using a hi-res timestamp, - // and we need to use the hi-res version for event listeners as well. - getNow = function () { return performance.now(); }; -} + insert: function insert (vnode) { + var context = vnode.context; + var componentInstance = vnode.componentInstance; + if (!componentInstance._isMounted) { + componentInstance._isMounted = true; + callHook(componentInstance, 'mounted'); + } + if (vnode.data.keepAlive) { + if (context._isMounted) { + // vue-router#1212 + // During updates, a kept-alive component's child components may + // change, so directly walking the tree here may call activated hooks + // on incorrect children. Instead we push them into a queue which will + // be processed after the whole patch process ended. + queueActivatedComponent(componentInstance); + } else { + activateChildComponent(componentInstance, true /* direct */); + } + } + }, -/** - * Flush both queues and run the watchers. - */ -function flushSchedulerQueue () { - currentFlushTimestamp = getNow(); - flushing = true; - var watcher, id; + destroy: function destroy (vnode) { + var componentInstance = vnode.componentInstance; + if (!componentInstance._isDestroyed) { + if (!vnode.data.keepAlive) { + componentInstance.$destroy(); + } else { + deactivateChildComponent(componentInstance, true /* direct */); + } + } + } +}; - // Sort queue before flush. - // This ensures that: - // 1. Components are updated from parent to child. (because parent is always - // created before the child) - // 2. A component's user watchers are run before its render watcher (because - // user watchers are created before the render watcher) - // 3. If a component is destroyed during a parent component's watcher run, - // its watchers can be skipped. - queue.sort(function (a, b) { return a.id - b.id; }); +var hooksToMerge = Object.keys(componentVNodeHooks); - // do not cache length because more watchers might be pushed - // as we run existing watchers - for (index = 0; index < queue.length; index++) { - watcher = queue[index]; - if (watcher.before) { - watcher.before(); +function createComponent ( + Ctor, + data, + context, + children, + tag +) { + if (isUndef(Ctor)) { + return + } + + var baseCtor = context.$options._base; + + // plain options object: turn it into a constructor + if (isObject(Ctor)) { + Ctor = baseCtor.extend(Ctor); + } + + // if at this stage it's not a constructor or an async component factory, + // reject. + if (typeof Ctor !== 'function') { + { + warn(("Invalid Component definition: " + (String(Ctor))), context); } - id = watcher.id; - has[id] = null; - watcher.run(); - // in dev build, check and stop circular updates. - if (has[id] != null) { - circular[id] = (circular[id] || 0) + 1; - if (circular[id] > MAX_UPDATE_COUNT) { - warn( - 'You may have an infinite update loop ' + ( - watcher.user - ? ("in watcher with expression \"" + (watcher.expression) + "\"") - : "in a component render function." - ), - watcher.vm - ); - break - } + return + } + + // async component + var asyncFactory; + if (isUndef(Ctor.cid)) { + asyncFactory = Ctor; + Ctor = resolveAsyncComponent(asyncFactory, baseCtor); + if (Ctor === undefined) { + // return a placeholder node for async component, which is rendered + // as a comment node but preserves all the raw information for the node. + // the information will be used for async server-rendering and hydration. + return createAsyncPlaceholder( + asyncFactory, + data, + context, + children, + tag + ) } } - // keep copies of post queues before resetting state - var activatedQueue = activatedChildren.slice(); - var updatedQueue = queue.slice(); + data = data || {}; - resetSchedulerState(); + // resolve constructor options in case global mixins are applied after + // component constructor creation + resolveConstructorOptions(Ctor); - // call component updated and activated hooks - callActivatedHooks(activatedQueue); - callUpdatedHooks(updatedQueue); + // transform component v-model data into props & events + if (isDef(data.model)) { + transformModel(Ctor.options, data); + } - // devtool hook - /* istanbul ignore if */ - if (devtools && config.devtools) { - devtools.emit('flush'); + // extract props + var propsData = extractPropsFromVNodeData(data, Ctor, tag); + + // functional component + if (isTrue(Ctor.options.functional)) { + return createFunctionalComponent(Ctor, propsData, data, context, children) } -} -function callUpdatedHooks (queue) { - var i = queue.length; - while (i--) { - var watcher = queue[i]; - var vm = watcher.vm; - if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'updated'); + // extract listeners, since these needs to be treated as + // child component listeners instead of DOM listeners + var listeners = data.on; + // replace with listeners with .native modifier + // so it gets processed during parent component patch. + data.on = data.nativeOn; + + if (isTrue(Ctor.options.abstract)) { + // abstract components do not keep anything + // other than props & listeners & slot + + // work around flow + var slot = data.slot; + data = {}; + if (slot) { + data.slot = slot; } } -} -/** - * Queue a kept-alive component that was activated during patch. - * The queue will be processed after the entire tree has been patched. - */ -function queueActivatedComponent (vm) { - // setting _inactive to false here so that a render function can - // rely on checking whether it's in an inactive tree (e.g. router-view) - vm._inactive = false; - activatedChildren.push(vm); + // install component management hooks onto the placeholder node + installComponentHooks(data); + + // return a placeholder vnode + var name = Ctor.options.name || tag; + var vnode = new VNode( + ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), + data, undefined, undefined, undefined, context, + { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, + asyncFactory + ); + + return vnode } -function callActivatedHooks (queue) { - for (var i = 0; i < queue.length; i++) { - queue[i]._inactive = true; - activateChildComponent(queue[i], true /* true */); +function createComponentInstanceForVnode ( + vnode, // we know it's MountedComponentVNode but flow doesn't + parent // activeInstance in lifecycle state +) { + var options = { + _isComponent: true, + _parentVnode: vnode, + parent: parent + }; + // check inline-template render functions + var inlineTemplate = vnode.data.inlineTemplate; + if (isDef(inlineTemplate)) { + options.render = inlineTemplate.render; + options.staticRenderFns = inlineTemplate.staticRenderFns; } + return new vnode.componentOptions.Ctor(options) } -/** - * Push a watcher into the watcher queue. - * Jobs with duplicate IDs will be skipped unless it's - * pushed when the queue is being flushed. - */ -function queueWatcher (watcher) { - var id = watcher.id; - if (has[id] == null) { - has[id] = true; - if (!flushing) { - queue.push(watcher); - } else { - // if already flushing, splice the watcher based on its id - // if already past its id, it will be run next immediately. - var i = queue.length - 1; - while (i > index && queue[i].id > watcher.id) { - i--; - } - queue.splice(i + 1, 0, watcher); +function installComponentHooks (data) { + var hooks = data.hook || (data.hook = {}); + for (var i = 0; i < hooksToMerge.length; i++) { + var key = hooksToMerge[i]; + var existing = hooks[key]; + var toMerge = componentVNodeHooks[key]; + if (existing !== toMerge && !(existing && existing._merged)) { + hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; } - // queue the flush - if (!waiting) { - waiting = true; + } +} - if (!config.async) { - flushSchedulerQueue(); - return - } - nextTick(flushSchedulerQueue); +function mergeHook$1 (f1, f2) { + var merged = function (a, b) { + // flow complains about extra args which is why we use any + f1(a, b); + f2(a, b); + }; + merged._merged = true; + return merged +} + +// transform component v-model info (value and callback) into +// prop and event handler respectively. +function transformModel (options, data) { + var prop = (options.model && options.model.prop) || 'value'; + var event = (options.model && options.model.event) || 'input' + ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; + var on = data.on || (data.on = {}); + var existing = on[event]; + var callback = data.model.callback; + if (isDef(existing)) { + if ( + Array.isArray(existing) + ? existing.indexOf(callback) === -1 + : existing !== callback + ) { + on[event] = [callback].concat(existing); } + } else { + on[event] = callback; } } /* */ +var SIMPLE_NORMALIZE = 1; +var ALWAYS_NORMALIZE = 2; +// wrapper function for providing a more flexible interface +// without getting yelled at by flow +function createElement ( + context, + tag, + data, + children, + normalizationType, + alwaysNormalize +) { + if (Array.isArray(data) || isPrimitive(data)) { + normalizationType = children; + children = data; + data = undefined; + } + if (isTrue(alwaysNormalize)) { + normalizationType = ALWAYS_NORMALIZE; + } + return _createElement(context, tag, data, children, normalizationType) +} -var uid$1 = 0; - -/** - * A watcher parses an expression, collects dependencies, - * and fires callback when the expression value changes. - * This is used for both the $watch() api and directives. - */ -var Watcher = function Watcher ( - vm, - expOrFn, - cb, - options, - isRenderWatcher +function _createElement ( + context, + tag, + data, + children, + normalizationType ) { - this.vm = vm; - if (isRenderWatcher) { - vm._watcher = this; + if (isDef(data) && isDef((data).__ob__)) { + warn( + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + + 'Always create fresh vnode data objects in each render!', + context + ); + return createEmptyVNode() } - vm._watchers.push(this); - // options - if (options) { - this.deep = !!options.deep; - this.user = !!options.user; - this.lazy = !!options.lazy; - this.sync = !!options.sync; - this.before = options.before; + // object syntax in v-bind + if (isDef(data) && isDef(data.is)) { + tag = data.is; + } + if (!tag) { + // in case of component :is set to falsy value + return createEmptyVNode() + } + // warn against non-primitive key + if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) + ) { + { + warn( + 'Avoid using non-primitive value as key, ' + + 'use string/number value instead.', + context + ); + } + } + // support single function children as default scoped slot + if (Array.isArray(children) && + typeof children[0] === 'function' + ) { + data = data || {}; + data.scopedSlots = { default: children[0] }; + children.length = 0; + } + if (normalizationType === ALWAYS_NORMALIZE) { + children = normalizeChildren(children); + } else if (normalizationType === SIMPLE_NORMALIZE) { + children = simpleNormalizeChildren(children); + } + var vnode, ns; + if (typeof tag === 'string') { + var Ctor; + ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); + if (config.isReservedTag(tag)) { + // platform built-in elements + vnode = new VNode( + config.parsePlatformTagName(tag), data, children, + undefined, undefined, context + ); + } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { + // component + vnode = createComponent(Ctor, data, context, children, tag); + } else { + // unknown or unlisted namespaced elements + // check at runtime because it may get assigned a namespace when its + // parent normalizes children + vnode = new VNode( + tag, data, children, + undefined, undefined, context + ); + } } else { - this.deep = this.user = this.lazy = this.sync = false; + // direct component options / constructor + vnode = createComponent(tag, data, context, children); } - this.cb = cb; - this.id = ++uid$1; // uid for batching - this.active = true; - this.dirty = this.lazy; // for lazy watchers - this.deps = []; - this.newDeps = []; - this.depIds = new _Set(); - this.newDepIds = new _Set(); - this.expression = expOrFn.toString(); - // parse expression for getter - if (typeof expOrFn === 'function') { - this.getter = expOrFn; + if (Array.isArray(vnode)) { + return vnode + } else if (isDef(vnode)) { + if (isDef(ns)) { applyNS(vnode, ns); } + if (isDef(data)) { registerDeepBindings(data); } + return vnode } else { - this.getter = parsePath(expOrFn); - if (!this.getter) { - this.getter = noop; - warn( - "Failed watching path: \"" + expOrFn + "\" " + - 'Watcher only accepts simple dot-delimited paths. ' + - 'For full control, use a function instead.', - vm - ); - } + return createEmptyVNode() } - this.value = this.lazy - ? undefined - : this.get(); -}; +} -/** - * Evaluate the getter, and re-collect dependencies. - */ -Watcher.prototype.get = function get () { - pushTarget(this); - var value; - var vm = this.vm; - try { - value = this.getter.call(vm, vm); - } catch (e) { - if (this.user) { - handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); - } else { - throw e - } - } finally { - // "touch" every property so they are all tracked as - // dependencies for deep watching - if (this.deep) { - traverse(value); - } - popTarget(); - this.cleanupDeps(); +function applyNS (vnode, ns, force) { + vnode.ns = ns; + if (vnode.tag === 'foreignObject') { + // use default namespace inside foreignObject + ns = undefined; + force = true; } - return value -}; - -/** - * Add a dependency to this directive. - */ -Watcher.prototype.addDep = function addDep (dep) { - var id = dep.id; - if (!this.newDepIds.has(id)) { - this.newDepIds.add(id); - this.newDeps.push(dep); - if (!this.depIds.has(id)) { - dep.addSub(this); + if (isDef(vnode.children)) { + for (var i = 0, l = vnode.children.length; i < l; i++) { + var child = vnode.children[i]; + if (isDef(child.tag) && ( + isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { + applyNS(child, ns, force); + } } } -}; +} -/** - * Clean up for dependency collection. - */ -Watcher.prototype.cleanupDeps = function cleanupDeps () { - var i = this.deps.length; - while (i--) { - var dep = this.deps[i]; - if (!this.newDepIds.has(dep.id)) { - dep.removeSub(this); - } +// ref #5318 +// necessary to ensure parent re-render when deep bindings like :style and +// :class are used on slot nodes +function registerDeepBindings (data) { + if (isObject(data.style)) { + traverse(data.style); } - var tmp = this.depIds; - this.depIds = this.newDepIds; - this.newDepIds = tmp; - this.newDepIds.clear(); - tmp = this.deps; - this.deps = this.newDeps; - this.newDeps = tmp; - this.newDeps.length = 0; -}; + if (isObject(data.class)) { + traverse(data.class); + } +} + +/* */ + +function initRender (vm) { + vm._vnode = null; // the root of the child tree + vm._staticTrees = null; // v-once cached trees + var options = vm.$options; + var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree + var renderContext = parentVnode && parentVnode.context; + vm.$slots = resolveSlots(options._renderChildren, renderContext); + vm.$scopedSlots = emptyObject; + // bind the createElement fn to this instance + // so that we get proper render context inside it. + // args order: tag, data, children, normalizationType, alwaysNormalize + // internal version is used by render functions compiled from templates + vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; + // normalization is always applied for the public version, used in + // user-written render functions. + vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; + + // $attrs & $listeners are exposed for easier HOC creation. + // they need to be reactive so that HOCs using them are always updated + var parentData = parentVnode && parentVnode.data; -/** - * Subscriber interface. - * Will be called when a dependency changes. - */ -Watcher.prototype.update = function update () { /* istanbul ignore else */ - if (this.lazy) { - this.dirty = true; - } else if (this.sync) { - this.run(); - } else { - queueWatcher(this); + { + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { + !isUpdatingChildComponent && warn("$attrs is readonly.", vm); + }, true); + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { + !isUpdatingChildComponent && warn("$listeners is readonly.", vm); + }, true); } -}; +} -/** - * Scheduler job interface. - * Will be called by the scheduler. - */ -Watcher.prototype.run = function run () { - if (this.active) { - var value = this.get(); - if ( - value !== this.value || - // Deep watchers and watchers on Object/Arrays should fire even - // when the value is the same, because the value may - // have mutated. - isObject(value) || - this.deep - ) { - // set new value - var oldValue = this.value; - this.value = value; - if (this.user) { - try { - this.cb.call(this.vm, value, oldValue); - } catch (e) { - handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); - } - } else { - this.cb.call(this.vm, value, oldValue); - } - } - } -}; +var currentRenderingInstance = null; -/** - * Evaluate the value of the watcher. - * This only gets called for lazy watchers. - */ -Watcher.prototype.evaluate = function evaluate () { - this.value = this.get(); - this.dirty = false; -}; +function renderMixin (Vue) { + // install runtime convenience helpers + installRenderHelpers(Vue.prototype); -/** - * Depend on all deps collected by this watcher. - */ -Watcher.prototype.depend = function depend () { - var i = this.deps.length; - while (i--) { - this.deps[i].depend(); - } -}; + Vue.prototype.$nextTick = function (fn) { + return nextTick(fn, this) + }; -/** - * Remove self from all dependencies' subscriber list. - */ -Watcher.prototype.teardown = function teardown () { - if (this.active) { - // remove self from vm's watcher list - // this is a somewhat expensive operation so we skip it - // if the vm is being destroyed. - if (!this.vm._isBeingDestroyed) { - remove(this.vm._watchers, this); + Vue.prototype._render = function () { + var vm = this; + var ref = vm.$options; + var render = ref.render; + var _parentVnode = ref._parentVnode; + + if (_parentVnode) { + vm.$scopedSlots = normalizeScopedSlots( + _parentVnode.data.scopedSlots, + vm.$slots + ); + } + + // set parent vnode. this allows render functions to have access + // to the data on the placeholder node. + vm.$vnode = _parentVnode; + // render self + var vnode; + try { + // There's no need to maintain a stack becaues all render fns are called + // separately from one another. Nested component's render fns are called + // when parent component is patched. + currentRenderingInstance = vm; + vnode = render.call(vm._renderProxy, vm.$createElement); + } catch (e) { + handleError(e, vm, "render"); + // return error render result, + // or previous vnode to prevent render error causing blank component + /* istanbul ignore else */ + if (vm.$options.renderError) { + try { + vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); + } catch (e) { + handleError(e, vm, "renderError"); + vnode = vm._vnode; + } + } else { + vnode = vm._vnode; + } + } finally { + currentRenderingInstance = null; } - var i = this.deps.length; - while (i--) { - this.deps[i].removeSub(this); + // if the returned array contains only a single node, allow it + if (Array.isArray(vnode) && vnode.length === 1) { + vnode = vnode[0]; } - this.active = false; - } -}; + // return empty vnode in case the render function errored out + if (!(vnode instanceof VNode)) { + if (Array.isArray(vnode)) { + warn( + 'Multiple root nodes returned from render function. Render function ' + + 'should return a single root node.', + vm + ); + } + vnode = createEmptyVNode(); + } + // set parent + vnode.parent = _parentVnode; + return vnode + }; +} /* */ -var sharedPropertyDefinition = { - enumerable: true, - configurable: true, - get: noop, - set: noop -}; +function ensureCtor (comp, base) { + if ( + comp.__esModule || + (hasSymbol && comp[Symbol.toStringTag] === 'Module') + ) { + comp = comp.default; + } + return isObject(comp) + ? base.extend(comp) + : comp +} -function proxy (target, sourceKey, key) { - sharedPropertyDefinition.get = function proxyGetter () { - return this[sourceKey][key] - }; - sharedPropertyDefinition.set = function proxySetter (val) { - this[sourceKey][key] = val; - }; - Object.defineProperty(target, key, sharedPropertyDefinition); +function createAsyncPlaceholder ( + factory, + data, + context, + children, + tag +) { + var node = createEmptyVNode(); + node.asyncFactory = factory; + node.asyncMeta = { data: data, context: context, children: children, tag: tag }; + return node } -function initState (vm) { - vm._watchers = []; - var opts = vm.$options; - if (opts.props) { initProps(vm, opts.props); } - if (opts.methods) { initMethods(vm, opts.methods); } - if (opts.data) { - initData(vm); - } else { - observe(vm._data = {}, true /* asRootData */); +function resolveAsyncComponent ( + factory, + baseCtor +) { + if (isTrue(factory.error) && isDef(factory.errorComp)) { + return factory.errorComp } - if (opts.computed) { initComputed(vm, opts.computed); } - if (opts.watch && opts.watch !== nativeWatch) { - initWatch(vm, opts.watch); + + if (isDef(factory.resolved)) { + return factory.resolved } -} -function initProps (vm, propsOptions) { - var propsData = vm.$options.propsData || {}; - var props = vm._props = {}; - // cache prop keys so that future props updates can iterate using Array - // instead of dynamic object key enumeration. - var keys = vm.$options._propKeys = []; - var isRoot = !vm.$parent; - // root instance props should be converted - if (!isRoot) { - toggleObserving(false); + if (isTrue(factory.loading) && isDef(factory.loadingComp)) { + return factory.loadingComp } - var loop = function ( key ) { - keys.push(key); - var value = validateProp(key, propsOptions, propsData, vm); - /* istanbul ignore else */ - { - var hyphenatedKey = hyphenate(key); - if (isReservedAttribute(hyphenatedKey) || - config.isReservedAttr(hyphenatedKey)) { - warn( - ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), - vm - ); + + var owner = currentRenderingInstance; + if (isDef(factory.owners)) { + // already pending + factory.owners.push(owner); + } else { + var owners = factory.owners = [owner]; + var sync = true; + + var forceRender = function (renderCompleted) { + for (var i = 0, l = owners.length; i < l; i++) { + (owners[i]).$forceUpdate(); } - defineReactive$$1(props, key, value, function () { - if (!isRoot && !isUpdatingChildComponent) { - warn( - "Avoid mutating a prop directly since the value will be " + - "overwritten whenever the parent component re-renders. " + - "Instead, use a data or computed property based on the prop's " + - "value. Prop being mutated: \"" + key + "\"", - vm - ); - } - }); - } - // static props are already proxied on the component's prototype - // during Vue.extend(). We only need to proxy props defined at - // instantiation here. - if (!(key in vm)) { - proxy(vm, "_props", key); - } - }; - for (var key in propsOptions) loop( key ); - toggleObserving(true); -} + if (renderCompleted) { + owners.length = 0; + } + }; -function initData (vm) { - var data = vm.$options.data; - data = vm._data = typeof data === 'function' - ? getData(data, vm) - : data || {}; - if (!isPlainObject(data)) { - data = {}; - warn( - 'data functions should return an object:\n' + - 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', - vm - ); - } - // proxy data on instance - var keys = Object.keys(data); - var props = vm.$options.props; - var methods = vm.$options.methods; - var i = keys.length; - while (i--) { - var key = keys[i]; - { - if (methods && hasOwn(methods, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a data property."), - vm - ); + var resolve = once(function (res) { + // cache resolved + factory.resolved = ensureCtor(res, baseCtor); + // invoke callbacks only if this is not a synchronous resolve + // (async resolves are shimmed as synchronous during SSR) + if (!sync) { + forceRender(true); + } else { + owners.length = 0; } - } - if (props && hasOwn(props, key)) { + }); + + var reject = once(function (reason) { warn( - "The data property \"" + key + "\" is already declared as a prop. " + - "Use prop default value instead.", - vm + "Failed to resolve async component: " + (String(factory)) + + (reason ? ("\nReason: " + reason) : '') ); - } else if (!isReserved(key)) { - proxy(vm, "_data", key); + if (isDef(factory.errorComp)) { + factory.error = true; + forceRender(true); + } + }); + + var res = factory(resolve, reject); + + if (isObject(res)) { + if (isPromise(res)) { + // () => Promise + if (isUndef(factory.resolved)) { + res.then(resolve, reject); + } + } else if (isPromise(res.component)) { + res.component.then(resolve, reject); + + if (isDef(res.error)) { + factory.errorComp = ensureCtor(res.error, baseCtor); + } + + if (isDef(res.loading)) { + factory.loadingComp = ensureCtor(res.loading, baseCtor); + if (res.delay === 0) { + factory.loading = true; + } else { + setTimeout(function () { + if (isUndef(factory.resolved) && isUndef(factory.error)) { + factory.loading = true; + forceRender(false); + } + }, res.delay || 200); + } + } + + if (isDef(res.timeout)) { + setTimeout(function () { + if (isUndef(factory.resolved)) { + reject( + "timeout (" + (res.timeout) + "ms)" + ); + } + }, res.timeout); + } + } } - } - // observe data - observe(data, true /* asRootData */); -} -function getData (data, vm) { - // #7573 disable dep collection when invoking data getters - pushTarget(); - try { - return data.call(vm, vm) - } catch (e) { - handleError(e, vm, "data()"); - return {} - } finally { - popTarget(); + sync = false; + // return in case resolved synchronously + return factory.loading + ? factory.loadingComp + : factory.resolved } } -var computedWatcherOptions = { lazy: true }; - -function initComputed (vm, computed) { - // $flow-disable-line - var watchers = vm._computedWatchers = Object.create(null); - // computed properties are just getters during SSR - var isSSR = isServerRendering(); +/* */ - for (var key in computed) { - var userDef = computed[key]; - var getter = typeof userDef === 'function' ? userDef : userDef.get; - if (getter == null) { - warn( - ("Getter is missing for computed property \"" + key + "\"."), - vm - ); - } +function isAsyncPlaceholder (node) { + return node.isComment && node.asyncFactory +} - if (!isSSR) { - // create internal watcher for the computed property. - watchers[key] = new Watcher( - vm, - getter || noop, - noop, - computedWatcherOptions - ); - } +/* */ - // component-defined computed properties are already defined on the - // component prototype. We only need to define computed properties defined - // at instantiation here. - if (!(key in vm)) { - defineComputed(vm, key, userDef); - } else { - if (key in vm.$data) { - warn(("The computed property \"" + key + "\" is already defined in data."), vm); - } else if (vm.$options.props && key in vm.$options.props) { - warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); +function getFirstComponentChild (children) { + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + var c = children[i]; + if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { + return c } } } } -function defineComputed ( - target, - key, - userDef -) { - var shouldCache = !isServerRendering(); - if (typeof userDef === 'function') { - sharedPropertyDefinition.get = shouldCache - ? createComputedGetter(key) - : createGetterInvoker(userDef); - sharedPropertyDefinition.set = noop; - } else { - sharedPropertyDefinition.get = userDef.get - ? shouldCache && userDef.cache !== false - ? createComputedGetter(key) - : createGetterInvoker(userDef.get) - : noop; - sharedPropertyDefinition.set = userDef.set || noop; - } - if (sharedPropertyDefinition.set === noop) { - sharedPropertyDefinition.set = function () { - warn( - ("Computed property \"" + key + "\" was assigned to but it has no setter."), - this - ); - }; - } - Object.defineProperty(target, key, sharedPropertyDefinition); -} +/* */ -function createComputedGetter (key) { - return function computedGetter () { - var watcher = this._computedWatchers && this._computedWatchers[key]; - if (watcher) { - if (watcher.dirty) { - watcher.evaluate(); - } - if (Dep.target) { - watcher.depend(); - } - return watcher.value - } +/* */ + +function initEvents (vm) { + vm._events = Object.create(null); + vm._hasHookEvent = false; + // init parent attached events + var listeners = vm.$options._parentListeners; + if (listeners) { + updateComponentListeners(vm, listeners); } } -function createGetterInvoker(fn) { - return function computedGetter () { - return fn.call(this, this) - } +var target; + +function add (event, fn) { + target.$on(event, fn); } -function initMethods (vm, methods) { - var props = vm.$options.props; - for (var key in methods) { - { - if (typeof methods[key] !== 'function') { - warn( - "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + - "Did you reference the function correctly?", - vm - ); - } - if (props && hasOwn(props, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a prop."), - vm - ); - } - if ((key in vm) && isReserved(key)) { - warn( - "Method \"" + key + "\" conflicts with an existing Vue instance method. " + - "Avoid defining component methods that start with _ or $." - ); - } - } - vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); - } +function remove$1 (event, fn) { + target.$off(event, fn); } -function initWatch (vm, watch) { - for (var key in watch) { - var handler = watch[key]; - if (Array.isArray(handler)) { - for (var i = 0; i < handler.length; i++) { - createWatcher(vm, key, handler[i]); - } - } else { - createWatcher(vm, key, handler); +function createOnceHandler (event, fn) { + var _target = target; + return function onceHandler () { + var res = fn.apply(null, arguments); + if (res !== null) { + _target.$off(event, onceHandler); } } } -function createWatcher ( +function updateComponentListeners ( vm, - expOrFn, - handler, - options + listeners, + oldListeners ) { - if (isPlainObject(handler)) { - options = handler; - handler = handler.handler; - } - if (typeof handler === 'string') { - handler = vm[handler]; - } - return vm.$watch(expOrFn, handler, options) + target = vm; + updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); + target = undefined; } -function stateMixin (Vue) { - // flow somehow has problems with directly declared definition object - // when using Object.defineProperty, so we have to procedurally build up - // the object here. - var dataDef = {}; - dataDef.get = function () { return this._data }; - var propsDef = {}; - propsDef.get = function () { return this._props }; - { - dataDef.set = function () { - warn( - 'Avoid replacing instance root $data. ' + - 'Use nested data properties instead.', - this - ); - }; - propsDef.set = function () { - warn("$props is readonly.", this); - }; - } - Object.defineProperty(Vue.prototype, '$data', dataDef); - Object.defineProperty(Vue.prototype, '$props', propsDef); +function eventsMixin (Vue) { + var hookRE = /^hook:/; + Vue.prototype.$on = function (event, fn) { + var vm = this; + if (Array.isArray(event)) { + for (var i = 0, l = event.length; i < l; i++) { + vm.$on(event[i], fn); + } + } else { + (vm._events[event] || (vm._events[event] = [])).push(fn); + // optimize hook:event cost by using a boolean flag marked at registration + // instead of a hash lookup + if (hookRE.test(event)) { + vm._hasHookEvent = true; + } + } + return vm + }; - Vue.prototype.$set = set; - Vue.prototype.$delete = del; + Vue.prototype.$once = function (event, fn) { + var vm = this; + function on () { + vm.$off(event, on); + fn.apply(vm, arguments); + } + on.fn = fn; + vm.$on(event, on); + return vm + }; + + Vue.prototype.$off = function (event, fn) { + var vm = this; + // all + if (!arguments.length) { + vm._events = Object.create(null); + return vm + } + // array of events + if (Array.isArray(event)) { + for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { + vm.$off(event[i$1], fn); + } + return vm + } + // specific event + var cbs = vm._events[event]; + if (!cbs) { + return vm + } + if (!fn) { + vm._events[event] = null; + return vm + } + // specific handler + var cb; + var i = cbs.length; + while (i--) { + cb = cbs[i]; + if (cb === fn || cb.fn === fn) { + cbs.splice(i, 1); + break + } + } + return vm + }; - Vue.prototype.$watch = function ( - expOrFn, - cb, - options - ) { + Vue.prototype.$emit = function (event) { var vm = this; - if (isPlainObject(cb)) { - return createWatcher(vm, expOrFn, cb, options) - } - options = options || {}; - options.user = true; - var watcher = new Watcher(vm, expOrFn, cb, options); - if (options.immediate) { - try { - cb.call(vm, watcher.value); - } catch (error) { - handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); + { + var lowerCaseEvent = event.toLowerCase(); + if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { + tip( + "Event \"" + lowerCaseEvent + "\" is emitted in component " + + (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + + "Note that HTML attributes are case-insensitive and you cannot use " + + "v-on to listen to camelCase events when using in-DOM templates. " + + "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." + ); } } - return function unwatchFn () { - watcher.teardown(); + var cbs = vm._events[event]; + if (cbs) { + cbs = cbs.length > 1 ? toArray(cbs) : cbs; + var args = toArray(arguments, 1); + var info = "event handler for \"" + event + "\""; + for (var i = 0, l = cbs.length; i < l; i++) { + invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } } + return vm }; } /* */ -function initProvide (vm) { - var provide = vm.$options.provide; - if (provide) { - vm._provided = typeof provide === 'function' - ? provide.call(vm) - : provide; - } -} +var activeInstance = null; +var isUpdatingChildComponent = false; -function initInjections (vm) { - var result = resolveInject(vm.$options.inject, vm); - if (result) { - toggleObserving(false); - Object.keys(result).forEach(function (key) { - /* istanbul ignore else */ - { - defineReactive$$1(vm, key, result[key], function () { - warn( - "Avoid mutating an injected value directly since the changes will be " + - "overwritten whenever the provided component re-renders. " + - "injection being mutated: \"" + key + "\"", - vm - ); - }); - } - }); - toggleObserving(true); +function setActiveInstance(vm) { + var prevActiveInstance = activeInstance; + activeInstance = vm; + return function () { + activeInstance = prevActiveInstance; } } -function resolveInject (inject, vm) { - if (inject) { - // inject is :any because flow is not smart enough to figure out cached - var result = Object.create(null); - var keys = hasSymbol - ? Reflect.ownKeys(inject) - : Object.keys(inject); +function initLifecycle (vm) { + var options = vm.$options; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - // #6574 in case the inject object is observed... - if (key === '__ob__') { continue } - var provideKey = inject[key].from; - var source = vm; - while (source) { - if (source._provided && hasOwn(source._provided, provideKey)) { - result[key] = source._provided[provideKey]; - break - } - source = source.$parent; - } - if (!source) { - if ('default' in inject[key]) { - var provideDefault = inject[key].default; - result[key] = typeof provideDefault === 'function' - ? provideDefault.call(vm) - : provideDefault; - } else { - warn(("Injection \"" + key + "\" not found"), vm); - } - } + // locate first non-abstract parent + var parent = options.parent; + if (parent && !options.abstract) { + while (parent.$options.abstract && parent.$parent) { + parent = parent.$parent; } - return result + parent.$children.push(vm); } -} - -/* */ -function normalizeScopedSlots ( - slots, - normalSlots -) { - var res; - if (!slots) { - res = {}; - } else if (slots._normalized) { - return slots - } else { - res = {}; - for (var key in slots) { - if (slots[key] && key[0] !== '$') { - res[key] = normalizeScopedSlot(normalSlots, key, slots[key]); - } - } - } - // expose normal slots on scopedSlots - for (var key$1 in normalSlots) { - if (!(key$1 in res)) { - res[key$1] = proxyNormalSlot(normalSlots, key$1); - } - } - res._normalized = true; - res.$stable = slots ? slots.$stable : true; - return res -} + vm.$parent = parent; + vm.$root = parent ? parent.$root : vm; -function normalizeScopedSlot(normalSlots, key, fn) { - var normalized = function (scope) { - if ( scope === void 0 ) scope = {}; + vm.$children = []; + vm.$refs = {}; - var res = fn(scope); - return res && typeof res === 'object' && !Array.isArray(res) - ? [res] // single vnode - : normalizeChildren(res) - }; - // proxy scoped slots on normal $slots - if (!hasOwn(normalSlots, key)) { - Object.defineProperty(normalSlots, key, { - get: normalized - }); - } - return normalized + vm._watcher = null; + vm._inactive = null; + vm._directInactive = false; + vm._isMounted = false; + vm._isDestroyed = false; + vm._isBeingDestroyed = false; } -function proxyNormalSlot(slots, key) { - return function () { return slots[key]; } -} +function lifecycleMixin (Vue) { + Vue.prototype._update = function (vnode, hydrating) { + var vm = this; + var prevEl = vm.$el; + var prevVnode = vm._vnode; + var restoreActiveInstance = setActiveInstance(vm); + vm._vnode = vnode; + // Vue.prototype.__patch__ is injected in entry points + // based on the rendering backend used. + if (!prevVnode) { + // initial render + vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); + } else { + // updates + vm.$el = vm.__patch__(prevVnode, vnode); + } + restoreActiveInstance(); + // update __vue__ reference + if (prevEl) { + prevEl.__vue__ = null; + } + if (vm.$el) { + vm.$el.__vue__ = vm; + } + // if parent is an HOC, update its $el as well + if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { + vm.$parent.$el = vm.$el; + } + // updated hook is called by the scheduler to ensure that children are + // updated in a parent's updated hook. + }; -/* */ + Vue.prototype.$forceUpdate = function () { + var vm = this; + if (vm._watcher) { + vm._watcher.update(); + } + }; -/** - * Runtime helper for rendering v-for lists. - */ -function renderList ( - val, - render -) { - var ret, i, l, keys, key; - if (Array.isArray(val) || typeof val === 'string') { - ret = new Array(val.length); - for (i = 0, l = val.length; i < l; i++) { - ret[i] = render(val[i], i); + Vue.prototype.$destroy = function () { + var vm = this; + if (vm._isBeingDestroyed) { + return } - } else if (typeof val === 'number') { - ret = new Array(val); - for (i = 0; i < val; i++) { - ret[i] = render(i + 1, i); + callHook(vm, 'beforeDestroy'); + vm._isBeingDestroyed = true; + // remove self from parent + var parent = vm.$parent; + if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { + remove(parent.$children, vm); } - } else if (isObject(val)) { - if (hasSymbol && val[Symbol.iterator]) { - ret = []; - var iterator = val[Symbol.iterator](); - var result = iterator.next(); - while (!result.done) { - ret.push(render(result.value, ret.length)); - result = iterator.next(); - } - } else { - keys = Object.keys(val); - ret = new Array(keys.length); - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - ret[i] = render(val[key], key, i); - } + // teardown watchers + if (vm._watcher) { + vm._watcher.teardown(); + } + var i = vm._watchers.length; + while (i--) { + vm._watchers[i].teardown(); + } + // remove reference from data ob + // frozen object may not have observer. + if (vm._data.__ob__) { + vm._data.__ob__.vmCount--; + } + // call the last hook... + vm._isDestroyed = true; + // invoke destroy hooks on current rendered tree + vm.__patch__(vm._vnode, null); + // fire destroyed hook + callHook(vm, 'destroyed'); + // turn off all instance listeners. + vm.$off(); + // remove __vue__ reference + if (vm.$el) { + vm.$el.__vue__ = null; } - } - if (!isDef(ret)) { - ret = []; - } - (ret)._isVList = true; - return ret + // release circular reference (#6759) + if (vm.$vnode) { + vm.$vnode.parent = null; + } + }; } -/* */ - -/** - * Runtime helper for rendering - */ -function renderSlot ( - name, - fallback, - props, - bindObject +function mountComponent ( + vm, + el, + hydrating ) { - var scopedSlotFn = this.$scopedSlots[name]; - var nodes; - if (scopedSlotFn) { // scoped slot - props = props || {}; - if (bindObject) { - if (!isObject(bindObject)) { + vm.$el = el; + if (!vm.$options.render) { + vm.$options.render = createEmptyVNode; + { + /* istanbul ignore if */ + if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || + vm.$options.el || el) { warn( - 'slot v-bind without argument expects an Object', - this + 'You are using the runtime-only build of Vue where the template ' + + 'compiler is not available. Either pre-compile the templates into ' + + 'render functions, or use the compiler-included build.', + vm + ); + } else { + warn( + 'Failed to mount component: template or render function not defined.', + vm ); } - props = extend(extend({}, bindObject), props); } - nodes = scopedSlotFn(props) || fallback; - } else { - nodes = this.$slots[name] || fallback; } + callHook(vm, 'beforeMount'); - var target = props && props.slot; - if (target) { - return this.$createElement('template', { slot: target }, nodes) - } else { - return nodes - } -} + var updateComponent; + /* istanbul ignore if */ + if (config.performance && mark) { + updateComponent = function () { + var name = vm._name; + var id = vm._uid; + var startTag = "vue-perf-start:" + id; + var endTag = "vue-perf-end:" + id; -/* */ + mark(startTag); + var vnode = vm._render(); + mark(endTag); + measure(("vue " + name + " render"), startTag, endTag); -/** - * Runtime helper for resolving filters - */ -function resolveFilter (id) { - return resolveAsset(this.$options, 'filters', id, true) || identity -} + mark(startTag); + vm._update(vnode, hydrating); + mark(endTag); + measure(("vue " + name + " patch"), startTag, endTag); + }; + } else { + updateComponent = function () { + vm._update(vm._render(), hydrating); + }; + } -/* */ + // we set this to vm._watcher inside the watcher's constructor + // since the watcher's initial patch may call $forceUpdate (e.g. inside child + // component's mounted hook), which relies on vm._watcher being already defined + new Watcher(vm, updateComponent, noop, { + before: function before () { + if (vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'beforeUpdate'); + } + } + }, true /* isRenderWatcher */); + hydrating = false; -function isKeyNotMatch (expect, actual) { - if (Array.isArray(expect)) { - return expect.indexOf(actual) === -1 - } else { - return expect !== actual + // manually mounted instance, call mounted on self + // mounted is called for render-created child components in its inserted hook + if (vm.$vnode == null) { + vm._isMounted = true; + callHook(vm, 'mounted'); } + return vm } -/** - * Runtime helper for checking keyCodes from config. - * exposed as Vue.prototype._k - * passing in eventKeyName as last argument separately for backwards compat - */ -function checkKeyCodes ( - eventKeyCode, - key, - builtInKeyCode, - eventKeyName, - builtInKeyName +function updateChildComponent ( + vm, + propsData, + listeners, + parentVnode, + renderChildren ) { - var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; - if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { - return isKeyNotMatch(builtInKeyName, eventKeyName) - } else if (mappedKeyCode) { - return isKeyNotMatch(mappedKeyCode, eventKeyCode) - } else if (eventKeyName) { - return hyphenate(eventKeyName) !== key + { + isUpdatingChildComponent = true; } -} - -/* */ -/** - * Runtime helper for merging v-bind="object" into a VNode's data. - */ -function bindObjectProps ( - data, - tag, - value, - asProp, - isSync -) { - if (value) { - if (!isObject(value)) { - warn( - 'v-bind without argument expects an Object or Array value', - this - ); - } else { - if (Array.isArray(value)) { - value = toObject(value); - } - var hash; - var loop = function ( key ) { - if ( - key === 'class' || - key === 'style' || - isReservedAttribute(key) - ) { - hash = data; - } else { - var type = data.attrs && data.attrs.type; - hash = asProp || config.mustUseProp(tag, type, key) - ? data.domProps || (data.domProps = {}) - : data.attrs || (data.attrs = {}); - } - var camelizedKey = camelize(key); - if (!(key in hash) && !(camelizedKey in hash)) { - hash[key] = value[key]; + // determine whether component has slot children + // we need to do this before overwriting $options._renderChildren. - if (isSync) { - var on = data.on || (data.on = {}); - on[("update:" + camelizedKey)] = function ($event) { - value[key] = $event; - }; - } - } - }; + // check if there are dynamic scopedSlots (hand-written or compiled but with + // dynamic slot names). Static scoped slots compiled from template has the + // "$stable" marker. + var hasDynamicScopedSlot = !!( + (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || + (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) + ); - for (var key in value) loop( key ); - } - } - return data -} + // Any static slot children from the parent may have changed during parent's + // update. Dynamic scoped slots may also have changed. In such cases, a forced + // update is necessary to ensure correctness. + var needsForceUpdate = !!( + renderChildren || // has new static slots + vm.$options._renderChildren || // has old static slots + hasDynamicScopedSlot + ); -/* */ + vm.$options._parentVnode = parentVnode; + vm.$vnode = parentVnode; // update vm's placeholder node without re-render -/** - * Runtime helper for rendering static trees. - */ -function renderStatic ( - index, - isInFor -) { - var cached = this._staticTrees || (this._staticTrees = []); - var tree = cached[index]; - // if has already-rendered static tree and not inside v-for, - // we can reuse the same tree. - if (tree && !isInFor) { - return tree + if (vm._vnode) { // update child tree's parent + vm._vnode.parent = parentVnode; } - // otherwise, render a fresh tree. - tree = cached[index] = this.$options.staticRenderFns[index].call( - this._renderProxy, - null, - this // for render fns generated for functional component templates - ); - markStatic(tree, ("__static__" + index), false); - return tree -} + vm.$options._renderChildren = renderChildren; -/** - * Runtime helper for v-once. - * Effectively it means marking the node as static with a unique key. - */ -function markOnce ( - tree, - index, - key -) { - markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); - return tree -} + // update $attrs and $listeners hash + // these are also reactive so they may trigger child update if the child + // used them during render + vm.$attrs = parentVnode.data.attrs || emptyObject; + vm.$listeners = listeners || emptyObject; -function markStatic ( - tree, - key, - isOnce -) { - if (Array.isArray(tree)) { - for (var i = 0; i < tree.length; i++) { - if (tree[i] && typeof tree[i] !== 'string') { - markStaticNode(tree[i], (key + "_" + i), isOnce); - } + // update props + if (propsData && vm.$options.props) { + toggleObserving(false); + var props = vm._props; + var propKeys = vm.$options._propKeys || []; + for (var i = 0; i < propKeys.length; i++) { + var key = propKeys[i]; + var propOptions = vm.$options.props; // wtf flow? + props[key] = validateProp(key, propOptions, propsData, vm); } - } else { - markStaticNode(tree, key, isOnce); + toggleObserving(true); + // keep a copy of raw propsData + vm.$options.propsData = propsData; } -} -function markStaticNode (node, key, isOnce) { - node.isStatic = true; - node.key = key; - node.isOnce = isOnce; + // update listeners + listeners = listeners || emptyObject; + var oldListeners = vm.$options._parentListeners; + vm.$options._parentListeners = listeners; + updateComponentListeners(vm, listeners, oldListeners); + + // resolve slots + force update if has children + if (needsForceUpdate) { + vm.$slots = resolveSlots(renderChildren, parentVnode.context); + vm.$forceUpdate(); + } + + { + isUpdatingChildComponent = false; + } } -/* */ +function isInInactiveTree (vm) { + while (vm && (vm = vm.$parent)) { + if (vm._inactive) { return true } + } + return false +} -function bindObjectListeners (data, value) { - if (value) { - if (!isPlainObject(value)) { - warn( - 'v-on without argument expects an Object value', - this - ); - } else { - var on = data.on = data.on ? extend({}, data.on) : {}; - for (var key in value) { - var existing = on[key]; - var ours = value[key]; - on[key] = existing ? [].concat(existing, ours) : ours; - } +function activateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = false; + if (isInInactiveTree(vm)) { + return } + } else if (vm._directInactive) { + return + } + if (vm._inactive || vm._inactive === null) { + vm._inactive = false; + for (var i = 0; i < vm.$children.length; i++) { + activateChildComponent(vm.$children[i]); + } + callHook(vm, 'activated'); } - return data } -/* */ - -function bindDynamicKeys (baseObj, values) { - for (var i = 0; i < values.length; i += 2) { - var key = values[i]; - if (typeof key === 'string' && key) { - baseObj[values[i]] = values[i + 1]; - } else if (key !== '' && key !== null) { - // null is a speical value for explicitly removing a binding - warn( - ("Invalid value for dynamic directive argument (expected string or null): " + key), - this - ); +function deactivateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = true; + if (isInInactiveTree(vm)) { + return } } - return baseObj + if (!vm._inactive) { + vm._inactive = true; + for (var i = 0; i < vm.$children.length; i++) { + deactivateChildComponent(vm.$children[i]); + } + callHook(vm, 'deactivated'); + } } -// helper to dynamically append modifier runtime markers to event names. -// ensure only append when value is already string, otherwise it will be cast -// to string and cause the type check to miss. -function prependModifier (value, symbol) { - return typeof value === 'string' ? symbol + value : value +function callHook (vm, hook) { + // #7573 disable dep collection when invoking lifecycle hooks + pushTarget(); + var handlers = vm.$options[hook]; + var info = hook + " hook"; + if (handlers) { + for (var i = 0, j = handlers.length; i < j; i++) { + invokeWithErrorHandling(handlers[i], vm, null, vm, info); + } + } + if (vm._hasHookEvent) { + vm.$emit('hook:' + hook); + } + popTarget(); } /* */ -function installRenderHelpers (target) { - target._o = markOnce; - target._n = toNumber; - target._s = toString; - target._l = renderList; - target._t = renderSlot; - target._q = looseEqual; - target._i = looseIndexOf; - target._m = renderStatic; - target._f = resolveFilter; - target._k = checkKeyCodes; - target._b = bindObjectProps; - target._v = createTextVNode; - target._e = createEmptyVNode; - target._u = resolveScopedSlots; - target._g = bindObjectListeners; - target._d = bindDynamicKeys; - target._p = prependModifier; -} +var MAX_UPDATE_COUNT = 100; -/* */ +var queue = []; +var activatedChildren = []; +var has = {}; +var circular = {}; +var waiting = false; +var flushing = false; +var index = 0; -function FunctionalRenderContext ( - data, - props, - children, - parent, - Ctor -) { - var options = Ctor.options; - // ensure the createElement function in functional components - // gets a unique context - this is necessary for correct named slot check - var contextVm; - if (hasOwn(parent, '_uid')) { - contextVm = Object.create(parent); - // $flow-disable-line - contextVm._original = parent; - } else { - // the context vm passed in is a functional context as well. - // in this case we want to make sure we are able to get a hold to the - // real context instance. - contextVm = parent; - // $flow-disable-line - parent = parent._original; +/** + * Reset the scheduler's state. + */ +function resetSchedulerState () { + index = queue.length = activatedChildren.length = 0; + has = {}; + { + circular = {}; } - var isCompiled = isTrue(options._compiled); - var needNormalization = !isCompiled; + waiting = flushing = false; +} - this.data = data; - this.props = props; - this.children = children; - this.parent = parent; - this.listeners = data.on || emptyObject; - this.injections = resolveInject(options.inject, parent); - this.slots = function () { return resolveSlots(children, parent); }; +// Async edge case #6566 requires saving the timestamp when event listeners are +// attached. However, calling performance.now() has a perf overhead especially +// if the page has thousands of event listeners. Instead, we take a timestamp +// every time the scheduler flushes and use that for all event listeners +// attached during that flush. +var currentFlushTimestamp = 0; - Object.defineProperty(this, 'scopedSlots', ({ - enumerable: true, - get: function get () { - return normalizeScopedSlots(data.scopedSlots, this.slots()) - } - })); +// Async edge case fix requires storing an event listener's attach timestamp. +var getNow = Date.now; - // support for compiled functional template - if (isCompiled) { - // exposing $options for renderStatic() - this.$options = options; - // pre-resolve slots for renderSlot() - this.$slots = this.slots(); - this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); - } +// Determine what event timestamp the browser is using. Annoyingly, the +// timestamp can either be hi-res (relative to page load) or low-res +// (relative to UNIX epoch), so in order to compare time we have to use the +// same timestamp type when saving the flush timestamp. +if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { + // if the low-res timestamp which is bigger than the event timestamp + // (which is evaluated AFTER) it means the event is using a hi-res timestamp, + // and we need to use the hi-res version for event listeners as well. + getNow = function () { return performance.now(); }; +} - if (options._scopeId) { - this._c = function (a, b, c, d) { - var vnode = createElement(contextVm, a, b, c, d, needNormalization); - if (vnode && !Array.isArray(vnode)) { - vnode.fnScopeId = options._scopeId; - vnode.fnContext = parent; +/** + * Flush both queues and run the watchers. + */ +function flushSchedulerQueue () { + currentFlushTimestamp = getNow(); + flushing = true; + var watcher, id; + + // Sort queue before flush. + // This ensures that: + // 1. Components are updated from parent to child. (because parent is always + // created before the child) + // 2. A component's user watchers are run before its render watcher (because + // user watchers are created before the render watcher) + // 3. If a component is destroyed during a parent component's watcher run, + // its watchers can be skipped. + queue.sort(function (a, b) { return a.id - b.id; }); + + // do not cache length because more watchers might be pushed + // as we run existing watchers + for (index = 0; index < queue.length; index++) { + watcher = queue[index]; + if (watcher.before) { + watcher.before(); + } + id = watcher.id; + has[id] = null; + watcher.run(); + // in dev build, check and stop circular updates. + if (has[id] != null) { + circular[id] = (circular[id] || 0) + 1; + if (circular[id] > MAX_UPDATE_COUNT) { + warn( + 'You may have an infinite update loop ' + ( + watcher.user + ? ("in watcher with expression \"" + (watcher.expression) + "\"") + : "in a component render function." + ), + watcher.vm + ); + break } - return vnode - }; - } else { - this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; + } } -} -installRenderHelpers(FunctionalRenderContext.prototype); + // keep copies of post queues before resetting state + var activatedQueue = activatedChildren.slice(); + var updatedQueue = queue.slice(); -function createFunctionalComponent ( - Ctor, - propsData, - data, - contextVm, - children -) { - var options = Ctor.options; - var props = {}; - var propOptions = options.props; - if (isDef(propOptions)) { - for (var key in propOptions) { - props[key] = validateProp(key, propOptions, propsData || emptyObject); - } - } else { - if (isDef(data.attrs)) { mergeProps(props, data.attrs); } - if (isDef(data.props)) { mergeProps(props, data.props); } - } + resetSchedulerState(); - var renderContext = new FunctionalRenderContext( - data, - props, - children, - contextVm, - Ctor - ); + // call component updated and activated hooks + callActivatedHooks(activatedQueue); + callUpdatedHooks(updatedQueue); - var vnode = options.render.call(null, renderContext._c, renderContext); + // devtool hook + /* istanbul ignore if */ + if (devtools && config.devtools) { + devtools.emit('flush'); + } +} - if (vnode instanceof VNode) { - return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) - } else if (Array.isArray(vnode)) { - var vnodes = normalizeChildren(vnode) || []; - var res = new Array(vnodes.length); - for (var i = 0; i < vnodes.length; i++) { - res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); +function callUpdatedHooks (queue) { + var i = queue.length; + while (i--) { + var watcher = queue[i]; + var vm = watcher.vm; + if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'updated'); } - return res } } -function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { - // #7817 clone node before setting fnContext, otherwise if the node is reused - // (e.g. it was from a cached normal slot) the fnContext causes named slots - // that should not be matched to match. - var clone = cloneVNode(vnode); - clone.fnContext = contextVm; - clone.fnOptions = options; - { - (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; - } - if (data.slot) { - (clone.data || (clone.data = {})).slot = data.slot; +/** + * Queue a kept-alive component that was activated during patch. + * The queue will be processed after the entire tree has been patched. + */ +function queueActivatedComponent (vm) { + // setting _inactive to false here so that a render function can + // rely on checking whether it's in an inactive tree (e.g. router-view) + vm._inactive = false; + activatedChildren.push(vm); +} + +function callActivatedHooks (queue) { + for (var i = 0; i < queue.length; i++) { + queue[i]._inactive = true; + activateChildComponent(queue[i], true /* true */); } - return clone } -function mergeProps (to, from) { - for (var key in from) { - to[camelize(key)] = from[key]; +/** + * Push a watcher into the watcher queue. + * Jobs with duplicate IDs will be skipped unless it's + * pushed when the queue is being flushed. + */ +function queueWatcher (watcher) { + var id = watcher.id; + if (has[id] == null) { + has[id] = true; + if (!flushing) { + queue.push(watcher); + } else { + // if already flushing, splice the watcher based on its id + // if already past its id, it will be run next immediately. + var i = queue.length - 1; + while (i > index && queue[i].id > watcher.id) { + i--; + } + queue.splice(i + 1, 0, watcher); + } + // queue the flush + if (!waiting) { + waiting = true; + + if (!config.async) { + flushSchedulerQueue(); + return + } + nextTick(flushSchedulerQueue); + } } } /* */ -/* */ -/* */ -/* */ +var uid$2 = 0; -// inline hooks to be invoked on component VNodes during patch -var componentVNodeHooks = { - init: function init (vnode, hydrating) { - if ( - vnode.componentInstance && - !vnode.componentInstance._isDestroyed && - vnode.data.keepAlive - ) { - // kept-alive components, treat as a patch - var mountedNode = vnode; // work around flow - componentVNodeHooks.prepatch(mountedNode, mountedNode); - } else { - var child = vnode.componentInstance = createComponentInstanceForVnode( - vnode, - activeInstance +/** + * A watcher parses an expression, collects dependencies, + * and fires callback when the expression value changes. + * This is used for both the $watch() api and directives. + */ +var Watcher = function Watcher ( + vm, + expOrFn, + cb, + options, + isRenderWatcher +) { + this.vm = vm; + if (isRenderWatcher) { + vm._watcher = this; + } + vm._watchers.push(this); + // options + if (options) { + this.deep = !!options.deep; + this.user = !!options.user; + this.lazy = !!options.lazy; + this.sync = !!options.sync; + this.before = options.before; + } else { + this.deep = this.user = this.lazy = this.sync = false; + } + this.cb = cb; + this.id = ++uid$2; // uid for batching + this.active = true; + this.dirty = this.lazy; // for lazy watchers + this.deps = []; + this.newDeps = []; + this.depIds = new _Set(); + this.newDepIds = new _Set(); + this.expression = expOrFn.toString(); + // parse expression for getter + if (typeof expOrFn === 'function') { + this.getter = expOrFn; + } else { + this.getter = parsePath(expOrFn); + if (!this.getter) { + this.getter = noop; + warn( + "Failed watching path: \"" + expOrFn + "\" " + + 'Watcher only accepts simple dot-delimited paths. ' + + 'For full control, use a function instead.', + vm ); - child.$mount(hydrating ? vnode.elm : undefined, hydrating); } - }, - - prepatch: function prepatch (oldVnode, vnode) { - var options = vnode.componentOptions; - var child = vnode.componentInstance = oldVnode.componentInstance; - updateChildComponent( - child, - options.propsData, // updated props - options.listeners, // updated listeners - vnode, // new parent vnode - options.children // new children - ); - }, + } + this.value = this.lazy + ? undefined + : this.get(); +}; - insert: function insert (vnode) { - var context = vnode.context; - var componentInstance = vnode.componentInstance; - if (!componentInstance._isMounted) { - componentInstance._isMounted = true; - callHook(componentInstance, 'mounted'); - } - if (vnode.data.keepAlive) { - if (context._isMounted) { - // vue-router#1212 - // During updates, a kept-alive component's child components may - // change, so directly walking the tree here may call activated hooks - // on incorrect children. Instead we push them into a queue which will - // be processed after the whole patch process ended. - queueActivatedComponent(componentInstance); - } else { - activateChildComponent(componentInstance, true /* direct */); - } +/** + * Evaluate the getter, and re-collect dependencies. + */ +Watcher.prototype.get = function get () { + pushTarget(this); + var value; + var vm = this.vm; + try { + value = this.getter.call(vm, vm); + } catch (e) { + if (this.user) { + handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); + } else { + throw e } - }, - - destroy: function destroy (vnode) { - var componentInstance = vnode.componentInstance; - if (!componentInstance._isDestroyed) { - if (!vnode.data.keepAlive) { - componentInstance.$destroy(); - } else { - deactivateChildComponent(componentInstance, true /* direct */); - } + } finally { + // "touch" every property so they are all tracked as + // dependencies for deep watching + if (this.deep) { + traverse(value); } + popTarget(); + this.cleanupDeps(); } + return value }; -var hooksToMerge = Object.keys(componentVNodeHooks); - -function createComponent ( - Ctor, - data, - context, - children, - tag -) { - if (isUndef(Ctor)) { - return - } - - var baseCtor = context.$options._base; - - // plain options object: turn it into a constructor - if (isObject(Ctor)) { - Ctor = baseCtor.extend(Ctor); - } - - // if at this stage it's not a constructor or an async component factory, - // reject. - if (typeof Ctor !== 'function') { - { - warn(("Invalid Component definition: " + (String(Ctor))), context); +/** + * Add a dependency to this directive. + */ +Watcher.prototype.addDep = function addDep (dep) { + var id = dep.id; + if (!this.newDepIds.has(id)) { + this.newDepIds.add(id); + this.newDeps.push(dep); + if (!this.depIds.has(id)) { + dep.addSub(this); } - return } +}; - // async component - var asyncFactory; - if (isUndef(Ctor.cid)) { - asyncFactory = Ctor; - Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context); - if (Ctor === undefined) { - // return a placeholder node for async component, which is rendered - // as a comment node but preserves all the raw information for the node. - // the information will be used for async server-rendering and hydration. - return createAsyncPlaceholder( - asyncFactory, - data, - context, - children, - tag - ) +/** + * Clean up for dependency collection. + */ +Watcher.prototype.cleanupDeps = function cleanupDeps () { + var i = this.deps.length; + while (i--) { + var dep = this.deps[i]; + if (!this.newDepIds.has(dep.id)) { + dep.removeSub(this); } } + var tmp = this.depIds; + this.depIds = this.newDepIds; + this.newDepIds = tmp; + this.newDepIds.clear(); + tmp = this.deps; + this.deps = this.newDeps; + this.newDeps = tmp; + this.newDeps.length = 0; +}; - data = data || {}; - - // resolve constructor options in case global mixins are applied after - // component constructor creation - resolveConstructorOptions(Ctor); - - // transform component v-model data into props & events - if (isDef(data.model)) { - transformModel(Ctor.options, data); - } - - // extract props - var propsData = extractPropsFromVNodeData(data, Ctor, tag); - - // functional component - if (isTrue(Ctor.options.functional)) { - return createFunctionalComponent(Ctor, propsData, data, context, children) +/** + * Subscriber interface. + * Will be called when a dependency changes. + */ +Watcher.prototype.update = function update () { + /* istanbul ignore else */ + if (this.lazy) { + this.dirty = true; + } else if (this.sync) { + this.run(); + } else { + queueWatcher(this); } +}; - // extract listeners, since these needs to be treated as - // child component listeners instead of DOM listeners - var listeners = data.on; - // replace with listeners with .native modifier - // so it gets processed during parent component patch. - data.on = data.nativeOn; - - if (isTrue(Ctor.options.abstract)) { - // abstract components do not keep anything - // other than props & listeners & slot - - // work around flow - var slot = data.slot; - data = {}; - if (slot) { - data.slot = slot; +/** + * Scheduler job interface. + * Will be called by the scheduler. + */ +Watcher.prototype.run = function run () { + if (this.active) { + var value = this.get(); + if ( + value !== this.value || + // Deep watchers and watchers on Object/Arrays should fire even + // when the value is the same, because the value may + // have mutated. + isObject(value) || + this.deep + ) { + // set new value + var oldValue = this.value; + this.value = value; + if (this.user) { + try { + this.cb.call(this.vm, value, oldValue); + } catch (e) { + handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); + } + } else { + this.cb.call(this.vm, value, oldValue); + } } } +}; - // install component management hooks onto the placeholder node - installComponentHooks(data); - - // return a placeholder vnode - var name = Ctor.options.name || tag; - var vnode = new VNode( - ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), - data, undefined, undefined, undefined, context, - { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, - asyncFactory - ); - - return vnode -} - -function createComponentInstanceForVnode ( - vnode, // we know it's MountedComponentVNode but flow doesn't - parent // activeInstance in lifecycle state -) { - var options = { - _isComponent: true, - _parentVnode: vnode, - parent: parent - }; - // check inline-template render functions - var inlineTemplate = vnode.data.inlineTemplate; - if (isDef(inlineTemplate)) { - options.render = inlineTemplate.render; - options.staticRenderFns = inlineTemplate.staticRenderFns; - } - return new vnode.componentOptions.Ctor(options) -} +/** + * Evaluate the value of the watcher. + * This only gets called for lazy watchers. + */ +Watcher.prototype.evaluate = function evaluate () { + this.value = this.get(); + this.dirty = false; +}; -function installComponentHooks (data) { - var hooks = data.hook || (data.hook = {}); - for (var i = 0; i < hooksToMerge.length; i++) { - var key = hooksToMerge[i]; - var existing = hooks[key]; - var toMerge = componentVNodeHooks[key]; - if (existing !== toMerge && !(existing && existing._merged)) { - hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; - } +/** + * Depend on all deps collected by this watcher. + */ +Watcher.prototype.depend = function depend () { + var i = this.deps.length; + while (i--) { + this.deps[i].depend(); } -} - -function mergeHook$1 (f1, f2) { - var merged = function (a, b) { - // flow complains about extra args which is why we use any - f1(a, b); - f2(a, b); - }; - merged._merged = true; - return merged -} +}; -// transform component v-model info (value and callback) into -// prop and event handler respectively. -function transformModel (options, data) { - var prop = (options.model && options.model.prop) || 'value'; - var event = (options.model && options.model.event) || 'input' - ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; - var on = data.on || (data.on = {}); - var existing = on[event]; - var callback = data.model.callback; - if (isDef(existing)) { - if ( - Array.isArray(existing) - ? existing.indexOf(callback) === -1 - : existing !== callback - ) { - on[event] = [callback].concat(existing); +/** + * Remove self from all dependencies' subscriber list. + */ +Watcher.prototype.teardown = function teardown () { + if (this.active) { + // remove self from vm's watcher list + // this is a somewhat expensive operation so we skip it + // if the vm is being destroyed. + if (!this.vm._isBeingDestroyed) { + remove(this.vm._watchers, this); } - } else { - on[event] = callback; + var i = this.deps.length; + while (i--) { + this.deps[i].removeSub(this); + } + this.active = false; } -} +}; /* */ -var SIMPLE_NORMALIZE = 1; -var ALWAYS_NORMALIZE = 2; +var sharedPropertyDefinition = { + enumerable: true, + configurable: true, + get: noop, + set: noop +}; -// wrapper function for providing a more flexible interface -// without getting yelled at by flow -function createElement ( - context, - tag, - data, - children, - normalizationType, - alwaysNormalize -) { - if (Array.isArray(data) || isPrimitive(data)) { - normalizationType = children; - children = data; - data = undefined; +function proxy (target, sourceKey, key) { + sharedPropertyDefinition.get = function proxyGetter () { + return this[sourceKey][key] + }; + sharedPropertyDefinition.set = function proxySetter (val) { + this[sourceKey][key] = val; + }; + Object.defineProperty(target, key, sharedPropertyDefinition); +} + +function initState (vm) { + vm._watchers = []; + var opts = vm.$options; + if (opts.props) { initProps(vm, opts.props); } + if (opts.methods) { initMethods(vm, opts.methods); } + if (opts.data) { + initData(vm); + } else { + observe(vm._data = {}, true /* asRootData */); } - if (isTrue(alwaysNormalize)) { - normalizationType = ALWAYS_NORMALIZE; + if (opts.computed) { initComputed(vm, opts.computed); } + if (opts.watch && opts.watch !== nativeWatch) { + initWatch(vm, opts.watch); } - return _createElement(context, tag, data, children, normalizationType) } -function _createElement ( - context, - tag, - data, - children, - normalizationType -) { - if (isDef(data) && isDef((data).__ob__)) { +function initProps (vm, propsOptions) { + var propsData = vm.$options.propsData || {}; + var props = vm._props = {}; + // cache prop keys so that future props updates can iterate using Array + // instead of dynamic object key enumeration. + var keys = vm.$options._propKeys = []; + var isRoot = !vm.$parent; + // root instance props should be converted + if (!isRoot) { + toggleObserving(false); + } + var loop = function ( key ) { + keys.push(key); + var value = validateProp(key, propsOptions, propsData, vm); + /* istanbul ignore else */ + { + var hyphenatedKey = hyphenate(key); + if (isReservedAttribute(hyphenatedKey) || + config.isReservedAttr(hyphenatedKey)) { + warn( + ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), + vm + ); + } + defineReactive$$1(props, key, value, function () { + if (!isRoot && !isUpdatingChildComponent) { + warn( + "Avoid mutating a prop directly since the value will be " + + "overwritten whenever the parent component re-renders. " + + "Instead, use a data or computed property based on the prop's " + + "value. Prop being mutated: \"" + key + "\"", + vm + ); + } + }); + } + // static props are already proxied on the component's prototype + // during Vue.extend(). We only need to proxy props defined at + // instantiation here. + if (!(key in vm)) { + proxy(vm, "_props", key); + } + }; + + for (var key in propsOptions) loop( key ); + toggleObserving(true); +} + +function initData (vm) { + var data = vm.$options.data; + data = vm._data = typeof data === 'function' + ? getData(data, vm) + : data || {}; + if (!isPlainObject(data)) { + data = {}; warn( - "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + - 'Always create fresh vnode data objects in each render!', - context + 'data functions should return an object:\n' + + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', + vm ); - return createEmptyVNode() - } - // object syntax in v-bind - if (isDef(data) && isDef(data.is)) { - tag = data.is; - } - if (!tag) { - // in case of component :is set to falsy value - return createEmptyVNode() } - // warn against non-primitive key - if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) - ) { + // proxy data on instance + var keys = Object.keys(data); + var props = vm.$options.props; + var methods = vm.$options.methods; + var i = keys.length; + while (i--) { + var key = keys[i]; { + if (methods && hasOwn(methods, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a data property."), + vm + ); + } + } + if (props && hasOwn(props, key)) { warn( - 'Avoid using non-primitive value as key, ' + - 'use string/number value instead.', - context + "The data property \"" + key + "\" is already declared as a prop. " + + "Use prop default value instead.", + vm ); + } else if (!isReserved(key)) { + proxy(vm, "_data", key); } } - // support single function children as default scoped slot - if (Array.isArray(children) && - typeof children[0] === 'function' - ) { - data = data || {}; - data.scopedSlots = { default: children[0] }; - children.length = 0; - } - if (normalizationType === ALWAYS_NORMALIZE) { - children = normalizeChildren(children); - } else if (normalizationType === SIMPLE_NORMALIZE) { - children = simpleNormalizeChildren(children); + // observe data + observe(data, true /* asRootData */); +} + +function getData (data, vm) { + // #7573 disable dep collection when invoking data getters + pushTarget(); + try { + return data.call(vm, vm) + } catch (e) { + handleError(e, vm, "data()"); + return {} + } finally { + popTarget(); } - var vnode, ns; - if (typeof tag === 'string') { - var Ctor; - ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); - if (config.isReservedTag(tag)) { - // platform built-in elements - vnode = new VNode( - config.parsePlatformTagName(tag), data, children, - undefined, undefined, context +} + +var computedWatcherOptions = { lazy: true }; + +function initComputed (vm, computed) { + // $flow-disable-line + var watchers = vm._computedWatchers = Object.create(null); + // computed properties are just getters during SSR + var isSSR = isServerRendering(); + + for (var key in computed) { + var userDef = computed[key]; + var getter = typeof userDef === 'function' ? userDef : userDef.get; + if (getter == null) { + warn( + ("Getter is missing for computed property \"" + key + "\"."), + vm ); - } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { - // component - vnode = createComponent(Ctor, data, context, children, tag); - } else { - // unknown or unlisted namespaced elements - // check at runtime because it may get assigned a namespace when its - // parent normalizes children - vnode = new VNode( - tag, data, children, - undefined, undefined, context + } + + if (!isSSR) { + // create internal watcher for the computed property. + watchers[key] = new Watcher( + vm, + getter || noop, + noop, + computedWatcherOptions ); } + + // component-defined computed properties are already defined on the + // component prototype. We only need to define computed properties defined + // at instantiation here. + if (!(key in vm)) { + defineComputed(vm, key, userDef); + } else { + if (key in vm.$data) { + warn(("The computed property \"" + key + "\" is already defined in data."), vm); + } else if (vm.$options.props && key in vm.$options.props) { + warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); + } + } + } +} + +function defineComputed ( + target, + key, + userDef +) { + var shouldCache = !isServerRendering(); + if (typeof userDef === 'function') { + sharedPropertyDefinition.get = shouldCache + ? createComputedGetter(key) + : createGetterInvoker(userDef); + sharedPropertyDefinition.set = noop; } else { - // direct component options / constructor - vnode = createComponent(tag, data, context, children); + sharedPropertyDefinition.get = userDef.get + ? shouldCache && userDef.cache !== false + ? createComputedGetter(key) + : createGetterInvoker(userDef.get) + : noop; + sharedPropertyDefinition.set = userDef.set || noop; } - if (Array.isArray(vnode)) { - return vnode - } else if (isDef(vnode)) { - if (isDef(ns)) { applyNS(vnode, ns); } - if (isDef(data)) { registerDeepBindings(data); } - return vnode - } else { - return createEmptyVNode() + if (sharedPropertyDefinition.set === noop) { + sharedPropertyDefinition.set = function () { + warn( + ("Computed property \"" + key + "\" was assigned to but it has no setter."), + this + ); + }; } + Object.defineProperty(target, key, sharedPropertyDefinition); } -function applyNS (vnode, ns, force) { - vnode.ns = ns; - if (vnode.tag === 'foreignObject') { - // use default namespace inside foreignObject - ns = undefined; - force = true; - } - if (isDef(vnode.children)) { - for (var i = 0, l = vnode.children.length; i < l; i++) { - var child = vnode.children[i]; - if (isDef(child.tag) && ( - isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { - applyNS(child, ns, force); +function createComputedGetter (key) { + return function computedGetter () { + var watcher = this._computedWatchers && this._computedWatchers[key]; + if (watcher) { + if (watcher.dirty) { + watcher.evaluate(); } + if (Dep.target) { + watcher.depend(); + } + return watcher.value } } } -// ref #5318 -// necessary to ensure parent re-render when deep bindings like :style and -// :class are used on slot nodes -function registerDeepBindings (data) { - if (isObject(data.style)) { - traverse(data.style); - } - if (isObject(data.class)) { - traverse(data.class); +function createGetterInvoker(fn) { + return function computedGetter () { + return fn.call(this, this) } } -/* */ - -function initRender (vm) { - vm._vnode = null; // the root of the child tree - vm._staticTrees = null; // v-once cached trees - var options = vm.$options; - var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree - var renderContext = parentVnode && parentVnode.context; - vm.$slots = resolveSlots(options._renderChildren, renderContext); - vm.$scopedSlots = emptyObject; - // bind the createElement fn to this instance - // so that we get proper render context inside it. - // args order: tag, data, children, normalizationType, alwaysNormalize - // internal version is used by render functions compiled from templates - vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; - // normalization is always applied for the public version, used in - // user-written render functions. - vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; +function initMethods (vm, methods) { + var props = vm.$options.props; + for (var key in methods) { + { + if (typeof methods[key] !== 'function') { + warn( + "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + + "Did you reference the function correctly?", + vm + ); + } + if (props && hasOwn(props, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a prop."), + vm + ); + } + if ((key in vm) && isReserved(key)) { + warn( + "Method \"" + key + "\" conflicts with an existing Vue instance method. " + + "Avoid defining component methods that start with _ or $." + ); + } + } + vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); + } +} - // $attrs & $listeners are exposed for easier HOC creation. - // they need to be reactive so that HOCs using them are always updated - var parentData = parentVnode && parentVnode.data; +function initWatch (vm, watch) { + for (var key in watch) { + var handler = watch[key]; + if (Array.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + createWatcher(vm, key, handler[i]); + } + } else { + createWatcher(vm, key, handler); + } + } +} - /* istanbul ignore else */ - { - defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { - !isUpdatingChildComponent && warn("$attrs is readonly.", vm); - }, true); - defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { - !isUpdatingChildComponent && warn("$listeners is readonly.", vm); - }, true); +function createWatcher ( + vm, + expOrFn, + handler, + options +) { + if (isPlainObject(handler)) { + options = handler; + handler = handler.handler; + } + if (typeof handler === 'string') { + handler = vm[handler]; } + return vm.$watch(expOrFn, handler, options) } -function renderMixin (Vue) { - // install runtime convenience helpers - installRenderHelpers(Vue.prototype); +function stateMixin (Vue) { + // flow somehow has problems with directly declared definition object + // when using Object.defineProperty, so we have to procedurally build up + // the object here. + var dataDef = {}; + dataDef.get = function () { return this._data }; + var propsDef = {}; + propsDef.get = function () { return this._props }; + { + dataDef.set = function () { + warn( + 'Avoid replacing instance root $data. ' + + 'Use nested data properties instead.', + this + ); + }; + propsDef.set = function () { + warn("$props is readonly.", this); + }; + } + Object.defineProperty(Vue.prototype, '$data', dataDef); + Object.defineProperty(Vue.prototype, '$props', propsDef); - Vue.prototype.$nextTick = function (fn) { - return nextTick(fn, this) - }; + Vue.prototype.$set = set; + Vue.prototype.$delete = del; - Vue.prototype._render = function () { + Vue.prototype.$watch = function ( + expOrFn, + cb, + options + ) { var vm = this; - var ref = vm.$options; - var render = ref.render; - var _parentVnode = ref._parentVnode; - - if (_parentVnode) { - vm.$scopedSlots = normalizeScopedSlots( - _parentVnode.data.scopedSlots, - vm.$slots - ); + if (isPlainObject(cb)) { + return createWatcher(vm, expOrFn, cb, options) } - - // set parent vnode. this allows render functions to have access - // to the data on the placeholder node. - vm.$vnode = _parentVnode; - // render self - var vnode; - try { - vnode = render.call(vm._renderProxy, vm.$createElement); - } catch (e) { - handleError(e, vm, "render"); - // return error render result, - // or previous vnode to prevent render error causing blank component - /* istanbul ignore else */ - if (vm.$options.renderError) { - try { - vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); - } catch (e) { - handleError(e, vm, "renderError"); - vnode = vm._vnode; - } - } else { - vnode = vm._vnode; + options = options || {}; + options.user = true; + var watcher = new Watcher(vm, expOrFn, cb, options); + if (options.immediate) { + try { + cb.call(vm, watcher.value); + } catch (error) { + handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); } } - // if the returned array contains only a single node, allow it - if (Array.isArray(vnode) && vnode.length === 1) { - vnode = vnode[0]; - } - // return empty vnode in case the render function errored out - if (!(vnode instanceof VNode)) { - if (Array.isArray(vnode)) { - warn( - 'Multiple root nodes returned from render function. Render function ' + - 'should return a single root node.', - vm - ); - } - vnode = createEmptyVNode(); + return function unwatchFn () { + watcher.teardown(); } - // set parent - vnode.parent = _parentVnode; - return vnode }; } @@ -5328,7 +5331,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', { value: FunctionalRenderContext }); -Vue.version = '2.6.2'; +Vue.version = '2.6.3'; /* */ @@ -7392,6 +7395,11 @@ function createOnceHandler$1 (event, handler, capture) { } } +// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp +// implementation and does not fire microtasks in between event propagation, so +// safe to exclude. +var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); + function add$1 ( name, handler, @@ -7404,11 +7412,16 @@ function add$1 ( // the solution is simple: we save the timestamp when a handler is attached, // and the handler would only fire if the event passed to it was fired // AFTER it was attached. - if (isUsingMicroTask) { + if (useMicrotaskFix) { var attachedTimestamp = currentFlushTimestamp; var original = handler; handler = original._wrapper = function (e) { - if (e.timeStamp >= attachedTimestamp) { + if ( + e.timeStamp >= attachedTimestamp || + // #9448 bail if event is fired in another document in a multi-page + // electron/nw.js app + e.target.ownerDocument !== document + ) { return original.apply(this, arguments) } }; @@ -9420,6 +9433,8 @@ var invalidAttributeRE = /[\s"'<>\/=]/; var decodeHTMLCached = cached(he.decode); +var emptySlotScopeToken = "_empty_"; + // configurable state var warn$2; var delimiters; @@ -10032,7 +10047,7 @@ function processSlotContent (el) { var dynamic = ref.dynamic; el.slotTarget = name; el.slotTargetDynamic = dynamic; - el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf + el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf } } else { // v-slot on component, denotes default slot @@ -10067,8 +10082,13 @@ function processSlotContent (el) { var slotContainer = slots[name$1] = createASTElement('template', [], el); slotContainer.slotTarget = name$1; slotContainer.slotTargetDynamic = dynamic$1; - slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; }); - slotContainer.slotScope = slotBinding$1.value || "_"; + slotContainer.children = el.children.filter(function (c) { + if (!c.slotScope) { + c.parent = slotContainer; + return true + } + }); + slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken; // remove children as they are returned from scopedSlots now el.children = []; // mark el non-plain so data gets generated @@ -10997,7 +11017,7 @@ function genData$2 (el, state) { } // scoped slots if (el.scopedSlots) { - data += (genScopedSlots(el.scopedSlots, state)) + ","; + data += (genScopedSlots(el, el.scopedSlots, state)) + ","; } // component v-model if (el.model) { @@ -11068,16 +11088,34 @@ function genInlineTemplate (el, state) { } function genScopedSlots ( + el, slots, state ) { - var hasDynamicKeys = Object.keys(slots).some(function (key) { + // by default scoped slots are considered "stable", this allows child + // components with only scoped slots to skip forced updates from parent. + // but in some cases we have to bail-out of this optimization + // for example if the slot contains dynamic names, has v-if or v-for on them... + var needsForceUpdate = Object.keys(slots).some(function (key) { var slot = slots[key]; return slot.slotTargetDynamic || slot.if || slot.for }); + // OR when it is inside another scoped slot (the reactivity is disconnected) + // #9438 + if (!needsForceUpdate) { + var parent = el.parent; + while (parent) { + if (parent.slotScope && parent.slotScope !== emptySlotScopeToken) { + needsForceUpdate = true; + break + } + parent = parent.parent; + } + } + return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return genScopedSlot(slots[key], state) - }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") + }).join(',')) + "]" + (needsForceUpdate ? ",true" : "") + ")") } function genScopedSlot ( @@ -11091,7 +11129,10 @@ function genScopedSlot ( if (el.for && !el.forProcessed) { return genFor(el, state, genScopedSlot) } - var fn = "function(" + (String(el.slotScope)) + "){" + + var slotScope = el.slotScope === emptySlotScopeToken + ? "" + : String(el.slotScope); + var fn = "function(" + slotScope + "){" + "return " + (el.tag === 'template' ? el.if && isLegacySyntax ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined") @@ -11184,7 +11225,14 @@ function genSlot (el, state) { var slotName = el.slotName || '"default"'; var children = genChildren(el, state); var res = "_t(" + slotName + (children ? ("," + children) : ''); - var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}"); + var attrs = el.attrs || el.dynamicAttrs + ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({ + // slot props are camelized + name: camelize(attr.name), + value: attr.value, + dynamic: attr.dynamic + }); })) + : null; var bind$$1 = el.attrsMap['v-bind']; if ((attrs || bind$$1) && !children) { res += ",null"; diff --git a/dist/vue.common.prod.js b/dist/vue.common.prod.js index 44e1c7f63c3..2c7c8c6b404 100644 --- a/dist/vue.common.prod.js +++ b/dist/vue.common.prod.js @@ -1,6 +1,6 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ -"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function A(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function k(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n0,W=K&&K.indexOf("edge/")>0,Z=(K&&K.indexOf("android"),K&&/iphone|ipad|ipod|ios/.test(K)||"ios"===V),G=(K&&/chrome\/\d+/.test(K),K&&/phantomjs/.test(K),{}.watch),X=!1;if(U)try{var Y={};Object.defineProperty(Y,"passive",{get:function(){X=!0}}),window.addEventListener("test-passive",null,Y)}catch(e){}var Q=function(){return void 0===H&&(H=!U&&!z&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),H},ee=U&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function te(e){return"function"==typeof e&&/native code/.test(e.toString())}var ne,re="undefined"!=typeof Symbol&&te(Symbol)&&"undefined"!=typeof Reflect&&te(Reflect.ownKeys);ne="undefined"!=typeof Set&&te(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ie=S,oe=0,ae=function(){this.id=oe++,this.subs=[]};ae.prototype.addSub=function(e){this.subs.push(e)},ae.prototype.removeSub=function(e){h(this.subs,e)},ae.prototype.depend=function(){ae.target&&ae.target.addDep(this)},ae.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===C(e)){var c=De(String,i.type);(c<0||s0&&(at((u=e(u,(a||"")+"_"+c))[0])&&at(f)&&(s[l]=de(f.text+u[0].text),u.shift()),s.push.apply(s,u)):i(u)?at(f)?s[l]=de(f.text+u):""!==u&&s.push(de(u)):at(u)&&at(f)?s[l]=de(f.text+u.text):(r(o._isVList)&&n(u.tag)&&t(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(e):void 0}function at(e){return n(e)&&n(e.text)&&!1===e.isComment}function st(e,t){return(e.__esModule||re&&"Module"===e[Symbol.toStringTag])&&(e=e.default),o(e)?t.extend(e):e}function ct(e){return e.isComment&&e.asyncFactory}function ut(e){if(Array.isArray(e))for(var t=0;tdocument.createEvent("Event").timeStamp&&(Tt=function(){return performance.now()});var Nt=0,jt=function(e,t,n,r,i){this.vm=e,i&&(e._watcher=this),e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++Nt,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new ne,this.newDepIds=new ne,this.expression="","function"==typeof t?this.getter=t:(this.getter=function(e){if(!F.test(e)){var t=e.split(".");return function(e){for(var n=0;nOt&&wt[n].id>e.id;)n--;wt.splice(n+1,0,e)}else wt.push(e);At||(At=!0,Ge(Et))}}(this)},jt.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||o(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Pe(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},jt.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},jt.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},jt.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var Lt={enumerable:!0,configurable:!0,get:S,set:S};function Mt(e,t,n){Lt.get=function(){return this[t][n]},Lt.set=function(e){this[t][n]=e},Object.defineProperty(e,n,Lt)}function It(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[];e.$parent&&_e(!1);var o=function(o){i.push(o);var a=Le(o,t,n,e);we(r,o,a),o in e||Mt(e,"_props",o)};for(var a in t)o(a);_e(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?S:x(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;s(t=e._data="function"==typeof t?function(e,t){ce();try{return e.call(t,t)}catch(e){return Pe(e,t,"data()"),{}}finally{ue()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,i=(e.$options.methods,n.length);for(;i--;){var o=n[i];r&&y(r,o)||(a=void 0,36!==(a=(o+"").charCodeAt(0))&&95!==a&&Mt(e,"_data",o))}var a;$e(t,!0)}(e):$e(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=Q();for(var i in t){var o=t[i],a="function"==typeof o?o:o.get;r||(n[i]=new jt(e,a||S,S,Dt)),i in e||Pt(e,i,o)}}(e,t.computed),t.watch&&t.watch!==G&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function wn(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=bn(a.componentOptions);s&&!t(s)&&Cn(n,o,r,i)}}}function Cn(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=mn++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=Ne(yn(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(n),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&dt(e,t)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,i=r&&r.context;t.$slots=vt(n._renderChildren,i),t.$scopedSlots=e,t._c=function(e,n,r,i){return hn(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return hn(t,e,n,r,i,!0)};var o=r&&r.data;we(t,"$attrs",o&&o.attrs||e,null,!0),we(t,"$listeners",n._parentListeners||e,null,!0)}(n),$t(n,"beforeCreate"),function(e){var t=Bt(e.$options.inject,e);t&&(_e(!1),Object.keys(t).forEach(function(n){we(e,n,t[n])}),_e(!0))}(n),It(n),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(n),$t(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(gn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=Ce,e.prototype.$delete=xe,e.prototype.$watch=function(e,t,n){if(s(t))return Ht(this,e,t,n);(n=n||{}).user=!0;var r=new jt(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Pe(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(gn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var i=0,o=e.length;i1?A(t):t;for(var n=A(arguments,1),r='event handler for "'+e+'"',i=0,o=t.length;iparseInt(this.max)&&Cn(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return P}};Object.defineProperty(e,"config",t),e.util={warn:ie,extend:k,mergeOptions:Ne,defineReactive:we},e.set=Ce,e.delete=xe,e.nextTick=Ge,e.observable=function(e){return $e(e),e},e.options=Object.create(null),I.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,k(e.options.components,An),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=A(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=Ne(this.options,e),this}}(e),_n(e),function(e){I.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&s(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(gn),Object.defineProperty(gn.prototype,"$isServer",{get:Q}),Object.defineProperty(gn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(gn,"FunctionalRenderContext",{value:an}),gn.version="2.6.2";var kn=p("style,class"),On=p("input,textarea,option,select,progress"),Sn=function(e,t,n){return"value"===n&&On(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Tn=p("contenteditable,draggable,spellcheck"),En=p("events,caret,typing,plaintext-only"),Nn=function(e,t){return Dn(t)||"false"===t?"false":"contenteditable"===e&&En(t)?t:"true"},jn=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Ln="http://www.w3.org/1999/xlink",Mn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},In=function(e){return Mn(e)?e.slice(6,e.length):""},Dn=function(e){return null==e||!1===e};function Pn(e){for(var t=e.data,r=e,i=e;n(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(t=Rn(i.data,t));for(;n(r=r.parent);)r&&r.data&&(t=Rn(t,r.data));return function(e,t){if(n(e)||n(t))return Fn(e,Hn(t));return""}(t.staticClass,t.class)}function Rn(e,t){return{staticClass:Fn(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function Fn(e,t){return e?t?e+" "+t:e:t||""}function Hn(e){return Array.isArray(e)?function(e){for(var t,r="",i=0,o=e.length;i-1?fr(e,t,n):jn(t)?Dn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Tn(t)?e.setAttribute(t,Nn(t,n)):Mn(t)?Dn(n)?e.removeAttributeNS(Ln,In(t)):e.setAttributeNS(Ln,t,n):fr(e,t,n)}function fr(e,t,n){if(Dn(n))e.removeAttribute(t);else{if(J&&!q&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var pr={create:ur,update:ur};function dr(e,r){var i=r.elm,o=r.data,a=e.data;if(!(t(o.staticClass)&&t(o.class)&&(t(a)||t(a.staticClass)&&t(a.class)))){var s=Pn(r),c=i._transitionClasses;n(c)&&(s=Fn(s,Hn(c))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var vr,hr,mr,yr,gr,_r,br={create:dr,update:dr},$r=/[\w).+\-_$\]]/;function wr(e){var t,n,r,i,o,a=!1,s=!1,c=!1,u=!1,l=0,f=0,p=0,d=0;for(r=0;r=0&&" "===(h=e.charAt(v));v--);h&&$r.test(h)||(u=!0)}}else void 0===i?(d=r+1,i=e.slice(0,r).trim()):m();function m(){(o||(o=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===i?i=e.slice(0,r).trim():0!==d&&m(),o)for(r=0;r-1?{exp:e.slice(0,yr),key:'"'+e.slice(yr+1)+'"'}:{exp:e,key:null};hr=e,yr=gr=_r=0;for(;!Fr();)Hr(mr=Rr())?Ur(mr):91===mr&&Br(mr);return{exp:e.slice(0,gr),key:e.slice(gr+1,_r)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Rr(){return hr.charCodeAt(++yr)}function Fr(){return yr>=vr}function Hr(e){return 34===e||39===e}function Br(e){var t=1;for(gr=yr;!Fr();)if(Hr(e=Rr()))Ur(e);else if(91===e&&t++,93===e&&t--,0===t){_r=yr;break}}function Ur(e){for(var t=e;!Fr()&&(e=Rr())!==t;);}var zr,Vr="__r",Kr="__c";function Jr(e,t,n){var r=zr;return function i(){null!==t.apply(null,arguments)&&Wr(e,i,n,r)}}function qr(e,t,n,r){if(Ue){var i=St,o=t;t=o._wrapper=function(e){if(e.timeStamp>=i)return o.apply(this,arguments)}}zr.addEventListener(e,t,X?{capture:n,passive:r}:n)}function Wr(e,t,n,r){(r||zr).removeEventListener(e,t._wrapper||t,n)}function Zr(e,r){if(!t(e.data.on)||!t(r.data.on)){var i=r.data.on||{},o=e.data.on||{};zr=r.elm,function(e){if(n(e[Vr])){var t=J?"change":"input";e[t]=[].concat(e[Vr],e[t]||[]),delete e[Vr]}n(e[Kr])&&(e.change=[].concat(e[Kr],e.change||[]),delete e[Kr])}(i),nt(i,o,qr,Wr,Jr,r.context),zr=void 0}}var Gr,Xr={create:Zr,update:Zr};function Yr(e,r){if(!t(e.data.domProps)||!t(r.data.domProps)){var i,o,a=r.elm,s=e.data.domProps||{},c=r.data.domProps||{};for(i in n(c.__ob__)&&(c=r.data.domProps=k({},c)),s)t(c[i])&&(a[i]="");for(i in c){if(o=c[i],"textContent"===i||"innerHTML"===i){if(r.children&&(r.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i||o!==s[i])if("value"===i){a._value=o;var u=t(o)?"":String(o);Qr(a,u)&&(a.value=u)}else if("innerHTML"===i&&zn(a.tagName)&&t(a.innerHTML)){(Gr=Gr||document.createElement("div")).innerHTML=""+o+"";for(var l=Gr.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else a[i]=o}}}function Qr(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var r=e.value,i=e._vModifiers;if(n(i)){if(i.number)return f(r)!==f(t);if(i.trim)return r.trim()!==t.trim()}return r!==t}(e,t))}var ei={create:Yr,update:Yr},ti=g(function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach(function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t});function ni(e){var t=ri(e.style);return e.staticStyle?k(e.staticStyle,t):t}function ri(e){return Array.isArray(e)?O(e):"string"==typeof e?ti(e):e}var ii,oi=/^--/,ai=/\s*!important$/,si=function(e,t,n){if(oi.test(t))e.style.setProperty(t,n);else if(ai.test(n))e.style.setProperty(C(t),n.replace(ai,""),"important");else{var r=ui(t);if(Array.isArray(n))for(var i=0,o=n.length;i-1?t.split(pi).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function vi(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(pi).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function hi(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&k(t,mi(e.name||"v")),k(t,e),t}return"string"==typeof e?mi(e):void 0}}var mi=g(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),yi=U&&!q,gi="transition",_i="animation",bi="transition",$i="transitionend",wi="animation",Ci="animationend";yi&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(bi="WebkitTransition",$i="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(wi="WebkitAnimation",Ci="webkitAnimationEnd"));var xi=U?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Ai(e){xi(function(){xi(e)})}function ki(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),di(e,t))}function Oi(e,t){e._transitionClasses&&h(e._transitionClasses,t),vi(e,t)}function Si(e,t,n){var r=Ei(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===gi?$i:Ci,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=gi,l=a,f=o.length):t===_i?u>0&&(n=_i,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?gi:_i:null)?n===gi?o.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===gi&&Ti.test(r[bi+"Property"])}}function Ni(e,t){for(;e.length1}function Pi(e,t){!0!==t.data.show&&Li(t)}var Ri=function(e){var o,a,s={},c=e.modules,u=e.nodeOps;for(o=0;ov?_(e,t(i[y+1])?null:i[y+1].elm,i,d,y,o):d>y&&$(0,r,p,v)}(p,h,y,o,l):n(y)?(n(e.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,o)):n(h)?$(0,h,0,h.length-1):n(e.text)&&u.setTextContent(p,""):e.text!==i.text&&u.setTextContent(p,i.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(e,i)}}}function A(e,t,i){if(r(i)&&n(e.parent))e.parent.data.pendingInsert=t;else for(var o=0;o-1,a.selected!==o&&(a.selected=o);else if(N(zi(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function Ui(e,t){return t.every(function(t){return!N(t,e)})}function zi(e){return"_value"in e?e._value:e.value}function Vi(e){e.target.composing=!0}function Ki(e){e.target.composing&&(e.target.composing=!1,Ji(e.target,"input"))}function Ji(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function qi(e){return!e.componentInstance||e.data&&e.data.transition?e:qi(e.componentInstance._vnode)}var Wi={model:Fi,show:{bind:function(e,t,n){var r=t.value,i=(n=qi(n)).data&&n.data.transition,o=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&i?(n.data.show=!0,Li(n,function(){e.style.display=o})):e.style.display=r?o:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=qi(n)).data&&n.data.transition?(n.data.show=!0,r?Li(n,function(){e.style.display=e.__vOriginalDisplay}):Mi(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,i){i||(e.style.display=e.__vOriginalDisplay)}}},Zi={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Gi(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?Gi(ut(t.children)):e}function Xi(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var i=n._parentListeners;for(var o in i)t[b(o)]=i[o];return t}function Yi(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var Qi=function(e){return e.tag||ct(e)},eo=function(e){return"show"===e.name},to={name:"transition",props:Zi,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(Qi)).length){var r=this.mode,o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var a=Gi(o);if(!a)return o;if(this._leaving)return Yi(e,o);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:i(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=Xi(this),u=this._vnode,l=Gi(u);if(a.data.directives&&a.data.directives.some(eo)&&(a.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(a,l)&&!ct(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=k({},c);if("out-in"===r)return this._leaving=!0,rt(f,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),Yi(e,o);if("in-out"===r){if(ct(a))return u;var p,d=function(){p()};rt(c,"afterEnter",d),rt(c,"enterCancelled",d),rt(f,"delayLeave",function(e){p=e})}}return o}}},no=k({tag:String,moveClass:String},Zi);function ro(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function io(e){e.data.newPos=e.elm.getBoundingClientRect()}function oo(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,i=t.top-n.top;if(r||i){e.data.moved=!0;var o=e.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}delete no.mode;var ao={Transition:to,TransitionGroup:{props:no,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var i=gt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,i(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],a=Xi(this),s=0;s-1?Jn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Jn[e]=/HTMLUnknownElement/.test(t.toString())},k(gn.options.directives,Wi),k(gn.options.components,ao),gn.prototype.__patch__=U?Ri:S,gn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=pe),$t(e,"beforeMount"),r=function(){e._update(e._render(),n)},new jt(e,r,S,{before:function(){e._isMounted&&!e._isDestroyed&&$t(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,$t(e,"mounted")),e}(this,e=e&&U?Wn(e):void 0,t)},U&&setTimeout(function(){P.devtools&&ee&&ee.emit("init",gn)},0);var so=/\{\{((?:.|\r?\n)+?)\}\}/g,co=/[-.*+?^${}()|[\]\/\\]/g,uo=g(function(e){var t=e[0].replace(co,"\\$&"),n=e[1].replace(co,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")});var lo={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Lr(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=jr(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var fo,po={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Lr(e,"style");n&&(e.staticStyle=JSON.stringify(ti(n)));var r=jr(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},vo=function(e){return(fo=fo||document.createElement("div")).innerHTML=e,fo.textContent},ho=p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),mo=p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),yo=p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),go=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,_o=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,bo="[a-zA-Z_][\\-\\.0-9_a-zA-Za-zA-Z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*",$o="((?:"+bo+"\\:)?"+bo+")",wo=new RegExp("^<"+$o),Co=/^\s*(\/?)>/,xo=new RegExp("^<\\/"+$o+"[^>]*>"),Ao=/^]+>/i,ko=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},No=/&(?:lt|gt|quot|amp|#39);/g,jo=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Lo=p("pre,textarea",!0),Mo=function(e,t){return e&&Lo(e)&&"\n"===t[0]};function Io(e,t){var n=t?jo:No;return e.replace(n,function(e){return Eo[e]})}var Do,Po,Ro,Fo,Ho,Bo,Uo,zo,Vo=/^@|^v-on:/,Ko=/^v-|^@|^:/,Jo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,qo=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Wo=/^\(|\)$/g,Zo=/^\[.*\]$/,Go=/:(.*)$/,Xo=/^:|^\.|^v-bind:/,Yo=/\.[^.]+/g,Qo=/^v-slot(:|$)|^#/,ea=/[\r\n]/,ta=/\s+/g,na=g(vo);function ra(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:la(t),rawAttrsMap:{},parent:n,children:[]}}function ia(e,t){Do=t.warn||xr,Bo=t.isPreTag||T,Uo=t.mustUseProp||T,zo=t.getTagNamespace||T;t.isReservedTag;Ro=Ar(t.modules,"transformNode"),Fo=Ar(t.modules,"preTransformNode"),Ho=Ar(t.modules,"postTransformNode"),Po=t.delimiters;var n,r,i=[],o=!1!==t.preserveWhitespace,a=t.whitespace,s=!1,c=!1;function u(e){if(l(e),s||e.processed||(e=oa(e,t)),i.length||e===n||n.if&&(e.elseif||e.else)&&sa(n,{exp:e.elseif,block:e}),r&&!e.forbidden)if(e.elseif||e.else)a=e,(u=function(e){var t=e.length;for(;t--;){if(1===e[t].type)return e[t];e.pop()}}(r.children))&&u.if&&sa(u,{exp:a.elseif,block:a});else{if(e.slotScope){var o=e.slotTarget||'"default"';(r.scopedSlots||(r.scopedSlots={}))[o]=e}r.children.push(e),e.parent=r}var a,u;e.children=e.children.filter(function(e){return!e.slotScope}),l(e),e.pre&&(s=!1),Bo(e.tag)&&(c=!1);for(var f=0;f]*>)","i")),p=e.replace(f,function(e,n,r){return u=r.length,So(l)||"noscript"===l||(n=n.replace(//g,"$1").replace(//g,"$1")),Mo(l,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""});c+=e.length-p.length,e=p,k(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(ko.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),C(v+3);continue}}if(Oo.test(e)){var h=e.indexOf("]>");if(h>=0){C(h+2);continue}}var m=e.match(Ao);if(m){C(m[0].length);continue}var y=e.match(xo);if(y){var g=c;C(y[0].length),k(y[1],g,c);continue}var _=x();if(_){A(_),Mo(_.tagName,e)&&C(1);continue}}var b=void 0,$=void 0,w=void 0;if(d>=0){for($=e.slice(d);!(xo.test($)||wo.test($)||ko.test($)||Oo.test($)||(w=$.indexOf("<",1))<0);)d+=w,$=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&C(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function C(t){c+=t,e=e.substring(t)}function x(){var t=e.match(wo);if(t){var n,r,i={tagName:t[1],attrs:[],start:c};for(C(t[0].length);!(n=e.match(Co))&&(r=e.match(_o)||e.match(go));)r.start=c,C(r[0].length),r.end=c,i.attrs.push(r);if(n)return i.unarySlash=n[1],C(n[0].length),i.end=c,i}}function A(e){var n=e.tagName,c=e.unarySlash;o&&("p"===r&&yo(n)&&k(r),s(n)&&r===n&&k(n));for(var u=a(n)||!!c,l=e.attrs.length,f=new Array(l),p=0;p=0&&i[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=i.length-1;u>=a;u--)t.end&&t.end(i[u].tag,n,o);i.length=a,r=a&&i[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,o):"p"===s&&(t.start&&t.start(e,[],!1,n,o),t.end&&t.end(e,n,o))}k()}(e,{warn:Do,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,l){var f=r&&r.ns||zo(e);J&&"svg"===f&&(o=function(e){for(var t=[],n=0;nc&&(s.push(o=e.slice(c,i)),a.push(JSON.stringify(o)));var u=wr(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+r[0].length}return c-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),Nr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Pr(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Pr(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Pr(t,"$$c")+"}",null,!0)}(e,r,i);else if("input"===o&&"radio"===a)!function(e,t,n){var r=n&&n.number,i=jr(e,"value")||"null";kr(e,"checked","_q("+t+","+(i=r?"_n("+i+")":i)+")"),Nr(e,"change",Pr(t,i),null,!0)}(e,r,i);else if("input"===o||"textarea"===o)!function(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?Vr:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=Pr(t,l);c&&(f="if($event.target.composing)return;"+f),kr(e,"value","("+t+")"),Nr(e,u,f,null,!0),(s||a)&&Nr(e,"blur","$forceUpdate()")}(e,r,i);else if(!P.isReservedTag(o))return Dr(e,r,i),!1;return!0},text:function(e,t){t.value&&kr(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&kr(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:ho,mustUseProp:Sn,canBeLeftOpenTag:mo,isReservedTag:Vn,getTagNamespace:Kn,staticKeys:function(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}(va)},ga=g(function(e){return p("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))});function _a(e,t){e&&(ha=ga(t.staticKeys||""),ma=t.isReservedTag||T,function e(t){t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||d(e.tag)||!ma(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(ha)))}(t);if(1===t.type){if(!ma(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n|^function\s*\(/,$a=/\([^)]*?\);*$/,wa=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Ca={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},xa={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Aa=function(e){return"if("+e+")return null;"},ka={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Aa("$event.target !== $event.currentTarget"),ctrl:Aa("!$event.ctrlKey"),shift:Aa("!$event.shiftKey"),alt:Aa("!$event.altKey"),meta:Aa("!$event.metaKey"),left:Aa("'button' in $event && $event.button !== 0"),middle:Aa("'button' in $event && $event.button !== 1"),right:Aa("'button' in $event && $event.button !== 2")};function Oa(e,t){var n=t?"nativeOn:":"on:",r="",i="";for(var o in e){var a=Sa(e[o]);e[o]&&e[o].dynamic?i+=o+","+a+",":r+='"'+o+'":'+a+","}return r="{"+r.slice(0,-1)+"}",i?n+"_d("+r+",["+i.slice(0,-1)+"])":n+r}function Sa(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map(function(e){return Sa(e)}).join(",")+"]";var t=wa.test(e.value),n=ba.test(e.value),r=wa.test(e.value.replace($a,""));if(e.modifiers){var i="",o="",a=[];for(var s in e.modifiers)if(ka[s])o+=ka[s],Ca[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;o+=Aa(["ctrl","shift","alt","meta"].filter(function(e){return!c[e]}).map(function(e){return"$event."+e+"Key"}).join("||"))}else a.push(s);return a.length&&(i+=function(e){return"if(('keyCode' in $event)&&"+e.map(Ta).join("&&")+")return null;"}(a)),o&&(i+=o),"function($event){"+i+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function Ta(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Ca[e],r=xa[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Ea={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:S},Na=function(e){this.options=e,this.warn=e.warn||xr,this.transforms=Ar(e.modules,"transformCode"),this.dataGenFns=Ar(e.modules,"genData"),this.directives=k(k({},Ea),e.directives);var t=e.isReservedTag||T;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function ja(e,t){var n=new Na(t);return{render:"with(this){return "+(e?La(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function La(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Ma(e,t);if(e.once&&!e.onceProcessed)return Ia(e,t);if(e.for&&!e.forProcessed)return Pa(e,t);if(e.if&&!e.ifProcessed)return Da(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=Ha(e,t),i="_t("+n+(r?","+r:""),o=e.attrs&&"{"+e.attrs.map(function(e){return b(e.name)+":"+e.value}).join(",")+"}",a=e.attrsMap["v-bind"];!o&&!a||r||(i+=",null");o&&(i+=","+o);a&&(i+=(o?"":",null")+","+a);return i+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:Ha(t,n,!0);return"_c("+e+","+Ra(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Ra(e,t));var i=e.inlineTemplate?null:Ha(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(i?","+i:"")+")"}for(var o=0;o':'
',Wa.innerHTML.indexOf(" ")>0}var Ya=!!U&&Xa(!1),Qa=!!U&&Xa(!0),es=g(function(e){var t=Wn(e);return t&&t.innerHTML}),ts=gn.prototype.$mount;gn.prototype.$mount=function(e,t){if((e=e&&Wn(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=es(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){var i=Ga(r,{outputSourceRange:!1,shouldDecodeNewlines:Ya,shouldDecodeNewlinesForHref:Qa,delimiters:n.delimiters,comments:n.comments},this),o=i.render,a=i.staticRenderFns;n.render=o,n.staticRenderFns=a}}return ts.call(this,e,t)},gn.compile=Ga,module.exports=gn; \ No newline at end of file +"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function A(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function k(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n0,W=K&&K.indexOf("edge/")>0,Z=(K&&K.indexOf("android"),K&&/iphone|ipad|ipod|ios/.test(K)||"ios"===V),G=(K&&/chrome\/\d+/.test(K),K&&/phantomjs/.test(K),K&&K.match(/firefox\/(\d+)/)),X={}.watch,Y=!1;if(U)try{var Q={};Object.defineProperty(Q,"passive",{get:function(){Y=!0}}),window.addEventListener("test-passive",null,Q)}catch(e){}var ee=function(){return void 0===H&&(H=!U&&!z&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),H},te=U&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ne(e){return"function"==typeof e&&/native code/.test(e.toString())}var re,ie="undefined"!=typeof Symbol&&ne(Symbol)&&"undefined"!=typeof Reflect&&ne(Reflect.ownKeys);re="undefined"!=typeof Set&&ne(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var oe=S,ae=0,se=function(){this.id=ae++,this.subs=[]};se.prototype.addSub=function(e){this.subs.push(e)},se.prototype.removeSub=function(e){h(this.subs,e)},se.prototype.depend=function(){se.target&&se.target.addDep(this)},se.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===C(e)){var c=Pe(String,i.type);(c<0||s0&&(at((u=e(u,(a||"")+"_"+c))[0])&&at(f)&&(s[l]=ve(f.text+u[0].text),u.shift()),s.push.apply(s,u)):i(u)?at(f)?s[l]=ve(f.text+u):""!==u&&s.push(ve(u)):at(u)&&at(f)?s[l]=ve(f.text+u.text):(r(o._isVList)&&n(u.tag)&&t(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(e):void 0}function at(e){return n(e)&&n(e.text)&&!1===e.isComment}function st(e,t){if(e){for(var n=Object.create(null),r=ie?Reflect.ownKeys(e):Object.keys(e),i=0;idocument.createEvent("Event").timeStamp&&(an=function(){return performance.now()});var cn=0,un=function(e,t,n,r,i){this.vm=e,i&&(e._watcher=this),e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++cn,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new re,this.newDepIds=new re,this.expression="","function"==typeof t?this.getter=t:(this.getter=function(e){if(!F.test(e)){var t=e.split(".");return function(e){for(var n=0;nrn&&Yt[n].id>e.id;)n--;Yt.splice(n+1,0,e)}else Yt.push(e);tn||(tn=!0,Xe(sn))}}(this)},un.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||o(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Re(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},un.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},un.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},un.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var ln={enumerable:!0,configurable:!0,get:S,set:S};function fn(e,t,n){ln.get=function(){return this[t][n]},ln.set=function(e){this[t][n]=e},Object.defineProperty(e,n,ln)}function pn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[];e.$parent&&be(!1);var o=function(o){i.push(o);var a=Me(o,t,n,e);Ce(r,o,a),o in e||fn(e,"_props",o)};for(var a in t)o(a);be(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?S:x(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;s(t=e._data="function"==typeof t?function(e,t){ue();try{return e.call(t,t)}catch(e){return Re(e,t,"data()"),{}}finally{le()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,i=(e.$options.methods,n.length);for(;i--;){var o=n[i];r&&y(r,o)||(a=void 0,36!==(a=(o+"").charCodeAt(0))&&95!==a&&fn(e,"_data",o))}var a;we(t,!0)}(e):we(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=ee();for(var i in t){var o=t[i],a="function"==typeof o?o:o.get;r||(n[i]=new un(e,a||S,S,dn)),i in e||vn(e,i,o)}}(e,t.computed),t.watch&&t.watch!==X&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function xn(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=wn(a.componentOptions);s&&!t(s)&&An(n,o,r,i)}}}function An(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=gn++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=je(_n(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(n),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Jt(e,t)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,i=r&&r.context;t.$slots=ct(n._renderChildren,i),t.$scopedSlots=e,t._c=function(e,n,r,i){return Pt(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return Pt(t,e,n,r,i,!0)};var o=r&&r.data;Ce(t,"$attrs",o&&o.attrs||e,null,!0),Ce(t,"$listeners",n._parentListeners||e,null,!0)}(n),Xt(n,"beforeCreate"),function(e){var t=st(e.$options.inject,e);t&&(be(!1),Object.keys(t).forEach(function(n){Ce(e,n,t[n])}),be(!0))}(n),pn(n),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(n),Xt(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(bn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=xe,e.prototype.$delete=Ae,e.prototype.$watch=function(e,t,n){if(s(t))return yn(this,e,t,n);(n=n||{}).user=!0;var r=new un(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Re(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(bn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var i=0,o=e.length;i1?A(t):t;for(var n=A(arguments,1),r='event handler for "'+e+'"',i=0,o=t.length;iparseInt(this.max)&&An(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return P}};Object.defineProperty(e,"config",t),e.util={warn:oe,extend:k,mergeOptions:je,defineReactive:Ce},e.set=xe,e.delete=Ae,e.nextTick=Xe,e.observable=function(e){return we(e),e},e.options=Object.create(null),I.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,k(e.options.components,On),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=A(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=je(this.options,e),this}}(e),$n(e),function(e){I.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&s(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(bn),Object.defineProperty(bn.prototype,"$isServer",{get:ee}),Object.defineProperty(bn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(bn,"FunctionalRenderContext",{value:St}),bn.version="2.6.3";var Sn=p("style,class"),Tn=p("input,textarea,option,select,progress"),En=function(e,t,n){return"value"===n&&Tn(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Nn=p("contenteditable,draggable,spellcheck"),jn=p("events,caret,typing,plaintext-only"),Ln=function(e,t){return Rn(t)||"false"===t?"false":"contenteditable"===e&&jn(t)?t:"true"},Mn=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),In="http://www.w3.org/1999/xlink",Dn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Pn=function(e){return Dn(e)?e.slice(6,e.length):""},Rn=function(e){return null==e||!1===e};function Fn(e){for(var t=e.data,r=e,i=e;n(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(t=Hn(i.data,t));for(;n(r=r.parent);)r&&r.data&&(t=Hn(t,r.data));return function(e,t){if(n(e)||n(t))return Bn(e,Un(t));return""}(t.staticClass,t.class)}function Hn(e,t){return{staticClass:Bn(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function Bn(e,t){return e?t?e+" "+t:e:t||""}function Un(e){return Array.isArray(e)?function(e){for(var t,r="",i=0,o=e.length;i-1?dr(e,t,n):Mn(t)?Rn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Nn(t)?e.setAttribute(t,Ln(t,n)):Dn(t)?Rn(n)?e.removeAttributeNS(In,Pn(t)):e.setAttributeNS(In,t,n):dr(e,t,n)}function dr(e,t,n){if(Rn(n))e.removeAttribute(t);else{if(J&&!q&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var vr={create:fr,update:fr};function hr(e,r){var i=r.elm,o=r.data,a=e.data;if(!(t(o.staticClass)&&t(o.class)&&(t(a)||t(a.staticClass)&&t(a.class)))){var s=Fn(r),c=i._transitionClasses;n(c)&&(s=Bn(s,Un(c))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var mr,yr,gr,_r,br,$r,wr={create:hr,update:hr},Cr=/[\w).+\-_$\]]/;function xr(e){var t,n,r,i,o,a=!1,s=!1,c=!1,u=!1,l=0,f=0,p=0,d=0;for(r=0;r=0&&" "===(h=e.charAt(v));v--);h&&Cr.test(h)||(u=!0)}}else void 0===i?(d=r+1,i=e.slice(0,r).trim()):m();function m(){(o||(o=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===i?i=e.slice(0,r).trim():0!==d&&m(),o)for(r=0;r-1?{exp:e.slice(0,_r),key:'"'+e.slice(_r+1)+'"'}:{exp:e,key:null};yr=e,_r=br=$r=0;for(;!Br();)Ur(gr=Hr())?Vr(gr):91===gr&&zr(gr);return{exp:e.slice(0,br),key:e.slice(br+1,$r)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Hr(){return yr.charCodeAt(++_r)}function Br(){return _r>=mr}function Ur(e){return 34===e||39===e}function zr(e){var t=1;for(br=_r;!Br();)if(Ur(e=Hr()))Vr(e);else if(91===e&&t++,93===e&&t--,0===t){$r=_r;break}}function Vr(e){for(var t=e;!Br()&&(e=Hr())!==t;);}var Kr,Jr="__r",qr="__c";function Wr(e,t,n){var r=Kr;return function i(){null!==t.apply(null,arguments)&&Xr(e,i,n,r)}}var Zr=ze&&!(G&&Number(G[1])<=53);function Gr(e,t,n,r){if(Zr){var i=on,o=t;t=o._wrapper=function(e){if(e.timeStamp>=i||e.target.ownerDocument!==document)return o.apply(this,arguments)}}Kr.addEventListener(e,t,Y?{capture:n,passive:r}:n)}function Xr(e,t,n,r){(r||Kr).removeEventListener(e,t._wrapper||t,n)}function Yr(e,r){if(!t(e.data.on)||!t(r.data.on)){var i=r.data.on||{},o=e.data.on||{};Kr=r.elm,function(e){if(n(e[Jr])){var t=J?"change":"input";e[t]=[].concat(e[Jr],e[t]||[]),delete e[Jr]}n(e[qr])&&(e.change=[].concat(e[qr],e.change||[]),delete e[qr])}(i),nt(i,o,Gr,Xr,Wr,r.context),Kr=void 0}}var Qr,ei={create:Yr,update:Yr};function ti(e,r){if(!t(e.data.domProps)||!t(r.data.domProps)){var i,o,a=r.elm,s=e.data.domProps||{},c=r.data.domProps||{};for(i in n(c.__ob__)&&(c=r.data.domProps=k({},c)),s)t(c[i])&&(a[i]="");for(i in c){if(o=c[i],"textContent"===i||"innerHTML"===i){if(r.children&&(r.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i||o!==s[i])if("value"===i){a._value=o;var u=t(o)?"":String(o);ni(a,u)&&(a.value=u)}else if("innerHTML"===i&&Kn(a.tagName)&&t(a.innerHTML)){(Qr=Qr||document.createElement("div")).innerHTML=""+o+"";for(var l=Qr.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else a[i]=o}}}function ni(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var r=e.value,i=e._vModifiers;if(n(i)){if(i.number)return f(r)!==f(t);if(i.trim)return r.trim()!==t.trim()}return r!==t}(e,t))}var ri={create:ti,update:ti},ii=g(function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach(function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t});function oi(e){var t=ai(e.style);return e.staticStyle?k(e.staticStyle,t):t}function ai(e){return Array.isArray(e)?O(e):"string"==typeof e?ii(e):e}var si,ci=/^--/,ui=/\s*!important$/,li=function(e,t,n){if(ci.test(t))e.style.setProperty(t,n);else if(ui.test(n))e.style.setProperty(C(t),n.replace(ui,""),"important");else{var r=pi(t);if(Array.isArray(n))for(var i=0,o=n.length;i-1?t.split(hi).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function yi(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(hi).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function gi(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&k(t,_i(e.name||"v")),k(t,e),t}return"string"==typeof e?_i(e):void 0}}var _i=g(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),bi=U&&!q,$i="transition",wi="animation",Ci="transition",xi="transitionend",Ai="animation",ki="animationend";bi&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Ci="WebkitTransition",xi="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Ai="WebkitAnimation",ki="webkitAnimationEnd"));var Oi=U?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Si(e){Oi(function(){Oi(e)})}function Ti(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),mi(e,t))}function Ei(e,t){e._transitionClasses&&h(e._transitionClasses,t),yi(e,t)}function Ni(e,t,n){var r=Li(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===$i?xi:ki,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=$i,l=a,f=o.length):t===wi?u>0&&(n=wi,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?$i:wi:null)?n===$i?o.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===$i&&ji.test(r[Ci+"Property"])}}function Mi(e,t){for(;e.length1}function Hi(e,t){!0!==t.data.show&&Di(t)}var Bi=function(e){var o,a,s={},c=e.modules,u=e.nodeOps;for(o=0;ov?_(e,t(i[y+1])?null:i[y+1].elm,i,d,y,o):d>y&&$(0,r,p,v)}(p,h,y,o,l):n(y)?(n(e.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,o)):n(h)?$(0,h,0,h.length-1):n(e.text)&&u.setTextContent(p,""):e.text!==i.text&&u.setTextContent(p,i.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(e,i)}}}function A(e,t,i){if(r(i)&&n(e.parent))e.parent.data.pendingInsert=t;else for(var o=0;o-1,a.selected!==o&&(a.selected=o);else if(N(Ji(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function Ki(e,t){return t.every(function(t){return!N(t,e)})}function Ji(e){return"_value"in e?e._value:e.value}function qi(e){e.target.composing=!0}function Wi(e){e.target.composing&&(e.target.composing=!1,Zi(e.target,"input"))}function Zi(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Gi(e){return!e.componentInstance||e.data&&e.data.transition?e:Gi(e.componentInstance._vnode)}var Xi={model:Ui,show:{bind:function(e,t,n){var r=t.value,i=(n=Gi(n)).data&&n.data.transition,o=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&i?(n.data.show=!0,Di(n,function(){e.style.display=o})):e.style.display=r?o:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Gi(n)).data&&n.data.transition?(n.data.show=!0,r?Di(n,function(){e.style.display=e.__vOriginalDisplay}):Pi(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,i){i||(e.style.display=e.__vOriginalDisplay)}}},Yi={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Qi(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?Qi(Ut(t.children)):e}function eo(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var i=n._parentListeners;for(var o in i)t[b(o)]=i[o];return t}function to(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var no=function(e){return e.tag||Bt(e)},ro=function(e){return"show"===e.name},io={name:"transition",props:Yi,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(no)).length){var r=this.mode,o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var a=Qi(o);if(!a)return o;if(this._leaving)return to(e,o);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:i(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=eo(this),u=this._vnode,l=Qi(u);if(a.data.directives&&a.data.directives.some(ro)&&(a.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(a,l)&&!Bt(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=k({},c);if("out-in"===r)return this._leaving=!0,rt(f,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),to(e,o);if("in-out"===r){if(Bt(a))return u;var p,d=function(){p()};rt(c,"afterEnter",d),rt(c,"enterCancelled",d),rt(f,"delayLeave",function(e){p=e})}}return o}}},oo=k({tag:String,moveClass:String},Yi);function ao(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function so(e){e.data.newPos=e.elm.getBoundingClientRect()}function co(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,i=t.top-n.top;if(r||i){e.data.moved=!0;var o=e.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}delete oo.mode;var uo={Transition:io,TransitionGroup:{props:oo,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var i=Wt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,i(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],a=eo(this),s=0;s-1?Wn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Wn[e]=/HTMLUnknownElement/.test(t.toString())},k(bn.options.directives,Xi),k(bn.options.components,uo),bn.prototype.__patch__=U?Bi:S,bn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=de),Xt(e,"beforeMount"),r=function(){e._update(e._render(),n)},new un(e,r,S,{before:function(){e._isMounted&&!e._isDestroyed&&Xt(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,Xt(e,"mounted")),e}(this,e=e&&U?Gn(e):void 0,t)},U&&setTimeout(function(){P.devtools&&te&&te.emit("init",bn)},0);var lo=/\{\{((?:.|\r?\n)+?)\}\}/g,fo=/[-.*+?^${}()|[\]\/\\]/g,po=g(function(e){var t=e[0].replace(fo,"\\$&"),n=e[1].replace(fo,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")});var vo={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Ir(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Mr(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var ho,mo={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Ir(e,"style");n&&(e.staticStyle=JSON.stringify(ii(n)));var r=Mr(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},yo=function(e){return(ho=ho||document.createElement("div")).innerHTML=e,ho.textContent},go=p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),_o=p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),bo=p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),$o=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,wo=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Co="[a-zA-Z_][\\-\\.0-9_a-zA-Za-zA-Z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*",xo="((?:"+Co+"\\:)?"+Co+")",Ao=new RegExp("^<"+xo),ko=/^\s*(\/?)>/,Oo=new RegExp("^<\\/"+xo+"[^>]*>"),So=/^]+>/i,To=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Mo=/&(?:lt|gt|quot|amp|#39);/g,Io=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Do=p("pre,textarea",!0),Po=function(e,t){return e&&Do(e)&&"\n"===t[0]};function Ro(e,t){var n=t?Io:Mo;return e.replace(n,function(e){return Lo[e]})}var Fo,Ho,Bo,Uo,zo,Vo,Ko,Jo,qo=/^@|^v-on:/,Wo=/^v-|^@|^:/,Zo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Go=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Xo=/^\(|\)$/g,Yo=/^\[.*\]$/,Qo=/:(.*)$/,ea=/^:|^\.|^v-bind:/,ta=/\.[^.]+/g,na=/^v-slot(:|$)|^#/,ra=/[\r\n]/,ia=/\s+/g,oa=g(yo),aa="_empty_";function sa(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:va(t),rawAttrsMap:{},parent:n,children:[]}}function ca(e,t){Fo=t.warn||kr,Vo=t.isPreTag||T,Ko=t.mustUseProp||T,Jo=t.getTagNamespace||T;t.isReservedTag;Bo=Or(t.modules,"transformNode"),Uo=Or(t.modules,"preTransformNode"),zo=Or(t.modules,"postTransformNode"),Ho=t.delimiters;var n,r,i=[],o=!1!==t.preserveWhitespace,a=t.whitespace,s=!1,c=!1;function u(e){if(l(e),s||e.processed||(e=ua(e,t)),i.length||e===n||n.if&&(e.elseif||e.else)&&fa(n,{exp:e.elseif,block:e}),r&&!e.forbidden)if(e.elseif||e.else)a=e,(u=function(e){var t=e.length;for(;t--;){if(1===e[t].type)return e[t];e.pop()}}(r.children))&&u.if&&fa(u,{exp:a.elseif,block:a});else{if(e.slotScope){var o=e.slotTarget||'"default"';(r.scopedSlots||(r.scopedSlots={}))[o]=e}r.children.push(e),e.parent=r}var a,u;e.children=e.children.filter(function(e){return!e.slotScope}),l(e),e.pre&&(s=!1),Vo(e.tag)&&(c=!1);for(var f=0;f]*>)","i")),p=e.replace(f,function(e,n,r){return u=r.length,No(l)||"noscript"===l||(n=n.replace(//g,"$1").replace(//g,"$1")),Po(l,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""});c+=e.length-p.length,e=p,k(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(To.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),C(v+3);continue}}if(Eo.test(e)){var h=e.indexOf("]>");if(h>=0){C(h+2);continue}}var m=e.match(So);if(m){C(m[0].length);continue}var y=e.match(Oo);if(y){var g=c;C(y[0].length),k(y[1],g,c);continue}var _=x();if(_){A(_),Po(_.tagName,e)&&C(1);continue}}var b=void 0,$=void 0,w=void 0;if(d>=0){for($=e.slice(d);!(Oo.test($)||Ao.test($)||To.test($)||Eo.test($)||(w=$.indexOf("<",1))<0);)d+=w,$=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&C(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function C(t){c+=t,e=e.substring(t)}function x(){var t=e.match(Ao);if(t){var n,r,i={tagName:t[1],attrs:[],start:c};for(C(t[0].length);!(n=e.match(ko))&&(r=e.match(wo)||e.match($o));)r.start=c,C(r[0].length),r.end=c,i.attrs.push(r);if(n)return i.unarySlash=n[1],C(n[0].length),i.end=c,i}}function A(e){var n=e.tagName,c=e.unarySlash;o&&("p"===r&&bo(n)&&k(r),s(n)&&r===n&&k(n));for(var u=a(n)||!!c,l=e.attrs.length,f=new Array(l),p=0;p=0&&i[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=i.length-1;u>=a;u--)t.end&&t.end(i[u].tag,n,o);i.length=a,r=a&&i[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,o):"p"===s&&(t.start&&t.start(e,[],!1,n,o),t.end&&t.end(e,n,o))}k()}(e,{warn:Fo,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,l){var f=r&&r.ns||Jo(e);J&&"svg"===f&&(o=function(e){for(var t=[],n=0;nc&&(s.push(o=e.slice(c,i)),a.push(JSON.stringify(o)));var u=xr(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+r[0].length}return c-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),Lr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Fr(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Fr(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Fr(t,"$$c")+"}",null,!0)}(e,r,i);else if("input"===o&&"radio"===a)!function(e,t,n){var r=n&&n.number,i=Mr(e,"value")||"null";Sr(e,"checked","_q("+t+","+(i=r?"_n("+i+")":i)+")"),Lr(e,"change",Fr(t,i),null,!0)}(e,r,i);else if("input"===o||"textarea"===o)!function(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?Jr:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=Fr(t,l);c&&(f="if($event.target.composing)return;"+f),Sr(e,"value","("+t+")"),Lr(e,u,f,null,!0),(s||a)&&Lr(e,"blur","$forceUpdate()")}(e,r,i);else if(!P.isReservedTag(o))return Rr(e,r,i),!1;return!0},text:function(e,t){t.value&&Sr(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Sr(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:go,mustUseProp:En,canBeLeftOpenTag:_o,isReservedTag:Jn,getTagNamespace:qn,staticKeys:function(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}(ga)},wa=g(function(e){return p("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))});function Ca(e,t){e&&(_a=wa(t.staticKeys||""),ba=t.isReservedTag||T,function e(t){t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||d(e.tag)||!ba(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(_a)))}(t);if(1===t.type){if(!ba(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n|^function\s*\(/,Aa=/\([^)]*?\);*$/,ka=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Oa={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Sa={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Ta=function(e){return"if("+e+")return null;"},Ea={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Ta("$event.target !== $event.currentTarget"),ctrl:Ta("!$event.ctrlKey"),shift:Ta("!$event.shiftKey"),alt:Ta("!$event.altKey"),meta:Ta("!$event.metaKey"),left:Ta("'button' in $event && $event.button !== 0"),middle:Ta("'button' in $event && $event.button !== 1"),right:Ta("'button' in $event && $event.button !== 2")};function Na(e,t){var n=t?"nativeOn:":"on:",r="",i="";for(var o in e){var a=ja(e[o]);e[o]&&e[o].dynamic?i+=o+","+a+",":r+='"'+o+'":'+a+","}return r="{"+r.slice(0,-1)+"}",i?n+"_d("+r+",["+i.slice(0,-1)+"])":n+r}function ja(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map(function(e){return ja(e)}).join(",")+"]";var t=ka.test(e.value),n=xa.test(e.value),r=ka.test(e.value.replace(Aa,""));if(e.modifiers){var i="",o="",a=[];for(var s in e.modifiers)if(Ea[s])o+=Ea[s],Oa[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;o+=Ta(["ctrl","shift","alt","meta"].filter(function(e){return!c[e]}).map(function(e){return"$event."+e+"Key"}).join("||"))}else a.push(s);return a.length&&(i+=function(e){return"if(('keyCode' in $event)&&"+e.map(La).join("&&")+")return null;"}(a)),o&&(i+=o),"function($event){"+i+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function La(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Oa[e],r=Sa[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Ma={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:S},Ia=function(e){this.options=e,this.warn=e.warn||kr,this.transforms=Or(e.modules,"transformCode"),this.dataGenFns=Or(e.modules,"genData"),this.directives=k(k({},Ma),e.directives);var t=e.isReservedTag||T;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Da(e,t){var n=new Ia(t);return{render:"with(this){return "+(e?Pa(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Pa(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Ra(e,t);if(e.once&&!e.onceProcessed)return Fa(e,t);if(e.for&&!e.forProcessed)return Ba(e,t);if(e.if&&!e.ifProcessed)return Ha(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=Va(e,t),i="_t("+n+(r?","+r:""),o=e.attrs||e.dynamicAttrs?qa((e.attrs||[]).concat(e.dynamicAttrs||[]).map(function(e){return{name:b(e.name),value:e.value,dynamic:e.dynamic}})):null,a=e.attrsMap["v-bind"];!o&&!a||r||(i+=",null");o&&(i+=","+o);a&&(i+=(o?"":",null")+","+a);return i+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:Va(t,n,!0);return"_c("+e+","+Ua(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Ua(e,t));var i=e.inlineTemplate?null:Va(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(i?","+i:"")+")"}for(var o=0;o':'
',Ya.innerHTML.indexOf(" ")>0}var ns=!!U&&ts(!1),rs=!!U&&ts(!0),is=g(function(e){var t=Gn(e);return t&&t.innerHTML}),os=bn.prototype.$mount;bn.prototype.$mount=function(e,t){if((e=e&&Gn(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=is(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){var i=es(r,{outputSourceRange:!1,shouldDecodeNewlines:ns,shouldDecodeNewlinesForHref:rs,delimiters:n.delimiters,comments:n.comments},this),o=i.render,a=i.staticRenderFns;n.render=o,n.staticRenderFns=a}}return os.call(this,e,t)},bn.compile=es,module.exports=bn; \ No newline at end of file diff --git a/dist/vue.esm.browser.js b/dist/vue.esm.browser.js index 83e124d4722..57fbf89cc63 100644 --- a/dist/vue.esm.browser.js +++ b/dist/vue.esm.browser.js @@ -1,5 +1,5 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ @@ -532,6 +532,7 @@ const isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'androi const isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; const isPhantomJS = UA && /phantomjs/.test(UA); +const isFF = UA && UA.match(/firefox\/(\d+)/); // Firefox has a "watch" function on Object.prototype... const nativeWatch = ({}).watch; @@ -2432,2448 +2433,2452 @@ function normalizeArrayChildren (children, nestedIndex) { /* */ -function ensureCtor (comp, base) { - if ( - comp.__esModule || - (hasSymbol && comp[Symbol.toStringTag] === 'Module') - ) { - comp = comp.default; +function initProvide (vm) { + const provide = vm.$options.provide; + if (provide) { + vm._provided = typeof provide === 'function' + ? provide.call(vm) + : provide; } - return isObject(comp) - ? base.extend(comp) - : comp -} - -function createAsyncPlaceholder ( - factory, - data, - context, - children, - tag -) { - const node = createEmptyVNode(); - node.asyncFactory = factory; - node.asyncMeta = { data, context, children, tag }; - return node } -function resolveAsyncComponent ( - factory, - baseCtor, - context -) { - if (isTrue(factory.error) && isDef(factory.errorComp)) { - return factory.errorComp - } - - if (isDef(factory.resolved)) { - return factory.resolved - } - - if (isTrue(factory.loading) && isDef(factory.loadingComp)) { - return factory.loadingComp - } - - if (isDef(factory.contexts)) { - // already pending - factory.contexts.push(context); - } else { - const contexts = factory.contexts = [context]; - let sync = true; - - const forceRender = (renderCompleted) => { - for (let i = 0, l = contexts.length; i < l; i++) { - contexts[i].$forceUpdate(); - } - - if (renderCompleted) { - contexts.length = 0; - } - }; - - const resolve = once((res) => { - // cache resolved - factory.resolved = ensureCtor(res, baseCtor); - // invoke callbacks only if this is not a synchronous resolve - // (async resolves are shimmed as synchronous during SSR) - if (!sync) { - forceRender(true); - } else { - contexts.length = 0; - } - }); - - const reject = once(reason => { - warn( - `Failed to resolve async component: ${String(factory)}` + - (reason ? `\nReason: ${reason}` : '') - ); - if (isDef(factory.errorComp)) { - factory.error = true; - forceRender(true); +function initInjections (vm) { + const result = resolveInject(vm.$options.inject, vm); + if (result) { + toggleObserving(false); + Object.keys(result).forEach(key => { + /* istanbul ignore else */ + { + defineReactive$$1(vm, key, result[key], () => { + warn( + `Avoid mutating an injected value directly since the changes will be ` + + `overwritten whenever the provided component re-renders. ` + + `injection being mutated: "${key}"`, + vm + ); + }); } }); + toggleObserving(true); + } +} - const res = factory(resolve, reject); - - if (isObject(res)) { - if (isPromise(res)) { - // () => Promise - if (isUndef(factory.resolved)) { - res.then(resolve, reject); - } - } else if (isPromise(res.component)) { - res.component.then(resolve, reject); - - if (isDef(res.error)) { - factory.errorComp = ensureCtor(res.error, baseCtor); - } +function resolveInject (inject, vm) { + if (inject) { + // inject is :any because flow is not smart enough to figure out cached + const result = Object.create(null); + const keys = hasSymbol + ? Reflect.ownKeys(inject) + : Object.keys(inject); - if (isDef(res.loading)) { - factory.loadingComp = ensureCtor(res.loading, baseCtor); - if (res.delay === 0) { - factory.loading = true; - } else { - setTimeout(() => { - if (isUndef(factory.resolved) && isUndef(factory.error)) { - factory.loading = true; - forceRender(false); - } - }, res.delay || 200); - } + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + // #6574 in case the inject object is observed... + if (key === '__ob__') continue + const provideKey = inject[key].from; + let source = vm; + while (source) { + if (source._provided && hasOwn(source._provided, provideKey)) { + result[key] = source._provided[provideKey]; + break } - - if (isDef(res.timeout)) { - setTimeout(() => { - if (isUndef(factory.resolved)) { - reject( - `timeout (${res.timeout}ms)` - ); - } - }, res.timeout); + source = source.$parent; + } + if (!source) { + if ('default' in inject[key]) { + const provideDefault = inject[key].default; + result[key] = typeof provideDefault === 'function' + ? provideDefault.call(vm) + : provideDefault; + } else { + warn(`Injection "${key}" not found`, vm); } } } - - sync = false; - // return in case resolved synchronously - return factory.loading - ? factory.loadingComp - : factory.resolved + return result } } /* */ -function isAsyncPlaceholder (node) { - return node.isComment && node.asyncFactory -} -/* */ -function getFirstComponentChild (children) { - if (Array.isArray(children)) { - for (let i = 0; i < children.length; i++) { - const c = children[i]; - if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { - return c +/** + * Runtime helper for resolving raw children VNodes into a slot object. + */ +function resolveSlots ( + children, + context +) { + if (!children || !children.length) { + return {} + } + const slots = {}; + for (let i = 0, l = children.length; i < l; i++) { + const child = children[i]; + const data = child.data; + // remove slot attribute if the node is resolved as a Vue slot node + if (data && data.attrs && data.attrs.slot) { + delete data.attrs.slot; + } + // named slots should only be respected if the vnode was rendered in the + // same context. + if ((child.context === context || child.fnContext === context) && + data && data.slot != null + ) { + const name = data.slot; + const slot = (slots[name] || (slots[name] = [])); + if (child.tag === 'template') { + slot.push.apply(slot, child.children || []); + } else { + slot.push(child); } + } else { + (slots.default || (slots.default = [])).push(child); + } + } + // ignore slots that contains only whitespace + for (const name in slots) { + if (slots[name].every(isWhitespace)) { + delete slots[name]; } } + return slots } -/* */ +function isWhitespace (node) { + return (node.isComment && !node.asyncFactory) || node.text === ' ' +} /* */ -function initEvents (vm) { - vm._events = Object.create(null); - vm._hasHookEvent = false; - // init parent attached events - const listeners = vm.$options._parentListeners; - if (listeners) { - updateComponentListeners(vm, listeners); +function normalizeScopedSlots ( + slots, + normalSlots +) { + let res; + if (!slots) { + res = {}; + } else if (slots._normalized) { + return slots + } else { + res = {}; + for (const key in slots) { + if (slots[key] && key[0] !== '$') { + res[key] = normalizeScopedSlot(slots[key]); + } + } + } + // expose normal slots on scopedSlots + for (const key in normalSlots) { + if (!(key in res)) { + res[key] = proxyNormalSlot(normalSlots, key); + } } + def(res, '_normalized', true); + def(res, '$stable', slots ? !!slots.$stable : true); + return res } -let target; - -function add (event, fn) { - target.$on(event, fn); +function normalizeScopedSlot(fn) { + return scope => { + const res = fn(scope); + return res && typeof res === 'object' && !Array.isArray(res) + ? [res] // single vnode + : normalizeChildren(res) + } } -function remove$1 (event, fn) { - target.$off(event, fn); +function proxyNormalSlot(slots, key) { + return () => slots[key] } -function createOnceHandler (event, fn) { - const _target = target; - return function onceHandler () { - const res = fn.apply(null, arguments); - if (res !== null) { - _target.$off(event, onceHandler); - } - } -} +/* */ -function updateComponentListeners ( - vm, - listeners, - oldListeners +/** + * Runtime helper for rendering v-for lists. + */ +function renderList ( + val, + render ) { - target = vm; - updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); - target = undefined; -} - -function eventsMixin (Vue) { - const hookRE = /^hook:/; - Vue.prototype.$on = function (event, fn) { - const vm = this; - if (Array.isArray(event)) { - for (let i = 0, l = event.length; i < l; i++) { - vm.$on(event[i], fn); - } - } else { - (vm._events[event] || (vm._events[event] = [])).push(fn); - // optimize hook:event cost by using a boolean flag marked at registration - // instead of a hash lookup - if (hookRE.test(event)) { - vm._hasHookEvent = true; - } - } - return vm - }; - - Vue.prototype.$once = function (event, fn) { - const vm = this; - function on () { - vm.$off(event, on); - fn.apply(vm, arguments); - } - on.fn = fn; - vm.$on(event, on); - return vm - }; - - Vue.prototype.$off = function (event, fn) { - const vm = this; - // all - if (!arguments.length) { - vm._events = Object.create(null); - return vm - } - // array of events - if (Array.isArray(event)) { - for (let i = 0, l = event.length; i < l; i++) { - vm.$off(event[i], fn); - } - return vm - } - // specific event - const cbs = vm._events[event]; - if (!cbs) { - return vm - } - if (!fn) { - vm._events[event] = null; - return vm + let ret, i, l, keys, key; + if (Array.isArray(val) || typeof val === 'string') { + ret = new Array(val.length); + for (i = 0, l = val.length; i < l; i++) { + ret[i] = render(val[i], i); } - // specific handler - let cb; - let i = cbs.length; - while (i--) { - cb = cbs[i]; - if (cb === fn || cb.fn === fn) { - cbs.splice(i, 1); - break - } + } else if (typeof val === 'number') { + ret = new Array(val); + for (i = 0; i < val; i++) { + ret[i] = render(i + 1, i); } - return vm - }; - - Vue.prototype.$emit = function (event) { - const vm = this; - { - const lowerCaseEvent = event.toLowerCase(); - if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { - tip( - `Event "${lowerCaseEvent}" is emitted in component ` + - `${formatComponentName(vm)} but the handler is registered for "${event}". ` + - `Note that HTML attributes are case-insensitive and you cannot use ` + - `v-on to listen to camelCase events when using in-DOM templates. ` + - `You should probably use "${hyphenate(event)}" instead of "${event}".` - ); + } else if (isObject(val)) { + if (hasSymbol && val[Symbol.iterator]) { + ret = []; + const iterator = val[Symbol.iterator](); + let result = iterator.next(); + while (!result.done) { + ret.push(render(result.value, ret.length)); + result = iterator.next(); } - } - let cbs = vm._events[event]; - if (cbs) { - cbs = cbs.length > 1 ? toArray(cbs) : cbs; - const args = toArray(arguments, 1); - const info = `event handler for "${event}"`; - for (let i = 0, l = cbs.length; i < l; i++) { - invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } else { + keys = Object.keys(val); + ret = new Array(keys.length); + for (i = 0, l = keys.length; i < l; i++) { + key = keys[i]; + ret[i] = render(val[key], key, i); } } - return vm - }; + } + if (!isDef(ret)) { + ret = []; + } + (ret)._isVList = true; + return ret } /* */ - - /** - * Runtime helper for resolving raw children VNodes into a slot object. + * Runtime helper for rendering */ -function resolveSlots ( - children, - context +function renderSlot ( + name, + fallback, + props, + bindObject ) { - if (!children || !children.length) { - return {} - } - const slots = {}; - for (let i = 0, l = children.length; i < l; i++) { - const child = children[i]; - const data = child.data; - // remove slot attribute if the node is resolved as a Vue slot node - if (data && data.attrs && data.attrs.slot) { - delete data.attrs.slot; - } - // named slots should only be respected if the vnode was rendered in the - // same context. - if ((child.context === context || child.fnContext === context) && - data && data.slot != null - ) { - const name = data.slot; - const slot = (slots[name] || (slots[name] = [])); - if (child.tag === 'template') { - slot.push.apply(slot, child.children || []); - } else { - slot.push(child); + const scopedSlotFn = this.$scopedSlots[name]; + let nodes; + if (scopedSlotFn) { // scoped slot + props = props || {}; + if (bindObject) { + if (!isObject(bindObject)) { + warn( + 'slot v-bind without argument expects an Object', + this + ); } - } else { - (slots.default || (slots.default = [])).push(child); - } - } - // ignore slots that contains only whitespace - for (const name in slots) { - if (slots[name].every(isWhitespace)) { - delete slots[name]; + props = extend(extend({}, bindObject), props); } + nodes = scopedSlotFn(props) || fallback; + } else { + nodes = this.$slots[name] || fallback; } - return slots -} - -function isWhitespace (node) { - return (node.isComment && !node.asyncFactory) || node.text === ' ' -} -function resolveScopedSlots ( - fns, // see flow/vnode - hasDynamicKeys, - res -) { - res = res || { $stable: !hasDynamicKeys }; - for (let i = 0; i < fns.length; i++) { - const slot = fns[i]; - if (Array.isArray(slot)) { - resolveScopedSlots(slot, hasDynamicKeys, res); - } else if (slot) { - res[slot.key] = slot.fn; - } + const target = props && props.slot; + if (target) { + return this.$createElement('template', { slot: target }, nodes) + } else { + return nodes } - return res } /* */ -let activeInstance = null; -let isUpdatingChildComponent = false; - -function setActiveInstance(vm) { - const prevActiveInstance = activeInstance; - activeInstance = vm; - return () => { - activeInstance = prevActiveInstance; - } +/** + * Runtime helper for resolving filters + */ +function resolveFilter (id) { + return resolveAsset(this.$options, 'filters', id, true) || identity } -function initLifecycle (vm) { - const options = vm.$options; +/* */ - // locate first non-abstract parent - let parent = options.parent; - if (parent && !options.abstract) { - while (parent.$options.abstract && parent.$parent) { - parent = parent.$parent; - } - parent.$children.push(vm); +function isKeyNotMatch (expect, actual) { + if (Array.isArray(expect)) { + return expect.indexOf(actual) === -1 + } else { + return expect !== actual } +} - vm.$parent = parent; - vm.$root = parent ? parent.$root : vm; - - vm.$children = []; - vm.$refs = {}; - - vm._watcher = null; - vm._inactive = null; - vm._directInactive = false; - vm._isMounted = false; - vm._isDestroyed = false; - vm._isBeingDestroyed = false; +/** + * Runtime helper for checking keyCodes from config. + * exposed as Vue.prototype._k + * passing in eventKeyName as last argument separately for backwards compat + */ +function checkKeyCodes ( + eventKeyCode, + key, + builtInKeyCode, + eventKeyName, + builtInKeyName +) { + const mappedKeyCode = config.keyCodes[key] || builtInKeyCode; + if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { + return isKeyNotMatch(builtInKeyName, eventKeyName) + } else if (mappedKeyCode) { + return isKeyNotMatch(mappedKeyCode, eventKeyCode) + } else if (eventKeyName) { + return hyphenate(eventKeyName) !== key + } } -function lifecycleMixin (Vue) { - Vue.prototype._update = function (vnode, hydrating) { - const vm = this; - const prevEl = vm.$el; - const prevVnode = vm._vnode; - const restoreActiveInstance = setActiveInstance(vm); - vm._vnode = vnode; - // Vue.prototype.__patch__ is injected in entry points - // based on the rendering backend used. - if (!prevVnode) { - // initial render - vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); +/* */ + +/** + * Runtime helper for merging v-bind="object" into a VNode's data. + */ +function bindObjectProps ( + data, + tag, + value, + asProp, + isSync +) { + if (value) { + if (!isObject(value)) { + warn( + 'v-bind without argument expects an Object or Array value', + this + ); } else { - // updates - vm.$el = vm.__patch__(prevVnode, vnode); - } - restoreActiveInstance(); - // update __vue__ reference - if (prevEl) { - prevEl.__vue__ = null; - } - if (vm.$el) { - vm.$el.__vue__ = vm; - } - // if parent is an HOC, update its $el as well - if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { - vm.$parent.$el = vm.$el; - } - // updated hook is called by the scheduler to ensure that children are - // updated in a parent's updated hook. - }; + if (Array.isArray(value)) { + value = toObject(value); + } + let hash; + for (const key in value) { + if ( + key === 'class' || + key === 'style' || + isReservedAttribute(key) + ) { + hash = data; + } else { + const type = data.attrs && data.attrs.type; + hash = asProp || config.mustUseProp(tag, type, key) + ? data.domProps || (data.domProps = {}) + : data.attrs || (data.attrs = {}); + } + const camelizedKey = camelize(key); + if (!(key in hash) && !(camelizedKey in hash)) { + hash[key] = value[key]; - Vue.prototype.$forceUpdate = function () { - const vm = this; - if (vm._watcher) { - vm._watcher.update(); + if (isSync) { + const on = data.on || (data.on = {}); + on[`update:${camelizedKey}`] = function ($event) { + value[key] = $event; + }; + } + } + } } - }; + } + return data +} - Vue.prototype.$destroy = function () { - const vm = this; - if (vm._isBeingDestroyed) { - return - } - callHook(vm, 'beforeDestroy'); - vm._isBeingDestroyed = true; - // remove self from parent - const parent = vm.$parent; - if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { - remove(parent.$children, vm); - } - // teardown watchers - if (vm._watcher) { - vm._watcher.teardown(); - } - let i = vm._watchers.length; - while (i--) { - vm._watchers[i].teardown(); - } - // remove reference from data ob - // frozen object may not have observer. - if (vm._data.__ob__) { - vm._data.__ob__.vmCount--; - } - // call the last hook... - vm._isDestroyed = true; - // invoke destroy hooks on current rendered tree - vm.__patch__(vm._vnode, null); - // fire destroyed hook - callHook(vm, 'destroyed'); - // turn off all instance listeners. - vm.$off(); - // remove __vue__ reference - if (vm.$el) { - vm.$el.__vue__ = null; - } - // release circular reference (#6759) - if (vm.$vnode) { - vm.$vnode.parent = null; - } - }; +/* */ + +/** + * Runtime helper for rendering static trees. + */ +function renderStatic ( + index, + isInFor +) { + const cached = this._staticTrees || (this._staticTrees = []); + let tree = cached[index]; + // if has already-rendered static tree and not inside v-for, + // we can reuse the same tree. + if (tree && !isInFor) { + return tree + } + // otherwise, render a fresh tree. + tree = cached[index] = this.$options.staticRenderFns[index].call( + this._renderProxy, + null, + this // for render fns generated for functional component templates + ); + markStatic(tree, `__static__${index}`, false); + return tree } -function mountComponent ( - vm, - el, - hydrating +/** + * Runtime helper for v-once. + * Effectively it means marking the node as static with a unique key. + */ +function markOnce ( + tree, + index, + key ) { - vm.$el = el; - if (!vm.$options.render) { - vm.$options.render = createEmptyVNode; - { - /* istanbul ignore if */ - if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || - vm.$options.el || el) { - warn( - 'You are using the runtime-only build of Vue where the template ' + - 'compiler is not available. Either pre-compile the templates into ' + - 'render functions, or use the compiler-included build.', - vm - ); - } else { - warn( - 'Failed to mount component: template or render function not defined.', - vm - ); + markStatic(tree, `__once__${index}${key ? `_${key}` : ``}`, true); + return tree +} + +function markStatic ( + tree, + key, + isOnce +) { + if (Array.isArray(tree)) { + for (let i = 0; i < tree.length; i++) { + if (tree[i] && typeof tree[i] !== 'string') { + markStaticNode(tree[i], `${key}_${i}`, isOnce); } } + } else { + markStaticNode(tree, key, isOnce); } - callHook(vm, 'beforeMount'); +} - let updateComponent; - /* istanbul ignore if */ - if (config.performance && mark) { - updateComponent = () => { - const name = vm._name; - const id = vm._uid; - const startTag = `vue-perf-start:${id}`; - const endTag = `vue-perf-end:${id}`; +function markStaticNode (node, key, isOnce) { + node.isStatic = true; + node.key = key; + node.isOnce = isOnce; +} - mark(startTag); - const vnode = vm._render(); - mark(endTag); - measure(`vue ${name} render`, startTag, endTag); +/* */ - mark(startTag); - vm._update(vnode, hydrating); - mark(endTag); - measure(`vue ${name} patch`, startTag, endTag); - }; - } else { - updateComponent = () => { - vm._update(vm._render(), hydrating); - }; +function bindObjectListeners (data, value) { + if (value) { + if (!isPlainObject(value)) { + warn( + 'v-on without argument expects an Object value', + this + ); + } else { + const on = data.on = data.on ? extend({}, data.on) : {}; + for (const key in value) { + const existing = on[key]; + const ours = value[key]; + on[key] = existing ? [].concat(existing, ours) : ours; + } + } } + return data +} - // we set this to vm._watcher inside the watcher's constructor - // since the watcher's initial patch may call $forceUpdate (e.g. inside child - // component's mounted hook), which relies on vm._watcher being already defined - new Watcher(vm, updateComponent, noop, { - before () { - if (vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'beforeUpdate'); - } +/* */ + +function resolveScopedSlots ( + fns, // see flow/vnode + hasDynamicKeys, + res +) { + res = res || { $stable: !hasDynamicKeys }; + for (let i = 0; i < fns.length; i++) { + const slot = fns[i]; + if (Array.isArray(slot)) { + resolveScopedSlots(slot, hasDynamicKeys, res); + } else if (slot) { + res[slot.key] = slot.fn; } - }, true /* isRenderWatcher */); - hydrating = false; + } + return res +} - // manually mounted instance, call mounted on self - // mounted is called for render-created child components in its inserted hook - if (vm.$vnode == null) { - vm._isMounted = true; - callHook(vm, 'mounted'); +/* */ + +function bindDynamicKeys (baseObj, values) { + for (let i = 0; i < values.length; i += 2) { + const key = values[i]; + if (typeof key === 'string' && key) { + baseObj[values[i]] = values[i + 1]; + } else if (key !== '' && key !== null) { + // null is a speical value for explicitly removing a binding + warn( + `Invalid value for dynamic directive argument (expected string or null): ${key}`, + this + ); + } } - return vm + return baseObj } -function updateChildComponent ( - vm, - propsData, - listeners, - parentVnode, - renderChildren +// helper to dynamically append modifier runtime markers to event names. +// ensure only append when value is already string, otherwise it will be cast +// to string and cause the type check to miss. +function prependModifier (value, symbol) { + return typeof value === 'string' ? symbol + value : value +} + +/* */ + +function installRenderHelpers (target) { + target._o = markOnce; + target._n = toNumber; + target._s = toString; + target._l = renderList; + target._t = renderSlot; + target._q = looseEqual; + target._i = looseIndexOf; + target._m = renderStatic; + target._f = resolveFilter; + target._k = checkKeyCodes; + target._b = bindObjectProps; + target._v = createTextVNode; + target._e = createEmptyVNode; + target._u = resolveScopedSlots; + target._g = bindObjectListeners; + target._d = bindDynamicKeys; + target._p = prependModifier; +} + +/* */ + +function FunctionalRenderContext ( + data, + props, + children, + parent, + Ctor ) { - { - isUpdatingChildComponent = true; + const options = Ctor.options; + // ensure the createElement function in functional components + // gets a unique context - this is necessary for correct named slot check + let contextVm; + if (hasOwn(parent, '_uid')) { + contextVm = Object.create(parent); + // $flow-disable-line + contextVm._original = parent; + } else { + // the context vm passed in is a functional context as well. + // in this case we want to make sure we are able to get a hold to the + // real context instance. + contextVm = parent; + // $flow-disable-line + parent = parent._original; } + const isCompiled = isTrue(options._compiled); + const needNormalization = !isCompiled; - // determine whether component has slot children - // we need to do this before overwriting $options._renderChildren. + this.data = data; + this.props = props; + this.children = children; + this.parent = parent; + this.listeners = data.on || emptyObject; + this.injections = resolveInject(options.inject, parent); + this.slots = () => resolveSlots(children, parent); - // check if there are dynamic scopedSlots (hand-written or compiled but with - // dynamic slot names). Static scoped slots compiled from template has the - // "$stable" marker. - const hasDynamicScopedSlot = !!( - (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || - (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) - ); - // Any static slot children from the parent may have changed during parent's - // update. Dynamic scoped slots may also have changed. In such cases, a forced - // update is necessary to ensure correctness. - const needsForceUpdate = !!( - renderChildren || // has new static slots - vm.$options._renderChildren || // has old static slots - hasDynamicScopedSlot - ); + Object.defineProperty(this, 'scopedSlots', ({ + enumerable: true, + get () { + return normalizeScopedSlots(data.scopedSlots, this.slots()) + } + })); - vm.$options._parentVnode = parentVnode; - vm.$vnode = parentVnode; // update vm's placeholder node without re-render + // support for compiled functional template + if (isCompiled) { + // exposing $options for renderStatic() + this.$options = options; + // pre-resolve slots for renderSlot() + this.$slots = this.slots(); + this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); + } - if (vm._vnode) { // update child tree's parent - vm._vnode.parent = parentVnode; + if (options._scopeId) { + this._c = (a, b, c, d) => { + const vnode = createElement(contextVm, a, b, c, d, needNormalization); + if (vnode && !Array.isArray(vnode)) { + vnode.fnScopeId = options._scopeId; + vnode.fnContext = parent; + } + return vnode + }; + } else { + this._c = (a, b, c, d) => createElement(contextVm, a, b, c, d, needNormalization); } - vm.$options._renderChildren = renderChildren; +} - // update $attrs and $listeners hash - // these are also reactive so they may trigger child update if the child - // used them during render - vm.$attrs = parentVnode.data.attrs || emptyObject; - vm.$listeners = listeners || emptyObject; +installRenderHelpers(FunctionalRenderContext.prototype); - // update props - if (propsData && vm.$options.props) { - toggleObserving(false); - const props = vm._props; - const propKeys = vm.$options._propKeys || []; - for (let i = 0; i < propKeys.length; i++) { - const key = propKeys[i]; - const propOptions = vm.$options.props; // wtf flow? - props[key] = validateProp(key, propOptions, propsData, vm); +function createFunctionalComponent ( + Ctor, + propsData, + data, + contextVm, + children +) { + const options = Ctor.options; + const props = {}; + const propOptions = options.props; + if (isDef(propOptions)) { + for (const key in propOptions) { + props[key] = validateProp(key, propOptions, propsData || emptyObject); } - toggleObserving(true); - // keep a copy of raw propsData - vm.$options.propsData = propsData; + } else { + if (isDef(data.attrs)) mergeProps(props, data.attrs); + if (isDef(data.props)) mergeProps(props, data.props); } - // update listeners - listeners = listeners || emptyObject; - const oldListeners = vm.$options._parentListeners; - vm.$options._parentListeners = listeners; - updateComponentListeners(vm, listeners, oldListeners); + const renderContext = new FunctionalRenderContext( + data, + props, + children, + contextVm, + Ctor + ); - // resolve slots + force update if has children - if (needsForceUpdate) { - vm.$slots = resolveSlots(renderChildren, parentVnode.context); - vm.$forceUpdate(); + const vnode = options.render.call(null, renderContext._c, renderContext); + + if (vnode instanceof VNode) { + return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) + } else if (Array.isArray(vnode)) { + const vnodes = normalizeChildren(vnode) || []; + const res = new Array(vnodes.length); + for (let i = 0; i < vnodes.length; i++) { + res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); + } + return res } +} +function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { + // #7817 clone node before setting fnContext, otherwise if the node is reused + // (e.g. it was from a cached normal slot) the fnContext causes named slots + // that should not be matched to match. + const clone = cloneVNode(vnode); + clone.fnContext = contextVm; + clone.fnOptions = options; { - isUpdatingChildComponent = false; + (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; } + if (data.slot) { + (clone.data || (clone.data = {})).slot = data.slot; + } + return clone } -function isInInactiveTree (vm) { - while (vm && (vm = vm.$parent)) { - if (vm._inactive) return true +function mergeProps (to, from) { + for (const key in from) { + to[camelize(key)] = from[key]; } - return false } -function activateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = false; - if (isInInactiveTree(vm)) { - return - } - } else if (vm._directInactive) { - return - } - if (vm._inactive || vm._inactive === null) { - vm._inactive = false; - for (let i = 0; i < vm.$children.length; i++) { - activateChildComponent(vm.$children[i]); +/* */ + +/* */ + +/* */ + +/* */ + +// inline hooks to be invoked on component VNodes during patch +const componentVNodeHooks = { + init (vnode, hydrating) { + if ( + vnode.componentInstance && + !vnode.componentInstance._isDestroyed && + vnode.data.keepAlive + ) { + // kept-alive components, treat as a patch + const mountedNode = vnode; // work around flow + componentVNodeHooks.prepatch(mountedNode, mountedNode); + } else { + const child = vnode.componentInstance = createComponentInstanceForVnode( + vnode, + activeInstance + ); + child.$mount(hydrating ? vnode.elm : undefined, hydrating); } - callHook(vm, 'activated'); - } -} + }, -function deactivateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = true; - if (isInInactiveTree(vm)) { - return + prepatch (oldVnode, vnode) { + const options = vnode.componentOptions; + const child = vnode.componentInstance = oldVnode.componentInstance; + updateChildComponent( + child, + options.propsData, // updated props + options.listeners, // updated listeners + vnode, // new parent vnode + options.children // new children + ); + }, + + insert (vnode) { + const { context, componentInstance } = vnode; + if (!componentInstance._isMounted) { + componentInstance._isMounted = true; + callHook(componentInstance, 'mounted'); } - } - if (!vm._inactive) { - vm._inactive = true; - for (let i = 0; i < vm.$children.length; i++) { - deactivateChildComponent(vm.$children[i]); + if (vnode.data.keepAlive) { + if (context._isMounted) { + // vue-router#1212 + // During updates, a kept-alive component's child components may + // change, so directly walking the tree here may call activated hooks + // on incorrect children. Instead we push them into a queue which will + // be processed after the whole patch process ended. + queueActivatedComponent(componentInstance); + } else { + activateChildComponent(componentInstance, true /* direct */); + } } - callHook(vm, 'deactivated'); - } -} + }, -function callHook (vm, hook) { - // #7573 disable dep collection when invoking lifecycle hooks - pushTarget(); - const handlers = vm.$options[hook]; - const info = `${hook} hook`; - if (handlers) { - for (let i = 0, j = handlers.length; i < j; i++) { - invokeWithErrorHandling(handlers[i], vm, null, vm, info); + destroy (vnode) { + const { componentInstance } = vnode; + if (!componentInstance._isDestroyed) { + if (!vnode.data.keepAlive) { + componentInstance.$destroy(); + } else { + deactivateChildComponent(componentInstance, true /* direct */); + } } } - if (vm._hasHookEvent) { - vm.$emit('hook:' + hook); +}; + +const hooksToMerge = Object.keys(componentVNodeHooks); + +function createComponent ( + Ctor, + data, + context, + children, + tag +) { + if (isUndef(Ctor)) { + return } - popTarget(); -} -/* */ + const baseCtor = context.$options._base; -const MAX_UPDATE_COUNT = 100; + // plain options object: turn it into a constructor + if (isObject(Ctor)) { + Ctor = baseCtor.extend(Ctor); + } -const queue = []; -const activatedChildren = []; -let has = {}; -let circular = {}; -let waiting = false; -let flushing = false; -let index = 0; + // if at this stage it's not a constructor or an async component factory, + // reject. + if (typeof Ctor !== 'function') { + { + warn(`Invalid Component definition: ${String(Ctor)}`, context); + } + return + } -/** - * Reset the scheduler's state. - */ -function resetSchedulerState () { - index = queue.length = activatedChildren.length = 0; - has = {}; - { - circular = {}; + // async component + let asyncFactory; + if (isUndef(Ctor.cid)) { + asyncFactory = Ctor; + Ctor = resolveAsyncComponent(asyncFactory, baseCtor); + if (Ctor === undefined) { + // return a placeholder node for async component, which is rendered + // as a comment node but preserves all the raw information for the node. + // the information will be used for async server-rendering and hydration. + return createAsyncPlaceholder( + asyncFactory, + data, + context, + children, + tag + ) + } } - waiting = flushing = false; -} -// Async edge case #6566 requires saving the timestamp when event listeners are -// attached. However, calling performance.now() has a perf overhead especially -// if the page has thousands of event listeners. Instead, we take a timestamp -// every time the scheduler flushes and use that for all event listeners -// attached during that flush. -let currentFlushTimestamp = 0; + data = data || {}; -// Async edge case fix requires storing an event listener's attach timestamp. -let getNow = Date.now; + // resolve constructor options in case global mixins are applied after + // component constructor creation + resolveConstructorOptions(Ctor); -// Determine what event timestamp the browser is using. Annoyingly, the -// timestamp can either be hi-res ( relative to poge load) or low-res -// (relative to UNIX epoch), so in order to compare time we have to use the -// same timestamp type when saving the flush timestamp. -if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { - // if the low-res timestamp which is bigger than the event timestamp - // (which is evaluated AFTER) it means the event is using a hi-res timestamp, - // and we need to use the hi-res version for event listeners as well. - getNow = () => performance.now(); -} + // transform component v-model data into props & events + if (isDef(data.model)) { + transformModel(Ctor.options, data); + } -/** - * Flush both queues and run the watchers. - */ -function flushSchedulerQueue () { - currentFlushTimestamp = getNow(); - flushing = true; - let watcher, id; + // extract props + const propsData = extractPropsFromVNodeData(data, Ctor, tag); - // Sort queue before flush. - // This ensures that: - // 1. Components are updated from parent to child. (because parent is always - // created before the child) - // 2. A component's user watchers are run before its render watcher (because - // user watchers are created before the render watcher) - // 3. If a component is destroyed during a parent component's watcher run, - // its watchers can be skipped. - queue.sort((a, b) => a.id - b.id); + // functional component + if (isTrue(Ctor.options.functional)) { + return createFunctionalComponent(Ctor, propsData, data, context, children) + } - // do not cache length because more watchers might be pushed - // as we run existing watchers - for (index = 0; index < queue.length; index++) { - watcher = queue[index]; - if (watcher.before) { - watcher.before(); - } - id = watcher.id; - has[id] = null; - watcher.run(); - // in dev build, check and stop circular updates. - if (has[id] != null) { - circular[id] = (circular[id] || 0) + 1; - if (circular[id] > MAX_UPDATE_COUNT) { - warn( - 'You may have an infinite update loop ' + ( - watcher.user - ? `in watcher with expression "${watcher.expression}"` - : `in a component render function.` - ), - watcher.vm - ); - break - } + // extract listeners, since these needs to be treated as + // child component listeners instead of DOM listeners + const listeners = data.on; + // replace with listeners with .native modifier + // so it gets processed during parent component patch. + data.on = data.nativeOn; + + if (isTrue(Ctor.options.abstract)) { + // abstract components do not keep anything + // other than props & listeners & slot + + // work around flow + const slot = data.slot; + data = {}; + if (slot) { + data.slot = slot; } } - // keep copies of post queues before resetting state - const activatedQueue = activatedChildren.slice(); - const updatedQueue = queue.slice(); + // install component management hooks onto the placeholder node + installComponentHooks(data); - resetSchedulerState(); + // return a placeholder vnode + const name = Ctor.options.name || tag; + const vnode = new VNode( + `vue-component-${Ctor.cid}${name ? `-${name}` : ''}`, + data, undefined, undefined, undefined, context, + { Ctor, propsData, listeners, tag, children }, + asyncFactory + ); - // call component updated and activated hooks - callActivatedHooks(activatedQueue); - callUpdatedHooks(updatedQueue); + return vnode +} - // devtool hook - /* istanbul ignore if */ - if (devtools && config.devtools) { - devtools.emit('flush'); +function createComponentInstanceForVnode ( + vnode, // we know it's MountedComponentVNode but flow doesn't + parent, // activeInstance in lifecycle state +) { + const options = { + _isComponent: true, + _parentVnode: vnode, + parent + }; + // check inline-template render functions + const inlineTemplate = vnode.data.inlineTemplate; + if (isDef(inlineTemplate)) { + options.render = inlineTemplate.render; + options.staticRenderFns = inlineTemplate.staticRenderFns; } + return new vnode.componentOptions.Ctor(options) } -function callUpdatedHooks (queue) { - let i = queue.length; - while (i--) { - const watcher = queue[i]; - const vm = watcher.vm; - if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'updated'); +function installComponentHooks (data) { + const hooks = data.hook || (data.hook = {}); + for (let i = 0; i < hooksToMerge.length; i++) { + const key = hooksToMerge[i]; + const existing = hooks[key]; + const toMerge = componentVNodeHooks[key]; + if (existing !== toMerge && !(existing && existing._merged)) { + hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; } } } -/** - * Queue a kept-alive component that was activated during patch. - * The queue will be processed after the entire tree has been patched. - */ -function queueActivatedComponent (vm) { - // setting _inactive to false here so that a render function can - // rely on checking whether it's in an inactive tree (e.g. router-view) - vm._inactive = false; - activatedChildren.push(vm); -} - -function callActivatedHooks (queue) { - for (let i = 0; i < queue.length; i++) { - queue[i]._inactive = true; - activateChildComponent(queue[i], true /* true */); - } +function mergeHook$1 (f1, f2) { + const merged = (a, b) => { + // flow complains about extra args which is why we use any + f1(a, b); + f2(a, b); + }; + merged._merged = true; + return merged } -/** - * Push a watcher into the watcher queue. - * Jobs with duplicate IDs will be skipped unless it's - * pushed when the queue is being flushed. - */ -function queueWatcher (watcher) { - const id = watcher.id; - if (has[id] == null) { - has[id] = true; - if (!flushing) { - queue.push(watcher); - } else { - // if already flushing, splice the watcher based on its id - // if already past its id, it will be run next immediately. - let i = queue.length - 1; - while (i > index && queue[i].id > watcher.id) { - i--; - } - queue.splice(i + 1, 0, watcher); - } - // queue the flush - if (!waiting) { - waiting = true; - - if (!config.async) { - flushSchedulerQueue(); - return - } - nextTick(flushSchedulerQueue); +// transform component v-model info (value and callback) into +// prop and event handler respectively. +function transformModel (options, data) { + const prop = (options.model && options.model.prop) || 'value'; + const event = (options.model && options.model.event) || 'input' + ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; + const on = data.on || (data.on = {}); + const existing = on[event]; + const callback = data.model.callback; + if (isDef(existing)) { + if ( + Array.isArray(existing) + ? existing.indexOf(callback) === -1 + : existing !== callback + ) { + on[event] = [callback].concat(existing); } + } else { + on[event] = callback; } } /* */ +const SIMPLE_NORMALIZE = 1; +const ALWAYS_NORMALIZE = 2; - -let uid$1 = 0; - -/** - * A watcher parses an expression, collects dependencies, - * and fires callback when the expression value changes. - * This is used for both the $watch() api and directives. - */ -class Watcher { - - - - - - - - - - - - - - - - - - - constructor ( - vm, - expOrFn, - cb, - options, - isRenderWatcher - ) { - this.vm = vm; - if (isRenderWatcher) { - vm._watcher = this; - } - vm._watchers.push(this); - // options - if (options) { - this.deep = !!options.deep; - this.user = !!options.user; - this.lazy = !!options.lazy; - this.sync = !!options.sync; - this.before = options.before; - } else { - this.deep = this.user = this.lazy = this.sync = false; - } - this.cb = cb; - this.id = ++uid$1; // uid for batching - this.active = true; - this.dirty = this.lazy; // for lazy watchers - this.deps = []; - this.newDeps = []; - this.depIds = new _Set(); - this.newDepIds = new _Set(); - this.expression = expOrFn.toString(); - // parse expression for getter - if (typeof expOrFn === 'function') { - this.getter = expOrFn; - } else { - this.getter = parsePath(expOrFn); - if (!this.getter) { - this.getter = noop; - warn( - `Failed watching path: "${expOrFn}" ` + - 'Watcher only accepts simple dot-delimited paths. ' + - 'For full control, use a function instead.', - vm - ); - } - } - this.value = this.lazy - ? undefined - : this.get(); - } - - /** - * Evaluate the getter, and re-collect dependencies. - */ - get () { - pushTarget(this); - let value; - const vm = this.vm; - try { - value = this.getter.call(vm, vm); - } catch (e) { - if (this.user) { - handleError(e, vm, `getter for watcher "${this.expression}"`); - } else { - throw e - } - } finally { - // "touch" every property so they are all tracked as - // dependencies for deep watching - if (this.deep) { - traverse(value); - } - popTarget(); - this.cleanupDeps(); - } - return value +// wrapper function for providing a more flexible interface +// without getting yelled at by flow +function createElement ( + context, + tag, + data, + children, + normalizationType, + alwaysNormalize +) { + if (Array.isArray(data) || isPrimitive(data)) { + normalizationType = children; + children = data; + data = undefined; } - - /** - * Add a dependency to this directive. - */ - addDep (dep) { - const id = dep.id; - if (!this.newDepIds.has(id)) { - this.newDepIds.add(id); - this.newDeps.push(dep); - if (!this.depIds.has(id)) { - dep.addSub(this); - } - } + if (isTrue(alwaysNormalize)) { + normalizationType = ALWAYS_NORMALIZE; } + return _createElement(context, tag, data, children, normalizationType) +} - /** - * Clean up for dependency collection. - */ - cleanupDeps () { - let i = this.deps.length; - while (i--) { - const dep = this.deps[i]; - if (!this.newDepIds.has(dep.id)) { - dep.removeSub(this); - } +function _createElement ( + context, + tag, + data, + children, + normalizationType +) { + if (isDef(data) && isDef((data).__ob__)) { + warn( + `Avoid using observed data object as vnode data: ${JSON.stringify(data)}\n` + + 'Always create fresh vnode data objects in each render!', + context + ); + return createEmptyVNode() + } + // object syntax in v-bind + if (isDef(data) && isDef(data.is)) { + tag = data.is; + } + if (!tag) { + // in case of component :is set to falsy value + return createEmptyVNode() + } + // warn against non-primitive key + if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) + ) { + { + warn( + 'Avoid using non-primitive value as key, ' + + 'use string/number value instead.', + context + ); } - let tmp = this.depIds; - this.depIds = this.newDepIds; - this.newDepIds = tmp; - this.newDepIds.clear(); - tmp = this.deps; - this.deps = this.newDeps; - this.newDeps = tmp; - this.newDeps.length = 0; } - - /** - * Subscriber interface. - * Will be called when a dependency changes. - */ - update () { - /* istanbul ignore else */ - if (this.lazy) { - this.dirty = true; - } else if (this.sync) { - this.run(); + // support single function children as default scoped slot + if (Array.isArray(children) && + typeof children[0] === 'function' + ) { + data = data || {}; + data.scopedSlots = { default: children[0] }; + children.length = 0; + } + if (normalizationType === ALWAYS_NORMALIZE) { + children = normalizeChildren(children); + } else if (normalizationType === SIMPLE_NORMALIZE) { + children = simpleNormalizeChildren(children); + } + let vnode, ns; + if (typeof tag === 'string') { + let Ctor; + ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); + if (config.isReservedTag(tag)) { + // platform built-in elements + vnode = new VNode( + config.parsePlatformTagName(tag), data, children, + undefined, undefined, context + ); + } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { + // component + vnode = createComponent(Ctor, data, context, children, tag); } else { - queueWatcher(this); + // unknown or unlisted namespaced elements + // check at runtime because it may get assigned a namespace when its + // parent normalizes children + vnode = new VNode( + tag, data, children, + undefined, undefined, context + ); } + } else { + // direct component options / constructor + vnode = createComponent(tag, data, context, children); + } + if (Array.isArray(vnode)) { + return vnode + } else if (isDef(vnode)) { + if (isDef(ns)) applyNS(vnode, ns); + if (isDef(data)) registerDeepBindings(data); + return vnode + } else { + return createEmptyVNode() } +} - /** - * Scheduler job interface. - * Will be called by the scheduler. - */ - run () { - if (this.active) { - const value = this.get(); - if ( - value !== this.value || - // Deep watchers and watchers on Object/Arrays should fire even - // when the value is the same, because the value may - // have mutated. - isObject(value) || - this.deep - ) { - // set new value - const oldValue = this.value; - this.value = value; - if (this.user) { - try { - this.cb.call(this.vm, value, oldValue); - } catch (e) { - handleError(e, this.vm, `callback for watcher "${this.expression}"`); - } - } else { - this.cb.call(this.vm, value, oldValue); - } +function applyNS (vnode, ns, force) { + vnode.ns = ns; + if (vnode.tag === 'foreignObject') { + // use default namespace inside foreignObject + ns = undefined; + force = true; + } + if (isDef(vnode.children)) { + for (let i = 0, l = vnode.children.length; i < l; i++) { + const child = vnode.children[i]; + if (isDef(child.tag) && ( + isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { + applyNS(child, ns, force); } } } +} - /** - * Evaluate the value of the watcher. - * This only gets called for lazy watchers. - */ - evaluate () { - this.value = this.get(); - this.dirty = false; +// ref #5318 +// necessary to ensure parent re-render when deep bindings like :style and +// :class are used on slot nodes +function registerDeepBindings (data) { + if (isObject(data.style)) { + traverse(data.style); + } + if (isObject(data.class)) { + traverse(data.class); } +} - /** - * Depend on all deps collected by this watcher. - */ - depend () { - let i = this.deps.length; - while (i--) { - this.deps[i].depend(); - } +/* */ + +function initRender (vm) { + vm._vnode = null; // the root of the child tree + vm._staticTrees = null; // v-once cached trees + const options = vm.$options; + const parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree + const renderContext = parentVnode && parentVnode.context; + vm.$slots = resolveSlots(options._renderChildren, renderContext); + vm.$scopedSlots = emptyObject; + // bind the createElement fn to this instance + // so that we get proper render context inside it. + // args order: tag, data, children, normalizationType, alwaysNormalize + // internal version is used by render functions compiled from templates + vm._c = (a, b, c, d) => createElement(vm, a, b, c, d, false); + // normalization is always applied for the public version, used in + // user-written render functions. + vm.$createElement = (a, b, c, d) => createElement(vm, a, b, c, d, true); + + // $attrs & $listeners are exposed for easier HOC creation. + // they need to be reactive so that HOCs using them are always updated + const parentData = parentVnode && parentVnode.data; + + /* istanbul ignore else */ + { + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, () => { + !isUpdatingChildComponent && warn(`$attrs is readonly.`, vm); + }, true); + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, () => { + !isUpdatingChildComponent && warn(`$listeners is readonly.`, vm); + }, true); } +} - /** - * Remove self from all dependencies' subscriber list. - */ - teardown () { - if (this.active) { - // remove self from vm's watcher list - // this is a somewhat expensive operation so we skip it - // if the vm is being destroyed. - if (!this.vm._isBeingDestroyed) { - remove(this.vm._watchers, this); +let currentRenderingInstance = null; + +function renderMixin (Vue) { + // install runtime convenience helpers + installRenderHelpers(Vue.prototype); + + Vue.prototype.$nextTick = function (fn) { + return nextTick(fn, this) + }; + + Vue.prototype._render = function () { + const vm = this; + const { render, _parentVnode } = vm.$options; + + if (_parentVnode) { + vm.$scopedSlots = normalizeScopedSlots( + _parentVnode.data.scopedSlots, + vm.$slots + ); + } + + // set parent vnode. this allows render functions to have access + // to the data on the placeholder node. + vm.$vnode = _parentVnode; + // render self + let vnode; + try { + // There's no need to maintain a stack becaues all render fns are called + // separately from one another. Nested component's render fns are called + // when parent component is patched. + currentRenderingInstance = vm; + vnode = render.call(vm._renderProxy, vm.$createElement); + } catch (e) { + handleError(e, vm, `render`); + // return error render result, + // or previous vnode to prevent render error causing blank component + /* istanbul ignore else */ + if (vm.$options.renderError) { + try { + vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); + } catch (e) { + handleError(e, vm, `renderError`); + vnode = vm._vnode; + } + } else { + vnode = vm._vnode; } - let i = this.deps.length; - while (i--) { - this.deps[i].removeSub(this); + } finally { + currentRenderingInstance = null; + } + // if the returned array contains only a single node, allow it + if (Array.isArray(vnode) && vnode.length === 1) { + vnode = vnode[0]; + } + // return empty vnode in case the render function errored out + if (!(vnode instanceof VNode)) { + if (Array.isArray(vnode)) { + warn( + 'Multiple root nodes returned from render function. Render function ' + + 'should return a single root node.', + vm + ); } - this.active = false; + vnode = createEmptyVNode(); } - } + // set parent + vnode.parent = _parentVnode; + return vnode + }; } /* */ -const sharedPropertyDefinition = { - enumerable: true, - configurable: true, - get: noop, - set: noop -}; +function ensureCtor (comp, base) { + if ( + comp.__esModule || + (hasSymbol && comp[Symbol.toStringTag] === 'Module') + ) { + comp = comp.default; + } + return isObject(comp) + ? base.extend(comp) + : comp +} -function proxy (target, sourceKey, key) { - sharedPropertyDefinition.get = function proxyGetter () { - return this[sourceKey][key] - }; - sharedPropertyDefinition.set = function proxySetter (val) { - this[sourceKey][key] = val; - }; - Object.defineProperty(target, key, sharedPropertyDefinition); +function createAsyncPlaceholder ( + factory, + data, + context, + children, + tag +) { + const node = createEmptyVNode(); + node.asyncFactory = factory; + node.asyncMeta = { data, context, children, tag }; + return node } -function initState (vm) { - vm._watchers = []; - const opts = vm.$options; - if (opts.props) initProps(vm, opts.props); - if (opts.methods) initMethods(vm, opts.methods); - if (opts.data) { - initData(vm); - } else { - observe(vm._data = {}, true /* asRootData */); +function resolveAsyncComponent ( + factory, + baseCtor +) { + if (isTrue(factory.error) && isDef(factory.errorComp)) { + return factory.errorComp } - if (opts.computed) initComputed(vm, opts.computed); - if (opts.watch && opts.watch !== nativeWatch) { - initWatch(vm, opts.watch); + + if (isDef(factory.resolved)) { + return factory.resolved } -} -function initProps (vm, propsOptions) { - const propsData = vm.$options.propsData || {}; - const props = vm._props = {}; - // cache prop keys so that future props updates can iterate using Array - // instead of dynamic object key enumeration. - const keys = vm.$options._propKeys = []; - const isRoot = !vm.$parent; - // root instance props should be converted - if (!isRoot) { - toggleObserving(false); + if (isTrue(factory.loading) && isDef(factory.loadingComp)) { + return factory.loadingComp } - for (const key in propsOptions) { - keys.push(key); - const value = validateProp(key, propsOptions, propsData, vm); - /* istanbul ignore else */ - { - const hyphenatedKey = hyphenate(key); - if (isReservedAttribute(hyphenatedKey) || - config.isReservedAttr(hyphenatedKey)) { - warn( - `"${hyphenatedKey}" is a reserved attribute and cannot be used as component prop.`, - vm - ); + + const owner = currentRenderingInstance; + if (isDef(factory.owners)) { + // already pending + factory.owners.push(owner); + } else { + const owners = factory.owners = [owner]; + let sync = true; + + const forceRender = (renderCompleted) => { + for (let i = 0, l = owners.length; i < l; i++) { + (owners[i]).$forceUpdate(); } - defineReactive$$1(props, key, value, () => { - if (!isRoot && !isUpdatingChildComponent) { - warn( - `Avoid mutating a prop directly since the value will be ` + - `overwritten whenever the parent component re-renders. ` + - `Instead, use a data or computed property based on the prop's ` + - `value. Prop being mutated: "${key}"`, - vm - ); - } - }); - } - // static props are already proxied on the component's prototype - // during Vue.extend(). We only need to proxy props defined at - // instantiation here. - if (!(key in vm)) { - proxy(vm, `_props`, key); - } - } - toggleObserving(true); -} -function initData (vm) { - let data = vm.$options.data; - data = vm._data = typeof data === 'function' - ? getData(data, vm) - : data || {}; - if (!isPlainObject(data)) { - data = {}; - warn( - 'data functions should return an object:\n' + - 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', - vm - ); - } - // proxy data on instance - const keys = Object.keys(data); - const props = vm.$options.props; - const methods = vm.$options.methods; - let i = keys.length; - while (i--) { - const key = keys[i]; - { - if (methods && hasOwn(methods, key)) { - warn( - `Method "${key}" has already been defined as a data property.`, - vm - ); + if (renderCompleted) { + owners.length = 0; } - } - if (props && hasOwn(props, key)) { + }; + + const resolve = once((res) => { + // cache resolved + factory.resolved = ensureCtor(res, baseCtor); + // invoke callbacks only if this is not a synchronous resolve + // (async resolves are shimmed as synchronous during SSR) + if (!sync) { + forceRender(true); + } else { + owners.length = 0; + } + }); + + const reject = once(reason => { warn( - `The data property "${key}" is already declared as a prop. ` + - `Use prop default value instead.`, - vm + `Failed to resolve async component: ${String(factory)}` + + (reason ? `\nReason: ${reason}` : '') ); - } else if (!isReserved(key)) { - proxy(vm, `_data`, key); - } - } - // observe data - observe(data, true /* asRootData */); -} + if (isDef(factory.errorComp)) { + factory.error = true; + forceRender(true); + } + }); -function getData (data, vm) { - // #7573 disable dep collection when invoking data getters - pushTarget(); - try { - return data.call(vm, vm) - } catch (e) { - handleError(e, vm, `data()`); - return {} - } finally { - popTarget(); + const res = factory(resolve, reject); + + if (isObject(res)) { + if (isPromise(res)) { + // () => Promise + if (isUndef(factory.resolved)) { + res.then(resolve, reject); + } + } else if (isPromise(res.component)) { + res.component.then(resolve, reject); + + if (isDef(res.error)) { + factory.errorComp = ensureCtor(res.error, baseCtor); + } + + if (isDef(res.loading)) { + factory.loadingComp = ensureCtor(res.loading, baseCtor); + if (res.delay === 0) { + factory.loading = true; + } else { + setTimeout(() => { + if (isUndef(factory.resolved) && isUndef(factory.error)) { + factory.loading = true; + forceRender(false); + } + }, res.delay || 200); + } + } + + if (isDef(res.timeout)) { + setTimeout(() => { + if (isUndef(factory.resolved)) { + reject( + `timeout (${res.timeout}ms)` + ); + } + }, res.timeout); + } + } + } + + sync = false; + // return in case resolved synchronously + return factory.loading + ? factory.loadingComp + : factory.resolved } } -const computedWatcherOptions = { lazy: true }; - -function initComputed (vm, computed) { - // $flow-disable-line - const watchers = vm._computedWatchers = Object.create(null); - // computed properties are just getters during SSR - const isSSR = isServerRendering(); +/* */ - for (const key in computed) { - const userDef = computed[key]; - const getter = typeof userDef === 'function' ? userDef : userDef.get; - if (getter == null) { - warn( - `Getter is missing for computed property "${key}".`, - vm - ); - } +function isAsyncPlaceholder (node) { + return node.isComment && node.asyncFactory +} - if (!isSSR) { - // create internal watcher for the computed property. - watchers[key] = new Watcher( - vm, - getter || noop, - noop, - computedWatcherOptions - ); - } +/* */ - // component-defined computed properties are already defined on the - // component prototype. We only need to define computed properties defined - // at instantiation here. - if (!(key in vm)) { - defineComputed(vm, key, userDef); - } else { - if (key in vm.$data) { - warn(`The computed property "${key}" is already defined in data.`, vm); - } else if (vm.$options.props && key in vm.$options.props) { - warn(`The computed property "${key}" is already defined as a prop.`, vm); +function getFirstComponentChild (children) { + if (Array.isArray(children)) { + for (let i = 0; i < children.length; i++) { + const c = children[i]; + if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { + return c } } } } -function defineComputed ( - target, - key, - userDef -) { - const shouldCache = !isServerRendering(); - if (typeof userDef === 'function') { - sharedPropertyDefinition.get = shouldCache - ? createComputedGetter(key) - : createGetterInvoker(userDef); - sharedPropertyDefinition.set = noop; - } else { - sharedPropertyDefinition.get = userDef.get - ? shouldCache && userDef.cache !== false - ? createComputedGetter(key) - : createGetterInvoker(userDef.get) - : noop; - sharedPropertyDefinition.set = userDef.set || noop; - } - if (sharedPropertyDefinition.set === noop) { - sharedPropertyDefinition.set = function () { - warn( - `Computed property "${key}" was assigned to but it has no setter.`, - this - ); - }; - } - Object.defineProperty(target, key, sharedPropertyDefinition); -} +/* */ -function createComputedGetter (key) { - return function computedGetter () { - const watcher = this._computedWatchers && this._computedWatchers[key]; - if (watcher) { - if (watcher.dirty) { - watcher.evaluate(); - } - if (Dep.target) { - watcher.depend(); - } - return watcher.value - } +/* */ + +function initEvents (vm) { + vm._events = Object.create(null); + vm._hasHookEvent = false; + // init parent attached events + const listeners = vm.$options._parentListeners; + if (listeners) { + updateComponentListeners(vm, listeners); } } -function createGetterInvoker(fn) { - return function computedGetter () { - return fn.call(this, this) - } +let target; + +function add (event, fn) { + target.$on(event, fn); } -function initMethods (vm, methods) { - const props = vm.$options.props; - for (const key in methods) { - { - if (typeof methods[key] !== 'function') { - warn( - `Method "${key}" has type "${typeof methods[key]}" in the component definition. ` + - `Did you reference the function correctly?`, - vm - ); - } - if (props && hasOwn(props, key)) { - warn( - `Method "${key}" has already been defined as a prop.`, - vm - ); - } - if ((key in vm) && isReserved(key)) { - warn( - `Method "${key}" conflicts with an existing Vue instance method. ` + - `Avoid defining component methods that start with _ or $.` - ); - } - } - vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); - } +function remove$1 (event, fn) { + target.$off(event, fn); } -function initWatch (vm, watch) { - for (const key in watch) { - const handler = watch[key]; - if (Array.isArray(handler)) { - for (let i = 0; i < handler.length; i++) { - createWatcher(vm, key, handler[i]); - } - } else { - createWatcher(vm, key, handler); +function createOnceHandler (event, fn) { + const _target = target; + return function onceHandler () { + const res = fn.apply(null, arguments); + if (res !== null) { + _target.$off(event, onceHandler); } } } -function createWatcher ( +function updateComponentListeners ( vm, - expOrFn, - handler, - options + listeners, + oldListeners ) { - if (isPlainObject(handler)) { - options = handler; - handler = handler.handler; - } - if (typeof handler === 'string') { - handler = vm[handler]; - } - return vm.$watch(expOrFn, handler, options) + target = vm; + updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); + target = undefined; } -function stateMixin (Vue) { - // flow somehow has problems with directly declared definition object - // when using Object.defineProperty, so we have to procedurally build up - // the object here. - const dataDef = {}; - dataDef.get = function () { return this._data }; - const propsDef = {}; - propsDef.get = function () { return this._props }; - { - dataDef.set = function () { - warn( - 'Avoid replacing instance root $data. ' + - 'Use nested data properties instead.', - this - ); - }; - propsDef.set = function () { - warn(`$props is readonly.`, this); - }; - } - Object.defineProperty(Vue.prototype, '$data', dataDef); - Object.defineProperty(Vue.prototype, '$props', propsDef); +function eventsMixin (Vue) { + const hookRE = /^hook:/; + Vue.prototype.$on = function (event, fn) { + const vm = this; + if (Array.isArray(event)) { + for (let i = 0, l = event.length; i < l; i++) { + vm.$on(event[i], fn); + } + } else { + (vm._events[event] || (vm._events[event] = [])).push(fn); + // optimize hook:event cost by using a boolean flag marked at registration + // instead of a hash lookup + if (hookRE.test(event)) { + vm._hasHookEvent = true; + } + } + return vm + }; - Vue.prototype.$set = set; - Vue.prototype.$delete = del; + Vue.prototype.$once = function (event, fn) { + const vm = this; + function on () { + vm.$off(event, on); + fn.apply(vm, arguments); + } + on.fn = fn; + vm.$on(event, on); + return vm + }; + + Vue.prototype.$off = function (event, fn) { + const vm = this; + // all + if (!arguments.length) { + vm._events = Object.create(null); + return vm + } + // array of events + if (Array.isArray(event)) { + for (let i = 0, l = event.length; i < l; i++) { + vm.$off(event[i], fn); + } + return vm + } + // specific event + const cbs = vm._events[event]; + if (!cbs) { + return vm + } + if (!fn) { + vm._events[event] = null; + return vm + } + // specific handler + let cb; + let i = cbs.length; + while (i--) { + cb = cbs[i]; + if (cb === fn || cb.fn === fn) { + cbs.splice(i, 1); + break + } + } + return vm + }; - Vue.prototype.$watch = function ( - expOrFn, - cb, - options - ) { + Vue.prototype.$emit = function (event) { const vm = this; - if (isPlainObject(cb)) { - return createWatcher(vm, expOrFn, cb, options) - } - options = options || {}; - options.user = true; - const watcher = new Watcher(vm, expOrFn, cb, options); - if (options.immediate) { - try { - cb.call(vm, watcher.value); - } catch (error) { - handleError(error, vm, `callback for immediate watcher "${watcher.expression}"`); + { + const lowerCaseEvent = event.toLowerCase(); + if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { + tip( + `Event "${lowerCaseEvent}" is emitted in component ` + + `${formatComponentName(vm)} but the handler is registered for "${event}". ` + + `Note that HTML attributes are case-insensitive and you cannot use ` + + `v-on to listen to camelCase events when using in-DOM templates. ` + + `You should probably use "${hyphenate(event)}" instead of "${event}".` + ); } } - return function unwatchFn () { - watcher.teardown(); + let cbs = vm._events[event]; + if (cbs) { + cbs = cbs.length > 1 ? toArray(cbs) : cbs; + const args = toArray(arguments, 1); + const info = `event handler for "${event}"`; + for (let i = 0, l = cbs.length; i < l; i++) { + invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } } + return vm }; } /* */ -function initProvide (vm) { - const provide = vm.$options.provide; - if (provide) { - vm._provided = typeof provide === 'function' - ? provide.call(vm) - : provide; - } -} +let activeInstance = null; +let isUpdatingChildComponent = false; -function initInjections (vm) { - const result = resolveInject(vm.$options.inject, vm); - if (result) { - toggleObserving(false); - Object.keys(result).forEach(key => { - /* istanbul ignore else */ - { - defineReactive$$1(vm, key, result[key], () => { - warn( - `Avoid mutating an injected value directly since the changes will be ` + - `overwritten whenever the provided component re-renders. ` + - `injection being mutated: "${key}"`, - vm - ); - }); - } - }); - toggleObserving(true); +function setActiveInstance(vm) { + const prevActiveInstance = activeInstance; + activeInstance = vm; + return () => { + activeInstance = prevActiveInstance; } } -function resolveInject (inject, vm) { - if (inject) { - // inject is :any because flow is not smart enough to figure out cached - const result = Object.create(null); - const keys = hasSymbol - ? Reflect.ownKeys(inject) - : Object.keys(inject); +function initLifecycle (vm) { + const options = vm.$options; - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - // #6574 in case the inject object is observed... - if (key === '__ob__') continue - const provideKey = inject[key].from; - let source = vm; - while (source) { - if (source._provided && hasOwn(source._provided, provideKey)) { - result[key] = source._provided[provideKey]; - break - } - source = source.$parent; - } - if (!source) { - if ('default' in inject[key]) { - const provideDefault = inject[key].default; - result[key] = typeof provideDefault === 'function' - ? provideDefault.call(vm) - : provideDefault; - } else { - warn(`Injection "${key}" not found`, vm); - } - } + // locate first non-abstract parent + let parent = options.parent; + if (parent && !options.abstract) { + while (parent.$options.abstract && parent.$parent) { + parent = parent.$parent; } - return result + parent.$children.push(vm); } -} -/* */ + vm.$parent = parent; + vm.$root = parent ? parent.$root : vm; -function normalizeScopedSlots ( - slots, - normalSlots -) { - let res; - if (!slots) { - res = {}; - } else if (slots._normalized) { - return slots - } else { - res = {}; - for (const key in slots) { - if (slots[key] && key[0] !== '$') { - res[key] = normalizeScopedSlot(normalSlots, key, slots[key]); - } - } - } - // expose normal slots on scopedSlots - for (const key in normalSlots) { - if (!(key in res)) { - res[key] = proxyNormalSlot(normalSlots, key); - } - } - res._normalized = true; - res.$stable = slots ? slots.$stable : true; - return res -} + vm.$children = []; + vm.$refs = {}; -function normalizeScopedSlot(normalSlots, key, fn) { - const normalized = (scope = {}) => { - const res = fn(scope); - return res && typeof res === 'object' && !Array.isArray(res) - ? [res] // single vnode - : normalizeChildren(res) - }; - // proxy scoped slots on normal $slots - if (!hasOwn(normalSlots, key)) { - Object.defineProperty(normalSlots, key, { - get: normalized - }); - } - return normalized + vm._watcher = null; + vm._inactive = null; + vm._directInactive = false; + vm._isMounted = false; + vm._isDestroyed = false; + vm._isBeingDestroyed = false; } -function proxyNormalSlot(slots, key) { - return () => slots[key] -} +function lifecycleMixin (Vue) { + Vue.prototype._update = function (vnode, hydrating) { + const vm = this; + const prevEl = vm.$el; + const prevVnode = vm._vnode; + const restoreActiveInstance = setActiveInstance(vm); + vm._vnode = vnode; + // Vue.prototype.__patch__ is injected in entry points + // based on the rendering backend used. + if (!prevVnode) { + // initial render + vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); + } else { + // updates + vm.$el = vm.__patch__(prevVnode, vnode); + } + restoreActiveInstance(); + // update __vue__ reference + if (prevEl) { + prevEl.__vue__ = null; + } + if (vm.$el) { + vm.$el.__vue__ = vm; + } + // if parent is an HOC, update its $el as well + if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { + vm.$parent.$el = vm.$el; + } + // updated hook is called by the scheduler to ensure that children are + // updated in a parent's updated hook. + }; -/* */ + Vue.prototype.$forceUpdate = function () { + const vm = this; + if (vm._watcher) { + vm._watcher.update(); + } + }; -/** - * Runtime helper for rendering v-for lists. - */ -function renderList ( - val, - render -) { - let ret, i, l, keys, key; - if (Array.isArray(val) || typeof val === 'string') { - ret = new Array(val.length); - for (i = 0, l = val.length; i < l; i++) { - ret[i] = render(val[i], i); + Vue.prototype.$destroy = function () { + const vm = this; + if (vm._isBeingDestroyed) { + return } - } else if (typeof val === 'number') { - ret = new Array(val); - for (i = 0; i < val; i++) { - ret[i] = render(i + 1, i); + callHook(vm, 'beforeDestroy'); + vm._isBeingDestroyed = true; + // remove self from parent + const parent = vm.$parent; + if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { + remove(parent.$children, vm); } - } else if (isObject(val)) { - if (hasSymbol && val[Symbol.iterator]) { - ret = []; - const iterator = val[Symbol.iterator](); - let result = iterator.next(); - while (!result.done) { - ret.push(render(result.value, ret.length)); - result = iterator.next(); - } - } else { - keys = Object.keys(val); - ret = new Array(keys.length); - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - ret[i] = render(val[key], key, i); - } + // teardown watchers + if (vm._watcher) { + vm._watcher.teardown(); + } + let i = vm._watchers.length; + while (i--) { + vm._watchers[i].teardown(); + } + // remove reference from data ob + // frozen object may not have observer. + if (vm._data.__ob__) { + vm._data.__ob__.vmCount--; } - } - if (!isDef(ret)) { - ret = []; - } - (ret)._isVList = true; - return ret + // call the last hook... + vm._isDestroyed = true; + // invoke destroy hooks on current rendered tree + vm.__patch__(vm._vnode, null); + // fire destroyed hook + callHook(vm, 'destroyed'); + // turn off all instance listeners. + vm.$off(); + // remove __vue__ reference + if (vm.$el) { + vm.$el.__vue__ = null; + } + // release circular reference (#6759) + if (vm.$vnode) { + vm.$vnode.parent = null; + } + }; } -/* */ - -/** - * Runtime helper for rendering - */ -function renderSlot ( - name, - fallback, - props, - bindObject +function mountComponent ( + vm, + el, + hydrating ) { - const scopedSlotFn = this.$scopedSlots[name]; - let nodes; - if (scopedSlotFn) { // scoped slot - props = props || {}; - if (bindObject) { - if (!isObject(bindObject)) { + vm.$el = el; + if (!vm.$options.render) { + vm.$options.render = createEmptyVNode; + { + /* istanbul ignore if */ + if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || + vm.$options.el || el) { warn( - 'slot v-bind without argument expects an Object', - this + 'You are using the runtime-only build of Vue where the template ' + + 'compiler is not available. Either pre-compile the templates into ' + + 'render functions, or use the compiler-included build.', + vm + ); + } else { + warn( + 'Failed to mount component: template or render function not defined.', + vm ); } - props = extend(extend({}, bindObject), props); } - nodes = scopedSlotFn(props) || fallback; - } else { - nodes = this.$slots[name] || fallback; } + callHook(vm, 'beforeMount'); - const target = props && props.slot; - if (target) { - return this.$createElement('template', { slot: target }, nodes) - } else { - return nodes - } -} + let updateComponent; + /* istanbul ignore if */ + if (config.performance && mark) { + updateComponent = () => { + const name = vm._name; + const id = vm._uid; + const startTag = `vue-perf-start:${id}`; + const endTag = `vue-perf-end:${id}`; -/* */ + mark(startTag); + const vnode = vm._render(); + mark(endTag); + measure(`vue ${name} render`, startTag, endTag); -/** - * Runtime helper for resolving filters - */ -function resolveFilter (id) { - return resolveAsset(this.$options, 'filters', id, true) || identity -} + mark(startTag); + vm._update(vnode, hydrating); + mark(endTag); + measure(`vue ${name} patch`, startTag, endTag); + }; + } else { + updateComponent = () => { + vm._update(vm._render(), hydrating); + }; + } -/* */ + // we set this to vm._watcher inside the watcher's constructor + // since the watcher's initial patch may call $forceUpdate (e.g. inside child + // component's mounted hook), which relies on vm._watcher being already defined + new Watcher(vm, updateComponent, noop, { + before () { + if (vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'beforeUpdate'); + } + } + }, true /* isRenderWatcher */); + hydrating = false; -function isKeyNotMatch (expect, actual) { - if (Array.isArray(expect)) { - return expect.indexOf(actual) === -1 - } else { - return expect !== actual + // manually mounted instance, call mounted on self + // mounted is called for render-created child components in its inserted hook + if (vm.$vnode == null) { + vm._isMounted = true; + callHook(vm, 'mounted'); } + return vm } -/** - * Runtime helper for checking keyCodes from config. - * exposed as Vue.prototype._k - * passing in eventKeyName as last argument separately for backwards compat - */ -function checkKeyCodes ( - eventKeyCode, - key, - builtInKeyCode, - eventKeyName, - builtInKeyName +function updateChildComponent ( + vm, + propsData, + listeners, + parentVnode, + renderChildren ) { - const mappedKeyCode = config.keyCodes[key] || builtInKeyCode; - if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { - return isKeyNotMatch(builtInKeyName, eventKeyName) - } else if (mappedKeyCode) { - return isKeyNotMatch(mappedKeyCode, eventKeyCode) - } else if (eventKeyName) { - return hyphenate(eventKeyName) !== key + { + isUpdatingChildComponent = true; } -} -/* */ + // determine whether component has slot children + // we need to do this before overwriting $options._renderChildren. -/** - * Runtime helper for merging v-bind="object" into a VNode's data. - */ -function bindObjectProps ( - data, - tag, - value, - asProp, - isSync -) { - if (value) { - if (!isObject(value)) { - warn( - 'v-bind without argument expects an Object or Array value', - this - ); - } else { - if (Array.isArray(value)) { - value = toObject(value); - } - let hash; - for (const key in value) { - if ( - key === 'class' || - key === 'style' || - isReservedAttribute(key) - ) { - hash = data; - } else { - const type = data.attrs && data.attrs.type; - hash = asProp || config.mustUseProp(tag, type, key) - ? data.domProps || (data.domProps = {}) - : data.attrs || (data.attrs = {}); - } - const camelizedKey = camelize(key); - if (!(key in hash) && !(camelizedKey in hash)) { - hash[key] = value[key]; + // check if there are dynamic scopedSlots (hand-written or compiled but with + // dynamic slot names). Static scoped slots compiled from template has the + // "$stable" marker. + const hasDynamicScopedSlot = !!( + (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || + (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) + ); - if (isSync) { - const on = data.on || (data.on = {}); - on[`update:${camelizedKey}`] = function ($event) { - value[key] = $event; - }; - } - } - } - } + // Any static slot children from the parent may have changed during parent's + // update. Dynamic scoped slots may also have changed. In such cases, a forced + // update is necessary to ensure correctness. + const needsForceUpdate = !!( + renderChildren || // has new static slots + vm.$options._renderChildren || // has old static slots + hasDynamicScopedSlot + ); + + vm.$options._parentVnode = parentVnode; + vm.$vnode = parentVnode; // update vm's placeholder node without re-render + + if (vm._vnode) { // update child tree's parent + vm._vnode.parent = parentVnode; } - return data -} + vm.$options._renderChildren = renderChildren; -/* */ + // update $attrs and $listeners hash + // these are also reactive so they may trigger child update if the child + // used them during render + vm.$attrs = parentVnode.data.attrs || emptyObject; + vm.$listeners = listeners || emptyObject; -/** - * Runtime helper for rendering static trees. - */ -function renderStatic ( - index, - isInFor -) { - const cached = this._staticTrees || (this._staticTrees = []); - let tree = cached[index]; - // if has already-rendered static tree and not inside v-for, - // we can reuse the same tree. - if (tree && !isInFor) { - return tree + // update props + if (propsData && vm.$options.props) { + toggleObserving(false); + const props = vm._props; + const propKeys = vm.$options._propKeys || []; + for (let i = 0; i < propKeys.length; i++) { + const key = propKeys[i]; + const propOptions = vm.$options.props; // wtf flow? + props[key] = validateProp(key, propOptions, propsData, vm); + } + toggleObserving(true); + // keep a copy of raw propsData + vm.$options.propsData = propsData; } - // otherwise, render a fresh tree. - tree = cached[index] = this.$options.staticRenderFns[index].call( - this._renderProxy, - null, - this // for render fns generated for functional component templates - ); - markStatic(tree, `__static__${index}`, false); - return tree -} -/** - * Runtime helper for v-once. - * Effectively it means marking the node as static with a unique key. - */ -function markOnce ( - tree, - index, - key -) { - markStatic(tree, `__once__${index}${key ? `_${key}` : ``}`, true); - return tree -} + // update listeners + listeners = listeners || emptyObject; + const oldListeners = vm.$options._parentListeners; + vm.$options._parentListeners = listeners; + updateComponentListeners(vm, listeners, oldListeners); -function markStatic ( - tree, - key, - isOnce -) { - if (Array.isArray(tree)) { - for (let i = 0; i < tree.length; i++) { - if (tree[i] && typeof tree[i] !== 'string') { - markStaticNode(tree[i], `${key}_${i}`, isOnce); - } - } - } else { - markStaticNode(tree, key, isOnce); + // resolve slots + force update if has children + if (needsForceUpdate) { + vm.$slots = resolveSlots(renderChildren, parentVnode.context); + vm.$forceUpdate(); } -} -function markStaticNode (node, key, isOnce) { - node.isStatic = true; - node.key = key; - node.isOnce = isOnce; + { + isUpdatingChildComponent = false; + } } -/* */ +function isInInactiveTree (vm) { + while (vm && (vm = vm.$parent)) { + if (vm._inactive) return true + } + return false +} -function bindObjectListeners (data, value) { - if (value) { - if (!isPlainObject(value)) { - warn( - 'v-on without argument expects an Object value', - this - ); - } else { - const on = data.on = data.on ? extend({}, data.on) : {}; - for (const key in value) { - const existing = on[key]; - const ours = value[key]; - on[key] = existing ? [].concat(existing, ours) : ours; - } +function activateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = false; + if (isInInactiveTree(vm)) { + return + } + } else if (vm._directInactive) { + return + } + if (vm._inactive || vm._inactive === null) { + vm._inactive = false; + for (let i = 0; i < vm.$children.length; i++) { + activateChildComponent(vm.$children[i]); } + callHook(vm, 'activated'); } - return data } -/* */ - -function bindDynamicKeys (baseObj, values) { - for (let i = 0; i < values.length; i += 2) { - const key = values[i]; - if (typeof key === 'string' && key) { - baseObj[values[i]] = values[i + 1]; - } else if (key !== '' && key !== null) { - // null is a speical value for explicitly removing a binding - warn( - `Invalid value for dynamic directive argument (expected string or null): ${key}`, - this - ); +function deactivateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = true; + if (isInInactiveTree(vm)) { + return } } - return baseObj + if (!vm._inactive) { + vm._inactive = true; + for (let i = 0; i < vm.$children.length; i++) { + deactivateChildComponent(vm.$children[i]); + } + callHook(vm, 'deactivated'); + } } -// helper to dynamically append modifier runtime markers to event names. -// ensure only append when value is already string, otherwise it will be cast -// to string and cause the type check to miss. -function prependModifier (value, symbol) { - return typeof value === 'string' ? symbol + value : value +function callHook (vm, hook) { + // #7573 disable dep collection when invoking lifecycle hooks + pushTarget(); + const handlers = vm.$options[hook]; + const info = `${hook} hook`; + if (handlers) { + for (let i = 0, j = handlers.length; i < j; i++) { + invokeWithErrorHandling(handlers[i], vm, null, vm, info); + } + } + if (vm._hasHookEvent) { + vm.$emit('hook:' + hook); + } + popTarget(); } /* */ -function installRenderHelpers (target) { - target._o = markOnce; - target._n = toNumber; - target._s = toString; - target._l = renderList; - target._t = renderSlot; - target._q = looseEqual; - target._i = looseIndexOf; - target._m = renderStatic; - target._f = resolveFilter; - target._k = checkKeyCodes; - target._b = bindObjectProps; - target._v = createTextVNode; - target._e = createEmptyVNode; - target._u = resolveScopedSlots; - target._g = bindObjectListeners; - target._d = bindDynamicKeys; - target._p = prependModifier; -} +const MAX_UPDATE_COUNT = 100; -/* */ +const queue = []; +const activatedChildren = []; +let has = {}; +let circular = {}; +let waiting = false; +let flushing = false; +let index = 0; -function FunctionalRenderContext ( - data, - props, - children, - parent, - Ctor -) { - const options = Ctor.options; - // ensure the createElement function in functional components - // gets a unique context - this is necessary for correct named slot check - let contextVm; - if (hasOwn(parent, '_uid')) { - contextVm = Object.create(parent); - // $flow-disable-line - contextVm._original = parent; - } else { - // the context vm passed in is a functional context as well. - // in this case we want to make sure we are able to get a hold to the - // real context instance. - contextVm = parent; - // $flow-disable-line - parent = parent._original; +/** + * Reset the scheduler's state. + */ +function resetSchedulerState () { + index = queue.length = activatedChildren.length = 0; + has = {}; + { + circular = {}; } - const isCompiled = isTrue(options._compiled); - const needNormalization = !isCompiled; + waiting = flushing = false; +} - this.data = data; - this.props = props; - this.children = children; - this.parent = parent; - this.listeners = data.on || emptyObject; - this.injections = resolveInject(options.inject, parent); - this.slots = () => resolveSlots(children, parent); +// Async edge case #6566 requires saving the timestamp when event listeners are +// attached. However, calling performance.now() has a perf overhead especially +// if the page has thousands of event listeners. Instead, we take a timestamp +// every time the scheduler flushes and use that for all event listeners +// attached during that flush. +let currentFlushTimestamp = 0; - Object.defineProperty(this, 'scopedSlots', ({ - enumerable: true, - get () { - return normalizeScopedSlots(data.scopedSlots, this.slots()) - } - })); +// Async edge case fix requires storing an event listener's attach timestamp. +let getNow = Date.now; - // support for compiled functional template - if (isCompiled) { - // exposing $options for renderStatic() - this.$options = options; - // pre-resolve slots for renderSlot() - this.$slots = this.slots(); - this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); - } +// Determine what event timestamp the browser is using. Annoyingly, the +// timestamp can either be hi-res (relative to page load) or low-res +// (relative to UNIX epoch), so in order to compare time we have to use the +// same timestamp type when saving the flush timestamp. +if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { + // if the low-res timestamp which is bigger than the event timestamp + // (which is evaluated AFTER) it means the event is using a hi-res timestamp, + // and we need to use the hi-res version for event listeners as well. + getNow = () => performance.now(); +} - if (options._scopeId) { - this._c = (a, b, c, d) => { - const vnode = createElement(contextVm, a, b, c, d, needNormalization); - if (vnode && !Array.isArray(vnode)) { - vnode.fnScopeId = options._scopeId; - vnode.fnContext = parent; +/** + * Flush both queues and run the watchers. + */ +function flushSchedulerQueue () { + currentFlushTimestamp = getNow(); + flushing = true; + let watcher, id; + + // Sort queue before flush. + // This ensures that: + // 1. Components are updated from parent to child. (because parent is always + // created before the child) + // 2. A component's user watchers are run before its render watcher (because + // user watchers are created before the render watcher) + // 3. If a component is destroyed during a parent component's watcher run, + // its watchers can be skipped. + queue.sort((a, b) => a.id - b.id); + + // do not cache length because more watchers might be pushed + // as we run existing watchers + for (index = 0; index < queue.length; index++) { + watcher = queue[index]; + if (watcher.before) { + watcher.before(); + } + id = watcher.id; + has[id] = null; + watcher.run(); + // in dev build, check and stop circular updates. + if (has[id] != null) { + circular[id] = (circular[id] || 0) + 1; + if (circular[id] > MAX_UPDATE_COUNT) { + warn( + 'You may have an infinite update loop ' + ( + watcher.user + ? `in watcher with expression "${watcher.expression}"` + : `in a component render function.` + ), + watcher.vm + ); + break } - return vnode - }; - } else { - this._c = (a, b, c, d) => createElement(contextVm, a, b, c, d, needNormalization); + } } -} -installRenderHelpers(FunctionalRenderContext.prototype); + // keep copies of post queues before resetting state + const activatedQueue = activatedChildren.slice(); + const updatedQueue = queue.slice(); -function createFunctionalComponent ( - Ctor, - propsData, - data, - contextVm, - children -) { - const options = Ctor.options; - const props = {}; - const propOptions = options.props; - if (isDef(propOptions)) { - for (const key in propOptions) { - props[key] = validateProp(key, propOptions, propsData || emptyObject); - } - } else { - if (isDef(data.attrs)) mergeProps(props, data.attrs); - if (isDef(data.props)) mergeProps(props, data.props); - } + resetSchedulerState(); - const renderContext = new FunctionalRenderContext( - data, - props, - children, - contextVm, - Ctor - ); + // call component updated and activated hooks + callActivatedHooks(activatedQueue); + callUpdatedHooks(updatedQueue); - const vnode = options.render.call(null, renderContext._c, renderContext); + // devtool hook + /* istanbul ignore if */ + if (devtools && config.devtools) { + devtools.emit('flush'); + } +} - if (vnode instanceof VNode) { - return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) - } else if (Array.isArray(vnode)) { - const vnodes = normalizeChildren(vnode) || []; - const res = new Array(vnodes.length); - for (let i = 0; i < vnodes.length; i++) { - res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); +function callUpdatedHooks (queue) { + let i = queue.length; + while (i--) { + const watcher = queue[i]; + const vm = watcher.vm; + if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'updated'); } - return res } } -function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { - // #7817 clone node before setting fnContext, otherwise if the node is reused - // (e.g. it was from a cached normal slot) the fnContext causes named slots - // that should not be matched to match. - const clone = cloneVNode(vnode); - clone.fnContext = contextVm; - clone.fnOptions = options; - { - (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; - } - if (data.slot) { - (clone.data || (clone.data = {})).slot = data.slot; - } - return clone +/** + * Queue a kept-alive component that was activated during patch. + * The queue will be processed after the entire tree has been patched. + */ +function queueActivatedComponent (vm) { + // setting _inactive to false here so that a render function can + // rely on checking whether it's in an inactive tree (e.g. router-view) + vm._inactive = false; + activatedChildren.push(vm); } -function mergeProps (to, from) { - for (const key in from) { - to[camelize(key)] = from[key]; +function callActivatedHooks (queue) { + for (let i = 0; i < queue.length; i++) { + queue[i]._inactive = true; + activateChildComponent(queue[i], true /* true */); } } -/* */ +/** + * Push a watcher into the watcher queue. + * Jobs with duplicate IDs will be skipped unless it's + * pushed when the queue is being flushed. + */ +function queueWatcher (watcher) { + const id = watcher.id; + if (has[id] == null) { + has[id] = true; + if (!flushing) { + queue.push(watcher); + } else { + // if already flushing, splice the watcher based on its id + // if already past its id, it will be run next immediately. + let i = queue.length - 1; + while (i > index && queue[i].id > watcher.id) { + i--; + } + queue.splice(i + 1, 0, watcher); + } + // queue the flush + if (!waiting) { + waiting = true; -/* */ + if (!config.async) { + flushSchedulerQueue(); + return + } + nextTick(flushSchedulerQueue); + } + } +} /* */ -/* */ -// inline hooks to be invoked on component VNodes during patch -const componentVNodeHooks = { - init (vnode, hydrating) { - if ( - vnode.componentInstance && - !vnode.componentInstance._isDestroyed && - vnode.data.keepAlive - ) { - // kept-alive components, treat as a patch - const mountedNode = vnode; // work around flow - componentVNodeHooks.prepatch(mountedNode, mountedNode); - } else { - const child = vnode.componentInstance = createComponentInstanceForVnode( - vnode, - activeInstance - ); - child.$mount(hydrating ? vnode.elm : undefined, hydrating); - } - }, - prepatch (oldVnode, vnode) { - const options = vnode.componentOptions; - const child = vnode.componentInstance = oldVnode.componentInstance; - updateChildComponent( - child, - options.propsData, // updated props - options.listeners, // updated listeners - vnode, // new parent vnode - options.children // new children - ); - }, +let uid$2 = 0; - insert (vnode) { - const { context, componentInstance } = vnode; - if (!componentInstance._isMounted) { - componentInstance._isMounted = true; - callHook(componentInstance, 'mounted'); +/** + * A watcher parses an expression, collects dependencies, + * and fires callback when the expression value changes. + * This is used for both the $watch() api and directives. + */ +class Watcher { + + + + + + + + + + + + + + + + + + + constructor ( + vm, + expOrFn, + cb, + options, + isRenderWatcher + ) { + this.vm = vm; + if (isRenderWatcher) { + vm._watcher = this; } - if (vnode.data.keepAlive) { - if (context._isMounted) { - // vue-router#1212 - // During updates, a kept-alive component's child components may - // change, so directly walking the tree here may call activated hooks - // on incorrect children. Instead we push them into a queue which will - // be processed after the whole patch process ended. - queueActivatedComponent(componentInstance); - } else { - activateChildComponent(componentInstance, true /* direct */); + vm._watchers.push(this); + // options + if (options) { + this.deep = !!options.deep; + this.user = !!options.user; + this.lazy = !!options.lazy; + this.sync = !!options.sync; + this.before = options.before; + } else { + this.deep = this.user = this.lazy = this.sync = false; + } + this.cb = cb; + this.id = ++uid$2; // uid for batching + this.active = true; + this.dirty = this.lazy; // for lazy watchers + this.deps = []; + this.newDeps = []; + this.depIds = new _Set(); + this.newDepIds = new _Set(); + this.expression = expOrFn.toString(); + // parse expression for getter + if (typeof expOrFn === 'function') { + this.getter = expOrFn; + } else { + this.getter = parsePath(expOrFn); + if (!this.getter) { + this.getter = noop; + warn( + `Failed watching path: "${expOrFn}" ` + + 'Watcher only accepts simple dot-delimited paths. ' + + 'For full control, use a function instead.', + vm + ); } } - }, + this.value = this.lazy + ? undefined + : this.get(); + } - destroy (vnode) { - const { componentInstance } = vnode; - if (!componentInstance._isDestroyed) { - if (!vnode.data.keepAlive) { - componentInstance.$destroy(); + /** + * Evaluate the getter, and re-collect dependencies. + */ + get () { + pushTarget(this); + let value; + const vm = this.vm; + try { + value = this.getter.call(vm, vm); + } catch (e) { + if (this.user) { + handleError(e, vm, `getter for watcher "${this.expression}"`); } else { - deactivateChildComponent(componentInstance, true /* direct */); + throw e + } + } finally { + // "touch" every property so they are all tracked as + // dependencies for deep watching + if (this.deep) { + traverse(value); } + popTarget(); + this.cleanupDeps(); } + return value } -}; - -const hooksToMerge = Object.keys(componentVNodeHooks); -function createComponent ( - Ctor, - data, - context, - children, - tag -) { - if (isUndef(Ctor)) { - return + /** + * Add a dependency to this directive. + */ + addDep (dep) { + const id = dep.id; + if (!this.newDepIds.has(id)) { + this.newDepIds.add(id); + this.newDeps.push(dep); + if (!this.depIds.has(id)) { + dep.addSub(this); + } + } } - const baseCtor = context.$options._base; - - // plain options object: turn it into a constructor - if (isObject(Ctor)) { - Ctor = baseCtor.extend(Ctor); + /** + * Clean up for dependency collection. + */ + cleanupDeps () { + let i = this.deps.length; + while (i--) { + const dep = this.deps[i]; + if (!this.newDepIds.has(dep.id)) { + dep.removeSub(this); + } + } + let tmp = this.depIds; + this.depIds = this.newDepIds; + this.newDepIds = tmp; + this.newDepIds.clear(); + tmp = this.deps; + this.deps = this.newDeps; + this.newDeps = tmp; + this.newDeps.length = 0; } - // if at this stage it's not a constructor or an async component factory, - // reject. - if (typeof Ctor !== 'function') { - { - warn(`Invalid Component definition: ${String(Ctor)}`, context); + /** + * Subscriber interface. + * Will be called when a dependency changes. + */ + update () { + /* istanbul ignore else */ + if (this.lazy) { + this.dirty = true; + } else if (this.sync) { + this.run(); + } else { + queueWatcher(this); } - return } - // async component - let asyncFactory; - if (isUndef(Ctor.cid)) { - asyncFactory = Ctor; - Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context); - if (Ctor === undefined) { - // return a placeholder node for async component, which is rendered - // as a comment node but preserves all the raw information for the node. - // the information will be used for async server-rendering and hydration. - return createAsyncPlaceholder( - asyncFactory, - data, - context, - children, - tag - ) + /** + * Scheduler job interface. + * Will be called by the scheduler. + */ + run () { + if (this.active) { + const value = this.get(); + if ( + value !== this.value || + // Deep watchers and watchers on Object/Arrays should fire even + // when the value is the same, because the value may + // have mutated. + isObject(value) || + this.deep + ) { + // set new value + const oldValue = this.value; + this.value = value; + if (this.user) { + try { + this.cb.call(this.vm, value, oldValue); + } catch (e) { + handleError(e, this.vm, `callback for watcher "${this.expression}"`); + } + } else { + this.cb.call(this.vm, value, oldValue); + } + } } } - data = data || {}; - - // resolve constructor options in case global mixins are applied after - // component constructor creation - resolveConstructorOptions(Ctor); - - // transform component v-model data into props & events - if (isDef(data.model)) { - transformModel(Ctor.options, data); + /** + * Evaluate the value of the watcher. + * This only gets called for lazy watchers. + */ + evaluate () { + this.value = this.get(); + this.dirty = false; } - // extract props - const propsData = extractPropsFromVNodeData(data, Ctor, tag); - - // functional component - if (isTrue(Ctor.options.functional)) { - return createFunctionalComponent(Ctor, propsData, data, context, children) + /** + * Depend on all deps collected by this watcher. + */ + depend () { + let i = this.deps.length; + while (i--) { + this.deps[i].depend(); + } } - // extract listeners, since these needs to be treated as - // child component listeners instead of DOM listeners - const listeners = data.on; - // replace with listeners with .native modifier - // so it gets processed during parent component patch. - data.on = data.nativeOn; - - if (isTrue(Ctor.options.abstract)) { - // abstract components do not keep anything - // other than props & listeners & slot - - // work around flow - const slot = data.slot; - data = {}; - if (slot) { - data.slot = slot; + /** + * Remove self from all dependencies' subscriber list. + */ + teardown () { + if (this.active) { + // remove self from vm's watcher list + // this is a somewhat expensive operation so we skip it + // if the vm is being destroyed. + if (!this.vm._isBeingDestroyed) { + remove(this.vm._watchers, this); + } + let i = this.deps.length; + while (i--) { + this.deps[i].removeSub(this); + } + this.active = false; } } - - // install component management hooks onto the placeholder node - installComponentHooks(data); - - // return a placeholder vnode - const name = Ctor.options.name || tag; - const vnode = new VNode( - `vue-component-${Ctor.cid}${name ? `-${name}` : ''}`, - data, undefined, undefined, undefined, context, - { Ctor, propsData, listeners, tag, children }, - asyncFactory - ); - - return vnode } -function createComponentInstanceForVnode ( - vnode, // we know it's MountedComponentVNode but flow doesn't - parent, // activeInstance in lifecycle state -) { - const options = { - _isComponent: true, - _parentVnode: vnode, - parent - }; - // check inline-template render functions - const inlineTemplate = vnode.data.inlineTemplate; - if (isDef(inlineTemplate)) { - options.render = inlineTemplate.render; - options.staticRenderFns = inlineTemplate.staticRenderFns; - } - return new vnode.componentOptions.Ctor(options) -} +/* */ -function installComponentHooks (data) { - const hooks = data.hook || (data.hook = {}); - for (let i = 0; i < hooksToMerge.length; i++) { - const key = hooksToMerge[i]; - const existing = hooks[key]; - const toMerge = componentVNodeHooks[key]; - if (existing !== toMerge && !(existing && existing._merged)) { - hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; - } - } -} +const sharedPropertyDefinition = { + enumerable: true, + configurable: true, + get: noop, + set: noop +}; -function mergeHook$1 (f1, f2) { - const merged = (a, b) => { - // flow complains about extra args which is why we use any - f1(a, b); - f2(a, b); +function proxy (target, sourceKey, key) { + sharedPropertyDefinition.get = function proxyGetter () { + return this[sourceKey][key] }; - merged._merged = true; - return merged + sharedPropertyDefinition.set = function proxySetter (val) { + this[sourceKey][key] = val; + }; + Object.defineProperty(target, key, sharedPropertyDefinition); } -// transform component v-model info (value and callback) into -// prop and event handler respectively. -function transformModel (options, data) { - const prop = (options.model && options.model.prop) || 'value'; - const event = (options.model && options.model.event) || 'input' - ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; - const on = data.on || (data.on = {}); - const existing = on[event]; - const callback = data.model.callback; - if (isDef(existing)) { - if ( - Array.isArray(existing) - ? existing.indexOf(callback) === -1 - : existing !== callback - ) { - on[event] = [callback].concat(existing); - } +function initState (vm) { + vm._watchers = []; + const opts = vm.$options; + if (opts.props) initProps(vm, opts.props); + if (opts.methods) initMethods(vm, opts.methods); + if (opts.data) { + initData(vm); } else { - on[event] = callback; + observe(vm._data = {}, true /* asRootData */); + } + if (opts.computed) initComputed(vm, opts.computed); + if (opts.watch && opts.watch !== nativeWatch) { + initWatch(vm, opts.watch); } } -/* */ - -const SIMPLE_NORMALIZE = 1; -const ALWAYS_NORMALIZE = 2; - -// wrapper function for providing a more flexible interface -// without getting yelled at by flow -function createElement ( - context, - tag, - data, - children, - normalizationType, - alwaysNormalize -) { - if (Array.isArray(data) || isPrimitive(data)) { - normalizationType = children; - children = data; - data = undefined; +function initProps (vm, propsOptions) { + const propsData = vm.$options.propsData || {}; + const props = vm._props = {}; + // cache prop keys so that future props updates can iterate using Array + // instead of dynamic object key enumeration. + const keys = vm.$options._propKeys = []; + const isRoot = !vm.$parent; + // root instance props should be converted + if (!isRoot) { + toggleObserving(false); } - if (isTrue(alwaysNormalize)) { - normalizationType = ALWAYS_NORMALIZE; + for (const key in propsOptions) { + keys.push(key); + const value = validateProp(key, propsOptions, propsData, vm); + /* istanbul ignore else */ + { + const hyphenatedKey = hyphenate(key); + if (isReservedAttribute(hyphenatedKey) || + config.isReservedAttr(hyphenatedKey)) { + warn( + `"${hyphenatedKey}" is a reserved attribute and cannot be used as component prop.`, + vm + ); + } + defineReactive$$1(props, key, value, () => { + if (!isRoot && !isUpdatingChildComponent) { + warn( + `Avoid mutating a prop directly since the value will be ` + + `overwritten whenever the parent component re-renders. ` + + `Instead, use a data or computed property based on the prop's ` + + `value. Prop being mutated: "${key}"`, + vm + ); + } + }); + } + // static props are already proxied on the component's prototype + // during Vue.extend(). We only need to proxy props defined at + // instantiation here. + if (!(key in vm)) { + proxy(vm, `_props`, key); + } } - return _createElement(context, tag, data, children, normalizationType) + toggleObserving(true); } -function _createElement ( - context, - tag, - data, - children, - normalizationType -) { - if (isDef(data) && isDef((data).__ob__)) { +function initData (vm) { + let data = vm.$options.data; + data = vm._data = typeof data === 'function' + ? getData(data, vm) + : data || {}; + if (!isPlainObject(data)) { + data = {}; warn( - `Avoid using observed data object as vnode data: ${JSON.stringify(data)}\n` + - 'Always create fresh vnode data objects in each render!', - context + 'data functions should return an object:\n' + + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', + vm ); - return createEmptyVNode() - } - // object syntax in v-bind - if (isDef(data) && isDef(data.is)) { - tag = data.is; - } - if (!tag) { - // in case of component :is set to falsy value - return createEmptyVNode() } - // warn against non-primitive key - if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) - ) { + // proxy data on instance + const keys = Object.keys(data); + const props = vm.$options.props; + const methods = vm.$options.methods; + let i = keys.length; + while (i--) { + const key = keys[i]; { + if (methods && hasOwn(methods, key)) { + warn( + `Method "${key}" has already been defined as a data property.`, + vm + ); + } + } + if (props && hasOwn(props, key)) { warn( - 'Avoid using non-primitive value as key, ' + - 'use string/number value instead.', - context + `The data property "${key}" is already declared as a prop. ` + + `Use prop default value instead.`, + vm ); + } else if (!isReserved(key)) { + proxy(vm, `_data`, key); } } - // support single function children as default scoped slot - if (Array.isArray(children) && - typeof children[0] === 'function' - ) { - data = data || {}; - data.scopedSlots = { default: children[0] }; - children.length = 0; - } - if (normalizationType === ALWAYS_NORMALIZE) { - children = normalizeChildren(children); - } else if (normalizationType === SIMPLE_NORMALIZE) { - children = simpleNormalizeChildren(children); + // observe data + observe(data, true /* asRootData */); +} + +function getData (data, vm) { + // #7573 disable dep collection when invoking data getters + pushTarget(); + try { + return data.call(vm, vm) + } catch (e) { + handleError(e, vm, `data()`); + return {} + } finally { + popTarget(); } - let vnode, ns; - if (typeof tag === 'string') { - let Ctor; - ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); - if (config.isReservedTag(tag)) { - // platform built-in elements - vnode = new VNode( - config.parsePlatformTagName(tag), data, children, - undefined, undefined, context +} + +const computedWatcherOptions = { lazy: true }; + +function initComputed (vm, computed) { + // $flow-disable-line + const watchers = vm._computedWatchers = Object.create(null); + // computed properties are just getters during SSR + const isSSR = isServerRendering(); + + for (const key in computed) { + const userDef = computed[key]; + const getter = typeof userDef === 'function' ? userDef : userDef.get; + if (getter == null) { + warn( + `Getter is missing for computed property "${key}".`, + vm ); - } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { - // component - vnode = createComponent(Ctor, data, context, children, tag); - } else { - // unknown or unlisted namespaced elements - // check at runtime because it may get assigned a namespace when its - // parent normalizes children - vnode = new VNode( - tag, data, children, - undefined, undefined, context + } + + if (!isSSR) { + // create internal watcher for the computed property. + watchers[key] = new Watcher( + vm, + getter || noop, + noop, + computedWatcherOptions ); } + + // component-defined computed properties are already defined on the + // component prototype. We only need to define computed properties defined + // at instantiation here. + if (!(key in vm)) { + defineComputed(vm, key, userDef); + } else { + if (key in vm.$data) { + warn(`The computed property "${key}" is already defined in data.`, vm); + } else if (vm.$options.props && key in vm.$options.props) { + warn(`The computed property "${key}" is already defined as a prop.`, vm); + } + } + } +} + +function defineComputed ( + target, + key, + userDef +) { + const shouldCache = !isServerRendering(); + if (typeof userDef === 'function') { + sharedPropertyDefinition.get = shouldCache + ? createComputedGetter(key) + : createGetterInvoker(userDef); + sharedPropertyDefinition.set = noop; } else { - // direct component options / constructor - vnode = createComponent(tag, data, context, children); + sharedPropertyDefinition.get = userDef.get + ? shouldCache && userDef.cache !== false + ? createComputedGetter(key) + : createGetterInvoker(userDef.get) + : noop; + sharedPropertyDefinition.set = userDef.set || noop; } - if (Array.isArray(vnode)) { - return vnode - } else if (isDef(vnode)) { - if (isDef(ns)) applyNS(vnode, ns); - if (isDef(data)) registerDeepBindings(data); - return vnode - } else { - return createEmptyVNode() + if (sharedPropertyDefinition.set === noop) { + sharedPropertyDefinition.set = function () { + warn( + `Computed property "${key}" was assigned to but it has no setter.`, + this + ); + }; } + Object.defineProperty(target, key, sharedPropertyDefinition); } -function applyNS (vnode, ns, force) { - vnode.ns = ns; - if (vnode.tag === 'foreignObject') { - // use default namespace inside foreignObject - ns = undefined; - force = true; - } - if (isDef(vnode.children)) { - for (let i = 0, l = vnode.children.length; i < l; i++) { - const child = vnode.children[i]; - if (isDef(child.tag) && ( - isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { - applyNS(child, ns, force); +function createComputedGetter (key) { + return function computedGetter () { + const watcher = this._computedWatchers && this._computedWatchers[key]; + if (watcher) { + if (watcher.dirty) { + watcher.evaluate(); + } + if (Dep.target) { + watcher.depend(); } + return watcher.value } } } -// ref #5318 -// necessary to ensure parent re-render when deep bindings like :style and -// :class are used on slot nodes -function registerDeepBindings (data) { - if (isObject(data.style)) { - traverse(data.style); - } - if (isObject(data.class)) { - traverse(data.class); +function createGetterInvoker(fn) { + return function computedGetter () { + return fn.call(this, this) } } -/* */ - -function initRender (vm) { - vm._vnode = null; // the root of the child tree - vm._staticTrees = null; // v-once cached trees - const options = vm.$options; - const parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree - const renderContext = parentVnode && parentVnode.context; - vm.$slots = resolveSlots(options._renderChildren, renderContext); - vm.$scopedSlots = emptyObject; - // bind the createElement fn to this instance - // so that we get proper render context inside it. - // args order: tag, data, children, normalizationType, alwaysNormalize - // internal version is used by render functions compiled from templates - vm._c = (a, b, c, d) => createElement(vm, a, b, c, d, false); - // normalization is always applied for the public version, used in - // user-written render functions. - vm.$createElement = (a, b, c, d) => createElement(vm, a, b, c, d, true); +function initMethods (vm, methods) { + const props = vm.$options.props; + for (const key in methods) { + { + if (typeof methods[key] !== 'function') { + warn( + `Method "${key}" has type "${typeof methods[key]}" in the component definition. ` + + `Did you reference the function correctly?`, + vm + ); + } + if (props && hasOwn(props, key)) { + warn( + `Method "${key}" has already been defined as a prop.`, + vm + ); + } + if ((key in vm) && isReserved(key)) { + warn( + `Method "${key}" conflicts with an existing Vue instance method. ` + + `Avoid defining component methods that start with _ or $.` + ); + } + } + vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); + } +} - // $attrs & $listeners are exposed for easier HOC creation. - // they need to be reactive so that HOCs using them are always updated - const parentData = parentVnode && parentVnode.data; +function initWatch (vm, watch) { + for (const key in watch) { + const handler = watch[key]; + if (Array.isArray(handler)) { + for (let i = 0; i < handler.length; i++) { + createWatcher(vm, key, handler[i]); + } + } else { + createWatcher(vm, key, handler); + } + } +} - /* istanbul ignore else */ - { - defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, () => { - !isUpdatingChildComponent && warn(`$attrs is readonly.`, vm); - }, true); - defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, () => { - !isUpdatingChildComponent && warn(`$listeners is readonly.`, vm); - }, true); +function createWatcher ( + vm, + expOrFn, + handler, + options +) { + if (isPlainObject(handler)) { + options = handler; + handler = handler.handler; + } + if (typeof handler === 'string') { + handler = vm[handler]; } + return vm.$watch(expOrFn, handler, options) } -function renderMixin (Vue) { - // install runtime convenience helpers - installRenderHelpers(Vue.prototype); +function stateMixin (Vue) { + // flow somehow has problems with directly declared definition object + // when using Object.defineProperty, so we have to procedurally build up + // the object here. + const dataDef = {}; + dataDef.get = function () { return this._data }; + const propsDef = {}; + propsDef.get = function () { return this._props }; + { + dataDef.set = function () { + warn( + 'Avoid replacing instance root $data. ' + + 'Use nested data properties instead.', + this + ); + }; + propsDef.set = function () { + warn(`$props is readonly.`, this); + }; + } + Object.defineProperty(Vue.prototype, '$data', dataDef); + Object.defineProperty(Vue.prototype, '$props', propsDef); - Vue.prototype.$nextTick = function (fn) { - return nextTick(fn, this) - }; + Vue.prototype.$set = set; + Vue.prototype.$delete = del; - Vue.prototype._render = function () { + Vue.prototype.$watch = function ( + expOrFn, + cb, + options + ) { const vm = this; - const { render, _parentVnode } = vm.$options; - - if (_parentVnode) { - vm.$scopedSlots = normalizeScopedSlots( - _parentVnode.data.scopedSlots, - vm.$slots - ); + if (isPlainObject(cb)) { + return createWatcher(vm, expOrFn, cb, options) } - - // set parent vnode. this allows render functions to have access - // to the data on the placeholder node. - vm.$vnode = _parentVnode; - // render self - let vnode; - try { - vnode = render.call(vm._renderProxy, vm.$createElement); - } catch (e) { - handleError(e, vm, `render`); - // return error render result, - // or previous vnode to prevent render error causing blank component - /* istanbul ignore else */ - if (vm.$options.renderError) { - try { - vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); - } catch (e) { - handleError(e, vm, `renderError`); - vnode = vm._vnode; - } - } else { - vnode = vm._vnode; + options = options || {}; + options.user = true; + const watcher = new Watcher(vm, expOrFn, cb, options); + if (options.immediate) { + try { + cb.call(vm, watcher.value); + } catch (error) { + handleError(error, vm, `callback for immediate watcher "${watcher.expression}"`); } } - // if the returned array contains only a single node, allow it - if (Array.isArray(vnode) && vnode.length === 1) { - vnode = vnode[0]; - } - // return empty vnode in case the render function errored out - if (!(vnode instanceof VNode)) { - if (Array.isArray(vnode)) { - warn( - 'Multiple root nodes returned from render function. Render function ' + - 'should return a single root node.', - vm - ); - } - vnode = createEmptyVNode(); + return function unwatchFn () { + watcher.teardown(); } - // set parent - vnode.parent = _parentVnode; - return vnode }; } @@ -5359,7 +5364,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', { value: FunctionalRenderContext }); -Vue.version = '2.6.2'; +Vue.version = '2.6.3'; /* */ @@ -7415,6 +7420,11 @@ function createOnceHandler$1 (event, handler, capture) { } } +// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp +// implementation and does not fire microtasks in between event propagation, so +// safe to exclude. +const useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); + function add$1 ( name, handler, @@ -7427,11 +7437,16 @@ function add$1 ( // the solution is simple: we save the timestamp when a handler is attached, // and the handler would only fire if the event passed to it was fired // AFTER it was attached. - if (isUsingMicroTask) { + if (useMicrotaskFix) { const attachedTimestamp = currentFlushTimestamp; const original = handler; handler = original._wrapper = function (e) { - if (e.timeStamp >= attachedTimestamp) { + if ( + e.timeStamp >= attachedTimestamp || + // #9448 bail if event is fired in another document in a multi-page + // electron/nw.js app + e.target.ownerDocument !== document + ) { return original.apply(this, arguments) } }; @@ -9437,6 +9452,8 @@ const invalidAttributeRE = /[\s"'<>\/=]/; const decodeHTMLCached = cached(he.decode); +const emptySlotScopeToken = `_empty_`; + // configurable state let warn$2; let delimiters; @@ -10047,7 +10064,7 @@ function processSlotContent (el) { const { name, dynamic } = getSlotName(slotBinding); el.slotTarget = name; el.slotTargetDynamic = dynamic; - el.slotScope = slotBinding.value || `_`; // force it into a scoped slot for perf + el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf } } else { // v-slot on component, denotes default slot @@ -10080,8 +10097,13 @@ function processSlotContent (el) { const slotContainer = slots[name] = createASTElement('template', [], el); slotContainer.slotTarget = name; slotContainer.slotTargetDynamic = dynamic; - slotContainer.children = el.children.filter(c => !(c).slotScope); - slotContainer.slotScope = slotBinding.value || `_`; + slotContainer.children = el.children.filter((c) => { + if (!c.slotScope) { + c.parent = slotContainer; + return true + } + }); + slotContainer.slotScope = slotBinding.value || emptySlotScopeToken; // remove children as they are returned from scopedSlots now el.children = []; // mark el non-plain so data gets generated @@ -11040,7 +11062,7 @@ function genData$2 (el, state) { } // scoped slots if (el.scopedSlots) { - data += `${genScopedSlots(el.scopedSlots, state)},`; + data += `${genScopedSlots(el, el.scopedSlots, state)},`; } // component v-model if (el.model) { @@ -11127,18 +11149,36 @@ function genInlineTemplate (el, state) { } function genScopedSlots ( + el, slots, state ) { - const hasDynamicKeys = Object.keys(slots).some(key => { + // by default scoped slots are considered "stable", this allows child + // components with only scoped slots to skip forced updates from parent. + // but in some cases we have to bail-out of this optimization + // for example if the slot contains dynamic names, has v-if or v-for on them... + let needsForceUpdate = Object.keys(slots).some(key => { const slot = slots[key]; return slot.slotTargetDynamic || slot.if || slot.for }); + // OR when it is inside another scoped slot (the reactivity is disconnected) + // #9438 + if (!needsForceUpdate) { + let parent = el.parent; + while (parent) { + if (parent.slotScope && parent.slotScope !== emptySlotScopeToken) { + needsForceUpdate = true; + break + } + parent = parent.parent; + } + } + return `scopedSlots:_u([${ Object.keys(slots).map(key => { return genScopedSlot(slots[key], state) }).join(',') - }]${hasDynamicKeys ? `,true` : ``})` + }]${needsForceUpdate ? `,true` : ``})` } function genScopedSlot ( @@ -11152,7 +11192,10 @@ function genScopedSlot ( if (el.for && !el.forProcessed) { return genFor(el, state, genScopedSlot) } - const fn = `function(${String(el.slotScope)}){` + + const slotScope = el.slotScope === emptySlotScopeToken + ? `` + : String(el.slotScope); + const fn = `function(${slotScope}){` + `return ${el.tag === 'template' ? el.if && isLegacySyntax ? `(${el.if})?${genChildren(el, state) || 'undefined'}:undefined` @@ -11249,7 +11292,14 @@ function genSlot (el, state) { const slotName = el.slotName || '"default"'; const children = genChildren(el, state); let res = `_t(${slotName}${children ? `,${children}` : ''}`; - const attrs = el.attrs && `{${el.attrs.map(a => `${camelize(a.name)}:${a.value}`).join(',')}}`; + const attrs = el.attrs || el.dynamicAttrs + ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(attr => ({ + // slot props are camelized + name: camelize(attr.name), + value: attr.value, + dynamic: attr.dynamic + }))) + : null; const bind$$1 = el.attrsMap['v-bind']; if ((attrs || bind$$1) && !children) { res += `,null`; diff --git a/dist/vue.esm.browser.min.js b/dist/vue.esm.browser.min.js index 111e977f8f0..79137b9abf3 100644 --- a/dist/vue.esm.browser.min.js +++ b/dist/vue.esm.browser.min.js @@ -1,6 +1,6 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ -const t=Object.freeze({});function e(t){return null==t}function n(t){return null!=t}function o(t){return!0===t}function r(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function s(t){return null!==t&&"object"==typeof t}const i=Object.prototype.toString;function a(t){return"[object Object]"===i.call(t)}function c(t){const e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function l(t){return n(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function u(t){return null==t?"":Array.isArray(t)||a(t)&&t.toString===i?JSON.stringify(t,null,2):String(t)}function f(t){const e=parseFloat(t);return isNaN(e)?t:e}function d(t,e){const n=Object.create(null),o=t.split(",");for(let t=0;tn[t.toLowerCase()]:t=>n[t]}const p=d("slot,component",!0),h=d("key,ref,slot,slot-scope,is");function m(t,e){if(t.length){const n=t.indexOf(e);if(n>-1)return t.splice(n,1)}}const g=Object.prototype.hasOwnProperty;function y(t,e){return g.call(t,e)}function v(t){const e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}const $=/-(\w)/g,_=v(t=>t.replace($,(t,e)=>e?e.toUpperCase():"")),b=v(t=>t.charAt(0).toUpperCase()+t.slice(1)),w=/\B([A-Z])/g,C=v(t=>t.replace(w,"-$1").toLowerCase());const x=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){const o=arguments.length;return o?o>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function A(t,e){e=e||0;let n=t.length-e;const o=new Array(n);for(;n--;)o[n]=t[n+e];return o}function k(t,e){for(const n in e)t[n]=e[n];return t}function O(t){const e={};for(let n=0;n!1,E=t=>t;function N(t,e){if(t===e)return!0;const n=s(t),o=s(e);if(!n||!o)return!n&&!o&&String(t)===String(e);try{const n=Array.isArray(t),o=Array.isArray(e);if(n&&o)return t.length===e.length&&t.every((t,n)=>N(t,e[n]));if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(n||o)return!1;{const n=Object.keys(t),o=Object.keys(e);return n.length===o.length&&n.every(n=>N(t[n],e[n]))}}catch(t){return!1}}function j(t,e){for(let n=0;n0,W=K&&K.indexOf("edge/")>0,Z=(K&&K.indexOf("android"),K&&/iphone|ipad|ipod|ios/.test(K)||"ios"===V),G=(K&&/chrome\/\d+/.test(K),K&&/phantomjs/.test(K),{}.watch);let X,Y=!1;if(U)try{const t={};Object.defineProperty(t,"passive",{get(){Y=!0}}),window.addEventListener("test-passive",null,t)}catch(t){}const Q=()=>(void 0===X&&(X=!U&&!z&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),X),tt=U&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function et(t){return"function"==typeof t&&/native code/.test(t.toString())}const nt="undefined"!=typeof Symbol&&et(Symbol)&&"undefined"!=typeof Reflect&&et(Reflect.ownKeys);let ot;ot="undefined"!=typeof Set&&et(Set)?Set:class{constructor(){this.set=Object.create(null)}has(t){return!0===this.set[t]}add(t){this.set[t]=!0}clear(){this.set=Object.create(null)}};let rt=S,st=0;class it{constructor(){this.id=st++,this.subs=[]}addSub(t){this.subs.push(t)}removeSub(t){m(this.subs,t)}depend(){it.target&&it.target.addDep(this)}notify(){const t=this.subs.slice();for(let e=0,n=t.length;e{const e=new ut;return e.text=t,e.isComment=!0,e};function dt(t){return new ut(void 0,void 0,void 0,String(t))}function pt(t){const e=new ut(t.tag,t.data,t.children&&t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);return e.ns=t.ns,e.isStatic=t.isStatic,e.key=t.key,e.isComment=t.isComment,e.fnContext=t.fnContext,e.fnOptions=t.fnOptions,e.fnScopeId=t.fnScopeId,e.asyncMeta=t.asyncMeta,e.isCloned=!0,e}const ht=Array.prototype,mt=Object.create(ht);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(t){const e=ht[t];F(mt,t,function(...n){const o=e.apply(this,n),r=this.__ob__;let s;switch(t){case"push":case"unshift":s=n;break;case"splice":s=n.slice(2)}return s&&r.observeArray(s),r.dep.notify(),o})});const gt=Object.getOwnPropertyNames(mt);let yt=!0;function vt(t){yt=t}class $t{constructor(t){var e;this.value=t,this.dep=new it,this.vmCount=0,F(t,"__ob__",this),Array.isArray(t)?(B?(e=mt,t.__proto__=e):function(t,e,n){for(let o=0,r=n.length;o{xt[t]=Ot}),I.forEach(function(t){xt[t+"s"]=St}),xt.watch=function(t,e,n,o){if(t===G&&(t=void 0),e===G&&(e=void 0),!e)return Object.create(t||null);if(!t)return e;const r={};k(r,t);for(const t in e){let n=r[t];const o=e[t];n&&!Array.isArray(n)&&(n=[n]),r[t]=n?n.concat(o):Array.isArray(o)?o:[o]}return r},xt.props=xt.methods=xt.inject=xt.computed=function(t,e,n,o){if(!t)return e;const r=Object.create(null);return k(r,t),e&&k(r,e),r},xt.provide=kt;const Tt=function(t,e){return void 0===e?t:e};function Et(t,e,n){if("function"==typeof e&&(e=e.options),function(t,e){const n=t.props;if(!n)return;const o={};let r,s,i;if(Array.isArray(n))for(r=n.length;r--;)"string"==typeof(s=n[r])&&(o[i=_(s)]={type:null});else if(a(n))for(const t in n)s=n[t],o[i=_(t)]=a(s)?s:{type:s};t.props=o}(e),function(t,e){const n=t.inject;if(!n)return;const o=t.inject={};if(Array.isArray(n))for(let t=0;t-1)if(s&&!y(r,"default"))i=!1;else if(""===i||i===C(t)){const t=It(String,r.type);(t<0||aDt(t,o,r+" (Promise/async)"))}catch(t){Dt(t,o,r)}return s}function Rt(t,e,n){if(P.errorHandler)try{return P.errorHandler.call(null,t,e,n)}catch(t){Ft(t,null,"config.errorHandler")}Ft(t,e,n)}function Ft(t,e,n){if(!U&&!z||"undefined"==typeof console)throw t;console.error(t)}let Ht=!1;const Bt=[];let Ut,zt=!1;function Vt(){zt=!1;const t=Bt.slice(0);Bt.length=0;for(let e=0;e{t.then(Vt),Z&&setTimeout(S)}),Ht=!0}else if(J||"undefined"==typeof MutationObserver||!et(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())Ut="undefined"!=typeof setImmediate&&et(setImmediate)?()=>{setImmediate(Vt)}:()=>{setTimeout(Vt,0)};else{let t=1;const e=new MutationObserver(Vt),n=document.createTextNode(String(t));e.observe(n,{characterData:!0}),Ut=(()=>{t=(t+1)%2,n.data=String(t)}),Ht=!0}function Kt(t,e){let n;if(Bt.push(()=>{if(t)try{t.call(e)}catch(t){Dt(t,e,"nextTick")}else n&&n(e)}),zt||(zt=!0,Ut()),!t&&"undefined"!=typeof Promise)return new Promise(t=>{n=t})}const Jt=new ot;function qt(t){!function t(e,n){let o,r;const i=Array.isArray(e);if(!i&&!s(e)||Object.isFrozen(e)||e instanceof ut)return;if(e.__ob__){const t=e.__ob__.dep.id;if(n.has(t))return;n.add(t)}if(i)for(o=e.length;o--;)t(e[o],n);else for(r=Object.keys(e),o=r.length;o--;)t(e[r[o]],n)}(t,Jt),Jt.clear()}const Wt=v(t=>{const e="&"===t.charAt(0),n="~"===(t=e?t.slice(1):t).charAt(0),o="!"===(t=n?t.slice(1):t).charAt(0);return{name:t=o?t.slice(1):t,once:n,capture:o,passive:e}});function Zt(t,e){function n(){const t=n.fns;if(!Array.isArray(t))return Pt(t,null,arguments,e,"v-on handler");{const n=t.slice();for(let t=0;t0&&(te((l=t(l,`${i||""}_${c}`))[0])&&te(f)&&(a[u]=dt(f.text+l[0].text),l.shift()),a.push.apply(a,l)):r(l)?te(f)?a[u]=dt(f.text+l):""!==l&&a.push(dt(l)):te(l)&&te(f)?a[u]=dt(f.text+l.text):(o(s._isVList)&&n(l.tag)&&e(l.key)&&n(i)&&(l.key=`__vlist${i}_${c}__`),a.push(l)));return a}(t):void 0}function te(t){return n(t)&&n(t.text)&&!1===t.isComment}function ee(t,e){return(t.__esModule||nt&&"Module"===t[Symbol.toStringTag])&&(t=t.default),s(t)?e.extend(t):t}function ne(t){return t.isComment&&t.asyncFactory}function oe(t){if(Array.isArray(t))for(let e=0;e{de=e}}function he(t){for(;t&&(t=t.$parent);)if(t._inactive)return!0;return!1}function me(t,e){if(e){if(t._directInactive=!1,he(t))return}else if(t._directInactive)return;if(t._inactive||null===t._inactive){t._inactive=!1;for(let e=0;et.id-e.id),we=0;wedocument.createEvent("Event").timeStamp&&(xe=(()=>performance.now()));let ke=0;class Oe{constructor(t,e,n,o,r){this.vm=t,r&&(t._watcher=this),t._watchers.push(this),o?(this.deep=!!o.deep,this.user=!!o.user,this.lazy=!!o.lazy,this.sync=!!o.sync,this.before=o.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++ke,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new ot,this.newDepIds=new ot,this.expression="","function"==typeof e?this.getter=e:(this.getter=function(t){if(H.test(t))return;const e=t.split(".");return function(t){for(let n=0;nwe&&ye[e].id>t.id;)e--;ye.splice(e+1,0,t)}else ye.push(t);_e||(_e=!0,Kt(Ae))}}(this)}run(){if(this.active){const t=this.get();if(t!==this.value||s(t)||this.deep){const e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){Dt(t,this.vm,`callback for watcher "${this.expression}"`)}else this.cb.call(this.vm,t,e)}}}evaluate(){this.value=this.get(),this.dirty=!1}depend(){let t=this.deps.length;for(;t--;)this.deps[t].depend()}teardown(){if(this.active){this.vm._isBeingDestroyed||m(this.vm._watchers,this);let t=this.deps.length;for(;t--;)this.deps[t].removeSub(this);this.active=!1}}}const Se={enumerable:!0,configurable:!0,get:S,set:S};function Te(t,e,n){Se.get=function(){return this[e][n]},Se.set=function(t){this[e][n]=t},Object.defineProperty(t,n,Se)}function Ee(t){t._watchers=[];const e=t.$options;e.props&&function(t,e){const n=t.$options.propsData||{},o=t._props={},r=t.$options._propKeys=[];t.$parent&&vt(!1);for(const s in e){r.push(s);const i=jt(s,e,n,t);bt(o,s,i),s in t||Te(t,"_props",s)}vt(!0)}(t,e.props),e.methods&&function(t,e){t.$options.props;for(const n in e)t[n]="function"!=typeof e[n]?S:x(e[n],t)}(t,e.methods),e.data?function(t){let e=t.$options.data;a(e=t._data="function"==typeof e?function(t,e){ct();try{return t.call(e,e)}catch(t){return Dt(t,e,"data()"),{}}finally{lt()}}(e,t):e||{})||(e={});const n=Object.keys(e),o=t.$options.props;t.$options.methods;let r=n.length;for(;r--;){const e=n[r];o&&y(o,e)||R(e)||Te(t,"_data",e)}_t(e,!0)}(t):_t(t._data={},!0),e.computed&&function(t,e){const n=t._computedWatchers=Object.create(null),o=Q();for(const r in e){const s=e[r],i="function"==typeof s?s:s.get;o||(n[r]=new Oe(t,i||S,S,Ne)),r in t||je(t,r,s)}}(t,e.computed),e.watch&&e.watch!==G&&function(t,e){for(const n in e){const o=e[n];if(Array.isArray(o))for(let e=0;e{const e=n(t);return e&&"object"==typeof e&&!Array.isArray(e)?[e]:Qt(e)};return y(t,e)||Object.defineProperty(t,e,{get:o}),o}function Fe(t,e){return()=>t[e]}function He(t,e){let o,r,i,a,c;if(Array.isArray(t)||"string"==typeof t)for(o=new Array(t.length),r=0,i=t.length;rle(r,s)),Object.defineProperty(this,"scopedSlots",{enumerable:!0,get(){return Pe(e.scopedSlots,this.slots())}}),l&&(this.$options=a,this.$slots=this.slots(),this.$scopedSlots=Pe(e.scopedSlots,this.$slots)),a._scopeId?this._c=((t,e,n,o)=>{const r=un(c,t,e,n,o,u);return r&&!Array.isArray(r)&&(r.fnScopeId=a._scopeId,r.fnContext=s),r}):this._c=((t,e,n,o)=>un(c,t,e,n,o,u))}function en(t,e,n,o,r){const s=pt(t);return s.fnContext=n,s.fnOptions=o,e.slot&&((s.data||(s.data={})).slot=e.slot),s}function nn(t,e){for(const n in e)t[_(n)]=e[n]}Qe(tn.prototype);const on={init(t,e){if(t.componentInstance&&!t.componentInstance._isDestroyed&&t.data.keepAlive){const e=t;on.prepatch(e,e)}else{(t.componentInstance=function(t,e){const o={_isComponent:!0,_parentVnode:t,parent:e},r=t.data.inlineTemplate;n(r)&&(o.render=r.render,o.staticRenderFns=r.staticRenderFns);return new t.componentOptions.Ctor(o)}(t,de)).$mount(e?t.elm:void 0,e)}},prepatch(e,n){const o=n.componentOptions;!function(e,n,o,r,s){const i=!!(r.data.scopedSlots&&!r.data.scopedSlots.$stable||e.$scopedSlots!==t&&!e.$scopedSlots.$stable),a=!!(s||e.$options._renderChildren||i);if(e.$options._parentVnode=r,e.$vnode=r,e._vnode&&(e._vnode.parent=r),e.$options._renderChildren=s,e.$attrs=r.data.attrs||t,e.$listeners=o||t,n&&e.$options.props){vt(!1);const t=e._props,o=e.$options._propKeys||[];for(let r=0;r{for(let t=0,e=o.length;t{t.resolved=ee(e,r),a?o.length=0:c(!0)}),f=L(e=>{n(t.errorComp)&&(t.error=!0,c(!0))}),d=t(u,f);return s(d)&&(l(d)?e(t.resolved)&&d.then(u,f):l(d.component)&&(d.component.then(u,f),n(d.error)&&(t.errorComp=ee(d.error,r)),n(d.loading)&&(t.loadingComp=ee(d.loading,r),0===d.delay?t.loading=!0:setTimeout(()=>{e(t.resolved)&&e(t.error)&&(t.loading=!0,c(!1))},d.delay||200)),n(d.timeout)&&setTimeout(()=>{e(t.resolved)&&f(null)},d.timeout))),a=!1,t.loading?t.loadingComp:t.resolved}t.contexts.push(i)}(d=r,f,a)))return function(t,e,n,o,r){const s=ft();return s.asyncFactory=t,s.asyncMeta={data:e,context:n,children:o,tag:r},s}(d,i,a,c,u);i=i||{},dn(r),n(i.model)&&function(t,e){const o=t.model&&t.model.prop||"value",r=t.model&&t.model.event||"input";(e.attrs||(e.attrs={}))[o]=e.model.value;const s=e.on||(e.on={}),i=s[r],a=e.model.callback;n(i)?(Array.isArray(i)?-1===i.indexOf(a):i!==a)&&(s[r]=[a].concat(i)):s[r]=a}(r.options,i);const p=function(t,o,r){const s=o.options.props;if(e(s))return;const i={},{attrs:a,props:c}=t;if(n(a)||n(c))for(const t in s){const e=C(t);Yt(i,c,t,e,!0)||Yt(i,a,t,e,!1)}return i}(i,r);if(o(r.options.functional))return function(e,o,r,s,i){const a=e.options,c={},l=a.props;if(n(l))for(const e in l)c[e]=jt(e,l,o||t);else n(r.attrs)&&nn(c,r.attrs),n(r.props)&&nn(c,r.props);const u=new tn(r,c,i,s,e),f=a.render.call(null,u._c,u);if(f instanceof ut)return en(f,r,u.parent,a);if(Array.isArray(f)){const t=Qt(f)||[],e=new Array(t.length);for(let n=0;n{t(n,o),e(n,o)};return n._merged=!0,n}const cn=1,ln=2;function un(t,i,a,c,l,u){return(Array.isArray(a)||r(a))&&(l=c,c=a,a=void 0),o(u)&&(l=ln),function(t,r,i,a,c){if(n(i)&&n(i.__ob__))return ft();n(i)&&n(i.is)&&(r=i.is);if(!r)return ft();Array.isArray(a)&&"function"==typeof a[0]&&((i=i||{}).scopedSlots={default:a[0]},a.length=0);c===ln?a=Qt(a):c===cn&&(a=function(t){for(let e=0;e-1:"string"==typeof t?t.split(",").indexOf(e)>-1:(n=t,"[object RegExp]"===i.call(n)&&t.test(e));var n}function yn(t,e){const{cache:n,keys:o,_vnode:r}=t;for(const t in n){const s=n[t];if(s){const i=mn(s.componentOptions);i&&!e(i)&&vn(n,t,o,r)}}}function vn(t,e,n,o){const r=t[e];!r||o&&r.tag===o.tag||r.componentInstance.$destroy(),t[e]=null,m(n,e)}!function(e){e.prototype._init=function(e){const n=this;n._uid=fn++,n._isVue=!0,e&&e._isComponent?function(t,e){const n=t.$options=Object.create(t.constructor.options),o=e._parentVnode;n.parent=e.parent,n._parentVnode=o;const r=o.componentOptions;n.propsData=r.propsData,n._parentListeners=r.listeners,n._renderChildren=r.children,n._componentTag=r.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(n,e):n.$options=Et(dn(n.constructor),e||{},n),n._renderProxy=n,n._self=n,function(t){const e=t.$options;let n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(n),function(t){t._events=Object.create(null),t._hasHookEvent=!1;const e=t.$options._parentListeners;e&&ce(t,e)}(n),function(e){e._vnode=null,e._staticTrees=null;const n=e.$options,o=e.$vnode=n._parentVnode,r=o&&o.context;e.$slots=le(n._renderChildren,r),e.$scopedSlots=t,e._c=((t,n,o,r)=>un(e,t,n,o,r,!1)),e.$createElement=((t,n,o,r)=>un(e,t,n,o,r,!0));const s=o&&o.data;bt(e,"$attrs",s&&s.attrs||t,null,!0),bt(e,"$listeners",n._parentListeners||t,null,!0)}(n),ge(n,"beforeCreate"),function(t){const e=De(t.$options.inject,t);e&&(vt(!1),Object.keys(e).forEach(n=>{bt(t,n,e[n])}),vt(!0))}(n),Ee(n),function(t){const e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(n),ge(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(pn),function(t){const e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=wt,t.prototype.$delete=Ct,t.prototype.$watch=function(t,e,n){const o=this;if(a(e))return Ie(o,t,e,n);(n=n||{}).user=!0;const r=new Oe(o,t,e,n);if(n.immediate)try{e.call(o,r.value)}catch(t){Dt(t,o,`callback for immediate watcher "${r.expression}"`)}return function(){r.teardown()}}}(pn),function(t){const e=/^hook:/;t.prototype.$on=function(t,n){const o=this;if(Array.isArray(t))for(let e=0,r=t.length;e1?A(n):n;const o=A(arguments,1),r=`event handler for "${t}"`;for(let t=0,s=n.length;t{yn(this,e=>gn(t,e))}),this.$watch("exclude",t=>{yn(this,e=>!gn(t,e))})},render(){const t=this.$slots.default,e=oe(t),n=e&&e.componentOptions;if(n){const t=mn(n),{include:o,exclude:r}=this;if(o&&(!t||!gn(o,t))||r&&t&&gn(r,t))return e;const{cache:s,keys:i}=this,a=null==e.key?n.Ctor.cid+(n.tag?`::${n.tag}`:""):e.key;s[a]?(e.componentInstance=s[a].componentInstance,m(i,a),i.push(a)):(s[a]=e,i.push(a),this.max&&i.length>parseInt(this.max)&&vn(s,i[0],i,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){const e={get:()=>P};Object.defineProperty(t,"config",e),t.util={warn:rt,extend:k,mergeOptions:Et,defineReactive:bt},t.set=wt,t.delete=Ct,t.nextTick=Kt,t.observable=(t=>(_t(t),t)),t.options=Object.create(null),I.forEach(e=>{t.options[e+"s"]=Object.create(null)}),t.options._base=t,k(t.options.components,_n),function(t){t.use=function(t){const e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;const n=A(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=Et(this.options,t),this}}(t),hn(t),function(t){I.forEach(e=>{t[e]=function(t,n){return n?("component"===e&&a(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}(t)}(pn),Object.defineProperty(pn.prototype,"$isServer",{get:Q}),Object.defineProperty(pn.prototype,"$ssrContext",{get(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(pn,"FunctionalRenderContext",{value:tn}),pn.version="2.6.2";const bn=d("style,class"),wn=d("input,textarea,option,select,progress"),Cn=(t,e,n)=>"value"===n&&wn(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t,xn=d("contenteditable,draggable,spellcheck"),An=d("events,caret,typing,plaintext-only"),kn=(t,e)=>Nn(e)||"false"===e?"false":"contenteditable"===t&&An(e)?e:"true",On=d("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Sn="http://www.w3.org/1999/xlink",Tn=t=>":"===t.charAt(5)&&"xlink"===t.slice(0,5),En=t=>Tn(t)?t.slice(6,t.length):"",Nn=t=>null==t||!1===t;function jn(t){let e=t.data,o=t,r=t;for(;n(r.componentInstance);)(r=r.componentInstance._vnode)&&r.data&&(e=Ln(r.data,e));for(;n(o=o.parent);)o&&o.data&&(e=Ln(e,o.data));return function(t,e){if(n(t)||n(e))return Mn(t,In(e));return""}(e.staticClass,e.class)}function Ln(t,e){return{staticClass:Mn(t.staticClass,e.staticClass),class:n(t.class)?[t.class,e.class]:e.class}}function Mn(t,e){return t?e?t+" "+e:t:e||""}function In(t){return Array.isArray(t)?function(t){let e,o="";for(let r=0,s=t.length;rPn(t)||Rn(t);function Hn(t){return Rn(t)?"svg":"math"===t?"math":void 0}const Bn=Object.create(null);const Un=d("text,number,password,search,email,tel,url");function zn(t){if("string"==typeof t){const e=document.querySelector(t);return e||document.createElement("div")}return t}var Vn=Object.freeze({createElement:function(t,e){const n=document.createElement(t);return"select"!==t?n:(e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)},createElementNS:function(t,e){return document.createElementNS(Dn[t],e)},createTextNode:function(t){return document.createTextNode(t)},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){t.appendChild(e)},parentNode:function(t){return t.parentNode},nextSibling:function(t){return t.nextSibling},tagName:function(t){return t.tagName},setTextContent:function(t,e){t.textContent=e},setStyleScope:function(t,e){t.setAttribute(e,"")}}),Kn={create(t,e){Jn(e)},update(t,e){t.data.ref!==e.data.ref&&(Jn(t,!0),Jn(e))},destroy(t){Jn(t,!0)}};function Jn(t,e){const o=t.data.ref;if(!n(o))return;const r=t.context,s=t.componentInstance||t.elm,i=r.$refs;e?Array.isArray(i[o])?m(i[o],s):i[o]===s&&(i[o]=void 0):t.data.refInFor?Array.isArray(i[o])?i[o].indexOf(s)<0&&i[o].push(s):i[o]=[s]:i[o]=s}const qn=new ut("",{},[]),Wn=["create","activate","update","remove","destroy"];function Zn(t,r){return t.key===r.key&&(t.tag===r.tag&&t.isComment===r.isComment&&n(t.data)===n(r.data)&&function(t,e){if("input"!==t.tag)return!0;let o;const r=n(o=t.data)&&n(o=o.attrs)&&o.type,s=n(o=e.data)&&n(o=o.attrs)&&o.type;return r===s||Un(r)&&Un(s)}(t,r)||o(t.isAsyncPlaceholder)&&t.asyncFactory===r.asyncFactory&&e(r.asyncFactory.error))}function Gn(t,e,o){let r,s;const i={};for(r=e;r<=o;++r)n(s=t[r].key)&&(i[s]=r);return i}var Xn={create:Yn,update:Yn,destroy:function(t){Yn(t,qn)}};function Yn(t,e){(t.data.directives||e.data.directives)&&function(t,e){const n=t===qn,o=e===qn,r=to(t.data.directives,t.context),s=to(e.data.directives,e.context),i=[],a=[];let c,l,u;for(c in s)l=r[c],u=s[c],l?(u.oldValue=l.value,u.oldArg=l.arg,no(u,"update",e,t),u.def&&u.def.componentUpdated&&a.push(u)):(no(u,"bind",e,t),u.def&&u.def.inserted&&i.push(u));if(i.length){const o=()=>{for(let n=0;n{for(let n=0;n-1?io(t,e,n):On(e)?Nn(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):xn(e)?t.setAttribute(e,kn(e,n)):Tn(e)?Nn(n)?t.removeAttributeNS(Sn,En(e)):t.setAttributeNS(Sn,e,n):io(t,e,n)}function io(t,e,n){if(Nn(n))t.removeAttribute(e);else{if(J&&!q&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){const e=n=>{n.stopImmediatePropagation(),t.removeEventListener("input",e)};t.addEventListener("input",e),t.__ieph=!0}t.setAttribute(e,n)}}var ao={create:ro,update:ro};function co(t,o){const r=o.elm,s=o.data,i=t.data;if(e(s.staticClass)&&e(s.class)&&(e(i)||e(i.staticClass)&&e(i.class)))return;let a=jn(o);const c=r._transitionClasses;n(c)&&(a=Mn(a,In(c))),a!==r._prevClass&&(r.setAttribute("class",a),r._prevClass=a)}var lo={create:co,update:co};const uo=/[\w).+\-_$\]]/;function fo(t){let e,n,o,r,s,i=!1,a=!1,c=!1,l=!1,u=0,f=0,d=0,p=0;for(o=0;o=0&&" "===(e=t.charAt(n));n--);e&&uo.test(e)||(l=!0)}}else void 0===r?(p=o+1,r=t.slice(0,o).trim()):h();function h(){(s||(s=[])).push(t.slice(p,o).trim()),p=o+1}if(void 0===r?r=t.slice(0,o).trim():0!==p&&h(),s)for(o=0;ot[e]).filter(t=>t):[]}function go(t,e,n,o,r){(t.props||(t.props=[])).push(Ao({name:e,value:n,dynamic:r},o)),t.plain=!1}function yo(t,e,n,o,r){(r?t.dynamicAttrs||(t.dynamicAttrs=[]):t.attrs||(t.attrs=[])).push(Ao({name:e,value:n,dynamic:r},o)),t.plain=!1}function vo(t,e,n,o){t.attrsMap[e]=n,t.attrsList.push(Ao({name:e,value:n},o))}function $o(t,e,n,o,r,s,i,a){(t.directives||(t.directives=[])).push(Ao({name:e,rawName:n,value:o,arg:r,isDynamicArg:s,modifiers:i},a)),t.plain=!1}function _o(t,e,n){return n?`_p(${e},"${t}")`:t+e}function bo(e,n,o,r,s,i,a,c){let l;(r=r||t).right?c?n=`(${n})==='click'?'contextmenu':(${n})`:"click"===n&&(n="contextmenu",delete r.right):r.middle&&(c?n=`(${n})==='click'?'mouseup':(${n})`:"click"===n&&(n="mouseup")),r.capture&&(delete r.capture,n=_o("!",n,c)),r.once&&(delete r.once,n=_o("~",n,c)),r.passive&&(delete r.passive,n=_o("&",n,c)),r.native?(delete r.native,l=e.nativeEvents||(e.nativeEvents={})):l=e.events||(e.events={});const u=Ao({value:o.trim(),dynamic:c},a);r!==t&&(u.modifiers=r);const f=l[n];Array.isArray(f)?s?f.unshift(u):f.push(u):l[n]=f?s?[u,f]:[f,u]:u,e.plain=!1}function wo(t,e,n){const o=Co(t,":"+e)||Co(t,"v-bind:"+e);if(null!=o)return fo(o);if(!1!==n){const n=Co(t,e);if(null!=n)return JSON.stringify(n)}}function Co(t,e,n){let o;if(null!=(o=t.attrsMap[e])){const n=t.attrsList;for(let t=0,o=n.length;t-1?{exp:t.slice(0,No),key:'"'+t.slice(No+1)+'"'}:{exp:t,key:null};To=t,No=jo=Lo=0;for(;!Io();)Do(Eo=Mo())?Ro(Eo):91===Eo&&Po(Eo);return{exp:t.slice(0,jo),key:t.slice(jo+1,Lo)}}(t);return null===n.key?`${t}=${e}`:`$set(${n.exp}, ${n.key}, ${e})`}let So,To,Eo,No,jo,Lo;function Mo(){return To.charCodeAt(++No)}function Io(){return No>=So}function Do(t){return 34===t||39===t}function Po(t){let e=1;for(jo=No;!Io();)if(Do(t=Mo()))Ro(t);else if(91===t&&e++,93===t&&e--,0===e){Lo=No;break}}function Ro(t){const e=t;for(;!Io()&&(t=Mo())!==e;);}const Fo="__r",Ho="__c";let Bo;function Uo(t,e,n){const o=Bo;return function r(){null!==e.apply(null,arguments)&&Vo(t,r,n,o)}}function zo(t,e,n,o){if(Ht){const t=Ce,n=e;e=n._wrapper=function(e){if(e.timeStamp>=t)return n.apply(this,arguments)}}Bo.addEventListener(t,e,Y?{capture:n,passive:o}:n)}function Vo(t,e,n,o){(o||Bo).removeEventListener(t,e._wrapper||e,n)}function Ko(t,o){if(e(t.data.on)&&e(o.data.on))return;const r=o.data.on||{},s=t.data.on||{};Bo=o.elm,function(t){if(n(t[Fo])){const e=J?"change":"input";t[e]=[].concat(t[Fo],t[e]||[]),delete t[Fo]}n(t[Ho])&&(t.change=[].concat(t[Ho],t.change||[]),delete t[Ho])}(r),Gt(r,s,zo,Vo,Uo,o.context),Bo=void 0}var Jo={create:Ko,update:Ko};let qo;function Wo(t,o){if(e(t.data.domProps)&&e(o.data.domProps))return;let r,s;const i=o.elm,a=t.data.domProps||{};let c=o.data.domProps||{};for(r in n(c.__ob__)&&(c=o.data.domProps=k({},c)),a)e(c[r])&&(i[r]="");for(r in c){if(s=c[r],"textContent"===r||"innerHTML"===r){if(o.children&&(o.children.length=0),s===a[r])continue;1===i.childNodes.length&&i.removeChild(i.childNodes[0])}if("value"===r||s!==a[r])if("value"===r){i._value=s;const t=e(s)?"":String(s);Zo(i,t)&&(i.value=t)}else if("innerHTML"===r&&Rn(i.tagName)&&e(i.innerHTML)){(qo=qo||document.createElement("div")).innerHTML=`${s}`;const t=qo.firstChild;for(;i.firstChild;)i.removeChild(i.firstChild);for(;t.firstChild;)i.appendChild(t.firstChild)}else i[r]=s}}function Zo(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){let n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){const o=t.value,r=t._vModifiers;if(n(r)){if(r.number)return f(o)!==f(e);if(r.trim)return o.trim()!==e.trim()}return o!==e}(t,e))}var Go={create:Wo,update:Wo};const Xo=v(function(t){const e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach(function(t){if(t){const o=t.split(n);o.length>1&&(e[o[0].trim()]=o[1].trim())}}),e});function Yo(t){const e=Qo(t.style);return t.staticStyle?k(t.staticStyle,e):e}function Qo(t){return Array.isArray(t)?O(t):"string"==typeof t?Xo(t):t}const tr=/^--/,er=/\s*!important$/,nr=(t,e,n)=>{if(tr.test(e))t.style.setProperty(e,n);else if(er.test(n))t.style.setProperty(C(e),n.replace(er,""),"important");else{const o=sr(e);if(Array.isArray(n))for(let e=0,r=n.length;e-1?e.split(cr).forEach(e=>t.classList.add(e)):t.classList.add(e);else{const n=` ${t.getAttribute("class")||""} `;n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function ur(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(cr).forEach(e=>t.classList.remove(e)):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{let n=` ${t.getAttribute("class")||""} `;const o=" "+e+" ";for(;n.indexOf(o)>=0;)n=n.replace(o," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function fr(t){if(t){if("object"==typeof t){const e={};return!1!==t.css&&k(e,dr(t.name||"v")),k(e,t),e}return"string"==typeof t?dr(t):void 0}}const dr=v(t=>({enterClass:`${t}-enter`,enterToClass:`${t}-enter-to`,enterActiveClass:`${t}-enter-active`,leaveClass:`${t}-leave`,leaveToClass:`${t}-leave-to`,leaveActiveClass:`${t}-leave-active`})),pr=U&&!q,hr="transition",mr="animation";let gr="transition",yr="transitionend",vr="animation",$r="animationend";pr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(gr="WebkitTransition",yr="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(vr="WebkitAnimation",$r="webkitAnimationEnd"));const _r=U?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:t=>t();function br(t){_r(()=>{_r(t)})}function wr(t,e){const n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),lr(t,e))}function Cr(t,e){t._transitionClasses&&m(t._transitionClasses,e),ur(t,e)}function xr(t,e,n){const{type:o,timeout:r,propCount:s}=kr(t,e);if(!o)return n();const i=o===hr?yr:$r;let a=0;const c=()=>{t.removeEventListener(i,l),n()},l=e=>{e.target===t&&++a>=s&&c()};setTimeout(()=>{a0&&(l=hr,u=s,f=r.length):e===mr?c>0&&(l=mr,u=c,f=a.length):f=(l=(u=Math.max(s,c))>0?s>c?hr:mr:null)?l===hr?r.length:a.length:0,{type:l,timeout:u,propCount:f,hasTransform:l===hr&&Ar.test(n[gr+"Property"])}}function Or(t,e){for(;t.lengthSr(e)+Sr(t[n])))}function Sr(t){return 1e3*Number(t.slice(0,-1).replace(",","."))}function Tr(t,o){const r=t.elm;n(r._leaveCb)&&(r._leaveCb.cancelled=!0,r._leaveCb());const i=fr(t.data.transition);if(e(i))return;if(n(r._enterCb)||1!==r.nodeType)return;const{css:a,type:c,enterClass:l,enterToClass:u,enterActiveClass:d,appearClass:p,appearToClass:h,appearActiveClass:m,beforeEnter:g,enter:y,afterEnter:v,enterCancelled:$,beforeAppear:_,appear:b,afterAppear:w,appearCancelled:C,duration:x}=i;let A=de,k=de.$vnode;for(;k&&k.parent;)A=(k=k.parent).context;const O=!A._isMounted||!t.isRootInsert;if(O&&!b&&""!==b)return;const S=O&&p?p:l,T=O&&m?m:d,E=O&&h?h:u,N=O&&_||g,j=O&&"function"==typeof b?b:y,M=O&&w||v,I=O&&C||$,D=f(s(x)?x.enter:x),P=!1!==a&&!q,R=jr(j),F=r._enterCb=L(()=>{P&&(Cr(r,E),Cr(r,T)),F.cancelled?(P&&Cr(r,S),I&&I(r)):M&&M(r),r._enterCb=null});t.data.show||Xt(t,"insert",()=>{const e=r.parentNode,n=e&&e._pending&&e._pending[t.key];n&&n.tag===t.tag&&n.elm._leaveCb&&n.elm._leaveCb(),j&&j(r,F)}),N&&N(r),P&&(wr(r,S),wr(r,T),br(()=>{Cr(r,S),F.cancelled||(wr(r,E),R||(Nr(D)?setTimeout(F,D):xr(r,c,F)))})),t.data.show&&(o&&o(),j&&j(r,F)),P||R||F()}function Er(t,o){const r=t.elm;n(r._enterCb)&&(r._enterCb.cancelled=!0,r._enterCb());const i=fr(t.data.transition);if(e(i)||1!==r.nodeType)return o();if(n(r._leaveCb))return;const{css:a,type:c,leaveClass:l,leaveToClass:u,leaveActiveClass:d,beforeLeave:p,leave:h,afterLeave:m,leaveCancelled:g,delayLeave:y,duration:v}=i,$=!1!==a&&!q,_=jr(h),b=f(s(v)?v.leave:v),w=r._leaveCb=L(()=>{r.parentNode&&r.parentNode._pending&&(r.parentNode._pending[t.key]=null),$&&(Cr(r,u),Cr(r,d)),w.cancelled?($&&Cr(r,l),g&&g(r)):(o(),m&&m(r)),r._leaveCb=null});function C(){w.cancelled||(!t.data.show&&r.parentNode&&((r.parentNode._pending||(r.parentNode._pending={}))[t.key]=t),p&&p(r),$&&(wr(r,l),wr(r,d),br(()=>{Cr(r,l),w.cancelled||(wr(r,u),_||(Nr(b)?setTimeout(w,b):xr(r,c,w)))})),h&&h(r,w),$||_||w())}y?y(C):C()}function Nr(t){return"number"==typeof t&&!isNaN(t)}function jr(t){if(e(t))return!1;const o=t.fns;return n(o)?jr(Array.isArray(o)?o[0]:o):(t._length||t.length)>1}function Lr(t,e){!0!==e.data.show&&Tr(e)}const Mr=function(t){let s,i;const a={},{modules:c,nodeOps:l}=t;for(s=0;sm?$(t,d=e(r[v+1])?null:r[v+1].elm,r,h,v,s):h>v&&b(0,o,p,m)}(d,m,y,s,u):n(y)?(n(t.text)&&l.setTextContent(d,""),$(d,null,y,0,y.length-1,s)):n(m)?b(0,m,0,m.length-1):n(t.text)&&l.setTextContent(d,""):t.text!==r.text&&l.setTextContent(d,r.text),n(h)&&n(p=h.hook)&&n(p=p.postpatch)&&p(t,r)}function A(t,e,r){if(o(r)&&n(t.parent))t.parent.data.pendingInsert=e;else for(let t=0;t{const t=document.activeElement;t&&t.vmodel&&Ur(t,"input")});const Ir={inserted(t,e,n,o){"select"===n.tag?(o.elm&&!o.elm._vOptions?Xt(n,"postpatch",()=>{Ir.componentUpdated(t,e,n)}):Dr(t,e,n.context),t._vOptions=[].map.call(t.options,Fr)):("textarea"===n.tag||Un(t.type))&&(t._vModifiers=e.modifiers,e.modifiers.lazy||(t.addEventListener("compositionstart",Hr),t.addEventListener("compositionend",Br),t.addEventListener("change",Br),q&&(t.vmodel=!0)))},componentUpdated(t,e,n){if("select"===n.tag){Dr(t,e,n.context);const o=t._vOptions,r=t._vOptions=[].map.call(t.options,Fr);if(r.some((t,e)=>!N(t,o[e]))){(t.multiple?e.value.some(t=>Rr(t,r)):e.value!==e.oldValue&&Rr(e.value,r))&&Ur(t,"change")}}}};function Dr(t,e,n){Pr(t,e,n),(J||W)&&setTimeout(()=>{Pr(t,e,n)},0)}function Pr(t,e,n){const o=e.value,r=t.multiple;if(r&&!Array.isArray(o))return;let s,i;for(let e=0,n=t.options.length;e-1,i.selected!==s&&(i.selected=s);else if(N(Fr(i),o))return void(t.selectedIndex!==e&&(t.selectedIndex=e));r||(t.selectedIndex=-1)}function Rr(t,e){return e.every(e=>!N(e,t))}function Fr(t){return"_value"in t?t._value:t.value}function Hr(t){t.target.composing=!0}function Br(t){t.target.composing&&(t.target.composing=!1,Ur(t.target,"input"))}function Ur(t,e){const n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function zr(t){return!t.componentInstance||t.data&&t.data.transition?t:zr(t.componentInstance._vnode)}var Vr={model:Ir,show:{bind(t,{value:e},n){const o=(n=zr(n)).data&&n.data.transition,r=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;e&&o?(n.data.show=!0,Tr(n,()=>{t.style.display=r})):t.style.display=e?r:"none"},update(t,{value:e,oldValue:n},o){if(!e==!n)return;(o=zr(o)).data&&o.data.transition?(o.data.show=!0,e?Tr(o,()=>{t.style.display=t.__vOriginalDisplay}):Er(o,()=>{t.style.display="none"})):t.style.display=e?t.__vOriginalDisplay:"none"},unbind(t,e,n,o,r){r||(t.style.display=t.__vOriginalDisplay)}}};const Kr={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Jr(t){const e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?Jr(oe(e.children)):t}function qr(t){const e={},n=t.$options;for(const o in n.propsData)e[o]=t[o];const o=n._parentListeners;for(const t in o)e[_(t)]=o[t];return e}function Wr(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}const Zr=t=>t.tag||ne(t),Gr=t=>"show"===t.name;var Xr={name:"transition",props:Kr,abstract:!0,render(t){let e=this.$slots.default;if(!e)return;if(!(e=e.filter(Zr)).length)return;const n=this.mode,o=e[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return o;const s=Jr(o);if(!s)return o;if(this._leaving)return Wr(t,o);const i=`__transition-${this._uid}-`;s.key=null==s.key?s.isComment?i+"comment":i+s.tag:r(s.key)?0===String(s.key).indexOf(i)?s.key:i+s.key:s.key;const a=(s.data||(s.data={})).transition=qr(this),c=this._vnode,l=Jr(c);if(s.data.directives&&s.data.directives.some(Gr)&&(s.data.show=!0),l&&l.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(s,l)&&!ne(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){const e=l.data.transition=k({},a);if("out-in"===n)return this._leaving=!0,Xt(e,"afterLeave",()=>{this._leaving=!1,this.$forceUpdate()}),Wr(t,o);if("in-out"===n){if(ne(s))return c;let t;const n=()=>{t()};Xt(a,"afterEnter",n),Xt(a,"enterCancelled",n),Xt(e,"delayLeave",e=>{t=e})}}return o}};const Yr=k({tag:String,moveClass:String},Kr);function Qr(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function ts(t){t.data.newPos=t.elm.getBoundingClientRect()}function es(t){const e=t.data.pos,n=t.data.newPos,o=e.left-n.left,r=e.top-n.top;if(o||r){t.data.moved=!0;const e=t.elm.style;e.transform=e.WebkitTransform=`translate(${o}px,${r}px)`,e.transitionDuration="0s"}}delete Yr.mode;var ns={Transition:Xr,TransitionGroup:{props:Yr,beforeMount(){const t=this._update;this._update=((e,n)=>{const o=pe(this);this.__patch__(this._vnode,this.kept,!1,!0),this._vnode=this.kept,o(),t.call(this,e,n)})},render(t){const e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),o=this.prevChildren=this.children,r=this.$slots.default||[],s=this.children=[],i=qr(this);for(let t=0;t{if(t.data.moved){const n=t.elm,o=n.style;wr(n,e),o.transform=o.WebkitTransform=o.transitionDuration="",n.addEventListener(yr,n._moveCb=function t(o){o&&o.target!==n||o&&!/transform$/.test(o.propertyName)||(n.removeEventListener(yr,t),n._moveCb=null,Cr(n,e))})}}))},methods:{hasMove(t,e){if(!pr)return!1;if(this._hasMove)return this._hasMove;const n=t.cloneNode();t._transitionClasses&&t._transitionClasses.forEach(t=>{ur(n,t)}),lr(n,e),n.style.display="none",this.$el.appendChild(n);const o=kr(n);return this.$el.removeChild(n),this._hasMove=o.hasTransform}}}};pn.config.mustUseProp=Cn,pn.config.isReservedTag=Fn,pn.config.isReservedAttr=bn,pn.config.getTagNamespace=Hn,pn.config.isUnknownElement=function(t){if(!U)return!0;if(Fn(t))return!1;if(t=t.toLowerCase(),null!=Bn[t])return Bn[t];const e=document.createElement(t);return t.indexOf("-")>-1?Bn[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Bn[t]=/HTMLUnknownElement/.test(e.toString())},k(pn.options.directives,Vr),k(pn.options.components,ns),pn.prototype.__patch__=U?Mr:S,pn.prototype.$mount=function(t,e){return function(t,e,n){let o;return t.$el=e,t.$options.render||(t.$options.render=ft),ge(t,"beforeMount"),o=(()=>{t._update(t._render(),n)}),new Oe(t,o,S,{before(){t._isMounted&&!t._isDestroyed&&ge(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,ge(t,"mounted")),t}(this,t=t&&U?zn(t):void 0,e)},U&&setTimeout(()=>{P.devtools&&tt&&tt.emit("init",pn)},0);const os=/\{\{((?:.|\r?\n)+?)\}\}/g,rs=/[-.*+?^${}()|[\]\/\\]/g,ss=v(t=>{const e=t[0].replace(rs,"\\$&"),n=t[1].replace(rs,"\\$&");return new RegExp(e+"((?:.|\\n)+?)"+n,"g")});var is={staticKeys:["staticClass"],transformNode:function(t,e){e.warn;const n=Co(t,"class");n&&(t.staticClass=JSON.stringify(n));const o=wo(t,"class",!1);o&&(t.classBinding=o)},genData:function(t){let e="";return t.staticClass&&(e+=`staticClass:${t.staticClass},`),t.classBinding&&(e+=`class:${t.classBinding},`),e}};var as={staticKeys:["staticStyle"],transformNode:function(t,e){e.warn;const n=Co(t,"style");n&&(t.staticStyle=JSON.stringify(Xo(n)));const o=wo(t,"style",!1);o&&(t.styleBinding=o)},genData:function(t){let e="";return t.staticStyle&&(e+=`staticStyle:${t.staticStyle},`),t.styleBinding&&(e+=`style:(${t.styleBinding}),`),e}};let cs;var ls={decode:t=>((cs=cs||document.createElement("div")).innerHTML=t,cs.textContent)};const us=d("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),fs=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),ds=d("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),ps=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,hs=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,ms="[a-zA-Z_][\\-\\.0-9_a-zA-Za-zA-Z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*",gs=`((?:${ms}\\:)?${ms})`,ys=new RegExp(`^<${gs}`),vs=/^\s*(\/?)>/,$s=new RegExp(`^<\\/${gs}[^>]*>`),_s=/^]+>/i,bs=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},ks=/&(?:lt|gt|quot|amp|#39);/g,Os=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Ss=d("pre,textarea",!0),Ts=(t,e)=>t&&Ss(t)&&"\n"===e[0];function Es(t,e){const n=e?Os:ks;return t.replace(n,t=>As[t])}const Ns=/^@|^v-on:/,js=/^v-|^@|^:/,Ls=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Ms=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Is=/^\(|\)$/g,Ds=/^\[.*\]$/,Ps=/:(.*)$/,Rs=/^:|^\.|^v-bind:/,Fs=/\.[^.]+/g,Hs=/^v-slot(:|$)|^#/,Bs=/[\r\n]/,Us=/\s+/g,zs=v(ls.decode);let Vs,Ks,Js,qs,Ws,Zs,Gs,Xs;function Ys(t,e,n){return{type:1,tag:t,attrsList:e,attrsMap:si(e),rawAttrsMap:{},parent:n,children:[]}}function Qs(t,e){Vs=e.warn||ho,Zs=e.isPreTag||T,Gs=e.mustUseProp||T,Xs=e.getTagNamespace||T;e.isReservedTag;Js=mo(e.modules,"transformNode"),qs=mo(e.modules,"preTransformNode"),Ws=mo(e.modules,"postTransformNode"),Ks=e.delimiters;const n=[],o=!1!==e.preserveWhitespace,r=e.whitespace;let s,i,a=!1,c=!1;function l(t){if(u(t),a||t.processed||(t=ti(t,e)),n.length||t===s||s.if&&(t.elseif||t.else)&&ni(s,{exp:t.elseif,block:t}),i&&!t.forbidden)if(t.elseif||t.else)!function(t,e){const n=function(t){let e=t.length;for(;e--;){if(1===t[e].type)return t[e];t.pop()}}(e.children);n&&n.if&&ni(n,{exp:t.elseif,block:t})}(t,i);else{if(t.slotScope){const e=t.slotTarget||'"default"';(i.scopedSlots||(i.scopedSlots={}))[e]=t}i.children.push(t),t.parent=i}t.children=t.children.filter(t=>!t.slotScope),u(t),t.pre&&(a=!1),Zs(t.tag)&&(c=!1);for(let n=0;n]*>)","i")),s=t.replace(r,function(t,r,s){return n=s.length,Cs(o)||"noscript"===o||(r=r.replace(//g,"$1").replace(//g,"$1")),Ts(o,r)&&(r=r.slice(1)),e.chars&&e.chars(r),""});c+=t.length-s.length,t=s,d(o,c-n,c)}else{let n,o,r,s=t.indexOf("<");if(0===s){if(bs.test(t)){const n=t.indexOf("--\x3e");if(n>=0){e.shouldKeepComment&&e.comment(t.substring(4,n),c,c+n+3),l(n+3);continue}}if(ws.test(t)){const e=t.indexOf("]>");if(e>=0){l(e+2);continue}}const n=t.match(_s);if(n){l(n[0].length);continue}const o=t.match($s);if(o){const t=c;l(o[0].length),d(o[1],t,c);continue}const r=u();if(r){f(r),Ts(r.tagName,t)&&l(1);continue}}if(s>=0){for(o=t.slice(s);!($s.test(o)||ys.test(o)||bs.test(o)||ws.test(o)||(r=o.indexOf("<",1))<0);)s+=r,o=t.slice(s);n=t.substring(0,s)}s<0&&(n=t),n&&l(n.length),e.chars&&n&&e.chars(n,c-n.length,c)}if(t===i){e.chars&&e.chars(t);break}}function l(e){c+=e,t=t.substring(e)}function u(){const e=t.match(ys);if(e){const n={tagName:e[1],attrs:[],start:c};let o,r;for(l(e[0].length);!(o=t.match(vs))&&(r=t.match(hs)||t.match(ps));)r.start=c,l(r[0].length),r.end=c,n.attrs.push(r);if(o)return n.unarySlash=o[1],l(o[0].length),n.end=c,n}}function f(t){const i=t.tagName,c=t.unarySlash;o&&("p"===a&&ds(i)&&d(a),s(i)&&a===i&&d(i));const l=r(i)||!!c,u=t.attrs.length,f=new Array(u);for(let n=0;n=0&&n[s].lowerCasedTag!==i;s--);else s=0;if(s>=0){for(let t=n.length-1;t>=s;t--)e.end&&e.end(n[t].tag,o,r);n.length=s,a=s&&n[s-1].tag}else"br"===i?e.start&&e.start(t,[],!0,o,r):"p"===i&&(e.start&&e.start(t,[],!1,o,r),e.end&&e.end(t,o,r))}d()}(t,{warn:Vs,expectHTML:e.expectHTML,isUnaryTag:e.isUnaryTag,canBeLeftOpenTag:e.canBeLeftOpenTag,shouldDecodeNewlines:e.shouldDecodeNewlines,shouldDecodeNewlinesForHref:e.shouldDecodeNewlinesForHref,shouldKeepComment:e.comments,outputSourceRange:e.outputSourceRange,start(t,o,r,u){const f=i&&i.ns||Xs(t);J&&"svg"===f&&(o=function(t){const e=[];for(let n=0;nc&&(r.push(a=t.slice(c,i)),o.push(JSON.stringify(a)));const e=fo(s[1].trim());o.push(`_s(${e})`),r.push({"@binding":e}),c=i+s[0].length}return c!t.slotScope),s.slotScope=e.value||"_",t.children=[],t.plain=!1}}}(t),"slot"===(n=t).tag&&(n.slotName=wo(n,"name")),function(t){let e;(e=wo(t,"is"))&&(t.component=e);null!=Co(t,"inline-template")&&(t.inlineTemplate=!0)}(t);for(let n=0;n{t[e.slice(1)]=!0}),t}}function si(t){const e={};for(let n=0,o=t.length;n-1`+("true"===s?`:(${e})`:`:_q(${e},${s})`)),bo(t,"change",`var $$a=${e},`+"$$el=$event.target,"+`$$c=$$el.checked?(${s}):(${i});`+"if(Array.isArray($$a)){"+`var $$v=${o?"_n("+r+")":r},`+"$$i=_i($$a,$$v);"+`if($$el.checked){$$i<0&&(${Oo(e,"$$a.concat([$$v])")})}`+`else{$$i>-1&&(${Oo(e,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")})}`+`}else{${Oo(e,"$$c")}}`,null,!0)}(t,o,r);else if("input"===s&&"radio"===i)!function(t,e,n){const o=n&&n.number;let r=wo(t,"value")||"null";go(t,"checked",`_q(${e},${r=o?`_n(${r})`:r})`),bo(t,"change",Oo(e,r),null,!0)}(t,o,r);else if("input"===s||"textarea"===s)!function(t,e,n){const o=t.attrsMap.type,{lazy:r,number:s,trim:i}=n||{},a=!r&&"range"!==o,c=r?"change":"range"===o?Fo:"input";let l="$event.target.value";i&&(l="$event.target.value.trim()"),s&&(l=`_n(${l})`);let u=Oo(e,l);a&&(u=`if($event.target.composing)return;${u}`),go(t,"value",`(${e})`),bo(t,c,u,null,!0),(i||s)&&bo(t,"blur","$forceUpdate()")}(t,o,r);else if(!P.isReservedTag(s))return ko(t,o,r),!1;return!0},text:function(t,e){e.value&&go(t,"textContent",`_s(${e.value})`,e)},html:function(t,e){e.value&&go(t,"innerHTML",`_s(${e.value})`,e)}},isPreTag:t=>"pre"===t,isUnaryTag:us,mustUseProp:Cn,canBeLeftOpenTag:fs,isReservedTag:Fn,getTagNamespace:Hn,staticKeys:function(t){return t.reduce((t,e)=>t.concat(e.staticKeys||[]),[]).join(",")}(li)};let fi,di;const pi=v(function(t){return d("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(t?","+t:""))});function hi(t,e){t&&(fi=pi(e.staticKeys||""),di=e.isReservedTag||T,function t(e){e.static=function(t){if(2===t.type)return!1;if(3===t.type)return!0;return!(!t.pre&&(t.hasBindings||t.if||t.for||p(t.tag)||!di(t.tag)||function(t){for(;t.parent;){if("template"!==(t=t.parent).tag)return!1;if(t.for)return!0}return!1}(t)||!Object.keys(t).every(fi)))}(e);if(1===e.type){if(!di(e.tag)&&"slot"!==e.tag&&null==e.attrsMap["inline-template"])return;for(let n=0,o=e.children.length;n|^function\s*\(/,gi=/\([^)]*?\);*$/,yi=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,vi={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},$i={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},_i=t=>`if(${t})return null;`,bi={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:_i("$event.target !== $event.currentTarget"),ctrl:_i("!$event.ctrlKey"),shift:_i("!$event.shiftKey"),alt:_i("!$event.altKey"),meta:_i("!$event.metaKey"),left:_i("'button' in $event && $event.button !== 0"),middle:_i("'button' in $event && $event.button !== 1"),right:_i("'button' in $event && $event.button !== 2")};function wi(t,e){const n=e?"nativeOn:":"on:";let o="",r="";for(const e in t){const n=Ci(t[e]);t[e]&&t[e].dynamic?r+=`${e},${n},`:o+=`"${e}":${n},`}return o=`{${o.slice(0,-1)}}`,r?n+`_d(${o},[${r.slice(0,-1)}])`:n+o}function Ci(t){if(!t)return"function(){}";if(Array.isArray(t))return`[${t.map(t=>Ci(t)).join(",")}]`;const e=yi.test(t.value),n=mi.test(t.value),o=yi.test(t.value.replace(gi,""));if(t.modifiers){let r="",s="";const i=[];for(const e in t.modifiers)if(bi[e])s+=bi[e],vi[e]&&i.push(e);else if("exact"===e){const e=t.modifiers;s+=_i(["ctrl","shift","alt","meta"].filter(t=>!e[t]).map(t=>`$event.${t}Key`).join("||"))}else i.push(e);return i.length&&(r+=function(t){return`if(('keyCode' in $event)&&${t.map(xi).join("&&")})return null;`}(i)),s&&(r+=s),`function($event){${r}${e?`return ${t.value}($event)`:n?`return (${t.value})($event)`:o?`return ${t.value}`:t.value}}`}return e||n?t.value:`function($event){${o?`return ${t.value}`:t.value}}`}function xi(t){const e=parseInt(t,10);if(e)return`$event.keyCode!==${e}`;const n=vi[t],o=$i[t];return"_k($event.keyCode,"+`${JSON.stringify(t)},`+`${JSON.stringify(n)},`+"$event.key,"+`${JSON.stringify(o)}`+")"}var Ai={on:function(t,e){t.wrapListeners=(t=>`_g(${t},${e.value})`)},bind:function(t,e){t.wrapData=(n=>`_b(${n},'${t.tag}',${e.value},${e.modifiers&&e.modifiers.prop?"true":"false"}${e.modifiers&&e.modifiers.sync?",true":""})`)},cloak:S};class ki{constructor(t){this.options=t,this.warn=t.warn||ho,this.transforms=mo(t.modules,"transformCode"),this.dataGenFns=mo(t.modules,"genData"),this.directives=k(k({},Ai),t.directives);const e=t.isReservedTag||T;this.maybeComponent=(t=>!!t.component||!e(t.tag)),this.onceId=0,this.staticRenderFns=[],this.pre=!1}}function Oi(t,e){const n=new ki(e);return{render:`with(this){return ${t?Si(t,n):'_c("div")'}}`,staticRenderFns:n.staticRenderFns}}function Si(t,e){if(t.parent&&(t.pre=t.pre||t.parent.pre),t.staticRoot&&!t.staticProcessed)return Ti(t,e);if(t.once&&!t.onceProcessed)return Ei(t,e);if(t.for&&!t.forProcessed)return ji(t,e);if(t.if&&!t.ifProcessed)return Ni(t,e);if("template"!==t.tag||t.slotTarget||e.pre){if("slot"===t.tag)return function(t,e){const n=t.slotName||'"default"',o=Ii(t,e);let r=`_t(${n}${o?`,${o}`:""}`;const s=t.attrs&&`{${t.attrs.map(t=>`${_(t.name)}:${t.value}`).join(",")}}`,i=t.attrsMap["v-bind"];!s&&!i||o||(r+=",null");s&&(r+=`,${s}`);i&&(r+=`${s?"":",null"},${i}`);return r+")"}(t,e);{let n;if(t.component)n=function(t,e,n){const o=e.inlineTemplate?null:Ii(e,n,!0);return`_c(${t},${Li(e,n)}${o?`,${o}`:""})`}(t.component,t,e);else{let o;(!t.plain||t.pre&&e.maybeComponent(t))&&(o=Li(t,e));const r=t.inlineTemplate?null:Ii(t,e,!0);n=`_c('${t.tag}'${o?`,${o}`:""}${r?`,${r}`:""})`}for(let o=0;o{const n=t[e];return n.slotTargetDynamic||n.if||n.for});return`scopedSlots:_u([${Object.keys(t).map(n=>Mi(t[n],e)).join(",")}]${n?",true":""})`}(t.scopedSlots,e)},`),t.model&&(n+=`model:{value:${t.model.value},callback:${t.model.callback},expression:${t.model.expression}},`),t.inlineTemplate){const o=function(t,e){const n=t.children[0];if(n&&1===n.type){const t=Oi(n,e.options);return`inlineTemplate:{render:function(){${t.render}},staticRenderFns:[${t.staticRenderFns.map(t=>`function(){${t}}`).join(",")}]}`}}(t,e);o&&(n+=`${o},`)}return n=n.replace(/,$/,"")+"}",t.dynamicAttrs&&(n=`_b(${n},"${t.tag}",${Ri(t.dynamicAttrs)})`),t.wrapData&&(n=t.wrapData(n)),t.wrapListeners&&(n=t.wrapListeners(n)),n}function Mi(t,e){const n=t.attrsMap["slot-scope"];if(t.if&&!t.ifProcessed&&!n)return Ni(t,e,Mi,"null");if(t.for&&!t.forProcessed)return ji(t,e,Mi);const o=`function(${String(t.slotScope)}){`+`return ${"template"===t.tag?t.if&&n?`(${t.if})?${Ii(t,e)||"undefined"}:undefined`:Ii(t,e)||"undefined":Si(t,e)}}`;return`{key:${t.slotTarget||'"default"'},fn:${o}}`}function Ii(t,e,n,o,r){const s=t.children;if(s.length){const t=s[0];if(1===s.length&&t.for&&"template"!==t.tag&&"slot"!==t.tag){const r=n?e.maybeComponent(t)?",1":",0":"";return`${(o||Si)(t,e)}${r}`}const i=n?function(t,e){let n=0;for(let o=0;oDi(t.block))){n=2;break}(e(r)||r.ifConditions&&r.ifConditions.some(t=>e(t.block)))&&(n=1)}}return n}(s,e.maybeComponent):0,a=r||Pi;return`[${s.map(t=>a(t,e)).join(",")}]${i?`,${i}`:""}`}}function Di(t){return void 0!==t.for||"template"===t.tag||"slot"===t.tag}function Pi(t,e){return 1===t.type?Si(t,e):3===t.type&&t.isComment?(o=t,`_e(${JSON.stringify(o.text)})`):`_v(${2===(n=t).type?n.expression:Fi(JSON.stringify(n.text))})`;var n,o}function Ri(t){let e="",n="";for(let o=0;oHi(t,c)),e[s]=a}}const Ui=(zi=function(t,e){const n=Qs(t.trim(),e);!1!==e.optimize&&hi(n,e);const o=Oi(n,e);return{ast:n,render:o.render,staticRenderFns:o.staticRenderFns}},function(t){function e(e,n){const o=Object.create(t),r=[],s=[];if(n){n.modules&&(o.modules=(t.modules||[]).concat(n.modules)),n.directives&&(o.directives=k(Object.create(t.directives||null),n.directives));for(const t in n)"modules"!==t&&"directives"!==t&&(o[t]=n[t])}o.warn=((t,e,n)=>{(n?s:r).push(t)});const i=zi(e.trim(),o);return i.errors=r,i.tips=s,i}return{compile:e,compileToFunctions:Bi(e)}});var zi;const{compile:Vi,compileToFunctions:Ki}=Ui(ui);let Ji;function qi(t){return(Ji=Ji||document.createElement("div")).innerHTML=t?'':'
',Ji.innerHTML.indexOf(" ")>0}const Wi=!!U&&qi(!1),Zi=!!U&&qi(!0),Gi=v(t=>{const e=zn(t);return e&&e.innerHTML}),Xi=pn.prototype.$mount;pn.prototype.$mount=function(t,e){if((t=t&&zn(t))===document.body||t===document.documentElement)return this;const n=this.$options;if(!n.render){let e=n.template;if(e)if("string"==typeof e)"#"===e.charAt(0)&&(e=Gi(e));else{if(!e.nodeType)return this;e=e.innerHTML}else t&&(e=function(t){if(t.outerHTML)return t.outerHTML;{const e=document.createElement("div");return e.appendChild(t.cloneNode(!0)),e.innerHTML}}(t));if(e){const{render:t,staticRenderFns:o}=Ki(e,{outputSourceRange:!1,shouldDecodeNewlines:Wi,shouldDecodeNewlinesForHref:Zi,delimiters:n.delimiters,comments:n.comments},this);n.render=t,n.staticRenderFns=o}}return Xi.call(this,t,e)},pn.compile=Ki;export default pn; \ No newline at end of file +const t=Object.freeze({});function e(t){return null==t}function n(t){return null!=t}function o(t){return!0===t}function r(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function s(t){return null!==t&&"object"==typeof t}const i=Object.prototype.toString;function a(t){return"[object Object]"===i.call(t)}function c(t){const e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function l(t){return n(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function u(t){return null==t?"":Array.isArray(t)||a(t)&&t.toString===i?JSON.stringify(t,null,2):String(t)}function f(t){const e=parseFloat(t);return isNaN(e)?t:e}function d(t,e){const n=Object.create(null),o=t.split(",");for(let t=0;tn[t.toLowerCase()]:t=>n[t]}const p=d("slot,component",!0),h=d("key,ref,slot,slot-scope,is");function m(t,e){if(t.length){const n=t.indexOf(e);if(n>-1)return t.splice(n,1)}}const y=Object.prototype.hasOwnProperty;function g(t,e){return y.call(t,e)}function v(t){const e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}const $=/-(\w)/g,_=v(t=>t.replace($,(t,e)=>e?e.toUpperCase():"")),b=v(t=>t.charAt(0).toUpperCase()+t.slice(1)),w=/\B([A-Z])/g,C=v(t=>t.replace(w,"-$1").toLowerCase());const x=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){const o=arguments.length;return o?o>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function A(t,e){e=e||0;let n=t.length-e;const o=new Array(n);for(;n--;)o[n]=t[n+e];return o}function k(t,e){for(const n in e)t[n]=e[n];return t}function O(t){const e={};for(let n=0;n!1,E=t=>t;function N(t,e){if(t===e)return!0;const n=s(t),o=s(e);if(!n||!o)return!n&&!o&&String(t)===String(e);try{const n=Array.isArray(t),o=Array.isArray(e);if(n&&o)return t.length===e.length&&t.every((t,n)=>N(t,e[n]));if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(n||o)return!1;{const n=Object.keys(t),o=Object.keys(e);return n.length===o.length&&n.every(n=>N(t[n],e[n]))}}catch(t){return!1}}function j(t,e){for(let n=0;n0,W=K&&K.indexOf("edge/")>0,Z=(K&&K.indexOf("android"),K&&/iphone|ipad|ipod|ios/.test(K)||"ios"===V),G=(K&&/chrome\/\d+/.test(K),K&&/phantomjs/.test(K),K&&K.match(/firefox\/(\d+)/)),X={}.watch;let Y,Q=!1;if(U)try{const t={};Object.defineProperty(t,"passive",{get(){Q=!0}}),window.addEventListener("test-passive",null,t)}catch(t){}const tt=()=>(void 0===Y&&(Y=!U&&!z&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),Y),et=U&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function nt(t){return"function"==typeof t&&/native code/.test(t.toString())}const ot="undefined"!=typeof Symbol&&nt(Symbol)&&"undefined"!=typeof Reflect&&nt(Reflect.ownKeys);let rt;rt="undefined"!=typeof Set&&nt(Set)?Set:class{constructor(){this.set=Object.create(null)}has(t){return!0===this.set[t]}add(t){this.set[t]=!0}clear(){this.set=Object.create(null)}};let st=S,it=0;class at{constructor(){this.id=it++,this.subs=[]}addSub(t){this.subs.push(t)}removeSub(t){m(this.subs,t)}depend(){at.target&&at.target.addDep(this)}notify(){const t=this.subs.slice();for(let e=0,n=t.length;e{const e=new ft;return e.text=t,e.isComment=!0,e};function pt(t){return new ft(void 0,void 0,void 0,String(t))}function ht(t){const e=new ft(t.tag,t.data,t.children&&t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);return e.ns=t.ns,e.isStatic=t.isStatic,e.key=t.key,e.isComment=t.isComment,e.fnContext=t.fnContext,e.fnOptions=t.fnOptions,e.fnScopeId=t.fnScopeId,e.asyncMeta=t.asyncMeta,e.isCloned=!0,e}const mt=Array.prototype,yt=Object.create(mt);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(t){const e=mt[t];F(yt,t,function(...n){const o=e.apply(this,n),r=this.__ob__;let s;switch(t){case"push":case"unshift":s=n;break;case"splice":s=n.slice(2)}return s&&r.observeArray(s),r.dep.notify(),o})});const gt=Object.getOwnPropertyNames(yt);let vt=!0;function $t(t){vt=t}class _t{constructor(t){var e;this.value=t,this.dep=new at,this.vmCount=0,F(t,"__ob__",this),Array.isArray(t)?(B?(e=yt,t.__proto__=e):function(t,e,n){for(let o=0,r=n.length;o{At[t]=St}),I.forEach(function(t){At[t+"s"]=Tt}),At.watch=function(t,e,n,o){if(t===X&&(t=void 0),e===X&&(e=void 0),!e)return Object.create(t||null);if(!t)return e;const r={};k(r,t);for(const t in e){let n=r[t];const o=e[t];n&&!Array.isArray(n)&&(n=[n]),r[t]=n?n.concat(o):Array.isArray(o)?o:[o]}return r},At.props=At.methods=At.inject=At.computed=function(t,e,n,o){if(!t)return e;const r=Object.create(null);return k(r,t),e&&k(r,e),r},At.provide=Ot;const Et=function(t,e){return void 0===e?t:e};function Nt(t,e,n){if("function"==typeof e&&(e=e.options),function(t,e){const n=t.props;if(!n)return;const o={};let r,s,i;if(Array.isArray(n))for(r=n.length;r--;)"string"==typeof(s=n[r])&&(o[i=_(s)]={type:null});else if(a(n))for(const t in n)s=n[t],o[i=_(t)]=a(s)?s:{type:s};t.props=o}(e),function(t,e){const n=t.inject;if(!n)return;const o=t.inject={};if(Array.isArray(n))for(let t=0;t-1)if(s&&!g(r,"default"))i=!1;else if(""===i||i===C(t)){const t=Dt(String,r.type);(t<0||aPt(t,o,r+" (Promise/async)"))}catch(t){Pt(t,o,r)}return s}function Ft(t,e,n){if(P.errorHandler)try{return P.errorHandler.call(null,t,e,n)}catch(t){Ht(t,null,"config.errorHandler")}Ht(t,e,n)}function Ht(t,e,n){if(!U&&!z||"undefined"==typeof console)throw t;console.error(t)}let Bt=!1;const Ut=[];let zt,Vt=!1;function Kt(){Vt=!1;const t=Ut.slice(0);Ut.length=0;for(let e=0;e{t.then(Kt),Z&&setTimeout(S)}),Bt=!0}else if(J||"undefined"==typeof MutationObserver||!nt(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())zt="undefined"!=typeof setImmediate&&nt(setImmediate)?()=>{setImmediate(Kt)}:()=>{setTimeout(Kt,0)};else{let t=1;const e=new MutationObserver(Kt),n=document.createTextNode(String(t));e.observe(n,{characterData:!0}),zt=(()=>{t=(t+1)%2,n.data=String(t)}),Bt=!0}function Jt(t,e){let n;if(Ut.push(()=>{if(t)try{t.call(e)}catch(t){Pt(t,e,"nextTick")}else n&&n(e)}),Vt||(Vt=!0,zt()),!t&&"undefined"!=typeof Promise)return new Promise(t=>{n=t})}const qt=new rt;function Wt(t){!function t(e,n){let o,r;const i=Array.isArray(e);if(!i&&!s(e)||Object.isFrozen(e)||e instanceof ft)return;if(e.__ob__){const t=e.__ob__.dep.id;if(n.has(t))return;n.add(t)}if(i)for(o=e.length;o--;)t(e[o],n);else for(r=Object.keys(e),o=r.length;o--;)t(e[r[o]],n)}(t,qt),qt.clear()}const Zt=v(t=>{const e="&"===t.charAt(0),n="~"===(t=e?t.slice(1):t).charAt(0),o="!"===(t=n?t.slice(1):t).charAt(0);return{name:t=o?t.slice(1):t,once:n,capture:o,passive:e}});function Gt(t,e){function n(){const t=n.fns;if(!Array.isArray(t))return Rt(t,null,arguments,e,"v-on handler");{const n=t.slice();for(let t=0;t0&&(ee((l=t(l,`${i||""}_${c}`))[0])&&ee(f)&&(a[u]=pt(f.text+l[0].text),l.shift()),a.push.apply(a,l)):r(l)?ee(f)?a[u]=pt(f.text+l):""!==l&&a.push(pt(l)):ee(l)&&ee(f)?a[u]=pt(f.text+l.text):(o(s._isVList)&&n(l.tag)&&e(l.key)&&n(i)&&(l.key=`__vlist${i}_${c}__`),a.push(l)));return a}(t):void 0}function ee(t){return n(t)&&n(t.text)&&!1===t.isComment}function ne(t,e){if(t){const n=Object.create(null),o=ot?Reflect.ownKeys(t):Object.keys(t);for(let r=0;r{const n=t(e);return n&&"object"==typeof n&&!Array.isArray(n)?[n]:te(n)}}function ae(t,e){return()=>t[e]}function ce(t,e){let o,r,i,a,c;if(Array.isArray(t)||"string"==typeof t)for(o=new Array(t.length),r=0,i=t.length;roe(r,s)),Object.defineProperty(this,"scopedSlots",{enumerable:!0,get(){return se(e.scopedSlots,this.slots())}}),l&&(this.$options=a,this.$slots=this.slots(),this.$scopedSlots=se(e.scopedSlots,this.$slots)),a._scopeId?this._c=((t,e,n,o)=>{const r=je(c,t,e,n,o,u);return r&&!Array.isArray(r)&&(r.fnScopeId=a._scopeId,r.fnContext=s),r}):this._c=((t,e,n,o)=>je(c,t,e,n,o,u))}function xe(t,e,n,o,r){const s=ht(t);return s.fnContext=n,s.fnOptions=o,e.slot&&((s.data||(s.data={})).slot=e.slot),s}function Ae(t,e){for(const n in e)t[_(n)]=e[n]}we(Ce.prototype);const ke={init(t,e){if(t.componentInstance&&!t.componentInstance._isDestroyed&&t.data.keepAlive){const e=t;ke.prepatch(e,e)}else{(t.componentInstance=function(t,e){const o={_isComponent:!0,_parentVnode:t,parent:e},r=t.data.inlineTemplate;n(r)&&(o.render=r.render,o.staticRenderFns=r.staticRenderFns);return new t.componentOptions.Ctor(o)}(t,Ue)).$mount(e?t.elm:void 0,e)}},prepatch(e,n){const o=n.componentOptions;!function(e,n,o,r,s){const i=!!(r.data.scopedSlots&&!r.data.scopedSlots.$stable||e.$scopedSlots!==t&&!e.$scopedSlots.$stable),a=!!(s||e.$options._renderChildren||i);e.$options._parentVnode=r,e.$vnode=r,e._vnode&&(e._vnode.parent=r);if(e.$options._renderChildren=s,e.$attrs=r.data.attrs||t,e.$listeners=o||t,n&&e.$options.props){$t(!1);const t=e._props,o=e.$options._propKeys||[];for(let r=0;r{for(let t=0,e=o.length;t{t.resolved=Ie(e,r),a?o.length=0:c(!0)}),f=L(e=>{n(t.errorComp)&&(t.error=!0,c(!0))}),d=t(u,f);return s(d)&&(l(d)?e(t.resolved)&&d.then(u,f):l(d.component)&&(d.component.then(u,f),n(d.error)&&(t.errorComp=Ie(d.error,r)),n(d.loading)&&(t.loadingComp=Ie(d.loading,r),0===d.delay?t.loading=!0:setTimeout(()=>{e(t.resolved)&&e(t.error)&&(t.loading=!0,c(!1))},d.delay||200)),n(d.timeout)&&setTimeout(()=>{e(t.resolved)&&f(null)},d.timeout))),a=!1,t.loading?t.loadingComp:t.resolved}t.owners.push(i)}(d=r,f)))return function(t,e,n,o,r){const s=dt();return s.asyncFactory=t,s.asyncMeta={data:e,context:n,children:o,tag:r},s}(d,i,a,c,u);i=i||{},hn(r),n(i.model)&&function(t,e){const o=t.model&&t.model.prop||"value",r=t.model&&t.model.event||"input";(e.attrs||(e.attrs={}))[o]=e.model.value;const s=e.on||(e.on={}),i=s[r],a=e.model.callback;n(i)?(Array.isArray(i)?-1===i.indexOf(a):i!==a)&&(s[r]=[a].concat(i)):s[r]=a}(r.options,i);const p=function(t,o,r){const s=o.options.props;if(e(s))return;const i={},{attrs:a,props:c}=t;if(n(a)||n(c))for(const t in s){const e=C(t);Qt(i,c,t,e,!0)||Qt(i,a,t,e,!1)}return i}(i,r);if(o(r.options.functional))return function(e,o,r,s,i){const a=e.options,c={},l=a.props;if(n(l))for(const e in l)c[e]=Lt(e,l,o||t);else n(r.attrs)&&Ae(c,r.attrs),n(r.props)&&Ae(c,r.props);const u=new Ce(r,c,i,s,e),f=a.render.call(null,u._c,u);if(f instanceof ft)return xe(f,r,u.parent,a);if(Array.isArray(f)){const t=te(f)||[],e=new Array(t.length);for(let n=0;n{t(n,o),e(n,o)};return n._merged=!0,n}const Ee=1,Ne=2;function je(t,i,a,c,l,u){return(Array.isArray(a)||r(a))&&(l=c,c=a,a=void 0),o(u)&&(l=Ne),function(t,r,i,a,c){if(n(i)&&n(i.__ob__))return dt();n(i)&&n(i.is)&&(r=i.is);if(!r)return dt();Array.isArray(a)&&"function"==typeof a[0]&&((i=i||{}).scopedSlots={default:a[0]},a.length=0);c===Ne?a=te(a):c===Ee&&(a=function(t){for(let e=0;e{Ue=e}}function Ve(t){for(;t&&(t=t.$parent);)if(t._inactive)return!0;return!1}function Ke(t,e){if(e){if(t._directInactive=!1,Ve(t))return}else if(t._directInactive)return;if(t._inactive||null===t._inactive){t._inactive=!1;for(let e=0;et.id-e.id),Ye=0;Yedocument.createEvent("Event").timeStamp&&(tn=(()=>performance.now()));let nn=0;class on{constructor(t,e,n,o,r){this.vm=t,r&&(t._watcher=this),t._watchers.push(this),o?(this.deep=!!o.deep,this.user=!!o.user,this.lazy=!!o.lazy,this.sync=!!o.sync,this.before=o.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++nn,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new rt,this.newDepIds=new rt,this.expression="","function"==typeof e?this.getter=e:(this.getter=function(t){if(H.test(t))return;const e=t.split(".");return function(t){for(let n=0;nYe&&qe[e].id>t.id;)e--;qe.splice(e+1,0,t)}else qe.push(t);Ge||(Ge=!0,Jt(en))}}(this)}run(){if(this.active){const t=this.get();if(t!==this.value||s(t)||this.deep){const e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){Pt(t,this.vm,`callback for watcher "${this.expression}"`)}else this.cb.call(this.vm,t,e)}}}evaluate(){this.value=this.get(),this.dirty=!1}depend(){let t=this.deps.length;for(;t--;)this.deps[t].depend()}teardown(){if(this.active){this.vm._isBeingDestroyed||m(this.vm._watchers,this);let t=this.deps.length;for(;t--;)this.deps[t].removeSub(this);this.active=!1}}}const rn={enumerable:!0,configurable:!0,get:S,set:S};function sn(t,e,n){rn.get=function(){return this[e][n]},rn.set=function(t){this[e][n]=t},Object.defineProperty(t,n,rn)}function an(t){t._watchers=[];const e=t.$options;e.props&&function(t,e){const n=t.$options.propsData||{},o=t._props={},r=t.$options._propKeys=[];t.$parent&&$t(!1);for(const s in e){r.push(s);const i=Lt(s,e,n,t);wt(o,s,i),s in t||sn(t,"_props",s)}$t(!0)}(t,e.props),e.methods&&function(t,e){t.$options.props;for(const n in e)t[n]="function"!=typeof e[n]?S:x(e[n],t)}(t,e.methods),e.data?function(t){let e=t.$options.data;a(e=t._data="function"==typeof e?function(t,e){lt();try{return t.call(e,e)}catch(t){return Pt(t,e,"data()"),{}}finally{ut()}}(e,t):e||{})||(e={});const n=Object.keys(e),o=t.$options.props;t.$options.methods;let r=n.length;for(;r--;){const e=n[r];o&&g(o,e)||R(e)||sn(t,"_data",e)}bt(e,!0)}(t):bt(t._data={},!0),e.computed&&function(t,e){const n=t._computedWatchers=Object.create(null),o=tt();for(const r in e){const s=e[r],i="function"==typeof s?s:s.get;o||(n[r]=new on(t,i||S,S,cn)),r in t||ln(t,r,s)}}(t,e.computed),e.watch&&e.watch!==X&&function(t,e){for(const n in e){const o=e[n];if(Array.isArray(o))for(let e=0;e-1:"string"==typeof t?t.split(",").indexOf(e)>-1:(n=t,"[object RegExp]"===i.call(n)&&t.test(e));var n}function $n(t,e){const{cache:n,keys:o,_vnode:r}=t;for(const t in n){const s=n[t];if(s){const i=gn(s.componentOptions);i&&!e(i)&&_n(n,t,o,r)}}}function _n(t,e,n,o){const r=t[e];!r||o&&r.tag===o.tag||r.componentInstance.$destroy(),t[e]=null,m(n,e)}!function(e){e.prototype._init=function(e){const n=this;n._uid=pn++,n._isVue=!0,e&&e._isComponent?function(t,e){const n=t.$options=Object.create(t.constructor.options),o=e._parentVnode;n.parent=e.parent,n._parentVnode=o;const r=o.componentOptions;n.propsData=r.propsData,n._parentListeners=r.listeners,n._renderChildren=r.children,n._componentTag=r.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(n,e):n.$options=Nt(hn(n.constructor),e||{},n),n._renderProxy=n,n._self=n,function(t){const e=t.$options;let n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(n),function(t){t._events=Object.create(null),t._hasHookEvent=!1;const e=t.$options._parentListeners;e&&Be(t,e)}(n),function(e){e._vnode=null,e._staticTrees=null;const n=e.$options,o=e.$vnode=n._parentVnode,r=o&&o.context;e.$slots=oe(n._renderChildren,r),e.$scopedSlots=t,e._c=((t,n,o,r)=>je(e,t,n,o,r,!1)),e.$createElement=((t,n,o,r)=>je(e,t,n,o,r,!0));const s=o&&o.data;wt(e,"$attrs",s&&s.attrs||t,null,!0),wt(e,"$listeners",n._parentListeners||t,null,!0)}(n),Je(n,"beforeCreate"),function(t){const e=ne(t.$options.inject,t);e&&($t(!1),Object.keys(e).forEach(n=>{wt(t,n,e[n])}),$t(!0))}(n),an(n),function(t){const e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(n),Je(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(mn),function(t){const e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=Ct,t.prototype.$delete=xt,t.prototype.$watch=function(t,e,n){const o=this;if(a(e))return dn(o,t,e,n);(n=n||{}).user=!0;const r=new on(o,t,e,n);if(n.immediate)try{e.call(o,r.value)}catch(t){Pt(t,o,`callback for immediate watcher "${r.expression}"`)}return function(){r.teardown()}}}(mn),function(t){const e=/^hook:/;t.prototype.$on=function(t,n){const o=this;if(Array.isArray(t))for(let e=0,r=t.length;e1?A(n):n;const o=A(arguments,1),r=`event handler for "${t}"`;for(let t=0,s=n.length;t{$n(this,e=>vn(t,e))}),this.$watch("exclude",t=>{$n(this,e=>!vn(t,e))})},render(){const t=this.$slots.default,e=Pe(t),n=e&&e.componentOptions;if(n){const t=gn(n),{include:o,exclude:r}=this;if(o&&(!t||!vn(o,t))||r&&t&&vn(r,t))return e;const{cache:s,keys:i}=this,a=null==e.key?n.Ctor.cid+(n.tag?`::${n.tag}`:""):e.key;s[a]?(e.componentInstance=s[a].componentInstance,m(i,a),i.push(a)):(s[a]=e,i.push(a),this.max&&i.length>parseInt(this.max)&&_n(s,i[0],i,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){const e={get:()=>P};Object.defineProperty(t,"config",e),t.util={warn:st,extend:k,mergeOptions:Nt,defineReactive:wt},t.set=Ct,t.delete=xt,t.nextTick=Jt,t.observable=(t=>(bt(t),t)),t.options=Object.create(null),I.forEach(e=>{t.options[e+"s"]=Object.create(null)}),t.options._base=t,k(t.options.components,wn),function(t){t.use=function(t){const e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;const n=A(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=Nt(this.options,t),this}}(t),yn(t),function(t){I.forEach(e=>{t[e]=function(t,n){return n?("component"===e&&a(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}(t)}(mn),Object.defineProperty(mn.prototype,"$isServer",{get:tt}),Object.defineProperty(mn.prototype,"$ssrContext",{get(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(mn,"FunctionalRenderContext",{value:Ce}),mn.version="2.6.3";const Cn=d("style,class"),xn=d("input,textarea,option,select,progress"),An=(t,e,n)=>"value"===n&&xn(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t,kn=d("contenteditable,draggable,spellcheck"),On=d("events,caret,typing,plaintext-only"),Sn=(t,e)=>Ln(e)||"false"===e?"false":"contenteditable"===t&&On(e)?e:"true",Tn=d("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),En="http://www.w3.org/1999/xlink",Nn=t=>":"===t.charAt(5)&&"xlink"===t.slice(0,5),jn=t=>Nn(t)?t.slice(6,t.length):"",Ln=t=>null==t||!1===t;function Mn(t){let e=t.data,o=t,r=t;for(;n(r.componentInstance);)(r=r.componentInstance._vnode)&&r.data&&(e=In(r.data,e));for(;n(o=o.parent);)o&&o.data&&(e=In(e,o.data));return function(t,e){if(n(t)||n(e))return Dn(t,Pn(e));return""}(e.staticClass,e.class)}function In(t,e){return{staticClass:Dn(t.staticClass,e.staticClass),class:n(t.class)?[t.class,e.class]:e.class}}function Dn(t,e){return t?e?t+" "+e:t:e||""}function Pn(t){return Array.isArray(t)?function(t){let e,o="";for(let r=0,s=t.length;rFn(t)||Hn(t);function Un(t){return Hn(t)?"svg":"math"===t?"math":void 0}const zn=Object.create(null);const Vn=d("text,number,password,search,email,tel,url");function Kn(t){if("string"==typeof t){const e=document.querySelector(t);return e||document.createElement("div")}return t}var Jn=Object.freeze({createElement:function(t,e){const n=document.createElement(t);return"select"!==t?n:(e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)},createElementNS:function(t,e){return document.createElementNS(Rn[t],e)},createTextNode:function(t){return document.createTextNode(t)},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){t.appendChild(e)},parentNode:function(t){return t.parentNode},nextSibling:function(t){return t.nextSibling},tagName:function(t){return t.tagName},setTextContent:function(t,e){t.textContent=e},setStyleScope:function(t,e){t.setAttribute(e,"")}}),qn={create(t,e){Wn(e)},update(t,e){t.data.ref!==e.data.ref&&(Wn(t,!0),Wn(e))},destroy(t){Wn(t,!0)}};function Wn(t,e){const o=t.data.ref;if(!n(o))return;const r=t.context,s=t.componentInstance||t.elm,i=r.$refs;e?Array.isArray(i[o])?m(i[o],s):i[o]===s&&(i[o]=void 0):t.data.refInFor?Array.isArray(i[o])?i[o].indexOf(s)<0&&i[o].push(s):i[o]=[s]:i[o]=s}const Zn=new ft("",{},[]),Gn=["create","activate","update","remove","destroy"];function Xn(t,r){return t.key===r.key&&(t.tag===r.tag&&t.isComment===r.isComment&&n(t.data)===n(r.data)&&function(t,e){if("input"!==t.tag)return!0;let o;const r=n(o=t.data)&&n(o=o.attrs)&&o.type,s=n(o=e.data)&&n(o=o.attrs)&&o.type;return r===s||Vn(r)&&Vn(s)}(t,r)||o(t.isAsyncPlaceholder)&&t.asyncFactory===r.asyncFactory&&e(r.asyncFactory.error))}function Yn(t,e,o){let r,s;const i={};for(r=e;r<=o;++r)n(s=t[r].key)&&(i[s]=r);return i}var Qn={create:to,update:to,destroy:function(t){to(t,Zn)}};function to(t,e){(t.data.directives||e.data.directives)&&function(t,e){const n=t===Zn,o=e===Zn,r=no(t.data.directives,t.context),s=no(e.data.directives,e.context),i=[],a=[];let c,l,u;for(c in s)l=r[c],u=s[c],l?(u.oldValue=l.value,u.oldArg=l.arg,ro(u,"update",e,t),u.def&&u.def.componentUpdated&&a.push(u)):(ro(u,"bind",e,t),u.def&&u.def.inserted&&i.push(u));if(i.length){const o=()=>{for(let n=0;n{for(let n=0;n-1?co(t,e,n):Tn(e)?Ln(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):kn(e)?t.setAttribute(e,Sn(e,n)):Nn(e)?Ln(n)?t.removeAttributeNS(En,jn(e)):t.setAttributeNS(En,e,n):co(t,e,n)}function co(t,e,n){if(Ln(n))t.removeAttribute(e);else{if(J&&!q&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){const e=n=>{n.stopImmediatePropagation(),t.removeEventListener("input",e)};t.addEventListener("input",e),t.__ieph=!0}t.setAttribute(e,n)}}var lo={create:io,update:io};function uo(t,o){const r=o.elm,s=o.data,i=t.data;if(e(s.staticClass)&&e(s.class)&&(e(i)||e(i.staticClass)&&e(i.class)))return;let a=Mn(o);const c=r._transitionClasses;n(c)&&(a=Dn(a,Pn(c))),a!==r._prevClass&&(r.setAttribute("class",a),r._prevClass=a)}var fo={create:uo,update:uo};const po=/[\w).+\-_$\]]/;function ho(t){let e,n,o,r,s,i=!1,a=!1,c=!1,l=!1,u=0,f=0,d=0,p=0;for(o=0;o=0&&" "===(e=t.charAt(n));n--);e&&po.test(e)||(l=!0)}}else void 0===r?(p=o+1,r=t.slice(0,o).trim()):h();function h(){(s||(s=[])).push(t.slice(p,o).trim()),p=o+1}if(void 0===r?r=t.slice(0,o).trim():0!==p&&h(),s)for(o=0;ot[e]).filter(t=>t):[]}function vo(t,e,n,o,r){(t.props||(t.props=[])).push(Oo({name:e,value:n,dynamic:r},o)),t.plain=!1}function $o(t,e,n,o,r){(r?t.dynamicAttrs||(t.dynamicAttrs=[]):t.attrs||(t.attrs=[])).push(Oo({name:e,value:n,dynamic:r},o)),t.plain=!1}function _o(t,e,n,o){t.attrsMap[e]=n,t.attrsList.push(Oo({name:e,value:n},o))}function bo(t,e,n,o,r,s,i,a){(t.directives||(t.directives=[])).push(Oo({name:e,rawName:n,value:o,arg:r,isDynamicArg:s,modifiers:i},a)),t.plain=!1}function wo(t,e,n){return n?`_p(${e},"${t}")`:t+e}function Co(e,n,o,r,s,i,a,c){let l;(r=r||t).right?c?n=`(${n})==='click'?'contextmenu':(${n})`:"click"===n&&(n="contextmenu",delete r.right):r.middle&&(c?n=`(${n})==='click'?'mouseup':(${n})`:"click"===n&&(n="mouseup")),r.capture&&(delete r.capture,n=wo("!",n,c)),r.once&&(delete r.once,n=wo("~",n,c)),r.passive&&(delete r.passive,n=wo("&",n,c)),r.native?(delete r.native,l=e.nativeEvents||(e.nativeEvents={})):l=e.events||(e.events={});const u=Oo({value:o.trim(),dynamic:c},a);r!==t&&(u.modifiers=r);const f=l[n];Array.isArray(f)?s?f.unshift(u):f.push(u):l[n]=f?s?[u,f]:[f,u]:u,e.plain=!1}function xo(t,e,n){const o=Ao(t,":"+e)||Ao(t,"v-bind:"+e);if(null!=o)return ho(o);if(!1!==n){const n=Ao(t,e);if(null!=n)return JSON.stringify(n)}}function Ao(t,e,n){let o;if(null!=(o=t.attrsMap[e])){const n=t.attrsList;for(let t=0,o=n.length;t-1?{exp:t.slice(0,Lo),key:'"'+t.slice(Lo+1)+'"'}:{exp:t,key:null};No=t,Lo=Mo=Io=0;for(;!Po();)Ro(jo=Do())?Ho(jo):91===jo&&Fo(jo);return{exp:t.slice(0,Mo),key:t.slice(Mo+1,Io)}}(t);return null===n.key?`${t}=${e}`:`$set(${n.exp}, ${n.key}, ${e})`}let Eo,No,jo,Lo,Mo,Io;function Do(){return No.charCodeAt(++Lo)}function Po(){return Lo>=Eo}function Ro(t){return 34===t||39===t}function Fo(t){let e=1;for(Mo=Lo;!Po();)if(Ro(t=Do()))Ho(t);else if(91===t&&e++,93===t&&e--,0===e){Io=Lo;break}}function Ho(t){const e=t;for(;!Po()&&(t=Do())!==e;);}const Bo="__r",Uo="__c";let zo;function Vo(t,e,n){const o=zo;return function r(){null!==e.apply(null,arguments)&&qo(t,r,n,o)}}const Ko=Bt&&!(G&&Number(G[1])<=53);function Jo(t,e,n,o){if(Ko){const t=Qe,n=e;e=n._wrapper=function(e){if(e.timeStamp>=t||e.target.ownerDocument!==document)return n.apply(this,arguments)}}zo.addEventListener(t,e,Q?{capture:n,passive:o}:n)}function qo(t,e,n,o){(o||zo).removeEventListener(t,e._wrapper||e,n)}function Wo(t,o){if(e(t.data.on)&&e(o.data.on))return;const r=o.data.on||{},s=t.data.on||{};zo=o.elm,function(t){if(n(t[Bo])){const e=J?"change":"input";t[e]=[].concat(t[Bo],t[e]||[]),delete t[Bo]}n(t[Uo])&&(t.change=[].concat(t[Uo],t.change||[]),delete t[Uo])}(r),Xt(r,s,Jo,qo,Vo,o.context),zo=void 0}var Zo={create:Wo,update:Wo};let Go;function Xo(t,o){if(e(t.data.domProps)&&e(o.data.domProps))return;let r,s;const i=o.elm,a=t.data.domProps||{};let c=o.data.domProps||{};for(r in n(c.__ob__)&&(c=o.data.domProps=k({},c)),a)e(c[r])&&(i[r]="");for(r in c){if(s=c[r],"textContent"===r||"innerHTML"===r){if(o.children&&(o.children.length=0),s===a[r])continue;1===i.childNodes.length&&i.removeChild(i.childNodes[0])}if("value"===r||s!==a[r])if("value"===r){i._value=s;const t=e(s)?"":String(s);Yo(i,t)&&(i.value=t)}else if("innerHTML"===r&&Hn(i.tagName)&&e(i.innerHTML)){(Go=Go||document.createElement("div")).innerHTML=`${s}`;const t=Go.firstChild;for(;i.firstChild;)i.removeChild(i.firstChild);for(;t.firstChild;)i.appendChild(t.firstChild)}else i[r]=s}}function Yo(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){let n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){const o=t.value,r=t._vModifiers;if(n(r)){if(r.number)return f(o)!==f(e);if(r.trim)return o.trim()!==e.trim()}return o!==e}(t,e))}var Qo={create:Xo,update:Xo};const tr=v(function(t){const e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach(function(t){if(t){const o=t.split(n);o.length>1&&(e[o[0].trim()]=o[1].trim())}}),e});function er(t){const e=nr(t.style);return t.staticStyle?k(t.staticStyle,e):e}function nr(t){return Array.isArray(t)?O(t):"string"==typeof t?tr(t):t}const or=/^--/,rr=/\s*!important$/,sr=(t,e,n)=>{if(or.test(e))t.style.setProperty(e,n);else if(rr.test(n))t.style.setProperty(C(e),n.replace(rr,""),"important");else{const o=cr(e);if(Array.isArray(n))for(let e=0,r=n.length;e-1?e.split(fr).forEach(e=>t.classList.add(e)):t.classList.add(e);else{const n=` ${t.getAttribute("class")||""} `;n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function pr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(fr).forEach(e=>t.classList.remove(e)):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{let n=` ${t.getAttribute("class")||""} `;const o=" "+e+" ";for(;n.indexOf(o)>=0;)n=n.replace(o," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function hr(t){if(t){if("object"==typeof t){const e={};return!1!==t.css&&k(e,mr(t.name||"v")),k(e,t),e}return"string"==typeof t?mr(t):void 0}}const mr=v(t=>({enterClass:`${t}-enter`,enterToClass:`${t}-enter-to`,enterActiveClass:`${t}-enter-active`,leaveClass:`${t}-leave`,leaveToClass:`${t}-leave-to`,leaveActiveClass:`${t}-leave-active`})),yr=U&&!q,gr="transition",vr="animation";let $r="transition",_r="transitionend",br="animation",wr="animationend";yr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&($r="WebkitTransition",_r="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(br="WebkitAnimation",wr="webkitAnimationEnd"));const Cr=U?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:t=>t();function xr(t){Cr(()=>{Cr(t)})}function Ar(t,e){const n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),dr(t,e))}function kr(t,e){t._transitionClasses&&m(t._transitionClasses,e),pr(t,e)}function Or(t,e,n){const{type:o,timeout:r,propCount:s}=Tr(t,e);if(!o)return n();const i=o===gr?_r:wr;let a=0;const c=()=>{t.removeEventListener(i,l),n()},l=e=>{e.target===t&&++a>=s&&c()};setTimeout(()=>{a0&&(l=gr,u=s,f=r.length):e===vr?c>0&&(l=vr,u=c,f=a.length):f=(l=(u=Math.max(s,c))>0?s>c?gr:vr:null)?l===gr?r.length:a.length:0,{type:l,timeout:u,propCount:f,hasTransform:l===gr&&Sr.test(n[$r+"Property"])}}function Er(t,e){for(;t.lengthNr(e)+Nr(t[n])))}function Nr(t){return 1e3*Number(t.slice(0,-1).replace(",","."))}function jr(t,o){const r=t.elm;n(r._leaveCb)&&(r._leaveCb.cancelled=!0,r._leaveCb());const i=hr(t.data.transition);if(e(i))return;if(n(r._enterCb)||1!==r.nodeType)return;const{css:a,type:c,enterClass:l,enterToClass:u,enterActiveClass:d,appearClass:p,appearToClass:h,appearActiveClass:m,beforeEnter:y,enter:g,afterEnter:v,enterCancelled:$,beforeAppear:_,appear:b,afterAppear:w,appearCancelled:C,duration:x}=i;let A=Ue,k=Ue.$vnode;for(;k&&k.parent;)A=(k=k.parent).context;const O=!A._isMounted||!t.isRootInsert;if(O&&!b&&""!==b)return;const S=O&&p?p:l,T=O&&m?m:d,E=O&&h?h:u,N=O&&_||y,j=O&&"function"==typeof b?b:g,M=O&&w||v,I=O&&C||$,D=f(s(x)?x.enter:x),P=!1!==a&&!q,R=Ir(j),F=r._enterCb=L(()=>{P&&(kr(r,E),kr(r,T)),F.cancelled?(P&&kr(r,S),I&&I(r)):M&&M(r),r._enterCb=null});t.data.show||Yt(t,"insert",()=>{const e=r.parentNode,n=e&&e._pending&&e._pending[t.key];n&&n.tag===t.tag&&n.elm._leaveCb&&n.elm._leaveCb(),j&&j(r,F)}),N&&N(r),P&&(Ar(r,S),Ar(r,T),xr(()=>{kr(r,S),F.cancelled||(Ar(r,E),R||(Mr(D)?setTimeout(F,D):Or(r,c,F)))})),t.data.show&&(o&&o(),j&&j(r,F)),P||R||F()}function Lr(t,o){const r=t.elm;n(r._enterCb)&&(r._enterCb.cancelled=!0,r._enterCb());const i=hr(t.data.transition);if(e(i)||1!==r.nodeType)return o();if(n(r._leaveCb))return;const{css:a,type:c,leaveClass:l,leaveToClass:u,leaveActiveClass:d,beforeLeave:p,leave:h,afterLeave:m,leaveCancelled:y,delayLeave:g,duration:v}=i,$=!1!==a&&!q,_=Ir(h),b=f(s(v)?v.leave:v),w=r._leaveCb=L(()=>{r.parentNode&&r.parentNode._pending&&(r.parentNode._pending[t.key]=null),$&&(kr(r,u),kr(r,d)),w.cancelled?($&&kr(r,l),y&&y(r)):(o(),m&&m(r)),r._leaveCb=null});function C(){w.cancelled||(!t.data.show&&r.parentNode&&((r.parentNode._pending||(r.parentNode._pending={}))[t.key]=t),p&&p(r),$&&(Ar(r,l),Ar(r,d),xr(()=>{kr(r,l),w.cancelled||(Ar(r,u),_||(Mr(b)?setTimeout(w,b):Or(r,c,w)))})),h&&h(r,w),$||_||w())}g?g(C):C()}function Mr(t){return"number"==typeof t&&!isNaN(t)}function Ir(t){if(e(t))return!1;const o=t.fns;return n(o)?Ir(Array.isArray(o)?o[0]:o):(t._length||t.length)>1}function Dr(t,e){!0!==e.data.show&&jr(e)}const Pr=function(t){let s,i;const a={},{modules:c,nodeOps:l}=t;for(s=0;sm?$(t,d=e(r[v+1])?null:r[v+1].elm,r,h,v,s):h>v&&b(0,o,p,m)}(d,m,g,s,u):n(g)?(n(t.text)&&l.setTextContent(d,""),$(d,null,g,0,g.length-1,s)):n(m)?b(0,m,0,m.length-1):n(t.text)&&l.setTextContent(d,""):t.text!==r.text&&l.setTextContent(d,r.text),n(h)&&n(p=h.hook)&&n(p=p.postpatch)&&p(t,r)}function A(t,e,r){if(o(r)&&n(t.parent))t.parent.data.pendingInsert=e;else for(let t=0;t{const t=document.activeElement;t&&t.vmodel&&Kr(t,"input")});const Rr={inserted(t,e,n,o){"select"===n.tag?(o.elm&&!o.elm._vOptions?Yt(n,"postpatch",()=>{Rr.componentUpdated(t,e,n)}):Fr(t,e,n.context),t._vOptions=[].map.call(t.options,Ur)):("textarea"===n.tag||Vn(t.type))&&(t._vModifiers=e.modifiers,e.modifiers.lazy||(t.addEventListener("compositionstart",zr),t.addEventListener("compositionend",Vr),t.addEventListener("change",Vr),q&&(t.vmodel=!0)))},componentUpdated(t,e,n){if("select"===n.tag){Fr(t,e,n.context);const o=t._vOptions,r=t._vOptions=[].map.call(t.options,Ur);if(r.some((t,e)=>!N(t,o[e]))){(t.multiple?e.value.some(t=>Br(t,r)):e.value!==e.oldValue&&Br(e.value,r))&&Kr(t,"change")}}}};function Fr(t,e,n){Hr(t,e,n),(J||W)&&setTimeout(()=>{Hr(t,e,n)},0)}function Hr(t,e,n){const o=e.value,r=t.multiple;if(r&&!Array.isArray(o))return;let s,i;for(let e=0,n=t.options.length;e-1,i.selected!==s&&(i.selected=s);else if(N(Ur(i),o))return void(t.selectedIndex!==e&&(t.selectedIndex=e));r||(t.selectedIndex=-1)}function Br(t,e){return e.every(e=>!N(e,t))}function Ur(t){return"_value"in t?t._value:t.value}function zr(t){t.target.composing=!0}function Vr(t){t.target.composing&&(t.target.composing=!1,Kr(t.target,"input"))}function Kr(t,e){const n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function Jr(t){return!t.componentInstance||t.data&&t.data.transition?t:Jr(t.componentInstance._vnode)}var qr={model:Rr,show:{bind(t,{value:e},n){const o=(n=Jr(n)).data&&n.data.transition,r=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;e&&o?(n.data.show=!0,jr(n,()=>{t.style.display=r})):t.style.display=e?r:"none"},update(t,{value:e,oldValue:n},o){if(!e==!n)return;(o=Jr(o)).data&&o.data.transition?(o.data.show=!0,e?jr(o,()=>{t.style.display=t.__vOriginalDisplay}):Lr(o,()=>{t.style.display="none"})):t.style.display=e?t.__vOriginalDisplay:"none"},unbind(t,e,n,o,r){r||(t.style.display=t.__vOriginalDisplay)}}};const Wr={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Zr(t){const e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?Zr(Pe(e.children)):t}function Gr(t){const e={},n=t.$options;for(const o in n.propsData)e[o]=t[o];const o=n._parentListeners;for(const t in o)e[_(t)]=o[t];return e}function Xr(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}const Yr=t=>t.tag||De(t),Qr=t=>"show"===t.name;var ts={name:"transition",props:Wr,abstract:!0,render(t){let e=this.$slots.default;if(!e)return;if(!(e=e.filter(Yr)).length)return;const n=this.mode,o=e[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return o;const s=Zr(o);if(!s)return o;if(this._leaving)return Xr(t,o);const i=`__transition-${this._uid}-`;s.key=null==s.key?s.isComment?i+"comment":i+s.tag:r(s.key)?0===String(s.key).indexOf(i)?s.key:i+s.key:s.key;const a=(s.data||(s.data={})).transition=Gr(this),c=this._vnode,l=Zr(c);if(s.data.directives&&s.data.directives.some(Qr)&&(s.data.show=!0),l&&l.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(s,l)&&!De(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){const e=l.data.transition=k({},a);if("out-in"===n)return this._leaving=!0,Yt(e,"afterLeave",()=>{this._leaving=!1,this.$forceUpdate()}),Xr(t,o);if("in-out"===n){if(De(s))return c;let t;const n=()=>{t()};Yt(a,"afterEnter",n),Yt(a,"enterCancelled",n),Yt(e,"delayLeave",e=>{t=e})}}return o}};const es=k({tag:String,moveClass:String},Wr);function ns(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function os(t){t.data.newPos=t.elm.getBoundingClientRect()}function rs(t){const e=t.data.pos,n=t.data.newPos,o=e.left-n.left,r=e.top-n.top;if(o||r){t.data.moved=!0;const e=t.elm.style;e.transform=e.WebkitTransform=`translate(${o}px,${r}px)`,e.transitionDuration="0s"}}delete es.mode;var ss={Transition:ts,TransitionGroup:{props:es,beforeMount(){const t=this._update;this._update=((e,n)=>{const o=ze(this);this.__patch__(this._vnode,this.kept,!1,!0),this._vnode=this.kept,o(),t.call(this,e,n)})},render(t){const e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),o=this.prevChildren=this.children,r=this.$slots.default||[],s=this.children=[],i=Gr(this);for(let t=0;t{if(t.data.moved){const n=t.elm,o=n.style;Ar(n,e),o.transform=o.WebkitTransform=o.transitionDuration="",n.addEventListener(_r,n._moveCb=function t(o){o&&o.target!==n||o&&!/transform$/.test(o.propertyName)||(n.removeEventListener(_r,t),n._moveCb=null,kr(n,e))})}}))},methods:{hasMove(t,e){if(!yr)return!1;if(this._hasMove)return this._hasMove;const n=t.cloneNode();t._transitionClasses&&t._transitionClasses.forEach(t=>{pr(n,t)}),dr(n,e),n.style.display="none",this.$el.appendChild(n);const o=Tr(n);return this.$el.removeChild(n),this._hasMove=o.hasTransform}}}};mn.config.mustUseProp=An,mn.config.isReservedTag=Bn,mn.config.isReservedAttr=Cn,mn.config.getTagNamespace=Un,mn.config.isUnknownElement=function(t){if(!U)return!0;if(Bn(t))return!1;if(t=t.toLowerCase(),null!=zn[t])return zn[t];const e=document.createElement(t);return t.indexOf("-")>-1?zn[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:zn[t]=/HTMLUnknownElement/.test(e.toString())},k(mn.options.directives,qr),k(mn.options.components,ss),mn.prototype.__patch__=U?Pr:S,mn.prototype.$mount=function(t,e){return function(t,e,n){let o;return t.$el=e,t.$options.render||(t.$options.render=dt),Je(t,"beforeMount"),o=(()=>{t._update(t._render(),n)}),new on(t,o,S,{before(){t._isMounted&&!t._isDestroyed&&Je(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,Je(t,"mounted")),t}(this,t=t&&U?Kn(t):void 0,e)},U&&setTimeout(()=>{P.devtools&&et&&et.emit("init",mn)},0);const is=/\{\{((?:.|\r?\n)+?)\}\}/g,as=/[-.*+?^${}()|[\]\/\\]/g,cs=v(t=>{const e=t[0].replace(as,"\\$&"),n=t[1].replace(as,"\\$&");return new RegExp(e+"((?:.|\\n)+?)"+n,"g")});var ls={staticKeys:["staticClass"],transformNode:function(t,e){e.warn;const n=Ao(t,"class");n&&(t.staticClass=JSON.stringify(n));const o=xo(t,"class",!1);o&&(t.classBinding=o)},genData:function(t){let e="";return t.staticClass&&(e+=`staticClass:${t.staticClass},`),t.classBinding&&(e+=`class:${t.classBinding},`),e}};var us={staticKeys:["staticStyle"],transformNode:function(t,e){e.warn;const n=Ao(t,"style");n&&(t.staticStyle=JSON.stringify(tr(n)));const o=xo(t,"style",!1);o&&(t.styleBinding=o)},genData:function(t){let e="";return t.staticStyle&&(e+=`staticStyle:${t.staticStyle},`),t.styleBinding&&(e+=`style:(${t.styleBinding}),`),e}};let fs;var ds={decode:t=>((fs=fs||document.createElement("div")).innerHTML=t,fs.textContent)};const ps=d("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),hs=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),ms=d("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),ys=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,gs=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,vs="[a-zA-Z_][\\-\\.0-9_a-zA-Za-zA-Z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*",$s=`((?:${vs}\\:)?${vs})`,_s=new RegExp(`^<${$s}`),bs=/^\s*(\/?)>/,ws=new RegExp(`^<\\/${$s}[^>]*>`),Cs=/^]+>/i,xs=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Ts=/&(?:lt|gt|quot|amp|#39);/g,Es=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Ns=d("pre,textarea",!0),js=(t,e)=>t&&Ns(t)&&"\n"===e[0];function Ls(t,e){const n=e?Es:Ts;return t.replace(n,t=>Ss[t])}const Ms=/^@|^v-on:/,Is=/^v-|^@|^:/,Ds=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Ps=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Rs=/^\(|\)$/g,Fs=/^\[.*\]$/,Hs=/:(.*)$/,Bs=/^:|^\.|^v-bind:/,Us=/\.[^.]+/g,zs=/^v-slot(:|$)|^#/,Vs=/[\r\n]/,Ks=/\s+/g,Js=v(ds.decode),qs="_empty_";let Ws,Zs,Gs,Xs,Ys,Qs,ti,ei;function ni(t,e,n){return{type:1,tag:t,attrsList:e,attrsMap:li(e),rawAttrsMap:{},parent:n,children:[]}}function oi(t,e){Ws=e.warn||yo,Qs=e.isPreTag||T,ti=e.mustUseProp||T,ei=e.getTagNamespace||T;e.isReservedTag;Gs=go(e.modules,"transformNode"),Xs=go(e.modules,"preTransformNode"),Ys=go(e.modules,"postTransformNode"),Zs=e.delimiters;const n=[],o=!1!==e.preserveWhitespace,r=e.whitespace;let s,i,a=!1,c=!1;function l(t){if(u(t),a||t.processed||(t=ri(t,e)),n.length||t===s||s.if&&(t.elseif||t.else)&&ii(s,{exp:t.elseif,block:t}),i&&!t.forbidden)if(t.elseif||t.else)!function(t,e){const n=function(t){let e=t.length;for(;e--;){if(1===t[e].type)return t[e];t.pop()}}(e.children);n&&n.if&&ii(n,{exp:t.elseif,block:t})}(t,i);else{if(t.slotScope){const e=t.slotTarget||'"default"';(i.scopedSlots||(i.scopedSlots={}))[e]=t}i.children.push(t),t.parent=i}t.children=t.children.filter(t=>!t.slotScope),u(t),t.pre&&(a=!1),Qs(t.tag)&&(c=!1);for(let n=0;n]*>)","i")),s=t.replace(r,function(t,r,s){return n=s.length,ks(o)||"noscript"===o||(r=r.replace(//g,"$1").replace(//g,"$1")),js(o,r)&&(r=r.slice(1)),e.chars&&e.chars(r),""});c+=t.length-s.length,t=s,d(o,c-n,c)}else{let n,o,r,s=t.indexOf("<");if(0===s){if(xs.test(t)){const n=t.indexOf("--\x3e");if(n>=0){e.shouldKeepComment&&e.comment(t.substring(4,n),c,c+n+3),l(n+3);continue}}if(As.test(t)){const e=t.indexOf("]>");if(e>=0){l(e+2);continue}}const n=t.match(Cs);if(n){l(n[0].length);continue}const o=t.match(ws);if(o){const t=c;l(o[0].length),d(o[1],t,c);continue}const r=u();if(r){f(r),js(r.tagName,t)&&l(1);continue}}if(s>=0){for(o=t.slice(s);!(ws.test(o)||_s.test(o)||xs.test(o)||As.test(o)||(r=o.indexOf("<",1))<0);)s+=r,o=t.slice(s);n=t.substring(0,s)}s<0&&(n=t),n&&l(n.length),e.chars&&n&&e.chars(n,c-n.length,c)}if(t===i){e.chars&&e.chars(t);break}}function l(e){c+=e,t=t.substring(e)}function u(){const e=t.match(_s);if(e){const n={tagName:e[1],attrs:[],start:c};let o,r;for(l(e[0].length);!(o=t.match(bs))&&(r=t.match(gs)||t.match(ys));)r.start=c,l(r[0].length),r.end=c,n.attrs.push(r);if(o)return n.unarySlash=o[1],l(o[0].length),n.end=c,n}}function f(t){const i=t.tagName,c=t.unarySlash;o&&("p"===a&&ms(i)&&d(a),s(i)&&a===i&&d(i));const l=r(i)||!!c,u=t.attrs.length,f=new Array(u);for(let n=0;n=0&&n[s].lowerCasedTag!==i;s--);else s=0;if(s>=0){for(let t=n.length-1;t>=s;t--)e.end&&e.end(n[t].tag,o,r);n.length=s,a=s&&n[s-1].tag}else"br"===i?e.start&&e.start(t,[],!0,o,r):"p"===i&&(e.start&&e.start(t,[],!1,o,r),e.end&&e.end(t,o,r))}d()}(t,{warn:Ws,expectHTML:e.expectHTML,isUnaryTag:e.isUnaryTag,canBeLeftOpenTag:e.canBeLeftOpenTag,shouldDecodeNewlines:e.shouldDecodeNewlines,shouldDecodeNewlinesForHref:e.shouldDecodeNewlinesForHref,shouldKeepComment:e.comments,outputSourceRange:e.outputSourceRange,start(t,o,r,u){const f=i&&i.ns||ei(t);J&&"svg"===f&&(o=function(t){const e=[];for(let n=0;nc&&(r.push(a=t.slice(c,i)),o.push(JSON.stringify(a)));const e=ho(s[1].trim());o.push(`_s(${e})`),r.push({"@binding":e}),c=i+s[0].length}return c{if(!t.slotScope)return t.parent=s,!0}),s.slotScope=e.value||qs,t.children=[],t.plain=!1}}}(t),"slot"===(n=t).tag&&(n.slotName=xo(n,"name")),function(t){let e;(e=xo(t,"is"))&&(t.component=e);null!=Ao(t,"inline-template")&&(t.inlineTemplate=!0)}(t);for(let n=0;n{t[e.slice(1)]=!0}),t}}function li(t){const e={};for(let n=0,o=t.length;n-1`+("true"===s?`:(${e})`:`:_q(${e},${s})`)),Co(t,"change",`var $$a=${e},`+"$$el=$event.target,"+`$$c=$$el.checked?(${s}):(${i});`+"if(Array.isArray($$a)){"+`var $$v=${o?"_n("+r+")":r},`+"$$i=_i($$a,$$v);"+`if($$el.checked){$$i<0&&(${To(e,"$$a.concat([$$v])")})}`+`else{$$i>-1&&(${To(e,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")})}`+`}else{${To(e,"$$c")}}`,null,!0)}(t,o,r);else if("input"===s&&"radio"===i)!function(t,e,n){const o=n&&n.number;let r=xo(t,"value")||"null";vo(t,"checked",`_q(${e},${r=o?`_n(${r})`:r})`),Co(t,"change",To(e,r),null,!0)}(t,o,r);else if("input"===s||"textarea"===s)!function(t,e,n){const o=t.attrsMap.type,{lazy:r,number:s,trim:i}=n||{},a=!r&&"range"!==o,c=r?"change":"range"===o?Bo:"input";let l="$event.target.value";i&&(l="$event.target.value.trim()"),s&&(l=`_n(${l})`);let u=To(e,l);a&&(u=`if($event.target.composing)return;${u}`),vo(t,"value",`(${e})`),Co(t,c,u,null,!0),(i||s)&&Co(t,"blur","$forceUpdate()")}(t,o,r);else if(!P.isReservedTag(s))return So(t,o,r),!1;return!0},text:function(t,e){e.value&&vo(t,"textContent",`_s(${e.value})`,e)},html:function(t,e){e.value&&vo(t,"innerHTML",`_s(${e.value})`,e)}},isPreTag:t=>"pre"===t,isUnaryTag:ps,mustUseProp:An,canBeLeftOpenTag:hs,isReservedTag:Bn,getTagNamespace:Un,staticKeys:function(t){return t.reduce((t,e)=>t.concat(e.staticKeys||[]),[]).join(",")}(pi)};let mi,yi;const gi=v(function(t){return d("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(t?","+t:""))});function vi(t,e){t&&(mi=gi(e.staticKeys||""),yi=e.isReservedTag||T,function t(e){e.static=function(t){if(2===t.type)return!1;if(3===t.type)return!0;return!(!t.pre&&(t.hasBindings||t.if||t.for||p(t.tag)||!yi(t.tag)||function(t){for(;t.parent;){if("template"!==(t=t.parent).tag)return!1;if(t.for)return!0}return!1}(t)||!Object.keys(t).every(mi)))}(e);if(1===e.type){if(!yi(e.tag)&&"slot"!==e.tag&&null==e.attrsMap["inline-template"])return;for(let n=0,o=e.children.length;n|^function\s*\(/,_i=/\([^)]*?\);*$/,bi=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,wi={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Ci={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},xi=t=>`if(${t})return null;`,Ai={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:xi("$event.target !== $event.currentTarget"),ctrl:xi("!$event.ctrlKey"),shift:xi("!$event.shiftKey"),alt:xi("!$event.altKey"),meta:xi("!$event.metaKey"),left:xi("'button' in $event && $event.button !== 0"),middle:xi("'button' in $event && $event.button !== 1"),right:xi("'button' in $event && $event.button !== 2")};function ki(t,e){const n=e?"nativeOn:":"on:";let o="",r="";for(const e in t){const n=Oi(t[e]);t[e]&&t[e].dynamic?r+=`${e},${n},`:o+=`"${e}":${n},`}return o=`{${o.slice(0,-1)}}`,r?n+`_d(${o},[${r.slice(0,-1)}])`:n+o}function Oi(t){if(!t)return"function(){}";if(Array.isArray(t))return`[${t.map(t=>Oi(t)).join(",")}]`;const e=bi.test(t.value),n=$i.test(t.value),o=bi.test(t.value.replace(_i,""));if(t.modifiers){let r="",s="";const i=[];for(const e in t.modifiers)if(Ai[e])s+=Ai[e],wi[e]&&i.push(e);else if("exact"===e){const e=t.modifiers;s+=xi(["ctrl","shift","alt","meta"].filter(t=>!e[t]).map(t=>`$event.${t}Key`).join("||"))}else i.push(e);return i.length&&(r+=function(t){return`if(('keyCode' in $event)&&${t.map(Si).join("&&")})return null;`}(i)),s&&(r+=s),`function($event){${r}${e?`return ${t.value}($event)`:n?`return (${t.value})($event)`:o?`return ${t.value}`:t.value}}`}return e||n?t.value:`function($event){${o?`return ${t.value}`:t.value}}`}function Si(t){const e=parseInt(t,10);if(e)return`$event.keyCode!==${e}`;const n=wi[t],o=Ci[t];return"_k($event.keyCode,"+`${JSON.stringify(t)},`+`${JSON.stringify(n)},`+"$event.key,"+`${JSON.stringify(o)}`+")"}var Ti={on:function(t,e){t.wrapListeners=(t=>`_g(${t},${e.value})`)},bind:function(t,e){t.wrapData=(n=>`_b(${n},'${t.tag}',${e.value},${e.modifiers&&e.modifiers.prop?"true":"false"}${e.modifiers&&e.modifiers.sync?",true":""})`)},cloak:S};class Ei{constructor(t){this.options=t,this.warn=t.warn||yo,this.transforms=go(t.modules,"transformCode"),this.dataGenFns=go(t.modules,"genData"),this.directives=k(k({},Ti),t.directives);const e=t.isReservedTag||T;this.maybeComponent=(t=>!!t.component||!e(t.tag)),this.onceId=0,this.staticRenderFns=[],this.pre=!1}}function Ni(t,e){const n=new Ei(e);return{render:`with(this){return ${t?ji(t,n):'_c("div")'}}`,staticRenderFns:n.staticRenderFns}}function ji(t,e){if(t.parent&&(t.pre=t.pre||t.parent.pre),t.staticRoot&&!t.staticProcessed)return Li(t,e);if(t.once&&!t.onceProcessed)return Mi(t,e);if(t.for&&!t.forProcessed)return Di(t,e);if(t.if&&!t.ifProcessed)return Ii(t,e);if("template"!==t.tag||t.slotTarget||e.pre){if("slot"===t.tag)return function(t,e){const n=t.slotName||'"default"',o=Fi(t,e);let r=`_t(${n}${o?`,${o}`:""}`;const s=t.attrs||t.dynamicAttrs?Ui((t.attrs||[]).concat(t.dynamicAttrs||[]).map(t=>({name:_(t.name),value:t.value,dynamic:t.dynamic}))):null,i=t.attrsMap["v-bind"];!s&&!i||o||(r+=",null");s&&(r+=`,${s}`);i&&(r+=`${s?"":",null"},${i}`);return r+")"}(t,e);{let n;if(t.component)n=function(t,e,n){const o=e.inlineTemplate?null:Fi(e,n,!0);return`_c(${t},${Pi(e,n)}${o?`,${o}`:""})`}(t.component,t,e);else{let o;(!t.plain||t.pre&&e.maybeComponent(t))&&(o=Pi(t,e));const r=t.inlineTemplate?null:Fi(t,e,!0);n=`_c('${t.tag}'${o?`,${o}`:""}${r?`,${r}`:""})`}for(let o=0;o{const n=e[t];return n.slotTargetDynamic||n.if||n.for});if(!o){let e=t.parent;for(;e;){if(e.slotScope&&e.slotScope!==qs){o=!0;break}e=e.parent}}return`scopedSlots:_u([${Object.keys(e).map(t=>Ri(e[t],n)).join(",")}]${o?",true":""})`}(t,t.scopedSlots,e)},`),t.model&&(n+=`model:{value:${t.model.value},callback:${t.model.callback},expression:${t.model.expression}},`),t.inlineTemplate){const o=function(t,e){const n=t.children[0];if(n&&1===n.type){const t=Ni(n,e.options);return`inlineTemplate:{render:function(){${t.render}},staticRenderFns:[${t.staticRenderFns.map(t=>`function(){${t}}`).join(",")}]}`}}(t,e);o&&(n+=`${o},`)}return n=n.replace(/,$/,"")+"}",t.dynamicAttrs&&(n=`_b(${n},"${t.tag}",${Ui(t.dynamicAttrs)})`),t.wrapData&&(n=t.wrapData(n)),t.wrapListeners&&(n=t.wrapListeners(n)),n}function Ri(t,e){const n=t.attrsMap["slot-scope"];if(t.if&&!t.ifProcessed&&!n)return Ii(t,e,Ri,"null");if(t.for&&!t.forProcessed)return Di(t,e,Ri);const o=`function(${t.slotScope===qs?"":String(t.slotScope)}){`+`return ${"template"===t.tag?t.if&&n?`(${t.if})?${Fi(t,e)||"undefined"}:undefined`:Fi(t,e)||"undefined":ji(t,e)}}`;return`{key:${t.slotTarget||'"default"'},fn:${o}}`}function Fi(t,e,n,o,r){const s=t.children;if(s.length){const t=s[0];if(1===s.length&&t.for&&"template"!==t.tag&&"slot"!==t.tag){const r=n?e.maybeComponent(t)?",1":",0":"";return`${(o||ji)(t,e)}${r}`}const i=n?function(t,e){let n=0;for(let o=0;oHi(t.block))){n=2;break}(e(r)||r.ifConditions&&r.ifConditions.some(t=>e(t.block)))&&(n=1)}}return n}(s,e.maybeComponent):0,a=r||Bi;return`[${s.map(t=>a(t,e)).join(",")}]${i?`,${i}`:""}`}}function Hi(t){return void 0!==t.for||"template"===t.tag||"slot"===t.tag}function Bi(t,e){return 1===t.type?ji(t,e):3===t.type&&t.isComment?(o=t,`_e(${JSON.stringify(o.text)})`):`_v(${2===(n=t).type?n.expression:zi(JSON.stringify(n.text))})`;var n,o}function Ui(t){let e="",n="";for(let o=0;oVi(t,c)),e[s]=a}}const Ji=(qi=function(t,e){const n=oi(t.trim(),e);!1!==e.optimize&&vi(n,e);const o=Ni(n,e);return{ast:n,render:o.render,staticRenderFns:o.staticRenderFns}},function(t){function e(e,n){const o=Object.create(t),r=[],s=[];if(n){n.modules&&(o.modules=(t.modules||[]).concat(n.modules)),n.directives&&(o.directives=k(Object.create(t.directives||null),n.directives));for(const t in n)"modules"!==t&&"directives"!==t&&(o[t]=n[t])}o.warn=((t,e,n)=>{(n?s:r).push(t)});const i=qi(e.trim(),o);return i.errors=r,i.tips=s,i}return{compile:e,compileToFunctions:Ki(e)}});var qi;const{compile:Wi,compileToFunctions:Zi}=Ji(hi);let Gi;function Xi(t){return(Gi=Gi||document.createElement("div")).innerHTML=t?'':'
',Gi.innerHTML.indexOf(" ")>0}const Yi=!!U&&Xi(!1),Qi=!!U&&Xi(!0),ta=v(t=>{const e=Kn(t);return e&&e.innerHTML}),ea=mn.prototype.$mount;mn.prototype.$mount=function(t,e){if((t=t&&Kn(t))===document.body||t===document.documentElement)return this;const n=this.$options;if(!n.render){let e=n.template;if(e)if("string"==typeof e)"#"===e.charAt(0)&&(e=ta(e));else{if(!e.nodeType)return this;e=e.innerHTML}else t&&(e=function(t){if(t.outerHTML)return t.outerHTML;{const e=document.createElement("div");return e.appendChild(t.cloneNode(!0)),e.innerHTML}}(t));if(e){const{render:t,staticRenderFns:o}=Zi(e,{outputSourceRange:!1,shouldDecodeNewlines:Yi,shouldDecodeNewlinesForHref:Qi,delimiters:n.delimiters,comments:n.comments},this);n.render=t,n.staticRenderFns=o}}return ea.call(this,t,e)},mn.compile=Zi;export default mn; \ No newline at end of file diff --git a/dist/vue.esm.js b/dist/vue.esm.js index 81b2c0623ad..df1fb691f77 100644 --- a/dist/vue.esm.js +++ b/dist/vue.esm.js @@ -1,5 +1,5 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ @@ -532,6 +532,7 @@ var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android' var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; var isPhantomJS = UA && /phantomjs/.test(UA); +var isFF = UA && UA.match(/firefox\/(\d+)/); // Firefox has a "watch" function on Object.prototype... var nativeWatch = ({}).watch; @@ -2408,2450 +2409,2452 @@ function normalizeArrayChildren (children, nestedIndex) { /* */ -function ensureCtor (comp, base) { - if ( - comp.__esModule || - (hasSymbol && comp[Symbol.toStringTag] === 'Module') - ) { - comp = comp.default; +function initProvide (vm) { + var provide = vm.$options.provide; + if (provide) { + vm._provided = typeof provide === 'function' + ? provide.call(vm) + : provide; } - return isObject(comp) - ? base.extend(comp) - : comp -} - -function createAsyncPlaceholder ( - factory, - data, - context, - children, - tag -) { - var node = createEmptyVNode(); - node.asyncFactory = factory; - node.asyncMeta = { data: data, context: context, children: children, tag: tag }; - return node } -function resolveAsyncComponent ( - factory, - baseCtor, - context -) { - if (isTrue(factory.error) && isDef(factory.errorComp)) { - return factory.errorComp - } - - if (isDef(factory.resolved)) { - return factory.resolved - } - - if (isTrue(factory.loading) && isDef(factory.loadingComp)) { - return factory.loadingComp - } - - if (isDef(factory.contexts)) { - // already pending - factory.contexts.push(context); - } else { - var contexts = factory.contexts = [context]; - var sync = true; - - var forceRender = function (renderCompleted) { - for (var i = 0, l = contexts.length; i < l; i++) { - contexts[i].$forceUpdate(); - } - - if (renderCompleted) { - contexts.length = 0; - } - }; - - var resolve = once(function (res) { - // cache resolved - factory.resolved = ensureCtor(res, baseCtor); - // invoke callbacks only if this is not a synchronous resolve - // (async resolves are shimmed as synchronous during SSR) - if (!sync) { - forceRender(true); +function initInjections (vm) { + var result = resolveInject(vm.$options.inject, vm); + if (result) { + toggleObserving(false); + Object.keys(result).forEach(function (key) { + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') { + defineReactive$$1(vm, key, result[key], function () { + warn( + "Avoid mutating an injected value directly since the changes will be " + + "overwritten whenever the provided component re-renders. " + + "injection being mutated: \"" + key + "\"", + vm + ); + }); } else { - contexts.length = 0; - } - }); - - var reject = once(function (reason) { - process.env.NODE_ENV !== 'production' && warn( - "Failed to resolve async component: " + (String(factory)) + - (reason ? ("\nReason: " + reason) : '') - ); - if (isDef(factory.errorComp)) { - factory.error = true; - forceRender(true); + defineReactive$$1(vm, key, result[key]); } }); + toggleObserving(true); + } +} - var res = factory(resolve, reject); - - if (isObject(res)) { - if (isPromise(res)) { - // () => Promise - if (isUndef(factory.resolved)) { - res.then(resolve, reject); - } - } else if (isPromise(res.component)) { - res.component.then(resolve, reject); - - if (isDef(res.error)) { - factory.errorComp = ensureCtor(res.error, baseCtor); - } +function resolveInject (inject, vm) { + if (inject) { + // inject is :any because flow is not smart enough to figure out cached + var result = Object.create(null); + var keys = hasSymbol + ? Reflect.ownKeys(inject) + : Object.keys(inject); - if (isDef(res.loading)) { - factory.loadingComp = ensureCtor(res.loading, baseCtor); - if (res.delay === 0) { - factory.loading = true; - } else { - setTimeout(function () { - if (isUndef(factory.resolved) && isUndef(factory.error)) { - factory.loading = true; - forceRender(false); - } - }, res.delay || 200); - } + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + // #6574 in case the inject object is observed... + if (key === '__ob__') { continue } + var provideKey = inject[key].from; + var source = vm; + while (source) { + if (source._provided && hasOwn(source._provided, provideKey)) { + result[key] = source._provided[provideKey]; + break } - - if (isDef(res.timeout)) { - setTimeout(function () { - if (isUndef(factory.resolved)) { - reject( - process.env.NODE_ENV !== 'production' - ? ("timeout (" + (res.timeout) + "ms)") - : null - ); - } - }, res.timeout); + source = source.$parent; + } + if (!source) { + if ('default' in inject[key]) { + var provideDefault = inject[key].default; + result[key] = typeof provideDefault === 'function' + ? provideDefault.call(vm) + : provideDefault; + } else if (process.env.NODE_ENV !== 'production') { + warn(("Injection \"" + key + "\" not found"), vm); } } } - - sync = false; - // return in case resolved synchronously - return factory.loading - ? factory.loadingComp - : factory.resolved + return result } } /* */ -function isAsyncPlaceholder (node) { - return node.isComment && node.asyncFactory -} -/* */ -function getFirstComponentChild (children) { - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - var c = children[i]; - if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { - return c +/** + * Runtime helper for resolving raw children VNodes into a slot object. + */ +function resolveSlots ( + children, + context +) { + if (!children || !children.length) { + return {} + } + var slots = {}; + for (var i = 0, l = children.length; i < l; i++) { + var child = children[i]; + var data = child.data; + // remove slot attribute if the node is resolved as a Vue slot node + if (data && data.attrs && data.attrs.slot) { + delete data.attrs.slot; + } + // named slots should only be respected if the vnode was rendered in the + // same context. + if ((child.context === context || child.fnContext === context) && + data && data.slot != null + ) { + var name = data.slot; + var slot = (slots[name] || (slots[name] = [])); + if (child.tag === 'template') { + slot.push.apply(slot, child.children || []); + } else { + slot.push(child); } + } else { + (slots.default || (slots.default = [])).push(child); + } + } + // ignore slots that contains only whitespace + for (var name$1 in slots) { + if (slots[name$1].every(isWhitespace)) { + delete slots[name$1]; } } + return slots } -/* */ +function isWhitespace (node) { + return (node.isComment && !node.asyncFactory) || node.text === ' ' +} /* */ -function initEvents (vm) { - vm._events = Object.create(null); - vm._hasHookEvent = false; - // init parent attached events - var listeners = vm.$options._parentListeners; - if (listeners) { - updateComponentListeners(vm, listeners); +function normalizeScopedSlots ( + slots, + normalSlots +) { + var res; + if (!slots) { + res = {}; + } else if (slots._normalized) { + return slots + } else { + res = {}; + for (var key in slots) { + if (slots[key] && key[0] !== '$') { + res[key] = normalizeScopedSlot(slots[key]); + } + } + } + // expose normal slots on scopedSlots + for (var key$1 in normalSlots) { + if (!(key$1 in res)) { + res[key$1] = proxyNormalSlot(normalSlots, key$1); + } } + def(res, '_normalized', true); + def(res, '$stable', slots ? !!slots.$stable : true); + return res } -var target; +function normalizeScopedSlot(fn) { + return function (scope) { + var res = fn(scope); + return res && typeof res === 'object' && !Array.isArray(res) + ? [res] // single vnode + : normalizeChildren(res) + } +} -function add (event, fn) { - target.$on(event, fn); +function proxyNormalSlot(slots, key) { + return function () { return slots[key]; } } -function remove$1 (event, fn) { - target.$off(event, fn); -} - -function createOnceHandler (event, fn) { - var _target = target; - return function onceHandler () { - var res = fn.apply(null, arguments); - if (res !== null) { - _target.$off(event, onceHandler); - } - } -} +/* */ -function updateComponentListeners ( - vm, - listeners, - oldListeners +/** + * Runtime helper for rendering v-for lists. + */ +function renderList ( + val, + render ) { - target = vm; - updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); - target = undefined; -} - -function eventsMixin (Vue) { - var hookRE = /^hook:/; - Vue.prototype.$on = function (event, fn) { - var vm = this; - if (Array.isArray(event)) { - for (var i = 0, l = event.length; i < l; i++) { - vm.$on(event[i], fn); - } - } else { - (vm._events[event] || (vm._events[event] = [])).push(fn); - // optimize hook:event cost by using a boolean flag marked at registration - // instead of a hash lookup - if (hookRE.test(event)) { - vm._hasHookEvent = true; - } - } - return vm - }; - - Vue.prototype.$once = function (event, fn) { - var vm = this; - function on () { - vm.$off(event, on); - fn.apply(vm, arguments); - } - on.fn = fn; - vm.$on(event, on); - return vm - }; - - Vue.prototype.$off = function (event, fn) { - var vm = this; - // all - if (!arguments.length) { - vm._events = Object.create(null); - return vm - } - // array of events - if (Array.isArray(event)) { - for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { - vm.$off(event[i$1], fn); - } - return vm - } - // specific event - var cbs = vm._events[event]; - if (!cbs) { - return vm - } - if (!fn) { - vm._events[event] = null; - return vm + var ret, i, l, keys, key; + if (Array.isArray(val) || typeof val === 'string') { + ret = new Array(val.length); + for (i = 0, l = val.length; i < l; i++) { + ret[i] = render(val[i], i); } - // specific handler - var cb; - var i = cbs.length; - while (i--) { - cb = cbs[i]; - if (cb === fn || cb.fn === fn) { - cbs.splice(i, 1); - break - } + } else if (typeof val === 'number') { + ret = new Array(val); + for (i = 0; i < val; i++) { + ret[i] = render(i + 1, i); } - return vm - }; - - Vue.prototype.$emit = function (event) { - var vm = this; - if (process.env.NODE_ENV !== 'production') { - var lowerCaseEvent = event.toLowerCase(); - if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { - tip( - "Event \"" + lowerCaseEvent + "\" is emitted in component " + - (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + - "Note that HTML attributes are case-insensitive and you cannot use " + - "v-on to listen to camelCase events when using in-DOM templates. " + - "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." - ); + } else if (isObject(val)) { + if (hasSymbol && val[Symbol.iterator]) { + ret = []; + var iterator = val[Symbol.iterator](); + var result = iterator.next(); + while (!result.done) { + ret.push(render(result.value, ret.length)); + result = iterator.next(); } - } - var cbs = vm._events[event]; - if (cbs) { - cbs = cbs.length > 1 ? toArray(cbs) : cbs; - var args = toArray(arguments, 1); - var info = "event handler for \"" + event + "\""; - for (var i = 0, l = cbs.length; i < l; i++) { - invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } else { + keys = Object.keys(val); + ret = new Array(keys.length); + for (i = 0, l = keys.length; i < l; i++) { + key = keys[i]; + ret[i] = render(val[key], key, i); } } - return vm - }; + } + if (!isDef(ret)) { + ret = []; + } + (ret)._isVList = true; + return ret } /* */ - - /** - * Runtime helper for resolving raw children VNodes into a slot object. + * Runtime helper for rendering */ -function resolveSlots ( - children, - context +function renderSlot ( + name, + fallback, + props, + bindObject ) { - if (!children || !children.length) { - return {} - } - var slots = {}; - for (var i = 0, l = children.length; i < l; i++) { - var child = children[i]; - var data = child.data; - // remove slot attribute if the node is resolved as a Vue slot node - if (data && data.attrs && data.attrs.slot) { - delete data.attrs.slot; - } - // named slots should only be respected if the vnode was rendered in the - // same context. - if ((child.context === context || child.fnContext === context) && - data && data.slot != null - ) { - var name = data.slot; - var slot = (slots[name] || (slots[name] = [])); - if (child.tag === 'template') { - slot.push.apply(slot, child.children || []); - } else { - slot.push(child); + var scopedSlotFn = this.$scopedSlots[name]; + var nodes; + if (scopedSlotFn) { // scoped slot + props = props || {}; + if (bindObject) { + if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) { + warn( + 'slot v-bind without argument expects an Object', + this + ); } - } else { - (slots.default || (slots.default = [])).push(child); - } - } - // ignore slots that contains only whitespace - for (var name$1 in slots) { - if (slots[name$1].every(isWhitespace)) { - delete slots[name$1]; + props = extend(extend({}, bindObject), props); } + nodes = scopedSlotFn(props) || fallback; + } else { + nodes = this.$slots[name] || fallback; } - return slots -} - -function isWhitespace (node) { - return (node.isComment && !node.asyncFactory) || node.text === ' ' -} -function resolveScopedSlots ( - fns, // see flow/vnode - hasDynamicKeys, - res -) { - res = res || { $stable: !hasDynamicKeys }; - for (var i = 0; i < fns.length; i++) { - var slot = fns[i]; - if (Array.isArray(slot)) { - resolveScopedSlots(slot, hasDynamicKeys, res); - } else if (slot) { - res[slot.key] = slot.fn; - } + var target = props && props.slot; + if (target) { + return this.$createElement('template', { slot: target }, nodes) + } else { + return nodes } - return res } /* */ -var activeInstance = null; -var isUpdatingChildComponent = false; - -function setActiveInstance(vm) { - var prevActiveInstance = activeInstance; - activeInstance = vm; - return function () { - activeInstance = prevActiveInstance; - } +/** + * Runtime helper for resolving filters + */ +function resolveFilter (id) { + return resolveAsset(this.$options, 'filters', id, true) || identity } -function initLifecycle (vm) { - var options = vm.$options; +/* */ - // locate first non-abstract parent - var parent = options.parent; - if (parent && !options.abstract) { - while (parent.$options.abstract && parent.$parent) { - parent = parent.$parent; - } - parent.$children.push(vm); +function isKeyNotMatch (expect, actual) { + if (Array.isArray(expect)) { + return expect.indexOf(actual) === -1 + } else { + return expect !== actual } +} - vm.$parent = parent; - vm.$root = parent ? parent.$root : vm; - - vm.$children = []; - vm.$refs = {}; - - vm._watcher = null; - vm._inactive = null; - vm._directInactive = false; - vm._isMounted = false; - vm._isDestroyed = false; - vm._isBeingDestroyed = false; +/** + * Runtime helper for checking keyCodes from config. + * exposed as Vue.prototype._k + * passing in eventKeyName as last argument separately for backwards compat + */ +function checkKeyCodes ( + eventKeyCode, + key, + builtInKeyCode, + eventKeyName, + builtInKeyName +) { + var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; + if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { + return isKeyNotMatch(builtInKeyName, eventKeyName) + } else if (mappedKeyCode) { + return isKeyNotMatch(mappedKeyCode, eventKeyCode) + } else if (eventKeyName) { + return hyphenate(eventKeyName) !== key + } } -function lifecycleMixin (Vue) { - Vue.prototype._update = function (vnode, hydrating) { - var vm = this; - var prevEl = vm.$el; - var prevVnode = vm._vnode; - var restoreActiveInstance = setActiveInstance(vm); - vm._vnode = vnode; - // Vue.prototype.__patch__ is injected in entry points - // based on the rendering backend used. - if (!prevVnode) { - // initial render - vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); +/* */ + +/** + * Runtime helper for merging v-bind="object" into a VNode's data. + */ +function bindObjectProps ( + data, + tag, + value, + asProp, + isSync +) { + if (value) { + if (!isObject(value)) { + process.env.NODE_ENV !== 'production' && warn( + 'v-bind without argument expects an Object or Array value', + this + ); } else { - // updates - vm.$el = vm.__patch__(prevVnode, vnode); - } - restoreActiveInstance(); - // update __vue__ reference - if (prevEl) { - prevEl.__vue__ = null; - } - if (vm.$el) { - vm.$el.__vue__ = vm; - } - // if parent is an HOC, update its $el as well - if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { - vm.$parent.$el = vm.$el; - } - // updated hook is called by the scheduler to ensure that children are - // updated in a parent's updated hook. - }; + if (Array.isArray(value)) { + value = toObject(value); + } + var hash; + var loop = function ( key ) { + if ( + key === 'class' || + key === 'style' || + isReservedAttribute(key) + ) { + hash = data; + } else { + var type = data.attrs && data.attrs.type; + hash = asProp || config.mustUseProp(tag, type, key) + ? data.domProps || (data.domProps = {}) + : data.attrs || (data.attrs = {}); + } + var camelizedKey = camelize(key); + if (!(key in hash) && !(camelizedKey in hash)) { + hash[key] = value[key]; - Vue.prototype.$forceUpdate = function () { - var vm = this; - if (vm._watcher) { - vm._watcher.update(); - } - }; + if (isSync) { + var on = data.on || (data.on = {}); + on[("update:" + camelizedKey)] = function ($event) { + value[key] = $event; + }; + } + } + }; - Vue.prototype.$destroy = function () { - var vm = this; - if (vm._isBeingDestroyed) { - return - } - callHook(vm, 'beforeDestroy'); - vm._isBeingDestroyed = true; - // remove self from parent - var parent = vm.$parent; - if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { - remove(parent.$children, vm); - } - // teardown watchers - if (vm._watcher) { - vm._watcher.teardown(); - } - var i = vm._watchers.length; - while (i--) { - vm._watchers[i].teardown(); - } - // remove reference from data ob - // frozen object may not have observer. - if (vm._data.__ob__) { - vm._data.__ob__.vmCount--; - } - // call the last hook... - vm._isDestroyed = true; - // invoke destroy hooks on current rendered tree - vm.__patch__(vm._vnode, null); - // fire destroyed hook - callHook(vm, 'destroyed'); - // turn off all instance listeners. - vm.$off(); - // remove __vue__ reference - if (vm.$el) { - vm.$el.__vue__ = null; - } - // release circular reference (#6759) - if (vm.$vnode) { - vm.$vnode.parent = null; + for (var key in value) loop( key ); } - }; + } + return data } -function mountComponent ( - vm, - el, - hydrating +/* */ + +/** + * Runtime helper for rendering static trees. + */ +function renderStatic ( + index, + isInFor ) { - vm.$el = el; - if (!vm.$options.render) { - vm.$options.render = createEmptyVNode; - if (process.env.NODE_ENV !== 'production') { - /* istanbul ignore if */ - if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || - vm.$options.el || el) { - warn( - 'You are using the runtime-only build of Vue where the template ' + - 'compiler is not available. Either pre-compile the templates into ' + - 'render functions, or use the compiler-included build.', - vm - ); - } else { - warn( - 'Failed to mount component: template or render function not defined.', - vm - ); + var cached = this._staticTrees || (this._staticTrees = []); + var tree = cached[index]; + // if has already-rendered static tree and not inside v-for, + // we can reuse the same tree. + if (tree && !isInFor) { + return tree + } + // otherwise, render a fresh tree. + tree = cached[index] = this.$options.staticRenderFns[index].call( + this._renderProxy, + null, + this // for render fns generated for functional component templates + ); + markStatic(tree, ("__static__" + index), false); + return tree +} + +/** + * Runtime helper for v-once. + * Effectively it means marking the node as static with a unique key. + */ +function markOnce ( + tree, + index, + key +) { + markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); + return tree +} + +function markStatic ( + tree, + key, + isOnce +) { + if (Array.isArray(tree)) { + for (var i = 0; i < tree.length; i++) { + if (tree[i] && typeof tree[i] !== 'string') { + markStaticNode(tree[i], (key + "_" + i), isOnce); } } + } else { + markStaticNode(tree, key, isOnce); } - callHook(vm, 'beforeMount'); +} - var updateComponent; - /* istanbul ignore if */ - if (process.env.NODE_ENV !== 'production' && config.performance && mark) { - updateComponent = function () { - var name = vm._name; - var id = vm._uid; - var startTag = "vue-perf-start:" + id; - var endTag = "vue-perf-end:" + id; +function markStaticNode (node, key, isOnce) { + node.isStatic = true; + node.key = key; + node.isOnce = isOnce; +} - mark(startTag); - var vnode = vm._render(); - mark(endTag); - measure(("vue " + name + " render"), startTag, endTag); +/* */ - mark(startTag); - vm._update(vnode, hydrating); - mark(endTag); - measure(("vue " + name + " patch"), startTag, endTag); - }; - } else { - updateComponent = function () { - vm._update(vm._render(), hydrating); - }; +function bindObjectListeners (data, value) { + if (value) { + if (!isPlainObject(value)) { + process.env.NODE_ENV !== 'production' && warn( + 'v-on without argument expects an Object value', + this + ); + } else { + var on = data.on = data.on ? extend({}, data.on) : {}; + for (var key in value) { + var existing = on[key]; + var ours = value[key]; + on[key] = existing ? [].concat(existing, ours) : ours; + } + } } + return data +} - // we set this to vm._watcher inside the watcher's constructor - // since the watcher's initial patch may call $forceUpdate (e.g. inside child - // component's mounted hook), which relies on vm._watcher being already defined - new Watcher(vm, updateComponent, noop, { - before: function before () { - if (vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'beforeUpdate'); - } +/* */ + +function resolveScopedSlots ( + fns, // see flow/vnode + hasDynamicKeys, + res +) { + res = res || { $stable: !hasDynamicKeys }; + for (var i = 0; i < fns.length; i++) { + var slot = fns[i]; + if (Array.isArray(slot)) { + resolveScopedSlots(slot, hasDynamicKeys, res); + } else if (slot) { + res[slot.key] = slot.fn; } - }, true /* isRenderWatcher */); - hydrating = false; + } + return res +} - // manually mounted instance, call mounted on self - // mounted is called for render-created child components in its inserted hook - if (vm.$vnode == null) { - vm._isMounted = true; - callHook(vm, 'mounted'); +/* */ + +function bindDynamicKeys (baseObj, values) { + for (var i = 0; i < values.length; i += 2) { + var key = values[i]; + if (typeof key === 'string' && key) { + baseObj[values[i]] = values[i + 1]; + } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) { + // null is a speical value for explicitly removing a binding + warn( + ("Invalid value for dynamic directive argument (expected string or null): " + key), + this + ); + } } - return vm + return baseObj } -function updateChildComponent ( - vm, - propsData, - listeners, - parentVnode, - renderChildren +// helper to dynamically append modifier runtime markers to event names. +// ensure only append when value is already string, otherwise it will be cast +// to string and cause the type check to miss. +function prependModifier (value, symbol) { + return typeof value === 'string' ? symbol + value : value +} + +/* */ + +function installRenderHelpers (target) { + target._o = markOnce; + target._n = toNumber; + target._s = toString; + target._l = renderList; + target._t = renderSlot; + target._q = looseEqual; + target._i = looseIndexOf; + target._m = renderStatic; + target._f = resolveFilter; + target._k = checkKeyCodes; + target._b = bindObjectProps; + target._v = createTextVNode; + target._e = createEmptyVNode; + target._u = resolveScopedSlots; + target._g = bindObjectListeners; + target._d = bindDynamicKeys; + target._p = prependModifier; +} + +/* */ + +function FunctionalRenderContext ( + data, + props, + children, + parent, + Ctor ) { - if (process.env.NODE_ENV !== 'production') { - isUpdatingChildComponent = true; + var options = Ctor.options; + // ensure the createElement function in functional components + // gets a unique context - this is necessary for correct named slot check + var contextVm; + if (hasOwn(parent, '_uid')) { + contextVm = Object.create(parent); + // $flow-disable-line + contextVm._original = parent; + } else { + // the context vm passed in is a functional context as well. + // in this case we want to make sure we are able to get a hold to the + // real context instance. + contextVm = parent; + // $flow-disable-line + parent = parent._original; } + var isCompiled = isTrue(options._compiled); + var needNormalization = !isCompiled; - // determine whether component has slot children - // we need to do this before overwriting $options._renderChildren. + this.data = data; + this.props = props; + this.children = children; + this.parent = parent; + this.listeners = data.on || emptyObject; + this.injections = resolveInject(options.inject, parent); + this.slots = function () { return resolveSlots(children, parent); }; - // check if there are dynamic scopedSlots (hand-written or compiled but with - // dynamic slot names). Static scoped slots compiled from template has the - // "$stable" marker. - var hasDynamicScopedSlot = !!( - (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || - (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) - ); - // Any static slot children from the parent may have changed during parent's - // update. Dynamic scoped slots may also have changed. In such cases, a forced - // update is necessary to ensure correctness. - var needsForceUpdate = !!( - renderChildren || // has new static slots - vm.$options._renderChildren || // has old static slots - hasDynamicScopedSlot - ); + Object.defineProperty(this, 'scopedSlots', ({ + enumerable: true, + get: function get () { + return normalizeScopedSlots(data.scopedSlots, this.slots()) + } + })); - vm.$options._parentVnode = parentVnode; - vm.$vnode = parentVnode; // update vm's placeholder node without re-render + // support for compiled functional template + if (isCompiled) { + // exposing $options for renderStatic() + this.$options = options; + // pre-resolve slots for renderSlot() + this.$slots = this.slots(); + this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); + } - if (vm._vnode) { // update child tree's parent - vm._vnode.parent = parentVnode; + if (options._scopeId) { + this._c = function (a, b, c, d) { + var vnode = createElement(contextVm, a, b, c, d, needNormalization); + if (vnode && !Array.isArray(vnode)) { + vnode.fnScopeId = options._scopeId; + vnode.fnContext = parent; + } + return vnode + }; + } else { + this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; } - vm.$options._renderChildren = renderChildren; +} - // update $attrs and $listeners hash - // these are also reactive so they may trigger child update if the child - // used them during render - vm.$attrs = parentVnode.data.attrs || emptyObject; - vm.$listeners = listeners || emptyObject; +installRenderHelpers(FunctionalRenderContext.prototype); - // update props - if (propsData && vm.$options.props) { - toggleObserving(false); - var props = vm._props; - var propKeys = vm.$options._propKeys || []; - for (var i = 0; i < propKeys.length; i++) { - var key = propKeys[i]; - var propOptions = vm.$options.props; // wtf flow? - props[key] = validateProp(key, propOptions, propsData, vm); +function createFunctionalComponent ( + Ctor, + propsData, + data, + contextVm, + children +) { + var options = Ctor.options; + var props = {}; + var propOptions = options.props; + if (isDef(propOptions)) { + for (var key in propOptions) { + props[key] = validateProp(key, propOptions, propsData || emptyObject); } - toggleObserving(true); - // keep a copy of raw propsData - vm.$options.propsData = propsData; + } else { + if (isDef(data.attrs)) { mergeProps(props, data.attrs); } + if (isDef(data.props)) { mergeProps(props, data.props); } } - // update listeners - listeners = listeners || emptyObject; - var oldListeners = vm.$options._parentListeners; - vm.$options._parentListeners = listeners; - updateComponentListeners(vm, listeners, oldListeners); + var renderContext = new FunctionalRenderContext( + data, + props, + children, + contextVm, + Ctor + ); - // resolve slots + force update if has children - if (needsForceUpdate) { - vm.$slots = resolveSlots(renderChildren, parentVnode.context); - vm.$forceUpdate(); + var vnode = options.render.call(null, renderContext._c, renderContext); + + if (vnode instanceof VNode) { + return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) + } else if (Array.isArray(vnode)) { + var vnodes = normalizeChildren(vnode) || []; + var res = new Array(vnodes.length); + for (var i = 0; i < vnodes.length; i++) { + res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); + } + return res } +} +function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { + // #7817 clone node before setting fnContext, otherwise if the node is reused + // (e.g. it was from a cached normal slot) the fnContext causes named slots + // that should not be matched to match. + var clone = cloneVNode(vnode); + clone.fnContext = contextVm; + clone.fnOptions = options; if (process.env.NODE_ENV !== 'production') { - isUpdatingChildComponent = false; + (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; } + if (data.slot) { + (clone.data || (clone.data = {})).slot = data.slot; + } + return clone } -function isInInactiveTree (vm) { - while (vm && (vm = vm.$parent)) { - if (vm._inactive) { return true } +function mergeProps (to, from) { + for (var key in from) { + to[camelize(key)] = from[key]; } - return false } -function activateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = false; - if (isInInactiveTree(vm)) { - return - } - } else if (vm._directInactive) { - return - } - if (vm._inactive || vm._inactive === null) { - vm._inactive = false; - for (var i = 0; i < vm.$children.length; i++) { - activateChildComponent(vm.$children[i]); +/* */ + +/* */ + +/* */ + +/* */ + +// inline hooks to be invoked on component VNodes during patch +var componentVNodeHooks = { + init: function init (vnode, hydrating) { + if ( + vnode.componentInstance && + !vnode.componentInstance._isDestroyed && + vnode.data.keepAlive + ) { + // kept-alive components, treat as a patch + var mountedNode = vnode; // work around flow + componentVNodeHooks.prepatch(mountedNode, mountedNode); + } else { + var child = vnode.componentInstance = createComponentInstanceForVnode( + vnode, + activeInstance + ); + child.$mount(hydrating ? vnode.elm : undefined, hydrating); } - callHook(vm, 'activated'); - } -} + }, -function deactivateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = true; - if (isInInactiveTree(vm)) { - return + prepatch: function prepatch (oldVnode, vnode) { + var options = vnode.componentOptions; + var child = vnode.componentInstance = oldVnode.componentInstance; + updateChildComponent( + child, + options.propsData, // updated props + options.listeners, // updated listeners + vnode, // new parent vnode + options.children // new children + ); + }, + + insert: function insert (vnode) { + var context = vnode.context; + var componentInstance = vnode.componentInstance; + if (!componentInstance._isMounted) { + componentInstance._isMounted = true; + callHook(componentInstance, 'mounted'); } - } - if (!vm._inactive) { - vm._inactive = true; - for (var i = 0; i < vm.$children.length; i++) { - deactivateChildComponent(vm.$children[i]); + if (vnode.data.keepAlive) { + if (context._isMounted) { + // vue-router#1212 + // During updates, a kept-alive component's child components may + // change, so directly walking the tree here may call activated hooks + // on incorrect children. Instead we push them into a queue which will + // be processed after the whole patch process ended. + queueActivatedComponent(componentInstance); + } else { + activateChildComponent(componentInstance, true /* direct */); + } } - callHook(vm, 'deactivated'); - } -} + }, -function callHook (vm, hook) { - // #7573 disable dep collection when invoking lifecycle hooks - pushTarget(); - var handlers = vm.$options[hook]; - var info = hook + " hook"; - if (handlers) { - for (var i = 0, j = handlers.length; i < j; i++) { - invokeWithErrorHandling(handlers[i], vm, null, vm, info); + destroy: function destroy (vnode) { + var componentInstance = vnode.componentInstance; + if (!componentInstance._isDestroyed) { + if (!vnode.data.keepAlive) { + componentInstance.$destroy(); + } else { + deactivateChildComponent(componentInstance, true /* direct */); + } } } - if (vm._hasHookEvent) { - vm.$emit('hook:' + hook); - } - popTarget(); -} +}; -/* */ +var hooksToMerge = Object.keys(componentVNodeHooks); -var MAX_UPDATE_COUNT = 100; +function createComponent ( + Ctor, + data, + context, + children, + tag +) { + if (isUndef(Ctor)) { + return + } -var queue = []; -var activatedChildren = []; -var has = {}; -var circular = {}; -var waiting = false; -var flushing = false; -var index = 0; + var baseCtor = context.$options._base; -/** - * Reset the scheduler's state. - */ -function resetSchedulerState () { - index = queue.length = activatedChildren.length = 0; - has = {}; - if (process.env.NODE_ENV !== 'production') { - circular = {}; + // plain options object: turn it into a constructor + if (isObject(Ctor)) { + Ctor = baseCtor.extend(Ctor); } - waiting = flushing = false; -} -// Async edge case #6566 requires saving the timestamp when event listeners are -// attached. However, calling performance.now() has a perf overhead especially -// if the page has thousands of event listeners. Instead, we take a timestamp -// every time the scheduler flushes and use that for all event listeners -// attached during that flush. -var currentFlushTimestamp = 0; + // if at this stage it's not a constructor or an async component factory, + // reject. + if (typeof Ctor !== 'function') { + if (process.env.NODE_ENV !== 'production') { + warn(("Invalid Component definition: " + (String(Ctor))), context); + } + return + } -// Async edge case fix requires storing an event listener's attach timestamp. -var getNow = Date.now; + // async component + var asyncFactory; + if (isUndef(Ctor.cid)) { + asyncFactory = Ctor; + Ctor = resolveAsyncComponent(asyncFactory, baseCtor); + if (Ctor === undefined) { + // return a placeholder node for async component, which is rendered + // as a comment node but preserves all the raw information for the node. + // the information will be used for async server-rendering and hydration. + return createAsyncPlaceholder( + asyncFactory, + data, + context, + children, + tag + ) + } + } -// Determine what event timestamp the browser is using. Annoyingly, the -// timestamp can either be hi-res ( relative to poge load) or low-res -// (relative to UNIX epoch), so in order to compare time we have to use the -// same timestamp type when saving the flush timestamp. -if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { - // if the low-res timestamp which is bigger than the event timestamp - // (which is evaluated AFTER) it means the event is using a hi-res timestamp, - // and we need to use the hi-res version for event listeners as well. - getNow = function () { return performance.now(); }; -} + data = data || {}; -/** - * Flush both queues and run the watchers. - */ -function flushSchedulerQueue () { - currentFlushTimestamp = getNow(); - flushing = true; - var watcher, id; + // resolve constructor options in case global mixins are applied after + // component constructor creation + resolveConstructorOptions(Ctor); - // Sort queue before flush. - // This ensures that: - // 1. Components are updated from parent to child. (because parent is always - // created before the child) - // 2. A component's user watchers are run before its render watcher (because - // user watchers are created before the render watcher) - // 3. If a component is destroyed during a parent component's watcher run, - // its watchers can be skipped. - queue.sort(function (a, b) { return a.id - b.id; }); + // transform component v-model data into props & events + if (isDef(data.model)) { + transformModel(Ctor.options, data); + } - // do not cache length because more watchers might be pushed - // as we run existing watchers - for (index = 0; index < queue.length; index++) { - watcher = queue[index]; - if (watcher.before) { - watcher.before(); - } - id = watcher.id; - has[id] = null; - watcher.run(); - // in dev build, check and stop circular updates. - if (process.env.NODE_ENV !== 'production' && has[id] != null) { - circular[id] = (circular[id] || 0) + 1; - if (circular[id] > MAX_UPDATE_COUNT) { - warn( - 'You may have an infinite update loop ' + ( - watcher.user - ? ("in watcher with expression \"" + (watcher.expression) + "\"") - : "in a component render function." - ), - watcher.vm - ); - break - } + // extract props + var propsData = extractPropsFromVNodeData(data, Ctor, tag); + + // functional component + if (isTrue(Ctor.options.functional)) { + return createFunctionalComponent(Ctor, propsData, data, context, children) + } + + // extract listeners, since these needs to be treated as + // child component listeners instead of DOM listeners + var listeners = data.on; + // replace with listeners with .native modifier + // so it gets processed during parent component patch. + data.on = data.nativeOn; + + if (isTrue(Ctor.options.abstract)) { + // abstract components do not keep anything + // other than props & listeners & slot + + // work around flow + var slot = data.slot; + data = {}; + if (slot) { + data.slot = slot; } } - // keep copies of post queues before resetting state - var activatedQueue = activatedChildren.slice(); - var updatedQueue = queue.slice(); + // install component management hooks onto the placeholder node + installComponentHooks(data); - resetSchedulerState(); + // return a placeholder vnode + var name = Ctor.options.name || tag; + var vnode = new VNode( + ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), + data, undefined, undefined, undefined, context, + { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, + asyncFactory + ); - // call component updated and activated hooks - callActivatedHooks(activatedQueue); - callUpdatedHooks(updatedQueue); + return vnode +} - // devtool hook - /* istanbul ignore if */ - if (devtools && config.devtools) { - devtools.emit('flush'); +function createComponentInstanceForVnode ( + vnode, // we know it's MountedComponentVNode but flow doesn't + parent // activeInstance in lifecycle state +) { + var options = { + _isComponent: true, + _parentVnode: vnode, + parent: parent + }; + // check inline-template render functions + var inlineTemplate = vnode.data.inlineTemplate; + if (isDef(inlineTemplate)) { + options.render = inlineTemplate.render; + options.staticRenderFns = inlineTemplate.staticRenderFns; } + return new vnode.componentOptions.Ctor(options) } -function callUpdatedHooks (queue) { - var i = queue.length; - while (i--) { - var watcher = queue[i]; - var vm = watcher.vm; - if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'updated'); +function installComponentHooks (data) { + var hooks = data.hook || (data.hook = {}); + for (var i = 0; i < hooksToMerge.length; i++) { + var key = hooksToMerge[i]; + var existing = hooks[key]; + var toMerge = componentVNodeHooks[key]; + if (existing !== toMerge && !(existing && existing._merged)) { + hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; } } } -/** - * Queue a kept-alive component that was activated during patch. - * The queue will be processed after the entire tree has been patched. - */ -function queueActivatedComponent (vm) { - // setting _inactive to false here so that a render function can - // rely on checking whether it's in an inactive tree (e.g. router-view) - vm._inactive = false; - activatedChildren.push(vm); -} - -function callActivatedHooks (queue) { - for (var i = 0; i < queue.length; i++) { - queue[i]._inactive = true; - activateChildComponent(queue[i], true /* true */); - } +function mergeHook$1 (f1, f2) { + var merged = function (a, b) { + // flow complains about extra args which is why we use any + f1(a, b); + f2(a, b); + }; + merged._merged = true; + return merged } -/** - * Push a watcher into the watcher queue. - * Jobs with duplicate IDs will be skipped unless it's - * pushed when the queue is being flushed. - */ -function queueWatcher (watcher) { - var id = watcher.id; - if (has[id] == null) { - has[id] = true; - if (!flushing) { - queue.push(watcher); - } else { - // if already flushing, splice the watcher based on its id - // if already past its id, it will be run next immediately. - var i = queue.length - 1; - while (i > index && queue[i].id > watcher.id) { - i--; - } - queue.splice(i + 1, 0, watcher); - } - // queue the flush - if (!waiting) { - waiting = true; - - if (process.env.NODE_ENV !== 'production' && !config.async) { - flushSchedulerQueue(); - return - } - nextTick(flushSchedulerQueue); +// transform component v-model info (value and callback) into +// prop and event handler respectively. +function transformModel (options, data) { + var prop = (options.model && options.model.prop) || 'value'; + var event = (options.model && options.model.event) || 'input' + ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; + var on = data.on || (data.on = {}); + var existing = on[event]; + var callback = data.model.callback; + if (isDef(existing)) { + if ( + Array.isArray(existing) + ? existing.indexOf(callback) === -1 + : existing !== callback + ) { + on[event] = [callback].concat(existing); } + } else { + on[event] = callback; } } /* */ +var SIMPLE_NORMALIZE = 1; +var ALWAYS_NORMALIZE = 2; +// wrapper function for providing a more flexible interface +// without getting yelled at by flow +function createElement ( + context, + tag, + data, + children, + normalizationType, + alwaysNormalize +) { + if (Array.isArray(data) || isPrimitive(data)) { + normalizationType = children; + children = data; + data = undefined; + } + if (isTrue(alwaysNormalize)) { + normalizationType = ALWAYS_NORMALIZE; + } + return _createElement(context, tag, data, children, normalizationType) +} -var uid$1 = 0; - -/** - * A watcher parses an expression, collects dependencies, - * and fires callback when the expression value changes. - * This is used for both the $watch() api and directives. - */ -var Watcher = function Watcher ( - vm, - expOrFn, - cb, - options, - isRenderWatcher +function _createElement ( + context, + tag, + data, + children, + normalizationType ) { - this.vm = vm; - if (isRenderWatcher) { - vm._watcher = this; + if (isDef(data) && isDef((data).__ob__)) { + process.env.NODE_ENV !== 'production' && warn( + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + + 'Always create fresh vnode data objects in each render!', + context + ); + return createEmptyVNode() } - vm._watchers.push(this); - // options - if (options) { - this.deep = !!options.deep; - this.user = !!options.user; - this.lazy = !!options.lazy; - this.sync = !!options.sync; - this.before = options.before; - } else { - this.deep = this.user = this.lazy = this.sync = false; + // object syntax in v-bind + if (isDef(data) && isDef(data.is)) { + tag = data.is; } - this.cb = cb; - this.id = ++uid$1; // uid for batching - this.active = true; - this.dirty = this.lazy; // for lazy watchers - this.deps = []; - this.newDeps = []; - this.depIds = new _Set(); - this.newDepIds = new _Set(); - this.expression = process.env.NODE_ENV !== 'production' - ? expOrFn.toString() - : ''; - // parse expression for getter - if (typeof expOrFn === 'function') { - this.getter = expOrFn; - } else { - this.getter = parsePath(expOrFn); - if (!this.getter) { - this.getter = noop; - process.env.NODE_ENV !== 'production' && warn( - "Failed watching path: \"" + expOrFn + "\" " + - 'Watcher only accepts simple dot-delimited paths. ' + - 'For full control, use a function instead.', - vm + if (!tag) { + // in case of component :is set to falsy value + return createEmptyVNode() + } + // warn against non-primitive key + if (process.env.NODE_ENV !== 'production' && + isDef(data) && isDef(data.key) && !isPrimitive(data.key) + ) { + { + warn( + 'Avoid using non-primitive value as key, ' + + 'use string/number value instead.', + context ); } } - this.value = this.lazy - ? undefined - : this.get(); -}; - -/** - * Evaluate the getter, and re-collect dependencies. - */ -Watcher.prototype.get = function get () { - pushTarget(this); - var value; - var vm = this.vm; - try { - value = this.getter.call(vm, vm); - } catch (e) { - if (this.user) { - handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); + // support single function children as default scoped slot + if (Array.isArray(children) && + typeof children[0] === 'function' + ) { + data = data || {}; + data.scopedSlots = { default: children[0] }; + children.length = 0; + } + if (normalizationType === ALWAYS_NORMALIZE) { + children = normalizeChildren(children); + } else if (normalizationType === SIMPLE_NORMALIZE) { + children = simpleNormalizeChildren(children); + } + var vnode, ns; + if (typeof tag === 'string') { + var Ctor; + ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); + if (config.isReservedTag(tag)) { + // platform built-in elements + vnode = new VNode( + config.parsePlatformTagName(tag), data, children, + undefined, undefined, context + ); + } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { + // component + vnode = createComponent(Ctor, data, context, children, tag); } else { - throw e - } - } finally { - // "touch" every property so they are all tracked as - // dependencies for deep watching - if (this.deep) { - traverse(value); + // unknown or unlisted namespaced elements + // check at runtime because it may get assigned a namespace when its + // parent normalizes children + vnode = new VNode( + tag, data, children, + undefined, undefined, context + ); } - popTarget(); - this.cleanupDeps(); + } else { + // direct component options / constructor + vnode = createComponent(tag, data, context, children); } - return value -}; + if (Array.isArray(vnode)) { + return vnode + } else if (isDef(vnode)) { + if (isDef(ns)) { applyNS(vnode, ns); } + if (isDef(data)) { registerDeepBindings(data); } + return vnode + } else { + return createEmptyVNode() + } +} -/** - * Add a dependency to this directive. - */ -Watcher.prototype.addDep = function addDep (dep) { - var id = dep.id; - if (!this.newDepIds.has(id)) { - this.newDepIds.add(id); - this.newDeps.push(dep); - if (!this.depIds.has(id)) { - dep.addSub(this); +function applyNS (vnode, ns, force) { + vnode.ns = ns; + if (vnode.tag === 'foreignObject') { + // use default namespace inside foreignObject + ns = undefined; + force = true; + } + if (isDef(vnode.children)) { + for (var i = 0, l = vnode.children.length; i < l; i++) { + var child = vnode.children[i]; + if (isDef(child.tag) && ( + isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { + applyNS(child, ns, force); + } } } -}; +} -/** - * Clean up for dependency collection. - */ -Watcher.prototype.cleanupDeps = function cleanupDeps () { - var i = this.deps.length; - while (i--) { - var dep = this.deps[i]; - if (!this.newDepIds.has(dep.id)) { - dep.removeSub(this); - } +// ref #5318 +// necessary to ensure parent re-render when deep bindings like :style and +// :class are used on slot nodes +function registerDeepBindings (data) { + if (isObject(data.style)) { + traverse(data.style); } - var tmp = this.depIds; - this.depIds = this.newDepIds; - this.newDepIds = tmp; - this.newDepIds.clear(); - tmp = this.deps; - this.deps = this.newDeps; - this.newDeps = tmp; - this.newDeps.length = 0; -}; + if (isObject(data.class)) { + traverse(data.class); + } +} + +/* */ + +function initRender (vm) { + vm._vnode = null; // the root of the child tree + vm._staticTrees = null; // v-once cached trees + var options = vm.$options; + var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree + var renderContext = parentVnode && parentVnode.context; + vm.$slots = resolveSlots(options._renderChildren, renderContext); + vm.$scopedSlots = emptyObject; + // bind the createElement fn to this instance + // so that we get proper render context inside it. + // args order: tag, data, children, normalizationType, alwaysNormalize + // internal version is used by render functions compiled from templates + vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; + // normalization is always applied for the public version, used in + // user-written render functions. + vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; + + // $attrs & $listeners are exposed for easier HOC creation. + // they need to be reactive so that HOCs using them are always updated + var parentData = parentVnode && parentVnode.data; -/** - * Subscriber interface. - * Will be called when a dependency changes. - */ -Watcher.prototype.update = function update () { /* istanbul ignore else */ - if (this.lazy) { - this.dirty = true; - } else if (this.sync) { - this.run(); + if (process.env.NODE_ENV !== 'production') { + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { + !isUpdatingChildComponent && warn("$attrs is readonly.", vm); + }, true); + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { + !isUpdatingChildComponent && warn("$listeners is readonly.", vm); + }, true); } else { - queueWatcher(this); + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true); + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true); } -}; +} -/** - * Scheduler job interface. - * Will be called by the scheduler. - */ -Watcher.prototype.run = function run () { - if (this.active) { - var value = this.get(); - if ( - value !== this.value || - // Deep watchers and watchers on Object/Arrays should fire even - // when the value is the same, because the value may - // have mutated. - isObject(value) || - this.deep - ) { - // set new value - var oldValue = this.value; - this.value = value; - if (this.user) { - try { - this.cb.call(this.vm, value, oldValue); - } catch (e) { - handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); - } - } else { - this.cb.call(this.vm, value, oldValue); - } - } - } -}; +var currentRenderingInstance = null; -/** - * Evaluate the value of the watcher. - * This only gets called for lazy watchers. - */ -Watcher.prototype.evaluate = function evaluate () { - this.value = this.get(); - this.dirty = false; -}; +function renderMixin (Vue) { + // install runtime convenience helpers + installRenderHelpers(Vue.prototype); -/** - * Depend on all deps collected by this watcher. - */ -Watcher.prototype.depend = function depend () { - var i = this.deps.length; - while (i--) { - this.deps[i].depend(); - } -}; + Vue.prototype.$nextTick = function (fn) { + return nextTick(fn, this) + }; -/** - * Remove self from all dependencies' subscriber list. - */ -Watcher.prototype.teardown = function teardown () { - if (this.active) { - // remove self from vm's watcher list - // this is a somewhat expensive operation so we skip it - // if the vm is being destroyed. - if (!this.vm._isBeingDestroyed) { - remove(this.vm._watchers, this); + Vue.prototype._render = function () { + var vm = this; + var ref = vm.$options; + var render = ref.render; + var _parentVnode = ref._parentVnode; + + if (_parentVnode) { + vm.$scopedSlots = normalizeScopedSlots( + _parentVnode.data.scopedSlots, + vm.$slots + ); + } + + // set parent vnode. this allows render functions to have access + // to the data on the placeholder node. + vm.$vnode = _parentVnode; + // render self + var vnode; + try { + // There's no need to maintain a stack becaues all render fns are called + // separately from one another. Nested component's render fns are called + // when parent component is patched. + currentRenderingInstance = vm; + vnode = render.call(vm._renderProxy, vm.$createElement); + } catch (e) { + handleError(e, vm, "render"); + // return error render result, + // or previous vnode to prevent render error causing blank component + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) { + try { + vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); + } catch (e) { + handleError(e, vm, "renderError"); + vnode = vm._vnode; + } + } else { + vnode = vm._vnode; + } + } finally { + currentRenderingInstance = null; } - var i = this.deps.length; - while (i--) { - this.deps[i].removeSub(this); + // if the returned array contains only a single node, allow it + if (Array.isArray(vnode) && vnode.length === 1) { + vnode = vnode[0]; } - this.active = false; - } -}; + // return empty vnode in case the render function errored out + if (!(vnode instanceof VNode)) { + if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) { + warn( + 'Multiple root nodes returned from render function. Render function ' + + 'should return a single root node.', + vm + ); + } + vnode = createEmptyVNode(); + } + // set parent + vnode.parent = _parentVnode; + return vnode + }; +} /* */ -var sharedPropertyDefinition = { - enumerable: true, - configurable: true, - get: noop, - set: noop -}; +function ensureCtor (comp, base) { + if ( + comp.__esModule || + (hasSymbol && comp[Symbol.toStringTag] === 'Module') + ) { + comp = comp.default; + } + return isObject(comp) + ? base.extend(comp) + : comp +} -function proxy (target, sourceKey, key) { - sharedPropertyDefinition.get = function proxyGetter () { - return this[sourceKey][key] - }; - sharedPropertyDefinition.set = function proxySetter (val) { - this[sourceKey][key] = val; - }; - Object.defineProperty(target, key, sharedPropertyDefinition); +function createAsyncPlaceholder ( + factory, + data, + context, + children, + tag +) { + var node = createEmptyVNode(); + node.asyncFactory = factory; + node.asyncMeta = { data: data, context: context, children: children, tag: tag }; + return node } -function initState (vm) { - vm._watchers = []; - var opts = vm.$options; - if (opts.props) { initProps(vm, opts.props); } - if (opts.methods) { initMethods(vm, opts.methods); } - if (opts.data) { - initData(vm); - } else { - observe(vm._data = {}, true /* asRootData */); +function resolveAsyncComponent ( + factory, + baseCtor +) { + if (isTrue(factory.error) && isDef(factory.errorComp)) { + return factory.errorComp } - if (opts.computed) { initComputed(vm, opts.computed); } - if (opts.watch && opts.watch !== nativeWatch) { - initWatch(vm, opts.watch); + + if (isDef(factory.resolved)) { + return factory.resolved } -} -function initProps (vm, propsOptions) { - var propsData = vm.$options.propsData || {}; - var props = vm._props = {}; - // cache prop keys so that future props updates can iterate using Array - // instead of dynamic object key enumeration. - var keys = vm.$options._propKeys = []; - var isRoot = !vm.$parent; - // root instance props should be converted - if (!isRoot) { - toggleObserving(false); + if (isTrue(factory.loading) && isDef(factory.loadingComp)) { + return factory.loadingComp } - var loop = function ( key ) { - keys.push(key); - var value = validateProp(key, propsOptions, propsData, vm); - /* istanbul ignore else */ - if (process.env.NODE_ENV !== 'production') { - var hyphenatedKey = hyphenate(key); - if (isReservedAttribute(hyphenatedKey) || - config.isReservedAttr(hyphenatedKey)) { - warn( - ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), - vm - ); + + var owner = currentRenderingInstance; + if (isDef(factory.owners)) { + // already pending + factory.owners.push(owner); + } else { + var owners = factory.owners = [owner]; + var sync = true; + + var forceRender = function (renderCompleted) { + for (var i = 0, l = owners.length; i < l; i++) { + (owners[i]).$forceUpdate(); } - defineReactive$$1(props, key, value, function () { - if (!isRoot && !isUpdatingChildComponent) { - warn( - "Avoid mutating a prop directly since the value will be " + - "overwritten whenever the parent component re-renders. " + - "Instead, use a data or computed property based on the prop's " + - "value. Prop being mutated: \"" + key + "\"", - vm - ); - } - }); - } else { - defineReactive$$1(props, key, value); - } - // static props are already proxied on the component's prototype - // during Vue.extend(). We only need to proxy props defined at - // instantiation here. - if (!(key in vm)) { - proxy(vm, "_props", key); - } - }; - for (var key in propsOptions) loop( key ); - toggleObserving(true); -} + if (renderCompleted) { + owners.length = 0; + } + }; -function initData (vm) { - var data = vm.$options.data; - data = vm._data = typeof data === 'function' - ? getData(data, vm) - : data || {}; - if (!isPlainObject(data)) { - data = {}; - process.env.NODE_ENV !== 'production' && warn( - 'data functions should return an object:\n' + - 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', - vm - ); - } - // proxy data on instance - var keys = Object.keys(data); - var props = vm.$options.props; - var methods = vm.$options.methods; - var i = keys.length; - while (i--) { - var key = keys[i]; - if (process.env.NODE_ENV !== 'production') { - if (methods && hasOwn(methods, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a data property."), - vm - ); + var resolve = once(function (res) { + // cache resolved + factory.resolved = ensureCtor(res, baseCtor); + // invoke callbacks only if this is not a synchronous resolve + // (async resolves are shimmed as synchronous during SSR) + if (!sync) { + forceRender(true); + } else { + owners.length = 0; } - } - if (props && hasOwn(props, key)) { + }); + + var reject = once(function (reason) { process.env.NODE_ENV !== 'production' && warn( - "The data property \"" + key + "\" is already declared as a prop. " + - "Use prop default value instead.", - vm + "Failed to resolve async component: " + (String(factory)) + + (reason ? ("\nReason: " + reason) : '') ); - } else if (!isReserved(key)) { - proxy(vm, "_data", key); - } - } - // observe data - observe(data, true /* asRootData */); -} - -function getData (data, vm) { - // #7573 disable dep collection when invoking data getters - pushTarget(); - try { - return data.call(vm, vm) - } catch (e) { - handleError(e, vm, "data()"); - return {} - } finally { - popTarget(); - } -} + if (isDef(factory.errorComp)) { + factory.error = true; + forceRender(true); + } + }); -var computedWatcherOptions = { lazy: true }; + var res = factory(resolve, reject); -function initComputed (vm, computed) { - // $flow-disable-line - var watchers = vm._computedWatchers = Object.create(null); - // computed properties are just getters during SSR - var isSSR = isServerRendering(); + if (isObject(res)) { + if (isPromise(res)) { + // () => Promise + if (isUndef(factory.resolved)) { + res.then(resolve, reject); + } + } else if (isPromise(res.component)) { + res.component.then(resolve, reject); - for (var key in computed) { - var userDef = computed[key]; - var getter = typeof userDef === 'function' ? userDef : userDef.get; - if (process.env.NODE_ENV !== 'production' && getter == null) { - warn( - ("Getter is missing for computed property \"" + key + "\"."), - vm - ); - } + if (isDef(res.error)) { + factory.errorComp = ensureCtor(res.error, baseCtor); + } - if (!isSSR) { - // create internal watcher for the computed property. - watchers[key] = new Watcher( - vm, - getter || noop, - noop, - computedWatcherOptions - ); - } + if (isDef(res.loading)) { + factory.loadingComp = ensureCtor(res.loading, baseCtor); + if (res.delay === 0) { + factory.loading = true; + } else { + setTimeout(function () { + if (isUndef(factory.resolved) && isUndef(factory.error)) { + factory.loading = true; + forceRender(false); + } + }, res.delay || 200); + } + } - // component-defined computed properties are already defined on the - // component prototype. We only need to define computed properties defined - // at instantiation here. - if (!(key in vm)) { - defineComputed(vm, key, userDef); - } else if (process.env.NODE_ENV !== 'production') { - if (key in vm.$data) { - warn(("The computed property \"" + key + "\" is already defined in data."), vm); - } else if (vm.$options.props && key in vm.$options.props) { - warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); + if (isDef(res.timeout)) { + setTimeout(function () { + if (isUndef(factory.resolved)) { + reject( + process.env.NODE_ENV !== 'production' + ? ("timeout (" + (res.timeout) + "ms)") + : null + ); + } + }, res.timeout); + } } } + + sync = false; + // return in case resolved synchronously + return factory.loading + ? factory.loadingComp + : factory.resolved } } -function defineComputed ( - target, - key, - userDef -) { - var shouldCache = !isServerRendering(); - if (typeof userDef === 'function') { - sharedPropertyDefinition.get = shouldCache - ? createComputedGetter(key) - : createGetterInvoker(userDef); - sharedPropertyDefinition.set = noop; - } else { - sharedPropertyDefinition.get = userDef.get - ? shouldCache && userDef.cache !== false - ? createComputedGetter(key) - : createGetterInvoker(userDef.get) - : noop; - sharedPropertyDefinition.set = userDef.set || noop; - } - if (process.env.NODE_ENV !== 'production' && - sharedPropertyDefinition.set === noop) { - sharedPropertyDefinition.set = function () { - warn( - ("Computed property \"" + key + "\" was assigned to but it has no setter."), - this - ); - }; - } - Object.defineProperty(target, key, sharedPropertyDefinition); +/* */ + +function isAsyncPlaceholder (node) { + return node.isComment && node.asyncFactory } -function createComputedGetter (key) { - return function computedGetter () { - var watcher = this._computedWatchers && this._computedWatchers[key]; - if (watcher) { - if (watcher.dirty) { - watcher.evaluate(); - } - if (Dep.target) { - watcher.depend(); +/* */ + +function getFirstComponentChild (children) { + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + var c = children[i]; + if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { + return c } - return watcher.value } } } -function createGetterInvoker(fn) { - return function computedGetter () { - return fn.call(this, this) +/* */ + +/* */ + +function initEvents (vm) { + vm._events = Object.create(null); + vm._hasHookEvent = false; + // init parent attached events + var listeners = vm.$options._parentListeners; + if (listeners) { + updateComponentListeners(vm, listeners); } } -function initMethods (vm, methods) { - var props = vm.$options.props; - for (var key in methods) { - if (process.env.NODE_ENV !== 'production') { - if (typeof methods[key] !== 'function') { - warn( - "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + - "Did you reference the function correctly?", - vm - ); - } - if (props && hasOwn(props, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a prop."), - vm - ); - } - if ((key in vm) && isReserved(key)) { - warn( - "Method \"" + key + "\" conflicts with an existing Vue instance method. " + - "Avoid defining component methods that start with _ or $." - ); - } - } - vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); - } +var target; + +function add (event, fn) { + target.$on(event, fn); } -function initWatch (vm, watch) { - for (var key in watch) { - var handler = watch[key]; - if (Array.isArray(handler)) { - for (var i = 0; i < handler.length; i++) { - createWatcher(vm, key, handler[i]); - } - } else { - createWatcher(vm, key, handler); +function remove$1 (event, fn) { + target.$off(event, fn); +} + +function createOnceHandler (event, fn) { + var _target = target; + return function onceHandler () { + var res = fn.apply(null, arguments); + if (res !== null) { + _target.$off(event, onceHandler); } } } -function createWatcher ( +function updateComponentListeners ( vm, - expOrFn, - handler, - options + listeners, + oldListeners ) { - if (isPlainObject(handler)) { - options = handler; - handler = handler.handler; - } - if (typeof handler === 'string') { - handler = vm[handler]; - } - return vm.$watch(expOrFn, handler, options) + target = vm; + updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); + target = undefined; } -function stateMixin (Vue) { - // flow somehow has problems with directly declared definition object - // when using Object.defineProperty, so we have to procedurally build up - // the object here. - var dataDef = {}; - dataDef.get = function () { return this._data }; - var propsDef = {}; - propsDef.get = function () { return this._props }; - if (process.env.NODE_ENV !== 'production') { - dataDef.set = function () { - warn( - 'Avoid replacing instance root $data. ' + - 'Use nested data properties instead.', - this - ); - }; - propsDef.set = function () { - warn("$props is readonly.", this); - }; - } - Object.defineProperty(Vue.prototype, '$data', dataDef); - Object.defineProperty(Vue.prototype, '$props', propsDef); +function eventsMixin (Vue) { + var hookRE = /^hook:/; + Vue.prototype.$on = function (event, fn) { + var vm = this; + if (Array.isArray(event)) { + for (var i = 0, l = event.length; i < l; i++) { + vm.$on(event[i], fn); + } + } else { + (vm._events[event] || (vm._events[event] = [])).push(fn); + // optimize hook:event cost by using a boolean flag marked at registration + // instead of a hash lookup + if (hookRE.test(event)) { + vm._hasHookEvent = true; + } + } + return vm + }; - Vue.prototype.$set = set; - Vue.prototype.$delete = del; + Vue.prototype.$once = function (event, fn) { + var vm = this; + function on () { + vm.$off(event, on); + fn.apply(vm, arguments); + } + on.fn = fn; + vm.$on(event, on); + return vm + }; - Vue.prototype.$watch = function ( - expOrFn, - cb, - options - ) { + Vue.prototype.$off = function (event, fn) { var vm = this; - if (isPlainObject(cb)) { - return createWatcher(vm, expOrFn, cb, options) + // all + if (!arguments.length) { + vm._events = Object.create(null); + return vm } - options = options || {}; - options.user = true; - var watcher = new Watcher(vm, expOrFn, cb, options); - if (options.immediate) { - try { - cb.call(vm, watcher.value); - } catch (error) { - handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); + // array of events + if (Array.isArray(event)) { + for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { + vm.$off(event[i$1], fn); + } + return vm + } + // specific event + var cbs = vm._events[event]; + if (!cbs) { + return vm + } + if (!fn) { + vm._events[event] = null; + return vm + } + // specific handler + var cb; + var i = cbs.length; + while (i--) { + cb = cbs[i]; + if (cb === fn || cb.fn === fn) { + cbs.splice(i, 1); + break } } - return function unwatchFn () { - watcher.teardown(); + return vm + }; + + Vue.prototype.$emit = function (event) { + var vm = this; + if (process.env.NODE_ENV !== 'production') { + var lowerCaseEvent = event.toLowerCase(); + if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { + tip( + "Event \"" + lowerCaseEvent + "\" is emitted in component " + + (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + + "Note that HTML attributes are case-insensitive and you cannot use " + + "v-on to listen to camelCase events when using in-DOM templates. " + + "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." + ); + } + } + var cbs = vm._events[event]; + if (cbs) { + cbs = cbs.length > 1 ? toArray(cbs) : cbs; + var args = toArray(arguments, 1); + var info = "event handler for \"" + event + "\""; + for (var i = 0, l = cbs.length; i < l; i++) { + invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } } + return vm }; } /* */ -function initProvide (vm) { - var provide = vm.$options.provide; - if (provide) { - vm._provided = typeof provide === 'function' - ? provide.call(vm) - : provide; - } -} +var activeInstance = null; +var isUpdatingChildComponent = false; -function initInjections (vm) { - var result = resolveInject(vm.$options.inject, vm); - if (result) { - toggleObserving(false); - Object.keys(result).forEach(function (key) { - /* istanbul ignore else */ - if (process.env.NODE_ENV !== 'production') { - defineReactive$$1(vm, key, result[key], function () { - warn( - "Avoid mutating an injected value directly since the changes will be " + - "overwritten whenever the provided component re-renders. " + - "injection being mutated: \"" + key + "\"", - vm - ); - }); - } else { - defineReactive$$1(vm, key, result[key]); - } - }); - toggleObserving(true); +function setActiveInstance(vm) { + var prevActiveInstance = activeInstance; + activeInstance = vm; + return function () { + activeInstance = prevActiveInstance; } } -function resolveInject (inject, vm) { - if (inject) { - // inject is :any because flow is not smart enough to figure out cached - var result = Object.create(null); - var keys = hasSymbol - ? Reflect.ownKeys(inject) - : Object.keys(inject); +function initLifecycle (vm) { + var options = vm.$options; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - // #6574 in case the inject object is observed... - if (key === '__ob__') { continue } - var provideKey = inject[key].from; - var source = vm; - while (source) { - if (source._provided && hasOwn(source._provided, provideKey)) { - result[key] = source._provided[provideKey]; - break - } - source = source.$parent; - } - if (!source) { - if ('default' in inject[key]) { - var provideDefault = inject[key].default; - result[key] = typeof provideDefault === 'function' - ? provideDefault.call(vm) - : provideDefault; - } else if (process.env.NODE_ENV !== 'production') { - warn(("Injection \"" + key + "\" not found"), vm); - } - } + // locate first non-abstract parent + var parent = options.parent; + if (parent && !options.abstract) { + while (parent.$options.abstract && parent.$parent) { + parent = parent.$parent; } - return result + parent.$children.push(vm); } -} - -/* */ -function normalizeScopedSlots ( - slots, - normalSlots -) { - var res; - if (!slots) { - res = {}; - } else if (slots._normalized) { - return slots - } else { - res = {}; - for (var key in slots) { - if (slots[key] && key[0] !== '$') { - res[key] = normalizeScopedSlot(normalSlots, key, slots[key]); - } - } - } - // expose normal slots on scopedSlots - for (var key$1 in normalSlots) { - if (!(key$1 in res)) { - res[key$1] = proxyNormalSlot(normalSlots, key$1); - } - } - res._normalized = true; - res.$stable = slots ? slots.$stable : true; - return res -} + vm.$parent = parent; + vm.$root = parent ? parent.$root : vm; -function normalizeScopedSlot(normalSlots, key, fn) { - var normalized = function (scope) { - if ( scope === void 0 ) scope = {}; + vm.$children = []; + vm.$refs = {}; - var res = fn(scope); - return res && typeof res === 'object' && !Array.isArray(res) - ? [res] // single vnode - : normalizeChildren(res) - }; - // proxy scoped slots on normal $slots - if (!hasOwn(normalSlots, key)) { - Object.defineProperty(normalSlots, key, { - get: normalized - }); - } - return normalized + vm._watcher = null; + vm._inactive = null; + vm._directInactive = false; + vm._isMounted = false; + vm._isDestroyed = false; + vm._isBeingDestroyed = false; } -function proxyNormalSlot(slots, key) { - return function () { return slots[key]; } -} +function lifecycleMixin (Vue) { + Vue.prototype._update = function (vnode, hydrating) { + var vm = this; + var prevEl = vm.$el; + var prevVnode = vm._vnode; + var restoreActiveInstance = setActiveInstance(vm); + vm._vnode = vnode; + // Vue.prototype.__patch__ is injected in entry points + // based on the rendering backend used. + if (!prevVnode) { + // initial render + vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); + } else { + // updates + vm.$el = vm.__patch__(prevVnode, vnode); + } + restoreActiveInstance(); + // update __vue__ reference + if (prevEl) { + prevEl.__vue__ = null; + } + if (vm.$el) { + vm.$el.__vue__ = vm; + } + // if parent is an HOC, update its $el as well + if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { + vm.$parent.$el = vm.$el; + } + // updated hook is called by the scheduler to ensure that children are + // updated in a parent's updated hook. + }; -/* */ + Vue.prototype.$forceUpdate = function () { + var vm = this; + if (vm._watcher) { + vm._watcher.update(); + } + }; -/** - * Runtime helper for rendering v-for lists. - */ -function renderList ( - val, - render -) { - var ret, i, l, keys, key; - if (Array.isArray(val) || typeof val === 'string') { - ret = new Array(val.length); - for (i = 0, l = val.length; i < l; i++) { - ret[i] = render(val[i], i); + Vue.prototype.$destroy = function () { + var vm = this; + if (vm._isBeingDestroyed) { + return } - } else if (typeof val === 'number') { - ret = new Array(val); - for (i = 0; i < val; i++) { - ret[i] = render(i + 1, i); + callHook(vm, 'beforeDestroy'); + vm._isBeingDestroyed = true; + // remove self from parent + var parent = vm.$parent; + if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { + remove(parent.$children, vm); } - } else if (isObject(val)) { - if (hasSymbol && val[Symbol.iterator]) { - ret = []; - var iterator = val[Symbol.iterator](); - var result = iterator.next(); - while (!result.done) { - ret.push(render(result.value, ret.length)); - result = iterator.next(); - } - } else { - keys = Object.keys(val); - ret = new Array(keys.length); - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - ret[i] = render(val[key], key, i); - } + // teardown watchers + if (vm._watcher) { + vm._watcher.teardown(); + } + var i = vm._watchers.length; + while (i--) { + vm._watchers[i].teardown(); + } + // remove reference from data ob + // frozen object may not have observer. + if (vm._data.__ob__) { + vm._data.__ob__.vmCount--; + } + // call the last hook... + vm._isDestroyed = true; + // invoke destroy hooks on current rendered tree + vm.__patch__(vm._vnode, null); + // fire destroyed hook + callHook(vm, 'destroyed'); + // turn off all instance listeners. + vm.$off(); + // remove __vue__ reference + if (vm.$el) { + vm.$el.__vue__ = null; } - } - if (!isDef(ret)) { - ret = []; - } - (ret)._isVList = true; - return ret + // release circular reference (#6759) + if (vm.$vnode) { + vm.$vnode.parent = null; + } + }; } -/* */ - -/** - * Runtime helper for rendering - */ -function renderSlot ( - name, - fallback, - props, - bindObject +function mountComponent ( + vm, + el, + hydrating ) { - var scopedSlotFn = this.$scopedSlots[name]; - var nodes; - if (scopedSlotFn) { // scoped slot - props = props || {}; - if (bindObject) { - if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) { + vm.$el = el; + if (!vm.$options.render) { + vm.$options.render = createEmptyVNode; + if (process.env.NODE_ENV !== 'production') { + /* istanbul ignore if */ + if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || + vm.$options.el || el) { warn( - 'slot v-bind without argument expects an Object', - this + 'You are using the runtime-only build of Vue where the template ' + + 'compiler is not available. Either pre-compile the templates into ' + + 'render functions, or use the compiler-included build.', + vm + ); + } else { + warn( + 'Failed to mount component: template or render function not defined.', + vm ); } - props = extend(extend({}, bindObject), props); } - nodes = scopedSlotFn(props) || fallback; - } else { - nodes = this.$slots[name] || fallback; } + callHook(vm, 'beforeMount'); - var target = props && props.slot; - if (target) { - return this.$createElement('template', { slot: target }, nodes) - } else { - return nodes - } -} + var updateComponent; + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && config.performance && mark) { + updateComponent = function () { + var name = vm._name; + var id = vm._uid; + var startTag = "vue-perf-start:" + id; + var endTag = "vue-perf-end:" + id; -/* */ + mark(startTag); + var vnode = vm._render(); + mark(endTag); + measure(("vue " + name + " render"), startTag, endTag); -/** - * Runtime helper for resolving filters - */ -function resolveFilter (id) { - return resolveAsset(this.$options, 'filters', id, true) || identity -} + mark(startTag); + vm._update(vnode, hydrating); + mark(endTag); + measure(("vue " + name + " patch"), startTag, endTag); + }; + } else { + updateComponent = function () { + vm._update(vm._render(), hydrating); + }; + } -/* */ + // we set this to vm._watcher inside the watcher's constructor + // since the watcher's initial patch may call $forceUpdate (e.g. inside child + // component's mounted hook), which relies on vm._watcher being already defined + new Watcher(vm, updateComponent, noop, { + before: function before () { + if (vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'beforeUpdate'); + } + } + }, true /* isRenderWatcher */); + hydrating = false; -function isKeyNotMatch (expect, actual) { - if (Array.isArray(expect)) { - return expect.indexOf(actual) === -1 - } else { - return expect !== actual + // manually mounted instance, call mounted on self + // mounted is called for render-created child components in its inserted hook + if (vm.$vnode == null) { + vm._isMounted = true; + callHook(vm, 'mounted'); } + return vm } -/** - * Runtime helper for checking keyCodes from config. - * exposed as Vue.prototype._k - * passing in eventKeyName as last argument separately for backwards compat - */ -function checkKeyCodes ( - eventKeyCode, - key, - builtInKeyCode, - eventKeyName, - builtInKeyName +function updateChildComponent ( + vm, + propsData, + listeners, + parentVnode, + renderChildren ) { - var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; - if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { - return isKeyNotMatch(builtInKeyName, eventKeyName) - } else if (mappedKeyCode) { - return isKeyNotMatch(mappedKeyCode, eventKeyCode) - } else if (eventKeyName) { - return hyphenate(eventKeyName) !== key + if (process.env.NODE_ENV !== 'production') { + isUpdatingChildComponent = true; } -} -/* */ + // determine whether component has slot children + // we need to do this before overwriting $options._renderChildren. -/** - * Runtime helper for merging v-bind="object" into a VNode's data. - */ -function bindObjectProps ( - data, - tag, - value, - asProp, - isSync -) { - if (value) { - if (!isObject(value)) { - process.env.NODE_ENV !== 'production' && warn( - 'v-bind without argument expects an Object or Array value', - this - ); - } else { - if (Array.isArray(value)) { - value = toObject(value); - } - var hash; - var loop = function ( key ) { - if ( - key === 'class' || - key === 'style' || - isReservedAttribute(key) - ) { - hash = data; - } else { - var type = data.attrs && data.attrs.type; - hash = asProp || config.mustUseProp(tag, type, key) - ? data.domProps || (data.domProps = {}) - : data.attrs || (data.attrs = {}); - } - var camelizedKey = camelize(key); - if (!(key in hash) && !(camelizedKey in hash)) { - hash[key] = value[key]; + // check if there are dynamic scopedSlots (hand-written or compiled but with + // dynamic slot names). Static scoped slots compiled from template has the + // "$stable" marker. + var hasDynamicScopedSlot = !!( + (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || + (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) + ); - if (isSync) { - var on = data.on || (data.on = {}); - on[("update:" + camelizedKey)] = function ($event) { - value[key] = $event; - }; - } - } - }; + // Any static slot children from the parent may have changed during parent's + // update. Dynamic scoped slots may also have changed. In such cases, a forced + // update is necessary to ensure correctness. + var needsForceUpdate = !!( + renderChildren || // has new static slots + vm.$options._renderChildren || // has old static slots + hasDynamicScopedSlot + ); - for (var key in value) loop( key ); + vm.$options._parentVnode = parentVnode; + vm.$vnode = parentVnode; // update vm's placeholder node without re-render + + if (vm._vnode) { // update child tree's parent + vm._vnode.parent = parentVnode; + } + vm.$options._renderChildren = renderChildren; + + // update $attrs and $listeners hash + // these are also reactive so they may trigger child update if the child + // used them during render + vm.$attrs = parentVnode.data.attrs || emptyObject; + vm.$listeners = listeners || emptyObject; + + // update props + if (propsData && vm.$options.props) { + toggleObserving(false); + var props = vm._props; + var propKeys = vm.$options._propKeys || []; + for (var i = 0; i < propKeys.length; i++) { + var key = propKeys[i]; + var propOptions = vm.$options.props; // wtf flow? + props[key] = validateProp(key, propOptions, propsData, vm); } + toggleObserving(true); + // keep a copy of raw propsData + vm.$options.propsData = propsData; } - return data -} -/* */ + // update listeners + listeners = listeners || emptyObject; + var oldListeners = vm.$options._parentListeners; + vm.$options._parentListeners = listeners; + updateComponentListeners(vm, listeners, oldListeners); -/** - * Runtime helper for rendering static trees. - */ -function renderStatic ( - index, - isInFor -) { - var cached = this._staticTrees || (this._staticTrees = []); - var tree = cached[index]; - // if has already-rendered static tree and not inside v-for, - // we can reuse the same tree. - if (tree && !isInFor) { - return tree + // resolve slots + force update if has children + if (needsForceUpdate) { + vm.$slots = resolveSlots(renderChildren, parentVnode.context); + vm.$forceUpdate(); + } + + if (process.env.NODE_ENV !== 'production') { + isUpdatingChildComponent = false; } - // otherwise, render a fresh tree. - tree = cached[index] = this.$options.staticRenderFns[index].call( - this._renderProxy, - null, - this // for render fns generated for functional component templates - ); - markStatic(tree, ("__static__" + index), false); - return tree } -/** - * Runtime helper for v-once. - * Effectively it means marking the node as static with a unique key. - */ -function markOnce ( - tree, - index, - key -) { - markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); - return tree +function isInInactiveTree (vm) { + while (vm && (vm = vm.$parent)) { + if (vm._inactive) { return true } + } + return false } -function markStatic ( - tree, - key, - isOnce -) { - if (Array.isArray(tree)) { - for (var i = 0; i < tree.length; i++) { - if (tree[i] && typeof tree[i] !== 'string') { - markStaticNode(tree[i], (key + "_" + i), isOnce); - } +function activateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = false; + if (isInInactiveTree(vm)) { + return } - } else { - markStaticNode(tree, key, isOnce); + } else if (vm._directInactive) { + return + } + if (vm._inactive || vm._inactive === null) { + vm._inactive = false; + for (var i = 0; i < vm.$children.length; i++) { + activateChildComponent(vm.$children[i]); + } + callHook(vm, 'activated'); } } -function markStaticNode (node, key, isOnce) { - node.isStatic = true; - node.key = key; - node.isOnce = isOnce; +function deactivateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = true; + if (isInInactiveTree(vm)) { + return + } + } + if (!vm._inactive) { + vm._inactive = true; + for (var i = 0; i < vm.$children.length; i++) { + deactivateChildComponent(vm.$children[i]); + } + callHook(vm, 'deactivated'); + } } -/* */ - -function bindObjectListeners (data, value) { - if (value) { - if (!isPlainObject(value)) { - process.env.NODE_ENV !== 'production' && warn( - 'v-on without argument expects an Object value', - this - ); - } else { - var on = data.on = data.on ? extend({}, data.on) : {}; - for (var key in value) { - var existing = on[key]; - var ours = value[key]; - on[key] = existing ? [].concat(existing, ours) : ours; - } +function callHook (vm, hook) { + // #7573 disable dep collection when invoking lifecycle hooks + pushTarget(); + var handlers = vm.$options[hook]; + var info = hook + " hook"; + if (handlers) { + for (var i = 0, j = handlers.length; i < j; i++) { + invokeWithErrorHandling(handlers[i], vm, null, vm, info); } } - return data + if (vm._hasHookEvent) { + vm.$emit('hook:' + hook); + } + popTarget(); } /* */ -function bindDynamicKeys (baseObj, values) { - for (var i = 0; i < values.length; i += 2) { - var key = values[i]; - if (typeof key === 'string' && key) { - baseObj[values[i]] = values[i + 1]; - } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) { - // null is a speical value for explicitly removing a binding - warn( - ("Invalid value for dynamic directive argument (expected string or null): " + key), - this - ); - } +var MAX_UPDATE_COUNT = 100; + +var queue = []; +var activatedChildren = []; +var has = {}; +var circular = {}; +var waiting = false; +var flushing = false; +var index = 0; + +/** + * Reset the scheduler's state. + */ +function resetSchedulerState () { + index = queue.length = activatedChildren.length = 0; + has = {}; + if (process.env.NODE_ENV !== 'production') { + circular = {}; } - return baseObj + waiting = flushing = false; } -// helper to dynamically append modifier runtime markers to event names. -// ensure only append when value is already string, otherwise it will be cast -// to string and cause the type check to miss. -function prependModifier (value, symbol) { - return typeof value === 'string' ? symbol + value : value -} +// Async edge case #6566 requires saving the timestamp when event listeners are +// attached. However, calling performance.now() has a perf overhead especially +// if the page has thousands of event listeners. Instead, we take a timestamp +// every time the scheduler flushes and use that for all event listeners +// attached during that flush. +var currentFlushTimestamp = 0; -/* */ +// Async edge case fix requires storing an event listener's attach timestamp. +var getNow = Date.now; -function installRenderHelpers (target) { - target._o = markOnce; - target._n = toNumber; - target._s = toString; - target._l = renderList; - target._t = renderSlot; - target._q = looseEqual; - target._i = looseIndexOf; - target._m = renderStatic; - target._f = resolveFilter; - target._k = checkKeyCodes; - target._b = bindObjectProps; - target._v = createTextVNode; - target._e = createEmptyVNode; - target._u = resolveScopedSlots; - target._g = bindObjectListeners; - target._d = bindDynamicKeys; - target._p = prependModifier; +// Determine what event timestamp the browser is using. Annoyingly, the +// timestamp can either be hi-res (relative to page load) or low-res +// (relative to UNIX epoch), so in order to compare time we have to use the +// same timestamp type when saving the flush timestamp. +if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { + // if the low-res timestamp which is bigger than the event timestamp + // (which is evaluated AFTER) it means the event is using a hi-res timestamp, + // and we need to use the hi-res version for event listeners as well. + getNow = function () { return performance.now(); }; } -/* */ - -function FunctionalRenderContext ( - data, - props, - children, - parent, - Ctor -) { - var options = Ctor.options; - // ensure the createElement function in functional components - // gets a unique context - this is necessary for correct named slot check - var contextVm; - if (hasOwn(parent, '_uid')) { - contextVm = Object.create(parent); - // $flow-disable-line - contextVm._original = parent; - } else { - // the context vm passed in is a functional context as well. - // in this case we want to make sure we are able to get a hold to the - // real context instance. - contextVm = parent; - // $flow-disable-line - parent = parent._original; - } - var isCompiled = isTrue(options._compiled); - var needNormalization = !isCompiled; +/** + * Flush both queues and run the watchers. + */ +function flushSchedulerQueue () { + currentFlushTimestamp = getNow(); + flushing = true; + var watcher, id; - this.data = data; - this.props = props; - this.children = children; - this.parent = parent; - this.listeners = data.on || emptyObject; - this.injections = resolveInject(options.inject, parent); - this.slots = function () { return resolveSlots(children, parent); }; + // Sort queue before flush. + // This ensures that: + // 1. Components are updated from parent to child. (because parent is always + // created before the child) + // 2. A component's user watchers are run before its render watcher (because + // user watchers are created before the render watcher) + // 3. If a component is destroyed during a parent component's watcher run, + // its watchers can be skipped. + queue.sort(function (a, b) { return a.id - b.id; }); - Object.defineProperty(this, 'scopedSlots', ({ - enumerable: true, - get: function get () { - return normalizeScopedSlots(data.scopedSlots, this.slots()) + // do not cache length because more watchers might be pushed + // as we run existing watchers + for (index = 0; index < queue.length; index++) { + watcher = queue[index]; + if (watcher.before) { + watcher.before(); } - })); - - // support for compiled functional template - if (isCompiled) { - // exposing $options for renderStatic() - this.$options = options; - // pre-resolve slots for renderSlot() - this.$slots = this.slots(); - this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); - } - - if (options._scopeId) { - this._c = function (a, b, c, d) { - var vnode = createElement(contextVm, a, b, c, d, needNormalization); - if (vnode && !Array.isArray(vnode)) { - vnode.fnScopeId = options._scopeId; - vnode.fnContext = parent; + id = watcher.id; + has[id] = null; + watcher.run(); + // in dev build, check and stop circular updates. + if (process.env.NODE_ENV !== 'production' && has[id] != null) { + circular[id] = (circular[id] || 0) + 1; + if (circular[id] > MAX_UPDATE_COUNT) { + warn( + 'You may have an infinite update loop ' + ( + watcher.user + ? ("in watcher with expression \"" + (watcher.expression) + "\"") + : "in a component render function." + ), + watcher.vm + ); + break } - return vnode - }; - } else { - this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; + } } -} -installRenderHelpers(FunctionalRenderContext.prototype); + // keep copies of post queues before resetting state + var activatedQueue = activatedChildren.slice(); + var updatedQueue = queue.slice(); -function createFunctionalComponent ( - Ctor, - propsData, - data, - contextVm, - children -) { - var options = Ctor.options; - var props = {}; - var propOptions = options.props; - if (isDef(propOptions)) { - for (var key in propOptions) { - props[key] = validateProp(key, propOptions, propsData || emptyObject); - } - } else { - if (isDef(data.attrs)) { mergeProps(props, data.attrs); } - if (isDef(data.props)) { mergeProps(props, data.props); } - } + resetSchedulerState(); - var renderContext = new FunctionalRenderContext( - data, - props, - children, - contextVm, - Ctor - ); + // call component updated and activated hooks + callActivatedHooks(activatedQueue); + callUpdatedHooks(updatedQueue); - var vnode = options.render.call(null, renderContext._c, renderContext); + // devtool hook + /* istanbul ignore if */ + if (devtools && config.devtools) { + devtools.emit('flush'); + } +} - if (vnode instanceof VNode) { - return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) - } else if (Array.isArray(vnode)) { - var vnodes = normalizeChildren(vnode) || []; - var res = new Array(vnodes.length); - for (var i = 0; i < vnodes.length; i++) { - res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); +function callUpdatedHooks (queue) { + var i = queue.length; + while (i--) { + var watcher = queue[i]; + var vm = watcher.vm; + if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'updated'); } - return res } } -function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { - // #7817 clone node before setting fnContext, otherwise if the node is reused - // (e.g. it was from a cached normal slot) the fnContext causes named slots - // that should not be matched to match. - var clone = cloneVNode(vnode); - clone.fnContext = contextVm; - clone.fnOptions = options; - if (process.env.NODE_ENV !== 'production') { - (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; - } - if (data.slot) { - (clone.data || (clone.data = {})).slot = data.slot; - } - return clone +/** + * Queue a kept-alive component that was activated during patch. + * The queue will be processed after the entire tree has been patched. + */ +function queueActivatedComponent (vm) { + // setting _inactive to false here so that a render function can + // rely on checking whether it's in an inactive tree (e.g. router-view) + vm._inactive = false; + activatedChildren.push(vm); } -function mergeProps (to, from) { - for (var key in from) { - to[camelize(key)] = from[key]; +function callActivatedHooks (queue) { + for (var i = 0; i < queue.length; i++) { + queue[i]._inactive = true; + activateChildComponent(queue[i], true /* true */); } } -/* */ +/** + * Push a watcher into the watcher queue. + * Jobs with duplicate IDs will be skipped unless it's + * pushed when the queue is being flushed. + */ +function queueWatcher (watcher) { + var id = watcher.id; + if (has[id] == null) { + has[id] = true; + if (!flushing) { + queue.push(watcher); + } else { + // if already flushing, splice the watcher based on its id + // if already past its id, it will be run next immediately. + var i = queue.length - 1; + while (i > index && queue[i].id > watcher.id) { + i--; + } + queue.splice(i + 1, 0, watcher); + } + // queue the flush + if (!waiting) { + waiting = true; -/* */ + if (process.env.NODE_ENV !== 'production' && !config.async) { + flushSchedulerQueue(); + return + } + nextTick(flushSchedulerQueue); + } + } +} /* */ -/* */ -// inline hooks to be invoked on component VNodes during patch -var componentVNodeHooks = { - init: function init (vnode, hydrating) { - if ( - vnode.componentInstance && - !vnode.componentInstance._isDestroyed && - vnode.data.keepAlive - ) { - // kept-alive components, treat as a patch - var mountedNode = vnode; // work around flow - componentVNodeHooks.prepatch(mountedNode, mountedNode); - } else { - var child = vnode.componentInstance = createComponentInstanceForVnode( - vnode, - activeInstance - ); - child.$mount(hydrating ? vnode.elm : undefined, hydrating); - } - }, - prepatch: function prepatch (oldVnode, vnode) { - var options = vnode.componentOptions; - var child = vnode.componentInstance = oldVnode.componentInstance; - updateChildComponent( - child, - options.propsData, // updated props - options.listeners, // updated listeners - vnode, // new parent vnode - options.children // new children - ); - }, +var uid$2 = 0; - insert: function insert (vnode) { - var context = vnode.context; - var componentInstance = vnode.componentInstance; - if (!componentInstance._isMounted) { - componentInstance._isMounted = true; - callHook(componentInstance, 'mounted'); - } - if (vnode.data.keepAlive) { - if (context._isMounted) { - // vue-router#1212 - // During updates, a kept-alive component's child components may - // change, so directly walking the tree here may call activated hooks - // on incorrect children. Instead we push them into a queue which will - // be processed after the whole patch process ended. - queueActivatedComponent(componentInstance); - } else { - activateChildComponent(componentInstance, true /* direct */); - } +/** + * A watcher parses an expression, collects dependencies, + * and fires callback when the expression value changes. + * This is used for both the $watch() api and directives. + */ +var Watcher = function Watcher ( + vm, + expOrFn, + cb, + options, + isRenderWatcher +) { + this.vm = vm; + if (isRenderWatcher) { + vm._watcher = this; + } + vm._watchers.push(this); + // options + if (options) { + this.deep = !!options.deep; + this.user = !!options.user; + this.lazy = !!options.lazy; + this.sync = !!options.sync; + this.before = options.before; + } else { + this.deep = this.user = this.lazy = this.sync = false; + } + this.cb = cb; + this.id = ++uid$2; // uid for batching + this.active = true; + this.dirty = this.lazy; // for lazy watchers + this.deps = []; + this.newDeps = []; + this.depIds = new _Set(); + this.newDepIds = new _Set(); + this.expression = process.env.NODE_ENV !== 'production' + ? expOrFn.toString() + : ''; + // parse expression for getter + if (typeof expOrFn === 'function') { + this.getter = expOrFn; + } else { + this.getter = parsePath(expOrFn); + if (!this.getter) { + this.getter = noop; + process.env.NODE_ENV !== 'production' && warn( + "Failed watching path: \"" + expOrFn + "\" " + + 'Watcher only accepts simple dot-delimited paths. ' + + 'For full control, use a function instead.', + vm + ); } - }, + } + this.value = this.lazy + ? undefined + : this.get(); +}; - destroy: function destroy (vnode) { - var componentInstance = vnode.componentInstance; - if (!componentInstance._isDestroyed) { - if (!vnode.data.keepAlive) { - componentInstance.$destroy(); - } else { - deactivateChildComponent(componentInstance, true /* direct */); - } +/** + * Evaluate the getter, and re-collect dependencies. + */ +Watcher.prototype.get = function get () { + pushTarget(this); + var value; + var vm = this.vm; + try { + value = this.getter.call(vm, vm); + } catch (e) { + if (this.user) { + handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); + } else { + throw e + } + } finally { + // "touch" every property so they are all tracked as + // dependencies for deep watching + if (this.deep) { + traverse(value); } + popTarget(); + this.cleanupDeps(); } + return value }; -var hooksToMerge = Object.keys(componentVNodeHooks); - -function createComponent ( - Ctor, - data, - context, - children, - tag -) { - if (isUndef(Ctor)) { - return +/** + * Add a dependency to this directive. + */ +Watcher.prototype.addDep = function addDep (dep) { + var id = dep.id; + if (!this.newDepIds.has(id)) { + this.newDepIds.add(id); + this.newDeps.push(dep); + if (!this.depIds.has(id)) { + dep.addSub(this); + } } +}; - var baseCtor = context.$options._base; - - // plain options object: turn it into a constructor - if (isObject(Ctor)) { - Ctor = baseCtor.extend(Ctor); +/** + * Clean up for dependency collection. + */ +Watcher.prototype.cleanupDeps = function cleanupDeps () { + var i = this.deps.length; + while (i--) { + var dep = this.deps[i]; + if (!this.newDepIds.has(dep.id)) { + dep.removeSub(this); + } } + var tmp = this.depIds; + this.depIds = this.newDepIds; + this.newDepIds = tmp; + this.newDepIds.clear(); + tmp = this.deps; + this.deps = this.newDeps; + this.newDeps = tmp; + this.newDeps.length = 0; +}; - // if at this stage it's not a constructor or an async component factory, - // reject. - if (typeof Ctor !== 'function') { - if (process.env.NODE_ENV !== 'production') { - warn(("Invalid Component definition: " + (String(Ctor))), context); - } - return +/** + * Subscriber interface. + * Will be called when a dependency changes. + */ +Watcher.prototype.update = function update () { + /* istanbul ignore else */ + if (this.lazy) { + this.dirty = true; + } else if (this.sync) { + this.run(); + } else { + queueWatcher(this); } +}; - // async component - var asyncFactory; - if (isUndef(Ctor.cid)) { - asyncFactory = Ctor; - Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context); - if (Ctor === undefined) { - // return a placeholder node for async component, which is rendered - // as a comment node but preserves all the raw information for the node. - // the information will be used for async server-rendering and hydration. - return createAsyncPlaceholder( - asyncFactory, - data, - context, - children, - tag - ) +/** + * Scheduler job interface. + * Will be called by the scheduler. + */ +Watcher.prototype.run = function run () { + if (this.active) { + var value = this.get(); + if ( + value !== this.value || + // Deep watchers and watchers on Object/Arrays should fire even + // when the value is the same, because the value may + // have mutated. + isObject(value) || + this.deep + ) { + // set new value + var oldValue = this.value; + this.value = value; + if (this.user) { + try { + this.cb.call(this.vm, value, oldValue); + } catch (e) { + handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); + } + } else { + this.cb.call(this.vm, value, oldValue); + } } } +}; - data = data || {}; +/** + * Evaluate the value of the watcher. + * This only gets called for lazy watchers. + */ +Watcher.prototype.evaluate = function evaluate () { + this.value = this.get(); + this.dirty = false; +}; - // resolve constructor options in case global mixins are applied after - // component constructor creation - resolveConstructorOptions(Ctor); +/** + * Depend on all deps collected by this watcher. + */ +Watcher.prototype.depend = function depend () { + var i = this.deps.length; + while (i--) { + this.deps[i].depend(); + } +}; - // transform component v-model data into props & events - if (isDef(data.model)) { - transformModel(Ctor.options, data); +/** + * Remove self from all dependencies' subscriber list. + */ +Watcher.prototype.teardown = function teardown () { + if (this.active) { + // remove self from vm's watcher list + // this is a somewhat expensive operation so we skip it + // if the vm is being destroyed. + if (!this.vm._isBeingDestroyed) { + remove(this.vm._watchers, this); + } + var i = this.deps.length; + while (i--) { + this.deps[i].removeSub(this); + } + this.active = false; } +}; - // extract props - var propsData = extractPropsFromVNodeData(data, Ctor, tag); +/* */ - // functional component - if (isTrue(Ctor.options.functional)) { - return createFunctionalComponent(Ctor, propsData, data, context, children) - } +var sharedPropertyDefinition = { + enumerable: true, + configurable: true, + get: noop, + set: noop +}; - // extract listeners, since these needs to be treated as - // child component listeners instead of DOM listeners - var listeners = data.on; - // replace with listeners with .native modifier - // so it gets processed during parent component patch. - data.on = data.nativeOn; +function proxy (target, sourceKey, key) { + sharedPropertyDefinition.get = function proxyGetter () { + return this[sourceKey][key] + }; + sharedPropertyDefinition.set = function proxySetter (val) { + this[sourceKey][key] = val; + }; + Object.defineProperty(target, key, sharedPropertyDefinition); +} - if (isTrue(Ctor.options.abstract)) { - // abstract components do not keep anything - // other than props & listeners & slot +function initState (vm) { + vm._watchers = []; + var opts = vm.$options; + if (opts.props) { initProps(vm, opts.props); } + if (opts.methods) { initMethods(vm, opts.methods); } + if (opts.data) { + initData(vm); + } else { + observe(vm._data = {}, true /* asRootData */); + } + if (opts.computed) { initComputed(vm, opts.computed); } + if (opts.watch && opts.watch !== nativeWatch) { + initWatch(vm, opts.watch); + } +} - // work around flow - var slot = data.slot; - data = {}; - if (slot) { - data.slot = slot; +function initProps (vm, propsOptions) { + var propsData = vm.$options.propsData || {}; + var props = vm._props = {}; + // cache prop keys so that future props updates can iterate using Array + // instead of dynamic object key enumeration. + var keys = vm.$options._propKeys = []; + var isRoot = !vm.$parent; + // root instance props should be converted + if (!isRoot) { + toggleObserving(false); + } + var loop = function ( key ) { + keys.push(key); + var value = validateProp(key, propsOptions, propsData, vm); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') { + var hyphenatedKey = hyphenate(key); + if (isReservedAttribute(hyphenatedKey) || + config.isReservedAttr(hyphenatedKey)) { + warn( + ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), + vm + ); + } + defineReactive$$1(props, key, value, function () { + if (!isRoot && !isUpdatingChildComponent) { + warn( + "Avoid mutating a prop directly since the value will be " + + "overwritten whenever the parent component re-renders. " + + "Instead, use a data or computed property based on the prop's " + + "value. Prop being mutated: \"" + key + "\"", + vm + ); + } + }); + } else { + defineReactive$$1(props, key, value); + } + // static props are already proxied on the component's prototype + // during Vue.extend(). We only need to proxy props defined at + // instantiation here. + if (!(key in vm)) { + proxy(vm, "_props", key); } - } - - // install component management hooks onto the placeholder node - installComponentHooks(data); - - // return a placeholder vnode - var name = Ctor.options.name || tag; - var vnode = new VNode( - ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), - data, undefined, undefined, undefined, context, - { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, - asyncFactory - ); + }; - return vnode + for (var key in propsOptions) loop( key ); + toggleObserving(true); } -function createComponentInstanceForVnode ( - vnode, // we know it's MountedComponentVNode but flow doesn't - parent // activeInstance in lifecycle state -) { - var options = { - _isComponent: true, - _parentVnode: vnode, - parent: parent - }; - // check inline-template render functions - var inlineTemplate = vnode.data.inlineTemplate; - if (isDef(inlineTemplate)) { - options.render = inlineTemplate.render; - options.staticRenderFns = inlineTemplate.staticRenderFns; +function initData (vm) { + var data = vm.$options.data; + data = vm._data = typeof data === 'function' + ? getData(data, vm) + : data || {}; + if (!isPlainObject(data)) { + data = {}; + process.env.NODE_ENV !== 'production' && warn( + 'data functions should return an object:\n' + + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', + vm + ); } - return new vnode.componentOptions.Ctor(options) -} - -function installComponentHooks (data) { - var hooks = data.hook || (data.hook = {}); - for (var i = 0; i < hooksToMerge.length; i++) { - var key = hooksToMerge[i]; - var existing = hooks[key]; - var toMerge = componentVNodeHooks[key]; - if (existing !== toMerge && !(existing && existing._merged)) { - hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; + // proxy data on instance + var keys = Object.keys(data); + var props = vm.$options.props; + var methods = vm.$options.methods; + var i = keys.length; + while (i--) { + var key = keys[i]; + if (process.env.NODE_ENV !== 'production') { + if (methods && hasOwn(methods, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a data property."), + vm + ); + } + } + if (props && hasOwn(props, key)) { + process.env.NODE_ENV !== 'production' && warn( + "The data property \"" + key + "\" is already declared as a prop. " + + "Use prop default value instead.", + vm + ); + } else if (!isReserved(key)) { + proxy(vm, "_data", key); } } + // observe data + observe(data, true /* asRootData */); } -function mergeHook$1 (f1, f2) { - var merged = function (a, b) { - // flow complains about extra args which is why we use any - f1(a, b); - f2(a, b); - }; - merged._merged = true; - return merged -} - -// transform component v-model info (value and callback) into -// prop and event handler respectively. -function transformModel (options, data) { - var prop = (options.model && options.model.prop) || 'value'; - var event = (options.model && options.model.event) || 'input' - ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; - var on = data.on || (data.on = {}); - var existing = on[event]; - var callback = data.model.callback; - if (isDef(existing)) { - if ( - Array.isArray(existing) - ? existing.indexOf(callback) === -1 - : existing !== callback - ) { - on[event] = [callback].concat(existing); - } - } else { - on[event] = callback; +function getData (data, vm) { + // #7573 disable dep collection when invoking data getters + pushTarget(); + try { + return data.call(vm, vm) + } catch (e) { + handleError(e, vm, "data()"); + return {} + } finally { + popTarget(); } } -/* */ - -var SIMPLE_NORMALIZE = 1; -var ALWAYS_NORMALIZE = 2; +var computedWatcherOptions = { lazy: true }; -// wrapper function for providing a more flexible interface -// without getting yelled at by flow -function createElement ( - context, - tag, - data, - children, - normalizationType, - alwaysNormalize -) { - if (Array.isArray(data) || isPrimitive(data)) { - normalizationType = children; - children = data; - data = undefined; - } - if (isTrue(alwaysNormalize)) { - normalizationType = ALWAYS_NORMALIZE; - } - return _createElement(context, tag, data, children, normalizationType) -} +function initComputed (vm, computed) { + // $flow-disable-line + var watchers = vm._computedWatchers = Object.create(null); + // computed properties are just getters during SSR + var isSSR = isServerRendering(); -function _createElement ( - context, - tag, - data, - children, - normalizationType -) { - if (isDef(data) && isDef((data).__ob__)) { - process.env.NODE_ENV !== 'production' && warn( - "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + - 'Always create fresh vnode data objects in each render!', - context - ); - return createEmptyVNode() - } - // object syntax in v-bind - if (isDef(data) && isDef(data.is)) { - tag = data.is; - } - if (!tag) { - // in case of component :is set to falsy value - return createEmptyVNode() - } - // warn against non-primitive key - if (process.env.NODE_ENV !== 'production' && - isDef(data) && isDef(data.key) && !isPrimitive(data.key) - ) { - { + for (var key in computed) { + var userDef = computed[key]; + var getter = typeof userDef === 'function' ? userDef : userDef.get; + if (process.env.NODE_ENV !== 'production' && getter == null) { warn( - 'Avoid using non-primitive value as key, ' + - 'use string/number value instead.', - context + ("Getter is missing for computed property \"" + key + "\"."), + vm ); } - } - // support single function children as default scoped slot - if (Array.isArray(children) && - typeof children[0] === 'function' - ) { - data = data || {}; - data.scopedSlots = { default: children[0] }; - children.length = 0; - } - if (normalizationType === ALWAYS_NORMALIZE) { - children = normalizeChildren(children); - } else if (normalizationType === SIMPLE_NORMALIZE) { - children = simpleNormalizeChildren(children); - } - var vnode, ns; - if (typeof tag === 'string') { - var Ctor; - ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); - if (config.isReservedTag(tag)) { - // platform built-in elements - vnode = new VNode( - config.parsePlatformTagName(tag), data, children, - undefined, undefined, context - ); - } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { - // component - vnode = createComponent(Ctor, data, context, children, tag); - } else { - // unknown or unlisted namespaced elements - // check at runtime because it may get assigned a namespace when its - // parent normalizes children - vnode = new VNode( - tag, data, children, - undefined, undefined, context + + if (!isSSR) { + // create internal watcher for the computed property. + watchers[key] = new Watcher( + vm, + getter || noop, + noop, + computedWatcherOptions ); } + + // component-defined computed properties are already defined on the + // component prototype. We only need to define computed properties defined + // at instantiation here. + if (!(key in vm)) { + defineComputed(vm, key, userDef); + } else if (process.env.NODE_ENV !== 'production') { + if (key in vm.$data) { + warn(("The computed property \"" + key + "\" is already defined in data."), vm); + } else if (vm.$options.props && key in vm.$options.props) { + warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); + } + } + } +} + +function defineComputed ( + target, + key, + userDef +) { + var shouldCache = !isServerRendering(); + if (typeof userDef === 'function') { + sharedPropertyDefinition.get = shouldCache + ? createComputedGetter(key) + : createGetterInvoker(userDef); + sharedPropertyDefinition.set = noop; } else { - // direct component options / constructor - vnode = createComponent(tag, data, context, children); + sharedPropertyDefinition.get = userDef.get + ? shouldCache && userDef.cache !== false + ? createComputedGetter(key) + : createGetterInvoker(userDef.get) + : noop; + sharedPropertyDefinition.set = userDef.set || noop; } - if (Array.isArray(vnode)) { - return vnode - } else if (isDef(vnode)) { - if (isDef(ns)) { applyNS(vnode, ns); } - if (isDef(data)) { registerDeepBindings(data); } - return vnode - } else { - return createEmptyVNode() + if (process.env.NODE_ENV !== 'production' && + sharedPropertyDefinition.set === noop) { + sharedPropertyDefinition.set = function () { + warn( + ("Computed property \"" + key + "\" was assigned to but it has no setter."), + this + ); + }; } + Object.defineProperty(target, key, sharedPropertyDefinition); } -function applyNS (vnode, ns, force) { - vnode.ns = ns; - if (vnode.tag === 'foreignObject') { - // use default namespace inside foreignObject - ns = undefined; - force = true; - } - if (isDef(vnode.children)) { - for (var i = 0, l = vnode.children.length; i < l; i++) { - var child = vnode.children[i]; - if (isDef(child.tag) && ( - isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { - applyNS(child, ns, force); +function createComputedGetter (key) { + return function computedGetter () { + var watcher = this._computedWatchers && this._computedWatchers[key]; + if (watcher) { + if (watcher.dirty) { + watcher.evaluate(); + } + if (Dep.target) { + watcher.depend(); } + return watcher.value } } } -// ref #5318 -// necessary to ensure parent re-render when deep bindings like :style and -// :class are used on slot nodes -function registerDeepBindings (data) { - if (isObject(data.style)) { - traverse(data.style); - } - if (isObject(data.class)) { - traverse(data.class); +function createGetterInvoker(fn) { + return function computedGetter () { + return fn.call(this, this) } } -/* */ - -function initRender (vm) { - vm._vnode = null; // the root of the child tree - vm._staticTrees = null; // v-once cached trees - var options = vm.$options; - var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree - var renderContext = parentVnode && parentVnode.context; - vm.$slots = resolveSlots(options._renderChildren, renderContext); - vm.$scopedSlots = emptyObject; - // bind the createElement fn to this instance - // so that we get proper render context inside it. - // args order: tag, data, children, normalizationType, alwaysNormalize - // internal version is used by render functions compiled from templates - vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; - // normalization is always applied for the public version, used in - // user-written render functions. - vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; +function initMethods (vm, methods) { + var props = vm.$options.props; + for (var key in methods) { + if (process.env.NODE_ENV !== 'production') { + if (typeof methods[key] !== 'function') { + warn( + "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + + "Did you reference the function correctly?", + vm + ); + } + if (props && hasOwn(props, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a prop."), + vm + ); + } + if ((key in vm) && isReserved(key)) { + warn( + "Method \"" + key + "\" conflicts with an existing Vue instance method. " + + "Avoid defining component methods that start with _ or $." + ); + } + } + vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); + } +} - // $attrs & $listeners are exposed for easier HOC creation. - // they need to be reactive so that HOCs using them are always updated - var parentData = parentVnode && parentVnode.data; +function initWatch (vm, watch) { + for (var key in watch) { + var handler = watch[key]; + if (Array.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + createWatcher(vm, key, handler[i]); + } + } else { + createWatcher(vm, key, handler); + } + } +} - /* istanbul ignore else */ - if (process.env.NODE_ENV !== 'production') { - defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { - !isUpdatingChildComponent && warn("$attrs is readonly.", vm); - }, true); - defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { - !isUpdatingChildComponent && warn("$listeners is readonly.", vm); - }, true); - } else { - defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true); - defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true); +function createWatcher ( + vm, + expOrFn, + handler, + options +) { + if (isPlainObject(handler)) { + options = handler; + handler = handler.handler; + } + if (typeof handler === 'string') { + handler = vm[handler]; } + return vm.$watch(expOrFn, handler, options) } -function renderMixin (Vue) { - // install runtime convenience helpers - installRenderHelpers(Vue.prototype); +function stateMixin (Vue) { + // flow somehow has problems with directly declared definition object + // when using Object.defineProperty, so we have to procedurally build up + // the object here. + var dataDef = {}; + dataDef.get = function () { return this._data }; + var propsDef = {}; + propsDef.get = function () { return this._props }; + if (process.env.NODE_ENV !== 'production') { + dataDef.set = function () { + warn( + 'Avoid replacing instance root $data. ' + + 'Use nested data properties instead.', + this + ); + }; + propsDef.set = function () { + warn("$props is readonly.", this); + }; + } + Object.defineProperty(Vue.prototype, '$data', dataDef); + Object.defineProperty(Vue.prototype, '$props', propsDef); - Vue.prototype.$nextTick = function (fn) { - return nextTick(fn, this) - }; + Vue.prototype.$set = set; + Vue.prototype.$delete = del; - Vue.prototype._render = function () { + Vue.prototype.$watch = function ( + expOrFn, + cb, + options + ) { var vm = this; - var ref = vm.$options; - var render = ref.render; - var _parentVnode = ref._parentVnode; - - if (_parentVnode) { - vm.$scopedSlots = normalizeScopedSlots( - _parentVnode.data.scopedSlots, - vm.$slots - ); + if (isPlainObject(cb)) { + return createWatcher(vm, expOrFn, cb, options) } - - // set parent vnode. this allows render functions to have access - // to the data on the placeholder node. - vm.$vnode = _parentVnode; - // render self - var vnode; - try { - vnode = render.call(vm._renderProxy, vm.$createElement); - } catch (e) { - handleError(e, vm, "render"); - // return error render result, - // or previous vnode to prevent render error causing blank component - /* istanbul ignore else */ - if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) { - try { - vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); - } catch (e) { - handleError(e, vm, "renderError"); - vnode = vm._vnode; - } - } else { - vnode = vm._vnode; + options = options || {}; + options.user = true; + var watcher = new Watcher(vm, expOrFn, cb, options); + if (options.immediate) { + try { + cb.call(vm, watcher.value); + } catch (error) { + handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); } } - // if the returned array contains only a single node, allow it - if (Array.isArray(vnode) && vnode.length === 1) { - vnode = vnode[0]; - } - // return empty vnode in case the render function errored out - if (!(vnode instanceof VNode)) { - if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) { - warn( - 'Multiple root nodes returned from render function. Render function ' + - 'should return a single root node.', - vm - ); - } - vnode = createEmptyVNode(); + return function unwatchFn () { + watcher.teardown(); } - // set parent - vnode.parent = _parentVnode; - return vnode }; } @@ -5348,7 +5351,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', { value: FunctionalRenderContext }); -Vue.version = '2.6.2'; +Vue.version = '2.6.3'; /* */ @@ -7414,6 +7417,11 @@ function createOnceHandler$1 (event, handler, capture) { } } +// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp +// implementation and does not fire microtasks in between event propagation, so +// safe to exclude. +var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); + function add$1 ( name, handler, @@ -7426,11 +7434,16 @@ function add$1 ( // the solution is simple: we save the timestamp when a handler is attached, // and the handler would only fire if the event passed to it was fired // AFTER it was attached. - if (isUsingMicroTask) { + if (useMicrotaskFix) { var attachedTimestamp = currentFlushTimestamp; var original = handler; handler = original._wrapper = function (e) { - if (e.timeStamp >= attachedTimestamp) { + if ( + e.timeStamp >= attachedTimestamp || + // #9448 bail if event is fired in another document in a multi-page + // electron/nw.js app + e.target.ownerDocument !== document + ) { return original.apply(this, arguments) } }; @@ -9449,6 +9462,8 @@ var invalidAttributeRE = /[\s"'<>\/=]/; var decodeHTMLCached = cached(he.decode); +var emptySlotScopeToken = "_empty_"; + // configurable state var warn$2; var delimiters; @@ -10061,7 +10076,7 @@ function processSlotContent (el) { var dynamic = ref.dynamic; el.slotTarget = name; el.slotTargetDynamic = dynamic; - el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf + el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf } } else { // v-slot on component, denotes default slot @@ -10096,8 +10111,13 @@ function processSlotContent (el) { var slotContainer = slots[name$1] = createASTElement('template', [], el); slotContainer.slotTarget = name$1; slotContainer.slotTargetDynamic = dynamic$1; - slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; }); - slotContainer.slotScope = slotBinding$1.value || "_"; + slotContainer.children = el.children.filter(function (c) { + if (!c.slotScope) { + c.parent = slotContainer; + return true + } + }); + slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken; // remove children as they are returned from scopedSlots now el.children = []; // mark el non-plain so data gets generated @@ -11029,7 +11049,7 @@ function genData$2 (el, state) { } // scoped slots if (el.scopedSlots) { - data += (genScopedSlots(el.scopedSlots, state)) + ","; + data += (genScopedSlots(el, el.scopedSlots, state)) + ","; } // component v-model if (el.model) { @@ -11102,16 +11122,34 @@ function genInlineTemplate (el, state) { } function genScopedSlots ( + el, slots, state ) { - var hasDynamicKeys = Object.keys(slots).some(function (key) { + // by default scoped slots are considered "stable", this allows child + // components with only scoped slots to skip forced updates from parent. + // but in some cases we have to bail-out of this optimization + // for example if the slot contains dynamic names, has v-if or v-for on them... + var needsForceUpdate = Object.keys(slots).some(function (key) { var slot = slots[key]; return slot.slotTargetDynamic || slot.if || slot.for }); + // OR when it is inside another scoped slot (the reactivity is disconnected) + // #9438 + if (!needsForceUpdate) { + var parent = el.parent; + while (parent) { + if (parent.slotScope && parent.slotScope !== emptySlotScopeToken) { + needsForceUpdate = true; + break + } + parent = parent.parent; + } + } + return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return genScopedSlot(slots[key], state) - }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") + }).join(',')) + "]" + (needsForceUpdate ? ",true" : "") + ")") } function genScopedSlot ( @@ -11125,7 +11163,10 @@ function genScopedSlot ( if (el.for && !el.forProcessed) { return genFor(el, state, genScopedSlot) } - var fn = "function(" + (String(el.slotScope)) + "){" + + var slotScope = el.slotScope === emptySlotScopeToken + ? "" + : String(el.slotScope); + var fn = "function(" + slotScope + "){" + "return " + (el.tag === 'template' ? el.if && isLegacySyntax ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined") @@ -11218,7 +11259,14 @@ function genSlot (el, state) { var slotName = el.slotName || '"default"'; var children = genChildren(el, state); var res = "_t(" + slotName + (children ? ("," + children) : ''); - var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}"); + var attrs = el.attrs || el.dynamicAttrs + ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({ + // slot props are camelized + name: camelize(attr.name), + value: attr.value, + dynamic: attr.dynamic + }); })) + : null; var bind$$1 = el.attrsMap['v-bind']; if ((attrs || bind$$1) && !children) { res += ",null"; diff --git a/dist/vue.js b/dist/vue.js index b89f44e22df..26151737239 100644 --- a/dist/vue.js +++ b/dist/vue.js @@ -1,5 +1,5 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ @@ -538,6 +538,7 @@ var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; var isPhantomJS = UA && /phantomjs/.test(UA); + var isFF = UA && UA.match(/firefox\/(\d+)/); // Firefox has a "watch" function on Object.prototype... var nativeWatch = ({}).watch; @@ -2408,2437 +2409,2439 @@ /* */ - function ensureCtor (comp, base) { - if ( - comp.__esModule || - (hasSymbol && comp[Symbol.toStringTag] === 'Module') - ) { - comp = comp.default; + function initProvide (vm) { + var provide = vm.$options.provide; + if (provide) { + vm._provided = typeof provide === 'function' + ? provide.call(vm) + : provide; } - return isObject(comp) - ? base.extend(comp) - : comp - } - - function createAsyncPlaceholder ( - factory, - data, - context, - children, - tag - ) { - var node = createEmptyVNode(); - node.asyncFactory = factory; - node.asyncMeta = { data: data, context: context, children: children, tag: tag }; - return node } - function resolveAsyncComponent ( - factory, - baseCtor, - context - ) { - if (isTrue(factory.error) && isDef(factory.errorComp)) { - return factory.errorComp - } - - if (isDef(factory.resolved)) { - return factory.resolved - } - - if (isTrue(factory.loading) && isDef(factory.loadingComp)) { - return factory.loadingComp - } - - if (isDef(factory.contexts)) { - // already pending - factory.contexts.push(context); - } else { - var contexts = factory.contexts = [context]; - var sync = true; - - var forceRender = function (renderCompleted) { - for (var i = 0, l = contexts.length; i < l; i++) { - contexts[i].$forceUpdate(); - } - - if (renderCompleted) { - contexts.length = 0; - } - }; - - var resolve = once(function (res) { - // cache resolved - factory.resolved = ensureCtor(res, baseCtor); - // invoke callbacks only if this is not a synchronous resolve - // (async resolves are shimmed as synchronous during SSR) - if (!sync) { - forceRender(true); - } else { - contexts.length = 0; - } - }); - - var reject = once(function (reason) { - warn( - "Failed to resolve async component: " + (String(factory)) + - (reason ? ("\nReason: " + reason) : '') - ); - if (isDef(factory.errorComp)) { - factory.error = true; - forceRender(true); + function initInjections (vm) { + var result = resolveInject(vm.$options.inject, vm); + if (result) { + toggleObserving(false); + Object.keys(result).forEach(function (key) { + /* istanbul ignore else */ + { + defineReactive$$1(vm, key, result[key], function () { + warn( + "Avoid mutating an injected value directly since the changes will be " + + "overwritten whenever the provided component re-renders. " + + "injection being mutated: \"" + key + "\"", + vm + ); + }); } }); + toggleObserving(true); + } + } - var res = factory(resolve, reject); - - if (isObject(res)) { - if (isPromise(res)) { - // () => Promise - if (isUndef(factory.resolved)) { - res.then(resolve, reject); - } - } else if (isPromise(res.component)) { - res.component.then(resolve, reject); - - if (isDef(res.error)) { - factory.errorComp = ensureCtor(res.error, baseCtor); - } + function resolveInject (inject, vm) { + if (inject) { + // inject is :any because flow is not smart enough to figure out cached + var result = Object.create(null); + var keys = hasSymbol + ? Reflect.ownKeys(inject) + : Object.keys(inject); - if (isDef(res.loading)) { - factory.loadingComp = ensureCtor(res.loading, baseCtor); - if (res.delay === 0) { - factory.loading = true; - } else { - setTimeout(function () { - if (isUndef(factory.resolved) && isUndef(factory.error)) { - factory.loading = true; - forceRender(false); - } - }, res.delay || 200); - } + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + // #6574 in case the inject object is observed... + if (key === '__ob__') { continue } + var provideKey = inject[key].from; + var source = vm; + while (source) { + if (source._provided && hasOwn(source._provided, provideKey)) { + result[key] = source._provided[provideKey]; + break } - - if (isDef(res.timeout)) { - setTimeout(function () { - if (isUndef(factory.resolved)) { - reject( - "timeout (" + (res.timeout) + "ms)" - ); - } - }, res.timeout); + source = source.$parent; + } + if (!source) { + if ('default' in inject[key]) { + var provideDefault = inject[key].default; + result[key] = typeof provideDefault === 'function' + ? provideDefault.call(vm) + : provideDefault; + } else { + warn(("Injection \"" + key + "\" not found"), vm); } } } - - sync = false; - // return in case resolved synchronously - return factory.loading - ? factory.loadingComp - : factory.resolved + return result } } /* */ - function isAsyncPlaceholder (node) { - return node.isComment && node.asyncFactory - } - /* */ - function getFirstComponentChild (children) { - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - var c = children[i]; - if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { - return c + /** + * Runtime helper for resolving raw children VNodes into a slot object. + */ + function resolveSlots ( + children, + context + ) { + if (!children || !children.length) { + return {} + } + var slots = {}; + for (var i = 0, l = children.length; i < l; i++) { + var child = children[i]; + var data = child.data; + // remove slot attribute if the node is resolved as a Vue slot node + if (data && data.attrs && data.attrs.slot) { + delete data.attrs.slot; + } + // named slots should only be respected if the vnode was rendered in the + // same context. + if ((child.context === context || child.fnContext === context) && + data && data.slot != null + ) { + var name = data.slot; + var slot = (slots[name] || (slots[name] = [])); + if (child.tag === 'template') { + slot.push.apply(slot, child.children || []); + } else { + slot.push(child); } + } else { + (slots.default || (slots.default = [])).push(child); + } + } + // ignore slots that contains only whitespace + for (var name$1 in slots) { + if (slots[name$1].every(isWhitespace)) { + delete slots[name$1]; } } + return slots } - /* */ + function isWhitespace (node) { + return (node.isComment && !node.asyncFactory) || node.text === ' ' + } /* */ - function initEvents (vm) { - vm._events = Object.create(null); - vm._hasHookEvent = false; - // init parent attached events - var listeners = vm.$options._parentListeners; - if (listeners) { - updateComponentListeners(vm, listeners); + function normalizeScopedSlots ( + slots, + normalSlots + ) { + var res; + if (!slots) { + res = {}; + } else if (slots._normalized) { + return slots + } else { + res = {}; + for (var key in slots) { + if (slots[key] && key[0] !== '$') { + res[key] = normalizeScopedSlot(slots[key]); + } + } + } + // expose normal slots on scopedSlots + for (var key$1 in normalSlots) { + if (!(key$1 in res)) { + res[key$1] = proxyNormalSlot(normalSlots, key$1); + } } + def(res, '_normalized', true); + def(res, '$stable', slots ? !!slots.$stable : true); + return res } - var target; - - function add (event, fn) { - target.$on(event, fn); + function normalizeScopedSlot(fn) { + return function (scope) { + var res = fn(scope); + return res && typeof res === 'object' && !Array.isArray(res) + ? [res] // single vnode + : normalizeChildren(res) + } } - function remove$1 (event, fn) { - target.$off(event, fn); + function proxyNormalSlot(slots, key) { + return function () { return slots[key]; } } - function createOnceHandler (event, fn) { - var _target = target; - return function onceHandler () { - var res = fn.apply(null, arguments); - if (res !== null) { - _target.$off(event, onceHandler); - } - } - } + /* */ - function updateComponentListeners ( - vm, - listeners, - oldListeners + /** + * Runtime helper for rendering v-for lists. + */ + function renderList ( + val, + render ) { - target = vm; - updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); - target = undefined; - } - - function eventsMixin (Vue) { - var hookRE = /^hook:/; - Vue.prototype.$on = function (event, fn) { - var vm = this; - if (Array.isArray(event)) { - for (var i = 0, l = event.length; i < l; i++) { - vm.$on(event[i], fn); - } - } else { - (vm._events[event] || (vm._events[event] = [])).push(fn); - // optimize hook:event cost by using a boolean flag marked at registration - // instead of a hash lookup - if (hookRE.test(event)) { - vm._hasHookEvent = true; - } - } - return vm - }; - - Vue.prototype.$once = function (event, fn) { - var vm = this; - function on () { - vm.$off(event, on); - fn.apply(vm, arguments); - } - on.fn = fn; - vm.$on(event, on); - return vm - }; - - Vue.prototype.$off = function (event, fn) { - var vm = this; - // all - if (!arguments.length) { - vm._events = Object.create(null); - return vm - } - // array of events - if (Array.isArray(event)) { - for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { - vm.$off(event[i$1], fn); - } - return vm - } - // specific event - var cbs = vm._events[event]; - if (!cbs) { - return vm - } - if (!fn) { - vm._events[event] = null; - return vm + var ret, i, l, keys, key; + if (Array.isArray(val) || typeof val === 'string') { + ret = new Array(val.length); + for (i = 0, l = val.length; i < l; i++) { + ret[i] = render(val[i], i); } - // specific handler - var cb; - var i = cbs.length; - while (i--) { - cb = cbs[i]; - if (cb === fn || cb.fn === fn) { - cbs.splice(i, 1); - break - } + } else if (typeof val === 'number') { + ret = new Array(val); + for (i = 0; i < val; i++) { + ret[i] = render(i + 1, i); } - return vm - }; - - Vue.prototype.$emit = function (event) { - var vm = this; - { - var lowerCaseEvent = event.toLowerCase(); - if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { - tip( - "Event \"" + lowerCaseEvent + "\" is emitted in component " + - (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + - "Note that HTML attributes are case-insensitive and you cannot use " + - "v-on to listen to camelCase events when using in-DOM templates. " + - "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." - ); + } else if (isObject(val)) { + if (hasSymbol && val[Symbol.iterator]) { + ret = []; + var iterator = val[Symbol.iterator](); + var result = iterator.next(); + while (!result.done) { + ret.push(render(result.value, ret.length)); + result = iterator.next(); } - } - var cbs = vm._events[event]; - if (cbs) { - cbs = cbs.length > 1 ? toArray(cbs) : cbs; - var args = toArray(arguments, 1); - var info = "event handler for \"" + event + "\""; - for (var i = 0, l = cbs.length; i < l; i++) { - invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } else { + keys = Object.keys(val); + ret = new Array(keys.length); + for (i = 0, l = keys.length; i < l; i++) { + key = keys[i]; + ret[i] = render(val[key], key, i); } } - return vm - }; + } + if (!isDef(ret)) { + ret = []; + } + (ret)._isVList = true; + return ret } /* */ - - /** - * Runtime helper for resolving raw children VNodes into a slot object. + * Runtime helper for rendering */ - function resolveSlots ( - children, - context + function renderSlot ( + name, + fallback, + props, + bindObject ) { - if (!children || !children.length) { - return {} - } - var slots = {}; - for (var i = 0, l = children.length; i < l; i++) { - var child = children[i]; - var data = child.data; - // remove slot attribute if the node is resolved as a Vue slot node - if (data && data.attrs && data.attrs.slot) { - delete data.attrs.slot; - } - // named slots should only be respected if the vnode was rendered in the - // same context. - if ((child.context === context || child.fnContext === context) && - data && data.slot != null - ) { - var name = data.slot; - var slot = (slots[name] || (slots[name] = [])); - if (child.tag === 'template') { - slot.push.apply(slot, child.children || []); - } else { - slot.push(child); + var scopedSlotFn = this.$scopedSlots[name]; + var nodes; + if (scopedSlotFn) { // scoped slot + props = props || {}; + if (bindObject) { + if (!isObject(bindObject)) { + warn( + 'slot v-bind without argument expects an Object', + this + ); } - } else { - (slots.default || (slots.default = [])).push(child); - } - } - // ignore slots that contains only whitespace - for (var name$1 in slots) { - if (slots[name$1].every(isWhitespace)) { - delete slots[name$1]; + props = extend(extend({}, bindObject), props); } + nodes = scopedSlotFn(props) || fallback; + } else { + nodes = this.$slots[name] || fallback; } - return slots - } - - function isWhitespace (node) { - return (node.isComment && !node.asyncFactory) || node.text === ' ' - } - function resolveScopedSlots ( - fns, // see flow/vnode - hasDynamicKeys, - res - ) { - res = res || { $stable: !hasDynamicKeys }; - for (var i = 0; i < fns.length; i++) { - var slot = fns[i]; - if (Array.isArray(slot)) { - resolveScopedSlots(slot, hasDynamicKeys, res); - } else if (slot) { - res[slot.key] = slot.fn; - } + var target = props && props.slot; + if (target) { + return this.$createElement('template', { slot: target }, nodes) + } else { + return nodes } - return res } /* */ - var activeInstance = null; - var isUpdatingChildComponent = false; - - function setActiveInstance(vm) { - var prevActiveInstance = activeInstance; - activeInstance = vm; - return function () { - activeInstance = prevActiveInstance; - } + /** + * Runtime helper for resolving filters + */ + function resolveFilter (id) { + return resolveAsset(this.$options, 'filters', id, true) || identity } - function initLifecycle (vm) { - var options = vm.$options; + /* */ - // locate first non-abstract parent - var parent = options.parent; - if (parent && !options.abstract) { - while (parent.$options.abstract && parent.$parent) { - parent = parent.$parent; - } - parent.$children.push(vm); + function isKeyNotMatch (expect, actual) { + if (Array.isArray(expect)) { + return expect.indexOf(actual) === -1 + } else { + return expect !== actual } + } - vm.$parent = parent; - vm.$root = parent ? parent.$root : vm; - - vm.$children = []; - vm.$refs = {}; - - vm._watcher = null; - vm._inactive = null; - vm._directInactive = false; - vm._isMounted = false; - vm._isDestroyed = false; - vm._isBeingDestroyed = false; + /** + * Runtime helper for checking keyCodes from config. + * exposed as Vue.prototype._k + * passing in eventKeyName as last argument separately for backwards compat + */ + function checkKeyCodes ( + eventKeyCode, + key, + builtInKeyCode, + eventKeyName, + builtInKeyName + ) { + var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; + if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { + return isKeyNotMatch(builtInKeyName, eventKeyName) + } else if (mappedKeyCode) { + return isKeyNotMatch(mappedKeyCode, eventKeyCode) + } else if (eventKeyName) { + return hyphenate(eventKeyName) !== key + } } - function lifecycleMixin (Vue) { - Vue.prototype._update = function (vnode, hydrating) { - var vm = this; - var prevEl = vm.$el; - var prevVnode = vm._vnode; - var restoreActiveInstance = setActiveInstance(vm); - vm._vnode = vnode; - // Vue.prototype.__patch__ is injected in entry points - // based on the rendering backend used. - if (!prevVnode) { - // initial render - vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); + /* */ + + /** + * Runtime helper for merging v-bind="object" into a VNode's data. + */ + function bindObjectProps ( + data, + tag, + value, + asProp, + isSync + ) { + if (value) { + if (!isObject(value)) { + warn( + 'v-bind without argument expects an Object or Array value', + this + ); } else { - // updates - vm.$el = vm.__patch__(prevVnode, vnode); - } - restoreActiveInstance(); - // update __vue__ reference - if (prevEl) { - prevEl.__vue__ = null; - } - if (vm.$el) { - vm.$el.__vue__ = vm; - } - // if parent is an HOC, update its $el as well - if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { - vm.$parent.$el = vm.$el; - } - // updated hook is called by the scheduler to ensure that children are - // updated in a parent's updated hook. - }; + if (Array.isArray(value)) { + value = toObject(value); + } + var hash; + var loop = function ( key ) { + if ( + key === 'class' || + key === 'style' || + isReservedAttribute(key) + ) { + hash = data; + } else { + var type = data.attrs && data.attrs.type; + hash = asProp || config.mustUseProp(tag, type, key) + ? data.domProps || (data.domProps = {}) + : data.attrs || (data.attrs = {}); + } + var camelizedKey = camelize(key); + if (!(key in hash) && !(camelizedKey in hash)) { + hash[key] = value[key]; - Vue.prototype.$forceUpdate = function () { - var vm = this; - if (vm._watcher) { - vm._watcher.update(); - } - }; + if (isSync) { + var on = data.on || (data.on = {}); + on[("update:" + camelizedKey)] = function ($event) { + value[key] = $event; + }; + } + } + }; - Vue.prototype.$destroy = function () { - var vm = this; - if (vm._isBeingDestroyed) { - return - } - callHook(vm, 'beforeDestroy'); - vm._isBeingDestroyed = true; - // remove self from parent - var parent = vm.$parent; - if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { - remove(parent.$children, vm); - } - // teardown watchers - if (vm._watcher) { - vm._watcher.teardown(); - } - var i = vm._watchers.length; - while (i--) { - vm._watchers[i].teardown(); - } - // remove reference from data ob - // frozen object may not have observer. - if (vm._data.__ob__) { - vm._data.__ob__.vmCount--; - } - // call the last hook... - vm._isDestroyed = true; - // invoke destroy hooks on current rendered tree - vm.__patch__(vm._vnode, null); - // fire destroyed hook - callHook(vm, 'destroyed'); - // turn off all instance listeners. - vm.$off(); - // remove __vue__ reference - if (vm.$el) { - vm.$el.__vue__ = null; - } - // release circular reference (#6759) - if (vm.$vnode) { - vm.$vnode.parent = null; + for (var key in value) loop( key ); } - }; + } + return data } - function mountComponent ( - vm, - el, - hydrating + /* */ + + /** + * Runtime helper for rendering static trees. + */ + function renderStatic ( + index, + isInFor ) { - vm.$el = el; - if (!vm.$options.render) { - vm.$options.render = createEmptyVNode; - { - /* istanbul ignore if */ - if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || - vm.$options.el || el) { - warn( - 'You are using the runtime-only build of Vue where the template ' + - 'compiler is not available. Either pre-compile the templates into ' + - 'render functions, or use the compiler-included build.', - vm - ); - } else { - warn( - 'Failed to mount component: template or render function not defined.', - vm - ); - } - } + var cached = this._staticTrees || (this._staticTrees = []); + var tree = cached[index]; + // if has already-rendered static tree and not inside v-for, + // we can reuse the same tree. + if (tree && !isInFor) { + return tree } - callHook(vm, 'beforeMount'); - - var updateComponent; - /* istanbul ignore if */ - if (config.performance && mark) { - updateComponent = function () { - var name = vm._name; - var id = vm._uid; - var startTag = "vue-perf-start:" + id; - var endTag = "vue-perf-end:" + id; + // otherwise, render a fresh tree. + tree = cached[index] = this.$options.staticRenderFns[index].call( + this._renderProxy, + null, + this // for render fns generated for functional component templates + ); + markStatic(tree, ("__static__" + index), false); + return tree + } - mark(startTag); - var vnode = vm._render(); - mark(endTag); - measure(("vue " + name + " render"), startTag, endTag); + /** + * Runtime helper for v-once. + * Effectively it means marking the node as static with a unique key. + */ + function markOnce ( + tree, + index, + key + ) { + markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); + return tree + } - mark(startTag); - vm._update(vnode, hydrating); - mark(endTag); - measure(("vue " + name + " patch"), startTag, endTag); - }; + function markStatic ( + tree, + key, + isOnce + ) { + if (Array.isArray(tree)) { + for (var i = 0; i < tree.length; i++) { + if (tree[i] && typeof tree[i] !== 'string') { + markStaticNode(tree[i], (key + "_" + i), isOnce); + } + } } else { - updateComponent = function () { - vm._update(vm._render(), hydrating); - }; + markStaticNode(tree, key, isOnce); } + } - // we set this to vm._watcher inside the watcher's constructor - // since the watcher's initial patch may call $forceUpdate (e.g. inside child - // component's mounted hook), which relies on vm._watcher being already defined - new Watcher(vm, updateComponent, noop, { - before: function before () { - if (vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'beforeUpdate'); + function markStaticNode (node, key, isOnce) { + node.isStatic = true; + node.key = key; + node.isOnce = isOnce; + } + + /* */ + + function bindObjectListeners (data, value) { + if (value) { + if (!isPlainObject(value)) { + warn( + 'v-on without argument expects an Object value', + this + ); + } else { + var on = data.on = data.on ? extend({}, data.on) : {}; + for (var key in value) { + var existing = on[key]; + var ours = value[key]; + on[key] = existing ? [].concat(existing, ours) : ours; } } - }, true /* isRenderWatcher */); - hydrating = false; - - // manually mounted instance, call mounted on self - // mounted is called for render-created child components in its inserted hook - if (vm.$vnode == null) { - vm._isMounted = true; - callHook(vm, 'mounted'); } - return vm + return data } - function updateChildComponent ( - vm, - propsData, - listeners, - parentVnode, - renderChildren + /* */ + + function resolveScopedSlots ( + fns, // see flow/vnode + hasDynamicKeys, + res ) { - { - isUpdatingChildComponent = true; + res = res || { $stable: !hasDynamicKeys }; + for (var i = 0; i < fns.length; i++) { + var slot = fns[i]; + if (Array.isArray(slot)) { + resolveScopedSlots(slot, hasDynamicKeys, res); + } else if (slot) { + res[slot.key] = slot.fn; + } } + return res + } - // determine whether component has slot children - // we need to do this before overwriting $options._renderChildren. + /* */ - // check if there are dynamic scopedSlots (hand-written or compiled but with - // dynamic slot names). Static scoped slots compiled from template has the - // "$stable" marker. - var hasDynamicScopedSlot = !!( - (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || - (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) - ); - // Any static slot children from the parent may have changed during parent's - // update. Dynamic scoped slots may also have changed. In such cases, a forced - // update is necessary to ensure correctness. - var needsForceUpdate = !!( - renderChildren || // has new static slots - vm.$options._renderChildren || // has old static slots - hasDynamicScopedSlot - ); + function bindDynamicKeys (baseObj, values) { + for (var i = 0; i < values.length; i += 2) { + var key = values[i]; + if (typeof key === 'string' && key) { + baseObj[values[i]] = values[i + 1]; + } else if (key !== '' && key !== null) { + // null is a speical value for explicitly removing a binding + warn( + ("Invalid value for dynamic directive argument (expected string or null): " + key), + this + ); + } + } + return baseObj + } - vm.$options._parentVnode = parentVnode; - vm.$vnode = parentVnode; // update vm's placeholder node without re-render + // helper to dynamically append modifier runtime markers to event names. + // ensure only append when value is already string, otherwise it will be cast + // to string and cause the type check to miss. + function prependModifier (value, symbol) { + return typeof value === 'string' ? symbol + value : value + } - if (vm._vnode) { // update child tree's parent - vm._vnode.parent = parentVnode; - } - vm.$options._renderChildren = renderChildren; + /* */ - // update $attrs and $listeners hash - // these are also reactive so they may trigger child update if the child - // used them during render - vm.$attrs = parentVnode.data.attrs || emptyObject; - vm.$listeners = listeners || emptyObject; + function installRenderHelpers (target) { + target._o = markOnce; + target._n = toNumber; + target._s = toString; + target._l = renderList; + target._t = renderSlot; + target._q = looseEqual; + target._i = looseIndexOf; + target._m = renderStatic; + target._f = resolveFilter; + target._k = checkKeyCodes; + target._b = bindObjectProps; + target._v = createTextVNode; + target._e = createEmptyVNode; + target._u = resolveScopedSlots; + target._g = bindObjectListeners; + target._d = bindDynamicKeys; + target._p = prependModifier; + } - // update props - if (propsData && vm.$options.props) { - toggleObserving(false); - var props = vm._props; - var propKeys = vm.$options._propKeys || []; - for (var i = 0; i < propKeys.length; i++) { - var key = propKeys[i]; - var propOptions = vm.$options.props; // wtf flow? - props[key] = validateProp(key, propOptions, propsData, vm); - } - toggleObserving(true); - // keep a copy of raw propsData - vm.$options.propsData = propsData; + /* */ + + function FunctionalRenderContext ( + data, + props, + children, + parent, + Ctor + ) { + var options = Ctor.options; + // ensure the createElement function in functional components + // gets a unique context - this is necessary for correct named slot check + var contextVm; + if (hasOwn(parent, '_uid')) { + contextVm = Object.create(parent); + // $flow-disable-line + contextVm._original = parent; + } else { + // the context vm passed in is a functional context as well. + // in this case we want to make sure we are able to get a hold to the + // real context instance. + contextVm = parent; + // $flow-disable-line + parent = parent._original; } + var isCompiled = isTrue(options._compiled); + var needNormalization = !isCompiled; - // update listeners - listeners = listeners || emptyObject; - var oldListeners = vm.$options._parentListeners; - vm.$options._parentListeners = listeners; - updateComponentListeners(vm, listeners, oldListeners); + this.data = data; + this.props = props; + this.children = children; + this.parent = parent; + this.listeners = data.on || emptyObject; + this.injections = resolveInject(options.inject, parent); + this.slots = function () { return resolveSlots(children, parent); }; - // resolve slots + force update if has children - if (needsForceUpdate) { - vm.$slots = resolveSlots(renderChildren, parentVnode.context); - vm.$forceUpdate(); - } + Object.defineProperty(this, 'scopedSlots', ({ + enumerable: true, + get: function get () { + return normalizeScopedSlots(data.scopedSlots, this.slots()) + } + })); - { - isUpdatingChildComponent = false; + // support for compiled functional template + if (isCompiled) { + // exposing $options for renderStatic() + this.$options = options; + // pre-resolve slots for renderSlot() + this.$slots = this.slots(); + this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); } - } - function isInInactiveTree (vm) { - while (vm && (vm = vm.$parent)) { - if (vm._inactive) { return true } + if (options._scopeId) { + this._c = function (a, b, c, d) { + var vnode = createElement(contextVm, a, b, c, d, needNormalization); + if (vnode && !Array.isArray(vnode)) { + vnode.fnScopeId = options._scopeId; + vnode.fnContext = parent; + } + return vnode + }; + } else { + this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; } - return false } - function activateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = false; - if (isInInactiveTree(vm)) { - return + installRenderHelpers(FunctionalRenderContext.prototype); + + function createFunctionalComponent ( + Ctor, + propsData, + data, + contextVm, + children + ) { + var options = Ctor.options; + var props = {}; + var propOptions = options.props; + if (isDef(propOptions)) { + for (var key in propOptions) { + props[key] = validateProp(key, propOptions, propsData || emptyObject); } - } else if (vm._directInactive) { - return + } else { + if (isDef(data.attrs)) { mergeProps(props, data.attrs); } + if (isDef(data.props)) { mergeProps(props, data.props); } } - if (vm._inactive || vm._inactive === null) { - vm._inactive = false; - for (var i = 0; i < vm.$children.length; i++) { - activateChildComponent(vm.$children[i]); + + var renderContext = new FunctionalRenderContext( + data, + props, + children, + contextVm, + Ctor + ); + + var vnode = options.render.call(null, renderContext._c, renderContext); + + if (vnode instanceof VNode) { + return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) + } else if (Array.isArray(vnode)) { + var vnodes = normalizeChildren(vnode) || []; + var res = new Array(vnodes.length); + for (var i = 0; i < vnodes.length; i++) { + res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); } - callHook(vm, 'activated'); + return res } } - function deactivateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = true; - if (isInInactiveTree(vm)) { - return - } + function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { + // #7817 clone node before setting fnContext, otherwise if the node is reused + // (e.g. it was from a cached normal slot) the fnContext causes named slots + // that should not be matched to match. + var clone = cloneVNode(vnode); + clone.fnContext = contextVm; + clone.fnOptions = options; + { + (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; } - if (!vm._inactive) { - vm._inactive = true; - for (var i = 0; i < vm.$children.length; i++) { - deactivateChildComponent(vm.$children[i]); - } - callHook(vm, 'deactivated'); + if (data.slot) { + (clone.data || (clone.data = {})).slot = data.slot; } + return clone } - function callHook (vm, hook) { - // #7573 disable dep collection when invoking lifecycle hooks - pushTarget(); - var handlers = vm.$options[hook]; - var info = hook + " hook"; - if (handlers) { - for (var i = 0, j = handlers.length; i < j; i++) { - invokeWithErrorHandling(handlers[i], vm, null, vm, info); - } - } - if (vm._hasHookEvent) { - vm.$emit('hook:' + hook); + function mergeProps (to, from) { + for (var key in from) { + to[camelize(key)] = from[key]; } - popTarget(); } /* */ - var MAX_UPDATE_COUNT = 100; + /* */ - var queue = []; - var activatedChildren = []; - var has = {}; - var circular = {}; - var waiting = false; - var flushing = false; - var index = 0; + /* */ - /** - * Reset the scheduler's state. - */ - function resetSchedulerState () { - index = queue.length = activatedChildren.length = 0; - has = {}; - { - circular = {}; - } - waiting = flushing = false; - } + /* */ - // Async edge case #6566 requires saving the timestamp when event listeners are - // attached. However, calling performance.now() has a perf overhead especially - // if the page has thousands of event listeners. Instead, we take a timestamp - // every time the scheduler flushes and use that for all event listeners - // attached during that flush. - var currentFlushTimestamp = 0; + // inline hooks to be invoked on component VNodes during patch + var componentVNodeHooks = { + init: function init (vnode, hydrating) { + if ( + vnode.componentInstance && + !vnode.componentInstance._isDestroyed && + vnode.data.keepAlive + ) { + // kept-alive components, treat as a patch + var mountedNode = vnode; // work around flow + componentVNodeHooks.prepatch(mountedNode, mountedNode); + } else { + var child = vnode.componentInstance = createComponentInstanceForVnode( + vnode, + activeInstance + ); + child.$mount(hydrating ? vnode.elm : undefined, hydrating); + } + }, - // Async edge case fix requires storing an event listener's attach timestamp. - var getNow = Date.now; + prepatch: function prepatch (oldVnode, vnode) { + var options = vnode.componentOptions; + var child = vnode.componentInstance = oldVnode.componentInstance; + updateChildComponent( + child, + options.propsData, // updated props + options.listeners, // updated listeners + vnode, // new parent vnode + options.children // new children + ); + }, - // Determine what event timestamp the browser is using. Annoyingly, the - // timestamp can either be hi-res ( relative to poge load) or low-res - // (relative to UNIX epoch), so in order to compare time we have to use the - // same timestamp type when saving the flush timestamp. - if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { - // if the low-res timestamp which is bigger than the event timestamp - // (which is evaluated AFTER) it means the event is using a hi-res timestamp, - // and we need to use the hi-res version for event listeners as well. - getNow = function () { return performance.now(); }; - } + insert: function insert (vnode) { + var context = vnode.context; + var componentInstance = vnode.componentInstance; + if (!componentInstance._isMounted) { + componentInstance._isMounted = true; + callHook(componentInstance, 'mounted'); + } + if (vnode.data.keepAlive) { + if (context._isMounted) { + // vue-router#1212 + // During updates, a kept-alive component's child components may + // change, so directly walking the tree here may call activated hooks + // on incorrect children. Instead we push them into a queue which will + // be processed after the whole patch process ended. + queueActivatedComponent(componentInstance); + } else { + activateChildComponent(componentInstance, true /* direct */); + } + } + }, - /** - * Flush both queues and run the watchers. - */ - function flushSchedulerQueue () { - currentFlushTimestamp = getNow(); - flushing = true; - var watcher, id; + destroy: function destroy (vnode) { + var componentInstance = vnode.componentInstance; + if (!componentInstance._isDestroyed) { + if (!vnode.data.keepAlive) { + componentInstance.$destroy(); + } else { + deactivateChildComponent(componentInstance, true /* direct */); + } + } + } + }; - // Sort queue before flush. - // This ensures that: - // 1. Components are updated from parent to child. (because parent is always - // created before the child) - // 2. A component's user watchers are run before its render watcher (because - // user watchers are created before the render watcher) - // 3. If a component is destroyed during a parent component's watcher run, - // its watchers can be skipped. - queue.sort(function (a, b) { return a.id - b.id; }); + var hooksToMerge = Object.keys(componentVNodeHooks); - // do not cache length because more watchers might be pushed - // as we run existing watchers - for (index = 0; index < queue.length; index++) { - watcher = queue[index]; - if (watcher.before) { - watcher.before(); + function createComponent ( + Ctor, + data, + context, + children, + tag + ) { + if (isUndef(Ctor)) { + return + } + + var baseCtor = context.$options._base; + + // plain options object: turn it into a constructor + if (isObject(Ctor)) { + Ctor = baseCtor.extend(Ctor); + } + + // if at this stage it's not a constructor or an async component factory, + // reject. + if (typeof Ctor !== 'function') { + { + warn(("Invalid Component definition: " + (String(Ctor))), context); } - id = watcher.id; - has[id] = null; - watcher.run(); - // in dev build, check and stop circular updates. - if (has[id] != null) { - circular[id] = (circular[id] || 0) + 1; - if (circular[id] > MAX_UPDATE_COUNT) { - warn( - 'You may have an infinite update loop ' + ( - watcher.user - ? ("in watcher with expression \"" + (watcher.expression) + "\"") - : "in a component render function." - ), - watcher.vm - ); - break - } + return + } + + // async component + var asyncFactory; + if (isUndef(Ctor.cid)) { + asyncFactory = Ctor; + Ctor = resolveAsyncComponent(asyncFactory, baseCtor); + if (Ctor === undefined) { + // return a placeholder node for async component, which is rendered + // as a comment node but preserves all the raw information for the node. + // the information will be used for async server-rendering and hydration. + return createAsyncPlaceholder( + asyncFactory, + data, + context, + children, + tag + ) } } - // keep copies of post queues before resetting state - var activatedQueue = activatedChildren.slice(); - var updatedQueue = queue.slice(); + data = data || {}; - resetSchedulerState(); + // resolve constructor options in case global mixins are applied after + // component constructor creation + resolveConstructorOptions(Ctor); - // call component updated and activated hooks - callActivatedHooks(activatedQueue); - callUpdatedHooks(updatedQueue); + // transform component v-model data into props & events + if (isDef(data.model)) { + transformModel(Ctor.options, data); + } - // devtool hook - /* istanbul ignore if */ - if (devtools && config.devtools) { - devtools.emit('flush'); + // extract props + var propsData = extractPropsFromVNodeData(data, Ctor, tag); + + // functional component + if (isTrue(Ctor.options.functional)) { + return createFunctionalComponent(Ctor, propsData, data, context, children) } - } - function callUpdatedHooks (queue) { - var i = queue.length; - while (i--) { - var watcher = queue[i]; - var vm = watcher.vm; - if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'updated'); + // extract listeners, since these needs to be treated as + // child component listeners instead of DOM listeners + var listeners = data.on; + // replace with listeners with .native modifier + // so it gets processed during parent component patch. + data.on = data.nativeOn; + + if (isTrue(Ctor.options.abstract)) { + // abstract components do not keep anything + // other than props & listeners & slot + + // work around flow + var slot = data.slot; + data = {}; + if (slot) { + data.slot = slot; } } - } - /** - * Queue a kept-alive component that was activated during patch. - * The queue will be processed after the entire tree has been patched. - */ - function queueActivatedComponent (vm) { - // setting _inactive to false here so that a render function can - // rely on checking whether it's in an inactive tree (e.g. router-view) - vm._inactive = false; - activatedChildren.push(vm); + // install component management hooks onto the placeholder node + installComponentHooks(data); + + // return a placeholder vnode + var name = Ctor.options.name || tag; + var vnode = new VNode( + ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), + data, undefined, undefined, undefined, context, + { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, + asyncFactory + ); + + return vnode } - function callActivatedHooks (queue) { - for (var i = 0; i < queue.length; i++) { - queue[i]._inactive = true; - activateChildComponent(queue[i], true /* true */); + function createComponentInstanceForVnode ( + vnode, // we know it's MountedComponentVNode but flow doesn't + parent // activeInstance in lifecycle state + ) { + var options = { + _isComponent: true, + _parentVnode: vnode, + parent: parent + }; + // check inline-template render functions + var inlineTemplate = vnode.data.inlineTemplate; + if (isDef(inlineTemplate)) { + options.render = inlineTemplate.render; + options.staticRenderFns = inlineTemplate.staticRenderFns; } + return new vnode.componentOptions.Ctor(options) } - /** - * Push a watcher into the watcher queue. - * Jobs with duplicate IDs will be skipped unless it's - * pushed when the queue is being flushed. - */ - function queueWatcher (watcher) { - var id = watcher.id; - if (has[id] == null) { - has[id] = true; - if (!flushing) { - queue.push(watcher); - } else { - // if already flushing, splice the watcher based on its id - // if already past its id, it will be run next immediately. - var i = queue.length - 1; - while (i > index && queue[i].id > watcher.id) { - i--; - } - queue.splice(i + 1, 0, watcher); + function installComponentHooks (data) { + var hooks = data.hook || (data.hook = {}); + for (var i = 0; i < hooksToMerge.length; i++) { + var key = hooksToMerge[i]; + var existing = hooks[key]; + var toMerge = componentVNodeHooks[key]; + if (existing !== toMerge && !(existing && existing._merged)) { + hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; } - // queue the flush - if (!waiting) { - waiting = true; + } + } - if (!config.async) { - flushSchedulerQueue(); - return - } - nextTick(flushSchedulerQueue); + function mergeHook$1 (f1, f2) { + var merged = function (a, b) { + // flow complains about extra args which is why we use any + f1(a, b); + f2(a, b); + }; + merged._merged = true; + return merged + } + + // transform component v-model info (value and callback) into + // prop and event handler respectively. + function transformModel (options, data) { + var prop = (options.model && options.model.prop) || 'value'; + var event = (options.model && options.model.event) || 'input' + ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; + var on = data.on || (data.on = {}); + var existing = on[event]; + var callback = data.model.callback; + if (isDef(existing)) { + if ( + Array.isArray(existing) + ? existing.indexOf(callback) === -1 + : existing !== callback + ) { + on[event] = [callback].concat(existing); } + } else { + on[event] = callback; } } /* */ + var SIMPLE_NORMALIZE = 1; + var ALWAYS_NORMALIZE = 2; + // wrapper function for providing a more flexible interface + // without getting yelled at by flow + function createElement ( + context, + tag, + data, + children, + normalizationType, + alwaysNormalize + ) { + if (Array.isArray(data) || isPrimitive(data)) { + normalizationType = children; + children = data; + data = undefined; + } + if (isTrue(alwaysNormalize)) { + normalizationType = ALWAYS_NORMALIZE; + } + return _createElement(context, tag, data, children, normalizationType) + } - var uid$1 = 0; - - /** - * A watcher parses an expression, collects dependencies, - * and fires callback when the expression value changes. - * This is used for both the $watch() api and directives. - */ - var Watcher = function Watcher ( - vm, - expOrFn, - cb, - options, - isRenderWatcher + function _createElement ( + context, + tag, + data, + children, + normalizationType ) { - this.vm = vm; - if (isRenderWatcher) { - vm._watcher = this; + if (isDef(data) && isDef((data).__ob__)) { + warn( + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + + 'Always create fresh vnode data objects in each render!', + context + ); + return createEmptyVNode() } - vm._watchers.push(this); - // options - if (options) { - this.deep = !!options.deep; - this.user = !!options.user; - this.lazy = !!options.lazy; - this.sync = !!options.sync; - this.before = options.before; + // object syntax in v-bind + if (isDef(data) && isDef(data.is)) { + tag = data.is; + } + if (!tag) { + // in case of component :is set to falsy value + return createEmptyVNode() + } + // warn against non-primitive key + if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) + ) { + { + warn( + 'Avoid using non-primitive value as key, ' + + 'use string/number value instead.', + context + ); + } + } + // support single function children as default scoped slot + if (Array.isArray(children) && + typeof children[0] === 'function' + ) { + data = data || {}; + data.scopedSlots = { default: children[0] }; + children.length = 0; + } + if (normalizationType === ALWAYS_NORMALIZE) { + children = normalizeChildren(children); + } else if (normalizationType === SIMPLE_NORMALIZE) { + children = simpleNormalizeChildren(children); + } + var vnode, ns; + if (typeof tag === 'string') { + var Ctor; + ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); + if (config.isReservedTag(tag)) { + // platform built-in elements + vnode = new VNode( + config.parsePlatformTagName(tag), data, children, + undefined, undefined, context + ); + } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { + // component + vnode = createComponent(Ctor, data, context, children, tag); + } else { + // unknown or unlisted namespaced elements + // check at runtime because it may get assigned a namespace when its + // parent normalizes children + vnode = new VNode( + tag, data, children, + undefined, undefined, context + ); + } } else { - this.deep = this.user = this.lazy = this.sync = false; + // direct component options / constructor + vnode = createComponent(tag, data, context, children); } - this.cb = cb; - this.id = ++uid$1; // uid for batching - this.active = true; - this.dirty = this.lazy; // for lazy watchers - this.deps = []; - this.newDeps = []; - this.depIds = new _Set(); - this.newDepIds = new _Set(); - this.expression = expOrFn.toString(); - // parse expression for getter - if (typeof expOrFn === 'function') { - this.getter = expOrFn; + if (Array.isArray(vnode)) { + return vnode + } else if (isDef(vnode)) { + if (isDef(ns)) { applyNS(vnode, ns); } + if (isDef(data)) { registerDeepBindings(data); } + return vnode } else { - this.getter = parsePath(expOrFn); - if (!this.getter) { - this.getter = noop; - warn( - "Failed watching path: \"" + expOrFn + "\" " + - 'Watcher only accepts simple dot-delimited paths. ' + - 'For full control, use a function instead.', - vm - ); - } + return createEmptyVNode() } - this.value = this.lazy - ? undefined - : this.get(); - }; + } - /** - * Evaluate the getter, and re-collect dependencies. - */ - Watcher.prototype.get = function get () { - pushTarget(this); - var value; - var vm = this.vm; - try { - value = this.getter.call(vm, vm); - } catch (e) { - if (this.user) { - handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); - } else { - throw e - } - } finally { - // "touch" every property so they are all tracked as - // dependencies for deep watching - if (this.deep) { - traverse(value); - } - popTarget(); - this.cleanupDeps(); + function applyNS (vnode, ns, force) { + vnode.ns = ns; + if (vnode.tag === 'foreignObject') { + // use default namespace inside foreignObject + ns = undefined; + force = true; } - return value - }; - - /** - * Add a dependency to this directive. - */ - Watcher.prototype.addDep = function addDep (dep) { - var id = dep.id; - if (!this.newDepIds.has(id)) { - this.newDepIds.add(id); - this.newDeps.push(dep); - if (!this.depIds.has(id)) { - dep.addSub(this); + if (isDef(vnode.children)) { + for (var i = 0, l = vnode.children.length; i < l; i++) { + var child = vnode.children[i]; + if (isDef(child.tag) && ( + isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { + applyNS(child, ns, force); + } } } - }; + } - /** - * Clean up for dependency collection. - */ - Watcher.prototype.cleanupDeps = function cleanupDeps () { - var i = this.deps.length; - while (i--) { - var dep = this.deps[i]; - if (!this.newDepIds.has(dep.id)) { - dep.removeSub(this); - } + // ref #5318 + // necessary to ensure parent re-render when deep bindings like :style and + // :class are used on slot nodes + function registerDeepBindings (data) { + if (isObject(data.style)) { + traverse(data.style); } - var tmp = this.depIds; - this.depIds = this.newDepIds; - this.newDepIds = tmp; - this.newDepIds.clear(); - tmp = this.deps; - this.deps = this.newDeps; - this.newDeps = tmp; - this.newDeps.length = 0; - }; + if (isObject(data.class)) { + traverse(data.class); + } + } + + /* */ + + function initRender (vm) { + vm._vnode = null; // the root of the child tree + vm._staticTrees = null; // v-once cached trees + var options = vm.$options; + var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree + var renderContext = parentVnode && parentVnode.context; + vm.$slots = resolveSlots(options._renderChildren, renderContext); + vm.$scopedSlots = emptyObject; + // bind the createElement fn to this instance + // so that we get proper render context inside it. + // args order: tag, data, children, normalizationType, alwaysNormalize + // internal version is used by render functions compiled from templates + vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; + // normalization is always applied for the public version, used in + // user-written render functions. + vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; + + // $attrs & $listeners are exposed for easier HOC creation. + // they need to be reactive so that HOCs using them are always updated + var parentData = parentVnode && parentVnode.data; - /** - * Subscriber interface. - * Will be called when a dependency changes. - */ - Watcher.prototype.update = function update () { /* istanbul ignore else */ - if (this.lazy) { - this.dirty = true; - } else if (this.sync) { - this.run(); - } else { - queueWatcher(this); + { + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { + !isUpdatingChildComponent && warn("$attrs is readonly.", vm); + }, true); + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { + !isUpdatingChildComponent && warn("$listeners is readonly.", vm); + }, true); } - }; + } - /** - * Scheduler job interface. - * Will be called by the scheduler. - */ - Watcher.prototype.run = function run () { - if (this.active) { - var value = this.get(); - if ( - value !== this.value || - // Deep watchers and watchers on Object/Arrays should fire even - // when the value is the same, because the value may - // have mutated. - isObject(value) || - this.deep - ) { - // set new value - var oldValue = this.value; - this.value = value; - if (this.user) { - try { - this.cb.call(this.vm, value, oldValue); - } catch (e) { - handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); - } - } else { - this.cb.call(this.vm, value, oldValue); - } - } - } - }; + var currentRenderingInstance = null; - /** - * Evaluate the value of the watcher. - * This only gets called for lazy watchers. - */ - Watcher.prototype.evaluate = function evaluate () { - this.value = this.get(); - this.dirty = false; - }; + function renderMixin (Vue) { + // install runtime convenience helpers + installRenderHelpers(Vue.prototype); - /** - * Depend on all deps collected by this watcher. - */ - Watcher.prototype.depend = function depend () { - var i = this.deps.length; - while (i--) { - this.deps[i].depend(); - } - }; + Vue.prototype.$nextTick = function (fn) { + return nextTick(fn, this) + }; - /** - * Remove self from all dependencies' subscriber list. - */ - Watcher.prototype.teardown = function teardown () { - if (this.active) { - // remove self from vm's watcher list - // this is a somewhat expensive operation so we skip it - // if the vm is being destroyed. - if (!this.vm._isBeingDestroyed) { - remove(this.vm._watchers, this); + Vue.prototype._render = function () { + var vm = this; + var ref = vm.$options; + var render = ref.render; + var _parentVnode = ref._parentVnode; + + if (_parentVnode) { + vm.$scopedSlots = normalizeScopedSlots( + _parentVnode.data.scopedSlots, + vm.$slots + ); + } + + // set parent vnode. this allows render functions to have access + // to the data on the placeholder node. + vm.$vnode = _parentVnode; + // render self + var vnode; + try { + // There's no need to maintain a stack becaues all render fns are called + // separately from one another. Nested component's render fns are called + // when parent component is patched. + currentRenderingInstance = vm; + vnode = render.call(vm._renderProxy, vm.$createElement); + } catch (e) { + handleError(e, vm, "render"); + // return error render result, + // or previous vnode to prevent render error causing blank component + /* istanbul ignore else */ + if (vm.$options.renderError) { + try { + vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); + } catch (e) { + handleError(e, vm, "renderError"); + vnode = vm._vnode; + } + } else { + vnode = vm._vnode; + } + } finally { + currentRenderingInstance = null; } - var i = this.deps.length; - while (i--) { - this.deps[i].removeSub(this); + // if the returned array contains only a single node, allow it + if (Array.isArray(vnode) && vnode.length === 1) { + vnode = vnode[0]; } - this.active = false; - } - }; + // return empty vnode in case the render function errored out + if (!(vnode instanceof VNode)) { + if (Array.isArray(vnode)) { + warn( + 'Multiple root nodes returned from render function. Render function ' + + 'should return a single root node.', + vm + ); + } + vnode = createEmptyVNode(); + } + // set parent + vnode.parent = _parentVnode; + return vnode + }; + } /* */ - var sharedPropertyDefinition = { - enumerable: true, - configurable: true, - get: noop, - set: noop - }; + function ensureCtor (comp, base) { + if ( + comp.__esModule || + (hasSymbol && comp[Symbol.toStringTag] === 'Module') + ) { + comp = comp.default; + } + return isObject(comp) + ? base.extend(comp) + : comp + } - function proxy (target, sourceKey, key) { - sharedPropertyDefinition.get = function proxyGetter () { - return this[sourceKey][key] - }; - sharedPropertyDefinition.set = function proxySetter (val) { - this[sourceKey][key] = val; - }; - Object.defineProperty(target, key, sharedPropertyDefinition); + function createAsyncPlaceholder ( + factory, + data, + context, + children, + tag + ) { + var node = createEmptyVNode(); + node.asyncFactory = factory; + node.asyncMeta = { data: data, context: context, children: children, tag: tag }; + return node } - function initState (vm) { - vm._watchers = []; - var opts = vm.$options; - if (opts.props) { initProps(vm, opts.props); } - if (opts.methods) { initMethods(vm, opts.methods); } - if (opts.data) { - initData(vm); - } else { - observe(vm._data = {}, true /* asRootData */); + function resolveAsyncComponent ( + factory, + baseCtor + ) { + if (isTrue(factory.error) && isDef(factory.errorComp)) { + return factory.errorComp } - if (opts.computed) { initComputed(vm, opts.computed); } - if (opts.watch && opts.watch !== nativeWatch) { - initWatch(vm, opts.watch); + + if (isDef(factory.resolved)) { + return factory.resolved } - } - function initProps (vm, propsOptions) { - var propsData = vm.$options.propsData || {}; - var props = vm._props = {}; - // cache prop keys so that future props updates can iterate using Array - // instead of dynamic object key enumeration. - var keys = vm.$options._propKeys = []; - var isRoot = !vm.$parent; - // root instance props should be converted - if (!isRoot) { - toggleObserving(false); + if (isTrue(factory.loading) && isDef(factory.loadingComp)) { + return factory.loadingComp } - var loop = function ( key ) { - keys.push(key); - var value = validateProp(key, propsOptions, propsData, vm); - /* istanbul ignore else */ - { - var hyphenatedKey = hyphenate(key); - if (isReservedAttribute(hyphenatedKey) || - config.isReservedAttr(hyphenatedKey)) { - warn( - ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), - vm - ); + + var owner = currentRenderingInstance; + if (isDef(factory.owners)) { + // already pending + factory.owners.push(owner); + } else { + var owners = factory.owners = [owner]; + var sync = true; + + var forceRender = function (renderCompleted) { + for (var i = 0, l = owners.length; i < l; i++) { + (owners[i]).$forceUpdate(); } - defineReactive$$1(props, key, value, function () { - if (!isRoot && !isUpdatingChildComponent) { - warn( - "Avoid mutating a prop directly since the value will be " + - "overwritten whenever the parent component re-renders. " + - "Instead, use a data or computed property based on the prop's " + - "value. Prop being mutated: \"" + key + "\"", - vm - ); - } - }); - } - // static props are already proxied on the component's prototype - // during Vue.extend(). We only need to proxy props defined at - // instantiation here. - if (!(key in vm)) { - proxy(vm, "_props", key); - } - }; - for (var key in propsOptions) loop( key ); - toggleObserving(true); - } + if (renderCompleted) { + owners.length = 0; + } + }; - function initData (vm) { - var data = vm.$options.data; - data = vm._data = typeof data === 'function' - ? getData(data, vm) - : data || {}; - if (!isPlainObject(data)) { - data = {}; - warn( - 'data functions should return an object:\n' + - 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', - vm - ); - } - // proxy data on instance - var keys = Object.keys(data); - var props = vm.$options.props; - var methods = vm.$options.methods; - var i = keys.length; - while (i--) { - var key = keys[i]; - { - if (methods && hasOwn(methods, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a data property."), - vm - ); + var resolve = once(function (res) { + // cache resolved + factory.resolved = ensureCtor(res, baseCtor); + // invoke callbacks only if this is not a synchronous resolve + // (async resolves are shimmed as synchronous during SSR) + if (!sync) { + forceRender(true); + } else { + owners.length = 0; } - } - if (props && hasOwn(props, key)) { + }); + + var reject = once(function (reason) { warn( - "The data property \"" + key + "\" is already declared as a prop. " + - "Use prop default value instead.", - vm + "Failed to resolve async component: " + (String(factory)) + + (reason ? ("\nReason: " + reason) : '') ); - } else if (!isReserved(key)) { - proxy(vm, "_data", key); + if (isDef(factory.errorComp)) { + factory.error = true; + forceRender(true); + } + }); + + var res = factory(resolve, reject); + + if (isObject(res)) { + if (isPromise(res)) { + // () => Promise + if (isUndef(factory.resolved)) { + res.then(resolve, reject); + } + } else if (isPromise(res.component)) { + res.component.then(resolve, reject); + + if (isDef(res.error)) { + factory.errorComp = ensureCtor(res.error, baseCtor); + } + + if (isDef(res.loading)) { + factory.loadingComp = ensureCtor(res.loading, baseCtor); + if (res.delay === 0) { + factory.loading = true; + } else { + setTimeout(function () { + if (isUndef(factory.resolved) && isUndef(factory.error)) { + factory.loading = true; + forceRender(false); + } + }, res.delay || 200); + } + } + + if (isDef(res.timeout)) { + setTimeout(function () { + if (isUndef(factory.resolved)) { + reject( + "timeout (" + (res.timeout) + "ms)" + ); + } + }, res.timeout); + } + } } - } - // observe data - observe(data, true /* asRootData */); - } - function getData (data, vm) { - // #7573 disable dep collection when invoking data getters - pushTarget(); - try { - return data.call(vm, vm) - } catch (e) { - handleError(e, vm, "data()"); - return {} - } finally { - popTarget(); + sync = false; + // return in case resolved synchronously + return factory.loading + ? factory.loadingComp + : factory.resolved } } - var computedWatcherOptions = { lazy: true }; - - function initComputed (vm, computed) { - // $flow-disable-line - var watchers = vm._computedWatchers = Object.create(null); - // computed properties are just getters during SSR - var isSSR = isServerRendering(); + /* */ - for (var key in computed) { - var userDef = computed[key]; - var getter = typeof userDef === 'function' ? userDef : userDef.get; - if (getter == null) { - warn( - ("Getter is missing for computed property \"" + key + "\"."), - vm - ); - } + function isAsyncPlaceholder (node) { + return node.isComment && node.asyncFactory + } - if (!isSSR) { - // create internal watcher for the computed property. - watchers[key] = new Watcher( - vm, - getter || noop, - noop, - computedWatcherOptions - ); - } + /* */ - // component-defined computed properties are already defined on the - // component prototype. We only need to define computed properties defined - // at instantiation here. - if (!(key in vm)) { - defineComputed(vm, key, userDef); - } else { - if (key in vm.$data) { - warn(("The computed property \"" + key + "\" is already defined in data."), vm); - } else if (vm.$options.props && key in vm.$options.props) { - warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); + function getFirstComponentChild (children) { + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + var c = children[i]; + if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { + return c } } } } - function defineComputed ( - target, - key, - userDef - ) { - var shouldCache = !isServerRendering(); - if (typeof userDef === 'function') { - sharedPropertyDefinition.get = shouldCache - ? createComputedGetter(key) - : createGetterInvoker(userDef); - sharedPropertyDefinition.set = noop; - } else { - sharedPropertyDefinition.get = userDef.get - ? shouldCache && userDef.cache !== false - ? createComputedGetter(key) - : createGetterInvoker(userDef.get) - : noop; - sharedPropertyDefinition.set = userDef.set || noop; - } - if (sharedPropertyDefinition.set === noop) { - sharedPropertyDefinition.set = function () { - warn( - ("Computed property \"" + key + "\" was assigned to but it has no setter."), - this - ); - }; - } - Object.defineProperty(target, key, sharedPropertyDefinition); - } + /* */ - function createComputedGetter (key) { - return function computedGetter () { - var watcher = this._computedWatchers && this._computedWatchers[key]; - if (watcher) { - if (watcher.dirty) { - watcher.evaluate(); - } - if (Dep.target) { - watcher.depend(); - } - return watcher.value - } + /* */ + + function initEvents (vm) { + vm._events = Object.create(null); + vm._hasHookEvent = false; + // init parent attached events + var listeners = vm.$options._parentListeners; + if (listeners) { + updateComponentListeners(vm, listeners); } } - function createGetterInvoker(fn) { - return function computedGetter () { - return fn.call(this, this) - } + var target; + + function add (event, fn) { + target.$on(event, fn); } - function initMethods (vm, methods) { - var props = vm.$options.props; - for (var key in methods) { - { - if (typeof methods[key] !== 'function') { - warn( - "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + - "Did you reference the function correctly?", - vm - ); - } - if (props && hasOwn(props, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a prop."), - vm - ); - } - if ((key in vm) && isReserved(key)) { - warn( - "Method \"" + key + "\" conflicts with an existing Vue instance method. " + - "Avoid defining component methods that start with _ or $." - ); - } - } - vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); - } + function remove$1 (event, fn) { + target.$off(event, fn); } - function initWatch (vm, watch) { - for (var key in watch) { - var handler = watch[key]; - if (Array.isArray(handler)) { - for (var i = 0; i < handler.length; i++) { - createWatcher(vm, key, handler[i]); - } - } else { - createWatcher(vm, key, handler); + function createOnceHandler (event, fn) { + var _target = target; + return function onceHandler () { + var res = fn.apply(null, arguments); + if (res !== null) { + _target.$off(event, onceHandler); } } } - function createWatcher ( + function updateComponentListeners ( vm, - expOrFn, - handler, - options + listeners, + oldListeners ) { - if (isPlainObject(handler)) { - options = handler; - handler = handler.handler; - } - if (typeof handler === 'string') { - handler = vm[handler]; - } - return vm.$watch(expOrFn, handler, options) + target = vm; + updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); + target = undefined; } - function stateMixin (Vue) { - // flow somehow has problems with directly declared definition object - // when using Object.defineProperty, so we have to procedurally build up - // the object here. - var dataDef = {}; - dataDef.get = function () { return this._data }; - var propsDef = {}; - propsDef.get = function () { return this._props }; - { - dataDef.set = function () { - warn( - 'Avoid replacing instance root $data. ' + - 'Use nested data properties instead.', - this - ); - }; - propsDef.set = function () { - warn("$props is readonly.", this); - }; - } - Object.defineProperty(Vue.prototype, '$data', dataDef); - Object.defineProperty(Vue.prototype, '$props', propsDef); + function eventsMixin (Vue) { + var hookRE = /^hook:/; + Vue.prototype.$on = function (event, fn) { + var vm = this; + if (Array.isArray(event)) { + for (var i = 0, l = event.length; i < l; i++) { + vm.$on(event[i], fn); + } + } else { + (vm._events[event] || (vm._events[event] = [])).push(fn); + // optimize hook:event cost by using a boolean flag marked at registration + // instead of a hash lookup + if (hookRE.test(event)) { + vm._hasHookEvent = true; + } + } + return vm + }; - Vue.prototype.$set = set; - Vue.prototype.$delete = del; + Vue.prototype.$once = function (event, fn) { + var vm = this; + function on () { + vm.$off(event, on); + fn.apply(vm, arguments); + } + on.fn = fn; + vm.$on(event, on); + return vm + }; + + Vue.prototype.$off = function (event, fn) { + var vm = this; + // all + if (!arguments.length) { + vm._events = Object.create(null); + return vm + } + // array of events + if (Array.isArray(event)) { + for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { + vm.$off(event[i$1], fn); + } + return vm + } + // specific event + var cbs = vm._events[event]; + if (!cbs) { + return vm + } + if (!fn) { + vm._events[event] = null; + return vm + } + // specific handler + var cb; + var i = cbs.length; + while (i--) { + cb = cbs[i]; + if (cb === fn || cb.fn === fn) { + cbs.splice(i, 1); + break + } + } + return vm + }; - Vue.prototype.$watch = function ( - expOrFn, - cb, - options - ) { + Vue.prototype.$emit = function (event) { var vm = this; - if (isPlainObject(cb)) { - return createWatcher(vm, expOrFn, cb, options) - } - options = options || {}; - options.user = true; - var watcher = new Watcher(vm, expOrFn, cb, options); - if (options.immediate) { - try { - cb.call(vm, watcher.value); - } catch (error) { - handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); + { + var lowerCaseEvent = event.toLowerCase(); + if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { + tip( + "Event \"" + lowerCaseEvent + "\" is emitted in component " + + (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + + "Note that HTML attributes are case-insensitive and you cannot use " + + "v-on to listen to camelCase events when using in-DOM templates. " + + "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." + ); } } - return function unwatchFn () { - watcher.teardown(); + var cbs = vm._events[event]; + if (cbs) { + cbs = cbs.length > 1 ? toArray(cbs) : cbs; + var args = toArray(arguments, 1); + var info = "event handler for \"" + event + "\""; + for (var i = 0, l = cbs.length; i < l; i++) { + invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } } + return vm }; } /* */ - function initProvide (vm) { - var provide = vm.$options.provide; - if (provide) { - vm._provided = typeof provide === 'function' - ? provide.call(vm) - : provide; - } - } + var activeInstance = null; + var isUpdatingChildComponent = false; - function initInjections (vm) { - var result = resolveInject(vm.$options.inject, vm); - if (result) { - toggleObserving(false); - Object.keys(result).forEach(function (key) { - /* istanbul ignore else */ - { - defineReactive$$1(vm, key, result[key], function () { - warn( - "Avoid mutating an injected value directly since the changes will be " + - "overwritten whenever the provided component re-renders. " + - "injection being mutated: \"" + key + "\"", - vm - ); - }); - } - }); - toggleObserving(true); + function setActiveInstance(vm) { + var prevActiveInstance = activeInstance; + activeInstance = vm; + return function () { + activeInstance = prevActiveInstance; } } - function resolveInject (inject, vm) { - if (inject) { - // inject is :any because flow is not smart enough to figure out cached - var result = Object.create(null); - var keys = hasSymbol - ? Reflect.ownKeys(inject) - : Object.keys(inject); + function initLifecycle (vm) { + var options = vm.$options; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - // #6574 in case the inject object is observed... - if (key === '__ob__') { continue } - var provideKey = inject[key].from; - var source = vm; - while (source) { - if (source._provided && hasOwn(source._provided, provideKey)) { - result[key] = source._provided[provideKey]; - break - } - source = source.$parent; - } - if (!source) { - if ('default' in inject[key]) { - var provideDefault = inject[key].default; - result[key] = typeof provideDefault === 'function' - ? provideDefault.call(vm) - : provideDefault; - } else { - warn(("Injection \"" + key + "\" not found"), vm); - } - } + // locate first non-abstract parent + var parent = options.parent; + if (parent && !options.abstract) { + while (parent.$options.abstract && parent.$parent) { + parent = parent.$parent; } - return result + parent.$children.push(vm); } - } - - /* */ - function normalizeScopedSlots ( - slots, - normalSlots - ) { - var res; - if (!slots) { - res = {}; - } else if (slots._normalized) { - return slots - } else { - res = {}; - for (var key in slots) { - if (slots[key] && key[0] !== '$') { - res[key] = normalizeScopedSlot(normalSlots, key, slots[key]); - } - } - } - // expose normal slots on scopedSlots - for (var key$1 in normalSlots) { - if (!(key$1 in res)) { - res[key$1] = proxyNormalSlot(normalSlots, key$1); - } - } - res._normalized = true; - res.$stable = slots ? slots.$stable : true; - return res - } + vm.$parent = parent; + vm.$root = parent ? parent.$root : vm; - function normalizeScopedSlot(normalSlots, key, fn) { - var normalized = function (scope) { - if ( scope === void 0 ) scope = {}; + vm.$children = []; + vm.$refs = {}; - var res = fn(scope); - return res && typeof res === 'object' && !Array.isArray(res) - ? [res] // single vnode - : normalizeChildren(res) - }; - // proxy scoped slots on normal $slots - if (!hasOwn(normalSlots, key)) { - Object.defineProperty(normalSlots, key, { - get: normalized - }); - } - return normalized + vm._watcher = null; + vm._inactive = null; + vm._directInactive = false; + vm._isMounted = false; + vm._isDestroyed = false; + vm._isBeingDestroyed = false; } - function proxyNormalSlot(slots, key) { - return function () { return slots[key]; } - } + function lifecycleMixin (Vue) { + Vue.prototype._update = function (vnode, hydrating) { + var vm = this; + var prevEl = vm.$el; + var prevVnode = vm._vnode; + var restoreActiveInstance = setActiveInstance(vm); + vm._vnode = vnode; + // Vue.prototype.__patch__ is injected in entry points + // based on the rendering backend used. + if (!prevVnode) { + // initial render + vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); + } else { + // updates + vm.$el = vm.__patch__(prevVnode, vnode); + } + restoreActiveInstance(); + // update __vue__ reference + if (prevEl) { + prevEl.__vue__ = null; + } + if (vm.$el) { + vm.$el.__vue__ = vm; + } + // if parent is an HOC, update its $el as well + if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { + vm.$parent.$el = vm.$el; + } + // updated hook is called by the scheduler to ensure that children are + // updated in a parent's updated hook. + }; - /* */ + Vue.prototype.$forceUpdate = function () { + var vm = this; + if (vm._watcher) { + vm._watcher.update(); + } + }; - /** - * Runtime helper for rendering v-for lists. - */ - function renderList ( - val, - render - ) { - var ret, i, l, keys, key; - if (Array.isArray(val) || typeof val === 'string') { - ret = new Array(val.length); - for (i = 0, l = val.length; i < l; i++) { - ret[i] = render(val[i], i); + Vue.prototype.$destroy = function () { + var vm = this; + if (vm._isBeingDestroyed) { + return } - } else if (typeof val === 'number') { - ret = new Array(val); - for (i = 0; i < val; i++) { - ret[i] = render(i + 1, i); + callHook(vm, 'beforeDestroy'); + vm._isBeingDestroyed = true; + // remove self from parent + var parent = vm.$parent; + if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { + remove(parent.$children, vm); } - } else if (isObject(val)) { - if (hasSymbol && val[Symbol.iterator]) { - ret = []; - var iterator = val[Symbol.iterator](); - var result = iterator.next(); - while (!result.done) { - ret.push(render(result.value, ret.length)); - result = iterator.next(); - } - } else { - keys = Object.keys(val); - ret = new Array(keys.length); - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - ret[i] = render(val[key], key, i); - } + // teardown watchers + if (vm._watcher) { + vm._watcher.teardown(); + } + var i = vm._watchers.length; + while (i--) { + vm._watchers[i].teardown(); + } + // remove reference from data ob + // frozen object may not have observer. + if (vm._data.__ob__) { + vm._data.__ob__.vmCount--; + } + // call the last hook... + vm._isDestroyed = true; + // invoke destroy hooks on current rendered tree + vm.__patch__(vm._vnode, null); + // fire destroyed hook + callHook(vm, 'destroyed'); + // turn off all instance listeners. + vm.$off(); + // remove __vue__ reference + if (vm.$el) { + vm.$el.__vue__ = null; } - } - if (!isDef(ret)) { - ret = []; - } - (ret)._isVList = true; - return ret + // release circular reference (#6759) + if (vm.$vnode) { + vm.$vnode.parent = null; + } + }; } - /* */ - - /** - * Runtime helper for rendering - */ - function renderSlot ( - name, - fallback, - props, - bindObject + function mountComponent ( + vm, + el, + hydrating ) { - var scopedSlotFn = this.$scopedSlots[name]; - var nodes; - if (scopedSlotFn) { // scoped slot - props = props || {}; - if (bindObject) { - if (!isObject(bindObject)) { + vm.$el = el; + if (!vm.$options.render) { + vm.$options.render = createEmptyVNode; + { + /* istanbul ignore if */ + if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || + vm.$options.el || el) { warn( - 'slot v-bind without argument expects an Object', - this + 'You are using the runtime-only build of Vue where the template ' + + 'compiler is not available. Either pre-compile the templates into ' + + 'render functions, or use the compiler-included build.', + vm + ); + } else { + warn( + 'Failed to mount component: template or render function not defined.', + vm ); } - props = extend(extend({}, bindObject), props); } - nodes = scopedSlotFn(props) || fallback; - } else { - nodes = this.$slots[name] || fallback; } + callHook(vm, 'beforeMount'); - var target = props && props.slot; - if (target) { - return this.$createElement('template', { slot: target }, nodes) - } else { - return nodes - } - } + var updateComponent; + /* istanbul ignore if */ + if (config.performance && mark) { + updateComponent = function () { + var name = vm._name; + var id = vm._uid; + var startTag = "vue-perf-start:" + id; + var endTag = "vue-perf-end:" + id; - /* */ + mark(startTag); + var vnode = vm._render(); + mark(endTag); + measure(("vue " + name + " render"), startTag, endTag); - /** - * Runtime helper for resolving filters - */ - function resolveFilter (id) { - return resolveAsset(this.$options, 'filters', id, true) || identity - } + mark(startTag); + vm._update(vnode, hydrating); + mark(endTag); + measure(("vue " + name + " patch"), startTag, endTag); + }; + } else { + updateComponent = function () { + vm._update(vm._render(), hydrating); + }; + } - /* */ + // we set this to vm._watcher inside the watcher's constructor + // since the watcher's initial patch may call $forceUpdate (e.g. inside child + // component's mounted hook), which relies on vm._watcher being already defined + new Watcher(vm, updateComponent, noop, { + before: function before () { + if (vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'beforeUpdate'); + } + } + }, true /* isRenderWatcher */); + hydrating = false; - function isKeyNotMatch (expect, actual) { - if (Array.isArray(expect)) { - return expect.indexOf(actual) === -1 - } else { - return expect !== actual + // manually mounted instance, call mounted on self + // mounted is called for render-created child components in its inserted hook + if (vm.$vnode == null) { + vm._isMounted = true; + callHook(vm, 'mounted'); } + return vm } - /** - * Runtime helper for checking keyCodes from config. - * exposed as Vue.prototype._k - * passing in eventKeyName as last argument separately for backwards compat - */ - function checkKeyCodes ( - eventKeyCode, - key, - builtInKeyCode, - eventKeyName, - builtInKeyName + function updateChildComponent ( + vm, + propsData, + listeners, + parentVnode, + renderChildren ) { - var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; - if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { - return isKeyNotMatch(builtInKeyName, eventKeyName) - } else if (mappedKeyCode) { - return isKeyNotMatch(mappedKeyCode, eventKeyCode) - } else if (eventKeyName) { - return hyphenate(eventKeyName) !== key + { + isUpdatingChildComponent = true; } - } - - /* */ - /** - * Runtime helper for merging v-bind="object" into a VNode's data. - */ - function bindObjectProps ( - data, - tag, - value, - asProp, - isSync - ) { - if (value) { - if (!isObject(value)) { - warn( - 'v-bind without argument expects an Object or Array value', - this - ); - } else { - if (Array.isArray(value)) { - value = toObject(value); - } - var hash; - var loop = function ( key ) { - if ( - key === 'class' || - key === 'style' || - isReservedAttribute(key) - ) { - hash = data; - } else { - var type = data.attrs && data.attrs.type; - hash = asProp || config.mustUseProp(tag, type, key) - ? data.domProps || (data.domProps = {}) - : data.attrs || (data.attrs = {}); - } - var camelizedKey = camelize(key); - if (!(key in hash) && !(camelizedKey in hash)) { - hash[key] = value[key]; + // determine whether component has slot children + // we need to do this before overwriting $options._renderChildren. - if (isSync) { - var on = data.on || (data.on = {}); - on[("update:" + camelizedKey)] = function ($event) { - value[key] = $event; - }; - } - } - }; + // check if there are dynamic scopedSlots (hand-written or compiled but with + // dynamic slot names). Static scoped slots compiled from template has the + // "$stable" marker. + var hasDynamicScopedSlot = !!( + (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || + (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) + ); - for (var key in value) loop( key ); - } - } - return data - } + // Any static slot children from the parent may have changed during parent's + // update. Dynamic scoped slots may also have changed. In such cases, a forced + // update is necessary to ensure correctness. + var needsForceUpdate = !!( + renderChildren || // has new static slots + vm.$options._renderChildren || // has old static slots + hasDynamicScopedSlot + ); - /* */ + vm.$options._parentVnode = parentVnode; + vm.$vnode = parentVnode; // update vm's placeholder node without re-render - /** - * Runtime helper for rendering static trees. - */ - function renderStatic ( - index, - isInFor - ) { - var cached = this._staticTrees || (this._staticTrees = []); - var tree = cached[index]; - // if has already-rendered static tree and not inside v-for, - // we can reuse the same tree. - if (tree && !isInFor) { - return tree + if (vm._vnode) { // update child tree's parent + vm._vnode.parent = parentVnode; } - // otherwise, render a fresh tree. - tree = cached[index] = this.$options.staticRenderFns[index].call( - this._renderProxy, - null, - this // for render fns generated for functional component templates - ); - markStatic(tree, ("__static__" + index), false); - return tree - } + vm.$options._renderChildren = renderChildren; - /** - * Runtime helper for v-once. - * Effectively it means marking the node as static with a unique key. - */ - function markOnce ( - tree, - index, - key - ) { - markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); - return tree - } + // update $attrs and $listeners hash + // these are also reactive so they may trigger child update if the child + // used them during render + vm.$attrs = parentVnode.data.attrs || emptyObject; + vm.$listeners = listeners || emptyObject; - function markStatic ( - tree, - key, - isOnce - ) { - if (Array.isArray(tree)) { - for (var i = 0; i < tree.length; i++) { - if (tree[i] && typeof tree[i] !== 'string') { - markStaticNode(tree[i], (key + "_" + i), isOnce); - } + // update props + if (propsData && vm.$options.props) { + toggleObserving(false); + var props = vm._props; + var propKeys = vm.$options._propKeys || []; + for (var i = 0; i < propKeys.length; i++) { + var key = propKeys[i]; + var propOptions = vm.$options.props; // wtf flow? + props[key] = validateProp(key, propOptions, propsData, vm); } - } else { - markStaticNode(tree, key, isOnce); + toggleObserving(true); + // keep a copy of raw propsData + vm.$options.propsData = propsData; } - } - function markStaticNode (node, key, isOnce) { - node.isStatic = true; - node.key = key; - node.isOnce = isOnce; + // update listeners + listeners = listeners || emptyObject; + var oldListeners = vm.$options._parentListeners; + vm.$options._parentListeners = listeners; + updateComponentListeners(vm, listeners, oldListeners); + + // resolve slots + force update if has children + if (needsForceUpdate) { + vm.$slots = resolveSlots(renderChildren, parentVnode.context); + vm.$forceUpdate(); + } + + { + isUpdatingChildComponent = false; + } } - /* */ + function isInInactiveTree (vm) { + while (vm && (vm = vm.$parent)) { + if (vm._inactive) { return true } + } + return false + } - function bindObjectListeners (data, value) { - if (value) { - if (!isPlainObject(value)) { - warn( - 'v-on without argument expects an Object value', - this - ); - } else { - var on = data.on = data.on ? extend({}, data.on) : {}; - for (var key in value) { - var existing = on[key]; - var ours = value[key]; - on[key] = existing ? [].concat(existing, ours) : ours; - } + function activateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = false; + if (isInInactiveTree(vm)) { + return } + } else if (vm._directInactive) { + return + } + if (vm._inactive || vm._inactive === null) { + vm._inactive = false; + for (var i = 0; i < vm.$children.length; i++) { + activateChildComponent(vm.$children[i]); + } + callHook(vm, 'activated'); } - return data } - /* */ - - function bindDynamicKeys (baseObj, values) { - for (var i = 0; i < values.length; i += 2) { - var key = values[i]; - if (typeof key === 'string' && key) { - baseObj[values[i]] = values[i + 1]; - } else if (key !== '' && key !== null) { - // null is a speical value for explicitly removing a binding - warn( - ("Invalid value for dynamic directive argument (expected string or null): " + key), - this - ); + function deactivateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = true; + if (isInInactiveTree(vm)) { + return } } - return baseObj + if (!vm._inactive) { + vm._inactive = true; + for (var i = 0; i < vm.$children.length; i++) { + deactivateChildComponent(vm.$children[i]); + } + callHook(vm, 'deactivated'); + } } - // helper to dynamically append modifier runtime markers to event names. - // ensure only append when value is already string, otherwise it will be cast - // to string and cause the type check to miss. - function prependModifier (value, symbol) { - return typeof value === 'string' ? symbol + value : value + function callHook (vm, hook) { + // #7573 disable dep collection when invoking lifecycle hooks + pushTarget(); + var handlers = vm.$options[hook]; + var info = hook + " hook"; + if (handlers) { + for (var i = 0, j = handlers.length; i < j; i++) { + invokeWithErrorHandling(handlers[i], vm, null, vm, info); + } + } + if (vm._hasHookEvent) { + vm.$emit('hook:' + hook); + } + popTarget(); } /* */ - function installRenderHelpers (target) { - target._o = markOnce; - target._n = toNumber; - target._s = toString; - target._l = renderList; - target._t = renderSlot; - target._q = looseEqual; - target._i = looseIndexOf; - target._m = renderStatic; - target._f = resolveFilter; - target._k = checkKeyCodes; - target._b = bindObjectProps; - target._v = createTextVNode; - target._e = createEmptyVNode; - target._u = resolveScopedSlots; - target._g = bindObjectListeners; - target._d = bindDynamicKeys; - target._p = prependModifier; - } + var MAX_UPDATE_COUNT = 100; - /* */ + var queue = []; + var activatedChildren = []; + var has = {}; + var circular = {}; + var waiting = false; + var flushing = false; + var index = 0; - function FunctionalRenderContext ( - data, - props, - children, - parent, - Ctor - ) { - var options = Ctor.options; - // ensure the createElement function in functional components - // gets a unique context - this is necessary for correct named slot check - var contextVm; - if (hasOwn(parent, '_uid')) { - contextVm = Object.create(parent); - // $flow-disable-line - contextVm._original = parent; - } else { - // the context vm passed in is a functional context as well. - // in this case we want to make sure we are able to get a hold to the - // real context instance. - contextVm = parent; - // $flow-disable-line - parent = parent._original; + /** + * Reset the scheduler's state. + */ + function resetSchedulerState () { + index = queue.length = activatedChildren.length = 0; + has = {}; + { + circular = {}; } - var isCompiled = isTrue(options._compiled); - var needNormalization = !isCompiled; + waiting = flushing = false; + } - this.data = data; - this.props = props; - this.children = children; - this.parent = parent; - this.listeners = data.on || emptyObject; - this.injections = resolveInject(options.inject, parent); - this.slots = function () { return resolveSlots(children, parent); }; + // Async edge case #6566 requires saving the timestamp when event listeners are + // attached. However, calling performance.now() has a perf overhead especially + // if the page has thousands of event listeners. Instead, we take a timestamp + // every time the scheduler flushes and use that for all event listeners + // attached during that flush. + var currentFlushTimestamp = 0; - Object.defineProperty(this, 'scopedSlots', ({ - enumerable: true, - get: function get () { - return normalizeScopedSlots(data.scopedSlots, this.slots()) - } - })); + // Async edge case fix requires storing an event listener's attach timestamp. + var getNow = Date.now; - // support for compiled functional template - if (isCompiled) { - // exposing $options for renderStatic() - this.$options = options; - // pre-resolve slots for renderSlot() - this.$slots = this.slots(); - this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); - } + // Determine what event timestamp the browser is using. Annoyingly, the + // timestamp can either be hi-res (relative to page load) or low-res + // (relative to UNIX epoch), so in order to compare time we have to use the + // same timestamp type when saving the flush timestamp. + if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { + // if the low-res timestamp which is bigger than the event timestamp + // (which is evaluated AFTER) it means the event is using a hi-res timestamp, + // and we need to use the hi-res version for event listeners as well. + getNow = function () { return performance.now(); }; + } - if (options._scopeId) { - this._c = function (a, b, c, d) { - var vnode = createElement(contextVm, a, b, c, d, needNormalization); - if (vnode && !Array.isArray(vnode)) { - vnode.fnScopeId = options._scopeId; - vnode.fnContext = parent; + /** + * Flush both queues and run the watchers. + */ + function flushSchedulerQueue () { + currentFlushTimestamp = getNow(); + flushing = true; + var watcher, id; + + // Sort queue before flush. + // This ensures that: + // 1. Components are updated from parent to child. (because parent is always + // created before the child) + // 2. A component's user watchers are run before its render watcher (because + // user watchers are created before the render watcher) + // 3. If a component is destroyed during a parent component's watcher run, + // its watchers can be skipped. + queue.sort(function (a, b) { return a.id - b.id; }); + + // do not cache length because more watchers might be pushed + // as we run existing watchers + for (index = 0; index < queue.length; index++) { + watcher = queue[index]; + if (watcher.before) { + watcher.before(); + } + id = watcher.id; + has[id] = null; + watcher.run(); + // in dev build, check and stop circular updates. + if (has[id] != null) { + circular[id] = (circular[id] || 0) + 1; + if (circular[id] > MAX_UPDATE_COUNT) { + warn( + 'You may have an infinite update loop ' + ( + watcher.user + ? ("in watcher with expression \"" + (watcher.expression) + "\"") + : "in a component render function." + ), + watcher.vm + ); + break } - return vnode - }; - } else { - this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; + } } - } - installRenderHelpers(FunctionalRenderContext.prototype); + // keep copies of post queues before resetting state + var activatedQueue = activatedChildren.slice(); + var updatedQueue = queue.slice(); - function createFunctionalComponent ( - Ctor, - propsData, - data, - contextVm, - children - ) { - var options = Ctor.options; - var props = {}; - var propOptions = options.props; - if (isDef(propOptions)) { - for (var key in propOptions) { - props[key] = validateProp(key, propOptions, propsData || emptyObject); - } - } else { - if (isDef(data.attrs)) { mergeProps(props, data.attrs); } - if (isDef(data.props)) { mergeProps(props, data.props); } - } + resetSchedulerState(); - var renderContext = new FunctionalRenderContext( - data, - props, - children, - contextVm, - Ctor - ); + // call component updated and activated hooks + callActivatedHooks(activatedQueue); + callUpdatedHooks(updatedQueue); - var vnode = options.render.call(null, renderContext._c, renderContext); + // devtool hook + /* istanbul ignore if */ + if (devtools && config.devtools) { + devtools.emit('flush'); + } + } - if (vnode instanceof VNode) { - return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) - } else if (Array.isArray(vnode)) { - var vnodes = normalizeChildren(vnode) || []; - var res = new Array(vnodes.length); - for (var i = 0; i < vnodes.length; i++) { - res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); + function callUpdatedHooks (queue) { + var i = queue.length; + while (i--) { + var watcher = queue[i]; + var vm = watcher.vm; + if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'updated'); } - return res } } - function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { - // #7817 clone node before setting fnContext, otherwise if the node is reused - // (e.g. it was from a cached normal slot) the fnContext causes named slots - // that should not be matched to match. - var clone = cloneVNode(vnode); - clone.fnContext = contextVm; - clone.fnOptions = options; - { - (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; - } - if (data.slot) { - (clone.data || (clone.data = {})).slot = data.slot; + /** + * Queue a kept-alive component that was activated during patch. + * The queue will be processed after the entire tree has been patched. + */ + function queueActivatedComponent (vm) { + // setting _inactive to false here so that a render function can + // rely on checking whether it's in an inactive tree (e.g. router-view) + vm._inactive = false; + activatedChildren.push(vm); + } + + function callActivatedHooks (queue) { + for (var i = 0; i < queue.length; i++) { + queue[i]._inactive = true; + activateChildComponent(queue[i], true /* true */); } - return clone } - function mergeProps (to, from) { - for (var key in from) { - to[camelize(key)] = from[key]; + /** + * Push a watcher into the watcher queue. + * Jobs with duplicate IDs will be skipped unless it's + * pushed when the queue is being flushed. + */ + function queueWatcher (watcher) { + var id = watcher.id; + if (has[id] == null) { + has[id] = true; + if (!flushing) { + queue.push(watcher); + } else { + // if already flushing, splice the watcher based on its id + // if already past its id, it will be run next immediately. + var i = queue.length - 1; + while (i > index && queue[i].id > watcher.id) { + i--; + } + queue.splice(i + 1, 0, watcher); + } + // queue the flush + if (!waiting) { + waiting = true; + + if (!config.async) { + flushSchedulerQueue(); + return + } + nextTick(flushSchedulerQueue); + } } } /* */ - /* */ - /* */ - /* */ + var uid$2 = 0; - // inline hooks to be invoked on component VNodes during patch - var componentVNodeHooks = { - init: function init (vnode, hydrating) { - if ( - vnode.componentInstance && - !vnode.componentInstance._isDestroyed && - vnode.data.keepAlive - ) { - // kept-alive components, treat as a patch - var mountedNode = vnode; // work around flow - componentVNodeHooks.prepatch(mountedNode, mountedNode); - } else { - var child = vnode.componentInstance = createComponentInstanceForVnode( - vnode, - activeInstance + /** + * A watcher parses an expression, collects dependencies, + * and fires callback when the expression value changes. + * This is used for both the $watch() api and directives. + */ + var Watcher = function Watcher ( + vm, + expOrFn, + cb, + options, + isRenderWatcher + ) { + this.vm = vm; + if (isRenderWatcher) { + vm._watcher = this; + } + vm._watchers.push(this); + // options + if (options) { + this.deep = !!options.deep; + this.user = !!options.user; + this.lazy = !!options.lazy; + this.sync = !!options.sync; + this.before = options.before; + } else { + this.deep = this.user = this.lazy = this.sync = false; + } + this.cb = cb; + this.id = ++uid$2; // uid for batching + this.active = true; + this.dirty = this.lazy; // for lazy watchers + this.deps = []; + this.newDeps = []; + this.depIds = new _Set(); + this.newDepIds = new _Set(); + this.expression = expOrFn.toString(); + // parse expression for getter + if (typeof expOrFn === 'function') { + this.getter = expOrFn; + } else { + this.getter = parsePath(expOrFn); + if (!this.getter) { + this.getter = noop; + warn( + "Failed watching path: \"" + expOrFn + "\" " + + 'Watcher only accepts simple dot-delimited paths. ' + + 'For full control, use a function instead.', + vm ); - child.$mount(hydrating ? vnode.elm : undefined, hydrating); } - }, - - prepatch: function prepatch (oldVnode, vnode) { - var options = vnode.componentOptions; - var child = vnode.componentInstance = oldVnode.componentInstance; - updateChildComponent( - child, - options.propsData, // updated props - options.listeners, // updated listeners - vnode, // new parent vnode - options.children // new children - ); - }, + } + this.value = this.lazy + ? undefined + : this.get(); + }; - insert: function insert (vnode) { - var context = vnode.context; - var componentInstance = vnode.componentInstance; - if (!componentInstance._isMounted) { - componentInstance._isMounted = true; - callHook(componentInstance, 'mounted'); - } - if (vnode.data.keepAlive) { - if (context._isMounted) { - // vue-router#1212 - // During updates, a kept-alive component's child components may - // change, so directly walking the tree here may call activated hooks - // on incorrect children. Instead we push them into a queue which will - // be processed after the whole patch process ended. - queueActivatedComponent(componentInstance); - } else { - activateChildComponent(componentInstance, true /* direct */); - } + /** + * Evaluate the getter, and re-collect dependencies. + */ + Watcher.prototype.get = function get () { + pushTarget(this); + var value; + var vm = this.vm; + try { + value = this.getter.call(vm, vm); + } catch (e) { + if (this.user) { + handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); + } else { + throw e } - }, - - destroy: function destroy (vnode) { - var componentInstance = vnode.componentInstance; - if (!componentInstance._isDestroyed) { - if (!vnode.data.keepAlive) { - componentInstance.$destroy(); - } else { - deactivateChildComponent(componentInstance, true /* direct */); - } + } finally { + // "touch" every property so they are all tracked as + // dependencies for deep watching + if (this.deep) { + traverse(value); } + popTarget(); + this.cleanupDeps(); } + return value }; - var hooksToMerge = Object.keys(componentVNodeHooks); - - function createComponent ( - Ctor, - data, - context, - children, - tag - ) { - if (isUndef(Ctor)) { - return - } - - var baseCtor = context.$options._base; - - // plain options object: turn it into a constructor - if (isObject(Ctor)) { - Ctor = baseCtor.extend(Ctor); - } - - // if at this stage it's not a constructor or an async component factory, - // reject. - if (typeof Ctor !== 'function') { - { - warn(("Invalid Component definition: " + (String(Ctor))), context); + /** + * Add a dependency to this directive. + */ + Watcher.prototype.addDep = function addDep (dep) { + var id = dep.id; + if (!this.newDepIds.has(id)) { + this.newDepIds.add(id); + this.newDeps.push(dep); + if (!this.depIds.has(id)) { + dep.addSub(this); } - return } + }; - // async component - var asyncFactory; - if (isUndef(Ctor.cid)) { - asyncFactory = Ctor; - Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context); - if (Ctor === undefined) { - // return a placeholder node for async component, which is rendered - // as a comment node but preserves all the raw information for the node. - // the information will be used for async server-rendering and hydration. - return createAsyncPlaceholder( - asyncFactory, - data, - context, - children, - tag - ) + /** + * Clean up for dependency collection. + */ + Watcher.prototype.cleanupDeps = function cleanupDeps () { + var i = this.deps.length; + while (i--) { + var dep = this.deps[i]; + if (!this.newDepIds.has(dep.id)) { + dep.removeSub(this); } } + var tmp = this.depIds; + this.depIds = this.newDepIds; + this.newDepIds = tmp; + this.newDepIds.clear(); + tmp = this.deps; + this.deps = this.newDeps; + this.newDeps = tmp; + this.newDeps.length = 0; + }; - data = data || {}; - - // resolve constructor options in case global mixins are applied after - // component constructor creation - resolveConstructorOptions(Ctor); - - // transform component v-model data into props & events - if (isDef(data.model)) { - transformModel(Ctor.options, data); - } - - // extract props - var propsData = extractPropsFromVNodeData(data, Ctor, tag); - - // functional component - if (isTrue(Ctor.options.functional)) { - return createFunctionalComponent(Ctor, propsData, data, context, children) + /** + * Subscriber interface. + * Will be called when a dependency changes. + */ + Watcher.prototype.update = function update () { + /* istanbul ignore else */ + if (this.lazy) { + this.dirty = true; + } else if (this.sync) { + this.run(); + } else { + queueWatcher(this); } + }; - // extract listeners, since these needs to be treated as - // child component listeners instead of DOM listeners - var listeners = data.on; - // replace with listeners with .native modifier - // so it gets processed during parent component patch. - data.on = data.nativeOn; - - if (isTrue(Ctor.options.abstract)) { - // abstract components do not keep anything - // other than props & listeners & slot - - // work around flow - var slot = data.slot; - data = {}; - if (slot) { - data.slot = slot; + /** + * Scheduler job interface. + * Will be called by the scheduler. + */ + Watcher.prototype.run = function run () { + if (this.active) { + var value = this.get(); + if ( + value !== this.value || + // Deep watchers and watchers on Object/Arrays should fire even + // when the value is the same, because the value may + // have mutated. + isObject(value) || + this.deep + ) { + // set new value + var oldValue = this.value; + this.value = value; + if (this.user) { + try { + this.cb.call(this.vm, value, oldValue); + } catch (e) { + handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); + } + } else { + this.cb.call(this.vm, value, oldValue); + } } } + }; - // install component management hooks onto the placeholder node - installComponentHooks(data); - - // return a placeholder vnode - var name = Ctor.options.name || tag; - var vnode = new VNode( - ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), - data, undefined, undefined, undefined, context, - { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, - asyncFactory - ); - - return vnode - } - - function createComponentInstanceForVnode ( - vnode, // we know it's MountedComponentVNode but flow doesn't - parent // activeInstance in lifecycle state - ) { - var options = { - _isComponent: true, - _parentVnode: vnode, - parent: parent - }; - // check inline-template render functions - var inlineTemplate = vnode.data.inlineTemplate; - if (isDef(inlineTemplate)) { - options.render = inlineTemplate.render; - options.staticRenderFns = inlineTemplate.staticRenderFns; - } - return new vnode.componentOptions.Ctor(options) - } + /** + * Evaluate the value of the watcher. + * This only gets called for lazy watchers. + */ + Watcher.prototype.evaluate = function evaluate () { + this.value = this.get(); + this.dirty = false; + }; - function installComponentHooks (data) { - var hooks = data.hook || (data.hook = {}); - for (var i = 0; i < hooksToMerge.length; i++) { - var key = hooksToMerge[i]; - var existing = hooks[key]; - var toMerge = componentVNodeHooks[key]; - if (existing !== toMerge && !(existing && existing._merged)) { - hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; - } + /** + * Depend on all deps collected by this watcher. + */ + Watcher.prototype.depend = function depend () { + var i = this.deps.length; + while (i--) { + this.deps[i].depend(); } - } - - function mergeHook$1 (f1, f2) { - var merged = function (a, b) { - // flow complains about extra args which is why we use any - f1(a, b); - f2(a, b); - }; - merged._merged = true; - return merged - } + }; - // transform component v-model info (value and callback) into - // prop and event handler respectively. - function transformModel (options, data) { - var prop = (options.model && options.model.prop) || 'value'; - var event = (options.model && options.model.event) || 'input' - ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; - var on = data.on || (data.on = {}); - var existing = on[event]; - var callback = data.model.callback; - if (isDef(existing)) { - if ( - Array.isArray(existing) - ? existing.indexOf(callback) === -1 - : existing !== callback - ) { - on[event] = [callback].concat(existing); + /** + * Remove self from all dependencies' subscriber list. + */ + Watcher.prototype.teardown = function teardown () { + if (this.active) { + // remove self from vm's watcher list + // this is a somewhat expensive operation so we skip it + // if the vm is being destroyed. + if (!this.vm._isBeingDestroyed) { + remove(this.vm._watchers, this); } - } else { - on[event] = callback; + var i = this.deps.length; + while (i--) { + this.deps[i].removeSub(this); + } + this.active = false; } - } + }; /* */ - var SIMPLE_NORMALIZE = 1; - var ALWAYS_NORMALIZE = 2; + var sharedPropertyDefinition = { + enumerable: true, + configurable: true, + get: noop, + set: noop + }; - // wrapper function for providing a more flexible interface - // without getting yelled at by flow - function createElement ( - context, - tag, - data, - children, - normalizationType, - alwaysNormalize - ) { - if (Array.isArray(data) || isPrimitive(data)) { - normalizationType = children; - children = data; - data = undefined; + function proxy (target, sourceKey, key) { + sharedPropertyDefinition.get = function proxyGetter () { + return this[sourceKey][key] + }; + sharedPropertyDefinition.set = function proxySetter (val) { + this[sourceKey][key] = val; + }; + Object.defineProperty(target, key, sharedPropertyDefinition); + } + + function initState (vm) { + vm._watchers = []; + var opts = vm.$options; + if (opts.props) { initProps(vm, opts.props); } + if (opts.methods) { initMethods(vm, opts.methods); } + if (opts.data) { + initData(vm); + } else { + observe(vm._data = {}, true /* asRootData */); } - if (isTrue(alwaysNormalize)) { - normalizationType = ALWAYS_NORMALIZE; + if (opts.computed) { initComputed(vm, opts.computed); } + if (opts.watch && opts.watch !== nativeWatch) { + initWatch(vm, opts.watch); } - return _createElement(context, tag, data, children, normalizationType) } - function _createElement ( - context, - tag, - data, - children, - normalizationType - ) { - if (isDef(data) && isDef((data).__ob__)) { + function initProps (vm, propsOptions) { + var propsData = vm.$options.propsData || {}; + var props = vm._props = {}; + // cache prop keys so that future props updates can iterate using Array + // instead of dynamic object key enumeration. + var keys = vm.$options._propKeys = []; + var isRoot = !vm.$parent; + // root instance props should be converted + if (!isRoot) { + toggleObserving(false); + } + var loop = function ( key ) { + keys.push(key); + var value = validateProp(key, propsOptions, propsData, vm); + /* istanbul ignore else */ + { + var hyphenatedKey = hyphenate(key); + if (isReservedAttribute(hyphenatedKey) || + config.isReservedAttr(hyphenatedKey)) { + warn( + ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), + vm + ); + } + defineReactive$$1(props, key, value, function () { + if (!isRoot && !isUpdatingChildComponent) { + warn( + "Avoid mutating a prop directly since the value will be " + + "overwritten whenever the parent component re-renders. " + + "Instead, use a data or computed property based on the prop's " + + "value. Prop being mutated: \"" + key + "\"", + vm + ); + } + }); + } + // static props are already proxied on the component's prototype + // during Vue.extend(). We only need to proxy props defined at + // instantiation here. + if (!(key in vm)) { + proxy(vm, "_props", key); + } + }; + + for (var key in propsOptions) loop( key ); + toggleObserving(true); + } + + function initData (vm) { + var data = vm.$options.data; + data = vm._data = typeof data === 'function' + ? getData(data, vm) + : data || {}; + if (!isPlainObject(data)) { + data = {}; warn( - "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + - 'Always create fresh vnode data objects in each render!', - context + 'data functions should return an object:\n' + + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', + vm ); - return createEmptyVNode() - } - // object syntax in v-bind - if (isDef(data) && isDef(data.is)) { - tag = data.is; - } - if (!tag) { - // in case of component :is set to falsy value - return createEmptyVNode() } - // warn against non-primitive key - if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) - ) { + // proxy data on instance + var keys = Object.keys(data); + var props = vm.$options.props; + var methods = vm.$options.methods; + var i = keys.length; + while (i--) { + var key = keys[i]; { + if (methods && hasOwn(methods, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a data property."), + vm + ); + } + } + if (props && hasOwn(props, key)) { warn( - 'Avoid using non-primitive value as key, ' + - 'use string/number value instead.', - context + "The data property \"" + key + "\" is already declared as a prop. " + + "Use prop default value instead.", + vm ); + } else if (!isReserved(key)) { + proxy(vm, "_data", key); } } - // support single function children as default scoped slot - if (Array.isArray(children) && - typeof children[0] === 'function' - ) { - data = data || {}; - data.scopedSlots = { default: children[0] }; - children.length = 0; - } - if (normalizationType === ALWAYS_NORMALIZE) { - children = normalizeChildren(children); - } else if (normalizationType === SIMPLE_NORMALIZE) { - children = simpleNormalizeChildren(children); + // observe data + observe(data, true /* asRootData */); + } + + function getData (data, vm) { + // #7573 disable dep collection when invoking data getters + pushTarget(); + try { + return data.call(vm, vm) + } catch (e) { + handleError(e, vm, "data()"); + return {} + } finally { + popTarget(); } - var vnode, ns; - if (typeof tag === 'string') { - var Ctor; - ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); - if (config.isReservedTag(tag)) { - // platform built-in elements - vnode = new VNode( - config.parsePlatformTagName(tag), data, children, - undefined, undefined, context + } + + var computedWatcherOptions = { lazy: true }; + + function initComputed (vm, computed) { + // $flow-disable-line + var watchers = vm._computedWatchers = Object.create(null); + // computed properties are just getters during SSR + var isSSR = isServerRendering(); + + for (var key in computed) { + var userDef = computed[key]; + var getter = typeof userDef === 'function' ? userDef : userDef.get; + if (getter == null) { + warn( + ("Getter is missing for computed property \"" + key + "\"."), + vm ); - } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { - // component - vnode = createComponent(Ctor, data, context, children, tag); - } else { - // unknown or unlisted namespaced elements - // check at runtime because it may get assigned a namespace when its - // parent normalizes children - vnode = new VNode( - tag, data, children, - undefined, undefined, context + } + + if (!isSSR) { + // create internal watcher for the computed property. + watchers[key] = new Watcher( + vm, + getter || noop, + noop, + computedWatcherOptions ); } + + // component-defined computed properties are already defined on the + // component prototype. We only need to define computed properties defined + // at instantiation here. + if (!(key in vm)) { + defineComputed(vm, key, userDef); + } else { + if (key in vm.$data) { + warn(("The computed property \"" + key + "\" is already defined in data."), vm); + } else if (vm.$options.props && key in vm.$options.props) { + warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); + } + } + } + } + + function defineComputed ( + target, + key, + userDef + ) { + var shouldCache = !isServerRendering(); + if (typeof userDef === 'function') { + sharedPropertyDefinition.get = shouldCache + ? createComputedGetter(key) + : createGetterInvoker(userDef); + sharedPropertyDefinition.set = noop; } else { - // direct component options / constructor - vnode = createComponent(tag, data, context, children); + sharedPropertyDefinition.get = userDef.get + ? shouldCache && userDef.cache !== false + ? createComputedGetter(key) + : createGetterInvoker(userDef.get) + : noop; + sharedPropertyDefinition.set = userDef.set || noop; } - if (Array.isArray(vnode)) { - return vnode - } else if (isDef(vnode)) { - if (isDef(ns)) { applyNS(vnode, ns); } - if (isDef(data)) { registerDeepBindings(data); } - return vnode - } else { - return createEmptyVNode() + if (sharedPropertyDefinition.set === noop) { + sharedPropertyDefinition.set = function () { + warn( + ("Computed property \"" + key + "\" was assigned to but it has no setter."), + this + ); + }; } + Object.defineProperty(target, key, sharedPropertyDefinition); } - function applyNS (vnode, ns, force) { - vnode.ns = ns; - if (vnode.tag === 'foreignObject') { - // use default namespace inside foreignObject - ns = undefined; - force = true; - } - if (isDef(vnode.children)) { - for (var i = 0, l = vnode.children.length; i < l; i++) { - var child = vnode.children[i]; - if (isDef(child.tag) && ( - isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { - applyNS(child, ns, force); + function createComputedGetter (key) { + return function computedGetter () { + var watcher = this._computedWatchers && this._computedWatchers[key]; + if (watcher) { + if (watcher.dirty) { + watcher.evaluate(); } + if (Dep.target) { + watcher.depend(); + } + return watcher.value } } } - // ref #5318 - // necessary to ensure parent re-render when deep bindings like :style and - // :class are used on slot nodes - function registerDeepBindings (data) { - if (isObject(data.style)) { - traverse(data.style); - } - if (isObject(data.class)) { - traverse(data.class); + function createGetterInvoker(fn) { + return function computedGetter () { + return fn.call(this, this) } } - /* */ - - function initRender (vm) { - vm._vnode = null; // the root of the child tree - vm._staticTrees = null; // v-once cached trees - var options = vm.$options; - var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree - var renderContext = parentVnode && parentVnode.context; - vm.$slots = resolveSlots(options._renderChildren, renderContext); - vm.$scopedSlots = emptyObject; - // bind the createElement fn to this instance - // so that we get proper render context inside it. - // args order: tag, data, children, normalizationType, alwaysNormalize - // internal version is used by render functions compiled from templates - vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; - // normalization is always applied for the public version, used in - // user-written render functions. - vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; + function initMethods (vm, methods) { + var props = vm.$options.props; + for (var key in methods) { + { + if (typeof methods[key] !== 'function') { + warn( + "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + + "Did you reference the function correctly?", + vm + ); + } + if (props && hasOwn(props, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a prop."), + vm + ); + } + if ((key in vm) && isReserved(key)) { + warn( + "Method \"" + key + "\" conflicts with an existing Vue instance method. " + + "Avoid defining component methods that start with _ or $." + ); + } + } + vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); + } + } - // $attrs & $listeners are exposed for easier HOC creation. - // they need to be reactive so that HOCs using them are always updated - var parentData = parentVnode && parentVnode.data; + function initWatch (vm, watch) { + for (var key in watch) { + var handler = watch[key]; + if (Array.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + createWatcher(vm, key, handler[i]); + } + } else { + createWatcher(vm, key, handler); + } + } + } - /* istanbul ignore else */ - { - defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { - !isUpdatingChildComponent && warn("$attrs is readonly.", vm); - }, true); - defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { - !isUpdatingChildComponent && warn("$listeners is readonly.", vm); - }, true); + function createWatcher ( + vm, + expOrFn, + handler, + options + ) { + if (isPlainObject(handler)) { + options = handler; + handler = handler.handler; + } + if (typeof handler === 'string') { + handler = vm[handler]; } + return vm.$watch(expOrFn, handler, options) } - function renderMixin (Vue) { - // install runtime convenience helpers - installRenderHelpers(Vue.prototype); + function stateMixin (Vue) { + // flow somehow has problems with directly declared definition object + // when using Object.defineProperty, so we have to procedurally build up + // the object here. + var dataDef = {}; + dataDef.get = function () { return this._data }; + var propsDef = {}; + propsDef.get = function () { return this._props }; + { + dataDef.set = function () { + warn( + 'Avoid replacing instance root $data. ' + + 'Use nested data properties instead.', + this + ); + }; + propsDef.set = function () { + warn("$props is readonly.", this); + }; + } + Object.defineProperty(Vue.prototype, '$data', dataDef); + Object.defineProperty(Vue.prototype, '$props', propsDef); - Vue.prototype.$nextTick = function (fn) { - return nextTick(fn, this) - }; + Vue.prototype.$set = set; + Vue.prototype.$delete = del; - Vue.prototype._render = function () { + Vue.prototype.$watch = function ( + expOrFn, + cb, + options + ) { var vm = this; - var ref = vm.$options; - var render = ref.render; - var _parentVnode = ref._parentVnode; - - if (_parentVnode) { - vm.$scopedSlots = normalizeScopedSlots( - _parentVnode.data.scopedSlots, - vm.$slots - ); + if (isPlainObject(cb)) { + return createWatcher(vm, expOrFn, cb, options) } - - // set parent vnode. this allows render functions to have access - // to the data on the placeholder node. - vm.$vnode = _parentVnode; - // render self - var vnode; - try { - vnode = render.call(vm._renderProxy, vm.$createElement); - } catch (e) { - handleError(e, vm, "render"); - // return error render result, - // or previous vnode to prevent render error causing blank component - /* istanbul ignore else */ - if (vm.$options.renderError) { - try { - vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); - } catch (e) { - handleError(e, vm, "renderError"); - vnode = vm._vnode; - } - } else { - vnode = vm._vnode; + options = options || {}; + options.user = true; + var watcher = new Watcher(vm, expOrFn, cb, options); + if (options.immediate) { + try { + cb.call(vm, watcher.value); + } catch (error) { + handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); } } - // if the returned array contains only a single node, allow it - if (Array.isArray(vnode) && vnode.length === 1) { - vnode = vnode[0]; - } - // return empty vnode in case the render function errored out - if (!(vnode instanceof VNode)) { - if (Array.isArray(vnode)) { - warn( - 'Multiple root nodes returned from render function. Render function ' + - 'should return a single root node.', - vm - ); - } - vnode = createEmptyVNode(); + return function unwatchFn () { + watcher.teardown(); } - // set parent - vnode.parent = _parentVnode; - return vnode }; } @@ -5332,7 +5335,7 @@ value: FunctionalRenderContext }); - Vue.version = '2.6.2'; + Vue.version = '2.6.3'; /* */ @@ -7396,6 +7399,11 @@ } } + // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp + // implementation and does not fire microtasks in between event propagation, so + // safe to exclude. + var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); + function add$1 ( name, handler, @@ -7408,11 +7416,16 @@ // the solution is simple: we save the timestamp when a handler is attached, // and the handler would only fire if the event passed to it was fired // AFTER it was attached. - if (isUsingMicroTask) { + if (useMicrotaskFix) { var attachedTimestamp = currentFlushTimestamp; var original = handler; handler = original._wrapper = function (e) { - if (e.timeStamp >= attachedTimestamp) { + if ( + e.timeStamp >= attachedTimestamp || + // #9448 bail if event is fired in another document in a multi-page + // electron/nw.js app + e.target.ownerDocument !== document + ) { return original.apply(this, arguments) } }; @@ -9424,6 +9437,8 @@ var decodeHTMLCached = cached(he.decode); + var emptySlotScopeToken = "_empty_"; + // configurable state var warn$2; var delimiters; @@ -10036,7 +10051,7 @@ var dynamic = ref.dynamic; el.slotTarget = name; el.slotTargetDynamic = dynamic; - el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf + el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf } } else { // v-slot on component, denotes default slot @@ -10071,8 +10086,13 @@ var slotContainer = slots[name$1] = createASTElement('template', [], el); slotContainer.slotTarget = name$1; slotContainer.slotTargetDynamic = dynamic$1; - slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; }); - slotContainer.slotScope = slotBinding$1.value || "_"; + slotContainer.children = el.children.filter(function (c) { + if (!c.slotScope) { + c.parent = slotContainer; + return true + } + }); + slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken; // remove children as they are returned from scopedSlots now el.children = []; // mark el non-plain so data gets generated @@ -11001,7 +11021,7 @@ } // scoped slots if (el.scopedSlots) { - data += (genScopedSlots(el.scopedSlots, state)) + ","; + data += (genScopedSlots(el, el.scopedSlots, state)) + ","; } // component v-model if (el.model) { @@ -11072,16 +11092,34 @@ } function genScopedSlots ( + el, slots, state ) { - var hasDynamicKeys = Object.keys(slots).some(function (key) { + // by default scoped slots are considered "stable", this allows child + // components with only scoped slots to skip forced updates from parent. + // but in some cases we have to bail-out of this optimization + // for example if the slot contains dynamic names, has v-if or v-for on them... + var needsForceUpdate = Object.keys(slots).some(function (key) { var slot = slots[key]; return slot.slotTargetDynamic || slot.if || slot.for }); + // OR when it is inside another scoped slot (the reactivity is disconnected) + // #9438 + if (!needsForceUpdate) { + var parent = el.parent; + while (parent) { + if (parent.slotScope && parent.slotScope !== emptySlotScopeToken) { + needsForceUpdate = true; + break + } + parent = parent.parent; + } + } + return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return genScopedSlot(slots[key], state) - }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") + }).join(',')) + "]" + (needsForceUpdate ? ",true" : "") + ")") } function genScopedSlot ( @@ -11095,7 +11133,10 @@ if (el.for && !el.forProcessed) { return genFor(el, state, genScopedSlot) } - var fn = "function(" + (String(el.slotScope)) + "){" + + var slotScope = el.slotScope === emptySlotScopeToken + ? "" + : String(el.slotScope); + var fn = "function(" + slotScope + "){" + "return " + (el.tag === 'template' ? el.if && isLegacySyntax ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined") @@ -11188,7 +11229,14 @@ var slotName = el.slotName || '"default"'; var children = genChildren(el, state); var res = "_t(" + slotName + (children ? ("," + children) : ''); - var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}"); + var attrs = el.attrs || el.dynamicAttrs + ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({ + // slot props are camelized + name: camelize(attr.name), + value: attr.value, + dynamic: attr.dynamic + }); })) + : null; var bind$$1 = el.attrsMap['v-bind']; if ((attrs || bind$$1) && !children) { res += ",null"; diff --git a/dist/vue.min.js b/dist/vue.min.js index a2a499e7cff..f89cdad0e30 100644 --- a/dist/vue.min.js +++ b/dist/vue.min.js @@ -1,6 +1,6 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vue=t()}(this,function(){"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function A(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function k(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n0,W=K&&K.indexOf("edge/")>0,Z=(K&&K.indexOf("android"),K&&/iphone|ipad|ipod|ios/.test(K)||"ios"===V),G=(K&&/chrome\/\d+/.test(K),K&&/phantomjs/.test(K),{}.watch),X=!1;if(U)try{var Y={};Object.defineProperty(Y,"passive",{get:function(){X=!0}}),window.addEventListener("test-passive",null,Y)}catch(e){}var Q=function(){return void 0===H&&(H=!U&&!z&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),H},ee=U&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function te(e){return"function"==typeof e&&/native code/.test(e.toString())}var ne,re="undefined"!=typeof Symbol&&te(Symbol)&&"undefined"!=typeof Reflect&&te(Reflect.ownKeys);ne="undefined"!=typeof Set&&te(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ie=S,oe=0,ae=function(){this.id=oe++,this.subs=[]};ae.prototype.addSub=function(e){this.subs.push(e)},ae.prototype.removeSub=function(e){h(this.subs,e)},ae.prototype.depend=function(){ae.target&&ae.target.addDep(this)},ae.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===C(e)){var c=De(String,i.type);(c<0||s0&&(at((u=e(u,(a||"")+"_"+c))[0])&&at(f)&&(s[l]=de(f.text+u[0].text),u.shift()),s.push.apply(s,u)):i(u)?at(f)?s[l]=de(f.text+u):""!==u&&s.push(de(u)):at(u)&&at(f)?s[l]=de(f.text+u.text):(r(o._isVList)&&n(u.tag)&&t(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(e):void 0}function at(e){return n(e)&&n(e.text)&&!1===e.isComment}function st(e,t){return(e.__esModule||re&&"Module"===e[Symbol.toStringTag])&&(e=e.default),o(e)?t.extend(e):e}function ct(e){return e.isComment&&e.asyncFactory}function ut(e){if(Array.isArray(e))for(var t=0;tdocument.createEvent("Event").timeStamp&&(Tt=function(){return performance.now()});var jt=0,Nt=function(e,t,n,r,i){this.vm=e,i&&(e._watcher=this),e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++jt,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new ne,this.newDepIds=new ne,this.expression="","function"==typeof t?this.getter=t:(this.getter=function(e){if(!F.test(e)){var t=e.split(".");return function(e){for(var n=0;nOt&&wt[n].id>e.id;)n--;wt.splice(n+1,0,e)}else wt.push(e);At||(At=!0,Ge(Et))}}(this)},Nt.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||o(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Pe(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},Nt.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Nt.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},Nt.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var Lt={enumerable:!0,configurable:!0,get:S,set:S};function Mt(e,t,n){Lt.get=function(){return this[t][n]},Lt.set=function(e){this[t][n]=e},Object.defineProperty(e,n,Lt)}function It(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[];e.$parent&&_e(!1);var o=function(o){i.push(o);var a=Le(o,t,n,e);we(r,o,a),o in e||Mt(e,"_props",o)};for(var a in t)o(a);_e(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?S:x(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;s(t=e._data="function"==typeof t?function(e,t){ce();try{return e.call(t,t)}catch(e){return Pe(e,t,"data()"),{}}finally{ue()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,i=(e.$options.methods,n.length);for(;i--;){var o=n[i];r&&y(r,o)||(a=void 0,36!==(a=(o+"").charCodeAt(0))&&95!==a&&Mt(e,"_data",o))}var a;$e(t,!0)}(e):$e(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=Q();for(var i in t){var o=t[i],a="function"==typeof o?o:o.get;r||(n[i]=new Nt(e,a||S,S,Dt)),i in e||Pt(e,i,o)}}(e,t.computed),t.watch&&t.watch!==G&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function wn(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=bn(a.componentOptions);s&&!t(s)&&Cn(n,o,r,i)}}}function Cn(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=mn++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=je(yn(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(n),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&dt(e,t)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,i=r&&r.context;t.$slots=vt(n._renderChildren,i),t.$scopedSlots=e,t._c=function(e,n,r,i){return hn(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return hn(t,e,n,r,i,!0)};var o=r&&r.data;we(t,"$attrs",o&&o.attrs||e,null,!0),we(t,"$listeners",n._parentListeners||e,null,!0)}(n),$t(n,"beforeCreate"),function(e){var t=Bt(e.$options.inject,e);t&&(_e(!1),Object.keys(t).forEach(function(n){we(e,n,t[n])}),_e(!0))}(n),It(n),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(n),$t(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(gn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=Ce,e.prototype.$delete=xe,e.prototype.$watch=function(e,t,n){if(s(t))return Ht(this,e,t,n);(n=n||{}).user=!0;var r=new Nt(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Pe(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(gn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var i=0,o=e.length;i1?A(t):t;for(var n=A(arguments,1),r='event handler for "'+e+'"',i=0,o=t.length;iparseInt(this.max)&&Cn(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return P}};Object.defineProperty(e,"config",t),e.util={warn:ie,extend:k,mergeOptions:je,defineReactive:we},e.set=Ce,e.delete=xe,e.nextTick=Ge,e.observable=function(e){return $e(e),e},e.options=Object.create(null),I.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,k(e.options.components,An),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=A(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=je(this.options,e),this}}(e),_n(e),function(e){I.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&s(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(gn),Object.defineProperty(gn.prototype,"$isServer",{get:Q}),Object.defineProperty(gn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(gn,"FunctionalRenderContext",{value:an}),gn.version="2.6.2";var kn=p("style,class"),On=p("input,textarea,option,select,progress"),Sn=function(e,t,n){return"value"===n&&On(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Tn=p("contenteditable,draggable,spellcheck"),En=p("events,caret,typing,plaintext-only"),jn=function(e,t){return Dn(t)||"false"===t?"false":"contenteditable"===e&&En(t)?t:"true"},Nn=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Ln="http://www.w3.org/1999/xlink",Mn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},In=function(e){return Mn(e)?e.slice(6,e.length):""},Dn=function(e){return null==e||!1===e};function Pn(e){for(var t=e.data,r=e,i=e;n(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(t=Rn(i.data,t));for(;n(r=r.parent);)r&&r.data&&(t=Rn(t,r.data));return function(e,t){if(n(e)||n(t))return Fn(e,Hn(t));return""}(t.staticClass,t.class)}function Rn(e,t){return{staticClass:Fn(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function Fn(e,t){return e?t?e+" "+t:e:t||""}function Hn(e){return Array.isArray(e)?function(e){for(var t,r="",i=0,o=e.length;i-1?fr(e,t,n):Nn(t)?Dn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Tn(t)?e.setAttribute(t,jn(t,n)):Mn(t)?Dn(n)?e.removeAttributeNS(Ln,In(t)):e.setAttributeNS(Ln,t,n):fr(e,t,n)}function fr(e,t,n){if(Dn(n))e.removeAttribute(t);else{if(J&&!q&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var pr={create:ur,update:ur};function dr(e,r){var i=r.elm,o=r.data,a=e.data;if(!(t(o.staticClass)&&t(o.class)&&(t(a)||t(a.staticClass)&&t(a.class)))){var s=Pn(r),c=i._transitionClasses;n(c)&&(s=Fn(s,Hn(c))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var vr,hr,mr,yr,gr,_r,br={create:dr,update:dr},$r=/[\w).+\-_$\]]/;function wr(e){var t,n,r,i,o,a=!1,s=!1,c=!1,u=!1,l=0,f=0,p=0,d=0;for(r=0;r=0&&" "===(h=e.charAt(v));v--);h&&$r.test(h)||(u=!0)}}else void 0===i?(d=r+1,i=e.slice(0,r).trim()):m();function m(){(o||(o=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===i?i=e.slice(0,r).trim():0!==d&&m(),o)for(r=0;r-1?{exp:e.slice(0,yr),key:'"'+e.slice(yr+1)+'"'}:{exp:e,key:null};hr=e,yr=gr=_r=0;for(;!Fr();)Hr(mr=Rr())?Ur(mr):91===mr&&Br(mr);return{exp:e.slice(0,gr),key:e.slice(gr+1,_r)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Rr(){return hr.charCodeAt(++yr)}function Fr(){return yr>=vr}function Hr(e){return 34===e||39===e}function Br(e){var t=1;for(gr=yr;!Fr();)if(Hr(e=Rr()))Ur(e);else if(91===e&&t++,93===e&&t--,0===t){_r=yr;break}}function Ur(e){for(var t=e;!Fr()&&(e=Rr())!==t;);}var zr,Vr="__r",Kr="__c";function Jr(e,t,n){var r=zr;return function i(){null!==t.apply(null,arguments)&&Wr(e,i,n,r)}}function qr(e,t,n,r){if(Ue){var i=St,o=t;t=o._wrapper=function(e){if(e.timeStamp>=i)return o.apply(this,arguments)}}zr.addEventListener(e,t,X?{capture:n,passive:r}:n)}function Wr(e,t,n,r){(r||zr).removeEventListener(e,t._wrapper||t,n)}function Zr(e,r){if(!t(e.data.on)||!t(r.data.on)){var i=r.data.on||{},o=e.data.on||{};zr=r.elm,function(e){if(n(e[Vr])){var t=J?"change":"input";e[t]=[].concat(e[Vr],e[t]||[]),delete e[Vr]}n(e[Kr])&&(e.change=[].concat(e[Kr],e.change||[]),delete e[Kr])}(i),nt(i,o,qr,Wr,Jr,r.context),zr=void 0}}var Gr,Xr={create:Zr,update:Zr};function Yr(e,r){if(!t(e.data.domProps)||!t(r.data.domProps)){var i,o,a=r.elm,s=e.data.domProps||{},c=r.data.domProps||{};for(i in n(c.__ob__)&&(c=r.data.domProps=k({},c)),s)t(c[i])&&(a[i]="");for(i in c){if(o=c[i],"textContent"===i||"innerHTML"===i){if(r.children&&(r.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i||o!==s[i])if("value"===i){a._value=o;var u=t(o)?"":String(o);Qr(a,u)&&(a.value=u)}else if("innerHTML"===i&&zn(a.tagName)&&t(a.innerHTML)){(Gr=Gr||document.createElement("div")).innerHTML=""+o+"";for(var l=Gr.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else a[i]=o}}}function Qr(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var r=e.value,i=e._vModifiers;if(n(i)){if(i.number)return f(r)!==f(t);if(i.trim)return r.trim()!==t.trim()}return r!==t}(e,t))}var ei={create:Yr,update:Yr},ti=g(function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach(function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t});function ni(e){var t=ri(e.style);return e.staticStyle?k(e.staticStyle,t):t}function ri(e){return Array.isArray(e)?O(e):"string"==typeof e?ti(e):e}var ii,oi=/^--/,ai=/\s*!important$/,si=function(e,t,n){if(oi.test(t))e.style.setProperty(t,n);else if(ai.test(n))e.style.setProperty(C(t),n.replace(ai,""),"important");else{var r=ui(t);if(Array.isArray(n))for(var i=0,o=n.length;i-1?t.split(pi).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function vi(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(pi).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function hi(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&k(t,mi(e.name||"v")),k(t,e),t}return"string"==typeof e?mi(e):void 0}}var mi=g(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),yi=U&&!q,gi="transition",_i="animation",bi="transition",$i="transitionend",wi="animation",Ci="animationend";yi&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(bi="WebkitTransition",$i="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(wi="WebkitAnimation",Ci="webkitAnimationEnd"));var xi=U?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Ai(e){xi(function(){xi(e)})}function ki(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),di(e,t))}function Oi(e,t){e._transitionClasses&&h(e._transitionClasses,t),vi(e,t)}function Si(e,t,n){var r=Ei(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===gi?$i:Ci,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=gi,l=a,f=o.length):t===_i?u>0&&(n=_i,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?gi:_i:null)?n===gi?o.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===gi&&Ti.test(r[bi+"Property"])}}function ji(e,t){for(;e.length1}function Pi(e,t){!0!==t.data.show&&Li(t)}var Ri=function(e){var o,a,s={},c=e.modules,u=e.nodeOps;for(o=0;ov?_(e,t(i[y+1])?null:i[y+1].elm,i,d,y,o):d>y&&$(0,r,p,v)}(p,h,y,o,l):n(y)?(n(e.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,o)):n(h)?$(0,h,0,h.length-1):n(e.text)&&u.setTextContent(p,""):e.text!==i.text&&u.setTextContent(p,i.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(e,i)}}}function A(e,t,i){if(r(i)&&n(e.parent))e.parent.data.pendingInsert=t;else for(var o=0;o-1,a.selected!==o&&(a.selected=o);else if(j(zi(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function Ui(e,t){return t.every(function(t){return!j(t,e)})}function zi(e){return"_value"in e?e._value:e.value}function Vi(e){e.target.composing=!0}function Ki(e){e.target.composing&&(e.target.composing=!1,Ji(e.target,"input"))}function Ji(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function qi(e){return!e.componentInstance||e.data&&e.data.transition?e:qi(e.componentInstance._vnode)}var Wi={model:Fi,show:{bind:function(e,t,n){var r=t.value,i=(n=qi(n)).data&&n.data.transition,o=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&i?(n.data.show=!0,Li(n,function(){e.style.display=o})):e.style.display=r?o:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=qi(n)).data&&n.data.transition?(n.data.show=!0,r?Li(n,function(){e.style.display=e.__vOriginalDisplay}):Mi(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,i){i||(e.style.display=e.__vOriginalDisplay)}}},Zi={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Gi(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?Gi(ut(t.children)):e}function Xi(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var i=n._parentListeners;for(var o in i)t[b(o)]=i[o];return t}function Yi(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var Qi=function(e){return e.tag||ct(e)},eo=function(e){return"show"===e.name},to={name:"transition",props:Zi,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(Qi)).length){var r=this.mode,o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var a=Gi(o);if(!a)return o;if(this._leaving)return Yi(e,o);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:i(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=Xi(this),u=this._vnode,l=Gi(u);if(a.data.directives&&a.data.directives.some(eo)&&(a.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(a,l)&&!ct(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=k({},c);if("out-in"===r)return this._leaving=!0,rt(f,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),Yi(e,o);if("in-out"===r){if(ct(a))return u;var p,d=function(){p()};rt(c,"afterEnter",d),rt(c,"enterCancelled",d),rt(f,"delayLeave",function(e){p=e})}}return o}}},no=k({tag:String,moveClass:String},Zi);function ro(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function io(e){e.data.newPos=e.elm.getBoundingClientRect()}function oo(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,i=t.top-n.top;if(r||i){e.data.moved=!0;var o=e.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}delete no.mode;var ao={Transition:to,TransitionGroup:{props:no,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var i=gt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,i(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],a=Xi(this),s=0;s-1?Jn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Jn[e]=/HTMLUnknownElement/.test(t.toString())},k(gn.options.directives,Wi),k(gn.options.components,ao),gn.prototype.__patch__=U?Ri:S,gn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=pe),$t(e,"beforeMount"),r=function(){e._update(e._render(),n)},new Nt(e,r,S,{before:function(){e._isMounted&&!e._isDestroyed&&$t(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,$t(e,"mounted")),e}(this,e=e&&U?Wn(e):void 0,t)},U&&setTimeout(function(){P.devtools&&ee&&ee.emit("init",gn)},0);var so=/\{\{((?:.|\r?\n)+?)\}\}/g,co=/[-.*+?^${}()|[\]\/\\]/g,uo=g(function(e){var t=e[0].replace(co,"\\$&"),n=e[1].replace(co,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")});var lo={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Lr(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Nr(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var fo,po={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Lr(e,"style");n&&(e.staticStyle=JSON.stringify(ti(n)));var r=Nr(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},vo=function(e){return(fo=fo||document.createElement("div")).innerHTML=e,fo.textContent},ho=p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),mo=p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),yo=p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),go=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,_o=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,bo="[a-zA-Z_][\\-\\.0-9_a-zA-Za-zA-Z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*",$o="((?:"+bo+"\\:)?"+bo+")",wo=new RegExp("^<"+$o),Co=/^\s*(\/?)>/,xo=new RegExp("^<\\/"+$o+"[^>]*>"),Ao=/^]+>/i,ko=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},jo=/&(?:lt|gt|quot|amp|#39);/g,No=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Lo=p("pre,textarea",!0),Mo=function(e,t){return e&&Lo(e)&&"\n"===t[0]};function Io(e,t){var n=t?No:jo;return e.replace(n,function(e){return Eo[e]})}var Do,Po,Ro,Fo,Ho,Bo,Uo,zo,Vo=/^@|^v-on:/,Ko=/^v-|^@|^:/,Jo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,qo=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Wo=/^\(|\)$/g,Zo=/^\[.*\]$/,Go=/:(.*)$/,Xo=/^:|^\.|^v-bind:/,Yo=/\.[^.]+/g,Qo=/^v-slot(:|$)|^#/,ea=/[\r\n]/,ta=/\s+/g,na=g(vo);function ra(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:la(t),rawAttrsMap:{},parent:n,children:[]}}function ia(e,t){Do=t.warn||xr,Bo=t.isPreTag||T,Uo=t.mustUseProp||T,zo=t.getTagNamespace||T;t.isReservedTag;Ro=Ar(t.modules,"transformNode"),Fo=Ar(t.modules,"preTransformNode"),Ho=Ar(t.modules,"postTransformNode"),Po=t.delimiters;var n,r,i=[],o=!1!==t.preserveWhitespace,a=t.whitespace,s=!1,c=!1;function u(e){if(l(e),s||e.processed||(e=oa(e,t)),i.length||e===n||n.if&&(e.elseif||e.else)&&sa(n,{exp:e.elseif,block:e}),r&&!e.forbidden)if(e.elseif||e.else)a=e,(u=function(e){var t=e.length;for(;t--;){if(1===e[t].type)return e[t];e.pop()}}(r.children))&&u.if&&sa(u,{exp:a.elseif,block:a});else{if(e.slotScope){var o=e.slotTarget||'"default"';(r.scopedSlots||(r.scopedSlots={}))[o]=e}r.children.push(e),e.parent=r}var a,u;e.children=e.children.filter(function(e){return!e.slotScope}),l(e),e.pre&&(s=!1),Bo(e.tag)&&(c=!1);for(var f=0;f]*>)","i")),p=e.replace(f,function(e,n,r){return u=r.length,So(l)||"noscript"===l||(n=n.replace(//g,"$1").replace(//g,"$1")),Mo(l,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""});c+=e.length-p.length,e=p,k(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(ko.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),C(v+3);continue}}if(Oo.test(e)){var h=e.indexOf("]>");if(h>=0){C(h+2);continue}}var m=e.match(Ao);if(m){C(m[0].length);continue}var y=e.match(xo);if(y){var g=c;C(y[0].length),k(y[1],g,c);continue}var _=x();if(_){A(_),Mo(_.tagName,e)&&C(1);continue}}var b=void 0,$=void 0,w=void 0;if(d>=0){for($=e.slice(d);!(xo.test($)||wo.test($)||ko.test($)||Oo.test($)||(w=$.indexOf("<",1))<0);)d+=w,$=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&C(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function C(t){c+=t,e=e.substring(t)}function x(){var t=e.match(wo);if(t){var n,r,i={tagName:t[1],attrs:[],start:c};for(C(t[0].length);!(n=e.match(Co))&&(r=e.match(_o)||e.match(go));)r.start=c,C(r[0].length),r.end=c,i.attrs.push(r);if(n)return i.unarySlash=n[1],C(n[0].length),i.end=c,i}}function A(e){var n=e.tagName,c=e.unarySlash;o&&("p"===r&&yo(n)&&k(r),s(n)&&r===n&&k(n));for(var u=a(n)||!!c,l=e.attrs.length,f=new Array(l),p=0;p=0&&i[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=i.length-1;u>=a;u--)t.end&&t.end(i[u].tag,n,o);i.length=a,r=a&&i[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,o):"p"===s&&(t.start&&t.start(e,[],!1,n,o),t.end&&t.end(e,n,o))}k()}(e,{warn:Do,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,l){var f=r&&r.ns||zo(e);J&&"svg"===f&&(o=function(e){for(var t=[],n=0;nc&&(s.push(o=e.slice(c,i)),a.push(JSON.stringify(o)));var u=wr(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+r[0].length}return c-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),jr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Pr(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Pr(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Pr(t,"$$c")+"}",null,!0)}(e,r,i);else if("input"===o&&"radio"===a)!function(e,t,n){var r=n&&n.number,i=Nr(e,"value")||"null";kr(e,"checked","_q("+t+","+(i=r?"_n("+i+")":i)+")"),jr(e,"change",Pr(t,i),null,!0)}(e,r,i);else if("input"===o||"textarea"===o)!function(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?Vr:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=Pr(t,l);c&&(f="if($event.target.composing)return;"+f),kr(e,"value","("+t+")"),jr(e,u,f,null,!0),(s||a)&&jr(e,"blur","$forceUpdate()")}(e,r,i);else if(!P.isReservedTag(o))return Dr(e,r,i),!1;return!0},text:function(e,t){t.value&&kr(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&kr(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:ho,mustUseProp:Sn,canBeLeftOpenTag:mo,isReservedTag:Vn,getTagNamespace:Kn,staticKeys:function(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}(va)},ga=g(function(e){return p("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))});function _a(e,t){e&&(ha=ga(t.staticKeys||""),ma=t.isReservedTag||T,function e(t){t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||d(e.tag)||!ma(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(ha)))}(t);if(1===t.type){if(!ma(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n|^function\s*\(/,$a=/\([^)]*?\);*$/,wa=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Ca={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},xa={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Aa=function(e){return"if("+e+")return null;"},ka={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Aa("$event.target !== $event.currentTarget"),ctrl:Aa("!$event.ctrlKey"),shift:Aa("!$event.shiftKey"),alt:Aa("!$event.altKey"),meta:Aa("!$event.metaKey"),left:Aa("'button' in $event && $event.button !== 0"),middle:Aa("'button' in $event && $event.button !== 1"),right:Aa("'button' in $event && $event.button !== 2")};function Oa(e,t){var n=t?"nativeOn:":"on:",r="",i="";for(var o in e){var a=Sa(e[o]);e[o]&&e[o].dynamic?i+=o+","+a+",":r+='"'+o+'":'+a+","}return r="{"+r.slice(0,-1)+"}",i?n+"_d("+r+",["+i.slice(0,-1)+"])":n+r}function Sa(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map(function(e){return Sa(e)}).join(",")+"]";var t=wa.test(e.value),n=ba.test(e.value),r=wa.test(e.value.replace($a,""));if(e.modifiers){var i="",o="",a=[];for(var s in e.modifiers)if(ka[s])o+=ka[s],Ca[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;o+=Aa(["ctrl","shift","alt","meta"].filter(function(e){return!c[e]}).map(function(e){return"$event."+e+"Key"}).join("||"))}else a.push(s);return a.length&&(i+=function(e){return"if(('keyCode' in $event)&&"+e.map(Ta).join("&&")+")return null;"}(a)),o&&(i+=o),"function($event){"+i+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function Ta(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Ca[e],r=xa[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Ea={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:S},ja=function(e){this.options=e,this.warn=e.warn||xr,this.transforms=Ar(e.modules,"transformCode"),this.dataGenFns=Ar(e.modules,"genData"),this.directives=k(k({},Ea),e.directives);var t=e.isReservedTag||T;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Na(e,t){var n=new ja(t);return{render:"with(this){return "+(e?La(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function La(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Ma(e,t);if(e.once&&!e.onceProcessed)return Ia(e,t);if(e.for&&!e.forProcessed)return Pa(e,t);if(e.if&&!e.ifProcessed)return Da(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=Ha(e,t),i="_t("+n+(r?","+r:""),o=e.attrs&&"{"+e.attrs.map(function(e){return b(e.name)+":"+e.value}).join(",")+"}",a=e.attrsMap["v-bind"];!o&&!a||r||(i+=",null");o&&(i+=","+o);a&&(i+=(o?"":",null")+","+a);return i+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:Ha(t,n,!0);return"_c("+e+","+Ra(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Ra(e,t));var i=e.inlineTemplate?null:Ha(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(i?","+i:"")+")"}for(var o=0;o':'
',Wa.innerHTML.indexOf(" ")>0}var Ya=!!U&&Xa(!1),Qa=!!U&&Xa(!0),es=g(function(e){var t=Wn(e);return t&&t.innerHTML}),ts=gn.prototype.$mount;return gn.prototype.$mount=function(e,t){if((e=e&&Wn(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=es(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){var i=Ga(r,{outputSourceRange:!1,shouldDecodeNewlines:Ya,shouldDecodeNewlinesForHref:Qa,delimiters:n.delimiters,comments:n.comments},this),o=i.render,a=i.staticRenderFns;n.render=o,n.staticRenderFns=a}}return ts.call(this,e,t)},gn.compile=Ga,gn}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vue=t()}(this,function(){"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function A(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function k(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n0,W=K&&K.indexOf("edge/")>0,Z=(K&&K.indexOf("android"),K&&/iphone|ipad|ipod|ios/.test(K)||"ios"===V),G=(K&&/chrome\/\d+/.test(K),K&&/phantomjs/.test(K),K&&K.match(/firefox\/(\d+)/)),X={}.watch,Y=!1;if(U)try{var Q={};Object.defineProperty(Q,"passive",{get:function(){Y=!0}}),window.addEventListener("test-passive",null,Q)}catch(e){}var ee=function(){return void 0===H&&(H=!U&&!z&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),H},te=U&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ne(e){return"function"==typeof e&&/native code/.test(e.toString())}var re,ie="undefined"!=typeof Symbol&&ne(Symbol)&&"undefined"!=typeof Reflect&&ne(Reflect.ownKeys);re="undefined"!=typeof Set&&ne(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var oe=S,ae=0,se=function(){this.id=ae++,this.subs=[]};se.prototype.addSub=function(e){this.subs.push(e)},se.prototype.removeSub=function(e){h(this.subs,e)},se.prototype.depend=function(){se.target&&se.target.addDep(this)},se.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===C(e)){var c=Pe(String,i.type);(c<0||s0&&(at((u=e(u,(a||"")+"_"+c))[0])&&at(f)&&(s[l]=ve(f.text+u[0].text),u.shift()),s.push.apply(s,u)):i(u)?at(f)?s[l]=ve(f.text+u):""!==u&&s.push(ve(u)):at(u)&&at(f)?s[l]=ve(f.text+u.text):(r(o._isVList)&&n(u.tag)&&t(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(e):void 0}function at(e){return n(e)&&n(e.text)&&!1===e.isComment}function st(e,t){if(e){for(var n=Object.create(null),r=ie?Reflect.ownKeys(e):Object.keys(e),i=0;idocument.createEvent("Event").timeStamp&&(an=function(){return performance.now()});var cn=0,un=function(e,t,n,r,i){this.vm=e,i&&(e._watcher=this),e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++cn,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new re,this.newDepIds=new re,this.expression="","function"==typeof t?this.getter=t:(this.getter=function(e){if(!F.test(e)){var t=e.split(".");return function(e){for(var n=0;nrn&&Yt[n].id>e.id;)n--;Yt.splice(n+1,0,e)}else Yt.push(e);tn||(tn=!0,Xe(sn))}}(this)},un.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||o(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Re(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},un.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},un.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},un.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var ln={enumerable:!0,configurable:!0,get:S,set:S};function fn(e,t,n){ln.get=function(){return this[t][n]},ln.set=function(e){this[t][n]=e},Object.defineProperty(e,n,ln)}function pn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[];e.$parent&&be(!1);var o=function(o){i.push(o);var a=Me(o,t,n,e);Ce(r,o,a),o in e||fn(e,"_props",o)};for(var a in t)o(a);be(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?S:x(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;s(t=e._data="function"==typeof t?function(e,t){ue();try{return e.call(t,t)}catch(e){return Re(e,t,"data()"),{}}finally{le()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,i=(e.$options.methods,n.length);for(;i--;){var o=n[i];r&&y(r,o)||(a=void 0,36!==(a=(o+"").charCodeAt(0))&&95!==a&&fn(e,"_data",o))}var a;we(t,!0)}(e):we(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=ee();for(var i in t){var o=t[i],a="function"==typeof o?o:o.get;r||(n[i]=new un(e,a||S,S,dn)),i in e||vn(e,i,o)}}(e,t.computed),t.watch&&t.watch!==X&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function xn(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=wn(a.componentOptions);s&&!t(s)&&An(n,o,r,i)}}}function An(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=gn++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=je(_n(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(n),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Jt(e,t)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,i=r&&r.context;t.$slots=ct(n._renderChildren,i),t.$scopedSlots=e,t._c=function(e,n,r,i){return Pt(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return Pt(t,e,n,r,i,!0)};var o=r&&r.data;Ce(t,"$attrs",o&&o.attrs||e,null,!0),Ce(t,"$listeners",n._parentListeners||e,null,!0)}(n),Xt(n,"beforeCreate"),function(e){var t=st(e.$options.inject,e);t&&(be(!1),Object.keys(t).forEach(function(n){Ce(e,n,t[n])}),be(!0))}(n),pn(n),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(n),Xt(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(bn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=xe,e.prototype.$delete=Ae,e.prototype.$watch=function(e,t,n){if(s(t))return yn(this,e,t,n);(n=n||{}).user=!0;var r=new un(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Re(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(bn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var i=0,o=e.length;i1?A(t):t;for(var n=A(arguments,1),r='event handler for "'+e+'"',i=0,o=t.length;iparseInt(this.max)&&An(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return P}};Object.defineProperty(e,"config",t),e.util={warn:oe,extend:k,mergeOptions:je,defineReactive:Ce},e.set=xe,e.delete=Ae,e.nextTick=Xe,e.observable=function(e){return we(e),e},e.options=Object.create(null),I.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,k(e.options.components,On),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=A(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=je(this.options,e),this}}(e),$n(e),function(e){I.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&s(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(bn),Object.defineProperty(bn.prototype,"$isServer",{get:ee}),Object.defineProperty(bn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(bn,"FunctionalRenderContext",{value:St}),bn.version="2.6.3";var Sn=p("style,class"),Tn=p("input,textarea,option,select,progress"),En=function(e,t,n){return"value"===n&&Tn(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Nn=p("contenteditable,draggable,spellcheck"),jn=p("events,caret,typing,plaintext-only"),Ln=function(e,t){return Rn(t)||"false"===t?"false":"contenteditable"===e&&jn(t)?t:"true"},Mn=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),In="http://www.w3.org/1999/xlink",Dn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Pn=function(e){return Dn(e)?e.slice(6,e.length):""},Rn=function(e){return null==e||!1===e};function Fn(e){for(var t=e.data,r=e,i=e;n(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(t=Hn(i.data,t));for(;n(r=r.parent);)r&&r.data&&(t=Hn(t,r.data));return function(e,t){if(n(e)||n(t))return Bn(e,Un(t));return""}(t.staticClass,t.class)}function Hn(e,t){return{staticClass:Bn(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function Bn(e,t){return e?t?e+" "+t:e:t||""}function Un(e){return Array.isArray(e)?function(e){for(var t,r="",i=0,o=e.length;i-1?dr(e,t,n):Mn(t)?Rn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Nn(t)?e.setAttribute(t,Ln(t,n)):Dn(t)?Rn(n)?e.removeAttributeNS(In,Pn(t)):e.setAttributeNS(In,t,n):dr(e,t,n)}function dr(e,t,n){if(Rn(n))e.removeAttribute(t);else{if(J&&!q&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var vr={create:fr,update:fr};function hr(e,r){var i=r.elm,o=r.data,a=e.data;if(!(t(o.staticClass)&&t(o.class)&&(t(a)||t(a.staticClass)&&t(a.class)))){var s=Fn(r),c=i._transitionClasses;n(c)&&(s=Bn(s,Un(c))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var mr,yr,gr,_r,br,$r,wr={create:hr,update:hr},Cr=/[\w).+\-_$\]]/;function xr(e){var t,n,r,i,o,a=!1,s=!1,c=!1,u=!1,l=0,f=0,p=0,d=0;for(r=0;r=0&&" "===(h=e.charAt(v));v--);h&&Cr.test(h)||(u=!0)}}else void 0===i?(d=r+1,i=e.slice(0,r).trim()):m();function m(){(o||(o=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===i?i=e.slice(0,r).trim():0!==d&&m(),o)for(r=0;r-1?{exp:e.slice(0,_r),key:'"'+e.slice(_r+1)+'"'}:{exp:e,key:null};yr=e,_r=br=$r=0;for(;!Br();)Ur(gr=Hr())?Vr(gr):91===gr&&zr(gr);return{exp:e.slice(0,br),key:e.slice(br+1,$r)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Hr(){return yr.charCodeAt(++_r)}function Br(){return _r>=mr}function Ur(e){return 34===e||39===e}function zr(e){var t=1;for(br=_r;!Br();)if(Ur(e=Hr()))Vr(e);else if(91===e&&t++,93===e&&t--,0===t){$r=_r;break}}function Vr(e){for(var t=e;!Br()&&(e=Hr())!==t;);}var Kr,Jr="__r",qr="__c";function Wr(e,t,n){var r=Kr;return function i(){null!==t.apply(null,arguments)&&Xr(e,i,n,r)}}var Zr=ze&&!(G&&Number(G[1])<=53);function Gr(e,t,n,r){if(Zr){var i=on,o=t;t=o._wrapper=function(e){if(e.timeStamp>=i||e.target.ownerDocument!==document)return o.apply(this,arguments)}}Kr.addEventListener(e,t,Y?{capture:n,passive:r}:n)}function Xr(e,t,n,r){(r||Kr).removeEventListener(e,t._wrapper||t,n)}function Yr(e,r){if(!t(e.data.on)||!t(r.data.on)){var i=r.data.on||{},o=e.data.on||{};Kr=r.elm,function(e){if(n(e[Jr])){var t=J?"change":"input";e[t]=[].concat(e[Jr],e[t]||[]),delete e[Jr]}n(e[qr])&&(e.change=[].concat(e[qr],e.change||[]),delete e[qr])}(i),nt(i,o,Gr,Xr,Wr,r.context),Kr=void 0}}var Qr,ei={create:Yr,update:Yr};function ti(e,r){if(!t(e.data.domProps)||!t(r.data.domProps)){var i,o,a=r.elm,s=e.data.domProps||{},c=r.data.domProps||{};for(i in n(c.__ob__)&&(c=r.data.domProps=k({},c)),s)t(c[i])&&(a[i]="");for(i in c){if(o=c[i],"textContent"===i||"innerHTML"===i){if(r.children&&(r.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i||o!==s[i])if("value"===i){a._value=o;var u=t(o)?"":String(o);ni(a,u)&&(a.value=u)}else if("innerHTML"===i&&Kn(a.tagName)&&t(a.innerHTML)){(Qr=Qr||document.createElement("div")).innerHTML=""+o+"";for(var l=Qr.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else a[i]=o}}}function ni(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var r=e.value,i=e._vModifiers;if(n(i)){if(i.number)return f(r)!==f(t);if(i.trim)return r.trim()!==t.trim()}return r!==t}(e,t))}var ri={create:ti,update:ti},ii=g(function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach(function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t});function oi(e){var t=ai(e.style);return e.staticStyle?k(e.staticStyle,t):t}function ai(e){return Array.isArray(e)?O(e):"string"==typeof e?ii(e):e}var si,ci=/^--/,ui=/\s*!important$/,li=function(e,t,n){if(ci.test(t))e.style.setProperty(t,n);else if(ui.test(n))e.style.setProperty(C(t),n.replace(ui,""),"important");else{var r=pi(t);if(Array.isArray(n))for(var i=0,o=n.length;i-1?t.split(hi).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function yi(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(hi).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function gi(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&k(t,_i(e.name||"v")),k(t,e),t}return"string"==typeof e?_i(e):void 0}}var _i=g(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),bi=U&&!q,$i="transition",wi="animation",Ci="transition",xi="transitionend",Ai="animation",ki="animationend";bi&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Ci="WebkitTransition",xi="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Ai="WebkitAnimation",ki="webkitAnimationEnd"));var Oi=U?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Si(e){Oi(function(){Oi(e)})}function Ti(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),mi(e,t))}function Ei(e,t){e._transitionClasses&&h(e._transitionClasses,t),yi(e,t)}function Ni(e,t,n){var r=Li(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===$i?xi:ki,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=$i,l=a,f=o.length):t===wi?u>0&&(n=wi,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?$i:wi:null)?n===$i?o.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===$i&&ji.test(r[Ci+"Property"])}}function Mi(e,t){for(;e.length1}function Hi(e,t){!0!==t.data.show&&Di(t)}var Bi=function(e){var o,a,s={},c=e.modules,u=e.nodeOps;for(o=0;ov?_(e,t(i[y+1])?null:i[y+1].elm,i,d,y,o):d>y&&$(0,r,p,v)}(p,h,y,o,l):n(y)?(n(e.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,o)):n(h)?$(0,h,0,h.length-1):n(e.text)&&u.setTextContent(p,""):e.text!==i.text&&u.setTextContent(p,i.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(e,i)}}}function A(e,t,i){if(r(i)&&n(e.parent))e.parent.data.pendingInsert=t;else for(var o=0;o-1,a.selected!==o&&(a.selected=o);else if(N(Ji(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function Ki(e,t){return t.every(function(t){return!N(t,e)})}function Ji(e){return"_value"in e?e._value:e.value}function qi(e){e.target.composing=!0}function Wi(e){e.target.composing&&(e.target.composing=!1,Zi(e.target,"input"))}function Zi(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Gi(e){return!e.componentInstance||e.data&&e.data.transition?e:Gi(e.componentInstance._vnode)}var Xi={model:Ui,show:{bind:function(e,t,n){var r=t.value,i=(n=Gi(n)).data&&n.data.transition,o=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&i?(n.data.show=!0,Di(n,function(){e.style.display=o})):e.style.display=r?o:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Gi(n)).data&&n.data.transition?(n.data.show=!0,r?Di(n,function(){e.style.display=e.__vOriginalDisplay}):Pi(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,i){i||(e.style.display=e.__vOriginalDisplay)}}},Yi={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Qi(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?Qi(Ut(t.children)):e}function eo(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var i=n._parentListeners;for(var o in i)t[b(o)]=i[o];return t}function to(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var no=function(e){return e.tag||Bt(e)},ro=function(e){return"show"===e.name},io={name:"transition",props:Yi,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(no)).length){var r=this.mode,o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var a=Qi(o);if(!a)return o;if(this._leaving)return to(e,o);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:i(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=eo(this),u=this._vnode,l=Qi(u);if(a.data.directives&&a.data.directives.some(ro)&&(a.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(a,l)&&!Bt(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=k({},c);if("out-in"===r)return this._leaving=!0,rt(f,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),to(e,o);if("in-out"===r){if(Bt(a))return u;var p,d=function(){p()};rt(c,"afterEnter",d),rt(c,"enterCancelled",d),rt(f,"delayLeave",function(e){p=e})}}return o}}},oo=k({tag:String,moveClass:String},Yi);function ao(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function so(e){e.data.newPos=e.elm.getBoundingClientRect()}function co(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,i=t.top-n.top;if(r||i){e.data.moved=!0;var o=e.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}delete oo.mode;var uo={Transition:io,TransitionGroup:{props:oo,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var i=Wt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,i(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],a=eo(this),s=0;s-1?Wn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Wn[e]=/HTMLUnknownElement/.test(t.toString())},k(bn.options.directives,Xi),k(bn.options.components,uo),bn.prototype.__patch__=U?Bi:S,bn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=de),Xt(e,"beforeMount"),r=function(){e._update(e._render(),n)},new un(e,r,S,{before:function(){e._isMounted&&!e._isDestroyed&&Xt(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,Xt(e,"mounted")),e}(this,e=e&&U?Gn(e):void 0,t)},U&&setTimeout(function(){P.devtools&&te&&te.emit("init",bn)},0);var lo=/\{\{((?:.|\r?\n)+?)\}\}/g,fo=/[-.*+?^${}()|[\]\/\\]/g,po=g(function(e){var t=e[0].replace(fo,"\\$&"),n=e[1].replace(fo,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")});var vo={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Ir(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Mr(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var ho,mo={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Ir(e,"style");n&&(e.staticStyle=JSON.stringify(ii(n)));var r=Mr(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},yo=function(e){return(ho=ho||document.createElement("div")).innerHTML=e,ho.textContent},go=p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),_o=p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),bo=p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),$o=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,wo=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Co="[a-zA-Z_][\\-\\.0-9_a-zA-Za-zA-Z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*",xo="((?:"+Co+"\\:)?"+Co+")",Ao=new RegExp("^<"+xo),ko=/^\s*(\/?)>/,Oo=new RegExp("^<\\/"+xo+"[^>]*>"),So=/^]+>/i,To=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Mo=/&(?:lt|gt|quot|amp|#39);/g,Io=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Do=p("pre,textarea",!0),Po=function(e,t){return e&&Do(e)&&"\n"===t[0]};function Ro(e,t){var n=t?Io:Mo;return e.replace(n,function(e){return Lo[e]})}var Fo,Ho,Bo,Uo,zo,Vo,Ko,Jo,qo=/^@|^v-on:/,Wo=/^v-|^@|^:/,Zo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Go=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Xo=/^\(|\)$/g,Yo=/^\[.*\]$/,Qo=/:(.*)$/,ea=/^:|^\.|^v-bind:/,ta=/\.[^.]+/g,na=/^v-slot(:|$)|^#/,ra=/[\r\n]/,ia=/\s+/g,oa=g(yo),aa="_empty_";function sa(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:va(t),rawAttrsMap:{},parent:n,children:[]}}function ca(e,t){Fo=t.warn||kr,Vo=t.isPreTag||T,Ko=t.mustUseProp||T,Jo=t.getTagNamespace||T;t.isReservedTag;Bo=Or(t.modules,"transformNode"),Uo=Or(t.modules,"preTransformNode"),zo=Or(t.modules,"postTransformNode"),Ho=t.delimiters;var n,r,i=[],o=!1!==t.preserveWhitespace,a=t.whitespace,s=!1,c=!1;function u(e){if(l(e),s||e.processed||(e=ua(e,t)),i.length||e===n||n.if&&(e.elseif||e.else)&&fa(n,{exp:e.elseif,block:e}),r&&!e.forbidden)if(e.elseif||e.else)a=e,(u=function(e){var t=e.length;for(;t--;){if(1===e[t].type)return e[t];e.pop()}}(r.children))&&u.if&&fa(u,{exp:a.elseif,block:a});else{if(e.slotScope){var o=e.slotTarget||'"default"';(r.scopedSlots||(r.scopedSlots={}))[o]=e}r.children.push(e),e.parent=r}var a,u;e.children=e.children.filter(function(e){return!e.slotScope}),l(e),e.pre&&(s=!1),Vo(e.tag)&&(c=!1);for(var f=0;f]*>)","i")),p=e.replace(f,function(e,n,r){return u=r.length,No(l)||"noscript"===l||(n=n.replace(//g,"$1").replace(//g,"$1")),Po(l,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""});c+=e.length-p.length,e=p,k(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(To.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),C(v+3);continue}}if(Eo.test(e)){var h=e.indexOf("]>");if(h>=0){C(h+2);continue}}var m=e.match(So);if(m){C(m[0].length);continue}var y=e.match(Oo);if(y){var g=c;C(y[0].length),k(y[1],g,c);continue}var _=x();if(_){A(_),Po(_.tagName,e)&&C(1);continue}}var b=void 0,$=void 0,w=void 0;if(d>=0){for($=e.slice(d);!(Oo.test($)||Ao.test($)||To.test($)||Eo.test($)||(w=$.indexOf("<",1))<0);)d+=w,$=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&C(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function C(t){c+=t,e=e.substring(t)}function x(){var t=e.match(Ao);if(t){var n,r,i={tagName:t[1],attrs:[],start:c};for(C(t[0].length);!(n=e.match(ko))&&(r=e.match(wo)||e.match($o));)r.start=c,C(r[0].length),r.end=c,i.attrs.push(r);if(n)return i.unarySlash=n[1],C(n[0].length),i.end=c,i}}function A(e){var n=e.tagName,c=e.unarySlash;o&&("p"===r&&bo(n)&&k(r),s(n)&&r===n&&k(n));for(var u=a(n)||!!c,l=e.attrs.length,f=new Array(l),p=0;p=0&&i[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=i.length-1;u>=a;u--)t.end&&t.end(i[u].tag,n,o);i.length=a,r=a&&i[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,o):"p"===s&&(t.start&&t.start(e,[],!1,n,o),t.end&&t.end(e,n,o))}k()}(e,{warn:Fo,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,l){var f=r&&r.ns||Jo(e);J&&"svg"===f&&(o=function(e){for(var t=[],n=0;nc&&(s.push(o=e.slice(c,i)),a.push(JSON.stringify(o)));var u=xr(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+r[0].length}return c-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),Lr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Fr(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Fr(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Fr(t,"$$c")+"}",null,!0)}(e,r,i);else if("input"===o&&"radio"===a)!function(e,t,n){var r=n&&n.number,i=Mr(e,"value")||"null";Sr(e,"checked","_q("+t+","+(i=r?"_n("+i+")":i)+")"),Lr(e,"change",Fr(t,i),null,!0)}(e,r,i);else if("input"===o||"textarea"===o)!function(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?Jr:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=Fr(t,l);c&&(f="if($event.target.composing)return;"+f),Sr(e,"value","("+t+")"),Lr(e,u,f,null,!0),(s||a)&&Lr(e,"blur","$forceUpdate()")}(e,r,i);else if(!P.isReservedTag(o))return Rr(e,r,i),!1;return!0},text:function(e,t){t.value&&Sr(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Sr(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:go,mustUseProp:En,canBeLeftOpenTag:_o,isReservedTag:Jn,getTagNamespace:qn,staticKeys:function(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}(ga)},wa=g(function(e){return p("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))});function Ca(e,t){e&&(_a=wa(t.staticKeys||""),ba=t.isReservedTag||T,function e(t){t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||d(e.tag)||!ba(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(_a)))}(t);if(1===t.type){if(!ba(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n|^function\s*\(/,Aa=/\([^)]*?\);*$/,ka=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Oa={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Sa={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Ta=function(e){return"if("+e+")return null;"},Ea={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Ta("$event.target !== $event.currentTarget"),ctrl:Ta("!$event.ctrlKey"),shift:Ta("!$event.shiftKey"),alt:Ta("!$event.altKey"),meta:Ta("!$event.metaKey"),left:Ta("'button' in $event && $event.button !== 0"),middle:Ta("'button' in $event && $event.button !== 1"),right:Ta("'button' in $event && $event.button !== 2")};function Na(e,t){var n=t?"nativeOn:":"on:",r="",i="";for(var o in e){var a=ja(e[o]);e[o]&&e[o].dynamic?i+=o+","+a+",":r+='"'+o+'":'+a+","}return r="{"+r.slice(0,-1)+"}",i?n+"_d("+r+",["+i.slice(0,-1)+"])":n+r}function ja(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map(function(e){return ja(e)}).join(",")+"]";var t=ka.test(e.value),n=xa.test(e.value),r=ka.test(e.value.replace(Aa,""));if(e.modifiers){var i="",o="",a=[];for(var s in e.modifiers)if(Ea[s])o+=Ea[s],Oa[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;o+=Ta(["ctrl","shift","alt","meta"].filter(function(e){return!c[e]}).map(function(e){return"$event."+e+"Key"}).join("||"))}else a.push(s);return a.length&&(i+=function(e){return"if(('keyCode' in $event)&&"+e.map(La).join("&&")+")return null;"}(a)),o&&(i+=o),"function($event){"+i+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function La(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Oa[e],r=Sa[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Ma={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:S},Ia=function(e){this.options=e,this.warn=e.warn||kr,this.transforms=Or(e.modules,"transformCode"),this.dataGenFns=Or(e.modules,"genData"),this.directives=k(k({},Ma),e.directives);var t=e.isReservedTag||T;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Da(e,t){var n=new Ia(t);return{render:"with(this){return "+(e?Pa(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Pa(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Ra(e,t);if(e.once&&!e.onceProcessed)return Fa(e,t);if(e.for&&!e.forProcessed)return Ba(e,t);if(e.if&&!e.ifProcessed)return Ha(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=Va(e,t),i="_t("+n+(r?","+r:""),o=e.attrs||e.dynamicAttrs?qa((e.attrs||[]).concat(e.dynamicAttrs||[]).map(function(e){return{name:b(e.name),value:e.value,dynamic:e.dynamic}})):null,a=e.attrsMap["v-bind"];!o&&!a||r||(i+=",null");o&&(i+=","+o);a&&(i+=(o?"":",null")+","+a);return i+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:Va(t,n,!0);return"_c("+e+","+Ua(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Ua(e,t));var i=e.inlineTemplate?null:Va(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(i?","+i:"")+")"}for(var o=0;o':'
',Ya.innerHTML.indexOf(" ")>0}var ns=!!U&&ts(!1),rs=!!U&&ts(!0),is=g(function(e){var t=Gn(e);return t&&t.innerHTML}),os=bn.prototype.$mount;return bn.prototype.$mount=function(e,t){if((e=e&&Gn(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=is(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){var i=es(r,{outputSourceRange:!1,shouldDecodeNewlines:ns,shouldDecodeNewlinesForHref:rs,delimiters:n.delimiters,comments:n.comments},this),o=i.render,a=i.staticRenderFns;n.render=o,n.staticRenderFns=a}}return os.call(this,e,t)},bn.compile=es,bn}); \ No newline at end of file diff --git a/dist/vue.runtime.common.dev.js b/dist/vue.runtime.common.dev.js index 389e6632973..452f825a0ad 100644 --- a/dist/vue.runtime.common.dev.js +++ b/dist/vue.runtime.common.dev.js @@ -1,5 +1,5 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ @@ -525,6 +525,7 @@ var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android' var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; var isPhantomJS = UA && /phantomjs/.test(UA); +var isFF = UA && UA.match(/firefox\/(\d+)/); // Firefox has a "watch" function on Object.prototype... var nativeWatch = ({}).watch; @@ -2395,2437 +2396,2439 @@ function normalizeArrayChildren (children, nestedIndex) { /* */ -function ensureCtor (comp, base) { - if ( - comp.__esModule || - (hasSymbol && comp[Symbol.toStringTag] === 'Module') - ) { - comp = comp.default; +function initProvide (vm) { + var provide = vm.$options.provide; + if (provide) { + vm._provided = typeof provide === 'function' + ? provide.call(vm) + : provide; } - return isObject(comp) - ? base.extend(comp) - : comp -} - -function createAsyncPlaceholder ( - factory, - data, - context, - children, - tag -) { - var node = createEmptyVNode(); - node.asyncFactory = factory; - node.asyncMeta = { data: data, context: context, children: children, tag: tag }; - return node } -function resolveAsyncComponent ( - factory, - baseCtor, - context -) { - if (isTrue(factory.error) && isDef(factory.errorComp)) { - return factory.errorComp - } - - if (isDef(factory.resolved)) { - return factory.resolved - } - - if (isTrue(factory.loading) && isDef(factory.loadingComp)) { - return factory.loadingComp - } - - if (isDef(factory.contexts)) { - // already pending - factory.contexts.push(context); - } else { - var contexts = factory.contexts = [context]; - var sync = true; - - var forceRender = function (renderCompleted) { - for (var i = 0, l = contexts.length; i < l; i++) { - contexts[i].$forceUpdate(); - } - - if (renderCompleted) { - contexts.length = 0; - } - }; - - var resolve = once(function (res) { - // cache resolved - factory.resolved = ensureCtor(res, baseCtor); - // invoke callbacks only if this is not a synchronous resolve - // (async resolves are shimmed as synchronous during SSR) - if (!sync) { - forceRender(true); - } else { - contexts.length = 0; - } - }); - - var reject = once(function (reason) { - warn( - "Failed to resolve async component: " + (String(factory)) + - (reason ? ("\nReason: " + reason) : '') - ); - if (isDef(factory.errorComp)) { - factory.error = true; - forceRender(true); +function initInjections (vm) { + var result = resolveInject(vm.$options.inject, vm); + if (result) { + toggleObserving(false); + Object.keys(result).forEach(function (key) { + /* istanbul ignore else */ + { + defineReactive$$1(vm, key, result[key], function () { + warn( + "Avoid mutating an injected value directly since the changes will be " + + "overwritten whenever the provided component re-renders. " + + "injection being mutated: \"" + key + "\"", + vm + ); + }); } }); + toggleObserving(true); + } +} - var res = factory(resolve, reject); - - if (isObject(res)) { - if (isPromise(res)) { - // () => Promise - if (isUndef(factory.resolved)) { - res.then(resolve, reject); - } - } else if (isPromise(res.component)) { - res.component.then(resolve, reject); - - if (isDef(res.error)) { - factory.errorComp = ensureCtor(res.error, baseCtor); - } +function resolveInject (inject, vm) { + if (inject) { + // inject is :any because flow is not smart enough to figure out cached + var result = Object.create(null); + var keys = hasSymbol + ? Reflect.ownKeys(inject) + : Object.keys(inject); - if (isDef(res.loading)) { - factory.loadingComp = ensureCtor(res.loading, baseCtor); - if (res.delay === 0) { - factory.loading = true; - } else { - setTimeout(function () { - if (isUndef(factory.resolved) && isUndef(factory.error)) { - factory.loading = true; - forceRender(false); - } - }, res.delay || 200); - } + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + // #6574 in case the inject object is observed... + if (key === '__ob__') { continue } + var provideKey = inject[key].from; + var source = vm; + while (source) { + if (source._provided && hasOwn(source._provided, provideKey)) { + result[key] = source._provided[provideKey]; + break } - - if (isDef(res.timeout)) { - setTimeout(function () { - if (isUndef(factory.resolved)) { - reject( - "timeout (" + (res.timeout) + "ms)" - ); - } - }, res.timeout); + source = source.$parent; + } + if (!source) { + if ('default' in inject[key]) { + var provideDefault = inject[key].default; + result[key] = typeof provideDefault === 'function' + ? provideDefault.call(vm) + : provideDefault; + } else { + warn(("Injection \"" + key + "\" not found"), vm); } } } - - sync = false; - // return in case resolved synchronously - return factory.loading - ? factory.loadingComp - : factory.resolved + return result } } /* */ -function isAsyncPlaceholder (node) { - return node.isComment && node.asyncFactory -} -/* */ -function getFirstComponentChild (children) { - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - var c = children[i]; - if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { - return c +/** + * Runtime helper for resolving raw children VNodes into a slot object. + */ +function resolveSlots ( + children, + context +) { + if (!children || !children.length) { + return {} + } + var slots = {}; + for (var i = 0, l = children.length; i < l; i++) { + var child = children[i]; + var data = child.data; + // remove slot attribute if the node is resolved as a Vue slot node + if (data && data.attrs && data.attrs.slot) { + delete data.attrs.slot; + } + // named slots should only be respected if the vnode was rendered in the + // same context. + if ((child.context === context || child.fnContext === context) && + data && data.slot != null + ) { + var name = data.slot; + var slot = (slots[name] || (slots[name] = [])); + if (child.tag === 'template') { + slot.push.apply(slot, child.children || []); + } else { + slot.push(child); } + } else { + (slots.default || (slots.default = [])).push(child); + } + } + // ignore slots that contains only whitespace + for (var name$1 in slots) { + if (slots[name$1].every(isWhitespace)) { + delete slots[name$1]; } } + return slots } -/* */ +function isWhitespace (node) { + return (node.isComment && !node.asyncFactory) || node.text === ' ' +} /* */ -function initEvents (vm) { - vm._events = Object.create(null); - vm._hasHookEvent = false; - // init parent attached events - var listeners = vm.$options._parentListeners; - if (listeners) { - updateComponentListeners(vm, listeners); +function normalizeScopedSlots ( + slots, + normalSlots +) { + var res; + if (!slots) { + res = {}; + } else if (slots._normalized) { + return slots + } else { + res = {}; + for (var key in slots) { + if (slots[key] && key[0] !== '$') { + res[key] = normalizeScopedSlot(slots[key]); + } + } + } + // expose normal slots on scopedSlots + for (var key$1 in normalSlots) { + if (!(key$1 in res)) { + res[key$1] = proxyNormalSlot(normalSlots, key$1); + } } + def(res, '_normalized', true); + def(res, '$stable', slots ? !!slots.$stable : true); + return res } -var target; - -function add (event, fn) { - target.$on(event, fn); +function normalizeScopedSlot(fn) { + return function (scope) { + var res = fn(scope); + return res && typeof res === 'object' && !Array.isArray(res) + ? [res] // single vnode + : normalizeChildren(res) + } } -function remove$1 (event, fn) { - target.$off(event, fn); +function proxyNormalSlot(slots, key) { + return function () { return slots[key]; } } -function createOnceHandler (event, fn) { - var _target = target; - return function onceHandler () { - var res = fn.apply(null, arguments); - if (res !== null) { - _target.$off(event, onceHandler); - } - } -} +/* */ -function updateComponentListeners ( - vm, - listeners, - oldListeners +/** + * Runtime helper for rendering v-for lists. + */ +function renderList ( + val, + render ) { - target = vm; - updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); - target = undefined; -} - -function eventsMixin (Vue) { - var hookRE = /^hook:/; - Vue.prototype.$on = function (event, fn) { - var vm = this; - if (Array.isArray(event)) { - for (var i = 0, l = event.length; i < l; i++) { - vm.$on(event[i], fn); - } - } else { - (vm._events[event] || (vm._events[event] = [])).push(fn); - // optimize hook:event cost by using a boolean flag marked at registration - // instead of a hash lookup - if (hookRE.test(event)) { - vm._hasHookEvent = true; - } - } - return vm - }; - - Vue.prototype.$once = function (event, fn) { - var vm = this; - function on () { - vm.$off(event, on); - fn.apply(vm, arguments); - } - on.fn = fn; - vm.$on(event, on); - return vm - }; - - Vue.prototype.$off = function (event, fn) { - var vm = this; - // all - if (!arguments.length) { - vm._events = Object.create(null); - return vm - } - // array of events - if (Array.isArray(event)) { - for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { - vm.$off(event[i$1], fn); - } - return vm - } - // specific event - var cbs = vm._events[event]; - if (!cbs) { - return vm - } - if (!fn) { - vm._events[event] = null; - return vm + var ret, i, l, keys, key; + if (Array.isArray(val) || typeof val === 'string') { + ret = new Array(val.length); + for (i = 0, l = val.length; i < l; i++) { + ret[i] = render(val[i], i); } - // specific handler - var cb; - var i = cbs.length; - while (i--) { - cb = cbs[i]; - if (cb === fn || cb.fn === fn) { - cbs.splice(i, 1); - break - } + } else if (typeof val === 'number') { + ret = new Array(val); + for (i = 0; i < val; i++) { + ret[i] = render(i + 1, i); } - return vm - }; - - Vue.prototype.$emit = function (event) { - var vm = this; - { - var lowerCaseEvent = event.toLowerCase(); - if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { - tip( - "Event \"" + lowerCaseEvent + "\" is emitted in component " + - (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + - "Note that HTML attributes are case-insensitive and you cannot use " + - "v-on to listen to camelCase events when using in-DOM templates. " + - "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." - ); + } else if (isObject(val)) { + if (hasSymbol && val[Symbol.iterator]) { + ret = []; + var iterator = val[Symbol.iterator](); + var result = iterator.next(); + while (!result.done) { + ret.push(render(result.value, ret.length)); + result = iterator.next(); } - } - var cbs = vm._events[event]; - if (cbs) { - cbs = cbs.length > 1 ? toArray(cbs) : cbs; - var args = toArray(arguments, 1); - var info = "event handler for \"" + event + "\""; - for (var i = 0, l = cbs.length; i < l; i++) { - invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } else { + keys = Object.keys(val); + ret = new Array(keys.length); + for (i = 0, l = keys.length; i < l; i++) { + key = keys[i]; + ret[i] = render(val[key], key, i); } } - return vm - }; + } + if (!isDef(ret)) { + ret = []; + } + (ret)._isVList = true; + return ret } /* */ - - /** - * Runtime helper for resolving raw children VNodes into a slot object. + * Runtime helper for rendering */ -function resolveSlots ( - children, - context +function renderSlot ( + name, + fallback, + props, + bindObject ) { - if (!children || !children.length) { - return {} - } - var slots = {}; - for (var i = 0, l = children.length; i < l; i++) { - var child = children[i]; - var data = child.data; - // remove slot attribute if the node is resolved as a Vue slot node - if (data && data.attrs && data.attrs.slot) { - delete data.attrs.slot; - } - // named slots should only be respected if the vnode was rendered in the - // same context. - if ((child.context === context || child.fnContext === context) && - data && data.slot != null - ) { - var name = data.slot; - var slot = (slots[name] || (slots[name] = [])); - if (child.tag === 'template') { - slot.push.apply(slot, child.children || []); - } else { - slot.push(child); + var scopedSlotFn = this.$scopedSlots[name]; + var nodes; + if (scopedSlotFn) { // scoped slot + props = props || {}; + if (bindObject) { + if (!isObject(bindObject)) { + warn( + 'slot v-bind without argument expects an Object', + this + ); } - } else { - (slots.default || (slots.default = [])).push(child); - } - } - // ignore slots that contains only whitespace - for (var name$1 in slots) { - if (slots[name$1].every(isWhitespace)) { - delete slots[name$1]; + props = extend(extend({}, bindObject), props); } + nodes = scopedSlotFn(props) || fallback; + } else { + nodes = this.$slots[name] || fallback; } - return slots -} - -function isWhitespace (node) { - return (node.isComment && !node.asyncFactory) || node.text === ' ' -} -function resolveScopedSlots ( - fns, // see flow/vnode - hasDynamicKeys, - res -) { - res = res || { $stable: !hasDynamicKeys }; - for (var i = 0; i < fns.length; i++) { - var slot = fns[i]; - if (Array.isArray(slot)) { - resolveScopedSlots(slot, hasDynamicKeys, res); - } else if (slot) { - res[slot.key] = slot.fn; - } + var target = props && props.slot; + if (target) { + return this.$createElement('template', { slot: target }, nodes) + } else { + return nodes } - return res } /* */ -var activeInstance = null; -var isUpdatingChildComponent = false; - -function setActiveInstance(vm) { - var prevActiveInstance = activeInstance; - activeInstance = vm; - return function () { - activeInstance = prevActiveInstance; - } +/** + * Runtime helper for resolving filters + */ +function resolveFilter (id) { + return resolveAsset(this.$options, 'filters', id, true) || identity } -function initLifecycle (vm) { - var options = vm.$options; +/* */ - // locate first non-abstract parent - var parent = options.parent; - if (parent && !options.abstract) { - while (parent.$options.abstract && parent.$parent) { - parent = parent.$parent; - } - parent.$children.push(vm); +function isKeyNotMatch (expect, actual) { + if (Array.isArray(expect)) { + return expect.indexOf(actual) === -1 + } else { + return expect !== actual } +} - vm.$parent = parent; - vm.$root = parent ? parent.$root : vm; - - vm.$children = []; - vm.$refs = {}; - - vm._watcher = null; - vm._inactive = null; - vm._directInactive = false; - vm._isMounted = false; - vm._isDestroyed = false; - vm._isBeingDestroyed = false; +/** + * Runtime helper for checking keyCodes from config. + * exposed as Vue.prototype._k + * passing in eventKeyName as last argument separately for backwards compat + */ +function checkKeyCodes ( + eventKeyCode, + key, + builtInKeyCode, + eventKeyName, + builtInKeyName +) { + var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; + if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { + return isKeyNotMatch(builtInKeyName, eventKeyName) + } else if (mappedKeyCode) { + return isKeyNotMatch(mappedKeyCode, eventKeyCode) + } else if (eventKeyName) { + return hyphenate(eventKeyName) !== key + } } -function lifecycleMixin (Vue) { - Vue.prototype._update = function (vnode, hydrating) { - var vm = this; - var prevEl = vm.$el; - var prevVnode = vm._vnode; - var restoreActiveInstance = setActiveInstance(vm); - vm._vnode = vnode; - // Vue.prototype.__patch__ is injected in entry points - // based on the rendering backend used. - if (!prevVnode) { - // initial render - vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); +/* */ + +/** + * Runtime helper for merging v-bind="object" into a VNode's data. + */ +function bindObjectProps ( + data, + tag, + value, + asProp, + isSync +) { + if (value) { + if (!isObject(value)) { + warn( + 'v-bind without argument expects an Object or Array value', + this + ); } else { - // updates - vm.$el = vm.__patch__(prevVnode, vnode); - } - restoreActiveInstance(); - // update __vue__ reference - if (prevEl) { - prevEl.__vue__ = null; - } - if (vm.$el) { - vm.$el.__vue__ = vm; - } - // if parent is an HOC, update its $el as well - if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { - vm.$parent.$el = vm.$el; - } - // updated hook is called by the scheduler to ensure that children are - // updated in a parent's updated hook. - }; + if (Array.isArray(value)) { + value = toObject(value); + } + var hash; + var loop = function ( key ) { + if ( + key === 'class' || + key === 'style' || + isReservedAttribute(key) + ) { + hash = data; + } else { + var type = data.attrs && data.attrs.type; + hash = asProp || config.mustUseProp(tag, type, key) + ? data.domProps || (data.domProps = {}) + : data.attrs || (data.attrs = {}); + } + var camelizedKey = camelize(key); + if (!(key in hash) && !(camelizedKey in hash)) { + hash[key] = value[key]; - Vue.prototype.$forceUpdate = function () { - var vm = this; - if (vm._watcher) { - vm._watcher.update(); - } - }; + if (isSync) { + var on = data.on || (data.on = {}); + on[("update:" + camelizedKey)] = function ($event) { + value[key] = $event; + }; + } + } + }; - Vue.prototype.$destroy = function () { - var vm = this; - if (vm._isBeingDestroyed) { - return - } - callHook(vm, 'beforeDestroy'); - vm._isBeingDestroyed = true; - // remove self from parent - var parent = vm.$parent; - if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { - remove(parent.$children, vm); - } - // teardown watchers - if (vm._watcher) { - vm._watcher.teardown(); - } - var i = vm._watchers.length; - while (i--) { - vm._watchers[i].teardown(); - } - // remove reference from data ob - // frozen object may not have observer. - if (vm._data.__ob__) { - vm._data.__ob__.vmCount--; - } - // call the last hook... - vm._isDestroyed = true; - // invoke destroy hooks on current rendered tree - vm.__patch__(vm._vnode, null); - // fire destroyed hook - callHook(vm, 'destroyed'); - // turn off all instance listeners. - vm.$off(); - // remove __vue__ reference - if (vm.$el) { - vm.$el.__vue__ = null; - } - // release circular reference (#6759) - if (vm.$vnode) { - vm.$vnode.parent = null; + for (var key in value) loop( key ); } - }; + } + return data } -function mountComponent ( - vm, - el, - hydrating +/* */ + +/** + * Runtime helper for rendering static trees. + */ +function renderStatic ( + index, + isInFor ) { - vm.$el = el; - if (!vm.$options.render) { - vm.$options.render = createEmptyVNode; - { - /* istanbul ignore if */ - if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || - vm.$options.el || el) { - warn( - 'You are using the runtime-only build of Vue where the template ' + - 'compiler is not available. Either pre-compile the templates into ' + - 'render functions, or use the compiler-included build.', - vm - ); - } else { - warn( - 'Failed to mount component: template or render function not defined.', - vm - ); - } - } + var cached = this._staticTrees || (this._staticTrees = []); + var tree = cached[index]; + // if has already-rendered static tree and not inside v-for, + // we can reuse the same tree. + if (tree && !isInFor) { + return tree } - callHook(vm, 'beforeMount'); - - var updateComponent; - /* istanbul ignore if */ - if (config.performance && mark) { - updateComponent = function () { - var name = vm._name; - var id = vm._uid; - var startTag = "vue-perf-start:" + id; - var endTag = "vue-perf-end:" + id; + // otherwise, render a fresh tree. + tree = cached[index] = this.$options.staticRenderFns[index].call( + this._renderProxy, + null, + this // for render fns generated for functional component templates + ); + markStatic(tree, ("__static__" + index), false); + return tree +} - mark(startTag); - var vnode = vm._render(); - mark(endTag); - measure(("vue " + name + " render"), startTag, endTag); +/** + * Runtime helper for v-once. + * Effectively it means marking the node as static with a unique key. + */ +function markOnce ( + tree, + index, + key +) { + markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); + return tree +} - mark(startTag); - vm._update(vnode, hydrating); - mark(endTag); - measure(("vue " + name + " patch"), startTag, endTag); - }; +function markStatic ( + tree, + key, + isOnce +) { + if (Array.isArray(tree)) { + for (var i = 0; i < tree.length; i++) { + if (tree[i] && typeof tree[i] !== 'string') { + markStaticNode(tree[i], (key + "_" + i), isOnce); + } + } } else { - updateComponent = function () { - vm._update(vm._render(), hydrating); - }; + markStaticNode(tree, key, isOnce); } +} - // we set this to vm._watcher inside the watcher's constructor - // since the watcher's initial patch may call $forceUpdate (e.g. inside child - // component's mounted hook), which relies on vm._watcher being already defined - new Watcher(vm, updateComponent, noop, { - before: function before () { - if (vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'beforeUpdate'); +function markStaticNode (node, key, isOnce) { + node.isStatic = true; + node.key = key; + node.isOnce = isOnce; +} + +/* */ + +function bindObjectListeners (data, value) { + if (value) { + if (!isPlainObject(value)) { + warn( + 'v-on without argument expects an Object value', + this + ); + } else { + var on = data.on = data.on ? extend({}, data.on) : {}; + for (var key in value) { + var existing = on[key]; + var ours = value[key]; + on[key] = existing ? [].concat(existing, ours) : ours; } } - }, true /* isRenderWatcher */); - hydrating = false; - - // manually mounted instance, call mounted on self - // mounted is called for render-created child components in its inserted hook - if (vm.$vnode == null) { - vm._isMounted = true; - callHook(vm, 'mounted'); } - return vm + return data } -function updateChildComponent ( - vm, - propsData, - listeners, - parentVnode, - renderChildren +/* */ + +function resolveScopedSlots ( + fns, // see flow/vnode + hasDynamicKeys, + res ) { - { - isUpdatingChildComponent = true; + res = res || { $stable: !hasDynamicKeys }; + for (var i = 0; i < fns.length; i++) { + var slot = fns[i]; + if (Array.isArray(slot)) { + resolveScopedSlots(slot, hasDynamicKeys, res); + } else if (slot) { + res[slot.key] = slot.fn; + } } + return res +} - // determine whether component has slot children - // we need to do this before overwriting $options._renderChildren. +/* */ - // check if there are dynamic scopedSlots (hand-written or compiled but with - // dynamic slot names). Static scoped slots compiled from template has the - // "$stable" marker. - var hasDynamicScopedSlot = !!( - (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || - (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) - ); - // Any static slot children from the parent may have changed during parent's - // update. Dynamic scoped slots may also have changed. In such cases, a forced - // update is necessary to ensure correctness. - var needsForceUpdate = !!( - renderChildren || // has new static slots - vm.$options._renderChildren || // has old static slots - hasDynamicScopedSlot - ); +function bindDynamicKeys (baseObj, values) { + for (var i = 0; i < values.length; i += 2) { + var key = values[i]; + if (typeof key === 'string' && key) { + baseObj[values[i]] = values[i + 1]; + } else if (key !== '' && key !== null) { + // null is a speical value for explicitly removing a binding + warn( + ("Invalid value for dynamic directive argument (expected string or null): " + key), + this + ); + } + } + return baseObj +} - vm.$options._parentVnode = parentVnode; - vm.$vnode = parentVnode; // update vm's placeholder node without re-render +// helper to dynamically append modifier runtime markers to event names. +// ensure only append when value is already string, otherwise it will be cast +// to string and cause the type check to miss. +function prependModifier (value, symbol) { + return typeof value === 'string' ? symbol + value : value +} - if (vm._vnode) { // update child tree's parent - vm._vnode.parent = parentVnode; - } - vm.$options._renderChildren = renderChildren; +/* */ - // update $attrs and $listeners hash - // these are also reactive so they may trigger child update if the child - // used them during render - vm.$attrs = parentVnode.data.attrs || emptyObject; - vm.$listeners = listeners || emptyObject; +function installRenderHelpers (target) { + target._o = markOnce; + target._n = toNumber; + target._s = toString; + target._l = renderList; + target._t = renderSlot; + target._q = looseEqual; + target._i = looseIndexOf; + target._m = renderStatic; + target._f = resolveFilter; + target._k = checkKeyCodes; + target._b = bindObjectProps; + target._v = createTextVNode; + target._e = createEmptyVNode; + target._u = resolveScopedSlots; + target._g = bindObjectListeners; + target._d = bindDynamicKeys; + target._p = prependModifier; +} - // update props - if (propsData && vm.$options.props) { - toggleObserving(false); - var props = vm._props; - var propKeys = vm.$options._propKeys || []; - for (var i = 0; i < propKeys.length; i++) { - var key = propKeys[i]; - var propOptions = vm.$options.props; // wtf flow? - props[key] = validateProp(key, propOptions, propsData, vm); - } - toggleObserving(true); - // keep a copy of raw propsData - vm.$options.propsData = propsData; +/* */ + +function FunctionalRenderContext ( + data, + props, + children, + parent, + Ctor +) { + var options = Ctor.options; + // ensure the createElement function in functional components + // gets a unique context - this is necessary for correct named slot check + var contextVm; + if (hasOwn(parent, '_uid')) { + contextVm = Object.create(parent); + // $flow-disable-line + contextVm._original = parent; + } else { + // the context vm passed in is a functional context as well. + // in this case we want to make sure we are able to get a hold to the + // real context instance. + contextVm = parent; + // $flow-disable-line + parent = parent._original; } + var isCompiled = isTrue(options._compiled); + var needNormalization = !isCompiled; - // update listeners - listeners = listeners || emptyObject; - var oldListeners = vm.$options._parentListeners; - vm.$options._parentListeners = listeners; - updateComponentListeners(vm, listeners, oldListeners); + this.data = data; + this.props = props; + this.children = children; + this.parent = parent; + this.listeners = data.on || emptyObject; + this.injections = resolveInject(options.inject, parent); + this.slots = function () { return resolveSlots(children, parent); }; - // resolve slots + force update if has children - if (needsForceUpdate) { - vm.$slots = resolveSlots(renderChildren, parentVnode.context); - vm.$forceUpdate(); - } + Object.defineProperty(this, 'scopedSlots', ({ + enumerable: true, + get: function get () { + return normalizeScopedSlots(data.scopedSlots, this.slots()) + } + })); - { - isUpdatingChildComponent = false; + // support for compiled functional template + if (isCompiled) { + // exposing $options for renderStatic() + this.$options = options; + // pre-resolve slots for renderSlot() + this.$slots = this.slots(); + this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); } -} -function isInInactiveTree (vm) { - while (vm && (vm = vm.$parent)) { - if (vm._inactive) { return true } + if (options._scopeId) { + this._c = function (a, b, c, d) { + var vnode = createElement(contextVm, a, b, c, d, needNormalization); + if (vnode && !Array.isArray(vnode)) { + vnode.fnScopeId = options._scopeId; + vnode.fnContext = parent; + } + return vnode + }; + } else { + this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; } - return false } -function activateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = false; - if (isInInactiveTree(vm)) { - return +installRenderHelpers(FunctionalRenderContext.prototype); + +function createFunctionalComponent ( + Ctor, + propsData, + data, + contextVm, + children +) { + var options = Ctor.options; + var props = {}; + var propOptions = options.props; + if (isDef(propOptions)) { + for (var key in propOptions) { + props[key] = validateProp(key, propOptions, propsData || emptyObject); } - } else if (vm._directInactive) { - return + } else { + if (isDef(data.attrs)) { mergeProps(props, data.attrs); } + if (isDef(data.props)) { mergeProps(props, data.props); } } - if (vm._inactive || vm._inactive === null) { - vm._inactive = false; - for (var i = 0; i < vm.$children.length; i++) { - activateChildComponent(vm.$children[i]); + + var renderContext = new FunctionalRenderContext( + data, + props, + children, + contextVm, + Ctor + ); + + var vnode = options.render.call(null, renderContext._c, renderContext); + + if (vnode instanceof VNode) { + return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) + } else if (Array.isArray(vnode)) { + var vnodes = normalizeChildren(vnode) || []; + var res = new Array(vnodes.length); + for (var i = 0; i < vnodes.length; i++) { + res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); } - callHook(vm, 'activated'); + return res } } -function deactivateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = true; - if (isInInactiveTree(vm)) { - return - } +function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { + // #7817 clone node before setting fnContext, otherwise if the node is reused + // (e.g. it was from a cached normal slot) the fnContext causes named slots + // that should not be matched to match. + var clone = cloneVNode(vnode); + clone.fnContext = contextVm; + clone.fnOptions = options; + { + (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; } - if (!vm._inactive) { - vm._inactive = true; - for (var i = 0; i < vm.$children.length; i++) { - deactivateChildComponent(vm.$children[i]); - } - callHook(vm, 'deactivated'); + if (data.slot) { + (clone.data || (clone.data = {})).slot = data.slot; } + return clone } -function callHook (vm, hook) { - // #7573 disable dep collection when invoking lifecycle hooks - pushTarget(); - var handlers = vm.$options[hook]; - var info = hook + " hook"; - if (handlers) { - for (var i = 0, j = handlers.length; i < j; i++) { - invokeWithErrorHandling(handlers[i], vm, null, vm, info); - } - } - if (vm._hasHookEvent) { - vm.$emit('hook:' + hook); +function mergeProps (to, from) { + for (var key in from) { + to[camelize(key)] = from[key]; } - popTarget(); } /* */ -var MAX_UPDATE_COUNT = 100; +/* */ -var queue = []; -var activatedChildren = []; -var has = {}; -var circular = {}; -var waiting = false; -var flushing = false; -var index = 0; +/* */ -/** - * Reset the scheduler's state. - */ -function resetSchedulerState () { - index = queue.length = activatedChildren.length = 0; - has = {}; - { - circular = {}; - } - waiting = flushing = false; -} +/* */ -// Async edge case #6566 requires saving the timestamp when event listeners are -// attached. However, calling performance.now() has a perf overhead especially -// if the page has thousands of event listeners. Instead, we take a timestamp -// every time the scheduler flushes and use that for all event listeners -// attached during that flush. -var currentFlushTimestamp = 0; +// inline hooks to be invoked on component VNodes during patch +var componentVNodeHooks = { + init: function init (vnode, hydrating) { + if ( + vnode.componentInstance && + !vnode.componentInstance._isDestroyed && + vnode.data.keepAlive + ) { + // kept-alive components, treat as a patch + var mountedNode = vnode; // work around flow + componentVNodeHooks.prepatch(mountedNode, mountedNode); + } else { + var child = vnode.componentInstance = createComponentInstanceForVnode( + vnode, + activeInstance + ); + child.$mount(hydrating ? vnode.elm : undefined, hydrating); + } + }, -// Async edge case fix requires storing an event listener's attach timestamp. -var getNow = Date.now; + prepatch: function prepatch (oldVnode, vnode) { + var options = vnode.componentOptions; + var child = vnode.componentInstance = oldVnode.componentInstance; + updateChildComponent( + child, + options.propsData, // updated props + options.listeners, // updated listeners + vnode, // new parent vnode + options.children // new children + ); + }, -// Determine what event timestamp the browser is using. Annoyingly, the -// timestamp can either be hi-res ( relative to poge load) or low-res -// (relative to UNIX epoch), so in order to compare time we have to use the -// same timestamp type when saving the flush timestamp. -if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { - // if the low-res timestamp which is bigger than the event timestamp - // (which is evaluated AFTER) it means the event is using a hi-res timestamp, - // and we need to use the hi-res version for event listeners as well. - getNow = function () { return performance.now(); }; -} + insert: function insert (vnode) { + var context = vnode.context; + var componentInstance = vnode.componentInstance; + if (!componentInstance._isMounted) { + componentInstance._isMounted = true; + callHook(componentInstance, 'mounted'); + } + if (vnode.data.keepAlive) { + if (context._isMounted) { + // vue-router#1212 + // During updates, a kept-alive component's child components may + // change, so directly walking the tree here may call activated hooks + // on incorrect children. Instead we push them into a queue which will + // be processed after the whole patch process ended. + queueActivatedComponent(componentInstance); + } else { + activateChildComponent(componentInstance, true /* direct */); + } + } + }, -/** - * Flush both queues and run the watchers. - */ -function flushSchedulerQueue () { - currentFlushTimestamp = getNow(); - flushing = true; - var watcher, id; + destroy: function destroy (vnode) { + var componentInstance = vnode.componentInstance; + if (!componentInstance._isDestroyed) { + if (!vnode.data.keepAlive) { + componentInstance.$destroy(); + } else { + deactivateChildComponent(componentInstance, true /* direct */); + } + } + } +}; - // Sort queue before flush. - // This ensures that: - // 1. Components are updated from parent to child. (because parent is always - // created before the child) - // 2. A component's user watchers are run before its render watcher (because - // user watchers are created before the render watcher) - // 3. If a component is destroyed during a parent component's watcher run, - // its watchers can be skipped. - queue.sort(function (a, b) { return a.id - b.id; }); +var hooksToMerge = Object.keys(componentVNodeHooks); - // do not cache length because more watchers might be pushed - // as we run existing watchers - for (index = 0; index < queue.length; index++) { - watcher = queue[index]; - if (watcher.before) { - watcher.before(); +function createComponent ( + Ctor, + data, + context, + children, + tag +) { + if (isUndef(Ctor)) { + return + } + + var baseCtor = context.$options._base; + + // plain options object: turn it into a constructor + if (isObject(Ctor)) { + Ctor = baseCtor.extend(Ctor); + } + + // if at this stage it's not a constructor or an async component factory, + // reject. + if (typeof Ctor !== 'function') { + { + warn(("Invalid Component definition: " + (String(Ctor))), context); } - id = watcher.id; - has[id] = null; - watcher.run(); - // in dev build, check and stop circular updates. - if (has[id] != null) { - circular[id] = (circular[id] || 0) + 1; - if (circular[id] > MAX_UPDATE_COUNT) { - warn( - 'You may have an infinite update loop ' + ( - watcher.user - ? ("in watcher with expression \"" + (watcher.expression) + "\"") - : "in a component render function." - ), - watcher.vm - ); - break - } + return + } + + // async component + var asyncFactory; + if (isUndef(Ctor.cid)) { + asyncFactory = Ctor; + Ctor = resolveAsyncComponent(asyncFactory, baseCtor); + if (Ctor === undefined) { + // return a placeholder node for async component, which is rendered + // as a comment node but preserves all the raw information for the node. + // the information will be used for async server-rendering and hydration. + return createAsyncPlaceholder( + asyncFactory, + data, + context, + children, + tag + ) } } - // keep copies of post queues before resetting state - var activatedQueue = activatedChildren.slice(); - var updatedQueue = queue.slice(); + data = data || {}; - resetSchedulerState(); + // resolve constructor options in case global mixins are applied after + // component constructor creation + resolveConstructorOptions(Ctor); - // call component updated and activated hooks - callActivatedHooks(activatedQueue); - callUpdatedHooks(updatedQueue); + // transform component v-model data into props & events + if (isDef(data.model)) { + transformModel(Ctor.options, data); + } - // devtool hook - /* istanbul ignore if */ - if (devtools && config.devtools) { - devtools.emit('flush'); + // extract props + var propsData = extractPropsFromVNodeData(data, Ctor, tag); + + // functional component + if (isTrue(Ctor.options.functional)) { + return createFunctionalComponent(Ctor, propsData, data, context, children) } -} -function callUpdatedHooks (queue) { - var i = queue.length; - while (i--) { - var watcher = queue[i]; - var vm = watcher.vm; - if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'updated'); + // extract listeners, since these needs to be treated as + // child component listeners instead of DOM listeners + var listeners = data.on; + // replace with listeners with .native modifier + // so it gets processed during parent component patch. + data.on = data.nativeOn; + + if (isTrue(Ctor.options.abstract)) { + // abstract components do not keep anything + // other than props & listeners & slot + + // work around flow + var slot = data.slot; + data = {}; + if (slot) { + data.slot = slot; } } -} -/** - * Queue a kept-alive component that was activated during patch. - * The queue will be processed after the entire tree has been patched. - */ -function queueActivatedComponent (vm) { - // setting _inactive to false here so that a render function can - // rely on checking whether it's in an inactive tree (e.g. router-view) - vm._inactive = false; - activatedChildren.push(vm); + // install component management hooks onto the placeholder node + installComponentHooks(data); + + // return a placeholder vnode + var name = Ctor.options.name || tag; + var vnode = new VNode( + ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), + data, undefined, undefined, undefined, context, + { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, + asyncFactory + ); + + return vnode } -function callActivatedHooks (queue) { - for (var i = 0; i < queue.length; i++) { - queue[i]._inactive = true; - activateChildComponent(queue[i], true /* true */); +function createComponentInstanceForVnode ( + vnode, // we know it's MountedComponentVNode but flow doesn't + parent // activeInstance in lifecycle state +) { + var options = { + _isComponent: true, + _parentVnode: vnode, + parent: parent + }; + // check inline-template render functions + var inlineTemplate = vnode.data.inlineTemplate; + if (isDef(inlineTemplate)) { + options.render = inlineTemplate.render; + options.staticRenderFns = inlineTemplate.staticRenderFns; } + return new vnode.componentOptions.Ctor(options) } -/** - * Push a watcher into the watcher queue. - * Jobs with duplicate IDs will be skipped unless it's - * pushed when the queue is being flushed. - */ -function queueWatcher (watcher) { - var id = watcher.id; - if (has[id] == null) { - has[id] = true; - if (!flushing) { - queue.push(watcher); - } else { - // if already flushing, splice the watcher based on its id - // if already past its id, it will be run next immediately. - var i = queue.length - 1; - while (i > index && queue[i].id > watcher.id) { - i--; - } - queue.splice(i + 1, 0, watcher); +function installComponentHooks (data) { + var hooks = data.hook || (data.hook = {}); + for (var i = 0; i < hooksToMerge.length; i++) { + var key = hooksToMerge[i]; + var existing = hooks[key]; + var toMerge = componentVNodeHooks[key]; + if (existing !== toMerge && !(existing && existing._merged)) { + hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; } - // queue the flush - if (!waiting) { - waiting = true; + } +} - if (!config.async) { - flushSchedulerQueue(); - return - } - nextTick(flushSchedulerQueue); +function mergeHook$1 (f1, f2) { + var merged = function (a, b) { + // flow complains about extra args which is why we use any + f1(a, b); + f2(a, b); + }; + merged._merged = true; + return merged +} + +// transform component v-model info (value and callback) into +// prop and event handler respectively. +function transformModel (options, data) { + var prop = (options.model && options.model.prop) || 'value'; + var event = (options.model && options.model.event) || 'input' + ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; + var on = data.on || (data.on = {}); + var existing = on[event]; + var callback = data.model.callback; + if (isDef(existing)) { + if ( + Array.isArray(existing) + ? existing.indexOf(callback) === -1 + : existing !== callback + ) { + on[event] = [callback].concat(existing); } + } else { + on[event] = callback; } } /* */ +var SIMPLE_NORMALIZE = 1; +var ALWAYS_NORMALIZE = 2; +// wrapper function for providing a more flexible interface +// without getting yelled at by flow +function createElement ( + context, + tag, + data, + children, + normalizationType, + alwaysNormalize +) { + if (Array.isArray(data) || isPrimitive(data)) { + normalizationType = children; + children = data; + data = undefined; + } + if (isTrue(alwaysNormalize)) { + normalizationType = ALWAYS_NORMALIZE; + } + return _createElement(context, tag, data, children, normalizationType) +} -var uid$1 = 0; - -/** - * A watcher parses an expression, collects dependencies, - * and fires callback when the expression value changes. - * This is used for both the $watch() api and directives. - */ -var Watcher = function Watcher ( - vm, - expOrFn, - cb, - options, - isRenderWatcher +function _createElement ( + context, + tag, + data, + children, + normalizationType ) { - this.vm = vm; - if (isRenderWatcher) { - vm._watcher = this; + if (isDef(data) && isDef((data).__ob__)) { + warn( + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + + 'Always create fresh vnode data objects in each render!', + context + ); + return createEmptyVNode() } - vm._watchers.push(this); - // options - if (options) { - this.deep = !!options.deep; - this.user = !!options.user; - this.lazy = !!options.lazy; - this.sync = !!options.sync; - this.before = options.before; - } else { - this.deep = this.user = this.lazy = this.sync = false; + // object syntax in v-bind + if (isDef(data) && isDef(data.is)) { + tag = data.is; } - this.cb = cb; - this.id = ++uid$1; // uid for batching - this.active = true; - this.dirty = this.lazy; // for lazy watchers - this.deps = []; - this.newDeps = []; - this.depIds = new _Set(); - this.newDepIds = new _Set(); - this.expression = expOrFn.toString(); - // parse expression for getter - if (typeof expOrFn === 'function') { - this.getter = expOrFn; - } else { - this.getter = parsePath(expOrFn); - if (!this.getter) { - this.getter = noop; + if (!tag) { + // in case of component :is set to falsy value + return createEmptyVNode() + } + // warn against non-primitive key + if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) + ) { + { warn( - "Failed watching path: \"" + expOrFn + "\" " + - 'Watcher only accepts simple dot-delimited paths. ' + - 'For full control, use a function instead.', - vm + 'Avoid using non-primitive value as key, ' + + 'use string/number value instead.', + context ); } } - this.value = this.lazy - ? undefined - : this.get(); -}; - -/** - * Evaluate the getter, and re-collect dependencies. - */ -Watcher.prototype.get = function get () { - pushTarget(this); - var value; - var vm = this.vm; - try { - value = this.getter.call(vm, vm); - } catch (e) { - if (this.user) { - handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); + // support single function children as default scoped slot + if (Array.isArray(children) && + typeof children[0] === 'function' + ) { + data = data || {}; + data.scopedSlots = { default: children[0] }; + children.length = 0; + } + if (normalizationType === ALWAYS_NORMALIZE) { + children = normalizeChildren(children); + } else if (normalizationType === SIMPLE_NORMALIZE) { + children = simpleNormalizeChildren(children); + } + var vnode, ns; + if (typeof tag === 'string') { + var Ctor; + ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); + if (config.isReservedTag(tag)) { + // platform built-in elements + vnode = new VNode( + config.parsePlatformTagName(tag), data, children, + undefined, undefined, context + ); + } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { + // component + vnode = createComponent(Ctor, data, context, children, tag); } else { - throw e - } - } finally { - // "touch" every property so they are all tracked as - // dependencies for deep watching - if (this.deep) { - traverse(value); + // unknown or unlisted namespaced elements + // check at runtime because it may get assigned a namespace when its + // parent normalizes children + vnode = new VNode( + tag, data, children, + undefined, undefined, context + ); } - popTarget(); - this.cleanupDeps(); + } else { + // direct component options / constructor + vnode = createComponent(tag, data, context, children); } - return value -}; + if (Array.isArray(vnode)) { + return vnode + } else if (isDef(vnode)) { + if (isDef(ns)) { applyNS(vnode, ns); } + if (isDef(data)) { registerDeepBindings(data); } + return vnode + } else { + return createEmptyVNode() + } +} -/** - * Add a dependency to this directive. - */ -Watcher.prototype.addDep = function addDep (dep) { - var id = dep.id; - if (!this.newDepIds.has(id)) { - this.newDepIds.add(id); - this.newDeps.push(dep); - if (!this.depIds.has(id)) { - dep.addSub(this); +function applyNS (vnode, ns, force) { + vnode.ns = ns; + if (vnode.tag === 'foreignObject') { + // use default namespace inside foreignObject + ns = undefined; + force = true; + } + if (isDef(vnode.children)) { + for (var i = 0, l = vnode.children.length; i < l; i++) { + var child = vnode.children[i]; + if (isDef(child.tag) && ( + isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { + applyNS(child, ns, force); + } } } -}; +} -/** - * Clean up for dependency collection. - */ -Watcher.prototype.cleanupDeps = function cleanupDeps () { - var i = this.deps.length; - while (i--) { - var dep = this.deps[i]; - if (!this.newDepIds.has(dep.id)) { - dep.removeSub(this); - } +// ref #5318 +// necessary to ensure parent re-render when deep bindings like :style and +// :class are used on slot nodes +function registerDeepBindings (data) { + if (isObject(data.style)) { + traverse(data.style); } - var tmp = this.depIds; - this.depIds = this.newDepIds; - this.newDepIds = tmp; - this.newDepIds.clear(); - tmp = this.deps; - this.deps = this.newDeps; - this.newDeps = tmp; - this.newDeps.length = 0; -}; + if (isObject(data.class)) { + traverse(data.class); + } +} + +/* */ + +function initRender (vm) { + vm._vnode = null; // the root of the child tree + vm._staticTrees = null; // v-once cached trees + var options = vm.$options; + var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree + var renderContext = parentVnode && parentVnode.context; + vm.$slots = resolveSlots(options._renderChildren, renderContext); + vm.$scopedSlots = emptyObject; + // bind the createElement fn to this instance + // so that we get proper render context inside it. + // args order: tag, data, children, normalizationType, alwaysNormalize + // internal version is used by render functions compiled from templates + vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; + // normalization is always applied for the public version, used in + // user-written render functions. + vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; + + // $attrs & $listeners are exposed for easier HOC creation. + // they need to be reactive so that HOCs using them are always updated + var parentData = parentVnode && parentVnode.data; -/** - * Subscriber interface. - * Will be called when a dependency changes. - */ -Watcher.prototype.update = function update () { /* istanbul ignore else */ - if (this.lazy) { - this.dirty = true; - } else if (this.sync) { - this.run(); - } else { - queueWatcher(this); + { + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { + !isUpdatingChildComponent && warn("$attrs is readonly.", vm); + }, true); + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { + !isUpdatingChildComponent && warn("$listeners is readonly.", vm); + }, true); } -}; +} -/** - * Scheduler job interface. - * Will be called by the scheduler. - */ -Watcher.prototype.run = function run () { - if (this.active) { - var value = this.get(); - if ( - value !== this.value || - // Deep watchers and watchers on Object/Arrays should fire even - // when the value is the same, because the value may - // have mutated. - isObject(value) || - this.deep - ) { - // set new value - var oldValue = this.value; - this.value = value; - if (this.user) { - try { - this.cb.call(this.vm, value, oldValue); - } catch (e) { - handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); - } - } else { - this.cb.call(this.vm, value, oldValue); - } - } - } -}; +var currentRenderingInstance = null; -/** - * Evaluate the value of the watcher. - * This only gets called for lazy watchers. - */ -Watcher.prototype.evaluate = function evaluate () { - this.value = this.get(); - this.dirty = false; -}; +function renderMixin (Vue) { + // install runtime convenience helpers + installRenderHelpers(Vue.prototype); -/** - * Depend on all deps collected by this watcher. - */ -Watcher.prototype.depend = function depend () { - var i = this.deps.length; - while (i--) { - this.deps[i].depend(); - } -}; + Vue.prototype.$nextTick = function (fn) { + return nextTick(fn, this) + }; -/** - * Remove self from all dependencies' subscriber list. - */ -Watcher.prototype.teardown = function teardown () { - if (this.active) { - // remove self from vm's watcher list - // this is a somewhat expensive operation so we skip it - // if the vm is being destroyed. - if (!this.vm._isBeingDestroyed) { - remove(this.vm._watchers, this); + Vue.prototype._render = function () { + var vm = this; + var ref = vm.$options; + var render = ref.render; + var _parentVnode = ref._parentVnode; + + if (_parentVnode) { + vm.$scopedSlots = normalizeScopedSlots( + _parentVnode.data.scopedSlots, + vm.$slots + ); } - var i = this.deps.length; - while (i--) { - this.deps[i].removeSub(this); + + // set parent vnode. this allows render functions to have access + // to the data on the placeholder node. + vm.$vnode = _parentVnode; + // render self + var vnode; + try { + // There's no need to maintain a stack becaues all render fns are called + // separately from one another. Nested component's render fns are called + // when parent component is patched. + currentRenderingInstance = vm; + vnode = render.call(vm._renderProxy, vm.$createElement); + } catch (e) { + handleError(e, vm, "render"); + // return error render result, + // or previous vnode to prevent render error causing blank component + /* istanbul ignore else */ + if (vm.$options.renderError) { + try { + vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); + } catch (e) { + handleError(e, vm, "renderError"); + vnode = vm._vnode; + } + } else { + vnode = vm._vnode; + } + } finally { + currentRenderingInstance = null; } - this.active = false; - } -}; + // if the returned array contains only a single node, allow it + if (Array.isArray(vnode) && vnode.length === 1) { + vnode = vnode[0]; + } + // return empty vnode in case the render function errored out + if (!(vnode instanceof VNode)) { + if (Array.isArray(vnode)) { + warn( + 'Multiple root nodes returned from render function. Render function ' + + 'should return a single root node.', + vm + ); + } + vnode = createEmptyVNode(); + } + // set parent + vnode.parent = _parentVnode; + return vnode + }; +} /* */ -var sharedPropertyDefinition = { - enumerable: true, - configurable: true, - get: noop, - set: noop -}; +function ensureCtor (comp, base) { + if ( + comp.__esModule || + (hasSymbol && comp[Symbol.toStringTag] === 'Module') + ) { + comp = comp.default; + } + return isObject(comp) + ? base.extend(comp) + : comp +} -function proxy (target, sourceKey, key) { - sharedPropertyDefinition.get = function proxyGetter () { - return this[sourceKey][key] - }; - sharedPropertyDefinition.set = function proxySetter (val) { - this[sourceKey][key] = val; - }; - Object.defineProperty(target, key, sharedPropertyDefinition); +function createAsyncPlaceholder ( + factory, + data, + context, + children, + tag +) { + var node = createEmptyVNode(); + node.asyncFactory = factory; + node.asyncMeta = { data: data, context: context, children: children, tag: tag }; + return node } -function initState (vm) { - vm._watchers = []; - var opts = vm.$options; - if (opts.props) { initProps(vm, opts.props); } - if (opts.methods) { initMethods(vm, opts.methods); } - if (opts.data) { - initData(vm); - } else { - observe(vm._data = {}, true /* asRootData */); +function resolveAsyncComponent ( + factory, + baseCtor +) { + if (isTrue(factory.error) && isDef(factory.errorComp)) { + return factory.errorComp } - if (opts.computed) { initComputed(vm, opts.computed); } - if (opts.watch && opts.watch !== nativeWatch) { - initWatch(vm, opts.watch); + + if (isDef(factory.resolved)) { + return factory.resolved } -} -function initProps (vm, propsOptions) { - var propsData = vm.$options.propsData || {}; - var props = vm._props = {}; - // cache prop keys so that future props updates can iterate using Array - // instead of dynamic object key enumeration. - var keys = vm.$options._propKeys = []; - var isRoot = !vm.$parent; - // root instance props should be converted - if (!isRoot) { - toggleObserving(false); + if (isTrue(factory.loading) && isDef(factory.loadingComp)) { + return factory.loadingComp } - var loop = function ( key ) { - keys.push(key); - var value = validateProp(key, propsOptions, propsData, vm); - /* istanbul ignore else */ - { - var hyphenatedKey = hyphenate(key); - if (isReservedAttribute(hyphenatedKey) || - config.isReservedAttr(hyphenatedKey)) { - warn( - ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), - vm - ); + + var owner = currentRenderingInstance; + if (isDef(factory.owners)) { + // already pending + factory.owners.push(owner); + } else { + var owners = factory.owners = [owner]; + var sync = true; + + var forceRender = function (renderCompleted) { + for (var i = 0, l = owners.length; i < l; i++) { + (owners[i]).$forceUpdate(); } - defineReactive$$1(props, key, value, function () { - if (!isRoot && !isUpdatingChildComponent) { - warn( - "Avoid mutating a prop directly since the value will be " + - "overwritten whenever the parent component re-renders. " + - "Instead, use a data or computed property based on the prop's " + - "value. Prop being mutated: \"" + key + "\"", - vm - ); - } - }); - } - // static props are already proxied on the component's prototype - // during Vue.extend(). We only need to proxy props defined at - // instantiation here. - if (!(key in vm)) { - proxy(vm, "_props", key); - } - }; - for (var key in propsOptions) loop( key ); - toggleObserving(true); -} + if (renderCompleted) { + owners.length = 0; + } + }; -function initData (vm) { - var data = vm.$options.data; - data = vm._data = typeof data === 'function' - ? getData(data, vm) - : data || {}; - if (!isPlainObject(data)) { - data = {}; - warn( - 'data functions should return an object:\n' + - 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', - vm - ); - } - // proxy data on instance - var keys = Object.keys(data); - var props = vm.$options.props; - var methods = vm.$options.methods; - var i = keys.length; - while (i--) { - var key = keys[i]; - { - if (methods && hasOwn(methods, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a data property."), - vm - ); + var resolve = once(function (res) { + // cache resolved + factory.resolved = ensureCtor(res, baseCtor); + // invoke callbacks only if this is not a synchronous resolve + // (async resolves are shimmed as synchronous during SSR) + if (!sync) { + forceRender(true); + } else { + owners.length = 0; } - } - if (props && hasOwn(props, key)) { + }); + + var reject = once(function (reason) { warn( - "The data property \"" + key + "\" is already declared as a prop. " + - "Use prop default value instead.", - vm + "Failed to resolve async component: " + (String(factory)) + + (reason ? ("\nReason: " + reason) : '') ); - } else if (!isReserved(key)) { - proxy(vm, "_data", key); - } - } - // observe data - observe(data, true /* asRootData */); -} + if (isDef(factory.errorComp)) { + factory.error = true; + forceRender(true); + } + }); + + var res = factory(resolve, reject); + + if (isObject(res)) { + if (isPromise(res)) { + // () => Promise + if (isUndef(factory.resolved)) { + res.then(resolve, reject); + } + } else if (isPromise(res.component)) { + res.component.then(resolve, reject); + + if (isDef(res.error)) { + factory.errorComp = ensureCtor(res.error, baseCtor); + } + + if (isDef(res.loading)) { + factory.loadingComp = ensureCtor(res.loading, baseCtor); + if (res.delay === 0) { + factory.loading = true; + } else { + setTimeout(function () { + if (isUndef(factory.resolved) && isUndef(factory.error)) { + factory.loading = true; + forceRender(false); + } + }, res.delay || 200); + } + } + + if (isDef(res.timeout)) { + setTimeout(function () { + if (isUndef(factory.resolved)) { + reject( + "timeout (" + (res.timeout) + "ms)" + ); + } + }, res.timeout); + } + } + } -function getData (data, vm) { - // #7573 disable dep collection when invoking data getters - pushTarget(); - try { - return data.call(vm, vm) - } catch (e) { - handleError(e, vm, "data()"); - return {} - } finally { - popTarget(); + sync = false; + // return in case resolved synchronously + return factory.loading + ? factory.loadingComp + : factory.resolved } } -var computedWatcherOptions = { lazy: true }; - -function initComputed (vm, computed) { - // $flow-disable-line - var watchers = vm._computedWatchers = Object.create(null); - // computed properties are just getters during SSR - var isSSR = isServerRendering(); +/* */ - for (var key in computed) { - var userDef = computed[key]; - var getter = typeof userDef === 'function' ? userDef : userDef.get; - if (getter == null) { - warn( - ("Getter is missing for computed property \"" + key + "\"."), - vm - ); - } +function isAsyncPlaceholder (node) { + return node.isComment && node.asyncFactory +} - if (!isSSR) { - // create internal watcher for the computed property. - watchers[key] = new Watcher( - vm, - getter || noop, - noop, - computedWatcherOptions - ); - } +/* */ - // component-defined computed properties are already defined on the - // component prototype. We only need to define computed properties defined - // at instantiation here. - if (!(key in vm)) { - defineComputed(vm, key, userDef); - } else { - if (key in vm.$data) { - warn(("The computed property \"" + key + "\" is already defined in data."), vm); - } else if (vm.$options.props && key in vm.$options.props) { - warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); +function getFirstComponentChild (children) { + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + var c = children[i]; + if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { + return c } } } } -function defineComputed ( - target, - key, - userDef -) { - var shouldCache = !isServerRendering(); - if (typeof userDef === 'function') { - sharedPropertyDefinition.get = shouldCache - ? createComputedGetter(key) - : createGetterInvoker(userDef); - sharedPropertyDefinition.set = noop; - } else { - sharedPropertyDefinition.get = userDef.get - ? shouldCache && userDef.cache !== false - ? createComputedGetter(key) - : createGetterInvoker(userDef.get) - : noop; - sharedPropertyDefinition.set = userDef.set || noop; - } - if (sharedPropertyDefinition.set === noop) { - sharedPropertyDefinition.set = function () { - warn( - ("Computed property \"" + key + "\" was assigned to but it has no setter."), - this - ); - }; - } - Object.defineProperty(target, key, sharedPropertyDefinition); -} +/* */ -function createComputedGetter (key) { - return function computedGetter () { - var watcher = this._computedWatchers && this._computedWatchers[key]; - if (watcher) { - if (watcher.dirty) { - watcher.evaluate(); - } - if (Dep.target) { - watcher.depend(); - } - return watcher.value - } +/* */ + +function initEvents (vm) { + vm._events = Object.create(null); + vm._hasHookEvent = false; + // init parent attached events + var listeners = vm.$options._parentListeners; + if (listeners) { + updateComponentListeners(vm, listeners); } } -function createGetterInvoker(fn) { - return function computedGetter () { - return fn.call(this, this) - } +var target; + +function add (event, fn) { + target.$on(event, fn); } -function initMethods (vm, methods) { - var props = vm.$options.props; - for (var key in methods) { - { - if (typeof methods[key] !== 'function') { - warn( - "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + - "Did you reference the function correctly?", - vm - ); - } - if (props && hasOwn(props, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a prop."), - vm - ); - } - if ((key in vm) && isReserved(key)) { - warn( - "Method \"" + key + "\" conflicts with an existing Vue instance method. " + - "Avoid defining component methods that start with _ or $." - ); - } - } - vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); - } +function remove$1 (event, fn) { + target.$off(event, fn); } -function initWatch (vm, watch) { - for (var key in watch) { - var handler = watch[key]; - if (Array.isArray(handler)) { - for (var i = 0; i < handler.length; i++) { - createWatcher(vm, key, handler[i]); - } - } else { - createWatcher(vm, key, handler); +function createOnceHandler (event, fn) { + var _target = target; + return function onceHandler () { + var res = fn.apply(null, arguments); + if (res !== null) { + _target.$off(event, onceHandler); } } } -function createWatcher ( +function updateComponentListeners ( vm, - expOrFn, - handler, - options + listeners, + oldListeners ) { - if (isPlainObject(handler)) { - options = handler; - handler = handler.handler; - } - if (typeof handler === 'string') { - handler = vm[handler]; - } - return vm.$watch(expOrFn, handler, options) + target = vm; + updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); + target = undefined; } -function stateMixin (Vue) { - // flow somehow has problems with directly declared definition object - // when using Object.defineProperty, so we have to procedurally build up - // the object here. - var dataDef = {}; - dataDef.get = function () { return this._data }; - var propsDef = {}; - propsDef.get = function () { return this._props }; - { - dataDef.set = function () { - warn( - 'Avoid replacing instance root $data. ' + - 'Use nested data properties instead.', - this - ); - }; - propsDef.set = function () { - warn("$props is readonly.", this); - }; - } - Object.defineProperty(Vue.prototype, '$data', dataDef); - Object.defineProperty(Vue.prototype, '$props', propsDef); +function eventsMixin (Vue) { + var hookRE = /^hook:/; + Vue.prototype.$on = function (event, fn) { + var vm = this; + if (Array.isArray(event)) { + for (var i = 0, l = event.length; i < l; i++) { + vm.$on(event[i], fn); + } + } else { + (vm._events[event] || (vm._events[event] = [])).push(fn); + // optimize hook:event cost by using a boolean flag marked at registration + // instead of a hash lookup + if (hookRE.test(event)) { + vm._hasHookEvent = true; + } + } + return vm + }; - Vue.prototype.$set = set; - Vue.prototype.$delete = del; + Vue.prototype.$once = function (event, fn) { + var vm = this; + function on () { + vm.$off(event, on); + fn.apply(vm, arguments); + } + on.fn = fn; + vm.$on(event, on); + return vm + }; + + Vue.prototype.$off = function (event, fn) { + var vm = this; + // all + if (!arguments.length) { + vm._events = Object.create(null); + return vm + } + // array of events + if (Array.isArray(event)) { + for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { + vm.$off(event[i$1], fn); + } + return vm + } + // specific event + var cbs = vm._events[event]; + if (!cbs) { + return vm + } + if (!fn) { + vm._events[event] = null; + return vm + } + // specific handler + var cb; + var i = cbs.length; + while (i--) { + cb = cbs[i]; + if (cb === fn || cb.fn === fn) { + cbs.splice(i, 1); + break + } + } + return vm + }; - Vue.prototype.$watch = function ( - expOrFn, - cb, - options - ) { + Vue.prototype.$emit = function (event) { var vm = this; - if (isPlainObject(cb)) { - return createWatcher(vm, expOrFn, cb, options) - } - options = options || {}; - options.user = true; - var watcher = new Watcher(vm, expOrFn, cb, options); - if (options.immediate) { - try { - cb.call(vm, watcher.value); - } catch (error) { - handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); + { + var lowerCaseEvent = event.toLowerCase(); + if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { + tip( + "Event \"" + lowerCaseEvent + "\" is emitted in component " + + (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + + "Note that HTML attributes are case-insensitive and you cannot use " + + "v-on to listen to camelCase events when using in-DOM templates. " + + "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." + ); } } - return function unwatchFn () { - watcher.teardown(); + var cbs = vm._events[event]; + if (cbs) { + cbs = cbs.length > 1 ? toArray(cbs) : cbs; + var args = toArray(arguments, 1); + var info = "event handler for \"" + event + "\""; + for (var i = 0, l = cbs.length; i < l; i++) { + invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } } + return vm }; } /* */ -function initProvide (vm) { - var provide = vm.$options.provide; - if (provide) { - vm._provided = typeof provide === 'function' - ? provide.call(vm) - : provide; - } -} +var activeInstance = null; +var isUpdatingChildComponent = false; -function initInjections (vm) { - var result = resolveInject(vm.$options.inject, vm); - if (result) { - toggleObserving(false); - Object.keys(result).forEach(function (key) { - /* istanbul ignore else */ - { - defineReactive$$1(vm, key, result[key], function () { - warn( - "Avoid mutating an injected value directly since the changes will be " + - "overwritten whenever the provided component re-renders. " + - "injection being mutated: \"" + key + "\"", - vm - ); - }); - } - }); - toggleObserving(true); +function setActiveInstance(vm) { + var prevActiveInstance = activeInstance; + activeInstance = vm; + return function () { + activeInstance = prevActiveInstance; } } -function resolveInject (inject, vm) { - if (inject) { - // inject is :any because flow is not smart enough to figure out cached - var result = Object.create(null); - var keys = hasSymbol - ? Reflect.ownKeys(inject) - : Object.keys(inject); +function initLifecycle (vm) { + var options = vm.$options; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - // #6574 in case the inject object is observed... - if (key === '__ob__') { continue } - var provideKey = inject[key].from; - var source = vm; - while (source) { - if (source._provided && hasOwn(source._provided, provideKey)) { - result[key] = source._provided[provideKey]; - break - } - source = source.$parent; - } - if (!source) { - if ('default' in inject[key]) { - var provideDefault = inject[key].default; - result[key] = typeof provideDefault === 'function' - ? provideDefault.call(vm) - : provideDefault; - } else { - warn(("Injection \"" + key + "\" not found"), vm); - } - } + // locate first non-abstract parent + var parent = options.parent; + if (parent && !options.abstract) { + while (parent.$options.abstract && parent.$parent) { + parent = parent.$parent; } - return result + parent.$children.push(vm); } -} - -/* */ -function normalizeScopedSlots ( - slots, - normalSlots -) { - var res; - if (!slots) { - res = {}; - } else if (slots._normalized) { - return slots - } else { - res = {}; - for (var key in slots) { - if (slots[key] && key[0] !== '$') { - res[key] = normalizeScopedSlot(normalSlots, key, slots[key]); - } - } - } - // expose normal slots on scopedSlots - for (var key$1 in normalSlots) { - if (!(key$1 in res)) { - res[key$1] = proxyNormalSlot(normalSlots, key$1); - } - } - res._normalized = true; - res.$stable = slots ? slots.$stable : true; - return res -} + vm.$parent = parent; + vm.$root = parent ? parent.$root : vm; -function normalizeScopedSlot(normalSlots, key, fn) { - var normalized = function (scope) { - if ( scope === void 0 ) scope = {}; + vm.$children = []; + vm.$refs = {}; - var res = fn(scope); - return res && typeof res === 'object' && !Array.isArray(res) - ? [res] // single vnode - : normalizeChildren(res) - }; - // proxy scoped slots on normal $slots - if (!hasOwn(normalSlots, key)) { - Object.defineProperty(normalSlots, key, { - get: normalized - }); - } - return normalized + vm._watcher = null; + vm._inactive = null; + vm._directInactive = false; + vm._isMounted = false; + vm._isDestroyed = false; + vm._isBeingDestroyed = false; } -function proxyNormalSlot(slots, key) { - return function () { return slots[key]; } -} +function lifecycleMixin (Vue) { + Vue.prototype._update = function (vnode, hydrating) { + var vm = this; + var prevEl = vm.$el; + var prevVnode = vm._vnode; + var restoreActiveInstance = setActiveInstance(vm); + vm._vnode = vnode; + // Vue.prototype.__patch__ is injected in entry points + // based on the rendering backend used. + if (!prevVnode) { + // initial render + vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); + } else { + // updates + vm.$el = vm.__patch__(prevVnode, vnode); + } + restoreActiveInstance(); + // update __vue__ reference + if (prevEl) { + prevEl.__vue__ = null; + } + if (vm.$el) { + vm.$el.__vue__ = vm; + } + // if parent is an HOC, update its $el as well + if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { + vm.$parent.$el = vm.$el; + } + // updated hook is called by the scheduler to ensure that children are + // updated in a parent's updated hook. + }; -/* */ + Vue.prototype.$forceUpdate = function () { + var vm = this; + if (vm._watcher) { + vm._watcher.update(); + } + }; -/** - * Runtime helper for rendering v-for lists. - */ -function renderList ( - val, - render -) { - var ret, i, l, keys, key; - if (Array.isArray(val) || typeof val === 'string') { - ret = new Array(val.length); - for (i = 0, l = val.length; i < l; i++) { - ret[i] = render(val[i], i); + Vue.prototype.$destroy = function () { + var vm = this; + if (vm._isBeingDestroyed) { + return } - } else if (typeof val === 'number') { - ret = new Array(val); - for (i = 0; i < val; i++) { - ret[i] = render(i + 1, i); + callHook(vm, 'beforeDestroy'); + vm._isBeingDestroyed = true; + // remove self from parent + var parent = vm.$parent; + if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { + remove(parent.$children, vm); + } + // teardown watchers + if (vm._watcher) { + vm._watcher.teardown(); + } + var i = vm._watchers.length; + while (i--) { + vm._watchers[i].teardown(); + } + // remove reference from data ob + // frozen object may not have observer. + if (vm._data.__ob__) { + vm._data.__ob__.vmCount--; + } + // call the last hook... + vm._isDestroyed = true; + // invoke destroy hooks on current rendered tree + vm.__patch__(vm._vnode, null); + // fire destroyed hook + callHook(vm, 'destroyed'); + // turn off all instance listeners. + vm.$off(); + // remove __vue__ reference + if (vm.$el) { + vm.$el.__vue__ = null; } - } else if (isObject(val)) { - if (hasSymbol && val[Symbol.iterator]) { - ret = []; - var iterator = val[Symbol.iterator](); - var result = iterator.next(); - while (!result.done) { - ret.push(render(result.value, ret.length)); - result = iterator.next(); - } - } else { - keys = Object.keys(val); - ret = new Array(keys.length); - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - ret[i] = render(val[key], key, i); - } + // release circular reference (#6759) + if (vm.$vnode) { + vm.$vnode.parent = null; } - } - if (!isDef(ret)) { - ret = []; - } - (ret)._isVList = true; - return ret + }; } -/* */ - -/** - * Runtime helper for rendering - */ -function renderSlot ( - name, - fallback, - props, - bindObject +function mountComponent ( + vm, + el, + hydrating ) { - var scopedSlotFn = this.$scopedSlots[name]; - var nodes; - if (scopedSlotFn) { // scoped slot - props = props || {}; - if (bindObject) { - if (!isObject(bindObject)) { + vm.$el = el; + if (!vm.$options.render) { + vm.$options.render = createEmptyVNode; + { + /* istanbul ignore if */ + if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || + vm.$options.el || el) { warn( - 'slot v-bind without argument expects an Object', - this + 'You are using the runtime-only build of Vue where the template ' + + 'compiler is not available. Either pre-compile the templates into ' + + 'render functions, or use the compiler-included build.', + vm + ); + } else { + warn( + 'Failed to mount component: template or render function not defined.', + vm ); } - props = extend(extend({}, bindObject), props); } - nodes = scopedSlotFn(props) || fallback; - } else { - nodes = this.$slots[name] || fallback; } + callHook(vm, 'beforeMount'); - var target = props && props.slot; - if (target) { - return this.$createElement('template', { slot: target }, nodes) - } else { - return nodes - } -} + var updateComponent; + /* istanbul ignore if */ + if (config.performance && mark) { + updateComponent = function () { + var name = vm._name; + var id = vm._uid; + var startTag = "vue-perf-start:" + id; + var endTag = "vue-perf-end:" + id; -/* */ + mark(startTag); + var vnode = vm._render(); + mark(endTag); + measure(("vue " + name + " render"), startTag, endTag); -/** - * Runtime helper for resolving filters - */ -function resolveFilter (id) { - return resolveAsset(this.$options, 'filters', id, true) || identity -} + mark(startTag); + vm._update(vnode, hydrating); + mark(endTag); + measure(("vue " + name + " patch"), startTag, endTag); + }; + } else { + updateComponent = function () { + vm._update(vm._render(), hydrating); + }; + } -/* */ + // we set this to vm._watcher inside the watcher's constructor + // since the watcher's initial patch may call $forceUpdate (e.g. inside child + // component's mounted hook), which relies on vm._watcher being already defined + new Watcher(vm, updateComponent, noop, { + before: function before () { + if (vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'beforeUpdate'); + } + } + }, true /* isRenderWatcher */); + hydrating = false; -function isKeyNotMatch (expect, actual) { - if (Array.isArray(expect)) { - return expect.indexOf(actual) === -1 - } else { - return expect !== actual + // manually mounted instance, call mounted on self + // mounted is called for render-created child components in its inserted hook + if (vm.$vnode == null) { + vm._isMounted = true; + callHook(vm, 'mounted'); } + return vm } -/** - * Runtime helper for checking keyCodes from config. - * exposed as Vue.prototype._k - * passing in eventKeyName as last argument separately for backwards compat - */ -function checkKeyCodes ( - eventKeyCode, - key, - builtInKeyCode, - eventKeyName, - builtInKeyName +function updateChildComponent ( + vm, + propsData, + listeners, + parentVnode, + renderChildren ) { - var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; - if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { - return isKeyNotMatch(builtInKeyName, eventKeyName) - } else if (mappedKeyCode) { - return isKeyNotMatch(mappedKeyCode, eventKeyCode) - } else if (eventKeyName) { - return hyphenate(eventKeyName) !== key + { + isUpdatingChildComponent = true; } -} -/* */ + // determine whether component has slot children + // we need to do this before overwriting $options._renderChildren. -/** - * Runtime helper for merging v-bind="object" into a VNode's data. - */ -function bindObjectProps ( - data, - tag, - value, - asProp, - isSync -) { - if (value) { - if (!isObject(value)) { - warn( - 'v-bind without argument expects an Object or Array value', - this - ); - } else { - if (Array.isArray(value)) { - value = toObject(value); - } - var hash; - var loop = function ( key ) { - if ( - key === 'class' || - key === 'style' || - isReservedAttribute(key) - ) { - hash = data; - } else { - var type = data.attrs && data.attrs.type; - hash = asProp || config.mustUseProp(tag, type, key) - ? data.domProps || (data.domProps = {}) - : data.attrs || (data.attrs = {}); - } - var camelizedKey = camelize(key); - if (!(key in hash) && !(camelizedKey in hash)) { - hash[key] = value[key]; + // check if there are dynamic scopedSlots (hand-written or compiled but with + // dynamic slot names). Static scoped slots compiled from template has the + // "$stable" marker. + var hasDynamicScopedSlot = !!( + (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || + (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) + ); - if (isSync) { - var on = data.on || (data.on = {}); - on[("update:" + camelizedKey)] = function ($event) { - value[key] = $event; - }; - } - } - }; + // Any static slot children from the parent may have changed during parent's + // update. Dynamic scoped slots may also have changed. In such cases, a forced + // update is necessary to ensure correctness. + var needsForceUpdate = !!( + renderChildren || // has new static slots + vm.$options._renderChildren || // has old static slots + hasDynamicScopedSlot + ); + + vm.$options._parentVnode = parentVnode; + vm.$vnode = parentVnode; // update vm's placeholder node without re-render + + if (vm._vnode) { // update child tree's parent + vm._vnode.parent = parentVnode; + } + vm.$options._renderChildren = renderChildren; + + // update $attrs and $listeners hash + // these are also reactive so they may trigger child update if the child + // used them during render + vm.$attrs = parentVnode.data.attrs || emptyObject; + vm.$listeners = listeners || emptyObject; + + // update props + if (propsData && vm.$options.props) { + toggleObserving(false); + var props = vm._props; + var propKeys = vm.$options._propKeys || []; + for (var i = 0; i < propKeys.length; i++) { + var key = propKeys[i]; + var propOptions = vm.$options.props; // wtf flow? + props[key] = validateProp(key, propOptions, propsData, vm); + } + toggleObserving(true); + // keep a copy of raw propsData + vm.$options.propsData = propsData; + } + + // update listeners + listeners = listeners || emptyObject; + var oldListeners = vm.$options._parentListeners; + vm.$options._parentListeners = listeners; + updateComponentListeners(vm, listeners, oldListeners); - for (var key in value) loop( key ); - } + // resolve slots + force update if has children + if (needsForceUpdate) { + vm.$slots = resolveSlots(renderChildren, parentVnode.context); + vm.$forceUpdate(); } - return data -} - -/* */ -/** - * Runtime helper for rendering static trees. - */ -function renderStatic ( - index, - isInFor -) { - var cached = this._staticTrees || (this._staticTrees = []); - var tree = cached[index]; - // if has already-rendered static tree and not inside v-for, - // we can reuse the same tree. - if (tree && !isInFor) { - return tree + { + isUpdatingChildComponent = false; } - // otherwise, render a fresh tree. - tree = cached[index] = this.$options.staticRenderFns[index].call( - this._renderProxy, - null, - this // for render fns generated for functional component templates - ); - markStatic(tree, ("__static__" + index), false); - return tree } -/** - * Runtime helper for v-once. - * Effectively it means marking the node as static with a unique key. - */ -function markOnce ( - tree, - index, - key -) { - markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); - return tree +function isInInactiveTree (vm) { + while (vm && (vm = vm.$parent)) { + if (vm._inactive) { return true } + } + return false } -function markStatic ( - tree, - key, - isOnce -) { - if (Array.isArray(tree)) { - for (var i = 0; i < tree.length; i++) { - if (tree[i] && typeof tree[i] !== 'string') { - markStaticNode(tree[i], (key + "_" + i), isOnce); - } +function activateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = false; + if (isInInactiveTree(vm)) { + return } - } else { - markStaticNode(tree, key, isOnce); + } else if (vm._directInactive) { + return } -} - -function markStaticNode (node, key, isOnce) { - node.isStatic = true; - node.key = key; - node.isOnce = isOnce; -} - -/* */ - -function bindObjectListeners (data, value) { - if (value) { - if (!isPlainObject(value)) { - warn( - 'v-on without argument expects an Object value', - this - ); - } else { - var on = data.on = data.on ? extend({}, data.on) : {}; - for (var key in value) { - var existing = on[key]; - var ours = value[key]; - on[key] = existing ? [].concat(existing, ours) : ours; - } + if (vm._inactive || vm._inactive === null) { + vm._inactive = false; + for (var i = 0; i < vm.$children.length; i++) { + activateChildComponent(vm.$children[i]); } + callHook(vm, 'activated'); } - return data } -/* */ - -function bindDynamicKeys (baseObj, values) { - for (var i = 0; i < values.length; i += 2) { - var key = values[i]; - if (typeof key === 'string' && key) { - baseObj[values[i]] = values[i + 1]; - } else if (key !== '' && key !== null) { - // null is a speical value for explicitly removing a binding - warn( - ("Invalid value for dynamic directive argument (expected string or null): " + key), - this - ); +function deactivateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = true; + if (isInInactiveTree(vm)) { + return } } - return baseObj + if (!vm._inactive) { + vm._inactive = true; + for (var i = 0; i < vm.$children.length; i++) { + deactivateChildComponent(vm.$children[i]); + } + callHook(vm, 'deactivated'); + } } -// helper to dynamically append modifier runtime markers to event names. -// ensure only append when value is already string, otherwise it will be cast -// to string and cause the type check to miss. -function prependModifier (value, symbol) { - return typeof value === 'string' ? symbol + value : value +function callHook (vm, hook) { + // #7573 disable dep collection when invoking lifecycle hooks + pushTarget(); + var handlers = vm.$options[hook]; + var info = hook + " hook"; + if (handlers) { + for (var i = 0, j = handlers.length; i < j; i++) { + invokeWithErrorHandling(handlers[i], vm, null, vm, info); + } + } + if (vm._hasHookEvent) { + vm.$emit('hook:' + hook); + } + popTarget(); } /* */ -function installRenderHelpers (target) { - target._o = markOnce; - target._n = toNumber; - target._s = toString; - target._l = renderList; - target._t = renderSlot; - target._q = looseEqual; - target._i = looseIndexOf; - target._m = renderStatic; - target._f = resolveFilter; - target._k = checkKeyCodes; - target._b = bindObjectProps; - target._v = createTextVNode; - target._e = createEmptyVNode; - target._u = resolveScopedSlots; - target._g = bindObjectListeners; - target._d = bindDynamicKeys; - target._p = prependModifier; -} +var MAX_UPDATE_COUNT = 100; -/* */ +var queue = []; +var activatedChildren = []; +var has = {}; +var circular = {}; +var waiting = false; +var flushing = false; +var index = 0; -function FunctionalRenderContext ( - data, - props, - children, - parent, - Ctor -) { - var options = Ctor.options; - // ensure the createElement function in functional components - // gets a unique context - this is necessary for correct named slot check - var contextVm; - if (hasOwn(parent, '_uid')) { - contextVm = Object.create(parent); - // $flow-disable-line - contextVm._original = parent; - } else { - // the context vm passed in is a functional context as well. - // in this case we want to make sure we are able to get a hold to the - // real context instance. - contextVm = parent; - // $flow-disable-line - parent = parent._original; +/** + * Reset the scheduler's state. + */ +function resetSchedulerState () { + index = queue.length = activatedChildren.length = 0; + has = {}; + { + circular = {}; } - var isCompiled = isTrue(options._compiled); - var needNormalization = !isCompiled; - - this.data = data; - this.props = props; - this.children = children; - this.parent = parent; - this.listeners = data.on || emptyObject; - this.injections = resolveInject(options.inject, parent); - this.slots = function () { return resolveSlots(children, parent); }; + waiting = flushing = false; +} - Object.defineProperty(this, 'scopedSlots', ({ - enumerable: true, - get: function get () { - return normalizeScopedSlots(data.scopedSlots, this.slots()) - } - })); +// Async edge case #6566 requires saving the timestamp when event listeners are +// attached. However, calling performance.now() has a perf overhead especially +// if the page has thousands of event listeners. Instead, we take a timestamp +// every time the scheduler flushes and use that for all event listeners +// attached during that flush. +var currentFlushTimestamp = 0; - // support for compiled functional template - if (isCompiled) { - // exposing $options for renderStatic() - this.$options = options; - // pre-resolve slots for renderSlot() - this.$slots = this.slots(); - this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); - } +// Async edge case fix requires storing an event listener's attach timestamp. +var getNow = Date.now; - if (options._scopeId) { - this._c = function (a, b, c, d) { - var vnode = createElement(contextVm, a, b, c, d, needNormalization); - if (vnode && !Array.isArray(vnode)) { - vnode.fnScopeId = options._scopeId; - vnode.fnContext = parent; - } - return vnode - }; - } else { - this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; - } +// Determine what event timestamp the browser is using. Annoyingly, the +// timestamp can either be hi-res (relative to page load) or low-res +// (relative to UNIX epoch), so in order to compare time we have to use the +// same timestamp type when saving the flush timestamp. +if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { + // if the low-res timestamp which is bigger than the event timestamp + // (which is evaluated AFTER) it means the event is using a hi-res timestamp, + // and we need to use the hi-res version for event listeners as well. + getNow = function () { return performance.now(); }; } -installRenderHelpers(FunctionalRenderContext.prototype); +/** + * Flush both queues and run the watchers. + */ +function flushSchedulerQueue () { + currentFlushTimestamp = getNow(); + flushing = true; + var watcher, id; -function createFunctionalComponent ( - Ctor, - propsData, - data, - contextVm, - children -) { - var options = Ctor.options; - var props = {}; - var propOptions = options.props; - if (isDef(propOptions)) { - for (var key in propOptions) { - props[key] = validateProp(key, propOptions, propsData || emptyObject); + // Sort queue before flush. + // This ensures that: + // 1. Components are updated from parent to child. (because parent is always + // created before the child) + // 2. A component's user watchers are run before its render watcher (because + // user watchers are created before the render watcher) + // 3. If a component is destroyed during a parent component's watcher run, + // its watchers can be skipped. + queue.sort(function (a, b) { return a.id - b.id; }); + + // do not cache length because more watchers might be pushed + // as we run existing watchers + for (index = 0; index < queue.length; index++) { + watcher = queue[index]; + if (watcher.before) { + watcher.before(); + } + id = watcher.id; + has[id] = null; + watcher.run(); + // in dev build, check and stop circular updates. + if (has[id] != null) { + circular[id] = (circular[id] || 0) + 1; + if (circular[id] > MAX_UPDATE_COUNT) { + warn( + 'You may have an infinite update loop ' + ( + watcher.user + ? ("in watcher with expression \"" + (watcher.expression) + "\"") + : "in a component render function." + ), + watcher.vm + ); + break + } } - } else { - if (isDef(data.attrs)) { mergeProps(props, data.attrs); } - if (isDef(data.props)) { mergeProps(props, data.props); } } - var renderContext = new FunctionalRenderContext( - data, - props, - children, - contextVm, - Ctor - ); + // keep copies of post queues before resetting state + var activatedQueue = activatedChildren.slice(); + var updatedQueue = queue.slice(); - var vnode = options.render.call(null, renderContext._c, renderContext); + resetSchedulerState(); - if (vnode instanceof VNode) { - return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) - } else if (Array.isArray(vnode)) { - var vnodes = normalizeChildren(vnode) || []; - var res = new Array(vnodes.length); - for (var i = 0; i < vnodes.length; i++) { - res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); - } - return res + // call component updated and activated hooks + callActivatedHooks(activatedQueue); + callUpdatedHooks(updatedQueue); + + // devtool hook + /* istanbul ignore if */ + if (devtools && config.devtools) { + devtools.emit('flush'); } } -function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { - // #7817 clone node before setting fnContext, otherwise if the node is reused - // (e.g. it was from a cached normal slot) the fnContext causes named slots - // that should not be matched to match. - var clone = cloneVNode(vnode); - clone.fnContext = contextVm; - clone.fnOptions = options; - { - (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; - } - if (data.slot) { - (clone.data || (clone.data = {})).slot = data.slot; +function callUpdatedHooks (queue) { + var i = queue.length; + while (i--) { + var watcher = queue[i]; + var vm = watcher.vm; + if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'updated'); + } } - return clone } -function mergeProps (to, from) { - for (var key in from) { - to[camelize(key)] = from[key]; - } +/** + * Queue a kept-alive component that was activated during patch. + * The queue will be processed after the entire tree has been patched. + */ +function queueActivatedComponent (vm) { + // setting _inactive to false here so that a render function can + // rely on checking whether it's in an inactive tree (e.g. router-view) + vm._inactive = false; + activatedChildren.push(vm); } -/* */ +function callActivatedHooks (queue) { + for (var i = 0; i < queue.length; i++) { + queue[i]._inactive = true; + activateChildComponent(queue[i], true /* true */); + } +} -/* */ +/** + * Push a watcher into the watcher queue. + * Jobs with duplicate IDs will be skipped unless it's + * pushed when the queue is being flushed. + */ +function queueWatcher (watcher) { + var id = watcher.id; + if (has[id] == null) { + has[id] = true; + if (!flushing) { + queue.push(watcher); + } else { + // if already flushing, splice the watcher based on its id + // if already past its id, it will be run next immediately. + var i = queue.length - 1; + while (i > index && queue[i].id > watcher.id) { + i--; + } + queue.splice(i + 1, 0, watcher); + } + // queue the flush + if (!waiting) { + waiting = true; -/* */ + if (!config.async) { + flushSchedulerQueue(); + return + } + nextTick(flushSchedulerQueue); + } + } +} /* */ -// inline hooks to be invoked on component VNodes during patch -var componentVNodeHooks = { - init: function init (vnode, hydrating) { - if ( - vnode.componentInstance && - !vnode.componentInstance._isDestroyed && - vnode.data.keepAlive - ) { - // kept-alive components, treat as a patch - var mountedNode = vnode; // work around flow - componentVNodeHooks.prepatch(mountedNode, mountedNode); - } else { - var child = vnode.componentInstance = createComponentInstanceForVnode( - vnode, - activeInstance - ); - child.$mount(hydrating ? vnode.elm : undefined, hydrating); - } - }, - prepatch: function prepatch (oldVnode, vnode) { - var options = vnode.componentOptions; - var child = vnode.componentInstance = oldVnode.componentInstance; - updateChildComponent( - child, - options.propsData, // updated props - options.listeners, // updated listeners - vnode, // new parent vnode - options.children // new children - ); - }, - insert: function insert (vnode) { - var context = vnode.context; - var componentInstance = vnode.componentInstance; - if (!componentInstance._isMounted) { - componentInstance._isMounted = true; - callHook(componentInstance, 'mounted'); - } - if (vnode.data.keepAlive) { - if (context._isMounted) { - // vue-router#1212 - // During updates, a kept-alive component's child components may - // change, so directly walking the tree here may call activated hooks - // on incorrect children. Instead we push them into a queue which will - // be processed after the whole patch process ended. - queueActivatedComponent(componentInstance); - } else { - activateChildComponent(componentInstance, true /* direct */); - } - } - }, +var uid$2 = 0; - destroy: function destroy (vnode) { - var componentInstance = vnode.componentInstance; - if (!componentInstance._isDestroyed) { - if (!vnode.data.keepAlive) { - componentInstance.$destroy(); - } else { - deactivateChildComponent(componentInstance, true /* direct */); - } +/** + * A watcher parses an expression, collects dependencies, + * and fires callback when the expression value changes. + * This is used for both the $watch() api and directives. + */ +var Watcher = function Watcher ( + vm, + expOrFn, + cb, + options, + isRenderWatcher +) { + this.vm = vm; + if (isRenderWatcher) { + vm._watcher = this; + } + vm._watchers.push(this); + // options + if (options) { + this.deep = !!options.deep; + this.user = !!options.user; + this.lazy = !!options.lazy; + this.sync = !!options.sync; + this.before = options.before; + } else { + this.deep = this.user = this.lazy = this.sync = false; + } + this.cb = cb; + this.id = ++uid$2; // uid for batching + this.active = true; + this.dirty = this.lazy; // for lazy watchers + this.deps = []; + this.newDeps = []; + this.depIds = new _Set(); + this.newDepIds = new _Set(); + this.expression = expOrFn.toString(); + // parse expression for getter + if (typeof expOrFn === 'function') { + this.getter = expOrFn; + } else { + this.getter = parsePath(expOrFn); + if (!this.getter) { + this.getter = noop; + warn( + "Failed watching path: \"" + expOrFn + "\" " + + 'Watcher only accepts simple dot-delimited paths. ' + + 'For full control, use a function instead.', + vm + ); } } + this.value = this.lazy + ? undefined + : this.get(); }; -var hooksToMerge = Object.keys(componentVNodeHooks); - -function createComponent ( - Ctor, - data, - context, - children, - tag -) { - if (isUndef(Ctor)) { - return - } - - var baseCtor = context.$options._base; - - // plain options object: turn it into a constructor - if (isObject(Ctor)) { - Ctor = baseCtor.extend(Ctor); - } - - // if at this stage it's not a constructor or an async component factory, - // reject. - if (typeof Ctor !== 'function') { - { - warn(("Invalid Component definition: " + (String(Ctor))), context); +/** + * Evaluate the getter, and re-collect dependencies. + */ +Watcher.prototype.get = function get () { + pushTarget(this); + var value; + var vm = this.vm; + try { + value = this.getter.call(vm, vm); + } catch (e) { + if (this.user) { + handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); + } else { + throw e } - return + } finally { + // "touch" every property so they are all tracked as + // dependencies for deep watching + if (this.deep) { + traverse(value); + } + popTarget(); + this.cleanupDeps(); } + return value +}; - // async component - var asyncFactory; - if (isUndef(Ctor.cid)) { - asyncFactory = Ctor; - Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context); - if (Ctor === undefined) { - // return a placeholder node for async component, which is rendered - // as a comment node but preserves all the raw information for the node. - // the information will be used for async server-rendering and hydration. - return createAsyncPlaceholder( - asyncFactory, - data, - context, - children, - tag - ) +/** + * Add a dependency to this directive. + */ +Watcher.prototype.addDep = function addDep (dep) { + var id = dep.id; + if (!this.newDepIds.has(id)) { + this.newDepIds.add(id); + this.newDeps.push(dep); + if (!this.depIds.has(id)) { + dep.addSub(this); } } +}; - data = data || {}; - - // resolve constructor options in case global mixins are applied after - // component constructor creation - resolveConstructorOptions(Ctor); - - // transform component v-model data into props & events - if (isDef(data.model)) { - transformModel(Ctor.options, data); +/** + * Clean up for dependency collection. + */ +Watcher.prototype.cleanupDeps = function cleanupDeps () { + var i = this.deps.length; + while (i--) { + var dep = this.deps[i]; + if (!this.newDepIds.has(dep.id)) { + dep.removeSub(this); + } } + var tmp = this.depIds; + this.depIds = this.newDepIds; + this.newDepIds = tmp; + this.newDepIds.clear(); + tmp = this.deps; + this.deps = this.newDeps; + this.newDeps = tmp; + this.newDeps.length = 0; +}; - // extract props - var propsData = extractPropsFromVNodeData(data, Ctor, tag); - - // functional component - if (isTrue(Ctor.options.functional)) { - return createFunctionalComponent(Ctor, propsData, data, context, children) +/** + * Subscriber interface. + * Will be called when a dependency changes. + */ +Watcher.prototype.update = function update () { + /* istanbul ignore else */ + if (this.lazy) { + this.dirty = true; + } else if (this.sync) { + this.run(); + } else { + queueWatcher(this); } +}; - // extract listeners, since these needs to be treated as - // child component listeners instead of DOM listeners - var listeners = data.on; - // replace with listeners with .native modifier - // so it gets processed during parent component patch. - data.on = data.nativeOn; - - if (isTrue(Ctor.options.abstract)) { - // abstract components do not keep anything - // other than props & listeners & slot - - // work around flow - var slot = data.slot; - data = {}; - if (slot) { - data.slot = slot; +/** + * Scheduler job interface. + * Will be called by the scheduler. + */ +Watcher.prototype.run = function run () { + if (this.active) { + var value = this.get(); + if ( + value !== this.value || + // Deep watchers and watchers on Object/Arrays should fire even + // when the value is the same, because the value may + // have mutated. + isObject(value) || + this.deep + ) { + // set new value + var oldValue = this.value; + this.value = value; + if (this.user) { + try { + this.cb.call(this.vm, value, oldValue); + } catch (e) { + handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); + } + } else { + this.cb.call(this.vm, value, oldValue); + } } } +}; - // install component management hooks onto the placeholder node - installComponentHooks(data); - - // return a placeholder vnode - var name = Ctor.options.name || tag; - var vnode = new VNode( - ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), - data, undefined, undefined, undefined, context, - { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, - asyncFactory - ); - - return vnode -} +/** + * Evaluate the value of the watcher. + * This only gets called for lazy watchers. + */ +Watcher.prototype.evaluate = function evaluate () { + this.value = this.get(); + this.dirty = false; +}; -function createComponentInstanceForVnode ( - vnode, // we know it's MountedComponentVNode but flow doesn't - parent // activeInstance in lifecycle state -) { - var options = { - _isComponent: true, - _parentVnode: vnode, - parent: parent - }; - // check inline-template render functions - var inlineTemplate = vnode.data.inlineTemplate; - if (isDef(inlineTemplate)) { - options.render = inlineTemplate.render; - options.staticRenderFns = inlineTemplate.staticRenderFns; +/** + * Depend on all deps collected by this watcher. + */ +Watcher.prototype.depend = function depend () { + var i = this.deps.length; + while (i--) { + this.deps[i].depend(); } - return new vnode.componentOptions.Ctor(options) -} +}; -function installComponentHooks (data) { - var hooks = data.hook || (data.hook = {}); - for (var i = 0; i < hooksToMerge.length; i++) { - var key = hooksToMerge[i]; - var existing = hooks[key]; - var toMerge = componentVNodeHooks[key]; - if (existing !== toMerge && !(existing && existing._merged)) { - hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; +/** + * Remove self from all dependencies' subscriber list. + */ +Watcher.prototype.teardown = function teardown () { + if (this.active) { + // remove self from vm's watcher list + // this is a somewhat expensive operation so we skip it + // if the vm is being destroyed. + if (!this.vm._isBeingDestroyed) { + remove(this.vm._watchers, this); + } + var i = this.deps.length; + while (i--) { + this.deps[i].removeSub(this); } + this.active = false; } -} +}; + +/* */ -function mergeHook$1 (f1, f2) { - var merged = function (a, b) { - // flow complains about extra args which is why we use any - f1(a, b); - f2(a, b); +var sharedPropertyDefinition = { + enumerable: true, + configurable: true, + get: noop, + set: noop +}; + +function proxy (target, sourceKey, key) { + sharedPropertyDefinition.get = function proxyGetter () { + return this[sourceKey][key] }; - merged._merged = true; - return merged + sharedPropertyDefinition.set = function proxySetter (val) { + this[sourceKey][key] = val; + }; + Object.defineProperty(target, key, sharedPropertyDefinition); } -// transform component v-model info (value and callback) into -// prop and event handler respectively. -function transformModel (options, data) { - var prop = (options.model && options.model.prop) || 'value'; - var event = (options.model && options.model.event) || 'input' - ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; - var on = data.on || (data.on = {}); - var existing = on[event]; - var callback = data.model.callback; - if (isDef(existing)) { - if ( - Array.isArray(existing) - ? existing.indexOf(callback) === -1 - : existing !== callback - ) { - on[event] = [callback].concat(existing); - } +function initState (vm) { + vm._watchers = []; + var opts = vm.$options; + if (opts.props) { initProps(vm, opts.props); } + if (opts.methods) { initMethods(vm, opts.methods); } + if (opts.data) { + initData(vm); } else { - on[event] = callback; + observe(vm._data = {}, true /* asRootData */); + } + if (opts.computed) { initComputed(vm, opts.computed); } + if (opts.watch && opts.watch !== nativeWatch) { + initWatch(vm, opts.watch); } } -/* */ - -var SIMPLE_NORMALIZE = 1; -var ALWAYS_NORMALIZE = 2; - -// wrapper function for providing a more flexible interface -// without getting yelled at by flow -function createElement ( - context, - tag, - data, - children, - normalizationType, - alwaysNormalize -) { - if (Array.isArray(data) || isPrimitive(data)) { - normalizationType = children; - children = data; - data = undefined; - } - if (isTrue(alwaysNormalize)) { - normalizationType = ALWAYS_NORMALIZE; +function initProps (vm, propsOptions) { + var propsData = vm.$options.propsData || {}; + var props = vm._props = {}; + // cache prop keys so that future props updates can iterate using Array + // instead of dynamic object key enumeration. + var keys = vm.$options._propKeys = []; + var isRoot = !vm.$parent; + // root instance props should be converted + if (!isRoot) { + toggleObserving(false); } - return _createElement(context, tag, data, children, normalizationType) + var loop = function ( key ) { + keys.push(key); + var value = validateProp(key, propsOptions, propsData, vm); + /* istanbul ignore else */ + { + var hyphenatedKey = hyphenate(key); + if (isReservedAttribute(hyphenatedKey) || + config.isReservedAttr(hyphenatedKey)) { + warn( + ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), + vm + ); + } + defineReactive$$1(props, key, value, function () { + if (!isRoot && !isUpdatingChildComponent) { + warn( + "Avoid mutating a prop directly since the value will be " + + "overwritten whenever the parent component re-renders. " + + "Instead, use a data or computed property based on the prop's " + + "value. Prop being mutated: \"" + key + "\"", + vm + ); + } + }); + } + // static props are already proxied on the component's prototype + // during Vue.extend(). We only need to proxy props defined at + // instantiation here. + if (!(key in vm)) { + proxy(vm, "_props", key); + } + }; + + for (var key in propsOptions) loop( key ); + toggleObserving(true); } -function _createElement ( - context, - tag, - data, - children, - normalizationType -) { - if (isDef(data) && isDef((data).__ob__)) { +function initData (vm) { + var data = vm.$options.data; + data = vm._data = typeof data === 'function' + ? getData(data, vm) + : data || {}; + if (!isPlainObject(data)) { + data = {}; warn( - "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + - 'Always create fresh vnode data objects in each render!', - context + 'data functions should return an object:\n' + + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', + vm ); - return createEmptyVNode() - } - // object syntax in v-bind - if (isDef(data) && isDef(data.is)) { - tag = data.is; - } - if (!tag) { - // in case of component :is set to falsy value - return createEmptyVNode() } - // warn against non-primitive key - if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) - ) { + // proxy data on instance + var keys = Object.keys(data); + var props = vm.$options.props; + var methods = vm.$options.methods; + var i = keys.length; + while (i--) { + var key = keys[i]; { + if (methods && hasOwn(methods, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a data property."), + vm + ); + } + } + if (props && hasOwn(props, key)) { warn( - 'Avoid using non-primitive value as key, ' + - 'use string/number value instead.', - context + "The data property \"" + key + "\" is already declared as a prop. " + + "Use prop default value instead.", + vm ); + } else if (!isReserved(key)) { + proxy(vm, "_data", key); } } - // support single function children as default scoped slot - if (Array.isArray(children) && - typeof children[0] === 'function' - ) { - data = data || {}; - data.scopedSlots = { default: children[0] }; - children.length = 0; - } - if (normalizationType === ALWAYS_NORMALIZE) { - children = normalizeChildren(children); - } else if (normalizationType === SIMPLE_NORMALIZE) { - children = simpleNormalizeChildren(children); + // observe data + observe(data, true /* asRootData */); +} + +function getData (data, vm) { + // #7573 disable dep collection when invoking data getters + pushTarget(); + try { + return data.call(vm, vm) + } catch (e) { + handleError(e, vm, "data()"); + return {} + } finally { + popTarget(); } - var vnode, ns; - if (typeof tag === 'string') { - var Ctor; - ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); - if (config.isReservedTag(tag)) { - // platform built-in elements - vnode = new VNode( - config.parsePlatformTagName(tag), data, children, - undefined, undefined, context +} + +var computedWatcherOptions = { lazy: true }; + +function initComputed (vm, computed) { + // $flow-disable-line + var watchers = vm._computedWatchers = Object.create(null); + // computed properties are just getters during SSR + var isSSR = isServerRendering(); + + for (var key in computed) { + var userDef = computed[key]; + var getter = typeof userDef === 'function' ? userDef : userDef.get; + if (getter == null) { + warn( + ("Getter is missing for computed property \"" + key + "\"."), + vm ); - } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { - // component - vnode = createComponent(Ctor, data, context, children, tag); - } else { - // unknown or unlisted namespaced elements - // check at runtime because it may get assigned a namespace when its - // parent normalizes children - vnode = new VNode( - tag, data, children, - undefined, undefined, context + } + + if (!isSSR) { + // create internal watcher for the computed property. + watchers[key] = new Watcher( + vm, + getter || noop, + noop, + computedWatcherOptions ); } - } else { - // direct component options / constructor - vnode = createComponent(tag, data, context, children); + + // component-defined computed properties are already defined on the + // component prototype. We only need to define computed properties defined + // at instantiation here. + if (!(key in vm)) { + defineComputed(vm, key, userDef); + } else { + if (key in vm.$data) { + warn(("The computed property \"" + key + "\" is already defined in data."), vm); + } else if (vm.$options.props && key in vm.$options.props) { + warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); + } + } } - if (Array.isArray(vnode)) { - return vnode - } else if (isDef(vnode)) { - if (isDef(ns)) { applyNS(vnode, ns); } - if (isDef(data)) { registerDeepBindings(data); } - return vnode +} + +function defineComputed ( + target, + key, + userDef +) { + var shouldCache = !isServerRendering(); + if (typeof userDef === 'function') { + sharedPropertyDefinition.get = shouldCache + ? createComputedGetter(key) + : createGetterInvoker(userDef); + sharedPropertyDefinition.set = noop; } else { - return createEmptyVNode() + sharedPropertyDefinition.get = userDef.get + ? shouldCache && userDef.cache !== false + ? createComputedGetter(key) + : createGetterInvoker(userDef.get) + : noop; + sharedPropertyDefinition.set = userDef.set || noop; } + if (sharedPropertyDefinition.set === noop) { + sharedPropertyDefinition.set = function () { + warn( + ("Computed property \"" + key + "\" was assigned to but it has no setter."), + this + ); + }; + } + Object.defineProperty(target, key, sharedPropertyDefinition); } -function applyNS (vnode, ns, force) { - vnode.ns = ns; - if (vnode.tag === 'foreignObject') { - // use default namespace inside foreignObject - ns = undefined; - force = true; - } - if (isDef(vnode.children)) { - for (var i = 0, l = vnode.children.length; i < l; i++) { - var child = vnode.children[i]; - if (isDef(child.tag) && ( - isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { - applyNS(child, ns, force); +function createComputedGetter (key) { + return function computedGetter () { + var watcher = this._computedWatchers && this._computedWatchers[key]; + if (watcher) { + if (watcher.dirty) { + watcher.evaluate(); } + if (Dep.target) { + watcher.depend(); + } + return watcher.value } } } -// ref #5318 -// necessary to ensure parent re-render when deep bindings like :style and -// :class are used on slot nodes -function registerDeepBindings (data) { - if (isObject(data.style)) { - traverse(data.style); - } - if (isObject(data.class)) { - traverse(data.class); +function createGetterInvoker(fn) { + return function computedGetter () { + return fn.call(this, this) } } -/* */ - -function initRender (vm) { - vm._vnode = null; // the root of the child tree - vm._staticTrees = null; // v-once cached trees - var options = vm.$options; - var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree - var renderContext = parentVnode && parentVnode.context; - vm.$slots = resolveSlots(options._renderChildren, renderContext); - vm.$scopedSlots = emptyObject; - // bind the createElement fn to this instance - // so that we get proper render context inside it. - // args order: tag, data, children, normalizationType, alwaysNormalize - // internal version is used by render functions compiled from templates - vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; - // normalization is always applied for the public version, used in - // user-written render functions. - vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; +function initMethods (vm, methods) { + var props = vm.$options.props; + for (var key in methods) { + { + if (typeof methods[key] !== 'function') { + warn( + "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + + "Did you reference the function correctly?", + vm + ); + } + if (props && hasOwn(props, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a prop."), + vm + ); + } + if ((key in vm) && isReserved(key)) { + warn( + "Method \"" + key + "\" conflicts with an existing Vue instance method. " + + "Avoid defining component methods that start with _ or $." + ); + } + } + vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); + } +} - // $attrs & $listeners are exposed for easier HOC creation. - // they need to be reactive so that HOCs using them are always updated - var parentData = parentVnode && parentVnode.data; +function initWatch (vm, watch) { + for (var key in watch) { + var handler = watch[key]; + if (Array.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + createWatcher(vm, key, handler[i]); + } + } else { + createWatcher(vm, key, handler); + } + } +} - /* istanbul ignore else */ - { - defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { - !isUpdatingChildComponent && warn("$attrs is readonly.", vm); - }, true); - defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { - !isUpdatingChildComponent && warn("$listeners is readonly.", vm); - }, true); +function createWatcher ( + vm, + expOrFn, + handler, + options +) { + if (isPlainObject(handler)) { + options = handler; + handler = handler.handler; + } + if (typeof handler === 'string') { + handler = vm[handler]; } + return vm.$watch(expOrFn, handler, options) } -function renderMixin (Vue) { - // install runtime convenience helpers - installRenderHelpers(Vue.prototype); +function stateMixin (Vue) { + // flow somehow has problems with directly declared definition object + // when using Object.defineProperty, so we have to procedurally build up + // the object here. + var dataDef = {}; + dataDef.get = function () { return this._data }; + var propsDef = {}; + propsDef.get = function () { return this._props }; + { + dataDef.set = function () { + warn( + 'Avoid replacing instance root $data. ' + + 'Use nested data properties instead.', + this + ); + }; + propsDef.set = function () { + warn("$props is readonly.", this); + }; + } + Object.defineProperty(Vue.prototype, '$data', dataDef); + Object.defineProperty(Vue.prototype, '$props', propsDef); - Vue.prototype.$nextTick = function (fn) { - return nextTick(fn, this) - }; + Vue.prototype.$set = set; + Vue.prototype.$delete = del; - Vue.prototype._render = function () { + Vue.prototype.$watch = function ( + expOrFn, + cb, + options + ) { var vm = this; - var ref = vm.$options; - var render = ref.render; - var _parentVnode = ref._parentVnode; - - if (_parentVnode) { - vm.$scopedSlots = normalizeScopedSlots( - _parentVnode.data.scopedSlots, - vm.$slots - ); + if (isPlainObject(cb)) { + return createWatcher(vm, expOrFn, cb, options) } - - // set parent vnode. this allows render functions to have access - // to the data on the placeholder node. - vm.$vnode = _parentVnode; - // render self - var vnode; - try { - vnode = render.call(vm._renderProxy, vm.$createElement); - } catch (e) { - handleError(e, vm, "render"); - // return error render result, - // or previous vnode to prevent render error causing blank component - /* istanbul ignore else */ - if (vm.$options.renderError) { - try { - vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); - } catch (e) { - handleError(e, vm, "renderError"); - vnode = vm._vnode; - } - } else { - vnode = vm._vnode; + options = options || {}; + options.user = true; + var watcher = new Watcher(vm, expOrFn, cb, options); + if (options.immediate) { + try { + cb.call(vm, watcher.value); + } catch (error) { + handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); } } - // if the returned array contains only a single node, allow it - if (Array.isArray(vnode) && vnode.length === 1) { - vnode = vnode[0]; - } - // return empty vnode in case the render function errored out - if (!(vnode instanceof VNode)) { - if (Array.isArray(vnode)) { - warn( - 'Multiple root nodes returned from render function. Render function ' + - 'should return a single root node.', - vm - ); - } - vnode = createEmptyVNode(); + return function unwatchFn () { + watcher.teardown(); } - // set parent - vnode.parent = _parentVnode; - return vnode }; } @@ -5319,7 +5322,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', { value: FunctionalRenderContext }); -Vue.version = '2.6.2'; +Vue.version = '2.6.3'; /* */ @@ -6744,6 +6747,11 @@ function createOnceHandler$1 (event, handler, capture) { } } +// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp +// implementation and does not fire microtasks in between event propagation, so +// safe to exclude. +var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); + function add$1 ( name, handler, @@ -6756,11 +6764,16 @@ function add$1 ( // the solution is simple: we save the timestamp when a handler is attached, // and the handler would only fire if the event passed to it was fired // AFTER it was attached. - if (isUsingMicroTask) { + if (useMicrotaskFix) { var attachedTimestamp = currentFlushTimestamp; var original = handler; handler = original._wrapper = function (e) { - if (e.timeStamp >= attachedTimestamp) { + if ( + e.timeStamp >= attachedTimestamp || + // #9448 bail if event is fired in another document in a multi-page + // electron/nw.js app + e.target.ownerDocument !== document + ) { return original.apply(this, arguments) } }; diff --git a/dist/vue.runtime.common.prod.js b/dist/vue.runtime.common.prod.js index 839e299e7cb..9471ab16c66 100644 --- a/dist/vue.runtime.common.prod.js +++ b/dist/vue.runtime.common.prod.js @@ -1,6 +1,6 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ -"use strict";var t=Object.freeze({});function e(t){return null==t}function n(t){return null!=t}function r(t){return!0===t}function o(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function i(t){return null!==t&&"object"==typeof t}var a=Object.prototype.toString;function s(t){return"[object Object]"===a.call(t)}function c(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function u(t){return n(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function l(t){return null==t?"":Array.isArray(t)||s(t)&&t.toString===a?JSON.stringify(t,null,2):String(t)}function f(t){var e=parseFloat(t);return isNaN(e)?t:e}function p(t,e){for(var n=Object.create(null),r=t.split(","),o=0;o-1)return t.splice(n,1)}}var h=Object.prototype.hasOwnProperty;function m(t,e){return h.call(t,e)}function y(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var g=/-(\w)/g,_=y(function(t){return t.replace(g,function(t,e){return e?e.toUpperCase():""})}),b=y(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),C=/\B([A-Z])/g,A=y(function(t){return t.replace(C,"-$1").toLowerCase()});var w=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function $(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function x(t,e){for(var n in e)t[n]=e[n];return t}function O(t){for(var e={},n=0;n0,K=z&&z.indexOf("edge/")>0,X=(z&&z.indexOf("android"),z&&/iphone|ipad|ipod|ios/.test(z)||"ios"===B),G=(z&&/chrome\/\d+/.test(z),z&&/phantomjs/.test(z),{}.watch),Z=!1;if(H)try{var J={};Object.defineProperty(J,"passive",{get:function(){Z=!0}}),window.addEventListener("test-passive",null,J)}catch(t){}var Q=function(){return void 0===R&&(R=!H&&!V&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),R},Y=H&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function tt(t){return"function"==typeof t&&/native code/.test(t.toString())}var et,nt="undefined"!=typeof Symbol&&tt(Symbol)&&"undefined"!=typeof Reflect&&tt(Reflect.ownKeys);et="undefined"!=typeof Set&&tt(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var rt=k,ot=0,it=function(){this.id=ot++,this.subs=[]};it.prototype.addSub=function(t){this.subs.push(t)},it.prototype.removeSub=function(t){v(this.subs,t)},it.prototype.depend=function(){it.target&&it.target.addDep(this)},it.prototype.notify=function(){for(var t=this.subs.slice(),e=0,n=t.length;e-1)if(i&&!m(o,"default"))a=!1;else if(""===a||a===A(t)){var c=Lt(String,o.type);(c<0||s0&&(ie((u=t(u,(a||"")+"_"+c))[0])&&ie(f)&&(s[l]=pt(f.text+u[0].text),u.shift()),s.push.apply(s,u)):o(u)?ie(f)?s[l]=pt(f.text+u):""!==u&&s.push(pt(u)):ie(u)&&ie(f)?s[l]=pt(f.text+u.text):(r(i._isVList)&&n(u.tag)&&e(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(t):void 0}function ie(t){return n(t)&&n(t.text)&&!1===t.isComment}function ae(t,e){return(t.__esModule||nt&&"Module"===t[Symbol.toStringTag])&&(t=t.default),i(t)?e.extend(t):t}function se(t){return t.isComment&&t.asyncFactory}function ce(t){if(Array.isArray(t))for(var e=0;edocument.createEvent("Event").timeStamp&&(Se=function(){return performance.now()});var je=0,Ie=function(t,e,n,r,o){this.vm=t,o&&(t._watcher=this),t._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++je,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new et,this.newDepIds=new et,this.expression="","function"==typeof e?this.getter=e:(this.getter=function(t){if(!F.test(t)){var e=t.split(".");return function(t){for(var n=0;nOe&&Ce[n].id>t.id;)n--;Ce.splice(n+1,0,t)}else Ce.push(t);$e||($e=!0,Gt(Ee))}}(this)},Ie.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||i(t)||this.deep){var e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){Nt(t,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,t,e)}}},Ie.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Ie.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},Ie.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||v(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var Te={enumerable:!0,configurable:!0,get:k,set:k};function De(t,e,n){Te.get=function(){return this[e][n]},Te.set=function(t){this[e][n]=t},Object.defineProperty(t,n,Te)}function Pe(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},r=t._props={},o=t.$options._propKeys=[];t.$parent&>(!1);var i=function(i){o.push(i);var a=Tt(i,e,n,t);Ct(r,i,a),i in t||De(t,"_props",i)};for(var a in e)i(a);gt(!0)}(t,e.props),e.methods&&function(t,e){t.$options.props;for(var n in e)t[n]="function"!=typeof e[n]?k:w(e[n],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;s(e=t._data="function"==typeof e?function(t,e){st();try{return t.call(e,e)}catch(t){return Nt(t,e,"data()"),{}}finally{ct()}}(e,t):e||{})||(e={});var n=Object.keys(e),r=t.$options.props,o=(t.$options.methods,n.length);for(;o--;){var i=n[o];r&&m(r,i)||(a=void 0,36!==(a=(i+"").charCodeAt(0))&&95!==a&&De(t,"_data",i))}var a;bt(e,!0)}(t):bt(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),r=Q();for(var o in e){var i=e[o],a="function"==typeof i?i:i.get;r||(n[o]=new Ie(t,a||k,k,Le)),o in t||Ne(t,o,i)}}(t,e.computed),e.watch&&e.watch!==G&&function(t,e){for(var n in e){var r=e[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof t?t.split(",").indexOf(e)>-1:(n=t,"[object RegExp]"===a.call(n)&&t.test(e));var n}function Cn(t,e){var n=t.cache,r=t.keys,o=t._vnode;for(var i in n){var a=n[i];if(a){var s=_n(a.componentOptions);s&&!e(s)&&An(n,i,r,o)}}}function An(t,e,n,r){var o=t[e];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),t[e]=null,v(n,e)}!function(e){e.prototype._init=function(e){var n=this;n._uid=hn++,n._isVue=!0,e&&e._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),r=e._parentVnode;n.parent=e.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(n,e):n.$options=jt(mn(n.constructor),e||{},n),n._renderProxy=n,n._self=n,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(n),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&pe(t,e)}(n),function(e){e._vnode=null,e._staticTrees=null;var n=e.$options,r=e.$vnode=n._parentVnode,o=r&&r.context;e.$slots=de(n._renderChildren,o),e.$scopedSlots=t,e._c=function(t,n,r,o){return vn(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return vn(e,t,n,r,o,!0)};var i=r&&r.data;Ct(e,"$attrs",i&&i.attrs||t,null,!0),Ct(e,"$listeners",n._parentListeners||t,null,!0)}(n),be(n,"beforeCreate"),function(t){var e=Ue(t.$options.inject,t);e&&(gt(!1),Object.keys(e).forEach(function(n){Ct(t,n,e[n])}),gt(!0))}(n),Pe(n),function(t){var e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(n),be(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(yn),function(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=At,t.prototype.$delete=wt,t.prototype.$watch=function(t,e,n){if(s(e))return Re(this,t,e,n);(n=n||{}).user=!0;var r=new Ie(this,t,e,n);if(n.immediate)try{e.call(this,r.value)}catch(t){Nt(t,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(yn),function(t){var e=/^hook:/;t.prototype.$on=function(t,n){var r=this;if(Array.isArray(t))for(var o=0,i=t.length;o1?$(e):e;for(var n=$(arguments,1),r='event handler for "'+t+'"',o=0,i=e.length;oparseInt(this.max)&&An(a,s[0],s,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return N}};Object.defineProperty(t,"config",e),t.util={warn:rt,extend:x,mergeOptions:jt,defineReactive:Ct},t.set=At,t.delete=wt,t.nextTick=Gt,t.observable=function(t){return bt(t),t},t.options=Object.create(null),P.forEach(function(e){t.options[e+"s"]=Object.create(null)}),t.options._base=t,x(t.options.components,$n),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=$(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=jt(this.options,t),this}}(t),gn(t),function(t){P.forEach(function(e){t[e]=function(t,n){return n?("component"===e&&s(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}(t)}(yn),Object.defineProperty(yn.prototype,"$isServer",{get:Q}),Object.defineProperty(yn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(yn,"FunctionalRenderContext",{value:on}),yn.version="2.6.2";var xn=p("style,class"),On=p("input,textarea,option,select,progress"),kn=p("contenteditable,draggable,spellcheck"),Sn=p("events,caret,typing,plaintext-only"),En=function(t,e){return Pn(e)||"false"===e?"false":"contenteditable"===t&&Sn(e)?e:"true"},jn=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),In="http://www.w3.org/1999/xlink",Tn=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},Dn=function(t){return Tn(t)?t.slice(6,t.length):""},Pn=function(t){return null==t||!1===t};function Ln(t){for(var e=t.data,r=t,o=t;n(o.componentInstance);)(o=o.componentInstance._vnode)&&o.data&&(e=Nn(o.data,e));for(;n(r=r.parent);)r&&r.data&&(e=Nn(e,r.data));return function(t,e){if(n(t)||n(e))return Mn(t,Fn(e));return""}(e.staticClass,e.class)}function Nn(t,e){return{staticClass:Mn(t.staticClass,e.staticClass),class:n(t.class)?[t.class,e.class]:e.class}}function Mn(t,e){return t?e?t+" "+e:t:e||""}function Fn(t){return Array.isArray(t)?function(t){for(var e,r="",o=0,i=t.length;o-1?sr(t,e,n):jn(e)?Pn(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):kn(e)?t.setAttribute(e,En(e,n)):Tn(e)?Pn(n)?t.removeAttributeNS(In,Dn(e)):t.setAttributeNS(In,e,n):sr(t,e,n)}function sr(t,e,n){if(Pn(n))t.removeAttribute(e);else{if(W&&!q&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var r=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",r)};t.addEventListener("input",r),t.__ieph=!0}t.setAttribute(e,n)}}var cr={create:ir,update:ir};function ur(t,r){var o=r.elm,i=r.data,a=t.data;if(!(e(i.staticClass)&&e(i.class)&&(e(a)||e(a.staticClass)&&e(a.class)))){var s=Ln(r),c=o._transitionClasses;n(c)&&(s=Mn(s,Fn(c))),s!==o._prevClass&&(o.setAttribute("class",s),o._prevClass=s)}}var lr,fr={create:ur,update:ur},pr="__r",dr="__c";function vr(t,e,n){var r=lr;return function o(){null!==e.apply(null,arguments)&&mr(t,o,n,r)}}function hr(t,e,n,r){if(Ht){var o=ke,i=e;e=i._wrapper=function(t){if(t.timeStamp>=o)return i.apply(this,arguments)}}lr.addEventListener(t,e,Z?{capture:n,passive:r}:n)}function mr(t,e,n,r){(r||lr).removeEventListener(t,e._wrapper||e,n)}function yr(t,r){if(!e(t.data.on)||!e(r.data.on)){var o=r.data.on||{},i=t.data.on||{};lr=r.elm,function(t){if(n(t[pr])){var e=W?"change":"input";t[e]=[].concat(t[pr],t[e]||[]),delete t[pr]}n(t[dr])&&(t.change=[].concat(t[dr],t.change||[]),delete t[dr])}(o),ee(o,i,hr,mr,vr,r.context),lr=void 0}}var gr,_r={create:yr,update:yr};function br(t,r){if(!e(t.data.domProps)||!e(r.data.domProps)){var o,i,a=r.elm,s=t.data.domProps||{},c=r.data.domProps||{};for(o in n(c.__ob__)&&(c=r.data.domProps=x({},c)),s)e(c[o])&&(a[o]="");for(o in c){if(i=c[o],"textContent"===o||"innerHTML"===o){if(r.children&&(r.children.length=0),i===s[o])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===o||i!==s[o])if("value"===o){a._value=i;var u=e(i)?"":String(i);Cr(a,u)&&(a.value=u)}else if("innerHTML"===o&&Hn(a.tagName)&&e(a.innerHTML)){(gr=gr||document.createElement("div")).innerHTML=""+i+"";for(var l=gr.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else a[o]=i}}}function Cr(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var r=t.value,o=t._vModifiers;if(n(o)){if(o.number)return f(r)!==f(e);if(o.trim)return r.trim()!==e.trim()}return r!==e}(t,e))}var Ar={create:br,update:br},wr=y(function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach(function(t){if(t){var r=t.split(n);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e});function $r(t){var e=xr(t.style);return t.staticStyle?x(t.staticStyle,e):e}function xr(t){return Array.isArray(t)?O(t):"string"==typeof t?wr(t):t}var Or,kr=/^--/,Sr=/\s*!important$/,Er=function(t,e,n){if(kr.test(e))t.style.setProperty(e,n);else if(Sr.test(n))t.style.setProperty(A(e),n.replace(Sr,""),"important");else{var r=Ir(e);if(Array.isArray(n))for(var o=0,i=n.length;o-1?e.split(Pr).forEach(function(e){return t.classList.add(e)}):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function Nr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Pr).forEach(function(e){return t.classList.remove(e)}):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",r=" "+e+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function Mr(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&x(e,Fr(t.name||"v")),x(e,t),e}return"string"==typeof t?Fr(t):void 0}}var Fr=y(function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}}),Rr=H&&!q,Ur="transition",Hr="animation",Vr="transition",Br="transitionend",zr="animation",Wr="animationend";Rr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Vr="WebkitTransition",Br="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(zr="WebkitAnimation",Wr="webkitAnimationEnd"));var qr=H?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Kr(t){qr(function(){qr(t)})}function Xr(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),Lr(t,e))}function Gr(t,e){t._transitionClasses&&v(t._transitionClasses,e),Nr(t,e)}function Zr(t,e,n){var r=Qr(t,e),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s=o===Ur?Br:Wr,c=0,u=function(){t.removeEventListener(s,l),n()},l=function(e){e.target===t&&++c>=a&&u()};setTimeout(function(){c0&&(n=Ur,l=a,f=i.length):e===Hr?u>0&&(n=Hr,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?Ur:Hr:null)?n===Ur?i.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===Ur&&Jr.test(r[Vr+"Property"])}}function Yr(t,e){for(;t.length1}function io(t,e){!0!==e.data.show&&eo(e)}var ao=function(t){var i,a,s={},c=t.modules,u=t.nodeOps;for(i=0;iv?_(t,e(o[y+1])?null:o[y+1].elm,o,d,y,i):d>y&&C(0,r,p,v)}(p,h,y,i,l):n(y)?(n(t.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,i)):n(h)?C(0,h,0,h.length-1):n(t.text)&&u.setTextContent(p,""):t.text!==o.text&&u.setTextContent(p,o.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(t,o)}}}function x(t,e,o){if(r(o)&&n(t.parent))t.parent.data.pendingInsert=e;else for(var i=0;i-1,a.selected!==i&&(a.selected=i);else if(j(fo(a),r))return void(t.selectedIndex!==s&&(t.selectedIndex=s));o||(t.selectedIndex=-1)}}function lo(t,e){return e.every(function(e){return!j(e,t)})}function fo(t){return"_value"in t?t._value:t.value}function po(t){t.target.composing=!0}function vo(t){t.target.composing&&(t.target.composing=!1,ho(t.target,"input"))}function ho(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function mo(t){return!t.componentInstance||t.data&&t.data.transition?t:mo(t.componentInstance._vnode)}var yo={model:so,show:{bind:function(t,e,n){var r=e.value,o=(n=mo(n)).data&&n.data.transition,i=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;r&&o?(n.data.show=!0,eo(n,function(){t.style.display=i})):t.style.display=r?i:"none"},update:function(t,e,n){var r=e.value;!r!=!e.oldValue&&((n=mo(n)).data&&n.data.transition?(n.data.show=!0,r?eo(n,function(){t.style.display=t.__vOriginalDisplay}):no(n,function(){t.style.display="none"})):t.style.display=r?t.__vOriginalDisplay:"none")},unbind:function(t,e,n,r,o){o||(t.style.display=t.__vOriginalDisplay)}}},go={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function _o(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?_o(ce(e.children)):t}function bo(t){var e={},n=t.$options;for(var r in n.propsData)e[r]=t[r];var o=n._parentListeners;for(var i in o)e[_(i)]=o[i];return e}function Co(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}var Ao=function(t){return t.tag||se(t)},wo=function(t){return"show"===t.name},$o={name:"transition",props:go,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(Ao)).length){var r=this.mode,i=n[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return i;var a=_o(i);if(!a)return i;if(this._leaving)return Co(t,i);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:o(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=bo(this),u=this._vnode,l=_o(u);if(a.data.directives&&a.data.directives.some(wo)&&(a.data.show=!0),l&&l.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(a,l)&&!se(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=x({},c);if("out-in"===r)return this._leaving=!0,ne(f,"afterLeave",function(){e._leaving=!1,e.$forceUpdate()}),Co(t,i);if("in-out"===r){if(se(a))return u;var p,d=function(){p()};ne(c,"afterEnter",d),ne(c,"enterCancelled",d),ne(f,"delayLeave",function(t){p=t})}}return i}}},xo=x({tag:String,moveClass:String},go);function Oo(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function ko(t){t.data.newPos=t.elm.getBoundingClientRect()}function So(t){var e=t.data.pos,n=t.data.newPos,r=e.left-n.left,o=e.top-n.top;if(r||o){t.data.moved=!0;var i=t.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+o+"px)",i.transitionDuration="0s"}}delete xo.mode;var Eo={Transition:$o,TransitionGroup:{props:xo,beforeMount:function(){var t=this,e=this._update;this._update=function(n,r){var o=ye(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,o(),e.call(t,n,r)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=bo(this),s=0;s-1?Bn[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Bn[t]=/HTMLUnknownElement/.test(e.toString())},x(yn.options.directives,yo),x(yn.options.components,Eo),yn.prototype.__patch__=H?ao:k,yn.prototype.$mount=function(t,e){return function(t,e,n){var r;return t.$el=e,t.$options.render||(t.$options.render=ft),be(t,"beforeMount"),r=function(){t._update(t._render(),n)},new Ie(t,r,k,{before:function(){t._isMounted&&!t._isDestroyed&&be(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,be(t,"mounted")),t}(this,t=t&&H?function(t){if("string"==typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}(t):void 0,e)},H&&setTimeout(function(){N.devtools&&Y&&Y.emit("init",yn)},0),module.exports=yn; \ No newline at end of file +"use strict";var t=Object.freeze({});function e(t){return null==t}function n(t){return null!=t}function r(t){return!0===t}function o(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function i(t){return null!==t&&"object"==typeof t}var a=Object.prototype.toString;function s(t){return"[object Object]"===a.call(t)}function c(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function u(t){return n(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function l(t){return null==t?"":Array.isArray(t)||s(t)&&t.toString===a?JSON.stringify(t,null,2):String(t)}function f(t){var e=parseFloat(t);return isNaN(e)?t:e}function p(t,e){for(var n=Object.create(null),r=t.split(","),o=0;o-1)return t.splice(n,1)}}var h=Object.prototype.hasOwnProperty;function m(t,e){return h.call(t,e)}function y(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var g=/-(\w)/g,_=y(function(t){return t.replace(g,function(t,e){return e?e.toUpperCase():""})}),b=y(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),C=/\B([A-Z])/g,w=y(function(t){return t.replace(C,"-$1").toLowerCase()});var A=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function $(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function x(t,e){for(var n in e)t[n]=e[n];return t}function O(t){for(var e={},n=0;n0,K=z&&z.indexOf("edge/")>0,X=(z&&z.indexOf("android"),z&&/iphone|ipad|ipod|ios/.test(z)||"ios"===B),G=(z&&/chrome\/\d+/.test(z),z&&/phantomjs/.test(z),z&&z.match(/firefox\/(\d+)/)),Z={}.watch,J=!1;if(H)try{var Q={};Object.defineProperty(Q,"passive",{get:function(){J=!0}}),window.addEventListener("test-passive",null,Q)}catch(t){}var Y=function(){return void 0===R&&(R=!H&&!V&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),R},tt=H&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function et(t){return"function"==typeof t&&/native code/.test(t.toString())}var nt,rt="undefined"!=typeof Symbol&&et(Symbol)&&"undefined"!=typeof Reflect&&et(Reflect.ownKeys);nt="undefined"!=typeof Set&&et(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var ot=k,it=0,at=function(){this.id=it++,this.subs=[]};at.prototype.addSub=function(t){this.subs.push(t)},at.prototype.removeSub=function(t){v(this.subs,t)},at.prototype.depend=function(){at.target&&at.target.addDep(this)},at.prototype.notify=function(){for(var t=this.subs.slice(),e=0,n=t.length;e-1)if(i&&!m(o,"default"))a=!1;else if(""===a||a===w(t)){var c=Pt(String,o.type);(c<0||s0&&(ie((u=t(u,(a||"")+"_"+c))[0])&&ie(f)&&(s[l]=dt(f.text+u[0].text),u.shift()),s.push.apply(s,u)):o(u)?ie(f)?s[l]=dt(f.text+u):""!==u&&s.push(dt(u)):ie(u)&&ie(f)?s[l]=dt(f.text+u.text):(r(i._isVList)&&n(u.tag)&&e(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(t):void 0}function ie(t){return n(t)&&n(t.text)&&!1===t.isComment}function ae(t,e){if(t){for(var n=Object.create(null),r=rt?Reflect.ownKeys(t):Object.keys(t),o=0;odocument.createEvent("Event").timeStamp&&(on=function(){return performance.now()});var sn=0,cn=function(t,e,n,r,o){this.vm=t,o&&(t._watcher=this),t._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++sn,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new nt,this.newDepIds=new nt,this.expression="","function"==typeof e?this.getter=e:(this.getter=function(t){if(!F.test(t)){var e=t.split(".");return function(t){for(var n=0;nnn&&Je[n].id>t.id;)n--;Je.splice(n+1,0,t)}else Je.push(t);tn||(tn=!0,Zt(an))}}(this)},cn.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||i(t)||this.deep){var e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){Mt(t,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,t,e)}}},cn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},cn.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},cn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||v(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var un={enumerable:!0,configurable:!0,get:k,set:k};function ln(t,e,n){un.get=function(){return this[e][n]},un.set=function(t){this[e][n]=t},Object.defineProperty(t,n,un)}function fn(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},r=t._props={},o=t.$options._propKeys=[];t.$parent&&_t(!1);var i=function(i){o.push(i);var a=Dt(i,e,n,t);wt(r,i,a),i in t||ln(t,"_props",i)};for(var a in e)i(a);_t(!0)}(t,e.props),e.methods&&function(t,e){t.$options.props;for(var n in e)t[n]="function"!=typeof e[n]?k:A(e[n],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;s(e=t._data="function"==typeof e?function(t,e){ct();try{return t.call(e,e)}catch(t){return Mt(t,e,"data()"),{}}finally{ut()}}(e,t):e||{})||(e={});var n=Object.keys(e),r=t.$options.props,o=(t.$options.methods,n.length);for(;o--;){var i=n[o];r&&m(r,i)||(a=void 0,36!==(a=(i+"").charCodeAt(0))&&95!==a&&ln(t,"_data",i))}var a;Ct(e,!0)}(t):Ct(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),r=Y();for(var o in e){var i=e[o],a="function"==typeof i?i:i.get;r||(n[o]=new cn(t,a||k,k,pn)),o in t||dn(t,o,i)}}(t,e.computed),e.watch&&e.watch!==Z&&function(t,e){for(var n in e){var r=e[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof t?t.split(",").indexOf(e)>-1:(n=t,"[object RegExp]"===a.call(n)&&t.test(e));var n}function An(t,e){var n=t.cache,r=t.keys,o=t._vnode;for(var i in n){var a=n[i];if(a){var s=Cn(a.componentOptions);s&&!e(s)&&$n(n,i,r,o)}}}function $n(t,e,n,r){var o=t[e];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),t[e]=null,v(n,e)}!function(e){e.prototype._init=function(e){var n=this;n._uid=yn++,n._isVue=!0,e&&e._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),r=e._parentVnode;n.parent=e.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(n,e):n.$options=It(gn(n.constructor),e||{},n),n._renderProxy=n,n._self=n,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(n),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&We(t,e)}(n),function(e){e._vnode=null,e._staticTrees=null;var n=e.$options,r=e.$vnode=n._parentVnode,o=r&&r.context;e.$slots=se(n._renderChildren,o),e.$scopedSlots=t,e._c=function(t,n,r,o){return Pe(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return Pe(e,t,n,r,o,!0)};var i=r&&r.data;wt(e,"$attrs",i&&i.attrs||t,null,!0),wt(e,"$listeners",n._parentListeners||t,null,!0)}(n),Ze(n,"beforeCreate"),function(t){var e=ae(t.$options.inject,t);e&&(_t(!1),Object.keys(e).forEach(function(n){wt(t,n,e[n])}),_t(!0))}(n),fn(n),function(t){var e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(n),Ze(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(_n),function(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=At,t.prototype.$delete=$t,t.prototype.$watch=function(t,e,n){if(s(e))return mn(this,t,e,n);(n=n||{}).user=!0;var r=new cn(this,t,e,n);if(n.immediate)try{e.call(this,r.value)}catch(t){Mt(t,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(_n),function(t){var e=/^hook:/;t.prototype.$on=function(t,n){var r=this;if(Array.isArray(t))for(var o=0,i=t.length;o1?$(e):e;for(var n=$(arguments,1),r='event handler for "'+t+'"',o=0,i=e.length;oparseInt(this.max)&&$n(a,s[0],s,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return P}};Object.defineProperty(t,"config",e),t.util={warn:ot,extend:x,mergeOptions:It,defineReactive:wt},t.set=At,t.delete=$t,t.nextTick=Zt,t.observable=function(t){return Ct(t),t},t.options=Object.create(null),N.forEach(function(e){t.options[e+"s"]=Object.create(null)}),t.options._base=t,x(t.options.components,On),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=$(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=It(this.options,t),this}}(t),bn(t),function(t){N.forEach(function(e){t[e]=function(t,n){return n?("component"===e&&s(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}(t)}(_n),Object.defineProperty(_n.prototype,"$isServer",{get:Y}),Object.defineProperty(_n.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(_n,"FunctionalRenderContext",{value:ke}),_n.version="2.6.3";var kn=p("style,class"),Sn=p("input,textarea,option,select,progress"),En=p("contenteditable,draggable,spellcheck"),jn=p("events,caret,typing,plaintext-only"),In=function(t,e){return Pn(e)||"false"===e?"false":"contenteditable"===t&&jn(e)?e:"true"},Tn=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Dn="http://www.w3.org/1999/xlink",Nn=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},Ln=function(t){return Nn(t)?t.slice(6,t.length):""},Pn=function(t){return null==t||!1===t};function Mn(t){for(var e=t.data,r=t,o=t;n(o.componentInstance);)(o=o.componentInstance._vnode)&&o.data&&(e=Fn(o.data,e));for(;n(r=r.parent);)r&&r.data&&(e=Fn(e,r.data));return function(t,e){if(n(t)||n(e))return Rn(t,Un(e));return""}(e.staticClass,e.class)}function Fn(t,e){return{staticClass:Rn(t.staticClass,e.staticClass),class:n(t.class)?[t.class,e.class]:e.class}}function Rn(t,e){return t?e?t+" "+e:t:e||""}function Un(t){return Array.isArray(t)?function(t){for(var e,r="",o=0,i=t.length;o-1?ur(t,e,n):Tn(e)?Pn(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):En(e)?t.setAttribute(e,In(e,n)):Nn(e)?Pn(n)?t.removeAttributeNS(Dn,Ln(e)):t.setAttributeNS(Dn,e,n):ur(t,e,n)}function ur(t,e,n){if(Pn(n))t.removeAttribute(e);else{if(W&&!q&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var r=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",r)};t.addEventListener("input",r),t.__ieph=!0}t.setAttribute(e,n)}}var lr={create:sr,update:sr};function fr(t,r){var o=r.elm,i=r.data,a=t.data;if(!(e(i.staticClass)&&e(i.class)&&(e(a)||e(a.staticClass)&&e(a.class)))){var s=Mn(r),c=o._transitionClasses;n(c)&&(s=Rn(s,Un(c))),s!==o._prevClass&&(o.setAttribute("class",s),o._prevClass=s)}}var pr,dr={create:fr,update:fr},vr="__r",hr="__c";function mr(t,e,n){var r=pr;return function o(){null!==e.apply(null,arguments)&&_r(t,o,n,r)}}var yr=Vt&&!(G&&Number(G[1])<=53);function gr(t,e,n,r){if(yr){var o=rn,i=e;e=i._wrapper=function(t){if(t.timeStamp>=o||t.target.ownerDocument!==document)return i.apply(this,arguments)}}pr.addEventListener(t,e,J?{capture:n,passive:r}:n)}function _r(t,e,n,r){(r||pr).removeEventListener(t,e._wrapper||e,n)}function br(t,r){if(!e(t.data.on)||!e(r.data.on)){var o=r.data.on||{},i=t.data.on||{};pr=r.elm,function(t){if(n(t[vr])){var e=W?"change":"input";t[e]=[].concat(t[vr],t[e]||[]),delete t[vr]}n(t[hr])&&(t.change=[].concat(t[hr],t.change||[]),delete t[hr])}(o),ee(o,i,gr,_r,mr,r.context),pr=void 0}}var Cr,wr={create:br,update:br};function Ar(t,r){if(!e(t.data.domProps)||!e(r.data.domProps)){var o,i,a=r.elm,s=t.data.domProps||{},c=r.data.domProps||{};for(o in n(c.__ob__)&&(c=r.data.domProps=x({},c)),s)e(c[o])&&(a[o]="");for(o in c){if(i=c[o],"textContent"===o||"innerHTML"===o){if(r.children&&(r.children.length=0),i===s[o])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===o||i!==s[o])if("value"===o){a._value=i;var u=e(i)?"":String(i);$r(a,u)&&(a.value=u)}else if("innerHTML"===o&&Bn(a.tagName)&&e(a.innerHTML)){(Cr=Cr||document.createElement("div")).innerHTML=""+i+"";for(var l=Cr.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else a[o]=i}}}function $r(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var r=t.value,o=t._vModifiers;if(n(o)){if(o.number)return f(r)!==f(e);if(o.trim)return r.trim()!==e.trim()}return r!==e}(t,e))}var xr={create:Ar,update:Ar},Or=y(function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach(function(t){if(t){var r=t.split(n);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e});function kr(t){var e=Sr(t.style);return t.staticStyle?x(t.staticStyle,e):e}function Sr(t){return Array.isArray(t)?O(t):"string"==typeof t?Or(t):t}var Er,jr=/^--/,Ir=/\s*!important$/,Tr=function(t,e,n){if(jr.test(e))t.style.setProperty(e,n);else if(Ir.test(n))t.style.setProperty(w(e),n.replace(Ir,""),"important");else{var r=Nr(e);if(Array.isArray(n))for(var o=0,i=n.length;o-1?e.split(Mr).forEach(function(e){return t.classList.add(e)}):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function Rr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Mr).forEach(function(e){return t.classList.remove(e)}):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",r=" "+e+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function Ur(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&x(e,Hr(t.name||"v")),x(e,t),e}return"string"==typeof t?Hr(t):void 0}}var Hr=y(function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}}),Vr=H&&!q,Br="transition",zr="animation",Wr="transition",qr="transitionend",Kr="animation",Xr="animationend";Vr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Wr="WebkitTransition",qr="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Kr="WebkitAnimation",Xr="webkitAnimationEnd"));var Gr=H?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Zr(t){Gr(function(){Gr(t)})}function Jr(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),Fr(t,e))}function Qr(t,e){t._transitionClasses&&v(t._transitionClasses,e),Rr(t,e)}function Yr(t,e,n){var r=eo(t,e),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s=o===Br?qr:Xr,c=0,u=function(){t.removeEventListener(s,l),n()},l=function(e){e.target===t&&++c>=a&&u()};setTimeout(function(){c0&&(n=Br,l=a,f=i.length):e===zr?u>0&&(n=zr,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?Br:zr:null)?n===Br?i.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===Br&&to.test(r[Wr+"Property"])}}function no(t,e){for(;t.length1}function co(t,e){!0!==e.data.show&&oo(e)}var uo=function(t){var i,a,s={},c=t.modules,u=t.nodeOps;for(i=0;iv?_(t,e(o[y+1])?null:o[y+1].elm,o,d,y,i):d>y&&C(0,r,p,v)}(p,h,y,i,l):n(y)?(n(t.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,i)):n(h)?C(0,h,0,h.length-1):n(t.text)&&u.setTextContent(p,""):t.text!==o.text&&u.setTextContent(p,o.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(t,o)}}}function x(t,e,o){if(r(o)&&n(t.parent))t.parent.data.pendingInsert=e;else for(var i=0;i-1,a.selected!==i&&(a.selected=i);else if(j(ho(a),r))return void(t.selectedIndex!==s&&(t.selectedIndex=s));o||(t.selectedIndex=-1)}}function vo(t,e){return e.every(function(e){return!j(e,t)})}function ho(t){return"_value"in t?t._value:t.value}function mo(t){t.target.composing=!0}function yo(t){t.target.composing&&(t.target.composing=!1,go(t.target,"input"))}function go(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function _o(t){return!t.componentInstance||t.data&&t.data.transition?t:_o(t.componentInstance._vnode)}var bo={model:lo,show:{bind:function(t,e,n){var r=e.value,o=(n=_o(n)).data&&n.data.transition,i=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;r&&o?(n.data.show=!0,oo(n,function(){t.style.display=i})):t.style.display=r?i:"none"},update:function(t,e,n){var r=e.value;!r!=!e.oldValue&&((n=_o(n)).data&&n.data.transition?(n.data.show=!0,r?oo(n,function(){t.style.display=t.__vOriginalDisplay}):io(n,function(){t.style.display="none"})):t.style.display=r?t.__vOriginalDisplay:"none")},unbind:function(t,e,n,r,o){o||(t.style.display=t.__vOriginalDisplay)}}},Co={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function wo(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?wo(He(e.children)):t}function Ao(t){var e={},n=t.$options;for(var r in n.propsData)e[r]=t[r];var o=n._parentListeners;for(var i in o)e[_(i)]=o[i];return e}function $o(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}var xo=function(t){return t.tag||Ue(t)},Oo=function(t){return"show"===t.name},ko={name:"transition",props:Co,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(xo)).length){var r=this.mode,i=n[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return i;var a=wo(i);if(!a)return i;if(this._leaving)return $o(t,i);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:o(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=Ao(this),u=this._vnode,l=wo(u);if(a.data.directives&&a.data.directives.some(Oo)&&(a.data.show=!0),l&&l.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(a,l)&&!Ue(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=x({},c);if("out-in"===r)return this._leaving=!0,ne(f,"afterLeave",function(){e._leaving=!1,e.$forceUpdate()}),$o(t,i);if("in-out"===r){if(Ue(a))return u;var p,d=function(){p()};ne(c,"afterEnter",d),ne(c,"enterCancelled",d),ne(f,"delayLeave",function(t){p=t})}}return i}}},So=x({tag:String,moveClass:String},Co);function Eo(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function jo(t){t.data.newPos=t.elm.getBoundingClientRect()}function Io(t){var e=t.data.pos,n=t.data.newPos,r=e.left-n.left,o=e.top-n.top;if(r||o){t.data.moved=!0;var i=t.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+o+"px)",i.transitionDuration="0s"}}delete So.mode;var To={Transition:ko,TransitionGroup:{props:So,beforeMount:function(){var t=this,e=this._update;this._update=function(n,r){var o=Ke(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,o(),e.call(t,n,r)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=Ao(this),s=0;s-1?Wn[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Wn[t]=/HTMLUnknownElement/.test(e.toString())},x(_n.options.directives,bo),x(_n.options.components,To),_n.prototype.__patch__=H?uo:k,_n.prototype.$mount=function(t,e){return function(t,e,n){var r;return t.$el=e,t.$options.render||(t.$options.render=pt),Ze(t,"beforeMount"),r=function(){t._update(t._render(),n)},new cn(t,r,k,{before:function(){t._isMounted&&!t._isDestroyed&&Ze(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,Ze(t,"mounted")),t}(this,t=t&&H?function(t){if("string"==typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}(t):void 0,e)},H&&setTimeout(function(){P.devtools&&tt&&tt.emit("init",_n)},0),module.exports=_n; \ No newline at end of file diff --git a/dist/vue.runtime.esm.js b/dist/vue.runtime.esm.js index 1c09d41199e..5cadd3ea6e8 100644 --- a/dist/vue.runtime.esm.js +++ b/dist/vue.runtime.esm.js @@ -1,5 +1,5 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ @@ -523,6 +523,7 @@ var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android' var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; var isPhantomJS = UA && /phantomjs/.test(UA); +var isFF = UA && UA.match(/firefox\/(\d+)/); // Firefox has a "watch" function on Object.prototype... var nativeWatch = ({}).watch; @@ -2399,2450 +2400,2452 @@ function normalizeArrayChildren (children, nestedIndex) { /* */ -function ensureCtor (comp, base) { - if ( - comp.__esModule || - (hasSymbol && comp[Symbol.toStringTag] === 'Module') - ) { - comp = comp.default; +function initProvide (vm) { + var provide = vm.$options.provide; + if (provide) { + vm._provided = typeof provide === 'function' + ? provide.call(vm) + : provide; } - return isObject(comp) - ? base.extend(comp) - : comp -} - -function createAsyncPlaceholder ( - factory, - data, - context, - children, - tag -) { - var node = createEmptyVNode(); - node.asyncFactory = factory; - node.asyncMeta = { data: data, context: context, children: children, tag: tag }; - return node } -function resolveAsyncComponent ( - factory, - baseCtor, - context -) { - if (isTrue(factory.error) && isDef(factory.errorComp)) { - return factory.errorComp - } - - if (isDef(factory.resolved)) { - return factory.resolved - } - - if (isTrue(factory.loading) && isDef(factory.loadingComp)) { - return factory.loadingComp - } - - if (isDef(factory.contexts)) { - // already pending - factory.contexts.push(context); - } else { - var contexts = factory.contexts = [context]; - var sync = true; - - var forceRender = function (renderCompleted) { - for (var i = 0, l = contexts.length; i < l; i++) { - contexts[i].$forceUpdate(); - } - - if (renderCompleted) { - contexts.length = 0; - } - }; - - var resolve = once(function (res) { - // cache resolved - factory.resolved = ensureCtor(res, baseCtor); - // invoke callbacks only if this is not a synchronous resolve - // (async resolves are shimmed as synchronous during SSR) - if (!sync) { - forceRender(true); +function initInjections (vm) { + var result = resolveInject(vm.$options.inject, vm); + if (result) { + toggleObserving(false); + Object.keys(result).forEach(function (key) { + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') { + defineReactive$$1(vm, key, result[key], function () { + warn( + "Avoid mutating an injected value directly since the changes will be " + + "overwritten whenever the provided component re-renders. " + + "injection being mutated: \"" + key + "\"", + vm + ); + }); } else { - contexts.length = 0; - } - }); - - var reject = once(function (reason) { - process.env.NODE_ENV !== 'production' && warn( - "Failed to resolve async component: " + (String(factory)) + - (reason ? ("\nReason: " + reason) : '') - ); - if (isDef(factory.errorComp)) { - factory.error = true; - forceRender(true); + defineReactive$$1(vm, key, result[key]); } }); + toggleObserving(true); + } +} - var res = factory(resolve, reject); - - if (isObject(res)) { - if (isPromise(res)) { - // () => Promise - if (isUndef(factory.resolved)) { - res.then(resolve, reject); - } - } else if (isPromise(res.component)) { - res.component.then(resolve, reject); - - if (isDef(res.error)) { - factory.errorComp = ensureCtor(res.error, baseCtor); - } +function resolveInject (inject, vm) { + if (inject) { + // inject is :any because flow is not smart enough to figure out cached + var result = Object.create(null); + var keys = hasSymbol + ? Reflect.ownKeys(inject) + : Object.keys(inject); - if (isDef(res.loading)) { - factory.loadingComp = ensureCtor(res.loading, baseCtor); - if (res.delay === 0) { - factory.loading = true; - } else { - setTimeout(function () { - if (isUndef(factory.resolved) && isUndef(factory.error)) { - factory.loading = true; - forceRender(false); - } - }, res.delay || 200); - } + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + // #6574 in case the inject object is observed... + if (key === '__ob__') { continue } + var provideKey = inject[key].from; + var source = vm; + while (source) { + if (source._provided && hasOwn(source._provided, provideKey)) { + result[key] = source._provided[provideKey]; + break } - - if (isDef(res.timeout)) { - setTimeout(function () { - if (isUndef(factory.resolved)) { - reject( - process.env.NODE_ENV !== 'production' - ? ("timeout (" + (res.timeout) + "ms)") - : null - ); - } - }, res.timeout); + source = source.$parent; + } + if (!source) { + if ('default' in inject[key]) { + var provideDefault = inject[key].default; + result[key] = typeof provideDefault === 'function' + ? provideDefault.call(vm) + : provideDefault; + } else if (process.env.NODE_ENV !== 'production') { + warn(("Injection \"" + key + "\" not found"), vm); } } } - - sync = false; - // return in case resolved synchronously - return factory.loading - ? factory.loadingComp - : factory.resolved + return result } } /* */ -function isAsyncPlaceholder (node) { - return node.isComment && node.asyncFactory -} -/* */ -function getFirstComponentChild (children) { - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - var c = children[i]; - if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { - return c +/** + * Runtime helper for resolving raw children VNodes into a slot object. + */ +function resolveSlots ( + children, + context +) { + if (!children || !children.length) { + return {} + } + var slots = {}; + for (var i = 0, l = children.length; i < l; i++) { + var child = children[i]; + var data = child.data; + // remove slot attribute if the node is resolved as a Vue slot node + if (data && data.attrs && data.attrs.slot) { + delete data.attrs.slot; + } + // named slots should only be respected if the vnode was rendered in the + // same context. + if ((child.context === context || child.fnContext === context) && + data && data.slot != null + ) { + var name = data.slot; + var slot = (slots[name] || (slots[name] = [])); + if (child.tag === 'template') { + slot.push.apply(slot, child.children || []); + } else { + slot.push(child); } + } else { + (slots.default || (slots.default = [])).push(child); + } + } + // ignore slots that contains only whitespace + for (var name$1 in slots) { + if (slots[name$1].every(isWhitespace)) { + delete slots[name$1]; } } + return slots } -/* */ +function isWhitespace (node) { + return (node.isComment && !node.asyncFactory) || node.text === ' ' +} /* */ -function initEvents (vm) { - vm._events = Object.create(null); - vm._hasHookEvent = false; - // init parent attached events - var listeners = vm.$options._parentListeners; - if (listeners) { - updateComponentListeners(vm, listeners); +function normalizeScopedSlots ( + slots, + normalSlots +) { + var res; + if (!slots) { + res = {}; + } else if (slots._normalized) { + return slots + } else { + res = {}; + for (var key in slots) { + if (slots[key] && key[0] !== '$') { + res[key] = normalizeScopedSlot(slots[key]); + } + } + } + // expose normal slots on scopedSlots + for (var key$1 in normalSlots) { + if (!(key$1 in res)) { + res[key$1] = proxyNormalSlot(normalSlots, key$1); + } } + def(res, '_normalized', true); + def(res, '$stable', slots ? !!slots.$stable : true); + return res } -var target; +function normalizeScopedSlot(fn) { + return function (scope) { + var res = fn(scope); + return res && typeof res === 'object' && !Array.isArray(res) + ? [res] // single vnode + : normalizeChildren(res) + } +} -function add (event, fn) { - target.$on(event, fn); +function proxyNormalSlot(slots, key) { + return function () { return slots[key]; } } -function remove$1 (event, fn) { - target.$off(event, fn); -} - -function createOnceHandler (event, fn) { - var _target = target; - return function onceHandler () { - var res = fn.apply(null, arguments); - if (res !== null) { - _target.$off(event, onceHandler); - } - } -} +/* */ -function updateComponentListeners ( - vm, - listeners, - oldListeners +/** + * Runtime helper for rendering v-for lists. + */ +function renderList ( + val, + render ) { - target = vm; - updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); - target = undefined; -} - -function eventsMixin (Vue) { - var hookRE = /^hook:/; - Vue.prototype.$on = function (event, fn) { - var vm = this; - if (Array.isArray(event)) { - for (var i = 0, l = event.length; i < l; i++) { - vm.$on(event[i], fn); - } - } else { - (vm._events[event] || (vm._events[event] = [])).push(fn); - // optimize hook:event cost by using a boolean flag marked at registration - // instead of a hash lookup - if (hookRE.test(event)) { - vm._hasHookEvent = true; - } - } - return vm - }; - - Vue.prototype.$once = function (event, fn) { - var vm = this; - function on () { - vm.$off(event, on); - fn.apply(vm, arguments); - } - on.fn = fn; - vm.$on(event, on); - return vm - }; - - Vue.prototype.$off = function (event, fn) { - var vm = this; - // all - if (!arguments.length) { - vm._events = Object.create(null); - return vm - } - // array of events - if (Array.isArray(event)) { - for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { - vm.$off(event[i$1], fn); - } - return vm - } - // specific event - var cbs = vm._events[event]; - if (!cbs) { - return vm - } - if (!fn) { - vm._events[event] = null; - return vm + var ret, i, l, keys, key; + if (Array.isArray(val) || typeof val === 'string') { + ret = new Array(val.length); + for (i = 0, l = val.length; i < l; i++) { + ret[i] = render(val[i], i); } - // specific handler - var cb; - var i = cbs.length; - while (i--) { - cb = cbs[i]; - if (cb === fn || cb.fn === fn) { - cbs.splice(i, 1); - break - } + } else if (typeof val === 'number') { + ret = new Array(val); + for (i = 0; i < val; i++) { + ret[i] = render(i + 1, i); } - return vm - }; - - Vue.prototype.$emit = function (event) { - var vm = this; - if (process.env.NODE_ENV !== 'production') { - var lowerCaseEvent = event.toLowerCase(); - if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { - tip( - "Event \"" + lowerCaseEvent + "\" is emitted in component " + - (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + - "Note that HTML attributes are case-insensitive and you cannot use " + - "v-on to listen to camelCase events when using in-DOM templates. " + - "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." - ); + } else if (isObject(val)) { + if (hasSymbol && val[Symbol.iterator]) { + ret = []; + var iterator = val[Symbol.iterator](); + var result = iterator.next(); + while (!result.done) { + ret.push(render(result.value, ret.length)); + result = iterator.next(); } - } - var cbs = vm._events[event]; - if (cbs) { - cbs = cbs.length > 1 ? toArray(cbs) : cbs; - var args = toArray(arguments, 1); - var info = "event handler for \"" + event + "\""; - for (var i = 0, l = cbs.length; i < l; i++) { - invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } else { + keys = Object.keys(val); + ret = new Array(keys.length); + for (i = 0, l = keys.length; i < l; i++) { + key = keys[i]; + ret[i] = render(val[key], key, i); } } - return vm - }; + } + if (!isDef(ret)) { + ret = []; + } + (ret)._isVList = true; + return ret } /* */ - - /** - * Runtime helper for resolving raw children VNodes into a slot object. + * Runtime helper for rendering */ -function resolveSlots ( - children, - context +function renderSlot ( + name, + fallback, + props, + bindObject ) { - if (!children || !children.length) { - return {} - } - var slots = {}; - for (var i = 0, l = children.length; i < l; i++) { - var child = children[i]; - var data = child.data; - // remove slot attribute if the node is resolved as a Vue slot node - if (data && data.attrs && data.attrs.slot) { - delete data.attrs.slot; - } - // named slots should only be respected if the vnode was rendered in the - // same context. - if ((child.context === context || child.fnContext === context) && - data && data.slot != null - ) { - var name = data.slot; - var slot = (slots[name] || (slots[name] = [])); - if (child.tag === 'template') { - slot.push.apply(slot, child.children || []); - } else { - slot.push(child); + var scopedSlotFn = this.$scopedSlots[name]; + var nodes; + if (scopedSlotFn) { // scoped slot + props = props || {}; + if (bindObject) { + if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) { + warn( + 'slot v-bind without argument expects an Object', + this + ); } - } else { - (slots.default || (slots.default = [])).push(child); - } - } - // ignore slots that contains only whitespace - for (var name$1 in slots) { - if (slots[name$1].every(isWhitespace)) { - delete slots[name$1]; + props = extend(extend({}, bindObject), props); } + nodes = scopedSlotFn(props) || fallback; + } else { + nodes = this.$slots[name] || fallback; } - return slots -} - -function isWhitespace (node) { - return (node.isComment && !node.asyncFactory) || node.text === ' ' -} -function resolveScopedSlots ( - fns, // see flow/vnode - hasDynamicKeys, - res -) { - res = res || { $stable: !hasDynamicKeys }; - for (var i = 0; i < fns.length; i++) { - var slot = fns[i]; - if (Array.isArray(slot)) { - resolveScopedSlots(slot, hasDynamicKeys, res); - } else if (slot) { - res[slot.key] = slot.fn; - } + var target = props && props.slot; + if (target) { + return this.$createElement('template', { slot: target }, nodes) + } else { + return nodes } - return res } /* */ -var activeInstance = null; -var isUpdatingChildComponent = false; - -function setActiveInstance(vm) { - var prevActiveInstance = activeInstance; - activeInstance = vm; - return function () { - activeInstance = prevActiveInstance; - } +/** + * Runtime helper for resolving filters + */ +function resolveFilter (id) { + return resolveAsset(this.$options, 'filters', id, true) || identity } -function initLifecycle (vm) { - var options = vm.$options; +/* */ - // locate first non-abstract parent - var parent = options.parent; - if (parent && !options.abstract) { - while (parent.$options.abstract && parent.$parent) { - parent = parent.$parent; - } - parent.$children.push(vm); +function isKeyNotMatch (expect, actual) { + if (Array.isArray(expect)) { + return expect.indexOf(actual) === -1 + } else { + return expect !== actual } +} - vm.$parent = parent; - vm.$root = parent ? parent.$root : vm; - - vm.$children = []; - vm.$refs = {}; - - vm._watcher = null; - vm._inactive = null; - vm._directInactive = false; - vm._isMounted = false; - vm._isDestroyed = false; - vm._isBeingDestroyed = false; +/** + * Runtime helper for checking keyCodes from config. + * exposed as Vue.prototype._k + * passing in eventKeyName as last argument separately for backwards compat + */ +function checkKeyCodes ( + eventKeyCode, + key, + builtInKeyCode, + eventKeyName, + builtInKeyName +) { + var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; + if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { + return isKeyNotMatch(builtInKeyName, eventKeyName) + } else if (mappedKeyCode) { + return isKeyNotMatch(mappedKeyCode, eventKeyCode) + } else if (eventKeyName) { + return hyphenate(eventKeyName) !== key + } } -function lifecycleMixin (Vue) { - Vue.prototype._update = function (vnode, hydrating) { - var vm = this; - var prevEl = vm.$el; - var prevVnode = vm._vnode; - var restoreActiveInstance = setActiveInstance(vm); - vm._vnode = vnode; - // Vue.prototype.__patch__ is injected in entry points - // based on the rendering backend used. - if (!prevVnode) { - // initial render - vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); +/* */ + +/** + * Runtime helper for merging v-bind="object" into a VNode's data. + */ +function bindObjectProps ( + data, + tag, + value, + asProp, + isSync +) { + if (value) { + if (!isObject(value)) { + process.env.NODE_ENV !== 'production' && warn( + 'v-bind without argument expects an Object or Array value', + this + ); } else { - // updates - vm.$el = vm.__patch__(prevVnode, vnode); - } - restoreActiveInstance(); - // update __vue__ reference - if (prevEl) { - prevEl.__vue__ = null; - } - if (vm.$el) { - vm.$el.__vue__ = vm; - } - // if parent is an HOC, update its $el as well - if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { - vm.$parent.$el = vm.$el; - } - // updated hook is called by the scheduler to ensure that children are - // updated in a parent's updated hook. - }; + if (Array.isArray(value)) { + value = toObject(value); + } + var hash; + var loop = function ( key ) { + if ( + key === 'class' || + key === 'style' || + isReservedAttribute(key) + ) { + hash = data; + } else { + var type = data.attrs && data.attrs.type; + hash = asProp || config.mustUseProp(tag, type, key) + ? data.domProps || (data.domProps = {}) + : data.attrs || (data.attrs = {}); + } + var camelizedKey = camelize(key); + if (!(key in hash) && !(camelizedKey in hash)) { + hash[key] = value[key]; - Vue.prototype.$forceUpdate = function () { - var vm = this; - if (vm._watcher) { - vm._watcher.update(); - } - }; + if (isSync) { + var on = data.on || (data.on = {}); + on[("update:" + camelizedKey)] = function ($event) { + value[key] = $event; + }; + } + } + }; - Vue.prototype.$destroy = function () { - var vm = this; - if (vm._isBeingDestroyed) { - return - } - callHook(vm, 'beforeDestroy'); - vm._isBeingDestroyed = true; - // remove self from parent - var parent = vm.$parent; - if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { - remove(parent.$children, vm); - } - // teardown watchers - if (vm._watcher) { - vm._watcher.teardown(); - } - var i = vm._watchers.length; - while (i--) { - vm._watchers[i].teardown(); - } - // remove reference from data ob - // frozen object may not have observer. - if (vm._data.__ob__) { - vm._data.__ob__.vmCount--; - } - // call the last hook... - vm._isDestroyed = true; - // invoke destroy hooks on current rendered tree - vm.__patch__(vm._vnode, null); - // fire destroyed hook - callHook(vm, 'destroyed'); - // turn off all instance listeners. - vm.$off(); - // remove __vue__ reference - if (vm.$el) { - vm.$el.__vue__ = null; - } - // release circular reference (#6759) - if (vm.$vnode) { - vm.$vnode.parent = null; + for (var key in value) loop( key ); } - }; + } + return data } -function mountComponent ( - vm, - el, - hydrating +/* */ + +/** + * Runtime helper for rendering static trees. + */ +function renderStatic ( + index, + isInFor ) { - vm.$el = el; - if (!vm.$options.render) { - vm.$options.render = createEmptyVNode; - if (process.env.NODE_ENV !== 'production') { - /* istanbul ignore if */ - if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || - vm.$options.el || el) { - warn( - 'You are using the runtime-only build of Vue where the template ' + - 'compiler is not available. Either pre-compile the templates into ' + - 'render functions, or use the compiler-included build.', - vm - ); - } else { - warn( - 'Failed to mount component: template or render function not defined.', - vm - ); + var cached = this._staticTrees || (this._staticTrees = []); + var tree = cached[index]; + // if has already-rendered static tree and not inside v-for, + // we can reuse the same tree. + if (tree && !isInFor) { + return tree + } + // otherwise, render a fresh tree. + tree = cached[index] = this.$options.staticRenderFns[index].call( + this._renderProxy, + null, + this // for render fns generated for functional component templates + ); + markStatic(tree, ("__static__" + index), false); + return tree +} + +/** + * Runtime helper for v-once. + * Effectively it means marking the node as static with a unique key. + */ +function markOnce ( + tree, + index, + key +) { + markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); + return tree +} + +function markStatic ( + tree, + key, + isOnce +) { + if (Array.isArray(tree)) { + for (var i = 0; i < tree.length; i++) { + if (tree[i] && typeof tree[i] !== 'string') { + markStaticNode(tree[i], (key + "_" + i), isOnce); } } + } else { + markStaticNode(tree, key, isOnce); } - callHook(vm, 'beforeMount'); +} - var updateComponent; - /* istanbul ignore if */ - if (process.env.NODE_ENV !== 'production' && config.performance && mark) { - updateComponent = function () { - var name = vm._name; - var id = vm._uid; - var startTag = "vue-perf-start:" + id; - var endTag = "vue-perf-end:" + id; +function markStaticNode (node, key, isOnce) { + node.isStatic = true; + node.key = key; + node.isOnce = isOnce; +} - mark(startTag); - var vnode = vm._render(); - mark(endTag); - measure(("vue " + name + " render"), startTag, endTag); +/* */ - mark(startTag); - vm._update(vnode, hydrating); - mark(endTag); - measure(("vue " + name + " patch"), startTag, endTag); - }; - } else { - updateComponent = function () { - vm._update(vm._render(), hydrating); - }; +function bindObjectListeners (data, value) { + if (value) { + if (!isPlainObject(value)) { + process.env.NODE_ENV !== 'production' && warn( + 'v-on without argument expects an Object value', + this + ); + } else { + var on = data.on = data.on ? extend({}, data.on) : {}; + for (var key in value) { + var existing = on[key]; + var ours = value[key]; + on[key] = existing ? [].concat(existing, ours) : ours; + } + } } + return data +} - // we set this to vm._watcher inside the watcher's constructor - // since the watcher's initial patch may call $forceUpdate (e.g. inside child - // component's mounted hook), which relies on vm._watcher being already defined - new Watcher(vm, updateComponent, noop, { - before: function before () { - if (vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'beforeUpdate'); - } +/* */ + +function resolveScopedSlots ( + fns, // see flow/vnode + hasDynamicKeys, + res +) { + res = res || { $stable: !hasDynamicKeys }; + for (var i = 0; i < fns.length; i++) { + var slot = fns[i]; + if (Array.isArray(slot)) { + resolveScopedSlots(slot, hasDynamicKeys, res); + } else if (slot) { + res[slot.key] = slot.fn; } - }, true /* isRenderWatcher */); - hydrating = false; + } + return res +} - // manually mounted instance, call mounted on self - // mounted is called for render-created child components in its inserted hook - if (vm.$vnode == null) { - vm._isMounted = true; - callHook(vm, 'mounted'); +/* */ + +function bindDynamicKeys (baseObj, values) { + for (var i = 0; i < values.length; i += 2) { + var key = values[i]; + if (typeof key === 'string' && key) { + baseObj[values[i]] = values[i + 1]; + } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) { + // null is a speical value for explicitly removing a binding + warn( + ("Invalid value for dynamic directive argument (expected string or null): " + key), + this + ); + } } - return vm + return baseObj } -function updateChildComponent ( - vm, - propsData, - listeners, - parentVnode, - renderChildren +// helper to dynamically append modifier runtime markers to event names. +// ensure only append when value is already string, otherwise it will be cast +// to string and cause the type check to miss. +function prependModifier (value, symbol) { + return typeof value === 'string' ? symbol + value : value +} + +/* */ + +function installRenderHelpers (target) { + target._o = markOnce; + target._n = toNumber; + target._s = toString; + target._l = renderList; + target._t = renderSlot; + target._q = looseEqual; + target._i = looseIndexOf; + target._m = renderStatic; + target._f = resolveFilter; + target._k = checkKeyCodes; + target._b = bindObjectProps; + target._v = createTextVNode; + target._e = createEmptyVNode; + target._u = resolveScopedSlots; + target._g = bindObjectListeners; + target._d = bindDynamicKeys; + target._p = prependModifier; +} + +/* */ + +function FunctionalRenderContext ( + data, + props, + children, + parent, + Ctor ) { - if (process.env.NODE_ENV !== 'production') { - isUpdatingChildComponent = true; + var options = Ctor.options; + // ensure the createElement function in functional components + // gets a unique context - this is necessary for correct named slot check + var contextVm; + if (hasOwn(parent, '_uid')) { + contextVm = Object.create(parent); + // $flow-disable-line + contextVm._original = parent; + } else { + // the context vm passed in is a functional context as well. + // in this case we want to make sure we are able to get a hold to the + // real context instance. + contextVm = parent; + // $flow-disable-line + parent = parent._original; } + var isCompiled = isTrue(options._compiled); + var needNormalization = !isCompiled; - // determine whether component has slot children - // we need to do this before overwriting $options._renderChildren. + this.data = data; + this.props = props; + this.children = children; + this.parent = parent; + this.listeners = data.on || emptyObject; + this.injections = resolveInject(options.inject, parent); + this.slots = function () { return resolveSlots(children, parent); }; - // check if there are dynamic scopedSlots (hand-written or compiled but with - // dynamic slot names). Static scoped slots compiled from template has the - // "$stable" marker. - var hasDynamicScopedSlot = !!( - (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || - (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) - ); - // Any static slot children from the parent may have changed during parent's - // update. Dynamic scoped slots may also have changed. In such cases, a forced - // update is necessary to ensure correctness. - var needsForceUpdate = !!( - renderChildren || // has new static slots - vm.$options._renderChildren || // has old static slots - hasDynamicScopedSlot - ); + Object.defineProperty(this, 'scopedSlots', ({ + enumerable: true, + get: function get () { + return normalizeScopedSlots(data.scopedSlots, this.slots()) + } + })); - vm.$options._parentVnode = parentVnode; - vm.$vnode = parentVnode; // update vm's placeholder node without re-render + // support for compiled functional template + if (isCompiled) { + // exposing $options for renderStatic() + this.$options = options; + // pre-resolve slots for renderSlot() + this.$slots = this.slots(); + this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); + } - if (vm._vnode) { // update child tree's parent - vm._vnode.parent = parentVnode; + if (options._scopeId) { + this._c = function (a, b, c, d) { + var vnode = createElement(contextVm, a, b, c, d, needNormalization); + if (vnode && !Array.isArray(vnode)) { + vnode.fnScopeId = options._scopeId; + vnode.fnContext = parent; + } + return vnode + }; + } else { + this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; } - vm.$options._renderChildren = renderChildren; +} - // update $attrs and $listeners hash - // these are also reactive so they may trigger child update if the child - // used them during render - vm.$attrs = parentVnode.data.attrs || emptyObject; - vm.$listeners = listeners || emptyObject; +installRenderHelpers(FunctionalRenderContext.prototype); - // update props - if (propsData && vm.$options.props) { - toggleObserving(false); - var props = vm._props; - var propKeys = vm.$options._propKeys || []; - for (var i = 0; i < propKeys.length; i++) { - var key = propKeys[i]; - var propOptions = vm.$options.props; // wtf flow? - props[key] = validateProp(key, propOptions, propsData, vm); +function createFunctionalComponent ( + Ctor, + propsData, + data, + contextVm, + children +) { + var options = Ctor.options; + var props = {}; + var propOptions = options.props; + if (isDef(propOptions)) { + for (var key in propOptions) { + props[key] = validateProp(key, propOptions, propsData || emptyObject); } - toggleObserving(true); - // keep a copy of raw propsData - vm.$options.propsData = propsData; + } else { + if (isDef(data.attrs)) { mergeProps(props, data.attrs); } + if (isDef(data.props)) { mergeProps(props, data.props); } } - // update listeners - listeners = listeners || emptyObject; - var oldListeners = vm.$options._parentListeners; - vm.$options._parentListeners = listeners; - updateComponentListeners(vm, listeners, oldListeners); + var renderContext = new FunctionalRenderContext( + data, + props, + children, + contextVm, + Ctor + ); - // resolve slots + force update if has children - if (needsForceUpdate) { - vm.$slots = resolveSlots(renderChildren, parentVnode.context); - vm.$forceUpdate(); + var vnode = options.render.call(null, renderContext._c, renderContext); + + if (vnode instanceof VNode) { + return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) + } else if (Array.isArray(vnode)) { + var vnodes = normalizeChildren(vnode) || []; + var res = new Array(vnodes.length); + for (var i = 0; i < vnodes.length; i++) { + res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); + } + return res } +} +function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { + // #7817 clone node before setting fnContext, otherwise if the node is reused + // (e.g. it was from a cached normal slot) the fnContext causes named slots + // that should not be matched to match. + var clone = cloneVNode(vnode); + clone.fnContext = contextVm; + clone.fnOptions = options; if (process.env.NODE_ENV !== 'production') { - isUpdatingChildComponent = false; + (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; } + if (data.slot) { + (clone.data || (clone.data = {})).slot = data.slot; + } + return clone } -function isInInactiveTree (vm) { - while (vm && (vm = vm.$parent)) { - if (vm._inactive) { return true } +function mergeProps (to, from) { + for (var key in from) { + to[camelize(key)] = from[key]; } - return false } -function activateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = false; - if (isInInactiveTree(vm)) { - return - } - } else if (vm._directInactive) { - return - } - if (vm._inactive || vm._inactive === null) { - vm._inactive = false; - for (var i = 0; i < vm.$children.length; i++) { - activateChildComponent(vm.$children[i]); +/* */ + +/* */ + +/* */ + +/* */ + +// inline hooks to be invoked on component VNodes during patch +var componentVNodeHooks = { + init: function init (vnode, hydrating) { + if ( + vnode.componentInstance && + !vnode.componentInstance._isDestroyed && + vnode.data.keepAlive + ) { + // kept-alive components, treat as a patch + var mountedNode = vnode; // work around flow + componentVNodeHooks.prepatch(mountedNode, mountedNode); + } else { + var child = vnode.componentInstance = createComponentInstanceForVnode( + vnode, + activeInstance + ); + child.$mount(hydrating ? vnode.elm : undefined, hydrating); } - callHook(vm, 'activated'); - } -} + }, -function deactivateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = true; - if (isInInactiveTree(vm)) { - return + prepatch: function prepatch (oldVnode, vnode) { + var options = vnode.componentOptions; + var child = vnode.componentInstance = oldVnode.componentInstance; + updateChildComponent( + child, + options.propsData, // updated props + options.listeners, // updated listeners + vnode, // new parent vnode + options.children // new children + ); + }, + + insert: function insert (vnode) { + var context = vnode.context; + var componentInstance = vnode.componentInstance; + if (!componentInstance._isMounted) { + componentInstance._isMounted = true; + callHook(componentInstance, 'mounted'); } - } - if (!vm._inactive) { - vm._inactive = true; - for (var i = 0; i < vm.$children.length; i++) { - deactivateChildComponent(vm.$children[i]); + if (vnode.data.keepAlive) { + if (context._isMounted) { + // vue-router#1212 + // During updates, a kept-alive component's child components may + // change, so directly walking the tree here may call activated hooks + // on incorrect children. Instead we push them into a queue which will + // be processed after the whole patch process ended. + queueActivatedComponent(componentInstance); + } else { + activateChildComponent(componentInstance, true /* direct */); + } } - callHook(vm, 'deactivated'); - } -} + }, -function callHook (vm, hook) { - // #7573 disable dep collection when invoking lifecycle hooks - pushTarget(); - var handlers = vm.$options[hook]; - var info = hook + " hook"; - if (handlers) { - for (var i = 0, j = handlers.length; i < j; i++) { - invokeWithErrorHandling(handlers[i], vm, null, vm, info); + destroy: function destroy (vnode) { + var componentInstance = vnode.componentInstance; + if (!componentInstance._isDestroyed) { + if (!vnode.data.keepAlive) { + componentInstance.$destroy(); + } else { + deactivateChildComponent(componentInstance, true /* direct */); + } } } - if (vm._hasHookEvent) { - vm.$emit('hook:' + hook); - } - popTarget(); -} +}; -/* */ +var hooksToMerge = Object.keys(componentVNodeHooks); -var MAX_UPDATE_COUNT = 100; +function createComponent ( + Ctor, + data, + context, + children, + tag +) { + if (isUndef(Ctor)) { + return + } -var queue = []; -var activatedChildren = []; -var has = {}; -var circular = {}; -var waiting = false; -var flushing = false; -var index = 0; + var baseCtor = context.$options._base; -/** - * Reset the scheduler's state. - */ -function resetSchedulerState () { - index = queue.length = activatedChildren.length = 0; - has = {}; - if (process.env.NODE_ENV !== 'production') { - circular = {}; + // plain options object: turn it into a constructor + if (isObject(Ctor)) { + Ctor = baseCtor.extend(Ctor); } - waiting = flushing = false; -} -// Async edge case #6566 requires saving the timestamp when event listeners are -// attached. However, calling performance.now() has a perf overhead especially -// if the page has thousands of event listeners. Instead, we take a timestamp -// every time the scheduler flushes and use that for all event listeners -// attached during that flush. -var currentFlushTimestamp = 0; + // if at this stage it's not a constructor or an async component factory, + // reject. + if (typeof Ctor !== 'function') { + if (process.env.NODE_ENV !== 'production') { + warn(("Invalid Component definition: " + (String(Ctor))), context); + } + return + } -// Async edge case fix requires storing an event listener's attach timestamp. -var getNow = Date.now; + // async component + var asyncFactory; + if (isUndef(Ctor.cid)) { + asyncFactory = Ctor; + Ctor = resolveAsyncComponent(asyncFactory, baseCtor); + if (Ctor === undefined) { + // return a placeholder node for async component, which is rendered + // as a comment node but preserves all the raw information for the node. + // the information will be used for async server-rendering and hydration. + return createAsyncPlaceholder( + asyncFactory, + data, + context, + children, + tag + ) + } + } -// Determine what event timestamp the browser is using. Annoyingly, the -// timestamp can either be hi-res ( relative to poge load) or low-res -// (relative to UNIX epoch), so in order to compare time we have to use the -// same timestamp type when saving the flush timestamp. -if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { - // if the low-res timestamp which is bigger than the event timestamp - // (which is evaluated AFTER) it means the event is using a hi-res timestamp, - // and we need to use the hi-res version for event listeners as well. - getNow = function () { return performance.now(); }; -} + data = data || {}; -/** - * Flush both queues and run the watchers. - */ -function flushSchedulerQueue () { - currentFlushTimestamp = getNow(); - flushing = true; - var watcher, id; + // resolve constructor options in case global mixins are applied after + // component constructor creation + resolveConstructorOptions(Ctor); - // Sort queue before flush. - // This ensures that: - // 1. Components are updated from parent to child. (because parent is always - // created before the child) - // 2. A component's user watchers are run before its render watcher (because - // user watchers are created before the render watcher) - // 3. If a component is destroyed during a parent component's watcher run, - // its watchers can be skipped. - queue.sort(function (a, b) { return a.id - b.id; }); + // transform component v-model data into props & events + if (isDef(data.model)) { + transformModel(Ctor.options, data); + } - // do not cache length because more watchers might be pushed - // as we run existing watchers - for (index = 0; index < queue.length; index++) { - watcher = queue[index]; - if (watcher.before) { - watcher.before(); - } - id = watcher.id; - has[id] = null; - watcher.run(); - // in dev build, check and stop circular updates. - if (process.env.NODE_ENV !== 'production' && has[id] != null) { - circular[id] = (circular[id] || 0) + 1; - if (circular[id] > MAX_UPDATE_COUNT) { - warn( - 'You may have an infinite update loop ' + ( - watcher.user - ? ("in watcher with expression \"" + (watcher.expression) + "\"") - : "in a component render function." - ), - watcher.vm - ); - break - } + // extract props + var propsData = extractPropsFromVNodeData(data, Ctor, tag); + + // functional component + if (isTrue(Ctor.options.functional)) { + return createFunctionalComponent(Ctor, propsData, data, context, children) + } + + // extract listeners, since these needs to be treated as + // child component listeners instead of DOM listeners + var listeners = data.on; + // replace with listeners with .native modifier + // so it gets processed during parent component patch. + data.on = data.nativeOn; + + if (isTrue(Ctor.options.abstract)) { + // abstract components do not keep anything + // other than props & listeners & slot + + // work around flow + var slot = data.slot; + data = {}; + if (slot) { + data.slot = slot; } } - // keep copies of post queues before resetting state - var activatedQueue = activatedChildren.slice(); - var updatedQueue = queue.slice(); + // install component management hooks onto the placeholder node + installComponentHooks(data); - resetSchedulerState(); + // return a placeholder vnode + var name = Ctor.options.name || tag; + var vnode = new VNode( + ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), + data, undefined, undefined, undefined, context, + { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, + asyncFactory + ); - // call component updated and activated hooks - callActivatedHooks(activatedQueue); - callUpdatedHooks(updatedQueue); + return vnode +} - // devtool hook - /* istanbul ignore if */ - if (devtools && config.devtools) { - devtools.emit('flush'); +function createComponentInstanceForVnode ( + vnode, // we know it's MountedComponentVNode but flow doesn't + parent // activeInstance in lifecycle state +) { + var options = { + _isComponent: true, + _parentVnode: vnode, + parent: parent + }; + // check inline-template render functions + var inlineTemplate = vnode.data.inlineTemplate; + if (isDef(inlineTemplate)) { + options.render = inlineTemplate.render; + options.staticRenderFns = inlineTemplate.staticRenderFns; } + return new vnode.componentOptions.Ctor(options) } -function callUpdatedHooks (queue) { - var i = queue.length; - while (i--) { - var watcher = queue[i]; - var vm = watcher.vm; - if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'updated'); +function installComponentHooks (data) { + var hooks = data.hook || (data.hook = {}); + for (var i = 0; i < hooksToMerge.length; i++) { + var key = hooksToMerge[i]; + var existing = hooks[key]; + var toMerge = componentVNodeHooks[key]; + if (existing !== toMerge && !(existing && existing._merged)) { + hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; } } } -/** - * Queue a kept-alive component that was activated during patch. - * The queue will be processed after the entire tree has been patched. - */ -function queueActivatedComponent (vm) { - // setting _inactive to false here so that a render function can - // rely on checking whether it's in an inactive tree (e.g. router-view) - vm._inactive = false; - activatedChildren.push(vm); -} - -function callActivatedHooks (queue) { - for (var i = 0; i < queue.length; i++) { - queue[i]._inactive = true; - activateChildComponent(queue[i], true /* true */); - } +function mergeHook$1 (f1, f2) { + var merged = function (a, b) { + // flow complains about extra args which is why we use any + f1(a, b); + f2(a, b); + }; + merged._merged = true; + return merged } -/** - * Push a watcher into the watcher queue. - * Jobs with duplicate IDs will be skipped unless it's - * pushed when the queue is being flushed. - */ -function queueWatcher (watcher) { - var id = watcher.id; - if (has[id] == null) { - has[id] = true; - if (!flushing) { - queue.push(watcher); - } else { - // if already flushing, splice the watcher based on its id - // if already past its id, it will be run next immediately. - var i = queue.length - 1; - while (i > index && queue[i].id > watcher.id) { - i--; - } - queue.splice(i + 1, 0, watcher); - } - // queue the flush - if (!waiting) { - waiting = true; - - if (process.env.NODE_ENV !== 'production' && !config.async) { - flushSchedulerQueue(); - return - } - nextTick(flushSchedulerQueue); +// transform component v-model info (value and callback) into +// prop and event handler respectively. +function transformModel (options, data) { + var prop = (options.model && options.model.prop) || 'value'; + var event = (options.model && options.model.event) || 'input' + ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; + var on = data.on || (data.on = {}); + var existing = on[event]; + var callback = data.model.callback; + if (isDef(existing)) { + if ( + Array.isArray(existing) + ? existing.indexOf(callback) === -1 + : existing !== callback + ) { + on[event] = [callback].concat(existing); } + } else { + on[event] = callback; } } /* */ +var SIMPLE_NORMALIZE = 1; +var ALWAYS_NORMALIZE = 2; +// wrapper function for providing a more flexible interface +// without getting yelled at by flow +function createElement ( + context, + tag, + data, + children, + normalizationType, + alwaysNormalize +) { + if (Array.isArray(data) || isPrimitive(data)) { + normalizationType = children; + children = data; + data = undefined; + } + if (isTrue(alwaysNormalize)) { + normalizationType = ALWAYS_NORMALIZE; + } + return _createElement(context, tag, data, children, normalizationType) +} -var uid$1 = 0; - -/** - * A watcher parses an expression, collects dependencies, - * and fires callback when the expression value changes. - * This is used for both the $watch() api and directives. - */ -var Watcher = function Watcher ( - vm, - expOrFn, - cb, - options, - isRenderWatcher +function _createElement ( + context, + tag, + data, + children, + normalizationType ) { - this.vm = vm; - if (isRenderWatcher) { - vm._watcher = this; + if (isDef(data) && isDef((data).__ob__)) { + process.env.NODE_ENV !== 'production' && warn( + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + + 'Always create fresh vnode data objects in each render!', + context + ); + return createEmptyVNode() } - vm._watchers.push(this); - // options - if (options) { - this.deep = !!options.deep; - this.user = !!options.user; - this.lazy = !!options.lazy; - this.sync = !!options.sync; - this.before = options.before; + // object syntax in v-bind + if (isDef(data) && isDef(data.is)) { + tag = data.is; + } + if (!tag) { + // in case of component :is set to falsy value + return createEmptyVNode() + } + // warn against non-primitive key + if (process.env.NODE_ENV !== 'production' && + isDef(data) && isDef(data.key) && !isPrimitive(data.key) + ) { + { + warn( + 'Avoid using non-primitive value as key, ' + + 'use string/number value instead.', + context + ); + } + } + // support single function children as default scoped slot + if (Array.isArray(children) && + typeof children[0] === 'function' + ) { + data = data || {}; + data.scopedSlots = { default: children[0] }; + children.length = 0; + } + if (normalizationType === ALWAYS_NORMALIZE) { + children = normalizeChildren(children); + } else if (normalizationType === SIMPLE_NORMALIZE) { + children = simpleNormalizeChildren(children); + } + var vnode, ns; + if (typeof tag === 'string') { + var Ctor; + ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); + if (config.isReservedTag(tag)) { + // platform built-in elements + vnode = new VNode( + config.parsePlatformTagName(tag), data, children, + undefined, undefined, context + ); + } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { + // component + vnode = createComponent(Ctor, data, context, children, tag); + } else { + // unknown or unlisted namespaced elements + // check at runtime because it may get assigned a namespace when its + // parent normalizes children + vnode = new VNode( + tag, data, children, + undefined, undefined, context + ); + } } else { - this.deep = this.user = this.lazy = this.sync = false; + // direct component options / constructor + vnode = createComponent(tag, data, context, children); } - this.cb = cb; - this.id = ++uid$1; // uid for batching - this.active = true; - this.dirty = this.lazy; // for lazy watchers - this.deps = []; - this.newDeps = []; - this.depIds = new _Set(); - this.newDepIds = new _Set(); - this.expression = process.env.NODE_ENV !== 'production' - ? expOrFn.toString() - : ''; - // parse expression for getter - if (typeof expOrFn === 'function') { - this.getter = expOrFn; + if (Array.isArray(vnode)) { + return vnode + } else if (isDef(vnode)) { + if (isDef(ns)) { applyNS(vnode, ns); } + if (isDef(data)) { registerDeepBindings(data); } + return vnode } else { - this.getter = parsePath(expOrFn); - if (!this.getter) { - this.getter = noop; - process.env.NODE_ENV !== 'production' && warn( - "Failed watching path: \"" + expOrFn + "\" " + - 'Watcher only accepts simple dot-delimited paths. ' + - 'For full control, use a function instead.', - vm - ); - } + return createEmptyVNode() } - this.value = this.lazy - ? undefined - : this.get(); -}; +} -/** - * Evaluate the getter, and re-collect dependencies. - */ -Watcher.prototype.get = function get () { - pushTarget(this); - var value; - var vm = this.vm; - try { - value = this.getter.call(vm, vm); - } catch (e) { - if (this.user) { - handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); - } else { - throw e - } - } finally { - // "touch" every property so they are all tracked as - // dependencies for deep watching - if (this.deep) { - traverse(value); - } - popTarget(); - this.cleanupDeps(); +function applyNS (vnode, ns, force) { + vnode.ns = ns; + if (vnode.tag === 'foreignObject') { + // use default namespace inside foreignObject + ns = undefined; + force = true; } - return value -}; - -/** - * Add a dependency to this directive. - */ -Watcher.prototype.addDep = function addDep (dep) { - var id = dep.id; - if (!this.newDepIds.has(id)) { - this.newDepIds.add(id); - this.newDeps.push(dep); - if (!this.depIds.has(id)) { - dep.addSub(this); + if (isDef(vnode.children)) { + for (var i = 0, l = vnode.children.length; i < l; i++) { + var child = vnode.children[i]; + if (isDef(child.tag) && ( + isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { + applyNS(child, ns, force); + } } } -}; +} -/** - * Clean up for dependency collection. - */ -Watcher.prototype.cleanupDeps = function cleanupDeps () { - var i = this.deps.length; - while (i--) { - var dep = this.deps[i]; - if (!this.newDepIds.has(dep.id)) { - dep.removeSub(this); - } +// ref #5318 +// necessary to ensure parent re-render when deep bindings like :style and +// :class are used on slot nodes +function registerDeepBindings (data) { + if (isObject(data.style)) { + traverse(data.style); } - var tmp = this.depIds; - this.depIds = this.newDepIds; - this.newDepIds = tmp; - this.newDepIds.clear(); - tmp = this.deps; - this.deps = this.newDeps; - this.newDeps = tmp; - this.newDeps.length = 0; -}; + if (isObject(data.class)) { + traverse(data.class); + } +} + +/* */ + +function initRender (vm) { + vm._vnode = null; // the root of the child tree + vm._staticTrees = null; // v-once cached trees + var options = vm.$options; + var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree + var renderContext = parentVnode && parentVnode.context; + vm.$slots = resolveSlots(options._renderChildren, renderContext); + vm.$scopedSlots = emptyObject; + // bind the createElement fn to this instance + // so that we get proper render context inside it. + // args order: tag, data, children, normalizationType, alwaysNormalize + // internal version is used by render functions compiled from templates + vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; + // normalization is always applied for the public version, used in + // user-written render functions. + vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; + + // $attrs & $listeners are exposed for easier HOC creation. + // they need to be reactive so that HOCs using them are always updated + var parentData = parentVnode && parentVnode.data; -/** - * Subscriber interface. - * Will be called when a dependency changes. - */ -Watcher.prototype.update = function update () { /* istanbul ignore else */ - if (this.lazy) { - this.dirty = true; - } else if (this.sync) { - this.run(); + if (process.env.NODE_ENV !== 'production') { + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { + !isUpdatingChildComponent && warn("$attrs is readonly.", vm); + }, true); + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { + !isUpdatingChildComponent && warn("$listeners is readonly.", vm); + }, true); } else { - queueWatcher(this); + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true); + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true); } -}; +} -/** - * Scheduler job interface. - * Will be called by the scheduler. - */ -Watcher.prototype.run = function run () { - if (this.active) { - var value = this.get(); - if ( - value !== this.value || - // Deep watchers and watchers on Object/Arrays should fire even - // when the value is the same, because the value may - // have mutated. - isObject(value) || - this.deep - ) { - // set new value - var oldValue = this.value; - this.value = value; - if (this.user) { - try { - this.cb.call(this.vm, value, oldValue); - } catch (e) { - handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); - } - } else { - this.cb.call(this.vm, value, oldValue); - } - } - } -}; +var currentRenderingInstance = null; -/** - * Evaluate the value of the watcher. - * This only gets called for lazy watchers. - */ -Watcher.prototype.evaluate = function evaluate () { - this.value = this.get(); - this.dirty = false; -}; +function renderMixin (Vue) { + // install runtime convenience helpers + installRenderHelpers(Vue.prototype); -/** - * Depend on all deps collected by this watcher. - */ -Watcher.prototype.depend = function depend () { - var i = this.deps.length; - while (i--) { - this.deps[i].depend(); - } -}; + Vue.prototype.$nextTick = function (fn) { + return nextTick(fn, this) + }; -/** - * Remove self from all dependencies' subscriber list. - */ -Watcher.prototype.teardown = function teardown () { - if (this.active) { - // remove self from vm's watcher list - // this is a somewhat expensive operation so we skip it - // if the vm is being destroyed. - if (!this.vm._isBeingDestroyed) { - remove(this.vm._watchers, this); + Vue.prototype._render = function () { + var vm = this; + var ref = vm.$options; + var render = ref.render; + var _parentVnode = ref._parentVnode; + + if (_parentVnode) { + vm.$scopedSlots = normalizeScopedSlots( + _parentVnode.data.scopedSlots, + vm.$slots + ); + } + + // set parent vnode. this allows render functions to have access + // to the data on the placeholder node. + vm.$vnode = _parentVnode; + // render self + var vnode; + try { + // There's no need to maintain a stack becaues all render fns are called + // separately from one another. Nested component's render fns are called + // when parent component is patched. + currentRenderingInstance = vm; + vnode = render.call(vm._renderProxy, vm.$createElement); + } catch (e) { + handleError(e, vm, "render"); + // return error render result, + // or previous vnode to prevent render error causing blank component + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) { + try { + vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); + } catch (e) { + handleError(e, vm, "renderError"); + vnode = vm._vnode; + } + } else { + vnode = vm._vnode; + } + } finally { + currentRenderingInstance = null; } - var i = this.deps.length; - while (i--) { - this.deps[i].removeSub(this); + // if the returned array contains only a single node, allow it + if (Array.isArray(vnode) && vnode.length === 1) { + vnode = vnode[0]; } - this.active = false; - } -}; + // return empty vnode in case the render function errored out + if (!(vnode instanceof VNode)) { + if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) { + warn( + 'Multiple root nodes returned from render function. Render function ' + + 'should return a single root node.', + vm + ); + } + vnode = createEmptyVNode(); + } + // set parent + vnode.parent = _parentVnode; + return vnode + }; +} /* */ -var sharedPropertyDefinition = { - enumerable: true, - configurable: true, - get: noop, - set: noop -}; +function ensureCtor (comp, base) { + if ( + comp.__esModule || + (hasSymbol && comp[Symbol.toStringTag] === 'Module') + ) { + comp = comp.default; + } + return isObject(comp) + ? base.extend(comp) + : comp +} -function proxy (target, sourceKey, key) { - sharedPropertyDefinition.get = function proxyGetter () { - return this[sourceKey][key] - }; - sharedPropertyDefinition.set = function proxySetter (val) { - this[sourceKey][key] = val; - }; - Object.defineProperty(target, key, sharedPropertyDefinition); +function createAsyncPlaceholder ( + factory, + data, + context, + children, + tag +) { + var node = createEmptyVNode(); + node.asyncFactory = factory; + node.asyncMeta = { data: data, context: context, children: children, tag: tag }; + return node } -function initState (vm) { - vm._watchers = []; - var opts = vm.$options; - if (opts.props) { initProps(vm, opts.props); } - if (opts.methods) { initMethods(vm, opts.methods); } - if (opts.data) { - initData(vm); - } else { - observe(vm._data = {}, true /* asRootData */); +function resolveAsyncComponent ( + factory, + baseCtor +) { + if (isTrue(factory.error) && isDef(factory.errorComp)) { + return factory.errorComp } - if (opts.computed) { initComputed(vm, opts.computed); } - if (opts.watch && opts.watch !== nativeWatch) { - initWatch(vm, opts.watch); + + if (isDef(factory.resolved)) { + return factory.resolved } -} -function initProps (vm, propsOptions) { - var propsData = vm.$options.propsData || {}; - var props = vm._props = {}; - // cache prop keys so that future props updates can iterate using Array - // instead of dynamic object key enumeration. - var keys = vm.$options._propKeys = []; - var isRoot = !vm.$parent; - // root instance props should be converted - if (!isRoot) { - toggleObserving(false); + if (isTrue(factory.loading) && isDef(factory.loadingComp)) { + return factory.loadingComp } - var loop = function ( key ) { - keys.push(key); - var value = validateProp(key, propsOptions, propsData, vm); - /* istanbul ignore else */ - if (process.env.NODE_ENV !== 'production') { - var hyphenatedKey = hyphenate(key); - if (isReservedAttribute(hyphenatedKey) || - config.isReservedAttr(hyphenatedKey)) { - warn( - ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), - vm - ); + + var owner = currentRenderingInstance; + if (isDef(factory.owners)) { + // already pending + factory.owners.push(owner); + } else { + var owners = factory.owners = [owner]; + var sync = true; + + var forceRender = function (renderCompleted) { + for (var i = 0, l = owners.length; i < l; i++) { + (owners[i]).$forceUpdate(); } - defineReactive$$1(props, key, value, function () { - if (!isRoot && !isUpdatingChildComponent) { - warn( - "Avoid mutating a prop directly since the value will be " + - "overwritten whenever the parent component re-renders. " + - "Instead, use a data or computed property based on the prop's " + - "value. Prop being mutated: \"" + key + "\"", - vm - ); - } - }); - } else { - defineReactive$$1(props, key, value); - } - // static props are already proxied on the component's prototype - // during Vue.extend(). We only need to proxy props defined at - // instantiation here. - if (!(key in vm)) { - proxy(vm, "_props", key); - } - }; - for (var key in propsOptions) loop( key ); - toggleObserving(true); -} + if (renderCompleted) { + owners.length = 0; + } + }; -function initData (vm) { - var data = vm.$options.data; - data = vm._data = typeof data === 'function' - ? getData(data, vm) - : data || {}; - if (!isPlainObject(data)) { - data = {}; - process.env.NODE_ENV !== 'production' && warn( - 'data functions should return an object:\n' + - 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', - vm - ); - } - // proxy data on instance - var keys = Object.keys(data); - var props = vm.$options.props; - var methods = vm.$options.methods; - var i = keys.length; - while (i--) { - var key = keys[i]; - if (process.env.NODE_ENV !== 'production') { - if (methods && hasOwn(methods, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a data property."), - vm - ); + var resolve = once(function (res) { + // cache resolved + factory.resolved = ensureCtor(res, baseCtor); + // invoke callbacks only if this is not a synchronous resolve + // (async resolves are shimmed as synchronous during SSR) + if (!sync) { + forceRender(true); + } else { + owners.length = 0; } - } - if (props && hasOwn(props, key)) { + }); + + var reject = once(function (reason) { process.env.NODE_ENV !== 'production' && warn( - "The data property \"" + key + "\" is already declared as a prop. " + - "Use prop default value instead.", - vm + "Failed to resolve async component: " + (String(factory)) + + (reason ? ("\nReason: " + reason) : '') ); - } else if (!isReserved(key)) { - proxy(vm, "_data", key); + if (isDef(factory.errorComp)) { + factory.error = true; + forceRender(true); + } + }); + + var res = factory(resolve, reject); + + if (isObject(res)) { + if (isPromise(res)) { + // () => Promise + if (isUndef(factory.resolved)) { + res.then(resolve, reject); + } + } else if (isPromise(res.component)) { + res.component.then(resolve, reject); + + if (isDef(res.error)) { + factory.errorComp = ensureCtor(res.error, baseCtor); + } + + if (isDef(res.loading)) { + factory.loadingComp = ensureCtor(res.loading, baseCtor); + if (res.delay === 0) { + factory.loading = true; + } else { + setTimeout(function () { + if (isUndef(factory.resolved) && isUndef(factory.error)) { + factory.loading = true; + forceRender(false); + } + }, res.delay || 200); + } + } + + if (isDef(res.timeout)) { + setTimeout(function () { + if (isUndef(factory.resolved)) { + reject( + process.env.NODE_ENV !== 'production' + ? ("timeout (" + (res.timeout) + "ms)") + : null + ); + } + }, res.timeout); + } + } } - } - // observe data - observe(data, true /* asRootData */); -} -function getData (data, vm) { - // #7573 disable dep collection when invoking data getters - pushTarget(); - try { - return data.call(vm, vm) - } catch (e) { - handleError(e, vm, "data()"); - return {} - } finally { - popTarget(); + sync = false; + // return in case resolved synchronously + return factory.loading + ? factory.loadingComp + : factory.resolved } } -var computedWatcherOptions = { lazy: true }; - -function initComputed (vm, computed) { - // $flow-disable-line - var watchers = vm._computedWatchers = Object.create(null); - // computed properties are just getters during SSR - var isSSR = isServerRendering(); +/* */ - for (var key in computed) { - var userDef = computed[key]; - var getter = typeof userDef === 'function' ? userDef : userDef.get; - if (process.env.NODE_ENV !== 'production' && getter == null) { - warn( - ("Getter is missing for computed property \"" + key + "\"."), - vm - ); - } +function isAsyncPlaceholder (node) { + return node.isComment && node.asyncFactory +} - if (!isSSR) { - // create internal watcher for the computed property. - watchers[key] = new Watcher( - vm, - getter || noop, - noop, - computedWatcherOptions - ); - } +/* */ - // component-defined computed properties are already defined on the - // component prototype. We only need to define computed properties defined - // at instantiation here. - if (!(key in vm)) { - defineComputed(vm, key, userDef); - } else if (process.env.NODE_ENV !== 'production') { - if (key in vm.$data) { - warn(("The computed property \"" + key + "\" is already defined in data."), vm); - } else if (vm.$options.props && key in vm.$options.props) { - warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); +function getFirstComponentChild (children) { + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + var c = children[i]; + if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { + return c } } } } -function defineComputed ( - target, - key, - userDef -) { - var shouldCache = !isServerRendering(); - if (typeof userDef === 'function') { - sharedPropertyDefinition.get = shouldCache - ? createComputedGetter(key) - : createGetterInvoker(userDef); - sharedPropertyDefinition.set = noop; - } else { - sharedPropertyDefinition.get = userDef.get - ? shouldCache && userDef.cache !== false - ? createComputedGetter(key) - : createGetterInvoker(userDef.get) - : noop; - sharedPropertyDefinition.set = userDef.set || noop; - } - if (process.env.NODE_ENV !== 'production' && - sharedPropertyDefinition.set === noop) { - sharedPropertyDefinition.set = function () { - warn( - ("Computed property \"" + key + "\" was assigned to but it has no setter."), - this - ); - }; - } - Object.defineProperty(target, key, sharedPropertyDefinition); -} +/* */ -function createComputedGetter (key) { - return function computedGetter () { - var watcher = this._computedWatchers && this._computedWatchers[key]; - if (watcher) { - if (watcher.dirty) { - watcher.evaluate(); - } - if (Dep.target) { - watcher.depend(); - } - return watcher.value - } +/* */ + +function initEvents (vm) { + vm._events = Object.create(null); + vm._hasHookEvent = false; + // init parent attached events + var listeners = vm.$options._parentListeners; + if (listeners) { + updateComponentListeners(vm, listeners); } } -function createGetterInvoker(fn) { - return function computedGetter () { - return fn.call(this, this) - } +var target; + +function add (event, fn) { + target.$on(event, fn); } -function initMethods (vm, methods) { - var props = vm.$options.props; - for (var key in methods) { - if (process.env.NODE_ENV !== 'production') { - if (typeof methods[key] !== 'function') { - warn( - "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + - "Did you reference the function correctly?", - vm - ); - } - if (props && hasOwn(props, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a prop."), - vm - ); - } - if ((key in vm) && isReserved(key)) { - warn( - "Method \"" + key + "\" conflicts with an existing Vue instance method. " + - "Avoid defining component methods that start with _ or $." - ); - } - } - vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); - } +function remove$1 (event, fn) { + target.$off(event, fn); } -function initWatch (vm, watch) { - for (var key in watch) { - var handler = watch[key]; - if (Array.isArray(handler)) { - for (var i = 0; i < handler.length; i++) { - createWatcher(vm, key, handler[i]); - } - } else { - createWatcher(vm, key, handler); +function createOnceHandler (event, fn) { + var _target = target; + return function onceHandler () { + var res = fn.apply(null, arguments); + if (res !== null) { + _target.$off(event, onceHandler); } } } -function createWatcher ( +function updateComponentListeners ( vm, - expOrFn, - handler, - options + listeners, + oldListeners ) { - if (isPlainObject(handler)) { - options = handler; - handler = handler.handler; - } - if (typeof handler === 'string') { - handler = vm[handler]; - } - return vm.$watch(expOrFn, handler, options) + target = vm; + updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); + target = undefined; } -function stateMixin (Vue) { - // flow somehow has problems with directly declared definition object - // when using Object.defineProperty, so we have to procedurally build up - // the object here. - var dataDef = {}; - dataDef.get = function () { return this._data }; - var propsDef = {}; - propsDef.get = function () { return this._props }; - if (process.env.NODE_ENV !== 'production') { - dataDef.set = function () { - warn( - 'Avoid replacing instance root $data. ' + - 'Use nested data properties instead.', - this - ); - }; - propsDef.set = function () { - warn("$props is readonly.", this); - }; - } - Object.defineProperty(Vue.prototype, '$data', dataDef); - Object.defineProperty(Vue.prototype, '$props', propsDef); +function eventsMixin (Vue) { + var hookRE = /^hook:/; + Vue.prototype.$on = function (event, fn) { + var vm = this; + if (Array.isArray(event)) { + for (var i = 0, l = event.length; i < l; i++) { + vm.$on(event[i], fn); + } + } else { + (vm._events[event] || (vm._events[event] = [])).push(fn); + // optimize hook:event cost by using a boolean flag marked at registration + // instead of a hash lookup + if (hookRE.test(event)) { + vm._hasHookEvent = true; + } + } + return vm + }; - Vue.prototype.$set = set; - Vue.prototype.$delete = del; + Vue.prototype.$once = function (event, fn) { + var vm = this; + function on () { + vm.$off(event, on); + fn.apply(vm, arguments); + } + on.fn = fn; + vm.$on(event, on); + return vm + }; - Vue.prototype.$watch = function ( - expOrFn, - cb, - options - ) { + Vue.prototype.$off = function (event, fn) { var vm = this; - if (isPlainObject(cb)) { - return createWatcher(vm, expOrFn, cb, options) + // all + if (!arguments.length) { + vm._events = Object.create(null); + return vm + } + // array of events + if (Array.isArray(event)) { + for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { + vm.$off(event[i$1], fn); + } + return vm + } + // specific event + var cbs = vm._events[event]; + if (!cbs) { + return vm + } + if (!fn) { + vm._events[event] = null; + return vm + } + // specific handler + var cb; + var i = cbs.length; + while (i--) { + cb = cbs[i]; + if (cb === fn || cb.fn === fn) { + cbs.splice(i, 1); + break + } } - options = options || {}; - options.user = true; - var watcher = new Watcher(vm, expOrFn, cb, options); - if (options.immediate) { - try { - cb.call(vm, watcher.value); - } catch (error) { - handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); + return vm + }; + + Vue.prototype.$emit = function (event) { + var vm = this; + if (process.env.NODE_ENV !== 'production') { + var lowerCaseEvent = event.toLowerCase(); + if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { + tip( + "Event \"" + lowerCaseEvent + "\" is emitted in component " + + (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + + "Note that HTML attributes are case-insensitive and you cannot use " + + "v-on to listen to camelCase events when using in-DOM templates. " + + "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." + ); } } - return function unwatchFn () { - watcher.teardown(); + var cbs = vm._events[event]; + if (cbs) { + cbs = cbs.length > 1 ? toArray(cbs) : cbs; + var args = toArray(arguments, 1); + var info = "event handler for \"" + event + "\""; + for (var i = 0, l = cbs.length; i < l; i++) { + invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } } + return vm }; } /* */ -function initProvide (vm) { - var provide = vm.$options.provide; - if (provide) { - vm._provided = typeof provide === 'function' - ? provide.call(vm) - : provide; - } -} +var activeInstance = null; +var isUpdatingChildComponent = false; -function initInjections (vm) { - var result = resolveInject(vm.$options.inject, vm); - if (result) { - toggleObserving(false); - Object.keys(result).forEach(function (key) { - /* istanbul ignore else */ - if (process.env.NODE_ENV !== 'production') { - defineReactive$$1(vm, key, result[key], function () { - warn( - "Avoid mutating an injected value directly since the changes will be " + - "overwritten whenever the provided component re-renders. " + - "injection being mutated: \"" + key + "\"", - vm - ); - }); - } else { - defineReactive$$1(vm, key, result[key]); - } - }); - toggleObserving(true); +function setActiveInstance(vm) { + var prevActiveInstance = activeInstance; + activeInstance = vm; + return function () { + activeInstance = prevActiveInstance; } } -function resolveInject (inject, vm) { - if (inject) { - // inject is :any because flow is not smart enough to figure out cached - var result = Object.create(null); - var keys = hasSymbol - ? Reflect.ownKeys(inject) - : Object.keys(inject); +function initLifecycle (vm) { + var options = vm.$options; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - // #6574 in case the inject object is observed... - if (key === '__ob__') { continue } - var provideKey = inject[key].from; - var source = vm; - while (source) { - if (source._provided && hasOwn(source._provided, provideKey)) { - result[key] = source._provided[provideKey]; - break - } - source = source.$parent; - } - if (!source) { - if ('default' in inject[key]) { - var provideDefault = inject[key].default; - result[key] = typeof provideDefault === 'function' - ? provideDefault.call(vm) - : provideDefault; - } else if (process.env.NODE_ENV !== 'production') { - warn(("Injection \"" + key + "\" not found"), vm); - } - } + // locate first non-abstract parent + var parent = options.parent; + if (parent && !options.abstract) { + while (parent.$options.abstract && parent.$parent) { + parent = parent.$parent; } - return result + parent.$children.push(vm); } -} -/* */ - -function normalizeScopedSlots ( - slots, - normalSlots -) { - var res; - if (!slots) { - res = {}; - } else if (slots._normalized) { - return slots - } else { - res = {}; - for (var key in slots) { - if (slots[key] && key[0] !== '$') { - res[key] = normalizeScopedSlot(normalSlots, key, slots[key]); - } - } - } - // expose normal slots on scopedSlots - for (var key$1 in normalSlots) { - if (!(key$1 in res)) { - res[key$1] = proxyNormalSlot(normalSlots, key$1); - } - } - res._normalized = true; - res.$stable = slots ? slots.$stable : true; - return res -} + vm.$parent = parent; + vm.$root = parent ? parent.$root : vm; -function normalizeScopedSlot(normalSlots, key, fn) { - var normalized = function (scope) { - if ( scope === void 0 ) scope = {}; + vm.$children = []; + vm.$refs = {}; - var res = fn(scope); - return res && typeof res === 'object' && !Array.isArray(res) - ? [res] // single vnode - : normalizeChildren(res) - }; - // proxy scoped slots on normal $slots - if (!hasOwn(normalSlots, key)) { - Object.defineProperty(normalSlots, key, { - get: normalized - }); - } - return normalized + vm._watcher = null; + vm._inactive = null; + vm._directInactive = false; + vm._isMounted = false; + vm._isDestroyed = false; + vm._isBeingDestroyed = false; } -function proxyNormalSlot(slots, key) { - return function () { return slots[key]; } -} +function lifecycleMixin (Vue) { + Vue.prototype._update = function (vnode, hydrating) { + var vm = this; + var prevEl = vm.$el; + var prevVnode = vm._vnode; + var restoreActiveInstance = setActiveInstance(vm); + vm._vnode = vnode; + // Vue.prototype.__patch__ is injected in entry points + // based on the rendering backend used. + if (!prevVnode) { + // initial render + vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); + } else { + // updates + vm.$el = vm.__patch__(prevVnode, vnode); + } + restoreActiveInstance(); + // update __vue__ reference + if (prevEl) { + prevEl.__vue__ = null; + } + if (vm.$el) { + vm.$el.__vue__ = vm; + } + // if parent is an HOC, update its $el as well + if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { + vm.$parent.$el = vm.$el; + } + // updated hook is called by the scheduler to ensure that children are + // updated in a parent's updated hook. + }; -/* */ + Vue.prototype.$forceUpdate = function () { + var vm = this; + if (vm._watcher) { + vm._watcher.update(); + } + }; -/** - * Runtime helper for rendering v-for lists. - */ -function renderList ( - val, - render -) { - var ret, i, l, keys, key; - if (Array.isArray(val) || typeof val === 'string') { - ret = new Array(val.length); - for (i = 0, l = val.length; i < l; i++) { - ret[i] = render(val[i], i); + Vue.prototype.$destroy = function () { + var vm = this; + if (vm._isBeingDestroyed) { + return } - } else if (typeof val === 'number') { - ret = new Array(val); - for (i = 0; i < val; i++) { - ret[i] = render(i + 1, i); + callHook(vm, 'beforeDestroy'); + vm._isBeingDestroyed = true; + // remove self from parent + var parent = vm.$parent; + if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { + remove(parent.$children, vm); } - } else if (isObject(val)) { - if (hasSymbol && val[Symbol.iterator]) { - ret = []; - var iterator = val[Symbol.iterator](); - var result = iterator.next(); - while (!result.done) { - ret.push(render(result.value, ret.length)); - result = iterator.next(); - } - } else { - keys = Object.keys(val); - ret = new Array(keys.length); - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - ret[i] = render(val[key], key, i); - } + // teardown watchers + if (vm._watcher) { + vm._watcher.teardown(); + } + var i = vm._watchers.length; + while (i--) { + vm._watchers[i].teardown(); + } + // remove reference from data ob + // frozen object may not have observer. + if (vm._data.__ob__) { + vm._data.__ob__.vmCount--; + } + // call the last hook... + vm._isDestroyed = true; + // invoke destroy hooks on current rendered tree + vm.__patch__(vm._vnode, null); + // fire destroyed hook + callHook(vm, 'destroyed'); + // turn off all instance listeners. + vm.$off(); + // remove __vue__ reference + if (vm.$el) { + vm.$el.__vue__ = null; } - } - if (!isDef(ret)) { - ret = []; - } - (ret)._isVList = true; - return ret + // release circular reference (#6759) + if (vm.$vnode) { + vm.$vnode.parent = null; + } + }; } -/* */ - -/** - * Runtime helper for rendering - */ -function renderSlot ( - name, - fallback, - props, - bindObject +function mountComponent ( + vm, + el, + hydrating ) { - var scopedSlotFn = this.$scopedSlots[name]; - var nodes; - if (scopedSlotFn) { // scoped slot - props = props || {}; - if (bindObject) { - if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) { + vm.$el = el; + if (!vm.$options.render) { + vm.$options.render = createEmptyVNode; + if (process.env.NODE_ENV !== 'production') { + /* istanbul ignore if */ + if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || + vm.$options.el || el) { warn( - 'slot v-bind without argument expects an Object', - this + 'You are using the runtime-only build of Vue where the template ' + + 'compiler is not available. Either pre-compile the templates into ' + + 'render functions, or use the compiler-included build.', + vm + ); + } else { + warn( + 'Failed to mount component: template or render function not defined.', + vm ); } - props = extend(extend({}, bindObject), props); } - nodes = scopedSlotFn(props) || fallback; - } else { - nodes = this.$slots[name] || fallback; } + callHook(vm, 'beforeMount'); - var target = props && props.slot; - if (target) { - return this.$createElement('template', { slot: target }, nodes) - } else { - return nodes - } -} + var updateComponent; + /* istanbul ignore if */ + if (process.env.NODE_ENV !== 'production' && config.performance && mark) { + updateComponent = function () { + var name = vm._name; + var id = vm._uid; + var startTag = "vue-perf-start:" + id; + var endTag = "vue-perf-end:" + id; -/* */ + mark(startTag); + var vnode = vm._render(); + mark(endTag); + measure(("vue " + name + " render"), startTag, endTag); -/** - * Runtime helper for resolving filters - */ -function resolveFilter (id) { - return resolveAsset(this.$options, 'filters', id, true) || identity -} + mark(startTag); + vm._update(vnode, hydrating); + mark(endTag); + measure(("vue " + name + " patch"), startTag, endTag); + }; + } else { + updateComponent = function () { + vm._update(vm._render(), hydrating); + }; + } -/* */ + // we set this to vm._watcher inside the watcher's constructor + // since the watcher's initial patch may call $forceUpdate (e.g. inside child + // component's mounted hook), which relies on vm._watcher being already defined + new Watcher(vm, updateComponent, noop, { + before: function before () { + if (vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'beforeUpdate'); + } + } + }, true /* isRenderWatcher */); + hydrating = false; -function isKeyNotMatch (expect, actual) { - if (Array.isArray(expect)) { - return expect.indexOf(actual) === -1 - } else { - return expect !== actual + // manually mounted instance, call mounted on self + // mounted is called for render-created child components in its inserted hook + if (vm.$vnode == null) { + vm._isMounted = true; + callHook(vm, 'mounted'); } + return vm } -/** - * Runtime helper for checking keyCodes from config. - * exposed as Vue.prototype._k - * passing in eventKeyName as last argument separately for backwards compat - */ -function checkKeyCodes ( - eventKeyCode, - key, - builtInKeyCode, - eventKeyName, - builtInKeyName +function updateChildComponent ( + vm, + propsData, + listeners, + parentVnode, + renderChildren ) { - var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; - if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { - return isKeyNotMatch(builtInKeyName, eventKeyName) - } else if (mappedKeyCode) { - return isKeyNotMatch(mappedKeyCode, eventKeyCode) - } else if (eventKeyName) { - return hyphenate(eventKeyName) !== key + if (process.env.NODE_ENV !== 'production') { + isUpdatingChildComponent = true; } -} - -/* */ -/** - * Runtime helper for merging v-bind="object" into a VNode's data. - */ -function bindObjectProps ( - data, - tag, - value, - asProp, - isSync -) { - if (value) { - if (!isObject(value)) { - process.env.NODE_ENV !== 'production' && warn( - 'v-bind without argument expects an Object or Array value', - this - ); - } else { - if (Array.isArray(value)) { - value = toObject(value); - } - var hash; - var loop = function ( key ) { - if ( - key === 'class' || - key === 'style' || - isReservedAttribute(key) - ) { - hash = data; - } else { - var type = data.attrs && data.attrs.type; - hash = asProp || config.mustUseProp(tag, type, key) - ? data.domProps || (data.domProps = {}) - : data.attrs || (data.attrs = {}); - } - var camelizedKey = camelize(key); - if (!(key in hash) && !(camelizedKey in hash)) { - hash[key] = value[key]; + // determine whether component has slot children + // we need to do this before overwriting $options._renderChildren. - if (isSync) { - var on = data.on || (data.on = {}); - on[("update:" + camelizedKey)] = function ($event) { - value[key] = $event; - }; - } - } - }; + // check if there are dynamic scopedSlots (hand-written or compiled but with + // dynamic slot names). Static scoped slots compiled from template has the + // "$stable" marker. + var hasDynamicScopedSlot = !!( + (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || + (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) + ); - for (var key in value) loop( key ); - } - } - return data -} + // Any static slot children from the parent may have changed during parent's + // update. Dynamic scoped slots may also have changed. In such cases, a forced + // update is necessary to ensure correctness. + var needsForceUpdate = !!( + renderChildren || // has new static slots + vm.$options._renderChildren || // has old static slots + hasDynamicScopedSlot + ); -/* */ + vm.$options._parentVnode = parentVnode; + vm.$vnode = parentVnode; // update vm's placeholder node without re-render -/** - * Runtime helper for rendering static trees. - */ -function renderStatic ( - index, - isInFor -) { - var cached = this._staticTrees || (this._staticTrees = []); - var tree = cached[index]; - // if has already-rendered static tree and not inside v-for, - // we can reuse the same tree. - if (tree && !isInFor) { - return tree + if (vm._vnode) { // update child tree's parent + vm._vnode.parent = parentVnode; } - // otherwise, render a fresh tree. - tree = cached[index] = this.$options.staticRenderFns[index].call( - this._renderProxy, - null, - this // for render fns generated for functional component templates - ); - markStatic(tree, ("__static__" + index), false); - return tree -} + vm.$options._renderChildren = renderChildren; -/** - * Runtime helper for v-once. - * Effectively it means marking the node as static with a unique key. - */ -function markOnce ( - tree, - index, - key -) { - markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); - return tree -} + // update $attrs and $listeners hash + // these are also reactive so they may trigger child update if the child + // used them during render + vm.$attrs = parentVnode.data.attrs || emptyObject; + vm.$listeners = listeners || emptyObject; -function markStatic ( - tree, - key, - isOnce -) { - if (Array.isArray(tree)) { - for (var i = 0; i < tree.length; i++) { - if (tree[i] && typeof tree[i] !== 'string') { - markStaticNode(tree[i], (key + "_" + i), isOnce); - } + // update props + if (propsData && vm.$options.props) { + toggleObserving(false); + var props = vm._props; + var propKeys = vm.$options._propKeys || []; + for (var i = 0; i < propKeys.length; i++) { + var key = propKeys[i]; + var propOptions = vm.$options.props; // wtf flow? + props[key] = validateProp(key, propOptions, propsData, vm); } - } else { - markStaticNode(tree, key, isOnce); + toggleObserving(true); + // keep a copy of raw propsData + vm.$options.propsData = propsData; } -} -function markStaticNode (node, key, isOnce) { - node.isStatic = true; - node.key = key; - node.isOnce = isOnce; + // update listeners + listeners = listeners || emptyObject; + var oldListeners = vm.$options._parentListeners; + vm.$options._parentListeners = listeners; + updateComponentListeners(vm, listeners, oldListeners); + + // resolve slots + force update if has children + if (needsForceUpdate) { + vm.$slots = resolveSlots(renderChildren, parentVnode.context); + vm.$forceUpdate(); + } + + if (process.env.NODE_ENV !== 'production') { + isUpdatingChildComponent = false; + } } -/* */ +function isInInactiveTree (vm) { + while (vm && (vm = vm.$parent)) { + if (vm._inactive) { return true } + } + return false +} -function bindObjectListeners (data, value) { - if (value) { - if (!isPlainObject(value)) { - process.env.NODE_ENV !== 'production' && warn( - 'v-on without argument expects an Object value', - this - ); - } else { - var on = data.on = data.on ? extend({}, data.on) : {}; - for (var key in value) { - var existing = on[key]; - var ours = value[key]; - on[key] = existing ? [].concat(existing, ours) : ours; - } +function activateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = false; + if (isInInactiveTree(vm)) { + return } + } else if (vm._directInactive) { + return + } + if (vm._inactive || vm._inactive === null) { + vm._inactive = false; + for (var i = 0; i < vm.$children.length; i++) { + activateChildComponent(vm.$children[i]); + } + callHook(vm, 'activated'); } - return data } -/* */ - -function bindDynamicKeys (baseObj, values) { - for (var i = 0; i < values.length; i += 2) { - var key = values[i]; - if (typeof key === 'string' && key) { - baseObj[values[i]] = values[i + 1]; - } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) { - // null is a speical value for explicitly removing a binding - warn( - ("Invalid value for dynamic directive argument (expected string or null): " + key), - this - ); +function deactivateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = true; + if (isInInactiveTree(vm)) { + return } } - return baseObj + if (!vm._inactive) { + vm._inactive = true; + for (var i = 0; i < vm.$children.length; i++) { + deactivateChildComponent(vm.$children[i]); + } + callHook(vm, 'deactivated'); + } } -// helper to dynamically append modifier runtime markers to event names. -// ensure only append when value is already string, otherwise it will be cast -// to string and cause the type check to miss. -function prependModifier (value, symbol) { - return typeof value === 'string' ? symbol + value : value +function callHook (vm, hook) { + // #7573 disable dep collection when invoking lifecycle hooks + pushTarget(); + var handlers = vm.$options[hook]; + var info = hook + " hook"; + if (handlers) { + for (var i = 0, j = handlers.length; i < j; i++) { + invokeWithErrorHandling(handlers[i], vm, null, vm, info); + } + } + if (vm._hasHookEvent) { + vm.$emit('hook:' + hook); + } + popTarget(); } /* */ -function installRenderHelpers (target) { - target._o = markOnce; - target._n = toNumber; - target._s = toString; - target._l = renderList; - target._t = renderSlot; - target._q = looseEqual; - target._i = looseIndexOf; - target._m = renderStatic; - target._f = resolveFilter; - target._k = checkKeyCodes; - target._b = bindObjectProps; - target._v = createTextVNode; - target._e = createEmptyVNode; - target._u = resolveScopedSlots; - target._g = bindObjectListeners; - target._d = bindDynamicKeys; - target._p = prependModifier; -} +var MAX_UPDATE_COUNT = 100; -/* */ +var queue = []; +var activatedChildren = []; +var has = {}; +var circular = {}; +var waiting = false; +var flushing = false; +var index = 0; -function FunctionalRenderContext ( - data, - props, - children, - parent, - Ctor -) { - var options = Ctor.options; - // ensure the createElement function in functional components - // gets a unique context - this is necessary for correct named slot check - var contextVm; - if (hasOwn(parent, '_uid')) { - contextVm = Object.create(parent); - // $flow-disable-line - contextVm._original = parent; - } else { - // the context vm passed in is a functional context as well. - // in this case we want to make sure we are able to get a hold to the - // real context instance. - contextVm = parent; - // $flow-disable-line - parent = parent._original; +/** + * Reset the scheduler's state. + */ +function resetSchedulerState () { + index = queue.length = activatedChildren.length = 0; + has = {}; + if (process.env.NODE_ENV !== 'production') { + circular = {}; } - var isCompiled = isTrue(options._compiled); - var needNormalization = !isCompiled; + waiting = flushing = false; +} - this.data = data; - this.props = props; - this.children = children; - this.parent = parent; - this.listeners = data.on || emptyObject; - this.injections = resolveInject(options.inject, parent); - this.slots = function () { return resolveSlots(children, parent); }; +// Async edge case #6566 requires saving the timestamp when event listeners are +// attached. However, calling performance.now() has a perf overhead especially +// if the page has thousands of event listeners. Instead, we take a timestamp +// every time the scheduler flushes and use that for all event listeners +// attached during that flush. +var currentFlushTimestamp = 0; - Object.defineProperty(this, 'scopedSlots', ({ - enumerable: true, - get: function get () { - return normalizeScopedSlots(data.scopedSlots, this.slots()) - } - })); +// Async edge case fix requires storing an event listener's attach timestamp. +var getNow = Date.now; - // support for compiled functional template - if (isCompiled) { - // exposing $options for renderStatic() - this.$options = options; - // pre-resolve slots for renderSlot() - this.$slots = this.slots(); - this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); - } +// Determine what event timestamp the browser is using. Annoyingly, the +// timestamp can either be hi-res (relative to page load) or low-res +// (relative to UNIX epoch), so in order to compare time we have to use the +// same timestamp type when saving the flush timestamp. +if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { + // if the low-res timestamp which is bigger than the event timestamp + // (which is evaluated AFTER) it means the event is using a hi-res timestamp, + // and we need to use the hi-res version for event listeners as well. + getNow = function () { return performance.now(); }; +} - if (options._scopeId) { - this._c = function (a, b, c, d) { - var vnode = createElement(contextVm, a, b, c, d, needNormalization); - if (vnode && !Array.isArray(vnode)) { - vnode.fnScopeId = options._scopeId; - vnode.fnContext = parent; +/** + * Flush both queues and run the watchers. + */ +function flushSchedulerQueue () { + currentFlushTimestamp = getNow(); + flushing = true; + var watcher, id; + + // Sort queue before flush. + // This ensures that: + // 1. Components are updated from parent to child. (because parent is always + // created before the child) + // 2. A component's user watchers are run before its render watcher (because + // user watchers are created before the render watcher) + // 3. If a component is destroyed during a parent component's watcher run, + // its watchers can be skipped. + queue.sort(function (a, b) { return a.id - b.id; }); + + // do not cache length because more watchers might be pushed + // as we run existing watchers + for (index = 0; index < queue.length; index++) { + watcher = queue[index]; + if (watcher.before) { + watcher.before(); + } + id = watcher.id; + has[id] = null; + watcher.run(); + // in dev build, check and stop circular updates. + if (process.env.NODE_ENV !== 'production' && has[id] != null) { + circular[id] = (circular[id] || 0) + 1; + if (circular[id] > MAX_UPDATE_COUNT) { + warn( + 'You may have an infinite update loop ' + ( + watcher.user + ? ("in watcher with expression \"" + (watcher.expression) + "\"") + : "in a component render function." + ), + watcher.vm + ); + break } - return vnode - }; - } else { - this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; + } } -} -installRenderHelpers(FunctionalRenderContext.prototype); + // keep copies of post queues before resetting state + var activatedQueue = activatedChildren.slice(); + var updatedQueue = queue.slice(); -function createFunctionalComponent ( - Ctor, - propsData, - data, - contextVm, - children -) { - var options = Ctor.options; - var props = {}; - var propOptions = options.props; - if (isDef(propOptions)) { - for (var key in propOptions) { - props[key] = validateProp(key, propOptions, propsData || emptyObject); - } - } else { - if (isDef(data.attrs)) { mergeProps(props, data.attrs); } - if (isDef(data.props)) { mergeProps(props, data.props); } - } + resetSchedulerState(); - var renderContext = new FunctionalRenderContext( - data, - props, - children, - contextVm, - Ctor - ); + // call component updated and activated hooks + callActivatedHooks(activatedQueue); + callUpdatedHooks(updatedQueue); - var vnode = options.render.call(null, renderContext._c, renderContext); + // devtool hook + /* istanbul ignore if */ + if (devtools && config.devtools) { + devtools.emit('flush'); + } +} - if (vnode instanceof VNode) { - return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) - } else if (Array.isArray(vnode)) { - var vnodes = normalizeChildren(vnode) || []; - var res = new Array(vnodes.length); - for (var i = 0; i < vnodes.length; i++) { - res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); +function callUpdatedHooks (queue) { + var i = queue.length; + while (i--) { + var watcher = queue[i]; + var vm = watcher.vm; + if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'updated'); } - return res } } -function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { - // #7817 clone node before setting fnContext, otherwise if the node is reused - // (e.g. it was from a cached normal slot) the fnContext causes named slots - // that should not be matched to match. - var clone = cloneVNode(vnode); - clone.fnContext = contextVm; - clone.fnOptions = options; - if (process.env.NODE_ENV !== 'production') { - (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; - } - if (data.slot) { - (clone.data || (clone.data = {})).slot = data.slot; +/** + * Queue a kept-alive component that was activated during patch. + * The queue will be processed after the entire tree has been patched. + */ +function queueActivatedComponent (vm) { + // setting _inactive to false here so that a render function can + // rely on checking whether it's in an inactive tree (e.g. router-view) + vm._inactive = false; + activatedChildren.push(vm); +} + +function callActivatedHooks (queue) { + for (var i = 0; i < queue.length; i++) { + queue[i]._inactive = true; + activateChildComponent(queue[i], true /* true */); } - return clone } -function mergeProps (to, from) { - for (var key in from) { - to[camelize(key)] = from[key]; +/** + * Push a watcher into the watcher queue. + * Jobs with duplicate IDs will be skipped unless it's + * pushed when the queue is being flushed. + */ +function queueWatcher (watcher) { + var id = watcher.id; + if (has[id] == null) { + has[id] = true; + if (!flushing) { + queue.push(watcher); + } else { + // if already flushing, splice the watcher based on its id + // if already past its id, it will be run next immediately. + var i = queue.length - 1; + while (i > index && queue[i].id > watcher.id) { + i--; + } + queue.splice(i + 1, 0, watcher); + } + // queue the flush + if (!waiting) { + waiting = true; + + if (process.env.NODE_ENV !== 'production' && !config.async) { + flushSchedulerQueue(); + return + } + nextTick(flushSchedulerQueue); + } } } /* */ -/* */ -/* */ -/* */ +var uid$2 = 0; -// inline hooks to be invoked on component VNodes during patch -var componentVNodeHooks = { - init: function init (vnode, hydrating) { - if ( - vnode.componentInstance && - !vnode.componentInstance._isDestroyed && - vnode.data.keepAlive - ) { - // kept-alive components, treat as a patch - var mountedNode = vnode; // work around flow - componentVNodeHooks.prepatch(mountedNode, mountedNode); - } else { - var child = vnode.componentInstance = createComponentInstanceForVnode( - vnode, - activeInstance +/** + * A watcher parses an expression, collects dependencies, + * and fires callback when the expression value changes. + * This is used for both the $watch() api and directives. + */ +var Watcher = function Watcher ( + vm, + expOrFn, + cb, + options, + isRenderWatcher +) { + this.vm = vm; + if (isRenderWatcher) { + vm._watcher = this; + } + vm._watchers.push(this); + // options + if (options) { + this.deep = !!options.deep; + this.user = !!options.user; + this.lazy = !!options.lazy; + this.sync = !!options.sync; + this.before = options.before; + } else { + this.deep = this.user = this.lazy = this.sync = false; + } + this.cb = cb; + this.id = ++uid$2; // uid for batching + this.active = true; + this.dirty = this.lazy; // for lazy watchers + this.deps = []; + this.newDeps = []; + this.depIds = new _Set(); + this.newDepIds = new _Set(); + this.expression = process.env.NODE_ENV !== 'production' + ? expOrFn.toString() + : ''; + // parse expression for getter + if (typeof expOrFn === 'function') { + this.getter = expOrFn; + } else { + this.getter = parsePath(expOrFn); + if (!this.getter) { + this.getter = noop; + process.env.NODE_ENV !== 'production' && warn( + "Failed watching path: \"" + expOrFn + "\" " + + 'Watcher only accepts simple dot-delimited paths. ' + + 'For full control, use a function instead.', + vm ); - child.$mount(hydrating ? vnode.elm : undefined, hydrating); } - }, - - prepatch: function prepatch (oldVnode, vnode) { - var options = vnode.componentOptions; - var child = vnode.componentInstance = oldVnode.componentInstance; - updateChildComponent( - child, - options.propsData, // updated props - options.listeners, // updated listeners - vnode, // new parent vnode - options.children // new children - ); - }, + } + this.value = this.lazy + ? undefined + : this.get(); +}; - insert: function insert (vnode) { - var context = vnode.context; - var componentInstance = vnode.componentInstance; - if (!componentInstance._isMounted) { - componentInstance._isMounted = true; - callHook(componentInstance, 'mounted'); - } - if (vnode.data.keepAlive) { - if (context._isMounted) { - // vue-router#1212 - // During updates, a kept-alive component's child components may - // change, so directly walking the tree here may call activated hooks - // on incorrect children. Instead we push them into a queue which will - // be processed after the whole patch process ended. - queueActivatedComponent(componentInstance); - } else { - activateChildComponent(componentInstance, true /* direct */); - } +/** + * Evaluate the getter, and re-collect dependencies. + */ +Watcher.prototype.get = function get () { + pushTarget(this); + var value; + var vm = this.vm; + try { + value = this.getter.call(vm, vm); + } catch (e) { + if (this.user) { + handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); + } else { + throw e } - }, - - destroy: function destroy (vnode) { - var componentInstance = vnode.componentInstance; - if (!componentInstance._isDestroyed) { - if (!vnode.data.keepAlive) { - componentInstance.$destroy(); - } else { - deactivateChildComponent(componentInstance, true /* direct */); - } + } finally { + // "touch" every property so they are all tracked as + // dependencies for deep watching + if (this.deep) { + traverse(value); } + popTarget(); + this.cleanupDeps(); } + return value }; -var hooksToMerge = Object.keys(componentVNodeHooks); - -function createComponent ( - Ctor, - data, - context, - children, - tag -) { - if (isUndef(Ctor)) { - return - } - - var baseCtor = context.$options._base; - - // plain options object: turn it into a constructor - if (isObject(Ctor)) { - Ctor = baseCtor.extend(Ctor); - } - - // if at this stage it's not a constructor or an async component factory, - // reject. - if (typeof Ctor !== 'function') { - if (process.env.NODE_ENV !== 'production') { - warn(("Invalid Component definition: " + (String(Ctor))), context); +/** + * Add a dependency to this directive. + */ +Watcher.prototype.addDep = function addDep (dep) { + var id = dep.id; + if (!this.newDepIds.has(id)) { + this.newDepIds.add(id); + this.newDeps.push(dep); + if (!this.depIds.has(id)) { + dep.addSub(this); } - return } +}; - // async component - var asyncFactory; - if (isUndef(Ctor.cid)) { - asyncFactory = Ctor; - Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context); - if (Ctor === undefined) { - // return a placeholder node for async component, which is rendered - // as a comment node but preserves all the raw information for the node. - // the information will be used for async server-rendering and hydration. - return createAsyncPlaceholder( - asyncFactory, - data, - context, - children, - tag - ) +/** + * Clean up for dependency collection. + */ +Watcher.prototype.cleanupDeps = function cleanupDeps () { + var i = this.deps.length; + while (i--) { + var dep = this.deps[i]; + if (!this.newDepIds.has(dep.id)) { + dep.removeSub(this); } } + var tmp = this.depIds; + this.depIds = this.newDepIds; + this.newDepIds = tmp; + this.newDepIds.clear(); + tmp = this.deps; + this.deps = this.newDeps; + this.newDeps = tmp; + this.newDeps.length = 0; +}; - data = data || {}; - - // resolve constructor options in case global mixins are applied after - // component constructor creation - resolveConstructorOptions(Ctor); - - // transform component v-model data into props & events - if (isDef(data.model)) { - transformModel(Ctor.options, data); - } - - // extract props - var propsData = extractPropsFromVNodeData(data, Ctor, tag); - - // functional component - if (isTrue(Ctor.options.functional)) { - return createFunctionalComponent(Ctor, propsData, data, context, children) +/** + * Subscriber interface. + * Will be called when a dependency changes. + */ +Watcher.prototype.update = function update () { + /* istanbul ignore else */ + if (this.lazy) { + this.dirty = true; + } else if (this.sync) { + this.run(); + } else { + queueWatcher(this); } +}; - // extract listeners, since these needs to be treated as - // child component listeners instead of DOM listeners - var listeners = data.on; - // replace with listeners with .native modifier - // so it gets processed during parent component patch. - data.on = data.nativeOn; - - if (isTrue(Ctor.options.abstract)) { - // abstract components do not keep anything - // other than props & listeners & slot - - // work around flow - var slot = data.slot; - data = {}; - if (slot) { - data.slot = slot; +/** + * Scheduler job interface. + * Will be called by the scheduler. + */ +Watcher.prototype.run = function run () { + if (this.active) { + var value = this.get(); + if ( + value !== this.value || + // Deep watchers and watchers on Object/Arrays should fire even + // when the value is the same, because the value may + // have mutated. + isObject(value) || + this.deep + ) { + // set new value + var oldValue = this.value; + this.value = value; + if (this.user) { + try { + this.cb.call(this.vm, value, oldValue); + } catch (e) { + handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); + } + } else { + this.cb.call(this.vm, value, oldValue); + } } } +}; - // install component management hooks onto the placeholder node - installComponentHooks(data); - - // return a placeholder vnode - var name = Ctor.options.name || tag; - var vnode = new VNode( - ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), - data, undefined, undefined, undefined, context, - { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, - asyncFactory - ); - - return vnode -} - -function createComponentInstanceForVnode ( - vnode, // we know it's MountedComponentVNode but flow doesn't - parent // activeInstance in lifecycle state -) { - var options = { - _isComponent: true, - _parentVnode: vnode, - parent: parent - }; - // check inline-template render functions - var inlineTemplate = vnode.data.inlineTemplate; - if (isDef(inlineTemplate)) { - options.render = inlineTemplate.render; - options.staticRenderFns = inlineTemplate.staticRenderFns; - } - return new vnode.componentOptions.Ctor(options) -} +/** + * Evaluate the value of the watcher. + * This only gets called for lazy watchers. + */ +Watcher.prototype.evaluate = function evaluate () { + this.value = this.get(); + this.dirty = false; +}; -function installComponentHooks (data) { - var hooks = data.hook || (data.hook = {}); - for (var i = 0; i < hooksToMerge.length; i++) { - var key = hooksToMerge[i]; - var existing = hooks[key]; - var toMerge = componentVNodeHooks[key]; - if (existing !== toMerge && !(existing && existing._merged)) { - hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; - } +/** + * Depend on all deps collected by this watcher. + */ +Watcher.prototype.depend = function depend () { + var i = this.deps.length; + while (i--) { + this.deps[i].depend(); } -} - -function mergeHook$1 (f1, f2) { - var merged = function (a, b) { - // flow complains about extra args which is why we use any - f1(a, b); - f2(a, b); - }; - merged._merged = true; - return merged -} +}; -// transform component v-model info (value and callback) into -// prop and event handler respectively. -function transformModel (options, data) { - var prop = (options.model && options.model.prop) || 'value'; - var event = (options.model && options.model.event) || 'input' - ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; - var on = data.on || (data.on = {}); - var existing = on[event]; - var callback = data.model.callback; - if (isDef(existing)) { - if ( - Array.isArray(existing) - ? existing.indexOf(callback) === -1 - : existing !== callback - ) { - on[event] = [callback].concat(existing); +/** + * Remove self from all dependencies' subscriber list. + */ +Watcher.prototype.teardown = function teardown () { + if (this.active) { + // remove self from vm's watcher list + // this is a somewhat expensive operation so we skip it + // if the vm is being destroyed. + if (!this.vm._isBeingDestroyed) { + remove(this.vm._watchers, this); } - } else { - on[event] = callback; + var i = this.deps.length; + while (i--) { + this.deps[i].removeSub(this); + } + this.active = false; } -} +}; /* */ -var SIMPLE_NORMALIZE = 1; -var ALWAYS_NORMALIZE = 2; +var sharedPropertyDefinition = { + enumerable: true, + configurable: true, + get: noop, + set: noop +}; -// wrapper function for providing a more flexible interface -// without getting yelled at by flow -function createElement ( - context, - tag, - data, - children, - normalizationType, - alwaysNormalize -) { - if (Array.isArray(data) || isPrimitive(data)) { - normalizationType = children; - children = data; - data = undefined; +function proxy (target, sourceKey, key) { + sharedPropertyDefinition.get = function proxyGetter () { + return this[sourceKey][key] + }; + sharedPropertyDefinition.set = function proxySetter (val) { + this[sourceKey][key] = val; + }; + Object.defineProperty(target, key, sharedPropertyDefinition); +} + +function initState (vm) { + vm._watchers = []; + var opts = vm.$options; + if (opts.props) { initProps(vm, opts.props); } + if (opts.methods) { initMethods(vm, opts.methods); } + if (opts.data) { + initData(vm); + } else { + observe(vm._data = {}, true /* asRootData */); } - if (isTrue(alwaysNormalize)) { - normalizationType = ALWAYS_NORMALIZE; + if (opts.computed) { initComputed(vm, opts.computed); } + if (opts.watch && opts.watch !== nativeWatch) { + initWatch(vm, opts.watch); } - return _createElement(context, tag, data, children, normalizationType) } -function _createElement ( - context, - tag, - data, - children, - normalizationType -) { - if (isDef(data) && isDef((data).__ob__)) { +function initProps (vm, propsOptions) { + var propsData = vm.$options.propsData || {}; + var props = vm._props = {}; + // cache prop keys so that future props updates can iterate using Array + // instead of dynamic object key enumeration. + var keys = vm.$options._propKeys = []; + var isRoot = !vm.$parent; + // root instance props should be converted + if (!isRoot) { + toggleObserving(false); + } + var loop = function ( key ) { + keys.push(key); + var value = validateProp(key, propsOptions, propsData, vm); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') { + var hyphenatedKey = hyphenate(key); + if (isReservedAttribute(hyphenatedKey) || + config.isReservedAttr(hyphenatedKey)) { + warn( + ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), + vm + ); + } + defineReactive$$1(props, key, value, function () { + if (!isRoot && !isUpdatingChildComponent) { + warn( + "Avoid mutating a prop directly since the value will be " + + "overwritten whenever the parent component re-renders. " + + "Instead, use a data or computed property based on the prop's " + + "value. Prop being mutated: \"" + key + "\"", + vm + ); + } + }); + } else { + defineReactive$$1(props, key, value); + } + // static props are already proxied on the component's prototype + // during Vue.extend(). We only need to proxy props defined at + // instantiation here. + if (!(key in vm)) { + proxy(vm, "_props", key); + } + }; + + for (var key in propsOptions) loop( key ); + toggleObserving(true); +} + +function initData (vm) { + var data = vm.$options.data; + data = vm._data = typeof data === 'function' + ? getData(data, vm) + : data || {}; + if (!isPlainObject(data)) { + data = {}; process.env.NODE_ENV !== 'production' && warn( - "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + - 'Always create fresh vnode data objects in each render!', - context + 'data functions should return an object:\n' + + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', + vm ); - return createEmptyVNode() - } - // object syntax in v-bind - if (isDef(data) && isDef(data.is)) { - tag = data.is; } - if (!tag) { - // in case of component :is set to falsy value - return createEmptyVNode() - } - // warn against non-primitive key - if (process.env.NODE_ENV !== 'production' && - isDef(data) && isDef(data.key) && !isPrimitive(data.key) - ) { - { - warn( - 'Avoid using non-primitive value as key, ' + - 'use string/number value instead.', - context + // proxy data on instance + var keys = Object.keys(data); + var props = vm.$options.props; + var methods = vm.$options.methods; + var i = keys.length; + while (i--) { + var key = keys[i]; + if (process.env.NODE_ENV !== 'production') { + if (methods && hasOwn(methods, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a data property."), + vm + ); + } + } + if (props && hasOwn(props, key)) { + process.env.NODE_ENV !== 'production' && warn( + "The data property \"" + key + "\" is already declared as a prop. " + + "Use prop default value instead.", + vm ); + } else if (!isReserved(key)) { + proxy(vm, "_data", key); } } - // support single function children as default scoped slot - if (Array.isArray(children) && - typeof children[0] === 'function' - ) { - data = data || {}; - data.scopedSlots = { default: children[0] }; - children.length = 0; - } - if (normalizationType === ALWAYS_NORMALIZE) { - children = normalizeChildren(children); - } else if (normalizationType === SIMPLE_NORMALIZE) { - children = simpleNormalizeChildren(children); + // observe data + observe(data, true /* asRootData */); +} + +function getData (data, vm) { + // #7573 disable dep collection when invoking data getters + pushTarget(); + try { + return data.call(vm, vm) + } catch (e) { + handleError(e, vm, "data()"); + return {} + } finally { + popTarget(); } - var vnode, ns; - if (typeof tag === 'string') { - var Ctor; - ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); - if (config.isReservedTag(tag)) { - // platform built-in elements - vnode = new VNode( - config.parsePlatformTagName(tag), data, children, - undefined, undefined, context +} + +var computedWatcherOptions = { lazy: true }; + +function initComputed (vm, computed) { + // $flow-disable-line + var watchers = vm._computedWatchers = Object.create(null); + // computed properties are just getters during SSR + var isSSR = isServerRendering(); + + for (var key in computed) { + var userDef = computed[key]; + var getter = typeof userDef === 'function' ? userDef : userDef.get; + if (process.env.NODE_ENV !== 'production' && getter == null) { + warn( + ("Getter is missing for computed property \"" + key + "\"."), + vm ); - } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { - // component - vnode = createComponent(Ctor, data, context, children, tag); - } else { - // unknown or unlisted namespaced elements - // check at runtime because it may get assigned a namespace when its - // parent normalizes children - vnode = new VNode( - tag, data, children, - undefined, undefined, context + } + + if (!isSSR) { + // create internal watcher for the computed property. + watchers[key] = new Watcher( + vm, + getter || noop, + noop, + computedWatcherOptions ); } - } else { - // direct component options / constructor - vnode = createComponent(tag, data, context, children); + + // component-defined computed properties are already defined on the + // component prototype. We only need to define computed properties defined + // at instantiation here. + if (!(key in vm)) { + defineComputed(vm, key, userDef); + } else if (process.env.NODE_ENV !== 'production') { + if (key in vm.$data) { + warn(("The computed property \"" + key + "\" is already defined in data."), vm); + } else if (vm.$options.props && key in vm.$options.props) { + warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); + } + } } - if (Array.isArray(vnode)) { - return vnode - } else if (isDef(vnode)) { - if (isDef(ns)) { applyNS(vnode, ns); } - if (isDef(data)) { registerDeepBindings(data); } - return vnode +} + +function defineComputed ( + target, + key, + userDef +) { + var shouldCache = !isServerRendering(); + if (typeof userDef === 'function') { + sharedPropertyDefinition.get = shouldCache + ? createComputedGetter(key) + : createGetterInvoker(userDef); + sharedPropertyDefinition.set = noop; } else { - return createEmptyVNode() + sharedPropertyDefinition.get = userDef.get + ? shouldCache && userDef.cache !== false + ? createComputedGetter(key) + : createGetterInvoker(userDef.get) + : noop; + sharedPropertyDefinition.set = userDef.set || noop; + } + if (process.env.NODE_ENV !== 'production' && + sharedPropertyDefinition.set === noop) { + sharedPropertyDefinition.set = function () { + warn( + ("Computed property \"" + key + "\" was assigned to but it has no setter."), + this + ); + }; } + Object.defineProperty(target, key, sharedPropertyDefinition); } -function applyNS (vnode, ns, force) { - vnode.ns = ns; - if (vnode.tag === 'foreignObject') { - // use default namespace inside foreignObject - ns = undefined; - force = true; - } - if (isDef(vnode.children)) { - for (var i = 0, l = vnode.children.length; i < l; i++) { - var child = vnode.children[i]; - if (isDef(child.tag) && ( - isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { - applyNS(child, ns, force); +function createComputedGetter (key) { + return function computedGetter () { + var watcher = this._computedWatchers && this._computedWatchers[key]; + if (watcher) { + if (watcher.dirty) { + watcher.evaluate(); + } + if (Dep.target) { + watcher.depend(); } + return watcher.value } } } -// ref #5318 -// necessary to ensure parent re-render when deep bindings like :style and -// :class are used on slot nodes -function registerDeepBindings (data) { - if (isObject(data.style)) { - traverse(data.style); - } - if (isObject(data.class)) { - traverse(data.class); +function createGetterInvoker(fn) { + return function computedGetter () { + return fn.call(this, this) } } -/* */ - -function initRender (vm) { - vm._vnode = null; // the root of the child tree - vm._staticTrees = null; // v-once cached trees - var options = vm.$options; - var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree - var renderContext = parentVnode && parentVnode.context; - vm.$slots = resolveSlots(options._renderChildren, renderContext); - vm.$scopedSlots = emptyObject; - // bind the createElement fn to this instance - // so that we get proper render context inside it. - // args order: tag, data, children, normalizationType, alwaysNormalize - // internal version is used by render functions compiled from templates - vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; - // normalization is always applied for the public version, used in - // user-written render functions. - vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; +function initMethods (vm, methods) { + var props = vm.$options.props; + for (var key in methods) { + if (process.env.NODE_ENV !== 'production') { + if (typeof methods[key] !== 'function') { + warn( + "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + + "Did you reference the function correctly?", + vm + ); + } + if (props && hasOwn(props, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a prop."), + vm + ); + } + if ((key in vm) && isReserved(key)) { + warn( + "Method \"" + key + "\" conflicts with an existing Vue instance method. " + + "Avoid defining component methods that start with _ or $." + ); + } + } + vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); + } +} - // $attrs & $listeners are exposed for easier HOC creation. - // they need to be reactive so that HOCs using them are always updated - var parentData = parentVnode && parentVnode.data; +function initWatch (vm, watch) { + for (var key in watch) { + var handler = watch[key]; + if (Array.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + createWatcher(vm, key, handler[i]); + } + } else { + createWatcher(vm, key, handler); + } + } +} - /* istanbul ignore else */ - if (process.env.NODE_ENV !== 'production') { - defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { - !isUpdatingChildComponent && warn("$attrs is readonly.", vm); - }, true); - defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { - !isUpdatingChildComponent && warn("$listeners is readonly.", vm); - }, true); - } else { - defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true); - defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true); +function createWatcher ( + vm, + expOrFn, + handler, + options +) { + if (isPlainObject(handler)) { + options = handler; + handler = handler.handler; + } + if (typeof handler === 'string') { + handler = vm[handler]; } + return vm.$watch(expOrFn, handler, options) } -function renderMixin (Vue) { - // install runtime convenience helpers - installRenderHelpers(Vue.prototype); +function stateMixin (Vue) { + // flow somehow has problems with directly declared definition object + // when using Object.defineProperty, so we have to procedurally build up + // the object here. + var dataDef = {}; + dataDef.get = function () { return this._data }; + var propsDef = {}; + propsDef.get = function () { return this._props }; + if (process.env.NODE_ENV !== 'production') { + dataDef.set = function () { + warn( + 'Avoid replacing instance root $data. ' + + 'Use nested data properties instead.', + this + ); + }; + propsDef.set = function () { + warn("$props is readonly.", this); + }; + } + Object.defineProperty(Vue.prototype, '$data', dataDef); + Object.defineProperty(Vue.prototype, '$props', propsDef); - Vue.prototype.$nextTick = function (fn) { - return nextTick(fn, this) - }; + Vue.prototype.$set = set; + Vue.prototype.$delete = del; - Vue.prototype._render = function () { + Vue.prototype.$watch = function ( + expOrFn, + cb, + options + ) { var vm = this; - var ref = vm.$options; - var render = ref.render; - var _parentVnode = ref._parentVnode; - - if (_parentVnode) { - vm.$scopedSlots = normalizeScopedSlots( - _parentVnode.data.scopedSlots, - vm.$slots - ); + if (isPlainObject(cb)) { + return createWatcher(vm, expOrFn, cb, options) } - - // set parent vnode. this allows render functions to have access - // to the data on the placeholder node. - vm.$vnode = _parentVnode; - // render self - var vnode; - try { - vnode = render.call(vm._renderProxy, vm.$createElement); - } catch (e) { - handleError(e, vm, "render"); - // return error render result, - // or previous vnode to prevent render error causing blank component - /* istanbul ignore else */ - if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) { - try { - vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); - } catch (e) { - handleError(e, vm, "renderError"); - vnode = vm._vnode; - } - } else { - vnode = vm._vnode; + options = options || {}; + options.user = true; + var watcher = new Watcher(vm, expOrFn, cb, options); + if (options.immediate) { + try { + cb.call(vm, watcher.value); + } catch (error) { + handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); } } - // if the returned array contains only a single node, allow it - if (Array.isArray(vnode) && vnode.length === 1) { - vnode = vnode[0]; - } - // return empty vnode in case the render function errored out - if (!(vnode instanceof VNode)) { - if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) { - warn( - 'Multiple root nodes returned from render function. Render function ' + - 'should return a single root node.', - vm - ); - } - vnode = createEmptyVNode(); + return function unwatchFn () { + watcher.teardown(); } - // set parent - vnode.parent = _parentVnode; - return vnode }; } @@ -5339,7 +5342,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', { value: FunctionalRenderContext }); -Vue.version = '2.6.2'; +Vue.version = '2.6.3'; /* */ @@ -6766,6 +6769,11 @@ function createOnceHandler$1 (event, handler, capture) { } } +// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp +// implementation and does not fire microtasks in between event propagation, so +// safe to exclude. +var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); + function add$1 ( name, handler, @@ -6778,11 +6786,16 @@ function add$1 ( // the solution is simple: we save the timestamp when a handler is attached, // and the handler would only fire if the event passed to it was fired // AFTER it was attached. - if (isUsingMicroTask) { + if (useMicrotaskFix) { var attachedTimestamp = currentFlushTimestamp; var original = handler; handler = original._wrapper = function (e) { - if (e.timeStamp >= attachedTimestamp) { + if ( + e.timeStamp >= attachedTimestamp || + // #9448 bail if event is fired in another document in a multi-page + // electron/nw.js app + e.target.ownerDocument !== document + ) { return original.apply(this, arguments) } }; diff --git a/dist/vue.runtime.js b/dist/vue.runtime.js index 89a65bdf4fd..32ac81afdbb 100644 --- a/dist/vue.runtime.js +++ b/dist/vue.runtime.js @@ -1,5 +1,5 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ @@ -529,6 +529,7 @@ var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; var isPhantomJS = UA && /phantomjs/.test(UA); + var isFF = UA && UA.match(/firefox\/(\d+)/); // Firefox has a "watch" function on Object.prototype... var nativeWatch = ({}).watch; @@ -2399,2437 +2400,2439 @@ /* */ - function ensureCtor (comp, base) { - if ( - comp.__esModule || - (hasSymbol && comp[Symbol.toStringTag] === 'Module') - ) { - comp = comp.default; + function initProvide (vm) { + var provide = vm.$options.provide; + if (provide) { + vm._provided = typeof provide === 'function' + ? provide.call(vm) + : provide; } - return isObject(comp) - ? base.extend(comp) - : comp - } - - function createAsyncPlaceholder ( - factory, - data, - context, - children, - tag - ) { - var node = createEmptyVNode(); - node.asyncFactory = factory; - node.asyncMeta = { data: data, context: context, children: children, tag: tag }; - return node } - function resolveAsyncComponent ( - factory, - baseCtor, - context - ) { - if (isTrue(factory.error) && isDef(factory.errorComp)) { - return factory.errorComp - } - - if (isDef(factory.resolved)) { - return factory.resolved - } - - if (isTrue(factory.loading) && isDef(factory.loadingComp)) { - return factory.loadingComp - } - - if (isDef(factory.contexts)) { - // already pending - factory.contexts.push(context); - } else { - var contexts = factory.contexts = [context]; - var sync = true; - - var forceRender = function (renderCompleted) { - for (var i = 0, l = contexts.length; i < l; i++) { - contexts[i].$forceUpdate(); - } - - if (renderCompleted) { - contexts.length = 0; - } - }; - - var resolve = once(function (res) { - // cache resolved - factory.resolved = ensureCtor(res, baseCtor); - // invoke callbacks only if this is not a synchronous resolve - // (async resolves are shimmed as synchronous during SSR) - if (!sync) { - forceRender(true); - } else { - contexts.length = 0; - } - }); - - var reject = once(function (reason) { - warn( - "Failed to resolve async component: " + (String(factory)) + - (reason ? ("\nReason: " + reason) : '') - ); - if (isDef(factory.errorComp)) { - factory.error = true; - forceRender(true); + function initInjections (vm) { + var result = resolveInject(vm.$options.inject, vm); + if (result) { + toggleObserving(false); + Object.keys(result).forEach(function (key) { + /* istanbul ignore else */ + { + defineReactive$$1(vm, key, result[key], function () { + warn( + "Avoid mutating an injected value directly since the changes will be " + + "overwritten whenever the provided component re-renders. " + + "injection being mutated: \"" + key + "\"", + vm + ); + }); } }); + toggleObserving(true); + } + } - var res = factory(resolve, reject); - - if (isObject(res)) { - if (isPromise(res)) { - // () => Promise - if (isUndef(factory.resolved)) { - res.then(resolve, reject); - } - } else if (isPromise(res.component)) { - res.component.then(resolve, reject); - - if (isDef(res.error)) { - factory.errorComp = ensureCtor(res.error, baseCtor); - } + function resolveInject (inject, vm) { + if (inject) { + // inject is :any because flow is not smart enough to figure out cached + var result = Object.create(null); + var keys = hasSymbol + ? Reflect.ownKeys(inject) + : Object.keys(inject); - if (isDef(res.loading)) { - factory.loadingComp = ensureCtor(res.loading, baseCtor); - if (res.delay === 0) { - factory.loading = true; - } else { - setTimeout(function () { - if (isUndef(factory.resolved) && isUndef(factory.error)) { - factory.loading = true; - forceRender(false); - } - }, res.delay || 200); - } + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + // #6574 in case the inject object is observed... + if (key === '__ob__') { continue } + var provideKey = inject[key].from; + var source = vm; + while (source) { + if (source._provided && hasOwn(source._provided, provideKey)) { + result[key] = source._provided[provideKey]; + break } - - if (isDef(res.timeout)) { - setTimeout(function () { - if (isUndef(factory.resolved)) { - reject( - "timeout (" + (res.timeout) + "ms)" - ); - } - }, res.timeout); + source = source.$parent; + } + if (!source) { + if ('default' in inject[key]) { + var provideDefault = inject[key].default; + result[key] = typeof provideDefault === 'function' + ? provideDefault.call(vm) + : provideDefault; + } else { + warn(("Injection \"" + key + "\" not found"), vm); } } } - - sync = false; - // return in case resolved synchronously - return factory.loading - ? factory.loadingComp - : factory.resolved + return result } } /* */ - function isAsyncPlaceholder (node) { - return node.isComment && node.asyncFactory - } - /* */ - function getFirstComponentChild (children) { - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - var c = children[i]; - if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { - return c + /** + * Runtime helper for resolving raw children VNodes into a slot object. + */ + function resolveSlots ( + children, + context + ) { + if (!children || !children.length) { + return {} + } + var slots = {}; + for (var i = 0, l = children.length; i < l; i++) { + var child = children[i]; + var data = child.data; + // remove slot attribute if the node is resolved as a Vue slot node + if (data && data.attrs && data.attrs.slot) { + delete data.attrs.slot; + } + // named slots should only be respected if the vnode was rendered in the + // same context. + if ((child.context === context || child.fnContext === context) && + data && data.slot != null + ) { + var name = data.slot; + var slot = (slots[name] || (slots[name] = [])); + if (child.tag === 'template') { + slot.push.apply(slot, child.children || []); + } else { + slot.push(child); } + } else { + (slots.default || (slots.default = [])).push(child); + } + } + // ignore slots that contains only whitespace + for (var name$1 in slots) { + if (slots[name$1].every(isWhitespace)) { + delete slots[name$1]; } } + return slots } - /* */ + function isWhitespace (node) { + return (node.isComment && !node.asyncFactory) || node.text === ' ' + } /* */ - function initEvents (vm) { - vm._events = Object.create(null); - vm._hasHookEvent = false; - // init parent attached events - var listeners = vm.$options._parentListeners; - if (listeners) { - updateComponentListeners(vm, listeners); + function normalizeScopedSlots ( + slots, + normalSlots + ) { + var res; + if (!slots) { + res = {}; + } else if (slots._normalized) { + return slots + } else { + res = {}; + for (var key in slots) { + if (slots[key] && key[0] !== '$') { + res[key] = normalizeScopedSlot(slots[key]); + } + } + } + // expose normal slots on scopedSlots + for (var key$1 in normalSlots) { + if (!(key$1 in res)) { + res[key$1] = proxyNormalSlot(normalSlots, key$1); + } } + def(res, '_normalized', true); + def(res, '$stable', slots ? !!slots.$stable : true); + return res } - var target; - - function add (event, fn) { - target.$on(event, fn); + function normalizeScopedSlot(fn) { + return function (scope) { + var res = fn(scope); + return res && typeof res === 'object' && !Array.isArray(res) + ? [res] // single vnode + : normalizeChildren(res) + } } - function remove$1 (event, fn) { - target.$off(event, fn); + function proxyNormalSlot(slots, key) { + return function () { return slots[key]; } } - function createOnceHandler (event, fn) { - var _target = target; - return function onceHandler () { - var res = fn.apply(null, arguments); - if (res !== null) { - _target.$off(event, onceHandler); - } - } - } + /* */ - function updateComponentListeners ( - vm, - listeners, - oldListeners + /** + * Runtime helper for rendering v-for lists. + */ + function renderList ( + val, + render ) { - target = vm; - updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); - target = undefined; - } - - function eventsMixin (Vue) { - var hookRE = /^hook:/; - Vue.prototype.$on = function (event, fn) { - var vm = this; - if (Array.isArray(event)) { - for (var i = 0, l = event.length; i < l; i++) { - vm.$on(event[i], fn); - } - } else { - (vm._events[event] || (vm._events[event] = [])).push(fn); - // optimize hook:event cost by using a boolean flag marked at registration - // instead of a hash lookup - if (hookRE.test(event)) { - vm._hasHookEvent = true; - } - } - return vm - }; - - Vue.prototype.$once = function (event, fn) { - var vm = this; - function on () { - vm.$off(event, on); - fn.apply(vm, arguments); - } - on.fn = fn; - vm.$on(event, on); - return vm - }; - - Vue.prototype.$off = function (event, fn) { - var vm = this; - // all - if (!arguments.length) { - vm._events = Object.create(null); - return vm - } - // array of events - if (Array.isArray(event)) { - for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { - vm.$off(event[i$1], fn); - } - return vm - } - // specific event - var cbs = vm._events[event]; - if (!cbs) { - return vm - } - if (!fn) { - vm._events[event] = null; - return vm + var ret, i, l, keys, key; + if (Array.isArray(val) || typeof val === 'string') { + ret = new Array(val.length); + for (i = 0, l = val.length; i < l; i++) { + ret[i] = render(val[i], i); } - // specific handler - var cb; - var i = cbs.length; - while (i--) { - cb = cbs[i]; - if (cb === fn || cb.fn === fn) { - cbs.splice(i, 1); - break - } + } else if (typeof val === 'number') { + ret = new Array(val); + for (i = 0; i < val; i++) { + ret[i] = render(i + 1, i); } - return vm - }; - - Vue.prototype.$emit = function (event) { - var vm = this; - { - var lowerCaseEvent = event.toLowerCase(); - if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { - tip( - "Event \"" + lowerCaseEvent + "\" is emitted in component " + - (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + - "Note that HTML attributes are case-insensitive and you cannot use " + - "v-on to listen to camelCase events when using in-DOM templates. " + - "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." - ); + } else if (isObject(val)) { + if (hasSymbol && val[Symbol.iterator]) { + ret = []; + var iterator = val[Symbol.iterator](); + var result = iterator.next(); + while (!result.done) { + ret.push(render(result.value, ret.length)); + result = iterator.next(); } - } - var cbs = vm._events[event]; - if (cbs) { - cbs = cbs.length > 1 ? toArray(cbs) : cbs; - var args = toArray(arguments, 1); - var info = "event handler for \"" + event + "\""; - for (var i = 0, l = cbs.length; i < l; i++) { - invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } else { + keys = Object.keys(val); + ret = new Array(keys.length); + for (i = 0, l = keys.length; i < l; i++) { + key = keys[i]; + ret[i] = render(val[key], key, i); } } - return vm - }; + } + if (!isDef(ret)) { + ret = []; + } + (ret)._isVList = true; + return ret } /* */ - - /** - * Runtime helper for resolving raw children VNodes into a slot object. + * Runtime helper for rendering */ - function resolveSlots ( - children, - context + function renderSlot ( + name, + fallback, + props, + bindObject ) { - if (!children || !children.length) { - return {} - } - var slots = {}; - for (var i = 0, l = children.length; i < l; i++) { - var child = children[i]; - var data = child.data; - // remove slot attribute if the node is resolved as a Vue slot node - if (data && data.attrs && data.attrs.slot) { - delete data.attrs.slot; - } - // named slots should only be respected if the vnode was rendered in the - // same context. - if ((child.context === context || child.fnContext === context) && - data && data.slot != null - ) { - var name = data.slot; - var slot = (slots[name] || (slots[name] = [])); - if (child.tag === 'template') { - slot.push.apply(slot, child.children || []); - } else { - slot.push(child); + var scopedSlotFn = this.$scopedSlots[name]; + var nodes; + if (scopedSlotFn) { // scoped slot + props = props || {}; + if (bindObject) { + if (!isObject(bindObject)) { + warn( + 'slot v-bind without argument expects an Object', + this + ); } - } else { - (slots.default || (slots.default = [])).push(child); - } - } - // ignore slots that contains only whitespace - for (var name$1 in slots) { - if (slots[name$1].every(isWhitespace)) { - delete slots[name$1]; + props = extend(extend({}, bindObject), props); } + nodes = scopedSlotFn(props) || fallback; + } else { + nodes = this.$slots[name] || fallback; } - return slots - } - - function isWhitespace (node) { - return (node.isComment && !node.asyncFactory) || node.text === ' ' - } - function resolveScopedSlots ( - fns, // see flow/vnode - hasDynamicKeys, - res - ) { - res = res || { $stable: !hasDynamicKeys }; - for (var i = 0; i < fns.length; i++) { - var slot = fns[i]; - if (Array.isArray(slot)) { - resolveScopedSlots(slot, hasDynamicKeys, res); - } else if (slot) { - res[slot.key] = slot.fn; - } + var target = props && props.slot; + if (target) { + return this.$createElement('template', { slot: target }, nodes) + } else { + return nodes } - return res } /* */ - var activeInstance = null; - var isUpdatingChildComponent = false; - - function setActiveInstance(vm) { - var prevActiveInstance = activeInstance; - activeInstance = vm; - return function () { - activeInstance = prevActiveInstance; - } + /** + * Runtime helper for resolving filters + */ + function resolveFilter (id) { + return resolveAsset(this.$options, 'filters', id, true) || identity } - function initLifecycle (vm) { - var options = vm.$options; + /* */ - // locate first non-abstract parent - var parent = options.parent; - if (parent && !options.abstract) { - while (parent.$options.abstract && parent.$parent) { - parent = parent.$parent; - } - parent.$children.push(vm); + function isKeyNotMatch (expect, actual) { + if (Array.isArray(expect)) { + return expect.indexOf(actual) === -1 + } else { + return expect !== actual } + } - vm.$parent = parent; - vm.$root = parent ? parent.$root : vm; - - vm.$children = []; - vm.$refs = {}; - - vm._watcher = null; - vm._inactive = null; - vm._directInactive = false; - vm._isMounted = false; - vm._isDestroyed = false; - vm._isBeingDestroyed = false; + /** + * Runtime helper for checking keyCodes from config. + * exposed as Vue.prototype._k + * passing in eventKeyName as last argument separately for backwards compat + */ + function checkKeyCodes ( + eventKeyCode, + key, + builtInKeyCode, + eventKeyName, + builtInKeyName + ) { + var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; + if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { + return isKeyNotMatch(builtInKeyName, eventKeyName) + } else if (mappedKeyCode) { + return isKeyNotMatch(mappedKeyCode, eventKeyCode) + } else if (eventKeyName) { + return hyphenate(eventKeyName) !== key + } } - function lifecycleMixin (Vue) { - Vue.prototype._update = function (vnode, hydrating) { - var vm = this; - var prevEl = vm.$el; - var prevVnode = vm._vnode; - var restoreActiveInstance = setActiveInstance(vm); - vm._vnode = vnode; - // Vue.prototype.__patch__ is injected in entry points - // based on the rendering backend used. - if (!prevVnode) { - // initial render - vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); + /* */ + + /** + * Runtime helper for merging v-bind="object" into a VNode's data. + */ + function bindObjectProps ( + data, + tag, + value, + asProp, + isSync + ) { + if (value) { + if (!isObject(value)) { + warn( + 'v-bind without argument expects an Object or Array value', + this + ); } else { - // updates - vm.$el = vm.__patch__(prevVnode, vnode); - } - restoreActiveInstance(); - // update __vue__ reference - if (prevEl) { - prevEl.__vue__ = null; - } - if (vm.$el) { - vm.$el.__vue__ = vm; - } - // if parent is an HOC, update its $el as well - if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { - vm.$parent.$el = vm.$el; - } - // updated hook is called by the scheduler to ensure that children are - // updated in a parent's updated hook. - }; + if (Array.isArray(value)) { + value = toObject(value); + } + var hash; + var loop = function ( key ) { + if ( + key === 'class' || + key === 'style' || + isReservedAttribute(key) + ) { + hash = data; + } else { + var type = data.attrs && data.attrs.type; + hash = asProp || config.mustUseProp(tag, type, key) + ? data.domProps || (data.domProps = {}) + : data.attrs || (data.attrs = {}); + } + var camelizedKey = camelize(key); + if (!(key in hash) && !(camelizedKey in hash)) { + hash[key] = value[key]; - Vue.prototype.$forceUpdate = function () { - var vm = this; - if (vm._watcher) { - vm._watcher.update(); - } - }; + if (isSync) { + var on = data.on || (data.on = {}); + on[("update:" + camelizedKey)] = function ($event) { + value[key] = $event; + }; + } + } + }; - Vue.prototype.$destroy = function () { - var vm = this; - if (vm._isBeingDestroyed) { - return - } - callHook(vm, 'beforeDestroy'); - vm._isBeingDestroyed = true; - // remove self from parent - var parent = vm.$parent; - if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { - remove(parent.$children, vm); - } - // teardown watchers - if (vm._watcher) { - vm._watcher.teardown(); - } - var i = vm._watchers.length; - while (i--) { - vm._watchers[i].teardown(); - } - // remove reference from data ob - // frozen object may not have observer. - if (vm._data.__ob__) { - vm._data.__ob__.vmCount--; - } - // call the last hook... - vm._isDestroyed = true; - // invoke destroy hooks on current rendered tree - vm.__patch__(vm._vnode, null); - // fire destroyed hook - callHook(vm, 'destroyed'); - // turn off all instance listeners. - vm.$off(); - // remove __vue__ reference - if (vm.$el) { - vm.$el.__vue__ = null; - } - // release circular reference (#6759) - if (vm.$vnode) { - vm.$vnode.parent = null; + for (var key in value) loop( key ); } - }; + } + return data } - function mountComponent ( - vm, - el, - hydrating + /* */ + + /** + * Runtime helper for rendering static trees. + */ + function renderStatic ( + index, + isInFor ) { - vm.$el = el; - if (!vm.$options.render) { - vm.$options.render = createEmptyVNode; - { - /* istanbul ignore if */ - if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || - vm.$options.el || el) { - warn( - 'You are using the runtime-only build of Vue where the template ' + - 'compiler is not available. Either pre-compile the templates into ' + - 'render functions, or use the compiler-included build.', - vm - ); - } else { - warn( - 'Failed to mount component: template or render function not defined.', - vm - ); - } - } + var cached = this._staticTrees || (this._staticTrees = []); + var tree = cached[index]; + // if has already-rendered static tree and not inside v-for, + // we can reuse the same tree. + if (tree && !isInFor) { + return tree } - callHook(vm, 'beforeMount'); - - var updateComponent; - /* istanbul ignore if */ - if (config.performance && mark) { - updateComponent = function () { - var name = vm._name; - var id = vm._uid; - var startTag = "vue-perf-start:" + id; - var endTag = "vue-perf-end:" + id; + // otherwise, render a fresh tree. + tree = cached[index] = this.$options.staticRenderFns[index].call( + this._renderProxy, + null, + this // for render fns generated for functional component templates + ); + markStatic(tree, ("__static__" + index), false); + return tree + } - mark(startTag); - var vnode = vm._render(); - mark(endTag); - measure(("vue " + name + " render"), startTag, endTag); + /** + * Runtime helper for v-once. + * Effectively it means marking the node as static with a unique key. + */ + function markOnce ( + tree, + index, + key + ) { + markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); + return tree + } - mark(startTag); - vm._update(vnode, hydrating); - mark(endTag); - measure(("vue " + name + " patch"), startTag, endTag); - }; + function markStatic ( + tree, + key, + isOnce + ) { + if (Array.isArray(tree)) { + for (var i = 0; i < tree.length; i++) { + if (tree[i] && typeof tree[i] !== 'string') { + markStaticNode(tree[i], (key + "_" + i), isOnce); + } + } } else { - updateComponent = function () { - vm._update(vm._render(), hydrating); - }; + markStaticNode(tree, key, isOnce); } + } - // we set this to vm._watcher inside the watcher's constructor - // since the watcher's initial patch may call $forceUpdate (e.g. inside child - // component's mounted hook), which relies on vm._watcher being already defined - new Watcher(vm, updateComponent, noop, { - before: function before () { - if (vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'beforeUpdate'); + function markStaticNode (node, key, isOnce) { + node.isStatic = true; + node.key = key; + node.isOnce = isOnce; + } + + /* */ + + function bindObjectListeners (data, value) { + if (value) { + if (!isPlainObject(value)) { + warn( + 'v-on without argument expects an Object value', + this + ); + } else { + var on = data.on = data.on ? extend({}, data.on) : {}; + for (var key in value) { + var existing = on[key]; + var ours = value[key]; + on[key] = existing ? [].concat(existing, ours) : ours; } } - }, true /* isRenderWatcher */); - hydrating = false; - - // manually mounted instance, call mounted on self - // mounted is called for render-created child components in its inserted hook - if (vm.$vnode == null) { - vm._isMounted = true; - callHook(vm, 'mounted'); } - return vm + return data } - function updateChildComponent ( - vm, - propsData, - listeners, - parentVnode, - renderChildren + /* */ + + function resolveScopedSlots ( + fns, // see flow/vnode + hasDynamicKeys, + res ) { - { - isUpdatingChildComponent = true; + res = res || { $stable: !hasDynamicKeys }; + for (var i = 0; i < fns.length; i++) { + var slot = fns[i]; + if (Array.isArray(slot)) { + resolveScopedSlots(slot, hasDynamicKeys, res); + } else if (slot) { + res[slot.key] = slot.fn; + } } + return res + } - // determine whether component has slot children - // we need to do this before overwriting $options._renderChildren. + /* */ - // check if there are dynamic scopedSlots (hand-written or compiled but with - // dynamic slot names). Static scoped slots compiled from template has the - // "$stable" marker. - var hasDynamicScopedSlot = !!( - (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || - (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) - ); - // Any static slot children from the parent may have changed during parent's - // update. Dynamic scoped slots may also have changed. In such cases, a forced - // update is necessary to ensure correctness. - var needsForceUpdate = !!( - renderChildren || // has new static slots - vm.$options._renderChildren || // has old static slots - hasDynamicScopedSlot - ); + function bindDynamicKeys (baseObj, values) { + for (var i = 0; i < values.length; i += 2) { + var key = values[i]; + if (typeof key === 'string' && key) { + baseObj[values[i]] = values[i + 1]; + } else if (key !== '' && key !== null) { + // null is a speical value for explicitly removing a binding + warn( + ("Invalid value for dynamic directive argument (expected string or null): " + key), + this + ); + } + } + return baseObj + } - vm.$options._parentVnode = parentVnode; - vm.$vnode = parentVnode; // update vm's placeholder node without re-render + // helper to dynamically append modifier runtime markers to event names. + // ensure only append when value is already string, otherwise it will be cast + // to string and cause the type check to miss. + function prependModifier (value, symbol) { + return typeof value === 'string' ? symbol + value : value + } - if (vm._vnode) { // update child tree's parent - vm._vnode.parent = parentVnode; - } - vm.$options._renderChildren = renderChildren; + /* */ - // update $attrs and $listeners hash - // these are also reactive so they may trigger child update if the child - // used them during render - vm.$attrs = parentVnode.data.attrs || emptyObject; - vm.$listeners = listeners || emptyObject; + function installRenderHelpers (target) { + target._o = markOnce; + target._n = toNumber; + target._s = toString; + target._l = renderList; + target._t = renderSlot; + target._q = looseEqual; + target._i = looseIndexOf; + target._m = renderStatic; + target._f = resolveFilter; + target._k = checkKeyCodes; + target._b = bindObjectProps; + target._v = createTextVNode; + target._e = createEmptyVNode; + target._u = resolveScopedSlots; + target._g = bindObjectListeners; + target._d = bindDynamicKeys; + target._p = prependModifier; + } - // update props - if (propsData && vm.$options.props) { - toggleObserving(false); - var props = vm._props; - var propKeys = vm.$options._propKeys || []; - for (var i = 0; i < propKeys.length; i++) { - var key = propKeys[i]; - var propOptions = vm.$options.props; // wtf flow? - props[key] = validateProp(key, propOptions, propsData, vm); - } - toggleObserving(true); - // keep a copy of raw propsData - vm.$options.propsData = propsData; + /* */ + + function FunctionalRenderContext ( + data, + props, + children, + parent, + Ctor + ) { + var options = Ctor.options; + // ensure the createElement function in functional components + // gets a unique context - this is necessary for correct named slot check + var contextVm; + if (hasOwn(parent, '_uid')) { + contextVm = Object.create(parent); + // $flow-disable-line + contextVm._original = parent; + } else { + // the context vm passed in is a functional context as well. + // in this case we want to make sure we are able to get a hold to the + // real context instance. + contextVm = parent; + // $flow-disable-line + parent = parent._original; } + var isCompiled = isTrue(options._compiled); + var needNormalization = !isCompiled; - // update listeners - listeners = listeners || emptyObject; - var oldListeners = vm.$options._parentListeners; - vm.$options._parentListeners = listeners; - updateComponentListeners(vm, listeners, oldListeners); + this.data = data; + this.props = props; + this.children = children; + this.parent = parent; + this.listeners = data.on || emptyObject; + this.injections = resolveInject(options.inject, parent); + this.slots = function () { return resolveSlots(children, parent); }; - // resolve slots + force update if has children - if (needsForceUpdate) { - vm.$slots = resolveSlots(renderChildren, parentVnode.context); - vm.$forceUpdate(); - } + Object.defineProperty(this, 'scopedSlots', ({ + enumerable: true, + get: function get () { + return normalizeScopedSlots(data.scopedSlots, this.slots()) + } + })); - { - isUpdatingChildComponent = false; + // support for compiled functional template + if (isCompiled) { + // exposing $options for renderStatic() + this.$options = options; + // pre-resolve slots for renderSlot() + this.$slots = this.slots(); + this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); } - } - function isInInactiveTree (vm) { - while (vm && (vm = vm.$parent)) { - if (vm._inactive) { return true } + if (options._scopeId) { + this._c = function (a, b, c, d) { + var vnode = createElement(contextVm, a, b, c, d, needNormalization); + if (vnode && !Array.isArray(vnode)) { + vnode.fnScopeId = options._scopeId; + vnode.fnContext = parent; + } + return vnode + }; + } else { + this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; } - return false } - function activateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = false; - if (isInInactiveTree(vm)) { - return + installRenderHelpers(FunctionalRenderContext.prototype); + + function createFunctionalComponent ( + Ctor, + propsData, + data, + contextVm, + children + ) { + var options = Ctor.options; + var props = {}; + var propOptions = options.props; + if (isDef(propOptions)) { + for (var key in propOptions) { + props[key] = validateProp(key, propOptions, propsData || emptyObject); } - } else if (vm._directInactive) { - return + } else { + if (isDef(data.attrs)) { mergeProps(props, data.attrs); } + if (isDef(data.props)) { mergeProps(props, data.props); } } - if (vm._inactive || vm._inactive === null) { - vm._inactive = false; - for (var i = 0; i < vm.$children.length; i++) { - activateChildComponent(vm.$children[i]); + + var renderContext = new FunctionalRenderContext( + data, + props, + children, + contextVm, + Ctor + ); + + var vnode = options.render.call(null, renderContext._c, renderContext); + + if (vnode instanceof VNode) { + return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) + } else if (Array.isArray(vnode)) { + var vnodes = normalizeChildren(vnode) || []; + var res = new Array(vnodes.length); + for (var i = 0; i < vnodes.length; i++) { + res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); } - callHook(vm, 'activated'); + return res } } - function deactivateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = true; - if (isInInactiveTree(vm)) { - return - } + function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { + // #7817 clone node before setting fnContext, otherwise if the node is reused + // (e.g. it was from a cached normal slot) the fnContext causes named slots + // that should not be matched to match. + var clone = cloneVNode(vnode); + clone.fnContext = contextVm; + clone.fnOptions = options; + { + (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; } - if (!vm._inactive) { - vm._inactive = true; - for (var i = 0; i < vm.$children.length; i++) { - deactivateChildComponent(vm.$children[i]); - } - callHook(vm, 'deactivated'); + if (data.slot) { + (clone.data || (clone.data = {})).slot = data.slot; } + return clone } - function callHook (vm, hook) { - // #7573 disable dep collection when invoking lifecycle hooks - pushTarget(); - var handlers = vm.$options[hook]; - var info = hook + " hook"; - if (handlers) { - for (var i = 0, j = handlers.length; i < j; i++) { - invokeWithErrorHandling(handlers[i], vm, null, vm, info); - } - } - if (vm._hasHookEvent) { - vm.$emit('hook:' + hook); + function mergeProps (to, from) { + for (var key in from) { + to[camelize(key)] = from[key]; } - popTarget(); } /* */ - var MAX_UPDATE_COUNT = 100; + /* */ - var queue = []; - var activatedChildren = []; - var has = {}; - var circular = {}; - var waiting = false; - var flushing = false; - var index = 0; + /* */ - /** - * Reset the scheduler's state. - */ - function resetSchedulerState () { - index = queue.length = activatedChildren.length = 0; - has = {}; - { - circular = {}; - } - waiting = flushing = false; - } + /* */ - // Async edge case #6566 requires saving the timestamp when event listeners are - // attached. However, calling performance.now() has a perf overhead especially - // if the page has thousands of event listeners. Instead, we take a timestamp - // every time the scheduler flushes and use that for all event listeners - // attached during that flush. - var currentFlushTimestamp = 0; + // inline hooks to be invoked on component VNodes during patch + var componentVNodeHooks = { + init: function init (vnode, hydrating) { + if ( + vnode.componentInstance && + !vnode.componentInstance._isDestroyed && + vnode.data.keepAlive + ) { + // kept-alive components, treat as a patch + var mountedNode = vnode; // work around flow + componentVNodeHooks.prepatch(mountedNode, mountedNode); + } else { + var child = vnode.componentInstance = createComponentInstanceForVnode( + vnode, + activeInstance + ); + child.$mount(hydrating ? vnode.elm : undefined, hydrating); + } + }, - // Async edge case fix requires storing an event listener's attach timestamp. - var getNow = Date.now; + prepatch: function prepatch (oldVnode, vnode) { + var options = vnode.componentOptions; + var child = vnode.componentInstance = oldVnode.componentInstance; + updateChildComponent( + child, + options.propsData, // updated props + options.listeners, // updated listeners + vnode, // new parent vnode + options.children // new children + ); + }, - // Determine what event timestamp the browser is using. Annoyingly, the - // timestamp can either be hi-res ( relative to poge load) or low-res - // (relative to UNIX epoch), so in order to compare time we have to use the - // same timestamp type when saving the flush timestamp. - if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { - // if the low-res timestamp which is bigger than the event timestamp - // (which is evaluated AFTER) it means the event is using a hi-res timestamp, - // and we need to use the hi-res version for event listeners as well. - getNow = function () { return performance.now(); }; - } + insert: function insert (vnode) { + var context = vnode.context; + var componentInstance = vnode.componentInstance; + if (!componentInstance._isMounted) { + componentInstance._isMounted = true; + callHook(componentInstance, 'mounted'); + } + if (vnode.data.keepAlive) { + if (context._isMounted) { + // vue-router#1212 + // During updates, a kept-alive component's child components may + // change, so directly walking the tree here may call activated hooks + // on incorrect children. Instead we push them into a queue which will + // be processed after the whole patch process ended. + queueActivatedComponent(componentInstance); + } else { + activateChildComponent(componentInstance, true /* direct */); + } + } + }, - /** - * Flush both queues and run the watchers. - */ - function flushSchedulerQueue () { - currentFlushTimestamp = getNow(); - flushing = true; - var watcher, id; + destroy: function destroy (vnode) { + var componentInstance = vnode.componentInstance; + if (!componentInstance._isDestroyed) { + if (!vnode.data.keepAlive) { + componentInstance.$destroy(); + } else { + deactivateChildComponent(componentInstance, true /* direct */); + } + } + } + }; - // Sort queue before flush. - // This ensures that: - // 1. Components are updated from parent to child. (because parent is always - // created before the child) - // 2. A component's user watchers are run before its render watcher (because - // user watchers are created before the render watcher) - // 3. If a component is destroyed during a parent component's watcher run, - // its watchers can be skipped. - queue.sort(function (a, b) { return a.id - b.id; }); + var hooksToMerge = Object.keys(componentVNodeHooks); - // do not cache length because more watchers might be pushed - // as we run existing watchers - for (index = 0; index < queue.length; index++) { - watcher = queue[index]; - if (watcher.before) { - watcher.before(); + function createComponent ( + Ctor, + data, + context, + children, + tag + ) { + if (isUndef(Ctor)) { + return + } + + var baseCtor = context.$options._base; + + // plain options object: turn it into a constructor + if (isObject(Ctor)) { + Ctor = baseCtor.extend(Ctor); + } + + // if at this stage it's not a constructor or an async component factory, + // reject. + if (typeof Ctor !== 'function') { + { + warn(("Invalid Component definition: " + (String(Ctor))), context); } - id = watcher.id; - has[id] = null; - watcher.run(); - // in dev build, check and stop circular updates. - if (has[id] != null) { - circular[id] = (circular[id] || 0) + 1; - if (circular[id] > MAX_UPDATE_COUNT) { - warn( - 'You may have an infinite update loop ' + ( - watcher.user - ? ("in watcher with expression \"" + (watcher.expression) + "\"") - : "in a component render function." - ), - watcher.vm - ); - break - } + return + } + + // async component + var asyncFactory; + if (isUndef(Ctor.cid)) { + asyncFactory = Ctor; + Ctor = resolveAsyncComponent(asyncFactory, baseCtor); + if (Ctor === undefined) { + // return a placeholder node for async component, which is rendered + // as a comment node but preserves all the raw information for the node. + // the information will be used for async server-rendering and hydration. + return createAsyncPlaceholder( + asyncFactory, + data, + context, + children, + tag + ) } } - // keep copies of post queues before resetting state - var activatedQueue = activatedChildren.slice(); - var updatedQueue = queue.slice(); + data = data || {}; - resetSchedulerState(); + // resolve constructor options in case global mixins are applied after + // component constructor creation + resolveConstructorOptions(Ctor); - // call component updated and activated hooks - callActivatedHooks(activatedQueue); - callUpdatedHooks(updatedQueue); + // transform component v-model data into props & events + if (isDef(data.model)) { + transformModel(Ctor.options, data); + } - // devtool hook - /* istanbul ignore if */ - if (devtools && config.devtools) { - devtools.emit('flush'); + // extract props + var propsData = extractPropsFromVNodeData(data, Ctor, tag); + + // functional component + if (isTrue(Ctor.options.functional)) { + return createFunctionalComponent(Ctor, propsData, data, context, children) } - } - function callUpdatedHooks (queue) { - var i = queue.length; - while (i--) { - var watcher = queue[i]; - var vm = watcher.vm; - if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { - callHook(vm, 'updated'); + // extract listeners, since these needs to be treated as + // child component listeners instead of DOM listeners + var listeners = data.on; + // replace with listeners with .native modifier + // so it gets processed during parent component patch. + data.on = data.nativeOn; + + if (isTrue(Ctor.options.abstract)) { + // abstract components do not keep anything + // other than props & listeners & slot + + // work around flow + var slot = data.slot; + data = {}; + if (slot) { + data.slot = slot; } } - } - /** - * Queue a kept-alive component that was activated during patch. - * The queue will be processed after the entire tree has been patched. - */ - function queueActivatedComponent (vm) { - // setting _inactive to false here so that a render function can - // rely on checking whether it's in an inactive tree (e.g. router-view) - vm._inactive = false; - activatedChildren.push(vm); + // install component management hooks onto the placeholder node + installComponentHooks(data); + + // return a placeholder vnode + var name = Ctor.options.name || tag; + var vnode = new VNode( + ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), + data, undefined, undefined, undefined, context, + { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, + asyncFactory + ); + + return vnode } - function callActivatedHooks (queue) { - for (var i = 0; i < queue.length; i++) { - queue[i]._inactive = true; - activateChildComponent(queue[i], true /* true */); + function createComponentInstanceForVnode ( + vnode, // we know it's MountedComponentVNode but flow doesn't + parent // activeInstance in lifecycle state + ) { + var options = { + _isComponent: true, + _parentVnode: vnode, + parent: parent + }; + // check inline-template render functions + var inlineTemplate = vnode.data.inlineTemplate; + if (isDef(inlineTemplate)) { + options.render = inlineTemplate.render; + options.staticRenderFns = inlineTemplate.staticRenderFns; } + return new vnode.componentOptions.Ctor(options) } - /** - * Push a watcher into the watcher queue. - * Jobs with duplicate IDs will be skipped unless it's - * pushed when the queue is being flushed. - */ - function queueWatcher (watcher) { - var id = watcher.id; - if (has[id] == null) { - has[id] = true; - if (!flushing) { - queue.push(watcher); - } else { - // if already flushing, splice the watcher based on its id - // if already past its id, it will be run next immediately. - var i = queue.length - 1; - while (i > index && queue[i].id > watcher.id) { - i--; - } - queue.splice(i + 1, 0, watcher); + function installComponentHooks (data) { + var hooks = data.hook || (data.hook = {}); + for (var i = 0; i < hooksToMerge.length; i++) { + var key = hooksToMerge[i]; + var existing = hooks[key]; + var toMerge = componentVNodeHooks[key]; + if (existing !== toMerge && !(existing && existing._merged)) { + hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; } - // queue the flush - if (!waiting) { - waiting = true; + } + } - if (!config.async) { - flushSchedulerQueue(); - return - } - nextTick(flushSchedulerQueue); + function mergeHook$1 (f1, f2) { + var merged = function (a, b) { + // flow complains about extra args which is why we use any + f1(a, b); + f2(a, b); + }; + merged._merged = true; + return merged + } + + // transform component v-model info (value and callback) into + // prop and event handler respectively. + function transformModel (options, data) { + var prop = (options.model && options.model.prop) || 'value'; + var event = (options.model && options.model.event) || 'input' + ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; + var on = data.on || (data.on = {}); + var existing = on[event]; + var callback = data.model.callback; + if (isDef(existing)) { + if ( + Array.isArray(existing) + ? existing.indexOf(callback) === -1 + : existing !== callback + ) { + on[event] = [callback].concat(existing); } + } else { + on[event] = callback; } } /* */ + var SIMPLE_NORMALIZE = 1; + var ALWAYS_NORMALIZE = 2; + // wrapper function for providing a more flexible interface + // without getting yelled at by flow + function createElement ( + context, + tag, + data, + children, + normalizationType, + alwaysNormalize + ) { + if (Array.isArray(data) || isPrimitive(data)) { + normalizationType = children; + children = data; + data = undefined; + } + if (isTrue(alwaysNormalize)) { + normalizationType = ALWAYS_NORMALIZE; + } + return _createElement(context, tag, data, children, normalizationType) + } - var uid$1 = 0; - - /** - * A watcher parses an expression, collects dependencies, - * and fires callback when the expression value changes. - * This is used for both the $watch() api and directives. - */ - var Watcher = function Watcher ( - vm, - expOrFn, - cb, - options, - isRenderWatcher + function _createElement ( + context, + tag, + data, + children, + normalizationType ) { - this.vm = vm; - if (isRenderWatcher) { - vm._watcher = this; + if (isDef(data) && isDef((data).__ob__)) { + warn( + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + + 'Always create fresh vnode data objects in each render!', + context + ); + return createEmptyVNode() } - vm._watchers.push(this); - // options - if (options) { - this.deep = !!options.deep; - this.user = !!options.user; - this.lazy = !!options.lazy; - this.sync = !!options.sync; - this.before = options.before; - } else { - this.deep = this.user = this.lazy = this.sync = false; + // object syntax in v-bind + if (isDef(data) && isDef(data.is)) { + tag = data.is; } - this.cb = cb; - this.id = ++uid$1; // uid for batching - this.active = true; - this.dirty = this.lazy; // for lazy watchers - this.deps = []; - this.newDeps = []; - this.depIds = new _Set(); - this.newDepIds = new _Set(); - this.expression = expOrFn.toString(); - // parse expression for getter - if (typeof expOrFn === 'function') { - this.getter = expOrFn; - } else { - this.getter = parsePath(expOrFn); - if (!this.getter) { - this.getter = noop; + if (!tag) { + // in case of component :is set to falsy value + return createEmptyVNode() + } + // warn against non-primitive key + if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) + ) { + { warn( - "Failed watching path: \"" + expOrFn + "\" " + - 'Watcher only accepts simple dot-delimited paths. ' + - 'For full control, use a function instead.', - vm + 'Avoid using non-primitive value as key, ' + + 'use string/number value instead.', + context ); } } - this.value = this.lazy - ? undefined - : this.get(); - }; - - /** - * Evaluate the getter, and re-collect dependencies. - */ - Watcher.prototype.get = function get () { - pushTarget(this); - var value; - var vm = this.vm; - try { - value = this.getter.call(vm, vm); - } catch (e) { - if (this.user) { - handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); + // support single function children as default scoped slot + if (Array.isArray(children) && + typeof children[0] === 'function' + ) { + data = data || {}; + data.scopedSlots = { default: children[0] }; + children.length = 0; + } + if (normalizationType === ALWAYS_NORMALIZE) { + children = normalizeChildren(children); + } else if (normalizationType === SIMPLE_NORMALIZE) { + children = simpleNormalizeChildren(children); + } + var vnode, ns; + if (typeof tag === 'string') { + var Ctor; + ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); + if (config.isReservedTag(tag)) { + // platform built-in elements + vnode = new VNode( + config.parsePlatformTagName(tag), data, children, + undefined, undefined, context + ); + } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { + // component + vnode = createComponent(Ctor, data, context, children, tag); } else { - throw e - } - } finally { - // "touch" every property so they are all tracked as - // dependencies for deep watching - if (this.deep) { - traverse(value); + // unknown or unlisted namespaced elements + // check at runtime because it may get assigned a namespace when its + // parent normalizes children + vnode = new VNode( + tag, data, children, + undefined, undefined, context + ); } - popTarget(); - this.cleanupDeps(); + } else { + // direct component options / constructor + vnode = createComponent(tag, data, context, children); } - return value - }; + if (Array.isArray(vnode)) { + return vnode + } else if (isDef(vnode)) { + if (isDef(ns)) { applyNS(vnode, ns); } + if (isDef(data)) { registerDeepBindings(data); } + return vnode + } else { + return createEmptyVNode() + } + } - /** - * Add a dependency to this directive. - */ - Watcher.prototype.addDep = function addDep (dep) { - var id = dep.id; - if (!this.newDepIds.has(id)) { - this.newDepIds.add(id); - this.newDeps.push(dep); - if (!this.depIds.has(id)) { - dep.addSub(this); + function applyNS (vnode, ns, force) { + vnode.ns = ns; + if (vnode.tag === 'foreignObject') { + // use default namespace inside foreignObject + ns = undefined; + force = true; + } + if (isDef(vnode.children)) { + for (var i = 0, l = vnode.children.length; i < l; i++) { + var child = vnode.children[i]; + if (isDef(child.tag) && ( + isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { + applyNS(child, ns, force); + } } } - }; + } - /** - * Clean up for dependency collection. - */ - Watcher.prototype.cleanupDeps = function cleanupDeps () { - var i = this.deps.length; - while (i--) { - var dep = this.deps[i]; - if (!this.newDepIds.has(dep.id)) { - dep.removeSub(this); - } + // ref #5318 + // necessary to ensure parent re-render when deep bindings like :style and + // :class are used on slot nodes + function registerDeepBindings (data) { + if (isObject(data.style)) { + traverse(data.style); } - var tmp = this.depIds; - this.depIds = this.newDepIds; - this.newDepIds = tmp; - this.newDepIds.clear(); - tmp = this.deps; - this.deps = this.newDeps; - this.newDeps = tmp; - this.newDeps.length = 0; - }; + if (isObject(data.class)) { + traverse(data.class); + } + } + + /* */ + + function initRender (vm) { + vm._vnode = null; // the root of the child tree + vm._staticTrees = null; // v-once cached trees + var options = vm.$options; + var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree + var renderContext = parentVnode && parentVnode.context; + vm.$slots = resolveSlots(options._renderChildren, renderContext); + vm.$scopedSlots = emptyObject; + // bind the createElement fn to this instance + // so that we get proper render context inside it. + // args order: tag, data, children, normalizationType, alwaysNormalize + // internal version is used by render functions compiled from templates + vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; + // normalization is always applied for the public version, used in + // user-written render functions. + vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; + + // $attrs & $listeners are exposed for easier HOC creation. + // they need to be reactive so that HOCs using them are always updated + var parentData = parentVnode && parentVnode.data; - /** - * Subscriber interface. - * Will be called when a dependency changes. - */ - Watcher.prototype.update = function update () { /* istanbul ignore else */ - if (this.lazy) { - this.dirty = true; - } else if (this.sync) { - this.run(); - } else { - queueWatcher(this); + { + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { + !isUpdatingChildComponent && warn("$attrs is readonly.", vm); + }, true); + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { + !isUpdatingChildComponent && warn("$listeners is readonly.", vm); + }, true); } - }; + } - /** - * Scheduler job interface. - * Will be called by the scheduler. - */ - Watcher.prototype.run = function run () { - if (this.active) { - var value = this.get(); - if ( - value !== this.value || - // Deep watchers and watchers on Object/Arrays should fire even - // when the value is the same, because the value may - // have mutated. - isObject(value) || - this.deep - ) { - // set new value - var oldValue = this.value; - this.value = value; - if (this.user) { - try { - this.cb.call(this.vm, value, oldValue); - } catch (e) { - handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); - } - } else { - this.cb.call(this.vm, value, oldValue); - } - } - } - }; + var currentRenderingInstance = null; - /** - * Evaluate the value of the watcher. - * This only gets called for lazy watchers. - */ - Watcher.prototype.evaluate = function evaluate () { - this.value = this.get(); - this.dirty = false; - }; + function renderMixin (Vue) { + // install runtime convenience helpers + installRenderHelpers(Vue.prototype); - /** - * Depend on all deps collected by this watcher. - */ - Watcher.prototype.depend = function depend () { - var i = this.deps.length; - while (i--) { - this.deps[i].depend(); - } - }; + Vue.prototype.$nextTick = function (fn) { + return nextTick(fn, this) + }; - /** - * Remove self from all dependencies' subscriber list. - */ - Watcher.prototype.teardown = function teardown () { - if (this.active) { - // remove self from vm's watcher list - // this is a somewhat expensive operation so we skip it - // if the vm is being destroyed. - if (!this.vm._isBeingDestroyed) { - remove(this.vm._watchers, this); + Vue.prototype._render = function () { + var vm = this; + var ref = vm.$options; + var render = ref.render; + var _parentVnode = ref._parentVnode; + + if (_parentVnode) { + vm.$scopedSlots = normalizeScopedSlots( + _parentVnode.data.scopedSlots, + vm.$slots + ); } - var i = this.deps.length; - while (i--) { - this.deps[i].removeSub(this); + + // set parent vnode. this allows render functions to have access + // to the data on the placeholder node. + vm.$vnode = _parentVnode; + // render self + var vnode; + try { + // There's no need to maintain a stack becaues all render fns are called + // separately from one another. Nested component's render fns are called + // when parent component is patched. + currentRenderingInstance = vm; + vnode = render.call(vm._renderProxy, vm.$createElement); + } catch (e) { + handleError(e, vm, "render"); + // return error render result, + // or previous vnode to prevent render error causing blank component + /* istanbul ignore else */ + if (vm.$options.renderError) { + try { + vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); + } catch (e) { + handleError(e, vm, "renderError"); + vnode = vm._vnode; + } + } else { + vnode = vm._vnode; + } + } finally { + currentRenderingInstance = null; } - this.active = false; - } - }; + // if the returned array contains only a single node, allow it + if (Array.isArray(vnode) && vnode.length === 1) { + vnode = vnode[0]; + } + // return empty vnode in case the render function errored out + if (!(vnode instanceof VNode)) { + if (Array.isArray(vnode)) { + warn( + 'Multiple root nodes returned from render function. Render function ' + + 'should return a single root node.', + vm + ); + } + vnode = createEmptyVNode(); + } + // set parent + vnode.parent = _parentVnode; + return vnode + }; + } /* */ - var sharedPropertyDefinition = { - enumerable: true, - configurable: true, - get: noop, - set: noop - }; + function ensureCtor (comp, base) { + if ( + comp.__esModule || + (hasSymbol && comp[Symbol.toStringTag] === 'Module') + ) { + comp = comp.default; + } + return isObject(comp) + ? base.extend(comp) + : comp + } - function proxy (target, sourceKey, key) { - sharedPropertyDefinition.get = function proxyGetter () { - return this[sourceKey][key] - }; - sharedPropertyDefinition.set = function proxySetter (val) { - this[sourceKey][key] = val; - }; - Object.defineProperty(target, key, sharedPropertyDefinition); + function createAsyncPlaceholder ( + factory, + data, + context, + children, + tag + ) { + var node = createEmptyVNode(); + node.asyncFactory = factory; + node.asyncMeta = { data: data, context: context, children: children, tag: tag }; + return node } - function initState (vm) { - vm._watchers = []; - var opts = vm.$options; - if (opts.props) { initProps(vm, opts.props); } - if (opts.methods) { initMethods(vm, opts.methods); } - if (opts.data) { - initData(vm); - } else { - observe(vm._data = {}, true /* asRootData */); + function resolveAsyncComponent ( + factory, + baseCtor + ) { + if (isTrue(factory.error) && isDef(factory.errorComp)) { + return factory.errorComp } - if (opts.computed) { initComputed(vm, opts.computed); } - if (opts.watch && opts.watch !== nativeWatch) { - initWatch(vm, opts.watch); + + if (isDef(factory.resolved)) { + return factory.resolved } - } - function initProps (vm, propsOptions) { - var propsData = vm.$options.propsData || {}; - var props = vm._props = {}; - // cache prop keys so that future props updates can iterate using Array - // instead of dynamic object key enumeration. - var keys = vm.$options._propKeys = []; - var isRoot = !vm.$parent; - // root instance props should be converted - if (!isRoot) { - toggleObserving(false); + if (isTrue(factory.loading) && isDef(factory.loadingComp)) { + return factory.loadingComp } - var loop = function ( key ) { - keys.push(key); - var value = validateProp(key, propsOptions, propsData, vm); - /* istanbul ignore else */ - { - var hyphenatedKey = hyphenate(key); - if (isReservedAttribute(hyphenatedKey) || - config.isReservedAttr(hyphenatedKey)) { - warn( - ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), - vm - ); + + var owner = currentRenderingInstance; + if (isDef(factory.owners)) { + // already pending + factory.owners.push(owner); + } else { + var owners = factory.owners = [owner]; + var sync = true; + + var forceRender = function (renderCompleted) { + for (var i = 0, l = owners.length; i < l; i++) { + (owners[i]).$forceUpdate(); } - defineReactive$$1(props, key, value, function () { - if (!isRoot && !isUpdatingChildComponent) { - warn( - "Avoid mutating a prop directly since the value will be " + - "overwritten whenever the parent component re-renders. " + - "Instead, use a data or computed property based on the prop's " + - "value. Prop being mutated: \"" + key + "\"", - vm - ); - } - }); - } - // static props are already proxied on the component's prototype - // during Vue.extend(). We only need to proxy props defined at - // instantiation here. - if (!(key in vm)) { - proxy(vm, "_props", key); - } - }; - for (var key in propsOptions) loop( key ); - toggleObserving(true); - } + if (renderCompleted) { + owners.length = 0; + } + }; - function initData (vm) { - var data = vm.$options.data; - data = vm._data = typeof data === 'function' - ? getData(data, vm) - : data || {}; - if (!isPlainObject(data)) { - data = {}; - warn( - 'data functions should return an object:\n' + - 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', - vm - ); - } - // proxy data on instance - var keys = Object.keys(data); - var props = vm.$options.props; - var methods = vm.$options.methods; - var i = keys.length; - while (i--) { - var key = keys[i]; - { - if (methods && hasOwn(methods, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a data property."), - vm - ); + var resolve = once(function (res) { + // cache resolved + factory.resolved = ensureCtor(res, baseCtor); + // invoke callbacks only if this is not a synchronous resolve + // (async resolves are shimmed as synchronous during SSR) + if (!sync) { + forceRender(true); + } else { + owners.length = 0; } - } - if (props && hasOwn(props, key)) { + }); + + var reject = once(function (reason) { warn( - "The data property \"" + key + "\" is already declared as a prop. " + - "Use prop default value instead.", - vm + "Failed to resolve async component: " + (String(factory)) + + (reason ? ("\nReason: " + reason) : '') ); - } else if (!isReserved(key)) { - proxy(vm, "_data", key); - } - } - // observe data - observe(data, true /* asRootData */); - } + if (isDef(factory.errorComp)) { + factory.error = true; + forceRender(true); + } + }); + + var res = factory(resolve, reject); + + if (isObject(res)) { + if (isPromise(res)) { + // () => Promise + if (isUndef(factory.resolved)) { + res.then(resolve, reject); + } + } else if (isPromise(res.component)) { + res.component.then(resolve, reject); + + if (isDef(res.error)) { + factory.errorComp = ensureCtor(res.error, baseCtor); + } + + if (isDef(res.loading)) { + factory.loadingComp = ensureCtor(res.loading, baseCtor); + if (res.delay === 0) { + factory.loading = true; + } else { + setTimeout(function () { + if (isUndef(factory.resolved) && isUndef(factory.error)) { + factory.loading = true; + forceRender(false); + } + }, res.delay || 200); + } + } + + if (isDef(res.timeout)) { + setTimeout(function () { + if (isUndef(factory.resolved)) { + reject( + "timeout (" + (res.timeout) + "ms)" + ); + } + }, res.timeout); + } + } + } - function getData (data, vm) { - // #7573 disable dep collection when invoking data getters - pushTarget(); - try { - return data.call(vm, vm) - } catch (e) { - handleError(e, vm, "data()"); - return {} - } finally { - popTarget(); + sync = false; + // return in case resolved synchronously + return factory.loading + ? factory.loadingComp + : factory.resolved } } - var computedWatcherOptions = { lazy: true }; - - function initComputed (vm, computed) { - // $flow-disable-line - var watchers = vm._computedWatchers = Object.create(null); - // computed properties are just getters during SSR - var isSSR = isServerRendering(); + /* */ - for (var key in computed) { - var userDef = computed[key]; - var getter = typeof userDef === 'function' ? userDef : userDef.get; - if (getter == null) { - warn( - ("Getter is missing for computed property \"" + key + "\"."), - vm - ); - } + function isAsyncPlaceholder (node) { + return node.isComment && node.asyncFactory + } - if (!isSSR) { - // create internal watcher for the computed property. - watchers[key] = new Watcher( - vm, - getter || noop, - noop, - computedWatcherOptions - ); - } + /* */ - // component-defined computed properties are already defined on the - // component prototype. We only need to define computed properties defined - // at instantiation here. - if (!(key in vm)) { - defineComputed(vm, key, userDef); - } else { - if (key in vm.$data) { - warn(("The computed property \"" + key + "\" is already defined in data."), vm); - } else if (vm.$options.props && key in vm.$options.props) { - warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); + function getFirstComponentChild (children) { + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + var c = children[i]; + if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { + return c } } } } - function defineComputed ( - target, - key, - userDef - ) { - var shouldCache = !isServerRendering(); - if (typeof userDef === 'function') { - sharedPropertyDefinition.get = shouldCache - ? createComputedGetter(key) - : createGetterInvoker(userDef); - sharedPropertyDefinition.set = noop; - } else { - sharedPropertyDefinition.get = userDef.get - ? shouldCache && userDef.cache !== false - ? createComputedGetter(key) - : createGetterInvoker(userDef.get) - : noop; - sharedPropertyDefinition.set = userDef.set || noop; - } - if (sharedPropertyDefinition.set === noop) { - sharedPropertyDefinition.set = function () { - warn( - ("Computed property \"" + key + "\" was assigned to but it has no setter."), - this - ); - }; - } - Object.defineProperty(target, key, sharedPropertyDefinition); - } + /* */ - function createComputedGetter (key) { - return function computedGetter () { - var watcher = this._computedWatchers && this._computedWatchers[key]; - if (watcher) { - if (watcher.dirty) { - watcher.evaluate(); - } - if (Dep.target) { - watcher.depend(); - } - return watcher.value - } + /* */ + + function initEvents (vm) { + vm._events = Object.create(null); + vm._hasHookEvent = false; + // init parent attached events + var listeners = vm.$options._parentListeners; + if (listeners) { + updateComponentListeners(vm, listeners); } } - function createGetterInvoker(fn) { - return function computedGetter () { - return fn.call(this, this) - } + var target; + + function add (event, fn) { + target.$on(event, fn); } - function initMethods (vm, methods) { - var props = vm.$options.props; - for (var key in methods) { - { - if (typeof methods[key] !== 'function') { - warn( - "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + - "Did you reference the function correctly?", - vm - ); - } - if (props && hasOwn(props, key)) { - warn( - ("Method \"" + key + "\" has already been defined as a prop."), - vm - ); - } - if ((key in vm) && isReserved(key)) { - warn( - "Method \"" + key + "\" conflicts with an existing Vue instance method. " + - "Avoid defining component methods that start with _ or $." - ); - } - } - vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); - } + function remove$1 (event, fn) { + target.$off(event, fn); } - function initWatch (vm, watch) { - for (var key in watch) { - var handler = watch[key]; - if (Array.isArray(handler)) { - for (var i = 0; i < handler.length; i++) { - createWatcher(vm, key, handler[i]); - } - } else { - createWatcher(vm, key, handler); + function createOnceHandler (event, fn) { + var _target = target; + return function onceHandler () { + var res = fn.apply(null, arguments); + if (res !== null) { + _target.$off(event, onceHandler); } } } - function createWatcher ( + function updateComponentListeners ( vm, - expOrFn, - handler, - options + listeners, + oldListeners ) { - if (isPlainObject(handler)) { - options = handler; - handler = handler.handler; - } - if (typeof handler === 'string') { - handler = vm[handler]; - } - return vm.$watch(expOrFn, handler, options) + target = vm; + updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); + target = undefined; } - function stateMixin (Vue) { - // flow somehow has problems with directly declared definition object - // when using Object.defineProperty, so we have to procedurally build up - // the object here. - var dataDef = {}; - dataDef.get = function () { return this._data }; - var propsDef = {}; - propsDef.get = function () { return this._props }; - { - dataDef.set = function () { - warn( - 'Avoid replacing instance root $data. ' + - 'Use nested data properties instead.', - this - ); - }; - propsDef.set = function () { - warn("$props is readonly.", this); - }; - } - Object.defineProperty(Vue.prototype, '$data', dataDef); - Object.defineProperty(Vue.prototype, '$props', propsDef); + function eventsMixin (Vue) { + var hookRE = /^hook:/; + Vue.prototype.$on = function (event, fn) { + var vm = this; + if (Array.isArray(event)) { + for (var i = 0, l = event.length; i < l; i++) { + vm.$on(event[i], fn); + } + } else { + (vm._events[event] || (vm._events[event] = [])).push(fn); + // optimize hook:event cost by using a boolean flag marked at registration + // instead of a hash lookup + if (hookRE.test(event)) { + vm._hasHookEvent = true; + } + } + return vm + }; - Vue.prototype.$set = set; - Vue.prototype.$delete = del; + Vue.prototype.$once = function (event, fn) { + var vm = this; + function on () { + vm.$off(event, on); + fn.apply(vm, arguments); + } + on.fn = fn; + vm.$on(event, on); + return vm + }; + + Vue.prototype.$off = function (event, fn) { + var vm = this; + // all + if (!arguments.length) { + vm._events = Object.create(null); + return vm + } + // array of events + if (Array.isArray(event)) { + for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { + vm.$off(event[i$1], fn); + } + return vm + } + // specific event + var cbs = vm._events[event]; + if (!cbs) { + return vm + } + if (!fn) { + vm._events[event] = null; + return vm + } + // specific handler + var cb; + var i = cbs.length; + while (i--) { + cb = cbs[i]; + if (cb === fn || cb.fn === fn) { + cbs.splice(i, 1); + break + } + } + return vm + }; - Vue.prototype.$watch = function ( - expOrFn, - cb, - options - ) { + Vue.prototype.$emit = function (event) { var vm = this; - if (isPlainObject(cb)) { - return createWatcher(vm, expOrFn, cb, options) - } - options = options || {}; - options.user = true; - var watcher = new Watcher(vm, expOrFn, cb, options); - if (options.immediate) { - try { - cb.call(vm, watcher.value); - } catch (error) { - handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); + { + var lowerCaseEvent = event.toLowerCase(); + if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { + tip( + "Event \"" + lowerCaseEvent + "\" is emitted in component " + + (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + + "Note that HTML attributes are case-insensitive and you cannot use " + + "v-on to listen to camelCase events when using in-DOM templates. " + + "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." + ); } } - return function unwatchFn () { - watcher.teardown(); + var cbs = vm._events[event]; + if (cbs) { + cbs = cbs.length > 1 ? toArray(cbs) : cbs; + var args = toArray(arguments, 1); + var info = "event handler for \"" + event + "\""; + for (var i = 0, l = cbs.length; i < l; i++) { + invokeWithErrorHandling(cbs[i], vm, args, vm, info); + } } + return vm }; } /* */ - function initProvide (vm) { - var provide = vm.$options.provide; - if (provide) { - vm._provided = typeof provide === 'function' - ? provide.call(vm) - : provide; - } - } + var activeInstance = null; + var isUpdatingChildComponent = false; - function initInjections (vm) { - var result = resolveInject(vm.$options.inject, vm); - if (result) { - toggleObserving(false); - Object.keys(result).forEach(function (key) { - /* istanbul ignore else */ - { - defineReactive$$1(vm, key, result[key], function () { - warn( - "Avoid mutating an injected value directly since the changes will be " + - "overwritten whenever the provided component re-renders. " + - "injection being mutated: \"" + key + "\"", - vm - ); - }); - } - }); - toggleObserving(true); + function setActiveInstance(vm) { + var prevActiveInstance = activeInstance; + activeInstance = vm; + return function () { + activeInstance = prevActiveInstance; } } - function resolveInject (inject, vm) { - if (inject) { - // inject is :any because flow is not smart enough to figure out cached - var result = Object.create(null); - var keys = hasSymbol - ? Reflect.ownKeys(inject) - : Object.keys(inject); + function initLifecycle (vm) { + var options = vm.$options; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - // #6574 in case the inject object is observed... - if (key === '__ob__') { continue } - var provideKey = inject[key].from; - var source = vm; - while (source) { - if (source._provided && hasOwn(source._provided, provideKey)) { - result[key] = source._provided[provideKey]; - break - } - source = source.$parent; - } - if (!source) { - if ('default' in inject[key]) { - var provideDefault = inject[key].default; - result[key] = typeof provideDefault === 'function' - ? provideDefault.call(vm) - : provideDefault; - } else { - warn(("Injection \"" + key + "\" not found"), vm); - } - } + // locate first non-abstract parent + var parent = options.parent; + if (parent && !options.abstract) { + while (parent.$options.abstract && parent.$parent) { + parent = parent.$parent; } - return result + parent.$children.push(vm); } - } - - /* */ - function normalizeScopedSlots ( - slots, - normalSlots - ) { - var res; - if (!slots) { - res = {}; - } else if (slots._normalized) { - return slots - } else { - res = {}; - for (var key in slots) { - if (slots[key] && key[0] !== '$') { - res[key] = normalizeScopedSlot(normalSlots, key, slots[key]); - } - } - } - // expose normal slots on scopedSlots - for (var key$1 in normalSlots) { - if (!(key$1 in res)) { - res[key$1] = proxyNormalSlot(normalSlots, key$1); - } - } - res._normalized = true; - res.$stable = slots ? slots.$stable : true; - return res - } + vm.$parent = parent; + vm.$root = parent ? parent.$root : vm; - function normalizeScopedSlot(normalSlots, key, fn) { - var normalized = function (scope) { - if ( scope === void 0 ) scope = {}; + vm.$children = []; + vm.$refs = {}; - var res = fn(scope); - return res && typeof res === 'object' && !Array.isArray(res) - ? [res] // single vnode - : normalizeChildren(res) - }; - // proxy scoped slots on normal $slots - if (!hasOwn(normalSlots, key)) { - Object.defineProperty(normalSlots, key, { - get: normalized - }); - } - return normalized + vm._watcher = null; + vm._inactive = null; + vm._directInactive = false; + vm._isMounted = false; + vm._isDestroyed = false; + vm._isBeingDestroyed = false; } - function proxyNormalSlot(slots, key) { - return function () { return slots[key]; } - } + function lifecycleMixin (Vue) { + Vue.prototype._update = function (vnode, hydrating) { + var vm = this; + var prevEl = vm.$el; + var prevVnode = vm._vnode; + var restoreActiveInstance = setActiveInstance(vm); + vm._vnode = vnode; + // Vue.prototype.__patch__ is injected in entry points + // based on the rendering backend used. + if (!prevVnode) { + // initial render + vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); + } else { + // updates + vm.$el = vm.__patch__(prevVnode, vnode); + } + restoreActiveInstance(); + // update __vue__ reference + if (prevEl) { + prevEl.__vue__ = null; + } + if (vm.$el) { + vm.$el.__vue__ = vm; + } + // if parent is an HOC, update its $el as well + if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { + vm.$parent.$el = vm.$el; + } + // updated hook is called by the scheduler to ensure that children are + // updated in a parent's updated hook. + }; - /* */ + Vue.prototype.$forceUpdate = function () { + var vm = this; + if (vm._watcher) { + vm._watcher.update(); + } + }; - /** - * Runtime helper for rendering v-for lists. - */ - function renderList ( - val, - render - ) { - var ret, i, l, keys, key; - if (Array.isArray(val) || typeof val === 'string') { - ret = new Array(val.length); - for (i = 0, l = val.length; i < l; i++) { - ret[i] = render(val[i], i); + Vue.prototype.$destroy = function () { + var vm = this; + if (vm._isBeingDestroyed) { + return } - } else if (typeof val === 'number') { - ret = new Array(val); - for (i = 0; i < val; i++) { - ret[i] = render(i + 1, i); + callHook(vm, 'beforeDestroy'); + vm._isBeingDestroyed = true; + // remove self from parent + var parent = vm.$parent; + if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { + remove(parent.$children, vm); + } + // teardown watchers + if (vm._watcher) { + vm._watcher.teardown(); + } + var i = vm._watchers.length; + while (i--) { + vm._watchers[i].teardown(); + } + // remove reference from data ob + // frozen object may not have observer. + if (vm._data.__ob__) { + vm._data.__ob__.vmCount--; + } + // call the last hook... + vm._isDestroyed = true; + // invoke destroy hooks on current rendered tree + vm.__patch__(vm._vnode, null); + // fire destroyed hook + callHook(vm, 'destroyed'); + // turn off all instance listeners. + vm.$off(); + // remove __vue__ reference + if (vm.$el) { + vm.$el.__vue__ = null; } - } else if (isObject(val)) { - if (hasSymbol && val[Symbol.iterator]) { - ret = []; - var iterator = val[Symbol.iterator](); - var result = iterator.next(); - while (!result.done) { - ret.push(render(result.value, ret.length)); - result = iterator.next(); - } - } else { - keys = Object.keys(val); - ret = new Array(keys.length); - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - ret[i] = render(val[key], key, i); - } + // release circular reference (#6759) + if (vm.$vnode) { + vm.$vnode.parent = null; } - } - if (!isDef(ret)) { - ret = []; - } - (ret)._isVList = true; - return ret + }; } - /* */ - - /** - * Runtime helper for rendering - */ - function renderSlot ( - name, - fallback, - props, - bindObject + function mountComponent ( + vm, + el, + hydrating ) { - var scopedSlotFn = this.$scopedSlots[name]; - var nodes; - if (scopedSlotFn) { // scoped slot - props = props || {}; - if (bindObject) { - if (!isObject(bindObject)) { + vm.$el = el; + if (!vm.$options.render) { + vm.$options.render = createEmptyVNode; + { + /* istanbul ignore if */ + if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || + vm.$options.el || el) { warn( - 'slot v-bind without argument expects an Object', - this + 'You are using the runtime-only build of Vue where the template ' + + 'compiler is not available. Either pre-compile the templates into ' + + 'render functions, or use the compiler-included build.', + vm + ); + } else { + warn( + 'Failed to mount component: template or render function not defined.', + vm ); } - props = extend(extend({}, bindObject), props); } - nodes = scopedSlotFn(props) || fallback; - } else { - nodes = this.$slots[name] || fallback; } + callHook(vm, 'beforeMount'); - var target = props && props.slot; - if (target) { - return this.$createElement('template', { slot: target }, nodes) - } else { - return nodes - } - } + var updateComponent; + /* istanbul ignore if */ + if (config.performance && mark) { + updateComponent = function () { + var name = vm._name; + var id = vm._uid; + var startTag = "vue-perf-start:" + id; + var endTag = "vue-perf-end:" + id; - /* */ + mark(startTag); + var vnode = vm._render(); + mark(endTag); + measure(("vue " + name + " render"), startTag, endTag); - /** - * Runtime helper for resolving filters - */ - function resolveFilter (id) { - return resolveAsset(this.$options, 'filters', id, true) || identity - } + mark(startTag); + vm._update(vnode, hydrating); + mark(endTag); + measure(("vue " + name + " patch"), startTag, endTag); + }; + } else { + updateComponent = function () { + vm._update(vm._render(), hydrating); + }; + } - /* */ + // we set this to vm._watcher inside the watcher's constructor + // since the watcher's initial patch may call $forceUpdate (e.g. inside child + // component's mounted hook), which relies on vm._watcher being already defined + new Watcher(vm, updateComponent, noop, { + before: function before () { + if (vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'beforeUpdate'); + } + } + }, true /* isRenderWatcher */); + hydrating = false; - function isKeyNotMatch (expect, actual) { - if (Array.isArray(expect)) { - return expect.indexOf(actual) === -1 - } else { - return expect !== actual + // manually mounted instance, call mounted on self + // mounted is called for render-created child components in its inserted hook + if (vm.$vnode == null) { + vm._isMounted = true; + callHook(vm, 'mounted'); } + return vm } - /** - * Runtime helper for checking keyCodes from config. - * exposed as Vue.prototype._k - * passing in eventKeyName as last argument separately for backwards compat - */ - function checkKeyCodes ( - eventKeyCode, - key, - builtInKeyCode, - eventKeyName, - builtInKeyName + function updateChildComponent ( + vm, + propsData, + listeners, + parentVnode, + renderChildren ) { - var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; - if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { - return isKeyNotMatch(builtInKeyName, eventKeyName) - } else if (mappedKeyCode) { - return isKeyNotMatch(mappedKeyCode, eventKeyCode) - } else if (eventKeyName) { - return hyphenate(eventKeyName) !== key + { + isUpdatingChildComponent = true; } - } - /* */ + // determine whether component has slot children + // we need to do this before overwriting $options._renderChildren. - /** - * Runtime helper for merging v-bind="object" into a VNode's data. - */ - function bindObjectProps ( - data, - tag, - value, - asProp, - isSync - ) { - if (value) { - if (!isObject(value)) { - warn( - 'v-bind without argument expects an Object or Array value', - this - ); - } else { - if (Array.isArray(value)) { - value = toObject(value); - } - var hash; - var loop = function ( key ) { - if ( - key === 'class' || - key === 'style' || - isReservedAttribute(key) - ) { - hash = data; - } else { - var type = data.attrs && data.attrs.type; - hash = asProp || config.mustUseProp(tag, type, key) - ? data.domProps || (data.domProps = {}) - : data.attrs || (data.attrs = {}); - } - var camelizedKey = camelize(key); - if (!(key in hash) && !(camelizedKey in hash)) { - hash[key] = value[key]; + // check if there are dynamic scopedSlots (hand-written or compiled but with + // dynamic slot names). Static scoped slots compiled from template has the + // "$stable" marker. + var hasDynamicScopedSlot = !!( + (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || + (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) + ); - if (isSync) { - var on = data.on || (data.on = {}); - on[("update:" + camelizedKey)] = function ($event) { - value[key] = $event; - }; - } - } - }; + // Any static slot children from the parent may have changed during parent's + // update. Dynamic scoped slots may also have changed. In such cases, a forced + // update is necessary to ensure correctness. + var needsForceUpdate = !!( + renderChildren || // has new static slots + vm.$options._renderChildren || // has old static slots + hasDynamicScopedSlot + ); + + vm.$options._parentVnode = parentVnode; + vm.$vnode = parentVnode; // update vm's placeholder node without re-render + + if (vm._vnode) { // update child tree's parent + vm._vnode.parent = parentVnode; + } + vm.$options._renderChildren = renderChildren; + + // update $attrs and $listeners hash + // these are also reactive so they may trigger child update if the child + // used them during render + vm.$attrs = parentVnode.data.attrs || emptyObject; + vm.$listeners = listeners || emptyObject; + + // update props + if (propsData && vm.$options.props) { + toggleObserving(false); + var props = vm._props; + var propKeys = vm.$options._propKeys || []; + for (var i = 0; i < propKeys.length; i++) { + var key = propKeys[i]; + var propOptions = vm.$options.props; // wtf flow? + props[key] = validateProp(key, propOptions, propsData, vm); + } + toggleObserving(true); + // keep a copy of raw propsData + vm.$options.propsData = propsData; + } + + // update listeners + listeners = listeners || emptyObject; + var oldListeners = vm.$options._parentListeners; + vm.$options._parentListeners = listeners; + updateComponentListeners(vm, listeners, oldListeners); - for (var key in value) loop( key ); - } + // resolve slots + force update if has children + if (needsForceUpdate) { + vm.$slots = resolveSlots(renderChildren, parentVnode.context); + vm.$forceUpdate(); } - return data - } - - /* */ - /** - * Runtime helper for rendering static trees. - */ - function renderStatic ( - index, - isInFor - ) { - var cached = this._staticTrees || (this._staticTrees = []); - var tree = cached[index]; - // if has already-rendered static tree and not inside v-for, - // we can reuse the same tree. - if (tree && !isInFor) { - return tree + { + isUpdatingChildComponent = false; } - // otherwise, render a fresh tree. - tree = cached[index] = this.$options.staticRenderFns[index].call( - this._renderProxy, - null, - this // for render fns generated for functional component templates - ); - markStatic(tree, ("__static__" + index), false); - return tree } - /** - * Runtime helper for v-once. - * Effectively it means marking the node as static with a unique key. - */ - function markOnce ( - tree, - index, - key - ) { - markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); - return tree + function isInInactiveTree (vm) { + while (vm && (vm = vm.$parent)) { + if (vm._inactive) { return true } + } + return false } - function markStatic ( - tree, - key, - isOnce - ) { - if (Array.isArray(tree)) { - for (var i = 0; i < tree.length; i++) { - if (tree[i] && typeof tree[i] !== 'string') { - markStaticNode(tree[i], (key + "_" + i), isOnce); - } + function activateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = false; + if (isInInactiveTree(vm)) { + return } - } else { - markStaticNode(tree, key, isOnce); + } else if (vm._directInactive) { + return } - } - - function markStaticNode (node, key, isOnce) { - node.isStatic = true; - node.key = key; - node.isOnce = isOnce; - } - - /* */ - - function bindObjectListeners (data, value) { - if (value) { - if (!isPlainObject(value)) { - warn( - 'v-on without argument expects an Object value', - this - ); - } else { - var on = data.on = data.on ? extend({}, data.on) : {}; - for (var key in value) { - var existing = on[key]; - var ours = value[key]; - on[key] = existing ? [].concat(existing, ours) : ours; - } + if (vm._inactive || vm._inactive === null) { + vm._inactive = false; + for (var i = 0; i < vm.$children.length; i++) { + activateChildComponent(vm.$children[i]); } + callHook(vm, 'activated'); } - return data } - /* */ - - function bindDynamicKeys (baseObj, values) { - for (var i = 0; i < values.length; i += 2) { - var key = values[i]; - if (typeof key === 'string' && key) { - baseObj[values[i]] = values[i + 1]; - } else if (key !== '' && key !== null) { - // null is a speical value for explicitly removing a binding - warn( - ("Invalid value for dynamic directive argument (expected string or null): " + key), - this - ); + function deactivateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = true; + if (isInInactiveTree(vm)) { + return } } - return baseObj + if (!vm._inactive) { + vm._inactive = true; + for (var i = 0; i < vm.$children.length; i++) { + deactivateChildComponent(vm.$children[i]); + } + callHook(vm, 'deactivated'); + } } - // helper to dynamically append modifier runtime markers to event names. - // ensure only append when value is already string, otherwise it will be cast - // to string and cause the type check to miss. - function prependModifier (value, symbol) { - return typeof value === 'string' ? symbol + value : value + function callHook (vm, hook) { + // #7573 disable dep collection when invoking lifecycle hooks + pushTarget(); + var handlers = vm.$options[hook]; + var info = hook + " hook"; + if (handlers) { + for (var i = 0, j = handlers.length; i < j; i++) { + invokeWithErrorHandling(handlers[i], vm, null, vm, info); + } + } + if (vm._hasHookEvent) { + vm.$emit('hook:' + hook); + } + popTarget(); } /* */ - function installRenderHelpers (target) { - target._o = markOnce; - target._n = toNumber; - target._s = toString; - target._l = renderList; - target._t = renderSlot; - target._q = looseEqual; - target._i = looseIndexOf; - target._m = renderStatic; - target._f = resolveFilter; - target._k = checkKeyCodes; - target._b = bindObjectProps; - target._v = createTextVNode; - target._e = createEmptyVNode; - target._u = resolveScopedSlots; - target._g = bindObjectListeners; - target._d = bindDynamicKeys; - target._p = prependModifier; - } + var MAX_UPDATE_COUNT = 100; - /* */ + var queue = []; + var activatedChildren = []; + var has = {}; + var circular = {}; + var waiting = false; + var flushing = false; + var index = 0; - function FunctionalRenderContext ( - data, - props, - children, - parent, - Ctor - ) { - var options = Ctor.options; - // ensure the createElement function in functional components - // gets a unique context - this is necessary for correct named slot check - var contextVm; - if (hasOwn(parent, '_uid')) { - contextVm = Object.create(parent); - // $flow-disable-line - contextVm._original = parent; - } else { - // the context vm passed in is a functional context as well. - // in this case we want to make sure we are able to get a hold to the - // real context instance. - contextVm = parent; - // $flow-disable-line - parent = parent._original; + /** + * Reset the scheduler's state. + */ + function resetSchedulerState () { + index = queue.length = activatedChildren.length = 0; + has = {}; + { + circular = {}; } - var isCompiled = isTrue(options._compiled); - var needNormalization = !isCompiled; - - this.data = data; - this.props = props; - this.children = children; - this.parent = parent; - this.listeners = data.on || emptyObject; - this.injections = resolveInject(options.inject, parent); - this.slots = function () { return resolveSlots(children, parent); }; + waiting = flushing = false; + } - Object.defineProperty(this, 'scopedSlots', ({ - enumerable: true, - get: function get () { - return normalizeScopedSlots(data.scopedSlots, this.slots()) - } - })); + // Async edge case #6566 requires saving the timestamp when event listeners are + // attached. However, calling performance.now() has a perf overhead especially + // if the page has thousands of event listeners. Instead, we take a timestamp + // every time the scheduler flushes and use that for all event listeners + // attached during that flush. + var currentFlushTimestamp = 0; - // support for compiled functional template - if (isCompiled) { - // exposing $options for renderStatic() - this.$options = options; - // pre-resolve slots for renderSlot() - this.$slots = this.slots(); - this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); - } + // Async edge case fix requires storing an event listener's attach timestamp. + var getNow = Date.now; - if (options._scopeId) { - this._c = function (a, b, c, d) { - var vnode = createElement(contextVm, a, b, c, d, needNormalization); - if (vnode && !Array.isArray(vnode)) { - vnode.fnScopeId = options._scopeId; - vnode.fnContext = parent; - } - return vnode - }; - } else { - this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; - } + // Determine what event timestamp the browser is using. Annoyingly, the + // timestamp can either be hi-res (relative to page load) or low-res + // (relative to UNIX epoch), so in order to compare time we have to use the + // same timestamp type when saving the flush timestamp. + if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { + // if the low-res timestamp which is bigger than the event timestamp + // (which is evaluated AFTER) it means the event is using a hi-res timestamp, + // and we need to use the hi-res version for event listeners as well. + getNow = function () { return performance.now(); }; } - installRenderHelpers(FunctionalRenderContext.prototype); + /** + * Flush both queues and run the watchers. + */ + function flushSchedulerQueue () { + currentFlushTimestamp = getNow(); + flushing = true; + var watcher, id; - function createFunctionalComponent ( - Ctor, - propsData, - data, - contextVm, - children - ) { - var options = Ctor.options; - var props = {}; - var propOptions = options.props; - if (isDef(propOptions)) { - for (var key in propOptions) { - props[key] = validateProp(key, propOptions, propsData || emptyObject); + // Sort queue before flush. + // This ensures that: + // 1. Components are updated from parent to child. (because parent is always + // created before the child) + // 2. A component's user watchers are run before its render watcher (because + // user watchers are created before the render watcher) + // 3. If a component is destroyed during a parent component's watcher run, + // its watchers can be skipped. + queue.sort(function (a, b) { return a.id - b.id; }); + + // do not cache length because more watchers might be pushed + // as we run existing watchers + for (index = 0; index < queue.length; index++) { + watcher = queue[index]; + if (watcher.before) { + watcher.before(); + } + id = watcher.id; + has[id] = null; + watcher.run(); + // in dev build, check and stop circular updates. + if (has[id] != null) { + circular[id] = (circular[id] || 0) + 1; + if (circular[id] > MAX_UPDATE_COUNT) { + warn( + 'You may have an infinite update loop ' + ( + watcher.user + ? ("in watcher with expression \"" + (watcher.expression) + "\"") + : "in a component render function." + ), + watcher.vm + ); + break + } } - } else { - if (isDef(data.attrs)) { mergeProps(props, data.attrs); } - if (isDef(data.props)) { mergeProps(props, data.props); } } - var renderContext = new FunctionalRenderContext( - data, - props, - children, - contextVm, - Ctor - ); + // keep copies of post queues before resetting state + var activatedQueue = activatedChildren.slice(); + var updatedQueue = queue.slice(); - var vnode = options.render.call(null, renderContext._c, renderContext); + resetSchedulerState(); - if (vnode instanceof VNode) { - return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) - } else if (Array.isArray(vnode)) { - var vnodes = normalizeChildren(vnode) || []; - var res = new Array(vnodes.length); - for (var i = 0; i < vnodes.length; i++) { - res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); - } - return res + // call component updated and activated hooks + callActivatedHooks(activatedQueue); + callUpdatedHooks(updatedQueue); + + // devtool hook + /* istanbul ignore if */ + if (devtools && config.devtools) { + devtools.emit('flush'); } } - function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { - // #7817 clone node before setting fnContext, otherwise if the node is reused - // (e.g. it was from a cached normal slot) the fnContext causes named slots - // that should not be matched to match. - var clone = cloneVNode(vnode); - clone.fnContext = contextVm; - clone.fnOptions = options; - { - (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; - } - if (data.slot) { - (clone.data || (clone.data = {})).slot = data.slot; + function callUpdatedHooks (queue) { + var i = queue.length; + while (i--) { + var watcher = queue[i]; + var vm = watcher.vm; + if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { + callHook(vm, 'updated'); + } } - return clone } - function mergeProps (to, from) { - for (var key in from) { - to[camelize(key)] = from[key]; - } + /** + * Queue a kept-alive component that was activated during patch. + * The queue will be processed after the entire tree has been patched. + */ + function queueActivatedComponent (vm) { + // setting _inactive to false here so that a render function can + // rely on checking whether it's in an inactive tree (e.g. router-view) + vm._inactive = false; + activatedChildren.push(vm); } - /* */ + function callActivatedHooks (queue) { + for (var i = 0; i < queue.length; i++) { + queue[i]._inactive = true; + activateChildComponent(queue[i], true /* true */); + } + } - /* */ + /** + * Push a watcher into the watcher queue. + * Jobs with duplicate IDs will be skipped unless it's + * pushed when the queue is being flushed. + */ + function queueWatcher (watcher) { + var id = watcher.id; + if (has[id] == null) { + has[id] = true; + if (!flushing) { + queue.push(watcher); + } else { + // if already flushing, splice the watcher based on its id + // if already past its id, it will be run next immediately. + var i = queue.length - 1; + while (i > index && queue[i].id > watcher.id) { + i--; + } + queue.splice(i + 1, 0, watcher); + } + // queue the flush + if (!waiting) { + waiting = true; - /* */ + if (!config.async) { + flushSchedulerQueue(); + return + } + nextTick(flushSchedulerQueue); + } + } + } /* */ - // inline hooks to be invoked on component VNodes during patch - var componentVNodeHooks = { - init: function init (vnode, hydrating) { - if ( - vnode.componentInstance && - !vnode.componentInstance._isDestroyed && - vnode.data.keepAlive - ) { - // kept-alive components, treat as a patch - var mountedNode = vnode; // work around flow - componentVNodeHooks.prepatch(mountedNode, mountedNode); - } else { - var child = vnode.componentInstance = createComponentInstanceForVnode( - vnode, - activeInstance - ); - child.$mount(hydrating ? vnode.elm : undefined, hydrating); - } - }, - prepatch: function prepatch (oldVnode, vnode) { - var options = vnode.componentOptions; - var child = vnode.componentInstance = oldVnode.componentInstance; - updateChildComponent( - child, - options.propsData, // updated props - options.listeners, // updated listeners - vnode, // new parent vnode - options.children // new children - ); - }, - insert: function insert (vnode) { - var context = vnode.context; - var componentInstance = vnode.componentInstance; - if (!componentInstance._isMounted) { - componentInstance._isMounted = true; - callHook(componentInstance, 'mounted'); - } - if (vnode.data.keepAlive) { - if (context._isMounted) { - // vue-router#1212 - // During updates, a kept-alive component's child components may - // change, so directly walking the tree here may call activated hooks - // on incorrect children. Instead we push them into a queue which will - // be processed after the whole patch process ended. - queueActivatedComponent(componentInstance); - } else { - activateChildComponent(componentInstance, true /* direct */); - } - } - }, + var uid$2 = 0; - destroy: function destroy (vnode) { - var componentInstance = vnode.componentInstance; - if (!componentInstance._isDestroyed) { - if (!vnode.data.keepAlive) { - componentInstance.$destroy(); - } else { - deactivateChildComponent(componentInstance, true /* direct */); - } + /** + * A watcher parses an expression, collects dependencies, + * and fires callback when the expression value changes. + * This is used for both the $watch() api and directives. + */ + var Watcher = function Watcher ( + vm, + expOrFn, + cb, + options, + isRenderWatcher + ) { + this.vm = vm; + if (isRenderWatcher) { + vm._watcher = this; + } + vm._watchers.push(this); + // options + if (options) { + this.deep = !!options.deep; + this.user = !!options.user; + this.lazy = !!options.lazy; + this.sync = !!options.sync; + this.before = options.before; + } else { + this.deep = this.user = this.lazy = this.sync = false; + } + this.cb = cb; + this.id = ++uid$2; // uid for batching + this.active = true; + this.dirty = this.lazy; // for lazy watchers + this.deps = []; + this.newDeps = []; + this.depIds = new _Set(); + this.newDepIds = new _Set(); + this.expression = expOrFn.toString(); + // parse expression for getter + if (typeof expOrFn === 'function') { + this.getter = expOrFn; + } else { + this.getter = parsePath(expOrFn); + if (!this.getter) { + this.getter = noop; + warn( + "Failed watching path: \"" + expOrFn + "\" " + + 'Watcher only accepts simple dot-delimited paths. ' + + 'For full control, use a function instead.', + vm + ); } } + this.value = this.lazy + ? undefined + : this.get(); }; - var hooksToMerge = Object.keys(componentVNodeHooks); - - function createComponent ( - Ctor, - data, - context, - children, - tag - ) { - if (isUndef(Ctor)) { - return - } - - var baseCtor = context.$options._base; - - // plain options object: turn it into a constructor - if (isObject(Ctor)) { - Ctor = baseCtor.extend(Ctor); - } - - // if at this stage it's not a constructor or an async component factory, - // reject. - if (typeof Ctor !== 'function') { - { - warn(("Invalid Component definition: " + (String(Ctor))), context); + /** + * Evaluate the getter, and re-collect dependencies. + */ + Watcher.prototype.get = function get () { + pushTarget(this); + var value; + var vm = this.vm; + try { + value = this.getter.call(vm, vm); + } catch (e) { + if (this.user) { + handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); + } else { + throw e } - return + } finally { + // "touch" every property so they are all tracked as + // dependencies for deep watching + if (this.deep) { + traverse(value); + } + popTarget(); + this.cleanupDeps(); } + return value + }; - // async component - var asyncFactory; - if (isUndef(Ctor.cid)) { - asyncFactory = Ctor; - Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context); - if (Ctor === undefined) { - // return a placeholder node for async component, which is rendered - // as a comment node but preserves all the raw information for the node. - // the information will be used for async server-rendering and hydration. - return createAsyncPlaceholder( - asyncFactory, - data, - context, - children, - tag - ) + /** + * Add a dependency to this directive. + */ + Watcher.prototype.addDep = function addDep (dep) { + var id = dep.id; + if (!this.newDepIds.has(id)) { + this.newDepIds.add(id); + this.newDeps.push(dep); + if (!this.depIds.has(id)) { + dep.addSub(this); } } + }; - data = data || {}; - - // resolve constructor options in case global mixins are applied after - // component constructor creation - resolveConstructorOptions(Ctor); - - // transform component v-model data into props & events - if (isDef(data.model)) { - transformModel(Ctor.options, data); + /** + * Clean up for dependency collection. + */ + Watcher.prototype.cleanupDeps = function cleanupDeps () { + var i = this.deps.length; + while (i--) { + var dep = this.deps[i]; + if (!this.newDepIds.has(dep.id)) { + dep.removeSub(this); + } } + var tmp = this.depIds; + this.depIds = this.newDepIds; + this.newDepIds = tmp; + this.newDepIds.clear(); + tmp = this.deps; + this.deps = this.newDeps; + this.newDeps = tmp; + this.newDeps.length = 0; + }; - // extract props - var propsData = extractPropsFromVNodeData(data, Ctor, tag); - - // functional component - if (isTrue(Ctor.options.functional)) { - return createFunctionalComponent(Ctor, propsData, data, context, children) + /** + * Subscriber interface. + * Will be called when a dependency changes. + */ + Watcher.prototype.update = function update () { + /* istanbul ignore else */ + if (this.lazy) { + this.dirty = true; + } else if (this.sync) { + this.run(); + } else { + queueWatcher(this); } + }; - // extract listeners, since these needs to be treated as - // child component listeners instead of DOM listeners - var listeners = data.on; - // replace with listeners with .native modifier - // so it gets processed during parent component patch. - data.on = data.nativeOn; - - if (isTrue(Ctor.options.abstract)) { - // abstract components do not keep anything - // other than props & listeners & slot - - // work around flow - var slot = data.slot; - data = {}; - if (slot) { - data.slot = slot; + /** + * Scheduler job interface. + * Will be called by the scheduler. + */ + Watcher.prototype.run = function run () { + if (this.active) { + var value = this.get(); + if ( + value !== this.value || + // Deep watchers and watchers on Object/Arrays should fire even + // when the value is the same, because the value may + // have mutated. + isObject(value) || + this.deep + ) { + // set new value + var oldValue = this.value; + this.value = value; + if (this.user) { + try { + this.cb.call(this.vm, value, oldValue); + } catch (e) { + handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); + } + } else { + this.cb.call(this.vm, value, oldValue); + } } } + }; - // install component management hooks onto the placeholder node - installComponentHooks(data); - - // return a placeholder vnode - var name = Ctor.options.name || tag; - var vnode = new VNode( - ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), - data, undefined, undefined, undefined, context, - { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, - asyncFactory - ); - - return vnode - } + /** + * Evaluate the value of the watcher. + * This only gets called for lazy watchers. + */ + Watcher.prototype.evaluate = function evaluate () { + this.value = this.get(); + this.dirty = false; + }; - function createComponentInstanceForVnode ( - vnode, // we know it's MountedComponentVNode but flow doesn't - parent // activeInstance in lifecycle state - ) { - var options = { - _isComponent: true, - _parentVnode: vnode, - parent: parent - }; - // check inline-template render functions - var inlineTemplate = vnode.data.inlineTemplate; - if (isDef(inlineTemplate)) { - options.render = inlineTemplate.render; - options.staticRenderFns = inlineTemplate.staticRenderFns; + /** + * Depend on all deps collected by this watcher. + */ + Watcher.prototype.depend = function depend () { + var i = this.deps.length; + while (i--) { + this.deps[i].depend(); } - return new vnode.componentOptions.Ctor(options) - } + }; - function installComponentHooks (data) { - var hooks = data.hook || (data.hook = {}); - for (var i = 0; i < hooksToMerge.length; i++) { - var key = hooksToMerge[i]; - var existing = hooks[key]; - var toMerge = componentVNodeHooks[key]; - if (existing !== toMerge && !(existing && existing._merged)) { - hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; + /** + * Remove self from all dependencies' subscriber list. + */ + Watcher.prototype.teardown = function teardown () { + if (this.active) { + // remove self from vm's watcher list + // this is a somewhat expensive operation so we skip it + // if the vm is being destroyed. + if (!this.vm._isBeingDestroyed) { + remove(this.vm._watchers, this); + } + var i = this.deps.length; + while (i--) { + this.deps[i].removeSub(this); } + this.active = false; } - } + }; + + /* */ - function mergeHook$1 (f1, f2) { - var merged = function (a, b) { - // flow complains about extra args which is why we use any - f1(a, b); - f2(a, b); + var sharedPropertyDefinition = { + enumerable: true, + configurable: true, + get: noop, + set: noop + }; + + function proxy (target, sourceKey, key) { + sharedPropertyDefinition.get = function proxyGetter () { + return this[sourceKey][key] }; - merged._merged = true; - return merged + sharedPropertyDefinition.set = function proxySetter (val) { + this[sourceKey][key] = val; + }; + Object.defineProperty(target, key, sharedPropertyDefinition); } - // transform component v-model info (value and callback) into - // prop and event handler respectively. - function transformModel (options, data) { - var prop = (options.model && options.model.prop) || 'value'; - var event = (options.model && options.model.event) || 'input' - ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; - var on = data.on || (data.on = {}); - var existing = on[event]; - var callback = data.model.callback; - if (isDef(existing)) { - if ( - Array.isArray(existing) - ? existing.indexOf(callback) === -1 - : existing !== callback - ) { - on[event] = [callback].concat(existing); - } + function initState (vm) { + vm._watchers = []; + var opts = vm.$options; + if (opts.props) { initProps(vm, opts.props); } + if (opts.methods) { initMethods(vm, opts.methods); } + if (opts.data) { + initData(vm); } else { - on[event] = callback; + observe(vm._data = {}, true /* asRootData */); + } + if (opts.computed) { initComputed(vm, opts.computed); } + if (opts.watch && opts.watch !== nativeWatch) { + initWatch(vm, opts.watch); } } - /* */ - - var SIMPLE_NORMALIZE = 1; - var ALWAYS_NORMALIZE = 2; - - // wrapper function for providing a more flexible interface - // without getting yelled at by flow - function createElement ( - context, - tag, - data, - children, - normalizationType, - alwaysNormalize - ) { - if (Array.isArray(data) || isPrimitive(data)) { - normalizationType = children; - children = data; - data = undefined; - } - if (isTrue(alwaysNormalize)) { - normalizationType = ALWAYS_NORMALIZE; + function initProps (vm, propsOptions) { + var propsData = vm.$options.propsData || {}; + var props = vm._props = {}; + // cache prop keys so that future props updates can iterate using Array + // instead of dynamic object key enumeration. + var keys = vm.$options._propKeys = []; + var isRoot = !vm.$parent; + // root instance props should be converted + if (!isRoot) { + toggleObserving(false); } - return _createElement(context, tag, data, children, normalizationType) + var loop = function ( key ) { + keys.push(key); + var value = validateProp(key, propsOptions, propsData, vm); + /* istanbul ignore else */ + { + var hyphenatedKey = hyphenate(key); + if (isReservedAttribute(hyphenatedKey) || + config.isReservedAttr(hyphenatedKey)) { + warn( + ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), + vm + ); + } + defineReactive$$1(props, key, value, function () { + if (!isRoot && !isUpdatingChildComponent) { + warn( + "Avoid mutating a prop directly since the value will be " + + "overwritten whenever the parent component re-renders. " + + "Instead, use a data or computed property based on the prop's " + + "value. Prop being mutated: \"" + key + "\"", + vm + ); + } + }); + } + // static props are already proxied on the component's prototype + // during Vue.extend(). We only need to proxy props defined at + // instantiation here. + if (!(key in vm)) { + proxy(vm, "_props", key); + } + }; + + for (var key in propsOptions) loop( key ); + toggleObserving(true); } - function _createElement ( - context, - tag, - data, - children, - normalizationType - ) { - if (isDef(data) && isDef((data).__ob__)) { + function initData (vm) { + var data = vm.$options.data; + data = vm._data = typeof data === 'function' + ? getData(data, vm) + : data || {}; + if (!isPlainObject(data)) { + data = {}; warn( - "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + - 'Always create fresh vnode data objects in each render!', - context + 'data functions should return an object:\n' + + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', + vm ); - return createEmptyVNode() - } - // object syntax in v-bind - if (isDef(data) && isDef(data.is)) { - tag = data.is; - } - if (!tag) { - // in case of component :is set to falsy value - return createEmptyVNode() } - // warn against non-primitive key - if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) - ) { + // proxy data on instance + var keys = Object.keys(data); + var props = vm.$options.props; + var methods = vm.$options.methods; + var i = keys.length; + while (i--) { + var key = keys[i]; { + if (methods && hasOwn(methods, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a data property."), + vm + ); + } + } + if (props && hasOwn(props, key)) { warn( - 'Avoid using non-primitive value as key, ' + - 'use string/number value instead.', - context + "The data property \"" + key + "\" is already declared as a prop. " + + "Use prop default value instead.", + vm ); + } else if (!isReserved(key)) { + proxy(vm, "_data", key); } } - // support single function children as default scoped slot - if (Array.isArray(children) && - typeof children[0] === 'function' - ) { - data = data || {}; - data.scopedSlots = { default: children[0] }; - children.length = 0; - } - if (normalizationType === ALWAYS_NORMALIZE) { - children = normalizeChildren(children); - } else if (normalizationType === SIMPLE_NORMALIZE) { - children = simpleNormalizeChildren(children); + // observe data + observe(data, true /* asRootData */); + } + + function getData (data, vm) { + // #7573 disable dep collection when invoking data getters + pushTarget(); + try { + return data.call(vm, vm) + } catch (e) { + handleError(e, vm, "data()"); + return {} + } finally { + popTarget(); } - var vnode, ns; - if (typeof tag === 'string') { - var Ctor; - ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); - if (config.isReservedTag(tag)) { - // platform built-in elements - vnode = new VNode( - config.parsePlatformTagName(tag), data, children, - undefined, undefined, context + } + + var computedWatcherOptions = { lazy: true }; + + function initComputed (vm, computed) { + // $flow-disable-line + var watchers = vm._computedWatchers = Object.create(null); + // computed properties are just getters during SSR + var isSSR = isServerRendering(); + + for (var key in computed) { + var userDef = computed[key]; + var getter = typeof userDef === 'function' ? userDef : userDef.get; + if (getter == null) { + warn( + ("Getter is missing for computed property \"" + key + "\"."), + vm ); - } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { - // component - vnode = createComponent(Ctor, data, context, children, tag); - } else { - // unknown or unlisted namespaced elements - // check at runtime because it may get assigned a namespace when its - // parent normalizes children - vnode = new VNode( - tag, data, children, - undefined, undefined, context + } + + if (!isSSR) { + // create internal watcher for the computed property. + watchers[key] = new Watcher( + vm, + getter || noop, + noop, + computedWatcherOptions ); } - } else { - // direct component options / constructor - vnode = createComponent(tag, data, context, children); + + // component-defined computed properties are already defined on the + // component prototype. We only need to define computed properties defined + // at instantiation here. + if (!(key in vm)) { + defineComputed(vm, key, userDef); + } else { + if (key in vm.$data) { + warn(("The computed property \"" + key + "\" is already defined in data."), vm); + } else if (vm.$options.props && key in vm.$options.props) { + warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); + } + } } - if (Array.isArray(vnode)) { - return vnode - } else if (isDef(vnode)) { - if (isDef(ns)) { applyNS(vnode, ns); } - if (isDef(data)) { registerDeepBindings(data); } - return vnode + } + + function defineComputed ( + target, + key, + userDef + ) { + var shouldCache = !isServerRendering(); + if (typeof userDef === 'function') { + sharedPropertyDefinition.get = shouldCache + ? createComputedGetter(key) + : createGetterInvoker(userDef); + sharedPropertyDefinition.set = noop; } else { - return createEmptyVNode() + sharedPropertyDefinition.get = userDef.get + ? shouldCache && userDef.cache !== false + ? createComputedGetter(key) + : createGetterInvoker(userDef.get) + : noop; + sharedPropertyDefinition.set = userDef.set || noop; } + if (sharedPropertyDefinition.set === noop) { + sharedPropertyDefinition.set = function () { + warn( + ("Computed property \"" + key + "\" was assigned to but it has no setter."), + this + ); + }; + } + Object.defineProperty(target, key, sharedPropertyDefinition); } - function applyNS (vnode, ns, force) { - vnode.ns = ns; - if (vnode.tag === 'foreignObject') { - // use default namespace inside foreignObject - ns = undefined; - force = true; - } - if (isDef(vnode.children)) { - for (var i = 0, l = vnode.children.length; i < l; i++) { - var child = vnode.children[i]; - if (isDef(child.tag) && ( - isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { - applyNS(child, ns, force); + function createComputedGetter (key) { + return function computedGetter () { + var watcher = this._computedWatchers && this._computedWatchers[key]; + if (watcher) { + if (watcher.dirty) { + watcher.evaluate(); } + if (Dep.target) { + watcher.depend(); + } + return watcher.value } } } - // ref #5318 - // necessary to ensure parent re-render when deep bindings like :style and - // :class are used on slot nodes - function registerDeepBindings (data) { - if (isObject(data.style)) { - traverse(data.style); - } - if (isObject(data.class)) { - traverse(data.class); + function createGetterInvoker(fn) { + return function computedGetter () { + return fn.call(this, this) } } - /* */ - - function initRender (vm) { - vm._vnode = null; // the root of the child tree - vm._staticTrees = null; // v-once cached trees - var options = vm.$options; - var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree - var renderContext = parentVnode && parentVnode.context; - vm.$slots = resolveSlots(options._renderChildren, renderContext); - vm.$scopedSlots = emptyObject; - // bind the createElement fn to this instance - // so that we get proper render context inside it. - // args order: tag, data, children, normalizationType, alwaysNormalize - // internal version is used by render functions compiled from templates - vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; - // normalization is always applied for the public version, used in - // user-written render functions. - vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; + function initMethods (vm, methods) { + var props = vm.$options.props; + for (var key in methods) { + { + if (typeof methods[key] !== 'function') { + warn( + "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + + "Did you reference the function correctly?", + vm + ); + } + if (props && hasOwn(props, key)) { + warn( + ("Method \"" + key + "\" has already been defined as a prop."), + vm + ); + } + if ((key in vm) && isReserved(key)) { + warn( + "Method \"" + key + "\" conflicts with an existing Vue instance method. " + + "Avoid defining component methods that start with _ or $." + ); + } + } + vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); + } + } - // $attrs & $listeners are exposed for easier HOC creation. - // they need to be reactive so that HOCs using them are always updated - var parentData = parentVnode && parentVnode.data; + function initWatch (vm, watch) { + for (var key in watch) { + var handler = watch[key]; + if (Array.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + createWatcher(vm, key, handler[i]); + } + } else { + createWatcher(vm, key, handler); + } + } + } - /* istanbul ignore else */ - { - defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { - !isUpdatingChildComponent && warn("$attrs is readonly.", vm); - }, true); - defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { - !isUpdatingChildComponent && warn("$listeners is readonly.", vm); - }, true); + function createWatcher ( + vm, + expOrFn, + handler, + options + ) { + if (isPlainObject(handler)) { + options = handler; + handler = handler.handler; + } + if (typeof handler === 'string') { + handler = vm[handler]; } + return vm.$watch(expOrFn, handler, options) } - function renderMixin (Vue) { - // install runtime convenience helpers - installRenderHelpers(Vue.prototype); + function stateMixin (Vue) { + // flow somehow has problems with directly declared definition object + // when using Object.defineProperty, so we have to procedurally build up + // the object here. + var dataDef = {}; + dataDef.get = function () { return this._data }; + var propsDef = {}; + propsDef.get = function () { return this._props }; + { + dataDef.set = function () { + warn( + 'Avoid replacing instance root $data. ' + + 'Use nested data properties instead.', + this + ); + }; + propsDef.set = function () { + warn("$props is readonly.", this); + }; + } + Object.defineProperty(Vue.prototype, '$data', dataDef); + Object.defineProperty(Vue.prototype, '$props', propsDef); - Vue.prototype.$nextTick = function (fn) { - return nextTick(fn, this) - }; + Vue.prototype.$set = set; + Vue.prototype.$delete = del; - Vue.prototype._render = function () { + Vue.prototype.$watch = function ( + expOrFn, + cb, + options + ) { var vm = this; - var ref = vm.$options; - var render = ref.render; - var _parentVnode = ref._parentVnode; - - if (_parentVnode) { - vm.$scopedSlots = normalizeScopedSlots( - _parentVnode.data.scopedSlots, - vm.$slots - ); + if (isPlainObject(cb)) { + return createWatcher(vm, expOrFn, cb, options) } - - // set parent vnode. this allows render functions to have access - // to the data on the placeholder node. - vm.$vnode = _parentVnode; - // render self - var vnode; - try { - vnode = render.call(vm._renderProxy, vm.$createElement); - } catch (e) { - handleError(e, vm, "render"); - // return error render result, - // or previous vnode to prevent render error causing blank component - /* istanbul ignore else */ - if (vm.$options.renderError) { - try { - vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); - } catch (e) { - handleError(e, vm, "renderError"); - vnode = vm._vnode; - } - } else { - vnode = vm._vnode; + options = options || {}; + options.user = true; + var watcher = new Watcher(vm, expOrFn, cb, options); + if (options.immediate) { + try { + cb.call(vm, watcher.value); + } catch (error) { + handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\"")); } } - // if the returned array contains only a single node, allow it - if (Array.isArray(vnode) && vnode.length === 1) { - vnode = vnode[0]; - } - // return empty vnode in case the render function errored out - if (!(vnode instanceof VNode)) { - if (Array.isArray(vnode)) { - warn( - 'Multiple root nodes returned from render function. Render function ' + - 'should return a single root node.', - vm - ); - } - vnode = createEmptyVNode(); + return function unwatchFn () { + watcher.teardown(); } - // set parent - vnode.parent = _parentVnode; - return vnode }; } @@ -5323,7 +5326,7 @@ value: FunctionalRenderContext }); - Vue.version = '2.6.2'; + Vue.version = '2.6.3'; /* */ @@ -6748,6 +6751,11 @@ } } + // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp + // implementation and does not fire microtasks in between event propagation, so + // safe to exclude. + var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); + function add$1 ( name, handler, @@ -6760,11 +6768,16 @@ // the solution is simple: we save the timestamp when a handler is attached, // and the handler would only fire if the event passed to it was fired // AFTER it was attached. - if (isUsingMicroTask) { + if (useMicrotaskFix) { var attachedTimestamp = currentFlushTimestamp; var original = handler; handler = original._wrapper = function (e) { - if (e.timeStamp >= attachedTimestamp) { + if ( + e.timeStamp >= attachedTimestamp || + // #9448 bail if event is fired in another document in a multi-page + // electron/nw.js app + e.target.ownerDocument !== document + ) { return original.apply(this, arguments) } }; diff --git a/dist/vue.runtime.min.js b/dist/vue.runtime.min.js index 9f3ae156f1c..01dc65ae4fc 100644 --- a/dist/vue.runtime.min.js +++ b/dist/vue.runtime.min.js @@ -1,6 +1,6 @@ /*! - * Vue.js v2.6.2 + * Vue.js v2.6.3 * (c) 2014-2019 Evan You * Released under the MIT License. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Vue=e()}(this,function(){"use strict";var t=Object.freeze({});function e(t){return null==t}function n(t){return null!=t}function r(t){return!0===t}function o(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function i(t){return null!==t&&"object"==typeof t}var a=Object.prototype.toString;function s(t){return"[object Object]"===a.call(t)}function c(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function u(t){return n(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function l(t){return null==t?"":Array.isArray(t)||s(t)&&t.toString===a?JSON.stringify(t,null,2):String(t)}function f(t){var e=parseFloat(t);return isNaN(e)?t:e}function p(t,e){for(var n=Object.create(null),r=t.split(","),o=0;o-1)return t.splice(n,1)}}var h=Object.prototype.hasOwnProperty;function m(t,e){return h.call(t,e)}function y(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var g=/-(\w)/g,_=y(function(t){return t.replace(g,function(t,e){return e?e.toUpperCase():""})}),b=y(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),C=/\B([A-Z])/g,A=y(function(t){return t.replace(C,"-$1").toLowerCase()});var w=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function $(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function x(t,e){for(var n in e)t[n]=e[n];return t}function O(t){for(var e={},n=0;n0,K=z&&z.indexOf("edge/")>0,X=(z&&z.indexOf("android"),z&&/iphone|ipad|ipod|ios/.test(z)||"ios"===B),G=(z&&/chrome\/\d+/.test(z),z&&/phantomjs/.test(z),{}.watch),Z=!1;if(H)try{var J={};Object.defineProperty(J,"passive",{get:function(){Z=!0}}),window.addEventListener("test-passive",null,J)}catch(t){}var Q=function(){return void 0===R&&(R=!H&&!V&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),R},Y=H&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function tt(t){return"function"==typeof t&&/native code/.test(t.toString())}var et,nt="undefined"!=typeof Symbol&&tt(Symbol)&&"undefined"!=typeof Reflect&&tt(Reflect.ownKeys);et="undefined"!=typeof Set&&tt(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var rt=k,ot=0,it=function(){this.id=ot++,this.subs=[]};it.prototype.addSub=function(t){this.subs.push(t)},it.prototype.removeSub=function(t){v(this.subs,t)},it.prototype.depend=function(){it.target&&it.target.addDep(this)},it.prototype.notify=function(){for(var t=this.subs.slice(),e=0,n=t.length;e-1)if(i&&!m(o,"default"))a=!1;else if(""===a||a===A(t)){var c=Lt(String,o.type);(c<0||s0&&(ie((u=t(u,(a||"")+"_"+c))[0])&&ie(f)&&(s[l]=pt(f.text+u[0].text),u.shift()),s.push.apply(s,u)):o(u)?ie(f)?s[l]=pt(f.text+u):""!==u&&s.push(pt(u)):ie(u)&&ie(f)?s[l]=pt(f.text+u.text):(r(i._isVList)&&n(u.tag)&&e(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(t):void 0}function ie(t){return n(t)&&n(t.text)&&!1===t.isComment}function ae(t,e){return(t.__esModule||nt&&"Module"===t[Symbol.toStringTag])&&(t=t.default),i(t)?e.extend(t):t}function se(t){return t.isComment&&t.asyncFactory}function ce(t){if(Array.isArray(t))for(var e=0;edocument.createEvent("Event").timeStamp&&(Se=function(){return performance.now()});var Ee=0,Ie=function(t,e,n,r,o){this.vm=t,o&&(t._watcher=this),t._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++Ee,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new et,this.newDepIds=new et,this.expression="","function"==typeof e?this.getter=e:(this.getter=function(t){if(!F.test(t)){var e=t.split(".");return function(t){for(var n=0;nOe&&Ce[n].id>t.id;)n--;Ce.splice(n+1,0,t)}else Ce.push(t);$e||($e=!0,Gt(je))}}(this)},Ie.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||i(t)||this.deep){var e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){Nt(t,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,t,e)}}},Ie.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Ie.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},Ie.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||v(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var Te={enumerable:!0,configurable:!0,get:k,set:k};function De(t,e,n){Te.get=function(){return this[e][n]},Te.set=function(t){this[e][n]=t},Object.defineProperty(t,n,Te)}function Pe(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},r=t._props={},o=t.$options._propKeys=[];t.$parent&>(!1);var i=function(i){o.push(i);var a=Tt(i,e,n,t);Ct(r,i,a),i in t||De(t,"_props",i)};for(var a in e)i(a);gt(!0)}(t,e.props),e.methods&&function(t,e){t.$options.props;for(var n in e)t[n]="function"!=typeof e[n]?k:w(e[n],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;s(e=t._data="function"==typeof e?function(t,e){st();try{return t.call(e,e)}catch(t){return Nt(t,e,"data()"),{}}finally{ct()}}(e,t):e||{})||(e={});var n=Object.keys(e),r=t.$options.props,o=(t.$options.methods,n.length);for(;o--;){var i=n[o];r&&m(r,i)||(a=void 0,36!==(a=(i+"").charCodeAt(0))&&95!==a&&De(t,"_data",i))}var a;bt(e,!0)}(t):bt(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),r=Q();for(var o in e){var i=e[o],a="function"==typeof i?i:i.get;r||(n[o]=new Ie(t,a||k,k,Le)),o in t||Ne(t,o,i)}}(t,e.computed),e.watch&&e.watch!==G&&function(t,e){for(var n in e){var r=e[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof t?t.split(",").indexOf(e)>-1:(n=t,"[object RegExp]"===a.call(n)&&t.test(e));var n}function Cn(t,e){var n=t.cache,r=t.keys,o=t._vnode;for(var i in n){var a=n[i];if(a){var s=_n(a.componentOptions);s&&!e(s)&&An(n,i,r,o)}}}function An(t,e,n,r){var o=t[e];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),t[e]=null,v(n,e)}!function(e){e.prototype._init=function(e){var n=this;n._uid=hn++,n._isVue=!0,e&&e._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),r=e._parentVnode;n.parent=e.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(n,e):n.$options=Et(mn(n.constructor),e||{},n),n._renderProxy=n,n._self=n,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(n),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&pe(t,e)}(n),function(e){e._vnode=null,e._staticTrees=null;var n=e.$options,r=e.$vnode=n._parentVnode,o=r&&r.context;e.$slots=de(n._renderChildren,o),e.$scopedSlots=t,e._c=function(t,n,r,o){return vn(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return vn(e,t,n,r,o,!0)};var i=r&&r.data;Ct(e,"$attrs",i&&i.attrs||t,null,!0),Ct(e,"$listeners",n._parentListeners||t,null,!0)}(n),be(n,"beforeCreate"),function(t){var e=Ue(t.$options.inject,t);e&&(gt(!1),Object.keys(e).forEach(function(n){Ct(t,n,e[n])}),gt(!0))}(n),Pe(n),function(t){var e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(n),be(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(yn),function(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=At,t.prototype.$delete=wt,t.prototype.$watch=function(t,e,n){if(s(e))return Re(this,t,e,n);(n=n||{}).user=!0;var r=new Ie(this,t,e,n);if(n.immediate)try{e.call(this,r.value)}catch(t){Nt(t,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(yn),function(t){var e=/^hook:/;t.prototype.$on=function(t,n){var r=this;if(Array.isArray(t))for(var o=0,i=t.length;o1?$(e):e;for(var n=$(arguments,1),r='event handler for "'+t+'"',o=0,i=e.length;oparseInt(this.max)&&An(a,s[0],s,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return N}};Object.defineProperty(t,"config",e),t.util={warn:rt,extend:x,mergeOptions:Et,defineReactive:Ct},t.set=At,t.delete=wt,t.nextTick=Gt,t.observable=function(t){return bt(t),t},t.options=Object.create(null),P.forEach(function(e){t.options[e+"s"]=Object.create(null)}),t.options._base=t,x(t.options.components,$n),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=$(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=Et(this.options,t),this}}(t),gn(t),function(t){P.forEach(function(e){t[e]=function(t,n){return n?("component"===e&&s(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}(t)}(yn),Object.defineProperty(yn.prototype,"$isServer",{get:Q}),Object.defineProperty(yn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(yn,"FunctionalRenderContext",{value:on}),yn.version="2.6.2";var xn=p("style,class"),On=p("input,textarea,option,select,progress"),kn=p("contenteditable,draggable,spellcheck"),Sn=p("events,caret,typing,plaintext-only"),jn=function(t,e){return Pn(e)||"false"===e?"false":"contenteditable"===t&&Sn(e)?e:"true"},En=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),In="http://www.w3.org/1999/xlink",Tn=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},Dn=function(t){return Tn(t)?t.slice(6,t.length):""},Pn=function(t){return null==t||!1===t};function Ln(t){for(var e=t.data,r=t,o=t;n(o.componentInstance);)(o=o.componentInstance._vnode)&&o.data&&(e=Nn(o.data,e));for(;n(r=r.parent);)r&&r.data&&(e=Nn(e,r.data));return function(t,e){if(n(t)||n(e))return Mn(t,Fn(e));return""}(e.staticClass,e.class)}function Nn(t,e){return{staticClass:Mn(t.staticClass,e.staticClass),class:n(t.class)?[t.class,e.class]:e.class}}function Mn(t,e){return t?e?t+" "+e:t:e||""}function Fn(t){return Array.isArray(t)?function(t){for(var e,r="",o=0,i=t.length;o-1?sr(t,e,n):En(e)?Pn(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):kn(e)?t.setAttribute(e,jn(e,n)):Tn(e)?Pn(n)?t.removeAttributeNS(In,Dn(e)):t.setAttributeNS(In,e,n):sr(t,e,n)}function sr(t,e,n){if(Pn(n))t.removeAttribute(e);else{if(W&&!q&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var r=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",r)};t.addEventListener("input",r),t.__ieph=!0}t.setAttribute(e,n)}}var cr={create:ir,update:ir};function ur(t,r){var o=r.elm,i=r.data,a=t.data;if(!(e(i.staticClass)&&e(i.class)&&(e(a)||e(a.staticClass)&&e(a.class)))){var s=Ln(r),c=o._transitionClasses;n(c)&&(s=Mn(s,Fn(c))),s!==o._prevClass&&(o.setAttribute("class",s),o._prevClass=s)}}var lr,fr={create:ur,update:ur},pr="__r",dr="__c";function vr(t,e,n){var r=lr;return function o(){null!==e.apply(null,arguments)&&mr(t,o,n,r)}}function hr(t,e,n,r){if(Ht){var o=ke,i=e;e=i._wrapper=function(t){if(t.timeStamp>=o)return i.apply(this,arguments)}}lr.addEventListener(t,e,Z?{capture:n,passive:r}:n)}function mr(t,e,n,r){(r||lr).removeEventListener(t,e._wrapper||e,n)}function yr(t,r){if(!e(t.data.on)||!e(r.data.on)){var o=r.data.on||{},i=t.data.on||{};lr=r.elm,function(t){if(n(t[pr])){var e=W?"change":"input";t[e]=[].concat(t[pr],t[e]||[]),delete t[pr]}n(t[dr])&&(t.change=[].concat(t[dr],t.change||[]),delete t[dr])}(o),ee(o,i,hr,mr,vr,r.context),lr=void 0}}var gr,_r={create:yr,update:yr};function br(t,r){if(!e(t.data.domProps)||!e(r.data.domProps)){var o,i,a=r.elm,s=t.data.domProps||{},c=r.data.domProps||{};for(o in n(c.__ob__)&&(c=r.data.domProps=x({},c)),s)e(c[o])&&(a[o]="");for(o in c){if(i=c[o],"textContent"===o||"innerHTML"===o){if(r.children&&(r.children.length=0),i===s[o])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===o||i!==s[o])if("value"===o){a._value=i;var u=e(i)?"":String(i);Cr(a,u)&&(a.value=u)}else if("innerHTML"===o&&Hn(a.tagName)&&e(a.innerHTML)){(gr=gr||document.createElement("div")).innerHTML=""+i+"";for(var l=gr.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else a[o]=i}}}function Cr(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var r=t.value,o=t._vModifiers;if(n(o)){if(o.number)return f(r)!==f(e);if(o.trim)return r.trim()!==e.trim()}return r!==e}(t,e))}var Ar={create:br,update:br},wr=y(function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach(function(t){if(t){var r=t.split(n);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e});function $r(t){var e=xr(t.style);return t.staticStyle?x(t.staticStyle,e):e}function xr(t){return Array.isArray(t)?O(t):"string"==typeof t?wr(t):t}var Or,kr=/^--/,Sr=/\s*!important$/,jr=function(t,e,n){if(kr.test(e))t.style.setProperty(e,n);else if(Sr.test(n))t.style.setProperty(A(e),n.replace(Sr,""),"important");else{var r=Ir(e);if(Array.isArray(n))for(var o=0,i=n.length;o-1?e.split(Pr).forEach(function(e){return t.classList.add(e)}):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function Nr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Pr).forEach(function(e){return t.classList.remove(e)}):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",r=" "+e+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function Mr(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&x(e,Fr(t.name||"v")),x(e,t),e}return"string"==typeof t?Fr(t):void 0}}var Fr=y(function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}}),Rr=H&&!q,Ur="transition",Hr="animation",Vr="transition",Br="transitionend",zr="animation",Wr="animationend";Rr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Vr="WebkitTransition",Br="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(zr="WebkitAnimation",Wr="webkitAnimationEnd"));var qr=H?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Kr(t){qr(function(){qr(t)})}function Xr(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),Lr(t,e))}function Gr(t,e){t._transitionClasses&&v(t._transitionClasses,e),Nr(t,e)}function Zr(t,e,n){var r=Qr(t,e),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s=o===Ur?Br:Wr,c=0,u=function(){t.removeEventListener(s,l),n()},l=function(e){e.target===t&&++c>=a&&u()};setTimeout(function(){c0&&(n=Ur,l=a,f=i.length):e===Hr?u>0&&(n=Hr,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?Ur:Hr:null)?n===Ur?i.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===Ur&&Jr.test(r[Vr+"Property"])}}function Yr(t,e){for(;t.length1}function io(t,e){!0!==e.data.show&&eo(e)}var ao=function(t){var i,a,s={},c=t.modules,u=t.nodeOps;for(i=0;iv?_(t,e(o[y+1])?null:o[y+1].elm,o,d,y,i):d>y&&C(0,r,p,v)}(p,h,y,i,l):n(y)?(n(t.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,i)):n(h)?C(0,h,0,h.length-1):n(t.text)&&u.setTextContent(p,""):t.text!==o.text&&u.setTextContent(p,o.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(t,o)}}}function x(t,e,o){if(r(o)&&n(t.parent))t.parent.data.pendingInsert=e;else for(var i=0;i-1,a.selected!==i&&(a.selected=i);else if(E(fo(a),r))return void(t.selectedIndex!==s&&(t.selectedIndex=s));o||(t.selectedIndex=-1)}}function lo(t,e){return e.every(function(e){return!E(e,t)})}function fo(t){return"_value"in t?t._value:t.value}function po(t){t.target.composing=!0}function vo(t){t.target.composing&&(t.target.composing=!1,ho(t.target,"input"))}function ho(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function mo(t){return!t.componentInstance||t.data&&t.data.transition?t:mo(t.componentInstance._vnode)}var yo={model:so,show:{bind:function(t,e,n){var r=e.value,o=(n=mo(n)).data&&n.data.transition,i=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;r&&o?(n.data.show=!0,eo(n,function(){t.style.display=i})):t.style.display=r?i:"none"},update:function(t,e,n){var r=e.value;!r!=!e.oldValue&&((n=mo(n)).data&&n.data.transition?(n.data.show=!0,r?eo(n,function(){t.style.display=t.__vOriginalDisplay}):no(n,function(){t.style.display="none"})):t.style.display=r?t.__vOriginalDisplay:"none")},unbind:function(t,e,n,r,o){o||(t.style.display=t.__vOriginalDisplay)}}},go={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function _o(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?_o(ce(e.children)):t}function bo(t){var e={},n=t.$options;for(var r in n.propsData)e[r]=t[r];var o=n._parentListeners;for(var i in o)e[_(i)]=o[i];return e}function Co(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}var Ao=function(t){return t.tag||se(t)},wo=function(t){return"show"===t.name},$o={name:"transition",props:go,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(Ao)).length){var r=this.mode,i=n[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return i;var a=_o(i);if(!a)return i;if(this._leaving)return Co(t,i);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:o(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=bo(this),u=this._vnode,l=_o(u);if(a.data.directives&&a.data.directives.some(wo)&&(a.data.show=!0),l&&l.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(a,l)&&!se(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=x({},c);if("out-in"===r)return this._leaving=!0,ne(f,"afterLeave",function(){e._leaving=!1,e.$forceUpdate()}),Co(t,i);if("in-out"===r){if(se(a))return u;var p,d=function(){p()};ne(c,"afterEnter",d),ne(c,"enterCancelled",d),ne(f,"delayLeave",function(t){p=t})}}return i}}},xo=x({tag:String,moveClass:String},go);function Oo(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function ko(t){t.data.newPos=t.elm.getBoundingClientRect()}function So(t){var e=t.data.pos,n=t.data.newPos,r=e.left-n.left,o=e.top-n.top;if(r||o){t.data.moved=!0;var i=t.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+o+"px)",i.transitionDuration="0s"}}delete xo.mode;var jo={Transition:$o,TransitionGroup:{props:xo,beforeMount:function(){var t=this,e=this._update;this._update=function(n,r){var o=ye(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,o(),e.call(t,n,r)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=bo(this),s=0;s-1?Bn[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Bn[t]=/HTMLUnknownElement/.test(e.toString())},x(yn.options.directives,yo),x(yn.options.components,jo),yn.prototype.__patch__=H?ao:k,yn.prototype.$mount=function(t,e){return function(t,e,n){var r;return t.$el=e,t.$options.render||(t.$options.render=ft),be(t,"beforeMount"),r=function(){t._update(t._render(),n)},new Ie(t,r,k,{before:function(){t._isMounted&&!t._isDestroyed&&be(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,be(t,"mounted")),t}(this,t=t&&H?function(t){if("string"==typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}(t):void 0,e)},H&&setTimeout(function(){N.devtools&&Y&&Y.emit("init",yn)},0),yn}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Vue=e()}(this,function(){"use strict";var t=Object.freeze({});function e(t){return null==t}function n(t){return null!=t}function r(t){return!0===t}function o(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function i(t){return null!==t&&"object"==typeof t}var a=Object.prototype.toString;function s(t){return"[object Object]"===a.call(t)}function c(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function u(t){return n(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function l(t){return null==t?"":Array.isArray(t)||s(t)&&t.toString===a?JSON.stringify(t,null,2):String(t)}function f(t){var e=parseFloat(t);return isNaN(e)?t:e}function p(t,e){for(var n=Object.create(null),r=t.split(","),o=0;o-1)return t.splice(n,1)}}var h=Object.prototype.hasOwnProperty;function m(t,e){return h.call(t,e)}function y(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var g=/-(\w)/g,_=y(function(t){return t.replace(g,function(t,e){return e?e.toUpperCase():""})}),b=y(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),C=/\B([A-Z])/g,w=y(function(t){return t.replace(C,"-$1").toLowerCase()});var A=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function $(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function x(t,e){for(var n in e)t[n]=e[n];return t}function O(t){for(var e={},n=0;n0,K=z&&z.indexOf("edge/")>0,X=(z&&z.indexOf("android"),z&&/iphone|ipad|ipod|ios/.test(z)||"ios"===B),G=(z&&/chrome\/\d+/.test(z),z&&/phantomjs/.test(z),z&&z.match(/firefox\/(\d+)/)),Z={}.watch,J=!1;if(H)try{var Q={};Object.defineProperty(Q,"passive",{get:function(){J=!0}}),window.addEventListener("test-passive",null,Q)}catch(t){}var Y=function(){return void 0===R&&(R=!H&&!V&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),R},tt=H&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function et(t){return"function"==typeof t&&/native code/.test(t.toString())}var nt,rt="undefined"!=typeof Symbol&&et(Symbol)&&"undefined"!=typeof Reflect&&et(Reflect.ownKeys);nt="undefined"!=typeof Set&&et(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var ot=k,it=0,at=function(){this.id=it++,this.subs=[]};at.prototype.addSub=function(t){this.subs.push(t)},at.prototype.removeSub=function(t){v(this.subs,t)},at.prototype.depend=function(){at.target&&at.target.addDep(this)},at.prototype.notify=function(){for(var t=this.subs.slice(),e=0,n=t.length;e-1)if(i&&!m(o,"default"))a=!1;else if(""===a||a===w(t)){var c=Pt(String,o.type);(c<0||s0&&(ie((u=t(u,(a||"")+"_"+c))[0])&&ie(f)&&(s[l]=dt(f.text+u[0].text),u.shift()),s.push.apply(s,u)):o(u)?ie(f)?s[l]=dt(f.text+u):""!==u&&s.push(dt(u)):ie(u)&&ie(f)?s[l]=dt(f.text+u.text):(r(i._isVList)&&n(u.tag)&&e(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(t):void 0}function ie(t){return n(t)&&n(t.text)&&!1===t.isComment}function ae(t,e){if(t){for(var n=Object.create(null),r=rt?Reflect.ownKeys(t):Object.keys(t),o=0;odocument.createEvent("Event").timeStamp&&(on=function(){return performance.now()});var sn=0,cn=function(t,e,n,r,o){this.vm=t,o&&(t._watcher=this),t._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++sn,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new nt,this.newDepIds=new nt,this.expression="","function"==typeof e?this.getter=e:(this.getter=function(t){if(!F.test(t)){var e=t.split(".");return function(t){for(var n=0;nnn&&Je[n].id>t.id;)n--;Je.splice(n+1,0,t)}else Je.push(t);tn||(tn=!0,Zt(an))}}(this)},cn.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||i(t)||this.deep){var e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){Mt(t,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,t,e)}}},cn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},cn.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},cn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||v(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var un={enumerable:!0,configurable:!0,get:k,set:k};function ln(t,e,n){un.get=function(){return this[e][n]},un.set=function(t){this[e][n]=t},Object.defineProperty(t,n,un)}function fn(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},r=t._props={},o=t.$options._propKeys=[];t.$parent&&_t(!1);var i=function(i){o.push(i);var a=Dt(i,e,n,t);wt(r,i,a),i in t||ln(t,"_props",i)};for(var a in e)i(a);_t(!0)}(t,e.props),e.methods&&function(t,e){t.$options.props;for(var n in e)t[n]="function"!=typeof e[n]?k:A(e[n],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;s(e=t._data="function"==typeof e?function(t,e){ct();try{return t.call(e,e)}catch(t){return Mt(t,e,"data()"),{}}finally{ut()}}(e,t):e||{})||(e={});var n=Object.keys(e),r=t.$options.props,o=(t.$options.methods,n.length);for(;o--;){var i=n[o];r&&m(r,i)||(a=void 0,36!==(a=(i+"").charCodeAt(0))&&95!==a&&ln(t,"_data",i))}var a;Ct(e,!0)}(t):Ct(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),r=Y();for(var o in e){var i=e[o],a="function"==typeof i?i:i.get;r||(n[o]=new cn(t,a||k,k,pn)),o in t||dn(t,o,i)}}(t,e.computed),e.watch&&e.watch!==Z&&function(t,e){for(var n in e){var r=e[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof t?t.split(",").indexOf(e)>-1:(n=t,"[object RegExp]"===a.call(n)&&t.test(e));var n}function An(t,e){var n=t.cache,r=t.keys,o=t._vnode;for(var i in n){var a=n[i];if(a){var s=Cn(a.componentOptions);s&&!e(s)&&$n(n,i,r,o)}}}function $n(t,e,n,r){var o=t[e];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),t[e]=null,v(n,e)}!function(e){e.prototype._init=function(e){var n=this;n._uid=yn++,n._isVue=!0,e&&e._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),r=e._parentVnode;n.parent=e.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(n,e):n.$options=It(gn(n.constructor),e||{},n),n._renderProxy=n,n._self=n,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(n),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&We(t,e)}(n),function(e){e._vnode=null,e._staticTrees=null;var n=e.$options,r=e.$vnode=n._parentVnode,o=r&&r.context;e.$slots=se(n._renderChildren,o),e.$scopedSlots=t,e._c=function(t,n,r,o){return Pe(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return Pe(e,t,n,r,o,!0)};var i=r&&r.data;wt(e,"$attrs",i&&i.attrs||t,null,!0),wt(e,"$listeners",n._parentListeners||t,null,!0)}(n),Ze(n,"beforeCreate"),function(t){var e=ae(t.$options.inject,t);e&&(_t(!1),Object.keys(e).forEach(function(n){wt(t,n,e[n])}),_t(!0))}(n),fn(n),function(t){var e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(n),Ze(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(_n),function(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=At,t.prototype.$delete=$t,t.prototype.$watch=function(t,e,n){if(s(e))return mn(this,t,e,n);(n=n||{}).user=!0;var r=new cn(this,t,e,n);if(n.immediate)try{e.call(this,r.value)}catch(t){Mt(t,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(_n),function(t){var e=/^hook:/;t.prototype.$on=function(t,n){var r=this;if(Array.isArray(t))for(var o=0,i=t.length;o1?$(e):e;for(var n=$(arguments,1),r='event handler for "'+t+'"',o=0,i=e.length;oparseInt(this.max)&&$n(a,s[0],s,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return P}};Object.defineProperty(t,"config",e),t.util={warn:ot,extend:x,mergeOptions:It,defineReactive:wt},t.set=At,t.delete=$t,t.nextTick=Zt,t.observable=function(t){return Ct(t),t},t.options=Object.create(null),N.forEach(function(e){t.options[e+"s"]=Object.create(null)}),t.options._base=t,x(t.options.components,On),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=$(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=It(this.options,t),this}}(t),bn(t),function(t){N.forEach(function(e){t[e]=function(t,n){return n?("component"===e&&s(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}(t)}(_n),Object.defineProperty(_n.prototype,"$isServer",{get:Y}),Object.defineProperty(_n.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(_n,"FunctionalRenderContext",{value:ke}),_n.version="2.6.3";var kn=p("style,class"),Sn=p("input,textarea,option,select,progress"),En=p("contenteditable,draggable,spellcheck"),jn=p("events,caret,typing,plaintext-only"),In=function(t,e){return Pn(e)||"false"===e?"false":"contenteditable"===t&&jn(e)?e:"true"},Tn=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Dn="http://www.w3.org/1999/xlink",Nn=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},Ln=function(t){return Nn(t)?t.slice(6,t.length):""},Pn=function(t){return null==t||!1===t};function Mn(t){for(var e=t.data,r=t,o=t;n(o.componentInstance);)(o=o.componentInstance._vnode)&&o.data&&(e=Fn(o.data,e));for(;n(r=r.parent);)r&&r.data&&(e=Fn(e,r.data));return function(t,e){if(n(t)||n(e))return Rn(t,Un(e));return""}(e.staticClass,e.class)}function Fn(t,e){return{staticClass:Rn(t.staticClass,e.staticClass),class:n(t.class)?[t.class,e.class]:e.class}}function Rn(t,e){return t?e?t+" "+e:t:e||""}function Un(t){return Array.isArray(t)?function(t){for(var e,r="",o=0,i=t.length;o-1?ur(t,e,n):Tn(e)?Pn(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):En(e)?t.setAttribute(e,In(e,n)):Nn(e)?Pn(n)?t.removeAttributeNS(Dn,Ln(e)):t.setAttributeNS(Dn,e,n):ur(t,e,n)}function ur(t,e,n){if(Pn(n))t.removeAttribute(e);else{if(W&&!q&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var r=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",r)};t.addEventListener("input",r),t.__ieph=!0}t.setAttribute(e,n)}}var lr={create:sr,update:sr};function fr(t,r){var o=r.elm,i=r.data,a=t.data;if(!(e(i.staticClass)&&e(i.class)&&(e(a)||e(a.staticClass)&&e(a.class)))){var s=Mn(r),c=o._transitionClasses;n(c)&&(s=Rn(s,Un(c))),s!==o._prevClass&&(o.setAttribute("class",s),o._prevClass=s)}}var pr,dr={create:fr,update:fr},vr="__r",hr="__c";function mr(t,e,n){var r=pr;return function o(){null!==e.apply(null,arguments)&&_r(t,o,n,r)}}var yr=Vt&&!(G&&Number(G[1])<=53);function gr(t,e,n,r){if(yr){var o=rn,i=e;e=i._wrapper=function(t){if(t.timeStamp>=o||t.target.ownerDocument!==document)return i.apply(this,arguments)}}pr.addEventListener(t,e,J?{capture:n,passive:r}:n)}function _r(t,e,n,r){(r||pr).removeEventListener(t,e._wrapper||e,n)}function br(t,r){if(!e(t.data.on)||!e(r.data.on)){var o=r.data.on||{},i=t.data.on||{};pr=r.elm,function(t){if(n(t[vr])){var e=W?"change":"input";t[e]=[].concat(t[vr],t[e]||[]),delete t[vr]}n(t[hr])&&(t.change=[].concat(t[hr],t.change||[]),delete t[hr])}(o),ee(o,i,gr,_r,mr,r.context),pr=void 0}}var Cr,wr={create:br,update:br};function Ar(t,r){if(!e(t.data.domProps)||!e(r.data.domProps)){var o,i,a=r.elm,s=t.data.domProps||{},c=r.data.domProps||{};for(o in n(c.__ob__)&&(c=r.data.domProps=x({},c)),s)e(c[o])&&(a[o]="");for(o in c){if(i=c[o],"textContent"===o||"innerHTML"===o){if(r.children&&(r.children.length=0),i===s[o])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===o||i!==s[o])if("value"===o){a._value=i;var u=e(i)?"":String(i);$r(a,u)&&(a.value=u)}else if("innerHTML"===o&&Bn(a.tagName)&&e(a.innerHTML)){(Cr=Cr||document.createElement("div")).innerHTML=""+i+"";for(var l=Cr.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else a[o]=i}}}function $r(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var r=t.value,o=t._vModifiers;if(n(o)){if(o.number)return f(r)!==f(e);if(o.trim)return r.trim()!==e.trim()}return r!==e}(t,e))}var xr={create:Ar,update:Ar},Or=y(function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach(function(t){if(t){var r=t.split(n);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e});function kr(t){var e=Sr(t.style);return t.staticStyle?x(t.staticStyle,e):e}function Sr(t){return Array.isArray(t)?O(t):"string"==typeof t?Or(t):t}var Er,jr=/^--/,Ir=/\s*!important$/,Tr=function(t,e,n){if(jr.test(e))t.style.setProperty(e,n);else if(Ir.test(n))t.style.setProperty(w(e),n.replace(Ir,""),"important");else{var r=Nr(e);if(Array.isArray(n))for(var o=0,i=n.length;o-1?e.split(Mr).forEach(function(e){return t.classList.add(e)}):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function Rr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Mr).forEach(function(e){return t.classList.remove(e)}):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",r=" "+e+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function Ur(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&x(e,Hr(t.name||"v")),x(e,t),e}return"string"==typeof t?Hr(t):void 0}}var Hr=y(function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}}),Vr=H&&!q,Br="transition",zr="animation",Wr="transition",qr="transitionend",Kr="animation",Xr="animationend";Vr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Wr="WebkitTransition",qr="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Kr="WebkitAnimation",Xr="webkitAnimationEnd"));var Gr=H?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Zr(t){Gr(function(){Gr(t)})}function Jr(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),Fr(t,e))}function Qr(t,e){t._transitionClasses&&v(t._transitionClasses,e),Rr(t,e)}function Yr(t,e,n){var r=eo(t,e),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s=o===Br?qr:Xr,c=0,u=function(){t.removeEventListener(s,l),n()},l=function(e){e.target===t&&++c>=a&&u()};setTimeout(function(){c0&&(n=Br,l=a,f=i.length):e===zr?u>0&&(n=zr,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?Br:zr:null)?n===Br?i.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===Br&&to.test(r[Wr+"Property"])}}function no(t,e){for(;t.length1}function co(t,e){!0!==e.data.show&&oo(e)}var uo=function(t){var i,a,s={},c=t.modules,u=t.nodeOps;for(i=0;iv?_(t,e(o[y+1])?null:o[y+1].elm,o,d,y,i):d>y&&C(0,r,p,v)}(p,h,y,i,l):n(y)?(n(t.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,i)):n(h)?C(0,h,0,h.length-1):n(t.text)&&u.setTextContent(p,""):t.text!==o.text&&u.setTextContent(p,o.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(t,o)}}}function x(t,e,o){if(r(o)&&n(t.parent))t.parent.data.pendingInsert=e;else for(var i=0;i-1,a.selected!==i&&(a.selected=i);else if(j(ho(a),r))return void(t.selectedIndex!==s&&(t.selectedIndex=s));o||(t.selectedIndex=-1)}}function vo(t,e){return e.every(function(e){return!j(e,t)})}function ho(t){return"_value"in t?t._value:t.value}function mo(t){t.target.composing=!0}function yo(t){t.target.composing&&(t.target.composing=!1,go(t.target,"input"))}function go(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function _o(t){return!t.componentInstance||t.data&&t.data.transition?t:_o(t.componentInstance._vnode)}var bo={model:lo,show:{bind:function(t,e,n){var r=e.value,o=(n=_o(n)).data&&n.data.transition,i=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;r&&o?(n.data.show=!0,oo(n,function(){t.style.display=i})):t.style.display=r?i:"none"},update:function(t,e,n){var r=e.value;!r!=!e.oldValue&&((n=_o(n)).data&&n.data.transition?(n.data.show=!0,r?oo(n,function(){t.style.display=t.__vOriginalDisplay}):io(n,function(){t.style.display="none"})):t.style.display=r?t.__vOriginalDisplay:"none")},unbind:function(t,e,n,r,o){o||(t.style.display=t.__vOriginalDisplay)}}},Co={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function wo(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?wo(He(e.children)):t}function Ao(t){var e={},n=t.$options;for(var r in n.propsData)e[r]=t[r];var o=n._parentListeners;for(var i in o)e[_(i)]=o[i];return e}function $o(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}var xo=function(t){return t.tag||Ue(t)},Oo=function(t){return"show"===t.name},ko={name:"transition",props:Co,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(xo)).length){var r=this.mode,i=n[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return i;var a=wo(i);if(!a)return i;if(this._leaving)return $o(t,i);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:o(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=Ao(this),u=this._vnode,l=wo(u);if(a.data.directives&&a.data.directives.some(Oo)&&(a.data.show=!0),l&&l.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(a,l)&&!Ue(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=x({},c);if("out-in"===r)return this._leaving=!0,ne(f,"afterLeave",function(){e._leaving=!1,e.$forceUpdate()}),$o(t,i);if("in-out"===r){if(Ue(a))return u;var p,d=function(){p()};ne(c,"afterEnter",d),ne(c,"enterCancelled",d),ne(f,"delayLeave",function(t){p=t})}}return i}}},So=x({tag:String,moveClass:String},Co);function Eo(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function jo(t){t.data.newPos=t.elm.getBoundingClientRect()}function Io(t){var e=t.data.pos,n=t.data.newPos,r=e.left-n.left,o=e.top-n.top;if(r||o){t.data.moved=!0;var i=t.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+o+"px)",i.transitionDuration="0s"}}delete So.mode;var To={Transition:ko,TransitionGroup:{props:So,beforeMount:function(){var t=this,e=this._update;this._update=function(n,r){var o=Ke(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,o(),e.call(t,n,r)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=Ao(this),s=0;s-1?Wn[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Wn[t]=/HTMLUnknownElement/.test(e.toString())},x(_n.options.directives,bo),x(_n.options.components,To),_n.prototype.__patch__=H?uo:k,_n.prototype.$mount=function(t,e){return function(t,e,n){var r;return t.$el=e,t.$options.render||(t.$options.render=pt),Ze(t,"beforeMount"),r=function(){t._update(t._render(),n)},new cn(t,r,k,{before:function(){t._isMounted&&!t._isDestroyed&&Ze(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,Ze(t,"mounted")),t}(this,t=t&&H?function(t){if("string"==typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}(t):void 0,e)},H&&setTimeout(function(){P.devtools&&tt&&tt.emit("init",_n)},0),_n}); \ No newline at end of file diff --git a/packages/vue-server-renderer/basic.js b/packages/vue-server-renderer/basic.js index 631fa00807f..abf4cb483df 100644 --- a/packages/vue-server-renderer/basic.js +++ b/packages/vue-server-renderer/basic.js @@ -694,6 +694,7 @@ var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; var isPhantomJS = UA && /phantomjs/.test(UA); + var isFF = UA && UA.match(/firefox\/(\d+)/); // Firefox has a "watch" function on Object.prototype... var nativeWatch = ({}).watch; @@ -3814,6 +3815,8 @@ var decodeHTMLCached = cached(he.decode); + var emptySlotScopeToken = "_empty_"; + // configurable state var warn$1; var delimiters; @@ -4426,7 +4429,7 @@ var dynamic = ref.dynamic; el.slotTarget = name; el.slotTargetDynamic = dynamic; - el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf + el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf } } else { // v-slot on component, denotes default slot @@ -4461,8 +4464,13 @@ var slotContainer = slots[name$1] = createASTElement('template', [], el); slotContainer.slotTarget = name$1; slotContainer.slotTargetDynamic = dynamic$1; - slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; }); - slotContainer.slotScope = slotBinding$1.value || "_"; + slotContainer.children = el.children.filter(function (c) { + if (!c.slotScope) { + c.parent = slotContainer; + return true + } + }); + slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken; // remove children as they are returned from scopedSlots now el.children = []; // mark el non-plain so data gets generated @@ -5430,7 +5438,7 @@ } // scoped slots if (el.scopedSlots) { - data += (genScopedSlots(el.scopedSlots, state)) + ","; + data += (genScopedSlots(el, el.scopedSlots, state)) + ","; } // component v-model if (el.model) { @@ -5501,16 +5509,34 @@ } function genScopedSlots ( + el, slots, state ) { - var hasDynamicKeys = Object.keys(slots).some(function (key) { + // by default scoped slots are considered "stable", this allows child + // components with only scoped slots to skip forced updates from parent. + // but in some cases we have to bail-out of this optimization + // for example if the slot contains dynamic names, has v-if or v-for on them... + var needsForceUpdate = Object.keys(slots).some(function (key) { var slot = slots[key]; return slot.slotTargetDynamic || slot.if || slot.for }); + // OR when it is inside another scoped slot (the reactivity is disconnected) + // #9438 + if (!needsForceUpdate) { + var parent = el.parent; + while (parent) { + if (parent.slotScope && parent.slotScope !== emptySlotScopeToken) { + needsForceUpdate = true; + break + } + parent = parent.parent; + } + } + return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return genScopedSlot(slots[key], state) - }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") + }).join(',')) + "]" + (needsForceUpdate ? ",true" : "") + ")") } function genScopedSlot ( @@ -5524,7 +5550,10 @@ if (el.for && !el.forProcessed) { return genFor(el, state, genScopedSlot) } - var fn = "function(" + (String(el.slotScope)) + "){" + + var slotScope = el.slotScope === emptySlotScopeToken + ? "" + : String(el.slotScope); + var fn = "function(" + slotScope + "){" + "return " + (el.tag === 'template' ? el.if && isLegacySyntax ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined") @@ -5617,7 +5646,14 @@ var slotName = el.slotName || '"default"'; var children = genChildren(el, state); var res = "_t(" + slotName + (children ? ("," + children) : ''); - var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}"); + var attrs = el.attrs || el.dynamicAttrs + ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({ + // slot props are camelized + name: camelize(attr.name), + value: attr.value, + dynamic: attr.dynamic + }); })) + : null; var bind$$1 = el.attrsMap['v-bind']; if ((attrs || bind$$1) && !children) { res += ",null"; @@ -6945,900 +6981,896 @@ /* */ - function ensureCtor (comp, base) { - if ( - comp.__esModule || - (hasSymbol && comp[Symbol.toStringTag] === 'Module') - ) { - comp = comp.default; - } - return isObject(comp) - ? base.extend(comp) - : comp - } + var SIMPLE_NORMALIZE = 1; + var ALWAYS_NORMALIZE = 2; - function createAsyncPlaceholder ( - factory, - data, + // wrapper function for providing a more flexible interface + // without getting yelled at by flow + function createElement ( context, + tag, + data, children, - tag + normalizationType, + alwaysNormalize ) { - var node = createEmptyVNode(); - node.asyncFactory = factory; - node.asyncMeta = { data: data, context: context, children: children, tag: tag }; - return node + if (Array.isArray(data) || isPrimitive(data)) { + normalizationType = children; + children = data; + data = undefined; + } + if (isTrue(alwaysNormalize)) { + normalizationType = ALWAYS_NORMALIZE; + } + return _createElement(context, tag, data, children, normalizationType) } - function resolveAsyncComponent ( - factory, - baseCtor, - context + function _createElement ( + context, + tag, + data, + children, + normalizationType ) { - if (isTrue(factory.error) && isDef(factory.errorComp)) { - return factory.errorComp + if (isDef(data) && isDef((data).__ob__)) { + warn( + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + + 'Always create fresh vnode data objects in each render!', + context + ); + return createEmptyVNode() } - - if (isDef(factory.resolved)) { - return factory.resolved + // object syntax in v-bind + if (isDef(data) && isDef(data.is)) { + tag = data.is; } - - if (isTrue(factory.loading) && isDef(factory.loadingComp)) { - return factory.loadingComp + if (!tag) { + // in case of component :is set to falsy value + return createEmptyVNode() } - - if (isDef(factory.contexts)) { - // already pending - factory.contexts.push(context); - } else { - var contexts = factory.contexts = [context]; - var sync = true; - - var forceRender = function (renderCompleted) { - for (var i = 0, l = contexts.length; i < l; i++) { - contexts[i].$forceUpdate(); - } - - if (renderCompleted) { - contexts.length = 0; - } - }; - - var resolve = once(function (res) { - // cache resolved - factory.resolved = ensureCtor(res, baseCtor); - // invoke callbacks only if this is not a synchronous resolve - // (async resolves are shimmed as synchronous during SSR) - if (!sync) { - forceRender(true); - } else { - contexts.length = 0; - } - }); - - var reject = once(function (reason) { + // warn against non-primitive key + if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) + ) { + { warn( - "Failed to resolve async component: " + (String(factory)) + - (reason ? ("\nReason: " + reason) : '') + 'Avoid using non-primitive value as key, ' + + 'use string/number value instead.', + context ); - if (isDef(factory.errorComp)) { - factory.error = true; - forceRender(true); - } - }); - - var res = factory(resolve, reject); - - if (isObject(res)) { - if (isPromise(res)) { - // () => Promise - if (isUndef(factory.resolved)) { - res.then(resolve, reject); - } - } else if (isPromise(res.component)) { - res.component.then(resolve, reject); - - if (isDef(res.error)) { - factory.errorComp = ensureCtor(res.error, baseCtor); - } - - if (isDef(res.loading)) { - factory.loadingComp = ensureCtor(res.loading, baseCtor); - if (res.delay === 0) { - factory.loading = true; - } else { - setTimeout(function () { - if (isUndef(factory.resolved) && isUndef(factory.error)) { - factory.loading = true; - forceRender(false); - } - }, res.delay || 200); - } - } - - if (isDef(res.timeout)) { - setTimeout(function () { - if (isUndef(factory.resolved)) { - reject( - "timeout (" + (res.timeout) + "ms)" - ); - } - }, res.timeout); - } - } } - - sync = false; - // return in case resolved synchronously - return factory.loading - ? factory.loadingComp - : factory.resolved + } + // support single function children as default scoped slot + if (Array.isArray(children) && + typeof children[0] === 'function' + ) { + data = data || {}; + data.scopedSlots = { default: children[0] }; + children.length = 0; + } + if (normalizationType === ALWAYS_NORMALIZE) { + children = normalizeChildren(children); + } else if (normalizationType === SIMPLE_NORMALIZE) { + children = simpleNormalizeChildren(children); + } + var vnode, ns; + if (typeof tag === 'string') { + var Ctor; + ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); + if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { + // component + vnode = createComponent(Ctor, data, context, children, tag); + } else { + // unknown or unlisted namespaced elements + // check at runtime because it may get assigned a namespace when its + // parent normalizes children + vnode = new VNode( + tag, data, children, + undefined, undefined, context + ); + } + } else { + // direct component options / constructor + vnode = createComponent(tag, data, context, children); + } + if (Array.isArray(vnode)) { + return vnode + } else if (isDef(vnode)) { + if (isDef(ns)) { applyNS(vnode, ns); } + if (isDef(data)) { registerDeepBindings(data); } + return vnode + } else { + return createEmptyVNode() } } - /* */ - - /* */ - - /* */ - - /* */ - - var target; - - function add (event, fn) { - target.$on(event, fn); - } - - function remove$1 (event, fn) { - target.$off(event, fn); + function applyNS (vnode, ns, force) { + vnode.ns = ns; + if (vnode.tag === 'foreignObject') { + // use default namespace inside foreignObject + ns = undefined; + force = true; + } + if (isDef(vnode.children)) { + for (var i = 0, l = vnode.children.length; i < l; i++) { + var child = vnode.children[i]; + if (isDef(child.tag) && ( + isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { + applyNS(child, ns, force); + } + } + } } - function createOnceHandler (event, fn) { - var _target = target; - return function onceHandler () { - var res = fn.apply(null, arguments); - if (res !== null) { - _target.$off(event, onceHandler); - } + // ref #5318 + // necessary to ensure parent re-render when deep bindings like :style and + // :class are used on slot nodes + function registerDeepBindings (data) { + if (isObject(data.style)) { + traverse(data.style); + } + if (isObject(data.class)) { + traverse(data.class); } } - function updateComponentListeners ( - vm, - listeners, - oldListeners - ) { - target = vm; - updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); - target = undefined; - } - /* */ - - /** - * Runtime helper for resolving raw children VNodes into a slot object. + * Runtime helper for rendering v-for lists. */ - function resolveSlots ( - children, - context + function renderList ( + val, + render ) { - if (!children || !children.length) { - return {} - } - var slots = {}; - for (var i = 0, l = children.length; i < l; i++) { - var child = children[i]; - var data = child.data; - // remove slot attribute if the node is resolved as a Vue slot node - if (data && data.attrs && data.attrs.slot) { - delete data.attrs.slot; + var ret, i, l, keys, key; + if (Array.isArray(val) || typeof val === 'string') { + ret = new Array(val.length); + for (i = 0, l = val.length; i < l; i++) { + ret[i] = render(val[i], i); } - // named slots should only be respected if the vnode was rendered in the - // same context. - if ((child.context === context || child.fnContext === context) && - data && data.slot != null - ) { - var name = data.slot; - var slot = (slots[name] || (slots[name] = [])); - if (child.tag === 'template') { - slot.push.apply(slot, child.children || []); - } else { - slot.push(child); + } else if (typeof val === 'number') { + ret = new Array(val); + for (i = 0; i < val; i++) { + ret[i] = render(i + 1, i); + } + } else if (isObject(val)) { + if (hasSymbol && val[Symbol.iterator]) { + ret = []; + var iterator = val[Symbol.iterator](); + var result = iterator.next(); + while (!result.done) { + ret.push(render(result.value, ret.length)); + result = iterator.next(); } } else { - (slots.default || (slots.default = [])).push(child); + keys = Object.keys(val); + ret = new Array(keys.length); + for (i = 0, l = keys.length; i < l; i++) { + key = keys[i]; + ret[i] = render(val[key], key, i); + } } } - // ignore slots that contains only whitespace - for (var name$1 in slots) { - if (slots[name$1].every(isWhitespace)) { - delete slots[name$1]; - } + if (!isDef(ret)) { + ret = []; } - return slots + (ret)._isVList = true; + return ret } - function isWhitespace (node) { - return (node.isComment && !node.asyncFactory) || node.text === ' ' - } + /* */ - function resolveScopedSlots ( - fns, // see flow/vnode - hasDynamicKeys, - res + /** + * Runtime helper for rendering + */ + function renderSlot ( + name, + fallback, + props, + bindObject ) { - res = res || { $stable: !hasDynamicKeys }; - for (var i = 0; i < fns.length; i++) { - var slot = fns[i]; - if (Array.isArray(slot)) { - resolveScopedSlots(slot, hasDynamicKeys, res); - } else if (slot) { - res[slot.key] = slot.fn; + var scopedSlotFn = this.$scopedSlots[name]; + var nodes; + if (scopedSlotFn) { // scoped slot + props = props || {}; + if (bindObject) { + if (!isObject(bindObject)) { + warn( + 'slot v-bind without argument expects an Object', + this + ); + } + props = extend(extend({}, bindObject), props); } + nodes = scopedSlotFn(props) || fallback; + } else { + nodes = this.$slots[name] || fallback; + } + + var target = props && props.slot; + if (target) { + return this.$createElement('template', { slot: target }, nodes) + } else { + return nodes } - return res } /* */ - var activeInstance = null; + /** + * Runtime helper for resolving filters + */ + function resolveFilter (id) { + return resolveAsset(this.$options, 'filters', id, true) || identity + } - function updateChildComponent ( - vm, - propsData, - listeners, - parentVnode, - renderChildren - ) { + /* */ - // determine whether component has slot children - // we need to do this before overwriting $options._renderChildren. + function isKeyNotMatch (expect, actual) { + if (Array.isArray(expect)) { + return expect.indexOf(actual) === -1 + } else { + return expect !== actual + } + } - // check if there are dynamic scopedSlots (hand-written or compiled but with - // dynamic slot names). Static scoped slots compiled from template has the - // "$stable" marker. - var hasDynamicScopedSlot = !!( - (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || - (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) - ); - // Any static slot children from the parent may have changed during parent's - // update. Dynamic scoped slots may also have changed. In such cases, a forced - // update is necessary to ensure correctness. - var needsForceUpdate = !!( - renderChildren || // has new static slots - vm.$options._renderChildren || // has old static slots - hasDynamicScopedSlot - ); + /** + * Runtime helper for checking keyCodes from config. + * exposed as Vue.prototype._k + * passing in eventKeyName as last argument separately for backwards compat + */ + function checkKeyCodes ( + eventKeyCode, + key, + builtInKeyCode, + eventKeyName, + builtInKeyName + ) { + var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; + if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { + return isKeyNotMatch(builtInKeyName, eventKeyName) + } else if (mappedKeyCode) { + return isKeyNotMatch(mappedKeyCode, eventKeyCode) + } else if (eventKeyName) { + return hyphenate(eventKeyName) !== key + } + } - vm.$options._parentVnode = parentVnode; - vm.$vnode = parentVnode; // update vm's placeholder node without re-render + /* */ - if (vm._vnode) { // update child tree's parent - vm._vnode.parent = parentVnode; - } - vm.$options._renderChildren = renderChildren; + /** + * Runtime helper for merging v-bind="object" into a VNode's data. + */ + function bindObjectProps ( + data, + tag, + value, + asProp, + isSync + ) { + if (value) { + if (!isObject(value)) { + warn( + 'v-bind without argument expects an Object or Array value', + this + ); + } else { + if (Array.isArray(value)) { + value = toObject(value); + } + var hash; + var loop = function ( key ) { + if ( + key === 'class' || + key === 'style' || + isReservedAttribute(key) + ) { + hash = data; + } else { + var type = data.attrs && data.attrs.type; + hash = asProp || config.mustUseProp(tag, type, key) + ? data.domProps || (data.domProps = {}) + : data.attrs || (data.attrs = {}); + } + var camelizedKey = camelize(key); + if (!(key in hash) && !(camelizedKey in hash)) { + hash[key] = value[key]; - // update $attrs and $listeners hash - // these are also reactive so they may trigger child update if the child - // used them during render - vm.$attrs = parentVnode.data.attrs || emptyObject; - vm.$listeners = listeners || emptyObject; + if (isSync) { + var on = data.on || (data.on = {}); + on[("update:" + camelizedKey)] = function ($event) { + value[key] = $event; + }; + } + } + }; - // update props - if (propsData && vm.$options.props) { - toggleObserving(false); - var props = vm._props; - var propKeys = vm.$options._propKeys || []; - for (var i = 0; i < propKeys.length; i++) { - var key = propKeys[i]; - var propOptions = vm.$options.props; // wtf flow? - props[key] = validateProp(key, propOptions, propsData, vm); + for (var key in value) loop( key ); } - toggleObserving(true); - // keep a copy of raw propsData - vm.$options.propsData = propsData; } + return data + } - // update listeners - listeners = listeners || emptyObject; - var oldListeners = vm.$options._parentListeners; - vm.$options._parentListeners = listeners; - updateComponentListeners(vm, listeners, oldListeners); + /* */ - // resolve slots + force update if has children - if (needsForceUpdate) { - vm.$slots = resolveSlots(renderChildren, parentVnode.context); - vm.$forceUpdate(); + /** + * Runtime helper for rendering static trees. + */ + function renderStatic ( + index, + isInFor + ) { + var cached = this._staticTrees || (this._staticTrees = []); + var tree = cached[index]; + // if has already-rendered static tree and not inside v-for, + // we can reuse the same tree. + if (tree && !isInFor) { + return tree } + // otherwise, render a fresh tree. + tree = cached[index] = this.$options.staticRenderFns[index].call( + this._renderProxy, + null, + this // for render fns generated for functional component templates + ); + markStatic(tree, ("__static__" + index), false); + return tree } - function isInInactiveTree (vm) { - while (vm && (vm = vm.$parent)) { - if (vm._inactive) { return true } - } - return false + /** + * Runtime helper for v-once. + * Effectively it means marking the node as static with a unique key. + */ + function markOnce ( + tree, + index, + key + ) { + markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); + return tree } - function activateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = false; - if (isInInactiveTree(vm)) { - return - } - } else if (vm._directInactive) { - return - } - if (vm._inactive || vm._inactive === null) { - vm._inactive = false; - for (var i = 0; i < vm.$children.length; i++) { - activateChildComponent(vm.$children[i]); + function markStatic ( + tree, + key, + isOnce + ) { + if (Array.isArray(tree)) { + for (var i = 0; i < tree.length; i++) { + if (tree[i] && typeof tree[i] !== 'string') { + markStaticNode(tree[i], (key + "_" + i), isOnce); + } } - callHook(vm, 'activated'); + } else { + markStaticNode(tree, key, isOnce); } } - function deactivateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = true; - if (isInInactiveTree(vm)) { - return - } - } - if (!vm._inactive) { - vm._inactive = true; - for (var i = 0; i < vm.$children.length; i++) { - deactivateChildComponent(vm.$children[i]); + function markStaticNode (node, key, isOnce) { + node.isStatic = true; + node.key = key; + node.isOnce = isOnce; + } + + /* */ + + function bindObjectListeners (data, value) { + if (value) { + if (!isPlainObject(value)) { + warn( + 'v-on without argument expects an Object value', + this + ); + } else { + var on = data.on = data.on ? extend({}, data.on) : {}; + for (var key in value) { + var existing = on[key]; + var ours = value[key]; + on[key] = existing ? [].concat(existing, ours) : ours; + } } - callHook(vm, 'deactivated'); } + return data } - function callHook (vm, hook) { - // #7573 disable dep collection when invoking lifecycle hooks - pushTarget(); - var handlers = vm.$options[hook]; - var info = hook + " hook"; - if (handlers) { - for (var i = 0, j = handlers.length; i < j; i++) { - invokeWithErrorHandling(handlers[i], vm, null, vm, info); + /* */ + + function resolveScopedSlots ( + fns, // see flow/vnode + hasDynamicKeys, + res + ) { + res = res || { $stable: !hasDynamicKeys }; + for (var i = 0; i < fns.length; i++) { + var slot = fns[i]; + if (Array.isArray(slot)) { + resolveScopedSlots(slot, hasDynamicKeys, res); + } else if (slot) { + res[slot.key] = slot.fn; } } - if (vm._hasHookEvent) { - vm.$emit('hook:' + hook); - } - popTarget(); + return res } /* */ - // Async edge case fix requires storing an event listener's attach timestamp. - var getNow = Date.now; - - // Determine what event timestamp the browser is using. Annoyingly, the - // timestamp can either be hi-res ( relative to poge load) or low-res - // (relative to UNIX epoch), so in order to compare time we have to use the - // same timestamp type when saving the flush timestamp. - if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { - // if the low-res timestamp which is bigger than the event timestamp - // (which is evaluated AFTER) it means the event is using a hi-res timestamp, - // and we need to use the hi-res version for event listeners as well. - getNow = function () { return performance.now(); }; + function bindDynamicKeys (baseObj, values) { + for (var i = 0; i < values.length; i += 2) { + var key = values[i]; + if (typeof key === 'string' && key) { + baseObj[values[i]] = values[i + 1]; + } else if (key !== '' && key !== null) { + // null is a speical value for explicitly removing a binding + warn( + ("Invalid value for dynamic directive argument (expected string or null): " + key), + this + ); + } + } + return baseObj } - /** - * Queue a kept-alive component that was activated during patch. - * The queue will be processed after the entire tree has been patched. - */ - function queueActivatedComponent (vm) { - // setting _inactive to false here so that a render function can - // rely on checking whether it's in an inactive tree (e.g. router-view) - vm._inactive = false; + // helper to dynamically append modifier runtime markers to event names. + // ensure only append when value is already string, otherwise it will be cast + // to string and cause the type check to miss. + function prependModifier (value, symbol) { + return typeof value === 'string' ? symbol + value : value } /* */ - /* */ + function installRenderHelpers (target) { + target._o = markOnce; + target._n = toNumber; + target._s = toString; + target._l = renderList; + target._t = renderSlot; + target._q = looseEqual; + target._i = looseIndexOf; + target._m = renderStatic; + target._f = resolveFilter; + target._k = checkKeyCodes; + target._b = bindObjectProps; + target._v = createTextVNode; + target._e = createEmptyVNode; + target._u = resolveScopedSlots; + target._g = bindObjectListeners; + target._d = bindDynamicKeys; + target._p = prependModifier; + } /* */ - var SIMPLE_NORMALIZE = 1; - var ALWAYS_NORMALIZE = 2; - // wrapper function for providing a more flexible interface - // without getting yelled at by flow - function createElement ( - context, - tag, - data, + + /** + * Runtime helper for resolving raw children VNodes into a slot object. + */ + function resolveSlots ( children, - normalizationType, - alwaysNormalize + context ) { - if (Array.isArray(data) || isPrimitive(data)) { - normalizationType = children; - children = data; - data = undefined; + if (!children || !children.length) { + return {} } - if (isTrue(alwaysNormalize)) { - normalizationType = ALWAYS_NORMALIZE; + var slots = {}; + for (var i = 0, l = children.length; i < l; i++) { + var child = children[i]; + var data = child.data; + // remove slot attribute if the node is resolved as a Vue slot node + if (data && data.attrs && data.attrs.slot) { + delete data.attrs.slot; + } + // named slots should only be respected if the vnode was rendered in the + // same context. + if ((child.context === context || child.fnContext === context) && + data && data.slot != null + ) { + var name = data.slot; + var slot = (slots[name] || (slots[name] = [])); + if (child.tag === 'template') { + slot.push.apply(slot, child.children || []); + } else { + slot.push(child); + } + } else { + (slots.default || (slots.default = [])).push(child); + } } - return _createElement(context, tag, data, children, normalizationType) + // ignore slots that contains only whitespace + for (var name$1 in slots) { + if (slots[name$1].every(isWhitespace)) { + delete slots[name$1]; + } + } + return slots } - function _createElement ( - context, - tag, - data, - children, - normalizationType - ) { - if (isDef(data) && isDef((data).__ob__)) { - warn( - "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + - 'Always create fresh vnode data objects in each render!', - context - ); - return createEmptyVNode() - } - // object syntax in v-bind - if (isDef(data) && isDef(data.is)) { - tag = data.is; - } - if (!tag) { - // in case of component :is set to falsy value - return createEmptyVNode() - } - // warn against non-primitive key - if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) - ) { - { - warn( - 'Avoid using non-primitive value as key, ' + - 'use string/number value instead.', - context - ); - } - } - // support single function children as default scoped slot - if (Array.isArray(children) && - typeof children[0] === 'function' - ) { - data = data || {}; - data.scopedSlots = { default: children[0] }; - children.length = 0; - } - if (normalizationType === ALWAYS_NORMALIZE) { - children = normalizeChildren(children); - } else if (normalizationType === SIMPLE_NORMALIZE) { - children = simpleNormalizeChildren(children); - } - var vnode, ns; - if (typeof tag === 'string') { - var Ctor; - ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); - if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { - // component - vnode = createComponent(Ctor, data, context, children, tag); - } else { - // unknown or unlisted namespaced elements - // check at runtime because it may get assigned a namespace when its - // parent normalizes children - vnode = new VNode( - tag, data, children, - undefined, undefined, context - ); - } - } else { - // direct component options / constructor - vnode = createComponent(tag, data, context, children); - } - if (Array.isArray(vnode)) { - return vnode - } else if (isDef(vnode)) { - if (isDef(ns)) { applyNS(vnode, ns); } - if (isDef(data)) { registerDeepBindings(data); } - return vnode - } else { - return createEmptyVNode() - } - } - - function applyNS (vnode, ns, force) { - vnode.ns = ns; - if (vnode.tag === 'foreignObject') { - // use default namespace inside foreignObject - ns = undefined; - force = true; - } - if (isDef(vnode.children)) { - for (var i = 0, l = vnode.children.length; i < l; i++) { - var child = vnode.children[i]; - if (isDef(child.tag) && ( - isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { - applyNS(child, ns, force); - } - } - } - } - - // ref #5318 - // necessary to ensure parent re-render when deep bindings like :style and - // :class are used on slot nodes - function registerDeepBindings (data) { - if (isObject(data.style)) { - traverse(data.style); - } - if (isObject(data.class)) { - traverse(data.class); - } + function isWhitespace (node) { + return (node.isComment && !node.asyncFactory) || node.text === ' ' } /* */ - /** - * Runtime helper for rendering v-for lists. - */ - function renderList ( - val, - render + function normalizeScopedSlots ( + slots, + normalSlots ) { - var ret, i, l, keys, key; - if (Array.isArray(val) || typeof val === 'string') { - ret = new Array(val.length); - for (i = 0, l = val.length; i < l; i++) { - ret[i] = render(val[i], i); - } - } else if (typeof val === 'number') { - ret = new Array(val); - for (i = 0; i < val; i++) { - ret[i] = render(i + 1, i); - } - } else if (isObject(val)) { - if (hasSymbol && val[Symbol.iterator]) { - ret = []; - var iterator = val[Symbol.iterator](); - var result = iterator.next(); - while (!result.done) { - ret.push(render(result.value, ret.length)); - result = iterator.next(); - } - } else { - keys = Object.keys(val); - ret = new Array(keys.length); - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - ret[i] = render(val[key], key, i); + var res; + if (!slots) { + res = {}; + } else if (slots._normalized) { + return slots + } else { + res = {}; + for (var key in slots) { + if (slots[key] && key[0] !== '$') { + res[key] = normalizeScopedSlot(slots[key]); } } } - if (!isDef(ret)) { - ret = []; + // expose normal slots on scopedSlots + for (var key$1 in normalSlots) { + if (!(key$1 in res)) { + res[key$1] = proxyNormalSlot(normalSlots, key$1); + } } - (ret)._isVList = true; - return ret + def(res, '_normalized', true); + def(res, '$stable', slots ? !!slots.$stable : true); + return res } - /* */ - - /** - * Runtime helper for rendering - */ - function renderSlot ( - name, - fallback, - props, - bindObject - ) { - var scopedSlotFn = this.$scopedSlots[name]; - var nodes; - if (scopedSlotFn) { // scoped slot - props = props || {}; - if (bindObject) { - if (!isObject(bindObject)) { - warn( - 'slot v-bind without argument expects an Object', - this - ); - } - props = extend(extend({}, bindObject), props); - } - nodes = scopedSlotFn(props) || fallback; - } else { - nodes = this.$slots[name] || fallback; + function normalizeScopedSlot(fn) { + return function (scope) { + var res = fn(scope); + return res && typeof res === 'object' && !Array.isArray(res) + ? [res] // single vnode + : normalizeChildren(res) } + } - var target = props && props.slot; - if (target) { - return this.$createElement('template', { slot: target }, nodes) - } else { - return nodes - } + function proxyNormalSlot(slots, key) { + return function () { return slots[key]; } } /* */ - /** - * Runtime helper for resolving filters - */ - function resolveFilter (id) { - return resolveAsset(this.$options, 'filters', id, true) || identity - } + var currentRenderingInstance = null; /* */ - function isKeyNotMatch (expect, actual) { - if (Array.isArray(expect)) { - return expect.indexOf(actual) === -1 - } else { - return expect !== actual + function ensureCtor (comp, base) { + if ( + comp.__esModule || + (hasSymbol && comp[Symbol.toStringTag] === 'Module') + ) { + comp = comp.default; } + return isObject(comp) + ? base.extend(comp) + : comp } - /** - * Runtime helper for checking keyCodes from config. - * exposed as Vue.prototype._k - * passing in eventKeyName as last argument separately for backwards compat - */ - function checkKeyCodes ( - eventKeyCode, - key, - builtInKeyCode, - eventKeyName, - builtInKeyName + function createAsyncPlaceholder ( + factory, + data, + context, + children, + tag ) { - var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; - if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { - return isKeyNotMatch(builtInKeyName, eventKeyName) - } else if (mappedKeyCode) { - return isKeyNotMatch(mappedKeyCode, eventKeyCode) - } else if (eventKeyName) { - return hyphenate(eventKeyName) !== key - } + var node = createEmptyVNode(); + node.asyncFactory = factory; + node.asyncMeta = { data: data, context: context, children: children, tag: tag }; + return node } - /* */ - - /** - * Runtime helper for merging v-bind="object" into a VNode's data. - */ - function bindObjectProps ( - data, - tag, - value, - asProp, - isSync + function resolveAsyncComponent ( + factory, + baseCtor ) { - if (value) { - if (!isObject(value)) { + if (isTrue(factory.error) && isDef(factory.errorComp)) { + return factory.errorComp + } + + if (isDef(factory.resolved)) { + return factory.resolved + } + + if (isTrue(factory.loading) && isDef(factory.loadingComp)) { + return factory.loadingComp + } + + var owner = currentRenderingInstance; + if (isDef(factory.owners)) { + // already pending + factory.owners.push(owner); + } else { + var owners = factory.owners = [owner]; + var sync = true; + + var forceRender = function (renderCompleted) { + for (var i = 0, l = owners.length; i < l; i++) { + (owners[i]).$forceUpdate(); + } + + if (renderCompleted) { + owners.length = 0; + } + }; + + var resolve = once(function (res) { + // cache resolved + factory.resolved = ensureCtor(res, baseCtor); + // invoke callbacks only if this is not a synchronous resolve + // (async resolves are shimmed as synchronous during SSR) + if (!sync) { + forceRender(true); + } else { + owners.length = 0; + } + }); + + var reject = once(function (reason) { warn( - 'v-bind without argument expects an Object or Array value', - this + "Failed to resolve async component: " + (String(factory)) + + (reason ? ("\nReason: " + reason) : '') ); - } else { - if (Array.isArray(value)) { - value = toObject(value); + if (isDef(factory.errorComp)) { + factory.error = true; + forceRender(true); } - var hash; - var loop = function ( key ) { - if ( - key === 'class' || - key === 'style' || - isReservedAttribute(key) - ) { - hash = data; - } else { - var type = data.attrs && data.attrs.type; - hash = asProp || config.mustUseProp(tag, type, key) - ? data.domProps || (data.domProps = {}) - : data.attrs || (data.attrs = {}); - } - var camelizedKey = camelize(key); - if (!(key in hash) && !(camelizedKey in hash)) { - hash[key] = value[key]; - - if (isSync) { - var on = data.on || (data.on = {}); - on[("update:" + camelizedKey)] = function ($event) { - value[key] = $event; - }; - } - } - }; + }); - for (var key in value) loop( key ); - } - } - return data - } + var res = factory(resolve, reject); - /* */ + if (isObject(res)) { + if (isPromise(res)) { + // () => Promise + if (isUndef(factory.resolved)) { + res.then(resolve, reject); + } + } else if (isPromise(res.component)) { + res.component.then(resolve, reject); - /** - * Runtime helper for rendering static trees. - */ - function renderStatic ( - index, - isInFor - ) { - var cached = this._staticTrees || (this._staticTrees = []); - var tree = cached[index]; - // if has already-rendered static tree and not inside v-for, - // we can reuse the same tree. - if (tree && !isInFor) { - return tree - } - // otherwise, render a fresh tree. - tree = cached[index] = this.$options.staticRenderFns[index].call( - this._renderProxy, - null, - this // for render fns generated for functional component templates - ); - markStatic(tree, ("__static__" + index), false); - return tree - } + if (isDef(res.error)) { + factory.errorComp = ensureCtor(res.error, baseCtor); + } - /** - * Runtime helper for v-once. - * Effectively it means marking the node as static with a unique key. - */ - function markOnce ( - tree, - index, - key - ) { - markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); - return tree - } + if (isDef(res.loading)) { + factory.loadingComp = ensureCtor(res.loading, baseCtor); + if (res.delay === 0) { + factory.loading = true; + } else { + setTimeout(function () { + if (isUndef(factory.resolved) && isUndef(factory.error)) { + factory.loading = true; + forceRender(false); + } + }, res.delay || 200); + } + } - function markStatic ( - tree, - key, - isOnce - ) { - if (Array.isArray(tree)) { - for (var i = 0; i < tree.length; i++) { - if (tree[i] && typeof tree[i] !== 'string') { - markStaticNode(tree[i], (key + "_" + i), isOnce); + if (isDef(res.timeout)) { + setTimeout(function () { + if (isUndef(factory.resolved)) { + reject( + "timeout (" + (res.timeout) + "ms)" + ); + } + }, res.timeout); + } } } - } else { - markStaticNode(tree, key, isOnce); + + sync = false; + // return in case resolved synchronously + return factory.loading + ? factory.loadingComp + : factory.resolved } } - function markStaticNode (node, key, isOnce) { - node.isStatic = true; - node.key = key; - node.isOnce = isOnce; - } + /* */ /* */ - function bindObjectListeners (data, value) { - if (value) { - if (!isPlainObject(value)) { - warn( - 'v-on without argument expects an Object value', - this - ); - } else { - var on = data.on = data.on ? extend({}, data.on) : {}; - for (var key in value) { - var existing = on[key]; - var ours = value[key]; - on[key] = existing ? [].concat(existing, ours) : ours; - } - } - } - return data - } + /* */ /* */ - function bindDynamicKeys (baseObj, values) { - for (var i = 0; i < values.length; i += 2) { - var key = values[i]; - if (typeof key === 'string' && key) { - baseObj[values[i]] = values[i + 1]; - } else if (key !== '' && key !== null) { - // null is a speical value for explicitly removing a binding - warn( - ("Invalid value for dynamic directive argument (expected string or null): " + key), - this - ); + var target; + + function add (event, fn) { + target.$on(event, fn); + } + + function remove$1 (event, fn) { + target.$off(event, fn); + } + + function createOnceHandler (event, fn) { + var _target = target; + return function onceHandler () { + var res = fn.apply(null, arguments); + if (res !== null) { + _target.$off(event, onceHandler); } } - return baseObj } - // helper to dynamically append modifier runtime markers to event names. - // ensure only append when value is already string, otherwise it will be cast - // to string and cause the type check to miss. - function prependModifier (value, symbol) { - return typeof value === 'string' ? symbol + value : value + function updateComponentListeners ( + vm, + listeners, + oldListeners + ) { + target = vm; + updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); + target = undefined; } /* */ - function installRenderHelpers (target) { - target._o = markOnce; - target._n = toNumber; - target._s = toString; - target._l = renderList; - target._t = renderSlot; - target._q = looseEqual; - target._i = looseIndexOf; - target._m = renderStatic; - target._f = resolveFilter; - target._k = checkKeyCodes; - target._b = bindObjectProps; - target._v = createTextVNode; - target._e = createEmptyVNode; - target._u = resolveScopedSlots; - target._g = bindObjectListeners; - target._d = bindDynamicKeys; - target._p = prependModifier; + var activeInstance = null; + + function updateChildComponent ( + vm, + propsData, + listeners, + parentVnode, + renderChildren + ) { + + // determine whether component has slot children + // we need to do this before overwriting $options._renderChildren. + + // check if there are dynamic scopedSlots (hand-written or compiled but with + // dynamic slot names). Static scoped slots compiled from template has the + // "$stable" marker. + var hasDynamicScopedSlot = !!( + (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || + (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) + ); + + // Any static slot children from the parent may have changed during parent's + // update. Dynamic scoped slots may also have changed. In such cases, a forced + // update is necessary to ensure correctness. + var needsForceUpdate = !!( + renderChildren || // has new static slots + vm.$options._renderChildren || // has old static slots + hasDynamicScopedSlot + ); + + vm.$options._parentVnode = parentVnode; + vm.$vnode = parentVnode; // update vm's placeholder node without re-render + + if (vm._vnode) { // update child tree's parent + vm._vnode.parent = parentVnode; + } + vm.$options._renderChildren = renderChildren; + + // update $attrs and $listeners hash + // these are also reactive so they may trigger child update if the child + // used them during render + vm.$attrs = parentVnode.data.attrs || emptyObject; + vm.$listeners = listeners || emptyObject; + + // update props + if (propsData && vm.$options.props) { + toggleObserving(false); + var props = vm._props; + var propKeys = vm.$options._propKeys || []; + for (var i = 0; i < propKeys.length; i++) { + var key = propKeys[i]; + var propOptions = vm.$options.props; // wtf flow? + props[key] = validateProp(key, propOptions, propsData, vm); + } + toggleObserving(true); + // keep a copy of raw propsData + vm.$options.propsData = propsData; + } + + // update listeners + listeners = listeners || emptyObject; + var oldListeners = vm.$options._parentListeners; + vm.$options._parentListeners = listeners; + updateComponentListeners(vm, listeners, oldListeners); + + // resolve slots + force update if has children + if (needsForceUpdate) { + vm.$slots = resolveSlots(renderChildren, parentVnode.context); + vm.$forceUpdate(); + } } - /* */ + function isInInactiveTree (vm) { + while (vm && (vm = vm.$parent)) { + if (vm._inactive) { return true } + } + return false + } - function normalizeScopedSlots ( - slots, - normalSlots - ) { - var res; - if (!slots) { - res = {}; - } else if (slots._normalized) { - return slots - } else { - res = {}; - for (var key in slots) { - if (slots[key] && key[0] !== '$') { - res[key] = normalizeScopedSlot(normalSlots, key, slots[key]); - } + function activateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = false; + if (isInInactiveTree(vm)) { + return } + } else if (vm._directInactive) { + return } - // expose normal slots on scopedSlots - for (var key$1 in normalSlots) { - if (!(key$1 in res)) { - res[key$1] = proxyNormalSlot(normalSlots, key$1); + if (vm._inactive || vm._inactive === null) { + vm._inactive = false; + for (var i = 0; i < vm.$children.length; i++) { + activateChildComponent(vm.$children[i]); } + callHook(vm, 'activated'); } - res._normalized = true; - res.$stable = slots ? slots.$stable : true; - return res } - function normalizeScopedSlot(normalSlots, key, fn) { - var normalized = function (scope) { - if ( scope === void 0 ) scope = {}; + function deactivateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = true; + if (isInInactiveTree(vm)) { + return + } + } + if (!vm._inactive) { + vm._inactive = true; + for (var i = 0; i < vm.$children.length; i++) { + deactivateChildComponent(vm.$children[i]); + } + callHook(vm, 'deactivated'); + } + } - var res = fn(scope); - return res && typeof res === 'object' && !Array.isArray(res) - ? [res] // single vnode - : normalizeChildren(res) - }; - // proxy scoped slots on normal $slots - if (!hasOwn(normalSlots, key)) { - Object.defineProperty(normalSlots, key, { - get: normalized - }); + function callHook (vm, hook) { + // #7573 disable dep collection when invoking lifecycle hooks + pushTarget(); + var handlers = vm.$options[hook]; + var info = hook + " hook"; + if (handlers) { + for (var i = 0, j = handlers.length; i < j; i++) { + invokeWithErrorHandling(handlers[i], vm, null, vm, info); + } + } + if (vm._hasHookEvent) { + vm.$emit('hook:' + hook); } - return normalized + popTarget(); } - function proxyNormalSlot(slots, key) { - return function () { return slots[key]; } + /* */ + + // Async edge case fix requires storing an event listener's attach timestamp. + var getNow = Date.now; + + // Determine what event timestamp the browser is using. Annoyingly, the + // timestamp can either be hi-res (relative to page load) or low-res + // (relative to UNIX epoch), so in order to compare time we have to use the + // same timestamp type when saving the flush timestamp. + if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { + // if the low-res timestamp which is bigger than the event timestamp + // (which is evaluated AFTER) it means the event is using a hi-res timestamp, + // and we need to use the hi-res version for event listeners as well. + getNow = function () { return performance.now(); }; + } + + /** + * Queue a kept-alive component that was activated during patch. + * The queue will be processed after the entire tree has been patched. + */ + function queueActivatedComponent (vm) { + // setting _inactive to false here so that a render function can + // rely on checking whether it's in an inactive tree (e.g. router-view) + vm._inactive = false; } /* */ /* */ + /* */ + function resolveInject (inject, vm) { if (inject) { // inject is :any because flow is not smart enough to figure out cached @@ -8151,7 +8183,7 @@ var asyncFactory; if (isUndef(Ctor.cid)) { asyncFactory = Ctor; - Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context); + Ctor = resolveAsyncComponent(asyncFactory, baseCtor); if (Ctor === undefined) { // return a placeholder node for async component, which is rendered // as a comment node but preserves all the raw information for the node. diff --git a/packages/vue-server-renderer/build.dev.js b/packages/vue-server-renderer/build.dev.js index a672e4a6ca3..cfde803378a 100644 --- a/packages/vue-server-renderer/build.dev.js +++ b/packages/vue-server-renderer/build.dev.js @@ -696,6 +696,7 @@ var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android' var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; var isPhantomJS = UA && /phantomjs/.test(UA); +var isFF = UA && UA.match(/firefox\/(\d+)/); // Firefox has a "watch" function on Object.prototype... var nativeWatch = ({}).watch; @@ -3564,6 +3565,8 @@ var invalidAttributeRE = /[\s"'<>\/=]/; var decodeHTMLCached = cached(he.decode); +var emptySlotScopeToken = "_empty_"; + // configurable state var warn$1; var delimiters; @@ -4176,7 +4179,7 @@ function processSlotContent (el) { var dynamic = ref.dynamic; el.slotTarget = name; el.slotTargetDynamic = dynamic; - el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf + el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf } } else { // v-slot on component, denotes default slot @@ -4211,8 +4214,13 @@ function processSlotContent (el) { var slotContainer = slots[name$1] = createASTElement('template', [], el); slotContainer.slotTarget = name$1; slotContainer.slotTargetDynamic = dynamic$1; - slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; }); - slotContainer.slotScope = slotBinding$1.value || "_"; + slotContainer.children = el.children.filter(function (c) { + if (!c.slotScope) { + c.parent = slotContainer; + return true + } + }); + slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken; // remove children as they are returned from scopedSlots now el.children = []; // mark el non-plain so data gets generated @@ -5180,7 +5188,7 @@ function genData$2 (el, state) { } // scoped slots if (el.scopedSlots) { - data += (genScopedSlots(el.scopedSlots, state)) + ","; + data += (genScopedSlots(el, el.scopedSlots, state)) + ","; } // component v-model if (el.model) { @@ -5251,16 +5259,34 @@ function genInlineTemplate (el, state) { } function genScopedSlots ( + el, slots, state ) { - var hasDynamicKeys = Object.keys(slots).some(function (key) { + // by default scoped slots are considered "stable", this allows child + // components with only scoped slots to skip forced updates from parent. + // but in some cases we have to bail-out of this optimization + // for example if the slot contains dynamic names, has v-if or v-for on them... + var needsForceUpdate = Object.keys(slots).some(function (key) { var slot = slots[key]; return slot.slotTargetDynamic || slot.if || slot.for }); + // OR when it is inside another scoped slot (the reactivity is disconnected) + // #9438 + if (!needsForceUpdate) { + var parent = el.parent; + while (parent) { + if (parent.slotScope && parent.slotScope !== emptySlotScopeToken) { + needsForceUpdate = true; + break + } + parent = parent.parent; + } + } + return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return genScopedSlot(slots[key], state) - }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")") + }).join(',')) + "]" + (needsForceUpdate ? ",true" : "") + ")") } function genScopedSlot ( @@ -5274,7 +5300,10 @@ function genScopedSlot ( if (el.for && !el.forProcessed) { return genFor(el, state, genScopedSlot) } - var fn = "function(" + (String(el.slotScope)) + "){" + + var slotScope = el.slotScope === emptySlotScopeToken + ? "" + : String(el.slotScope); + var fn = "function(" + slotScope + "){" + "return " + (el.tag === 'template' ? el.if && isLegacySyntax ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined") @@ -5367,7 +5396,14 @@ function genSlot (el, state) { var slotName = el.slotName || '"default"'; var children = genChildren(el, state); var res = "_t(" + slotName + (children ? ("," + children) : ''); - var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}"); + var attrs = el.attrs || el.dynamicAttrs + ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({ + // slot props are camelized + name: camelize(attr.name), + value: attr.value, + dynamic: attr.dynamic + }); })) + : null; var bind$$1 = el.attrsMap['v-bind']; if ((attrs || bind$$1) && !children) { res += ",null"; @@ -6695,900 +6731,896 @@ function checkProp ( /* */ -function ensureCtor (comp, base) { - if ( - comp.__esModule || - (hasSymbol && comp[Symbol.toStringTag] === 'Module') - ) { - comp = comp.default; - } - return isObject(comp) - ? base.extend(comp) - : comp -} +var SIMPLE_NORMALIZE = 1; +var ALWAYS_NORMALIZE = 2; -function createAsyncPlaceholder ( - factory, - data, +// wrapper function for providing a more flexible interface +// without getting yelled at by flow +function createElement ( context, + tag, + data, children, - tag + normalizationType, + alwaysNormalize ) { - var node = createEmptyVNode(); - node.asyncFactory = factory; - node.asyncMeta = { data: data, context: context, children: children, tag: tag }; - return node + if (Array.isArray(data) || isPrimitive(data)) { + normalizationType = children; + children = data; + data = undefined; + } + if (isTrue(alwaysNormalize)) { + normalizationType = ALWAYS_NORMALIZE; + } + return _createElement(context, tag, data, children, normalizationType) } -function resolveAsyncComponent ( - factory, - baseCtor, - context +function _createElement ( + context, + tag, + data, + children, + normalizationType ) { - if (isTrue(factory.error) && isDef(factory.errorComp)) { - return factory.errorComp + if (isDef(data) && isDef((data).__ob__)) { + warn( + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + + 'Always create fresh vnode data objects in each render!', + context + ); + return createEmptyVNode() } - - if (isDef(factory.resolved)) { - return factory.resolved + // object syntax in v-bind + if (isDef(data) && isDef(data.is)) { + tag = data.is; } - - if (isTrue(factory.loading) && isDef(factory.loadingComp)) { - return factory.loadingComp + if (!tag) { + // in case of component :is set to falsy value + return createEmptyVNode() } - - if (isDef(factory.contexts)) { - // already pending - factory.contexts.push(context); - } else { - var contexts = factory.contexts = [context]; - var sync = true; - - var forceRender = function (renderCompleted) { - for (var i = 0, l = contexts.length; i < l; i++) { - contexts[i].$forceUpdate(); - } - - if (renderCompleted) { - contexts.length = 0; - } - }; - - var resolve = once(function (res) { - // cache resolved - factory.resolved = ensureCtor(res, baseCtor); - // invoke callbacks only if this is not a synchronous resolve - // (async resolves are shimmed as synchronous during SSR) - if (!sync) { - forceRender(true); - } else { - contexts.length = 0; - } - }); - - var reject = once(function (reason) { + // warn against non-primitive key + if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) + ) { + { warn( - "Failed to resolve async component: " + (String(factory)) + - (reason ? ("\nReason: " + reason) : '') + 'Avoid using non-primitive value as key, ' + + 'use string/number value instead.', + context ); - if (isDef(factory.errorComp)) { - factory.error = true; - forceRender(true); - } - }); - - var res = factory(resolve, reject); - - if (isObject(res)) { - if (isPromise(res)) { - // () => Promise - if (isUndef(factory.resolved)) { - res.then(resolve, reject); - } - } else if (isPromise(res.component)) { - res.component.then(resolve, reject); - - if (isDef(res.error)) { - factory.errorComp = ensureCtor(res.error, baseCtor); - } - - if (isDef(res.loading)) { - factory.loadingComp = ensureCtor(res.loading, baseCtor); - if (res.delay === 0) { - factory.loading = true; - } else { - setTimeout(function () { - if (isUndef(factory.resolved) && isUndef(factory.error)) { - factory.loading = true; - forceRender(false); - } - }, res.delay || 200); - } - } - - if (isDef(res.timeout)) { - setTimeout(function () { - if (isUndef(factory.resolved)) { - reject( - "timeout (" + (res.timeout) + "ms)" - ); - } - }, res.timeout); - } - } } - - sync = false; - // return in case resolved synchronously - return factory.loading - ? factory.loadingComp - : factory.resolved + } + // support single function children as default scoped slot + if (Array.isArray(children) && + typeof children[0] === 'function' + ) { + data = data || {}; + data.scopedSlots = { default: children[0] }; + children.length = 0; + } + if (normalizationType === ALWAYS_NORMALIZE) { + children = normalizeChildren(children); + } else if (normalizationType === SIMPLE_NORMALIZE) { + children = simpleNormalizeChildren(children); + } + var vnode, ns; + if (typeof tag === 'string') { + var Ctor; + ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); + if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { + // component + vnode = createComponent(Ctor, data, context, children, tag); + } else { + // unknown or unlisted namespaced elements + // check at runtime because it may get assigned a namespace when its + // parent normalizes children + vnode = new VNode( + tag, data, children, + undefined, undefined, context + ); + } + } else { + // direct component options / constructor + vnode = createComponent(tag, data, context, children); + } + if (Array.isArray(vnode)) { + return vnode + } else if (isDef(vnode)) { + if (isDef(ns)) { applyNS(vnode, ns); } + if (isDef(data)) { registerDeepBindings(data); } + return vnode + } else { + return createEmptyVNode() } } -/* */ - -/* */ - -/* */ - -/* */ - -var target; - -function add (event, fn) { - target.$on(event, fn); -} - -function remove$1 (event, fn) { - target.$off(event, fn); +function applyNS (vnode, ns, force) { + vnode.ns = ns; + if (vnode.tag === 'foreignObject') { + // use default namespace inside foreignObject + ns = undefined; + force = true; + } + if (isDef(vnode.children)) { + for (var i = 0, l = vnode.children.length; i < l; i++) { + var child = vnode.children[i]; + if (isDef(child.tag) && ( + isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { + applyNS(child, ns, force); + } + } + } } -function createOnceHandler (event, fn) { - var _target = target; - return function onceHandler () { - var res = fn.apply(null, arguments); - if (res !== null) { - _target.$off(event, onceHandler); - } +// ref #5318 +// necessary to ensure parent re-render when deep bindings like :style and +// :class are used on slot nodes +function registerDeepBindings (data) { + if (isObject(data.style)) { + traverse(data.style); + } + if (isObject(data.class)) { + traverse(data.class); } } -function updateComponentListeners ( - vm, - listeners, - oldListeners -) { - target = vm; - updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); - target = undefined; -} - /* */ - - /** - * Runtime helper for resolving raw children VNodes into a slot object. + * Runtime helper for rendering v-for lists. */ -function resolveSlots ( - children, - context +function renderList ( + val, + render ) { - if (!children || !children.length) { - return {} - } - var slots = {}; - for (var i = 0, l = children.length; i < l; i++) { - var child = children[i]; - var data = child.data; - // remove slot attribute if the node is resolved as a Vue slot node - if (data && data.attrs && data.attrs.slot) { - delete data.attrs.slot; + var ret, i, l, keys, key; + if (Array.isArray(val) || typeof val === 'string') { + ret = new Array(val.length); + for (i = 0, l = val.length; i < l; i++) { + ret[i] = render(val[i], i); } - // named slots should only be respected if the vnode was rendered in the - // same context. - if ((child.context === context || child.fnContext === context) && - data && data.slot != null - ) { - var name = data.slot; - var slot = (slots[name] || (slots[name] = [])); - if (child.tag === 'template') { - slot.push.apply(slot, child.children || []); - } else { - slot.push(child); + } else if (typeof val === 'number') { + ret = new Array(val); + for (i = 0; i < val; i++) { + ret[i] = render(i + 1, i); + } + } else if (isObject(val)) { + if (hasSymbol && val[Symbol.iterator]) { + ret = []; + var iterator = val[Symbol.iterator](); + var result = iterator.next(); + while (!result.done) { + ret.push(render(result.value, ret.length)); + result = iterator.next(); } } else { - (slots.default || (slots.default = [])).push(child); + keys = Object.keys(val); + ret = new Array(keys.length); + for (i = 0, l = keys.length; i < l; i++) { + key = keys[i]; + ret[i] = render(val[key], key, i); + } } } - // ignore slots that contains only whitespace - for (var name$1 in slots) { - if (slots[name$1].every(isWhitespace)) { - delete slots[name$1]; - } + if (!isDef(ret)) { + ret = []; } - return slots + (ret)._isVList = true; + return ret } -function isWhitespace (node) { - return (node.isComment && !node.asyncFactory) || node.text === ' ' -} +/* */ -function resolveScopedSlots ( - fns, // see flow/vnode - hasDynamicKeys, - res +/** + * Runtime helper for rendering + */ +function renderSlot ( + name, + fallback, + props, + bindObject ) { - res = res || { $stable: !hasDynamicKeys }; - for (var i = 0; i < fns.length; i++) { - var slot = fns[i]; - if (Array.isArray(slot)) { - resolveScopedSlots(slot, hasDynamicKeys, res); - } else if (slot) { - res[slot.key] = slot.fn; + var scopedSlotFn = this.$scopedSlots[name]; + var nodes; + if (scopedSlotFn) { // scoped slot + props = props || {}; + if (bindObject) { + if (!isObject(bindObject)) { + warn( + 'slot v-bind without argument expects an Object', + this + ); + } + props = extend(extend({}, bindObject), props); } + nodes = scopedSlotFn(props) || fallback; + } else { + nodes = this.$slots[name] || fallback; + } + + var target = props && props.slot; + if (target) { + return this.$createElement('template', { slot: target }, nodes) + } else { + return nodes } - return res } /* */ -var activeInstance = null; +/** + * Runtime helper for resolving filters + */ +function resolveFilter (id) { + return resolveAsset(this.$options, 'filters', id, true) || identity +} -function updateChildComponent ( - vm, - propsData, - listeners, - parentVnode, - renderChildren -) { +/* */ - // determine whether component has slot children - // we need to do this before overwriting $options._renderChildren. +function isKeyNotMatch (expect, actual) { + if (Array.isArray(expect)) { + return expect.indexOf(actual) === -1 + } else { + return expect !== actual + } +} - // check if there are dynamic scopedSlots (hand-written or compiled but with - // dynamic slot names). Static scoped slots compiled from template has the - // "$stable" marker. - var hasDynamicScopedSlot = !!( - (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || - (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) - ); - // Any static slot children from the parent may have changed during parent's - // update. Dynamic scoped slots may also have changed. In such cases, a forced - // update is necessary to ensure correctness. - var needsForceUpdate = !!( - renderChildren || // has new static slots - vm.$options._renderChildren || // has old static slots - hasDynamicScopedSlot - ); +/** + * Runtime helper for checking keyCodes from config. + * exposed as Vue.prototype._k + * passing in eventKeyName as last argument separately for backwards compat + */ +function checkKeyCodes ( + eventKeyCode, + key, + builtInKeyCode, + eventKeyName, + builtInKeyName +) { + var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; + if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { + return isKeyNotMatch(builtInKeyName, eventKeyName) + } else if (mappedKeyCode) { + return isKeyNotMatch(mappedKeyCode, eventKeyCode) + } else if (eventKeyName) { + return hyphenate(eventKeyName) !== key + } +} - vm.$options._parentVnode = parentVnode; - vm.$vnode = parentVnode; // update vm's placeholder node without re-render +/* */ - if (vm._vnode) { // update child tree's parent - vm._vnode.parent = parentVnode; - } - vm.$options._renderChildren = renderChildren; +/** + * Runtime helper for merging v-bind="object" into a VNode's data. + */ +function bindObjectProps ( + data, + tag, + value, + asProp, + isSync +) { + if (value) { + if (!isObject(value)) { + warn( + 'v-bind without argument expects an Object or Array value', + this + ); + } else { + if (Array.isArray(value)) { + value = toObject(value); + } + var hash; + var loop = function ( key ) { + if ( + key === 'class' || + key === 'style' || + isReservedAttribute(key) + ) { + hash = data; + } else { + var type = data.attrs && data.attrs.type; + hash = asProp || config.mustUseProp(tag, type, key) + ? data.domProps || (data.domProps = {}) + : data.attrs || (data.attrs = {}); + } + var camelizedKey = camelize(key); + if (!(key in hash) && !(camelizedKey in hash)) { + hash[key] = value[key]; - // update $attrs and $listeners hash - // these are also reactive so they may trigger child update if the child - // used them during render - vm.$attrs = parentVnode.data.attrs || emptyObject; - vm.$listeners = listeners || emptyObject; + if (isSync) { + var on = data.on || (data.on = {}); + on[("update:" + camelizedKey)] = function ($event) { + value[key] = $event; + }; + } + } + }; - // update props - if (propsData && vm.$options.props) { - toggleObserving(false); - var props = vm._props; - var propKeys = vm.$options._propKeys || []; - for (var i = 0; i < propKeys.length; i++) { - var key = propKeys[i]; - var propOptions = vm.$options.props; // wtf flow? - props[key] = validateProp(key, propOptions, propsData, vm); + for (var key in value) loop( key ); } - toggleObserving(true); - // keep a copy of raw propsData - vm.$options.propsData = propsData; } + return data +} - // update listeners - listeners = listeners || emptyObject; - var oldListeners = vm.$options._parentListeners; - vm.$options._parentListeners = listeners; - updateComponentListeners(vm, listeners, oldListeners); +/* */ - // resolve slots + force update if has children - if (needsForceUpdate) { - vm.$slots = resolveSlots(renderChildren, parentVnode.context); - vm.$forceUpdate(); +/** + * Runtime helper for rendering static trees. + */ +function renderStatic ( + index, + isInFor +) { + var cached = this._staticTrees || (this._staticTrees = []); + var tree = cached[index]; + // if has already-rendered static tree and not inside v-for, + // we can reuse the same tree. + if (tree && !isInFor) { + return tree } + // otherwise, render a fresh tree. + tree = cached[index] = this.$options.staticRenderFns[index].call( + this._renderProxy, + null, + this // for render fns generated for functional component templates + ); + markStatic(tree, ("__static__" + index), false); + return tree } -function isInInactiveTree (vm) { - while (vm && (vm = vm.$parent)) { - if (vm._inactive) { return true } - } - return false +/** + * Runtime helper for v-once. + * Effectively it means marking the node as static with a unique key. + */ +function markOnce ( + tree, + index, + key +) { + markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); + return tree } -function activateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = false; - if (isInInactiveTree(vm)) { - return - } - } else if (vm._directInactive) { - return - } - if (vm._inactive || vm._inactive === null) { - vm._inactive = false; - for (var i = 0; i < vm.$children.length; i++) { - activateChildComponent(vm.$children[i]); +function markStatic ( + tree, + key, + isOnce +) { + if (Array.isArray(tree)) { + for (var i = 0; i < tree.length; i++) { + if (tree[i] && typeof tree[i] !== 'string') { + markStaticNode(tree[i], (key + "_" + i), isOnce); + } } - callHook(vm, 'activated'); + } else { + markStaticNode(tree, key, isOnce); } } -function deactivateChildComponent (vm, direct) { - if (direct) { - vm._directInactive = true; - if (isInInactiveTree(vm)) { - return - } - } - if (!vm._inactive) { - vm._inactive = true; - for (var i = 0; i < vm.$children.length; i++) { - deactivateChildComponent(vm.$children[i]); +function markStaticNode (node, key, isOnce) { + node.isStatic = true; + node.key = key; + node.isOnce = isOnce; +} + +/* */ + +function bindObjectListeners (data, value) { + if (value) { + if (!isPlainObject(value)) { + warn( + 'v-on without argument expects an Object value', + this + ); + } else { + var on = data.on = data.on ? extend({}, data.on) : {}; + for (var key in value) { + var existing = on[key]; + var ours = value[key]; + on[key] = existing ? [].concat(existing, ours) : ours; + } } - callHook(vm, 'deactivated'); } + return data } -function callHook (vm, hook) { - // #7573 disable dep collection when invoking lifecycle hooks - pushTarget(); - var handlers = vm.$options[hook]; - var info = hook + " hook"; - if (handlers) { - for (var i = 0, j = handlers.length; i < j; i++) { - invokeWithErrorHandling(handlers[i], vm, null, vm, info); +/* */ + +function resolveScopedSlots ( + fns, // see flow/vnode + hasDynamicKeys, + res +) { + res = res || { $stable: !hasDynamicKeys }; + for (var i = 0; i < fns.length; i++) { + var slot = fns[i]; + if (Array.isArray(slot)) { + resolveScopedSlots(slot, hasDynamicKeys, res); + } else if (slot) { + res[slot.key] = slot.fn; } } - if (vm._hasHookEvent) { - vm.$emit('hook:' + hook); - } - popTarget(); + return res } /* */ -// Async edge case fix requires storing an event listener's attach timestamp. -var getNow = Date.now; - -// Determine what event timestamp the browser is using. Annoyingly, the -// timestamp can either be hi-res ( relative to poge load) or low-res -// (relative to UNIX epoch), so in order to compare time we have to use the -// same timestamp type when saving the flush timestamp. -if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { - // if the low-res timestamp which is bigger than the event timestamp - // (which is evaluated AFTER) it means the event is using a hi-res timestamp, - // and we need to use the hi-res version for event listeners as well. - getNow = function () { return performance.now(); }; +function bindDynamicKeys (baseObj, values) { + for (var i = 0; i < values.length; i += 2) { + var key = values[i]; + if (typeof key === 'string' && key) { + baseObj[values[i]] = values[i + 1]; + } else if (key !== '' && key !== null) { + // null is a speical value for explicitly removing a binding + warn( + ("Invalid value for dynamic directive argument (expected string or null): " + key), + this + ); + } + } + return baseObj } -/** - * Queue a kept-alive component that was activated during patch. - * The queue will be processed after the entire tree has been patched. - */ -function queueActivatedComponent (vm) { - // setting _inactive to false here so that a render function can - // rely on checking whether it's in an inactive tree (e.g. router-view) - vm._inactive = false; +// helper to dynamically append modifier runtime markers to event names. +// ensure only append when value is already string, otherwise it will be cast +// to string and cause the type check to miss. +function prependModifier (value, symbol) { + return typeof value === 'string' ? symbol + value : value } /* */ -/* */ +function installRenderHelpers (target) { + target._o = markOnce; + target._n = toNumber; + target._s = toString; + target._l = renderList; + target._t = renderSlot; + target._q = looseEqual; + target._i = looseIndexOf; + target._m = renderStatic; + target._f = resolveFilter; + target._k = checkKeyCodes; + target._b = bindObjectProps; + target._v = createTextVNode; + target._e = createEmptyVNode; + target._u = resolveScopedSlots; + target._g = bindObjectListeners; + target._d = bindDynamicKeys; + target._p = prependModifier; +} /* */ -var SIMPLE_NORMALIZE = 1; -var ALWAYS_NORMALIZE = 2; -// wrapper function for providing a more flexible interface -// without getting yelled at by flow -function createElement ( - context, - tag, - data, + +/** + * Runtime helper for resolving raw children VNodes into a slot object. + */ +function resolveSlots ( children, - normalizationType, - alwaysNormalize + context ) { - if (Array.isArray(data) || isPrimitive(data)) { - normalizationType = children; - children = data; - data = undefined; + if (!children || !children.length) { + return {} } - if (isTrue(alwaysNormalize)) { - normalizationType = ALWAYS_NORMALIZE; + var slots = {}; + for (var i = 0, l = children.length; i < l; i++) { + var child = children[i]; + var data = child.data; + // remove slot attribute if the node is resolved as a Vue slot node + if (data && data.attrs && data.attrs.slot) { + delete data.attrs.slot; + } + // named slots should only be respected if the vnode was rendered in the + // same context. + if ((child.context === context || child.fnContext === context) && + data && data.slot != null + ) { + var name = data.slot; + var slot = (slots[name] || (slots[name] = [])); + if (child.tag === 'template') { + slot.push.apply(slot, child.children || []); + } else { + slot.push(child); + } + } else { + (slots.default || (slots.default = [])).push(child); + } } - return _createElement(context, tag, data, children, normalizationType) + // ignore slots that contains only whitespace + for (var name$1 in slots) { + if (slots[name$1].every(isWhitespace)) { + delete slots[name$1]; + } + } + return slots } -function _createElement ( - context, - tag, - data, - children, - normalizationType -) { - if (isDef(data) && isDef((data).__ob__)) { - warn( - "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + - 'Always create fresh vnode data objects in each render!', - context - ); - return createEmptyVNode() - } - // object syntax in v-bind - if (isDef(data) && isDef(data.is)) { - tag = data.is; - } - if (!tag) { - // in case of component :is set to falsy value - return createEmptyVNode() - } - // warn against non-primitive key - if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) - ) { - { - warn( - 'Avoid using non-primitive value as key, ' + - 'use string/number value instead.', - context - ); - } - } - // support single function children as default scoped slot - if (Array.isArray(children) && - typeof children[0] === 'function' - ) { - data = data || {}; - data.scopedSlots = { default: children[0] }; - children.length = 0; - } - if (normalizationType === ALWAYS_NORMALIZE) { - children = normalizeChildren(children); - } else if (normalizationType === SIMPLE_NORMALIZE) { - children = simpleNormalizeChildren(children); - } - var vnode, ns; - if (typeof tag === 'string') { - var Ctor; - ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); - if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { - // component - vnode = createComponent(Ctor, data, context, children, tag); - } else { - // unknown or unlisted namespaced elements - // check at runtime because it may get assigned a namespace when its - // parent normalizes children - vnode = new VNode( - tag, data, children, - undefined, undefined, context - ); - } - } else { - // direct component options / constructor - vnode = createComponent(tag, data, context, children); - } - if (Array.isArray(vnode)) { - return vnode - } else if (isDef(vnode)) { - if (isDef(ns)) { applyNS(vnode, ns); } - if (isDef(data)) { registerDeepBindings(data); } - return vnode - } else { - return createEmptyVNode() - } -} - -function applyNS (vnode, ns, force) { - vnode.ns = ns; - if (vnode.tag === 'foreignObject') { - // use default namespace inside foreignObject - ns = undefined; - force = true; - } - if (isDef(vnode.children)) { - for (var i = 0, l = vnode.children.length; i < l; i++) { - var child = vnode.children[i]; - if (isDef(child.tag) && ( - isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { - applyNS(child, ns, force); - } - } - } -} - -// ref #5318 -// necessary to ensure parent re-render when deep bindings like :style and -// :class are used on slot nodes -function registerDeepBindings (data) { - if (isObject(data.style)) { - traverse(data.style); - } - if (isObject(data.class)) { - traverse(data.class); - } +function isWhitespace (node) { + return (node.isComment && !node.asyncFactory) || node.text === ' ' } /* */ -/** - * Runtime helper for rendering v-for lists. - */ -function renderList ( - val, - render +function normalizeScopedSlots ( + slots, + normalSlots ) { - var ret, i, l, keys, key; - if (Array.isArray(val) || typeof val === 'string') { - ret = new Array(val.length); - for (i = 0, l = val.length; i < l; i++) { - ret[i] = render(val[i], i); - } - } else if (typeof val === 'number') { - ret = new Array(val); - for (i = 0; i < val; i++) { - ret[i] = render(i + 1, i); - } - } else if (isObject(val)) { - if (hasSymbol && val[Symbol.iterator]) { - ret = []; - var iterator = val[Symbol.iterator](); - var result = iterator.next(); - while (!result.done) { - ret.push(render(result.value, ret.length)); - result = iterator.next(); - } - } else { - keys = Object.keys(val); - ret = new Array(keys.length); - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - ret[i] = render(val[key], key, i); + var res; + if (!slots) { + res = {}; + } else if (slots._normalized) { + return slots + } else { + res = {}; + for (var key in slots) { + if (slots[key] && key[0] !== '$') { + res[key] = normalizeScopedSlot(slots[key]); } } } - if (!isDef(ret)) { - ret = []; + // expose normal slots on scopedSlots + for (var key$1 in normalSlots) { + if (!(key$1 in res)) { + res[key$1] = proxyNormalSlot(normalSlots, key$1); + } } - (ret)._isVList = true; - return ret + def(res, '_normalized', true); + def(res, '$stable', slots ? !!slots.$stable : true); + return res } -/* */ - -/** - * Runtime helper for rendering - */ -function renderSlot ( - name, - fallback, - props, - bindObject -) { - var scopedSlotFn = this.$scopedSlots[name]; - var nodes; - if (scopedSlotFn) { // scoped slot - props = props || {}; - if (bindObject) { - if (!isObject(bindObject)) { - warn( - 'slot v-bind without argument expects an Object', - this - ); - } - props = extend(extend({}, bindObject), props); - } - nodes = scopedSlotFn(props) || fallback; - } else { - nodes = this.$slots[name] || fallback; +function normalizeScopedSlot(fn) { + return function (scope) { + var res = fn(scope); + return res && typeof res === 'object' && !Array.isArray(res) + ? [res] // single vnode + : normalizeChildren(res) } +} - var target = props && props.slot; - if (target) { - return this.$createElement('template', { slot: target }, nodes) - } else { - return nodes - } +function proxyNormalSlot(slots, key) { + return function () { return slots[key]; } } /* */ -/** - * Runtime helper for resolving filters - */ -function resolveFilter (id) { - return resolveAsset(this.$options, 'filters', id, true) || identity -} +var currentRenderingInstance = null; /* */ -function isKeyNotMatch (expect, actual) { - if (Array.isArray(expect)) { - return expect.indexOf(actual) === -1 - } else { - return expect !== actual +function ensureCtor (comp, base) { + if ( + comp.__esModule || + (hasSymbol && comp[Symbol.toStringTag] === 'Module') + ) { + comp = comp.default; } + return isObject(comp) + ? base.extend(comp) + : comp } -/** - * Runtime helper for checking keyCodes from config. - * exposed as Vue.prototype._k - * passing in eventKeyName as last argument separately for backwards compat - */ -function checkKeyCodes ( - eventKeyCode, - key, - builtInKeyCode, - eventKeyName, - builtInKeyName +function createAsyncPlaceholder ( + factory, + data, + context, + children, + tag ) { - var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; - if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { - return isKeyNotMatch(builtInKeyName, eventKeyName) - } else if (mappedKeyCode) { - return isKeyNotMatch(mappedKeyCode, eventKeyCode) - } else if (eventKeyName) { - return hyphenate(eventKeyName) !== key - } + var node = createEmptyVNode(); + node.asyncFactory = factory; + node.asyncMeta = { data: data, context: context, children: children, tag: tag }; + return node } -/* */ - -/** - * Runtime helper for merging v-bind="object" into a VNode's data. - */ -function bindObjectProps ( - data, - tag, - value, - asProp, - isSync +function resolveAsyncComponent ( + factory, + baseCtor ) { - if (value) { - if (!isObject(value)) { + if (isTrue(factory.error) && isDef(factory.errorComp)) { + return factory.errorComp + } + + if (isDef(factory.resolved)) { + return factory.resolved + } + + if (isTrue(factory.loading) && isDef(factory.loadingComp)) { + return factory.loadingComp + } + + var owner = currentRenderingInstance; + if (isDef(factory.owners)) { + // already pending + factory.owners.push(owner); + } else { + var owners = factory.owners = [owner]; + var sync = true; + + var forceRender = function (renderCompleted) { + for (var i = 0, l = owners.length; i < l; i++) { + (owners[i]).$forceUpdate(); + } + + if (renderCompleted) { + owners.length = 0; + } + }; + + var resolve = once(function (res) { + // cache resolved + factory.resolved = ensureCtor(res, baseCtor); + // invoke callbacks only if this is not a synchronous resolve + // (async resolves are shimmed as synchronous during SSR) + if (!sync) { + forceRender(true); + } else { + owners.length = 0; + } + }); + + var reject = once(function (reason) { warn( - 'v-bind without argument expects an Object or Array value', - this + "Failed to resolve async component: " + (String(factory)) + + (reason ? ("\nReason: " + reason) : '') ); - } else { - if (Array.isArray(value)) { - value = toObject(value); + if (isDef(factory.errorComp)) { + factory.error = true; + forceRender(true); } - var hash; - var loop = function ( key ) { - if ( - key === 'class' || - key === 'style' || - isReservedAttribute(key) - ) { - hash = data; - } else { - var type = data.attrs && data.attrs.type; - hash = asProp || config.mustUseProp(tag, type, key) - ? data.domProps || (data.domProps = {}) - : data.attrs || (data.attrs = {}); - } - var camelizedKey = camelize(key); - if (!(key in hash) && !(camelizedKey in hash)) { - hash[key] = value[key]; - - if (isSync) { - var on = data.on || (data.on = {}); - on[("update:" + camelizedKey)] = function ($event) { - value[key] = $event; - }; - } - } - }; + }); - for (var key in value) loop( key ); - } - } - return data -} + var res = factory(resolve, reject); -/* */ + if (isObject(res)) { + if (isPromise(res)) { + // () => Promise + if (isUndef(factory.resolved)) { + res.then(resolve, reject); + } + } else if (isPromise(res.component)) { + res.component.then(resolve, reject); -/** - * Runtime helper for rendering static trees. - */ -function renderStatic ( - index, - isInFor -) { - var cached = this._staticTrees || (this._staticTrees = []); - var tree = cached[index]; - // if has already-rendered static tree and not inside v-for, - // we can reuse the same tree. - if (tree && !isInFor) { - return tree - } - // otherwise, render a fresh tree. - tree = cached[index] = this.$options.staticRenderFns[index].call( - this._renderProxy, - null, - this // for render fns generated for functional component templates - ); - markStatic(tree, ("__static__" + index), false); - return tree -} + if (isDef(res.error)) { + factory.errorComp = ensureCtor(res.error, baseCtor); + } -/** - * Runtime helper for v-once. - * Effectively it means marking the node as static with a unique key. - */ -function markOnce ( - tree, - index, - key -) { - markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); - return tree -} + if (isDef(res.loading)) { + factory.loadingComp = ensureCtor(res.loading, baseCtor); + if (res.delay === 0) { + factory.loading = true; + } else { + setTimeout(function () { + if (isUndef(factory.resolved) && isUndef(factory.error)) { + factory.loading = true; + forceRender(false); + } + }, res.delay || 200); + } + } -function markStatic ( - tree, - key, - isOnce -) { - if (Array.isArray(tree)) { - for (var i = 0; i < tree.length; i++) { - if (tree[i] && typeof tree[i] !== 'string') { - markStaticNode(tree[i], (key + "_" + i), isOnce); + if (isDef(res.timeout)) { + setTimeout(function () { + if (isUndef(factory.resolved)) { + reject( + "timeout (" + (res.timeout) + "ms)" + ); + } + }, res.timeout); + } } } - } else { - markStaticNode(tree, key, isOnce); + + sync = false; + // return in case resolved synchronously + return factory.loading + ? factory.loadingComp + : factory.resolved } } -function markStaticNode (node, key, isOnce) { - node.isStatic = true; - node.key = key; - node.isOnce = isOnce; -} +/* */ /* */ -function bindObjectListeners (data, value) { - if (value) { - if (!isPlainObject(value)) { - warn( - 'v-on without argument expects an Object value', - this - ); - } else { - var on = data.on = data.on ? extend({}, data.on) : {}; - for (var key in value) { - var existing = on[key]; - var ours = value[key]; - on[key] = existing ? [].concat(existing, ours) : ours; - } - } - } - return data -} +/* */ /* */ -function bindDynamicKeys (baseObj, values) { - for (var i = 0; i < values.length; i += 2) { - var key = values[i]; - if (typeof key === 'string' && key) { - baseObj[values[i]] = values[i + 1]; - } else if (key !== '' && key !== null) { - // null is a speical value for explicitly removing a binding - warn( - ("Invalid value for dynamic directive argument (expected string or null): " + key), - this - ); +var target; + +function add (event, fn) { + target.$on(event, fn); +} + +function remove$1 (event, fn) { + target.$off(event, fn); +} + +function createOnceHandler (event, fn) { + var _target = target; + return function onceHandler () { + var res = fn.apply(null, arguments); + if (res !== null) { + _target.$off(event, onceHandler); } } - return baseObj } -// helper to dynamically append modifier runtime markers to event names. -// ensure only append when value is already string, otherwise it will be cast -// to string and cause the type check to miss. -function prependModifier (value, symbol) { - return typeof value === 'string' ? symbol + value : value +function updateComponentListeners ( + vm, + listeners, + oldListeners +) { + target = vm; + updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); + target = undefined; } /* */ -function installRenderHelpers (target) { - target._o = markOnce; - target._n = toNumber; - target._s = toString; - target._l = renderList; - target._t = renderSlot; - target._q = looseEqual; - target._i = looseIndexOf; - target._m = renderStatic; - target._f = resolveFilter; - target._k = checkKeyCodes; - target._b = bindObjectProps; - target._v = createTextVNode; - target._e = createEmptyVNode; - target._u = resolveScopedSlots; - target._g = bindObjectListeners; - target._d = bindDynamicKeys; - target._p = prependModifier; +var activeInstance = null; + +function updateChildComponent ( + vm, + propsData, + listeners, + parentVnode, + renderChildren +) { + + // determine whether component has slot children + // we need to do this before overwriting $options._renderChildren. + + // check if there are dynamic scopedSlots (hand-written or compiled but with + // dynamic slot names). Static scoped slots compiled from template has the + // "$stable" marker. + var hasDynamicScopedSlot = !!( + (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || + (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) + ); + + // Any static slot children from the parent may have changed during parent's + // update. Dynamic scoped slots may also have changed. In such cases, a forced + // update is necessary to ensure correctness. + var needsForceUpdate = !!( + renderChildren || // has new static slots + vm.$options._renderChildren || // has old static slots + hasDynamicScopedSlot + ); + + vm.$options._parentVnode = parentVnode; + vm.$vnode = parentVnode; // update vm's placeholder node without re-render + + if (vm._vnode) { // update child tree's parent + vm._vnode.parent = parentVnode; + } + vm.$options._renderChildren = renderChildren; + + // update $attrs and $listeners hash + // these are also reactive so they may trigger child update if the child + // used them during render + vm.$attrs = parentVnode.data.attrs || emptyObject; + vm.$listeners = listeners || emptyObject; + + // update props + if (propsData && vm.$options.props) { + toggleObserving(false); + var props = vm._props; + var propKeys = vm.$options._propKeys || []; + for (var i = 0; i < propKeys.length; i++) { + var key = propKeys[i]; + var propOptions = vm.$options.props; // wtf flow? + props[key] = validateProp(key, propOptions, propsData, vm); + } + toggleObserving(true); + // keep a copy of raw propsData + vm.$options.propsData = propsData; + } + + // update listeners + listeners = listeners || emptyObject; + var oldListeners = vm.$options._parentListeners; + vm.$options._parentListeners = listeners; + updateComponentListeners(vm, listeners, oldListeners); + + // resolve slots + force update if has children + if (needsForceUpdate) { + vm.$slots = resolveSlots(renderChildren, parentVnode.context); + vm.$forceUpdate(); + } } -/* */ +function isInInactiveTree (vm) { + while (vm && (vm = vm.$parent)) { + if (vm._inactive) { return true } + } + return false +} -function normalizeScopedSlots ( - slots, - normalSlots -) { - var res; - if (!slots) { - res = {}; - } else if (slots._normalized) { - return slots - } else { - res = {}; - for (var key in slots) { - if (slots[key] && key[0] !== '$') { - res[key] = normalizeScopedSlot(normalSlots, key, slots[key]); - } +function activateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = false; + if (isInInactiveTree(vm)) { + return } + } else if (vm._directInactive) { + return } - // expose normal slots on scopedSlots - for (var key$1 in normalSlots) { - if (!(key$1 in res)) { - res[key$1] = proxyNormalSlot(normalSlots, key$1); + if (vm._inactive || vm._inactive === null) { + vm._inactive = false; + for (var i = 0; i < vm.$children.length; i++) { + activateChildComponent(vm.$children[i]); } + callHook(vm, 'activated'); } - res._normalized = true; - res.$stable = slots ? slots.$stable : true; - return res } -function normalizeScopedSlot(normalSlots, key, fn) { - var normalized = function (scope) { - if ( scope === void 0 ) scope = {}; +function deactivateChildComponent (vm, direct) { + if (direct) { + vm._directInactive = true; + if (isInInactiveTree(vm)) { + return + } + } + if (!vm._inactive) { + vm._inactive = true; + for (var i = 0; i < vm.$children.length; i++) { + deactivateChildComponent(vm.$children[i]); + } + callHook(vm, 'deactivated'); + } +} - var res = fn(scope); - return res && typeof res === 'object' && !Array.isArray(res) - ? [res] // single vnode - : normalizeChildren(res) - }; - // proxy scoped slots on normal $slots - if (!hasOwn(normalSlots, key)) { - Object.defineProperty(normalSlots, key, { - get: normalized - }); +function callHook (vm, hook) { + // #7573 disable dep collection when invoking lifecycle hooks + pushTarget(); + var handlers = vm.$options[hook]; + var info = hook + " hook"; + if (handlers) { + for (var i = 0, j = handlers.length; i < j; i++) { + invokeWithErrorHandling(handlers[i], vm, null, vm, info); + } + } + if (vm._hasHookEvent) { + vm.$emit('hook:' + hook); } - return normalized + popTarget(); } -function proxyNormalSlot(slots, key) { - return function () { return slots[key]; } +/* */ + +// Async edge case fix requires storing an event listener's attach timestamp. +var getNow = Date.now; + +// Determine what event timestamp the browser is using. Annoyingly, the +// timestamp can either be hi-res (relative to page load) or low-res +// (relative to UNIX epoch), so in order to compare time we have to use the +// same timestamp type when saving the flush timestamp. +if (inBrowser && getNow() > document.createEvent('Event').timeStamp) { + // if the low-res timestamp which is bigger than the event timestamp + // (which is evaluated AFTER) it means the event is using a hi-res timestamp, + // and we need to use the hi-res version for event listeners as well. + getNow = function () { return performance.now(); }; +} + +/** + * Queue a kept-alive component that was activated during patch. + * The queue will be processed after the entire tree has been patched. + */ +function queueActivatedComponent (vm) { + // setting _inactive to false here so that a render function can + // rely on checking whether it's in an inactive tree (e.g. router-view) + vm._inactive = false; } /* */ /* */ +/* */ + function resolveInject (inject, vm) { if (inject) { // inject is :any because flow is not smart enough to figure out cached @@ -7901,7 +7933,7 @@ function createComponent ( var asyncFactory; if (isUndef(Ctor.cid)) { asyncFactory = Ctor; - Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context); + Ctor = resolveAsyncComponent(asyncFactory, baseCtor); if (Ctor === undefined) { // return a placeholder node for async component, which is rendered // as a comment node but preserves all the raw information for the node. diff --git a/packages/vue-server-renderer/build.prod.js b/packages/vue-server-renderer/build.prod.js index d09674532fb..386b3c2c98e 100644 --- a/packages/vue-server-renderer/build.prod.js +++ b/packages/vue-server-renderer/build.prod.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("he"))&&"object"==typeof e&&"default"in e?e.default:e,r=Object.freeze({});function n(e){return null==e}function i(e){return null!=e}function o(e){return!0===e}function a(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function s(e){return null!==e&&"object"==typeof e}var c=Object.prototype.toString;function u(e){return"[object Object]"===c.call(e)}function l(e){return i(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function f(e){return null==e?"":Array.isArray(e)||u(e)&&e.toString===c?JSON.stringify(e,null,2):String(e)}function p(e){var t=parseFloat(e);return isNaN(t)?e:t}function d(e,t){for(var r=Object.create(null),n=e.split(","),i=0;i\/="'\u0009\u000a\u000c\u0020]/,N=function(e){return E.test(e)},L=function(e){return P(e)||0===e.indexOf("data-")||0===e.indexOf("aria-")},I={acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},M={"<":"<",">":">",'"':""","&":"&"};function R(e){return e.replace(/[<>"&]/g,D)}function D(e){return M[e]||e}var U={"animation-iteration-count":!0,"border-image-outset":!0,"border-image-slice":!0,"border-image-width":!0,"box-flex":!0,"box-flex-group":!0,"box-ordinal-group":!0,"column-count":!0,columns:!0,flex:!0,"flex-grow":!0,"flex-positive":!0,"flex-shrink":!0,"flex-negative":!0,"flex-order":!0,"grid-row":!0,"grid-row-end":!0,"grid-row-span":!0,"grid-row-start":!0,"grid-column":!0,"grid-column-end":!0,"grid-column-span":!0,"grid-column-start":!0,"font-weight":!0,"line-clamp":!0,"line-height":!0,opacity:!0,order:!0,orphans:!0,"tab-size":!0,widows:!0,"z-index":!0,zoom:!0,"fill-opacity":!0,"flood-opacity":!0,"stop-opacity":!0,"stroke-dasharray":!0,"stroke-dashoffset":!0,"stroke-miterlimit":!0,"stroke-opacity":!0,"stroke-width":!0},z=d("input,textarea,option,select,progress"),B=d("contenteditable,draggable,spellcheck"),q=d("events,caret,typing,plaintext-only"),J=function(e,t){return K(t)||"false"===t?"false":"contenteditable"===e&&q(t)?t:"true"},H=d("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),K=function(e){return null==e||!1===e};function V(e,t){if(H(e)){if(!K(t))return" "+e+'="'+e+'"'}else{if(B(e))return" "+e+'="'+R(J(e,t))+'"';if(!K(t))return" "+e+'="'+R(String(t))+'"'}return""}var W=function(e,t,r,n,i,o,a,s){this.tag=e,this.data=t,this.children=r,this.text=n,this.elm=i,this.ns=void 0,this.context=o,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=t&&t.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1},Z={child:{configurable:!0}};Z.child.get=function(){return this.componentInstance},Object.defineProperties(W.prototype,Z);var X=function(e){void 0===e&&(e="");var t=new W;return t.text=e,t.isComment=!0,t};function G(e){return new W(void 0,void 0,void 0,String(e))}function Q(e,t,r){var n=new W(void 0,void 0,void 0,t);n.raw=r,e.children=[n]}function Y(e,t,r,n){Object.defineProperty(e,t,{value:r,enumerable:!!n,writable:!0,configurable:!0})}var ee,te="__proto__"in{},re="undefined"!=typeof window,ne="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,ie=ne&&WXEnvironment.platform.toLowerCase(),oe=re&&window.navigator.userAgent.toLowerCase(),ae=oe&&/msie|trident/.test(oe),se=(oe&&oe.indexOf("msie 9.0"),oe&&oe.indexOf("edge/")>0),ce=(oe&&oe.indexOf("android"),oe&&/iphone|ipad|ipod|ios/.test(oe),oe&&/chrome\/\d+/.test(oe),oe&&/phantomjs/.test(oe),{}.watch);if(re)try{var ue={};Object.defineProperty(ue,"passive",{get:function(){}}),window.addEventListener("test-passive",null,ue)}catch(e){}var le=function(){return void 0===ee&&(ee=!re&&!ne&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),ee};re&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function fe(e){return"function"==typeof e&&/native code/.test(e.toString())}var pe,de="undefined"!=typeof Symbol&&fe(Symbol)&&"undefined"!=typeof Reflect&&fe(Reflect.ownKeys);pe="undefined"!=typeof Set&&fe(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ve="data-server-rendered",he=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch"],me={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:k,isReservedAttr:k,isUnknownElement:k,getTagNamespace:O,parsePlatformTagName:C,mustUseProp:k,async:!0,_lifecycleHooks:he},ye=O,ge=0,be=function(){this.id=ge++,this.subs=[]};be.prototype.addSub=function(e){this.subs.push(e)},be.prototype.removeSub=function(e){!function(e,t){if(e.length){var r=e.indexOf(t);if(r>-1)e.splice(r,1)}}(this.subs,e)},be.prototype.depend=function(){be.target&&be.target.addDep(this)},be.prototype.notify=function(){for(var e=this.subs.slice(),t=0,r=e.length;t=0&&Math.floor(t)===t&&isFinite(e)}(t))return e.length=Math.max(e.length,t),e.splice(t,1,r),r;if(t in e&&!(t in Object.prototype))return e[t]=r,r;var n=e.__ob__;return e._isVue||n&&n.vmCount?r:n?(Ce(n.value,t,r),n.dep.notify(),r):(e[t]=r,r)}Oe.prototype.walk=function(e){for(var t=Object.keys(e),r=0;r-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===S(e)){var c=ze(String,i.type);(c<0||s1&&(t[n[0].trim()]=n[1].trim())}}),t});function tt(e){var t=rt(e.style);return e.staticStyle?$(e.staticStyle,t):t}function rt(e){return Array.isArray(e)?A(e):"string"==typeof e?et(e):e}function nt(e){var t="";for(var r in e){var n=e[r],i=S(r);if(Array.isArray(n))for(var o=0,a=n.length;o-1&&st(a);else if(T(r,at(a)))return void st(a)}}},ut=d("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),lt=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),ft=d("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),pt=900,dt=function(e){return e},vt="undefined"!=typeof process&&process.nextTick?process.nextTick:"undefined"!=typeof Promise?function(e){return Promise.resolve().then(e)}:"undefined"!=typeof setTimeout?setTimeout:dt;if(vt===dt)throw new Error("Your JavaScript runtime does not support any asynchronous primitives that are required by vue-server-renderer. Please use a polyfill for either Promise or setTimeout.");function ht(e,t){var r=0,n=function(i,o){i&&n.caching&&(n.cacheBuffer[n.cacheBuffer.length-1]+=i),!0!==e(i,o)&&(r>=pt?vt(function(){try{o()}catch(e){t(e)}}):(r++,o(),r--))};return n.caching=!1,n.cacheBuffer=[],n.componentBuffer=[],n}var mt=function(e){function t(t){var r=this;e.call(this),this.buffer="",this.render=t,this.expectedSize=0,this.write=ht(function(e,t){var n=r.expectedSize;return r.buffer+=e,r.buffer.length>=n&&(r.next=t,r.pushBySize(n),!0)},function(e){r.emit("error",e)}),this.end=function(){r.emit("beforeEnd"),r.done=!0,r.push(r.buffer)}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.pushBySize=function(e){var t=this.buffer.substring(0,e);this.buffer=this.buffer.substring(e),this.push(t)},t.prototype.tryRender=function(){try{this.render(this.write,this.end)}catch(e){this.emit("error",e)}},t.prototype.tryNext=function(){try{this.next()}catch(e){this.emit("error",e)}},t.prototype._read=function(e){this.expectedSize=e,o(this.done)?this.push(null):this.buffer.length>=e?this.pushBySize(e):n(this.next)?this.tryRender():this.tryNext()},t}(require("stream").Readable),yt=function(e){this.userContext=e.userContext,this.activeInstance=e.activeInstance,this.renderStates=[],this.write=e.write,this.done=e.done,this.renderNode=e.renderNode,this.isUnaryTag=e.isUnaryTag,this.modules=e.modules,this.directives=e.directives;var t=e.cache;if(t&&(!t.get||!t.set))throw new Error("renderer cache must implement at least get & set.");this.cache=t,this.get=t&>(t,"get"),this.has=t&>(t,"has"),this.next=this.next.bind(this)};function gt(e,t){var r=e[t];return n(r)?void 0:r.length>1?function(t,n){return r.call(e,t,n)}:function(t,n){return n(r.call(e,t))}}yt.prototype.next=function(){for(;;){var e=this.renderStates[this.renderStates.length-1];if(n(e))return this.done();switch(e.type){case"Element":case"Fragment":var t=e.children,r=e.total,i=e.rendered++;if(i=0&&" "===(h=e.charAt(v));v--);h&&bt.test(h)||(u=!0)}}else void 0===i?(d=n+1,i=e.slice(0,n).trim()):m();function m(){(o||(o=[])).push(e.slice(d,n).trim()),d=n+1}if(void 0===i?i=e.slice(0,n).trim():0!==d&&m(),o)for(n=0;n\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Kt=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Vt="[a-zA-Z_][\\-\\.0-9_a-zA-Za-zA-Z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*",Wt="((?:"+Vt+"\\:)?"+Vt+")",Zt=new RegExp("^<"+Wt),Xt=/^\s*(\/?)>/,Gt=new RegExp("^<\\/"+Wt+"[^>]*>"),Qt=/^]+>/i,Yt=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},ir=/&(?:lt|gt|quot|amp|#39);/g,or=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,ar=d("pre,textarea",!0),sr=function(e,t){return e&&ar(e)&&"\n"===t[0]};function cr(e,t){var r=t?or:ir;return e.replace(r,function(e){return nr[e]})}function ur(e,t,r){var n=r||{},i=n.number,o="$$v";n.trim&&(o="(typeof $$v === 'string'? $$v.trim(): $$v)"),i&&(o="_n("+o+")");var a=lr(t,o);e.model={value:"("+t+")",expression:JSON.stringify(t),callback:"function ($$v) {"+a+"}"}}function lr(e,t){var r=function(e){if(e=e.trim(),Rt=e.length,e.indexOf("[")<0||e.lastIndexOf("]")-1?{exp:e.slice(0,zt),key:'"'+e.slice(zt+1)+'"'}:{exp:e,key:null};Dt=e,zt=Bt=qt=0;for(;!pr();)dr(Ut=fr())?hr(Ut):91===Ut&&vr(Ut);return{exp:e.slice(0,Bt),key:e.slice(Bt+1,qt)}}(e);return null===r.key?e+"="+t:"$set("+r.exp+", "+r.key+", "+t+")"}function fr(){return Dt.charCodeAt(++zt)}function pr(){return zt>=Rt}function dr(e){return 34===e||39===e}function vr(e){var t=1;for(Bt=zt;!pr();)if(dr(e=fr()))hr(e);else if(91===e&&t++,93===e&&t--,0===t){qt=zt;break}}function hr(e){for(var t=e;!pr()&&(e=fr())!==t;);}var mr,yr,gr,br,_r,wr,xr,Sr,$r=/^@|^v-on:/,Ar=/^v-|^@|^:/,Or=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,kr=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Cr=/^\(|\)$/g,Tr=/^\[.*\]$/,jr=/:(.*)$/,Fr=/^:|^\.|^v-bind:/,Pr=/\.[^.]+/g,Er=/^v-slot(:|$)|^#/,Nr=/[\r\n]/,Lr=/\s+/g,Ir=g(t.decode);function Mr(e,t,r){return{type:1,tag:e,attrsList:t,attrsMap:Jr(t),rawAttrsMap:{},parent:r,children:[]}}function Rr(e,t){mr=t.warn||At,wr=t.isPreTag||k,xr=t.mustUseProp||k,Sr=t.getTagNamespace||k;t.isReservedTag;gr=Ot(t.modules,"transformNode"),br=Ot(t.modules,"preTransformNode"),_r=Ot(t.modules,"postTransformNode"),yr=t.delimiters;var r,n,i=[],o=!1!==t.preserveWhitespace,a=t.whitespace,s=!1,c=!1;function u(e){if(l(e),s||e.processed||(e=Dr(e,t)),i.length||e===r||r.if&&(e.elseif||e.else)&&zr(r,{exp:e.elseif,block:e}),n&&!e.forbidden)if(e.elseif||e.else)a=e,(u=function(e){var t=e.length;for(;t--;){if(1===e[t].type)return e[t];e.pop()}}(n.children))&&u.if&&zr(u,{exp:a.elseif,block:a});else{if(e.slotScope){var o=e.slotTarget||'"default"';(n.scopedSlots||(n.scopedSlots={}))[o]=e}n.children.push(e),e.parent=n}var a,u;e.children=e.children.filter(function(e){return!e.slotScope}),l(e),e.pre&&(s=!1),wr(e.tag)&&(c=!1);for(var f=0;f<_r.length;f++)_r[f](e,t)}function l(e){if(!c)for(var t;(t=e.children[e.children.length-1])&&3===t.type&&" "===t.text;)e.children.pop()}return function(e,t){for(var r,n,i=[],o=t.expectHTML,a=t.isUnaryTag||k,s=t.canBeLeftOpenTag||k,c=0;e;){if(r=e,n&&tr(n)){var u=0,l=n.toLowerCase(),f=rr[l]||(rr[l]=new RegExp("([\\s\\S]*?)(]*>)","i")),p=e.replace(f,function(e,r,n){return u=n.length,tr(l)||"noscript"===l||(r=r.replace(//g,"$1").replace(//g,"$1")),sr(l,r)&&(r=r.slice(1)),t.chars&&t.chars(r),""});c+=e.length-p.length,e=p,O(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(Yt.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),S(v+3);continue}}if(er.test(e)){var h=e.indexOf("]>");if(h>=0){S(h+2);continue}}var m=e.match(Qt);if(m){S(m[0].length);continue}var y=e.match(Gt);if(y){var g=c;S(y[0].length),O(y[1],g,c);continue}var b=$();if(b){A(b),sr(b.tagName,e)&&S(1);continue}}var _=void 0,w=void 0,x=void 0;if(d>=0){for(w=e.slice(d);!(Gt.test(w)||Zt.test(w)||Yt.test(w)||er.test(w)||(x=w.indexOf("<",1))<0);)d+=x,w=e.slice(d);_=e.substring(0,d)}d<0&&(_=e),_&&S(_.length),t.chars&&_&&t.chars(_,c-_.length,c)}if(e===r){t.chars&&t.chars(e);break}}function S(t){c+=t,e=e.substring(t)}function $(){var t=e.match(Zt);if(t){var r,n,i={tagName:t[1],attrs:[],start:c};for(S(t[0].length);!(r=e.match(Xt))&&(n=e.match(Kt)||e.match(Ht));)n.start=c,S(n[0].length),n.end=c,i.attrs.push(n);if(r)return i.unarySlash=r[1],S(r[0].length),i.end=c,i}}function A(e){var r=e.tagName,c=e.unarySlash;o&&("p"===n&&ft(r)&&O(n),s(r)&&n===r&&O(r));for(var u=a(r)||!!c,l=e.attrs.length,f=new Array(l),p=0;p=0&&i[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=i.length-1;u>=a;u--)t.end&&t.end(i[u].tag,r,o);i.length=a,n=a&&i[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,r,o):"p"===s&&(t.start&&t.start(e,[],!1,r,o),t.end&&t.end(e,r,o))}O()}(e,{warn:mr,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,l){var f=n&&n.ns||Sr(e);ae&&"svg"===f&&(o=function(e){for(var t=[],r=0;rc&&(s.push(o=e.slice(c,i)),a.push(JSON.stringify(o)));var u=_t(n[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+n[0].length}return c-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),Pt(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(n?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+lr(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+lr(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+lr(t,"$$c")+"}",null,!0)}(e,n,i);else if("input"===o&&"radio"===a)!function(e,t,r){var n=r&&r.number,i=Et(e,"value")||"null";kt(e,"checked","_q("+t+","+(i=n?"_n("+i+")":i)+")"),Pt(e,"change",lr(t,i),null,!0)}(e,n,i);else{if("input"!==o&&"textarea"!==o)return ur(e,n,i),!1;!function(e,t,r){var n=e.attrsMap.type,i=r||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==n,u=o?"change":"range"===n?Zr:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=lr(t,l);c&&(f="if($event.target.composing)return;"+f),kt(e,"value","("+t+")"),Pt(e,u,f,null,!0),(s||a)&&Pt(e,"blur","$forceUpdate()")}(e,n,i)}return!0},text:function(e,t){t.value&&kt(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&kt(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:ut,mustUseProp:function(e,t,r){return"value"===r&&z(e)&&"button"!==t||"selected"===r&&"option"===e||"checked"===r&&"input"===e||"muted"===r&&"video"===e},canBeLeftOpenTag:lt,isReservedTag:function(e){return Qe(e)||Ye(e)},getTagNamespace:function(e){return Ye(e)?"svg":"math"===e?"math":void 0},staticKeys:function(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}(Wr)},Gr=/^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/,Qr=/\([^)]*?\);*$/,Yr=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,en={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},tn={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},rn=function(e){return"if("+e+")return null;"},nn={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:rn("$event.target !== $event.currentTarget"),ctrl:rn("!$event.ctrlKey"),shift:rn("!$event.shiftKey"),alt:rn("!$event.altKey"),meta:rn("!$event.metaKey"),left:rn("'button' in $event && $event.button !== 0"),middle:rn("'button' in $event && $event.button !== 1"),right:rn("'button' in $event && $event.button !== 2")};function on(e,t){var r=t?"nativeOn:":"on:",n="",i="";for(var o in e){var a=an(e[o]);e[o]&&e[o].dynamic?i+=o+","+a+",":n+='"'+o+'":'+a+","}return n="{"+n.slice(0,-1)+"}",i?r+"_d("+n+",["+i.slice(0,-1)+"])":r+n}function an(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map(function(e){return an(e)}).join(",")+"]";var t=Yr.test(e.value),r=Gr.test(e.value),n=Yr.test(e.value.replace(Qr,""));if(e.modifiers){var i="",o="",a=[];for(var s in e.modifiers)if(nn[s])o+=nn[s],en[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;o+=rn(["ctrl","shift","alt","meta"].filter(function(e){return!c[e]}).map(function(e){return"$event."+e+"Key"}).join("||"))}else a.push(s);return a.length&&(i+=function(e){return"if(('keyCode' in $event)&&"+e.map(sn).join("&&")+")return null;"}(a)),o&&(i+=o),"function($event){"+i+(t?"return "+e.value+"($event)":r?"return ("+e.value+")($event)":n?"return "+e.value:e.value)+"}"}return t||r?e.value:"function($event){"+(n?"return "+e.value:e.value)+"}"}function sn(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var r=en[e],n=tn[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(r)+",$event.key,"+JSON.stringify(n)+")"}var cn={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(r){return"_b("+r+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:O},un=function(e){this.options=e,this.warn=e.warn||At,this.transforms=Ot(e.modules,"transformCode"),this.dataGenFns=Ot(e.modules,"genData"),this.directives=$($({},cn),e.directives);var t=e.isReservedTag||k;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function ln(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return fn(e,t);if(e.once&&!e.onceProcessed)return pn(e,t);if(e.for&&!e.forProcessed)return vn(e,t);if(e.if&&!e.ifProcessed)return dn(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var r=e.slotName||'"default"',n=yn(e,t),i="_t("+r+(n?","+n:""),o=e.attrs&&"{"+e.attrs.map(function(e){return _(e.name)+":"+e.value}).join(",")+"}",a=e.attrsMap["v-bind"];!o&&!a||n||(i+=",null");o&&(i+=","+o);a&&(i+=(o?"":",null")+","+a);return i+")"}(e,t);var r;if(e.component)r=function(e,t,r){var n=t.inlineTemplate?null:yn(t,r,!0);return"_c("+e+","+hn(t,r)+(n?","+n:"")+")"}(e.component,e,t);else{var n;(!e.plain||e.pre&&t.maybeComponent(e))&&(n=hn(e,t));var i=e.inlineTemplate?null:yn(e,t,!0);r="_c('"+e.tag+"'"+(n?","+n:"")+(i?","+i:"")+")"}for(var o=0;o"'+(r?","+r:"")+")"}(e,t);case On.CHILDREN:return En(e,t,!0);case On.PARTIAL:return En(e,t,!1);default:return ln(e,t)}}function En(e,t,r){var n=e.plain?void 0:hn(e,t),i=r?"["+In(e,t)+"]":Nn(e,t,!0);return"_c('"+e.tag+"'"+(n?","+n:"")+(i?","+i:"")+")"}function Nn(e,t,r){return yn(e,t,r,Pn,Ln)}function Ln(e,t){return 1===e.type?Pn(e,t):_n(e)}function In(e,t){return e.children.length?"_ssrNode("+zn(Un(e,t))+")":""}function Mn(e,t){return"("+zn(Rn(e,t))+")"}function Rn(e,t){if(e.for&&!e.forProcessed)return e.forProcessed=!0,[{type:Fn,value:vn(e,t,Mn,"_ssrList")}];if(e.if&&!e.ifProcessed)return e.ifProcessed=!0,[{type:Fn,value:dn(e,t,Mn,'"\x3c!----\x3e"')}];if("template"===e.tag)return Un(e,t);var r=Dn(e,t),n=Un(e,t),i=t.options.isUnaryTag,o=i&&i(e.tag)?[]:[{type:Tn,value:""}];return r.concat(n,o)}function Dn(e,t){var r;!function(e,t){if(e.directives)for(var r=0;r"}),u}function Un(e,t){var r;return(r=e.attrsMap["v-html"])?[{type:Fn,value:"_s("+r+")"}]:(r=e.attrsMap["v-text"])?[{type:jn,value:"_s("+r+")"}]:"textarea"===e.tag&&(r=e.attrsMap["v-model"])?[{type:jn,value:"_s("+r+")"}]:e.children?function(e,t){for(var r=[],n=0;n0&&(Zn((u=e(u,(r||"")+"_"+c))[0])&&Zn(f)&&(s[l]=G(f.text+u[0].text),u.shift()),s.push.apply(s,u)):a(u)?Zn(f)?s[l]=G(f.text+u):""!==u&&s.push(G(u)):Zn(u)&&Zn(f)?s[l]=G(f.text+u.text):(o(t._isVList)&&i(u.tag)&&n(u.key)&&i(r)&&(u.key="__vlist"+r+"_"+c+"__"),s.push(u)));return s}(e):void 0}function Zn(e){return i(e)&&i(e.text)&&!1===e.isComment}var Xn={_ssrEscape:R,_ssrNode:function(e,t,r,n){return new Gn(e,t,r,n)},_ssrList:function(e,t){var r,n,i,o,a="";if(Array.isArray(e)||"string"==typeof e)for(r=0,n=e.length;rdocument.createEvent("Event").timeStamp&&(vi=function(){return performance.now()});var hi=1,mi=2;function yi(e,t,r,c,u,l){return(Array.isArray(r)||a(r))&&(u=c,c=r,r=void 0),o(l)&&(u=mi),function(e,t,r,a,c){if(i(r)&&i(r.__ob__))return X();i(r)&&i(r.is)&&(t=r.is);if(!t)return X();Array.isArray(a)&&"function"==typeof a[0]&&((r=r||{}).scopedSlots={default:a[0]},a.length=0);c===mi?a=Wn(a):c===hi&&(a=Vn(a));var u,l;if("string"==typeof t){var f;l=e.$vnode&&e.$vnode.ns||me.getTagNamespace(t),u=r&&r.pre||!i(f=Me(e.$options,"components",t))?new W(t,r,a,void 0,void 0,e):Di(f,r,e,a,t)}else u=Di(t,r,e,a);return Array.isArray(u)?u:i(u)?(i(l)&&function e(t,r,a){t.ns=r;"foreignObject"===t.tag&&(r=void 0,a=!0);if(i(t.children))for(var s=0,c=t.children.length;s"}(e,r),u="";if(r.isUnaryTag(e.tag))a(c,s);else if(n(e.children)||0===e.children.length)a(c+u,s);else{var l=e.children;r.renderStates.push({type:"Element",children:l,rendered:0,total:l.length,endTag:u}),a(c,s)}}(e,t,r):o(e.isComment)?i(e.asyncFactory)?function(e,t,r){var n=e.asyncFactory,i=function(n){n.__esModule&&n.default&&(n=n.default);var i=e.asyncMeta,o=i.data,a=i.children,s=i.tag,c=e.asyncMeta.context,u=Di(n,o,c,a,s);u?u.componentOptions?Zi(u,t,r):Array.isArray(u)?(r.renderStates.push({type:"Fragment",children:u,rendered:0,total:u.length}),r.next()):Vi(u,t,r):r.write("\x3c!----\x3e",r.next)};if(n.resolved)return void i(n.resolved);var o,a=r.done;try{o=n(i,a)}catch(e){a(e)}if(o)if("function"==typeof o.then)o.then(i,a).catch(a);else{var s=o.component;s&&"function"==typeof s.then&&s.then(i,a).catch(a)}}(e,t,r):r.write("\x3c!--"+e.text+"--\x3e",r.next):r.write(e.raw?e.text:R(String(e.text)),r.next)}function Wi(e,t){var r=e._ssrRegister;return t.caching&&i(r)&&t.componentBuffer[t.componentBuffer.length-1].add(r),r}function Zi(e,t,r){var o=r.write,a=r.next,s=r.userContext,c=e.componentOptions.Ctor,u=c.options.serverCacheKey,l=c.options.name,f=r.cache,p=Wi(c.options,o);if(i(u)&&i(f)&&i(l)){var d=u(e.componentOptions.propsData);if(!1===d)return void Gi(e,t,r);var v=l+"::"+d,h=r.has,m=r.get;i(h)?h(v,function(n){!0===n&&i(m)?m(v,function(e){i(p)&&p(s),e.components.forEach(function(e){return e(s)}),o(e.html,a)}):Xi(e,t,v,r)}):i(m)&&m(v,function(n){i(n)?(i(p)&&p(s),n.components.forEach(function(e){return e(s)}),o(n.html,a)):Xi(e,t,v,r)})}else i(u)&&n(f)&&qi("[vue-server-renderer] Component "+(c.options.name||"(anonymous)")+" implemented serverCacheKey, but no cache was provided to the renderer."),i(u)&&n(l)&&qi('[vue-server-renderer] Components that implement "serverCacheKey" must also define a unique "name" option.'),Gi(e,t,r)}function Xi(e,t,r,n){var i=n.write;i.caching=!0;var o=i.cacheBuffer,a=o.push("")-1,s=i.componentBuffer;s.push(new Set),n.renderStates.push({type:"ComponentWithCache",key:r,buffer:o,bufferIndex:a,componentBuffer:s}),Gi(e,t,n)}function Gi(e,t,r){var n=r.activeInstance;e.ssrContext=r.userContext;var i=r.activeInstance=Ui(e,r.activeInstance);Hi(i);var o=r.done;Ki(i,function(){var o=i._render();o.parent=e,r.renderStates.push({type:"Component",prevActive:n}),Vi(o,t,r)},o)}function Qi(e,t,r,n){return function(i,o,a,s){Bi=Object.create(null);var c=new yt({activeInstance:i,userContext:a,write:o,done:s,renderNode:Vi,isUnaryTag:r,modules:e,directives:t,cache:n});!function(e){if(!e._ssrNode){for(var t=e.constructor;t.super;)t=t.super;$(t.prototype,Xn),t.FunctionalRenderContext&&$(t.FunctionalRenderContext.prototype,Xn)}}(i),Hi(i);Ki(i,function(){Vi(i._render(),!0,c)},s)}}var Yi=function(e){return/\.js(\?[^.]+)?$/.test(e)};function eo(){var e,t;return{promise:new Promise(function(r,n){e=r,t=n}),cb:function(r,n){if(r)return t(r);e(n||"")}}}var to=function(e){function t(t,r,n){e.call(this),this.started=!1,this.renderer=t,this.template=r,this.context=n||{},this.inject=t.inject}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype._transform=function(e,t,r){this.started||(this.emit("beforeStart"),this.start()),this.push(e),r()},t.prototype.start=function(){if(this.started=!0,this.push(this.template.head(this.context)),this.inject){this.context.head&&this.push(this.context.head);var e=this.renderer.renderResourceHints(this.context);e&&this.push(e);var t=this.renderer.renderStyles(this.context);t&&this.push(t)}this.push(this.template.neck(this.context))},t.prototype._flush=function(e){if(this.emit("beforeEnd"),this.inject){var t=this.renderer.renderState(this.context);t&&this.push(t);var r=this.renderer.renderScripts(this.context);r&&this.push(r)}this.push(this.template.tail(this.context)),e()},t}(require("stream").Transform),ro=require("lodash.template"),no={escape:/{{([^{][\s\S]+?[^}])}}/g,interpolate:/{{{([\s\S]+?)}}}/g};function io(e){var t=function(e){var t=new Map;return Object.keys(e.modules).forEach(function(r){t.set(r,function(e,t){var r=[],n=t.modules[e];return n&&n.forEach(function(e){var n=t.all[e];(t.async.indexOf(n)>-1||!/\.js($|\?)/.test(n))&&r.push(n)}),r}(r,e))}),t}(e);return function(e){for(var r=new Set,n=0;n"),n=e.indexOf(t);if(n<0)throw new Error("Content placeholder not found in template.");return r<0&&(r=e.indexOf(""))<0&&(r=n),{head:ro(e.slice(0,r),no),neck:ro(e.slice(r,n),no),tail:ro(e.slice(n+t.length),no)}}(t):t:null,this.serialize=e.serializer||function(e){return ao(e,{isJSON:!0})},e.clientManifest){var r=this.clientManifest=e.clientManifest;this.publicPath=""===r.publicPath?"":r.publicPath.replace(/([^\/])$/,"$1/"),this.preloadFiles=(r.initial||[]).map(co),this.prefetchFiles=(r.async||[]).map(co),this.mapFiles=io(r)}};function co(e){var t=e.replace(/\?.*/,""),r=oo.extname(t).slice(1);return{file:e,extension:r,fileWithoutQuery:t,asType:uo(r)}}function uo(e){return"js"===e?"script":"css"===e?"style":/jpe?g|png|svg|gif|webp|ico/.test(e)?"image":/woff2?|ttf|otf|eot/.test(e)?"font":""}so.prototype.bindRenderFns=function(e){var t=this;["ResourceHints","State","Scripts","Styles"].forEach(function(r){e["render"+r]=t["render"+r].bind(t,e)}),e.getPreloadFiles=t.getPreloadFiles.bind(t,e)},so.prototype.render=function(e,t){var r=this.parsedTemplate;if(!r)throw new Error("render cannot be called without a template.");return t=t||{},"function"==typeof r?r(e,t):this.inject?r.head(t)+(t.head||"")+this.renderResourceHints(t)+this.renderStyles(t)+r.neck(t)+e+this.renderState(t)+this.renderScripts(t)+r.tail(t):r.head(t)+r.neck(t)+e+r.tail(t)},so.prototype.renderStyles=function(e){var t=this,r=this.preloadFiles||[],n=this.getUsedAsyncFiles(e)||[],i=r.concat(n).filter(function(e){return function(e){return/\.css(\?[^.]+)?$/.test(e)}(e.file)});return(i.length?i.map(function(e){var r=e.file;return''}).join(""):"")+(e.styles||"")},so.prototype.renderResourceHints=function(e){return this.renderPreloadLinks(e)+this.renderPrefetchLinks(e)},so.prototype.getPreloadFiles=function(e){var t=this.getUsedAsyncFiles(e);return this.preloadFiles||t?(this.preloadFiles||[]).concat(t||[]):[]},so.prototype.renderPreloadLinks=function(e){var t=this,r=this.getPreloadFiles(e),n=this.options.shouldPreload;return r.length?r.map(function(e){var r=e.file,i=e.extension,o=e.fileWithoutQuery,a=e.asType,s="";return n||"script"===a||"style"===a?n&&!n(o,a)?"":("font"===a&&(s=' type="font/'+i+'" crossorigin'),'"):""}).join(""):""},so.prototype.renderPrefetchLinks=function(e){var t=this,r=this.options.shouldPrefetch;if(this.prefetchFiles){var n=this.getUsedAsyncFiles(e);return this.prefetchFiles.map(function(e){var i=e.file,o=e.fileWithoutQuery,a=e.asType;return r&&!r(o,a)?"":function(e){return n&&n.some(function(t){return t.file===e})}(i)?"":''}).join("")}return""},so.prototype.renderState=function(e,t){var r=t||{},n=r.contextKey;void 0===n&&(n="state");var i=r.windowKey;void 0===i&&(i="__INITIAL_STATE__");var o=this.serialize(e[n]),a=e.nonce?' nonce="'+e.nonce+'"':"";return e[n]?"window."+i+"="+o+";(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());<\/script>":""},so.prototype.renderScripts=function(e){var t=this;if(this.clientManifest){var r=this.preloadFiles.filter(function(e){var t=e.file;return Yi(t)}),n=(this.getUsedAsyncFiles(e)||[]).filter(function(e){var t=e.file;return Yi(t)});return[r[0]].concat(n,r.slice(1)).map(function(e){var r=e.file;return'