(()=>{var e={};e.id=316,e.ids=[316],e.modules={20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},79348:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},30412:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},92048:e=>{"use strict";e.exports=require("fs")},19801:e=>{"use strict";e.exports=require("os")},55315:e=>{"use strict";e.exports=require("path")},33820:(e,s,r)=>{"use strict";r.r(s),r.d(s,{patchFetch:()=>v,routeModule:()=>x,serverHooks:()=>g,workAsyncStorage:()=>m,workUnitAsyncStorage:()=>j});var t={};r.r(t),r.d(t,{GET:()=>f,dynamic:()=>d,runtime:()=>c});var o=r(88797),i=r(10042),n=r(58492),a=r(92048),p=r(59540),u=r(19801),l=r(55315);let d="force-dynamic",c="nodejs";async function h(e){return(await a.promises.readFile(e,"utf-8")).split("\n").filter(e=>""!==e.trim()).map(e=>JSON.parse(e))}async function f(e,{params:s}){try{let{runHash:r}=await s,t=process.env.CURATOR_CACHE_DIR||(0,l.join)((0,u.homedir)(),".cache","curator"),o=(0,l.join)(t,r),i=e.nextUrl.searchParams,n=parseInt(i.get("lastLine")||"0"),d=(i.get("processedFiles")||"").split(",").filter(Boolean),c="true"===i.get("batchMode");if(!(0,a.existsSync)(o))return p.NextResponse.json({error:"Run directory not found"},{status:404});if(c){let e=(await a.promises.readdir(o)).filter(e=>e.startsWith("responses_")&&e.endsWith(".jsonl")).filter(e=>!d.includes(e)),s=[];for(let r of e){let e=(0,l.join)(o,r),t=await h(e);s.push(...t)}return p.NextResponse.json({data:s,processedFiles:e,isBatchMode:!0,totalLines:null})}{let e=(0,l.join)(o,"responses_0.jsonl");if(!(0,a.existsSync)(e))return p.NextResponse.json({data:[],totalLines:0,isBatchMode:!1,processedFiles:null,message:"No responses file found yet"});let s=(await a.promises.readFile(e,"utf-8")).split("\n").filter(e=>""!==e.trim()),r=s.slice(n).map(e=>JSON.parse(e));return p.NextResponse.json({data:r,totalLines:s.length,isBatchMode:!1,processedFiles:null})}}catch(e){return console.error("Error reading responses file:",e),p.NextResponse.json({error:"Failed to read responses file"},{status:500})}}let x=new o.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/responses/[runHash]/route",pathname:"/api/responses/[runHash]",filename:"route",bundlePath:"app/api/responses/[runHash]/route"},resolvedPagePath:"/home/charlieji/workspace/bella-cli/bespoke-dataset-viewer/app/api/responses/[runHash]/route.ts",nextConfigOutput:"",userland:t}),{workAsyncStorage:m,workUnitAsyncStorage:j,serverHooks:g}=x;function v(){return(0,n.patchFetch)({workAsyncStorage:m,workUnitAsyncStorage:j})}},78031:()=>{},35303:()=>{}};var s=require("../../../../webpack-runtime.js");s.C(e);var r=e=>s(s.s=e),t=s.X(0,[492,661],()=>r(33820));module.exports=t})();