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,OAA1C,EAAE,OAAO,GAAqB,YAAY,QAAjC,EAAE,cAAc,GAAK,YAAY,eAAjB,CAAkB;YAC9D,IAAI,OAAO,IAAI,IAAI,IAAI,CAAC,cAAc,IAAI,MAAM,KAAK,KAAK,CAAC;gBAAE,OAAO;YACpE,IAAI,CAAC,oBAAO,CAAC,OAAO,CAAC;gBAAE,OAAO,GAAG,CAAS,OAAO,CAAC,CAAC;YACnD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO;YACjC,IAAI,CAAC,KAAK,CAAC,GAAG;gBAAE,OAAO,GAAG,YAAG,CAAW,OAAO,EAAE,kBAAkB,CAAC,CAAC;YAErE,OAAkB,OAAQ,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAG,KAAK,CAAC,EAAE,SAAI,GAAK,EAApB,CAAoB,CAAC,CAAC;QAChE,CAAC,CAAC;aACD,MAAM,CAAC,iBAAQ,CAAC;aAChB,MAAM,CAAC,gBAAO,EAAE,EAAE,CAAC;aACnB,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,wFAAwF;QACxF,OAAO,UAAU,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,MAAI,WAAa,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACtG,CAAC;IA9dD,gBAAgB;IACT,wBAAa,GAAW,2BAA2B,CAAC;IA8d7D,iBAAC;CAAA,AAheD,IAgeC;AAheY,gCAAU",
10 "sourcesContent": [
11 "import { map, inherit, identity, unnest, tail, find, Obj, allTrueR, unnestR, arrayTuples } from '../common/common';\nimport { prop, propEq } from '../common/hof';\nimport { isArray, isString, isDefined } from '../common/predicates';\nimport { Param, DefType } from '../params/param';\nimport { ParamTypes } from '../params/paramTypes';\nimport { RawParams } from '../params/interface';\nimport { UrlMatcherCompileConfig } from './interface';\nimport { joinNeighborsR, splitOnDelim } from '../common/strings';\nimport { ParamType } from '../params';\nimport { defaults } from '../common';\nimport { ParamFactory } from './urlMatcherFactory';\n\nfunction quoteRegExp(str: any, param?: any) {\n let surroundPattern = ['', ''],\n result = str.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, '\\\\$&');\n if (!param) return result;\n\n switch (param.squash) {\n case false:\n surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')];\n break;\n case true:\n result = result.replace(/\\/$/, '');\n surroundPattern = ['(?:/(', ')|/)?'];\n break;\n default:\n surroundPattern = [`(${param.squash}|`, ')?'];\n break;\n }\n return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1];\n}\n\nconst memoizeTo = (obj: Obj, _prop: string, fn: Function) => (obj[_prop] = obj[_prop] || fn());\n\nconst splitOnSlash = splitOnDelim('/');\n\ninterface UrlMatcherCache {\n segments?: any[];\n weights?: number[];\n path?: UrlMatcher[];\n parent?: UrlMatcher;\n pattern?: RegExp;\n}\n\ninterface MatchDetails {\n id: string;\n regexp: string;\n segment: string;\n type: ParamType;\n}\n\nconst defaultConfig: UrlMatcherCompileConfig = {\n state: { params: {} },\n strict: true,\n caseInsensitive: true,\n decodeParams: true,\n};\n\n/**\n * Matches URLs against patterns.\n *\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL.\n *\n * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query)\n * parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by [[UrlMatcher.exec]].\n *\n * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`)\n * or colon placeholders (`/somePath/:param`).\n *\n * - *A parameter RegExp* may be defined for a param after a colon\n * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder.\n * The regexp must match for the url to be matched.\n * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]].\n *\n * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters.\n * See [[UrlMatcherFactory.type]] for more information.\n *\n * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`).\n * A catch-all * parameter value will contain the remainder of the URL.\n *\n * ---\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters).\n * A path parameter matches any number of characters other than '/'. For catch-all\n * placeholders the path parameter matches any number of characters.\n *\n * Examples:\n *\n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n * trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n * '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n * parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n * path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n */\nexport class UrlMatcher {\n /** @internal */\n static nameValidator: RegExp = /^\\w+([-.]+\\w+)*(?:\\[\\])?$/;\n\n /** @internal */\n private _cache: UrlMatcherCache = { path: [this] };\n /** @internal */\n private _children: UrlMatcher[] = [];\n /** @internal */\n private _params: Param[] = [];\n /** @internal */\n private _segments: string[] = [];\n /** @internal */\n private _compiled: string[] = [];\n /** @internal */\n private readonly config: UrlMatcherCompileConfig;\n\n /** The pattern that was passed into the constructor */\n public pattern: string;\n\n /** @internal */\n static encodeDashes(str: string) {\n // Replace dashes with encoded \"\\-\"\n return encodeURIComponent(str).replace(/-/g, (c) => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`);\n }\n\n /** @internal Given a matcher, return an array with the matcher's path segments and path params, in order */\n static pathSegmentsAndParams(matcher: UrlMatcher) {\n const staticSegments = matcher._segments;\n const pathParams = matcher._params.filter((p) => p.location === DefType.PATH);\n return arrayTuples(staticSegments, pathParams.concat(undefined))\n .reduce(unnestR, [])\n .filter((x) => x !== '' && isDefined(x));\n }\n\n /** @internal Given a matcher, return an array with the matcher's query params */\n static queryParams(matcher: UrlMatcher): Param[] {\n return matcher._params.filter((p) => p.location === DefType.SEARCH);\n }\n\n /**\n * Compare two UrlMatchers\n *\n * This comparison function converts a UrlMatcher into static and dynamic path segments.\n * Each static path segment is a static string between a path separator (slash character).\n * Each dynamic segment is a path parameter.\n *\n * The comparison function sorts static segments before dynamic ones.\n */\n static compare(a: UrlMatcher, b: UrlMatcher): number {\n /**\n * Turn a UrlMatcher and all its parent matchers into an array\n * of slash literals '/', string literals, and Param objects\n *\n * This example matcher matches strings like \"/foo/:param/tail\":\n * var matcher = $umf.compile(\"/foo\").append($umf.compile(\"/:param\")).append($umf.compile(\"/\")).append($umf.compile(\"tail\"));\n * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ]\n *\n * Caches the result as `matcher._cache.segments`\n */\n const segments = (matcher: UrlMatcher) =>\n (matcher._cache.segments =\n matcher._cache.segments ||\n matcher._cache.path\n .map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .reduce(joinNeighborsR, [])\n .map((x) => (isString(x) ? splitOnSlash(x) : x))\n .reduce(unnestR, []));\n\n /**\n * Gets the sort weight for each segment of a UrlMatcher\n *\n * Caches the result as `matcher._cache.weights`\n */\n const weights = (matcher: UrlMatcher) =>\n (matcher._cache.weights =\n matcher._cache.weights ||\n segments(matcher).map((segment) => {\n // Sort slashes first, then static strings, the Params\n if (segment === '/') return 1;\n if (isString(segment)) return 2;\n if (segment instanceof Param) return 3;\n }));\n\n /**\n * Pads shorter array in-place (mutates)\n */\n const padArrays = (l: any[], r: any[], padVal: any) => {\n const len = Math.max(l.length, r.length);\n while (l.length < len) l.push(padVal);\n while (r.length < len) r.push(padVal);\n };\n\n const weightsA = weights(a),\n weightsB = weights(b);\n padArrays(weightsA, weightsB, 0);\n\n const _pairs = arrayTuples(weightsA, weightsB);\n let cmp, i;\n\n for (i = 0; i < _pairs.length; i++) {\n cmp = _pairs[i][0] - _pairs[i][1];\n if (cmp !== 0) return cmp;\n }\n\n return 0;\n }\n\n /**\n * @param pattern The pattern to compile into a matcher.\n * @param paramTypes The [[ParamTypes]] registry\n * @param paramFactory A [[ParamFactory]] object\n * @param config A [[UrlMatcherCompileConfig]] configuration object\n */\n constructor(pattern: string, paramTypes: ParamTypes, paramFactory: ParamFactory, config?: UrlMatcherCompileConfig) {\n this.config = config = defaults(config, defaultConfig);\n this.pattern = pattern;\n\n // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n // '*' name\n // ':' name\n // '{' name '}'\n // '{' name ':' regexp '}'\n // The regular expression is somewhat complicated due to the need to allow curly braces\n // inside the regular expression. The placeholder regexp breaks down as follows:\n // ([:*])([\\w\\[\\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case)\n // \\{([\\w\\[\\]]+)(?:\\:\\s*( ... ))?\\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either\n // [^{}\\\\]+ - anything other than curly braces or backslash\n // \\\\. - a backslash escape\n // \\{(?:[^{}\\\\]+|\\\\.)*\\} - a matched set of curly braces containing other atoms\n const placeholder = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g;\n const searchPlaceholder = /([:]?)([\\w\\[\\].-]+)|\\{([\\w\\[\\].-]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g;\n const patterns: any[][] = [];\n let last = 0;\n let matchArray: RegExpExecArray;\n\n const checkParamErrors = (id: string) => {\n if (!UrlMatcher.nameValidator.test(id)) throw new Error(`Invalid parameter name '${id}' in pattern '${pattern}'`);\n if (find(this._params, propEq('id', id)))\n throw new Error(`Duplicate parameter name '${id}' in pattern '${pattern}'`);\n };\n\n // Split into static segments separated by path parameter placeholders.\n // The number of segments is always 1 more than the number of parameters.\n const matchDetails = (m: RegExpExecArray, isSearch: boolean): MatchDetails => {\n // IE[78] returns '' for unmatched groups instead of null\n const id: string = m[2] || m[3];\n const regexp: string = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\\\s\\\\S]*' : null);\n\n const makeRegexpType = (str) =>\n inherit(paramTypes.type(isSearch ? 'query' : 'path'), {\n pattern: new RegExp(str, this.config.caseInsensitive ? 'i' : undefined),\n });\n\n return {\n id,\n regexp,\n segment: pattern.substring(last, m.index),\n type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp),\n };\n };\n\n let details: MatchDetails;\n let segment: string;\n\n // tslint:disable-next-line:no-conditional-assignment\n while ((matchArray = placeholder.exec(pattern))) {\n details = matchDetails(matchArray, false);\n if (details.segment.indexOf('?') >= 0) break; // we're into the search part\n\n checkParamErrors(details.id);\n this._params.push(paramFactory.fromPath(details.id, details.type, config.state));\n this._segments.push(details.segment);\n patterns.push([details.segment, tail(this._params)]);\n last = placeholder.lastIndex;\n }\n segment = pattern.substring(last);\n\n // Find any search parameter names and remove them from the last segment\n const i = segment.indexOf('?');\n\n if (i >= 0) {\n const search = segment.substring(i);\n segment = segment.substring(0, i);\n\n if (search.length > 0) {\n last = 0;\n\n // tslint:disable-next-line:no-conditional-assignment\n while ((matchArray = searchPlaceholder.exec(search))) {\n details = matchDetails(matchArray, true);\n checkParamErrors(details.id);\n this._params.push(paramFactory.fromSearch(details.id, details.type, config.state));\n last = placeholder.lastIndex;\n // check if ?&\n }\n }\n }\n\n this._segments.push(segment);\n this._compiled = patterns.map((_pattern) => quoteRegExp.apply(null, _pattern)).concat(quoteRegExp(segment));\n }\n\n /**\n * Creates a new concatenated UrlMatcher\n *\n * Builds a new UrlMatcher by appending another UrlMatcher to this one.\n *\n * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`.\n */\n append(url: UrlMatcher): UrlMatcher {\n this._children.push(url);\n url._cache = {\n path: this._cache.path.concat(url),\n parent: this,\n pattern: null,\n };\n return url;\n }\n\n /** @internal */\n isRoot(): boolean {\n return this._cache.path[0] === this;\n }\n\n /** Returns the input pattern string */\n toString(): string {\n return this.pattern;\n }\n\n private _getDecodedParamValue(value: any, param: Param): any {\n if (isDefined(value)) {\n if (this.config.decodeParams && !param.type.raw) {\n if (isArray(value)) {\n value = value.map((paramValue) => decodeURIComponent(paramValue));\n } else {\n value = decodeURIComponent(value);\n }\n }\n\n value = param.type.decode(value);\n }\n\n return param.value(value);\n }\n\n /**\n * Tests the specified url/path against this matcher.\n *\n * Tests if the given url matches this matcher's pattern, and returns an object containing the captured\n * parameter values. Returns null if the path does not match.\n *\n * The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `search`. This means that search parameters are always treated\n * as optional.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n * x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * ```\n *\n * @param path The URL path to match, e.g. `$location.path()`.\n * @param search URL search parameters, e.g. `$location.search()`.\n * @param hash URL hash e.g. `$location.hash()`.\n * @param options\n *\n * @returns The captured parameter values.\n */\n exec(path: string, search: any = {}, hash?: string, options: any = {}): RawParams {\n const match = memoizeTo(this._cache, 'pattern', () => {\n return new RegExp(\n [\n '^',\n unnest(this._cache.path.map(prop('_compiled'))).join(''),\n this.config.strict === false ? '/?' : '',\n '$',\n ].join(''),\n this.config.caseInsensitive ? 'i' : undefined\n );\n }).exec(path);\n\n if (!match) return null;\n\n // options = defaults(options, { isolate: false });\n\n const allParams: Param[] = this.parameters(),\n pathParams: Param[] = allParams.filter((param) => !param.isSearch()),\n searchParams: Param[] = allParams.filter((param) => param.isSearch()),\n nPathSegments = this._cache.path.map((urlm) => urlm._segments.length - 1).reduce((a, x) => a + x),\n values: RawParams = {};\n\n if (nPathSegments !== match.length - 1) throw new Error(`Unbalanced capture group in route '${this.pattern}'`);\n\n function decodePathArray(paramVal: string) {\n const reverseString = (str: string) => str.split('').reverse().join('');\n const unquoteDashes = (str: string) => str.replace(/\\\\-/g, '-');\n\n const split = reverseString(paramVal).split(/-(?!\\\\)/);\n const allReversed = map(split, reverseString);\n return map(allReversed, unquoteDashes).reverse();\n }\n\n for (let i = 0; i < nPathSegments; i++) {\n const param: Param = pathParams[i];\n let value: any | any[] = match[i + 1];\n\n // if the param value matches a pre-replace pair, replace the value before decoding.\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n\n if (value && param.array === true) value = decodePathArray(value);\n\n values[param.id] = this._getDecodedParamValue(value, param);\n }\n searchParams.forEach((param: Param) => {\n let value = search[param.id];\n\n for (let j = 0; j < param.replace.length; j++) {\n if (param.replace[j].from === value) value = param.replace[j].to;\n }\n\n values[param.id] = this._getDecodedParamValue(value, param);\n });\n\n if (hash) values['#'] = hash;\n\n return values;\n }\n\n /**\n * @internal\n * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance.\n *\n * @returns {Array.<Param>} An array of [[Param]] objects. Must be treated as read-only. If the\n * pattern has no parameters, an empty array is returned.\n */\n parameters(opts: any = {}): Param[] {\n if (opts.inherit === false) return this._params;\n return unnest(this._cache.path.map((matcher) => matcher._params));\n }\n\n /**\n * @internal\n * Returns a single parameter from this UrlMatcher by id\n *\n * @param id\n * @param opts\n * @returns {T|Param|any|boolean|UrlMatcher|null}\n */\n parameter(id: string, opts: any = {}): Param {\n const findParam = () => {\n for (const param of this._params) {\n if (param.id === id) return param;\n }\n };\n\n const parent = this._cache.parent;\n return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null;\n }\n\n /**\n * Validates the input parameter values against this UrlMatcher\n *\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param params The object hash of parameters to validate.\n * @returns Returns `true` if `params` validates, otherwise `false`.\n */\n validates(params: RawParams): boolean {\n const validParamVal = (param: Param, val: any) => !param || param.validates(val);\n\n params = params || {};\n\n // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher\n const paramSchema = this.parameters().filter((paramDef) => params.hasOwnProperty(paramDef.id));\n return paramSchema.map((paramDef) => validParamVal(paramDef, params[paramDef.id])).reduce(allTrueR, true);\n }\n\n /**\n * Given a set of parameter values, creates a URL from this UrlMatcher.\n *\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters.\n *\n * #### Example:\n * ```js\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param values the values to substitute for the parameters in this pattern.\n * @returns the formatted URL (path and optionally search part).\n */\n format(values: RawParams = {}) {\n // Build the full path of UrlMatchers (including all parent UrlMatchers)\n const urlMatchers = this._cache.path;\n\n // Extract all the static segments and Params (processed as ParamDetails)\n // into an ordered array\n const pathSegmentsAndParams: Array<string | ParamDetails> = urlMatchers\n .map(UrlMatcher.pathSegmentsAndParams)\n .reduce(unnestR, [])\n .map((x) => (isString(x) ? x : getDetails(x)));\n\n // Extract the query params into a separate array\n const queryParams: Array<ParamDetails> = urlMatchers\n .map(UrlMatcher.queryParams)\n .reduce(unnestR, [])\n .map(getDetails);\n\n const isInvalid = (param: ParamDetails) => param.isValid === false;\n if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) {\n return null;\n }\n\n /**\n * Given a Param, applies the parameter value, then returns detailed information about it\n */\n function getDetails(param: Param): ParamDetails {\n // Normalize to typed value\n const value = param.value(values[param.id]);\n const isValid = param.validates(value);\n const isDefaultValue = param.isDefaultValue(value);\n // Check if we're in squash mode for the parameter\n const squash = isDefaultValue ? param.squash : false;\n // Allow the Parameter's Type to encode the value\n const encoded = param.type.encode(value);\n\n return { param, value, isValid, isDefaultValue, squash, encoded };\n }\n\n // Build up the path-portion from the list of static segments and parameters\n const pathString = pathSegmentsAndParams.reduce((acc: string, x: string | ParamDetails) => {\n // The element is a static segment (a raw string); just append it\n if (isString(x)) return acc + x;\n\n // Otherwise, it's a ParamDetails.\n const { squash, encoded, param } = x;\n\n // If squash is === true, try to remove a slash from the path\n if (squash === true) return acc.match(/\\/$/) ? acc.slice(0, -1) : acc;\n // If squash is a string, use the string for the param value\n if (isString(squash)) return acc + squash;\n if (squash !== false) return acc; // ?\n if (encoded == null) return acc;\n // If this parameter value is an array, encode the value using encodeDashes\n if (isArray(encoded)) return acc + map(<string[]>encoded, UrlMatcher.encodeDashes).join('-');\n // If the parameter type is \"raw\", then do not encodeURIComponent\n if (param.raw) return acc + encoded;\n // Encode the value\n return acc + encodeURIComponent(<string>encoded);\n }, '');\n\n // Build the query string by applying parameter values (array or regular)\n // then mapping to key=value, then flattening and joining using \"&\"\n const queryString = queryParams\n .map((paramDetails: ParamDetails) => {\n let { param, squash, encoded, isDefaultValue } = paramDetails;\n if (encoded == null || (isDefaultValue && squash !== false)) return;\n if (!isArray(encoded)) encoded = [<string>encoded];\n if (encoded.length === 0) return;\n if (!param.raw) encoded = map(<string[]>encoded, encodeURIComponent);\n\n return (<string[]>encoded).map((val) => `${param.id}=${val}`);\n })\n .filter(identity)\n .reduce(unnestR, [])\n .join('&');\n\n // Concat the pathstring with the queryString (if exists) and the hashString (if exists)\n return pathString + (queryString ? `?${queryString}` : '') + (values['#'] ? '#' + values['#'] : '');\n }\n}\n\n/** @internal */\ninterface ParamDetails {\n param: Param;\n value: any;\n isValid: boolean;\n isDefaultValue: boolean;\n squash: boolean | string;\n encoded: string | string[];\n}\n"
12 ]
13}
\No newline at end of file