next 15.2.0-canary.62 → 15.2.0-canary.63

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.

Potentially problematic release.


This version of next might be problematic. Click here for more details.

@@ -28,6 +28,6 @@
28
28
  `)}}class tN extends Error{constructor(){super(`The request.ua has been removed in favour of \`userAgent\` function.
29
29
  Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent
30
30
  `)}}var tk=r("./dist/esm/server/web/spec-extension/cookies.js");let tI=Symbol("internal request");class tM extends Request{constructor(e,t={}){let r="string"!=typeof e&&"url"in e?e.url:String(e);tg(r),e instanceof Request?super(e,t):super(r,t);let n=new tD(r,{headers:tm(this.headers),nextConfig:t.nextConfig});this[tI]={cookies:new tk.tm(this.headers),nextUrl:n,url:process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE?r:n.toString()}}[Symbol.for("edge-runtime.inspect.custom")](){return{cookies:this.cookies,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[tI].cookies}get nextUrl(){return this[tI].nextUrl}get page(){throw new tj}get ua(){throw new tN}get url(){return this[tI].url}}let tq=e=>!0,tL=e=>!0,t$="ResponseAborted";class tH extends Error{constructor(...e){super(...e),this.name=t$}}function tF(e){let t=new AbortController;return e.once("close",()=>{e.writableFinished||t.abort(new tH)}),t}class tz{static fromBaseNextRequest(e,t){if(tq(e))return tz.fromNodeNextRequest(e,t);throw Object.defineProperty(Error("Invariant: Unsupported NextRequest type"),"__NEXT_ERROR_CODE",{value:"E345",enumerable:!1,configurable:!0})}static fromNodeNextRequest(e,t){let r,n=null;if("GET"!==e.method&&"HEAD"!==e.method&&e.body&&(n=e.body),e.url.startsWith("http"))r=new URL(e.url);else{let t=er(e,"initURL");r=t&&t.startsWith("http")?new URL(e.url,t):new URL(e.url,"http://n")}return new tM(r,{method:e.method,headers:tp(e.headers),duplex:"half",signal:t,...t.aborted?{}:{body:n}})}static fromWebNextRequest(e){let t=null;return"GET"!==e.method&&"HEAD"!==e.method&&(t=e.body),new tM(e.url,{method:e.method,headers:tp(e.headers),duplex:"half",signal:e.request.signal,...e.request.signal.aborted?{}:{body:t}})}}let tU=0,tW=0,tX=0;function tB(e){return(null==e?void 0:e.name)==="AbortError"||(null==e?void 0:e.name)===t$}async function tG(e,t,r){try{let{errored:n,destroyed:i}=t;if(n||i)return;let a=tF(t),s=function(e,t){let r=!1,n=new tn;function i(){n.resolve()}e.on("drain",i),e.once("close",()=>{e.off("drain",i),n.resolve()});let a=new tn;return e.once("finish",()=>{a.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===tU?void 0:{clientComponentLoadStart:tU,clientComponentLoadTimes:tW,clientComponentLoadCount:tX};return e.reset&&(tU=0,tW=0,tX=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,ts.getTracer)().trace(to.Fx.startResponse,{spanName:"start response"},()=>void 0)}try{let r=e.write(t);"flush"in e&&"function"==typeof e.flush&&e.flush(),r||(await n.promise,n=new tn)}catch(t){throw e.end(),Object.defineProperty(Error("failed to write chunk to response",{cause:t}),"__NEXT_ERROR_CODE",{value:"E321",enumerable:!1,configurable:!0})}},abort:t=>{e.writableFinished||e.destroy(t)},close:async()=>{if(t&&await t,!e.writableFinished)return e.end(),a.promise}})}(t,r);await e.pipeTo(s,{signal:a.signal})}catch(e){if(tB(e))return;throw Object.defineProperty(Error("failed to pipe response",{cause:e}),"__NEXT_ERROR_CODE",{value:"E180",enumerable:!1,configurable:!0})}}class tV{static fromStatic(e){return new tV(e,{metadata:{}})}constructor(e,{contentType:t,waitUntil:r,metadata:n}){this.response=e,this.contentType=t,this.metadata=n,this.waitUntil=r}assignMetadata(e){Object.assign(this.metadata,e)}get isNull(){return null===this.response}get isDynamic(){return"string"!=typeof this.response}toUnchunkedBuffer(e=!1){if(null===this.response)throw Object.defineProperty(Error("Invariant: null responses cannot be unchunked"),"__NEXT_ERROR_CODE",{value:"E274",enumerable:!1,configurable:!0});if("string"!=typeof this.response){if(!e)throw Object.defineProperty(Error("Invariant: dynamic responses cannot be unchunked. This is a bug in Next.js"),"__NEXT_ERROR_CODE",{value:"E81",enumerable:!1,configurable:!0});return tc(this.readable)}return Buffer.from(this.response)}toUnchunkedString(e=!1){if(null===this.response)throw Object.defineProperty(Error("Invariant: null responses cannot be unchunked"),"__NEXT_ERROR_CODE",{value:"E274",enumerable:!1,configurable:!0});if("string"!=typeof this.response){if(!e)throw Object.defineProperty(Error("Invariant: dynamic responses cannot be unchunked. This is a bug in Next.js"),"__NEXT_ERROR_CODE",{value:"E81",enumerable:!1,configurable:!0});return th(this.readable)}return this.response}get readable(){if(null===this.response)throw Object.defineProperty(Error("Invariant: null responses cannot be streamed"),"__NEXT_ERROR_CODE",{value:"E14",enumerable:!1,configurable:!0});if("string"==typeof this.response)throw Object.defineProperty(Error("Invariant: static responses cannot be streamed"),"__NEXT_ERROR_CODE",{value:"E151",enumerable:!1,configurable:!0});return Buffer.isBuffer(this.response)?td(this.response):Array.isArray(this.response)?function(...e){if(0===e.length)throw Object.defineProperty(Error("Invariant: chainStreams requires at least one stream"),"__NEXT_ERROR_CODE",{value:"E437",enumerable:!1,configurable:!0});if(1===e.length)return e[0];let{readable:t,writable:r}=new TransformStream,n=e[0].pipeTo(r,{preventClose:!0}),i=1;for(;i<e.length-1;i++){let t=e[i];n=n.then(()=>t.pipeTo(r,{preventClose:!0}))}let a=e[i];return(n=n.then(()=>a.pipeTo(r))).catch(tl),t}(...this.response):this.response}chain(e){var t;let r;if(null===this.response)throw Object.defineProperty(Error("Invariant: response is null. This is a bug in Next.js"),"__NEXT_ERROR_CODE",{value:"E258",enumerable:!1,configurable:!0});"string"==typeof this.response?r=[(t=this.response,new ReadableStream({start(e){e.enqueue(tu.encode(t)),e.close()}}))]:Array.isArray(this.response)?r=this.response:Buffer.isBuffer(this.response)?r=[td(this.response)]:r=[this.response],r.push(e),this.response=r}async pipeTo(e){try{await this.readable.pipeTo(e,{preventClose:!0}),this.waitUntil&&await this.waitUntil,await e.close()}catch(t){if(tB(t)){await e.abort(t);return}throw t}}async pipeToNodeResponse(e){await tG(this.readable,e,this.waitUntil)}}var tK=/*#__PURE__*/function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({});async function tJ(e){var t,r;return{...e,value:(null==(t=e.value)?void 0:t.kind)===tt.PAGES?{kind:tt.PAGES,html:await e.value.html.toUnchunkedString(!0),pageData:e.value.pageData,headers:e.value.headers,status:e.value.status}:(null==(r=e.value)?void 0:r.kind)===tt.APP_PAGE?{kind:tt.APP_PAGE,html:await e.value.html.toUnchunkedString(!0),postponed:e.value.postponed,rscData:e.value.rscData,headers:e.value.headers,status:e.value.status,segmentData:e.value.segmentData}:e.value}}async function tY(e){var t,r,n;if(!e)return null;if((null==(t=e.value)?void 0:t.kind)===tt.FETCH)throw Object.defineProperty(Error("Invariant: unexpected cachedResponse of kind fetch in response cache"),"__NEXT_ERROR_CODE",{value:"E165",enumerable:!1,configurable:!0});return{isMiss:e.isMiss,isStale:e.isStale,revalidate:e.revalidate,isFallback:e.isFallback,value:(null==(r=e.value)?void 0:r.kind)===tt.PAGES?{kind:tt.PAGES,html:tV.fromStatic(e.value.html),pageData:e.value.pageData,headers:e.value.headers,status:e.value.status}:(null==(n=e.value)?void 0:n.kind)===tt.APP_PAGE?{kind:tt.APP_PAGE,html:tV.fromStatic(e.value.html),rscData:e.value.rscData,headers:e.value.headers,status:e.value.status,postponed:e.value.postponed,segmentData:e.value.segmentData}:e.value}}class tQ{constructor(e){this.batcher=ti.create({cacheKeyFn:({key:e,isOnDemandRevalidate:t})=>`${e}-${t?"1":"0"}`,schedulerFn:ta}),this.minimalMode=e}async get(e,t,r){if(!e)return t({hasResolved:!1,previousCacheEntry:null});let{incrementalCache:n,isOnDemandRevalidate:i=!1,isFallback:a=!1,isRoutePPREnabled:s=!1}=r;return tY(await this.batcher.batch({key:e,isOnDemandRevalidate:i},async(o,l)=>{var u;if((null==(u=this.previousCacheItem)?void 0:u.key)===o&&this.previousCacheItem.expiresAt>Date.now())return this.previousCacheItem.entry;!function(e){switch(e){case tK.PAGES:return tr.PAGES;case tK.APP_PAGE:return tr.APP_PAGE;case tK.IMAGE:return tr.IMAGE;case tK.APP_ROUTE:return tr.APP_ROUTE;default:throw Object.defineProperty(Error(`Unexpected route kind ${e}`),"__NEXT_ERROR_CODE",{value:"E64",enumerable:!1,configurable:!0})}}(r.routeKind);let d=!1,c=null;try{c=null;let e=await t({hasResolved:d,previousCacheEntry:c,isRevalidating:!0});if(!e)return this.previousCacheItem=void 0,null;let r=await tJ({...e,isMiss:!c});if(!r)return this.previousCacheItem=void 0,null;return i||d||(l(r),d=!0),void 0!==r.revalidate&&(this.previousCacheItem={key:o,entry:r,expiresAt:Date.now()+1e3}),r}catch(t){if(c&&await n.set(e,c.value,{revalidate:Math.min(Math.max(c.revalidate||3,3),30),isRoutePPREnabled:s,isFallback:a}),d)return console.error(t),null;throw t}}))}}let tZ="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",t0=`(${tZ}[.]){3}${tZ}`,t1="(?:[0-9a-fA-F]{1,4})",t4=RegExp(`^((?:${t1}:){7}(?:${t1}|:)|(?:${t1}:){6}(?:${t0}|:${t1}|:)|(?:${t1}:){5}(?::${t0}|(:${t1}){1,2}|:)|(?:${t1}:){4}(?:(:${t1}){0,1}:${t0}|(:${t1}){1,3}|:)|(?:${t1}:){3}(?:(:${t1}){0,2}:${t0}|(:${t1}){1,4}|:)|(?:${t1}:){2}(?:(:${t1}){0,3}:${t0}|(:${t1}){1,5}|:)|(?:${t1}:){1}(?:(:${t1}){0,4}:${t0}|(:${t1}){1,6}|:)|(?::((?::${t1}){0,5}:${t0}|(?::${t1}){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})?$`),t2=/\/[^/]*\[[^/]+\][^/]*(?=\/|$)/,t3=/\/\[[^/]+\](?=\/|$)/;function t8(e,t){return(void 0===t&&(t=!0),e4(e)&&(e=function(e){let t,r,n;for(let i of e.split("/"))if(r=e1.find(e=>i.startsWith(e))){[t,n]=e.split(r,2);break}if(!t||!r||!n)throw Object.defineProperty(Error(`Invalid interception route: ${e}. Must be in the format /<intercepting route>/(..|...|..)(..)/<intercepted route>`),"__NEXT_ERROR_CODE",{value:"E269",enumerable:!1,configurable:!0});switch(t=eZ(t),r){case"(.)":n="/"===t?`/${n}`:t+"/"+n;break;case"(..)":if("/"===t)throw Object.defineProperty(Error(`Invalid interception route: ${e}. Cannot use (..) marker at the root level, use (.) instead.`),"__NEXT_ERROR_CODE",{value:"E207",enumerable:!1,configurable:!0});n=t.split("/").slice(0,-1).concat(n).join("/");break;case"(...)":n="/"+n;break;case"(..)(..)":let i=t.split("/");if(i.length<=2)throw Object.defineProperty(Error(`Invalid interception route: ${e}. Cannot use (..)(..) marker at the root level or one level up.`),"__NEXT_ERROR_CODE",{value:"E486",enumerable:!1,configurable:!0});n=i.slice(0,-2).concat(n).join("/");break;default:throw Object.defineProperty(Error("Invariant: unexpected marker"),"__NEXT_ERROR_CODE",{value:"E112",enumerable:!1,configurable:!0})}return{interceptingRoute:t,interceptedRoute:n}}(e).interceptedRoute),t)?t3.test(e):t2.test(e)}let t5=require("next/dist/shared/lib/runtime-config.external.js"),t9=/Googlebot|Google-PageRenderer|AdsBot-Google|googleweblight|Storebot-Google/i,t6="Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview",t7=RegExp(t6,"i");function re(e){return t9.test(e)||t7.test(e)}function rt(e){return t9.test(e)?"dom":t7.test(e)?"html":void 0}function rr(e){let t=e.replace(/\\/g,"/");return t.startsWith("/index/")&&!t8(t)?t.slice(6):"/index"!==t?t:"/"}var rn=r("./dist/compiled/path-to-regexp/index.js");function ri(e,t){let r=[],n=(0,rn.pathToRegexp)(e,r,{delimiter:"/",sensitive:"boolean"==typeof(null==t?void 0:t.sensitive)&&t.sensitive,strict:null==t?void 0:t.strict}),i=(0,rn.regexpToFunction)((null==t?void 0:t.regexModifier)?new RegExp(t.regexModifier(n.source),n.flags):n,r);return(e,n)=>{if("string"!=typeof e)return!1;let a=i(e);if(!a)return!1;if(null==t?void 0:t.removeUnnamedParams)for(let e of r)"number"==typeof e.name&&delete a.params[e.name];return{...n,...a.params}}}function ra(e){return e.replace(/__ESC_COLON_/gi,":")}function rs(e,t,r,n){void 0===r&&(r=[]),void 0===n&&(n=[]);let i={},a=r=>{let n;let a=r.key;switch(r.type){case"header":a=a.toLowerCase(),n=e.headers[a];break;case"cookie":n="cookies"in e?e.cookies[r.key]:eg(e.headers)()[r.key];break;case"query":n=t[a];break;case"host":{let{host:t}=(null==e?void 0:e.headers)||{};n=null==t?void 0:t.split(":",1)[0].toLowerCase()}}if(!r.value&&n)return i[function(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);(n>64&&n<91||n>96&&n<123)&&(t+=e[r])}return t}(a)]=n,!0;if(n){let e=RegExp("^"+r.value+"$"),t=Array.isArray(n)?n.slice(-1)[0].match(e):n.match(e);if(t)return Array.isArray(t)&&(t.groups?Object.keys(t.groups).forEach(e=>{i[e]=t.groups[e]}):"host"===r.type&&t[0]&&(i.host=t[0])),!0}return!1};return!!r.every(e=>a(e))&&!n.some(e=>a(e))&&i}function ro(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,rn.compile)("/"+e,{validate:!1})(t).slice(1)}function rl(e){return"object"==typeof e&&null!==e&&"name"in e&&"message"in e}function ru(e){return rl(e)?e:Object.defineProperty(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+"":function(e){let t=new WeakSet;return JSON.stringify(e,(e,r)=>{if("object"==typeof r&&null!==r){if(t.has(r))return"[Circular]";t.add(r)}return r})}(e)),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}class rd{constructor(e){this.provider=e}normalize(e){return this.provider.analyze(e).pathname}}class rc{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 Object.defineProperty(Error('You cannot define a route with the same specificity as a optional catch-all route ("'+t+'" and "'+t+"[[..."+this.optionalRestSlugName+']]").'),"__NEXT_ERROR_CODE",{value:"E458",enumerable:!1,configurable:!0});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 Object.defineProperty(Error("Catch-all must be the last part of the URL."),"__NEXT_ERROR_CODE",{value:"E392",enumerable:!1,configurable:!0});let n=e[0];if(n.startsWith("[")&&n.endsWith("]")){let a=n.slice(1,-1),s=!1;if(a.startsWith("[")&&a.endsWith("]")&&(a=a.slice(1,-1),s=!0),a.startsWith("…"))throw Object.defineProperty(Error("Detected a three-dot character ('…') at ('"+a+"'). Did you mean ('...')?"),"__NEXT_ERROR_CODE",{value:"E147",enumerable:!1,configurable:!0});if(a.startsWith("...")&&(a=a.substring(3),r=!0),a.startsWith("[")||a.endsWith("]"))throw Object.defineProperty(Error("Segment names may not start or end with extra brackets ('"+a+"')."),"__NEXT_ERROR_CODE",{value:"E421",enumerable:!1,configurable:!0});if(a.startsWith("."))throw Object.defineProperty(Error("Segment names may not start with erroneous periods ('"+a+"')."),"__NEXT_ERROR_CODE",{value:"E288",enumerable:!1,configurable:!0});function i(e,r){if(null!==e&&e!==r)throw Object.defineProperty(Error("You cannot use different slug names for the same dynamic path ('"+e+"' !== '"+r+"')."),"__NEXT_ERROR_CODE",{value:"E337",enumerable:!1,configurable:!0});t.forEach(e=>{if(e===r)throw Object.defineProperty(Error('You cannot have the same slug name "'+r+'" repeat within a single dynamic path'),"__NEXT_ERROR_CODE",{value:"E247",enumerable:!1,configurable:!0});if(e.replace(/\W/g,"")===n.replace(/\W/g,""))throw Object.defineProperty(Error('You cannot have the slug names "'+e+'" and "'+r+'" differ only by non-word symbols within a single dynamic path'),"__NEXT_ERROR_CODE",{value:"E499",enumerable:!1,configurable:!0})}),t.push(r)}if(r){if(s){if(null!=this.restSlugName)throw Object.defineProperty(Error('You cannot use both an required and optional catch-all route at the same level ("[...'+this.restSlugName+']" and "'+e[0]+'" ).'),"__NEXT_ERROR_CODE",{value:"E299",enumerable:!1,configurable:!0});i(this.optionalRestSlugName,a),this.optionalRestSlugName=a,n="[[...]]"}else{if(null!=this.optionalRestSlugName)throw Object.defineProperty(Error('You cannot use both an optional and required catch-all route at the same level ("[[...'+this.optionalRestSlugName+']]" and "'+e[0]+'").'),"__NEXT_ERROR_CODE",{value:"E300",enumerable:!1,configurable:!0});i(this.restSlugName,a),this.restSlugName=a,n="[...]"}}else{if(s)throw Object.defineProperty(Error('Optional route parameters are not yet supported ("'+e[0]+'").'),"__NEXT_ERROR_CODE",{value:"E435",enumerable:!1,configurable:!0});i(this.slugName,a),this.slugName=a,n="[]"}}this.children.has(n)||this.children.set(n,new rc),this.children.get(n)._insert(e.slice(1),t,r)}constructor(){this.placeholder=!0,this.children=new Map,this.slugName=null,this.restSlugName=null,this.optionalRestSlugName=null}}class rh{constructor(e){this.definition=e,t8(e.pathname)&&(this.dynamic=ee(e7(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 rp extends rh{get identity(){var e;return`${this.definition.pathname}?__nextLocale=${null==(e=this.definition.i18n)?void 0:e.locale}`}match(e,t){var r,n;let i=this.test(e,t);return i?{definition:this.definition,params:i.params,detectedLocale:(null==t?void 0:null==(r=t.i18n)?void 0:r.detectedLocale)??(null==(n=this.definition.i18n)?void 0:n.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 rf{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 n=this.compilationID;try{let e=[],t=await Promise.all(this.providers.map(e=>e.matchers())),r=new Map,i={};for(let n of t)for(let t of n){t.duplicated&&delete t.duplicated;let n=r.get(t.definition.pathname);if(n){let e=i[t.definition.pathname]??[n];e.push(t),i[t.definition.pathname]=e,n.duplicated=e,t.duplicated=e}e.push(t),r.set(t.definition.pathname,t)}if(this.matchers.duplicates=i,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 a=e.filter(e=>e.isDynamic),s=new Map,o=[];for(let e=0;e<a.length;e++){let t=a[e].definition.pathname,r=s.get(t)??[];r.push(e),1===r.length&&(s.set(t,r),o.push(t))}let l=function(e){let t=new rc;return e.forEach(e=>t.insert(e)),t.smoosh()}(o),u=[];for(let e of l){let t=s.get(e);if(!Array.isArray(t))throw Object.defineProperty(Error("Invariant: expected to find identity in indexes map"),"__NEXT_ERROR_CODE",{value:"E271",enumerable:!1,configurable:!0});let r=t.map(e=>a[e]);u.push(...r)}if(this.matchers.dynamic=u,this.compilationID!==n)throw Object.defineProperty(Error("Invariant: expected compilation to finish before new matchers were added, possible missing await"),"__NEXT_ERROR_CODE",{value:"E242",enumerable:!1,configurable:!0})}catch(e){r(e)}finally{this.lastCompilationID=n,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 n;return t instanceof rp?t.match(e,r):(null==(n=r.i18n)?void 0:n.inferredFromDefault)?t.match(r.i18n.pathname):t.match(e)}async *matchAll(e,t){if(this.lastCompilationID!==this.compilationID)throw Object.defineProperty(Error("Invariant: expected routes to have been loaded before match"),"__NEXT_ERROR_CODE",{value:"E235",enumerable:!1,configurable:!0});if(!t8(e=eQ(e)))for(let r of this.matchers.static){let n=this.validate(e,r,t);n&&(yield n)}if(null==t?void 0:t.skipDynamic)return null;for(let r of this.matchers.dynamic){let n=this.validate(e,r,t);n&&(yield n)}return null}constructor(){this.providers=[],this.matchers={static:[],dynamic:[],duplicates:{}},this.lastCompilationID=this.compilationID,this.previousMatchers=[]}}class rm{constructor(e=[]){this.normalizers=e}push(e){this.normalizers.push(e)}normalize(e){return this.normalizers.reduce((e,t)=>t.normalize(e),e)}}var rg=r("./dist/esm/shared/lib/isomorphic/path.js"),rv=/*#__PURE__*/r.n(rg);class ry{constructor(...e){this.prefix=rv().posix.join(...e)}normalize(e){return rv().posix.join(this.prefix,e)}}function rb(e){let t=/^\/index(\/|$)/.test(e)&&!t8(e)?"/index"+e:"/"===e?"/index":eQ(e);{let{posix:e}=r("path"),n=e.normalize(t);if(n!==t)throw new Y("Requested and resolved page mismatch: "+t+" "+n)}return t}class rE extends ry{constructor(){super("app")}normalize(e){return super.normalize(rb(e))}}class r_ extends ry{constructor(e){super(e,ed)}normalize(e){return super.normalize(e)}}function rR(e){return{normalize:e}}class rw{normalize(e){return e.replace(/%5F/g,"_")}}class rx extends rm{constructor(){super([rR(eZ),new rw])}normalize(e){return super.normalize(e)}}class rP{constructor(e){this.filename=new r_(e),this.pathname=new rx,this.bundlePath=new rE}}class rO extends rh{get identity(){return`${this.definition.pathname}?__nextPage=${this.definition.page}`}}class rC{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 rT extends rC{constructor(e,t){super({load:async()=>t.load(e),compare:(e,t)=>e===t})}}class rS extends rT{constructor(e,t){super(eu,t),this.normalizers=new rP(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 n=[];for(let[t,i]of Object.entries(r)){let r=i[0],a=this.normalizers.filename.normalize(e[r]),s=this.normalizers.bundlePath.normalize(r);n.push(new rO({kind:tK.APP_PAGE,pathname:t,page:r,bundlePath:s,filename:a,appPaths:i}))}return n}}class rD extends rh{}class rA extends rT{constructor(e,t){super(eu,t),this.normalizers=new rP(e)}async transform(e){let t=Object.keys(e).filter(e=>e.endsWith("/route")),r=[];for(let n of t){let t=this.normalizers.filename.normalize(e[n]),i=this.normalizers.pathname.normalize(n),a=this.normalizers.bundlePath.normalize(n);r.push(new rD({kind:tK.APP_ROUTE,pathname:i,page:n,bundlePath:a,filename:t}))}return r}}function rj(e){return"/api"===e||!!(null==e?void 0:e.startsWith("/api/"))}class rN extends rh{}class rk extends rp{}class rI extends rm{constructor(){super([rR(rb),new ry("pages")])}normalize(e){return super.normalize(e)}}class rM extends ry{constructor(e){super(e,ed)}normalize(e){return super.normalize(e)}}class rq{constructor(e){this.filename=new rM(e),this.bundlePath=new rI}}class rL extends rT{constructor(e,t,r){super(el,t),this.i18nProvider=r,this.normalizers=new rq(e)}async transform(e){let t=Object.keys(e).filter(e=>rj(e)),r=[];for(let n of t)if(this.i18nProvider){let{detectedLocale:t,pathname:i}=this.i18nProvider.analyze(n);r.push(new rk({kind:tK.PAGES_API,pathname:i,page:n,bundlePath:this.normalizers.bundlePath.normalize(n),filename:this.normalizers.filename.normalize(e[n]),i18n:{locale:t}}))}else r.push(new rN({kind:tK.PAGES_API,pathname:n,page:n,bundlePath:this.normalizers.bundlePath.normalize(n),filename:this.normalizers.filename.normalize(e[n])}));return r}}class r$ extends rh{}class rH extends rp{}class rF extends rT{constructor(e,t,r){super(el,t),this.i18nProvider=r,this.normalizers=new rq(e)}async transform(e){let t=Object.keys(e).filter(e=>!rj(e)).filter(e=>{var t;let r=(null==(t=this.i18nProvider)?void 0:t.analyze(e).pathname)??e;return!ec.includes(r)}),r=[];for(let n of t)if(this.i18nProvider){let{detectedLocale:t,pathname:i}=this.i18nProvider.analyze(n);r.push(new rH({kind:tK.PAGES,pathname:i,page:n,bundlePath:this.normalizers.bundlePath.normalize(n),filename:this.normalizers.filename.normalize(e[n]),i18n:{locale:t}}))}else r.push(new r$({kind:tK.PAGES,pathname:n,page:n,bundlePath:this.normalizers.bundlePath.normalize(n),filename:this.normalizers.filename.normalize(e[n])}));return r}}class rz{constructor(e){this.getter=e}load(e){return this.getter(e)}}class rU{constructor(e){var t;if(this.config=e,!e.locales.length)throw Object.defineProperty(Error("Invariant: No locales provided"),"__NEXT_ERROR_CODE",{value:"E510",enumerable:!1,configurable:!0});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 n=0;n<this.lowerCaseDomains.length;n++){var r;let i=this.lowerCaseDomains[n];if(i.hostname===e||(null==(r=i.locales)?void 0:r.some(e=>e===t)))return this.config.domains[n]}}}fromRequest(e,t){let r=er(e,"locale");if(r){let e=this.analyze(t);if(e.detectedLocale){if(e.detectedLocale!==r)throw Object.defineProperty(Error(`Invariant: The detected locale does not match the locale in the query. Expected to find '${r}' in '${t}' but found '${e.detectedLocale}'}`),"__NEXT_ERROR_CODE",{value:"E517",enumerable:!1,configurable:!0});t=e.pathname}}return{pathname:t,detectedLocale:r,inferredFromDefault:er(e,"localeInferredFromDefault")??!1}}analyze(e,t={}){let r=t.defaultLocale,n="string"==typeof r,i=e.split("/",2);if(!i[1])return{detectedLocale:r,pathname:e,inferredFromDefault:n};let a=i[1].toLowerCase(),s=this.lowerCaseLocales.indexOf(a);return s<0||(r=this.config.locales[s],n=!1,e=e.slice(r.length+1)||"/"),{detectedLocale:r,pathname:e,inferredFromDefault:n}}}async function rW(e,t,r,n){if(tL(t)){var i;t.statusCode=r.status,t.statusMessage=r.statusText;let a=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(i=r.headers)||i.forEach((e,r)=>{if("x-middleware-set-cookie"!==r.toLowerCase()){if("set-cookie"===r.toLowerCase())for(let n of tf(e))t.appendHeader(r,n);else{let n=void 0!==t.getHeader(r);(a.includes(r.toLowerCase())||!n)&&t.appendHeader(r,e)}}});let{originalResponse:s}=t;r.body&&"HEAD"!==e.method?await tG(r.body,s,n):s.end()}}let rX=ri("/_next/data/:path*");function rB(e){return e.split("/").map(e=>{try{e=decodeURIComponent(e).replace(RegExp("([/#?]|%(2f|23|3f|5c))","gi"),e=>encodeURIComponent(e))}catch(e){throw Object.defineProperty(new J("Failed to decode path param(s)."),"__NEXT_ERROR_CODE",{value:"E539",enumerable:!1,configurable:!0})}return e}).join("/")}class rG{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 rV extends rG{constructor(){super(eP.RM)}}function rK(e){for(let t of ej)delete e[t.toLowerCase()]}function rJ(e){return e.definition.kind===tK.APP_PAGE}function rY(e){return e.definition.kind===tK.PAGES}class rQ extends rG{constructor(){super(eP.pu)}match(e){return e==="/__index"+eP.pu||super.match(e)}normalize(e,t){return e==="/__index"+eP.pu?"/":super.normalize(e,t)}}class rZ{constructor(e){if(this.prefix=e,e.endsWith("/"))throw Object.defineProperty(Error(`PrefixPathnameNormalizer: prefix "${e}" should not end with a slash`),"__NEXT_ERROR_CODE",{value:"E219",enumerable:!1,configurable:!0})}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 r0{constructor(e){if(this.suffix=new rG(".json"),!e)throw Object.defineProperty(Error("Invariant: buildID is required"),"__NEXT_ERROR_CODE",{value:"E200",enumerable:!1,configurable:!0});this.prefix=new rZ(`/_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),rr(e=this.suffix.normalize(e,!0))):e}}function r1(e){return e.replace(/(?:\/index)?\/?$/,"")||"/"}let r4=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0}),r2="undefined"!=typeof globalThis&&globalThis.AsyncLocalStorage,r3=Symbol.for("@next/request-context");Symbol("response"),Symbol("passThrough"),Symbol("waitUntil");var r8=r("./dist/esm/server/web/spec-extension/adapters/reflect.js");let r5=Symbol("internal response"),r9=new Set([301,302,303,307,308]);function r6(e,t){var r;if(null==e?void 0:null==(r=e.request)?void 0:r.headers){if(!(e.request.headers instanceof Headers))throw Object.defineProperty(Error("request.headers must be an instance of Headers"),"__NEXT_ERROR_CODE",{value:"E119",enumerable:!1,configurable:!0});let r=[];for(let[n,i]of e.request.headers)t.set("x-middleware-request-"+n,i),r.push(n);t.set("x-middleware-override-headers",r.join(","))}}class r7 extends Response{constructor(e,t={}){super(e,t);let r=this.headers,n=new Proxy(new tk.VO(r),{get(e,n,i){switch(n){case"delete":case"set":return(...i)=>{let a=Reflect.apply(e[n],e,i),s=new Headers(r);return a instanceof tk.VO&&r.set("x-middleware-set-cookie",a.getAll().map(e=>(0,tk.Ud)(e)).join(",")),r6(t,s),a};default:return r8.l.get(e,n,i)}}});this[r5]={cookies:n,url:t.url?new tD(t.url,{headers:tm(r),nextConfig:t.nextConfig}):void 0}}[Symbol.for("edge-runtime.inspect.custom")](){return{cookies:this.cookies,url:this.url,body:this.body,bodyUsed:this.bodyUsed,headers:Object.fromEntries(this.headers),ok:this.ok,redirected:this.redirected,status:this.status,statusText:this.statusText,type:this.type}}get cookies(){return this[r5].cookies}static json(e,t){let r=Response.json(e,t);return new r7(r.body,r)}static redirect(e,t){let r="number"==typeof t?t:(null==t?void 0:t.status)??307;if(!r9.has(r))throw Object.defineProperty(RangeError('Failed to execute "redirect" on "response": Invalid status code'),"__NEXT_ERROR_CODE",{value:"E529",enumerable:!1,configurable:!0});let n="object"==typeof t?t:{},i=new Headers(null==n?void 0:n.headers);return i.set("Location",tg(e)),new r7(null,{...n,headers:i,status:r})}static rewrite(e,t){let r=new Headers(null==t?void 0:t.headers);return r.set("x-middleware-rewrite",tg(e)),r6(t,r),new r7(null,{...t,headers:r})}static next(e){let t=new Headers(null==e?void 0:e.headers);return t.set("x-middleware-next","1"),r6(e,t),new r7(null,{...e,headers:t})}}r("./dist/esm/server/web/spec-extension/adapters/headers.js");class ne extends Error{constructor(){super("Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#options")}static callable(){throw new ne}}Symbol.for("next.mutated.cookies"),r("./dist/compiled/p-queue/index.js"),require("next/dist/server/app-render/after-task-async-storage.external.js");class nt extends tM{constructor(e){super(e.input,e.init),this.sourcePage=e.page}get request(){throw Object.defineProperty(new tA({page:this.sourcePage}),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}respondWith(){throw Object.defineProperty(new tA({page:this.sourcePage}),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}waitUntil(){throw Object.defineProperty(new tA({page:this.sourcePage}),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}}function nr(e){return e.isOnDemandRevalidate?"on-demand":e.isRevalidate?"stale":void 0}var nn=/*#__PURE__*/function(e){return e.BLOCKING_STATIC_RENDER="BLOCKING_STATIC_RENDER",e.PRERENDER="PRERENDER",e.NOT_FOUND="NOT_FOUND",e}({});let ni=RegExp(`^(/.*)${eP.mH}(/.*)${eP.tz}$`);class na{match(e){return ni.test(e)}extract(e){let t=e.match(ni);return t?{originalPathname:t[1],segmentPath:t[2]}:null}normalize(e){let t=this.extract(e);return t?t.originalPathname:e}}class ns extends Error{}class no extends Error{constructor(e){super(),this.innerError=e}}class nl{getServerComponentsHmrCache(){return this.nextConfig.experimental.serverComponentsHmrCache?globalThis.__serverComponentsHmrCache:void 0}constructor(e){var t,n,i;this.handleRSCRequest=(e,t,r)=>{var n,i,a;if(!r.pathname)return!1;if(null==(n=this.normalizers.segmentPrefetchRSC)?void 0:n.match(r.pathname)){let t=this.normalizers.segmentPrefetchRSC.extract(r.pathname);if(!t)return!1;let{originalPathname:n,segmentPath:i}=t;r.pathname=n,e.headers["RSC".toLowerCase()]="1",e.headers[eS.toLowerCase()]="1",e.headers[eD.toLowerCase()]=i,en(e,"isRSCRequest",!0),en(e,"isPrefetchRSCRequest",!0),en(e,"segmentPrefetchRSCRequest",i)}else 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[eS.toLowerCase()]="1",en(e,"isRSCRequest",!0),en(e,"isPrefetchRSCRequest",!0);else if(null==(a=this.normalizers.rsc)?void 0:a.match(r.pathname))r.pathname=this.normalizers.rsc.normalize(r.pathname,!0),e.headers["RSC".toLowerCase()]="1",en(e,"isRSCRequest",!0);else if(e.headers["x-now-route-matches"])return rK(e.headers),!1;else if("1"!==e.headers.rsc)return!1;else if(en(e,"isRSCRequest",!0),"1"===e.headers[eS.toLowerCase()]){en(e,"isPrefetchRSCRequest",!0);let t=e.headers[eD.toLowerCase()];"string"==typeof t&&en(e,"segmentPrefetchRSCRequest",t)}if(e.url){let t=(0,d.parse)(e.url);t.pathname=r.pathname,e.url=(0,d.format)(t)}return!1},this.handleNextDataRequest=async(e,t,r)=>{let n=this.getMiddleware(),i=function(e){return"string"==typeof e&&rX(e)}(r.pathname);if(!i||!i.path)return!1;if(i.path[0]!==this.buildId)return!er(e,"middlewareInvoke")&&(await this.render404(e,t,r),!0);i.path.shift();let a=i.path[i.path.length-1];if("string"!=typeof a||!a.endsWith(".json"))return await this.render404(e,t,r),!0;let s=`/${i.path.join("/")}`;if(s=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/")&&!t8(e)?e=e.slice(6):"/index"===e&&(e="/"),e}(s,".json"),n&&(this.nextConfig.trailingSlash&&!s.endsWith("/")&&(s+="/"),!this.nextConfig.trailingSlash&&s.length>1&&s.endsWith("/")&&(s=s.substring(0,s.length-1))),this.i18nProvider){var o;let i=null==e?void 0:null==(o=e.headers.host)?void 0:o.split(":",1)[0].toLowerCase(),a=this.i18nProvider.detectDomainLocale(i),l=(null==a?void 0:a.defaultLocale)??this.i18nProvider.config.defaultLocale,u=this.i18nProvider.analyze(s);if(u.detectedLocale&&(s=u.pathname),en(e,"locale",u.detectedLocale),en(e,"defaultLocale",l),u.detectedLocale||ei(e,"localeInferredFromDefault"),!u.detectedLocale&&!n)return en(e,"locale",l),await this.render404(e,t,r),!0}return r.pathname=s,en(e,"isNextDataReq",!0),!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.segmentPrefetchRSC&&t.push(this.normalizers.segmentPrefetchRSC),this.normalizers.prefetchRSC&&t.push(this.normalizers.prefetchRSC),this.normalizers.rsc&&t.push(this.normalizers.rsc),t))if(r.match(e))return r.normalize(e,!0);return e},this.normalizeAndAttachMetadata=async(e,t,r)=>{let n=await this.handleNextImageRequest(e,t,r);return!!(n||this.enabledDirectories.pages&&(n=await this.handleNextDataRequest(e,t,r)))},this.prepared=!1,this.preparedPromise=null,this.customErrorNo404Warn=function(e){let t,r=!1;return function(){for(var n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];return r||(r=!0,t=e(...i)),t}}(()=>{eX(`You have added a custom /_error page without a custom /404 page. This prevents the 404 page from being auto statically optimized.
31
- See here for info: https://nextjs.org/docs/messages/custom-error-no-custom-404`)});let{dir:a=".",quiet:s=!1,conf:o,dev:l=!1,minimalMode:u=!1,hostname:c,port:h,experimentalTestProxy:p}=e;this.experimentalTestProxy=p,this.serverOptions=e,this.dir=r("path").resolve(a),this.quiet=s,this.loadEnvConfig({dev:l}),this.nextConfig=o,this.hostname=c,this.hostname&&(this.fetchHostname=function(e){return t4.test(e)?`[${e}]`:e}(this.hostname)),this.port=h,this.distDir=r("path").join(this.dir,this.nextConfig.distDir),this.publicDir=this.getPublicDir(),this.hasStaticDir=!u&&this.getHasStaticDir(),this.i18nProvider=(null==(t=this.nextConfig.i18n)?void 0:t.locales)?new rU(this.nextConfig.i18n):void 0,this.localeNormalizer=this.i18nProvider?new rd(this.i18nProvider):void 0;let{serverRuntimeConfig:f={},publicRuntimeConfig:m,assetPrefix:g,generateEtags:v}=this.nextConfig;this.buildId=this.getBuildId(),this.minimalMode=u||!!process.env.NEXT_PRIVATE_MINIMAL_MODE,this.enabledDirectories=this.getEnabledDirectories(l),this.isAppPPREnabled=this.enabledDirectories.app&&function(e){return void 0!==e&&("boolean"==typeof e?e:"incremental"===e)}(this.nextConfig.experimental.ppr),this.isAppSegmentPrefetchEnabled=this.enabledDirectories.app&&!0===this.nextConfig.experimental.clientSegmentCache,this.normalizers={rsc:this.enabledDirectories.app?new rV:void 0,prefetchRSC:this.isAppPPREnabled?new rQ:void 0,segmentPrefetchRSC:this.isAppSegmentPrefetchEnabled?new na:void 0,data:this.enabledDirectories.pages?new r0(this.buildId):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??!0,poweredByHeader:this.nextConfig.poweredByHeader,canonicalBase:this.nextConfig.amp.canonicalBase||"",generateEtags:v,previewProps:this.getPrerenderManifest().preview,ampOptimizerConfig:null==(n=this.nextConfig.experimental.amp)?void 0:n.optimizer,basePath:this.nextConfig.basePath,images:this.nextConfig.images,optimizeCss:this.nextConfig.experimental.optimizeCss,nextConfigOutput:this.nextConfig.output,nextScriptWorkers:this.nextConfig.experimental.nextScriptWorkers,disableOptimizedLoading:this.nextConfig.experimental.disableOptimizedLoading,domainLocales:null==(i=this.nextConfig.i18n)?void 0:i.domains,distDir:this.distDir,serverComponents:this.enabledDirectories.app,cacheLifeProfiles:this.nextConfig.experimental.cacheLife,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:{expireTime:this.nextConfig.expireTime,clientTraceMetadata:this.nextConfig.experimental.clientTraceMetadata,dynamicIO:this.nextConfig.experimental.dynamicIO??!1,clientSegmentCache:this.nextConfig.experimental.clientSegmentCache??!1,inlineCss:this.nextConfig.experimental.inlineCss??!1,authInterrupts:!!this.nextConfig.experimental.authInterrupts,streamingMetadata:!!this.nextConfig.experimental.streamingMetadata,htmlLimitedBots:this.nextConfig.experimental.htmlLimitedBots},onInstrumentationRequestError:this.instrumentationOnRequestError.bind(this),reactMaxHeadersLength:this.nextConfig.reactMaxHeadersLength},(0,t5.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(g),this.responseCache=this.getResponseCache({dev:l})}reloadMatchers(){return this.matchers.reload()}getRouteMatchers(){let e=new rz(e=>{switch(e){case el:return this.getPagesManifest()??null;case eu:return this.getAppPathsManifest()??null;default:return null}}),t=new rf;return t.push(new rF(this.distDir,e,this.i18nProvider)),t.push(new rL(this.distDir,e,this.i18nProvider)),this.enabledDirectories.app&&(t.push(new rS(this.distDir,e)),t.push(new rA(this.distDir,e))),t}async instrumentationOnRequestError(...e){let[t,r,n]=e;if(this.instrumentation)try{await (null==this.instrumentation.onRequestError?void 0:this.instrumentation.onRequestError.call(this.instrumentation,t,{path:r.url||"",method:r.method||"GET",headers:r instanceof nt?Object.fromEntries(r.headers.entries()):r.headers},n))}catch(e){console.error("Error in instrumentation.onRequestError:",e)}}logError(e){this.quiet||eW(e)}async handleRequest(e,t,r){await this.prepare();let n=e.method.toUpperCase(),i=(0,ts.getTracer)();return i.withPropagatedContext(e.headers,()=>i.trace(to.Li.handleRequest,{spanName:`${n} ${e.url}`,kind:ts.SpanKind.SERVER,attributes:{"http.method":n,"http.target":e.url}},async a=>this.handleRequestImpl(e,t,r).finally(()=>{if(!a)return;let r=er(e,"isRSCRequest")??!1;a.setAttributes({"http.status_code":t.statusCode,"next.rsc":r});let s=i.getRootSpanAttributes();if(!s)return;if(s.get("next.span_type")!==to.Li.handleRequest){console.warn(`Unexpected root span type '${s.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);return}let o=s.get("next.route");if(o){let e=r?`RSC ${n} ${o}`:`${n} ${o}`;a.setAttributes({"next.route":o,"http.route":o,"next.span_name":e}),a.updateName(e)}else a.updateName(r?`RSC ${n} ${e.url}`:`${n} ${e.url}`)})))}async handleRequestImpl(e,t,r){try{var n,i,a,s,o,l,u,c,h,p;await this.matchers.waitTillReady(),function(e,t){let r=t.setHeader.bind(t);t.setHeader=(n,i)=>{if("headersSent"in t&&t.headersSent)return t;if("set-cookie"===n.toLowerCase()){let t=er(e,"middlewareCookie");t&&Array.isArray(i)&&i.every((e,r)=>e===t[r])||(i=[...new Set([...t||[],..."string"==typeof i?[i]:Array.isArray(i)?i:[]])])}return r(n,i)}}(e,tL(t)?t.originalResponse:t);let f=(e.url||"").split("?",1)[0];if(null==f?void 0:f.match(/(\\|\/\/)/)){let r=K(e.url);t.redirect(r,308).body(r).send();return}if(!r||"object"!=typeof r){if(!e.url)throw Object.defineProperty(Error("Invariant: url can not be undefined"),"__NEXT_ERROR_CODE",{value:"E123",enumerable:!1,configurable:!0});r=(0,d.parse)(e.url,!0)}if(!r.pathname)throw Object.defineProperty(Error("Invariant: pathname can't be empty"),"__NEXT_ERROR_CODE",{value:"E412",enumerable:!1,configurable:!0});"string"==typeof r.query&&(r.query=Object.fromEntries(new URLSearchParams(r.query)));let{originalRequest:m=null}=tq(e)?e:{},g=null==m?void 0:m.headers["x-forwarded-proto"],v=g?"https"===g:!!(null==m?void 0:null==(n=m.socket)?void 0:n.encrypted);e.headers["x-forwarded-host"]??=e.headers.host??this.hostname,e.headers["x-forwarded-port"]??=this.port?this.port.toString():v?"443":"80",e.headers["x-forwarded-proto"]??=v?"https":"http",e.headers["x-forwarded-for"]??=null==m?void 0:null==(i=m.socket)?void 0:i.remoteAddress,this.attachRequestMeta(e,r);let y=await this.handleRSCRequest(e,t,r);if(y)return;let b=null==(a=this.i18nProvider)?void 0:a.detectDomainLocale(tR(r,e.headers)),E=(null==b?void 0:b.defaultLocale)||(null==(s=this.nextConfig.i18n)?void 0:s.defaultLocale);en(e,"defaultLocale",E);let _=eq(e.url.replace(/^\/+/,"/")),R=tO(_.pathname,{nextConfig:this.nextConfig,i18nProvider:this.i18nProvider});_.pathname=R.pathname,R.basePath&&(e.url=tP(e.url,this.nextConfig.basePath));let w="string"==typeof e.headers[eP.vx];if(w)try{this.enabledDirectories.app&&(e.url.match(/^\/index($|\?)/)&&(e.url=e.url.replace(/^\/index/,"/")),r.pathname="/index"===r.pathname?"/":r.pathname);let{pathname:n}=new URL(e.headers[eP.vx],"http://localhost"),{pathname:i}=new URL(e.url,"http://localhost");if(null==(o=this.normalizers.data)?void 0:o.match(i))en(e,"isNextDataReq",!0);else if(this.isAppPPREnabled&&"1"===e.headers[eP.gs]&&"POST"===e.method){let t=[];for await(let r of e.body)t.push(r);let r=Buffer.concat(t).toString("utf8");en(e,"postponed",r)}n=this.normalize(n);let a=this.stripNextDataPath(i),s=null==(l=this.i18nProvider)?void 0:l.analyze(n,{defaultLocale:E});s&&(en(e,"locale",s.detectedLocale),s.inferredFromDefault?en(e,"localeInferredFromDefault",!0):ei(e,"localeInferredFromDefault"));let h=n=rr(n),p=t8(h);if(!p){let e=await this.matchers.match(h,{i18n:s});e&&(h=e.definition.pathname,p=void 0!==e.params)}s&&(n=s.pathname);let f=function({page:e,i18n:t,basePath:r,rewrites:n,pageIsDynamic:i,trailingSlash:a,caseSensitive:s}){let o,l,u;return i&&(u=(l=ee(o=function(e,t){var r,n,i;let a=function(e,t,r,n,i){let a;let s=(a=0,()=>{let e="",t=++a;for(;t>0;)e+=String.fromCharCode(97+(t-1)%26),t=Math.floor((t-1)/26);return e}),o={},l=[];for(let a of e5(e).slice(1).split("/")){let e=e1.some(e=>a.startsWith(e)),u=a.match(e9);if(e&&u&&u[2])l.push(te({getSafeRouteKey:s,interceptionMarker:u[1],segment:u[2],routeKeys:o,keyPrefix:t?eP.h:void 0,backreferenceDuplicateKeys:i}));else if(u&&u[2]){n&&u[1]&&l.push("/"+e8(u[1]));let e=te({getSafeRouteKey:s,segment:u[2],routeKeys:o,keyPrefix:t?eP.AA:void 0,backreferenceDuplicateKeys:i});n&&u[1]&&(e=e.substring(1)),l.push(e)}else l.push("/"+e8(a));r&&u&&u[3]&&l.push(e8(u[3]))}return{namedParameterizedRoute:l.join(""),routeKeys:o}}(e,t.prefixRouteKeys,null!=(r=t.includeSuffix)&&r,null!=(n=t.includePrefix)&&n,null!=(i=t.backreferenceDuplicateKeys)&&i),s=a.namedParameterizedRoute;return t.excludeOptionalTrailingSlash||(s+="(?:/)?"),{...e7(e,t),namedRegex:"^"+s+"$",routeKeys:a.routeKeys}}(e,{prefixRouteKeys:!1})))(e)),{handleRewrites:function(o,u){let d={},c=u.pathname,h=n=>{let h=ri(n.source+(a?"(/)?":""),{removeUnnamedParams:!0,strict:!0,sensitive:!!s});if(!u.pathname)return!1;let p=h(u.pathname);if((n.has||n.missing)&&p){let e=rs(o,u.query,n.has,n.missing);e?Object.assign(p,e):p=!1}if(p){let{parsedDestination:a,destQuery:s}=function(e){let t,r;let n=Object.assign({},e.query);delete n[eN];let i=function(e){let t=e.destination;for(let r of Object.keys({...e.params,...e.query}))r&&(t=t.replace(RegExp(":"+e8(r),"g"),"__ESC_COLON_"+r));let r=eq(t),n=r.pathname;n&&(n=ra(n));let i=r.href;i&&(i=ra(i));let a=r.hostname;a&&(a=ra(a));let s=r.hash;return s&&(s=ra(s)),{...r,pathname:n,hostname:a,href:i,hash:s}}(e),{hostname:a,query:s}=i,o=i.pathname;i.hash&&(o=""+o+i.hash);let l=[],u=[];for(let e of((0,rn.pathToRegexp)(o,u),u))l.push(e.name);if(a){let e=[];for(let t of((0,rn.pathToRegexp)(a,e),e))l.push(t.name)}let d=(0,rn.compile)(o,{validate:!1});for(let[r,n]of(a&&(t=(0,rn.compile)(a,{validate:!1})),Object.entries(s)))Array.isArray(n)?s[r]=n.map(t=>ro(ra(t),e.params)):"string"==typeof n&&(s[r]=ro(ra(n),e.params));let c=Object.keys(e.params).filter(e=>"nextInternalLocale"!==e);if(e.appendParamsToQuery&&!c.some(e=>l.includes(e)))for(let t of c)t in s||(s[t]=e.params[t]);if(e4(o))for(let t of o.split("/")){let r=e1.find(e=>t.startsWith(e));if(r){"(..)(..)"===r?(e.params["0"]="(..)",e.params["1"]="(..)"):e.params["0"]=r;break}}try{let[n,a]=(r=d(e.params)).split("#",2);t&&(i.hostname=t(e.params)),i.pathname=n,i.hash=(a?"#":"")+(a||""),delete i.search}catch(e){if(e.message.match(/Expected .*? to not repeat, but got an array/))throw Object.defineProperty(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"),"__NEXT_ERROR_CODE",{value:"E329",enumerable:!1,configurable:!0});throw e}return i.query={...n,...i.query},{newUrl:r,destQuery:s,parsedDestination:i}}({appendParamsToQuery:!0,destination:n.destination,params:p,query:u.query});if(a.protocol)return!0;if(Object.assign(d,s,p),Object.assign(u.query,a.query),delete a.query,Object.assign(u,a),!(c=u.pathname))return!1;if(r&&(c=c.replace(RegExp(`^${r}`),"")||"/"),t){let e=tx(c,t.locales);c=e.pathname,u.query.nextInternalLocale=e.detectedLocale||p.nextInternalLocale}if(c===e)return!0;if(i&&l){let e=l(c);if(e)return u.query={...u.query,...e},!0}}return!1};for(let e of n.beforeFiles||[])h(e);if(c!==e){let t=!1;for(let e of n.afterFiles||[])if(t=h(e))break;if(!t&&!(()=>{let t=e5(c||"");return t===e5(e)||(null==l?void 0:l(t))})()){for(let e of n.fallback||[])if(t=h(e))break}}return d},defaultRouteRegex:o,dynamicRouteMatcher:l,defaultRouteMatches:u,getParamsFromRouteMatches:function(e){if(!o)return null;let{groups:t,routeKeys:r}=o;return ee({re:{exec:e=>{let n=Object.fromEntries(new URLSearchParams(e));for(let[e,t]of Object.entries(n)){let r=tv(e);r&&(n[r]=t,delete n[e])}let i={};for(let e of Object.keys(r)){let a=r[e];if(!a)continue;let s=t[a],o=n[e];if(!s.optional&&!o)return null;i[s.pos]=o}return i}},groups:t})(e)||null},normalizeDynamicRouteParams:(e,t)=>o&&u?function(e,t,r,n){let i={};for(let a of Object.keys(t.groups)){let s=e[a];"string"==typeof s?s=e0(s):Array.isArray(s)&&(s=s.map(e0));let o=r[a],l=t.groups[a].optional;if((Array.isArray(o)?o.some(e=>Array.isArray(s)?s.some(t=>t.includes(e)):null==s?void 0:s.includes(e)):null==s?void 0:s.includes(o))||void 0===s&&!(l&&n))return{params:{},hasValidParams:!1};l&&(!s||Array.isArray(s)&&1===s.length&&("index"===s[0]||s[0]===`[[...${a}]]`))&&(s=void 0,delete e[a]),s&&"string"==typeof s&&t.groups[a].repeat&&(s=s.split("/")),s&&(i[a]=s)}return{params:i,hasValidParams:!0}}(e,o,u,t):{params:{},hasValidParams:!1},normalizeVercelUrl:(e,t)=>(function(e,t,r){if(!r)return;let n=(0,d.parse)(e.url,!0);for(let e of(delete n.search,Object.keys(n.query))){let i=e!==eP.AA&&e.startsWith(eP.AA),a=e!==eP.h&&e.startsWith(eP.h);(i||a||(t||Object.keys(r.groups)).includes(e))&&delete n.query[e]}e.url=(0,d.format)(n)})(e,t,o),interpolateDynamicPath:(e,t)=>(function(e,t,r){if(!r)return e;for(let n of Object.keys(r.groups)){let i;let{optional:a,repeat:s}=r.groups[n],o=`[${s?"...":""}${n}]`;a&&(o=`[${o}]`);let l=t[n];i=Array.isArray(l)?l.map(e=>e&&encodeURIComponent(e)).join("/"):l?encodeURIComponent(l):"",e=e.replaceAll(o,i)}return e})(e,t,o)}}({pageIsDynamic:p,page:h,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});E&&!R.locale&&(r.pathname=`/${E}${r.pathname}`);let m=r.pathname,g=f.handleRewrites(e,r),v=Object.keys(g),b=m!==r.pathname;b&&r.pathname&&en(e,"rewroteURL",r.pathname);let w=new Set;for(let[e,t]of Object.entries(r.query)){if(void 0===t)continue;let n=tv(e);n&&(r.query[n]=t,w.add(n),delete r.query[e])}if(p){let t={},i=f.normalizeDynamicRouteParams(r.query,!1);if(!i.hasValidParams&&!t8(a)){let e=null==f.dynamicRouteMatcher?void 0:f.dynamicRouteMatcher.call(f,a);e&&(f.normalizeDynamicRouteParams(e,!1),Object.assign(i.params,e),i.hasValidParams=!0)}if("/index"!==n&&!i.hasValidParams&&!t8(n)){let e=null==f.dynamicRouteMatcher?void 0:f.dynamicRouteMatcher.call(f,n);if(e){let r=f.normalizeDynamicRouteParams(e,!1);r.hasValidParams&&(Object.assign(t,e),i=r)}}i.hasValidParams&&(t=i.params);let s=e.headers["x-now-route-matches"];if("string"==typeof s&&s&&t8(n)&&!i.hasValidParams){let e=f.getParamsFromRouteMatches(s);e&&(i=f.normalizeDynamicRouteParams(e,!0)).hasValidParams&&(t=i.params)}if(!i.hasValidParams&&(i=f.normalizeDynamicRouteParams(r.query,!0)).hasValidParams&&(t=i.params),!f.defaultRouteMatches||a!==h||i.hasValidParams||f.normalizeDynamicRouteParams({...t},!0).hasValidParams||(t=f.defaultRouteMatches,en(e,"didSetDefaultRouteMatches",!0)),t){n=f.interpolateDynamicPath(h,t),e.url=f.interpolateDynamicPath(e.url,t);let r=er(e,"segmentPrefetchRSCRequest");r&&t8(r,!1)&&(r=f.interpolateDynamicPath(r,t),e.headers[eD.toLowerCase()]=r,en(e,"segmentPrefetchRSCRequest",r))}}for(let t of((p||b)&&f.normalizeVercelUrl(e,[...v,...Object.keys((null==(c=f.defaultRouteRegex)?void 0:c.groups)||{})]),w))delete r.query[t];if(r.pathname=n,_.pathname=r.pathname,y=await this.normalizeAndAttachMetadata(e,t,r))return}catch(r){if(r instanceof J||r instanceof Y)return t.statusCode=400,this.renderError(null,e,t,"/_error",{});throw r}if(en(e,"isLocaleDomain",!!b),R.locale&&(e.url=(0,d.format)(_),en(e,"didStripLocale",!0)),!er(e,"locale")&&(R.locale?en(e,"locale",R.locale):E&&(en(e,"locale",E),en(e,"localeInferredFromDefault",!0))),!this.serverOptions.webServerConfig&&!er(e,"incrementalCache")){let t="https:";try{t=new URL(er(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(),en(e,"incrementalCache",r),globalThis.__incrementalCache=r}let x=globalThis;if(x.__nextCacheHandlers){let t=(null==(h=e.headers[eP.vS])?void 0:h.split(","))||[];for(let e of Object.values(x.__nextCacheHandlers))"function"==typeof(null==e?void 0:e.receiveExpiredTags)&&await e.receiveExpiredTags(...t)}er(e,"serverComponentsHmrCache")||en(e,"serverComponentsHmrCache",this.getServerComponentsHmrCache());let P=er(e,"invokePath");if(!w&&P){let n=er(e,"invokeStatus");if(n){let i=er(e,"invokeQuery");i&&Object.assign(r.query,i),t.statusCode=n;let a=er(e,"invokeError")||null;return this.renderError(a,e,t,"/_error",r.query)}let i=new URL(P||"/","http://n"),a=tO(i.pathname,{nextConfig:this.nextConfig,parseData:!1});a.locale&&en(e,"locale",a.locale),r.pathname!==i.pathname&&(r.pathname=i.pathname,en(e,"rewroteURL",a.pathname));let s=tx(tP(r.pathname,this.nextConfig.basePath||""),null==(p=this.nextConfig.i18n)?void 0:p.locales);for(let t of(s.detectedLocale&&en(e,"locale",s.detectedLocale),r.pathname=s.pathname,Object.keys(r.query)))delete r.query[t];let o=er(e,"invokeQuery");if(o&&Object.assign(r.query,o),y=await this.normalizeAndAttachMetadata(e,t,r))return;await this.handleCatchallRenderRequest(e,t,r);return}if(er(e,"middlewareInvoke")){if((y=await this.normalizeAndAttachMetadata(e,t,r))||(y=await this.handleCatchallMiddlewareRequest(e,t,r)))return;let n=Error();throw n.result={response:new Response(null,{headers:{"x-middleware-next":"1"}})},n.bubble=!0,n}return!w&&R.basePath&&(r.pathname=tP(r.pathname,R.basePath)),t.statusCode=200,await this.run(e,t,r)}catch(r){if(r instanceof ns)throw r;if(r&&"object"==typeof r&&"ERR_INVALID_URL"===r.code||r instanceof J||r instanceof Y)return t.statusCode=400,this.renderError(null,e,t,"/_error",{});throw r}}getRequestHandlerWithMetadata(e){let t=this.getRequestHandler();return(r,n,i)=>(r[et]=e,t(r,n,i))}getRequestHandler(){return this.handleRequest.bind(this)}setAssetPrefix(e){this.renderOpts.assetPrefix=e?e.replace(/\/$/,""):""}async prepare(){if(!this.prepared)return null===this.preparedPromise&&(this.instrumentation=await this.loadInstrumentationModule(),this.preparedPromise=this.prepareImpl().then(()=>{this.prepared=!0,this.preparedPromise=null})),this.preparedPromise}async prepareImpl(){}async loadInstrumentationModule(){}async close(){}getAppPathRoutes(){let e={};return Object.keys(this.appPathsManifest||{}).forEach(t=>{let r=eZ(t);e[r]||(e[r]=[]),e[r].push(t)}),e}async run(e,t,r){return(0,ts.getTracer)().trace(to.Li.run,async()=>this.runImpl(e,t,r))}async runImpl(e,t,r){await this.handleCatchallRenderRequest(e,t,r)}async pipe(e,t){return(0,ts.getTracer)().trace(to.Li.pipe,async()=>this.pipeImpl(e,t))}async pipeImpl(e,t){let r=t.req.headers["user-agent"]||"",n=re(r),i={...t,renderOpts:{...this.renderOpts,supportsDynamicResponse:!n,botType:rt(r),serveStreamingMetadata:function(e,{streamingMetadata:t,htmlLimitedBots:r}){if(!t)return!1;let n=RegExp(r||t6,"i");return!!e&&!n.test(e)}(r,this.renderOpts.experimental)}},a=await e(i);if(null===a)return;let{req:s,res:o}=i,l=o.statusCode,{body:u,type:d}=a,{revalidate:c}=a;if(!o.sent){let{generateEtags:e,poweredByHeader:t,dev:r}=this.renderOpts;r&&(o.setHeader("Cache-Control","no-store, must-revalidate"),c=void 0),await this.sendRenderResult(s,o,{result:u,type:d,generateEtags:e,poweredByHeader:t,revalidate:c,expireTime:this.nextConfig.expireTime}),o.statusCode=l}}async getStaticHTML(e,t){let r={...t,renderOpts:{...this.renderOpts,supportsDynamicResponse:!1}},n=await e(r);return null===n?null:n.body.toUnchunkedString()}async render(e,t,r,n={},i,a=!1){return(0,ts.getTracer)().trace(to.Li.render,async()=>this.renderImpl(e,t,r,n,i,a))}getWaitUntil(){let e=function(){let e=globalThis[r3];return null==e?void 0:e.get()}();if(e)return e.waitUntil}getInternalWaitUntil(){}async renderImpl(e,t,r,n={},i,a=!1){var s;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.serverOptions.customServer&&"/index"===r&&!await this.hasPage("/index")&&(r="/"),(s=r,ec.includes(s))?this.render404(e,t,i):this.pipe(e=>this.renderToResponse(e),{req:e,res:t,pathname:r,query:n})}async getStaticPaths({pathname:e}){var t;return{staticPaths:void 0,fallbackMode:function(e){if("string"==typeof e)return"PRERENDER";if(null===e)return"BLOCKING_STATIC_RENDER";if(!1===e)return"NOT_FOUND";if(void 0!==e)throw Object.defineProperty(Error(`Invalid fallback option: ${e}. Fallback option must be a string, null, undefined, or false.`),"__NEXT_ERROR_CODE",{value:"E285",enumerable:!1,configurable:!0})}(null==(t=this.getPrerenderManifest().dynamicRoutes[e])?void 0:t.fallback)}}async renderToResponseWithComponents(e,t){return(0,ts.getTracer)().trace(to.Li.renderToResponseWithComponents,async()=>this.renderToResponseWithComponentsImpl(e,t))}pathCouldBeIntercepted(e){return e4(e)||this.interceptionRoutePatterns.some(t=>t.test(e))}setVaryHeader(e,t,r,n){let i=`RSC, ${eT}, ${eS}, ${eD}`,a=er(e,"isRSCRequest")??!1,s=!1;r&&this.pathCouldBeIntercepted(n)?(t.appendHeader("vary",`${i}, ${eA}`),s=!0):(r||a)&&t.appendHeader("vary",i),s||delete e.headers[eA]}async renderToResponseWithComponentsImpl({req:e,res:t,pathname:n,renderOpts:i},{components:a,query:s}){var o,l,u,c,h,p,f,m,g,v;let y,b,E,_;n===es&&(n="/404");let R="/_error"===n,w="/404"===n||R&&404===t.statusCode,x="/500"===n||R&&500===t.statusCode,P=!0===a.isAppPath,O=!!a.getServerSideProps,C=!!a.getStaticPaths,T=function(e){let t,r;e.headers instanceof Headers?(t=e.headers.get(eC.toLowerCase())??null,r=e.headers.get("content-type")):(t=e.headers[eC.toLowerCase()]??null,r=e.headers["content-type"]??null);let n=!!("POST"===e.method&&"application/x-www-form-urlencoded"===r),i=!!("POST"===e.method&&(null==r?void 0:r.startsWith("multipart/form-data"))),a=!!(void 0!==t&&"string"==typeof t&&"POST"===e.method);return{actionId:t,isURLEncodedAction:n,isMultipartAction:i,isFetchAction:a,isServerAction:!!(a||n||i)}}(e).isServerAction,S=!!(null==(o=a.Component)?void 0:o.getInitialProps),D=!!a.getStaticProps,A=(0,d.parse)(e.url||"").pathname||"/",j=er(e,"rewroteURL")||A;this.setVaryHeader(e,t,P,j);let N=!1,k=t8(a.page),I=this.getPrerenderManifest();if(P&&k){let t=await this.getStaticPaths({pathname:n,page:a.page,isAppPath:P,requestHeaders:e.headers});if(y=t.staticPaths,N=void 0!==(b=t.fallbackMode),"export"===this.nextConfig.output){let e=a.page;if(!y)throw Object.defineProperty(Error(`Page "${e}" is missing exported function "generateStaticParams()", which is required with "output: export" config.`),"__NEXT_ERROR_CODE",{value:"E353",enumerable:!1,configurable:!0});let t=e5(j);if(!y.includes(t))throw Object.defineProperty(Error(`Page "${e}" is missing param "${t}" in "generateStaticParams()", which is required with "output: export" config.`),"__NEXT_ERROR_CODE",{value:"E443",enumerable:!1,configurable:!0})}N&&(C=!0)}let M="html"===rt(e.headers["user-agent"]||"");M&&(this.renderOpts.serveStreamingMetadata=!1),N||(null==y?void 0:y.includes(j))||e.headers["x-now-route-matches"]?D=!0:(D||=!!I.routes[r1(n)],M&&(D=!1));let q=!!(er(e,"isNextDataReq")||e.headers["x-nextjs-data"]&&this.serverOptions.webServerConfig)&&(D||O),L=er(e,"isPrefetchRSCRequest")??!1,$=er(e,"isRSCRequest")??!1;if(!D&&e.headers["x-middleware-prefetch"]&&!(w||"/_error"===n))return t.setHeader(eP.vx,n),t.setHeader("x-middleware-skip","1"),t.setHeader("cache-control","private, no-cache, no-store, max-age=0, must-revalidate"),t.body("{}").send(),null;D&&e.headers[eP.vx]&&e.url.startsWith("/_next/data")&&(e.url=this.stripNextDataPath(e.url));let H=er(e,"locale"),F=D?null==(l=this.nextConfig.i18n)?void 0:l.defaultLocale:er(e,"defaultLocale");e.headers["x-nextjs-data"]&&(!t.statusCode||200===t.statusCode)&&t.setHeader("x-nextjs-matched-path",`${H?`/${H}`:""}${n}`),a.routeModule&&(E=a.routeModule);let z=this.isAppPPREnabled&&void 0!==E&&rJ(E)&&!M,U="1"===process.env.__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING&&void 0!==s.__nextppronly&&z,W=U&&"fallback"===s.__nextppronly,X=z&&((null==(u=I.routes[n]??I.dynamicRoutes[n])?void 0:u.renderingMode)==="PARTIALLY_STATIC"||U&&!0===this.experimentalTestProxy),B=U&&X,G=B&&!1,V=W&&X,J=X?er(e,"postponed"):void 0,Y=X&&$&&!L,Q=er(e,"segmentPrefetchRSCRequest");if(!w||q||$||(t.statusCode=404),eh.includes(n)&&(t.statusCode=parseInt(n.slice(1),10)),!T&&!J&&!w&&!x&&"/_error"!==n&&"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,n),null;if("string"==typeof a.Component)return{type:"html",body:tV.fromStatic(a.Component)};if("amp"in s&&!s.amp&&delete s.amp,!0===i.supportsDynamicResponse){let t=re(e.headers["user-agent"]||""),r="function"!=typeof(null==(p=a.Document)?void 0:p.getInitialProps)||"__NEXT_BUILTIN_DOCUMENT__"in a.Document;i.supportsDynamicResponse=!D&&!t&&!s.amp&&r}!q&&P&&i.dev&&(i.supportsDynamicResponse=!0);let Z=null==(c=this.nextConfig.i18n)?void 0:c.locales,et=!1;if(O||D||P){let{tryGetPreviewData:n}=r("./dist/esm/server/api-utils/node/try-get-preview-data.js");et=!1!==n(e,t,this.renderOpts.previewProps,!!this.nextConfig.experimental.multiZoneDraftMode)}P&&!i.dev&&!et&&D&&$&&!Y&&(!((v=i.runtime)===eP.li.experimentalEdge||v===eP.li.edge)||this.serverOptions.webServerConfig)&&rK(e.headers);let ei=!1,ea=!1;D&&({isOnDemandRevalidate:ei,revalidateOnlyGenerated:ea}=(0,ef.Gx)(e,this.renderOpts.previewProps)),D&&e.headers[eP.vx]&&(j=A),A=e5(A),j=e5(j),this.localeNormalizer&&(j=this.localeNormalizer.normalize(j)),q&&(j=this.stripNextDataPath(j),A=this.stripNextDataPath(A));let eo=null;et||!D||i.supportsDynamicResponse||T||J||Y||(eo=`${H?`/${H}`:""}${("/"===n||"/"===j)&&H?"":j}${s.amp?".amp":""}`),(w||x)&&D&&(eo=`${H?`/${H}`:""}${n}${s.amp?".amp":""}`),eo&&(eo="/index"===(eo=rB(eo))&&"/"===n?"/":eo);let el="https:";try{el=new URL(er(e,"initURL")||"/","http://n").protocol}catch{}let eu=globalThis.__incrementalCache||await this.getIncrementalCache({requestHeaders:Object.assign({},e.headers),requestProtocol:el.substring(0,el.length-1)});eu.resetRequestCache();let ed=async({postponed:r,pagesFallback:o=!1,fallbackRouteParams:l})=>{let u,c=!q&&!0===i.dev||!D&&!C||"string"==typeof r||Y,h=(0,d.parse)(e.url||"",!0).query;i.params&&Object.keys(i.params).forEach(e=>{delete h[e]});let p="/"!==A&&this.nextConfig.trailingSlash,f=(0,d.format)({pathname:`${j}${p?"/":""}`,query:h}),m=!c||M,g={...a,...i,...P?{incrementalCache:eu,isRevalidate:D&&!r&&!Y,serverActions:this.nextConfig.experimental.serverActions}:{},isNextDataRequest:q,resolvedUrl:f,locale:H,locales:Z,defaultLocale:F,multiZoneDraftMode:this.nextConfig.experimental.multiZoneDraftMode,resolvedAsPath:O||S?(0,d.format)({pathname:`${A}${p?"/":""}`,query:h}):f,experimental:{...i.experimental,isRoutePPREnabled:X},supportsDynamicResponse:c,shouldWaitOnAllReady:m,isOnDemandRevalidate:ei,isDraftMode:et,isServerAction:T,postponed:r,waitUntil:this.getWaitUntil(),onClose:t.onClose.bind(t),onAfterTaskError:void 0,setAppIsrStatus:this.setAppIsrStatus};if((B||G)&&(c=!1,g.nextExport=!0,g.supportsDynamicResponse=!1,g.isStaticGeneration=!0,g.isRevalidate=!0,g.isDebugDynamicAccesses=G),E){if(E.definition.kind===tK.APP_ROUTE){var v;if(!tq(e)||!tL(t))throw Object.defineProperty(Error("Invariant: App Route Route Modules cannot be used in the edge runtime"),"__NEXT_ERROR_CODE",{value:"E130",enumerable:!1,configurable:!0});let r={params:i.params,prerenderManifest:I,renderOpts:{experimental:{dynamicIO:g.experimental.dynamicIO,authInterrupts:g.experimental.authInterrupts},supportsDynamicResponse:c,incrementalCache:eu,cacheLifeProfiles:null==(v=this.nextConfig.experimental)?void 0:v.cacheLife,isRevalidate:D,waitUntil:this.getWaitUntil(),onClose:t.onClose.bind(t),onAfterTaskError:void 0,onInstrumentationRequestError:this.renderOpts.onInstrumentationRequestError},sharedContext:{buildId:this.buildId}};try{let n=tz.fromNodeNextRequest(e,function(e){let{errored:t,destroyed:r}=e;if(t||r)return AbortSignal.abort(t??new tH);let{signal:n}=tF(e);return n}(t.originalResponse)),i=await E.handle(n,r);e.fetchMetrics=r.renderOpts.fetchMetrics;let a=r.renderOpts.collectedTags;if(D){let e=await i.blob(),t=tm(i.headers);a&&(t[eP.VC]=a),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let n=void 0!==r.renderOpts.collectedRevalidate&&!(r.renderOpts.collectedRevalidate>=eP.AR)&&r.renderOpts.collectedRevalidate;return{value:{kind:tt.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},revalidate:n,isFallback:!1}}let s=r.renderOpts.pendingWaitUntil;return s&&r.renderOpts.waitUntil&&(r.renderOpts.waitUntil(s),s=void 0),await rW(e,t,i,r.renderOpts.pendingWaitUntil),null}catch(r){if(await this.instrumentationOnRequestError(r,e,{routerKind:"App Router",routePath:n,routeType:"route",revalidateReason:nr(g)}),D)throw r;return eW(r),await rW(e,t,new Response(null,{status:500})),null}}else if(rY(E)||rJ(E)){if("OPTIONS"===e.method&&!w)return await rW(e,t,new Response(null,{status:400})),null;if(rY(E)){g.nextFontManifest=this.nextFontManifest,g.clientReferenceManifest=a.clientReferenceManifest;let r=tq(e)?e.originalRequest:e,l=tL(t)?t.originalResponse:t;try{u=await E.render(r,l,{page:n,params:i.params,query:s,renderOpts:g,sharedContext:{buildId:this.buildId,deploymentId:this.nextConfig.deploymentId,customServer:this.serverOptions.customServer||void 0},renderContext:{isFallback:o,isDraftMode:g.isDraftMode,developmentNotFoundSourcePage:er(e,"developmentNotFoundSourcePage")}})}catch(t){throw await this.instrumentationOnRequestError(t,e,{routerKind:"Pages Router",routePath:n,routeType:"render",revalidateReason:nr({isRevalidate:D,isOnDemandRevalidate:g.isOnDemandRevalidate})}),t}}else{let r=a.routeModule;g.nextFontManifest=this.nextFontManifest;let o={page:w?"/404":n,params:i.params,query:s,fallbackRouteParams:l,renderOpts:g,serverComponentsHmrCache:this.getServerComponentsHmrCache(),sharedContext:{buildId:this.buildId}};this.nextConfig.experimental.dynamicIO,u=await r.render(e,t,o)}}else throw Object.defineProperty(Error("Invariant: Unknown route module type"),"__NEXT_ERROR_CODE",{value:"E450",enumerable:!1,configurable:!0})}else u=await this.renderHTML(e,t,n,s,g);let{metadata:y}=u,{headers:b={},fetchTags:_}=y;if(_&&(b[eP.VC]=_),e.fetchMetrics=y.fetchMetrics,P&&D&&0===y.revalidate&&!X){let e=y.staticBailoutInfo,t=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${A}${(null==e?void 0:e.description)?`, reason: ${e.description}`:""}
32
- see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});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 y&&y.isNotFound?{value:null,revalidate:y.revalidate,isFallback:!1}:y.isRedirect?{value:{kind:tt.REDIRECT,props:y.pageData??y.flightData},revalidate:y.revalidate,isFallback:!1}:u.isNull?null:P?{value:{kind:tt.APP_PAGE,html:u,headers:b,rscData:y.flightData,postponed:y.postponed,status:t.statusCode,segmentData:y.segmentData},revalidate:y.revalidate,isFallback:!!l}:{value:{kind:tt.PAGES,html:u,pageData:y.pageData??y.flightData,headers:b,status:P?t.statusCode:void 0},revalidate:y.revalidate,isFallback:o}},ec=async({hasResolved:r,previousCacheEntry:o,isRevalidating:l})=>{if(r||t.sent,!y&&k){if(C){let t=await this.getStaticPaths({pathname:n,requestHeaders:e.headers,isAppPath:P,page:a.page});y=t.staticPaths,b=t.fallbackMode}else y=void 0,b=nn.NOT_FOUND}b===nn.PRERENDER&&re(e.headers["user-agent"]||"")&&(b=nn.BLOCKING_STATIC_RENDER),(null==o?void 0:o.isStale)===-1&&(ei=!0),ei&&(b!==nn.NOT_FOUND||o)&&(b=nn.BLOCKING_STATIC_RENDER);let u=eo;!u&&i.dev&&P&&(u=rB(j)),u&&s.amp&&(u=u.replace(/\.amp$/,"")),u&&(null==y||y.includes(u)),this.nextConfig.experimental.isExperimentalCompile&&(b=nn.BLOCKING_STATIC_RENDER);let d=ei||l||!J?void 0:J;if((B||G)&&void 0!==d)return{revalidate:1,isFallback:!1,value:{kind:tt.PAGES,html:tV.fromStatic(""),pageData:{},headers:void 0,status:void 0}};let c=k&&X&&(er(e,"didSetDefaultRouteMatches")||V)?function(e){let t;if(0===(t="string"==typeof e?Object.keys(ee(e7(e))(e)):e).length)return null;let r=new Map,n=Math.random().toString(16).slice(2);for(let e of t)r.set(e,`%%drp:${e}:${n}%%`);return r}(n):null,h=await ed({postponed:d,pagesFallback:void 0,fallbackRouteParams:c});return h?{...h,revalidate:h.revalidate}:null},ep=await this.responseCache.get(eo,ec,{routeKind:(null==E?void 0:E.definition.kind)??(P?tK.APP_PAGE:tK.PAGES),incrementalCache:eu,isOnDemandRevalidate:ei,isPrefetch:"prefetch"===e.headers.purpose,isRoutePPREnabled:X});if(et&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),!ep){if(eo&&!(ei&&ea))throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}let eg=(null==(h=ep.value)?void 0:h.kind)===tt.APP_PAGE&&"string"==typeof ep.value.postponed&&!M;D&&!Y&&(!eg||L)&&t.setHeader("x-nextjs-prerender","1");let{value:ev}=ep;if("string"==typeof Q&&(null==ev?void 0:ev.kind)===tt.APP_PAGE&&ev.segmentData){t.setHeader(ek,"2");let e=ev.segmentData.get(Q);return void 0!==e?{type:"rsc",body:tV.fromStatic(e),revalidate:ep.revalidate}:(t.statusCode=204,{type:"rsc",body:tV.fromStatic(""),revalidate:null==ep?void 0:ep.revalidate})}if((null==ev?void 0:ev.kind)===tt.IMAGE)throw Object.defineProperty(Error("invariant SSG should not return an image cache value"),"__NEXT_ERROR_CODE",{value:"E390",enumerable:!1,configurable:!0});if(J)_=0;else if($&&!L&&X)_=0;else if(1){if(et)_=0;else if(D){if(w){let t=er(e,"notFoundRevalidate");_=void 0===t?0:t}else if(x)_=0;else if("number"==typeof ep.revalidate){if(ep.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${ep.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});_=ep.revalidate}else!1===ep.revalidate&&(_=eP.qF)}else t.getHeader("Cache-Control")||(_=0)}ep.revalidate=_;let ey=er(e,"onCacheEntry");if(ey&&await ey({...ep,value:{...ep.value,kind:(null==(f=ep.value)?void 0:f.kind)===tt.APP_PAGE?"PAGE":null==(m=ep.value)?void 0:m.kind}},{url:er(e,"initURL")}))return null;if(ev){if(ev.kind===tt.REDIRECT)return(void 0===ep.revalidate||t.getHeader("Cache-Control")||t.setHeader("Cache-Control",eO({revalidate:ep.revalidate,expireTime:this.nextConfig.expireTime})),q)?{type:"json",body:tV.fromStatic(JSON.stringify(ev.props)),revalidate:ep.revalidate}:(await (e=>{let r={destination:e.pageProps.__N_REDIRECT,statusCode:e.pageProps.__N_REDIRECT_STATUS,basePath:e.pageProps.__N_REDIRECT_BASE_PATH},n=r.statusCode||(r.permanent?em.PermanentRedirect:em.TemporaryRedirect),{basePath:i}=this.nextConfig;i&&!1!==r.basePath&&r.destination.startsWith("/")&&(r.destination=`${i}${r.destination}`),r.destination.startsWith("/")&&(r.destination=K(r.destination)),t.redirect(r.destination,n).body(r.destination).send()})(ev.props),null);if(ev.kind===tt.APP_ROUTE){let r=tp(ev.headers);return D||r.delete(eP.VC),void 0===ep.revalidate||t.getHeader("Cache-Control")||r.get("Cache-Control")||r.set("Cache-Control",eO({revalidate:ep.revalidate,expireTime:this.nextConfig.expireTime})),await rW(e,t,new Response(ev.body,{headers:r,status:ev.status||200})),null}if(ev.kind===tt.APP_PAGE){if(eg&&J)throw Object.defineProperty(Error("Invariant: postponed state should not be present on a resume request"),"__NEXT_ERROR_CODE",{value:"E396",enumerable:!1,configurable:!0});if(ev.headers){let e={...ev.headers};for(let[r,n]of(D||delete e[eP.VC],Object.entries(e)))if(void 0!==n){if(Array.isArray(n))for(let e of n)t.appendHeader(r,e);else"number"==typeof n&&(n=n.toString()),t.appendHeader(r,n)}}if(D&&(null==(g=ev.headers)?void 0:g[eP.VC])&&t.setHeader(eP.VC,ev.headers[eP.VC]),!ev.status||$&&X||(t.statusCode=ev.status),eg&&t.setHeader(ek,"1"),$&&!et){if(void 0===ev.rscData){if(ev.postponed)throw Object.defineProperty(Error("Invariant: Expected postponed to be undefined"),"__NEXT_ERROR_CODE",{value:"E372",enumerable:!1,configurable:!0});return{type:"rsc",body:ev.html,revalidate:Y?0:ep.revalidate}}return{type:"rsc",body:tV.fromStatic(ev.rscData),revalidate:ep.revalidate}}return{type:"html",body:ev.html,revalidate:ep.revalidate}}return q?{type:"json",body:tV.fromStatic(JSON.stringify(ev.pageData)),revalidate:ep.revalidate}:{type:"html",body:ev.html,revalidate:ep.revalidate}}return(en(e,"notFoundRevalidate",ep.revalidate),void 0===ep.revalidate||t.getHeader("Cache-Control")||t.setHeader("Cache-Control",eO({revalidate:ep.revalidate,expireTime:this.nextConfig.expireTime})),q)?(t.statusCode=404,t.body('{"notFound":true}').send()):await this.render404(e,t,{pathname:n,query:s},!1),null}stripNextDataPath(e,t=!0){return(e.includes(this.buildId)&&(e=rr(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;let{query:n,pathname:i}=e,a=this.getOriginalAppPaths(i),s=Array.isArray(a),o=i;s&&(o=a[a.length-1]);let l=await this.findPageComponents({locale:er(e.req,"locale"),page:o,query:n,params:e.renderOpts.params||{},isAppPath:s,sriEnabled:!!(null==(r=this.nextConfig.experimental.sri)?void 0:r.algorithm),appPaths:a,shouldEnsure:!1});if(l){(0,ts.getTracer)().setRootSpanAttribute("next.route",i);try{return await this.renderToResponseWithComponents(e,l)}catch(r){let e=r instanceof ns;if(!e||e&&t)throw r}}return!1}async renderToResponse(e){return(0,ts.getTracer)().trace(to.Li.renderToResponse,{spanName:"rendering page",attributes:{"next.route":e.pathname}},async()=>this.renderToResponseImpl(e))}async renderToResponseImpl(e){var t;let{req:r,res:n,query:i,pathname:a}=e,s=er(e.req,"bubbleNoFallback")??!1;delete i[eN];let o={i18n:null==(t=this.i18nProvider)?void 0:t.fromRequest(r,a)};try{for await(let t of this.matchers.matchAll(a,o)){er(e.req,"invokeOutput");let r=await this.renderPageComponent({...e,pathname:t.definition.pathname,renderOpts:{...e.renderOpts,params:t.params}},s);if(!1!==r)return r}if(this.serverOptions.webServerConfig){e.pathname=this.serverOptions.webServerConfig.page;let t=await this.renderPageComponent(e,s);if(!1!==t)return t}}catch(i){let t=ru(i);if(i instanceof Z)throw console.error("Invariant: failed to load static page",JSON.stringify({page:a,url:e.req.url,matchedPath:e.req.headers[eP.vx],initUrl:er(e.req,"initURL"),didRewrite:!!er(e.req,"rewroteURL"),rewroteUrl:er(e.req,"rewroteURL")},null,2)),t;if(t instanceof ns&&s)throw t;if(t instanceof J||t instanceof Y)return n.statusCode=400,await this.renderErrorToResponse(e,t);n.statusCode=500,await this.hasPage("/500")&&(en(e.req,"customErrorRender",!0),await this.renderErrorToResponse(e,t),ei(e.req,"customErrorRender"));let r=t instanceof no;if(!r)throw rl(t)&&(t.page=a),t;return await this.renderErrorToResponse(e,r?t.innerError:t)}if(this.getMiddleware()&&e.req.headers["x-nextjs-data"]&&(!n.statusCode||200===n.statusCode||404===n.statusCode)){let e=er(r,"locale");return n.setHeader("x-nextjs-matched-path",`${e?`/${e}`:""}${a}`),n.statusCode=200,n.setHeader("content-type","application/json"),n.body("{}"),n.send(),null}return n.statusCode=404,this.renderErrorToResponse(e,null)}async renderToHTML(e,t,r,n={}){return(0,ts.getTracer)().trace(to.Li.renderToHTML,async()=>this.renderToHTMLImpl(e,t,r,n))}async renderToHTMLImpl(e,t,r,n={}){return this.getStaticHTML(e=>this.renderToResponse(e),{req:e,res:t,pathname:r,query:n})}async renderError(e,t,r,n,i={},a=!0){return(0,ts.getTracer)().trace(to.Li.renderError,async()=>this.renderErrorImpl(e,t,r,n,i,a))}async renderErrorImpl(e,t,r,n,i={},a=!0){return a&&r.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),this.pipe(async t=>{let n=await this.renderErrorToResponse(t,e);if(500===r.statusCode)throw e;return n},{req:t,res:r,pathname:n,query:i})}async renderErrorToResponse(e,t){return(0,ts.getTracer)().trace(to.Li.renderErrorToResponse,async()=>this.renderErrorToResponseImpl(e,t))}async renderErrorToResponseImpl(e,t){let{res:r,query:n}=e;try{let i=null;404===r.statusCode&&(this.enabledDirectories.app&&(i=await this.findPageComponents({locale:er(e.req,"locale"),page:eo,query:n,params:{},isAppPath:!0,shouldEnsure:!0,url:e.req.url})),!i&&await this.hasPage("/404")&&(i=await this.findPageComponents({locale:er(e.req,"locale"),page:"/404",query:n,params:{},isAppPath:!1,shouldEnsure:!0,url:e.req.url})));let a=`/${r.statusCode}`;if(!er(e.req,"customErrorRender")&&!i&&eh.includes(a)&&(i=await this.findPageComponents({locale:er(e.req,"locale"),page:a,query:n,params:{},isAppPath:!1,shouldEnsure:!0,url:e.req.url})),i||(i=await this.findPageComponents({locale:er(e.req,"locale"),page:"/_error",query:n,params:{},isAppPath:!1,shouldEnsure:!0,url:e.req.url}),a="/_error"),!i)throw new no(Object.defineProperty(Error("missing required error components"),"__NEXT_ERROR_CODE",{value:"E60",enumerable:!1,configurable:!0}));i.components.routeModule?en(e.req,"match",{definition:i.components.routeModule.definition,params:void 0}):ei(e.req,"match");try{return await this.renderToResponseWithComponents({...e,pathname:a,renderOpts:{...e.renderOpts,err:t}},i)}catch(e){if(e instanceof ns)throw Object.defineProperty(Error("invariant: failed to render error page"),"__NEXT_ERROR_CODE",{value:"E55",enumerable:!1,configurable:!0});throw e}}catch(s){let t=ru(s),i=t instanceof no;i||this.logError(t),r.statusCode=500;let a=await this.getFallbackErrorComponents(e.req.url);if(a)return en(e.req,"match",{definition:a.routeModule.definition,params:void 0}),this.renderToResponseWithComponents({...e,pathname:"/_error",renderOpts:{...e.renderOpts,err:i?t.innerError:t}},{query:n,components:a});return{type:"html",body:tV.fromStatic("Internal Server Error")}}}async renderErrorToHTML(e,t,r,n,i={}){return this.getStaticHTML(t=>this.renderErrorToResponse(t,e),{req:t,res:r,pathname:n,query:i})}async render404(e,t,r,n=!0){let{pathname:i,query:a}=r||(0,d.parse)(e.url,!0);return this.nextConfig.i18n&&(er(e,"locale")||en(e,"locale",this.nextConfig.i18n.defaultLocale),en(e,"defaultLocale",this.nextConfig.i18n.defaultLocale)),t.statusCode=404,this.renderError(null,e,t,i,a,n)}}let nu=require("vm");function nd(e){if(Object.isFrozen(e))return e;if(Array.isArray(e)){for(let t of e)t&&"object"==typeof t&&nd(t);return Object.freeze(e)}for(let t of Object.values(e))t&&"object"==typeof t&&nd(t);return Object.freeze(e)}let nc=new Map;function nh(e,t=!0,r=nc){let n=t&&r.get(e);if(n)return n;let i=JSON.parse((0,h.readFileSync)(e,"utf8"));return t&&(i=nd(i)),t&&r.set(e,i),i}let np=new eL(1e3);function nf(e,t,r,n){let i;let a=`${e}:${t}:${r}:${n}`,s=null==np?void 0:np.get(a);if(s)return s;let o=u().join(t,ed);n&&(i=nh(u().join(o,eu),!0));let l=nh(u().join(o,el),!0);try{e=rr(rb(e))}catch(t){throw console.error(t),new Q(e)}let d=t=>{let n=t[e];if(!t[n]&&r){let i={};for(let e of Object.keys(t))i[tx(e,r).pathname]=l[e];n=i[e]}return n};return(i&&(s=d(i)),s||(s=d(l)),s)?(s=u().join(o,s),null==np||np.set(a,s),s):(null==np||np.set(a,null),null)}function nm(e,t,r,n){let i=nf(e,t,r,n);if(!i)throw new Q(e);return i}async function ng(e,t,r){let n=nm(e,t,void 0,r);if(n.endsWith(".html"))return h.promises.readFile(n,"utf8").catch(t=>{throw new Z(e,t.message)});try{return process.env.__NEXT_PRIVATE_RUNTIME_TYPE=r?"app":"pages",require(n)}finally{process.env.__NEXT_PRIVATE_RUNTIME_TYPE=""}}function nv(e){return e.default||e}async function ny(e){return new Promise(t=>setTimeout(t,e))}let nb=Symbol.for("next.server.action-manifests");async function nE(e,t=3){for(;;)try{return nh(e)}catch(e){if(--t<=0)throw e;await ny(100)}}async function n_(e,t=3){try{return await nE(e,t)}catch(e){return}}async function nR(e,t=3){for(;;)try{return function(e,t=!0,r=nc){let n=t&&r.get(e);if(n)return n;let i=(0,h.readFileSync)(e,"utf8");if(0===i.length)throw Object.defineProperty(Error("Manifest file is empty"),"__NEXT_ERROR_CODE",{value:"E328",enumerable:!1,configurable:!0});let a={};return(0,nu.runInNewContext)(i,a),t&&(a=nd(a)),t&&r.set(e,a),a}(e)}catch(e){if(--t<=0)throw e;await ny(100)}}async function nw(e,t,r){try{return(await nR(e,r)).__RSC_MANIFEST[t]}catch(e){return}}async function nx({distDir:e,page:t,isAppPath:r,isDev:n,sriEnabled:i}){let a,s={},o={};r||([s,o]=await Promise.all([ng("/_document",e,!1),ng("/_app",e,!1)]));let u=n?3:1;a=(0,l.join)(e,"react-loadable-manifest.json");let[d,c,h,p,f,m]=await Promise.all([nE((0,l.join)(e,"build-manifest.json"),u),n_(a,u),r?void 0:nE((0,l.join)(e,"dynamic-css-manifest.json"),u).catch(()=>void 0),r?nw((0,l.join)(e,"server","app",t.replace(/%5F/g,"_")+"_client-reference-manifest.js"),t.replace(/%5F/g,"_"),u):void 0,r?nE((0,l.join)(e,"server","server-reference-manifest.json"),u).catch(()=>null):null,i?nE((0,l.join)(e,"server","subresource-integrity-manifest.json")).catch(()=>void 0):void 0]);f&&p&&function({page:e,clientReferenceManifest:t,serverActionsManifest:r,serverModuleMap:n}){var i;let a=null==(i=globalThis[nb])?void 0:i.clientReferenceManifestsPerPage;globalThis[nb]={clientReferenceManifestsPerPage:{...a,[eZ(e)]:t},serverActionsManifest:r,serverModuleMap:n}}({page:t,clientReferenceManifest:p,serverActionsManifest:f,serverModuleMap:function({serverActionsManifest:e}){return new Proxy({},{get:(t,r)=>{var n;let i;let a=e.node[r].workers,s=L.workAsyncStorage.getStore();if(!(i=s?a[t_(n=s.page,"app")?n:"app"+n]:Object.values(a).at(0)))return;let{moduleId:o,async:l}=i;return{id:o,name:r,chunks:[],async:l}}})}({serverActionsManifest:f})});let g=await ng(t,e,r),v=nv(g),y=nv(s),b=nv(o),{getServerSideProps:E,getStaticProps:_,getStaticPaths:R,routeModule:w}=g;return{App:b,Document:y,Component:v,buildManifest:d,subresourceIntegrityManifest:m,reactLoadableManifest:c||{},dynamicCssManifest:h,pageConfig:g.config||{},ComponentMod:g,getServerSideProps:E,getStaticProps:_,getStaticPaths:R,clientReferenceManifest:p,serverActionsManifest:f,isAppPath:r,page:t,routeModule:w}}let nP=(0,ts.getTracer)().wrap(to.p2.loadComponents,nx);function nO(e){return(t,r,n)=>{for(let i of e)if(new RegExp(i.regexp).exec(t)&&(!i.has&&!i.missing||rs(r,n,i.has,i.missing)))return!0;return!1}}var nC=r("../next-env/dist/index.js");let nT=require("stream");var nS=/*#__PURE__*/r.n(nT);let nD=require("next/dist/server/lib/incremental-cache/tags-manifest.external.js");class nA{constructor(e){this.fs=e,this.tasks=[]}findOrCreateTask(e){for(let t of this.tasks)if(t[0]===e)return t;let t=this.fs.mkdir(e);t.catch(()=>{});let r=[e,t,[]];return this.tasks.push(r),r}append(e,t){let r=this.findOrCreateTask(rv().dirname(e)),n=r[1].then(()=>this.fs.writeFile(e,t));n.catch(()=>{}),r[2].push(n)}wait(){return Promise.all(this.tasks.flatMap(e=>e[2]))}}class nj{constructor(e){this.fs=e.fs,this.flushToDisk=e.flushToDisk,this.serverDistDir=e.serverDistDir,this.revalidatedTags=e.revalidatedTags,this.debug=!!process.env.NEXT_PRIVATE_DEBUG_CACHE,e.maxMemoryCacheSize?t||(this.debug&&console.log("using memory store for fetch cache"),t=new eL(e.maxMemoryCacheSize,function({value:e}){var t;if(!e)return 25;if(e.kind===tt.REDIRECT)return JSON.stringify(e.props).length;if(e.kind===tt.IMAGE)throw Object.defineProperty(Error("invariant image should not be incremental-cache"),"__NEXT_ERROR_CODE",{value:"E501",enumerable:!1,configurable:!0});return e.kind===tt.FETCH?JSON.stringify(e.data||"").length:e.kind===tt.APP_ROUTE?e.body.length:e.html.length+((null==(t=JSON.stringify(e.kind===tt.APP_PAGE?e.rscData:e.pageData))?void 0:t.length)||0)})):this.debug&&console.log("not using memory store for fetch cache")}resetRequestCache(){}async revalidateTag(...e){let[t]=e;if(t="string"==typeof t?[t]:t,this.debug&&console.log("revalidateTag",t),0!==t.length)for(let e of t){let t=nD.tagsManifest.items[e]||{};t.revalidatedAt=Date.now(),nD.tagsManifest.items[e]=t}}async get(...e){var r,n,i,a,s,o;let[l,u]=e,{tags:d,softTags:c,kind:h,isRoutePPREnabled:p,isFallback:f}=u,m=null==t?void 0:t.get(l);if(this.debug&&console.log("get",l,d,h,!!m),!m){if(h===tr.APP_ROUTE)try{let e=this.getFilePath(`${l}.body`,tr.APP_ROUTE),t=await this.fs.readFile(e),{mtime:r}=await this.fs.stat(e),n=JSON.parse(await this.fs.readFile(e.replace(/\.body$/,eP.EP),"utf8"));return{lastModified:r.getTime(),value:{kind:tt.APP_ROUTE,body:t,headers:n.headers,status:n.status}}}catch{return null}try{let e=this.getFilePath(h===tr.FETCH?l:`${l}.html`,h),r=await this.fs.readFile(e,"utf8"),{mtime:n}=await this.fs.stat(e);if(h===tr.FETCH){if(!this.flushToDisk)return null;let e=n.getTime(),t=JSON.parse(r);if(m={lastModified:e,value:t},(null==(a=m.value)?void 0:a.kind)===tt.FETCH){let e=null==(s=m.value)?void 0:s.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,m.value,{tags:d,isRoutePPREnabled:p}))}}else if(h===tr.APP_PAGE){let t,i,a;try{t=JSON.parse(await this.fs.readFile(e.replace(/\.html$/,eP.EP),"utf8"))}catch{}if(null==t?void 0:t.segmentPaths){let e=new Map;i=e;let r=l+eP.mH;await Promise.all(t.segmentPaths.map(async t=>{let n=this.getFilePath(r+t+eP.tz,tr.APP_PAGE);try{e.set(t,await this.fs.readFile(n))}catch{}}))}f||(a=await this.fs.readFile(this.getFilePath(`${l}${p?eP.pu:eP.RM}`,tr.APP_PAGE))),m={lastModified:n.getTime(),value:{kind:tt.APP_PAGE,html:r,rscData:a,postponed:null==t?void 0:t.postponed,headers:null==t?void 0:t.headers,status:null==t?void 0:t.status,segmentData:i}}}else if(h===tr.PAGES){let e;let t={};f||(t=JSON.parse(await this.fs.readFile(this.getFilePath(`${l}${eP.x3}`,tr.PAGES),"utf8"))),m={lastModified:n.getTime(),value:{kind:tt.PAGES,html:r,pageData:t,headers:null==e?void 0:e.headers,status:null==e?void 0:e.status}}}else throw Object.defineProperty(Error(`Invariant: Unexpected route kind ${h} in file system cache.`),"__NEXT_ERROR_CODE",{value:"E445",enumerable:!1,configurable:!0});m&&(null==t||t.set(l,m))}catch{return null}}if((null==m?void 0:null==(r=m.value)?void 0:r.kind)===tt.APP_PAGE||(null==m?void 0:null==(n=m.value)?void 0:n.kind)===tt.PAGES){let e;let t=null==(o=m.value.headers)?void 0:o[eP.VC];if("string"==typeof t&&(e=t.split(",")),(null==e?void 0:e.length)&&e.some(e=>{var t;return(null==nD.tagsManifest?void 0:null==(t=nD.tagsManifest.items[e])?void 0:t.revalidatedAt)&&(null==nD.tagsManifest?void 0:nD.tagsManifest.items[e].revalidatedAt)>=((null==m?void 0:m.lastModified)||Date.now())}))return null}else(null==m?void 0:null==(i=m.value)?void 0:i.kind)===tt.FETCH&&[...d||[],...c||[]].some(e=>{var t;return!!this.revalidatedTags.includes(e)||(null==nD.tagsManifest?void 0:null==(t=nD.tagsManifest.items[e])?void 0:t.revalidatedAt)&&(null==nD.tagsManifest?void 0:nD.tagsManifest.items[e].revalidatedAt)>=((null==m?void 0:m.lastModified)||Date.now())})&&(m=void 0);return m??null}async set(...e){let[r,n,i]=e,{isFallback:a}=i;if(null==t||t.set(r,{value:n,lastModified:Date.now()}),this.debug&&console.log("set",r),!this.flushToDisk||!n)return;let s=new nA(this.fs);if(n.kind===tt.APP_ROUTE){let e=this.getFilePath(`${r}.body`,tr.APP_ROUTE);s.append(e,n.body);let t={headers:n.headers,status:n.status,postponed:void 0,segmentPaths:void 0};s.append(e.replace(/\.body$/,eP.EP),JSON.stringify(t,null,2))}else if(n.kind===tt.PAGES||n.kind===tt.APP_PAGE){let e=n.kind===tt.APP_PAGE,t=this.getFilePath(`${r}.html`,e?tr.APP_PAGE:tr.PAGES);if(s.append(t,n.html),a||s.append(this.getFilePath(`${r}${e?i.isRoutePPREnabled?eP.pu:eP.RM:eP.x3}`,e?tr.APP_PAGE:tr.PAGES),e?n.rscData:JSON.stringify(n.pageData)),(null==n?void 0:n.kind)===tt.APP_PAGE){let e;if(n.segmentData){e=[];let r=t.replace(/\.html$/,eP.mH);for(let[t,i]of n.segmentData){e.push(t);let n=r+t+eP.tz;s.append(n,i)}}let r={headers:n.headers,status:n.status,postponed:n.postponed,segmentPaths:e};s.append(t.replace(/\.html$/,eP.EP),JSON.stringify(r))}}else if(n.kind===tt.FETCH){let e=this.getFilePath(r,tr.FETCH);s.append(e,JSON.stringify({...n,tags:i.tags}))}await s.wait()}getFilePath(e,t){switch(t){case tr.FETCH:return rv().join(this.serverDistDir,"..","cache","fetch-cache",e);case tr.PAGES:return rv().join(this.serverDistDir,"pages",e);case tr.IMAGE:case tr.APP_PAGE:case tr.APP_ROUTE:return rv().join(this.serverDistDir,"app",e);default:throw Object.defineProperty(Error(`Unexpected file path kind: ${t}`),"__NEXT_ERROR_CODE",{value:"E479",enumerable:!1,configurable:!0})}}}class nN{static #e=this.timings=new Map;constructor(e){this.prerenderManifest=e}get(e){var t,r;let n=nN.timings.get(e);if(void 0!==n||void 0!==(n=null==(t=this.prerenderManifest.routes[e])?void 0:t.initialRevalidateSeconds)||void 0!==(n=null==(r=this.prerenderManifest.dynamicRoutes[e])?void 0:r.fallbackRevalidate))return n}set(e,t){nN.timings.set(e,t)}clear(){nN.timings.clear()}}let nk=r2?new r2:new class{disable(){throw r4}getStore(){}run(){throw r4}exit(){throw r4}enterWith(){throw r4}static bind(e){return e}};class nI{constructor({fs:e,dev:t,flushToDisk:r,minimalMode:n,serverDistDir:i,requestHeaders:a,requestProtocol:s,maxMemoryCacheSize:o,getPrerenderManifest:l,fetchCacheKeyPrefix:u,CurCacheHandler:d,allowedRevalidateHeaderKeys:c}){var h,p,f,m;this.locks=new Map;let g=!!process.env.NEXT_PRIVATE_DEBUG_CACHE;this.hasCustomCacheHandler=!!d;let v=Symbol.for("@next/cache-handlers"),y=globalThis;if(d)g&&console.log("using custom cache handler",d.name);else{let t=y[v];(null==t?void 0:t.FetchCache)?d=t.FetchCache:e&&i&&(g&&console.log("using filesystem cache handler"),d=nj)}process.env.__NEXT_TEST_MAX_ISR_CACHE&&(o=parseInt(process.env.__NEXT_TEST_MAX_ISR_CACHE,10)),this.dev=t,this.disableForTestmode="true"===process.env.NEXT_PRIVATE_TEST_PROXY,this.minimalMode=n,this.requestHeaders=a,this.requestProtocol=s,this.allowedRevalidateHeaderKeys=c,this.prerenderManifest=l(),this.revalidateTimings=new nN(this.prerenderManifest),this.fetchCacheKeyPrefix=u;let b=[];a[eP.kz]===(null==(p=this.prerenderManifest)?void 0:null==(h=p.preview)?void 0:h.previewModeId)&&(this.isOnDemandRevalidate=!0),n&&"string"==typeof a[eP.vS]&&a[eP.c1]===(null==(m=this.prerenderManifest)?void 0:null==(f=m.preview)?void 0:f.previewModeId)&&(b=a[eP.vS].split(",")),d&&(this.cacheHandler=new d({dev:t,fs:e,flushToDisk:r,serverDistDir:i,revalidatedTags:b,maxMemoryCacheSize:o,_requestHeaders:a,fetchCacheKeyPrefix:u}))}calculateRevalidate(e,t,r,n){if(r)return Math.floor(performance.timeOrigin+performance.now()-1e3);let i=this.revalidateTimings.get(r1(e))??(!n&&1);return"number"==typeof i?1e3*i+t:i}_getPathname(e,t){return t?e:rb(e)}resetRequestCache(){var e,t;null==(t=this.cacheHandler)||null==(e=t.resetRequestCache)||e.call(t)}async lock(e){let t=()=>Promise.resolve(),r=this.locks.get(e);r&&await r;let n=new Promise(r=>{t=async()=>{r(),this.locks.delete(e)}});return this.locks.set(e,n),t}async revalidateTag(e){var t,r;return Promise.all([Object.values(globalThis.__nextCacheHandlers||{}).map(t=>"function"==typeof t.expireTags&&t.expireTags(...Array.isArray(e)?e:[e])),null==(r=this.cacheHandler)?void 0:null==(t=r.revalidateTag)?void 0:t.call(r,e)]).then(()=>{})}async generateCacheKey(e,t={}){let n=[],i=new TextEncoder,a=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(i.encode(e)),n.push(e)):(r.push(e),n.push(a.decode(e,{stream:!0})))}})),n.push(a.decode());let s=r.reduce((e,t)=>e+t.length,0),o=new Uint8Array(s),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);n.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();n.push(await e.text()),t._ogBody=new Blob([r],{type:e.type})}else"string"==typeof t.body&&(n.push(t.body),t._ogBody=t.body)}let s="function"==typeof(t.headers||{}).keys?Object.fromEntries(t.headers):Object.assign({},t.headers);"traceparent"in s&&delete s.traceparent,"tracestate"in s&&delete s.tracestate;let o=JSON.stringify(["v3",this.fetchCacheKeyPrefix||"",e,t.method,s,t.mode,t.redirect,t.credentials,t.referrer,t.referrerPolicy,t.integrity,t.cache,n]);return r("crypto").createHash("sha256").update(o).digest("hex")}async get(e,t){var r,n;let i,a;if(t.kind===tr.FETCH){let t=nk.getStore(),r=t?(0,A.getRenderResumeDataCache)(t):null;if(r){let t=r.fetch.get(e);if((null==t?void 0:t.kind)===tt.FETCH)return{isStale:!1,value:t,revalidateAfter:!1,isFallback:!1}}}if(this.disableForTestmode||this.dev&&(t.kind!==tr.FETCH||"no-cache"===this.requestHeaders["cache-control"]))return null;let{isFallback:s}=t;e=this._getPathname(e,t.kind===tr.FETCH);let o=null,l=t.revalidate,u=await (null==(r=this.cacheHandler)?void 0:r.get(e,t));if((null==u?void 0:null==(n=u.value)?void 0:n.kind)===tt.FETCH){if([...t.tags||[],...t.softTags||[]].some(e=>{var t;return null==(t=this.revalidatedTags)?void 0:t.includes(e)}))return null;l=l||u.value.revalidate;let e=(performance.timeOrigin+performance.now()-(u.lastModified||0))/1e3>l,r=u.value.data;return{isStale:e,value:{kind:tt.FETCH,data:r,revalidate:l},revalidateAfter:performance.timeOrigin+performance.now()+1e3*l,isFallback:s}}let d=this.revalidateTimings.get(r1(e));return(null==u?void 0:u.lastModified)===-1?(i=-1,a=-1*eP.qF):i=!!(!1!==(a=this.calculateRevalidate(e,(null==u?void 0:u.lastModified)||performance.timeOrigin+performance.now(),!!this.dev&&t.kind!==tr.FETCH,t.isFallback))&&a<performance.timeOrigin+performance.now())||void 0,u&&(o={isStale:i,curRevalidate:d,revalidateAfter:a,value:u.value,isFallback:s}),!u&&this.prerenderManifest.notFoundRoutes.includes(e)&&(o={isStale:i,value:null,curRevalidate:d,revalidateAfter:a,isFallback:s},this.set(e,o.value,t)),o}async set(e,t,r){if((null==t?void 0:t.kind)===tt.FETCH){let r=nk.getStore(),n=r?(0,A.getPrerenderResumeDataCache)(r):null;n&&n.fetch.set(e,t)}if(this.disableForTestmode||this.dev&&!r.fetchCache)return;e=this._getPathname(e,r.fetchCache);let n=JSON.stringify(t).length;if(r.fetchCache&&!this.hasCustomCacheHandler&&n>2097152){if(this.dev)throw Object.defineProperty(Error(`Failed to set Next.js data cache, items over 2MB can not be cached (${n} bytes)`),"__NEXT_ERROR_CODE",{value:"E86",enumerable:!1,configurable:!0});return}try{var i;void 0===r.revalidate||r.fetchCache||this.revalidateTimings.set(r1(e),r.revalidate),await (null==(i=this.cacheHandler)?void 0:i.set(e,t,r))}catch(t){console.warn("Failed to update prerender cache for",e,t)}}}let nM=require("http"),nq=require("https"),nL={existsSync:p().existsSync,readFile:p().promises.readFile,readFileSync:p().readFileSync,writeFile:(e,t)=>p().promises.writeFile(e,t),mkdir:e=>p().promises.mkdir(e,{recursive:!0}),stat:e=>p().promises.stat(e)};class n$ extends nS().Readable{constructor({url:e,headers:t,method:r,socket:n=null,readable:i}){super(),this.httpVersion="1.0",this.httpVersionMajor=1,this.httpVersionMinor=0,this.socket=new Proxy({},{get:(e,t)=>{if("encrypted"!==t&&"remoteAddress"!==t)throw Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0});if("remoteAddress"!==t)return!1}}),this.url=e,this.headers=t,this.method=r,i&&(this.bodyReadable=i,this.bodyReadable.on("end",()=>this.emit("end")),this.bodyReadable.on("close",()=>this.emit("close"))),n&&(this.socket=n)}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 Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0})}get complete(){throw Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0})}get trailers(){throw Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0})}get trailersDistinct(){throw Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0})}get rawTrailers(){throw Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0})}get rawHeaders(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}setTimeout(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}}class nH extends nS().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?tp(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 tm(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 Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}writeEarlyHints(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get req(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}assignSocket(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}detachSocket(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}writeContinue(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}writeProcessing(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get upgrading(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get chunkedEncoding(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get shouldKeepAlive(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get useChunkedEncodingByDefault(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get sendDate(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}setTimeout(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}addTrailers(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}setHeaders(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}}class nF{async load(e){return await require(e)}}class nz{static async load(e,t=new nF){let r=await t.load(e);if("routeModule"in r)return r.routeModule;throw Object.defineProperty(Error(`Module "${e}" does not export a routeModule.`),"__NEXT_ERROR_CODE",{value:"E53",enumerable:!1,configurable:!0})}}let nU=(e,t)=>{let r=u().isAbsolute(t)?t:u().join(e,t);return(0,d.pathToFileURL)(r).toString()};function nW(e){var t,r;return(null==(r=e.has)?void 0:null==(t=r[0])?void 0:t.key)===eA}class nX{add(e){this.callbacks.push(e)}async runAll(){if(!this.callbacks.length)return;let e=this.callbacks;this.callbacks=[],await Promise.allSettled(e.map(async e=>e()))}constructor(){this.callbacks=[]}}let nB=new eL(0x3200000,e=>e.size),nG=new Map,nV={async get(e,t){await nG.get(e);let r=nB.get(e);if(!r)return;let n=r.entry;if(performance.timeOrigin+performance.now()>n.timestamp+1e3*n.revalidate||(0,nD.isTagStale)(n.tags,n.timestamp)||(0,nD.isTagStale)(t,n.timestamp))return;let[i,a]=n.value.tee();return n.value=a,{...n,value:i}},async set(e,t){let r=()=>{},n=new Promise(e=>{r=e});nG.set(e,n);let i=await t,a=0;try{let[t,r]=i.value.tee();i.value=t;let n=r.getReader();for(let e;!(e=await n.read()).done;)a+=Buffer.from(e.value).byteLength;nB.set(e,{entry:i,isErrored:!1,errorRetryCount:0,size:a})}catch{}finally{r(),nG.delete(e)}},async expireTags(...e){for(let t of e)nD.tagsManifest.items[t]||(nD.tagsManifest.items[t]={}),nD.tagsManifest.items[t].revalidatedAt=Date.now()},async receiveExpiredTags(...e){return this.expireTags(...e)}},nK=Symbol.for("@next/cache-handlers"),nJ=globalThis,nY=e=>import(e).then(e=>e.default||e),nQ=require,nZ=new WeakMap;class n0 extends nl{constructor(e){var t,r;super(e),this.registeredInstrumentation=!1,this.cleanupListeners=new nX,this.handleNextImageRequest=async(e,t,r)=>!(!r.pathname||!r.pathname.startsWith("/_next/image")||er(e,"middlewareInvoke"))&&(t.statusCode=400,t.body("Bad Request").send(),!0),this.handleCatchallRenderRequest=async(e,t,r)=>{let{pathname:n,query:i}=r;if(!n)throw Object.defineProperty(Error("Invariant: pathname is undefined"),"__NEXT_ERROR_CODE",{value:"E409",enumerable:!1,configurable:!0});en(e,"bubbleNoFallback",!0);try{var a;n=e5(n);let s={i18n:null==(a=this.i18nProvider)?void 0:a.fromRequest(e,n)},o=await this.matchers.match(n,s);if(!o)return await this.render(e,t,n,i,r,!0),!0;for(let n of(en(e,"match",o),this.getEdgeFunctionsPages()))if(n===o.definition.page){if("export"===this.nextConfig.output)return await this.render404(e,t,r),!0;delete i[eN];try{if(await this.runEdgeFunction({req:e,res:t,query:i,params:o.params,page:o.definition.page,match:o,appPaths:null}))return!0}catch(t){throw await this.instrumentationOnRequestError(t,e,{routePath:o.definition.page,routerKind:"Pages Router",routeType:"route",revalidateReason:void 0}),t}}if(o.definition.kind===tK.PAGES_API){if("export"===this.nextConfig.output)return await this.render404(e,t,r),!0;if(await this.handleApiRequest(e,t,i,o))return!0}return await this.render(e,t,n,i,r,!0),!0}catch(r){if(r instanceof ns)throw r;try{return this.logError(r),t.statusCode=500,await this.renderError(r,e,t,n,i),!0}catch{}throw r}},this.handleCatchallMiddlewareRequest=async(e,t,r)=>{let n;let i=er(e,"middlewareInvoke");if(!i)return!1;let a=()=>(en(e,"middlewareInvoke",!0),t.body("").send(),!0),s=this.getMiddleware();if(!s)return a();let o=eq(er(e,"initURL")),l=tO(o.pathname,{nextConfig:this.nextConfig,i18nProvider:this.i18nProvider});o.pathname=l.pathname;let u=e5(r.pathname||"");if(!s.match(u,e,o.query))return a();let d=!1;try{if(await this.ensureMiddleware(e.url),n=await this.runMiddleware({request:e,response:t,parsedUrl:o,parsed:r}),"response"in n){if(i)throw d=!0,Object.defineProperty(new ts.BubbledError(!0,n),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});for(let[e,r]of Object.entries(tm(n.response.headers)))"content-encoding"!==e&&void 0!==r&&t.setHeader(e,r);t.statusCode=n.response.status;let{originalResponse:e}=t;return n.response.body?await tG(n.response.body,e):e.end(),!0}}catch(i){if(d)throw i;if(rl(i)&&"ENOENT"===i.code)return await this.render404(e,t,r),!0;if(i instanceof J)return t.statusCode=400,await this.renderError(i,e,t,r.pathname||""),!0;let n=ru(i);return console.error(n),t.statusCode=500,await this.renderError(n,e,t,r.pathname||""),!0}return n.finished},this.isDev=e.dev??!1,this.sriEnabled=!!(null==(r=e.conf.experimental)?void 0:null==(t=r.sri)?void 0:t.algorithm),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:n}=this.nextConfig.experimental;if(e.dev||!0!==n&&void 0===n||(nP({distDir:this.distDir,page:"/_document",isAppPath:!1,isDev:this.isDev,sriEnabled:this.sriEnabled}).catch(()=>{}),nP({distDir:this.distDir,page:"/_app",isAppPath:!1,isDev:this.isDev,sriEnabled:this.sriEnabled}).catch(()=>{})),e.dev,!e.dev){let{dynamicRoutes:e=[]}=this.getRoutesManifest()??{};this.dynamicRoutes=e.map(e=>{let t=e7(e.page);return{match:ee(t),page:e.page,re:t.re}})}(function(e){if(!globalThis.__NEXT_HTTP_AGENT){if(!e)throw Object.defineProperty(Error("Expected config.httpAgentOptions to be an object"),"__NEXT_ERROR_CODE",{value:"E204",enumerable:!1,configurable:!0});globalThis.__NEXT_HTTP_AGENT_OPTIONS=e.httpAgentOptions,globalThis.__NEXT_HTTP_AGENT=new nM.Agent(e.httpAgentOptions),globalThis.__NEXT_HTTPS_AGENT=new nq.Agent(e.httpAgentOptions)}})(this.nextConfig),this.middlewareManifestPath=(0,l.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(),t=this.getPagesManifest();for(let e of(await this.loadCustomCacheHandlers(),Object.keys(t||{})))await nP({distDir:this.distDir,page:e,isAppPath:!1,isDev:this.isDev,sriEnabled:this.sriEnabled}).catch(()=>{});for(let t of Object.keys(e||{}))await nP({distDir:this.distDir,page:t,isAppPath:!0,isDev:this.isDev,sriEnabled:this.sriEnabled}).then(async({ComponentMod:e})=>{e.patchFetch();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 loadInstrumentationModule(){if(!this.serverOptions.dev)try{this.instrumentation=await nQ((0,l.resolve)(this.serverOptions.dir||".",this.serverOptions.conf.distDir,"server",eP.Hw))}catch(e){if("MODULE_NOT_FOUND"!==e.code)throw Object.defineProperty(Error("An error occurred while loading the instrumentation hook",{cause:e}),"__NEXT_ERROR_CODE",{value:"E92",enumerable:!1,configurable:!0})}return this.instrumentation}async prepareImpl(){await super.prepareImpl(),await this.runInstrumentationHookIfAvailable()}async runInstrumentationHookIfAvailable(){var e,t;this.registeredInstrumentation||(this.registeredInstrumentation=!0,await (null==(t=this.instrumentation)?void 0:null==(e=t.register)?void 0:e.call(t)))}loadEnvConfig({dev:e,forceReload:t,silent:r}){(0,nC.loadEnvConfig)(this.dir,e,r?{info:()=>{},error:()=>{}}:s,t)}async loadCustomCacheHandlers(){let{cacheHandlers:e}=this.nextConfig.experimental;if(!nJ.__nextCacheHandlers&&e){for(let t of(nJ.__nextCacheHandlers={},Object.keys(e)))e[t]&&(globalThis.__nextCacheHandlers[t]=nv(await nY(nU(this.distDir,e[t]))));if(!e.default){var t;nJ.__nextCacheHandlers.default=(null==(t=nJ[nK])?void 0:t.DefaultCache)||nV}}}async getIncrementalCache({requestHeaders:e,requestProtocol:t}){let r;let{cacheHandler:n}=this.nextConfig;return n&&(r=nv(await nY(nU(this.distDir,n)))),await this.loadCustomCacheHandlers(),new nI({fs:this.getCacheFilesystem(),dev:!1,requestHeaders:e,requestProtocol:t,allowedRevalidateHeaderKeys:this.nextConfig.experimental.allowedRevalidateHeaderKeys,minimalMode:!0,serverDistDir:this.serverDistDir,fetchCacheKeyPrefix:this.nextConfig.experimental.fetchCacheKeyPrefix,maxMemoryCacheSize:this.nextConfig.cacheMaxMemorySize,flushToDisk:!1,getPrerenderManifest:()=>this.getPrerenderManifest(),CurCacheHandler:r})}getResponseCache(){return new tQ(!0)}getPublicDir(){return(0,l.join)(this.dir,"public")}getHasStaticDir(){return p().existsSync((0,l.join)(this.dir,"static"))}getPagesManifest(){return nh((0,l.join)(this.serverDistDir,el))}getAppPathsManifest(){if(this.enabledDirectories.app)return nh((0,l.join)(this.serverDistDir,eu))}getinterceptionRoutePatterns(){if(!this.enabledDirectories.app)return[];let e=this.getRoutesManifest();return(null==e?void 0:e.rewrites.beforeFiles.filter(nW).map(e=>new RegExp(e.regex)))??[]}async hasPage(e){var t;return!!nf(e,this.distDir,null==(t=this.nextConfig.i18n)?void 0:t.locales,this.enabledDirectories.app)}getBuildId(){let e=(0,l.join)(this.distDir,"BUILD_ID");try{return p().readFileSync(e,"utf8").trim()}catch(e){if("ENOENT"===e.code)throw Object.defineProperty(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`),"__NEXT_ERROR_CODE",{value:"E427",enumerable:!1,configurable:!0});throw e}}getEnabledDirectories(e){let t=e?this.dir:this.serverDistDir;return{app:!!ep(t,"app"),pages:!!ep(t,"pages")}}sendRenderResult(e,t,r){return eI({req:e.originalRequest,res:t.originalResponse,result:r.result,type:r.type,generateEtags:r.generateEtags,poweredByHeader:r.poweredByHeader,revalidate:r.revalidate,expireTime:r.expireTime})}async runApi(e,t,r,n){for(let i of this.getEdgeFunctionsPages())if(i===n.definition.pathname&&await this.runEdgeFunction({req:e,res:t,query:r,params:n.params,page:n.definition.pathname,appPaths:null}))return!0;let i=await nz.load(n.definition.filename);return r={...r,...n.params},await i.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:n.params,page:n.definition.pathname,onError:this.instrumentationOnRequestError.bind(this),multiZoneDraftMode:this.nextConfig.experimental.multiZoneDraftMode}),!0}async renderHTML(e,t,r,n,i){return(0,ts.getTracer)().trace(to.Fx.renderHTML,async()=>this.renderHTMLImpl(e,t,r,n,i))}async renderHTMLImpl(e,t,r,n,i){throw Object.defineProperty(Error("Invariant: renderHTML should not be called in minimal mode"),"__NEXT_ERROR_CODE",{value:"E472",enumerable:!1,configurable:!0})}async imageOptimizer(e,t,r,n){throw Object.defineProperty(Error("invariant: imageOptimizer should not be called in minimal mode"),"__NEXT_ERROR_CODE",{value:"E506",enumerable:!1,configurable:!0})}getPagePath(e,t){return nm(e,this.distDir,t,this.enabledDirectories.app)}async renderPageComponent(e,t){let r=this.getEdgeFunctionsPages()||[];if(r.length){let t=this.getOriginalAppPaths(e.pathname),n=Array.isArray(t),i=e.pathname;for(let a of(n&&(i=t[0]),r))if(a===i)return await this.runEdgeFunction({req:e.req,res:e.res,query:e.query,params:e.renderOpts.params,page:i,appPaths:t}),null}return super.renderPageComponent(e,t)}async findPageComponents({locale:e,page:t,query:r,params:n,isAppPath:i,url:a}){return(0,ts.getTracer)().trace(to.Fx.findPageComponents,{spanName:"resolve page components",attributes:{"next.route":i?eZ(t):t}},()=>this.findPageComponentsImpl({locale:e,page:t,query:r,params:n,isAppPath:i,url:a}))}async findPageComponentsImpl({locale:e,page:t,query:r,params:n,isAppPath:i,url:a}){let s=[t];for(let a of(r.amp&&s.unshift((i?eZ(t):rb(t))+".amp"),e&&s.unshift(...s.map(t=>`/${e}${"/"===t?"":t}`)),s))try{let t=await nP({distDir:this.distDir,page:a,isAppPath:i,isDev:this.isDev,sriEnabled:this.sriEnabled});if(e&&"string"==typeof t.Component&&!a.startsWith(`/${e}/`)&&a!==`/${e}`)continue;return{components:t,query:{...!this.renderOpts.isExperimentalCompile&&t.getStaticProps?{amp:r.amp}:r,...(i?{}:n)||{}}}}catch(e){if(!(e instanceof Q))throw e}return null}getNextFontManifest(){return nh((0,l.join)(this.distDir,"server","next-font-manifest.json"))}logErrorWithOriginalStack(e,t){throw Object.defineProperty(Error("Invariant: logErrorWithOriginalStack can only be called on the development server"),"__NEXT_ERROR_CODE",{value:"E6",enumerable:!1,configurable:!0})}async ensurePage(e){throw Object.defineProperty(Error("Invariant: ensurePage can only be called on the development server"),"__NEXT_ERROR_CODE",{value:"E291",enumerable:!1,configurable:!0})}async handleApiRequest(e,t,r,n){return this.runApi(e,t,r,n)}getCacheFilesystem(){return nL}normalizeReq(e){return e instanceof eb?e:new eb(e)}normalizeRes(e){return e instanceof eE?e:new eE(e)}getRequestHandler(){return this.makeRequestHandler()}makeRequestHandler(){this.prepare().catch(e=>{console.error("Failed to prepare server",e)});let e=super.getRequestHandler();return(t,r,n)=>e(this.normalizeReq(t),this.normalizeRes(r),n)}async revalidate({urlPath:e,revalidateHeaders:t,opts:r}){let n=function({url:e,headers:t={},method:r="GET",bodyReadable:n,resWriter:i,socket:a=null}){return{req:new n$({url:e,headers:t,method:r,socket:a,readable:n}),res:new nH({socket:a,resWriter:i})}}({url:e,headers:t}),i=this.getRequestHandler();if(await i(new eb(n.req),new eE(n.res)),await n.res.hasStreamed,"REVALIDATED"!==n.res.getHeader("x-nextjs-cache")&&!(404===n.res.statusCode&&r.unstable_onlyGenerated))throw Object.defineProperty(Error(`Invalid response ${n.res.statusCode}`),"__NEXT_ERROR_CODE",{value:"E175",enumerable:!1,configurable:!0})}async render(e,t,r,n,i,a=!1){return super.render(this.normalizeReq(e),this.normalizeRes(t),r,n,i,a)}async renderToHTML(e,t,r,n){return super.renderToHTML(this.normalizeReq(e),this.normalizeRes(t),r,n)}async renderErrorToResponseImpl(e,t){let{req:r,res:n,query:i}=e;return 404===n.statusCode&&this.enabledDirectories.app&&this.getEdgeFunctionsPages().includes(eo)?(await this.runEdgeFunction({req:r,res:n,query:i||{},params:{},page:eo,appPaths:null}),null):super.renderErrorToResponseImpl(e,t)}async renderError(e,t,r,n,i,a){return super.renderError(e,this.normalizeReq(t),this.normalizeRes(r),n,i,a)}async renderErrorToHTML(e,t,r,n,i){return super.renderErrorToHTML(e,this.normalizeReq(t),this.normalizeRes(r),n,i)}async render404(e,t,r,n){return super.render404(this.normalizeReq(e),this.normalizeRes(t),r,n)}getMiddlewareManifest(){return null}getMiddleware(){var e,t;let r=this.getMiddlewareManifest(),n=null==r?void 0:null==(e=r.middleware)?void 0:e["/"];if(!n){let e=this.loadNodeMiddleware();return e?{match:nO((null==(t=e.config)?void 0:t.matchers)||[{regexp:".*",originalSource:"/:path*"}]),page:"/"}:void 0}return{match:function(e){let t=nZ.get(e);if(t)return t;if(!Array.isArray(e.matchers))throw Object.defineProperty(Error(`Invariant: invalid matchers for middleware ${JSON.stringify(e)}`),"__NEXT_ERROR_CODE",{value:"E257",enumerable:!1,configurable:!0});let r=nO(e.matchers);return nZ.set(e,r),r}(n),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=rr(rb(e.page))}catch(e){return null}let n=e.middleware?r.middleware[t]:r.functions[t];if(!n){if(!e.middleware)throw new Q(t);return null}return{name:n.name,paths:n.files.map(e=>(0,l.join)(this.distDir,e)),wasm:(n.wasm??[]).map(e=>({...e,filePath:(0,l.join)(this.distDir,e.filePath)})),assets:n.assets&&n.assets.map(e=>({...e,filePath:(0,l.join)(this.distDir,e.filePath)})),env:n.env}}loadNodeMiddleware(){if(this.nextConfig.experimental.nodeMiddleware)try{var e;let t=r("./dist/esm/server sync recursive")((0,l.join)(this.distDir,"server","functions-config-manifest.json"));if(null==t?void 0:null==(e=t.functions)?void 0:e["/_middleware"])return r("./dist/esm/server sync recursive")((0,l.join)(this.distDir,"server","middleware.js"))}catch(e){if(rl(e)&&"ENOENT"!==e.code&&"MODULE_NOT_FOUND"!==e.code)throw e}}async hasMiddleware(e){let t=this.getEdgeFunctionInfo({page:e,middleware:!0});return!!(!t&&this.loadNodeMiddleware())||!!(t&&t.paths.length>0)}async ensureMiddleware(e){}async ensureEdgeFunction(e){}async runMiddleware(e){throw Object.defineProperty(Error("invariant: runMiddleware should not be called in minimal mode"),"__NEXT_ERROR_CODE",{value:"E276",enumerable:!1,configurable:!0})}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=nh((0,l.join)(this.distDir,"prerender-manifest.json"))),this._cachedPreviewManifest}getRoutesManifest(){return(0,ts.getTracer)().trace(to.Fx.getRoutesManifest,()=>{let e=nh((0,l.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 n;let i=(null==(n=e.headers["x-forwarded-proto"])?void 0:n.includes("https"))?"https":"http",a=this.fetchHostname&&this.port?`${i}://${this.fetchHostname}:${this.port}${e.url}`:this.nextConfig.experimental.trustHostHeader?`https://${e.headers.host||"localhost"}${e.url}`:e.url;en(e,"initURL",a),en(e,"initQuery",{...t.query}),en(e,"initProtocol",i),r||en(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 n=await r;if(n&&"object"==typeof n&&n.error)throw n.error;(function(e,t){for(let r in t){let n=t[r];"function"==typeof n&&(n=n.bind(e)),e[r]=n}})(e,t),t=e}},cloneBodyStream(){let r=t??e,n=new nT.PassThrough,i=new nT.PassThrough;return r.on("data",e=>{n.push(e),i.push(e)}),r.on("end",()=>{n.push(null),i.push(null)}),t=i,n}}}(e.originalRequest))}async runEdgeFunction(e){throw Object.defineProperty(Error("Middleware is not supported in minimal mode. Please remove the `NEXT_MINIMAL` environment variable."),"__NEXT_ERROR_CODE",{value:"E58",enumerable:!1,configurable:!0})}get serverDistDir(){if(this._serverDistDir)return this._serverDistDir;let e=(0,l.join)(this.distDir,ed);return this._serverDistDir=e,e}async getFallbackErrorComponents(e){return null}async instrumentationOnRequestError(...e){await super.instrumentationOnRequestError(...e),this.logError(e[0])}onServerClose(e){this.cleanupListeners.add(e)}async close(){await this.cleanupListeners.runAll()}getInternalWaitUntil(){return this.internalWaitUntil??=this.createInternalWaitUntil(),this.internalWaitUntil}createInternalWaitUntil(){throw Object.defineProperty(new $("createInternalWaitUntil should never be called in minimal mode"),"__NEXT_ERROR_CODE",{value:"E540",enumerable:!1,configurable:!0})}}})(),module.exports=n})();
31
+ See here for info: https://nextjs.org/docs/messages/custom-error-no-custom-404`)});let{dir:a=".",quiet:s=!1,conf:o,dev:l=!1,minimalMode:u=!1,hostname:c,port:h,experimentalTestProxy:p}=e;this.experimentalTestProxy=p,this.serverOptions=e,this.dir=r("path").resolve(a),this.quiet=s,this.loadEnvConfig({dev:l}),this.nextConfig=o,this.hostname=c,this.hostname&&(this.fetchHostname=function(e){return t4.test(e)?`[${e}]`:e}(this.hostname)),this.port=h,this.distDir=r("path").join(this.dir,this.nextConfig.distDir),this.publicDir=this.getPublicDir(),this.hasStaticDir=!u&&this.getHasStaticDir(),this.i18nProvider=(null==(t=this.nextConfig.i18n)?void 0:t.locales)?new rU(this.nextConfig.i18n):void 0,this.localeNormalizer=this.i18nProvider?new rd(this.i18nProvider):void 0;let{serverRuntimeConfig:f={},publicRuntimeConfig:m,assetPrefix:g,generateEtags:v}=this.nextConfig;this.buildId=this.getBuildId(),this.minimalMode=u||!!process.env.NEXT_PRIVATE_MINIMAL_MODE,this.enabledDirectories=this.getEnabledDirectories(l),this.isAppPPREnabled=this.enabledDirectories.app&&function(e){return void 0!==e&&("boolean"==typeof e?e:"incremental"===e)}(this.nextConfig.experimental.ppr),this.isAppSegmentPrefetchEnabled=this.enabledDirectories.app&&!0===this.nextConfig.experimental.clientSegmentCache,this.normalizers={rsc:this.enabledDirectories.app?new rV:void 0,prefetchRSC:this.isAppPPREnabled?new rQ:void 0,segmentPrefetchRSC:this.isAppSegmentPrefetchEnabled?new na:void 0,data:this.enabledDirectories.pages?new r0(this.buildId):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??!0,poweredByHeader:this.nextConfig.poweredByHeader,canonicalBase:this.nextConfig.amp.canonicalBase||"",generateEtags:v,previewProps:this.getPrerenderManifest().preview,ampOptimizerConfig:null==(n=this.nextConfig.experimental.amp)?void 0:n.optimizer,basePath:this.nextConfig.basePath,images:this.nextConfig.images,optimizeCss:this.nextConfig.experimental.optimizeCss,nextConfigOutput:this.nextConfig.output,nextScriptWorkers:this.nextConfig.experimental.nextScriptWorkers,disableOptimizedLoading:this.nextConfig.experimental.disableOptimizedLoading,domainLocales:null==(i=this.nextConfig.i18n)?void 0:i.domains,distDir:this.distDir,serverComponents:this.enabledDirectories.app,cacheLifeProfiles:this.nextConfig.experimental.cacheLife,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:{expireTime:this.nextConfig.expireTime,clientTraceMetadata:this.nextConfig.experimental.clientTraceMetadata,dynamicIO:this.nextConfig.experimental.dynamicIO??!1,clientSegmentCache:this.nextConfig.experimental.clientSegmentCache??!1,inlineCss:this.nextConfig.experimental.inlineCss??!1,authInterrupts:!!this.nextConfig.experimental.authInterrupts,streamingMetadata:!!this.nextConfig.experimental.streamingMetadata,htmlLimitedBots:this.nextConfig.experimental.htmlLimitedBots},onInstrumentationRequestError:this.instrumentationOnRequestError.bind(this),reactMaxHeadersLength:this.nextConfig.reactMaxHeadersLength},(0,t5.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(g),this.responseCache=this.getResponseCache({dev:l})}reloadMatchers(){return this.matchers.reload()}getRouteMatchers(){let e=new rz(e=>{switch(e){case el:return this.getPagesManifest()??null;case eu:return this.getAppPathsManifest()??null;default:return null}}),t=new rf;return t.push(new rF(this.distDir,e,this.i18nProvider)),t.push(new rL(this.distDir,e,this.i18nProvider)),this.enabledDirectories.app&&(t.push(new rS(this.distDir,e)),t.push(new rA(this.distDir,e))),t}async instrumentationOnRequestError(...e){let[t,r,n]=e;if(this.instrumentation)try{await (null==this.instrumentation.onRequestError?void 0:this.instrumentation.onRequestError.call(this.instrumentation,t,{path:r.url||"",method:r.method||"GET",headers:r instanceof nt?Object.fromEntries(r.headers.entries()):r.headers},n))}catch(e){console.error("Error in instrumentation.onRequestError:",e)}}logError(e){this.quiet||eW(e)}async handleRequest(e,t,r){await this.prepare();let n=e.method.toUpperCase(),i=(0,ts.getTracer)();return i.withPropagatedContext(e.headers,()=>i.trace(to.Li.handleRequest,{spanName:`${n} ${e.url}`,kind:ts.SpanKind.SERVER,attributes:{"http.method":n,"http.target":e.url}},async a=>this.handleRequestImpl(e,t,r).finally(()=>{if(!a)return;let r=er(e,"isRSCRequest")??!1;a.setAttributes({"http.status_code":t.statusCode,"next.rsc":r});let s=i.getRootSpanAttributes();if(!s)return;if(s.get("next.span_type")!==to.Li.handleRequest){console.warn(`Unexpected root span type '${s.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);return}let o=s.get("next.route");if(o){let e=r?`RSC ${n} ${o}`:`${n} ${o}`;a.setAttributes({"next.route":o,"http.route":o,"next.span_name":e}),a.updateName(e)}else a.updateName(r?`RSC ${n} ${e.url}`:`${n} ${e.url}`)})))}async handleRequestImpl(e,t,r){try{var n,i,a,s,o,l,u,c,h,p;await this.matchers.waitTillReady(),function(e,t){let r=t.setHeader.bind(t);t.setHeader=(n,i)=>{if("headersSent"in t&&t.headersSent)return t;if("set-cookie"===n.toLowerCase()){let t=er(e,"middlewareCookie");t&&Array.isArray(i)&&i.every((e,r)=>e===t[r])||(i=[...new Set([...t||[],..."string"==typeof i?[i]:Array.isArray(i)?i:[]])])}return r(n,i)}}(e,tL(t)?t.originalResponse:t);let f=(e.url||"").split("?",1)[0];if(null==f?void 0:f.match(/(\\|\/\/)/)){let r=K(e.url);t.redirect(r,308).body(r).send();return}if(!r||"object"!=typeof r){if(!e.url)throw Object.defineProperty(Error("Invariant: url can not be undefined"),"__NEXT_ERROR_CODE",{value:"E123",enumerable:!1,configurable:!0});r=(0,d.parse)(e.url,!0)}if(!r.pathname)throw Object.defineProperty(Error("Invariant: pathname can't be empty"),"__NEXT_ERROR_CODE",{value:"E412",enumerable:!1,configurable:!0});"string"==typeof r.query&&(r.query=Object.fromEntries(new URLSearchParams(r.query)));let{originalRequest:m=null}=tq(e)?e:{},g=null==m?void 0:m.headers["x-forwarded-proto"],v=g?"https"===g:!!(null==m?void 0:null==(n=m.socket)?void 0:n.encrypted);e.headers["x-forwarded-host"]??=e.headers.host??this.hostname,e.headers["x-forwarded-port"]??=this.port?this.port.toString():v?"443":"80",e.headers["x-forwarded-proto"]??=v?"https":"http",e.headers["x-forwarded-for"]??=null==m?void 0:null==(i=m.socket)?void 0:i.remoteAddress,this.attachRequestMeta(e,r);let y=await this.handleRSCRequest(e,t,r);if(y)return;let b=null==(a=this.i18nProvider)?void 0:a.detectDomainLocale(tR(r,e.headers)),E=(null==b?void 0:b.defaultLocale)||(null==(s=this.nextConfig.i18n)?void 0:s.defaultLocale);en(e,"defaultLocale",E);let _=eq(e.url.replace(/^\/+/,"/")),R=tO(_.pathname,{nextConfig:this.nextConfig,i18nProvider:this.i18nProvider});_.pathname=R.pathname,R.basePath&&(e.url=tP(e.url,this.nextConfig.basePath));let w="string"==typeof e.headers[eP.vx];if(w)try{this.enabledDirectories.app&&(e.url.match(/^\/index($|\?)/)&&(e.url=e.url.replace(/^\/index/,"/")),r.pathname="/index"===r.pathname?"/":r.pathname);let{pathname:n}=new URL(e.headers[eP.vx],"http://localhost"),{pathname:i}=new URL(e.url,"http://localhost");if(null==(o=this.normalizers.data)?void 0:o.match(i))en(e,"isNextDataReq",!0);else if(this.isAppPPREnabled&&"1"===e.headers[eP.gs]&&"POST"===e.method){let t=[];for await(let r of e.body)t.push(r);let r=Buffer.concat(t).toString("utf8");en(e,"postponed",r)}n=this.normalize(n);let a=this.stripNextDataPath(i),s=null==(l=this.i18nProvider)?void 0:l.analyze(n,{defaultLocale:E});s&&(en(e,"locale",s.detectedLocale),s.inferredFromDefault?en(e,"localeInferredFromDefault",!0):ei(e,"localeInferredFromDefault"));let h=n=rr(n),p=t8(h);if(!p){let e=await this.matchers.match(h,{i18n:s});e&&(h=e.definition.pathname,p=void 0!==e.params)}s&&(n=s.pathname);let f=function({page:e,i18n:t,basePath:r,rewrites:n,pageIsDynamic:i,trailingSlash:a,caseSensitive:s}){let o,l,u;return i&&(u=(l=ee(o=function(e,t){var r,n,i;let a=function(e,t,r,n,i){let a;let s=(a=0,()=>{let e="",t=++a;for(;t>0;)e+=String.fromCharCode(97+(t-1)%26),t=Math.floor((t-1)/26);return e}),o={},l=[];for(let a of e5(e).slice(1).split("/")){let e=e1.some(e=>a.startsWith(e)),u=a.match(e9);if(e&&u&&u[2])l.push(te({getSafeRouteKey:s,interceptionMarker:u[1],segment:u[2],routeKeys:o,keyPrefix:t?eP.h:void 0,backreferenceDuplicateKeys:i}));else if(u&&u[2]){n&&u[1]&&l.push("/"+e8(u[1]));let e=te({getSafeRouteKey:s,segment:u[2],routeKeys:o,keyPrefix:t?eP.AA:void 0,backreferenceDuplicateKeys:i});n&&u[1]&&(e=e.substring(1)),l.push(e)}else l.push("/"+e8(a));r&&u&&u[3]&&l.push(e8(u[3]))}return{namedParameterizedRoute:l.join(""),routeKeys:o}}(e,t.prefixRouteKeys,null!=(r=t.includeSuffix)&&r,null!=(n=t.includePrefix)&&n,null!=(i=t.backreferenceDuplicateKeys)&&i),s=a.namedParameterizedRoute;return t.excludeOptionalTrailingSlash||(s+="(?:/)?"),{...e7(e,t),namedRegex:"^"+s+"$",routeKeys:a.routeKeys}}(e,{prefixRouteKeys:!1})))(e)),{handleRewrites:function(o,u){let d={},c=u.pathname,h=n=>{let h=ri(n.source+(a?"(/)?":""),{removeUnnamedParams:!0,strict:!0,sensitive:!!s});if(!u.pathname)return!1;let p=h(u.pathname);if((n.has||n.missing)&&p){let e=rs(o,u.query,n.has,n.missing);e?Object.assign(p,e):p=!1}if(p){let{parsedDestination:a,destQuery:s}=function(e){let t,r;let n=Object.assign({},e.query);delete n[eN];let i=function(e){let t=e.destination;for(let r of Object.keys({...e.params,...e.query}))r&&(t=t.replace(RegExp(":"+e8(r),"g"),"__ESC_COLON_"+r));let r=eq(t),n=r.pathname;n&&(n=ra(n));let i=r.href;i&&(i=ra(i));let a=r.hostname;a&&(a=ra(a));let s=r.hash;return s&&(s=ra(s)),{...r,pathname:n,hostname:a,href:i,hash:s}}(e),{hostname:a,query:s}=i,o=i.pathname;i.hash&&(o=""+o+i.hash);let l=[],u=[];for(let e of((0,rn.pathToRegexp)(o,u),u))l.push(e.name);if(a){let e=[];for(let t of((0,rn.pathToRegexp)(a,e),e))l.push(t.name)}let d=(0,rn.compile)(o,{validate:!1});for(let[r,n]of(a&&(t=(0,rn.compile)(a,{validate:!1})),Object.entries(s)))Array.isArray(n)?s[r]=n.map(t=>ro(ra(t),e.params)):"string"==typeof n&&(s[r]=ro(ra(n),e.params));let c=Object.keys(e.params).filter(e=>"nextInternalLocale"!==e);if(e.appendParamsToQuery&&!c.some(e=>l.includes(e)))for(let t of c)t in s||(s[t]=e.params[t]);if(e4(o))for(let t of o.split("/")){let r=e1.find(e=>t.startsWith(e));if(r){"(..)(..)"===r?(e.params["0"]="(..)",e.params["1"]="(..)"):e.params["0"]=r;break}}try{let[n,a]=(r=d(e.params)).split("#",2);t&&(i.hostname=t(e.params)),i.pathname=n,i.hash=(a?"#":"")+(a||""),delete i.search}catch(e){if(e.message.match(/Expected .*? to not repeat, but got an array/))throw Object.defineProperty(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"),"__NEXT_ERROR_CODE",{value:"E329",enumerable:!1,configurable:!0});throw e}return i.query={...n,...i.query},{newUrl:r,destQuery:s,parsedDestination:i}}({appendParamsToQuery:!0,destination:n.destination,params:p,query:u.query});if(a.protocol)return!0;if(Object.assign(d,s,p),Object.assign(u.query,a.query),delete a.query,Object.assign(u,a),!(c=u.pathname))return!1;if(r&&(c=c.replace(RegExp(`^${r}`),"")||"/"),t){let e=tx(c,t.locales);c=e.pathname,u.query.nextInternalLocale=e.detectedLocale||p.nextInternalLocale}if(c===e)return!0;if(i&&l){let e=l(c);if(e)return u.query={...u.query,...e},!0}}return!1};for(let e of n.beforeFiles||[])h(e);if(c!==e){let t=!1;for(let e of n.afterFiles||[])if(t=h(e))break;if(!t&&!(()=>{let t=e5(c||"");return t===e5(e)||(null==l?void 0:l(t))})()){for(let e of n.fallback||[])if(t=h(e))break}}return d},defaultRouteRegex:o,dynamicRouteMatcher:l,defaultRouteMatches:u,getParamsFromRouteMatches:function(e){if(!o)return null;let{groups:t,routeKeys:r}=o;return ee({re:{exec:e=>{let n=Object.fromEntries(new URLSearchParams(e));for(let[e,t]of Object.entries(n)){let r=tv(e);r&&(n[r]=t,delete n[e])}let i={};for(let e of Object.keys(r)){let a=r[e];if(!a)continue;let s=t[a],o=n[e];if(!s.optional&&!o)return null;i[s.pos]=o}return i}},groups:t})(e)||null},normalizeDynamicRouteParams:(e,t)=>o&&u?function(e,t,r,n){let i={};for(let a of Object.keys(t.groups)){let s=e[a];"string"==typeof s?s=e0(s):Array.isArray(s)&&(s=s.map(e0));let o=r[a],l=t.groups[a].optional;if((Array.isArray(o)?o.some(e=>Array.isArray(s)?s.some(t=>t.includes(e)):null==s?void 0:s.includes(e)):null==s?void 0:s.includes(o))||void 0===s&&!(l&&n))return{params:{},hasValidParams:!1};l&&(!s||Array.isArray(s)&&1===s.length&&("index"===s[0]||s[0]===`[[...${a}]]`))&&(s=void 0,delete e[a]),s&&"string"==typeof s&&t.groups[a].repeat&&(s=s.split("/")),s&&(i[a]=s)}return{params:i,hasValidParams:!0}}(e,o,u,t):{params:{},hasValidParams:!1},normalizeVercelUrl:(e,t)=>(function(e,t,r){if(!r)return;let n=(0,d.parse)(e.url,!0);for(let e of(delete n.search,Object.keys(n.query))){let i=e!==eP.AA&&e.startsWith(eP.AA),a=e!==eP.h&&e.startsWith(eP.h);(i||a||(t||Object.keys(r.groups)).includes(e))&&delete n.query[e]}e.url=(0,d.format)(n)})(e,t,o),interpolateDynamicPath:(e,t)=>(function(e,t,r){if(!r)return e;for(let n of Object.keys(r.groups)){let i;let{optional:a,repeat:s}=r.groups[n],o=`[${s?"...":""}${n}]`;a&&(o=`[${o}]`);let l=t[n];i=Array.isArray(l)?l.map(e=>e&&encodeURIComponent(e)).join("/"):l?encodeURIComponent(l):"",e=e.replaceAll(o,i)}return e})(e,t,o)}}({pageIsDynamic:p,page:h,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});E&&!R.locale&&(r.pathname=`/${E}${r.pathname}`);let m=r.pathname,g=f.handleRewrites(e,r),v=Object.keys(g),b=m!==r.pathname;b&&r.pathname&&en(e,"rewroteURL",r.pathname);let w=new Set;for(let[e,t]of Object.entries(r.query)){if(void 0===t)continue;let n=tv(e);n&&(r.query[n]=t,w.add(n),delete r.query[e])}if(p){let t={},i=f.normalizeDynamicRouteParams(r.query,!1);if(!i.hasValidParams&&!t8(a)){let e=null==f.dynamicRouteMatcher?void 0:f.dynamicRouteMatcher.call(f,a);e&&(f.normalizeDynamicRouteParams(e,!1),Object.assign(i.params,e),i.hasValidParams=!0)}if("/index"!==n&&!i.hasValidParams&&!t8(n)){let e=null==f.dynamicRouteMatcher?void 0:f.dynamicRouteMatcher.call(f,n);if(e){let r=f.normalizeDynamicRouteParams(e,!1);r.hasValidParams&&(Object.assign(t,e),i=r)}}i.hasValidParams&&(t=i.params);let s=e.headers["x-now-route-matches"];if("string"==typeof s&&s&&t8(n)&&!i.hasValidParams){let e=f.getParamsFromRouteMatches(s);e&&(i=f.normalizeDynamicRouteParams(e,!0)).hasValidParams&&(t=i.params)}if(!i.hasValidParams&&(i=f.normalizeDynamicRouteParams(r.query,!0)).hasValidParams&&(t=i.params),!f.defaultRouteMatches||a!==h||i.hasValidParams||f.normalizeDynamicRouteParams({...t},!0).hasValidParams||(t=f.defaultRouteMatches,en(e,"didSetDefaultRouteMatches",!0)),t){n=f.interpolateDynamicPath(h,t),e.url=f.interpolateDynamicPath(e.url,t);let r=er(e,"segmentPrefetchRSCRequest");r&&t8(r,!1)&&(r=f.interpolateDynamicPath(r,t),e.headers[eD.toLowerCase()]=r,en(e,"segmentPrefetchRSCRequest",r))}}for(let t of((p||b)&&f.normalizeVercelUrl(e,[...v,...Object.keys((null==(c=f.defaultRouteRegex)?void 0:c.groups)||{})]),w))delete r.query[t];if(r.pathname=n,_.pathname=r.pathname,y=await this.normalizeAndAttachMetadata(e,t,r))return}catch(r){if(r instanceof J||r instanceof Y)return t.statusCode=400,this.renderError(null,e,t,"/_error",{});throw r}if(en(e,"isLocaleDomain",!!b),R.locale&&(e.url=(0,d.format)(_),en(e,"didStripLocale",!0)),!er(e,"locale")&&(R.locale?en(e,"locale",R.locale):E&&(en(e,"locale",E),en(e,"localeInferredFromDefault",!0))),!this.serverOptions.webServerConfig&&!er(e,"incrementalCache")){let t="https:";try{t=new URL(er(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(),en(e,"incrementalCache",r),globalThis.__incrementalCache=r}let x=globalThis;if(x.__nextCacheHandlers){let t=(null==(h=e.headers[eP.vS])?void 0:h.split(","))||[];for(let e of Object.values(x.__nextCacheHandlers))"function"==typeof(null==e?void 0:e.receiveExpiredTags)&&await e.receiveExpiredTags(...t)}er(e,"serverComponentsHmrCache")||en(e,"serverComponentsHmrCache",this.getServerComponentsHmrCache());let P=er(e,"invokePath");if(!w&&P){let n=er(e,"invokeStatus");if(n){let i=er(e,"invokeQuery");i&&Object.assign(r.query,i),t.statusCode=n;let a=er(e,"invokeError")||null;return this.renderError(a,e,t,"/_error",r.query)}let i=new URL(P||"/","http://n"),a=tO(i.pathname,{nextConfig:this.nextConfig,parseData:!1});a.locale&&en(e,"locale",a.locale),r.pathname!==i.pathname&&(r.pathname=i.pathname,en(e,"rewroteURL",a.pathname));let s=tx(tP(r.pathname,this.nextConfig.basePath||""),null==(p=this.nextConfig.i18n)?void 0:p.locales);for(let t of(s.detectedLocale&&en(e,"locale",s.detectedLocale),r.pathname=s.pathname,Object.keys(r.query)))delete r.query[t];let o=er(e,"invokeQuery");if(o&&Object.assign(r.query,o),y=await this.normalizeAndAttachMetadata(e,t,r))return;await this.handleCatchallRenderRequest(e,t,r);return}if(er(e,"middlewareInvoke")){if((y=await this.normalizeAndAttachMetadata(e,t,r))||(y=await this.handleCatchallMiddlewareRequest(e,t,r)))return;let n=Error();throw n.result={response:new Response(null,{headers:{"x-middleware-next":"1"}})},n.bubble=!0,n}return!w&&R.basePath&&(r.pathname=tP(r.pathname,R.basePath)),t.statusCode=200,await this.run(e,t,r)}catch(r){if(r instanceof ns)throw r;if(r&&"object"==typeof r&&"ERR_INVALID_URL"===r.code||r instanceof J||r instanceof Y)return t.statusCode=400,this.renderError(null,e,t,"/_error",{});throw r}}getRequestHandlerWithMetadata(e){let t=this.getRequestHandler();return(r,n,i)=>(r[et]=e,t(r,n,i))}getRequestHandler(){return this.handleRequest.bind(this)}setAssetPrefix(e){this.renderOpts.assetPrefix=e?e.replace(/\/$/,""):""}async prepare(){if(!this.prepared)return null===this.preparedPromise&&(this.instrumentation=await this.loadInstrumentationModule(),this.preparedPromise=this.prepareImpl().then(()=>{this.prepared=!0,this.preparedPromise=null})),this.preparedPromise}async prepareImpl(){}async loadInstrumentationModule(){}async close(){}getAppPathRoutes(){let e={};return Object.keys(this.appPathsManifest||{}).forEach(t=>{let r=eZ(t);e[r]||(e[r]=[]),e[r].push(t)}),e}async run(e,t,r){return(0,ts.getTracer)().trace(to.Li.run,async()=>this.runImpl(e,t,r))}async runImpl(e,t,r){await this.handleCatchallRenderRequest(e,t,r)}async pipe(e,t){return(0,ts.getTracer)().trace(to.Li.pipe,async()=>this.pipeImpl(e,t))}async pipeImpl(e,t){let r=t.req.headers["user-agent"]||"",n=re(r),i={...t,renderOpts:{...this.renderOpts,supportsDynamicResponse:!n,botType:rt(r),serveStreamingMetadata:function(e,{streamingMetadata:t,htmlLimitedBots:r}){if(!t)return!1;let n=RegExp(r||t6,"i");return!!e&&!n.test(e)}(r,this.renderOpts.experimental)}},a=await e(i);if(null===a)return;let{req:s,res:o}=i,l=o.statusCode,{body:u,type:d}=a,{revalidate:c}=a;if(!o.sent){let{generateEtags:e,poweredByHeader:t,dev:r}=this.renderOpts;r&&(o.setHeader("Cache-Control","no-store, must-revalidate"),c=void 0),await this.sendRenderResult(s,o,{result:u,type:d,generateEtags:e,poweredByHeader:t,revalidate:c,expireTime:this.nextConfig.expireTime}),o.statusCode=l}}async getStaticHTML(e,t){let r={...t,renderOpts:{...this.renderOpts,supportsDynamicResponse:!1}},n=await e(r);return null===n?null:n.body.toUnchunkedString()}async render(e,t,r,n={},i,a=!1){return(0,ts.getTracer)().trace(to.Li.render,async()=>this.renderImpl(e,t,r,n,i,a))}getWaitUntil(){let e=function(){let e=globalThis[r3];return null==e?void 0:e.get()}();if(e)return e.waitUntil}getInternalWaitUntil(){}async renderImpl(e,t,r,n={},i,a=!1){var s;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.serverOptions.customServer&&"/index"===r&&!await this.hasPage("/index")&&(r="/"),(s=r,ec.includes(s))?this.render404(e,t,i):this.pipe(e=>this.renderToResponse(e),{req:e,res:t,pathname:r,query:n})}async getStaticPaths({pathname:e}){var t;return{staticPaths:void 0,fallbackMode:function(e){if("string"==typeof e)return"PRERENDER";if(null===e)return"BLOCKING_STATIC_RENDER";if(!1===e)return"NOT_FOUND";if(void 0!==e)throw Object.defineProperty(Error(`Invalid fallback option: ${e}. Fallback option must be a string, null, undefined, or false.`),"__NEXT_ERROR_CODE",{value:"E285",enumerable:!1,configurable:!0})}(null==(t=this.getPrerenderManifest().dynamicRoutes[e])?void 0:t.fallback)}}async renderToResponseWithComponents(e,t){return(0,ts.getTracer)().trace(to.Li.renderToResponseWithComponents,async()=>this.renderToResponseWithComponentsImpl(e,t))}pathCouldBeIntercepted(e){return e4(e)||this.interceptionRoutePatterns.some(t=>t.test(e))}setVaryHeader(e,t,r,n){let i=`RSC, ${eT}, ${eS}, ${eD}`,a=er(e,"isRSCRequest")??!1,s=!1;r&&this.pathCouldBeIntercepted(n)?(t.appendHeader("vary",`${i}, ${eA}`),s=!0):(r||a)&&t.appendHeader("vary",i),s||delete e.headers[eA]}async renderToResponseWithComponentsImpl({req:e,res:t,pathname:n,renderOpts:i},{components:a,query:s}){var o,l,u,c,h,p,f,m,g,v;let y,b,E,_;n===es&&(n="/404");let R="/_error"===n,w="/404"===n||R&&404===t.statusCode,x="/500"===n||R&&500===t.statusCode,P=!0===a.isAppPath,O=!!a.getServerSideProps,C=!!a.getStaticPaths,T=function(e){let t,r;e.headers instanceof Headers?(t=e.headers.get(eC.toLowerCase())??null,r=e.headers.get("content-type")):(t=e.headers[eC.toLowerCase()]??null,r=e.headers["content-type"]??null);let n=!!("POST"===e.method&&"application/x-www-form-urlencoded"===r),i=!!("POST"===e.method&&(null==r?void 0:r.startsWith("multipart/form-data"))),a=!!(void 0!==t&&"string"==typeof t&&"POST"===e.method);return{actionId:t,isURLEncodedAction:n,isMultipartAction:i,isFetchAction:a,isServerAction:!!(a||n||i)}}(e).isServerAction,S=!!(null==(o=a.Component)?void 0:o.getInitialProps),D=!!a.getStaticProps,A=(0,d.parse)(e.url||"").pathname||"/",j=er(e,"rewroteURL")||A;this.setVaryHeader(e,t,P,j);let N=!1,k=t8(a.page),I=this.getPrerenderManifest();if(P&&k){let t=await this.getStaticPaths({pathname:n,page:a.page,isAppPath:P,requestHeaders:e.headers});if(y=t.staticPaths,N=void 0!==(b=t.fallbackMode),"export"===this.nextConfig.output){let e=a.page;if(!y)throw Object.defineProperty(Error(`Page "${e}" is missing exported function "generateStaticParams()", which is required with "output: export" config.`),"__NEXT_ERROR_CODE",{value:"E353",enumerable:!1,configurable:!0});let t=e5(j);if(!y.includes(t))throw Object.defineProperty(Error(`Page "${e}" is missing param "${t}" in "generateStaticParams()", which is required with "output: export" config.`),"__NEXT_ERROR_CODE",{value:"E443",enumerable:!1,configurable:!0})}N&&(C=!0)}let M="html"===rt(e.headers["user-agent"]||"");M&&(this.renderOpts.serveStreamingMetadata=!1),N||(null==y?void 0:y.includes(j))||e.headers["x-now-route-matches"]?D=!0:(D||=!!I.routes[r1(n)],M&&(D=!1));let q=!!(er(e,"isNextDataReq")||e.headers["x-nextjs-data"]&&this.serverOptions.webServerConfig)&&(D||O),L=er(e,"isPrefetchRSCRequest")??!1,$=er(e,"isRSCRequest")??!1;if(!D&&e.headers["x-middleware-prefetch"]&&!(w||"/_error"===n))return t.setHeader(eP.vx,n),t.setHeader("x-middleware-skip","1"),t.setHeader("cache-control","private, no-cache, no-store, max-age=0, must-revalidate"),t.body("{}").send(),null;D&&e.headers[eP.vx]&&e.url.startsWith("/_next/data")&&(e.url=this.stripNextDataPath(e.url));let H=er(e,"locale"),F=D?null==(l=this.nextConfig.i18n)?void 0:l.defaultLocale:er(e,"defaultLocale");e.headers["x-nextjs-data"]&&(!t.statusCode||200===t.statusCode)&&t.setHeader("x-nextjs-matched-path",`${H?`/${H}`:""}${n}`),a.routeModule&&(E=a.routeModule);let z=this.isAppPPREnabled&&void 0!==E&&rJ(E),U="1"===process.env.__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING&&void 0!==s.__nextppronly&&z,W=U&&"fallback"===s.__nextppronly,X=z&&((null==(u=I.routes[n]??I.dynamicRoutes[n])?void 0:u.renderingMode)==="PARTIALLY_STATIC"||U&&!0===this.experimentalTestProxy),B=U&&X,G=B&&!1,V=W&&X,J=X?er(e,"postponed"):void 0,Y=X&&$&&!L,Q=er(e,"segmentPrefetchRSCRequest");if(!w||q||$||(t.statusCode=404),eh.includes(n)&&(t.statusCode=parseInt(n.slice(1),10)),!T&&!J&&!w&&!x&&"/_error"!==n&&"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,n),null;if("string"==typeof a.Component)return{type:"html",body:tV.fromStatic(a.Component)};if("amp"in s&&!s.amp&&delete s.amp,!0===i.supportsDynamicResponse){let t=re(e.headers["user-agent"]||""),r="function"!=typeof(null==(p=a.Document)?void 0:p.getInitialProps)||"__NEXT_BUILTIN_DOCUMENT__"in a.Document;i.supportsDynamicResponse=!D&&!t&&!s.amp&&r}!q&&P&&i.dev&&(i.supportsDynamicResponse=!0);let Z=null==(c=this.nextConfig.i18n)?void 0:c.locales,et=!1;if(O||D||P){let{tryGetPreviewData:n}=r("./dist/esm/server/api-utils/node/try-get-preview-data.js");et=!1!==n(e,t,this.renderOpts.previewProps,!!this.nextConfig.experimental.multiZoneDraftMode)}P&&!i.dev&&!et&&D&&$&&!Y&&(!((v=i.runtime)===eP.li.experimentalEdge||v===eP.li.edge)||this.serverOptions.webServerConfig)&&rK(e.headers);let ei=!1,ea=!1;D&&({isOnDemandRevalidate:ei,revalidateOnlyGenerated:ea}=(0,ef.Gx)(e,this.renderOpts.previewProps)),D&&e.headers[eP.vx]&&(j=A),A=e5(A),j=e5(j),this.localeNormalizer&&(j=this.localeNormalizer.normalize(j)),q&&(j=this.stripNextDataPath(j),A=this.stripNextDataPath(A));let eo=null;et||!D||i.supportsDynamicResponse||T||J||Y||(eo=`${H?`/${H}`:""}${("/"===n||"/"===j)&&H?"":j}${s.amp?".amp":""}`),(w||x)&&D&&(eo=`${H?`/${H}`:""}${n}${s.amp?".amp":""}`),eo&&(eo="/index"===(eo=rB(eo))&&"/"===n?"/":eo);let el="https:";try{el=new URL(er(e,"initURL")||"/","http://n").protocol}catch{}let eu=globalThis.__incrementalCache||await this.getIncrementalCache({requestHeaders:Object.assign({},e.headers),requestProtocol:el.substring(0,el.length-1)});eu.resetRequestCache();let ed=async({postponed:r,pagesFallback:o=!1,fallbackRouteParams:l})=>{let u,c=!q&&!0===i.dev||!D&&!C||"string"==typeof r||Y,h=(0,d.parse)(e.url||"",!0).query;i.params&&Object.keys(i.params).forEach(e=>{delete h[e]});let p="/"!==A&&this.nextConfig.trailingSlash,f=(0,d.format)({pathname:`${j}${p?"/":""}`,query:h}),m=!c||M,g={...a,...i,...P?{incrementalCache:eu,isRevalidate:D&&!r&&!Y,serverActions:this.nextConfig.experimental.serverActions}:{},isNextDataRequest:q,resolvedUrl:f,locale:H,locales:Z,defaultLocale:F,multiZoneDraftMode:this.nextConfig.experimental.multiZoneDraftMode,resolvedAsPath:O||S?(0,d.format)({pathname:`${A}${p?"/":""}`,query:h}):f,experimental:{...i.experimental,isRoutePPREnabled:X},supportsDynamicResponse:c,shouldWaitOnAllReady:m,isOnDemandRevalidate:ei,isDraftMode:et,isServerAction:T,postponed:r,waitUntil:this.getWaitUntil(),onClose:t.onClose.bind(t),onAfterTaskError:void 0,setAppIsrStatus:this.setAppIsrStatus};if((B||G)&&(c=!1,g.nextExport=!0,g.supportsDynamicResponse=!1,g.isStaticGeneration=!0,g.isRevalidate=!0,g.isDebugDynamicAccesses=G),E){if(E.definition.kind===tK.APP_ROUTE){var v;if(!tq(e)||!tL(t))throw Object.defineProperty(Error("Invariant: App Route Route Modules cannot be used in the edge runtime"),"__NEXT_ERROR_CODE",{value:"E130",enumerable:!1,configurable:!0});let r={params:i.params,prerenderManifest:I,renderOpts:{experimental:{dynamicIO:g.experimental.dynamicIO,authInterrupts:g.experimental.authInterrupts},supportsDynamicResponse:c,incrementalCache:eu,cacheLifeProfiles:null==(v=this.nextConfig.experimental)?void 0:v.cacheLife,isRevalidate:D,waitUntil:this.getWaitUntil(),onClose:t.onClose.bind(t),onAfterTaskError:void 0,onInstrumentationRequestError:this.renderOpts.onInstrumentationRequestError},sharedContext:{buildId:this.buildId}};try{let n=tz.fromNodeNextRequest(e,function(e){let{errored:t,destroyed:r}=e;if(t||r)return AbortSignal.abort(t??new tH);let{signal:n}=tF(e);return n}(t.originalResponse)),i=await E.handle(n,r);e.fetchMetrics=r.renderOpts.fetchMetrics;let a=r.renderOpts.collectedTags;if(D){let e=await i.blob(),t=tm(i.headers);a&&(t[eP.VC]=a),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let n=void 0!==r.renderOpts.collectedRevalidate&&!(r.renderOpts.collectedRevalidate>=eP.AR)&&r.renderOpts.collectedRevalidate;return{value:{kind:tt.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},revalidate:n,isFallback:!1}}let s=r.renderOpts.pendingWaitUntil;return s&&r.renderOpts.waitUntil&&(r.renderOpts.waitUntil(s),s=void 0),await rW(e,t,i,r.renderOpts.pendingWaitUntil),null}catch(r){if(await this.instrumentationOnRequestError(r,e,{routerKind:"App Router",routePath:n,routeType:"route",revalidateReason:nr(g)}),D)throw r;return eW(r),await rW(e,t,new Response(null,{status:500})),null}}else if(rY(E)||rJ(E)){if("OPTIONS"===e.method&&!w)return await rW(e,t,new Response(null,{status:400})),null;if(rY(E)){g.nextFontManifest=this.nextFontManifest,g.clientReferenceManifest=a.clientReferenceManifest;let r=tq(e)?e.originalRequest:e,l=tL(t)?t.originalResponse:t;try{u=await E.render(r,l,{page:n,params:i.params,query:s,renderOpts:g,sharedContext:{buildId:this.buildId,deploymentId:this.nextConfig.deploymentId,customServer:this.serverOptions.customServer||void 0},renderContext:{isFallback:o,isDraftMode:g.isDraftMode,developmentNotFoundSourcePage:er(e,"developmentNotFoundSourcePage")}})}catch(t){throw await this.instrumentationOnRequestError(t,e,{routerKind:"Pages Router",routePath:n,routeType:"render",revalidateReason:nr({isRevalidate:D,isOnDemandRevalidate:g.isOnDemandRevalidate})}),t}}else{let r=a.routeModule;g.nextFontManifest=this.nextFontManifest;let o={page:w?"/404":n,params:i.params,query:s,fallbackRouteParams:l,renderOpts:g,serverComponentsHmrCache:this.getServerComponentsHmrCache(),sharedContext:{buildId:this.buildId}};this.nextConfig.experimental.dynamicIO,u=await r.render(e,t,o)}}else throw Object.defineProperty(Error("Invariant: Unknown route module type"),"__NEXT_ERROR_CODE",{value:"E450",enumerable:!1,configurable:!0})}else u=await this.renderHTML(e,t,n,s,g);let{metadata:y}=u,{headers:b={},fetchTags:_}=y;if(_&&(b[eP.VC]=_),e.fetchMetrics=y.fetchMetrics,P&&D&&0===y.revalidate&&!X){let e=y.staticBailoutInfo,t=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${A}${(null==e?void 0:e.description)?`, reason: ${e.description}`:""}
32
+ see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});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 y&&y.isNotFound?{value:null,revalidate:y.revalidate,isFallback:!1}:y.isRedirect?{value:{kind:tt.REDIRECT,props:y.pageData??y.flightData},revalidate:y.revalidate,isFallback:!1}:u.isNull?null:P?{value:{kind:tt.APP_PAGE,html:u,headers:b,rscData:y.flightData,postponed:y.postponed,status:t.statusCode,segmentData:y.segmentData},revalidate:y.revalidate,isFallback:!!l}:{value:{kind:tt.PAGES,html:u,pageData:y.pageData??y.flightData,headers:b,status:P?t.statusCode:void 0},revalidate:y.revalidate,isFallback:o}},ec=async({hasResolved:r,previousCacheEntry:o,isRevalidating:l})=>{if(r||t.sent,!y&&k){if(C){let t=await this.getStaticPaths({pathname:n,requestHeaders:e.headers,isAppPath:P,page:a.page});y=t.staticPaths,b=t.fallbackMode}else y=void 0,b=nn.NOT_FOUND}b===nn.PRERENDER&&re(e.headers["user-agent"]||"")&&(b=nn.BLOCKING_STATIC_RENDER),(null==o?void 0:o.isStale)===-1&&(ei=!0),ei&&(b!==nn.NOT_FOUND||o)&&(b=nn.BLOCKING_STATIC_RENDER);let u=eo;!u&&i.dev&&P&&(u=rB(j)),u&&s.amp&&(u=u.replace(/\.amp$/,"")),u&&(null==y||y.includes(u)),this.nextConfig.experimental.isExperimentalCompile&&(b=nn.BLOCKING_STATIC_RENDER);let d=ei||l||!J?void 0:J;if((B||G)&&void 0!==d)return{revalidate:1,isFallback:!1,value:{kind:tt.PAGES,html:tV.fromStatic(""),pageData:{},headers:void 0,status:void 0}};let c=k&&X&&(er(e,"didSetDefaultRouteMatches")||V)?function(e){let t;if(0===(t="string"==typeof e?Object.keys(ee(e7(e))(e)):e).length)return null;let r=new Map,n=Math.random().toString(16).slice(2);for(let e of t)r.set(e,`%%drp:${e}:${n}%%`);return r}(n):null,h=await ed({postponed:d,pagesFallback:void 0,fallbackRouteParams:c});return h?{...h,revalidate:h.revalidate}:null},ep=await this.responseCache.get(eo,ec,{routeKind:(null==E?void 0:E.definition.kind)??(P?tK.APP_PAGE:tK.PAGES),incrementalCache:eu,isOnDemandRevalidate:ei,isPrefetch:"prefetch"===e.headers.purpose,isRoutePPREnabled:X});if(et&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),!ep){if(eo&&!(ei&&ea))throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}let eg=(null==(h=ep.value)?void 0:h.kind)===tt.APP_PAGE&&"string"==typeof ep.value.postponed;D&&!Y&&(!eg||L)&&t.setHeader("x-nextjs-prerender","1");let{value:ev}=ep;if("string"==typeof Q&&(null==ev?void 0:ev.kind)===tt.APP_PAGE&&ev.segmentData){t.setHeader(ek,"2");let e=ev.segmentData.get(Q);return void 0!==e?{type:"rsc",body:tV.fromStatic(e),revalidate:ep.revalidate}:(t.statusCode=204,{type:"rsc",body:tV.fromStatic(""),revalidate:null==ep?void 0:ep.revalidate})}if((null==ev?void 0:ev.kind)===tt.IMAGE)throw Object.defineProperty(Error("invariant SSG should not return an image cache value"),"__NEXT_ERROR_CODE",{value:"E390",enumerable:!1,configurable:!0});if(J)_=0;else if($&&!L&&X)_=0;else if(1){if(et)_=0;else if(D){if(w){let t=er(e,"notFoundRevalidate");_=void 0===t?0:t}else if(x)_=0;else if("number"==typeof ep.revalidate){if(ep.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${ep.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});_=ep.revalidate}else!1===ep.revalidate&&(_=eP.qF)}else t.getHeader("Cache-Control")||(_=0)}ep.revalidate=_;let ey=er(e,"onCacheEntry");if(ey&&await ey({...ep,value:{...ep.value,kind:(null==(f=ep.value)?void 0:f.kind)===tt.APP_PAGE?"PAGE":null==(m=ep.value)?void 0:m.kind}},{url:er(e,"initURL")}))return null;if(ev){if(ev.kind===tt.REDIRECT)return(void 0===ep.revalidate||t.getHeader("Cache-Control")||t.setHeader("Cache-Control",eO({revalidate:ep.revalidate,expireTime:this.nextConfig.expireTime})),q)?{type:"json",body:tV.fromStatic(JSON.stringify(ev.props)),revalidate:ep.revalidate}:(await (e=>{let r={destination:e.pageProps.__N_REDIRECT,statusCode:e.pageProps.__N_REDIRECT_STATUS,basePath:e.pageProps.__N_REDIRECT_BASE_PATH},n=r.statusCode||(r.permanent?em.PermanentRedirect:em.TemporaryRedirect),{basePath:i}=this.nextConfig;i&&!1!==r.basePath&&r.destination.startsWith("/")&&(r.destination=`${i}${r.destination}`),r.destination.startsWith("/")&&(r.destination=K(r.destination)),t.redirect(r.destination,n).body(r.destination).send()})(ev.props),null);if(ev.kind===tt.APP_ROUTE){let r=tp(ev.headers);return D||r.delete(eP.VC),void 0===ep.revalidate||t.getHeader("Cache-Control")||r.get("Cache-Control")||r.set("Cache-Control",eO({revalidate:ep.revalidate,expireTime:this.nextConfig.expireTime})),await rW(e,t,new Response(ev.body,{headers:r,status:ev.status||200})),null}if(ev.kind===tt.APP_PAGE){if(eg&&J)throw Object.defineProperty(Error("Invariant: postponed state should not be present on a resume request"),"__NEXT_ERROR_CODE",{value:"E396",enumerable:!1,configurable:!0});if(ev.headers){let e={...ev.headers};for(let[r,n]of(D||delete e[eP.VC],Object.entries(e)))if(void 0!==n){if(Array.isArray(n))for(let e of n)t.appendHeader(r,e);else"number"==typeof n&&(n=n.toString()),t.appendHeader(r,n)}}if(D&&(null==(g=ev.headers)?void 0:g[eP.VC])&&t.setHeader(eP.VC,ev.headers[eP.VC]),!ev.status||$&&X||(t.statusCode=ev.status),eg&&t.setHeader(ek,"1"),$&&!et){if(void 0===ev.rscData){if(ev.postponed)throw Object.defineProperty(Error("Invariant: Expected postponed to be undefined"),"__NEXT_ERROR_CODE",{value:"E372",enumerable:!1,configurable:!0});return{type:"rsc",body:ev.html,revalidate:Y?0:ep.revalidate}}return{type:"rsc",body:tV.fromStatic(ev.rscData),revalidate:ep.revalidate}}return{type:"html",body:ev.html,revalidate:ep.revalidate}}return q?{type:"json",body:tV.fromStatic(JSON.stringify(ev.pageData)),revalidate:ep.revalidate}:{type:"html",body:ev.html,revalidate:ep.revalidate}}return(en(e,"notFoundRevalidate",ep.revalidate),void 0===ep.revalidate||t.getHeader("Cache-Control")||t.setHeader("Cache-Control",eO({revalidate:ep.revalidate,expireTime:this.nextConfig.expireTime})),q)?(t.statusCode=404,t.body('{"notFound":true}').send()):await this.render404(e,t,{pathname:n,query:s},!1),null}stripNextDataPath(e,t=!0){return(e.includes(this.buildId)&&(e=rr(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;let{query:n,pathname:i}=e,a=this.getOriginalAppPaths(i),s=Array.isArray(a),o=i;s&&(o=a[a.length-1]);let l=await this.findPageComponents({locale:er(e.req,"locale"),page:o,query:n,params:e.renderOpts.params||{},isAppPath:s,sriEnabled:!!(null==(r=this.nextConfig.experimental.sri)?void 0:r.algorithm),appPaths:a,shouldEnsure:!1});if(l){(0,ts.getTracer)().setRootSpanAttribute("next.route",i);try{return await this.renderToResponseWithComponents(e,l)}catch(r){let e=r instanceof ns;if(!e||e&&t)throw r}}return!1}async renderToResponse(e){return(0,ts.getTracer)().trace(to.Li.renderToResponse,{spanName:"rendering page",attributes:{"next.route":e.pathname}},async()=>this.renderToResponseImpl(e))}async renderToResponseImpl(e){var t;let{req:r,res:n,query:i,pathname:a}=e,s=er(e.req,"bubbleNoFallback")??!1;delete i[eN];let o={i18n:null==(t=this.i18nProvider)?void 0:t.fromRequest(r,a)};try{for await(let t of this.matchers.matchAll(a,o)){er(e.req,"invokeOutput");let r=await this.renderPageComponent({...e,pathname:t.definition.pathname,renderOpts:{...e.renderOpts,params:t.params}},s);if(!1!==r)return r}if(this.serverOptions.webServerConfig){e.pathname=this.serverOptions.webServerConfig.page;let t=await this.renderPageComponent(e,s);if(!1!==t)return t}}catch(i){let t=ru(i);if(i instanceof Z)throw console.error("Invariant: failed to load static page",JSON.stringify({page:a,url:e.req.url,matchedPath:e.req.headers[eP.vx],initUrl:er(e.req,"initURL"),didRewrite:!!er(e.req,"rewroteURL"),rewroteUrl:er(e.req,"rewroteURL")},null,2)),t;if(t instanceof ns&&s)throw t;if(t instanceof J||t instanceof Y)return n.statusCode=400,await this.renderErrorToResponse(e,t);n.statusCode=500,await this.hasPage("/500")&&(en(e.req,"customErrorRender",!0),await this.renderErrorToResponse(e,t),ei(e.req,"customErrorRender"));let r=t instanceof no;if(!r)throw rl(t)&&(t.page=a),t;return await this.renderErrorToResponse(e,r?t.innerError:t)}if(this.getMiddleware()&&e.req.headers["x-nextjs-data"]&&(!n.statusCode||200===n.statusCode||404===n.statusCode)){let e=er(r,"locale");return n.setHeader("x-nextjs-matched-path",`${e?`/${e}`:""}${a}`),n.statusCode=200,n.setHeader("content-type","application/json"),n.body("{}"),n.send(),null}return n.statusCode=404,this.renderErrorToResponse(e,null)}async renderToHTML(e,t,r,n={}){return(0,ts.getTracer)().trace(to.Li.renderToHTML,async()=>this.renderToHTMLImpl(e,t,r,n))}async renderToHTMLImpl(e,t,r,n={}){return this.getStaticHTML(e=>this.renderToResponse(e),{req:e,res:t,pathname:r,query:n})}async renderError(e,t,r,n,i={},a=!0){return(0,ts.getTracer)().trace(to.Li.renderError,async()=>this.renderErrorImpl(e,t,r,n,i,a))}async renderErrorImpl(e,t,r,n,i={},a=!0){return a&&r.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),this.pipe(async t=>{let n=await this.renderErrorToResponse(t,e);if(500===r.statusCode)throw e;return n},{req:t,res:r,pathname:n,query:i})}async renderErrorToResponse(e,t){return(0,ts.getTracer)().trace(to.Li.renderErrorToResponse,async()=>this.renderErrorToResponseImpl(e,t))}async renderErrorToResponseImpl(e,t){let{res:r,query:n}=e;try{let i=null;404===r.statusCode&&(this.enabledDirectories.app&&(i=await this.findPageComponents({locale:er(e.req,"locale"),page:eo,query:n,params:{},isAppPath:!0,shouldEnsure:!0,url:e.req.url})),!i&&await this.hasPage("/404")&&(i=await this.findPageComponents({locale:er(e.req,"locale"),page:"/404",query:n,params:{},isAppPath:!1,shouldEnsure:!0,url:e.req.url})));let a=`/${r.statusCode}`;if(!er(e.req,"customErrorRender")&&!i&&eh.includes(a)&&(i=await this.findPageComponents({locale:er(e.req,"locale"),page:a,query:n,params:{},isAppPath:!1,shouldEnsure:!0,url:e.req.url})),i||(i=await this.findPageComponents({locale:er(e.req,"locale"),page:"/_error",query:n,params:{},isAppPath:!1,shouldEnsure:!0,url:e.req.url}),a="/_error"),!i)throw new no(Object.defineProperty(Error("missing required error components"),"__NEXT_ERROR_CODE",{value:"E60",enumerable:!1,configurable:!0}));i.components.routeModule?en(e.req,"match",{definition:i.components.routeModule.definition,params:void 0}):ei(e.req,"match");try{return await this.renderToResponseWithComponents({...e,pathname:a,renderOpts:{...e.renderOpts,err:t}},i)}catch(e){if(e instanceof ns)throw Object.defineProperty(Error("invariant: failed to render error page"),"__NEXT_ERROR_CODE",{value:"E55",enumerable:!1,configurable:!0});throw e}}catch(s){let t=ru(s),i=t instanceof no;i||this.logError(t),r.statusCode=500;let a=await this.getFallbackErrorComponents(e.req.url);if(a)return en(e.req,"match",{definition:a.routeModule.definition,params:void 0}),this.renderToResponseWithComponents({...e,pathname:"/_error",renderOpts:{...e.renderOpts,err:i?t.innerError:t}},{query:n,components:a});return{type:"html",body:tV.fromStatic("Internal Server Error")}}}async renderErrorToHTML(e,t,r,n,i={}){return this.getStaticHTML(t=>this.renderErrorToResponse(t,e),{req:t,res:r,pathname:n,query:i})}async render404(e,t,r,n=!0){let{pathname:i,query:a}=r||(0,d.parse)(e.url,!0);return this.nextConfig.i18n&&(er(e,"locale")||en(e,"locale",this.nextConfig.i18n.defaultLocale),en(e,"defaultLocale",this.nextConfig.i18n.defaultLocale)),t.statusCode=404,this.renderError(null,e,t,i,a,n)}}let nu=require("vm");function nd(e){if(Object.isFrozen(e))return e;if(Array.isArray(e)){for(let t of e)t&&"object"==typeof t&&nd(t);return Object.freeze(e)}for(let t of Object.values(e))t&&"object"==typeof t&&nd(t);return Object.freeze(e)}let nc=new Map;function nh(e,t=!0,r=nc){let n=t&&r.get(e);if(n)return n;let i=JSON.parse((0,h.readFileSync)(e,"utf8"));return t&&(i=nd(i)),t&&r.set(e,i),i}let np=new eL(1e3);function nf(e,t,r,n){let i;let a=`${e}:${t}:${r}:${n}`,s=null==np?void 0:np.get(a);if(s)return s;let o=u().join(t,ed);n&&(i=nh(u().join(o,eu),!0));let l=nh(u().join(o,el),!0);try{e=rr(rb(e))}catch(t){throw console.error(t),new Q(e)}let d=t=>{let n=t[e];if(!t[n]&&r){let i={};for(let e of Object.keys(t))i[tx(e,r).pathname]=l[e];n=i[e]}return n};return(i&&(s=d(i)),s||(s=d(l)),s)?(s=u().join(o,s),null==np||np.set(a,s),s):(null==np||np.set(a,null),null)}function nm(e,t,r,n){let i=nf(e,t,r,n);if(!i)throw new Q(e);return i}async function ng(e,t,r){let n=nm(e,t,void 0,r);if(n.endsWith(".html"))return h.promises.readFile(n,"utf8").catch(t=>{throw new Z(e,t.message)});try{return process.env.__NEXT_PRIVATE_RUNTIME_TYPE=r?"app":"pages",require(n)}finally{process.env.__NEXT_PRIVATE_RUNTIME_TYPE=""}}function nv(e){return e.default||e}async function ny(e){return new Promise(t=>setTimeout(t,e))}let nb=Symbol.for("next.server.action-manifests");async function nE(e,t=3){for(;;)try{return nh(e)}catch(e){if(--t<=0)throw e;await ny(100)}}async function n_(e,t=3){try{return await nE(e,t)}catch(e){return}}async function nR(e,t=3){for(;;)try{return function(e,t=!0,r=nc){let n=t&&r.get(e);if(n)return n;let i=(0,h.readFileSync)(e,"utf8");if(0===i.length)throw Object.defineProperty(Error("Manifest file is empty"),"__NEXT_ERROR_CODE",{value:"E328",enumerable:!1,configurable:!0});let a={};return(0,nu.runInNewContext)(i,a),t&&(a=nd(a)),t&&r.set(e,a),a}(e)}catch(e){if(--t<=0)throw e;await ny(100)}}async function nw(e,t,r){try{return(await nR(e,r)).__RSC_MANIFEST[t]}catch(e){return}}async function nx({distDir:e,page:t,isAppPath:r,isDev:n,sriEnabled:i}){let a,s={},o={};r||([s,o]=await Promise.all([ng("/_document",e,!1),ng("/_app",e,!1)]));let u=n?3:1;a=(0,l.join)(e,"react-loadable-manifest.json");let[d,c,h,p,f,m]=await Promise.all([nE((0,l.join)(e,"build-manifest.json"),u),n_(a,u),r?void 0:nE((0,l.join)(e,"dynamic-css-manifest.json"),u).catch(()=>void 0),r?nw((0,l.join)(e,"server","app",t.replace(/%5F/g,"_")+"_client-reference-manifest.js"),t.replace(/%5F/g,"_"),u):void 0,r?nE((0,l.join)(e,"server","server-reference-manifest.json"),u).catch(()=>null):null,i?nE((0,l.join)(e,"server","subresource-integrity-manifest.json")).catch(()=>void 0):void 0]);f&&p&&function({page:e,clientReferenceManifest:t,serverActionsManifest:r,serverModuleMap:n}){var i;let a=null==(i=globalThis[nb])?void 0:i.clientReferenceManifestsPerPage;globalThis[nb]={clientReferenceManifestsPerPage:{...a,[eZ(e)]:t},serverActionsManifest:r,serverModuleMap:n}}({page:t,clientReferenceManifest:p,serverActionsManifest:f,serverModuleMap:function({serverActionsManifest:e}){return new Proxy({},{get:(t,r)=>{var n;let i;let a=e.node[r].workers,s=L.workAsyncStorage.getStore();if(!(i=s?a[t_(n=s.page,"app")?n:"app"+n]:Object.values(a).at(0)))return;let{moduleId:o,async:l}=i;return{id:o,name:r,chunks:[],async:l}}})}({serverActionsManifest:f})});let g=await ng(t,e,r),v=nv(g),y=nv(s),b=nv(o),{getServerSideProps:E,getStaticProps:_,getStaticPaths:R,routeModule:w}=g;return{App:b,Document:y,Component:v,buildManifest:d,subresourceIntegrityManifest:m,reactLoadableManifest:c||{},dynamicCssManifest:h,pageConfig:g.config||{},ComponentMod:g,getServerSideProps:E,getStaticProps:_,getStaticPaths:R,clientReferenceManifest:p,serverActionsManifest:f,isAppPath:r,page:t,routeModule:w}}let nP=(0,ts.getTracer)().wrap(to.p2.loadComponents,nx);function nO(e){return(t,r,n)=>{for(let i of e)if(new RegExp(i.regexp).exec(t)&&(!i.has&&!i.missing||rs(r,n,i.has,i.missing)))return!0;return!1}}var nC=r("../next-env/dist/index.js");let nT=require("stream");var nS=/*#__PURE__*/r.n(nT);let nD=require("next/dist/server/lib/incremental-cache/tags-manifest.external.js");class nA{constructor(e){this.fs=e,this.tasks=[]}findOrCreateTask(e){for(let t of this.tasks)if(t[0]===e)return t;let t=this.fs.mkdir(e);t.catch(()=>{});let r=[e,t,[]];return this.tasks.push(r),r}append(e,t){let r=this.findOrCreateTask(rv().dirname(e)),n=r[1].then(()=>this.fs.writeFile(e,t));n.catch(()=>{}),r[2].push(n)}wait(){return Promise.all(this.tasks.flatMap(e=>e[2]))}}class nj{constructor(e){this.fs=e.fs,this.flushToDisk=e.flushToDisk,this.serverDistDir=e.serverDistDir,this.revalidatedTags=e.revalidatedTags,this.debug=!!process.env.NEXT_PRIVATE_DEBUG_CACHE,e.maxMemoryCacheSize?t||(this.debug&&console.log("using memory store for fetch cache"),t=new eL(e.maxMemoryCacheSize,function({value:e}){var t;if(!e)return 25;if(e.kind===tt.REDIRECT)return JSON.stringify(e.props).length;if(e.kind===tt.IMAGE)throw Object.defineProperty(Error("invariant image should not be incremental-cache"),"__NEXT_ERROR_CODE",{value:"E501",enumerable:!1,configurable:!0});return e.kind===tt.FETCH?JSON.stringify(e.data||"").length:e.kind===tt.APP_ROUTE?e.body.length:e.html.length+((null==(t=JSON.stringify(e.kind===tt.APP_PAGE?e.rscData:e.pageData))?void 0:t.length)||0)})):this.debug&&console.log("not using memory store for fetch cache")}resetRequestCache(){}async revalidateTag(...e){let[t]=e;if(t="string"==typeof t?[t]:t,this.debug&&console.log("revalidateTag",t),0!==t.length)for(let e of t){let t=nD.tagsManifest.items[e]||{};t.revalidatedAt=Date.now(),nD.tagsManifest.items[e]=t}}async get(...e){var r,n,i,a,s,o;let[l,u]=e,{tags:d,softTags:c,kind:h,isRoutePPREnabled:p,isFallback:f}=u,m=null==t?void 0:t.get(l);if(this.debug&&console.log("get",l,d,h,!!m),!m){if(h===tr.APP_ROUTE)try{let e=this.getFilePath(`${l}.body`,tr.APP_ROUTE),t=await this.fs.readFile(e),{mtime:r}=await this.fs.stat(e),n=JSON.parse(await this.fs.readFile(e.replace(/\.body$/,eP.EP),"utf8"));return{lastModified:r.getTime(),value:{kind:tt.APP_ROUTE,body:t,headers:n.headers,status:n.status}}}catch{return null}try{let e=this.getFilePath(h===tr.FETCH?l:`${l}.html`,h),r=await this.fs.readFile(e,"utf8"),{mtime:n}=await this.fs.stat(e);if(h===tr.FETCH){if(!this.flushToDisk)return null;let e=n.getTime(),t=JSON.parse(r);if(m={lastModified:e,value:t},(null==(a=m.value)?void 0:a.kind)===tt.FETCH){let e=null==(s=m.value)?void 0:s.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,m.value,{tags:d,isRoutePPREnabled:p}))}}else if(h===tr.APP_PAGE){let t,i,a;try{t=JSON.parse(await this.fs.readFile(e.replace(/\.html$/,eP.EP),"utf8"))}catch{}if(null==t?void 0:t.segmentPaths){let e=new Map;i=e;let r=l+eP.mH;await Promise.all(t.segmentPaths.map(async t=>{let n=this.getFilePath(r+t+eP.tz,tr.APP_PAGE);try{e.set(t,await this.fs.readFile(n))}catch{}}))}f||(a=await this.fs.readFile(this.getFilePath(`${l}${p?eP.pu:eP.RM}`,tr.APP_PAGE))),m={lastModified:n.getTime(),value:{kind:tt.APP_PAGE,html:r,rscData:a,postponed:null==t?void 0:t.postponed,headers:null==t?void 0:t.headers,status:null==t?void 0:t.status,segmentData:i}}}else if(h===tr.PAGES){let e;let t={};f||(t=JSON.parse(await this.fs.readFile(this.getFilePath(`${l}${eP.x3}`,tr.PAGES),"utf8"))),m={lastModified:n.getTime(),value:{kind:tt.PAGES,html:r,pageData:t,headers:null==e?void 0:e.headers,status:null==e?void 0:e.status}}}else throw Object.defineProperty(Error(`Invariant: Unexpected route kind ${h} in file system cache.`),"__NEXT_ERROR_CODE",{value:"E445",enumerable:!1,configurable:!0});m&&(null==t||t.set(l,m))}catch{return null}}if((null==m?void 0:null==(r=m.value)?void 0:r.kind)===tt.APP_PAGE||(null==m?void 0:null==(n=m.value)?void 0:n.kind)===tt.PAGES){let e;let t=null==(o=m.value.headers)?void 0:o[eP.VC];if("string"==typeof t&&(e=t.split(",")),(null==e?void 0:e.length)&&e.some(e=>{var t;return(null==nD.tagsManifest?void 0:null==(t=nD.tagsManifest.items[e])?void 0:t.revalidatedAt)&&(null==nD.tagsManifest?void 0:nD.tagsManifest.items[e].revalidatedAt)>=((null==m?void 0:m.lastModified)||Date.now())}))return null}else(null==m?void 0:null==(i=m.value)?void 0:i.kind)===tt.FETCH&&[...d||[],...c||[]].some(e=>{var t;return!!this.revalidatedTags.includes(e)||(null==nD.tagsManifest?void 0:null==(t=nD.tagsManifest.items[e])?void 0:t.revalidatedAt)&&(null==nD.tagsManifest?void 0:nD.tagsManifest.items[e].revalidatedAt)>=((null==m?void 0:m.lastModified)||Date.now())})&&(m=void 0);return m??null}async set(...e){let[r,n,i]=e,{isFallback:a}=i;if(null==t||t.set(r,{value:n,lastModified:Date.now()}),this.debug&&console.log("set",r),!this.flushToDisk||!n)return;let s=new nA(this.fs);if(n.kind===tt.APP_ROUTE){let e=this.getFilePath(`${r}.body`,tr.APP_ROUTE);s.append(e,n.body);let t={headers:n.headers,status:n.status,postponed:void 0,segmentPaths:void 0};s.append(e.replace(/\.body$/,eP.EP),JSON.stringify(t,null,2))}else if(n.kind===tt.PAGES||n.kind===tt.APP_PAGE){let e=n.kind===tt.APP_PAGE,t=this.getFilePath(`${r}.html`,e?tr.APP_PAGE:tr.PAGES);if(s.append(t,n.html),a||s.append(this.getFilePath(`${r}${e?i.isRoutePPREnabled?eP.pu:eP.RM:eP.x3}`,e?tr.APP_PAGE:tr.PAGES),e?n.rscData:JSON.stringify(n.pageData)),(null==n?void 0:n.kind)===tt.APP_PAGE){let e;if(n.segmentData){e=[];let r=t.replace(/\.html$/,eP.mH);for(let[t,i]of n.segmentData){e.push(t);let n=r+t+eP.tz;s.append(n,i)}}let r={headers:n.headers,status:n.status,postponed:n.postponed,segmentPaths:e};s.append(t.replace(/\.html$/,eP.EP),JSON.stringify(r))}}else if(n.kind===tt.FETCH){let e=this.getFilePath(r,tr.FETCH);s.append(e,JSON.stringify({...n,tags:i.tags}))}await s.wait()}getFilePath(e,t){switch(t){case tr.FETCH:return rv().join(this.serverDistDir,"..","cache","fetch-cache",e);case tr.PAGES:return rv().join(this.serverDistDir,"pages",e);case tr.IMAGE:case tr.APP_PAGE:case tr.APP_ROUTE:return rv().join(this.serverDistDir,"app",e);default:throw Object.defineProperty(Error(`Unexpected file path kind: ${t}`),"__NEXT_ERROR_CODE",{value:"E479",enumerable:!1,configurable:!0})}}}class nN{static #e=this.timings=new Map;constructor(e){this.prerenderManifest=e}get(e){var t,r;let n=nN.timings.get(e);if(void 0!==n||void 0!==(n=null==(t=this.prerenderManifest.routes[e])?void 0:t.initialRevalidateSeconds)||void 0!==(n=null==(r=this.prerenderManifest.dynamicRoutes[e])?void 0:r.fallbackRevalidate))return n}set(e,t){nN.timings.set(e,t)}clear(){nN.timings.clear()}}let nk=r2?new r2:new class{disable(){throw r4}getStore(){}run(){throw r4}exit(){throw r4}enterWith(){throw r4}static bind(e){return e}};class nI{constructor({fs:e,dev:t,flushToDisk:r,minimalMode:n,serverDistDir:i,requestHeaders:a,requestProtocol:s,maxMemoryCacheSize:o,getPrerenderManifest:l,fetchCacheKeyPrefix:u,CurCacheHandler:d,allowedRevalidateHeaderKeys:c}){var h,p,f,m;this.locks=new Map;let g=!!process.env.NEXT_PRIVATE_DEBUG_CACHE;this.hasCustomCacheHandler=!!d;let v=Symbol.for("@next/cache-handlers"),y=globalThis;if(d)g&&console.log("using custom cache handler",d.name);else{let t=y[v];(null==t?void 0:t.FetchCache)?d=t.FetchCache:e&&i&&(g&&console.log("using filesystem cache handler"),d=nj)}process.env.__NEXT_TEST_MAX_ISR_CACHE&&(o=parseInt(process.env.__NEXT_TEST_MAX_ISR_CACHE,10)),this.dev=t,this.disableForTestmode="true"===process.env.NEXT_PRIVATE_TEST_PROXY,this.minimalMode=n,this.requestHeaders=a,this.requestProtocol=s,this.allowedRevalidateHeaderKeys=c,this.prerenderManifest=l(),this.revalidateTimings=new nN(this.prerenderManifest),this.fetchCacheKeyPrefix=u;let b=[];a[eP.kz]===(null==(p=this.prerenderManifest)?void 0:null==(h=p.preview)?void 0:h.previewModeId)&&(this.isOnDemandRevalidate=!0),n&&"string"==typeof a[eP.vS]&&a[eP.c1]===(null==(m=this.prerenderManifest)?void 0:null==(f=m.preview)?void 0:f.previewModeId)&&(b=a[eP.vS].split(",")),d&&(this.cacheHandler=new d({dev:t,fs:e,flushToDisk:r,serverDistDir:i,revalidatedTags:b,maxMemoryCacheSize:o,_requestHeaders:a,fetchCacheKeyPrefix:u}))}calculateRevalidate(e,t,r,n){if(r)return Math.floor(performance.timeOrigin+performance.now()-1e3);let i=this.revalidateTimings.get(r1(e))??(!n&&1);return"number"==typeof i?1e3*i+t:i}_getPathname(e,t){return t?e:rb(e)}resetRequestCache(){var e,t;null==(t=this.cacheHandler)||null==(e=t.resetRequestCache)||e.call(t)}async lock(e){let t=()=>Promise.resolve(),r=this.locks.get(e);r&&await r;let n=new Promise(r=>{t=async()=>{r(),this.locks.delete(e)}});return this.locks.set(e,n),t}async revalidateTag(e){var t,r;return Promise.all([Object.values(globalThis.__nextCacheHandlers||{}).map(t=>"function"==typeof t.expireTags&&t.expireTags(...Array.isArray(e)?e:[e])),null==(r=this.cacheHandler)?void 0:null==(t=r.revalidateTag)?void 0:t.call(r,e)]).then(()=>{})}async generateCacheKey(e,t={}){let n=[],i=new TextEncoder,a=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(i.encode(e)),n.push(e)):(r.push(e),n.push(a.decode(e,{stream:!0})))}})),n.push(a.decode());let s=r.reduce((e,t)=>e+t.length,0),o=new Uint8Array(s),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);n.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();n.push(await e.text()),t._ogBody=new Blob([r],{type:e.type})}else"string"==typeof t.body&&(n.push(t.body),t._ogBody=t.body)}let s="function"==typeof(t.headers||{}).keys?Object.fromEntries(t.headers):Object.assign({},t.headers);"traceparent"in s&&delete s.traceparent,"tracestate"in s&&delete s.tracestate;let o=JSON.stringify(["v3",this.fetchCacheKeyPrefix||"",e,t.method,s,t.mode,t.redirect,t.credentials,t.referrer,t.referrerPolicy,t.integrity,t.cache,n]);return r("crypto").createHash("sha256").update(o).digest("hex")}async get(e,t){var r,n;let i,a;if(t.kind===tr.FETCH){let t=nk.getStore(),r=t?(0,A.getRenderResumeDataCache)(t):null;if(r){let t=r.fetch.get(e);if((null==t?void 0:t.kind)===tt.FETCH)return{isStale:!1,value:t,revalidateAfter:!1,isFallback:!1}}}if(this.disableForTestmode||this.dev&&(t.kind!==tr.FETCH||"no-cache"===this.requestHeaders["cache-control"]))return null;let{isFallback:s}=t;e=this._getPathname(e,t.kind===tr.FETCH);let o=null,l=t.revalidate,u=await (null==(r=this.cacheHandler)?void 0:r.get(e,t));if((null==u?void 0:null==(n=u.value)?void 0:n.kind)===tt.FETCH){if([...t.tags||[],...t.softTags||[]].some(e=>{var t;return null==(t=this.revalidatedTags)?void 0:t.includes(e)}))return null;l=l||u.value.revalidate;let e=(performance.timeOrigin+performance.now()-(u.lastModified||0))/1e3>l,r=u.value.data;return{isStale:e,value:{kind:tt.FETCH,data:r,revalidate:l},revalidateAfter:performance.timeOrigin+performance.now()+1e3*l,isFallback:s}}let d=this.revalidateTimings.get(r1(e));return(null==u?void 0:u.lastModified)===-1?(i=-1,a=-1*eP.qF):i=!!(!1!==(a=this.calculateRevalidate(e,(null==u?void 0:u.lastModified)||performance.timeOrigin+performance.now(),!!this.dev&&t.kind!==tr.FETCH,t.isFallback))&&a<performance.timeOrigin+performance.now())||void 0,u&&(o={isStale:i,curRevalidate:d,revalidateAfter:a,value:u.value,isFallback:s}),!u&&this.prerenderManifest.notFoundRoutes.includes(e)&&(o={isStale:i,value:null,curRevalidate:d,revalidateAfter:a,isFallback:s},this.set(e,o.value,t)),o}async set(e,t,r){if((null==t?void 0:t.kind)===tt.FETCH){let r=nk.getStore(),n=r?(0,A.getPrerenderResumeDataCache)(r):null;n&&n.fetch.set(e,t)}if(this.disableForTestmode||this.dev&&!r.fetchCache)return;e=this._getPathname(e,r.fetchCache);let n=JSON.stringify(t).length;if(r.fetchCache&&!this.hasCustomCacheHandler&&n>2097152){if(this.dev)throw Object.defineProperty(Error(`Failed to set Next.js data cache, items over 2MB can not be cached (${n} bytes)`),"__NEXT_ERROR_CODE",{value:"E86",enumerable:!1,configurable:!0});return}try{var i;void 0===r.revalidate||r.fetchCache||this.revalidateTimings.set(r1(e),r.revalidate),await (null==(i=this.cacheHandler)?void 0:i.set(e,t,r))}catch(t){console.warn("Failed to update prerender cache for",e,t)}}}let nM=require("http"),nq=require("https"),nL={existsSync:p().existsSync,readFile:p().promises.readFile,readFileSync:p().readFileSync,writeFile:(e,t)=>p().promises.writeFile(e,t),mkdir:e=>p().promises.mkdir(e,{recursive:!0}),stat:e=>p().promises.stat(e)};class n$ extends nS().Readable{constructor({url:e,headers:t,method:r,socket:n=null,readable:i}){super(),this.httpVersion="1.0",this.httpVersionMajor=1,this.httpVersionMinor=0,this.socket=new Proxy({},{get:(e,t)=>{if("encrypted"!==t&&"remoteAddress"!==t)throw Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0});if("remoteAddress"!==t)return!1}}),this.url=e,this.headers=t,this.method=r,i&&(this.bodyReadable=i,this.bodyReadable.on("end",()=>this.emit("end")),this.bodyReadable.on("close",()=>this.emit("close"))),n&&(this.socket=n)}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 Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0})}get complete(){throw Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0})}get trailers(){throw Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0})}get trailersDistinct(){throw Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0})}get rawTrailers(){throw Object.defineProperty(Error("Method not implemented"),"__NEXT_ERROR_CODE",{value:"E52",enumerable:!1,configurable:!0})}get rawHeaders(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}setTimeout(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}}class nH extends nS().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?tp(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 tm(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 Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}writeEarlyHints(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get req(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}assignSocket(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}detachSocket(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}writeContinue(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}writeProcessing(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get upgrading(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get chunkedEncoding(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get shouldKeepAlive(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get useChunkedEncodingByDefault(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}get sendDate(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}setTimeout(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}addTrailers(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}setHeaders(){throw Object.defineProperty(Error("Method not implemented."),"__NEXT_ERROR_CODE",{value:"E41",enumerable:!1,configurable:!0})}}class nF{async load(e){return await require(e)}}class nz{static async load(e,t=new nF){let r=await t.load(e);if("routeModule"in r)return r.routeModule;throw Object.defineProperty(Error(`Module "${e}" does not export a routeModule.`),"__NEXT_ERROR_CODE",{value:"E53",enumerable:!1,configurable:!0})}}let nU=(e,t)=>{let r=u().isAbsolute(t)?t:u().join(e,t);return(0,d.pathToFileURL)(r).toString()};function nW(e){var t,r;return(null==(r=e.has)?void 0:null==(t=r[0])?void 0:t.key)===eA}class nX{add(e){this.callbacks.push(e)}async runAll(){if(!this.callbacks.length)return;let e=this.callbacks;this.callbacks=[],await Promise.allSettled(e.map(async e=>e()))}constructor(){this.callbacks=[]}}let nB=new eL(0x3200000,e=>e.size),nG=new Map,nV={async get(e,t){await nG.get(e);let r=nB.get(e);if(!r)return;let n=r.entry;if(performance.timeOrigin+performance.now()>n.timestamp+1e3*n.revalidate||(0,nD.isTagStale)(n.tags,n.timestamp)||(0,nD.isTagStale)(t,n.timestamp))return;let[i,a]=n.value.tee();return n.value=a,{...n,value:i}},async set(e,t){let r=()=>{},n=new Promise(e=>{r=e});nG.set(e,n);let i=await t,a=0;try{let[t,r]=i.value.tee();i.value=t;let n=r.getReader();for(let e;!(e=await n.read()).done;)a+=Buffer.from(e.value).byteLength;nB.set(e,{entry:i,isErrored:!1,errorRetryCount:0,size:a})}catch{}finally{r(),nG.delete(e)}},async expireTags(...e){for(let t of e)nD.tagsManifest.items[t]||(nD.tagsManifest.items[t]={}),nD.tagsManifest.items[t].revalidatedAt=Date.now()},async receiveExpiredTags(...e){return this.expireTags(...e)}},nK=Symbol.for("@next/cache-handlers"),nJ=globalThis,nY=e=>import(e).then(e=>e.default||e),nQ=require,nZ=new WeakMap;class n0 extends nl{constructor(e){var t,r;super(e),this.registeredInstrumentation=!1,this.cleanupListeners=new nX,this.handleNextImageRequest=async(e,t,r)=>!(!r.pathname||!r.pathname.startsWith("/_next/image")||er(e,"middlewareInvoke"))&&(t.statusCode=400,t.body("Bad Request").send(),!0),this.handleCatchallRenderRequest=async(e,t,r)=>{let{pathname:n,query:i}=r;if(!n)throw Object.defineProperty(Error("Invariant: pathname is undefined"),"__NEXT_ERROR_CODE",{value:"E409",enumerable:!1,configurable:!0});en(e,"bubbleNoFallback",!0);try{var a;n=e5(n);let s={i18n:null==(a=this.i18nProvider)?void 0:a.fromRequest(e,n)},o=await this.matchers.match(n,s);if(!o)return await this.render(e,t,n,i,r,!0),!0;for(let n of(en(e,"match",o),this.getEdgeFunctionsPages()))if(n===o.definition.page){if("export"===this.nextConfig.output)return await this.render404(e,t,r),!0;delete i[eN];try{if(await this.runEdgeFunction({req:e,res:t,query:i,params:o.params,page:o.definition.page,match:o,appPaths:null}))return!0}catch(t){throw await this.instrumentationOnRequestError(t,e,{routePath:o.definition.page,routerKind:"Pages Router",routeType:"route",revalidateReason:void 0}),t}}if(o.definition.kind===tK.PAGES_API){if("export"===this.nextConfig.output)return await this.render404(e,t,r),!0;if(await this.handleApiRequest(e,t,i,o))return!0}return await this.render(e,t,n,i,r,!0),!0}catch(r){if(r instanceof ns)throw r;try{return this.logError(r),t.statusCode=500,await this.renderError(r,e,t,n,i),!0}catch{}throw r}},this.handleCatchallMiddlewareRequest=async(e,t,r)=>{let n;let i=er(e,"middlewareInvoke");if(!i)return!1;let a=()=>(en(e,"middlewareInvoke",!0),t.body("").send(),!0),s=this.getMiddleware();if(!s)return a();let o=eq(er(e,"initURL")),l=tO(o.pathname,{nextConfig:this.nextConfig,i18nProvider:this.i18nProvider});o.pathname=l.pathname;let u=e5(r.pathname||"");if(!s.match(u,e,o.query))return a();let d=!1;try{if(await this.ensureMiddleware(e.url),n=await this.runMiddleware({request:e,response:t,parsedUrl:o,parsed:r}),"response"in n){if(i)throw d=!0,Object.defineProperty(new ts.BubbledError(!0,n),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});for(let[e,r]of Object.entries(tm(n.response.headers)))"content-encoding"!==e&&void 0!==r&&t.setHeader(e,r);t.statusCode=n.response.status;let{originalResponse:e}=t;return n.response.body?await tG(n.response.body,e):e.end(),!0}}catch(i){if(d)throw i;if(rl(i)&&"ENOENT"===i.code)return await this.render404(e,t,r),!0;if(i instanceof J)return t.statusCode=400,await this.renderError(i,e,t,r.pathname||""),!0;let n=ru(i);return console.error(n),t.statusCode=500,await this.renderError(n,e,t,r.pathname||""),!0}return n.finished},this.isDev=e.dev??!1,this.sriEnabled=!!(null==(r=e.conf.experimental)?void 0:null==(t=r.sri)?void 0:t.algorithm),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:n}=this.nextConfig.experimental;if(e.dev||!0!==n&&void 0===n||(nP({distDir:this.distDir,page:"/_document",isAppPath:!1,isDev:this.isDev,sriEnabled:this.sriEnabled}).catch(()=>{}),nP({distDir:this.distDir,page:"/_app",isAppPath:!1,isDev:this.isDev,sriEnabled:this.sriEnabled}).catch(()=>{})),e.dev,!e.dev){let{dynamicRoutes:e=[]}=this.getRoutesManifest()??{};this.dynamicRoutes=e.map(e=>{let t=e7(e.page);return{match:ee(t),page:e.page,re:t.re}})}(function(e){if(!globalThis.__NEXT_HTTP_AGENT){if(!e)throw Object.defineProperty(Error("Expected config.httpAgentOptions to be an object"),"__NEXT_ERROR_CODE",{value:"E204",enumerable:!1,configurable:!0});globalThis.__NEXT_HTTP_AGENT_OPTIONS=e.httpAgentOptions,globalThis.__NEXT_HTTP_AGENT=new nM.Agent(e.httpAgentOptions),globalThis.__NEXT_HTTPS_AGENT=new nq.Agent(e.httpAgentOptions)}})(this.nextConfig),this.middlewareManifestPath=(0,l.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(),t=this.getPagesManifest();for(let e of(await this.loadCustomCacheHandlers(),Object.keys(t||{})))await nP({distDir:this.distDir,page:e,isAppPath:!1,isDev:this.isDev,sriEnabled:this.sriEnabled}).catch(()=>{});for(let t of Object.keys(e||{}))await nP({distDir:this.distDir,page:t,isAppPath:!0,isDev:this.isDev,sriEnabled:this.sriEnabled}).then(async({ComponentMod:e})=>{e.patchFetch();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 loadInstrumentationModule(){if(!this.serverOptions.dev)try{this.instrumentation=await nQ((0,l.resolve)(this.serverOptions.dir||".",this.serverOptions.conf.distDir,"server",eP.Hw))}catch(e){if("MODULE_NOT_FOUND"!==e.code)throw Object.defineProperty(Error("An error occurred while loading the instrumentation hook",{cause:e}),"__NEXT_ERROR_CODE",{value:"E92",enumerable:!1,configurable:!0})}return this.instrumentation}async prepareImpl(){await super.prepareImpl(),await this.runInstrumentationHookIfAvailable()}async runInstrumentationHookIfAvailable(){var e,t;this.registeredInstrumentation||(this.registeredInstrumentation=!0,await (null==(t=this.instrumentation)?void 0:null==(e=t.register)?void 0:e.call(t)))}loadEnvConfig({dev:e,forceReload:t,silent:r}){(0,nC.loadEnvConfig)(this.dir,e,r?{info:()=>{},error:()=>{}}:s,t)}async loadCustomCacheHandlers(){let{cacheHandlers:e}=this.nextConfig.experimental;if(!nJ.__nextCacheHandlers&&e){for(let t of(nJ.__nextCacheHandlers={},Object.keys(e)))e[t]&&(globalThis.__nextCacheHandlers[t]=nv(await nY(nU(this.distDir,e[t]))));if(!e.default){var t;nJ.__nextCacheHandlers.default=(null==(t=nJ[nK])?void 0:t.DefaultCache)||nV}}}async getIncrementalCache({requestHeaders:e,requestProtocol:t}){let r;let{cacheHandler:n}=this.nextConfig;return n&&(r=nv(await nY(nU(this.distDir,n)))),await this.loadCustomCacheHandlers(),new nI({fs:this.getCacheFilesystem(),dev:!1,requestHeaders:e,requestProtocol:t,allowedRevalidateHeaderKeys:this.nextConfig.experimental.allowedRevalidateHeaderKeys,minimalMode:!0,serverDistDir:this.serverDistDir,fetchCacheKeyPrefix:this.nextConfig.experimental.fetchCacheKeyPrefix,maxMemoryCacheSize:this.nextConfig.cacheMaxMemorySize,flushToDisk:!1,getPrerenderManifest:()=>this.getPrerenderManifest(),CurCacheHandler:r})}getResponseCache(){return new tQ(!0)}getPublicDir(){return(0,l.join)(this.dir,"public")}getHasStaticDir(){return p().existsSync((0,l.join)(this.dir,"static"))}getPagesManifest(){return nh((0,l.join)(this.serverDistDir,el))}getAppPathsManifest(){if(this.enabledDirectories.app)return nh((0,l.join)(this.serverDistDir,eu))}getinterceptionRoutePatterns(){if(!this.enabledDirectories.app)return[];let e=this.getRoutesManifest();return(null==e?void 0:e.rewrites.beforeFiles.filter(nW).map(e=>new RegExp(e.regex)))??[]}async hasPage(e){var t;return!!nf(e,this.distDir,null==(t=this.nextConfig.i18n)?void 0:t.locales,this.enabledDirectories.app)}getBuildId(){let e=(0,l.join)(this.distDir,"BUILD_ID");try{return p().readFileSync(e,"utf8").trim()}catch(e){if("ENOENT"===e.code)throw Object.defineProperty(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`),"__NEXT_ERROR_CODE",{value:"E427",enumerable:!1,configurable:!0});throw e}}getEnabledDirectories(e){let t=e?this.dir:this.serverDistDir;return{app:!!ep(t,"app"),pages:!!ep(t,"pages")}}sendRenderResult(e,t,r){return eI({req:e.originalRequest,res:t.originalResponse,result:r.result,type:r.type,generateEtags:r.generateEtags,poweredByHeader:r.poweredByHeader,revalidate:r.revalidate,expireTime:r.expireTime})}async runApi(e,t,r,n){for(let i of this.getEdgeFunctionsPages())if(i===n.definition.pathname&&await this.runEdgeFunction({req:e,res:t,query:r,params:n.params,page:n.definition.pathname,appPaths:null}))return!0;let i=await nz.load(n.definition.filename);return r={...r,...n.params},await i.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:n.params,page:n.definition.pathname,onError:this.instrumentationOnRequestError.bind(this),multiZoneDraftMode:this.nextConfig.experimental.multiZoneDraftMode}),!0}async renderHTML(e,t,r,n,i){return(0,ts.getTracer)().trace(to.Fx.renderHTML,async()=>this.renderHTMLImpl(e,t,r,n,i))}async renderHTMLImpl(e,t,r,n,i){throw Object.defineProperty(Error("Invariant: renderHTML should not be called in minimal mode"),"__NEXT_ERROR_CODE",{value:"E472",enumerable:!1,configurable:!0})}async imageOptimizer(e,t,r,n){throw Object.defineProperty(Error("invariant: imageOptimizer should not be called in minimal mode"),"__NEXT_ERROR_CODE",{value:"E506",enumerable:!1,configurable:!0})}getPagePath(e,t){return nm(e,this.distDir,t,this.enabledDirectories.app)}async renderPageComponent(e,t){let r=this.getEdgeFunctionsPages()||[];if(r.length){let t=this.getOriginalAppPaths(e.pathname),n=Array.isArray(t),i=e.pathname;for(let a of(n&&(i=t[0]),r))if(a===i)return await this.runEdgeFunction({req:e.req,res:e.res,query:e.query,params:e.renderOpts.params,page:i,appPaths:t}),null}return super.renderPageComponent(e,t)}async findPageComponents({locale:e,page:t,query:r,params:n,isAppPath:i,url:a}){return(0,ts.getTracer)().trace(to.Fx.findPageComponents,{spanName:"resolve page components",attributes:{"next.route":i?eZ(t):t}},()=>this.findPageComponentsImpl({locale:e,page:t,query:r,params:n,isAppPath:i,url:a}))}async findPageComponentsImpl({locale:e,page:t,query:r,params:n,isAppPath:i,url:a}){let s=[t];for(let a of(r.amp&&s.unshift((i?eZ(t):rb(t))+".amp"),e&&s.unshift(...s.map(t=>`/${e}${"/"===t?"":t}`)),s))try{let t=await nP({distDir:this.distDir,page:a,isAppPath:i,isDev:this.isDev,sriEnabled:this.sriEnabled});if(e&&"string"==typeof t.Component&&!a.startsWith(`/${e}/`)&&a!==`/${e}`)continue;return{components:t,query:{...!this.renderOpts.isExperimentalCompile&&t.getStaticProps?{amp:r.amp}:r,...(i?{}:n)||{}}}}catch(e){if(!(e instanceof Q))throw e}return null}getNextFontManifest(){return nh((0,l.join)(this.distDir,"server","next-font-manifest.json"))}logErrorWithOriginalStack(e,t){throw Object.defineProperty(Error("Invariant: logErrorWithOriginalStack can only be called on the development server"),"__NEXT_ERROR_CODE",{value:"E6",enumerable:!1,configurable:!0})}async ensurePage(e){throw Object.defineProperty(Error("Invariant: ensurePage can only be called on the development server"),"__NEXT_ERROR_CODE",{value:"E291",enumerable:!1,configurable:!0})}async handleApiRequest(e,t,r,n){return this.runApi(e,t,r,n)}getCacheFilesystem(){return nL}normalizeReq(e){return e instanceof eb?e:new eb(e)}normalizeRes(e){return e instanceof eE?e:new eE(e)}getRequestHandler(){return this.makeRequestHandler()}makeRequestHandler(){this.prepare().catch(e=>{console.error("Failed to prepare server",e)});let e=super.getRequestHandler();return(t,r,n)=>e(this.normalizeReq(t),this.normalizeRes(r),n)}async revalidate({urlPath:e,revalidateHeaders:t,opts:r}){let n=function({url:e,headers:t={},method:r="GET",bodyReadable:n,resWriter:i,socket:a=null}){return{req:new n$({url:e,headers:t,method:r,socket:a,readable:n}),res:new nH({socket:a,resWriter:i})}}({url:e,headers:t}),i=this.getRequestHandler();if(await i(new eb(n.req),new eE(n.res)),await n.res.hasStreamed,"REVALIDATED"!==n.res.getHeader("x-nextjs-cache")&&!(404===n.res.statusCode&&r.unstable_onlyGenerated))throw Object.defineProperty(Error(`Invalid response ${n.res.statusCode}`),"__NEXT_ERROR_CODE",{value:"E175",enumerable:!1,configurable:!0})}async render(e,t,r,n,i,a=!1){return super.render(this.normalizeReq(e),this.normalizeRes(t),r,n,i,a)}async renderToHTML(e,t,r,n){return super.renderToHTML(this.normalizeReq(e),this.normalizeRes(t),r,n)}async renderErrorToResponseImpl(e,t){let{req:r,res:n,query:i}=e;return 404===n.statusCode&&this.enabledDirectories.app&&this.getEdgeFunctionsPages().includes(eo)?(await this.runEdgeFunction({req:r,res:n,query:i||{},params:{},page:eo,appPaths:null}),null):super.renderErrorToResponseImpl(e,t)}async renderError(e,t,r,n,i,a){return super.renderError(e,this.normalizeReq(t),this.normalizeRes(r),n,i,a)}async renderErrorToHTML(e,t,r,n,i){return super.renderErrorToHTML(e,this.normalizeReq(t),this.normalizeRes(r),n,i)}async render404(e,t,r,n){return super.render404(this.normalizeReq(e),this.normalizeRes(t),r,n)}getMiddlewareManifest(){return null}getMiddleware(){var e,t;let r=this.getMiddlewareManifest(),n=null==r?void 0:null==(e=r.middleware)?void 0:e["/"];if(!n){let e=this.loadNodeMiddleware();return e?{match:nO((null==(t=e.config)?void 0:t.matchers)||[{regexp:".*",originalSource:"/:path*"}]),page:"/"}:void 0}return{match:function(e){let t=nZ.get(e);if(t)return t;if(!Array.isArray(e.matchers))throw Object.defineProperty(Error(`Invariant: invalid matchers for middleware ${JSON.stringify(e)}`),"__NEXT_ERROR_CODE",{value:"E257",enumerable:!1,configurable:!0});let r=nO(e.matchers);return nZ.set(e,r),r}(n),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=rr(rb(e.page))}catch(e){return null}let n=e.middleware?r.middleware[t]:r.functions[t];if(!n){if(!e.middleware)throw new Q(t);return null}return{name:n.name,paths:n.files.map(e=>(0,l.join)(this.distDir,e)),wasm:(n.wasm??[]).map(e=>({...e,filePath:(0,l.join)(this.distDir,e.filePath)})),assets:n.assets&&n.assets.map(e=>({...e,filePath:(0,l.join)(this.distDir,e.filePath)})),env:n.env}}loadNodeMiddleware(){if(this.nextConfig.experimental.nodeMiddleware)try{var e;let t=r("./dist/esm/server sync recursive")((0,l.join)(this.distDir,"server","functions-config-manifest.json"));if(null==t?void 0:null==(e=t.functions)?void 0:e["/_middleware"])return r("./dist/esm/server sync recursive")((0,l.join)(this.distDir,"server","middleware.js"))}catch(e){if(rl(e)&&"ENOENT"!==e.code&&"MODULE_NOT_FOUND"!==e.code)throw e}}async hasMiddleware(e){let t=this.getEdgeFunctionInfo({page:e,middleware:!0});return!!(!t&&this.loadNodeMiddleware())||!!(t&&t.paths.length>0)}async ensureMiddleware(e){}async ensureEdgeFunction(e){}async runMiddleware(e){throw Object.defineProperty(Error("invariant: runMiddleware should not be called in minimal mode"),"__NEXT_ERROR_CODE",{value:"E276",enumerable:!1,configurable:!0})}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=nh((0,l.join)(this.distDir,"prerender-manifest.json"))),this._cachedPreviewManifest}getRoutesManifest(){return(0,ts.getTracer)().trace(to.Fx.getRoutesManifest,()=>{let e=nh((0,l.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 n;let i=(null==(n=e.headers["x-forwarded-proto"])?void 0:n.includes("https"))?"https":"http",a=this.fetchHostname&&this.port?`${i}://${this.fetchHostname}:${this.port}${e.url}`:this.nextConfig.experimental.trustHostHeader?`https://${e.headers.host||"localhost"}${e.url}`:e.url;en(e,"initURL",a),en(e,"initQuery",{...t.query}),en(e,"initProtocol",i),r||en(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 n=await r;if(n&&"object"==typeof n&&n.error)throw n.error;(function(e,t){for(let r in t){let n=t[r];"function"==typeof n&&(n=n.bind(e)),e[r]=n}})(e,t),t=e}},cloneBodyStream(){let r=t??e,n=new nT.PassThrough,i=new nT.PassThrough;return r.on("data",e=>{n.push(e),i.push(e)}),r.on("end",()=>{n.push(null),i.push(null)}),t=i,n}}}(e.originalRequest))}async runEdgeFunction(e){throw Object.defineProperty(Error("Middleware is not supported in minimal mode. Please remove the `NEXT_MINIMAL` environment variable."),"__NEXT_ERROR_CODE",{value:"E58",enumerable:!1,configurable:!0})}get serverDistDir(){if(this._serverDistDir)return this._serverDistDir;let e=(0,l.join)(this.distDir,ed);return this._serverDistDir=e,e}async getFallbackErrorComponents(e){return null}async instrumentationOnRequestError(...e){await super.instrumentationOnRequestError(...e),this.logError(e[0])}onServerClose(e){this.cleanupListeners.add(e)}async close(){await this.cleanupListeners.runAll()}getInternalWaitUntil(){return this.internalWaitUntil??=this.createInternalWaitUntil(),this.internalWaitUntil}createInternalWaitUntil(){throw Object.defineProperty(new $("createInternalWaitUntil should never be called in minimal mode"),"__NEXT_ERROR_CODE",{value:"E540",enumerable:!1,configurable:!0})}}})(),module.exports=n})();
33
33
  //# sourceMappingURL=server.runtime.prod.js.map