blob: 278b7ec9ac1ef46d701e0c0d1400d8f29a218500 [file] [log] [blame]
{"version":3,"sources":["packages/router/router-upgrade.umd.js"],"names":["global","factory","exports","module","require","define","amd","self","ng","router","upgrade","common","core","static","this","_static","anchor","ɵ0","locationSyncBootstrapListener","ngUpgrade","setUpLocationSync","urlType","$injector","Error","router$1","injector","get","Router","location","Location","$on","_","next","__","url","resolveUrl","hashIdx","indexOf","substring","path","normalize","pathname","navigateByUrl","search","hash","document","createElement","setAttribute","href","replace","RouterUpgradeInitializer","provide","APP_BOOTSTRAP_LISTENER","multi","useFactory","deps","UpgradeModule","Object","defineProperty","value"],"mappings":";;;;;CAMC,SAAUA,EAAQC,GACI,iBAAZC,SAA0C,oBAAXC,OAAyBF,EAAQC,QAASE,QAAQ,mBAAoBA,QAAQ,iBAAkBA,QAAQ,mBAAoBA,QAAQ,4BACxJ,mBAAXC,QAAyBA,OAAOC,IAAMD,OAAO,0BAA2B,CAAC,UAAW,kBAAmB,gBAAiB,kBAAmB,2BAA4BJ,GACpJA,IAAzBD,EAASA,GAAUO,MAAsBC,GAAKR,EAAOQ,IAAM,GAAIR,EAAOQ,GAAGC,OAAST,EAAOQ,GAAGC,QAAU,GAAIT,EAAOQ,GAAGC,OAAOC,QAAU,IAAKV,EAAOQ,GAAGG,OAAQX,EAAOQ,GAAGI,KAAMZ,EAAOQ,GAAGC,OAAQT,EAAOQ,GAAGE,QAAQG,QAHrN,CAIEC,KAAM,SAAUZ,EAASS,EAAQC,EAAMH,EAAQM,GAAW;;;;;;;OASxD,IAyFIC,EAzFAC,EAAKC,EAiCT,SAASA,EAA8BC,GACnC,OAAO,WAAcC,EAAkBD,IAY3C,SAASC,EAAkBD,EAAWE,GAElC,QADgB,IAAZA,IAAsBA,EAAU,SAC/BF,EAAUG,UACX,MAAM,IAAIC,MAAM,iNAEpB,IAAIC,EAAWL,EAAUM,SAASC,IAAIjB,EAAOkB,QACzCC,EAAWT,EAAUM,SAASC,IAAIf,EAAOkB,UAC7CV,EAAUG,UAAUI,IAAI,cACnBI,IAAI,uBAAwB,SAAUC,EAAGC,EAAMC,GAChD,IAAIC,EACJ,GAAgB,SAAZb,EACAa,EAAMC,EAAWH,OAEhB,CAAA,GAAgB,SAAZX,EAML,KAAM,gDAAkDA,EAJxD,IAAIe,EAAUJ,EAAKK,QAAQ,KAC3BH,EAAMC,EAAWH,EAAKM,UAAU,EAAGF,GAAWJ,EAAKM,UAAUF,EAAU,IAK3E,IAAIG,EAAOX,EAASY,UAAUN,EAAIO,UAClCjB,EAASkB,cAAcH,EAAOL,EAAIS,OAAST,EAAIU,QAsBvD,SAAST,EAAWD,GAMhB,OALKlB,IACDA,EAAS6B,SAASC,cAAc,MAEpC9B,EAAO+B,aAAa,OAAQb,GAC5BlB,EAAO+B,aAAa,OAAQ/B,EAAOgC,MAC5B,CAEHP,SAAU,IAAMzB,EAAOyB,SAASQ,QAAQ,MAAO,IAC/CN,OAAQ3B,EAAO2B,OACfC,KAAM5B,EAAO4B;;;;;;;;;;;;;;OAyBrB1C,EAAQgD,yBArGuB,CAC3BC,QAASvC,EAAKwC,uBACdC,OAAO,EACPC,WAAYrC,EACZsC,KAAM,CAACxC,EAAQyC,gBAkGnBtD,EAAQgB,8BAAgCA,EACxChB,EAAQkB,kBAAoBA,EAC5BlB,EAAQe,GAAKA,EAEbwC,OAAOC,eAAexD,EAAS,aAAc,CAAEyD,OAAO","sourcesContent":["/**\n * @license Angular v8.1.1\n * (c) 2010-2019 Google LLC. https://angular.io/\n * License: MIT\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/router'), require('@angular/upgrade/static')) :\n typeof define === 'function' && define.amd ? define('@angular/router/upgrade', ['exports', '@angular/common', '@angular/core', '@angular/router', '@angular/upgrade/static'], factory) :\n (global = global || self, factory((global.ng = global.ng || {}, global.ng.router = global.ng.router || {}, global.ng.router.upgrade = {}), global.ng.common, global.ng.core, global.ng.router, global.ng.upgrade.static));\n}(this, function (exports, common, core, router, _static) { 'use strict';\n\n /**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n var ɵ0 = locationSyncBootstrapListener;\n /**\n * @description\n *\n * Creates an initializer that in addition to setting up the Angular\n * router sets up the ngRoute integration.\n *\n * ```\n * @NgModule({\n * imports: [\n * RouterModule.forRoot(SOME_ROUTES),\n * UpgradeModule\n * ],\n * providers: [\n * RouterUpgradeInitializer\n * ]\n * })\n * export class AppModule {\n * ngDoBootstrap() {}\n * }\n * ```\n *\n * @publicApi\n */\n var RouterUpgradeInitializer = {\n provide: core.APP_BOOTSTRAP_LISTENER,\n multi: true,\n useFactory: ɵ0,\n deps: [_static.UpgradeModule]\n };\n /**\n * @internal\n */\n function locationSyncBootstrapListener(ngUpgrade) {\n return function () { setUpLocationSync(ngUpgrade); };\n }\n /**\n * @description\n *\n * Sets up a location synchronization.\n *\n * History.pushState does not fire onPopState, so the Angular location\n * doesn't detect it. The workaround is to attach a location change listener\n *\n * @publicApi\n */\n function setUpLocationSync(ngUpgrade, urlType) {\n if (urlType === void 0) { urlType = 'path'; }\n if (!ngUpgrade.$injector) {\n throw new Error(\"\\n RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called.\\n Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap.\\n \");\n }\n var router$1 = ngUpgrade.injector.get(router.Router);\n var location = ngUpgrade.injector.get(common.Location);\n ngUpgrade.$injector.get('$rootScope')\n .$on('$locationChangeStart', function (_, next, __) {\n var url;\n if (urlType === 'path') {\n url = resolveUrl(next);\n }\n else if (urlType === 'hash') {\n // Remove the first hash from the URL\n var hashIdx = next.indexOf('#');\n url = resolveUrl(next.substring(0, hashIdx) + next.substring(hashIdx + 1));\n }\n else {\n throw 'Invalid URLType passed to setUpLocationSync: ' + urlType;\n }\n var path = location.normalize(url.pathname);\n router$1.navigateByUrl(path + url.search + url.hash);\n });\n }\n /**\n * Normalize and parse a URL.\n *\n * - Normalizing means that a relative URL will be resolved into an absolute URL in the context of\n * the application document.\n * - Parsing means that the anchor's `protocol`, `hostname`, `port`, `pathname` and related\n * properties are all populated to reflect the normalized URL.\n *\n * While this approach has wide compatibility, it doesn't work as expected on IE. On IE, normalizing\n * happens similar to other browsers, but the parsed components will not be set. (E.g. if you assign\n * `a.href = 'foo'`, then `a.protocol`, `a.host`, etc. will not be correctly updated.)\n * We work around that by performing the parsing in a 2nd step by taking a previously normalized URL\n * and assigning it again. This correctly populates all properties.\n *\n * See\n * https://github.com/angular/angular.js/blob/2c7400e7d07b0f6cec1817dab40b9250ce8ebce6/src/ng/urlUtils.js#L26-L33\n * for more info.\n */\n var anchor;\n function resolveUrl(url) {\n if (!anchor) {\n anchor = document.createElement('a');\n }\n anchor.setAttribute('href', url);\n anchor.setAttribute('href', anchor.href);\n return {\n // IE does not start `pathname` with `/` like other browsers.\n pathname: \"/\" + anchor.pathname.replace(/^\\//, ''),\n search: anchor.search,\n hash: anchor.hash\n };\n }\n\n /**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n // This file only reexports content of the `src` folder. Keep it that way.\n\n /**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n /**\n * Generated bundle index. Do not edit.\n */\n\n exports.RouterUpgradeInitializer = RouterUpgradeInitializer;\n exports.locationSyncBootstrapListener = locationSyncBootstrapListener;\n exports.setUpLocationSync = setUpLocationSync;\n exports.ɵ0 = ɵ0;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n}));\n//# sourceMappingURL=router-upgrade.umd.js.map\n"]}