From 1d2c12e2e7183d01b7467a2ae474e9a18cb0e5bd Mon Sep 17 00:00:00 2001 From: Krasimir Tsonev Date: Wed, 10 Feb 2021 23:45:13 +0200 Subject: [PATCH] Proper of the Match object in case of custom --- CHANGELOG.md | 4 ++++ lib/es/utils.js | 2 +- lib/navigo.amd.js | 2 +- lib/navigo.amd.js.map | 2 +- lib/navigo.amd.min.js | 2 +- lib/navigo.amd.min.js.map | 2 +- lib/navigo.js | 2 +- lib/navigo.js.map | 2 +- lib/navigo.min.js | 2 +- lib/navigo.min.js.map | 2 +- package.json | 2 +- src/__tests__/basic.spec.ts | 24 ++++++++++++++++++++++++ src/__tests__/navigate.spec.ts | 2 +- src/utils.ts | 2 +- 14 files changed, 40 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80290abc..fef2ac20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 8.8.9 + +Proper `url` of the Match object in case of custom `root`. + ## 8.8.8 Fixing a bug with `directMatchWithLocation`. It wasn't aware for the `root`. diff --git a/lib/es/utils.js b/lib/es/utils.js index 4acf060f..ef5b7af5 100644 --- a/lib/es/utils.js +++ b/lib/es/utils.js @@ -97,7 +97,7 @@ export function matchRoute(context, route) { if (match) { var data = isString(route.path) ? regExpResultToParams(match, paramNames) : match.groups ? match.groups : match.slice(1); return { - url: current, + url: clean(current.replace(new RegExp("^" + context.instance.root), "")), queryString: GETParams, hashString: extractHashFromURL(context.to), route: route, diff --git a/lib/navigo.amd.js b/lib/navigo.amd.js index 82502809..d46b5579 100644 --- a/lib/navigo.amd.js +++ b/lib/navigo.amd.js @@ -1172,7 +1172,7 @@ function matchRoute(context, route) { if (match) { var data = isString(route.path) ? regExpResultToParams(match, paramNames) : match.groups ? match.groups : match.slice(1); return { - url: current, + url: clean(current.replace(new RegExp("^" + context.instance.root), "")), queryString: GETParams, hashString: extractHashFromURL(context.to), route: route, diff --git a/lib/navigo.amd.js.map b/lib/navigo.amd.js.map index 52a6a7f9..003b7fed 100644 --- a/lib/navigo.amd.js.map +++ b/lib/navigo.amd.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/middlewares/updateState.ts","webpack://Navigo.amd/./src/middlewares/waitingList.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo.amd/webpack/runtime/make namespace object","webpack://Navigo.amd/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","to","options","__dirty","__waiting","undefined","instance","currentLocationPath","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","waitingList","navigate","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","navigateByName","data","generate","off","what","filter","r","isFunction","listen","__popstateListener","__freezeListening","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","route","find","result","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","hashString","extractHashFromURL","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","annotatePathWithRoot","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForLeaveHook","checkForNotFoundHandler","notFoundHandled","concat","updateState","errorOut","flushCurrent","undefinedOrTrue","after","already","before","map","beforeHookInternal","_","d","shouldStop","force","oldMatch","leaveLoopDone","leave","runHook","newLocationVSOldMatch","someOfTheLastOnesMatch","notFoundRoute","notFoundMatch","i","nextMatch","end","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","shift","fallback","s","pop","regExpResultToParams","names","reduce","index","decodeURIComponent","join","query","pairs","pair","GETParams","paramNames","pattern","full","dots","regexp","groups","pushState","obj","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,sF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"navigo.amd.js","sourcesContent":["type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n extractHashFromURL,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\nimport waitingList from \"./middlewares/waitingList\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n if (self.__dirty) {\n self.__waiting.push(() => self.resolve(to, options));\n return;\n } else {\n self.__dirty = true;\n }\n to = to ? `${clean(root)}/${clean(to)}` : undefined;\n // console.log(\"-- resolve --> \" + to, self.__dirty);\n const context: QContext = {\n instance: self,\n to,\n currentLocationPath: to,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context,\n waitingList\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n // console.log(\"-- navigate --> \" + to, self.__dirty);\n if (self.__dirty) {\n self.__waiting.push(() => self.navigate(to, navigateOptions));\n return;\n } else {\n self.__dirty = true;\n }\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n waitingList,\n ],\n context,\n waitingList\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n if (!self.__freezeListening) {\n resolve();\n }\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const hashString = extractHashFromURL(path);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n hashString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n to: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string | RegExp,\n currentLocation?: string,\n annotatePathWithRoot?: boolean\n ): false | Match {\n const context: QContext = {\n instance: self,\n to: currentLocation,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n if (typeof path === \"string\") {\n path =\n typeof annotatePathWithRoot === \"undefined\" || annotatePathWithRoot\n ? composePathWithRoot(path)\n : path;\n }\n const match = matchRoute(context, {\n name: String(path),\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n this.__freezeListening = false;\n this.__waiting = [];\n this.__dirty = false;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\nimport updateState from \"./middlewares/updateState\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(\n ({ notFoundHandled }: QContext) => notFoundHandled,\n foundLifecycle.concat([updateState]),\n [errorOut, flushCurrent]\n ),\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f((shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n }, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path,\n context.currentLocationPath,\n false\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n (shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n },\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport {\n parseQuery,\n extractGETParameters,\n clean,\n extractHashFromURL,\n} from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n const hashString = extractHashFromURL(context.to);\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n hashString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = context.to = getCurrentEnvURL(\n context.instance.root\n );\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n context.instance.__freezeListening = true;\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n context.instance.__freezeListening = false;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function updateState(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function waitingList(context: QContext) {\n context.instance.__dirty = false;\n if (context.instance.__waiting.length > 0) {\n context.instance.__waiting.shift()();\n }\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n QContext,\n ResolveStrategy,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function extractHashFromURL(url: string) {\n if (url && url.indexOf(\"#\") >= 0) {\n return url.split(\"#\").pop() || \"\";\n }\n return \"\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(context: QContext, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(\n clean(context.currentLocationPath)\n );\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.groups\n ? match.groups\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1] as ResolveStrategy;\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/middlewares/updateState.ts","webpack://Navigo.amd/./src/middlewares/waitingList.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo.amd/webpack/runtime/make namespace object","webpack://Navigo.amd/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","to","options","__dirty","__waiting","undefined","instance","currentLocationPath","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","waitingList","navigate","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","navigateByName","data","generate","off","what","filter","r","isFunction","listen","__popstateListener","__freezeListening","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","route","find","result","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","hashString","extractHashFromURL","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","annotatePathWithRoot","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForLeaveHook","checkForNotFoundHandler","notFoundHandled","concat","updateState","errorOut","flushCurrent","undefinedOrTrue","after","already","before","map","beforeHookInternal","_","d","shouldStop","force","oldMatch","leaveLoopDone","leave","runHook","newLocationVSOldMatch","someOfTheLastOnesMatch","notFoundRoute","notFoundMatch","i","nextMatch","end","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","shift","fallback","s","pop","regExpResultToParams","names","reduce","index","decodeURIComponent","join","query","pairs","pair","GETParams","paramNames","pattern","full","dots","regexp","groups","pushState","obj","source","str","temp","v","h"],"mappings":";;;;;;;;;;;;;;AAKe,SAASA,CAAT,CACbC,KADa,EAEbC,CAFa,EAGbC,IAHa,EAIb;AACA,MAAMC,OAAO,GAAGF,CAAC,IAAI,EAArB;AACA,MAAIG,GAAG,GAAG,CAAV;;AAEA,GAAC,SAASC,IAAT,GAAgB;AACf,QAAI,CAACL,KAAK,CAACI,GAAD,CAAV,EAA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Content":["type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n extractHashFromURL,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\nimport waitingList from \"./middlewares/waitingList\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n if (self.__dirty) {\n self.__waiting.push(() => self.resolve(to, options));\n return;\n } else {\n self.__dirty = true;\n }\n to = to ? `${clean(root)}/${clean(to)}` : undefined;\n // console.log(\"-- resolve --> \" + to, self.__dirty);\n const context: QContext = {\n instance: self,\n to,\n currentLocationPath: to,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context,\n waitingList\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n // console.log(\"-- navigate --> \" + to, self.__dirty);\n if (self.__dirty) {\n self.__waiting.push(() => self.navigate(to, navigateOptions));\n return;\n } else {\n self.__dirty = true;\n }\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n waitingList,\n ],\n context,\n waitingList\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n if (!self.__freezeListening) {\n resolve();\n }\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const hashString = extractHashFromURL(path);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n hashString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n to: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string | RegExp,\n currentLocation?: string,\n annotatePathWithRoot?: boolean\n ): false | Match {\n const context: QContext = {\n instance: self,\n to: currentLocation,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n if (typeof path === \"string\") {\n path =\n typeof annotatePathWithRoot === \"undefined\" || annotatePathWithRoot\n ? composePathWithRoot(path)\n : path;\n }\n const match = matchRoute(context, {\n name: String(path),\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n this.__freezeListening = false;\n this.__waiting = [];\n this.__dirty = false;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\nimport updateState from \"./middlewares/updateState\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(\n ({ notFoundHandled }: QContext) => notFoundHandled,\n foundLifecycle.concat([updateState]),\n [errorOut, flushCurrent]\n ),\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f((shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n }, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path,\n context.currentLocationPath,\n false\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n (shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n },\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport {\n parseQuery,\n extractGETParameters,\n clean,\n extractHashFromURL,\n} from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n const hashString = extractHashFromURL(context.to);\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n hashString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = context.to = getCurrentEnvURL(\n context.instance.root\n );\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n context.instance.__freezeListening = true;\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n context.instance.__freezeListening = false;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function updateState(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function waitingList(context: QContext) {\n context.instance.__dirty = false;\n if (context.instance.__waiting.length > 0) {\n context.instance.__waiting.shift()();\n }\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n QContext,\n ResolveStrategy,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function extractHashFromURL(url: string) {\n if (url && url.indexOf(\"#\") >= 0) {\n return url.split(\"#\").pop() || \"\";\n }\n return \"\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(context: QContext, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(\n clean(context.currentLocationPath)\n );\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.groups\n ? match.groups\n : match.slice(1);\n return {\n url: clean(current.replace(new RegExp(`^${context.instance.root}`), \"\")),\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1] as ResolveStrategy;\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/navigo.amd.min.js b/lib/navigo.amd.min.js index 9f49fa69..e659d933 100644 --- a/lib/navigo.amd.min.js +++ b/lib/navigo.amd.min.js @@ -1,2 +1,2 @@ -define("Navigo.amd",[],(()=>(()=>{"use strict";var t={407:(t,n,e)=>{e.d(n,{default:()=>C});var r=/([:*])(\w+)/g,o=/\*/g,i=/\/\?/g;function a(t){return void 0===t&&(t="/"),v()?location.pathname+location.search+location.hash:t}function s(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function c(t){return"string"==typeof t}function u(t){return t&&t.indexOf("#")>=0&&t.split("#").pop()||""}function h(t){var n=s(t).split(/\?(.*)?$/);return[s(n[0]),n.slice(1).join("")]}function f(t){for(var n={},e=t.split("&"),r=0;r0?1===t.matches.length?t.matches[0]:t.matches:void 0)}})).concat([function(){return r()}])):r()}else r()}})),{},(function(){return n()})):n()}function A(t,n){d(t.navigateOptions,"updateState")&&t.instance._setCurrent(t.matches),n()}var R=[function(t,n){var e=t.instance.lastResolved();if(e&&e[0]&&e[0].route===t.match.route&&e[0].url===t.match.url&&e[0].queryString===t.match.queryString)return e.forEach((function(n){n.route.hooks&&n.route.hooks.already&&d(t.navigateOptions,"callHooks")&&n.route.hooks.already.forEach((function(n){return n(t.match)}))})),void n(!1);n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.before&&d(t.navigateOptions,"callHooks")?m(t.match.route.hooks.before.map((function(n){return function(e,r){return n((function(n){!1===n?t.instance.__dirty=!1:r()}),t.match)}})).concat([function(){return n()}])):n()},function(t,n){d(t.navigateOptions,"callHandler")&&t.match.route.handler(t.match),t.instance.updatePageLinks(),n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.after&&d(t.navigateOptions,"callHooks")&&t.match.route.hooks.after.forEach((function(n){return n(t.match)})),n()}],S=[P,function(t,n){var e=t.instance._notFoundRoute;if(e){t.notFoundHandled=!0;var r=h(t.currentLocationPath),o=r[0],i=r[1],a=u(t.to);e.path=s(o);var c={url:e.path,queryString:i,hashString:a,data:null,route:e,params:""!==i?f(i):null};t.matches=[c],t.match=c}n()},m.if((function(t){return t.notFoundHandled}),R.concat([A]),[function(t,n){t.resolveOptions&&!1!==t.resolveOptions.noMatchWarning&&void 0!==t.resolveOptions.noMatchWarning||console.warn('Navigo: "'+t.currentLocationPath+"\" didn't match any of the registered routes."),n()},function(t,n){t.instance._setCurrent(null),n()}])];function E(){return(E=Object.assign||function(t){for(var n=1;n0&&t.instance.__waiting.shift()()}function x(){return(x=Object.assign||function(t){for(var n=1;n=0&&(t=!0===r.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function E(t){return s(i+"/"+s(t))}function C(t,n,e,r){return t=c(t)?E(t):t,{name:r||s(String(t)),path:t,handler:n,hooks:g(e)}}function N(t,n){if(!o.__dirty){o.__dirty=!0,t=t?s(i)+"/"+s(t):void 0;var e={instance:o,to:t,currentLocationPath:t,navigateOptions:{},resolveOptions:x({},r,n)};return m([y,_,m.if((function(t){var n=t.matches;return n&&n.length>0}),H,S)],e,j),!!e.matches&&e.matches}o.__waiting.push((function(){return o.resolve(t,n)}))}function U(t,n){if(o.__dirty)o.__waiting.push((function(){return o.navigate(t,n)}));else{o.__dirty=!0,t=s(i)+"/"+s(t);var e={instance:o,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:r,currentLocationPath:R(t)};m([O,k,_,m.if((function(t){var n=t.matches;return n&&n.length>0}),H,S),b,j],e,j)}}function q(){if(A)return(A?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){"false"!==t.getAttribute("data-navigo")&&"_blank"!==t.getAttribute("target")?t.hasListenerAttached||(t.hasListenerAttached=!0,t.navigoHandler=function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var r=new URL(e);e=r.pathname+r.search}catch(t){}var i=function(t){if(!t)return{};var n,e=t.split(","),r={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":r.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":r[e[0]]="true"===e[1]}})),n&&(r.resolveOptions=n),r}(t.getAttribute("data-navigo-options"));w||(n.preventDefault(),n.stopPropagation(),o.navigate(s(e),i))},t.addEventListener("click",t.navigoHandler)):t.hasListenerAttached&&t.removeEventListener("click",t.navigoHandler)})),o}function F(t,n){var e=L.find((function(n){return n.name===t}));if(e){var r=e.path;if(n)for(var o in n)r=r.replace(":"+o,n[o]);return r.match(/^\//)?r:"/"+r}return null}function I(t){var n=h(s(t)),r=n[0],o=n[1],i=""===o?null:f(o);return{url:r,queryString:o,hashString:u(t),route:C(r,(function(){}),[e],r),data:null,params:i}}function M(t,n,e){return"string"==typeof n&&(n=T(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function T(t){return"string"==typeof t?L.find((function(n){return n.name===E(t)})):L.find((function(n){return n.handler===t}))}t?i=s(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=i,this.routes=L,this.destroyed=w,this.current=d,this.__freezeListening=!1,this.__waiting=[],this.__dirty=!1,this.on=function(t,n,r){var o=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(r=n,n=t,t=i),L.push(C(t,n,[e,r])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])o.on(n,t[n]);else{var r=t[n],i=r.uses,a=r.as,s=r.hooks;L.push(C(n,i,[e,s],a))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return c(t)?s(n.path)!==s(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=N,this.navigate=U,this.navigateByName=function(t,n,e){var r=F(t,n);return null!==r&&(U(r,e),!0)},this.destroy=function(){this.routes=L=[],P&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=w=!0},this.notFound=function(t,n){return o._notFoundRoute=C("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=q,this.link=function(t){return"/"+i+"/"+s(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return h(R(t))},this.lastResolved=function(){return d},this.generate=F,this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:o,currentLocationPath:t,to:t,navigateOptions:{},resolveOptions:r};return _(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n,e){var r={instance:o,to:n,currentLocationPath:n};return y(r,(function(){})),"string"==typeof t&&(t=void 0===e||e?E(t):t),l(r,{name:String(t),path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return I(s(a(i)).replace(new RegExp("^"+i),""))},this.addBeforeHook=M.bind(this,"before"),this.addAfterHook=M.bind(this,"after"),this.addAlreadyHook=M.bind(this,"already"),this.addLeaveHook=M.bind(this,"leave"),this.getRoute=T,this._pathToMatchObject=I,this._clean=s,this._checkForAHash=R,this._setCurrent=function(t){return d=o.current=t},function(){P&&(this.__popstateListener=function(){o.__freezeListening||N()},window.addEventListener("popstate",this.__popstateListener))}.call(this),q.call(this)}}},n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{}};return t[r](o,o.exports,e),o.exports}return e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(407)})().default)); +define("Navigo.amd",[],(()=>(()=>{"use strict";var t={407:(t,n,e)=>{e.d(n,{default:()=>C});var r=/([:*])(\w+)/g,o=/\*/g,i=/\/\?/g;function a(t){return void 0===t&&(t="/"),v()?location.pathname+location.search+location.hash:t}function s(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function c(t){return"string"==typeof t}function u(t){return t&&t.indexOf("#")>=0&&t.split("#").pop()||""}function h(t){var n=s(t).split(/\?(.*)?$/);return[s(n[0]),n.slice(1).join("")]}function f(t){for(var n={},e=t.split("&"),r=0;r0?1===t.matches.length?t.matches[0]:t.matches:void 0)}})).concat([function(){return r()}])):r()}else r()}})),{},(function(){return n()})):n()}function A(t,n){d(t.navigateOptions,"updateState")&&t.instance._setCurrent(t.matches),n()}var R=[function(t,n){var e=t.instance.lastResolved();if(e&&e[0]&&e[0].route===t.match.route&&e[0].url===t.match.url&&e[0].queryString===t.match.queryString)return e.forEach((function(n){n.route.hooks&&n.route.hooks.already&&d(t.navigateOptions,"callHooks")&&n.route.hooks.already.forEach((function(n){return n(t.match)}))})),void n(!1);n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.before&&d(t.navigateOptions,"callHooks")?m(t.match.route.hooks.before.map((function(n){return function(e,r){return n((function(n){!1===n?t.instance.__dirty=!1:r()}),t.match)}})).concat([function(){return n()}])):n()},function(t,n){d(t.navigateOptions,"callHandler")&&t.match.route.handler(t.match),t.instance.updatePageLinks(),n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.after&&d(t.navigateOptions,"callHooks")&&t.match.route.hooks.after.forEach((function(n){return n(t.match)})),n()}],S=[P,function(t,n){var e=t.instance._notFoundRoute;if(e){t.notFoundHandled=!0;var r=h(t.currentLocationPath),o=r[0],i=r[1],a=u(t.to);e.path=s(o);var c={url:e.path,queryString:i,hashString:a,data:null,route:e,params:""!==i?f(i):null};t.matches=[c],t.match=c}n()},m.if((function(t){return t.notFoundHandled}),R.concat([A]),[function(t,n){t.resolveOptions&&!1!==t.resolveOptions.noMatchWarning&&void 0!==t.resolveOptions.noMatchWarning||console.warn('Navigo: "'+t.currentLocationPath+"\" didn't match any of the registered routes."),n()},function(t,n){t.instance._setCurrent(null),n()}])];function E(){return(E=Object.assign||function(t){for(var n=1;n0&&t.instance.__waiting.shift()()}function x(){return(x=Object.assign||function(t){for(var n=1;n=0&&(t=!0===r.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function E(t){return s(i+"/"+s(t))}function C(t,n,e,r){return t=c(t)?E(t):t,{name:r||s(String(t)),path:t,handler:n,hooks:g(e)}}function N(t,n){if(!o.__dirty){o.__dirty=!0,t=t?s(i)+"/"+s(t):void 0;var e={instance:o,to:t,currentLocationPath:t,navigateOptions:{},resolveOptions:x({},r,n)};return m([y,_,m.if((function(t){var n=t.matches;return n&&n.length>0}),H,S)],e,j),!!e.matches&&e.matches}o.__waiting.push((function(){return o.resolve(t,n)}))}function U(t,n){if(o.__dirty)o.__waiting.push((function(){return o.navigate(t,n)}));else{o.__dirty=!0,t=s(i)+"/"+s(t);var e={instance:o,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:r,currentLocationPath:R(t)};m([O,k,_,m.if((function(t){var n=t.matches;return n&&n.length>0}),H,S),b,j],e,j)}}function q(){if(A)return(A?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){"false"!==t.getAttribute("data-navigo")&&"_blank"!==t.getAttribute("target")?t.hasListenerAttached||(t.hasListenerAttached=!0,t.navigoHandler=function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var r=new URL(e);e=r.pathname+r.search}catch(t){}var i=function(t){if(!t)return{};var n,e=t.split(","),r={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":r.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":r[e[0]]="true"===e[1]}})),n&&(r.resolveOptions=n),r}(t.getAttribute("data-navigo-options"));w||(n.preventDefault(),n.stopPropagation(),o.navigate(s(e),i))},t.addEventListener("click",t.navigoHandler)):t.hasListenerAttached&&t.removeEventListener("click",t.navigoHandler)})),o}function F(t,n){var e=L.find((function(n){return n.name===t}));if(e){var r=e.path;if(n)for(var o in n)r=r.replace(":"+o,n[o]);return r.match(/^\//)?r:"/"+r}return null}function I(t){var n=h(s(t)),r=n[0],o=n[1],i=""===o?null:f(o);return{url:r,queryString:o,hashString:u(t),route:C(r,(function(){}),[e],r),data:null,params:i}}function M(t,n,e){return"string"==typeof n&&(n=T(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function T(t){return"string"==typeof t?L.find((function(n){return n.name===E(t)})):L.find((function(n){return n.handler===t}))}t?i=s(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=i,this.routes=L,this.destroyed=w,this.current=d,this.__freezeListening=!1,this.__waiting=[],this.__dirty=!1,this.on=function(t,n,r){var o=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(r=n,n=t,t=i),L.push(C(t,n,[e,r])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])o.on(n,t[n]);else{var r=t[n],i=r.uses,a=r.as,s=r.hooks;L.push(C(n,i,[e,s],a))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return c(t)?s(n.path)!==s(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=N,this.navigate=U,this.navigateByName=function(t,n,e){var r=F(t,n);return null!==r&&(U(r,e),!0)},this.destroy=function(){this.routes=L=[],P&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=w=!0},this.notFound=function(t,n){return o._notFoundRoute=C("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=q,this.link=function(t){return"/"+i+"/"+s(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return h(R(t))},this.lastResolved=function(){return d},this.generate=F,this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:o,currentLocationPath:t,to:t,navigateOptions:{},resolveOptions:r};return _(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n,e){var r={instance:o,to:n,currentLocationPath:n};return y(r,(function(){})),"string"==typeof t&&(t=void 0===e||e?E(t):t),l(r,{name:String(t),path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return I(s(a(i)).replace(new RegExp("^"+i),""))},this.addBeforeHook=M.bind(this,"before"),this.addAfterHook=M.bind(this,"after"),this.addAlreadyHook=M.bind(this,"already"),this.addLeaveHook=M.bind(this,"leave"),this.getRoute=T,this._pathToMatchObject=I,this._clean=s,this._checkForAHash=R,this._setCurrent=function(t){return d=o.current=t},function(){P&&(this.__popstateListener=function(){o.__freezeListening||N()},window.addEventListener("popstate",this.__popstateListener))}.call(this),q.call(this)}}},n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{}};return t[r](o,o.exports,e),o.exports}return e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(407)})().default)); //# sourceMappingURL=navigo.amd.min.js.map \ No newline at end of file diff --git a/lib/navigo.amd.min.js.map b/lib/navigo.amd.min.js.map index 4092d6e1..2272dc21 100644 --- a/lib/navigo.amd.min.js.map +++ b/lib/navigo.amd.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/middlewares/updateState.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/middlewares/waitingList.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/startup","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand"],"names":["PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractHashFromURL","url","indexOf","split","pop","extractGETParameters","tmp","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","context","route","pattern","currentLocationPath","current","GETParams","params","paramNames","path","full","dots","name","hashString","to","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","groups","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","idx","next","splice","moveForward","setLocationPath","instance","root","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","__freezeListening","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","runHook","newLocationVSOldMatch","matchLocation","find","f","d","shouldStop","__dirty","undefined","concat","updateState","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","waitingList","__waiting","shift","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","self","this","destroyed","composePathWithRoot","createRoute","String","resolve","options","navigate","call","document","querySelectorAll","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","addEventListener","removeEventListener","generate","r","pathToMatchObject","addHook","func","getRoute","nameOrHandler","on","Object","keys","p","uses","as","off","what","navigateByName","destroy","__popstateListener","notFound","getLinkPath","currentLocation","annotatePathWithRoot","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","exports","module","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"2FAAO,IAAMA,EAAmB,eAEnBC,EAAkB,MAElBC,EAAkB,QCiBxB,SAASC,EAAiBC,GAC/B,YADuD,IAAxBA,MAAW,KACtCC,IACKC,SAASC,SAAWD,SAASE,OAASF,SAASG,KAEjDL,EAEF,SAASM,EAAMC,GACpB,OAAOA,EAAEC,QAAQ,OAAQ,IAAIA,QAAQ,OAAQ,IAExC,SAASC,EAASF,GACvB,MAAoB,iBAANA,EAKT,SAASG,EAAmBC,GACjC,OAAIA,GAAOA,EAAIC,QAAQ,MAAQ,GACtBD,EAAIE,MAAM,KAAKC,OAEjB,GAWF,SAASC,EAAqBJ,GACnC,IAAMK,EAAMV,EAAMK,GAAKE,MAAM,YAC7B,MAAO,CAACP,EAAMU,EAAI,IAAKA,EAAIC,MAAM,GAAGC,KAAK,KAEpC,SAASC,EAAWC,GAGzB,IAFA,IAAIC,EAAQ,GACRC,EAAQF,EAAYP,MAAM,KACrBU,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACrC,IAAIE,EAAOH,EAAMC,GAAGV,MAAM,KAC1B,GAAgB,KAAZY,EAAK,GAAW,CAClB,IAAIC,EAAMC,mBAAmBF,EAAK,IAC7BJ,EAAMK,IAGJE,MAAMC,QAAQR,EAAMK,MAAOL,EAAMK,GAAO,CAACL,EAAMK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AAQ,IAAIwC,OAAJ,IAAe+B,GAAS,MA6FlEqE,KAAKwD,cAAgBpB,EAAQqB,KAAKzD,KAAM,UACxCA,KAAK0D,aAAetB,EAAQqB,KAAKzD,KAAM,SACvCA,KAAK2D,eAAiBvB,EAAQqB,KAAKzD,KAAM,WACzCA,KAAK4D,aAAexB,EAAQqB,KAAKzD,KAAM,SACvCA,KAAKsC,SAAWA,EAChBtC,KAAKvD,mBAAqB0F,EAC1BnC,KAAK6D,OAAS3M,EACd8I,KAAKpE,eAAiBA,EACtBoE,KAAKxD,YAAc,SAACrB,GAAD,OAAQnC,EAAU+G,EAAK/G,QAAUmC,GA9NpD,WACM4B,IACFiD,KAAKkD,mBAAqB,WACnBnD,EAAK1C,mBACRgD,KAGJhG,OAAO0H,iBAAiB,WAAY/B,KAAKkD,sBAyNtC1C,KAAKR,MACZlB,EAAgB0B,KAAKR,SC9anB8D,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUC,QAG3C,IAAIC,EAASJ,EAAyBE,GAAY,CAGjDC,QAAS,IAOV,OAHAE,EAAoBH,GAAUE,EAAQA,EAAOD,QAASF,GAG/CG,EAAOD,QCjBf,OCFAF,EAAoB3F,EAAI,CAAC6F,EAASG,KACjC,IAAI,IAAI9L,KAAO8L,EACXL,EAAoBM,EAAED,EAAY9L,KAASyL,EAAoBM,EAAEJ,EAAS3L,IAC5EmK,OAAO6B,eAAeL,EAAS3L,EAAK,CAAEiM,YAAY,EAAMC,IAAKJ,EAAW9L,MCJ3EyL,EAAoBM,EAAI,CAAC5J,EAAKgK,IAAShC,OAAOiC,UAAUC,eAAenE,KAAK/F,EAAKgK,GFG1EV,EAAoB,M","file":"navigo.amd.min.js","sourcesContent":["export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n QContext,\n ResolveStrategy,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function extractHashFromURL(url: string) {\n if (url && url.indexOf(\"#\") >= 0) {\n return url.split(\"#\").pop() || \"\";\n }\n return \"\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(context: QContext, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(\n clean(context.currentLocationPath)\n );\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.groups\n ? match.groups\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1] as ResolveStrategy;\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = context.to = getCurrentEnvURL(\n context.instance.root\n );\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n context.instance.__freezeListening = true;\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n context.instance.__freezeListening = false;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path,\n context.currentLocationPath,\n false\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n (shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n },\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function updateState(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\nimport updateState from \"./middlewares/updateState\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(\n ({ notFoundHandled }: QContext) => notFoundHandled,\n foundLifecycle.concat([updateState]),\n [errorOut, flushCurrent]\n ),\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f((shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n }, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport {\n parseQuery,\n extractGETParameters,\n clean,\n extractHashFromURL,\n} from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n const hashString = extractHashFromURL(context.to);\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n hashString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\n\nexport default function waitingList(context: QContext) {\n context.instance.__dirty = false;\n if (context.instance.__waiting.length > 0) {\n context.instance.__waiting.shift()();\n }\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n extractHashFromURL,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\nimport waitingList from \"./middlewares/waitingList\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n if (self.__dirty) {\n self.__waiting.push(() => self.resolve(to, options));\n return;\n } else {\n self.__dirty = true;\n }\n to = to ? `${clean(root)}/${clean(to)}` : undefined;\n // console.log(\"-- resolve --> \" + to, self.__dirty);\n const context: QContext = {\n instance: self,\n to,\n currentLocationPath: to,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context,\n waitingList\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n // console.log(\"-- navigate --> \" + to, self.__dirty);\n if (self.__dirty) {\n self.__waiting.push(() => self.navigate(to, navigateOptions));\n return;\n } else {\n self.__dirty = true;\n }\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n waitingList,\n ],\n context,\n waitingList\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n if (!self.__freezeListening) {\n resolve();\n }\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const hashString = extractHashFromURL(path);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n hashString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n to: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string | RegExp,\n currentLocation?: string,\n annotatePathWithRoot?: boolean\n ): false | Match {\n const context: QContext = {\n instance: self,\n to: currentLocation,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n if (typeof path === \"string\") {\n path =\n typeof annotatePathWithRoot === \"undefined\" || annotatePathWithRoot\n ? composePathWithRoot(path)\n : path;\n }\n const match = matchRoute(context, {\n name: String(path),\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n this.__freezeListening = false;\n this.__waiting = [];\n this.__dirty = false;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(407);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/middlewares/updateState.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/middlewares/waitingList.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/startup","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand"],"names":["PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractHashFromURL","url","indexOf","split","pop","extractGETParameters","tmp","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","context","route","pattern","currentLocationPath","current","GETParams","params","paramNames","path","full","dots","name","hashString","to","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","groups","instance","root","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","idx","next","splice","moveForward","setLocationPath","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","__freezeListening","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","runHook","newLocationVSOldMatch","matchLocation","find","f","d","shouldStop","__dirty","undefined","concat","updateState","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","waitingList","__waiting","shift","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","self","this","destroyed","composePathWithRoot","createRoute","String","resolve","options","navigate","call","document","querySelectorAll","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","addEventListener","removeEventListener","generate","r","pathToMatchObject","addHook","func","getRoute","nameOrHandler","on","Object","keys","p","uses","as","off","what","navigateByName","destroy","__popstateListener","notFound","getLinkPath","currentLocation","annotatePathWithRoot","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","exports","module","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"2FAAO,IAAMA,EAAmB,eAEnBC,EAAkB,MAElBC,EAAkB,QCiBxB,SAASC,EAAiBC,GAC/B,YADuD,IAAxBA,MAAW,KACtCC,IACKC,SAASC,SAAWD,SAASE,OAASF,SAASG,KAEjDL,EAEF,SAASM,EAAMC,GACpB,OAAOA,EAAEC,QAAQ,OAAQ,IAAIA,QAAQ,OAAQ,IAExC,SAASC,EAASF,GACvB,MAAoB,iBAANA,EAKT,SAASG,EAAmBC,GACjC,OAAIA,GAAOA,EAAIC,QAAQ,MAAQ,GACtBD,EAAIE,MAAM,KAAKC,OAEjB,GAWF,SAASC,EAAqBJ,GACnC,IAAMK,EAAMV,EAAMK,GAAKE,MAAM,YAC7B,MAAO,CAACP,EAAMU,EAAI,IAAKA,EAAIC,MAAM,GAAGC,KAAK,KAEpC,SAASC,EAAWC,GAGzB,IAFA,IAAIC,EAAQ,GACRC,EAAQF,EAAYP,MAAM,KACrBU,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACrC,IAAIE,EAAOH,EAAMC,GAAGV,MAAM,KAC1B,GAAgB,KAAZY,EAAK,GAAW,CAClB,IAAIC,EAAMC,mBAAmBF,EAAK,IAC7BJ,EAAMK,IAGJE,MAAMC,QAAQR,EAAMK,MAAOL,EAAMK,GAAO,CAACL,EAAMK,KACpDL,EAAMK,GAAKI,KAAKH,mBAAmBF,EAAK,IAAM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AAIwC,OAAJ,IAAeS,GAAS,MA6FlE2F,KAAKwD,cAAgBpB,EAAQqB,KAAKzD,KAAM,UACxCA,KAAK0D,aAAetB,EAAQqB,KAAKzD,KAAM,SACvCA,KAAK2D,eAAiBvB,EAAQqB,KAAKzD,KAAM,WACzCA,KAAK4D,aAAexB,EAAQqB,KAAKzD,KAAM,SACvCA,KAAKsC,SAAWA,EAChBtC,KAAKvD,mBAAqB0F,EAC1BnC,KAAK6D,OAAS3M,EACd8I,KAAKpE,eAAiBA,EACtBoE,KAAKxD,YAAc,SAACnB,GAAD,OAAQrC,EAAU+G,EAAK/G,QAAUqC,GA9NpD,WACM0B,IACFiD,KAAKkD,mBAAqB,WACnBnD,EAAK1C,mBACRgD,KAGJ9F,OAAOwH,iBAAiB,WAAY/B,KAAKkD,sBAyNtC1C,KAAKR,MACZlB,EAAgB0B,KAAKR,SC9anB8D,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUC,QAG3C,IAAIC,EAASJ,EAAyBE,GAAY,CAGjDC,QAAS,IAOV,OAHAE,EAAoBH,GAAUE,EAAQA,EAAOD,QAASF,GAG/CG,EAAOD,QCjBf,OCFAF,EAAoB3F,EAAI,CAAC6F,EAASG,KACjC,IAAI,IAAI9L,KAAO8L,EACXL,EAAoBM,EAAED,EAAY9L,KAASyL,EAAoBM,EAAEJ,EAAS3L,IAC5EmK,OAAO6B,eAAeL,EAAS3L,EAAK,CAAEiM,YAAY,EAAMC,IAAKJ,EAAW9L,MCJ3EyL,EAAoBM,EAAI,CAAC1J,EAAK8J,IAAShC,OAAOiC,UAAUC,eAAenE,KAAK7F,EAAK8J,GFG1EV,EAAoB,M","file":"navigo.amd.min.js","sourcesContent":["export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n QContext,\n ResolveStrategy,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function extractHashFromURL(url: string) {\n if (url && url.indexOf(\"#\") >= 0) {\n return url.split(\"#\").pop() || \"\";\n }\n return \"\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(context: QContext, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(\n clean(context.currentLocationPath)\n );\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.groups\n ? match.groups\n : match.slice(1);\n return {\n url: clean(current.replace(new RegExp(`^${context.instance.root}`), \"\")),\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1] as ResolveStrategy;\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = context.to = getCurrentEnvURL(\n context.instance.root\n );\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n context.instance.__freezeListening = true;\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n context.instance.__freezeListening = false;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path,\n context.currentLocationPath,\n false\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n (shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n },\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function updateState(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\nimport updateState from \"./middlewares/updateState\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(\n ({ notFoundHandled }: QContext) => notFoundHandled,\n foundLifecycle.concat([updateState]),\n [errorOut, flushCurrent]\n ),\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f((shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n }, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport {\n parseQuery,\n extractGETParameters,\n clean,\n extractHashFromURL,\n} from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n const hashString = extractHashFromURL(context.to);\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n hashString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\n\nexport default function waitingList(context: QContext) {\n context.instance.__dirty = false;\n if (context.instance.__waiting.length > 0) {\n context.instance.__waiting.shift()();\n }\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n extractHashFromURL,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\nimport waitingList from \"./middlewares/waitingList\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n if (self.__dirty) {\n self.__waiting.push(() => self.resolve(to, options));\n return;\n } else {\n self.__dirty = true;\n }\n to = to ? `${clean(root)}/${clean(to)}` : undefined;\n // console.log(\"-- resolve --> \" + to, self.__dirty);\n const context: QContext = {\n instance: self,\n to,\n currentLocationPath: to,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context,\n waitingList\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n // console.log(\"-- navigate --> \" + to, self.__dirty);\n if (self.__dirty) {\n self.__waiting.push(() => self.navigate(to, navigateOptions));\n return;\n } else {\n self.__dirty = true;\n }\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n waitingList,\n ],\n context,\n waitingList\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n if (!self.__freezeListening) {\n resolve();\n }\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const hashString = extractHashFromURL(path);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n hashString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n to: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string | RegExp,\n currentLocation?: string,\n annotatePathWithRoot?: boolean\n ): false | Match {\n const context: QContext = {\n instance: self,\n to: currentLocation,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n if (typeof path === \"string\") {\n path =\n typeof annotatePathWithRoot === \"undefined\" || annotatePathWithRoot\n ? composePathWithRoot(path)\n : path;\n }\n const match = matchRoute(context, {\n name: String(path),\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n this.__freezeListening = false;\n this.__waiting = [];\n this.__dirty = false;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(407);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/navigo.js b/lib/navigo.js index 7eb45737..24a60875 100644 --- a/lib/navigo.js +++ b/lib/navigo.js @@ -1182,7 +1182,7 @@ function matchRoute(context, route) { if (match) { var data = isString(route.path) ? regExpResultToParams(match, paramNames) : match.groups ? match.groups : match.slice(1); return { - url: current, + url: clean(current.replace(new RegExp("^" + context.instance.root), "")), queryString: GETParams, hashString: extractHashFromURL(context.to), route: route, diff --git a/lib/navigo.js.map b/lib/navigo.js.map index 5c4a961c..311f8de4 100644 --- a/lib/navigo.js.map +++ b/lib/navigo.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/middlewares/updateState.ts","webpack://Navigo/./src/middlewares/waitingList.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo/webpack/runtime/make namespace object","webpack://Navigo/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","to","options","__dirty","__waiting","undefined","instance","currentLocationPath","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","waitingList","navigate","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","navigateByName","data","generate","off","what","filter","r","isFunction","listen","__popstateListener","__freezeListening","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","route","find","result","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","hashString","extractHashFromURL","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","annotatePathWithRoot","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForLeaveHook","checkForNotFoundHandler","notFoundHandled","concat","updateState","errorOut","flushCurrent","undefinedOrTrue","after","already","before","map","beforeHookInternal","_","d","shouldStop","force","oldMatch","leaveLoopDone","leave","runHook","newLocationVSOldMatch","someOfTheLastOnesMatch","notFoundRoute","notFoundMatch","i","nextMatch","end","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","shift","fallback","s","pop","regExpResultToParams","names","reduce","index","decodeURIComponent","join","query","pairs","pair","GETParams","paramNames","pattern","full","dots","regexp","groups","pushState","obj","source","str","temp","v","h"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;ACLe,SAASA,CAAT,CACbC,KADa,EAEbC,CAFa,EAGbC,IAHa,EAIb;AACA,MAAMC,OAAO,GAAGF,CAAC,IAAI,EAArB;AACA,MAAIG,GAAG,GAAG,CAAV;;AAEA,GAAC,SAASC,IAAT,GAAgB;AACf,QAAI,CAACL,KAAK,CAACI,GAAD,CAAV,EAAiB;AACf,UAAIF,IAAJ,EAAU;AACRA,YAAI,CAACC,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AzB;AACD;;AACD,SAAO0C,OAAP;AACD;AACM,SAAS5B,eAAT,GAA2B;AAChC,SAAO,OAAOyD,MAAP,KAAkB,WAAzB;AACD;AACM,SAASzC,eAAT,CACLJ,KADK,EAELiF,MAFK,EAGc;AAAA,MAFnBjF,KAEmB;AAFnBA,SAEmB,GAFX,EAEW;AAAA;;AAAA,MADnBiF,MACmB;AADnBA,UACmB,GADS,EACT;AAAA;;AACnBjF,OAAK,CACFuC,MADH,CACU,UAAC+I,CAAD;AAAA,WAAOA,CAAP;AAAA,GADV,EAEG7K,OAFH,CAEW,UAAC6K,CAAD,EAAO;AACd,KAAC,QAAD,EAAW,OAAX,EAAoB,SAApB,EAA+B,OAA/B,EAAwC7K,OAAxC,CAAgD,UAAC2F,IAAD,EAAU;AACxD,UAAIkF,CAAC,CAAClF,IAAD,CAAL,EAAa;AACX,YAAI,CAACnB,MAAM,CAACmB,IAAD,CAAX,EAAmBnB,MAAM,CAACmB,IAAD,CAAN,GAAe,EAAf;AACnBnB,cAAM,CAACmB,IAAD,CAAN,CAAavF,IAAb,CAAkByK,CAAC,CAAClF,IAAD,CAAnB;AACD;AACF,KALD;AAMD,GATH;AAUA,SAAOnB,MAAP;AACD,C;;;;;;UC1LD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,sF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"navigo.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n extractHashFromURL,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\nimport waitingList from \"./middlewares/waitingList\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n if (self.__dirty) {\n self.__waiting.push(() => self.resolve(to, options));\n return;\n } else {\n self.__dirty = true;\n }\n to = to ? `${clean(root)}/${clean(to)}` : undefined;\n // console.log(\"-- resolve --> \" + to, self.__dirty);\n const context: QContext = {\n instance: self,\n to,\n currentLocationPath: to,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context,\n waitingList\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n // console.log(\"-- navigate --> \" + to, self.__dirty);\n if (self.__dirty) {\n self.__waiting.push(() => self.navigate(to, navigateOptions));\n return;\n } else {\n self.__dirty = true;\n }\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n waitingList,\n ],\n context,\n waitingList\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n if (!self.__freezeListening) {\n resolve();\n }\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const hashString = extractHashFromURL(path);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n hashString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n to: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string | RegExp,\n currentLocation?: string,\n annotatePathWithRoot?: boolean\n ): false | Match {\n const context: QContext = {\n instance: self,\n to: currentLocation,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n if (typeof path === \"string\") {\n path =\n typeof annotatePathWithRoot === \"undefined\" || annotatePathWithRoot\n ? composePathWithRoot(path)\n : path;\n }\n const match = matchRoute(context, {\n name: String(path),\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n this.__freezeListening = false;\n this.__waiting = [];\n this.__dirty = false;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\nimport updateState from \"./middlewares/updateState\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(\n ({ notFoundHandled }: QContext) => notFoundHandled,\n foundLifecycle.concat([updateState]),\n [errorOut, flushCurrent]\n ),\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f((shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n }, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path,\n context.currentLocationPath,\n false\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n (shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n },\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport {\n parseQuery,\n extractGETParameters,\n clean,\n extractHashFromURL,\n} from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n const hashString = extractHashFromURL(context.to);\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n hashString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = context.to = getCurrentEnvURL(\n context.instance.root\n );\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n context.instance.__freezeListening = true;\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n context.instance.__freezeListening = false;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function updateState(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function waitingList(context: QContext) {\n context.instance.__dirty = false;\n if (context.instance.__waiting.length > 0) {\n context.instance.__waiting.shift()();\n }\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n QContext,\n ResolveStrategy,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function extractHashFromURL(url: string) {\n if (url && url.indexOf(\"#\") >= 0) {\n return url.split(\"#\").pop() || \"\";\n }\n return \"\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(context: QContext, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(\n clean(context.currentLocationPath)\n );\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.groups\n ? match.groups\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1] as ResolveStrategy;\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/middlewares/updateState.ts","webpack://Navigo/./src/middlewares/waitingList.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo/webpack/runtime/make namespace object","webpack://Navigo/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","to","options","__dirty","__waiting","undefined","instance","currentLocationPath","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","waitingList","navigate","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","navigateByName","data","generate","off","what","filter","r","isFunction","listen","__popstateListener","__freezeListening","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","route","find","result","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","hashString","extractHashFromURL","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","annotatePathWithRoot","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForLeaveHook","checkForNotFoundHandler","notFoundHandled","concat","updateState","errorOut","flushCurrent","undefinedOrTrue","after","already","before","map","beforeHookInternal","_","d","shouldStop","force","oldMatch","leaveLoopDone","leave","runHook","newLocationVSOldMatch","someOfTheLastOnesMatch","notFoundRoute","notFoundMatch","i","nextMatch","end","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","shift","fallback","s","pop","regExpResultToParams","names","reduce","index","decodeURIComponent","join","query","pairs","pair","GETParams","paramNames","pattern","full","dots","regexp","groups","pushState","obj","source","str","temp","v","h"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;ACLe,SAASA,CAAT,CACbC,KADa,EAEbC,CAFa,EAGbC,IAHa,EAIb;AACA,MAAMC,OAAO,GAAGF,CAAC,IAAI,EAArB;AACA,MAAIG,GAAG,GAAG,CAAV;;AAEA,GAAC,SAASC,IAAT,GAAgB;AACf,QAAI,CAACL,KAAK,CAACI,GAAD,CAAV,EAAiB;AACf,UAAIF,IAAJ,EAAU;AACRA,YAAI,CAACC,OAAD,CA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AJ,KAAY,MAA/B;AACA;AAjBJ;AAmBD,GArBD;;AAsBA,MAAI9M,cAAJ,EAAoB;AAClB0C,WAAO,CAAC1C,cAAR,GAAyBA,cAAzB;AACD;;AACD,SAAO0C,OAAP;AACD;AACM,SAAS5B,eAAT,GAA2B;AAChC,SAAO,OAAOyD,MAAP,KAAkB,WAAzB;AACD;AACM,SAASzC,eAAT,CACLJ,KADK,EAELiF,MAFK,EAGc;AAAA,MAFnBjF,KAEmB;AAFnBA,SAEmB,GAFX,EAEW;AAAA;;AAAA,MADnBiF,MACmB;AADnBA,UACmB,GADS,EACT;AAAA;;AACnBjF,OAAK,CACFuC,MADH,CACU,UAAC+I,CAAD;AAAA,WAAOA,CAAP;AAAA,GADV,EAEG7K,OAFH,CAEW,UAAC6K,CAAD,EAAO;AACd,KAAC,QAAD,EAAW,OAAX,EAAoB,SAApB,EAA+B,OAA/B,EAAwC7K,OAAxC,CAAgD,UAAC2F,IAAD,EAAU;AACxD,UAAIkF,CAAC,CAAClF,IAAD,CAAL,EAAa;AACX,YAAI,CAACnB,MAAM,CAACmB,IAAD,CAAX,EAAmBnB,MAAM,CAACmB,IAAD,CAAN,GAAe,EAAf;AACnBnB,cAAM,CAACmB,IAAD,CAAN,CAAavF,IAAb,CAAkByK,CAAC,CAAClF,IAAD,CAAnB;AACD;AACF,KALD;AAMD,GATH;AAUA,SAAOnB,MAAP;AACD,C;;;;;;UC1LD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,sF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"navigo.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n extractHashFromURL,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\nimport waitingList from \"./middlewares/waitingList\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n if (self.__dirty) {\n self.__waiting.push(() => self.resolve(to, options));\n return;\n } else {\n self.__dirty = true;\n }\n to = to ? `${clean(root)}/${clean(to)}` : undefined;\n // console.log(\"-- resolve --> \" + to, self.__dirty);\n const context: QContext = {\n instance: self,\n to,\n currentLocationPath: to,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context,\n waitingList\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n // console.log(\"-- navigate --> \" + to, self.__dirty);\n if (self.__dirty) {\n self.__waiting.push(() => self.navigate(to, navigateOptions));\n return;\n } else {\n self.__dirty = true;\n }\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n waitingList,\n ],\n context,\n waitingList\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n if (!self.__freezeListening) {\n resolve();\n }\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const hashString = extractHashFromURL(path);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n hashString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n to: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string | RegExp,\n currentLocation?: string,\n annotatePathWithRoot?: boolean\n ): false | Match {\n const context: QContext = {\n instance: self,\n to: currentLocation,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n if (typeof path === \"string\") {\n path =\n typeof annotatePathWithRoot === \"undefined\" || annotatePathWithRoot\n ? composePathWithRoot(path)\n : path;\n }\n const match = matchRoute(context, {\n name: String(path),\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n this.__freezeListening = false;\n this.__waiting = [];\n this.__dirty = false;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\nimport updateState from \"./middlewares/updateState\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(\n ({ notFoundHandled }: QContext) => notFoundHandled,\n foundLifecycle.concat([updateState]),\n [errorOut, flushCurrent]\n ),\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f((shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n }, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path,\n context.currentLocationPath,\n false\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n (shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n },\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport {\n parseQuery,\n extractGETParameters,\n clean,\n extractHashFromURL,\n} from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n const hashString = extractHashFromURL(context.to);\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n hashString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = context.to = getCurrentEnvURL(\n context.instance.root\n );\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n context.instance.__freezeListening = true;\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n context.instance.__freezeListening = false;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function updateState(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function waitingList(context: QContext) {\n context.instance.__dirty = false;\n if (context.instance.__waiting.length > 0) {\n context.instance.__waiting.shift()();\n }\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n QContext,\n ResolveStrategy,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function extractHashFromURL(url: string) {\n if (url && url.indexOf(\"#\") >= 0) {\n return url.split(\"#\").pop() || \"\";\n }\n return \"\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(context: QContext, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(\n clean(context.currentLocationPath)\n );\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.groups\n ? match.groups\n : match.slice(1);\n return {\n url: clean(current.replace(new RegExp(`^${context.instance.root}`), \"\")),\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1] as ResolveStrategy;\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/navigo.min.js b/lib/navigo.min.js index 5f57294e..554001e9 100644 --- a/lib/navigo.min.js +++ b/lib/navigo.min.js @@ -1,2 +1,2 @@ -!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("Navigo",[],n):"object"==typeof exports?exports.Navigo=n():t.Navigo=n()}("undefined"!=typeof self?self:this,(function(){return(()=>{"use strict";var t={407:(t,n,e)=>{e.d(n,{default:()=>N});var o=/([:*])(\w+)/g,r=/\*/g,i=/\/\?/g;function a(t){return void 0===t&&(t="/"),v()?location.pathname+location.search+location.hash:t}function s(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function c(t){return"string"==typeof t}function u(t){return t&&t.indexOf("#")>=0&&t.split("#").pop()||""}function h(t){var n=s(t).split(/\?(.*)?$/);return[s(n[0]),n.slice(1).join("")]}function f(t){for(var n={},e=t.split("&"),o=0;o0?1===t.matches.length?t.matches[0]:t.matches:void 0)}})).concat([function(){return o()}])):o()}else o()}})),{},(function(){return n()})):n()}function A(t,n){d(t.navigateOptions,"updateState")&&t.instance._setCurrent(t.matches),n()}var R=[function(t,n){var e=t.instance.lastResolved();if(e&&e[0]&&e[0].route===t.match.route&&e[0].url===t.match.url&&e[0].queryString===t.match.queryString)return e.forEach((function(n){n.route.hooks&&n.route.hooks.already&&d(t.navigateOptions,"callHooks")&&n.route.hooks.already.forEach((function(n){return n(t.match)}))})),void n(!1);n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.before&&d(t.navigateOptions,"callHooks")?m(t.match.route.hooks.before.map((function(n){return function(e,o){return n((function(n){!1===n?t.instance.__dirty=!1:o()}),t.match)}})).concat([function(){return n()}])):n()},function(t,n){d(t.navigateOptions,"callHandler")&&t.match.route.handler(t.match),t.instance.updatePageLinks(),n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.after&&d(t.navigateOptions,"callHooks")&&t.match.route.hooks.after.forEach((function(n){return n(t.match)})),n()}],S=[P,function(t,n){var e=t.instance._notFoundRoute;if(e){t.notFoundHandled=!0;var o=h(t.currentLocationPath),r=o[0],i=o[1],a=u(t.to);e.path=s(r);var c={url:e.path,queryString:i,hashString:a,data:null,route:e,params:""!==i?f(i):null};t.matches=[c],t.match=c}n()},m.if((function(t){return t.notFoundHandled}),R.concat([A]),[function(t,n){t.resolveOptions&&!1!==t.resolveOptions.noMatchWarning&&void 0!==t.resolveOptions.noMatchWarning||console.warn('Navigo: "'+t.currentLocationPath+"\" didn't match any of the registered routes."),n()},function(t,n){t.instance._setCurrent(null),n()}])];function E(){return(E=Object.assign||function(t){for(var n=1;n0&&t.instance.__waiting.shift()()}function x(){return(x=Object.assign||function(t){for(var n=1;n=0&&(t=!0===o.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function E(t){return s(i+"/"+s(t))}function N(t,n,e,o){return t=c(t)?E(t):t,{name:o||s(String(t)),path:t,handler:n,hooks:g(e)}}function C(t,n){if(!r.__dirty){r.__dirty=!0,t=t?s(i)+"/"+s(t):void 0;var e={instance:r,to:t,currentLocationPath:t,navigateOptions:{},resolveOptions:x({},o,n)};return m([y,_,m.if((function(t){var n=t.matches;return n&&n.length>0}),H,S)],e,j),!!e.matches&&e.matches}r.__waiting.push((function(){return r.resolve(t,n)}))}function U(t,n){if(r.__dirty)r.__waiting.push((function(){return r.navigate(t,n)}));else{r.__dirty=!0,t=s(i)+"/"+s(t);var e={instance:r,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:o,currentLocationPath:R(t)};m([O,k,_,m.if((function(t){var n=t.matches;return n&&n.length>0}),H,S),b,j],e,j)}}function q(){if(A)return(A?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){"false"!==t.getAttribute("data-navigo")&&"_blank"!==t.getAttribute("target")?t.hasListenerAttached||(t.hasListenerAttached=!0,t.navigoHandler=function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var o=new URL(e);e=o.pathname+o.search}catch(t){}var i=function(t){if(!t)return{};var n,e=t.split(","),o={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":o.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":o[e[0]]="true"===e[1]}})),n&&(o.resolveOptions=n),o}(t.getAttribute("data-navigo-options"));w||(n.preventDefault(),n.stopPropagation(),r.navigate(s(e),i))},t.addEventListener("click",t.navigoHandler)):t.hasListenerAttached&&t.removeEventListener("click",t.navigoHandler)})),r}function F(t,n){var e=L.find((function(n){return n.name===t}));if(e){var o=e.path;if(n)for(var r in n)o=o.replace(":"+r,n[r]);return o.match(/^\//)?o:"/"+o}return null}function I(t){var n=h(s(t)),o=n[0],r=n[1],i=""===r?null:f(r);return{url:o,queryString:r,hashString:u(t),route:N(o,(function(){}),[e],o),data:null,params:i}}function M(t,n,e){return"string"==typeof n&&(n=T(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function T(t){return"string"==typeof t?L.find((function(n){return n.name===E(t)})):L.find((function(n){return n.handler===t}))}t?i=s(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=i,this.routes=L,this.destroyed=w,this.current=d,this.__freezeListening=!1,this.__waiting=[],this.__dirty=!1,this.on=function(t,n,o){var r=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(o=n,n=t,t=i),L.push(N(t,n,[e,o])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])r.on(n,t[n]);else{var o=t[n],i=o.uses,a=o.as,s=o.hooks;L.push(N(n,i,[e,s],a))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return c(t)?s(n.path)!==s(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=C,this.navigate=U,this.navigateByName=function(t,n,e){var o=F(t,n);return null!==o&&(U(o,e),!0)},this.destroy=function(){this.routes=L=[],P&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=w=!0},this.notFound=function(t,n){return r._notFoundRoute=N("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=q,this.link=function(t){return"/"+i+"/"+s(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return h(R(t))},this.lastResolved=function(){return d},this.generate=F,this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:r,currentLocationPath:t,to:t,navigateOptions:{},resolveOptions:o};return _(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n,e){var o={instance:r,to:n,currentLocationPath:n};return y(o,(function(){})),"string"==typeof t&&(t=void 0===e||e?E(t):t),l(o,{name:String(t),path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return I(s(a(i)).replace(new RegExp("^"+i),""))},this.addBeforeHook=M.bind(this,"before"),this.addAfterHook=M.bind(this,"after"),this.addAlreadyHook=M.bind(this,"already"),this.addLeaveHook=M.bind(this,"leave"),this.getRoute=T,this._pathToMatchObject=I,this._clean=s,this._checkForAHash=R,this._setCurrent=function(t){return d=r.current=t},function(){P&&(this.__popstateListener=function(){r.__freezeListening||C()},window.addEventListener("popstate",this.__popstateListener))}.call(this),q.call(this)}}},n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{}};return t[o](r,r.exports,e),r.exports}return e.d=(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(407)})().default})); +!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("Navigo",[],n):"object"==typeof exports?exports.Navigo=n():t.Navigo=n()}("undefined"!=typeof self?self:this,(function(){return(()=>{"use strict";var t={407:(t,n,e)=>{e.d(n,{default:()=>N});var o=/([:*])(\w+)/g,r=/\*/g,i=/\/\?/g;function a(t){return void 0===t&&(t="/"),v()?location.pathname+location.search+location.hash:t}function s(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function c(t){return"string"==typeof t}function u(t){return t&&t.indexOf("#")>=0&&t.split("#").pop()||""}function h(t){var n=s(t).split(/\?(.*)?$/);return[s(n[0]),n.slice(1).join("")]}function f(t){for(var n={},e=t.split("&"),o=0;o0?1===t.matches.length?t.matches[0]:t.matches:void 0)}})).concat([function(){return o()}])):o()}else o()}})),{},(function(){return n()})):n()}function A(t,n){d(t.navigateOptions,"updateState")&&t.instance._setCurrent(t.matches),n()}var R=[function(t,n){var e=t.instance.lastResolved();if(e&&e[0]&&e[0].route===t.match.route&&e[0].url===t.match.url&&e[0].queryString===t.match.queryString)return e.forEach((function(n){n.route.hooks&&n.route.hooks.already&&d(t.navigateOptions,"callHooks")&&n.route.hooks.already.forEach((function(n){return n(t.match)}))})),void n(!1);n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.before&&d(t.navigateOptions,"callHooks")?m(t.match.route.hooks.before.map((function(n){return function(e,o){return n((function(n){!1===n?t.instance.__dirty=!1:o()}),t.match)}})).concat([function(){return n()}])):n()},function(t,n){d(t.navigateOptions,"callHandler")&&t.match.route.handler(t.match),t.instance.updatePageLinks(),n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.after&&d(t.navigateOptions,"callHooks")&&t.match.route.hooks.after.forEach((function(n){return n(t.match)})),n()}],S=[P,function(t,n){var e=t.instance._notFoundRoute;if(e){t.notFoundHandled=!0;var o=h(t.currentLocationPath),r=o[0],i=o[1],a=u(t.to);e.path=s(r);var c={url:e.path,queryString:i,hashString:a,data:null,route:e,params:""!==i?f(i):null};t.matches=[c],t.match=c}n()},m.if((function(t){return t.notFoundHandled}),R.concat([A]),[function(t,n){t.resolveOptions&&!1!==t.resolveOptions.noMatchWarning&&void 0!==t.resolveOptions.noMatchWarning||console.warn('Navigo: "'+t.currentLocationPath+"\" didn't match any of the registered routes."),n()},function(t,n){t.instance._setCurrent(null),n()}])];function E(){return(E=Object.assign||function(t){for(var n=1;n0&&t.instance.__waiting.shift()()}function j(){return(j=Object.assign||function(t){for(var n=1;n=0&&(t=!0===o.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function E(t){return s(i+"/"+s(t))}function N(t,n,e,o){return t=c(t)?E(t):t,{name:o||s(String(t)),path:t,handler:n,hooks:g(e)}}function C(t,n){if(!r.__dirty){r.__dirty=!0,t=t?s(i)+"/"+s(t):void 0;var e={instance:r,to:t,currentLocationPath:t,navigateOptions:{},resolveOptions:j({},o,n)};return m([y,_,m.if((function(t){var n=t.matches;return n&&n.length>0}),H,S)],e,x),!!e.matches&&e.matches}r.__waiting.push((function(){return r.resolve(t,n)}))}function U(t,n){if(r.__dirty)r.__waiting.push((function(){return r.navigate(t,n)}));else{r.__dirty=!0,t=s(i)+"/"+s(t);var e={instance:r,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:o,currentLocationPath:R(t)};m([O,k,_,m.if((function(t){var n=t.matches;return n&&n.length>0}),H,S),b,x],e,x)}}function q(){if(A)return(A?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){"false"!==t.getAttribute("data-navigo")&&"_blank"!==t.getAttribute("target")?t.hasListenerAttached||(t.hasListenerAttached=!0,t.navigoHandler=function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var o=new URL(e);e=o.pathname+o.search}catch(t){}var i=function(t){if(!t)return{};var n,e=t.split(","),o={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":o.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":o[e[0]]="true"===e[1]}})),n&&(o.resolveOptions=n),o}(t.getAttribute("data-navigo-options"));w||(n.preventDefault(),n.stopPropagation(),r.navigate(s(e),i))},t.addEventListener("click",t.navigoHandler)):t.hasListenerAttached&&t.removeEventListener("click",t.navigoHandler)})),r}function F(t,n){var e=L.find((function(n){return n.name===t}));if(e){var o=e.path;if(n)for(var r in n)o=o.replace(":"+r,n[r]);return o.match(/^\//)?o:"/"+o}return null}function I(t){var n=h(s(t)),o=n[0],r=n[1],i=""===r?null:f(r);return{url:o,queryString:r,hashString:u(t),route:N(o,(function(){}),[e],o),data:null,params:i}}function M(t,n,e){return"string"==typeof n&&(n=T(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function T(t){return"string"==typeof t?L.find((function(n){return n.name===E(t)})):L.find((function(n){return n.handler===t}))}t?i=s(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=i,this.routes=L,this.destroyed=w,this.current=d,this.__freezeListening=!1,this.__waiting=[],this.__dirty=!1,this.on=function(t,n,o){var r=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(o=n,n=t,t=i),L.push(N(t,n,[e,o])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])r.on(n,t[n]);else{var o=t[n],i=o.uses,a=o.as,s=o.hooks;L.push(N(n,i,[e,s],a))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return c(t)?s(n.path)!==s(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=C,this.navigate=U,this.navigateByName=function(t,n,e){var o=F(t,n);return null!==o&&(U(o,e),!0)},this.destroy=function(){this.routes=L=[],P&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=w=!0},this.notFound=function(t,n){return r._notFoundRoute=N("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=q,this.link=function(t){return"/"+i+"/"+s(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return h(R(t))},this.lastResolved=function(){return d},this.generate=F,this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:r,currentLocationPath:t,to:t,navigateOptions:{},resolveOptions:o};return _(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n,e){var o={instance:r,to:n,currentLocationPath:n};return y(o,(function(){})),"string"==typeof t&&(t=void 0===e||e?E(t):t),l(o,{name:String(t),path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return I(s(a(i)).replace(new RegExp("^"+i),""))},this.addBeforeHook=M.bind(this,"before"),this.addAfterHook=M.bind(this,"after"),this.addAlreadyHook=M.bind(this,"already"),this.addLeaveHook=M.bind(this,"leave"),this.getRoute=T,this._pathToMatchObject=I,this._clean=s,this._checkForAHash=R,this._setCurrent=function(t){return d=r.current=t},function(){P&&(this.__popstateListener=function(){r.__freezeListening||C()},window.addEventListener("popstate",this.__popstateListener))}.call(this),q.call(this)}}},n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{}};return t[o](r,r.exports,e),r.exports}return e.d=(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(407)})().default})); //# sourceMappingURL=navigo.min.js.map \ No newline at end of file diff --git a/lib/navigo.min.js.map b/lib/navigo.min.js.map index 496ed976..0ef62840 100644 --- a/lib/navigo.min.js.map +++ b/lib/navigo.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/middlewares/updateState.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/middlewares/waitingList.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/startup","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand"],"names":["root","factory","exports","module","define","amd","self","this","PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractHashFromURL","url","indexOf","split","pop","extractGETParameters","tmp","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","context","route","pattern","currentLocationPath","current","GETParams","params","paramNames","path","full","dots","name","hashString","to","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","groups","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","idx","next","splice","moveForward","setLocationPath","instance","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","__freezeListening","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","runHook","newLocationVSOldMatch","matchLocation","find","f","d","shouldStop","__dirty","undefined","concat","updateState","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","waitingList","__waiting","shift","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","destroyed","composePathWithRoot","createRoute","String","resolve","options","navigate","call","document","querySelectorAll","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","addEventListener","removeEventListener","generate","r","pathToMatchObject","addHook","func","getRoute","nameOrHandler","on","Object","keys","p","uses","as","off","what","navigateByName","destroy","__popstateListener","notFound","getLinkPath","currentLocation","annotatePathWithRoot","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,SAAU,GAAIH,GACK,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,IARnB,CASmB,oBAATK,KAAuBA,KAAOC,MAAM,WAC9C,M,+DCVO,IAAMC,EAAmB,eAEnBC,EAAkB,MAElBC,EAAkB,QCiBxB,SAASC,EAAiBC,GAC/B,YADuD,IAAxBA,MAAW,KACtCC,IACKC,SAASC,SAAWD,SAASE,OAASF,SAASG,KAEjDL,EAEF,SAASM,EAAMC,GACpB,OAAOA,EAAEC,QAAQ,OAAQ,IAAIA,QAAQ,OAAQ,IAExC,SA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IC,EAASwN,EAAyBE,GAAY,CAGjD3N,QAAS,IAOV,OAHA4N,EAAoBD,GAAU1N,EAAQA,EAAOD,QAAS0N,GAG/CzN,EAAOD,QCjBf,OCFA0N,EAAoBzF,EAAI,CAACjI,EAAS6N,KACjC,IAAI,IAAIzL,KAAOyL,EACXH,EAAoBI,EAAED,EAAYzL,KAASsL,EAAoBI,EAAE9N,EAASoC,IAC5EgK,OAAO2B,eAAe/N,EAASoC,EAAK,CAAE4L,YAAY,EAAMC,IAAKJ,EAAWzL,MCJ3EsL,EAAoBI,EAAI,CAACvJ,EAAK2J,IAAS9B,OAAO+B,UAAUC,eAAejE,KAAK5F,EAAK2J,GFG1ER,EAAoB,M","file":"navigo.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n QContext,\n ResolveStrategy,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function extractHashFromURL(url: string) {\n if (url && url.indexOf(\"#\") >= 0) {\n return url.split(\"#\").pop() || \"\";\n }\n return \"\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(context: QContext, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(\n clean(context.currentLocationPath)\n );\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.groups\n ? match.groups\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1] as ResolveStrategy;\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = context.to = getCurrentEnvURL(\n context.instance.root\n );\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n context.instance.__freezeListening = true;\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n context.instance.__freezeListening = false;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path,\n context.currentLocationPath,\n false\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n (shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n },\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function updateState(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\nimport updateState from \"./middlewares/updateState\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(\n ({ notFoundHandled }: QContext) => notFoundHandled,\n foundLifecycle.concat([updateState]),\n [errorOut, flushCurrent]\n ),\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f((shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n }, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport {\n parseQuery,\n extractGETParameters,\n clean,\n extractHashFromURL,\n} from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n const hashString = extractHashFromURL(context.to);\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n hashString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\n\nexport default function waitingList(context: QContext) {\n context.instance.__dirty = false;\n if (context.instance.__waiting.length > 0) {\n context.instance.__waiting.shift()();\n }\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n extractHashFromURL,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\nimport waitingList from \"./middlewares/waitingList\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n if (self.__dirty) {\n self.__waiting.push(() => self.resolve(to, options));\n return;\n } else {\n self.__dirty = true;\n }\n to = to ? `${clean(root)}/${clean(to)}` : undefined;\n // console.log(\"-- resolve --> \" + to, self.__dirty);\n const context: QContext = {\n instance: self,\n to,\n currentLocationPath: to,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context,\n waitingList\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n // console.log(\"-- navigate --> \" + to, self.__dirty);\n if (self.__dirty) {\n self.__waiting.push(() => self.navigate(to, navigateOptions));\n return;\n } else {\n self.__dirty = true;\n }\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n waitingList,\n ],\n context,\n waitingList\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n if (!self.__freezeListening) {\n resolve();\n }\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const hashString = extractHashFromURL(path);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n hashString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n to: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string | RegExp,\n currentLocation?: string,\n annotatePathWithRoot?: boolean\n ): false | Match {\n const context: QContext = {\n instance: self,\n to: currentLocation,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n if (typeof path === \"string\") {\n path =\n typeof annotatePathWithRoot === \"undefined\" || annotatePathWithRoot\n ? composePathWithRoot(path)\n : path;\n }\n const match = matchRoute(context, {\n name: String(path),\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n this.__freezeListening = false;\n this.__waiting = [];\n this.__dirty = false;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(407);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/middlewares/updateState.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/middlewares/waitingList.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/startup","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand"],"names":["root","factory","exports","module","define","amd","self","this","PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractHashFromURL","url","indexOf","split","pop","extractGETParameters","tmp","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","context","route","pattern","currentLocationPath","current","GETParams","params","paramNames","path","full","dots","name","hashString","to","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","groups","instance","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","idx","next","splice","moveForward","setLocationPath","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","__freezeListening","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","runHook","newLocationVSOldMatch","matchLocation","find","f","d","shouldStop","__dirty","undefined","concat","updateState","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","waitingList","__waiting","shift","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","destroyed","composePathWithRoot","createRoute","String","resolve","options","navigate","call","document","querySelectorAll","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","addEventListener","removeEventListener","generate","r","pathToMatchObject","addHook","func","getRoute","nameOrHandler","on","Object","keys","p","uses","as","off","what","navigateByName","destroy","__popstateListener","notFound","getLinkPath","currentLocation","annotatePathWithRoot","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD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vCA,KAAK4L,SAAWA,EAChB5L,KAAKiG,mBAAqBwF,EAC1BzL,KAAKmN,OAASxM,EACdX,KAAKoF,eAAiBA,EACtBpF,KAAKgG,YAAc,SAACnB,GAAD,OAAQpC,EAAU1C,EAAK0C,QAAUoC,GA9NpD,WACM0B,IACFvG,KAAKwM,mBAAqB,WACnBzM,EAAK8G,mBACR8C,KAGJ5F,OAAOsH,iBAAiB,WAAYrL,KAAKwM,sBAyNtC1C,KAAK9J,MACZsI,EAAgBwB,KAAK9J,SC9anBoN,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAU3N,QAG3C,IAAIC,EAASwN,EAAyBE,GAAY,CAGjD3N,QAAS,IAOV,OAHA4N,EAAoBD,GAAU1N,EAAQA,EAAOD,QAAS0N,GAG/CzN,EAAOD,QCjBf,OCFA0N,EAAoBzF,EAAI,CAACjI,EAAS6N,KACjC,IAAI,IAAIzL,KAAOyL,EACXH,EAAoBI,EAAED,EAAYzL,KAASsL,EAAoBI,EAAE9N,EAASoC,IAC5EgK,OAAO2B,eAAe/N,EAASoC,EAAK,CAAE4L,YAAY,EAAMC,IAAKJ,EAAWzL,MCJ3EsL,EAAoBI,EAAI,CAACtJ,EAAK0J,IAAS9B,OAAO+B,UAAUC,eAAejE,KAAK3F,EAAK0J,GFG1ER,EAAoB,M","file":"navigo.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n QContext,\n ResolveStrategy,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function extractHashFromURL(url: string) {\n if (url && url.indexOf(\"#\") >= 0) {\n return url.split(\"#\").pop() || \"\";\n }\n return \"\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(context: QContext, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(\n clean(context.currentLocationPath)\n );\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.groups\n ? match.groups\n : match.slice(1);\n return {\n url: clean(current.replace(new RegExp(`^${context.instance.root}`), \"\")),\n queryString: GETParams,\n hashString: extractHashFromURL(context.to),\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1] as ResolveStrategy;\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = context.to = getCurrentEnvURL(\n context.instance.root\n );\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n context.instance.__freezeListening = true;\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n context.instance.__freezeListening = false;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path,\n context.currentLocationPath,\n false\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n (shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n },\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function updateState(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\nimport updateState from \"./middlewares/updateState\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(\n ({ notFoundHandled }: QContext) => notFoundHandled,\n foundLifecycle.concat([updateState]),\n [errorOut, flushCurrent]\n ),\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f((shouldStop) => {\n if (shouldStop === false) {\n context.instance.__dirty = false;\n } else {\n d();\n }\n }, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport {\n parseQuery,\n extractGETParameters,\n clean,\n extractHashFromURL,\n} from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n const hashString = extractHashFromURL(context.to);\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n hashString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\n\nexport default function waitingList(context: QContext) {\n context.instance.__dirty = false;\n if (context.instance.__waiting.length > 0) {\n context.instance.__waiting.shift()();\n }\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n extractHashFromURL,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\nimport waitingList from \"./middlewares/waitingList\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n if (self.__dirty) {\n self.__waiting.push(() => self.resolve(to, options));\n return;\n } else {\n self.__dirty = true;\n }\n to = to ? `${clean(root)}/${clean(to)}` : undefined;\n // console.log(\"-- resolve --> \" + to, self.__dirty);\n const context: QContext = {\n instance: self,\n to,\n currentLocationPath: to,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context,\n waitingList\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n // console.log(\"-- navigate --> \" + to, self.__dirty);\n if (self.__dirty) {\n self.__waiting.push(() => self.navigate(to, navigateOptions));\n return;\n } else {\n self.__dirty = true;\n }\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n waitingList,\n ],\n context,\n waitingList\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n if (!self.__freezeListening) {\n resolve();\n }\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const hashString = extractHashFromURL(path);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n hashString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n to: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string | RegExp,\n currentLocation?: string,\n annotatePathWithRoot?: boolean\n ): false | Match {\n const context: QContext = {\n instance: self,\n to: currentLocation,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n if (typeof path === \"string\") {\n path =\n typeof annotatePathWithRoot === \"undefined\" || annotatePathWithRoot\n ? composePathWithRoot(path)\n : path;\n }\n const match = matchRoute(context, {\n name: String(path),\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n this.__freezeListening = false;\n this.__waiting = [];\n this.__dirty = false;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(407);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index 275add77..c644b033 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "navigo", - "version": "8.8.8", + "version": "8.8.9", "description": "A simple vanilla JavaScript router", "main": "lib/navigo.js", "browser": "lib/navigo.min.js", diff --git a/src/__tests__/basic.spec.ts b/src/__tests__/basic.spec.ts index 088f646b..efdcb6b7 100644 --- a/src/__tests__/basic.spec.ts +++ b/src/__tests__/basic.spec.ts @@ -428,4 +428,28 @@ describe("Given the Navigo library", () => { expect(r.current).toHaveLength(1); }); }); + describe("when we have a custom root and we have a match", () => { + it("should not include the root into the Match's url prop", () => { + const r: NavigoRouter = new Navigo("/app"); + const h = jest.fn(); + + r.on("/login", h); + r.navigate("login"); + + expect(h).toBeCalledTimes(1); + expect(h).toBeCalledWith({ + url: "login", + data: null, + params: null, + queryString: "", + hashString: "", + route: { + handler: expect.any(Function), + hooks: {}, + name: "app/login", + path: "app/login", + }, + }); + }); + }); }); diff --git a/src/__tests__/navigate.spec.ts b/src/__tests__/navigate.spec.ts index eef41e53..ebccf4d6 100644 --- a/src/__tests__/navigate.spec.ts +++ b/src/__tests__/navigate.spec.ts @@ -231,7 +231,7 @@ describe("Given the Navigo library", () => { expect(location.pathname).toBe("/app/login"); expect(r.current).toStrictEqual([ expect.objectContaining({ - url: "app/login", + url: "login", }), ]); }); diff --git a/src/utils.ts b/src/utils.ts index 4925ecdd..150b31a3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -113,7 +113,7 @@ export function matchRoute(context: QContext, route: Route): false | Match { ? match.groups : match.slice(1); return { - url: current, + url: clean(current.replace(new RegExp(`^${context.instance.root}`), "")), queryString: GETParams, hashString: extractHashFromURL(context.to), route: route,