"use strict";exports.id=9922,exports.ids=[9922],exports.modules={32253:(t,e,r)=>{r.d(e,{$o:()=>p,Lp:()=>m,Vt:()=>y,aP:()=>f,vp:()=>l});var n=r(61282),i=r(21764),o=r(87070);let s=(0,r(43895).h)("git-utils"),a=(0,i.promisify)(n.execFile);async function c(t,e){try{let{stdout:r}=await a("git",t,{cwd:e,timeout:1e3});return r.trim()}catch(e){return s.error("git:command-failed",{args:t.join(" "),error:e instanceof Error?e.message:"Unknown error"}),null}}async function l(t,e){let r;let[n,i,o]=await Promise.all([c(["rev-parse","--abbrev-ref","HEAD"],t),c(["rev-parse","--short","HEAD"],t),c(["status","--porcelain"],t)]);return{currentBranch:r=null===n?"(unknown)":"HEAD"===n?"(detached HEAD)":n,initialBranch:e,isBranchMismatch:null!==e&&"(unknown)"!==r&&"(detached HEAD)"!==r&&r!==e,commitHash:i??"(unknown)",isDirty:null!==o&&o.length>0}}class u extends Error{constructor(t){super(t),this.name="GitTimeoutError"}}class d extends Error{constructor(t){super(t),this.name="GitNotRepoError"}}async function h(t,e,r){try{let{stdout:n}=await a("git",t,{cwd:e,timeout:r});return n}catch(n){if(n.killed||"ERR_CHILD_PROCESS_EXEC_TIMEOUT"===n.code||"ETIMEDOUT"===n.code)throw new u(`Git command timed out after ${r}ms`);if((n.stderr||n.message||"").includes("not a git repository"))throw new d("Not a git repository");let e=`${n.stderr||""} ${n.message||""}`;if(e.includes("unknown revision")||e.includes("bad object"))throw Error(e.trim());throw s.error("git:command-failed",{args:t.join(" "),error:n.message}),Error("Failed to execute git command")}}async function m(t,e=50,r=0){return function(t){let e=t.trim();if(!e)return[];let r=e.split("\n"),n=[];for(let t=0;t+4<r.length;t+=5)n.push({hash:r[t],shortHash:r[t+1],message:r[t+2],author:r[t+3],date:r[t+4]});return n}(await h(["log",`--max-count=${e}`,`--skip=${r}`,"--format=%H%n%h%n%s%n%an%n%aI","--"],t,3e3))}async function f(t,e){try{let r=(await h(["log","-1","--format=%H%n%h%n%s%n%an%n%aI",e,"--"],t,3e3)).trim().split("\n");if(r.length<5)return null;let n={hash:r[0],shortHash:r[1],message:r[2],author:r[3],date:r[4]},i=await h(["diff-tree","--no-commit-id","-r","--name-status",e,"--"],t,3e3),o=function(t){let e=[];for(let r of t.trim().split("\n")){if(!r.trim())continue;let t=r.split("	");if(t.length<2)continue;let n=t[0].trim(),i=t[t.length-1].trim();n.startsWith("R")?e.push({path:i,status:"renamed"}):"A"===n?e.push({path:i,status:"added"}):"D"===n?e.push({path:i,status:"deleted"}):e.push({path:i,status:"modified"})}return e}(i);return{commit:n,files:o}}catch(e){if(e instanceof u||e instanceof d)throw e;let t=e instanceof Error?e.message:"";if(t.includes("unknown revision")||t.includes("bad object"))return null;throw e}}async function p(t,e,r){try{return(await h(["show",e,"--",r],t,3e3)).trim()||null}catch(t){if(t instanceof u||t instanceof d)throw t;return null}}function y(t,e){return t instanceof d?o.NextResponse.json({error:"Not a git repository"},{status:400}):t instanceof u?o.NextResponse.json({error:"Git command timed out"},{status:504}):(s.error("git:api-error",{prefix:e,error:t instanceof Error?t.message:String(t)}),o.NextResponse.json({error:"Failed to execute git command"},{status:500}))}},46155:(t,e,r)=>{r.d(e,{iH:()=>h,jj:()=>u,kz:()=>d,m$:()=>c});var n=r(55315),i=r.n(n),o=r(92048);let s=(0,r(43895).h)("path-validator"),a=/^[a-zA-Z0-9_-]+$/;function c(t){return!!t&&0!==t.length&&a.test(t)}function l(t,e){return t===e||t.startsWith(e+i().sep)}function u(t,e){if(!t||""===t.trim()||t.includes("\0"))return!1;let r=t;try{r=decodeURIComponent(t)}catch{r=t}if(r.includes("\0"))return!1;let n=i().resolve(e),o=i().resolve(e,r),s=i().relative(n,o);return!(s.startsWith("..")||i().isAbsolute(s))}function d(t,e){if(!t||""===t.trim())throw Error("Invalid path: Path cannot be empty");if(t.includes("\0"))throw Error("Invalid path: Null bytes not allowed");if(!u(t,e))throw Error(`Path is outside allowed directory: ${t} (allowed root: ${e})`);let r=t;try{r=decodeURIComponent(t)}catch{r=t}return i().resolve(e,r)}function h(t,e){let r;try{r=(0,o.realpathSync)(e)}catch{return!1}let n=i().resolve(e,t);if((0,o.existsSync)(n))try{let e=(0,o.realpathSync)(n),i=l(e,r);return i||s.warn("security:symlink-rejected",{targetPath:t,resolvedTarget:e}),i}catch{return!1}try{if((0,o.lstatSync)(n).isSymbolicLink())try{let e=(0,o.readlinkSync)(n),a=i().resolve(i().dirname(n),e),c=l(a,r);return c||s.warn("security:dangling-symlink-rejected",{targetPath:t,resolvedLinkTarget:a}),c}catch{return!1}}catch{}let a=i().dirname(n);for(;a!==i().dirname(a);){if((0,o.existsSync)(a))try{let t=(0,o.realpathSync)(a),e=l(t,r);return e||s.warn("security:symlink-ancestor-rejected",{currentPath:a,resolvedAncestor:t}),e}catch{break}a=i().dirname(a)}return!1}},39798:(t,e,r)=>{r.d(e,{S:()=>n});let n=/^[0-9a-f]{7,40}$/}};