You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11965 lines
334 KiB
11965 lines
334 KiB
/*!
|
|
* Vue.js v2.6.12
|
|
* (c) 2014-2020 Evan You
|
|
* Released under the MIT License.
|
|
*/
|
|
(function (global, factory) {
|
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
(global = global || self, global.Vue = factory());
|
|
}(this, function () { 'use strict';
|
|
|
|
/* */
|
|
|
|
var emptyObject = Object.freeze({});
|
|
|
|
// These helpers produce better VM code in JS engines due to their
|
|
// explicitness and function inlining.
|
|
function isUndef (v) {
|
|
return v === undefined || v === null
|
|
}
|
|
|
|
function isDef (v) {
|
|
return v !== undefined && v !== null
|
|
}
|
|
|
|
function isTrue (v) {
|
|
return v === true
|
|
}
|
|
|
|
function isFalse (v) {
|
|
return v === false
|
|
}
|
|
|
|
/**
|
|
* Check if value is primitive.
|
|
*/
|
|
function isPrimitive (value) {
|
|
return (
|
|
typeof value === 'string' ||
|
|
typeof value === 'number' ||
|
|
// $flow-disable-line
|
|
typeof value === 'symbol' ||
|
|
typeof value === 'boolean'
|
|
)
|
|
}
|
|
|
|
/**
|
|
* Quick object check - this is primarily used to tell
|
|
* Objects from primitive values when we know the value
|
|
* is a JSON-compliant type.
|
|
*/
|
|
function isObject (obj) {
|
|
return obj !== null && typeof obj === 'object'
|
|
}
|
|
|
|
/**
|
|
* Get the raw type string of a value, e.g., [object Object].
|
|
*/
|
|
var _toString = Object.prototype.toString;
|
|
|
|
function toRawType (value) {
|
|
return _toString.call(value).slice(8, -1)
|
|
}
|
|
|
|
/**
|
|
* Strict object type check. Only returns true
|
|
* for plain JavaScript objects.
|
|
*/
|
|
function isPlainObject (obj) {
|
|
return _toString.call(obj) === '[object Object]'
|
|
}
|
|
|
|
function isRegExp (v) {
|
|
return _toString.call(v) === '[object RegExp]'
|
|
}
|
|
|
|
/**
|
|
* Check if val is a valid array index.
|
|
*/
|
|
function isValidArrayIndex (val) {
|
|
var n = parseFloat(String(val));
|
|
return n >= 0 && Math.floor(n) === n && isFinite(val)
|
|
}
|
|
|
|
function isPromise (val) {
|
|
return (
|
|
isDef(val) &&
|
|
typeof val.then === 'function' &&
|
|
typeof val.catch === 'function'
|
|
)
|
|
}
|
|
|
|
/**
|
|
* Convert a value to a string that is actually rendered.
|
|
*/
|
|
function toString (val) {
|
|
return val == null
|
|
? ''
|
|
: Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
|
|
? JSON.stringify(val, null, 2)
|
|
: String(val)
|
|
}
|
|
|
|
/**
|
|
* Convert an input value to a number for persistence.
|
|
* If the conversion fails, return original string.
|
|
*/
|
|
function toNumber (val) {
|
|
var n = parseFloat(val);
|
|
return isNaN(n) ? val : n
|
|
}
|
|
|
|
/**
|
|
* Make a map and return a function for checking if a key
|
|
* is in that map.
|
|
*/
|
|
function makeMap (
|
|
str,
|
|
expectsLowerCase
|
|
) {
|
|
var map = Object.create(null);
|
|
var list = str.split(',');
|
|
for (var i = 0; i < list.length; i++) {
|
|
map[list[i]] = true;
|
|
}
|
|
return expectsLowerCase
|
|
? function (val) { return map[val.toLowerCase()]; }
|
|
: function (val) { return map[val]; }
|
|
}
|
|
|
|
/**
|
|
* Check if a tag is a built-in tag.
|
|
*/
|
|
var isBuiltInTag = makeMap('slot,component', true);
|
|
|
|
/**
|
|
* Check if an attribute is a reserved attribute.
|
|
*/
|
|
var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
|
|
|
|
/**
|
|
* Remove an item from an array.
|
|
*/
|
|
function remove (arr, item) {
|
|
if (arr.length) {
|
|
var index = arr.indexOf(item);
|
|
if (index > -1) {
|
|
return arr.splice(index, 1)
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Check whether an object has the property.
|
|
*/
|
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
function hasOwn (obj, key) {
|
|
return hasOwnProperty.call(obj, key)
|
|
}
|
|
|
|
/**
|
|
* Create a cached version of a pure function.
|
|
*/
|
|
function cached (fn) {
|
|
var cache = Object.create(null);
|
|
return (function cachedFn (str) {
|
|
var hit = cache[str];
|
|
return hit || (cache[str] = fn(str))
|
|
})
|
|
}
|
|
|
|
/**
|
|
* Camelize a hyphen-delimited string.
|
|
*/
|
|
var camelizeRE = /-(\w)/g;
|
|
var camelize = cached(function (str) {
|
|
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
|
|
});
|
|
|
|
/**
|
|
* Capitalize a string.
|
|
*/
|
|
var capitalize = cached(function (str) {
|
|
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
});
|
|
|
|
/**
|
|
* Hyphenate a camelCase string.
|
|
*/
|
|
var hyphenateRE = /\B([A-Z])/g;
|
|
var hyphenate = cached(function (str) {
|
|
return str.replace(hyphenateRE, '-$1').toLowerCase()
|
|
});
|
|
|
|
/**
|
|
* Simple bind polyfill for environments that do not support it,
|
|
* e.g., PhantomJS 1.x. Technically, we don't need this anymore
|
|
* since native bind is now performant enough in most browsers.
|
|
* But removing it would mean breaking code that was able to run in
|
|
* PhantomJS 1.x, so this must be kept for backward compatibility.
|
|
*/
|
|
|
|
/* istanbul ignore next */
|
|
function polyfillBind (fn, ctx) {
|
|
function boundFn (a) {
|
|
var l = arguments.length;
|
|
return l
|
|
? l > 1
|
|
? fn.apply(ctx, arguments)
|
|
: fn.call(ctx, a)
|
|
: fn.call(ctx)
|
|
}
|
|
|
|
boundFn._length = fn.length;
|
|
return boundFn
|
|
}
|
|
|
|
function nativeBind (fn, ctx) {
|
|
return fn.bind(ctx)
|
|
}
|
|
|
|
var bind = Function.prototype.bind
|
|
? nativeBind
|
|
: polyfillBind;
|
|
|
|
/**
|
|
* Convert an Array-like object to a real Array.
|
|
*/
|
|
function toArray (list, start) {
|
|
start = start || 0;
|
|
var i = list.length - start;
|
|
var ret = new Array(i);
|
|
while (i--) {
|
|
ret[i] = list[i + start];
|
|
}
|
|
return ret
|
|
}
|
|
|
|
/**
|
|
* Mix properties into target object.
|
|
*/
|
|
function extend (to, _from) {
|
|
for (var key in _from) {
|
|
to[key] = _from[key];
|
|
}
|
|
return to
|
|
}
|
|
|
|
/**
|
|
* Merge an Array of Objects into a single Object.
|
|
*/
|
|
function toObject (arr) {
|
|
var res = {};
|
|
for (var i = 0; i < arr.length; i++) {
|
|
if (arr[i]) {
|
|
extend(res, arr[i]);
|
|
}
|
|
}
|
|
return res
|
|
}
|
|
|
|
/* eslint-disable no-unused-vars */
|
|
|
|
/**
|
|
* Perform no operation.
|
|
* Stubbing args to make Flow happy without leaving useless transpiled code
|
|
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
|
|
*/
|
|
function noop (a, b, c) {}
|
|
|
|
/**
|
|
* Always return false.
|
|
*/
|
|
var no = function (a, b, c) { return false; };
|
|
|
|
/* eslint-enable no-unused-vars */
|
|
|
|
/**
|
|
* Return the same value.
|
|
*/
|
|
var identity = function (_) { return _; };
|
|
|
|
/**
|
|
* Generate a string containing static keys from compiler modules.
|
|
*/
|
|
function genStaticKeys (modules) {
|
|
return modules.reduce(function (keys, m) {
|
|
return keys.concat(m.staticKeys || [])
|
|
}, []).join(',')
|
|
}
|
|
|
|
/**
|
|
* Check if two values are loosely equal - that is,
|
|
* if they are plain objects, do they have the same shape?
|
|
*/
|
|
function looseEqual (a, b) {
|
|
if (a === b) { return true }
|
|
var isObjectA = isObject(a);
|
|
var isObjectB = isObject(b);
|
|
if (isObjectA && isObjectB) {
|
|
try {
|
|
var isArrayA = Array.isArray(a);
|
|
var isArrayB = Array.isArray(b);
|
|
if (isArrayA && isArrayB) {
|
|
return a.length === b.length && a.every(function (e, i) {
|
|
return looseEqual(e, b[i])
|
|
})
|
|
} else if (a instanceof Date && b instanceof Date) {
|
|
return a.getTime() === b.getTime()
|
|
} else if (!isArrayA && !isArrayB) {
|
|
var keysA = Object.keys(a);
|
|
var keysB = Object.keys(b);
|
|
return keysA.length === keysB.length && keysA.every(function (key) {
|
|
return looseEqual(a[key], b[key])
|
|
})
|
|
} else {
|
|
/* istanbul ignore next */
|
|
return false
|
|
}
|
|
} catch (e) {
|
|
/* istanbul ignore next */
|
|
return false
|
|
}
|
|
} else if (!isObjectA && !isObjectB) {
|
|
return String(a) === String(b)
|
|
} else {
|
|
return false
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Return the first index at which a loosely equal value can be
|
|
* found in the array (if value is a plain object, the array must
|
|
* contain an object of the same shape), or -1 if it is not present.
|
|
*/
|
|
function looseIndexOf (arr, val) {
|
|
for (var i = 0; i < arr.length; i++) {
|
|
if (looseEqual(arr[i], val)) { return i }
|
|
}
|
|
return -1
|
|
}
|
|
|
|
/**
|
|
* Ensure a function is called only once.
|
|
*/
|
|
function once (fn) {
|
|
var called = false;
|
|
return function () {
|
|
if (!called) {
|
|
called = true;
|
|
fn.apply(this, arguments);
|
|
}
|
|
}
|
|
}
|
|
|
|
var SSR_ATTR = 'data-server-rendered';
|
|
|
|
var ASSET_TYPES = [
|
|
'component',
|
|
'directive',
|
|
'filter'
|
|
];
|
|
|
|
var LIFECYCLE_HOOKS = [
|
|
'beforeCreate',
|
|
'created',
|
|
'beforeMount',
|
|
'mounted',
|
|
'beforeUpdate',
|
|
'updated',
|
|
'beforeDestroy',
|
|
'destroyed',
|
|
'activated',
|
|
'deactivated',
|
|
'errorCaptured',
|
|
'serverPrefetch'
|
|
];
|
|
|
|
/* */
|
|
|
|
|
|
|
|
var config = ({
|
|
/**
|
|
* Option merge strategies (used in core/util/options)
|
|
*/
|
|
// $flow-disable-line
|
|
optionMergeStrategies: Object.create(null),
|
|
|
|
/**
|
|
* Whether to suppress warnings.
|
|
*/
|
|
silent: false,
|
|
|
|
/**
|
|
* Show production mode tip message on boot?
|
|
*/
|
|
productionTip: "development" !== 'production',
|
|
|
|
/**
|
|
* Whether to enable devtools
|
|
*/
|
|
devtools: "development" !== 'production',
|
|
|
|
/**
|
|
* Whether to record perf
|
|
*/
|
|
performance: false,
|
|
|
|
/**
|
|
* Error handler for watcher errors
|
|
*/
|
|
errorHandler: null,
|
|
|
|
/**
|
|
* Warn handler for watcher warns
|
|
*/
|
|
warnHandler: null,
|
|
|
|
/**
|
|
* Ignore certain custom elements
|
|
*/
|
|
ignoredElements: [],
|
|
|
|
/**
|
|
* Custom user key aliases for v-on
|
|
*/
|
|
// $flow-disable-line
|
|
keyCodes: Object.create(null),
|
|
|
|
/**
|
|
* Check if a tag is reserved so that it cannot be registered as a
|
|
* component. This is platform-dependent and may be overwritten.
|
|
*/
|
|
isReservedTag: no,
|
|
|
|
/**
|
|
* Check if an attribute is reserved so that it cannot be used as a component
|
|
* prop. This is platform-dependent and may be overwritten.
|
|
*/
|
|
isReservedAttr: no,
|
|
|
|
/**
|
|
* Check if a tag is an unknown element.
|
|
* Platform-dependent.
|
|
*/
|
|
isUnknownElement: no,
|
|
|
|
/**
|
|
* Get the namespace of an element
|
|
*/
|
|
getTagNamespace: noop,
|
|
|
|
/**
|
|
* Parse the real tag name for the specific platform.
|
|
*/
|
|
parsePlatformTagName: identity,
|
|
|
|
/**
|
|
* Check if an attribute must be bound using property, e.g. value
|
|
* Platform-dependent.
|
|
*/
|
|
mustUseProp: no,
|
|
|
|
/**
|
|
* Perform updates asynchronously. Intended to be used by Vue Test Utils
|
|
* This will significantly reduce performance if set to false.
|
|
*/
|
|
async: true,
|
|
|
|
/**
|
|
* Exposed for legacy reasons
|
|
*/
|
|
_lifecycleHooks: LIFECYCLE_HOOKS
|
|
});
|
|
|
|
/* */
|
|
|
|
/**
|
|
* unicode letters used for parsing html tags, component names and property paths.
|
|
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
|
|
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS
|
|
*/
|
|
var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
|
|
|
|
/**
|
|
* Check if a string starts with $ or _
|
|
*/
|
|
function isReserved (str) {
|
|
var c = (str + '').charCodeAt(0);
|
|
return c === 0x24 || c === 0x5F
|
|
}
|
|
|
|
/**
|
|
* Define a property.
|
|
*/
|
|
function def (obj, key, val, enumerable) {
|
|
Object.defineProperty(obj, key, {
|
|
value: val,
|
|
enumerable: !!enumerable,
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Parse simple path.
|
|
*/
|
|
var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
|
|
function parsePath (path) {
|
|
if (bailRE.test(path)) {
|
|
return
|
|
}
|
|
var segments = path.split('.');
|
|
return function (obj) {
|
|
for (var i = 0; i < segments.length; i++) {
|
|
if (!obj) { return }
|
|
obj = obj[segments[i]];
|
|
}
|
|
return obj
|
|
}
|
|
}
|
|
|
|
/* */
|
|
|
|
// can we use __proto__?
|
|
var hasProto = '__proto__' in {};
|
|
|
|
// Browser environment sniffing
|
|
var inBrowser = typeof window !== 'undefined';
|
|
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
|
|
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
|
|
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
|
var isIE = UA && /msie|trident/.test(UA);
|
|
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
|
var isEdge = UA && UA.indexOf('edge/') > 0;
|
|
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;
|
|
|
|
var supportsPassive = false;
|
|
if (inBrowser) {
|
|
try {
|
|
var opts = {};
|
|
Object.defineProperty(opts, 'passive', ({
|
|
get: function get () {
|
|
/* istanbul ignore next */
|
|
supportsPassive = true;
|
|
}
|
|
})); // https://github.com/facebook/flow/issues/285
|
|
window.addEventListener('test-passive', null, opts);
|
|
} catch (e) {}
|
|
}
|
|
|
|
// this needs to be lazy-evaled because vue may be required before
|
|
// vue-server-renderer can set VUE_ENV
|
|
var _isServer;
|
|
var isServerRendering = function () {
|
|
if (_isServer === undefined) {
|
|
/* istanbul ignore if */
|
|
if (!inBrowser && !inWeex && typeof global !== 'undefined') {
|
|
// detect presence of vue-server-renderer and avoid
|
|
// Webpack shimming the process
|
|
_isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
|
|
} else {
|
|
_isServer = false;
|
|
}
|
|
}
|
|
return _isServer
|
|
};
|
|
|
|
// detect devtools
|
|
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
|
|
/* istanbul ignore next */
|
|
function isNative (Ctor) {
|
|
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
|
|
}
|
|
|
|
var hasSymbol =
|
|
typeof Symbol !== 'undefined' && isNative(Symbol) && |