trident-git 0.25.0 → 0.27.0
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/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +5 -5
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +2 -2
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +3 -3
- package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/credentials/github/repos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/credentials/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/custom-scripts/route.js +2 -2
- package/.next/server/app/api/custom-scripts/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/fs/open/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/fs/open-terminal/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/fs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/action/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/branches/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/log/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repos/clone/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/.next/server/app/credentials/page_client-reference-manifest.js +1 -1
- package/.next/server/app/credentials.html +1 -1
- package/.next/server/app/credentials.rsc +3 -3
- package/.next/server/app/credentials.segments/_full.segment.rsc +3 -3
- package/.next/server/app/credentials.segments/_head.segment.rsc +1 -1
- package/.next/server/app/credentials.segments/_index.segment.rsc +3 -3
- package/.next/server/app/credentials.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/credentials.segments/credentials/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/credentials.segments/credentials.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +3 -3
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/changes/page.js +1 -1
- package/.next/server/app/workspace/changes/page.js.nft.json +1 -1
- package/.next/server/app/workspace/changes/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/changes.html +1 -1
- package/.next/server/app/workspace/changes.rsc +18 -21
- package/.next/server/app/workspace/changes.segments/_full.segment.rsc +18 -21
- package/.next/server/app/workspace/changes.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace/changes.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace/changes.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace/changes.segments/workspace/changes/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/workspace/changes.segments/workspace/changes.segment.rsc +1 -1
- package/.next/server/app/workspace/changes.segments/workspace.segment.rsc +6 -9
- package/.next/server/app/workspace/conflicts/page.js +1 -1
- package/.next/server/app/workspace/conflicts/page.js.nft.json +1 -1
- package/.next/server/app/workspace/conflicts/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/conflicts.html +1 -1
- package/.next/server/app/workspace/conflicts.rsc +18 -21
- package/.next/server/app/workspace/conflicts.segments/_full.segment.rsc +18 -21
- package/.next/server/app/workspace/conflicts.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace/conflicts.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace/conflicts.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace/conflicts.segments/workspace/conflicts/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/workspace/conflicts.segments/workspace/conflicts.segment.rsc +1 -1
- package/.next/server/app/workspace/conflicts.segments/workspace.segment.rsc +6 -9
- package/.next/server/app/workspace/custom-scripts/page.js +1 -1
- package/.next/server/app/workspace/custom-scripts/page.js.nft.json +1 -1
- package/.next/server/app/workspace/custom-scripts/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/custom-scripts.html +1 -1
- package/.next/server/app/workspace/custom-scripts.rsc +18 -21
- package/.next/server/app/workspace/custom-scripts.segments/_full.segment.rsc +18 -21
- package/.next/server/app/workspace/custom-scripts.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace/custom-scripts.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace/custom-scripts.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace/custom-scripts.segments/workspace/custom-scripts/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/workspace/custom-scripts.segments/workspace/custom-scripts.segment.rsc +1 -1
- package/.next/server/app/workspace/custom-scripts.segments/workspace.segment.rsc +6 -9
- package/.next/server/app/workspace/history/page.js +1 -1
- package/.next/server/app/workspace/history/page.js.nft.json +1 -1
- package/.next/server/app/workspace/history/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/history.html +1 -1
- package/.next/server/app/workspace/history.rsc +18 -21
- package/.next/server/app/workspace/history.segments/_full.segment.rsc +18 -21
- package/.next/server/app/workspace/history.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace/history.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace/history.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace/history.segments/workspace/history/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/workspace/history.segments/workspace/history.segment.rsc +1 -1
- package/.next/server/app/workspace/history.segments/workspace.segment.rsc +6 -9
- package/.next/server/app/workspace/page.js +1 -1
- package/.next/server/app/workspace/page.js.nft.json +1 -1
- package/.next/server/app/workspace/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/settings/page.js +1 -1
- package/.next/server/app/workspace/settings/page.js.nft.json +1 -1
- package/.next/server/app/workspace/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/settings.html +1 -1
- package/.next/server/app/workspace/settings.rsc +18 -21
- package/.next/server/app/workspace/settings.segments/_full.segment.rsc +18 -21
- package/.next/server/app/workspace/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace/settings.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace/settings.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace/settings.segments/workspace/settings/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/workspace/settings.segments/workspace/settings.segment.rsc +1 -1
- package/.next/server/app/workspace/settings.segments/workspace.segment.rsc +6 -9
- package/.next/server/app/workspace/stashes/page.js +1 -1
- package/.next/server/app/workspace/stashes/page.js.nft.json +1 -1
- package/.next/server/app/workspace/stashes/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/stashes.html +1 -1
- package/.next/server/app/workspace/stashes.rsc +18 -21
- package/.next/server/app/workspace/stashes.segments/_full.segment.rsc +18 -21
- package/.next/server/app/workspace/stashes.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace/stashes.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace/stashes.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace/stashes.segments/workspace/stashes/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/workspace/stashes.segments/workspace/stashes.segment.rsc +1 -1
- package/.next/server/app/workspace/stashes.segments/workspace.segment.rsc +6 -9
- package/.next/server/app/workspace.html +1 -1
- package/.next/server/app/workspace.rsc +18 -21
- package/.next/server/app/workspace.segments/_full.segment.rsc +18 -21
- package/.next/server/app/workspace.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace.segments/workspace/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/workspace.segments/workspace.segment.rsc +6 -9
- package/.next/server/app-paths-manifest.json +5 -5
- package/.next/server/chunks/764.js +3 -1
- package/.next/server/chunks/809.js +1 -1
- package/.next/server/chunks/835.js +1 -0
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/2944-317f69df23d5d81c.js +9 -0
- package/.next/static/chunks/app/layout-28df9f0af1a904ba.js +3 -0
- package/.next/static/chunks/app/workspace/layout-0cefd66558e505b9.js +1 -0
- package/.next/static/css/{04da82c464d41917.css → f63b50c409c55440.css} +1 -1
- package/package.json +1 -1
- package/.next/server/chunks/547.js +0 -3
- package/.next/static/chunks/2944-f1ff2d4c47ff4526.js +0 -9
- package/.next/static/chunks/app/layout-1eb3f74bfb86e3d5.js +0 -1
- package/.next/static/chunks/app/workspace/layout-6735475bf8f9495d.js +0 -3
- /package/.next/static/{Z2jcv8BWFnY_uJuEr8xah → C7h0CkZ-fYKbUd_hIQuKW}/_buildManifest.js +0 -0
- /package/.next/static/{Z2jcv8BWFnY_uJuEr8xah → C7h0CkZ-fYKbUd_hIQuKW}/_ssgManifest.js +0 -0
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
exports.id=547,exports.ids=[547],exports.modules={10:(a,b,c)=>{"use strict";c.d(b,{L:()=>h});var d=c(21820),e=c.n(d),f=c(33873),g=c.n(f);function h(){let a=process.platform,b=e().homedir();return"win32"===a?g().join(process.env.APPDATA||g().join(b,"AppData","Roaming"),"trident"):"darwin"===a?g().join(b,"Library","Application Support","trident"):g().join(process.env.XDG_CONFIG_HOME||g().join(b,".config"),"trident")}},16772:(a,b,c)=>{"use strict";c.d(b,{C:()=>i,CustomScriptExecutionProvider:()=>h});var d=c(48249),e=c(67484),f=c(5023);let g=(0,e.createContext)(null);function h({children:a}){(0,f.jE)();let[b,c]=(0,e.useState)([]),h=(0,e.useRef)(b);h.current=b;let i=(0,e.useCallback)(async({repoPath:a,branchRef:b,script:d})=>{let e=`temp-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,f={id:e,repoPath:a,branchRef:b,scriptName:d.name,scriptContent:d.content,status:"starting",output:"",error:null,startedAt:new Date().toISOString(),finishedAt:null,isCanceling:!1,isForceCanceling:!1,isModalOpen:!0};c(a=>[...a.map(a=>a.isModalOpen?{...a,isModalOpen:!1}:a),f]);try{let f=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"start",repoPath:a,branchRef:b,scriptContent:d.content})}),g=await f.json();if(!f.ok)throw Error(g.error||"Failed to start script execution");let h=[];return g.previousBranch&&g.checkedOutBranch&&g.previousBranch!==g.checkedOutBranch&&h.push(`[info] Checked out ${g.checkedOutBranch} (from ${g.previousBranch})`),c(a=>a.map(a=>a.id===e?{...a,id:g.executionId,output:[h.join("\n"),g.output].filter(Boolean).join("\n"),status:g.status,error:null}:a)),g.executionId}catch(b){let a=b.message||"Failed to start script";return c(b=>b.map(b=>b.id===e?{...b,status:"failed",error:a,output:b.output?`${b.output}
|
|
2
|
-
[error] ${a}`:`[error] ${a}`,finishedAt:new Date().toISOString()}:b)),e}},[]),j=(0,e.useCallback)(async(a,b)=>{if(h.current.find(b=>b.id===a)){c(c=>c.map(c=>c.id===a?{...c,isCanceling:!0,isForceCanceling:!!b||c.isForceCanceling}:c));try{let d=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"cancel",executionId:a,force:!!b})}),e=await d.json();if(!d.ok)throw Error(e.error||"Failed to cancel script");c(b=>b.map(b=>{if(b.id===a){let a=e.status;return{...b,output:e.output,status:a,isCanceling:"running"===a||"starting"===a,isForceCanceling:!1,finishedAt:e.finishedAt||b.finishedAt}}return b}))}catch(b){c(c=>c.map(c=>c.id===a?{...c,isCanceling:!1,isForceCanceling:!1,output:`${c.output}
|
|
3
|
-
[error] ${b.message}`}:c))}}},[]),k=(0,e.useCallback)(a=>{c(b=>b.map(b=>({...b,isModalOpen:b.id===a})))},[]),l=(0,e.useCallback)(()=>{c(a=>a.map(a=>a.isModalOpen?{...a,isModalOpen:!1}:a))},[]),m=(0,e.useCallback)(a=>{c(b=>b.filter(b=>b.id!==a))},[]),n=(0,e.useMemo)(()=>b.find(a=>a.isModalOpen)||null,[b]);return(0,d.jsx)(g.Provider,{value:{executions:b,activeModalExecution:n,startScript:i,cancelScript:j,openModal:k,minimizeModal:l,dismissExecution:m},children:a})}function i(){let a=(0,e.useContext)(g);if(!a)throw Error("useCustomScriptExecution must be used within a CustomScriptExecutionProvider");return a}},33748:(a,b,c)=>{"use strict";c.d(b,{ScriptModal:()=>i});var d=c(48249),e=c(67484),f=c(16772),g=c(14490);async function h(a){try{return await navigator.clipboard.writeText(a),!0}catch{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.left="-9999px",document.body.appendChild(b),b.select();try{return document.execCommand("copy"),!0}catch{return!1}finally{document.body.removeChild(b)}}}function i(){let{activeModalExecution:a,minimizeModal:b,cancelScript:c,dismissExecution:i}=(0,f.C)(),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),n=(0,e.useRef)(null),o=(0,e.useCallback)(async()=>{if(!a||l)return;m(!0);let b=await h(a.output);m(!1),k(b),b&&setTimeout(()=>k(!1),1500)},[a,l]);if(!a)return null;let p="starting"===a.status||"running"===a.status,q="completed"===a.status||"failed"===a.status||"canceled"===a.status;return(0,d.jsxs)("dialog",{className:"modal modal-open z-50",children:[(0,d.jsxs)("div",{className:"modal-box max-w-4xl max-h-[85vh] flex flex-col",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("h3",{className:"font-bold text-lg truncate",children:["Custom Script: ",a.scriptName]}),(0,d.jsxs)("p",{className:"text-xs opacity-70 mt-1 break-all",children:["Ref: ",a.branchRef]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,d.jsxs)("span",{className:(0,g.cn)("badge badge-sm shrink-0",p?"badge-info":"completed"===a.status?"badge-success":"failed"===a.status?"badge-error":"canceled"===a.status?"badge-warning":"badge-ghost"),children:[p&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs mr-1"}),a.status]}),(0,d.jsx)("button",{className:"btn btn-ghost btn-xs btn-circle",onClick:b,title:"Minimize to bottom-right corner","aria-label":"Minimize",children:(0,d.jsx)("i",{className:"iconoir-minus text-[16px]","aria-hidden":"true"})})]})]}),(0,d.jsx)("div",{className:"mt-4 border border-base-300 rounded bg-base-200/40 flex-1 overflow-hidden flex flex-col",children:(0,d.jsx)("pre",{ref:n,className:"p-3 font-mono text-xs overflow-auto max-h-[50vh] whitespace-pre-wrap break-words flex-1",children:a.output||"Waiting for output..."})}),a.error&&(0,d.jsx)("div",{className:"alert alert-error py-2 mt-3 text-xs",children:(0,d.jsx)("span",{children:a.error})}),(0,d.jsxs)("div",{className:"modal-action mt-4 flex items-center justify-between",children:[(0,d.jsxs)("button",{type:"button",className:"btn btn-ghost btn-sm gap-1.5",onClick:b,title:"Minimize dialog and keep running in bottom right",children:[(0,d.jsx)("i",{className:"iconoir-minus text-[14px]","aria-hidden":"true"}),"Dock / Minimize"]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[p&&(0,d.jsx)(d.Fragment,{children:a.isCanceling?(0,d.jsxs)("button",{type:"button",className:"btn btn-error btn-sm",onClick:()=>void c(a.id,!0),title:"Force terminate immediately",children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs mr-1"}),"Force Kill"]}):(0,d.jsx)("button",{type:"button",className:"btn btn-warning btn-sm",onClick:()=>void c(a.id,!1),children:"Cancel"})}),(0,d.jsxs)("button",{type:"button",className:"btn btn-outline btn-sm",onClick:()=>void o(),disabled:l,children:[l&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs mr-1"}),j?"Copied":"Copy"]}),q?(0,d.jsx)("button",{type:"button",className:"btn btn-primary btn-sm",onClick:()=>{i(a.id)},children:"Done"}):(0,d.jsx)("button",{type:"button",className:"btn btn-neutral btn-sm",onClick:b,children:"Hide"})]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{type:"button",onClick:a=>{a.preventDefault(),b()},children:"close"})})]})}},43246:(a,b,c)=>{"use strict";c.d(b,{WorkspaceRepoOpenTracker:()=>g});var d=c(67484),e=c(19099),f=c(54626);function g(){(0,e.usePathname)(),(0,e.useSearchParams)().get("path");let{data:a}=(0,f.uG)();return(0,f.Lp)(),(0,d.useRef)(null),null}},45229:(a,b,c)=>{"use strict";c.d(b,{Sidebar:()=>l});var d=c(48249),e=c(14490),f=c(2116),g=c.n(f),h=c(40781),i=c(19099),j=c(67484),k=c(54626);function l({className:a,initialCollapsed:b=!1}){let c=(0,i.usePathname)(),f=(0,i.useSearchParams)(),l=(0,i.useRouter)(),m=f.get("path")||"",n=(0,k.GK)(m||null),[o,p]=(0,j.useState)(b),[q,r]=(0,j.useState)(!1),[s,t]=(0,j.useState)(!1),u=(0,k.Y5)(),{data:v}=(0,k.en)(m||null),w=v?.conflicted?.length??0,x=v?.current?.trim(),y=n?(0,e.iu)(n):m?(0,e.kj)(m):"",z=(0,j.useCallback)(()=>{let a=!o;p(a),u.mutate({sidebarCollapsed:a})},[o,u]),A=(a="")=>{let b=new URLSearchParams(f.toString());return b.delete("tab"),m&&x?b.set("branch",x):m||b.delete("branch"),`/workspace${a}?${b.toString()}`},B=a=>"history"===a?"/workspace"===c||c.startsWith("/workspace/history"):"conflicts"===a?c.startsWith("/workspace/conflicts"):"custom-scripts"===a?c.startsWith("/workspace/custom-scripts"):"settings"===a?c.startsWith("/workspace/settings"):"stashes"===a&&c.startsWith("/workspace/stashes"),C=o?64:256;return(0,d.jsxs)("div",{style:{width:C},className:(0,e.cn)("pb-12 border-r border-base-300 min-h-screen bg-base-100 relative",q&&"transition-all duration-300",a),children:[(0,d.jsx)("div",{className:"space-y-4 py-4",children:(0,d.jsxs)("div",{className:(0,e.cn)("px-3 py-2",o&&"px-2"),children:[(0,d.jsxs)("div",{className:(0,e.cn)("mb-6 flex items-center",o?"flex-col gap-2 px-0":"justify-between px-4"),children:[!o&&(0,d.jsxs)("a",{href:"/",onClick:a=>{a.metaKey||a.ctrlKey||(a.preventDefault(),l.push("/"))},className:"flex items-center gap-2 hover:opacity-80 transition-opacity cursor-pointer text-base-content overflow-hidden",title:y?`${y} - Go to Home`:"Go to Home",children:[n?.icon?(0,d.jsx)("span",{className:"h-5 w-5 flex-shrink-0 flex items-center justify-center text-base leading-none","aria-hidden":"true",children:n.icon}):(0,d.jsx)("img",{src:"/icon.png",alt:"Trident",className:"h-5 w-5 flex-shrink-0"}),(0,d.jsx)("h2",{className:"text-lg font-bold tracking-tight truncate",children:y||"Trident"})]}),o&&(0,d.jsx)("a",{href:"/",onClick:a=>{a.metaKey||a.ctrlKey||(a.preventDefault(),l.push("/"))},className:"flex items-center justify-center h-8 w-8 hover:opacity-80 transition-opacity cursor-pointer",title:y?`${y} - Go to Home`:"Go to Home",children:n?.icon?(0,d.jsx)("span",{className:"h-5 w-5 flex items-center justify-center text-base leading-none","aria-hidden":"true",children:n.icon}):(0,d.jsx)("img",{src:"/icon.png",alt:y||"Trident",className:"h-5 w-5"})}),(0,d.jsx)("div",{className:(0,e.cn)("flex items-center gap-1",o&&"flex-col"),children:(0,d.jsx)("button",{className:"btn btn-ghost btn-sm btn-square",onClick:z,title:o?"Expand sidebar":"Collapse sidebar",children:o?(0,d.jsx)("i",{className:"iconoir-fast-arrow-right text-[16px]","aria-hidden":"true"}):(0,d.jsx)("i",{className:"iconoir-fast-arrow-left text-[16px]","aria-hidden":"true"})})})]}),!o&&m&&(0,d.jsx)("div",{className:"px-4 mb-6",children:(0,d.jsx)("p",{className:"text-[10px] font-mono opacity-60 break-all border border-base-300 rounded p-2 bg-base-200/30",title:m,children:m})}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsxs)(g(),{href:A(),className:(0,e.cn)("btn btn-ghost w-full justify-start font-normal",o?"px-0 justify-center":"",B("history")&&"btn-active font-medium"),title:o?"History":void 0,children:[(0,d.jsx)("i",{className:(0,e.cn)("iconoir-git-fork text-[20px]",!o&&"mr-2"),"aria-hidden":"true"}),!o&&"History"]}),(0,d.jsxs)(g(),{href:A("/conflicts"),className:(0,e.cn)("btn btn-ghost w-full justify-start font-normal",o?"px-0 justify-center":"",B("conflicts")&&"btn-active font-medium"),title:o?`Conflicts${w>0?` (${w})`:""}`:void 0,children:[(0,d.jsxs)("div",{className:(0,e.cn)("relative flex items-center",!o&&"mr-2"),children:[(0,d.jsx)("i",{className:"iconoir-warning-triangle text-[20px]","aria-hidden":"true"}),o&&w>0&&(0,d.jsx)("span",{className:"absolute -top-1 -right-1 badge badge-error badge-xs scale-75",children:w>99?"99+":w})]}),!o&&(0,d.jsxs)("span",{className:"flex-1 flex justify-between items-center",children:["Conflicts",w>0&&(0,d.jsx)("span",{className:"badge badge-sm badge-error",children:w})]})]}),(0,d.jsxs)(g(),{href:A("/stashes"),className:(0,e.cn)("btn btn-ghost w-full justify-start font-normal",o?"px-0 justify-center":"",B("stashes")&&"btn-active font-medium"),title:o?"Stashes":void 0,children:[(0,d.jsx)("i",{className:(0,e.cn)("iconoir-download-square text-[20px]",!o&&"mr-2"),"aria-hidden":"true"}),!o&&"Stashes"]}),(0,d.jsxs)(g(),{href:A("/custom-scripts"),className:(0,e.cn)("btn btn-ghost w-full justify-start font-normal",o?"px-0 justify-center":"",B("custom-scripts")&&"btn-active font-medium"),title:o?"Custom scripts":void 0,children:[(0,d.jsx)("i",{className:(0,e.cn)("iconoir-terminal text-[20px]",!o&&"mr-2"),"aria-hidden":"true"}),!o&&"Custom scripts"]}),(0,d.jsxs)(g(),{href:A("/settings"),className:(0,e.cn)("btn btn-ghost w-full justify-start font-normal",o?"px-0 justify-center":"",B("settings")&&"btn-active font-medium"),title:o?"Settings":void 0,children:[(0,d.jsx)("i",{className:(0,e.cn)("iconoir-settings text-[20px]",!o&&"mr-2"),"aria-hidden":"true"}),!o&&"Settings"]})]})]})}),(0,d.jsx)("div",{className:(0,e.cn)("absolute bottom-4 left-0 w-full",o?"px-2":"px-6"),children:(0,d.jsxs)("div",{className:(0,e.cn)("flex items-center",o?"justify-center":"gap-2"),children:[(0,d.jsx)("button",{className:"btn btn-ghost btn-sm btn-square",onClick:()=>t(!0),title:o?"Preferences":void 0,children:(0,d.jsx)("i",{className:"iconoir-ios-settings text-[20px]","aria-hidden":"true"})}),!o&&(0,d.jsx)("span",{className:"text-xs opacity-70",children:"Preferences"})]})}),(0,d.jsx)(h.g,{open:s,onOpenChange:t})]})}},49671:(a,b,c)=>{"use strict";c.d(b,{Sidebar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call Sidebar() from the server but Sidebar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/trident/trident/src/components/layout/sidebar.tsx","Sidebar")},54874:(a,b,c)=>{"use strict";c.d(b,{ScriptModal:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ScriptModal() from the server but ScriptModal is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/trident/trident/src/components/git/script-modal.tsx","ScriptModal")},56724:(a,b,c)=>{Promise.resolve().then(c.bind(c,76772)),Promise.resolve().then(c.bind(c,54874)),Promise.resolve().then(c.bind(c,49671)),Promise.resolve().then(c.bind(c,66920)),Promise.resolve().then(c.bind(c,84430))},58932:(a,b,c)=>{Promise.resolve().then(c.bind(c,82026)),Promise.resolve().then(c.bind(c,33748)),Promise.resolve().then(c.bind(c,45229)),Promise.resolve().then(c.bind(c,43246)),Promise.resolve().then(c.bind(c,16772))},64528:(a,b,c)=>{"use strict";c.d(b,{Ck:()=>n,Ir:()=>o,NV:()=>l,Xx:()=>s,cZ:()=>t,jD:()=>p,mt:()=>r});var d=c(29021),e=c.n(d),f=c(21820),g=c.n(f),h=c(33873),i=c.n(h);let j=(0,c(10).L)(),k=i().join(j,"repos.json");function l(){if(!e().existsSync(k))return[];try{let a=e().readFileSync(k,"utf-8");return JSON.parse(a)}catch(a){return console.error("Failed to parse repos.json",a),[]}}function m(a){if(void 0===a)return;if(null===a)return null;let b=a.trim();return b.length>0?b:null}function n(a,b,c){let d=l();if(d.find(b=>b.path===a))throw Error("Repository already exists");let f=m(c),g={path:a,name:b||i().basename(a),...f?{displayName:f}:{}};return d.push(g),e().writeFileSync(k,JSON.stringify(d,null,2)),g}function o(a,b){let c=l(),d=c.findIndex(b=>b.path===a);if(-1===d)throw Error("Repository not found");let f={...b};"displayName"in f&&(f.displayName=m(f.displayName)),"icon"in f&&(f.icon=function(a){if(void 0===a)return;if(null===a)return null;let b=a.trim();return b.length>0?b:null}(f.icon));let g={...c[d],...f};return c[d]=g,e().writeFileSync(k,JSON.stringify(c,null,2)),g}function p(a,b){let{deleteLocalFolder:c=!1}=b||{};if(c){let b=i().resolve(a),c=i().parse(b).root;if(b===c)throw Error("Refusing to delete a filesystem root path");e().rmSync(b,{recursive:!0,force:!0})}let d=l();d=d.filter(b=>b.path!==a),e().writeFileSync(k,JSON.stringify(d,null,2))}e().existsSync(j)||e().mkdirSync(j,{recursive:!0});let q=i().join(j,"settings.json");function r(){let a={defaultRootFolder:null,sidebarCollapsed:!1};if(!e().existsSync(q))return a;try{let b=e().readFileSync(q,"utf-8"),c=JSON.parse(b);return{...a,...c}}catch(b){return console.error("Failed to parse settings.json",b),a}}function s(a){let b={...r(),...a};return e().writeFileSync(q,JSON.stringify(b,null,2)),b}function t(){let a=r();if(a.defaultRootFolder)try{if(e().existsSync(a.defaultRootFolder)&&e().statSync(a.defaultRootFolder).isDirectory())return a.defaultRootFolder}catch{}return g().homedir()}},66920:(a,b,c)=>{"use strict";c.d(b,{WorkspaceRepoOpenTracker:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call WorkspaceRepoOpenTracker() from the server but WorkspaceRepoOpenTracker is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/trident/trident/src/components/workspace-repo-open-tracker.tsx","WorkspaceRepoOpenTracker")},76772:(a,b,c)=>{"use strict";c.d(b,{ScriptDock:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ScriptDock() from the server but ScriptDock is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/trident/trident/src/components/git/script-dock.tsx","ScriptDock")},82026:(a,b,c)=>{"use strict";c.d(b,{ScriptDock:()=>g});var d=c(48249);c(67484);var e=c(16772),f=c(14490);function g(){let{executions:a,openModal:b,cancelScript:c,dismissExecution:g}=(0,e.C)(),h=a.filter(a=>!a.isModalOpen);return 0===h.length?null:(0,d.jsx)("div",{className:"fixed bottom-4 right-4 z-40 flex flex-col gap-2 max-w-sm pointer-events-none",children:h.map(a=>{let e="starting"===a.status||"running"===a.status;return(0,d.jsxs)("div",{className:(0,f.cn)("pointer-events-auto bg-base-100 shadow-xl border rounded-lg p-3 w-84 text-xs transition-all flex flex-col gap-2",e?"border-primary/40 shadow-primary/5":"border-base-300"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"font-semibold truncate text-sm",title:a.scriptName,children:a.scriptName}),(0,d.jsx)("div",{className:"text-[11px] opacity-60 truncate mt-0.5",title:a.branchRef,children:a.branchRef})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,d.jsxs)("span",{className:(0,f.cn)("badge badge-xs font-medium",e?"badge-info animate-pulse":"completed"===a.status?"badge-success":"failed"===a.status?"badge-error":"canceled"===a.status?"badge-warning":"badge-ghost"),children:[e&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs mr-1 scale-75"}),a.status]}),!e&&(0,d.jsx)("button",{className:"btn btn-ghost btn-xs btn-circle text-base-content/60 hover:text-base-content",onClick:()=>g(a.id),title:"Dismiss","aria-label":"Dismiss",children:(0,d.jsx)("i",{className:"iconoir-xmark text-[14px]","aria-hidden":"true"})})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1 border-t border-base-200",children:[(0,d.jsxs)("button",{type:"button",className:"btn btn-ghost btn-xs gap-1 font-normal text-xs",onClick:()=>b(a.id),title:"View terminal logs",children:[(0,d.jsx)("i",{className:"iconoir-open-new-window text-[13px]","aria-hidden":"true"}),"View Logs"]}),(0,d.jsx)("div",{className:"flex items-center gap-1",children:e&&(0,d.jsx)(d.Fragment,{children:a.isCanceling?(0,d.jsxs)("button",{type:"button",className:"btn btn-error btn-xs",onClick:()=>void c(a.id,!0),title:"Force kill process immediately",children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs mr-1 scale-75"}),"Force Kill"]}):(0,d.jsxs)("button",{type:"button",className:"btn btn-warning btn-xs gap-1",onClick:()=>void c(a.id,!1),title:"Stop process",children:[(0,d.jsx)("i",{className:"iconoir-square text-[11px]","aria-hidden":"true"}),"Stop"]})})})]})]},a.id)})})}},84430:(a,b,c)=>{"use strict";c.d(b,{CustomScriptExecutionProvider:()=>e});var d=c(77943);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call CustomScriptExecutionProvider() from the server but CustomScriptExecutionProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/trident/trident/src/contexts/custom-script-execution-context.tsx","CustomScriptExecutionProvider");(0,d.registerClientReference)(function(){throw Error("Attempted to call useCustomScriptExecution() from the server but useCustomScriptExecution is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/trident/trident/src/contexts/custom-script-execution-context.tsx","useCustomScriptExecution")},84763:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>l});var d=c(5735),e=c(49671),f=c(91986),g=c(66920),h=c(64528),i=c(84430),j=c(76772),k=c(54874);function l({children:a}){let b=(0,h.mt)().sidebarCollapsed??!1;return(0,d.jsx)(i.CustomScriptExecutionProvider,{children:(0,d.jsxs)("div",{className:"flex min-h-screen max-h-screen bg-base-100",children:[(0,d.jsx)(f.Suspense,{fallback:null,children:(0,d.jsx)(g.WorkspaceRepoOpenTracker,{})}),(0,d.jsx)(f.Suspense,{fallback:(0,d.jsx)("div",{className:`${b?"w-16":"w-64"} border-r border-base-300 min-h-screen bg-base-200/30 flex items-center justify-center`,children:(0,d.jsx)("span",{className:"loading loading-spinner"})}),children:(0,d.jsx)(e.Sidebar,{initialCollapsed:b})}),(0,d.jsx)("main",{className:"flex-1 overflow-auto",children:a}),(0,d.jsx)(j.ScriptDock,{}),(0,d.jsx)(k.ScriptModal,{})]})})}}};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2944],{302:(e,a,t)=>{t.d(a,{v:()=>o});var s=t(2115);let l=[],n=0,r=!1;function i(e){let a,t=(a=l[l.length-1])||null;if(t){if("Escape"===e.key){e.preventDefault(),t.onEscape();return}"Enter"===e.key&&t.onEnter&&!function(e){if(e.defaultPrevented||e.repeat||e.isComposing||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return!0;let a=e.target;if(!a)return!1;if(a.isContentEditable)return!0;let t=a.tagName;return"TEXTAREA"===t||"BUTTON"===t||"SELECT"===t||"OPTION"===t||"A"===t}(e)&&(e.preventDefault(),t.onEnter())}}function o(e,a,t){let o=(0,s.useRef)(a),c=(0,s.useRef)(t);(0,s.useEffect)(()=>{o.current=a},[a]),(0,s.useEffect)(()=>{c.current=t},[t]),(0,s.useEffect)(()=>{if(!e)return;let a=++n;return l.push({id:a,onEscape:()=>o.current(),onEnter:()=>c.current?.()}),!r&&"u">typeof document&&(document.addEventListener("keydown",i),r=!0),()=>{let e=l.findIndex(e=>e.id===a);e>=0&&l.splice(e,1),r&&"u">typeof document&&!(l.length>0)&&(document.removeEventListener("keydown",i),r=!1)}},[e])}},2944:(e,a,t)=>{t.d(a,{u:()=>z});var s=t(5155),l=t(696),n=t(2115);function r(e){let a=0x811c9dc5;for(let t=0;t<e.length;t++)a^=e.charCodeAt(t),a=Math.imul(a,0x1000193);return a>>>0}var i=t(8599);function o({children:e,items:a,containerClassName:t="w-full"}){let[l,r]=(0,n.useState)(!1),[o,c]=(0,n.useState)({x:0,y:0}),d=(0,n.useRef)(null),h=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!l)return;let e=e=>{d.current&&!d.current.contains(e.target)&&h.current&&!h.current.contains(e.target)&&r(!1)},a=e=>{"Escape"===e.key&&r(!1)};return setTimeout(()=>{document.addEventListener("click",e),document.addEventListener("contextmenu",e),document.addEventListener("keydown",a)},0),()=>{document.removeEventListener("click",e),document.removeEventListener("contextmenu",e),document.removeEventListener("keydown",a)}},[l]),(0,n.useEffect)(()=>{if(!l||!d.current)return;let e=d.current;requestAnimationFrame(()=>{let t=document.createElement("div");t.style.position="absolute",t.style.visibility="hidden",t.style.whiteSpace="nowrap",t.style.pointerEvents="none";let s=window.getComputedStyle(e);t.style.fontSize=s.fontSize,t.style.fontFamily=s.fontFamily,t.style.fontWeight=s.fontWeight,t.style.padding="0.5rem 0.75rem",t.style.boxSizing="border-box",document.body.appendChild(t);let l=0;a.forEach(e=>{t.textContent=e.label;let a=t.getBoundingClientRect().width+20*!!e.icon+16*!!e.children?.length;a>l&&(l=a)}),document.body.removeChild(t);let n=Math.max(l+32,280);e.style.width=`${n}px`,e.style.minWidth=`${n}px`;let r=e.getBoundingClientRect(),i=window.innerWidth,c=window.innerHeight,d=o.x,h=o.y;r.right>i&&(d=i-r.width-10),d<10&&(d=10),r.bottom>c&&(h=c-r.height-10),h<10&&(h=10),(d!==o.x||h!==o.y)&&(e.style.left=`${d}px`,e.style.top=`${h}px`)})},[l,o,a]);let m=(e,a)=>{let t=!!e.children?.length;return(0,s.jsxs)("li",{className:(0,i.cn)(t&&"relative group/submenu"),children:[(0,s.jsxs)("a",{onClick:a=>{a.stopPropagation(),e.disabled||t||(e.onClick?.(),r(!1))},className:(0,i.cn)("flex items-center gap-2","whitespace-nowrap",e.danger&&"text-error",e.disabled&&"opacity-40 pointer-events-none",t&&"flex items-center justify-between gap-3"),children:[(0,s.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[e.icon&&(0,s.jsx)("span",{className:"inline-flex shrink-0 opacity-80",children:e.icon}),(0,s.jsx)("span",{children:e.labelNode??e.label})]}),t&&(0,s.jsx)("i",{className:"iconoir-nav-arrow-right text-[12px]","aria-hidden":"true"})]}),t&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"hidden group-hover/submenu:block absolute left-full top-0 h-full w-3"}),(0,s.jsx)("ul",{className:"hidden group-hover/submenu:block absolute left-[calc(100%-1px)] top-0 menu !m-0 p-2 shadow-lg bg-base-100 rounded-box border border-base-200 min-w-[220px] z-[10000] [&:before]:hidden",children:e.children.map((e,t)=>m(e,`${a}-${t}`))})]})]},a)};return(0,s.jsxs)("div",{ref:h,className:t,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),c({x:e.clientX,y:e.clientY}),r(!0)},children:[e,l&&(0,s.jsx)("ul",{ref:d,className:"fixed z-[9999] menu p-2 shadow-lg bg-base-100 rounded-box border border-base-200",style:{left:`${o.x}px`,top:`${o.y}px`},children:a.map((e,a)=>m(e,`menu-${a}`))})]})}function c({text:e,searchQuery:a}){if(!a||!e)return(0,s.jsx)(s.Fragment,{children:e});let t=a.toLowerCase(),l=e.toLowerCase(),n=[],r=0,i=l.indexOf(t);for(;-1!==i;)i>r&&n.push({text:e.slice(r,i),highlighted:!1}),n.push({text:e.slice(i,i+t.length),highlighted:!0}),r=i+t.length,i=l.indexOf(t,r);return(r<e.length&&n.push({text:e.slice(r),highlighted:!1}),0===n.length)?(0,s.jsx)(s.Fragment,{children:e}):(0,s.jsx)(s.Fragment,{children:n.map((e,a)=>e.highlighted?(0,s.jsx)("mark",{className:"bg-warning text-warning-content rounded-sm px-0.5",children:e.text},a):(0,s.jsx)("span",{children:e.text},a))})}let d=(0,n.forwardRef)(function({commits:e,onSelectCommit:a,onResetToCommit:t,onRevertCommit:l,onCreateTag:d,onCherryPickCommit:h,onCherryPickSelectedCommits:m,onRewordCommit:u,selectedHash:x,selectedHashes:p,onEndReached:b,isLoadingMore:f,currentBranch:g,hiddenBranches:j,localBranches:N=[],trackingInfo:y,getBranchTagContextMenuItems:v},k){let w=(0,n.useCallback)(e=>e.startsWith("refs/heads/")?e.slice(11):e.startsWith("refs/remotes/")?e.slice(13):e.startsWith("remotes/")?e.slice(8):e,[]),C=(0,n.useCallback)(e=>e.startsWith("tag:")?e.replace(/^tag:\s*/,"").trim():e,[]),S=(0,n.useMemo)(()=>(function(e,a={}){let t=[],s=new Set(a.localBranches??[]),l=[],n=[],i=[];function o(){for(let e=0;e<l.length;e++)if(null===l[e])return e;return l.length}function c(e){let a,t=i[e],s=t?(a=r(t),`hsl(${a%360} 82% 52%)`):n[e]??`hsl(${47*e%360} 78% 56%)`;return n[e]=s,s}return e.forEach((e,r)=>{var d;let h=[];for(let a=0;a<l.length;a++)l[a]===e.hash&&h.push(a);let m=h.length>0?h[0]:-1;for(-1===m&&(m=o());l.length<=m;)l.push(null),i.push(null),n.push(void 0);"__LOCAL_CHANGES__"===e.hash&&a.currentBranch&&(i[m]=a.currentBranch);let u=function(e,a){if(0===e.length)return null;let t=e.find(e=>a.has(e));return t||e[0]}((d=e.refs)?d.replace(/^\s*\((.*)\)\s*$/,"$1").split(",").map(e=>e.trim()).filter(Boolean).map(e=>e.replace(/^HEAD\s*->\s*/,"").trim()).map(e=>e.startsWith("refs/heads/")?e.slice(11):e.startsWith("refs/remotes/")?e.slice(13):e.startsWith("remotes/")?e.slice(8):e).filter(e=>!e.startsWith("tag:")).filter(e=>"HEAD"!==e).filter(e=>!/\/HEAD$/.test(e)):[],s);if(u){let e=function(e,a){let t,s;if(a.has(e))return e;let l=-1===(s=(t=e.startsWith("remotes/")?e.slice(8):e).indexOf("/"))?null:t.slice(s+1);return l&&a.has(l)?l:e}(u,s);(function(e,a,t){return!a||t.has(e)&&!t.has(a)})(e,i[m],s)&&(i[m]=e)}let x=c(m),p={...e,x:m,y:r,color:x,paths:[],isMerge:e.parents.length>1},b=h.filter(e=>e!==m),f=new Set(b);for(let e=0;e<l.length;e++)e===m||null===l[e]||f.has(e)||p.paths.push({x1:e,y1:r,x2:e,y2:r+1,color:c(e),type:"straight"});for(let e of(l[m]=null,b)){if(r>0){let a=t[t.length-1];a&&(a.paths=a.paths.filter(a=>"straight"!==a.type||a.x1!==e||a.y1!==r-1||a.x2!==e||a.y2!==r))}p.paths.push({x1:e,y1:r-1,x2:m,y2:r,color:c(e),type:"merge"}),l[e]=null,i[e]=null,n[e]=void 0}let g=e.parents;if(g.length>0){let e=g[0];l[m]=e,p.paths.push({x1:m,y1:r,x2:m,y2:r+1,color:x,type:"straight"});for(let e=1;e<g.length;e++){let a=g[e],t=l.indexOf(a);if(-1!==t)p.paths.push({x1:m,y1:r,x2:t,y2:r+1,color:c(t),type:"fork"});else{let e=o();for(;l.length<=e;)l.push(null),i.push(null),n.push(void 0);l[e]=a,p.paths.push({x1:m,y1:r,x2:e,y2:r+1,color:c(e),type:"fork"})}}}null===l[m]&&(i[m]=null,n[m]=void 0),t.push(p)}),t})(e,{localBranches:N,currentBranch:g}),[e,N,g]),E=(0,n.useRef)(null),R=(0,n.useRef)(null),[$,P]=(0,n.useState)(!1),[B,M]=(0,n.useState)("");(0,n.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"f"===e.key&&(e.preventDefault(),P(!0),setTimeout(()=>R.current?.focus(),0)),"Escape"===e.key&&$&&(P(!1),M(""))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[$]);let F=(0,n.useCallback)(()=>{P(!1),M("")},[]);if((0,n.useImperativeHandle)(k,()=>({scrollToCommit:e=>{if(!S||0===S.length)return!1;let a=S.findIndex(a=>a.hash===e);if(-1===a)return!1;if(E.current){let e=24*a-E.current.clientHeight/2+12;E.current.scrollTop=Math.max(0,e)}return!0}}),[S]),!S||0===S.length)return null;let A=(Math.max(...S.map(e=>e.x),0)+1)*12+20,L=24*S.length;return(0,s.jsxs)("div",{className:"flex flex-col h-full bg-base-100 overflow-hidden font-mono text-sm select-none",children:[$&&(0,s.jsxs)("div",{className:"sticky top-0 z-30 bg-base-100 border-b border-base-300 px-2 py-2 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"opacity-50",children:"\uD83D\uDD0D"}),(0,s.jsx)("input",{ref:R,type:"text",placeholder:"Search in commits...",value:B,onChange:e=>M(e.target.value),className:"input input-bordered input-sm flex-1 text-sm",autoFocus:!0}),(0,s.jsx)("div",{className:"tooltip tooltip-left z-50","data-tip":"Close search (Esc)",children:(0,s.jsx)("button",{onClick:F,className:"btn btn-ghost btn-sm btn-square",children:"✖️"})})]}),(0,s.jsx)("div",{className:"flex-1 overflow-auto h-full max-w-full px-2",onScroll:e=>{let{scrollTop:a,clientHeight:t,scrollHeight:s}=e.currentTarget;s-a-t<100&&b?.()},ref:E,children:(0,s.jsxs)("div",{className:"relative min-w-full",style:{height:L},children:[(0,s.jsxs)("svg",{width:A,height:L,className:"absolute top-0 left-0 pointer-events-none z-10",children:[S.map(e=>(0,s.jsx)("g",{children:e.paths.map((e,a)=>{let t=12*e.x1+6,l=24*e.y1+12,n=12*e.x2+6,r=24*e.y2+12,i="";if("straight"===e.type)i=`M ${t} ${l} L ${n} ${r}`;else{let e=l+12,a=r-12;i=`M ${t} ${l} C ${t} ${e}, ${n} ${a}, ${n} ${r}`}return(0,s.jsx)("path",{d:i,stroke:e.color,strokeWidth:2,fill:"none",strokeLinecap:"round"},a)})},e.hash)),S.map(e=>{let a="__LOCAL_CHANGES__"===e.hash;return(0,s.jsx)("circle",{cx:12*e.x+6,cy:24*e.y+12,r:3,fill:a?"var(--fallback-b1, oklch(var(--b1)))":e.color,stroke:e.color,strokeWidth:2,className:a?"fill-base-100":void 0},`dot-${e.hash}`)})]}),(0,s.jsxs)("div",{style:{width:"100%"},children:[S.map(e=>{let n="__LOCAL_CHANGES__"===e.hash,b=p?p.has(e.hash):x===e.hash,f=p?.size??+!!x,k=n?[]:[{label:"Reset to here",icon:(0,s.jsx)("i",{className:"iconoir-refresh-circle text-[14px]","aria-hidden":"true"}),onClick:()=>t?.(e.hash)}];if(!n&&l&&k.push({label:"Revert commit",icon:(0,s.jsx)("i",{className:"iconoir-u-turn-arrow-left text-[14px]","aria-hidden":"true"}),onClick:()=>l(e.hash,e.message)}),!n&&d&&k.push({label:"Create tag",icon:(0,s.jsx)("i",{className:"iconoir-bookmark text-[14px]","aria-hidden":"true"}),onClick:()=>d(e.hash)}),!n&&h&&k.push({label:"Cherry-pick commit",icon:(0,s.jsx)("i",{className:"iconoir-git-fork text-[14px]","aria-hidden":"true"}),onClick:()=>h(e.hash,e.message)}),!n&&m&&f>1&&b&&k.push({label:`Cherry-pick ${f} selected commits`,icon:(0,s.jsx)("i",{className:"iconoir-git-fork text-[14px]","aria-hidden":"true"}),onClick:m}),!n&&u&&N&&N.length>0){let a=e.refs?e.refs.replace(/[()]/g,"").split(",").map(e=>e.trim()):[],t=null;for(let e of a){let a=e.replace(/^HEAD\s*->\s*/,"");if(N.includes(a)&&(t=a,g&&a===g))break}t&&k.push({label:"Reword commit",icon:(0,s.jsx)("i",{className:"iconoir-edit-pencil text-[14px]","aria-hidden":"true"}),onClick:()=>u(e.hash,e.message,e.body??"",t)})}let S=(()=>{if(!e.refs||n)return[];let a=e.refs.replace(/^\s*\((.*)\)\s*$/,"$1").split(",").map(e=>{let a=e.startsWith("HEAD -> "),t=w(e.replace(/^HEAD\s*->\s*/,"").trim());return{raw:e,name:t,isHead:a}}),t=[],s=new Set,l=e=>j&&(j.has(e)||j.has(`remotes/${e}`));return a.forEach((e,n)=>{if(!s.has(n)&&N.includes(e.name)&&!l(e.name)){let l=y?.[e.name];if(l&&l.upstream){let r=w(l.upstream.trim()),i=new Set([r,w(`remotes/${r}`),w(`refs/remotes/${r}`)]),o=a.findIndex((e,a)=>a!==n&&!s.has(a)&&i.has(e.name));if(-1!==o){let l=a[o],i=r.split("/")[0];t.push({displayName:`${e.name} (${i})`,primaryRef:e.name,secondaryRef:l.name,isHead:e.isHead}),s.add(n),s.add(o);return}}}}),a.forEach((e,a)=>{!s.has(a)&&(l(e.name)||t.push({displayName:C(e.name),primaryRef:e.name,isHead:e.isHead}))}),t})(),E=(0,s.jsxs)("div",{className:(0,i.cn)("flex items-center hover:bg-base-200 border-b border-base-200 last:border-0 cursor-pointer transition-colors text-xs",b&&"bg-primary/10"),style:{height:24},onClick:t=>a?.(e.hash,{isMultiSelect:t.metaKey||t.ctrlKey,isRangeSelect:t.shiftKey}),children:[(0,s.jsx)("div",{style:{width:A,flexShrink:0}}),(0,s.jsxs)("div",{className:"flex flex-1 gap-4 overflow-hidden pr-4 items-center",children:[(0,s.jsxs)("div",{className:"flex-1 truncate flex items-center gap-2",children:[S.map((e,a)=>{let t=g&&(e.primaryRef===g||e.isHead&&e.primaryRef===g),l=e.primaryRef.startsWith("tag:")?{textColor:"#374151",backgroundColor:"#e5e7eb"}:function(e){let a,t,s,l,n,i,o,c,d,h=r(e),m=h%360,u=72+(h>>>9)%20,x=84+(h>>>17)%8,p=1.05/((d=function({r:e,g:a,b:t}){let s=e=>{let a=e/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)};return .2126*s(e)+.7152*s(a)+.0722*s(t)}((t=u/100*(1-Math.abs(2*(a=x/100)-1)),l=t*(1-Math.abs((s=m/60)%2-1)),n=0,i=0,o=0,s>=0&&s<1?(n=t,i=l):s>=1&&s<2?(n=l,i=t):s>=2&&s<3?(i=t,o=l):s>=3&&s<4?(i=l,o=t):s>=4&&s<5?(n=l,o=t):(n=t,o=l),{r:Math.round((n+(c=a-t/2))*255),g:Math.round((i+c)*255),b:Math.round((o+c)*255)})))+.05)>=(d+.05)/.05?"#ffffff":"#111827";return{backgroundColor:`hsl(${m} ${u}% ${x}%)`,textColor:p}}(e.primaryRef),n=(0,s.jsx)("span",{className:(0,i.cn)("text-[10px] px-1.5 rounded-full whitespace-nowrap shrink-0",t&&"font-bold"),style:{color:l.textColor,backgroundColor:l.backgroundColor},title:e.displayName,children:(0,s.jsx)(c,{text:e.displayName,searchQuery:B})}),d=v?.(e.primaryRef)||[];return 0===d.length?(0,s.jsx)("span",{className:"shrink-0",children:n},a):(0,s.jsx)(o,{items:d,containerClassName:"inline-flex shrink-0",children:n},a)}),(0,s.jsx)("span",{className:(0,i.cn)("truncate min-w-0 max-w-[600px]",n?"italic text-base-content/80":"",b?"font-semibold text-primary":""),title:e.message,children:(0,s.jsx)(c,{text:e.message,searchQuery:B})})]}),(0,s.jsx)("div",{className:"w-32 truncate opacity-70 text-right commit-author",children:n?null:(0,s.jsx)(c,{text:e.author_name,searchQuery:B})}),(0,s.jsx)("div",{className:"w-20 truncate opacity-50 font-mono text-right commit-hash",children:n?null:(0,s.jsx)(c,{text:e.hash.substring(0,7),searchQuery:B})}),(0,s.jsx)("div",{className:"w-32 truncate opacity-70 text-right",children:n?null:new Date(e.date).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]})]});return 0===k.length?(0,s.jsx)("div",{children:E},e.hash):(0,s.jsx)(o,{items:k,children:E},e.hash)}),f&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8 border-b border-base-300",children:[(0,s.jsx)("span",{className:"loading loading-spinner text-base-content/50"}),(0,s.jsx)("span",{className:"ml-2 text-sm opacity-70",children:"Loading more commits..."})]})]})]})})]})});var h=t(302),m=t(6695),u=t(460),x=t(6162),p=t(4254);function b({status:e}){switch(e){case"A":return(0,s.jsx)("i",{className:"iconoir-plus-circle text-[16px] text-success","aria-hidden":"true"});case"D":return(0,s.jsx)("i",{className:"iconoir-minus-circle text-[16px] text-error","aria-hidden":"true"});case"M":return(0,s.jsx)("i",{className:"iconoir-edit-pencil text-[16px] text-warning","aria-hidden":"true"});default:return(0,s.jsx)("i",{className:"iconoir-page text-[16px] opacity-50","aria-hidden":"true"})}}function f({node:e,selectedFile:a,expandedFolders:t,onToggleFolder:l,onSelectFile:n,depth:r=0}){let o=Array.from(e.children.values()).sort((e,a)=>{let t=e.children.size>0,s=a.children.size>0;return t&&!s?-1:!t&&s?1:e.name.localeCompare(a.name)});return(0,s.jsx)(s.Fragment,{children:o.map(e=>{if(e.children.size>0){let i=t.has(e.path);return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1.5 text-xs rounded cursor-pointer hover:bg-base-200 transition-colors opacity-80",style:{paddingLeft:`${12*r+8}px`},onClick:()=>l(e.path),title:e.path,children:[(0,s.jsx)("span",{className:"text-[10px] opacity-70",children:i?"▼":"▶"}),(0,s.jsx)("i",{className:"iconoir-folder text-[14px] opacity-70","aria-hidden":"true"}),(0,s.jsx)("span",{className:"truncate flex-1",children:e.name})]}),i&&(0,s.jsx)(f,{node:e,selectedFile:a,expandedFolders:t,onToggleFolder:l,onSelectFile:n,depth:r+1})]},e.path)}if(!e.file)return null;let o=e.file;return(0,s.jsxs)("div",{className:(0,i.cn)("flex items-center gap-2 px-2 py-1.5 text-xs rounded cursor-pointer hover:bg-base-200 transition-colors",a===o.path&&"bg-base-200 font-medium"),style:{paddingLeft:`${12*r+8}px`},onClick:()=>n(o.path),title:o.path,children:[(0,s.jsx)(b,{status:o.status}),(0,s.jsx)("span",{className:"truncate flex-1 font-mono",children:e.name})]},e.path)})})}function g({repoPath:e,commitHash:a,fromCommitHash:t,toCommitHash:r,filePath:o,splitView:c}){let{data:d,isLoading:h}=(0,l.st)(e,o,{commitHash:a,fromCommitHash:t,toCommitHash:r}),{resolvedTheme:m}=(0,u.D)(),b=`${a??""}:${t??""}:${r??""}:${o}`,[f,g]=(0,n.useState)(null),j=f===b,N=(0,n.useRef)(null);if((0,n.useEffect)(()=>{let e=requestAnimationFrame(()=>{N.current?.scrollTo({top:0,left:0})});return()=>cancelAnimationFrame(e)},[o,a,t,r,h]),h)return(0,s.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,s.jsx)("span",{className:"loading loading-spinner text-base-content/50"})});if(!d)return(0,s.jsx)("div",{className:"flex items-center justify-center p-8 opacity-50",children:"No diff available"});if((0,i.u)(o))return(0,s.jsx)(p.K,{filePath:o,imageDiff:d.imageDiff});if((0,i.kO)(o,d.left,d.right))return(0,s.jsx)("div",{className:"flex items-center justify-center p-8 opacity-50",children:"Binary file - diff not available"});let y=d.diff||"",v=y.length,k=(0,i.tq)(y);return(v>102400||k>3e3)&&!j?(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center p-8",children:[(0,s.jsx)("i",{className:"iconoir-warning-triangle text-[32px] text-warning","aria-hidden":"true"}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Large Diff Detected"}),(0,s.jsxs)("p",{className:"opacity-70",children:["This diff is large (",Math.round(v/1024),"KB, ~",k," changed lines) and may freeze your browser if rendered."]})]}),(0,s.jsx)("button",{className:"btn btn-outline",onClick:()=>g(b),children:"Show Diff Anyway"})]}):(0,s.jsx)("div",{ref:N,className:"overflow-auto h-full",children:(0,s.jsx)(x.O,{oldValue:d.left||"",newValue:d.right||"",splitView:c,useDarkTheme:"dark"===m})})}function j({repoPath:e,commitHash:a=null,fromCommitHash:t=null,toCommitHash:r=null}){let o=!!t&&!!r,c=o?`${t}..${r}`:a??"none",{data:d,isLoading:m}=(0,l.gg)(e,{commitHash:a,fromCommitHash:t,toCommitHash:r}),[u,x]=(0,n.useState)({}),[p,b]=(0,n.useState)(!1),[j,N]=(0,n.useState)({}),y=(0,n.useMemo)(()=>(function(e){let a={name:"",path:"",children:new Map};for(let t of e){let e=t.path.split("/").filter(Boolean),s=a,l="";for(let a=0;a<e.length;a++){let n=e[a];l=l?`${l}/${n}`:n,s.children.has(n)||s.children.set(n,{name:n,path:l,children:new Map}),s=s.children.get(n),a===e.length-1&&(s.file=t)}}return a})(d?.files??[]),[d?.files]),v=(0,n.useMemo)(()=>(function e(a){let t=[];return Array.from(a.children.values()).forEach(a=>{a.children.size>0&&(t.push(a.path),t.push(...e(a)))}),t})(y),[y]),k=(0,n.useMemo)(()=>j[c]??new Set,[j,c]),w="git-web:diff-view-split",[C,S]=(0,n.useState)(()=>{try{let e=localStorage.getItem(w);return null===e||JSON.parse(e)}catch(e){return console.error("Failed to load split view preference:",e),!0}}),E=(0,n.useRef)(null),R=(0,n.useMemo)(()=>{let e=d?.files??[];if(0===e.length)return null;let a=u[c]??null;return a&&e.some(e=>e.path===a)?a:e[0].path},[d?.files,u,c]),$=(0,n.useCallback)(e=>{x(a=>(a[c]??null)===e?a:{...a,[c]:e})},[c]);(0,n.useEffect)(()=>{try{localStorage.setItem(w,JSON.stringify(C))}catch(e){console.error("Failed to save split view preference:",e)}},[C]),(0,n.useEffect)(()=>{if(!R)return;let e=requestAnimationFrame(()=>{E.current?.scrollTo({top:0,left:0})});return()=>cancelAnimationFrame(e)},[R,c]),(0,h.v)(p,()=>b(!1)),(0,n.useEffect)(()=>{if(!p)return;let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[p]);let P=(0,n.useMemo)(()=>{let e=new Set;return v.forEach(a=>{k.has(a)||e.add(a)}),R&&(function(e){let a=e.split("/").filter(Boolean),t=[];for(let e=1;e<a.length;e++)t.push(a.slice(0,e).join("/"));return t})(R).forEach(a=>e.add(a)),e},[v,k,R]),B=(0,n.useCallback)(e=>{N(a=>{let t=new Set(a[c]??new Set);return t.has(e)?t.delete(e):t.add(e),{...a,[c]:t}})},[c]);return m?(0,s.jsx)("div",{className:"flex items-center justify-center p-8 h-full",children:(0,s.jsx)("span",{className:"loading loading-spinner text-base-content/50"})}):d&&0!==d.files.length?(0,s.jsxs)("div",{className:(0,i.cn)("flex h-full",p&&"fixed inset-0 z-[80] h-auto bg-base-100 shadow-2xl"),children:[(0,s.jsxs)("div",{className:"w-64 border-r border-base-300 flex flex-col bg-base-200/30 shrink-0",children:[(0,s.jsxs)("div",{className:"px-3 py-2 text-xs font-bold opacity-70 border-b border-base-300 bg-base-100",children:[d.files.length," file",1!==d.files.length?"s":""," changed"]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:(0,s.jsx)("div",{className:"p-1",children:(0,s.jsx)(f,{node:y,selectedFile:R,expandedFolders:P,onToggleFolder:B,onSelectFile:$})})})]}),(0,s.jsx)("div",{className:"flex-1 overflow-hidden",children:R?(0,s.jsxs)("div",{className:"h-full flex flex-col",children:[(0,s.jsxs)("div",{className:"px-4 py-2 text-xs font-mono opacity-70 border-b border-base-300 bg-base-100 shrink-0 truncate flex items-center justify-between",children:[(0,s.jsx)("span",{className:"truncate",children:R}),(0,s.jsxs)("div",{className:"flex items-center gap-2 shrink-0 ml-4",children:[(0,s.jsx)("label",{htmlFor:"commit-diff-split-view",className:"text-[10px] uppercase tracking-wider font-bold cursor-pointer opacity-70",children:"Split View"}),(0,s.jsx)("input",{type:"checkbox",id:"commit-diff-split-view",checked:C,onChange:e=>S(e.target.checked),className:"toggle toggle-xs toggle-primary"}),(0,s.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs btn-square",onClick:()=>b(e=>!e),"aria-label":p?"Exit full-page diff view":"Expand diff viewer to full page",title:p?"Exit full-page diff view":"Expand diff viewer to full page",children:(0,s.jsx)("i",{className:(0,i.cn)(p?"iconoir-collapse":"iconoir-maximize","text-[14px]"),"aria-hidden":"true"})})]})]}),(0,s.jsx)("div",{ref:E,className:"flex-1 overflow-auto diff-viewer-wrapper",children:(0,s.jsx)(g,{repoPath:e,commitHash:a,fromCommitHash:t,toCommitHash:r,filePath:R,splitView:C},`${c}:${R}`)})]}):(0,s.jsx)("div",{className:"flex items-center justify-center h-full opacity-70 text-sm",children:"Select a file to view changes"})})]}):(0,s.jsx)("div",{className:"flex items-center justify-center p-8 h-full opacity-50",children:o?"No changes in selected commit range":"No changes in this commit"})}function N({repoPath:e,filePath:a}){let{data:t,isLoading:r}=(0,l.xV)(e,a),o=(0,n.useRef)(null),c="git-web:diff-view-split",[d,h]=(0,n.useState)(()=>{try{let e=localStorage.getItem(c);return null===e||JSON.parse(e)}catch(e){return console.error("Failed to load split view preference:",e),!0}}),[m,b]=(0,n.useState)(null),f=m===a,{resolvedTheme:g}=(0,u.D)();if((0,n.useEffect)(()=>{try{localStorage.setItem(c,JSON.stringify(d))}catch(e){console.error("Failed to save split view preference:",e)}},[d]),(0,n.useEffect)(()=>{if(r)return;let e=requestAnimationFrame(()=>{o.current?.scrollTo({top:0,left:0})});return()=>cancelAnimationFrame(e)},[a,r]),r)return(0,s.jsx)("div",{className:"flex items-center justify-center p-8 h-full",children:(0,s.jsx)("span",{className:"loading loading-spinner text-base-content/50"})});if(!t)return(0,s.jsx)("div",{className:"flex items-center justify-center h-full opacity-50",children:"No diff available"});if((0,i.u)(a))return(0,s.jsxs)("div",{className:"flex flex-col h-full bg-base-100",children:[(0,s.jsx)("div",{className:"flex items-center justify-between px-4 h-[57px] border-b border-base-300 shrink-0 bg-base-100",children:(0,s.jsx)("span",{className:"text-sm font-mono truncate max-w-[70%]",title:a,children:a})}),(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:(0,s.jsx)(p.K,{filePath:a,imageDiff:t.imageDiff})})]});if((0,i.kO)(a,t.left,t.right))return(0,s.jsxs)("div",{className:"flex flex-col h-full bg-base-100",children:[(0,s.jsx)("div",{className:"flex items-center justify-between px-4 h-[57px] border-b border-base-300 shrink-0 bg-base-100",children:(0,s.jsx)("span",{className:"text-sm font-mono truncate max-w-[70%]",title:a,children:a})}),(0,s.jsx)("div",{className:"flex-1 flex items-center justify-center opacity-50",children:"Binary file - diff not available"})]});let j=t.diff||"",N=j.length,y=(0,i.tq)(j),v=N>102400||y>3e3;return(0,s.jsxs)("div",{className:"flex flex-col h-full bg-base-100",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 h-[57px] border-b border-base-300 shrink-0 bg-base-100",children:[(0,s.jsx)("span",{className:"text-sm font-mono truncate max-w-[70%]",title:a,children:a}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("label",{htmlFor:"split-view",className:"text-[10px] uppercase tracking-wider font-bold cursor-pointer opacity-70",children:"Split View"}),(0,s.jsx)("input",{type:"checkbox",id:"split-view",checked:d,onChange:e=>h(e.target.checked),className:"toggle toggle-sm toggle-primary"})]})]}),(0,s.jsx)("div",{ref:o,className:"flex-1 overflow-auto diff-viewer-wrapper",children:v&&!f?(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center p-4",children:[(0,s.jsx)("i",{className:"iconoir-warning-triangle text-[40px] text-warning","aria-hidden":"true"}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Large Diff Detected"}),(0,s.jsxs)("p",{className:"opacity-70",children:["This diff is large (",Math.round(N/1024),"KB, ~",y," changed lines) and may freeze your browser if rendered."]})]}),(0,s.jsx)("button",{className:"btn btn-outline",onClick:()=>b(a),children:"Show Diff Anyway"})]}):(0,s.jsx)(x.O,{oldValue:t.left||"",newValue:t.right||"",splitView:d,useDarkTheme:"dark"===g})})]})}let y=[];function v(e,a){let t=e.trim(),s=a.replace(/\r\n/g,"\n");return s.trim()?`${t}
|
|
2
|
-
|
|
3
|
-
${s}`:t}function k(e){let a={name:"",path:"",children:new Map};for(let t of e){let e=t.split("/").filter(Boolean),s=a,l="";for(let a=0;a<e.length;a++){let n=e[a];l=l?`${l}/${n}`:n,s.children.has(n)||s.children.set(n,{name:n,path:l,children:new Map}),s=s.children.get(n),a===e.length-1&&(s.filePath=t)}}return a}function w(e){let a=[];return Array.from(e.children.values()).forEach(e=>{e.children.size>0&&(a.push(e.path),a.push(...w(e)))}),a}function C(e){let a=e.split("/").filter(Boolean),t=[];for(let e=1;e<a.length;e++)t.push(a.slice(0,e).join("/"));return t}function S({node:e,selectedFile:a,expandedFolders:t,onToggleFolder:l,onSelectFile:n,onActionFile:r,actionType:o,actionPending:c,depth:d=0}){let h=Array.from(e.children.values()).sort((e,a)=>{let t=e.children.size>0,s=a.children.size>0;return t&&!s?-1:!t&&s?1:e.name.localeCompare(a.name)});return(0,s.jsx)(s.Fragment,{children:h.map(e=>{if(e.children.size>0){let i=t.has(e.path);return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1.5 text-xs rounded cursor-pointer hover:bg-base-300 transition-colors opacity-80",style:{paddingLeft:`${12*d+8}px`},onClick:()=>l(e.path),title:e.path,children:[(0,s.jsx)("span",{className:"text-[10px] opacity-70",children:i?"▼":"▶"}),(0,s.jsx)("i",{className:"iconoir-folder text-[14px] opacity-70","aria-hidden":"true"}),(0,s.jsx)("span",{className:"truncate flex-1",children:e.name})]}),i&&(0,s.jsx)(S,{node:e,selectedFile:a,expandedFolders:t,onToggleFolder:l,onSelectFile:n,onActionFile:r,actionType:o,actionPending:c,depth:d+1})]},e.path)}let h=e.filePath;return h?(0,s.jsxs)("div",{className:(0,i.cn)("flex items-center justify-between gap-2 px-2 py-1.5 rounded-md cursor-pointer group hover:bg-base-300 transition-colors text-sm",a===h&&"bg-base-300 font-medium text-primary"),style:{paddingLeft:`${12*d+8}px`},onClick:()=>n(h),title:h,children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,s.jsx)("i",{className:"iconoir-page text-[14px] opacity-70 shrink-0","aria-hidden":"true"}),(0,s.jsx)("span",{className:"truncate flex-1 font-mono text-xs",children:e.name})]}),(0,s.jsx)("button",{className:(0,i.cn)("btn btn-ghost btn-xs btn-square opacity-0 group-hover:opacity-100 transition-opacity","stage"===o?"text-success hover:bg-success/10":"text-error hover:bg-error/10"),onClick:e=>{e.stopPropagation(),r(h)},disabled:c,children:(0,s.jsx)("i",{className:(0,i.cn)("text-[14px]","stage"===o?"iconoir-plus-circle":"iconoir-minus-circle"),"aria-hidden":"true"})})]},h):null})})}function E({repoPath:e,onClose:a}){let{data:t,isLoading:r,isError:o,error:c,refetch:d}=(0,l.en)(e),{data:m}=(0,l._6)(e),u=(0,l.a3)(),[x,p]=(0,n.useState)(""),[b,f]=(0,n.useState)(""),[g,j]=(0,n.useState)(null),[E,R]=(0,n.useState)(!1),[$,P]=(0,n.useState)(""),[B,M]=(0,n.useState)(!1),[F,A]=(0,n.useState)(!1),[L,D]=(0,n.useState)("main"),[T,_]=(0,n.useState)(new Set),[O,H]=(0,n.useState)(new Set),[I,K]=(0,n.useState)(180),[z,q]=(0,n.useState)(!1),W=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=e=>{if(!z||!W.current)return;let a=W.current.startY-e.clientY;K(Math.max(120,Math.min(600,W.current.startHeight+a)))},a=()=>{q(!1),W.current=null,document.body.style.cursor="default",document.body.style.userSelect="auto"};return z&&(window.addEventListener("mousemove",e),window.addEventListener("mouseup",a),document.body.style.cursor="ns-resize",document.body.style.userSelect="none"),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",a),document.body.style.cursor="default",document.body.style.userSelect="auto"}},[z]);let G=t?.files??y,U=!!m&&0===m.branches.length,{staged:V,changes:Y}=(0,n.useMemo)(()=>{let e=[],a=[];return G.forEach(t=>{" "!==t.index&&"?"!==t.index&&e.push(t.path),(" "!==t.working_dir||"?"===t.index)&&a.push(t.path)}),{staged:e,changes:a}},[G]),J=(0,n.useMemo)(()=>k(Y),[Y]),Q=(0,n.useMemo)(()=>k(V),[V]),X=(0,n.useMemo)(()=>w(J),[J]),Z=(0,n.useMemo)(()=>w(Q),[Q]),ee=(0,n.useMemo)(()=>{let e=new Set;return X.forEach(a=>{T.has(a)||e.add(a)}),g&&C(g).forEach(a=>e.add(a)),e},[X,T,g]),ea=(0,n.useMemo)(()=>{let e=new Set;return Z.forEach(a=>{O.has(a)||e.add(a)}),g&&C(g).forEach(a=>e.add(a)),e},[Z,O,g]),et=(0,n.useCallback)(e=>{_(a=>{let t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),es=(0,n.useCallback)(e=>{H(a=>{let t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),el=async a=>{await u.mutateAsync({repoPath:e,action:"stage",data:{files:[a]}})},en=async a=>{await u.mutateAsync({repoPath:e,action:"unstage",data:{files:[a]}})},er=async()=>{await u.mutateAsync({repoPath:e,action:"stage",data:{files:["."]}})},ei=async()=>{await u.mutateAsync({repoPath:e,action:"unstage",data:{files:V}})},eo=async()=>{await u.mutateAsync({repoPath:e,action:"stash",data:{message:$||void 0}}),R(!1),P(""),j(null)},ec=async()=>{await u.mutateAsync({repoPath:e,action:"discard",data:{includeUntracked:!0}}),M(!1),j(null)},ed=async()=>{let a=x.trim();if(a){if(U)return void A(!0);await u.mutateAsync({repoPath:e,action:"commit",data:{message:v(a,b)}}),p(""),f(""),j(null)}},eh=async()=>{let a=x.trim(),t=L.trim();a&&t&&(await u.mutateAsync({repoPath:e,action:"commit",data:{message:v(a,b),initialBranch:t}}),p(""),f(""),j(null),A(!1))};(0,h.v)(E,()=>R(!1),()=>{u.isPending||eo()}),(0,h.v)(B,()=>M(!1),()=>{u.isPending||ec()}),(0,h.v)(F,()=>A(!1),()=>{!u.isPending&&L.trim()&&eh()});let em=e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),V.length>0&&x.trim()&&!u.isPending&&ed())};return r?(0,s.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,s.jsx)("span",{className:"loading loading-spinner text-base-content/50"})}):o?(0,s.jsxs)("div",{className:"flex items-center justify-center h-64 flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-error font-bold",children:"Error Loading Status"}),(0,s.jsx)("p",{className:"text-sm opacity-70",children:c?.message||"An unknown error occurred"}),(0,s.jsxs)("button",{onClick:()=>d(),className:"btn btn-outline btn-sm",children:[(0,s.jsx)("i",{className:"iconoir-refresh-circle text-[16px] mr-1","aria-hidden":"true"}),"Try Again"]})]}):t?(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-hidden bg-base-100",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-base-300 bg-base-100 shrink-0",children:[(0,s.jsx)("div",{className:"flex items-center gap-3 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"font-bold text-sm",children:"Local Changes"}),G.length>0&&(0,s.jsx)("span",{className:"badge badge-sm badge-ghost text-xs",children:V.length>0?`${V.length} staged, ${Y.length} unstaged`:`${Y.length} changes`}),m?.current&&(0,s.jsxs)("span",{className:"text-xs opacity-60 truncate",children:["on ",(0,s.jsx)("span",{className:"font-mono font-semibold",children:m.current})]})]})}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,s.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:()=>d(),disabled:u.isPending,title:"Refresh status",children:u.isPending?(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,s.jsx)("i",{className:"iconoir-refresh-circle text-[14px]","aria-hidden":"true"})}),a&&(0,s.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:a,title:"Close",children:"✕"})]})]}),(0,s.jsxs)("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[(0,s.jsx)("div",{className:"w-64 border-r border-base-300 flex flex-col bg-base-200/30 shrink-0",children:(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,s.jsxs)("div",{className:"p-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 mb-1",children:[(0,s.jsxs)("h3",{className:"text-xs font-bold uppercase tracking-wider opacity-70",children:["Changes (",Y.length,")"]}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[0===Y.length&&V.length>0?(0,s.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:ei,title:"Unstage All",children:(0,s.jsx)("i",{className:"iconoir-arrow-up text-[14px]","aria-hidden":"true"})}):(0,s.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:er,disabled:0===Y.length,title:"Stage All",children:(0,s.jsx)("i",{className:"iconoir-arrow-down text-[14px]","aria-hidden":"true"})}),(0,s.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:()=>R(!0),disabled:0===Y.length&&0===V.length,title:"Stash",children:(0,s.jsx)("i",{className:"iconoir-download-square text-[14px]","aria-hidden":"true"})}),(0,s.jsx)("button",{className:"btn btn-ghost btn-xs btn-square text-error hover:bg-error/10",onClick:()=>M(!0),disabled:0===Y.length,title:"Discard All",children:(0,s.jsx)("i",{className:"iconoir-trash text-[14px]","aria-hidden":"true"})})]})]}),(0,s.jsxs)("div",{className:"space-y-0.5",children:[0===Y.length&&(0,s.jsx)("p",{className:"px-2 py-1 text-xs opacity-50 italic",children:"No unstaged changes"}),Y.length>0&&(0,s.jsx)(S,{node:J,selectedFile:g,expandedFolders:ee,onToggleFolder:et,onSelectFile:j,onActionFile:el,actionType:"stage",actionPending:u.isPending})]})]}),(0,s.jsx)("div",{className:"h-px bg-base-300 mx-3 my-1"}),(0,s.jsxs)("div",{className:"p-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 mb-1",children:[(0,s.jsxs)("h3",{className:"text-xs font-bold uppercase tracking-wider opacity-70",children:["Staged (",V.length,")"]}),V.length>0&&(0,s.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:ei,title:"Unstage All",children:(0,s.jsx)("i",{className:"iconoir-arrow-up text-[14px]","aria-hidden":"true"})})]}),(0,s.jsxs)("div",{className:"space-y-0.5",children:[0===V.length&&(0,s.jsx)("p",{className:"px-2 py-1 text-xs opacity-50 italic",children:"No staged changes"}),V.length>0&&(0,s.jsx)(S,{node:Q,selectedFile:g,expandedFolders:ea,onToggleFolder:es,onSelectFile:j,onActionFile:en,actionType:"unstage",actionPending:u.isPending})]})]})]})}),(0,s.jsxs)("div",{className:"flex-1 flex flex-col bg-base-100 overflow-hidden min-h-0",children:[(0,s.jsx)("div",{className:"flex-1 overflow-hidden flex flex-col min-h-0",children:g?(0,s.jsx)("div",{className:"h-full flex flex-col",children:(0,s.jsx)(N,{repoPath:e,filePath:g})}):(0,s.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center opacity-50 p-4",children:[(0,s.jsx)("i",{className:"iconoir-page-flip text-[32px] mb-2 opacity-60","aria-hidden":"true"}),(0,s.jsx)("p",{className:"text-xs font-semibold",children:"Select a file to view changes"})]})}),(0,s.jsx)("div",{className:"h-1.5 cursor-ns-resize flex items-center justify-center hover:bg-base-200 transition-colors group shrink-0 border-t border-base-300",onMouseDown:e=>{e.preventDefault(),q(!0),W.current={startY:e.clientY,startHeight:I}},children:(0,s.jsx)("div",{className:"w-8 h-1 rounded-full bg-base-300 group-hover:bg-base-400 transition-colors"})}),(0,s.jsx)("div",{className:"flex flex-col border-t border-base-300 bg-base-100 shrink-0",style:{height:I},children:(0,s.jsxs)("div",{className:"flex-1 p-3 overflow-y-auto flex flex-col gap-2",children:[(0,s.jsx)("input",{type:"text",placeholder:"Commit subject...",value:x,onChange:e=>p(e.target.value),onKeyDown:em,className:"input input-bordered input-sm w-full text-sm font-sans shrink-0"}),(0,s.jsx)("textarea",{placeholder:"Commit message body (optional)...",value:b,onChange:e=>f(e.target.value),onKeyDown:em,className:"textarea textarea-bordered textarea-sm w-full text-sm resize-none font-sans flex-1 min-h-[48px]"}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 shrink-0 pt-0.5",children:[(0,s.jsxs)("span",{className:"text-[11px] opacity-40",children:[(0,s.jsx)("kbd",{className:"kbd kbd-xs",children:"⌘"}),"+",(0,s.jsx)("kbd",{className:"kbd kbd-xs",children:"Enter"})," to commit"]}),(0,s.jsxs)("button",{className:"btn btn-primary btn-sm",onClick:ed,disabled:0===V.length||!x.trim()||u.isPending,children:[u.isPending?(0,s.jsx)("span",{className:"loading loading-spinner loading-xs mr-1"}):(0,s.jsx)("i",{className:"iconoir-check text-[14px] mr-1","aria-hidden":"true"}),"Commit Changes"]})]})]})})]})]}),E&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Stash Changes"}),(0,s.jsx)("p",{className:"py-4 opacity-70",children:"Save your local modifications to a new stash entry."}),(0,s.jsx)("div",{className:"py-2",children:(0,s.jsx)("input",{type:"text",placeholder:"Stash message (optional)",value:$,onChange:e=>P(e.target.value),autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),eo())},className:"input input-bordered w-full"})}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>R(!1),children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:eo,disabled:u.isPending,children:[u.isPending&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Stash"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>R(!1),children:"close"})})]}),B&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Discard Changes"}),(0,s.jsx)("p",{className:"py-4",children:"Are you sure you want to discard all unstaged changes and new files? This action cannot be undone."}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>M(!1),children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-error",onClick:ec,disabled:u.isPending,children:[u.isPending&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Discard"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>M(!1),children:"close"})})]}),F&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"First Commit Branch"}),(0,s.jsx)("p",{className:"py-4 opacity-70",children:"This repository has no commits yet. Choose the branch name for the first commit."}),(0,s.jsx)("div",{className:"py-2",children:(0,s.jsx)("input",{type:"text",placeholder:"Branch name",value:L,onChange:e=>D((0,i.L9)(e.target.value)),autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),eh())},className:"input input-bordered w-full"})}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>A(!1),children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:eh,disabled:!L.trim()||u.isPending,children:[u.isPending&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Commit to Branch"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>A(!1),children:"close"})})]})]}):(0,s.jsx)("div",{className:"flex items-center justify-center h-64 opacity-70",children:"No status data available"})}function R(e,a=""){let t={name:"",children:new Map};for(let s of e){let e=s.split("/"),l=t;for(let t=0;t<e.length;t++){let n=e[t];l.children.has(n)||l.children.set(n,{name:n,children:new Map}),l=l.children.get(n),t===e.length-1&&(l.fullPath=a?`${a}/${s}`:s)}}return t}function $(e,a,t){if(a[e])return a[e];let s=e.split("/");for(let e=s.length-1;e>0;e--){let t=s.slice(0,e).join("/");if(a[t])return a[t]}if(t){let e=t.split("/");for(let t=e.length;t>0;t--){let s=e.slice(0,t).join("/");if(a[s])return a[s]}}return null}function P(e){return Array.from(e.children.values()).sort((e,a)=>{let t=e.children.size>0&&!e.fullPath,s=a.children.size>0&&!a.fullPath;return t&&!s?-1:!t&&s?1:e.name.localeCompare(a.name)})}function B(e,a,t=""){let s=[];for(let l of P(e)){if(void 0!==l.fullPath){s.push(l.fullPath);continue}let e=t?`${t}/${l.name}`:l.name;a.has(e)&&s.push(...B(l,a,e))}return s}function M(e){let a=[];for(let t of P(e)){if(t.fullPath){a.push(t.fullPath);continue}a.push(...M(t))}return a}function F({type:e,isActive:a,isInherited:t,onClick:l,showOnHover:n}){return(0,s.jsx)("button",{className:(0,i.cn)("p-0.5 rounded hover:bg-base-300 transition-colors shrink-0 cursor-pointer text-xs",a&&"bg-primary/10",t&&"opacity-50",!a&&!n&&"opacity-0 group-hover:opacity-100"),onClick:l,title:"visible"===e?a?"Remove visible filter":"Show only this branch":a?"Remove hide filter":"Hide this branch",children:"visible"===e?(0,s.jsx)("i",{className:"iconoir-eye text-[14px]","aria-hidden":"true"}):(0,s.jsx)("i",{className:"iconoir-eye-closed text-[14px]","aria-hidden":"true"})})}function A({name:e,groupPath:a,icon:t,isExpanded:l,onToggle:n,visibilityMap:r,onToggleVisibility:o,depth:c=0}){let d=r[a],h=a.includes("/")?a.split("/").slice(0,-1).join("/"):void 0,m=h?r[h]:null,u=d||m,x=!d&&null!==m;return(0,s.jsxs)("div",{className:(0,i.cn)("group flex items-center gap-1 px-2 py-1.5 text-sm rounded-md cursor-pointer hover:bg-base-200 transition-colors font-medium"),style:{paddingLeft:`${12*c+8}px`},children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",onClick:n,children:[(0,s.jsx)("span",{className:"text-xs opacity-70",children:l?"▼":"▶"}),(0,s.jsx)("span",{className:"shrink-0",children:t}),(0,s.jsx)("span",{className:"truncate min-w-0 flex-1",children:e})]}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,s.jsx)(F,{type:"visible",isActive:"visible"===d||x&&"visible"===u,isInherited:x&&"visible"===u,onClick:e=>{e.stopPropagation(),o(a,"visible")},showOnHover:"visible"===d||x&&"visible"===u}),(0,s.jsx)(F,{type:"hidden",isActive:"hidden"===d||x&&"hidden"===u,isInherited:x&&"hidden"===u,onClick:e=>{e.stopPropagation(),o(a,"hidden")},showOnHover:"hidden"===d||x&&"hidden"===u})]})]})}function L({node:e,currentBranch:a,expandedFolders:t,onToggleFolder:l,onCheckout:n,onCheckoutToLocal:r,onCreateBranch:c,onDeleteBranch:d,onRenameBranch:h,onRenameRemoteBranch:m,onRebase:u,onMerge:x,onPushToRemote:p,onPullFromRemote:b,getBranchContextMenuItems:f,onBranchClick:g,onBranchContextMenu:j,onDeleteBranchGroup:N,selectedBranches:y,visibilityMap:v,onToggleVisibility:k,parentPath:w="",depth:C=0,groupPath:S,isRemote:E=!1,trackingInfo:R}){let P=Array.from(e.children.values()).sort((e,a)=>{let t=e.children.size>0&&!e.fullPath,s=a.children.size>0&&!a.fullPath;return t&&!s?-1:!t&&s?1:e.name.localeCompare(a.name)});return(0,s.jsx)(s.Fragment,{children:P.map(e=>{let P=void 0!==e.fullPath,B=e.children.size>0&&!P,A=e.fullPath||(w?`${w}/${e.name}`:e.name),D=t.has(A),T=P&&e.fullPath===a,_=v[A],O=$(A,v,S),H=!_&&null!==O;if(B){let w=M(e).filter(e=>e!==a);return(0,s.jsxs)("div",{children:[(0,s.jsx)(o,{items:[{label:"Delete",icon:(0,s.jsx)("i",{className:"iconoir-trash text-[14px]","aria-hidden":"true"}),onClick:()=>N(w),danger:!0,disabled:0===w.length}],children:(0,s.jsxs)("div",{className:(0,i.cn)("group flex items-center gap-1 px-2 py-1.5 text-sm rounded-md cursor-pointer hover:bg-base-200 transition-colors opacity-70 select-none"),style:{paddingLeft:`${12*C+8}px`},children:[(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-1 min-w-0",onClick:()=>l(A),children:[(0,s.jsx)("span",{className:"text-xs opacity-70",children:D?"▼":"▶"}),(0,s.jsx)("i",{className:"iconoir-folder text-[16px] shrink-0","aria-hidden":"true"}),(0,s.jsx)("span",{className:"truncate min-w-0 flex-1",children:e.name})]}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,s.jsx)(F,{type:"visible",isActive:"visible"===_||H&&"visible"===O,isInherited:H&&"visible"===O,onClick:e=>{e.stopPropagation(),k(A,"visible")},showOnHover:"visible"===_||H&&"visible"===O}),(0,s.jsx)(F,{type:"hidden",isActive:"hidden"===_||H&&"hidden"===O,isInherited:H&&"hidden"===O,onClick:e=>{e.stopPropagation(),k(A,"hidden")},showOnHover:"hidden"===_||H&&"hidden"===O})]})]})}),D&&(0,s.jsx)(L,{node:e,currentBranch:a,expandedFolders:t,onToggleFolder:l,onCheckout:n,onCheckoutToLocal:r,onCreateBranch:c,onDeleteBranch:d,onRenameBranch:h,onRenameRemoteBranch:m,onRebase:u,onMerge:x,onPushToRemote:p,onPullFromRemote:b,getBranchContextMenuItems:f,onBranchClick:g,onBranchContextMenu:j,onDeleteBranchGroup:N,selectedBranches:y,visibilityMap:v,onToggleVisibility:k,parentPath:A,depth:C+1,groupPath:S,isRemote:E,trackingInfo:R})]},A)}let I=!E&&e.fullPath?R?.[e.fullPath]:void 0,K=I&&(I.ahead>0||I.behind>0),z=f({branchRef:e.fullPath,branchLeafName:e.name,currentBranch:a,isRemote:E,selectedBranchRefs:y.has(e.fullPath)?Array.from(y):[e.fullPath]}),q=y.has(e.fullPath);return(0,s.jsx)(o,{items:z,children:(0,s.jsxs)("div",{className:(0,i.cn)("group flex items-center gap-2 px-2 py-1.5 text-sm rounded-md cursor-pointer transition-colors select-none",!q&&"hover:bg-base-200",q&&"bg-primary/10 hover:bg-primary/20",T&&"bg-base-200 font-medium text-primary"),style:{paddingLeft:`${12*C+8}px`},onContextMenu:()=>j?.(e.fullPath),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",onClick:a=>g?.(e.fullPath,{isMultiSelect:a.metaKey||a.ctrlKey,isRangeSelect:a.shiftKey}),onDoubleClick:()=>!T&&n(e.fullPath),children:[T?(0,s.jsx)("span",{className:"w-3 h-3 flex items-center justify-center shrink-0",children:(0,s.jsx)("span",{className:"w-2 h-2 rounded-full bg-primary"})}):E?(0,s.jsx)("i",{className:"iconoir-globe text-[14px] opacity-50 shrink-0","aria-hidden":"true"}):(0,s.jsx)("i",{className:"iconoir-git-branch text-[14px] opacity-50 shrink-0","aria-hidden":"true"}),(0,s.jsx)("span",{className:"truncate min-w-0 flex-1",title:e.fullPath,children:e.name}),K&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-xs opacity-70 shrink-0",title:`${I.ahead} ahead, ${I.behind} behind ${I.upstream}`,children:[I.ahead>0&&(0,s.jsxs)("span",{className:"flex items-center gap-0.5 text-xs",children:[(0,s.jsx)("i",{className:"iconoir-arrow-up text-[12px]","aria-hidden":"true"}),(0,s.jsx)("span",{children:I.ahead})]}),I.behind>0&&(0,s.jsxs)("span",{className:"flex items-center gap-0.5 text-xs",children:[(0,s.jsx)("i",{className:"iconoir-arrow-down text-[12px]","aria-hidden":"true"}),(0,s.jsx)("span",{children:I.behind})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,s.jsx)(F,{type:"visible",isActive:"visible"===_||H&&"visible"===O,isInherited:H&&"visible"===O,onClick:e=>{e.stopPropagation(),k(A,"visible")},showOnHover:"visible"===_||H&&"visible"===O}),(0,s.jsx)(F,{type:"hidden",isActive:"hidden"===_||H&&"hidden"===O,isInherited:H&&"hidden"===O,onClick:e=>{e.stopPropagation(),k(A,"hidden")},showOnHover:"hidden"===_||H&&"hidden"===O})]})]})},e.fullPath)})})}var D=t(3321),T=t(8500),_=t.n(T),O=t(3278);function H(e){return Math.min(Math.max(e,100),900)}function I(e){return Math.min(Math.max(e,.15),.75)}function K(e){let a=e.indexOf("/");return a<=0||a>=e.length-1?null:{remote:e.slice(0,a),branch:e.slice(a+1)}}function z({repoPath:e}){let{data:a}=(0,l.t0)(),t=(0,l.Y5)(),r=(0,D.useRouter)(),c=(0,D.useSearchParams)(),u=(c.get("branch")??"").trim(),x=(0,n.useRef)(null),p=(0,n.useRef)(null),[b,f]=(0,n.useState)(100),{data:g,isLoading:N,isError:y,error:v,refetch:k,isFetching:w}=(0,l._X)(e,b),{data:C,isLoading:S,refetch:P}=(0,l._6)(e),F=C?.current?.trim()??"",{data:T,refetch:z}=(0,l.en)(e),q=!!(T?.files&&T.files.length>0),[W,G]=(0,n.useState)(null),[U,V]=(0,n.useState)([]),[Y,J]=(0,n.useState)(null),Q=(0,n.useRef)(0),X=(0,n.useCallback)(()=>{let e=Date.now();e-Q.current<500||(Q.current=e,Promise.all([P(),k(),z()]))},[P,k,z]);(0,n.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&X()},a=()=>{"visible"===document.visibilityState&&X()};return document.addEventListener("visibilitychange",e),window.addEventListener("focus",a),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("focus",a)}},[X]);let Z=(0,n.useCallback)(e=>{G(e),V(e?[e]:[]),J(e)},[]);(0,n.useEffect)(()=>{Z(null),sF([]),sL(null)},[e,Z]),(0,n.useEffect)(()=>{q||"__LOCAL_CHANGES__"!==W||Z(null)},[q,W,Z]);let{mutateAsync:ee}=(0,l.a3)(),ea=(0,n.useCallback)(()=>{let e=new URLSearchParams(c.toString()).toString();r.push(e?`/workspace/conflicts?${e}`:"/workspace/conflicts")},[r,c]),et=(0,n.useCallback)(e=>{if(!(e instanceof Error))return!1;let a=e.message.toLowerCase();return a.includes("conflict")||a.includes("could not apply")||a.includes("fix conflicts")||a.includes("resolve all conflicts")||a.includes("merge --continue")||a.includes("rebase --continue")},[]);(0,n.useEffect)(()=>{x.current=null,p.current=null},[e]),(0,n.useEffect)(()=>{if(!u||!C)return;let a=`${e}:${u}`;if(x.current!==a){if(C.current===u){x.current=a;return}if(!C.branches.includes(u)){x.current=a,(0,m.oR)({type:"error",title:"Branch Not Found",description:`Branch "${u}" does not exist in this repository.`});return}x.current=a,(async()=>{try{await ee({repoPath:e,action:"checkout",data:{branch:u}})}catch(e){console.error(e)}})()}},[C,e,u,ee]);let[es,el]=(0,n.useState)(!1),[en,er]=(0,n.useState)(""),[ei,eo]=(0,n.useState)(null),[ec,ed]=(0,n.useState)(!1),[eh,em]=(0,n.useState)(!1),[eu,ex]=(0,n.useState)(null),[ep,eb]=(0,n.useState)(""),[ef,eg]=(0,n.useState)(!1),[ej,eN]=(0,n.useState)(!1),[ey,ev]=(0,n.useState)(!1),[ek,ew]=(0,n.useState)([]),[eC,eS]=(0,n.useState)(!1),[eE,eR]=(0,n.useState)(!1),[e$,eP]=(0,n.useState)(!1),[eB,eM]=(0,n.useState)(null),[eF,eA]=(0,n.useState)(!1),[eL,eD]=(0,n.useState)(!1),[eT,e_]=(0,n.useState)(null),[eO,eH]=(0,n.useState)(!1),[eI,eK]=(0,n.useState)(!1),[ez,eq]=(0,n.useState)(!1),[eW,eG]=(0,n.useState)([]),[eU,eV]=(0,n.useState)(!1),[eY,eJ]=(0,n.useState)(!1),[eQ,eX]=(0,n.useState)(!1),[eZ,e0]=(0,n.useState)(!1),[e1,e2]=(0,n.useState)(null),[e4,e3]=(0,n.useState)(null),[e5,e7]=(0,n.useState)(""),[e6,e8]=(0,n.useState)(!1),[e9,ae]=(0,n.useState)(!1),[aa,at]=(0,n.useState)(!1),[as,al]=(0,n.useState)(null),[an,ar]=(0,n.useState)(""),[ai,ao]=(0,n.useState)(!1),[ac,ad]=(0,n.useState)(!1),[ah,am]=(0,n.useState)(null),[au,ax]=(0,n.useState)(!1),[ap,ab]=(0,n.useState)(!1),[af,ag]=(0,n.useState)("origin"),[aj,aN]=(0,n.useState)(""),[ay,av]=(0,n.useState)(!1),[ak,aw]=(0,n.useState)(!1),[aC,aS]=(0,n.useState)(null),[aE,aR]=(0,n.useState)(null),[a$,aP]=(0,n.useState)(!0),[aB,aM]=(0,n.useState)(!1),[aF,aA]=(0,n.useState)("checking"),aL=(0,n.useCallback)(()=>{aw(!1),aS(null),aR(null),aA("checking")},[]),[aD,aT]=(0,n.useState)(!1),[a_,aO]=(0,n.useState)(null),[aH,aI]=(0,n.useState)(null),[aK,az]=(0,n.useState)(!1),[aq,aW]=(0,n.useState)(!1),[aG,aU]=(0,n.useState)(!1),[aV,aY]=(0,n.useState)(""),[aJ,aQ]=(0,n.useState)(!1),[aX,aZ]=(0,n.useState)("checking"),a0=(0,n.useCallback)(()=>{aT(!1),aO(null),aI(null),aZ("checking")},[]),[a1,a2]=(0,n.useState)(!1),[a4,a3]=(0,n.useState)(null),[a5,a7]=(0,n.useState)([]),[a6,a8]=(0,n.useState)(""),[a9,te]=(0,n.useState)([]),[ta,tt]=(0,n.useState)(""),[ts,tl]=(0,n.useState)(null),[tn,tr]=(0,n.useState)(!1),[ti,to]=(0,n.useState)(!1),[tc,td]=(0,n.useState)(!0),[th,tm]=(0,n.useState)(!1),[tu,tx]=(0,n.useState)(""),[tp,tb]=(0,n.useState)(!1),[tf,tg]=(0,n.useState)(null),[tj,tN]=(0,n.useState)(!1),[ty,tv]=(0,n.useState)(!1),[tk,tw]=(0,n.useState)(!1),[tC,tS]=(0,n.useState)(null),[tE,tR]=(0,n.useState)([]),[t$,tP]=(0,n.useState)(""),[tB,tM]=(0,n.useState)([]),[tF,tA]=(0,n.useState)(""),[tL,tD]=(0,n.useState)(null),[tT,t_]=(0,n.useState)(!0),[tO,tH]=(0,n.useState)(!1),[tI,tK]=(0,n.useState)(!1),[tz,tq]=(0,n.useState)(null),[tW,tG]=(0,n.useState)(!1),[tU,tV]=(0,n.useState)(!1),[tY,tJ]=(0,n.useState)(!1),[tQ,tX]=(0,n.useState)(!1),[tZ,t0]=(0,n.useState)(!1),[t1,t2]=(0,n.useState)(!1),[t4,t3]=(0,n.useState)(null),[t5,t7]=(0,n.useState)(""),[t6,t8]=(0,n.useState)(!1),[t9,se]=(0,n.useState)(!1),[sa,st]=(0,n.useState)(null),[ss,sl]=(0,n.useState)("stash-and-reapply"),[sn,sr]=(0,n.useState)(!1),[si,so]=(0,n.useState)(!1),[sc,sd]=(0,n.useState)(null),[sh,sm]=(0,n.useState)(!1),[su,sx]=(0,n.useState)(!1),[sp,sb]=(0,n.useState)(null),[sf,sg]=(0,n.useState)(!1),[sj,sN]=(0,n.useState)(!1),[sy,sv]=(0,n.useState)(null),[sk,sw]=(0,n.useState)(""),[sC,sS]=(0,n.useState)(""),[sE,sR]=(0,n.useState)(!1),s$=(0,n.useRef)(null),[sP,sB]=(0,n.useState)(null),[sM,sF]=(0,n.useState)([]),[sA,sL]=(0,n.useState)(null),[sD,sT]=(0,n.useState)(!1),s_=(0,n.useRef)(null),{startScript:sO}=(0,O.C)(),[sH,sI]=(0,n.useState)(!1),sK=(0,n.useRef)(null),sz=(0,n.useCallback)(()=>{e0(!1),e2(null),e3(null),e7(""),e8(!1)},[]),sq=(0,n.useCallback)(()=>{at(!1),al(null),ar("")},[]),sW=(0,n.useCallback)(()=>{ad(!1),am(null)},[]),sG=(0,n.useCallback)(()=>{ab(!1),ag("origin"),aN("")},[]),sU=(0,n.useCallback)(()=>{sN(!1),sv(null),sw(""),sS("")},[]),sV=(0,n.useCallback)(()=>{if(t9){sn||(se(!1),st(null));return}if(eY){eJ(!1),eG([]);return}if(t1)return void t2(!1);if(es){el(!1),eo(null);return}if(eh){em(!1),ex(null),eb(""),eg(!1);return}if(tk)return void tw(!1);if(a1)return void a2(!1);if(aD)return void a0();if(ak)return void aL();if(eZ)return void sz();if(aa)return void sq();if(ac)return void sW();if(ap)return void sG();if(ez){eq(!1),eG([]);return}if(ey){ev(!1),ew([]),eS(!1);return}if(e$){eP(!1),eM(null);return}if(eL){eD(!1),e_(null),eH(!1);return}if(sj)return void sU();if(si)return void so(!1);if(su){sx(!1),sb(null);return}sD?sT(!1):sH&&sI(!1)},[eY,t1,es,eh,tk,a1,a0,aD,aL,ak,eZ,sz,aa,sq,ac,sW,ap,sG,ez,ey,e$,eL,sj,sU,si,su,sD,sH,t9,sn]),sY=si||su||sj||ey||e$||eL||eY||ez||eZ||aa||ac||ap||ak||aD||a1||tk||es||eh||t1||t9||sD||sH;(0,h.v)(sY,sV,()=>{if(t9){sn||nf();return}if(eY){eQ||nE();return}if(t1){t5&&!t6&&nd();return}if(es){en&&!ec&&nR();return}if(eh){ep.trim()&&!ej&&nP();return}if(tk){!tO&&tE.length>0&&t$&&tF&&ni();return}if(a1){!tp&&a5.length>0&&a6&&ta&&nl();return}if(aD){aJ||ne();return}if(ak){aB||l6();return}if(eZ){let e=e4?e5===e4.branch:e5===e1;!e5||e||e9||l2();return}if(aa){let e=an.trim();e&&e!==(as??"").trim()&&!ai&&l4();return}if(ac){ah&&!au&&l3();return}if(ap){af.trim()&&aj.trim()&&!ay&&l5();return}if(ez){eU||nS();return}if(ey){eE||lQ();return}if(e$){eB&&!eF&&lZ();return}if(eL){eT&&!eI&&lX();return}if(sj){sk.trim()&&!sE&&ny();return}if(si){sh||nj();return}if(su){sf||nN();return}});let sJ="git-web:history-panel-height",sQ="git-web:history-commit-details-message-ratio",[sX,sZ]=(0,n.useState)(300),[s0,s1]=(0,n.useState)(!1),s2=(0,n.useRef)(null),[s4,s3]=(0,n.useState)(.28),[s5,s7]=(0,n.useState)(!1),s6=(0,n.useRef)(null),s8=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(a?.historyPanelHeight)sZ(H(a.historyPanelHeight));else try{let e=localStorage.getItem(sJ);if(e){let a=parseInt(e,10);!isNaN(a)&&a>=100&&a<=900&&sZ(a)}}catch(e){console.error("Failed to load panel height from localStorage:",e)}},[a?.historyPanelHeight]),(0,n.useEffect)(()=>{try{localStorage.setItem(sJ,String(sX))}catch(e){console.error("Failed to save panel height to localStorage:",e)}},[sX]),(0,n.useEffect)(()=>{try{let e=localStorage.getItem(sQ);if(!e)return;let a=parseFloat(e);Number.isNaN(a)||s3(I(a))}catch(e){console.error("Failed to load commit details ratio from localStorage:",e)}},[]),(0,n.useEffect)(()=>{try{localStorage.setItem(sQ,String(s4))}catch(e){console.error("Failed to save commit details ratio to localStorage:",e)}},[s4]),(0,n.useEffect)(()=>{!s0&&s8.current&&(t.mutate({historyPanelHeight:sX}),s8.current=!1)},[s0,sX,t]);let s9=(0,n.useCallback)(e=>{e.preventDefault(),s1(!0),s2.current={startY:e.clientY,startHeight:sX}},[sX]);(0,n.useEffect)(()=>{if(!s0)return;let e=e=>{if(!s2.current)return;let a=s2.current.startY-e.clientY;sZ(H(s2.current.startHeight+a)),s8.current=!0},a=()=>{s1(!1),s2.current=null};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",a)}},[s0]);let le=(0,n.useCallback)(e=>{e.preventDefault(),s7(!0)},[]);(0,n.useEffect)(()=>{if(!s5)return;let e=e=>{let a=s6.current;if(!a)return;let t=a.getBoundingClientRect();t.height<=0||s3(I((e.clientY-t.top)/t.height))},a=()=>{s7(!1)};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",a),document.body.style.cursor="ns-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",a),document.body.style.cursor="",document.body.style.userSelect=""}},[s5]),(0,n.useEffect)(()=>{if(!sD)return;let e=e=>{s_.current&&!s_.current.contains(e.target)&&sT(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[sD]),(0,n.useEffect)(()=>{if(!sH)return;let e=e=>{sK.current&&!sK.current.contains(e.target)&&sI(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[sH]);let la=(0,n.useMemo)(()=>C?.branches?R(C.branches):null,[C?.branches]),lt=(0,n.useMemo)(()=>{if(!C?.remotes)return null;var e=C.remotes;let a=new Map;for(let[t,s]of Object.entries(e))a.set(t,R(s,`remotes/${t}`));return a},[C?.remotes]),ls=(0,n.useMemo)(()=>{let e=new Set;for(let a of C?.branches??[])e.add(a);for(let[a,t]of Object.entries(C?.remotes??{}))for(let s of t)e.add(`remotes/${a}/${s}`);return e},[C?.branches,C?.remotes]),ll=(0,n.useMemo)(()=>new Set(sM),[sM]),ln=(0,l.GK)(e),lr=(0,l.Lp)(),li=(0,n.useMemo)(()=>(ln?.customScripts??[]).filter(e=>"branch"===e.target&&"run-bash-script"===e.action&&e.name.trim().length>0&&e.content.trim().length>0),[ln?.customScripts]),[lo,lc]=(0,n.useState)(!0),[ld,lh]=(0,n.useState)(!0),[lm,lu]=(0,n.useState)(!0),[lx,lp]=(0,n.useState)({}),[lb,lf]=(0,n.useState)(new Set),lg=(0,n.useMemo)(()=>{let e=[];if(lo&&la&&e.push(...B(la,lb)),ld&<)for(let[a,t]of Array.from(lt.entries())){let s=`__remotes__/${a}`;lb.has(s)&&e.push(...B(t,lb,`remotes/${a}`))}return e},[lb,la,lo,lt,ld]);(0,n.useEffect)(()=>{if(0===sM.length)return;let e=sM.filter(e=>ls.has(e));e.length!==sM.length&&sF(e),sA&&!ls.has(sA)&&sL(e.length>0?e[e.length-1]:null)},[ls,sA,sM]);let lj=(0,n.useRef)(null);(0,n.useEffect)(()=>{ln&&ln.path!==lj.current&&(lj.current=ln.path,void 0!==ln.localGroupExpanded&&lc(ln.localGroupExpanded),void 0!==ln.remotesGroupExpanded&&lh(ln.remotesGroupExpanded),void 0!==ln.worktreesGroupExpanded&&lu(ln.worktreesGroupExpanded),ln.expandedFolders&&lf(new Set(ln.expandedFolders)),ln.visibilityMap&&lp(ln.visibilityMap))},[ln]);let lN=(0,n.useCallback)(a=>{lr.mutate({path:e,updates:a})},[e,lr]),ly=(0,n.useCallback)(()=>{let e=!lo;lc(e),lN({localGroupExpanded:e})},[lo,lN]),lv=(0,n.useCallback)(()=>{let e=!ld;lh(e),lN({remotesGroupExpanded:e})},[ld,lN]),lk=(0,n.useCallback)(()=>{let e=!lm;lu(e),lN({worktreesGroupExpanded:e})},[lN,lm]),lw=(0,n.useCallback)(e=>{lf(a=>{let t=new Set(a);return t.has(e)?t.delete(e):t.add(e),lN({expandedFolders:Array.from(t)}),t})},[lN]),lC=(0,n.useCallback)((e,a)=>{lp(t=>{let s={...t};s[e]===a?delete s[e]:s[e]=a;let l={};return Object.entries(s).forEach(([e,a])=>{("visible"===a||"hidden"===a)&&(l[e]=a)}),lN({visibilityMap:l}),s})},[lN]),lS=(0,n.useCallback)(()=>{lp({}),lN({visibilityMap:{}})},[lN]),lE=(0,n.useCallback)((e,a)=>{let t=$(e,lx);if(t)return t;if(a){let a=e.split("/");if(a.length>=2&&"remotes"===a[0]){let e=a[1],t=lx[`__remotes__/${e}`];if(t)return t;let s=lx.__remotes__;if(s)return s}}else{let e=lx.__local__;if(e)return e}return null},[lx]),lR=(0,n.useMemo)(()=>{if(!g?.all||!C?.branches||!C?.branchCommits)return g?.all||[];let e=Object.values(lx).some(e=>"visible"===e),a=Object.values(lx).some(e=>"hidden"===e);if(!e&&!a)return g.all;let t=[...C.branches.map(e=>({branch:e,isRemote:!1}))];if(C.remotes)for(let[e,a]of Object.entries(C.remotes))for(let s of a)t.push({branch:`remotes/${e}/${s}`,isRemote:!0});let s=new Set,l=new Set,n=new Set;for(let{branch:e,isRemote:a}of t){let t=lE(e,a);"visible"===t?s.add(e):"hidden"===t?l.add(e):n.add(e)}let r=new Map(g.all.map(e=>[e.hash,e])),i=(e,a)=>{let t=[e];for(;t.length>0;){let e=t.pop();if(a.has(e))continue;let s=r.get(e);if(s)for(let l of(a.add(e),s.parents||[]))a.has(l)||t.push(l)}},o=new Set;for(let e of s){let a=C.branchCommits[e];a&&i(a,o)}if(e)return g.all.filter(e=>o.has(e.hash));if(a){let e=new Set;for(let a of n){let t=C.branchCommits[a];t&&i(t,e)}return g.all.filter(a=>e.has(a.hash))}return g.all},[g?.all,C?.branches,C?.branchCommits,C?.remotes,lx,lE]),l$=C?.current?.trim()||T?.current?.trim()||"",lP=(0,n.useMemo)(()=>l$&&C?.branchCommits?.[l$]?C.branchCommits[l$]:g?.all&&g.all.length>0?g.all[0].hash:null,[l$,C?.branchCommits,g?.all]),lB=(0,n.useMemo)(()=>q?[{hash:"__LOCAL_CHANGES__",message:"(local changes)",date:new Date().toISOString(),refs:"",body:"",author_name:"",author_email:"",parents:lP?[lP]:[]},...lR]:lR,[q,lR,lP]),lM=(0,n.useMemo)(()=>new Set(U),[U]),lF=(0,n.useMemo)(()=>lB.map(e=>e.hash),[lB]),lA=(0,n.useMemo)(()=>W&&"__LOCAL_CHANGES__"!==W?g?.all.find(e=>e.hash===W):null,[g?.all,W]),lL=(0,n.useMemo)(()=>{if(lA&&lA.hash&&"__LOCAL_CHANGES__"!==lA.hash)return{ref:lA.hash,label:`Commit ${lA.hash.substring(0,7)}`,sublabel:lA.message};let e=l$||"HEAD";return{ref:e,label:`Branch ${e}`,sublabel:null}},[lA,l$]),lD=(0,n.useMemo)(()=>{if(!g?.all||U.length<2||U.includes("__LOCAL_CHANGES__"))return null;let e=new Map(g.all.map(e=>[e.hash,e])),a=new Map(lF.map((e,a)=>[e,a])),t=Array.from(new Set(U)).filter(e=>a.has(e)).sort((e,t)=>(a.get(e)??Number.MAX_SAFE_INTEGER)-(a.get(t)??Number.MAX_SAFE_INTEGER));if(t.length<2)return null;let s=t[0],l=t[t.length-1],n=e.get(s),r=e.get(l);return n&&r?{latestHash:s,oldestHash:l,latestCommit:n,oldestCommit:r}:null},[lF,g?.all,U]),lT=!!lD;(0,n.useEffect)(()=>{if(0===lF.length){(W||U.length>0||Y)&&Z(null);return}let e=new Set(lF),a=U.filter(a=>e.has(a));a.length!==U.length&&V(a),W&&!e.has(W)&&G(a.length>0?a[a.length-1]:null),Y&&!e.has(Y)&&J(a.length>0?a[a.length-1]:null)},[lF,W,U,Y,Z]);let l_=(0,n.useCallback)((e,a)=>{let t=a?.isRangeSelect??!1,s=a?.isMultiSelect??!1;if(t){let a=Y??W??e,t=lF.indexOf(a),s=lF.indexOf(e);if(-1!==t&&-1!==s){let[l,n]=t<s?[t,s]:[s,t];V(lF.slice(l,n+1)),G(e),J(a);return}}if(s){if(lM.has(e)){let a=U.filter(a=>a!==e);V(a),G(t=>t!==e?t:a.length>0?a[a.length-1]:null),Y===e&&J(a.length>0?a[a.length-1]:null)}else V([...U,e]),G(e),J(e);return}Z(e)},[lF,lM,U,W,Y,Z]),lO=(0,n.useMemo)(()=>lR.filter(e=>lM.has(e.hash)).reverse(),[lR,lM]),lH=(0,n.useMemo)(()=>Object.values(lx).some(e=>"visible"===e||"hidden"===e),[lx]),lI=(0,n.useMemo)(()=>{let e=new Set;if(C?.branches)for(let a of C.branches)"hidden"===lE(a,!1)&&e.add(a);if(C?.remotes)for(let[a,t]of Object.entries(C.remotes))for(let s of t){let t=`remotes/${a}/${s}`;"hidden"===lE(t,!0)&&e.add(t)}return e},[C?.branches,C?.remotes,lE]);(0,n.useEffect)(()=>{lH&&lR.length<50&&!w&&b<5e3&&g?.all&&g.all.length>=b&&f(e=>Math.min(e+100,5e3))},[lH,lR.length,w,b,g?.all]),(0,n.useEffect)(()=>{sP&&g?.all&&!w&&(g.all.some(e=>e.hash===sP)?requestAnimationFrame(()=>{s$.current?.scrollToCommit(sP)&&(Z(sP),sB(null))}):b<5e3?f(e=>e+100):(console.warn("Could not find commit after loading 5000 commits"),sB(null)))},[sP,g?.all,w,b,Z]);let lK=(0,n.useCallback)(e=>{if(!C?.branchCommits)return;let a=C.branchCommits[e];if(a){if(g?.all?.some(e=>e.hash===a)&&s$.current&&s$.current.scrollToCommit(a))return void Z(a);sB(a),Z(a)}},[C?.branchCommits,g?.all,Z]);(0,n.useEffect)(()=>{if(!u||!C?.branchCommits||F!==u)return;let a=`${e}:${u}`;p.current!==a&&(p.current=a,lK(u))},[F,C?.branchCommits,e,u,lK]);let lz=(0,n.useCallback)((e,a)=>{let t=a?.isRangeSelect??!1,s=a?.isMultiSelect??!1;if(t){let a=sA??e,t=lg.indexOf(a),s=lg.indexOf(e);if(-1!==t&&-1!==s){let[l,n]=t<s?[t,s]:[s,t],r=lg.slice(l,n+1);ll.has(e)?sF(sM.filter(e=>!r.includes(e))):sF(Array.from(new Set([...sM,...r]))),sL(a)}else sF([e]),sL(e);return}if(s){ll.has(e)?sF(sM.filter(a=>a!==e)):sF([...sM,e]),sL(e);return}sF([e]),sL(e),lK(e)},[sA,lg,lK,sM,ll]),lq=(0,n.useCallback)(e=>{ll.has(e)||(sF([e]),sL(e))},[ll]),lW=(0,n.useCallback)((a,t)=>{sO({repoPath:e,branchRef:t,script:a})},[e,sO]),lG=e=>{let a=e.filter(e=>e!==l$);0!==a.length&&(ew(a),eS(!1),ev(!0))},lU=e=>{lG([e])},lV=(0,n.useCallback)(e=>{let a=e.trim();a&&(eM(a),eP(!0))},[]),lY=(0,n.useCallback)(()=>{eD(!1),e_(null),eH(!1)},[]),lJ=(0,n.useCallback)(e=>{e&&(e_(e),eH(!1),eD(!0))},[]),lQ=async()=>{if(0!==ek.length){eR(!0);try{let a=new Map,t=(e,t,s)=>{a.has(e)||a.set(e,{branchRef:t,run:s})},l=new Set;if(eC)for(let e of ek){if(e.startsWith("remotes/"))continue;let a=C?.trackingInfo?.[e];a?.upstream&&l.add(a.upstream)}for(let a of l){let[s,...l]=a.split("/"),n=l.join("/");if(s&&n){let a=`${s}/${n}`;t(`remote:${a}`,a,()=>ee({repoPath:e,action:"delete-remote-branch",data:{remote:s,branch:n},suppressErrorToast:!0}))}}for(let a of ek){if(a.startsWith("remotes/")){let s=a.split("/");if(s.length>=3){let a=s[1],l=s.slice(2).join("/"),n=`${a}/${l}`;t(`remote:${n}`,n,()=>ee({repoPath:e,action:"delete-remote-branch",data:{remote:a,branch:l},suppressErrorToast:!0}))}continue}t(`local:${a}`,a,()=>ee({repoPath:e,action:"delete-branch",data:{branch:a},suppressErrorToast:!0}))}let n=Array.from(a.values()),r=(await Promise.allSettled(n.map(e=>e.run()))).flatMap((e,a)=>{if("fulfilled"===e.status)return[];let t=n[a].branchRef;return console.error(`Failed to delete branch "${t}":`,e.reason),[t]});r.length>0&&(0,m.oR)({type:"error",title:1===r.length?"Failed to Delete 1 Branch":`Failed to Delete ${r.length} Branches`,description:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{children:"The following branches could not be deleted:"}),(0,s.jsx)("ul",{className:"mt-1 max-h-40 overflow-y-auto list-disc pl-5",children:r.map(e=>(0,s.jsx)("li",{className:"break-all",children:e},e))})]}),duration:1e4}),ev(!1),ew([]),eS(!1),sF([]),sL(null)}catch(e){console.error(e)}finally{eR(!1)}}},lX=async()=>{if(eT){eK(!0);try{if(await ee({repoPath:e,action:"delete-tag",data:{tag:eT}}),eO&&nM)try{await ee({repoPath:e,action:"delete-remote-tag",data:{remote:nM,tag:eT}})}catch(e){console.error("Failed to delete remote tag:",e)}lY()}catch(e){console.error(e)}finally{eK(!1)}}},lZ=async()=>{if(eB){eA(!0);try{await ee({repoPath:e,action:"delete-worktree",data:{path:eB}}),eP(!1),eM(null)}catch(e){console.error(e)}finally{eA(!1)}}},l0=e=>{e2(e),e3(null),e7(e),e8(!1),e0(!0)},l1=e=>{let a=e.split("/");if(a.length<3||"remotes"!==a[0])return;let t=a[1],s=a.slice(2).join("/");t&&s&&(e2(e),e3({remote:t,branch:s}),e7(s),e8(!1),e0(!0))},l2=async()=>{if(e1&&e5){if(e4?e4.branch===e5:e1===e5)return void sz();ae(!0);try{e4?await ee({repoPath:e,action:"rename-remote-branch",data:{remote:e4.remote,oldName:e4.branch,newName:e5}}):await ee({repoPath:e,action:"rename-branch",data:{oldName:e1,newName:e5,renameTrackingRemote:e6}}),sz()}catch(e){console.error(e)}finally{ae(!1)}}},l4=async()=>{if(!as)return;let a=as.trim(),t=an.trim();if(a&&t){if(a===t)return void sq();ao(!0);try{await ee({repoPath:e,action:"rename-remote",data:{oldName:a,newName:t}}),sq()}catch(e){console.error(e)}finally{ao(!1)}}},l3=async()=>{if(!ah)return;let a=ah.trim();if(a){ax(!0);try{await ee({repoPath:e,action:"delete-remote",data:{name:a}}),sW()}catch(e){console.error(e)}finally{ax(!1)}}},l5=async()=>{let a=af.trim(),t=aj.trim();if(a&&t){av(!0);try{await ee({repoPath:e,action:"add-remote",data:{name:a,url:t}}),sG()}catch(e){console.error(e)}finally{av(!1)}}},l7=({sourceBranch:e,targetBranch:a})=>{aS(e),aR(a),aP(!0),aA("checking"),aw(!0)},l6=async()=>{if(aC&&aE){aM(!0);try{await ee({repoPath:e,action:"checkout",data:{branch:aC}}),await ee({repoPath:e,action:"rebase",data:{ontoBranch:aE,stashChanges:a$}}),aL()}catch(e){et(e)&&(aL(),ea(),(0,m.oR)({type:"warning",title:"Rebase Conflict Detected",description:"Redirected to the conflict resolver. Resolve conflicted files, then continue or abort.",duration:12e3})),console.error(e)}finally{aM(!1)}}};(0,n.useEffect)(()=>{if(!ak||!aC||!aE)return;let a=!1;return aA("checking"),(async()=>{try{let t=await ee({repoPath:e,action:"check-rebase-conflicts",data:{sourceBranch:aC,ontoBranch:aE}});a||aA(t.hasConflicts?"has-conflicts":"no-conflict")}catch(e){console.error(e),a||aA("has-conflicts")}})(),()=>{a=!0}},[ak,aC,aE,e,ee]);let l8=({sourceBranch:e,targetBranch:a})=>{aO(a),aI(e),az(!1),aW(!1),aU(!1),aY(""),aZ("checking"),aT(!0)},l9=(0,n.useCallback)(a=>{if(aW(a),a){if(!aH)return void aY("");(async()=>{try{let a=await ee({repoPath:e,action:"get-latest-commit-message",data:{branch:aH}});aY("string"==typeof a?.message?a.message:"")}catch(e){console.error(e),aY("")}})()}},[aH,e,ee]),ne=async()=>{if(a_&&aH){aQ(!0);try{await ee({repoPath:e,action:"checkout",data:{branch:a_}}),await ee({repoPath:e,action:"merge",data:{targetBranch:aH,rebaseBeforeMerge:aK,squash:aq,fastForward:aG,squashMessage:aq?aV:void 0}}),a0()}catch(e){et(e)&&(a0(),ea(),(0,m.oR)({type:"warning",title:"Merge Conflict Detected",description:"Redirected to the conflict resolver. Resolve conflicted files, then continue or abort.",duration:12e3})),console.error(e)}finally{aQ(!1)}}};(0,n.useEffect)(()=>{if(!aD||!aH||!a_)return;let a=!1;return aZ("checking"),(async()=>{try{let t=await ee({repoPath:e,action:"check-merge-conflicts",data:{sourceBranch:aH,targetBranch:a_}});a||aZ(t.hasConflicts?"has-conflicts":"no-conflict")}catch(e){console.error(e),a||aZ("has-conflicts")}})(),()=>{a=!0}},[aD,aH,a_,e,ee]);let na=async a=>{a3(a),tg(null),a7([]),te([]),a8(""),tt(""),tl(null),tr(!1),to(!1),td(!0),tm(!1),tx(""),a2(!0),tN(!0);try{let t=await ee({repoPath:e,action:"get-remotes",data:{}});if(!t.remotes||0===t.remotes.length){tg("No remote repository configured. Please add a remote first."),tN(!1);return}a7(t.remotes);let s=await ee({repoPath:e,action:"get-tracking-branch",data:{branch:a}});tl(s.tracking);let l=s.tracking?.remote,n=l&&t.remotes.includes(l)?l:t.remotes[0];a8(n),tv(!0);let r=await ee({repoPath:e,action:"get-remote-branches",data:{remote:n}});te(r.branches||[]),s.tracking?.remote===n&&s.tracking?.branch?tt(s.tracking.branch):(r.branches?.includes(a),tt(a))}catch(e){console.error(e),tg(e.message||"Failed to load remote information")}finally{tN(!1),tv(!1)}},nt=async a=>{a8(a),tv(!0),te([]);try{let t=await ee({repoPath:e,action:"get-remote-branches",data:{remote:a}});te(t.branches||[]),ts?.remote===a&&ts?.branch?tt(ts.branch):tt(a4||"")}catch(e){console.error(e),tg(e.message||"Failed to load remote branches")}finally{tv(!1)}},ns=(0,n.useCallback)(a=>{if(tm(a),a){if(!a4)return void tx("");(async()=>{try{let a=await ee({repoPath:e,action:"get-latest-commit-message",data:{branch:a4}});tx("string"==typeof a?.message?a.message:"")}catch(e){console.error(e),tx("")}})()}},[a4,e,ee]),nl=async()=>{if(a4&&a6&&ta){tb(!0),tg(null);try{let a=!a9.includes(ta)||ts?.remote!==a6||ts?.branch!==ta;await ee({repoPath:e,action:"push-to-remote",data:{localBranch:a4,remote:a6,remoteBranch:ta,rebaseFirst:!ti&&tn,forcePush:ti,pushLocalOnlyTags:tc,setUpstream:a,squash:th,squashMessage:tu}}),await ee({repoPath:e,action:"fetch",data:{remote:a6}}),a2(!1),a3(null)}catch(e){console.error(e),tg(e.message||"Failed to push to remote")}finally{tb(!1)}}},nn=async a=>{tS(a),tq(null),tR([]),tM([]),tP(""),tA(""),tD(null),t_(!0),tw(!0),tG(!0);try{let t=await ee({repoPath:e,action:"get-remotes",data:{}});if(!t.remotes||0===t.remotes.length){tq("No remote repository configured. Please add a remote first."),tG(!1);return}tR(t.remotes);let s=await ee({repoPath:e,action:"get-tracking-branch",data:{branch:a}});tD(s.tracking);let l=s.tracking?.remote,n=l&&t.remotes.includes(l)?l:t.remotes[0];tP(n),tV(!0);let r=await ee({repoPath:e,action:"get-remote-branches",data:{remote:n}});tM(r.branches||[]),s.tracking?.remote===n&&s.tracking?.branch?tA(s.tracking.branch):tA("")}catch(e){console.error(e),tq(e.message||"Failed to load remote information")}finally{tG(!1),tV(!1)}},nr=async a=>{tP(a),tV(!0),tM([]),tA("");try{let t=await ee({repoPath:e,action:"get-remote-branches",data:{remote:a}});tM(t.branches||[]),tL?.remote===a&&tL?.branch?tA(tL.branch):tA("")}catch(e){console.error(e),tq(e.message||"Failed to load remote branches")}finally{tV(!1)}},ni=async()=>{if(tC&&t$&&tF){tH(!0),tq(null);try{await ee({repoPath:e,action:"pull-from-remote",data:{localBranch:tC,remote:t$,remoteBranch:tF,rebase:tT}}),tw(!1),tS(null)}catch(e){console.error(e),tq(e.message||"Failed to pull from remote")}finally{tH(!1)}}},no=e=>{t3(e),t7(e.split("/").slice(2).join("/")),t2(!0)},nc=(0,n.useMemo)(()=>sa?"local"===sa.type?sa.branch:sa.localBranch:"",[sa]),nd=async()=>{if(t4&&t5){if(q){t2(!1),st({type:"remote",remoteBranch:t4,localBranch:t5}),sl("stash-and-reapply"),se(!0);return}t8(!0);try{await ee({repoPath:e,action:"checkout-to-local",data:{remoteBranch:t4,localBranch:t5}}),t2(!1),t3(null),t7("")}catch(e){console.error(e)}finally{t8(!1)}}},nh=async()=>{tJ(!0);try{await ee({repoPath:e,action:"fetch",data:{allRemotes:!0}})}catch(e){console.error(e)}finally{tJ(!1)}},nm=(0,n.useCallback)(async()=>{if(!tQ){tX(!0);try{let a=await fetch("/api/fs/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),t=await a.json().catch(()=>({}));if(!a.ok)throw Error(t.error||"Failed to open repository folder")}catch(e){(0,m.oR)({type:"error",title:"Failed to Open Repo Folder",description:e instanceof Error?e.message:"Unknown error"})}finally{tX(!1)}}},[tQ,e]),nu=(0,n.useCallback)(async()=>{if(!tZ){t0(!0);try{let a=await fetch("/api/fs/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),t=await a.json().catch(()=>({}));if(!a.ok)throw Error(t.error||"Failed to open terminal")}catch(e){(0,m.oR)({type:"error",title:"Failed to Open Terminal",description:e instanceof Error?e.message:"Unknown error"})}finally{t0(!1)}}},[tZ,e]),nx=(0,n.useCallback)((e,a)=>{if(a)return;let t=window.location.origin;try{window.top?.location?.origin&&(t=window.top.location.origin)}catch{}let s=`${t}/workspace?path=${encodeURIComponent(e)}`;window.open(s,"_blank","noopener,noreferrer")},[]),np=async a=>{try{await ee({repoPath:e,action:"fetch",data:{remote:a}})}catch(e){console.error(e)}},nb=async a=>{if(a!==l$){if(q){st({type:"local",branch:a}),sl("stash-and-reapply"),se(!0);return}try{await ee({repoPath:e,action:"checkout",data:{branch:a}})}catch(e){console.error(e)}}},nf=async()=>{if(sa){sr(!0);try{"local"===sa.type?await ee({repoPath:e,action:"checkout",data:{branch:sa.branch,switchStrategy:ss}}):(await ee({repoPath:e,action:"checkout-to-local",data:{remoteBranch:sa.remoteBranch,localBranch:sa.localBranch,switchStrategy:ss}}),t3(null),t7("")),se(!1),st(null)}catch(e){console.error(e)}finally{sr(!1)}}},ng=async e=>{sd(e),so(!0)},nj=async()=>{if(sc){sm(!0);try{await ee({repoPath:e,action:"reset",data:{commitHash:sc,mode:"hard"}}),so(!1),sd(null)}catch(e){console.error(e)}finally{sm(!1)}}},nN=async()=>{if(sp){sg(!0);try{await ee({repoPath:e,action:"revert",data:{commitHash:sp.hash}}),sx(!1),sb(null)}catch(e){console.error(e)}finally{sg(!1)}}},ny=async()=>{if(sy&&sk.trim()){sR(!0);try{let a,t;await ee({repoPath:e,action:"reword",data:{commitHash:sy.hash,message:(a=sk.trim(),(t=sC.replace(/\r\n/g,"\n")).trim()?`${a}
|
|
4
|
-
|
|
5
|
-
${t}`:a),branch:sy.branch}}),sU()}catch(e){console.error(e)}finally{sR(!1)}}},nv=e=>{if(!(e instanceof Error))return!1;let a=e.message.toLowerCase();return a.includes("cherry-pick")&&a.includes("already in progress")},nk=e=>{if(!(e instanceof Error))return!1;let a=e.message.toLowerCase();return a.includes("could not apply")||a.includes("conflict")||a.includes("cherry-pick --continue")},nw=(0,n.useCallback)(async a=>{1===a.length?await ee({repoPath:e,action:"cherry-pick",data:{commitHash:a[0]}}):await ee({repoPath:e,action:"cherry-pick-multiple",data:{commitHashes:a}})},[e,ee]),nC=(0,n.useCallback)(async()=>{try{await ee({repoPath:e,action:"cherry-pick-abort"})}catch(e){console.error(e)}finally{eq(!1),eJ(!1),eG([])}},[e,ee]),nS=async()=>{if(0!==eW.length){eV(!0);try{let e=eW.map(e=>e.hash);await nw(e),eq(!1),eG([])}catch(e){nv(e)?(eq(!1),eJ(!0)):nk(e)&&await nC(),console.error(e)}finally{eV(!1)}}},nE=async()=>{if(0===eW.length)return void eJ(!1);eX(!0);try{await ee({repoPath:e,action:"cherry-pick-abort"});let a=eW.map(e=>e.hash);await nw(a),eJ(!1),eG([])}catch(e){nv(e)?eJ(!0):nk(e)&&await nC(),console.error(e)}finally{eX(!1)}},nR=async()=>{if(en){ed(!0);try{await ee({repoPath:e,action:"branch",data:{branch:en,fromRef:ei||void 0}}),el(!1),er(""),eo(null)}catch(e){console.error(e)}finally{ed(!1)}}},n$=e=>{eo(e||null),el(!0)},nP=async()=>{if(eu&&ep.trim()){eN(!0);try{await ee({repoPath:e,action:"create-tag",data:{tagName:ep.trim(),commitHash:eu,pushToRemote:ef}}),em(!1),ex(null),eb(""),eg(!1)}catch(e){console.error(e)}finally{eN(!1)}}},nB=C?.trackingInfo,nM=(0,n.useMemo)(()=>Object.keys(C?.remoteUrls??{}).sort((e,a)=>"origin"===e?-1:"origin"===a?1:e.localeCompare(a)),[C?.remoteUrls])[0]||null,nF=(0,n.useMemo)(()=>{let e=[];for(let a of ek){if(a.startsWith("remotes/"))continue;let t=nB?.[a]?.upstream;t&&e.push(t)}return Array.from(new Set(e))},[ek,nB]),nA=(0,n.useMemo)(()=>!e1||e4?null:nB?.[e1]??null,[e1,e4,nB]),nL=T?.files?.length,nD=l$||(S?"Loading branches...":"Detached HEAD"),nT=l$&&"number"==typeof nL&&nL>0?`${l$} (${nL})`:nD,n_=(0,n.useMemo)(()=>{if(!l$)return null;let e=nB?.[l$];if(!e?.upstream)return null;let a=K(e.upstream);return a?{upstream:e.upstream,...a}:null},[l$,nB]),nO=(0,n.useMemo)(()=>{let e=[];for(let a of C?.branches??[]){let t=nB?.[a]?.upstream;if(!t)continue;let s=K(t);s&&e.push({localBranch:a,remote:s.remote,remoteBranch:s.branch})}return e},[C?.branches,nB]),nH=(0,n.useMemo)(()=>S?"Loading branches...":l$?n_?null:`Branch "${l$}" has no tracking remote branch`:"Not on a local branch",[l$,n_,S]),nI=(0,n.useMemo)(()=>S?"Loading branches...":0===nO.length?"No local branches with tracking remote branches":null,[S,nO.length]),nK=(0,n.useMemo)(()=>S?"Loading branches...":l$?null:"Not on a local branch",[l$,S]),nz=async()=>{if(tI||0===nO.length)return;tK(!0);let a=[];try{for(let t of nO)try{await ee({repoPath:e,action:"pull-from-remote",data:{localBranch:t.localBranch,remote:t.remote,remoteBranch:t.remoteBranch,rebase:!0},suppressErrorToast:!0}),a.push(t.localBranch)}catch(l){let e=l instanceof Error?l.message:"Unknown error",s=a.length>0?`Pulled ${a.length} branch${1===a.length?"":"es"} before failure.`:"No branches were updated.";(0,m.oR)({type:"error",title:`Pull All Failed on "${t.localBranch}"`,description:`${e} ${s}`,duration:12e3});return}(0,m.oR)({type:"success",title:1===a.length?"Pulled 1 Branch":`Pulled ${a.length} Branches`,description:"Updated all local branches that have tracking remote branches."})}finally{tK(!1)}},nq=e=>{let a=function(e,a){let{branchRef:t,branchLeafName:l,currentBranch:n,isRemote:r,selectedBranchRefs:i}=e,o=!r&&t===n,c=i&&i.length>0?i:[t],d=c.length>1,h=[];return o||r||h.push({label:"Checkout",icon:(0,s.jsx)("i",{className:"iconoir-arrow-right text-[14px]","aria-hidden":"true"}),onClick:()=>a.onCheckout(t)}),r&&h.push({label:"Checkout to local",icon:(0,s.jsx)("i",{className:"iconoir-arrow-down text-[14px]","aria-hidden":"true"}),onClick:()=>a.onCheckoutToLocal(t)}),h.push({label:"Create Branch",icon:(0,s.jsx)("i",{className:"iconoir-plus-circle text-[14px]","aria-hidden":"true"}),onClick:()=>a.onCreateBranch(t)}),r||h.push({label:"Rename Branch",icon:(0,s.jsx)("i",{className:"iconoir-edit-pencil text-[14px]","aria-hidden":"true"}),onClick:()=>a.onRenameBranch(t)}),r&&h.push({label:"Rename branch",icon:(0,s.jsx)("i",{className:"iconoir-edit-pencil text-[14px]","aria-hidden":"true"}),onClick:()=>a.onRenameRemoteBranch(t)}),r||h.push({label:"Push to Remote",icon:(0,s.jsx)("i",{className:"iconoir-arrow-up text-[14px]","aria-hidden":"true"}),onClick:()=>a.onPushToRemote(t)}),r||h.push({label:"Pull from Remote",icon:(0,s.jsx)("i",{className:"iconoir-arrow-down text-[14px]","aria-hidden":"true"}),onClick:()=>a.onPullFromRemote(t)}),!o&&n&&(h.push({label:`Rebase ${n} onto ${l}`,labelNode:(0,s.jsxs)(s.Fragment,{children:["Rebase ",(0,s.jsx)("span",{className:"font-bold",children:n})," onto ",l]}),icon:(0,s.jsx)("i",{className:"iconoir-git-fork text-[14px]","aria-hidden":"true"}),onClick:()=>a.onRebase({sourceBranch:n,targetBranch:t})}),h.push({label:`Rebase ${l} onto ${n}`,labelNode:(0,s.jsxs)(s.Fragment,{children:["Rebase ",l," onto ",(0,s.jsx)("span",{className:"font-bold",children:n})]}),icon:(0,s.jsx)("i",{className:"iconoir-git-fork text-[14px]","aria-hidden":"true"}),onClick:()=>a.onRebase({sourceBranch:t,targetBranch:n})}),h.push({label:`Merge ${n} into ${l}`,labelNode:(0,s.jsxs)(s.Fragment,{children:["Merge ",(0,s.jsx)("span",{className:"font-bold",children:n})," into ",l]}),icon:(0,s.jsx)("i",{className:"iconoir-git-fork text-[14px]","aria-hidden":"true"}),onClick:()=>a.onMerge({sourceBranch:n,targetBranch:t})}),h.push({label:`Merge ${l} into ${n}`,labelNode:(0,s.jsxs)(s.Fragment,{children:["Merge ",l," into ",(0,s.jsx)("span",{className:"font-bold",children:n})]}),icon:(0,s.jsx)("i",{className:"iconoir-git-fork text-[14px]","aria-hidden":"true"}),onClick:()=>a.onMerge({sourceBranch:t,targetBranch:n})})),o||(d?h.push({label:`Delete Selected Branches (${c.length})`,icon:(0,s.jsx)("i",{className:"iconoir-trash text-[14px]","aria-hidden":"true"}),onClick:()=>a.onDeleteBranches(c),danger:!0}):h.push({label:"Delete Branch",icon:(0,s.jsx)("i",{className:"iconoir-trash text-[14px]","aria-hidden":"true"}),onClick:()=>a.onDeleteBranch(t),danger:!0})),h}(e,{onCheckout:nb,onCheckoutToLocal:no,onCreateBranch:n$,onDeleteBranch:lU,onDeleteBranches:lG,onRenameBranch:l0,onRenameRemoteBranch:l1,onRebase:l7,onMerge:l8,onPushToRemote:na,onPullFromRemote:nn});return li.length>0&&a.push({label:"Custom scripts",icon:(0,s.jsx)("i",{className:"iconoir-terminal text-[14px]","aria-hidden":"true"}),children:li.map(a=>({label:a.name,icon:(0,s.jsx)("i",{className:"iconoir-play text-[14px]","aria-hidden":"true"}),onClick:()=>{lW(a,e.branchRef)}}))}),a},nW=(0,n.useMemo)(()=>new Set(C?.branches??[]),[C?.branches]),nG=(0,n.useMemo)(()=>{let e=new Map;if(!C?.remotes)return e;for(let[a,t]of Object.entries(C.remotes))for(let s of t)e.set(`${a}/${s}`,`remotes/${a}/${s}`);return e},[C?.remotes]),nU=(0,n.useMemo)(()=>la?M(la).filter(e=>e!==l$):[],[la,l$]),nV=C?.worktrees??[],nY=(0,s.jsxs)("div",{className:"w-[22rem] max-w-[calc(100vw-2rem)] flex flex-col border border-base-300 bg-base-100 rounded-box shadow-xl overflow-hidden",children:[(0,s.jsxs)("div",{className:"px-4 border-b border-base-300 flex items-center justify-between bg-base-100 h-[57px] shrink-0",children:[(0,s.jsx)("h2",{className:"font-bold text-lg",children:"Branches"}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[lH&&(0,s.jsx)("div",{className:"tooltip tooltip-left z-20","data-tip":"Clear filters",children:(0,s.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:lS,children:(0,s.jsx)("i",{className:"iconoir-filter text-[16px]","aria-hidden":"true"})})}),(0,s.jsx)("div",{className:"tooltip tooltip-left z-20","data-tip":"Create Branch",children:(0,s.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:()=>n$(),children:(0,s.jsx)("i",{className:"iconoir-plus-circle text-[16px]","aria-hidden":"true"})})})]})]}),(0,s.jsx)("div",{className:"max-h-[70vh] overflow-auto",children:(0,s.jsxs)("div",{className:"p-2 space-y-0.5",children:[la&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o,{items:[{label:"Delete",icon:(0,s.jsx)("i",{className:"iconoir-trash text-[14px]","aria-hidden":"true"}),onClick:()=>lG(nU),danger:!0,disabled:0===nU.length}],children:(0,s.jsx)(A,{name:"Branches",groupPath:"__local__",icon:(0,s.jsx)("i",{className:"iconoir-git-branch text-[14px]","aria-hidden":"true"}),isExpanded:lo,onToggle:ly,visibilityMap:lx,onToggleVisibility:lC})}),lo&&(0,s.jsx)(L,{node:la,currentBranch:C?.current,expandedFolders:lb,onToggleFolder:lw,onCheckout:nb,onCheckoutToLocal:no,onCreateBranch:()=>n$(),onDeleteBranch:lU,onRenameBranch:l0,onRenameRemoteBranch:l1,onRebase:l7,onMerge:l8,onPushToRemote:na,onPullFromRemote:nn,getBranchContextMenuItems:nq,onBranchClick:lz,onBranchContextMenu:lq,onDeleteBranchGroup:lG,selectedBranches:ll,visibilityMap:lx,onToggleVisibility:lC,depth:1,groupPath:"__local__",trackingInfo:C?.trackingInfo})]}),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o,{items:[{label:"Fetch from all remotes",icon:(0,s.jsx)("i",{className:"iconoir-refresh-circle text-[14px]","aria-hidden":"true"}),onClick:nh},{label:"Add remote",icon:(0,s.jsx)("i",{className:"iconoir-plus-circle text-[14px]","aria-hidden":"true"}),onClick:()=>{ag("origin"),aN(""),ab(!0)}}],children:(0,s.jsx)(A,{name:"Remotes",groupPath:"__remotes__",icon:(0,s.jsx)("i",{className:"iconoir-globe text-[14px]","aria-hidden":"true"}),isExpanded:ld,onToggle:lv,visibilityMap:lx,onToggleVisibility:lC})}),ld&&S&&!lt&&(0,s.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-sm opacity-70",style:{paddingLeft:"20px"},children:[(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,s.jsx)("span",{children:"Loading remotes..."})]}),ld&<&&Array.from(lt.entries()).map(([e,a])=>{let t=`__remotes__/${e}`,l=lb.has(t);return(0,s.jsxs)("div",{children:[(0,s.jsx)(o,{items:[{label:`Fetch from ${e}`,icon:(0,s.jsx)("i",{className:"iconoir-refresh-circle text-[14px]","aria-hidden":"true"}),onClick:()=>np(e)},{label:"Rename",icon:(0,s.jsx)("i",{className:"iconoir-edit-pencil text-[14px]","aria-hidden":"true"}),onClick:()=>{al(e),ar(e),at(!0)}},{label:"Delete",icon:(0,s.jsx)("i",{className:"iconoir-trash text-[14px]","aria-hidden":"true"}),onClick:()=>{e&&(am(e),ad(!0))},danger:!0}],children:(0,s.jsx)(A,{name:e,groupPath:t,icon:(0,s.jsx)("i",{className:"iconoir-globe text-[14px] opacity-50","aria-hidden":"true"}),isExpanded:l,onToggle:()=>lw(t),visibilityMap:lx,onToggleVisibility:lC,depth:1})}),l&&(0,s.jsx)(L,{node:a,currentBranch:C?.current,expandedFolders:lb,onToggleFolder:lw,onCheckout:nb,onCheckoutToLocal:no,onCreateBranch:()=>n$(),onDeleteBranch:lU,onRenameBranch:l0,onRenameRemoteBranch:l1,onRebase:l7,onMerge:l8,onPushToRemote:na,onPullFromRemote:nn,getBranchContextMenuItems:nq,onBranchClick:lz,onBranchContextMenu:lq,onDeleteBranchGroup:lG,selectedBranches:ll,visibilityMap:lx,onToggleVisibility:lC,depth:2,groupPath:t,isRemote:!0,trackingInfo:C?.trackingInfo})]},e)})]}),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"group flex items-center gap-1 px-2 py-1.5 text-sm rounded-md cursor-pointer hover:bg-base-200 transition-colors font-medium",onClick:lk,children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[(0,s.jsx)("span",{className:"text-xs opacity-70",children:lm?"▼":"▶"}),(0,s.jsx)("i",{className:"iconoir-folder text-[14px]","aria-hidden":"true"}),(0,s.jsx)("span",{className:"truncate min-w-0 flex-1",children:"Worktrees"})]}),(0,s.jsx)("span",{className:"text-xs opacity-60",children:nV.length})]}),lm&&S&&0===nV.length&&(0,s.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-sm opacity-70",style:{paddingLeft:"20px"},children:[(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,s.jsx)("span",{children:"Loading worktrees..."})]}),lm&&!S&&0===nV.length&&(0,s.jsx)("div",{className:"px-2 py-2 text-sm opacity-70",style:{paddingLeft:"20px"},children:"No worktrees found"}),lm&&nV.map(e=>{let a=(0,s.jsxs)("button",{type:"button",className:(0,i.cn)("group flex w-full items-center gap-2 px-2 py-1.5 text-sm rounded-md transition-colors text-left",e.isCurrent?"cursor-default opacity-85":"cursor-pointer hover:bg-base-200"),style:{paddingLeft:"20px"},onClick:()=>nx(e.path,e.isCurrent),title:e.path,disabled:e.isCurrent,children:[(0,s.jsx)("i",{className:`iconoir-folder text-[14px] shrink-0 ${e.isCurrent?"text-primary":"opacity-60"}`,"aria-hidden":"true"}),(0,s.jsx)("span",{className:"truncate min-w-0 flex-1",children:e.path}),e.branch&&(0,s.jsx)("span",{className:"shrink-0 text-xs opacity-60",children:e.branch}),e.isCurrent&&(0,s.jsx)("span",{className:"shrink-0 text-xs text-primary font-medium",children:"current"})]});return e.isCurrent?(0,s.jsx)("div",{children:a},e.path):(0,s.jsx)(o,{items:[{label:"Delete worktree",icon:(0,s.jsx)("i",{className:"iconoir-trash text-[14px]","aria-hidden":"true"}),onClick:()=>lV(e.path),danger:!0}],children:a},e.path)})]})]})})]});return N&&100===b?(0,s.jsx)("div",{className:"flex items-center justify-center p-8 h-full",children:(0,s.jsx)("span",{className:"loading loading-spinner text-base-content/50"})}):y?(0,s.jsxs)("div",{className:"flex items-center justify-center p-8 h-full flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-error font-medium",children:"Error Loading History"}),(0,s.jsx)("p",{className:"text-sm opacity-70",children:v?.message||"An unknown error occurred"}),(0,s.jsxs)("button",{onClick:()=>void k(),className:"btn btn-outline btn-sm",children:[(0,s.jsx)("i",{className:"iconoir-refresh-circle text-[16px] mr-1","aria-hidden":"true"}),"Try Again"]})]}):g?(0,s.jsxs)("div",{className:"flex h-full overflow-hidden",children:[si&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Reset to Commit"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to hard reset branch ",(0,s.jsx)("span",{className:"font-bold break-all",children:C?.current||"Detached HEAD"})," to commit ",(0,s.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:sc?.substring(0,7)}),"?",(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-error font-bold",children:"Warning: This will discard all local changes and commits after this point. This action cannot be undone."})]}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>so(!1),disabled:sh,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-error",onClick:nj,disabled:sh,children:[sh&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Reset"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>so(!1),children:"close"})})]}),su&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Revert Commit"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to revert commit ",(0,s.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:sp?.hash.substring(0,7)})," on ",(0,s.jsx)("span",{className:"font-bold break-all",children:C?.current||"current"}),"?"]}),sp?.message&&(0,s.jsx)("div",{className:"rounded border border-base-300 bg-base-200/40 px-3 py-2 text-xs break-words",children:sp.message}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>{sx(!1),sb(null)},disabled:sf,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:nN,disabled:sf,children:[sf&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Revert"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>{sx(!1),sb(null)},children:"close"})})]}),sj&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Reword Commit"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Reword commit ",(0,s.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:sy?.hash.substring(0,7)})," on branch ",(0,s.jsx)("span",{className:"font-bold",children:sy?.branch}),"."]}),(0,s.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono text-sm mb-3",value:sk,onChange:e=>sw(e.target.value),autoFocus:!0,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&sk.trim()&&!sE&&(e.preventDefault(),ny())},placeholder:"Commit subject",disabled:sE}),(0,s.jsx)("textarea",{className:"textarea textarea-bordered w-full h-32 font-mono text-sm",value:sC,onChange:e=>sS(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&sk.trim()&&!sE&&(e.preventDefault(),ny())},placeholder:"Commit message body (optional)",disabled:sE}),sy?.branch!==C?.current&&(0,s.jsx)("div",{className:"alert alert-warning text-xs mt-2 py-2",children:(0,s.jsxs)("span",{children:["This will briefly checkout ",(0,s.jsx)("b",{children:sy?.branch})," to amend the commit."]})}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:sU,disabled:sE,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:ny,disabled:!sk.trim()||sE,children:[sE&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Reword"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:sU,children:"close"})})]}),ey&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:ek.length>1?"Delete Branches":"Delete Branch"}),ek.length>1?(0,s.jsxs)("div",{className:"py-4 space-y-3",children:[(0,s.jsxs)("p",{className:"break-words",children:["Are you sure you want to delete ",(0,s.jsxs)("span",{className:"font-bold",children:[ek.length," selected branches"]}),"? This action cannot be undone."]}),(0,s.jsx)("div",{className:"max-h-44 overflow-auto rounded border border-base-300 bg-base-200/40 p-2 space-y-1",children:ek.map(e=>(0,s.jsx)("div",{className:"text-xs min-w-0 break-all",children:e.startsWith("remotes/")?e.slice(8):e},e))})]}):(0,s.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete the branch ",(0,s.jsx)("span",{className:"font-bold break-all",children:ek[0]?.startsWith("remotes/")?ek[0].slice(8):ek[0]}),"? This action cannot be undone."]}),nF.length>0&&(0,s.jsx)("div",{className:"form-control",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:eC,onChange:e=>eS(e.target.checked),disabled:eE}),(0,s.jsx)("span",{className:"label-text break-words whitespace-normal",children:1===nF.length?(0,s.jsxs)(s.Fragment,{children:["Delete tracking remote branch ",(0,s.jsx)("span",{className:"font-mono opacity-70 break-all",children:nF[0]})]}):(0,s.jsxs)(s.Fragment,{children:["Delete ",nF.length," tracking remote branches"]})})]})}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>{ev(!1),ew([]),eS(!1)},disabled:eE,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-error",onClick:lQ,disabled:eE,children:[eE&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>{ev(!1),ew([]),eS(!1)},children:"close"})})]}),e$&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Delete Worktree"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete the worktree ",(0,s.jsx)("span",{className:"font-bold break-all",children:eB}),"?"]}),(0,s.jsx)("p",{className:"text-sm text-error break-words",children:"This will remove the worktree from git and remove its working directory."}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>{eP(!1),eM(null)},disabled:eF,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-error",onClick:()=>void lZ(),disabled:eF||!eB,children:[eF&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>{eP(!1),eM(null)},children:"close"})})]}),eL&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Delete Tag"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete the tag ",(0,s.jsx)("span",{className:"font-bold break-all",children:eT}),"? This action cannot be undone."]}),(0,s.jsx)("div",{className:"form-control",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:eO,onChange:e=>eH(e.target.checked),disabled:eI||!nM}),(0,s.jsx)("span",{className:"label-text break-words whitespace-normal",children:nM?(0,s.jsxs)(s.Fragment,{children:["Also delete from remote ",(0,s.jsx)("span",{className:"font-mono opacity-70",children:nM})]}):"No remote configured"})]})}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:lY,disabled:eI,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-error",onClick:lX,disabled:eI||!eT,children:[eI&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:lY,children:"close"})})]}),ez&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Cherry Pick"}),(0,s.jsx)("p",{className:"text-sm opacity-70 mt-1",children:eW.length>1?"Apply selected commits from oldest to newest":"Apply changes from the selected commit"}),1===eW.length?(0,s.jsxs)("p",{className:"py-4 break-words",children:["Are you sure to apply ",(0,s.jsx)("span",{className:"font-bold font-mono break-all",children:eW[0]?.hash})," ",(0,s.jsx)("span",{className:"font-bold break-words",children:eW[0]?.message})," to ",(0,s.jsx)("span",{className:"font-bold break-all",children:C?.current||"current"})," branch?"]}):(0,s.jsxs)("div",{className:"py-4 space-y-3",children:[(0,s.jsxs)("p",{className:"break-words",children:["Are you sure to apply ",(0,s.jsxs)("span",{className:"font-bold",children:[eW.length," selected commits"]})," to ",(0,s.jsx)("span",{className:"font-bold break-all",children:C?.current||"current"})," branch?"]}),(0,s.jsx)("div",{className:"max-h-44 overflow-auto rounded border border-base-300 bg-base-200/40 p-2 space-y-1",children:eW.map(e=>(0,s.jsxs)("div",{className:"text-xs min-w-0",children:[(0,s.jsx)("span",{className:"font-mono opacity-70",children:e.hash.slice(0,7)})," ",(0,s.jsx)("span",{className:"break-words",children:e.message})]},e.hash))})]}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>{eq(!1),eG([])},disabled:eU,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:nS,disabled:eU,children:[eU&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>{eq(!1),eG([])},children:"close"})})]}),eY&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Cherry Pick In Progress"}),(0,s.jsx)("p",{className:"text-sm opacity-70 mt-1",children:"Another cherry-pick operation is currently in progress."}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Abort the in-progress cherry-pick and continue with ",eW.length>1?"the selected commits":"this commit","?"]}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>{eJ(!1),eG([])},disabled:eQ,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-warning",onClick:()=>void nE(),disabled:eQ,children:[eQ&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Abort and Continue"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>{eJ(!1),eG([])},children:"close"})})]}),eZ&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:e4?"Rename Remote Branch":"Rename Branch"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Enter a new name for the branch ",(0,s.jsx)("span",{className:"font-bold break-all",children:e1}),". Press ",(0,s.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,s.jsx)("input",{type:"text",className:"input input-bordered w-full",value:e5,onChange:e=>e7((0,i.L9)(e.target.value)),placeholder:"New branch name",disabled:e9,autoFocus:!0,onKeyDown:e=>{let a="Enter"===e.key&&(e.metaKey||e.ctrlKey),t=e4?e5===e4.branch:e5===e1;a&&e5&&!t&&!e9&&l2()}}),!e4&&nA?.upstream&&(0,s.jsx)("div",{className:"form-control mt-2",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:e6,onChange:e=>e8(e.target.checked),disabled:e9}),(0,s.jsxs)("span",{className:"label-text break-words whitespace-normal",children:["Also rename tracking remote branch ",(0,s.jsx)("span",{className:"font-mono opacity-70 break-all",children:nA.upstream})]})]})}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:sz,disabled:e9,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:l2,disabled:!e5||(e4?e5===e4.branch:e5===e1)||e9,children:[e9&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Rename"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:sz,children:"close"})})]}),aa&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Rename Remote"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Enter a new name for remote ",(0,s.jsx)("span",{className:"font-bold break-all",children:as}),". Press ",(0,s.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,s.jsx)("input",{type:"text",className:"input input-bordered w-full",value:an,onChange:e=>ar(e.target.value),placeholder:"New remote name",disabled:ai,autoFocus:!0,onKeyDown:e=>{let a="Enter"===e.key&&(e.metaKey||e.ctrlKey),t=an.trim(),s=t===(as??"").trim();a&&t&&!s&&!ai&&l4()}}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:sq,disabled:ai,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:l4,disabled:!an.trim()||an.trim()===(as??"").trim()||ai,children:[ai&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Rename"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:sq,children:"close"})})]}),ac&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Delete Remote"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete remote ",(0,s.jsx)("span",{className:"font-bold break-all",children:ah}),"? This removes all tracking branches for that remote."]}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:sW,disabled:au,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-error",onClick:l3,disabled:!ah||au,children:[au&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:sW,children:"close"})})]}),ap&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Add Remote"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Add a new remote by providing a name and URL. Press ",(0,s.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label pt-0",children:(0,s.jsx)("span",{className:"label-text",children:"Remote name"})}),(0,s.jsx)("input",{type:"text",className:"input input-bordered w-full",value:af,onChange:e=>ag(e.target.value),placeholder:"origin",disabled:ay,autoFocus:!0})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label pt-0",children:(0,s.jsx)("span",{className:"label-text",children:"Remote URL"})}),(0,s.jsx)("input",{type:"text",className:"input input-bordered w-full",value:aj,onChange:e=>aN(e.target.value),placeholder:"https://github.com/owner/repo.git",disabled:ay,onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&af.trim()&&aj.trim()&&!ay&&l5()}})]})]}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:sG,disabled:ay,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:l5,disabled:!af.trim()||!aj.trim()||ay,children:[ay&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Add"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:sG,children:"close"})})]}),ak&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Rebase"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Copy commits from one branch to another.",(0,s.jsx)("br",{}),"Are you sure to rebase ",(0,s.jsx)("span",{className:"font-bold break-all",children:aC})," onto ",(0,s.jsx)("span",{className:"font-bold break-all",children:aE}),"?"]}),(0,s.jsx)("div",{className:"form-control",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:a$,onChange:e=>aP(e.target.checked),disabled:aB}),(0,s.jsx)("span",{className:"label-text",children:"Stash and reapply local changes"})]})}),!a$&&(0,s.jsx)("p",{className:"text-xs text-warning mt-2 ml-6",children:"Warning: All local changes will be discarded."}),"checking"===aF?(0,s.jsxs)("div",{className:"alert alert-info text-sm mt-4 py-2",children:[(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,s.jsxs)("span",{children:["Checking conflicts for rebasing ",(0,s.jsx)("span",{className:"font-bold break-all",children:aC})," onto ",(0,s.jsx)("span",{className:"font-bold break-all",children:aE}),"..."]})]}):"no-conflict"===aF?(0,s.jsxs)("div",{className:"alert alert-success text-sm mt-4 py-2",children:[(0,s.jsx)("i",{className:"iconoir-check-circle-solid text-[18px]","aria-hidden":"true"}),(0,s.jsxs)("span",{children:["No conflict: rebasing ",(0,s.jsx)("span",{className:"font-bold break-all",children:aC})," onto ",(0,s.jsx)("span",{className:"font-bold break-all",children:aE})," will not cause conflicts."]})]}):(0,s.jsxs)("div",{className:"alert alert-warning text-sm mt-4 py-2",children:[(0,s.jsx)("i",{className:"iconoir-warning-circle-solid text-[18px]","aria-hidden":"true"}),(0,s.jsxs)("span",{children:["Conflicts detected: rebasing ",(0,s.jsx)("span",{className:"font-bold break-all",children:aC})," onto ",(0,s.jsx)("span",{className:"font-bold break-all",children:aE})," will cause conflicts."]})]}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:aL,disabled:aB,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:l6,disabled:aB,children:[aB&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:aL,children:"close"})})]}),aD&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Merge"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Merge branch into another one.",(0,s.jsx)("br",{}),"Are you sure to merge ",(0,s.jsx)("span",{className:"font-bold break-all",children:aH})," into ",(0,s.jsx)("span",{className:"font-bold break-all",children:a_}),"?"]}),(0,s.jsx)("div",{className:"form-control",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:aK,onChange:e=>az(e.target.checked),disabled:aJ}),(0,s.jsx)("span",{className:"label-text",children:"Rebase before merge"})]})}),(0,s.jsx)("div",{className:"form-control",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:aq,onChange:e=>l9(e.target.checked),disabled:aJ}),(0,s.jsx)("span",{className:"label-text",children:"Squash before merge"})]})}),aq&&(0,s.jsx)("textarea",{className:"textarea textarea-bordered w-full mt-2",placeholder:"Commit message for squash merge",value:aV,onChange:e=>aY(e.target.value),disabled:aJ,autoFocus:!0}),(0,s.jsx)("div",{className:"form-control",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:aG,onChange:e=>aU(e.target.checked),disabled:aJ}),(0,s.jsx)("span",{className:"label-text",children:"Fast forward merge"})]})}),"checking"===aX?(0,s.jsxs)("div",{className:"alert alert-info text-sm mt-4 py-2",children:[(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,s.jsxs)("span",{children:["Checking conflicts for merging ",(0,s.jsx)("span",{className:"font-bold break-all",children:aH})," into ",(0,s.jsx)("span",{className:"font-bold break-all",children:a_}),"..."]})]}):"no-conflict"===aX?(0,s.jsxs)("div",{className:"alert alert-success text-sm mt-4 py-2",children:[(0,s.jsx)("i",{className:"iconoir-check-circle-solid text-[18px]","aria-hidden":"true"}),(0,s.jsxs)("span",{children:["No conflict: merging ",(0,s.jsx)("span",{className:"font-bold break-all",children:aH})," into ",(0,s.jsx)("span",{className:"font-bold break-all",children:a_})," will not cause conflicts."]})]}):(0,s.jsxs)("div",{className:"alert alert-warning text-sm mt-4 py-2",children:[(0,s.jsx)("i",{className:"iconoir-warning-circle-solid text-[18px]","aria-hidden":"true"}),(0,s.jsxs)("span",{children:["Conflicts detected: merging ",(0,s.jsx)("span",{className:"font-bold break-all",children:aH})," into ",(0,s.jsx)("span",{className:"font-bold break-all",children:a_})," will cause conflicts."]})]}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:a0,disabled:aJ,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:ne,disabled:aJ,children:[aJ&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:a0,children:"close"})})]}),a1&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Push to Remote"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Push ",(0,s.jsx)("span",{className:"font-bold break-all",children:a4})," to a remote repository."]}),tf&&0===a5.length?(0,s.jsxs)("div",{className:"alert alert-error",children:[(0,s.jsx)("span",{className:"text-xl",children:"⚠️"}),(0,s.jsx)("span",{children:tf})]}):tj?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)("span",{className:"loading loading-spinner loading-lg"})}):(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,s.jsx)("label",{className:"label flex-shrink-0",children:(0,s.jsx)("span",{className:"label-text",children:"Remote Repository"})}),(0,s.jsx)("select",{className:"select select-bordered w-64",value:a6,onChange:e=>nt(e.target.value),disabled:tp,children:a5.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})]}),(0,s.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,s.jsx)("label",{className:"label flex-shrink-0",children:(0,s.jsx)("span",{className:"label-text",children:"Remote Branch"})}),(0,s.jsxs)("div",{className:"flex flex-col items-end gap-1 w-64",children:[ty?(0,s.jsxs)("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-base-200 opacity-70 w-full",children:[(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"})," Loading branches..."]}):(0,s.jsxs)("select",{className:"select select-bordered w-full",value:ta,onChange:e=>tt(e.target.value),disabled:tp,children:[a4&&!a9.includes(a4)&&(0,s.jsxs)("option",{value:a4,children:[a4," (new)"]}),a9.map(e=>(0,s.jsxs)("option",{value:e,children:[e,ts?.remote===a6&&ts?.branch===e?" (tracking)":""]},e))]}),ta&&!a9.includes(ta)&&(0,s.jsx)("div",{className:"label",children:(0,s.jsx)("span",{className:"label-text-alt text-warning",children:"New branch will be created"})})]})]}),(0,s.jsx)("div",{className:"form-control",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:tn,onChange:e=>tr(e.target.checked),disabled:tp||ti}),(0,s.jsx)("span",{className:"label-text",children:"Rebase onto remote branch before pushing"})]})}),(0,s.jsx)("div",{className:"form-control",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm checkbox-error",checked:ti,onChange:e=>to(e.target.checked),disabled:tp}),(0,s.jsx)("span",{className:"label-text text-error",children:"Force push"})]})}),(0,s.jsx)("div",{className:"form-control",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:tc,onChange:e=>td(e.target.checked),disabled:tp}),(0,s.jsx)("span",{className:"label-text",children:"Push all tags"})]})}),(0,s.jsx)("div",{className:"form-control",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:th,onChange:e=>ns(e.target.checked),disabled:tp}),(0,s.jsx)("span",{className:"label-text",children:"Squash local commits before push"})]})}),th&&(0,s.jsx)("textarea",{className:"textarea textarea-bordered w-full",placeholder:"Commit message for squash",value:tu,onChange:e=>tx(e.target.value),disabled:tp,autoFocus:!0}),tf&&(0,s.jsx)("div",{className:"alert alert-error text-sm",children:(0,s.jsx)("span",{children:tf})})]}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>a2(!1),disabled:tp,children:"Cancel"}),a5.length>0&&(0,s.jsxs)("button",{className:"btn btn-primary",onClick:nl,disabled:tp||!a6||!ta,children:[tp&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"})," Push"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>a2(!1),children:"close"})})]}),tk&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Pull from Remote"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Pull changes from a remote branch into ",(0,s.jsx)("span",{className:"font-bold break-all",children:tC}),"."]}),tz&&0===tE.length?(0,s.jsx)("div",{className:"alert alert-error",children:(0,s.jsx)("span",{children:tz})}):tW?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)("span",{className:"loading loading-spinner loading-lg"})}):(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,s.jsx)("label",{className:"label flex-shrink-0",children:(0,s.jsx)("span",{className:"label-text",children:"Remote Repository"})}),(0,s.jsx)("select",{className:"select select-bordered w-64",value:t$,onChange:e=>nr(e.target.value),disabled:tO,children:tE.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})]}),(0,s.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,s.jsx)("label",{className:"label flex-shrink-0",children:(0,s.jsx)("span",{className:"label-text",children:"Remote Branch"})}),tU?(0,s.jsxs)("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-base-200 opacity-70 w-64",children:[(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"})," Loading branches..."]}):(0,s.jsx)("select",{className:"select select-bordered w-64",value:tF,onChange:e=>tA(e.target.value),disabled:tO,children:tB.map(e=>(0,s.jsxs)("option",{value:e,children:[e,tL?.remote===t$&&tL?.branch===e?" (tracking)":""]},e))})]}),(0,s.jsx)("div",{className:"form-control",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:tT,onChange:e=>t_(e.target.checked),disabled:tO}),(0,s.jsx)("span",{className:"label-text",children:"Rebase onto remote branch"})]})}),tz&&(0,s.jsx)("div",{className:"alert alert-error text-sm",children:(0,s.jsx)("span",{children:tz})})]}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>tw(!1),disabled:tO,children:"Cancel"}),tE.length>0&&(0,s.jsxs)("button",{className:"btn btn-primary",onClick:ni,disabled:tO||!t$||!tF,children:[tO&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"})," Pull"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>tw(!1),children:"close"})})]}),eh&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Create Tag"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Create a new tag at commit ",(0,s.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:eu?.substring(0,7)}),"."]}),(0,s.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono",value:ep,onChange:e=>eb(e.target.value),placeholder:"Tag name",disabled:ej,autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&ep.trim()&&!ej&&(e.preventDefault(),nP())}}),(0,s.jsx)("div",{className:"form-control mt-3",children:(0,s.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:ef,onChange:e=>eg(e.target.checked),disabled:ej}),(0,s.jsx)("span",{className:"label-text",children:"Push tag to remote after creation"})]})}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>{em(!1),ex(null),eb(""),eg(!1)},disabled:ej,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:nP,disabled:!ep.trim()||ej,children:[ej&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Create"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>{em(!1),ex(null),eb(""),eg(!1)},children:"close"})})]}),es&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Create New Branch"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Create a new branch from"," ",(0,s.jsx)("span",{className:"font-bold break-all",children:ei?ei.replace(/^remotes\//,""):"current HEAD"}),"."]}),(0,s.jsx)("input",{type:"text",className:"input input-bordered w-full",value:en,onChange:e=>er((0,i.L9)(e.target.value)),placeholder:"Branch name",disabled:ec,autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&en&&!ec&&(e.preventDefault(),nR())}}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>{el(!1),eo(null)},disabled:ec,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:nR,disabled:!en||ec,children:[ec&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"})," Create & Checkout"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>{el(!1),eo(null)},children:"close"})})]}),t1&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Checkout to Local Branch"}),(0,s.jsxs)("p",{className:"py-4 break-words",children:["Create a local branch from ",(0,s.jsx)("span",{className:"font-bold break-all",children:t4?.replace(/^remotes\//,"")})," and set up tracking."]}),(0,s.jsxs)("div",{className:"form-control w-full",children:[(0,s.jsx)("label",{className:"label",children:(0,s.jsx)("span",{className:"label-text",children:"Local Branch Name"})}),(0,s.jsx)("input",{type:"text",className:"input input-bordered w-full",value:t5,onChange:e=>t7((0,i.L9)(e.target.value)),placeholder:"Local branch name",disabled:t6,autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&t5&&!t6&&(e.preventDefault(),nd())}})]}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{className:"btn",onClick:()=>t2(!1),disabled:t6,children:"Cancel"}),(0,s.jsxs)("button",{className:"btn btn-primary",onClick:nd,disabled:!t5||t6,children:[t6&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"})," Checkout"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{onClick:()=>t2(!1),children:"close"})})]}),t9&&(0,s.jsxs)("dialog",{className:"modal modal-open",children:[(0,s.jsxs)("div",{className:"modal-box",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded-full bg-warning/15 text-warning flex items-center justify-center shrink-0",children:(0,s.jsx)("i",{className:"iconoir-warning-triangle text-[20px]","aria-hidden":"true"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("h3",{className:"font-bold text-lg",children:"Uncommitted Changes"}),(0,s.jsxs)("p",{className:"text-sm opacity-80 mt-1",children:["You have uncommitted changes in your workspace. Choose how to handle your changes before switching to branch"," ",(0,s.jsx)("span",{className:"font-bold font-mono text-primary break-all",children:nc}),":"]})]})]}),(0,s.jsxs)("div",{className:"space-y-2.5 my-5",children:[(0,s.jsxs)("label",{className:(0,i.cn)("flex items-start gap-3 p-3.5 rounded-lg border cursor-pointer transition-colors select-none","stash-and-reapply"===ss?"border-primary bg-primary/5 shadow-xs":"border-base-300 hover:bg-base-200/50"),onClick:()=>sl("stash-and-reapply"),children:[(0,s.jsx)("input",{type:"radio",name:"switchBranchStrategy",className:"radio radio-primary radio-sm mt-0.5",checked:"stash-and-reapply"===ss,onChange:()=>sl("stash-and-reapply"),disabled:sn}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"font-semibold text-sm flex items-center gap-2",children:[(0,s.jsx)("span",{children:"Stash and reapply"}),(0,s.jsx)("span",{className:"badge badge-xs badge-primary/20 text-primary font-normal",children:"Default"})]}),(0,s.jsxs)("p",{className:"text-xs opacity-70 mt-0.5 leading-relaxed",children:["Stash current changes, switch to ",(0,s.jsx)("span",{className:"font-mono font-medium",children:nc}),", and reapply your changes."]})]})]}),(0,s.jsxs)("label",{className:(0,i.cn)("flex items-start gap-3 p-3.5 rounded-lg border cursor-pointer transition-colors select-none","discard"===ss?"border-error bg-error/5 shadow-xs":"border-base-300 hover:bg-base-200/50"),onClick:()=>sl("discard"),children:[(0,s.jsx)("input",{type:"radio",name:"switchBranchStrategy",className:"radio radio-error radio-sm mt-0.5",checked:"discard"===ss,onChange:()=>sl("discard"),disabled:sn}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"font-semibold text-sm text-error flex items-center gap-1.5",children:[(0,s.jsx)("i",{className:"iconoir-trash text-[14px]","aria-hidden":"true"}),(0,s.jsx)("span",{children:"Discard changes"})]}),(0,s.jsxs)("p",{className:"text-xs opacity-70 mt-0.5 leading-relaxed",children:["Permanently discard all uncommitted changes before switching. ",(0,s.jsx)("span",{className:"text-error font-medium",children:"This cannot be undone."})]})]})]})]}),(0,s.jsxs)("div",{className:"modal-action",children:[(0,s.jsx)("button",{type:"button",className:"btn",onClick:()=>{se(!1),st(null)},disabled:sn,children:"Cancel"}),(0,s.jsxs)("button",{type:"button",className:(0,i.cn)("btn","discard"===ss?"btn-error":"btn-primary"),onClick:nf,disabled:sn,children:[sn&&(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,s.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,s.jsx)("button",{type:"button",onClick:()=>{sn||(se(!1),st(null))},children:"close"})})]}),(0,s.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 bg-base-100",children:[(0,s.jsxs)("div",{className:"h-[57px] flex items-center justify-between gap-3 px-6 border-b border-base-300 shrink-0 history-header",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,s.jsx)("h1",{className:"font-bold text-lg",children:"History"}),(0,s.jsxs)("div",{className:"relative",ref:s_,children:[(0,s.jsxs)("button",{className:"btn btn-sm gap-2 max-w-[24rem] header-icon-btn",onClick:()=>sT(e=>!e),title:nT,"aria-label":nT,children:[(0,s.jsx)("span",{className:"truncate branch-selector-label",children:nT}),(0,s.jsx)("i",{className:(0,i.cn)("iconoir-nav-arrow-down text-[16px] shrink-0 transition-transform",sD&&"rotate-180"),"aria-hidden":"true"})]}),sD&&(0,s.jsx)("div",{className:"absolute left-0 top-full mt-2 z-50",children:nY})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,s.jsxs)("button",{className:"btn btn-sm gap-2 header-icon-btn",onClick:()=>void nh(),disabled:tY||tI||tk||a1,title:"Fetch latest changes from all remotes","aria-label":"Fetch",children:[tY?(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,s.jsx)("i",{className:"iconoir-refresh text-[16px]","aria-hidden":"true"}),(0,s.jsx)("span",{className:"header-btn-label",children:"Fetch"})]}),(0,s.jsxs)("button",{className:"btn btn-sm gap-2 header-icon-btn",onClick:()=>{l$&&!nH&&nn(l$)},disabled:!!nH||tI||tk||a1,title:nH||`Pull from ${n_?.upstream}`,"aria-label":"Pull",children:[tW?(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,s.jsx)("i",{className:"iconoir-arrow-down text-[16px]","aria-hidden":"true"}),(0,s.jsx)("span",{className:"header-btn-label",children:"Pull"})]}),(0,s.jsxs)("button",{className:"btn btn-sm gap-2 header-icon-btn",onClick:()=>void nz(),disabled:!!nI||tk||a1||tI,title:nI||"Pull all local branches from tracking remote branches","aria-label":"Pull All",children:[tI?(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,s.jsx)("i",{className:"iconoir-fast-arrow-down text-[16px]","aria-hidden":"true"}),(0,s.jsx)("span",{className:"header-btn-label",children:"Pull All"})]}),(0,s.jsxs)("button",{className:"btn btn-sm gap-2 header-icon-btn",onClick:()=>{l$&&!nK&&na(l$)},disabled:!!nK||tI||tk||a1,title:nK||(n_?`Push to ${n_.upstream}`:"Push current branch to remote"),"aria-label":"Push",children:[tj?(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,s.jsx)("i",{className:"iconoir-arrow-up text-[16px]","aria-hidden":"true"}),(0,s.jsx)("span",{className:"header-btn-label",children:"Push"})]})]})]}),(0,s.jsxs)("div",{className:"shrink-0 flex items-center gap-2",children:[(0,s.jsxs)("div",{className:"relative",ref:sK,children:[(0,s.jsxs)("button",{className:"btn btn-sm gap-2 header-icon-btn",onClick:()=>sI(e=>!e),title:`Run custom scripts on ${lL.label}`,"aria-label":"Custom Scripts",children:[(0,s.jsx)("i",{className:"iconoir-code text-[16px]","aria-hidden":"true"}),(0,s.jsx)("span",{className:"header-btn-label",children:"Custom Scripts"}),(0,s.jsx)("i",{className:(0,i.cn)("iconoir-nav-arrow-down text-[14px] shrink-0 transition-transform",sH&&"rotate-180"),"aria-hidden":"true"})]}),sH&&(0,s.jsxs)("div",{className:"absolute right-0 top-full mt-2 z-50 w-72 bg-base-100 rounded-lg shadow-xl border border-base-300 p-2 text-xs",children:[(0,s.jsxs)("div",{className:"px-3 py-2 border-b border-base-200",children:[(0,s.jsx)("div",{className:"text-[10px] uppercase font-bold tracking-wider opacity-60",children:"Target Ref"}),(0,s.jsx)("div",{className:"font-semibold truncate text-xs mt-0.5",children:lL.label}),lL.sublabel&&(0,s.jsx)("div",{className:"text-[11px] opacity-60 truncate mt-0.5",title:lL.sublabel,children:lL.sublabel})]}),(0,s.jsx)("div",{className:"py-1 max-h-56 overflow-auto",children:0===li.length?(0,s.jsx)("div",{className:"px-3 py-3 text-center opacity-60 text-xs",children:"No custom scripts configured."}):li.map(e=>(0,s.jsxs)("button",{className:"w-full text-left px-3 py-2 hover:bg-base-200 rounded flex items-center justify-between gap-2 group transition-colors",onClick:()=>{sI(!1),lW(e,lL.ref)},children:[(0,s.jsx)("span",{className:"font-medium truncate",children:e.name}),(0,s.jsx)("i",{className:"iconoir-play text-[13px] opacity-0 group-hover:opacity-100 text-primary transition-opacity shrink-0","aria-hidden":"true"})]},e.id))}),(0,s.jsx)("div",{className:"pt-2 border-t border-base-200",children:(0,s.jsxs)(_(),{href:`/workspace/custom-scripts?path=${encodeURIComponent(e)}`,className:"w-full btn btn-ghost btn-xs justify-start gap-1.5 font-normal text-xs",onClick:()=>sI(!1),children:[(0,s.jsx)("i",{className:"iconoir-settings text-[14px]","aria-hidden":"true"}),"Manage scripts..."]})})]})]}),(0,s.jsxs)("button",{className:"btn btn-sm gap-2 header-icon-btn",onClick:()=>void nu(),disabled:tZ,title:"Open terminal in repository folder","aria-label":"Open Terminal",children:[tZ?(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,s.jsx)("i",{className:"iconoir-terminal text-[16px]","aria-hidden":"true"}),(0,s.jsx)("span",{className:"header-btn-label",children:"Open Terminal"})]}),(0,s.jsxs)("button",{className:"btn btn-sm gap-2 header-icon-btn",onClick:()=>void nm(),disabled:tQ,title:"Open repository folder in Finder","aria-label":"Open Repo Folder",children:[tQ?(0,s.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,s.jsx)("i",{className:"iconoir-folder text-[16px]","aria-hidden":"true"}),(0,s.jsx)("span",{className:"header-btn-label",children:"Open Repo Folder"})]})]})]}),(0,s.jsx)("div",{className:"flex-1 overflow-hidden relative",children:lH&&S?(0,s.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,s.jsx)("span",{className:"loading loading-spinner loading-lg opacity-50"})}):(0,s.jsx)(d,{ref:s$,commits:lB,selectedHash:W||void 0,selectedHashes:lM,onSelectCommit:l_,onResetToCommit:ng,onRevertCommit:(e,a)=>{sb({hash:e,message:a}),sx(!0)},onCreateTag:e=>{ex(e),eb(""),eg(!1),em(!0)},onCherryPickCommit:(e,a)=>{eG([{hash:e,message:a}]),eq(!0)},onCherryPickSelectedCommits:()=>{lO.length<2||(eG(lO.map(e=>({hash:e.hash,message:e.message}))),eq(!0))},onRewordCommit:(e,a,t,s)=>{sv({hash:e,subject:a,body:t,branch:s}),sw(a),sS(t),sN(!0)},localBranches:C?.branches||[],trackingInfo:C?.trackingInfo,onEndReached:()=>{!w&&g.all.length>=b&&f(e=>e+50)},isLoadingMore:w&&b>100,currentBranch:C?.current,hiddenBranches:lI,getBranchTagContextMenuItems:e=>{if(e.startsWith("tag:")){let a=e.replace(/^tag:\s*/,"").trim();return a?[{label:"Delete Tag",icon:(0,s.jsx)("i",{className:"iconoir-trash text-[14px]","aria-hidden":"true"}),onClick:()=>lJ(a),danger:!0}]:null}if(nW.has(e))return nq({branchRef:e,branchLeafName:e.split("/").pop()||e,currentBranch:l$,isRemote:!1});let a=nG.get(e);return a?nq({branchRef:a,branchLeafName:a.split("/").pop()||e,currentBranch:l$,isRemote:!0}):null}})}),W&&(0,s.jsxs)("div",{className:"flex flex-col overflow-hidden border-t border-base-300 bg-base-200/30",style:{height:sX},children:[(0,s.jsx)("div",{className:(0,i.cn)("h-1.5 cursor-ns-resize flex items-center justify-center hover:bg-base-200 transition-colors group shrink-0",s0&&"bg-base-200"),onMouseDown:s9,children:(0,s.jsx)("div",{className:"w-8 h-1 rounded-full bg-base-300 group-hover:bg-base-content/20 transition-colors"})}),"__LOCAL_CHANGES__"===W?(0,s.jsx)("div",{className:"flex-1 overflow-hidden min-h-0 flex flex-col",children:(0,s.jsx)(E,{repoPath:e,onClose:()=>Z(null)})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex flex-row items-center py-2 px-4 border-b border-base-300 bg-base-100 shrink-0 justify-between gap-4",children:[(0,s.jsx)("div",{className:"flex items-center gap-4 flex-1 min-w-0",children:lT&&lD?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"text-sm font-bold truncate",children:[lD.latestHash.substring(0,7),": ",lD.latestCommit.message]}),(0,s.jsxs)("div",{className:"text-sm font-bold truncate opacity-75",children:[lD.oldestHash.substring(0,7),": ",lD.oldestCommit.message]})]})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"text-sm font-bold truncate",children:lA?.message}),(0,s.jsx)("span",{className:"text-xs font-mono opacity-50 shrink-0",children:W.substring(0,7)})]})}),(0,s.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[!lT&&lA?.author_name&&(0,s.jsx)("span",{className:"text-xs opacity-60 truncate max-w-[200px]",title:lA.author_email,children:lA.author_name}),(0,s.jsx)("button",{className:"ml-2 btn btn-ghost btn-xs btn-square",onClick:()=>Z(null),title:"Close",children:"✕"})]})]}),lT&&lD?(0,s.jsxs)("div",{className:"flex-1 overflow-hidden min-h-0 flex flex-col bg-base-100",children:[(0,s.jsx)("div",{className:"px-4 pt-2 pb-1 text-[10px] uppercase tracking-wider font-bold opacity-60 border-b border-base-300 bg-base-100 shrink-0",children:"Changes"}),(0,s.jsx)("div",{className:"flex-1 min-h-0",children:(0,s.jsx)(j,{repoPath:e,fromCommitHash:lD.oldestHash,toCommitHash:lD.latestHash})})]}):(0,s.jsxs)("div",{ref:s6,className:"flex-1 overflow-hidden bg-base-100 grid",style:{gridTemplateRows:`${s4}fr 6px ${1-s4}fr`},children:[(0,s.jsxs)("div",{className:"border-b border-base-300 bg-base-100 min-h-0 flex flex-col",children:[(0,s.jsx)("div",{className:"px-4 pt-3 pb-1 text-[10px] uppercase tracking-wider font-bold opacity-60",children:"Message"}),(0,s.jsx)("div",{className:"px-4 pb-3 overflow-auto flex-1 min-h-0",children:(0,s.jsx)("div",{className:"text-xs opacity-70 whitespace-pre-wrap font-mono",children:lA?(lA.body?.trim()?`${lA.message}
|
|
6
|
-
|
|
7
|
-
${lA.body}`:lA.message).replace(/\r\n/g,"\n").replace(/\\r\\n/g,"\n").replace(/\\n/g,"\n"):"No additional message"})})]}),(0,s.jsx)("div",{className:(0,i.cn)("cursor-ns-resize flex items-center justify-center hover:bg-base-200/60 transition-colors",s5&&"bg-base-200/60"),onMouseDown:le,children:(0,s.jsx)("div",{className:"w-8 h-1 rounded-full bg-base-300"})}),(0,s.jsxs)("div",{className:"flex-1 overflow-hidden min-h-0 flex flex-col",children:[(0,s.jsx)("div",{className:"px-4 pt-2 pb-1 text-[10px] uppercase tracking-wider font-bold opacity-60 border-b border-base-300 bg-base-100 shrink-0",children:"Changes"}),(0,s.jsx)("div",{className:"flex-1 min-h-0",children:(0,s.jsx)(j,{repoPath:e,commitHash:W})})]})]})]})]})]})]}):(0,s.jsx)("div",{className:"flex items-center justify-center p-8 h-full opacity-70",children:"No history data available"})}},3278:(e,a,t)=>{t.d(a,{C:()=>o,CustomScriptExecutionProvider:()=>i});var s=t(5155),l=t(2115),n=t(5625);let r=(0,l.createContext)(null);function i({children:e}){let a=(0,n.jE)(),[t,i]=(0,l.useState)([]),o=(0,l.useRef)(t);o.current=t;let c=(0,l.useCallback)(async({repoPath:e,branchRef:a,script:t})=>{let s=`temp-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,l={id:s,repoPath:e,branchRef:a,scriptName:t.name,scriptContent:t.content,status:"starting",output:"",error:null,startedAt:new Date().toISOString(),finishedAt:null,isCanceling:!1,isForceCanceling:!1,isModalOpen:!0};i(e=>[...e.map(e=>e.isModalOpen?{...e,isModalOpen:!1}:e),l]);try{let l=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"start",repoPath:e,branchRef:a,scriptContent:t.content})}),n=await l.json();if(!l.ok)throw Error(n.error||"Failed to start script execution");let r=[];return n.previousBranch&&n.checkedOutBranch&&n.previousBranch!==n.checkedOutBranch&&r.push(`[info] Checked out ${n.checkedOutBranch} (from ${n.previousBranch})`),i(e=>e.map(e=>e.id===s?{...e,id:n.executionId,output:[r.join("\n"),n.output].filter(Boolean).join("\n"),status:n.status,error:null}:e)),n.executionId}catch(a){let e=a.message||"Failed to start script";return i(a=>a.map(a=>a.id===s?{...a,status:"failed",error:e,output:a.output?`${a.output}
|
|
8
|
-
[error] ${e}`:`[error] ${e}`,finishedAt:new Date().toISOString()}:a)),s}},[]),d=(0,l.useCallback)(async(e,a)=>{if(o.current.find(a=>a.id===e)){i(t=>t.map(t=>t.id===e?{...t,isCanceling:!0,isForceCanceling:!!a||t.isForceCanceling}:t));try{let t=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"cancel",executionId:e,force:!!a})}),s=await t.json();if(!t.ok)throw Error(s.error||"Failed to cancel script");i(a=>a.map(a=>{if(a.id===e){let e=s.status;return{...a,output:s.output,status:e,isCanceling:"running"===e||"starting"===e,isForceCanceling:!1,finishedAt:s.finishedAt||a.finishedAt}}return a}))}catch(a){i(t=>t.map(t=>t.id===e?{...t,isCanceling:!1,isForceCanceling:!1,output:`${t.output}
|
|
9
|
-
[error] ${a.message}`}:t))}}},[]),h=(0,l.useCallback)(e=>{i(a=>a.map(a=>({...a,isModalOpen:a.id===e})))},[]),m=(0,l.useCallback)(()=>{i(e=>e.map(e=>e.isModalOpen?{...e,isModalOpen:!1}:e))},[]),u=(0,l.useCallback)(e=>{i(a=>a.filter(a=>a.id!==e))},[]);(0,l.useEffect)(()=>{if(0===t.filter(e=>"running"===e.status||"starting"===e.status).length)return;let e=!1,s=null,l=async()=>{let t=o.current.filter(e=>"running"===e.status&&!e.id.startsWith("temp-"));0!==t.length&&(await Promise.all(t.map(async t=>{try{let s=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"status",executionId:t.id})}),l=await s.json();if(!s.ok||e)return;let n=l.status;i(e=>e.map(e=>e.id===t.id?{...e,output:l.output,status:n,finishedAt:l.finishedAt||e.finishedAt,isCanceling:"running"===n&&e.isCanceling}:e)),("completed"===n||"failed"===n||"canceled"===n)&&a.invalidateQueries({queryKey:["git",t.repoPath]})}catch{}})),e||(s=setTimeout(l,500)))};return s=setTimeout(l,500),()=>{e=!0,s&&clearTimeout(s)}},[t,a]);let x=(0,l.useMemo)(()=>t.find(e=>e.isModalOpen)||null,[t]);return(0,s.jsx)(r.Provider,{value:{executions:t,activeModalExecution:x,startScript:c,cancelScript:d,openModal:h,minimizeModal:m,dismissExecution:u},children:e})}function o(){let e=(0,l.useContext)(r);if(!e)throw Error("useCustomScriptExecution must be used within a CustomScriptExecutionProvider");return e}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{302:(e,t,n)=>{"use strict";n.d(t,{v:()=>o});var s=n(2115);let r=[],a=0,l=!1;function i(e){let t,n=(t=r[r.length-1])||null;if(n){if("Escape"===e.key){e.preventDefault(),n.onEscape();return}"Enter"===e.key&&n.onEnter&&!function(e){if(e.defaultPrevented||e.repeat||e.isComposing||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return!0;let t=e.target;if(!t)return!1;if(t.isContentEditable)return!0;let n=t.tagName;return"TEXTAREA"===n||"BUTTON"===n||"SELECT"===n||"OPTION"===n||"A"===n}(e)&&(e.preventDefault(),n.onEnter())}}function o(e,t,n){let o=(0,s.useRef)(t),c=(0,s.useRef)(n);(0,s.useEffect)(()=>{o.current=t},[t]),(0,s.useEffect)(()=>{c.current=n},[n]),(0,s.useEffect)(()=>{if(!e)return;let t=++a;return r.push({id:t,onEscape:()=>o.current(),onEnter:()=>c.current?.()}),!l&&"u">typeof document&&(document.addEventListener("keydown",i),l=!0),()=>{let e=r.findIndex(e=>e.id===t);e>=0&&r.splice(e,1),l&&"u">typeof document&&!(r.length>0)&&(document.removeEventListener("keydown",i),l=!1)}},[e])}},1673:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,421,23)),Promise.resolve().then(n.t.bind(n,9695,23)),Promise.resolve().then(n.t.bind(n,1743,23)),Promise.resolve().then(n.bind(n,2246))},1743:()=>{},2246:(e,t,n)=>{"use strict";n.d(t,{Providers:()=>x});var s=n(5155),r=n(6887),a=n(5625),l=n(2115),i=n(460),o=n(6695);function c(){let{toasts:e}=(0,o.dj)(),[t,n]=(0,l.useState)(!1);return((0,l.useEffect)(()=>{n(!0)},[]),t)?(0,s.jsx)("div",{className:"toast toast-bottom toast-end z-50 p-4 gap-2",children:e.map(e=>{let t="alert-info";return"success"===e.type?t="alert-success":"warning"===e.type||"warning"===e.variant?t="alert-warning":("error"===e.type||"destructive"===e.variant)&&(t="alert-error"),(0,s.jsxs)("div",{className:`alert ${t} shadow-lg max-w-md w-auto flex-col items-start gap-1 p-3 text-sm animate-in fade-in slide-in-from-bottom-2 duration-300`,children:[(0,s.jsxs)("div",{className:"w-full",children:[e.title&&(0,s.jsx)("h3",{className:"font-bold",children:e.title}),e.description&&(0,s.jsx)("div",{className:"opacity-90 break-words",children:e.description})]}),e.action&&(0,s.jsx)("div",{className:"mt-2 w-full",children:e.action})]},e.id)})}):null}var u=n(3321),d=n(696),p=n(8599),m=n(302);function f(e,t){return new Date(t.lastOpenedAt||0).getTime()-new Date(e.lastOpenedAt||0).getTime()}function h(){let e=(0,u.useRouter)(),{data:t}=(0,d.uG)(),[n,r]=(0,l.useState)(!1),[a,i]=(0,l.useState)(""),[o,c]=(0,l.useState)(0),h=(0,l.useRef)(null),x=(0,l.useMemo)(()=>(t||[]).filter(e=>!!e.lastOpenedAt).sort(f).slice(0,5),[t]),v=(0,l.useMemo)(()=>{let e=a.trim().toLowerCase();return e?x.filter(t=>{let n=(0,p.iu)(t).toLowerCase(),s=t.path.toLowerCase();return n.includes(e)||s.includes(e)}):x},[a,x]),y=(0,l.useCallback)(()=>{r(!1),i(""),c(0)},[]),w=0===v.length?-1:Math.min(o,v.length-1),b=(0,l.useCallback)(t=>{y(),e.push(`/workspace?path=${encodeURIComponent(t)}`)},[y,e]);return((0,l.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()&&(e.preventDefault(),r(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,m.v)(n,y),(0,l.useEffect)(()=>{n&&requestAnimationFrame(()=>h.current?.focus())},[n]),n)?(0,s.jsx)("div",{className:"fixed inset-0 z-50 bg-black/40 px-4 py-16",onMouseDown:y,role:"dialog","aria-modal":"true","aria-label":"Command palette",children:(0,s.jsxs)("div",{className:"mx-auto w-full max-w-2xl overflow-hidden rounded-xl border border-base-300 bg-base-100 shadow-2xl",onMouseDown:e=>e.stopPropagation(),children:[(0,s.jsx)("div",{className:"border-b border-base-300 p-3",children:(0,s.jsx)("input",{ref:h,type:"text",value:a,onChange:e=>{i(e.target.value),c(0)},onKeyDown:e=>{if("ArrowDown"===e.key){e.preventDefault(),v.length>0&&c(e=>(e+1)%v.length);return}if("ArrowUp"===e.key){e.preventDefault(),v.length>0&&c(e=>e<=0?v.length-1:e-1);return}if("Enter"===e.key){e.preventDefault();let t=w>=0?v[w]:null;t&&b(t.path)}},placeholder:"Type a command...",className:"input input-ghost w-full text-base focus:outline-none"})}),(0,s.jsxs)("div",{className:"max-h-80 overflow-y-auto py-2",children:[(0,s.jsx)("div",{className:"px-4 pb-2 text-xs font-semibold uppercase tracking-wider opacity-60",children:"Recent repositories"}),0===x.length&&(0,s.jsx)("div",{className:"px-4 py-6 text-sm opacity-60",children:"No recently opened repositories yet."}),x.length>0&&0===v.length&&(0,s.jsx)("div",{className:"px-4 py-6 text-sm opacity-60",children:"No matching repositories."}),v.map((e,t)=>{let n=(0,p.iu)(e);return(0,s.jsxs)("button",{type:"button",className:(0,p.cn)("flex w-full items-center justify-between gap-4 px-4 py-3 text-left",w===t?"bg-base-200":"hover:bg-base-200/70"),onMouseEnter:()=>c(t),onClick:()=>b(e.path),children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("div",{className:"truncate text-sm font-medium",children:n}),(0,s.jsx)("div",{className:"truncate text-xs opacity-65",children:e.path})]}),(0,s.jsx)("span",{className:"text-xs opacity-60",children:"Open"})]},e.path)})]}),(0,s.jsx)("div",{className:"border-t border-base-300 px-4 py-2 text-xs opacity-60",children:"Use ↑ ↓ to navigate, Enter to open, Esc to close."})]})}):null}function x({children:e}){let[t]=(0,l.useState)(()=>new r.E);return(0,s.jsx)(a.Ht,{client:t,children:(0,s.jsxs)(i.N,{attribute:"data-theme",defaultTheme:"system",enableSystem:!0,children:[e,(0,s.jsx)(h,{}),(0,s.jsx)(c,{})]})})}}},e=>{e.O(0,[293,3334,2176,2785,4200,8645,8441,3794,7358],()=>e(e.s=1673)),_N_E=e.O()}]);
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1807],{236:(e,t,s)=>{Promise.resolve().then(s.bind(s,6204)),Promise.resolve().then(s.bind(s,1464)),Promise.resolve().then(s.bind(s,7185)),Promise.resolve().then(s.bind(s,9128)),Promise.resolve().then(s.bind(s,3278))},1464:(e,t,s)=>{"use strict";s.d(t,{ScriptModal:()=>c});var n=s(5155),a=s(2115),i=s(3278),r=s(8599);async function l(e){try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();try{return document.execCommand("copy"),!0}catch{return!1}finally{document.body.removeChild(t)}}}function c(){let{activeModalExecution:e,minimizeModal:t,cancelScript:s,dismissExecution:c}=(0,i.C)(),[o,d]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1),p=(0,a.useRef)(null);(0,a.useEffect)(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[e?.output]),(0,a.useEffect)(()=>{if(!e)return;let s=e=>{"Escape"===e.key&&(e.preventDefault(),t())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e,t]);let h=(0,a.useCallback)(async()=>{if(!e||u)return;m(!0);let t=await l(e.output);m(!1),d(t),t&&setTimeout(()=>d(!1),1500)},[e,u]);if(!e)return null;let x="starting"===e.status||"running"===e.status,b="completed"===e.status||"failed"===e.status||"canceled"===e.status;return(0,n.jsxs)("dialog",{className:"modal modal-open z-50",children:[(0,n.jsxs)("div",{className:"modal-box max-w-4xl max-h-[85vh] flex flex-col",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("h3",{className:"font-bold text-lg truncate",children:["Custom Script: ",e.scriptName]}),(0,n.jsxs)("p",{className:"text-xs opacity-70 mt-1 break-all",children:["Ref: ",e.branchRef]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,n.jsxs)("span",{className:(0,r.cn)("badge badge-sm shrink-0",x?"badge-info":"completed"===e.status?"badge-success":"failed"===e.status?"badge-error":"canceled"===e.status?"badge-warning":"badge-ghost"),children:[x&&(0,n.jsx)("span",{className:"loading loading-spinner loading-xs mr-1"}),e.status]}),(0,n.jsx)("button",{className:"btn btn-ghost btn-xs btn-circle",onClick:t,title:"Minimize to bottom-right corner","aria-label":"Minimize",children:(0,n.jsx)("i",{className:"iconoir-minus text-[16px]","aria-hidden":"true"})})]})]}),(0,n.jsx)("div",{className:"mt-4 border border-base-300 rounded bg-base-200/40 flex-1 overflow-hidden flex flex-col",children:(0,n.jsx)("pre",{ref:p,className:"p-3 font-mono text-xs overflow-auto max-h-[50vh] whitespace-pre-wrap break-words flex-1",children:e.output||"Waiting for output..."})}),e.error&&(0,n.jsx)("div",{className:"alert alert-error py-2 mt-3 text-xs",children:(0,n.jsx)("span",{children:e.error})}),(0,n.jsxs)("div",{className:"modal-action mt-4 flex items-center justify-between",children:[(0,n.jsxs)("button",{type:"button",className:"btn btn-ghost btn-sm gap-1.5",onClick:t,title:"Minimize dialog and keep running in bottom right",children:[(0,n.jsx)("i",{className:"iconoir-minus text-[14px]","aria-hidden":"true"}),"Dock / Minimize"]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,n.jsx)(n.Fragment,{children:e.isCanceling?(0,n.jsxs)("button",{type:"button",className:"btn btn-error btn-sm",onClick:()=>void s(e.id,!0),title:"Force terminate immediately",children:[(0,n.jsx)("span",{className:"loading loading-spinner loading-xs mr-1"}),"Force Kill"]}):(0,n.jsx)("button",{type:"button",className:"btn btn-warning btn-sm",onClick:()=>void s(e.id,!1),children:"Cancel"})}),(0,n.jsxs)("button",{type:"button",className:"btn btn-outline btn-sm",onClick:()=>void h(),disabled:u,children:[u&&(0,n.jsx)("span",{className:"loading loading-spinner loading-xs mr-1"}),o?"Copied":"Copy"]}),b?(0,n.jsx)("button",{type:"button",className:"btn btn-primary btn-sm",onClick:()=>{c(e.id)},children:"Done"}):(0,n.jsx)("button",{type:"button",className:"btn btn-neutral btn-sm",onClick:t,children:"Hide"})]})]})]}),(0,n.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,n.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),t()},children:"close"})})]})}},3278:(e,t,s)=>{"use strict";s.d(t,{C:()=>c,CustomScriptExecutionProvider:()=>l});var n=s(5155),a=s(2115),i=s(5625);let r=(0,a.createContext)(null);function l({children:e}){let t=(0,i.jE)(),[s,l]=(0,a.useState)([]),c=(0,a.useRef)(s);c.current=s;let o=(0,a.useCallback)(async({repoPath:e,branchRef:t,script:s})=>{let n=`temp-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,a={id:n,repoPath:e,branchRef:t,scriptName:s.name,scriptContent:s.content,status:"starting",output:"",error:null,startedAt:new Date().toISOString(),finishedAt:null,isCanceling:!1,isForceCanceling:!1,isModalOpen:!0};l(e=>[...e.map(e=>e.isModalOpen?{...e,isModalOpen:!1}:e),a]);try{let a=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"start",repoPath:e,branchRef:t,scriptContent:s.content})}),i=await a.json();if(!a.ok)throw Error(i.error||"Failed to start script execution");let r=[];return i.previousBranch&&i.checkedOutBranch&&i.previousBranch!==i.checkedOutBranch&&r.push(`[info] Checked out ${i.checkedOutBranch} (from ${i.previousBranch})`),l(e=>e.map(e=>e.id===n?{...e,id:i.executionId,output:[r.join("\n"),i.output].filter(Boolean).join("\n"),status:i.status,error:null}:e)),i.executionId}catch(t){let e=t.message||"Failed to start script";return l(t=>t.map(t=>t.id===n?{...t,status:"failed",error:e,output:t.output?`${t.output}
|
|
2
|
-
[error] ${e}`:`[error] ${e}`,finishedAt:new Date().toISOString()}:t)),n}},[]),d=(0,a.useCallback)(async(e,t)=>{if(c.current.find(t=>t.id===e)){l(s=>s.map(s=>s.id===e?{...s,isCanceling:!0,isForceCanceling:!!t||s.isForceCanceling}:s));try{let s=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"cancel",executionId:e,force:!!t})}),n=await s.json();if(!s.ok)throw Error(n.error||"Failed to cancel script");l(t=>t.map(t=>{if(t.id===e){let e=n.status;return{...t,output:n.output,status:e,isCanceling:"running"===e||"starting"===e,isForceCanceling:!1,finishedAt:n.finishedAt||t.finishedAt}}return t}))}catch(t){l(s=>s.map(s=>s.id===e?{...s,isCanceling:!1,isForceCanceling:!1,output:`${s.output}
|
|
3
|
-
[error] ${t.message}`}:s))}}},[]),u=(0,a.useCallback)(e=>{l(t=>t.map(t=>({...t,isModalOpen:t.id===e})))},[]),m=(0,a.useCallback)(()=>{l(e=>e.map(e=>e.isModalOpen?{...e,isModalOpen:!1}:e))},[]),p=(0,a.useCallback)(e=>{l(t=>t.filter(t=>t.id!==e))},[]);(0,a.useEffect)(()=>{if(0===s.filter(e=>"running"===e.status||"starting"===e.status).length)return;let e=!1,n=null,a=async()=>{let s=c.current.filter(e=>"running"===e.status&&!e.id.startsWith("temp-"));0!==s.length&&(await Promise.all(s.map(async s=>{try{let n=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"status",executionId:s.id})}),a=await n.json();if(!n.ok||e)return;let i=a.status;l(e=>e.map(e=>e.id===s.id?{...e,output:a.output,status:i,finishedAt:a.finishedAt||e.finishedAt,isCanceling:"running"===i&&e.isCanceling}:e)),("completed"===i||"failed"===i||"canceled"===i)&&t.invalidateQueries({queryKey:["git",s.repoPath]})}catch{}})),e||(n=setTimeout(a,500)))};return n=setTimeout(a,500),()=>{e=!0,n&&clearTimeout(n)}},[s,t]);let h=(0,a.useMemo)(()=>s.find(e=>e.isModalOpen)||null,[s]);return(0,n.jsx)(r.Provider,{value:{executions:s,activeModalExecution:h,startScript:o,cancelScript:d,openModal:u,minimizeModal:m,dismissExecution:p},children:e})}function c(){let e=(0,a.useContext)(r);if(!e)throw Error("useCustomScriptExecution must be used within a CustomScriptExecutionProvider");return e}},6204:(e,t,s)=>{"use strict";s.d(t,{ScriptDock:()=>r});var n=s(5155);s(2115);var a=s(3278),i=s(8599);function r(){let{executions:e,openModal:t,cancelScript:s,dismissExecution:r}=(0,a.C)(),l=e.filter(e=>!e.isModalOpen);return 0===l.length?null:(0,n.jsx)("div",{className:"fixed bottom-4 right-4 z-40 flex flex-col gap-2 max-w-sm pointer-events-none",children:l.map(e=>{let a="starting"===e.status||"running"===e.status;return(0,n.jsxs)("div",{className:(0,i.cn)("pointer-events-auto bg-base-100 shadow-xl border rounded-lg p-3 w-84 text-xs transition-all flex flex-col gap-2",a?"border-primary/40 shadow-primary/5":"border-base-300"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"font-semibold truncate text-sm",title:e.scriptName,children:e.scriptName}),(0,n.jsx)("div",{className:"text-[11px] opacity-60 truncate mt-0.5",title:e.branchRef,children:e.branchRef})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,n.jsxs)("span",{className:(0,i.cn)("badge badge-xs font-medium",a?"badge-info animate-pulse":"completed"===e.status?"badge-success":"failed"===e.status?"badge-error":"canceled"===e.status?"badge-warning":"badge-ghost"),children:[a&&(0,n.jsx)("span",{className:"loading loading-spinner loading-xs mr-1 scale-75"}),e.status]}),!a&&(0,n.jsx)("button",{className:"btn btn-ghost btn-xs btn-circle text-base-content/60 hover:text-base-content",onClick:()=>r(e.id),title:"Dismiss","aria-label":"Dismiss",children:(0,n.jsx)("i",{className:"iconoir-xmark text-[14px]","aria-hidden":"true"})})]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1 border-t border-base-200",children:[(0,n.jsxs)("button",{type:"button",className:"btn btn-ghost btn-xs gap-1 font-normal text-xs",onClick:()=>t(e.id),title:"View terminal logs",children:[(0,n.jsx)("i",{className:"iconoir-open-new-window text-[13px]","aria-hidden":"true"}),"View Logs"]}),(0,n.jsx)("div",{className:"flex items-center gap-1",children:a&&(0,n.jsx)(n.Fragment,{children:e.isCanceling?(0,n.jsxs)("button",{type:"button",className:"btn btn-error btn-xs",onClick:()=>void s(e.id,!0),title:"Force kill process immediately",children:[(0,n.jsx)("span",{className:"loading loading-spinner loading-xs mr-1 scale-75"}),"Force Kill"]}):(0,n.jsxs)("button",{type:"button",className:"btn btn-warning btn-xs gap-1",onClick:()=>void s(e.id,!1),title:"Stop process",children:[(0,n.jsx)("i",{className:"iconoir-square text-[11px]","aria-hidden":"true"}),"Stop"]})})})]})]},e.id)})})}},7185:(e,t,s)=>{"use strict";s.d(t,{Sidebar:()=>u});var n=s(5155),a=s(8599),i=s(8500),r=s.n(i),l=s(4131),c=s(3321),o=s(2115),d=s(696);function u({className:e,initialCollapsed:t=!1}){let s=(0,c.usePathname)(),i=(0,c.useSearchParams)(),u=(0,c.useRouter)(),m=i.get("path")||"",p=(0,d.GK)(m||null),[h,x]=(0,o.useState)(t),[b,f]=(0,o.useState)(!1),[g,j]=(0,o.useState)(!1),N=(0,d.Y5)(),{data:y}=(0,d.en)(m||null),v=y?.conflicted?.length??0,w=y?.current?.trim(),C=p?(0,a.iu)(p):m?(0,a.kj)(m):"";(0,o.useEffect)(()=>{let e=null,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>{f(!0)})});return()=>{cancelAnimationFrame(t),null!==e&&cancelAnimationFrame(e)}},[]),(0,o.useEffect)(()=>{localStorage.setItem("workspace-sidebar-collapsed",String(h))},[h]);let k=(0,o.useCallback)(()=>{let e=!h;x(e),N.mutate({sidebarCollapsed:e})},[h,N]),S=(e="")=>{let t=new URLSearchParams(i.toString());return t.delete("tab"),m&&w?t.set("branch",w):m||t.delete("branch"),`/workspace${e}?${t.toString()}`},O=e=>"history"===e?"/workspace"===s||s.startsWith("/workspace/history"):"conflicts"===e?s.startsWith("/workspace/conflicts"):"custom-scripts"===e?s.startsWith("/workspace/custom-scripts"):"settings"===e?s.startsWith("/workspace/settings"):"stashes"===e&&s.startsWith("/workspace/stashes"),E=h?64:256;return(0,n.jsxs)("div",{style:{width:E},className:(0,a.cn)("pb-12 border-r border-base-300 min-h-screen bg-base-100 relative",b&&"transition-all duration-300",e),children:[(0,n.jsx)("div",{className:"space-y-4 py-4",children:(0,n.jsxs)("div",{className:(0,a.cn)("px-3 py-2",h&&"px-2"),children:[(0,n.jsxs)("div",{className:(0,a.cn)("mb-6 flex items-center",h?"flex-col gap-2 px-0":"justify-between px-4"),children:[!h&&(0,n.jsxs)("a",{href:"/",onClick:e=>{e.metaKey||e.ctrlKey||(e.preventDefault(),u.push("/"))},className:"flex items-center gap-2 hover:opacity-80 transition-opacity cursor-pointer text-base-content overflow-hidden",title:C?`${C} - Go to Home`:"Go to Home",children:[p?.icon?(0,n.jsx)("span",{className:"h-5 w-5 flex-shrink-0 flex items-center justify-center text-base leading-none","aria-hidden":"true",children:p.icon}):(0,n.jsx)("img",{src:"/icon.png",alt:"Trident",className:"h-5 w-5 flex-shrink-0"}),(0,n.jsx)("h2",{className:"text-lg font-bold tracking-tight truncate",children:C||"Trident"})]}),h&&(0,n.jsx)("a",{href:"/",onClick:e=>{e.metaKey||e.ctrlKey||(e.preventDefault(),u.push("/"))},className:"flex items-center justify-center h-8 w-8 hover:opacity-80 transition-opacity cursor-pointer",title:C?`${C} - Go to Home`:"Go to Home",children:p?.icon?(0,n.jsx)("span",{className:"h-5 w-5 flex items-center justify-center text-base leading-none","aria-hidden":"true",children:p.icon}):(0,n.jsx)("img",{src:"/icon.png",alt:C||"Trident",className:"h-5 w-5"})}),(0,n.jsx)("div",{className:(0,a.cn)("flex items-center gap-1",h&&"flex-col"),children:(0,n.jsx)("button",{className:"btn btn-ghost btn-sm btn-square",onClick:k,title:h?"Expand sidebar":"Collapse sidebar",children:h?(0,n.jsx)("i",{className:"iconoir-fast-arrow-right text-[16px]","aria-hidden":"true"}):(0,n.jsx)("i",{className:"iconoir-fast-arrow-left text-[16px]","aria-hidden":"true"})})})]}),!h&&m&&(0,n.jsx)("div",{className:"px-4 mb-6",children:(0,n.jsx)("p",{className:"text-[10px] font-mono opacity-60 break-all border border-base-300 rounded p-2 bg-base-200/30",title:m,children:m})}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)(r(),{href:S(),className:(0,a.cn)("btn btn-ghost w-full justify-start font-normal",h?"px-0 justify-center":"",O("history")&&"btn-active font-medium"),title:h?"History":void 0,children:[(0,n.jsx)("i",{className:(0,a.cn)("iconoir-git-fork text-[20px]",!h&&"mr-2"),"aria-hidden":"true"}),!h&&"History"]}),(0,n.jsxs)(r(),{href:S("/conflicts"),className:(0,a.cn)("btn btn-ghost w-full justify-start font-normal",h?"px-0 justify-center":"",O("conflicts")&&"btn-active font-medium"),title:h?`Conflicts${v>0?` (${v})`:""}`:void 0,children:[(0,n.jsxs)("div",{className:(0,a.cn)("relative flex items-center",!h&&"mr-2"),children:[(0,n.jsx)("i",{className:"iconoir-warning-triangle text-[20px]","aria-hidden":"true"}),h&&v>0&&(0,n.jsx)("span",{className:"absolute -top-1 -right-1 badge badge-error badge-xs scale-75",children:v>99?"99+":v})]}),!h&&(0,n.jsxs)("span",{className:"flex-1 flex justify-between items-center",children:["Conflicts",v>0&&(0,n.jsx)("span",{className:"badge badge-sm badge-error",children:v})]})]}),(0,n.jsxs)(r(),{href:S("/stashes"),className:(0,a.cn)("btn btn-ghost w-full justify-start font-normal",h?"px-0 justify-center":"",O("stashes")&&"btn-active font-medium"),title:h?"Stashes":void 0,children:[(0,n.jsx)("i",{className:(0,a.cn)("iconoir-download-square text-[20px]",!h&&"mr-2"),"aria-hidden":"true"}),!h&&"Stashes"]}),(0,n.jsxs)(r(),{href:S("/custom-scripts"),className:(0,a.cn)("btn btn-ghost w-full justify-start font-normal",h?"px-0 justify-center":"",O("custom-scripts")&&"btn-active font-medium"),title:h?"Custom scripts":void 0,children:[(0,n.jsx)("i",{className:(0,a.cn)("iconoir-terminal text-[20px]",!h&&"mr-2"),"aria-hidden":"true"}),!h&&"Custom scripts"]}),(0,n.jsxs)(r(),{href:S("/settings"),className:(0,a.cn)("btn btn-ghost w-full justify-start font-normal",h?"px-0 justify-center":"",O("settings")&&"btn-active font-medium"),title:h?"Settings":void 0,children:[(0,n.jsx)("i",{className:(0,a.cn)("iconoir-settings text-[20px]",!h&&"mr-2"),"aria-hidden":"true"}),!h&&"Settings"]})]})]})}),(0,n.jsx)("div",{className:(0,a.cn)("absolute bottom-4 left-0 w-full",h?"px-2":"px-6"),children:(0,n.jsxs)("div",{className:(0,a.cn)("flex items-center",h?"justify-center":"gap-2"),children:[(0,n.jsx)("button",{className:"btn btn-ghost btn-sm btn-square",onClick:()=>j(!0),title:h?"Preferences":void 0,children:(0,n.jsx)("i",{className:"iconoir-ios-settings text-[20px]","aria-hidden":"true"})}),!h&&(0,n.jsx)("span",{className:"text-xs opacity-70",children:"Preferences"})]})}),(0,n.jsx)(l.g,{open:g,onOpenChange:j})]})}},9128:(e,t,s)=>{"use strict";s.d(t,{WorkspaceRepoOpenTracker:()=>r});var n=s(2115),a=s(3321),i=s(696);function r(){let e=(0,a.usePathname)(),t=(0,a.useSearchParams)().get("path"),{data:s}=(0,i.uG)(),r=(0,i.Lp)(),l=(0,n.useRef)(null);return(0,n.useEffect)(()=>{if(!e.startsWith("/workspace")){l.current=null;return}t&&s?.some(e=>e.path===t)&&l.current!==t&&(l.current=t,r.mutate({path:t,updates:{lastOpenedAt:new Date().toISOString()}}))},[e,t,s,r]),null}}},e=>{e.O(0,[2176,2785,8500,8645,4131,8441,3794,7358],()=>e(e.s=236)),_N_E=e.O()}]);
|
|
File without changes
|
|
File without changes
|