import{n as e}from"./cache-request-state-CDdKGw_d.js";import{f as t,t as n}from"./implicit-tags-BJP8ZwY0.js";import{n as r,t as i}from"./headers-CJ8zthei.js";import{a,i as o,n as s,r as c,t as l}from"./text-stream-TM9xO6G4.js";import{i as u,t as d,u as f,v as p}from"./app-page-stream-DHstZbOy.js";async function m(m){let h=p(m.renderToReadableStream(m.element,{onError:m.onError}),m.captureRscData),g={value:null},_=m.getFontPreloads(),v=await(await m.loadSsrHandler()).handleSsr(h.ssrStream,m.getNavigationContext(),{links:m.getFontLinks(),styles:m.getFontStyles(),preloads:_},{basePath:m.basePath,clientTraceMetadata:m.clientTraceMetadata,reactMaxHeadersLength:m.reactMaxHeadersLength,rootParams:m.rootParams,waitForAllReady:m.waitForAllReady,isStaticGeneration:!0,isForceStatic:m.isForceStatic,...h.sideStream?{sideStream:h.sideStream,capturedRscDataRef:g}:{}}),y=u(v)?v.htmlStream:v,b=d(u(v)?v.linkHeader:void 0,f(_),m.reactMaxHeadersLength),x=await l(y),S;if(m.captureRscData){let e=g.value;if(!e)throw Error(`[vinext] Expected captured RSC data while rendering app page cache artifacts`);S=await e}let C=e(),w=n(m.cleanPathname,t(),m.route.routeSegments),T=s();r(),i();let E={html:x,htmlRenderObservation:o({boundaryOutcome:{kind:`success`},cacheability:`public`,cacheTags:w,cleanPathname:m.cleanPathname,completeness:`complete`,output:c({element:m.element,renderEpoch:null,rootBoundaryId:null,routePattern:m.route.pattern}),params:m.navigationParams,state:T}),...b?{linkHeader:b}:{},tags:w,cacheControl:typeof C?.revalidate==`number`?{revalidate:C.revalidate,expire:C.expire,stale:C.stale}:void 0};return m.captureRscData&&(E.rscData=S,E.rscRenderObservation=o({boundaryOutcome:{kind:`success`},cacheability:`public`,cacheTags:w,cleanPathname:m.cleanPathname,completeness:`complete`,output:a({element:m.element,mountedSlotsHeader:m.mountedSlotsHeader,renderEpoch:null,rootBoundaryId:null,routePattern:m.route.pattern}),params:m.navigationParams,state:T})),E}export{m as renderAppPageCacheArtifacts};