next 14.2.28 → 14.2.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +1 -1
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/webpack-config.js +2 -2
  5. package/dist/client/app-bootstrap.js +1 -1
  6. package/dist/client/index.js +1 -1
  7. package/dist/compiled/next-server/server.runtime.prod.js +1 -1
  8. package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
  9. package/dist/esm/build/index.js +1 -1
  10. package/dist/esm/build/swc/index.js +1 -1
  11. package/dist/esm/build/webpack-config.js +2 -2
  12. package/dist/esm/client/app-bootstrap.js +1 -1
  13. package/dist/esm/client/index.js +1 -1
  14. package/dist/esm/server/base-server.js +1 -1
  15. package/dist/esm/server/base-server.js.map +1 -1
  16. package/dist/esm/server/config-schema.js +1 -0
  17. package/dist/esm/server/config-schema.js.map +1 -1
  18. package/dist/esm/server/config-shared.js +1 -0
  19. package/dist/esm/server/config-shared.js.map +1 -1
  20. package/dist/esm/server/config.js +1 -1
  21. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  22. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  23. package/dist/esm/server/lib/app-info-log.js +1 -1
  24. package/dist/esm/server/lib/router-server.js +7 -0
  25. package/dist/esm/server/lib/router-server.js.map +1 -1
  26. package/dist/esm/server/lib/router-utils/block-cross-site.js +66 -0
  27. package/dist/esm/server/lib/router-utils/block-cross-site.js.map +1 -0
  28. package/dist/esm/server/lib/start-server.js +1 -1
  29. package/dist/esm/server/web/adapter.js +4 -1
  30. package/dist/esm/server/web/adapter.js.map +1 -1
  31. package/dist/esm/server/web/sandbox/sandbox.js +1 -0
  32. package/dist/esm/server/web/sandbox/sandbox.js.map +1 -1
  33. package/dist/server/base-server.js +1 -1
  34. package/dist/server/base-server.js.map +1 -1
  35. package/dist/server/config-schema.js +1 -0
  36. package/dist/server/config-schema.js.map +1 -1
  37. package/dist/server/config-shared.d.ts +1 -0
  38. package/dist/server/config-shared.js +1 -0
  39. package/dist/server/config-shared.js.map +1 -1
  40. package/dist/server/config.js +1 -1
  41. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  42. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  43. package/dist/server/lib/app-info-log.js +1 -1
  44. package/dist/server/lib/router-server.js +7 -0
  45. package/dist/server/lib/router-server.js.map +1 -1
  46. package/dist/server/lib/router-utils/block-cross-site.d.ts +3 -0
  47. package/dist/server/lib/router-utils/block-cross-site.js +76 -0
  48. package/dist/server/lib/router-utils/block-cross-site.js.map +1 -0
  49. package/dist/server/lib/start-server.js +1 -1
  50. package/dist/server/web/adapter.js +4 -1
  51. package/dist/server/web/adapter.js.map +1 -1
  52. package/dist/server/web/sandbox/sandbox.js +1 -0
  53. package/dist/server/web/sandbox/sandbox.js.map +1 -1
  54. package/dist/telemetry/anonymous-meta.js +1 -1
  55. package/dist/telemetry/events/session-stopped.js +2 -2
  56. package/dist/telemetry/events/version.js +2 -2
  57. package/package.json +15 -15
package/dist/bin/next CHANGED
@@ -71,7 +71,7 @@ const program = new MyRootCommand();
71
71
  program.name("next").description("The Next.js CLI allows you to develop, build, start your application, and more.").configureHelp({
72
72
  formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
73
73
  subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
74
- }).helpCommand(false).helpOption("-h, --help", "Displays this message.").version(`Next.js v${"14.2.28"}`, "-v, --version", "Outputs the Next.js version.");
74
+ }).helpCommand(false).helpOption("-h, --help", "Displays this message.").version(`Next.js v${"14.2.30"}`, "-v, --version", "Outputs the Next.js version.");
75
75
  program.command("build").description("Creates an optimized production build of your application. The output displays information about each route.").argument("[directory]", `A directory on which to build the application. ${(0, _picocolors.italic)("If no directory is provided, the current directory will be used.")}`).option("-d, --debug", "Enables a more verbose build output.").option("--no-lint", "Disables linting.").option("--no-mangling", "Disables mangling.").option("--profile", "Enables production profiling for React.").option("--experimental-app-only", "Builds only App Router routes.").addOption(new _commander.Option("--experimental-turbo").hideHelp()).addOption(new _commander.Option("--experimental-build-mode [mode]", "Uses an experimental build mode.").choices([
76
76
  "compile",
77
77
  "generate"
@@ -358,7 +358,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
358
358
  const nextBuildSpan = (0, _trace.trace)("next-build", undefined, {
359
359
  buildMode: experimentalBuildMode,
360
360
  isTurboBuild: String(turboNextBuild),
361
- version: "14.2.28"
361
+ version: "14.2.30"
362
362
  });
363
363
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
364
364
  _buildcontext.NextBuildContext.dir = dir;
@@ -129,7 +129,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
129
129
  }
130
130
  return newObj;
131
131
  }
132
- const nextVersion = "14.2.28";
132
+ const nextVersion = "14.2.30";
133
133
  const ArchName = (0, _os.arch)();
134
134
  const PlatformName = (0, _os.platform)();
135
135
  const infoLog = (...args)=>{
@@ -1515,7 +1515,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1515
1515
  new _wellknownerrorsplugin.WellKnownErrorsPlugin(),
1516
1516
  isClient && new _copyfileplugin.CopyFilePlugin({
1517
1517
  filePath: require.resolve("./polyfills/polyfill-nomodule"),
1518
- cacheKey: "14.2.28",
1518
+ cacheKey: "14.2.30",
1519
1519
  name: `static/chunks/polyfills${dev ? "" : "-[hash]"}.js`,
1520
1520
  minimize: false,
1521
1521
  info: {
@@ -1743,7 +1743,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1743
1743
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1744
1744
  // - Next.js version
1745
1745
  // - next.config.js keys that affect compilation
1746
- version: `${__dirname}|${"14.2.28"}|${configVars}`,
1746
+ version: `${__dirname}|${"14.2.30"}|${configVars}`,
1747
1747
  cacheDirectory: _path.default.join(distDir, "cache", "webpack"),
1748
1748
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1749
1749
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "appBootstrap", {
13
13
  return appBootstrap;
14
14
  }
15
15
  });
16
- const version = "14.2.28";
16
+ const version = "14.2.30";
17
17
  window.next = {
18
18
  version,
19
19
  appDir: true
@@ -62,7 +62,7 @@ const _hooksclientcontextsharedruntime = require("../shared/lib/hooks-client-con
62
62
  const _onrecoverableerror = /*#__PURE__*/ _interop_require_default._(require("./on-recoverable-error"));
63
63
  const _tracer = /*#__PURE__*/ _interop_require_default._(require("./tracing/tracer"));
64
64
  const _reporttosocket = /*#__PURE__*/ _interop_require_default._(require("./tracing/report-to-socket"));
65
- const version = "14.2.28";
65
+ const version = "14.2.30";
66
66
  let router;
67
67
  const emitter = (0, _mitt.default)();
68
68
  const looseToArray = (input)=>[].slice.call(input);
@@ -13,6 +13,6 @@
13
13
  `)}}class e5 extends Error{constructor(){super(`The request.ua has been removed in favour of \`userAgent\` function.
14
14
  Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent
15
15
  `)}}var e7=r("./dist/esm/server/web/spec-extension/cookies.js");let te=Symbol("internal request");class tt extends Request{constructor(e,t={}){let r="string"!=typeof e&&"url"in e?e.url:String(e);(function(e){try{String(new URL(String(e)))}catch(t){throw Error(`URL is malformed "${String(e)}". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`,{cause:t})}})(r),e instanceof Request?super(e,t):super(r,t);let i=new e6(r,{headers:eK(this.headers),nextConfig:t.nextConfig});this[te]={cookies:new e7.qC(this.headers),geo:t.geo||{},ip:t.ip,nextUrl:i,url:process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE?r:i.toString()}}[Symbol.for("edge-runtime.inspect.custom")](){return{cookies:this.cookies,geo:this.geo,ip:this.ip,nextUrl:this.nextUrl,url:this.url,bodyUsed:this.bodyUsed,cache:this.cache,credentials:this.credentials,destination:this.destination,headers:Object.fromEntries(this.headers),integrity:this.integrity,keepalive:this.keepalive,method:this.method,mode:this.mode,redirect:this.redirect,referrer:this.referrer,referrerPolicy:this.referrerPolicy,signal:this.signal}}get cookies(){return this[te].cookies}get geo(){return this[te].geo}get ip(){return this[te].ip}get nextUrl(){return this[te].nextUrl}get page(){throw new e9}get ua(){throw new e5}get url(){return this[te].url}}let tr="ResponseAborted";class ti extends Error{constructor(...e){super(...e),this.name=tr}}function ts(e){let t=new AbortController;return e.once("close",()=>{e.writableFinished||t.abort(new ti)}),t}class tn{static fromBaseNextRequest(e,t){return"request"in e&&e.request?tn.fromWebNextRequest(e):tn.fromNodeNextRequest(e,t)}static fromNodeNextRequest(e,t){let r,i=null;if("GET"!==e.method&&"HEAD"!==e.method&&e.body&&(i=e.body),e.url.startsWith("http"))r=new URL(e.url);else{let t=_(e,"initURL");r=t&&t.startsWith("http")?new URL(e.url,t):new URL(e.url,"http://n")}return new tt(r,{method:e.method,headers:eB(e.headers),duplex:"half",signal:t,...t.aborted?{}:{body:i}})}static fromWebNextRequest(e){let t=null;return"GET"!==e.method&&"HEAD"!==e.method&&(t=e.body),new tt(e.url,{method:e.method,headers:eB(e.headers),duplex:"half",signal:e.request.signal,...e.request.signal.aborted?{}:{body:t}})}}class ta{constructor(){let e,t;this.promise=new Promise((r,i)=>{e=r,t=i}),this.resolve=e,this.reject=t}}let to=0,tl=0,th=0;function td(e){return(null==e?void 0:e.name)==="AbortError"||(null==e?void 0:e.name)===tr}async function tu(e,t,r){try{let{errored:i,destroyed:s}=t;if(i||s)return;let n=ts(t),a=function(e,t){let r=!1,i=new ta;function s(){i.resolve()}e.on("drain",s),e.once("close",()=>{e.off("drain",s),i.resolve()});let n=new ta;return e.once("finish",()=>{n.resolve()}),new WritableStream({write:async t=>{if(!r){if(r=!0,"performance"in globalThis&&process.env.NEXT_OTEL_PERFORMANCE_PREFIX){let e=function(e={}){let t=0===to?void 0:{clientComponentLoadStart:to,clientComponentLoadTimes:tl,clientComponentLoadCount:th};return e.reset&&(to=0,tl=0,th=0),t}();e&&performance.measure(`${process.env.NEXT_OTEL_PERFORMANCE_PREFIX}:next-client-component-loading`,{start:e.clientComponentLoadStart,end:e.clientComponentLoadStart+e.clientComponentLoadTimes})}e.flushHeaders(),(0,eH.getTracer)().trace(eF.Xy.startResponse,{spanName:"start response"},()=>void 0)}try{let r=e.write(t);"flush"in e&&"function"==typeof e.flush&&e.flush(),r||(await i.promise,i=new ta)}catch(t){throw e.end(),Error("failed to write chunk to response",{cause:t})}},abort:t=>{e.writableFinished||e.destroy(t)},close:async()=>{if(t&&await t,!e.writableFinished)return e.end(),n.promise}})}(t,r);await e.pipeTo(a,{signal:n.signal})}catch(e){if(td(e))return;throw Error("failed to pipe response",{cause:e})}}class tc{static fromStatic(e){return new tc(e,{metadata:{}})}constructor(e,{contentType:t,waitUntil:r,metadata:i}){this.response=e,this.contentType=t,this.metadata=i,this.waitUntil=r}assignMetadata(e){Object.assign(this.metadata,e)}get isNull(){return null===this.response}get isDynamic(){return"string"!=typeof this.response}toUnchunkedString(e=!1){if(null===this.response)throw Error("Invariant: null responses cannot be unchunked");if("string"!=typeof this.response){if(!e)throw Error("Invariant: dynamic responses cannot be unchunked. This is a bug in Next.js");return eW(this.readable)}return this.response}get readable(){if(null===this.response)throw Error("Invariant: null responses cannot be streamed");if("string"==typeof this.response)throw Error("Invariant: static responses cannot be streamed");return Array.isArray(this.response)?function(...e){if(0===e.length)throw Error("Invariant: chainStreams requires at least one stream");if(1===e.length)return e[0];let{readable:t,writable:r}=new TransformStream,i=e[0].pipeTo(r,{preventClose:!0}),s=1;for(;s<e.length-1;s++){let t=e[s];i=i.then(()=>t.pipeTo(r,{preventClose:!0}))}let n=e[s];return(i=i.then(()=>n.pipeTo(r))).catch(ez),t}(...this.response):this.response}chain(e){let t;if(null===this.response)throw Error("Invariant: response is null. This is a bug in Next.js");if("string"==typeof this.response){var r;t=[(r=this.response,new ReadableStream({start(e){e.enqueue(eU.encode(r)),e.close()}}))]}else t=Array.isArray(this.response)?this.response:[this.response];t.push(e),this.response=t}async pipeTo(e){try{await this.readable.pipeTo(e,{preventClose:!0}),this.waitUntil&&await this.waitUntil,await e.close()}catch(t){if(td(t)){await e.abort(t);return}throw t}}async pipeToNodeResponse(e){await tu(this.readable,e,this.waitUntil)}}function tp(e){let t=e.replace(/\\/g,"/");return t.startsWith("/index/")&&!eI(t)?t.slice(6):"/index"!==t?t:"/"}var tf=r("./dist/compiled/path-to-regexp/index.js");function tm(e,t){let r=[],i=(0,tf.Bo)(e,r,{delimiter:"/",sensitive:"boolean"==typeof(null==t?void 0:t.sensitive)&&t.sensitive,strict:null==t?void 0:t.strict}),s=(0,tf.WS)((null==t?void 0:t.regexModifier)?new RegExp(t.regexModifier(i.source),i.flags):i,r);return(e,i)=>{if("string"!=typeof e)return!1;let n=s(e);if(!n)return!1;if(null==t?void 0:t.removeUnnamedParams)for(let e of r)"number"==typeof e.name&&delete n.params[e.name];return{...i,...n.params}}}let tg=/[|\\{}()[\]^$+*?.-]/,tv=/[|\\{}()[\]^$+*?.-]/g;function ty(e){return tg.test(e)?e.replace(tv,"\\$&"):e}function tx(e){let t=e.startsWith("[")&&e.endsWith("]");t&&(e=e.slice(1,-1));let r=e.startsWith("...");return r&&(e=e.slice(3)),{key:e,repeat:r,optional:t}}function tw(e){let{parameterizedRoute:t,groups:r}=function(e){let t=eV(e).slice(1).split("/"),r={},i=1;return{parameterizedRoute:t.map(e=>{let t=ek.find(t=>e.startsWith(t)),s=e.match(/\[((?:\[.*\])|.+)\]/);if(t&&s){let{key:e,optional:n,repeat:a}=tx(s[1]);return r[e]={pos:i++,repeat:a,optional:n},"/"+ty(t)+"([^/]+?)"}if(!s)return"/"+ty(e);{let{key:e,repeat:t,optional:n}=tx(s[1]);return r[e]={pos:i++,repeat:t,optional:n},t?n?"(?:/(.+?))?":"/(.+?)":"/([^/]+?)"}}).join(""),groups:r}}(e);return{re:RegExp("^"+t+"(?:/)?$"),groups:r}}function tb(e){let{interceptionMarker:t,getSafeRouteKey:r,segment:i,routeKeys:s,keyPrefix:n}=e,{key:a,optional:o,repeat:l}=tx(i),h=a.replace(/\W/g,"");n&&(h=""+n+h);let d=!1;(0===h.length||h.length>30)&&(d=!0),isNaN(parseInt(h.slice(0,1)))||(d=!0),d&&(h=r()),n?s[h]=""+n+a:s[h]=a;let u=t?ty(t):"";return l?o?"(?:/"+u+"(?<"+h+">.+?))?":"/"+u+"(?<"+h+">.+?)":"/"+u+"(?<"+h+">[^/]+?)"}function tE(e){return e.replace(/__ESC_COLON_/gi,":")}function t_(e,t,r,i){void 0===r&&(r=[]),void 0===i&&(i=[]);let s={},n=r=>{let i;let n=r.key;switch(r.type){case"header":n=n.toLowerCase(),i=e.headers[n];break;case"cookie":i="cookies"in e?e.cookies[r.key]:j(e.headers)()[r.key];break;case"query":i=t[n];break;case"host":{let{host:t}=(null==e?void 0:e.headers)||{};i=null==t?void 0:t.split(":",1)[0].toLowerCase()}}if(!r.value&&i)return s[function(e){let t="";for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);(i>64&&i<91||i>96&&i<123)&&(t+=e[r])}return t}(n)]=i,!0;if(i){let e=RegExp("^"+r.value+"$"),t=Array.isArray(i)?i.slice(-1)[0].match(e):i.match(e);if(t)return Array.isArray(t)&&(t.groups?Object.keys(t.groups).forEach(e=>{s[e]=t.groups[e]}):"host"===r.type&&t[0]&&(s.host=t[0])),!0}return!1};return!!r.every(e=>n(e))&&!i.some(e=>n(e))&&s}function tC(e,t){if(!e.includes(":"))return e;for(let r of Object.keys(t))e.includes(":"+r)&&(e=e.replace(RegExp(":"+r+"\\*","g"),":"+r+"--ESCAPED_PARAM_ASTERISKS").replace(RegExp(":"+r+"\\?","g"),":"+r+"--ESCAPED_PARAM_QUESTION").replace(RegExp(":"+r+"\\+","g"),":"+r+"--ESCAPED_PARAM_PLUS").replace(RegExp(":"+r+"(?!\\w)","g"),"--ESCAPED_PARAM_COLON"+r));return e=e.replace(/(:|\*|\?|\+|\(|\)|\{|\})/g,"\\$1").replace(/--ESCAPED_PARAM_PLUS/g,"+").replace(/--ESCAPED_PARAM_COLON/g,":").replace(/--ESCAPED_PARAM_QUESTION/g,"?").replace(/--ESCAPED_PARAM_ASTERISKS/g,"*"),(0,tf.MY)("/"+e,{validate:!1})(t).slice(1)}function tR(e){return"object"==typeof e&&null!==e&&"name"in e&&"message"in e}function tP(e){return tR(e)?e:Error(!function(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||t.hasOwnProperty("isPrototypeOf")}(e)?e+"":JSON.stringify(e))}class tS{constructor(e){this.provider=e}normalize(e){return this.provider.analyze(e).pathname}}class tT{insert(e){this._insert(e.split("/").filter(Boolean),[],!1)}smoosh(){return this._smoosh()}_smoosh(e){void 0===e&&(e="/");let t=[...this.children.keys()].sort();null!==this.slugName&&t.splice(t.indexOf("[]"),1),null!==this.restSlugName&&t.splice(t.indexOf("[...]"),1),null!==this.optionalRestSlugName&&t.splice(t.indexOf("[[...]]"),1);let r=t.map(t=>this.children.get(t)._smoosh(""+e+t+"/")).reduce((e,t)=>[...e,...t],[]);if(null!==this.slugName&&r.push(...this.children.get("[]")._smoosh(e+"["+this.slugName+"]/")),!this.placeholder){let t="/"===e?"/":e.slice(0,-1);if(null!=this.optionalRestSlugName)throw Error('You cannot define a route with the same specificity as a optional catch-all route ("'+t+'" and "'+t+"[[..."+this.optionalRestSlugName+']]").');r.unshift(t)}return null!==this.restSlugName&&r.push(...this.children.get("[...]")._smoosh(e+"[..."+this.restSlugName+"]/")),null!==this.optionalRestSlugName&&r.push(...this.children.get("[[...]]")._smoosh(e+"[[..."+this.optionalRestSlugName+"]]/")),r}_insert(e,t,r){if(0===e.length){this.placeholder=!1;return}if(r)throw Error("Catch-all must be the last part of the URL.");let i=e[0];if(i.startsWith("[")&&i.endsWith("]")){let n=i.slice(1,-1),a=!1;if(n.startsWith("[")&&n.endsWith("]")&&(n=n.slice(1,-1),a=!0),n.startsWith("...")&&(n=n.substring(3),r=!0),n.startsWith("[")||n.endsWith("]"))throw Error("Segment names may not start or end with extra brackets ('"+n+"').");if(n.startsWith("."))throw Error("Segment names may not start with erroneous periods ('"+n+"').");function s(e,r){if(null!==e&&e!==r)throw Error("You cannot use different slug names for the same dynamic path ('"+e+"' !== '"+r+"').");t.forEach(e=>{if(e===r)throw Error('You cannot have the same slug name "'+r+'" repeat within a single dynamic path');if(e.replace(/\W/g,"")===i.replace(/\W/g,""))throw Error('You cannot have the slug names "'+e+'" and "'+r+'" differ only by non-word symbols within a single dynamic path')}),t.push(r)}if(r){if(a){if(null!=this.restSlugName)throw Error('You cannot use both an required and optional catch-all route at the same level ("[...'+this.restSlugName+']" and "'+e[0]+'" ).');s(this.optionalRestSlugName,n),this.optionalRestSlugName=n,i="[[...]]"}else{if(null!=this.optionalRestSlugName)throw Error('You cannot use both an optional and required catch-all route at the same level ("[[...'+this.optionalRestSlugName+']]" and "'+e[0]+'").');s(this.restSlugName,n),this.restSlugName=n,i="[...]"}}else{if(a)throw Error('Optional route parameters are not yet supported ("'+e[0]+'").');s(this.slugName,n),this.slugName=n,i="[]"}}this.children.has(i)||this.children.set(i,new tT),this.children.get(i)._insert(e.slice(1),t,r)}constructor(){this.placeholder=!0,this.children=new Map,this.slugName=null,this.restSlugName=null,this.optionalRestSlugName=null}}class tA{constructor(e){this.definition=e,eI(e.pathname)&&(this.dynamic=b(tw(e.pathname)))}get identity(){return this.definition.pathname}get isDynamic(){return void 0!==this.dynamic}match(e){let t=this.test(e);return t?{definition:this.definition,params:t.params}:null}test(e){if(this.dynamic){let t=this.dynamic(e);return t?{params:t}:null}return e===this.definition.pathname?{}:null}}class tD extends tA{get identity(){var e;return`${this.definition.pathname}?__nextLocale=${null==(e=this.definition.i18n)?void 0:e.locale}`}match(e,t){var r,i;let s=this.test(e,t);return s?{definition:this.definition,params:s.params,detectedLocale:(null==t?void 0:null==(r=t.i18n)?void 0:r.detectedLocale)??(null==(i=this.definition.i18n)?void 0:i.locale)}:null}test(e,t){return this.definition.i18n&&(null==t?void 0:t.i18n)?this.definition.i18n.locale&&t.i18n.detectedLocale&&this.definition.i18n.locale!==t.i18n.detectedLocale?null:super.test(t.i18n.pathname):super.test(e)}}class tN{get compilationID(){return this.providers.length}async waitTillReady(){this.waitTillReadyPromise&&(await this.waitTillReadyPromise,delete this.waitTillReadyPromise)}async reload(){let{promise:e,resolve:t,reject:r}=new ta;this.waitTillReadyPromise=e;let i=this.compilationID;try{let e=[],t=await Promise.all(this.providers.map(e=>e.matchers())),r=new Map,s={};for(let i of t)for(let t of i){t.duplicated&&delete t.duplicated;let i=r.get(t.definition.pathname);if(i){let e=s[t.definition.pathname]??[i];e.push(t),s[t.definition.pathname]=e,i.duplicated=e,t.duplicated=e}e.push(t),r.set(t.definition.pathname,t)}if(this.matchers.duplicates=s,this.previousMatchers.length===e.length&&this.previousMatchers.every((t,r)=>t===e[r]))return;this.previousMatchers=e,this.matchers.static=e.filter(e=>!e.isDynamic);let n=e.filter(e=>e.isDynamic),a=new Map,o=[];for(let e=0;e<n.length;e++){let t=n[e].definition.pathname,r=a.get(t)??[];r.push(e),1===r.length&&(a.set(t,r),o.push(t))}let l=function(e){let t=new tT;return e.forEach(e=>t.insert(e)),t.smoosh()}(o),h=[];for(let e of l){let t=a.get(e);if(!Array.isArray(t))throw Error("Invariant: expected to find identity in indexes map");let r=t.map(e=>n[e]);h.push(...r)}if(this.matchers.dynamic=h,this.compilationID!==i)throw Error("Invariant: expected compilation to finish before new matchers were added, possible missing await")}catch(e){r(e)}finally{this.lastCompilationID=i,t()}}push(e){this.providers.push(e)}async test(e,t){return null!==await this.match(e,t)}async match(e,t){for await(let r of this.matchAll(e,t))return r;return null}validate(e,t,r){var i;return t instanceof tD?t.match(e,r):(null==(i=r.i18n)?void 0:i.inferredFromDefault)?t.match(r.i18n.pathname):t.match(e)}async *matchAll(e,t){if(this.lastCompilationID!==this.compilationID)throw Error("Invariant: expected routes to have been loaded before match");if(!eI(e=eN(e)))for(let r of this.matchers.static){let i=this.validate(e,r,t);i&&(yield i)}if(null==t?void 0:t.skipDynamic)return null;for(let r of this.matchers.dynamic){let i=this.validate(e,r,t);i&&(yield i)}return null}constructor(){this.providers=[],this.matchers={static:[],dynamic:[],duplicates:{}},this.lastCompilationID=this.compilationID,this.previousMatchers=[]}}class tO{constructor(e=[]){this.normalizers=e}push(e){this.normalizers.push(e)}normalize(e){return this.normalizers.reduce((e,t)=>t.normalize(e),e)}}var tM=r("./dist/esm/shared/lib/isomorphic/path.js"),tk=r.n(tM);class tj{constructor(...e){this.prefix=tk().posix.join(...e)}normalize(e){return tk().posix.join(this.prefix,e)}}function tL(e){let t=/^\/index(\/|$)/.test(e)&&!eI(e)?"/index"+e:"/"===e?"/index":eN(e);{let{posix:e}=r("path"),i=e.normalize(t);if(i!==t)throw new g.KM("Requested and resolved page mismatch: "+t+" "+i)}return t}class tI extends tj{constructor(){super("app")}normalize(e){return super.normalize(tL(e))}}class tq extends tj{constructor(e){super(e,D)}normalize(e){return super.normalize(e)}}function t$(e){return{normalize:e}}!function(e){e.PAGES="pages",e.ROOT="root",e.APP="app"}(o||(o={}));class tH{normalize(e){return e.replace(/%5F/g,"_")}}class tF extends tO{constructor(){super([t$(eO),new tH])}normalize(e){return super.normalize(e)}}class tz{constructor(e){this.filename=new tq(e),this.pathname=new tF,this.bundlePath=new tI}}!function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE"}(l||(l={}));class tU extends tA{get identity(){return`${this.definition.pathname}?__nextPage=${this.definition.page}`}}class tW{constructor(e){this.loader=e,this.cached=[]}async matchers(){let e=await this.loader.load();if(!e)return[];if(this.data&&this.loader.compare(this.data,e))return this.cached;this.data=e;let t=await this.transform(e);return this.cached=t,t}}class tB extends tW{constructor(e,t){super({load:async()=>t.load(e),compare:(e,t)=>e===t})}}class tG extends tB{constructor(e,t){super(A,t),this.normalizers=new tz(e)}async transform(e){let t=Object.keys(e).filter(e=>e.endsWith("/page")),r={};for(let e of t){let t=this.normalizers.pathname.normalize(e);t in r?r[t].push(e):r[t]=[e]}let i=[];for(let[t,s]of Object.entries(r)){let r=s[0],n=this.normalizers.filename.normalize(e[r]),a=this.normalizers.bundlePath.normalize(r);i.push(new tU({kind:l.APP_PAGE,pathname:t,page:r,bundlePath:a,filename:n,appPaths:s}))}return i}}class tK extends tA{}class tV extends tB{constructor(e,t){super(A,t),this.normalizers=new tz(e)}async transform(e){let t=Object.keys(e).filter(e=>e.endsWith("/route")),r=[];for(let i of t){let t=this.normalizers.filename.normalize(e[i]),s=this.normalizers.pathname.normalize(i),n=this.normalizers.bundlePath.normalize(i);r.push(new tK({kind:l.APP_ROUTE,pathname:s,page:i,bundlePath:n,filename:t}))}return r}}function tX(e){return"/api"===e||!!(null==e?void 0:e.startsWith("/api/"))}class tJ extends tA{}class tY extends tD{}class tQ extends tO{constructor(){super([t$(tL),new tj("pages")])}normalize(e){return super.normalize(e)}}class tZ extends tj{constructor(e){super(e,D)}normalize(e){return super.normalize(e)}}class t0{constructor(e){this.filename=new tZ(e),this.bundlePath=new tQ}}class t1 extends tB{constructor(e,t,r){super(T,t),this.i18nProvider=r,this.normalizers=new t0(e)}async transform(e){let t=Object.keys(e).filter(e=>tX(e)),r=[];for(let i of t)if(this.i18nProvider){let{detectedLocale:t,pathname:s}=this.i18nProvider.analyze(i);r.push(new tY({kind:l.PAGES_API,pathname:s,page:i,bundlePath:this.normalizers.bundlePath.normalize(i),filename:this.normalizers.filename.normalize(e[i]),i18n:{locale:t}}))}else r.push(new tJ({kind:l.PAGES_API,pathname:i,page:i,bundlePath:this.normalizers.bundlePath.normalize(i),filename:this.normalizers.filename.normalize(e[i])}));return r}}class t4 extends tA{}class t8 extends tD{}class t3 extends tB{constructor(e,t,r){super(T,t),this.i18nProvider=r,this.normalizers=new t0(e)}async transform(e){let t=Object.keys(e).filter(e=>!tX(e)).filter(e=>{var t;let r=(null==(t=this.i18nProvider)?void 0:t.analyze(e).pathname)??e;return!N.includes(r)}),r=[];for(let i of t)if(this.i18nProvider){let{detectedLocale:t,pathname:s}=this.i18nProvider.analyze(i);r.push(new t8({kind:l.PAGES,pathname:s,page:i,bundlePath:this.normalizers.bundlePath.normalize(i),filename:this.normalizers.filename.normalize(e[i]),i18n:{locale:t}}))}else r.push(new t4({kind:l.PAGES,pathname:i,page:i,bundlePath:this.normalizers.bundlePath.normalize(i),filename:this.normalizers.filename.normalize(e[i])}));return r}}class t2{constructor(e){this.getter=e}load(e){return this.getter(e)}}class t6{constructor(e){var t;if(this.config=e,!e.locales.length)throw Error("Invariant: No locales provided");this.lowerCaseLocales=e.locales.map(e=>e.toLowerCase()),this.lowerCaseDomains=null==(t=e.domains)?void 0:t.map(e=>{var t;let r=e.domain.toLowerCase();return{defaultLocale:e.defaultLocale.toLowerCase(),hostname:r.split(":",1)[0],domain:r,locales:null==(t=e.locales)?void 0:t.map(e=>e.toLowerCase()),http:e.http}})}detectDomainLocale(e,t){if(e&&this.lowerCaseDomains&&this.config.domains){t&&(t=t.toLowerCase());for(let i=0;i<this.lowerCaseDomains.length;i++){var r;let s=this.lowerCaseDomains[i];if(s.hostname===e||(null==(r=s.locales)?void 0:r.some(e=>e===t)))return this.config.domains[i]}}}fromQuery(e,t){let r=t.__nextLocale;if(r){let t=this.analyze(e);if(t.detectedLocale){if(t.detectedLocale!==r)throw Error(`Invariant: The detected locale does not match the locale in the query. Expected to find '${r}' in '${e}' but found '${t.detectedLocale}'}`);e=t.pathname}}return{pathname:e,detectedLocale:r,inferredFromDefault:"1"===t.__nextInferredLocaleFromDefault}}validate(e){return this.lowerCaseLocales.includes(e.toLowerCase())}validateQuery(e){return(!e.__nextLocale||!!this.validate(e.__nextLocale))&&(!e.__nextDefaultLocale||!!this.validate(e.__nextDefaultLocale))}analyze(e,t={}){let r=t.defaultLocale,i="string"==typeof r,s=e.split("/",2);if(!s[1])return{detectedLocale:r,pathname:e,inferredFromDefault:i};let n=s[1].toLowerCase(),a=this.lowerCaseLocales.indexOf(n);return a<0||(r=this.config.locales[a],i=!1,e=e.slice(r.length+1)||"/"),{detectedLocale:r,pathname:e,inferredFromDefault:i}}}async function t9(e,t,r,i){{var s;t.statusCode=r.status,t.statusMessage=r.statusText,null==(s=r.headers)||s.forEach((e,r)=>{if("x-middleware-set-cookie"!==r.toLowerCase()){if("set-cookie"===r.toLowerCase())for(let i of eG(e))t.appendHeader(r,i);else t.appendHeader(r,e)}});let n=t.originalResponse;r.body&&"HEAD"!==e.method?await tu(r.body,n,i):n.end()}}require("next/dist/client/components/static-generation-async-storage.external.js"),Symbol.for("next.mutated.cookies");let t5=tm("/_next/data/:path*");class t7{constructor(e){this.suffix=e}match(e){return!!e.endsWith(this.suffix)}normalize(e,t){return t||this.match(e)?e.substring(0,e.length-this.suffix.length):e}}class re extends t7{constructor(){super(W.hd)}}class rt{constructor(e){if(this.prefix=e,e.endsWith("/"))throw Error(`PrefixPathnameNormalizer: prefix "${e}" should not end with a slash`)}match(e){return!!(e===this.prefix||e.startsWith(this.prefix+"/"))}normalize(e,t){return t||this.match(e)?e.length===this.prefix.length?"/":e.substring(this.prefix.length):e}}class rr extends rt{constructor(){super("/_next/postponed/resume")}normalize(e,t){return t||this.match(e)?tp(e=super.normalize(e,!0)):e}}class ri extends t7{constructor(){super(W.Vz)}}function rs(e){for(let[t]of J)delete e[t.toLowerCase()]}class rn extends t7{constructor(){super(W.Sx)}}class ra{constructor(e){if(this.suffix=new t7(".json"),!e)throw Error("Invariant: buildID is required");this.prefix=new rt(`/_next/data/${e}`)}match(e){return this.prefix.match(e)&&this.suffix.match(e)}normalize(e,t){return t||this.match(e)?(e=this.prefix.normalize(e,!0),tp(e=this.suffix.normalize(e,!0))):e}}function ro(e){return e.replace(/(?:\/index)?\/?$/,"")||"/"}class rl extends Error{}class rh extends Error{constructor(e){super(),this.innerError=e}}class rd{constructor(e){var t,i,s;this.handleRSCRequest=(e,t,r)=>{var i,s;if(!r.pathname)return!1;if(null==(i=this.normalizers.prefetchRSC)?void 0:i.match(r.pathname))r.pathname=this.normalizers.prefetchRSC.normalize(r.pathname,!0),e.headers["RSC".toLowerCase()]="1",e.headers[V.toLowerCase()]="1",C(e,"isRSCRequest",!0),C(e,"isPrefetchRSCRequest",!0);else if(null==(s=this.normalizers.rsc)?void 0:s.match(r.pathname))r.pathname=this.normalizers.rsc.normalize(r.pathname,!0),e.headers["RSC".toLowerCase()]="1",C(e,"isRSCRequest",!0);else if(e.headers["x-now-route-matches"])return rs(e.headers),!1;else return!1;if(e.url){let t=(0,eP.parse)(e.url);t.pathname=r.pathname,e.url=(0,eP.format)(t)}return!1},this.handleNextDataRequest=async(e,t,r)=>{let i=this.getMiddleware(),s=function(e){return"string"==typeof e&&t5(e)}(r.pathname);if(!s||!s.path)return!1;if(s.path[0]!==this.buildId)return!_(e,"middlewareInvoke")&&(await this.render404(e,t,r),!0);s.path.shift();let n=s.path[s.path.length-1];if("string"!=typeof n||!n.endsWith(".json"))return await this.render404(e,t,r),!0;let a=`/${s.path.join("/")}`;if(a=function(e,t){return void 0===t&&(t=""),e=e.replace(/\\/g,"/"),(e=t&&e.endsWith(t)?e.slice(0,-t.length):e).startsWith("/index/")&&!eI(e)?e=e.slice(6):"/index"===e&&(e="/"),e}(a,".json"),i&&(this.nextConfig.trailingSlash&&!a.endsWith("/")&&(a+="/"),!this.nextConfig.trailingSlash&&a.length>1&&a.endsWith("/")&&(a=a.substring(0,a.length-1))),this.i18nProvider){var o;let s=null==e?void 0:null==(o=e.headers.host)?void 0:o.split(":",1)[0].toLowerCase(),n=this.i18nProvider.detectDomainLocale(s),l=(null==n?void 0:n.defaultLocale)??this.i18nProvider.config.defaultLocale,h=this.i18nProvider.analyze(a);if(h.detectedLocale&&(a=h.pathname),r.query.__nextLocale=h.detectedLocale,r.query.__nextDefaultLocale=l,h.detectedLocale||delete r.query.__nextInferredLocaleFromDefault,!h.detectedLocale&&!i)return r.query.__nextLocale=l,await this.render404(e,t,r),!0}return r.pathname=a,r.query.__nextDataReq="1",!1},this.handleNextImageRequest=()=>!1,this.handleCatchallRenderRequest=()=>!1,this.handleCatchallMiddlewareRequest=()=>!1,this.normalize=e=>{let t=[];for(let r of(this.normalizers.data&&t.push(this.normalizers.data),this.normalizers.postponed&&t.push(this.normalizers.postponed),this.normalizers.prefetchRSC&&t.push(this.normalizers.prefetchRSC),this.normalizers.rsc&&t.push(this.normalizers.rsc),this.normalizers.action&&t.push(this.normalizers.action),t))if(r.match(e))return r.normalize(e,!0);return e},this.normalizeAndAttachMetadata=async(e,t,r)=>{let i=await this.handleNextImageRequest(e,t,r);return!!(i||this.enabledDirectories.pages&&(i=await this.handleNextDataRequest(e,t,r)))},this.prepared=!1,this.preparedPromise=null,this.customErrorNo404Warn=(0,g.gf)(()=>{ey(`You have added a custom /_error page without a custom /404 page. This prevents the 404 page from being auto statically optimized.
