trident-git 0.3.0 → 0.4.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.
Files changed (148) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +12 -12
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/server/app/_global-error.html +2 -2
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +3 -3
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  18. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  23. package/.next/server/app/api/credentials/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/custom-scripts/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/fs/route.js +1 -1
  26. package/.next/server/app/api/fs/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/git/action/route.js +1 -1
  28. package/.next/server/app/api/git/action/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/git/branches/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/git/diff/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/git/log/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/git/status/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/repos/clone/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/repos/route.js +1 -1
  35. package/.next/server/app/api/repos/route.js.nft.json +1 -1
  36. package/.next/server/app/api/repos/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/credentials/page.js +2 -4
  39. package/.next/server/app/credentials/page.js.nft.json +1 -1
  40. package/.next/server/app/credentials/page_client-reference-manifest.js +1 -1
  41. package/.next/server/app/credentials.html +1 -1
  42. package/.next/server/app/credentials.rsc +4 -4
  43. package/.next/server/app/credentials.segments/_full.segment.rsc +4 -4
  44. package/.next/server/app/credentials.segments/_head.segment.rsc +1 -1
  45. package/.next/server/app/credentials.segments/_index.segment.rsc +3 -3
  46. package/.next/server/app/credentials.segments/_tree.segment.rsc +2 -2
  47. package/.next/server/app/credentials.segments/credentials/__PAGE__.segment.rsc +2 -2
  48. package/.next/server/app/credentials.segments/credentials.segment.rsc +1 -1
  49. package/.next/server/app/index.html +1 -1
  50. package/.next/server/app/index.rsc +14 -13
  51. package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -5
  52. package/.next/server/app/index.segments/_full.segment.rsc +14 -13
  53. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  54. package/.next/server/app/index.segments/_index.segment.rsc +3 -3
  55. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  56. package/.next/server/app/page.js +4 -2
  57. package/.next/server/app/page.js.nft.json +1 -1
  58. package/.next/server/app/page_client-reference-manifest.js +1 -1
  59. package/.next/server/app/workspace/changes/page.js +2 -2
  60. package/.next/server/app/workspace/changes/page_client-reference-manifest.js +1 -1
  61. package/.next/server/app/workspace/changes.html +1 -1
  62. package/.next/server/app/workspace/changes.rsc +6 -6
  63. package/.next/server/app/workspace/changes.segments/_full.segment.rsc +6 -6
  64. package/.next/server/app/workspace/changes.segments/_head.segment.rsc +1 -1
  65. package/.next/server/app/workspace/changes.segments/_index.segment.rsc +3 -3
  66. package/.next/server/app/workspace/changes.segments/_tree.segment.rsc +2 -2
  67. package/.next/server/app/workspace/changes.segments/workspace/changes/__PAGE__.segment.rsc +2 -2
  68. package/.next/server/app/workspace/changes.segments/workspace/changes.segment.rsc +1 -1
  69. package/.next/server/app/workspace/changes.segments/workspace.segment.rsc +3 -3
  70. package/.next/server/app/workspace/custom-scripts/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app/workspace/custom-scripts.html +1 -1
  72. package/.next/server/app/workspace/custom-scripts.rsc +6 -6
  73. package/.next/server/app/workspace/custom-scripts.segments/_full.segment.rsc +6 -6
  74. package/.next/server/app/workspace/custom-scripts.segments/_head.segment.rsc +1 -1
  75. package/.next/server/app/workspace/custom-scripts.segments/_index.segment.rsc +3 -3
  76. package/.next/server/app/workspace/custom-scripts.segments/_tree.segment.rsc +2 -2
  77. package/.next/server/app/workspace/custom-scripts.segments/workspace/custom-scripts/__PAGE__.segment.rsc +2 -2
  78. package/.next/server/app/workspace/custom-scripts.segments/workspace/custom-scripts.segment.rsc +1 -1
  79. package/.next/server/app/workspace/custom-scripts.segments/workspace.segment.rsc +3 -3
  80. package/.next/server/app/workspace/history/page_client-reference-manifest.js +1 -1
  81. package/.next/server/app/workspace/history.html +1 -1
  82. package/.next/server/app/workspace/history.rsc +6 -6
  83. package/.next/server/app/workspace/history.segments/_full.segment.rsc +6 -6
  84. package/.next/server/app/workspace/history.segments/_head.segment.rsc +1 -1
  85. package/.next/server/app/workspace/history.segments/_index.segment.rsc +3 -3
  86. package/.next/server/app/workspace/history.segments/_tree.segment.rsc +2 -2
  87. package/.next/server/app/workspace/history.segments/workspace/history/__PAGE__.segment.rsc +2 -2
  88. package/.next/server/app/workspace/history.segments/workspace/history.segment.rsc +1 -1
  89. package/.next/server/app/workspace/history.segments/workspace.segment.rsc +3 -3
  90. package/.next/server/app/workspace/page.js +2 -2
  91. package/.next/server/app/workspace/page_client-reference-manifest.js +1 -1
  92. package/.next/server/app/workspace/settings/page_client-reference-manifest.js +1 -1
  93. package/.next/server/app/workspace/settings.html +1 -1
  94. package/.next/server/app/workspace/settings.rsc +6 -6
  95. package/.next/server/app/workspace/settings.segments/_full.segment.rsc +6 -6
  96. package/.next/server/app/workspace/settings.segments/_head.segment.rsc +1 -1
  97. package/.next/server/app/workspace/settings.segments/_index.segment.rsc +3 -3
  98. package/.next/server/app/workspace/settings.segments/_tree.segment.rsc +2 -2
  99. package/.next/server/app/workspace/settings.segments/workspace/settings/__PAGE__.segment.rsc +2 -2
  100. package/.next/server/app/workspace/settings.segments/workspace/settings.segment.rsc +1 -1
  101. package/.next/server/app/workspace/settings.segments/workspace.segment.rsc +3 -3
  102. package/.next/server/app/workspace/stashes/page_client-reference-manifest.js +1 -1
  103. package/.next/server/app/workspace/stashes.html +1 -1
  104. package/.next/server/app/workspace/stashes.rsc +6 -6
  105. package/.next/server/app/workspace/stashes.segments/_full.segment.rsc +6 -6
  106. package/.next/server/app/workspace/stashes.segments/_head.segment.rsc +1 -1
  107. package/.next/server/app/workspace/stashes.segments/_index.segment.rsc +3 -3
  108. package/.next/server/app/workspace/stashes.segments/_tree.segment.rsc +2 -2
  109. package/.next/server/app/workspace/stashes.segments/workspace/stashes/__PAGE__.segment.rsc +2 -2
  110. package/.next/server/app/workspace/stashes.segments/workspace/stashes.segment.rsc +1 -1
  111. package/.next/server/app/workspace/stashes.segments/workspace.segment.rsc +3 -3
  112. package/.next/server/app/workspace.html +1 -1
  113. package/.next/server/app/workspace.rsc +6 -6
  114. package/.next/server/app/workspace.segments/_full.segment.rsc +6 -6
  115. package/.next/server/app/workspace.segments/_head.segment.rsc +1 -1
  116. package/.next/server/app/workspace.segments/_index.segment.rsc +3 -3
  117. package/.next/server/app/workspace.segments/_tree.segment.rsc +2 -2
  118. package/.next/server/app/workspace.segments/workspace/__PAGE__.segment.rsc +2 -2
  119. package/.next/server/app/workspace.segments/workspace.segment.rsc +3 -3
  120. package/.next/server/app-paths-manifest.json +12 -12
  121. package/.next/server/chunks/392.js +1 -1
  122. package/.next/server/chunks/455.js +3 -0
  123. package/.next/server/chunks/471.js +4 -4
  124. package/.next/server/chunks/557.js +1 -1
  125. package/.next/server/chunks/739.js +6 -4
  126. package/.next/server/chunks/781.js +1 -1
  127. package/.next/server/chunks/946.js +1 -1
  128. package/.next/server/pages/404.html +1 -1
  129. package/.next/server/pages/500.html +2 -2
  130. package/.next/server/server-reference-manifest.json +1 -1
  131. package/.next/static/chunks/{131-7599c38c2eb54305.js → 131-4e059eb668f6734a.js} +1 -1
  132. package/.next/static/chunks/147-64f7ae9eceb783be.js +8 -0
  133. package/.next/static/chunks/26-71a5a763fed8540a.js +1 -0
  134. package/.next/static/chunks/{772-b39107b40c31b6b6.js → 437-856aae031cb5746d.js} +3 -3
  135. package/.next/static/chunks/app/credentials/page-98f6c498c4356393.js +1 -0
  136. package/.next/static/chunks/app/page-b6a88311748e2958.js +1 -0
  137. package/.next/static/chunks/app/workspace/changes/page-332cb9b7837d465b.js +3 -0
  138. package/.next/static/css/c4117eb58c7d0642.css +1 -0
  139. package/package.json +1 -1
  140. package/public/github.png +0 -0
  141. package/.next/static/chunks/147-d4cb3e03218d75df.js +0 -6
  142. package/.next/static/chunks/26-0e6386c43f055f59.js +0 -1
  143. package/.next/static/chunks/app/credentials/page-9d0b6c0a8cf1ce2f.js +0 -1
  144. package/.next/static/chunks/app/page-157b05e7d700b845.js +0 -1
  145. package/.next/static/chunks/app/workspace/changes/page-e8bc3001e0ce1bb9.js +0 -3
  146. package/.next/static/css/aba7f1cbfd108b5e.css +0 -1
  147. /package/.next/static/{rozD2mKp-fnaizXZhYJKN → IsI_X7X1cKXUpjpCKYBiv}/_buildManifest.js +0 -0
  148. /package/.next/static/{rozD2mKp-fnaizXZhYJKN → IsI_X7X1cKXUpjpCKYBiv}/_ssgManifest.js +0 -0
