Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1this.workbox = this.workbox || {};2this.workbox.routing = (function (exports, assert_js, logger_js, WorkboxError_js, getFriendlyURL_js) {3 'use strict';4 5 // @ts-ignore6 try {7 self['workbox:routing:7.4.0'] && _();8 } catch (e) {}9 10 /*11 Copyright 2018 Google LLC12 13 Use of this source code is governed by an MIT-style14 license that can be found in the LICENSE file or at15 https://opensource.org/licenses/MIT.16 */17 /**18 * The default HTTP method, 'GET', used when there's no specific method19 * configured for a route.20 *21 * @type {string}22 *23 * @private24 */25 const defaultMethod = 'GET';26 /**27 * The list of valid HTTP methods associated with requests that could be routed.28 *29 * @type {Array<string>}30 *31 * @private32 */33 const validMethods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];34 35 /*36 Copyright 2018 Google LLC37 38 Use of this source code is governed by an MIT-style39 license that can be found in the LICENSE file or at40 https://opensource.org/licenses/MIT.41 */42 /**43 * @param {function()|Object} handler Either a function, or an object with a44 * 'handle' method.45 * @return {Object} An object with a handle method.46 *47 * @private48 */49 const normalizeHandler = handler => {50 if (handler && typeof handler === 'object') {51 {52 assert_js.assert.hasMethod(handler, 'handle', {53 moduleName: 'workbox-routing',54 className: 'Route',55 funcName: 'constructor',56 paramName: 'handler'57 });58 }59 return handler;60 } else {61 {62 assert_js.assert.isType(handler, 'function', {63 moduleName: 'workbox-routing',64 className: 'Route',65 funcName: 'constructor',66 paramName: 'handler'67 });68 }69 return {70 handle: handler71 };72 }73 };74 75 /*76 Copyright 2018 Google LLC77 78 Use of this source code is governed by an MIT-style79 license that can be found in the LICENSE file or at80 https://opensource.org/licenses/MIT.81 */82 /**83 * A `Route` consists of a pair of callback functions, "match" and "handler".84 * The "match" callback determine if a route should be used to "handle" a85 * request by returning a non-falsy value if it can. The "handler" callback86 * is called when there is a match and should return a Promise that resolves87 * to a `Response`.88 *89 * @memberof workbox-routing90 */91 class Route {92 /**93 * Constructor for Route class.94 *95 * @param {workbox-routing~matchCallback} match96 * A callback function that determines whether the route matches a given97 * `fetch` event by returning a non-falsy value.98 * @param {workbox-routing~handlerCallback} handler A callback99 * function that returns a Promise resolving to a Response.100 * @param {string} [method='GET'] The HTTP method to match the Route101 * against.102 */103 constructor(match, handler, method = defaultMethod) {104 {105 assert_js.assert.isType(match, 'function', {106 moduleName: 'workbox-routing',107 className: 'Route',108 funcName: 'constructor',109 paramName: 'match'110 });111 if (method) {112 assert_js.assert.isOneOf(method, validMethods, {113 paramName: 'method'114 });115 }116 }117 // These values are referenced directly by Router so cannot be118 // altered by minificaton.119 this.handler = normalizeHandler(handler);120 this.match = match;121 this.method = method;122 }123 /**124 *125 * @param {workbox-routing-handlerCallback} handler A callback126 * function that returns a Promise resolving to a Response127 */128 setCatchHandler(handler) {129 this.catchHandler = normalizeHandler(handler);130 }131 }132 133 /*134 Copyright 2018 Google LLC135 136 Use of this source code is governed by an MIT-style137 license that can be found in the LICENSE file or at138 https://opensource.org/licenses/MIT.139 */140 /**141 * NavigationRoute makes it easy to create a142 * {@link workbox-routing.Route} that matches for browser143 * [navigation requests]{@link https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests}.144 *145 * It will only match incoming Requests whose146 * {@link https://fetch.spec.whatwg.org/#concept-request-mode|mode}147 * is set to `navigate`.148 *149 * You can optionally only apply this route to a subset of navigation requests150 * by using one or both of the `denylist` and `allowlist` parameters.151 *152 * @memberof workbox-routing153 * @extends workbox-routing.Route154 */155 class NavigationRoute extends Route {156 /**157 * If both `denylist` and `allowlist` are provided, the `denylist` will158 * take precedence and the request will not match this route.159 *160 * The regular expressions in `allowlist` and `denylist`161 * are matched against the concatenated162 * [`pathname`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/pathname}163 * and [`search`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/search}164 * portions of the requested URL.165 *166 * *Note*: These RegExps may be evaluated against every destination URL during167 * a navigation. Avoid using168 * [complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077),169 * or else your users may see delays when navigating your site.170 *171 * @param {workbox-routing~handlerCallback} handler A callback172 * function that returns a Promise resulting in a Response.173 * @param {Object} options174 * @param {Array<RegExp>} [options.denylist] If any of these patterns match,175 * the route will not handle the request (even if a allowlist RegExp matches).176 * @param {Array<RegExp>} [options.allowlist=[/./]] If any of these patterns177 * match the URL's pathname and search parameter, the route will handle the178 * request (assuming the denylist doesn't match).179 */180 constructor(handler, {181 allowlist = [/./],182 denylist = []183 } = {}) {184 {185 assert_js.assert.isArrayOfClass(allowlist, RegExp, {186 moduleName: 'workbox-routing',187 className: 'NavigationRoute',188 funcName: 'constructor',189 paramName: 'options.allowlist'190 });191 assert_js.assert.isArrayOfClass(denylist, RegExp, {192 moduleName: 'workbox-routing',193 className: 'NavigationRoute',194 funcName: 'constructor',195 paramName: 'options.denylist'196 });197 }198 super(options => this._match(options), handler);199 this._allowlist = allowlist;200 this._denylist = denylist;201 }202 /**203 * Routes match handler.204 *205 * @param {Object} options206 * @param {URL} options.url207 * @param {Request} options.request208 * @return {boolean}209 *210 * @private211 */212 _match({213 url,214 request215 }) {216 if (request && request.mode !== 'navigate') {217 return false;218 }219 const pathnameAndSearch = url.pathname + url.search;220 for (const regExp of this._denylist) {221 if (regExp.test(pathnameAndSearch)) {222 {223 logger_js.logger.log(`The navigation route ${pathnameAndSearch} is not ` + `being used, since the URL matches this denylist pattern: ` + `${regExp.toString()}`);224 }225 return false;226 }227 }228 if (this._allowlist.some(regExp => regExp.test(pathnameAndSearch))) {229 {230 logger_js.logger.debug(`The navigation route ${pathnameAndSearch} ` + `is being used.`);231 }232 return true;233 }234 {235 logger_js.logger.log(`The navigation route ${pathnameAndSearch} is not ` + `being used, since the URL being navigated to doesn't ` + `match the allowlist.`);236 }237 return false;238 }239 }240 241 /*242 Copyright 2018 Google LLC243 244 Use of this source code is governed by an MIT-style245 license that can be found in the LICENSE file or at246 https://opensource.org/licenses/MIT.247 */248 /**249 * RegExpRoute makes it easy to create a regular expression based250 * {@link workbox-routing.Route}.251 *252 * For same-origin requests the RegExp only needs to match part of the URL. For253 * requests against third-party servers, you must define a RegExp that matches254 * the start of the URL.255 *256 * @memberof workbox-routing257 * @extends workbox-routing.Route258 */259 class RegExpRoute extends Route {260 /**261 * If the regular expression contains262 * [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},263 * the captured values will be passed to the264 * {@link workbox-routing~handlerCallback} `params`265 * argument.266 *267 * @param {RegExp} regExp The regular expression to match against URLs.268 * @param {workbox-routing~handlerCallback} handler A callback269 * function that returns a Promise resulting in a Response.270 * @param {string} [method='GET'] The HTTP method to match the Route271 * against.272 */273 constructor(regExp, handler, method) {274 {275 assert_js.assert.isInstance(regExp, RegExp, {276 moduleName: 'workbox-routing',277 className: 'RegExpRoute',278 funcName: 'constructor',279 paramName: 'pattern'280 });281 }282 const match = ({283 url284 }) => {285 const result = regExp.exec(url.href);286 // Return immediately if there's no match.287 if (!result) {288 return;289 }290 // Require that the match start at the first character in the URL string291 // if it's a cross-origin request.292 // See https://github.com/GoogleChrome/workbox/issues/281 for the context293 // behind this behavior.294 if (url.origin !== location.origin && result.index !== 0) {295 {296 logger_js.logger.debug(`The regular expression '${regExp.toString()}' only partially matched ` + `against the cross-origin URL '${url.toString()}'. RegExpRoute's will only ` + `handle cross-origin requests if they match the entire URL.`);297 }298 return;299 }300 // If the route matches, but there aren't any capture groups defined, then301 // this will return [], which is truthy and therefore sufficient to302 // indicate a match.303 // If there are capture groups, then it will return their values.304 return result.slice(1);305 };306 super(match, handler, method);307 }308 }309 310 /*311 Copyright 2018 Google LLC312 313 Use of this source code is governed by an MIT-style314 license that can be found in the LICENSE file or at315 https://opensource.org/licenses/MIT.316 */317 /**318 * The Router can be used to process a `FetchEvent` using one or more319 * {@link workbox-routing.Route}, responding with a `Response` if320 * a matching route exists.321 *322 * If no route matches a given a request, the Router will use a "default"323 * handler if one is defined.324 *325 * Should the matching Route throw an error, the Router will use a "catch"326 * handler if one is defined to gracefully deal with issues and respond with a327 * Request.328 *329 * If a request matches multiple routes, the **earliest** registered route will330 * be used to respond to the request.331 *332 * @memberof workbox-routing333 */334 class Router {335 /**336 * Initializes a new Router.337 */338 constructor() {339 this._routes = new Map();340 this._defaultHandlerMap = new Map();341 }342 /**343 * @return {Map<string, Array<workbox-routing.Route>>} routes A `Map` of HTTP344 * method name ('GET', etc.) to an array of all the corresponding `Route`345 * instances that are registered.346 */347 get routes() {348 return this._routes;349 }350 /**351 * Adds a fetch event listener to respond to events when a route matches352 * the event's request.353 */354 addFetchListener() {355 // See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705356 self.addEventListener('fetch', event => {357 const {358 request359 } = event;360 const responsePromise = this.handleRequest({361 request,362 event363 });364 if (responsePromise) {365 event.respondWith(responsePromise);366 }367 });368 }369 /**370 * Adds a message event listener for URLs to cache from the window.371 * This is useful to cache resources loaded on the page prior to when the372 * service worker started controlling it.373 *374 * The format of the message data sent from the window should be as follows.375 * Where the `urlsToCache` array may consist of URL strings or an array of376 * URL string + `requestInit` object (the same as you'd pass to `fetch()`).377 *378 * ```379 * {380 * type: 'CACHE_URLS',381 * payload: {382 * urlsToCache: [383 * './script1.js',384 * './script2.js',385 * ['./script3.js', {mode: 'no-cors'}],386 * ],387 * },388 * }389 * ```390 */391 addCacheListener() {392 // See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705393 self.addEventListener('message', event => {394 // event.data is type 'any'395 // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access396 if (event.data && event.data.type === 'CACHE_URLS') {397 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment398 const {399 payload400 } = event.data;401 {402 logger_js.logger.debug(`Caching URLs from the window`, payload.urlsToCache);403 }404 const requestPromises = Promise.all(payload.urlsToCache.map(entry => {405 if (typeof entry === 'string') {406 entry = [entry];407 }408 const request = new Request(...entry);409 return this.handleRequest({410 request,411 event412 });413 // TODO(philipwalton): TypeScript errors without this typecast for414 // some reason (probably a bug). The real type here should work but415 // doesn't: `Array<Promise<Response> | undefined>`.416 })); // TypeScript417 event.waitUntil(requestPromises);418 // If a MessageChannel was used, reply to the message on success.419 if (event.ports && event.ports[0]) {420 void requestPromises.then(() => event.ports[0].postMessage(true));421 }422 }423 });424 }425 /**426 * Apply the routing rules to a FetchEvent object to get a Response from an427 * appropriate Route's handler.428 *429 * @param {Object} options430 * @param {Request} options.request The request to handle.431 * @param {ExtendableEvent} options.event The event that triggered the432 * request.433 * @return {Promise<Response>|undefined} A promise is returned if a434 * registered route can handle the request. If there is no matching435 * route and there's no `defaultHandler`, `undefined` is returned.436 */437 handleRequest({438 request,439 event440 }) {441 {442 assert_js.assert.isInstance(request, Request, {443 moduleName: 'workbox-routing',444 className: 'Router',445 funcName: 'handleRequest',446 paramName: 'options.request'447 });448 }449 const url = new URL(request.url, location.href);450 if (!url.protocol.startsWith('http')) {451 {452 logger_js.logger.debug(`Workbox Router only supports URLs that start with 'http'.`);453 }454 return;455 }456 const sameOrigin = url.origin === location.origin;457 const {458 params,459 route460 } = this.findMatchingRoute({461 event,462 request,463 sameOrigin,464 url465 });466 let handler = route && route.handler;467 const debugMessages = [];468 {469 if (handler) {470 debugMessages.push([`Found a route to handle this request:`, route]);471 if (params) {472 debugMessages.push([`Passing the following params to the route's handler:`, params]);473 }474 }475 }476 // If we don't have a handler because there was no matching route, then477 // fall back to defaultHandler if that's defined.478 const method = request.method;479 if (!handler && this._defaultHandlerMap.has(method)) {480 {481 debugMessages.push(`Failed to find a matching route. Falling ` + `back to the default handler for ${method}.`);482 }483 handler = this._defaultHandlerMap.get(method);484 }485 if (!handler) {486 {487 // No handler so Workbox will do nothing. If logs is set of debug488 // i.e. verbose, we should print out this information.489 logger_js.logger.debug(`No route found for: ${getFriendlyURL_js.getFriendlyURL(url)}`);490 }491 return;492 }493 {494 // We have a handler, meaning Workbox is going to handle the route.495 // print the routing details to the console.496 logger_js.logger.groupCollapsed(`Router is responding to: ${getFriendlyURL_js.getFriendlyURL(url)}`);497 debugMessages.forEach(msg => {498 if (Array.isArray(msg)) {499 logger_js.logger.log(...msg);500 } else {501 logger_js.logger.log(msg);502 }503 });504 logger_js.logger.groupEnd();505 }506 // Wrap in try and catch in case the handle method throws a synchronous507 // error. It should still callback to the catch handler.508 let responsePromise;509 try {510 responsePromise = handler.handle({511 url,512 request,513 event,514 params515 });516 } catch (err) {517 responsePromise = Promise.reject(err);518 }519 // Get route's catch handler, if it exists520 const catchHandler = route && route.catchHandler;521 if (responsePromise instanceof Promise && (this._catchHandler || catchHandler)) {522 responsePromise = responsePromise.catch(async err => {523 // If there's a route catch handler, process that first524 if (catchHandler) {525 {526 // Still include URL here as it will be async from the console group527 // and may not make sense without the URL528 logger_js.logger.groupCollapsed(`Error thrown when responding to: ` + ` ${getFriendlyURL_js.getFriendlyURL(url)}. Falling back to route's Catch Handler.`);529 logger_js.logger.error(`Error thrown by:`, route);530 logger_js.logger.error(err);531 logger_js.logger.groupEnd();532 }533 try {534 return await catchHandler.handle({535 url,536 request,537 event,538 params539 });540 } catch (catchErr) {541 if (catchErr instanceof Error) {542 err = catchErr;543 }544 }545 }546 if (this._catchHandler) {547 {548 // Still include URL here as it will be async from the console group549 // and may not make sense without the URL550 logger_js.logger.groupCollapsed(`Error thrown when responding to: ` + ` ${getFriendlyURL_js.getFriendlyURL(url)}. Falling back to global Catch Handler.`);551 logger_js.logger.error(`Error thrown by:`, route);552 logger_js.logger.error(err);553 logger_js.logger.groupEnd();554 }555 return this._catchHandler.handle({556 url,557 request,558 event559 });560 }561 throw err;562 });563 }564 return responsePromise;565 }566 /**567 * Checks a request and URL (and optionally an event) against the list of568 * registered routes, and if there's a match, returns the corresponding569 * route along with any params generated by the match.570 *571 * @param {Object} options572 * @param {URL} options.url573 * @param {boolean} options.sameOrigin The result of comparing `url.origin`574 * against the current origin.575 * @param {Request} options.request The request to match.576 * @param {Event} options.event The corresponding event.577 * @return {Object} An object with `route` and `params` properties.578 * They are populated if a matching route was found or `undefined`579 * otherwise.580 */581 findMatchingRoute({582 url,583 sameOrigin,584 request,585 event586 }) {587 const routes = this._routes.get(request.method) || [];588 for (const route of routes) {589 let params;590 // route.match returns type any, not possible to change right now.591 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment592 const matchResult = route.match({593 url,594 sameOrigin,595 request,596 event597 });598 if (matchResult) {599 {600 // Warn developers that using an async matchCallback is almost always601 // not the right thing to do.602 if (matchResult instanceof Promise) {603 logger_js.logger.warn(`While routing ${getFriendlyURL_js.getFriendlyURL(url)}, an async ` + `matchCallback function was used. Please convert the ` + `following route to use a synchronous matchCallback function:`, route);604 }605 }606 // See https://github.com/GoogleChrome/workbox/issues/2079607 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment608 params = matchResult;609 if (Array.isArray(params) && params.length === 0) {610 // Instead of passing an empty array in as params, use undefined.611 params = undefined;612 } else if (matchResult.constructor === Object &&613 // eslint-disable-line614 Object.keys(matchResult).length === 0) {615 // Instead of passing an empty object in as params, use undefined.616 params = undefined;617 } else if (typeof matchResult === 'boolean') {618 // For the boolean value true (rather than just something truth-y),619 // don't set params.620 // See https://github.com/GoogleChrome/workbox/pull/2134#issuecomment-513924353621 params = undefined;622 }623 // Return early if have a match.624 return {625 route,626 params627 };628 }629 }630 // If no match was found above, return and empty object.631 return {};632 }633 /**634 * Define a default `handler` that's called when no routes explicitly635 * match the incoming request.636 *637 * Each HTTP method ('GET', 'POST', etc.) gets its own default handler.638 *639 * Without a default handler, unmatched requests will go against the640 * network as if there were no service worker present.641 *642 * @param {workbox-routing~handlerCallback} handler A callback643 * function that returns a Promise resulting in a Response.644 * @param {string} [method='GET'] The HTTP method to associate with this645 * default handler. Each method has its own default.646 */647 setDefaultHandler(handler, method = defaultMethod) {648 this._defaultHandlerMap.set(method, normalizeHandler(handler));649 }650 /**651 * If a Route throws an error while handling a request, this `handler`652 * will be called and given a chance to provide a response.653 *654 * @param {workbox-routing~handlerCallback} handler A callback655 * function that returns a Promise resulting in a Response.656 */657 setCatchHandler(handler) {658 this._catchHandler = normalizeHandler(handler);659 }660 /**661 * Registers a route with the router.662 *663 * @param {workbox-routing.Route} route The route to register.664 */665 registerRoute(route) {666 {667 assert_js.assert.isType(route, 'object', {668 moduleName: 'workbox-routing',669 className: 'Router',670 funcName: 'registerRoute',671 paramName: 'route'672 });673 assert_js.assert.hasMethod(route, 'match', {674 moduleName: 'workbox-routing',675 className: 'Router',676 funcName: 'registerRoute',677 paramName: 'route'678 });679 assert_js.assert.isType(route.handler, 'object', {680 moduleName: 'workbox-routing',681 className: 'Router',682 funcName: 'registerRoute',683 paramName: 'route'684 });685 assert_js.assert.hasMethod(route.handler, 'handle', {686 moduleName: 'workbox-routing',687 className: 'Router',688 funcName: 'registerRoute',689 paramName: 'route.handler'690 });691 assert_js.assert.isType(route.method, 'string', {692 moduleName: 'workbox-routing',693 className: 'Router',694 funcName: 'registerRoute',695 paramName: 'route.method'696 });697 }698 if (!this._routes.has(route.method)) {699 this._routes.set(route.method, []);700 }701 // Give precedence to all of the earlier routes by adding this additional702 // route to the end of the array.703 this._routes.get(route.method).push(route);704 }705 /**706 * Unregisters a route with the router.707 *708 * @param {workbox-routing.Route} route The route to unregister.709 */710 unregisterRoute(route) {711 if (!this._routes.has(route.method)) {712 throw new WorkboxError_js.WorkboxError('unregister-route-but-not-found-with-method', {713 method: route.method714 });715 }716 const routeIndex = this._routes.get(route.method).indexOf(route);717 if (routeIndex > -1) {718 this._routes.get(route.method).splice(routeIndex, 1);719 } else {720 throw new WorkboxError_js.WorkboxError('unregister-route-route-not-registered');721 }722 }723 }724 725 /*726 Copyright 2019 Google LLC727 728 Use of this source code is governed by an MIT-style729 license that can be found in the LICENSE file or at730 https://opensource.org/licenses/MIT.731 */732 let defaultRouter;733 /**734 * Creates a new, singleton Router instance if one does not exist. If one735 * does already exist, that instance is returned.736 *737 * @private738 * @return {Router}739 */740 const getOrCreateDefaultRouter = () => {741 if (!defaultRouter) {742 defaultRouter = new Router();743 // The helpers that use the default Router assume these listeners exist.744 defaultRouter.addFetchListener();745 defaultRouter.addCacheListener();746 }747 return defaultRouter;748 };749 750 /*751 Copyright 2019 Google LLC752 753 Use of this source code is governed by an MIT-style754 license that can be found in the LICENSE file or at755 https://opensource.org/licenses/MIT.756 */757 /**758 * Easily register a RegExp, string, or function with a caching759 * strategy to a singleton Router instance.760 *761 * This method will generate a Route for you if needed and762 * call {@link workbox-routing.Router#registerRoute}.763 *764 * @param {RegExp|string|workbox-routing.Route~matchCallback|workbox-routing.Route} capture765 * If the capture param is a `Route`, all other arguments will be ignored.766 * @param {workbox-routing~handlerCallback} [handler] A callback767 * function that returns a Promise resulting in a Response. This parameter768 * is required if `capture` is not a `Route` object.769 * @param {string} [method='GET'] The HTTP method to match the Route770 * against.771 * @return {workbox-routing.Route} The generated `Route`.772 *773 * @memberof workbox-routing774 */775 function registerRoute(capture, handler, method) {776 let route;777 if (typeof capture === 'string') {778 const captureUrl = new URL(capture, location.href);779 {780 if (!(capture.startsWith('/') || capture.startsWith('http'))) {781 throw new WorkboxError_js.WorkboxError('invalid-string', {782 moduleName: 'workbox-routing',783 funcName: 'registerRoute',784 paramName: 'capture'785 });786 }787 // We want to check if Express-style wildcards are in the pathname only.788 // TODO: Remove this log message in v4.789 const valueToCheck = capture.startsWith('http') ? captureUrl.pathname : capture;790 // See https://github.com/pillarjs/path-to-regexp#parameters791 const wildcards = '[*:?+]';792 if (new RegExp(`${wildcards}`).exec(valueToCheck)) {793 logger_js.logger.debug(`The '$capture' parameter contains an Express-style wildcard ` + `character (${wildcards}). Strings are now always interpreted as ` + `exact matches; use a RegExp for partial or wildcard matches.`);794 }795 }796 const matchCallback = ({797 url798 }) => {799 {800 if (url.pathname === captureUrl.pathname && url.origin !== captureUrl.origin) {801 logger_js.logger.debug(`${capture} only partially matches the cross-origin URL ` + `${url.toString()}. This route will only handle cross-origin requests ` + `if they match the entire URL.`);802 }803 }804 return url.href === captureUrl.href;805 };806 // If `capture` is a string then `handler` and `method` must be present.807 route = new Route(matchCallback, handler, method);808 } else if (capture instanceof RegExp) {809 // If `capture` is a `RegExp` then `handler` and `method` must be present.810 route = new RegExpRoute(capture, handler, method);811 } else if (typeof capture === 'function') {812 // If `capture` is a function then `handler` and `method` must be present.813 route = new Route(capture, handler, method);814 } else if (capture instanceof Route) {815 route = capture;816 } else {817 throw new WorkboxError_js.WorkboxError('unsupported-route-type', {818 moduleName: 'workbox-routing',819 funcName: 'registerRoute',820 paramName: 'capture'821 });822 }823 const defaultRouter = getOrCreateDefaultRouter();824 defaultRouter.registerRoute(route);825 return route;826 }827 828 /*829 Copyright 2019 Google LLC830 831 Use of this source code is governed by an MIT-style832 license that can be found in the LICENSE file or at833 https://opensource.org/licenses/MIT.834 */835 /**836 * If a Route throws an error while handling a request, this `handler`837 * will be called and given a chance to provide a response.838 *839 * @param {workbox-routing~handlerCallback} handler A callback840 * function that returns a Promise resulting in a Response.841 *842 * @memberof workbox-routing843 */844 function setCatchHandler(handler) {845 const defaultRouter = getOrCreateDefaultRouter();846 defaultRouter.setCatchHandler(handler);847 }848 849 /*850 Copyright 2019 Google LLC851 852 Use of this source code is governed by an MIT-style853 license that can be found in the LICENSE file or at854 https://opensource.org/licenses/MIT.855 */856 /**857 * Define a default `handler` that's called when no routes explicitly858 * match the incoming request.859 *860 * Without a default handler, unmatched requests will go against the861 * network as if there were no service worker present.862 *863 * @param {workbox-routing~handlerCallback} handler A callback864 * function that returns a Promise resulting in a Response.865 *866 * @memberof workbox-routing867 */868 function setDefaultHandler(handler) {869 const defaultRouter = getOrCreateDefaultRouter();870 defaultRouter.setDefaultHandler(handler);871 }872 873 exports.NavigationRoute = NavigationRoute;874 exports.RegExpRoute = RegExpRoute;875 exports.Route = Route;876 exports.Router = Router;877 exports.registerRoute = registerRoute;878 exports.setCatchHandler = setCatchHandler;879 exports.setDefaultHandler = setDefaultHandler;880 881 return exports;882 883})({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private);884//# sourceMappingURL=workbox-routing.dev.js.map885 