"use strict";(()=>{var e={};e.id=4552,e.ids=[4552],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},84770:e=>{e.exports=require("crypto")},92048:e=>{e.exports=require("fs")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},68360:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>x,patchFetch:()=>f,requestAsyncStorage:()=>l,routeModule:()=>m,serverHooks:()=>g,staticGenerationAsyncStorage:()=>c});var s={};r.r(s),r.d(s,{GET:()=>d});var o=r(49303),i=r(88716),a=r(60670),n=r(87070),u=r(97425),p=r(75748);async function d(e,{params:t}){try{let r=(0,u.n)();if(!(0,p.gU)(r,t.id))return n.NextResponse.json({error:`Worktree '${t.id}' not found`},{status:404});let{searchParams:s}=new URL(e.url),o=s.get("before"),i=s.get("limit"),a=s.get("cliTool"),d=o?new Date(o):void 0,m=i?parseInt(i,10):50;if(a&&!["claude","codex","gemini"].includes(a))return n.NextResponse.json({error:"Invalid cliTool parameter (must be claude, codex, or gemini)"},{status:400});if(isNaN(m)||m<1||m>100)return n.NextResponse.json({error:"Invalid limit parameter (must be 1-100)"},{status:400});let l=[...(0,p._U)(r,t.id,d,m,a).filter(e=>e.content&&""!==e.content.trim())].sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime());return n.NextResponse.json(l,{status:200})}catch(e){return console.error("Error fetching messages:",e),n.NextResponse.json({error:"Failed to fetch messages"},{status:500})}}let m=new o.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/worktrees/[id]/messages/route",pathname:"/api/worktrees/[id]/messages",filename:"route",bundlePath:"app/api/worktrees/[id]/messages/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/messages/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:l,staticGenerationAsyncStorage:c,serverHooks:g}=m,x="/api/worktrees/[id]/messages/route";function f(){return(0,a.patchFetch)({serverHooks:g,staticGenerationAsyncStorage:c})}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[8948,5972,7425],()=>r(68360));module.exports=s})();