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,CAAC;QACF,OAAO,IAAI,uBAAU,CAAC,OAAO,EAAE,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,EAAE,eAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IACxG,CAAC;IAED;;;;;;OAMG;IACH,qCAAS,GAAT,UAAU,MAAW;QACnB,gBAAgB;QAChB,IAAI,CAAC,iBAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,KAAK,CAAC;QACpC,IAAI,MAAM,GAAG,IAAI,CAAC;QAElB,gBAAO,CAAC,uBAAU,CAAC,SAAS,EAAE,UAAC,GAAG,EAAE,IAAI;YACtC,IAAI,mBAAU,CAAC,GAAG,CAAC;gBAAE,MAAM,GAAG,MAAM,IAAI,kBAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,mBAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9F,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,gBAAgB;IAChB,gCAAI,GAAJ;QACE,IAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;QAChD,SAAS,CAAC,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC;QACrC,SAAS,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAeH,wBAAC;AAAD,CAAC,AArED,IAqEC;AArEY,8CAAiB",
10 "sourcesContent": [
11 "import { extend, forEach, isDefined, isFunction, isObject } from '../common';\nimport { UrlMatcher } from './urlMatcher';\nimport { DefType, Param, ParamType, ParamTypeDefinition } from '../params';\nimport { UrlMatcherCompileConfig } from './interface';\nimport { StateDeclaration } from '../state';\nimport { UIRouter } from '../router';\n\nexport class ParamFactory {\n fromConfig(id: string, type: ParamType, state: StateDeclaration) {\n return new Param(id, type, DefType.CONFIG, this.router.urlService.config, state);\n }\n\n fromPath(id: string, type: ParamType, state: StateDeclaration) {\n return new Param(id, type, DefType.PATH, this.router.urlService.config, state);\n }\n\n fromSearch(id: string, type: ParamType, state: StateDeclaration) {\n return new Param(id, type, DefType.SEARCH, this.router.urlService.config, state);\n }\n\n constructor(private router: UIRouter) {}\n}\n\n/**\n * Factory for [[UrlMatcher]] instances.\n *\n * The factory is available to ng1 services as\n * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`.\n */\nexport class UrlMatcherFactory {\n /** Creates a new [[Param]] for a given location (DefType) */\n paramFactory = new ParamFactory(this.router);\n // TODO: Check if removal of this will break anything, then remove these\n UrlMatcher: typeof UrlMatcher = UrlMatcher;\n Param: typeof Param = Param;\n\n // TODO: move implementations to UrlConfig (urlService.config)\n constructor(/** @internal */ private router: UIRouter) {}\n\n /**\n * Creates a [[UrlMatcher]] for the specified pattern.\n *\n * @param pattern The URL pattern.\n * @param config The config object hash.\n * @returns The UrlMatcher.\n */\n compile(pattern: string, config?: UrlMatcherCompileConfig) {\n const urlConfig = this.router.urlService.config;\n // backward-compatible support for config.params -> config.state.params\n const params = config && !config.state && (config as any).params;\n config = params ? { state: { params }, ...config } : config;\n const globalConfig: UrlMatcherCompileConfig = {\n strict: urlConfig._isStrictMode,\n caseInsensitive: urlConfig._isCaseInsensitive,\n decodeParams: urlConfig._decodeParams,\n };\n return new UrlMatcher(pattern, urlConfig.paramTypes, this.paramFactory, extend(globalConfig, config));\n }\n\n /**\n * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.\n *\n * @param object The object to perform the type check against.\n * @returns `true` if the object matches the `UrlMatcher` interface, by\n * implementing all the same methods.\n */\n isMatcher(object: any): boolean {\n // TODO: typeof?\n if (!isObject(object)) return false;\n let result = true;\n\n forEach(UrlMatcher.prototype, (val, name) => {\n if (isFunction(val)) result = result && isDefined(object[name]) && isFunction(object[name]);\n });\n return result;\n }\n\n /** @internal */\n $get() {\n const urlConfig = this.router.urlService.config;\n urlConfig.paramTypes.enqueue = false;\n urlConfig.paramTypes._flushTypeQueue();\n return this;\n }\n\n /** @deprecated use [[UrlConfig.caseInsensitive]] */\n caseInsensitive = (value?: boolean) => this.router.urlService.config.caseInsensitive(value);\n\n /** @deprecated use [[UrlConfig.defaultSquashPolicy]] */\n defaultSquashPolicy = (value?: boolean | string) => this.router.urlService.config.defaultSquashPolicy(value);\n\n /** @deprecated use [[UrlConfig.strictMode]] */\n strictMode = (value?: boolean) => this.router.urlService.config.strictMode(value);\n\n /** @deprecated use [[UrlConfig.type]] */\n type = (name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) => {\n return this.router.urlService.config.type(name, definition, definitionFn) || this;\n };\n}\n"
12 ]
13}
\No newline at end of file