"use strict";(()=>{var e={};e.id=9542,e.ids=[9542],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")},82935:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>f,patchFetch:()=>g,requestAsyncStorage:()=>m,routeModule:()=>h,serverHooks:()=>y,staticGenerationAsyncStorage:()=>x});var o={};r.r(o),r.d(o,{GET:()=>p});var n=r(49303),s=r(88716),i=r(60670),a=r(87070),l=r(94925),u=r(30721),c=r(46155);let d=(0,r(43895).h)("api/execution-logs");async function p(e,{params:t}){try{if(!(0,c.m$)(t.id))return a.NextResponse.json({error:"Invalid worktree ID format"},{status:400});let e=(0,l.getDbInstance)();if(!(0,u.gU)(e,t.id))return a.NextResponse.json({error:`Worktree '${t.id}' not found`},{status:404});let r=e.prepare(`
      SELECT el.id, el.schedule_id, el.worktree_id, el.message, el.exit_code, el.status, el.started_at, el.completed_at, el.created_at,
             se.name AS schedule_name
      FROM execution_logs el
      LEFT JOIN scheduled_executions se ON el.schedule_id = se.id
      WHERE el.worktree_id = ?
      ORDER BY el.created_at DESC
      LIMIT 100
    `).all(t.id);return a.NextResponse.json({logs:r},{status:200})}catch(e){return d.error("error-fetching-execution-logs:",{error:e instanceof Error?e.message:String(e)}),a.NextResponse.json({error:"Failed to fetch execution logs"},{status:500})}}let h=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/worktrees/[id]/execution-logs/route",pathname:"/api/worktrees/[id]/execution-logs",filename:"route",bundlePath:"app/api/worktrees/[id]/execution-logs/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/execution-logs/route.ts",nextConfigOutput:"",userland:o}),{requestAsyncStorage:m,staticGenerationAsyncStorage:x,serverHooks:y}=h,f="/api/worktrees/[id]/execution-logs/route";function g(){return(0,i.patchFetch)({serverHooks:y,staticGenerationAsyncStorage:x})}},46155:(e,t,r)=>{r.d(t,{iH:()=>p,jj:()=>c,kz:()=>d,m$:()=>l});var o=r(55315),n=r.n(o),s=r(92048);let i=(0,r(43895).h)("path-validator"),a=/^[a-zA-Z0-9_-]+$/;function l(e){return!!e&&0!==e.length&&a.test(e)}function u(e,t){return e===t||e.startsWith(t+n().sep)}function c(e,t){if(!e||""===e.trim()||e.includes("\0"))return!1;let r=e;try{r=decodeURIComponent(e)}catch{r=e}if(r.includes("\0"))return!1;let o=n().resolve(t),s=n().resolve(t,r),i=n().relative(o,s);return!(i.startsWith("..")||n().isAbsolute(i))}function d(e,t){if(!e||""===e.trim())throw Error("Invalid path: Path cannot be empty");if(e.includes("\0"))throw Error("Invalid path: Null bytes not allowed");if(!c(e,t))throw Error(`Path is outside allowed directory: ${e} (allowed root: ${t})`);let r=e;try{r=decodeURIComponent(e)}catch{r=e}return n().resolve(t,r)}function p(e,t){let r;try{r=(0,s.realpathSync)(t)}catch{return!1}let o=n().resolve(t,e);if((0,s.existsSync)(o))try{let t=(0,s.realpathSync)(o),n=u(t,r);return n||i.warn("security:symlink-rejected",{targetPath:e,resolvedTarget:t}),n}catch{return!1}try{if((0,s.lstatSync)(o).isSymbolicLink())try{let t=(0,s.readlinkSync)(o),a=n().resolve(n().dirname(o),t),l=u(a,r);return l||i.warn("security:dangling-symlink-rejected",{targetPath:e,resolvedLinkTarget:a}),l}catch{return!1}}catch{}let a=n().dirname(o);for(;a!==n().dirname(a);){if((0,s.existsSync)(a))try{let e=(0,s.realpathSync)(a),t=u(e,r);return t||i.warn("security:symlink-ancestor-rejected",{currentPath:a,resolvedAncestor:e}),t}catch{break}a=n().dirname(a)}return!1}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8948,5972,3895,4925,721],()=>r(82935));module.exports=o})();