"use strict";(()=>{var e={};e.id=3286,e.ids=[3286],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")},78893:e=>{e.exports=require("buffer")},61282:e=>{e.exports=require("child_process")},84770:e=>{e.exports=require("crypto")},17702:e=>{e.exports=require("events")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},32615:e=>{e.exports=require("http")},35240:e=>{e.exports=require("https")},98216:e=>{e.exports=require("net")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},76162:e=>{e.exports=require("stream")},82452:e=>{e.exports=require("tls")},17360:e=>{e.exports=require("url")},21764:e=>{e.exports=require("util")},71568:e=>{e.exports=require("zlib")},14371:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>j,patchFetch:()=>v,requestAsyncStorage:()=>f,routeModule:()=>q,serverHooks:()=>R,staticGenerationAsyncStorage:()=>g});var s={};t.r(s),t.d(s,{PUT:()=>h});var o=t(49303),i=t(88716),n=t(60670),p=t(87070),u=t(94925),a=t(4709),c=t(55044),l=t(43112),d=t(92048),x=t.n(d);let m=(0,t(43895).h)("api/repositories-restore");async function h(e){try{let{repositoryPath:r}=await e.json(),t=(0,a.VZ)(r);if(!t.valid)return p.NextResponse.json({success:!1,error:t.error},{status:400});let s=t.resolvedPath,o=(0,u.getDbInstance)();if(!(0,a.RT)(o,r))return p.NextResponse.json({success:!1,error:"Repository not found in exclusion list"},{status:404});if(!x().existsSync(s))return p.NextResponse.json({success:!0,worktreeCount:0,warning:"Repository path not found on disk. No worktrees were restored."});let i=await (0,c.e9)(s),n=0,d=[];if(i.length>0){let e=await (0,l.Hz)(o,i);n=e.syncResult.deletedIds.length,d=e.cleanupWarnings}return p.NextResponse.json({success:!0,worktreeCount:i.length,message:`Repository restored with ${i.length} worktree(s)`,deletedCount:n,cleanupWarnings:d})}catch(e){return m.error("repository:restore-failed",{error:e instanceof Error?e.message:String(e)}),p.NextResponse.json({success:!1,error:"Failed to restore repository"},{status:500})}}let q=new o.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/repositories/restore/route",pathname:"/api/repositories/restore",filename:"route",bundlePath:"app/api/repositories/restore/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/repositories/restore/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:f,staticGenerationAsyncStorage:g,serverHooks:R}=q,j="/api/repositories/restore/route";function v(){return(0,n.patchFetch)({serverHooks:R,staticGenerationAsyncStorage:g})}},4709:(e,r,t)=>{t.d(r,{Bj:()=>s.Bj,RT:()=>s.RT,VZ:()=>s.VZ,j$:()=>s.j$,mm:()=>s.mm,nJ:()=>s.nJ});var s=t(95280)}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8948,5972,3853,4893,2509,3895,4925,721,9228,550,3112],()=>t(14371));module.exports=s})();