16
- See here for info: https://nextjs.org/docs/messages/custom-error-no-custom-404`)});let{dir:n=".",quiet:a=!1,conf:o,dev:l=!1,minimalMode:h=!1,customServer:d=!0,hostname:u,port:c,experimentalTestProxy:p}=e;this.experimentalTestProxy=p,this.serverOptions=e,this.dir=r("path").resolve(n),this.quiet=a,this.loadEnvConfig({dev:l}),this.nextConfig=o,this.hostname=u,this.hostname&&(this.fetchHostname=function(e){return eD.test(e)?`[${e}]`:e}(this.hostname)),this.port=c,this.distDir=r("path").join(this.dir,this.nextConfig.distDir),this.publicDir=this.getPublicDir(),this.hasStaticDir=!h&&this.getHasStaticDir(),this.i18nProvider=(null==(t=this.nextConfig.i18n)?void 0:t.locales)?new t6(this.nextConfig.i18n):void 0,this.localeNormalizer=this.i18nProvider?new tS(this.i18nProvider):void 0;let{serverRuntimeConfig:f={},publicRuntimeConfig:m,assetPrefix:v,generateEtags:y}=this.nextConfig;this.buildId=this.getBuildId(),this.minimalMode=h||!!process.env.NEXT_PRIVATE_MINIMAL_MODE,this.enabledDirectories=this.getEnabledDirectories(l),this.normalizers={postponed:this.enabledDirectories.app&&this.nextConfig.experimental.ppr?new rr:void 0,rsc:this.enabledDirectories.app?new re:void 0,prefetchRSC:this.enabledDirectories.app&&this.nextConfig.experimental.ppr?new rn:void 0,data:this.enabledDirectories.pages?new ra(this.buildId):void 0,action:this.enabledDirectories.app?new ri:void 0},this.nextFontManifest=this.getNextFontManifest(),process.env.NEXT_DEPLOYMENT_ID=this.nextConfig.deploymentId||"",this.renderOpts={supportsDynamicResponse:!0,trailingSlash:this.nextConfig.trailingSlash,deploymentId:this.nextConfig.deploymentId,strictNextHead:!!this.nextConfig.experimental.strictNextHead,poweredByHeader:this.nextConfig.poweredByHeader,canonicalBase:this.nextConfig.amp.canonicalBase||"",buildId:this.buildId,generateEtags:y,previewProps:this.getPrerenderManifest().preview,customServer:!0===d||void 0,ampOptimizerConfig:null==(i=this.nextConfig.experimental.amp)?void 0:i.optimizer,basePath:this.nextConfig.basePath,images:this.nextConfig.images,optimizeFonts:this.nextConfig.optimizeFonts,fontManifest:this.nextConfig.optimizeFonts&&!l?this.getFontManifest():void 0,optimizeCss:this.nextConfig.experimental.optimizeCss,nextConfigOutput:this.nextConfig.output,nextScriptWorkers:this.nextConfig.experimental.nextScriptWorkers,disableOptimizedLoading:this.nextConfig.experimental.disableOptimizedLoading,domainLocales:null==(s=this.nextConfig.i18n)?void 0:s.domains,distDir:this.distDir,serverComponents:this.enabledDirectories.app,enableTainting:this.nextConfig.experimental.taint,crossOrigin:this.nextConfig.crossOrigin?this.nextConfig.crossOrigin:void 0,largePageDataBytes:this.nextConfig.experimental.largePageDataBytes,runtimeConfig:Object.keys(m).length>0?m:void 0,isExperimentalCompile:this.nextConfig.experimental.isExperimentalCompile,experimental:{ppr:this.enabledDirectories.app&&!0===this.nextConfig.experimental.ppr,missingSuspenseWithCSRBailout:!0===this.nextConfig.experimental.missingSuspenseWithCSRBailout,swrDelta:this.nextConfig.experimental.swrDelta}},(0,eq.setConfig)({serverRuntimeConfig:f,publicRuntimeConfig:m}),this.pagesManifest=this.getPagesManifest(),this.appPathsManifest=this.getAppPathsManifest(),this.appPathRoutes=this.getAppPathRoutes(),this.interceptionRoutePatterns=this.getinterceptionRoutePatterns(),this.matchers=this.getRouteMatchers(),this.matchers.reload(),this.setAssetPrefix(v),this.responseCache=this.getResponseCache({dev:l})}reloadMatchers(){return this.matchers.reload()}getRouteMatchers(){let e=new t2(e=>{switch(e){case T:return this.getPagesManifest()??null;case A:return this.getAppPathsManifest()??null;default:return null}}),t=new tN;return t.push(new t3(this.distDir,e,this.i18nProvider)),t.push(new t1(this.distDir,e,this.i18nProvider)),this.enabledDirectories.app&&(t.push(new tG(this.distDir,e)),t.push(new tV(this.distDir,e))),t}logError(e){this.quiet||ev(e)}async handleRequest(e,t,r){await this.prepare();let i=e.method.toUpperCase(),s=ru(e)?"RSC ":"",n=(0,eH.getTracer)();return n.withPropagatedContext(e.headers,()=>n.trace(eF._J.handleRequest,{spanName:`${s}${i} ${e.url}`,kind:eH.SpanKind.SERVER,attributes:{"http.method":i,"http.target":e.url,"next.rsc":!!s}},async a=>this.handleRequestImpl(e,t,r).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":t.statusCode});let e=n.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==eF._J.handleRequest){console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);return}let r=e.get("next.route");if(r){let e=`${s}${i} ${r}`;a.setAttributes({"next.route":r,"http.route":r,"next.span_name":e}),a.updateName(e)}})))}async handleRequestImpl(e,t,r){try{var i,s,n,a,o,l,h,d,u,c,p;await this.matchers.waitTillReady();let f=t.originalResponse||t,m=f.setHeader.bind(f);f.setHeader=(t,r)=>{if(!f.headersSent){if("set-cookie"===t.toLowerCase()){let t=_(e,"middlewareCookie");t&&Array.isArray(r)&&r.every((e,r)=>e===t[r])||(r=[...new Set([...t||[],..."string"==typeof r?[r]:Array.isArray(r)?r:[]])])}return m(t,r)}};let v=(e.url||"").split("?",1)[0];if(null==v?void 0:v.match(/(\\|\/\/)/)){let r=(0,g.U3)(e.url);t.redirect(r,308).body(r).send();return}if(!r||"object"!=typeof r){if(!e.url)throw Error("Invariant: url can not be undefined");r=(0,eP.parse)(e.url,!0)}if(!r.pathname)throw Error("Invariant: pathname can't be empty");"string"==typeof r.query&&(r.query=Object.fromEntries(new URLSearchParams(r.query)));let{originalRequest:y}=e,x=null==y?void 0:y.headers["x-forwarded-proto"],w=x?"https"===x:!!(null==y?void 0:null==(i=y.socket)?void 0:i.encrypted);if(e.headers["x-forwarded-host"]??=e.headers.host??this.hostname,e.headers["x-forwarded-port"]??=this.port?this.port.toString():w?"443":"80",e.headers["x-forwarded-proto"]??=w?"https":"http",e.headers["x-forwarded-for"]??=null==(s=y.socket)?void 0:s.remoteAddress,(null==(n=this.i18nProvider)?void 0:n.validateQuery(r.query))||(delete r.query.__nextLocale,delete r.query.__nextDefaultLocale,delete r.query.__nextInferredLocaleFromDefault),this.attachRequestMeta(e,r),this.enabledDirectories.app&&await this.handleRSCRequest(e,t,r))return;let E=null==(a=this.i18nProvider)?void 0:a.detectDomainLocale(eZ(r,e.headers)),R=(null==E?void 0:E.defaultLocale)||(null==(o=this.nextConfig.i18n)?void 0:o.defaultLocale);r.query.__nextDefaultLocale=R;let P=ee(e.url.replace(/^\/+/,"/")),S=e4(P.pathname,{nextConfig:this.nextConfig,i18nProvider:this.i18nProvider});P.pathname=S.pathname,S.basePath&&(e.url=e1(e.url,this.nextConfig.basePath));let T="string"==typeof e.headers["x-matched-path"];if(T)try{this.enabledDirectories.app&&(e.url.match(/^\/index($|\?)/)&&(e.url=e.url.replace(/^\/index/,"/")),r.pathname="/index"===r.pathname?"/":r.pathname);let{pathname:i}=new URL(e.headers["x-matched-path"],"http://localhost"),{pathname:s}=new URL(e.url,"http://localhost");if(null==(l=this.normalizers.data)?void 0:l.match(s))r.query.__nextDataReq="1";else if((null==(h=this.normalizers.postponed)?void 0:h.match(i))&&"POST"===e.method){let t=[];for await(let r of e.body)t.push(r);let r=Buffer.concat(t).toString("utf8");C(e,"postponed",r),e.headers["x-now-route-matches"]||(s=this.normalizers.postponed.normalize(i,!0))}i=this.normalize(i);let n=this.stripNextDataPath(s),a=null==(d=this.i18nProvider)?void 0:d.analyze(i,{defaultLocale:R});a&&(r.query.__nextLocale=a.detectedLocale,a.inferredFromDefault?r.query.__nextInferredLocaleFromDefault="1":delete r.query.__nextInferredLocaleFromDefault);let o=i=tp(i),p=eI(o);if(!p){let e=await this.matchers.match(o,{i18n:a});e&&(o=e.definition.pathname,p=void 0!==e.params)}a&&(i=a.pathname);let f=function({page:e,i18n:t,basePath:r,rewrites:i,pageIsDynamic:s,trailingSlash:n,caseSensitive:a}){let o,l,h;return s&&(h=(l=b(o=function(e,t){let r=function(e,t){let r;let i=eV(e).slice(1).split("/"),s=(r=0,()=>{let e="",t=++r;for(;t>0;)e+=String.fromCharCode(97+(t-1)%26),t=Math.floor((t-1)/26);return e}),n={};return{namedParameterizedRoute:i.map(e=>{let r=ek.some(t=>e.startsWith(t)),i=e.match(/\[((?:\[.*\])|.+)\]/);if(r&&i){let[r]=e.split(i[0]);return tb({getSafeRouteKey:s,interceptionMarker:r,segment:i[1],routeKeys:n,keyPrefix:t?W.u7:void 0})}return i?tb({getSafeRouteKey:s,segment:i[1],routeKeys:n,keyPrefix:t?W.dN:void 0}):"/"+ty(e)}).join(""),routeKeys:n}}(e,t);return{...tw(e),namedRegex:"^"+r.namedParameterizedRoute+"(?:/)?$",routeKeys:r.routeKeys}}(e,!1)))(e)),{handleRewrites:function(o,h){let d={},u=h.pathname,c=i=>{let c=tm(i.source+(n?"(/)?":""),{removeUnnamedParams:!0,strict:!0,sensitive:!!a})(h.pathname);if((i.has||i.missing)&&c){let e=t_(o,h.query,i.has,i.missing);e?Object.assign(c,e):c=!1}if(c){let{parsedDestination:n,destQuery:a}=function(e){let t;let r=Object.assign({},e.query);delete r.__nextLocale,delete r.__nextDefaultLocale,delete r.__nextDataReq,delete r.__nextInferredLocaleFromDefault,delete r[Y];let i=e.destination;for(let t of Object.keys({...e.params,...r}))i=i.replace(RegExp(":"+ty(t),"g"),"__ESC_COLON_"+t);let s=ee(i),n=s.query,a=tE(""+s.pathname+(s.hash||"")),o=tE(s.hostname||""),l=[],h=[];(0,tf.Bo)(a,l),(0,tf.Bo)(o,h);let d=[];l.forEach(e=>d.push(e.name)),h.forEach(e=>d.push(e.name));let u=(0,tf.MY)(a,{validate:!1}),c=(0,tf.MY)(o,{validate:!1});for(let[t,r]of Object.entries(n))Array.isArray(r)?n[t]=r.map(t=>tC(tE(t),e.params)):"string"==typeof r&&(n[t]=tC(tE(r),e.params));let p=Object.keys(e.params).filter(e=>"nextInternalLocale"!==e);if(e.appendParamsToQuery&&!p.some(e=>d.includes(e)))for(let t of p)t in n||(n[t]=e.params[t]);if(ej(a))for(let t of a.split("/")){let r=ek.find(e=>t.startsWith(e));if(r){e.params["0"]=r;break}}try{let[r,i]=(t=u(e.params)).split("#",2);s.hostname=c(e.params),s.pathname=r,s.hash=(i?"#":"")+(i||""),delete s.search}catch(e){if(e.message.match(/Expected .*? to not repeat, but got an array/))throw Error("To use a multi-match in the destination you must add `*` at the end of the param name to signify it should repeat. https://nextjs.org/docs/messages/invalid-multi-match");throw e}return s.query={...r,...s.query},{newUrl:t,destQuery:n,parsedDestination:s}}({appendParamsToQuery:!0,destination:i.destination,params:c,query:h.query});if(n.protocol)return!0;if(Object.assign(d,a,c),Object.assign(h.query,n.query),delete n.query,Object.assign(h,n),u=h.pathname,r&&(u=u.replace(RegExp(`^${r}`),"")||"/"),t){let e=e0(u,t.locales);u=e.pathname,h.query.nextInternalLocale=e.detectedLocale||c.nextInternalLocale}if(u===e)return!0;if(s&&l){let e=l(u);if(e)return h.query={...h.query,...e},!0}}return!1};for(let e of i.beforeFiles||[])c(e);if(u!==e){let t=!1;for(let e of i.afterFiles||[])if(t=c(e))break;if(!t&&!(()=>{let t=eV(u||"");return t===eV(e)||(null==l?void 0:l(t))})()){for(let e of i.fallback||[])if(t=c(e))break}}return d},defaultRouteRegex:o,dynamicRouteMatcher:l,defaultRouteMatches:h,getParamsFromRouteMatches:function(e,r,i){return b(function(){let{groups:e,routeKeys:s}=o;return{re:{exec:n=>{let a=Object.fromEntries(new URLSearchParams(n)),o=t&&i&&a["1"]===i;for(let e of Object.keys(a)){let t=a[e];e!==W.dN&&e.startsWith(W.dN)&&(a[e.substring(W.dN.length)]=t,delete a[e])}let l=Object.keys(s||{}),h=e=>{if(t){let s=Array.isArray(e),n=s?e[0]:e;if("string"==typeof n&&t.locales.some(e=>e.toLowerCase()===n.toLowerCase()&&(i=e,r.locale=i,!0)))return s&&e.splice(0,1),!s||0===e.length}return!1};return l.every(e=>a[e])?l.reduce((t,r)=>{let i=null==s?void 0:s[r];return i&&!h(a[r])&&(t[e[i].pos]=a[r]),t},{}):Object.keys(a).reduce((e,t)=>{if(!h(a[t])){let r=t;return o&&(r=parseInt(t,10)-1+""),Object.assign(e,{[r]:a[t]})}return e},{})}},groups:e}}())(e.headers["x-now-route-matches"])},normalizeDynamicRouteParams:(e,t)=>{var r,i,s;let n;return r=e,i=o,s=h,n=!0,i?{params:r=Object.keys(i.groups).reduce((e,a)=>{let o=r[a];"string"==typeof o&&(o=eM(o)),Array.isArray(o)&&(o=o.map(e=>("string"==typeof e&&(e=eM(e)),e)));let l=s[a],h=i.groups[a].optional;return((Array.isArray(l)?l.some(e=>Array.isArray(o)?o.some(t=>t.includes(e)):null==o?void 0:o.includes(e)):null==o?void 0:o.includes(l))||void 0===o&&!(h&&t))&&(n=!1),h&&(!o||Array.isArray(o)&&1===o.length&&("index"===o[0]||o[0]===`[[...${a}]]`))&&(o=void 0,delete r[a]),o&&"string"==typeof o&&i.groups[a].repeat&&(o=o.split("/")),o&&(e[a]=o),e},{}),hasValidParams:n}:{params:r,hasValidParams:!1}},normalizeVercelUrl:(e,t,r)=>(function(e,t,r,i,s){if(i&&t&&s){let t=(0,eP.parse)(e.url,!0);for(let e of(delete t.search,Object.keys(t.query))){let i=e!==W.dN&&e.startsWith(W.dN),n=e!==W.u7&&e.startsWith(W.u7);(i||n||(r||Object.keys(s.groups)).includes(e))&&delete t.query[e]}e.url=(0,eP.format)(t)}})(e,t,r,s,o),interpolateDynamicPath:(e,t)=>(function(e,t,r){if(!r)return e;for(let i of Object.keys(r.groups)){let{optional:s,repeat:n}=r.groups[i],a=`[${n?"...":""}${i}]`;s&&(a=`[${a}]`);let o=e.indexOf(a);if(o>-1){let r;let s=t[i];r=Array.isArray(s)?s.map(e=>e&&encodeURIComponent(e)).join("/"):s?encodeURIComponent(s):"",e=e.slice(0,o)+r+e.slice(o+a.length)}}return e})(e,t,o)}}({pageIsDynamic:p,page:o,i18n:this.nextConfig.i18n,basePath:this.nextConfig.basePath,rewrites:(null==(u=this.getRoutesManifest())?void 0:u.rewrites)||{beforeFiles:[],afterFiles:[],fallback:[]},caseSensitive:!!this.nextConfig.experimental.caseSensitiveRoutes});R&&!S.locale&&(r.pathname=`/${R}${r.pathname}`);let m=r.pathname,g=f.handleRewrites(e,r),v=Object.keys(g),y=m!==r.pathname;y&&r.pathname&&C(e,"rewroteURL",r.pathname);let x=new Set;for(let e of Object.keys(r.query)){let t=r.query[e];!function(e,t){for(let r of[W.dN,W.u7])e!==r&&e.startsWith(r)&&t(e.substring(r.length))}(e,i=>{r&&(r.query[i]=t,x.add(i),delete r.query[e])})}if(p){let t={},s=f.normalizeDynamicRouteParams(r.query);if(!s.hasValidParams&&p&&!eI(n)){let e=null==f.dynamicRouteMatcher?void 0:f.dynamicRouteMatcher.call(f,n);e&&(f.normalizeDynamicRouteParams(e),Object.assign(s.params,e),s.hasValidParams=!0)}if(s.hasValidParams&&(t=s.params),e.headers["x-now-route-matches"]&&eI(i)&&!s.hasValidParams){let i={},n=f.getParamsFromRouteMatches(e,i,r.query.__nextLocale||"");i.locale&&(r.query.__nextLocale=i.locale,delete r.query.__nextInferredLocaleFromDefault),(s=f.normalizeDynamicRouteParams(n,!0)).hasValidParams&&(t=s.params)}p&&f.defaultRouteMatches&&n===o&&!s.hasValidParams&&!f.normalizeDynamicRouteParams({...t},!0).hasValidParams&&(t=f.defaultRouteMatches),t&&(i=f.interpolateDynamicPath(o,t),e.url=f.interpolateDynamicPath(e.url,t))}for(let t of((p||y)&&f.normalizeVercelUrl(e,!0,[...v,...Object.keys((null==(c=f.defaultRouteRegex)?void 0:c.groups)||{})]),x))delete r.query[t];if(r.pathname=i,P.pathname=r.pathname,await this.normalizeAndAttachMetadata(e,t,r))return}catch(r){if(r instanceof g._9||r instanceof g.KM)return t.statusCode=400,this.renderError(null,e,t,"/_error",{});throw r}if(C(e,"isLocaleDomain",!!E),S.locale&&(e.url=(0,eP.format)(P),C(e,"didStripLocale",!0)),!r.query.__nextLocale&&(S.locale?r.query.__nextLocale=S.locale:R&&(r.query.__nextLocale=R,r.query.__nextInferredLocaleFromDefault="1")),!this.serverOptions.webServerConfig&&!_(e,"incrementalCache")){let t="https:";try{t=new URL(_(e,"initURL")||"/","http://n").protocol}catch{}let r=await this.getIncrementalCache({requestHeaders:Object.assign({},e.headers),requestProtocol:t.substring(0,t.length-1)});r.resetRequestCache(),C(e,"incrementalCache",r),globalThis.__incrementalCache=r}let A=_(e,"invokePath");if(!T&&A){let i=_(e,"invokeStatus");if(i){let s=_(e,"invokeQuery");s&&Object.assign(r.query,s),t.statusCode=i;let n=_(e,"invokeError")||null;return this.renderError(n,e,t,"/_error",r.query)}let s=new URL(A||"/","http://n"),n=e4(s.pathname,{nextConfig:this.nextConfig,parseData:!1});n.locale&&(r.query.__nextLocale=n.locale),r.pathname!==s.pathname&&(r.pathname=s.pathname,C(e,"rewroteURL",n.pathname));let a=e0(e1(r.pathname,this.nextConfig.basePath||""),(null==(p=this.nextConfig.i18n)?void 0:p.locales)||[]);for(let e of(a.detectedLocale&&(r.query.__nextLocale=a.detectedLocale),r.pathname=a.pathname,Object.keys(r.query)))e.startsWith("__next")||e.startsWith("_next")||delete r.query[e];let o=_(e,"invokeQuery");if(o&&Object.assign(r.query,o),await this.normalizeAndAttachMetadata(e,t,r))return;await this.handleCatchallRenderRequest(e,t,r);return}if(_(e,"middlewareInvoke")){if(await this.normalizeAndAttachMetadata(e,t,r)||await this.handleCatchallMiddlewareRequest(e,t,r))return;let i=Error();throw i.result={response:new Response(null,{headers:{"x-middleware-next":"1"}})},i.bubble=!0,i}return!T&&S.basePath&&(r.pathname=e1(r.pathname,S.basePath)),t.statusCode=200,await this.run(e,t,r)}catch(r){if(r instanceof rl)throw r;if(r&&"object"==typeof r&&"ERR_INVALID_URL"===r.code||r instanceof g._9||r instanceof g.KM)return t.statusCode=400,this.renderError(null,e,t,"/_error",{});throw r}}getRequestHandlerWithMetadata(e){let t=this.getRequestHandler();return(r,i,s)=>(r[E]=e,t(r,i,s))}getRequestHandler(){return this.handleRequest.bind(this)}setAssetPrefix(e){this.renderOpts.assetPrefix=e?e.replace(/\/$/,""):""}async prepare(){if(!this.prepared)return null===this.preparedPromise&&(this.preparedPromise=this.prepareImpl().then(()=>{this.prepared=!0,this.preparedPromise=null})),this.preparedPromise}async prepareImpl(){}async close(){}getAppPathRoutes(){let e={};return Object.keys(this.appPathsManifest||{}).forEach(t=>{let r=eO(t);e[r]||(e[r]=[]),e[r].push(t)}),e}async run(e,t,r){return(0,eH.getTracer)().trace(eF._J.run,async()=>this.runImpl(e,t,r))}async runImpl(e,t,r){await this.handleCatchallRenderRequest(e,t,r)}async pipe(e,t){return(0,eH.getTracer)().trace(eF._J.pipe,async()=>this.pipeImpl(e,t))}async pipeImpl(e,t){let r=e$(t.req.headers["user-agent"]||""),i={...t,renderOpts:{...this.renderOpts,supportsDynamicResponse:!r,isBot:!!r}},s=await e(i);if(null===s)return;let{req:n,res:a}=i,o=a.statusCode,{body:l,type:h}=s,{revalidate:d}=s;if(!a.sent){let{generateEtags:e,poweredByHeader:t,dev:r}=this.renderOpts;r&&(a.setHeader("Cache-Control","no-store, must-revalidate"),d=void 0),await this.sendRenderResult(n,a,{result:l,type:h,generateEtags:e,poweredByHeader:t,revalidate:d,swrDelta:this.nextConfig.experimental.swrDelta}),a.statusCode=o}}async getStaticHTML(e,t){let r={...t,renderOpts:{...this.renderOpts,supportsDynamicResponse:!1}},i=await e(r);return null===i?null:i.body.toUnchunkedString()}async render(e,t,r,i={},s,n=!1){return(0,eH.getTracer)().trace(eF._J.render,async()=>this.renderImpl(e,t,r,i,s,n))}getWaitUntil(){let e=function(){let e=globalThis[eR];return null==e?void 0:e.get()}();if(e)return e.waitUntil}async renderImpl(e,t,r,i={},s,n=!1){var a;return r.startsWith("/")||console.warn(`Cannot render page with path "${r}", did you mean "/${r}"?. See more info here: https://nextjs.org/docs/messages/render-no-starting-slash`),this.renderOpts.customServer&&"/index"===r&&!await this.hasPage("/index")&&(r="/"),(a=r,N.includes(a))?this.render404(e,t,s):this.pipe(e=>this.renderToResponse(e),{req:e,res:t,pathname:r,query:i})}async getStaticPaths({pathname:e}){var t;let r=null==(t=this.getPrerenderManifest().dynamicRoutes[e])?void 0:t.fallback;return{staticPaths:void 0,fallbackMode:"string"==typeof r?"static":null===r?"blocking":r}}async renderToResponseWithComponents(e,t){return(0,eH.getTracer)().trace(eF._J.renderToResponseWithComponents,async()=>this.renderToResponseWithComponentsImpl(e,t))}pathCouldBeIntercepted(e){return ej(e)||this.interceptionRoutePatterns.some(t=>t.test(e))}setVaryHeader(e,t,r,i){let s=`RSC, ${K}, ${V}`,n=ru(e),a=!1;r&&this.pathCouldBeIntercepted(i)?(t.setHeader("vary",`${s}, ${X}`),a=!0):(r||n)&&t.setHeader("vary",s),a||delete e.headers[X]}async renderToResponseWithComponentsImpl({req:e,res:t,pathname:i,renderOpts:s},{components:a,query:o}){var h,d,u,c,p,f,m;let v,y,x;i===P&&(i="/404");let w="/_error"===i,b="/404"===i||w&&404===t.statusCode,E="/500"===i||w&&500===t.statusCode,R=!0===a.isAppPath,S=!!a.getServerSideProps,T=!!a.getStaticPaths,A=function(e){let t,r;e.headers instanceof Headers?(t=e.headers.get(G.toLowerCase())??null,r=e.headers.get("content-type")):(t=e.headers[G.toLowerCase()]??null,r=e.headers["content-type"]??null);let i=!!("POST"===e.method&&"application/x-www-form-urlencoded"===r),s=!!("POST"===e.method&&(null==r?void 0:r.startsWith("multipart/form-data"))),n=!!(void 0!==t&&"string"==typeof t&&"POST"===e.method);return{actionId:t,isURLEncodedAction:i,isMultipartAction:s,isFetchAction:n,isServerAction:!!(n||i||s)}}(e).isServerAction,D=!!(null==(h=a.Component)?void 0:h.getInitialProps),N=!!a.getStaticProps,M=(0,eP.parse)(e.url||"").pathname||"/",j=_(e,"rewroteURL")||M;this.setVaryHeader(e,t,R,j);let L=!1,I=eI(a.page),q=this.getPrerenderManifest();if(R&&I){let t=await this.getStaticPaths({pathname:i,page:a.page,isAppPath:R,requestHeaders:e.headers});if(v=t.staticPaths,L=void 0!==(y=t.fallbackMode),"export"===this.nextConfig.output){let e=a.page;if("static"!==y)throw Error(`Page "${e}" is missing exported function "generateStaticParams()", which is required with "output: export" config.`);let t=eV(j);if(!(null==v?void 0:v.includes(t)))throw Error(`Page "${e}" is missing param "${t}" in "generateStaticParams()", which is required with "output: export" config.`)}L&&(T=!0)}L||(null==v?void 0:v.includes(j))||e.headers["x-now-route-matches"]?N=!0:N||=!!q.routes[ro(i)];let $=!!(o.__nextDataReq||e.headers["x-nextjs-data"]&&this.serverOptions.webServerConfig)&&(N||S),H=("1"===e.headers[V.toLowerCase()]||_(e,"isPrefetchRSCRequest"))??!1;if(!N&&e.headers["x-middleware-prefetch"]&&!(b||"/_error"===i))return t.setHeader("x-matched-path",i),t.setHeader("x-middleware-skip","1"),t.setHeader("cache-control","private, no-cache, no-store, max-age=0, must-revalidate"),t.body("{}").send(),null;delete o.__nextDataReq,N&&e.headers["x-matched-path"]&&e.url.startsWith("/_next/data")&&(e.url=this.stripNextDataPath(e.url)),e.headers["x-nextjs-data"]&&(!t.statusCode||200===t.statusCode)&&t.setHeader("x-nextjs-matched-path",`${o.__nextLocale?`/${o.__nextLocale}`:""}${i}`);let F=ru(e),z=_(e,"postponed"),U=s.experimental.ppr&&F&&!H;if(!b||$||F||(t.statusCode=404),O.includes(i)&&(t.statusCode=parseInt(i.slice(1),10)),!A&&!z&&!b&&!E&&"/_error"!==i&&"HEAD"!==e.method&&"GET"!==e.method&&("string"==typeof a.Component||N))return t.statusCode=405,t.setHeader("Allow",["GET","HEAD"]),await this.renderError(null,e,t,i),null;if("string"==typeof a.Component)return{type:"html",body:tc.fromStatic(a.Component)};if(o.amp||delete o.amp,!0===s.supportsDynamicResponse){let t=e$(e.headers["user-agent"]||""),r="function"!=typeof(null==(p=a.Document)?void 0:p.getInitialProps)||"__NEXT_BUILTIN_DOCUMENT__"in a.Document;s.supportsDynamicResponse=!N&&!t&&!o.amp&&r,s.isBot=t}!$&&R&&s.dev&&(s.supportsDynamicResponse=!0);let K=N?null==(d=this.nextConfig.i18n)?void 0:d.defaultLocale:o.__nextDefaultLocale,X=o.__nextLocale,J=null==(u=this.nextConfig.i18n)?void 0:u.locales,Y=!1;if(S||N||R){let{tryGetPreviewData:i}=r("./dist/esm/server/api-utils/node/try-get-preview-data.js");Y=!1!==i(e,t,this.renderOpts.previewProps,!!this.nextConfig.experimental.multiZoneDraftMode)}R&&!s.dev&&!Y&&N&&F&&!U&&(!((m=s.runtime)===W.Jp.experimentalEdge||m===W.Jp.edge)||this.serverOptions.webServerConfig)&&rs(e.headers);let Q=!1,Z=!1;N&&({isOnDemandRevalidate:Q,revalidateOnlyGenerated:Z}=(0,k.Iq)(e,this.renderOpts.previewProps)),N&&e.headers["x-matched-path"]&&(j=M),M=eV(M),j=eV(j),this.localeNormalizer&&(j=this.localeNormalizer.normalize(j)),$&&(j=this.stripNextDataPath(j),M=this.stripNextDataPath(M));let ee=null;Y||!N||s.supportsDynamicResponse||A||z||U||(ee=`${X?`/${X}`:""}${("/"===i||"/"===j)&&X?"":j}${o.amp?".amp":""}`),(b||E)&&N&&(ee=`${X?`/${X}`:""}${i}${o.amp?".amp":""}`),ee&&(ee="/index"===(ee=ee.split("/").map(e=>{try{e=decodeURIComponent(e).replace(RegExp("([/#?]|%(2f|23|3f))","gi"),e=>encodeURIComponent(e))}catch(e){throw new g._9("failed to decode param")}return e}).join("/"))&&"/"===i?"/":ee);let et="https:";try{et=new URL(_(e,"initURL")||"/","http://n").protocol}catch{}let er=globalThis.__incrementalCache||await this.getIncrementalCache({requestHeaders:Object.assign({},e.headers),requestProtocol:et.substring(0,et.length-1)});null==er||er.resetRequestCache();let{routeModule:ei}=a,es=!!(this.nextConfig.experimental.ppr&&this.experimentalTestProxy&&o.__nextppronly),en=async({postponed:r})=>{let n,h=!$&&!0===s.dev||!N&&!T||"string"==typeof r||U,d=(0,eP.parse)(e.url||"",!0).query;s.params&&Object.keys(s.params).forEach(e=>{delete d[e]});let u="/"!==M&&this.nextConfig.trailingSlash,c=(0,eP.format)({pathname:`${j}${u?"/":""}`,query:d}),p={...a,...s,...R?{incrementalCache:er,isRevalidate:N&&!r&&!U,originalPathname:a.ComponentMod.originalPathname,serverActions:this.nextConfig.experimental.serverActions}:{},isNextDataRequest:$,resolvedUrl:c,locale:X,locales:J,defaultLocale:K,multiZoneDraftMode:this.nextConfig.experimental.multiZoneDraftMode,resolvedAsPath:S||D?(0,eP.format)({pathname:`${M}${u?"/":""}`,query:d}):c,supportsDynamicResponse:h,isOnDemandRevalidate:Q,isDraftMode:Y,isServerAction:A,postponed:r,builtInWaitUntil:this.getWaitUntil()};if(es&&(h=!1,p.nextExport=!0,p.supportsDynamicResponse=!1,p.isStaticGeneration=!0,p.isRevalidate=!0,p.isDebugPPRSkeleton=!0),ei){if(ei.definition.kind===l.APP_ROUTE){let r={params:s.params,prerenderManifest:q,renderOpts:{experimental:{ppr:!1},originalPathname:a.ComponentMod.originalPathname,supportsDynamicResponse:h,incrementalCache:er,isRevalidate:N,builtInWaitUntil:this.getWaitUntil()}};try{let i=tn.fromBaseNextRequest(e,function(e){let{errored:t,destroyed:r}=e;if(t||r)return AbortSignal.abort(t??new ti);let{signal:i}=ts(e);return i}(t.originalResponse)),s=await ei.handle(i,r);e.fetchMetrics=r.renderOpts.fetchMetrics;let n=r.renderOpts.fetchTags;if(N){var f;let e=await s.blob(),t=eK(s.headers);n&&(t[W.Et]=n),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let i=(null==(f=r.renderOpts.store)?void 0:f.revalidate)??!1;return{value:{kind:"ROUTE",status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},revalidate:i}}return await t9(e,t,s,r.renderOpts.waitUntil),null}catch(r){if(N)throw r;return ev(r),await t9(e,t,new Response(null,{status:500})),null}}else if(ei.definition.kind===l.PAGES)p.nextFontManifest=this.nextFontManifest,p.clientReferenceManifest=a.clientReferenceManifest,n=await ei.render(e.originalRequest??e,t.originalResponse??t,{page:i,params:s.params,query:o,renderOpts:p});else if(ei.definition.kind===l.APP_PAGE){let r=a.routeModule;p.nextFontManifest=this.nextFontManifest,n=await r.render(e.originalRequest??e,t.originalResponse??t,{page:b?"/404":i,params:s.params,query:o,renderOpts:p})}else throw Error("Invariant: Unknown route module type")}else n=await this.renderHTML(e,t,i,o,p);let{metadata:m}=n,{headers:g={},fetchTags:v}=m;if(v&&(g[W.Et]=v),e.fetchMetrics=m.fetchMetrics,R&&N&&0===m.revalidate&&!p.experimental.ppr){let e=m.staticBailoutInfo,t=Error(`Page changed from static to dynamic at runtime ${M}${(null==e?void 0:e.description)?`, reason: ${e.description}`:""}
16
+ See here for info: https://nextjs.org/docs/messages/custom-error-no-custom-404`)});let{dir:n=".",quiet:a=!1,conf:o,dev:l=!1,minimalMode:h=!1,customServer:d=!0,hostname:u,port:c,experimentalTestProxy:p}=e;this.experimentalTestProxy=p,this.serverOptions=e,this.dir=r("path").resolve(n),this.quiet=a,this.loadEnvConfig({dev:l}),this.nextConfig=o,this.hostname=u,this.hostname&&(this.fetchHostname=function(e){return eD.test(e)?`[${e}]`:e}(this.hostname)),this.port=c,this.distDir=r("path").join(this.dir,this.nextConfig.distDir),this.publicDir=this.getPublicDir(),this.hasStaticDir=!h&&this.getHasStaticDir(),this.i18nProvider=(null==(t=this.nextConfig.i18n)?void 0:t.locales)?new t6(this.nextConfig.i18n):void 0,this.localeNormalizer=this.i18nProvider?new tS(this.i18nProvider):void 0;let{serverRuntimeConfig:f={},publicRuntimeConfig:m,assetPrefix:v,generateEtags:y}=this.nextConfig;this.buildId=this.getBuildId(),this.minimalMode=h||!!process.env.NEXT_PRIVATE_MINIMAL_MODE,this.enabledDirectories=this.getEnabledDirectories(l),this.normalizers={postponed:this.enabledDirectories.app&&this.nextConfig.experimental.ppr?new rr:void 0,rsc:this.enabledDirectories.app?new re:void 0,prefetchRSC:this.enabledDirectories.app&&this.nextConfig.experimental.ppr?new rn:void 0,data:this.enabledDirectories.pages?new ra(this.buildId):void 0,action:this.enabledDirectories.app?new ri:void 0},this.nextFontManifest=this.getNextFontManifest(),process.env.NEXT_DEPLOYMENT_ID=this.nextConfig.deploymentId||"",this.renderOpts={supportsDynamicResponse:!0,trailingSlash:this.nextConfig.trailingSlash,deploymentId:this.nextConfig.deploymentId,strictNextHead:!!this.nextConfig.experimental.strictNextHead,poweredByHeader:this.nextConfig.poweredByHeader,canonicalBase:this.nextConfig.amp.canonicalBase||"",buildId:this.buildId,generateEtags:y,previewProps:this.getPrerenderManifest().preview,customServer:!0===d||void 0,ampOptimizerConfig:null==(i=this.nextConfig.experimental.amp)?void 0:i.optimizer,basePath:this.nextConfig.basePath,images:this.nextConfig.images,optimizeFonts:this.nextConfig.optimizeFonts,fontManifest:this.nextConfig.optimizeFonts&&!l?this.getFontManifest():void 0,optimizeCss:this.nextConfig.experimental.optimizeCss,nextConfigOutput:this.nextConfig.output,nextScriptWorkers:this.nextConfig.experimental.nextScriptWorkers,disableOptimizedLoading:this.nextConfig.experimental.disableOptimizedLoading,domainLocales:null==(s=this.nextConfig.i18n)?void 0:s.domains,distDir:this.distDir,serverComponents:this.enabledDirectories.app,enableTainting:this.nextConfig.experimental.taint,crossOrigin:this.nextConfig.crossOrigin?this.nextConfig.crossOrigin:void 0,largePageDataBytes:this.nextConfig.experimental.largePageDataBytes,runtimeConfig:Object.keys(m).length>0?m:void 0,isExperimentalCompile:this.nextConfig.experimental.isExperimentalCompile,experimental:{ppr:this.enabledDirectories.app&&!0===this.nextConfig.experimental.ppr,missingSuspenseWithCSRBailout:!0===this.nextConfig.experimental.missingSuspenseWithCSRBailout,swrDelta:this.nextConfig.experimental.swrDelta}},(0,eq.setConfig)({serverRuntimeConfig:f,publicRuntimeConfig:m}),this.pagesManifest=this.getPagesManifest(),this.appPathsManifest=this.getAppPathsManifest(),this.appPathRoutes=this.getAppPathRoutes(),this.interceptionRoutePatterns=this.getinterceptionRoutePatterns(),this.matchers=this.getRouteMatchers(),this.matchers.reload(),this.setAssetPrefix(v),this.responseCache=this.getResponseCache({dev:l})}reloadMatchers(){return this.matchers.reload()}getRouteMatchers(){let e=new t2(e=>{switch(e){case T:return this.getPagesManifest()??null;case A:return this.getAppPathsManifest()??null;default:return null}}),t=new tN;return t.push(new t3(this.distDir,e,this.i18nProvider)),t.push(new t1(this.distDir,e,this.i18nProvider)),this.enabledDirectories.app&&(t.push(new tG(this.distDir,e)),t.push(new tV(this.distDir,e))),t}logError(e){this.quiet||ev(e)}async handleRequest(e,t,r){await this.prepare();let i=e.method.toUpperCase(),s=ru(e)?"RSC ":"",n=(0,eH.getTracer)();return n.withPropagatedContext(e.headers,()=>n.trace(eF._J.handleRequest,{spanName:`${s}${i} ${e.url}`,kind:eH.SpanKind.SERVER,attributes:{"http.method":i,"http.target":e.url,"next.rsc":!!s}},async a=>this.handleRequestImpl(e,t,r).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":t.statusCode});let e=n.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==eF._J.handleRequest){console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);return}let r=e.get("next.route");if(r){let e=`${s}${i} ${r}`;a.setAttributes({"next.route":r,"http.route":r,"next.span_name":e}),a.updateName(e)}})))}async handleRequestImpl(e,t,r){try{var i,s,n,a,o,l,h,d,u,c,p;await this.matchers.waitTillReady();let f=t.originalResponse||t,m=f.setHeader.bind(f);f.setHeader=(t,r)=>{if(!f.headersSent){if("set-cookie"===t.toLowerCase()){let t=_(e,"middlewareCookie");t&&Array.isArray(r)&&r.every((e,r)=>e===t[r])||(r=[...new Set([...t||[],..."string"==typeof r?[r]:Array.isArray(r)?r:[]])])}return m(t,r)}};let v=(e.url||"").split("?",1)[0];if(null==v?void 0:v.match(/(\\|\/\/)/)){let r=(0,g.U3)(e.url);t.redirect(r,308).body(r).send();return}if(!r||"object"!=typeof r){if(!e.url)throw Error("Invariant: url can not be undefined");r=(0,eP.parse)(e.url,!0)}if(!r.pathname)throw Error("Invariant: pathname can't be empty");"string"==typeof r.query&&(r.query=Object.fromEntries(new URLSearchParams(r.query)));let{originalRequest:y}=e,x=null==y?void 0:y.headers["x-forwarded-proto"],w=x?"https"===x:!!(null==y?void 0:null==(i=y.socket)?void 0:i.encrypted);if(e.headers["x-forwarded-host"]??=e.headers.host??this.hostname,e.headers["x-forwarded-port"]??=this.port?this.port.toString():w?"443":"80",e.headers["x-forwarded-proto"]??=w?"https":"http",e.headers["x-forwarded-for"]??=null==(s=y.socket)?void 0:s.remoteAddress,(null==(n=this.i18nProvider)?void 0:n.validateQuery(r.query))||(delete r.query.__nextLocale,delete r.query.__nextDefaultLocale,delete r.query.__nextInferredLocaleFromDefault),this.attachRequestMeta(e,r),this.enabledDirectories.app&&await this.handleRSCRequest(e,t,r))return;let E=null==(a=this.i18nProvider)?void 0:a.detectDomainLocale(eZ(r,e.headers)),R=(null==E?void 0:E.defaultLocale)||(null==(o=this.nextConfig.i18n)?void 0:o.defaultLocale);r.query.__nextDefaultLocale=R;let P=ee(e.url.replace(/^\/+/,"/")),S=e4(P.pathname,{nextConfig:this.nextConfig,i18nProvider:this.i18nProvider});P.pathname=S.pathname,S.basePath&&(e.url=e1(e.url,this.nextConfig.basePath));let T="string"==typeof e.headers["x-matched-path"];if(T)try{this.enabledDirectories.app&&(e.url.match(/^\/index($|\?)/)&&(e.url=e.url.replace(/^\/index/,"/")),r.pathname="/index"===r.pathname?"/":r.pathname);let{pathname:i}=new URL(e.headers["x-matched-path"],"http://localhost"),{pathname:s}=new URL(e.url,"http://localhost");if(null==(l=this.normalizers.data)?void 0:l.match(s))r.query.__nextDataReq="1";else if((null==(h=this.normalizers.postponed)?void 0:h.match(i))&&"POST"===e.method){let t=[];for await(let r of e.body)t.push(r);let r=Buffer.concat(t).toString("utf8");C(e,"postponed",r),e.headers["x-now-route-matches"]||(s=this.normalizers.postponed.normalize(i,!0))}i=this.normalize(i);let n=this.stripNextDataPath(s),a=null==(d=this.i18nProvider)?void 0:d.analyze(i,{defaultLocale:R});a&&(r.query.__nextLocale=a.detectedLocale,a.inferredFromDefault?r.query.__nextInferredLocaleFromDefault="1":delete r.query.__nextInferredLocaleFromDefault);let o=i=tp(i),p=eI(o);if(!p){let e=await this.matchers.match(o,{i18n:a});e&&(o=e.definition.pathname,p=void 0!==e.params)}a&&(i=a.pathname);let f=function({page:e,i18n:t,basePath:r,rewrites:i,pageIsDynamic:s,trailingSlash:n,caseSensitive:a}){let o,l,h;return s&&(h=(l=b(o=function(e,t){let r=function(e,t){let r;let i=eV(e).slice(1).split("/"),s=(r=0,()=>{let e="",t=++r;for(;t>0;)e+=String.fromCharCode(97+(t-1)%26),t=Math.floor((t-1)/26);return e}),n={};return{namedParameterizedRoute:i.map(e=>{let r=ek.some(t=>e.startsWith(t)),i=e.match(/\[((?:\[.*\])|.+)\]/);if(r&&i){let[r]=e.split(i[0]);return tb({getSafeRouteKey:s,interceptionMarker:r,segment:i[1],routeKeys:n,keyPrefix:t?W.u7:void 0})}return i?tb({getSafeRouteKey:s,segment:i[1],routeKeys:n,keyPrefix:t?W.dN:void 0}):"/"+ty(e)}).join(""),routeKeys:n}}(e,t);return{...tw(e),namedRegex:"^"+r.namedParameterizedRoute+"(?:/)?$",routeKeys:r.routeKeys}}(e,!1)))(e)),{handleRewrites:function(o,h){let d={},u=h.pathname,c=i=>{let c=tm(i.source+(n?"(/)?":""),{removeUnnamedParams:!0,strict:!0,sensitive:!!a})(h.pathname);if((i.has||i.missing)&&c){let e=t_(o,h.query,i.has,i.missing);e?Object.assign(c,e):c=!1}if(c){let{parsedDestination:n,destQuery:a}=function(e){let t;let r=Object.assign({},e.query);delete r.__nextLocale,delete r.__nextDefaultLocale,delete r.__nextDataReq,delete r.__nextInferredLocaleFromDefault,delete r[Y];let i=e.destination;for(let t of Object.keys({...e.params,...r}))i=i.replace(RegExp(":"+ty(t),"g"),"__ESC_COLON_"+t);let s=ee(i),n=s.query,a=tE(""+s.pathname+(s.hash||"")),o=tE(s.hostname||""),l=[],h=[];(0,tf.Bo)(a,l),(0,tf.Bo)(o,h);let d=[];l.forEach(e=>d.push(e.name)),h.forEach(e=>d.push(e.name));let u=(0,tf.MY)(a,{validate:!1}),c=(0,tf.MY)(o,{validate:!1});for(let[t,r]of Object.entries(n))Array.isArray(r)?n[t]=r.map(t=>tC(tE(t),e.params)):"string"==typeof r&&(n[t]=tC(tE(r),e.params));let p=Object.keys(e.params).filter(e=>"nextInternalLocale"!==e);if(e.appendParamsToQuery&&!p.some(e=>d.includes(e)))for(let t of p)t in n||(n[t]=e.params[t]);if(ej(a))for(let t of a.split("/")){let r=ek.find(e=>t.startsWith(e));if(r){e.params["0"]=r;break}}try{let[r,i]=(t=u(e.params)).split("#",2);s.hostname=c(e.params),s.pathname=r,s.hash=(i?"#":"")+(i||""),delete s.search}catch(e){if(e.message.match(/Expected .*? to not repeat, but got an array/))throw Error("To use a multi-match in the destination you must add `*` at the end of the param name to signify it should repeat. https://nextjs.org/docs/messages/invalid-multi-match");throw e}return s.query={...r,...s.query},{newUrl:t,destQuery:n,parsedDestination:s}}({appendParamsToQuery:!0,destination:i.destination,params:c,query:h.query});if(n.protocol)return!0;if(Object.assign(d,a,c),Object.assign(h.query,n.query),delete n.query,Object.assign(h,n),u=h.pathname,r&&(u=u.replace(RegExp(`^${r}`),"")||"/"),t){let e=e0(u,t.locales);u=e.pathname,h.query.nextInternalLocale=e.detectedLocale||c.nextInternalLocale}if(u===e)return!0;if(s&&l){let e=l(u);if(e)return h.query={...h.query,...e},!0}}return!1};for(let e of i.beforeFiles||[])c(e);if(u!==e){let t=!1;for(let e of i.afterFiles||[])if(t=c(e))break;if(!t&&!(()=>{let t=eV(u||"");return t===eV(e)||(null==l?void 0:l(t))})()){for(let e of i.fallback||[])if(t=c(e))break}}return d},defaultRouteRegex:o,dynamicRouteMatcher:l,defaultRouteMatches:h,getParamsFromRouteMatches:function(e,r,i){return b(function(){let{groups:e,routeKeys:s}=o;return{re:{exec:n=>{let a=Object.fromEntries(new URLSearchParams(n)),o=t&&i&&a["1"]===i;for(let e of Object.keys(a)){let t=a[e];e!==W.dN&&e.startsWith(W.dN)&&(a[e.substring(W.dN.length)]=t,delete a[e])}let l=Object.keys(s||{}),h=e=>{if(t){let s=Array.isArray(e),n=s?e[0]:e;if("string"==typeof n&&t.locales.some(e=>e.toLowerCase()===n.toLowerCase()&&(i=e,r.locale=i,!0)))return s&&e.splice(0,1),!s||0===e.length}return!1};return l.every(e=>a[e])?l.reduce((t,r)=>{let i=null==s?void 0:s[r];return i&&!h(a[r])&&(t[e[i].pos]=a[r]),t},{}):Object.keys(a).reduce((e,t)=>{if(!h(a[t])){let r=t;return o&&(r=parseInt(t,10)-1+""),Object.assign(e,{[r]:a[t]})}return e},{})}},groups:e}}())(e.headers["x-now-route-matches"])},normalizeDynamicRouteParams:(e,t)=>{var r,i,s;let n;return r=e,i=o,s=h,n=!0,i?{params:r=Object.keys(i.groups).reduce((e,a)=>{let o=r[a];"string"==typeof o&&(o=eM(o)),Array.isArray(o)&&(o=o.map(e=>("string"==typeof e&&(e=eM(e)),e)));let l=s[a],h=i.groups[a].optional;return((Array.isArray(l)?l.some(e=>Array.isArray(o)?o.some(t=>t.includes(e)):null==o?void 0:o.includes(e)):null==o?void 0:o.includes(l))||void 0===o&&!(h&&t))&&(n=!1),h&&(!o||Array.isArray(o)&&1===o.length&&("index"===o[0]||o[0]===`[[...${a}]]`))&&(o=void 0,delete r[a]),o&&"string"==typeof o&&i.groups[a].repeat&&(o=o.split("/")),o&&(e[a]=o),e},{}),hasValidParams:n}:{params:r,hasValidParams:!1}},normalizeVercelUrl:(e,t,r)=>(function(e,t,r,i,s){if(i&&t&&s){let t=(0,eP.parse)(e.url,!0);for(let e of(delete t.search,Object.keys(t.query))){let i=e!==W.dN&&e.startsWith(W.dN),n=e!==W.u7&&e.startsWith(W.u7);(i||n||(r||Object.keys(s.groups)).includes(e))&&delete t.query[e]}e.url=(0,eP.format)(t)}})(e,t,r,s,o),interpolateDynamicPath:(e,t)=>(function(e,t,r){if(!r)return e;for(let i of Object.keys(r.groups)){let{optional:s,repeat:n}=r.groups[i],a=`[${n?"...":""}${i}]`;s&&(a=`[${a}]`);let o=e.indexOf(a);if(o>-1){let r;let s=t[i];r=Array.isArray(s)?s.map(e=>e&&encodeURIComponent(e)).join("/"):s?encodeURIComponent(s):"",e=e.slice(0,o)+r+e.slice(o+a.length)}}return e})(e,t,o)}}({pageIsDynamic:p,page:o,i18n:this.nextConfig.i18n,basePath:this.nextConfig.basePath,rewrites:(null==(u=this.getRoutesManifest())?void 0:u.rewrites)||{beforeFiles:[],afterFiles:[],fallback:[]},caseSensitive:!!this.nextConfig.experimental.caseSensitiveRoutes});R&&!S.locale&&(r.pathname=`/${R}${r.pathname}`);let m=r.pathname,g=f.handleRewrites(e,r),v=Object.keys(g),y=m!==r.pathname;y&&r.pathname&&C(e,"rewroteURL",r.pathname);let x=new Set;for(let e of Object.keys(r.query)){let t=r.query[e];!function(e,t){for(let r of[W.dN,W.u7])e!==r&&e.startsWith(r)&&t(e.substring(r.length))}(e,i=>{r&&(r.query[i]=t,x.add(i),delete r.query[e])})}if(p){let t={},s=f.normalizeDynamicRouteParams(r.query);if(!s.hasValidParams&&p&&!eI(n)){let e=null==f.dynamicRouteMatcher?void 0:f.dynamicRouteMatcher.call(f,n);e&&(f.normalizeDynamicRouteParams(e),Object.assign(s.params,e),s.hasValidParams=!0)}if(s.hasValidParams&&(t=s.params),e.headers["x-now-route-matches"]&&eI(i)&&!s.hasValidParams){let i={},n=f.getParamsFromRouteMatches(e,i,r.query.__nextLocale||"");i.locale&&(r.query.__nextLocale=i.locale,delete r.query.__nextInferredLocaleFromDefault),(s=f.normalizeDynamicRouteParams(n,!0)).hasValidParams&&(t=s.params)}p&&f.defaultRouteMatches&&n===o&&!s.hasValidParams&&!f.normalizeDynamicRouteParams({...t},!0).hasValidParams&&(t=f.defaultRouteMatches),t&&(i=f.interpolateDynamicPath(o,t),e.url=f.interpolateDynamicPath(e.url,t))}for(let t of((p||y)&&f.normalizeVercelUrl(e,!0,[...v,...Object.keys((null==(c=f.defaultRouteRegex)?void 0:c.groups)||{})]),x))delete r.query[t];if(r.pathname=i,P.pathname=r.pathname,await this.normalizeAndAttachMetadata(e,t,r))return}catch(r){if(r instanceof g._9||r instanceof g.KM)return t.statusCode=400,this.renderError(null,e,t,"/_error",{});throw r}if(C(e,"isLocaleDomain",!!E),S.locale&&(e.url=(0,eP.format)(P),C(e,"didStripLocale",!0)),!r.query.__nextLocale&&(S.locale?r.query.__nextLocale=S.locale:R&&(r.query.__nextLocale=R,r.query.__nextInferredLocaleFromDefault="1")),!this.serverOptions.webServerConfig&&!_(e,"incrementalCache")){let t="https:";try{t=new URL(_(e,"initURL")||"/","http://n").protocol}catch{}let r=await this.getIncrementalCache({requestHeaders:Object.assign({},e.headers),requestProtocol:t.substring(0,t.length-1)});r.resetRequestCache(),C(e,"incrementalCache",r),globalThis.__incrementalCache=r}let A=_(e,"invokePath");if(!T&&A){let i=_(e,"invokeStatus");if(i){let s=_(e,"invokeQuery");s&&Object.assign(r.query,s),t.statusCode=i;let n=_(e,"invokeError")||null;return this.renderError(n,e,t,"/_error",r.query)}let s=new URL(A||"/","http://n"),n=e4(s.pathname,{nextConfig:this.nextConfig,parseData:!1});n.locale&&(r.query.__nextLocale=n.locale),r.pathname!==s.pathname&&(r.pathname=s.pathname,C(e,"rewroteURL",n.pathname));let a=e0(e1(r.pathname,this.nextConfig.basePath||""),(null==(p=this.nextConfig.i18n)?void 0:p.locales)||[]);for(let e of(a.detectedLocale&&(r.query.__nextLocale=a.detectedLocale),r.pathname=a.pathname,Object.keys(r.query)))e.startsWith("__next")||e.startsWith("_next")||delete r.query[e];let o=_(e,"invokeQuery");if(o&&Object.assign(r.query,o),await this.normalizeAndAttachMetadata(e,t,r))return;await this.handleCatchallRenderRequest(e,t,r);return}if(_(e,"middlewareInvoke")){if(await this.normalizeAndAttachMetadata(e,t,r)||await this.handleCatchallMiddlewareRequest(e,t,r))return;let i=Error();throw i.result={response:new Response(null,{headers:{"x-middleware-next":"1"}})},i.bubble=!0,i}return!T&&S.basePath&&(r.pathname=e1(r.pathname,S.basePath)),t.statusCode=200,await this.run(e,t,r)}catch(r){if(r instanceof rl)throw r;if(r&&"object"==typeof r&&"ERR_INVALID_URL"===r.code||r instanceof g._9||r instanceof g.KM)return t.statusCode=400,this.renderError(null,e,t,"/_error",{});throw r}}getRequestHandlerWithMetadata(e){let t=this.getRequestHandler();return(r,i,s)=>(r[E]=e,t(r,i,s))}getRequestHandler(){return this.handleRequest.bind(this)}setAssetPrefix(e){this.renderOpts.assetPrefix=e?e.replace(/\/$/,""):""}async prepare(){if(!this.prepared)return null===this.preparedPromise&&(this.preparedPromise=this.prepareImpl().then(()=>{this.prepared=!0,this.preparedPromise=null})),this.preparedPromise}async prepareImpl(){}async close(){}getAppPathRoutes(){let e={};return Object.keys(this.appPathsManifest||{}).forEach(t=>{let r=eO(t);e[r]||(e[r]=[]),e[r].push(t)}),e}async run(e,t,r){return(0,eH.getTracer)().trace(eF._J.run,async()=>this.runImpl(e,t,r))}async runImpl(e,t,r){await this.handleCatchallRenderRequest(e,t,r)}async pipe(e,t){return(0,eH.getTracer)().trace(eF._J.pipe,async()=>this.pipeImpl(e,t))}async pipeImpl(e,t){let r=e$(t.req.headers["user-agent"]||""),i={...t,renderOpts:{...this.renderOpts,supportsDynamicResponse:!r,isBot:!!r}},s=await e(i);if(null===s)return;let{req:n,res:a}=i,o=a.statusCode,{body:l,type:h}=s,{revalidate:d}=s;if(!a.sent){let{generateEtags:e,poweredByHeader:t,dev:r}=this.renderOpts;r&&(a.setHeader("Cache-Control","no-store, must-revalidate"),d=void 0),await this.sendRenderResult(n,a,{result:l,type:h,generateEtags:e,poweredByHeader:t,revalidate:d,swrDelta:this.nextConfig.experimental.swrDelta}),a.statusCode=o}}async getStaticHTML(e,t){let r={...t,renderOpts:{...this.renderOpts,supportsDynamicResponse:!1}},i=await e(r);return null===i?null:i.body.toUnchunkedString()}async render(e,t,r,i={},s,n=!1){return(0,eH.getTracer)().trace(eF._J.render,async()=>this.renderImpl(e,t,r,i,s,n))}getWaitUntil(){let e=function(){let e=globalThis[eR];return null==e?void 0:e.get()}();if(e)return e.waitUntil}async renderImpl(e,t,r,i={},s,n=!1){var a;return r.startsWith("/")||console.warn(`Cannot render page with path "${r}", did you mean "/${r}"?. See more info here: https://nextjs.org/docs/messages/render-no-starting-slash`),this.renderOpts.customServer&&"/index"===r&&!await this.hasPage("/index")&&(r="/"),(a=r,N.includes(a))?this.render404(e,t,s):this.pipe(e=>this.renderToResponse(e),{req:e,res:t,pathname:r,query:i})}async getStaticPaths({pathname:e}){var t;let r=null==(t=this.getPrerenderManifest().dynamicRoutes[e])?void 0:t.fallback;return{staticPaths:void 0,fallbackMode:"string"==typeof r?"static":null===r?"blocking":r}}async renderToResponseWithComponents(e,t){return(0,eH.getTracer)().trace(eF._J.renderToResponseWithComponents,async()=>this.renderToResponseWithComponentsImpl(e,t))}pathCouldBeIntercepted(e){return ej(e)||this.interceptionRoutePatterns.some(t=>t.test(e))}setVaryHeader(e,t,r,i){let s=`RSC, ${K}, ${V}`,n=ru(e),a=!1;r&&this.pathCouldBeIntercepted(i)?(t.setHeader("vary",`${s}, ${X}`),a=!0):(r||n)&&t.setHeader("vary",s),a||delete e.headers[X]}async renderToResponseWithComponentsImpl({req:e,res:t,pathname:i,renderOpts:s},{components:a,query:o}){var h,d,u,c,p,f,m;let v,y,x;i===P&&(i="/404");let w="/_error"===i,b="/404"===i||w&&404===t.statusCode,E="/500"===i||w&&500===t.statusCode,R=!0===a.isAppPath,S=!!a.getServerSideProps,T=!!a.getStaticPaths,A=function(e){let t,r;e.headers instanceof Headers?(t=e.headers.get(G.toLowerCase())??null,r=e.headers.get("content-type")):(t=e.headers[G.toLowerCase()]??null,r=e.headers["content-type"]??null);let i=!!("POST"===e.method&&"application/x-www-form-urlencoded"===r),s=!!("POST"===e.method&&(null==r?void 0:r.startsWith("multipart/form-data"))),n=!!(void 0!==t&&"string"==typeof t&&"POST"===e.method);return{actionId:t,isURLEncodedAction:i,isMultipartAction:s,isFetchAction:n,isServerAction:!!(n||i||s)}}(e).isServerAction,D=!!(null==(h=a.Component)?void 0:h.getInitialProps),N=!!a.getStaticProps,M=(0,eP.parse)(e.url||"").pathname||"/",j=_(e,"rewroteURL")||M;this.setVaryHeader(e,t,R,j);let L=!1,I=eI(a.page),q=this.getPrerenderManifest();if(R&&I){let t=await this.getStaticPaths({pathname:i,page:a.page,isAppPath:R,requestHeaders:e.headers});if(v=t.staticPaths,L=void 0!==(y=t.fallbackMode),"export"===this.nextConfig.output){let e=a.page;if("static"!==y)throw Error(`Page "${e}" is missing exported function "generateStaticParams()", which is required with "output: export" config.`);let t=eV(j);if(!(null==v?void 0:v.includes(t)))throw Error(`Page "${e}" is missing param "${t}" in "generateStaticParams()", which is required with "output: export" config.`)}L&&(T=!0)}L||(null==v?void 0:v.includes(j))||e.headers["x-now-route-matches"]?N=!0:N||=!!q.routes[ro(i)];let $=!!(o.__nextDataReq||e.headers["x-nextjs-data"]&&this.serverOptions.webServerConfig)&&(N||S),H=("1"===e.headers[V.toLowerCase()]||_(e,"isPrefetchRSCRequest"))??!1;if(!N&&e.headers["x-middleware-prefetch"]&&!(b||"/_error"===i))return t.setHeader("x-matched-path",i),t.setHeader("x-middleware-skip","1"),t.setHeader("cache-control","private, no-cache, no-store, max-age=0, must-revalidate"),t.body("{}").send(),null;delete o.__nextDataReq,N&&e.headers["x-matched-path"]&&e.url.startsWith("/_next/data")&&(e.url=this.stripNextDataPath(e.url)),e.headers["x-nextjs-data"]&&(!t.statusCode||200===t.statusCode)&&t.setHeader("x-nextjs-matched-path",`${o.__nextLocale?`/${o.__nextLocale}`:""}${i}`);let F=ru(e),z=_(e,"postponed"),U=s.experimental.ppr&&F&&!H;if(!b||$||F||(t.statusCode=404),O.includes(i)&&(t.statusCode=parseInt(i.slice(1),10)),!A&&!z&&!b&&!E&&"/_error"!==i&&"HEAD"!==e.method&&"GET"!==e.method&&("string"==typeof a.Component||N))return t.statusCode=405,t.setHeader("Allow",["GET","HEAD"]),await this.renderError(null,e,t,i),null;if("string"==typeof a.Component)return{type:"html",body:tc.fromStatic(a.Component)};if(o.amp||delete o.amp,!0===s.supportsDynamicResponse){let t=e$(e.headers["user-agent"]||""),r="function"!=typeof(null==(p=a.Document)?void 0:p.getInitialProps)||"__NEXT_BUILTIN_DOCUMENT__"in a.Document;s.supportsDynamicResponse=!N&&!t&&!o.amp&&r,s.isBot=t}!$&&R&&s.dev&&(s.supportsDynamicResponse=!0);let K=N?null==(d=this.nextConfig.i18n)?void 0:d.defaultLocale:o.__nextDefaultLocale,X=o.__nextLocale,J=null==(u=this.nextConfig.i18n)?void 0:u.locales,Y=!1;if(S||N||R){let{tryGetPreviewData:i}=r("./dist/esm/server/api-utils/node/try-get-preview-data.js");Y=!1!==i(e,t,this.renderOpts.previewProps,!!this.nextConfig.experimental.multiZoneDraftMode)}R&&!s.dev&&!Y&&N&&F&&!U&&(!((m=s.runtime)===W.Jp.experimentalEdge||m===W.Jp.edge)||this.serverOptions.webServerConfig)&&rs(e.headers);let Q=!1,Z=!1;N&&({isOnDemandRevalidate:Q,revalidateOnlyGenerated:Z}=(0,k.Iq)(e,this.renderOpts.previewProps)),N&&e.headers["x-matched-path"]&&(j=M),M=eV(M),j=eV(j),this.localeNormalizer&&(j=this.localeNormalizer.normalize(j)),$&&(j=this.stripNextDataPath(j),M=this.stripNextDataPath(M));let ee=null;Y||!N||s.supportsDynamicResponse||A||z||U||(ee=`${X?`/${X}`:""}${("/"===i||"/"===j)&&X?"":j}${o.amp?".amp":""}`),(b||E)&&N&&(ee=`${X?`/${X}`:""}${i}${o.amp?".amp":""}`),ee&&(ee="/index"===(ee=ee.split("/").map(e=>{try{e=decodeURIComponent(e).replace(RegExp("([/#?]|%(2f|23|3f))","gi"),e=>encodeURIComponent(e))}catch(e){throw new g._9("failed to decode param")}return e}).join("/"))&&"/"===i?"/":ee);let et="https:";try{et=new URL(_(e,"initURL")||"/","http://n").protocol}catch{}let er=await this.getIncrementalCache({requestHeaders:Object.assign({},e.headers),requestProtocol:et.substring(0,et.length-1)});null==er||er.resetRequestCache();let{routeModule:ei}=a,es=!!(this.nextConfig.experimental.ppr&&this.experimentalTestProxy&&o.__nextppronly),en=async({postponed:r})=>{let n,h=!$&&!0===s.dev||!N&&!T||"string"==typeof r||U,d=(0,eP.parse)(e.url||"",!0).query;s.params&&Object.keys(s.params).forEach(e=>{delete d[e]});let u="/"!==M&&this.nextConfig.trailingSlash,c=(0,eP.format)({pathname:`${j}${u?"/":""}`,query:d}),p={...a,...s,...R?{incrementalCache:er,isRevalidate:N&&!r&&!U,originalPathname:a.ComponentMod.originalPathname,serverActions:this.nextConfig.experimental.serverActions}:{},isNextDataRequest:$,resolvedUrl:c,locale:X,locales:J,defaultLocale:K,multiZoneDraftMode:this.nextConfig.experimental.multiZoneDraftMode,resolvedAsPath:S||D?(0,eP.format)({pathname:`${M}${u?"/":""}`,query:d}):c,supportsDynamicResponse:h,isOnDemandRevalidate:Q,isDraftMode:Y,isServerAction:A,postponed:r,builtInWaitUntil:this.getWaitUntil()};if(es&&(h=!1,p.nextExport=!0,p.supportsDynamicResponse=!1,p.isStaticGeneration=!0,p.isRevalidate=!0,p.isDebugPPRSkeleton=!0),ei){if(ei.definition.kind===l.APP_ROUTE){let r={params:s.params,prerenderManifest:q,renderOpts:{experimental:{ppr:!1},originalPathname:a.ComponentMod.originalPathname,supportsDynamicResponse:h,incrementalCache:er,isRevalidate:N,builtInWaitUntil:this.getWaitUntil()}};try{let i=tn.fromBaseNextRequest(e,function(e){let{errored:t,destroyed:r}=e;if(t||r)return AbortSignal.abort(t??new ti);let{signal:i}=ts(e);return i}(t.originalResponse)),s=await ei.handle(i,r);e.fetchMetrics=r.renderOpts.fetchMetrics;let n=r.renderOpts.fetchTags;if(N){var f;let e=await s.blob(),t=eK(s.headers);n&&(t[W.Et]=n),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let i=(null==(f=r.renderOpts.store)?void 0:f.revalidate)??!1;return{value:{kind:"ROUTE",status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},revalidate:i}}return await t9(e,t,s,r.renderOpts.waitUntil),null}catch(r){if(N)throw r;return ev(r),await t9(e,t,new Response(null,{status:500})),null}}else if(ei.definition.kind===l.PAGES)p.nextFontManifest=this.nextFontManifest,p.clientReferenceManifest=a.clientReferenceManifest,n=await ei.render(e.originalRequest??e,t.originalResponse??t,{page:i,params:s.params,query:o,renderOpts:p});else if(ei.definition.kind===l.APP_PAGE){let r=a.routeModule;p.nextFontManifest=this.nextFontManifest,n=await r.render(e.originalRequest??e,t.originalResponse??t,{page:b?"/404":i,params:s.params,query:o,renderOpts:p})}else throw Error("Invariant: Unknown route module type")}else n=await this.renderHTML(e,t,i,o,p);let{metadata:m}=n,{headers:g={},fetchTags:v}=m;if(v&&(g[W.Et]=v),e.fetchMetrics=m.fetchMetrics,R&&N&&0===m.revalidate&&!p.experimental.ppr){let e=m.staticBailoutInfo,t=Error(`Page changed from static to dynamic at runtime ${M}${(null==e?void 0:e.description)?`, reason: ${e.description}`:""}
17
17
  see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`);if(null==e?void 0:e.stack){let r=e.stack;t.stack=t.message+r.substring(r.indexOf("\n"))}throw t}return"isNotFound"in m&&m.isNotFound?{value:null,revalidate:m.revalidate}:m.isRedirect?{value:{kind:"REDIRECT",props:m.pageData??m.flightData},revalidate:m.revalidate}:n.isNull?null:{value:{kind:"PAGE",html:n,pageData:m.pageData??m.flightData,postponed:m.postponed,headers:g,status:R?t.statusCode:void 0},revalidate:m.revalidate}},ea=await this.responseCache.get(ee,async(r,n,l)=>{r||t.sent,v||({staticPaths:v,fallbackMode:y}=T?await this.getStaticPaths({pathname:i,requestHeaders:e.headers,isAppPath:R,page:a.page}):{staticPaths:void 0,fallbackMode:!1}),"static"===y&&e$(e.headers["user-agent"]||"")&&(y="blocking"),(null==n?void 0:n.isStale)===-1&&(Q=!0),Q&&(!1!==y||n)&&(y="blocking");let h=ee??(s.dev&&R?j:null);h&&o.amp&&(h=h.replace(/\.amp$/,"")),h&&(null==v||v.includes(h)),this.nextConfig.experimental.isExperimentalCompile&&(y="blocking");let d=await en({postponed:Q||l||!z?void 0:z});return d?{...d,revalidate:d.revalidate}:null},{routeKind:null==ei?void 0:ei.definition.kind,incrementalCache:er,isOnDemandRevalidate:Q,isPrefetch:"prefetch"===e.headers.purpose});if(Y&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),!ea){if(ee&&!(Q&&Z))throw Error("invariant: cache entry required but not generated");return null}(null==(c=ea.value)?void 0:c.kind)==="PAGE"&&ea.value.postponed;let{value:eo}=ea;if((null==eo?void 0:eo.kind)==="IMAGE")throw Error("invariant SSG should not return an image cache value");if(z)x=0;else if(F&&!H&&s.experimental.ppr)x=0;else if(1){if(Y||b&&!$)x=0;else if(N){if(b){let t=_(e,"notFoundRevalidate");x=void 0===t?0:t}else if(E)x=0;else if("number"==typeof ea.revalidate){if(ea.revalidate<1)throw Error(`Invariant: invalid Cache-Control duration provided: ${ea.revalidate} < 1`);x=ea.revalidate}else!1===ea.revalidate&&(x=W.BR)}else t.getHeader("Cache-Control")||(x=0)}ea.revalidate=x;let el=_(e,"onCacheEntry");if(el&&await el(ea,{url:_(e,"initURL")}))return null;if(eo){if("REDIRECT"===eo.kind)return(ea.revalidate&&!t.getHeader("Cache-Control")&&t.setHeader("Cache-Control",B({revalidate:ea.revalidate,swrDelta:this.nextConfig.experimental.swrDelta})),$)?{type:"json",body:tc.fromStatic(JSON.stringify(eo.props)),revalidate:ea.revalidate}:(await (e=>{let r={destination:e.pageProps.__N_REDIRECT,statusCode:e.pageProps.__N_REDIRECT_STATUS,basePath:e.pageProps.__N_REDIRECT_BASE_PATH},i=r.statusCode||(r.permanent?n.PermanentRedirect:n.TemporaryRedirect),{basePath:s}=this.nextConfig;s&&!1!==r.basePath&&r.destination.startsWith("/")&&(r.destination=`${s}${r.destination}`),r.destination.startsWith("/")&&(r.destination=(0,g.U3)(r.destination)),t.redirect(r.destination,i).body(r.destination).send()})(eo.props),null);if("ROUTE"===eo.kind){let r={...eo.headers};return N||delete r[W.Et],await t9(e,t,new Response(eo.body,{headers:eB(r),status:eo.status||200})),null}if(R){if(eo.postponed&&z)throw Error("Invariant: postponed state should not be present on a resume request");if(eo.headers){let e={...eo.headers};for(let[r,i]of(N||delete e[W.Et],Object.entries(e)))if(void 0!==i){if(Array.isArray(i))for(let e of i)t.appendHeader(r,e);else"number"==typeof i&&(i=i.toString()),t.appendHeader(r,i)}}if(N&&(null==(f=eo.headers)?void 0:f[W.Et])&&t.setHeader(W.Et,eo.headers[W.Et]),!eo.status||F&&s.experimental.ppr||(t.statusCode=eo.status),eo.postponed&&F&&t.setHeader("x-nextjs-postponed","1"),F&&!Y){if("string"!=typeof eo.pageData){if(eo.postponed)throw Error("Invariant: Expected postponed to be undefined");return{type:"rsc",body:eo.html,revalidate:U?0:ea.revalidate}}return{type:"rsc",body:tc.fromStatic(eo.pageData),revalidate:ea.revalidate}}let e=eo.html;return eo.postponed,{type:"html",body:e,revalidate:ea.revalidate}}return $?{type:"json",body:tc.fromStatic(JSON.stringify(eo.pageData)),revalidate:ea.revalidate}:{type:"html",body:eo.html,revalidate:ea.revalidate}}return(C(e,"notFoundRevalidate",ea.revalidate),ea.revalidate&&!t.getHeader("Cache-Control")&&t.setHeader("Cache-Control",B({revalidate:ea.revalidate,swrDelta:this.nextConfig.experimental.swrDelta})),$)?(t.statusCode=404,t.body('{"notFound":true}').send()):await this.render404(e,t,{pathname:i,query:o},!1),null}stripNextDataPath(e,t=!0){return(e.includes(this.buildId)&&(e=tp(e.substring(e.indexOf(this.buildId)+this.buildId.length).replace(/\.json$/,""))),this.localeNormalizer&&t)?this.localeNormalizer.normalize(e):e}getOriginalAppPaths(e){if(this.enabledDirectories.app){var t;return(null==(t=this.appPathRoutes)?void 0:t[e])||null}return null}async renderPageComponent(e,t){var r,i;let{query:s,pathname:n}=e,a=this.getOriginalAppPaths(n),o=Array.isArray(a),l=n;o&&(l=a[a.length-1]);let h=await this.findPageComponents({page:l,query:s,params:e.renderOpts.params||{},isAppPath:o,sriEnabled:!!(null==(r=this.nextConfig.experimental.sri)?void 0:r.algorithm),appPaths:a,shouldEnsure:!1});if(h){null==(i=(0,eH.getTracer)().getRootSpanAttributes())||i.set("next.route",n);try{return await this.renderToResponseWithComponents(e,h)}catch(r){let e=r instanceof rl;if(!e||e&&t)throw r}}return!1}async renderToResponse(e){return(0,eH.getTracer)().trace(eF._J.renderToResponse,{spanName:"rendering page",attributes:{"next.route":e.pathname}},async()=>this.renderToResponseImpl(e))}async renderToResponseImpl(e){var t;let{res:r,query:i,pathname:s}=e,n=!!i._nextBubbleNoFallback;delete i[Y],delete i._nextBubbleNoFallback;let a={i18n:null==(t=this.i18nProvider)?void 0:t.fromQuery(s,i)};try{for await(let t of this.matchers.matchAll(s,a)){_(e.req,"invokeOutput");let r=await this.renderPageComponent({...e,pathname:t.definition.pathname,renderOpts:{...e.renderOpts,params:t.params}},n);if(!1!==r)return r}if(this.serverOptions.webServerConfig){e.pathname=this.serverOptions.webServerConfig.page;let t=await this.renderPageComponent(e,n);if(!1!==t)return t}}catch(a){let t=tP(a);if(a instanceof g.At)throw console.error("Invariant: failed to load static page",JSON.stringify({page:s,url:e.req.url,matchedPath:e.req.headers["x-matched-path"],initUrl:_(e.req,"initURL"),didRewrite:!!_(e.req,"rewroteURL"),rewroteUrl:_(e.req,"rewroteURL")},null,2)),t;if(t instanceof rl&&n)throw t;if(t instanceof g._9||t instanceof g.KM)return r.statusCode=400,await this.renderErrorToResponse(e,t);r.statusCode=500,await this.hasPage("/500")&&(e.query.__nextCustomErrorRender="1",await this.renderErrorToResponse(e,t),delete e.query.__nextCustomErrorRender);let i=t instanceof rh;if(!i)throw tR(t)&&(t.page=s),t;return await this.renderErrorToResponse(e,i?t.innerError:t)}return this.getMiddleware()&&e.req.headers["x-nextjs-data"]&&(!r.statusCode||200===r.statusCode||404===r.statusCode)?(r.setHeader("x-nextjs-matched-path",`${i.__nextLocale?`/${i.__nextLocale}`:""}${s}`),r.statusCode=200,r.setHeader("content-type","application/json"),r.body("{}"),r.send(),null):(r.statusCode=404,this.renderErrorToResponse(e,null))}async renderToHTML(e,t,r,i={}){return(0,eH.getTracer)().trace(eF._J.renderToHTML,async()=>this.renderToHTMLImpl(e,t,r,i))}async renderToHTMLImpl(e,t,r,i={}){return this.getStaticHTML(e=>this.renderToResponse(e),{req:e,res:t,pathname:r,query:i})}async renderError(e,t,r,i,s={},n=!0){return(0,eH.getTracer)().trace(eF._J.renderError,async()=>this.renderErrorImpl(e,t,r,i,s,n))}async renderErrorImpl(e,t,r,i,s={},n=!0){return n&&r.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),this.pipe(async t=>{let i=await this.renderErrorToResponse(t,e);if(500===r.statusCode)throw e;return i},{req:t,res:r,pathname:i,query:s})}async renderErrorToResponse(e,t){return(0,eH.getTracer)().trace(eF._J.renderErrorToResponse,async()=>this.renderErrorToResponseImpl(e,t))}async renderErrorToResponseImpl(e,t){let{res:r,query:i}=e;try{let s=null;404===r.statusCode&&(this.enabledDirectories.app&&(s=await this.findPageComponents({page:S,query:i,params:{},isAppPath:!0,shouldEnsure:!0,url:e.req.url})),!s&&await this.hasPage("/404")&&(s=await this.findPageComponents({page:"/404",query:i,params:{},isAppPath:!1,shouldEnsure:!0,url:e.req.url})));let n=`/${r.statusCode}`;if(!e.query.__nextCustomErrorRender&&!s&&O.includes(n)&&(s=await this.findPageComponents({page:n,query:i,params:{},isAppPath:!1,shouldEnsure:!0,url:e.req.url})),s||(s=await this.findPageComponents({page:"/_error",query:i,params:{},isAppPath:!1,shouldEnsure:!0,url:e.req.url}),n="/_error"),!s)throw new rh(Error("missing required error components"));s.components.routeModule?C(e.req,"match",{definition:s.components.routeModule.definition,params:void 0}):function(e,t){let r=_(e);return delete r[t],e[E]=r,r}(e.req,"match");try{return await this.renderToResponseWithComponents({...e,pathname:n,renderOpts:{...e.renderOpts,err:t}},s)}catch(e){if(e instanceof rl)throw Error("invariant: failed to render error page");throw e}}catch(a){let t=tP(a),s=t instanceof rh;s||this.logError(t),r.statusCode=500;let n=await this.getFallbackErrorComponents(e.req.url);if(n)return C(e.req,"match",{definition:n.routeModule.definition,params:void 0}),this.renderToResponseWithComponents({...e,pathname:"/_error",renderOpts:{...e.renderOpts,err:s?t.innerError:t}},{query:i,components:n});return{type:"html",body:tc.fromStatic("Internal Server Error")}}}async renderErrorToHTML(e,t,r,i,s={}){return this.getStaticHTML(t=>this.renderErrorToResponse(t,e),{req:t,res:r,pathname:i,query:s})}async render404(e,t,r,i=!0){let{pathname:s,query:n}=r||(0,eP.parse)(e.url,!0);return this.nextConfig.i18n&&(n.__nextLocale||=this.nextConfig.i18n.defaultLocale,n.__nextDefaultLocale||=this.nextConfig.i18n.defaultLocale),t.statusCode=404,this.renderError(null,e,t,s,n,i)}}function ru(e){return"1"===e.headers.rsc||!!_(e,"isRSCRequest")}var rc=r("./dist/compiled/lru-cache/index.js"),rp=r.n(rc);let rf=require("vm");function rm(e){if(Object.isFrozen(e))return e;if(Array.isArray(e)){for(let t of e)t&&"object"==typeof t&&rm(t);return Object.freeze(e)}for(let t of Object.values(e))t&&"object"==typeof t&&rm(t);return Object.freeze(e)}let rg=new Map;function rv(e,t=!0,r=rg){let i=t&&r.get(e);if(i)return i;let s=JSON.parse((0,v.readFileSync)(e,"utf8"));return t&&(s=rm(s)),t&&r.set(e,s),s}let ry=new(rp())({max:1e3});function rx(e,t,r,i){let s;let n=`${e}:${t}:${r}:${i}`,a=null==ry?void 0:ry.get(n);if(a)return a;let o=w().join(t,D);i&&(s=rv(w().join(o,A),!0));let l=rv(w().join(o,T),!0);try{e=tp(tL(e))}catch(t){throw console.error(t),new g.GP(e)}let h=t=>{let i=t[e];if(!t[i]&&r){let s={};for(let e of Object.keys(t))s[e0(e,r).pathname]=l[e];i=s[e]}return i};return(s&&(a=h(s)),a||(a=h(l)),a)?(a=w().join(o,a),null==ry||ry.set(n,a),a):(null==ry||ry.set(n,null),null)}function rw(e,t,r,i){let s=rx(e,t,r,i);if(!s)throw new g.GP(e);return s}function rb(e,t,r){let i=rw(e,t,void 0,r);if(i.endsWith(".html"))return v.promises.readFile(i,"utf8").catch(t=>{throw new g.At(e,t.message)});try{return process.env.__NEXT_PRIVATE_RUNTIME_TYPE=r?"app":"pages",require(i)}finally{process.env.__NEXT_PRIVATE_RUNTIME_TYPE=""}}function rE(e){return e.default||e}async function r_(e){return new Promise(t=>setTimeout(t,e))}let rC=Symbol.for("next.server.action-manifests");async function rR(e,t=3){for(;;)try{return rv(e)}catch(e){if(--t<=0)throw e;await r_(100)}}async function rP(e,t=3){for(;;)try{return function(e,t=!0,r=rg){let i=t&&r.get(e);if(i)return i;let s=(0,v.readFileSync)(e,"utf8");if(0===s.length)throw Error("Manifest file is empty");let n={};return(0,rf.runInNewContext)(s,n),t&&(n=rm(n)),t&&r.set(e,n),n}(e)}catch(e){if(--t<=0)throw e;await r_(100)}}async function rS(e,t,r){try{return(await rP(e,r)).__RSC_MANIFEST[t]}catch(e){return}}async function rT({distDir:e,page:t,isAppPath:r,isDev:i}){let s={},n={};r||([s,n]=await Promise.all([Promise.resolve().then(()=>rb("/_document",e,!1)),Promise.resolve().then(()=>rb("/_app",e,!1))]));let a=r&&(t.endsWith("/page")||t===P),o=i?3:1,[l,h,d,u]=await Promise.all([rR((0,x.join)(e,"build-manifest.json"),o),rR((0,x.join)(e,"react-loadable-manifest.json"),o),a?rS((0,x.join)(e,"server","app",t.replace(/%5F/g,"_")+"_client-reference-manifest.js"),t.replace(/%5F/g,"_"),o):void 0,r?rR((0,x.join)(e,"server","server-reference-manifest.json"),o).catch(()=>null):null]);u&&d&&function({clientReferenceManifest:e,serverActionsManifest:t,serverModuleMap:r}){globalThis[rC]={clientReferenceManifest:e,serverActionsManifest:t,serverModuleMap:r}}({clientReferenceManifest:d,serverActionsManifest:u,serverModuleMap:function({serverActionsManifest:e,pageName:t}){return new Proxy({},{get:(r,i)=>({id:e.node[i].workers[eQ(t,"app")?t:"app"+t],name:i,chunks:[]})})}({serverActionsManifest:u,pageName:t})});let c=await Promise.resolve().then(()=>rb(t,e,r)),p=rE(c),f=rE(s),m=rE(n),{getServerSideProps:g,getStaticProps:v,getStaticPaths:y,routeModule:w}=c;return{App:m,Document:f,Component:p,buildManifest:l,reactLoadableManifest:h,pageConfig:c.config||{},ComponentMod:c,getServerSideProps:g,getStaticProps:v,getStaticPaths:y,clientReferenceManifest:d,serverActionsManifest:u,isAppPath:r,page:t,routeModule:w}}let rA=(0,eH.getTracer)().wrap(eF.qj.loadComponents,rT);var rD=r("../next-env/dist/index.js");let rN=require("stream");var rO=r.n(rN);class rM{constructor(e,t=e=>e()){this.cacheKeyFn=e,this.schedulerFn=t,this.pending=new Map}static create(e){return new rM(null==e?void 0:e.cacheKeyFn,null==e?void 0:e.schedulerFn)}async batch(e,t){let r=this.cacheKeyFn?await this.cacheKeyFn(e):e;if(null===r)return t(r,Promise.resolve);let i=this.pending.get(r);if(i)return i;let{promise:s,resolve:n,reject:a}=new ta;return this.pending.set(r,s),this.schedulerFn(async()=>{try{let e=await t(r,n);n(e)}catch(e){a(e)}finally{this.pending.delete(r)}}),s}}let rk=e=>{Promise.resolve().then(()=>{process.nextTick(e)})};async function rj(e){var t;return{...e,value:(null==(t=e.value)?void 0:t.kind)==="PAGE"?{kind:"PAGE",html:await e.value.html.toUnchunkedString(!0),postponed:e.value.postponed,pageData:e.value.pageData,headers:e.value.headers,status:e.value.status}:e.value}}async function rL(e){var t,r;if(!e)return null;if((null==(t=e.value)?void 0:t.kind)==="FETCH")throw Error("Invariant: unexpected cachedResponse of kind fetch in response cache");return{isMiss:e.isMiss,isStale:e.isStale,revalidate:e.revalidate,value:(null==(r=e.value)?void 0:r.kind)==="PAGE"?{kind:"PAGE",html:tc.fromStatic(e.value.html),pageData:e.value.pageData,postponed:e.value.postponed,headers:e.value.headers,status:e.value.status}:e.value}}class rI{constructor(e){this.batcher=rM.create({cacheKeyFn:({key:e,isOnDemandRevalidate:t})=>`${e}-${t?"1":"0"}`,schedulerFn:rk}),this.minimalMode=e}async get(e,t,r){if(!e)return t(!1,null);let{incrementalCache:i,isOnDemandRevalidate:s=!1}=r;return rL(await this.batcher.batch({key:e,isOnDemandRevalidate:s},async(n,a)=>{var o;if((null==(o=this.previousCacheItem)?void 0:o.key)===n&&this.previousCacheItem.expiresAt>Date.now())return this.previousCacheItem.entry;r.routeKind===l.APP_PAGE||r.routeKind===l.APP_ROUTE||(r.routeKind,l.PAGES);let h=!1,d=null;try{d=null;let e=await t(h,d,!0);if(!e)return this.previousCacheItem=void 0,null;let r=await rj({...e,isMiss:!d});if(!r)return this.previousCacheItem=void 0,null;return s||h||(a(r),h=!0),void 0!==r.revalidate&&(this.previousCacheItem={key:n,entry:r,expiresAt:Date.now()+1e3}),r}catch(t){if(d&&await i.set(e,d.value,{revalidate:Math.min(Math.max(d.revalidate||3,3),30)}),h)return console.error(t),null;throw t}}))}}let rq=0,r$="x-vercel-cache-tags",rH="x-vercel-sc-headers",rF="x-vercel-revalidate",rz="x-vercel-cache-item-name",rU=!!process.env.NEXT_PRIVATE_DEBUG_CACHE;async function rW(e,t,r=0){let i=new AbortController,s=setTimeout(()=>{i.abort()},500);return fetch(e,{...t||{},signal:i.signal}).catch(i=>{if(3!==r)return rU&&console.log(`Fetch failed for ${e} retry ${r}`),rW(e,t,r+1);throw i}).finally(()=>{clearTimeout(s)})}class rB{hasMatchingTags(e,t){if(e.length!==t.length)return!1;let r=new Set(e),i=new Set(t);if(r.size!==i.size)return!1;for(let e of r)if(!i.has(e))return!1;return!0}static isAvailable(e){return!!(e._requestHeaders["x-vercel-sc-host"]||process.env.SUSPENSE_CACHE_URL)}constructor(t){if(this.headers={},this.headers["Content-Type"]="application/json",rH in t._requestHeaders){let e=JSON.parse(t._requestHeaders[rH]);for(let t in e)this.headers[t]=e[t];delete t._requestHeaders[rH]}let r=t._requestHeaders["x-vercel-sc-host"]||process.env.SUSPENSE_CACHE_URL,i=t._requestHeaders["x-vercel-sc-basepath"]||process.env.SUSPENSE_CACHE_BASEPATH;if(process.env.SUSPENSE_CACHE_AUTH_TOKEN&&(this.headers.Authorization=`Bearer ${process.env.SUSPENSE_CACHE_AUTH_TOKEN}`),r){let e=process.env.SUSPENSE_CACHE_PROTO||"https";this.cacheEndpoint=`${e}://${r}${i||""}`,rU&&console.log("using cache endpoint",this.cacheEndpoint)}else rU&&console.log("no cache endpoint available");t.maxMemoryCacheSize?e||(rU&&console.log("using memory store for fetch cache"),e=new(rp())({max:t.maxMemoryCacheSize,length({value:e}){var t;if(!e)return 25;if("REDIRECT"===e.kind)return JSON.stringify(e.props).length;if("IMAGE"===e.kind)throw Error("invariant image should not be incremental-cache");return"FETCH"===e.kind?JSON.stringify(e.data||"").length:"ROUTE"===e.kind?e.body.length:e.html.length+((null==(t=JSON.stringify("PAGE"===e.kind&&e.pageData))?void 0:t.length)||0)}})):rU&&console.log("not using memory store for fetch cache")}resetRequestCache(){null==e||e.reset()}async revalidateTag(...e){let[t]=e;if(t="string"==typeof t?[t]:t,rU&&console.log("revalidateTag",t),t.length){if(Date.now()<rq){rU&&console.log("rate limited ",rq);return}for(let e=0;e<Math.ceil(t.length/64);e++){let r=t.slice(64*e,64*e+64);try{let e=await rW(`${this.cacheEndpoint}/v1/suspense-cache/revalidate?tags=${r.map(e=>encodeURIComponent(e)).join(",")}`,{method:"POST",headers:this.headers,next:{internal:!0}});if(429===e.status){let t=e.headers.get("retry-after")||"60000";rq=Date.now()+parseInt(t)}if(!e.ok)throw Error(`Request failed with status ${e.status}.`)}catch(e){console.warn("Failed to revalidate tag",r,e)}}}}async get(...t){var r;let[i,s={}]=t,{tags:n,softTags:a,kindHint:o,fetchIdx:l,fetchUrl:h}=s;if("fetch"!==o)return null;if(Date.now()<rq)return rU&&console.log("rate limited"),null;let d=null==e?void 0:e.get(i),u=(null==d?void 0:null==(r=d.value)?void 0:r.kind)==="FETCH"&&this.hasMatchingTags(n??[],d.value.tags??[]);if(this.cacheEndpoint&&(!d||!u))try{let t=Date.now(),r=await fetch(`${this.cacheEndpoint}/v1/suspense-cache/${i}`,{method:"GET",headers:{...this.headers,[rz]:h,[r$]:(null==n?void 0:n.join(","))||"",[W.Ar]:(null==a?void 0:a.join(","))||""},next:{internal:!0,fetchType:"cache-get",fetchUrl:h,fetchIdx:l}});if(429===r.status){let e=r.headers.get("retry-after")||"60000";rq=Date.now()+parseInt(e)}if(404===r.status)return rU&&console.log(`no fetch cache entry for ${i}, duration: ${Date.now()-t}ms`),null;if(!r.ok)throw console.error(await r.text()),Error(`invalid response from cache ${r.status}`);let s=await r.json();if(!s||"FETCH"!==s.kind)throw rU&&console.log({cached:s}),Error("invalid cache value");if("FETCH"===s.kind)for(let e of(s.tags??=[],n??[]))s.tags.includes(e)||s.tags.push(e);let o=r.headers.get("x-vercel-cache-state"),u=r.headers.get("age");d={value:s,lastModified:"fresh"!==o?Date.now()-W.BR:Date.now()-1e3*parseInt(u||"0",10)},rU&&console.log(`got fetch cache entry for ${i}, duration: ${Date.now()-t}ms, size: ${Object.keys(s).length}, cache-state: ${o} tags: ${null==n?void 0:n.join(",")} softTags: ${null==a?void 0:a.join(",")}`),d&&(null==e||e.set(i,d))}catch(e){rU&&console.error("Failed to get from fetch-cache",e)}return d||null}async set(...t){let[r,i,s]=t,{fetchCache:n,fetchIdx:a,fetchUrl:o,tags:l}=s;if(n){if(Date.now()<rq){rU&&console.log("rate limited");return}if(null==e||e.set(r,{value:i,lastModified:Date.now()}),this.cacheEndpoint)try{let e=Date.now();null!==i&&"revalidate"in i&&(this.headers[rF]=i.revalidate.toString()),!this.headers[rF]&&null!==i&&"data"in i&&(this.headers["x-vercel-cache-control"]=i.data.headers["cache-control"]);let t=JSON.stringify({...i,tags:void 0});rU&&console.log("set cache",r);let s=await fetch(`${this.cacheEndpoint}/v1/suspense-cache/${r}`,{method:"POST",headers:{...this.headers,[rz]:o||"",[r$]:(null==l?void 0:l.join(","))||""},body:t,next:{internal:!0,fetchType:"cache-set",fetchUrl:o,fetchIdx:a}});if(429===s.status){let e=s.headers.get("retry-after")||"60000";rq=Date.now()+parseInt(e)}if(!s.ok)throw rU&&console.log(await s.text()),Error(`invalid response ${s.status}`);rU&&console.log(`successfully set to fetch-cache for ${r}, duration: ${Date.now()-e}ms, size: ${t.length}`)}catch(e){rU&&console.error("Failed to update fetch cache",e)}}}}class rG{constructor(e){this.fs=e.fs,this.flushToDisk=e.flushToDisk,this.serverDistDir=e.serverDistDir,this.appDir=!!e._appDir,this.pagesDir=!!e._pagesDir,this.revalidatedTags=e.revalidatedTags,this.experimental=e.experimental,this.debug=!!process.env.NEXT_PRIVATE_DEBUG_CACHE,e.maxMemoryCacheSize&&!t?(this.debug&&console.log("using memory store for fetch cache"),t=new(rp())({max:e.maxMemoryCacheSize,length({value:e}){var t;if(!e)return 25;if("REDIRECT"===e.kind)return JSON.stringify(e.props).length;if("IMAGE"===e.kind)throw Error("invariant image should not be incremental-cache");return"FETCH"===e.kind?JSON.stringify(e.data||"").length:"ROUTE"===e.kind?e.body.length:e.html.length+((null==(t=JSON.stringify(e.pageData))?void 0:t.length)||0)}})):this.debug&&console.log("not using memory store for fetch cache"),this.serverDistDir&&this.fs&&(this.tagsManifestPath=tk().join(this.serverDistDir,"..","cache","fetch-cache","tags-manifest.json"),this.loadTagsManifest())}resetRequestCache(){}loadTagsManifest(){if(this.tagsManifestPath&&this.fs&&!s){try{s=JSON.parse(this.fs.readFileSync(this.tagsManifestPath,"utf8"))}catch(e){s={version:1,items:{}}}this.debug&&console.log("loadTagsManifest",s)}}async revalidateTag(...e){let[t]=e;if(t="string"==typeof t?[t]:t,this.debug&&console.log("revalidateTag",t),0!==t.length&&(await this.loadTagsManifest(),s&&this.tagsManifestPath)){for(let e of t){let t=s.items[e]||{};t.revalidatedAt=Date.now(),s.items[e]=t}try{await this.fs.mkdir(tk().dirname(this.tagsManifestPath)),await this.fs.writeFile(this.tagsManifestPath,JSON.stringify(s||{})),this.debug&&console.log("Updated tags manifest",s)}catch(e){console.warn("Failed to update tags manifest.",e)}}}async get(...e){var r,i,n,a,o;let[l,h={}]=e,{tags:d,softTags:u,kindHint:c}=h,p=null==t?void 0:t.get(l);if(this.debug&&console.log("get",l,d,c,!!p),!p){try{let e=this.getFilePath(`${l}.body`,"app"),t=await this.fs.readFile(e),{mtime:r}=await this.fs.stat(e),i=JSON.parse(await this.fs.readFile(e.replace(/\.body$/,W.EX),"utf8"));return{lastModified:r.getTime(),value:{kind:"ROUTE",body:t,headers:i.headers,status:i.status}}}catch(e){}try{let e=c;e||(e=this.detectFileKind(`${l}.html`));let r="app"===e,i=this.getFilePath("fetch"===e?l:`${l}.html`,e),s=await this.fs.readFile(i,"utf8"),{mtime:o}=await this.fs.stat(i);if("fetch"===e&&this.flushToDisk){let e=o.getTime(),t=JSON.parse(s);if(p={lastModified:e,value:t},(null==(n=p.value)?void 0:n.kind)==="FETCH"){let e=null==(a=p.value)?void 0:a.tags;(null==d?void 0:d.every(t=>null==e?void 0:e.includes(t)))||(this.debug&&console.log("tags vs storedTags mismatch",d,e),await this.set(l,p.value,{tags:d}))}}else{let e;let t=r?await this.fs.readFile(this.getFilePath(`${l}${this.experimental.ppr?W.Sx:W.hd}`,"app"),"utf8"):JSON.parse(await this.fs.readFile(this.getFilePath(`${l}${W.JT}`,"pages"),"utf8"));if(r)try{e=JSON.parse(await this.fs.readFile(i.replace(/\.html$/,W.EX),"utf8"))}catch{}p={lastModified:o.getTime(),value:{kind:"PAGE",html:s,pageData:t,postponed:null==e?void 0:e.postponed,headers:null==e?void 0:e.headers,status:null==e?void 0:e.status}}}p&&(null==t||t.set(l,p))}catch(e){}}if((null==p?void 0:null==(r=p.value)?void 0:r.kind)==="PAGE"){let e;let t=null==(o=p.value.headers)?void 0:o[W.Et];"string"==typeof t&&(e=t.split(",")),(null==e?void 0:e.length)&&(this.loadTagsManifest(),e.some(e=>{var t;return(null==s?void 0:null==(t=s.items[e])?void 0:t.revalidatedAt)&&(null==s?void 0:s.items[e].revalidatedAt)>=((null==p?void 0:p.lastModified)||Date.now())})&&(p=void 0))}return p&&(null==p?void 0:null==(i=p.value)?void 0:i.kind)==="FETCH"&&(this.loadTagsManifest(),[...d||[],...u||[]].some(e=>{var t;return!!this.revalidatedTags.includes(e)||(null==s?void 0:null==(t=s.items[e])?void 0:t.revalidatedAt)&&(null==s?void 0:s.items[e].revalidatedAt)>=((null==p?void 0:p.lastModified)||Date.now())})&&(p=void 0)),p??null}async set(...e){let[r,i,s]=e;if(null==t||t.set(r,{value:i,lastModified:Date.now()}),this.debug&&console.log("set",r),this.flushToDisk){if((null==i?void 0:i.kind)==="ROUTE"){let e=this.getFilePath(`${r}.body`,"app");await this.fs.mkdir(tk().dirname(e)),await this.fs.writeFile(e,i.body);let t={headers:i.headers,status:i.status,postponed:void 0};await this.fs.writeFile(e.replace(/\.body$/,W.EX),JSON.stringify(t,null,2));return}if((null==i?void 0:i.kind)==="PAGE"){let e="string"==typeof i.pageData,t=this.getFilePath(`${r}.html`,e?"app":"pages");if(await this.fs.mkdir(tk().dirname(t)),await this.fs.writeFile(t,i.html),await this.fs.writeFile(this.getFilePath(`${r}${e?this.experimental.ppr?W.Sx:W.hd:W.JT}`,e?"app":"pages"),e?i.pageData:JSON.stringify(i.pageData)),i.headers||i.status){let e={headers:i.headers,status:i.status,postponed:i.postponed};await this.fs.writeFile(t.replace(/\.html$/,W.EX),JSON.stringify(e))}}else if((null==i?void 0:i.kind)==="FETCH"){let e=this.getFilePath(r,"fetch");await this.fs.mkdir(tk().dirname(e)),await this.fs.writeFile(e,JSON.stringify({...i,tags:s.tags}))}}}detectFileKind(e){if(!this.appDir&&!this.pagesDir)throw Error("Invariant: Can't determine file path kind, no page directory enabled");if(!this.appDir&&this.pagesDir)return"pages";if(this.appDir&&!this.pagesDir)return"app";let t=this.getFilePath(e,"pages");if(this.fs.existsSync(t))return"pages";if(t=this.getFilePath(e,"app"),this.fs.existsSync(t))return"app";throw Error(`Invariant: Unable to determine file path kind for ${e}`)}getFilePath(e,t){switch(t){case"fetch":return tk().join(this.serverDistDir,"..","cache","fetch-cache",e);case"pages":return tk().join(this.serverDistDir,"pages",e);case"app":return tk().join(this.serverDistDir,"app",e);default:throw Error("Invariant: Can't determine file path kind")}}}class rK{static #e=this.timings=new Map;constructor(e){this.prerenderManifest=e}get(e){var t;let r=rK.timings.get(e);if(void 0!==r||void 0!==(r=null==(t=this.prerenderManifest.routes[e])?void 0:t.initialRevalidateSeconds))return r}set(e,t){rK.timings.set(e,t)}clear(){rK.timings.clear()}}class rV{constructor({fs:e,dev:t,appDir:r,pagesDir:i,flushToDisk:s,fetchCache:n,minimalMode:a,serverDistDir:o,requestHeaders:l,requestProtocol:h,maxMemoryCacheSize:d,getPrerenderManifest:u,fetchCacheKeyPrefix:c,CurCacheHandler:p,allowedRevalidateHeaderKeys:f,experimental:m}){var g,v,y,x;this.locks=new Map,this.unlocks=new Map;let w=!!process.env.NEXT_PRIVATE_DEBUG_CACHE;this.hasCustomCacheHandler=!!p,p?w&&console.log("using custom cache handler",p.name):(e&&o&&(w&&console.log("using filesystem cache handler"),p=rG),rB.isAvailable({_requestHeaders:l})&&a&&n&&(w&&console.log("using fetch cache handler"),p=rB)),process.env.__NEXT_TEST_MAX_ISR_CACHE&&(d=parseInt(process.env.__NEXT_TEST_MAX_ISR_CACHE,10)),this.dev=t,this.disableForTestmode="true"===process.env.NEXT_PRIVATE_TEST_PROXY,this.minimalMode=a,this.requestHeaders=l,this.requestProtocol=h,this.allowedRevalidateHeaderKeys=f,this.prerenderManifest=u(),this.revalidateTimings=new rK(this.prerenderManifest),this.fetchCacheKeyPrefix=c;let b=[];l[W.y3]===(null==(v=this.prerenderManifest)?void 0:null==(g=v.preview)?void 0:g.previewModeId)&&(this.isOnDemandRevalidate=!0),a&&"string"==typeof l[W.of]&&l[W.X_]===(null==(x=this.prerenderManifest)?void 0:null==(y=x.preview)?void 0:y.previewModeId)&&(b=l[W.of].split(",")),p&&(this.cacheHandler=new p({dev:t,fs:e,flushToDisk:s,serverDistDir:o,revalidatedTags:b,maxMemoryCacheSize:d,_pagesDir:!!i,_appDir:!!r,_requestHeaders:l,fetchCacheKeyPrefix:c,experimental:m}))}calculateRevalidate(e,t,r){if(r)return new Date().getTime()-1e3;let i=this.revalidateTimings.get(ro(e))??1;return"number"==typeof i?1e3*i+t:i}_getPathname(e,t){return t?e:tL(e)}resetRequestCache(){var e,t;null==(t=this.cacheHandler)||null==(e=t.resetRequestCache)||e.call(t)}async unlock(e){let t=this.unlocks.get(e);t&&(t(),this.locks.delete(e),this.unlocks.delete(e))}async lock(e){if(process.env.__NEXT_INCREMENTAL_CACHE_IPC_PORT&&process.env.__NEXT_INCREMENTAL_CACHE_IPC_KEY){let t=r("./dist/esm/server/lib/server-ipc/request-utils.js").p;return await t({method:"lock",ipcPort:process.env.__NEXT_INCREMENTAL_CACHE_IPC_PORT,ipcKey:process.env.__NEXT_INCREMENTAL_CACHE_IPC_KEY,args:[e]}),async()=>{await t({method:"unlock",ipcPort:process.env.__NEXT_INCREMENTAL_CACHE_IPC_PORT,ipcKey:process.env.__NEXT_INCREMENTAL_CACHE_IPC_KEY,args:[e]})}}let t=()=>Promise.resolve(),i=this.locks.get(e);if(i)await i;else{let r=new Promise(e=>{t=async()=>{e()}});this.locks.set(e,r),this.unlocks.set(e,t)}return t}async revalidateTag(e){var t,i;return process.env.__NEXT_INCREMENTAL_CACHE_IPC_PORT&&process.env.__NEXT_INCREMENTAL_CACHE_IPC_KEY?(0,r("./dist/esm/server/lib/server-ipc/request-utils.js").p)({method:"revalidateTag",ipcPort:process.env.__NEXT_INCREMENTAL_CACHE_IPC_PORT,ipcKey:process.env.__NEXT_INCREMENTAL_CACHE_IPC_KEY,args:[...arguments]}):null==(i=this.cacheHandler)?void 0:null==(t=i.revalidateTag)?void 0:t.call(i,e)}async fetchCacheKey(e,t={}){let i=[],s=new TextEncoder,n=new TextDecoder;if(t.body){if("function"==typeof t.body.getReader){let e=t.body,r=[];try{await e.pipeTo(new WritableStream({write(e){"string"==typeof e?(r.push(s.encode(e)),i.push(e)):(r.push(e),i.push(n.decode(e,{stream:!0})))}})),i.push(n.decode());let a=r.reduce((e,t)=>e+t.length,0),o=new Uint8Array(a),l=0;for(let e of r)o.set(e,l),l+=e.length;t._ogBody=o}catch(e){console.error("Problem reading body",e)}}else if("function"==typeof t.body.keys){let e=t.body;for(let r of(t._ogBody=t.body,new Set([...e.keys()]))){let t=e.getAll(r);i.push(`${r}=${(await Promise.all(t.map(async e=>"string"==typeof e?e:await e.text()))).join(",")}`)}}else if("function"==typeof t.body.arrayBuffer){let e=t.body,r=await e.arrayBuffer();i.push(await e.text()),t._ogBody=new Blob([r],{type:e.type})}else"string"==typeof t.body&&(i.push(t.body),t._ogBody=t.body)}let a="function"==typeof(t.headers||{}).keys?Object.fromEntries(t.headers):Object.assign({},t.headers);"traceparent"in a&&delete a.traceparent;let o=JSON.stringify(["v3",this.fetchCacheKeyPrefix||"",e,t.method,a,t.mode,t.redirect,t.credentials,t.referrer,t.referrerPolicy,t.integrity,t.cache,i]);return r("crypto").createHash("sha256").update(o).digest("hex")}async get(e,t={}){var i,s;let n,a;if(process.env.__NEXT_INCREMENTAL_CACHE_IPC_PORT&&process.env.__NEXT_INCREMENTAL_CACHE_IPC_KEY)return(0,r("./dist/esm/server/lib/server-ipc/request-utils.js").p)({method:"get",ipcPort:process.env.__NEXT_INCREMENTAL_CACHE_IPC_PORT,ipcKey:process.env.__NEXT_INCREMENTAL_CACHE_IPC_KEY,args:[...arguments]});if(this.disableForTestmode||this.dev&&("fetch"!==t.kindHint||"no-cache"===this.requestHeaders["cache-control"]))return null;e=this._getPathname(e,"fetch"===t.kindHint);let o=null,l=t.revalidate,h=await (null==(i=this.cacheHandler)?void 0:i.get(e,t));if((null==h?void 0:null==(s=h.value)?void 0:s.kind)==="FETCH")return[...t.tags||[],...t.softTags||[]].some(e=>{var t;return null==(t=this.revalidatedTags)?void 0:t.includes(e)})?null:(l=l||h.value.revalidate,{isStale:(Date.now()-(h.lastModified||0))/1e3>l,value:{kind:"FETCH",data:h.value.data,revalidate:l},revalidateAfter:Date.now()+1e3*l});let d=this.revalidateTimings.get(ro(e));return(null==h?void 0:h.lastModified)===-1?(n=-1,a=-1*W.BR):n=!!(!1!==(a=this.calculateRevalidate(e,(null==h?void 0:h.lastModified)||Date.now(),this.dev&&"fetch"!==t.kindHint))&&a<Date.now())||void 0,h&&(o={isStale:n,curRevalidate:d,revalidateAfter:a,value:h.value}),!h&&this.prerenderManifest.notFoundRoutes.includes(e)&&(o={isStale:n,value:null,curRevalidate:d,revalidateAfter:a},this.set(e,o.value,t)),o}async set(e,t,i){if(process.env.__NEXT_INCREMENTAL_CACHE_IPC_PORT&&process.env.__NEXT_INCREMENTAL_CACHE_IPC_KEY)return(0,r("./dist/esm/server/lib/server-ipc/request-utils.js").p)({method:"set",ipcPort:process.env.__NEXT_INCREMENTAL_CACHE_IPC_PORT,ipcKey:process.env.__NEXT_INCREMENTAL_CACHE_IPC_KEY,args:[...arguments]});if(this.disableForTestmode||this.dev&&!i.fetchCache)return;let s=JSON.stringify(t).length;if(i.fetchCache&&!this.hasCustomCacheHandler&&s>2097152){if(this.dev)throw Error(`Failed to set Next.js data cache, items over 2MB can not be cached (${s} bytes)`);return}e=this._getPathname(e,i.fetchCache);try{var n;void 0===i.revalidate||i.fetchCache||this.revalidateTimings.set(e,i.revalidate),await (null==(n=this.cacheHandler)?void 0:n.set(e,t,i))}catch(t){console.warn("Failed to update prerender cache for",e,t)}}}let rX=require("http"),rJ=require("https"),rY={existsSync:y().existsSync,readFile:y().promises.readFile,readFileSync:y().readFileSync,writeFile:(e,t)=>y().promises.writeFile(e,t),mkdir:e=>y().promises.mkdir(e,{recursive:!0}),stat:e=>y().promises.stat(e)};class rQ extends rO().Readable{constructor({url:e,headers:t,method:r,socket:i=null,readable:s}){super(),this.httpVersion="1.0",this.httpVersionMajor=1,this.httpVersionMinor=0,this.socket=new Proxy({},{get:(e,t)=>{if("encrypted"!==t&&"remoteAddress"!==t)throw Error("Method not implemented");if("remoteAddress"!==t)return!1}}),this.url=e,this.headers=t,this.method=r,s&&(this.bodyReadable=s,this.bodyReadable.on("end",()=>this.emit("end")),this.bodyReadable.on("close",()=>this.emit("close"))),i&&(this.socket=i)}get headersDistinct(){let e={};for(let[t,r]of Object.entries(this.headers))r&&(e[t]=Array.isArray(r)?r:[r]);return e}_read(e){if(this.bodyReadable)return this.bodyReadable._read(e);this.emit("end"),this.emit("close")}get connection(){return this.socket}get aborted(){throw Error("Method not implemented")}get complete(){throw Error("Method not implemented")}get trailers(){throw Error("Method not implemented")}get trailersDistinct(){throw Error("Method not implemented")}get rawTrailers(){throw Error("Method not implemented")}get rawHeaders(){throw Error("Method not implemented.")}setTimeout(){throw Error("Method not implemented.")}}class rZ extends rO().Writable{constructor(e={}){super(),this.statusMessage="",this.finished=!1,this.headersSent=!1,this.buffers=[],this.statusCode=e.statusCode??200,this.socket=e.socket??null,this.headers=e.headers?eB(e.headers):new Headers,this.headPromise=new Promise(e=>{this.headPromiseResolve=e}),this.hasStreamed=new Promise((e,t)=>{this.on("finish",()=>e(!0)),this.on("end",()=>e(!0)),this.on("error",e=>t(e))}).then(e=>(null==this.headPromiseResolve||this.headPromiseResolve.call(this),e)),e.resWriter&&(this.resWriter=e.resWriter)}appendHeader(e,t){for(let r of Array.isArray(t)?t:[t])this.headers.append(e,r);return this}get isSent(){return this.finished||this.headersSent}get connection(){return this.socket}write(e){return this.resWriter?this.resWriter(e):(this.buffers.push(Buffer.isBuffer(e)?e:Buffer.from(e)),!0)}end(){return this.finished=!0,super.end(...arguments)}_implicitHeader(){}_write(e,t,r){this.write(e),r()}writeHead(e,t,r){if(r||"string"==typeof t?"string"==typeof t&&t.length>0&&(this.statusMessage=t):r=t,r){if(Array.isArray(r))for(let e=0;e<r.length;e+=2)this.setHeader(r[e],r[e+1]);else for(let[e,t]of Object.entries(r))void 0!==t&&this.setHeader(e,t)}return this.statusCode=e,this.headersSent=!0,null==this.headPromiseResolve||this.headPromiseResolve.call(this),this}hasHeader(e){return this.headers.has(e)}getHeader(e){return this.headers.get(e)??void 0}getHeaders(){return eK(this.headers)}getHeaderNames(){return Array.from(this.headers.keys())}setHeader(e,t){if(Array.isArray(t))for(let r of(this.headers.delete(e),t))this.headers.append(e,r);else"number"==typeof t?this.headers.set(e,t.toString()):this.headers.set(e,t);return this}removeHeader(e){this.headers.delete(e)}flushHeaders(){}get strictContentLength(){throw Error("Method not implemented.")}writeEarlyHints(){throw Error("Method not implemented.")}get req(){throw Error("Method not implemented.")}assignSocket(){throw Error("Method not implemented.")}detachSocket(){throw Error("Method not implemented.")}writeContinue(){throw Error("Method not implemented.")}writeProcessing(){throw Error("Method not implemented.")}get upgrading(){throw Error("Method not implemented.")}get chunkedEncoding(){throw Error("Method not implemented.")}get shouldKeepAlive(){throw Error("Method not implemented.")}get useChunkedEncodingByDefault(){throw Error("Method not implemented.")}get sendDate(){throw Error("Method not implemented.")}setTimeout(){throw Error("Method not implemented.")}addTrailers(){throw Error("Method not implemented.")}}class r0{async load(e){return await require(e)}}class r1{static async load(e,t=new r0){let r=await t.load(e);if("routeModule"in r)return r.routeModule;throw Error(`Module "${e}" does not export a routeModule.`)}}let r4=(e,t)=>{let r=w().isAbsolute(t)?t:w().join(e,t);return(0,eP.pathToFileURL)(r).toString()};function r8(e){var t,r;return(null==(r=e.has)?void 0:null==(t=r[0])?void 0:t.key)===X}let r3=e=>import(e).then(e=>e.default||e),r2=require,r6=new WeakMap;class r9 extends rd{constructor(e){super(e),this.handleNextImageRequest=async(e,t,r)=>!!(r.pathname&&r.pathname.startsWith("/_next/image"))&&(t.statusCode=400,t.body("Bad Request").send(),!0),this.handleCatchallRenderRequest=async(e,t,r)=>{let{pathname:i,query:s}=r;if(!i)throw Error("Invariant: pathname is undefined");s._nextBubbleNoFallback="1";try{var n;i=eV(i);let a={i18n:null==(n=this.i18nProvider)?void 0:n.fromQuery(i,s)},o=await this.matchers.match(i,a);if(!o)return await this.render(e,t,i,s,r,!0),!0;for(let i of(C(e,"match",o),this.getEdgeFunctionsPages()))if(i===o.definition.page){if("export"===this.nextConfig.output)return await this.render404(e,t,r),!0;if(delete s._nextBubbleNoFallback,delete s[Y],await this.runEdgeFunction({req:e,res:t,query:s,params:o.params,page:o.definition.page,match:o,appPaths:null}))return!0}if(o.definition.kind===l.PAGES_API){if("export"===this.nextConfig.output)return await this.render404(e,t,r),!0;if(delete s._nextBubbleNoFallback,await this.handleApiRequest(e,t,s,o))return!0}return await this.render(e,t,i,s,r,!0),!0}catch(r){if(r instanceof rl)throw r;try{return this.logError(r),t.statusCode=500,await this.renderError(r,e,t,i,s),!0}catch{}throw r}},this.handleCatchallMiddlewareRequest=async(e,t,r)=>{let i;let s=_(e,"middlewareInvoke");if(!s)return!1;let n=()=>(C(e,"middlewareInvoke",!0),t.body("").send(),!0),a=this.getMiddleware();if(!a)return n();let o=ee(_(e,"initURL")),l=e4(o.pathname,{nextConfig:this.nextConfig,i18nProvider:this.i18nProvider});o.pathname=l.pathname;let h=eV(r.pathname||"");if(!a.match(h,e,o.query))return n();let d=!1;try{if(await this.ensureMiddleware(e.url),i=await this.runMiddleware({request:e,response:t,parsedUrl:o,parsed:r}),"response"in i){if(s){d=!0;let e=Error();throw e.result=i,e.bubble=!0,e}for(let[e,r]of Object.entries(eK(i.response.headers)))"content-encoding"!==e&&void 0!==r&&t.setHeader(e,r);t.statusCode=i.response.status;let{originalResponse:e}=t;return i.response.body?await tu(i.response.body,e):e.end(),!0}}catch(s){if(d)throw s;if(tR(s)&&"ENOENT"===s.code)return await this.render404(e,t,r),!0;if(s instanceof g._9)return t.statusCode=400,await this.renderError(s,e,t,r.pathname||""),!0;let i=tP(s);return console.error(i),t.statusCode=500,await this.renderError(i,e,t,r.pathname||""),!0}return i.finished},this.isDev=e.dev??!1,this.renderOpts.optimizeFonts&&(process.env.__NEXT_OPTIMIZE_FONTS=JSON.stringify(this.renderOpts.optimizeFonts)),this.renderOpts.optimizeCss&&(process.env.__NEXT_OPTIMIZE_CSS=JSON.stringify(!0)),this.renderOpts.nextScriptWorkers&&(process.env.__NEXT_SCRIPT_WORKERS=JSON.stringify(!0)),process.env.NEXT_DEPLOYMENT_ID=this.nextConfig.deploymentId||"";let{appDocumentPreloading:t}=this.nextConfig.experimental;if(e.dev||!0!==t&&void 0===t||(rA({distDir:this.distDir,page:"/_document",isAppPath:!1,isDev:this.isDev}).catch(()=>{}),rA({distDir:this.distDir,page:"/_app",isAppPath:!1,isDev:this.isDev}).catch(()=>{})),!e.dev&&this.nextConfig.experimental.preloadEntriesOnStart&&this.unstable_preloadEntries(),!e.dev){let{dynamicRoutes:e=[]}=this.getRoutesManifest()??{};this.dynamicRoutes=e.map(e=>{let t=tw(e.page);return{match:b(t),page:e.page,re:t.re}})}(function(e){if(!globalThis.__NEXT_HTTP_AGENT){if(!e)throw Error("Expected config.httpAgentOptions to be an object");globalThis.__NEXT_HTTP_AGENT_OPTIONS=e.httpAgentOptions,globalThis.__NEXT_HTTP_AGENT=new rX.Agent(e.httpAgentOptions),globalThis.__NEXT_HTTPS_AGENT=new rJ.Agent(e.httpAgentOptions)}})(this.nextConfig),this.middlewareManifestPath=(0,x.join)(this.serverDistDir,"middleware-manifest.json"),e.dev||this.prepare().catch(e=>{console.error("Failed to prepare server",e)})}async unstable_preloadEntries(){let e=this.getAppPathsManifest();for(let e of Object.keys(this.getPagesManifest()||{}))await rA({distDir:this.distDir,page:e,isAppPath:!1,isDev:this.isDev}).catch(()=>{});for(let t of Object.keys(e||{}))await rA({distDir:this.distDir,page:t,isAppPath:!0,isDev:this.isDev}).then(async({ComponentMod:e})=>{let t=e.__next_app__.require;if(null==t?void 0:t.m)for(let e of Object.keys(t.m))await t(e)}).catch(()=>{})}async handleUpgrade(){}async prepareImpl(){if(await super.prepareImpl(),!this.serverOptions.dev&&this.nextConfig.experimental.instrumentationHook)try{let e=await r2((0,x.resolve)(this.serverOptions.dir||".",this.serverOptions.conf.distDir,"server",W.o$));await (null==e.register?void 0:e.register.call(e))}catch(e){if("MODULE_NOT_FOUND"!==e.code)throw e.message=`An error occurred while loading instrumentation hook: ${e.message}`,e}}loadEnvConfig({dev:e,forceReload:t,silent:r}){(0,rD.loadEnvConfig)(this.dir,e,r?{info:()=>{},error:()=>{}}:h,t)}async getIncrementalCache({requestHeaders:e,requestProtocol:t}){let r;let{cacheHandler:i}=this.nextConfig;return i&&(r=rE(await r3(r4(this.distDir,i)))),new rV({fs:this.getCacheFilesystem(),dev:!1,requestHeaders:e,requestProtocol:t,pagesDir:this.enabledDirectories.pages,appDir:this.enabledDirectories.app,allowedRevalidateHeaderKeys:this.nextConfig.experimental.allowedRevalidateHeaderKeys,minimalMode:!0,serverDistDir:this.serverDistDir,fetchCache:!0,fetchCacheKeyPrefix:this.nextConfig.experimental.fetchCacheKeyPrefix,maxMemoryCacheSize:this.nextConfig.cacheMaxMemorySize,flushToDisk:!1,getPrerenderManifest:()=>this.getPrerenderManifest(),CurCacheHandler:r,experimental:this.renderOpts.experimental})}getResponseCache(){return new rI(!0)}getPublicDir(){return(0,x.join)(this.dir,"public")}getHasStaticDir(){return y().existsSync((0,x.join)(this.dir,"static"))}getPagesManifest(){return rv((0,x.join)(this.serverDistDir,T))}getAppPathsManifest(){if(this.enabledDirectories.app)return rv((0,x.join)(this.serverDistDir,A))}getinterceptionRoutePatterns(){if(!this.enabledDirectories.app)return[];let e=this.getRoutesManifest();return(null==e?void 0:e.rewrites.beforeFiles.filter(r8).map(e=>new RegExp(e.regex)))??[]}async hasPage(e){var t;return!!rx(e,this.distDir,null==(t=this.nextConfig.i18n)?void 0:t.locales,this.enabledDirectories.app)}getBuildId(){let e=(0,x.join)(this.distDir,"BUILD_ID");try{return y().readFileSync(e,"utf8").trim()}catch(e){if("ENOENT"===e.code)throw Error(`Could not find a production build in the '${this.distDir}' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id`);throw e}}getEnabledDirectories(e){let t=e?this.dir:this.serverDistDir;return{app:!!M(t,"app"),pages:!!M(t,"pages")}}sendRenderResult(e,t,r){return Q({req:e.originalRequest,res:t.originalResponse,result:r.result,type:r.type,generateEtags:r.generateEtags,poweredByHeader:r.poweredByHeader,revalidate:r.revalidate,swrDelta:r.swrDelta})}async runApi(e,t,r,i){for(let s of this.getEdgeFunctionsPages())if(s===i.definition.pathname&&await this.runEdgeFunction({req:e,res:t,query:r,params:i.params,page:i.definition.pathname,appPaths:null}))return!0;let s=await r1.load(i.definition.filename);return r={...r,...i.params},delete r.__nextLocale,delete r.__nextDefaultLocale,delete r.__nextInferredLocaleFromDefault,await s.render(e.originalRequest,t.originalResponse,{previewProps:this.renderOpts.previewProps,revalidate:this.revalidate.bind(this),trustHostHeader:this.nextConfig.experimental.trustHostHeader,allowedRevalidateHeaderKeys:this.nextConfig.experimental.allowedRevalidateHeaderKeys,hostname:this.fetchHostname,minimalMode:!0,dev:!1,query:r,params:i.params,page:i.definition.pathname,multiZoneDraftMode:this.nextConfig.experimental.multiZoneDraftMode}),!0}async renderHTML(e,t,r,i,s){return(0,eH.getTracer)().trace(eF.Xy.renderHTML,async()=>this.renderHTMLImpl(e,t,r,i,s))}async renderHTMLImpl(e,t,r,i,s){throw Error("Invariant: renderHTML should not be called in minimal mode")}async imageOptimizer(e,t,r){throw Error("invariant: imageOptimizer should not be called in minimal mode")}getPagePath(e,t){return rw(e,this.distDir,t,this.enabledDirectories.app)}async renderPageComponent(e,t){let r=this.getEdgeFunctionsPages()||[];if(r.length){let t=this.getOriginalAppPaths(e.pathname),i=Array.isArray(t),s=e.pathname;for(let n of(i&&(s=t[0]),r))if(n===s)return await this.runEdgeFunction({req:e.req,res:e.res,query:e.query,params:e.renderOpts.params,page:s,appPaths:t}),null}return super.renderPageComponent(e,t)}async findPageComponents({page:e,query:t,params:r,isAppPath:i,url:s}){return(0,eH.getTracer)().trace(eF.Xy.findPageComponents,{spanName:"resolve page components",attributes:{"next.route":i?eO(e):e}},()=>this.findPageComponentsImpl({page:e,query:t,params:r,isAppPath:i,url:s}))}async findPageComponentsImpl({page:e,query:t,params:r,isAppPath:i,url:s}){let n=[e];for(let s of(t.amp&&n.unshift((i?eO(e):tL(e))+".amp"),t.__nextLocale&&n.unshift(...n.map(e=>`/${t.__nextLocale}${"/"===e?"":e}`)),n))try{let e=await rA({distDir:this.distDir,page:s,isAppPath:i,isDev:this.isDev});if(t.__nextLocale&&"string"==typeof e.Component&&!s.startsWith(`/${t.__nextLocale}`))continue;return{components:e,query:{...!this.renderOpts.isExperimentalCompile&&e.getStaticProps?{amp:t.amp,__nextDataReq:t.__nextDataReq,__nextLocale:t.__nextLocale,__nextDefaultLocale:t.__nextDefaultLocale}:t,...(i?{}:r)||{}}}}catch(e){if(!(e instanceof g.GP))throw e}return null}getFontManifest(){return function(e){let t=w().join(e,D);return rv(w().join(t,"font-manifest.json"))}(this.distDir)}getNextFontManifest(){return rv((0,x.join)(this.distDir,"server","next-font-manifest.json"))}getFallback(e){return e=tL(e),this.getCacheFilesystem().readFile((0,x.join)(this.serverDistDir,"pages",`${e}.html`),"utf8")}async logErrorWithOriginalStack(e,t){throw Error("Invariant: logErrorWithOriginalStack can only be called on the development server")}async ensurePage(e){throw Error("Invariant: ensurePage can only be called on the development server")}async handleApiRequest(e,t,r,i){return this.runApi(e,t,r,i)}getPrefetchRsc(e){return this.getCacheFilesystem().readFile((0,x.join)(this.serverDistDir,"app",`${e}${W.Sx}`),"utf8")}getCacheFilesystem(){return rY}normalizeReq(e){return e instanceof q?e:new q(e)}normalizeRes(e){return e instanceof $?e:new $(e)}getRequestHandler(){return this.makeRequestHandler()}makeRequestHandler(){this.prepare().catch(e=>{console.error("Failed to prepare server",e)});let e=super.getRequestHandler();return(t,r,i)=>{var s;let n=this.normalizeReq(t),a=this.normalizeRes(r),o=null==(s=this.nextConfig.logging)?void 0:s.fetches;return null==o||o.fullUrl,e(n,a,i)}}async revalidate({urlPath:e,revalidateHeaders:t,opts:r}){let i=function({url:e,headers:t={},method:r="GET",bodyReadable:i,resWriter:s,socket:n=null}){return{req:new rQ({url:e,headers:t,method:r,socket:n,readable:i}),res:new rZ({socket:n,resWriter:s})}}({url:e,headers:t}),s=this.getRequestHandler();if(await s(new q(i.req),new $(i.res)),await i.res.hasStreamed,"REVALIDATED"!==i.res.getHeader("x-nextjs-cache")&&!(404===i.res.statusCode&&r.unstable_onlyGenerated))throw Error(`Invalid response ${i.res.statusCode}`)}async render(e,t,r,i,s,n=!1){return super.render(this.normalizeReq(e),this.normalizeRes(t),r,i,s,n)}async renderToHTML(e,t,r,i){return super.renderToHTML(this.normalizeReq(e),this.normalizeRes(t),r,i)}async renderErrorToResponseImpl(e,t){let{req:r,res:i,query:s}=e;return 404===i.statusCode&&this.enabledDirectories.app&&this.getEdgeFunctionsPages().includes(S)?(await this.runEdgeFunction({req:r,res:i,query:s||{},params:{},page:S,appPaths:null}),null):super.renderErrorToResponseImpl(e,t)}async renderError(e,t,r,i,s,n){return super.renderError(e,this.normalizeReq(t),this.normalizeRes(r),i,s,n)}async renderErrorToHTML(e,t,r,i,s){return super.renderErrorToHTML(e,this.normalizeReq(t),this.normalizeRes(r),i,s)}async render404(e,t,r,i){return super.render404(this.normalizeReq(e),this.normalizeRes(t),r,i)}getMiddlewareManifest(){return null}getMiddleware(){var e;let t=this.getMiddlewareManifest(),r=null==t?void 0:null==(e=t.middleware)?void 0:e["/"];if(r)return{match:function(e){var t;let r=r6.get(e);if(r)return r;if(!Array.isArray(e.matchers))throw Error(`Invariant: invalid matchers for middleware ${JSON.stringify(e)}`);let i=(t=e.matchers,(e,r,i)=>{for(let s of t)if(new RegExp(s.regexp).exec(e)&&(!s.has&&!s.missing||t_(r,i,s.has,s.missing)))return!0;return!1});return r6.set(e,i),i}(r),page:"/"}}getEdgeFunctionsPages(){let e=this.getMiddlewareManifest();return e?Object.keys(e.functions):[]}getEdgeFunctionInfo(e){let t;let r=this.getMiddlewareManifest();if(!r)return null;try{t=tp(tL(e.page))}catch(e){return null}let i=e.middleware?r.middleware[t]:r.functions[t];if(!i){if(!e.middleware)throw new g.GP(t);return null}return{name:i.name,paths:i.files.map(e=>(0,x.join)(this.distDir,e)),wasm:(i.wasm??[]).map(e=>({...e,filePath:(0,x.join)(this.distDir,e.filePath)})),assets:i.assets&&i.assets.map(e=>({...e,filePath:(0,x.join)(this.distDir,e.filePath)})),env:i.env}}async hasMiddleware(e){let t=this.getEdgeFunctionInfo({page:e,middleware:!0});return!!(t&&t.paths.length>0)}async ensureMiddleware(e){}async ensureEdgeFunction(e){}async runMiddleware(e){throw Error("invariant: runMiddleware should not be called in minimal mode")}getPrerenderManifest(){var e;return this._cachedPreviewManifest||((this.renderOpts,(null==(e=this.serverOptions)?void 0:e.dev)||"phase-production-build"===process.env.NEXT_PHASE)?this._cachedPreviewManifest={version:4,routes:{},dynamicRoutes:{},notFoundRoutes:[],preview:{previewModeId:r("crypto").randomBytes(16).toString("hex"),previewModeSigningKey:r("crypto").randomBytes(32).toString("hex"),previewModeEncryptionKey:r("crypto").randomBytes(32).toString("hex")}}:this._cachedPreviewManifest=rv((0,x.join)(this.distDir,"prerender-manifest.json"))),this._cachedPreviewManifest}getRoutesManifest(){return(0,eH.getTracer)().trace(eF.Xy.getRoutesManifest,()=>{let e=rv((0,x.join)(this.distDir,"routes-manifest.json")),t=e.rewrites??{beforeFiles:[],afterFiles:[],fallback:[]};return Array.isArray(t)&&(t={beforeFiles:[],afterFiles:t,fallback:[]}),{...e,rewrites:t}})}attachRequestMeta(e,t,r){var i;let s=(null==(i=e.headers["x-forwarded-proto"])?void 0:i.includes("https"))?"https":"http",n=this.fetchHostname&&this.port?`${s}://${this.fetchHostname}:${this.port}${e.url}`:this.nextConfig.experimental.trustHostHeader?`https://${e.headers.host||"localhost"}${e.url}`:e.url;C(e,"initURL",n),C(e,"initQuery",{...t.query}),C(e,"initProtocol",s),r||C(e,"clonableBody",function(e){let t=null,r=new Promise((t,r)=>{e.on("end",t),e.on("error",r)}).catch(e=>({error:e}));return{async finalize(){if(t){let i=await r;if(i&&"object"==typeof i&&i.error)throw i.error;(function(e,t){for(let r in t){let i=t[r];"function"==typeof i&&(i=i.bind(e)),e[r]=i}})(e,t),t=e}},cloneBodyStream(){let r=t??e,i=new rN.PassThrough,s=new rN.PassThrough;return r.on("data",e=>{i.push(e),s.push(e)}),r.on("end",()=>{i.push(null),s.push(null)}),t=s,i}}}(e.body))}async runEdgeFunction(e){throw Error("Middleware is not supported in minimal mode. Please remove the `NEXT_MINIMAL` environment variable.")}get serverDistDir(){if(this._serverDistDir)return this._serverDistDir;let e=(0,x.join)(this.distDir,D);return this._serverDistDir=e,e}async getFallbackErrorComponents(e){return null}}})(),module.exports=i})();
18
18
  //# sourceMappingURL=server.runtime.prod.js.map