PageSourceSearch

https://axis-fe.up.railway.app/node_modules/.vite/deps/chunk-6QRBSAIV.js?v=bf763330

js axis-fe.up.railway.app collected 2026-10-03 12:13:39 UTC 263,105 bytes, 7,610 lines download raw bytes

1import __buffer_polyfill from "/node_modules/.vite/deps/vite-plugin-node-polyfills_shims_buffer.js?v=bf763330"
2globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
3import __global_polyfill from "/node_modules/.vite/deps/vite-plugin-node-polyfills_shims_global.js?v=bf763330"
4globalThis.global = globalThis.global || __global_polyfill
5import __process_polyfill from "/node_modules/.vite/deps/vite-plugin-node-polyfills_shims_process.js?v=bf763330"
6globalThis.process = globalThis.process || __process_polyfill
7
8import {
9  __commonJS,
10  __esm,
11  __export,
12  __publicField,
13  __toESM,
14  require_dist,
15  require_dist2,
16  require_dist3
17} from "/node_modules/.vite/deps/chunk-CURNFZRR.js?v=bf763330";
18
vendor: 140,176 bytes, lines 19-4005
19// node_modules/.pnpm/@[email protected]/node_modules/@remix-run/router/dist/router.js
20function _extends() {
21  _extends = Object.assign ? Object.assign.bind() : function(target) {
22    for (var i = 1; i < arguments.length; i++) {
23      var source = arguments[i];
24      for (var key in source) {
25        if (Object.prototype.hasOwnProperty.call(source, key)) {
26          target[key] = source[key];
27        }
28      }
29    }
30    return target;
31  };
32  return _extends.apply(this, arguments);
33}
34function createBrowserHistory(options) {
35  if (options === void 0) {
36    options = {};
37  }
38  function createBrowserLocation(window2, globalHistory) {
39    let {
40      pathname,
41      search,
42      hash
43    } = window2.location;
44    return createLocation(
45      "",
46      {
47        pathname,
48        search,
49        hash
50      },
51      // state defaults to `null` because `window.history.state` does
52      globalHistory.state && globalHistory.state.usr || null,
53      globalHistory.state && globalHistory.state.key || "default"
54    );
55  }
56  function createBrowserHref(window2, to) {
57    return typeof to === "string" ? to : createPath(to);
58  }
59  return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);
60}
61function invariant(value, message) {
62  if (value === false || value === null || typeof value === "undefined") {
63    throw new Error(message);
64  }
65}
66function warning(cond, message) {
67  if (!cond) {
68    if (typeof console !== "undefined") console.warn(message);
69    try {
70      throw new Error(message);
71    } catch (e) {
72    }
73  }
74}
75function createKey() {
76  return Math.random().toString(36).substr(2, 8);
77}
78function getHistoryState(location, index) {
79  return {
80    usr: location.state,
81    key: location.key,
82    idx: index
83  };
84}
85function createLocation(current, to, state, key) {
86  if (state === void 0) {
87    state = null;
88  }
89  let location = _extends({
90    pathname: typeof current === "string" ? current : current.pathname,
91    search: "",
92    hash: ""
93  }, typeof to === "string" ? parsePath(to) : to, {
94    state,
95    // TODO: This could be cleaned up.  push/replace should probably just take
96    // full Locations now and avoid the need to run through this flow at all
97    // But that's a pretty big refactor to the current test suite so going to
98    // keep as is for the time being and just let any incoming keys take precedence
99    key: to && to.key || key || createKey()
100  });
101  return location;
102}
103function createPath(_ref) {
104  let {
105    pathname = "/",
106    search = "",
107    hash = ""
108  } = _ref;
109  if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
110  if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
111  return pathname;
112}
113function parsePath(path) {
114  let parsedPath = {};
115  if (path) {
116    let hashIndex = path.indexOf("#");
117    if (hashIndex >= 0) {
118      parsedPath.hash = path.substr(hashIndex);
119      path = path.substr(0, hashIndex);
120    }
121    let searchIndex = path.indexOf("?");
122    if (searchIndex >= 0) {
123      parsedPath.search = path.substr(searchIndex);
124      path = path.substr(0, searchIndex);
125    }
126    if (path) {
127      parsedPath.pathname = path;
128    }
129  }
130  return parsedPath;
131}
132function getUrlBasedHistory(getLocation, createHref, validateLocation, options) {
133  if (options === void 0) {
134    options = {};
135  }
136  let {
137    window: window2 = document.defaultView,
138    v5Compat = false
139  } = options;
140  let globalHistory = window2.history;
141  let action = Action.Pop;
142  let listener = null;
143  let index = getIndex();
144  if (index == null) {
145    index = 0;
146    globalHistory.replaceState(_extends({}, globalHistory.state, {
147      idx: index
148    }), "");
149  }
150  function getIndex() {
151    let state = globalHistory.state || {
152      idx: null
153    };
154    return state.idx;
155  }
156  function handlePop() {
157    action = Action.Pop;
158    let nextIndex = getIndex();
159    let delta = nextIndex == null ? null : nextIndex - index;
160    index = nextIndex;
161    if (listener) {
162      listener({
163        action,
164        location: history.location,
165        delta
166      });
167    }
168  }
169  function push(to, state) {
170    action = Action.Push;
171    let location = createLocation(history.location, to, state);
172    if (validateLocation) validateLocation(location, to);
173    index = getIndex() + 1;
174    let historyState = getHistoryState(location, index);
175    let url = history.createHref(location);
176    try {
177      globalHistory.pushState(historyState, "", url);
178    } catch (error) {
179      if (error instanceof DOMException && error.name === "DataCloneError") {
180        throw error;
181      }
182      window2.location.assign(url);
183    }
184    if (v5Compat && listener) {
185      listener({
186        action,
187        location: history.location,
188        delta: 1
189      });
190    }
191  }
192  function replace3(to, state) {
193    action = Action.Replace;
194    let location = createLocation(history.location, to, state);
195    if (validateLocation) validateLocation(location, to);
196    index = getIndex();
197    let historyState = getHistoryState(location, index);
198    let url = history.createHref(location);
199    globalHistory.replaceState(historyState, "", url);
200    if (v5Compat && listener) {
201      listener({
202        action,
203        location: history.location,
204        delta: 0
205      });
206    }
207  }
208  function createURL(to) {
209    let base = window2.location.origin !== "null" ? window2.location.origin : window2.location.href;
210    let href = typeof to === "string" ? to : createPath(to);
211    href = href.replace(/ $/, "%20");
212    invariant(base, "No window.location.(origin|href) available to create URL for href: " + href);
213    return new URL(href, base);
214  }
215  let history = {
216    get action() {
217      return action;
218    },
219    get location() {
220      return getLocation(window2, globalHistory);
221    },
222    listen(fn) {
223      if (listener) {
224        throw new Error("A history only accepts one active listener");
225      }
226      window2.addEventListener(PopStateEventType, handlePop);
227      listener = fn;
228      return () => {
229        window2.removeEventListener(PopStateEventType, handlePop);
230        listener = null;
231      };
232    },
233    createHref(to) {
234      return createHref(window2, to);
235    },
236    createURL,
237    encodeLocation(to) {
238      let url = createURL(to);
239      return {
240        pathname: url.pathname,
241        search: url.search,
242        hash: url.hash
243      };
244    },
245    push,
246    replace: replace3,
247    go(n) {
248      return globalHistory.go(n);
249    }
250  };
251  return history;
252}
253function isIndexRoute(route) {
254  return route.index === true;
255}
256function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) {
257  if (parentPath === void 0) {
258    parentPath = [];
259  }
260  if (manifest === void 0) {
261    manifest = {};
262  }
263  return routes.map((route, index) => {
264    let treePath = [...parentPath, String(index)];
265    let id = typeof route.id === "string" ? route.id : treePath.join("-");
266    invariant(route.index !== true || !route.children, "Cannot specify children on an index route");
267    invariant(!manifest[id], 'Found a route id collision on id "' + id + `".  Route id's must be globally unique within Data Router usages`);
268    if (isIndexRoute(route)) {
269      let indexRoute = _extends({}, route, mapRouteProperties(route), {
270        id
271      });
272      manifest[id] = indexRoute;
273      return indexRoute;
274    } else {
275      let pathOrLayoutRoute = _extends({}, route, mapRouteProperties(route), {
276        id,
277        children: void 0
278      });
279      manifest[id] = pathOrLayoutRoute;
280      if (route.children) {
281        pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest);
282      }
283      return pathOrLayoutRoute;
284    }
285  });
286}
287function matchRoutes(routes, locationArg, basename) {
288  if (basename === void 0) {
289    basename = "/";
290  }
291  return matchRoutesImpl(routes, locationArg, basename, false);
292}
293function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
294  let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
295  let pathname = stripBasename(location.pathname || "/", basename);
296  if (pathname == null) {
297    return null;
298  }
299  let branches = flattenRoutes(routes);
300  rankRouteBranches(branches);
301  let matches = null;
302  for (let i = 0; matches == null && i < branches.length; ++i) {
303    let decoded = decodePath(pathname);
304    matches = matchRouteBranch(branches[i], decoded, allowPartial);
305  }
306  return matches;
307}
308function convertRouteMatchToUiMatch(match, loaderData) {
309  let {
310    route,
311    pathname,
312    params
313  } = match;
314  return {
315    id: route.id,
316    pathname,
317    params,
318    data: loaderData[route.id],
319    handle: route.handle
320  };
321}
322function flattenRoutes(routes, branches, parentsMeta, parentPath) {
323  if (branches === void 0) {
324    branches = [];
325  }
326  if (parentsMeta === void 0) {
327    parentsMeta = [];
328  }
329  if (parentPath === void 0) {
330    parentPath = "";
331  }
332  let flattenRoute = (route, index, relativePath) => {
333    let meta = {
334      relativePath: relativePath === void 0 ? route.path || "" : relativePath,
335      caseSensitive: route.caseSensitive === true,
336      childrenIndex: index,
337      route
338    };
339    if (meta.relativePath.startsWith("/")) {
340      invariant(meta.relativePath.startsWith(parentPath), 'Absolute route path "' + meta.relativePath + '" nested under path ' + ('"' + parentPath + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes.");
341      meta.relativePath = meta.relativePath.slice(parentPath.length);
342    }
343    let path = joinPaths([parentPath, meta.relativePath]);
344    let routesMeta = parentsMeta.concat(meta);
345    if (route.children && route.children.length > 0) {
346      invariant(
347        // Our types know better, but runtime JS may not!
348        // @ts-expect-error
349        route.index !== true,
350        "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + path + '".')
351      );
352      flattenRoutes(route.children, branches, routesMeta, path);
353    }
354    if (route.path == null && !route.index) {
355      return;
356    }
357    branches.push({
358      path,
359      score: computeScore(path, route.index),
360      routesMeta
361    });
362  };
363  routes.forEach((route, index) => {
364    var _route$path;
365    if (route.path === "" || !((_route$path = route.path) != null && _route$path.includes("?"))) {
366      flattenRoute(route, index);
367    } else {
368      for (let exploded of explodeOptionalSegments(route.path)) {
369        flattenRoute(route, index, exploded);
370      }
371    }
372  });
373  return branches;
374}
375function explodeOptionalSegments(path) {
376  let segments = path.split("/");
377  if (segments.length === 0) return [];
378  let [first, ...rest] = segments;
379  let isOptional = first.endsWith("?");
380  let required = first.replace(/\?$/, "");
381  if (rest.length === 0) {
382    return isOptional ? [required, ""] : [required];
383  }
384  let restExploded = explodeOptionalSegments(rest.join("/"));
385  let result = [];
386  result.push(...restExploded.map((subpath) => subpath === "" ? required : [required, subpath].join("/")));
387  if (isOptional) {
388    result.push(...restExploded);
389  }
390  return result.map((exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded);
391}
392function rankRouteBranches(branches) {
393  branches.sort((a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(a.routesMeta.map((meta) => meta.childrenIndex), b.routesMeta.map((meta) => meta.childrenIndex)));
394}
395function computeScore(path, index) {
396  let segments = path.split("/");
397  let initialScore = segments.length;
398  if (segments.some(isSplat)) {
399    initialScore += splatPenalty;
400  }
401  if (index) {
402    initialScore += indexRouteValue;
403  }
404  return segments.filter((s) => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore);
405}
406function compareIndexes(a, b) {
407  let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
408  return siblings ? (
409    // If two routes are siblings, we should try to match the earlier sibling
410    // first. This allows people to have fine-grained control over the matching
411    // behavior by simply putting routes with identical paths in the order they
412    // want them tried.
413    a[a.length - 1] - b[b.length - 1]
414  ) : (
415    // Otherwise, it doesn't really make sense to rank non-siblings by index,
416    // so they sort equally.
417    0
418  );
419}
420function matchRouteBranch(branch, pathname, allowPartial) {
421  if (allowPartial === void 0) {
422    allowPartial = false;
423  }
424  let {
425    routesMeta
426  } = branch;
427  let matchedParams = {};
428  let matchedPathname = "/";
429  let matches = [];
430  for (let i = 0; i < routesMeta.length; ++i) {
431    let meta = routesMeta[i];
432    let end = i === routesMeta.length - 1;
433    let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
434    let match = matchPath({
435      path: meta.relativePath,
436      caseSensitive: meta.caseSensitive,
437      end
438    }, remainingPathname);
439    let route = meta.route;
440    if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
441      match = matchPath({
442        path: meta.relativePath,
443        caseSensitive: meta.caseSensitive,
444        end: false
445      }, remainingPathname);
446    }
447    if (!match) {
448      return null;
449    }
450    Object.assign(matchedParams, match.params);
451    matches.push({
452      // TODO: Can this as be avoided?
453      params: matchedParams,
454      pathname: joinPaths([matchedPathname, match.pathname]),
455      pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),
456      route
457    });
458    if (match.pathnameBase !== "/") {
459      matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
460    }
461  }
462  return matches;
463}
464function generatePath(originalPath, params) {
465  if (params === void 0) {
466    params = {};
467  }
468  let path = originalPath;
469  if (path.endsWith("*") && path !== "*" && !path.endsWith("/*")) {
470    warning(false, 'Route path "' + path + '" will be treated as if it were ' + ('"' + path.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path.replace(/\*$/, "/*") + '".'));
471    path = path.replace(/\*$/, "/*");
472  }
473  const prefix = path.startsWith("/") ? "/" : "";
474  const stringify2 = (p) => p == null ? "" : typeof p === "string" ? p : String(p);
475  const segments = path.split(/\/+/).map((segment, index, array) => {
476    const isLastSegment = index === array.length - 1;
477    if (isLastSegment && segment === "*") {
478      const star = "*";
479      return stringify2(params[star]);
480    }
481    const keyMatch = segment.match(/^:([\w-]+)(\??)$/);
482    if (keyMatch) {
483      const [, key, optional] = keyMatch;
484      let param = params[key];
485      invariant(optional === "?" || param != null, 'Missing ":' + key + '" param');
486      return stringify2(param);
487    }
488    return segment.replace(/\?$/g, "");
489  }).filter((segment) => !!segment);
490  return prefix + segments.join("/");
491}
492function matchPath(pattern, pathname) {
493  if (typeof pattern === "string") {
494    pattern = {
495      path: pattern,
496      caseSensitive: false,
497      end: true
498    };
499  }
500  let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);
501  let match = pathname.match(matcher);
502  if (!match) return null;
503  let matchedPathname = match[0];
504  let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
505  let captureGroups = match.slice(1);
506  let params = compiledParams.reduce((memo, _ref, index) => {
507    let {
508      paramName,
509      isOptional
510    } = _ref;
511    if (paramName === "*") {
512      let splatValue = captureGroups[index] || "";
513      pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
514    }
515    const value = captureGroups[index];
516    if (isOptional && !value) {
517      memo[paramName] = void 0;
518    } else {
519      memo[paramName] = (value || "").replace(/%2F/g, "/");
520    }
521    return memo;
522  }, {});
523  return {
524    params,
525    pathname: matchedPathname,
526    pathnameBase,
527    pattern
528  };
529}
530function compilePath(path, caseSensitive, end) {
531  if (caseSensitive === void 0) {
532    caseSensitive = false;
533  }
534  if (end === void 0) {
535    end = true;
536  }
537  warning(path === "*" || !path.endsWith("*") || path.endsWith("/*"), 'Route path "' + path + '" will be treated as if it were ' + ('"' + path.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path.replace(/\*$/, "/*") + '".'));
538  let params = [];
539  let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (_, paramName, isOptional) => {
540    params.push({
541      paramName,
542      isOptional: isOptional != null
543    });
544    return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
545  });
546  if (path.endsWith("*")) {
547    params.push({
548      paramName: "*"
549    });
550    regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
551  } else if (end) {
552    regexpSource += "\\/*$";
553  } else if (path !== "" && path !== "/") {
554    regexpSource += "(?:(?=\\/|$))";
555  } else ;
556  let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
557  return [matcher, params];
558}
559function decodePath(value) {
560  try {
561    return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
562  } catch (error) {
563    warning(false, 'The URL path "' + value + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + error + ")."));
564    return value;
565  }
566}
567function stripBasename(pathname, basename) {
568  if (basename === "/") return pathname;
569  if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
570    return null;
571  }
572  let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
573  let nextChar = pathname.charAt(startIndex);
574  if (nextChar && nextChar !== "/") {
575    return null;
576  }
577  return pathname.slice(startIndex) || "/";
578}
579function resolvePath(to, fromPathname) {
580  if (fromPathname === void 0) {
581    fromPathname = "/";
582  }
583  let {
584    pathname: toPathname,
585    search = "",
586    hash = ""
587  } = typeof to === "string" ? parsePath(to) : to;
588  let pathname;
589  if (toPathname) {
590    if (isAbsoluteUrl(toPathname)) {
591      pathname = toPathname;
592    } else {
593      if (toPathname.includes("//")) {
594        let oldPathname = toPathname;
595        toPathname = toPathname.replace(/\/\/+/g, "/");
596        warning(false, "Pathnames cannot have embedded double slashes - normalizing " + (oldPathname + " -> " + toPathname));
597      }
598      if (toPathname.startsWith("/")) {
599        pathname = resolvePathname(toPathname.substring(1), "/");
600      } else {
601        pathname = resolvePathname(toPathname, fromPathname);
602      }
603    }
604  } else {
605    pathname = fromPathname;
606  }
607  return {
608    pathname,
609    search: normalizeSearch(search),
610    hash: normalizeHash(hash)
611  };
612}
613function resolvePathname(relativePath, fromPathname) {
614  let segments = fromPathname.replace(/\/+$/, "").split("/");
615  let relativeSegments = relativePath.split("/");
616  relativeSegments.forEach((segment) => {
617    if (segment === "..") {
618      if (segments.length > 1) segments.pop();
619    } else if (segment !== ".") {
620      segments.push(segment);
621    }
622  });
623  return segments.length > 1 ? segments.join("/") : "/";
624}
625function getInvalidPathError(char, field, dest, path) {
626  return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "].  Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
627}
628function getPathContributingMatches(matches) {
629  return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);
630}
631function getResolveToMatches(matches, v7_relativeSplatPath) {
632  let pathMatches = getPathContributingMatches(matches);
633  if (v7_relativeSplatPath) {
634    return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);
635  }
636  return pathMatches.map((match) => match.pathnameBase);
637}
638function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {
639  if (isPathRelative === void 0) {
640    isPathRelative = false;
641  }
642  let to;
643  if (typeof toArg === "string") {
644    to = parsePath(toArg);
645  } else {
646    to = _extends({}, toArg);
647    invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to));
648    invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to));
649    invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to));
650  }
651  let isEmptyPath = toArg === "" || to.pathname === "";
652  let toPathname = isEmptyPath ? "/" : to.pathname;
653  let from;
654  if (toPathname == null) {
655    from = locationPathname;
656  } else {
657    let routePathnameIndex = routePathnames.length - 1;
658    if (!isPathRelative && toPathname.startsWith("..")) {
659      let toSegments = toPathname.split("/");
660      while (toSegments[0] === "..") {
661        toSegments.shift();
662        routePathnameIndex -= 1;
663      }
664      to.pathname = toSegments.join("/");
665    }
666    from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
667  }
668  let path = resolvePath(to, from);
669  let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
670  let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
671  if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
672    path.pathname += "/";
673  }
674  return path;
675}
676function data(data3, init) {
677  return new DataWithResponseInit(data3, typeof init === "number" ? {
678    status: init
679  } : init);
680}
681function isTrackedPromise(value) {
682  return value instanceof Promise && value._tracked === true;
683}
684function unwrapTrackedPromise(value) {
685  if (!isTrackedPromise(value)) {
686    return value;
687  }
688  if (value._error) {
689    throw value._error;
690  }
691  return value._data;
692}
693function isRouteErrorResponse(error) {
694  return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
695}
696function createRouter(init) {
697  const routerWindow = init.window ? init.window : typeof window !== "undefined" ? window : void 0;
698  const isBrowser = typeof routerWindow !== "undefined" && typeof routerWindow.document !== "undefined" && typeof routerWindow.document.createElement !== "undefined";
699  const isServer = !isBrowser;
700  invariant(init.routes.length > 0, "You must provide a non-empty routes array to createRouter");
701  let mapRouteProperties;
702  if (init.mapRouteProperties) {
703    mapRouteProperties = init.mapRouteProperties;
704  } else if (init.detectErrorBoundary) {
705    let detectErrorBoundary = init.detectErrorBoundary;
706    mapRouteProperties = (route) => ({
707      hasErrorBoundary: detectErrorBoundary(route)
708    });
709  } else {
710    mapRouteProperties = defaultMapRouteProperties;
711  }
712  let manifest = {};
713  let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, void 0, manifest);
714  let inFlightDataRoutes;
715  let basename = init.basename || "/";
716  let dataStrategyImpl = init.dataStrategy || defaultDataStrategy;
717  let patchRoutesOnNavigationImpl = init.patchRoutesOnNavigation;
718  let future = _extends({
719    v7_fetcherPersist: false,
720    v7_normalizeFormMethod: false,
721    v7_partialHydration: false,
722    v7_prependBasename: false,
723    v7_relativeSplatPath: false,
724    v7_skipActionErrorRevalidation: false
725  }, init.future);
726  let unlistenHistory = null;
727  let subscribers = /* @__PURE__ */ new Set();
728  let savedScrollPositions = null;
729  let getScrollRestorationKey = null;
730  let getScrollPosition = null;
731  let initialScrollRestored = init.hydrationData != null;
732  let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);
733  let initialMatchesIsFOW = false;
734  let initialErrors = null;
735  if (initialMatches == null && !patchRoutesOnNavigationImpl) {
736    let error = getInternalRouterError(404, {
737      pathname: init.history.location.pathname
738    });
739    let {
740      matches,
741      route
742    } = getShortCircuitMatches(dataRoutes);
743    initialMatches = matches;
744    initialErrors = {
745      [route.id]: error
746    };
747  }
748  if (initialMatches && !init.hydrationData) {
749    let fogOfWar = checkFogOfWar(initialMatches, dataRoutes, init.history.location.pathname);
750    if (fogOfWar.active) {
751      initialMatches = null;
752    }
753  }
754  let initialized;
755  if (!initialMatches) {
756    initialized = false;
757    initialMatches = [];
758    if (future.v7_partialHydration) {
759      let fogOfWar = checkFogOfWar(null, dataRoutes, init.history.location.pathname);
760      if (fogOfWar.active && fogOfWar.matches) {
761        initialMatchesIsFOW = true;
762        initialMatches = fogOfWar.matches;
763      }
764    }
765  } else if (initialMatches.some((m) => m.route.lazy)) {
766    initialized = false;
767  } else if (!initialMatches.some((m) => m.route.loader)) {
768    initialized = true;
769  } else if (future.v7_partialHydration) {
770    let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
771    let errors = init.hydrationData ? init.hydrationData.errors : null;
772    if (errors) {
773      let idx = initialMatches.findIndex((m) => errors[m.route.id] !== void 0);
774      initialized = initialMatches.slice(0, idx + 1).every((m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors));
775    } else {
776      initialized = initialMatches.every((m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors));
777    }
778  } else {
779    initialized = init.hydrationData != null;
780  }
781  let router;
782  let state = {
783    historyAction: init.history.action,
784    location: init.history.location,
785    matches: initialMatches,
786    initialized,
787    navigation: IDLE_NAVIGATION,
788    // Don't restore on initial updateState() if we were SSR'd
789    restoreScrollPosition: init.hydrationData != null ? false : null,
790    preventScrollReset: false,
791    revalidation: "idle",
792    loaderData: init.hydrationData && init.hydrationData.loaderData || {},
793    actionData: init.hydrationData && init.hydrationData.actionData || null,
794    errors: init.hydrationData && init.hydrationData.errors || initialErrors,
795    fetchers: /* @__PURE__ */ new Map(),
796    blockers: /* @__PURE__ */ new Map()
797  };
798  let pendingAction = Action.Pop;
799  let pendingPreventScrollReset = false;
800  let pendingNavigationController;
801  let pendingViewTransitionEnabled = false;
802  let appliedViewTransitions = /* @__PURE__ */ new Map();
803  let removePageHideEventListener = null;
804  let isUninterruptedRevalidation = false;
805  let isRevalidationRequired = false;
806  let cancelledDeferredRoutes = [];
807  let cancelledFetcherLoads = /* @__PURE__ */ new Set();
808  let fetchControllers = /* @__PURE__ */ new Map();
809  let incrementingLoadId = 0;
810  let pendingNavigationLoadId = -1;
811  let fetchReloadIds = /* @__PURE__ */ new Map();
812  let fetchRedirectIds = /* @__PURE__ */ new Set();
813  let fetchLoadMatches = /* @__PURE__ */ new Map();
814  let activeFetchers = /* @__PURE__ */ new Map();
815  let deletedFetchers = /* @__PURE__ */ new Set();
816  let activeDeferreds = /* @__PURE__ */ new Map();
817  let blockerFunctions = /* @__PURE__ */ new Map();
818  let unblockBlockerHistoryUpdate = void 0;
819  function initialize() {
820    unlistenHistory = init.history.listen((_ref) => {
821      let {
822        action: historyAction,
823        location,
824        delta
825      } = _ref;
826      if (unblockBlockerHistoryUpdate) {
827        unblockBlockerHistoryUpdate();
828        unblockBlockerHistoryUpdate = void 0;
829        return;
830      }
831      warning(blockerFunctions.size === 0 || delta != null, "You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs.  This can also happen if you are using createHashRouter and the user manually changes the URL.");
832      let blockerKey = shouldBlockNavigation({
833        currentLocation: state.location,
834        nextLocation: location,
835        historyAction
836      });
837      if (blockerKey && delta != null) {
838        let nextHistoryUpdatePromise = new Promise((resolve) => {
839          unblockBlockerHistoryUpdate = resolve;
840        });
841        init.history.go(delta * -1);
842        updateBlocker(blockerKey, {
843          state: "blocked",
844          location,
845          proceed() {
846            updateBlocker(blockerKey, {
847              state: "proceeding",
848              proceed: void 0,
849              reset: void 0,
850              location
851            });
852            nextHistoryUpdatePromise.then(() => init.history.go(delta));
853          },
854          reset() {
855            let blockers = new Map(state.blockers);
856            blockers.set(blockerKey, IDLE_BLOCKER);
857            updateState({
858              blockers
859            });
860          }
861        });
862        return;
863      }
864      return startNavigation(historyAction, location);
865    });
866    if (isBrowser) {
867      restoreAppliedTransitions(routerWindow, appliedViewTransitions);
868      let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);
869      routerWindow.addEventListener("pagehide", _saveAppliedTransitions);
870      removePageHideEventListener = () => routerWindow.removeEventListener("pagehide", _saveAppliedTransitions);
871    }
872    if (!state.initialized) {
873      startNavigation(Action.Pop, state.location, {
874        initialHydration: true
875      });
876    }
877    return router;
878  }
879  function dispose() {
880    if (unlistenHistory) {
881      unlistenHistory();
882    }
883    if (removePageHideEventListener) {
884      removePageHideEventListener();
885    }
886    subscribers.clear();
887    pendingNavigationController && pendingNavigationController.abort();
888    state.fetchers.forEach((_, key) => deleteFetcher(key));
889    state.blockers.forEach((_, key) => deleteBlocker(key));
890  }
891  function subscribe(fn) {
892    subscribers.add(fn);
893    return () => subscribers.delete(fn);
894  }
895  function updateState(newState, opts) {
896    if (opts === void 0) {
897      opts = {};
898    }
899    state = _extends({}, state, newState);
900    let completedFetchers = [];
901    let deletedFetchersKeys = [];
902    if (future.v7_fetcherPersist) {
903      state.fetchers.forEach((fetcher, key) => {
904        if (fetcher.state === "idle") {
905          if (deletedFetchers.has(key)) {
906            deletedFetchersKeys.push(key);
907          } else {
908            completedFetchers.push(key);
909          }
910        }
911      });
912    }
913    deletedFetchers.forEach((key) => {
914      if (!state.fetchers.has(key) && !fetchControllers.has(key)) {
915        deletedFetchersKeys.push(key);
916      }
917    });
918    [...subscribers].forEach((subscriber) => subscriber(state, {
919      deletedFetchers: deletedFetchersKeys,
920      viewTransitionOpts: opts.viewTransitionOpts,
921      flushSync: opts.flushSync === true
922    }));
923    if (future.v7_fetcherPersist) {
924      completedFetchers.forEach((key) => state.fetchers.delete(key));
925      deletedFetchersKeys.forEach((key) => deleteFetcher(key));
926    } else {
927      deletedFetchersKeys.forEach((key) => deletedFetchers.delete(key));
928    }
929  }
930  function completeNavigation(location, newState, _temp) {
931    var _location$state, _location$state2;
932    let {
933      flushSync
934    } = _temp === void 0 ? {} : _temp;
935    let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === "loading" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true;
936    let actionData;
937    if (newState.actionData) {
938      if (Object.keys(newState.actionData).length > 0) {
939        actionData = newState.actionData;
940      } else {
941        actionData = null;
942      }
943    } else if (isActionReload) {
944      actionData = state.actionData;
945    } else {
946      actionData = null;
947    }
948    let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;
949    let blockers = state.blockers;
950    if (blockers.size > 0) {
951      blockers = new Map(blockers);
952      blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));
953    }
954    let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true;
955    if (inFlightDataRoutes) {
956      dataRoutes = inFlightDataRoutes;
957      inFlightDataRoutes = void 0;
958    }
959    if (isUninterruptedRevalidation) ;
960    else if (pendingAction === Action.Pop) ;
961    else if (pendingAction === Action.Push) {
962      init.history.push(location, location.state);
963    } else if (pendingAction === Action.Replace) {
964      init.history.replace(location, location.state);
965    }
966    let viewTransitionOpts;
967    if (pendingAction === Action.Pop) {
968      let priorPaths = appliedViewTransitions.get(state.location.pathname);
969      if (priorPaths && priorPaths.has(location.pathname)) {
970        viewTransitionOpts = {
971          currentLocation: state.location,
972          nextLocation: location
973        };
974      } else if (appliedViewTransitions.has(location.pathname)) {
975        viewTransitionOpts = {
976          currentLocation: location,
977          nextLocation: state.location
978        };
979      }
980    } else if (pendingViewTransitionEnabled) {
981      let toPaths = appliedViewTransitions.get(state.location.pathname);
982      if (toPaths) {
983        toPaths.add(location.pathname);
984      } else {
985        toPaths = /* @__PURE__ */ new Set([location.pathname]);
986        appliedViewTransitions.set(state.location.pathname, toPaths);
987      }
988      viewTransitionOpts = {
989        currentLocation: state.location,
990        nextLocation: location
991      };
992    }
993    updateState(_extends({}, newState, {
994      actionData,
995      loaderData,
996      historyAction: pendingAction,
997      location,
998      initialized: true,
999      navigation: IDLE_NAVIGATION,
1000      revalidation: "idle",
1001      restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches),
1002      preventScrollReset,
1003      blockers
1004    }), {
1005      viewTransitionOpts,
1006      flushSync: flushSync === true
1007    });
1008    pendingAction = Action.Pop;
1009    pendingPreventScrollReset = false;
1010    pendingViewTransitionEnabled = false;
1011    isUninterruptedRevalidation = false;
1012    isRevalidationRequired = false;
1013    cancelledDeferredRoutes = [];
1014  }
1015  async function navigate(to, opts) {
1016    if (typeof to === "number") {
1017      init.history.go(to);
1018      return;
1019    }
1020    let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, future.v7_relativeSplatPath, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative);
1021    let {
1022      path,
1023      submission,
1024      error
1025    } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts);
1026    let currentLocation = state.location;
1027    let nextLocation = createLocation(state.location, path, opts && opts.state);
1028    nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation));
1029    let userReplace = opts && opts.replace != null ? opts.replace : void 0;
1030    let historyAction = Action.Push;
1031    if (userReplace === true) {
1032      historyAction = Action.Replace;
1033    } else if (userReplace === false) ;
1034    else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) {
1035      historyAction = Action.Replace;
1036    }
1037    let preventScrollReset = opts && "preventScrollReset" in opts ? opts.preventScrollReset === true : void 0;
1038    let flushSync = (opts && opts.flushSync) === true;
1039    let blockerKey = shouldBlockNavigation({
1040      currentLocation,
1041      nextLocation,
1042      historyAction
1043    });
1044    if (blockerKey) {
1045      updateBlocker(blockerKey, {
1046        state: "blocked",
1047        location: nextLocation,
1048        proceed() {
1049          updateBlocker(blockerKey, {
1050            state: "proceeding",
1051            proceed: void 0,
1052            reset: void 0,
1053            location: nextLocation
1054          });
1055          navigate(to, opts);
1056        },
1057        reset() {
1058          let blockers = new Map(state.blockers);
1059          blockers.set(blockerKey, IDLE_BLOCKER);
1060          updateState({
1061            blockers
1062          });
1063        }
1064      });
1065      return;
1066    }
1067    return await startNavigation(historyAction, nextLocation, {
1068      submission,
1069      // Send through the formData serialization error if we have one so we can
1070      // render at the right error boundary after we match routes
1071      pendingError: error,
1072      preventScrollReset,
1073      replace: opts && opts.replace,
1074      enableViewTransition: opts && opts.viewTransition,
1075      flushSync
1076    });
1077  }
1078  function revalidate() {
1079    interruptActiveLoads();
1080    updateState({
1081      revalidation: "loading"
1082    });
1083    if (state.navigation.state === "submitting") {
1084      return;
1085    }
1086    if (state.navigation.state === "idle") {
1087      startNavigation(state.historyAction, state.location, {
1088        startUninterruptedRevalidation: true
1089      });
1090      return;
1091    }
1092    startNavigation(pendingAction || state.historyAction, state.navigation.location, {
1093      overrideNavigation: state.navigation,
1094      // Proxy through any rending view transition
1095      enableViewTransition: pendingViewTransitionEnabled === true
1096    });
1097  }
1098  async function startNavigation(historyAction, location, opts) {
1099    pendingNavigationController && pendingNavigationController.abort();
1100    pendingNavigationController = null;
1101    pendingAction = historyAction;
1102    isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;
1103    saveScrollPosition(state.location, state.matches);
1104    pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;
1105    pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;
1106    let routesToUse = inFlightDataRoutes || dataRoutes;
1107    let loadingNavigation = opts && opts.overrideNavigation;
1108    let matches = opts != null && opts.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? (
1109      // `matchRoutes()` has already been called if we're in here via `router.initialize()`
1110      state.matches
1111    ) : matchRoutes(routesToUse, location, basename);
1112    let flushSync = (opts && opts.flushSync) === true;
1113    if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {
1114      completeNavigation(location, {
1115        matches
1116      }, {
1117        flushSync
1118      });
1119      return;
1120    }
1121    let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);
1122    if (fogOfWar.active && fogOfWar.matches) {
1123      matches = fogOfWar.matches;
1124    }
1125    if (!matches) {
1126      let {
1127        error,
1128        notFoundMatches,
1129        route
1130      } = handleNavigational404(location.pathname);
1131      completeNavigation(location, {
1132        matches: notFoundMatches,
1133        loaderData: {},
1134        errors: {
1135          [route.id]: error
1136        }
1137      }, {
1138        flushSync
1139      });
1140      return;
1141    }
1142    pendingNavigationController = new AbortController();
1143    let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);
1144    let pendingActionResult;
1145    if (opts && opts.pendingError) {
1146      pendingActionResult = [findNearestBoundary(matches).route.id, {
1147        type: ResultType.error,
1148        error: opts.pendingError
1149      }];
1150    } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {
1151      let actionResult = await handleAction(request, location, opts.submission, matches, fogOfWar.active, {
1152        replace: opts.replace,
1153        flushSync
1154      });
1155      if (actionResult.shortCircuited) {
1156        return;
1157      }
1158      if (actionResult.pendingActionResult) {
1159        let [routeId, result] = actionResult.pendingActionResult;
1160        if (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) {
1161          pendingNavigationController = null;
1162          completeNavigation(location, {
1163            matches: actionResult.matches,
1164            loaderData: {},
1165            errors: {
1166              [routeId]: result.error
1167            }
1168          });
1169          return;
1170        }
1171      }
1172      matches = actionResult.matches || matches;
1173      pendingActionResult = actionResult.pendingActionResult;
1174      loadingNavigation = getLoadingNavigation(location, opts.submission);
1175      flushSync = false;
1176      fogOfWar.active = false;
1177      request = createClientSideRequest(init.history, request.url, request.signal);
1178    }
1179    let {
1180      shortCircuited,
1181      matches: updatedMatches,
1182      loaderData,
1183      errors
1184    } = await handleLoaders(request, location, matches, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult);
1185    if (shortCircuited) {
1186      return;
1187    }
1188    pendingNavigationController = null;
1189    completeNavigation(location, _extends({
1190      matches: updatedMatches || matches
1191    }, getActionDataForCommit(pendingActionResult), {
1192      loaderData,
1193      errors
1194    }));
1195  }
1196  async function handleAction(request, location, submission, matches, isFogOfWar, opts) {
1197    if (opts === void 0) {
1198      opts = {};
1199    }
1200    interruptActiveLoads();
1201    let navigation = getSubmittingNavigation(location, submission);
1202    updateState({
1203      navigation
1204    }, {
1205      flushSync: opts.flushSync === true
1206    });
1207    if (isFogOfWar) {
1208      let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);
1209      if (discoverResult.type === "aborted") {
1210        return {
1211          shortCircuited: true
1212        };
1213      } else if (discoverResult.type === "error") {
1214        let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
1215        return {
1216          matches: discoverResult.partialMatches,
1217          pendingActionResult: [boundaryId, {
1218            type: ResultType.error,
1219            error: discoverResult.error
1220          }]
1221        };
1222      } else if (!discoverResult.matches) {
1223        let {
1224          notFoundMatches,
1225          error,
1226          route
1227        } = handleNavigational404(location.pathname);
1228        return {
1229          matches: notFoundMatches,
1230          pendingActionResult: [route.id, {
1231            type: ResultType.error,
1232            error
1233          }]
1234        };
1235      } else {
1236        matches = discoverResult.matches;
1237      }
1238    }
1239    let result;
1240    let actionMatch = getTargetMatch(matches, location);
1241    if (!actionMatch.route.action && !actionMatch.route.lazy) {
1242      result = {
1243        type: ResultType.error,
1244        error: getInternalRouterError(405, {
1245          method: request.method,
1246          pathname: location.pathname,
1247          routeId: actionMatch.route.id
1248        })
1249      };
1250    } else {
1251      let results = await callDataStrategy("action", state, request, [actionMatch], matches, null);
1252      result = results[actionMatch.route.id];
1253      if (request.signal.aborted) {
1254        return {
1255          shortCircuited: true
1256        };
1257      }
1258    }
1259    if (isRedirectResult(result)) {
1260      let replace3;
1261      if (opts && opts.replace != null) {
1262        replace3 = opts.replace;
1263      } else {
1264        let location2 = normalizeRedirectLocation(result.response.headers.get("Location"), new URL(request.url), basename, init.history);
1265        replace3 = location2 === state.location.pathname + state.location.search;
1266      }
1267      await startRedirectNavigation(request, result, true, {
1268        submission,
1269        replace: replace3
1270      });
1271      return {
1272        shortCircuited: true
1273      };
1274    }
1275    if (isDeferredResult(result)) {
1276      throw getInternalRouterError(400, {
1277        type: "defer-action"
1278      });
1279    }
1280    if (isErrorResult(result)) {
1281      let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);
1282      if ((opts && opts.replace) !== true) {
1283        pendingAction = Action.Push;
1284      }
1285      return {
1286        matches,
1287        pendingActionResult: [boundaryMatch.route.id, result]
1288      };
1289    }
1290    return {
1291      matches,
1292      pendingActionResult: [actionMatch.route.id, result]
1293    };
1294  }
1295  async function handleLoaders(request, location, matches, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace3, initialHydration, flushSync, pendingActionResult) {
1296    let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);
1297    let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);
1298    let shouldUpdateNavigationState = !isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration);
1299    if (isFogOfWar) {
1300      if (shouldUpdateNavigationState) {
1301        let actionData = getUpdatedActionData(pendingActionResult);
1302        updateState(_extends({
1303          navigation: loadingNavigation
1304        }, actionData !== void 0 ? {
1305          actionData
1306        } : {}), {
1307          flushSync
1308        });
1309      }
1310      let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);
1311      if (discoverResult.type === "aborted") {
1312        return {
1313          shortCircuited: true
1314        };
1315      } else if (discoverResult.type === "error") {
1316        let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
1317        return {
1318          matches: discoverResult.partialMatches,
1319          loaderData: {},
1320          errors: {
1321            [boundaryId]: discoverResult.error
1322          }
1323        };
1324      } else if (!discoverResult.matches) {
1325        let {
1326          error,
1327          notFoundMatches,
1328          route
1329        } = handleNavigational404(location.pathname);
1330        return {
1331          matches: notFoundMatches,
1332          loaderData: {},
1333          errors: {
1334            [route.id]: error
1335          }
1336        };
1337      } else {
1338        matches = discoverResult.matches;
1339      }
1340    }
1341    let routesToUse = inFlightDataRoutes || dataRoutes;
1342    let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult);
1343    cancelActiveDeferreds((routeId) => !(matches && matches.some((m) => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some((m) => m.route.id === routeId));
1344    pendingNavigationLoadId = ++incrementingLoadId;
1345    if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {
1346      let updatedFetchers2 = markFetchRedirectsDone();
1347      completeNavigation(location, _extends({
1348        matches,
1349        loaderData: {},
1350        // Commit pending error if we're short circuiting
1351        errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {
1352          [pendingActionResult[0]]: pendingActionResult[1].error
1353        } : null
1354      }, getActionDataForCommit(pendingActionResult), updatedFetchers2 ? {
1355        fetchers: new Map(state.fetchers)
1356      } : {}), {
1357        flushSync
1358      });
1359      return {
1360        shortCircuited: true
1361      };
1362    }
1363    if (shouldUpdateNavigationState) {
1364      let updates = {};
1365      if (!isFogOfWar) {
1366        updates.navigation = loadingNavigation;
1367        let actionData = getUpdatedActionData(pendingActionResult);
1368        if (actionData !== void 0) {
1369          updates.actionData = actionData;
1370        }
1371      }
1372      if (revalidatingFetchers.length > 0) {
1373        updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers);
1374      }
1375      updateState(updates, {
1376        flushSync
1377      });
1378    }
1379    revalidatingFetchers.forEach((rf) => {
1380      abortFetcher(rf.key);
1381      if (rf.controller) {
1382        fetchControllers.set(rf.key, rf.controller);
1383      }
1384    });
1385    let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach((f) => abortFetcher(f.key));
1386    if (pendingNavigationController) {
1387      pendingNavigationController.signal.addEventListener("abort", abortPendingFetchRevalidations);
1388    }
1389    let {
1390      loaderResults,
1391      fetcherResults
1392    } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, request);
1393    if (request.signal.aborted) {
1394      return {
1395        shortCircuited: true
1396      };
1397    }
1398    if (pendingNavigationController) {
1399      pendingNavigationController.signal.removeEventListener("abort", abortPendingFetchRevalidations);
1400    }
1401    revalidatingFetchers.forEach((rf) => fetchControllers.delete(rf.key));
1402    let redirect4 = findRedirect(loaderResults);
1403    if (redirect4) {
1404      await startRedirectNavigation(request, redirect4.result, true, {
1405        replace: replace3
1406      });
1407      return {
1408        shortCircuited: true
1409      };
1410    }
1411    redirect4 = findRedirect(fetcherResults);
1412    if (redirect4) {
1413      fetchRedirectIds.add(redirect4.key);
1414      await startRedirectNavigation(request, redirect4.result, true, {
1415        replace: replace3
1416      });
1417      return {
1418        shortCircuited: true
1419      };
1420    }
1421    let {
1422      loaderData,
1423      errors
1424    } = processLoaderData(state, matches, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds);
1425    activeDeferreds.forEach((deferredData, routeId) => {
1426      deferredData.subscribe((aborted) => {
1427        if (aborted || deferredData.done) {
1428          activeDeferreds.delete(routeId);
1429        }
1430      });
1431    });
1432    if (future.v7_partialHydration && initialHydration && state.errors) {
1433      errors = _extends({}, state.errors, errors);
1434    }
1435    let updatedFetchers = markFetchRedirectsDone();
1436    let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);
1437    let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;
1438    return _extends({
1439      matches,
1440      loaderData,
1441      errors
1442    }, shouldUpdateFetchers ? {
1443      fetchers: new Map(state.fetchers)
1444    } : {});
1445  }
1446  function getUpdatedActionData(pendingActionResult) {
1447    if (pendingActionResult && !isErrorResult(pendingActionResult[1])) {
1448      return {
1449        [pendingActionResult[0]]: pendingActionResult[1].data
1450      };
1451    } else if (state.actionData) {
1452      if (Object.keys(state.actionData).length === 0) {
1453        return null;
1454      } else {
1455        return state.actionData;
1456      }
1457    }
1458  }
1459  function getUpdatedRevalidatingFetchers(revalidatingFetchers) {
1460    revalidatingFetchers.forEach((rf) => {
1461      let fetcher = state.fetchers.get(rf.key);
1462      let revalidatingFetcher = getLoadingFetcher(void 0, fetcher ? fetcher.data : void 0);
1463      state.fetchers.set(rf.key, revalidatingFetcher);
1464    });
1465    return new Map(state.fetchers);
1466  }
1467  function fetch2(key, routeId, href, opts) {
1468    if (isServer) {
1469      throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");
1470    }
1471    abortFetcher(key);
1472    let flushSync = (opts && opts.flushSync) === true;
1473    let routesToUse = inFlightDataRoutes || dataRoutes;
1474    let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, future.v7_relativeSplatPath, routeId, opts == null ? void 0 : opts.relative);
1475    let matches = matchRoutes(routesToUse, normalizedPath, basename);
1476    let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath);
1477    if (fogOfWar.active && fogOfWar.matches) {
1478      matches = fogOfWar.matches;
1479    }
1480    if (!matches) {
1481      setFetcherError(key, routeId, getInternalRouterError(404, {
1482        pathname: normalizedPath
1483      }), {
1484        flushSync
1485      });
1486      return;
1487    }
1488    let {
1489      path,
1490      submission,
1491      error
1492    } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts);
1493    if (error) {
1494      setFetcherError(key, routeId, error, {
1495        flushSync
1496      });
1497      return;
1498    }
1499    let match = getTargetMatch(matches, path);
1500    let preventScrollReset = (opts && opts.preventScrollReset) === true;
1501    if (submission && isMutationMethod(submission.formMethod)) {
1502      handleFetcherAction(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission);
1503      return;
1504    }
1505    fetchLoadMatches.set(key, {
1506      routeId,
1507      path
1508    });
1509    handleFetcherLoader(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission);
1510  }
1511  async function handleFetcherAction(key, routeId, path, match, requestMatches, isFogOfWar, flushSync, preventScrollReset, submission) {
1512    interruptActiveLoads();
1513    fetchLoadMatches.delete(key);
1514    function detectAndHandle405Error(m) {
1515      if (!m.route.action && !m.route.lazy) {
1516        let error = getInternalRouterError(405, {
1517          method: submission.formMethod,
1518          pathname: path,
1519          routeId
1520        });
1521        setFetcherError(key, routeId, error, {
1522          flushSync
1523        });
1524        return true;
1525      }
1526      return false;
1527    }
1528    if (!isFogOfWar && detectAndHandle405Error(match)) {
1529      return;
1530    }
1531    let existingFetcher = state.fetchers.get(key);
1532    updateFetcherState(key, getSubmittingFetcher(submission, existingFetcher), {
1533      flushSync
1534    });
1535    let abortController = new AbortController();
1536    let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);
1537    if (isFogOfWar) {
1538      let discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);
1539      if (discoverResult.type === "aborted") {
1540        return;
1541      } else if (discoverResult.type === "error") {
1542        setFetcherError(key, routeId, discoverResult.error, {
1543          flushSync
1544        });
1545        return;
1546      } else if (!discoverResult.matches) {
1547        setFetcherError(key, routeId, getInternalRouterError(404, {
1548          pathname: path
1549        }), {
1550          flushSync
1551        });
1552        return;
1553      } else {
1554        requestMatches = discoverResult.matches;
1555        match = getTargetMatch(requestMatches, path);
1556        if (detectAndHandle405Error(match)) {
1557          return;
1558        }
1559      }
1560    }
1561    fetchControllers.set(key, abortController);
1562    let originatingLoadId = incrementingLoadId;
1563    let actionResults = await callDataStrategy("action", state, fetchRequest, [match], requestMatches, key);
1564    let actionResult = actionResults[match.route.id];
1565    if (fetchRequest.signal.aborted) {
1566      if (fetchControllers.get(key) === abortController) {
1567        fetchControllers.delete(key);
1568      }
1569      return;
1570    }
1571    if (future.v7_fetcherPersist && deletedFetchers.has(key)) {
1572      if (isRedirectResult(actionResult) || isErrorResult(actionResult)) {
1573        updateFetcherState(key, getDoneFetcher(void 0));
1574        return;
1575      }
1576    } else {
1577      if (isRedirectResult(actionResult)) {
1578        fetchControllers.delete(key);
1579        if (pendingNavigationLoadId > originatingLoadId) {
1580          updateFetcherState(key, getDoneFetcher(void 0));
1581          return;
1582        } else {
1583          fetchRedirectIds.add(key);
1584          updateFetcherState(key, getLoadingFetcher(submission));
1585          return startRedirectNavigation(fetchRequest, actionResult, false, {
1586            fetcherSubmission: submission,
1587            preventScrollReset
1588          });
1589        }
1590      }
1591      if (isErrorResult(actionResult)) {
1592        setFetcherError(key, routeId, actionResult.error);
1593        return;
1594      }
1595    }
1596    if (isDeferredResult(actionResult)) {
1597      throw getInternalRouterError(400, {
1598        type: "defer-action"
1599      });
1600    }
1601    let nextLocation = state.navigation.location || state.location;
1602    let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);
1603    let routesToUse = inFlightDataRoutes || dataRoutes;
1604    let matches = state.navigation.state !== "idle" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;
1605    invariant(matches, "Didn't find any matches after fetcher action");
1606    let loadId = ++incrementingLoadId;
1607    fetchReloadIds.set(key, loadId);
1608    let loadFetcher = getLoadingFetcher(submission, actionResult.data);
1609    state.fetchers.set(key, loadFetcher);
1610    let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, [match.route.id, actionResult]);
1611    revalidatingFetchers.filter((rf) => rf.key !== key).forEach((rf) => {
1612      let staleKey = rf.key;
1613      let existingFetcher2 = state.fetchers.get(staleKey);
1614      let revalidatingFetcher = getLoadingFetcher(void 0, existingFetcher2 ? existingFetcher2.data : void 0);
1615      state.fetchers.set(staleKey, revalidatingFetcher);
1616      abortFetcher(staleKey);
1617      if (rf.controller) {
1618        fetchControllers.set(staleKey, rf.controller);
1619      }
1620    });
1621    updateState({
1622      fetchers: new Map(state.fetchers)
1623    });
1624    let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach((rf) => abortFetcher(rf.key));
1625    abortController.signal.addEventListener("abort", abortPendingFetchRevalidations);
1626    let {
1627      loaderResults,
1628      fetcherResults
1629    } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, revalidationRequest);
1630    if (abortController.signal.aborted) {
1631      return;
1632    }
1633    abortController.signal.removeEventListener("abort", abortPendingFetchRevalidations);
1634    fetchReloadIds.delete(key);
1635    fetchControllers.delete(key);
1636    revalidatingFetchers.forEach((r) => fetchControllers.delete(r.key));
1637    let redirect4 = findRedirect(loaderResults);
1638    if (redirect4) {
1639      return startRedirectNavigation(revalidationRequest, redirect4.result, false, {
1640        preventScrollReset
1641      });
1642    }
1643    redirect4 = findRedirect(fetcherResults);
1644    if (redirect4) {
1645      fetchRedirectIds.add(redirect4.key);
1646      return startRedirectNavigation(revalidationRequest, redirect4.result, false, {
1647        preventScrollReset
1648      });
1649    }
1650    let {
1651      loaderData,
1652      errors
1653    } = processLoaderData(state, matches, loaderResults, void 0, revalidatingFetchers, fetcherResults, activeDeferreds);
1654    if (state.fetchers.has(key)) {
1655      let doneFetcher = getDoneFetcher(actionResult.data);
1656      state.fetchers.set(key, doneFetcher);
1657    }
1658    abortStaleFetchLoads(loadId);
1659    if (state.navigation.state === "loading" && loadId > pendingNavigationLoadId) {
1660      invariant(pendingAction, "Expected pending action");
1661      pendingNavigationController && pendingNavigationController.abort();
1662      completeNavigation(state.navigation.location, {
1663        matches,
1664        loaderData,
1665        errors,
1666        fetchers: new Map(state.fetchers)
1667      });
1668    } else {
1669      updateState({
1670        errors,
1671        loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors),
1672        fetchers: new Map(state.fetchers)
1673      });
1674      isRevalidationRequired = false;
1675    }
1676  }
1677  async function handleFetcherLoader(key, routeId, path, match, matches, isFogOfWar, flushSync, preventScrollReset, submission) {
1678    let existingFetcher = state.fetchers.get(key);
1679    updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : void 0), {
1680      flushSync
1681    });
1682    let abortController = new AbortController();
1683    let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);
1684    if (isFogOfWar) {
1685      let discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);
1686      if (discoverResult.type === "aborted") {
1687        return;
1688      } else if (discoverResult.type === "error") {
1689        setFetcherError(key, routeId, discoverResult.error, {
1690          flushSync
1691        });
1692        return;
1693      } else if (!discoverResult.matches) {
1694        setFetcherError(key, routeId, getInternalRouterError(404, {
1695          pathname: path
1696        }), {
1697          flushSync
1698        });
1699        return;
1700      } else {
1701        matches = discoverResult.matches;
1702        match = getTargetMatch(matches, path);
1703      }
1704    }
1705    fetchControllers.set(key, abortController);
1706    let originatingLoadId = incrementingLoadId;
1707    let results = await callDataStrategy("loader", state, fetchRequest, [match], matches, key);
1708    let result = results[match.route.id];
1709    if (isDeferredResult(result)) {
1710      result = await resolveDeferredData(result, fetchRequest.signal, true) || result;
1711    }
1712    if (fetchControllers.get(key) === abortController) {
1713      fetchControllers.delete(key);
1714    }
1715    if (fetchRequest.signal.aborted) {
1716      return;
1717    }
1718    if (deletedFetchers.has(key)) {
1719      updateFetcherState(key, getDoneFetcher(void 0));
1720      return;
1721    }
1722    if (isRedirectResult(result)) {
1723      if (pendingNavigationLoadId > originatingLoadId) {
1724        updateFetcherState(key, getDoneFetcher(void 0));
1725        return;
1726      } else {
1727        fetchRedirectIds.add(key);
1728        await startRedirectNavigation(fetchRequest, result, false, {
1729          preventScrollReset
1730        });
1731        return;
1732      }
1733    }
1734    if (isErrorResult(result)) {
1735      setFetcherError(key, routeId, result.error);
1736      return;
1737    }
1738    invariant(!isDeferredResult(result), "Unhandled fetcher deferred data");
1739    updateFetcherState(key, getDoneFetcher(result.data));
1740  }
1741  async function startRedirectNavigation(request, redirect4, isNavigation, _temp2) {
1742    let {
1743      submission,
1744      fetcherSubmission,
1745      preventScrollReset,
1746      replace: replace3
1747    } = _temp2 === void 0 ? {} : _temp2;
1748    if (redirect4.response.headers.has("X-Remix-Revalidate")) {
1749      isRevalidationRequired = true;
1750    }
1751    let location = redirect4.response.headers.get("Location");
1752    invariant(location, "Expected a Location header on the redirect Response");
1753    location = normalizeRedirectLocation(location, new URL(request.url), basename, init.history);
1754    let redirectLocation = createLocation(state.location, location, {
1755      _isRedirect: true
1756    });
1757    if (isBrowser) {
1758      let isDocumentReload = false;
1759      if (redirect4.response.headers.has("X-Remix-Reload-Document")) {
1760        isDocumentReload = true;
1761      } else if (ABSOLUTE_URL_REGEX.test(location)) {
1762        const url = init.history.createURL(location);
1763        isDocumentReload = // Hard reload if it's an absolute URL to a new origin
1764        url.origin !== routerWindow.location.origin || // Hard reload if it's an absolute URL that does not match our basename
1765        stripBasename(url.pathname, basename) == null;
1766      }
1767      if (isDocumentReload) {
1768        if (replace3) {
1769          routerWindow.location.replace(location);
1770        } else {
1771          routerWindow.location.assign(location);
1772        }
1773        return;
1774      }
1775    }
1776    pendingNavigationController = null;
1777    let redirectHistoryAction = replace3 === true || redirect4.response.headers.has("X-Remix-Replace") ? Action.Replace : Action.Push;
1778    let {
1779      formMethod,
1780      formAction,
1781      formEncType
1782    } = state.navigation;
1783    if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) {
1784      submission = getSubmissionFromNavigation(state.navigation);
1785    }
1786    let activeSubmission = submission || fetcherSubmission;
1787    if (redirectPreserveMethodStatusCodes.has(redirect4.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) {
1788      await startNavigation(redirectHistoryAction, redirectLocation, {
1789        submission: _extends({}, activeSubmission, {
1790          formAction: location
1791        }),
1792        // Preserve these flags across redirects
1793        preventScrollReset: preventScrollReset || pendingPreventScrollReset,
1794        enableViewTransition: isNavigation ? pendingViewTransitionEnabled : void 0
1795      });
1796    } else {
1797      let overrideNavigation = getLoadingNavigation(redirectLocation, submission);
1798      await startNavigation(redirectHistoryAction, redirectLocation, {
1799        overrideNavigation,
1800        // Send fetcher submissions through for shouldRevalidate
1801        fetcherSubmission,
1802        // Preserve these flags across redirects
1803        preventScrollReset: preventScrollReset || pendingPreventScrollReset,
1804        enableViewTransition: isNavigation ? pendingViewTransitionEnabled : void 0
1805      });
1806    }
1807  }
1808  async function callDataStrategy(type, state2, request, matchesToLoad, matches, fetcherKey) {
1809    let results;
1810    let dataResults = {};
1811    try {
1812      results = await callDataStrategyImpl(dataStrategyImpl, type, state2, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties);
1813    } catch (e) {
1814      matchesToLoad.forEach((m) => {
1815        dataResults[m.route.id] = {
1816          type: ResultType.error,
1817          error: e
1818        };
1819      });
1820      return dataResults;
1821    }
1822    for (let [routeId, result] of Object.entries(results)) {
1823      if (isRedirectDataStrategyResultResult(result)) {
1824        let response = result.result;
1825        dataResults[routeId] = {
1826          type: ResultType.redirect,
1827          response: normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, future.v7_relativeSplatPath)
1828        };
1829      } else {
1830        dataResults[routeId] = await convertDataStrategyResultToDataResult(result);
1831      }
1832    }
1833    return dataResults;
1834  }
1835  async function callLoadersAndMaybeResolveData(state2, matches, matchesToLoad, fetchersToLoad, request) {
1836    let currentMatches = state2.matches;
1837    let loaderResultsPromise = callDataStrategy("loader", state2, request, matchesToLoad, matches, null);
1838    let fetcherResultsPromise = Promise.all(fetchersToLoad.map(async (f) => {
1839      if (f.matches && f.match && f.controller) {
1840        let results = await callDataStrategy("loader", state2, createClientSideRequest(init.history, f.path, f.controller.signal), [f.match], f.matches, f.key);
1841        let result = results[f.match.route.id];
1842        return {
1843          [f.key]: result
1844        };
1845      } else {
1846        return Promise.resolve({
1847          [f.key]: {
1848            type: ResultType.error,
1849            error: getInternalRouterError(404, {
1850              pathname: f.path
1851            })
1852          }
1853        });
1854      }
1855    }));
1856    let loaderResults = await loaderResultsPromise;
1857    let fetcherResults = (await fetcherResultsPromise).reduce((acc, r) => Object.assign(acc, r), {});
1858    await Promise.all([resolveNavigationDeferredResults(matches, loaderResults, request.signal, currentMatches, state2.loaderData), resolveFetcherDeferredResults(matches, fetcherResults, fetchersToLoad)]);
1859    return {
1860      loaderResults,
1861      fetcherResults
1862    };
1863  }
1864  function interruptActiveLoads() {
1865    isRevalidationRequired = true;
1866    cancelledDeferredRoutes.push(...cancelActiveDeferreds());
1867    fetchLoadMatches.forEach((_, key) => {
1868      if (fetchControllers.has(key)) {
1869        cancelledFetcherLoads.add(key);
1870      }
1871      abortFetcher(key);
1872    });
1873  }
1874  function updateFetcherState(key, fetcher, opts) {
1875    if (opts === void 0) {
1876      opts = {};
1877    }
1878    state.fetchers.set(key, fetcher);
1879    updateState({
1880      fetchers: new Map(state.fetchers)
1881    }, {
1882      flushSync: (opts && opts.flushSync) === true
1883    });
1884  }
1885  function setFetcherError(key, routeId, error, opts) {
1886    if (opts === void 0) {
1887      opts = {};
1888    }
1889    let boundaryMatch = findNearestBoundary(state.matches, routeId);
1890    deleteFetcher(key);
1891    updateState({
1892      errors: {
1893        [boundaryMatch.route.id]: error
1894      },
1895      fetchers: new Map(state.fetchers)
1896    }, {
1897      flushSync: (opts && opts.flushSync) === true
1898    });
1899  }
1900  function getFetcher(key) {
1901    activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1);
1902    if (deletedFetchers.has(key)) {
1903      deletedFetchers.delete(key);
1904    }
1905    return state.fetchers.get(key) || IDLE_FETCHER;
1906  }
1907  function deleteFetcher(key) {
1908    let fetcher = state.fetchers.get(key);
1909    if (fetchControllers.has(key) && !(fetcher && fetcher.state === "loading" && fetchReloadIds.has(key))) {
1910      abortFetcher(key);
1911    }
1912    fetchLoadMatches.delete(key);
1913    fetchReloadIds.delete(key);
1914    fetchRedirectIds.delete(key);
1915    if (future.v7_fetcherPersist) {
1916      deletedFetchers.delete(key);
1917    }
1918    cancelledFetcherLoads.delete(key);
1919    state.fetchers.delete(key);
1920  }
1921  function deleteFetcherAndUpdateState(key) {
1922    let count = (activeFetchers.get(key) || 0) - 1;
1923    if (count <= 0) {
1924      activeFetchers.delete(key);
1925      deletedFetchers.add(key);
1926      if (!future.v7_fetcherPersist) {
1927        deleteFetcher(key);
1928      }
1929    } else {
1930      activeFetchers.set(key, count);
1931    }
1932    updateState({
1933      fetchers: new Map(state.fetchers)
1934    });
1935  }
1936  function abortFetcher(key) {
1937    let controller = fetchControllers.get(key);
1938    if (controller) {
1939      controller.abort();
1940      fetchControllers.delete(key);
1941    }
1942  }
1943  function markFetchersDone(keys) {
1944    for (let key of keys) {
1945      let fetcher = getFetcher(key);
1946      let doneFetcher = getDoneFetcher(fetcher.data);
1947      state.fetchers.set(key, doneFetcher);
1948    }
1949  }
1950  function markFetchRedirectsDone() {
1951    let doneKeys = [];
1952    let updatedFetchers = false;
1953    for (let key of fetchRedirectIds) {
1954      let fetcher = state.fetchers.get(key);
1955      invariant(fetcher, "Expected fetcher: " + key);
1956      if (fetcher.state === "loading") {
1957        fetchRedirectIds.delete(key);
1958        doneKeys.push(key);
1959        updatedFetchers = true;
1960      }
1961    }
1962    markFetchersDone(doneKeys);
1963    return updatedFetchers;
1964  }
1965  function abortStaleFetchLoads(landedId) {
1966    let yeetedKeys = [];
1967    for (let [key, id] of fetchReloadIds) {
1968      if (id < landedId) {
1969        let fetcher = state.fetchers.get(key);
1970        invariant(fetcher, "Expected fetcher: " + key);
1971        if (fetcher.state === "loading") {
1972          abortFetcher(key);
1973          fetchReloadIds.delete(key);
1974          yeetedKeys.push(key);
1975        }
1976      }
1977    }
1978    markFetchersDone(yeetedKeys);
1979    return yeetedKeys.length > 0;
1980  }
1981  function getBlocker(key, fn) {
1982    let blocker = state.blockers.get(key) || IDLE_BLOCKER;
1983    if (blockerFunctions.get(key) !== fn) {
1984      blockerFunctions.set(key, fn);
1985    }
1986    return blocker;
1987  }
1988  function deleteBlocker(key) {
1989    state.blockers.delete(key);
1990    blockerFunctions.delete(key);
1991  }
1992  function updateBlocker(key, newBlocker) {
1993    let blocker = state.blockers.get(key) || IDLE_BLOCKER;
1994    invariant(blocker.state === "unblocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "proceeding" || blocker.state === "blocked" && newBlocker.state === "unblocked" || blocker.state === "proceeding" && newBlocker.state === "unblocked", "Invalid blocker state transition: " + blocker.state + " -> " + newBlocker.state);
1995    let blockers = new Map(state.blockers);
1996    blockers.set(key, newBlocker);
1997    updateState({
1998      blockers
1999    });
2000  }
2001  function shouldBlockNavigation(_ref2) {
2002    let {
2003      currentLocation,
2004      nextLocation,
2005      historyAction
2006    } = _ref2;
2007    if (blockerFunctions.size === 0) {
2008      return;
2009    }
2010    if (blockerFunctions.size > 1) {
2011      warning(false, "A router only supports one blocker at a time");
2012    }
2013    let entries = Array.from(blockerFunctions.entries());
2014    let [blockerKey, blockerFunction] = entries[entries.length - 1];
2015    let blocker = state.blockers.get(blockerKey);
2016    if (blocker && blocker.state === "proceeding") {
2017      return;
2018    }
2019    if (blockerFunction({
2020      currentLocation,
2021      nextLocation,
2022      historyAction
2023    })) {
2024      return blockerKey;
2025    }
2026  }
2027  function handleNavigational404(pathname) {
2028    let error = getInternalRouterError(404, {
2029      pathname
2030    });
2031    let routesToUse = inFlightDataRoutes || dataRoutes;
2032    let {
2033      matches,
2034      route
2035    } = getShortCircuitMatches(routesToUse);
2036    cancelActiveDeferreds();
2037    return {
2038      notFoundMatches: matches,
2039      route,
2040      error
2041    };
2042  }
2043  function cancelActiveDeferreds(predicate) {
2044    let cancelledRouteIds = [];
2045    activeDeferreds.forEach((dfd, routeId) => {
2046      if (!predicate || predicate(routeId)) {
2047        dfd.cancel();
2048        cancelledRouteIds.push(routeId);
2049        activeDeferreds.delete(routeId);
2050      }
2051    });
2052    return cancelledRouteIds;
2053  }
2054  function enableScrollRestoration(positions, getPosition, getKey) {
2055    savedScrollPositions = positions;
2056    getScrollPosition = getPosition;
2057    getScrollRestorationKey = getKey || null;
2058    if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {
2059      initialScrollRestored = true;
2060      let y = getSavedScrollPosition(state.location, state.matches);
2061      if (y != null) {
2062        updateState({
2063          restoreScrollPosition: y
2064        });
2065      }
2066    }
2067    return () => {
2068      savedScrollPositions = null;
2069      getScrollPosition = null;
2070      getScrollRestorationKey = null;
2071    };
2072  }
2073  function getScrollKey(location, matches) {
2074    if (getScrollRestorationKey) {
2075      let key = getScrollRestorationKey(location, matches.map((m) => convertRouteMatchToUiMatch(m, state.loaderData)));
2076      return key || location.key;
2077    }
2078    return location.key;
2079  }
2080  function saveScrollPosition(location, matches) {
2081    if (savedScrollPositions && getScrollPosition) {
2082      let key = getScrollKey(location, matches);
2083      savedScrollPositions[key] = getScrollPosition();
2084    }
2085  }
2086  function getSavedScrollPosition(location, matches) {
2087    if (savedScrollPositions) {
2088      let key = getScrollKey(location, matches);
2089      let y = savedScrollPositions[key];
2090      if (typeof y === "number") {
2091        return y;
2092      }
2093    }
2094    return null;
2095  }
2096  function checkFogOfWar(matches, routesToUse, pathname) {
2097    if (patchRoutesOnNavigationImpl) {
2098      if (!matches) {
2099        let fogMatches = matchRoutesImpl(routesToUse, pathname, basename, true);
2100        return {
2101          active: true,
2102          matches: fogMatches || []
2103        };
2104      } else {
2105        if (Object.keys(matches[0].params).length > 0) {
2106          let partialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);
2107          return {
2108            active: true,
2109            matches: partialMatches
2110          };
2111        }
2112      }
2113    }
2114    return {
2115      active: false,
2116      matches: null
2117    };
2118  }
2119  async function discoverRoutes(matches, pathname, signal, fetcherKey) {
2120    if (!patchRoutesOnNavigationImpl) {
2121      return {
2122        type: "success",
2123        matches
2124      };
2125    }
2126    let partialMatches = matches;
2127    while (true) {
2128      let isNonHMR = inFlightDataRoutes == null;
2129      let routesToUse = inFlightDataRoutes || dataRoutes;
2130      let localManifest = manifest;
2131      try {
2132        await patchRoutesOnNavigationImpl({
2133          signal,
2134          path: pathname,
2135          matches: partialMatches,
2136          fetcherKey,
2137          patch: (routeId, children) => {
2138            if (signal.aborted) return;
2139            patchRoutesImpl(routeId, children, routesToUse, localManifest, mapRouteProperties);
2140          }
2141        });
2142      } catch (e) {
2143        return {
2144          type: "error",
2145          error: e,
2146          partialMatches
2147        };
2148      } finally {
2149        if (isNonHMR && !signal.aborted) {
2150          dataRoutes = [...dataRoutes];
2151        }
2152      }
2153      if (signal.aborted) {
2154        return {
2155          type: "aborted"
2156        };
2157      }
2158      let newMatches = matchRoutes(routesToUse, pathname, basename);
2159      if (newMatches) {
2160        return {
2161          type: "success",
2162          matches: newMatches
2163        };
2164      }
2165      let newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);
2166      if (!newPartialMatches || partialMatches.length === newPartialMatches.length && partialMatches.every((m, i) => m.route.id === newPartialMatches[i].route.id)) {
2167        return {
2168          type: "success",
2169          matches: null
2170        };
2171      }
2172      partialMatches = newPartialMatches;
2173    }
2174  }
2175  function _internalSetRoutes(newRoutes) {
2176    manifest = {};
2177    inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, void 0, manifest);
2178  }
2179  function patchRoutes(routeId, children) {
2180    let isNonHMR = inFlightDataRoutes == null;
2181    let routesToUse = inFlightDataRoutes || dataRoutes;
2182    patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties);
2183    if (isNonHMR) {
2184      dataRoutes = [...dataRoutes];
2185      updateState({});
2186    }
2187  }
2188  router = {
2189    get basename() {
2190      return basename;
2191    },
2192    get future() {
2193      return future;
2194    },
2195    get state() {
2196      return state;
2197    },
2198    get routes() {
2199      return dataRoutes;
2200    },
2201    get window() {
2202      return routerWindow;
2203    },
2204    initialize,
2205    subscribe,
2206    enableScrollRestoration,
2207    navigate,
2208    fetch: fetch2,
2209    revalidate,
2210    // Passthrough to history-aware createHref used by useHref so we get proper
2211    // hash-aware URLs in DOM paths
2212    createHref: (to) => init.history.createHref(to),
2213    encodeLocation: (to) => init.history.encodeLocation(to),
2214    getFetcher,
2215    deleteFetcher: deleteFetcherAndUpdateState,
2216    dispose,
2217    getBlocker,
2218    deleteBlocker,
2219    patchRoutes,
2220    _internalFetchControllers: fetchControllers,
2221    _internalActiveDeferreds: activeDeferreds,
2222    // TODO: Remove setRoutes, it's temporary to avoid dealing with
2223    // updating the tree while validating the update algorithm.
2224    _internalSetRoutes
2225  };
2226  return router;
2227}
2228function createStaticHandler(routes, opts) {
2229  invariant(routes.length > 0, "You must provide a non-empty routes array to createStaticHandler");
2230  let manifest = {};
2231  let basename = (opts ? opts.basename : null) || "/";
2232  let mapRouteProperties;
2233  if (opts != null && opts.mapRouteProperties) {
2234    mapRouteProperties = opts.mapRouteProperties;
2235  } else if (opts != null && opts.detectErrorBoundary) {
2236    let detectErrorBoundary = opts.detectErrorBoundary;
2237    mapRouteProperties = (route) => ({
2238      hasErrorBoundary: detectErrorBoundary(route)
2239    });
2240  } else {
2241    mapRouteProperties = defaultMapRouteProperties;
2242  }
2243  let future = _extends({
2244    v7_relativeSplatPath: false,
2245    v7_throwAbortReason: false
2246  }, opts ? opts.future : null);
2247  let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, void 0, manifest);
2248  async function query(request, _temp3) {
2249    let {
2250      requestContext,
2251      skipLoaderErrorBubbling,
2252      dataStrategy
2253    } = _temp3 === void 0 ? {} : _temp3;
2254    let url = new URL(request.url);
2255    let method = request.method;
2256    let location = createLocation("", createPath(url), null, "default");
2257    let matches = matchRoutes(dataRoutes, location, basename);
2258    if (!isValidMethod(method) && method !== "HEAD") {
2259      let error = getInternalRouterError(405, {
2260        method
2261      });
2262      let {
2263        matches: methodNotAllowedMatches,
2264        route
2265      } = getShortCircuitMatches(dataRoutes);
2266      return {
2267        basename,
2268        location,
2269        matches: methodNotAllowedMatches,
2270        loaderData: {},
2271        actionData: null,
2272        errors: {
2273          [route.id]: error
2274        },
2275        statusCode: error.status,
2276        loaderHeaders: {},
2277        actionHeaders: {},
2278        activeDeferreds: null
2279      };
2280    } else if (!matches) {
2281      let error = getInternalRouterError(404, {
2282        pathname: location.pathname
2283      });
2284      let {
2285        matches: notFoundMatches,
2286        route
2287      } = getShortCircuitMatches(dataRoutes);
2288      return {
2289        basename,
2290        location,
2291        matches: notFoundMatches,
2292        loaderData: {},
2293        actionData: null,
2294        errors: {
2295          [route.id]: error
2296        },
2297        statusCode: error.status,
2298        loaderHeaders: {},
2299        actionHeaders: {},
2300        activeDeferreds: null
2301      };
2302    }
2303    let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null);
2304    if (isResponse(result)) {
2305      return result;
2306    }
2307    return _extends({
2308      location,
2309      basename
2310    }, result);
2311  }
2312  async function queryRoute(request, _temp4) {
2313    let {
2314      routeId,
2315      requestContext,
2316      dataStrategy
2317    } = _temp4 === void 0 ? {} : _temp4;
2318    let url = new URL(request.url);
2319    let method = request.method;
2320    let location = createLocation("", createPath(url), null, "default");
2321    let matches = matchRoutes(dataRoutes, location, basename);
2322    if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
2323      throw getInternalRouterError(405, {
2324        method
2325      });
2326    } else if (!matches) {
2327      throw getInternalRouterError(404, {
2328        pathname: location.pathname
2329      });
2330    }
2331    let match = routeId ? matches.find((m) => m.route.id === routeId) : getTargetMatch(matches, location);
2332    if (routeId && !match) {
2333      throw getInternalRouterError(403, {
2334        pathname: location.pathname,
2335        routeId
2336      });
2337    } else if (!match) {
2338      throw getInternalRouterError(404, {
2339        pathname: location.pathname
2340      });
2341    }
2342    let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, false, match);
2343    if (isResponse(result)) {
2344      return result;
2345    }
2346    let error = result.errors ? Object.values(result.errors)[0] : void 0;
2347    if (error !== void 0) {
2348      throw error;
2349    }
2350    if (result.actionData) {
2351      return Object.values(result.actionData)[0];
2352    }
2353    if (result.loaderData) {
2354      var _result$activeDeferre;
2355      let data3 = Object.values(result.loaderData)[0];
2356      if ((_result$activeDeferre = result.activeDeferreds) != null && _result$activeDeferre[match.route.id]) {
2357        data3[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id];
2358      }
2359      return data3;
2360    }
2361    return void 0;
2362  }
2363  async function queryImpl(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch) {
2364    invariant(request.signal, "query()/queryRoute() requests must contain an AbortController signal");
2365    try {
2366      if (isMutationMethod(request.method.toLowerCase())) {
2367        let result2 = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch != null);
2368        return result2;
2369      }
2370      let result = await loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch);
2371      return isResponse(result) ? result : _extends({}, result, {
2372        actionData: null,
2373        actionHeaders: {}
2374      });
2375    } catch (e) {
2376      if (isDataStrategyResult(e) && isResponse(e.result)) {
2377        if (e.type === ResultType.error) {
2378          throw e.result;
2379        }
2380        return e.result;
2381      }
2382      if (isRedirectResponse(e)) {
2383        return e;
2384      }
2385      throw e;
2386    }
2387  }
2388  async function submit(request, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest) {
2389    let result;
2390    if (!actionMatch.route.action && !actionMatch.route.lazy) {
2391      let error = getInternalRouterError(405, {
2392        method: request.method,
2393        pathname: new URL(request.url).pathname,
2394        routeId: actionMatch.route.id
2395      });
2396      if (isRouteRequest) {
2397        throw error;
2398      }
2399      result = {
2400        type: ResultType.error,
2401        error
2402      };
2403    } else {
2404      let results = await callDataStrategy("action", request, [actionMatch], matches, isRouteRequest, requestContext, dataStrategy);
2405      result = results[actionMatch.route.id];
2406      if (request.signal.aborted) {
2407        throwStaticHandlerAbortedError(request, isRouteRequest, future);
2408      }
2409    }
2410    if (isRedirectResult(result)) {
2411      throw new Response(null, {
2412        status: result.response.status,
2413        headers: {
2414          Location: result.response.headers.get("Location")
2415        }
2416      });
2417    }
2418    if (isDeferredResult(result)) {
2419      let error = getInternalRouterError(400, {
2420        type: "defer-action"
2421      });
2422      if (isRouteRequest) {
2423        throw error;
2424      }
2425      result = {
2426        type: ResultType.error,
2427        error
2428      };
2429    }
2430    if (isRouteRequest) {
2431      if (isErrorResult(result)) {
2432        throw result.error;
2433      }
2434      return {
2435        matches: [actionMatch],
2436        loaderData: {},
2437        actionData: {
2438          [actionMatch.route.id]: result.data
2439        },
2440        errors: null,
2441        // Note: statusCode + headers are unused here since queryRoute will
2442        // return the raw Response or value
2443        statusCode: 200,
2444        loaderHeaders: {},
2445        actionHeaders: {},
2446        activeDeferreds: null
2447      };
2448    }
2449    let loaderRequest = new Request(request.url, {
2450      headers: request.headers,
2451      redirect: request.redirect,
2452      signal: request.signal
2453    });
2454    if (isErrorResult(result)) {
2455      let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);
2456      let context2 = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, [boundaryMatch.route.id, result]);
2457      return _extends({}, context2, {
2458        statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,
2459        actionData: null,
2460        actionHeaders: _extends({}, result.headers ? {
2461          [actionMatch.route.id]: result.headers
2462        } : {})
2463      });
2464    }
2465    let context = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null);
2466    return _extends({}, context, {
2467      actionData: {
2468        [actionMatch.route.id]: result.data
2469      }
2470    }, result.statusCode ? {
2471      statusCode: result.statusCode
2472    } : {}, {
2473      actionHeaders: result.headers ? {
2474        [actionMatch.route.id]: result.headers
2475      } : {}
2476    });
2477  }
2478  async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, pendingActionResult) {
2479    let isRouteRequest = routeMatch != null;
2480    if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader) && !(routeMatch != null && routeMatch.route.lazy)) {
2481      throw getInternalRouterError(400, {
2482        method: request.method,
2483        pathname: new URL(request.url).pathname,
2484        routeId: routeMatch == null ? void 0 : routeMatch.route.id
2485      });
2486    }
2487    let requestMatches = routeMatch ? [routeMatch] : pendingActionResult && isErrorResult(pendingActionResult[1]) ? getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]) : matches;
2488    let matchesToLoad = requestMatches.filter((m) => m.route.loader || m.route.lazy);
2489    if (matchesToLoad.length === 0) {
2490      return {
2491        matches,
2492        // Add a null for all matched routes for proper revalidation on the client
2493        loaderData: matches.reduce((acc, m) => Object.assign(acc, {
2494          [m.route.id]: null
2495        }), {}),
2496        errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {
2497          [pendingActionResult[0]]: pendingActionResult[1].error
2498        } : null,
2499        statusCode: 200,
2500        loaderHeaders: {},
2501        activeDeferreds: null
2502      };
2503    }
2504    let results = await callDataStrategy("loader", request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy);
2505    if (request.signal.aborted) {
2506      throwStaticHandlerAbortedError(request, isRouteRequest, future);
2507    }
2508    let activeDeferreds = /* @__PURE__ */ new Map();
2509    let context = processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling);
2510    let executedLoaders = new Set(matchesToLoad.map((match) => match.route.id));
2511    matches.forEach((match) => {
2512      if (!executedLoaders.has(match.route.id)) {
2513        context.loaderData[match.route.id] = null;
2514      }
2515    });
2516    return _extends({}, context, {
2517      matches,
2518      activeDeferreds: activeDeferreds.size > 0 ? Object.fromEntries(activeDeferreds.entries()) : null
2519    });
2520  }
2521  async function callDataStrategy(type, request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy) {
2522    let results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, type, null, request, matchesToLoad, matches, null, manifest, mapRouteProperties, requestContext);
2523    let dataResults = {};
2524    await Promise.all(matches.map(async (match) => {
2525      if (!(match.route.id in results)) {
2526        return;
2527      }
2528      let result = results[match.route.id];
2529      if (isRedirectDataStrategyResultResult(result)) {
2530        let response = result.result;
2531        throw normalizeRelativeRoutingRedirectResponse(response, request, match.route.id, matches, basename, future.v7_relativeSplatPath);
2532      }
2533      if (isResponse(result.result) && isRouteRequest) {
2534        throw result;
2535      }
2536      dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);
2537    }));
2538    return dataResults;
2539  }
2540  return {
2541    dataRoutes,
2542    query,
2543    queryRoute
2544  };
2545}
2546function getStaticContextFromError(routes, context, error) {
2547  let newContext = _extends({}, context, {
2548    statusCode: isRouteErrorResponse(error) ? error.status : 500,
2549    errors: {
2550      [context._deepestRenderedBoundaryId || routes[0].id]: error
2551    }
2552  });
2553  return newContext;
2554}
2555function throwStaticHandlerAbortedError(request, isRouteRequest, future) {
2556  if (future.v7_throwAbortReason && request.signal.reason !== void 0) {
2557    throw request.signal.reason;
2558  }
2559  let method = isRouteRequest ? "queryRoute" : "query";
2560  throw new Error(method + "() call aborted: " + request.method + " " + request.url);
2561}
2562function isSubmissionNavigation(opts) {
2563  return opts != null && ("formData" in opts && opts.formData != null || "body" in opts && opts.body !== void 0);
2564}
2565function normalizeTo(location, matches, basename, prependBasename, to, v7_relativeSplatPath, fromRouteId, relative) {
2566  let contextualMatches;
2567  let activeRouteMatch;
2568  if (fromRouteId) {
2569    contextualMatches = [];
2570    for (let match of matches) {
2571      contextualMatches.push(match);
2572      if (match.route.id === fromRouteId) {
2573        activeRouteMatch = match;
2574        break;
2575      }
2576    }
2577  } else {
2578    contextualMatches = matches;
2579    activeRouteMatch = matches[matches.length - 1];
2580  }
2581  let path = resolveTo(to ? to : ".", getResolveToMatches(contextualMatches, v7_relativeSplatPath), stripBasename(location.pathname, basename) || location.pathname, relative === "path");
2582  if (to == null) {
2583    path.search = location.search;
2584    path.hash = location.hash;
2585  }
2586  if ((to == null || to === "" || to === ".") && activeRouteMatch) {
2587    let nakedIndex = hasNakedIndexQuery(path.search);
2588    if (activeRouteMatch.route.index && !nakedIndex) {
2589      path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
2590    } else if (!activeRouteMatch.route.index && nakedIndex) {
2591      let params = new URLSearchParams(path.search);
2592      let indexValues = params.getAll("index");
2593      params.delete("index");
2594      indexValues.filter((v) => v).forEach((v) => params.append("index", v));
2595      let qs = params.toString();
2596      path.search = qs ? "?" + qs : "";
2597    }
2598  }
2599  if (prependBasename && basename !== "/") {
2600    path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
2601  }
2602  return createPath(path);
2603}
2604function normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {
2605  if (!opts || !isSubmissionNavigation(opts)) {
2606    return {
2607      path
2608    };
2609  }
2610  if (opts.formMethod && !isValidMethod(opts.formMethod)) {
2611    return {
2612      path,
2613      error: getInternalRouterError(405, {
2614        method: opts.formMethod
2615      })
2616    };
2617  }
2618  let getInvalidBodyError = () => ({
2619    path,
2620    error: getInternalRouterError(400, {
2621      type: "invalid-body"
2622    })
2623  });
2624  let rawFormMethod = opts.formMethod || "get";
2625  let formMethod = normalizeFormMethod ? rawFormMethod.toUpperCase() : rawFormMethod.toLowerCase();
2626  let formAction = stripHashFromPath(path);
2627  if (opts.body !== void 0) {
2628    if (opts.formEncType === "text/plain") {
2629      if (!isMutationMethod(formMethod)) {
2630        return getInvalidBodyError();
2631      }
2632      let text = typeof opts.body === "string" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ? (
2633        // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data
2634        Array.from(opts.body.entries()).reduce((acc, _ref3) => {
2635          let [name, value] = _ref3;
2636          return "" + acc + name + "=" + value + "\n";
2637        }, "")
2638      ) : String(opts.body);
2639      return {
2640        path,
2641        submission: {
2642          formMethod,
2643          formAction,
2644          formEncType: opts.formEncType,
2645          formData: void 0,
2646          json: void 0,
2647          text
2648        }
2649      };
2650    } else if (opts.formEncType === "application/json") {
2651      if (!isMutationMethod(formMethod)) {
2652        return getInvalidBodyError();
2653      }
2654      try {
2655        let json4 = typeof opts.body === "string" ? JSON.parse(opts.body) : opts.body;
2656        return {
2657          path,
2658          submission: {
2659            formMethod,
2660            formAction,
2661            formEncType: opts.formEncType,
2662            formData: void 0,
2663            json: json4,
2664            text: void 0
2665          }
2666        };
2667      } catch (e) {
2668        return getInvalidBodyError();
2669      }
2670    }
2671  }
2672  invariant(typeof FormData === "function", "FormData is not available in this environment");
2673  let searchParams;
2674  let formData;
2675  if (opts.formData) {
2676    searchParams = convertFormDataToSearchParams(opts.formData);
2677    formData = opts.formData;
2678  } else if (opts.body instanceof FormData) {
2679    searchParams = convertFormDataToSearchParams(opts.body);
2680    formData = opts.body;
2681  } else if (opts.body instanceof URLSearchParams) {
2682    searchParams = opts.body;
2683    formData = convertSearchParamsToFormData(searchParams);
2684  } else if (opts.body == null) {
2685    searchParams = new URLSearchParams();
2686    formData = new FormData();
2687  } else {
2688    try {
2689      searchParams = new URLSearchParams(opts.body);
2690      formData = convertSearchParamsToFormData(searchParams);
2691    } catch (e) {
2692      return getInvalidBodyError();
2693    }
2694  }
2695  let submission = {
2696    formMethod,
2697    formAction,
2698    formEncType: opts && opts.formEncType || "application/x-www-form-urlencoded",
2699    formData,
2700    json: void 0,
2701    text: void 0
2702  };
2703  if (isMutationMethod(submission.formMethod)) {
2704    return {
2705      path,
2706      submission
2707    };
2708  }
2709  let parsedPath = parsePath(path);
2710  if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) {
2711    searchParams.append("index", "");
2712  }
2713  parsedPath.search = "?" + searchParams;
2714  return {
2715    path: createPath(parsedPath),
2716    submission
2717  };
2718}
2719function getLoaderMatchesUntilBoundary(matches, boundaryId, includeBoundary) {
2720  if (includeBoundary === void 0) {
2721    includeBoundary = false;
2722  }
2723  let index = matches.findIndex((m) => m.route.id === boundaryId);
2724  if (index >= 0) {
2725    return matches.slice(0, includeBoundary ? index + 1 : index);
2726  }
2727  return matches;
2728}
2729function getMatchesToLoad(history, state, matches, submission, location, initialHydration, skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) {
2730  let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0;
2731  let currentUrl = history.createURL(state.location);
2732  let nextUrl = history.createURL(location);
2733  let boundaryMatches = matches;
2734  if (initialHydration && state.errors) {
2735    boundaryMatches = getLoaderMatchesUntilBoundary(matches, Object.keys(state.errors)[0], true);
2736  } else if (pendingActionResult && isErrorResult(pendingActionResult[1])) {
2737    boundaryMatches = getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]);
2738  }
2739  let actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : void 0;
2740  let shouldSkipRevalidation = skipActionErrorRevalidation && actionStatus && actionStatus >= 400;
2741  let navigationMatches = boundaryMatches.filter((match, index) => {
2742    let {
2743      route
2744    } = match;
2745    if (route.lazy) {
2746      return true;
2747    }
2748    if (route.loader == null) {
2749      return false;
2750    }
2751    if (initialHydration) {
2752      return shouldLoadRouteOnHydration(route, state.loaderData, state.errors);
2753    }
2754    if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some((id) => id === match.route.id)) {
2755      return true;
2756    }
2757    let currentRouteMatch = state.matches[index];
2758    let nextRouteMatch = match;
2759    return shouldRevalidateLoader(match, _extends({
2760      currentUrl,
2761      currentParams: currentRouteMatch.params,
2762      nextUrl,
2763      nextParams: nextRouteMatch.params
2764    }, submission, {
2765      actionResult,
2766      actionStatus,
2767      defaultShouldRevalidate: shouldSkipRevalidation ? false : (
2768        // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate
2769        isRevalidationRequired || currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search || // Search params affect all loaders
2770        currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)
2771      )
2772    }));
2773  });
2774  let revalidatingFetchers = [];
2775  fetchLoadMatches.forEach((f, key) => {
2776    if (initialHydration || !matches.some((m) => m.route.id === f.routeId) || deletedFetchers.has(key)) {
2777      return;
2778    }
2779    let fetcherMatches = matchRoutes(routesToUse, f.path, basename);
2780    if (!fetcherMatches) {
2781      revalidatingFetchers.push({
2782        key,
2783        routeId: f.routeId,
2784        path: f.path,
2785        matches: null,
2786        match: null,
2787        controller: null
2788      });
2789      return;
2790    }
2791    let fetcher = state.fetchers.get(key);
2792    let fetcherMatch = getTargetMatch(fetcherMatches, f.path);
2793    let shouldRevalidate = false;
2794    if (fetchRedirectIds.has(key)) {
2795      shouldRevalidate = false;
2796    } else if (cancelledFetcherLoads.has(key)) {
2797      cancelledFetcherLoads.delete(key);
2798      shouldRevalidate = true;
2799    } else if (fetcher && fetcher.state !== "idle" && fetcher.data === void 0) {
2800      shouldRevalidate = isRevalidationRequired;
2801    } else {
2802      shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends({
2803        currentUrl,
2804        currentParams: state.matches[state.matches.length - 1].params,
2805        nextUrl,
2806        nextParams: matches[matches.length - 1].params
2807      }, submission, {
2808        actionResult,
2809        actionStatus,
2810        defaultShouldRevalidate: shouldSkipRevalidation ? false : isRevalidationRequired
2811      }));
2812    }
2813    if (shouldRevalidate) {
2814      revalidatingFetchers.push({
2815        key,
2816        routeId: f.routeId,
2817        path: f.path,
2818        matches: fetcherMatches,
2819        match: fetcherMatch,
2820        controller: new AbortController()
2821      });
2822    }
2823  });
2824  return [navigationMatches, revalidatingFetchers];
2825}
2826function shouldLoadRouteOnHydration(route, loaderData, errors) {
2827  if (route.lazy) {
2828    return true;
2829  }
2830  if (!route.loader) {
2831    return false;
2832  }
2833  let hasData = loaderData != null && loaderData[route.id] !== void 0;
2834  let hasError = errors != null && errors[route.id] !== void 0;
2835  if (!hasData && hasError) {
2836    return false;
2837  }
2838  if (typeof route.loader === "function" && route.loader.hydrate === true) {
2839    return true;
2840  }
2841  return !hasData && !hasError;
2842}
2843function isNewLoader(currentLoaderData, currentMatch, match) {
2844  let isNew = (
2845    // [a] -> [a, b]
2846    !currentMatch || // [a, b] -> [a, c]
2847    match.route.id !== currentMatch.route.id
2848  );
2849  let isMissingData = currentLoaderData[match.route.id] === void 0;
2850  return isNew || isMissingData;
2851}
2852function isNewRouteInstance(currentMatch, match) {
2853  let currentPath = currentMatch.route.path;
2854  return (
2855    // param change for this match, /users/123 -> /users/456
2856    currentMatch.pathname !== match.pathname || // splat param changed, which is not present in match.path
2857    // e.g. /files/images/avatar.jpg -> files/finances.xls
2858    currentPath != null && currentPath.endsWith("*") && currentMatch.params["*"] !== match.params["*"]
2859  );
2860}
2861function shouldRevalidateLoader(loaderMatch, arg) {
2862  if (loaderMatch.route.shouldRevalidate) {
2863    let routeChoice = loaderMatch.route.shouldRevalidate(arg);
2864    if (typeof routeChoice === "boolean") {
2865      return routeChoice;
2866    }
2867  }
2868  return arg.defaultShouldRevalidate;
2869}
2870function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties) {
2871  var _childrenToPatch;
2872  let childrenToPatch;
2873  if (routeId) {
2874    let route = manifest[routeId];
2875    invariant(route, "No route found to patch children into: routeId = " + routeId);
2876    if (!route.children) {
2877      route.children = [];
2878    }
2879    childrenToPatch = route.children;
2880  } else {
2881    childrenToPatch = routesToUse;
2882  }
2883  let uniqueChildren = children.filter((newRoute) => !childrenToPatch.some((existingRoute) => isSameRoute(newRoute, existingRoute)));
2884  let newRoutes = convertRoutesToDataRoutes(uniqueChildren, mapRouteProperties, [routeId || "_", "patch", String(((_childrenToPatch = childrenToPatch) == null ? void 0 : _childrenToPatch.length) || "0")], manifest);
2885  childrenToPatch.push(...newRoutes);
2886}
2887function isSameRoute(newRoute, existingRoute) {
2888  if ("id" in newRoute && "id" in existingRoute && newRoute.id === existingRoute.id) {
2889    return true;
2890  }
2891  if (!(newRoute.index === existingRoute.index && newRoute.path === existingRoute.path && newRoute.caseSensitive === existingRoute.caseSensitive)) {
2892    return false;
2893  }
2894  if ((!newRoute.children || newRoute.children.length === 0) && (!existingRoute.children || existingRoute.children.length === 0)) {
2895    return true;
2896  }
2897  return newRoute.children.every((aChild, i) => {
2898    var _existingRoute$childr;
2899    return (_existingRoute$childr = existingRoute.children) == null ? void 0 : _existingRoute$childr.some((bChild) => isSameRoute(aChild, bChild));
2900  });
2901}
2902async function loadLazyRouteModule(route, mapRouteProperties, manifest) {
2903  if (!route.lazy) {
2904    return;
2905  }
2906  let lazyRoute = await route.lazy();
2907  if (!route.lazy) {
2908    return;
2909  }
2910  let routeToUpdate = manifest[route.id];
2911  invariant(routeToUpdate, "No route found in manifest");
2912  let routeUpdates = {};
2913  for (let lazyRouteProperty in lazyRoute) {
2914    let staticRouteValue = routeToUpdate[lazyRouteProperty];
2915    let isPropertyStaticallyDefined = staticRouteValue !== void 0 && // This property isn't static since it should always be updated based
2916    // on the route updates
2917    lazyRouteProperty !== "hasErrorBoundary";
2918    warning(!isPropertyStaticallyDefined, 'Route "' + routeToUpdate.id + '" has a static property "' + lazyRouteProperty + '" defined but its lazy function is also returning a value for this property. ' + ('The lazy route property "' + lazyRouteProperty + '" will be ignored.'));
2919    if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) {
2920      routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty];
2921    }
2922  }
2923  Object.assign(routeToUpdate, routeUpdates);
2924  Object.assign(routeToUpdate, _extends({}, mapRouteProperties(routeToUpdate), {
2925    lazy: void 0
2926  }));
2927}
2928async function defaultDataStrategy(_ref4) {
2929  let {
2930    matches
2931  } = _ref4;
2932  let matchesToLoad = matches.filter((m) => m.shouldLoad);
2933  let results = await Promise.all(matchesToLoad.map((m) => m.resolve()));
2934  return results.reduce((acc, result, i) => Object.assign(acc, {
2935    [matchesToLoad[i].route.id]: result
2936  }), {});
2937}
2938async function callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties, requestContext) {
2939  let loadRouteDefinitionsPromises = matches.map((m) => m.route.lazy ? loadLazyRouteModule(m.route, mapRouteProperties, manifest) : void 0);
2940  let dsMatches = matches.map((match, i) => {
2941    let loadRoutePromise = loadRouteDefinitionsPromises[i];
2942    let shouldLoad = matchesToLoad.some((m) => m.route.id === match.route.id);
2943    let resolve = async (handlerOverride) => {
2944      if (handlerOverride && request.method === "GET" && (match.route.lazy || match.route.loader)) {
2945        shouldLoad = true;
2946      }
2947      return shouldLoad ? callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, requestContext) : Promise.resolve({
2948        type: ResultType.data,
2949        result: void 0
2950      });
2951    };
2952    return _extends({}, match, {
2953      shouldLoad,
2954      resolve
2955    });
2956  });
2957  let results = await dataStrategyImpl({
2958    matches: dsMatches,
2959    request,
2960    params: matches[0].params,
2961    fetcherKey,
2962    context: requestContext
2963  });
2964  try {
2965    await Promise.all(loadRouteDefinitionsPromises);
2966  } catch (e) {
2967  }
2968  return results;
2969}
2970async function callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, staticContext) {
2971  let result;
2972  let onReject;
2973  let runHandler = (handler) => {
2974    let reject;
2975    let abortPromise = new Promise((_, r) => reject = r);
2976    onReject = () => reject();
2977    request.signal.addEventListener("abort", onReject);
2978    let actualHandler = (ctx) => {
2979      if (typeof handler !== "function") {
2980        return Promise.reject(new Error("You cannot call the handler for a route which defines a boolean " + ('"' + type + '" [routeId: ' + match.route.id + "]")));
2981      }
2982      return handler({
2983        request,
2984        params: match.params,
2985        context: staticContext
2986      }, ...ctx !== void 0 ? [ctx] : []);
2987    };
2988    let handlerPromise = (async () => {
2989      try {
2990        let val = await (handlerOverride ? handlerOverride((ctx) => actualHandler(ctx)) : actualHandler());
2991        return {
2992          type: "data",
2993          result: val
2994        };
2995      } catch (e) {
2996        return {
2997          type: "error",
2998          result: e
2999        };
3000      }
3001    })();
3002    return Promise.race([handlerPromise, abortPromise]);
3003  };
3004  try {
3005    let handler = match.route[type];
3006    if (loadRoutePromise) {
3007      if (handler) {
3008        let handlerError;
3009        let [value] = await Promise.all([
3010          // If the handler throws, don't let it immediately bubble out,
3011          // since we need to let the lazy() execution finish so we know if this
3012          // route has a boundary that can handle the error
3013          runHandler(handler).catch((e) => {
3014            handlerError = e;
3015          }),
3016          loadRoutePromise
3017        ]);
3018        if (handlerError !== void 0) {
3019          throw handlerError;
3020        }
3021        result = value;
3022      } else {
3023        await loadRoutePromise;
3024        handler = match.route[type];
3025        if (handler) {
3026          result = await runHandler(handler);
3027        } else if (type === "action") {
3028          let url = new URL(request.url);
3029          let pathname = url.pathname + url.search;
3030          throw getInternalRouterError(405, {
3031            method: request.method,
3032            pathname,
3033            routeId: match.route.id
3034          });
3035        } else {
3036          return {
3037            type: ResultType.data,
3038            result: void 0
3039          };
3040        }
3041      }
3042    } else if (!handler) {
3043      let url = new URL(request.url);
3044      let pathname = url.pathname + url.search;
3045      throw getInternalRouterError(404, {
3046        pathname
3047      });
3048    } else {
3049      result = await runHandler(handler);
3050    }
3051    invariant(result.result !== void 0, "You defined " + (type === "action" ? "an action" : "a loader") + " for route " + ('"' + match.route.id + "\" but didn't return anything from your `" + type + "` ") + "function. Please return a value or `null`.");
3052  } catch (e) {
3053    return {
3054      type: ResultType.error,
3055      result: e
3056    };
3057  } finally {
3058    if (onReject) {
3059      request.signal.removeEventListener("abort", onReject);
3060    }
3061  }
3062  return result;
3063}
3064async function convertDataStrategyResultToDataResult(dataStrategyResult) {
3065  let {
3066    result,
3067    type
3068  } = dataStrategyResult;
3069  if (isResponse(result)) {
3070    let data3;
3071    try {
3072      let contentType = result.headers.get("Content-Type");
3073      if (contentType && /\bapplication\/json\b/.test(contentType)) {
3074        if (result.body == null) {
3075          data3 = null;
3076        } else {
3077          data3 = await result.json();
3078        }
3079      } else {
3080        data3 = await result.text();
3081      }
3082    } catch (e) {
3083      return {
3084        type: ResultType.error,
3085        error: e
3086      };
3087    }
3088    if (type === ResultType.error) {
3089      return {
3090        type: ResultType.error,
3091        error: new ErrorResponseImpl(result.status, result.statusText, data3),
3092        statusCode: result.status,
3093        headers: result.headers
3094      };
3095    }
3096    return {
3097      type: ResultType.data,
3098      data: data3,
3099      statusCode: result.status,
3100      headers: result.headers
3101    };
3102  }
3103  if (type === ResultType.error) {
3104    if (isDataWithResponseInit(result)) {
3105      var _result$init3, _result$init4;
3106      if (result.data instanceof Error) {
3107        var _result$init, _result$init2;
3108        return {
3109          type: ResultType.error,
3110          error: result.data,
3111          statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,
3112          headers: (_result$init2 = result.init) != null && _result$init2.headers ? new Headers(result.init.headers) : void 0
3113        };
3114      }
3115      return {
3116        type: ResultType.error,
3117        error: new ErrorResponseImpl(((_result$init3 = result.init) == null ? void 0 : _result$init3.status) || 500, void 0, result.data),
3118        statusCode: isRouteErrorResponse(result) ? result.status : void 0,
3119        headers: (_result$init4 = result.init) != null && _result$init4.headers ? new Headers(result.init.headers) : void 0
3120      };
3121    }
3122    return {
3123      type: ResultType.error,
3124      error: result,
3125      statusCode: isRouteErrorResponse(result) ? result.status : void 0
3126    };
3127  }
3128  if (isDeferredData(result)) {
3129    var _result$init5, _result$init6;
3130    return {
3131      type: ResultType.deferred,
3132      deferredData: result,
3133      statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status,
3134      headers: ((_result$init6 = result.init) == null ? void 0 : _result$init6.headers) && new Headers(result.init.headers)
3135    };
3136  }
3137  if (isDataWithResponseInit(result)) {
3138    var _result$init7, _result$init8;
3139    return {
3140      type: ResultType.data,
3141      data: result.data,
3142      statusCode: (_result$init7 = result.init) == null ? void 0 : _result$init7.status,
3143      headers: (_result$init8 = result.init) != null && _result$init8.headers ? new Headers(result.init.headers) : void 0
3144    };
3145  }
3146  return {
3147    type: ResultType.data,
3148    data: result
3149  };
3150}
3151function normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, v7_relativeSplatPath) {
3152  let location = response.headers.get("Location");
3153  invariant(location, "Redirects returned/thrown from loaders/actions must have a Location header");
3154  if (!ABSOLUTE_URL_REGEX.test(location)) {
3155    let trimmedMatches = matches.slice(0, matches.findIndex((m) => m.route.id === routeId) + 1);
3156    location = normalizeTo(new URL(request.url), trimmedMatches, basename, true, location, v7_relativeSplatPath);
3157    response.headers.set("Location", location);
3158  }
3159  return response;
3160}
3161function normalizeRedirectLocation(location, currentUrl, basename, historyInstance) {
3162  let invalidProtocols = [
3163    "about:",
3164    "blob:",
3165    "chrome:",
3166    "chrome-untrusted:",
3167    "content:",
3168    "data:",
3169    "devtools:",
3170    "file:",
3171    "filesystem:",
3172    // eslint-disable-next-line no-script-url
3173    "javascript:"
3174  ];
3175  if (ABSOLUTE_URL_REGEX.test(location)) {
3176    let normalizedLocation = location;
3177    let url = normalizedLocation.startsWith("//") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);
3178    if (invalidProtocols.includes(url.protocol)) {
3179      throw new Error("Invalid redirect location");
3180    }
3181    let isSameBasename = stripBasename(url.pathname, basename) != null;
3182    if (url.origin === currentUrl.origin && isSameBasename) {
3183      return url.pathname + url.search + url.hash;
3184    }
3185  }
3186  try {
3187    let url = historyInstance.createURL(location);
3188    if (invalidProtocols.includes(url.protocol)) {
3189      throw new Error("Invalid redirect location");
3190    }
3191  } catch (e) {
3192  }
3193  return location;
3194}
3195function createClientSideRequest(history, location, signal, submission) {
3196  let url = history.createURL(stripHashFromPath(location)).toString();
3197  let init = {
3198    signal
3199  };
3200  if (submission && isMutationMethod(submission.formMethod)) {
3201    let {
3202      formMethod,
3203      formEncType
3204    } = submission;
3205    init.method = formMethod.toUpperCase();
3206    if (formEncType === "application/json") {
3207      init.headers = new Headers({
3208        "Content-Type": formEncType
3209      });
3210      init.body = JSON.stringify(submission.json);
3211    } else if (formEncType === "text/plain") {
3212      init.body = submission.text;
3213    } else if (formEncType === "application/x-www-form-urlencoded" && submission.formData) {
3214      init.body = convertFormDataToSearchParams(submission.formData);
3215    } else {
3216      init.body = submission.formData;
3217    }
3218  }
3219  return new Request(url, init);
3220}
3221function convertFormDataToSearchParams(formData) {
3222  let searchParams = new URLSearchParams();
3223  for (let [key, value] of formData.entries()) {
3224    searchParams.append(key, typeof value === "string" ? value : value.name);
3225  }
3226  return searchParams;
3227}
3228function convertSearchParamsToFormData(searchParams) {
3229  let formData = new FormData();
3230  for (let [key, value] of searchParams.entries()) {
3231    formData.append(key, value);
3232  }
3233  return formData;
3234}
3235function processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling) {
3236  let loaderData = {};
3237  let errors = null;
3238  let statusCode;
3239  let foundError = false;
3240  let loaderHeaders = {};
3241  let pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : void 0;
3242  matches.forEach((match) => {
3243    if (!(match.route.id in results)) {
3244      return;
3245    }
3246    let id = match.route.id;
3247    let result = results[id];
3248    invariant(!isRedirectResult(result), "Cannot handle redirect results in processLoaderData");
3249    if (isErrorResult(result)) {
3250      let error = result.error;
3251      if (pendingError !== void 0) {
3252        error = pendingError;
3253        pendingError = void 0;
3254      }
3255      errors = errors || {};
3256      if (skipLoaderErrorBubbling) {
3257        errors[id] = error;
3258      } else {
3259        let boundaryMatch = findNearestBoundary(matches, id);
3260        if (errors[boundaryMatch.route.id] == null) {
3261          errors[boundaryMatch.route.id] = error;
3262        }
3263      }
3264      loaderData[id] = void 0;
3265      if (!foundError) {
3266        foundError = true;
3267        statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;
3268      }
3269      if (result.headers) {
3270        loaderHeaders[id] = result.headers;
3271      }
3272    } else {
3273      if (isDeferredResult(result)) {
3274        activeDeferreds.set(id, result.deferredData);
3275        loaderData[id] = result.deferredData.data;
3276        if (result.statusCode != null && result.statusCode !== 200 && !foundError) {
3277          statusCode = result.statusCode;
3278        }
3279        if (result.headers) {
3280          loaderHeaders[id] = result.headers;
3281        }
3282      } else {
3283        loaderData[id] = result.data;
3284        if (result.statusCode && result.statusCode !== 200 && !foundError) {
3285          statusCode = result.statusCode;
3286        }
3287        if (result.headers) {
3288          loaderHeaders[id] = result.headers;
3289        }
3290      }
3291    }
3292  });
3293  if (pendingError !== void 0 && pendingActionResult) {
3294    errors = {
3295      [pendingActionResult[0]]: pendingError
3296    };
3297    loaderData[pendingActionResult[0]] = void 0;
3298  }
3299  return {
3300    loaderData,
3301    errors,
3302    statusCode: statusCode || 200,
3303    loaderHeaders
3304  };
3305}
3306function processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds) {
3307  let {
3308    loaderData,
3309    errors
3310  } = processRouteLoaderData(
3311    matches,
3312    results,
3313    pendingActionResult,
3314    activeDeferreds,
3315    false
3316    // This method is only called client side so we always want to bubble
3317  );
3318  revalidatingFetchers.forEach((rf) => {
3319    let {
3320      key,
3321      match,
3322      controller
3323    } = rf;
3324    let result = fetcherResults[key];
3325    invariant(result, "Did not find corresponding fetcher result");
3326    if (controller && controller.signal.aborted) {
3327      return;
3328    } else if (isErrorResult(result)) {
3329      let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id);
3330      if (!(errors && errors[boundaryMatch.route.id])) {
3331        errors = _extends({}, errors, {
3332          [boundaryMatch.route.id]: result.error
3333        });
3334      }
3335      state.fetchers.delete(key);
3336    } else if (isRedirectResult(result)) {
3337      invariant(false, "Unhandled fetcher revalidation redirect");
3338    } else if (isDeferredResult(result)) {
3339      invariant(false, "Unhandled fetcher deferred data");
3340    } else {
3341      let doneFetcher = getDoneFetcher(result.data);
3342      state.fetchers.set(key, doneFetcher);
3343    }
3344  });
3345  return {
3346    loaderData,
3347    errors
3348  };
3349}
3350function mergeLoaderData(loaderData, newLoaderData, matches, errors) {
3351  let mergedLoaderData = _extends({}, newLoaderData);
3352  for (let match of matches) {
3353    let id = match.route.id;
3354    if (newLoaderData.hasOwnProperty(id)) {
3355      if (newLoaderData[id] !== void 0) {
3356        mergedLoaderData[id] = newLoaderData[id];
3357      }
3358    } else if (loaderData[id] !== void 0 && match.route.loader) {
3359      mergedLoaderData[id] = loaderData[id];
3360    }
3361    if (errors && errors.hasOwnProperty(id)) {
3362      break;
3363    }
3364  }
3365  return mergedLoaderData;
3366}
3367function getActionDataForCommit(pendingActionResult) {
3368  if (!pendingActionResult) {
3369    return {};
3370  }
3371  return isErrorResult(pendingActionResult[1]) ? {
3372    // Clear out prior actionData on errors
3373    actionData: {}
3374  } : {
3375    actionData: {
3376      [pendingActionResult[0]]: pendingActionResult[1].data
3377    }
3378  };
3379}
3380function findNearestBoundary(matches, routeId) {
3381  let eligibleMatches = routeId ? matches.slice(0, matches.findIndex((m) => m.route.id === routeId) + 1) : [...matches];
3382  return eligibleMatches.reverse().find((m) => m.route.hasErrorBoundary === true) || matches[0];
3383}
3384function getShortCircuitMatches(routes) {
3385  let route = routes.length === 1 ? routes[0] : routes.find((r) => r.index || !r.path || r.path === "/") || {
3386    id: "__shim-error-route__"
3387  };
3388  return {
3389    matches: [{
3390      params: {},
3391      pathname: "",
3392      pathnameBase: "",
3393      route
3394    }],
3395    route
3396  };
3397}
3398function getInternalRouterError(status, _temp5) {
3399  let {
3400    pathname,
3401    routeId,
3402    method,
3403    type,
3404    message
3405  } = _temp5 === void 0 ? {} : _temp5;
3406  let statusText = "Unknown Server Error";
3407  let errorMessage = "Unknown @remix-run/router error";
3408  if (status === 400) {
3409    statusText = "Bad Request";
3410    if (method && pathname && routeId) {
3411      errorMessage = "You made a " + method + ' request to "' + pathname + '" but ' + ('did not provide a `loader` for route "' + routeId + '", ') + "so there is no way to handle the request.";
3412    } else if (type === "defer-action") {
3413      errorMessage = "defer() is not supported in actions";
3414    } else if (type === "invalid-body") {
3415      errorMessage = "Unable to encode submission body";
3416    }
3417  } else if (status === 403) {
3418    statusText = "Forbidden";
3419    errorMessage = 'Route "' + routeId + '" does not match URL "' + pathname + '"';
3420  } else if (status === 404) {
3421    statusText = "Not Found";
3422    errorMessage = 'No route matches URL "' + pathname + '"';
3423  } else if (status === 405) {
3424    statusText = "Method Not Allowed";
3425    if (method && pathname && routeId) {
3426      errorMessage = "You made a " + method.toUpperCase() + ' request to "' + pathname + '" but ' + ('did not provide an `action` for route "' + routeId + '", ') + "so there is no way to handle the request.";
3427    } else if (method) {
3428      errorMessage = 'Invalid request method "' + method.toUpperCase() + '"';
3429    }
3430  }
3431  return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);
3432}
3433function findRedirect(results) {
3434  let entries = Object.entries(results);
3435  for (let i = entries.length - 1; i >= 0; i--) {
3436    let [key, result] = entries[i];
3437    if (isRedirectResult(result)) {
3438      return {
3439        key,
3440        result
3441      };
3442    }
3443  }
3444}
3445function stripHashFromPath(path) {
3446  let parsedPath = typeof path === "string" ? parsePath(path) : path;
3447  return createPath(_extends({}, parsedPath, {
3448    hash: ""
3449  }));
3450}
3451function isHashChangeOnly(a, b) {
3452  if (a.pathname !== b.pathname || a.search !== b.search) {
3453    return false;
3454  }
3455  if (a.hash === "") {
3456    return b.hash !== "";
3457  } else if (a.hash === b.hash) {
3458    return true;
3459  } else if (b.hash !== "") {
3460    return true;
3461  }
3462  return false;
3463}
3464function isDataStrategyResult(result) {
3465  return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === ResultType.data || result.type === ResultType.error);
3466}
3467function isRedirectDataStrategyResultResult(result) {
3468  return isResponse(result.result) && redirectStatusCodes.has(result.result.status);
3469}
3470function isDeferredResult(result) {
3471  return result.type === ResultType.deferred;
3472}
3473function isErrorResult(result) {
3474  return result.type === ResultType.error;
3475}
3476function isRedirectResult(result) {
3477  return (result && result.type) === ResultType.redirect;
3478}
3479function isDataWithResponseInit(value) {
3480  return typeof value === "object" && value != null && "type" in value && "data" in value && "init" in value && value.type === "DataWithResponseInit";
3481}
3482function isDeferredData(value) {
3483  let deferred = value;
3484  return deferred && typeof deferred === "object" && typeof deferred.data === "object" && typeof deferred.subscribe === "function" && typeof deferred.cancel === "function" && typeof deferred.resolveData === "function";
3485}
3486function isResponse(value) {
3487  return value != null && typeof value.status === "number" && typeof value.statusText === "string" && typeof value.headers === "object" && typeof value.body !== "undefined";
3488}
3489function isRedirectResponse(result) {
3490  if (!isResponse(result)) {
3491    return false;
3492  }
3493  let status = result.status;
3494  let location = result.headers.get("Location");
3495  return status >= 300 && status <= 399 && location != null;
3496}
3497function isValidMethod(method) {
3498  return validRequestMethods.has(method.toLowerCase());
3499}
3500function isMutationMethod(method) {
3501  return validMutationMethods.has(method.toLowerCase());
3502}
3503async function resolveNavigationDeferredResults(matches, results, signal, currentMatches, currentLoaderData) {
3504  let entries = Object.entries(results);
3505  for (let index = 0; index < entries.length; index++) {
3506    let [routeId, result] = entries[index];
3507    let match = matches.find((m) => (m == null ? void 0 : m.route.id) === routeId);
3508    if (!match) {
3509      continue;
3510    }
3511    let currentMatch = currentMatches.find((m) => m.route.id === match.route.id);
3512    let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== void 0;
3513    if (isDeferredResult(result) && isRevalidatingLoader) {
3514      await resolveDeferredData(result, signal, false).then((result2) => {
3515        if (result2) {
3516          results[routeId] = result2;
3517        }
3518      });
3519    }
3520  }
3521}
3522async function resolveFetcherDeferredResults(matches, results, revalidatingFetchers) {
3523  for (let index = 0; index < revalidatingFetchers.length; index++) {
3524    let {
3525      key,
3526      routeId,
3527      controller
3528    } = revalidatingFetchers[index];
3529    let result = results[key];
3530    let match = matches.find((m) => (m == null ? void 0 : m.route.id) === routeId);
3531    if (!match) {
3532      continue;
3533    }
3534    if (isDeferredResult(result)) {
3535      invariant(controller, "Expected an AbortController for revalidating fetcher deferred result");
3536      await resolveDeferredData(result, controller.signal, true).then((result2) => {
3537        if (result2) {
3538          results[key] = result2;
3539        }
3540      });
3541    }
3542  }
3543}
3544async function resolveDeferredData(result, signal, unwrap) {
3545  if (unwrap === void 0) {
3546    unwrap = false;
3547  }
3548  let aborted = await result.deferredData.resolveData(signal);
3549  if (aborted) {
3550    return;
3551  }
3552  if (unwrap) {
3553    try {
3554      return {
3555        type: ResultType.data,
3556        data: result.deferredData.unwrappedData
3557      };
3558    } catch (e) {
3559      return {
3560        type: ResultType.error,
3561        error: e
3562      };
3563    }
3564  }
3565  return {
3566    type: ResultType.data,
3567    data: result.deferredData.data
3568  };
3569}
3570function hasNakedIndexQuery(search) {
3571  return new URLSearchParams(search).getAll("index").some((v) => v === "");
3572}
3573function getTargetMatch(matches, location) {
3574  let search = typeof location === "string" ? parsePath(location).search : location.search;
3575  if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || "")) {
3576    return matches[matches.length - 1];
3577  }
3578  let pathMatches = getPathContributingMatches(matches);
3579  return pathMatches[pathMatches.length - 1];
3580}
3581function getSubmissionFromNavigation(navigation) {
3582  let {
3583    formMethod,
3584    formAction,
3585    formEncType,
3586    text,
3587    formData,
3588    json: json4
3589  } = navigation;
3590  if (!formMethod || !formAction || !formEncType) {
3591    return;
3592  }
3593  if (text != null) {
3594    return {
3595      formMethod,
3596      formAction,
3597      formEncType,
3598      formData: void 0,
3599      json: void 0,
3600      text
3601    };
3602  } else if (formData != null) {
3603    return {
3604      formMethod,
3605      formAction,
3606      formEncType,
3607      formData,
3608      json: void 0,
3609      text: void 0
3610    };
3611  } else if (json4 !== void 0) {
3612    return {
3613      formMethod,
3614      formAction,
3615      formEncType,
3616      formData: void 0,
3617      json: json4,
3618      text: void 0
3619    };
3620  }
3621}
3622function getLoadingNavigation(location, submission) {
3623  if (submission) {
3624    let navigation = {
3625      state: "loading",
3626      location,
3627      formMethod: submission.formMethod,
3628      formAction: submission.formAction,
3629      formEncType: submission.formEncType,
3630      formData: submission.formData,
3631      json: submission.json,
3632      text: submission.text
3633    };
3634    return navigation;
3635  } else {
3636    let navigation = {
3637      state: "loading",
3638      location,
3639      formMethod: void 0,
3640      formAction: void 0,
3641      formEncType: void 0,
3642      formData: void 0,
3643      json: void 0,
3644      text: void 0
3645    };
3646    return navigation;
3647  }
3648}
3649function getSubmittingNavigation(location, submission) {
3650  let navigation = {
3651    state: "submitting",
3652    location,
3653    formMethod: submission.formMethod,
3654    formAction: submission.formAction,
3655    formEncType: submission.formEncType,
3656    formData: submission.formData,
3657    json: submission.json,
3658    text: submission.text
3659  };
3660  return navigation;
3661}
3662function getLoadingFetcher(submission, data3) {
3663  if (submission) {
3664    let fetcher = {
3665      state: "loading",
3666      formMethod: submission.formMethod,
3667      formAction: submission.formAction,
3668      formEncType: submission.formEncType,
3669      formData: submission.formData,
3670      json: submission.json,
3671      text: submission.text,
3672      data: data3
3673    };
3674    return fetcher;
3675  } else {
3676    let fetcher = {
3677      state: "loading",
3678      formMethod: void 0,
3679      formAction: void 0,
3680      formEncType: void 0,
3681      formData: void 0,
3682      json: void 0,
3683      text: void 0,
3684      data: data3
3685    };
3686    return fetcher;
3687  }
3688}
3689function getSubmittingFetcher(submission, existingFetcher) {
3690  let fetcher = {
3691    state: "submitting",
3692    formMethod: submission.formMethod,
3693    formAction: submission.formAction,
3694    formEncType: submission.formEncType,
3695    formData: submission.formData,
3696    json: submission.json,
3697    text: submission.text,
3698    data: existingFetcher ? existingFetcher.data : void 0
3699  };
3700  return fetcher;
3701}
3702function getDoneFetcher(data3) {
3703  let fetcher = {
3704    state: "idle",
3705    formMethod: void 0,
3706    formAction: void 0,
3707    formEncType: void 0,
3708    formData: void 0,
3709    json: void 0,
3710    text: void 0,
3711    data: data3
3712  };
3713  return fetcher;
3714}
3715function restoreAppliedTransitions(_window, transitions) {
3716  try {
3717    let sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY);
3718    if (sessionPositions) {
3719      let json4 = JSON.parse(sessionPositions);
3720      for (let [k, v] of Object.entries(json4 || {})) {
3721        if (v && Array.isArray(v)) {
3722          transitions.set(k, new Set(v || []));
3723        }
3724      }
3725    }
3726  } catch (e) {
3727  }
3728}
3729function persistAppliedTransitions(_window, transitions) {
3730  if (transitions.size > 0) {
3731    let json4 = {};
3732    for (let [k, v] of transitions) {
3733      json4[k] = [...v];
3734    }
3735    try {
3736      _window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json4));
3737    } catch (error) {
3738      warning(false, "Failed to save applied view transitions in sessionStorage (" + error + ").");
3739    }
3740  }
3741}
3742var import_dist, import_dist2, import_dist3, Action, PopStateEventType, ResultType, immutableRouteKeys, paramRe, dynamicSegmentValue, indexRouteValue, emptySegmentValue, staticSegmentValue, splatPenalty, isSplat, ABSOLUTE_URL_REGEX$1, isAbsoluteUrl, joinPaths, normalizePathname, normalizeSearch, normalizeHash, json, DataWithResponseInit, AbortedDeferredError, DeferredData, defer, redirect, redirectDocument, replace, ErrorResponseImpl, validMutationMethodsArr, validMutationMethods, validRequestMethodsArr, validRequestMethods, redirectStatusCodes, redirectPreserveMethodStatusCodes, IDLE_NAVIGATION, IDLE_FETCHER, IDLE_BLOCKER, ABSOLUTE_URL_REGEX, defaultMapRouteProperties, TRANSITIONS_STORAGE_KEY, UNSAFE_DEFERRED_SYMBOL;
3743var init_router = __esm({
3744  "node_modules/.pnpm/@[email protected]/node_modules/@remix-run/router/dist/router.js"() {
3745    import_dist = __toESM(require_dist());
3746    import_dist2 = __toESM(require_dist2());
3747    import_dist3 = __toESM(require_dist3());
3748    (function(Action2) {
3749      Action2["Pop"] = "POP";
3750      Action2["Push"] = "PUSH";
3751      Action2["Replace"] = "REPLACE";
3752    })(Action || (Action = {}));
3753    PopStateEventType = "popstate";
3754    (function(ResultType2) {
3755      ResultType2["data"] = "data";
3756      ResultType2["deferred"] = "deferred";
3757      ResultType2["redirect"] = "redirect";
3758      ResultType2["error"] = "error";
3759    })(ResultType || (ResultType = {}));
3760    immutableRouteKeys = /* @__PURE__ */ new Set(["lazy", "caseSensitive", "path", "id", "index", "children"]);
3761    paramRe = /^:[\w-]+$/;
3762    dynamicSegmentValue = 3;
3763    indexRouteValue = 2;
3764    emptySegmentValue = 1;
3765    staticSegmentValue = 10;
3766    splatPenalty = -2;
3767    isSplat = (s) => s === "*";
3768    ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
3769    isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX$1.test(url);
3770    joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
3771    normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
3772    normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
3773    normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
3774    json = function json2(data3, init) {
3775      if (init === void 0) {
3776        init = {};
3777      }
3778      let responseInit = typeof init === "number" ? {
3779        status: init
3780      } : init;
3781      let headers = new Headers(responseInit.headers);
3782      if (!headers.has("Content-Type")) {
3783        headers.set("Content-Type", "application/json; charset=utf-8");
3784      }
3785      return new Response(JSON.stringify(data3), _extends({}, responseInit, {
3786        headers
3787      }));
3788    };
3789    DataWithResponseInit = class {
3790      constructor(data3, init) {
3791        this.type = "DataWithResponseInit";
3792        this.data = data3;
3793        this.init = init || null;
3794      }
3795    };
3796    AbortedDeferredError = class extends Error {
3797    };
3798    DeferredData = class {
3799      constructor(data3, responseInit) {
3800        this.pendingKeysSet = /* @__PURE__ */ new Set();
3801        this.subscribers = /* @__PURE__ */ new Set();
3802        this.deferredKeys = [];
3803        invariant(data3 && typeof data3 === "object" && !Array.isArray(data3), "defer() only accepts plain objects");
3804        let reject;
3805        this.abortPromise = new Promise((_, r) => reject = r);
3806        this.controller = new AbortController();
3807        let onAbort = () => reject(new AbortedDeferredError("Deferred data aborted"));
3808        this.unlistenAbortSignal = () => this.controller.signal.removeEventListener("abort", onAbort);
3809        this.controller.signal.addEventListener("abort", onAbort);
3810        this.data = Object.entries(data3).reduce((acc, _ref2) => {
3811          let [key, value] = _ref2;
3812          return Object.assign(acc, {
3813            [key]: this.trackPromise(key, value)
3814          });
3815        }, {});
3816        if (this.done) {
3817          this.unlistenAbortSignal();
3818        }
3819        this.init = responseInit;
3820      }
3821      trackPromise(key, value) {
3822        if (!(value instanceof Promise)) {
3823          return value;
3824        }
3825        this.deferredKeys.push(key);
3826        this.pendingKeysSet.add(key);
3827        let promise = Promise.race([value, this.abortPromise]).then((data3) => this.onSettle(promise, key, void 0, data3), (error) => this.onSettle(promise, key, error));
3828        promise.catch(() => {
3829        });
3830        Object.defineProperty(promise, "_tracked", {
3831          get: () => true
3832        });
3833        return promise;
3834      }
3835      onSettle(promise, key, error, data3) {
3836        if (this.controller.signal.aborted && error instanceof AbortedDeferredError) {
3837          this.unlistenAbortSignal();
3838          Object.defineProperty(promise, "_error", {
3839            get: () => error
3840          });
3841          return Promise.reject(error);
3842        }
3843        this.pendingKeysSet.delete(key);
3844        if (this.done) {
3845          this.unlistenAbortSignal();
3846        }
3847        if (error === void 0 && data3 === void 0) {
3848          let undefinedError = new Error('Deferred data for key "' + key + '" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');
3849          Object.defineProperty(promise, "_error", {
3850            get: () => undefinedError
3851          });
3852          this.emit(false, key);
3853          return Promise.reject(undefinedError);
3854        }
3855        if (data3 === void 0) {
3856          Object.defineProperty(promise, "_error", {
3857            get: () => error
3858          });
3859          this.emit(false, key);
3860          return Promise.reject(error);
3861        }
3862        Object.defineProperty(promise, "_data", {
3863          get: () => data3
3864        });
3865        this.emit(false, key);
3866        return data3;
3867      }
3868      emit(aborted, settledKey) {
3869        this.subscribers.forEach((subscriber) => subscriber(aborted, settledKey));
3870      }
3871      subscribe(fn) {
3872        this.subscribers.add(fn);
3873        return () => this.subscribers.delete(fn);
3874      }
3875      cancel() {
3876        this.controller.abort();
3877        this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));
3878        this.emit(true);
3879      }
3880      async resolveData(signal) {
3881        let aborted = false;
3882        if (!this.done) {
3883          let onAbort = () => this.cancel();
3884          signal.addEventListener("abort", onAbort);
3885          aborted = await new Promise((resolve) => {
3886            this.subscribe((aborted2) => {
3887              signal.removeEventListener("abort", onAbort);
3888              if (aborted2 || this.done) {
3889                resolve(aborted2);
3890              }
3891            });
3892          });
3893        }
3894        return aborted;
3895      }
3896      get done() {
3897        return this.pendingKeysSet.size === 0;
3898      }
3899      get unwrappedData() {
3900        invariant(this.data !== null && this.done, "Can only unwrap data on initialized and settled deferreds");
3901        return Object.entries(this.data).reduce((acc, _ref3) => {
3902          let [key, value] = _ref3;
3903          return Object.assign(acc, {
3904            [key]: unwrapTrackedPromise(value)
3905          });
3906        }, {});
3907      }
3908      get pendingKeys() {
3909        return Array.from(this.pendingKeysSet);
3910      }
3911    };
3912    defer = function defer2(data3, init) {
3913      if (init === void 0) {
3914        init = {};
3915      }
3916      let responseInit = typeof init === "number" ? {
3917        status: init
3918      } : init;
3919      return new DeferredData(data3, responseInit);
3920    };
3921    redirect = function redirect2(url, init) {
3922      if (init === void 0) {
3923        init = 302;
3924      }
3925      let responseInit = init;
3926      if (typeof responseInit === "number") {
3927        responseInit = {
3928          status: responseInit
3929        };
3930      } else if (typeof responseInit.status === "undefined") {
3931        responseInit.status = 302;
3932      }
3933      let headers = new Headers(responseInit.headers);
3934      headers.set("Location", url);
3935      return new Response(null, _extends({}, responseInit, {
3936        headers
3937      }));
3938    };
3939    redirectDocument = (url, init) => {
3940      let response = redirect(url, init);
3941      response.headers.set("X-Remix-Reload-Document", "true");
3942      return response;
3943    };
3944    replace = (url, init) => {
3945      let response = redirect(url, init);
3946      response.headers.set("X-Remix-Replace", "true");
3947      return response;
3948    };
3949    ErrorResponseImpl = class {
3950      constructor(status, statusText, data3, internal) {
3951        if (internal === void 0) {
3952          internal = false;
3953        }
3954        this.status = status;
3955        this.statusText = statusText || "";
3956        this.internal = internal;
3957        if (data3 instanceof Error) {
3958          this.data = data3.toString();
3959          this.error = data3;
3960        } else {
3961          this.data = data3;
3962        }
3963      }
3964    };
3965    validMutationMethodsArr = ["post", "put", "patch", "delete"];
3966    validMutationMethods = new Set(validMutationMethodsArr);
3967    validRequestMethodsArr = ["get", ...validMutationMethodsArr];
3968    validRequestMethods = new Set(validRequestMethodsArr);
3969    redirectStatusCodes = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
3970    redirectPreserveMethodStatusCodes = /* @__PURE__ */ new Set([307, 308]);
3971    IDLE_NAVIGATION = {
3972      state: "idle",
3973      location: void 0,
3974      formMethod: void 0,
3975      formAction: void 0,
3976      formEncType: void 0,
3977      formData: void 0,
3978      json: void 0,
3979      text: void 0
3980    };
3981    IDLE_FETCHER = {
3982      state: "idle",
3983      data: void 0,
3984      formMethod: void 0,
3985      formAction: void 0,
3986      formEncType: void 0,
3987      formData: void 0,
3988      json: void 0,
3989      text: void 0
3990    };
3991    IDLE_BLOCKER = {
3992      state: "unblocked",
3993      proceed: void 0,
3994      reset: void 0,
3995      location: void 0
3996    };
3997    ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
3998    defaultMapRouteProperties = (route) => ({
3999      hasErrorBoundary: Boolean(route.hasErrorBoundary)
4000    });
4001    TRANSITIONS_STORAGE_KEY = "remix-router-transitions";
4002    UNSAFE_DEFERRED_SYMBOL = Symbol("deferred");
4003  }
4004});
4005
vendor: 838 bytes, lines 4006-4024
4006// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/mode.js
4007function isServerMode(value) {
4008  return value === ServerMode.Development || value === ServerMode.Production || value === ServerMode.Test;
4009}
4010var import_dist4, import_dist5, import_dist6, ServerMode;
4011var init_mode = __esm({
4012  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/mode.js"() {
4013    import_dist4 = __toESM(require_dist());
4014    import_dist5 = __toESM(require_dist2());
4015    import_dist6 = __toESM(require_dist3());
4016    ServerMode = function(ServerMode2) {
4017      ServerMode2["Development"] = "development";
4018      ServerMode2["Production"] = "production";
4019      ServerMode2["Test"] = "test";
4020      return ServerMode2;
4021    }({});
4022  }
4023});
4024
vendor: 2,104 bytes, lines 4025-4088
4025// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/errors.js
4026function sanitizeError(error, serverMode) {
4027  if (error instanceof Error && serverMode !== ServerMode.Development) {
4028    let sanitized = new Error("Unexpected Server Error");
4029    sanitized.stack = void 0;
4030    return sanitized;
4031  }
4032  return error;
4033}
4034function sanitizeErrors(errors, serverMode) {
4035  return Object.entries(errors).reduce((acc, [routeId, error]) => {
4036    return Object.assign(acc, {
4037      [routeId]: sanitizeError(error, serverMode)
4038    });
4039  }, {});
4040}
4041function serializeError(error, serverMode) {
4042  let sanitized = sanitizeError(error, serverMode);
4043  return {
4044    message: sanitized.message,
4045    stack: sanitized.stack
4046  };
4047}
4048function serializeErrors(errors, serverMode) {
4049  if (!errors) return null;
4050  let entries = Object.entries(errors);
4051  let serialized = {};
4052  for (let [key, val] of entries) {
4053    if (isRouteErrorResponse(val)) {
4054      serialized[key] = {
4055        ...val,
4056        __type: "RouteErrorResponse"
4057      };
4058    } else if (val instanceof Error) {
4059      let sanitized = sanitizeError(val, serverMode);
4060      serialized[key] = {
4061        message: sanitized.message,
4062        stack: sanitized.stack,
4063        __type: "Error",
4064        // If this is a subclass (i.e., ReferenceError), send up the type so we
4065        // can re-create the same type during hydration.  This will only apply
4066        // in dev mode since all production errors are sanitized to normal
4067        // Error instances
4068        ...sanitized.name !== "Error" ? {
4069          __subType: sanitized.name
4070        } : {}
4071      };
4072    } else {
4073      serialized[key] = val;
4074    }
4075  }
4076  return serialized;
4077}
4078var import_dist7, import_dist8, import_dist9;
4079var init_errors = __esm({
4080  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/errors.js"() {
4081    import_dist7 = __toESM(require_dist());
4082    import_dist8 = __toESM(require_dist2());
4083    import_dist9 = __toESM(require_dist3());
4084    init_router();
4085    init_mode();
4086  }
4087});
4088
vendor: 3,688 bytes, lines 4089-4176
4089// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/responses.js
4090function isDeferredData2(value) {
4091  let deferred = value;
4092  return deferred && typeof deferred === "object" && typeof deferred.data === "object" && typeof deferred.subscribe === "function" && typeof deferred.cancel === "function" && typeof deferred.resolveData === "function";
4093}
4094function isResponse2(value) {
4095  return value != null && typeof value.status === "number" && typeof value.statusText === "string" && typeof value.headers === "object" && typeof value.body !== "undefined";
4096}
4097function isRedirectStatusCode(statusCode) {
4098  return redirectStatusCodes2.has(statusCode);
4099}
4100function isRedirectResponse2(response) {
4101  return isRedirectStatusCode(response.status);
4102}
4103function isTrackedPromise2(value) {
4104  return value != null && typeof value.then === "function" && value._tracked === true;
4105}
4106function createDeferredReadableStream(deferredData, signal, serverMode) {
4107  let encoder = new TextEncoder();
4108  let stream = new ReadableStream({
4109    async start(controller) {
4110      let criticalData = {};
4111      let preresolvedKeys = [];
4112      for (let [key, value] of Object.entries(deferredData.data)) {
4113        if (isTrackedPromise2(value)) {
4114          criticalData[key] = `${DEFERRED_VALUE_PLACEHOLDER_PREFIX}${key}`;
4115          if (typeof value._data !== "undefined" || typeof value._error !== "undefined") {
4116            preresolvedKeys.push(key);
4117          }
4118        } else {
4119          criticalData[key] = value;
4120        }
4121      }
4122      controller.enqueue(encoder.encode(JSON.stringify(criticalData) + "\n\n"));
4123      for (let preresolvedKey of preresolvedKeys) {
4124        enqueueTrackedPromise(controller, encoder, preresolvedKey, deferredData.data[preresolvedKey], serverMode);
4125      }
4126      let unsubscribe = deferredData.subscribe((aborted, settledKey) => {
4127        if (settledKey) {
4128          enqueueTrackedPromise(controller, encoder, settledKey, deferredData.data[settledKey], serverMode);
4129        }
4130      });
4131      await deferredData.resolveData(signal);
4132      unsubscribe();
4133      controller.close();
4134    }
4135  });
4136  return stream;
4137}
4138function enqueueTrackedPromise(controller, encoder, settledKey, promise, serverMode) {
4139  if ("_error" in promise) {
4140    controller.enqueue(encoder.encode("error:" + JSON.stringify({
4141      [settledKey]: promise._error instanceof Error ? serializeError(promise._error, serverMode) : promise._error
4142    }) + "\n\n"));
4143  } else {
4144    controller.enqueue(encoder.encode("data:" + JSON.stringify({
4145      [settledKey]: promise._data ?? null
4146    }) + "\n\n"));
4147  }
4148}
4149var import_dist10, import_dist11, import_dist12, json3, defer3, redirect3, replace2, redirectDocument2, redirectStatusCodes2, DEFERRED_VALUE_PLACEHOLDER_PREFIX;
4150var init_responses = __esm({
4151  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/responses.js"() {
4152    import_dist10 = __toESM(require_dist());
4153    import_dist11 = __toESM(require_dist2());
4154    import_dist12 = __toESM(require_dist3());
4155    init_router();
4156    init_errors();
4157    json3 = (data3, init = {}) => {
4158      return json(data3, init);
4159    };
4160    defer3 = (data3, init = {}) => {
4161      return defer(data3, init);
4162    };
4163    redirect3 = (url, init = 302) => {
4164      return redirect(url, init);
4165    };
4166    replace2 = (url, init = 302) => {
4167      return replace(url, init);
4168    };
4169    redirectDocument2 = (url, init = 302) => {
4170      return redirectDocument(url, init);
4171    };
4172    redirectStatusCodes2 = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
4173    DEFERRED_VALUE_PLACEHOLDER_PREFIX = "__deferred_promise:";
4174  }
4175});
4176
vendor: 21,349 bytes, lines 4177-4855
4177// node_modules/.pnpm/[email protected]/node_modules/turbo-stream/dist/turbo-stream.mjs
4178function createLineSplittingTransform() {
4179  const decoder = new TextDecoder();
4180  let leftover = "";
4181  return new TransformStream({
4182    transform(chunk, controller) {
4183      const str = decoder.decode(chunk, { stream: true });
4184      const parts = (leftover + str).split("\n");
4185      leftover = parts.pop() || "";
4186      for (const part of parts) {
4187        controller.enqueue(part);
4188      }
4189    },
4190    flush(controller) {
4191      if (leftover) {
4192        controller.enqueue(leftover);
4193      }
4194    }
4195  });
4196}
4197function flatten(input) {
4198  const { indices } = this;
4199  const existing = indices.get(input);
4200  if (existing)
4201    return [existing];
4202  if (input === void 0)
4203    return UNDEFINED;
4204  if (input === null)
4205    return NULL;
4206  if (Number.isNaN(input))
4207    return NAN;
4208  if (input === Number.POSITIVE_INFINITY)
4209    return POSITIVE_INFINITY;
4210  if (input === Number.NEGATIVE_INFINITY)
4211    return NEGATIVE_INFINITY;
4212  if (input === 0 && 1 / input < 0)
4213    return NEGATIVE_ZERO;
4214  const index = this.index++;
4215  indices.set(input, index);
4216  stringify.call(this, input, index);
4217  return index;
4218}
4219function stringify(input, index) {
4220  const { deferred, plugins, postPlugins } = this;
4221  const str = this.stringified;
4222  const stack = [[input, index]];
4223  while (stack.length > 0) {
4224    const [input2, index2] = stack.pop();
4225    const partsForObj = (obj) => Object.keys(obj).map((k) => `"_${flatten.call(this, k)}":${flatten.call(this, obj[k])}`).join(",");
4226    let error = null;
4227    switch (typeof input2) {
4228      case "boolean":
4229      case "number":
4230      case "string":
4231        str[index2] = JSON.stringify(input2);
4232        break;
4233      case "bigint":
4234        str[index2] = `["${TYPE_BIGINT}","${input2}"]`;
4235        break;
4236      case "symbol": {
4237        const keyFor = Symbol.keyFor(input2);
4238        if (!keyFor) {
4239          error = new Error(
4240            "Cannot encode symbol unless created with Symbol.for()"
4241          );
4242        } else {
4243          str[index2] = `["${TYPE_SYMBOL}",${JSON.stringify(keyFor)}]`;
4244        }
4245        break;
4246      }
4247      case "object": {
4248        if (!input2) {
4249          str[index2] = `${NULL}`;
4250          break;
4251        }
4252        const isArray = Array.isArray(input2);
4253        let pluginHandled = false;
4254        if (!isArray && plugins) {
4255          for (const plugin of plugins) {
4256            const pluginResult = plugin(input2);
4257            if (Array.isArray(pluginResult)) {
4258              pluginHandled = true;
4259              const [pluginIdentifier, ...rest] = pluginResult;
4260              str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
4261              if (rest.length > 0) {
4262                str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
4263              }
4264              str[index2] += "]";
4265              break;
4266            }
4267          }
4268        }
4269        if (!pluginHandled) {
4270          let result = isArray ? "[" : "{";
4271          if (isArray) {
4272            for (let i = 0; i < input2.length; i++)
4273              result += (i ? "," : "") + (i in input2 ? flatten.call(this, input2[i]) : HOLE);
4274            str[index2] = `${result}]`;
4275          } else if (input2 instanceof Date) {
4276            str[index2] = `["${TYPE_DATE}",${input2.getTime()}]`;
4277          } else if (input2 instanceof URL) {
4278            str[index2] = `["${TYPE_URL}",${JSON.stringify(input2.href)}]`;
4279          } else if (input2 instanceof RegExp) {
4280            str[index2] = `["${TYPE_REGEXP}",${JSON.stringify(
4281              input2.source
4282            )},${JSON.stringify(input2.flags)}]`;
4283          } else if (input2 instanceof Set) {
4284            if (input2.size > 0) {
4285              str[index2] = `["${TYPE_SET}",${[...input2].map((val) => flatten.call(this, val)).join(",")}]`;
4286            } else {
4287              str[index2] = `["${TYPE_SET}"]`;
4288            }
4289          } else if (input2 instanceof Map) {
4290            if (input2.size > 0) {
4291              str[index2] = `["${TYPE_MAP}",${[...input2].flatMap(([k, v]) => [
4292                flatten.call(this, k),
4293                flatten.call(this, v)
4294              ]).join(",")}]`;
4295            } else {
4296              str[index2] = `["${TYPE_MAP}"]`;
4297            }
4298          } else if (input2 instanceof Promise) {
4299            str[index2] = `["${TYPE_PROMISE}",${index2}]`;
4300            deferred[index2] = input2;
4301          } else if (input2 instanceof Error) {
4302            str[index2] = `["${TYPE_ERROR}",${JSON.stringify(input2.message)}`;
4303            if (input2.name !== "Error") {
4304              str[index2] += `,${JSON.stringify(input2.name)}`;
4305            }
4306            str[index2] += "]";
4307          } else if (Object.getPrototypeOf(input2) === null) {
4308            str[index2] = `["${TYPE_NULL_OBJECT}",{${partsForObj(input2)}}]`;
4309          } else if (isPlainObject(input2)) {
4310            str[index2] = `{${partsForObj(input2)}}`;
4311          } else {
4312            error = new Error("Cannot encode object with prototype");
4313          }
4314        }
4315        break;
4316      }
4317      default: {
4318        const isArray = Array.isArray(input2);
4319        let pluginHandled = false;
4320        if (!isArray && plugins) {
4321          for (const plugin of plugins) {
4322            const pluginResult = plugin(input2);
4323            if (Array.isArray(pluginResult)) {
4324              pluginHandled = true;
4325              const [pluginIdentifier, ...rest] = pluginResult;
4326              str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
4327              if (rest.length > 0) {
4328                str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
4329              }
4330              str[index2] += "]";
4331              break;
4332            }
4333          }
4334        }
4335        if (!pluginHandled) {
4336          error = new Error("Cannot encode function or unexpected type");
4337        }
4338      }
4339    }
4340    if (error) {
4341      let pluginHandled = false;
4342      if (postPlugins) {
4343        for (const plugin of postPlugins) {
4344          const pluginResult = plugin(input2);
4345          if (Array.isArray(pluginResult)) {
4346            pluginHandled = true;
4347            const [pluginIdentifier, ...rest] = pluginResult;
4348            str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
4349            if (rest.length > 0) {
4350              str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
4351            }
4352            str[index2] += "]";
4353            break;
4354          }
4355        }
4356      }
4357      if (!pluginHandled) {
4358        throw error;
4359      }
4360    }
4361  }
4362}
4363function isPlainObject(thing) {
4364  const proto = Object.getPrototypeOf(thing);
4365  return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
4366}
4367function unflatten(parsed) {
4368  const { hydrated, values } = this;
4369  if (typeof parsed === "number")
4370    return hydrate.call(this, parsed);
4371  if (!Array.isArray(parsed) || !parsed.length)
4372    throw new SyntaxError();
4373  const startIndex = values.length;
4374  for (const value of parsed) {
4375    values.push(value);
4376  }
4377  hydrated.length = values.length;
4378  return hydrate.call(this, startIndex);
4379}
4380function hydrate(index) {
4381  const { hydrated, values, deferred, plugins } = this;
4382  let result;
4383  const stack = [
4384    [
4385      index,
4386      (v) => {
4387        result = v;
4388      }
4389    ]
4390  ];
4391  let postRun = [];
4392  while (stack.length > 0) {
4393    const [index2, set] = stack.pop();
4394    switch (index2) {
4395      case UNDEFINED:
4396        set(void 0);
4397        continue;
4398      case NULL:
4399        set(null);
4400        continue;
4401      case NAN:
4402        set(NaN);
4403        continue;
4404      case POSITIVE_INFINITY:
4405        set(Infinity);
4406        continue;
4407      case NEGATIVE_INFINITY:
4408        set(-Infinity);
4409        continue;
4410      case NEGATIVE_ZERO:
4411        set(-0);
4412        continue;
4413    }
4414    if (hydrated[index2]) {
4415      set(hydrated[index2]);
4416      continue;
4417    }
4418    const value = values[index2];
4419    if (!value || typeof value !== "object") {
4420      hydrated[index2] = value;
4421      set(value);
4422      continue;
4423    }
4424    if (Array.isArray(value)) {
4425      if (typeof value[0] === "string") {
4426        const [type, b, c] = value;
4427        switch (type) {
4428          case TYPE_DATE:
4429            set(hydrated[index2] = new Date(b));
4430            continue;
4431          case TYPE_URL:
4432            set(hydrated[index2] = new URL(b));
4433            continue;
4434          case TYPE_BIGINT:
4435            set(hydrated[index2] = BigInt(b));
4436            continue;
4437          case TYPE_REGEXP:
4438            set(hydrated[index2] = new RegExp(b, c));
4439            continue;
4440          case TYPE_SYMBOL:
4441            set(hydrated[index2] = Symbol.for(b));
4442            continue;
4443          case TYPE_SET:
4444            const newSet = /* @__PURE__ */ new Set();
4445            hydrated[index2] = newSet;
4446            for (let i = 1; i < value.length; i++)
4447              stack.push([
4448                value[i],
4449                (v) => {
4450                  newSet.add(v);
4451                }
4452              ]);
4453            set(newSet);
4454            continue;
4455          case TYPE_MAP:
4456            const map = /* @__PURE__ */ new Map();
4457            hydrated[index2] = map;
4458            for (let i = 1; i < value.length; i += 2) {
4459              const r = [];
4460              stack.push([
4461                value[i + 1],
4462                (v) => {
4463                  r[1] = v;
4464                }
4465              ]);
4466              stack.push([
4467                value[i],
4468                (k) => {
4469                  r[0] = k;
4470                }
4471              ]);
4472              postRun.push(() => {
4473                map.set(r[0], r[1]);
4474              });
4475            }
4476            set(map);
4477            continue;
4478          case TYPE_NULL_OBJECT:
4479            const obj = /* @__PURE__ */ Object.create(null);
4480            hydrated[index2] = obj;
4481            for (const key of Object.keys(b).reverse()) {
4482              const r = [];
4483              stack.push([
4484                b[key],
4485                (v) => {
4486                  r[1] = v;
4487                }
4488              ]);
4489              stack.push([
4490                Number(key.slice(1)),
4491                (k) => {
4492                  r[0] = k;
4493                }
4494              ]);
4495              postRun.push(() => {
4496                obj[r[0]] = r[1];
4497              });
4498            }
4499            set(obj);
4500            continue;
4501          case TYPE_PROMISE:
4502            if (hydrated[b]) {
4503              set(hydrated[index2] = hydrated[b]);
4504            } else {
4505              const d = new Deferred();
4506              deferred[b] = d;
4507              set(hydrated[index2] = d.promise);
4508            }
4509            continue;
4510          case TYPE_ERROR:
4511            const [, message, errorType] = value;
4512            let error = errorType && globalObj && globalObj[errorType] ? new globalObj[errorType](message) : new Error(message);
4513            hydrated[index2] = error;
4514            set(error);
4515            continue;
4516          case TYPE_PREVIOUS_RESOLVED:
4517            set(hydrated[index2] = hydrated[b]);
4518            continue;
4519          default:
4520            if (Array.isArray(plugins)) {
4521              const r = [];
4522              const vals = value.slice(1);
4523              for (let i = 0; i < vals.length; i++) {
4524                const v = vals[i];
4525                stack.push([
4526                  v,
4527                  (v2) => {
4528                    r[i] = v2;
4529                  }
4530                ]);
4531              }
4532              postRun.push(() => {
4533                for (const plugin of plugins) {
4534                  const result2 = plugin(value[0], ...r);
4535                  if (result2) {
4536                    set(hydrated[index2] = result2.value);
4537                    return;
4538                  }
4539                }
4540                throw new SyntaxError();
4541              });
4542              continue;
4543            }
4544            throw new SyntaxError();
4545        }
4546      } else {
4547        const array = [];
4548        hydrated[index2] = array;
4549        for (let i = 0; i < value.length; i++) {
4550          const n = value[i];
4551          if (n !== HOLE) {
4552            stack.push([
4553              n,
4554              (v) => {
4555                array[i] = v;
4556              }
4557            ]);
4558          }
4559        }
4560        set(array);
4561        continue;
4562      }
4563    } else {
4564      const object = {};
4565      hydrated[index2] = object;
4566      for (const key of Object.keys(value).reverse()) {
4567        const r = [];
4568        stack.push([
4569          value[key],
4570          (v) => {
4571            r[1] = v;
4572          }
4573        ]);
4574        stack.push([
4575          Number(key.slice(1)),
4576          (k) => {
4577            r[0] = k;
4578          }
4579        ]);
4580        postRun.push(() => {
4581          object[r[0]] = r[1];
4582        });
4583      }
4584      set(object);
4585      continue;
4586    }
4587  }
4588  while (postRun.length > 0) {
4589    postRun.pop()();
4590  }
4591  return result;
4592}
4593async function decode(readable, options) {
4594  const { plugins } = options ?? {};
4595  const done = new Deferred();
4596  const reader = readable.pipeThrough(createLineSplittingTransform()).getReader();
4597  const decoder = {
4598    values: [],
4599    hydrated: [],
4600    deferred: {},
4601    plugins
4602  };
4603  const decoded = await decodeInitial.call(decoder, reader);
4604  let donePromise = done.promise;
4605  if (decoded.done) {
4606    done.resolve();
4607  } else {
4608    donePromise = decodeDeferred.call(decoder, reader).then(done.resolve).catch((reason) => {
4609      for (const deferred of Object.values(decoder.deferred)) {
4610        deferred.reject(reason);
4611      }
4612      done.reject(reason);
4613    });
4614  }
4615  return {
4616    done: donePromise.then(() => reader.closed),
4617    value: decoded.value
4618  };
4619}
4620async function decodeInitial(reader) {
4621  const read = await reader.read();
4622  if (!read.value) {
4623    throw new SyntaxError();
4624  }
4625  let line;
4626  try {
4627    line = JSON.parse(read.value);
4628  } catch (reason) {
4629    throw new SyntaxError();
4630  }
4631  return {
4632    done: read.done,
4633    value: unflatten.call(this, line)
4634  };
4635}
4636async function decodeDeferred(reader) {
4637  let read = await reader.read();
4638  while (!read.done) {
4639    if (!read.value)
4640      continue;
4641    const line = read.value;
4642    switch (line[0]) {
4643      case TYPE_PROMISE: {
4644        const colonIndex = line.indexOf(":");
4645        const deferredId = Number(line.slice(1, colonIndex));
4646        const deferred = this.deferred[deferredId];
4647        if (!deferred) {
4648          throw new Error(`Deferred ID ${deferredId} not found in stream`);
4649        }
4650        const lineData = line.slice(colonIndex + 1);
4651        let jsonLine;
4652        try {
4653          jsonLine = JSON.parse(lineData);
4654        } catch (reason) {
4655          throw new SyntaxError();
4656        }
4657        const value = unflatten.call(this, jsonLine);
4658        deferred.resolve(value);
4659        break;
4660      }
4661      case TYPE_ERROR: {
4662        const colonIndex = line.indexOf(":");
4663        const deferredId = Number(line.slice(1, colonIndex));
4664        const deferred = this.deferred[deferredId];
4665        if (!deferred) {
4666          throw new Error(`Deferred ID ${deferredId} not found in stream`);
4667        }
4668        const lineData = line.slice(colonIndex + 1);
4669        let jsonLine;
4670        try {
4671          jsonLine = JSON.parse(lineData);
4672        } catch (reason) {
4673          throw new SyntaxError();
4674        }
4675        const value = unflatten.call(this, jsonLine);
4676        deferred.reject(value);
4677        break;
4678      }
4679      default:
4680        throw new SyntaxError();
4681    }
4682    read = await reader.read();
4683  }
4684}
4685function encode(input, options) {
4686  const { plugins, postPlugins, signal } = options ?? {};
4687  const encoder = {
4688    deferred: {},
4689    index: 0,
4690    indices: /* @__PURE__ */ new Map(),
4691    stringified: [],
4692    plugins,
4693    postPlugins,
4694    signal
4695  };
4696  const textEncoder = new TextEncoder();
4697  let lastSentIndex = 0;
4698  const readable = new ReadableStream({
4699    async start(controller) {
4700      const id = flatten.call(encoder, input);
4701      if (Array.isArray(id)) {
4702        throw new Error("This should never happen");
4703      }
4704      if (id < 0) {
4705        controller.enqueue(textEncoder.encode(`${id}
4706`));
4707      } else {
4708        controller.enqueue(
4709          textEncoder.encode(`[${encoder.stringified.join(",")}]
4710`)
4711        );
4712        lastSentIndex = encoder.stringified.length - 1;
4713      }
4714      const seenPromises = /* @__PURE__ */ new WeakSet();
4715      if (Object.keys(encoder.deferred).length) {
4716        let raceDone;
4717        const racePromise = new Promise((resolve, reject) => {
4718          raceDone = resolve;
4719          if (signal) {
4720            const rejectPromise = () => reject(signal.reason || new Error("Signal was aborted."));
4721            if (signal.aborted) {
4722              rejectPromise();
4723            } else {
4724              signal.addEventListener("abort", (event) => {
4725                rejectPromise();
4726              });
4727            }
4728          }
4729        });
4730        while (Object.keys(encoder.deferred).length > 0) {
4731          for (const [deferredId, deferred] of Object.entries(
4732            encoder.deferred
4733          )) {
4734            if (seenPromises.has(deferred))
4735              continue;
4736            seenPromises.add(
4737              // biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
4738              encoder.deferred[Number(deferredId)] = Promise.race([
4739                racePromise,
4740                deferred
4741              ]).then(
4742                (resolved) => {
4743                  const id2 = flatten.call(encoder, resolved);
4744                  if (Array.isArray(id2)) {
4745                    controller.enqueue(
4746                      textEncoder.encode(
4747                        `${TYPE_PROMISE}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
4748`
4749                      )
4750                    );
4751                    encoder.index++;
4752                    lastSentIndex++;
4753                  } else if (id2 < 0) {
4754                    controller.enqueue(
4755                      textEncoder.encode(
4756                        `${TYPE_PROMISE}${deferredId}:${id2}
4757`
4758                      )
4759                    );
4760                  } else {
4761                    const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
4762                    controller.enqueue(
4763                      textEncoder.encode(
4764                        `${TYPE_PROMISE}${deferredId}:[${values}]
4765`
4766                      )
4767                    );
4768                    lastSentIndex = encoder.stringified.length - 1;
4769                  }
4770                },
4771                (reason) => {
4772                  if (!reason || typeof reason !== "object" || !(reason instanceof Error)) {
4773                    reason = new Error("An unknown error occurred");
4774                  }
4775                  const id2 = flatten.call(encoder, reason);
4776                  if (Array.isArray(id2)) {
4777                    controller.enqueue(
4778                      textEncoder.encode(
4779                        `${TYPE_ERROR}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
4780`
4781                      )
4782                    );
4783                    encoder.index++;
4784                    lastSentIndex++;
4785                  } else if (id2 < 0) {
4786                    controller.enqueue(
4787                      textEncoder.encode(`${TYPE_ERROR}${deferredId}:${id2}
4788`)
4789                    );
4790                  } else {
4791                    const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
4792                    controller.enqueue(
4793                      textEncoder.encode(
4794                        `${TYPE_ERROR}${deferredId}:[${values}]
4795`
4796                      )
4797                    );
4798                    lastSentIndex = encoder.stringified.length - 1;
4799                  }
4800                }
4801              ).finally(() => {
4802                delete encoder.deferred[Number(deferredId)];
4803              })
4804            );
4805          }
4806          await Promise.race(Object.values(encoder.deferred));
4807        }
4808        raceDone();
4809      }
4810      await Promise.all(Object.values(encoder.deferred));
4811      controller.close();
4812    }
4813  });
4814  return readable;
4815}
4816var import_dist13, import_dist14, import_dist15, HOLE, NAN, NEGATIVE_INFINITY, NEGATIVE_ZERO, NULL, POSITIVE_INFINITY, UNDEFINED, TYPE_BIGINT, TYPE_DATE, TYPE_ERROR, TYPE_MAP, TYPE_NULL_OBJECT, TYPE_PROMISE, TYPE_REGEXP, TYPE_SET, TYPE_SYMBOL, TYPE_URL, TYPE_PREVIOUS_RESOLVED, Deferred, objectProtoNames, globalObj;
4817var init_turbo_stream = __esm({
4818  "node_modules/.pnpm/[email protected]/node_modules/turbo-stream/dist/turbo-stream.mjs"() {
4819    import_dist13 = __toESM(require_dist(), 1);
4820    import_dist14 = __toESM(require_dist2(), 1);
4821    import_dist15 = __toESM(require_dist3(), 1);
4822    HOLE = -1;
4823    NAN = -2;
4824    NEGATIVE_INFINITY = -3;
4825    NEGATIVE_ZERO = -4;
4826    NULL = -5;
4827    POSITIVE_INFINITY = -6;
4828    UNDEFINED = -7;
4829    TYPE_BIGINT = "B";
4830    TYPE_DATE = "D";
4831    TYPE_ERROR = "E";
4832    TYPE_MAP = "M";
4833    TYPE_NULL_OBJECT = "N";
4834    TYPE_PROMISE = "P";
4835    TYPE_REGEXP = "R";
4836    TYPE_SET = "S";
4837    TYPE_SYMBOL = "Y";
4838    TYPE_URL = "U";
4839    TYPE_PREVIOUS_RESOLVED = "Z";
4840    Deferred = class {
4841      constructor() {
4842        __publicField(this, "promise");
4843        __publicField(this, "resolve");
4844        __publicField(this, "reject");
4845        this.promise = new Promise((resolve, reject) => {
4846          this.resolve = resolve;
4847          this.reject = reject;
4848        });
4849      }
4850    };
4851    objectProtoNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
4852    globalObj = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : void 0;
4853  }
4854});
4855
vendor: 6,383 bytes, lines 4856-5041
4856// node_modules/.pnpm/[email protected]/node_modules/set-cookie-parser/lib/set-cookie.js
4857var require_set_cookie = __commonJS({
4858  "node_modules/.pnpm/[email protected]/node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) {
4859    "use strict";
4860    var import_dist91 = __toESM(require_dist());
4861    var import_dist92 = __toESM(require_dist2());
4862    var import_dist93 = __toESM(require_dist3());
4863    var defaultParseOptions = {
4864      decodeValues: true,
4865      map: false,
4866      silent: false
4867    };
4868    function isForbiddenKey(key) {
4869      return typeof key !== "string" || key in {};
4870    }
4871    function createNullObj() {
4872      return /* @__PURE__ */ Object.create(null);
4873    }
4874    function isNonEmptyString(str) {
4875      return typeof str === "string" && !!str.trim();
4876    }
4877    function parseString(setCookieValue, options) {
4878      var parts = setCookieValue.split(";").filter(isNonEmptyString);
4879      var nameValuePairStr = parts.shift();
4880      var parsed = parseNameValuePair(nameValuePairStr);
4881      var name = parsed.name;
4882      var value = parsed.value;
4883      options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
4884      if (isForbiddenKey(name)) {
4885        return null;
4886      }
4887      try {
4888        value = options.decodeValues ? decodeURIComponent(value) : value;
4889      } catch (e) {
4890        console.error(
4891          "set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",
4892          e
4893        );
4894      }
4895      var cookie = createNullObj();
4896      cookie.name = name;
4897      cookie.value = value;
4898      parts.forEach(function(part) {
4899        var sides = part.split("=");
4900        var key = sides.shift().trimLeft().toLowerCase();
4901        if (isForbiddenKey(key)) {
4902          return;
4903        }
4904        var value2 = sides.join("=");
4905        if (key === "expires") {
4906          cookie.expires = new Date(value2);
4907        } else if (key === "max-age") {
4908          var n = parseInt(value2, 10);
4909          if (!Number.isNaN(n)) cookie.maxAge = n;
4910        } else if (key === "secure") {
4911          cookie.secure = true;
4912        } else if (key === "httponly") {
4913          cookie.httpOnly = true;
4914        } else if (key === "samesite") {
4915          cookie.sameSite = value2;
4916        } else if (key === "partitioned") {
4917          cookie.partitioned = true;
4918        } else if (key) {
4919          cookie[key] = value2;
4920        }
4921      });
4922      return cookie;
4923    }
4924    function parseNameValuePair(nameValuePairStr) {
4925      var name = "";
4926      var value = "";
4927      var nameValueArr = nameValuePairStr.split("=");
4928      if (nameValueArr.length > 1) {
4929        name = nameValueArr.shift();
4930        value = nameValueArr.join("=");
4931      } else {
4932        value = nameValuePairStr;
4933      }
4934      return { name, value };
4935    }
4936    function parse2(input, options) {
4937      options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
4938      if (!input) {
4939        if (!options.map) {
4940          return [];
4941        } else {
4942          return createNullObj();
4943        }
4944      }
4945      if (input.headers) {
4946        if (typeof input.headers.getSetCookie === "function") {
4947          input = input.headers.getSetCookie();
4948        } else if (input.headers["set-cookie"]) {
4949          input = input.headers["set-cookie"];
4950        } else {
4951          var sch = input.headers[Object.keys(input.headers).find(function(key) {
4952            return key.toLowerCase() === "set-cookie";
4953          })];
4954          if (!sch && input.headers.cookie && !options.silent) {
4955            console.warn(
4956              "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
4957            );
4958          }
4959          input = sch;
4960        }
4961      }
4962      if (!Array.isArray(input)) {
4963        input = [input];
4964      }
4965      if (!options.map) {
4966        return input.filter(isNonEmptyString).map(function(str) {
4967          return parseString(str, options);
4968        }).filter(Boolean);
4969      } else {
4970        var cookies = createNullObj();
4971        return input.filter(isNonEmptyString).reduce(function(cookies2, str) {
4972          var cookie = parseString(str, options);
4973          if (cookie && !isForbiddenKey(cookie.name)) {
4974            cookies2[cookie.name] = cookie;
4975          }
4976          return cookies2;
4977        }, cookies);
4978      }
4979    }
4980    function splitCookiesString2(cookiesString) {
4981      if (Array.isArray(cookiesString)) {
4982        return cookiesString;
4983      }
4984      if (typeof cookiesString !== "string") {
4985        return [];
4986      }
4987      var cookiesStrings = [];
4988      var pos = 0;
4989      var start;
4990      var ch;
4991      var lastComma;
4992      var nextStart;
4993      var cookiesSeparatorFound;
4994      function skipWhitespace() {
4995        while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
4996          pos += 1;
4997        }
4998        return pos < cookiesString.length;
4999      }
5000      function notSpecialChar() {
5001        ch = cookiesString.charAt(pos);
5002        return ch !== "=" && ch !== ";" && ch !== ",";
5003      }
5004      while (pos < cookiesString.length) {
5005        start = pos;
5006        cookiesSeparatorFound = false;
5007        while (skipWhitespace()) {
5008          ch = cookiesString.charAt(pos);
5009          if (ch === ",") {
5010            lastComma = pos;
5011            pos += 1;
5012            skipWhitespace();
5013            nextStart = pos;
5014            while (pos < cookiesString.length && notSpecialChar()) {
5015              pos += 1;
5016            }
5017            if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
5018              cookiesSeparatorFound = true;
5019              pos = nextStart;
5020              cookiesStrings.push(cookiesString.substring(start, lastComma));
5021              start = pos;
5022            } else {
5023              pos = lastComma + 1;
5024            }
5025          } else {
5026            pos += 1;
5027          }
5028        }
5029        if (!cookiesSeparatorFound || pos >= cookiesString.length) {
5030          cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
5031        }
5032      }
5033      return cookiesStrings;
5034    }
5035    module.exports = parse2;
5036    module.exports.parse = parse2;
5037    module.exports.parseString = parseString;
5038    module.exports.splitCookiesString = splitCookiesString2;
5039  }
5040});
5041
vendor: 3,268 bytes, lines 5042-5119
5042// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/headers.js
5043function getDocumentHeaders(build, context) {
5044  let boundaryIdx = context.errors ? context.matches.findIndex((m) => context.errors[m.route.id]) : -1;
5045  let matches = boundaryIdx >= 0 ? context.matches.slice(0, boundaryIdx + 1) : context.matches;
5046  let errorHeaders;
5047  if (boundaryIdx >= 0) {
5048    let {
5049      actionHeaders,
5050      actionData,
5051      loaderHeaders,
5052      loaderData
5053    } = context;
5054    context.matches.slice(boundaryIdx).some((match) => {
5055      let id = match.route.id;
5056      if (actionHeaders[id] && (!actionData || actionData[id] === void 0)) {
5057        errorHeaders = actionHeaders[id];
5058      } else if (loaderHeaders[id] && loaderData[id] === void 0) {
5059        errorHeaders = loaderHeaders[id];
5060      }
5061      return errorHeaders != null;
5062    });
5063  }
5064  return matches.reduce((parentHeaders, match, idx) => {
5065    let {
5066      id
5067    } = match.route;
5068    let routeModule = build.routes[id].module;
5069    let loaderHeaders = context.loaderHeaders[id] || new Headers();
5070    let actionHeaders = context.actionHeaders[id] || new Headers();
5071    let includeErrorHeaders = errorHeaders != void 0 && idx === matches.length - 1;
5072    let includeErrorCookies = includeErrorHeaders && errorHeaders !== loaderHeaders && errorHeaders !== actionHeaders;
5073    if (routeModule.headers == null) {
5074      let headers2 = new Headers(parentHeaders);
5075      if (includeErrorCookies) {
5076        prependCookies(errorHeaders, headers2);
5077      }
5078      prependCookies(actionHeaders, headers2);
5079      prependCookies(loaderHeaders, headers2);
5080      return headers2;
5081    }
5082    let headers = new Headers(routeModule.headers ? typeof routeModule.headers === "function" ? routeModule.headers({
5083      loaderHeaders,
5084      parentHeaders,
5085      actionHeaders,
5086      errorHeaders: includeErrorHeaders ? errorHeaders : void 0
5087    }) : routeModule.headers : void 0);
5088    if (includeErrorCookies) {
5089      prependCookies(errorHeaders, headers);
5090    }
5091    prependCookies(actionHeaders, headers);
5092    prependCookies(loaderHeaders, headers);
5093    prependCookies(parentHeaders, headers);
5094    return headers;
5095  }, new Headers());
5096}
5097function prependCookies(parentHeaders, childHeaders) {
5098  let parentSetCookieString = parentHeaders.get("Set-Cookie");
5099  if (parentSetCookieString) {
5100    var _childHeaders$getSetC;
5101    let cookies = (0, import_set_cookie_parser.splitCookiesString)(parentSetCookieString);
5102    let childCookies = new Set((_childHeaders$getSetC = childHeaders.getSetCookie) === null || _childHeaders$getSetC === void 0 ? void 0 : _childHeaders$getSetC.call(childHeaders));
5103    cookies.forEach((cookie) => {
5104      if (!childCookies.has(cookie)) {
5105        childHeaders.append("Set-Cookie", cookie);
5106      }
5107    });
5108  }
5109}
5110var import_dist16, import_dist17, import_dist18, import_set_cookie_parser;
5111var init_headers = __esm({
5112  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/headers.js"() {
5113    import_dist16 = __toESM(require_dist());
5114    import_dist17 = __toESM(require_dist2());
5115    import_dist18 = __toESM(require_dist3());
5116    import_set_cookie_parser = __toESM(require_set_cookie());
5117  }
5118});
5119
vendor: 1,754 bytes, lines 5120-5154
5120// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/actions.js
5121function throwIfPotentialCSRFAttack(headers) {
5122  let originHeader = headers.get("origin");
5123  let originDomain = typeof originHeader === "string" && originHeader !== "null" ? new URL(originHeader).host : originHeader;
5124  let host = parseHostHeader(headers);
5125  if (originDomain && (!host || originDomain !== host.value)) {
5126    if (host) {
5127      throw new Error(`${host.type} header does not match \`origin\` header from a forwarded action request. Aborting the action.`);
5128    } else {
5129      throw new Error("`x-forwarded-host` or `host` headers are not provided. One of these is needed to compare the `origin` header from a forwarded action request. Aborting the action.");
5130    }
5131  }
5132}
5133function parseHostHeader(headers) {
5134  var _forwardedHostHeader$;
5135  let forwardedHostHeader = headers.get("x-forwarded-host");
5136  let forwardedHostValue = forwardedHostHeader === null || forwardedHostHeader === void 0 ? void 0 : (_forwardedHostHeader$ = forwardedHostHeader.split(",")[0]) === null || _forwardedHostHeader$ === void 0 ? void 0 : _forwardedHostHeader$.trim();
5137  let hostHeader = headers.get("host");
5138  return forwardedHostValue ? {
5139    type: "x-forwarded-host",
5140    value: forwardedHostValue
5141  } : hostHeader ? {
5142    type: "host",
5143    value: hostHeader
5144  } : void 0;
5145}
5146var import_dist19, import_dist20, import_dist21;
5147var init_actions = __esm({
5148  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/actions.js"() {
5149    import_dist19 = __toESM(require_dist());
5150    import_dist20 = __toESM(require_dist2());
5151    import_dist21 = __toESM(require_dist3());
5152  }
5153});
5154
vendor: 8,273 bytes, lines 5155-5396
5155// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/single-fetch.js
5156function getSingleFetchDataStrategy({
5157  isActionDataRequest,
5158  loadRouteIds
5159} = {}) {
5160  return async ({
5161    request,
5162    matches
5163  }) => {
5164    if (isActionDataRequest && request.method === "GET") {
5165      return {};
5166    }
5167    let matchesToLoad = loadRouteIds ? matches.filter((m) => loadRouteIds.includes(m.route.id)) : matches;
5168    let results = await Promise.all(matchesToLoad.map((match) => match.resolve()));
5169    return results.reduce((acc, result, i) => Object.assign(acc, {
5170      [matchesToLoad[i].route.id]: result
5171    }), {});
5172  };
5173}
5174async function singleFetchAction(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
5175  try {
5176    throwIfPotentialCSRFAttack(request.headers);
5177    let handlerRequest = new Request(handlerUrl, {
5178      method: request.method,
5179      body: request.body,
5180      headers: request.headers,
5181      signal: request.signal,
5182      ...request.body ? {
5183        duplex: "half"
5184      } : void 0
5185    });
5186    let result = await staticHandler.query(handlerRequest, {
5187      requestContext: loadContext,
5188      skipLoaderErrorBubbling: true,
5189      dataStrategy: getSingleFetchDataStrategy({
5190        isActionDataRequest: true
5191      })
5192    });
5193    if (isResponse2(result)) {
5194      return {
5195        result: getSingleFetchRedirect(result.status, result.headers, build.basename),
5196        headers: result.headers,
5197        status: SINGLE_FETCH_REDIRECT_STATUS
5198      };
5199    }
5200    let context = result;
5201    let headers = getDocumentHeaders(build, context);
5202    if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) {
5203      return {
5204        result: getSingleFetchRedirect(context.statusCode, headers, build.basename),
5205        headers,
5206        status: SINGLE_FETCH_REDIRECT_STATUS
5207      };
5208    }
5209    if (context.errors) {
5210      Object.values(context.errors).forEach((err) => {
5211        if (!isRouteErrorResponse(err) || err.error) {
5212          handleError(err);
5213        }
5214      });
5215      context.errors = sanitizeErrors(context.errors, serverMode);
5216    }
5217    let singleFetchResult;
5218    if (context.errors) {
5219      singleFetchResult = {
5220        error: Object.values(context.errors)[0]
5221      };
5222    } else {
5223      singleFetchResult = {
5224        data: Object.values(context.actionData || {})[0]
5225      };
5226    }
5227    return {
5228      result: singleFetchResult,
5229      headers,
5230      status: context.statusCode
5231    };
5232  } catch (error) {
5233    handleError(error);
5234    return {
5235      result: {
5236        error
5237      },
5238      headers: new Headers(),
5239      status: 500
5240    };
5241  }
5242}
5243async function singleFetchLoaders(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
5244  try {
5245    var _URL$searchParams$get;
5246    let handlerRequest = new Request(handlerUrl, {
5247      headers: request.headers,
5248      signal: request.signal
5249    });
5250    let loadRouteIds = ((_URL$searchParams$get = new URL(request.url).searchParams.get("_routes")) === null || _URL$searchParams$get === void 0 ? void 0 : _URL$searchParams$get.split(",")) || void 0;
5251    let result = await staticHandler.query(handlerRequest, {
5252      requestContext: loadContext,
5253      skipLoaderErrorBubbling: true,
5254      dataStrategy: getSingleFetchDataStrategy({
5255        loadRouteIds
5256      })
5257    });
5258    if (isResponse2(result)) {
5259      return {
5260        result: {
5261          [SingleFetchRedirectSymbol]: getSingleFetchRedirect(result.status, result.headers, build.basename)
5262        },
5263        headers: result.headers,
5264        status: SINGLE_FETCH_REDIRECT_STATUS
5265      };
5266    }
5267    let context = result;
5268    let headers = getDocumentHeaders(build, context);
5269    if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) {
5270      return {
5271        result: {
5272          [SingleFetchRedirectSymbol]: getSingleFetchRedirect(context.statusCode, headers, build.basename)
5273        },
5274        headers,
5275        status: SINGLE_FETCH_REDIRECT_STATUS
5276      };
5277    }
5278    if (context.errors) {
5279      Object.values(context.errors).forEach((err) => {
5280        if (!isRouteErrorResponse(err) || err.error) {
5281          handleError(err);
5282        }
5283      });
5284      context.errors = sanitizeErrors(context.errors, serverMode);
5285    }
5286    let results = {};
5287    let loadedMatches = loadRouteIds ? context.matches.filter((m) => m.route.loader && loadRouteIds.includes(m.route.id)) : context.matches;
5288    loadedMatches.forEach((m) => {
5289      var _context$loaderData, _context$errors;
5290      let data3 = (_context$loaderData = context.loaderData) === null || _context$loaderData === void 0 ? void 0 : _context$loaderData[m.route.id];
5291      let error = (_context$errors = context.errors) === null || _context$errors === void 0 ? void 0 : _context$errors[m.route.id];
5292      if (error !== void 0) {
5293        results[m.route.id] = {
5294          error
5295        };
5296      } else if (data3 !== void 0) {
5297        results[m.route.id] = {
5298          data: data3
5299        };
5300      }
5301    });
5302    return {
5303      result: results,
5304      headers,
5305      status: context.statusCode
5306    };
5307  } catch (error) {
5308    handleError(error);
5309    return {
5310      result: {
5311        root: {
5312          error
5313        }
5314      },
5315      headers: new Headers(),
5316      status: 500
5317    };
5318  }
5319}
5320function getSingleFetchRedirect(status, headers, basename) {
5321  let redirect4 = headers.get("Location");
5322  if (basename) {
5323    redirect4 = stripBasename(redirect4, basename) || redirect4;
5324  }
5325  return {
5326    redirect: redirect4,
5327    status,
5328    revalidate: (
5329      // Technically X-Remix-Revalidate isn't needed here - that was an implementation
5330      // detail of ?_data requests as our way to tell the front end to revalidate when
5331      // we didn't have a response body to include that information in.
5332      // With single fetch, we tell the front end via this revalidate boolean field.
5333      // However, we're respecting it for now because it may be something folks have
5334      // used in their own responses
5335      // TODO(v3): Consider removing or making this official public API
5336      headers.has("X-Remix-Revalidate") || headers.has("Set-Cookie")
5337    ),
5338    reload: headers.has("X-Remix-Reload-Document"),
5339    replace: headers.has("X-Remix-Replace")
5340  };
5341}
5342function encodeViaTurboStream(data3, requestSignal, streamTimeout, serverMode) {
5343  let controller = new AbortController();
5344  let timeoutId = setTimeout(() => controller.abort(new Error("Server Timeout")), typeof streamTimeout === "number" ? streamTimeout : 4950);
5345  requestSignal.addEventListener("abort", () => clearTimeout(timeoutId));
5346  return encode(data3, {
5347    signal: controller.signal,
5348    plugins: [(value) => {
5349      if (value instanceof Error) {
5350        let {
5351          name,
5352          message,
5353          stack
5354        } = serverMode === ServerMode.Production ? sanitizeError(value, serverMode) : value;
5355        return ["SanitizedError", name, message, stack];
5356      }
5357      if (value instanceof ErrorResponseImpl) {
5358        let {
5359          data: data4,
5360          status,
5361          statusText
5362        } = value;
5363        return ["ErrorResponse", data4, status, statusText];
5364      }
5365      if (value && typeof value === "object" && SingleFetchRedirectSymbol in value) {
5366        return ["SingleFetchRedirect", value[SingleFetchRedirectSymbol]];
5367      }
5368    }],
5369    postPlugins: [(value) => {
5370      if (!value) return;
5371      if (typeof value !== "object") return;
5372      return ["SingleFetchClassInstance", Object.fromEntries(Object.entries(value))];
5373    }, () => ["SingleFetchFallback"]]
5374  });
5375}
5376function data2(value, init) {
5377  return data(value, init);
5378}
5379var import_dist22, import_dist23, import_dist24, SingleFetchRedirectSymbol, SINGLE_FETCH_REDIRECT_STATUS;
5380var init_single_fetch = __esm({
5381  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/single-fetch.js"() {
5382    import_dist22 = __toESM(require_dist());
5383    import_dist23 = __toESM(require_dist2());
5384    import_dist24 = __toESM(require_dist3());
5385    init_router();
5386    init_turbo_stream();
5387    init_errors();
5388    init_headers();
5389    init_mode();
5390    init_responses();
5391    init_actions();
5392    SingleFetchRedirectSymbol = Symbol("SingleFetchRedirect");
5393    SINGLE_FETCH_REDIRECT_STATUS = 202;
5394  }
5395});
5396
vendor: 5,558 bytes, lines 5397-5565
5397// node_modules/.pnpm/[email protected]/node_modules/cookie/index.js
5398var require_cookie = __commonJS({
5399  "node_modules/.pnpm/[email protected]/node_modules/cookie/index.js"(exports) {
5400    "use strict";
5401    var import_dist91 = __toESM(require_dist());
5402    var import_dist92 = __toESM(require_dist2());
5403    var import_dist93 = __toESM(require_dist3());
5404    exports.parse = parse2;
5405    exports.serialize = serialize2;
5406    var __toString = Object.prototype.toString;
5407    var __hasOwnProperty = Object.prototype.hasOwnProperty;
5408    var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
5409    var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
5410    var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
5411    var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
5412    function parse2(str, opt) {
5413      if (typeof str !== "string") {
5414        throw new TypeError("argument str must be a string");
5415      }
5416      var obj = {};
5417      var len = str.length;
5418      if (len < 2) return obj;
5419      var dec = opt && opt.decode || decode2;
5420      var index = 0;
5421      var eqIdx = 0;
5422      var endIdx = 0;
5423      do {
5424        eqIdx = str.indexOf("=", index);
5425        if (eqIdx === -1) break;
5426        endIdx = str.indexOf(";", index);
5427        if (endIdx === -1) {
5428          endIdx = len;
5429        } else if (eqIdx > endIdx) {
5430          index = str.lastIndexOf(";", eqIdx - 1) + 1;
5431          continue;
5432        }
5433        var keyStartIdx = startIndex(str, index, eqIdx);
5434        var keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
5435        var key = str.slice(keyStartIdx, keyEndIdx);
5436        if (!__hasOwnProperty.call(obj, key)) {
5437          var valStartIdx = startIndex(str, eqIdx + 1, endIdx);
5438          var valEndIdx = endIndex(str, endIdx, valStartIdx);
5439          if (str.charCodeAt(valStartIdx) === 34 && str.charCodeAt(valEndIdx - 1) === 34) {
5440            valStartIdx++;
5441            valEndIdx--;
5442          }
5443          var val = str.slice(valStartIdx, valEndIdx);
5444          obj[key] = tryDecode(val, dec);
5445        }
5446        index = endIdx + 1;
5447      } while (index < len);
5448      return obj;
5449    }
5450    function startIndex(str, index, max) {
5451      do {
5452        var code = str.charCodeAt(index);
5453        if (code !== 32 && code !== 9) return index;
5454      } while (++index < max);
5455      return max;
5456    }
5457    function endIndex(str, index, min) {
5458      while (index > min) {
5459        var code = str.charCodeAt(--index);
5460        if (code !== 32 && code !== 9) return index + 1;
5461      }
5462      return min;
5463    }
5464    function serialize2(name, val, opt) {
5465      var enc = opt && opt.encode || encodeURIComponent;
5466      if (typeof enc !== "function") {
5467        throw new TypeError("option encode is invalid");
5468      }
5469      if (!cookieNameRegExp.test(name)) {
5470        throw new TypeError("argument name is invalid");
5471      }
5472      var value = enc(val);
5473      if (!cookieValueRegExp.test(value)) {
5474        throw new TypeError("argument val is invalid");
5475      }
5476      var str = name + "=" + value;
5477      if (!opt) return str;
5478      if (null != opt.maxAge) {
5479        var maxAge = Math.floor(opt.maxAge);
5480        if (!isFinite(maxAge)) {
5481          throw new TypeError("option maxAge is invalid");
5482        }
5483        str += "; Max-Age=" + maxAge;
5484      }
5485      if (opt.domain) {
5486        if (!domainValueRegExp.test(opt.domain)) {
5487          throw new TypeError("option domain is invalid");
5488        }
5489        str += "; Domain=" + opt.domain;
5490      }
5491      if (opt.path) {
5492        if (!pathValueRegExp.test(opt.path)) {
5493          throw new TypeError("option path is invalid");
5494        }
5495        str += "; Path=" + opt.path;
5496      }
5497      if (opt.expires) {
5498        var expires = opt.expires;
5499        if (!isDate(expires) || isNaN(expires.valueOf())) {
5500          throw new TypeError("option expires is invalid");
5501        }
5502        str += "; Expires=" + expires.toUTCString();
5503      }
5504      if (opt.httpOnly) {
5505        str += "; HttpOnly";
5506      }
5507      if (opt.secure) {
5508        str += "; Secure";
5509      }
5510      if (opt.partitioned) {
5511        str += "; Partitioned";
5512      }
5513      if (opt.priority) {
5514        var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
5515        switch (priority) {
5516          case "low":
5517            str += "; Priority=Low";
5518            break;
5519          case "medium":
5520            str += "; Priority=Medium";
5521            break;
5522          case "high":
5523            str += "; Priority=High";
5524            break;
5525          default:
5526            throw new TypeError("option priority is invalid");
5527        }
5528      }
5529      if (opt.sameSite) {
5530        var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
5531        switch (sameSite) {
5532          case true:
5533            str += "; SameSite=Strict";
5534            break;
5535          case "lax":
5536            str += "; SameSite=Lax";
5537            break;
5538          case "strict":
5539            str += "; SameSite=Strict";
5540            break;
5541          case "none":
5542            str += "; SameSite=None";
5543            break;
5544          default:
5545            throw new TypeError("option sameSite is invalid");
5546        }
5547      }
5548      return str;
5549    }
5550    function decode2(str) {
5551      return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
5552    }
5553    function isDate(val) {
5554      return __toString.call(val) === "[object Date]";
5555    }
5556    function tryDecode(str, decode3) {
5557      try {
5558        return decode3(str);
5559      } catch (e) {
5560        return str;
5561      }
5562    }
5563  }
5564});
5565
vendor: 686 bytes, lines 5566-5582
5566// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/warnings.js
5567function warnOnce(condition, message) {
5568  if (!condition && !alreadyWarned[message]) {
5569    alreadyWarned[message] = true;
5570    console.warn(message);
5571  }
5572}
5573var import_dist25, import_dist26, import_dist27, alreadyWarned;
5574var init_warnings = __esm({
5575  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/warnings.js"() {
5576    import_dist25 = __toESM(require_dist());
5577    import_dist26 = __toESM(require_dist2());
5578    import_dist27 = __toESM(require_dist3());
5579    alreadyWarned = {};
5580  }
5581});
5582
vendor: 4,545 bytes, lines 5583-5721
5583// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/cookies.js
5584async function encodeCookieValue(sign, value, secrets) {
5585  let encoded = encodeData(value);
5586  if (secrets.length > 0) {
5587    encoded = await sign(encoded, secrets[0]);
5588  }
5589  return encoded;
5590}
5591async function decodeCookieValue(unsign, value, secrets) {
5592  if (secrets.length > 0) {
5593    for (let secret of secrets) {
5594      let unsignedValue = await unsign(value, secret);
5595      if (unsignedValue !== false) {
5596        return decodeData(unsignedValue);
5597      }
5598    }
5599    return null;
5600  }
5601  return decodeData(value);
5602}
5603function encodeData(value) {
5604  return btoa(myUnescape(encodeURIComponent(JSON.stringify(value))));
5605}
5606function decodeData(value) {
5607  try {
5608    return JSON.parse(decodeURIComponent(myEscape(atob(value))));
5609  } catch (error) {
5610    return {};
5611  }
5612}
5613function myEscape(value) {
5614  let str = value.toString();
5615  let result = "";
5616  let index = 0;
5617  let chr, code;
5618  while (index < str.length) {
5619    chr = str.charAt(index++);
5620    if (/[\w*+\-./@]/.exec(chr)) {
5621      result += chr;
5622    } else {
5623      code = chr.charCodeAt(0);
5624      if (code < 256) {
5625        result += "%" + hex(code, 2);
5626      } else {
5627        result += "%u" + hex(code, 4).toUpperCase();
5628      }
5629    }
5630  }
5631  return result;
5632}
5633function hex(code, length) {
5634  let result = code.toString(16);
5635  while (result.length < length) result = "0" + result;
5636  return result;
5637}
5638function myUnescape(value) {
5639  let str = value.toString();
5640  let result = "";
5641  let index = 0;
5642  let chr, part;
5643  while (index < str.length) {
5644    chr = str.charAt(index++);
5645    if (chr === "%") {
5646      if (str.charAt(index) === "u") {
5647        part = str.slice(index + 1, index + 5);
5648        if (/^[\da-f]{4}$/i.exec(part)) {
5649          result += String.fromCharCode(parseInt(part, 16));
5650          index += 5;
5651          continue;
5652        }
5653      } else {
5654        part = str.slice(index, index + 2);
5655        if (/^[\da-f]{2}$/i.exec(part)) {
5656          result += String.fromCharCode(parseInt(part, 16));
5657          index += 2;
5658          continue;
5659        }
5660      }
5661    }
5662    result += chr;
5663  }
5664  return result;
5665}
5666function warnOnceAboutExpiresCookie(name, expires) {
5667  warnOnce(!expires, `The "${name}" cookie has an "expires" property set. This will cause the expires value to not be updated when the session is committed. Instead, you should set the expires value when serializing the cookie. You can use \`commitSession(session, { expires })\` if using a session storage object, or \`cookie.serialize("value", { expires })\` if you're using the cookie directly.`);
5668}
5669var import_dist28, import_dist29, import_dist30, import_cookie, createCookieFactory, isCookie;
5670var init_cookies = __esm({
5671  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/cookies.js"() {
5672    import_dist28 = __toESM(require_dist());
5673    import_dist29 = __toESM(require_dist2());
5674    import_dist30 = __toESM(require_dist3());
5675    import_cookie = __toESM(require_cookie());
5676    init_warnings();
5677    createCookieFactory = ({
5678      sign,
5679      unsign
5680    }) => (name, cookieOptions = {}) => {
5681      let {
5682        secrets = [],
5683        ...options
5684      } = {
5685        path: "/",
5686        sameSite: "lax",
5687        ...cookieOptions
5688      };
5689      warnOnceAboutExpiresCookie(name, options.expires);
5690      return {
5691        get name() {
5692          return name;
5693        },
5694        get isSigned() {
5695          return secrets.length > 0;
5696        },
5697        get expires() {
5698          return typeof options.maxAge !== "undefined" ? new Date(Date.now() + options.maxAge * 1e3) : options.expires;
5699        },
5700        async parse(cookieHeader, parseOptions) {
5701          if (!cookieHeader) return null;
5702          let cookies = (0, import_cookie.parse)(cookieHeader, {
5703            ...options,
5704            ...parseOptions
5705          });
5706          return name in cookies ? cookies[name] === "" ? "" : await decodeCookieValue(unsign, cookies[name], secrets) : null;
5707        },
5708        async serialize(value, serializeOptions) {
5709          return (0, import_cookie.serialize)(name, value === "" ? "" : await encodeCookieValue(sign, value, secrets), {
5710            ...options,
5711            ...serializeOptions
5712          });
5713        }
5714      };
5715    };
5716    isCookie = (object) => {
5717      return object != null && typeof object.name === "string" && typeof object.isSigned === "boolean" && typeof object.parse === "function" && typeof object.serialize === "function";
5718    };
5719  }
5720});
5721
vendor: 1,169 bytes, lines 5722-5759
5722// node_modules/.pnpm/@[email protected]/node_modules/@web3-storage/multipart-parser/esm/src/utils.js
5723function stringToArray(s) {
5724  const utf8 = unescape(encodeURIComponent(s));
5725  return Uint8Array.from(utf8, (_, i) => utf8.charCodeAt(i));
5726}
5727function arrayToString(a) {
5728  const utf8 = String.fromCharCode.apply(null, a);
5729  return decodeURIComponent(escape(utf8));
5730}
5731function mergeArrays(...arrays) {
5732  const out = new Uint8Array(arrays.reduce((total, arr) => total + arr.length, 0));
5733  let offset = 0;
5734  for (const arr of arrays) {
5735    out.set(arr, offset);
5736    offset += arr.length;
5737  }
5738  return out;
5739}
5740function arraysEqual(a, b) {
5741  if (a.length !== b.length) {
5742    return false;
5743  }
5744  for (let i = 0; i < a.length; i++) {
5745    if (a[i] !== b[i]) {
5746      return false;
5747    }
5748  }
5749  return true;
5750}
5751var import_dist31, import_dist32, import_dist33;
5752var init_utils = __esm({
5753  "node_modules/.pnpm/@[email protected]/node_modules/@web3-storage/multipart-parser/esm/src/utils.js"() {
5754    import_dist31 = __toESM(require_dist(), 1);
5755    import_dist32 = __toESM(require_dist2(), 1);
5756    import_dist33 = __toESM(require_dist3(), 1);
5757  }
5758});
5759
vendor: 5,610 bytes, lines 5760-5931
5760// node_modules/.pnpm/@[email protected]/node_modules/@web3-storage/multipart-parser/esm/src/search.js
5761function coerce(a) {
5762  if (a instanceof Uint8Array) {
5763    return (index) => a[index];
5764  }
5765  return a;
5766}
5767function jsmemcmp(buf1, pos1, buf2, pos2, len) {
5768  const fn1 = coerce(buf1);
5769  const fn2 = coerce(buf2);
5770  for (let i = 0; i < len; ++i) {
5771    if (fn1(pos1 + i) !== fn2(pos2 + i)) {
5772      return false;
5773    }
5774  }
5775  return true;
5776}
5777function createOccurenceTable(s) {
5778  const table = new Array(256).fill(s.length);
5779  if (s.length > 1) {
5780    for (let i = 0; i < s.length - 1; i++) {
5781      table[s[i]] = s.length - 1 - i;
5782    }
5783  }
5784  return table;
5785}
5786var import_dist34, import_dist35, import_dist36, MATCH, StreamSearch, ReadableStreamSearch, EOQ;
5787var init_search = __esm({
5788  "node_modules/.pnpm/@[email protected]/node_modules/@web3-storage/multipart-parser/esm/src/search.js"() {
5789    import_dist34 = __toESM(require_dist(), 1);
5790    import_dist35 = __toESM(require_dist2(), 1);
5791    import_dist36 = __toESM(require_dist3(), 1);
5792    init_utils();
5793    MATCH = Symbol("Match");
5794    StreamSearch = class {
5795      constructor(needle) {
5796        this._lookbehind = new Uint8Array();
5797        if (typeof needle === "string") {
5798          this._needle = needle = stringToArray(needle);
5799        } else {
5800          this._needle = needle;
5801        }
5802        this._lastChar = needle[needle.length - 1];
5803        this._occ = createOccurenceTable(needle);
5804      }
5805      feed(chunk) {
5806        let pos = 0;
5807        let tokens;
5808        const allTokens = [];
5809        while (pos !== chunk.length) {
5810          ;
5811          [pos, ...tokens] = this._feed(chunk, pos);
5812          allTokens.push(...tokens);
5813        }
5814        return allTokens;
5815      }
5816      end() {
5817        const tail = this._lookbehind;
5818        this._lookbehind = new Uint8Array();
5819        return tail;
5820      }
5821      _feed(data3, bufPos) {
5822        const tokens = [];
5823        let pos = -this._lookbehind.length;
5824        if (pos < 0) {
5825          while (pos < 0 && pos <= data3.length - this._needle.length) {
5826            const ch = this._charAt(data3, pos + this._needle.length - 1);
5827            if (ch === this._lastChar && this._memcmp(data3, pos, this._needle.length - 1)) {
5828              if (pos > -this._lookbehind.length) {
5829                tokens.push(this._lookbehind.slice(0, this._lookbehind.length + pos));
5830              }
5831              tokens.push(MATCH);
5832              this._lookbehind = new Uint8Array();
5833              return [
5834                pos + this._needle.length,
5835                ...tokens
5836              ];
5837            } else {
5838              pos += this._occ[ch];
5839            }
5840          }
5841          if (pos < 0) {
5842            while (pos < 0 && !this._memcmp(data3, pos, data3.length - pos)) {
5843              pos++;
5844            }
5845          }
5846          if (pos >= 0) {
5847            tokens.push(this._lookbehind);
5848            this._lookbehind = new Uint8Array();
5849          } else {
5850            const bytesToCutOff = this._lookbehind.length + pos;
5851            if (bytesToCutOff > 0) {
5852              tokens.push(this._lookbehind.slice(0, bytesToCutOff));
5853              this._lookbehind = this._lookbehind.slice(bytesToCutOff);
5854            }
5855            this._lookbehind = Uint8Array.from(new Array(this._lookbehind.length + data3.length), (_, i) => this._charAt(data3, i - this._lookbehind.length));
5856            return [
5857              data3.length,
5858              ...tokens
5859            ];
5860          }
5861        }
5862        pos += bufPos;
5863        while (pos <= data3.length - this._needle.length) {
5864          const ch = data3[pos + this._needle.length - 1];
5865          if (ch === this._lastChar && data3[pos] === this._needle[0] && jsmemcmp(this._needle, 0, data3, pos, this._needle.length - 1)) {
5866            if (pos > bufPos) {
5867              tokens.push(data3.slice(bufPos, pos));
5868            }
5869            tokens.push(MATCH);
5870            return [
5871              pos + this._needle.length,
5872              ...tokens
5873            ];
5874          } else {
5875            pos += this._occ[ch];
5876          }
5877        }
5878        if (pos < data3.length) {
5879          while (pos < data3.length && (data3[pos] !== this._needle[0] || !jsmemcmp(data3, pos, this._needle, 0, data3.length - pos))) {
5880            ++pos;
5881          }
5882          if (pos < data3.length) {
5883            this._lookbehind = data3.slice(pos);
5884          }
5885        }
5886        if (pos > 0) {
5887          tokens.push(data3.slice(bufPos, pos < data3.length ? pos : data3.length));
5888        }
5889        return [
5890          data3.length,
5891          ...tokens
5892        ];
5893      }
5894      _charAt(data3, pos) {
5895        if (pos < 0) {
5896          return this._lookbehind[this._lookbehind.length + pos];
5897        }
5898        return data3[pos];
5899      }
5900      _memcmp(data3, pos, len) {
5901        return jsmemcmp(this._charAt.bind(this, data3), pos, this._needle, 0, len);
5902      }
5903    };
5904    ReadableStreamSearch = class {
5905      constructor(needle, _readableStream) {
5906        this._readableStream = _readableStream;
5907        this._search = new StreamSearch(needle);
5908      }
5909      async *[Symbol.asyncIterator]() {
5910        const reader = this._readableStream.getReader();
5911        try {
5912          while (true) {
5913            const result = await reader.read();
5914            if (result.done) {
5915              break;
5916            }
5917            yield* this._search.feed(result.value);
5918          }
5919          const tail = this._search.end();
5920          if (tail.length) {
5921            yield tail;
5922          }
5923        } finally {
5924          reader.releaseLock();
5925        }
5926      }
5927    };
5928    EOQ = Symbol("End of Queue");
5929  }
5930});
5931
vendor: 6,436 bytes, lines 5932-6139
5932// node_modules/.pnpm/@[email protected]/node_modules/@web3-storage/multipart-parser/esm/src/index.js
5933function parseContentDisposition(header) {
5934  const parts = header.split(";").map((part) => part.trim());
5935  if (parts.shift() !== "form-data") {
5936    throw new Error('malformed content-disposition header: missing "form-data" in `' + JSON.stringify(parts) + "`");
5937  }
5938  const out = {};
5939  for (const part of parts) {
5940    const kv = part.split("=", 2);
5941    if (kv.length !== 2) {
5942      throw new Error("malformed content-disposition header: key-value pair not found - " + part + " in `" + header + "`");
5943    }
5944    const [name, value] = kv;
5945    if (value[0] === '"' && value[value.length - 1] === '"') {
5946      out[name] = value.slice(1, -1).replace(/\\"/g, '"');
5947    } else if (value[0] !== '"' && value[value.length - 1] !== '"') {
5948      out[name] = value;
5949    } else if (value[0] === '"' && value[value.length - 1] !== '"' || value[0] !== '"' && value[value.length - 1] === '"') {
5950      throw new Error("malformed content-disposition header: mismatched quotations in `" + header + "`");
5951    }
5952  }
5953  if (!out.name) {
5954    throw new Error("malformed content-disposition header: missing field name in `" + header + "`");
5955  }
5956  return out;
5957}
5958function parsePartHeaders(lines) {
5959  const entries = [];
5960  let disposition = false;
5961  let line;
5962  while (typeof (line = lines.shift()) !== "undefined") {
5963    const colon = line.indexOf(":");
5964    if (colon === -1) {
5965      throw new Error("malformed multipart-form header: missing colon");
5966    }
5967    const header = line.slice(0, colon).trim().toLowerCase();
5968    const value = line.slice(colon + 1).trim();
5969    switch (header) {
5970      case "content-disposition":
5971        disposition = true;
5972        entries.push(...Object.entries(parseContentDisposition(value)));
5973        break;
5974      case "content-type":
5975        entries.push([
5976          "contentType",
5977          value
5978        ]);
5979    }
5980  }
5981  if (!disposition) {
5982    throw new Error("malformed multipart-form header: missing content-disposition");
5983  }
5984  return Object.fromEntries(entries);
5985}
5986async function readHeaderLines(it, needle) {
5987  let firstChunk = true;
5988  let lastTokenWasMatch = false;
5989  const headerLines = [[]];
5990  const crlfSearch = new StreamSearch(CRLF);
5991  for (; ; ) {
5992    const result = await it.next();
5993    if (result.done) {
5994      throw new Error("malformed multipart-form data: unexpected end of stream");
5995    }
5996    if (firstChunk && result.value !== MATCH && arraysEqual(result.value.slice(0, 2), dash)) {
5997      return [
5998        void 0,
5999        new Uint8Array()
6000      ];
6001    }
6002    let chunk;
6003    if (result.value !== MATCH) {
6004      chunk = result.value;
6005    } else if (!lastTokenWasMatch) {
6006      chunk = needle;
6007    } else {
6008      throw new Error("malformed multipart-form data: unexpected boundary");
6009    }
6010    if (!chunk.length) {
6011      continue;
6012    }
6013    if (firstChunk) {
6014      firstChunk = false;
6015    }
6016    const tokens = crlfSearch.feed(chunk);
6017    for (const [i, token] of tokens.entries()) {
6018      const isMatch = token === MATCH;
6019      if (!isMatch && !token.length) {
6020        continue;
6021      }
6022      if (lastTokenWasMatch && isMatch) {
6023        tokens.push(crlfSearch.end());
6024        return [
6025          headerLines.filter((chunks) => chunks.length).map(mergeArrays2).map(arrayToString),
6026          mergeArrays(...tokens.slice(i + 1).map((token2) => token2 === MATCH ? CRLF : token2))
6027        ];
6028      }
6029      if (lastTokenWasMatch = isMatch) {
6030        headerLines.push([]);
6031      } else {
6032        headerLines[headerLines.length - 1].push(token);
6033      }
6034    }
6035  }
6036}
6037async function* streamMultipart(body, boundary) {
6038  const needle = mergeArrays(dash, stringToArray(boundary));
6039  const it = new ReadableStreamSearch(needle, body)[Symbol.asyncIterator]();
6040  for (; ; ) {
6041    const result = await it.next();
6042    if (result.done) {
6043      return;
6044    }
6045    if (result.value === MATCH) {
6046      break;
6047    }
6048  }
6049  const crlfSearch = new StreamSearch(CRLF);
6050  for (; ; ) {
6051    let feedChunk = function(chunk) {
6052      const chunks = [];
6053      for (const token of crlfSearch.feed(chunk)) {
6054        if (trailingCRLF) {
6055          chunks.push(CRLF);
6056        }
6057        if (!(trailingCRLF = token === MATCH)) {
6058          chunks.push(token);
6059        }
6060      }
6061      return mergeArrays(...chunks);
6062    };
6063    const [headerLines, tail] = await readHeaderLines(it, needle);
6064    if (!headerLines) {
6065      return;
6066    }
6067    async function nextToken() {
6068      const result = await it.next();
6069      if (result.done) {
6070        throw new Error("malformed multipart-form data: unexpected end of stream");
6071      }
6072      return result;
6073    }
6074    let trailingCRLF = false;
6075    let done = false;
6076    async function nextChunk() {
6077      const result = await nextToken();
6078      let chunk;
6079      if (result.value !== MATCH) {
6080        chunk = result.value;
6081      } else if (!trailingCRLF) {
6082        chunk = CRLF;
6083      } else {
6084        done = true;
6085        return { value: crlfSearch.end() };
6086      }
6087      return { value: feedChunk(chunk) };
6088    }
6089    const bufferedChunks = [{ value: feedChunk(tail) }];
6090    yield {
6091      ...parsePartHeaders(headerLines),
6092      data: {
6093        [Symbol.asyncIterator]() {
6094          return this;
6095        },
6096        async next() {
6097          for (; ; ) {
6098            const result = bufferedChunks.shift();
6099            if (!result) {
6100              break;
6101            }
6102            if (result.value.length > 0) {
6103              return result;
6104            }
6105          }
6106          for (; ; ) {
6107            if (done) {
6108              return {
6109                done,
6110                value: void 0
6111              };
6112            }
6113            const result = await nextChunk();
6114            if (result.value.length > 0) {
6115              return result;
6116            }
6117          }
6118        }
6119      }
6120    };
6121    while (!done) {
6122      bufferedChunks.push(await nextChunk());
6123    }
6124  }
6125}
6126var import_dist37, import_dist38, import_dist39, mergeArrays2, dash, CRLF;
6127var init_src = __esm({
6128  "node_modules/.pnpm/@[email protected]/node_modules/@web3-storage/multipart-parser/esm/src/index.js"() {
6129    import_dist37 = __toESM(require_dist());
6130    import_dist38 = __toESM(require_dist2());
6131    import_dist39 = __toESM(require_dist3());
6132    init_search();
6133    init_utils();
6134    mergeArrays2 = Function.prototype.apply.bind(mergeArrays, void 0);
6135    dash = stringToArray("--");
6136    CRLF = stringToArray("\r\n");
6137  }
6138});
6139
vendor: 1,538 bytes, lines 6140-6181
6140// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/formData.js
6141function composeUploadHandlers(...handlers) {
6142  return async (part) => {
6143    for (let handler of handlers) {
6144      let value = await handler(part);
6145      if (typeof value !== "undefined" && value !== null) {
6146        return value;
6147      }
6148    }
6149    return void 0;
6150  };
6151}
6152async function parseMultipartFormData(request, uploadHandler) {
6153  let contentType = request.headers.get("Content-Type") || "";
6154  let [type, boundary] = contentType.split(/\s*;\s*boundary=/);
6155  if (!request.body || !boundary || type !== "multipart/form-data") {
6156    throw new TypeError("Could not parse content as FormData.");
6157  }
6158  let formData = new FormData();
6159  let parts = streamMultipart(request.body, boundary);
6160  for await (let part of parts) {
6161    if (part.done) break;
6162    if (typeof part.filename === "string") {
6163      part.filename = part.filename.split(/[/\\]/).pop();
6164    }
6165    let value = await uploadHandler(part);
6166    if (typeof value !== "undefined" && value !== null) {
6167      formData.append(part.name, value);
6168    }
6169  }
6170  return formData;
6171}
6172var import_dist40, import_dist41, import_dist42;
6173var init_formData = __esm({
6174  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/formData.js"() {
6175    import_dist40 = __toESM(require_dist());
6176    import_dist41 = __toESM(require_dist2());
6177    import_dist42 = __toESM(require_dist3());
6178    init_src();
6179  }
6180});
6181
vendor: 662 bytes, lines 6182-6197
6182// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/entry.js
6183function createEntryRouteModules(manifest) {
6184  return Object.keys(manifest).reduce((memo, routeId) => {
6185    memo[routeId] = manifest[routeId].module;
6186    return memo;
6187  }, {});
6188}
6189var import_dist43, import_dist44, import_dist45;
6190var init_entry = __esm({
6191  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/entry.js"() {
6192    import_dist43 = __toESM(require_dist());
6193    import_dist44 = __toESM(require_dist2());
6194    import_dist45 = __toESM(require_dist3());
6195  }
6196});
6197
vendor: 773 bytes, lines 6198-6213
6198// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/invariant.js
6199function invariant2(value, message) {
6200  if (value === false || value === null || typeof value === "undefined") {
6201    console.error("The following error is a bug in Remix; please open an issue! https://github.com/remix-run/remix/issues/new");
6202    throw new Error(message);
6203  }
6204}
6205var import_dist46, import_dist47, import_dist48;
6206var init_invariant = __esm({
6207  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/invariant.js"() {
6208    import_dist46 = __toESM(require_dist());
6209    import_dist47 = __toESM(require_dist2());
6210    import_dist48 = __toESM(require_dist3());
6211  }
6212});
6213
vendor: 792 bytes, lines 6214-6233
6214// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/routeMatching.js
6215function matchServerRoutes(routes, pathname, basename) {
6216  let matches = matchRoutes(routes, pathname, basename);
6217  if (!matches) return null;
6218  return matches.map((match) => ({
6219    params: match.params,
6220    pathname: match.pathname,
6221    route: match.route
6222  }));
6223}
6224var import_dist49, import_dist50, import_dist51;
6225var init_routeMatching = __esm({
6226  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/routeMatching.js"() {
6227    import_dist49 = __toESM(require_dist());
6228    import_dist50 = __toESM(require_dist2());
6229    import_dist51 = __toESM(require_dist3());
6230    init_router();
6231  }
6232});
6233
vendor: 3,168 bytes, lines 6234-6344
6234// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/data.js
6235async function callRouteAction({
6236  loadContext,
6237  action,
6238  params,
6239  request,
6240  routeId,
6241  singleFetch
6242}) {
6243  let result = await action({
6244    request: singleFetch ? stripRoutesParam(stripIndexParam(request)) : stripDataParam(stripIndexParam(request)),
6245    context: loadContext,
6246    params
6247  });
6248  if (result === void 0) {
6249    throw new Error(`You defined an action for route "${routeId}" but didn't return anything from your \`action\` function. Please return a value or \`null\`.`);
6250  }
6251  if (singleFetch) {
6252    return result;
6253  }
6254  return isResponse2(result) ? result : json3(result);
6255}
6256async function callRouteLoader({
6257  loadContext,
6258  loader,
6259  params,
6260  request,
6261  routeId,
6262  singleFetch
6263}) {
6264  let result = await loader({
6265    request: singleFetch ? stripRoutesParam(stripIndexParam(request)) : stripDataParam(stripIndexParam(request)),
6266    context: loadContext,
6267    params
6268  });
6269  if (result === void 0) {
6270    throw new Error(`You defined a loader for route "${routeId}" but didn't return anything from your \`loader\` function. Please return a value or \`null\`.`);
6271  }
6272  if (isDeferredData2(result)) {
6273    if (result.init && isRedirectStatusCode(result.init.status || 200)) {
6274      return redirect3(new Headers(result.init.headers).get("Location"), result.init);
6275    }
6276    return result;
6277  }
6278  if (singleFetch) {
6279    return result;
6280  }
6281  return isResponse2(result) ? result : json3(result);
6282}
6283function stripIndexParam(request) {
6284  let url = new URL(request.url);
6285  let indexValues = url.searchParams.getAll("index");
6286  url.searchParams.delete("index");
6287  let indexValuesToKeep = [];
6288  for (let indexValue of indexValues) {
6289    if (indexValue) {
6290      indexValuesToKeep.push(indexValue);
6291    }
6292  }
6293  for (let toKeep of indexValuesToKeep) {
6294    url.searchParams.append("index", toKeep);
6295  }
6296  let init = {
6297    method: request.method,
6298    body: request.body,
6299    headers: request.headers,
6300    signal: request.signal
6301  };
6302  if (init.body) {
6303    init.duplex = "half";
6304  }
6305  return new Request(url.href, init);
6306}
6307function stripDataParam(request) {
6308  let url = new URL(request.url);
6309  url.searchParams.delete("_data");
6310  let init = {
6311    method: request.method,
6312    body: request.body,
6313    headers: request.headers,
6314    signal: request.signal
6315  };
6316  if (init.body) {
6317    init.duplex = "half";
6318  }
6319  return new Request(url.href, init);
6320}
6321function stripRoutesParam(request) {
6322  let url = new URL(request.url);
6323  url.searchParams.delete("_routes");
6324  let init = {
6325    method: request.method,
6326    body: request.body,
6327    headers: request.headers,
6328    signal: request.signal
6329  };
6330  if (init.body) {
6331    init.duplex = "half";
6332  }
6333  return new Request(url.href, init);
6334}
6335var import_dist52, import_dist53, import_dist54;
6336var init_data = __esm({
6337  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/data.js"() {
6338    import_dist52 = __toESM(require_dist());
6339    import_dist53 = __toESM(require_dist2());
6340    import_dist54 = __toESM(require_dist3());
6341    init_responses();
6342  }
6343});
6344
vendor: 2,500 bytes, lines 6345-6411
6345// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/routes.js
6346function groupRoutesByParentId(manifest) {
6347  let routes = {};
6348  Object.values(manifest).forEach((route) => {
6349    let parentId = route.parentId || "";
6350    if (!routes[parentId]) {
6351      routes[parentId] = [];
6352    }
6353    routes[parentId].push(route);
6354  });
6355  return routes;
6356}
6357function createRoutes(manifest, parentId = "", routesByParentId = groupRoutesByParentId(manifest)) {
6358  return (routesByParentId[parentId] || []).map((route) => ({
6359    ...route,
6360    children: createRoutes(manifest, route.id, routesByParentId)
6361  }));
6362}
6363function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesByParentId = groupRoutesByParentId(manifest)) {
6364  return (routesByParentId[parentId] || []).map((route) => {
6365    let commonRoute = {
6366      // Always include root due to default boundaries
6367      hasErrorBoundary: route.id === "root" || route.module.ErrorBoundary != null,
6368      id: route.id,
6369      path: route.path,
6370      loader: route.module.loader ? (
6371        // Need to use RR's version here to permit the optional context even
6372        // though we know it'll always be provided in remix
6373        (args, dataStrategyCtx) => callRouteLoader({
6374          request: args.request,
6375          params: args.params,
6376          loadContext: args.context,
6377          loader: route.module.loader,
6378          routeId: route.id,
6379          singleFetch: future.v3_singleFetch === true
6380        })
6381      ) : void 0,
6382      action: route.module.action ? (args, dataStrategyCtx) => callRouteAction({
6383        request: args.request,
6384        params: args.params,
6385        loadContext: args.context,
6386        action: route.module.action,
6387        routeId: route.id,
6388        singleFetch: future.v3_singleFetch === true
6389      }) : void 0,
6390      handle: route.module.handle
6391    };
6392    return route.index ? {
6393      index: true,
6394      ...commonRoute
6395    } : {
6396      caseSensitive: route.caseSensitive,
6397      children: createStaticHandlerDataRoutes(manifest, future, route.id, routesByParentId),
6398      ...commonRoute
6399    };
6400  });
6401}
6402var import_dist55, import_dist56, import_dist57;
6403var init_routes = __esm({
6404  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/routes.js"() {
6405    import_dist55 = __toESM(require_dist());
6406    import_dist56 = __toESM(require_dist2());
6407    import_dist57 = __toESM(require_dist3());
6408    init_data();
6409  }
6410});
6411
vendor: 804 bytes, lines 6412-6432
6412// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/markup.js
6413function escapeHtml(html) {
6414  return html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
6415}
6416var import_dist58, import_dist59, import_dist60, ESCAPE_LOOKUP, ESCAPE_REGEX;
6417var init_markup = __esm({
6418  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/markup.js"() {
6419    import_dist58 = __toESM(require_dist());
6420    import_dist59 = __toESM(require_dist2());
6421    import_dist60 = __toESM(require_dist3());
6422    ESCAPE_LOOKUP = {
6423      "&": "\\u0026",
6424      ">": "\\u003e",
6425      "<": "\\u003c",
6426      "\u2028": "\\u2028",
6427      "\u2029": "\\u2029"
6428    };
6429    ESCAPE_REGEX = /[&><\u2028\u2029]/g;
6430  }
6431});
6432
vendor: 632 bytes, lines 6433-6446
6433// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/serverHandoff.js
6434function createServerHandoffString(serverHandoff) {
6435  return escapeHtml(JSON.stringify(serverHandoff));
6436}
6437var import_dist61, import_dist62, import_dist63;
6438var init_serverHandoff = __esm({
6439  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/serverHandoff.js"() {
6440    import_dist61 = __toESM(require_dist());
6441    import_dist62 = __toESM(require_dist2());
6442    import_dist63 = __toESM(require_dist3());
6443    init_markup();
6444  }
6445});
6446
vendor: 1,508 bytes, lines 6447-6488
6447// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/dev.js
6448async function broadcastDevReady(build, origin) {
6449  origin ?? (origin = process.env.REMIX_DEV_ORIGIN);
6450  if (!origin) throw Error("Dev server origin not set");
6451  let url = new URL(origin);
6452  url.pathname = "ping";
6453  let response = await fetch(url.href, {
6454    method: "POST",
6455    headers: {
6456      "Content-Type": "application/json"
6457    },
6458    body: JSON.stringify({
6459      buildHash: build.assets.version
6460    })
6461  }).catch((error) => {
6462    console.error(`Could not reach Remix dev server at ${url}`);
6463    throw error;
6464  });
6465  if (!response.ok) {
6466    console.error(`Could not reach Remix dev server at ${url} (${response.status})`);
6467    throw Error(await response.text());
6468  }
6469}
6470function logDevReady(build) {
6471  console.log(`[REMIX DEV] ${build.assets.version} ready`);
6472}
6473function setDevServerHooks(devServerHooks) {
6474  globalThis[globalDevServerHooksKey] = devServerHooks;
6475}
6476function getDevServerHooks() {
6477  return globalThis[globalDevServerHooksKey];
6478}
6479var import_dist64, import_dist65, import_dist66, globalDevServerHooksKey;
6480var init_dev = __esm({
6481  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/dev.js"() {
6482    import_dist64 = __toESM(require_dist());
6483    import_dist65 = __toESM(require_dist2());
6484    import_dist66 = __toESM(require_dist3());
6485    globalDevServerHooksKey = "__remix_devServerHooks";
6486  }
6487});
6488
vendor: 1,032 bytes, lines 6489-6501
6489// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/deprecations.js
6490function resourceRouteJsonWarning(type, routeId) {
6491  return `⚠️ REMIX FUTURE CHANGE: Externally-accessed resource routes will no longer be able to return raw JavaScript objects or \`null\` in React Router v7 when Single Fetch becomes the default. You can prepare for this change at your convenience by wrapping the data returned from your \`${type}\` function in the \`${routeId}\` route with \`json()\`.  For instructions on making this change, see https://remix.run/docs/en/v2.13.1/guides/single-fetch#resource-routes`;
6492}
6493var import_dist67, import_dist68, import_dist69;
6494var init_deprecations = __esm({
6495  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/deprecations.js"() {
6496    import_dist67 = __toESM(require_dist());
6497    import_dist68 = __toESM(require_dist2());
6498    import_dist69 = __toESM(require_dist3());
6499  }
6500});
6501
vendor: 17,532 bytes, lines 6502-6959
6502// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/server.js
6503function derive(build, mode) {
6504  var _build$future, _build$future2;
6505  let routes = createRoutes(build.routes);
6506  let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future);
6507  let serverMode = isServerMode(mode) ? mode : ServerMode.Production;
6508  let staticHandler = createStaticHandler(dataRoutes, {
6509    basename: build.basename,
6510    future: {
6511      v7_relativeSplatPath: ((_build$future = build.future) === null || _build$future === void 0 ? void 0 : _build$future.v3_relativeSplatPath) === true,
6512      v7_throwAbortReason: ((_build$future2 = build.future) === null || _build$future2 === void 0 ? void 0 : _build$future2.v3_throwAbortReason) === true
6513    }
6514  });
6515  let errorHandler = build.entry.module.handleError || ((error, {
6516    request
6517  }) => {
6518    if (serverMode !== ServerMode.Test && !request.signal.aborted) {
6519      console.error(
6520        // @ts-expect-error This is "private" from users but intended for internal use
6521        isRouteErrorResponse(error) && error.error ? error.error : error
6522      );
6523    }
6524  });
6525  return {
6526    routes,
6527    dataRoutes,
6528    serverMode,
6529    staticHandler,
6530    errorHandler
6531  };
6532}
6533async function handleManifestRequest(build, routes, url) {
6534  if (build.assets.version !== url.searchParams.get("version")) {
6535    return new Response(null, {
6536      status: 204,
6537      headers: {
6538        "X-Remix-Reload-Document": "true"
6539      }
6540    });
6541  }
6542  let patches = {};
6543  if (url.searchParams.has("p")) {
6544    let paths = /* @__PURE__ */ new Set();
6545    url.searchParams.getAll("p").forEach((path) => {
6546      if (!path.startsWith("/")) {
6547        path = `/${path}`;
6548      }
6549      let segments = path.split("/").slice(1);
6550      segments.forEach((_, i) => {
6551        let partialPath = segments.slice(0, i + 1).join("/");
6552        paths.add(`/${partialPath}`);
6553      });
6554    });
6555    for (let path of paths) {
6556      let matches = matchServerRoutes(routes, path, build.basename);
6557      if (matches) {
6558        for (let match of matches) {
6559          let routeId = match.route.id;
6560          patches[routeId] = build.assets.routes[routeId];
6561        }
6562      }
6563    }
6564    return json3(patches, {
6565      headers: {
6566        "Cache-Control": "public, max-age=31536000, immutable"
6567      }
6568    });
6569  }
6570  return new Response("Invalid Request", {
6571    status: 400
6572  });
6573}
6574async function handleDataRequest(serverMode, build, staticHandler, routeId, request, loadContext, handleError) {
6575  try {
6576    let response = await staticHandler.queryRoute(request, {
6577      routeId,
6578      requestContext: loadContext
6579    });
6580    if (isRedirectResponse2(response)) {
6581      return createRemixRedirectResponse(response, build.basename);
6582    }
6583    if (UNSAFE_DEFERRED_SYMBOL in response) {
6584      let deferredData = response[UNSAFE_DEFERRED_SYMBOL];
6585      let body = createDeferredReadableStream(deferredData, request.signal, serverMode);
6586      let init = deferredData.init || {};
6587      let headers = new Headers(init.headers);
6588      headers.set("Content-Type", "text/remix-deferred");
6589      headers.set("X-Remix-Response", "yes");
6590      init.headers = headers;
6591      return new Response(body, init);
6592    }
6593    response = safelySetHeader(response, "X-Remix-Response", "yes");
6594    return response;
6595  } catch (error) {
6596    if (isResponse2(error)) {
6597      let response = safelySetHeader(error, "X-Remix-Catch", "yes");
6598      return response;
6599    }
6600    if (isRouteErrorResponse(error)) {
6601      handleError(error);
6602      return errorResponseToJson(error, serverMode);
6603    }
6604    let errorInstance = error instanceof Error || error instanceof DOMException ? error : new Error("Unexpected Server Error");
6605    handleError(errorInstance);
6606    return json(serializeError(errorInstance, serverMode), {
6607      status: 500,
6608      headers: {
6609        "X-Remix-Error": "yes"
6610      }
6611    });
6612  }
6613}
6614async function handleSingleFetchRequest(serverMode, build, staticHandler, request, handlerUrl, loadContext, handleError) {
6615  let {
6616    result,
6617    headers,
6618    status
6619  } = request.method !== "GET" ? await singleFetchAction(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) : await singleFetchLoaders(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError);
6620  let resultHeaders = new Headers(headers);
6621  resultHeaders.set("X-Remix-Response", "yes");
6622  if (NO_BODY_STATUS_CODES.has(status)) {
6623    return new Response(null, {
6624      status,
6625      headers: resultHeaders
6626    });
6627  }
6628  resultHeaders.set("Content-Type", "text/x-script");
6629  return new Response(encodeViaTurboStream(result, request.signal, build.entry.module.streamTimeout, serverMode), {
6630    status: status || 200,
6631    headers: resultHeaders
6632  });
6633}
6634async function handleDocumentRequest(serverMode, build, staticHandler, request, loadContext, handleError, criticalCss) {
6635  let context;
6636  try {
6637    if (request.method === "POST") {
6638      throwIfPotentialCSRFAttack(request.headers);
6639    }
6640    context = await staticHandler.query(request, {
6641      requestContext: loadContext
6642    });
6643  } catch (error) {
6644    handleError(error);
6645    return new Response(null, {
6646      status: 500
6647    });
6648  }
6649  if (isResponse2(context)) {
6650    return context;
6651  }
6652  let headers = getDocumentHeaders(build, context);
6653  if (NO_BODY_STATUS_CODES.has(context.statusCode)) {
6654    return new Response(null, {
6655      status: context.statusCode,
6656      headers
6657    });
6658  }
6659  if (context.errors) {
6660    Object.values(context.errors).forEach((err) => {
6661      if (!isRouteErrorResponse(err) || err.error) {
6662        handleError(err);
6663      }
6664    });
6665    context.errors = sanitizeErrors(context.errors, serverMode);
6666  }
6667  let state = {
6668    loaderData: context.loaderData,
6669    actionData: context.actionData,
6670    errors: serializeErrors(context.errors, serverMode)
6671  };
6672  let entryContext = {
6673    manifest: build.assets,
6674    routeModules: createEntryRouteModules(build.routes),
6675    staticHandlerContext: context,
6676    criticalCss,
6677    serverHandoffString: createServerHandoffString({
6678      basename: build.basename,
6679      criticalCss,
6680      future: build.future,
6681      isSpaMode: build.isSpaMode,
6682      ...!build.future.v3_singleFetch ? {
6683        state
6684      } : null
6685    }),
6686    ...build.future.v3_singleFetch ? {
6687      serverHandoffStream: encodeViaTurboStream(state, request.signal, build.entry.module.streamTimeout, serverMode),
6688      renderMeta: {}
6689    } : null,
6690    future: build.future,
6691    isSpaMode: build.isSpaMode,
6692    serializeError: (err) => serializeError(err, serverMode)
6693  };
6694  let handleDocumentRequestFunction = build.entry.module.default;
6695  try {
6696    return await handleDocumentRequestFunction(request, context.statusCode, headers, entryContext, loadContext);
6697  } catch (error) {
6698    handleError(error);
6699    let errorForSecondRender = error;
6700    if (isResponse2(error)) {
6701      try {
6702        let data3 = await unwrapResponse(error);
6703        errorForSecondRender = new ErrorResponseImpl(error.status, error.statusText, data3);
6704      } catch (e) {
6705      }
6706    }
6707    context = getStaticContextFromError(staticHandler.dataRoutes, context, errorForSecondRender);
6708    if (context.errors) {
6709      context.errors = sanitizeErrors(context.errors, serverMode);
6710    }
6711    let state2 = {
6712      loaderData: context.loaderData,
6713      actionData: context.actionData,
6714      errors: serializeErrors(context.errors, serverMode)
6715    };
6716    entryContext = {
6717      ...entryContext,
6718      staticHandlerContext: context,
6719      serverHandoffString: createServerHandoffString({
6720        basename: build.basename,
6721        future: build.future,
6722        isSpaMode: build.isSpaMode,
6723        ...!build.future.v3_singleFetch ? {
6724          state: state2
6725        } : null
6726      }),
6727      ...build.future.v3_singleFetch ? {
6728        serverHandoffStream: encodeViaTurboStream(state2, request.signal, build.entry.module.streamTimeout, serverMode),
6729        renderMeta: {}
6730      } : null
6731    };
6732    try {
6733      return await handleDocumentRequestFunction(request, context.statusCode, headers, entryContext, loadContext);
6734    } catch (error2) {
6735      handleError(error2);
6736      return returnLastResortErrorResponse(error2, serverMode);
6737    }
6738  }
6739}
6740async function handleResourceRequest(serverMode, build, staticHandler, routeId, request, loadContext, handleError) {
6741  try {
6742    let response = await staticHandler.queryRoute(request, {
6743      routeId,
6744      requestContext: loadContext
6745    });
6746    if (typeof response === "object" && response !== null) {
6747      invariant2(!(UNSAFE_DEFERRED_SYMBOL in response), `You cannot return a \`defer()\` response from a Resource Route.  Did you forget to export a default UI component from the "${routeId}" route?`);
6748    }
6749    if (build.future.v3_singleFetch && !isResponse2(response)) {
6750      console.warn(resourceRouteJsonWarning(request.method === "GET" ? "loader" : "action", routeId));
6751      response = json3(response);
6752    }
6753    invariant2(isResponse2(response), "Expected a Response to be returned from queryRoute");
6754    return response;
6755  } catch (error) {
6756    if (isResponse2(error)) {
6757      let response = safelySetHeader(error, "X-Remix-Catch", "yes");
6758      return response;
6759    }
6760    if (isRouteErrorResponse(error)) {
6761      if (error) {
6762        handleError(error);
6763      }
6764      return errorResponseToJson(error, serverMode);
6765    }
6766    handleError(error);
6767    return returnLastResortErrorResponse(error, serverMode);
6768  }
6769}
6770function errorResponseToJson(errorResponse, serverMode) {
6771  return json(serializeError(
6772    // @ts-expect-error This is "private" from users but intended for internal use
6773    errorResponse.error || new Error("Unexpected Server Error"),
6774    serverMode
6775  ), {
6776    status: errorResponse.status,
6777    statusText: errorResponse.statusText,
6778    headers: {
6779      "X-Remix-Error": "yes"
6780    }
6781  });
6782}
6783function returnLastResortErrorResponse(error, serverMode) {
6784  let message = "Unexpected Server Error";
6785  if (serverMode !== ServerMode.Production) {
6786    message += `
6787
6788${String(error)}`;
6789  }
6790  return new Response(message, {
6791    status: 500,
6792    headers: {
6793      "Content-Type": "text/plain"
6794    }
6795  });
6796}
6797function unwrapResponse(response) {
6798  let contentType = response.headers.get("Content-Type");
6799  return contentType && /\bapplication\/json\b/.test(contentType) ? response.body == null ? null : response.json() : response.text();
6800}
6801function createRemixRedirectResponse(response, basename) {
6802  let headers = new Headers(response.headers);
6803  let redirectUrl = headers.get("Location");
6804  headers.set("X-Remix-Redirect", basename ? stripBasename(redirectUrl, basename) || redirectUrl : redirectUrl);
6805  headers.set("X-Remix-Status", String(response.status));
6806  headers.delete("Location");
6807  if (response.headers.get("Set-Cookie") !== null) {
6808    headers.set("X-Remix-Revalidate", "yes");
6809  }
6810  return new Response(null, {
6811    status: 204,
6812    headers
6813  });
6814}
6815function safelySetHeader(response, name, value) {
6816  let headers = new Headers(response.headers);
6817  headers.set(name, value);
6818  return new Response(response.body, {
6819    status: response.status,
6820    statusText: response.statusText,
6821    headers,
6822    duplex: response.body ? "half" : void 0
6823  });
6824}
6825var import_dist70, import_dist71, import_dist72, NO_BODY_STATUS_CODES, createRequestHandler;
6826var init_server = __esm({
6827  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/server.js"() {
6828    import_dist70 = __toESM(require_dist());
6829    import_dist71 = __toESM(require_dist2());
6830    import_dist72 = __toESM(require_dist3());
6831    init_router();
6832    init_entry();
6833    init_errors();
6834    init_headers();
6835    init_invariant();
6836    init_mode();
6837    init_routeMatching();
6838    init_routes();
6839    init_responses();
6840    init_serverHandoff();
6841    init_dev();
6842    init_single_fetch();
6843    init_deprecations();
6844    init_actions();
6845    NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([100, 101, 204, 205, 304]);
6846    createRequestHandler = (build, mode) => {
6847      let _build;
6848      let routes;
6849      let serverMode;
6850      let staticHandler;
6851      let errorHandler;
6852      return async function requestHandler(request, loadContext = {}) {
6853        _build = typeof build === "function" ? await build() : build;
6854        mode ?? (mode = _build.mode);
6855        if (typeof build === "function") {
6856          let derived = derive(_build, mode);
6857          routes = derived.routes;
6858          serverMode = derived.serverMode;
6859          staticHandler = derived.staticHandler;
6860          errorHandler = derived.errorHandler;
6861        } else if (!routes || !serverMode || !staticHandler || !errorHandler) {
6862          let derived = derive(_build, mode);
6863          routes = derived.routes;
6864          serverMode = derived.serverMode;
6865          staticHandler = derived.staticHandler;
6866          errorHandler = derived.errorHandler;
6867        }
6868        let url = new URL(request.url);
6869        let params = {};
6870        let handleError = (error) => {
6871          if (mode === ServerMode.Development) {
6872            var _getDevServerHooks, _getDevServerHooks$pr;
6873            (_getDevServerHooks = getDevServerHooks()) === null || _getDevServerHooks === void 0 ? void 0 : (_getDevServerHooks$pr = _getDevServerHooks.processRequestError) === null || _getDevServerHooks$pr === void 0 ? void 0 : _getDevServerHooks$pr.call(_getDevServerHooks, error);
6874          }
6875          errorHandler(error, {
6876            context: loadContext,
6877            params,
6878            request
6879          });
6880        };
6881        let manifestUrl = `${_build.basename ?? "/"}/__manifest`.replace(/\/+/g, "/");
6882        if (url.pathname === manifestUrl) {
6883          try {
6884            let res = await handleManifestRequest(_build, routes, url);
6885            return res;
6886          } catch (e) {
6887            handleError(e);
6888            return new Response("Unknown Server Error", {
6889              status: 500
6890            });
6891          }
6892        }
6893        let matches = matchServerRoutes(routes, url.pathname, _build.basename);
6894        if (matches && matches.length > 0) {
6895          Object.assign(params, matches[0].params);
6896        }
6897        let response;
6898        if (url.searchParams.has("_data")) {
6899          if (_build.future.v3_singleFetch) {
6900            handleError(new Error("Warning: Single fetch-enabled apps should not be making ?_data requests, this is likely to break in the future"));
6901          }
6902          let routeId = url.searchParams.get("_data");
6903          response = await handleDataRequest(serverMode, _build, staticHandler, routeId, request, loadContext, handleError);
6904          if (_build.entry.module.handleDataRequest) {
6905            response = await _build.entry.module.handleDataRequest(response, {
6906              context: loadContext,
6907              params,
6908              request
6909            });
6910            if (isRedirectResponse2(response)) {
6911              response = createRemixRedirectResponse(response, _build.basename);
6912            }
6913          }
6914        } else if (_build.future.v3_singleFetch && url.pathname.endsWith(".data")) {
6915          let handlerUrl = new URL(request.url);
6916          handlerUrl.pathname = handlerUrl.pathname.replace(/\.data$/, "").replace(/^\/_root$/, "/");
6917          let singleFetchMatches = matchServerRoutes(routes, handlerUrl.pathname, _build.basename);
6918          response = await handleSingleFetchRequest(serverMode, _build, staticHandler, request, handlerUrl, loadContext, handleError);
6919          if (_build.entry.module.handleDataRequest) {
6920            response = await _build.entry.module.handleDataRequest(response, {
6921              context: loadContext,
6922              params: singleFetchMatches ? singleFetchMatches[0].params : {},
6923              request
6924            });
6925            if (isRedirectResponse2(response)) {
6926              let result = getSingleFetchRedirect(response.status, response.headers, _build.basename);
6927              if (request.method === "GET") {
6928                result = {
6929                  [SingleFetchRedirectSymbol]: result
6930                };
6931              }
6932              let headers = new Headers(response.headers);
6933              headers.set("Content-Type", "text/x-script");
6934              return new Response(encodeViaTurboStream(result, request.signal, _build.entry.module.streamTimeout, serverMode), {
6935                status: SINGLE_FETCH_REDIRECT_STATUS,
6936                headers
6937              });
6938            }
6939          }
6940        } else if (matches && matches[matches.length - 1].route.module.default == null && matches[matches.length - 1].route.module.ErrorBoundary == null) {
6941          response = await handleResourceRequest(serverMode, _build, staticHandler, matches.slice(-1)[0].route.id, request, loadContext, handleError);
6942        } else {
6943          var _getDevServerHooks2, _getDevServerHooks2$g;
6944          let criticalCss = mode === ServerMode.Development ? await ((_getDevServerHooks2 = getDevServerHooks()) === null || _getDevServerHooks2 === void 0 ? void 0 : (_getDevServerHooks2$g = _getDevServerHooks2.getCriticalCss) === null || _getDevServerHooks2$g === void 0 ? void 0 : _getDevServerHooks2$g.call(_getDevServerHooks2, _build, url.pathname)) : void 0;
6945          response = await handleDocumentRequest(serverMode, _build, staticHandler, request, loadContext, handleError, criticalCss);
6946        }
6947        if (request.method === "HEAD") {
6948          return new Response(null, {
6949            headers: response.headers,
6950            status: response.status,
6951            statusText: response.statusText
6952          });
6953        }
6954        return response;
6955      };
6956    };
6957  }
6958});
6959
vendor: 3,638 bytes, lines 6960-7051
6960// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/sessions.js
6961function flash(name) {
6962  return `__flash_${name}__`;
6963}
6964function warnOnceAboutSigningSessionCookie(cookie) {
6965  warnOnce(cookie.isSigned, `The "${cookie.name}" cookie is not signed, but session cookies should be signed to prevent tampering on the client before they are sent back to the server. See https://remix.run/utils/cookies#signing-cookies for more information.`);
6966}
6967var import_dist73, import_dist74, import_dist75, createSession, isSession, createSessionStorageFactory;
6968var init_sessions = __esm({
6969  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/sessions.js"() {
6970    import_dist73 = __toESM(require_dist());
6971    import_dist74 = __toESM(require_dist2());
6972    import_dist75 = __toESM(require_dist3());
6973    init_cookies();
6974    init_warnings();
6975    createSession = (initialData = {}, id = "") => {
6976      let map = new Map(Object.entries(initialData));
6977      return {
6978        get id() {
6979          return id;
6980        },
6981        get data() {
6982          return Object.fromEntries(map);
6983        },
6984        has(name) {
6985          return map.has(name) || map.has(flash(name));
6986        },
6987        get(name) {
6988          if (map.has(name)) return map.get(name);
6989          let flashName = flash(name);
6990          if (map.has(flashName)) {
6991            let value = map.get(flashName);
6992            map.delete(flashName);
6993            return value;
6994          }
6995          return void 0;
6996        },
6997        set(name, value) {
6998          map.set(name, value);
6999        },
7000        flash(name, value) {
7001          map.set(flash(name), value);
7002        },
7003        unset(name) {
7004          map.delete(name);
7005        }
7006      };
7007    };
7008    isSession = (object) => {
7009      return object != null && typeof object.id === "string" && typeof object.data !== "undefined" && typeof object.has === "function" && typeof object.get === "function" && typeof object.set === "function" && typeof object.flash === "function" && typeof object.unset === "function";
7010    };
7011    createSessionStorageFactory = (createCookie) => ({
7012      cookie: cookieArg,
7013      createData,
7014      readData,
7015      updateData,
7016      deleteData
7017    }) => {
7018      let cookie = isCookie(cookieArg) ? cookieArg : createCookie((cookieArg === null || cookieArg === void 0 ? void 0 : cookieArg.name) || "__session", cookieArg);
7019      warnOnceAboutSigningSessionCookie(cookie);
7020      return {
7021        async getSession(cookieHeader, options) {
7022          let id = cookieHeader && await cookie.parse(cookieHeader, options);
7023          let data3 = id && await readData(id);
7024          return createSession(data3 || {}, id || "");
7025        },
7026        async commitSession(session, options) {
7027          let {
7028            id,
7029            data: data3
7030          } = session;
7031          let expires = (options === null || options === void 0 ? void 0 : options.maxAge) != null ? new Date(Date.now() + options.maxAge * 1e3) : (options === null || options === void 0 ? void 0 : options.expires) != null ? options.expires : cookie.expires;
7032          if (id) {
7033            await updateData(id, data3, expires);
7034          } else {
7035            id = await createData(data3, expires);
7036          }
7037          return cookie.serialize(id, options);
7038        },
7039        async destroySession(session, options) {
7040          await deleteData(session.id);
7041          return cookie.serialize("", {
7042            ...options,
7043            maxAge: void 0,
7044            expires: /* @__PURE__ */ new Date(0)
7045          });
7046        }
7047      };
7048    };
7049  }
7050});
7051
vendor: 1,665 bytes, lines 7052-7088
7052// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/sessions/cookieStorage.js
7053var import_dist76, import_dist77, import_dist78, createCookieSessionStorageFactory;
7054var init_cookieStorage = __esm({
7055  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/sessions/cookieStorage.js"() {
7056    import_dist76 = __toESM(require_dist());
7057    import_dist77 = __toESM(require_dist2());
7058    import_dist78 = __toESM(require_dist3());
7059    init_cookies();
7060    init_sessions();
7061    createCookieSessionStorageFactory = (createCookie) => ({
7062      cookie: cookieArg
7063    } = {}) => {
7064      let cookie = isCookie(cookieArg) ? cookieArg : createCookie((cookieArg === null || cookieArg === void 0 ? void 0 : cookieArg.name) || "__session", cookieArg);
7065      warnOnceAboutSigningSessionCookie(cookie);
7066      return {
7067        async getSession(cookieHeader, options) {
7068          return createSession(cookieHeader && await cookie.parse(cookieHeader, options) || {});
7069        },
7070        async commitSession(session, options) {
7071          let serializedCookie = await cookie.serialize(session.data, options);
7072          if (serializedCookie.length > 4096) {
7073            throw new Error("Cookie length will exceed browser maximum. Length: " + serializedCookie.length);
7074          }
7075          return serializedCookie;
7076        },
7077        async destroySession(_session, options) {
7078          return cookie.serialize("", {
7079            ...options,
7080            maxAge: void 0,
7081            expires: /* @__PURE__ */ new Date(0)
7082          });
7083        }
7084      };
7085    };
7086  }
7087});
7088
vendor: 1,552 bytes, lines 7089-7136
7089// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/sessions/memoryStorage.js
7090var import_dist79, import_dist80, import_dist81, createMemorySessionStorageFactory;
7091var init_memoryStorage = __esm({
7092  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/sessions/memoryStorage.js"() {
7093    import_dist79 = __toESM(require_dist());
7094    import_dist80 = __toESM(require_dist2());
7095    import_dist81 = __toESM(require_dist3());
7096    createMemorySessionStorageFactory = (createSessionStorage) => ({
7097      cookie
7098    } = {}) => {
7099      let map = /* @__PURE__ */ new Map();
7100      return createSessionStorage({
7101        cookie,
7102        async createData(data3, expires) {
7103          let id = Math.random().toString(36).substring(2, 10);
7104          map.set(id, {
7105            data: data3,
7106            expires
7107          });
7108          return id;
7109        },
7110        async readData(id) {
7111          if (map.has(id)) {
7112            let {
7113              data: data3,
7114              expires
7115            } = map.get(id);
7116            if (!expires || expires > /* @__PURE__ */ new Date()) {
7117              return data3;
7118            }
7119            if (expires) map.delete(id);
7120          }
7121          return null;
7122        },
7123        async updateData(id, data3, expires) {
7124          map.set(id, {
7125            data: data3,
7126            expires
7127          });
7128        },
7129        async deleteData(id) {
7130          map.delete(id);
7131        }
7132      });
7133    };
7134  }
7135});
7136
vendor: 772 bytes, lines 7137-7153
7137// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/upload/errors.js
7138var import_dist82, import_dist83, import_dist84, MaxPartSizeExceededError;
7139var init_errors2 = __esm({
7140  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/upload/errors.js"() {
7141    import_dist82 = __toESM(require_dist());
7142    import_dist83 = __toESM(require_dist2());
7143    import_dist84 = __toESM(require_dist3());
7144    MaxPartSizeExceededError = class extends Error {
7145      constructor(field, maxBytes) {
7146        super(`Field "${field}" exceeded upload size of ${maxBytes} bytes.`);
7147        this.field = field;
7148        this.maxBytes = maxBytes;
7149      }
7150    };
7151  }
7152});
7153
vendor: 1,287 bytes, lines 7154-7200
7154// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/upload/memoryUploadHandler.js
7155function createMemoryUploadHandler({
7156  filter,
7157  maxPartSize = 3e6
7158} = {}) {
7159  return async ({
7160    filename,
7161    contentType,
7162    name,
7163    data: data3
7164  }) => {
7165    if (filter && !await filter({
7166      filename,
7167      contentType,
7168      name
7169    })) {
7170      return void 0;
7171    }
7172    let size = 0;
7173    let chunks = [];
7174    for await (let chunk of data3) {
7175      size += chunk.byteLength;
7176      if (size > maxPartSize) {
7177        throw new MaxPartSizeExceededError(name, maxPartSize);
7178      }
7179      chunks.push(chunk);
7180    }
7181    if (typeof filename === "string") {
7182      return new File(chunks, filename, {
7183        type: contentType
7184      });
7185    }
7186    return await new Blob(chunks, {
7187      type: contentType
7188    }).text();
7189  };
7190}
7191var import_dist85, import_dist86, import_dist87;
7192var init_memoryUploadHandler = __esm({
7193  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/upload/memoryUploadHandler.js"() {
7194    import_dist85 = __toESM(require_dist());
7195    import_dist86 = __toESM(require_dist2());
7196    import_dist87 = __toESM(require_dist3());
7197    init_errors2();
7198  }
7199});
7200
vendor: 10,711 bytes, lines 7201-7610
7201// node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/index.js
7202var esm_exports = {};
7203__export(esm_exports, {
7204  MaxPartSizeExceededError: () => MaxPartSizeExceededError,
7205  UNSAFE_SingleFetchRedirectSymbol: () => SingleFetchRedirectSymbol,
7206  broadcastDevReady: () => broadcastDevReady,
7207  createCookieFactory: () => createCookieFactory,
7208  createCookieSessionStorageFactory: () => createCookieSessionStorageFactory,
7209  createMemorySessionStorageFactory: () => createMemorySessionStorageFactory,
7210  createRequestHandler: () => createRequestHandler,
7211  createSession: () => createSession,
7212  createSessionStorageFactory: () => createSessionStorageFactory,
7213  data: () => data2,
7214  defer: () => defer3,
7215  isCookie: () => isCookie,
7216  isSession: () => isSession,
7217  json: () => json3,
7218  logDevReady: () => logDevReady,
7219  redirect: () => redirect3,
7220  redirectDocument: () => redirectDocument2,
7221  replace: () => replace2,
7222  unstable_composeUploadHandlers: () => composeUploadHandlers,
7223  unstable_createMemoryUploadHandler: () => createMemoryUploadHandler,
7224  unstable_parseMultipartFormData: () => parseMultipartFormData,
7225  unstable_setDevServerHooks: () => setDevServerHooks
7226});
7227var import_dist88, import_dist89, import_dist90;
7228var init_esm = __esm({
7229  "node_modules/.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/esm/index.js"() {
7230    import_dist88 = __toESM(require_dist());
7231    import_dist89 = __toESM(require_dist2());
7232    import_dist90 = __toESM(require_dist3());
7233    init_cookies();
7234    init_formData();
7235    init_responses();
7236    init_single_fetch();
7237    init_server();
7238    init_sessions();
7239    init_cookieStorage();
7240    init_memoryStorage();
7241    init_memoryUploadHandler();
7242    init_errors2();
7243    init_dev();
7244  }
7245});
7246
7247export {
7248  Action,
7249  createBrowserHistory,
7250  invariant,
7251  warning,
7252  createPath,
7253  parsePath,
7254  convertRoutesToDataRoutes,
7255  matchRoutes,
7256  convertRouteMatchToUiMatch,
7257  generatePath,
7258  matchPath,
7259  decodePath,
7260  stripBasename,
7261  resolvePath,
7262  getResolveToMatches,
7263  resolveTo,
7264  joinPaths,
7265  data,
7266  AbortedDeferredError,
7267  DeferredData,
7268  redirect,
7269  ErrorResponseImpl,
7270  isRouteErrorResponse,
7271  IDLE_NAVIGATION,
7272  IDLE_FETCHER,
7273  IDLE_BLOCKER,
7274  createRouter,
7275  init_router,
7276  json3 as json,
7277  defer3 as defer,
7278  redirect3 as redirect2,
7279  replace2 as replace,
7280  redirectDocument2 as redirectDocument,
7281  decode,
7282  init_turbo_stream,
7283  SingleFetchRedirectSymbol,
7284  data2,
7285  esm_exports,
7286  init_esm
7287};
7288/*! Bundled license information:
7289
7290@remix-run/router/dist/router.js:
7291  (**
7292   * @remix-run/router v1.23.2
7293   *
7294   * Copyright (c) Remix Software Inc.
7295   *
7296   * This source code is licensed under the MIT license found in the
7297   * LICENSE.md file in the root directory of this source tree.
7298   *
7299   * @license MIT
7300   *)
7301
7302@remix-run/server-runtime/dist/esm/mode.js:
7303  (**
7304   * @remix-run/server-runtime v2.17.4
7305   *
7306   * Copyright (c) Remix Software Inc.
7307   *
7308   * This source code is licensed under the MIT license found in the
7309   * LICENSE.md file in the root directory of this source tree.
7310   *
7311   * @license MIT
7312   *)
7313
7314@remix-run/server-runtime/dist/esm/errors.js:
7315  (**
7316   * @remix-run/server-runtime v2.17.4
7317   *
7318   * Copyright (c) Remix Software Inc.
7319   *
7320   * This source code is licensed under the MIT license found in the
7321   * LICENSE.md file in the root directory of this source tree.
7322   *
7323   * @license MIT
7324   *)
7325
7326@remix-run/server-runtime/dist/esm/responses.js:
7327  (**
7328   * @remix-run/server-runtime v2.17.4
7329   *
7330   * Copyright (c) Remix Software Inc.
7331   *
7332   * This source code is licensed under the MIT license found in the
7333   * LICENSE.md file in the root directory of this source tree.
7334   *
7335   * @license MIT
7336   *)
7337
7338@remix-run/server-runtime/dist/esm/headers.js:
7339  (**
7340   * @remix-run/server-runtime v2.17.4
7341   *
7342   * Copyright (c) Remix Software Inc.
7343   *
7344   * This source code is licensed under the MIT license found in the
7345   * LICENSE.md file in the root directory of this source tree.
7346   *
7347   * @license MIT
7348   *)
7349
7350@remix-run/server-runtime/dist/esm/actions.js:
7351  (**
7352   * @remix-run/server-runtime v2.17.4
7353   *
7354   * Copyright (c) Remix Software Inc.
7355   *
7356   * This source code is licensed under the MIT license found in the
7357   * LICENSE.md file in the root directory of this source tree.
7358   *
7359   * @license MIT
7360   *)
7361
7362@remix-run/server-runtime/dist/esm/single-fetch.js:
7363  (**
7364   * @remix-run/server-runtime v2.17.4
7365   *
7366   * Copyright (c) Remix Software Inc.
7367   *
7368   * This source code is licensed under the MIT license found in the
7369   * LICENSE.md file in the root directory of this source tree.
7370   *
7371   * @license MIT
7372   *)
7373
7374cookie/index.js:
7375  (*!
7376   * cookie
7377   * Copyright(c) 2012-2014 Roman Shtylman
7378   * Copyright(c) 2015 Douglas Christopher Wilson
7379   * MIT Licensed
7380   *)
7381
7382@remix-run/server-runtime/dist/esm/warnings.js:
7383  (**
7384   * @remix-run/server-runtime v2.17.4
7385   *
7386   * Copyright (c) Remix Software Inc.
7387   *
7388   * This source code is licensed under the MIT license found in the
7389   * LICENSE.md file in the root directory of this source tree.
7390   *
7391   * @license MIT
7392   *)
7393
7394@remix-run/server-runtime/dist/esm/cookies.js:
7395  (**
7396   * @remix-run/server-runtime v2.17.4
7397   *
7398   * Copyright (c) Remix Software Inc.
7399   *
7400   * This source code is licensed under the MIT license found in the
7401   * LICENSE.md file in the root directory of this source tree.
7402   *
7403   * @license MIT
7404   *)
7405
7406@remix-run/server-runtime/dist/esm/formData.js:
7407  (**
7408   * @remix-run/server-runtime v2.17.4
7409   *
7410   * Copyright (c) Remix Software Inc.
7411   *
7412   * This source code is licensed under the MIT license found in the
7413   * LICENSE.md file in the root directory of this source tree.
7414   *
7415   * @license MIT
7416   *)
7417
7418@remix-run/server-runtime/dist/esm/entry.js:
7419  (**
7420   * @remix-run/server-runtime v2.17.4
7421   *
7422   * Copyright (c) Remix Software Inc.
7423   *
7424   * This source code is licensed under the MIT license found in the
7425   * LICENSE.md file in the root directory of this source tree.
7426   *
7427   * @license MIT
7428   *)
7429
7430@remix-run/server-runtime/dist/esm/invariant.js:
7431  (**
7432   * @remix-run/server-runtime v2.17.4
7433   *
7434   * Copyright (c) Remix Software Inc.
7435   *
7436   * This source code is licensed under the MIT license found in the
7437   * LICENSE.md file in the root directory of this source tree.
7438   *
7439   * @license MIT
7440   *)
7441
7442@remix-run/server-runtime/dist/esm/routeMatching.js:
7443  (**
7444   * @remix-run/server-runtime v2.17.4
7445   *
7446   * Copyright (c) Remix Software Inc.
7447   *
7448   * This source code is licensed under the MIT license found in the
7449   * LICENSE.md file in the root directory of this source tree.
7450   *
7451   * @license MIT
7452   *)
7453
7454@remix-run/server-runtime/dist/esm/data.js:
7455  (**
7456   * @remix-run/server-runtime v2.17.4
7457   *
7458   * Copyright (c) Remix Software Inc.
7459   *
7460   * This source code is licensed under the MIT license found in the
7461   * LICENSE.md file in the root directory of this source tree.
7462   *
7463   * @license MIT
7464   *)
7465
7466@remix-run/server-runtime/dist/esm/routes.js:
7467  (**
7468   * @remix-run/server-runtime v2.17.4
7469   *
7470   * Copyright (c) Remix Software Inc.
7471   *
7472   * This source code is licensed under the MIT license found in the
7473   * LICENSE.md file in the root directory of this source tree.
7474   *
7475   * @license MIT
7476   *)
7477
7478@remix-run/server-runtime/dist/esm/markup.js:
7479  (**
7480   * @remix-run/server-runtime v2.17.4
7481   *
7482   * Copyright (c) Remix Software Inc.
7483   *
7484   * This source code is licensed under the MIT license found in the
7485   * LICENSE.md file in the root directory of this source tree.
7486   *
7487   * @license MIT
7488   *)
7489
7490@remix-run/server-runtime/dist/esm/serverHandoff.js:
7491  (**
7492   * @remix-run/server-runtime v2.17.4
7493   *
7494   * Copyright (c) Remix Software Inc.
7495   *
7496   * This source code is licensed under the MIT license found in the
7497   * LICENSE.md file in the root directory of this source tree.
7498   *
7499   * @license MIT
7500   *)
7501
7502@remix-run/server-runtime/dist/esm/dev.js:
7503  (**
7504   * @remix-run/server-runtime v2.17.4
7505   *
7506   * Copyright (c) Remix Software Inc.
7507   *
7508   * This source code is licensed under the MIT license found in the
7509   * LICENSE.md file in the root directory of this source tree.
7510   *
7511   * @license MIT
7512   *)
7513
7514@remix-run/server-runtime/dist/esm/deprecations.js:
7515  (**
7516   * @remix-run/server-runtime v2.17.4
7517   *
7518   * Copyright (c) Remix Software Inc.
7519   *
7520   * This source code is licensed under the MIT license found in the
7521   * LICENSE.md file in the root directory of this source tree.
7522   *
7523   * @license MIT
7524   *)
7525
7526@remix-run/server-runtime/dist/esm/server.js:
7527  (**
7528   * @remix-run/server-runtime v2.17.4
7529   *
7530   * Copyright (c) Remix Software Inc.
7531   *
7532   * This source code is licensed under the MIT license found in the
7533   * LICENSE.md file in the root directory of this source tree.
7534   *
7535   * @license MIT
7536   *)
7537
7538@remix-run/server-runtime/dist/esm/sessions.js:
7539  (**
7540   * @remix-run/server-runtime v2.17.4
7541   *
7542   * Copyright (c) Remix Software Inc.
7543   *
7544   * This source code is licensed under the MIT license found in the
7545   * LICENSE.md file in the root directory of this source tree.
7546   *
7547   * @license MIT
7548   *)
7549
7550@remix-run/server-runtime/dist/esm/sessions/cookieStorage.js:
7551  (**
7552   * @remix-run/server-runtime v2.17.4
7553   *
7554   * Copyright (c) Remix Software Inc.
7555   *
7556   * This source code is licensed under the MIT license found in the
7557   * LICENSE.md file in the root directory of this source tree.
7558   *
7559   * @license MIT
7560   *)
7561
7562@remix-run/server-runtime/dist/esm/sessions/memoryStorage.js:
7563  (**
7564   * @remix-run/server-runtime v2.17.4
7565   *
7566   * Copyright (c) Remix Software Inc.
7567   *
7568   * This source code is licensed under the MIT license found in the
7569   * LICENSE.md file in the root directory of this source tree.
7570   *
7571   * @license MIT
7572   *)
7573
7574@remix-run/server-runtime/dist/esm/upload/errors.js:
7575  (**
7576   * @remix-run/server-runtime v2.17.4
7577   *
7578   * Copyright (c) Remix Software Inc.
7579   *
7580   * This source code is licensed under the MIT license found in the
7581   * LICENSE.md file in the root directory of this source tree.
7582   *
7583   * @license MIT
7584   *)
7585
7586@remix-run/server-runtime/dist/esm/upload/memoryUploadHandler.js:
7587  (**
7588   * @remix-run/server-runtime v2.17.4
7589   *
7590   * Copyright (c) Remix Software Inc.
7591   *
7592   * This source code is licensed under the MIT license found in the
7593   * LICENSE.md file in the root directory of this source tree.
7594   *
7595   * @license MIT
7596   *)
7597
7598@remix-run/server-runtime/dist/esm/index.js:
7599  (**
7600   * @remix-run/server-runtime v2.17.4
7601   *
7602   * Copyright (c) Remix Software Inc.
7603   *
7604   * This source code is licensed under the MIT license found in the
7605   * LICENSE.md file in the root directory of this source tree.
7606   *
7607   * @license MIT
7608   *)
7609*/
7610//# sourceMappingURL=chunk-6QRBSAIV.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.