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I,EAAE,OAAO,CAAC,CAAC;KAC3C;IAED,OAAO,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/**\n * Default configs.\n */\nconst DEFAULT_DELIMITER = \"/\";\n\nexport interface ParseOptions {\n /**\n * Set the default delimiter for repeat parameters. (default: `'/'`)\n */\n delimiter?: string;\n /**\n * List of characters to consider delimiters when parsing. (default: `undefined`, any character)\n */\n whitelist?: string | string[];\n}\n\n/**\n * Normalize a pathname for matching, replaces multiple slashes with a single\n * slash and normalizes unicode characters to \"NFC\". When using this method,\n * `decode` should be an identity function so you don't decode strings twice.\n */\nexport function normalizePathname(pathname: string) {\n return decodeURI(pathname).replace(/\\/+/g, \"/\");\n}\n\n/**\n * Balanced bracket helper function.\n */\nfunction balanced(open: string, close: string, str: string, index: number) {\n let count = 0;\n let i = index;\n\n while (i < str.length) {\n if (str[i] === \"\\\\\") {\n i += 2;\n continue;\n }\n\n if (str[i] === close) {\n count--;\n\n if (count === 0) return i + 1;\n }\n\n if (str[i] === open) {\n count++;\n }\n\n i++;\n }\n\n return -1;\n}\n\n/**\n * Parse a string for the raw tokens.\n */\nexport function parse(str: string, options: ParseOptions = {}): Token[] {\n const tokens = [];\n const defaultDelimiter = options.delimiter ?? DEFAULT_DELIMITER;\n const whitelist = options.whitelist ?? undefined;\n let i = 0;\n let key = 0;\n let path = \"\";\n let isEscaped = false;\n\n // tslint:disable-next-line\n while (i < str.length) {\n let prefix = \"\";\n let name = \"\";\n let pattern = \"\";\n\n // Ignore escaped sequences.\n if (str[i] === \"\\\\\") {\n i++;\n path += str[i++];\n isEscaped = true;\n continue;\n }\n\n if (str[i] === \":\") {\n while (++i < str.length) {\n const code = str.charCodeAt(i);\n\n if (\n // `0-9`\n (code >= 48 && code <= 57) ||\n // `A-Z`\n (code >= 65 && code <= 90) ||\n // `a-z`\n (code >= 97 && code <= 122) ||\n // `_`\n code === 95\n ) {\n name += str[i];\n continue;\n }\n\n break;\n }\n\n // False positive on param name.\n if (!name) i--;\n }\n\n if (str[i] === \"(\") {\n const end = balanced(\"(\", \")\", str, i);\n\n // False positive on matching brackets.\n if (end > -1) {\n pattern = str.slice(i + 1, end - 1);\n i = end;\n\n if (pattern[0] === \"?\") {\n throw new TypeError(\"Path pattern must be a capturing group\");\n }\n\n if (/\\((?=[^?])/.test(pattern)) {\n const validPattern = pattern.replace(/\\((?=[^?])/, \"(?:\");\n\n throw new TypeError(\n `Capturing groups are not allowed in pattern, use a non-capturing group: (${validPattern})`\n );\n }\n }\n }\n\n // Add regular characters to the path string.\n if (name === \"\" && pattern === \"\") {\n path += str[i++];\n isEscaped = false;\n continue;\n }\n\n // Extract the final character from `path` for the prefix.\n if (path.length && !isEscaped) {\n const char = path[path.length - 1];\n const matches = whitelist ? whitelist.indexOf(char) > -1 : true;\n\n if (matches) {\n prefix = char;\n path = path.slice(0, -1);\n }\n }\n\n // Push the current path onto the list of tokens.\n if (path.length) {\n tokens.push(path);\n path = \"\";\n }\n\n const repeat = str[i] === \"+\" || str[i] === \"*\";\n const optional = str[i] === \"?\" || str[i] === \"*\";\n const delimiter = prefix || defaultDelimiter;\n\n // Increment `i` past modifier token.\n if (repeat || optional) i++;\n\n tokens.push({\n name: name || key++,\n prefix,\n delimiter,\n optional,\n repeat,\n pattern:\n pattern ||\n `[^${escapeString(\n delimiter === defaultDelimiter\n ? delimiter\n : delimiter + defaultDelimiter\n )}]+?`\n });\n }\n\n if (path.length) tokens.push(path);\n\n return tokens;\n}\n\nexport interface TokensToFunctionOptions {\n /**\n * When `true` the regexp will be case sensitive. (default: `false`)\n */\n sensitive?: boolean;\n /**\n * Function for encoding input strings for output.\n */\n encode?: (value: string, token: Key) => string;\n /**\n * When `false` the function can produce an invalid (unmatched) path. (default: `true`)\n */\n validate?: boolean;\n}\n\n/**\n * Compile a string to a template function for the path.\n */\nexport function compile

