@luzhaoqi/test 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib-cjs.js +23 -3167
- package/package.json +1 -1
package/dist/lib-cjs.js
CHANGED
@@ -12,6 +12,7 @@ var require$$1 = require('util');
|
|
12
12
|
var require$$0$1 = require('os');
|
13
13
|
var require$$8 = require('zlib');
|
14
14
|
var require$$0$4 = require('vue');
|
15
|
+
var VueRouter = require('vue-router');
|
15
16
|
|
16
17
|
/*! js-cookie v3.0.1 | MIT */
|
17
18
|
/* eslint-disable no-var */
|
@@ -17854,7 +17855,7 @@ function isString(val) {
|
|
17854
17855
|
* @param {Object} val The value to test
|
17855
17856
|
* @returns {boolean} True if value is a Number, otherwise false
|
17856
17857
|
*/
|
17857
|
-
function isNumber
|
17858
|
+
function isNumber(val) {
|
17858
17859
|
return typeof val === 'number';
|
17859
17860
|
}
|
17860
17861
|
|
@@ -18064,7 +18065,7 @@ function merge$1(/* obj1, obj2, obj3, ... */) {
|
|
18064
18065
|
* @param {Object} thisArg The object to bind function to
|
18065
18066
|
* @return {Object} The resulting value of object a
|
18066
18067
|
*/
|
18067
|
-
function extend
|
18068
|
+
function extend(a, b, thisArg) {
|
18068
18069
|
forEach(b, function assignValue(val, key) {
|
18069
18070
|
if (thisArg && typeof val === 'function') {
|
18070
18071
|
a[key] = bind$1(val, thisArg);
|
@@ -18095,7 +18096,7 @@ var utils$8 = {
|
|
18095
18096
|
isFormData: isFormData,
|
18096
18097
|
isArrayBufferView: isArrayBufferView,
|
18097
18098
|
isString: isString,
|
18098
|
-
isNumber: isNumber
|
18099
|
+
isNumber: isNumber,
|
18099
18100
|
isObject: isObject$4,
|
18100
18101
|
isPlainObject: isPlainObject,
|
18101
18102
|
isUndefined: isUndefined,
|
@@ -18108,14 +18109,14 @@ var utils$8 = {
|
|
18108
18109
|
isStandardBrowserEnv: isStandardBrowserEnv,
|
18109
18110
|
forEach: forEach,
|
18110
18111
|
merge: merge$1,
|
18111
|
-
extend: extend
|
18112
|
+
extend: extend,
|
18112
18113
|
trim: trim,
|
18113
18114
|
stripBOM: stripBOM
|
18114
18115
|
};
|
18115
18116
|
|
18116
18117
|
var utils$7 = utils$8;
|
18117
18118
|
|
18118
|
-
function encode
|
18119
|
+
function encode(val) {
|
18119
18120
|
return encodeURIComponent(val).
|
18120
18121
|
replace(/%3A/gi, ':').
|
18121
18122
|
replace(/%24/g, '$').
|
@@ -18163,7 +18164,7 @@ var buildURL$1 = function buildURL(url, params, paramsSerializer) {
|
|
18163
18164
|
} else if (utils$7.isObject(v)) {
|
18164
18165
|
v = JSON.stringify(v);
|
18165
18166
|
}
|
18166
|
-
parts.push(encode
|
18167
|
+
parts.push(encode(key) + '=' + encode(v));
|
18167
18168
|
});
|
18168
18169
|
});
|
18169
18170
|
|
@@ -93893,3171 +93894,16 @@ function createAxios(Vue) {
|
|
93893
93894
|
}
|
93894
93895
|
}
|
93895
93896
|
|
93896
|
-
function install$
|
93897
|
+
function install$2(Vue, option = {}) {
|
93897
93898
|
setGolbalData(Vue, option);
|
93898
93899
|
const $http = createAxios(Vue);
|
93899
93900
|
Vue.prototype.$z.$http = $http;
|
93900
93901
|
}
|
93901
93902
|
|
93902
93903
|
var RequestZ = {
|
93903
|
-
install: install$
|
93904
|
+
install: install$2
|
93904
93905
|
};
|
93905
93906
|
|
93906
|
-
/*!
|
93907
|
-
* vue-router v3.6.5
|
93908
|
-
* (c) 2022 Evan You
|
93909
|
-
* @license MIT
|
93910
|
-
*/
|
93911
|
-
/* */
|
93912
|
-
|
93913
|
-
function assert (condition, message) {
|
93914
|
-
if (!condition) {
|
93915
|
-
throw new Error(("[vue-router] " + message))
|
93916
|
-
}
|
93917
|
-
}
|
93918
|
-
|
93919
|
-
function warn (condition, message) {
|
93920
|
-
if (!condition) {
|
93921
|
-
typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
|
93922
|
-
}
|
93923
|
-
}
|
93924
|
-
|
93925
|
-
function extend (a, b) {
|
93926
|
-
for (var key in b) {
|
93927
|
-
a[key] = b[key];
|
93928
|
-
}
|
93929
|
-
return a
|
93930
|
-
}
|
93931
|
-
|
93932
|
-
/* */
|
93933
|
-
|
93934
|
-
var encodeReserveRE = /[!'()*]/g;
|
93935
|
-
var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
|
93936
|
-
var commaRE = /%2C/g;
|
93937
|
-
|
93938
|
-
// fixed encodeURIComponent which is more conformant to RFC3986:
|
93939
|
-
// - escapes [!'()*]
|
93940
|
-
// - preserve commas
|
93941
|
-
var encode = function (str) { return encodeURIComponent(str)
|
93942
|
-
.replace(encodeReserveRE, encodeReserveReplacer)
|
93943
|
-
.replace(commaRE, ','); };
|
93944
|
-
|
93945
|
-
function decode (str) {
|
93946
|
-
try {
|
93947
|
-
return decodeURIComponent(str)
|
93948
|
-
} catch (err) {
|
93949
|
-
{
|
93950
|
-
warn(false, ("Error decoding \"" + str + "\". Leaving it intact."));
|
93951
|
-
}
|
93952
|
-
}
|
93953
|
-
return str
|
93954
|
-
}
|
93955
|
-
|
93956
|
-
function resolveQuery (
|
93957
|
-
query,
|
93958
|
-
extraQuery,
|
93959
|
-
_parseQuery
|
93960
|
-
) {
|
93961
|
-
if ( extraQuery === void 0 ) extraQuery = {};
|
93962
|
-
|
93963
|
-
var parse = _parseQuery || parseQuery;
|
93964
|
-
var parsedQuery;
|
93965
|
-
try {
|
93966
|
-
parsedQuery = parse(query || '');
|
93967
|
-
} catch (e) {
|
93968
|
-
warn(false, e.message);
|
93969
|
-
parsedQuery = {};
|
93970
|
-
}
|
93971
|
-
for (var key in extraQuery) {
|
93972
|
-
var value = extraQuery[key];
|
93973
|
-
parsedQuery[key] = Array.isArray(value)
|
93974
|
-
? value.map(castQueryParamValue)
|
93975
|
-
: castQueryParamValue(value);
|
93976
|
-
}
|
93977
|
-
return parsedQuery
|
93978
|
-
}
|
93979
|
-
|
93980
|
-
var castQueryParamValue = function (value) { return (value == null || typeof value === 'object' ? value : String(value)); };
|
93981
|
-
|
93982
|
-
function parseQuery (query) {
|
93983
|
-
var res = {};
|
93984
|
-
|
93985
|
-
query = query.trim().replace(/^(\?|#|&)/, '');
|
93986
|
-
|
93987
|
-
if (!query) {
|
93988
|
-
return res
|
93989
|
-
}
|
93990
|
-
|
93991
|
-
query.split('&').forEach(function (param) {
|
93992
|
-
var parts = param.replace(/\+/g, ' ').split('=');
|
93993
|
-
var key = decode(parts.shift());
|
93994
|
-
var val = parts.length > 0 ? decode(parts.join('=')) : null;
|
93995
|
-
|
93996
|
-
if (res[key] === undefined) {
|
93997
|
-
res[key] = val;
|
93998
|
-
} else if (Array.isArray(res[key])) {
|
93999
|
-
res[key].push(val);
|
94000
|
-
} else {
|
94001
|
-
res[key] = [res[key], val];
|
94002
|
-
}
|
94003
|
-
});
|
94004
|
-
|
94005
|
-
return res
|
94006
|
-
}
|
94007
|
-
|
94008
|
-
function stringifyQuery (obj) {
|
94009
|
-
var res = obj
|
94010
|
-
? Object.keys(obj)
|
94011
|
-
.map(function (key) {
|
94012
|
-
var val = obj[key];
|
94013
|
-
|
94014
|
-
if (val === undefined) {
|
94015
|
-
return ''
|
94016
|
-
}
|
94017
|
-
|
94018
|
-
if (val === null) {
|
94019
|
-
return encode(key)
|
94020
|
-
}
|
94021
|
-
|
94022
|
-
if (Array.isArray(val)) {
|
94023
|
-
var result = [];
|
94024
|
-
val.forEach(function (val2) {
|
94025
|
-
if (val2 === undefined) {
|
94026
|
-
return
|
94027
|
-
}
|
94028
|
-
if (val2 === null) {
|
94029
|
-
result.push(encode(key));
|
94030
|
-
} else {
|
94031
|
-
result.push(encode(key) + '=' + encode(val2));
|
94032
|
-
}
|
94033
|
-
});
|
94034
|
-
return result.join('&')
|
94035
|
-
}
|
94036
|
-
|
94037
|
-
return encode(key) + '=' + encode(val)
|
94038
|
-
})
|
94039
|
-
.filter(function (x) { return x.length > 0; })
|
94040
|
-
.join('&')
|
94041
|
-
: null;
|
94042
|
-
return res ? ("?" + res) : ''
|
94043
|
-
}
|
94044
|
-
|
94045
|
-
/* */
|
94046
|
-
|
94047
|
-
var trailingSlashRE = /\/?$/;
|
94048
|
-
|
94049
|
-
function createRoute (
|
94050
|
-
record,
|
94051
|
-
location,
|
94052
|
-
redirectedFrom,
|
94053
|
-
router
|
94054
|
-
) {
|
94055
|
-
var stringifyQuery = router && router.options.stringifyQuery;
|
94056
|
-
|
94057
|
-
var query = location.query || {};
|
94058
|
-
try {
|
94059
|
-
query = clone(query);
|
94060
|
-
} catch (e) {}
|
94061
|
-
|
94062
|
-
var route = {
|
94063
|
-
name: location.name || (record && record.name),
|
94064
|
-
meta: (record && record.meta) || {},
|
94065
|
-
path: location.path || '/',
|
94066
|
-
hash: location.hash || '',
|
94067
|
-
query: query,
|
94068
|
-
params: location.params || {},
|
94069
|
-
fullPath: getFullPath(location, stringifyQuery),
|
94070
|
-
matched: record ? formatMatch(record) : []
|
94071
|
-
};
|
94072
|
-
if (redirectedFrom) {
|
94073
|
-
route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
|
94074
|
-
}
|
94075
|
-
return Object.freeze(route)
|
94076
|
-
}
|
94077
|
-
|
94078
|
-
function clone (value) {
|
94079
|
-
if (Array.isArray(value)) {
|
94080
|
-
return value.map(clone)
|
94081
|
-
} else if (value && typeof value === 'object') {
|
94082
|
-
var res = {};
|
94083
|
-
for (var key in value) {
|
94084
|
-
res[key] = clone(value[key]);
|
94085
|
-
}
|
94086
|
-
return res
|
94087
|
-
} else {
|
94088
|
-
return value
|
94089
|
-
}
|
94090
|
-
}
|
94091
|
-
|
94092
|
-
// the starting route that represents the initial state
|
94093
|
-
var START = createRoute(null, {
|
94094
|
-
path: '/'
|
94095
|
-
});
|
94096
|
-
|
94097
|
-
function formatMatch (record) {
|
94098
|
-
var res = [];
|
94099
|
-
while (record) {
|
94100
|
-
res.unshift(record);
|
94101
|
-
record = record.parent;
|
94102
|
-
}
|
94103
|
-
return res
|
94104
|
-
}
|
94105
|
-
|
94106
|
-
function getFullPath (
|
94107
|
-
ref,
|
94108
|
-
_stringifyQuery
|
94109
|
-
) {
|
94110
|
-
var path = ref.path;
|
94111
|
-
var query = ref.query; if ( query === void 0 ) query = {};
|
94112
|
-
var hash = ref.hash; if ( hash === void 0 ) hash = '';
|
94113
|
-
|
94114
|
-
var stringify = _stringifyQuery || stringifyQuery;
|
94115
|
-
return (path || '/') + stringify(query) + hash
|
94116
|
-
}
|
94117
|
-
|
94118
|
-
function isSameRoute (a, b, onlyPath) {
|
94119
|
-
if (b === START) {
|
94120
|
-
return a === b
|
94121
|
-
} else if (!b) {
|
94122
|
-
return false
|
94123
|
-
} else if (a.path && b.path) {
|
94124
|
-
return a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') && (onlyPath ||
|
94125
|
-
a.hash === b.hash &&
|
94126
|
-
isObjectEqual(a.query, b.query))
|
94127
|
-
} else if (a.name && b.name) {
|
94128
|
-
return (
|
94129
|
-
a.name === b.name &&
|
94130
|
-
(onlyPath || (
|
94131
|
-
a.hash === b.hash &&
|
94132
|
-
isObjectEqual(a.query, b.query) &&
|
94133
|
-
isObjectEqual(a.params, b.params))
|
94134
|
-
)
|
94135
|
-
)
|
94136
|
-
} else {
|
94137
|
-
return false
|
94138
|
-
}
|
94139
|
-
}
|
94140
|
-
|
94141
|
-
function isObjectEqual (a, b) {
|
94142
|
-
if ( a === void 0 ) a = {};
|
94143
|
-
if ( b === void 0 ) b = {};
|
94144
|
-
|
94145
|
-
// handle null value #1566
|
94146
|
-
if (!a || !b) { return a === b }
|
94147
|
-
var aKeys = Object.keys(a).sort();
|
94148
|
-
var bKeys = Object.keys(b).sort();
|
94149
|
-
if (aKeys.length !== bKeys.length) {
|
94150
|
-
return false
|
94151
|
-
}
|
94152
|
-
return aKeys.every(function (key, i) {
|
94153
|
-
var aVal = a[key];
|
94154
|
-
var bKey = bKeys[i];
|
94155
|
-
if (bKey !== key) { return false }
|
94156
|
-
var bVal = b[key];
|
94157
|
-
// query values can be null and undefined
|
94158
|
-
if (aVal == null || bVal == null) { return aVal === bVal }
|
94159
|
-
// check nested equality
|
94160
|
-
if (typeof aVal === 'object' && typeof bVal === 'object') {
|
94161
|
-
return isObjectEqual(aVal, bVal)
|
94162
|
-
}
|
94163
|
-
return String(aVal) === String(bVal)
|
94164
|
-
})
|
94165
|
-
}
|
94166
|
-
|
94167
|
-
function isIncludedRoute (current, target) {
|
94168
|
-
return (
|
94169
|
-
current.path.replace(trailingSlashRE, '/').indexOf(
|
94170
|
-
target.path.replace(trailingSlashRE, '/')
|
94171
|
-
) === 0 &&
|
94172
|
-
(!target.hash || current.hash === target.hash) &&
|
94173
|
-
queryIncludes(current.query, target.query)
|
94174
|
-
)
|
94175
|
-
}
|
94176
|
-
|
94177
|
-
function queryIncludes (current, target) {
|
94178
|
-
for (var key in target) {
|
94179
|
-
if (!(key in current)) {
|
94180
|
-
return false
|
94181
|
-
}
|
94182
|
-
}
|
94183
|
-
return true
|
94184
|
-
}
|
94185
|
-
|
94186
|
-
function handleRouteEntered (route) {
|
94187
|
-
for (var i = 0; i < route.matched.length; i++) {
|
94188
|
-
var record = route.matched[i];
|
94189
|
-
for (var name in record.instances) {
|
94190
|
-
var instance = record.instances[name];
|
94191
|
-
var cbs = record.enteredCbs[name];
|
94192
|
-
if (!instance || !cbs) { continue }
|
94193
|
-
delete record.enteredCbs[name];
|
94194
|
-
for (var i$1 = 0; i$1 < cbs.length; i$1++) {
|
94195
|
-
if (!instance._isBeingDestroyed) { cbs[i$1](instance); }
|
94196
|
-
}
|
94197
|
-
}
|
94198
|
-
}
|
94199
|
-
}
|
94200
|
-
|
94201
|
-
var View = {
|
94202
|
-
name: 'RouterView',
|
94203
|
-
functional: true,
|
94204
|
-
props: {
|
94205
|
-
name: {
|
94206
|
-
type: String,
|
94207
|
-
default: 'default'
|
94208
|
-
}
|
94209
|
-
},
|
94210
|
-
render: function render (_, ref) {
|
94211
|
-
var props = ref.props;
|
94212
|
-
var children = ref.children;
|
94213
|
-
var parent = ref.parent;
|
94214
|
-
var data = ref.data;
|
94215
|
-
|
94216
|
-
// used by devtools to display a router-view badge
|
94217
|
-
data.routerView = true;
|
94218
|
-
|
94219
|
-
// directly use parent context's createElement() function
|
94220
|
-
// so that components rendered by router-view can resolve named slots
|
94221
|
-
var h = parent.$createElement;
|
94222
|
-
var name = props.name;
|
94223
|
-
var route = parent.$route;
|
94224
|
-
var cache = parent._routerViewCache || (parent._routerViewCache = {});
|
94225
|
-
|
94226
|
-
// determine current view depth, also check to see if the tree
|
94227
|
-
// has been toggled inactive but kept-alive.
|
94228
|
-
var depth = 0;
|
94229
|
-
var inactive = false;
|
94230
|
-
while (parent && parent._routerRoot !== parent) {
|
94231
|
-
var vnodeData = parent.$vnode ? parent.$vnode.data : {};
|
94232
|
-
if (vnodeData.routerView) {
|
94233
|
-
depth++;
|
94234
|
-
}
|
94235
|
-
if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
|
94236
|
-
inactive = true;
|
94237
|
-
}
|
94238
|
-
parent = parent.$parent;
|
94239
|
-
}
|
94240
|
-
data.routerViewDepth = depth;
|
94241
|
-
|
94242
|
-
// render previous view if the tree is inactive and kept-alive
|
94243
|
-
if (inactive) {
|
94244
|
-
var cachedData = cache[name];
|
94245
|
-
var cachedComponent = cachedData && cachedData.component;
|
94246
|
-
if (cachedComponent) {
|
94247
|
-
// #2301
|
94248
|
-
// pass props
|
94249
|
-
if (cachedData.configProps) {
|
94250
|
-
fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
|
94251
|
-
}
|
94252
|
-
return h(cachedComponent, data, children)
|
94253
|
-
} else {
|
94254
|
-
// render previous empty view
|
94255
|
-
return h()
|
94256
|
-
}
|
94257
|
-
}
|
94258
|
-
|
94259
|
-
var matched = route.matched[depth];
|
94260
|
-
var component = matched && matched.components[name];
|
94261
|
-
|
94262
|
-
// render empty node if no matched route or no config component
|
94263
|
-
if (!matched || !component) {
|
94264
|
-
cache[name] = null;
|
94265
|
-
return h()
|
94266
|
-
}
|
94267
|
-
|
94268
|
-
// cache component
|
94269
|
-
cache[name] = { component: component };
|
94270
|
-
|
94271
|
-
// attach instance registration hook
|
94272
|
-
// this will be called in the instance's injected lifecycle hooks
|
94273
|
-
data.registerRouteInstance = function (vm, val) {
|
94274
|
-
// val could be undefined for unregistration
|
94275
|
-
var current = matched.instances[name];
|
94276
|
-
if (
|
94277
|
-
(val && current !== vm) ||
|
94278
|
-
(!val && current === vm)
|
94279
|
-
) {
|
94280
|
-
matched.instances[name] = val;
|
94281
|
-
}
|
94282
|
-
}
|
94283
|
-
|
94284
|
-
// also register instance in prepatch hook
|
94285
|
-
// in case the same component instance is reused across different routes
|
94286
|
-
;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
|
94287
|
-
matched.instances[name] = vnode.componentInstance;
|
94288
|
-
};
|
94289
|
-
|
94290
|
-
// register instance in init hook
|
94291
|
-
// in case kept-alive component be actived when routes changed
|
94292
|
-
data.hook.init = function (vnode) {
|
94293
|
-
if (vnode.data.keepAlive &&
|
94294
|
-
vnode.componentInstance &&
|
94295
|
-
vnode.componentInstance !== matched.instances[name]
|
94296
|
-
) {
|
94297
|
-
matched.instances[name] = vnode.componentInstance;
|
94298
|
-
}
|
94299
|
-
|
94300
|
-
// if the route transition has already been confirmed then we weren't
|
94301
|
-
// able to call the cbs during confirmation as the component was not
|
94302
|
-
// registered yet, so we call it here.
|
94303
|
-
handleRouteEntered(route);
|
94304
|
-
};
|
94305
|
-
|
94306
|
-
var configProps = matched.props && matched.props[name];
|
94307
|
-
// save route and configProps in cache
|
94308
|
-
if (configProps) {
|
94309
|
-
extend(cache[name], {
|
94310
|
-
route: route,
|
94311
|
-
configProps: configProps
|
94312
|
-
});
|
94313
|
-
fillPropsinData(component, data, route, configProps);
|
94314
|
-
}
|
94315
|
-
|
94316
|
-
return h(component, data, children)
|
94317
|
-
}
|
94318
|
-
};
|
94319
|
-
|
94320
|
-
function fillPropsinData (component, data, route, configProps) {
|
94321
|
-
// resolve props
|
94322
|
-
var propsToPass = data.props = resolveProps(route, configProps);
|
94323
|
-
if (propsToPass) {
|
94324
|
-
// clone to prevent mutation
|
94325
|
-
propsToPass = data.props = extend({}, propsToPass);
|
94326
|
-
// pass non-declared props as attrs
|
94327
|
-
var attrs = data.attrs = data.attrs || {};
|
94328
|
-
for (var key in propsToPass) {
|
94329
|
-
if (!component.props || !(key in component.props)) {
|
94330
|
-
attrs[key] = propsToPass[key];
|
94331
|
-
delete propsToPass[key];
|
94332
|
-
}
|
94333
|
-
}
|
94334
|
-
}
|
94335
|
-
}
|
94336
|
-
|
94337
|
-
function resolveProps (route, config) {
|
94338
|
-
switch (typeof config) {
|
94339
|
-
case 'undefined':
|
94340
|
-
return
|
94341
|
-
case 'object':
|
94342
|
-
return config
|
94343
|
-
case 'function':
|
94344
|
-
return config(route)
|
94345
|
-
case 'boolean':
|
94346
|
-
return config ? route.params : undefined
|
94347
|
-
default:
|
94348
|
-
{
|
94349
|
-
warn(
|
94350
|
-
false,
|
94351
|
-
"props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
|
94352
|
-
"expecting an object, function or boolean."
|
94353
|
-
);
|
94354
|
-
}
|
94355
|
-
}
|
94356
|
-
}
|
94357
|
-
|
94358
|
-
/* */
|
94359
|
-
|
94360
|
-
function resolvePath (
|
94361
|
-
relative,
|
94362
|
-
base,
|
94363
|
-
append
|
94364
|
-
) {
|
94365
|
-
var firstChar = relative.charAt(0);
|
94366
|
-
if (firstChar === '/') {
|
94367
|
-
return relative
|
94368
|
-
}
|
94369
|
-
|
94370
|
-
if (firstChar === '?' || firstChar === '#') {
|
94371
|
-
return base + relative
|
94372
|
-
}
|
94373
|
-
|
94374
|
-
var stack = base.split('/');
|
94375
|
-
|
94376
|
-
// remove trailing segment if:
|
94377
|
-
// - not appending
|
94378
|
-
// - appending to trailing slash (last segment is empty)
|
94379
|
-
if (!append || !stack[stack.length - 1]) {
|
94380
|
-
stack.pop();
|
94381
|
-
}
|
94382
|
-
|
94383
|
-
// resolve relative path
|
94384
|
-
var segments = relative.replace(/^\//, '').split('/');
|
94385
|
-
for (var i = 0; i < segments.length; i++) {
|
94386
|
-
var segment = segments[i];
|
94387
|
-
if (segment === '..') {
|
94388
|
-
stack.pop();
|
94389
|
-
} else if (segment !== '.') {
|
94390
|
-
stack.push(segment);
|
94391
|
-
}
|
94392
|
-
}
|
94393
|
-
|
94394
|
-
// ensure leading slash
|
94395
|
-
if (stack[0] !== '') {
|
94396
|
-
stack.unshift('');
|
94397
|
-
}
|
94398
|
-
|
94399
|
-
return stack.join('/')
|
94400
|
-
}
|
94401
|
-
|
94402
|
-
function parsePath (path) {
|
94403
|
-
var hash = '';
|
94404
|
-
var query = '';
|
94405
|
-
|
94406
|
-
var hashIndex = path.indexOf('#');
|
94407
|
-
if (hashIndex >= 0) {
|
94408
|
-
hash = path.slice(hashIndex);
|
94409
|
-
path = path.slice(0, hashIndex);
|
94410
|
-
}
|
94411
|
-
|
94412
|
-
var queryIndex = path.indexOf('?');
|
94413
|
-
if (queryIndex >= 0) {
|
94414
|
-
query = path.slice(queryIndex + 1);
|
94415
|
-
path = path.slice(0, queryIndex);
|
94416
|
-
}
|
94417
|
-
|
94418
|
-
return {
|
94419
|
-
path: path,
|
94420
|
-
query: query,
|
94421
|
-
hash: hash
|
94422
|
-
}
|
94423
|
-
}
|
94424
|
-
|
94425
|
-
function cleanPath (path) {
|
94426
|
-
return path.replace(/\/(?:\s*\/)+/g, '/')
|
94427
|
-
}
|
94428
|
-
|
94429
|
-
var isarray = Array.isArray || function (arr) {
|
94430
|
-
return Object.prototype.toString.call(arr) == '[object Array]';
|
94431
|
-
};
|
94432
|
-
|
94433
|
-
/**
|
94434
|
-
* Expose `pathToRegexp`.
|
94435
|
-
*/
|
94436
|
-
var pathToRegexp_1 = pathToRegexp;
|
94437
|
-
var parse_1 = parse;
|
94438
|
-
var compile_1 = compile;
|
94439
|
-
var tokensToFunction_1 = tokensToFunction;
|
94440
|
-
var tokensToRegExp_1 = tokensToRegExp;
|
94441
|
-
|
94442
|
-
/**
|
94443
|
-
* The main path matching regexp utility.
|
94444
|
-
*
|
94445
|
-
* @type {RegExp}
|
94446
|
-
*/
|
94447
|
-
var PATH_REGEXP = new RegExp([
|
94448
|
-
// Match escaped characters that would otherwise appear in future matches.
|
94449
|
-
// This allows the user to escape special characters that won't transform.
|
94450
|
-
'(\\\\.)',
|
94451
|
-
// Match Express-style parameters and un-named parameters with a prefix
|
94452
|
-
// and optional suffixes. Matches appear as:
|
94453
|
-
//
|
94454
|
-
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
|
94455
|
-
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
|
94456
|
-
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
|
94457
|
-
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
|
94458
|
-
].join('|'), 'g');
|
94459
|
-
|
94460
|
-
/**
|
94461
|
-
* Parse a string for the raw tokens.
|
94462
|
-
*
|
94463
|
-
* @param {string} str
|
94464
|
-
* @param {Object=} options
|
94465
|
-
* @return {!Array}
|
94466
|
-
*/
|
94467
|
-
function parse (str, options) {
|
94468
|
-
var tokens = [];
|
94469
|
-
var key = 0;
|
94470
|
-
var index = 0;
|
94471
|
-
var path = '';
|
94472
|
-
var defaultDelimiter = options && options.delimiter || '/';
|
94473
|
-
var res;
|
94474
|
-
|
94475
|
-
while ((res = PATH_REGEXP.exec(str)) != null) {
|
94476
|
-
var m = res[0];
|
94477
|
-
var escaped = res[1];
|
94478
|
-
var offset = res.index;
|
94479
|
-
path += str.slice(index, offset);
|
94480
|
-
index = offset + m.length;
|
94481
|
-
|
94482
|
-
// Ignore already escaped sequences.
|
94483
|
-
if (escaped) {
|
94484
|
-
path += escaped[1];
|
94485
|
-
continue
|
94486
|
-
}
|
94487
|
-
|
94488
|
-
var next = str[index];
|
94489
|
-
var prefix = res[2];
|
94490
|
-
var name = res[3];
|
94491
|
-
var capture = res[4];
|
94492
|
-
var group = res[5];
|
94493
|
-
var modifier = res[6];
|
94494
|
-
var asterisk = res[7];
|
94495
|
-
|
94496
|
-
// Push the current path onto the tokens.
|
94497
|
-
if (path) {
|
94498
|
-
tokens.push(path);
|
94499
|
-
path = '';
|
94500
|
-
}
|
94501
|
-
|
94502
|
-
var partial = prefix != null && next != null && next !== prefix;
|
94503
|
-
var repeat = modifier === '+' || modifier === '*';
|
94504
|
-
var optional = modifier === '?' || modifier === '*';
|
94505
|
-
var delimiter = res[2] || defaultDelimiter;
|
94506
|
-
var pattern = capture || group;
|
94507
|
-
|
94508
|
-
tokens.push({
|
94509
|
-
name: name || key++,
|
94510
|
-
prefix: prefix || '',
|
94511
|
-
delimiter: delimiter,
|
94512
|
-
optional: optional,
|
94513
|
-
repeat: repeat,
|
94514
|
-
partial: partial,
|
94515
|
-
asterisk: !!asterisk,
|
94516
|
-
pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
|
94517
|
-
});
|
94518
|
-
}
|
94519
|
-
|
94520
|
-
// Match any characters still remaining.
|
94521
|
-
if (index < str.length) {
|
94522
|
-
path += str.substr(index);
|
94523
|
-
}
|
94524
|
-
|
94525
|
-
// If the path exists, push it onto the end.
|
94526
|
-
if (path) {
|
94527
|
-
tokens.push(path);
|
94528
|
-
}
|
94529
|
-
|
94530
|
-
return tokens
|
94531
|
-
}
|
94532
|
-
|
94533
|
-
/**
|
94534
|
-
* Compile a string to a template function for the path.
|
94535
|
-
*
|
94536
|
-
* @param {string} str
|
94537
|
-
* @param {Object=} options
|
94538
|
-
* @return {!function(Object=, Object=)}
|
94539
|
-
*/
|
94540
|
-
function compile (str, options) {
|
94541
|
-
return tokensToFunction(parse(str, options), options)
|
94542
|
-
}
|
94543
|
-
|
94544
|
-
/**
|
94545
|
-
* Prettier encoding of URI path segments.
|
94546
|
-
*
|
94547
|
-
* @param {string}
|
94548
|
-
* @return {string}
|
94549
|
-
*/
|
94550
|
-
function encodeURIComponentPretty (str) {
|
94551
|
-
return encodeURI(str).replace(/[\/?#]/g, function (c) {
|
94552
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
94553
|
-
})
|
94554
|
-
}
|
94555
|
-
|
94556
|
-
/**
|
94557
|
-
* Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
|
94558
|
-
*
|
94559
|
-
* @param {string}
|
94560
|
-
* @return {string}
|
94561
|
-
*/
|
94562
|
-
function encodeAsterisk (str) {
|
94563
|
-
return encodeURI(str).replace(/[?#]/g, function (c) {
|
94564
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
94565
|
-
})
|
94566
|
-
}
|
94567
|
-
|
94568
|
-
/**
|
94569
|
-
* Expose a method for transforming tokens into the path function.
|
94570
|
-
*/
|
94571
|
-
function tokensToFunction (tokens, options) {
|
94572
|
-
// Compile all the tokens into regexps.
|
94573
|
-
var matches = new Array(tokens.length);
|
94574
|
-
|
94575
|
-
// Compile all the patterns before compilation.
|
94576
|
-
for (var i = 0; i < tokens.length; i++) {
|
94577
|
-
if (typeof tokens[i] === 'object') {
|
94578
|
-
matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options));
|
94579
|
-
}
|
94580
|
-
}
|
94581
|
-
|
94582
|
-
return function (obj, opts) {
|
94583
|
-
var path = '';
|
94584
|
-
var data = obj || {};
|
94585
|
-
var options = opts || {};
|
94586
|
-
var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
|
94587
|
-
|
94588
|
-
for (var i = 0; i < tokens.length; i++) {
|
94589
|
-
var token = tokens[i];
|
94590
|
-
|
94591
|
-
if (typeof token === 'string') {
|
94592
|
-
path += token;
|
94593
|
-
|
94594
|
-
continue
|
94595
|
-
}
|
94596
|
-
|
94597
|
-
var value = data[token.name];
|
94598
|
-
var segment;
|
94599
|
-
|
94600
|
-
if (value == null) {
|
94601
|
-
if (token.optional) {
|
94602
|
-
// Prepend partial segment prefixes.
|
94603
|
-
if (token.partial) {
|
94604
|
-
path += token.prefix;
|
94605
|
-
}
|
94606
|
-
|
94607
|
-
continue
|
94608
|
-
} else {
|
94609
|
-
throw new TypeError('Expected "' + token.name + '" to be defined')
|
94610
|
-
}
|
94611
|
-
}
|
94612
|
-
|
94613
|
-
if (isarray(value)) {
|
94614
|
-
if (!token.repeat) {
|
94615
|
-
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
|
94616
|
-
}
|
94617
|
-
|
94618
|
-
if (value.length === 0) {
|
94619
|
-
if (token.optional) {
|
94620
|
-
continue
|
94621
|
-
} else {
|
94622
|
-
throw new TypeError('Expected "' + token.name + '" to not be empty')
|
94623
|
-
}
|
94624
|
-
}
|
94625
|
-
|
94626
|
-
for (var j = 0; j < value.length; j++) {
|
94627
|
-
segment = encode(value[j]);
|
94628
|
-
|
94629
|
-
if (!matches[i].test(segment)) {
|
94630
|
-
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
|
94631
|
-
}
|
94632
|
-
|
94633
|
-
path += (j === 0 ? token.prefix : token.delimiter) + segment;
|
94634
|
-
}
|
94635
|
-
|
94636
|
-
continue
|
94637
|
-
}
|
94638
|
-
|
94639
|
-
segment = token.asterisk ? encodeAsterisk(value) : encode(value);
|
94640
|
-
|
94641
|
-
if (!matches[i].test(segment)) {
|
94642
|
-
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
|
94643
|
-
}
|
94644
|
-
|
94645
|
-
path += token.prefix + segment;
|
94646
|
-
}
|
94647
|
-
|
94648
|
-
return path
|
94649
|
-
}
|
94650
|
-
}
|
94651
|
-
|
94652
|
-
/**
|
94653
|
-
* Escape a regular expression string.
|
94654
|
-
*
|
94655
|
-
* @param {string} str
|
94656
|
-
* @return {string}
|
94657
|
-
*/
|
94658
|
-
function escapeString (str) {
|
94659
|
-
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
|
94660
|
-
}
|
94661
|
-
|
94662
|
-
/**
|
94663
|
-
* Escape the capturing group by escaping special characters and meaning.
|
94664
|
-
*
|
94665
|
-
* @param {string} group
|
94666
|
-
* @return {string}
|
94667
|
-
*/
|
94668
|
-
function escapeGroup (group) {
|
94669
|
-
return group.replace(/([=!:$\/()])/g, '\\$1')
|
94670
|
-
}
|
94671
|
-
|
94672
|
-
/**
|
94673
|
-
* Attach the keys as a property of the regexp.
|
94674
|
-
*
|
94675
|
-
* @param {!RegExp} re
|
94676
|
-
* @param {Array} keys
|
94677
|
-
* @return {!RegExp}
|
94678
|
-
*/
|
94679
|
-
function attachKeys (re, keys) {
|
94680
|
-
re.keys = keys;
|
94681
|
-
return re
|
94682
|
-
}
|
94683
|
-
|
94684
|
-
/**
|
94685
|
-
* Get the flags for a regexp from the options.
|
94686
|
-
*
|
94687
|
-
* @param {Object} options
|
94688
|
-
* @return {string}
|
94689
|
-
*/
|
94690
|
-
function flags (options) {
|
94691
|
-
return options && options.sensitive ? '' : 'i'
|
94692
|
-
}
|
94693
|
-
|
94694
|
-
/**
|
94695
|
-
* Pull out keys from a regexp.
|
94696
|
-
*
|
94697
|
-
* @param {!RegExp} path
|
94698
|
-
* @param {!Array} keys
|
94699
|
-
* @return {!RegExp}
|
94700
|
-
*/
|
94701
|
-
function regexpToRegexp (path, keys) {
|
94702
|
-
// Use a negative lookahead to match only capturing groups.
|
94703
|
-
var groups = path.source.match(/\((?!\?)/g);
|
94704
|
-
|
94705
|
-
if (groups) {
|
94706
|
-
for (var i = 0; i < groups.length; i++) {
|
94707
|
-
keys.push({
|
94708
|
-
name: i,
|
94709
|
-
prefix: null,
|
94710
|
-
delimiter: null,
|
94711
|
-
optional: false,
|
94712
|
-
repeat: false,
|
94713
|
-
partial: false,
|
94714
|
-
asterisk: false,
|
94715
|
-
pattern: null
|
94716
|
-
});
|
94717
|
-
}
|
94718
|
-
}
|
94719
|
-
|
94720
|
-
return attachKeys(path, keys)
|
94721
|
-
}
|
94722
|
-
|
94723
|
-
/**
|
94724
|
-
* Transform an array into a regexp.
|
94725
|
-
*
|
94726
|
-
* @param {!Array} path
|
94727
|
-
* @param {Array} keys
|
94728
|
-
* @param {!Object} options
|
94729
|
-
* @return {!RegExp}
|
94730
|
-
*/
|
94731
|
-
function arrayToRegexp (path, keys, options) {
|
94732
|
-
var parts = [];
|
94733
|
-
|
94734
|
-
for (var i = 0; i < path.length; i++) {
|
94735
|
-
parts.push(pathToRegexp(path[i], keys, options).source);
|
94736
|
-
}
|
94737
|
-
|
94738
|
-
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
|
94739
|
-
|
94740
|
-
return attachKeys(regexp, keys)
|
94741
|
-
}
|
94742
|
-
|
94743
|
-
/**
|
94744
|
-
* Create a path regexp from string input.
|
94745
|
-
*
|
94746
|
-
* @param {string} path
|
94747
|
-
* @param {!Array} keys
|
94748
|
-
* @param {!Object} options
|
94749
|
-
* @return {!RegExp}
|
94750
|
-
*/
|
94751
|
-
function stringToRegexp (path, keys, options) {
|
94752
|
-
return tokensToRegExp(parse(path, options), keys, options)
|
94753
|
-
}
|
94754
|
-
|
94755
|
-
/**
|
94756
|
-
* Expose a function for taking tokens and returning a RegExp.
|
94757
|
-
*
|
94758
|
-
* @param {!Array} tokens
|
94759
|
-
* @param {(Array|Object)=} keys
|
94760
|
-
* @param {Object=} options
|
94761
|
-
* @return {!RegExp}
|
94762
|
-
*/
|
94763
|
-
function tokensToRegExp (tokens, keys, options) {
|
94764
|
-
if (!isarray(keys)) {
|
94765
|
-
options = /** @type {!Object} */ (keys || options);
|
94766
|
-
keys = [];
|
94767
|
-
}
|
94768
|
-
|
94769
|
-
options = options || {};
|
94770
|
-
|
94771
|
-
var strict = options.strict;
|
94772
|
-
var end = options.end !== false;
|
94773
|
-
var route = '';
|
94774
|
-
|
94775
|
-
// Iterate over the tokens and create our regexp string.
|
94776
|
-
for (var i = 0; i < tokens.length; i++) {
|
94777
|
-
var token = tokens[i];
|
94778
|
-
|
94779
|
-
if (typeof token === 'string') {
|
94780
|
-
route += escapeString(token);
|
94781
|
-
} else {
|
94782
|
-
var prefix = escapeString(token.prefix);
|
94783
|
-
var capture = '(?:' + token.pattern + ')';
|
94784
|
-
|
94785
|
-
keys.push(token);
|
94786
|
-
|
94787
|
-
if (token.repeat) {
|
94788
|
-
capture += '(?:' + prefix + capture + ')*';
|
94789
|
-
}
|
94790
|
-
|
94791
|
-
if (token.optional) {
|
94792
|
-
if (!token.partial) {
|
94793
|
-
capture = '(?:' + prefix + '(' + capture + '))?';
|
94794
|
-
} else {
|
94795
|
-
capture = prefix + '(' + capture + ')?';
|
94796
|
-
}
|
94797
|
-
} else {
|
94798
|
-
capture = prefix + '(' + capture + ')';
|
94799
|
-
}
|
94800
|
-
|
94801
|
-
route += capture;
|
94802
|
-
}
|
94803
|
-
}
|
94804
|
-
|
94805
|
-
var delimiter = escapeString(options.delimiter || '/');
|
94806
|
-
var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
|
94807
|
-
|
94808
|
-
// In non-strict mode we allow a slash at the end of match. If the path to
|
94809
|
-
// match already ends with a slash, we remove it for consistency. The slash
|
94810
|
-
// is valid at the end of a path match, not in the middle. This is important
|
94811
|
-
// in non-ending mode, where "/test/" shouldn't match "/test//route".
|
94812
|
-
if (!strict) {
|
94813
|
-
route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
|
94814
|
-
}
|
94815
|
-
|
94816
|
-
if (end) {
|
94817
|
-
route += '$';
|
94818
|
-
} else {
|
94819
|
-
// In non-ending mode, we need the capturing groups to match as much as
|
94820
|
-
// possible by using a positive lookahead to the end or next path segment.
|
94821
|
-
route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
|
94822
|
-
}
|
94823
|
-
|
94824
|
-
return attachKeys(new RegExp('^' + route, flags(options)), keys)
|
94825
|
-
}
|
94826
|
-
|
94827
|
-
/**
|
94828
|
-
* Normalize the given path string, returning a regular expression.
|
94829
|
-
*
|
94830
|
-
* An empty array can be passed in for the keys, which will hold the
|
94831
|
-
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
|
94832
|
-
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
|
94833
|
-
*
|
94834
|
-
* @param {(string|RegExp|Array)} path
|
94835
|
-
* @param {(Array|Object)=} keys
|
94836
|
-
* @param {Object=} options
|
94837
|
-
* @return {!RegExp}
|
94838
|
-
*/
|
94839
|
-
function pathToRegexp (path, keys, options) {
|
94840
|
-
if (!isarray(keys)) {
|
94841
|
-
options = /** @type {!Object} */ (keys || options);
|
94842
|
-
keys = [];
|
94843
|
-
}
|
94844
|
-
|
94845
|
-
options = options || {};
|
94846
|
-
|
94847
|
-
if (path instanceof RegExp) {
|
94848
|
-
return regexpToRegexp(path, /** @type {!Array} */ (keys))
|
94849
|
-
}
|
94850
|
-
|
94851
|
-
if (isarray(path)) {
|
94852
|
-
return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
|
94853
|
-
}
|
94854
|
-
|
94855
|
-
return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
|
94856
|
-
}
|
94857
|
-
pathToRegexp_1.parse = parse_1;
|
94858
|
-
pathToRegexp_1.compile = compile_1;
|
94859
|
-
pathToRegexp_1.tokensToFunction = tokensToFunction_1;
|
94860
|
-
pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
|
94861
|
-
|
94862
|
-
/* */
|
94863
|
-
|
94864
|
-
// $flow-disable-line
|
94865
|
-
var regexpCompileCache = Object.create(null);
|
94866
|
-
|
94867
|
-
function fillParams (
|
94868
|
-
path,
|
94869
|
-
params,
|
94870
|
-
routeMsg
|
94871
|
-
) {
|
94872
|
-
params = params || {};
|
94873
|
-
try {
|
94874
|
-
var filler =
|
94875
|
-
regexpCompileCache[path] ||
|
94876
|
-
(regexpCompileCache[path] = pathToRegexp_1.compile(path));
|
94877
|
-
|
94878
|
-
// Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
|
94879
|
-
// and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
|
94880
|
-
if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
|
94881
|
-
|
94882
|
-
return filler(params, { pretty: true })
|
94883
|
-
} catch (e) {
|
94884
|
-
{
|
94885
|
-
// Fix #3072 no warn if `pathMatch` is string
|
94886
|
-
warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
|
94887
|
-
}
|
94888
|
-
return ''
|
94889
|
-
} finally {
|
94890
|
-
// delete the 0 if it was added
|
94891
|
-
delete params[0];
|
94892
|
-
}
|
94893
|
-
}
|
94894
|
-
|
94895
|
-
/* */
|
94896
|
-
|
94897
|
-
function normalizeLocation (
|
94898
|
-
raw,
|
94899
|
-
current,
|
94900
|
-
append,
|
94901
|
-
router
|
94902
|
-
) {
|
94903
|
-
var next = typeof raw === 'string' ? { path: raw } : raw;
|
94904
|
-
// named target
|
94905
|
-
if (next._normalized) {
|
94906
|
-
return next
|
94907
|
-
} else if (next.name) {
|
94908
|
-
next = extend({}, raw);
|
94909
|
-
var params = next.params;
|
94910
|
-
if (params && typeof params === 'object') {
|
94911
|
-
next.params = extend({}, params);
|
94912
|
-
}
|
94913
|
-
return next
|
94914
|
-
}
|
94915
|
-
|
94916
|
-
// relative params
|
94917
|
-
if (!next.path && next.params && current) {
|
94918
|
-
next = extend({}, next);
|
94919
|
-
next._normalized = true;
|
94920
|
-
var params$1 = extend(extend({}, current.params), next.params);
|
94921
|
-
if (current.name) {
|
94922
|
-
next.name = current.name;
|
94923
|
-
next.params = params$1;
|
94924
|
-
} else if (current.matched.length) {
|
94925
|
-
var rawPath = current.matched[current.matched.length - 1].path;
|
94926
|
-
next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
|
94927
|
-
} else {
|
94928
|
-
warn(false, "relative params navigation requires a current route.");
|
94929
|
-
}
|
94930
|
-
return next
|
94931
|
-
}
|
94932
|
-
|
94933
|
-
var parsedPath = parsePath(next.path || '');
|
94934
|
-
var basePath = (current && current.path) || '/';
|
94935
|
-
var path = parsedPath.path
|
94936
|
-
? resolvePath(parsedPath.path, basePath, append || next.append)
|
94937
|
-
: basePath;
|
94938
|
-
|
94939
|
-
var query = resolveQuery(
|
94940
|
-
parsedPath.query,
|
94941
|
-
next.query,
|
94942
|
-
router && router.options.parseQuery
|
94943
|
-
);
|
94944
|
-
|
94945
|
-
var hash = next.hash || parsedPath.hash;
|
94946
|
-
if (hash && hash.charAt(0) !== '#') {
|
94947
|
-
hash = "#" + hash;
|
94948
|
-
}
|
94949
|
-
|
94950
|
-
return {
|
94951
|
-
_normalized: true,
|
94952
|
-
path: path,
|
94953
|
-
query: query,
|
94954
|
-
hash: hash
|
94955
|
-
}
|
94956
|
-
}
|
94957
|
-
|
94958
|
-
/* */
|
94959
|
-
|
94960
|
-
// work around weird flow bug
|
94961
|
-
var toTypes = [String, Object];
|
94962
|
-
var eventTypes = [String, Array];
|
94963
|
-
|
94964
|
-
var noop = function () {};
|
94965
|
-
|
94966
|
-
var warnedCustomSlot;
|
94967
|
-
var warnedTagProp;
|
94968
|
-
var warnedEventProp;
|
94969
|
-
|
94970
|
-
var Link = {
|
94971
|
-
name: 'RouterLink',
|
94972
|
-
props: {
|
94973
|
-
to: {
|
94974
|
-
type: toTypes,
|
94975
|
-
required: true
|
94976
|
-
},
|
94977
|
-
tag: {
|
94978
|
-
type: String,
|
94979
|
-
default: 'a'
|
94980
|
-
},
|
94981
|
-
custom: Boolean,
|
94982
|
-
exact: Boolean,
|
94983
|
-
exactPath: Boolean,
|
94984
|
-
append: Boolean,
|
94985
|
-
replace: Boolean,
|
94986
|
-
activeClass: String,
|
94987
|
-
exactActiveClass: String,
|
94988
|
-
ariaCurrentValue: {
|
94989
|
-
type: String,
|
94990
|
-
default: 'page'
|
94991
|
-
},
|
94992
|
-
event: {
|
94993
|
-
type: eventTypes,
|
94994
|
-
default: 'click'
|
94995
|
-
}
|
94996
|
-
},
|
94997
|
-
render: function render (h) {
|
94998
|
-
var this$1$1 = this;
|
94999
|
-
|
95000
|
-
var router = this.$router;
|
95001
|
-
var current = this.$route;
|
95002
|
-
var ref = router.resolve(
|
95003
|
-
this.to,
|
95004
|
-
current,
|
95005
|
-
this.append
|
95006
|
-
);
|
95007
|
-
var location = ref.location;
|
95008
|
-
var route = ref.route;
|
95009
|
-
var href = ref.href;
|
95010
|
-
|
95011
|
-
var classes = {};
|
95012
|
-
var globalActiveClass = router.options.linkActiveClass;
|
95013
|
-
var globalExactActiveClass = router.options.linkExactActiveClass;
|
95014
|
-
// Support global empty active class
|
95015
|
-
var activeClassFallback =
|
95016
|
-
globalActiveClass == null ? 'router-link-active' : globalActiveClass;
|
95017
|
-
var exactActiveClassFallback =
|
95018
|
-
globalExactActiveClass == null
|
95019
|
-
? 'router-link-exact-active'
|
95020
|
-
: globalExactActiveClass;
|
95021
|
-
var activeClass =
|
95022
|
-
this.activeClass == null ? activeClassFallback : this.activeClass;
|
95023
|
-
var exactActiveClass =
|
95024
|
-
this.exactActiveClass == null
|
95025
|
-
? exactActiveClassFallback
|
95026
|
-
: this.exactActiveClass;
|
95027
|
-
|
95028
|
-
var compareTarget = route.redirectedFrom
|
95029
|
-
? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
|
95030
|
-
: route;
|
95031
|
-
|
95032
|
-
classes[exactActiveClass] = isSameRoute(current, compareTarget, this.exactPath);
|
95033
|
-
classes[activeClass] = this.exact || this.exactPath
|
95034
|
-
? classes[exactActiveClass]
|
95035
|
-
: isIncludedRoute(current, compareTarget);
|
95036
|
-
|
95037
|
-
var ariaCurrentValue = classes[exactActiveClass] ? this.ariaCurrentValue : null;
|
95038
|
-
|
95039
|
-
var handler = function (e) {
|
95040
|
-
if (guardEvent(e)) {
|
95041
|
-
if (this$1$1.replace) {
|
95042
|
-
router.replace(location, noop);
|
95043
|
-
} else {
|
95044
|
-
router.push(location, noop);
|
95045
|
-
}
|
95046
|
-
}
|
95047
|
-
};
|
95048
|
-
|
95049
|
-
var on = { click: guardEvent };
|
95050
|
-
if (Array.isArray(this.event)) {
|
95051
|
-
this.event.forEach(function (e) {
|
95052
|
-
on[e] = handler;
|
95053
|
-
});
|
95054
|
-
} else {
|
95055
|
-
on[this.event] = handler;
|
95056
|
-
}
|
95057
|
-
|
95058
|
-
var data = { class: classes };
|
95059
|
-
|
95060
|
-
var scopedSlot =
|
95061
|
-
!this.$scopedSlots.$hasNormal &&
|
95062
|
-
this.$scopedSlots.default &&
|
95063
|
-
this.$scopedSlots.default({
|
95064
|
-
href: href,
|
95065
|
-
route: route,
|
95066
|
-
navigate: handler,
|
95067
|
-
isActive: classes[activeClass],
|
95068
|
-
isExactActive: classes[exactActiveClass]
|
95069
|
-
});
|
95070
|
-
|
95071
|
-
if (scopedSlot) {
|
95072
|
-
if (!this.custom) {
|
95073
|
-
!warnedCustomSlot && warn(false, 'In Vue Router 4, the v-slot API will by default wrap its content with an <a> element. Use the custom prop to remove this warning:\n<router-link v-slot="{ navigate, href }" custom></router-link>\n');
|
95074
|
-
warnedCustomSlot = true;
|
95075
|
-
}
|
95076
|
-
if (scopedSlot.length === 1) {
|
95077
|
-
return scopedSlot[0]
|
95078
|
-
} else if (scopedSlot.length > 1 || !scopedSlot.length) {
|
95079
|
-
{
|
95080
|
-
warn(
|
95081
|
-
false,
|
95082
|
-
("<router-link> with to=\"" + (this.to) + "\" is trying to use a scoped slot but it didn't provide exactly one child. Wrapping the content with a span element.")
|
95083
|
-
);
|
95084
|
-
}
|
95085
|
-
return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
|
95086
|
-
}
|
95087
|
-
}
|
95088
|
-
|
95089
|
-
{
|
95090
|
-
if ('tag' in this.$options.propsData && !warnedTagProp) {
|
95091
|
-
warn(
|
95092
|
-
false,
|
95093
|
-
"<router-link>'s tag prop is deprecated and has been removed in Vue Router 4. Use the v-slot API to remove this warning: https://next.router.vuejs.org/guide/migration/#removal-of-event-and-tag-props-in-router-link."
|
95094
|
-
);
|
95095
|
-
warnedTagProp = true;
|
95096
|
-
}
|
95097
|
-
if ('event' in this.$options.propsData && !warnedEventProp) {
|
95098
|
-
warn(
|
95099
|
-
false,
|
95100
|
-
"<router-link>'s event prop is deprecated and has been removed in Vue Router 4. Use the v-slot API to remove this warning: https://next.router.vuejs.org/guide/migration/#removal-of-event-and-tag-props-in-router-link."
|
95101
|
-
);
|
95102
|
-
warnedEventProp = true;
|
95103
|
-
}
|
95104
|
-
}
|
95105
|
-
|
95106
|
-
if (this.tag === 'a') {
|
95107
|
-
data.on = on;
|
95108
|
-
data.attrs = { href: href, 'aria-current': ariaCurrentValue };
|
95109
|
-
} else {
|
95110
|
-
// find the first <a> child and apply listener and href
|
95111
|
-
var a = findAnchor(this.$slots.default);
|
95112
|
-
if (a) {
|
95113
|
-
// in case the <a> is a static node
|
95114
|
-
a.isStatic = false;
|
95115
|
-
var aData = (a.data = extend({}, a.data));
|
95116
|
-
aData.on = aData.on || {};
|
95117
|
-
// transform existing events in both objects into arrays so we can push later
|
95118
|
-
for (var event in aData.on) {
|
95119
|
-
var handler$1 = aData.on[event];
|
95120
|
-
if (event in on) {
|
95121
|
-
aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
|
95122
|
-
}
|
95123
|
-
}
|
95124
|
-
// append new listeners for router-link
|
95125
|
-
for (var event$1 in on) {
|
95126
|
-
if (event$1 in aData.on) {
|
95127
|
-
// on[event] is always a function
|
95128
|
-
aData.on[event$1].push(on[event$1]);
|
95129
|
-
} else {
|
95130
|
-
aData.on[event$1] = handler;
|
95131
|
-
}
|
95132
|
-
}
|
95133
|
-
|
95134
|
-
var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
|
95135
|
-
aAttrs.href = href;
|
95136
|
-
aAttrs['aria-current'] = ariaCurrentValue;
|
95137
|
-
} else {
|
95138
|
-
// doesn't have <a> child, apply listener to self
|
95139
|
-
data.on = on;
|
95140
|
-
}
|
95141
|
-
}
|
95142
|
-
|
95143
|
-
return h(this.tag, data, this.$slots.default)
|
95144
|
-
}
|
95145
|
-
};
|
95146
|
-
|
95147
|
-
function guardEvent (e) {
|
95148
|
-
// don't redirect with control keys
|
95149
|
-
if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
|
95150
|
-
// don't redirect when preventDefault called
|
95151
|
-
if (e.defaultPrevented) { return }
|
95152
|
-
// don't redirect on right click
|
95153
|
-
if (e.button !== undefined && e.button !== 0) { return }
|
95154
|
-
// don't redirect if `target="_blank"`
|
95155
|
-
if (e.currentTarget && e.currentTarget.getAttribute) {
|
95156
|
-
var target = e.currentTarget.getAttribute('target');
|
95157
|
-
if (/\b_blank\b/i.test(target)) { return }
|
95158
|
-
}
|
95159
|
-
// this may be a Weex event which doesn't have this method
|
95160
|
-
if (e.preventDefault) {
|
95161
|
-
e.preventDefault();
|
95162
|
-
}
|
95163
|
-
return true
|
95164
|
-
}
|
95165
|
-
|
95166
|
-
function findAnchor (children) {
|
95167
|
-
if (children) {
|
95168
|
-
var child;
|
95169
|
-
for (var i = 0; i < children.length; i++) {
|
95170
|
-
child = children[i];
|
95171
|
-
if (child.tag === 'a') {
|
95172
|
-
return child
|
95173
|
-
}
|
95174
|
-
if (child.children && (child = findAnchor(child.children))) {
|
95175
|
-
return child
|
95176
|
-
}
|
95177
|
-
}
|
95178
|
-
}
|
95179
|
-
}
|
95180
|
-
|
95181
|
-
var _Vue;
|
95182
|
-
|
95183
|
-
function install$2 (Vue) {
|
95184
|
-
if (install$2.installed && _Vue === Vue) { return }
|
95185
|
-
install$2.installed = true;
|
95186
|
-
|
95187
|
-
_Vue = Vue;
|
95188
|
-
|
95189
|
-
var isDef = function (v) { return v !== undefined; };
|
95190
|
-
|
95191
|
-
var registerInstance = function (vm, callVal) {
|
95192
|
-
var i = vm.$options._parentVnode;
|
95193
|
-
if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
|
95194
|
-
i(vm, callVal);
|
95195
|
-
}
|
95196
|
-
};
|
95197
|
-
|
95198
|
-
Vue.mixin({
|
95199
|
-
beforeCreate: function beforeCreate () {
|
95200
|
-
if (isDef(this.$options.router)) {
|
95201
|
-
this._routerRoot = this;
|
95202
|
-
this._router = this.$options.router;
|
95203
|
-
this._router.init(this);
|
95204
|
-
Vue.util.defineReactive(this, '_route', this._router.history.current);
|
95205
|
-
} else {
|
95206
|
-
this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
|
95207
|
-
}
|
95208
|
-
registerInstance(this, this);
|
95209
|
-
},
|
95210
|
-
destroyed: function destroyed () {
|
95211
|
-
registerInstance(this);
|
95212
|
-
}
|
95213
|
-
});
|
95214
|
-
|
95215
|
-
Object.defineProperty(Vue.prototype, '$router', {
|
95216
|
-
get: function get () { return this._routerRoot._router }
|
95217
|
-
});
|
95218
|
-
|
95219
|
-
Object.defineProperty(Vue.prototype, '$route', {
|
95220
|
-
get: function get () { return this._routerRoot._route }
|
95221
|
-
});
|
95222
|
-
|
95223
|
-
Vue.component('RouterView', View);
|
95224
|
-
Vue.component('RouterLink', Link);
|
95225
|
-
|
95226
|
-
var strats = Vue.config.optionMergeStrategies;
|
95227
|
-
// use the same hook merging strategy for route hooks
|
95228
|
-
strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
|
95229
|
-
}
|
95230
|
-
|
95231
|
-
/* */
|
95232
|
-
|
95233
|
-
var inBrowser = typeof window !== 'undefined';
|
95234
|
-
|
95235
|
-
/* */
|
95236
|
-
|
95237
|
-
function createRouteMap (
|
95238
|
-
routes,
|
95239
|
-
oldPathList,
|
95240
|
-
oldPathMap,
|
95241
|
-
oldNameMap,
|
95242
|
-
parentRoute
|
95243
|
-
) {
|
95244
|
-
// the path list is used to control path matching priority
|
95245
|
-
var pathList = oldPathList || [];
|
95246
|
-
// $flow-disable-line
|
95247
|
-
var pathMap = oldPathMap || Object.create(null);
|
95248
|
-
// $flow-disable-line
|
95249
|
-
var nameMap = oldNameMap || Object.create(null);
|
95250
|
-
|
95251
|
-
routes.forEach(function (route) {
|
95252
|
-
addRouteRecord(pathList, pathMap, nameMap, route, parentRoute);
|
95253
|
-
});
|
95254
|
-
|
95255
|
-
// ensure wildcard routes are always at the end
|
95256
|
-
for (var i = 0, l = pathList.length; i < l; i++) {
|
95257
|
-
if (pathList[i] === '*') {
|
95258
|
-
pathList.push(pathList.splice(i, 1)[0]);
|
95259
|
-
l--;
|
95260
|
-
i--;
|
95261
|
-
}
|
95262
|
-
}
|
95263
|
-
|
95264
|
-
{
|
95265
|
-
// warn if routes do not include leading slashes
|
95266
|
-
var found = pathList
|
95267
|
-
// check for missing leading slash
|
95268
|
-
.filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
|
95269
|
-
|
95270
|
-
if (found.length > 0) {
|
95271
|
-
var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
|
95272
|
-
warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
|
95273
|
-
}
|
95274
|
-
}
|
95275
|
-
|
95276
|
-
return {
|
95277
|
-
pathList: pathList,
|
95278
|
-
pathMap: pathMap,
|
95279
|
-
nameMap: nameMap
|
95280
|
-
}
|
95281
|
-
}
|
95282
|
-
|
95283
|
-
function addRouteRecord (
|
95284
|
-
pathList,
|
95285
|
-
pathMap,
|
95286
|
-
nameMap,
|
95287
|
-
route,
|
95288
|
-
parent,
|
95289
|
-
matchAs
|
95290
|
-
) {
|
95291
|
-
var path = route.path;
|
95292
|
-
var name = route.name;
|
95293
|
-
{
|
95294
|
-
assert(path != null, "\"path\" is required in a route configuration.");
|
95295
|
-
assert(
|
95296
|
-
typeof route.component !== 'string',
|
95297
|
-
"route config \"component\" for path: " + (String(
|
95298
|
-
path || name
|
95299
|
-
)) + " cannot be a " + "string id. Use an actual component instead."
|
95300
|
-
);
|
95301
|
-
|
95302
|
-
warn(
|
95303
|
-
// eslint-disable-next-line no-control-regex
|
95304
|
-
!/[^\u0000-\u007F]+/.test(path),
|
95305
|
-
"Route with path \"" + path + "\" contains unencoded characters, make sure " +
|
95306
|
-
"your path is correctly encoded before passing it to the router. Use " +
|
95307
|
-
"encodeURI to encode static segments of your path."
|
95308
|
-
);
|
95309
|
-
}
|
95310
|
-
|
95311
|
-
var pathToRegexpOptions =
|
95312
|
-
route.pathToRegexpOptions || {};
|
95313
|
-
var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
|
95314
|
-
|
95315
|
-
if (typeof route.caseSensitive === 'boolean') {
|
95316
|
-
pathToRegexpOptions.sensitive = route.caseSensitive;
|
95317
|
-
}
|
95318
|
-
|
95319
|
-
var record = {
|
95320
|
-
path: normalizedPath,
|
95321
|
-
regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
|
95322
|
-
components: route.components || { default: route.component },
|
95323
|
-
alias: route.alias
|
95324
|
-
? typeof route.alias === 'string'
|
95325
|
-
? [route.alias]
|
95326
|
-
: route.alias
|
95327
|
-
: [],
|
95328
|
-
instances: {},
|
95329
|
-
enteredCbs: {},
|
95330
|
-
name: name,
|
95331
|
-
parent: parent,
|
95332
|
-
matchAs: matchAs,
|
95333
|
-
redirect: route.redirect,
|
95334
|
-
beforeEnter: route.beforeEnter,
|
95335
|
-
meta: route.meta || {},
|
95336
|
-
props:
|
95337
|
-
route.props == null
|
95338
|
-
? {}
|
95339
|
-
: route.components
|
95340
|
-
? route.props
|
95341
|
-
: { default: route.props }
|
95342
|
-
};
|
95343
|
-
|
95344
|
-
if (route.children) {
|
95345
|
-
// Warn if route is named, does not redirect and has a default child route.
|
95346
|
-
// If users navigate to this route by name, the default child will
|
95347
|
-
// not be rendered (GH Issue #629)
|
95348
|
-
{
|
95349
|
-
if (
|
95350
|
-
route.name &&
|
95351
|
-
!route.redirect &&
|
95352
|
-
route.children.some(function (child) { return /^\/?$/.test(child.path); })
|
95353
|
-
) {
|
95354
|
-
warn(
|
95355
|
-
false,
|
95356
|
-
"Named Route '" + (route.name) + "' has a default child route. " +
|
95357
|
-
"When navigating to this named route (:to=\"{name: '" + (route.name) + "'}\"), " +
|
95358
|
-
"the default child route will not be rendered. Remove the name from " +
|
95359
|
-
"this route and use the name of the default child route for named " +
|
95360
|
-
"links instead."
|
95361
|
-
);
|
95362
|
-
}
|
95363
|
-
}
|
95364
|
-
route.children.forEach(function (child) {
|
95365
|
-
var childMatchAs = matchAs
|
95366
|
-
? cleanPath((matchAs + "/" + (child.path)))
|
95367
|
-
: undefined;
|
95368
|
-
addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
|
95369
|
-
});
|
95370
|
-
}
|
95371
|
-
|
95372
|
-
if (!pathMap[record.path]) {
|
95373
|
-
pathList.push(record.path);
|
95374
|
-
pathMap[record.path] = record;
|
95375
|
-
}
|
95376
|
-
|
95377
|
-
if (route.alias !== undefined) {
|
95378
|
-
var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
|
95379
|
-
for (var i = 0; i < aliases.length; ++i) {
|
95380
|
-
var alias = aliases[i];
|
95381
|
-
if (alias === path) {
|
95382
|
-
warn(
|
95383
|
-
false,
|
95384
|
-
("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
|
95385
|
-
);
|
95386
|
-
// skip in dev to make it work
|
95387
|
-
continue
|
95388
|
-
}
|
95389
|
-
|
95390
|
-
var aliasRoute = {
|
95391
|
-
path: alias,
|
95392
|
-
children: route.children
|
95393
|
-
};
|
95394
|
-
addRouteRecord(
|
95395
|
-
pathList,
|
95396
|
-
pathMap,
|
95397
|
-
nameMap,
|
95398
|
-
aliasRoute,
|
95399
|
-
parent,
|
95400
|
-
record.path || '/' // matchAs
|
95401
|
-
);
|
95402
|
-
}
|
95403
|
-
}
|
95404
|
-
|
95405
|
-
if (name) {
|
95406
|
-
if (!nameMap[name]) {
|
95407
|
-
nameMap[name] = record;
|
95408
|
-
} else if (!matchAs) {
|
95409
|
-
warn(
|
95410
|
-
false,
|
95411
|
-
"Duplicate named routes definition: " +
|
95412
|
-
"{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
|
95413
|
-
);
|
95414
|
-
}
|
95415
|
-
}
|
95416
|
-
}
|
95417
|
-
|
95418
|
-
function compileRouteRegex (
|
95419
|
-
path,
|
95420
|
-
pathToRegexpOptions
|
95421
|
-
) {
|
95422
|
-
var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
|
95423
|
-
{
|
95424
|
-
var keys = Object.create(null);
|
95425
|
-
regex.keys.forEach(function (key) {
|
95426
|
-
warn(
|
95427
|
-
!keys[key.name],
|
95428
|
-
("Duplicate param keys in route with path: \"" + path + "\"")
|
95429
|
-
);
|
95430
|
-
keys[key.name] = true;
|
95431
|
-
});
|
95432
|
-
}
|
95433
|
-
return regex
|
95434
|
-
}
|
95435
|
-
|
95436
|
-
function normalizePath (
|
95437
|
-
path,
|
95438
|
-
parent,
|
95439
|
-
strict
|
95440
|
-
) {
|
95441
|
-
if (!strict) { path = path.replace(/\/$/, ''); }
|
95442
|
-
if (path[0] === '/') { return path }
|
95443
|
-
if (parent == null) { return path }
|
95444
|
-
return cleanPath(((parent.path) + "/" + path))
|
95445
|
-
}
|
95446
|
-
|
95447
|
-
/* */
|
95448
|
-
|
95449
|
-
|
95450
|
-
|
95451
|
-
function createMatcher (
|
95452
|
-
routes,
|
95453
|
-
router
|
95454
|
-
) {
|
95455
|
-
var ref = createRouteMap(routes);
|
95456
|
-
var pathList = ref.pathList;
|
95457
|
-
var pathMap = ref.pathMap;
|
95458
|
-
var nameMap = ref.nameMap;
|
95459
|
-
|
95460
|
-
function addRoutes (routes) {
|
95461
|
-
createRouteMap(routes, pathList, pathMap, nameMap);
|
95462
|
-
}
|
95463
|
-
|
95464
|
-
function addRoute (parentOrRoute, route) {
|
95465
|
-
var parent = (typeof parentOrRoute !== 'object') ? nameMap[parentOrRoute] : undefined;
|
95466
|
-
// $flow-disable-line
|
95467
|
-
createRouteMap([route || parentOrRoute], pathList, pathMap, nameMap, parent);
|
95468
|
-
|
95469
|
-
// add aliases of parent
|
95470
|
-
if (parent && parent.alias.length) {
|
95471
|
-
createRouteMap(
|
95472
|
-
// $flow-disable-line route is defined if parent is
|
95473
|
-
parent.alias.map(function (alias) { return ({ path: alias, children: [route] }); }),
|
95474
|
-
pathList,
|
95475
|
-
pathMap,
|
95476
|
-
nameMap,
|
95477
|
-
parent
|
95478
|
-
);
|
95479
|
-
}
|
95480
|
-
}
|
95481
|
-
|
95482
|
-
function getRoutes () {
|
95483
|
-
return pathList.map(function (path) { return pathMap[path]; })
|
95484
|
-
}
|
95485
|
-
|
95486
|
-
function match (
|
95487
|
-
raw,
|
95488
|
-
currentRoute,
|
95489
|
-
redirectedFrom
|
95490
|
-
) {
|
95491
|
-
var location = normalizeLocation(raw, currentRoute, false, router);
|
95492
|
-
var name = location.name;
|
95493
|
-
|
95494
|
-
if (name) {
|
95495
|
-
var record = nameMap[name];
|
95496
|
-
{
|
95497
|
-
warn(record, ("Route with name '" + name + "' does not exist"));
|
95498
|
-
}
|
95499
|
-
if (!record) { return _createRoute(null, location) }
|
95500
|
-
var paramNames = record.regex.keys
|
95501
|
-
.filter(function (key) { return !key.optional; })
|
95502
|
-
.map(function (key) { return key.name; });
|
95503
|
-
|
95504
|
-
if (typeof location.params !== 'object') {
|
95505
|
-
location.params = {};
|
95506
|
-
}
|
95507
|
-
|
95508
|
-
if (currentRoute && typeof currentRoute.params === 'object') {
|
95509
|
-
for (var key in currentRoute.params) {
|
95510
|
-
if (!(key in location.params) && paramNames.indexOf(key) > -1) {
|
95511
|
-
location.params[key] = currentRoute.params[key];
|
95512
|
-
}
|
95513
|
-
}
|
95514
|
-
}
|
95515
|
-
|
95516
|
-
location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
|
95517
|
-
return _createRoute(record, location, redirectedFrom)
|
95518
|
-
} else if (location.path) {
|
95519
|
-
location.params = {};
|
95520
|
-
for (var i = 0; i < pathList.length; i++) {
|
95521
|
-
var path = pathList[i];
|
95522
|
-
var record$1 = pathMap[path];
|
95523
|
-
if (matchRoute(record$1.regex, location.path, location.params)) {
|
95524
|
-
return _createRoute(record$1, location, redirectedFrom)
|
95525
|
-
}
|
95526
|
-
}
|
95527
|
-
}
|
95528
|
-
// no match
|
95529
|
-
return _createRoute(null, location)
|
95530
|
-
}
|
95531
|
-
|
95532
|
-
function redirect (
|
95533
|
-
record,
|
95534
|
-
location
|
95535
|
-
) {
|
95536
|
-
var originalRedirect = record.redirect;
|
95537
|
-
var redirect = typeof originalRedirect === 'function'
|
95538
|
-
? originalRedirect(createRoute(record, location, null, router))
|
95539
|
-
: originalRedirect;
|
95540
|
-
|
95541
|
-
if (typeof redirect === 'string') {
|
95542
|
-
redirect = { path: redirect };
|
95543
|
-
}
|
95544
|
-
|
95545
|
-
if (!redirect || typeof redirect !== 'object') {
|
95546
|
-
{
|
95547
|
-
warn(
|
95548
|
-
false, ("invalid redirect option: " + (JSON.stringify(redirect)))
|
95549
|
-
);
|
95550
|
-
}
|
95551
|
-
return _createRoute(null, location)
|
95552
|
-
}
|
95553
|
-
|
95554
|
-
var re = redirect;
|
95555
|
-
var name = re.name;
|
95556
|
-
var path = re.path;
|
95557
|
-
var query = location.query;
|
95558
|
-
var hash = location.hash;
|
95559
|
-
var params = location.params;
|
95560
|
-
query = re.hasOwnProperty('query') ? re.query : query;
|
95561
|
-
hash = re.hasOwnProperty('hash') ? re.hash : hash;
|
95562
|
-
params = re.hasOwnProperty('params') ? re.params : params;
|
95563
|
-
|
95564
|
-
if (name) {
|
95565
|
-
// resolved named direct
|
95566
|
-
var targetRecord = nameMap[name];
|
95567
|
-
{
|
95568
|
-
assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
|
95569
|
-
}
|
95570
|
-
return match({
|
95571
|
-
_normalized: true,
|
95572
|
-
name: name,
|
95573
|
-
query: query,
|
95574
|
-
hash: hash,
|
95575
|
-
params: params
|
95576
|
-
}, undefined, location)
|
95577
|
-
} else if (path) {
|
95578
|
-
// 1. resolve relative redirect
|
95579
|
-
var rawPath = resolveRecordPath(path, record);
|
95580
|
-
// 2. resolve params
|
95581
|
-
var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
|
95582
|
-
// 3. rematch with existing query and hash
|
95583
|
-
return match({
|
95584
|
-
_normalized: true,
|
95585
|
-
path: resolvedPath,
|
95586
|
-
query: query,
|
95587
|
-
hash: hash
|
95588
|
-
}, undefined, location)
|
95589
|
-
} else {
|
95590
|
-
{
|
95591
|
-
warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
|
95592
|
-
}
|
95593
|
-
return _createRoute(null, location)
|
95594
|
-
}
|
95595
|
-
}
|
95596
|
-
|
95597
|
-
function alias (
|
95598
|
-
record,
|
95599
|
-
location,
|
95600
|
-
matchAs
|
95601
|
-
) {
|
95602
|
-
var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
|
95603
|
-
var aliasedMatch = match({
|
95604
|
-
_normalized: true,
|
95605
|
-
path: aliasedPath
|
95606
|
-
});
|
95607
|
-
if (aliasedMatch) {
|
95608
|
-
var matched = aliasedMatch.matched;
|
95609
|
-
var aliasedRecord = matched[matched.length - 1];
|
95610
|
-
location.params = aliasedMatch.params;
|
95611
|
-
return _createRoute(aliasedRecord, location)
|
95612
|
-
}
|
95613
|
-
return _createRoute(null, location)
|
95614
|
-
}
|
95615
|
-
|
95616
|
-
function _createRoute (
|
95617
|
-
record,
|
95618
|
-
location,
|
95619
|
-
redirectedFrom
|
95620
|
-
) {
|
95621
|
-
if (record && record.redirect) {
|
95622
|
-
return redirect(record, redirectedFrom || location)
|
95623
|
-
}
|
95624
|
-
if (record && record.matchAs) {
|
95625
|
-
return alias(record, location, record.matchAs)
|
95626
|
-
}
|
95627
|
-
return createRoute(record, location, redirectedFrom, router)
|
95628
|
-
}
|
95629
|
-
|
95630
|
-
return {
|
95631
|
-
match: match,
|
95632
|
-
addRoute: addRoute,
|
95633
|
-
getRoutes: getRoutes,
|
95634
|
-
addRoutes: addRoutes
|
95635
|
-
}
|
95636
|
-
}
|
95637
|
-
|
95638
|
-
function matchRoute (
|
95639
|
-
regex,
|
95640
|
-
path,
|
95641
|
-
params
|
95642
|
-
) {
|
95643
|
-
var m = path.match(regex);
|
95644
|
-
|
95645
|
-
if (!m) {
|
95646
|
-
return false
|
95647
|
-
} else if (!params) {
|
95648
|
-
return true
|
95649
|
-
}
|
95650
|
-
|
95651
|
-
for (var i = 1, len = m.length; i < len; ++i) {
|
95652
|
-
var key = regex.keys[i - 1];
|
95653
|
-
if (key) {
|
95654
|
-
// Fix #1994: using * with props: true generates a param named 0
|
95655
|
-
params[key.name || 'pathMatch'] = typeof m[i] === 'string' ? decode(m[i]) : m[i];
|
95656
|
-
}
|
95657
|
-
}
|
95658
|
-
|
95659
|
-
return true
|
95660
|
-
}
|
95661
|
-
|
95662
|
-
function resolveRecordPath (path, record) {
|
95663
|
-
return resolvePath(path, record.parent ? record.parent.path : '/', true)
|
95664
|
-
}
|
95665
|
-
|
95666
|
-
/* */
|
95667
|
-
|
95668
|
-
// use User Timing api (if present) for more accurate key precision
|
95669
|
-
var Time =
|
95670
|
-
inBrowser && window.performance && window.performance.now
|
95671
|
-
? window.performance
|
95672
|
-
: Date;
|
95673
|
-
|
95674
|
-
function genStateKey () {
|
95675
|
-
return Time.now().toFixed(3)
|
95676
|
-
}
|
95677
|
-
|
95678
|
-
var _key = genStateKey();
|
95679
|
-
|
95680
|
-
function getStateKey () {
|
95681
|
-
return _key
|
95682
|
-
}
|
95683
|
-
|
95684
|
-
function setStateKey (key) {
|
95685
|
-
return (_key = key)
|
95686
|
-
}
|
95687
|
-
|
95688
|
-
/* */
|
95689
|
-
|
95690
|
-
var positionStore = Object.create(null);
|
95691
|
-
|
95692
|
-
function setupScroll () {
|
95693
|
-
// Prevent browser scroll behavior on History popstate
|
95694
|
-
if ('scrollRestoration' in window.history) {
|
95695
|
-
window.history.scrollRestoration = 'manual';
|
95696
|
-
}
|
95697
|
-
// Fix for #1585 for Firefox
|
95698
|
-
// Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
|
95699
|
-
// Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
|
95700
|
-
// window.location.protocol + '//' + window.location.host
|
95701
|
-
// location.host contains the port and location.hostname doesn't
|
95702
|
-
var protocolAndPath = window.location.protocol + '//' + window.location.host;
|
95703
|
-
var absolutePath = window.location.href.replace(protocolAndPath, '');
|
95704
|
-
// preserve existing history state as it could be overriden by the user
|
95705
|
-
var stateCopy = extend({}, window.history.state);
|
95706
|
-
stateCopy.key = getStateKey();
|
95707
|
-
window.history.replaceState(stateCopy, '', absolutePath);
|
95708
|
-
window.addEventListener('popstate', handlePopState);
|
95709
|
-
return function () {
|
95710
|
-
window.removeEventListener('popstate', handlePopState);
|
95711
|
-
}
|
95712
|
-
}
|
95713
|
-
|
95714
|
-
function handleScroll (
|
95715
|
-
router,
|
95716
|
-
to,
|
95717
|
-
from,
|
95718
|
-
isPop
|
95719
|
-
) {
|
95720
|
-
if (!router.app) {
|
95721
|
-
return
|
95722
|
-
}
|
95723
|
-
|
95724
|
-
var behavior = router.options.scrollBehavior;
|
95725
|
-
if (!behavior) {
|
95726
|
-
return
|
95727
|
-
}
|
95728
|
-
|
95729
|
-
{
|
95730
|
-
assert(typeof behavior === 'function', "scrollBehavior must be a function");
|
95731
|
-
}
|
95732
|
-
|
95733
|
-
// wait until re-render finishes before scrolling
|
95734
|
-
router.app.$nextTick(function () {
|
95735
|
-
var position = getScrollPosition();
|
95736
|
-
var shouldScroll = behavior.call(
|
95737
|
-
router,
|
95738
|
-
to,
|
95739
|
-
from,
|
95740
|
-
isPop ? position : null
|
95741
|
-
);
|
95742
|
-
|
95743
|
-
if (!shouldScroll) {
|
95744
|
-
return
|
95745
|
-
}
|
95746
|
-
|
95747
|
-
if (typeof shouldScroll.then === 'function') {
|
95748
|
-
shouldScroll
|
95749
|
-
.then(function (shouldScroll) {
|
95750
|
-
scrollToPosition((shouldScroll), position);
|
95751
|
-
})
|
95752
|
-
.catch(function (err) {
|
95753
|
-
{
|
95754
|
-
assert(false, err.toString());
|
95755
|
-
}
|
95756
|
-
});
|
95757
|
-
} else {
|
95758
|
-
scrollToPosition(shouldScroll, position);
|
95759
|
-
}
|
95760
|
-
});
|
95761
|
-
}
|
95762
|
-
|
95763
|
-
function saveScrollPosition () {
|
95764
|
-
var key = getStateKey();
|
95765
|
-
if (key) {
|
95766
|
-
positionStore[key] = {
|
95767
|
-
x: window.pageXOffset,
|
95768
|
-
y: window.pageYOffset
|
95769
|
-
};
|
95770
|
-
}
|
95771
|
-
}
|
95772
|
-
|
95773
|
-
function handlePopState (e) {
|
95774
|
-
saveScrollPosition();
|
95775
|
-
if (e.state && e.state.key) {
|
95776
|
-
setStateKey(e.state.key);
|
95777
|
-
}
|
95778
|
-
}
|
95779
|
-
|
95780
|
-
function getScrollPosition () {
|
95781
|
-
var key = getStateKey();
|
95782
|
-
if (key) {
|
95783
|
-
return positionStore[key]
|
95784
|
-
}
|
95785
|
-
}
|
95786
|
-
|
95787
|
-
function getElementPosition (el, offset) {
|
95788
|
-
var docEl = document.documentElement;
|
95789
|
-
var docRect = docEl.getBoundingClientRect();
|
95790
|
-
var elRect = el.getBoundingClientRect();
|
95791
|
-
return {
|
95792
|
-
x: elRect.left - docRect.left - offset.x,
|
95793
|
-
y: elRect.top - docRect.top - offset.y
|
95794
|
-
}
|
95795
|
-
}
|
95796
|
-
|
95797
|
-
function isValidPosition (obj) {
|
95798
|
-
return isNumber(obj.x) || isNumber(obj.y)
|
95799
|
-
}
|
95800
|
-
|
95801
|
-
function normalizePosition (obj) {
|
95802
|
-
return {
|
95803
|
-
x: isNumber(obj.x) ? obj.x : window.pageXOffset,
|
95804
|
-
y: isNumber(obj.y) ? obj.y : window.pageYOffset
|
95805
|
-
}
|
95806
|
-
}
|
95807
|
-
|
95808
|
-
function normalizeOffset (obj) {
|
95809
|
-
return {
|
95810
|
-
x: isNumber(obj.x) ? obj.x : 0,
|
95811
|
-
y: isNumber(obj.y) ? obj.y : 0
|
95812
|
-
}
|
95813
|
-
}
|
95814
|
-
|
95815
|
-
function isNumber (v) {
|
95816
|
-
return typeof v === 'number'
|
95817
|
-
}
|
95818
|
-
|
95819
|
-
var hashStartsWithNumberRE = /^#\d/;
|
95820
|
-
|
95821
|
-
function scrollToPosition (shouldScroll, position) {
|
95822
|
-
var isObject = typeof shouldScroll === 'object';
|
95823
|
-
if (isObject && typeof shouldScroll.selector === 'string') {
|
95824
|
-
// getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
|
95825
|
-
// but at the same time, it doesn't make much sense to select an element with an id and an extra selector
|
95826
|
-
var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
|
95827
|
-
? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
|
95828
|
-
: document.querySelector(shouldScroll.selector);
|
95829
|
-
|
95830
|
-
if (el) {
|
95831
|
-
var offset =
|
95832
|
-
shouldScroll.offset && typeof shouldScroll.offset === 'object'
|
95833
|
-
? shouldScroll.offset
|
95834
|
-
: {};
|
95835
|
-
offset = normalizeOffset(offset);
|
95836
|
-
position = getElementPosition(el, offset);
|
95837
|
-
} else if (isValidPosition(shouldScroll)) {
|
95838
|
-
position = normalizePosition(shouldScroll);
|
95839
|
-
}
|
95840
|
-
} else if (isObject && isValidPosition(shouldScroll)) {
|
95841
|
-
position = normalizePosition(shouldScroll);
|
95842
|
-
}
|
95843
|
-
|
95844
|
-
if (position) {
|
95845
|
-
// $flow-disable-line
|
95846
|
-
if ('scrollBehavior' in document.documentElement.style) {
|
95847
|
-
window.scrollTo({
|
95848
|
-
left: position.x,
|
95849
|
-
top: position.y,
|
95850
|
-
// $flow-disable-line
|
95851
|
-
behavior: shouldScroll.behavior
|
95852
|
-
});
|
95853
|
-
} else {
|
95854
|
-
window.scrollTo(position.x, position.y);
|
95855
|
-
}
|
95856
|
-
}
|
95857
|
-
}
|
95858
|
-
|
95859
|
-
/* */
|
95860
|
-
|
95861
|
-
var supportsPushState =
|
95862
|
-
inBrowser &&
|
95863
|
-
(function () {
|
95864
|
-
var ua = window.navigator.userAgent;
|
95865
|
-
|
95866
|
-
if (
|
95867
|
-
(ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
|
95868
|
-
ua.indexOf('Mobile Safari') !== -1 &&
|
95869
|
-
ua.indexOf('Chrome') === -1 &&
|
95870
|
-
ua.indexOf('Windows Phone') === -1
|
95871
|
-
) {
|
95872
|
-
return false
|
95873
|
-
}
|
95874
|
-
|
95875
|
-
return window.history && typeof window.history.pushState === 'function'
|
95876
|
-
})();
|
95877
|
-
|
95878
|
-
function pushState (url, replace) {
|
95879
|
-
saveScrollPosition();
|
95880
|
-
// try...catch the pushState call to get around Safari
|
95881
|
-
// DOM Exception 18 where it limits to 100 pushState calls
|
95882
|
-
var history = window.history;
|
95883
|
-
try {
|
95884
|
-
if (replace) {
|
95885
|
-
// preserve existing history state as it could be overriden by the user
|
95886
|
-
var stateCopy = extend({}, history.state);
|
95887
|
-
stateCopy.key = getStateKey();
|
95888
|
-
history.replaceState(stateCopy, '', url);
|
95889
|
-
} else {
|
95890
|
-
history.pushState({ key: setStateKey(genStateKey()) }, '', url);
|
95891
|
-
}
|
95892
|
-
} catch (e) {
|
95893
|
-
window.location[replace ? 'replace' : 'assign'](url);
|
95894
|
-
}
|
95895
|
-
}
|
95896
|
-
|
95897
|
-
function replaceState (url) {
|
95898
|
-
pushState(url, true);
|
95899
|
-
}
|
95900
|
-
|
95901
|
-
// When changing thing, also edit router.d.ts
|
95902
|
-
var NavigationFailureType = {
|
95903
|
-
redirected: 2,
|
95904
|
-
aborted: 4,
|
95905
|
-
cancelled: 8,
|
95906
|
-
duplicated: 16
|
95907
|
-
};
|
95908
|
-
|
95909
|
-
function createNavigationRedirectedError (from, to) {
|
95910
|
-
return createRouterError(
|
95911
|
-
from,
|
95912
|
-
to,
|
95913
|
-
NavigationFailureType.redirected,
|
95914
|
-
("Redirected when going from \"" + (from.fullPath) + "\" to \"" + (stringifyRoute(
|
95915
|
-
to
|
95916
|
-
)) + "\" via a navigation guard.")
|
95917
|
-
)
|
95918
|
-
}
|
95919
|
-
|
95920
|
-
function createNavigationDuplicatedError (from, to) {
|
95921
|
-
var error = createRouterError(
|
95922
|
-
from,
|
95923
|
-
to,
|
95924
|
-
NavigationFailureType.duplicated,
|
95925
|
-
("Avoided redundant navigation to current location: \"" + (from.fullPath) + "\".")
|
95926
|
-
);
|
95927
|
-
// backwards compatible with the first introduction of Errors
|
95928
|
-
error.name = 'NavigationDuplicated';
|
95929
|
-
return error
|
95930
|
-
}
|
95931
|
-
|
95932
|
-
function createNavigationCancelledError (from, to) {
|
95933
|
-
return createRouterError(
|
95934
|
-
from,
|
95935
|
-
to,
|
95936
|
-
NavigationFailureType.cancelled,
|
95937
|
-
("Navigation cancelled from \"" + (from.fullPath) + "\" to \"" + (to.fullPath) + "\" with a new navigation.")
|
95938
|
-
)
|
95939
|
-
}
|
95940
|
-
|
95941
|
-
function createNavigationAbortedError (from, to) {
|
95942
|
-
return createRouterError(
|
95943
|
-
from,
|
95944
|
-
to,
|
95945
|
-
NavigationFailureType.aborted,
|
95946
|
-
("Navigation aborted from \"" + (from.fullPath) + "\" to \"" + (to.fullPath) + "\" via a navigation guard.")
|
95947
|
-
)
|
95948
|
-
}
|
95949
|
-
|
95950
|
-
function createRouterError (from, to, type, message) {
|
95951
|
-
var error = new Error(message);
|
95952
|
-
error._isRouter = true;
|
95953
|
-
error.from = from;
|
95954
|
-
error.to = to;
|
95955
|
-
error.type = type;
|
95956
|
-
|
95957
|
-
return error
|
95958
|
-
}
|
95959
|
-
|
95960
|
-
var propertiesToLog = ['params', 'query', 'hash'];
|
95961
|
-
|
95962
|
-
function stringifyRoute (to) {
|
95963
|
-
if (typeof to === 'string') { return to }
|
95964
|
-
if ('path' in to) { return to.path }
|
95965
|
-
var location = {};
|
95966
|
-
propertiesToLog.forEach(function (key) {
|
95967
|
-
if (key in to) { location[key] = to[key]; }
|
95968
|
-
});
|
95969
|
-
return JSON.stringify(location, null, 2)
|
95970
|
-
}
|
95971
|
-
|
95972
|
-
function isError (err) {
|
95973
|
-
return Object.prototype.toString.call(err).indexOf('Error') > -1
|
95974
|
-
}
|
95975
|
-
|
95976
|
-
function isNavigationFailure (err, errorType) {
|
95977
|
-
return (
|
95978
|
-
isError(err) &&
|
95979
|
-
err._isRouter &&
|
95980
|
-
(errorType == null || err.type === errorType)
|
95981
|
-
)
|
95982
|
-
}
|
95983
|
-
|
95984
|
-
/* */
|
95985
|
-
|
95986
|
-
function runQueue (queue, fn, cb) {
|
95987
|
-
var step = function (index) {
|
95988
|
-
if (index >= queue.length) {
|
95989
|
-
cb();
|
95990
|
-
} else {
|
95991
|
-
if (queue[index]) {
|
95992
|
-
fn(queue[index], function () {
|
95993
|
-
step(index + 1);
|
95994
|
-
});
|
95995
|
-
} else {
|
95996
|
-
step(index + 1);
|
95997
|
-
}
|
95998
|
-
}
|
95999
|
-
};
|
96000
|
-
step(0);
|
96001
|
-
}
|
96002
|
-
|
96003
|
-
/* */
|
96004
|
-
|
96005
|
-
function resolveAsyncComponents (matched) {
|
96006
|
-
return function (to, from, next) {
|
96007
|
-
var hasAsync = false;
|
96008
|
-
var pending = 0;
|
96009
|
-
var error = null;
|
96010
|
-
|
96011
|
-
flatMapComponents(matched, function (def, _, match, key) {
|
96012
|
-
// if it's a function and doesn't have cid attached,
|
96013
|
-
// assume it's an async component resolve function.
|
96014
|
-
// we are not using Vue's default async resolving mechanism because
|
96015
|
-
// we want to halt the navigation until the incoming component has been
|
96016
|
-
// resolved.
|
96017
|
-
if (typeof def === 'function' && def.cid === undefined) {
|
96018
|
-
hasAsync = true;
|
96019
|
-
pending++;
|
96020
|
-
|
96021
|
-
var resolve = once(function (resolvedDef) {
|
96022
|
-
if (isESModule(resolvedDef)) {
|
96023
|
-
resolvedDef = resolvedDef.default;
|
96024
|
-
}
|
96025
|
-
// save resolved on async factory in case it's used elsewhere
|
96026
|
-
def.resolved = typeof resolvedDef === 'function'
|
96027
|
-
? resolvedDef
|
96028
|
-
: _Vue.extend(resolvedDef);
|
96029
|
-
match.components[key] = resolvedDef;
|
96030
|
-
pending--;
|
96031
|
-
if (pending <= 0) {
|
96032
|
-
next();
|
96033
|
-
}
|
96034
|
-
});
|
96035
|
-
|
96036
|
-
var reject = once(function (reason) {
|
96037
|
-
var msg = "Failed to resolve async component " + key + ": " + reason;
|
96038
|
-
warn(false, msg);
|
96039
|
-
if (!error) {
|
96040
|
-
error = isError(reason)
|
96041
|
-
? reason
|
96042
|
-
: new Error(msg);
|
96043
|
-
next(error);
|
96044
|
-
}
|
96045
|
-
});
|
96046
|
-
|
96047
|
-
var res;
|
96048
|
-
try {
|
96049
|
-
res = def(resolve, reject);
|
96050
|
-
} catch (e) {
|
96051
|
-
reject(e);
|
96052
|
-
}
|
96053
|
-
if (res) {
|
96054
|
-
if (typeof res.then === 'function') {
|
96055
|
-
res.then(resolve, reject);
|
96056
|
-
} else {
|
96057
|
-
// new syntax in Vue 2.3
|
96058
|
-
var comp = res.component;
|
96059
|
-
if (comp && typeof comp.then === 'function') {
|
96060
|
-
comp.then(resolve, reject);
|
96061
|
-
}
|
96062
|
-
}
|
96063
|
-
}
|
96064
|
-
}
|
96065
|
-
});
|
96066
|
-
|
96067
|
-
if (!hasAsync) { next(); }
|
96068
|
-
}
|
96069
|
-
}
|
96070
|
-
|
96071
|
-
function flatMapComponents (
|
96072
|
-
matched,
|
96073
|
-
fn
|
96074
|
-
) {
|
96075
|
-
return flatten(matched.map(function (m) {
|
96076
|
-
return Object.keys(m.components).map(function (key) { return fn(
|
96077
|
-
m.components[key],
|
96078
|
-
m.instances[key],
|
96079
|
-
m, key
|
96080
|
-
); })
|
96081
|
-
}))
|
96082
|
-
}
|
96083
|
-
|
96084
|
-
function flatten (arr) {
|
96085
|
-
return Array.prototype.concat.apply([], arr)
|
96086
|
-
}
|
96087
|
-
|
96088
|
-
var hasSymbol =
|
96089
|
-
typeof Symbol === 'function' &&
|
96090
|
-
typeof Symbol.toStringTag === 'symbol';
|
96091
|
-
|
96092
|
-
function isESModule (obj) {
|
96093
|
-
return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
|
96094
|
-
}
|
96095
|
-
|
96096
|
-
// in Webpack 2, require.ensure now also returns a Promise
|
96097
|
-
// so the resolve/reject functions may get called an extra time
|
96098
|
-
// if the user uses an arrow function shorthand that happens to
|
96099
|
-
// return that Promise.
|
96100
|
-
function once (fn) {
|
96101
|
-
var called = false;
|
96102
|
-
return function () {
|
96103
|
-
var args = [], len = arguments.length;
|
96104
|
-
while ( len-- ) args[ len ] = arguments[ len ];
|
96105
|
-
|
96106
|
-
if (called) { return }
|
96107
|
-
called = true;
|
96108
|
-
return fn.apply(this, args)
|
96109
|
-
}
|
96110
|
-
}
|
96111
|
-
|
96112
|
-
/* */
|
96113
|
-
|
96114
|
-
var History = function History (router, base) {
|
96115
|
-
this.router = router;
|
96116
|
-
this.base = normalizeBase(base);
|
96117
|
-
// start with a route object that stands for "nowhere"
|
96118
|
-
this.current = START;
|
96119
|
-
this.pending = null;
|
96120
|
-
this.ready = false;
|
96121
|
-
this.readyCbs = [];
|
96122
|
-
this.readyErrorCbs = [];
|
96123
|
-
this.errorCbs = [];
|
96124
|
-
this.listeners = [];
|
96125
|
-
};
|
96126
|
-
|
96127
|
-
History.prototype.listen = function listen (cb) {
|
96128
|
-
this.cb = cb;
|
96129
|
-
};
|
96130
|
-
|
96131
|
-
History.prototype.onReady = function onReady (cb, errorCb) {
|
96132
|
-
if (this.ready) {
|
96133
|
-
cb();
|
96134
|
-
} else {
|
96135
|
-
this.readyCbs.push(cb);
|
96136
|
-
if (errorCb) {
|
96137
|
-
this.readyErrorCbs.push(errorCb);
|
96138
|
-
}
|
96139
|
-
}
|
96140
|
-
};
|
96141
|
-
|
96142
|
-
History.prototype.onError = function onError (errorCb) {
|
96143
|
-
this.errorCbs.push(errorCb);
|
96144
|
-
};
|
96145
|
-
|
96146
|
-
History.prototype.transitionTo = function transitionTo (
|
96147
|
-
location,
|
96148
|
-
onComplete,
|
96149
|
-
onAbort
|
96150
|
-
) {
|
96151
|
-
var this$1$1 = this;
|
96152
|
-
|
96153
|
-
var route;
|
96154
|
-
// catch redirect option https://github.com/vuejs/vue-router/issues/3201
|
96155
|
-
try {
|
96156
|
-
route = this.router.match(location, this.current);
|
96157
|
-
} catch (e) {
|
96158
|
-
this.errorCbs.forEach(function (cb) {
|
96159
|
-
cb(e);
|
96160
|
-
});
|
96161
|
-
// Exception should still be thrown
|
96162
|
-
throw e
|
96163
|
-
}
|
96164
|
-
var prev = this.current;
|
96165
|
-
this.confirmTransition(
|
96166
|
-
route,
|
96167
|
-
function () {
|
96168
|
-
this$1$1.updateRoute(route);
|
96169
|
-
onComplete && onComplete(route);
|
96170
|
-
this$1$1.ensureURL();
|
96171
|
-
this$1$1.router.afterHooks.forEach(function (hook) {
|
96172
|
-
hook && hook(route, prev);
|
96173
|
-
});
|
96174
|
-
|
96175
|
-
// fire ready cbs once
|
96176
|
-
if (!this$1$1.ready) {
|
96177
|
-
this$1$1.ready = true;
|
96178
|
-
this$1$1.readyCbs.forEach(function (cb) {
|
96179
|
-
cb(route);
|
96180
|
-
});
|
96181
|
-
}
|
96182
|
-
},
|
96183
|
-
function (err) {
|
96184
|
-
if (onAbort) {
|
96185
|
-
onAbort(err);
|
96186
|
-
}
|
96187
|
-
if (err && !this$1$1.ready) {
|
96188
|
-
// Initial redirection should not mark the history as ready yet
|
96189
|
-
// because it's triggered by the redirection instead
|
96190
|
-
// https://github.com/vuejs/vue-router/issues/3225
|
96191
|
-
// https://github.com/vuejs/vue-router/issues/3331
|
96192
|
-
if (!isNavigationFailure(err, NavigationFailureType.redirected) || prev !== START) {
|
96193
|
-
this$1$1.ready = true;
|
96194
|
-
this$1$1.readyErrorCbs.forEach(function (cb) {
|
96195
|
-
cb(err);
|
96196
|
-
});
|
96197
|
-
}
|
96198
|
-
}
|
96199
|
-
}
|
96200
|
-
);
|
96201
|
-
};
|
96202
|
-
|
96203
|
-
History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
|
96204
|
-
var this$1$1 = this;
|
96205
|
-
|
96206
|
-
var current = this.current;
|
96207
|
-
this.pending = route;
|
96208
|
-
var abort = function (err) {
|
96209
|
-
// changed after adding errors with
|
96210
|
-
// https://github.com/vuejs/vue-router/pull/3047 before that change,
|
96211
|
-
// redirect and aborted navigation would produce an err == null
|
96212
|
-
if (!isNavigationFailure(err) && isError(err)) {
|
96213
|
-
if (this$1$1.errorCbs.length) {
|
96214
|
-
this$1$1.errorCbs.forEach(function (cb) {
|
96215
|
-
cb(err);
|
96216
|
-
});
|
96217
|
-
} else {
|
96218
|
-
{
|
96219
|
-
warn(false, 'uncaught error during route navigation:');
|
96220
|
-
}
|
96221
|
-
console.error(err);
|
96222
|
-
}
|
96223
|
-
}
|
96224
|
-
onAbort && onAbort(err);
|
96225
|
-
};
|
96226
|
-
var lastRouteIndex = route.matched.length - 1;
|
96227
|
-
var lastCurrentIndex = current.matched.length - 1;
|
96228
|
-
if (
|
96229
|
-
isSameRoute(route, current) &&
|
96230
|
-
// in the case the route map has been dynamically appended to
|
96231
|
-
lastRouteIndex === lastCurrentIndex &&
|
96232
|
-
route.matched[lastRouteIndex] === current.matched[lastCurrentIndex]
|
96233
|
-
) {
|
96234
|
-
this.ensureURL();
|
96235
|
-
if (route.hash) {
|
96236
|
-
handleScroll(this.router, current, route, false);
|
96237
|
-
}
|
96238
|
-
return abort(createNavigationDuplicatedError(current, route))
|
96239
|
-
}
|
96240
|
-
|
96241
|
-
var ref = resolveQueue(
|
96242
|
-
this.current.matched,
|
96243
|
-
route.matched
|
96244
|
-
);
|
96245
|
-
var updated = ref.updated;
|
96246
|
-
var deactivated = ref.deactivated;
|
96247
|
-
var activated = ref.activated;
|
96248
|
-
|
96249
|
-
var queue = [].concat(
|
96250
|
-
// in-component leave guards
|
96251
|
-
extractLeaveGuards(deactivated),
|
96252
|
-
// global before hooks
|
96253
|
-
this.router.beforeHooks,
|
96254
|
-
// in-component update hooks
|
96255
|
-
extractUpdateHooks(updated),
|
96256
|
-
// in-config enter guards
|
96257
|
-
activated.map(function (m) { return m.beforeEnter; }),
|
96258
|
-
// async components
|
96259
|
-
resolveAsyncComponents(activated)
|
96260
|
-
);
|
96261
|
-
|
96262
|
-
var iterator = function (hook, next) {
|
96263
|
-
if (this$1$1.pending !== route) {
|
96264
|
-
return abort(createNavigationCancelledError(current, route))
|
96265
|
-
}
|
96266
|
-
try {
|
96267
|
-
hook(route, current, function (to) {
|
96268
|
-
if (to === false) {
|
96269
|
-
// next(false) -> abort navigation, ensure current URL
|
96270
|
-
this$1$1.ensureURL(true);
|
96271
|
-
abort(createNavigationAbortedError(current, route));
|
96272
|
-
} else if (isError(to)) {
|
96273
|
-
this$1$1.ensureURL(true);
|
96274
|
-
abort(to);
|
96275
|
-
} else if (
|
96276
|
-
typeof to === 'string' ||
|
96277
|
-
(typeof to === 'object' &&
|
96278
|
-
(typeof to.path === 'string' || typeof to.name === 'string'))
|
96279
|
-
) {
|
96280
|
-
// next('/') or next({ path: '/' }) -> redirect
|
96281
|
-
abort(createNavigationRedirectedError(current, route));
|
96282
|
-
if (typeof to === 'object' && to.replace) {
|
96283
|
-
this$1$1.replace(to);
|
96284
|
-
} else {
|
96285
|
-
this$1$1.push(to);
|
96286
|
-
}
|
96287
|
-
} else {
|
96288
|
-
// confirm transition and pass on the value
|
96289
|
-
next(to);
|
96290
|
-
}
|
96291
|
-
});
|
96292
|
-
} catch (e) {
|
96293
|
-
abort(e);
|
96294
|
-
}
|
96295
|
-
};
|
96296
|
-
|
96297
|
-
runQueue(queue, iterator, function () {
|
96298
|
-
// wait until async components are resolved before
|
96299
|
-
// extracting in-component enter guards
|
96300
|
-
var enterGuards = extractEnterGuards(activated);
|
96301
|
-
var queue = enterGuards.concat(this$1$1.router.resolveHooks);
|
96302
|
-
runQueue(queue, iterator, function () {
|
96303
|
-
if (this$1$1.pending !== route) {
|
96304
|
-
return abort(createNavigationCancelledError(current, route))
|
96305
|
-
}
|
96306
|
-
this$1$1.pending = null;
|
96307
|
-
onComplete(route);
|
96308
|
-
if (this$1$1.router.app) {
|
96309
|
-
this$1$1.router.app.$nextTick(function () {
|
96310
|
-
handleRouteEntered(route);
|
96311
|
-
});
|
96312
|
-
}
|
96313
|
-
});
|
96314
|
-
});
|
96315
|
-
};
|
96316
|
-
|
96317
|
-
History.prototype.updateRoute = function updateRoute (route) {
|
96318
|
-
this.current = route;
|
96319
|
-
this.cb && this.cb(route);
|
96320
|
-
};
|
96321
|
-
|
96322
|
-
History.prototype.setupListeners = function setupListeners () {
|
96323
|
-
// Default implementation is empty
|
96324
|
-
};
|
96325
|
-
|
96326
|
-
History.prototype.teardown = function teardown () {
|
96327
|
-
// clean up event listeners
|
96328
|
-
// https://github.com/vuejs/vue-router/issues/2341
|
96329
|
-
this.listeners.forEach(function (cleanupListener) {
|
96330
|
-
cleanupListener();
|
96331
|
-
});
|
96332
|
-
this.listeners = [];
|
96333
|
-
|
96334
|
-
// reset current history route
|
96335
|
-
// https://github.com/vuejs/vue-router/issues/3294
|
96336
|
-
this.current = START;
|
96337
|
-
this.pending = null;
|
96338
|
-
};
|
96339
|
-
|
96340
|
-
function normalizeBase (base) {
|
96341
|
-
if (!base) {
|
96342
|
-
if (inBrowser) {
|
96343
|
-
// respect <base> tag
|
96344
|
-
var baseEl = document.querySelector('base');
|
96345
|
-
base = (baseEl && baseEl.getAttribute('href')) || '/';
|
96346
|
-
// strip full URL origin
|
96347
|
-
base = base.replace(/^https?:\/\/[^\/]+/, '');
|
96348
|
-
} else {
|
96349
|
-
base = '/';
|
96350
|
-
}
|
96351
|
-
}
|
96352
|
-
// make sure there's the starting slash
|
96353
|
-
if (base.charAt(0) !== '/') {
|
96354
|
-
base = '/' + base;
|
96355
|
-
}
|
96356
|
-
// remove trailing slash
|
96357
|
-
return base.replace(/\/$/, '')
|
96358
|
-
}
|
96359
|
-
|
96360
|
-
function resolveQueue (
|
96361
|
-
current,
|
96362
|
-
next
|
96363
|
-
) {
|
96364
|
-
var i;
|
96365
|
-
var max = Math.max(current.length, next.length);
|
96366
|
-
for (i = 0; i < max; i++) {
|
96367
|
-
if (current[i] !== next[i]) {
|
96368
|
-
break
|
96369
|
-
}
|
96370
|
-
}
|
96371
|
-
return {
|
96372
|
-
updated: next.slice(0, i),
|
96373
|
-
activated: next.slice(i),
|
96374
|
-
deactivated: current.slice(i)
|
96375
|
-
}
|
96376
|
-
}
|
96377
|
-
|
96378
|
-
function extractGuards (
|
96379
|
-
records,
|
96380
|
-
name,
|
96381
|
-
bind,
|
96382
|
-
reverse
|
96383
|
-
) {
|
96384
|
-
var guards = flatMapComponents(records, function (def, instance, match, key) {
|
96385
|
-
var guard = extractGuard(def, name);
|
96386
|
-
if (guard) {
|
96387
|
-
return Array.isArray(guard)
|
96388
|
-
? guard.map(function (guard) { return bind(guard, instance, match, key); })
|
96389
|
-
: bind(guard, instance, match, key)
|
96390
|
-
}
|
96391
|
-
});
|
96392
|
-
return flatten(reverse ? guards.reverse() : guards)
|
96393
|
-
}
|
96394
|
-
|
96395
|
-
function extractGuard (
|
96396
|
-
def,
|
96397
|
-
key
|
96398
|
-
) {
|
96399
|
-
if (typeof def !== 'function') {
|
96400
|
-
// extend now so that global mixins are applied.
|
96401
|
-
def = _Vue.extend(def);
|
96402
|
-
}
|
96403
|
-
return def.options[key]
|
96404
|
-
}
|
96405
|
-
|
96406
|
-
function extractLeaveGuards (deactivated) {
|
96407
|
-
return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
|
96408
|
-
}
|
96409
|
-
|
96410
|
-
function extractUpdateHooks (updated) {
|
96411
|
-
return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
|
96412
|
-
}
|
96413
|
-
|
96414
|
-
function bindGuard (guard, instance) {
|
96415
|
-
if (instance) {
|
96416
|
-
return function boundRouteGuard () {
|
96417
|
-
return guard.apply(instance, arguments)
|
96418
|
-
}
|
96419
|
-
}
|
96420
|
-
}
|
96421
|
-
|
96422
|
-
function extractEnterGuards (
|
96423
|
-
activated
|
96424
|
-
) {
|
96425
|
-
return extractGuards(
|
96426
|
-
activated,
|
96427
|
-
'beforeRouteEnter',
|
96428
|
-
function (guard, _, match, key) {
|
96429
|
-
return bindEnterGuard(guard, match, key)
|
96430
|
-
}
|
96431
|
-
)
|
96432
|
-
}
|
96433
|
-
|
96434
|
-
function bindEnterGuard (
|
96435
|
-
guard,
|
96436
|
-
match,
|
96437
|
-
key
|
96438
|
-
) {
|
96439
|
-
return function routeEnterGuard (to, from, next) {
|
96440
|
-
return guard(to, from, function (cb) {
|
96441
|
-
if (typeof cb === 'function') {
|
96442
|
-
if (!match.enteredCbs[key]) {
|
96443
|
-
match.enteredCbs[key] = [];
|
96444
|
-
}
|
96445
|
-
match.enteredCbs[key].push(cb);
|
96446
|
-
}
|
96447
|
-
next(cb);
|
96448
|
-
})
|
96449
|
-
}
|
96450
|
-
}
|
96451
|
-
|
96452
|
-
/* */
|
96453
|
-
|
96454
|
-
var HTML5History = /*@__PURE__*/(function (History) {
|
96455
|
-
function HTML5History (router, base) {
|
96456
|
-
History.call(this, router, base);
|
96457
|
-
|
96458
|
-
this._startLocation = getLocation(this.base);
|
96459
|
-
}
|
96460
|
-
|
96461
|
-
if ( History ) HTML5History.__proto__ = History;
|
96462
|
-
HTML5History.prototype = Object.create( History && History.prototype );
|
96463
|
-
HTML5History.prototype.constructor = HTML5History;
|
96464
|
-
|
96465
|
-
HTML5History.prototype.setupListeners = function setupListeners () {
|
96466
|
-
var this$1$1 = this;
|
96467
|
-
|
96468
|
-
if (this.listeners.length > 0) {
|
96469
|
-
return
|
96470
|
-
}
|
96471
|
-
|
96472
|
-
var router = this.router;
|
96473
|
-
var expectScroll = router.options.scrollBehavior;
|
96474
|
-
var supportsScroll = supportsPushState && expectScroll;
|
96475
|
-
|
96476
|
-
if (supportsScroll) {
|
96477
|
-
this.listeners.push(setupScroll());
|
96478
|
-
}
|
96479
|
-
|
96480
|
-
var handleRoutingEvent = function () {
|
96481
|
-
var current = this$1$1.current;
|
96482
|
-
|
96483
|
-
// Avoiding first `popstate` event dispatched in some browsers but first
|
96484
|
-
// history route not updated since async guard at the same time.
|
96485
|
-
var location = getLocation(this$1$1.base);
|
96486
|
-
if (this$1$1.current === START && location === this$1$1._startLocation) {
|
96487
|
-
return
|
96488
|
-
}
|
96489
|
-
|
96490
|
-
this$1$1.transitionTo(location, function (route) {
|
96491
|
-
if (supportsScroll) {
|
96492
|
-
handleScroll(router, route, current, true);
|
96493
|
-
}
|
96494
|
-
});
|
96495
|
-
};
|
96496
|
-
window.addEventListener('popstate', handleRoutingEvent);
|
96497
|
-
this.listeners.push(function () {
|
96498
|
-
window.removeEventListener('popstate', handleRoutingEvent);
|
96499
|
-
});
|
96500
|
-
};
|
96501
|
-
|
96502
|
-
HTML5History.prototype.go = function go (n) {
|
96503
|
-
window.history.go(n);
|
96504
|
-
};
|
96505
|
-
|
96506
|
-
HTML5History.prototype.push = function push (location, onComplete, onAbort) {
|
96507
|
-
var this$1$1 = this;
|
96508
|
-
|
96509
|
-
var ref = this;
|
96510
|
-
var fromRoute = ref.current;
|
96511
|
-
this.transitionTo(location, function (route) {
|
96512
|
-
pushState(cleanPath(this$1$1.base + route.fullPath));
|
96513
|
-
handleScroll(this$1$1.router, route, fromRoute, false);
|
96514
|
-
onComplete && onComplete(route);
|
96515
|
-
}, onAbort);
|
96516
|
-
};
|
96517
|
-
|
96518
|
-
HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
|
96519
|
-
var this$1$1 = this;
|
96520
|
-
|
96521
|
-
var ref = this;
|
96522
|
-
var fromRoute = ref.current;
|
96523
|
-
this.transitionTo(location, function (route) {
|
96524
|
-
replaceState(cleanPath(this$1$1.base + route.fullPath));
|
96525
|
-
handleScroll(this$1$1.router, route, fromRoute, false);
|
96526
|
-
onComplete && onComplete(route);
|
96527
|
-
}, onAbort);
|
96528
|
-
};
|
96529
|
-
|
96530
|
-
HTML5History.prototype.ensureURL = function ensureURL (push) {
|
96531
|
-
if (getLocation(this.base) !== this.current.fullPath) {
|
96532
|
-
var current = cleanPath(this.base + this.current.fullPath);
|
96533
|
-
push ? pushState(current) : replaceState(current);
|
96534
|
-
}
|
96535
|
-
};
|
96536
|
-
|
96537
|
-
HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
|
96538
|
-
return getLocation(this.base)
|
96539
|
-
};
|
96540
|
-
|
96541
|
-
return HTML5History;
|
96542
|
-
}(History));
|
96543
|
-
|
96544
|
-
function getLocation (base) {
|
96545
|
-
var path = window.location.pathname;
|
96546
|
-
var pathLowerCase = path.toLowerCase();
|
96547
|
-
var baseLowerCase = base.toLowerCase();
|
96548
|
-
// base="/a" shouldn't turn path="/app" into "/a/pp"
|
96549
|
-
// https://github.com/vuejs/vue-router/issues/3555
|
96550
|
-
// so we ensure the trailing slash in the base
|
96551
|
-
if (base && ((pathLowerCase === baseLowerCase) ||
|
96552
|
-
(pathLowerCase.indexOf(cleanPath(baseLowerCase + '/')) === 0))) {
|
96553
|
-
path = path.slice(base.length);
|
96554
|
-
}
|
96555
|
-
return (path || '/') + window.location.search + window.location.hash
|
96556
|
-
}
|
96557
|
-
|
96558
|
-
/* */
|
96559
|
-
|
96560
|
-
var HashHistory = /*@__PURE__*/(function (History) {
|
96561
|
-
function HashHistory (router, base, fallback) {
|
96562
|
-
History.call(this, router, base);
|
96563
|
-
// check history fallback deeplinking
|
96564
|
-
if (fallback && checkFallback(this.base)) {
|
96565
|
-
return
|
96566
|
-
}
|
96567
|
-
ensureSlash();
|
96568
|
-
}
|
96569
|
-
|
96570
|
-
if ( History ) HashHistory.__proto__ = History;
|
96571
|
-
HashHistory.prototype = Object.create( History && History.prototype );
|
96572
|
-
HashHistory.prototype.constructor = HashHistory;
|
96573
|
-
|
96574
|
-
// this is delayed until the app mounts
|
96575
|
-
// to avoid the hashchange listener being fired too early
|
96576
|
-
HashHistory.prototype.setupListeners = function setupListeners () {
|
96577
|
-
var this$1$1 = this;
|
96578
|
-
|
96579
|
-
if (this.listeners.length > 0) {
|
96580
|
-
return
|
96581
|
-
}
|
96582
|
-
|
96583
|
-
var router = this.router;
|
96584
|
-
var expectScroll = router.options.scrollBehavior;
|
96585
|
-
var supportsScroll = supportsPushState && expectScroll;
|
96586
|
-
|
96587
|
-
if (supportsScroll) {
|
96588
|
-
this.listeners.push(setupScroll());
|
96589
|
-
}
|
96590
|
-
|
96591
|
-
var handleRoutingEvent = function () {
|
96592
|
-
var current = this$1$1.current;
|
96593
|
-
if (!ensureSlash()) {
|
96594
|
-
return
|
96595
|
-
}
|
96596
|
-
this$1$1.transitionTo(getHash(), function (route) {
|
96597
|
-
if (supportsScroll) {
|
96598
|
-
handleScroll(this$1$1.router, route, current, true);
|
96599
|
-
}
|
96600
|
-
if (!supportsPushState) {
|
96601
|
-
replaceHash(route.fullPath);
|
96602
|
-
}
|
96603
|
-
});
|
96604
|
-
};
|
96605
|
-
var eventType = supportsPushState ? 'popstate' : 'hashchange';
|
96606
|
-
window.addEventListener(
|
96607
|
-
eventType,
|
96608
|
-
handleRoutingEvent
|
96609
|
-
);
|
96610
|
-
this.listeners.push(function () {
|
96611
|
-
window.removeEventListener(eventType, handleRoutingEvent);
|
96612
|
-
});
|
96613
|
-
};
|
96614
|
-
|
96615
|
-
HashHistory.prototype.push = function push (location, onComplete, onAbort) {
|
96616
|
-
var this$1$1 = this;
|
96617
|
-
|
96618
|
-
var ref = this;
|
96619
|
-
var fromRoute = ref.current;
|
96620
|
-
this.transitionTo(
|
96621
|
-
location,
|
96622
|
-
function (route) {
|
96623
|
-
pushHash(route.fullPath);
|
96624
|
-
handleScroll(this$1$1.router, route, fromRoute, false);
|
96625
|
-
onComplete && onComplete(route);
|
96626
|
-
},
|
96627
|
-
onAbort
|
96628
|
-
);
|
96629
|
-
};
|
96630
|
-
|
96631
|
-
HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
|
96632
|
-
var this$1$1 = this;
|
96633
|
-
|
96634
|
-
var ref = this;
|
96635
|
-
var fromRoute = ref.current;
|
96636
|
-
this.transitionTo(
|
96637
|
-
location,
|
96638
|
-
function (route) {
|
96639
|
-
replaceHash(route.fullPath);
|
96640
|
-
handleScroll(this$1$1.router, route, fromRoute, false);
|
96641
|
-
onComplete && onComplete(route);
|
96642
|
-
},
|
96643
|
-
onAbort
|
96644
|
-
);
|
96645
|
-
};
|
96646
|
-
|
96647
|
-
HashHistory.prototype.go = function go (n) {
|
96648
|
-
window.history.go(n);
|
96649
|
-
};
|
96650
|
-
|
96651
|
-
HashHistory.prototype.ensureURL = function ensureURL (push) {
|
96652
|
-
var current = this.current.fullPath;
|
96653
|
-
if (getHash() !== current) {
|
96654
|
-
push ? pushHash(current) : replaceHash(current);
|
96655
|
-
}
|
96656
|
-
};
|
96657
|
-
|
96658
|
-
HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
|
96659
|
-
return getHash()
|
96660
|
-
};
|
96661
|
-
|
96662
|
-
return HashHistory;
|
96663
|
-
}(History));
|
96664
|
-
|
96665
|
-
function checkFallback (base) {
|
96666
|
-
var location = getLocation(base);
|
96667
|
-
if (!/^\/#/.test(location)) {
|
96668
|
-
window.location.replace(cleanPath(base + '/#' + location));
|
96669
|
-
return true
|
96670
|
-
}
|
96671
|
-
}
|
96672
|
-
|
96673
|
-
function ensureSlash () {
|
96674
|
-
var path = getHash();
|
96675
|
-
if (path.charAt(0) === '/') {
|
96676
|
-
return true
|
96677
|
-
}
|
96678
|
-
replaceHash('/' + path);
|
96679
|
-
return false
|
96680
|
-
}
|
96681
|
-
|
96682
|
-
function getHash () {
|
96683
|
-
// We can't use window.location.hash here because it's not
|
96684
|
-
// consistent across browsers - Firefox will pre-decode it!
|
96685
|
-
var href = window.location.href;
|
96686
|
-
var index = href.indexOf('#');
|
96687
|
-
// empty path
|
96688
|
-
if (index < 0) { return '' }
|
96689
|
-
|
96690
|
-
href = href.slice(index + 1);
|
96691
|
-
|
96692
|
-
return href
|
96693
|
-
}
|
96694
|
-
|
96695
|
-
function getUrl (path) {
|
96696
|
-
var href = window.location.href;
|
96697
|
-
var i = href.indexOf('#');
|
96698
|
-
var base = i >= 0 ? href.slice(0, i) : href;
|
96699
|
-
return (base + "#" + path)
|
96700
|
-
}
|
96701
|
-
|
96702
|
-
function pushHash (path) {
|
96703
|
-
if (supportsPushState) {
|
96704
|
-
pushState(getUrl(path));
|
96705
|
-
} else {
|
96706
|
-
window.location.hash = path;
|
96707
|
-
}
|
96708
|
-
}
|
96709
|
-
|
96710
|
-
function replaceHash (path) {
|
96711
|
-
if (supportsPushState) {
|
96712
|
-
replaceState(getUrl(path));
|
96713
|
-
} else {
|
96714
|
-
window.location.replace(getUrl(path));
|
96715
|
-
}
|
96716
|
-
}
|
96717
|
-
|
96718
|
-
/* */
|
96719
|
-
|
96720
|
-
var AbstractHistory = /*@__PURE__*/(function (History) {
|
96721
|
-
function AbstractHistory (router, base) {
|
96722
|
-
History.call(this, router, base);
|
96723
|
-
this.stack = [];
|
96724
|
-
this.index = -1;
|
96725
|
-
}
|
96726
|
-
|
96727
|
-
if ( History ) AbstractHistory.__proto__ = History;
|
96728
|
-
AbstractHistory.prototype = Object.create( History && History.prototype );
|
96729
|
-
AbstractHistory.prototype.constructor = AbstractHistory;
|
96730
|
-
|
96731
|
-
AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
|
96732
|
-
var this$1$1 = this;
|
96733
|
-
|
96734
|
-
this.transitionTo(
|
96735
|
-
location,
|
96736
|
-
function (route) {
|
96737
|
-
this$1$1.stack = this$1$1.stack.slice(0, this$1$1.index + 1).concat(route);
|
96738
|
-
this$1$1.index++;
|
96739
|
-
onComplete && onComplete(route);
|
96740
|
-
},
|
96741
|
-
onAbort
|
96742
|
-
);
|
96743
|
-
};
|
96744
|
-
|
96745
|
-
AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
|
96746
|
-
var this$1$1 = this;
|
96747
|
-
|
96748
|
-
this.transitionTo(
|
96749
|
-
location,
|
96750
|
-
function (route) {
|
96751
|
-
this$1$1.stack = this$1$1.stack.slice(0, this$1$1.index).concat(route);
|
96752
|
-
onComplete && onComplete(route);
|
96753
|
-
},
|
96754
|
-
onAbort
|
96755
|
-
);
|
96756
|
-
};
|
96757
|
-
|
96758
|
-
AbstractHistory.prototype.go = function go (n) {
|
96759
|
-
var this$1$1 = this;
|
96760
|
-
|
96761
|
-
var targetIndex = this.index + n;
|
96762
|
-
if (targetIndex < 0 || targetIndex >= this.stack.length) {
|
96763
|
-
return
|
96764
|
-
}
|
96765
|
-
var route = this.stack[targetIndex];
|
96766
|
-
this.confirmTransition(
|
96767
|
-
route,
|
96768
|
-
function () {
|
96769
|
-
var prev = this$1$1.current;
|
96770
|
-
this$1$1.index = targetIndex;
|
96771
|
-
this$1$1.updateRoute(route);
|
96772
|
-
this$1$1.router.afterHooks.forEach(function (hook) {
|
96773
|
-
hook && hook(route, prev);
|
96774
|
-
});
|
96775
|
-
},
|
96776
|
-
function (err) {
|
96777
|
-
if (isNavigationFailure(err, NavigationFailureType.duplicated)) {
|
96778
|
-
this$1$1.index = targetIndex;
|
96779
|
-
}
|
96780
|
-
}
|
96781
|
-
);
|
96782
|
-
};
|
96783
|
-
|
96784
|
-
AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
|
96785
|
-
var current = this.stack[this.stack.length - 1];
|
96786
|
-
return current ? current.fullPath : '/'
|
96787
|
-
};
|
96788
|
-
|
96789
|
-
AbstractHistory.prototype.ensureURL = function ensureURL () {
|
96790
|
-
// noop
|
96791
|
-
};
|
96792
|
-
|
96793
|
-
return AbstractHistory;
|
96794
|
-
}(History));
|
96795
|
-
|
96796
|
-
/* */
|
96797
|
-
|
96798
|
-
|
96799
|
-
|
96800
|
-
var VueRouter = function VueRouter (options) {
|
96801
|
-
if ( options === void 0 ) options = {};
|
96802
|
-
|
96803
|
-
{
|
96804
|
-
warn(this instanceof VueRouter, "Router must be called with the new operator.");
|
96805
|
-
}
|
96806
|
-
this.app = null;
|
96807
|
-
this.apps = [];
|
96808
|
-
this.options = options;
|
96809
|
-
this.beforeHooks = [];
|
96810
|
-
this.resolveHooks = [];
|
96811
|
-
this.afterHooks = [];
|
96812
|
-
this.matcher = createMatcher(options.routes || [], this);
|
96813
|
-
|
96814
|
-
var mode = options.mode || 'hash';
|
96815
|
-
this.fallback =
|
96816
|
-
mode === 'history' && !supportsPushState && options.fallback !== false;
|
96817
|
-
if (this.fallback) {
|
96818
|
-
mode = 'hash';
|
96819
|
-
}
|
96820
|
-
if (!inBrowser) {
|
96821
|
-
mode = 'abstract';
|
96822
|
-
}
|
96823
|
-
this.mode = mode;
|
96824
|
-
|
96825
|
-
switch (mode) {
|
96826
|
-
case 'history':
|
96827
|
-
this.history = new HTML5History(this, options.base);
|
96828
|
-
break
|
96829
|
-
case 'hash':
|
96830
|
-
this.history = new HashHistory(this, options.base, this.fallback);
|
96831
|
-
break
|
96832
|
-
case 'abstract':
|
96833
|
-
this.history = new AbstractHistory(this, options.base);
|
96834
|
-
break
|
96835
|
-
default:
|
96836
|
-
{
|
96837
|
-
assert(false, ("invalid mode: " + mode));
|
96838
|
-
}
|
96839
|
-
}
|
96840
|
-
};
|
96841
|
-
|
96842
|
-
var prototypeAccessors = { currentRoute: { configurable: true } };
|
96843
|
-
|
96844
|
-
VueRouter.prototype.match = function match (raw, current, redirectedFrom) {
|
96845
|
-
return this.matcher.match(raw, current, redirectedFrom)
|
96846
|
-
};
|
96847
|
-
|
96848
|
-
prototypeAccessors.currentRoute.get = function () {
|
96849
|
-
return this.history && this.history.current
|
96850
|
-
};
|
96851
|
-
|
96852
|
-
VueRouter.prototype.init = function init (app /* Vue component instance */) {
|
96853
|
-
var this$1$1 = this;
|
96854
|
-
|
96855
|
-
assert(
|
96856
|
-
install$2.installed,
|
96857
|
-
"not installed. Make sure to call `Vue.use(VueRouter)` " +
|
96858
|
-
"before creating root instance."
|
96859
|
-
);
|
96860
|
-
|
96861
|
-
this.apps.push(app);
|
96862
|
-
|
96863
|
-
// set up app destroyed handler
|
96864
|
-
// https://github.com/vuejs/vue-router/issues/2639
|
96865
|
-
app.$once('hook:destroyed', function () {
|
96866
|
-
// clean out app from this.apps array once destroyed
|
96867
|
-
var index = this$1$1.apps.indexOf(app);
|
96868
|
-
if (index > -1) { this$1$1.apps.splice(index, 1); }
|
96869
|
-
// ensure we still have a main app or null if no apps
|
96870
|
-
// we do not release the router so it can be reused
|
96871
|
-
if (this$1$1.app === app) { this$1$1.app = this$1$1.apps[0] || null; }
|
96872
|
-
|
96873
|
-
if (!this$1$1.app) { this$1$1.history.teardown(); }
|
96874
|
-
});
|
96875
|
-
|
96876
|
-
// main app previously initialized
|
96877
|
-
// return as we don't need to set up new history listener
|
96878
|
-
if (this.app) {
|
96879
|
-
return
|
96880
|
-
}
|
96881
|
-
|
96882
|
-
this.app = app;
|
96883
|
-
|
96884
|
-
var history = this.history;
|
96885
|
-
|
96886
|
-
if (history instanceof HTML5History || history instanceof HashHistory) {
|
96887
|
-
var handleInitialScroll = function (routeOrError) {
|
96888
|
-
var from = history.current;
|
96889
|
-
var expectScroll = this$1$1.options.scrollBehavior;
|
96890
|
-
var supportsScroll = supportsPushState && expectScroll;
|
96891
|
-
|
96892
|
-
if (supportsScroll && 'fullPath' in routeOrError) {
|
96893
|
-
handleScroll(this$1$1, routeOrError, from, false);
|
96894
|
-
}
|
96895
|
-
};
|
96896
|
-
var setupListeners = function (routeOrError) {
|
96897
|
-
history.setupListeners();
|
96898
|
-
handleInitialScroll(routeOrError);
|
96899
|
-
};
|
96900
|
-
history.transitionTo(
|
96901
|
-
history.getCurrentLocation(),
|
96902
|
-
setupListeners,
|
96903
|
-
setupListeners
|
96904
|
-
);
|
96905
|
-
}
|
96906
|
-
|
96907
|
-
history.listen(function (route) {
|
96908
|
-
this$1$1.apps.forEach(function (app) {
|
96909
|
-
app._route = route;
|
96910
|
-
});
|
96911
|
-
});
|
96912
|
-
};
|
96913
|
-
|
96914
|
-
VueRouter.prototype.beforeEach = function beforeEach (fn) {
|
96915
|
-
return registerHook(this.beforeHooks, fn)
|
96916
|
-
};
|
96917
|
-
|
96918
|
-
VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
|
96919
|
-
return registerHook(this.resolveHooks, fn)
|
96920
|
-
};
|
96921
|
-
|
96922
|
-
VueRouter.prototype.afterEach = function afterEach (fn) {
|
96923
|
-
return registerHook(this.afterHooks, fn)
|
96924
|
-
};
|
96925
|
-
|
96926
|
-
VueRouter.prototype.onReady = function onReady (cb, errorCb) {
|
96927
|
-
this.history.onReady(cb, errorCb);
|
96928
|
-
};
|
96929
|
-
|
96930
|
-
VueRouter.prototype.onError = function onError (errorCb) {
|
96931
|
-
this.history.onError(errorCb);
|
96932
|
-
};
|
96933
|
-
|
96934
|
-
VueRouter.prototype.push = function push (location, onComplete, onAbort) {
|
96935
|
-
var this$1$1 = this;
|
96936
|
-
|
96937
|
-
// $flow-disable-line
|
96938
|
-
if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
|
96939
|
-
return new Promise(function (resolve, reject) {
|
96940
|
-
this$1$1.history.push(location, resolve, reject);
|
96941
|
-
})
|
96942
|
-
} else {
|
96943
|
-
this.history.push(location, onComplete, onAbort);
|
96944
|
-
}
|
96945
|
-
};
|
96946
|
-
|
96947
|
-
VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
|
96948
|
-
var this$1$1 = this;
|
96949
|
-
|
96950
|
-
// $flow-disable-line
|
96951
|
-
if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
|
96952
|
-
return new Promise(function (resolve, reject) {
|
96953
|
-
this$1$1.history.replace(location, resolve, reject);
|
96954
|
-
})
|
96955
|
-
} else {
|
96956
|
-
this.history.replace(location, onComplete, onAbort);
|
96957
|
-
}
|
96958
|
-
};
|
96959
|
-
|
96960
|
-
VueRouter.prototype.go = function go (n) {
|
96961
|
-
this.history.go(n);
|
96962
|
-
};
|
96963
|
-
|
96964
|
-
VueRouter.prototype.back = function back () {
|
96965
|
-
this.go(-1);
|
96966
|
-
};
|
96967
|
-
|
96968
|
-
VueRouter.prototype.forward = function forward () {
|
96969
|
-
this.go(1);
|
96970
|
-
};
|
96971
|
-
|
96972
|
-
VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
|
96973
|
-
var route = to
|
96974
|
-
? to.matched
|
96975
|
-
? to
|
96976
|
-
: this.resolve(to).route
|
96977
|
-
: this.currentRoute;
|
96978
|
-
if (!route) {
|
96979
|
-
return []
|
96980
|
-
}
|
96981
|
-
return [].concat.apply(
|
96982
|
-
[],
|
96983
|
-
route.matched.map(function (m) {
|
96984
|
-
return Object.keys(m.components).map(function (key) {
|
96985
|
-
return m.components[key]
|
96986
|
-
})
|
96987
|
-
})
|
96988
|
-
)
|
96989
|
-
};
|
96990
|
-
|
96991
|
-
VueRouter.prototype.resolve = function resolve (
|
96992
|
-
to,
|
96993
|
-
current,
|
96994
|
-
append
|
96995
|
-
) {
|
96996
|
-
current = current || this.history.current;
|
96997
|
-
var location = normalizeLocation(to, current, append, this);
|
96998
|
-
var route = this.match(location, current);
|
96999
|
-
var fullPath = route.redirectedFrom || route.fullPath;
|
97000
|
-
var base = this.history.base;
|
97001
|
-
var href = createHref(base, fullPath, this.mode);
|
97002
|
-
return {
|
97003
|
-
location: location,
|
97004
|
-
route: route,
|
97005
|
-
href: href,
|
97006
|
-
// for backwards compat
|
97007
|
-
normalizedTo: location,
|
97008
|
-
resolved: route
|
97009
|
-
}
|
97010
|
-
};
|
97011
|
-
|
97012
|
-
VueRouter.prototype.getRoutes = function getRoutes () {
|
97013
|
-
return this.matcher.getRoutes()
|
97014
|
-
};
|
97015
|
-
|
97016
|
-
VueRouter.prototype.addRoute = function addRoute (parentOrRoute, route) {
|
97017
|
-
this.matcher.addRoute(parentOrRoute, route);
|
97018
|
-
if (this.history.current !== START) {
|
97019
|
-
this.history.transitionTo(this.history.getCurrentLocation());
|
97020
|
-
}
|
97021
|
-
};
|
97022
|
-
|
97023
|
-
VueRouter.prototype.addRoutes = function addRoutes (routes) {
|
97024
|
-
{
|
97025
|
-
warn(false, 'router.addRoutes() is deprecated and has been removed in Vue Router 4. Use router.addRoute() instead.');
|
97026
|
-
}
|
97027
|
-
this.matcher.addRoutes(routes);
|
97028
|
-
if (this.history.current !== START) {
|
97029
|
-
this.history.transitionTo(this.history.getCurrentLocation());
|
97030
|
-
}
|
97031
|
-
};
|
97032
|
-
|
97033
|
-
Object.defineProperties( VueRouter.prototype, prototypeAccessors );
|
97034
|
-
|
97035
|
-
var VueRouter$1 = VueRouter;
|
97036
|
-
|
97037
|
-
function registerHook (list, fn) {
|
97038
|
-
list.push(fn);
|
97039
|
-
return function () {
|
97040
|
-
var i = list.indexOf(fn);
|
97041
|
-
if (i > -1) { list.splice(i, 1); }
|
97042
|
-
}
|
97043
|
-
}
|
97044
|
-
|
97045
|
-
function createHref (base, fullPath, mode) {
|
97046
|
-
var path = mode === 'hash' ? '#' + fullPath : fullPath;
|
97047
|
-
return base ? cleanPath(base + '/' + path) : path
|
97048
|
-
}
|
97049
|
-
|
97050
|
-
// We cannot remove this as it would be a breaking change
|
97051
|
-
VueRouter.install = install$2;
|
97052
|
-
VueRouter.version = '3.6.5';
|
97053
|
-
VueRouter.isNavigationFailure = isNavigationFailure;
|
97054
|
-
VueRouter.NavigationFailureType = NavigationFailureType;
|
97055
|
-
VueRouter.START_LOCATION = START;
|
97056
|
-
|
97057
|
-
if (inBrowser && window.Vue) {
|
97058
|
-
window.Vue.use(VueRouter);
|
97059
|
-
}
|
97060
|
-
|
97061
93907
|
var nprogress = {exports: {}};
|
97062
93908
|
|
97063
93909
|
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
|
@@ -97558,9 +94404,19 @@ function chuli(arr) {
|
|
97558
94404
|
}
|
97559
94405
|
|
97560
94406
|
function createRouter(Vue) {
|
97561
|
-
|
97562
|
-
|
97563
|
-
Vue.
|
94407
|
+
console.log(Vue._installedPlugins);
|
94408
|
+
|
94409
|
+
const VueRouterObj = Vue._installedPlugins.filter((item) => {
|
94410
|
+
return item.name === 'VueRouter'
|
94411
|
+
});
|
94412
|
+
if (VueRouterObj && VueRouterObj[0]) {
|
94413
|
+
console.log(111111);
|
94414
|
+
} else {
|
94415
|
+
console.log(22222);
|
94416
|
+
Vue.use(VueRouter);
|
94417
|
+
}
|
94418
|
+
console.log(VueRouterObj);
|
94419
|
+
console.log(33333);
|
97564
94420
|
const $z = Vue.prototype.$z;
|
97565
94421
|
if ($z.router) {
|
97566
94422
|
const defaultConfig = {
|
@@ -97574,7 +94430,7 @@ function createRouter(Vue) {
|
|
97574
94430
|
delete $z.router.afterEach;
|
97575
94431
|
Object.assign(defaultConfig, routerOption);
|
97576
94432
|
chuli(defaultConfig.routes);
|
97577
|
-
const router = new VueRouter
|
94433
|
+
const router = new VueRouter(defaultConfig);
|
97578
94434
|
router.beforeEach((to, from, next) => {
|
97579
94435
|
if (beforeEach) {
|
97580
94436
|
beforeEach(to, from, next);
|