This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsw-toolbox.map.json
1 lines (1 loc) · 35.1 KB
/
sw-toolbox.map.json
1
{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","lib/sw-toolbox.js","lib/options.js","lib/helpers.js","lib/router.js","lib/strategies/index.js","lib/route.js","lib/strategies/networkFirst.js","lib/strategies/cacheOnly.js","lib/strategies/cacheFirst.js","lib/strategies/fastest.js","lib/strategies/networkOnly.js","node_modules/serviceworker-cache-polyfill/index.js","node_modules/path-to-regexp/index.js","node_modules/path-to-regexp/node_modules/isarray/index.js"],"names":["cache","url","options","helpers","openCache","then","add","uncache","precache","items","Array","isArray","preCacheItems","concat","require","router","strategies","debug","self","addEventListener","event","inactiveCache","cacheName","join","waitUntil","Promise","all","addAll","bind","renameCache","handler","match","request","respondWith","module","exports","networkOnly","networkFirst","cacheOnly","cacheFirst","fastest","scope","registration","URL","location","href","successResponses","message","flag","globalOptions","console","log","caches","open","fetchAndCache","fetch","clone","response","test","status","put","source","destination","results","sourceCache","destCache","keys","requests","map","regexEscape","s","replace","Route","keyMatch","object","string","Object","i","length","pattern","RegExp","Router","this","routes","forEach","method","prototype","path","origin","toLowerCase","route","regexp","matchMethod","pathname","methods","makeHandler","basePath","pathRegexp","indexOf","exec","values","key","index","name","cacheResponse","error","rejected","reasons","maybeReject","reason","push","toString","reject","Error","resolve","Cache","NetworkError","code","create","arguments","TypeError","Request","String","scheme","protocol","responses","undefined","escapeGroup","group","attachKeys","re","flags","sensitive","regexpToRegexp","groups","delimiter","optional","repeat","arrayToRegexp","parts","pathToRegexp","replacePath","_","escaped","prefix","capture","suffix","escape","PATH_REGEXP","strict","end","endsWithSlash","charAt","slice","arr","call"],"mappings":"AAAA;ACeA,YA8CA,SAASA,OAAMC,EAAKC,GAClB,MAAOC,SAAQC,UAAUF,GAASG,KAAK,SAASL,GAC9C,MAAOA,GAAMM,IAAIL,KA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G,YAOjB,IAAIQ,aAAc,GAAIpE,SAGpB,UAMA,qFAEA,6BACAzD,KAAK,KAAM;;ACxBbW,OAAOC,QAAUzB,MAAMC,SAAW,SAAU+I,GAC1C,MAA8C,kBAAvC9E,OAAOU,UAAUyB,SAAS4C,KAAKD;;AFDnCvC,MAAM7B,UAAUhF,MACnB6G,MAAM7B,UAAUhF,IAAM,SAAa0B,GACjC,MAAOkD,MAAKvD,QAAQK,MAInBmF,MAAM7B,UAAU3D,SACnBwF,MAAM7B,UAAU3D,OAAS,SAAgBwC,GAIvC,QAASiD,GAAarE,GACpBmC,KAAKqB,KAAO,eACZrB,KAAKmC,KAAO,GACZnC,KAAKnC,QAAUA,EANjB,GAAI/C,GAAQkF,IAUZ,OAFAkC,GAAa9B,UAAYV,OAAO0C,OAAOL,MAAM3B,WAEtC7D,QAAQyF,UAAU7G,KAAK,WAC5B,GAAIkH,UAAUzC,OAAS,EAAG,KAAM,IAAI0C,UAcpC,OATArD,GAAWA,EAASC,IAAI,SAASpC,GAC/B,MAAIA,aAAmByF,SACdzF,EAGA0F,OAAO1F,KAIXP,QAAQC,IACbyC,EAASC,IAAI,SAASpC,GACG,gBAAZA,KACTA,EAAU,GAAIyF,SAAQzF,GAGxB,IAAI2F,GAAS,GAAIhF,KAAIX,EAAQ/B,KAAK2H,QAElC,IAAe,UAAXD,GAAiC,WAAXA,EACxB,KAAM,IAAIP,GAAa,iBAGzB,OAAO7D,OAAMvB,EAAQwB,cAGxBnD,KAAK,SAASwH,GAGf,MAAOpG,SAAQC,IACbmG,EAAUzD,IAAI,SAASX,EAAUoB,GAC/B,MAAO7E,GAAM4D,IAAIO,EAASU,GAAIpB,QAGjCpD,KAAK,WACN,MAAOyH","file":"bundle.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\n\nrequire('serviceworker-cache-polyfill');\nvar options = require('./options');\nvar router = require('./router');\nvar helpers = require('./helpers');\nvar strategies = require('./strategies');\n\nhelpers.debug('Service Worker Toolbox is loading');\n\n// Install\n\nself.addEventListener('install', function(event) {\n var inactiveCache = options.cacheName + '$$$inactive$$$';\n helpers.debug('install event fired');\n helpers.debug('creating cache [' + inactiveCache + ']');\n helpers.debug('preCache list: ' + (options.preCacheItems.join(', ') || '(none)'));\n event.waitUntil(\n helpers.openCache({cacheName: inactiveCache}).then(function(cache) {\n return Promise.all(options.preCacheItems).then(cache.addAll.bind(cache));\n })\n );\n});\n\n// Activate\n\nself.addEventListener('activate', function(event) {\n helpers.debug('activate event fired');\n var inactiveCache = options.cacheName + '$$$inactive$$$';\n event.waitUntil(helpers.renameCache(inactiveCache, options.cacheName));\n});\n\n// Fetch\n\nself.addEventListener('fetch', function(event) {\n var handler = router.match(event.request);\n\n if (handler) {\n event.respondWith(handler(event.request));\n } else if (router.default) {\n event.respondWith(router.default(event.request));\n }\n});\n\n// Caching\n\nfunction cache(url, options) {\n return helpers.openCache(options).then(function(cache) {\n return cache.add(url);\n });\n}\n\nfunction uncache(url, options) {\n return helpers.openCache(options).then(function(cache) {\n return cache.delete(url);\n });\n}\n\nfunction precache(items) {\n if (!Array.isArray(items)) {\n items = [items];\n }\n options.preCacheItems = options.preCacheItems.concat(items);\n}\n\nmodule.exports = {\n networkOnly: strategies.networkOnly,\n networkFirst: strategies.networkFirst,\n cacheOnly: strategies.cacheOnly,\n cacheFirst: strategies.cacheFirst,\n fastest: strategies.fastest,\n router: router,\n options: options,\n cache: cache,\n uncache: uncache,\n precache: precache\n};\n","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n\t http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n'use strict';\n\n// TODO: This is necessary to handle different implementations in the wild\n// The spec defines self.registration, but it was not implemented in Chrome 40.\nvar scope;\nif (self.registration) {\n scope = self.registration.scope;\n} else {\n scope = self.scope || new URL('./', self.location).href;\n}\n\nmodule.exports = {\n\tcacheName: '$$$toolbox-cache$$$' + scope + '$$$',\n\tdebug: false,\n\tpreCacheItems: [],\n\t// A regular expression to apply to HTTP response codes. Codes that match\n\t// will be considered successes, while others will not, and will not be\n\t// cached.\n\tsuccessResponses: /^0|([123]\\d\\d)|(40[14567])|410$/,\n};\n","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\n\nvar globalOptions = require('./options');\n\nfunction debug(message, options) {\n options = options || {};\n var flag = options.debug || globalOptions.debug; \n if (flag) {\n console.log('[sw-toolbox] ' + message);\n }\n}\n\nfunction openCache(options) {\n options = options || {};\n var cacheName = options.cacheName || globalOptions.cacheName;\n debug('Opening cache \"' + cacheName + '\"', options);\n return caches.open(cacheName);\n}\n\nfunction fetchAndCache(request, options) {\n options = options || {};\n var successResponses = options.successResponses || globalOptions.successResponses; \n return fetch(request.clone()).then(function(response) {\n\n // Only cache successful responses\n if (successResponses.test(response.status)) {\n openCache(options).then(function(cache) {\n cache.put(request, response);\n });\n }\n\n return response.clone();\n });\n}\n\nfunction renameCache(source, destination, options) {\n debug('Renaming cache: [' + source + '] to [' + destination + ']', options);\n return caches.delete(destination).then(function() {\n return Promise.all([\n caches.open(source),\n caches.open(destination)\n ]).then(function(results) {\n var sourceCache = results[0];\n var destCache = results[1];\n\n return sourceCache.keys().then(function(requests) {\n return Promise.all(requests.map(function(request) {\n return sourceCache.match(request).then(function(response) {\n return destCache.put(request, response);\n });\n }));\n }).then(function() {\n return caches.delete(source);\n });\n });\n });\n}\n\nmodule.exports = {\n debug: debug,\n fetchAndCache: fetchAndCache,\n openCache: openCache,\n renameCache: renameCache\n};","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\n\nvar Route = require('./route');\n\nfunction regexEscape(s) {\n return s.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\n\nvar keyMatch = function(object, string) {\n var keys = Object.keys(object);\n for (var i = 0; i < keys.length; i++) {\n var pattern = new RegExp(keys[i]);\n if (pattern.test(string)) {\n return object[keys[i]];\n }\n }\n return null;\n};\n\nvar Router = function() {\n this.routes = {};\n this.default = null;\n};\n\n['get', 'post', 'put', 'delete', 'head', 'any'].forEach(function(method) {\n Router.prototype[method] = function(path, handler, options) {\n return this.add(method, path, handler, options);\n };\n});\n\nRouter.prototype.add = function(method, path, handler, options) {\n options = options || {};\n var origin = options.origin || self.location.origin;\n if (origin instanceof RegExp) {\n origin = origin.source;\n } else {\n origin = regexEscape(origin);\n }\n method = method.toLowerCase();\n var route = new Route(method, path, handler, options);\n this.routes[origin] = this.routes[origin] || {};\n this.routes[origin][method] = this.routes[origin][method] || {};\n this.routes[origin][method][route.regexp.source] = route;\n};\n\nRouter.prototype.matchMethod = function(method, url) {\n url = new URL(url);\n var origin = url.origin;\n var path = url.pathname;\n method = method.toLowerCase();\n\n var methods = keyMatch(this.routes, origin);\n if (!methods) {\n return null;\n }\n\n var routes = methods[method];\n if (!routes) {\n return null;\n }\n\n var route = keyMatch(routes, path);\n\n if (route) {\n return route.makeHandler(path);\n }\n\n return null;\n};\n\nRouter.prototype.match = function(request) {\n return this.matchMethod(request.method, request.url) || this.matchMethod('any', request.url);\n};\n\nmodule.exports = new Router();\n","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n\t http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\nmodule.exports = {\n networkOnly: require('./networkOnly'),\n networkFirst: require('./networkFirst'),\n cacheOnly: require('./cacheOnly'),\n cacheFirst: require('./cacheFirst'),\n fastest: require('./fastest')\t\n};","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\n\n//TODO: Use self.registration.scope instead of self.location\nvar url = new URL('./', self.location);\nvar basePath = url.pathname;\nvar pathRegexp = require('path-to-regexp');\n\n\nvar Route = function(method, path, handler, options) {\n // The URL() constructor can't parse express-style routes as they are not\n // valid urls. This means we have to manually manipulate relative urls into\n // absolute ones. This check is extremely naive but implementing a tweaked\n // version of the full algorithm seems like overkill\n // (https://url.spec.whatwg.org/#concept-basic-url-parser)\n if (path.indexOf('/') !== 0) {\n path = basePath + path;\n }\n\n this.method = method;\n this.keys = [];\n this.regexp = pathRegexp(path, this.keys);\n this.options = options;\n this.handler = handler;\n};\n\nRoute.prototype.makeHandler = function(url) {\n var match = this.regexp.exec(url);\n var values = {};\n this.keys.forEach(function(key, index) {\n values[key.name] = match[index + 1];\n });\n return function(request) {\n return this.handler(request, values, this.options);\n }.bind(this);\n};\n\nmodule.exports = Route;\n","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\nvar globalOptions = require('../options');\nvar helpers = require('../helpers');\n\nfunction networkFirst(request, values, options) {\n options = options || {};\n var successResponses = options.successResponses || globalOptions.successResponses;\n helpers.debug('Strategy: network first [' + request.url + ']', options);\n return helpers.openCache(options).then(function(cache) {\n return helpers.fetchAndCache(request, options).then(function(response) {\n if (successResponses.test(response.status)) {\n return response;\n }\n\n return cache.match(request).then(function(cacheResponse) {\n helpers.debug('Response was an HTTP error', options);\n if (cacheResponse) {\n helpers.debug('Resolving with cached response instead', options);\n return cacheResponse;\n } else {\n // If we didn't have anything in the cache, it's better to return the\n // error page than to return nothing\n helpers.debug('No cached result, resolving with HTTP error response from network', options);\n return response;\n }\n });\n }).catch(function(error) {\n helpers.debug('Network error, fallback to cache [' + request.url + ']', options);\n return cache.match(request);\n });\n });\n}\n\nmodule.exports = networkFirst;","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n\t http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\n\nfunction cacheOnly(request, values, options) {\n helpers.debug('Strategy: cache only [' + request.url + ']', options);\n return helpers.openCache(options).then(function(cache) {\n return cache.match(request);\n });\n}\n\nmodule.exports = cacheOnly;\n","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n\t http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\n\nfunction cacheFirst(request, values, options) {\n helpers.debug('Strategy: cache first [' + request.url + ']', options);\n return helpers.openCache(options).then(function(cache) {\n return cache.match(request).then(function (response) {\n if (response) {\n return response;\n }\n\n return helpers.fetchAndCache(request, options);\n });\n });\n}\n\nmodule.exports = cacheFirst;","/*\n Copyright 2014 Google Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\nvar cacheOnly = require('./cacheOnly');\n\nfunction fastest(request, values, options) {\n helpers.debug('Strategy: fastest [' + request.url + ']', options);\n var rejected = false;\n var reasons = [];\n\n var maybeReject = function(reason) {\n reasons.push(reason.toString());\n if (rejected) {\n return Promise.reject(new Error('Both cache and network failed: \"' + reasons.join('\", \"') + '\"'));\n }\n rejected = true;\n };\n\n return new Promise(function(resolve, reject) {\n helpers.fetchAndCache(request.clone(), options).then(resolve, maybeReject);\n cacheOnly(request, options).then(resolve, maybeReject);\n });\n}\n\nmodule.exports = fastest;","/*\n\tCopyright 2014 Google Inc. All Rights Reserved.\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n\t http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n*/\n'use strict';\nvar helpers = require('../helpers');\n\nfunction networkOnly(request, values, options) {\n helpers.debug('Strategy: network only [' + request.url + ']', options);\n return fetch(request);\n}\n\nmodule.exports = networkOnly;","if (!Cache.prototype.add) {\n Cache.prototype.add = function add(request) {\n return this.addAll([request]);\n };\n}\n\nif (!Cache.prototype.addAll) {\n Cache.prototype.addAll = function addAll(requests) {\n var cache = this;\n\n // Since DOMExceptions are not constructable:\n function NetworkError(message) {\n this.name = 'NetworkError';\n this.code = 19;\n this.message = message;\n }\n NetworkError.prototype = Object.create(Error.prototype);\n\n return Promise.resolve().then(function() {\n if (arguments.length < 1) throw new TypeError();\n \n // Simulate sequence<(Request or USVString)> binding:\n var sequence = [];\n\n requests = requests.map(function(request) {\n if (request instanceof Request) {\n return request;\n }\n else {\n return String(request); // may throw TypeError\n }\n });\n\n return Promise.all(\n requests.map(function(request) {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n var scheme = new URL(request.url).protocol;\n\n if (scheme !== 'http:' && scheme !== 'https:') {\n throw new NetworkError(\"Invalid scheme\");\n }\n\n return fetch(request.clone());\n })\n );\n }).then(function(responses) {\n // TODO: check that requests don't overwrite one another\n // (don't think this is possible to polyfill due to opaque responses)\n return Promise.all(\n responses.map(function(response, i) {\n return cache.put(requests[i], response);\n })\n );\n }).then(function() {\n return undefined;\n });\n };\n}\n","var isArray = require('isarray');\n\n/**\n * Expose `pathToRegexp`.\n */\nmodule.exports = pathToRegexp;\n\n/**\n * The main path matching regexp utility.\n *\n * @type {RegExp}\n */\nvar PATH_REGEXP = new RegExp([\n // Match escaped characters that would otherwise appear in future matches.\n // This allows the user to escape special characters that won't transform.\n '(\\\\\\\\.)',\n // Match Express-style parameters and un-named parameters with a prefix\n // and optional suffixes. Matches appear as:\n //\n // \"/:test(\\\\d+)?\" => [\"/\", \"test\", \"\\d+\", undefined, \"?\"]\n // \"/route(\\\\d+)\" => [undefined, undefined, undefined, \"\\d+\", undefined]\n '([\\\\/.])?(?:\\\\:(\\\\w+)(?:\\\\(((?:\\\\\\\\.|[^)])*)\\\\))?|\\\\(((?:\\\\\\\\.|[^)])*)\\\\))([+*?])?',\n // Match regexp special characters that are always escaped.\n '([.+*?=^!:${}()[\\\\]|\\\\/])'\n].join('|'), 'g');\n\n/**\n * Escape the capturing group by escaping special characters and meaning.\n *\n * @param {String} group\n * @return {String}\n */\nfunction escapeGroup (group) {\n return group.replace(/([=!:$\\/()])/g, '\\\\$1');\n}\n\n/**\n * Attach the keys as a property of the regexp.\n *\n * @param {RegExp} re\n * @param {Array} keys\n * @return {RegExp}\n */\nfunction attachKeys (re, keys) {\n re.keys = keys;\n return re;\n}\n\n/**\n * Get the flags for a regexp from the options.\n *\n * @param {Object} options\n * @return {String}\n */\nfunction flags (options) {\n return options.sensitive ? '' : 'i';\n}\n\n/**\n * Pull out keys from a regexp.\n *\n * @param {RegExp} path\n * @param {Array} keys\n * @return {RegExp}\n */\nfunction regexpToRegexp (path, keys) {\n // Use a negative lookahead to match only capturing groups.\n var groups = path.source.match(/\\((?!\\?)/g);\n\n if (groups) {\n for (var i = 0; i < groups.length; i++) {\n keys.push({\n name: i,\n delimiter: null,\n optional: false,\n repeat: false\n });\n }\n }\n\n return attachKeys(path, keys);\n}\n\n/**\n * Transform an array into a regexp.\n *\n * @param {Array} path\n * @param {Array} keys\n * @param {Object} options\n * @return {RegExp}\n */\nfunction arrayToRegexp (path, keys, options) {\n var parts = [];\n\n for (var i = 0; i < path.length; i++) {\n parts.push(pathToRegexp(path[i], keys, options).source);\n }\n\n var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));\n return attachKeys(regexp, keys);\n}\n\n/**\n * Replace the specific tags with regexp strings.\n *\n * @param {String} path\n * @param {Array} keys\n * @return {String}\n */\nfunction replacePath (path, keys) {\n var index = 0;\n\n function replace (_, escaped, prefix, key, capture, group, suffix, escape) {\n if (escaped) {\n return escaped;\n }\n\n if (escape) {\n return '\\\\' + escape;\n }\n\n var repeat = suffix === '+' || suffix === '*';\n var optional = suffix === '?' || suffix === '*';\n\n keys.push({\n name: key || index++,\n delimiter: prefix || '/',\n optional: optional,\n repeat: repeat\n });\n\n prefix = prefix ? ('\\\\' + prefix) : '';\n capture = escapeGroup(capture || group || '[^' + (prefix || '\\\\/') + ']+?');\n\n if (repeat) {\n capture = capture + '(?:' + prefix + capture + ')*';\n }\n\n if (optional) {\n return '(?:' + prefix + '(' + capture + '))?';\n }\n\n // Basic parameter support.\n return prefix + '(' + capture + ')';\n }\n\n return path.replace(PATH_REGEXP, replace);\n}\n\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n *\n * @param {(String|RegExp|Array)} path\n * @param {Array} [keys]\n * @param {Object} [options]\n * @return {RegExp}\n */\nfunction pathToRegexp (path, keys, options) {\n keys = keys || [];\n\n if (!isArray(keys)) {\n options = keys;\n keys = [];\n } else if (!options) {\n options = {};\n }\n\n if (path instanceof RegExp) {\n return regexpToRegexp(path, keys, options);\n }\n\n if (isArray(path)) {\n return arrayToRegexp(path, keys, options);\n }\n\n var strict = options.strict;\n var end = options.end !== false;\n var route = replacePath(path, keys);\n var endsWithSlash = path.charAt(path.length - 1) === '/';\n\n // In non-strict mode we allow a slash at the end of match. If the path to\n // match already ends with a slash, we remove it for consistency. The slash\n // is valid at the end of a path match, not in the middle. This is important\n // in non-ending mode, where \"/test/\" shouldn't match \"/test//route\".\n if (!strict) {\n route = (endsWithSlash ? route.slice(0, -2) : route) + '(?:\\\\/(?=$))?';\n }\n\n if (end) {\n route += '$';\n } else {\n // In non-ending mode, we need the capturing groups to match as much as\n // possible by using a positive lookahead to the end or next path segment.\n route += strict && endsWithSlash ? '' : '(?=\\\\/|$)';\n }\n\n return attachKeys(new RegExp('^' + route, flags(options)), keys);\n}\n","module.exports = Array.isArray || function (arr) {\n return Object.prototype.toString.call(arr) == '[object Array]';\n};\n"]}