next 14.2.17 → 14.2.18

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.
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.17"}`, "-v, --version", "Outputs the Next.js version.");
74
+ }).helpCommand(false).helpOption("-h, --help", "Displays this message.").version(`Next.js v${"14.2.18"}`, "-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"
@@ -354,7 +354,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
354
354
  const nextBuildSpan = (0, _trace.trace)("next-build", undefined, {
355
355
  buildMode: experimentalBuildMode,
356
356
  isTurboBuild: String(turboNextBuild),
357
- version: "14.2.17"
357
+ version: "14.2.18"
358
358
  });
359
359
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
360
360
  _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.17";
132
+ const nextVersion = "14.2.18";
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.17",
1518
+ cacheKey: "14.2.18",
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.17"}|${configVars}`,
1746
+ version: `${__dirname}|${"14.2.18"}|${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.17";
16
+ const version = "14.2.18";
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.17";
65
+ const version = "14.2.18";
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 e9 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 e5=r("./dist/esm/server/web/spec-extension/cookies.js");let e7=Symbol("internal request");class te 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 e2(r,{headers:eG(this.headers),nextConfig:t.nextConfig});this[e7]={cookies:new e5.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[e7].cookies}get geo(){return this[e7].geo}get ip(){return this[e7].ip}get nextUrl(){return this[e7].nextUrl}get page(){throw new e6}get ua(){throw new e9}get url(){return this[e7].url}}let tt="ResponseAborted";class tr extends Error{constructor(...e){super(...e),this.name=tt}}function ti(e){let t=new AbortController;return e.once("close",()=>{e.writableFinished||t.abort(new tr)}),t}class ts{static fromBaseNextRequest(e,t){return"request"in e&&e.request?ts.fromWebNextRequest(e):ts.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 te(r,{method:e.method,headers:eW(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 te(e.url,{method:e.method,headers:eW(e.headers),duplex:"half",signal:e.request.signal,...e.request.signal.aborted?{}:{body:t}})}}class tn{constructor(){let e,t;this.promise=new Promise((r,i)=>{e=r,t=i}),this.resolve=e,this.reject=t}}let ta=0,to=0,tl=0;function th(e){return(null==e?void 0:e.name)==="AbortError"||(null==e?void 0:e.name)===tt}async function td(e,t,r){try{let{errored:i,destroyed:s}=t;if(i||s)return;let n=ti(t),a=function(e,t){let r=!1,i=new tn;function s(){i.resolve()}e.on("drain",s),e.once("close",()=>{e.off("drain",s),i.resolve()});let n=new tn;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===ta?void 0:{clientComponentLoadStart:ta,clientComponentLoadTimes:to,clientComponentLoadCount:tl};return e.reset&&(ta=0,to=0,tl=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,e$.getTracer)().trace(eH.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 tn)}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(th(e))return;throw Error("failed to pipe response",{cause:e})}}class tu{static fromStatic(e){return new tu(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 eU(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(eF),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(ez.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(th(t)){await e.abort(t);return}throw t}}async pipeToNodeResponse(e){await td(this.readable,e,this.waitUntil)}}function tc(e){let t=e.replace(/\\/g,"/");return t.startsWith("/index/")&&!eL(t)?t.slice(6):"/index"!==t?t:"/"}var tp=r("./dist/compiled/path-to-regexp/index.js");function tf(e,t){let r=[],i=(0,tp.Bo)(e,r,{delimiter:"/",sensitive:"boolean"==typeof(null==t?void 0:t.sensitive)&&t.sensitive,strict:null==t?void 0:t.strict}),s=(0,tp.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 tm=/[|\\{}()[\]^$+*?.-]/,tg=/[|\\{}()[\]^$+*?.-]/g;function tv(e){return tm.test(e)?e.replace(tg,"\\$&"):e}function ty(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 tx(e){let{parameterizedRoute:t,groups:r}=function(e){let t=eK(e).slice(1).split("/"),r={},i=1;return{parameterizedRoute:t.map(e=>{let t=eM.find(t=>e.startsWith(t)),s=e.match(/\[((?:\[.*\])|.+)\]/);if(t&&s){let{key:e,optional:n,repeat:a}=ty(s[1]);return r[e]={pos:i++,repeat:a,optional:n},"/"+tv(t)+"([^/]+?)"}if(!s)return"/"+tv(e);{let{key:e,repeat:t,optional:n}=ty(s[1]);return r[e]={pos:i++,repeat:t,optional:n},t?n?"(?:/(.+?))?":"/(.+?)":"/([^/]+?)"}}).join(""),groups:r}}(e);return{re:RegExp("^"+t+"(?:/)?$"),groups:r}}function tw(e){let{interceptionMarker:t,getSafeRouteKey:r,segment:i,routeKeys:s,keyPrefix:n}=e,{key:a,optional:o,repeat:l}=ty(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?tv(t):"";return l?o?"(?:/"+u+"(?<"+h+">.+?))?":"/"+u+"(?<"+h+">.+?)":"/"+u+"(?<"+h+">[^/]+?)"}function tb(e){return e.replace(/__ESC_COLON_/gi,":")}function tE(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 t_(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,tp.MY)("/"+e,{validate:!1})(t).slice(1)}function tC(e){return"object"==typeof e&&null!==e&&"name"in e&&"message"in e}function tR(e){return tC(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 tP{constructor(e){this.provider=e}normalize(e){return this.provider.analyze(e).pathname}}class tS{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 tS),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 tT{constructor(e){this.definition=e,eL(e.pathname)&&(this.dynamic=b(tx(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 tA extends tT{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 tD{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 tn;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 tS;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 tA?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(!eL(e=eD(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 tN{constructor(e=[]){this.normalizers=e}push(e){this.normalizers.push(e)}normalize(e){return this.normalizers.reduce((e,t)=>t.normalize(e),e)}}var tO=r("./dist/esm/shared/lib/isomorphic/path.js"),tM=r.n(tO);class tk{constructor(...e){this.prefix=tM().posix.join(...e)}normalize(e){return tM().posix.join(this.prefix,e)}}function tj(e){let t=/^\/index(\/|$)/.test(e)&&!eL(e)?"/index"+e:"/"===e?"/index":eD(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 tL extends tk{constructor(){super("app")}normalize(e){return super.normalize(tj(e))}}class tI extends tk{constructor(e){super(e,D)}normalize(e){return super.normalize(e)}}function tq(e){return{normalize:e}}!function(e){e.PAGES="pages",e.ROOT="root",e.APP="app"}(o||(o={}));class t${normalize(e){return e.replace(/%5F/g,"_")}}class tH extends tN{constructor(){super([tq(eN),new t$])}normalize(e){return super.normalize(e)}}class tF{constructor(e){this.filename=new tI(e),this.pathname=new tH,this.bundlePath=new tL}}!function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE"}(l||(l={}));class tz extends tT{get identity(){return`${this.definition.pathname}?__nextPage=${this.definition.page}`}}class tU{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 tW extends tU{constructor(e,t){super({load:async()=>t.load(e),compare:(e,t)=>e===t})}}class tB extends tW{constructor(e,t){super(A,t),this.normalizers=new tF(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 tz({kind:l.APP_PAGE,pathname:t,page:r,bundlePath:a,filename:n,appPaths:s}))}return i}}class tG extends tT{}class tK extends tW{constructor(e,t){super(A,t),this.normalizers=new tF(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 tG({kind:l.APP_ROUTE,pathname:s,page:i,bundlePath:n,filename:t}))}return r}}function tV(e){return"/api"===e||!!(null==e?void 0:e.startsWith("/api/"))}class tX extends tT{}class tJ extends tA{}class tY extends tN{constructor(){super([tq(tj),new tk("pages")])}normalize(e){return super.normalize(e)}}class tQ extends tk{constructor(e){super(e,D)}normalize(e){return super.normalize(e)}}class tZ{constructor(e){this.filename=new tQ(e),this.bundlePath=new tY}}class t0 extends tW{constructor(e,t,r){super(T,t),this.i18nProvider=r,this.normalizers=new tZ(e)}async transform(e){let t=Object.keys(e).filter(e=>tV(e)),r=[];for(let i of t)if(this.i18nProvider){let{detectedLocale:t,pathname:s}=this.i18nProvider.analyze(i);r.push(new tJ({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 tX({kind:l.PAGES_API,pathname:i,page:i,bundlePath:this.normalizers.bundlePath.normalize(i),filename:this.normalizers.filename.normalize(e[i])}));return r}}class t1 extends tT{}class t4 extends tA{}class t8 extends tW{constructor(e,t,r){super(T,t),this.i18nProvider=r,this.normalizers=new tZ(e)}async transform(e){let t=Object.keys(e).filter(e=>!tV(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 t4({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 t1({kind:l.PAGES,pathname:i,page:i,bundlePath:this.normalizers.bundlePath.normalize(i),filename:this.normalizers.filename.normalize(e[i])}));return r}}class t3{constructor(e){this.getter=e}load(e){return this.getter(e)}}class t2{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 t6(e,t,r,i){{var s;t.statusCode=r.status,t.statusMessage=r.statusText,null==(s=r.headers)||s.forEach((e,r)=>{if("set-cookie"===r.toLowerCase())for(let i of eB(e))t.appendHeader(r,i);else t.appendHeader(r,e)});let n=t.originalResponse;r.body&&"HEAD"!==e.method?await td(r.body,n,i):n.end()}}require("next/dist/client/components/static-generation-async-storage.external.js"),Symbol.for("next.mutated.cookies");let t9=tf("/_next/data/:path*");class t5{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 t7 extends t5{constructor(){super(W.hd)}}class re{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 rt extends re{constructor(){super("/_next/postponed/resume")}normalize(e,t){return t||this.match(e)?tc(e=super.normalize(e,!0)):e}}class rr extends t5{constructor(){super(W.Vz)}}function ri(e){for(let[t]of J)delete e[t.toLowerCase()]}class rs extends t5{constructor(){super(W.Sx)}}class rn{constructor(e){if(this.suffix=new t5(".json"),!e)throw Error("Invariant: buildID is required");this.prefix=new re(`/_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),tc(e=this.suffix.normalize(e,!0))):e}}function ra(e){return e.replace(/(?:\/index)?\/?$/,"")||"/"}class ro extends Error{}class rl extends Error{constructor(e){super(),this.innerError=e}}class rh{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 ri(e.headers),!1;else return!1;if(e.url){let t=(0,eR.parse)(e.url);t.pathname=r.pathname,e.url=(0,eR.format)(t)}return!1},this.handleNextDataRequest=async(e,t,r)=>{let i=this.getMiddleware(),s=function(e){return"string"==typeof e&&t9(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/")&&!eL(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 eA.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 t2(this.nextConfig.i18n):void 0,this.localeNormalizer=this.i18nProvider?new tP(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 rt:void 0,rsc:this.enabledDirectories.app?new t7:void 0,prefetchRSC:this.enabledDirectories.app&&this.nextConfig.experimental.ppr?new rs:void 0,data:this.enabledDirectories.pages?new rn(this.buildId):void 0,action:this.enabledDirectories.app?new rr: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,eI.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 t3(e=>{switch(e){case T:return this.getPagesManifest()??null;case A:return this.getAppPathsManifest()??null;default:return null}}),t=new tD;return t.push(new t8(this.distDir,e,this.i18nProvider)),t.push(new t0(this.distDir,e,this.i18nProvider)),this.enabledDirectories.app&&(t.push(new tB(this.distDir,e)),t.push(new tK(this.distDir,e))),t}logError(e){this.quiet||ev(e)}async handleRequest(e,t,r){await this.prepare();let i=e.method.toUpperCase(),s=rd(e)?"RSC ":"",n=(0,e$.getTracer)();return n.withPropagatedContext(e.headers,()=>n.trace(eH._J.handleRequest,{spanName:`${s}${i} ${e.url}`,kind:e$.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")!==eH._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,eR.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(eQ(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=e1(P.pathname,{nextConfig:this.nextConfig,i18nProvider:this.i18nProvider});P.pathname=S.pathname,S.basePath&&(e.url=e0(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=tc(i),p=eL(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=eK(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=eM.some(t=>e.startsWith(t)),i=e.match(/\[((?:\[.*\])|.+)\]/);if(r&&i){let[r]=e.split(i[0]);return tw({getSafeRouteKey:s,interceptionMarker:r,segment:i[1],routeKeys:n,keyPrefix:t?"nxtI":void 0})}return i?tw({getSafeRouteKey:s,segment:i[1],routeKeys:n,keyPrefix:t?"nxtP":void 0}):"/"+tv(e)}).join(""),routeKeys:n}}(e,t);return{...tx(e),namedRegex:"^"+r.namedParameterizedRoute+"(?:/)?$",routeKeys:r.routeKeys}}(e,!1)))(e)),{handleRewrites:function(o,h){let d={},u=h.pathname,c=i=>{let c=tf(i.source+(n?"(/)?":""),{removeUnnamedParams:!0,strict:!0,sensitive:!!a})(h.pathname);if((i.has||i.missing)&&c){let e=tE(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(":"+tv(t),"g"),"__ESC_COLON_"+t);let s=ee(i),n=s.query,a=tb(""+s.pathname+(s.hash||"")),o=tb(s.hostname||""),l=[],h=[];(0,tp.Bo)(a,l),(0,tp.Bo)(o,h);let d=[];l.forEach(e=>d.push(e.name)),h.forEach(e=>d.push(e.name));let u=(0,tp.MY)(a,{validate:!1}),c=(0,tp.MY)(o,{validate:!1});for(let[t,r]of Object.entries(n))Array.isArray(r)?n[t]=r.map(t=>t_(tb(t),e.params)):"string"==typeof r&&(n[t]=t_(tb(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(ek(a))for(let t of a.split("/")){let r=eM.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=eZ(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=eK(u||"");return t===eK(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=eO(o)),Array.isArray(o)&&(o=o.map(e=>("string"==typeof e&&(e=eO(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,eR.parse)(e.url,!0);for(let e of(delete t.search,Object.keys(t.query)))(e!==W.dN&&e.startsWith(W.dN)||(r||Object.keys(s.groups)).includes(e))&&delete t.query[e];e.url=(0,eR.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];if(e!==W.dN&&e.startsWith(W.dN)){let i=e.substring(W.dN.length);r.query[i]=t,x.add(i),delete r.query[e]}}if(p){let t={},s=f.normalizeDynamicRouteParams(r.query);if(!s.hasValidParams&&p&&!eL(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"]&&eL(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,eR.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=e1(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=eZ(e0(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=e0(r.pathname,S.basePath)),t.statusCode=200,await this.run(e,t,r)}catch(r){if(r instanceof ro)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=eN(t);e[r]||(e[r]=[]),e[r].push(t)}),e}async run(e,t,r){return(0,e$.getTracer)().trace(eH._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,e$.getTracer)().trace(eH._J.pipe,async()=>this.pipeImpl(e,t))}async pipeImpl(e,t){let r=eq(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,e$.getTracer)().trace(eH._J.render,async()=>this.renderImpl(e,t,r,i,s,n))}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,e$.getTracer)().trace(eH._J.renderToResponseWithComponents,async()=>this.renderToResponseWithComponentsImpl(e,t))}pathCouldBeIntercepted(e){return ek(e)||this.interceptionRoutePatterns.some(t=>t.test(e))}setVaryHeader(e,t,r,i){let s=`RSC, ${K}, ${V}`,n=rd(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="/404"===i,b="/500"===i,E=!0===a.isAppPath,R=!!a.getServerSideProps,S=!!a.getStaticPaths,T=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,A=!!(null==(h=a.Component)?void 0:h.getInitialProps),D=!!a.getStaticProps,N=(0,eR.parse)(e.url||"").pathname||"/",M=_(e,"rewroteURL")||N;this.setVaryHeader(e,t,E,M);let j=!1,L=eL(a.page),I=this.getPrerenderManifest();if(E&&L){let t=await this.getStaticPaths({pathname:i,page:a.page,isAppPath:E,requestHeaders:e.headers});if(v=t.staticPaths,j=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=eK(M);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.`)}j&&(S=!0)}j||(null==v?void 0:v.includes(M))||e.headers["x-now-route-matches"]?D=!0:D||=!!I.routes[ra(i)];let q=!!(o.__nextDataReq||e.headers["x-nextjs-data"]&&this.serverOptions.webServerConfig)&&(D||R),$=("1"===e.headers[V.toLowerCase()]||_(e,"isPrefetchRSCRequest"))??!1;if(!D&&e.headers["x-middleware-prefetch"]&&!(w||"/_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,D&&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 H=rd(e),F=_(e,"postponed"),z=s.experimental.ppr&&H&&!$;if(!w||q||H||(t.statusCode=404),O.includes(i)&&(t.statusCode=parseInt(i.slice(1),10)),!T&&!F&&!w&&!b&&"/_error"!==i&&"HEAD"!==e.method&&"GET"!==e.method&&("string"==typeof a.Component||D))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:tu.fromStatic(a.Component)};if(o.amp||delete o.amp,!0===s.supportsDynamicResponse){let t=eq(e.headers["user-agent"]||""),r="function"!=typeof(null==(p=a.Document)?void 0:p.getInitialProps)||"__NEXT_BUILTIN_DOCUMENT__"in a.Document;s.supportsDynamicResponse=!D&&!t&&!o.amp&&r,s.isBot=t}!q&&E&&s.dev&&(s.supportsDynamicResponse=!0);let U=D?null==(d=this.nextConfig.i18n)?void 0:d.defaultLocale:o.__nextDefaultLocale,K=o.__nextLocale,X=null==(u=this.nextConfig.i18n)?void 0:u.locales,J=!1;if(R||D||E){let{tryGetPreviewData:i}=r("./dist/esm/server/api-utils/node/try-get-preview-data.js");J=!1!==i(e,t,this.renderOpts.previewProps,!!this.nextConfig.experimental.multiZoneDraftMode)}E&&!s.dev&&!J&&D&&H&&!z&&(!((m=s.runtime)===W.Jp.experimentalEdge||m===W.Jp.edge)||this.serverOptions.webServerConfig)&&ri(e.headers);let Y=!1,Q=!1;D&&({isOnDemandRevalidate:Y,revalidateOnlyGenerated:Q}=(0,k.Iq)(e,this.renderOpts.previewProps)),D&&e.headers["x-matched-path"]&&(M=N),N=eK(N),M=eK(M),this.localeNormalizer&&(M=this.localeNormalizer.normalize(M)),q&&(M=this.stripNextDataPath(M),N=this.stripNextDataPath(N));let Z=null;J||!D||s.supportsDynamicResponse||T||F||z||(Z=`${K?`/${K}`:""}${("/"===i||"/"===M)&&K?"":M}${o.amp?".amp":""}`),(w||b)&&D&&(Z=`${K?`/${K}`:""}${i}${o.amp?".amp":""}`),Z&&(Z="/index"===(Z=Z.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?"/":Z);let ee="https:";try{ee=new URL(_(e,"initURL")||"/","http://n").protocol}catch{}let et=globalThis.__incrementalCache||await this.getIncrementalCache({requestHeaders:Object.assign({},e.headers),requestProtocol:ee.substring(0,ee.length-1)});null==et||et.resetRequestCache();let{routeModule:er}=a,ei=!!(this.nextConfig.experimental.ppr&&this.experimentalTestProxy&&o.__nextppronly),es=async({postponed:r})=>{let n,h=!q&&!0===s.dev||!D&&!S||"string"==typeof r||z,d=(0,eR.parse)(e.url||"",!0).query;s.params&&Object.keys(s.params).forEach(e=>{delete d[e]});let u="/"!==N&&this.nextConfig.trailingSlash,c=(0,eR.format)({pathname:`${M}${u?"/":""}`,query:d}),p={...a,...s,...E?{incrementalCache:et,isRevalidate:D&&!r&&!z,originalPathname:a.ComponentMod.originalPathname,serverActions:this.nextConfig.experimental.serverActions}:{},isNextDataRequest:q,resolvedUrl:c,locale:K,locales:X,defaultLocale:U,multiZoneDraftMode:this.nextConfig.experimental.multiZoneDraftMode,resolvedAsPath:R||A?(0,eR.format)({pathname:`${N}${u?"/":""}`,query:d}):c,supportsDynamicResponse:h,isOnDemandRevalidate:Y,isDraftMode:J,isServerAction:T,postponed:r};if(ei&&(h=!1,p.nextExport=!0,p.supportsDynamicResponse=!1,p.isStaticGeneration=!0,p.isRevalidate=!0,p.isDebugPPRSkeleton=!0),er){if(er.definition.kind===l.APP_ROUTE){let r={params:s.params,prerenderManifest:I,renderOpts:{experimental:{ppr:!1},originalPathname:a.ComponentMod.originalPathname,supportsDynamicResponse:h,incrementalCache:et,isRevalidate:D}};try{let i=ts.fromBaseNextRequest(e,function(e){let{errored:t,destroyed:r}=e;if(t||r)return AbortSignal.abort(t??new tr);let{signal:i}=ti(e);return i}(t.originalResponse)),s=await er.handle(i,r);e.fetchMetrics=r.renderOpts.fetchMetrics;let n=r.renderOpts.fetchTags;if(D){var f;let e=await s.blob(),t=eG(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 t6(e,t,s,r.renderOpts.waitUntil),null}catch(r){if(D)throw r;return ev(r),await t6(e,t,new Response(null,{status:500})),null}}else if(er.definition.kind===l.PAGES)p.nextFontManifest=this.nextFontManifest,p.clientReferenceManifest=a.clientReferenceManifest,n=await er.render(e.originalRequest??e,t.originalResponse??t,{page:i,params:s.params,query:o,renderOpts:p});else if(er.definition.kind===l.APP_PAGE){let r=a.routeModule;p.nextFontManifest=this.nextFontManifest,n=await r.render(e.originalRequest??e,t.originalResponse??t,{page:w?"/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,E&&D&&0===m.revalidate&&!p.experimental.ppr){let e=m.staticBailoutInfo,t=Error(`Page changed from static to dynamic at runtime ${N}${(null==e?void 0:e.description)?`, reason: ${e.description}`:""}
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:E?t.statusCode:void 0},revalidate:m.revalidate}},en=await this.responseCache.get(Z,async(r,n,l)=>{r||t.sent,v||({staticPaths:v,fallbackMode:y}=S?await this.getStaticPaths({pathname:i,requestHeaders:e.headers,isAppPath:E,page:a.page}):{staticPaths:void 0,fallbackMode:!1}),"static"===y&&eq(e.headers["user-agent"]||"")&&(y="blocking"),(null==n?void 0:n.isStale)===-1&&(Y=!0),Y&&(!1!==y||n)&&(y="blocking");let h=Z??(s.dev&&E?M:null);h&&o.amp&&(h=h.replace(/\.amp$/,"")),h&&(null==v||v.includes(h)),this.nextConfig.experimental.isExperimentalCompile&&(y="blocking");let d=await es({postponed:Y||l||!F?void 0:F});return d?{...d,revalidate:d.revalidate}:null},{routeKind:null==er?void 0:er.definition.kind,incrementalCache:et,isOnDemandRevalidate:Y,isPrefetch:"prefetch"===e.headers.purpose});if(J&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),!en){if(Z&&!(Y&&Q))throw Error("invariant: cache entry required but not generated");return null}(null==(c=en.value)?void 0:c.kind)==="PAGE"&&en.value.postponed;let{value:ea}=en;if((null==ea?void 0:ea.kind)==="IMAGE")throw Error("invariant SSG should not return an image cache value");if(F)x=0;else if(H&&!$&&s.experimental.ppr)x=0;else if(1){if(J||w&&!q)x=0;else if(D){if(w){let t=_(e,"notFoundRevalidate");x=void 0===t?0:t}else if(b)x=0;else if("number"==typeof en.revalidate){if(en.revalidate<1)throw Error(`Invariant: invalid Cache-Control duration provided: ${en.revalidate} < 1`);x=en.revalidate}else!1===en.revalidate&&(x=W.BR)}else t.getHeader("Cache-Control")||(x=0)}en.revalidate=x;let eo=_(e,"onCacheEntry");if(eo&&await eo(en,{url:_(e,"initURL")}))return null;if(ea){if("REDIRECT"===ea.kind)return(en.revalidate&&!t.getHeader("Cache-Control")&&t.setHeader("Cache-Control",B({revalidate:en.revalidate,swrDelta:this.nextConfig.experimental.swrDelta})),q)?{type:"json",body:tu.fromStatic(JSON.stringify(ea.props)),revalidate:en.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()})(ea.props),null);if("ROUTE"===ea.kind){let r={...ea.headers};return D||delete r[W.Et],await t6(e,t,new Response(ea.body,{headers:eW(r),status:ea.status||200})),null}if(E){if(ea.postponed&&F)throw Error("Invariant: postponed state should not be present on a resume request");if(ea.headers){let e={...ea.headers};for(let[r,i]of(D||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(D&&(null==(f=ea.headers)?void 0:f[W.Et])&&t.setHeader(W.Et,ea.headers[W.Et]),!ea.status||H&&s.experimental.ppr||(t.statusCode=ea.status),ea.postponed&&H&&t.setHeader("x-nextjs-postponed","1"),H&&!J){if("string"!=typeof ea.pageData){if(ea.postponed)throw Error("Invariant: Expected postponed to be undefined");return{type:"rsc",body:ea.html,revalidate:z?0:en.revalidate}}return{type:"rsc",body:tu.fromStatic(ea.pageData),revalidate:en.revalidate}}let e=ea.html;return ea.postponed,{type:"html",body:e,revalidate:en.revalidate}}return q?{type:"json",body:tu.fromStatic(JSON.stringify(ea.pageData)),revalidate:en.revalidate}:{type:"html",body:ea.html,revalidate:en.revalidate}}return(C(e,"notFoundRevalidate",en.revalidate),en.revalidate&&!t.getHeader("Cache-Control")&&t.setHeader("Cache-Control",B({revalidate:en.revalidate,swrDelta:this.nextConfig.experimental.swrDelta})),q)?(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=tc(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,e$.getTracer)().getRootSpanAttributes())||i.set("next.route",n);try{return await this.renderToResponseWithComponents(e,h)}catch(r){let e=r instanceof ro;if(!e||e&&t)throw r}}return!1}async renderToResponse(e){return(0,e$.getTracer)().trace(eH._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=tR(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 ro&&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 rl;if(!i)throw tC(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,e$.getTracer)().trace(eH._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,e$.getTracer)().trace(eH._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,e$.getTracer)().trace(eH._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 rl(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 ro)throw Error("invariant: failed to render error page");throw e}}catch(a){let t=tR(a),s=t instanceof rl;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:tu.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,eR.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 rd(e){return"1"===e.headers.rsc||!!_(e,"isRSCRequest")}var ru=r("./dist/compiled/lru-cache/index.js"),rc=r.n(ru);let rp=require("vm");function rf(e){if(Object.isFrozen(e))return e;if(Array.isArray(e)){for(let t of e)t&&"object"==typeof t&&rf(t);return Object.freeze(e)}for(let t of Object.values(e))t&&"object"==typeof t&&rf(t);return Object.freeze(e)}let rm=new Map;function rg(e,t=!0,r=rm){let i=t&&r.get(e);if(i)return i;let s=JSON.parse((0,v.readFileSync)(e,"utf8"));return t&&(s=rf(s)),t&&r.set(e,s),s}let rv=new(rc())({max:1e3});function ry(e,t,r,i){let s;let n=`${e}:${t}:${r}:${i}`,a=null==rv?void 0:rv.get(n);if(a)return a;let o=w().join(t,D);i&&(s=rg(w().join(o,A),!0));let l=rg(w().join(o,T),!0);try{e=tc(tj(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[eZ(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==rv||rv.set(n,a),a):(null==rv||rv.set(n,null),null)}function rx(e,t,r,i){let s=ry(e,t,r,i);if(!s)throw new g.GP(e);return s}function rw(e,t,r){let i=rx(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 rb(e){return e.default||e}async function rE(e){return new Promise(t=>setTimeout(t,e))}let r_=Symbol.for("next.server.action-manifests");async function rC(e,t=3){for(;;)try{return rg(e)}catch(e){if(--t<=0)throw e;await rE(100)}}async function rR(e,t=3){for(;;)try{return function(e,t=!0,r=rm){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,rp.runInNewContext)(s,n),t&&(n=rf(n)),t&&r.set(e,n),n}(e)}catch(e){if(--t<=0)throw e;await rE(100)}}async function rP(e,t){try{return(await rR(e)).__RSC_MANIFEST[t]}catch(e){return}}async function rS({distDir:e,page:t,isAppPath:r}){let i={},s={};r||([i,s]=await Promise.all([Promise.resolve().then(()=>rw("/_document",e,!1)),Promise.resolve().then(()=>rw("/_app",e,!1))]));let n=r&&(t.endsWith("/page")||t===P),[a,o,l,h]=await Promise.all([rC((0,x.join)(e,"build-manifest.json")),rC((0,x.join)(e,"react-loadable-manifest.json")),n?rP((0,x.join)(e,"server","app",t.replace(/%5F/g,"_")+"_client-reference-manifest.js"),t.replace(/%5F/g,"_")):void 0,r?rC((0,x.join)(e,"server","server-reference-manifest.json")).catch(()=>null):null]);h&&l&&function({clientReferenceManifest:e,serverActionsManifest:t,serverModuleMap:r}){globalThis[r_]={clientReferenceManifest:e,serverActionsManifest:t,serverModuleMap:r}}({clientReferenceManifest:l,serverActionsManifest:h,serverModuleMap:function({serverActionsManifest:e,pageName:t}){return new Proxy({},{get:(r,i)=>({id:e.node[i].workers[eY(t,"app")?t:"app"+t],name:i,chunks:[]})})}({serverActionsManifest:h,pageName:t})});let d=await Promise.resolve().then(()=>rw(t,e,r)),u=rb(d),c=rb(i),p=rb(s),{getServerSideProps:f,getStaticProps:m,getStaticPaths:g,routeModule:v}=d;return{App:p,Document:c,Component:u,buildManifest:a,reactLoadableManifest:o,pageConfig:d.config||{},ComponentMod:d,getServerSideProps:f,getStaticProps:m,getStaticPaths:g,clientReferenceManifest:l,serverActionsManifest:h,isAppPath:r,page:t,routeModule:v}}let rT=(0,e$.getTracer)().wrap(eH.qj.loadComponents,rS);var rA=r("../next-env/dist/index.js");let rD=require("stream");var rN=r.n(rD);class rO{constructor(e,t=e=>e()){this.cacheKeyFn=e,this.schedulerFn=t,this.pending=new Map}static create(e){return new rO(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 tn;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 rM=e=>{Promise.resolve().then(()=>{process.nextTick(e)})};async function rk(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 rj(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:tu.fromStatic(e.value.html),pageData:e.value.pageData,postponed:e.value.postponed,headers:e.value.headers,status:e.value.status}:e.value}}class rL{constructor(e){this.batcher=rO.create({cacheKeyFn:({key:e,isOnDemandRevalidate:t})=>`${e}-${t?"1":"0"}`,schedulerFn:rM}),this.minimalMode=e}async get(e,t,r){if(!e)return t(!1,null);let{incrementalCache:i,isOnDemandRevalidate:s=!1}=r;return rj(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 rk({...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 rI=0,rq="x-vercel-cache-tags",r$="x-vercel-sc-headers",rH="x-vercel-revalidate",rF="x-vercel-cache-item-name",rz=!!process.env.NEXT_PRIVATE_DEBUG_CACHE;async function rU(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 rz&&console.log(`Fetch failed for ${e} retry ${r}`),rU(e,t,r+1);throw i}).finally(()=>{clearTimeout(s)})}class rW{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",r$ in t._requestHeaders){let e=JSON.parse(t._requestHeaders[r$]);for(let t in e)this.headers[t]=e[t];delete t._requestHeaders[r$]}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||""}`,rz&&console.log("using cache endpoint",this.cacheEndpoint)}else rz&&console.log("no cache endpoint available");t.maxMemoryCacheSize?e||(rz&&console.log("using memory store for fetch cache"),e=new(rc())({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)}})):rz&&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,rz&&console.log("revalidateTag",t),t.length){if(Date.now()<rI){rz&&console.log("rate limited ",rI);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 rU(`${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";rI=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()<rI)return rz&&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,[rF]:h,[rq]:(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";rI=Date.now()+parseInt(e)}if(404===r.status)return rz&&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 rz&&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)},rz&&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){rz&&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()<rI){rz&&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[rH]=i.revalidate.toString()),!this.headers[rH]&&null!==i&&"data"in i&&(this.headers["x-vercel-cache-control"]=i.data.headers["cache-control"]);let t=JSON.stringify({...i,tags:void 0});rz&&console.log("set cache",r);let s=await fetch(`${this.cacheEndpoint}/v1/suspense-cache/${r}`,{method:"POST",headers:{...this.headers,[rF]:o||"",[rq]:(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";rI=Date.now()+parseInt(e)}if(!s.ok)throw rz&&console.log(await s.text()),Error(`invalid response ${s.status}`);rz&&console.log(`successfully set to fetch-cache for ${r}, duration: ${Date.now()-e}ms, size: ${t.length}`)}catch(e){rz&&console.error("Failed to update fetch cache",e)}}}}class rB{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(rc())({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=tM().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(tM().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(tM().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(tM().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(tM().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 tM().join(this.serverDistDir,"..","cache","fetch-cache",e);case"pages":return tM().join(this.serverDistDir,"pages",e);case"app":return tM().join(this.serverDistDir,"app",e);default:throw Error("Invariant: Can't determine file path kind")}}}class rG{static #e=this.timings=new Map;constructor(e){this.prerenderManifest=e}get(e){var t;let r=rG.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){rG.timings.set(e,t)}clear(){rG.timings.clear()}}class rK{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=rB),rW.isAvailable({_requestHeaders:l})&&a&&n&&(w&&console.log("using fetch cache handler"),p=rW)),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 rG(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(ra(e))??1;return"number"==typeof i?1e3*i+t:i}_getPathname(e,t){return t?e:tj(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(ra(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 rV=require("http"),rX=require("https"),rJ={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 rY extends rN().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 rQ extends rN().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?eW(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 eG(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 rZ{async load(e){return await require(e)}}class r0{static async load(e,t=new rZ){let r=await t.load(e);if("routeModule"in r)return r.routeModule;throw Error(`Module "${e}" does not export a routeModule.`)}}let r1=(e,t)=>{let r=w().isAbsolute(t)?t:w().join(e,t);return(0,eR.pathToFileURL)(r).toString()};function r4(e){var t,r;return(null==(r=e.has)?void 0:null==(t=r[0])?void 0:t.key)===X}let r8=e=>import(e).then(e=>e.default||e),r3=require,r2=new WeakMap;class r6 extends rh{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=eK(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 ro)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=e1(o.pathname,{nextConfig:this.nextConfig,i18nProvider:this.i18nProvider});o.pathname=l.pathname;let h=eK(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(eG(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 td(i.response.body,e):e.end(),!0}}catch(s){if(d)throw s;if(tC(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=tR(s);return console.error(i),t.statusCode=500,await this.renderError(i,e,t,r.pathname||""),!0}return i.finished},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||(rT({distDir:this.distDir,page:"/_document",isAppPath:!1}).catch(()=>{}),rT({distDir:this.distDir,page:"/_app",isAppPath:!1}).catch(()=>{})),!e.dev&&this.nextConfig.experimental.preloadEntriesOnStart&&this.unstable_preloadEntries(),!e.dev){let{dynamicRoutes:e=[]}=this.getRoutesManifest()??{};this.dynamicRoutes=e.map(e=>{let t=tx(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 rV.Agent(e.httpAgentOptions),globalThis.__NEXT_HTTPS_AGENT=new rX.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 rT({distDir:this.distDir,page:e,isAppPath:!1}).catch(()=>{});for(let t of Object.keys(e||{}))await rT({distDir:this.distDir,page:t,isAppPath:!0}).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 r3((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,rA.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=rb(await r8(r1(this.distDir,i)))),new rK({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 rL(!0)}getPublicDir(){return(0,x.join)(this.dir,"public")}getHasStaticDir(){return y().existsSync((0,x.join)(this.dir,"static"))}getPagesManifest(){return rg((0,x.join)(this.serverDistDir,T))}getAppPathsManifest(){if(this.enabledDirectories.app)return rg((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(r4).map(e=>new RegExp(e.regex)))??[]}async hasPage(e){var t;return!!ry(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 r0.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,e$.getTracer)().trace(eH.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 rx(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,e$.getTracer)().trace(eH.Xy.findPageComponents,{spanName:"resolve page components",attributes:{"next.route":i?eN(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?eN(e):tj(e))+".amp"),t.__nextLocale&&n.unshift(...n.map(e=>`/${t.__nextLocale}${"/"===e?"":e}`)),n))try{let e=await rT({distDir:this.distDir,page:s,isAppPath:i});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 rg(w().join(t,"font-manifest.json"))}(this.distDir)}getNextFontManifest(){return rg((0,x.join)(this.distDir,"server","next-font-manifest.json"))}getFallback(e){return e=tj(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 rJ}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 rY({url:e,headers:t,method:r,socket:n,readable:i}),res:new rQ({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=r2.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||tE(r,i,s.has,s.missing)))return!0;return!1});return r2.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=tc(tj(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=rg((0,x.join)(this.distDir,"prerender-manifest.json"))),this._cachedPreviewManifest}getRoutesManifest(){return(0,e$.getTracer)().trace(eH.Xy.getRoutesManifest,()=>{let e=rg((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 rD.PassThrough,s=new rD.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})();
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 eA.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 t2(this.nextConfig.i18n):void 0,this.localeNormalizer=this.i18nProvider?new tP(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 rt:void 0,rsc:this.enabledDirectories.app?new t7:void 0,prefetchRSC:this.enabledDirectories.app&&this.nextConfig.experimental.ppr?new rs:void 0,data:this.enabledDirectories.pages?new rn(this.buildId):void 0,action:this.enabledDirectories.app?new rr: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,eI.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 t3(e=>{switch(e){case T:return this.getPagesManifest()??null;case A:return this.getAppPathsManifest()??null;default:return null}}),t=new tD;return t.push(new t8(this.distDir,e,this.i18nProvider)),t.push(new t0(this.distDir,e,this.i18nProvider)),this.enabledDirectories.app&&(t.push(new tB(this.distDir,e)),t.push(new tK(this.distDir,e))),t}logError(e){this.quiet||ev(e)}async handleRequest(e,t,r){await this.prepare();let i=e.method.toUpperCase(),s=rd(e)?"RSC ":"",n=(0,e$.getTracer)();return n.withPropagatedContext(e.headers,()=>n.trace(eH._J.handleRequest,{spanName:`${s}${i} ${e.url}`,kind:e$.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")!==eH._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,eR.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(eQ(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=e1(P.pathname,{nextConfig:this.nextConfig,i18nProvider:this.i18nProvider});P.pathname=S.pathname,S.basePath&&(e.url=e0(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=tc(i),p=eL(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=eK(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=eM.some(t=>e.startsWith(t)),i=e.match(/\[((?:\[.*\])|.+)\]/);if(r&&i){let[r]=e.split(i[0]);return tw({getSafeRouteKey:s,interceptionMarker:r,segment:i[1],routeKeys:n,keyPrefix:t?"nxtI":void 0})}return i?tw({getSafeRouteKey:s,segment:i[1],routeKeys:n,keyPrefix:t?"nxtP":void 0}):"/"+tv(e)}).join(""),routeKeys:n}}(e,t);return{...tx(e),namedRegex:"^"+r.namedParameterizedRoute+"(?:/)?$",routeKeys:r.routeKeys}}(e,!1)))(e)),{handleRewrites:function(o,h){let d={},u=h.pathname,c=i=>{let c=tf(i.source+(n?"(/)?":""),{removeUnnamedParams:!0,strict:!0,sensitive:!!a})(h.pathname);if((i.has||i.missing)&&c){let e=tE(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(":"+tv(t),"g"),"__ESC_COLON_"+t);let s=ee(i),n=s.query,a=tb(""+s.pathname+(s.hash||"")),o=tb(s.hostname||""),l=[],h=[];(0,tp.Bo)(a,l),(0,tp.Bo)(o,h);let d=[];l.forEach(e=>d.push(e.name)),h.forEach(e=>d.push(e.name));let u=(0,tp.MY)(a,{validate:!1}),c=(0,tp.MY)(o,{validate:!1});for(let[t,r]of Object.entries(n))Array.isArray(r)?n[t]=r.map(t=>t_(tb(t),e.params)):"string"==typeof r&&(n[t]=t_(tb(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(ek(a))for(let t of a.split("/")){let r=eM.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=eZ(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=eK(u||"");return t===eK(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=eO(o)),Array.isArray(o)&&(o=o.map(e=>("string"==typeof e&&(e=eO(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,eR.parse)(e.url,!0);for(let e of(delete t.search,Object.keys(t.query)))(e!==W.dN&&e.startsWith(W.dN)||(r||Object.keys(s.groups)).includes(e))&&delete t.query[e];e.url=(0,eR.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];if(e!==W.dN&&e.startsWith(W.dN)){let i=e.substring(W.dN.length);r.query[i]=t,x.add(i),delete r.query[e]}}if(p){let t={},s=f.normalizeDynamicRouteParams(r.query);if(!s.hasValidParams&&p&&!eL(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"]&&eL(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,eR.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=e1(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=eZ(e0(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=e0(r.pathname,S.basePath)),t.statusCode=200,await this.run(e,t,r)}catch(r){if(r instanceof ro)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=eN(t);e[r]||(e[r]=[]),e[r].push(t)}),e}async run(e,t,r){return(0,e$.getTracer)().trace(eH._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,e$.getTracer)().trace(eH._J.pipe,async()=>this.pipeImpl(e,t))}async pipeImpl(e,t){let r=eq(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,e$.getTracer)().trace(eH._J.render,async()=>this.renderImpl(e,t,r,i,s,n))}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,e$.getTracer)().trace(eH._J.renderToResponseWithComponents,async()=>this.renderToResponseWithComponentsImpl(e,t))}pathCouldBeIntercepted(e){return ek(e)||this.interceptionRoutePatterns.some(t=>t.test(e))}setVaryHeader(e,t,r,i){let s=`RSC, ${K}, ${V}`,n=rd(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,eR.parse)(e.url||"").pathname||"/",j=_(e,"rewroteURL")||M;this.setVaryHeader(e,t,R,j);let L=!1,I=eL(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=eK(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[ra(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=rd(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:tu.fromStatic(a.Component)};if(o.amp||delete o.amp,!0===s.supportsDynamicResponse){let t=eq(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)&&ri(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=eK(M),j=eK(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,eR.parse)(e.url||"",!0).query;s.params&&Object.keys(s.params).forEach(e=>{delete d[e]});let u="/"!==M&&this.nextConfig.trailingSlash,c=(0,eR.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,eR.format)({pathname:`${M}${u?"/":""}`,query:d}):c,supportsDynamicResponse:h,isOnDemandRevalidate:Q,isDraftMode:Y,isServerAction:A,postponed:r};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}};try{let i=ts.fromBaseNextRequest(e,function(e){let{errored:t,destroyed:r}=e;if(t||r)return AbortSignal.abort(t??new tr);let{signal:i}=ti(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=eG(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 t6(e,t,s,r.renderOpts.waitUntil),null}catch(r){if(N)throw r;return ev(r),await t6(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
+ 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&&eq(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:tu.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 t6(e,t,new Response(eo.body,{headers:eW(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:tu.fromStatic(eo.pageData),revalidate:ea.revalidate}}let e=eo.html;return eo.postponed,{type:"html",body:e,revalidate:ea.revalidate}}return $?{type:"json",body:tu.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=tc(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,e$.getTracer)().getRootSpanAttributes())||i.set("next.route",n);try{return await this.renderToResponseWithComponents(e,h)}catch(r){let e=r instanceof ro;if(!e||e&&t)throw r}}return!1}async renderToResponse(e){return(0,e$.getTracer)().trace(eH._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=tR(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 ro&&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 rl;if(!i)throw tC(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,e$.getTracer)().trace(eH._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,e$.getTracer)().trace(eH._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,e$.getTracer)().trace(eH._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 rl(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 ro)throw Error("invariant: failed to render error page");throw e}}catch(a){let t=tR(a),s=t instanceof rl;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:tu.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,eR.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 rd(e){return"1"===e.headers.rsc||!!_(e,"isRSCRequest")}var ru=r("./dist/compiled/lru-cache/index.js"),rc=r.n(ru);let rp=require("vm");function rf(e){if(Object.isFrozen(e))return e;if(Array.isArray(e)){for(let t of e)t&&"object"==typeof t&&rf(t);return Object.freeze(e)}for(let t of Object.values(e))t&&"object"==typeof t&&rf(t);return Object.freeze(e)}let rm=new Map;function rg(e,t=!0,r=rm){let i=t&&r.get(e);if(i)return i;let s=JSON.parse((0,v.readFileSync)(e,"utf8"));return t&&(s=rf(s)),t&&r.set(e,s),s}let rv=new(rc())({max:1e3});function ry(e,t,r,i){let s;let n=`${e}:${t}:${r}:${i}`,a=null==rv?void 0:rv.get(n);if(a)return a;let o=w().join(t,D);i&&(s=rg(w().join(o,A),!0));let l=rg(w().join(o,T),!0);try{e=tc(tj(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[eZ(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==rv||rv.set(n,a),a):(null==rv||rv.set(n,null),null)}function rx(e,t,r,i){let s=ry(e,t,r,i);if(!s)throw new g.GP(e);return s}function rw(e,t,r){let i=rx(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 rb(e){return e.default||e}async function rE(e){return new Promise(t=>setTimeout(t,e))}let r_=Symbol.for("next.server.action-manifests");async function rC(e,t=3){for(;;)try{return rg(e)}catch(e){if(--t<=0)throw e;await rE(100)}}async function rR(e,t=3){for(;;)try{return function(e,t=!0,r=rm){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,rp.runInNewContext)(s,n),t&&(n=rf(n)),t&&r.set(e,n),n}(e)}catch(e){if(--t<=0)throw e;await rE(100)}}async function rP(e,t){try{return(await rR(e)).__RSC_MANIFEST[t]}catch(e){return}}async function rS({distDir:e,page:t,isAppPath:r}){let i={},s={};r||([i,s]=await Promise.all([Promise.resolve().then(()=>rw("/_document",e,!1)),Promise.resolve().then(()=>rw("/_app",e,!1))]));let n=r&&(t.endsWith("/page")||t===P),[a,o,l,h]=await Promise.all([rC((0,x.join)(e,"build-manifest.json")),rC((0,x.join)(e,"react-loadable-manifest.json")),n?rP((0,x.join)(e,"server","app",t.replace(/%5F/g,"_")+"_client-reference-manifest.js"),t.replace(/%5F/g,"_")):void 0,r?rC((0,x.join)(e,"server","server-reference-manifest.json")).catch(()=>null):null]);h&&l&&function({clientReferenceManifest:e,serverActionsManifest:t,serverModuleMap:r}){globalThis[r_]={clientReferenceManifest:e,serverActionsManifest:t,serverModuleMap:r}}({clientReferenceManifest:l,serverActionsManifest:h,serverModuleMap:function({serverActionsManifest:e,pageName:t}){return new Proxy({},{get:(r,i)=>({id:e.node[i].workers[eY(t,"app")?t:"app"+t],name:i,chunks:[]})})}({serverActionsManifest:h,pageName:t})});let d=await Promise.resolve().then(()=>rw(t,e,r)),u=rb(d),c=rb(i),p=rb(s),{getServerSideProps:f,getStaticProps:m,getStaticPaths:g,routeModule:v}=d;return{App:p,Document:c,Component:u,buildManifest:a,reactLoadableManifest:o,pageConfig:d.config||{},ComponentMod:d,getServerSideProps:f,getStaticProps:m,getStaticPaths:g,clientReferenceManifest:l,serverActionsManifest:h,isAppPath:r,page:t,routeModule:v}}let rT=(0,e$.getTracer)().wrap(eH.qj.loadComponents,rS);var rA=r("../next-env/dist/index.js");let rD=require("stream");var rN=r.n(rD);class rO{constructor(e,t=e=>e()){this.cacheKeyFn=e,this.schedulerFn=t,this.pending=new Map}static create(e){return new rO(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 tn;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 rM=e=>{Promise.resolve().then(()=>{process.nextTick(e)})};async function rk(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 rj(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:tu.fromStatic(e.value.html),pageData:e.value.pageData,postponed:e.value.postponed,headers:e.value.headers,status:e.value.status}:e.value}}class rL{constructor(e){this.batcher=rO.create({cacheKeyFn:({key:e,isOnDemandRevalidate:t})=>`${e}-${t?"1":"0"}`,schedulerFn:rM}),this.minimalMode=e}async get(e,t,r){if(!e)return t(!1,null);let{incrementalCache:i,isOnDemandRevalidate:s=!1}=r;return rj(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 rk({...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 rI=0,rq="x-vercel-cache-tags",r$="x-vercel-sc-headers",rH="x-vercel-revalidate",rF="x-vercel-cache-item-name",rz=!!process.env.NEXT_PRIVATE_DEBUG_CACHE;async function rU(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 rz&&console.log(`Fetch failed for ${e} retry ${r}`),rU(e,t,r+1);throw i}).finally(()=>{clearTimeout(s)})}class rW{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",r$ in t._requestHeaders){let e=JSON.parse(t._requestHeaders[r$]);for(let t in e)this.headers[t]=e[t];delete t._requestHeaders[r$]}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||""}`,rz&&console.log("using cache endpoint",this.cacheEndpoint)}else rz&&console.log("no cache endpoint available");t.maxMemoryCacheSize?e||(rz&&console.log("using memory store for fetch cache"),e=new(rc())({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)}})):rz&&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,rz&&console.log("revalidateTag",t),t.length){if(Date.now()<rI){rz&&console.log("rate limited ",rI);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 rU(`${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";rI=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()<rI)return rz&&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,[rF]:h,[rq]:(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";rI=Date.now()+parseInt(e)}if(404===r.status)return rz&&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 rz&&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)},rz&&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){rz&&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()<rI){rz&&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[rH]=i.revalidate.toString()),!this.headers[rH]&&null!==i&&"data"in i&&(this.headers["x-vercel-cache-control"]=i.data.headers["cache-control"]);let t=JSON.stringify({...i,tags:void 0});rz&&console.log("set cache",r);let s=await fetch(`${this.cacheEndpoint}/v1/suspense-cache/${r}`,{method:"POST",headers:{...this.headers,[rF]:o||"",[rq]:(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";rI=Date.now()+parseInt(e)}if(!s.ok)throw rz&&console.log(await s.text()),Error(`invalid response ${s.status}`);rz&&console.log(`successfully set to fetch-cache for ${r}, duration: ${Date.now()-e}ms, size: ${t.length}`)}catch(e){rz&&console.error("Failed to update fetch cache",e)}}}}class rB{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(rc())({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=tM().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(tM().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(tM().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(tM().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(tM().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 tM().join(this.serverDistDir,"..","cache","fetch-cache",e);case"pages":return tM().join(this.serverDistDir,"pages",e);case"app":return tM().join(this.serverDistDir,"app",e);default:throw Error("Invariant: Can't determine file path kind")}}}class rG{static #e=this.timings=new Map;constructor(e){this.prerenderManifest=e}get(e){var t;let r=rG.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){rG.timings.set(e,t)}clear(){rG.timings.clear()}}class rK{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=rB),rW.isAvailable({_requestHeaders:l})&&a&&n&&(w&&console.log("using fetch cache handler"),p=rW)),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 rG(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(ra(e))??1;return"number"==typeof i?1e3*i+t:i}_getPathname(e,t){return t?e:tj(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(ra(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 rV=require("http"),rX=require("https"),rJ={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 rY extends rN().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 rQ extends rN().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?eW(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 eG(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 rZ{async load(e){return await require(e)}}class r0{static async load(e,t=new rZ){let r=await t.load(e);if("routeModule"in r)return r.routeModule;throw Error(`Module "${e}" does not export a routeModule.`)}}let r1=(e,t)=>{let r=w().isAbsolute(t)?t:w().join(e,t);return(0,eR.pathToFileURL)(r).toString()};function r4(e){var t,r;return(null==(r=e.has)?void 0:null==(t=r[0])?void 0:t.key)===X}let r8=e=>import(e).then(e=>e.default||e),r3=require,r2=new WeakMap;class r6 extends rh{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=eK(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 ro)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=e1(o.pathname,{nextConfig:this.nextConfig,i18nProvider:this.i18nProvider});o.pathname=l.pathname;let h=eK(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(eG(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 td(i.response.body,e):e.end(),!0}}catch(s){if(d)throw s;if(tC(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=tR(s);return console.error(i),t.statusCode=500,await this.renderError(i,e,t,r.pathname||""),!0}return i.finished},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||(rT({distDir:this.distDir,page:"/_document",isAppPath:!1}).catch(()=>{}),rT({distDir:this.distDir,page:"/_app",isAppPath:!1}).catch(()=>{})),!e.dev&&this.nextConfig.experimental.preloadEntriesOnStart&&this.unstable_preloadEntries(),!e.dev){let{dynamicRoutes:e=[]}=this.getRoutesManifest()??{};this.dynamicRoutes=e.map(e=>{let t=tx(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 rV.Agent(e.httpAgentOptions),globalThis.__NEXT_HTTPS_AGENT=new rX.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 rT({distDir:this.distDir,page:e,isAppPath:!1}).catch(()=>{});for(let t of Object.keys(e||{}))await rT({distDir:this.distDir,page:t,isAppPath:!0}).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 r3((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,rA.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=rb(await r8(r1(this.distDir,i)))),new rK({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 rL(!0)}getPublicDir(){return(0,x.join)(this.dir,"public")}getHasStaticDir(){return y().existsSync((0,x.join)(this.dir,"static"))}getPagesManifest(){return rg((0,x.join)(this.serverDistDir,T))}getAppPathsManifest(){if(this.enabledDirectories.app)return rg((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(r4).map(e=>new RegExp(e.regex)))??[]}async hasPage(e){var t;return!!ry(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 r0.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,e$.getTracer)().trace(eH.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 rx(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,e$.getTracer)().trace(eH.Xy.findPageComponents,{spanName:"resolve page components",attributes:{"next.route":i?eN(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?eN(e):tj(e))+".amp"),t.__nextLocale&&n.unshift(...n.map(e=>`/${t.__nextLocale}${"/"===e?"":e}`)),n))try{let e=await rT({distDir:this.distDir,page:s,isAppPath:i});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 rg(w().join(t,"font-manifest.json"))}(this.distDir)}getNextFontManifest(){return rg((0,x.join)(this.distDir,"server","next-font-manifest.json"))}getFallback(e){return e=tj(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 rJ}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 rY({url:e,headers:t,method:r,socket:n,readable:i}),res:new rQ({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=r2.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||tE(r,i,s.has,s.missing)))return!0;return!1});return r2.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=tc(tj(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=rg((0,x.join)(this.distDir,"prerender-manifest.json"))),this._cachedPreviewManifest}getRoutesManifest(){return(0,e$.getTracer)().trace(eH.Xy.getRoutesManifest,()=>{let e=rg((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 rD.PassThrough,s=new rD.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