diffhub 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
- package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/node_modules/shiki-43d062b67f27bbdc/dist/bundle-full.mjs +27 -0
- package/.next/standalone/apps/web/.next/node_modules/shiki-43d062b67f27bbdc/dist/index.mjs +6 -0
- package/.next/standalone/apps/web/.next/node_modules/shiki-43d062b67f27bbdc/dist/langs.mjs +1430 -0
- package/.next/standalone/apps/web/.next/node_modules/shiki-43d062b67f27bbdc/dist/themes.mjs +395 -0
- package/.next/standalone/apps/web/.next/node_modules/shiki-43d062b67f27bbdc/dist/wasm.mjs +2 -0
- package/.next/standalone/apps/web/.next/node_modules/shiki-43d062b67f27bbdc/package.json +70 -0
- package/.next/standalone/apps/web/.next/prerender-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__002xd2v._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__08v6xj7._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__0of4lzl._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__0wmjj~m._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__0zeknn4._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__11d5pg1._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0oc3qg_._.js +15 -15
- package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
- package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/08y3m525937fg.css +3 -0
- package/.next/standalone/apps/web/.next/static/chunks/{0gcusppap8f2f.js → 10kt4bfjbj3p6.js} +17 -17
- package/.next/standalone/apps/web/package.json +4 -3
- package/.next/standalone/apps/web/public/file.svg +1 -0
- package/.next/standalone/apps/web/public/glide-variable-italic.woff2 +0 -0
- package/.next/standalone/apps/web/public/glide-variable.woff2 +0 -0
- package/.next/standalone/apps/web/public/globe.svg +1 -0
- package/.next/standalone/apps/web/public/next.svg +1 -0
- package/.next/standalone/apps/web/public/operator-mono-book-italic.woff2 +0 -0
- package/.next/standalone/apps/web/public/operator-mono-book.woff2 +0 -0
- package/.next/standalone/apps/web/public/operator-mono-medium-italic.woff2 +0 -0
- package/.next/standalone/apps/web/public/operator-mono-medium.woff2 +0 -0
- package/.next/standalone/apps/web/public/screenshot.png +0 -0
- package/.next/standalone/apps/web/public/vercel.svg +1 -0
- package/.next/standalone/apps/web/public/window.svg +1 -0
- package/bin/diffhub.mjs +14 -26
- package/bin/prepare-standalone.mjs +24 -0
- package/bin/standalone-helpers.mjs +118 -0
- package/package.json +4 -3
- package/.next/standalone/apps/web/.next/static/chunks/0rv4vihrj083t.css +0 -3
- /package/.next/standalone/apps/web/.next/static/{jwjMsDTIK6u1jExOzJG4I → wJudy_0U8odZjFz2U2KtS}/_buildManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{jwjMsDTIK6u1jExOzJG4I → wJudy_0U8odZjFz2U2KtS}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{jwjMsDTIK6u1jExOzJG4I → wJudy_0U8odZjFz2U2KtS}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66312,e=>{"use strict";var t=e.i(2157);let r="/tmp/diffhub-active-repo";e.s(["REPO_POINTER",0,r,"getConfiguredRepoPath",0,()=>{if(process.env.DIFFHUB_REPO)return process.env.DIFFHUB_REPO;let e=(()=>{try{let e=(0,t.readFileSync)(r,"utf-8").trim();if(e)return e}catch{}return null})();return e||process.cwd()}])},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},59130,e=>{"use strict";var t=e.i(2157),r=e.i(50227);let a="gitdir:";class n extends Error{constructor(e){super(`Invalid repo-relative path: ${e}`),this.name="InvalidRepoFilePathError"}}e.s(["InvalidRepoFilePathError",0,n,"getGitDirectory",0,e=>{let n=(0,r.join)(e,".git");if(!(0,t.existsSync)(n)||(0,t.lstatSync)(n).isDirectory())return n;let i=(0,t.readFileSync)(n,"utf-8").trim();if(!i.startsWith(a))return n;let s=i.slice(a.length).trim();return(0,r.resolve)((0,r.dirname)(n),s)},"resolveRepoFilePath",0,(e,t)=>{if(!t||(0,r.isAbsolute)(t))throw new n(t);let a=(0,r.resolve)(e,t),i=(0,r.relative)(e,a);if(i.startsWith("..")||(0,r.isAbsolute)(i))throw new n(t);return a}])},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},69951,73733,e=>{"use strict";var t=e.i(74533),r=e.i(66680),a=e.i(2157),n=e.i(60526),i=e.i(50227);let s=()=>{let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),reject:t,resolve:e}};e.s(["createDeferred",0,s],73733);var o=e.i(59130),l=e.i(66312);let d=(()=>{let e=globalThis;if(!e.__diffhubGitRuntimeState){let t=process.env.DIFFHUB_SERVER_BOOT_ID;e.__diffhubGitRuntimeState={cache:new Map,gitCommandQueue:Promise.resolve(),lastPointerMtime:0,serverBootId:t??(0,r.createHash)("sha1").update(`${process.pid}:${Date.now()}:${Math.random()}`).digest("hex")}}return e.__diffhubGitRuntimeState})(),{cache:u}=d,c=["main","master","develop","dev"],p="1"===process.env.DIFFHUB_DEBUG,f=e=>`diffhub-snapshot-${(0,r.createHash)("sha1").update(e).digest("hex")}-`,h=(e,t,a,s)=>{let o=JSON.stringify({base:t??"",mode:a??"",whitespace:s??""}),l=(0,r.createHash)("sha1").update(o).digest("hex");return(0,i.join)((0,n.tmpdir)(),`${f(e)}${l}.json`)},m=e=>{if(!e)return void u.clear();let t=`:${e}`;for(let e of u.keys())e.includes(t)&&u.delete(e)},g=e=>{if(m(e),"1"!==process.env.DIFFHUB_CMUX||"1"===process.env.DIFFHUB_EXTERNAL_SNAPSHOT_WRITER)return;if(!e){for(let e of(0,a.readdirSync)((0,n.tmpdir)()))e.startsWith("diffhub-snapshot-")&&(0,a.rmSync)((0,i.join)((0,n.tmpdir)(),e),{force:!0});return}let t=f(e);for(let e of(0,a.readdirSync)((0,n.tmpdir)()))e.startsWith(t)&&(0,a.rmSync)((0,i.join)((0,n.tmpdir)(),e),{force:!0})},v=async(e,t,r)=>{try{let e=(0,a.statSync)(l.REPO_POINTER).mtimeMs;e!==d.lastPointerMtime&&(d.lastPointerMtime=e,"1"===process.env.DIFFHUB_EXTERNAL_SNAPSHOT_WRITER?m():g())}catch{}let n=u.get(e);if(n&&n.expires>Date.now())return n.value;let i=await r();return u.set(e,{expires:Date.now()+t,value:i}),i},w=()=>(0,l.getConfiguredRepoPath)(),x=async e=>{let r=Date.now();p&&console.info("[diffhub] git command start",{args:e});try{let{promise:a,reject:n,resolve:i}=s();{let r=(0,t.spawn)("git",e,{cwd:w(),env:{...process.env,GIT_TERMINAL_PROMPT:"0"},stdio:["ignore","pipe","pipe"]}),a=[],s=[],o=0,l=!1,d=e=>{l||(l=!0,e())},u=(t,a)=>{let i=Buffer.isBuffer(a)?a:Buffer.from(a);if((o+=i.length)>0x1400000){r.kill("SIGKILL"),d(()=>{n(Error(`git ${e.join(" ")} failed: output exceeded 20971520 bytes`))});return}t.push(i)};r.stdout.on("data",e=>{u(a,e)}),r.stderr.on("data",e=>{u(s,e)}),r.on("error",e=>{d(()=>n(e))}),r.on("close",t=>{let r=Buffer.concat(a).toString("utf-8"),o=Buffer.concat(s).toString("utf-8").trim();0===t?d(()=>i(r)):d(()=>{n(Object.assign(Error(o||`git ${e.join(" ")} failed with exit code ${t??"unknown"}`),{code:t,status:t??void 0,stderr:o}))})})}let o=await a;return p&&console.info("[diffhub] git command success",{args:e,durationMs:Date.now()-r}),o}catch(a){let t="string"==typeof a.stderr?a.stderr.trim():a.stderr?.toString("utf-8").trim()||"";if(console.error("[diffhub] git command failed",{args:e,code:a.code,durationMs:Date.now()-r,error:a,status:a.status,stderr:t||null}),a instanceof Error&&!t)throw a;throw Error(t||`git ${e.join(" ")} failed: ${a.message}`,{cause:a})}},R=async e=>{let t,r=new Promise(e=>{t=e}),a=d.gitCommandQueue;d.gitCommandQueue=r,await a;try{return await x(e)}finally{t()}},y=e=>e.split("\n").map(e=>e.trim()).filter(Boolean),E=e=>(0,r.createHash)("sha1").update(e).digest("hex"),b=(e,t,r,n,i)=>{if("1"!==process.env.DIFFHUB_CMUX)return null;let s=h(e,t,r,n);try{let t=(0,a.readFileSync)(s,"utf-8"),r=JSON.parse(t),n=Date.now()-r.metadata.createdAt;if(void 0!==i&&r.generation!==i||r.metadata.bootId!==d.serverBootId||r.metadata.repoPath!==e)return p&&console.info("[diffhub] snapshot cache stale",{ageMs:n,expectedBootId:d.serverBootId,expectedGeneration:i??null,repoPath:e,snapshotBootId:r.metadata.bootId,snapshotGeneration:r.generation,snapshotRepoPath:r.metadata.repoPath,source:"disk"}),(0,a.rmSync)(s,{force:!0}),null;return p&&console.info("[diffhub] snapshot cache hit",{ageMs:Date.now()-r.metadata.createdAt,generation:r.generation,repoPath:e,source:"disk"}),{...r,patchByFile:new Map(Object.entries(r.patchByFile))}}catch{return null}},P=async(e,t,r,a,n)=>{let i=Date.now()+1e3;for(;Date.now()<i;){let i=b(e,t,r,a,n);if(i)return i;await new Promise(e=>{setTimeout(e,50)})}return null},S=(e,t,n,i)=>{let s=w();return v(`snapshot:${s}:${e??""}:${t??""}:${n??""}:${i??""}`,500,async()=>{let o,l,u,f,m=b(s,e,t,n,i);if(m)return m;if("1"===process.env.DIFFHUB_EXTERNAL_SNAPSHOT_WRITER){let r=await P(s,e,t,n,i);if(r)return r;console.warn("[diffhub] external snapshot unavailable, recomputing inline",{expectedGeneration:i??null,mode:t??"all",repoPath:s,whitespace:n??"default"})}let g=(await R(["rev-parse","--abbrev-ref","HEAD"])).trim(),x="uncommitted"===t?"HEAD":e??process.env.DIFFHUB_BASE??await (o=w(),v(`baseBranch:${o}`,3e4,async()=>{let e=y(await R(["branch","-r","--format=%(refname:short)"]));for(let t of c)if(e.includes(`origin/${t}`))return`origin/${t}`;let t=y(await R(["branch","--format=%(refname:short)"]));for(let e of c)if(t.includes(e))return e;return"origin/main"})),E="uncommitted"===t?"HEAD":await (l=w(),v(`mergeBase:${l}:${x}`,3e4,async()=>(await R(["merge-base","HEAD",x])).trim())),S=(u=[E],"ignore"===n?["-w",...u]:u),[I,_]=await Promise.all([R(["diff",...S]),R(["diff","--numstat","-z","-M",...S])]),F=(0,r.createHash)("sha1").update(I).digest("hex"),B=(e=>{let t=[],r=0,a=0,n=0;for(;n<e.length;){let i=e.indexOf(" ",n);if(-1===i)break;let s=e.indexOf(" ",i+1);if(-1===s)throw Error("Malformed git diff --numstat output");let o=e.slice(n,i),l=e.slice(i+1,s),d="";if("\0"===e[n=s+1]){n+=1;let t=e.indexOf("\0",n);if(-1===t)throw Error("Malformed git diff --numstat rename output");n=t+1;let r=e.indexOf("\0",n);if(-1===r)throw Error("Malformed git diff --numstat rename output");d=e.slice(n,r),n=r+1}else{let t=e.indexOf("\0",n);if(-1===t)throw Error("Malformed git diff --numstat output");d=e.slice(n,t),n=t+1}let u="-"===o||"-"===l,c=u?0:Number.parseInt(o,10)||0,p=u?0:Number.parseInt(l,10)||0;t.push({binary:u,changes:c+p,deletions:p,file:d,insertions:c}),r+=c,a+=p}return{deletions:a,files:t,insertions:r}})(_),A=Date.now(),O=(f=d.serverBootId,(0,r.createHash)("sha1").update(`${f}:${F}:${E}`).digest("hex")),C={baseBranch:x,branch:g,deletions:B.deletions,files:B.files,fingerprint:F,fullPatch:I,generation:O,insertions:B.insertions,mergeBase:E,metadata:{bootId:d.serverBootId,createdAt:A,repoPath:s},patchByFile:(e=>{let t=new Map,r=/^diff --git a\/(.+?) b\/(.+)$/gm,a=[],n=r.exec(e);for(;n;)a.push({file:n[2],start:n.index}),n=r.exec(e);for(let[r,n]of a.entries()){let i=a[r+1]?.start??e.length,s=e.slice(n.start,i).trimEnd();t.set(n.file,s?`${s}
|
|
2
|
-
`:"")}return t})(I)};return console.info("[diffhub] snapshot cache miss",{generation:O,repoPath:s,source:"recomputed"}),((e,t,r,n,i)=>{if("1"!==process.env.DIFFHUB_CMUX)return;let s={...i,patchByFile:Object.fromEntries(i.patchByFile)};(0,a.writeFileSync)(h(e,t,r,n),JSON.stringify(s),"utf-8"),p&&console.info("[diffhub] snapshot cache wrote",{generation:i.generation,repoPath:e,source:"disk"})})(s,e,t,n,C),C})},I=async(e,t,r,a,n)=>{let i=await S(t,r,a,n),s=i.patchByFile.get(e)??"";return{baseBranch:i.baseBranch,branch:i.branch,fingerprint:i.fingerprint,generation:i.generation,mergeBase:i.mergeBase,patch:s,reviewKey:E(s)}},_=async(e,t,r,a)=>{let n=await S(e,t,r,a),i=Object.fromEntries(n.patchByFile),s=Object.fromEntries(Object.entries(i).map(([e,t])=>[e,E(t)]));return{baseBranch:n.baseBranch,branch:n.branch,deletions:n.deletions,files:n.files,fingerprint:n.fingerprint,generation:n.generation,insertions:n.insertions,mergeBase:n.mergeBase,patchByFile:i,reviewKeyByFile:s}},F=async(e,t,r)=>{let a=await S(e,t,r);return{baseBranch:a.baseBranch,branch:a.branch,deletions:a.deletions,files:a.files,fingerprint:a.fingerprint,generation:a.generation,insertions:a.insertions}},B=async()=>{for(let e of(await Promise.allSettled([F(),F(void 0,"uncommitted")])))"rejected"===e.status&&console.error("[diffhub] failed to prime diff snapshot",{error:e.reason})},A=async e=>{await R(["restore","--staged","--worktree","--",e])};e.s(["clearGitMemoryCache",0,m,"discardFile",0,A,"getDiffForFile",0,I,"getDiffStats",0,F,"getFileAtRef",0,(e,t)=>{let r=w();if("WORKING_TREE"===t)try{return Promise.resolve((0,a.readFileSync)((0,o.resolveRepoFilePath)(r,e),"utf-8"))}catch{return Promise.resolve("")}return v(`file:${r}:${t}:${e}`,3e4,async()=>{try{return await R(["show",`${t}:${e}`])}catch{return""}})},"getMultiFileDiff",0,_,"invalidateGitCache",0,g,"primeGitSnapshots",0,B],69951)},27227,e=>{"use strict";var t=e.i(31173),r=e.i(62205),a=e.i(9467),n=e.i(68273),i=e.i(18601),s=e.i(67822),o=e.i(94179),l=e.i(86434),d=e.i(34044),u=e.i(282),c=e.i(63625),p=e.i(62788),f=e.i(60321),h=e.i(21422),m=e.i(91917),g=e.i(93695);e.i(93930);var v=e.i(82490),w=e.i(29950),x=e.i(69951),R=e.i(59130);let y=async e=>{let{searchParams:t}=new URL(e.url),r=t.get("path")??"",a=t.get("ref")??"";if(!r||!a)return w.NextResponse.json({error:"Missing path or ref"},{status:400});try{let e=await (0,x.getFileAtRef)(r,a);return w.NextResponse.json({content:e})}catch(e){if(e instanceof R.InvalidRepoFilePathError)return w.NextResponse.json({error:e.message},{status:400});return w.NextResponse.json({error:e instanceof Error?e.message:"Internal server error"},{status:500})}};e.s(["GET",0,y],7980);var E=e.i(7980);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/file/route",pathname:"/api/file",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/apps/web/app/api/file/route.ts",nextConfigOutput:"standalone",userland:E,...{}}),{workAsyncStorage:P,workUnitAsyncStorage:S,serverHooks:I}=b;async function _(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),b.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/file/route";w=w.replace(/\/index$/,"")||"/";let x=await b.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!x)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:R,params:y,nextConfig:E,parsedUrl:P,isDraftMode:S,prerenderManifest:I,routerServerContext:_,isOnDemandRevalidate:F,revalidateOnlyGenerated:B,resolvedPathname:A,clientReferenceManifest:O,serverActionsManifest:C}=x,D=(0,o.normalizeAppPath)(w),N=!!(I.dynamicRoutes[D]||I.routes[A]),T=async()=>((null==_?void 0:_.render404)?await _.render404(e,t,P,!1):t.end("This page could not be found"),null);if(N&&!S){let e=!!I.routes[A],t=I.dynamicRoutes[D];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await T();throw new g.NoFallbackError}}let $=null;!N||b.isDev||S||($="/index"===($=A)?"/":$);let H=!0===b.isDev||!N,M=N&&!H;C&&O&&(0,s.setManifestsSingleton)({page:w,clientReferenceManifest:O,serverActionsManifest:C});let j=e.method||"GET",U=(0,i.getTracer)(),k=U.getActiveScopeSpan(),q=!!(null==_?void 0:_.isWrappedByNextServer),G=!!(0,n.getRequestMeta)(e,"minimalMode"),L=(0,n.getRequestMeta)(e,"incrementalCache")||await b.getIncrementalCache(e,E,I,G);null==L||L.resetRequestCache(),globalThis.__incrementalCache=L;let K={params:y,previewProps:I.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:H,incrementalCache:L,cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>b.onRequestError(e,t,a,n,_)},sharedContext:{buildId:R}},W=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),V=d.NextRequestAdapter.fromNodeNextRequest(W,(0,d.signalFromNodeResponse)(t));try{let n,s=async e=>b.handle(V,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=U.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${j} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${j} ${w}`)}),o=async n=>{var i,o;let l=async({previousCacheEntry:r})=>{try{if(!G&&F&&B&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(n);e.fetchMetrics=K.renderOpts.fetchMetrics;let o=K.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=K.renderOpts.collectedTags;if(!N)return await (0,p.sendResponse)(W,X,i,K.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(i.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:F})},!1,_),t}},d=await b.handleResponse({req:e,nextConfig:E,cacheKey:$,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:I,isRoutePPREnabled:!1,isOnDemandRevalidate:F,revalidateOnlyGenerated:B,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:G});if(!N)return null;if((null==d||null==(i=d.value)?void 0:i.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(o=d.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",F?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),S&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return G&&N||u.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(W,X,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};q&&k?await o(k):(n=U.getActiveScopeSpan(),await U.withPropagatedContext(e.headers,()=>U.trace(u.BaseServerSpan.handleRequest,{spanName:`${j} ${w}`,kind:i.SpanKind.SERVER,attributes:{"http.method":j,"http.target":e.url}},o),void 0,!q))}catch(t){if(t instanceof g.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:F})},!1,_),N)throw t;return await (0,p.sendResponse)(W,X,new Response(null,{status:500})),null}}e.s(["handler",0,_,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:P,workUnitAsyncStorage:S})},"routeModule",0,b,"serverHooks",0,I,"workAsyncStorage",0,P,"workUnitAsyncStorage",0,S],27227)}];
|
|
2
|
+
`:"")}return t})(I)};return p&&console.info("[diffhub] snapshot cache miss",{generation:O,repoPath:s,source:"recomputed"}),((e,t,r,n,i)=>{if("1"!==process.env.DIFFHUB_CMUX)return;let s={...i,patchByFile:Object.fromEntries(i.patchByFile)};(0,a.writeFileSync)(h(e,t,r,n),JSON.stringify(s),"utf-8"),p&&console.info("[diffhub] snapshot cache wrote",{generation:i.generation,repoPath:e,source:"disk"})})(s,e,t,n,C),C})},I=async(e,t,r,a,n)=>{let i=await S(t,r,a,n),s=i.patchByFile.get(e)??"";return{baseBranch:i.baseBranch,branch:i.branch,fingerprint:i.fingerprint,generation:i.generation,mergeBase:i.mergeBase,patch:s,reviewKey:E(s)}},_=async(e,t,r,a)=>{let n=await S(e,t,r,a),i=Object.fromEntries(n.patchByFile),s=Object.fromEntries(Object.entries(i).map(([e,t])=>[e,E(t)]));return{baseBranch:n.baseBranch,branch:n.branch,deletions:n.deletions,files:n.files,fingerprint:n.fingerprint,generation:n.generation,insertions:n.insertions,mergeBase:n.mergeBase,patchByFile:i,reviewKeyByFile:s}},F=async(e,t,r)=>{let a=await S(e,t,r);return{baseBranch:a.baseBranch,branch:a.branch,deletions:a.deletions,files:a.files,fingerprint:a.fingerprint,generation:a.generation,insertions:a.insertions}},B=async()=>{for(let e of(await Promise.allSettled([F(),F(void 0,"uncommitted")])))"rejected"===e.status&&console.error("[diffhub] failed to prime diff snapshot",{error:e.reason})},A=async e=>{await R(["restore","--staged","--worktree","--",e])};e.s(["clearGitMemoryCache",0,m,"discardFile",0,A,"getDiffForFile",0,I,"getDiffStats",0,F,"getFileAtRef",0,(e,t)=>{let r=w();if("WORKING_TREE"===t)try{return Promise.resolve((0,a.readFileSync)((0,o.resolveRepoFilePath)(r,e),"utf-8"))}catch{return Promise.resolve("")}return v(`file:${r}:${t}:${e}`,3e4,async()=>{try{return await R(["show",`${t}:${e}`])}catch{return""}})},"getMultiFileDiff",0,_,"invalidateGitCache",0,g,"primeGitSnapshots",0,B],69951)},27227,e=>{"use strict";var t=e.i(31173),r=e.i(62205),a=e.i(9467),n=e.i(68273),i=e.i(18601),s=e.i(67822),o=e.i(94179),l=e.i(86434),d=e.i(34044),u=e.i(282),c=e.i(63625),p=e.i(62788),f=e.i(60321),h=e.i(21422),m=e.i(91917),g=e.i(93695);e.i(93930);var v=e.i(82490),w=e.i(29950),x=e.i(69951),R=e.i(59130);let y=async e=>{let{searchParams:t}=new URL(e.url),r=t.get("path")??"",a=t.get("ref")??"";if(!r||!a)return w.NextResponse.json({error:"Missing path or ref"},{status:400});try{let e=await (0,x.getFileAtRef)(r,a);return w.NextResponse.json({content:e})}catch(e){if(e instanceof R.InvalidRepoFilePathError)return w.NextResponse.json({error:e.message},{status:400});return w.NextResponse.json({error:e instanceof Error?e.message:"Internal server error"},{status:500})}};e.s(["GET",0,y],7980);var E=e.i(7980);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/file/route",pathname:"/api/file",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/apps/web/app/api/file/route.ts",nextConfigOutput:"standalone",userland:E,...{}}),{workAsyncStorage:P,workUnitAsyncStorage:S,serverHooks:I}=b;async function _(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),b.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/file/route";w=w.replace(/\/index$/,"")||"/";let x=await b.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!x)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:R,params:y,nextConfig:E,parsedUrl:P,isDraftMode:S,prerenderManifest:I,routerServerContext:_,isOnDemandRevalidate:F,revalidateOnlyGenerated:B,resolvedPathname:A,clientReferenceManifest:O,serverActionsManifest:C}=x,D=(0,o.normalizeAppPath)(w),N=!!(I.dynamicRoutes[D]||I.routes[A]),T=async()=>((null==_?void 0:_.render404)?await _.render404(e,t,P,!1):t.end("This page could not be found"),null);if(N&&!S){let e=!!I.routes[A],t=I.dynamicRoutes[D];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await T();throw new g.NoFallbackError}}let $=null;!N||b.isDev||S||($="/index"===($=A)?"/":$);let H=!0===b.isDev||!N,M=N&&!H;C&&O&&(0,s.setManifestsSingleton)({page:w,clientReferenceManifest:O,serverActionsManifest:C});let j=e.method||"GET",U=(0,i.getTracer)(),k=U.getActiveScopeSpan(),q=!!(null==_?void 0:_.isWrappedByNextServer),G=!!(0,n.getRequestMeta)(e,"minimalMode"),L=(0,n.getRequestMeta)(e,"incrementalCache")||await b.getIncrementalCache(e,E,I,G);null==L||L.resetRequestCache(),globalThis.__incrementalCache=L;let K={params:y,previewProps:I.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:H,incrementalCache:L,cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>b.onRequestError(e,t,a,n,_)},sharedContext:{buildId:R}},W=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),V=d.NextRequestAdapter.fromNodeNextRequest(W,(0,d.signalFromNodeResponse)(t));try{let n,s=async e=>b.handle(V,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=U.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${j} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${j} ${w}`)}),o=async n=>{var i,o;let l=async({previousCacheEntry:r})=>{try{if(!G&&F&&B&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(n);e.fetchMetrics=K.renderOpts.fetchMetrics;let o=K.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=K.renderOpts.collectedTags;if(!N)return await (0,p.sendResponse)(W,X,i,K.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(i.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:F})},!1,_),t}},d=await b.handleResponse({req:e,nextConfig:E,cacheKey:$,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:I,isRoutePPREnabled:!1,isOnDemandRevalidate:F,revalidateOnlyGenerated:B,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:G});if(!N)return null;if((null==d||null==(i=d.value)?void 0:i.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(o=d.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",F?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),S&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return G&&N||u.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(W,X,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};q&&k?await o(k):(n=U.getActiveScopeSpan(),await U.withPropagatedContext(e.headers,()=>U.trace(u.BaseServerSpan.handleRequest,{spanName:`${j} ${w}`,kind:i.SpanKind.SERVER,attributes:{"http.method":j,"http.target":e.url}},o),void 0,!q))}catch(t){if(t instanceof g.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:F})},!1,_),N)throw t;return await (0,p.sendResponse)(W,X,new Response(null,{status:500})),null}}e.s(["handler",0,_,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:P,workUnitAsyncStorage:S})},"routeModule",0,b,"serverHooks",0,I,"workAsyncStorage",0,P,"workUnitAsyncStorage",0,S],27227)}];
|
|
3
3
|
|
|
4
4
|
//# sourceMappingURL=%5Broot-of-the-server%5D__0zeknn4._.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66312,e=>{"use strict";var t=e.i(2157);let r="/tmp/diffhub-active-repo";e.s(["REPO_POINTER",0,r,"getConfiguredRepoPath",0,()=>{if(process.env.DIFFHUB_REPO)return process.env.DIFFHUB_REPO;let e=(()=>{try{let e=(0,t.readFileSync)(r,"utf-8").trim();if(e)return e}catch{}return null})();return e||process.cwd()}])},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},59130,e=>{"use strict";var t=e.i(2157),r=e.i(50227);let n="gitdir:";class i extends Error{constructor(e){super(`Invalid repo-relative path: ${e}`),this.name="InvalidRepoFilePathError"}}e.s(["InvalidRepoFilePathError",0,i,"getGitDirectory",0,e=>{let i=(0,r.join)(e,".git");if(!(0,t.existsSync)(i)||(0,t.lstatSync)(i).isDirectory())return i;let a=(0,t.readFileSync)(i,"utf-8").trim();if(!a.startsWith(n))return i;let o=a.slice(n.length).trim();return(0,r.resolve)((0,r.dirname)(i),o)},"resolveRepoFilePath",0,(e,t)=>{if(!t||(0,r.isAbsolute)(t))throw new i(t);let n=(0,r.resolve)(e,t),a=(0,r.relative)(e,n);if(a.startsWith("..")||(0,r.isAbsolute)(a))throw new i(t);return n}])},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},69951,73733,e=>{"use strict";var t=e.i(74533),r=e.i(66680),n=e.i(2157),i=e.i(60526),a=e.i(50227);let o=()=>{let e,t;return{promise:new Promise((r,n)=>{e=r,t=n}),reject:t,resolve:e}};e.s(["createDeferred",0,o],73733);var s=e.i(59130),l=e.i(66312);let d=(()=>{let e=globalThis;if(!e.__diffhubGitRuntimeState){let t=process.env.DIFFHUB_SERVER_BOOT_ID;e.__diffhubGitRuntimeState={cache:new Map,gitCommandQueue:Promise.resolve(),lastPointerMtime:0,serverBootId:t??(0,r.createHash)("sha1").update(`${process.pid}:${Date.now()}:${Math.random()}`).digest("hex")}}return e.__diffhubGitRuntimeState})(),{cache:u}=d,c=["main","master","develop","dev"],p="1"===process.env.DIFFHUB_DEBUG,f=e=>`diffhub-snapshot-${(0,r.createHash)("sha1").update(e).digest("hex")}-`,h=(e,t,n,o)=>{let s=JSON.stringify({base:t??"",mode:n??"",whitespace:o??""}),l=(0,r.createHash)("sha1").update(s).digest("hex");return(0,a.join)((0,i.tmpdir)(),`${f(e)}${l}.json`)},m=e=>{if(!e)return void u.clear();let t=`:${e}`;for(let e of u.keys())e.includes(t)&&u.delete(e)},g=e=>{if(m(e),"1"!==process.env.DIFFHUB_CMUX||"1"===process.env.DIFFHUB_EXTERNAL_SNAPSHOT_WRITER)return;if(!e){for(let e of(0,n.readdirSync)((0,i.tmpdir)()))e.startsWith("diffhub-snapshot-")&&(0,n.rmSync)((0,a.join)((0,i.tmpdir)(),e),{force:!0});return}let t=f(e);for(let e of(0,n.readdirSync)((0,i.tmpdir)()))e.startsWith(t)&&(0,n.rmSync)((0,a.join)((0,i.tmpdir)(),e),{force:!0})},w=async(e,t,r)=>{try{let e=(0,n.statSync)(l.REPO_POINTER).mtimeMs;e!==d.lastPointerMtime&&(d.lastPointerMtime=e,"1"===process.env.DIFFHUB_EXTERNAL_SNAPSHOT_WRITER?m():g())}catch{}let i=u.get(e);if(i&&i.expires>Date.now())return i.value;let a=await r();return u.set(e,{expires:Date.now()+t,value:a}),a},v=()=>(0,l.getConfiguredRepoPath)(),R=async e=>{let r=Date.now();p&&console.info("[diffhub] git command start",{args:e});try{let{promise:n,reject:i,resolve:a}=o();{let r=(0,t.spawn)("git",e,{cwd:v(),env:{...process.env,GIT_TERMINAL_PROMPT:"0"},stdio:["ignore","pipe","pipe"]}),n=[],o=[],s=0,l=!1,d=e=>{l||(l=!0,e())},u=(t,n)=>{let a=Buffer.isBuffer(n)?n:Buffer.from(n);if((s+=a.length)>0x1400000){r.kill("SIGKILL"),d(()=>{i(Error(`git ${e.join(" ")} failed: output exceeded 20971520 bytes`))});return}t.push(a)};r.stdout.on("data",e=>{u(n,e)}),r.stderr.on("data",e=>{u(o,e)}),r.on("error",e=>{d(()=>i(e))}),r.on("close",t=>{let r=Buffer.concat(n).toString("utf-8"),s=Buffer.concat(o).toString("utf-8").trim();0===t?d(()=>a(r)):d(()=>{i(Object.assign(Error(s||`git ${e.join(" ")} failed with exit code ${t??"unknown"}`),{code:t,status:t??void 0,stderr:s}))})})}let s=await n;return p&&console.info("[diffhub] git command success",{args:e,durationMs:Date.now()-r}),s}catch(n){let t="string"==typeof n.stderr?n.stderr.trim():n.stderr?.toString("utf-8").trim()||"";if(console.error("[diffhub] git command failed",{args:e,code:n.code,durationMs:Date.now()-r,error:n,status:n.status,stderr:t||null}),n instanceof Error&&!t)throw n;throw Error(t||`git ${e.join(" ")} failed: ${n.message}`,{cause:n})}},y=async e=>{let t,r=new Promise(e=>{t=e}),n=d.gitCommandQueue;d.gitCommandQueue=r,await n;try{return await R(e)}finally{t()}},x=e=>e.split("\n").map(e=>e.trim()).filter(Boolean),E=e=>(0,r.createHash)("sha1").update(e).digest("hex"),b=(e,t,r,i,a)=>{if("1"!==process.env.DIFFHUB_CMUX)return null;let o=h(e,t,r,i);try{let t=(0,n.readFileSync)(o,"utf-8"),r=JSON.parse(t),i=Date.now()-r.metadata.createdAt;if(void 0!==a&&r.generation!==a||r.metadata.bootId!==d.serverBootId||r.metadata.repoPath!==e)return p&&console.info("[diffhub] snapshot cache stale",{ageMs:i,expectedBootId:d.serverBootId,expectedGeneration:a??null,repoPath:e,snapshotBootId:r.metadata.bootId,snapshotGeneration:r.generation,snapshotRepoPath:r.metadata.repoPath,source:"disk"}),(0,n.rmSync)(o,{force:!0}),null;return p&&console.info("[diffhub] snapshot cache hit",{ageMs:Date.now()-r.metadata.createdAt,generation:r.generation,repoPath:e,source:"disk"}),{...r,patchByFile:new Map(Object.entries(r.patchByFile))}}catch{return null}},S=async(e,t,r,n,i)=>{let a=Date.now()+1e3;for(;Date.now()<a;){let a=b(e,t,r,n,i);if(a)return a;await new Promise(e=>{setTimeout(e,50)})}return null},_=(e,t,i,a)=>{let o=v();return w(`snapshot:${o}:${e??""}:${t??""}:${i??""}:${a??""}`,500,async()=>{let s,l,u,f,m=b(o,e,t,i,a);if(m)return m;if("1"===process.env.DIFFHUB_EXTERNAL_SNAPSHOT_WRITER){let r=await S(o,e,t,i,a);if(r)return r;console.warn("[diffhub] external snapshot unavailable, recomputing inline",{expectedGeneration:a??null,mode:t??"all",repoPath:o,whitespace:i??"default"})}let g=(await y(["rev-parse","--abbrev-ref","HEAD"])).trim(),R="uncommitted"===t?"HEAD":e??process.env.DIFFHUB_BASE??await (s=v(),w(`baseBranch:${s}`,3e4,async()=>{let e=x(await y(["branch","-r","--format=%(refname:short)"]));for(let t of c)if(e.includes(`origin/${t}`))return`origin/${t}`;let t=x(await y(["branch","--format=%(refname:short)"]));for(let e of c)if(t.includes(e))return e;return"origin/main"})),E="uncommitted"===t?"HEAD":await (l=v(),w(`mergeBase:${l}:${R}`,3e4,async()=>(await y(["merge-base","HEAD",R])).trim())),_=(u=[E],"ignore"===i?["-w",...u]:u),[I,F]=await Promise.all([y(["diff",..._]),y(["diff","--numstat","-z","-M",..._])]),P=(0,r.createHash)("sha1").update(I).digest("hex"),A=(e=>{let t=[],r=0,n=0,i=0;for(;i<e.length;){let a=e.indexOf(" ",i);if(-1===a)break;let o=e.indexOf(" ",a+1);if(-1===o)throw Error("Malformed git diff --numstat output");let s=e.slice(i,a),l=e.slice(a+1,o),d="";if("\0"===e[i=o+1]){i+=1;let t=e.indexOf("\0",i);if(-1===t)throw Error("Malformed git diff --numstat rename output");i=t+1;let r=e.indexOf("\0",i);if(-1===r)throw Error("Malformed git diff --numstat rename output");d=e.slice(i,r),i=r+1}else{let t=e.indexOf("\0",i);if(-1===t)throw Error("Malformed git diff --numstat output");d=e.slice(i,t),i=t+1}let u="-"===s||"-"===l,c=u?0:Number.parseInt(s,10)||0,p=u?0:Number.parseInt(l,10)||0;t.push({binary:u,changes:c+p,deletions:p,file:d,insertions:c}),r+=c,n+=p}return{deletions:n,files:t,insertions:r}})(F),T=Date.now(),B=(f=d.serverBootId,(0,r.createHash)("sha1").update(`${f}:${P}:${E}`).digest("hex")),D={baseBranch:R,branch:g,deletions:A.deletions,files:A.files,fingerprint:P,fullPatch:I,generation:B,insertions:A.insertions,mergeBase:E,metadata:{bootId:d.serverBootId,createdAt:T,repoPath:o},patchByFile:(e=>{let t=new Map,r=/^diff --git a\/(.+?) b\/(.+)$/gm,n=[],i=r.exec(e);for(;i;)n.push({file:i[2],start:i.index}),i=r.exec(e);for(let[r,i]of n.entries()){let a=n[r+1]?.start??e.length,o=e.slice(i.start,a).trimEnd();t.set(i.file,o?`${o}
|
|
2
|
-
`:"")}return t})(I)};return console.info("[diffhub] snapshot cache miss",{generation:B,repoPath:o,source:"recomputed"}),((e,t,r,i,a)=>{if("1"!==process.env.DIFFHUB_CMUX)return;let o={...a,patchByFile:Object.fromEntries(a.patchByFile)};(0,n.writeFileSync)(h(e,t,r,i),JSON.stringify(o),"utf-8"),p&&console.info("[diffhub] snapshot cache wrote",{generation:a.generation,repoPath:e,source:"disk"})})(o,e,t,i,D),D})},I=async(e,t,r,n,i)=>{let a=await _(t,r,n,i),o=a.patchByFile.get(e)??"";return{baseBranch:a.baseBranch,branch:a.branch,fingerprint:a.fingerprint,generation:a.generation,mergeBase:a.mergeBase,patch:o,reviewKey:E(o)}},F=async(e,t,r,n)=>{let i=await _(e,t,r,n),a=Object.fromEntries(i.patchByFile),o=Object.fromEntries(Object.entries(a).map(([e,t])=>[e,E(t)]));return{baseBranch:i.baseBranch,branch:i.branch,deletions:i.deletions,files:i.files,fingerprint:i.fingerprint,generation:i.generation,insertions:i.insertions,mergeBase:i.mergeBase,patchByFile:a,reviewKeyByFile:o}},P=async(e,t,r)=>{let n=await _(e,t,r);return{baseBranch:n.baseBranch,branch:n.branch,deletions:n.deletions,files:n.files,fingerprint:n.fingerprint,generation:n.generation,insertions:n.insertions}},A=async()=>{for(let e of(await Promise.allSettled([P(),P(void 0,"uncommitted")])))"rejected"===e.status&&console.error("[diffhub] failed to prime diff snapshot",{error:e.reason})},T=async e=>{await y(["restore","--staged","--worktree","--",e])};e.s(["clearGitMemoryCache",0,m,"discardFile",0,T,"getDiffForFile",0,I,"getDiffStats",0,P,"getFileAtRef",0,(e,t)=>{let r=v();if("WORKING_TREE"===t)try{return Promise.resolve((0,n.readFileSync)((0,s.resolveRepoFilePath)(r,e),"utf-8"))}catch{return Promise.resolve("")}return w(`file:${r}:${t}:${e}`,3e4,async()=>{try{return await y(["show",`${t}:${e}`])}catch{return""}})},"getMultiFileDiff",0,F,"invalidateGitCache",0,g,"primeGitSnapshots",0,A],69951)},63438,e=>{"use strict";var t=e.i(31173),r=e.i(62205),n=e.i(9467),i=e.i(68273),a=e.i(18601),o=e.i(67822),s=e.i(94179),l=e.i(86434),d=e.i(34044),u=e.i(282),c=e.i(63625),p=e.i(62788),f=e.i(60321),h=e.i(21422),m=e.i(91917),g=e.i(93695);e.i(93930);var w=e.i(82490),v=e.i(2157),R=e.i(50227),y=e.i(73733),x=e.i(69951),E=e.i(59130),b=e.i(66312);let S=()=>null,_=new Set,I=null,F=[],P=null,A=null,T=!1,B=0,D=0,C=async()=>{if(A){T=!0,await A;return}A=(async()=>{try{await (0,x.primeGitSnapshots)()}finally{A=null}})(),await A,T&&(T=!1,await C())},O=e=>{let t=(0,E.getGitDirectory)(e),r=[e].filter(v.existsSync),n="darwin"===process.platform||"win32"===process.platform,i=[],a=(t,r)=>{if(!((e,t)=>{let r=(0,R.relative)(t,e).split(R.sep).join("/");if(!r||r.startsWith(".."))return!1;for(let e of[".next",".turbo","node_modules"])if(r===e||r.startsWith(`${e}/`))return!0;return!(!(".git"===r||r.startsWith(".git/"))||".git/HEAD"===r||".git/index"===r||".git/packed-refs"===r||".git/refs"===r||r.startsWith(".git/refs/"))})(r?(0,R.join)(t,r.toString()):t,e)){let e;e=I,"1"===process.env.DIFFHUB_EXTERNAL_SNAPSHOT_WRITER?(0,x.clearGitMemoryCache)(e??void 0):(0,x.invalidateGitCache)(e??void 0),P&&clearTimeout(P),P=setTimeout(()=>{P=null,(async()=>{try{"1"!==process.env.DIFFHUB_EXTERNAL_SNAPSHOT_WRITER&&await C()}catch(e){console.error("[diffhub] snapshot prime failed",{error:e})}finally{for(let e of(B+=1,D=Date.now(),_))e()}})()},150)}},o=(t,r)=>{console.error("[diffhub] file watcher error",r);let n=i.indexOf(t);-1!==n&&i.splice(n,1),0===i.length&&setTimeout(()=>{I===e&&0===F.length&&(console.log("[diffhub] attempting watcher recovery"),F=O(e))},5e3)};for(let e of r){let t=(0,v.watch)(e,{persistent:!0,recursive:n},(t,r)=>{a(e,r)});t.on("error",e=>o(t,e)),i.push(t)}for(let e of[(0,R.join)(t,"HEAD"),(0,R.join)(t,"index"),(0,R.join)(t,"packed-refs"),(0,R.join)(t,"refs","heads"),(0,R.join)(t,"refs","tags"),(0,R.join)(t,"refs","remotes")]){if(!(0,v.existsSync)(e))continue;let t=(0,v.watch)(e,{persistent:!0},(t,r)=>{a(e,r)});t.on("error",e=>o(t,e)),i.push(t)}return i},H=()=>({changedAt:D,revision:B}),N=async e=>{if("1"===process.env.DIFFHUB_DISABLE_WATCH)return Response.json({error:"File watch disabled"},{status:503});try{await (()=>{let e=(0,b.getConfiguredRepoPath)();if(F.length>0&&I===e)return;let t=I;I=e,(()=>{if(P&&(clearTimeout(P),P=null),0===F.length)return;let e=F;for(let t of(F=[],e))t.close()})(),(t!==e||0===F.length)&&(F=O(e))})()}catch(e){return Response.json({error:String(e)},{status:500})}let t=H(),r=new URL(e.url).searchParams.get("revision"),n=null===r?null:Number.parseInt(r,10);if(!(null!==n&&Number.isFinite(n)&&n===t.revision))return Response.json({...t,changed:!1,ok:!0});let i=await (e=>{var t;let{promise:r,resolve:n}=(0,y.createDeferred)(),i=!1,a=null,o=S;if(e.aborted)return n("timeout"),r;let s=S,l=t=>{i||(i=!0,a&&(clearTimeout(a),a=null),o(),e.removeEventListener("abort",s),n(t))};return s=()=>{l("timeout")},e.addEventListener("abort",s,{once:!0}),t=()=>{l("change")},_.add(t),o=()=>{_.delete(t)},a=setTimeout(()=>{l("timeout")},25e3),r})(e.signal);return Response.json({...H(),changed:"change"===i,ok:!0})};e.s(["GET",0,N,"dynamic",0,"force-dynamic","runtime",0,"nodejs"],83171);var j=e.i(83171);let $=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/watch/route",pathname:"/api/watch",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/apps/web/app/api/watch/route.ts",nextConfigOutput:"standalone",userland:j,...{}}),{workAsyncStorage:M,workUnitAsyncStorage:U,serverHooks:k}=$;async function q(e,t,n){n.requestMeta&&(0,i.setRequestMeta)(e,n.requestMeta),$.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/watch/route";v=v.replace(/\/index$/,"")||"/";let R=await $.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:y,params:x,nextConfig:E,parsedUrl:b,isDraftMode:S,prerenderManifest:_,routerServerContext:I,isOnDemandRevalidate:F,revalidateOnlyGenerated:P,resolvedPathname:A,clientReferenceManifest:T,serverActionsManifest:B}=R,D=(0,s.normalizeAppPath)(v),C=!!(_.dynamicRoutes[D]||_.routes[A]),O=async()=>((null==I?void 0:I.render404)?await I.render404(e,t,b,!1):t.end("This page could not be found"),null);if(C&&!S){let e=!!_.routes[A],t=_.dynamicRoutes[D];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await O();throw new g.NoFallbackError}}let H=null;!C||$.isDev||S||(H="/index"===(H=A)?"/":H);let N=!0===$.isDev||!C,j=C&&!N;B&&T&&(0,o.setManifestsSingleton)({page:v,clientReferenceManifest:T,serverActionsManifest:B});let M=e.method||"GET",U=(0,a.getTracer)(),k=U.getActiveScopeSpan(),q=!!(null==I?void 0:I.isWrappedByNextServer),G=!!(0,i.getRequestMeta)(e,"minimalMode"),W=(0,i.getRequestMeta)(e,"incrementalCache")||await $.getIncrementalCache(e,E,_,G);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let L={params:x,previewProps:_.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:N,incrementalCache:W,cacheLifeProfiles:E.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,i)=>$.onRequestError(e,t,n,i,I)},sharedContext:{buildId:y}},K=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),V=d.NextRequestAdapter.fromNodeNextRequest(K,(0,d.signalFromNodeResponse)(t));try{let i,o=async e=>$.handle(V,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=U.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),i&&i!==e&&(i.setAttribute("http.route",n),i.updateName(t))}else e.updateName(`${M} ${v}`)}),s=async i=>{var a,s;let l=async({previousCacheEntry:r})=>{try{if(!G&&F&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await o(i);e.fetchMetrics=L.renderOpts.fetchMetrics;let s=L.renderOpts.pendingWaitUntil;s&&n.waitUntil&&(n.waitUntil(s),s=void 0);let l=L.renderOpts.collectedTags;if(!C)return await (0,p.sendResponse)(K,X,a,L.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(a.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,n=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:w.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await $.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:F})},!1,I),t}},d=await $.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:_,isRoutePPREnabled:!1,isOnDemandRevalidate:F,revalidateOnlyGenerated:P,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:G});if(!C)return null;if((null==d||null==(a=d.value)?void 0:a.kind)!==w.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(s=d.value)?void 0:s.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",F?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),S&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return G&&C||u.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(K,X,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};q&&k?await s(k):(i=U.getActiveScopeSpan(),await U.withPropagatedContext(e.headers,()=>U.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${v}`,kind:a.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},s),void 0,!q))}catch(t){if(t instanceof g.NoFallbackError||await $.onRequestError(e,t,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:F})},!1,I),C)throw t;return await (0,p.sendResponse)(K,X,new Response(null,{status:500})),null}}e.s(["handler",0,q,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:M,workUnitAsyncStorage:U})},"routeModule",0,$,"serverHooks",0,k,"workAsyncStorage",0,M,"workUnitAsyncStorage",0,U],63438)}];
|
|
2
|
+
`:"")}return t})(I)};return p&&console.info("[diffhub] snapshot cache miss",{generation:B,repoPath:o,source:"recomputed"}),((e,t,r,i,a)=>{if("1"!==process.env.DIFFHUB_CMUX)return;let o={...a,patchByFile:Object.fromEntries(a.patchByFile)};(0,n.writeFileSync)(h(e,t,r,i),JSON.stringify(o),"utf-8"),p&&console.info("[diffhub] snapshot cache wrote",{generation:a.generation,repoPath:e,source:"disk"})})(o,e,t,i,D),D})},I=async(e,t,r,n,i)=>{let a=await _(t,r,n,i),o=a.patchByFile.get(e)??"";return{baseBranch:a.baseBranch,branch:a.branch,fingerprint:a.fingerprint,generation:a.generation,mergeBase:a.mergeBase,patch:o,reviewKey:E(o)}},F=async(e,t,r,n)=>{let i=await _(e,t,r,n),a=Object.fromEntries(i.patchByFile),o=Object.fromEntries(Object.entries(a).map(([e,t])=>[e,E(t)]));return{baseBranch:i.baseBranch,branch:i.branch,deletions:i.deletions,files:i.files,fingerprint:i.fingerprint,generation:i.generation,insertions:i.insertions,mergeBase:i.mergeBase,patchByFile:a,reviewKeyByFile:o}},P=async(e,t,r)=>{let n=await _(e,t,r);return{baseBranch:n.baseBranch,branch:n.branch,deletions:n.deletions,files:n.files,fingerprint:n.fingerprint,generation:n.generation,insertions:n.insertions}},A=async()=>{for(let e of(await Promise.allSettled([P(),P(void 0,"uncommitted")])))"rejected"===e.status&&console.error("[diffhub] failed to prime diff snapshot",{error:e.reason})},T=async e=>{await y(["restore","--staged","--worktree","--",e])};e.s(["clearGitMemoryCache",0,m,"discardFile",0,T,"getDiffForFile",0,I,"getDiffStats",0,P,"getFileAtRef",0,(e,t)=>{let r=v();if("WORKING_TREE"===t)try{return Promise.resolve((0,n.readFileSync)((0,s.resolveRepoFilePath)(r,e),"utf-8"))}catch{return Promise.resolve("")}return w(`file:${r}:${t}:${e}`,3e4,async()=>{try{return await y(["show",`${t}:${e}`])}catch{return""}})},"getMultiFileDiff",0,F,"invalidateGitCache",0,g,"primeGitSnapshots",0,A],69951)},63438,e=>{"use strict";var t=e.i(31173),r=e.i(62205),n=e.i(9467),i=e.i(68273),a=e.i(18601),o=e.i(67822),s=e.i(94179),l=e.i(86434),d=e.i(34044),u=e.i(282),c=e.i(63625),p=e.i(62788),f=e.i(60321),h=e.i(21422),m=e.i(91917),g=e.i(93695);e.i(93930);var w=e.i(82490),v=e.i(2157),R=e.i(50227),y=e.i(73733),x=e.i(69951),E=e.i(59130),b=e.i(66312);let S=()=>null,_=new Set,I=null,F=[],P=null,A=null,T=!1,B=0,D=0,C=async()=>{if(A){T=!0,await A;return}A=(async()=>{try{await (0,x.primeGitSnapshots)()}finally{A=null}})(),await A,T&&(T=!1,await C())},O=e=>{let t=(0,E.getGitDirectory)(e),r=[e].filter(v.existsSync),n="darwin"===process.platform||"win32"===process.platform,i=[],a=(t,r)=>{if(!((e,t)=>{let r=(0,R.relative)(t,e).split(R.sep).join("/");if(!r||r.startsWith(".."))return!1;for(let e of[".next",".turbo","node_modules"])if(r===e||r.startsWith(`${e}/`))return!0;return!(!(".git"===r||r.startsWith(".git/"))||".git/HEAD"===r||".git/index"===r||".git/packed-refs"===r||".git/refs"===r||r.startsWith(".git/refs/"))})(r?(0,R.join)(t,r.toString()):t,e)){let e;e=I,"1"===process.env.DIFFHUB_EXTERNAL_SNAPSHOT_WRITER?(0,x.clearGitMemoryCache)(e??void 0):(0,x.invalidateGitCache)(e??void 0),P&&clearTimeout(P),P=setTimeout(()=>{P=null,(async()=>{try{"1"!==process.env.DIFFHUB_EXTERNAL_SNAPSHOT_WRITER&&await C()}catch(e){console.error("[diffhub] snapshot prime failed",{error:e})}finally{for(let e of(B+=1,D=Date.now(),_))e()}})()},150)}},o=(t,r)=>{console.error("[diffhub] file watcher error",r);let n=i.indexOf(t);-1!==n&&i.splice(n,1),0===i.length&&setTimeout(()=>{I===e&&0===F.length&&(console.log("[diffhub] attempting watcher recovery"),F=O(e))},5e3)};for(let e of r){let t=(0,v.watch)(e,{persistent:!0,recursive:n},(t,r)=>{a(e,r)});t.on("error",e=>o(t,e)),i.push(t)}for(let e of[(0,R.join)(t,"HEAD"),(0,R.join)(t,"index"),(0,R.join)(t,"packed-refs"),(0,R.join)(t,"refs","heads"),(0,R.join)(t,"refs","tags"),(0,R.join)(t,"refs","remotes")]){if(!(0,v.existsSync)(e))continue;let t=(0,v.watch)(e,{persistent:!0},(t,r)=>{a(e,r)});t.on("error",e=>o(t,e)),i.push(t)}return i},H=()=>({changedAt:D,revision:B}),N=async e=>{if("1"===process.env.DIFFHUB_DISABLE_WATCH)return Response.json({error:"File watch disabled"},{status:503});try{await (()=>{let e=(0,b.getConfiguredRepoPath)();if(F.length>0&&I===e)return;let t=I;I=e,(()=>{if(P&&(clearTimeout(P),P=null),0===F.length)return;let e=F;for(let t of(F=[],e))t.close()})(),(t!==e||0===F.length)&&(F=O(e))})()}catch(e){return Response.json({error:String(e)},{status:500})}let t=H(),r=new URL(e.url).searchParams.get("revision"),n=null===r?null:Number.parseInt(r,10);if(!(null!==n&&Number.isFinite(n)&&n===t.revision))return Response.json({...t,changed:!1,ok:!0});let i=await (e=>{var t;let{promise:r,resolve:n}=(0,y.createDeferred)(),i=!1,a=null,o=S;if(e.aborted)return n("timeout"),r;let s=S,l=t=>{i||(i=!0,a&&(clearTimeout(a),a=null),o(),e.removeEventListener("abort",s),n(t))};return s=()=>{l("timeout")},e.addEventListener("abort",s,{once:!0}),t=()=>{l("change")},_.add(t),o=()=>{_.delete(t)},a=setTimeout(()=>{l("timeout")},25e3),r})(e.signal);return Response.json({...H(),changed:"change"===i,ok:!0})};e.s(["GET",0,N,"dynamic",0,"force-dynamic","runtime",0,"nodejs"],83171);var j=e.i(83171);let $=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/watch/route",pathname:"/api/watch",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/apps/web/app/api/watch/route.ts",nextConfigOutput:"standalone",userland:j,...{}}),{workAsyncStorage:M,workUnitAsyncStorage:U,serverHooks:k}=$;async function q(e,t,n){n.requestMeta&&(0,i.setRequestMeta)(e,n.requestMeta),$.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/watch/route";v=v.replace(/\/index$/,"")||"/";let R=await $.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:y,params:x,nextConfig:E,parsedUrl:b,isDraftMode:S,prerenderManifest:_,routerServerContext:I,isOnDemandRevalidate:F,revalidateOnlyGenerated:P,resolvedPathname:A,clientReferenceManifest:T,serverActionsManifest:B}=R,D=(0,s.normalizeAppPath)(v),C=!!(_.dynamicRoutes[D]||_.routes[A]),O=async()=>((null==I?void 0:I.render404)?await I.render404(e,t,b,!1):t.end("This page could not be found"),null);if(C&&!S){let e=!!_.routes[A],t=_.dynamicRoutes[D];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await O();throw new g.NoFallbackError}}let H=null;!C||$.isDev||S||(H="/index"===(H=A)?"/":H);let N=!0===$.isDev||!C,j=C&&!N;B&&T&&(0,o.setManifestsSingleton)({page:v,clientReferenceManifest:T,serverActionsManifest:B});let M=e.method||"GET",U=(0,a.getTracer)(),k=U.getActiveScopeSpan(),q=!!(null==I?void 0:I.isWrappedByNextServer),G=!!(0,i.getRequestMeta)(e,"minimalMode"),W=(0,i.getRequestMeta)(e,"incrementalCache")||await $.getIncrementalCache(e,E,_,G);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let L={params:x,previewProps:_.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:N,incrementalCache:W,cacheLifeProfiles:E.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,i)=>$.onRequestError(e,t,n,i,I)},sharedContext:{buildId:y}},K=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),V=d.NextRequestAdapter.fromNodeNextRequest(K,(0,d.signalFromNodeResponse)(t));try{let i,o=async e=>$.handle(V,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=U.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),i&&i!==e&&(i.setAttribute("http.route",n),i.updateName(t))}else e.updateName(`${M} ${v}`)}),s=async i=>{var a,s;let l=async({previousCacheEntry:r})=>{try{if(!G&&F&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await o(i);e.fetchMetrics=L.renderOpts.fetchMetrics;let s=L.renderOpts.pendingWaitUntil;s&&n.waitUntil&&(n.waitUntil(s),s=void 0);let l=L.renderOpts.collectedTags;if(!C)return await (0,p.sendResponse)(K,X,a,L.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(a.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,n=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:w.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await $.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:F})},!1,I),t}},d=await $.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:_,isRoutePPREnabled:!1,isOnDemandRevalidate:F,revalidateOnlyGenerated:P,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:G});if(!C)return null;if((null==d||null==(a=d.value)?void 0:a.kind)!==w.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(s=d.value)?void 0:s.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",F?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),S&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return G&&C||u.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(K,X,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};q&&k?await s(k):(i=U.getActiveScopeSpan(),await U.withPropagatedContext(e.headers,()=>U.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${v}`,kind:a.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},s),void 0,!q))}catch(t){if(t instanceof g.NoFallbackError||await $.onRequestError(e,t,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:F})},!1,I),C)throw t;return await (0,p.sendResponse)(K,X,new Response(null,{status:500})),null}}e.s(["handler",0,q,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:M,workUnitAsyncStorage:U})},"routeModule",0,$,"serverHooks",0,k,"workAsyncStorage",0,M,"workUnitAsyncStorage",0,U],63438)}];
|
|
3
3
|
|
|
4
4
|
//# sourceMappingURL=%5Broot-of-the-server%5D__11d5pg1._.js.map
|
|
@@ -13,34 +13,34 @@ ${b.join("\n")}`})(f);await navigator.clipboard.writeText(a),F.current&&clearTim
|
|
|
13
13
|
${a.right}px ${a.bottom}px,
|
|
14
14
|
${a.right}px ${a.top}px,
|
|
15
15
|
${a.left}px ${a.top}px
|
|
16
|
-
)`}return(0,o.jsx)("div",{ref:b,role:"presentation","data-base-ui-inert":"",...e,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})}),gm=p.forwardRef(function(a,b){let{keepMounted:c=!1,...d}=a,{store:e}=fO(),f=e.useState("mounted"),g=e.useState("modal"),h=e.useState("open");return f||c?(0,o.jsx)(gc.Provider,{value:c,children:(0,o.jsxs)(ej,{ref:b,...d,children:[f&&!0===g&&(0,o.jsx)(gl,{ref:e.context.internalBackdropRef,inert:fm(!h)}),a.children]})}):null}),gn={},go={},gp="";class gq{lockCount=0;restore=null;timeoutLock=b_.create();timeoutUnlock=b_.create();acquire(a){return this.lockCount+=1,1===this.lockCount&&null===this.restore&&this.timeoutLock.start(0,()=>this.lock(a)),this.release}release=()=>{this.lockCount-=1,0===this.lockCount&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{0===this.lockCount&&this.restore&&(this.restore?.(),this.restore=null)};lock(a){let b,c,d,e,f;if(0===this.lockCount||null!==this.restore)return;let g=b1(a).documentElement,h=bf(g).getComputedStyle(g).overflowY;if("hidden"===h||"clip"===h){this.restore=P;return}let i=bF||!function(a){if("u"<typeof document)return!1;let b=b1(a);return bf(b).innerWidth-b.documentElement.clientWidth>0}(a);this.restore=i?(c=(b=b1(a)).documentElement,d=b.body,f={overflowY:(e=bi(c)?c:d).style.overflowY,overflowX:e.style.overflowX},Object.assign(e.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(e.style,f)}):function(a){let b=b1(a),c=b.documentElement,d=b.body,e=bf(c),f=0,g=0,h=!1,i=ci.create();if(bE&&(e.visualViewport?.scale??1)!==1)return()=>{};function j(){let b=e.getComputedStyle(c),i=e.getComputedStyle(d),j=(b.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";f=c.scrollTop,g=c.scrollLeft,gn={scrollbarGutter:c.style.scrollbarGutter,overflowY:c.style.overflowY,overflowX:c.style.overflowX},gp=c.style.scrollBehavior,go={position:d.style.position,height:d.style.height,width:d.style.width,boxSizing:d.style.boxSizing,overflowY:d.style.overflowY,overflowX:d.style.overflowX,scrollBehavior:d.style.scrollBehavior};let k=c.scrollHeight>c.clientHeight,l=c.scrollWidth>c.clientWidth,m="scroll"===b.overflowY||"scroll"===i.overflowY,n="scroll"===b.overflowX||"scroll"===i.overflowX,o=Math.max(0,e.innerWidth-d.clientWidth),p=Math.max(0,e.innerHeight-d.clientHeight),q=parseFloat(i.marginTop)+parseFloat(i.marginBottom),r=parseFloat(i.marginLeft)+parseFloat(i.marginRight),s=bi(c)?c:d;if(h=function(a){if(!("u">typeof CSS&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||"u"<typeof document)return!1;let b=b1(a),c=b.documentElement,d=b.body,e=bi(c)?c:d,f=e.style.overflowY,g=c.style.scrollbarGutter;c.style.scrollbarGutter="stable",e.style.overflowY="scroll";let h=e.offsetWidth;e.style.overflowY="hidden";let i=e.offsetWidth;return e.style.overflowY=f,c.style.scrollbarGutter=g,h===i}(a)){c.style.scrollbarGutter=j,s.style.overflowY="hidden",s.style.overflowX="hidden";return}Object.assign(c.style,{scrollbarGutter:j,overflowY:"hidden",overflowX:"hidden"}),(k||m)&&(c.style.overflowY="scroll"),(l||n)&&(c.style.overflowX="scroll"),Object.assign(d.style,{position:"relative",height:q||p?`calc(100dvh - ${q+p}px)`:"100dvh",width:r||o?`calc(100vw - ${r+o}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),d.scrollTop=f,d.scrollLeft=g,c.setAttribute("data-base-ui-scroll-locked",""),c.style.scrollBehavior="unset"}function k(){Object.assign(c.style,gn),Object.assign(d.style,go),h||(c.scrollTop=f,c.scrollLeft=g,c.removeAttribute("data-base-ui-scroll-locked"),c.style.scrollBehavior=gp)}function l(){k(),i.request(j)}return j(),e.addEventListener("resize",l),()=>{i.cancel(),k(),"function"==typeof e.removeEventListener&&e.removeEventListener("resize",l)}}(a)}}let gr=new gq,gs=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var b9=b9;let gt={...c5,modal:cR(a=>a.modal),nested:cR(a=>a.nested),nestedOpenDialogCount:cR(a=>a.nestedOpenDialogCount),disablePointerDismissal:cR(a=>a.disablePointerDismissal),openMethod:cR(a=>a.openMethod),descriptionElementId:cR(a=>a.descriptionElementId),titleElementId:cR(a=>a.titleElementId),viewportElement:cR(a=>a.viewportElement),role:cR(a=>a.role)};class gu extends cW{constructor(a){super(function(a={}){return{...c3(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...a}}(a),{popupRef:p.createRef(),backdropRef:p.createRef(),internalBackdropRef:p.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new c2,onOpenChange:void 0,onOpenChangeComplete:void 0},gt)}setOpen=(a,b)=>{if(b.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},a||null!=b.trigger||null==this.state.activeTriggerId||(b.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(a,b),b.isCanceled)return;let c={open:a,nativeEvent:b.event,reason:b.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",c);let d={open:a},e=b.trigger?.id??null;(e||a)&&(d.activeTriggerId=e,d.activeTriggerElement=b.trigger??null),this.update(d)}}let gv=((m={})[m.open=c9.open]="open",m[m.closed=c9.closed]="closed",m[m.startingStyle=c9.startingStyle]="startingStyle",m[m.endingStyle=c9.endingStyle]="endingStyle",m.nested="data-nested",m.nestedDialogOpen="data-nested-dialog-open",m),gw={...dg,...cp,nested:a=>a?{[gv.nested]:""}:null,nestedDialogOpen:a=>a?{[gv.nestedDialogOpen]:""}:null},gx=p.forwardRef(function(a,b){let{className:c,render:d,children:e,...f}=a,g=gd(),{store:h}=fO(),i=h.useState("open"),j=h.useState("nested"),k=h.useState("transitionStatus"),l=h.useState("nestedOpenDialogCount"),m=h.useState("mounted");return R("div",a,{enabled:g||m,state:{open:i,nested:j,transitionStatus:k,nestedDialogOpen:l>0},ref:[b,h.useStateSetter("viewportElement")],stateAttributesMapping:gw,props:[{role:"presentation",hidden:!m,style:{pointerEvents:i?void 0:"none"},children:e},f]})}),gy=p.forwardRef(function(a,b){let{render:c,className:d,id:e,...f}=a,{store:g}=fO(),h=dh(e);return g.useSyncedValueWithCleanup("titleElementId",h),R("h2",a,{ref:b,props:[{id:h},f]})});var b9=b9;let gz=p.forwardRef(function(a,b){let{render:c,className:d,disabled:e=!1,nativeButton:f=!0,id:g,payload:h,handle:i,...j}=a,k=fO(!0),l=i?.store??k?.store;if(!l)throw Error(H(79));let m=dh(g),n=l.useState("floatingRootContext"),o=l.useState("isOpenedByTrigger",m),q=p.useRef(null),{registerTrigger:r,isMountedByThisTrigger:s}=cs(m,q,l,{payload:h}),{getButtonProps:t,buttonRef:u}=fS({disabled:e,native:f}),v=ce([function(a,b={}){let c="rootStore"in a?a.rootStore:a,d=c.context.dataRef,{enabled:e=!0,event:f="click",toggle:g=!0,ignoreMouse:h=!1,stickIfOpen:i=!0,touchOpenDelay:j=0,reason:k=b9.triggerPress}=b,l=p.useRef(void 0),m=cj(),n=b0(),o=p.useMemo(()=>({onPointerDown(a){l.current=a.pointerType},onMouseDown(a){let b=l.current,e=a.nativeEvent,o=c.select("open");if(0!==a.button||"click"===f||bW(b,!0)&&h)return;let p=d.current.openEvent,q=p?.type,r=c.select("domReferenceElement")!==a.currentTarget,s=o&&r||!(o&&g&&(!p||!i||"click"===q||"mousedown"===q));if(bT(e.target)){let a=b8(k,e,e.target);s&&"touch"===b&&j>0?n.start(j,()=>{c.setOpen(!0,a)}):c.setOpen(s,a);return}let t=a.currentTarget;m.request(()=>{let a=b8(k,e,t);s&&"touch"===b&&j>0?n.start(j,()=>{c.setOpen(!0,a)}):c.setOpen(s,a)})},onClick(a){if("mousedown-only"===f)return;let b=l.current;if("mousedown"===f&&b){l.current=void 0;return}if(bW(b,!0)&&h)return;let e=c.select("open"),m=d.current.openEvent,o=c.select("domReferenceElement")!==a.currentTarget,p=e&&o||!(e&&g&&(!m||!i||bX(m))),q=b8(k,a.nativeEvent,a.currentTarget);p&&"touch"===b&&j>0?n.start(j,()=>{c.setOpen(!0,q)}):c.setOpen(p,q)},onKeyDown(){l.current=void 0}}),[d,f,h,c,i,g,m,n,j,k]);return p.useMemo(()=>e?{reference:o}:Q,[e,o])}(n,{enabled:null!=n})]),w=l.useState("triggerProps",s);return R("button",a,{state:{disabled:e,open:o},ref:[u,b,r,q],props:[v.getReferenceProps(),w,{[ed]:"",id:m},j,t],stateAttributesMapping:df})});var b9=b9;class gA{constructor(a){this.store=a??new gu}open(a){let b=a?this.store.context.triggerElements.getById(a):void 0;this.store.setOpen(!0,b8(b9.imperativeAction,void 0,b))}openWithPayload(a){this.store.set("payload",a),this.store.setOpen(!0,b8(b9.imperativeAction,void 0,void 0))}close(){this.store.setOpen(!1,b8(b9.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}a.s(["Backdrop",0,fQ,"Close",0,fU,"Description",0,fV,"Handle",0,gA,"Popup",0,gk,"Portal",0,gm,"Root",0,function(a){let{children:b,open:c,defaultOpen:d=!1,onOpenChange:e,onOpenChangeComplete:f,disablePointerDismissal:g=!1,modal:h=!0,actionsRef:i,handle:j,triggerId:k,defaultTriggerId:l=null}=a,m=fO(!0),n=!!m,q=J(()=>j?.store??new gu({open:d,openProp:c,activeTriggerId:l,triggerIdProp:k,modal:h,disablePointerDismissal:g,nested:n})).current;ba(()=>{void 0===c&&!1===q.state.open&&!0===d&&q.update({open:!0,activeTriggerId:l})}),q.useControlledProp("openProp",c),q.useControlledProp("triggerIdProp",k),q.useSyncedValues({disablePointerDismissal:g,nested:n,modal:h}),q.useContextCallback("onOpenChange",e),q.useContextCallback("onOpenChangeComplete",f);let r=q.useState("payload");!function(a){let{store:b,parentContext:c,actionsRef:d}=a,e=b.useState("open"),f=b.useState("disablePointerDismissal"),g=b.useState("modal"),h=b.useState("popupElement"),{openMethod:i,triggerProps:j}=function(a){let b,c,d,e,[f,g]=p.useState(null),h=bx((b,c)=>{a||g(c||(bF?"touch":""))});b=p.useRef(a),bb(()=>{b.current!==a&&c(b.current)},[a,c=bx(b=>{b&&!a&&g(null)})]),bb(()=>{b.current=a},[a]);let{onClick:i,onPointerDown:j}=(d=p.useRef(""),e=p.useCallback(a=>{a.defaultPrevented||(d.current=a.pointerType,h(a,a.pointerType))},[h]),{onClick:p.useCallback(a=>{0===a.detail?h(a,"keyboard"):(h(a,"pointerType"in a?a.pointerType:d.current),d.current="")},[h]),onPointerDown:e});return p.useMemo(()=>({openMethod:f,triggerProps:{onClick:i,onPointerDown:j}}),[f,i,j])}(e);ct(b);let{forceUnmount:k}=cu(e,b),l=bx(a=>{let c=b8(a);return c.preventUnmountOnClose=()=>{b.set("preventUnmountingOnClose",!0)},c}),m=p.useCallback(()=>{b.setOpen(!1,l(b9.imperativeAction))},[b,l]);p.useImperativeHandle(d,()=>({unmount:k,close:m}),[k,m]);let n=c1({popupStore:b,onOpenChange:b.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[o,q]=p.useState(0),r=0===o,s=function(a,b={}){let c="rootStore"in a?a.rootStore:a,d=c.useState("open"),e=c.useState("floatingId"),f=c.useState("domReferenceElement"),g=c.useState("floatingElement"),{role:h="dialog"}=b,i=c$(),j=f?.id||i,k=p.useMemo(()=>bV(g)?.id||e,[g,e]),l=gs.get(h)??h,m=null!=b6(),n=p.useMemo(()=>"tooltip"===l||"label"===h?Q:{"aria-haspopup":"alertdialog"===l?"dialog":l,"aria-expanded":"false",..."listbox"===l&&{role:"combobox"},..."menu"===l&&m&&{role:"menuitem"},..."select"===h&&{"aria-autocomplete":"none"},..."combobox"===h&&{"aria-autocomplete":"list"}},[l,m,h]),o=p.useMemo(()=>"tooltip"===l||"label"===h?{[`aria-${"label"===h?"labelledby":"describedby"}`]:d?k:void 0}:{...n,"aria-expanded":d?"true":"false","aria-controls":d?k:void 0,..."menu"===l&&{id:j}},[l,k,d,j,h,n]),q=p.useMemo(()=>{let a={id:k,...l&&{role:l}};return"tooltip"===l||"label"===h?a:{...a,..."menu"===l&&{"aria-labelledby":j}}},[l,k,j,h]),r=p.useCallback(({active:a,selected:b})=>{let c={role:"option",...a&&{id:`${k}-fui-option`}};switch(h){case"select":case"combobox":return{...c,"aria-selected":b}}return{}},[k,h]);return p.useMemo(()=>({reference:o,floating:q,item:r,trigger:n}),[o,q,n,r])}(n),t=cd(n,{outsidePressEvent:()=>b.context.internalBackdropRef.current||b.context.backdropRef.current?"intentional":{mouse:"trap-focus"===g?"sloppy":"intentional",touch:"sloppy"},outsidePress(a){if(!b.context.outsidePressEnabledRef.current||"button"in a&&0!==a.button||"touches"in a&&1!==a.touches.length)return!1;let c=bR(a);return!!r&&!f&&(!g||!b.context.internalBackdropRef.current&&!b.context.backdropRef.current||b.context.internalBackdropRef.current===c||b.context.backdropRef.current===c||bP(c,h)&&!c?.hasAttribute("data-base-ui-portal"))},escapeKey:r});!function(a=!0,b=null){bb(()=>{if(a)return gr.acquire(b)},[a,b])}(e&&!0===g,h);let{getReferenceProps:u,getFloatingProps:v,getTriggerProps:w}=ce([s,t]);b.useContextCallback("onNestedDialogOpen",a=>{q(a+1)}),b.useContextCallback("onNestedDialogClose",()=>{q(0)}),p.useEffect(()=>(c?.onNestedDialogOpen&&e&&c.onNestedDialogOpen(o),c?.onNestedDialogClose&&!e&&c.onNestedDialogClose(),()=>{c?.onNestedDialogClose&&e&&c.onNestedDialogClose()}),[e,c,o]);let x=p.useMemo(()=>u(j),[u,j]),y=p.useMemo(()=>w(j),[w,j]),z=p.useMemo(()=>v(),[v]);b.useSyncedValues({openMethod:i,activeTriggerProps:x,inactiveTriggerProps:y,popupProps:z,floatingRootContext:n,nestedOpenDialogCount:o})}({store:q,actionsRef:i,parentContext:m?.store.context,onOpenChange:e,triggerIdProp:k});let s=p.useMemo(()=>({store:q}),[q]);return(0,o.jsx)(fN.Provider,{value:s,children:"function"==typeof b?b({payload:r}):b})},"Title",0,gy,"Trigger",0,gz,"Viewport",0,gx,"createHandle",0,function(){return new gA}],79021);var gB=a.i(79021),gB=gB;let gC=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim(),gD=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)};var gE={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let gF=(0,p.createContext)({}),gG=(0,p.forwardRef)(({color:a,size:b,strokeWidth:c,absoluteStrokeWidth:d,className:e="",children:f,iconNode:g,...h},i)=>{let{size:j=24,strokeWidth:k=2,absoluteStrokeWidth:l=!1,color:m="currentColor",className:n=""}=(0,p.useContext)(gF)??{},o=d??l?24*Number(c??k)/Number(b??j):c??k;return(0,p.createElement)("svg",{ref:i,...gE,width:b??j??gE.width,height:b??j??gE.height,stroke:a??m,strokeWidth:o,className:gC("lucide",n,e),...!f&&!(a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0;return!1})(h)&&{"aria-hidden":"true"},...h},[...g.map(([a,b])=>(0,p.createElement)(a,b)),...Array.isArray(f)?f:[f]])}),gH=(n=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],(d=(0,p.forwardRef)(({className:a,...b},c)=>(0,p.createElement)(gG,{ref:c,iconNode:n,className:gC(`lucide-${gD("x").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,"lucide-x",a),...b}))).displayName=gD("x"),d),gI=({...a})=>(0,o.jsx)(gB.Root,{"data-slot":"sheet",...a}),gJ=({...a})=>(0,o.jsx)(gB.Portal,{"data-slot":"sheet-portal",...a}),gK=({className:a,...b})=>(0,o.jsx)(gB.Backdrop,{"data-slot":"sheet-overlay",className:((...a)=>a3(T(a)))("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",a),...b}),gL=({className:a,children:b,side:c="right",showCloseButton:d=!0,...e})=>(0,o.jsxs)(gJ,{children:[(0,o.jsx)(gK,{}),(0,o.jsxs)(gB.Popup,{"data-slot":"sheet-content","data-side":c,className:((...a)=>a3(T(a)))("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",a),...e,children:[b,d&&(0,o.jsxs)(gB.Close,{"data-slot":"sheet-close",render:(0,o.jsx)(a6,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[(0,o.jsx)(gH,{}),(0,o.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}),gM=({className:a,...b})=>(0,o.jsx)("div",{"data-slot":"sheet-header",className:((...a)=>a3(T(a)))("flex flex-col gap-0.5 p-4",a),...b}),gN=({className:a,...b})=>(0,o.jsx)(gB.Title,{"data-slot":"sheet-title",className:((...a)=>a3(T(a)))("font-heading text-base font-medium text-foreground",a),...b}),gO=({className:a,...b})=>(0,o.jsx)(gB.Description,{"data-slot":"sheet-description",className:((...a)=>a3(T(a)))("text-sm text-muted-foreground",a),...b}),gP=(0,p.createContext)(null),gQ=({defaultOpen:a=!0,open:b,onOpenChange:c,className:d,style:e,children:f,...g})=>{let h=(()=>{let[a,b]=(0,p.useState)();return(0,p.useEffect)(()=>{let a=window.matchMedia("(max-width: 767px)"),c=()=>{b(window.innerWidth<768)};return a.addEventListener("change",c),b(window.innerWidth<768),()=>a.removeEventListener("change",c)},[]),!!a})(),[i,j]=(0,p.useState)(!1),[k,l]=(0,p.useState)(a),m=b??k,n=(0,p.useCallback)(a=>{let b="function"==typeof a?a(m):a;c?c(b):l(b),cookieStore.set({expires:Date.now()+6048e5,name:"sidebar_state",path:"/",value:String(b)})},[c,m]),q=(0,p.useCallback)(()=>h?j(a=>!a):n(a=>!a),[h,n]);(0,p.useEffect)(()=>{let a=a=>{"b"===a.key&&(a.metaKey||a.ctrlKey)&&(a.preventDefault(),q())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[q]);let r=m?"expanded":"collapsed",s=(0,p.useMemo)(()=>({isMobile:h,open:m,openMobile:i,setOpen:n,setOpenMobile:j,state:r,toggleSidebar:q}),[r,m,n,h,i,q]);return(0,o.jsx)(gP.Provider,{value:s,children:(0,o.jsx)(fx,{delay:0,children:(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",d),"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"16rem","--sidebar-width-icon":"3rem",...e},...g,children:f})})})},gR=({side:a="left",variant:b="sidebar",collapsible:c="offcanvas",className:d,children:e,...f})=>{let{isMobile:g,state:h,openMobile:i,setOpenMobile:j}=(()=>{let a=(0,p.useContext)(gP);if(!a)throw Error("useSidebar must be used within a SidebarProvider.");return a})();return"none"===c?(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",d),"data-slot":"sidebar",...f,children:e}):g?(0,o.jsx)(gI,{onOpenChange:j,open:i,...f,children:(0,o.jsxs)(gL,{className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden","data-mobile":"true","data-sidebar":"sidebar","data-slot":"sidebar",side:a,style:{"--sidebar-width":"18rem"},children:[(0,o.jsxs)(gM,{className:"sr-only",children:[(0,o.jsx)(gN,{children:"Sidebar"}),(0,o.jsx)(gO,{children:"Displays the mobile sidebar."})]}),(0,o.jsx)("div",{className:"flex h-full w-full flex-col",children:e})]})}):(0,o.jsxs)("div",{className:"group peer hidden text-sidebar-foreground md:block","data-collapsible":"collapsed"===h?c:"","data-side":a,"data-slot":"sidebar","data-state":h,"data-variant":b,children:[(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===b||"inset"===b?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)"),"data-slot":"sidebar-gap"}),(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex","left"===a?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===b||"inset"===b?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",d),"data-slot":"sidebar-container",...f,children:(0,o.jsx)("div",{className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm","data-sidebar":"sidebar","data-slot":"sidebar-inner",children:e})})]})},gS=({className:a,...b})=>(0,o.jsx)("main",{className:((...a)=>a3(T(a)))("relative flex w-full flex-1 flex-col bg-background","md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",a),"data-slot":"sidebar-inset",...b}),gT=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex flex-col gap-2 p-2",a),"data-sidebar":"header","data-slot":"sidebar-header",...b}),gU=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex flex-col gap-2 p-2",a),"data-sidebar":"footer","data-slot":"sidebar-footer",...b}),gV=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",a),"data-sidebar":"content","data-slot":"sidebar-content",...b}),gW="diffhub:file-tree:expand-all",gX="diffhub:file-tree:collapse-all",gY=a=>a.map(a=>{if("file"===a.type)return a;let b=gY(a.children);if(1===b.length&&"folder"===b[0].type){let c=b[0];return{...c,name:`${a.name}/${c.name}`}}return{...a,children:b}}),gZ=(a,b=[])=>{for(let c of a)"folder"===c.type&&(b.push(c.path),gZ(c.children,b));return b},g$=(0,p.memo)(function({node:a,depth:b,isSelected:c,commentCount:d,onNavigate:e}){let{insertions:f,deletions:g}=a.fileStat,h=fK;f>0&&0===g?h=fL:g>0&&0===f&&(h=fM);let i="shrink-0 text-sidebar-foreground/40";return f>0&&0===g?i="shrink-0 text-diff-green":g>0&&0===f&&(i="shrink-0 text-destructive"),(0,o.jsxs)("button",{type:"button","aria-current":c?"true":void 0,className:((...a)=>a3(T(a)))("flex w-full cursor-pointer items-center gap-1.5 py-1 text-left transition-colors",c?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),"data-file-path":a.path,"data-selected":c?"true":void 0,style:{containIntrinsicBlockSize:"26px",contentVisibility:"auto",paddingLeft:16*b+8,paddingRight:8},onClick:()=>e(a.path),children:[(0,o.jsx)(h,{size:16,className:i}),(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)("span",{className:"flex-1 truncate text-[12px] leading-tight text-muted-foreground"}),children:a.name}),(0,o.jsx)(fA,{side:"right",children:a.path})]}),d>0&&(0,o.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 text-[10px] text-sidebar-foreground/50",children:[(0,o.jsx)(fG,{size:10}),d]})]})}),g_=(0,p.memo)(function({node:a,depth:b,isCollapsed:c,onToggle:d,children:e}){let f=16*b+8,g=a4(a.name),h=g.split("/");return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("button",{type:"button","aria-expanded":!c,className:"flex w-full items-center gap-1.5 py-1 text-left transition-colors hover:bg-sidebar-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-sidebar-ring",style:{paddingLeft:f,paddingRight:8},onClick:()=>d(a.path),children:[c?(0,o.jsx)(fH,{size:16,className:"shrink-0 text-sidebar-foreground/50"}):(0,o.jsx)(fI,{size:16,className:"shrink-0 text-sidebar-foreground/50"}),(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)("span",{className:"truncate text-[12px] text-muted-foreground"}),children:h.map((a,b)=>{let c=h.slice(0,b+1).join("/");return(0,o.jsxs)(p.Fragment,{children:[a,b<h.length-1&&(0,o.jsx)("span",{className:"text-sidebar-foreground/30",children:"/"})]},c)})}),a.name!==g&&(0,o.jsx)(fA,{side:"right",children:a.name})]})]}),!c&&(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)("div",{className:"pointer-events-none absolute inset-y-0 border-l border-sidebar-border/60",style:{left:f+8}}),e]})]})}),g0=(0,p.memo)(function a({nodes:b,depth:c,selectedFile:d,commentsByFile:e,collapsedFolders:f,onToggleFolder:g,onNavigate:h}){return b.map(b=>"folder"===b.type?(0,o.jsx)(g_,{node:b,depth:c,isCollapsed:f.has(b.path),onToggle:g,children:(0,o.jsx)(a,{nodes:b.children,depth:c+1,selectedFile:d,commentsByFile:e,collapsedFolders:f,onToggleFolder:g,onNavigate:h})},b.path):(0,o.jsx)(g$,{node:b,depth:c,isSelected:d===b.path,commentCount:e.get(b.path)??0,onNavigate:h},b.path))}),g1=({files:a,selectedFile:b,onSelectFile:c,comments:d,filterQuery:e,onFilterChange:f,isLoading:g=!1,insertions:h,deletions:i})=>{let[j,k]=(0,p.useState)(new Set),[l,m]=(0,p.useState)(256),n=(0,p.useRef)(null);(0,p.useEffect)(()=>{let a=()=>{n.current=null,document.body.style.cursor="",document.body.style.userSelect=""},b=a=>{n.current&&m(Math.max(8,n.current.startWidth+a.clientX-n.current.startX))},c=()=>{n.current&&a()};return document.addEventListener("mousemove",b),document.addEventListener("mouseup",c),window.addEventListener("blur",c),()=>{a(),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",c),window.removeEventListener("blur",c)}},[]);let q=(0,p.useCallback)(a=>{a.preventDefault(),n.current={startWidth:l,startX:a.clientX},document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[l]),r=(0,p.useMemo)(()=>e?a.filter(a=>a.file.toLowerCase().includes(e.toLowerCase())):a,[a,e]),s=(0,p.useMemo)(()=>gY((a=>{let b={files:[],folders:{}};for(let c of a){let a=c.file.split("/"),d=b;for(let b=0;b<a.length-1;b+=1){let c=a[b];d.folders[c]||(d.folders[c]={files:[],folders:{}}),d=d.folders[c]}d.files.push(c)}let c=(a,b,d)=>{let e=d?`${d}/${a}`:a,f=[];for(let[a,d]of Object.entries(b.folders).toSorted())f.push(c(a,d,e));for(let a of b.files){let b=a.file.split("/");f.push({fileStat:a,name:b.at(-1)??a.file,path:a.file,type:"file"})}return{children:f,name:a,path:e,type:"folder"}},d=[];for(let[a,e]of Object.entries(b.folders).toSorted())d.push(c(a,e,""));for(let a of b.files)d.push({fileStat:a,name:a.file,path:a.file,type:"file"});return d})(r)),[r]),t=(0,p.useMemo)(()=>gZ(s),[s]);(0,p.useEffect)(()=>{let a=()=>{k(new Set)},b=()=>{k(new Set(t))};return window.addEventListener(gW,a),window.addEventListener(gX,b),()=>{window.removeEventListener(gW,a),window.removeEventListener(gX,b)}},[t]);let u=(0,p.useMemo)(()=>{let a=new Map;for(let b of d)a.set(b.file,(a.get(b.file)??0)+1);return a},[d]),v=(0,p.useCallback)(a=>{k(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),w=(0,p.useCallback)(a=>{let b=new CustomEvent("diffhub:file:navigate",{cancelable:!0,detail:{file:a,source:"sidebar"}});window.dispatchEvent(b)&&c(a,"auto")},[c]),x=null;return x=g?(0,o.jsx)("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:(0,o.jsx)("p",{className:"animate-pulse text-xs text-sidebar-foreground/50",children:"Loading…"})}):0===r.length?(0,o.jsxs)("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[(0,o.jsx)("p",{className:"text-xs text-sidebar-foreground/50",children:"No changes"}),e&&(0,o.jsxs)("p",{className:"text-[10px] text-sidebar-foreground/30",children:["No files match “",e,"”"]})]}):(0,o.jsx)(g0,{nodes:s,depth:0,selectedFile:b,commentsByFile:u,collapsedFolders:j,onToggleFolder:v,onNavigate:w}),(0,o.jsx)(fx,{delay:400,children:(0,o.jsxs)(gR,{collapsible:"none",className:"relative overflow-hidden border-r border-sidebar-border",style:{"--sidebar-width":`${l}px`},children:[(0,o.jsx)(gT,{className:"border-b border-sidebar-border h-[52px] flex-row items-center py-0 px-2",children:(0,o.jsxs)("div",{className:"relative flex w-full items-center",children:[(0,o.jsx)(fJ,{size:12,className:"pointer-events-none absolute left-2.5 text-sidebar-foreground/40"}),(0,o.jsx)("input",{type:"text",value:e,onChange:a=>f(a.target.value),placeholder:"Filter files…","aria-label":"Filter files",className:"w-full rounded-md border border-sidebar-border bg-sidebar-accent py-1.5 pl-7 pr-7 text-xs text-sidebar-foreground placeholder:text-sidebar-foreground/40 transition-colors focus:border-sidebar-ring/50 focus:outline-none"}),e&&(0,o.jsx)("button",{type:"button",onClick:()=>f(""),"aria-label":"Clear filter",className:"absolute right-2 text-sm leading-none text-sidebar-foreground/40 transition-colors hover:text-sidebar-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-sidebar-ring",children:"×"})]})}),(0,o.jsx)(gV,{className:"gap-0 py-1",children:x}),(0,o.jsx)(gU,{className:"border-t border-sidebar-border px-3 py-2",children:(0,o.jsxs)("div",{className:"flex items-center gap-2 text-[12px] font-mono text-sidebar-foreground/60",children:[(0,o.jsxs)("span",{children:[a.length," ",1===a.length?"file":"files"]}),h>0&&(0,o.jsxs)("span",{className:"text-diff-green",children:["+",h]}),i>0&&(0,o.jsxs)("span",{className:"text-destructive",children:["−",i]})]})}),(0,o.jsx)("div",{"aria-hidden":!0,className:"absolute inset-y-0 right-0 z-20 w-[5px] cursor-col-resize after:absolute after:inset-y-0 after:left-1/2 after:-translate-x-1/2 after:w-px after:transition-colors hover:after:bg-sidebar-border",onMouseDown:q})]})})};var g2=a.i(81478);let g3={dark:{addition:"oklch(0.696 0.15 145)",deletion:"oklch(0.704 0.191 22.216)"},light:{addition:"oklch(0.696 0.17 145)",deletion:"oklch(0.577 0.245 27.325)"}},g4={dark:{additionBg:"rgba(74, 222, 128, 0.12)",additionBgNumber:"rgba(74, 222, 128, 0.18)",additionEmphasis:"rgba(74, 222, 128, 0.25)",deletionBg:"rgba(248, 113, 113, 0.12)",deletionBgNumber:"rgba(248, 113, 113, 0.18)",deletionEmphasis:"rgba(248, 113, 113, 0.25)"},light:{additionBg:"rgba(34, 197, 94, 0.08)",additionBgNumber:"rgba(34, 197, 94, 0.12)",additionEmphasis:"rgba(34, 197, 94, 0.20)",deletionBg:"rgba(239, 68, 68, 0.08)",deletionBgNumber:"rgba(239, 68, 68, 0.12)",deletionEmphasis:"rgba(239, 68, 68, 0.20)"}},g5=({value:a,label:b="Copy file path",copiedLabel:c="Copied!",delay:d=400,className:e})=>{let[f,g]=(0,p.useState)(!1),h=(0,p.useCallback)(async()=>{try{await navigator.clipboard.writeText(a),g(!0),setTimeout(()=>g(!1),1500)}catch{}},[a]);return(0,o.jsx)(fx,{delay:d,children:(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)(a6,{variant:"ghost",size:"icon-xs",onClick:h,"aria-label":f?c:b,className:((...a)=>a3(T(a)))("size-6",f?"text-diff-green":"text-muted-foreground hover:text-foreground hover:bg-secondary",e)}),children:f?(0,o.jsx)(r,{size:12}):(0,o.jsx)(t,{size:12})}),(0,o.jsx)(fA,{side:"bottom",children:f?c:b})]})})},g6=({file:a,insertions:b,deletions:c,commentCount:d,repoPath:e,collapsed:f=!1,active:g=!1,onToggleCollapse:h,headingId:i,panelId:j})=>{let k=a4(a),l=k.lastIndexOf("/"),m=-1===l?"":k.slice(0,l),n=-1===l?k:k.slice(l+1);return(0,o.jsx)(fx,{delay:400,children:(0,o.jsxs)("div",{"data-active":g?"true":void 0,"data-state":f?"collapsed":"expanded",className:"flex items-center gap-2 px-3 h-9 border-b border-border bg-card sticky top-0 z-10",children:[(0,o.jsxs)("h3",{id:i,className:"flex min-w-0 flex-1 items-center gap-2 text-[12px] font-normal",children:[(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)(a6,{variant:"ghost",size:"icon-xs",onClick:()=>{h?h():window.dispatchEvent(new CustomEvent("diffhub:file:toggle-collapse",{detail:{file:a}}))},"aria-expanded":!f,"aria-controls":j,"aria-label":f?"Expand file section":"Collapse file section",className:"text-muted-foreground hover:bg-transparent active:bg-transparent aria-expanded:bg-transparent"}),children:(0,o.jsx)(s,{size:14,className:((...a)=>a3(T(a)))("transition-transform duration-150",f&&"-rotate-90")})}),(0,o.jsx)(fA,{side:"bottom",children:f?"Expand file section":"Collapse file section"})]}),(0,o.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,o.jsxs)(fy,{children:[(0,o.jsxs)(fz,{render:(0,o.jsx)("span",{className:"flex min-w-0 items-center gap-1"}),children:[(0,o.jsxs)("span",{className:"flex min-w-0 items-baseline gap-0 font-mono",children:[m&&(0,o.jsxs)("span",{className:"text-muted-foreground truncate shrink",children:[m,"/"]}),(0,o.jsx)("span",{className:"text-muted-foreground font-normal shrink-0",children:n})]}),(0,o.jsx)(g5,{value:`${e}/${a}`})]}),a!==k&&(0,o.jsx)(fA,{side:"bottom",children:a})]}),(0,o.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[b>0&&(0,o.jsxs)("span",{className:"font-mono text-[12px] text-diff-green",children:["+",b]}),c>0&&(0,o.jsxs)("span",{className:"font-mono text-[12px] text-destructive",children:["−",c]})]})]})]}),d>0&&(0,o.jsxs)("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded-full bg-diff-purple/10 text-diff-purple text-[10px] shrink-0",children:[(0,o.jsx)(fG,{size:10}),d]})]})})},g7=q("BranchIcon",(0,p.forwardRef)((a,b)=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:b,...a},p.createElement("circle",{cx:6.5,cy:6,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),p.createElement("circle",{cx:6.5,cy:18,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),p.createElement("circle",{cx:17.5,cy:6,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),p.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6.5 8v8M17.5 8v1c0 1.6569-1.3431 3-3 3h-5c-1.6569 0-3 1.3431-3 3v1"})))),g8=q("TrashCan2Icon",(0,p.forwardRef)((a,b)=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:b,...a},p.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 6v12c0 1.6569 1.3431 3 3 3h6c1.6569 0 3-1.3431 3-3V6M6 6h12M6 6H4m14 0h2M9 6c0-1.6569 1.3431-3 3-3s3 1.3431 3 3m-1 5v5m-4-5v5"})))),g9=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance rounded-lg border-dashed p-6 text-center md:p-12",a),"data-slot":"empty",...b}),ha=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex max-w-sm flex-col items-center gap-2 text-center",a),"data-slot":"empty-header",...b}),hb=V("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{defaultVariants:{variant:"default"},variants:{variant:{default:"bg-transparent",icon:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"}}}),hc=({className:a,variant:b="default",...c})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))(hb({className:a,variant:b})),"data-slot":"empty-icon","data-variant":b,...c}),hd=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("font-medium text-lg tracking-tight",a),"data-slot":"empty-title",...b}),he=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("text-muted-foreground text-sm/relaxed [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",a),"data-slot":"empty-description",...b}),hf=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex w-full min-w-0 max-w-sm flex-col items-center gap-4 text-balance text-sm",a),"data-slot":"empty-content",...b}),hg=({className:a,children:b,...c})=>(0,o.jsx)("kbd",{className:((...a)=>a3(T(a)))("inline-flex h-5 items-center rounded border border-border bg-muted px-1.5 font-mono text-[10px] text-muted-foreground",a),...c,children:b}),hh={"[must-fix]":{border:"border-l-destructive",text:"text-destructive"},"[nit]":{border:"border-l-muted-foreground/40",text:"text-muted-foreground"},"[question]":{border:"border-l-diff-purple",text:"text-diff-purple"},"[suggestion]":{border:"border-l-diff-green",text:"text-diff-green"}},hi=()=>(0,o.jsxs)("div",{className:"animate-pulse",children:[(0,o.jsx)("div",{className:"h-9 border-b border-border bg-card"}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-diff-green/5",children:[(0,o.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-diff-green/20"}),(0,o.jsx)("div",{className:"h-2 rounded bg-diff-green/15",style:{width:"67%"}})]}),(0,o.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3",children:[(0,o.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-muted"}),(0,o.jsx)("div",{className:"h-2 rounded bg-muted",style:{width:"82%"}})]}),(0,o.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-destructive/5",children:[(0,o.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-destructive/20"}),(0,o.jsx)("div",{className:"h-2 rounded bg-destructive/15",style:{width:"54%"}})]}),(0,o.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3",children:[(0,o.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-muted"}),(0,o.jsx)("div",{className:"h-2 rounded bg-muted",style:{width:"78%"}})]}),(0,o.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-diff-green/5",children:[(0,o.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-diff-green/20"}),(0,o.jsx)("div",{className:"h-2 rounded bg-diff-green/15",style:{width:"91%"}})]})]})]}),hj=(0,g2.default)(async()=>{},{loadableGenerated:{modules:[1980]},loading:()=>(0,o.jsx)(hi,{}),ssr:!1}),hk=({onSubmit:a,onCancel:b})=>{let[c,d]=(0,p.useState)(""),[e,f]=(0,p.useState)(null),[g,h]=(0,p.useState)(!1),i=(0,p.useCallback)(a=>{a?.focus({preventScroll:!0})},[]),j=(0,p.useCallback)(async()=>{let b=c.trim();if(b&&!g){f(null),h(!0);try{await a(b,"")||f("Failed to save comment.")}catch{f("Failed to save comment.")}finally{h(!1)}}},[c,g,a]);return(0,o.jsxs)("div",{className:"my-1 mx-4 rounded-md border border-border bg-background p-3 shadow-lg dark:shadow-none",children:[(0,o.jsx)("textarea",{ref:i,value:c,onChange:a=>d(a.target.value),placeholder:"Add a comment for the AI",rows:3,onKeyDown:a=>{("Enter"===a.key&&a.metaKey||"Return"===a.key)&&c.trim()&&j(),"Escape"===a.key&&b()},className:"w-full resize-none rounded border-0 bg-transparent px-0 py-0 font-sans text-sm text-foreground placeholder:text-muted-foreground focus:outline-none"}),(0,o.jsxs)("div",{className:"mt-2 flex justify-end gap-2",children:[(0,o.jsx)(a6,{variant:"ghost",size:"sm",onClick:b,children:"Cancel"}),(0,o.jsx)(a6,{size:"sm",disabled:!c.trim()||g,onClick:()=>void j(),children:g?"Saving…":"Comment"})]}),e&&(0,o.jsx)("p",{className:"mt-2 text-xs text-destructive",children:e})]})},hl=({comment:a,onDelete:b})=>{let[c,d]=(0,p.useState)(!1),[e,f]=(0,p.useState)(null),[g,h]=(0,p.useState)(!1),i=(0,p.useRef)(null);(0,p.useEffect)(()=>()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);let j=async()=>{let b=a.tag?`${a.tag} ${a.body}`:a.body;try{await navigator.clipboard.writeText(b),i.current&&clearTimeout(i.current),d(!0),i.current=setTimeout(()=>{d(!1),i.current=null},1500)}catch{}},k=(0,p.useCallback)(async()=>{if(!g){f(null),h(!0);try{await b()||f("Failed to delete comment.")}catch{f("Failed to delete comment.")}finally{h(!1)}}},[g,b]),l=a.tag?hh[a.tag]?.border??"border-l-ring/40":"border-l-ring/40";return(0,o.jsxs)("div",{className:((...a)=>a3(T(a)))("group my-1 mx-4 rounded-md border border-border bg-card shadow-sm dark:shadow-none overflow-hidden border-l-2",l),children:[(0,o.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2.5",children:[a.tag&&(0,o.jsx)("span",{className:((...a)=>a3(T(a)))("shrink-0 mt-0.5 text-[11px]",hh[a.tag]?.text??"text-muted-foreground"),children:a.tag}),(0,o.jsx)("p",{className:"flex-1 text-sm text-foreground leading-relaxed",children:a.body}),(0,o.jsx)(fx,{delay:400,children:(0,o.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:[(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)("button",{type:"button",onClick:j,"aria-label":c?"Comment copied":"Copy comment",className:((...a)=>a3(T(a)))("rounded p-1 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/50",c?"text-diff-green":"text-muted-foreground hover:text-foreground hover:bg-secondary")}),children:c?(0,o.jsx)(r,{size:12}):(0,o.jsx)(t,{size:12})}),(0,o.jsx)(fA,{side:"top",children:c?"Copied!":"Copy comment"})]}),(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)("button",{type:"button",onClick:k,"aria-label":"Delete comment",disabled:g,className:"rounded p-1 text-muted-foreground transition-colors hover:text-destructive hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/50"}),children:(0,o.jsx)(g8,{size:12})}),(0,o.jsx)(fA,{side:"top",children:"Delete comment"})]})]})})]}),(0,o.jsxs)("div",{className:"border-t border-border/40 px-3 py-1 flex items-center gap-2 text-[10px] text-muted-foreground/60",children:[(0,o.jsxs)("span",{children:["L",a.lineNumber]}),a.createdAt&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{children:"·"}),(0,o.jsx)("span",{children:(a=>{let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return"just now";let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return`${e}d ago`})(a.createdAt)})]})]}),e&&(0,o.jsx)("p",{className:"px-3 pb-2 text-xs text-destructive",children:e})]})},hm=a=>`diff-${encodeURIComponent(a)}`,hn=(0,p.memo)(function({getHoveredLine:a,onCommentTargetChange:b}){let c=(0,p.useCallback)(()=>{let c=a();c&&b({lineNumber:c.lineNumber,side:c.side})},[a,b]);return(0,o.jsx)("button",{type:"button",className:"diffhub-gutter-btn",title:"Add comment for AI",onClick:c,children:"+"})}),ho=(0,p.memo)(function({file:a,filePatch:b,layout:c,prerenderedHTML:d,comments:e,fileStat:f,collapsed:g,active:h=!1,sectionId:i,onToggleCollapse:j,repoPath:k,commentTarget:l,onCommentTargetChange:m,onAddComment:n,onDeleteComment:q}){var r;let s,t,{resolvedTheme:u}=(0,y.useTheme)(),v=(0,p.useMemo)(()=>e.filter(b=>b.file===a),[e,a]),w=`${i}-header`,x=`${i}-panel`,z=(0,p.useMemo)(()=>{let b=v.map(a=>({lineNumber:a.lineNumber,metadata:{comment:a,type:"comment"},side:a.side??"right"}));return l&&b.push({lineNumber:l.lineNumber,metadata:{file:a,type:"input"},side:l.side}),b},[v,l,a]),A=(0,p.useCallback)(b=>{let c=b.metadata;return c?"input"===c.type?(0,o.jsx)(hk,{onSubmit:async(c,d)=>{let e=await n(a,b.lineNumber,b.side,c,d);return e&&m(null),e},onCancel:()=>m(null)}):"comment"===c.type?(0,o.jsx)(hl,{comment:c.comment,onDelete:()=>q(c.comment.id)}):null:null},[a,n,m,q]),B=(0,p.useCallback)(a=>(0,o.jsx)(hn,{getHoveredLine:a,onCommentTargetChange:m}),[m]),C=g&&null===l,D=null;return C||(D=b?(0,o.jsx)(hj,{patch:b,prerenderedHTML:d?.["light"===u?"light":"dark"],disableWorkerPool:!0,style:{colorScheme:"light"===u?"light":"dark"},options:{diffStyle:"split"===c?"split":"unified",disableFileHeader:!0,disableLineNumbers:!1,enableGutterUtility:!0,expansionLineCount:20,hunkSeparators:"line-info",lineDiffType:"word",lineHoverHighlight:"line",maxLineDiffLength:500,overflow:"wrap",theme:{dark:"github-dark",light:"github-light"},themeType:"light"===u?"light":"dark",unsafeCSS:(s=g3[r=u??"dark"],t=g4[r],`
|
|
16
|
+
)`}return(0,o.jsx)("div",{ref:b,role:"presentation","data-base-ui-inert":"",...e,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})}),gm=p.forwardRef(function(a,b){let{keepMounted:c=!1,...d}=a,{store:e}=fO(),f=e.useState("mounted"),g=e.useState("modal"),h=e.useState("open");return f||c?(0,o.jsx)(gc.Provider,{value:c,children:(0,o.jsxs)(ej,{ref:b,...d,children:[f&&!0===g&&(0,o.jsx)(gl,{ref:e.context.internalBackdropRef,inert:fm(!h)}),a.children]})}):null}),gn={},go={},gp="";class gq{lockCount=0;restore=null;timeoutLock=b_.create();timeoutUnlock=b_.create();acquire(a){return this.lockCount+=1,1===this.lockCount&&null===this.restore&&this.timeoutLock.start(0,()=>this.lock(a)),this.release}release=()=>{this.lockCount-=1,0===this.lockCount&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{0===this.lockCount&&this.restore&&(this.restore?.(),this.restore=null)};lock(a){let b,c,d,e,f;if(0===this.lockCount||null!==this.restore)return;let g=b1(a).documentElement,h=bf(g).getComputedStyle(g).overflowY;if("hidden"===h||"clip"===h){this.restore=P;return}let i=bF||!function(a){if("u"<typeof document)return!1;let b=b1(a);return bf(b).innerWidth-b.documentElement.clientWidth>0}(a);this.restore=i?(c=(b=b1(a)).documentElement,d=b.body,f={overflowY:(e=bi(c)?c:d).style.overflowY,overflowX:e.style.overflowX},Object.assign(e.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(e.style,f)}):function(a){let b=b1(a),c=b.documentElement,d=b.body,e=bf(c),f=0,g=0,h=!1,i=ci.create();if(bE&&(e.visualViewport?.scale??1)!==1)return()=>{};function j(){let b=e.getComputedStyle(c),i=e.getComputedStyle(d),j=(b.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";f=c.scrollTop,g=c.scrollLeft,gn={scrollbarGutter:c.style.scrollbarGutter,overflowY:c.style.overflowY,overflowX:c.style.overflowX},gp=c.style.scrollBehavior,go={position:d.style.position,height:d.style.height,width:d.style.width,boxSizing:d.style.boxSizing,overflowY:d.style.overflowY,overflowX:d.style.overflowX,scrollBehavior:d.style.scrollBehavior};let k=c.scrollHeight>c.clientHeight,l=c.scrollWidth>c.clientWidth,m="scroll"===b.overflowY||"scroll"===i.overflowY,n="scroll"===b.overflowX||"scroll"===i.overflowX,o=Math.max(0,e.innerWidth-d.clientWidth),p=Math.max(0,e.innerHeight-d.clientHeight),q=parseFloat(i.marginTop)+parseFloat(i.marginBottom),r=parseFloat(i.marginLeft)+parseFloat(i.marginRight),s=bi(c)?c:d;if(h=function(a){if(!("u">typeof CSS&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||"u"<typeof document)return!1;let b=b1(a),c=b.documentElement,d=b.body,e=bi(c)?c:d,f=e.style.overflowY,g=c.style.scrollbarGutter;c.style.scrollbarGutter="stable",e.style.overflowY="scroll";let h=e.offsetWidth;e.style.overflowY="hidden";let i=e.offsetWidth;return e.style.overflowY=f,c.style.scrollbarGutter=g,h===i}(a)){c.style.scrollbarGutter=j,s.style.overflowY="hidden",s.style.overflowX="hidden";return}Object.assign(c.style,{scrollbarGutter:j,overflowY:"hidden",overflowX:"hidden"}),(k||m)&&(c.style.overflowY="scroll"),(l||n)&&(c.style.overflowX="scroll"),Object.assign(d.style,{position:"relative",height:q||p?`calc(100dvh - ${q+p}px)`:"100dvh",width:r||o?`calc(100vw - ${r+o}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),d.scrollTop=f,d.scrollLeft=g,c.setAttribute("data-base-ui-scroll-locked",""),c.style.scrollBehavior="unset"}function k(){Object.assign(c.style,gn),Object.assign(d.style,go),h||(c.scrollTop=f,c.scrollLeft=g,c.removeAttribute("data-base-ui-scroll-locked"),c.style.scrollBehavior=gp)}function l(){k(),i.request(j)}return j(),e.addEventListener("resize",l),()=>{i.cancel(),k(),"function"==typeof e.removeEventListener&&e.removeEventListener("resize",l)}}(a)}}let gr=new gq,gs=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var b9=b9;let gt={...c5,modal:cR(a=>a.modal),nested:cR(a=>a.nested),nestedOpenDialogCount:cR(a=>a.nestedOpenDialogCount),disablePointerDismissal:cR(a=>a.disablePointerDismissal),openMethod:cR(a=>a.openMethod),descriptionElementId:cR(a=>a.descriptionElementId),titleElementId:cR(a=>a.titleElementId),viewportElement:cR(a=>a.viewportElement),role:cR(a=>a.role)};class gu extends cW{constructor(a){super(function(a={}){return{...c3(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...a}}(a),{popupRef:p.createRef(),backdropRef:p.createRef(),internalBackdropRef:p.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new c2,onOpenChange:void 0,onOpenChangeComplete:void 0},gt)}setOpen=(a,b)=>{if(b.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},a||null!=b.trigger||null==this.state.activeTriggerId||(b.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(a,b),b.isCanceled)return;let c={open:a,nativeEvent:b.event,reason:b.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",c);let d={open:a},e=b.trigger?.id??null;(e||a)&&(d.activeTriggerId=e,d.activeTriggerElement=b.trigger??null),this.update(d)}}let gv=((m={})[m.open=c9.open]="open",m[m.closed=c9.closed]="closed",m[m.startingStyle=c9.startingStyle]="startingStyle",m[m.endingStyle=c9.endingStyle]="endingStyle",m.nested="data-nested",m.nestedDialogOpen="data-nested-dialog-open",m),gw={...dg,...cp,nested:a=>a?{[gv.nested]:""}:null,nestedDialogOpen:a=>a?{[gv.nestedDialogOpen]:""}:null},gx=p.forwardRef(function(a,b){let{className:c,render:d,children:e,...f}=a,g=gd(),{store:h}=fO(),i=h.useState("open"),j=h.useState("nested"),k=h.useState("transitionStatus"),l=h.useState("nestedOpenDialogCount"),m=h.useState("mounted");return R("div",a,{enabled:g||m,state:{open:i,nested:j,transitionStatus:k,nestedDialogOpen:l>0},ref:[b,h.useStateSetter("viewportElement")],stateAttributesMapping:gw,props:[{role:"presentation",hidden:!m,style:{pointerEvents:i?void 0:"none"},children:e},f]})}),gy=p.forwardRef(function(a,b){let{render:c,className:d,id:e,...f}=a,{store:g}=fO(),h=dh(e);return g.useSyncedValueWithCleanup("titleElementId",h),R("h2",a,{ref:b,props:[{id:h},f]})});var b9=b9;let gz=p.forwardRef(function(a,b){let{render:c,className:d,disabled:e=!1,nativeButton:f=!0,id:g,payload:h,handle:i,...j}=a,k=fO(!0),l=i?.store??k?.store;if(!l)throw Error(H(79));let m=dh(g),n=l.useState("floatingRootContext"),o=l.useState("isOpenedByTrigger",m),q=p.useRef(null),{registerTrigger:r,isMountedByThisTrigger:s}=cs(m,q,l,{payload:h}),{getButtonProps:t,buttonRef:u}=fS({disabled:e,native:f}),v=ce([function(a,b={}){let c="rootStore"in a?a.rootStore:a,d=c.context.dataRef,{enabled:e=!0,event:f="click",toggle:g=!0,ignoreMouse:h=!1,stickIfOpen:i=!0,touchOpenDelay:j=0,reason:k=b9.triggerPress}=b,l=p.useRef(void 0),m=cj(),n=b0(),o=p.useMemo(()=>({onPointerDown(a){l.current=a.pointerType},onMouseDown(a){let b=l.current,e=a.nativeEvent,o=c.select("open");if(0!==a.button||"click"===f||bW(b,!0)&&h)return;let p=d.current.openEvent,q=p?.type,r=c.select("domReferenceElement")!==a.currentTarget,s=o&&r||!(o&&g&&(!p||!i||"click"===q||"mousedown"===q));if(bT(e.target)){let a=b8(k,e,e.target);s&&"touch"===b&&j>0?n.start(j,()=>{c.setOpen(!0,a)}):c.setOpen(s,a);return}let t=a.currentTarget;m.request(()=>{let a=b8(k,e,t);s&&"touch"===b&&j>0?n.start(j,()=>{c.setOpen(!0,a)}):c.setOpen(s,a)})},onClick(a){if("mousedown-only"===f)return;let b=l.current;if("mousedown"===f&&b){l.current=void 0;return}if(bW(b,!0)&&h)return;let e=c.select("open"),m=d.current.openEvent,o=c.select("domReferenceElement")!==a.currentTarget,p=e&&o||!(e&&g&&(!m||!i||bX(m))),q=b8(k,a.nativeEvent,a.currentTarget);p&&"touch"===b&&j>0?n.start(j,()=>{c.setOpen(!0,q)}):c.setOpen(p,q)},onKeyDown(){l.current=void 0}}),[d,f,h,c,i,g,m,n,j,k]);return p.useMemo(()=>e?{reference:o}:Q,[e,o])}(n,{enabled:null!=n})]),w=l.useState("triggerProps",s);return R("button",a,{state:{disabled:e,open:o},ref:[u,b,r,q],props:[v.getReferenceProps(),w,{[ed]:"",id:m},j,t],stateAttributesMapping:df})});var b9=b9;class gA{constructor(a){this.store=a??new gu}open(a){let b=a?this.store.context.triggerElements.getById(a):void 0;this.store.setOpen(!0,b8(b9.imperativeAction,void 0,b))}openWithPayload(a){this.store.set("payload",a),this.store.setOpen(!0,b8(b9.imperativeAction,void 0,void 0))}close(){this.store.setOpen(!1,b8(b9.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}a.s(["Backdrop",0,fQ,"Close",0,fU,"Description",0,fV,"Handle",0,gA,"Popup",0,gk,"Portal",0,gm,"Root",0,function(a){let{children:b,open:c,defaultOpen:d=!1,onOpenChange:e,onOpenChangeComplete:f,disablePointerDismissal:g=!1,modal:h=!0,actionsRef:i,handle:j,triggerId:k,defaultTriggerId:l=null}=a,m=fO(!0),n=!!m,q=J(()=>j?.store??new gu({open:d,openProp:c,activeTriggerId:l,triggerIdProp:k,modal:h,disablePointerDismissal:g,nested:n})).current;ba(()=>{void 0===c&&!1===q.state.open&&!0===d&&q.update({open:!0,activeTriggerId:l})}),q.useControlledProp("openProp",c),q.useControlledProp("triggerIdProp",k),q.useSyncedValues({disablePointerDismissal:g,nested:n,modal:h}),q.useContextCallback("onOpenChange",e),q.useContextCallback("onOpenChangeComplete",f);let r=q.useState("payload");!function(a){let{store:b,parentContext:c,actionsRef:d}=a,e=b.useState("open"),f=b.useState("disablePointerDismissal"),g=b.useState("modal"),h=b.useState("popupElement"),{openMethod:i,triggerProps:j}=function(a){let b,c,d,e,[f,g]=p.useState(null),h=bx((b,c)=>{a||g(c||(bF?"touch":""))});b=p.useRef(a),bb(()=>{b.current!==a&&c(b.current)},[a,c=bx(b=>{b&&!a&&g(null)})]),bb(()=>{b.current=a},[a]);let{onClick:i,onPointerDown:j}=(d=p.useRef(""),e=p.useCallback(a=>{a.defaultPrevented||(d.current=a.pointerType,h(a,a.pointerType))},[h]),{onClick:p.useCallback(a=>{0===a.detail?h(a,"keyboard"):(h(a,"pointerType"in a?a.pointerType:d.current),d.current="")},[h]),onPointerDown:e});return p.useMemo(()=>({openMethod:f,triggerProps:{onClick:i,onPointerDown:j}}),[f,i,j])}(e);ct(b);let{forceUnmount:k}=cu(e,b),l=bx(a=>{let c=b8(a);return c.preventUnmountOnClose=()=>{b.set("preventUnmountingOnClose",!0)},c}),m=p.useCallback(()=>{b.setOpen(!1,l(b9.imperativeAction))},[b,l]);p.useImperativeHandle(d,()=>({unmount:k,close:m}),[k,m]);let n=c1({popupStore:b,onOpenChange:b.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[o,q]=p.useState(0),r=0===o,s=function(a,b={}){let c="rootStore"in a?a.rootStore:a,d=c.useState("open"),e=c.useState("floatingId"),f=c.useState("domReferenceElement"),g=c.useState("floatingElement"),{role:h="dialog"}=b,i=c$(),j=f?.id||i,k=p.useMemo(()=>bV(g)?.id||e,[g,e]),l=gs.get(h)??h,m=null!=b6(),n=p.useMemo(()=>"tooltip"===l||"label"===h?Q:{"aria-haspopup":"alertdialog"===l?"dialog":l,"aria-expanded":"false",..."listbox"===l&&{role:"combobox"},..."menu"===l&&m&&{role:"menuitem"},..."select"===h&&{"aria-autocomplete":"none"},..."combobox"===h&&{"aria-autocomplete":"list"}},[l,m,h]),o=p.useMemo(()=>"tooltip"===l||"label"===h?{[`aria-${"label"===h?"labelledby":"describedby"}`]:d?k:void 0}:{...n,"aria-expanded":d?"true":"false","aria-controls":d?k:void 0,..."menu"===l&&{id:j}},[l,k,d,j,h,n]),q=p.useMemo(()=>{let a={id:k,...l&&{role:l}};return"tooltip"===l||"label"===h?a:{...a,..."menu"===l&&{"aria-labelledby":j}}},[l,k,j,h]),r=p.useCallback(({active:a,selected:b})=>{let c={role:"option",...a&&{id:`${k}-fui-option`}};switch(h){case"select":case"combobox":return{...c,"aria-selected":b}}return{}},[k,h]);return p.useMemo(()=>({reference:o,floating:q,item:r,trigger:n}),[o,q,n,r])}(n),t=cd(n,{outsidePressEvent:()=>b.context.internalBackdropRef.current||b.context.backdropRef.current?"intentional":{mouse:"trap-focus"===g?"sloppy":"intentional",touch:"sloppy"},outsidePress(a){if(!b.context.outsidePressEnabledRef.current||"button"in a&&0!==a.button||"touches"in a&&1!==a.touches.length)return!1;let c=bR(a);return!!r&&!f&&(!g||!b.context.internalBackdropRef.current&&!b.context.backdropRef.current||b.context.internalBackdropRef.current===c||b.context.backdropRef.current===c||bP(c,h)&&!c?.hasAttribute("data-base-ui-portal"))},escapeKey:r});!function(a=!0,b=null){bb(()=>{if(a)return gr.acquire(b)},[a,b])}(e&&!0===g,h);let{getReferenceProps:u,getFloatingProps:v,getTriggerProps:w}=ce([s,t]);b.useContextCallback("onNestedDialogOpen",a=>{q(a+1)}),b.useContextCallback("onNestedDialogClose",()=>{q(0)}),p.useEffect(()=>(c?.onNestedDialogOpen&&e&&c.onNestedDialogOpen(o),c?.onNestedDialogClose&&!e&&c.onNestedDialogClose(),()=>{c?.onNestedDialogClose&&e&&c.onNestedDialogClose()}),[e,c,o]);let x=p.useMemo(()=>u(j),[u,j]),y=p.useMemo(()=>w(j),[w,j]),z=p.useMemo(()=>v(),[v]);b.useSyncedValues({openMethod:i,activeTriggerProps:x,inactiveTriggerProps:y,popupProps:z,floatingRootContext:n,nestedOpenDialogCount:o})}({store:q,actionsRef:i,parentContext:m?.store.context,onOpenChange:e,triggerIdProp:k});let s=p.useMemo(()=>({store:q}),[q]);return(0,o.jsx)(fN.Provider,{value:s,children:"function"==typeof b?b({payload:r}):b})},"Title",0,gy,"Trigger",0,gz,"Viewport",0,gx,"createHandle",0,function(){return new gA}],79021);var gB=a.i(79021),gB=gB;let gC=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim(),gD=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)};var gE={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let gF=(0,p.createContext)({}),gG=(0,p.forwardRef)(({color:a,size:b,strokeWidth:c,absoluteStrokeWidth:d,className:e="",children:f,iconNode:g,...h},i)=>{let{size:j=24,strokeWidth:k=2,absoluteStrokeWidth:l=!1,color:m="currentColor",className:n=""}=(0,p.useContext)(gF)??{},o=d??l?24*Number(c??k)/Number(b??j):c??k;return(0,p.createElement)("svg",{ref:i,...gE,width:b??j??gE.width,height:b??j??gE.height,stroke:a??m,strokeWidth:o,className:gC("lucide",n,e),...!f&&!(a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0;return!1})(h)&&{"aria-hidden":"true"},...h},[...g.map(([a,b])=>(0,p.createElement)(a,b)),...Array.isArray(f)?f:[f]])}),gH=(n=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],(d=(0,p.forwardRef)(({className:a,...b},c)=>(0,p.createElement)(gG,{ref:c,iconNode:n,className:gC(`lucide-${gD("x").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,"lucide-x",a),...b}))).displayName=gD("x"),d),gI=({...a})=>(0,o.jsx)(gB.Root,{"data-slot":"sheet",...a}),gJ=({...a})=>(0,o.jsx)(gB.Portal,{"data-slot":"sheet-portal",...a}),gK=({className:a,...b})=>(0,o.jsx)(gB.Backdrop,{"data-slot":"sheet-overlay",className:((...a)=>a3(T(a)))("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",a),...b}),gL=({className:a,children:b,side:c="right",showCloseButton:d=!0,...e})=>(0,o.jsxs)(gJ,{children:[(0,o.jsx)(gK,{}),(0,o.jsxs)(gB.Popup,{"data-slot":"sheet-content","data-side":c,className:((...a)=>a3(T(a)))("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",a),...e,children:[b,d&&(0,o.jsxs)(gB.Close,{"data-slot":"sheet-close",render:(0,o.jsx)(a6,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[(0,o.jsx)(gH,{}),(0,o.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}),gM=({className:a,...b})=>(0,o.jsx)("div",{"data-slot":"sheet-header",className:((...a)=>a3(T(a)))("flex flex-col gap-0.5 p-4",a),...b}),gN=({className:a,...b})=>(0,o.jsx)(gB.Title,{"data-slot":"sheet-title",className:((...a)=>a3(T(a)))("font-heading text-base font-medium text-foreground",a),...b}),gO=({className:a,...b})=>(0,o.jsx)(gB.Description,{"data-slot":"sheet-description",className:((...a)=>a3(T(a)))("text-sm text-muted-foreground",a),...b}),gP=(0,p.createContext)(null),gQ=({defaultOpen:a=!0,open:b,onOpenChange:c,className:d,style:e,children:f,...g})=>{let h=(()=>{let[a,b]=(0,p.useState)();return(0,p.useEffect)(()=>{let a=window.matchMedia("(max-width: 767px)"),c=()=>{b(window.innerWidth<768)};return a.addEventListener("change",c),b(window.innerWidth<768),()=>a.removeEventListener("change",c)},[]),!!a})(),[i,j]=(0,p.useState)(!1),[k,l]=(0,p.useState)(a),m=b??k,n=(0,p.useCallback)(a=>{let b="function"==typeof a?a(m):a;c?c(b):l(b),cookieStore.set({expires:Date.now()+6048e5,name:"sidebar_state",path:"/",value:String(b)})},[c,m]),q=(0,p.useCallback)(()=>h?j(a=>!a):n(a=>!a),[h,n]);(0,p.useEffect)(()=>{let a=a=>{"b"===a.key&&(a.metaKey||a.ctrlKey)&&(a.preventDefault(),q())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[q]);let r=m?"expanded":"collapsed",s=(0,p.useMemo)(()=>({isMobile:h,open:m,openMobile:i,setOpen:n,setOpenMobile:j,state:r,toggleSidebar:q}),[r,m,n,h,i,q]);return(0,o.jsx)(gP.Provider,{value:s,children:(0,o.jsx)(fx,{delay:0,children:(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",d),"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"16rem","--sidebar-width-icon":"3rem",...e},...g,children:f})})})},gR=({side:a="left",variant:b="sidebar",collapsible:c="offcanvas",className:d,children:e,...f})=>{let{isMobile:g,state:h,openMobile:i,setOpenMobile:j}=(()=>{let a=(0,p.useContext)(gP);if(!a)throw Error("useSidebar must be used within a SidebarProvider.");return a})();return"none"===c?(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",d),"data-slot":"sidebar",...f,children:e}):g?(0,o.jsx)(gI,{onOpenChange:j,open:i,...f,children:(0,o.jsxs)(gL,{className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden","data-mobile":"true","data-sidebar":"sidebar","data-slot":"sidebar",side:a,style:{"--sidebar-width":"18rem"},children:[(0,o.jsxs)(gM,{className:"sr-only",children:[(0,o.jsx)(gN,{children:"Sidebar"}),(0,o.jsx)(gO,{children:"Displays the mobile sidebar."})]}),(0,o.jsx)("div",{className:"flex h-full w-full flex-col",children:e})]})}):(0,o.jsxs)("div",{className:"group peer hidden text-sidebar-foreground md:block","data-collapsible":"collapsed"===h?c:"","data-side":a,"data-slot":"sidebar","data-state":h,"data-variant":b,children:[(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===b||"inset"===b?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)"),"data-slot":"sidebar-gap"}),(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex","left"===a?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===b||"inset"===b?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",d),"data-slot":"sidebar-container",...f,children:(0,o.jsx)("div",{className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm","data-sidebar":"sidebar","data-slot":"sidebar-inner",children:e})})]})},gS=({className:a,...b})=>(0,o.jsx)("main",{className:((...a)=>a3(T(a)))("relative flex w-full flex-1 flex-col bg-background","md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",a),"data-slot":"sidebar-inset",...b}),gT=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex flex-col gap-2 p-2",a),"data-sidebar":"header","data-slot":"sidebar-header",...b}),gU=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex flex-col gap-2 p-2",a),"data-sidebar":"footer","data-slot":"sidebar-footer",...b}),gV=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",a),"data-sidebar":"content","data-slot":"sidebar-content",...b}),gW="diffhub:file-tree:expand-all",gX="diffhub:file-tree:collapse-all",gY=a=>a.map(a=>{if("file"===a.type)return a;let b=gY(a.children);if(1===b.length&&"folder"===b[0].type){let c=b[0];return{...c,name:`${a.name}/${c.name}`}}return{...a,children:b}}),gZ=(a,b=[])=>{for(let c of a)"folder"===c.type&&(b.push(c.path),gZ(c.children,b));return b},g$=(0,p.memo)(function({node:a,depth:b,isSelected:c,commentCount:d,onNavigate:e}){let{insertions:f,deletions:g}=a.fileStat,h=fK;f>0&&0===g?h=fL:g>0&&0===f&&(h=fM);let i="shrink-0 text-sidebar-foreground/40";return f>0&&0===g?i="shrink-0 text-diff-green":g>0&&0===f&&(i="shrink-0 text-destructive"),(0,o.jsxs)("button",{type:"button","aria-current":c?"true":void 0,className:((...a)=>a3(T(a)))("flex w-full cursor-pointer items-center gap-1.5 py-1 text-left transition-colors",c?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),"data-file-path":a.path,"data-selected":c?"true":void 0,style:{containIntrinsicBlockSize:"26px",contentVisibility:"auto",paddingLeft:16*b+8,paddingRight:8},onClick:()=>e(a.path),children:[(0,o.jsx)(h,{size:16,className:i}),(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)("span",{className:"flex-1 truncate text-[12px] leading-tight text-muted-foreground"}),children:a.name}),(0,o.jsx)(fA,{side:"right",children:a.path})]}),d>0&&(0,o.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 text-[10px] text-sidebar-foreground/50",children:[(0,o.jsx)(fG,{size:10}),d]})]})}),g_=(0,p.memo)(function({node:a,depth:b,isCollapsed:c,onToggle:d,children:e}){let f=16*b+8,g=a4(a.name),h=g.split("/");return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("button",{type:"button","aria-expanded":!c,className:"flex w-full items-center gap-1.5 py-1 text-left transition-colors hover:bg-sidebar-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-sidebar-ring",style:{paddingLeft:f,paddingRight:8},onClick:()=>d(a.path),children:[c?(0,o.jsx)(fH,{size:16,className:"shrink-0 text-sidebar-foreground/50"}):(0,o.jsx)(fI,{size:16,className:"shrink-0 text-sidebar-foreground/50"}),(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)("span",{className:"truncate text-[12px] text-muted-foreground"}),children:h.map((a,b)=>{let c=h.slice(0,b+1).join("/");return(0,o.jsxs)(p.Fragment,{children:[a,b<h.length-1&&(0,o.jsx)("span",{className:"text-sidebar-foreground/30",children:"/"})]},c)})}),a.name!==g&&(0,o.jsx)(fA,{side:"right",children:a.name})]})]}),!c&&(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)("div",{className:"pointer-events-none absolute inset-y-0 border-l border-sidebar-border/60",style:{left:f+8}}),e]})]})}),g0=(0,p.memo)(function a({nodes:b,depth:c,selectedFile:d,commentsByFile:e,collapsedFolders:f,onToggleFolder:g,onNavigate:h}){return b.map(b=>"folder"===b.type?(0,o.jsx)(g_,{node:b,depth:c,isCollapsed:f.has(b.path),onToggle:g,children:(0,o.jsx)(a,{nodes:b.children,depth:c+1,selectedFile:d,commentsByFile:e,collapsedFolders:f,onToggleFolder:g,onNavigate:h})},b.path):(0,o.jsx)(g$,{node:b,depth:c,isSelected:d===b.path,commentCount:e.get(b.path)??0,onNavigate:h},b.path))}),g1=({files:a,selectedFile:b,onSelectFile:c,comments:d,filterQuery:e,onFilterChange:f,isLoading:g=!1,insertions:h,deletions:i})=>{let[j,k]=(0,p.useState)(new Set),[l,m]=(0,p.useState)(256),n=(0,p.useRef)(null);(0,p.useEffect)(()=>{let a=()=>{n.current=null,document.body.style.cursor="",document.body.style.userSelect=""},b=a=>{n.current&&m(Math.max(8,n.current.startWidth+a.clientX-n.current.startX))},c=()=>{n.current&&a()};return document.addEventListener("mousemove",b),document.addEventListener("mouseup",c),window.addEventListener("blur",c),()=>{a(),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",c),window.removeEventListener("blur",c)}},[]);let q=(0,p.useCallback)(a=>{a.preventDefault(),n.current={startWidth:l,startX:a.clientX},document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[l]),r=(0,p.useMemo)(()=>e?a.filter(a=>a.file.toLowerCase().includes(e.toLowerCase())):a,[a,e]),s=(0,p.useMemo)(()=>gY((a=>{let b={files:[],folders:{}};for(let c of a){let a=c.file.split("/"),d=b;for(let b=0;b<a.length-1;b+=1){let c=a[b];d.folders[c]||(d.folders[c]={files:[],folders:{}}),d=d.folders[c]}d.files.push(c)}let c=(a,b,d)=>{let e=d?`${d}/${a}`:a,f=[];for(let[a,d]of Object.entries(b.folders).toSorted())f.push(c(a,d,e));for(let a of b.files){let b=a.file.split("/");f.push({fileStat:a,name:b.at(-1)??a.file,path:a.file,type:"file"})}return{children:f,name:a,path:e,type:"folder"}},d=[];for(let[a,e]of Object.entries(b.folders).toSorted())d.push(c(a,e,""));for(let a of b.files)d.push({fileStat:a,name:a.file,path:a.file,type:"file"});return d})(r)),[r]),t=(0,p.useMemo)(()=>gZ(s),[s]);(0,p.useEffect)(()=>{let a=()=>{k(new Set)},b=()=>{k(new Set(t))};return window.addEventListener(gW,a),window.addEventListener(gX,b),()=>{window.removeEventListener(gW,a),window.removeEventListener(gX,b)}},[t]);let u=(0,p.useMemo)(()=>{let a=new Map;for(let b of d)a.set(b.file,(a.get(b.file)??0)+1);return a},[d]),v=(0,p.useCallback)(a=>{k(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),w=(0,p.useCallback)(a=>{let b=new CustomEvent("diffhub:file:navigate",{cancelable:!0,detail:{file:a,source:"sidebar"}});window.dispatchEvent(b)&&c(a,"auto")},[c]),x=null;return x=g?(0,o.jsx)("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:(0,o.jsx)("p",{className:"animate-pulse text-xs text-sidebar-foreground/50",children:"Loading…"})}):0===r.length?(0,o.jsxs)("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[(0,o.jsx)("p",{className:"text-xs text-sidebar-foreground/50",children:"No changes"}),e&&(0,o.jsxs)("p",{className:"text-[10px] text-sidebar-foreground/30",children:["No files match “",e,"”"]})]}):(0,o.jsx)(g0,{nodes:s,depth:0,selectedFile:b,commentsByFile:u,collapsedFolders:j,onToggleFolder:v,onNavigate:w}),(0,o.jsx)(fx,{delay:400,children:(0,o.jsxs)(gR,{collapsible:"none",className:"relative overflow-hidden border-r border-sidebar-border",style:{"--sidebar-width":`${l}px`},children:[(0,o.jsx)(gT,{className:"border-b border-sidebar-border h-[52px] flex-row items-center py-0 px-2",children:(0,o.jsxs)("div",{className:"relative flex w-full items-center",children:[(0,o.jsx)(fJ,{size:12,className:"pointer-events-none absolute left-2.5 text-sidebar-foreground/40"}),(0,o.jsx)("input",{type:"text",value:e,onChange:a=>f(a.target.value),placeholder:"Filter files…","aria-label":"Filter files",className:"w-full rounded-md border border-sidebar-border bg-sidebar-accent py-1.5 pl-7 pr-7 text-xs text-sidebar-foreground placeholder:text-sidebar-foreground/40 transition-colors focus:border-sidebar-ring/50 focus:outline-none"}),e&&(0,o.jsx)("button",{type:"button",onClick:()=>f(""),"aria-label":"Clear filter",className:"absolute right-2 text-sm leading-none text-sidebar-foreground/40 transition-colors hover:text-sidebar-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-sidebar-ring",children:"×"})]})}),(0,o.jsx)(gV,{className:"gap-0 py-1",children:x}),(0,o.jsx)(gU,{className:"border-t border-sidebar-border px-3 py-2",children:(0,o.jsxs)("div",{className:"flex items-center gap-2 text-[12px] font-mono text-sidebar-foreground/60",children:[(0,o.jsxs)("span",{children:[a.length," ",1===a.length?"file":"files"]}),h>0&&(0,o.jsxs)("span",{className:"text-diff-green",children:["+",h]}),i>0&&(0,o.jsxs)("span",{className:"text-destructive",children:["−",i]})]})}),(0,o.jsx)("div",{"aria-hidden":!0,className:"absolute inset-y-0 right-0 z-20 w-[5px] cursor-col-resize after:absolute after:inset-y-0 after:left-1/2 after:-translate-x-1/2 after:w-px after:transition-colors hover:after:bg-sidebar-border",onMouseDown:q})]})})};var g2=a.i(81478);let g3={dark:{addition:"oklch(0.696 0.15 145)",deletion:"oklch(0.704 0.191 22.216)"},light:{addition:"oklch(0.696 0.17 145)",deletion:"oklch(0.577 0.245 27.325)"}},g4={dark:{additionBg:"rgba(74, 222, 128, 0.12)",additionBgNumber:"rgba(74, 222, 128, 0.18)",additionEmphasis:"rgba(74, 222, 128, 0.25)",deletionBg:"rgba(248, 113, 113, 0.12)",deletionBgNumber:"rgba(248, 113, 113, 0.18)",deletionEmphasis:"rgba(248, 113, 113, 0.25)"},light:{additionBg:"rgba(34, 197, 94, 0.08)",additionBgNumber:"rgba(34, 197, 94, 0.12)",additionEmphasis:"rgba(34, 197, 94, 0.20)",deletionBg:"rgba(239, 68, 68, 0.08)",deletionBgNumber:"rgba(239, 68, 68, 0.12)",deletionEmphasis:"rgba(239, 68, 68, 0.20)"}},g5=({value:a,label:b="Copy file path",copiedLabel:c="Copied!",delay:d=400,className:e})=>{let[f,g]=(0,p.useState)(!1),h=(0,p.useCallback)(async()=>{try{await navigator.clipboard.writeText(a),g(!0),setTimeout(()=>g(!1),1500)}catch{}},[a]);return(0,o.jsx)(fx,{delay:d,children:(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)(a6,{variant:"ghost",size:"icon-xs",onClick:h,"aria-label":f?c:b,className:((...a)=>a3(T(a)))("size-6",f?"text-diff-green":"text-muted-foreground hover:text-foreground hover:bg-secondary",e)}),children:f?(0,o.jsx)(r,{size:12}):(0,o.jsx)(t,{size:12})}),(0,o.jsx)(fA,{side:"bottom",children:f?c:b})]})})},g6=({file:a,insertions:b,deletions:c,commentCount:d,repoPath:e,collapsed:f=!1,active:g=!1,onToggleCollapse:h,headingId:i,panelId:j})=>{let k=a4(a),l=k.lastIndexOf("/"),m=-1===l?"":k.slice(0,l),n=-1===l?k:k.slice(l+1);return(0,o.jsx)(fx,{delay:400,children:(0,o.jsxs)("div",{"data-active":g?"true":void 0,"data-state":f?"collapsed":"expanded",className:"flex items-center gap-2 px-3 h-9 border-b border-border bg-card sticky top-0 z-10",children:[(0,o.jsxs)("h3",{id:i,className:"flex min-w-0 flex-1 items-center gap-2 text-[12px] font-normal",children:[(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)(a6,{variant:"ghost",size:"icon-xs",onClick:()=>{h?h():window.dispatchEvent(new CustomEvent("diffhub:file:toggle-collapse",{detail:{file:a}}))},"aria-expanded":!f,"aria-controls":j,"aria-label":f?"Expand file section":"Collapse file section",className:"text-muted-foreground hover:bg-transparent active:bg-transparent aria-expanded:bg-transparent"}),children:(0,o.jsx)(s,{size:14,className:((...a)=>a3(T(a)))("transition-transform duration-150",f&&"-rotate-90")})}),(0,o.jsx)(fA,{side:"bottom",children:f?"Expand file section":"Collapse file section"})]}),(0,o.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,o.jsxs)(fy,{children:[(0,o.jsxs)(fz,{render:(0,o.jsx)("span",{className:"flex min-w-0 items-center gap-1"}),children:[(0,o.jsxs)("span",{className:"flex min-w-0 items-baseline gap-0 font-mono",children:[m&&(0,o.jsxs)("span",{className:"text-muted-foreground truncate shrink",children:[m,"/"]}),(0,o.jsx)("span",{className:"text-muted-foreground font-normal shrink-0",children:n})]}),(0,o.jsx)(g5,{value:`${e}/${a}`})]}),a!==k&&(0,o.jsx)(fA,{side:"bottom",children:a})]}),(0,o.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[b>0&&(0,o.jsxs)("span",{className:"font-mono text-[12px] text-diff-green",children:["+",b]}),c>0&&(0,o.jsxs)("span",{className:"font-mono text-[12px] text-destructive",children:["−",c]})]})]})]}),d>0&&(0,o.jsxs)("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded-full bg-diff-purple/10 text-diff-purple text-[10px] shrink-0",children:[(0,o.jsx)(fG,{size:10}),d]})]})})},g7=q("BranchIcon",(0,p.forwardRef)((a,b)=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:b,...a},p.createElement("circle",{cx:6.5,cy:6,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),p.createElement("circle",{cx:6.5,cy:18,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),p.createElement("circle",{cx:17.5,cy:6,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),p.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6.5 8v8M17.5 8v1c0 1.6569-1.3431 3-3 3h-5c-1.6569 0-3 1.3431-3 3v1"})))),g8=q("TrashCan2Icon",(0,p.forwardRef)((a,b)=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:b,...a},p.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 6v12c0 1.6569 1.3431 3 3 3h6c1.6569 0 3-1.3431 3-3V6M6 6h12M6 6H4m14 0h2M9 6c0-1.6569 1.3431-3 3-3s3 1.3431 3 3m-1 5v5m-4-5v5"})))),g9=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance rounded-lg border-dashed p-6 text-center md:p-12",a),"data-slot":"empty",...b}),ha=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex max-w-sm flex-col items-center gap-2 text-center",a),"data-slot":"empty-header",...b}),hb=V("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{defaultVariants:{variant:"default"},variants:{variant:{default:"bg-transparent",icon:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"}}}),hc=({className:a,variant:b="default",...c})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))(hb({className:a,variant:b})),"data-slot":"empty-icon","data-variant":b,...c}),hd=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("font-medium text-lg tracking-tight",a),"data-slot":"empty-title",...b}),he=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("text-muted-foreground text-sm/relaxed [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",a),"data-slot":"empty-description",...b}),hf=({className:a,...b})=>(0,o.jsx)("div",{className:((...a)=>a3(T(a)))("flex w-full min-w-0 max-w-sm flex-col items-center gap-4 text-balance text-sm",a),"data-slot":"empty-content",...b}),hg=({className:a,children:b,...c})=>(0,o.jsx)("kbd",{className:((...a)=>a3(T(a)))("inline-flex h-5 items-center rounded border border-border bg-muted px-1.5 font-mono text-[10px] text-muted-foreground",a),...c,children:b}),hh={"[must-fix]":{border:"border-l-destructive",text:"text-destructive"},"[nit]":{border:"border-l-muted-foreground/40",text:"text-muted-foreground"},"[question]":{border:"border-l-diff-purple",text:"text-diff-purple"},"[suggestion]":{border:"border-l-diff-green",text:"text-diff-green"}},hi=()=>(0,o.jsxs)("div",{className:"animate-pulse",children:[(0,o.jsx)("div",{className:"h-9 border-b border-border bg-card"}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-diff-green/5",children:[(0,o.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-diff-green/20"}),(0,o.jsx)("div",{className:"h-2 rounded bg-diff-green/15",style:{width:"67%"}})]}),(0,o.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3",children:[(0,o.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-muted"}),(0,o.jsx)("div",{className:"h-2 rounded bg-muted",style:{width:"82%"}})]}),(0,o.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-destructive/5",children:[(0,o.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-destructive/20"}),(0,o.jsx)("div",{className:"h-2 rounded bg-destructive/15",style:{width:"54%"}})]}),(0,o.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3",children:[(0,o.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-muted"}),(0,o.jsx)("div",{className:"h-2 rounded bg-muted",style:{width:"78%"}})]}),(0,o.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-diff-green/5",children:[(0,o.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-diff-green/20"}),(0,o.jsx)("div",{className:"h-2 rounded bg-diff-green/15",style:{width:"91%"}})]})]})]}),hj=({onRender:a})=>(0,o.jsxs)("div",{className:"mx-4 my-4 rounded-md border border-dashed border-border bg-muted/20 p-4","data-testid":"deferred-diff-placeholder",children:[(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:"Diff rendering is deferred until this file becomes active or visible."}),(0,o.jsx)(a6,{className:"mt-3",size:"sm",variant:"outline",onClick:a,children:"Render diff"})]}),hk=(0,g2.default)(async()=>{},{loadableGenerated:{modules:[1980]},loading:()=>(0,o.jsx)(hi,{}),ssr:!1}),hl=({onSubmit:a,onCancel:b})=>{let[c,d]=(0,p.useState)(""),[e,f]=(0,p.useState)(null),[g,h]=(0,p.useState)(!1),i=(0,p.useCallback)(a=>{a?.focus({preventScroll:!0})},[]),j=(0,p.useCallback)(async()=>{let b=c.trim();!b||g||(f(null),h(!0),await a(b,"").catch(()=>!1)||f("Failed to save comment."),h(!1))},[c,g,a]);return(0,o.jsxs)("div",{className:"my-1 mx-4 rounded-md border border-border bg-background p-3 shadow-lg dark:shadow-none",children:[(0,o.jsx)("textarea",{ref:i,value:c,onChange:a=>d(a.target.value),placeholder:"Add a comment for the AI",rows:3,onKeyDown:a=>{("Enter"===a.key&&a.metaKey||"Return"===a.key)&&c.trim()&&j(),"Escape"===a.key&&b()},className:"w-full resize-none rounded border-0 bg-transparent px-0 py-0 font-sans text-sm text-foreground placeholder:text-muted-foreground focus:outline-none"}),(0,o.jsxs)("div",{className:"mt-2 flex justify-end gap-2",children:[(0,o.jsx)(a6,{variant:"ghost",size:"sm",onClick:b,children:"Cancel"}),(0,o.jsx)(a6,{size:"sm",disabled:!c.trim()||g,onClick:()=>void j(),children:g?"Saving…":"Comment"})]}),e&&(0,o.jsx)("p",{className:"mt-2 text-xs text-destructive",children:e})]})},hm=({comment:a,onDelete:b})=>{let[c,d]=(0,p.useState)(!1),[e,f]=(0,p.useState)(null),[g,h]=(0,p.useState)(!1),i=(0,p.useRef)(null);(0,p.useEffect)(()=>()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);let j=async()=>{let b=a.tag?`${a.tag} ${a.body}`:a.body;try{await navigator.clipboard.writeText(b),i.current&&clearTimeout(i.current),d(!0),i.current=setTimeout(()=>{d(!1),i.current=null},1500)}catch{}},k=(0,p.useCallback)(async()=>{g||(f(null),h(!0),await b().catch(()=>!1)||f("Failed to delete comment."),h(!1))},[g,b]),l=a.tag?hh[a.tag]?.border??"border-l-ring/40":"border-l-ring/40";return(0,o.jsxs)("div",{className:((...a)=>a3(T(a)))("group my-1 mx-4 rounded-md border border-border bg-card shadow-sm dark:shadow-none overflow-hidden border-l-2",l),children:[(0,o.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2.5",children:[a.tag&&(0,o.jsx)("span",{className:((...a)=>a3(T(a)))("shrink-0 mt-0.5 text-[11px]",hh[a.tag]?.text??"text-muted-foreground"),children:a.tag}),(0,o.jsx)("p",{className:"flex-1 text-sm text-foreground leading-relaxed",children:a.body}),(0,o.jsx)(fx,{delay:400,children:(0,o.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:[(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)("button",{type:"button",onClick:j,"aria-label":c?"Comment copied":"Copy comment",className:((...a)=>a3(T(a)))("rounded p-1 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/50",c?"text-diff-green":"text-muted-foreground hover:text-foreground hover:bg-secondary")}),children:c?(0,o.jsx)(r,{size:12}):(0,o.jsx)(t,{size:12})}),(0,o.jsx)(fA,{side:"top",children:c?"Copied!":"Copy comment"})]}),(0,o.jsxs)(fy,{children:[(0,o.jsx)(fz,{render:(0,o.jsx)("button",{type:"button",onClick:k,"aria-label":"Delete comment",disabled:g,className:"rounded p-1 text-muted-foreground transition-colors hover:text-destructive hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/50"}),children:(0,o.jsx)(g8,{size:12})}),(0,o.jsx)(fA,{side:"top",children:"Delete comment"})]})]})})]}),(0,o.jsxs)("div",{className:"border-t border-border/40 px-3 py-1 flex items-center gap-2 text-[10px] text-muted-foreground/60",children:[(0,o.jsxs)("span",{children:["L",a.lineNumber]}),a.createdAt&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{children:"·"}),(0,o.jsx)("span",{children:(a=>{let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return"just now";let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return`${e}d ago`})(a.createdAt)})]})]}),e&&(0,o.jsx)("p",{className:"px-3 pb-2 text-xs text-destructive",children:e})]})},hn=a=>`diff-${encodeURIComponent(a)}`,ho=(0,p.memo)(function({getHoveredLine:a,onCommentTargetChange:b}){let c=(0,p.useCallback)(()=>{let c=a();c&&b({lineNumber:c.lineNumber,side:c.side})},[a,b]);return(0,o.jsx)("button",{type:"button",className:"diffhub-gutter-btn",title:"Add comment for AI",onClick:c,children:"+"})}),hp=(0,p.memo)(function({file:a,filePatch:b,layout:c,prerenderedHTML:d,shouldRenderPatch:e,comments:f,fileStat:g,collapsed:h,active:i=!1,sectionId:j,onToggleCollapse:k,repoPath:l,commentTarget:m,onCommentTargetChange:n,onRenderPatch:q,onAddComment:r,onDeleteComment:s}){let{resolvedTheme:t}=(0,y.useTheme)(),u=(0,p.useMemo)(()=>f.filter(b=>b.file===a),[f,a]),v=`${j}-header`,w=`${j}-panel`,x=(0,p.useMemo)(()=>{let b=u.map(a=>({lineNumber:a.lineNumber,metadata:{comment:a,type:"comment"},side:"left"===a.side?"deletions":"additions"}));return m&&b.push({lineNumber:m.lineNumber,metadata:{file:a,type:"input"},side:m.side}),b},[u,m,a]),z=(0,p.useCallback)(b=>{let c=b.metadata;return c?"input"===c.type?(0,o.jsx)(hl,{onSubmit:async(c,d)=>{let e=await r(a,b.lineNumber,b.side,c,d);return e&&n(null),e},onCancel:()=>n(null)}):"comment"===c.type?(0,o.jsx)(hm,{comment:c.comment,onDelete:()=>s(c.comment.id)}):null:null},[a,r,n,s]),A=(0,p.useCallback)(a=>(0,o.jsx)(ho,{getHoveredLine:a,onCommentTargetChange:n}),[n]),B=(0,p.useCallback)(()=>{q()},[q]),C=h&&null===m,D=null;if(!C)if(b)if(e){var E;let e,f;D=(0,o.jsx)(hk,{patch:b,prerenderedHTML:d?.["light"===t?"light":"dark"],disableWorkerPool:!0,style:{colorScheme:"light"===t?"light":"dark"},options:{diffStyle:"split"===c?"split":"unified",disableFileHeader:!0,disableLineNumbers:!1,enableGutterUtility:!0,expansionLineCount:20,hunkSeparators:"line-info",lineDiffType:"word",lineHoverHighlight:"line",maxLineDiffLength:500,overflow:"wrap",theme:{dark:"github-dark",light:"github-light"},themeType:"light"===t?"light":"dark",unsafeCSS:(e=g3[E=t??"dark"],f=g4[E],`
|
|
17
17
|
[data-diff-span] { border-radius: 0; }
|
|
18
18
|
:host {
|
|
19
19
|
/* Base colors for additions/deletions */
|
|
20
|
-
--diffs-addition-color-override: ${
|
|
21
|
-
--diffs-deletion-color-override: ${
|
|
20
|
+
--diffs-addition-color-override: ${e.addition};
|
|
21
|
+
--diffs-deletion-color-override: ${e.deletion};
|
|
22
22
|
|
|
23
23
|
/* Line background colors */
|
|
24
|
-
--diffs-bg-addition-override: ${
|
|
25
|
-
--diffs-bg-deletion-override: ${
|
|
24
|
+
--diffs-bg-addition-override: ${f.additionBg};
|
|
25
|
+
--diffs-bg-deletion-override: ${f.deletionBg};
|
|
26
26
|
|
|
27
27
|
/* Line number background colors */
|
|
28
|
-
--diffs-bg-addition-number-override: ${
|
|
29
|
-
--diffs-bg-deletion-number-override: ${
|
|
28
|
+
--diffs-bg-addition-number-override: ${f.additionBgNumber};
|
|
29
|
+
--diffs-bg-deletion-number-override: ${f.deletionBgNumber};
|
|
30
30
|
|
|
31
31
|
/* Character-level emphasis (inline diff highlights) */
|
|
32
|
-
--diffs-bg-addition-emphasis-override: ${
|
|
33
|
-
--diffs-bg-deletion-emphasis-override: ${
|
|
32
|
+
--diffs-bg-addition-emphasis-override: ${f.additionEmphasis};
|
|
33
|
+
--diffs-bg-deletion-emphasis-override: ${f.deletionEmphasis};
|
|
34
34
|
|
|
35
35
|
/* Hover states */
|
|
36
|
-
--diffs-bg-addition-hover-override: ${
|
|
37
|
-
--diffs-bg-deletion-hover-override: ${
|
|
36
|
+
--diffs-bg-addition-hover-override: ${f.additionEmphasis};
|
|
37
|
+
--diffs-bg-deletion-hover-override: ${f.deletionEmphasis};
|
|
38
38
|
|
|
39
39
|
/* Line number text colors */
|
|
40
|
-
--diffs-fg-number-addition-override: ${
|
|
41
|
-
--diffs-fg-number-deletion-override: ${
|
|
40
|
+
--diffs-fg-number-addition-override: ${e.addition};
|
|
41
|
+
--diffs-fg-number-deletion-override: ${e.deletion};
|
|
42
42
|
}
|
|
43
|
-
`)},lineAnnotations:
|
|
44
|
-
`:"")}return b})(d.patch??"")),{baseBranch:d.baseBranch,branch:d.branch,generation:d.generation,mergeBase:d.mergeBase,patchesByFile:f,prerenderedHTMLByFile:d.prerenderedHTMLByFile,reviewKeysByFile:d.reviewKeysByFile??(g=d.generation,Object.fromEntries(Object.entries(f).map(([a,b])=>[a,`${g}:${(a=>{let b=0;for(let c=0;c<a.length;c+=1)b=Math.trunc(Math.imul(31,b)+(a.codePointAt(c)??0));return Math.abs(b).toString(36)})(`${a}:${b}`)}`]))),sourceFingerprint:e});if(a!==K.current||c!==D.current||b!==E.current)return void console.info("[diffhub] fetchDiff response stale",{fingerprint:c,generation:b,latestRequestId:K.current,requestId:a});console.info("[diffhub] fetchDiff success",{fileCount:Object.keys(i.patchesByFile).length,fingerprint:c,generation:i.generation,requestId:a}),L(()=>j(i))}catch(d){console.error("[diffhub] fetchDiff threw",{error:d,fingerprint:c,generation:b,mode:A.current,requestId:a}),a===K.current&&v(d instanceof Error?d.message:String(d))}},[R,L]),T=(0,p.useCallback)(async()=>{if(J.current=!0,!I.current){I.current=!0,x(!0);
|
|
43
|
+
`)},lineAnnotations:x,renderAnnotation:z,renderGutterUtility:A},`${a}:${c}:${t}`)}else D=(0,o.jsx)(hj,{onRender:B});else D=(0,o.jsx)("div",{className:"px-4 py-6 text-sm text-muted-foreground",children:"No textual patch available for this file."});return(0,o.jsxs)("div",{"data-filename":a,className:"font-sans",children:[(0,o.jsx)(g6,{file:a,insertions:g?.insertions??0,deletions:g?.deletions??0,commentCount:u.length,repoPath:l,collapsed:h,active:i,onToggleCollapse:k,headingId:v,panelId:w}),(0,o.jsx)("div",{id:w,role:"region","aria-labelledby":v,hidden:C,children:D})]})}),hq=(0,p.memo)(function({file:a,filePatch:b,layout:c,prerenderedHTML:d,deferPatchRendering:e,comments:f,fileStat:g,collapsed:h,active:i,onToggleCollapse:j,onVisible:k,repoPath:l,onAddComment:m,onDeleteComment:n}){let q=(0,p.useRef)(null),[r,s]=(0,p.useState)(null),[t,u]=(0,p.useState)(()=>i||!e),v=(0,p.useCallback)(()=>{u(!0)},[]);(0,p.useEffect)(()=>{(!e||i||null!==r)&&u(!0)},[i,r,e]),(0,p.useEffect)(()=>{let b=q.current;if(!b||"u"<typeof IntersectionObserver)return;let c=new IntersectionObserver(b=>{let[c]=b;c&&c.isIntersecting&&c.intersectionRatio>=.35&&(u(!0),k(a))},{root:document.querySelector("#diff-container"),rootMargin:"-72px 0px -55% 0px",threshold:[.35,.6]});return c.observe(b),()=>c.disconnect()},[a,k]);let w=hn(a);return(0,o.jsx)("section",{ref:q,id:w,"data-file-section":a,className:"scroll-mt-16",style:{containIntrinsicBlockSize:"auto 300px",contentVisibility:"auto"},children:(0,o.jsx)(hp,{file:a,filePatch:b,layout:c,prerenderedHTML:d?.[c],shouldRenderPatch:t,comments:f,fileStat:g,collapsed:h,active:i,sectionId:w,onToggleCollapse:j,repoPath:l,commentTarget:r,onCommentTargetChange:s,onRenderPatch:v,onAddComment:m,onDeleteComment:n})})}),hr=({patchesByFile:a,prerenderedHTMLByFile:b,layout:c,comments:d,onAddComment:e,onDeleteComment:f,activeFileId:g,fileStats:h,collapsedFiles:i,onToggleCollapse:j,onActiveFileChange:k,repoPath:l})=>{let m=(0,p.useMemo)(()=>{let a=new Map;for(let b of h)a.set(b.file,b);return a},[h]),n=(0,p.useMemo)(()=>(a=>{let b={files:[],folders:new Map};for(let c of a){let a=c.split("/"),d=b;for(let b=0;b<a.length-1;b+=1){let c=a[b];d.folders.has(c)||d.folders.set(c,{files:[],folders:new Map});let e=d.folders.get(c);e&&(d=e)}d.files.push(c)}let c=[],d=a=>{for(let[,b]of[...a.folders.entries()].toSorted((a,b)=>a[0].localeCompare(b[0])))d(b);let b=[...a.files].toSorted((a,b)=>{let c=a.split("/").at(-1)??a,d=b.split("/").at(-1)??b;return c.localeCompare(d)});c.push(...b)};return d(b),c})([...h.map(a=>a.file),...Object.keys(a).filter(a=>!m.has(a))]),[m,h,a]),q=n.length>=24&&0===Object.keys(b??{}).length,r=(0,p.useMemo)(()=>{let a=new Map;for(let b of n)a.set(b,()=>j(b));return a},[n,j]);return 0===n.length?(0,o.jsxs)(g9,{className:"h-full",children:[(0,o.jsxs)(ha,{children:[(0,o.jsx)(hc,{variant:"icon",children:(0,o.jsx)(g7,{})}),(0,o.jsx)(hd,{children:"No changes"}),(0,o.jsx)(he,{children:"The working tree is clean relative to the base branch"})]}),(0,o.jsx)(hf,{children:(0,o.jsxs)("p",{className:"text-xs text-muted-foreground/60",children:["Press ",(0,o.jsx)(hg,{children:"r"})," to refresh"]})})]}):(0,o.jsx)("div",{className:"h-full min-h-0 overflow-auto",id:"diff-container",children:n.map(h=>(0,o.jsx)(hq,{file:h,filePatch:a[h]??"",layout:c,prerenderedHTML:b?.[h],deferPatchRendering:q,comments:d,fileStat:m.get(h),collapsed:i.has(h),active:g===h,onToggleCollapse:r.get(h),onVisible:k,repoPath:l,onAddComment:e,onDeleteComment:f},h))})},hs=[1e3,2e3,5e3],ht=(a,b,c)=>{let[d,e]=(0,p.useState)(b);return(0,p.useEffect)(()=>{try{let b=localStorage.getItem(a);null!==b&&(!c||c.includes(b))&&e(b)}catch{}},[a,c]),[d,(0,p.useCallback)(b=>{e(c=>{let d="function"==typeof b?b(c):b;try{localStorage.setItem(a,d)}catch{}return d})},[a])]},hu=["split","stacked"],hv=["all","uncommitted"],hw=({text:a,pulse:b=!1})=>(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("div",{className:`text-muted-foreground text-sm${b?" animate-pulse":""}`,children:a})}),hx=a=>{let b=hn(a).replaceAll(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g,"\\$&");return`#${b}`},hy=({notice:a})=>{let b="border-border bg-muted/40 text-muted-foreground";return"destructive"===a.tone?b="border-destructive/30 bg-destructive/10 text-destructive":"warning"===a.tone&&(b="border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400"),(0,o.jsx)("div",{className:`border-b px-4 py-2 text-xs ${b}`,children:(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{className:"font-medium",children:a.label}),a.detail&&(0,o.jsx)("span",{className:"text-xs opacity-80",children:a.detail})]})})},hz=({filesData:a,deferredDiffData:b,diffError:c,syncNotice:d,layout:e,comments:f,onAddComment:g,onDeleteComment:h,selectedFile:i,collapsedFiles:j,onToggleCollapse:k,onActiveFileChange:l,repoPath:m})=>null===a?(0,o.jsx)(hw,{text:"Loading diff…",pulse:!0}):0===a.files.length?(0,o.jsx)(hw,{text:"No changes"}):b?(0,o.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[d&&(0,o.jsx)(hy,{notice:d}),(0,o.jsx)("div",{className:"min-h-0 flex-1",children:(0,o.jsx)(hr,{patchesByFile:b.patchesByFile,prerenderedHTMLByFile:b.prerenderedHTMLByFile,layout:e,comments:f,onAddComment:g,onDeleteComment:h,activeFileId:i,fileStats:a.files,collapsedFiles:j,onToggleCollapse:k,onActiveFileChange:l,repoPath:m})})]}):c?(0,o.jsx)(hw,{text:c}):(0,o.jsx)(hw,{text:"Loading diff…",pulse:!0});a.s(["DiffApp",0,({repoPath:a})=>{let[b,c]=(0,p.useState)(null),[d,e]=(0,p.useState)([]),[f,g]=(0,p.useState)(null),h=(0,p.useRef)(null),[i,j]=(0,p.useState)(null),[k,l]=ht("diffhub-layout","stacked",hu),[m,n]=(0,p.useState)(""),[q,r]=(0,p.useState)(!1),[s,t]=(0,p.useState)(null),[u,v]=(0,p.useState)(null),[w,x]=(0,p.useState)(!1),[y,z]=ht("diffhub-diffMode","all",hv),A=(0,p.useRef)(y),B=(0,p.useRef)(null),C=(0,p.useRef)(null),D=(0,p.useRef)(null),E=(0,p.useRef)(null),F=(0,p.useRef)(!1),G=(0,p.useRef)(!1),H=(0,p.useRef)(()=>Promise.resolve()),I=(0,p.useRef)(!1),J=(0,p.useRef)(!1),K=(0,p.useRef)(0),[,L]=(0,p.useTransition)(),[M,N]=(0,p.useState)(()=>new Set);(0,p.useEffect)(()=>{A.current=y},[y]),(0,p.useEffect)(()=>{N(new Set([]))},[a]);let O=(0,p.useCallback)(b=>{N(c=>{let d=b(c);if(d===c)return c;try{localStorage.setItem(`diffhub-collapsed:${a}`,JSON.stringify([...d]))}catch{}return d})},[a]),P=(0,p.useDeferredValue)(i),Q=(0,p.useCallback)(()=>{let a=new URLSearchParams;"uncommitted"===A.current&&a.set("mode","uncommitted");let b=a.toString();return b?`?${b}`:""},[]),R=(0,p.useCallback)(()=>{let a=new URLSearchParams;E.current&&a.set("generation",E.current),"uncommitted"===A.current&&a.set("mode","uncommitted");let b=a.toString();return b?`?${b}`:""},[]),S=(0,p.useCallback)(async a=>{let b=E.current,c=D.current;v(null),console.info("[diffhub] fetchDiff start",{fingerprint:c,generation:b,mode:A.current,requestId:a});try{var d,e;let f,g,h=await fetch(`/api/diff${R()}`);if(!h.ok){let d=(await h.json().catch(()=>({error:"Failed to load diff"}))).error??`Failed to load diff (${h.status})`;console.error("[diffhub] fetchDiff non-ok response",{fingerprint:c,generation:b,mode:A.current,requestId:a,responseStatus:h.status,responseStatusText:h.statusText,serverError:d}),a===K.current&&v(d);return}let i=(d=await h.json(),e=c??"unknown",f=d.patchesByFile??Object.fromEntries((a=>{let b=new Map,c=/^diff --git a\/(.+?) b\/(.+)$/gm,d=[],e=c.exec(a);for(;e;)d.push({file:e[2],start:e.index}),e=c.exec(a);for(let[c,e]of d.entries()){let f=d[c+1]?.start??a.length,g=a.slice(e.start,f).trimEnd();b.set(e.file,g?`${g}
|
|
44
|
+
`:"")}return b})(d.patch??"")),{baseBranch:d.baseBranch,branch:d.branch,generation:d.generation,mergeBase:d.mergeBase,patchesByFile:f,prerenderedHTMLByFile:d.prerenderedHTMLByFile,reviewKeysByFile:d.reviewKeysByFile??(g=d.generation,Object.fromEntries(Object.entries(f).map(([a,b])=>[a,`${g}:${(a=>{let b=0;for(let c=0;c<a.length;c+=1)b=Math.trunc(Math.imul(31,b)+(a.codePointAt(c)??0));return Math.abs(b).toString(36)})(`${a}:${b}`)}`]))),sourceFingerprint:e});if(a!==K.current||c!==D.current||b!==E.current)return void console.info("[diffhub] fetchDiff response stale",{fingerprint:c,generation:b,latestRequestId:K.current,requestId:a});console.info("[diffhub] fetchDiff success",{fileCount:Object.keys(i.patchesByFile).length,fingerprint:c,generation:i.generation,requestId:a}),L(()=>j(i))}catch(d){console.error("[diffhub] fetchDiff threw",{error:d,fingerprint:c,generation:b,mode:A.current,requestId:a}),a===K.current&&v(d instanceof Error?d.message:String(d))}},[R,L]),T=(0,p.useCallback)(async()=>{if(J.current=!0,!I.current){for(I.current=!0,x(!0);J.current;)J.current=!1,K.current+=1,await S(K.current);I.current=!1,x(!1)}},[S]),U=(0,p.useCallback)(a=>{if(D.current=a.fingerprint,E.current=a.generation,0===a.files.length){h.current=null,K.current+=1,(0,p.startTransition)(()=>{g(null),j(null)}),v(null),C.current=a.fingerprint;return}let b=h.current;b&&a.files.some(a=>a.file===b)||(h.current=b=a.files[0]?.file??null,(0,p.startTransition)(()=>g(b)));let c=a.fingerprint!==C.current,d=i?.generation===a.generation;(c||!d||null!==u)&&(C.current=a.fingerprint,c&&(K.current+=1),T())},[i,u,T]),V=(0,p.useCallback)(()=>{K.current+=1,C.current=null,D.current=null,E.current=null,j(null),v(null)},[]),W=(0,p.useCallback)(async(a=!1)=>{let b=()=>{a||r(!1),F.current=!1,G.current&&(G.current=!1,queueMicrotask(()=>{H.current(!0)}))};if(F.current){G.current=!0;return}F.current=!0,a||r(!0),t(null);let d=await Promise.all([fetch(`/api/files${Q()}`),fetch("/api/comments").then(async a=>{if(!a.ok)throw Error(`Failed to load comments (${a.status})`);return await a.json()}).catch(a=>(console.error("[diffhub] comments refresh failed",{error:a}),null))]).catch(a=>(t(a instanceof Error?a.message:String(a)),null));if(!d)return void b();let[f,g]=d;if(!f.ok){t((await f.json().catch(()=>({error:"Network error"}))).error??"Failed to load files"),b();return}let h=await f.json();(0,p.startTransition)(()=>{c(h),null!==g&&e(g)}),U(h),b()},[Q,U]);(0,p.useEffect)(()=>{H.current=W},[W]);let X=(a=>{let[b,c]=(0,p.useState)("connecting"),d=(0,p.useEffectEvent)(a),e=(0,p.useRef)(null);return(0,p.useEffect)(()=>{let a=!1,b=0,f=null,g=new AbortController,h=async()=>{if(!a)try{let f=null===e.current?"":`?revision=${e.current}`,i=await fetch(`/api/watch${f}`,{cache:"no-store",signal:g.signal});if(a)return;if(!i.ok)throw Error(`Watch request failed with status ${i.status}`);let j=await i.json();if(a)return;b=0,c("live");let k=e.current;e.current=j.revision,j.changed&&null!==k&&j.revision!==k&&d(),a||queueMicrotask(()=>{a||h()})}catch(d){if(a||g.signal.aborted)return;if(console.error("[diffhub] file watch failed",{error:d,failureCount:b+=1}),b>10){console.error("[diffhub] file watch: max retries exceeded, stopping"),c("fallback");return}c(b>=hs.length?"fallback":"connecting"),f=setTimeout(()=>{f=null,a||h()},hs[Math.min(b-1,hs.length-1)])}};return c("connecting"),h(),()=>{a=!0,g.abort(),f&&clearTimeout(f)}},[]),b})(()=>{W(!0)}),Y=(0,p.useCallback)(()=>{W()},[W]);(0,p.useEffect)(()=>{W()},[W]),(0,p.useEffect)(()=>{let a=setInterval(()=>void W(!0),"live"===X?3e4:5e3);return()=>clearInterval(a)},[X,W]);let Z=(0,p.useCallback)((a,b=800)=>{B.current={file:a,until:Date.now()+b},h.current=a,(0,p.startTransition)(()=>g(a))},[]),$=(0,p.useCallback)((a,b="smooth")=>{Z(a),O(b=>{if(b.has(a)){let c=new Set(b);return c.delete(a),c}return b});let c=a=>{a.scrollIntoView({behavior:b,block:"start"});let c=a.querySelector('[role="heading"], h2, h3, button');c?c.focus({preventScroll:!0}):(a.setAttribute("tabindex","-1"),a.focus({preventScroll:!0}))},d=document.querySelector(hx(a));if(d)return void c(d);let e=document.querySelector("#diff-container");if(!e)return;let f=new MutationObserver(()=>{let b=document.querySelector(hx(a));b&&(f.disconnect(),c(b))});f.observe(e,{childList:!0,subtree:!0}),setTimeout(()=>f.disconnect(),5e3)},[Z,O]),_=(0,p.useCallback)(a=>{let b=B.current;if(b){if(Date.now()>b.until)B.current=null;else if(b.file!==a)return}h.current!==a&&(h.current=a,(0,p.startTransition)(()=>g(a)))},[]),aa=(0,p.useCallback)(a=>{Z(a),O(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[Z,O]),ab=(0,p.useCallback)(()=>{O(()=>new Set((b?.files??[]).map(a=>a.file)))},[b,O]),ac=(0,p.useCallback)(()=>{O(()=>new Set)},[O]);(0,p.useEffect)(()=>{let a=a=>{if(!(a.target instanceof HTMLTextAreaElement||a.target instanceof HTMLInputElement)){if("s"!==a.key||a.metaKey||a.ctrlKey||l(a=>"split"===a?"stacked":"split"),"/"!==a.key&&"t"!==a.key.toLowerCase()||a.metaKey||a.ctrlKey||(a.preventDefault(),document.querySelector('input[placeholder="Filter files…"]')?.focus()),"c"===a.key.toLowerCase()&&!a.metaKey&&!a.ctrlKey&&f){if(a.shiftKey)return void ab();aa(f)}if("e"!==a.key.toLowerCase()||!a.shiftKey||a.metaKey||a.ctrlKey||ac(),"r"!==a.key||a.metaKey||a.ctrlKey||W(),"j"===a.key||"k"===a.key){let c=b?.files??[];if(0===c.length)return;let d=c.findIndex(a=>a.file===f),e="j"===a.key?c[d+1]:c[d-1];e&&$(e.file)}}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[ab,ac,b,W,$,f,l,aa]);let ad=(0,p.useCallback)(a=>{A.current=a,z(a),V(),W(!1)},[V,W,z]),ae=(0,p.useCallback)(async(a,b,c,d,f)=>{let g=await fetch("/api/comments",{body:JSON.stringify({body:d,file:a,lineNumber:b,side:"deletions"===c?"left":"right",tag:f}),headers:{"Content-Type":"application/json"},method:"POST"});if(!g.ok)return console.error("[diffhub] add comment failed",{error:(await g.json().catch(()=>({error:"Failed to save comment"}))).error??`Failed to save comment (${g.status})`}),!1;let h=await g.json();return e(a=>[...a,h]),!0},[]),af=(0,p.useCallback)(async a=>{let b=await fetch(`/api/comments?id=${a}`,{method:"DELETE"});return b.ok?(e(b=>b.filter(b=>b.id!==a)),!0):(console.error("[diffhub] delete comment failed",{error:(await b.json().catch(()=>({error:"Failed to delete comment"}))).error??`Failed to delete comment (${b.status})`}),!1)},[]),ag=s&&null!==b?{detail:s,label:"Background refresh failed",tone:"destructive"}:u&&P?{detail:u,label:"Diff refresh failed",tone:"destructive"}:"fallback"===X?{detail:"Live watch is unavailable, so the app is polling every 5 seconds",label:"Polling fallback",tone:"warning"}:null;return s&&null===b?(0,o.jsx)(gQ,{className:"h-svh",children:(0,o.jsxs)(gS,{className:"flex flex-col h-svh items-center justify-center gap-4",children:[(0,o.jsxs)("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 px-6 py-4 text-sm text-destructive max-w-md text-center",children:[(0,o.jsx)("p",{className:"font-semibold mb-1",children:"Failed to load diff"}),(0,o.jsx)("p",{className:"text-xs opacity-80",children:s})]}),(0,o.jsx)(a6,{variant:"outline",onClick:Y,children:"Retry"})]})}):(0,o.jsxs)(gQ,{className:"h-svh",children:[(0,o.jsx)(g1,{files:b?.files??[],selectedFile:f,onSelectFile:$,comments:d,filterQuery:m,onFilterChange:n,isLoading:null===b,insertions:b?.insertions??0,deletions:b?.deletions??0}),(0,o.jsxs)(gS,{className:"flex flex-col h-svh overflow-hidden",children:[(0,o.jsx)(fF,{branch:b?.branch??"…",baseBranch:b?.baseBranch??"main",refreshing:q||w,fileWatchState:X,comments:d,diffMode:y,onDiffModeChange:ad,layout:k,onLayoutChange:l,syncNotice:ag}),(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,o.jsx)(hz,{filesData:b,deferredDiffData:P,diffError:u,syncNotice:ag,layout:k,comments:d,onAddComment:ae,onDeleteComment:af,selectedFile:f,collapsedFiles:M,onToggleCollapse:aa,onActiveFileChange:_,repoPath:a})})]})]})}],44425)}];
|
|
45
45
|
|
|
46
46
|
//# sourceMappingURL=_0oc3qg_._.js.map
|
|
@@ -7,9 +7,9 @@ globalThis.__BUILD_MANIFEST = {
|
|
|
7
7
|
"static/chunks/03~yq9q893hmn.js"
|
|
8
8
|
],
|
|
9
9
|
"lowPriorityFiles": [
|
|
10
|
-
"static/
|
|
11
|
-
"static/
|
|
12
|
-
"static/
|
|
10
|
+
"static/wJudy_0U8odZjFz2U2KtS/_buildManifest.js",
|
|
11
|
+
"static/wJudy_0U8odZjFz2U2KtS/_ssgManifest.js",
|
|
12
|
+
"static/wJudy_0U8odZjFz2U2KtS/_clientMiddlewareManifest.js"
|
|
13
13
|
],
|
|
14
14
|
"rootMainFiles": [
|
|
15
15
|
"static/chunks/0nupph2ieezql.js",
|