minimal-piral 1.6.2-beta.7367 → 1.6.2-beta.7393
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/app/{index.d31caa.js → index.6860bf.js} +547 -445
- package/app/index.6860bf.js.map +1 -0
- package/app/index.html +1 -1
- package/files.tar +0 -0
- package/files_once.tar +0 -0
- package/package.json +5 -5
- package/app/index.d31caa.js.map +0 -1
|
@@ -3248,11 +3248,113 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3248
3248
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3249
3249
|
/* harmony export */ createRouteMatcher: () => (/* binding */ createRouteMatcher)
|
|
3250
3250
|
/* harmony export */ });
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3251
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
3252
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
3253
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
3254
|
+
var defaultDelimiter = escapeString('/');
|
|
3255
|
+
var pathExpr = new RegExp(['(\\\\.)', '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'].join('|'), 'g');
|
|
3256
|
+
function escapeString(str) {
|
|
3257
|
+
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1');
|
|
3258
|
+
}
|
|
3259
|
+
function escapeGroup(group) {
|
|
3260
|
+
return group.replace(/([=!:$\/()])/g, '\\$1');
|
|
3261
|
+
}
|
|
3262
|
+
function parse(str) {
|
|
3263
|
+
var tokens = [];
|
|
3264
|
+
var key = 0;
|
|
3265
|
+
var index = 0;
|
|
3266
|
+
var path = '';
|
|
3267
|
+
var res;
|
|
3268
|
+
while ((res = pathExpr.exec(str)) !== null) {
|
|
3269
|
+
var m = res[0];
|
|
3270
|
+
var escaped = res[1];
|
|
3271
|
+
var offset = res.index;
|
|
3272
|
+
path += str.slice(index, offset);
|
|
3273
|
+
index = offset + m.length;
|
|
3274
|
+
// Ignore already escaped sequences.
|
|
3275
|
+
if (escaped) {
|
|
3276
|
+
path += escaped[1];
|
|
3277
|
+
continue;
|
|
3278
|
+
}
|
|
3279
|
+
var next = str[index];
|
|
3280
|
+
var prefix = res[2];
|
|
3281
|
+
var name = res[3];
|
|
3282
|
+
var capture = res[4];
|
|
3283
|
+
var group = res[5];
|
|
3284
|
+
var modifier = res[6];
|
|
3285
|
+
var asterisk = res[7];
|
|
3286
|
+
// Push the current path onto the tokens.
|
|
3287
|
+
if (path) {
|
|
3288
|
+
tokens.push(path);
|
|
3289
|
+
path = '';
|
|
3290
|
+
}
|
|
3291
|
+
var partial = prefix != null && next != null && next !== prefix;
|
|
3292
|
+
var repeat = modifier === '+' || modifier === '*';
|
|
3293
|
+
var optional = modifier === '?' || modifier === '*';
|
|
3294
|
+
var delimiter = res[2] || '/';
|
|
3295
|
+
var pattern = capture || group;
|
|
3296
|
+
tokens.push({
|
|
3297
|
+
name: name || "".concat(key++),
|
|
3298
|
+
prefix: prefix || '',
|
|
3299
|
+
delimiter: delimiter,
|
|
3300
|
+
optional: optional,
|
|
3301
|
+
repeat: repeat,
|
|
3302
|
+
partial: partial,
|
|
3303
|
+
asterisk: !!asterisk,
|
|
3304
|
+
pattern: pattern ? escapeGroup(pattern) : asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?'
|
|
3305
|
+
});
|
|
3306
|
+
}
|
|
3307
|
+
// Match any characters still remaining.
|
|
3308
|
+
if (index < str.length) {
|
|
3309
|
+
path += str.substring(index);
|
|
3310
|
+
}
|
|
3311
|
+
// If the path exists, push it onto the end.
|
|
3312
|
+
if (path) {
|
|
3313
|
+
tokens.push(path);
|
|
3314
|
+
}
|
|
3315
|
+
return tokens;
|
|
3316
|
+
}
|
|
3317
|
+
function tokensToRegExp(tokens) {
|
|
3318
|
+
var route = '';
|
|
3319
|
+
var _iterator = _createForOfIteratorHelper(tokens),
|
|
3320
|
+
_step;
|
|
3321
|
+
try {
|
|
3322
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
3323
|
+
var token = _step.value;
|
|
3324
|
+
if (typeof token === 'string') {
|
|
3325
|
+
route += escapeString(token);
|
|
3326
|
+
} else {
|
|
3327
|
+
var prefix = escapeString(token.prefix);
|
|
3328
|
+
var capture = '(?:' + token.pattern + ')';
|
|
3329
|
+
if (token.repeat) {
|
|
3330
|
+
capture += '(?:' + prefix + capture + ')*';
|
|
3331
|
+
}
|
|
3332
|
+
if (token.optional) {
|
|
3333
|
+
if (!token.partial) {
|
|
3334
|
+
capture = '(?:' + prefix + '(' + capture + '))?';
|
|
3335
|
+
} else {
|
|
3336
|
+
capture = prefix + '(' + capture + ')?';
|
|
3337
|
+
}
|
|
3338
|
+
} else {
|
|
3339
|
+
capture = prefix + '(' + capture + ')';
|
|
3340
|
+
}
|
|
3341
|
+
route += capture;
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
} catch (err) {
|
|
3345
|
+
_iterator.e(err);
|
|
3346
|
+
} finally {
|
|
3347
|
+
_iterator.f();
|
|
3348
|
+
}
|
|
3349
|
+
var endsWithDelimiter = route.slice(-defaultDelimiter.length) === defaultDelimiter;
|
|
3350
|
+
var path = endsWithDelimiter ? route.slice(0, -defaultDelimiter.length) : route;
|
|
3351
|
+
return new RegExp("^".concat(path, "(?:").concat(defaultDelimiter, "(?=$))?$"), 'i');
|
|
3352
|
+
}
|
|
3353
|
+
function stringToRegexp(path) {
|
|
3354
|
+
return tokensToRegExp(parse(path));
|
|
3355
|
+
}
|
|
3254
3356
|
function createRouteMatcher(path) {
|
|
3255
|
-
return
|
|
3357
|
+
return stringToRegexp(path);
|
|
3256
3358
|
}
|
|
3257
3359
|
|
|
3258
3360
|
/***/ }),
|
|
@@ -3702,12 +3804,12 @@ function installPiralDebug(options) {
|
|
|
3702
3804
|
debug: debugApiVersion,
|
|
3703
3805
|
instance: {
|
|
3704
3806
|
name: "minimal-piral",
|
|
3705
|
-
version: "1.6.2-beta.
|
|
3807
|
+
version: "1.6.2-beta.7393",
|
|
3706
3808
|
dependencies: "tslib,react,react-dom,react-router,react-router-dom"
|
|
3707
3809
|
},
|
|
3708
3810
|
build: {
|
|
3709
|
-
date: "2024-09-
|
|
3710
|
-
cli: "1.6.2-beta.
|
|
3811
|
+
date: "2024-09-10T15:32:47.248Z",
|
|
3812
|
+
cli: "1.6.2-beta.7393",
|
|
3711
3813
|
compat: "1"
|
|
3712
3814
|
}
|
|
3713
3815
|
};
|
|
@@ -5910,442 +6012,6 @@ return (0,piral_debug_utils__WEBPACK_IMPORTED_MODULE_13__.useDebugRouteFilter)(p
|
|
|
5910
6012
|
|
|
5911
6013
|
|
|
5912
6014
|
|
|
5913
|
-
/***/ }),
|
|
5914
|
-
|
|
5915
|
-
/***/ "../../../node_modules/path-to-regexp/index.js":
|
|
5916
|
-
/*!*****************************************************!*\
|
|
5917
|
-
!*** ../../../node_modules/path-to-regexp/index.js ***!
|
|
5918
|
-
\*****************************************************/
|
|
5919
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
5920
|
-
|
|
5921
|
-
var isarray = __webpack_require__(/*! isarray */ "../../../node_modules/isarray/index.js")
|
|
5922
|
-
|
|
5923
|
-
/**
|
|
5924
|
-
* Expose `pathToRegexp`.
|
|
5925
|
-
*/
|
|
5926
|
-
module.exports = pathToRegexp
|
|
5927
|
-
module.exports.parse = parse
|
|
5928
|
-
module.exports.compile = compile
|
|
5929
|
-
module.exports.tokensToFunction = tokensToFunction
|
|
5930
|
-
module.exports.tokensToRegExp = tokensToRegExp
|
|
5931
|
-
|
|
5932
|
-
/**
|
|
5933
|
-
* The main path matching regexp utility.
|
|
5934
|
-
*
|
|
5935
|
-
* @type {RegExp}
|
|
5936
|
-
*/
|
|
5937
|
-
var PATH_REGEXP = new RegExp([
|
|
5938
|
-
// Match escaped characters that would otherwise appear in future matches.
|
|
5939
|
-
// This allows the user to escape special characters that won't transform.
|
|
5940
|
-
'(\\\\.)',
|
|
5941
|
-
// Match Express-style parameters and un-named parameters with a prefix
|
|
5942
|
-
// and optional suffixes. Matches appear as:
|
|
5943
|
-
//
|
|
5944
|
-
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
|
|
5945
|
-
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
|
|
5946
|
-
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
|
|
5947
|
-
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
|
|
5948
|
-
].join('|'), 'g')
|
|
5949
|
-
|
|
5950
|
-
/**
|
|
5951
|
-
* Parse a string for the raw tokens.
|
|
5952
|
-
*
|
|
5953
|
-
* @param {string} str
|
|
5954
|
-
* @param {Object=} options
|
|
5955
|
-
* @return {!Array}
|
|
5956
|
-
*/
|
|
5957
|
-
function parse (str, options) {
|
|
5958
|
-
var tokens = []
|
|
5959
|
-
var key = 0
|
|
5960
|
-
var index = 0
|
|
5961
|
-
var path = ''
|
|
5962
|
-
var defaultDelimiter = options && options.delimiter || '/'
|
|
5963
|
-
var res
|
|
5964
|
-
|
|
5965
|
-
while ((res = PATH_REGEXP.exec(str)) != null) {
|
|
5966
|
-
var m = res[0]
|
|
5967
|
-
var escaped = res[1]
|
|
5968
|
-
var offset = res.index
|
|
5969
|
-
path += str.slice(index, offset)
|
|
5970
|
-
index = offset + m.length
|
|
5971
|
-
|
|
5972
|
-
// Ignore already escaped sequences.
|
|
5973
|
-
if (escaped) {
|
|
5974
|
-
path += escaped[1]
|
|
5975
|
-
continue
|
|
5976
|
-
}
|
|
5977
|
-
|
|
5978
|
-
var next = str[index]
|
|
5979
|
-
var prefix = res[2]
|
|
5980
|
-
var name = res[3]
|
|
5981
|
-
var capture = res[4]
|
|
5982
|
-
var group = res[5]
|
|
5983
|
-
var modifier = res[6]
|
|
5984
|
-
var asterisk = res[7]
|
|
5985
|
-
|
|
5986
|
-
// Push the current path onto the tokens.
|
|
5987
|
-
if (path) {
|
|
5988
|
-
tokens.push(path)
|
|
5989
|
-
path = ''
|
|
5990
|
-
}
|
|
5991
|
-
|
|
5992
|
-
var partial = prefix != null && next != null && next !== prefix
|
|
5993
|
-
var repeat = modifier === '+' || modifier === '*'
|
|
5994
|
-
var optional = modifier === '?' || modifier === '*'
|
|
5995
|
-
var delimiter = res[2] || defaultDelimiter
|
|
5996
|
-
var pattern = capture || group
|
|
5997
|
-
|
|
5998
|
-
tokens.push({
|
|
5999
|
-
name: name || key++,
|
|
6000
|
-
prefix: prefix || '',
|
|
6001
|
-
delimiter: delimiter,
|
|
6002
|
-
optional: optional,
|
|
6003
|
-
repeat: repeat,
|
|
6004
|
-
partial: partial,
|
|
6005
|
-
asterisk: !!asterisk,
|
|
6006
|
-
pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
|
|
6007
|
-
})
|
|
6008
|
-
}
|
|
6009
|
-
|
|
6010
|
-
// Match any characters still remaining.
|
|
6011
|
-
if (index < str.length) {
|
|
6012
|
-
path += str.substr(index)
|
|
6013
|
-
}
|
|
6014
|
-
|
|
6015
|
-
// If the path exists, push it onto the end.
|
|
6016
|
-
if (path) {
|
|
6017
|
-
tokens.push(path)
|
|
6018
|
-
}
|
|
6019
|
-
|
|
6020
|
-
return tokens
|
|
6021
|
-
}
|
|
6022
|
-
|
|
6023
|
-
/**
|
|
6024
|
-
* Compile a string to a template function for the path.
|
|
6025
|
-
*
|
|
6026
|
-
* @param {string} str
|
|
6027
|
-
* @param {Object=} options
|
|
6028
|
-
* @return {!function(Object=, Object=)}
|
|
6029
|
-
*/
|
|
6030
|
-
function compile (str, options) {
|
|
6031
|
-
return tokensToFunction(parse(str, options), options)
|
|
6032
|
-
}
|
|
6033
|
-
|
|
6034
|
-
/**
|
|
6035
|
-
* Prettier encoding of URI path segments.
|
|
6036
|
-
*
|
|
6037
|
-
* @param {string}
|
|
6038
|
-
* @return {string}
|
|
6039
|
-
*/
|
|
6040
|
-
function encodeURIComponentPretty (str) {
|
|
6041
|
-
return encodeURI(str).replace(/[\/?#]/g, function (c) {
|
|
6042
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
|
6043
|
-
})
|
|
6044
|
-
}
|
|
6045
|
-
|
|
6046
|
-
/**
|
|
6047
|
-
* Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
|
|
6048
|
-
*
|
|
6049
|
-
* @param {string}
|
|
6050
|
-
* @return {string}
|
|
6051
|
-
*/
|
|
6052
|
-
function encodeAsterisk (str) {
|
|
6053
|
-
return encodeURI(str).replace(/[?#]/g, function (c) {
|
|
6054
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
|
6055
|
-
})
|
|
6056
|
-
}
|
|
6057
|
-
|
|
6058
|
-
/**
|
|
6059
|
-
* Expose a method for transforming tokens into the path function.
|
|
6060
|
-
*/
|
|
6061
|
-
function tokensToFunction (tokens, options) {
|
|
6062
|
-
// Compile all the tokens into regexps.
|
|
6063
|
-
var matches = new Array(tokens.length)
|
|
6064
|
-
|
|
6065
|
-
// Compile all the patterns before compilation.
|
|
6066
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
6067
|
-
if (typeof tokens[i] === 'object') {
|
|
6068
|
-
matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options))
|
|
6069
|
-
}
|
|
6070
|
-
}
|
|
6071
|
-
|
|
6072
|
-
return function (obj, opts) {
|
|
6073
|
-
var path = ''
|
|
6074
|
-
var data = obj || {}
|
|
6075
|
-
var options = opts || {}
|
|
6076
|
-
var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent
|
|
6077
|
-
|
|
6078
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
6079
|
-
var token = tokens[i]
|
|
6080
|
-
|
|
6081
|
-
if (typeof token === 'string') {
|
|
6082
|
-
path += token
|
|
6083
|
-
|
|
6084
|
-
continue
|
|
6085
|
-
}
|
|
6086
|
-
|
|
6087
|
-
var value = data[token.name]
|
|
6088
|
-
var segment
|
|
6089
|
-
|
|
6090
|
-
if (value == null) {
|
|
6091
|
-
if (token.optional) {
|
|
6092
|
-
// Prepend partial segment prefixes.
|
|
6093
|
-
if (token.partial) {
|
|
6094
|
-
path += token.prefix
|
|
6095
|
-
}
|
|
6096
|
-
|
|
6097
|
-
continue
|
|
6098
|
-
} else {
|
|
6099
|
-
throw new TypeError('Expected "' + token.name + '" to be defined')
|
|
6100
|
-
}
|
|
6101
|
-
}
|
|
6102
|
-
|
|
6103
|
-
if (isarray(value)) {
|
|
6104
|
-
if (!token.repeat) {
|
|
6105
|
-
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
|
|
6106
|
-
}
|
|
6107
|
-
|
|
6108
|
-
if (value.length === 0) {
|
|
6109
|
-
if (token.optional) {
|
|
6110
|
-
continue
|
|
6111
|
-
} else {
|
|
6112
|
-
throw new TypeError('Expected "' + token.name + '" to not be empty')
|
|
6113
|
-
}
|
|
6114
|
-
}
|
|
6115
|
-
|
|
6116
|
-
for (var j = 0; j < value.length; j++) {
|
|
6117
|
-
segment = encode(value[j])
|
|
6118
|
-
|
|
6119
|
-
if (!matches[i].test(segment)) {
|
|
6120
|
-
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
|
|
6121
|
-
}
|
|
6122
|
-
|
|
6123
|
-
path += (j === 0 ? token.prefix : token.delimiter) + segment
|
|
6124
|
-
}
|
|
6125
|
-
|
|
6126
|
-
continue
|
|
6127
|
-
}
|
|
6128
|
-
|
|
6129
|
-
segment = token.asterisk ? encodeAsterisk(value) : encode(value)
|
|
6130
|
-
|
|
6131
|
-
if (!matches[i].test(segment)) {
|
|
6132
|
-
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
|
|
6133
|
-
}
|
|
6134
|
-
|
|
6135
|
-
path += token.prefix + segment
|
|
6136
|
-
}
|
|
6137
|
-
|
|
6138
|
-
return path
|
|
6139
|
-
}
|
|
6140
|
-
}
|
|
6141
|
-
|
|
6142
|
-
/**
|
|
6143
|
-
* Escape a regular expression string.
|
|
6144
|
-
*
|
|
6145
|
-
* @param {string} str
|
|
6146
|
-
* @return {string}
|
|
6147
|
-
*/
|
|
6148
|
-
function escapeString (str) {
|
|
6149
|
-
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
|
|
6150
|
-
}
|
|
6151
|
-
|
|
6152
|
-
/**
|
|
6153
|
-
* Escape the capturing group by escaping special characters and meaning.
|
|
6154
|
-
*
|
|
6155
|
-
* @param {string} group
|
|
6156
|
-
* @return {string}
|
|
6157
|
-
*/
|
|
6158
|
-
function escapeGroup (group) {
|
|
6159
|
-
return group.replace(/([=!:$\/()])/g, '\\$1')
|
|
6160
|
-
}
|
|
6161
|
-
|
|
6162
|
-
/**
|
|
6163
|
-
* Attach the keys as a property of the regexp.
|
|
6164
|
-
*
|
|
6165
|
-
* @param {!RegExp} re
|
|
6166
|
-
* @param {Array} keys
|
|
6167
|
-
* @return {!RegExp}
|
|
6168
|
-
*/
|
|
6169
|
-
function attachKeys (re, keys) {
|
|
6170
|
-
re.keys = keys
|
|
6171
|
-
return re
|
|
6172
|
-
}
|
|
6173
|
-
|
|
6174
|
-
/**
|
|
6175
|
-
* Get the flags for a regexp from the options.
|
|
6176
|
-
*
|
|
6177
|
-
* @param {Object} options
|
|
6178
|
-
* @return {string}
|
|
6179
|
-
*/
|
|
6180
|
-
function flags (options) {
|
|
6181
|
-
return options && options.sensitive ? '' : 'i'
|
|
6182
|
-
}
|
|
6183
|
-
|
|
6184
|
-
/**
|
|
6185
|
-
* Pull out keys from a regexp.
|
|
6186
|
-
*
|
|
6187
|
-
* @param {!RegExp} path
|
|
6188
|
-
* @param {!Array} keys
|
|
6189
|
-
* @return {!RegExp}
|
|
6190
|
-
*/
|
|
6191
|
-
function regexpToRegexp (path, keys) {
|
|
6192
|
-
// Use a negative lookahead to match only capturing groups.
|
|
6193
|
-
var groups = path.source.match(/\((?!\?)/g)
|
|
6194
|
-
|
|
6195
|
-
if (groups) {
|
|
6196
|
-
for (var i = 0; i < groups.length; i++) {
|
|
6197
|
-
keys.push({
|
|
6198
|
-
name: i,
|
|
6199
|
-
prefix: null,
|
|
6200
|
-
delimiter: null,
|
|
6201
|
-
optional: false,
|
|
6202
|
-
repeat: false,
|
|
6203
|
-
partial: false,
|
|
6204
|
-
asterisk: false,
|
|
6205
|
-
pattern: null
|
|
6206
|
-
})
|
|
6207
|
-
}
|
|
6208
|
-
}
|
|
6209
|
-
|
|
6210
|
-
return attachKeys(path, keys)
|
|
6211
|
-
}
|
|
6212
|
-
|
|
6213
|
-
/**
|
|
6214
|
-
* Transform an array into a regexp.
|
|
6215
|
-
*
|
|
6216
|
-
* @param {!Array} path
|
|
6217
|
-
* @param {Array} keys
|
|
6218
|
-
* @param {!Object} options
|
|
6219
|
-
* @return {!RegExp}
|
|
6220
|
-
*/
|
|
6221
|
-
function arrayToRegexp (path, keys, options) {
|
|
6222
|
-
var parts = []
|
|
6223
|
-
|
|
6224
|
-
for (var i = 0; i < path.length; i++) {
|
|
6225
|
-
parts.push(pathToRegexp(path[i], keys, options).source)
|
|
6226
|
-
}
|
|
6227
|
-
|
|
6228
|
-
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options))
|
|
6229
|
-
|
|
6230
|
-
return attachKeys(regexp, keys)
|
|
6231
|
-
}
|
|
6232
|
-
|
|
6233
|
-
/**
|
|
6234
|
-
* Create a path regexp from string input.
|
|
6235
|
-
*
|
|
6236
|
-
* @param {string} path
|
|
6237
|
-
* @param {!Array} keys
|
|
6238
|
-
* @param {!Object} options
|
|
6239
|
-
* @return {!RegExp}
|
|
6240
|
-
*/
|
|
6241
|
-
function stringToRegexp (path, keys, options) {
|
|
6242
|
-
return tokensToRegExp(parse(path, options), keys, options)
|
|
6243
|
-
}
|
|
6244
|
-
|
|
6245
|
-
/**
|
|
6246
|
-
* Expose a function for taking tokens and returning a RegExp.
|
|
6247
|
-
*
|
|
6248
|
-
* @param {!Array} tokens
|
|
6249
|
-
* @param {(Array|Object)=} keys
|
|
6250
|
-
* @param {Object=} options
|
|
6251
|
-
* @return {!RegExp}
|
|
6252
|
-
*/
|
|
6253
|
-
function tokensToRegExp (tokens, keys, options) {
|
|
6254
|
-
if (!isarray(keys)) {
|
|
6255
|
-
options = /** @type {!Object} */ (keys || options)
|
|
6256
|
-
keys = []
|
|
6257
|
-
}
|
|
6258
|
-
|
|
6259
|
-
options = options || {}
|
|
6260
|
-
|
|
6261
|
-
var strict = options.strict
|
|
6262
|
-
var end = options.end !== false
|
|
6263
|
-
var route = ''
|
|
6264
|
-
|
|
6265
|
-
// Iterate over the tokens and create our regexp string.
|
|
6266
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
6267
|
-
var token = tokens[i]
|
|
6268
|
-
|
|
6269
|
-
if (typeof token === 'string') {
|
|
6270
|
-
route += escapeString(token)
|
|
6271
|
-
} else {
|
|
6272
|
-
var prefix = escapeString(token.prefix)
|
|
6273
|
-
var capture = '(?:' + token.pattern + ')'
|
|
6274
|
-
|
|
6275
|
-
keys.push(token)
|
|
6276
|
-
|
|
6277
|
-
if (token.repeat) {
|
|
6278
|
-
capture += '(?:' + prefix + capture + ')*'
|
|
6279
|
-
}
|
|
6280
|
-
|
|
6281
|
-
if (token.optional) {
|
|
6282
|
-
if (!token.partial) {
|
|
6283
|
-
capture = '(?:' + prefix + '(' + capture + '))?'
|
|
6284
|
-
} else {
|
|
6285
|
-
capture = prefix + '(' + capture + ')?'
|
|
6286
|
-
}
|
|
6287
|
-
} else {
|
|
6288
|
-
capture = prefix + '(' + capture + ')'
|
|
6289
|
-
}
|
|
6290
|
-
|
|
6291
|
-
route += capture
|
|
6292
|
-
}
|
|
6293
|
-
}
|
|
6294
|
-
|
|
6295
|
-
var delimiter = escapeString(options.delimiter || '/')
|
|
6296
|
-
var endsWithDelimiter = route.slice(-delimiter.length) === delimiter
|
|
6297
|
-
|
|
6298
|
-
// In non-strict mode we allow a slash at the end of match. If the path to
|
|
6299
|
-
// match already ends with a slash, we remove it for consistency. The slash
|
|
6300
|
-
// is valid at the end of a path match, not in the middle. This is important
|
|
6301
|
-
// in non-ending mode, where "/test/" shouldn't match "/test//route".
|
|
6302
|
-
if (!strict) {
|
|
6303
|
-
route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?'
|
|
6304
|
-
}
|
|
6305
|
-
|
|
6306
|
-
if (end) {
|
|
6307
|
-
route += '$'
|
|
6308
|
-
} else {
|
|
6309
|
-
// In non-ending mode, we need the capturing groups to match as much as
|
|
6310
|
-
// possible by using a positive lookahead to the end or next path segment.
|
|
6311
|
-
route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)'
|
|
6312
|
-
}
|
|
6313
|
-
|
|
6314
|
-
return attachKeys(new RegExp('^' + route, flags(options)), keys)
|
|
6315
|
-
}
|
|
6316
|
-
|
|
6317
|
-
/**
|
|
6318
|
-
* Normalize the given path string, returning a regular expression.
|
|
6319
|
-
*
|
|
6320
|
-
* An empty array can be passed in for the keys, which will hold the
|
|
6321
|
-
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
|
|
6322
|
-
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
|
|
6323
|
-
*
|
|
6324
|
-
* @param {(string|RegExp|Array)} path
|
|
6325
|
-
* @param {(Array|Object)=} keys
|
|
6326
|
-
* @param {Object=} options
|
|
6327
|
-
* @return {!RegExp}
|
|
6328
|
-
*/
|
|
6329
|
-
function pathToRegexp (path, keys, options) {
|
|
6330
|
-
if (!isarray(keys)) {
|
|
6331
|
-
options = /** @type {!Object} */ (keys || options)
|
|
6332
|
-
keys = []
|
|
6333
|
-
}
|
|
6334
|
-
|
|
6335
|
-
options = options || {}
|
|
6336
|
-
|
|
6337
|
-
if (path instanceof RegExp) {
|
|
6338
|
-
return regexpToRegexp(path, /** @type {!Array} */ (keys))
|
|
6339
|
-
}
|
|
6340
|
-
|
|
6341
|
-
if (isarray(path)) {
|
|
6342
|
-
return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
|
|
6343
|
-
}
|
|
6344
|
-
|
|
6345
|
-
return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
|
|
6346
|
-
}
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
6015
|
/***/ }),
|
|
6350
6016
|
|
|
6351
6017
|
/***/ "../../../node_modules/prop-types/checkPropTypes.js":
|
|
@@ -37698,7 +37364,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
37698
37364
|
/* harmony import */ var tiny_warning__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! tiny-warning */ "../../../node_modules/tiny-warning/dist/tiny-warning.esm.js");
|
|
37699
37365
|
/* harmony import */ var tiny_invariant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tiny-invariant */ "../../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js");
|
|
37700
37366
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../../node_modules/@babel/runtime/helpers/esm/extends.js");
|
|
37701
|
-
/* harmony import */ var path_to_regexp__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! path-to-regexp */ "../../../node_modules/path-to-regexp/index.js");
|
|
37367
|
+
/* harmony import */ var path_to_regexp__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! path-to-regexp */ "../../../node_modules/react-router/node_modules/path-to-regexp/index.js");
|
|
37702
37368
|
/* harmony import */ var path_to_regexp__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(path_to_regexp__WEBPACK_IMPORTED_MODULE_4__);
|
|
37703
37369
|
/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-is */ "../../../node_modules/react-is/index.js");
|
|
37704
37370
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "../../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
|
|
@@ -38656,6 +38322,442 @@ if (true) {
|
|
|
38656
38322
|
//# sourceMappingURL=react-router.js.map
|
|
38657
38323
|
|
|
38658
38324
|
|
|
38325
|
+
/***/ }),
|
|
38326
|
+
|
|
38327
|
+
/***/ "../../../node_modules/react-router/node_modules/path-to-regexp/index.js":
|
|
38328
|
+
/*!*******************************************************************************!*\
|
|
38329
|
+
!*** ../../../node_modules/react-router/node_modules/path-to-regexp/index.js ***!
|
|
38330
|
+
\*******************************************************************************/
|
|
38331
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
38332
|
+
|
|
38333
|
+
var isarray = __webpack_require__(/*! isarray */ "../../../node_modules/isarray/index.js")
|
|
38334
|
+
|
|
38335
|
+
/**
|
|
38336
|
+
* Expose `pathToRegexp`.
|
|
38337
|
+
*/
|
|
38338
|
+
module.exports = pathToRegexp
|
|
38339
|
+
module.exports.parse = parse
|
|
38340
|
+
module.exports.compile = compile
|
|
38341
|
+
module.exports.tokensToFunction = tokensToFunction
|
|
38342
|
+
module.exports.tokensToRegExp = tokensToRegExp
|
|
38343
|
+
|
|
38344
|
+
/**
|
|
38345
|
+
* The main path matching regexp utility.
|
|
38346
|
+
*
|
|
38347
|
+
* @type {RegExp}
|
|
38348
|
+
*/
|
|
38349
|
+
var PATH_REGEXP = new RegExp([
|
|
38350
|
+
// Match escaped characters that would otherwise appear in future matches.
|
|
38351
|
+
// This allows the user to escape special characters that won't transform.
|
|
38352
|
+
'(\\\\.)',
|
|
38353
|
+
// Match Express-style parameters and un-named parameters with a prefix
|
|
38354
|
+
// and optional suffixes. Matches appear as:
|
|
38355
|
+
//
|
|
38356
|
+
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
|
|
38357
|
+
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
|
|
38358
|
+
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
|
|
38359
|
+
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
|
|
38360
|
+
].join('|'), 'g')
|
|
38361
|
+
|
|
38362
|
+
/**
|
|
38363
|
+
* Parse a string for the raw tokens.
|
|
38364
|
+
*
|
|
38365
|
+
* @param {string} str
|
|
38366
|
+
* @param {Object=} options
|
|
38367
|
+
* @return {!Array}
|
|
38368
|
+
*/
|
|
38369
|
+
function parse (str, options) {
|
|
38370
|
+
var tokens = []
|
|
38371
|
+
var key = 0
|
|
38372
|
+
var index = 0
|
|
38373
|
+
var path = ''
|
|
38374
|
+
var defaultDelimiter = options && options.delimiter || '/'
|
|
38375
|
+
var res
|
|
38376
|
+
|
|
38377
|
+
while ((res = PATH_REGEXP.exec(str)) != null) {
|
|
38378
|
+
var m = res[0]
|
|
38379
|
+
var escaped = res[1]
|
|
38380
|
+
var offset = res.index
|
|
38381
|
+
path += str.slice(index, offset)
|
|
38382
|
+
index = offset + m.length
|
|
38383
|
+
|
|
38384
|
+
// Ignore already escaped sequences.
|
|
38385
|
+
if (escaped) {
|
|
38386
|
+
path += escaped[1]
|
|
38387
|
+
continue
|
|
38388
|
+
}
|
|
38389
|
+
|
|
38390
|
+
var next = str[index]
|
|
38391
|
+
var prefix = res[2]
|
|
38392
|
+
var name = res[3]
|
|
38393
|
+
var capture = res[4]
|
|
38394
|
+
var group = res[5]
|
|
38395
|
+
var modifier = res[6]
|
|
38396
|
+
var asterisk = res[7]
|
|
38397
|
+
|
|
38398
|
+
// Push the current path onto the tokens.
|
|
38399
|
+
if (path) {
|
|
38400
|
+
tokens.push(path)
|
|
38401
|
+
path = ''
|
|
38402
|
+
}
|
|
38403
|
+
|
|
38404
|
+
var partial = prefix != null && next != null && next !== prefix
|
|
38405
|
+
var repeat = modifier === '+' || modifier === '*'
|
|
38406
|
+
var optional = modifier === '?' || modifier === '*'
|
|
38407
|
+
var delimiter = res[2] || defaultDelimiter
|
|
38408
|
+
var pattern = capture || group
|
|
38409
|
+
|
|
38410
|
+
tokens.push({
|
|
38411
|
+
name: name || key++,
|
|
38412
|
+
prefix: prefix || '',
|
|
38413
|
+
delimiter: delimiter,
|
|
38414
|
+
optional: optional,
|
|
38415
|
+
repeat: repeat,
|
|
38416
|
+
partial: partial,
|
|
38417
|
+
asterisk: !!asterisk,
|
|
38418
|
+
pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
|
|
38419
|
+
})
|
|
38420
|
+
}
|
|
38421
|
+
|
|
38422
|
+
// Match any characters still remaining.
|
|
38423
|
+
if (index < str.length) {
|
|
38424
|
+
path += str.substr(index)
|
|
38425
|
+
}
|
|
38426
|
+
|
|
38427
|
+
// If the path exists, push it onto the end.
|
|
38428
|
+
if (path) {
|
|
38429
|
+
tokens.push(path)
|
|
38430
|
+
}
|
|
38431
|
+
|
|
38432
|
+
return tokens
|
|
38433
|
+
}
|
|
38434
|
+
|
|
38435
|
+
/**
|
|
38436
|
+
* Compile a string to a template function for the path.
|
|
38437
|
+
*
|
|
38438
|
+
* @param {string} str
|
|
38439
|
+
* @param {Object=} options
|
|
38440
|
+
* @return {!function(Object=, Object=)}
|
|
38441
|
+
*/
|
|
38442
|
+
function compile (str, options) {
|
|
38443
|
+
return tokensToFunction(parse(str, options), options)
|
|
38444
|
+
}
|
|
38445
|
+
|
|
38446
|
+
/**
|
|
38447
|
+
* Prettier encoding of URI path segments.
|
|
38448
|
+
*
|
|
38449
|
+
* @param {string}
|
|
38450
|
+
* @return {string}
|
|
38451
|
+
*/
|
|
38452
|
+
function encodeURIComponentPretty (str) {
|
|
38453
|
+
return encodeURI(str).replace(/[\/?#]/g, function (c) {
|
|
38454
|
+
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
|
38455
|
+
})
|
|
38456
|
+
}
|
|
38457
|
+
|
|
38458
|
+
/**
|
|
38459
|
+
* Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
|
|
38460
|
+
*
|
|
38461
|
+
* @param {string}
|
|
38462
|
+
* @return {string}
|
|
38463
|
+
*/
|
|
38464
|
+
function encodeAsterisk (str) {
|
|
38465
|
+
return encodeURI(str).replace(/[?#]/g, function (c) {
|
|
38466
|
+
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
|
38467
|
+
})
|
|
38468
|
+
}
|
|
38469
|
+
|
|
38470
|
+
/**
|
|
38471
|
+
* Expose a method for transforming tokens into the path function.
|
|
38472
|
+
*/
|
|
38473
|
+
function tokensToFunction (tokens, options) {
|
|
38474
|
+
// Compile all the tokens into regexps.
|
|
38475
|
+
var matches = new Array(tokens.length)
|
|
38476
|
+
|
|
38477
|
+
// Compile all the patterns before compilation.
|
|
38478
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
38479
|
+
if (typeof tokens[i] === 'object') {
|
|
38480
|
+
matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options))
|
|
38481
|
+
}
|
|
38482
|
+
}
|
|
38483
|
+
|
|
38484
|
+
return function (obj, opts) {
|
|
38485
|
+
var path = ''
|
|
38486
|
+
var data = obj || {}
|
|
38487
|
+
var options = opts || {}
|
|
38488
|
+
var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent
|
|
38489
|
+
|
|
38490
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
38491
|
+
var token = tokens[i]
|
|
38492
|
+
|
|
38493
|
+
if (typeof token === 'string') {
|
|
38494
|
+
path += token
|
|
38495
|
+
|
|
38496
|
+
continue
|
|
38497
|
+
}
|
|
38498
|
+
|
|
38499
|
+
var value = data[token.name]
|
|
38500
|
+
var segment
|
|
38501
|
+
|
|
38502
|
+
if (value == null) {
|
|
38503
|
+
if (token.optional) {
|
|
38504
|
+
// Prepend partial segment prefixes.
|
|
38505
|
+
if (token.partial) {
|
|
38506
|
+
path += token.prefix
|
|
38507
|
+
}
|
|
38508
|
+
|
|
38509
|
+
continue
|
|
38510
|
+
} else {
|
|
38511
|
+
throw new TypeError('Expected "' + token.name + '" to be defined')
|
|
38512
|
+
}
|
|
38513
|
+
}
|
|
38514
|
+
|
|
38515
|
+
if (isarray(value)) {
|
|
38516
|
+
if (!token.repeat) {
|
|
38517
|
+
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
|
|
38518
|
+
}
|
|
38519
|
+
|
|
38520
|
+
if (value.length === 0) {
|
|
38521
|
+
if (token.optional) {
|
|
38522
|
+
continue
|
|
38523
|
+
} else {
|
|
38524
|
+
throw new TypeError('Expected "' + token.name + '" to not be empty')
|
|
38525
|
+
}
|
|
38526
|
+
}
|
|
38527
|
+
|
|
38528
|
+
for (var j = 0; j < value.length; j++) {
|
|
38529
|
+
segment = encode(value[j])
|
|
38530
|
+
|
|
38531
|
+
if (!matches[i].test(segment)) {
|
|
38532
|
+
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
|
|
38533
|
+
}
|
|
38534
|
+
|
|
38535
|
+
path += (j === 0 ? token.prefix : token.delimiter) + segment
|
|
38536
|
+
}
|
|
38537
|
+
|
|
38538
|
+
continue
|
|
38539
|
+
}
|
|
38540
|
+
|
|
38541
|
+
segment = token.asterisk ? encodeAsterisk(value) : encode(value)
|
|
38542
|
+
|
|
38543
|
+
if (!matches[i].test(segment)) {
|
|
38544
|
+
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
|
|
38545
|
+
}
|
|
38546
|
+
|
|
38547
|
+
path += token.prefix + segment
|
|
38548
|
+
}
|
|
38549
|
+
|
|
38550
|
+
return path
|
|
38551
|
+
}
|
|
38552
|
+
}
|
|
38553
|
+
|
|
38554
|
+
/**
|
|
38555
|
+
* Escape a regular expression string.
|
|
38556
|
+
*
|
|
38557
|
+
* @param {string} str
|
|
38558
|
+
* @return {string}
|
|
38559
|
+
*/
|
|
38560
|
+
function escapeString (str) {
|
|
38561
|
+
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
|
|
38562
|
+
}
|
|
38563
|
+
|
|
38564
|
+
/**
|
|
38565
|
+
* Escape the capturing group by escaping special characters and meaning.
|
|
38566
|
+
*
|
|
38567
|
+
* @param {string} group
|
|
38568
|
+
* @return {string}
|
|
38569
|
+
*/
|
|
38570
|
+
function escapeGroup (group) {
|
|
38571
|
+
return group.replace(/([=!:$\/()])/g, '\\$1')
|
|
38572
|
+
}
|
|
38573
|
+
|
|
38574
|
+
/**
|
|
38575
|
+
* Attach the keys as a property of the regexp.
|
|
38576
|
+
*
|
|
38577
|
+
* @param {!RegExp} re
|
|
38578
|
+
* @param {Array} keys
|
|
38579
|
+
* @return {!RegExp}
|
|
38580
|
+
*/
|
|
38581
|
+
function attachKeys (re, keys) {
|
|
38582
|
+
re.keys = keys
|
|
38583
|
+
return re
|
|
38584
|
+
}
|
|
38585
|
+
|
|
38586
|
+
/**
|
|
38587
|
+
* Get the flags for a regexp from the options.
|
|
38588
|
+
*
|
|
38589
|
+
* @param {Object} options
|
|
38590
|
+
* @return {string}
|
|
38591
|
+
*/
|
|
38592
|
+
function flags (options) {
|
|
38593
|
+
return options && options.sensitive ? '' : 'i'
|
|
38594
|
+
}
|
|
38595
|
+
|
|
38596
|
+
/**
|
|
38597
|
+
* Pull out keys from a regexp.
|
|
38598
|
+
*
|
|
38599
|
+
* @param {!RegExp} path
|
|
38600
|
+
* @param {!Array} keys
|
|
38601
|
+
* @return {!RegExp}
|
|
38602
|
+
*/
|
|
38603
|
+
function regexpToRegexp (path, keys) {
|
|
38604
|
+
// Use a negative lookahead to match only capturing groups.
|
|
38605
|
+
var groups = path.source.match(/\((?!\?)/g)
|
|
38606
|
+
|
|
38607
|
+
if (groups) {
|
|
38608
|
+
for (var i = 0; i < groups.length; i++) {
|
|
38609
|
+
keys.push({
|
|
38610
|
+
name: i,
|
|
38611
|
+
prefix: null,
|
|
38612
|
+
delimiter: null,
|
|
38613
|
+
optional: false,
|
|
38614
|
+
repeat: false,
|
|
38615
|
+
partial: false,
|
|
38616
|
+
asterisk: false,
|
|
38617
|
+
pattern: null
|
|
38618
|
+
})
|
|
38619
|
+
}
|
|
38620
|
+
}
|
|
38621
|
+
|
|
38622
|
+
return attachKeys(path, keys)
|
|
38623
|
+
}
|
|
38624
|
+
|
|
38625
|
+
/**
|
|
38626
|
+
* Transform an array into a regexp.
|
|
38627
|
+
*
|
|
38628
|
+
* @param {!Array} path
|
|
38629
|
+
* @param {Array} keys
|
|
38630
|
+
* @param {!Object} options
|
|
38631
|
+
* @return {!RegExp}
|
|
38632
|
+
*/
|
|
38633
|
+
function arrayToRegexp (path, keys, options) {
|
|
38634
|
+
var parts = []
|
|
38635
|
+
|
|
38636
|
+
for (var i = 0; i < path.length; i++) {
|
|
38637
|
+
parts.push(pathToRegexp(path[i], keys, options).source)
|
|
38638
|
+
}
|
|
38639
|
+
|
|
38640
|
+
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options))
|
|
38641
|
+
|
|
38642
|
+
return attachKeys(regexp, keys)
|
|
38643
|
+
}
|
|
38644
|
+
|
|
38645
|
+
/**
|
|
38646
|
+
* Create a path regexp from string input.
|
|
38647
|
+
*
|
|
38648
|
+
* @param {string} path
|
|
38649
|
+
* @param {!Array} keys
|
|
38650
|
+
* @param {!Object} options
|
|
38651
|
+
* @return {!RegExp}
|
|
38652
|
+
*/
|
|
38653
|
+
function stringToRegexp (path, keys, options) {
|
|
38654
|
+
return tokensToRegExp(parse(path, options), keys, options)
|
|
38655
|
+
}
|
|
38656
|
+
|
|
38657
|
+
/**
|
|
38658
|
+
* Expose a function for taking tokens and returning a RegExp.
|
|
38659
|
+
*
|
|
38660
|
+
* @param {!Array} tokens
|
|
38661
|
+
* @param {(Array|Object)=} keys
|
|
38662
|
+
* @param {Object=} options
|
|
38663
|
+
* @return {!RegExp}
|
|
38664
|
+
*/
|
|
38665
|
+
function tokensToRegExp (tokens, keys, options) {
|
|
38666
|
+
if (!isarray(keys)) {
|
|
38667
|
+
options = /** @type {!Object} */ (keys || options)
|
|
38668
|
+
keys = []
|
|
38669
|
+
}
|
|
38670
|
+
|
|
38671
|
+
options = options || {}
|
|
38672
|
+
|
|
38673
|
+
var strict = options.strict
|
|
38674
|
+
var end = options.end !== false
|
|
38675
|
+
var route = ''
|
|
38676
|
+
|
|
38677
|
+
// Iterate over the tokens and create our regexp string.
|
|
38678
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
38679
|
+
var token = tokens[i]
|
|
38680
|
+
|
|
38681
|
+
if (typeof token === 'string') {
|
|
38682
|
+
route += escapeString(token)
|
|
38683
|
+
} else {
|
|
38684
|
+
var prefix = escapeString(token.prefix)
|
|
38685
|
+
var capture = '(?:' + token.pattern + ')'
|
|
38686
|
+
|
|
38687
|
+
keys.push(token)
|
|
38688
|
+
|
|
38689
|
+
if (token.repeat) {
|
|
38690
|
+
capture += '(?:' + prefix + capture + ')*'
|
|
38691
|
+
}
|
|
38692
|
+
|
|
38693
|
+
if (token.optional) {
|
|
38694
|
+
if (!token.partial) {
|
|
38695
|
+
capture = '(?:' + prefix + '(' + capture + '))?'
|
|
38696
|
+
} else {
|
|
38697
|
+
capture = prefix + '(' + capture + ')?'
|
|
38698
|
+
}
|
|
38699
|
+
} else {
|
|
38700
|
+
capture = prefix + '(' + capture + ')'
|
|
38701
|
+
}
|
|
38702
|
+
|
|
38703
|
+
route += capture
|
|
38704
|
+
}
|
|
38705
|
+
}
|
|
38706
|
+
|
|
38707
|
+
var delimiter = escapeString(options.delimiter || '/')
|
|
38708
|
+
var endsWithDelimiter = route.slice(-delimiter.length) === delimiter
|
|
38709
|
+
|
|
38710
|
+
// In non-strict mode we allow a slash at the end of match. If the path to
|
|
38711
|
+
// match already ends with a slash, we remove it for consistency. The slash
|
|
38712
|
+
// is valid at the end of a path match, not in the middle. This is important
|
|
38713
|
+
// in non-ending mode, where "/test/" shouldn't match "/test//route".
|
|
38714
|
+
if (!strict) {
|
|
38715
|
+
route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?'
|
|
38716
|
+
}
|
|
38717
|
+
|
|
38718
|
+
if (end) {
|
|
38719
|
+
route += '$'
|
|
38720
|
+
} else {
|
|
38721
|
+
// In non-ending mode, we need the capturing groups to match as much as
|
|
38722
|
+
// possible by using a positive lookahead to the end or next path segment.
|
|
38723
|
+
route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)'
|
|
38724
|
+
}
|
|
38725
|
+
|
|
38726
|
+
return attachKeys(new RegExp('^' + route, flags(options)), keys)
|
|
38727
|
+
}
|
|
38728
|
+
|
|
38729
|
+
/**
|
|
38730
|
+
* Normalize the given path string, returning a regular expression.
|
|
38731
|
+
*
|
|
38732
|
+
* An empty array can be passed in for the keys, which will hold the
|
|
38733
|
+
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
|
|
38734
|
+
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
|
|
38735
|
+
*
|
|
38736
|
+
* @param {(string|RegExp|Array)} path
|
|
38737
|
+
* @param {(Array|Object)=} keys
|
|
38738
|
+
* @param {Object=} options
|
|
38739
|
+
* @return {!RegExp}
|
|
38740
|
+
*/
|
|
38741
|
+
function pathToRegexp (path, keys, options) {
|
|
38742
|
+
if (!isarray(keys)) {
|
|
38743
|
+
options = /** @type {!Object} */ (keys || options)
|
|
38744
|
+
keys = []
|
|
38745
|
+
}
|
|
38746
|
+
|
|
38747
|
+
options = options || {}
|
|
38748
|
+
|
|
38749
|
+
if (path instanceof RegExp) {
|
|
38750
|
+
return regexpToRegexp(path, /** @type {!Array} */ (keys))
|
|
38751
|
+
}
|
|
38752
|
+
|
|
38753
|
+
if (isarray(path)) {
|
|
38754
|
+
return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
|
|
38755
|
+
}
|
|
38756
|
+
|
|
38757
|
+
return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
|
|
38758
|
+
}
|
|
38759
|
+
|
|
38760
|
+
|
|
38659
38761
|
/***/ }),
|
|
38660
38762
|
|
|
38661
38763
|
/***/ "../../../node_modules/react/cjs/react.development.js":
|
|
@@ -45015,4 +45117,4 @@ var instance = (0,piral_core__WEBPACK_IMPORTED_MODULE_2__.createInstance)({
|
|
|
45015
45117
|
|
|
45016
45118
|
/******/ })()
|
|
45017
45119
|
;
|
|
45018
|
-
//# sourceMappingURL=index.
|
|
45120
|
+
//# sourceMappingURL=index.6860bf.js.map
|