module.exports=[522734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},446786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},193695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},918622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},556704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},832319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},324725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},270406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},814747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},780204,(e,t,r)=>{t.exports=e.x("puppeteer-582bc9288a971b4a",()=>require("puppeteer-582bc9288a971b4a"))},35355,e=>{"use strict";var t=e.i(814747),r=e.i(446786);async function a(){if("darwin"===r.default.platform()){let t=e.r(780204);return await t.launch({headless:!0,args:["--no-sandbox","--disable-setuid-sandbox"]})}}e.i(522734),t.default.join(process.cwd(),".chromium","chromium"),e.s(["launchBrowser",0,a])},17207,e=>{"use strict";var t=e.i(747909),r=e.i(174017),a=e.i(996250),n=e.i(759756),s=e.i(561916),o=e.i(174677),i=e.i(869741),l=e.i(316795),d=e.i(487718),u=e.i(995169),p=e.i(47587),c=e.i(666012),h=e.i(570101),m=e.i(626937),g=e.i(10372),x=e.i(193695);e.i(52474);var f=e.i(600220),w=e.i(89171);let v="http://www.educationboardresults.gov.bd";async function R(t){try{let{html:r,exam:a,board:n,year:s,roll:o}=await t.json();if(!r)return w.NextResponse.json({error:"Missing HTML content"},{status:400});console.log("🎨 Generating PDF for result:",{exam:a,board:n,year:s,roll:o});let{launchBrowser:i}=e.r(35355),l=await i(),d=await l.newPage(),u=r,p=e=>e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")?e:e.startsWith("//")?"http:"+e:e.startsWith("/")?`${v}${e}`:`${v}/${e}`;u=(u=(u=u.replace(/src="([^"]+)"/g,(e,t)=>{let r=p(t);return`src="${r}"`})).replace(/href="([^"]+)"/g,(e,t)=>{if(t.includes(".css")||t.includes("Content")||t.includes("style")){let e=p(t);return`href="${e}"`}return e})).replace(/<head>/i,`<head>
        <meta charset="UTF-8">
        <base href="${v}/">
        <style>
          * {
            -webkit-print-color-adjust: exact !important;
            print-color-adjust: exact !important;
          }
          body {
            background: white !important;
          }
          @media print {
            body { background: white !important; margin: 0; padding: 0; }
            .no-print { display: none !important; }
          }
        </style>`),await d.setContent(u,{waitUntil:["networkidle0","domcontentloaded"],timeout:3e4});try{await d.evaluate(()=>Promise.all(Array.from(document.images).filter(e=>!e.complete).map(e=>new Promise(t=>{e.onload=()=>t(),e.onerror=()=>t(),setTimeout(t,5e3)})))),console.log("✅ Images loaded")}catch(e){console.log("⚠️ Image loading error:",e)}await new Promise(e=>setTimeout(e,2e3));let c=await d.pdf({format:"A4",printBackground:!0,margin:{top:"0mm",right:"0mm",bottom:"0mm",left:"0mm"},scale:1,displayHeaderFooter:!1,preferCSSPageSize:!0});await l.close(),console.log("✅ PDF generated successfully");let h=`result-${a}-${n}-${s}-${o||"result"}.pdf`;return new w.NextResponse(c,{headers:{"Content-Type":"application/pdf","Content-Disposition":`attachment; filename="${h}"`}})}catch(e){return console.error("❌ PDF generation error:",e),w.NextResponse.json({error:"Failed to generate PDF",message:e.message},{status:500})}}e.s(["POST",0,R],599569);var y=e.i(599569);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/result/generate-pdf/route",pathname:"/api/result/generate-pdf",filename:"route",bundlePath:""},distDir:"_next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/result/generate-pdf/route.ts",nextConfigOutput:"standalone",userland:y,...{}}),{workAsyncStorage:C,workUnitAsyncStorage:E,serverHooks:P}=b;async function A(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),b.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/result/generate-pdf/route";w=w.replace(/\/index$/,"")||"/";let v=await b.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:R,params:y,nextConfig:C,parsedUrl:E,isDraftMode:P,prerenderManifest:A,routerServerContext:T,isOnDemandRevalidate:q,revalidateOnlyGenerated:N,resolvedPathname:k,clientReferenceManifest:S,serverActionsManifest:j}=v,_=(0,i.normalizeAppPath)(w),O=!!(A.dynamicRoutes[_]||A.routes[k]),$=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,E,!1):t.end("This page could not be found"),null);if(O&&!P){let e=!!A.routes[k],t=A.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(C.adapterPath)return await $();throw new x.NoFallbackError}}let H=null;!O||b.isDev||P||(H="/index"===(H=k)?"/":H);let D=!0===b.isDev||!O,I=O&&!D;j&&S&&(0,o.setManifestsSingleton)({page:w,clientReferenceManifest:S,serverActionsManifest:j});let U=e.method||"GET",M=(0,s.getTracer)(),F=M.getActiveScopeSpan(),B=!!(null==T?void 0:T.isWrappedByNextServer),K=!!(0,n.getRequestMeta)(e,"minimalMode"),W=(0,n.getRequestMeta)(e,"incrementalCache")||await b.getIncrementalCache(e,C,A,K);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let L={params:y,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:D,incrementalCache:W,cacheLifeProfiles:C.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>b.onRequestError(e,t,a,n,T)},sharedContext:{buildId:R}},G=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=d.NextRequestAdapter.fromNodeNextRequest(G,(0,d.signalFromNodeResponse)(t));try{let n,o=async e=>b.handle(X,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=M.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${U} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${U} ${w}`)}),i=async n=>{var s,i;let l=async({previousCacheEntry:r})=>{try{if(!K&&q&&N&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(n);e.fetchMetrics=L.renderOpts.fetchMetrics;let i=L.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let l=L.renderOpts.collectedTags;if(!O)return await (0,c.sendResponse)(G,V,s,L.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[g.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,a=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:q})},!1,T),t}},d=await b.handleResponse({req:e,nextConfig:C,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:q,revalidateOnlyGenerated:N,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:K});if(!O)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",q?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),P&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return K&&O||u.delete(g.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,m.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(G,V,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};B&&F?await i(F):(n=M.getActiveScopeSpan(),await M.withPropagatedContext(e.headers,()=>M.trace(u.BaseServerSpan.handleRequest,{spanName:`${U} ${w}`,kind:s.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},i),void 0,!B))}catch(t){if(t instanceof x.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:q})},!1,T),O)throw t;return await (0,c.sendResponse)(G,V,new Response(null,{status:500})),null}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:E})},"routeModule",0,b,"serverHooks",0,P,"workAsyncStorage",0,C,"workUnitAsyncStorage",0,E],17207)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__0246d5v._.js.map