@@ -0,0 +1,8 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[147],{302:(e,a,s)=>{s.d(a,{v:()=>o});var t=s(2115);let l=[],n=0,r=!1;function i(e){if("Escape"!==e.key)return;let a=l[l.length-1];a&&(e.preventDefault(),a.onEscape())}function o(e,a){let s=(0,t.useRef)(a);(0,t.useEffect)(()=>{s.current=a},[a]),(0,t.useEffect)(()=>{if(!e)return;let a=++n;return l.push({id:a,onEscape:()=>s.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])}},7147:(e,a,s)=>{s.d(a,{u:()=>F});var t=s(5155),l=s(696),n=s(5625),r=s(2115);function i(e){let a=0x811c9dc5;for(let s=0;s<e.length;s++)a^=e.charCodeAt(s),a=Math.imul(a,0x1000193);return a>>>0}var o=s(8599);function c({children:e,items:a,containerClassName:s="w-full"}){let[l,n]=(0,r.useState)(!1),[i,c]=(0,r.useState)({x:0,y:0}),d=(0,r.useRef)(null),h=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!l)return;let e=e=>{d.current&&!d.current.contains(e.target)&&h.current&&!h.current.contains(e.target)&&n(!1)},a=e=>{"Escape"===e.key&&n(!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,r.useEffect)(()=>{if(!l||!d.current)return;let e=d.current;requestAnimationFrame(()=>{let s=document.createElement("div");s.style.position="absolute",s.style.visibility="hidden",s.style.whiteSpace="nowrap",s.style.pointerEvents="none";let t=window.getComputedStyle(e);s.style.fontSize=t.fontSize,s.style.fontFamily=t.fontFamily,s.style.fontWeight=t.fontWeight,s.style.padding="0.5rem 0.75rem",s.style.boxSizing="border-box",document.body.appendChild(s);let l=0;a.forEach(e=>{s.textContent=e.label;let a=s.getBoundingClientRect().width;a>l&&(l=a)}),document.body.removeChild(s);let n=Math.max(l+32,280);e.style.width=`${n}px`,e.style.minWidth=`${n}px`;let r=e.getBoundingClientRect(),o=window.innerWidth,c=window.innerHeight,d=i.x,h=i.y;r.right>o&&(d=o-r.width-10),d<10&&(d=10),r.bottom>c&&(h=c-r.height-10),h<10&&(h=10),(d!==i.x||h!==i.y)&&(e.style.left=`${d}px`,e.style.top=`${h}px`)})},[l,i,a]);let m=(e,a)=>{let s=!!e.children?.length;return(0,t.jsxs)("li",{className:(0,o.cn)(s&&"relative group/submenu"),children:[(0,t.jsxs)("a",{onClick:a=>{a.stopPropagation(),e.disabled||s||(e.onClick?.(),n(!1))},className:(0,o.cn)("whitespace-nowrap",e.danger&&"text-error",e.disabled&&"opacity-40 pointer-events-none",s&&"flex items-center justify-between gap-3"),children:[(0,t.jsx)("span",{children:e.labelNode??e.label}),s&&(0,t.jsx)("i",{className:"iconoir-nav-arrow-right text-[12px]","aria-hidden":"true"})]}),s&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"hidden group-hover/submenu:block absolute left-full top-0 h-full w-3"}),(0,t.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,s)=>m(e,`${a}-${s}`))})]})]},a)};return(0,t.jsxs)("div",{ref:h,className:s,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),c({x:e.clientX,y:e.clientY}),n(!0)},children:[e,l&&(0,t.jsx)("ul",{ref:d,className:"fixed z-[9999] menu p-2 shadow-lg bg-base-100 rounded-box border border-base-200",style:{left:`${i.x}px`,top:`${i.y}px`},children:a.map((e,a)=>m(e,`menu-${a}`))})]})}function d({text:e,searchQuery:a}){if(!a||!e)return(0,t.jsx)(t.Fragment,{children:e});let s=a.toLowerCase(),l=e.toLowerCase(),n=[],r=0,i=l.indexOf(s);for(;-1!==i;)i>r&&n.push({text:e.slice(r,i),highlighted:!1}),n.push({text:e.slice(i,i+s.length),highlighted:!0}),r=i+s.length,i=l.indexOf(s,r);return(r<e.length&&n.push({text:e.slice(r),highlighted:!1}),0===n.length)?(0,t.jsx)(t.Fragment,{children:e}):(0,t.jsx)(t.Fragment,{children:n.map((e,a)=>e.highlighted?(0,t.jsx)("mark",{className:"bg-warning text-warning-content rounded-sm px-0.5",children:e.text},a):(0,t.jsx)("span",{children:e.text},a))})}let h=(0,r.forwardRef)(function({commits:e,onSelectCommit:a,onResetToCommit:s,onRevertCommit:l,onCreateTag:n,onCherryPickCommit:h,onCherryPickSelectedCommits:m,onRewordCommit:u,selectedHash:x,selectedHashes:p,onEndReached:b,isLoadingMore:f,currentBranch:g,hiddenBranches:j,localBranches:N=[],trackingInfo:y,getBranchTagContextMenuItems:k},v){let w=(0,r.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,r.useCallback)(e=>e.startsWith("tag:")?e.replace(/^tag:\s*/,"").trim():e,[]),S=(0,r.useMemo)(()=>(function(e,a={}){let s=[],t=new Set(a.localBranches??[]),l=[],n=[],r=[];function o(){for(let e=0;e<l.length;e++)if(null===l[e])return e;return l.length}function c(e){let a,s=r[e],t=s?(a=i(s),`hsl(${a%360} 82% 52%)`):n[e]??`hsl(${47*e%360} 78% 56%)`;return n[e]=t,t}return e.forEach((e,a)=>{var i;let d=l.indexOf(e.hash);for(-1===d&&(d=o());l.length<=d;)l.push(null),r.push(null),n.push(void 0);let h=function(e,a){if(0===e.length)return null;let s=e.find(e=>a.has(e));return s||e[0]}((i=e.refs)?i.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)):[],t);if(h){let e=function(e,a){let s,t;if(a.has(e))return e;let l=-1===(t=(s=e.startsWith("remotes/")?e.slice(8):e).indexOf("/"))?null:s.slice(t+1);return l&&a.has(l)?l:e}(h,t);(function(e,a,s){return!a||s.has(e)&&!s.has(a)})(e,r[d],t)&&(r[d]=e)}let m=c(d),u={...e,x:d,y:a,color:m,paths:[],isMerge:e.parents.length>1};for(let e=0;e<l.length;e++)e!==d&&null!==l[e]&&u.paths.push({x1:e,y1:a,x2:e,y2:a+1,color:c(e),type:"straight"});l[d]=null;let x=e.parents;if(x.length>0){let e=x[0],s=l.indexOf(e);-1!==s?u.paths.push({x1:d,y1:a,x2:s,y2:a+1,color:m,type:"merge"}):(l[d]=e,u.paths.push({x1:d,y1:a,x2:d,y2:a+1,color:m,type:"straight"}));for(let e=1;e<x.length;e++){let s=x[e],t=l.indexOf(s);if(-1!==t)u.paths.push({x1:d,y1:a,x2:t,y2:a+1,color:c(t),type:"fork"});else{let e=o();for(;l.length<=e;)l.push(null),r.push(null),n.push(void 0);l[e]=s,u.paths.push({x1:d,y1:a,x2:e,y2:a+1,color:c(e),type:"fork"})}}}null===l[d]&&(r[d]=null,n[d]=void 0),s.push(u)}),s})(e,{localBranches:N}),[e,N]),R=(0,r.useRef)(null),E=(0,r.useRef)(null),[$,B]=(0,r.useState)(!1),[M,P]=(0,r.useState)("");(0,r.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"f"===e.key&&(e.preventDefault(),B(!0),setTimeout(()=>E.current?.focus(),0)),"Escape"===e.key&&$&&(B(!1),P(""))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[$]);let F=(0,r.useCallback)(()=>{B(!1),P("")},[]);if((0,r.useImperativeHandle)(v,()=>({scrollToCommit:e=>{if(!S||0===S.length)return!1;let a=S.findIndex(a=>a.hash===e);if(-1===a)return!1;if(R.current){let e=24*a-R.current.clientHeight/2+12;R.current.scrollTop=Math.max(0,e)}return!0}}),[S]),!S||0===S.length)return null;let D=(Math.max(...S.map(e=>e.x),0)+1)*12+20,T=24*S.length;return(0,t.jsxs)("div",{className:"flex flex-col h-full bg-base-100 overflow-hidden font-mono text-sm select-none",children:[$&&(0,t.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,t.jsx)("span",{className:"opacity-50",children:"\uD83D\uDD0D"}),(0,t.jsx)("input",{ref:E,type:"text",placeholder:"Search in commits...",value:M,onChange:e=>P(e.target.value),className:"input input-bordered input-sm flex-1 text-sm",autoFocus:!0}),(0,t.jsx)("div",{className:"tooltip tooltip-left z-50","data-tip":"Close search (Esc)",children:(0,t.jsx)("button",{onClick:F,className:"btn btn-ghost btn-sm btn-square",children:"✖️"})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-auto h-full max-w-full px-2",onScroll:e=>{let{scrollTop:a,clientHeight:s,scrollHeight:t}=e.currentTarget;t-a-s<100&&b?.()},ref:R,children:(0,t.jsxs)("div",{className:"relative min-w-full",style:{height:T},children:[(0,t.jsxs)("svg",{width:D,height:T,className:"absolute top-0 left-0 pointer-events-none z-10",children:[S.map(e=>(0,t.jsx)("g",{children:e.paths.map((e,a)=>{let s=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 ${s} ${l} L ${n} ${r}`;else{let e=l+12,a=r-12;i=`M ${s} ${l} C ${s} ${e}, ${n} ${a}, ${n} ${r}`}return(0,t.jsx)("path",{d:i,stroke:e.color,strokeWidth:2,fill:"none",strokeLinecap:"round"},a)})},e.hash)),S.map(e=>(0,t.jsx)("circle",{cx:12*e.x+6,cy:24*e.y+12,r:3,fill:e.color,stroke:e.color,strokeWidth:2},`dot-${e.hash}`))]}),(0,t.jsxs)("div",{style:{width:"100%"},children:[S.map(e=>{let r=p?p.has(e.hash):x===e.hash,b=p?.size??+!!x,f=[{label:"Reset to here",onClick:()=>s?.(e.hash)}];if(l&&f.push({label:"Revert commit",onClick:()=>l(e.hash,e.message)}),n&&f.push({label:"Create tag",onClick:()=>n(e.hash)}),h&&f.push({label:"Cherry-pick commit",onClick:()=>h(e.hash,e.message)}),m&&b>1&&r&&f.push({label:`Cherry-pick ${b} selected commits`,onClick:m}),u&&N&&N.length>0){let a=e.refs?e.refs.replace(/[()]/g,"").split(",").map(e=>e.trim()):[],s=null;for(let e of a){let a=e.replace(/^HEAD\s*->\s*/,"");if(N.includes(a)&&(s=a,g&&a===g))break}s&&f.push({label:"Reword commit",onClick:()=>u(e.hash,e.message,e.body??"",s)})}let v=(()=>{if(!e.refs)return[];let a=e.refs.replace(/^\s*\((.*)\)\s*$/,"$1").split(",").map(e=>{let a=e.startsWith("HEAD -> "),s=w(e.replace(/^HEAD\s*->\s*/,"").trim());return{raw:e,name:s,isHead:a}}),s=[],t=new Set,l=e=>j&&(j.has(e)||j.has(`remotes/${e}`));return a.forEach((e,n)=>{if(!t.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&&!t.has(a)&&i.has(e.name));if(-1!==o){let l=a[o],i=r.split("/")[0];s.push({displayName:`${e.name} (${i})`,primaryRef:e.name,secondaryRef:l.name,isHead:e.isHead}),t.add(n),t.add(o);return}}}}),a.forEach((e,a)=>{!t.has(a)&&(l(e.name)||s.push({displayName:C(e.name),primaryRef:e.name,isHead:e.isHead}))}),s})();return(0,t.jsx)(c,{items:f,children:(0,t.jsxs)("div",{className:(0,o.cn)("flex items-center hover:bg-base-200 border-b border-base-200 last:border-0 cursor-pointer transition-colors text-xs",r&&"bg-primary/10"),style:{height:24},onClick:s=>a?.(e.hash,{isMultiSelect:s.metaKey||s.ctrlKey,isRangeSelect:s.shiftKey}),children:[(0,t.jsx)("div",{style:{width:D,flexShrink:0}}),(0,t.jsxs)("div",{className:"flex flex-1 gap-4 overflow-hidden pr-4 items-center",children:[(0,t.jsxs)("div",{className:"flex-1 truncate flex items-center gap-2",children:[v.map((e,a)=>{let s=g&&(e.primaryRef===g||e.isHead&&e.primaryRef===g),l=e.primaryRef.startsWith("tag:")?{textColor:"#374151",backgroundColor:"#e5e7eb"}:function(e){let a,s,t,l,n,r,o,c,d,h=i(e),m=h%360,u=72+(h>>>9)%20,x=84+(h>>>17)%8,p=1.05/((d=function({r:e,g:a,b:s}){let t=e=>{let a=e/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)};return .2126*t(e)+.7152*t(a)+.0722*t(s)}((s=u/100*(1-Math.abs(2*(a=x/100)-1)),l=s*(1-Math.abs((t=m/60)%2-1)),n=0,r=0,o=0,t>=0&&t<1?(n=s,r=l):t>=1&&t<2?(n=l,r=s):t>=2&&t<3?(r=s,o=l):t>=3&&t<4?(r=l,o=s):t>=4&&t<5?(n=l,o=s):(n=s,o=l),{r:Math.round((n+(c=a-s/2))*255),g:Math.round((r+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,t.jsx)("span",{className:(0,o.cn)("text-[10px] px-1.5 rounded-full whitespace-nowrap shrink-0",s&&"font-bold"),style:{color:l.textColor,backgroundColor:l.backgroundColor},title:e.displayName,children:(0,t.jsx)(d,{text:e.displayName,searchQuery:M})}),r=k?.(e.primaryRef)||[];return 0===r.length?(0,t.jsx)("span",{className:"shrink-0",children:n},a):(0,t.jsx)(c,{items:r,containerClassName:"inline-flex shrink-0",children:n},a)}),(0,t.jsx)("span",{className:(0,o.cn)("truncate min-w-0 max-w-[600px]",r?"font-semibold":""),title:e.message,children:(0,t.jsx)(d,{text:e.message,searchQuery:M})})]}),(0,t.jsx)("div",{className:"w-32 truncate opacity-70 text-right",children:(0,t.jsx)(d,{text:e.author_name,searchQuery:M})}),(0,t.jsx)("div",{className:"w-20 truncate opacity-50 font-mono text-right",children:(0,t.jsx)(d,{text:e.hash.substring(0,7),searchQuery:M})}),(0,t.jsx)("div",{className:"w-32 truncate opacity-70 text-right",children:new Date(e.date).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]})]})},e.hash)}),f&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-8 border-b border-base-300",children:[(0,t.jsx)("span",{className:"loading loading-spinner text-base-content/50"}),(0,t.jsx)("span",{className:"ml-2 text-sm opacity-70",children:"Loading more commits..."})]})]})]})})]})});var m=s(460),u=s(6162),x=s(4254),p=s(302),b=s(6695);function f(e){return Math.min(Math.max(e,100),900)}function g(e){return Math.min(Math.max(e,.15),.75)}async function j(e){try{return await navigator.clipboard.writeText(e),!0}catch{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-9999px",document.body.appendChild(a),a.select();try{return document.execCommand("copy"),!0}catch{return!1}finally{document.body.removeChild(a)}}}let N={isOpen:!1,executionId:null,scriptName:"",branchRef:"",output:"",status:"idle",error:null};function y({status:e}){switch(e){case"A":return(0,t.jsx)("i",{className:"iconoir-plus-circle text-[16px] text-success","aria-hidden":"true"});case"D":return(0,t.jsx)("i",{className:"iconoir-minus-circle text-[16px] text-error","aria-hidden":"true"});case"M":return(0,t.jsx)("i",{className:"iconoir-edit-pencil text-[16px] text-warning","aria-hidden":"true"});default:return(0,t.jsx)("i",{className:"iconoir-page text-[16px] opacity-50","aria-hidden":"true"})}}function k({node:e,selectedFile:a,expandedFolders:s,onToggleFolder:l,onSelectFile:n,depth:r=0}){let i=Array.from(e.children.values()).sort((e,a)=>{let s=e.children.size>0,t=a.children.size>0;return s&&!t?-1:!s&&t?1:e.name.localeCompare(a.name)});return(0,t.jsx)(t.Fragment,{children:i.map(e=>{if(e.children.size>0){let i=s.has(e.path);return(0,t.jsxs)("div",{children:[(0,t.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,t.jsx)("span",{className:"text-[10px] opacity-70",children:i?"▼":"▶"}),(0,t.jsx)("i",{className:"iconoir-folder text-[14px] opacity-70","aria-hidden":"true"}),(0,t.jsx)("span",{className:"truncate flex-1",children:e.name})]}),i&&(0,t.jsx)(k,{node:e,selectedFile:a,expandedFolders:s,onToggleFolder:l,onSelectFile:n,depth:r+1})]},e.path)}if(!e.file)return null;let i=e.file;return(0,t.jsxs)("div",{className:(0,o.cn)("flex items-center gap-2 px-2 py-1.5 text-xs rounded cursor-pointer hover:bg-base-200 transition-colors",a===i.path&&"bg-base-200 font-medium"),style:{paddingLeft:`${12*r+8}px`},onClick:()=>n(i.path),title:i.path,children:[(0,t.jsx)(y,{status:i.status}),(0,t.jsx)("span",{className:"truncate flex-1 font-mono",children:e.name})]},e.path)})})}function v({repoPath:e,commitHash:a,filePath:s,splitView:n}){let{data:i,isLoading:c}=(0,l.st)(e,a,s),{resolvedTheme:d}=(0,m.D)(),[h,p]=(0,r.useState)(!1);if((0,r.useEffect)(()=>{p(!1)},[s,a]),c)return(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)("span",{className:"loading loading-spinner text-base-content/50"})});if(!i)return(0,t.jsx)("div",{className:"flex items-center justify-center p-8 opacity-50",children:"No diff available"});if((0,o.u)(s))return(0,t.jsx)(x.K,{filePath:s,imageDiff:i.imageDiff});if((0,o.kO)(s,i.left,i.right))return(0,t.jsx)("div",{className:"flex items-center justify-center p-8 opacity-50",children:"Binary file - diff not available"});let b=i.diff||"",f=b.length,g=(0,o.tq)(b);return(f>102400||g>3e3)&&!h?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center p-8",children:[(0,t.jsx)("i",{className:"iconoir-warning-triangle text-[32px] text-warning","aria-hidden":"true"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Large Diff Detected"}),(0,t.jsxs)("p",{className:"opacity-70",children:["This diff is large (",Math.round(f/1024),"KB, ~",g," changed lines) and may freeze your browser if rendered."]})]}),(0,t.jsx)("button",{className:"btn btn-outline",onClick:()=>p(!0),children:"Show Diff Anyway"})]}):(0,t.jsx)("div",{className:"overflow-auto h-full",children:(0,t.jsx)(u.O,{oldValue:i.left||"",newValue:i.right||"",splitView:n,useDarkTheme:"dark"===d})})}function w({repoPath:e,commitHash:a}){let{data:s,isLoading:n}=(0,l.gg)(e,a),[i,c]=(0,r.useState)(null),[d,h]=(0,r.useState)(!1),[m,u]=(0,r.useState)({}),x=(0,r.useMemo)(()=>(function(e){let a={name:"",path:"",children:new Map};for(let s of e){let e=s.path.split("/").filter(Boolean),t=a,l="";for(let a=0;a<e.length;a++){let n=e[a];l=l?`${l}/${n}`:n,t.children.has(n)||t.children.set(n,{name:n,path:l,children:new Map}),t=t.children.get(n),a===e.length-1&&(t.file=s)}}return a})(s?.files??[]),[s?.files]),b=(0,r.useMemo)(()=>(function e(a){let s=[];return Array.from(a.children.values()).forEach(a=>{a.children.size>0&&(s.push(a.path),s.push(...e(a)))}),s})(x),[x]),f=(0,r.useMemo)(()=>m[a]??new Set,[m,a]),g="git-web:diff-view-split",[j,N]=(0,r.useState)(()=>{try{let e=localStorage.getItem(g);return null===e||JSON.parse(e)}catch(e){return console.error("Failed to load split view preference:",e),!0}});(0,r.useEffect)(()=>{try{localStorage.setItem(g,JSON.stringify(j))}catch(e){console.error("Failed to save split view preference:",e)}},[j]),(0,r.useEffect)(()=>{c(null)},[a]),(0,r.useEffect)(()=>{!i&&s?.files&&s.files.length>0&&c(s.files[0].path)},[s?.files,i]),(0,p.v)(d,()=>h(!1)),(0,r.useEffect)(()=>{if(!d)return;let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[d]);let y=(0,r.useMemo)(()=>{let e=new Set;return b.forEach(a=>{f.has(a)||e.add(a)}),i&&(function(e){let a=e.split("/").filter(Boolean),s=[];for(let e=1;e<a.length;e++)s.push(a.slice(0,e).join("/"));return s})(i).forEach(a=>e.add(a)),e},[b,f,i]),w=(0,r.useCallback)(e=>{u(s=>{let t=new Set(s[a]??new Set);return t.has(e)?t.delete(e):t.add(e),{...s,[a]:t}})},[a]);return n?(0,t.jsx)("div",{className:"flex items-center justify-center p-8 h-full",children:(0,t.jsx)("span",{className:"loading loading-spinner text-base-content/50"})}):s&&0!==s.files.length?(0,t.jsxs)("div",{className:(0,o.cn)("flex h-full",d&&"fixed inset-0 z-[80] h-auto bg-base-100 shadow-2xl"),children:[(0,t.jsxs)("div",{className:"w-64 border-r border-base-300 flex flex-col bg-base-200/30 shrink-0",children:[(0,t.jsxs)("div",{className:"px-3 py-2 text-xs font-bold opacity-70 border-b border-base-300 bg-base-100",children:[s.files.length," file",1!==s.files.length?"s":""," changed"]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:(0,t.jsx)("div",{className:"p-1",children:(0,t.jsx)(k,{node:x,selectedFile:i,expandedFolders:y,onToggleFolder:w,onSelectFile:c})})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden",children:i?(0,t.jsxs)("div",{className:"h-full flex flex-col",children:[(0,t.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,t.jsx)("span",{className:"truncate",children:i}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0 ml-4",children:[(0,t.jsx)("label",{htmlFor:"commit-diff-split-view",className:"text-[10px] uppercase tracking-wider font-bold cursor-pointer opacity-70",children:"Split View"}),(0,t.jsx)("input",{type:"checkbox",id:"commit-diff-split-view",checked:j,onChange:e=>N(e.target.checked),className:"toggle toggle-xs toggle-primary"}),(0,t.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs btn-square",onClick:()=>h(e=>!e),"aria-label":d?"Exit full-page diff view":"Expand diff viewer to full page",title:d?"Exit full-page diff view":"Expand diff viewer to full page",children:(0,t.jsx)("i",{className:(0,o.cn)(d?"iconoir-collapse":"iconoir-maximize","text-[14px]"),"aria-hidden":"true"})})]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-auto diff-viewer-wrapper",children:(0,t.jsx)(v,{repoPath:e,commitHash:a,filePath:i,splitView:j})})]}):(0,t.jsx)("div",{className:"flex items-center justify-center h-full opacity-70 text-sm",children:"Select a file to view changes"})})]}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8 h-full opacity-50",children:"No changes in this commit"})}function C(e,a=""){let s={name:"",children:new Map};for(let t of e){let e=t.split("/"),l=s;for(let s=0;s<e.length;s++){let n=e[s];l.children.has(n)||l.children.set(n,{name:n,children:new Map}),l=l.children.get(n),s===e.length-1&&(l.fullPath=a?`${a}/${t}`:t)}}return s}function S(e,a,s){if(a[e])return a[e];let t=e.split("/");for(let e=t.length-1;e>0;e--){let s=t.slice(0,e).join("/");if(a[s])return a[s]}if(s){let e=s.split("/");for(let s=e.length;s>0;s--){let t=e.slice(0,s).join("/");if(a[t])return a[t]}}return null}function R({name:e,groupPath:a,icon:s,isExpanded:l,onToggle:n,visibilityMap:r,onToggleVisibility:i,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,t.jsxs)("div",{className:(0,o.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,t.jsxs)("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",onClick:n,children:[(0,t.jsx)("span",{className:"text-xs opacity-70",children:l?"▼":"▶"}),(0,t.jsx)("span",{className:"shrink-0",children:s}),(0,t.jsx)("span",{className:"truncate min-w-0 flex-1",children:e})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,t.jsx)(E,{type:"visible",isActive:"visible"===d||x&&"visible"===u,isInherited:x&&"visible"===u,onClick:e=>{e.stopPropagation(),i(a,"visible")},showOnHover:"visible"===d||x&&"visible"===u}),(0,t.jsx)(E,{type:"hidden",isActive:"hidden"===d||x&&"hidden"===u,isInherited:x&&"hidden"===u,onClick:e=>{e.stopPropagation(),i(a,"hidden")},showOnHover:"hidden"===d||x&&"hidden"===u})]})]})}function E({type:e,isActive:a,isInherited:s,onClick:l,showOnHover:n}){return(0,t.jsx)("button",{className:(0,o.cn)("p-0.5 rounded hover:bg-base-300 transition-colors shrink-0 cursor-pointer text-xs",a&&"bg-primary/10",s&&"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,t.jsx)("i",{className:"iconoir-eye text-[14px]","aria-hidden":"true"}):(0,t.jsx)("i",{className:"iconoir-eye-closed text-[14px]","aria-hidden":"true"})})}function $(e){return Array.from(e.children.values()).sort((e,a)=>{let s=e.children.size>0&&!e.fullPath,t=a.children.size>0&&!a.fullPath;return s&&!t?-1:!s&&t?1:e.name.localeCompare(a.name)})}function B(e,a,s=""){let t=[];for(let l of $(e)){if(void 0!==l.fullPath){t.push(l.fullPath);continue}let e=s?`${s}/${l.name}`:l.name;a.has(e)&&t.push(...B(l,a,e))}return t}function M(e){let a=[];for(let s of $(e)){if(s.fullPath){a.push(s.fullPath);continue}a.push(...M(s))}return a}function P({node:e,currentBranch:a,expandedFolders:s,onToggleFolder:l,onCheckout:n,onCheckoutToLocal:r,onCreateBranch:i,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:k,onToggleVisibility:v,parentPath:w="",depth:C=0,groupPath:R,isRemote:$=!1,trackingInfo:B}){let F=Array.from(e.children.values()).sort((e,a)=>{let s=e.children.size>0&&!e.fullPath,t=a.children.size>0&&!a.fullPath;return s&&!t?-1:!s&&t?1:e.name.localeCompare(a.name)});return(0,t.jsx)(t.Fragment,{children:F.map(e=>{let F=void 0!==e.fullPath,D=e.children.size>0&&!F,T=e.fullPath||(w?`${w}/${e.name}`:e.name),L=s.has(T),A=F&&e.fullPath===a,I=k[T],O=S(T,k,R),H=!I&&null!==O;if(D){let w=M(e).filter(e=>e!==a);return(0,t.jsxs)("div",{children:[(0,t.jsx)(c,{items:[{label:"Delete",onClick:()=>N(w),danger:!0,disabled:0===w.length}],children:(0,t.jsxs)("div",{className:(0,o.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,t.jsxs)("div",{className:"flex items-center gap-1 flex-1 min-w-0",onClick:()=>l(T),children:[(0,t.jsx)("span",{className:"text-xs opacity-70",children:L?"▼":"▶"}),(0,t.jsx)("i",{className:"iconoir-folder text-[16px] shrink-0","aria-hidden":"true"}),(0,t.jsx)("span",{className:"truncate min-w-0 flex-1",children:e.name})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,t.jsx)(E,{type:"visible",isActive:"visible"===I||H&&"visible"===O,isInherited:H&&"visible"===O,onClick:e=>{e.stopPropagation(),v(T,"visible")},showOnHover:"visible"===I||H&&"visible"===O}),(0,t.jsx)(E,{type:"hidden",isActive:"hidden"===I||H&&"hidden"===O,isInherited:H&&"hidden"===O,onClick:e=>{e.stopPropagation(),v(T,"hidden")},showOnHover:"hidden"===I||H&&"hidden"===O})]})]})}),L&&(0,t.jsx)(P,{node:e,currentBranch:a,expandedFolders:s,onToggleFolder:l,onCheckout:n,onCheckoutToLocal:r,onCreateBranch:i,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:k,onToggleVisibility:v,parentPath:T,depth:C+1,groupPath:R,isRemote:$,trackingInfo:B})]},T)}let _=!$&&e.fullPath?B?.[e.fullPath]:void 0,K=_&&(_.ahead>0||_.behind>0),z=f({branchRef:e.fullPath,branchLeafName:e.name,currentBranch:a,isRemote:$,selectedBranchRefs:y.has(e.fullPath)?Array.from(y):[e.fullPath]}),W=y.has(e.fullPath);return(0,t.jsx)(c,{items:z,children:(0,t.jsxs)("div",{className:(0,o.cn)("group flex items-center gap-2 px-2 py-1.5 text-sm rounded-md cursor-pointer transition-colors select-none",!W&&"hover:bg-base-200",W&&"bg-primary/10 hover:bg-primary/20",A&&"bg-base-200 font-medium text-primary"),style:{paddingLeft:`${12*C+8}px`},onContextMenu:()=>j?.(e.fullPath),children:[(0,t.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:()=>!A&&n(e.fullPath),children:[A?(0,t.jsx)("span",{className:"w-3 h-3 flex items-center justify-center shrink-0",children:(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-primary"})}):$?(0,t.jsx)("i",{className:"iconoir-globe text-[14px] opacity-50 shrink-0","aria-hidden":"true"}):(0,t.jsx)("i",{className:"iconoir-git-branch text-[14px] opacity-50 shrink-0","aria-hidden":"true"}),(0,t.jsx)("span",{className:"truncate min-w-0 flex-1",title:e.fullPath,children:e.name}),K&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-xs opacity-70 shrink-0",title:`${_.ahead} ahead, ${_.behind} behind ${_.upstream}`,children:[_.ahead>0&&(0,t.jsxs)("span",{className:"flex items-center gap-0.5 text-xs",children:[(0,t.jsx)("i",{className:"iconoir-arrow-up text-[12px]","aria-hidden":"true"}),(0,t.jsx)("span",{children:_.ahead})]}),_.behind>0&&(0,t.jsxs)("span",{className:"flex items-center gap-0.5 text-xs",children:[(0,t.jsx)("i",{className:"iconoir-arrow-down text-[12px]","aria-hidden":"true"}),(0,t.jsx)("span",{children:_.behind})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,t.jsx)(E,{type:"visible",isActive:"visible"===I||H&&"visible"===O,isInherited:H&&"visible"===O,onClick:e=>{e.stopPropagation(),v(T,"visible")},showOnHover:"visible"===I||H&&"visible"===O}),(0,t.jsx)(E,{type:"hidden",isActive:"hidden"===I||H&&"hidden"===O,isInherited:H&&"hidden"===O,onClick:e=>{e.stopPropagation(),v(T,"hidden")},showOnHover:"hidden"===I||H&&"hidden"===O})]})]})},e.fullPath)})})}function F({repoPath:e}){let a=(0,n.jE)(),{data:s}=(0,l.t0)(),i=(0,l.Y5)(),[d,m]=(0,r.useState)(100),{data:u,isLoading:x,isError:y,error:k,refetch:v,isFetching:E}=(0,l._X)(e,d),{data:$,isLoading:F}=(0,l._6)(e),{data:D}=(0,l.en)(e),[T,L]=(0,r.useState)(null),[A,I]=(0,r.useState)([]),[O,H]=(0,r.useState)(null),_=(0,r.useCallback)(e=>{L(e),I(e?[e]:[]),H(e)},[]);(0,r.useEffect)(()=>{_(null),s9([]),ta(null)},[e,_]);let{mutateAsync:K}=(0,l.a3)(),[z,W]=(0,r.useState)(!1),[q,V]=(0,r.useState)(""),[G,Y]=(0,r.useState)(null),[J,Q]=(0,r.useState)(!1),[U,X]=(0,r.useState)(!1),[Z,ee]=(0,r.useState)(null),[ea,es]=(0,r.useState)(""),[et,el]=(0,r.useState)(!1),[en,er]=(0,r.useState)(!1),[ei,eo]=(0,r.useState)(!1),[ec,ed]=(0,r.useState)([]),[eh,em]=(0,r.useState)(!1),[eu,ex]=(0,r.useState)(!1),[ep,eb]=(0,r.useState)(!1),[ef,eg]=(0,r.useState)(null),[ej,eN]=(0,r.useState)(!1),[ey,ek]=(0,r.useState)(!1),[ev,ew]=(0,r.useState)(!1),[eC,eS]=(0,r.useState)([]),[eR,eE]=(0,r.useState)(!1),[e$,eB]=(0,r.useState)(!1),[eM,eP]=(0,r.useState)(!1),[eF,eD]=(0,r.useState)(!1),[eT,eL]=(0,r.useState)(null),[eA,eI]=(0,r.useState)(null),[eO,eH]=(0,r.useState)(""),[e_,eK]=(0,r.useState)(!1),[ez,eW]=(0,r.useState)(!1),[eq,eV]=(0,r.useState)(!1),[eG,eY]=(0,r.useState)(null),[eJ,eQ]=(0,r.useState)(""),[eU,eX]=(0,r.useState)(!1),[eZ,e0]=(0,r.useState)(!1),[e1,e2]=(0,r.useState)(null),[e4,e3]=(0,r.useState)(!1),[e5,e7]=(0,r.useState)(!1),[e6,e8]=(0,r.useState)("origin"),[e9,ae]=(0,r.useState)(""),[aa,as]=(0,r.useState)(!1),[at,al]=(0,r.useState)(!1),[an,ar]=(0,r.useState)(null),[ai,ao]=(0,r.useState)(null),[ac,ad]=(0,r.useState)(!0),[ah,am]=(0,r.useState)(!1),[au,ax]=(0,r.useState)("checking"),ap=(0,r.useCallback)(()=>{al(!1),ar(null),ao(null),ax("checking")},[]),[ab,af]=(0,r.useState)(!1),[ag,aj]=(0,r.useState)(null),[aN,ay]=(0,r.useState)(null),[ak,av]=(0,r.useState)(!1),[aw,aC]=(0,r.useState)(!1),[aS,aR]=(0,r.useState)(!1),[aE,a$]=(0,r.useState)(""),[aB,aM]=(0,r.useState)(!1),[aP,aF]=(0,r.useState)("checking"),aD=(0,r.useCallback)(()=>{af(!1),aj(null),ay(null),aF("checking")},[]),[aT,aL]=(0,r.useState)(!1),[aA,aI]=(0,r.useState)(null),[aO,aH]=(0,r.useState)([]),[a_,aK]=(0,r.useState)(""),[az,aW]=(0,r.useState)([]),[aq,aV]=(0,r.useState)(""),[aG,aY]=(0,r.useState)(null),[aJ,aQ]=(0,r.useState)(!1),[aU,aX]=(0,r.useState)(!1),[aZ,a0]=(0,r.useState)(!0),[a1,a2]=(0,r.useState)(!1),[a4,a3]=(0,r.useState)(""),[a5,a7]=(0,r.useState)(!1),[a6,a8]=(0,r.useState)(null),[a9,se]=(0,r.useState)(!1),[sa,ss]=(0,r.useState)(!1),[st,sl]=(0,r.useState)(!1),[sn,sr]=(0,r.useState)(null),[si,so]=(0,r.useState)([]),[sc,sd]=(0,r.useState)(""),[sh,sm]=(0,r.useState)([]),[su,sx]=(0,r.useState)(""),[sp,sb]=(0,r.useState)(null),[sf,sg]=(0,r.useState)(!0),[sj,sN]=(0,r.useState)(!1),[sy,sk]=(0,r.useState)(null),[sv,sw]=(0,r.useState)(!1),[sC,sS]=(0,r.useState)(!1),[sR,sE]=(0,r.useState)(!1),[s$,sB]=(0,r.useState)(!1),[sM,sP]=(0,r.useState)(null),[sF,sD]=(0,r.useState)(""),[sT,sL]=(0,r.useState)(!1),[sA,sI]=(0,r.useState)(!1),[sO,sH]=(0,r.useState)(null),[s_,sK]=(0,r.useState)(!1),[sz,sW]=(0,r.useState)(!1),[sq,sV]=(0,r.useState)(null),[sG,sY]=(0,r.useState)(!1),[sJ,sQ]=(0,r.useState)(!1),[sU,sX]=(0,r.useState)(null),[sZ,s0]=(0,r.useState)(""),[s1,s2]=(0,r.useState)(""),[s4,s3]=(0,r.useState)(!1),s5=(0,r.useRef)(null),[s7,s6]=(0,r.useState)(null),[s8,s9]=(0,r.useState)([]),[te,ta]=(0,r.useState)(null),[ts,tt]=(0,r.useState)(!1),tl=(0,r.useRef)(null),[tn,tr]=(0,r.useState)(N),[ti,to]=(0,r.useState)(!1),[tc,td]=(0,r.useState)(!1),[th,tm]=(0,r.useState)(!1),tu="starting"===tn.status||"running"===tn.status,tx="completed"===tn.status||"failed"===tn.status||"canceled"===tn.status;(0,r.useEffect)(()=>{tx&&tn.executionId&&a.invalidateQueries({queryKey:["git",e]})},[tx,tn.executionId,a,e]);let tp=(0,r.useCallback)(()=>{eD(!1),eL(null),eI(null),eH(""),eK(!1)},[]),tb=(0,r.useCallback)(()=>{eV(!1),eY(null),eQ("")},[]),tf=(0,r.useCallback)(()=>{e0(!1),e2(null)},[]),tg=(0,r.useCallback)(()=>{e7(!1),e8("origin"),ae("")},[]),tj=(0,r.useCallback)(()=>{sQ(!1),sX(null),s0(""),s2("")},[]),tN=(0,r.useCallback)(()=>{if(e$){eB(!1),eS([]);return}if(s$)return void sB(!1);if(z){W(!1),Y(null);return}if(U){X(!1),ee(null),es(""),el(!1);return}if(st)return void sl(!1);if(aT)return void aL(!1);if(ab)return void aD();if(at)return void ap();if(eF)return void tp();if(eq)return void tb();if(eZ)return void tf();if(e5)return void tg();if(ev){ew(!1),eS([]);return}if(ei){eo(!1),ed([]),em(!1);return}if(ep){eb(!1),eg(null),eN(!1);return}if(sJ)return void tj();if(sA)return void sI(!1);if(sz){sW(!1),sV(null);return}ts?tt(!1):tn.isOpen&&tx&&(tr(N),tm(!1),to(!1))},[e$,s$,z,U,st,aT,aD,ab,ap,at,eF,tp,eq,tb,eZ,tf,e5,tg,ev,ei,ep,sJ,tj,sA,sz,ts,tn.isOpen,tx]),ty=sA||sz||sJ||ei||ep||e$||ev||eF||eq||eZ||e5||at||ab||aT||st||z||U||s$||ts||tn.isOpen;(0,p.v)(ty,tN);let tk="git-web:history-panel-height",tv="git-web:history-commit-details-message-ratio",[tw,tC]=(0,r.useState)(300),[tS,tR]=(0,r.useState)(!1),tE=(0,r.useRef)(null),[t$,tB]=(0,r.useState)(.28),[tM,tP]=(0,r.useState)(!1),tF=(0,r.useRef)(null),tD=(0,r.useRef)(!1);(0,r.useEffect)(()=>{if(s?.historyPanelHeight)tC(f(s.historyPanelHeight));else try{let e=localStorage.getItem(tk);if(e){let a=parseInt(e,10);!isNaN(a)&&a>=100&&a<=900&&tC(a)}}catch(e){console.error("Failed to load panel height from localStorage:",e)}},[s?.historyPanelHeight]),(0,r.useEffect)(()=>{try{localStorage.setItem(tk,String(tw))}catch(e){console.error("Failed to save panel height to localStorage:",e)}},[tw]),(0,r.useEffect)(()=>{try{let e=localStorage.getItem(tv);if(!e)return;let a=parseFloat(e);Number.isNaN(a)||tB(g(a))}catch(e){console.error("Failed to load commit details ratio from localStorage:",e)}},[]),(0,r.useEffect)(()=>{try{localStorage.setItem(tv,String(t$))}catch(e){console.error("Failed to save commit details ratio to localStorage:",e)}},[t$]),(0,r.useEffect)(()=>{!tS&&tD.current&&(i.mutate({historyPanelHeight:tw}),tD.current=!1)},[tS,tw,i]);let tT=(0,r.useCallback)(e=>{e.preventDefault(),tR(!0),tE.current={startY:e.clientY,startHeight:tw}},[tw]);(0,r.useEffect)(()=>{if(!tS)return;let e=e=>{if(!tE.current)return;let a=tE.current.startY-e.clientY;tC(f(tE.current.startHeight+a)),tD.current=!0},a=()=>{tR(!1),tE.current=null};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",a)}},[tS]);let tL=(0,r.useCallback)(e=>{e.preventDefault(),tP(!0)},[]);(0,r.useEffect)(()=>{if(!tM)return;let e=e=>{let a=tF.current;if(!a)return;let s=a.getBoundingClientRect();s.height<=0||tB(g((e.clientY-s.top)/s.height))},a=()=>{tP(!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=""}},[tM]),(0,r.useEffect)(()=>{if(!ts)return;let e=e=>{tl.current&&!tl.current.contains(e.target)&&tt(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[ts]);let tA=(0,r.useMemo)(()=>$?.branches?C($.branches):null,[$?.branches]),tI=(0,r.useMemo)(()=>{if(!$?.remotes)return null;var e=$.remotes;let a=new Map;for(let[s,t]of Object.entries(e))a.set(s,C(t,`remotes/${s}`));return a},[$?.remotes]),tO=(0,r.useMemo)(()=>{let e=new Set;for(let a of $?.branches??[])e.add(a);for(let[a,s]of Object.entries($?.remotes??{}))for(let t of s)e.add(`remotes/${a}/${t}`);return e},[$?.branches,$?.remotes]),tH=(0,r.useMemo)(()=>new Set(s8),[s8]),t_=(0,l.GK)(e),tK=(0,l.Lp)(),tz=(0,r.useMemo)(()=>(t_?.customScripts??[]).filter(e=>"branch"===e.target&&"run-bash-script"===e.action&&e.name.trim().length>0&&e.content.trim().length>0),[t_?.customScripts]),[tW,tq]=(0,r.useState)(!0),[tV,tG]=(0,r.useState)(!0),[tY,tJ]=(0,r.useState)({}),[tQ,tU]=(0,r.useState)(new Set),tX=(0,r.useMemo)(()=>{let e=[];if(tW&&tA&&e.push(...B(tA,tQ)),tV&&tI)for(let[a,s]of Array.from(tI.entries())){let t=`__remotes__/${a}`;tQ.has(t)&&e.push(...B(s,tQ,`remotes/${a}`))}return e},[tQ,tA,tW,tI,tV]);(0,r.useEffect)(()=>{if(0===s8.length)return;let e=s8.filter(e=>tO.has(e));e.length!==s8.length&&s9(e),te&&!tO.has(te)&&ta(e.length>0?e[e.length-1]:null)},[tO,te,s8]);let tZ=(0,r.useRef)(null);(0,r.useEffect)(()=>{t_&&t_.path!==tZ.current&&(tZ.current=t_.path,void 0!==t_.localGroupExpanded&&tq(t_.localGroupExpanded),void 0!==t_.remotesGroupExpanded&&tG(t_.remotesGroupExpanded),t_.expandedFolders&&tU(new Set(t_.expandedFolders)),t_.visibilityMap&&tJ(t_.visibilityMap))},[t_]);let t0=(0,r.useCallback)(a=>{tK.mutate({path:e,updates:a})},[e,tK]),t1=(0,r.useCallback)(()=>{let e=!tW;tq(e),t0({localGroupExpanded:e})},[tW,t0]),t2=(0,r.useCallback)(()=>{let e=!tV;tG(e),t0({remotesGroupExpanded:e})},[tV,t0]),t4=(0,r.useCallback)(e=>{tU(a=>{let s=new Set(a);return s.has(e)?s.delete(e):s.add(e),t0({expandedFolders:Array.from(s)}),s})},[t0]),t3=(0,r.useCallback)((e,a)=>{tJ(s=>{let t={...s};t[e]===a?delete t[e]:t[e]=a;let l={};return Object.entries(t).forEach(([e,a])=>{("visible"===a||"hidden"===a)&&(l[e]=a)}),t0({visibilityMap:l}),t})},[t0]),t5=(0,r.useCallback)(()=>{tJ({}),t0({visibilityMap:{}})},[t0]),t7=(0,r.useCallback)((e,a)=>{let s=S(e,tY);if(s)return s;if(a){let a=e.split("/");if(a.length>=2&&"remotes"===a[0]){let e=a[1],s=tY[`__remotes__/${e}`];if(s)return s;let t=tY.__remotes__;if(t)return t}}else{let e=tY.__local__;if(e)return e}return null},[tY]),t6=(0,r.useMemo)(()=>{if(!u?.all||!$?.branches||!$?.branchCommits)return u?.all||[];let e=Object.values(tY).some(e=>"visible"===e),a=Object.values(tY).some(e=>"hidden"===e);if(!e&&!a)return u.all;let s=[...$.branches.map(e=>({branch:e,isRemote:!1}))];if($.remotes)for(let[e,a]of Object.entries($.remotes))for(let t of a)s.push({branch:`remotes/${e}/${t}`,isRemote:!0});let t=new Set,l=new Set,n=new Set;for(let{branch:e,isRemote:a}of s){let s=t7(e,a);"visible"===s?t.add(e):"hidden"===s?l.add(e):n.add(e)}let r=new Map(u.all.map(e=>[e.hash,e])),i=(e,a)=>{let s=[e];for(;s.length>0;){let e=s.pop();if(a.has(e))continue;let t=r.get(e);if(t)for(let l of(a.add(e),t.parents||[]))a.has(l)||s.push(l)}},o=new Set;for(let e of t){let a=$.branchCommits[e];a&&i(a,o)}if(e)return u.all.filter(e=>o.has(e.hash));if(a){let e=new Set;for(let a of n){let s=$.branchCommits[a];s&&i(s,e)}return u.all.filter(a=>e.has(a.hash))}return u.all},[u?.all,$?.branches,$?.branchCommits,$?.remotes,tY,t7]),t8=(0,r.useMemo)(()=>new Set(A),[A]),t9=(0,r.useMemo)(()=>t6.map(e=>e.hash),[t6]),le=(0,r.useMemo)(()=>T?u?.all.find(e=>e.hash===T):null,[u?.all,T]);(0,r.useEffect)(()=>{if(0===t9.length){(T||A.length>0||O)&&_(null);return}let e=new Set(t9),a=A.filter(a=>e.has(a));a.length!==A.length&&I(a),T&&!e.has(T)&&L(a.length>0?a[a.length-1]:null),O&&!e.has(O)&&H(a.length>0?a[a.length-1]:null)},[t9,T,A,O,_]);let la=(0,r.useCallback)((e,a)=>{let s=a?.isRangeSelect??!1,t=a?.isMultiSelect??!1;if(s){let a=O??T??e,s=t9.indexOf(a),t=t9.indexOf(e);if(-1!==s&&-1!==t){let[l,n]=s<t?[s,t]:[t,s];I(t9.slice(l,n+1)),L(e),H(a);return}}if(t){if(t8.has(e)){let a=A.filter(a=>a!==e);I(a),L(s=>s!==e?s:a.length>0?a[a.length-1]:null),O===e&&H(a.length>0?a[a.length-1]:null)}else I([...A,e]),L(e),H(e);return}_(e)},[t9,t8,A,T,O,_]),ls=(0,r.useMemo)(()=>t6.filter(e=>t8.has(e.hash)).reverse(),[t6,t8]),lt=(0,r.useMemo)(()=>Object.values(tY).some(e=>"visible"===e||"hidden"===e),[tY]),ll=(0,r.useMemo)(()=>{let e=new Set;if($?.branches)for(let a of $.branches)"hidden"===t7(a,!1)&&e.add(a);if($?.remotes)for(let[a,s]of Object.entries($.remotes))for(let t of s){let s=`remotes/${a}/${t}`;"hidden"===t7(s,!0)&&e.add(s)}return e},[$?.branches,$?.remotes,t7]);(0,r.useEffect)(()=>{lt&&t6.length<50&&!E&&d<5e3&&u?.all&&u.all.length>=d&&m(e=>Math.min(e+100,5e3))},[lt,t6.length,E,d,u?.all]),(0,r.useEffect)(()=>{s7&&u?.all&&!E&&(u.all.some(e=>e.hash===s7)?requestAnimationFrame(()=>{s5.current?.scrollToCommit(s7)&&(_(s7),s6(null))}):d<5e3?m(e=>e+100):(console.warn("Could not find commit after loading 5000 commits"),s6(null)))},[s7,u?.all,E,d,_]);let ln=(0,r.useCallback)(e=>{if(!$?.branchCommits)return;let a=$.branchCommits[e];if(a){if(u?.all?.some(e=>e.hash===a)&&s5.current&&s5.current.scrollToCommit(a))return void _(a);s6(a),_(a)}},[$?.branchCommits,u?.all,_]),lr=(0,r.useCallback)((e,a)=>{let s=a?.isRangeSelect??!1,t=a?.isMultiSelect??!1;if(s){let a=te??e,s=tX.indexOf(a),t=tX.indexOf(e);if(-1!==s&&-1!==t){let[l,n]=s<t?[s,t]:[t,s],r=tX.slice(l,n+1);tH.has(e)?s9(s8.filter(e=>!r.includes(e))):s9(Array.from(new Set([...s8,...r]))),ta(a)}else s9([e]),ta(e);return}if(t){tH.has(e)?s9(s8.filter(a=>a!==e)):s9([...s8,e]),ta(e);return}s9([e]),ta(e),ln(e)},[te,tX,ln,s8,tH]),li=(0,r.useCallback)(e=>{tH.has(e)||(s9([e]),ta(e))},[tH]),lo=(0,r.useCallback)(async(a,s)=>{tm(!1),to(!1),tr({isOpen:!0,executionId:null,scriptName:a.name,branchRef:s,output:"",status:"starting",error:null});try{let t=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"start",repoPath:e,branchRef:s,scriptContent:a.content})}),l=await t.json();if(!t.ok)throw Error(l.error||"Failed to start script execution");let n=[];l.previousBranch&&l.checkedOutBranch&&l.previousBranch!==l.checkedOutBranch&&n.push(`[info] Checked out ${l.checkedOutBranch} (from ${l.previousBranch})`),tr(e=>({...e,executionId:l.executionId,output:[n.join("\n"),l.output].filter(Boolean).join("\n"),status:l.status,error:null}))}catch(e){tr(a=>({...a,status:"failed",error:e.message,output:a.output?`${a.output}
2
+ [error] ${e.message}`:`[error] ${e.message}`}))}},[e]),lc=(0,r.useCallback)(async()=>{if(tn.executionId&&tu){to(!0);try{let e=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"cancel",executionId:tn.executionId})}),a=await e.json();if(!e.ok)throw Error(a.error||"Failed to cancel script execution");tr(e=>({...e,output:a.output,status:a.status})),"running"!==a.status&&"starting"!==a.status&&to(!1)}catch(e){tr(a=>({...a,output:`${a.output}
3
+ [error] ${e.message}`})),to(!1)}}},[tn.executionId,tu]),ld=(0,r.useCallback)(async()=>{if(tc)return;td(!0);let e=await j(tn.output);td(!1),tm(e),e&&setTimeout(()=>tm(!1),1500)},[tc,tn.output]);(0,r.useEffect)(()=>{if(!tn.executionId||!tu)return;let e=!1,a=null,s=async()=>{try{let t=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"status",executionId:tn.executionId})}),l=await t.json();if(!t.ok)throw Error(l.error||"Failed to fetch script execution output");if(e)return;let n=l.status;tr(e=>e.executionId!==l.executionId?e:{...e,output:l.output,status:n,error:null}),"running"===n?a=setTimeout(s,450):to(!1)}catch(a){if(e)return;to(!1),tr(e=>({...e,status:"failed",error:a.message,output:e.output?`${e.output}
4
+ [error] ${a.message}`:`[error] ${a.message}`}))}};return s(),()=>{e=!0,a&&clearTimeout(a)}},[tn.executionId,tu]);let lh=e=>{let a=e.filter(e=>e!==lZ);0!==a.length&&(ed(a),em(!1),eo(!0))},lm=e=>{lh([e])},lu=(0,r.useCallback)(()=>{eb(!1),eg(null),eN(!1)},[]),lx=(0,r.useCallback)(e=>{e&&(eg(e),eN(!1),eb(!0))},[]),lp=async()=>{if(0!==ec.length){ex(!0);try{let a=new Map,s=(e,s,t)=>{a.has(e)||a.set(e,{branchRef:s,run:t})},l=new Set;if(eh)for(let e of ec){if(e.startsWith("remotes/"))continue;let a=$?.trackingInfo?.[e];a?.upstream&&l.add(a.upstream)}for(let a of l){let[t,...l]=a.split("/"),n=l.join("/");if(t&&n){let a=`${t}/${n}`;s(`remote:${a}`,a,()=>K({repoPath:e,action:"delete-remote-branch",data:{remote:t,branch:n},suppressErrorToast:!0}))}}for(let a of ec){if(a.startsWith("remotes/")){let t=a.split("/");if(t.length>=3){let a=t[1],l=t.slice(2).join("/"),n=`${a}/${l}`;s(`remote:${n}`,n,()=>K({repoPath:e,action:"delete-remote-branch",data:{remote:a,branch:l},suppressErrorToast:!0}))}continue}s(`local:${a}`,a,()=>K({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 s=n[a].branchRef;return console.error(`Failed to delete branch "${s}":`,e.reason),[s]});r.length>0&&(0,b.oR)({type:"error",title:1===r.length?"Failed to Delete 1 Branch":`Failed to Delete ${r.length} Branches`,description:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:"The following branches could not be deleted:"}),(0,t.jsx)("ul",{className:"mt-1 max-h-40 overflow-y-auto list-disc pl-5",children:r.map(e=>(0,t.jsx)("li",{className:"break-all",children:e},e))})]}),duration:1e4}),eo(!1),ed([]),em(!1),s9([]),ta(null)}catch(e){console.error(e)}finally{ex(!1)}}},lb=async()=>{if(ef){ek(!0);try{if(await K({repoPath:e,action:"delete-tag",data:{tag:ef}}),ej&&l1)try{await K({repoPath:e,action:"delete-remote-tag",data:{remote:l1,tag:ef}})}catch(e){console.error("Failed to delete remote tag:",e)}lu()}catch(e){console.error(e)}finally{ek(!1)}}},lf=e=>{eL(e),eI(null),eH(e),eK(!1),eD(!0)},lg=e=>{let a=e.split("/");if(a.length<3||"remotes"!==a[0])return;let s=a[1],t=a.slice(2).join("/");s&&t&&(eL(e),eI({remote:s,branch:t}),eH(t),eK(!1),eD(!0))},lj=async()=>{if(eT&&eO){if(eA?eA.branch===eO:eT===eO)return void tp();eW(!0);try{eA?await K({repoPath:e,action:"rename-remote-branch",data:{remote:eA.remote,oldName:eA.branch,newName:eO}}):await K({repoPath:e,action:"rename-branch",data:{oldName:eT,newName:eO,renameTrackingRemote:e_}}),tp()}catch(e){console.error(e)}finally{eW(!1)}}},lN=async()=>{if(!eG)return;let a=eG.trim(),s=eJ.trim();if(a&&s){if(a===s)return void tb();eX(!0);try{await K({repoPath:e,action:"rename-remote",data:{oldName:a,newName:s}}),tb()}catch(e){console.error(e)}finally{eX(!1)}}},ly=async()=>{if(!e1)return;let a=e1.trim();if(a){e3(!0);try{await K({repoPath:e,action:"delete-remote",data:{name:a}}),tf()}catch(e){console.error(e)}finally{e3(!1)}}},lk=async()=>{let a=e6.trim(),s=e9.trim();if(a&&s){as(!0);try{await K({repoPath:e,action:"add-remote",data:{name:a,url:s}}),tg()}catch(e){console.error(e)}finally{as(!1)}}},lv=({sourceBranch:e,targetBranch:a})=>{ar(e),ao(a),ad(!0),ax("checking"),al(!0)},lw=async()=>{if(an&&ai){am(!0);try{await K({repoPath:e,action:"checkout",data:{branch:an}}),await K({repoPath:e,action:"rebase",data:{ontoBranch:ai,stashChanges:ac}}),ap()}catch(e){console.error(e)}finally{am(!1)}}};(0,r.useEffect)(()=>{if(!at||!an||!ai)return;let a=!1;return ax("checking"),(async()=>{try{let s=await K({repoPath:e,action:"check-rebase-conflicts",data:{sourceBranch:an,ontoBranch:ai}});a||ax(s.hasConflicts?"has-conflicts":"no-conflict")}catch(e){console.error(e),a||ax("has-conflicts")}})(),()=>{a=!0}},[at,an,ai,e,K]);let lC=({sourceBranch:e,targetBranch:a})=>{aj(a),ay(e),av(!1),aC(!1),aR(!1),a$(""),aF("checking"),af(!0)},lS=(0,r.useCallback)(a=>{if(aC(a),a){if(!aN)return void a$("");(async()=>{try{let a=await K({repoPath:e,action:"get-latest-commit-message",data:{branch:aN}});a$("string"==typeof a?.message?a.message:"")}catch(e){console.error(e),a$("")}})()}},[aN,e,K]),lR=async()=>{if(ag&&aN){aM(!0);try{await K({repoPath:e,action:"checkout",data:{branch:ag}}),await K({repoPath:e,action:"merge",data:{targetBranch:aN,rebaseBeforeMerge:ak,squash:aw,fastForward:aS,squashMessage:aw?aE:void 0}}),aD()}catch(e){console.error(e)}finally{aM(!1)}}};(0,r.useEffect)(()=>{if(!ab||!aN||!ag)return;let a=!1;return aF("checking"),(async()=>{try{let s=await K({repoPath:e,action:"check-merge-conflicts",data:{sourceBranch:aN,targetBranch:ag}});a||aF(s.hasConflicts?"has-conflicts":"no-conflict")}catch(e){console.error(e),a||aF("has-conflicts")}})(),()=>{a=!0}},[ab,aN,ag,e,K]);let lE=async a=>{aI(a),a8(null),aH([]),aW([]),aK(""),aV(""),aY(null),aQ(!1),aX(!1),a0(!0),a2(!1),a3(""),aL(!0),se(!0);try{let s=await K({repoPath:e,action:"get-remotes",data:{}});if(!s.remotes||0===s.remotes.length){a8("No remote repository configured. Please add a remote first."),se(!1);return}aH(s.remotes);let t=await K({repoPath:e,action:"get-tracking-branch",data:{branch:a}});aY(t.tracking);let l=t.tracking?.remote,n=l&&s.remotes.includes(l)?l:s.remotes[0];aK(n),ss(!0);let r=await K({repoPath:e,action:"get-remote-branches",data:{remote:n}});aW(r.branches||[]),t.tracking?.remote===n&&t.tracking?.branch?aV(t.tracking.branch):(r.branches?.includes(a),aV(a))}catch(e){console.error(e),a8(e.message||"Failed to load remote information")}finally{se(!1),ss(!1)}},l$=async a=>{aK(a),ss(!0),aW([]);try{let s=await K({repoPath:e,action:"get-remote-branches",data:{remote:a}});aW(s.branches||[]),aG?.remote===a&&aG?.branch?aV(aG.branch):aV(aA||"")}catch(e){console.error(e),a8(e.message||"Failed to load remote branches")}finally{ss(!1)}},lB=(0,r.useCallback)(a=>{if(a2(a),a){if(!aA)return void a3("");(async()=>{try{let a=await K({repoPath:e,action:"get-latest-commit-message",data:{branch:aA}});a3("string"==typeof a?.message?a.message:"")}catch(e){console.error(e),a3("")}})()}},[aA,e,K]),lM=async()=>{if(aA&&a_&&aq){a7(!0),a8(null);try{let a=!az.includes(aq)||aG?.remote!==a_||aG?.branch!==aq;await K({repoPath:e,action:"push-to-remote",data:{localBranch:aA,remote:a_,remoteBranch:aq,rebaseFirst:!aU&&aJ,forcePush:aU,pushLocalOnlyTags:aZ,setUpstream:a,squash:a1,squashMessage:a4}}),await K({repoPath:e,action:"fetch",data:{remote:a_}}),aL(!1),aI(null)}catch(e){console.error(e),a8(e.message||"Failed to push to remote")}finally{a7(!1)}}},lP=async a=>{sr(a),sk(null),so([]),sm([]),sd(""),sx(""),sb(null),sg(!0),sl(!0),sw(!0);try{let s=await K({repoPath:e,action:"get-remotes",data:{}});if(!s.remotes||0===s.remotes.length){sk("No remote repository configured. Please add a remote first."),sw(!1);return}so(s.remotes);let t=await K({repoPath:e,action:"get-tracking-branch",data:{branch:a}});sb(t.tracking);let l=t.tracking?.remote,n=l&&s.remotes.includes(l)?l:s.remotes[0];sd(n),sS(!0);let r=await K({repoPath:e,action:"get-remote-branches",data:{remote:n}});sm(r.branches||[]),t.tracking?.remote===n&&t.tracking?.branch?sx(t.tracking.branch):sx("")}catch(e){console.error(e),sk(e.message||"Failed to load remote information")}finally{sw(!1),sS(!1)}},lF=async a=>{sd(a),sS(!0),sm([]),sx("");try{let s=await K({repoPath:e,action:"get-remote-branches",data:{remote:a}});sm(s.branches||[]),sp?.remote===a&&sp?.branch?sx(sp.branch):sx("")}catch(e){console.error(e),sk(e.message||"Failed to load remote branches")}finally{sS(!1)}},lD=async()=>{if(sn&&sc&&su){sN(!0),sk(null);try{await K({repoPath:e,action:"pull-from-remote",data:{localBranch:sn,remote:sc,remoteBranch:su,rebase:sf}}),sl(!1),sr(null)}catch(e){console.error(e),sk(e.message||"Failed to pull from remote")}finally{sN(!1)}}},lT=e=>{sP(e),sD(e.split("/").slice(2).join("/")),sB(!0)},lL=async()=>{if(sM&&sF){sL(!0);try{await K({repoPath:e,action:"checkout-to-local",data:{remoteBranch:sM,localBranch:sF}}),sB(!1),sP(null),sD("")}catch(e){console.error(e)}finally{sL(!1)}}},lA=async()=>{sE(!0);try{await K({repoPath:e,action:"fetch",data:{allRemotes:!0}})}catch(e){console.error(e)}finally{sE(!1)}},lI=async a=>{try{await K({repoPath:e,action:"fetch",data:{remote:a}})}catch(e){console.error(e)}},lO=async a=>{try{await K({repoPath:e,action:"checkout",data:{branch:a}})}catch(e){console.error(e)}},lH=async e=>{sH(e),sI(!0)},l_=async()=>{if(sO){sK(!0);try{await K({repoPath:e,action:"reset",data:{commitHash:sO,mode:"hard"}}),sI(!1),sH(null)}catch(e){console.error(e)}finally{sK(!1)}}},lK=async()=>{if(sq){sY(!0);try{await K({repoPath:e,action:"revert",data:{commitHash:sq.hash}}),sW(!1),sV(null)}catch(e){console.error(e)}finally{sY(!1)}}},lz=async()=>{if(sU&&sZ.trim()){s3(!0);try{let a,s;await K({repoPath:e,action:"reword",data:{commitHash:sU.hash,message:(a=sZ.trim(),(s=s1.replace(/\r\n/g,"\n")).trim()?`${a}
5
+
6
+ ${s}`:a),branch:sU.branch}}),tj()}catch(e){console.error(e)}finally{s3(!1)}}},lW=e=>{if(!(e instanceof Error))return!1;let a=e.message.toLowerCase();return a.includes("cherry-pick")&&a.includes("already in progress")},lq=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")},lV=(0,r.useCallback)(async a=>{1===a.length?await K({repoPath:e,action:"cherry-pick",data:{commitHash:a[0]}}):await K({repoPath:e,action:"cherry-pick-multiple",data:{commitHashes:a}})},[e,K]),lG=(0,r.useCallback)(async()=>{try{await K({repoPath:e,action:"cherry-pick-abort"})}catch(e){console.error(e)}finally{ew(!1),eB(!1),eS([])}},[e,K]),lY=async()=>{if(0!==eC.length){eE(!0);try{let e=eC.map(e=>e.hash);await lV(e),ew(!1),eS([])}catch(e){lW(e)?(ew(!1),eB(!0)):lq(e)&&await lG(),console.error(e)}finally{eE(!1)}}},lJ=async()=>{if(0===eC.length)return void eB(!1);eP(!0);try{await K({repoPath:e,action:"cherry-pick-abort"});let a=eC.map(e=>e.hash);await lV(a),eB(!1),eS([])}catch(e){lW(e)?eB(!0):lq(e)&&await lG(),console.error(e)}finally{eP(!1)}},lQ=async()=>{if(q){Q(!0);try{await K({repoPath:e,action:"branch",data:{branch:q,fromRef:G||void 0}}),W(!1),V(""),Y(null)}catch(e){console.error(e)}finally{Q(!1)}}},lU=e=>{Y(e||null),W(!0)},lX=async()=>{if(Z&&ea.trim()){er(!0);try{await K({repoPath:e,action:"create-tag",data:{tagName:ea.trim(),commitHash:Z,pushToRemote:et}}),X(!1),ee(null),es(""),el(!1)}catch(e){console.error(e)}finally{er(!1)}}},lZ=$?.current,l0=$?.trackingInfo,l1=(0,r.useMemo)(()=>Object.keys($?.remoteUrls??{}).sort((e,a)=>"origin"===e?-1:"origin"===a?1:e.localeCompare(a)),[$?.remoteUrls])[0]||null,l2=(0,r.useMemo)(()=>{let e=[];for(let a of ec){if(a.startsWith("remotes/"))continue;let s=l0?.[a]?.upstream;s&&e.push(s)}return Array.from(new Set(e))},[ec,l0]),l4=(0,r.useMemo)(()=>!eT||eA?null:l0?.[eT]??null,[eT,eA,l0]),l3=D?.files?.length,l5=lZ||(F?"Loading branches...":"Detached HEAD"),l7=lZ&&"number"==typeof l3&&l3>0?`${lZ} (${l3})`:l5,l6=(0,r.useMemo)(()=>{if(!lZ)return null;let e=l0?.[lZ];if(!e?.upstream)return null;let a=e.upstream.indexOf("/");return a<=0?null:{upstream:e.upstream,remote:e.upstream.slice(0,a),branch:e.upstream.slice(a+1)}},[lZ,l0]),l8=(0,r.useMemo)(()=>F?"Loading branches...":lZ?l6?null:`Branch "${lZ}" has no tracking remote branch`:"Not on a local branch",[lZ,l6,F]),l9=(0,r.useMemo)(()=>F?"Loading branches...":lZ?null:"Not on a local branch",[lZ,F]),ne=e=>{let a=function(e,a){let{branchRef:s,branchLeafName:l,currentBranch:n,isRemote:r,selectedBranchRefs:i}=e,o=!r&&s===n,c=i&&i.length>0?i:[s],d=c.length>1,h=[];return o||r||h.push({label:"Checkout",onClick:()=>a.onCheckout(s)}),r&&h.push({label:"Checkout to local",onClick:()=>a.onCheckoutToLocal(s)}),h.push({label:"Create Branch",onClick:()=>a.onCreateBranch(s)}),r||h.push({label:"Rename Branch",onClick:()=>a.onRenameBranch(s)}),r&&h.push({label:"Rename branch",onClick:()=>a.onRenameRemoteBranch(s)}),r||h.push({label:"Push to Remote",onClick:()=>a.onPushToRemote(s)}),r||h.push({label:"Pull from Remote",onClick:()=>a.onPullFromRemote(s)}),!o&&n&&(h.push({label:`Rebase ${n} onto ${l}`,labelNode:(0,t.jsxs)(t.Fragment,{children:["Rebase ",(0,t.jsx)("span",{className:"font-bold",children:n})," onto ",l]}),onClick:()=>a.onRebase({sourceBranch:n,targetBranch:s})}),h.push({label:`Rebase ${l} onto ${n}`,labelNode:(0,t.jsxs)(t.Fragment,{children:["Rebase ",l," onto ",(0,t.jsx)("span",{className:"font-bold",children:n})]}),onClick:()=>a.onRebase({sourceBranch:s,targetBranch:n})}),h.push({label:`Merge ${n} into ${l}`,labelNode:(0,t.jsxs)(t.Fragment,{children:["Merge ",(0,t.jsx)("span",{className:"font-bold",children:n})," into ",l]}),onClick:()=>a.onMerge({sourceBranch:n,targetBranch:s})}),h.push({label:`Merge ${l} into ${n}`,labelNode:(0,t.jsxs)(t.Fragment,{children:["Merge ",l," into ",(0,t.jsx)("span",{className:"font-bold",children:n})]}),onClick:()=>a.onMerge({sourceBranch:s,targetBranch:n})})),o||(d?h.push({label:`Delete Selected Branches (${c.length})`,onClick:()=>a.onDeleteBranches(c),danger:!0}):h.push({label:r?"Delete Remote Branch":"Delete Branch",onClick:()=>a.onDeleteBranch(s),danger:!0})),h}(e,{onCheckout:lO,onCheckoutToLocal:lT,onCreateBranch:lU,onDeleteBranch:lm,onDeleteBranches:lh,onRenameBranch:lf,onRenameRemoteBranch:lg,onRebase:lv,onMerge:lC,onPushToRemote:lE,onPullFromRemote:lP});return tz.length>0&&a.push({label:"Custom scripts",children:tz.map(a=>({label:a.name,onClick:()=>{lo(a,e.branchRef)}}))}),a},na=(0,r.useMemo)(()=>new Set($?.branches??[]),[$?.branches]),ns=(0,r.useMemo)(()=>{let e=new Map;if(!$?.remotes)return e;for(let[a,s]of Object.entries($.remotes))for(let t of s)e.set(`${a}/${t}`,`remotes/${a}/${t}`);return e},[$?.remotes]),nt=(0,r.useMemo)(()=>tA?M(tA).filter(e=>e!==lZ):[],[tA,lZ]),nl=(0,t.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,t.jsxs)("div",{className:"px-4 border-b border-base-300 flex items-center justify-between bg-base-100 h-[57px] shrink-0",children:[(0,t.jsx)("h2",{className:"font-bold text-lg",children:"Branches"}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[lt&&(0,t.jsx)("div",{className:"tooltip tooltip-left z-20","data-tip":"Clear filters",children:(0,t.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:t5,children:(0,t.jsx)("i",{className:"iconoir-filter text-[16px]","aria-hidden":"true"})})}),(0,t.jsx)("div",{className:"tooltip tooltip-left z-20","data-tip":"Create Branch",children:(0,t.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:()=>lU(),children:(0,t.jsx)("i",{className:"iconoir-plus-circle text-[16px]","aria-hidden":"true"})})})]})]}),(0,t.jsx)("div",{className:"max-h-[70vh] overflow-auto",children:(0,t.jsxs)("div",{className:"p-2 space-y-0.5",children:[tA&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c,{items:[{label:"Delete",onClick:()=>lh(nt),danger:!0,disabled:0===nt.length}],children:(0,t.jsx)(R,{name:"Branches",groupPath:"__local__",icon:(0,t.jsx)("i",{className:"iconoir-git-branch text-[14px]","aria-hidden":"true"}),isExpanded:tW,onToggle:t1,visibilityMap:tY,onToggleVisibility:t3})}),tW&&(0,t.jsx)(P,{node:tA,currentBranch:$?.current,expandedFolders:tQ,onToggleFolder:t4,onCheckout:lO,onCheckoutToLocal:lT,onCreateBranch:()=>lU(),onDeleteBranch:lm,onRenameBranch:lf,onRenameRemoteBranch:lg,onRebase:lv,onMerge:lC,onPushToRemote:lE,onPullFromRemote:lP,getBranchContextMenuItems:ne,onBranchClick:lr,onBranchContextMenu:li,onDeleteBranchGroup:lh,selectedBranches:tH,visibilityMap:tY,onToggleVisibility:t3,depth:1,groupPath:"__local__",trackingInfo:$?.trackingInfo})]}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c,{items:[{label:"Fetch from all remotes",onClick:lA},{label:"Add remote",onClick:()=>{e8("origin"),ae(""),e7(!0)}}],children:(0,t.jsx)(R,{name:"Remotes",groupPath:"__remotes__",icon:(0,t.jsx)("i",{className:"iconoir-globe text-[14px]","aria-hidden":"true"}),isExpanded:tV,onToggle:t2,visibilityMap:tY,onToggleVisibility:t3})}),tV&&F&&!tI&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-sm opacity-70",style:{paddingLeft:"20px"},children:[(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,t.jsx)("span",{children:"Loading remotes..."})]}),tV&&tI&&Array.from(tI.entries()).map(([e,a])=>{let s=`__remotes__/${e}`,l=tQ.has(s);return(0,t.jsxs)("div",{children:[(0,t.jsx)(c,{items:[{label:`Fetch from ${e}`,onClick:()=>lI(e)},{label:"Rename",onClick:()=>{eY(e),eQ(e),eV(!0)}},{label:"Delete",onClick:()=>{e&&(e2(e),e0(!0))},danger:!0}],children:(0,t.jsx)(R,{name:e,groupPath:s,icon:(0,t.jsx)("i",{className:"iconoir-globe text-[14px] opacity-50","aria-hidden":"true"}),isExpanded:l,onToggle:()=>t4(s),visibilityMap:tY,onToggleVisibility:t3,depth:1})}),l&&(0,t.jsx)(P,{node:a,currentBranch:$?.current,expandedFolders:tQ,onToggleFolder:t4,onCheckout:lO,onCheckoutToLocal:lT,onCreateBranch:()=>lU(),onDeleteBranch:lm,onRenameBranch:lf,onRenameRemoteBranch:lg,onRebase:lv,onMerge:lC,onPushToRemote:lE,onPullFromRemote:lP,getBranchContextMenuItems:ne,onBranchClick:lr,onBranchContextMenu:li,onDeleteBranchGroup:lh,selectedBranches:tH,visibilityMap:tY,onToggleVisibility:t3,depth:2,groupPath:s,isRemote:!0,trackingInfo:$?.trackingInfo})]},e)})]})]})})]});return x&&100===d?(0,t.jsx)("div",{className:"flex items-center justify-center p-8 h-full",children:(0,t.jsx)("span",{className:"loading loading-spinner text-base-content/50"})}):y?(0,t.jsxs)("div",{className:"flex items-center justify-center p-8 h-full flex-col gap-4",children:[(0,t.jsx)("p",{className:"text-error font-medium",children:"Error Loading History"}),(0,t.jsx)("p",{className:"text-sm opacity-70",children:k?.message||"An unknown error occurred"}),(0,t.jsxs)("button",{onClick:()=>v(),className:"btn btn-outline btn-sm",children:[(0,t.jsx)("i",{className:"iconoir-refresh-circle text-[16px] mr-1","aria-hidden":"true"}),"Try Again"]})]}):u?(0,t.jsxs)("div",{className:"flex h-full overflow-hidden",children:[sA&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Reset to Commit"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to hard reset the current branch to commit ",(0,t.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:sO?.substring(0,7)}),"?",(0,t.jsx)("br",{}),(0,t.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,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:()=>sI(!1),disabled:s_,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-error",onClick:l_,disabled:s_,children:[s_&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Reset"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:()=>sI(!1),children:"close"})})]}),sz&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Revert Commit"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to revert commit ",(0,t.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:sq?.hash.substring(0,7)})," on ",(0,t.jsx)("span",{className:"font-bold break-all",children:$?.current||"current"}),"?"]}),sq?.message&&(0,t.jsx)("div",{className:"rounded border border-base-300 bg-base-200/40 px-3 py-2 text-xs break-words",children:sq.message}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:()=>{sW(!1),sV(null)},disabled:sG,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lK,disabled:sG,children:[sG&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Revert"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:()=>{sW(!1),sV(null)},children:"close"})})]}),sJ&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Reword Commit"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Reword commit ",(0,t.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:sU?.hash.substring(0,7)})," on branch ",(0,t.jsx)("span",{className:"font-bold",children:sU?.branch}),"."]}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono text-sm mb-3",value:sZ,onChange:e=>s0(e.target.value),autoFocus:!0,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&sZ.trim()&&!s4&&(e.preventDefault(),lz())},placeholder:"Commit subject",disabled:s4}),(0,t.jsx)("textarea",{className:"textarea textarea-bordered w-full h-32 font-mono text-sm",value:s1,onChange:e=>s2(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&sZ.trim()&&!s4&&(e.preventDefault(),lz())},placeholder:"Commit message body (optional)",disabled:s4}),sU?.branch!==$?.current&&(0,t.jsx)("div",{className:"alert alert-warning text-xs mt-2 py-2",children:(0,t.jsxs)("span",{children:["This will briefly checkout ",(0,t.jsx)("b",{children:sU?.branch})," to amend the commit."]})}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:tj,disabled:s4,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lz,disabled:!sZ.trim()||s4,children:[s4&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Reword"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:tj,children:"close"})})]}),ei&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:ec.length>1?"Delete Branches":"Delete Branch"}),ec.length>1?(0,t.jsxs)("div",{className:"py-4 space-y-3",children:[(0,t.jsxs)("p",{className:"break-words",children:["Are you sure you want to delete ",(0,t.jsxs)("span",{className:"font-bold",children:[ec.length," selected branches"]}),"? This action cannot be undone."]}),(0,t.jsx)("div",{className:"max-h-44 overflow-auto rounded border border-base-300 bg-base-200/40 p-2 space-y-1",children:ec.map(e=>(0,t.jsx)("div",{className:"text-xs min-w-0 break-all",children:e.startsWith("remotes/")?e.slice(8):e},e))})]}):(0,t.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete the branch ",(0,t.jsx)("span",{className:"font-bold break-all",children:ec[0]?.startsWith("remotes/")?ec[0].slice(8):ec[0]}),"? This action cannot be undone."]}),l2.length>0&&(0,t.jsx)("div",{className:"form-control",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:eh,onChange:e=>em(e.target.checked),disabled:eu}),(0,t.jsx)("span",{className:"label-text break-words whitespace-normal",children:1===l2.length?(0,t.jsxs)(t.Fragment,{children:["Delete tracking remote branch ",(0,t.jsx)("span",{className:"font-mono opacity-70 break-all",children:l2[0]})]}):(0,t.jsxs)(t.Fragment,{children:["Delete ",l2.length," tracking remote branches"]})})]})}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:()=>{eo(!1),ed([]),em(!1)},disabled:eu,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-error",onClick:lp,disabled:eu,children:[eu&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:()=>{eo(!1),ed([]),em(!1)},children:"close"})})]}),ep&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Delete Tag"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete the tag ",(0,t.jsx)("span",{className:"font-bold break-all",children:ef}),"? This action cannot be undone."]}),(0,t.jsx)("div",{className:"form-control",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:ej,onChange:e=>eN(e.target.checked),disabled:ey||!l1}),(0,t.jsx)("span",{className:"label-text break-words whitespace-normal",children:l1?(0,t.jsxs)(t.Fragment,{children:["Also delete from remote ",(0,t.jsx)("span",{className:"font-mono opacity-70",children:l1})]}):"No remote configured"})]})}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:lu,disabled:ey,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-error",onClick:lb,disabled:ey||!ef,children:[ey&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:lu,children:"close"})})]}),ev&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Cherry Pick"}),(0,t.jsx)("p",{className:"text-sm opacity-70 mt-1",children:eC.length>1?"Apply selected commits from oldest to newest":"Apply changes from the selected commit"}),1===eC.length?(0,t.jsxs)("p",{className:"py-4 break-words",children:["Are you sure to apply ",(0,t.jsx)("span",{className:"font-bold font-mono break-all",children:eC[0]?.hash})," ",(0,t.jsx)("span",{className:"font-bold break-words",children:eC[0]?.message})," to ",(0,t.jsx)("span",{className:"font-bold break-all",children:$?.current||"current"})," branch?"]}):(0,t.jsxs)("div",{className:"py-4 space-y-3",children:[(0,t.jsxs)("p",{className:"break-words",children:["Are you sure to apply ",(0,t.jsxs)("span",{className:"font-bold",children:[eC.length," selected commits"]})," to ",(0,t.jsx)("span",{className:"font-bold break-all",children:$?.current||"current"})," branch?"]}),(0,t.jsx)("div",{className:"max-h-44 overflow-auto rounded border border-base-300 bg-base-200/40 p-2 space-y-1",children:eC.map(e=>(0,t.jsxs)("div",{className:"text-xs min-w-0",children:[(0,t.jsx)("span",{className:"font-mono opacity-70",children:e.hash.slice(0,7)})," ",(0,t.jsx)("span",{className:"break-words",children:e.message})]},e.hash))})]}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:()=>{ew(!1),eS([])},disabled:eR,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lY,disabled:eR,children:[eR&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:()=>{ew(!1),eS([])},children:"close"})})]}),e$&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Cherry Pick In Progress"}),(0,t.jsx)("p",{className:"text-sm opacity-70 mt-1",children:"Another cherry-pick operation is currently in progress."}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Abort the in-progress cherry-pick and continue with ",eC.length>1?"the selected commits":"this commit","?"]}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:()=>{eB(!1),eS([])},disabled:eM,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-warning",onClick:()=>void lJ(),disabled:eM,children:[eM&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Abort and Continue"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:()=>{eB(!1),eS([])},children:"close"})})]}),eF&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:eA?"Rename Remote Branch":"Rename Branch"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Enter a new name for the branch ",(0,t.jsx)("span",{className:"font-bold break-all",children:eT}),". Press ",(0,t.jsx)("kbd",{className:"kbd kbd-sm",children:"Cmd"}),"+",(0,t.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full",value:eO,onChange:e=>eH((0,o.L9)(e.target.value)),placeholder:"New branch name",disabled:ez,autoFocus:!0,onKeyDown:e=>{let a="Enter"===e.key&&(e.metaKey||e.ctrlKey),s=eA?eO===eA.branch:eO===eT;a&&eO&&!s&&!ez&&lj()}}),!eA&&l4?.upstream&&(0,t.jsx)("div",{className:"form-control mt-2",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:e_,onChange:e=>eK(e.target.checked),disabled:ez}),(0,t.jsxs)("span",{className:"label-text break-words whitespace-normal",children:["Also rename tracking remote branch ",(0,t.jsx)("span",{className:"font-mono opacity-70 break-all",children:l4.upstream})]})]})}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:tp,disabled:ez,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lj,disabled:!eO||(eA?eO===eA.branch:eO===eT)||ez,children:[ez&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Rename"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:tp,children:"close"})})]}),eq&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Rename Remote"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Enter a new name for remote ",(0,t.jsx)("span",{className:"font-bold break-all",children:eG}),". Press ",(0,t.jsx)("kbd",{className:"kbd kbd-sm",children:"Cmd"}),"+",(0,t.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full",value:eJ,onChange:e=>eQ(e.target.value),placeholder:"New remote name",disabled:eU,autoFocus:!0,onKeyDown:e=>{let a="Enter"===e.key&&(e.metaKey||e.ctrlKey),s=eJ.trim(),t=s===(eG??"").trim();a&&s&&!t&&!eU&&lN()}}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:tb,disabled:eU,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lN,disabled:!eJ.trim()||eJ.trim()===(eG??"").trim()||eU,children:[eU&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Rename"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:tb,children:"close"})})]}),eZ&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Delete Remote"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete remote ",(0,t.jsx)("span",{className:"font-bold break-all",children:e1}),"? This removes all tracking branches for that remote."]}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:tf,disabled:e4,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-error",onClick:ly,disabled:!e1||e4,children:[e4&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:tf,children:"close"})})]}),e5&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Add Remote"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Add a new remote by providing a name and URL. Press ",(0,t.jsx)("kbd",{className:"kbd kbd-sm",children:"Cmd"}),"+",(0,t.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"label pt-0",children:(0,t.jsx)("span",{className:"label-text",children:"Remote name"})}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full",value:e6,onChange:e=>e8(e.target.value),placeholder:"origin",disabled:aa,autoFocus:!0})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"label pt-0",children:(0,t.jsx)("span",{className:"label-text",children:"Remote URL"})}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full",value:e9,onChange:e=>ae(e.target.value),placeholder:"https://github.com/owner/repo.git",disabled:aa,onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&e6.trim()&&e9.trim()&&!aa&&lk()}})]})]}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:tg,disabled:aa,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lk,disabled:!e6.trim()||!e9.trim()||aa,children:[aa&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Add"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:tg,children:"close"})})]}),at&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Rebase"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Copy commits from one branch to another.",(0,t.jsx)("br",{}),"Are you sure to rebase ",(0,t.jsx)("span",{className:"font-bold break-all",children:an})," onto ",(0,t.jsx)("span",{className:"font-bold break-all",children:ai}),"?"]}),(0,t.jsx)("div",{className:"form-control",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:ac,onChange:e=>ad(e.target.checked),disabled:ah}),(0,t.jsx)("span",{className:"label-text",children:"Stash and reapply local changes"})]})}),!ac&&(0,t.jsx)("p",{className:"text-xs text-warning mt-2 ml-6",children:"Warning: All local changes will be discarded."}),"checking"===au?(0,t.jsxs)("div",{className:"alert alert-info text-sm mt-4 py-2",children:[(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,t.jsxs)("span",{children:["Checking conflicts for rebasing ",(0,t.jsx)("span",{className:"font-bold break-all",children:an})," onto ",(0,t.jsx)("span",{className:"font-bold break-all",children:ai}),"..."]})]}):"no-conflict"===au?(0,t.jsxs)("div",{className:"alert alert-success text-sm mt-4 py-2",children:[(0,t.jsx)("i",{className:"iconoir-check-circle-solid text-[18px]","aria-hidden":"true"}),(0,t.jsxs)("span",{children:["No conflict: rebasing ",(0,t.jsx)("span",{className:"font-bold break-all",children:an})," onto ",(0,t.jsx)("span",{className:"font-bold break-all",children:ai})," will not cause conflicts."]})]}):(0,t.jsxs)("div",{className:"alert alert-warning text-sm mt-4 py-2",children:[(0,t.jsx)("i",{className:"iconoir-warning-circle-solid text-[18px]","aria-hidden":"true"}),(0,t.jsxs)("span",{children:["Conflicts detected: rebasing ",(0,t.jsx)("span",{className:"font-bold break-all",children:an})," onto ",(0,t.jsx)("span",{className:"font-bold break-all",children:ai})," will cause conflicts."]})]}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:ap,disabled:ah,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lw,disabled:ah,children:[ah&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:ap,children:"close"})})]}),ab&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Merge"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Merge branch into another one.",(0,t.jsx)("br",{}),"Are you sure to merge ",(0,t.jsx)("span",{className:"font-bold break-all",children:aN})," into ",(0,t.jsx)("span",{className:"font-bold break-all",children:ag}),"?"]}),(0,t.jsx)("div",{className:"form-control",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:ak,onChange:e=>av(e.target.checked),disabled:aB}),(0,t.jsx)("span",{className:"label-text",children:"Rebase before merge"})]})}),(0,t.jsx)("div",{className:"form-control",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:aw,onChange:e=>lS(e.target.checked),disabled:aB}),(0,t.jsx)("span",{className:"label-text",children:"Squash before merge"})]})}),aw&&(0,t.jsx)("textarea",{className:"textarea textarea-bordered w-full mt-2",placeholder:"Commit message for squash merge",value:aE,onChange:e=>a$(e.target.value),disabled:aB,autoFocus:!0}),(0,t.jsx)("div",{className:"form-control",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:aS,onChange:e=>aR(e.target.checked),disabled:aB}),(0,t.jsx)("span",{className:"label-text",children:"Fast forward merge"})]})}),"checking"===aP?(0,t.jsxs)("div",{className:"alert alert-info text-sm mt-4 py-2",children:[(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,t.jsxs)("span",{children:["Checking conflicts for merging ",(0,t.jsx)("span",{className:"font-bold break-all",children:aN})," into ",(0,t.jsx)("span",{className:"font-bold break-all",children:ag}),"..."]})]}):"no-conflict"===aP?(0,t.jsxs)("div",{className:"alert alert-success text-sm mt-4 py-2",children:[(0,t.jsx)("i",{className:"iconoir-check-circle-solid text-[18px]","aria-hidden":"true"}),(0,t.jsxs)("span",{children:["No conflict: merging ",(0,t.jsx)("span",{className:"font-bold break-all",children:aN})," into ",(0,t.jsx)("span",{className:"font-bold break-all",children:ag})," will not cause conflicts."]})]}):(0,t.jsxs)("div",{className:"alert alert-warning text-sm mt-4 py-2",children:[(0,t.jsx)("i",{className:"iconoir-warning-circle-solid text-[18px]","aria-hidden":"true"}),(0,t.jsxs)("span",{children:["Conflicts detected: merging ",(0,t.jsx)("span",{className:"font-bold break-all",children:aN})," into ",(0,t.jsx)("span",{className:"font-bold break-all",children:ag})," will cause conflicts."]})]}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:aD,disabled:aB,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lR,disabled:aB,children:[aB&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:aD,children:"close"})})]}),aT&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Push to Remote"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Push ",(0,t.jsx)("span",{className:"font-bold break-all",children:aA})," to a remote repository."]}),a6&&0===aO.length?(0,t.jsxs)("div",{className:"alert alert-error",children:[(0,t.jsx)("span",{className:"text-xl",children:"⚠️"}),(0,t.jsx)("span",{children:a6})]}):a9?(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)("span",{className:"loading loading-spinner loading-lg"})}):(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,t.jsx)("label",{className:"label flex-shrink-0",children:(0,t.jsx)("span",{className:"label-text",children:"Remote Repository"})}),(0,t.jsx)("select",{className:"select select-bordered w-64",value:a_,onChange:e=>l$(e.target.value),disabled:a5,children:aO.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]}),(0,t.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,t.jsx)("label",{className:"label flex-shrink-0",children:(0,t.jsx)("span",{className:"label-text",children:"Remote Branch"})}),(0,t.jsxs)("div",{className:"flex flex-col items-end gap-1 w-64",children:[sa?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-base-200 opacity-70 w-full",children:[(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"})," Loading branches..."]}):(0,t.jsxs)("select",{className:"select select-bordered w-full",value:aq,onChange:e=>aV(e.target.value),disabled:a5,children:[aA&&!az.includes(aA)&&(0,t.jsxs)("option",{value:aA,children:[aA," (new)"]}),az.map(e=>(0,t.jsxs)("option",{value:e,children:[e,aG?.remote===a_&&aG?.branch===e?" (tracking)":""]},e))]}),aq&&!az.includes(aq)&&(0,t.jsx)("div",{className:"label",children:(0,t.jsx)("span",{className:"label-text-alt text-warning",children:"New branch will be created"})})]})]}),(0,t.jsx)("div",{className:"form-control",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:aJ,onChange:e=>aQ(e.target.checked),disabled:a5||aU}),(0,t.jsx)("span",{className:"label-text",children:"Rebase onto remote branch before pushing"})]})}),(0,t.jsx)("div",{className:"form-control",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm checkbox-error",checked:aU,onChange:e=>aX(e.target.checked),disabled:a5}),(0,t.jsx)("span",{className:"label-text text-error",children:"Force push"})]})}),(0,t.jsx)("div",{className:"form-control",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:aZ,onChange:e=>a0(e.target.checked),disabled:a5}),(0,t.jsx)("span",{className:"label-text",children:"Push all tags"})]})}),(0,t.jsx)("div",{className:"form-control",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:a1,onChange:e=>lB(e.target.checked),disabled:a5}),(0,t.jsx)("span",{className:"label-text",children:"Squash local commits before push"})]})}),a1&&(0,t.jsx)("textarea",{className:"textarea textarea-bordered w-full",placeholder:"Commit message for squash",value:a4,onChange:e=>a3(e.target.value),disabled:a5,autoFocus:!0}),a6&&(0,t.jsx)("div",{className:"alert alert-error text-sm",children:(0,t.jsx)("span",{children:a6})})]}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:()=>aL(!1),disabled:a5,children:"Cancel"}),aO.length>0&&(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lM,disabled:a5||!a_||!aq,children:[a5&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"})," Push"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:()=>aL(!1),children:"close"})})]}),st&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Pull from Remote"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Pull changes from a remote branch into ",(0,t.jsx)("span",{className:"font-bold break-all",children:sn}),"."]}),sy&&0===si.length?(0,t.jsx)("div",{className:"alert alert-error",children:(0,t.jsx)("span",{children:sy})}):sv?(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)("span",{className:"loading loading-spinner loading-lg"})}):(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,t.jsx)("label",{className:"label flex-shrink-0",children:(0,t.jsx)("span",{className:"label-text",children:"Remote Repository"})}),(0,t.jsx)("select",{className:"select select-bordered w-64",value:sc,onChange:e=>lF(e.target.value),disabled:sj,children:si.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]}),(0,t.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,t.jsx)("label",{className:"label flex-shrink-0",children:(0,t.jsx)("span",{className:"label-text",children:"Remote Branch"})}),sC?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-base-200 opacity-70 w-64",children:[(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"})," Loading branches..."]}):(0,t.jsx)("select",{className:"select select-bordered w-64",value:su,onChange:e=>sx(e.target.value),disabled:sj,children:sh.map(e=>(0,t.jsxs)("option",{value:e,children:[e,sp?.remote===sc&&sp?.branch===e?" (tracking)":""]},e))})]}),(0,t.jsx)("div",{className:"form-control",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:sf,onChange:e=>sg(e.target.checked),disabled:sj}),(0,t.jsx)("span",{className:"label-text",children:"Rebase onto remote branch"})]})}),sy&&(0,t.jsx)("div",{className:"alert alert-error text-sm",children:(0,t.jsx)("span",{children:sy})})]}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:()=>sl(!1),disabled:sj,children:"Cancel"}),si.length>0&&(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lD,disabled:sj||!sc||!su,children:[sj&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"})," Pull"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:()=>sl(!1),children:"close"})})]}),U&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Create Tag"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Create a new tag at commit ",(0,t.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:Z?.substring(0,7)}),"."]}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono",value:ea,onChange:e=>es(e.target.value),placeholder:"Tag name",disabled:en,autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&ea.trim()&&!en&&lX()}}),(0,t.jsx)("div",{className:"form-control mt-3",children:(0,t.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:et,onChange:e=>el(e.target.checked),disabled:en}),(0,t.jsx)("span",{className:"label-text",children:"Push tag to remote after creation"})]})}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:()=>{X(!1),ee(null),es(""),el(!1)},disabled:en,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lX,disabled:!ea.trim()||en,children:[en&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Create"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:()=>{X(!1),ee(null),es(""),el(!1)},children:"close"})})]}),z&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Create New Branch"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Create a new branch from"," ",(0,t.jsx)("span",{className:"font-bold break-all",children:G?G.replace(/^remotes\//,""):"current HEAD"}),"."]}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full",value:q,onChange:e=>V((0,o.L9)(e.target.value)),placeholder:"Branch name",disabled:J,autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&q&&!J&&lQ()}}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:()=>{W(!1),Y(null)},disabled:J,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lQ,disabled:!q||J,children:[J&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"})," Create & Checkout"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:()=>{W(!1),Y(null)},children:"close"})})]}),s$&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box",children:[(0,t.jsx)("h3",{className:"font-bold text-lg",children:"Checkout to Local Branch"}),(0,t.jsxs)("p",{className:"py-4 break-words",children:["Create a local branch from ",(0,t.jsx)("span",{className:"font-bold break-all",children:sM?.replace(/^remotes\//,"")})," and set up tracking."]}),(0,t.jsxs)("div",{className:"form-control w-full",children:[(0,t.jsx)("label",{className:"label",children:(0,t.jsx)("span",{className:"label-text",children:"Local Branch Name"})}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full",value:sF,onChange:e=>sD((0,o.L9)(e.target.value)),placeholder:"Local branch name",disabled:sT,autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&sF&&!sT&&lL()}})]}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsx)("button",{className:"btn",onClick:()=>sB(!1),disabled:sT,children:"Cancel"}),(0,t.jsxs)("button",{className:"btn btn-primary",onClick:lL,disabled:!sF||sT,children:[sT&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"})," Checkout"]})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:()=>sB(!1),children:"close"})})]}),tn.isOpen&&(0,t.jsxs)("dialog",{className:"modal modal-open",children:[(0,t.jsxs)("div",{className:"modal-box max-w-4xl",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("h3",{className:"font-bold text-lg truncate",children:["Custom Script: ",tn.scriptName]}),(0,t.jsxs)("p",{className:"text-xs opacity-70 mt-1 break-all",children:["Branch: ",tn.branchRef]})]}),(0,t.jsx)("span",{className:(0,o.cn)("badge badge-sm shrink-0","running"===tn.status||"starting"===tn.status?"badge-info":"completed"===tn.status?"badge-success":"failed"===tn.status?"badge-error":"canceled"===tn.status?"badge-warning":"badge-ghost"),children:tn.status})]}),(0,t.jsx)("div",{className:"mt-4 border border-base-300 rounded bg-base-200/40",children:(0,t.jsx)("pre",{className:"p-3 font-mono text-xs overflow-auto max-h-[50vh] whitespace-pre-wrap break-words",children:tn.output||"Waiting for output..."})}),tn.error&&(0,t.jsx)("div",{className:"alert alert-error py-2 mt-3",children:(0,t.jsx)("span",{children:tn.error})}),(0,t.jsxs)("div",{className:"modal-action",children:[(0,t.jsxs)("button",{className:"btn btn-warning",onClick:()=>void lc(),disabled:!tu||ti,children:[ti&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Cancel"]}),(0,t.jsxs)("button",{className:"btn btn-outline",onClick:()=>void ld(),disabled:tc,children:[tc&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}),th?"Copied":"Copy"]}),(0,t.jsx)("button",{className:"btn btn-primary",onClick:()=>{tr(N),tm(!1),to(!1)},disabled:!tx,children:"Done"})]})]}),(0,t.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,t.jsx)("button",{onClick:e=>{tx?(tr(N),tm(!1),to(!1)):e.preventDefault()},children:"close"})})]}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 bg-base-100",children:[(0,t.jsx)("div",{className:"h-[57px] flex items-center px-6 border-b border-base-300 shrink-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)("h1",{className:"font-bold text-lg",children:"History"}),(0,t.jsxs)("div",{className:"relative",ref:tl,children:[(0,t.jsxs)("button",{className:"btn btn-sm gap-2 max-w-[24rem]",onClick:()=>tt(e=>!e),title:l7,children:[(0,t.jsx)("span",{className:"truncate",children:l7}),(0,t.jsx)("i",{className:(0,o.cn)("iconoir-nav-arrow-down text-[16px] shrink-0 transition-transform",ts&&"rotate-180"),"aria-hidden":"true"})]}),ts&&(0,t.jsx)("div",{className:"absolute left-0 top-full mt-2 z-50",children:nl})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,t.jsxs)("button",{className:"btn btn-sm gap-2",onClick:()=>void lA(),disabled:sR||st||aT,title:"Fetch latest changes from all remotes",children:[sR?(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,t.jsx)("i",{className:"iconoir-refresh text-[16px]","aria-hidden":"true"}),"Fetch"]}),(0,t.jsxs)("button",{className:"btn btn-sm gap-2",onClick:()=>{lZ&&!l8&&lP(lZ)},disabled:!!l8||st||aT,title:l8||`Pull from ${l6?.upstream}`,children:[sv?(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,t.jsx)("i",{className:"iconoir-arrow-down text-[16px]","aria-hidden":"true"}),"Pull"]}),(0,t.jsxs)("button",{className:"btn btn-sm gap-2",onClick:()=>{lZ&&!l9&&lE(lZ)},disabled:!!l9||st||aT,title:l9||(l6?`Push to ${l6.upstream}`:"Push current branch to remote"),children:[a9?(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,t.jsx)("i",{className:"iconoir-arrow-up text-[16px]","aria-hidden":"true"}),"Push"]})]})]})}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden relative",children:lt&&F?(0,t.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,t.jsx)("span",{className:"loading loading-spinner loading-lg opacity-50"})}):(0,t.jsx)(h,{ref:s5,commits:t6,selectedHash:T||void 0,selectedHashes:t8,onSelectCommit:la,onResetToCommit:lH,onRevertCommit:(e,a)=>{sV({hash:e,message:a}),sW(!0)},onCreateTag:e=>{ee(e),es(""),el(!1),X(!0)},onCherryPickCommit:(e,a)=>{eS([{hash:e,message:a}]),ew(!0)},onCherryPickSelectedCommits:()=>{ls.length<2||(eS(ls.map(e=>({hash:e.hash,message:e.message}))),ew(!0))},onRewordCommit:(e,a,s,t)=>{sX({hash:e,subject:a,body:s,branch:t}),s0(a),s2(s),sQ(!0)},localBranches:$?.branches||[],trackingInfo:$?.trackingInfo,onEndReached:()=>{!E&&u.all.length>=d&&m(e=>e+50)},isLoadingMore:E&&d>100,currentBranch:$?.current,hiddenBranches:ll,getBranchTagContextMenuItems:e=>{if(e.startsWith("tag:")){let a=e.replace(/^tag:\s*/,"").trim();return a?[{label:"Delete Tag",onClick:()=>lx(a),danger:!0}]:null}if(na.has(e))return ne({branchRef:e,branchLeafName:e.split("/").pop()||e,currentBranch:lZ,isRemote:!1});let a=ns.get(e);return a?ne({branchRef:a,branchLeafName:a.split("/").pop()||e,currentBranch:lZ,isRemote:!0}):null}})}),T&&(0,t.jsxs)("div",{className:"flex flex-col overflow-hidden border-t border-base-300 bg-base-200/30",style:{height:tw},children:[(0,t.jsx)("div",{className:(0,o.cn)("h-1.5 cursor-ns-resize flex items-center justify-center hover:bg-base-200 transition-colors group shrink-0",tS&&"bg-base-200"),onMouseDown:tT,children:(0,t.jsx)("div",{className:"w-8 h-1 rounded-full bg-base-300 group-hover:bg-base-content/20 transition-colors"})}),(0,t.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,t.jsxs)("div",{className:"flex items-center gap-4 flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-sm font-bold truncate",children:le?.message}),(0,t.jsx)("span",{className:"text-xs font-mono opacity-50 shrink-0",children:T.substring(0,7)})]}),(0,t.jsx)("div",{className:"flex items-center gap-1 shrink-0",children:(0,t.jsx)("button",{className:"ml-2 btn btn-ghost btn-xs btn-square",onClick:()=>_(null),title:"Close",children:"✕"})})]}),(0,t.jsxs)("div",{ref:tF,className:"flex-1 overflow-hidden bg-base-100 grid",style:{gridTemplateRows:`${t$}fr 6px ${1-t$}fr`},children:[(0,t.jsxs)("div",{className:"border-b border-base-300 bg-base-100 min-h-0 flex flex-col",children:[(0,t.jsx)("div",{className:"px-4 pt-3 pb-1 text-[10px] uppercase tracking-wider font-bold opacity-60",children:"Message"}),(0,t.jsx)("div",{className:"px-4 pb-3 overflow-auto flex-1 min-h-0",children:(0,t.jsx)("div",{className:"text-xs opacity-70 whitespace-pre-wrap font-mono",children:le?(le.body?.trim()?`${le.message}
7
+
8
+ ${le.body}`:le.message).replace(/\r\n/g,"\n").replace(/\\r\\n/g,"\n").replace(/\\n/g,"\n"):"No additional message"})})]}),(0,t.jsx)("div",{className:(0,o.cn)("cursor-ns-resize flex items-center justify-center hover:bg-base-200/60 transition-colors",tM&&"bg-base-200/60"),onMouseDown:tL,children:(0,t.jsx)("div",{className:"w-8 h-1 rounded-full bg-base-300"})}),(0,t.jsxs)("div",{className:"flex-1 overflow-hidden min-h-0 flex flex-col",children:[(0,t.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,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(w,{repoPath:e,commitHash:T})})]})]})]})]})]}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8 h-full opacity-70",children:"No history data available"})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{696:(e,t,r)=>{r.d(t,{F3:()=>d,GK:()=>p,Jy:()=>S,Lp:()=>m,Ud:()=>T,X0:()=>y,Y5:()=>u,_6:()=>w,_X:()=>b,a3:()=>q,cT:()=>v,en:()=>g,fr:()=>h,gg:()=>j,st:()=>x,t0:()=>l,uG:()=>f,xV:()=>k});var n=r(2115),a=r(4109),s=r(5625),o=r(8934),i=r(6695);let c="/api";function l(){return(0,a.I)({queryKey:["settings"],queryFn:async()=>{let e=await fetch(`${c}/settings`);if(!e.ok)throw Error("Failed to fetch settings");return e.json()}})}function u(){let e=(0,s.jE)();return(0,o.n)({mutationFn:async e=>{let t=await fetch(`${c}/settings`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("Failed to update settings");return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}})}function f(){return(0,a.I)({queryKey:["repos"],queryFn:async()=>{let e=await fetch(`${c}/repos`);if(!e.ok)throw Error("Failed to fetch repositories");return e.json()}})}function p(e){let{data:t}=f();return(0,n.useMemo)(()=>t?.find(t=>t.path===e)||null,[t,e])}function d(){let e=(0,s.jE)();return(0,o.n)({mutationFn:async({path:e,name:t,initializeIfNeeded:r})=>{let n=await fetch(`${c}/repos`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,name:t,initializeIfNeeded:r})});if(!n.ok)throw Error((await n.json().catch(()=>({}))).error||"Failed to add repository");return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["repos"]})}})}function h(){let e=(0,s.jE)();return(0,o.n)({mutationFn:async e=>{let t=await fetch(`${c}/repos/clone`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r.error||"Failed to clone repository");return r},onSuccess:()=>{e.invalidateQueries({queryKey:["repos"]})}})}function m(){let e=(0,s.jE)();return(0,o.n)({mutationFn:async({path:e,updates:t})=>{let r=await fetch(`${c}/repos`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,updates:t})});if(!r.ok)throw Error(await r.text());return r.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["repos"]})}})}function y(){let e=(0,s.jE)();return(0,o.n)({mutationFn:async({path:e,deleteLocalFolder:t=!1})=>{let r=await fetch(`${c}/repos`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,deleteLocalFolder:t})});if(!r.ok)throw Error(await r.text());return r.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["repos"]})}})}function g(e){return(0,a.I)({queryKey:["git",e,"status"],queryFn:async()=>{if(!e)return null;let t=await fetch(`${c}/git/status?path=${encodeURIComponent(e)}`);if(!t.ok){let e=Error((await t.json().catch(()=>({}))).error||"Failed to fetch status");throw e.status=t.status,e}return t.json()},enabled:!!e,refetchOnWindowFocus:!0,refetchOnReconnect:!0,retry:(e,t)=>404!==t.status&&400!==t.status&&e<3})}function b(e,t=50){return(0,a.I)({queryKey:["git",e,"log",t],queryFn:async()=>{if(!e)return null;let r=await fetch(`${c}/git/log?path=${encodeURIComponent(e)}&limit=${t}`);if(!r.ok){let e=Error((await r.json().catch(()=>({}))).error||"Failed to fetch log");throw e.status=r.status,e}return r.json()},enabled:!!e,placeholderData:e=>e,retry:(e,t)=>404!==t.status&&400!==t.status&&e<3})}function w(e){return(0,a.I)({queryKey:["git",e,"branches"],queryFn:async()=>{if(!e)return null;let t=await fetch(`${c}/git/branches?path=${encodeURIComponent(e)}`);if(!t.ok)throw Error("Failed to fetch branches");return t.json()},enabled:!!e})}function k(e,t){return(0,a.I)({queryKey:["git",e,"diff",t],queryFn:async()=>{if(!e||!t)return null;let r=await fetch(`${c}/git/diff?path=${encodeURIComponent(e)}&file=${encodeURIComponent(t)}`);if(!r.ok){let e=Error((await r.json().catch(()=>({}))).error||"Failed to fetch diff");throw e.status=r.status,e}return r.json()},enabled:!!e&&!!t,retry:(e,t)=>404!==t.status&&400!==t.status&&e<3})}function j(e,t){return(0,a.I)({queryKey:["git",e,"commit-diff",t],queryFn:async()=>{if(!e||!t)return null;let r=await fetch(`${c}/git/diff?path=${encodeURIComponent(e)}&commit=${encodeURIComponent(t)}`);if(!r.ok){let e=Error((await r.json().catch(()=>({}))).error||"Failed to fetch commit diff");throw e.status=r.status,e}return r.json()},enabled:!!e&&!!t,retry:(e,t)=>404!==t.status&&400!==t.status&&e<3})}function x(e,t,r){return(0,a.I)({queryKey:["git",e,"commit-file-diff",t,r],queryFn:async()=>{if(!e||!t||!r)return null;let n=await fetch(`${c}/git/diff?path=${encodeURIComponent(e)}&commit=${encodeURIComponent(t)}&file=${encodeURIComponent(r)}`);if(!n.ok){let e=Error((await n.json().catch(()=>({}))).error||"Failed to fetch file diff");throw e.status=n.status,e}return n.json()},enabled:!!e&&!!t&&!!r,retry:(e,t)=>404!==t.status&&400!==t.status&&e<3})}function S(e){return(0,a.I)({queryKey:["git",e,"stashes"],queryFn:async()=>{if(!e)return[];let t=await fetch(`${c}/git/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoPath:e,action:"stash-list"})});if(!t.ok)throw Error("Failed to fetch stashes");return(await t.json()).stashes||[]},enabled:!!e})}function v(e,t){return(0,a.I)({queryKey:["git",e,"stash-files",t],queryFn:async()=>{if(!e||null===t)return[];let r=await fetch(`${c}/git/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoPath:e,action:"stash-files",data:{index:t}})});if(!r.ok)throw Error("Failed to fetch stash files");return(await r.json()).files||[]},enabled:!!e&&null!==t})}function T(e,t,r){return(0,a.I)({queryKey:["git",e,"stash-file-diff",t,r],queryFn:async()=>{if(!e||null===t||!r)return{left:"",right:"",diff:""};let n=await fetch(`${c}/git/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoPath:e,action:"stash-file-diff",data:{index:t,file:r}})});if(!n.ok)throw Error("Failed to fetch stash file diff");return n.json()},enabled:!!e&&null!==t&&!!r})}let E={commit:"Commit",push:"Push",pull:"Pull",fetch:"Fetch",stage:"Stage",unstage:"Unstage",checkout:"Checkout","checkout-to-local":"Checkout",branch:"Create Branch","create-tag":"Create Tag","delete-branch":"Delete Branch","delete-remote-branch":"Delete Remote Branch","delete-remote":"Delete Remote","delete-tag":"Delete Tag","delete-remote-tag":"Delete Remote Tag","rename-branch":"Rename Branch","rename-remote-branch":"Rename Remote Branch","rename-remote":"Rename Remote","add-remote":"Add Remote",reset:"Reset",revert:"Revert Commit","cherry-pick":"Cherry Pick","cherry-pick-multiple":"Cherry Pick","cherry-pick-abort":"Cherry Pick",rebase:"Rebase",merge:"Merge","check-merge-conflicts":"Check Merge Conflicts","check-rebase-conflicts":"Check Rebase Conflicts","get-remotes":"Get Remotes","get-remote-branches":"Get Remote Branches","get-tracking-branch":"Get Tracking Branch","get-latest-commit-message":"Get Latest Commit Message","push-to-remote":"Push","pull-from-remote":"Pull",stash:"Stash","stash-apply":"Apply Stash","stash-drop":"Drop Stash","stash-pop":"Pop Stash",reword:"Reword Commit",discard:"Discard Changes","cleanup-lock-file":"Cleanup Lock File"},C=["check-merge-conflicts","check-rebase-conflicts","get-remotes","get-remote-branches","get-tracking-branch","get-latest-commit-message"];async function F(e){let t=await fetch(`${c}/git/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoPath:e,action:"cleanup-lock-file"})});if(!t.ok)throw Error("Failed to cleanup lock file");return t.json()}function q(){let e=(0,s.jE)();return(0,o.n)({mutationFn:async({repoPath:e,action:t,data:r})=>{let n=await fetch(`${c}/git/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoPath:e,action:t,data:r})});if(!n.ok)throw Error((await n.json()).error||"Failed to execute action");return n.json()},onSuccess:(t,r)=>{C.includes(r.action)||e.invalidateQueries({queryKey:["git",r.repoPath]})},onError:(t,r)=>{if(!C.includes(r.action)&&!r.suppressErrorToast){let n=E[r.action]||r.action;t.message.includes("Unable to create")&&t.message.includes(".git/index.lock")?(0,i.tk)(t,{operation:n,fixLabel:"Remove Lock File",onFix:async()=>{await F(r.repoPath),e.invalidateQueries({queryKey:["git",r.repoPath]})}}):(0,i.tk)(t,{operation:n})}}})}},6695:(e,t,r)=>{r.d(t,{dj:()=>h,oR:()=>d,tk:()=>m});var n=r(2115);let a=5e3;async function s(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)}}}let o=0;function i(){return(o=(o+1)%Number.MAX_SAFE_INTEGER).toString()}let c=new Map,l=(e,t=a)=>{if(c.has(e))return;let r=setTimeout(()=>{c.delete(e),p({type:"REMOVE_TOAST",toastId:e})},t);c.set(e,r)},u=[],f={toasts:[]};function p(e){f=((e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,5)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?l(r,0):e.toasts.forEach(e=>{l(e.id,0)}),{...e,toasts:e.toasts.filter(e=>e.id!==r&&void 0!==r)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}})(f,e),u.forEach(e=>{e(f)})}function d(e){let t=i();return p({type:"ADD_TOAST",toast:{...e,id:t}}),l(t,e.duration||a),{id:t,dismiss:()=>p({type:"DISMISS_TOAST",toastId:t}),update:e=>p({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function h(){let[e,t]=n.useState(f);return n.useEffect(()=>(u.push(t),()=>{let e=u.indexOf(t);e>-1&&u.splice(e,1)}),[e]),{...e,toast:d,dismiss:e=>p({type:"DISMISS_TOAST",toastId:e})}}function m(e,t={}){let r="string"==typeof e?e:e.message,a=t.title||(t.operation?`${t.operation} Failed`:"Git Operation Failed"),o=i();return d({type:"error",title:a,description:n.createElement(()=>{let[e,a]=n.useState(!1),[i,c]=n.useState(!1),l=async e=>{e.stopPropagation(),await s(r)&&(a(!0),setTimeout(()=>a(!1),2e3))},u=async e=>{if(e.stopPropagation(),t.onFix){c(!0);try{await t.onFix(),p({type:"DISMISS_TOAST",toastId:o})}catch(e){console.error("Fix failed",e),c(!1)}}};return n.createElement("div",{className:"mt-2 space-y-3"},n.createElement("div",{className:"max-h-[120px] overflow-y-auto whitespace-pre-wrap font-mono text-[11px] leading-relaxed bg-black/20 p-3 rounded-md break-all text-error-content/90 border border-error-content/20"},r),n.createElement("div",{className:"flex gap-2"},n.createElement("button",{onClick:l,type:"button",className:`btn btn-xs ${e?"btn-success text-white":"bg-white/20 hover:bg-white/30 text-white border-white/20"}`},e?"Copied!":"Copy Error"),t.onFix?n.createElement("button",{onClick:u,type:"button",disabled:i,className:"btn btn-xs btn-warning text-white"},i?"Fixing...":t.fixLabel||"Fix Issue"):null))}),duration:1e4}),{id:o,dismiss:()=>p({type:"DISMISS_TOAST",toastId:o})}}},8599:(e,t,r)=>{r.d(t,{L9:()=>y,cn:()=>s,iu:()=>i,kO:()=>d,kj:()=>o,tq:()=>m,u:()=>h});var n=r(9722),a=r(622);function s(...e){return(0,a.QP)((0,n.$)(e))}function o(e){let t=e.replace(/[\\/]+$/,"").split(/[/\\]/).filter(Boolean);return t[t.length-1]||e}function i(e){let t=e.displayName?.trim();return t||(e.name?.trim()?e.name:o(e.path))}function c(e){if(!e)return"";let t=e.split("/").pop()||"",r=t.lastIndexOf(".");return -1===r||0===r?t.toLowerCase():t.slice(r+1).toLowerCase()}let l=new Set(["js","jsx","ts","tsx","mjs","cjs","mts","cts","py","pyw","pyi","pyx","rb","rake","gemspec","java","kt","kts","scala","sc","groovy","gradle","c","h","cpp","cc","cxx","hpp","hh","hxx","c++","h++","cs","fs","fsx","fsi","go","rs","swift","dart","zig","nim","v","odin","php","phtml","php3","php4","php5","php7","phps","pl","pm","pod","t","psgi","lua","tcl","r","R","jl","ex","exs","erl","hrl","clj","cljs","cljc","edn","lisp","lsp","el","scm","ss","rkt","hs","lhs","elm","purs","ml","mli","f90","f95","f03","f08","for","asm","s","S","vhd","vhdl","v","sv","svh","bas","vb","vbs","vba","pas","pp","inc","dpr","dpk","sh","bash","zsh","fish","ksh","csh","tcsh","ps1","psm1","psd1","bat","cmd","html","htm","xhtml","shtml","css","scss","sass","less","styl","stylus","pcss","postcss","svg","xml","xsl","xslt","xsd","dtd","rss","atom","rdf","wsdl","soap","vue","svelte","astro","mdx","hbs","handlebars","mustache","ejs","pug","jade","haml","slim","erb","graphql","gql","json","json5","jsonc","jsonl","ndjson","geojson","yaml","yml","toml","ini","cfg","conf","config","properties","env","csv","tsv","psv","txt","text","log","out","md","markdown","mdown","mkd","mkdn","mdwn","rst","rest","adoc","asciidoc","asc","org","tex","latex","ltx","bib","sty","cls","rtf","diff","patch","gitignore","gitattributes","gitmodules","gitconfig","dockerignore","dockerfile","containerfile","editorconfig","prettierrc","eslintrc","babelrc","stylelintrc","browserslistrc","npmrc","nvmrc","yarnrc","pnpmfile","makefile","mk","cmake","make","mak","rake","podfile","gemfile","fastfile","sql","plsql","pgsql","mysql","sqlite","hql","cql","proto","protobuf","thrift","avro","capnp","fbs","flatc","tf","tfvars","hcl","nomad","sentinel","prisma","graphqls","lock"]),u=new Set(["jpg","jpeg","png","gif","bmp","ico","icns","tiff","tif","webp","avif","heic","heif","psd","ai","eps","raw","cr2","nef","orf","sr2","dng","mp4","avi","mov","wmv","flv","mkv","webm","m4v","mpeg","mpg","3gp","3g2","ogv","mp3","wav","ogg","oga","flac","aac","m4a","wma","aiff","aif","mid","midi","opus","zip","rar","7z","tar","gz","bz2","xz","lz","lzma","lz4","zst","cab","iso","dmg","exe","dll","so","dylib","a","lib","obj","o","app","msi","deb","rpm","apk","ipa","pkg","snap","flatpak","appimage","class","jar","war","ear","pyc","pyo","pyd","beam","wasm","wat","pdf","doc","docx","xls","xlsx","ppt","pptx","odt","ods","odp","pages","numbers","key","ttf","otf","woff","woff2","eot","fon","fnt","db","sqlite","sqlite3","mdb","accdb","frm","myd","myi","ibd","bin","dat","data","sav","bak","swf","fla","blend","fbx","obj","stl","gltf","glb","3ds","dae","ply","sketch","fig","xd","unity","unitypackage","asset","prefab","meta"]),f=new Set(["png","jpg","jpeg","gif","bmp","ico","icns","tiff","tif","webp","avif","heic","heif","svg"]);function p(e){if(!e)return!1;if(e.includes("\0"))return!0;let t=e.slice(0,8192),r=0;for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n<32&&9!==n&&10!==n&&13!==n&&r++}return t.length>0&&r/t.length>.1}function d(e,t,r){let n=function(e){if(!e)return"unknown";let t=c(e);return l.has(t)?"text":u.has(t)?"binary":"unknown"}(e);return"binary"===n||"text"!==n&&(p(t||"")||p(r||""))}function h(e){return f.has(c(e))}function m(e){return e?e.split("\n").reduce((e,t)=>t.startsWith("+++ ")||t.startsWith("--- ")?e:t.startsWith("+")||t.startsWith("-")?e+1:e,0):0}function y(e){return e.replace(/[\s~^:?*\[\]\\@{}<>|"'`!#$%&()+=;,]/g,"-").replace(/\.{2,}/g,"-").replace(/\/{2,}/g,"/").replace(/-{2,}/g,"-")}}}]);
@@ -1,3 +1,3 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[772],{751:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RouterContext",{enumerable:!0,get:function(){return i}});let i=r(3623)._(r(2115)).default.createContext(null)},2590:(e,t)=>{function r({widthInt:e,heightInt:t,blurWidth:r,blurHeight:i,blurDataURL:n,objectFit:o}){let a=r?40*r:e,l=i?40*i:t,s=a&&l?`viewBox='0 0 ${a} ${l}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${s}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${s?"none":"contain"===o?"xMidYMid":"cover"===o?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${n}'/%3E%3C/svg%3E`}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},5413:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return u}}),r(7284);let i=r(3887),n=r(2590),o=r(5762),a=["-moz-initial","fill","none","scale-down",void 0];function l(e){return void 0!==e.default}function s(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function u({src:e,sizes:t,unoptimized:r=!1,priority:u=!1,preload:d=!1,loading:c,className:f,quality:p,width:g,height:m,fill:h=!1,style:b,overrideSrc:y,onLoad:_,onLoadingComplete:v,placeholder:w="empty",blurDataURL:j,fetchPriority:P,decoding:O="async",layout:x,objectFit:C,objectPosition:S,lazyBoundary:E,lazyRoot:R,...z},M){var I;let $,D,k,{imgConf:A,showAltText:N,blurComplete:L,defaultLoader:T}=M,q=A||o.imageConfigDefault;if("allSizes"in q)$=q;else{let e=[...q.deviceSizes,...q.imageSizes].sort((e,t)=>e-t),t=q.deviceSizes.sort((e,t)=>e-t),r=q.qualities?.sort((e,t)=>e-t);$={...q,allSizes:e,deviceSizes:t,qualities:r}}if(void 0===T)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let F=z.loader||T;delete z.loader,delete z.srcSet;let U="__next_img_default"in F;if(U){if("custom"===$.loader)throw Object.defineProperty(Error(`Image with src "${e}" is missing "loader" prop.
2
- Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=F;F=t=>{let{config:r,...i}=t;return e(i)}}if(x){"fill"===x&&(h=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[x];e&&(b={...b,...e});let r={responsive:"100vw",fill:"100vw"}[x];r&&!t&&(t=r)}let B="",W=s(g),G=s(m);if((I=e)&&"object"==typeof I&&(l(I)||void 0!==I.src)){let t=l(e)?e.default:e;if(!t.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!t.height||!t.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(D=t.blurWidth,k=t.blurHeight,j=j||t.blurDataURL,B=t.src,!h)if(W||G){if(W&&!G){let e=W/t.width;G=Math.round(t.height*e)}else if(!W&&G){let e=G/t.height;W=Math.round(t.width*e)}}else W=t.width,G=t.height}let V=!u&&!d&&("lazy"===c||void 0===c);(!(e="string"==typeof e?e:B)||e.startsWith("data:")||e.startsWith("blob:"))&&(r=!0,V=!1),$.unoptimized&&(r=!0),U&&!$.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(r=!0);let X=s(p),H=Object.assign(h?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:C,objectPosition:S}:{},N?{}:{color:"transparent"},b),J=L||"empty"===w?null:"blur"===w?`url("data:image/svg+xml;charset=utf-8,${(0,n.getImageBlurSvg)({widthInt:W,heightInt:G,blurWidth:D,blurHeight:k,blurDataURL:j||"",objectFit:H.objectFit})}")`:`url("${w}")`,Q=a.includes(H.objectFit)?"fill"===H.objectFit?"100% 100%":"cover":H.objectFit,Y=J?{backgroundSize:Q,backgroundPosition:H.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:J}:{},K=function({config:e,src:t,unoptimized:r,width:n,quality:o,sizes:a,loader:l}){if(r){let e=(0,i.getDeploymentId)();if(t.startsWith("/")&&!t.startsWith("//")&&e){let r=t.includes("?")?"&":"?";t=`${t}${r}dpl=${e}`}return{src:t,srcSet:void 0,sizes:void 0}}let{widths:s,kind:u}=function({deviceSizes:e,allSizes:t},r,i){if(i){let r=/(^|\s)(1?\d?\d)vw/g,n=[];for(let e;e=r.exec(i);)n.push(parseInt(e[2]));if(n.length){let r=.01*Math.min(...n);return{widths:t.filter(t=>t>=e[0]*r),kind:"w"}}return{widths:t,kind:"w"}}return"number"!=typeof r?{widths:e,kind:"w"}:{widths:[...new Set([r,2*r].map(e=>t.find(t=>t>=e)||t[t.length-1]))],kind:"x"}}(e,n,a),d=s.length-1;return{sizes:a||"w"!==u?a:"100vw",srcSet:s.map((r,i)=>`${l({config:e,src:t,quality:o,width:r})} ${"w"===u?r:i+1}${u}`).join(", "),src:l({config:e,src:t,quality:o,width:s[d]})}}({config:$,src:e,unoptimized:r,width:W,quality:X,sizes:t,loader:F}),Z=V?"lazy":c;return{props:{...z,loading:Z,fetchPriority:P,width:W,height:G,decoding:O,className:f,style:{...H,...Y},sizes:K.sizes,srcSet:K.srcSet,src:y||K.src},meta:{unoptimized:r,preload:d||u,placeholder:w,fill:h}}}},5762:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var r={VALID_LOADERS:function(){return n},imageConfigDefault:function(){return o}};for(var i in r)Object.defineProperty(t,i,{enumerable:!0,get:r[i]});let n=["default","imgix","cloudinary","akamai","custom"],o={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1}},5772:(e,t,r)=>{r.d(t,{default:()=>n.a});var i=r(7651),n=r.n(i)},6095:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let i=r(8857),n=r(3887);function o({config:e,src:t,width:r,quality:o}){if(t.startsWith("/")&&t.includes("?")&&e.localPatterns?.length===1&&"**"===e.localPatterns[0].pathname&&""===e.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${t}" is using a query string which is not configured in images.localPatterns.
3
- Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let a=(0,i.findClosestQuality)(o,e),l=(0,n.getDeploymentId)();return`${e.path}?url=${encodeURIComponent(t)}&w=${r}&q=${a}${t.startsWith("/")&&l?`&dpl=${l}`:""}`}o.__next_img_default=!0;let a=o},6686:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var i={default:function(){return m},defaultHead:function(){return c}};for(var n in i)Object.defineProperty(t,n,{enumerable:!0,get:i[n]});let o=r(3623),a=r(6388),l=r(5155),s=a._(r(2115)),u=o._(r(6899)),d=r(5368);function c(){return[(0,l.jsx)("meta",{charSet:"utf-8"},"charset"),(0,l.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function f(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===s.default.Fragment?e.concat(s.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}r(7284);let p=["name","httpEquiv","charSet","itemProp"];function g(e){let t,r,i,n;return e.reduce(f,[]).reverse().concat(c().reverse()).filter((t=new Set,r=new Set,i=new Set,n={},e=>{let o=!0,a=!1;if(e.key&&"number"!=typeof e.key&&e.key.indexOf("$")>0){a=!0;let r=e.key.slice(e.key.indexOf("$")+1);t.has(r)?o=!1:t.add(r)}switch(e.type){case"title":case"base":r.has(e.type)?o=!1:r.add(e.type);break;case"meta":for(let t=0,r=p.length;t<r;t++){let r=p[t];if(e.props.hasOwnProperty(r))if("charSet"===r)i.has(r)?o=!1:i.add(r);else{let t=e.props[r],i=n[r]||new Set;("name"!==r||!a)&&i.has(t)?o=!1:(i.add(t),n[r]=i)}}}return o})).reverse().map((e,t)=>{let r=e.key||t;return s.default.cloneElement(e,{key:r})})}let m=function({children:e}){let t=(0,s.useContext)(d.HeadManagerContext);return(0,l.jsx)(u.default,{reduceComponentsToState:g,headManager:t,children:e})};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6899:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let i=r(2115),n=i.useLayoutEffect,o=i.useEffect;function a(e){let{headManager:t,reduceComponentsToState:r}=e;function a(){if(t&&t.mountedInstances){let e=i.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(r(e))}}return n(()=>(t?.mountedInstances?.add(e.children),()=>{t?.mountedInstances?.delete(e.children)})),n(()=>(t&&(t._pendingUpdate=a),()=>{t&&(t._pendingUpdate=a)})),o(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},7150:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ImageConfigContext",{enumerable:!0,get:function(){return o}});let i=r(3623)._(r(2115)),n=r(5762),o=i.default.createContext(n.imageConfigDefault)},7651:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var i={default:function(){return d},getImageProps:function(){return u}};for(var n in i)Object.defineProperty(t,n,{enumerable:!0,get:i[n]});let o=r(3623),a=r(5413),l=r(8437),s=o._(r(6095));function u(e){let{props:t}=(0,a.getImgProps)(e,{defaultLoader:s.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}}let d=l.Image},8437:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return v}});let i=r(3623),n=r(6388),o=r(5155),a=n._(r(2115)),l=i._(r(7650)),s=i._(r(6686)),u=r(5413),d=r(5762),c=r(7150);r(7284);let f=r(751),p=i._(r(6095)),g=r(1172),m={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function h(e,t,r,i,n,o,a){let l=e?.src;e&&e["data-loaded-src"]!==l&&(e["data-loaded-src"]=l,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&n(!0),r?.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let i=!1,n=!1;r.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>i,isPropagationStopped:()=>n,persist:()=>{},preventDefault:()=>{i=!0,t.preventDefault()},stopPropagation:()=>{n=!0,t.stopPropagation()}})}i?.current&&i.current(e)}}))}function b(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}let y=(0,a.forwardRef)(({src:e,srcSet:t,sizes:r,height:i,width:n,decoding:l,className:s,style:u,fetchPriority:d,placeholder:c,loading:f,unoptimized:p,fill:m,onLoadRef:y,onLoadingCompleteRef:_,setBlurComplete:v,setShowAltText:w,sizesInput:j,onLoad:P,onError:O,...x},C)=>{let S=(0,a.useCallback)(e=>{e&&(O&&(e.src=e.src),e.complete&&h(e,c,y,_,v,p,j))},[e,c,y,_,v,O,p,j]),E=(0,g.useMergedRef)(C,S);return(0,o.jsx)("img",{...x,...b(d),loading:f,width:n,height:i,decoding:l,"data-nimg":m?"fill":"1",className:s,style:u,sizes:r,srcSet:t,src:e,ref:E,onLoad:e=>{h(e.currentTarget,c,y,_,v,p,j)},onError:e=>{w(!0),"empty"!==c&&v(!0),O&&O(e)}})});function _({isAppRouter:e,imgAttributes:t}){let r={as:"image",imageSrcSet:t.srcSet,imageSizes:t.sizes,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,...b(t.fetchPriority)};return e&&l.default.preload?(l.default.preload(t.src,r),null):(0,o.jsx)(s.default,{children:(0,o.jsx)("link",{rel:"preload",href:t.srcSet?void 0:t.src,...r},"__nimg-"+t.src+t.srcSet+t.sizes)})}let v=(0,a.forwardRef)((e,t)=>{let r=(0,a.useContext)(f.RouterContext),i=(0,a.useContext)(c.ImageConfigContext),n=(0,a.useMemo)(()=>{let e=m||i||d.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>e-t),r=e.deviceSizes.sort((e,t)=>e-t),n=e.qualities?.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:r,qualities:n,localPatterns:e.localPatterns}},[i]),{onLoad:l,onLoadingComplete:s}=e,g=(0,a.useRef)(l);(0,a.useEffect)(()=>{g.current=l},[l]);let h=(0,a.useRef)(s);(0,a.useEffect)(()=>{h.current=s},[s]);let[b,v]=(0,a.useState)(!1),[w,j]=(0,a.useState)(!1),{props:P,meta:O}=(0,u.getImgProps)(e,{defaultLoader:p.default,imgConf:n,blurComplete:b,showAltText:w});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(y,{...P,unoptimized:O.unoptimized,placeholder:O.placeholder,fill:O.fill,onLoadRef:g,onLoadingCompleteRef:h,setBlurComplete:v,setShowAltText:j,sizesInput:e.sizes,ref:t}),O.preload?(0,o.jsx)(_,{isAppRouter:!r,imgAttributes:P}):null]})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8857:(e,t)=>{function r(e,t){let r=e||75;return t?.qualities?.length?t.qualities.reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e,0):r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"findClosestQuality",{enumerable:!0,get:function(){return r}})}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[437],{751:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RouterContext",{enumerable:!0,get:function(){return i}});let i=r(3623)._(r(2115)).default.createContext(null)},2590:(e,t)=>{function r({widthInt:e,heightInt:t,blurWidth:r,blurHeight:i,blurDataURL:n,objectFit:o}){let a=r?40*r:e,l=i?40*i:t,s=a&&l?`viewBox='0 0 ${a} ${l}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${s}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${s?"none":"contain"===o?"xMidYMid":"cover"===o?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${n}'/%3E%3C/svg%3E`}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},5413:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return u}}),r(7284);let i=r(3887),n=r(2590),o=r(5762),a=["-moz-initial","fill","none","scale-down",void 0];function l(e){return void 0!==e.default}function s(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function u({src:e,sizes:t,unoptimized:r=!1,priority:u=!1,preload:d=!1,loading:c,className:f,quality:p,width:g,height:m,fill:h=!1,style:b,overrideSrc:y,onLoad:_,onLoadingComplete:v,placeholder:w="empty",blurDataURL:j,fetchPriority:P,decoding:x="async",layout:C,objectFit:E,objectPosition:O,lazyBoundary:S,lazyRoot:R,...z},M){var $;let I,D,k,{imgConf:A,showAltText:N,blurComplete:T,defaultLoader:F}=M,L=A||o.imageConfigDefault;if("allSizes"in L)I=L;else{let e=[...L.deviceSizes,...L.imageSizes].sort((e,t)=>e-t),t=L.deviceSizes.sort((e,t)=>e-t),r=L.qualities?.sort((e,t)=>e-t);I={...L,allSizes:e,deviceSizes:t,qualities:r}}if(void 0===F)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let U=z.loader||F;delete z.loader,delete z.srcSet;let q="__next_img_default"in U;if(q){if("custom"===I.loader)throw Object.defineProperty(Error(`Image with src "${e}" is missing "loader" prop.
2
+ Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=U;U=t=>{let{config:r,...i}=t;return e(i)}}if(C){"fill"===C&&(h=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[C];e&&(b={...b,...e});let r={responsive:"100vw",fill:"100vw"}[C];r&&!t&&(t=r)}let B="",W=s(g),G=s(m);if(($=e)&&"object"==typeof $&&(l($)||void 0!==$.src)){let t=l(e)?e.default:e;if(!t.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!t.height||!t.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(D=t.blurWidth,k=t.blurHeight,j=j||t.blurDataURL,B=t.src,!h)if(W||G){if(W&&!G){let e=W/t.width;G=Math.round(t.height*e)}else if(!W&&G){let e=G/t.height;W=Math.round(t.width*e)}}else W=t.width,G=t.height}let X=!u&&!d&&("lazy"===c||void 0===c);(!(e="string"==typeof e?e:B)||e.startsWith("data:")||e.startsWith("blob:"))&&(r=!0,X=!1),I.unoptimized&&(r=!0),q&&!I.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(r=!0);let H=s(p),V=Object.assign(h?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:E,objectPosition:O}:{},N?{}:{color:"transparent"},b),J=T||"empty"===w?null:"blur"===w?`url("data:image/svg+xml;charset=utf-8,${(0,n.getImageBlurSvg)({widthInt:W,heightInt:G,blurWidth:D,blurHeight:k,blurDataURL:j||"",objectFit:V.objectFit})}")`:`url("${w}")`,Q=a.includes(V.objectFit)?"fill"===V.objectFit?"100% 100%":"cover":V.objectFit,Y=J?{backgroundSize:Q,backgroundPosition:V.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:J}:{},K=function({config:e,src:t,unoptimized:r,width:n,quality:o,sizes:a,loader:l}){if(r){let e=(0,i.getDeploymentId)();if(t.startsWith("/")&&!t.startsWith("//")&&e){let r=t.includes("?")?"&":"?";t=`${t}${r}dpl=${e}`}return{src:t,srcSet:void 0,sizes:void 0}}let{widths:s,kind:u}=function({deviceSizes:e,allSizes:t},r,i){if(i){let r=/(^|\s)(1?\d?\d)vw/g,n=[];for(let e;e=r.exec(i);)n.push(parseInt(e[2]));if(n.length){let r=.01*Math.min(...n);return{widths:t.filter(t=>t>=e[0]*r),kind:"w"}}return{widths:t,kind:"w"}}return"number"!=typeof r?{widths:e,kind:"w"}:{widths:[...new Set([r,2*r].map(e=>t.find(t=>t>=e)||t[t.length-1]))],kind:"x"}}(e,n,a),d=s.length-1;return{sizes:a||"w"!==u?a:"100vw",srcSet:s.map((r,i)=>`${l({config:e,src:t,quality:o,width:r})} ${"w"===u?r:i+1}${u}`).join(", "),src:l({config:e,src:t,quality:o,width:s[d]})}}({config:I,src:e,unoptimized:r,width:W,quality:H,sizes:t,loader:U}),Z=X?"lazy":c;return{props:{...z,loading:Z,fetchPriority:P,width:W,height:G,decoding:x,className:f,style:{...V,...Y},sizes:K.sizes,srcSet:K.srcSet,src:y||K.src},meta:{unoptimized:r,preload:d||u,placeholder:w,fill:h}}}},5762:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var r={VALID_LOADERS:function(){return n},imageConfigDefault:function(){return o}};for(var i in r)Object.defineProperty(t,i,{enumerable:!0,get:r[i]});let n=["default","imgix","cloudinary","akamai","custom"],o={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1}},6095:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let i=r(8857),n=r(3887);function o({config:e,src:t,width:r,quality:o}){if(t.startsWith("/")&&t.includes("?")&&e.localPatterns?.length===1&&"**"===e.localPatterns[0].pathname&&""===e.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${t}" is using a query string which is not configured in images.localPatterns.
3
+ Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let a=(0,i.findClosestQuality)(o,e),l=(0,n.getDeploymentId)();return`${e.path}?url=${encodeURIComponent(t)}&w=${r}&q=${a}${t.startsWith("/")&&l?`&dpl=${l}`:""}`}o.__next_img_default=!0;let a=o},6686:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var i={default:function(){return m},defaultHead:function(){return c}};for(var n in i)Object.defineProperty(t,n,{enumerable:!0,get:i[n]});let o=r(3623),a=r(6388),l=r(5155),s=a._(r(2115)),u=o._(r(6899)),d=r(5368);function c(){return[(0,l.jsx)("meta",{charSet:"utf-8"},"charset"),(0,l.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function f(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===s.default.Fragment?e.concat(s.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}r(7284);let p=["name","httpEquiv","charSet","itemProp"];function g(e){let t,r,i,n;return e.reduce(f,[]).reverse().concat(c().reverse()).filter((t=new Set,r=new Set,i=new Set,n={},e=>{let o=!0,a=!1;if(e.key&&"number"!=typeof e.key&&e.key.indexOf("$")>0){a=!0;let r=e.key.slice(e.key.indexOf("$")+1);t.has(r)?o=!1:t.add(r)}switch(e.type){case"title":case"base":r.has(e.type)?o=!1:r.add(e.type);break;case"meta":for(let t=0,r=p.length;t<r;t++){let r=p[t];if(e.props.hasOwnProperty(r))if("charSet"===r)i.has(r)?o=!1:i.add(r);else{let t=e.props[r],i=n[r]||new Set;("name"!==r||!a)&&i.has(t)?o=!1:(i.add(t),n[r]=i)}}}return o})).reverse().map((e,t)=>{let r=e.key||t;return s.default.cloneElement(e,{key:r})})}let m=function({children:e}){let t=(0,s.useContext)(d.HeadManagerContext);return(0,l.jsx)(u.default,{reduceComponentsToState:g,headManager:t,children:e})};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6899:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let i=r(2115),n=i.useLayoutEffect,o=i.useEffect;function a(e){let{headManager:t,reduceComponentsToState:r}=e;function a(){if(t&&t.mountedInstances){let e=i.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(r(e))}}return n(()=>(t?.mountedInstances?.add(e.children),()=>{t?.mountedInstances?.delete(e.children)})),n(()=>(t&&(t._pendingUpdate=a),()=>{t&&(t._pendingUpdate=a)})),o(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},7150:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ImageConfigContext",{enumerable:!0,get:function(){return o}});let i=r(3623)._(r(2115)),n=r(5762),o=i.default.createContext(n.imageConfigDefault)},8437:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return v}});let i=r(3623),n=r(6388),o=r(5155),a=n._(r(2115)),l=i._(r(7650)),s=i._(r(6686)),u=r(5413),d=r(5762),c=r(7150);r(7284);let f=r(751),p=i._(r(6095)),g=r(1172),m={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function h(e,t,r,i,n,o,a){let l=e?.src;e&&e["data-loaded-src"]!==l&&(e["data-loaded-src"]=l,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&n(!0),r?.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let i=!1,n=!1;r.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>i,isPropagationStopped:()=>n,persist:()=>{},preventDefault:()=>{i=!0,t.preventDefault()},stopPropagation:()=>{n=!0,t.stopPropagation()}})}i?.current&&i.current(e)}}))}function b(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}let y=(0,a.forwardRef)(({src:e,srcSet:t,sizes:r,height:i,width:n,decoding:l,className:s,style:u,fetchPriority:d,placeholder:c,loading:f,unoptimized:p,fill:m,onLoadRef:y,onLoadingCompleteRef:_,setBlurComplete:v,setShowAltText:w,sizesInput:j,onLoad:P,onError:x,...C},E)=>{let O=(0,a.useCallback)(e=>{e&&(x&&(e.src=e.src),e.complete&&h(e,c,y,_,v,p,j))},[e,c,y,_,v,x,p,j]),S=(0,g.useMergedRef)(E,O);return(0,o.jsx)("img",{...C,...b(d),loading:f,width:n,height:i,decoding:l,"data-nimg":m?"fill":"1",className:s,style:u,sizes:r,srcSet:t,src:e,ref:S,onLoad:e=>{h(e.currentTarget,c,y,_,v,p,j)},onError:e=>{w(!0),"empty"!==c&&v(!0),x&&x(e)}})});function _({isAppRouter:e,imgAttributes:t}){let r={as:"image",imageSrcSet:t.srcSet,imageSizes:t.sizes,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,...b(t.fetchPriority)};return e&&l.default.preload?(l.default.preload(t.src,r),null):(0,o.jsx)(s.default,{children:(0,o.jsx)("link",{rel:"preload",href:t.srcSet?void 0:t.src,...r},"__nimg-"+t.src+t.srcSet+t.sizes)})}let v=(0,a.forwardRef)((e,t)=>{let r=(0,a.useContext)(f.RouterContext),i=(0,a.useContext)(c.ImageConfigContext),n=(0,a.useMemo)(()=>{let e=m||i||d.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>e-t),r=e.deviceSizes.sort((e,t)=>e-t),n=e.qualities?.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:r,qualities:n,localPatterns:e.localPatterns}},[i]),{onLoad:l,onLoadingComplete:s}=e,g=(0,a.useRef)(l);(0,a.useEffect)(()=>{g.current=l},[l]);let h=(0,a.useRef)(s);(0,a.useEffect)(()=>{h.current=s},[s]);let[b,v]=(0,a.useState)(!1),[w,j]=(0,a.useState)(!1),{props:P,meta:x}=(0,u.getImgProps)(e,{defaultLoader:p.default,imgConf:n,blurComplete:b,showAltText:w});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(y,{...P,unoptimized:x.unoptimized,placeholder:x.placeholder,fill:x.fill,onLoadRef:g,onLoadingCompleteRef:h,setBlurComplete:v,setShowAltText:j,sizesInput:e.sizes,ref:t}),x.preload?(0,o.jsx)(_,{isAppRouter:!r,imgAttributes:P}):null]})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8857:(e,t)=>{function r(e,t){let r=e||75;return t?.qualities?.length?t.qualities.reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e,0):r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"findClosestQuality",{enumerable:!0,get:function(){return r}})}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[871],{302:(e,s,t)=>{"use strict";t.d(s,{v:()=>c});var a=t(2115);let n=[],l=0,i=!1;function r(e){if("Escape"!==e.key)return;let s=n[n.length-1];s&&(e.preventDefault(),s.onEscape())}function c(e,s){let t=(0,a.useRef)(s);(0,a.useEffect)(()=>{t.current=s},[s]),(0,a.useEffect)(()=>{if(!e)return;let s=++l;return n.push({id:s,onEscape:()=>t.current()}),!i&&"u">typeof document&&(document.addEventListener("keydown",r),i=!0),()=>{let e=n.findIndex(e=>e.id===s);e>=0&&n.splice(e,1),i&&"u">typeof document&&!(n.length>0)&&(document.removeEventListener("keydown",r),i=!1)}},[e])}},3706:(e,s,t)=>{Promise.resolve().then(t.bind(t,4740))},4740:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>m});var a=t(5155),n=t(2115),l=t(7702),i=t(7651),r=t.n(i),c=t(8500),d=t.n(c),o=t(302);let u={github:"https://www.google.com/s2/favicons?domain=github.com&sz=64",gitlab:"https://www.google.com/s2/favicons?domain=gitlab.com&sz=64"};function x({type:e,size:s,className:t=""}){return(0,a.jsx)(r(),{src:u[e],alt:`${"github"===e?"GitHub":"GitLab"} icon`,width:s,height:s,className:t,unoptimized:!0})}function m(){let{data:e,isLoading:s,error:t}=(0,l.aX)(),i=(0,l.Lv)(),r=(0,l.sX)(),c=(0,l.Ii)(),[u,m]=(0,n.useState)(null),[b,p]=(0,n.useState)(null),[j,g]=(0,n.useState)(null),[N,f]=(0,n.useState)(""),[y,v]=(0,n.useState)(""),[w,k]=(0,n.useState)(!1),[E,C]=(0,n.useState)(null),S=()=>{m(null),p(null),f(""),v(""),k(!1),C(null)},L=e=>{S(),m(e)},G=async e=>{e.preventDefault(),C(null);try{b?await r.mutateAsync({id:b.id,token:N}):"github"===u?await i.mutateAsync({type:"github",token:N}):"gitlab"===u&&await i.mutateAsync({type:"gitlab",serverUrl:y,token:N}),S()}catch(e){C(e.message)}},F=async()=>{if(j)try{await c.mutateAsync(j.id),g(null)}catch(e){console.error("Failed to delete credential:",e)}},P=i.isPending||r.isPending;return(0,o.v)(null!==u,S),(0,o.v)(null!==j,()=>g(null)),(0,a.jsxs)("main",{className:"min-h-screen bg-base-100",children:[(0,a.jsxs)("div",{className:"container mx-auto max-w-4xl py-12 px-6",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-8",children:(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)(d(),{href:"/",className:"btn btn-ghost btn-square",children:(0,a.jsx)("i",{className:"iconoir-arrow-left text-[20px]","aria-hidden":"true"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:"Credentials"}),(0,a.jsx)("p",{className:"text-sm opacity-70 mt-1",children:"Manage your remote repository credentials"})]})]})}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-8",children:[(0,a.jsx)("div",{className:"card bg-base-100 shadow-lg hover:shadow-xl transition-shadow cursor-pointer border border-base-200",onClick:()=>L("github"),children:(0,a.jsxs)("div",{className:"card-body p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsx)("div",{className:"p-2 bg-base-200 rounded-lg",children:(0,a.jsx)(x,{type:"github",size:24,className:"h-6 w-6 rounded-sm"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"card-title text-base",children:"GitHub"}),(0,a.jsx)("p",{className:"text-xs opacity-70",children:"Personal Access Token"})]})]}),(0,a.jsxs)("button",{className:"btn btn-sm w-full gap-2",children:[(0,a.jsx)("i",{className:"iconoir-plus text-[16px]","aria-hidden":"true"}),"Add GitHub"]})]})}),(0,a.jsx)("div",{className:"card bg-base-100 shadow-lg hover:shadow-xl transition-shadow cursor-pointer border border-base-200",onClick:()=>L("gitlab"),children:(0,a.jsxs)("div",{className:"card-body p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsx)("div",{className:"p-2 bg-base-200 rounded-lg",children:(0,a.jsx)(x,{type:"gitlab",size:24,className:"h-6 w-6 rounded-sm"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"card-title text-base",children:"GitLab"}),(0,a.jsx)("p",{className:"text-xs opacity-70",children:"Server URL + Personal Access Token"})]})]}),(0,a.jsxs)("button",{className:"btn btn-sm w-full gap-2",children:[(0,a.jsx)("i",{className:"iconoir-plus text-[16px]","aria-hidden":"true"}),"Add GitLab Server"]})]})})]}),(0,a.jsxs)("div",{className:"border border-base-200 rounded-lg overflow-hidden bg-base-100",children:[(0,a.jsx)("div",{className:"px-6 py-3 bg-base-200/50 border-b border-base-200",children:(0,a.jsx)("h2",{className:"text-sm font-bold opacity-70",children:"Saved Credentials"})}),s?(0,a.jsxs)("div",{className:"p-12 text-center opacity-70",children:[(0,a.jsx)("span",{className:"loading loading-spinner"}),(0,a.jsx)("p",{className:"mt-2 text-sm",children:"Loading credentials..."})]}):t?(0,a.jsx)("div",{className:"p-12 text-center text-error",children:(0,a.jsx)("p",{children:"Failed to load credentials"})}):e?.length===0?(0,a.jsxs)("div",{className:"p-12 text-center opacity-50",children:[(0,a.jsx)("i",{className:"iconoir-key text-[40px] mx-auto","aria-hidden":"true"}),(0,a.jsx)("p",{className:"font-bold mt-2",children:"No credentials saved yet."}),(0,a.jsx)("p",{className:"text-xs mt-1",children:"Add your first credential using the cards above."})]}):(0,a.jsx)("div",{className:"divide-y divide-base-200",children:e?.map(e=>(0,a.jsx)(h,{credential:e,onEdit:()=>{p(e),m(e.type),f(""),"gitlab"===e.type&&v(e.serverUrl)},onDelete:()=>g(e)},e.id))})]})]}),null!==u&&(0,a.jsxs)("dialog",{className:"modal modal-open",children:[(0,a.jsxs)("div",{className:"modal-box",children:[(0,a.jsx)("h3",{className:"font-bold text-lg flex items-center gap-2",children:"github"===u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x,{type:"github",size:20,className:"h-5 w-5 rounded-sm"}),"GitHub Credential"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x,{type:"gitlab",size:20,className:"h-5 w-5 rounded-sm"}),"GitLab Credential"]})}),(0,a.jsx)("p",{className:"py-4 text-sm opacity-70",children:b?"Enter a new personal access token to update this credential.":"github"===u?"Enter your GitHub personal access token. This will be stored securely in your system keychain.":"Enter your GitLab server URL and personal access token."}),(0,a.jsxs)("form",{onSubmit:G,className:"flex flex-col gap-4",children:["gitlab"===u&&!b&&(0,a.jsxs)("div",{className:"form-control w-full",children:[(0,a.jsx)("label",{className:"label",children:(0,a.jsx)("span",{className:"label-text",children:"Server URL"})}),(0,a.jsx)("input",{type:"url",placeholder:"https://gitlab.example.com",value:y,onChange:e=>v(e.target.value),required:!0,className:"input input-bordered w-full",autoFocus:!0}),(0,a.jsx)("label",{className:"label",children:(0,a.jsx)("span",{className:"label-text-alt opacity-70",children:"Enter the full URL of your GitLab server"})})]}),"gitlab"===u&&b&&(0,a.jsxs)("div",{className:"form-control w-full",children:[(0,a.jsx)("label",{className:"label",children:(0,a.jsx)("span",{className:"label-text",children:"Server URL"})}),(0,a.jsxs)("div",{className:"p-3 bg-base-200 rounded-lg text-sm font-mono flex items-center gap-2 min-w-0 break-all",children:[(0,a.jsx)(x,{type:"gitlab",size:16,className:"h-4 w-4 shrink-0 rounded-sm"}),b.serverUrl]})]}),(0,a.jsxs)("div",{className:"form-control w-full",children:[(0,a.jsx)("label",{className:"label",children:(0,a.jsx)("span",{className:"label-text",children:"Personal Access Token"})}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:w?"text":"password",placeholder:b?"Enter new token":"ghp_xxxxxxxxxxxx or glpat-xxxxx",value:N,onChange:e=>f(e.target.value),className:"input input-bordered w-full pr-10",required:!0,autoFocus:!("gitlab"===u&&!b)}),(0,a.jsx)("button",{type:"button",className:"absolute right-2 top-2 btn btn-ghost btn-xs btn-square",onClick:()=>k(!w),children:w?(0,a.jsx)("i",{className:"iconoir-eye-closed text-[16px]","aria-hidden":"true"}):(0,a.jsx)("i",{className:"iconoir-eye text-[16px]","aria-hidden":"true"})})]}),(0,a.jsx)("label",{className:"label",children:(0,a.jsx)("span",{className:"label-text-alt opacity-70",children:"github"===u?(0,a.jsxs)(a.Fragment,{children:["Token needs repo scope."," ",(0,a.jsx)("a",{href:"https://github.com/settings/tokens/new?description=Trident&scopes=repo,user,notifications,workflow",target:"_blank",rel:"noreferrer",className:"link link-primary",children:"Create new token"})]}):"Token needs api scope for GitLab access"})})]}),E&&(0,a.jsx)("div",{className:"alert alert-error text-sm",children:(0,a.jsx)("span",{children:E})}),(0,a.jsxs)("div",{className:"modal-action",children:[(0,a.jsx)("button",{type:"button",className:"btn",onClick:S,disabled:P,children:"Cancel"}),(0,a.jsxs)("button",{type:"submit",className:"btn btn-primary",disabled:P,children:[P&&(0,a.jsx)("span",{className:"loading loading-spinner loading-xs"}),b?"Update":"Verify & Save"]})]})]})]}),(0,a.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,a.jsx)("button",{onClick:S,children:"close"})})]}),null!==j&&(0,a.jsxs)("dialog",{className:"modal modal-open",children:[(0,a.jsxs)("div",{className:"modal-box",children:[(0,a.jsx)("h3",{className:"font-bold text-lg",children:"Delete Credential"}),(0,a.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete this ",j?.type==="github"?"GitHub":"GitLab"," ","credential for ",(0,a.jsx)("strong",{className:"break-all",children:j?.username}),"? This action cannot be undone."]}),(0,a.jsxs)("div",{className:"modal-action",children:[(0,a.jsx)("button",{className:"btn",onClick:()=>g(null),children:"Cancel"}),(0,a.jsxs)("button",{className:"btn btn-error",onClick:F,disabled:c.isPending,children:[c.isPending&&(0,a.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,a.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,a.jsx)("button",{onClick:()=>g(null),children:"close"})})]})]})}function h({credential:e,onEdit:s,onDelete:t}){let n="gitlab"===e.type;return(0,a.jsxs)("div",{className:"px-6 py-4 flex items-center justify-between hover:bg-base-200/30 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("div",{className:"p-2 bg-base-200 rounded-lg",children:n?(0,a.jsx)(x,{type:"gitlab",size:20,className:"h-5 w-5 rounded-sm"}):(0,a.jsx)(x,{type:"github",size:20,className:"h-5 w-5 rounded-sm"})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-bold text-sm",children:n?"GitLab":"GitHub"}),n&&(0,a.jsx)("span",{className:"text-xs opacity-70 font-mono bg-base-200 px-1.5 py-0.5 rounded",children:e.serverUrl.replace(/^https?:\/\//,"")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs opacity-70 mt-1",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("i",{className:"iconoir-user text-[14px]","aria-hidden":"true"}),e.username]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("i",{className:"iconoir-calendar text-[14px]","aria-hidden":"true"}),new Date(e.updatedAt).toLocaleDateString()]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{className:"btn btn-ghost btn-sm btn-square",onClick:s,title:"Edit",children:(0,a.jsx)("i",{className:"iconoir-edit-pencil text-[16px]","aria-hidden":"true"})}),(0,a.jsx)("button",{className:"btn btn-ghost btn-sm btn-square text-error hover:bg-error/10",onClick:t,title:"Delete",children:(0,a.jsx)("i",{className:"iconoir-trash text-[16px]","aria-hidden":"true"})})]})]})}},7651:(e,s,t)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var a={default:function(){return o},getImageProps:function(){return d}};for(var n in a)Object.defineProperty(s,n,{enumerable:!0,get:a[n]});let l=t(3623),i=t(5413),r=t(8437),c=l._(t(6095));function d(e){let{props:s}=(0,i.getImgProps)(e,{defaultLoader:c.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,t]of Object.entries(s))void 0===t&&delete s[e];return{props:s}}let o=r.Image},7702:(e,s,t)=>{"use strict";t.d(s,{Ii:()=>m,Lv:()=>d,aX:()=>r,sX:()=>u});var a=t(4109),n=t(5625),l=t(8934);async function i(){let e=await fetch("/api/credentials");if(!e.ok)throw Error("Failed to fetch credentials");return e.json()}function r(){return(0,a.I)({queryKey:["credentials"],queryFn:i})}async function c(e){let s=await fetch("/api/credentials",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),t=await s.json();if(!s.ok)throw Error(t.error||"Failed to create credential");return t}function d(){let e=(0,n.jE)();return(0,l.n)({mutationFn:c,onSuccess:()=>{e.invalidateQueries({queryKey:["credentials"]})}})}async function o(e){let s=await fetch("/api/credentials",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),t=await s.json();if(!s.ok)throw Error(t.error||"Failed to update credential");return t}function u(){let e=(0,n.jE)();return(0,l.n)({mutationFn:o,onSuccess:()=>{e.invalidateQueries({queryKey:["credentials"]})}})}async function x(e){let s=await fetch("/api/credentials",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})}),t=await s.json();if(!s.ok)throw Error(t.error||"Failed to delete credential")}function m(){let e=(0,n.jE)();return(0,l.n)({mutationFn:x,onSuccess:()=>{e.invalidateQueries({queryKey:["credentials"]})}})}}},e=>{e.O(0,[176,500,437,441,794,358],()=>e(e.s=3706)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{3411:(e,t,s)=>{"use strict";s.d(t,{RepoList:()=>f});var a=s(5155),n=s(696),i=s(7702),r=s(2115),l=s(8500),o=s.n(l),c=s(3321),d=s(6848),h=s(6695),p=s(4131),u=s(8599),m=s(302);function x(e){try{if(e.startsWith("git@")){let t=e.match(/^git@([^:]+):/);return t?t[1]:null}return new URL(e).hostname}catch{return null}}function b(e){let t=e.trim().replace(/[?#].*$/,"").replace(/\/+$/,"");if(!t)return null;let s=Math.max(t.lastIndexOf("/"),t.lastIndexOf(":")),a=s>=0?t.slice(s+1):t,n=(a.endsWith(".git")?a.slice(0,-4):a).trim();return n.length>0?n:null}function j(e){return"github"===e.type?`GitHub (${e.username})`:`GitLab (${new URL(e.serverUrl).hostname} - ${e.username})`}function f(){let{data:e,isLoading:t}=(0,n.uG)(),{data:s}=(0,i.aX)(),l=(0,n.F3)(),f=(0,n.fr)(),y=(0,n.X0)(),[g,N]=(0,r.useState)(!1),[v,w]=(0,r.useState)(!1),[k,C]=(0,r.useState)(!1),[R,S]=(0,r.useState)(!1),[F,P]=(0,r.useState)(!1),[E,U]=(0,r.useState)(null),[I,$]=(0,r.useState)(null),[q,L]=(0,r.useState)(!1),[O,A]=(0,r.useState)(void 0),[D,T]=(0,r.useState)(""),[z,K]=(0,r.useState)(""),[_,G]=(0,r.useState)(""),[M,X]=(0,r.useState)(!1),[J,Q]=(0,r.useState)("auto"),W=(0,c.useRouter)(),B=()=>{C(!1),w(!1)};(0,m.v)(R,()=>S(!1)),(0,m.v)(v,B),(0,m.v)(F,()=>{P(!1),U(null),N(!0)}),(0,r.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();A(t.resolvedDefaultFolder)}}catch(e){console.error("Failed to load settings:",e)}})()},[]);let H=(0,r.useMemo)(()=>{if(!s?.length||!D.trim())return[];let e=x(D.trim());return e?s.filter(t=>"github"===t.type?"github.com"===e:x(t.serverUrl)===e):[]},[s,D]),Y=H[0]??null,V=(0,r.useMemo)(()=>{if(!s)return[];let e=new Set(H.map(e=>e.id));return[...H,...s.filter(t=>!e.has(t.id))]},[s,H]),Z=async e=>{if(e)try{await l.mutateAsync({path:e}),W.push(`/workspace?path=${encodeURIComponent(e)}`)}catch(t){let e=t instanceof Error?t.message:"Unknown error";e.includes("already exists")?(0,h.oR)({type:"warning",title:"Repository already added",description:"This repository is already in your list. Select it from the list to open it."}):(0,h.oR)({type:"error",title:"Failed to add repository",description:e})}},ee=async()=>{if(E)try{await l.mutateAsync({path:E,initializeIfNeeded:!0}),P(!1),U(null),W.push(`/workspace?path=${encodeURIComponent(E)}`)}catch(t){let e=t instanceof Error?t.message:"Unknown error";(0,h.oR)({type:"error",title:"Failed to initialize repository",description:e})}},et=()=>{P(!1),U(null),N(!0)},es=async()=>{let e=D.trim(),t=z.trim(),a=_.trim();if(!e)return void(0,h.oR)({type:"error",title:"Repository URL is required",description:"Enter a repository URL to clone."});if(!t)return void(0,h.oR)({type:"error",title:"Destination folder is required",description:"Select a local destination folder first."});let n=a||b(e);if(!n)return void(0,h.oR)({type:"error",title:"Folder name is required",description:"Provide a destination folder name for this clone."});try{let a=await f.mutateAsync({repoUrl:e,destinationParent:t,folderName:n,credentialId:"auto"===J?null:J}),i=s?.find(e=>e.id===a.usedCredentialId);(0,h.oR)({type:"success",title:"Repository cloned",description:i?`Cloned with ${j(i)}`:"Clone completed successfully."}),w(!1),C(!1),W.push(`/workspace?path=${encodeURIComponent(a.path)}`)}catch(t){let e=t instanceof Error?t.message:"Unknown error";(0,h.oR)({type:"error",title:"Failed to clone repository",description:e})}},ea=async e=>{if(I)try{await y.mutateAsync({path:I.path,deleteLocalFolder:e}),S(!1),$(null)}catch(t){let e=t instanceof Error?t.message:"Unknown error";(0,h.oR)({type:"error",title:"Failed to delete repository",description:e})}};return t?(0,a.jsx)("div",{className:"p-12 text-center opacity-70",children:"Loading repositories..."}):(0,a.jsxs)("div",{className:"container mx-auto max-w-5xl py-12 px-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:"Repositories"}),(0,a.jsx)("p",{className:"text-sm opacity-70 mt-1",children:"Manage your git repositories."})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{className:"btn btn-square btn-ghost",onClick:()=>L(!0),title:"Settings",children:(0,a.jsx)("i",{className:"iconoir-ios-settings text-[20px]","aria-hidden":"true"})}),(0,a.jsxs)(o(),{href:"/credentials",className:"btn gap-2",children:[(0,a.jsx)("i",{className:"iconoir-key text-[20px]","aria-hidden":"true"}),"Credentials"]}),(0,a.jsxs)("button",{onClick:()=>{T(""),G(""),X(!1),Q("auto"),K(O||""),w(!0)},className:"btn gap-2",children:[(0,a.jsx)("i",{className:"iconoir-git-fork text-[20px]","aria-hidden":"true"}),"Clone"]}),(0,a.jsxs)("button",{onClick:()=>N(!0),className:"btn btn-accent gap-2",children:[(0,a.jsx)("i",{className:"iconoir-plus-circle text-[20px]","aria-hidden":"true"}),"Add Repository"]})]})]}),(0,a.jsx)("div",{className:"overflow-x-auto border border-base-300 rounded-lg bg-base-100",children:(0,a.jsxs)("table",{className:"table w-full",children:[(0,a.jsx)("thead",{className:"bg-base-200/50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Name"}),(0,a.jsx)("th",{children:"Path"}),(0,a.jsx)("th",{className:"text-right",children:"Action"})]})}),(0,a.jsxs)("tbody",{children:[e?.length===0&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:3,className:"text-center py-12 text-muted-foreground",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,a.jsx)("p",{children:"No repositories found."}),(0,a.jsx)("button",{className:"btn btn-link",onClick:()=>N(!0),children:"Add your first repository"})]})})}),e?.map(e=>{let t=(0,u.iu)(e);return(0,a.jsxs)("tr",{className:"hover:bg-base-200/30 cursor-pointer group",onClick:()=>W.push(`/workspace?path=${encodeURIComponent(e.path)}`),children:[(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("i",{className:"iconoir-bookmark text-[20px] opacity-70 group-hover:text-primary transition-colors","aria-hidden":"true"}),(0,a.jsx)("span",{className:"font-bold text-sm",children:t})]})}),(0,a.jsx)("td",{className:"text-sm opacity-70 font-mono truncate max-w-xs",title:e.path,children:e.path}),(0,a.jsx)("td",{className:"text-right",children:(0,a.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,a.jsx)(o(),{href:`/workspace?path=${encodeURIComponent(e.path)}`,className:"btn btn-ghost btn-sm btn-square",onClick:e=>e.stopPropagation(),children:(0,a.jsx)("i",{className:"iconoir-arrow-right text-[16px]","aria-hidden":"true"})}),(0,a.jsx)("button",{className:"btn btn-ghost btn-sm btn-square text-error hover:bg-error/10",onClick:s=>{var a;return a={path:e.path,displayName:t},void(s.stopPropagation(),$(a),S(!0))},children:(0,a.jsx)("i",{className:"iconoir-trash text-[16px]","aria-hidden":"true"})})]})})]},e.path)})]})]})}),(0,a.jsx)(d.K,{open:g,onOpenChange:N,onSelect:(e,t)=>{if(e){if(t.isRepo)return void Z(e);U(e),P(!0)}},initialPath:O}),(0,a.jsx)(p.g,{open:q,onOpenChange:L,onSettingsChange:e=>A(e.resolvedDefaultFolder)}),v&&(0,a.jsxs)("dialog",{className:"modal modal-open",children:[(0,a.jsxs)("div",{className:"modal-box max-w-2xl",children:[(0,a.jsx)("h3",{className:"font-bold text-lg",children:"Clone Repository"}),(0,a.jsx)("p",{className:"py-2 text-sm opacity-70",children:"Clone a remote repository into a local folder and add it to your repository list."}),(0,a.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,a.jsxs)("div",{className:"form-control",children:[(0,a.jsx)("label",{className:"label",children:(0,a.jsx)("span",{className:"label-text",children:"Repository URL"})}),(0,a.jsx)("input",{type:"text",className:"input input-bordered w-full",placeholder:"https://github.com/org/repo.git",value:D,onChange:e=>{var t;T(t=e.target.value),M||G(b(t)??"")}})]}),(0,a.jsxs)("div",{className:"form-control",children:[(0,a.jsx)("label",{className:"label",children:(0,a.jsx)("span",{className:"label-text",children:"Destination Parent Folder"})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono text-sm",value:z,onChange:e=>K(e.target.value),placeholder:O||"/path/to/folder"}),(0,a.jsx)("button",{type:"button",className:"btn btn-outline",onClick:()=>C(!0),children:"Browse"})]})]}),(0,a.jsxs)("div",{className:"form-control",children:[(0,a.jsx)("label",{className:"label",children:(0,a.jsx)("span",{className:"label-text",children:"Destination Folder Name"})}),(0,a.jsx)("input",{type:"text",className:"input input-bordered w-full",value:_,onChange:e=>{X(!0),G(e.target.value)},placeholder:b(D)||"repository-name"})]}),(0,a.jsxs)("div",{className:"form-control",children:[(0,a.jsx)("label",{className:"label",children:(0,a.jsx)("span",{className:"label-text",children:"Credential"})}),(0,a.jsxs)("select",{className:"select select-bordered w-full",value:J,onChange:e=>Q(e.target.value),children:[(0,a.jsx)("option",{value:"auto",children:Y?`Auto detect (${j(Y)})`:"Auto detect"}),V.map(e=>(0,a.jsx)("option",{value:e.id,children:j(e)},e.id))]}),D.trim()&&0===H.length&&(0,a.jsx)("label",{className:"label",children:(0,a.jsx)("span",{className:"label-text-alt opacity-70",children:"No matching credential found for this URL. Clone will run without stored credentials unless you pick one."})})]})]}),(0,a.jsxs)("div",{className:"modal-action",children:[(0,a.jsx)("button",{className:"btn",onClick:B,disabled:f.isPending,children:"Cancel"}),(0,a.jsx)("button",{className:"btn btn-primary",onClick:es,disabled:f.isPending,children:f.isPending?(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Cloning..."]}):"Clone"})]})]}),(0,a.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,a.jsx)("button",{onClick:B,children:"close"})})]}),(0,a.jsx)(d.K,{open:k,onOpenChange:C,onSelect:e=>K(e),initialPath:z||O,title:"Select Destination Folder",selectionMode:"folder"}),F&&(0,a.jsxs)("dialog",{className:"modal modal-open",children:[(0,a.jsxs)("div",{className:"modal-box max-w-xl",children:[(0,a.jsx)("h3",{className:"font-bold text-lg",children:"Initialize New Repository?"}),(0,a.jsxs)("p",{className:"py-4",children:[(0,a.jsx)("span",{className:"break-all font-mono text-sm",children:E}),(0,a.jsx)("br",{}),"This folder is not a Git repository. Initialize it as a new local Git repository and open it in workspace?"]}),(0,a.jsxs)("div",{className:"modal-action",children:[(0,a.jsx)("button",{className:"btn",onClick:et,disabled:l.isPending,children:"No"}),(0,a.jsx)("button",{className:"btn btn-primary",onClick:ee,disabled:l.isPending,children:l.isPending?(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Initializing..."]}):"Yes, Initialize"})]})]}),(0,a.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,a.jsx)("button",{onClick:et,children:"close"})})]}),R&&(0,a.jsxs)("dialog",{className:"modal modal-open",children:[(0,a.jsxs)("div",{className:"modal-box",children:[(0,a.jsx)("h3",{className:"font-bold text-lg",children:"Delete Repository"}),(0,a.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to remove ",(0,a.jsx)("strong",{className:"break-all",children:I?.displayName})," from the list? Choose whether to only remove it from your repository list, or also delete its local folder."]}),(0,a.jsxs)("div",{className:"modal-action",children:[(0,a.jsx)("button",{className:"btn",onClick:()=>S(!1),disabled:y.isPending,children:"Cancel"}),(0,a.jsx)("button",{className:"btn btn-error btn-outline",onClick:()=>ea(!1),disabled:y.isPending,children:"Delete Repo"}),(0,a.jsx)("button",{className:"btn btn-error",onClick:()=>ea(!0),disabled:y.isPending,children:"Delete Repo & Folder"})]})]}),(0,a.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,a.jsx)("button",{onClick:()=>S(!1),children:"close"})})]})]})}},7702:(e,t,s)=>{"use strict";s.d(t,{Ii:()=>u,Lv:()=>c,aX:()=>l,sX:()=>h});var a=s(4109),n=s(5625),i=s(8934);async function r(){let e=await fetch("/api/credentials");if(!e.ok)throw Error("Failed to fetch credentials");return e.json()}function l(){return(0,a.I)({queryKey:["credentials"],queryFn:r})}async function o(e){let t=await fetch("/api/credentials",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();if(!t.ok)throw Error(s.error||"Failed to create credential");return s}function c(){let e=(0,n.jE)();return(0,i.n)({mutationFn:o,onSuccess:()=>{e.invalidateQueries({queryKey:["credentials"]})}})}async function d(e){let t=await fetch("/api/credentials",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();if(!t.ok)throw Error(s.error||"Failed to update credential");return s}function h(){let e=(0,n.jE)();return(0,i.n)({mutationFn:d,onSuccess:()=>{e.invalidateQueries({queryKey:["credentials"]})}})}async function p(e){let t=await fetch("/api/credentials",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})}),s=await t.json();if(!t.ok)throw Error(s.error||"Failed to delete credential")}function u(){let e=(0,n.jE)();return(0,i.n)({mutationFn:p,onSuccess:()=>{e.invalidateQueries({queryKey:["credentials"]})}})}},9487:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,8437,23)),Promise.resolve().then(s.bind(s,3411))}},e=>{e.O(0,[176,785,500,437,26,131,441,794,358],()=>e(e.s=9487)),_N_E=e.O()}]);
@@ -0,0 +1,3 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[306],{302:(e,s,t)=>{"use strict";t.d(s,{v:()=>c});var a=t(2115);let n=[],l=0,i=!1;function r(e){if("Escape"!==e.key)return;let s=n[n.length-1];s&&(e.preventDefault(),s.onEscape())}function c(e,s){let t=(0,a.useRef)(s);(0,a.useEffect)(()=>{t.current=s},[s]),(0,a.useEffect)(()=>{if(!e)return;let s=++l;return n.push({id:s,onEscape:()=>t.current()}),!i&&"u">typeof document&&(document.addEventListener("keydown",r),i=!0),()=>{let e=n.findIndex(e=>e.id===s);e>=0&&n.splice(e,1),i&&"u">typeof document&&!(n.length>0)&&(document.removeEventListener("keydown",r),i=!1)}},[e])}},1984:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>v});var a=t(5155),n=t(3321),l=t(696),i=t(2115),r=t(8599),c=t(460),o=t(6162),d=t(4254);function h({repoPath:e,filePath:s}){let{data:t,isLoading:n}=(0,l.xV)(e,s),h="git-web:diff-view-split",[x,m]=(0,i.useState)(()=>{try{let e=localStorage.getItem(h);return null===e||JSON.parse(e)}catch(e){return console.error("Failed to load split view preference:",e),!0}}),[u,p]=(0,i.useState)(!1),{resolvedTheme:f}=(0,c.D)();if((0,i.useEffect)(()=>{p(!1)},[s]),(0,i.useEffect)(()=>{try{localStorage.setItem(h,JSON.stringify(x))}catch(e){console.error("Failed to save split view preference:",e)}},[x]),n)return(0,a.jsx)("div",{className:"flex items-center justify-center p-8 h-full",children:(0,a.jsx)("span",{className:"loading loading-spinner text-base-content/50"})});if(!t)return(0,a.jsx)("div",{className:"flex items-center justify-center h-full opacity-50",children:"No diff available"});if((0,r.u)(s))return(0,a.jsxs)("div",{className:"flex flex-col h-full bg-base-100",children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 h-[57px] border-b border-base-300 shrink-0 bg-base-100",children:(0,a.jsx)("span",{className:"text-sm font-mono truncate max-w-[70%]",title:s,children:s})}),(0,a.jsx)("div",{className:"flex-1 overflow-auto",children:(0,a.jsx)(d.K,{filePath:s,imageDiff:t.imageDiff})})]});if((0,r.kO)(s,t.left,t.right))return(0,a.jsxs)("div",{className:"flex flex-col h-full bg-base-100",children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 h-[57px] border-b border-base-300 shrink-0 bg-base-100",children:(0,a.jsx)("span",{className:"text-sm font-mono truncate max-w-[70%]",title:s,children:s})}),(0,a.jsx)("div",{className:"flex-1 flex items-center justify-center opacity-50",children:"Binary file - diff not available"})]});let g=t.diff||"",b=g.length,j=(0,r.tq)(g),y=b>102400||j>3e3;return(0,a.jsxs)("div",{className:"flex flex-col h-full bg-base-100",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 h-[57px] border-b border-base-300 shrink-0 bg-base-100",children:[(0,a.jsx)("span",{className:"text-sm font-mono truncate max-w-[70%]",title:s,children:s}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{htmlFor:"split-view",className:"text-[10px] uppercase tracking-wider font-bold cursor-pointer opacity-70",children:"Split View"}),(0,a.jsx)("input",{type:"checkbox",id:"split-view",checked:x,onChange:e=>m(e.target.checked),className:"toggle toggle-sm toggle-primary"})]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-auto diff-viewer-wrapper",children:y&&!u?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center p-4",children:[(0,a.jsx)("i",{className:"iconoir-warning-triangle text-[40px] text-warning","aria-hidden":"true"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"font-bold text-lg",children:"Large Diff Detected"}),(0,a.jsxs)("p",{className:"opacity-70",children:["This diff is large (",Math.round(b/1024),"KB, ~",j," changed lines) and may freeze your browser if rendered."]})]}),(0,a.jsx)("button",{className:"btn btn-outline",onClick:()=>p(!0),children:"Show Diff Anyway"})]}):(0,a.jsx)(o.O,{oldValue:t.left||"",newValue:t.right||"",splitView:x,useDarkTheme:"dark"===f})})]})}var x=t(302);let m=[];function u(e,s){let t=e.trim(),a=s.replace(/\r\n/g,"\n");return a.trim()?`${t}
2
+
3
+ ${a}`:t}function p(e){let s={name:"",path:"",children:new Map};for(let t of e){let e=t.split("/").filter(Boolean),a=s,n="";for(let s=0;s<e.length;s++){let l=e[s];n=n?`${n}/${l}`:l,a.children.has(l)||a.children.set(l,{name:l,path:n,children:new Map}),a=a.children.get(l),s===e.length-1&&(a.filePath=t)}}return s}function f(e){let s=[];return Array.from(e.children.values()).forEach(e=>{e.children.size>0&&(s.push(e.path),s.push(...f(e)))}),s}function g(e){let s=e.split("/").filter(Boolean),t=[];for(let e=1;e<s.length;e++)t.push(s.slice(0,e).join("/"));return t}function b({node:e,selectedFile:s,expandedFolders:t,onToggleFolder:n,onSelectFile:l,onActionFile:i,actionType:c,actionPending:o,depth:d=0}){let h=Array.from(e.children.values()).sort((e,s)=>{let t=e.children.size>0,a=s.children.size>0;return t&&!a?-1:!t&&a?1:e.name.localeCompare(s.name)});return(0,a.jsx)(a.Fragment,{children:h.map(e=>{if(e.children.size>0){let r=t.has(e.path);return(0,a.jsxs)("div",{children:[(0,a.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:()=>n(e.path),title:e.path,children:[(0,a.jsx)("span",{className:"text-[10px] opacity-70",children:r?"▼":"▶"}),(0,a.jsx)("i",{className:"iconoir-folder text-[14px] opacity-70","aria-hidden":"true"}),(0,a.jsx)("span",{className:"truncate flex-1",children:e.name})]}),r&&(0,a.jsx)(b,{node:e,selectedFile:s,expandedFolders:t,onToggleFolder:n,onSelectFile:l,onActionFile:i,actionType:c,actionPending:o,depth:d+1})]},e.path)}let h=e.filePath;return h?(0,a.jsxs)("div",{className:(0,r.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",s===h&&"bg-base-300 font-medium text-primary"),style:{paddingLeft:`${12*d+8}px`},onClick:()=>l(h),title:h,children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,a.jsx)("i",{className:"iconoir-page text-[14px] opacity-70 shrink-0","aria-hidden":"true"}),(0,a.jsx)("span",{className:"truncate flex-1 font-mono text-xs",children:e.name})]}),(0,a.jsx)("button",{className:(0,r.cn)("btn btn-ghost btn-xs btn-square opacity-0 group-hover:opacity-100 transition-opacity","stage"===c?"text-success hover:bg-success/10":"text-error hover:bg-error/10"),onClick:e=>{e.stopPropagation(),i(h)},disabled:o,children:(0,a.jsx)("i",{className:(0,r.cn)("text-[14px]","stage"===c?"iconoir-plus-circle":"iconoir-minus-circle"),"aria-hidden":"true"})})]},h):null})})}function j({repoPath:e}){let{data:s,isLoading:t,isError:n,error:c,refetch:o}=(0,l.en)(e),{data:d}=(0,l._6)(e),j=(0,l.a3)(),[y,N]=(0,i.useState)(""),[v,w]=(0,i.useState)(""),[k,C]=(0,i.useState)(null),[S,E]=(0,i.useState)(!1),[P,F]=(0,i.useState)(""),[A,D]=(0,i.useState)(!1),[M,L]=(0,i.useState)(!1),[T,q]=(0,i.useState)("main"),[z,B]=(0,i.useState)(new Set),[K,_]=(0,i.useState)(new Set),[O,$]=(0,i.useState)(250),[V,Y]=(0,i.useState)(!1),H=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=e=>{if(!V||!H.current)return;let s=H.current.startY-e.clientY;$(Math.max(150,Math.min(800,H.current.startHeight+s)))},s=()=>{Y(!1),H.current=null,document.body.style.cursor="default",document.body.style.userSelect="auto"};return V&&(window.addEventListener("mousemove",e),window.addEventListener("mouseup",s),document.body.style.cursor="ns-resize",document.body.style.userSelect="none"),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",s),document.body.style.cursor="default",document.body.style.userSelect="auto"}},[V]);let I=s?.files??m;(0,x.v)(S,()=>E(!1)),(0,x.v)(A,()=>D(!1)),(0,x.v)(M,()=>L(!1));let J=!!d&&0===d.branches.length,{staged:R,changes:U}=(0,i.useMemo)(()=>{let e=[],s=[];return I.forEach(t=>{" "!==t.index&&"?"!==t.index&&e.push(t.path),(" "!==t.working_dir||"?"===t.index)&&s.push(t.path)}),{staged:e,changes:s}},[I]),G=(0,i.useMemo)(()=>p(U),[U]),Q=(0,i.useMemo)(()=>p(R),[R]),W=(0,i.useMemo)(()=>f(G),[G]),X=(0,i.useMemo)(()=>f(Q),[Q]),Z=(0,i.useMemo)(()=>{let e=new Set;return W.forEach(s=>{z.has(s)||e.add(s)}),k&&g(k).forEach(s=>e.add(s)),e},[W,z,k]),ee=(0,i.useMemo)(()=>{let e=new Set;return X.forEach(s=>{K.has(s)||e.add(s)}),k&&g(k).forEach(s=>e.add(s)),e},[X,K,k]),es=(0,i.useCallback)(e=>{B(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},[]),et=(0,i.useCallback)(e=>{_(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},[]),ea=async s=>{await j.mutateAsync({repoPath:e,action:"stage",data:{files:[s]}})},en=async s=>{await j.mutateAsync({repoPath:e,action:"unstage",data:{files:[s]}})},el=async()=>{await j.mutateAsync({repoPath:e,action:"stage",data:{files:["."]}})},ei=async()=>{await j.mutateAsync({repoPath:e,action:"unstage",data:{files:R}})},er=async()=>{await j.mutateAsync({repoPath:e,action:"stash",data:{message:P||void 0}}),E(!1),F(""),C(null)},ec=async()=>{await j.mutateAsync({repoPath:e,action:"discard",data:{includeUntracked:!0}}),D(!1),C(null)},eo=async()=>{let s=y.trim();if(s){if(J)return void L(!0);await j.mutateAsync({repoPath:e,action:"commit",data:{message:u(s,v)}}),N(""),w(""),C(null)}},ed=async()=>{let s=y.trim(),t=T.trim();s&&t&&(await j.mutateAsync({repoPath:e,action:"commit",data:{message:u(s,v),initialBranch:t}}),N(""),w(""),C(null),L(!1))},eh=e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),R.length>0&&y.trim()&&!j.isPending&&eo())};return t?(0,a.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,a.jsx)("span",{className:"loading loading-spinner text-base-content/50"})}):n?(0,a.jsxs)("div",{className:"flex items-center justify-center h-64 flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-error font-bold",children:"Error Loading Status"}),(0,a.jsx)("p",{className:"text-sm opacity-70",children:c?.message||"An unknown error occurred"}),(0,a.jsxs)("button",{onClick:()=>o(),className:"btn btn-outline btn-sm",children:[(0,a.jsx)("i",{className:"iconoir-refresh-circle text-[16px] mr-1","aria-hidden":"true"}),"Try Again"]})]}):s?(0,a.jsxs)("div",{className:"flex h-full overflow-hidden",children:[(0,a.jsxs)("div",{className:"w-64 border-r border-base-300 flex flex-col bg-base-200/30",children:[(0,a.jsxs)("div",{className:"h-[57px] px-4 border-b border-base-300 flex items-center justify-between bg-base-100",children:[(0,a.jsx)("h1",{className:"font-bold text-lg",children:"Changes"}),(0,a.jsx)("button",{className:"btn btn-ghost btn-sm btn-square",onClick:()=>o(),disabled:j.isPending,title:"Refresh",children:j.isPending?(0,a.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,a.jsx)("i",{className:"iconoir-refresh-circle text-[16px]","aria-hidden":"true"})})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,a.jsxs)("div",{className:"p-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 mb-1",children:[(0,a.jsxs)("h3",{className:"text-xs font-bold uppercase tracking-wider opacity-70",children:["Changes (",U.length,")"]}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[0===U.length&&R.length>0?(0,a.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:ei,title:"Unstage All",children:(0,a.jsx)("i",{className:"iconoir-arrow-up text-[16px]","aria-hidden":"true"})}):(0,a.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:el,disabled:0===U.length,title:"Stage All",children:(0,a.jsx)("i",{className:"iconoir-arrow-down text-[16px]","aria-hidden":"true"})}),(0,a.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:()=>E(!0),disabled:0===U.length&&0===R.length,title:"Stash",children:(0,a.jsx)("i",{className:"iconoir-download-square text-[16px]","aria-hidden":"true"})}),(0,a.jsx)("button",{className:"btn btn-ghost btn-xs btn-square text-error hover:bg-error/10",onClick:()=>D(!0),disabled:0===U.length,title:"Discard All",children:(0,a.jsx)("i",{className:"iconoir-trash text-[16px]","aria-hidden":"true"})})]})]}),(0,a.jsxs)("div",{className:"space-y-0.5",children:[0===U.length&&(0,a.jsx)("p",{className:"px-2 py-2 text-xs opacity-50 italic",children:"No changes"}),U.length>0&&(0,a.jsx)(b,{node:G,selectedFile:k,expandedFolders:Z,onToggleFolder:es,onSelectFile:C,onActionFile:ea,actionType:"stage",actionPending:j.isPending})]})]}),(0,a.jsx)("div",{className:"h-px bg-base-300 mx-4 my-2"}),(0,a.jsxs)("div",{className:"p-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-2 py-2 mb-1",children:(0,a.jsxs)("h3",{className:"text-xs font-bold uppercase tracking-wider opacity-70",children:["Staged (",R.length,")"]})}),(0,a.jsxs)("div",{className:"space-y-0.5",children:[0===R.length&&(0,a.jsx)("p",{className:"px-2 py-2 text-xs opacity-50 italic",children:"No staged changes"}),R.length>0&&(0,a.jsx)(b,{node:Q,selectedFile:k,expandedFolders:ee,onToggleFolder:et,onSelectFile:C,onActionFile:en,actionType:"unstage",actionPending:j.isPending})]})]})]})]}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col bg-base-100 overflow-hidden",children:[(0,a.jsx)("div",{className:"flex-1 overflow-hidden flex flex-col min-h-0",children:k?(0,a.jsx)("div",{className:"h-full flex flex-col",children:(0,a.jsx)(h,{repoPath:e,filePath:k})}):(0,a.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center opacity-50",children:[(0,a.jsx)("div",{className:"p-8 rounded-full bg-base-200 mb-4 text-4xl",children:(0,a.jsx)("i",{className:"iconoir-refresh-circle text-[32px]","aria-hidden":"true"})}),(0,a.jsx)("p",{className:"text-sm font-bold",children:"Select a file to view changes"})]})}),(0,a.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(),Y(!0),H.current={startY:e.clientY,startHeight:O}},children:(0,a.jsx)("div",{className:"w-8 h-1 rounded-full bg-base-300 group-hover:bg-base-400 transition-colors"})}),(0,a.jsx)("div",{className:"flex flex-col border-t border-base-300 bg-base-100 shrink-0",style:{height:O},children:(0,a.jsxs)("div",{className:"flex-1 p-4 overflow-y-auto",children:[(0,a.jsx)("input",{type:"text",placeholder:"Commit subject...",value:y,onChange:e=>N(e.target.value),onKeyDown:eh,className:"input input-bordered w-full text-sm mb-2 font-sans"}),(0,a.jsx)("textarea",{placeholder:"Commit message body (optional)...",value:v,onChange:e=>w(e.target.value),onKeyDown:eh,className:"textarea textarea-bordered w-full text-sm resize-none mb-3 font-sans flex-1",style:{minHeight:"80px",height:"calc(100% - 90px)"}}),(0,a.jsxs)("button",{className:"btn btn-primary w-full btn-sm",onClick:eo,disabled:0===R.length||!y.trim()||j.isPending,children:[j.isPending?(0,a.jsx)("span",{className:"loading loading-spinner loading-xs mr-2"}):(0,a.jsx)("span",{className:"mr-2",children:"✅"}),"Commit Changes"]})]})})]}),S&&(0,a.jsxs)("dialog",{className:"modal modal-open",children:[(0,a.jsxs)("div",{className:"modal-box",children:[(0,a.jsx)("h3",{className:"font-bold text-lg",children:"Stash Changes"}),(0,a.jsx)("p",{className:"py-4 opacity-70",children:"Save your local modifications to a new stash entry."}),(0,a.jsx)("div",{className:"py-2",children:(0,a.jsx)("input",{type:"text",placeholder:"Stash message (optional)",value:P,onChange:e=>F(e.target.value),autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),er())},className:"input input-bordered w-full"})}),(0,a.jsxs)("div",{className:"modal-action",children:[(0,a.jsx)("button",{className:"btn",onClick:()=>E(!1),children:"Cancel"}),(0,a.jsxs)("button",{className:"btn btn-primary",onClick:er,disabled:j.isPending,children:[j.isPending&&(0,a.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Stash"]})]})]}),(0,a.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,a.jsx)("button",{onClick:()=>E(!1),children:"close"})})]}),A&&(0,a.jsxs)("dialog",{className:"modal modal-open",children:[(0,a.jsxs)("div",{className:"modal-box",children:[(0,a.jsx)("h3",{className:"font-bold text-lg",children:"Discard Changes"}),(0,a.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,a.jsxs)("div",{className:"modal-action",children:[(0,a.jsx)("button",{className:"btn",onClick:()=>D(!1),children:"Cancel"}),(0,a.jsxs)("button",{className:"btn btn-error",onClick:ec,disabled:j.isPending,children:[j.isPending&&(0,a.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Discard"]})]})]}),(0,a.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,a.jsx)("button",{onClick:()=>D(!1),children:"close"})})]}),M&&(0,a.jsxs)("dialog",{className:"modal modal-open",children:[(0,a.jsxs)("div",{className:"modal-box",children:[(0,a.jsx)("h3",{className:"font-bold text-lg",children:"First Commit Branch"}),(0,a.jsx)("p",{className:"py-4 opacity-70",children:"This repository has no commits yet. Choose the branch name for the first commit."}),(0,a.jsx)("div",{className:"py-2",children:(0,a.jsx)("input",{type:"text",placeholder:"Branch name",value:T,onChange:e=>q((0,r.L9)(e.target.value)),autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ed())},className:"input input-bordered w-full"})}),(0,a.jsxs)("div",{className:"modal-action",children:[(0,a.jsx)("button",{className:"btn",onClick:()=>L(!1),children:"Cancel"}),(0,a.jsxs)("button",{className:"btn btn-primary",onClick:ed,disabled:!T.trim()||j.isPending,children:[j.isPending&&(0,a.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Commit to Branch"]})]})]}),(0,a.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,a.jsx)("button",{onClick:()=>L(!1),children:"close"})})]})]}):(0,a.jsx)("div",{className:"flex items-center justify-center h-64 opacity-70",children:"No status data available"})}var y=t(6534);function N(){let e=(0,n.useSearchParams)().get("path");return((0,y.J)(e,"Changes"),e)?(0,a.jsx)(j,{repoPath:e}):(0,a.jsx)("div",{className:"p-8",children:"No repository path specified."})}function v(){return(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsx)("span",{className:"loading loading-spinner"})}),children:(0,a.jsx)(N,{})})}},7999:(e,s,t)=>{Promise.resolve().then(t.bind(t,1984))}},e=>{e.O(0,[508,176,785,841,26,790,441,794,358],()=>e(e.s=7999)),_N_E=e.O()}]);