(\n str: string,\n options?: ParseOptions & TokensToFunctionOptions\n) {\n return tokensToFunction

(parse(str, options), options);\n}\n\nexport type PathFunction

= (data?: P) => string;\n\n/**\n * Expose a method for transforming tokens into the path function.\n */\nexport function tokensToFunction

(\n tokens: Token[],\n options: TokensToFunctionOptions = {}\n): PathFunction

{\n const reFlags = flags(options);\n const { encode = encodeURIComponent, validate = true } = options;\n\n // Compile all the tokens into regexps.\n const matches = tokens.map(token => {\n if (typeof token === \"object\") {\n return new RegExp(`^(?:${token.pattern})$`, reFlags);\n }\n });\n\n return (data: Record | null | undefined) => {\n let path = \"\";\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n\n if (typeof token === \"string\") {\n path += token;\n continue;\n }\n\n const value = data ? data[token.name] : undefined;\n\n if (Array.isArray(value)) {\n if (!token.repeat) {\n throw new TypeError(\n `Expected \"${token.name}\" to not repeat, but got an array`\n );\n }\n\n if (value.length === 0) {\n if (token.optional) continue;\n\n throw new TypeError(`Expected \"${token.name}\" to not be empty`);\n }\n\n for (let j = 0; j < value.length; j++) {\n const segment = encode(value[j], token);\n\n if (validate && !(matches[i] as RegExp).test(segment)) {\n throw new TypeError(\n `Expected all \"${token.name}\" to match \"${token.pattern}\", but got \"${segment}\"`\n );\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue;\n }\n\n if (typeof value === \"string\" || typeof value === \"number\") {\n const segment = encode(String(value), token);\n\n if (validate && !(matches[i] as RegExp).test(segment)) {\n throw new TypeError(\n `Expected \"${token.name}\" to match \"${token.pattern}\", but got \"${segment}\"`\n );\n }\n\n path += token.prefix + segment;\n continue;\n }\n\n if (token.optional) continue;\n\n const typeOfMessage = token.repeat ? \"an array\" : \"a string\";\n throw new TypeError(`Expected \"${token.name}\" to be ${typeOfMessage}`);\n }\n\n return path;\n };\n}\n\nexport interface RegexpToFunctionOptions {\n /**\n * Function for decoding strings for params.\n */\n decode?: (value: string, token: Key) => string;\n}\n\n/**\n * A match result contains data about the path match.\n */\nexport interface MatchResult

{\n path: string;\n index: number;\n params: P;\n}\n\n/**\n * A match is either `false` (no match) or a match result.\n */\nexport type Match

= false | MatchResult

;\n\n/**\n * The match function takes a string and returns whether it matched the path.\n */\nexport type MatchFunction

= (\n path: string\n) => Match

;\n\n/**\n * Create path match function from `path-to-regexp` spec.\n */\nexport function match

(\n str: Path,\n options?: ParseOptions & RegexpOptions & RegexpToFunctionOptions\n) {\n const keys: Key[] = [];\n const re = pathToRegexp(str, keys, options);\n return regexpToFunction

(re, keys, options);\n}\n\n/**\n * Create a path match function from `path-to-regexp` output.\n */\nexport function regexpToFunction

(\n re: RegExp,\n keys: Key[],\n options: RegexpToFunctionOptions = {}\n): MatchFunction

{\n const { decode = (x: string) => x } = options;\n\n return function(pathname: string) {\n const m = re.exec(pathname);\n if (!m) return false;\n\n const { 0: path, index } = m;\n const params = Object.create(null);\n\n for (let i = 1; i < m.length; i++) {\n // tslint:disable-next-line\n if (m[i] === undefined) continue;\n\n const key = keys[i - 1];\n\n if (key.repeat) {\n params[key.name] = m[i].split(key.delimiter).map(value => {\n return decode(value, key);\n });\n } else {\n params[key.name] = decode(m[i], key);\n }\n }\n\n return { path, index, params };\n };\n}\n\n/**\n * Escape a regular expression string.\n */\nfunction escapeString(str: string) {\n return str.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n}\n\n/**\n * Get the flags for a regexp from the options.\n */\nfunction flags(options?: { sensitive?: boolean }) {\n return options && options.sensitive ? \"\" : \"i\";\n}\n\n/**\n * Metadata about a key.\n */\nexport interface Key {\n name: string | number;\n prefix: string;\n delimiter: string;\n optional: boolean;\n repeat: boolean;\n pattern: string;\n}\n\n/**\n * A token is a string (nothing special) or key metadata (capture group).\n */\nexport type Token = string | Key;\n\n/**\n * Pull out keys from a regexp.\n */\nfunction regexpToRegexp(path: RegExp, keys?: Key[]): RegExp {\n if (!keys) return path;\n\n // Use a negative lookahead to match only capturing groups.\n const groups = path.source.match(/\\((?!\\?)/g);\n\n if (groups) {\n for (let i = 0; i < groups.length; i++) {\n keys.push({\n name: i,\n prefix: \"\",\n delimiter: \"\",\n optional: false,\n repeat: false,\n pattern: \"\"\n });\n }\n }\n\n return path;\n}\n\n/**\n * Transform an array into a regexp.\n */\nfunction arrayToRegexp(\n paths: Array,\n keys?: Key[],\n options?: RegexpOptions & ParseOptions\n): RegExp {\n const parts = paths.map(path => pathToRegexp(path, keys, options).source);\n return new RegExp(`(?:${parts.join(\"|\")})`, flags(options));\n}\n\n/**\n * Create a path regexp from string input.\n */\nfunction stringToRegexp(\n path: string,\n keys?: Key[],\n options?: RegexpOptions & ParseOptions\n) {\n return tokensToRegexp(parse(path, options), keys, options);\n}\n\n/**\n * Expose a function for taking tokens and returning a RegExp.\n */\nexport function tokensToRegexp(\n tokens: Token[],\n keys?: Key[],\n options: RegexpOptions = {}\n) {\n const {\n strict,\n start = true,\n end = true,\n delimiter = DEFAULT_DELIMITER\n } = options;\n const endsWith = (typeof options.endsWith === \"string\"\n ? options.endsWith.split(\"\")\n : options.endsWith || []\n )\n .map(escapeString)\n .concat(\"$\")\n .join(\"|\");\n let route = start ? \"^\" : \"\";\n\n // Iterate over the tokens and create our regexp string.\n for (const token of tokens) {\n if (typeof token === \"string\") {\n route += escapeString(token);\n } else {\n const capture = token.repeat\n ? `(?:${token.pattern})(?:${escapeString(token.delimiter)}(?:${\n token.pattern\n }))*`\n : token.pattern;\n\n if (keys) keys.push(token);\n\n if (token.optional) {\n if (!token.prefix) {\n route += `(${capture})?`;\n } else {\n route += `(?:${escapeString(token.prefix)}(${capture}))?`;\n }\n } else {\n route += `${escapeString(token.prefix)}(${capture})`;\n }\n }\n }\n\n if (end) {\n if (!strict) route += `(?:${escapeString(delimiter)})?`;\n\n route += endsWith === \"$\" ? \"$\" : `(?=${endsWith})`;\n } else {\n const endToken = tokens[tokens.length - 1];\n const isEndDelimited =\n typeof endToken === \"string\"\n ? endToken[endToken.length - 1] === delimiter\n : // tslint:disable-next-line\n endToken === undefined;\n\n if (!strict) {\n route += `(?:${escapeString(delimiter)}(?=${endsWith}))?`;\n }\n\n if (!isEndDelimited) {\n route += `(?=${escapeString(delimiter)}|${endsWith})`;\n }\n }\n\n return new RegExp(route, flags(options));\n}\n\nexport interface RegexpOptions {\n /**\n * When `true` the regexp will be case sensitive. (default: `false`)\n */\n sensitive?: boolean;\n /**\n * When `true` the regexp allows an optional trailing delimiter to match. (default: `false`)\n */\n strict?: boolean;\n /**\n * When `true` the regexp will match to the end of the string. (default: `true`)\n */\n end?: boolean;\n /**\n * When `true` the regexp will match from the beginning of the string. (default: `true`)\n */\n start?: boolean;\n /**\n * Sets the final character for non-ending optimistic matches. (default: `/`)\n */\n delimiter?: string;\n /**\n * List of characters that can also be \"end\" characters.\n */\n endsWith?: string | string[];\n}\n\nexport interface ParseOptions {\n /**\n * Set the default delimiter for repeat parameters. (default: `'/'`)\n */\n delimiter?: string;\n}\n\n/**\n * Supported `path-to-regexp` input types.\n */\nexport type Path = string | RegExp | Array;\n\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n */\nexport function pathToRegexp(\n path: Path,\n keys?: Key[],\n options?: RegexpOptions & ParseOptions\n) {\n if (path instanceof RegExp) {\n return regexpToRegexp(path, keys);\n }\n\n if (Array.isArray(path)) {\n return arrayToRegexp(path, keys, options);\n }\n\n return stringToRegexp(path, keys, options);\n}\n"]}