@openchamber/web 2.7.2 → 2.7.3-canary.20261115.21

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 (103) hide show
  1. package/dist/assets/{AboutDialog-l-zrh7nU.js → AboutDialog-gL1x0YFW.js} +1 -1
  2. package/dist/assets/{AboutLogo-K3wdJM69.js → AboutLogo-cbKkZDLU.js} +1 -1
  3. package/dist/assets/{ArchiveView-DjRZQdOo.js → ArchiveView-0QjF07oK.js} +1 -1
  4. package/dist/assets/{ChangeRequestDiffUnavailable-BtH6Ad8g.js → ChangeRequestDiffUnavailable-kfarKKvU.js} +1 -1
  5. package/dist/assets/{CommandPalette-C7Uc4nDE.js → CommandPalette-D4bXVkJf.js} +1 -1
  6. package/dist/assets/{DataFileArtifact-DtnZXuug.js → DataFileArtifact-DWC11mPC.js} +1 -1
  7. package/dist/assets/{DiffView-CS0gR_am.js → DiffView-CSSPNDYJ.js} +1 -1
  8. package/dist/assets/{FilesView-tcU8_bnh.js → FilesView-D0FOaLpo.js} +3 -3
  9. package/dist/assets/{GitView-Ccs7O5Rf.js → GitView-CJl97ZjN.js} +1 -1
  10. package/dist/assets/{GuestPanelContent-CJ_wlnNr.js → GuestPanelContent-BCxvKv4H.js} +1 -1
  11. package/dist/assets/{HelpDialog-iH44R9qu.js → HelpDialog-DjficTGt.js} +1 -1
  12. package/dist/assets/{IntegrationsCatalogView-D9icTaJt.js → IntegrationsCatalogView-BvS1pCRR.js} +1 -1
  13. package/dist/assets/{JsonTreeView-BjPbJlHc.js → JsonTreeView-DQ6XLAW4.js} +1 -1
  14. package/dist/assets/{MarkdownDiffPreview-gCh_8R1F.js → MarkdownDiffPreview-C8KpNQaC.js} +1 -1
  15. package/dist/assets/{MarkdownRendererImpl-fohUB8r2.js → MarkdownRendererImpl-B1SjhV-G.js} +4 -4
  16. package/dist/assets/{MemoryDebugPanel-fX9cD8th.js → MemoryDebugPanel-BWT5owg7.js} +1 -1
  17. package/dist/assets/{NoteEditor-CTPSChrc.js → NoteEditor-DfHpXxIN.js} +1 -1
  18. package/dist/assets/{OfficeArtifact-BRviGdkx.js → OfficeArtifact-BAYHzDft.js} +2 -2
  19. package/dist/assets/{OfficeDocumentDiff-Hp2baXgN.js → OfficeDocumentDiff-Csvxzve7.js} +1 -1
  20. package/dist/assets/{OnboardingScreen-CDhZHMEt.js → OnboardingScreen-NWWMu7OG.js} +1 -1
  21. package/dist/assets/{OpenCodeStatusDialog-CBiLhgh9.js → OpenCodeStatusDialog-DtnVfNI4.js} +1 -1
  22. package/dist/assets/{OverviewView-DmNAg498.js → OverviewView-BXMN0Z8_.js} +1 -1
  23. package/dist/assets/{PatchDiff-rhuT-3au.js → PatchDiff-DxGkHtIk.js} +1 -1
  24. package/dist/assets/{PlanView-VhIl4wzm.js → PlanView-DE4sxgkq.js} +1 -1
  25. package/dist/assets/{ProjectActionsDialog-B_jMMuJ0.js → ProjectActionsDialog-C5q25ipO.js} +1 -1
  26. package/dist/assets/{ReceivedPagePanel-CCDFxXT4.js → ReceivedPagePanel-CfXyzCii.js} +5 -5
  27. package/dist/assets/{ReplyCommand-CUHB1iPz.js → ReplyCommand-OczgxN8d.js} +1 -1
  28. package/dist/assets/{ReplyUiBlock-TNOJJ_HH.js → ReplyUiBlock-D1HJeVU_.js} +1 -1
  29. package/dist/assets/{ReviewCards-UN_E9jl0.js → ReviewCards-D7jBPhS_.js} +1 -1
  30. package/dist/assets/{RunOverview-C7FUT8DD.js → RunOverview-BDblAbDp.js} +1 -1
  31. package/dist/assets/{ScheduledTasksDialog-DdXypryy.js → ScheduledTasksDialog-NDtZLq5t.js} +1 -1
  32. package/dist/assets/{SettingsView-uSZDjIcc.js → SettingsView-UjifxDq7.js} +1 -1
  33. package/dist/assets/{SettingsWindow-CoijA05f.js → SettingsWindow-D2K9vSYk.js} +1 -1
  34. package/dist/assets/{SidebarSectionsManager-d6IaYpHW.js → SidebarSectionsManager-QqwIUOdu.js} +1 -1
  35. package/dist/assets/{SourceBoardView-BrQkCEgn.js → SourceBoardView-CKJDJ2f4.js} +1 -1
  36. package/dist/assets/{SpaceAccessDialog-CymnxxLO.js → SpaceAccessDialog-G331hiT_.js} +1 -1
  37. package/dist/assets/{SpaceApplyDialog-DVJkF4lG.js → SpaceApplyDialog-x0rDuJEc.js} +1 -1
  38. package/dist/assets/{SpaceRow-CJFX1Zsr.js → SpaceRow-CsS43yrt.js} +1 -1
  39. package/dist/assets/{SpaceSetupOutput-Btttdq6K.js → SpaceSetupOutput-BEXQGXPw.js} +1 -1
  40. package/dist/assets/{SpacesView-GxzOEIeI.js → SpacesView-DFcnInBv.js} +1 -1
  41. package/dist/assets/{SubmoduleDiffSummary-D0Nj5PJN.js → SubmoduleDiffSummary-CTqIH0Cp.js} +1 -1
  42. package/dist/assets/{TableArtifact-DiRnrtL5.js → TableArtifact-Beve8fiv.js} +1 -1
  43. package/dist/assets/{ToolOutputDialog-DnvhhdiH.js → ToolOutputDialog-Bn2g6tIX.js} +1 -1
  44. package/dist/assets/{ToolPartDiffPreview-CHdkL7BJ.js → ToolPartDiffPreview-mgtjJMMz.js} +1 -1
  45. package/dist/assets/{UiBlock-CvZ92eyw.js → UiBlock-DkgJyZVl.js} +2 -2
  46. package/dist/assets/{UsageStatsView-Dbo3dCgC.js → UsageStatsView-CLJFagDC.js} +1 -1
  47. package/dist/assets/{WalkthroughView-l9TMdlPB.js → WalkthroughView-Dm4-RaV3.js} +1 -1
  48. package/dist/assets/{WorktreesView-DNa5Soxq.js → WorktreesView-DyZy4OjB.js} +1 -1
  49. package/dist/assets/{appThemeRegistry-C3TUDJ7r.js → appThemeRegistry-C4Av1s90.js} +1 -1
  50. package/dist/assets/{codeHighlight-DyrRLTkb.js → codeHighlight-Bmb7zcc2.js} +1 -1
  51. package/dist/assets/{columnWidthMemory-D0i9Kdhi.js → columnWidthMemory-D8H-O0YE.js} +1 -1
  52. package/dist/assets/{computeVirtualFileMetrics-YMtW3BEg.js → computeVirtualFileMetrics-Bc_YiqAD.js} +2 -2
  53. package/dist/assets/{contextFileOpenGuard-USev-3h1.js → contextFileOpenGuard-D-HtBtn6.js} +1 -1
  54. package/dist/assets/{date-time-DSQbTMhf.js → date-time-DfmOsLQo.js} +1 -1
  55. package/dist/assets/{diffsHighlighter-DZ_8ZCaS.js → diffsHighlighter-CFc933Ip.js} +1 -1
  56. package/dist/assets/{documentClient-5O0az-Ma.js → documentClient-D-gfZAFK.js} +2 -2
  57. package/dist/assets/{documentHost-BqOqnqk5.js → documentHost-fBeQzdlp.js} +1 -1
  58. package/dist/assets/{editorCodeMetrics-a0NLS65y.js → editorCodeMetrics-CNBjOGNA.js} +1 -1
  59. package/dist/assets/{fileContentPoller-B8a010z5.js → fileContentPoller-DRoVO_sh.js} +1 -1
  60. package/dist/assets/{flexokiTheme-DJaL_u7G.js → flexokiTheme-CcqiI7j-.js} +1 -1
  61. package/dist/assets/{highlights-CSy_17b-.js → highlights-_5vZZ38i.js} +1 -1
  62. package/dist/assets/{index-CvHejcGo.js → index-BbbQXJ_t.js} +1 -1
  63. package/dist/assets/{initializeSharedPreferences-MLG8op-A.js → initializeSharedPreferences-B1ISDxLb.js} +1 -1
  64. package/dist/assets/{install-NTaAzPnj.js → install-DY6TBn2e.js} +1 -1
  65. package/dist/assets/{install-request-D5VhmtWC.js → install-request-CzRei4tp.js} +1 -1
  66. package/dist/assets/{isDiffPlainText-B6ZzF_T5.js → isDiffPlainText-Cx5SgKlQ.js} +1 -1
  67. package/dist/assets/{isFilePlainText-Bitg2337.js → isFilePlainText-Bcn3vV6J.js} +1 -1
  68. package/dist/assets/{katex.min-B3YMLLh4.js → katex.min-DklPh68d.js} +3 -3
  69. package/dist/assets/{main-Bqwtrv5m.js → main-D0ACoTpS.js} +2 -2
  70. package/dist/assets/{main-B61P9v4A.js → main-QZk4AKac.js} +4 -4
  71. package/dist/assets/{miniChat-CZx_2XHj.js → miniChat-DeYRMPYt.js} +2 -2
  72. package/dist/assets/{mobile-DiLdHL_W.js → mobile-DjT3KVMo.js} +2 -2
  73. package/dist/assets/{moveWorkspacePath-CpN2DOGn.js → moveWorkspacePath-DibtVw_Q.js} +1 -1
  74. package/dist/assets/{officeDocument-Ca0s-jYd.js → officeDocument-CBwDUdTr.js} +1 -1
  75. package/dist/assets/{parseDiffFromFile-CL7WjMrZ.js → parseDiffFromFile-D28_u-uC.js} +1 -1
  76. package/dist/assets/{pierreDiffTint-C4cPKKnP.js → pierreDiffTint-CLCzflgS.js} +1 -1
  77. package/dist/assets/{relocateRestoredSession-Bw3yb1_0.js → relocateRestoredSession-BPqdEuzx.js} +2 -2
  78. package/dist/assets/{renderElectronMiniChatApp-DB0hWKLa.js → renderElectronMiniChatApp-C0v7P53f.js} +2 -2
  79. package/dist/assets/{renderMarkdownForExport-CICPn_1e.js → renderMarkdownForExport-DvKl_kjS.js} +1 -1
  80. package/dist/assets/{renderMobileApp-CYhEWO14.js → renderMobileApp-EVllBWS5.js} +3 -3
  81. package/dist/assets/{resolveLanguages-gKOTFspE.js → resolveLanguages-DqxtADuz.js} +1 -1
  82. package/dist/assets/{scheduledTasksApi-C1TDMoZd.js → scheduledTasksApi-v463mt0u.js} +1 -1
  83. package/dist/assets/{shiki-B0-fz3dN.js → shiki-3oNYFbTw.js} +1 -1
  84. package/dist/assets/{space-apply-DnoCDzwj.js → space-apply-j71ap5Rs.js} +1 -1
  85. package/dist/assets/{space-close-Bqfdl7kv.js → space-close-Bj32J79L.js} +1 -1
  86. package/dist/assets/{spaceNetwork-D5Fcyb33.js → spaceNetwork-BV5W32NY.js} +1 -1
  87. package/dist/assets/{stream-tokenizer-FniCZxxb.js → stream-tokenizer-wGP5G2_C.js} +1 -1
  88. package/dist/assets/{useAppFontEffects-CpxtKEGw.js → useAppFontEffects-BDLOJuy5.js} +15 -15
  89. package/dist/assets/{useBranchPullRequestRequest-DVy6rEsu.js → useBranchPullRequestRequest-DMiPjfPQ.js} +1 -1
  90. package/dist/assets/{useCallableModelProviders-DngJbZnV.js → useCallableModelProviders-aGFpVUZL.js} +1 -1
  91. package/dist/assets/{useDiffFindSurface-DY6lBBpH.js → useDiffFindSurface-mA0rc6AR.js} +1 -1
  92. package/dist/assets/{useGitCleanLine-CxdK3EQ3.js → useGitCleanLine-BwAypcLn.js} +1 -1
  93. package/dist/assets/{useInlineCommentController-Z8ADSR8f.js → useInlineCommentController-Wnopn0Ar.js} +1 -1
  94. package/dist/assets/{useMarkdownLocalAssets-CZIMWgjn.js → useMarkdownLocalAssets-BjT607tF.js} +1 -1
  95. package/dist/assets/{useRootScrollLock-C9UIEqnb.js → useRootScrollLock-DPhGk2Eu.js} +1 -1
  96. package/dist/assets/{useWalkthroughReview-BWxwaV05.js → useWalkthroughReview-BrULG_dy.js} +1 -1
  97. package/dist/assets/{useWholeFileComment-zterYCFS.js → useWholeFileComment-CQj6q_QX.js} +1 -1
  98. package/dist/assets/{useWorktreeArchiveActions-CKnDdsvh.js → useWorktreeArchiveActions-CpegLYyZ.js} +1 -1
  99. package/dist/assets/{vendor-codemirror-language-data-BI6j-q9C.js → vendor-codemirror-language-data-CFvXza4M.js} +2 -2
  100. package/dist/index.html +3 -3
  101. package/dist/mini-chat.html +2 -2
  102. package/dist/mobile.html +2 -2
  103. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import{R as z,j as E,a as Ie,f as ze,r as m}from"./vendor-react--VO_rL_p.js";import{a2 as je,u as Ut,an,ao as Mt,P as ln,U as cn,hq as dn,n as un,bS as fn,cs as hn,au as Se,ct as Pt,cu as Nt,cv as pn}from"./useAppFontEffects-CpxtKEGw.js";import{p as mn,a as gn}from"./parseDiffFromFile-CL7WjMrZ.js";import{c as Ft}from"./isDiffPlainText-B6ZzF_T5.js";import{P as yn,a as xn,V as it,F as vn}from"./pierreDiffTint-C4cPKKnP.js";import{R as wn,a as Ln,V as Sn}from"./ReviewCards-UN_E9jl0.js";import"./katex.min-B3YMLLh4.js";import{a as Ht,I as bn,u as Rn}from"./useInlineCommentController-Z8ADSR8f.js";import{u as kn,aE as Cn}from"./ReceivedPagePanel-CCDFxXT4.js";import{ensurePierreThemeRegistered as $t,getResolvedShikiTheme as Ot}from"./appThemeRegistry-C3TUDJ7r.js";import{DIFFS_HIGHLIGHTER as En}from"./diffsHighlighter-DZ_8ZCaS.js";import{u as In}from"./editorCodeMetrics-a0NLS65y.js";const pe=n=>{if(n.type==="review")return`review-${n.id}`;if(n.type==="new"){const e=Math.min(n.selection.start,n.selection.end),r=Math.max(n.selection.start,n.selection.end);return`new-comment-${n.selection.side??"additions"}-${e}-${r}`}return`draft-${n.draft.id}`},Tn=(n,e)=>n&&!e?{lineNumber:Math.max(n.start,n.end),side:n.side??"additions",metadata:{type:"new",selection:n}}:null,An=n=>{const{drafts:e,editingDraftId:r,reviewItems:t=[]}=n,i=[];for(const a of e){if(!Number.isFinite(a.endLine))continue;const l=Math.max(1,Math.floor(a.endLine)),u=a.side==="original"?"deletions":"additions";i.push({lineNumber:l,side:u,metadata:{type:a.id===r?"edit":"saved",draft:a}})}for(const a of t)i.push({lineNumber:a.lineNumber,side:a.side,metadata:{type:"review",id:a.id}});return i};function Mn(n){const e=n.trim();if(!e)return null;if(/^-?\d+(\.\d+)?$/.test(e)){const r=Number.parseFloat(e);return Number.isFinite(r)?r:null}if(e.endsWith("px")){const r=Number.parseFloat(e.slice(0,-2));return Number.isFinite(r)?r:null}return null}function _t(n){if(!(!n||n<=0))return Math.max(200,Math.floor(n))}function Pn(n){const{diffRootRef:e,drafts:r,selection:t,editingDraftId:i,commentText:a,onTextChange:l,fileLabel:u,onSave:d,onCancel:c,onEdit:f,onDelete:y,review:h,reviewItems:S,reviewField:R,excerptOf:w}=n,[O,D]=z.useState(0),[N,H]=z.useState(null),M=z.useMemo(()=>!t||i?null:pe({type:"new",selection:t}),[i,t]),W=z.useMemo(()=>{const x=r.map(b=>pe({type:b.id===i?"edit":"saved",draft:b}));M&&x.push(M);for(const b of S)x.push(pe({type:"review",id:b.id}));return x},[r,i,S,M]),q=z.useCallback(x=>{const b=e.current;if(!b)return null;const _=b.querySelector("diffs-container");if(!(_ instanceof HTMLElement))return null;const j=_.querySelector(`[data-annotation-id="${x}"]`);if(j instanceof HTMLElement)return j;const X=_.shadowRoot;return X?X.querySelector(`[data-annotation-id="${x}"]`):null},[e]);z.useEffect(()=>{if(W.length===0)return;let x=false,b=0;const _=12,j=()=>{x||W.every(Y=>!!q(Y))||b>=_||(b+=1,requestAnimationFrame(()=>{x||(D(Y=>Y+1),j())}))};return j(),()=>{x=true}},[W,q]),z.useEffect(()=>{const x=e.current;if(!x)return;const b=()=>{const j=getComputedStyle(x),X=Mn(j.getPropertyValue("--oc-context-panel-width")),Y=x.getBoundingClientRect(),Q=X??Y.width;H(Q>0?Q:null)};b();const _=new ResizeObserver(()=>{b()});return _.observe(x),window.addEventListener("resize",b),()=>{_.disconnect(),window.removeEventListener("resize",b)}},[e]);const oe=z.useCallback(x=>{const _=e.current?.getBoundingClientRect(),j=x.closest("[data-annotation-content]"),X=j instanceof HTMLElement?j.getBoundingClientRect():x.getBoundingClientRect(),Y=[X.width];_&&Y.push(_.right-X.left);const Q=Y.filter(Te=>Number.isFinite(Te)&&Te>0);return Q.length>0?_t(Math.min(...Q)):_t(N)},[e,N]),ie=()=>{const x=e.current?.querySelector("diffs-container")?.shadowRoot,b=x?Array.from(x.querySelectorAll("[data-line][data-selected-line]")).at(-1):void 0;if(b)return getComputedStyle(b).getPropertyValue("--diffs-computed-selected-line-bg").trim()||void 0};return E.jsxs(E.Fragment,{children:[r.map(x=>{const b=pe({type:x.id===i?"edit":"saved",draft:x}),_=q(b);if(!_)return null;const j=oe(_);return x.id===i?Ie.createPortal(E.jsx(Ht,{initialText:a,onTextChange:l,fileLabel:u,lineRange:{start:x.startLine,end:x.endLine,side:x.side==="original"?"deletions":"additions"},isEditing:true,onSave:d,onCancel:c,maxWidth:j,bandColor:ie()}),_,`draft-edit-${x.id}`):Ie.createPortal(E.jsx(bn,{draft:x,onEdit:()=>f(x),onDelete:()=>y(x),maxWidth:j,forAgent:h!==null}),_,`draft-card-${x.id}`)}),t&&!i&&M&&(()=>{const x=q(M);if(!x)return null;const b=oe(x);return Ie.createPortal(E.jsx(Ht,{initialText:a,onTextChange:l,fileLabel:u,lineRange:t,isEditing:false,onSave:d,onCancel:c,maxWidth:b,bandColor:ie(),review:R}),x,M)})(),h?S.map(x=>{const b=pe({type:"review",id:x.id}),_=q(b);if(!_)return null;const j=oe(_);return Ie.createPortal(E.jsx("div",{className:"px-3 py-1.5",children:x.kind==="draft"?E.jsx(wn,{comment:x.comment,review:h,excerpt:w(x),fileLabel:u,maxWidth:j}):E.jsx(Ln,{thread:x.thread,review:h,excerpt:w(x),maxWidth:j})}),_,b)}):null]})}const Br=14,Wr=n=>n.slice(n.lastIndexOf("/",n.length-2)+1),Gt=n=>n.replace(/\\/g,"/").replace(/^\/+/,"").trim(),Dt=(n,e)=>({id:`dir:${n}`,path:n,name:e,children:new Map,directFiles:[],files:[]}),zr=n=>{const e=Dt("","");for(const r of n){const t=Gt(r.path);if(!t)continue;const a=t.split("/").filter(Boolean).slice(0,-1);let l=e;if(l.files.push(r),a.length>0){let u="";for(const d of a){u=u?`${u}/${d}`:d;const c=l.children.get(d);if(c){c.files.push(r),l=c;continue}const f=Dt(u,d);f.files.push(r),l.children.set(d,f),l=f}}l.directFiles.push(r)}return e},Nn=n=>{let e=n,r=n.name;for(;e.directFiles.length===0&&e.children.size===1;){const[t]=e.children.values();e=t,r=`${r}/${t.name}`}return{node:e,label:r}},qr=(n,e)=>{const r=[],t=(i,a)=>{const l=Array.from(i.children.values()).sort((d,c)=>d.path.localeCompare(c.path));for(const d of l){const{node:c,label:f}=Nn(d);r.push({key:c.id,kind:"directory",depth:a,label:f,directory:c}),e.has(c.path)&&t(c,a+1)}const u=[...i.directFiles].sort((d,c)=>d.path.localeCompare(c.path));for(const d of u)r.push({key:`file:${Gt(d.path)}`,kind:"file",depth:a,file:d})};return t(n,0),r},Vr=n=>{const e=ze.c(29),{path:r,from:t,className:i,nameFirst:a}=n,l=a===void 0?false:a;let u,d;e[0]!==r?(u=r.lastIndexOf("/"),d=u===-1?"":r.slice(0,u),e[0]=r,e[1]=u,e[2]=d):(u=e[1],d=e[2]);const c=d;let f;e[3]!==u||e[4]!==r?(f=r.slice(u+1),e[3]=u,e[4]=r,e[5]=f):f=e[5];const y=f;let h;if(e[6]!==t){const M=t?t.lastIndexOf("/"):-1;h=t&&M!==-1?t.slice(0,M):"",e[6]=t,e[7]=h}else h=e[7];const S=h,R=t?`${t} \u2192 ${r}`:r;if(u===-1&&!t){let M;e[8]!==i?(M=je("block min-w-0 truncate text-foreground",i),e[8]=i,e[9]=M):M=e[9];let W;return e[10]!==r||e[11]!==M||e[12]!==R?(W=E.jsx("span",{dir:"ltr",className:M,title:R,children:r}),e[10]=r,e[11]=M,e[12]=R,e[13]=W):W=e[13],W}const w=l&&"gap-2";let O;e[14]!==i||e[15]!==w?(O=je("flex min-w-0 items-baseline overflow-hidden",w,i),e[14]=i,e[15]=w,e[16]=O):O=e[16];let D;e[17]!==t?(D=t?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"oc-ui-start-align min-w-0 truncate text-muted-foreground",style:{direction:"rtl",unicodeBidi:"plaintext"},children:t}),E.jsx("span",{className:"shrink-0 px-1 text-muted-foreground",children:"\u2192"})]}):null,e[17]=t,e[18]=D):D=e[18];let N;e[19]!==c||e[20]!==S||e[21]!==y||e[22]!==l?(N=l?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"max-w-full shrink-0 truncate text-foreground",children:y}),c&&c!==S?E.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground",children:c}):null]}):E.jsxs(E.Fragment,{children:[c?E.jsx("span",{className:"oc-ui-start-align min-w-0 truncate text-muted-foreground",style:{direction:"rtl",unicodeBidi:"plaintext"},children:c}):null,E.jsxs("span",{className:"max-w-full shrink-0 truncate",children:[c?E.jsx("span",{className:"text-muted-foreground",children:"/"}):null,E.jsx("span",{className:"text-foreground",children:y})]})]}),e[19]=c,e[20]=S,e[21]=y,e[22]=l,e[23]=N):N=e[23];let H;return e[24]!==O||e[25]!==D||e[26]!==N||e[27]!==R?(H=E.jsxs("span",{dir:"ltr",className:O,title:R,children:[D,N]}),e[24]=O,e[25]=D,e[26]=N,e[27]=R,e[28]=H):H=e[28],H},st=3,Fn=1e6,jt=new WeakMap,Hn=n=>{const e=jt.get(n);if(e)return e;let r=false;const t=[];for(const a of n.hunks){const l=[];for(const u of a.hunkContent){if(u.type==="context"){dt(l,{...u});continue}const d=$n(n,u);(d.length>1||d[0]?.type==="context")&&(r=true);for(const c of d)dt(l,c)}t.push(..._n(a,l))}const i=r?jn(n,t):n;return jt.set(n,i),i},Bt=n=>n.replace(/\s+/g,""),$n=(n,e)=>{if(e.deletions===0||e.additions===0)return[{...e}];const r=n.deletionLines.slice(e.deletionLineIndex,e.deletionLineIndex+e.deletions),t=n.additionLines.slice(e.additionLineIndex,e.additionLineIndex+e.additions),i=[];let a=0,l=0;for(const[u,d]of On(r,t))(u>a||d>l)&&i.push({type:"change",deletions:u-a,deletionLineIndex:e.deletionLineIndex+a,additions:d-l,additionLineIndex:e.additionLineIndex+l}),dt(i,{type:"context",lines:1,deletionLineIndex:e.deletionLineIndex+u,additionLineIndex:e.additionLineIndex+d}),a=u+1,l=d+1;return(a<e.deletions||l<e.additions)&&i.push({type:"change",deletions:e.deletions-a,deletionLineIndex:e.deletionLineIndex+a,additions:e.additions-l,additionLineIndex:e.additionLineIndex+l}),i},On=(n,e)=>{const r=n.map(Bt),t=e.map(Bt),i=[];let a=0;for(;a<r.length&&a<t.length&&r[a]===t[a];)i.push([a,a]),a+=1;let l=0;for(;l<r.length-a&&l<t.length-a&&r[r.length-1-l]===t[t.length-1-l];)l+=1;const u=r.length-a-l,d=t.length-a-l;if(u>0&&d>0&&(u+1)*(d+1)<=Fn){const c=d+1,f=new Uint32Array((u+1)*c);for(let S=u-1;S>=0;S-=1)for(let R=d-1;R>=0;R-=1)f[S*c+R]=r[a+S]===t[a+R]?f[(S+1)*c+R+1]+1:Math.max(f[(S+1)*c+R],f[S*c+R+1]);let y=0,h=0;for(;y<u&&h<d;)r[a+y]===t[a+h]?(i.push([a+y,a+h]),y+=1,h+=1):f[(y+1)*c+h]>=f[y*c+h+1]?y+=1:h+=1}for(let c=l;c>0;c-=1)i.push([r.length-c,t.length-c]);return i},dt=(n,e)=>{const r=n.at(-1);if(r?.type==="context"&&e.type==="context"){r.lines+=e.lines;return}n.push(e)},Wt=(n,e,r)=>({type:"context",lines:r,deletionLineIndex:n.deletionLineIndex+e,additionLineIndex:n.additionLineIndex+e}),_n=(n,e)=>{const r=[];let t=null;for(const[a,l]of e.entries()){if(l.type==="change"){if(!t){t=[];const d=e[a-1];if(d?.type==="context"){const c=Math.min(d.lines,st);t.push(Wt(d,d.lines-c,c))}}t.push(l);continue}if(!t)continue;if(a<e.length-1&&l.lines<=st*2){t.push(l);continue}t.push(Wt(l,0,Math.min(l.lines,st))),r.push(t),t=null}t&&r.push(t);const i=e.at(-1);return r.map(a=>{const l=a.at(-1),u=l!==void 0&&i!==void 0&&_e(l,"deletion")===_e(i,"deletion")&&_e(l,"addition")===_e(i,"addition");return Dn(n,a,u)})},_e=(n,e)=>e==="deletion"?n.deletionLineIndex+(n.type==="context"?n.lines:n.deletions):n.additionLineIndex+(n.type==="context"?n.lines:n.additions),Dn=(n,e,r)=>{let t=0,i=0,a=0,l=0,u=0;for(const w of e)w.type==="context"?(a+=w.lines,l+=w.lines,u+=w.lines):(t+=w.additions,i+=w.deletions,l+=Math.max(w.additions,w.deletions),u+=w.additions+w.deletions);const d=e[0],c=a+t,f=a+i,y=zt(Be(n.additionStart,n.additionCount)+d.additionLineIndex-n.additionLineIndex,c),h=zt(Be(n.deletionStart,n.deletionCount)+d.deletionLineIndex-n.deletionLineIndex,f),R=d.additionLineIndex===n.additionLineIndex&&d.deletionLineIndex===n.deletionLineIndex?n.hunkContext:void 0;return{collapsedBefore:0,additionStart:y,additionCount:c,additionLines:t,additionLineIndex:d.additionLineIndex,deletionStart:h,deletionCount:f,deletionLines:i,deletionLineIndex:d.deletionLineIndex,hunkContent:e,hunkContext:R,hunkSpecs:`@@ -${h},${f} +${y},${c} @@${R?` ${R}`:""}
1
+ import{R as z,j as E,a as Ie,f as ze,r as m}from"./vendor-react--VO_rL_p.js";import{a2 as je,u as Ut,an,ao as Mt,P as ln,U as cn,hq as dn,n as un,bS as fn,cs as hn,au as Se,ct as Pt,cu as Nt,cv as pn}from"./useAppFontEffects-BDLOJuy5.js";import{p as mn,a as gn}from"./parseDiffFromFile-D28_u-uC.js";import{c as Ft}from"./isDiffPlainText-Cx5SgKlQ.js";import{P as yn,a as xn,V as it,F as vn}from"./pierreDiffTint-CLCzflgS.js";import{R as wn,a as Ln,V as Sn}from"./ReviewCards-D7jBPhS_.js";import"./katex.min-DklPh68d.js";import{a as Ht,I as bn,u as Rn}from"./useInlineCommentController-Wnopn0Ar.js";import{u as kn,aE as Cn}from"./ReceivedPagePanel-CfXyzCii.js";import{ensurePierreThemeRegistered as $t,getResolvedShikiTheme as Ot}from"./appThemeRegistry-C4Av1s90.js";import{DIFFS_HIGHLIGHTER as En}from"./diffsHighlighter-CFc933Ip.js";import{u as In}from"./editorCodeMetrics-CNBjOGNA.js";const pe=n=>{if(n.type==="review")return`review-${n.id}`;if(n.type==="new"){const e=Math.min(n.selection.start,n.selection.end),r=Math.max(n.selection.start,n.selection.end);return`new-comment-${n.selection.side??"additions"}-${e}-${r}`}return`draft-${n.draft.id}`},Tn=(n,e)=>n&&!e?{lineNumber:Math.max(n.start,n.end),side:n.side??"additions",metadata:{type:"new",selection:n}}:null,An=n=>{const{drafts:e,editingDraftId:r,reviewItems:t=[]}=n,i=[];for(const a of e){if(!Number.isFinite(a.endLine))continue;const l=Math.max(1,Math.floor(a.endLine)),u=a.side==="original"?"deletions":"additions";i.push({lineNumber:l,side:u,metadata:{type:a.id===r?"edit":"saved",draft:a}})}for(const a of t)i.push({lineNumber:a.lineNumber,side:a.side,metadata:{type:"review",id:a.id}});return i};function Mn(n){const e=n.trim();if(!e)return null;if(/^-?\d+(\.\d+)?$/.test(e)){const r=Number.parseFloat(e);return Number.isFinite(r)?r:null}if(e.endsWith("px")){const r=Number.parseFloat(e.slice(0,-2));return Number.isFinite(r)?r:null}return null}function _t(n){if(!(!n||n<=0))return Math.max(200,Math.floor(n))}function Pn(n){const{diffRootRef:e,drafts:r,selection:t,editingDraftId:i,commentText:a,onTextChange:l,fileLabel:u,onSave:d,onCancel:c,onEdit:f,onDelete:y,review:h,reviewItems:S,reviewField:R,excerptOf:w}=n,[O,D]=z.useState(0),[N,H]=z.useState(null),M=z.useMemo(()=>!t||i?null:pe({type:"new",selection:t}),[i,t]),W=z.useMemo(()=>{const x=r.map(b=>pe({type:b.id===i?"edit":"saved",draft:b}));M&&x.push(M);for(const b of S)x.push(pe({type:"review",id:b.id}));return x},[r,i,S,M]),q=z.useCallback(x=>{const b=e.current;if(!b)return null;const _=b.querySelector("diffs-container");if(!(_ instanceof HTMLElement))return null;const j=_.querySelector(`[data-annotation-id="${x}"]`);if(j instanceof HTMLElement)return j;const X=_.shadowRoot;return X?X.querySelector(`[data-annotation-id="${x}"]`):null},[e]);z.useEffect(()=>{if(W.length===0)return;let x=false,b=0;const _=12,j=()=>{x||W.every(Y=>!!q(Y))||b>=_||(b+=1,requestAnimationFrame(()=>{x||(D(Y=>Y+1),j())}))};return j(),()=>{x=true}},[W,q]),z.useEffect(()=>{const x=e.current;if(!x)return;const b=()=>{const j=getComputedStyle(x),X=Mn(j.getPropertyValue("--oc-context-panel-width")),Y=x.getBoundingClientRect(),Q=X??Y.width;H(Q>0?Q:null)};b();const _=new ResizeObserver(()=>{b()});return _.observe(x),window.addEventListener("resize",b),()=>{_.disconnect(),window.removeEventListener("resize",b)}},[e]);const oe=z.useCallback(x=>{const _=e.current?.getBoundingClientRect(),j=x.closest("[data-annotation-content]"),X=j instanceof HTMLElement?j.getBoundingClientRect():x.getBoundingClientRect(),Y=[X.width];_&&Y.push(_.right-X.left);const Q=Y.filter(Te=>Number.isFinite(Te)&&Te>0);return Q.length>0?_t(Math.min(...Q)):_t(N)},[e,N]),ie=()=>{const x=e.current?.querySelector("diffs-container")?.shadowRoot,b=x?Array.from(x.querySelectorAll("[data-line][data-selected-line]")).at(-1):void 0;if(b)return getComputedStyle(b).getPropertyValue("--diffs-computed-selected-line-bg").trim()||void 0};return E.jsxs(E.Fragment,{children:[r.map(x=>{const b=pe({type:x.id===i?"edit":"saved",draft:x}),_=q(b);if(!_)return null;const j=oe(_);return x.id===i?Ie.createPortal(E.jsx(Ht,{initialText:a,onTextChange:l,fileLabel:u,lineRange:{start:x.startLine,end:x.endLine,side:x.side==="original"?"deletions":"additions"},isEditing:true,onSave:d,onCancel:c,maxWidth:j,bandColor:ie()}),_,`draft-edit-${x.id}`):Ie.createPortal(E.jsx(bn,{draft:x,onEdit:()=>f(x),onDelete:()=>y(x),maxWidth:j,forAgent:h!==null}),_,`draft-card-${x.id}`)}),t&&!i&&M&&(()=>{const x=q(M);if(!x)return null;const b=oe(x);return Ie.createPortal(E.jsx(Ht,{initialText:a,onTextChange:l,fileLabel:u,lineRange:t,isEditing:false,onSave:d,onCancel:c,maxWidth:b,bandColor:ie(),review:R}),x,M)})(),h?S.map(x=>{const b=pe({type:"review",id:x.id}),_=q(b);if(!_)return null;const j=oe(_);return Ie.createPortal(E.jsx("div",{className:"px-3 py-1.5",children:x.kind==="draft"?E.jsx(wn,{comment:x.comment,review:h,excerpt:w(x),fileLabel:u,maxWidth:j}):E.jsx(Ln,{thread:x.thread,review:h,excerpt:w(x),maxWidth:j})}),_,b)}):null]})}const Br=14,Wr=n=>n.slice(n.lastIndexOf("/",n.length-2)+1),Gt=n=>n.replace(/\\/g,"/").replace(/^\/+/,"").trim(),Dt=(n,e)=>({id:`dir:${n}`,path:n,name:e,children:new Map,directFiles:[],files:[]}),zr=n=>{const e=Dt("","");for(const r of n){const t=Gt(r.path);if(!t)continue;const a=t.split("/").filter(Boolean).slice(0,-1);let l=e;if(l.files.push(r),a.length>0){let u="";for(const d of a){u=u?`${u}/${d}`:d;const c=l.children.get(d);if(c){c.files.push(r),l=c;continue}const f=Dt(u,d);f.files.push(r),l.children.set(d,f),l=f}}l.directFiles.push(r)}return e},Nn=n=>{let e=n,r=n.name;for(;e.directFiles.length===0&&e.children.size===1;){const[t]=e.children.values();e=t,r=`${r}/${t.name}`}return{node:e,label:r}},qr=(n,e)=>{const r=[],t=(i,a)=>{const l=Array.from(i.children.values()).sort((d,c)=>d.path.localeCompare(c.path));for(const d of l){const{node:c,label:f}=Nn(d);r.push({key:c.id,kind:"directory",depth:a,label:f,directory:c}),e.has(c.path)&&t(c,a+1)}const u=[...i.directFiles].sort((d,c)=>d.path.localeCompare(c.path));for(const d of u)r.push({key:`file:${Gt(d.path)}`,kind:"file",depth:a,file:d})};return t(n,0),r},Vr=n=>{const e=ze.c(29),{path:r,from:t,className:i,nameFirst:a}=n,l=a===void 0?false:a;let u,d;e[0]!==r?(u=r.lastIndexOf("/"),d=u===-1?"":r.slice(0,u),e[0]=r,e[1]=u,e[2]=d):(u=e[1],d=e[2]);const c=d;let f;e[3]!==u||e[4]!==r?(f=r.slice(u+1),e[3]=u,e[4]=r,e[5]=f):f=e[5];const y=f;let h;if(e[6]!==t){const M=t?t.lastIndexOf("/"):-1;h=t&&M!==-1?t.slice(0,M):"",e[6]=t,e[7]=h}else h=e[7];const S=h,R=t?`${t} \u2192 ${r}`:r;if(u===-1&&!t){let M;e[8]!==i?(M=je("block min-w-0 truncate text-foreground",i),e[8]=i,e[9]=M):M=e[9];let W;return e[10]!==r||e[11]!==M||e[12]!==R?(W=E.jsx("span",{dir:"ltr",className:M,title:R,children:r}),e[10]=r,e[11]=M,e[12]=R,e[13]=W):W=e[13],W}const w=l&&"gap-2";let O;e[14]!==i||e[15]!==w?(O=je("flex min-w-0 items-baseline overflow-hidden",w,i),e[14]=i,e[15]=w,e[16]=O):O=e[16];let D;e[17]!==t?(D=t?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"oc-ui-start-align min-w-0 truncate text-muted-foreground",style:{direction:"rtl",unicodeBidi:"plaintext"},children:t}),E.jsx("span",{className:"shrink-0 px-1 text-muted-foreground",children:"\u2192"})]}):null,e[17]=t,e[18]=D):D=e[18];let N;e[19]!==c||e[20]!==S||e[21]!==y||e[22]!==l?(N=l?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"max-w-full shrink-0 truncate text-foreground",children:y}),c&&c!==S?E.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground",children:c}):null]}):E.jsxs(E.Fragment,{children:[c?E.jsx("span",{className:"oc-ui-start-align min-w-0 truncate text-muted-foreground",style:{direction:"rtl",unicodeBidi:"plaintext"},children:c}):null,E.jsxs("span",{className:"max-w-full shrink-0 truncate",children:[c?E.jsx("span",{className:"text-muted-foreground",children:"/"}):null,E.jsx("span",{className:"text-foreground",children:y})]})]}),e[19]=c,e[20]=S,e[21]=y,e[22]=l,e[23]=N):N=e[23];let H;return e[24]!==O||e[25]!==D||e[26]!==N||e[27]!==R?(H=E.jsxs("span",{dir:"ltr",className:O,title:R,children:[D,N]}),e[24]=O,e[25]=D,e[26]=N,e[27]=R,e[28]=H):H=e[28],H},st=3,Fn=1e6,jt=new WeakMap,Hn=n=>{const e=jt.get(n);if(e)return e;let r=false;const t=[];for(const a of n.hunks){const l=[];for(const u of a.hunkContent){if(u.type==="context"){dt(l,{...u});continue}const d=$n(n,u);(d.length>1||d[0]?.type==="context")&&(r=true);for(const c of d)dt(l,c)}t.push(..._n(a,l))}const i=r?jn(n,t):n;return jt.set(n,i),i},Bt=n=>n.replace(/\s+/g,""),$n=(n,e)=>{if(e.deletions===0||e.additions===0)return[{...e}];const r=n.deletionLines.slice(e.deletionLineIndex,e.deletionLineIndex+e.deletions),t=n.additionLines.slice(e.additionLineIndex,e.additionLineIndex+e.additions),i=[];let a=0,l=0;for(const[u,d]of On(r,t))(u>a||d>l)&&i.push({type:"change",deletions:u-a,deletionLineIndex:e.deletionLineIndex+a,additions:d-l,additionLineIndex:e.additionLineIndex+l}),dt(i,{type:"context",lines:1,deletionLineIndex:e.deletionLineIndex+u,additionLineIndex:e.additionLineIndex+d}),a=u+1,l=d+1;return(a<e.deletions||l<e.additions)&&i.push({type:"change",deletions:e.deletions-a,deletionLineIndex:e.deletionLineIndex+a,additions:e.additions-l,additionLineIndex:e.additionLineIndex+l}),i},On=(n,e)=>{const r=n.map(Bt),t=e.map(Bt),i=[];let a=0;for(;a<r.length&&a<t.length&&r[a]===t[a];)i.push([a,a]),a+=1;let l=0;for(;l<r.length-a&&l<t.length-a&&r[r.length-1-l]===t[t.length-1-l];)l+=1;const u=r.length-a-l,d=t.length-a-l;if(u>0&&d>0&&(u+1)*(d+1)<=Fn){const c=d+1,f=new Uint32Array((u+1)*c);for(let S=u-1;S>=0;S-=1)for(let R=d-1;R>=0;R-=1)f[S*c+R]=r[a+S]===t[a+R]?f[(S+1)*c+R+1]+1:Math.max(f[(S+1)*c+R],f[S*c+R+1]);let y=0,h=0;for(;y<u&&h<d;)r[a+y]===t[a+h]?(i.push([a+y,a+h]),y+=1,h+=1):f[(y+1)*c+h]>=f[y*c+h+1]?y+=1:h+=1}for(let c=l;c>0;c-=1)i.push([r.length-c,t.length-c]);return i},dt=(n,e)=>{const r=n.at(-1);if(r?.type==="context"&&e.type==="context"){r.lines+=e.lines;return}n.push(e)},Wt=(n,e,r)=>({type:"context",lines:r,deletionLineIndex:n.deletionLineIndex+e,additionLineIndex:n.additionLineIndex+e}),_n=(n,e)=>{const r=[];let t=null;for(const[a,l]of e.entries()){if(l.type==="change"){if(!t){t=[];const d=e[a-1];if(d?.type==="context"){const c=Math.min(d.lines,st);t.push(Wt(d,d.lines-c,c))}}t.push(l);continue}if(!t)continue;if(a<e.length-1&&l.lines<=st*2){t.push(l);continue}t.push(Wt(l,0,Math.min(l.lines,st))),r.push(t),t=null}t&&r.push(t);const i=e.at(-1);return r.map(a=>{const l=a.at(-1),u=l!==void 0&&i!==void 0&&_e(l,"deletion")===_e(i,"deletion")&&_e(l,"addition")===_e(i,"addition");return Dn(n,a,u)})},_e=(n,e)=>e==="deletion"?n.deletionLineIndex+(n.type==="context"?n.lines:n.deletions):n.additionLineIndex+(n.type==="context"?n.lines:n.additions),Dn=(n,e,r)=>{let t=0,i=0,a=0,l=0,u=0;for(const w of e)w.type==="context"?(a+=w.lines,l+=w.lines,u+=w.lines):(t+=w.additions,i+=w.deletions,l+=Math.max(w.additions,w.deletions),u+=w.additions+w.deletions);const d=e[0],c=a+t,f=a+i,y=zt(Be(n.additionStart,n.additionCount)+d.additionLineIndex-n.additionLineIndex,c),h=zt(Be(n.deletionStart,n.deletionCount)+d.deletionLineIndex-n.deletionLineIndex,f),R=d.additionLineIndex===n.additionLineIndex&&d.deletionLineIndex===n.deletionLineIndex?n.hunkContext:void 0;return{collapsedBefore:0,additionStart:y,additionCount:c,additionLines:t,additionLineIndex:d.additionLineIndex,deletionStart:h,deletionCount:f,deletionLines:i,deletionLineIndex:d.deletionLineIndex,hunkContent:e,hunkContext:R,hunkSpecs:`@@ -${h},${f} +${y},${c} @@${R?` ${R}`:""}
2
2
  `,splitLineStart:0,splitLineCount:l,unifiedLineStart:0,unifiedLineCount:u,noEOFCRDeletions:r&&n.noEOFCRDeletions,noEOFCRAdditions:r&&n.noEOFCRAdditions}},Be=(n,e)=>n-(e===0?0:1),zt=(n,e)=>n+(e===0?0:1),jn=(n,e)=>{let r=0,t=0,i=0;for(const l of e)l.collapsedBefore=Math.max(Be(l.additionStart,l.additionCount)-i,0),l.splitLineStart=r+l.collapsedBefore,l.unifiedLineStart=t+l.collapsedBefore,r+=l.collapsedBefore+l.splitLineCount,t+=l.collapsedBefore+l.unifiedLineCount,i=Be(l.additionStart,l.additionCount)+l.additionCount;if(e.at(-1)&&!n.isPartial&&n.additionLines.length>0&&n.deletionLines.length>0){const l=Math.max(n.additionLines.length-i,0);r+=l,t+=l}return{...n,...n.isPartial?Bn(n,e):{hunks:e},splitLineCount:r,unifiedLineCount:t,cacheKey:n.cacheKey===void 0?void 0:`${n.cacheKey}:hide-whitespace`}},Bn=(n,e)=>{const r=[],t=[],i=(l,u,d,c)=>{for(let f=d;f<d+c;f+=1)u.push(l[f])};return{hunks:e.map(l=>{const u=r.length,d=t.length,c=l.hunkContent.map(f=>{const y={...f,deletionLineIndex:r.length,additionLineIndex:t.length};return i(n.deletionLines,r,f.deletionLineIndex,f.type==="context"?f.lines:f.deletions),i(n.additionLines,t,f.additionLineIndex,f.type==="context"?f.lines:f.additions),y});return{...l,deletionLineIndex:u,additionLineIndex:d,hunkContent:c}}),deletionLines:r,additionLines:t}},Wn=n=>n.replace(/\r?\n$/,""),zn=(n,e,r)=>{if(!n.isPartial)return r-1;for(const t of n.hunks){const i=e==="additions"?t.additionStart:t.deletionStart,a=e==="additions"?t.additionCount:t.deletionCount;if(r<i||r>=i+a)continue;return(e==="additions"?t.additionLineIndex:t.deletionLineIndex)+(r-i)}return null},qn=(n,e,r,t)=>{const i=e==="additions"?n.additionLines:n.deletionLines,a=[];for(let l=Math.max(1,r);l<=t;l+=1){const u=zn(n,e,l),d=u===null?void 0:i[u];d!==void 0&&a.push(Wn(d))}return a.join(`
3
3
  `)},at=/[\p{L}\p{N}_$]/u,Vn=(n,e)=>{if(e<0||e>n.length)return null;const r=e===n.length?n.length-1:e;if(r<0||!at.test(n[r]))return null;let t=r,i=r+1;for(;t>0&&at.test(n[t-1]);)t-=1;for(;i<n.length&&at.test(n[i]);)i+=1;return{word:n.slice(t,i),spanStart:t}},Kn=n=>n?Array.from(n.children).filter(e=>e instanceof HTMLElement&&e.hasAttribute("data-code")):[],Un=(n,e)=>{const r=new Map,t=()=>{const d=n.getBoundingClientRect().left,c=Array.from(r.values(),f=>({entry:f,left:f.column.getBoundingClientRect().left-d,clientWidth:f.column.clientWidth,scrollWidth:f.column.scrollWidth,scrollLeft:f.column.scrollLeft}));e.hidden=!c.some(f=>f.scrollWidth-f.clientWidth>1);for(const{entry:f,left:y,clientWidth:h,scrollWidth:S,scrollLeft:R}of c){const w=S-h>1;f.track.hidden=!w,w&&(f.track.style.left=`${y}px`,f.track.style.width=`${h}px`,f.spacer.style.width=`${S}px`,f.track.scrollLeft=R)}},i=new ResizeObserver(t),a=new MutationObserver(()=>u()),l=d=>{const c=document.createElement("div");c.className="absolute inset-y-0 overflow-x-auto overflow-y-hidden overscroll-x-none",c.tabIndex=-1,c.hidden=true;const f=document.createElement("div");f.className="h-px",c.appendChild(f),e.appendChild(c);const y=()=>{Math.abs(c.scrollLeft-d.scrollLeft)>=1&&(c.scrollLeft=d.scrollLeft)},h=()=>{Math.abs(d.scrollLeft-c.scrollLeft)>=1&&(d.scrollLeft=c.scrollLeft)};return d.addEventListener("scroll",y,{passive:true}),c.addEventListener("scroll",h,{passive:true}),i.observe(d),{column:d,content:null,track:c,spacer:f,detach:()=>{d.removeEventListener("scroll",y),c.removeEventListener("scroll",h),i.unobserve(d),c.remove()}}},u=()=>{const d=n.querySelector("diffs-container")?.shadowRoot??null,c=d?.querySelector("pre")??null,f=Kn(c);for(const[y,h]of r)f.includes(y)||(h.detach(),h.content&&i.unobserve(h.content),r.delete(y));for(const y of f){const h=r.get(y)??l(y);r.set(y,h);const S=Array.from(y.children).find(R=>R.hasAttribute("data-content"))??null;S!==h.content&&(h.content&&i.unobserve(h.content),S&&i.observe(S),h.content=S)}a.disconnect(),a.observe(n,{childList:true}),d&&a.observe(d,{childList:true}),c&&a.observe(c,{childList:true});for(const y of f)a.observe(y,{childList:true});r.size===0&&(e.hidden=true)};return u(),i.observe(n),()=>{a.disconnect(),i.disconnect();for(const d of r.values())d.detach();r.clear(),e.hidden=true}},Gn=n=>{const e=ze.c(4),{containerRef:r}=n,t=z.useRef(null);let i,a;e[0]!==r?(i=()=>{const u=r.current,d=t.current;if(!(!u||!d))return Un(u,d)},a=[r],e[0]=r,e[1]=i,e[2]=a):(i=e[1],a=e[2]),z.useEffect(i,a);let l;return e[3]===Symbol.for("react.memo_cache_sentinel")?(l=E.jsx("div",{ref:t,hidden:true,"aria-hidden":"true",className:"sticky bottom-0 z-10 h-2.5 bg-background"}),e[3]=l):l=e[3],l},qt=[],Xn=`
4
4
  [data-gutter-buffer="annotation"] { min-height: 0; }
@@ -1 +1 @@
1
- import{r as a}from"./vendor-react--VO_rL_p.js";import{l as u,j as p}from"./katex.min-B3YMLLh4.js";import{V as f}from"./useAppFontEffects-CpxtKEGw.js";function h(t=!0){const i=f(r=>r.providers),e=u(r=>r.currentDirectory),[c,n]=a.useState(void 0);return a.useEffect(()=>{if(!t)return;let r=!1;return(async()=>{try{const l=e?`/api/small-model?directory=${encodeURIComponent(e)}`:"/api/small-model",o=await p(l,{method:"GET",headers:{Accept:"application/json"}});if(!o.ok)return;const s=await o.json().catch(()=>null);!r&&Array.isArray(s?.authenticatedProviders)&&n(s.authenticatedProviders.filter(d=>typeof d=="string"))}catch{}})(),()=>{r=!0}},[i,e,t]),c}export{h as u};
1
+ import{r as a}from"./vendor-react--VO_rL_p.js";import{l as u,j as p}from"./katex.min-DklPh68d.js";import{V as f}from"./useAppFontEffects-BDLOJuy5.js";function h(t=!0){const i=f(r=>r.providers),e=u(r=>r.currentDirectory),[c,n]=a.useState(void 0);return a.useEffect(()=>{if(!t)return;let r=!1;return(async()=>{try{const l=e?`/api/small-model?directory=${encodeURIComponent(e)}`:"/api/small-model",o=await p(l,{method:"GET",headers:{Accept:"application/json"}});if(!o.ok)return;const s=await o.json().catch(()=>null);!r&&Array.isArray(s?.authenticatedProviders)&&n(s.authenticatedProviders.filter(d=>typeof d=="string"))}catch{}})(),()=>{r=!0}},[i,e,t]),c}export{h as u};
@@ -1 +1 @@
1
- import{f as we,R as n,j as x}from"./vendor-react--VO_rL_p.js";import{h as Fe}from"./useBranchPullRequestRequest-DVy6rEsu.js";import{u as Ce,a2 as Ee,da as Se,I as oe,y as Re,af as ue,B as fe,ag as de,ae as me,fU as ve,fV as Ne}from"./useAppFontEffects-CpxtKEGw.js";import"./katex.min-B3YMLLh4.js";const je="data-diff-find-bar",Qe=t=>{const e=we.c(99),{query:i,onQueryChange:y,total:a,currentIndex:h,isSearching:s,failedCount:C,onNext:g,onPrevious:b,onClose:m,focusNonce:d,className:P}=t,k=C===void 0?0:C,{t:l}=Ce(),E=n.useRef(null);let A,N;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{E.current?.focus()},N=[],e[0]=A,e[1]=N):(A=e[0],N=e[1]),n.useEffect(A,N);let F,S;e[2]!==d?(F=()=>{d&&d>0&&(E.current?.focus(),E.current?.select())},S=[d],e[2]=d,e[3]=F,e[4]=S):(F=e[3],S=e[4]),n.useEffect(F,S);let I;e[5]!==s||e[6]!==i?(I=i.trim().length>0&&!s,e[5]=s,e[6]=i,e[7]=I):I=e[7];const j=I;let p;e[8]!==h||e[9]!==j||e[10]!==l||e[11]!==a?(p=a>0?l("diffFind.countAria",{current:h+1,total:a}):j?l("diffFind.noMatches"):void 0,e[8]=h,e[9]=j,e[10]=l,e[11]=a,e[12]=p):p=e[12];const _=p;let o;e[13]!==s||e[14]!==_||e[15]!==l?(o=s?[_,l("diffFind.searchingAria")].filter(Boolean).join(", "):_,e[13]=s,e[14]=_,e[15]=l,e[16]=o):o=e[16];const c=o;let u;e[17]!==m||e[18]!==g||e[19]!==b?(u=B=>{Se(B)||(B.key==="Enter"?(B.preventDefault(),B.shiftKey?b():g()):B.key==="Escape"&&(B.preventDefault(),m()))},e[17]=m,e[18]=g,e[19]=b,e[20]=u):u=e[20];const w=u;let R;e[21]!==P?(R=Ee("absolute inset-e-3 top-3 z-40 flex flex-col rounded-lg border border-edge bg-[var(--surface-elevated)] px-1.5 py-1 shadow-lg",P),e[21]=P,e[22]=R):R=e[22];let Q;e[23]===Symbol.for("react.memo_cache_sentinel")?(Q=x.jsx(oe,{name:"search",className:"ms-0.5 size-3.5 text-muted-foreground"}),e[23]=Q):Q=e[23];let T;e[24]!==y?(T=B=>y(B.target.value),e[24]=y,e[25]=T):T=e[25];let O;e[26]!==l?(O=l("diffFind.placeholder"),e[26]=l,e[27]=O):O=e[27];let $;e[28]!==l?($=l("diffFind.placeholder"),e[28]=l,e[29]=$):$=e[29];let z;e[30]!==w||e[31]!==i||e[32]!==T||e[33]!==O||e[34]!==$?(z=x.jsx(Re,{ref:E,value:i,onChange:T,onKeyDown:w,placeholder:O,"aria-label":$,className:"h-7 w-40 rounded-md px-2 py-0 text-sm md:w-56"}),e[30]=w,e[31]=i,e[32]=T,e[33]=O,e[34]=$,e[35]=z):z=e[35];let D;e[36]!==h||e[37]!==j||e[38]!==s||e[39]!==l||e[40]!==a?(D=j&&a===0?l("diffFind.noMatches"):a>0?`${h+1}/${a}${s?"+":""}`:"",e[36]=h,e[37]=j,e[38]=s,e[39]=l,e[40]=a,e[41]=D):D=e[41];let r;e[42]!==c||e[43]!==D?(r=x.jsx("span",{className:"min-w-12 px-1 text-center typography-micro text-muted-foreground tabular-nums","aria-live":"polite","aria-label":c,children:D}),e[42]=c,e[43]=D,e[44]=r):r=e[44];let f;e[45]!==l?(f=l("diffFind.previousAria"),e[45]=l,e[46]=f):f=e[46];const v=a===0;let M;e[47]===Symbol.for("react.memo_cache_sentinel")?(M=x.jsx(oe,{name:"arrow-up",className:"size-3.5"}),e[47]=M):M=e[47];let L;e[48]!==b||e[49]!==f||e[50]!==v?(L=x.jsx(ue,{asChild:!0,children:x.jsx("span",{className:"inline-flex",children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:b,"aria-label":f,disabled:v,children:M})})}),e[48]=b,e[49]=f,e[50]=v,e[51]=L):L=e[51];let H;e[52]!==l?(H=l("diffFind.previousAria"),e[52]=l,e[53]=H):H=e[53];let K;e[54]!==H?(K=x.jsx(de,{side:"bottom",sideOffset:6,children:H}),e[54]=H,e[55]=K):K=e[55];let W;e[56]!==L||e[57]!==K?(W=x.jsxs(me,{children:[L,K]}),e[56]=L,e[57]=K,e[58]=W):W=e[58];let U;e[59]!==l?(U=l("diffFind.nextAria"),e[59]=l,e[60]=U):U=e[60];const ce=a===0;let re;e[61]===Symbol.for("react.memo_cache_sentinel")?(re=x.jsx(oe,{name:"arrow-down",className:"size-3.5"}),e[61]=re):re=e[61];let q;e[62]!==g||e[63]!==U||e[64]!==ce?(q=x.jsx(ue,{asChild:!0,children:x.jsx("span",{className:"inline-flex",children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:g,"aria-label":U,disabled:ce,children:re})})}),e[62]=g,e[63]=U,e[64]=ce,e[65]=q):q=e[65];let J;e[66]!==l?(J=l("diffFind.nextAria"),e[66]=l,e[67]=J):J=e[67];let V;e[68]!==J?(V=x.jsx(de,{side:"bottom",sideOffset:6,children:J}),e[68]=J,e[69]=V):V=e[69];let G;e[70]!==q||e[71]!==V?(G=x.jsxs(me,{children:[q,V]}),e[70]=q,e[71]=V,e[72]=G):G=e[72];let X;e[73]!==l?(X=l("diffFind.closeAria"),e[73]=l,e[74]=X):X=e[74];let ie;e[75]===Symbol.for("react.memo_cache_sentinel")?(ie=x.jsx(oe,{name:"close",className:"size-3.5"}),e[75]=ie):ie=e[75];let Y;e[76]!==m||e[77]!==X?(Y=x.jsx(ue,{asChild:!0,children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:m,"aria-label":X,children:ie})}),e[76]=m,e[77]=X,e[78]=Y):Y=e[78];let Z;e[79]!==l?(Z=l("diffFind.closeAria"),e[79]=l,e[80]=Z):Z=e[80];let ee;e[81]!==Z?(ee=x.jsx(de,{side:"bottom",sideOffset:6,children:Z}),e[81]=Z,e[82]=ee):ee=e[82];let te;e[83]!==Y||e[84]!==ee?(te=x.jsxs(me,{children:[Y,ee]}),e[83]=Y,e[84]=ee,e[85]=te):te=e[85];let ne;e[86]!==z||e[87]!==r||e[88]!==W||e[89]!==G||e[90]!==te?(ne=x.jsxs("div",{className:"flex items-center gap-1",children:[Q,z,r,W,G,te]}),e[86]=z,e[87]=r,e[88]=W,e[89]=G,e[90]=te,e[91]=ne):ne=e[91];let se;e[92]!==k||e[93]!==l?(se=k>0&&x.jsx("p",{className:"w-0 min-w-full px-1 pb-0.5 typography-micro text-status-warning",children:l("diffFind.failedCount",{count:k})}),e[92]=k,e[93]=l,e[94]=se):se=e[94];let le;return e[95]!==R||e[96]!==ne||e[97]!==se?(le=x.jsxs("div",{"data-diff-find-bar":"",className:R,children:[ne,se]}),e[95]=R,e[96]=ne,e[97]=se,e[98]=le):le=e[98],le},Ie=/[.*+?^${}()|[\]\\]/g,Me=t=>t.replace(Ie,"\\$&"),Le=t=>t.replace(/\r?\n$/,""),ke=(t,e,i)=>{const y=new RegExp(Me(e),i?"g":"gi"),a=[];for(const h of t.matchAll(y))a.push({spanStart:h.index??0,spanLength:h[0].length});return a},ae=(t,e,i,y,a,h,s)=>{if(y<1)return;const C=Le(a);for(const g of ke(C,h,s))t.push({filePath:e,side:i,lineNumber:y,spanStart:g.spanStart,spanLength:g.spanLength})},Ae=(t,e,i,y)=>{if(i.length===0)return[];const a=y.caseSensitive??!1,h=y.layout==="inline",s=[];for(const C of t.hunks){let g=C.additionStart,b=C.deletionStart;for(const m of C.hunkContent){if(m.type==="context"){for(let d=0;d<m.lines;d+=1)h||ae(s,e,"deletions",b+d,t.deletionLines[m.deletionLineIndex+d],i,a),ae(s,e,"additions",g+d,t.additionLines[m.additionLineIndex+d],i,a);g+=m.lines,b+=m.lines;continue}for(let d=0;d<m.deletions;d+=1)ae(s,e,"deletions",b+d,t.deletionLines[m.deletionLineIndex+d],i,a);b+=m.deletions;for(let d=0;d<m.additions;d+=1)ae(s,e,"additions",g+d,t.additionLines[m.additionLineIndex+d],i,a);g+=m.additions}}return s},Pe=120,He=(t,e)=>t&&e?Fe(t):t,pe=[],xe=(t,e)=>t.filePath===e.filePath&&t.side===e.side&&t.lineNumber===e.lineNumber&&t.spanStart===e.spanStart,ge=(t,e)=>{const i=t.get(e.filePath);return i!==void 0&&i.revision===e.revision},he=(t,e)=>t.has(e.filePath)&&t.get(e.filePath)===e.revision,be=(t,e)=>{const i=[],y=a=>{for(const h of a){const s=e.get(h.filePath);s?.nestedSources&&s.revision===h.revision?y(s.nestedSources):i.push(h)}};return y(t),i},Ke=({sources:t,caseSensitive:e=!1})=>{const[i,y]=n.useState(!1),[a,h]=n.useState(""),[s,C]=n.useState(""),[g,b]=n.useState(0),[m,d]=n.useState(()=>new Map),P=n.useRef(m),[k,l]=n.useState(()=>new Map),E=n.useRef(k),A=n.useRef(t);A.current=t;const N=n.useRef(i);N.current=i;const F=n.useRef(!1),S=n.useRef(null),I=n.useCallback(async()=>{if(!F.current){F.current=!0;try{for(;;){if(!N.current)return;const r=be(A.current,P.current).find(L=>!ge(P.current,L)&&!he(E.current,L));if(!r)return;let f;try{f=await r.load()}catch{const L=new Map(E.current).set(r.filePath,r.revision);E.current=L,l(L);continue}const v=f!==null&&"nestedSources"in f?{revision:r.revision,diff:null,nestedSources:f.nestedSources}:{revision:r.revision,diff:f,nestedSources:null},M=new Map(P.current).set(r.filePath,v);P.current=M,d(M)}}finally{F.current=!1}}},[]);n.useEffect(()=>{i&&I()},[i,I,t]),n.useEffect(()=>{if(a===s)return;const r=window.setTimeout(()=>{C(a),b(0)},Pe);return()=>window.clearTimeout(r)},[s,a]);const j=n.useMemo(()=>be(t,m),[m,t]),p=n.useMemo(()=>{if(!i)return pe;const r=s.trim();if(r.length===0)return pe;const f=[];for(const v of j){const M=m.get(v.filePath)?.diff;M&&f.push(...Ae(M,v.filePath,r,{caseSensitive:e,layout:v.layout}))}return f},[s,e,i,m,j]),_=n.useRef(p);_.current=p;const[o,c]=n.useState({matches:p,query:s});if(o.matches!==p){const r=o.query===s?o.matches[g]:void 0,f=r?p.findIndex(M=>xe(M,r)):-1,v=f>=0?f:p.length===0?0:Math.min(g,p.length-1);c({matches:p,query:s}),v!==g&&b(v)}const u=n.useCallback(r=>{S.current=null,h(r)},[]),w=n.useCallback(()=>{if(!N.current&&E.current.size>0){const r=new Map;E.current=r,l(r)}y(!0)},[]),R=n.useCallback(()=>{S.current=null,w()},[w]),Q=n.useCallback(()=>{S.current=null,y(!1)},[]),T=n.useCallback((r,f)=>{if(h(r),C(r),w(),f){S.current={...f,query:r};return}S.current=null,b(0)},[w]),O=i&&j.some(r=>!ge(m,r)&&!he(k,r)),$=i?j.filter(r=>he(k,r)).length:0;n.useEffect(()=>{const r=S.current;if(!r)return;if(!i||r.query!==s){S.current=null;return}const f=p.findIndex(v=>xe(v,r));if(f>=0){S.current=null,b(p.length===0?0:(f+1)%p.length);return}O||(S.current=null,b(0))},[s,i,O,p]);const z=n.useCallback(()=>{b(r=>{const f=_.current.length;return f===0?0:(r+1)%f})},[]),D=n.useCallback(()=>{b(r=>{const f=_.current.length;return f===0?0:(r-1+f)%f})},[]);return{isOpen:i,open:R,close:Q,query:a,setQuery:u,matches:p,currentIndex:g,currentMatch:p[g]??null,isSearching:O,failedCount:$,next:z,previous:D,openWithQuery:T}},_e=(t,e)=>t instanceof HTMLElement&&!e?.contains(t)&&(t.isContentEditable||t.matches("input, textarea")),Oe=5e3,Te="[data-find-surface]",ye=(t,e)=>{if(!(t instanceof Element))return!1;const i=t.closest(Te);return i!==null&&i!==e},We=({find:t,visible:e,rootRef:i,reveal:y})=>{const{isOpen:a,matches:h,currentMatch:s,currentIndex:C,open:g,close:b,openWithQuery:m}=t,d=n.useRef(new Map),[P,k]=n.useState(0),l=n.useRef(y);l.current=y;const E=n.useMemo(()=>{const o=new Map;for(const c of h){const u=o.get(c.filePath);u?u.push(c):o.set(c.filePath,[c])}return o},[h]),A=n.useRef({isOpen:a,currentMatch:s,matchesByFile:E});A.current={isOpen:a,currentMatch:s,matchesByFile:E};const N=n.useCallback((o,c)=>{const u=A.current,w=u.currentMatch;if(!u.isOpen||!w||w.filePath!==o){c.setFindHighlights([],0);return}const R=u.matchesByFile.get(o)??[];c.setFindHighlights(R,R.indexOf(w))},[]),F=n.useRef(null),S=n.useCallback(()=>{const o=F.current;o?.frame!=null&&window.cancelAnimationFrame(o.frame),F.current=null},[]),I=n.useCallback(o=>{const c=F.current;c?.frame!=null&&window.cancelAnimationFrame(c.frame);const u={match:o,frame:null,deadline:performance.now()+Oe};F.current=u;const w=()=>{if(u.frame=null,F.current!==u)return;if(d.current.get(o.filePath)?.scrollToLine({lineNumber:o.lineNumber,side:o.side,align:"center"})){F.current=null;return}performance.now()<u.deadline&&(u.frame=window.requestAnimationFrame(w))};u.frame=window.requestAnimationFrame(w)},[]);n.useEffect(()=>S,[S]);const j=n.useCallback((o,c)=>{if(!c){d.current.delete(o);return}d.current.set(o,c),A.current.isOpen&&N(o,c);const u=F.current;u&&u.match.filePath===o&&I(u.match)},[N,I]);n.useEffect(()=>{for(const[o,c]of d.current)N(o,c)},[N,s,a,E]);const p=n.useRef(null);n.useEffect(()=>{if(!a||!s){p.current=null,S();return}const o=`${C}:${s.filePath}:${s.side}:${s.lineNumber}:${s.spanStart}`;p.current!==o&&(p.current=o,l.current(s,d.current.has(s.filePath)),I(s))},[S,C,s,a,I]),ve("find_in_file",o=>{if(!e||o.defaultPrevented||_e(document.activeElement,i.current)||ye(o.target,i.current))return!1;g(),k(c=>c+1)}),n.useEffect(()=>{if(!e||!a)return;const o=c=>{if(c.key!=="Escape"||c.defaultPrevented||Se(c))return;const{target:u}=c;if(!(u instanceof Node))return;const w=document.activeElement,R=!w||w===document.body;!i.current?.contains(u)&&!R||ye(u,i.current)||!(u instanceof Element&&u.closest(`[${je}]`)!==null)&&Ne(u)||(c.preventDefault(),c.stopPropagation(),b())};return window.addEventListener("keydown",o,!0),()=>window.removeEventListener("keydown",o,!0)},[b,a,i,e]);const _=n.useCallback((o,c)=>{m(c.word,{filePath:o,side:c.side,lineNumber:c.lineNumber,spanStart:c.spanStart}),k(u=>u+1)},[m]);return{registerViewer:j,openOnWord:_,focusNonce:P}};export{Qe as D,We as a,He as r,Ke as u};
1
+ import{f as we,R as n,j as x}from"./vendor-react--VO_rL_p.js";import{h as Fe}from"./useBranchPullRequestRequest-DMiPjfPQ.js";import{u as Ce,a2 as Ee,da as Se,I as oe,y as Re,af as ue,B as fe,ag as de,ae as me,fU as ve,fV as Ne}from"./useAppFontEffects-BDLOJuy5.js";import"./katex.min-DklPh68d.js";const je="data-diff-find-bar",Qe=t=>{const e=we.c(99),{query:i,onQueryChange:y,total:a,currentIndex:h,isSearching:s,failedCount:C,onNext:g,onPrevious:b,onClose:m,focusNonce:d,className:P}=t,k=C===void 0?0:C,{t:l}=Ce(),E=n.useRef(null);let A,N;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{E.current?.focus()},N=[],e[0]=A,e[1]=N):(A=e[0],N=e[1]),n.useEffect(A,N);let F,S;e[2]!==d?(F=()=>{d&&d>0&&(E.current?.focus(),E.current?.select())},S=[d],e[2]=d,e[3]=F,e[4]=S):(F=e[3],S=e[4]),n.useEffect(F,S);let I;e[5]!==s||e[6]!==i?(I=i.trim().length>0&&!s,e[5]=s,e[6]=i,e[7]=I):I=e[7];const j=I;let p;e[8]!==h||e[9]!==j||e[10]!==l||e[11]!==a?(p=a>0?l("diffFind.countAria",{current:h+1,total:a}):j?l("diffFind.noMatches"):void 0,e[8]=h,e[9]=j,e[10]=l,e[11]=a,e[12]=p):p=e[12];const _=p;let o;e[13]!==s||e[14]!==_||e[15]!==l?(o=s?[_,l("diffFind.searchingAria")].filter(Boolean).join(", "):_,e[13]=s,e[14]=_,e[15]=l,e[16]=o):o=e[16];const c=o;let u;e[17]!==m||e[18]!==g||e[19]!==b?(u=B=>{Se(B)||(B.key==="Enter"?(B.preventDefault(),B.shiftKey?b():g()):B.key==="Escape"&&(B.preventDefault(),m()))},e[17]=m,e[18]=g,e[19]=b,e[20]=u):u=e[20];const w=u;let R;e[21]!==P?(R=Ee("absolute inset-e-3 top-3 z-40 flex flex-col rounded-lg border border-edge bg-[var(--surface-elevated)] px-1.5 py-1 shadow-lg",P),e[21]=P,e[22]=R):R=e[22];let Q;e[23]===Symbol.for("react.memo_cache_sentinel")?(Q=x.jsx(oe,{name:"search",className:"ms-0.5 size-3.5 text-muted-foreground"}),e[23]=Q):Q=e[23];let T;e[24]!==y?(T=B=>y(B.target.value),e[24]=y,e[25]=T):T=e[25];let O;e[26]!==l?(O=l("diffFind.placeholder"),e[26]=l,e[27]=O):O=e[27];let $;e[28]!==l?($=l("diffFind.placeholder"),e[28]=l,e[29]=$):$=e[29];let z;e[30]!==w||e[31]!==i||e[32]!==T||e[33]!==O||e[34]!==$?(z=x.jsx(Re,{ref:E,value:i,onChange:T,onKeyDown:w,placeholder:O,"aria-label":$,className:"h-7 w-40 rounded-md px-2 py-0 text-sm md:w-56"}),e[30]=w,e[31]=i,e[32]=T,e[33]=O,e[34]=$,e[35]=z):z=e[35];let D;e[36]!==h||e[37]!==j||e[38]!==s||e[39]!==l||e[40]!==a?(D=j&&a===0?l("diffFind.noMatches"):a>0?`${h+1}/${a}${s?"+":""}`:"",e[36]=h,e[37]=j,e[38]=s,e[39]=l,e[40]=a,e[41]=D):D=e[41];let r;e[42]!==c||e[43]!==D?(r=x.jsx("span",{className:"min-w-12 px-1 text-center typography-micro text-muted-foreground tabular-nums","aria-live":"polite","aria-label":c,children:D}),e[42]=c,e[43]=D,e[44]=r):r=e[44];let f;e[45]!==l?(f=l("diffFind.previousAria"),e[45]=l,e[46]=f):f=e[46];const v=a===0;let M;e[47]===Symbol.for("react.memo_cache_sentinel")?(M=x.jsx(oe,{name:"arrow-up",className:"size-3.5"}),e[47]=M):M=e[47];let L;e[48]!==b||e[49]!==f||e[50]!==v?(L=x.jsx(ue,{asChild:!0,children:x.jsx("span",{className:"inline-flex",children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:b,"aria-label":f,disabled:v,children:M})})}),e[48]=b,e[49]=f,e[50]=v,e[51]=L):L=e[51];let H;e[52]!==l?(H=l("diffFind.previousAria"),e[52]=l,e[53]=H):H=e[53];let K;e[54]!==H?(K=x.jsx(de,{side:"bottom",sideOffset:6,children:H}),e[54]=H,e[55]=K):K=e[55];let W;e[56]!==L||e[57]!==K?(W=x.jsxs(me,{children:[L,K]}),e[56]=L,e[57]=K,e[58]=W):W=e[58];let U;e[59]!==l?(U=l("diffFind.nextAria"),e[59]=l,e[60]=U):U=e[60];const ce=a===0;let re;e[61]===Symbol.for("react.memo_cache_sentinel")?(re=x.jsx(oe,{name:"arrow-down",className:"size-3.5"}),e[61]=re):re=e[61];let q;e[62]!==g||e[63]!==U||e[64]!==ce?(q=x.jsx(ue,{asChild:!0,children:x.jsx("span",{className:"inline-flex",children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:g,"aria-label":U,disabled:ce,children:re})})}),e[62]=g,e[63]=U,e[64]=ce,e[65]=q):q=e[65];let J;e[66]!==l?(J=l("diffFind.nextAria"),e[66]=l,e[67]=J):J=e[67];let V;e[68]!==J?(V=x.jsx(de,{side:"bottom",sideOffset:6,children:J}),e[68]=J,e[69]=V):V=e[69];let G;e[70]!==q||e[71]!==V?(G=x.jsxs(me,{children:[q,V]}),e[70]=q,e[71]=V,e[72]=G):G=e[72];let X;e[73]!==l?(X=l("diffFind.closeAria"),e[73]=l,e[74]=X):X=e[74];let ie;e[75]===Symbol.for("react.memo_cache_sentinel")?(ie=x.jsx(oe,{name:"close",className:"size-3.5"}),e[75]=ie):ie=e[75];let Y;e[76]!==m||e[77]!==X?(Y=x.jsx(ue,{asChild:!0,children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:m,"aria-label":X,children:ie})}),e[76]=m,e[77]=X,e[78]=Y):Y=e[78];let Z;e[79]!==l?(Z=l("diffFind.closeAria"),e[79]=l,e[80]=Z):Z=e[80];let ee;e[81]!==Z?(ee=x.jsx(de,{side:"bottom",sideOffset:6,children:Z}),e[81]=Z,e[82]=ee):ee=e[82];let te;e[83]!==Y||e[84]!==ee?(te=x.jsxs(me,{children:[Y,ee]}),e[83]=Y,e[84]=ee,e[85]=te):te=e[85];let ne;e[86]!==z||e[87]!==r||e[88]!==W||e[89]!==G||e[90]!==te?(ne=x.jsxs("div",{className:"flex items-center gap-1",children:[Q,z,r,W,G,te]}),e[86]=z,e[87]=r,e[88]=W,e[89]=G,e[90]=te,e[91]=ne):ne=e[91];let se;e[92]!==k||e[93]!==l?(se=k>0&&x.jsx("p",{className:"w-0 min-w-full px-1 pb-0.5 typography-micro text-status-warning",children:l("diffFind.failedCount",{count:k})}),e[92]=k,e[93]=l,e[94]=se):se=e[94];let le;return e[95]!==R||e[96]!==ne||e[97]!==se?(le=x.jsxs("div",{"data-diff-find-bar":"",className:R,children:[ne,se]}),e[95]=R,e[96]=ne,e[97]=se,e[98]=le):le=e[98],le},Ie=/[.*+?^${}()|[\]\\]/g,Me=t=>t.replace(Ie,"\\$&"),Le=t=>t.replace(/\r?\n$/,""),ke=(t,e,i)=>{const y=new RegExp(Me(e),i?"g":"gi"),a=[];for(const h of t.matchAll(y))a.push({spanStart:h.index??0,spanLength:h[0].length});return a},ae=(t,e,i,y,a,h,s)=>{if(y<1)return;const C=Le(a);for(const g of ke(C,h,s))t.push({filePath:e,side:i,lineNumber:y,spanStart:g.spanStart,spanLength:g.spanLength})},Ae=(t,e,i,y)=>{if(i.length===0)return[];const a=y.caseSensitive??!1,h=y.layout==="inline",s=[];for(const C of t.hunks){let g=C.additionStart,b=C.deletionStart;for(const m of C.hunkContent){if(m.type==="context"){for(let d=0;d<m.lines;d+=1)h||ae(s,e,"deletions",b+d,t.deletionLines[m.deletionLineIndex+d],i,a),ae(s,e,"additions",g+d,t.additionLines[m.additionLineIndex+d],i,a);g+=m.lines,b+=m.lines;continue}for(let d=0;d<m.deletions;d+=1)ae(s,e,"deletions",b+d,t.deletionLines[m.deletionLineIndex+d],i,a);b+=m.deletions;for(let d=0;d<m.additions;d+=1)ae(s,e,"additions",g+d,t.additionLines[m.additionLineIndex+d],i,a);g+=m.additions}}return s},Pe=120,He=(t,e)=>t&&e?Fe(t):t,pe=[],xe=(t,e)=>t.filePath===e.filePath&&t.side===e.side&&t.lineNumber===e.lineNumber&&t.spanStart===e.spanStart,ge=(t,e)=>{const i=t.get(e.filePath);return i!==void 0&&i.revision===e.revision},he=(t,e)=>t.has(e.filePath)&&t.get(e.filePath)===e.revision,be=(t,e)=>{const i=[],y=a=>{for(const h of a){const s=e.get(h.filePath);s?.nestedSources&&s.revision===h.revision?y(s.nestedSources):i.push(h)}};return y(t),i},Ke=({sources:t,caseSensitive:e=!1})=>{const[i,y]=n.useState(!1),[a,h]=n.useState(""),[s,C]=n.useState(""),[g,b]=n.useState(0),[m,d]=n.useState(()=>new Map),P=n.useRef(m),[k,l]=n.useState(()=>new Map),E=n.useRef(k),A=n.useRef(t);A.current=t;const N=n.useRef(i);N.current=i;const F=n.useRef(!1),S=n.useRef(null),I=n.useCallback(async()=>{if(!F.current){F.current=!0;try{for(;;){if(!N.current)return;const r=be(A.current,P.current).find(L=>!ge(P.current,L)&&!he(E.current,L));if(!r)return;let f;try{f=await r.load()}catch{const L=new Map(E.current).set(r.filePath,r.revision);E.current=L,l(L);continue}const v=f!==null&&"nestedSources"in f?{revision:r.revision,diff:null,nestedSources:f.nestedSources}:{revision:r.revision,diff:f,nestedSources:null},M=new Map(P.current).set(r.filePath,v);P.current=M,d(M)}}finally{F.current=!1}}},[]);n.useEffect(()=>{i&&I()},[i,I,t]),n.useEffect(()=>{if(a===s)return;const r=window.setTimeout(()=>{C(a),b(0)},Pe);return()=>window.clearTimeout(r)},[s,a]);const j=n.useMemo(()=>be(t,m),[m,t]),p=n.useMemo(()=>{if(!i)return pe;const r=s.trim();if(r.length===0)return pe;const f=[];for(const v of j){const M=m.get(v.filePath)?.diff;M&&f.push(...Ae(M,v.filePath,r,{caseSensitive:e,layout:v.layout}))}return f},[s,e,i,m,j]),_=n.useRef(p);_.current=p;const[o,c]=n.useState({matches:p,query:s});if(o.matches!==p){const r=o.query===s?o.matches[g]:void 0,f=r?p.findIndex(M=>xe(M,r)):-1,v=f>=0?f:p.length===0?0:Math.min(g,p.length-1);c({matches:p,query:s}),v!==g&&b(v)}const u=n.useCallback(r=>{S.current=null,h(r)},[]),w=n.useCallback(()=>{if(!N.current&&E.current.size>0){const r=new Map;E.current=r,l(r)}y(!0)},[]),R=n.useCallback(()=>{S.current=null,w()},[w]),Q=n.useCallback(()=>{S.current=null,y(!1)},[]),T=n.useCallback((r,f)=>{if(h(r),C(r),w(),f){S.current={...f,query:r};return}S.current=null,b(0)},[w]),O=i&&j.some(r=>!ge(m,r)&&!he(k,r)),$=i?j.filter(r=>he(k,r)).length:0;n.useEffect(()=>{const r=S.current;if(!r)return;if(!i||r.query!==s){S.current=null;return}const f=p.findIndex(v=>xe(v,r));if(f>=0){S.current=null,b(p.length===0?0:(f+1)%p.length);return}O||(S.current=null,b(0))},[s,i,O,p]);const z=n.useCallback(()=>{b(r=>{const f=_.current.length;return f===0?0:(r+1)%f})},[]),D=n.useCallback(()=>{b(r=>{const f=_.current.length;return f===0?0:(r-1+f)%f})},[]);return{isOpen:i,open:R,close:Q,query:a,setQuery:u,matches:p,currentIndex:g,currentMatch:p[g]??null,isSearching:O,failedCount:$,next:z,previous:D,openWithQuery:T}},_e=(t,e)=>t instanceof HTMLElement&&!e?.contains(t)&&(t.isContentEditable||t.matches("input, textarea")),Oe=5e3,Te="[data-find-surface]",ye=(t,e)=>{if(!(t instanceof Element))return!1;const i=t.closest(Te);return i!==null&&i!==e},We=({find:t,visible:e,rootRef:i,reveal:y})=>{const{isOpen:a,matches:h,currentMatch:s,currentIndex:C,open:g,close:b,openWithQuery:m}=t,d=n.useRef(new Map),[P,k]=n.useState(0),l=n.useRef(y);l.current=y;const E=n.useMemo(()=>{const o=new Map;for(const c of h){const u=o.get(c.filePath);u?u.push(c):o.set(c.filePath,[c])}return o},[h]),A=n.useRef({isOpen:a,currentMatch:s,matchesByFile:E});A.current={isOpen:a,currentMatch:s,matchesByFile:E};const N=n.useCallback((o,c)=>{const u=A.current,w=u.currentMatch;if(!u.isOpen||!w||w.filePath!==o){c.setFindHighlights([],0);return}const R=u.matchesByFile.get(o)??[];c.setFindHighlights(R,R.indexOf(w))},[]),F=n.useRef(null),S=n.useCallback(()=>{const o=F.current;o?.frame!=null&&window.cancelAnimationFrame(o.frame),F.current=null},[]),I=n.useCallback(o=>{const c=F.current;c?.frame!=null&&window.cancelAnimationFrame(c.frame);const u={match:o,frame:null,deadline:performance.now()+Oe};F.current=u;const w=()=>{if(u.frame=null,F.current!==u)return;if(d.current.get(o.filePath)?.scrollToLine({lineNumber:o.lineNumber,side:o.side,align:"center"})){F.current=null;return}performance.now()<u.deadline&&(u.frame=window.requestAnimationFrame(w))};u.frame=window.requestAnimationFrame(w)},[]);n.useEffect(()=>S,[S]);const j=n.useCallback((o,c)=>{if(!c){d.current.delete(o);return}d.current.set(o,c),A.current.isOpen&&N(o,c);const u=F.current;u&&u.match.filePath===o&&I(u.match)},[N,I]);n.useEffect(()=>{for(const[o,c]of d.current)N(o,c)},[N,s,a,E]);const p=n.useRef(null);n.useEffect(()=>{if(!a||!s){p.current=null,S();return}const o=`${C}:${s.filePath}:${s.side}:${s.lineNumber}:${s.spanStart}`;p.current!==o&&(p.current=o,l.current(s,d.current.has(s.filePath)),I(s))},[S,C,s,a,I]),ve("find_in_file",o=>{if(!e||o.defaultPrevented||_e(document.activeElement,i.current)||ye(o.target,i.current))return!1;g(),k(c=>c+1)}),n.useEffect(()=>{if(!e||!a)return;const o=c=>{if(c.key!=="Escape"||c.defaultPrevented||Se(c))return;const{target:u}=c;if(!(u instanceof Node))return;const w=document.activeElement,R=!w||w===document.body;!i.current?.contains(u)&&!R||ye(u,i.current)||!(u instanceof Element&&u.closest(`[${je}]`)!==null)&&Ne(u)||(c.preventDefault(),c.stopPropagation(),b())};return window.addEventListener("keydown",o,!0),()=>window.removeEventListener("keydown",o,!0)},[b,a,i,e]);const _=n.useCallback((o,c)=>{m(c.word,{filePath:o,side:c.side,lineNumber:c.lineNumber,spanStart:c.spanStart}),k(u=>u+1)},[m]);return{registerViewer:j,openOnWord:_,focusNonce:P}};export{Qe as D,We as a,He as r,Ke as u};
@@ -1,2 +1,2 @@
1
- import{R as v,f as be,j as t}from"./vendor-react--VO_rL_p.js";import{u as Pt}from"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import{hB as Ot,hc as Ft,u as xe,P as nt,ae as at,af as ot,I as G,a2 as le,ag as lt,fb as Mt,fj as Lt,K as $t,aU as we,B as ae,hC as Ht,hD as Gt,cp as _t,hE as Bt,t as Oe,q as Fe,D as Me,l as Le,F as $e,o as it,hF as Kt,a0 as rt,f1 as ct,n as dt,hG as Ut,ch as qt,A as ge,C as Wt,bS as wt,bT as vt,hH as Re,hI as jt,cs as Be,hJ as Nt,hK as Ct,hL as Xt,hM as St,hN as Ke,hO as kt,hP as Vt,hQ as Yt,hR as Zt,hS as At,hT as Jt,hU as Qt,hV as es,hW as Tt,hX as It,fE as Ye,aW as ut,aX as mt,aY as ft,aZ as ht,a_ as pt,hY as ts,hZ as ss,h_ as is,h$ as ns,i0 as as,cr as He,i1 as Et,i2 as os,x as gt,i3 as ls,i4 as rs}from"./useAppFontEffects-CpxtKEGw.js";import{u as Ue,b6 as Dt,b7 as cs,W as qe}from"./katex.min-B3YMLLh4.js";import{a as xt,C as ds,b as us,c as ms,f as fs,T as Ze}from"./useBranchPullRequestRequest-DVy6rEsu.js";import{a6 as hs,a4 as ps,a5 as gs,aI as xs}from"./ReceivedPagePanel-CCDFxXT4.js";const ys=500,bs=10;let Se=null;const Pe=()=>{Se&&window.clearTimeout(Se.timer),Se=null},zt=l=>({onPointerDown:e=>{if(Pe(),e.pointerType==="mouse"||e.target instanceof Element&&e.target.closest("button, a, input"))return;Se={timer:window.setTimeout(()=>{Se=null,Ot(),l()},ys),x:e.clientX,y:e.clientY}},onPointerMove:e=>{Se&&Math.hypot(e.clientX-Se.x,e.clientY-Se.y)>bs&&Pe()},onPointerUp:Pe,onPointerCancel:Pe,onPointerLeave:Pe,onContextMenu:e=>e.preventDefault()}),ws=l=>{const e=be.c(4),{insertions:s,deletions:n,hideZero:h}=l,f=h===void 0?false:h;let u;return e[0]!==n||e[1]!==f||e[2]!==s?(u=t.jsx(Lt,{added:s,removed:n,hideZero:f,className:"typography-micro"}),e[0]=n,e[1]=f,e[2]=s,e[3]=u):u=e[3],u},vs=v.memo(function(e){const s=be.c(71),{file:n,actionLabel:h,actionSymbol:f,onAction:u,onViewDiff:c,onRevert:p,isReverting:r,stats:k,rowPaddingClassName:y,indentPx:m,actionAtStart:j,nameOnly:b,showRevert:O}=e,A=m===void 0?0:m,w=j===void 0?false:j,o=b===void 0?false:b,g=O===void 0?true:O;let L;s[0]!==n?(L=Ft(n),s[0]=n,s[1]=L):L=s[1];const C=L,{t:E}=xe(),{isMobile:z}=nt();let ee;s[2]!==C.descriptionKey||s[3]!==E?(ee=E(C.descriptionKey),s[2]=C.descriptionKey,s[3]=E,s[4]=ee):ee=s[4];const Y=ee,_=k?.insertions??0,R=k?.deletions??0;let V;s[5]!==u||s[6]!==c?(V=K=>{K.key===" "?(K.preventDefault(),u()):K.key==="Enter"&&(K.preventDefault(),c())},s[5]=u,s[6]=c,s[7]=V):V=s[7];const N=V;let P;s[8]!==u?(P=K=>{K.preventDefault(),K.stopPropagation(),u()},s[8]=u,s[9]=P):P=s[9];const S=P;let I;s[10]!==p?(I=K=>{K.preventDefault(),K.stopPropagation(),p()},s[10]=p,s[11]=I):I=s[11];const $=I,W=f==="+"?"contextTooltips.git.stageFile":"contextTooltips.git.unstageFile";let H;s[12]!==E||s[13]!==W?(H=E(W),s[12]=E,s[13]=W,s[14]=H):H=s[14];let Z;s[15]!==h||s[16]!==f||s[17]!==S||s[18]!==H?(Z=t.jsx("button",{type:"button",onClick:S,className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":h,"data-row-tooltip":H,children:f}),s[15]=h,s[16]=f,s[17]=S,s[18]=H,s[19]=Z):Z=s[19];const U=Z;let B;s[20]!==R||s[21]!==_||s[22]!==z?(B=t.jsx(ws,{insertions:_,deletions:R,hideZero:z}),s[20]=R,s[21]=_,s[22]=z,s[23]=B):B=s[23];const F=B;let M;s[24]!==n.path||s[25]!==$||s[26]!==z||s[27]!==r||s[28]!==g||s[29]!==E?(M=g?t.jsxs(at,{children:[t.jsx(ot,{asChild:true,children:t.jsx("button",{type:"button",onClick:$,disabled:r,className:le(z?"sr-only":"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"),"aria-label":E("gitView.changes.revertFileAria",{path:n.path}),children:r?t.jsx(G,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(G,{name:"arrow-go-back",className:"size-3.5"})})}),t.jsx(lt,{sideOffset:8,children:E("gitView.changes.revertFileTooltip")})]}):null,s[24]=n.path,s[25]=$,s[26]=z,s[27]=r,s[28]=g,s[29]=E,s[30]=M):M=s[30];const J=M,se=y??"px-3",ie=z?"min-h-11 select-none rounded-md active:bg-interactive-hover":"py-1.5";let Q;s[31]!==se||s[32]!==ie?(Q=le("group flex items-center gap-2 cursor-pointer",se,ie),s[31]=se,s[32]=ie,s[33]=Q):Q=s[33];let te;s[34]!==z||s[35]!==r||s[36]!==p||s[37]!==g?(te=z&&g&&!r?zt(p):null,s[34]=z,s[35]=r,s[36]=p,s[37]=g,s[38]=te):te=s[38];let a;s[39]!==A?(a=A>0?{paddingInlineStart:`${A}px`}:void 0,s[39]=A,s[40]=a):a=s[40];const d=w?U:null;let i;s[41]!==C.color?(i={color:C.color},s[41]=C.color,s[42]=i):i=s[42];let x;s[43]!==C.code||s[44]!==Y||s[45]!==i?(x=t.jsx("span",{className:"typography-micro font-semibold w-4 text-center uppercase",style:i,title:Y,"aria-label":Y,children:C.code}),s[43]=C.code,s[44]=Y,s[45]=i,s[46]=x):x=s[46];let T;s[47]!==n.path?(T=t.jsx(Mt,{filePath:n.path,className:"h-3.5 w-3.5 shrink-0"}),s[47]=n.path,s[48]=T):T=s[48];let D;s[49]!==n.path||s[50]!==n.previousPath||s[51]!==z||s[52]!==o?(D=o?t.jsxs("span",{className:"oc-ui-start-align flex-1 min-w-0 truncate typography-ui-label",style:{direction:"rtl",unicodeBidi:"plaintext"},title:n.previousPath?`${n.previousPath} \u2192 ${n.path}`:n.path,children:[n.previousPath?t.jsxs("span",{className:"text-muted-foreground",children:[xt(n.previousPath)," \u2192 "]}):null,t.jsx("span",{className:"text-foreground",children:xt(n.path)})]}):t.jsx(ds,{path:n.path,from:n.previousPath,nameFirst:z,className:"flex-1 typography-ui-label"}),s[49]=n.path,s[50]=n.previousPath,s[51]=z,s[52]=o,s[53]=D):D=s[53];let q;s[54]!==w||s[55]!==U||s[56]!==r||s[57]!==J||s[58]!==F?(q=w?t.jsxs(t.Fragment,{children:[F,J]}):t.jsxs("span",{className:"flex shrink-0 items-center justify-items-end gap-2 md:grid",children:[t.jsx("span",{className:le("md:col-start-1 md:row-start-1",r?"md:invisible":"md:group-hover:invisible md:group-focus-within:invisible"),children:F}),t.jsxs("span",{className:le("flex items-center gap-2 md:col-start-1 md:row-start-1",!r&&"md:invisible md:group-hover:visible md:group-focus-within:visible"),children:[J,U]})]}),s[54]=w,s[55]=U,s[56]=r,s[57]=J,s[58]=F,s[59]=q):q=s[59];let X;return s[60]!==N||s[61]!==c||s[62]!==Q||s[63]!==te||s[64]!==a||s[65]!==d||s[66]!==x||s[67]!==T||s[68]!==D||s[69]!==q?(X=t.jsxs("div",{className:Q,role:"button",tabIndex:0,onClick:c,onKeyDown:N,...te,style:a,children:[d,x,T,D,q]}),s[60]=N,s[61]=c,s[62]=Q,s[63]=te,s[64]=a,s[65]=d,s[66]=x,s[67]=T,s[68]=D,s[69]=q,s[70]=X):X=s[70],X}),js=1e3,yt=34,Je=30,Ge="ps-0 pe-2",Qe=(l,e)=>`${l} ${e}`,Ys=({groups:l,diffStats:e,revertingPaths:s,isRevertingAll:n=false,headerBackgroundClassName:h="bg-sidebar",scrollSurface:f,onVisiblePathsChange:u,onRevertAll:c,onRevertDirectory:p})=>{const{t:r}=xe(),{isMobile:k}=nt(),y=v.useRef(null),j=Ue(a=>a.gitChangesViewMode)==="tree",b=v.useMemo(()=>l.filter(a=>a.entries.length>0),[l]),[O,A]=v.useState(new Set),[w,o]=v.useState(new Set),[g,L]=v.useState(false),[C,E]=v.useState(null),z=$t(),{confirm:ee}=z,Y=v.useCallback(async(a,d)=>{await ee({title:r("gitView.changes.revertFileDialogTitle"),message:r("gitView.changes.revertFileDescription",{path:d}),action:r("gitView.changes.revertFileConfirm"),destructive:true})&&a.onRevertFile(d)},[ee,r]),_=v.useMemo(()=>b.map(a=>us(a.entries)),[b]),R=v.useMemo(()=>{const a=[];return b.forEach((d,i)=>{Array.from(_[i]?.children.values()??[]).forEach(x=>{a.push(Qe(d.id,ms(x).node.path))})}),a},[_,b]);v.useEffect(()=>{j&&o(a=>{const d=new Set,i=new Set(R);return a.forEach(x=>{(x.slice(x.indexOf(" ")+1).includes("/")||i.has(x))&&d.add(x)}),R.forEach(x=>d.add(x)),d})},[j,R]);const V=v.useMemo(()=>{const a=[];return b.forEach((d,i)=>{if(a.push({type:"header",key:`header:${d.id}`,groupIndex:i}),!O.has(d.id)){if(j){const x=new Set;w.forEach(D=>{D.startsWith(`${d.id} `)&&x.add(D.slice(d.id.length+1))}),fs(_[i],x).forEach(D=>{D.kind==="file"?a.push({type:"file",key:`${d.id}:${D.key}`,groupIndex:i,file:D.file,depth:D.depth}):a.push({type:"directory",key:`${d.id}:${D.key}`,groupIndex:i,directory:D.directory,label:D.label,depth:D.depth})});return}d.entries.forEach(x=>{a.push({type:"file",key:`${d.id}:file:${x.path}`,groupIndex:i,file:x,depth:0})})}}),c&&b.length>0&&a.push({type:"revert-all",key:"revert-all"}),a},[O,w,j,c,_,b]),N=V.length,P=N>=js,S=Pt({count:N,enabled:P,getScrollElement:()=>y.current,estimateSize:()=>yt,overscan:12,getItemKey:a=>V[a]?.key??a}),I=S.getVirtualItems(),$=v.useMemo(()=>{if(!P)return 0;const a=y.current?.scrollTop??0;return I.find(i=>i.end>a)?.index??0},[P,I,y]);v.useEffect(()=>{if(!u)return;const a=d=>d&&d.type==="file"?d.file.path:null;if(N===0){u([]);return}if(!P){const d=[];for(const i of V)if(i.type==="file"&&(d.push(i.file.path),d.length>=Je))break;u(d);return}u(V.slice($,$+Math.ceil((y.current?.clientHeight??0)/yt)+Je).map(d=>a(d)).filter(d=>!!d).slice(0,Je))},[u,N,V,P,$]);const W=v.useCallback(a=>{A(d=>{const i=new Set(d);return i.has(a)?i.delete(a):i.add(a),i})},[]),H=v.useCallback((a,d)=>{o(i=>{const x=new Set(i),T=Qe(a,d);return x.has(T)?x.delete(T):x.add(T),x})},[]),Z=v.useMemo(()=>{const a=new Set;return b.forEach(d=>d.entries.forEach(i=>a.add(i.path))),Array.from(a)},[b]),U=Z.length,B=C?n||C.paths.some(a=>s.has(a)):false,F=v.useCallback(async()=>{!c||n||Z.length===0||(await c(Z),L(false))},[Z,n,c]),M=v.useCallback(async()=>{!p||!C||B||(await p(C.paths),E(null))},[B,p,C]),J=v.useCallback((a,d)=>{const i=O.has(a.id),x=a.entries.length;return t.jsxs("div",{className:le("sticky top-0 z-10 flex items-center gap-2 py-2",h,Ge,!d&&"mt-1 border-t border-edge-muted"),children:[t.jsx(we,{sideOffset:8,label:a.actionAllLabel,className:"shrink-0",children:t.jsx("button",{type:"button",onClick:()=>a.onActionAll(a.entries.map(T=>T.path)),className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":a.actionAllLabel,children:a.actionSymbol})}),t.jsxs("button",{type:"button",onClick:()=>W(a.id),className:"flex min-w-0 flex-1 items-center gap-2 rounded text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-expanded":!i,children:[t.jsx("h3",{className:"truncate typography-ui-header font-semibold text-foreground",children:a.title}),t.jsx("span",{className:"typography-meta text-muted-foreground",children:x}),t.jsx(G,{name:"arrow-down-s",className:le("size-3.5 shrink-0 text-muted-foreground transition-transform",i&&"-rotate-90 rtl:rotate-90")})]})]})},[O,h,W]),se=v.useCallback((a,d,i,x)=>{const T=w.has(Qe(a.id,d.path)),D=d.files.map(X=>X.path),q=n||D.some(X=>s.has(X));return t.jsxs("div",{className:le("group flex items-center gap-2 text-muted-foreground hover:text-foreground",k?"min-h-11 select-none":"py-1.5",Ge),style:{paddingInlineStart:`${x*Ze}px`},...k&&a.showRevertActions!==false&&p&&!q?zt(()=>E({path:d.path,paths:D,count:D.length})):null,children:[t.jsxs("button",{type:"button",onClick:()=>H(a.id,d.path),"aria-expanded":T,className:"flex min-w-0 flex-1 items-center gap-1.5 rounded text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":T?r("gitView.changes.collapseDirectoryAria",{path:d.path}):r("gitView.changes.expandDirectoryAria",{path:d.path}),children:[t.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center",children:t.jsx(G,{name:"arrow-right-s",className:le("size-3.5 transition-transform",T&&"rotate-90 rtl:-rotate-90")})}),t.jsx("span",{className:"min-w-0 truncate typography-ui-label",title:d.path,children:i}),T?null:t.jsx("span",{className:"shrink-0 typography-micro tabular-nums text-muted-foreground",children:d.files.length})]}),t.jsxs("span",{className:le("flex shrink-0 items-center gap-2 transition-opacity",!q&&"md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100"),children:[a.showRevertActions!==false&&p?t.jsx("button",{type:"button",onClick:()=>E({path:d.path,paths:D,count:D.length}),disabled:q,className:k?"sr-only":"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50","aria-label":r("gitView.changes.revertDirectoryAria",{path:d.path}),"data-row-tooltip":r("gitView.changes.revertDirectoryTooltip"),children:q?t.jsx(G,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(G,{name:"arrow-go-back",className:"size-3.5"})}):null,t.jsx("button",{type:"button",onClick:()=>a.onActionAll(d.files.map(X=>X.path)),className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":r(a.actionSymbol==="+"?"gitView.changes.stageDirectoryAria":"gitView.changes.unstageDirectoryAria",{path:d.path}),"data-row-tooltip":r(a.actionSymbol==="+"?"contextTooltips.git.stageFolder":"contextTooltips.git.unstageFolder"),children:a.actionSymbol})]})]})},[w,k,n,p,s,r,H]),ie=v.useCallback((a,d)=>{if(a.type==="revert-all")return t.jsx("div",{className:le("flex justify-end py-2",Ge),children:t.jsx(we,{sideOffset:8,label:r("contextTooltips.git.discardAll"),children:t.jsxs(ae,{variant:"ghost",size:"sm",onClick:()=>L(true),disabled:n,className:"gap-1.5 text-[var(--status-error)] hover:bg-[var(--status-error)]/10 hover:text-[var(--status-error)]",children:[t.jsx(G,{name:"arrow-go-back",className:"size-3.5"}),r("gitView.changes.revertAll")]})})});const i=b[a.groupIndex];if(!i)return null;if(a.type==="header")return J(i,d);if(a.type==="directory")return se(i,a.directory,a.label,a.depth);const x=a.file;return t.jsx(vs,{file:x,actionLabel:i.getActionLabel(x.path),actionSymbol:i.actionSymbol,onAction:()=>i.onActionFile(x.path),stats:e?.[i.statsScope]?.[x.path],onViewDiff:()=>i.onViewDiff(x.path),onRevert:()=>{Y(i,x.path)},isReverting:s.has(x.path)||n,rowPaddingClassName:Ge,indentPx:a.depth*Ze,actionAtStart:!j,nameOnly:j,showRevert:i.showRevertActions!==false})},[e,n,j,se,J,Y,s,r,b]),Q=a=>a.type!=="file"&&a.type!=="directory"?null:Array.from({length:a.depth},(d,i)=>t.jsx("span",{"aria-hidden":true,className:"pointer-events-none absolute inset-y-0 w-px bg-edge",style:{insetInlineStart:`${i*Ze+8}px`}},i)),te=v.useCallback(a=>{if(j||k)return false;const d=V[a],i=V[a-1];return!d||!i||d.type!=="file"&&d.type!=="directory"||i.type!=="file"&&i.type!=="directory"?false:i.groupIndex===d.groupIndex},[k,j,V]);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden",children:[t.jsx(Ht,{ref:y,surface:f,className:"overlay-scrollbar-target overlay-scrollbar-container min-h-0 w-full flex-1 overflow-x-hidden overflow-y-auto",children:P?t.jsx("div",{style:{height:S.getTotalSize(),position:"relative"},children:I.map(a=>{const d=V[a.index];return d?t.jsxs("div",{"data-index":a.index,ref:S.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${a.start}px)`},className:le(te(a.index)&&"before:pointer-events-none before:absolute before:inset-s-0 before:inset-e-2 before:top-0 before:border-t before:border-edge"),children:[Q(d),ie(d,a.index===0)]},d.key):null})}):t.jsx("div",{role:"list","aria-label":r("gitView.changes.changedFilesAria"),children:V.map((a,d)=>t.jsxs("div",{className:le("relative",te(d)&&"before:pointer-events-none before:absolute before:inset-s-0 before:inset-e-2 before:top-0 before:border-t before:border-edge"),children:[Q(a),ie(a,d===0)]},a.key))})}),f?t.jsx(Gt,{surface:f}):null,t.jsx(_t,{containerRef:y,disableHorizontal:true}),t.jsx(Bt,{containerRef:y,sideOffset:8})]}),z.dialog,t.jsx(Oe,{open:g,onOpenChange:a=>{!n&&!a&&L(false)},children:t.jsxs(Fe,{className:"max-w-md",children:[t.jsxs(Me,{children:[t.jsx(Le,{children:r("gitView.changes.revertAllDialogTitle")}),t.jsx($e,{children:U===1?r("gitView.changes.revertAllDescriptionSingle",{count:U}):r("gitView.changes.revertAllDescriptionPlural",{count:U})})]}),t.jsxs(it,{children:[t.jsx(ae,{variant:"outline",size:"sm",onClick:()=>L(false),disabled:n,children:r("gitView.common.cancel")}),t.jsx(ae,{variant:"destructive",size:"sm",onClick:()=>{F()},disabled:n,children:r(n?"gitView.changes.reverting":"gitView.changes.revertAll")})]})]})}),t.jsx(Oe,{open:!!C,onOpenChange:a=>{!B&&!a&&E(null)},children:t.jsxs(Fe,{className:"max-w-md",children:[t.jsxs(Me,{children:[t.jsx(Le,{children:r("gitView.changes.revertDirectoryDialogTitle")}),t.jsx($e,{children:C?C.count===1?r("gitView.changes.revertDirectoryDescriptionSingle",{count:C.count,path:C.path}):r("gitView.changes.revertDirectoryDescriptionPlural",{count:C.count,path:C.path}):null})]}),t.jsxs(it,{children:[t.jsx(ae,{variant:"outline",size:"sm",onClick:()=>E(null),disabled:B,children:r("gitView.common.cancel")}),t.jsx(ae,{variant:"destructive",size:"sm",onClick:()=>{M()},disabled:B||!C,children:r(B?"gitView.changes.reverting":"gitView.changes.revertDirectory")})]})]})})]})},et=38,_e=200,Ns=l=>{const e=be.c(26),{value:s,onChange:n,onSubmit:h,placeholder:f,disabled:u,hasTouchInput:c,isMobile:p}=l,r=u===void 0?false:u,k=c===void 0?false:c,y=p===void 0?false:p,{t:m}=xe(),j=v.useRef(null),b=Kt(j),O=Ue(Cs);let A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{const N=j.current;if(!N)return;const P=document.activeElement===N,S=()=>{N.style.height=`${et}px`;const $=N.scrollHeight,W=Math.min(Math.max($,et),_e);N.style.height=`${W}px`,N.style.overflowY=$>_e?"auto":"hidden",$>_e&&!P&&(N.scrollTop=N.scrollHeight)};S();const I=window.requestAnimationFrame(S);return()=>{window.cancelAnimationFrame(I)}},e[0]=A):A=e[0];let w;e[1]!==s?(w=[s],e[1]=s,e[2]=w):w=e[2],v.useLayoutEffect(A,w);let o;e[3]!==n?(o=N=>n(N.target.value),e[3]=n,e[4]=o):o=e[4];let g;e[5]!==h?(g=N=>{N.key==="Enter"&&(N.metaKey||N.ctrlKey)&&!N.shiftKey&&!N.altKey&&(N.preventDefault(),h?.())},e[5]=h,e[6]=g):g=e[6];let L;e[7]!==f||e[8]!==m?(L=f??m("gitView.commit.messagePlaceholder"),e[7]=f,e[8]=m,e[9]=L):L=e[9];const C=k?"on":"off",E=k?"sentences":"off",z=y||O,ee=r&&"opacity-50";let Y;e[10]!==ee?(Y=le("oc-raised oc-field w-full rounded-lg bg-surface-elevated px-3 py-2 typography-ui-label text-foreground placeholder:text-muted-foreground","resize-none outline-none",ee),e[10]=ee,e[11]=Y):Y=e[11];let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_={minHeight:et,maxHeight:_e},e[12]=_):_=e[12];let R;e[13]!==r||e[14]!==E||e[15]!==z||e[16]!==Y||e[17]!==o||e[18]!==g||e[19]!==L||e[20]!==C||e[21]!==s?(R=t.jsx("textarea",{ref:j,value:s,onChange:o,onKeyDown:g,placeholder:L,rows:1,disabled:r,autoCorrect:C,autoCapitalize:E,spellCheck:z,className:Y,style:_}),e[13]=r,e[14]=E,e[15]=z,e[16]=Y,e[17]=o,e[18]=g,e[19]=L,e[20]=C,e[21]=s,e[22]=R):R=e[22];let V;return e[23]!==b||e[24]!==R?(V=t.jsxs(t.Fragment,{children:[R,b]}),e[23]=b,e[24]=R,e[25]=V):V=e[25],V};function Cs(l){return l.inputSpellcheckEnabled}const Ss=l=>{const e=be.c(30),{highlights:s,onInsert:n}=l,{t:h}=xe();if(s.length===0)return null;let f;e[0]!==s||e[1]!==n?(f=()=>{n(s)},e[0]=s,e[1]=n,e[2]=f):f=e[2];const u=f;let c;e[3]!==h?(c=h("gitView.commit.aiHighlights.title"),e[3]=h,e[4]=c):c=e[4];let p;e[5]!==c?(p=t.jsx("p",{className:"typography-micro text-muted-foreground",children:c}),e[5]=c,e[6]=p):p=e[6];let r;e[7]!==h?(r=h("gitView.commit.aiHighlights.insertAria"),e[7]=h,e[8]=r):r=e[8];let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(G,{name:"arrow-down",className:"size-4"}),e[9]=k):k=e[9];let y;e[10]!==u||e[11]!==r?(y=t.jsx(ot,{asChild:true,children:t.jsx(ae,{variant:"ghost",size:"icon",className:"size-6",onClick:u,"aria-label":r,children:k})}),e[10]=u,e[11]=r,e[12]=y):y=e[12];let m;e[13]!==h?(m=h("gitView.commit.aiHighlights.insertTooltip"),e[13]=h,e[14]=m):m=e[14];let j;e[15]!==m?(j=t.jsx(lt,{sideOffset:8,children:m}),e[15]=m,e[16]=j):j=e[16];let b;e[17]!==y||e[18]!==j?(b=t.jsxs(at,{children:[y,j]}),e[17]=y,e[18]=j,e[19]=b):b=e[19];let O;e[20]!==p||e[21]!==b?(O=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p,b]}),e[20]=p,e[21]=b,e[22]=O):O=e[22];let A;e[23]!==s?(A=s.map(ks),e[23]=s,e[24]=A):A=e[24];let w;e[25]!==A?(w=t.jsx("ul",{className:"space-y-1",children:A}),e[25]=A,e[26]=w):w=e[26];let o;return e[27]!==O||e[28]!==w?(o=t.jsxs("div",{className:"space-y-2 rounded-xl oc-tile px-3 py-2",children:[O,w]}),e[27]=O,e[28]=w,e[29]=o):o=e[29],o};function ks(l,e){return t.jsx("li",{className:"typography-meta text-foreground",children:l},`${l}-${e}`)}const Zs=l=>{const e=be.c(113),{stagedCount:s,commitMessage:n,onCommitMessageChange:h,generatedHighlights:f,onInsertHighlights:u,onGenerateMessage:c,isGeneratingMessage:p,onCommit:r,onCommitAndPush:k,commitAction:y,networkOperationBlocked:m,hasPendingIndexMutation:j,gitmojiEnabled:b,onOpenGitmojiPicker:O}=l,A=m===void 0?false:m,w=j===void 0?false:j,{t:o}=xe(),g=s>0;let L;e[0]!==y||e[1]!==n||e[2]!==w||e[3]!==g?(L=n.trim()&&g&&y===null&&!w,e[0]=y,e[1]=n,e[2]=w,e[3]=g,e[4]=L):L=e[4];const C=L,{isMobile:E,hasTouchInput:z}=nt(),[ee,Y]=v.useState(false);let _;e[5]!==n||e[6]!==g||e[7]!==o?(_=g?n.trim()?null:o("contextTooltips.git.writeMessageFirst"):o("contextTooltips.git.stageFilesFirst"),e[5]=n,e[6]=g,e[7]=o,e[8]=_):_=e[8];const R=_;if(E&&!ee&&!g&&!n.trim()&&f.length===0){let oe;e[9]!==o?(oe=o("gitView.commit.title"),e[9]=o,e[10]=oe):oe=e[10];let me;e[11]!==oe?(me=t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:oe}),e[11]=oe,e[12]=me):me=e[12];let fe;e[13]!==o?(fe=o("gitView.commit.stageFilesHint"),e[13]=o,e[14]=fe):fe=e[14];let he;e[15]!==fe?(he=t.jsx("span",{className:"min-w-0 truncate typography-meta text-muted-foreground",children:fe}),e[15]=fe,e[16]=he):he=e[16];let ve;return e[17]!==me||e[18]!==he?(ve=t.jsxs("section",{className:"flex items-baseline gap-2",children:[me,he]}),e[17]=me,e[18]=he,e[19]=ve):ve=e[19],ve}let V,N;e[20]===Symbol.for("react.memo_cache_sentinel")?(V=()=>Y(true),N=oe=>{oe.currentTarget.contains(oe.relatedTarget)||Y(false)},e[20]=V,e[21]=N):(V=e[20],N=e[21]);let P;e[22]!==o?(P=o("gitView.commit.title"),e[22]=o,e[23]=P):P=e[23];let S;e[24]!==P?(S=t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:P}),e[24]=P,e[25]=S):S=e[25];let I;e[26]!==g||e[27]!==o?(I=g?null:t.jsx("span",{className:"min-w-0 truncate typography-meta text-muted-foreground",children:o("gitView.commit.stageFilesHint")}),e[26]=g,e[27]=o,e[28]=I):I=e[28];let $;e[29]!==S||e[30]!==I?($=t.jsxs("div",{className:"flex w-full items-baseline gap-2 px-0 pt-2 pb-1",children:[S,I]}),e[29]=S,e[30]=I,e[31]=$):$=e[31];let W;e[32]!==f||e[33]!==u?(W=t.jsx(Ss,{highlights:f,onInsert:u}),e[32]=f,e[33]=u,e[34]=W):W=e[34];let H;e[35]!==C||e[36]!==p||e[37]!==r?(H=()=>{C&&!p&&r()},e[35]=C,e[36]=p,e[37]=r,e[38]=H):H=e[38];let Z;e[39]!==o?(Z=o("gitView.commit.messagePlaceholder"),e[39]=o,e[40]=Z):Z=e[40];const U=y!==null;let B;e[41]!==n||e[42]!==z||e[43]!==E||e[44]!==h||e[45]!==H||e[46]!==Z||e[47]!==U?(B=t.jsx(Ns,{value:n,onChange:h,onSubmit:H,placeholder:Z,disabled:U,hasTouchInput:z,isMobile:E}),e[41]=n,e[42]=z,e[43]=E,e[44]=h,e[45]=H,e[46]=Z,e[47]=U,e[48]=B):B=e[48];let F;e[49]!==b||e[50]!==O||e[51]!==o?(F=b&&t.jsx(we,{sideOffset:8,label:o("contextTooltips.git.addGitmoji"),className:"w-fit",children:t.jsxs(ae,{variant:"outline",size:"sm",onClick:O,className:"w-fit",type:"button",children:[t.jsx(G,{name:"emotion-happy",className:"size-4"}),o("gitView.commit.addGitmoji")]})}),e[49]=b,e[50]=O,e[51]=o,e[52]=F):F=e[52];let M;e[53]!==g||e[54]!==o?(M=o(g?"gitView.commit.generateAria":"contextTooltips.git.stageFilesFirst"),e[53]=g,e[54]=o,e[55]=M):M=e[55];const J=p||y!==null||w||s===0;let se;e[56]!==o?(se=o("gitView.commit.generateAria"),e[56]=o,e[57]=se):se=e[57];let ie;e[58]!==p?(ie=p?t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(G,{name:"ai-generate-2",className:"size-4 text-primary"}),e[58]=p,e[59]=ie):ie=e[59];let Q;e[60]!==o?(Q=o("gitView.commit.generate"),e[60]=o,e[61]=Q):Q=e[61];let te;e[62]!==Q?(te=t.jsx("span",{className:"commit-actions__label",children:Q}),e[62]=Q,e[63]=te):te=e[63];let a;e[64]!==c||e[65]!==J||e[66]!==se||e[67]!==ie||e[68]!==te?(a=t.jsxs(ae,{variant:"outline",size:"sm",onClick:c,disabled:J,type:"button","aria-label":se,className:"commit-actions__btn",children:[ie,te]}),e[64]=c,e[65]=J,e[66]=se,e[67]=ie,e[68]=te,e[69]=a):a=e[69];let d;e[70]!==M||e[71]!==a?(d=t.jsx(we,{sideOffset:8,label:M,children:a}),e[70]=M,e[71]=a,e[72]=d):d=e[72];let i;e[73]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1"}),e[73]=i):i=e[73];let x;e[74]!==R||e[75]!==o?(x=R??o("contextTooltips.git.commit"),e[74]=R,e[75]=o,e[76]=x):x=e[76];let T;e[77]!==r?(T=oe=>r(oe.currentTarget),e[77]=r,e[78]=T):T=e[78];const D=!C||p;let q;e[79]!==o?(q=o("gitView.commit.commitAria"),e[79]=o,e[80]=q):q=e[80];let X;e[81]!==y||e[82]!==o?(X=y==="commit"?t.jsxs(t.Fragment,{children:[t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label",children:o("gitView.commit.committing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(G,{name:"git-commit",className:"size-4"}),t.jsx("span",{className:"commit-actions__label",children:o("gitView.commit.commit")})]}),e[81]=y,e[82]=o,e[83]=X):X=e[83];let K;e[84]!==T||e[85]!==D||e[86]!==q||e[87]!==X?(K=t.jsx(ae,{size:"sm",variant:"outline",onClick:T,disabled:D,className:"commit-actions__btn whitespace-nowrap","aria-label":q,children:X}),e[84]=T,e[85]=D,e[86]=q,e[87]=X,e[88]=K):K=e[88];let re;e[89]!==x||e[90]!==K?(re=t.jsx(we,{sideOffset:8,label:x,children:K}),e[89]=x,e[90]=K,e[91]=re):re=e[91];let ce;e[92]!==C||e[93]!==y||e[94]!==R||e[95]!==p||e[96]!==E||e[97]!==A||e[98]!==k||e[99]!==o?(ce=E?t.jsxs(at,{children:[t.jsx(ot,{asChild:true,children:t.jsx(ae,{variant:"default",size:"sm",onClick:oe=>k(oe.currentTarget),disabled:!C||p||A,className:"h-7 w-7 p-0","aria-label":o("gitView.commit.pushAria"),children:y==="commitAndPush"?t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(G,{name:"arrow-up",className:"size-3.5"})})}),t.jsx(lt,{side:"top",children:t.jsx("p",{children:o("gitView.commit.push")})})]}):t.jsx(we,{sideOffset:8,label:R??o("contextTooltips.git.commitAndSync"),children:t.jsx(ae,{size:"sm",variant:"default",onClick:oe=>k(oe.currentTarget),disabled:!C||p||A,className:"commit-actions__btn","aria-label":o("gitView.commit.pushAria"),children:y==="commitAndPush"?t.jsxs(t.Fragment,{children:[t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:o("gitView.commit.pushing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(G,{name:"arrow-up",className:"size-3.5"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:o("gitView.commit.push")})]})})}),e[92]=C,e[93]=y,e[94]=R,e[95]=p,e[96]=E,e[97]=A,e[98]=k,e[99]=o,e[100]=ce):ce=e[100];let de;e[101]!==d||e[102]!==re||e[103]!==ce?(de=t.jsxs("div",{className:"@container/commit-actions flex items-center gap-2 min-w-0",children:[d,i,re,ce]}),e[101]=d,e[102]=re,e[103]=ce,e[104]=de):de=e[104];let ue;e[105]!==W||e[106]!==B||e[107]!==F||e[108]!==de?(ue=t.jsxs("div",{className:"flex flex-col gap-3 px-0 pt-1 pb-3",children:[W,B,F,de]}),e[105]=W,e[106]=B,e[107]=F,e[108]=de,e[109]=ue):ue=e[109];let ye;return e[110]!==$||e[111]!==ue?(ye=t.jsxs("section",{className:"border-0 bg-transparent rounded-none",onFocus:V,onBlur:N,children:[$,ue]}),e[110]=$,e[111]=ue,e[112]=ye):ye=e[112],ye},Js=l=>{const e=be.c(153),{open:s,onOpenChange:n,conflictFiles:h,directory:f,operation:u,onAbort:c,onClearState:p,onNavigatedToChat:r}=l;let k;e[0]!==h?(k=h===void 0?[]:h,e[0]=h,e[1]=k):k=e[1];const y=k,{t:m}=xe(),j=rt(Vs),b=rt(As),O=ct(Ts),A=ct(Is),[w,o]=v.useState(false),[g,L]=v.useState(null),[C,E]=v.useState(null);let z,ee;e[2]!==f||e[3]!==s||e[4]!==m?(z=()=>{!s||!f||(o(true),E(null),L(null),Ut(f).then(ne=>{L(ne)}).catch(ne=>{const pe=ne instanceof Error?ne.message:m("gitView.conflict.loadFailed");E(pe)}).finally(()=>{o(false)}))},ee=[s,f,m],e[2]=f,e[3]=s,e[4]=m,e[5]=z,e[6]=ee):(z=e[5],ee=e[6]),v.useEffect(z,ee);let Y;e[7]!==g||e[8]!==f||e[9]!==u?(Y=async()=>{if(!g)return null;const ne=u==="merge"?"merge":"rebase",pe=g.headInfo||(u==="merge"?"MERGE_HEAD":"REBASE_HEAD"),ke=u==="merge"?"git commit --no-edit":"git rebase --continue",Ve=await qt(f),je=Ve.render("git.conflict.resolve.visible",{operation_label:ne,head_ref:pe}),Ne=Ve.render("git.conflict.resolve.instructions",{operation_label:ne,directory:f,operation:u,head_info:g.headInfo||"N/A",continue_cmd:ke}),Ce=`${ne} conflict context (JSON)
1
+ import{R as v,f as be,j as t}from"./vendor-react--VO_rL_p.js";import{u as Pt}from"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import{hB as Ot,hc as Ft,u as xe,P as nt,ae as at,af as ot,I as G,a2 as le,ag as lt,fb as Mt,fj as Lt,K as $t,aU as we,B as ae,hC as Ht,hD as Gt,cp as _t,hE as Bt,t as Oe,q as Fe,D as Me,l as Le,F as $e,o as it,hF as Kt,a0 as rt,f1 as ct,n as dt,hG as Ut,ch as qt,A as ge,C as Wt,bS as wt,bT as vt,hH as Re,hI as jt,cs as Be,hJ as Nt,hK as Ct,hL as Xt,hM as St,hN as Ke,hO as kt,hP as Vt,hQ as Yt,hR as Zt,hS as At,hT as Jt,hU as Qt,hV as es,hW as Tt,hX as It,fE as Ye,aW as ut,aX as mt,aY as ft,aZ as ht,a_ as pt,hY as ts,hZ as ss,h_ as is,h$ as ns,i0 as as,cr as He,i1 as Et,i2 as os,x as gt,i3 as ls,i4 as rs}from"./useAppFontEffects-BDLOJuy5.js";import{u as Ue,b6 as Dt,b7 as cs,W as qe}from"./katex.min-DklPh68d.js";import{a as xt,C as ds,b as us,c as ms,f as fs,T as Ze}from"./useBranchPullRequestRequest-DMiPjfPQ.js";import{a6 as hs,a4 as ps,a5 as gs,aI as xs}from"./ReceivedPagePanel-CfXyzCii.js";const ys=500,bs=10;let Se=null;const Pe=()=>{Se&&window.clearTimeout(Se.timer),Se=null},zt=l=>({onPointerDown:e=>{if(Pe(),e.pointerType==="mouse"||e.target instanceof Element&&e.target.closest("button, a, input"))return;Se={timer:window.setTimeout(()=>{Se=null,Ot(),l()},ys),x:e.clientX,y:e.clientY}},onPointerMove:e=>{Se&&Math.hypot(e.clientX-Se.x,e.clientY-Se.y)>bs&&Pe()},onPointerUp:Pe,onPointerCancel:Pe,onPointerLeave:Pe,onContextMenu:e=>e.preventDefault()}),ws=l=>{const e=be.c(4),{insertions:s,deletions:n,hideZero:h}=l,f=h===void 0?false:h;let u;return e[0]!==n||e[1]!==f||e[2]!==s?(u=t.jsx(Lt,{added:s,removed:n,hideZero:f,className:"typography-micro"}),e[0]=n,e[1]=f,e[2]=s,e[3]=u):u=e[3],u},vs=v.memo(function(e){const s=be.c(71),{file:n,actionLabel:h,actionSymbol:f,onAction:u,onViewDiff:c,onRevert:p,isReverting:r,stats:k,rowPaddingClassName:y,indentPx:m,actionAtStart:j,nameOnly:b,showRevert:O}=e,A=m===void 0?0:m,w=j===void 0?false:j,o=b===void 0?false:b,g=O===void 0?true:O;let L;s[0]!==n?(L=Ft(n),s[0]=n,s[1]=L):L=s[1];const C=L,{t:E}=xe(),{isMobile:z}=nt();let ee;s[2]!==C.descriptionKey||s[3]!==E?(ee=E(C.descriptionKey),s[2]=C.descriptionKey,s[3]=E,s[4]=ee):ee=s[4];const Y=ee,_=k?.insertions??0,R=k?.deletions??0;let V;s[5]!==u||s[6]!==c?(V=K=>{K.key===" "?(K.preventDefault(),u()):K.key==="Enter"&&(K.preventDefault(),c())},s[5]=u,s[6]=c,s[7]=V):V=s[7];const N=V;let P;s[8]!==u?(P=K=>{K.preventDefault(),K.stopPropagation(),u()},s[8]=u,s[9]=P):P=s[9];const S=P;let I;s[10]!==p?(I=K=>{K.preventDefault(),K.stopPropagation(),p()},s[10]=p,s[11]=I):I=s[11];const $=I,W=f==="+"?"contextTooltips.git.stageFile":"contextTooltips.git.unstageFile";let H;s[12]!==E||s[13]!==W?(H=E(W),s[12]=E,s[13]=W,s[14]=H):H=s[14];let Z;s[15]!==h||s[16]!==f||s[17]!==S||s[18]!==H?(Z=t.jsx("button",{type:"button",onClick:S,className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":h,"data-row-tooltip":H,children:f}),s[15]=h,s[16]=f,s[17]=S,s[18]=H,s[19]=Z):Z=s[19];const U=Z;let B;s[20]!==R||s[21]!==_||s[22]!==z?(B=t.jsx(ws,{insertions:_,deletions:R,hideZero:z}),s[20]=R,s[21]=_,s[22]=z,s[23]=B):B=s[23];const F=B;let M;s[24]!==n.path||s[25]!==$||s[26]!==z||s[27]!==r||s[28]!==g||s[29]!==E?(M=g?t.jsxs(at,{children:[t.jsx(ot,{asChild:true,children:t.jsx("button",{type:"button",onClick:$,disabled:r,className:le(z?"sr-only":"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"),"aria-label":E("gitView.changes.revertFileAria",{path:n.path}),children:r?t.jsx(G,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(G,{name:"arrow-go-back",className:"size-3.5"})})}),t.jsx(lt,{sideOffset:8,children:E("gitView.changes.revertFileTooltip")})]}):null,s[24]=n.path,s[25]=$,s[26]=z,s[27]=r,s[28]=g,s[29]=E,s[30]=M):M=s[30];const J=M,se=y??"px-3",ie=z?"min-h-11 select-none rounded-md active:bg-interactive-hover":"py-1.5";let Q;s[31]!==se||s[32]!==ie?(Q=le("group flex items-center gap-2 cursor-pointer",se,ie),s[31]=se,s[32]=ie,s[33]=Q):Q=s[33];let te;s[34]!==z||s[35]!==r||s[36]!==p||s[37]!==g?(te=z&&g&&!r?zt(p):null,s[34]=z,s[35]=r,s[36]=p,s[37]=g,s[38]=te):te=s[38];let a;s[39]!==A?(a=A>0?{paddingInlineStart:`${A}px`}:void 0,s[39]=A,s[40]=a):a=s[40];const d=w?U:null;let i;s[41]!==C.color?(i={color:C.color},s[41]=C.color,s[42]=i):i=s[42];let x;s[43]!==C.code||s[44]!==Y||s[45]!==i?(x=t.jsx("span",{className:"typography-micro font-semibold w-4 text-center uppercase",style:i,title:Y,"aria-label":Y,children:C.code}),s[43]=C.code,s[44]=Y,s[45]=i,s[46]=x):x=s[46];let T;s[47]!==n.path?(T=t.jsx(Mt,{filePath:n.path,className:"h-3.5 w-3.5 shrink-0"}),s[47]=n.path,s[48]=T):T=s[48];let D;s[49]!==n.path||s[50]!==n.previousPath||s[51]!==z||s[52]!==o?(D=o?t.jsxs("span",{className:"oc-ui-start-align flex-1 min-w-0 truncate typography-ui-label",style:{direction:"rtl",unicodeBidi:"plaintext"},title:n.previousPath?`${n.previousPath} \u2192 ${n.path}`:n.path,children:[n.previousPath?t.jsxs("span",{className:"text-muted-foreground",children:[xt(n.previousPath)," \u2192 "]}):null,t.jsx("span",{className:"text-foreground",children:xt(n.path)})]}):t.jsx(ds,{path:n.path,from:n.previousPath,nameFirst:z,className:"flex-1 typography-ui-label"}),s[49]=n.path,s[50]=n.previousPath,s[51]=z,s[52]=o,s[53]=D):D=s[53];let q;s[54]!==w||s[55]!==U||s[56]!==r||s[57]!==J||s[58]!==F?(q=w?t.jsxs(t.Fragment,{children:[F,J]}):t.jsxs("span",{className:"flex shrink-0 items-center justify-items-end gap-2 md:grid",children:[t.jsx("span",{className:le("md:col-start-1 md:row-start-1",r?"md:invisible":"md:group-hover:invisible md:group-focus-within:invisible"),children:F}),t.jsxs("span",{className:le("flex items-center gap-2 md:col-start-1 md:row-start-1",!r&&"md:invisible md:group-hover:visible md:group-focus-within:visible"),children:[J,U]})]}),s[54]=w,s[55]=U,s[56]=r,s[57]=J,s[58]=F,s[59]=q):q=s[59];let X;return s[60]!==N||s[61]!==c||s[62]!==Q||s[63]!==te||s[64]!==a||s[65]!==d||s[66]!==x||s[67]!==T||s[68]!==D||s[69]!==q?(X=t.jsxs("div",{className:Q,role:"button",tabIndex:0,onClick:c,onKeyDown:N,...te,style:a,children:[d,x,T,D,q]}),s[60]=N,s[61]=c,s[62]=Q,s[63]=te,s[64]=a,s[65]=d,s[66]=x,s[67]=T,s[68]=D,s[69]=q,s[70]=X):X=s[70],X}),js=1e3,yt=34,Je=30,Ge="ps-0 pe-2",Qe=(l,e)=>`${l} ${e}`,Ys=({groups:l,diffStats:e,revertingPaths:s,isRevertingAll:n=false,headerBackgroundClassName:h="bg-sidebar",scrollSurface:f,onVisiblePathsChange:u,onRevertAll:c,onRevertDirectory:p})=>{const{t:r}=xe(),{isMobile:k}=nt(),y=v.useRef(null),j=Ue(a=>a.gitChangesViewMode)==="tree",b=v.useMemo(()=>l.filter(a=>a.entries.length>0),[l]),[O,A]=v.useState(new Set),[w,o]=v.useState(new Set),[g,L]=v.useState(false),[C,E]=v.useState(null),z=$t(),{confirm:ee}=z,Y=v.useCallback(async(a,d)=>{await ee({title:r("gitView.changes.revertFileDialogTitle"),message:r("gitView.changes.revertFileDescription",{path:d}),action:r("gitView.changes.revertFileConfirm"),destructive:true})&&a.onRevertFile(d)},[ee,r]),_=v.useMemo(()=>b.map(a=>us(a.entries)),[b]),R=v.useMemo(()=>{const a=[];return b.forEach((d,i)=>{Array.from(_[i]?.children.values()??[]).forEach(x=>{a.push(Qe(d.id,ms(x).node.path))})}),a},[_,b]);v.useEffect(()=>{j&&o(a=>{const d=new Set,i=new Set(R);return a.forEach(x=>{(x.slice(x.indexOf(" ")+1).includes("/")||i.has(x))&&d.add(x)}),R.forEach(x=>d.add(x)),d})},[j,R]);const V=v.useMemo(()=>{const a=[];return b.forEach((d,i)=>{if(a.push({type:"header",key:`header:${d.id}`,groupIndex:i}),!O.has(d.id)){if(j){const x=new Set;w.forEach(D=>{D.startsWith(`${d.id} `)&&x.add(D.slice(d.id.length+1))}),fs(_[i],x).forEach(D=>{D.kind==="file"?a.push({type:"file",key:`${d.id}:${D.key}`,groupIndex:i,file:D.file,depth:D.depth}):a.push({type:"directory",key:`${d.id}:${D.key}`,groupIndex:i,directory:D.directory,label:D.label,depth:D.depth})});return}d.entries.forEach(x=>{a.push({type:"file",key:`${d.id}:file:${x.path}`,groupIndex:i,file:x,depth:0})})}}),c&&b.length>0&&a.push({type:"revert-all",key:"revert-all"}),a},[O,w,j,c,_,b]),N=V.length,P=N>=js,S=Pt({count:N,enabled:P,getScrollElement:()=>y.current,estimateSize:()=>yt,overscan:12,getItemKey:a=>V[a]?.key??a}),I=S.getVirtualItems(),$=v.useMemo(()=>{if(!P)return 0;const a=y.current?.scrollTop??0;return I.find(i=>i.end>a)?.index??0},[P,I,y]);v.useEffect(()=>{if(!u)return;const a=d=>d&&d.type==="file"?d.file.path:null;if(N===0){u([]);return}if(!P){const d=[];for(const i of V)if(i.type==="file"&&(d.push(i.file.path),d.length>=Je))break;u(d);return}u(V.slice($,$+Math.ceil((y.current?.clientHeight??0)/yt)+Je).map(d=>a(d)).filter(d=>!!d).slice(0,Je))},[u,N,V,P,$]);const W=v.useCallback(a=>{A(d=>{const i=new Set(d);return i.has(a)?i.delete(a):i.add(a),i})},[]),H=v.useCallback((a,d)=>{o(i=>{const x=new Set(i),T=Qe(a,d);return x.has(T)?x.delete(T):x.add(T),x})},[]),Z=v.useMemo(()=>{const a=new Set;return b.forEach(d=>d.entries.forEach(i=>a.add(i.path))),Array.from(a)},[b]),U=Z.length,B=C?n||C.paths.some(a=>s.has(a)):false,F=v.useCallback(async()=>{!c||n||Z.length===0||(await c(Z),L(false))},[Z,n,c]),M=v.useCallback(async()=>{!p||!C||B||(await p(C.paths),E(null))},[B,p,C]),J=v.useCallback((a,d)=>{const i=O.has(a.id),x=a.entries.length;return t.jsxs("div",{className:le("sticky top-0 z-10 flex items-center gap-2 py-2",h,Ge,!d&&"mt-1 border-t border-edge-muted"),children:[t.jsx(we,{sideOffset:8,label:a.actionAllLabel,className:"shrink-0",children:t.jsx("button",{type:"button",onClick:()=>a.onActionAll(a.entries.map(T=>T.path)),className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":a.actionAllLabel,children:a.actionSymbol})}),t.jsxs("button",{type:"button",onClick:()=>W(a.id),className:"flex min-w-0 flex-1 items-center gap-2 rounded text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-expanded":!i,children:[t.jsx("h3",{className:"truncate typography-ui-header font-semibold text-foreground",children:a.title}),t.jsx("span",{className:"typography-meta text-muted-foreground",children:x}),t.jsx(G,{name:"arrow-down-s",className:le("size-3.5 shrink-0 text-muted-foreground transition-transform",i&&"-rotate-90 rtl:rotate-90")})]})]})},[O,h,W]),se=v.useCallback((a,d,i,x)=>{const T=w.has(Qe(a.id,d.path)),D=d.files.map(X=>X.path),q=n||D.some(X=>s.has(X));return t.jsxs("div",{className:le("group flex items-center gap-2 text-muted-foreground hover:text-foreground",k?"min-h-11 select-none":"py-1.5",Ge),style:{paddingInlineStart:`${x*Ze}px`},...k&&a.showRevertActions!==false&&p&&!q?zt(()=>E({path:d.path,paths:D,count:D.length})):null,children:[t.jsxs("button",{type:"button",onClick:()=>H(a.id,d.path),"aria-expanded":T,className:"flex min-w-0 flex-1 items-center gap-1.5 rounded text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":T?r("gitView.changes.collapseDirectoryAria",{path:d.path}):r("gitView.changes.expandDirectoryAria",{path:d.path}),children:[t.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center",children:t.jsx(G,{name:"arrow-right-s",className:le("size-3.5 transition-transform",T&&"rotate-90 rtl:-rotate-90")})}),t.jsx("span",{className:"min-w-0 truncate typography-ui-label",title:d.path,children:i}),T?null:t.jsx("span",{className:"shrink-0 typography-micro tabular-nums text-muted-foreground",children:d.files.length})]}),t.jsxs("span",{className:le("flex shrink-0 items-center gap-2 transition-opacity",!q&&"md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100"),children:[a.showRevertActions!==false&&p?t.jsx("button",{type:"button",onClick:()=>E({path:d.path,paths:D,count:D.length}),disabled:q,className:k?"sr-only":"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50","aria-label":r("gitView.changes.revertDirectoryAria",{path:d.path}),"data-row-tooltip":r("gitView.changes.revertDirectoryTooltip"),children:q?t.jsx(G,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(G,{name:"arrow-go-back",className:"size-3.5"})}):null,t.jsx("button",{type:"button",onClick:()=>a.onActionAll(d.files.map(X=>X.path)),className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":r(a.actionSymbol==="+"?"gitView.changes.stageDirectoryAria":"gitView.changes.unstageDirectoryAria",{path:d.path}),"data-row-tooltip":r(a.actionSymbol==="+"?"contextTooltips.git.stageFolder":"contextTooltips.git.unstageFolder"),children:a.actionSymbol})]})]})},[w,k,n,p,s,r,H]),ie=v.useCallback((a,d)=>{if(a.type==="revert-all")return t.jsx("div",{className:le("flex justify-end py-2",Ge),children:t.jsx(we,{sideOffset:8,label:r("contextTooltips.git.discardAll"),children:t.jsxs(ae,{variant:"ghost",size:"sm",onClick:()=>L(true),disabled:n,className:"gap-1.5 text-[var(--status-error)] hover:bg-[var(--status-error)]/10 hover:text-[var(--status-error)]",children:[t.jsx(G,{name:"arrow-go-back",className:"size-3.5"}),r("gitView.changes.revertAll")]})})});const i=b[a.groupIndex];if(!i)return null;if(a.type==="header")return J(i,d);if(a.type==="directory")return se(i,a.directory,a.label,a.depth);const x=a.file;return t.jsx(vs,{file:x,actionLabel:i.getActionLabel(x.path),actionSymbol:i.actionSymbol,onAction:()=>i.onActionFile(x.path),stats:e?.[i.statsScope]?.[x.path],onViewDiff:()=>i.onViewDiff(x.path),onRevert:()=>{Y(i,x.path)},isReverting:s.has(x.path)||n,rowPaddingClassName:Ge,indentPx:a.depth*Ze,actionAtStart:!j,nameOnly:j,showRevert:i.showRevertActions!==false})},[e,n,j,se,J,Y,s,r,b]),Q=a=>a.type!=="file"&&a.type!=="directory"?null:Array.from({length:a.depth},(d,i)=>t.jsx("span",{"aria-hidden":true,className:"pointer-events-none absolute inset-y-0 w-px bg-edge",style:{insetInlineStart:`${i*Ze+8}px`}},i)),te=v.useCallback(a=>{if(j||k)return false;const d=V[a],i=V[a-1];return!d||!i||d.type!=="file"&&d.type!=="directory"||i.type!=="file"&&i.type!=="directory"?false:i.groupIndex===d.groupIndex},[k,j,V]);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden",children:[t.jsx(Ht,{ref:y,surface:f,className:"overlay-scrollbar-target overlay-scrollbar-container min-h-0 w-full flex-1 overflow-x-hidden overflow-y-auto",children:P?t.jsx("div",{style:{height:S.getTotalSize(),position:"relative"},children:I.map(a=>{const d=V[a.index];return d?t.jsxs("div",{"data-index":a.index,ref:S.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${a.start}px)`},className:le(te(a.index)&&"before:pointer-events-none before:absolute before:inset-s-0 before:inset-e-2 before:top-0 before:border-t before:border-edge"),children:[Q(d),ie(d,a.index===0)]},d.key):null})}):t.jsx("div",{role:"list","aria-label":r("gitView.changes.changedFilesAria"),children:V.map((a,d)=>t.jsxs("div",{className:le("relative",te(d)&&"before:pointer-events-none before:absolute before:inset-s-0 before:inset-e-2 before:top-0 before:border-t before:border-edge"),children:[Q(a),ie(a,d===0)]},a.key))})}),f?t.jsx(Gt,{surface:f}):null,t.jsx(_t,{containerRef:y,disableHorizontal:true}),t.jsx(Bt,{containerRef:y,sideOffset:8})]}),z.dialog,t.jsx(Oe,{open:g,onOpenChange:a=>{!n&&!a&&L(false)},children:t.jsxs(Fe,{className:"max-w-md",children:[t.jsxs(Me,{children:[t.jsx(Le,{children:r("gitView.changes.revertAllDialogTitle")}),t.jsx($e,{children:U===1?r("gitView.changes.revertAllDescriptionSingle",{count:U}):r("gitView.changes.revertAllDescriptionPlural",{count:U})})]}),t.jsxs(it,{children:[t.jsx(ae,{variant:"outline",size:"sm",onClick:()=>L(false),disabled:n,children:r("gitView.common.cancel")}),t.jsx(ae,{variant:"destructive",size:"sm",onClick:()=>{F()},disabled:n,children:r(n?"gitView.changes.reverting":"gitView.changes.revertAll")})]})]})}),t.jsx(Oe,{open:!!C,onOpenChange:a=>{!B&&!a&&E(null)},children:t.jsxs(Fe,{className:"max-w-md",children:[t.jsxs(Me,{children:[t.jsx(Le,{children:r("gitView.changes.revertDirectoryDialogTitle")}),t.jsx($e,{children:C?C.count===1?r("gitView.changes.revertDirectoryDescriptionSingle",{count:C.count,path:C.path}):r("gitView.changes.revertDirectoryDescriptionPlural",{count:C.count,path:C.path}):null})]}),t.jsxs(it,{children:[t.jsx(ae,{variant:"outline",size:"sm",onClick:()=>E(null),disabled:B,children:r("gitView.common.cancel")}),t.jsx(ae,{variant:"destructive",size:"sm",onClick:()=>{M()},disabled:B||!C,children:r(B?"gitView.changes.reverting":"gitView.changes.revertDirectory")})]})]})})]})},et=38,_e=200,Ns=l=>{const e=be.c(26),{value:s,onChange:n,onSubmit:h,placeholder:f,disabled:u,hasTouchInput:c,isMobile:p}=l,r=u===void 0?false:u,k=c===void 0?false:c,y=p===void 0?false:p,{t:m}=xe(),j=v.useRef(null),b=Kt(j),O=Ue(Cs);let A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{const N=j.current;if(!N)return;const P=document.activeElement===N,S=()=>{N.style.height=`${et}px`;const $=N.scrollHeight,W=Math.min(Math.max($,et),_e);N.style.height=`${W}px`,N.style.overflowY=$>_e?"auto":"hidden",$>_e&&!P&&(N.scrollTop=N.scrollHeight)};S();const I=window.requestAnimationFrame(S);return()=>{window.cancelAnimationFrame(I)}},e[0]=A):A=e[0];let w;e[1]!==s?(w=[s],e[1]=s,e[2]=w):w=e[2],v.useLayoutEffect(A,w);let o;e[3]!==n?(o=N=>n(N.target.value),e[3]=n,e[4]=o):o=e[4];let g;e[5]!==h?(g=N=>{N.key==="Enter"&&(N.metaKey||N.ctrlKey)&&!N.shiftKey&&!N.altKey&&(N.preventDefault(),h?.())},e[5]=h,e[6]=g):g=e[6];let L;e[7]!==f||e[8]!==m?(L=f??m("gitView.commit.messagePlaceholder"),e[7]=f,e[8]=m,e[9]=L):L=e[9];const C=k?"on":"off",E=k?"sentences":"off",z=y||O,ee=r&&"opacity-50";let Y;e[10]!==ee?(Y=le("oc-raised oc-field w-full rounded-lg bg-surface-elevated px-3 py-2 typography-ui-label text-foreground placeholder:text-muted-foreground","resize-none outline-none",ee),e[10]=ee,e[11]=Y):Y=e[11];let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_={minHeight:et,maxHeight:_e},e[12]=_):_=e[12];let R;e[13]!==r||e[14]!==E||e[15]!==z||e[16]!==Y||e[17]!==o||e[18]!==g||e[19]!==L||e[20]!==C||e[21]!==s?(R=t.jsx("textarea",{ref:j,value:s,onChange:o,onKeyDown:g,placeholder:L,rows:1,disabled:r,autoCorrect:C,autoCapitalize:E,spellCheck:z,className:Y,style:_}),e[13]=r,e[14]=E,e[15]=z,e[16]=Y,e[17]=o,e[18]=g,e[19]=L,e[20]=C,e[21]=s,e[22]=R):R=e[22];let V;return e[23]!==b||e[24]!==R?(V=t.jsxs(t.Fragment,{children:[R,b]}),e[23]=b,e[24]=R,e[25]=V):V=e[25],V};function Cs(l){return l.inputSpellcheckEnabled}const Ss=l=>{const e=be.c(30),{highlights:s,onInsert:n}=l,{t:h}=xe();if(s.length===0)return null;let f;e[0]!==s||e[1]!==n?(f=()=>{n(s)},e[0]=s,e[1]=n,e[2]=f):f=e[2];const u=f;let c;e[3]!==h?(c=h("gitView.commit.aiHighlights.title"),e[3]=h,e[4]=c):c=e[4];let p;e[5]!==c?(p=t.jsx("p",{className:"typography-micro text-muted-foreground",children:c}),e[5]=c,e[6]=p):p=e[6];let r;e[7]!==h?(r=h("gitView.commit.aiHighlights.insertAria"),e[7]=h,e[8]=r):r=e[8];let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(G,{name:"arrow-down",className:"size-4"}),e[9]=k):k=e[9];let y;e[10]!==u||e[11]!==r?(y=t.jsx(ot,{asChild:true,children:t.jsx(ae,{variant:"ghost",size:"icon",className:"size-6",onClick:u,"aria-label":r,children:k})}),e[10]=u,e[11]=r,e[12]=y):y=e[12];let m;e[13]!==h?(m=h("gitView.commit.aiHighlights.insertTooltip"),e[13]=h,e[14]=m):m=e[14];let j;e[15]!==m?(j=t.jsx(lt,{sideOffset:8,children:m}),e[15]=m,e[16]=j):j=e[16];let b;e[17]!==y||e[18]!==j?(b=t.jsxs(at,{children:[y,j]}),e[17]=y,e[18]=j,e[19]=b):b=e[19];let O;e[20]!==p||e[21]!==b?(O=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p,b]}),e[20]=p,e[21]=b,e[22]=O):O=e[22];let A;e[23]!==s?(A=s.map(ks),e[23]=s,e[24]=A):A=e[24];let w;e[25]!==A?(w=t.jsx("ul",{className:"space-y-1",children:A}),e[25]=A,e[26]=w):w=e[26];let o;return e[27]!==O||e[28]!==w?(o=t.jsxs("div",{className:"space-y-2 rounded-xl oc-tile px-3 py-2",children:[O,w]}),e[27]=O,e[28]=w,e[29]=o):o=e[29],o};function ks(l,e){return t.jsx("li",{className:"typography-meta text-foreground",children:l},`${l}-${e}`)}const Zs=l=>{const e=be.c(113),{stagedCount:s,commitMessage:n,onCommitMessageChange:h,generatedHighlights:f,onInsertHighlights:u,onGenerateMessage:c,isGeneratingMessage:p,onCommit:r,onCommitAndPush:k,commitAction:y,networkOperationBlocked:m,hasPendingIndexMutation:j,gitmojiEnabled:b,onOpenGitmojiPicker:O}=l,A=m===void 0?false:m,w=j===void 0?false:j,{t:o}=xe(),g=s>0;let L;e[0]!==y||e[1]!==n||e[2]!==w||e[3]!==g?(L=n.trim()&&g&&y===null&&!w,e[0]=y,e[1]=n,e[2]=w,e[3]=g,e[4]=L):L=e[4];const C=L,{isMobile:E,hasTouchInput:z}=nt(),[ee,Y]=v.useState(false);let _;e[5]!==n||e[6]!==g||e[7]!==o?(_=g?n.trim()?null:o("contextTooltips.git.writeMessageFirst"):o("contextTooltips.git.stageFilesFirst"),e[5]=n,e[6]=g,e[7]=o,e[8]=_):_=e[8];const R=_;if(E&&!ee&&!g&&!n.trim()&&f.length===0){let oe;e[9]!==o?(oe=o("gitView.commit.title"),e[9]=o,e[10]=oe):oe=e[10];let me;e[11]!==oe?(me=t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:oe}),e[11]=oe,e[12]=me):me=e[12];let fe;e[13]!==o?(fe=o("gitView.commit.stageFilesHint"),e[13]=o,e[14]=fe):fe=e[14];let he;e[15]!==fe?(he=t.jsx("span",{className:"min-w-0 truncate typography-meta text-muted-foreground",children:fe}),e[15]=fe,e[16]=he):he=e[16];let ve;return e[17]!==me||e[18]!==he?(ve=t.jsxs("section",{className:"flex items-baseline gap-2",children:[me,he]}),e[17]=me,e[18]=he,e[19]=ve):ve=e[19],ve}let V,N;e[20]===Symbol.for("react.memo_cache_sentinel")?(V=()=>Y(true),N=oe=>{oe.currentTarget.contains(oe.relatedTarget)||Y(false)},e[20]=V,e[21]=N):(V=e[20],N=e[21]);let P;e[22]!==o?(P=o("gitView.commit.title"),e[22]=o,e[23]=P):P=e[23];let S;e[24]!==P?(S=t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:P}),e[24]=P,e[25]=S):S=e[25];let I;e[26]!==g||e[27]!==o?(I=g?null:t.jsx("span",{className:"min-w-0 truncate typography-meta text-muted-foreground",children:o("gitView.commit.stageFilesHint")}),e[26]=g,e[27]=o,e[28]=I):I=e[28];let $;e[29]!==S||e[30]!==I?($=t.jsxs("div",{className:"flex w-full items-baseline gap-2 px-0 pt-2 pb-1",children:[S,I]}),e[29]=S,e[30]=I,e[31]=$):$=e[31];let W;e[32]!==f||e[33]!==u?(W=t.jsx(Ss,{highlights:f,onInsert:u}),e[32]=f,e[33]=u,e[34]=W):W=e[34];let H;e[35]!==C||e[36]!==p||e[37]!==r?(H=()=>{C&&!p&&r()},e[35]=C,e[36]=p,e[37]=r,e[38]=H):H=e[38];let Z;e[39]!==o?(Z=o("gitView.commit.messagePlaceholder"),e[39]=o,e[40]=Z):Z=e[40];const U=y!==null;let B;e[41]!==n||e[42]!==z||e[43]!==E||e[44]!==h||e[45]!==H||e[46]!==Z||e[47]!==U?(B=t.jsx(Ns,{value:n,onChange:h,onSubmit:H,placeholder:Z,disabled:U,hasTouchInput:z,isMobile:E}),e[41]=n,e[42]=z,e[43]=E,e[44]=h,e[45]=H,e[46]=Z,e[47]=U,e[48]=B):B=e[48];let F;e[49]!==b||e[50]!==O||e[51]!==o?(F=b&&t.jsx(we,{sideOffset:8,label:o("contextTooltips.git.addGitmoji"),className:"w-fit",children:t.jsxs(ae,{variant:"outline",size:"sm",onClick:O,className:"w-fit",type:"button",children:[t.jsx(G,{name:"emotion-happy",className:"size-4"}),o("gitView.commit.addGitmoji")]})}),e[49]=b,e[50]=O,e[51]=o,e[52]=F):F=e[52];let M;e[53]!==g||e[54]!==o?(M=o(g?"gitView.commit.generateAria":"contextTooltips.git.stageFilesFirst"),e[53]=g,e[54]=o,e[55]=M):M=e[55];const J=p||y!==null||w||s===0;let se;e[56]!==o?(se=o("gitView.commit.generateAria"),e[56]=o,e[57]=se):se=e[57];let ie;e[58]!==p?(ie=p?t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(G,{name:"ai-generate-2",className:"size-4 text-primary"}),e[58]=p,e[59]=ie):ie=e[59];let Q;e[60]!==o?(Q=o("gitView.commit.generate"),e[60]=o,e[61]=Q):Q=e[61];let te;e[62]!==Q?(te=t.jsx("span",{className:"commit-actions__label",children:Q}),e[62]=Q,e[63]=te):te=e[63];let a;e[64]!==c||e[65]!==J||e[66]!==se||e[67]!==ie||e[68]!==te?(a=t.jsxs(ae,{variant:"outline",size:"sm",onClick:c,disabled:J,type:"button","aria-label":se,className:"commit-actions__btn",children:[ie,te]}),e[64]=c,e[65]=J,e[66]=se,e[67]=ie,e[68]=te,e[69]=a):a=e[69];let d;e[70]!==M||e[71]!==a?(d=t.jsx(we,{sideOffset:8,label:M,children:a}),e[70]=M,e[71]=a,e[72]=d):d=e[72];let i;e[73]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1"}),e[73]=i):i=e[73];let x;e[74]!==R||e[75]!==o?(x=R??o("contextTooltips.git.commit"),e[74]=R,e[75]=o,e[76]=x):x=e[76];let T;e[77]!==r?(T=oe=>r(oe.currentTarget),e[77]=r,e[78]=T):T=e[78];const D=!C||p;let q;e[79]!==o?(q=o("gitView.commit.commitAria"),e[79]=o,e[80]=q):q=e[80];let X;e[81]!==y||e[82]!==o?(X=y==="commit"?t.jsxs(t.Fragment,{children:[t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label",children:o("gitView.commit.committing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(G,{name:"git-commit",className:"size-4"}),t.jsx("span",{className:"commit-actions__label",children:o("gitView.commit.commit")})]}),e[81]=y,e[82]=o,e[83]=X):X=e[83];let K;e[84]!==T||e[85]!==D||e[86]!==q||e[87]!==X?(K=t.jsx(ae,{size:"sm",variant:"outline",onClick:T,disabled:D,className:"commit-actions__btn whitespace-nowrap","aria-label":q,children:X}),e[84]=T,e[85]=D,e[86]=q,e[87]=X,e[88]=K):K=e[88];let re;e[89]!==x||e[90]!==K?(re=t.jsx(we,{sideOffset:8,label:x,children:K}),e[89]=x,e[90]=K,e[91]=re):re=e[91];let ce;e[92]!==C||e[93]!==y||e[94]!==R||e[95]!==p||e[96]!==E||e[97]!==A||e[98]!==k||e[99]!==o?(ce=E?t.jsxs(at,{children:[t.jsx(ot,{asChild:true,children:t.jsx(ae,{variant:"default",size:"sm",onClick:oe=>k(oe.currentTarget),disabled:!C||p||A,className:"h-7 w-7 p-0","aria-label":o("gitView.commit.pushAria"),children:y==="commitAndPush"?t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(G,{name:"arrow-up",className:"size-3.5"})})}),t.jsx(lt,{side:"top",children:t.jsx("p",{children:o("gitView.commit.push")})})]}):t.jsx(we,{sideOffset:8,label:R??o("contextTooltips.git.commitAndSync"),children:t.jsx(ae,{size:"sm",variant:"default",onClick:oe=>k(oe.currentTarget),disabled:!C||p||A,className:"commit-actions__btn","aria-label":o("gitView.commit.pushAria"),children:y==="commitAndPush"?t.jsxs(t.Fragment,{children:[t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:o("gitView.commit.pushing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(G,{name:"arrow-up",className:"size-3.5"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:o("gitView.commit.push")})]})})}),e[92]=C,e[93]=y,e[94]=R,e[95]=p,e[96]=E,e[97]=A,e[98]=k,e[99]=o,e[100]=ce):ce=e[100];let de;e[101]!==d||e[102]!==re||e[103]!==ce?(de=t.jsxs("div",{className:"@container/commit-actions flex items-center gap-2 min-w-0",children:[d,i,re,ce]}),e[101]=d,e[102]=re,e[103]=ce,e[104]=de):de=e[104];let ue;e[105]!==W||e[106]!==B||e[107]!==F||e[108]!==de?(ue=t.jsxs("div",{className:"flex flex-col gap-3 px-0 pt-1 pb-3",children:[W,B,F,de]}),e[105]=W,e[106]=B,e[107]=F,e[108]=de,e[109]=ue):ue=e[109];let ye;return e[110]!==$||e[111]!==ue?(ye=t.jsxs("section",{className:"border-0 bg-transparent rounded-none",onFocus:V,onBlur:N,children:[$,ue]}),e[110]=$,e[111]=ue,e[112]=ye):ye=e[112],ye},Js=l=>{const e=be.c(153),{open:s,onOpenChange:n,conflictFiles:h,directory:f,operation:u,onAbort:c,onClearState:p,onNavigatedToChat:r}=l;let k;e[0]!==h?(k=h===void 0?[]:h,e[0]=h,e[1]=k):k=e[1];const y=k,{t:m}=xe(),j=rt(Vs),b=rt(As),O=ct(Ts),A=ct(Is),[w,o]=v.useState(false),[g,L]=v.useState(null),[C,E]=v.useState(null);let z,ee;e[2]!==f||e[3]!==s||e[4]!==m?(z=()=>{!s||!f||(o(true),E(null),L(null),Ut(f).then(ne=>{L(ne)}).catch(ne=>{const pe=ne instanceof Error?ne.message:m("gitView.conflict.loadFailed");E(pe)}).finally(()=>{o(false)}))},ee=[s,f,m],e[2]=f,e[3]=s,e[4]=m,e[5]=z,e[6]=ee):(z=e[5],ee=e[6]),v.useEffect(z,ee);let Y;e[7]!==g||e[8]!==f||e[9]!==u?(Y=async()=>{if(!g)return null;const ne=u==="merge"?"merge":"rebase",pe=g.headInfo||(u==="merge"?"MERGE_HEAD":"REBASE_HEAD"),ke=u==="merge"?"git commit --no-edit":"git rebase --continue",Ve=await qt(f),je=Ve.render("git.conflict.resolve.visible",{operation_label:ne,head_ref:pe}),Ne=Ve.render("git.conflict.resolve.instructions",{operation_label:ne,directory:f,operation:u,head_info:g.headInfo||"N/A",continue_cmd:ke}),Ce=`${ne} conflict context (JSON)
2
2
  ${JSON.stringify({directory:f,operation:g.operation,headInfo:g.headInfo,statusPorcelain:g.statusPorcelain,unmergedFiles:g.unmergedFiles,diff:g.diff},null,2)}`;return{visibleText:je,instructionsText:Ne,payloadText:Ce}},e[7]=g,e[8]=f,e[9]=u,e[10]=Y):Y=e[10];const _=Y;let R;e[11]!==_||e[12]!==m?(R=async()=>{try{return await _()}catch(ne){const pe=ne;ge.error(m("magicPrompts.toast.loadFailed"),{description:pe instanceof Error?pe.message:void 0});return}},e[11]=_,e[12]=m,e[13]=R):R=e[13];const V=R;let N;e[14]!==c||e[15]!==n?(N=()=>{c(),n(false)},e[14]=c,e[15]=n,e[16]=N):N=e[16];const P=N;let S;e[17]!==p||e[18]!==n?(S=()=>{p?.(),n(false)},e[17]=p,e[18]=n,e[19]=S):S=e[19];const I=S;let $;e[20]!==b||e[21]!==p||e[22]!==r||e[23]!==n||e[24]!==V||e[25]!==O||e[26]!==A||e[27]!==m?($=async()=>{const ne=await V();if(ne!==void 0){if(!ne){ge.error(m("gitView.conflict.noDetailsAvailable"));return}if(!b){ge.error(m("gitView.conflict.noActiveSession"),{description:m("gitView.conflict.noActiveSessionDescription")});return}O(ne.visibleText,"replace"),A([{text:ne.instructionsText,synthetic:true},{text:ne.payloadText,synthetic:true}]),p?.(),n(false),r?.()}},e[20]=b,e[21]=p,e[22]=r,e[23]=n,e[24]=V,e[25]=O,e[26]=A,e[27]=m,e[28]=$):$=e[28];const W=$;let H;e[29]!==f||e[30]!==p||e[31]!==r||e[32]!==n||e[33]!==j||e[34]!==V||e[35]!==m?(H=async()=>{const ne=await V();if(ne!==void 0){if(!ne){ge.error(m("gitView.conflict.noDetailsAvailable"));return}j({directoryOverride:f,initialPrompt:ne.visibleText,syntheticParts:[{text:ne.instructionsText,synthetic:true},{text:ne.payloadText,synthetic:true}]}),p?.(),n(false),r?.()}},e[29]=f,e[30]=p,e[31]=r,e[32]=n,e[33]=j,e[34]=V,e[35]=m,e[36]=H):H=e[36];const Z=H;let U,B,F,M,J,se,ie,Q,te,a,d,i,x,T,D,q,X,K,re,ce,de,ue;if(e[37]!==g||e[38]!==y||e[39]!==b||e[40]!==P||e[41]!==I||e[42]!==W||e[43]!==Z||e[44]!==w||e[45]!==C||e[46]!==n||e[47]!==s||e[48]!==u||e[49]!==m){const ne=m(u==="merge"?"gitView.operation.merge":"gitView.operation.rebase"),pe=g?.unmergedFiles||y;F=Oe,de=s,ue=n,B=Fe,ce="max-w-md w-[calc(100vw-2rem)]",T="flex flex-col gap-4 overflow-hidden";let ke;e[72]===Symbol.for("react.memo_cache_sentinel")?(ke=t.jsx(G,{name:"alert",className:"size-5 shrink-0 text-[var(--status-warning)]"}),e[72]=ke):ke=e[72];const Ve=t.jsxs("div",{className:"flex items-center gap-2",children:[ke,t.jsx(Le,{children:m("gitView.conflict.detectedTitle",{operation:ne})})]});let je;e[73]!==u||e[74]!==m?(je=m("gitView.conflict.detectedDescription",{operation:u}),e[73]=u,e[74]=m,e[75]=je):je=e[75];let Ne;e[76]!==je?(Ne=t.jsx($e,{children:je}),e[76]=je,e[77]=Ne):Ne=e[77],e[78]!==Ve||e[79]!==Ne?(D=t.jsxs(Me,{children:[Ve,Ne]}),e[78]=Ve,e[79]=Ne,e[80]=D):D=e[80],e[81]!==w||e[82]!==m?(q=w&&t.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-muted-foreground",children:[t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"typography-meta",children:m("gitView.conflict.loading")})]}),e[81]=w,e[82]=m,e[83]=q):q=e[83],e[84]!==C||e[85]!==m?(X=C&&t.jsx("div",{className:"rounded-lg bg-[var(--status-error-bg)] p-3 text-[var(--status-error)] typography-meta break-words",children:m("gitView.conflict.errorLoadingDetails",{message:C})}),e[84]=C,e[85]=m,e[86]=X):X=e[86],e[87]!==pe||e[88]!==m?(K=pe.length>0&&t.jsxs("div",{className:"space-y-2 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{className:"typography-meta text-muted-foreground",children:m("gitView.conflict.conflictedFiles")}),t.jsx("span",{className:"typography-micro px-1.5 py-0.5 rounded bg-[var(--surface-elevated)] text-muted-foreground",children:pe.length})]}),t.jsx(dt,{outerClassName:"max-h-40 rounded-lg bg-[var(--surface-elevated)]",className:"p-3",disableHorizontal:true,children:t.jsx("ul",{className:"space-y-1",children:pe.map(Es)})})]}),e[87]=pe,e[88]=m,e[89]=K):K=e[89],e[90]!==g||e[91]!==m?(re=g?.headInfo&&t.jsxs("div",{className:"space-y-1 overflow-hidden",children:[t.jsx("p",{className:"typography-meta text-muted-foreground",children:m("gitView.conflict.headInfo")}),t.jsx(dt,{outerClassName:"max-h-24 rounded-lg bg-[var(--surface-elevated)]",className:"typography-micro text-foreground font-mono p-3 break-words whitespace-pre-wrap",disableHorizontal:true,children:g.headInfo})]}),e[90]=g,e[91]=m,e[92]=re):re=e[92],d="flex flex-col gap-2 pt-2";let Ce;e[93]!==Z?(Ce=()=>{Z()},e[93]=Z,e[94]=Ce):Ce=e[94];const We=w||!g;let Ae;e[95]!==w?(Ae=w?t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(G,{name:"add",className:"size-4"}),e[95]=w,e[96]=Ae):Ae=e[96];let Te;e[97]!==m?(Te=m("gitView.conflict.resolveNewSession"),e[97]=m,e[98]=Te):Te=e[98],e[99]!==Ce||e[100]!==We||e[101]!==Ae||e[102]!==Te?(i=t.jsxs(ae,{variant:"default",onClick:Ce,disabled:We,className:"w-full gap-2",children:[Ae,Te]}),e[99]=Ce,e[100]=We,e[101]=Ae,e[102]=Te,e[103]=i):i=e[103];let Ie;e[104]!==W?(Ie=()=>{W()},e[104]=W,e[105]=Ie):Ie=e[105];const Xe=w||!g||!b;let Ee;e[106]!==w?(Ee=w?t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(G,{name:"chat-1",className:"size-4"}),e[106]=w,e[107]=Ee):Ee=e[107];let De;e[108]!==m?(De=m("gitView.conflict.resolveCurrentSession"),e[108]=m,e[109]=De):De=e[109],e[110]!==Ie||e[111]!==Xe||e[112]!==Ee||e[113]!==De?(x=t.jsxs(ae,{variant:"outline",onClick:Ie,disabled:Xe,className:"w-full gap-2",children:[Ee,De]}),e[110]=Ie,e[111]=Xe,e[112]=Ee,e[113]=De,e[114]=x):x=e[114],te="flex gap-2 pt-1";let ze;e[115]!==m?(ze=m("gitView.conflict.continueLater"),e[115]=m,e[116]=ze):ze=e[116],e[117]!==I||e[118]!==ze?(a=t.jsx(ae,{variant:"ghost",size:"sm",onClick:I,className:"flex-1",children:ze}),e[117]=I,e[118]=ze,e[119]=a):a=e[119],U=ae,M="destructive",J="sm",se=P,ie="flex-1",Q=m("gitView.conflict.abortOperation",{operation:ne}),e[37]=g,e[38]=y,e[39]=b,e[40]=P,e[41]=I,e[42]=W,e[43]=Z,e[44]=w,e[45]=C,e[46]=n,e[47]=s,e[48]=u,e[49]=m,e[50]=U,e[51]=B,e[52]=F,e[53]=M,e[54]=J,e[55]=se,e[56]=ie,e[57]=Q,e[58]=te,e[59]=a,e[60]=d,e[61]=i,e[62]=x,e[63]=T,e[64]=D,e[65]=q,e[66]=X,e[67]=K,e[68]=re,e[69]=ce,e[70]=de,e[71]=ue}else U=e[50],B=e[51],F=e[52],M=e[53],J=e[54],se=e[55],ie=e[56],Q=e[57],te=e[58],a=e[59],d=e[60],i=e[61],x=e[62],T=e[63],D=e[64],q=e[65],X=e[66],K=e[67],re=e[68],ce=e[69],de=e[70],ue=e[71];let ye;e[120]!==U||e[121]!==M||e[122]!==J||e[123]!==se||e[124]!==ie||e[125]!==Q?(ye=t.jsx(U,{variant:M,size:J,onClick:se,className:ie,children:Q}),e[120]=U,e[121]=M,e[122]=J,e[123]=se,e[124]=ie,e[125]=Q,e[126]=ye):ye=e[126];let oe;e[127]!==te||e[128]!==a||e[129]!==ye?(oe=t.jsxs("div",{className:te,children:[a,ye]}),e[127]=te,e[128]=a,e[129]=ye,e[130]=oe):oe=e[130];let me;e[131]!==d||e[132]!==i||e[133]!==x||e[134]!==oe?(me=t.jsxs("div",{className:d,children:[i,x,oe]}),e[131]=d,e[132]=i,e[133]=x,e[134]=oe,e[135]=me):me=e[135];let fe;e[136]!==T||e[137]!==D||e[138]!==q||e[139]!==X||e[140]!==K||e[141]!==re||e[142]!==me?(fe=t.jsxs("div",{className:T,children:[D,q,X,K,re,me]}),e[136]=T,e[137]=D,e[138]=q,e[139]=X,e[140]=K,e[141]=re,e[142]=me,e[143]=fe):fe=e[143];let he;e[144]!==B||e[145]!==ce||e[146]!==fe?(he=t.jsx(B,{className:ce,children:fe}),e[144]=B,e[145]=ce,e[146]=fe,e[147]=he):he=e[147];let ve;return e[148]!==F||e[149]!==de||e[150]!==ue||e[151]!==he?(ve=t.jsx(F,{open:de,onOpenChange:ue,children:he}),e[148]=F,e[149]=de,e[150]=ue,e[151]=he,e[152]=ve):ve=e[152],ve};function Vs(l){return l.openNewSessionDraft}function As(l){return l.currentSessionId}function Ts(l){return l.setPendingInputText}function Is(l){return l.setPendingSyntheticParts}function Es(l){return t.jsx("li",{className:"typography-micro text-foreground font-mono truncate block",title:l,children:l},l)}const Qs=({open:l,onOpenChange:e,targetBranch:s,changedFileCount:n,onCommitAndSwitch:h,onGenerateMessage:f,onRevertAndSwitch:u})=>{const{t:c}=xe(),[p,r]=v.useState(""),[k,y]=v.useState(null),[m,j]=v.useState(false),b=k!==null;v.useEffect(()=>{l||(r(""),j(false))},[l]);const O=async()=>{y("generate");try{const o=await f();o&&r(o)}catch(o){ge.error(o instanceof Error?o.message:c("gitView.dirtySwitch.actionFailed"))}finally{y(null)}},A=async()=>{y("commit");try{let o=p.trim();if(!o){if(o=(await f()).trim(),!o){ge.error(c("gitView.toast.enterCommitMessage"));return}r(o)}await h(o,m)}catch(o){ge.error(o instanceof Error?o.message:c("gitView.dirtySwitch.actionFailed"))}finally{y(null)}},w=async()=>{y("revert");try{await u()}catch(o){ge.error(o instanceof Error?o.message:c("gitView.dirtySwitch.actionFailed"))}finally{y(null)}};return t.jsx(Oe,{open:l,onOpenChange:o=>{b||e(o)},children:t.jsx(Fe,{className:"max-w-md w-[calc(100vw-2rem)]",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs(Me,{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(G,{name:"alert",className:"size-5 shrink-0 text-[var(--status-warning)]"}),t.jsx(Le,{children:c("gitView.dirtySwitch.title")})]}),t.jsx($e,{children:n===1?c("gitView.dirtySwitch.descriptionSingle",{branch:s}):c("gitView.dirtySwitch.descriptionPlural",{branch:s,count:n})})]}),t.jsxs("div",{className:"oc-raised oc-field flex items-center gap-2 rounded-lg px-3 py-2",children:[t.jsx("input",{value:p,onChange:o=>r(o.target.value),placeholder:c("gitView.commit.messagePlaceholder"),disabled:b,onKeyDown:o=>{o.key==="Enter"&&!b&&(o.preventDefault(),A())},className:"min-w-0 flex-1 bg-transparent typography-meta text-foreground outline-none placeholder:text-muted-foreground"}),t.jsx(we,{sideOffset:8,label:c("gitView.commit.generateAria"),className:"shrink-0",children:t.jsx("button",{type:"button",onClick:()=>{O()},disabled:b,"aria-label":c("gitView.commit.generate"),className:"shrink-0 text-muted-foreground hover:text-foreground disabled:opacity-50",children:k==="generate"?t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(G,{name:"ai-generate-2",className:"size-4 text-primary"})})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Wt,{checked:m,onChange:j,disabled:b,ariaLabel:c("gitView.dirtySwitch.pushAfterCommit")}),t.jsx("span",{className:"typography-ui-label text-foreground cursor-pointer select-none",onClick:()=>!b&&j(!m),children:c("gitView.dirtySwitch.pushAfterCommit")})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[t.jsxs(ae,{variant:"destructive",size:"sm",onClick:()=>{w()},disabled:b,className:"gap-2",children:[k==="revert"?t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):null,c("gitView.dirtySwitch.revertAndSwitch")]}),t.jsxs(ae,{variant:"default",size:"sm",onClick:()=>{A()},disabled:b,className:"gap-2",children:[k==="commit"?t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):null,c("gitView.dirtySwitch.commitAndSwitch")]})]})]})})})},tt="max-w-none",Ds="flex flex-wrap items-center gap-2",Rt=l=>{const e=be.c(6),{error:s,children:n}=l,h=s?"alert":void 0,f=s&&"text-[var(--status-error)]";let u;e[0]!==f?(u=le(Ke,f),e[0]=f,e[1]=u):u=e[1];let c;return e[2]!==n||e[3]!==h||e[4]!==u?(c=t.jsx("p",{role:h,className:u,children:n}),e[2]=n,e[3]=h,e[4]=u,e[5]=c):c=e[5],c},zs=l=>{if(!l||l.target.operation!=="checkout-hydration")return[];const e=[...l.target.requirements],s=[...(l.hydration?.submodules??[]).map(n=>({kind:"submodule",item:n})),...(l.hydration?.lfs??[]).map(n=>({kind:"lfs",item:n}))];for(const{kind:n,item:h}of s){const f=h.endpoint;f&&(e.some(u=>u.kind===n&&u.path===h.path&&u.endpoint.fingerprint===f.fingerprint)||e.push({kind:n,path:h.path,endpoint:f}))}return e},Rs=l=>{const e=be.c(48),{directory:s,className:n}=l,{t:h}=xe(),{git:f,sourceControl:u}=wt(),c=vt(s,u),p=Re(Os),r=Re(Fs),k=jt(),y=Be(Ms),m=Be(Ls);let j;e[0]!==m?(j=Nt(m),e[0]=m,e[1]=j):j=e[1];const b=j,[O,A]=v.useState(""),[w,o]=v.useState(false),g=v.useRef(0);let L;e[2]===Symbol.for("react.memo_cache_sentinel")?(L=()=>(g.current=g.current+1,A(""),o(false),()=>{g.current=g.current+1}),e[2]=L):L=e[2];let C;e[3]!==c.scope||e[4]!==f||e[5]!==u?(C=[c.scope,f,u],e[3]=c.scope,e[4]=f,e[5]=u,e[6]=C):C=e[6],v.useLayoutEffect(L,C);const E=c.read;let z;e[7]!==k?(z=H=>Dt(H)&&At(H,k),e[7]=k,e[8]=z):z=e[8];let ee;e[9]!==p||e[10]!==r||e[11]!==z?(ee=Ct(p,r,z),e[9]=p,e[10]=r,e[11]=z,e[12]=ee):ee=e[12];const Y=ee;let _,R,V,N,P,S,I;if(e[13]!==n||e[14]!==s||e[15]!==f||e[16]!==p||e[17]!==Y||e[18]!==b||e[19]!==O||e[20]!==E||e[21]!==y||e[22]!==u||e[23]!==h){V=Symbol.for("react.early_return_sentinel");e:{const H=E?Xt(E):null,Z=H?.providers[0]?.primaryRemote??H?.remotes[0]?.name??"origin",U=(E?.repository.remotes??[]).filter(F=>F.name!==Z&&H?.remotes.find(M=>M.name===F.name)?.readiness!=="ready"),B=async(F,M)=>{if(O)return;const J=g.current,se=qe(),ie=()=>g.current===J&&se===qe();A(F),o(false);const Q=await ss({directory:s,identity:M,remoteName:F},{git:f,sourceControl:u});ie()&&(Q.status!=="applied"&&o(true),A(""))};if(!U.length||!f.configureTransportBinding){V=null;break e}_=Tt,e[31]!==h?(N=h("gitView.remotes.title"),e[31]=h,e[32]=N):N=e[32],e[33]!==h?(P=h("gitView.remotes.description"),e[33]=h,e[34]=P):P=e[34],e[35]!==n?(S=le("min-w-0",n),e[35]=n,e[36]=S):S=e[36],I=It,R=U.map(F=>{const M=St(F.fetch.displayUrl);return t.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate typography-ui-label text-foreground",children:F.name}),t.jsx("p",{className:le(Ke,"truncate"),title:F.fetch.displayUrl,children:F.fetch.displayUrl})]}),t.jsx(kt,{activeProfile:null,identities:Y,onSelect:J=>{B(F.name,J)},isApplying:O===F.name,applicability:J=>Vt(J,M,b),triggerClassName:"shrink-0 border border-border",onOpen:()=>{y(u,p.map($s))}})]},F.name)})}e[13]=n,e[14]=s,e[15]=f,e[16]=p,e[17]=Y,e[18]=b,e[19]=O,e[20]=E,e[21]=y,e[22]=u,e[23]=h,e[24]=_,e[25]=R,e[26]=V,e[27]=N,e[28]=P,e[29]=S,e[30]=I}else _=e[24],R=e[25],V=e[26],N=e[27],P=e[28],S=e[29],I=e[30];if(V!==Symbol.for("react.early_return_sentinel"))return V;let $;e[37]!==w||e[38]!==h?($=w?t.jsx(Rt,{error:true,children:h("settings.sourceControl.instance.status.operationFailed")}):null,e[37]=w,e[38]=h,e[39]=$):$=e[39];let W;return e[40]!==_||e[41]!==R||e[42]!==$||e[43]!==N||e[44]!==P||e[45]!==S||e[46]!==I?(W=t.jsxs(_,{title:N,description:P,className:S,contentClassName:I,children:[R,$]}),e[40]=_,e[41]=R,e[42]=$,e[43]=N,e[44]=P,e[45]=S,e[46]=I,e[47]=W):W=e[47],W},Ps=({directory:l,className:e})=>{const{t:s}=xe(),{git:n,sourceControl:h}=wt(),f=vt(l,h),u=Yt(l,n,h),[c,p]=v.useState(""),[r,k]=v.useState(""),[y,m]=v.useState(null),[j,b]=v.useState(false),[O,A]=v.useState(false),[w,o]=v.useState(false),g=v.useRef(0),L=Re(i=>i.profiles),C=Re(i=>i.globalIdentity),E=Re(i=>i.loadProfiles),z=Re(i=>i.loadGlobalIdentity),ee=jt(),Y=Be(i=>i.refreshIdentityAccounts),_=Be(i=>i.identities),R=v.useMemo(()=>Nt(_),[_]),V=Zt(l),N=u.entry?.reads.at(-1)?.operation,P=N?.target.operation==="checkout-hydration"&&N.target.remote.name===c?zs(N):[],S=P.find(i=>JSON.stringify([i.kind,i.path,i.endpoint.fingerprint])===r),I=f.read,$=I?.repository.remotes.find(i=>i.name===c),W=S&&I?.binding?.auxiliary.find(i=>i.kind===S.kind&&i.endpoint.fingerprint===S.endpoint.fingerprint);v.useLayoutEffect(()=>(g.current+=1,p(""),k(""),m(null),b(false),A(false),o(false),()=>{g.current+=1}),[f.scope,n,h]),v.useLayoutEffect(()=>{},[S?.endpoint.fingerprint]),v.useEffect(()=>{w&&(E(),z())},[E,z,w]);const H=v.useMemo(()=>Ct(L,C,i=>Dt(i)&&At(i,ee)),[ee,L,C]),Z=S?.endpoint.displayUrl??"",U=v.useMemo(()=>Z?St(Z):null,[Z]),B=v.useCallback(i=>U?Vt(i,U,R):{applicable:true},[U,R]),F=v.useMemo(()=>{const i=H.filter(T=>B(T).applicable);return(V?.userName&&V.userEmail?i.find(T=>T.userName===V.userName&&T.userEmail===V.userEmail):void 0)??i.find(T=>T.account&&U?.host&&(Jt(T.account.instance)===U.host||Qt(R[T.account.instance]??"")===U.host))??null},[B,H,U,R,V]),M=(y?.endpoint===S?.endpoint.fingerprint?H.find(i=>i.id===y?.id):null)??F,J=M?cs(M):null,se=!!(f.status==="ready"&&I?.binding&&$&&S&&n.configureAuxiliaryBinding&&!j&&M&&B(M).applicable&&(J!=="account"||M?.account)&&(J!=="ssh"||M?.sshCredentialId)),ie=!!(f.status==="ready"&&W&&$&&n.configureAuxiliaryBinding&&!j),Q=async()=>{if(!c||u.blocked)return;const i=u.start();if(i){A(false);try{await is({directory:l,git:n,sourceControl:h,parentRemoteName:c,onOperation:i.onOperation})}catch(x){x instanceof ns||A(true)}finally{i.finish()}}},te=async i=>{if(i==="configure"&&!se||i==="remove"&&!ie||!f.isCurrent()||!I?.binding||!$||!S||!n.configureAuxiliaryBinding)return;const x=g.current,T=qe(),D=()=>g.current===x&&T===qe(),q={directory:l,expectedRepositoryId:I.repository.repositoryId,expectedRevision:I.revision,expectedConfigRevision:I.repository.configRevision,parentRemote:c,expectedParentFingerprint:$.fetch.fingerprint,kind:S.kind,path:S.path,expectedEndpointFingerprint:S.endpoint.fingerprint},X=i==="remove"?{...q,operation:i}:M&&as(M,q);if(!X)return;const K=He.captureMutation(f.scope,I);b(true),A(false);try{const re=await n.configureAuxiliaryBinding(X);He.setMutationResult(K,re.binding)||await He.reconcile(K,h)}catch{D()&&A(true),await He.reconcile(K,h)}finally{K.release(),D()&&b(false)}},a=!!(P.length&&N&&"error"in N&&N.error.code==="AUTHENTICATION_REQUIRED"),d=i=>s(i==="submodule"?"gitView.hydration.kind.submodule":"gitView.hydration.kind.lfs");return t.jsxs(hs,{open:w,onOpenChange:o,className:le("min-w-0",e),children:[t.jsxs(ps,{className:"w-auto justify-start gap-1.5",children:[t.jsx(es,{children:s("gitView.hydration.title")}),t.jsx(G,{name:w?"arrow-up-s":"arrow-down-s",className:"h-4 w-4 text-muted-foreground"})]}),t.jsx(gs,{children:t.jsxs(Tt,{description:s("gitView.hydration.description"),className:"min-w-0 pt-2",contentClassName:It,children:[t.jsx(Ye,{label:s("gitView.hydration.parentRemote"),controlClassName:tt,children:t.jsxs(ut,{value:c,onValueChange:i=>{p(i),k(""),m(null)},disabled:!I?.binding||j||u.blocked,children:[t.jsx(mt,{className:"w-fit max-w-[28ch]","aria-label":s("gitView.hydration.parentRemote"),children:t.jsx(ft,{placeholder:s("settings.sourceControl.transport.remoteLabel")})}),t.jsx(ht,{children:I?.binding?.remotes.filter(i=>i.readiness==="ready").map(i=>t.jsx(pt,{value:i.name,children:i.name},i.name))})]})}),t.jsx(ts,{entry:u.entry,onRefresh:()=>{u.refresh()},onCancel:()=>{u.cancel()}}),a?t.jsx("p",{className:Ke,children:s("gitView.hydration.authorizationNeeded")}):null,P.length?t.jsx(Ye,{label:s("gitView.hydration.endpoint"),controlClassName:tt,children:t.jsxs(ut,{value:r,onValueChange:k,disabled:j,children:[t.jsx(mt,{className:"w-fit max-w-[28ch]","aria-label":s("gitView.hydration.endpoint"),children:t.jsx(ft,{placeholder:s("gitView.hydration.chooseEndpoint"),children:S?`${S.path} \xB7 ${d(S.kind)} \xB7 ${S.endpoint.displayUrl}`:void 0})}),t.jsx(ht,{children:P.map(i=>{const x=JSON.stringify([i.kind,i.path,i.endpoint.fingerprint]);return t.jsxs(pt,{value:x,children:[i.path," \xB7 ",d(i.kind)," \xB7 ",i.endpoint.displayUrl]},x)})})]})}):null,S?t.jsx(t.Fragment,{children:t.jsx(Ye,{label:s("gitView.hydration.identity"),controlClassName:tt,children:t.jsx(kt,{activeProfile:M,identities:H,onSelect:i=>m({endpoint:S.endpoint.fingerprint,id:i.id}),isApplying:j,applicability:B,triggerClassName:"w-full max-w-none border border-border",menuAlign:"start",onOpen:()=>{Y(h,L.map(i=>i.account))}})})}):null,N?.hydration?.status==="client-missing"?t.jsx("p",{role:"alert",className:le(Ke,"text-[var(--status-warning)]"),children:s("gitView.hydration.lfsMissing")}):null,O?t.jsx(Rt,{error:true,children:s("settings.sourceControl.instance.status.operationFailed")}):null,t.jsxs("div",{className:Ds,children:[t.jsx(ae,{size:"sm",variant:"outline",disabled:!c||u.blocked||j,onClick:()=>{Q()},children:s("gitView.hydration.retry")}),S?t.jsxs(t.Fragment,{children:[t.jsx(ae,{size:"sm",disabled:!se,onClick:()=>{te("configure")},children:s("settings.common.actions.saveChanges")}),W?t.jsx(ae,{size:"sm",variant:"ghost",disabled:!ie,onClick:()=>{te("remove")},children:s("settings.common.actions.delete")}):null]}):null]})]})})]})};function Os(l){return l.profiles}function Fs(l){return l.globalIdentity}function Ms(l){return l.refreshIdentityAccounts}function Ls(l){return l.identities}function $s(l){return l.account}const st="border-t border-edge pt-4",ei=l=>{const e=be.c(11),{open:s,onOpenChange:n,directory:h}=l,{t:f}=xe(),u=Ue(Hs),c=Ue(Gs);let p;e[0]!==h||e[1]!==n||e[2]!==s||e[3]!==c||e[4]!==u||e[5]!==f?(p=s?t.jsxs(Fe,{className:"@container min-w-0 max-h-[85dvh] overflow-y-auto",children:[t.jsxs(Me,{children:[t.jsx(Le,{children:f("gitView.context.configure")}),t.jsx($e,{children:f("gitView.context.description")})]}),t.jsx(Rs,{directory:h,className:st}),t.jsx(Ps,{directory:h,className:st}),t.jsxs(it,{className:st,children:[t.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>{n(false),u("git"),c(true)},children:f("gitView.context.settings")}),t.jsx(ae,{size:"sm",variant:"outline",onClick:()=>n(false),children:f("dialog.common.actions.close")})]})]}):null,e[0]=h,e[1]=n,e[2]=s,e[3]=c,e[4]=u,e[5]=f,e[6]=p):p=e[6];let r;return e[7]!==n||e[8]!==s||e[9]!==p?(r=t.jsx(Oe,{open:s,onOpenChange:n,children:p}),e[7]=n,e[8]=s,e[9]=p,e[10]=r):r=e[10],r};function Hs(l){return l.setSettingsPage}function Gs(l){return l.setSettingsDialogOpen}const ti=({mergeInProgress:l,rebaseInProgress:e,onContinue:s,onAbort:n,onResolveWithAI:h,conflictCount:f=0,isLoading:u=false})=>{const{t:c}=xe(),[p,r]=v.useState(null),k=l&&l.head,y=e&&(e.headName||e.onto),m=k?"merge":y?"rebase":null;if(!m)return null;const j=async()=>{r("continue");try{await s()}finally{r(null)}},b=async()=>{r("abort");try{await n()}finally{r(null)}},O=p!==null,A=f>0,w=c(m==="merge"?"gitView.operation.merge":"gitView.operation.rebase");let o="";l?o=l.message?c("gitView.operation.mergingMessage",{message:l.message}):c("gitView.operation.mergeInProgressWithHead",{head:l.head}):e&&(o=e.headName?c("gitView.operation.rebasingOnto",{headName:e.headName,onto:e.onto||""}):c("gitView.operation.rebaseInProgress"));const g=A?f===1?c("gitView.operation.inProgressTitleOneConflict",{operation:w,count:f}):c("gitView.operation.inProgressTitleManyConflicts",{operation:w,count:f}):c("gitView.operation.inProgressTitle",{operation:w}),L=c(A?"gitView.operation.resolveConflictsHint":"gitView.operation.readyToContinueHint");return t.jsx("div",{className:"mx-4 mt-3 overflow-hidden rounded-lg bg-[var(--status-warning-background)]",children:t.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"typography-label text-[var(--status-warning)]",children:g}),o&&t.jsx("p",{className:"typography-micro break-words text-muted-foreground",children:o})]}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("p",{className:"typography-micro min-w-[12rem] flex-1 text-muted-foreground",children:L}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx(we,{sideOffset:8,label:c("contextTooltips.git.abortOperation"),children:t.jsxs(ae,{variant:"ghost",size:"sm",onClick:b,disabled:O||u,className:"gap-1.5",children:[p==="abort"?t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(G,{name:"close",className:"size-4"}),c("gitView.operation.abort")]})}),A?h&&t.jsx(we,{sideOffset:8,label:c("contextTooltips.git.resolveWithAgent"),children:t.jsx(ae,{variant:"default",size:"sm",onClick:h,disabled:O||u,children:c("gitView.operation.resolveWithAi")})}):t.jsx(we,{sideOffset:8,label:c("contextTooltips.git.continueOperation"),children:t.jsxs(ae,{variant:"default",size:"sm",onClick:j,disabled:O||u,className:"gap-1.5",children:[p==="continue"?t.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(G,{name:"check",className:"size-4"}),c("gitView.operation.continue")]})})]})]})]})})},bt=()=>Math.floor(Math.random()*1e3);function si(){const l=be.c(11),{t:e}=xe(),{triggerFireworks:s}=xs(),n=Et();let h;l[0]!==n||l[1]!==e||l[2]!==s?(h=(r,k)=>{const{pushAfter:y,origin:m}=k,j=n?os(n,r,gt(),bt()):null;return j?ge.success(j.title,{description:j.description}):ge.success(e("gitView.toast.commitCreated")),j&&!y&&s({kind:"deletion",origin:m}),j!==null},l[0]=n,l[1]=e,l[2]=s,l[3]=h):h=l[3];const f=h;let u;l[4]!==n||l[5]!==e||l[6]!==s?(u=r=>{const{deletion:k,origin:y}=r,m=n?ls(n,new Date,gt(),bt()):null;m?ge.success(m.title,{description:m.description}):ge.success(e("gitView.publish.succeeded")),s({kind:k?"deletion":"push",origin:y})},l[4]=n,l[5]=e,l[6]=s,l[7]=u):u=l[7];const c=u;let p;return l[8]!==f||l[9]!==c?(p={committed:f,pushed:c},l[8]=f,l[9]=c,l[10]=p):p=l[10],p}function ii(l){const e=be.c(4),s=Et(),[n]=v.useState(_s);let h;return e[0]!==s||e[1]!==l||e[2]!==n?(h=(s?rs(s,n.at,n.seed):null)??l,e[0]=s,e[1]=l,e[2]=n,e[3]=h):h=e[3],h}function _s(){return{at:new Date,seed:Math.floor(Math.random()*1e3)}}export{Ys as C,Qs as D,ti as I,ei as R,si as a,Zs as b,Js as c,ws as d,ii as u};
@@ -1,4 +1,4 @@
1
- import{f as Ce,r as se,j as s,R as V}from"./vendor-react--VO_rL_p.js";import{u as le,a2 as te,U as ce,B as ee,I as Q,af as oe,ag as ae,ae as re,P as je,d2 as ve,d3 as we,az as ye,d4 as Se,d5 as Ne,d6 as ke,d7 as De,d8 as Ie,d9 as de,z as me,da as Le,db as Te,dc as Ee,a0 as ue,bO as ze,dd as ie,de as Re,df as Pe,dg as fe,A as he,dh as _e}from"./useAppFontEffects-CpxtKEGw.js";import{a4 as Me,a5 as Ae,a6 as $e}from"./ReceivedPagePanel-CCDFxXT4.js";import{a9 as xe,W as Fe}from"./katex.min-B3YMLLh4.js";const pe="inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-interactive-hover hover:text-foreground";function Je(r){const e=Ce.c(79),{draft:l,onEdit:y,onDelete:f,className:p,maxWidth:Z,forAgent:Y}=r,C=Y===void 0?false:Y,{t:n}=le(),[g,U]=se.useState(false),S=l.text;let B;e[0]!==S?(B=S.length>150||S.split(`
1
+ import{f as Ce,r as se,j as s,R as V}from"./vendor-react--VO_rL_p.js";import{u as le,a2 as te,U as ce,B as ee,I as Q,af as oe,ag as ae,ae as re,P as je,d2 as ve,d3 as we,az as ye,d4 as Se,d5 as Ne,d6 as ke,d7 as De,d8 as Ie,d9 as de,z as me,da as Le,db as Te,dc as Ee,a0 as ue,bO as ze,dd as ie,de as Re,df as Pe,dg as fe,A as he,dh as _e}from"./useAppFontEffects-BDLOJuy5.js";import{a4 as Me,a5 as Ae,a6 as $e}from"./ReceivedPagePanel-CfXyzCii.js";import{a9 as xe,W as Fe}from"./katex.min-DklPh68d.js";const pe="inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-interactive-hover hover:text-foreground";function Je(r){const e=Ce.c(79),{draft:l,onEdit:y,onDelete:f,className:p,maxWidth:Z,forAgent:Y}=r,C=Y===void 0?false:Y,{t:n}=le(),[g,U]=se.useState(false),S=l.text;let B;e[0]!==S?(B=S.length>150||S.split(`
2
2
  `).length>3,e[0]=S,e[1]=B):B=e[1];const N=B;let T;e[2]!==p?(T=te("w-full max-w-[min(100%,calc(var(--oc-context-panel-width,100vw)-var(--oc-editor-gutter-width,0px)))] overflow-hidden rounded-xl border border-[var(--interactive-border)] bg-[var(--surface-elevated)] shadow-none",p),e[2]=p,e[3]=T):T=e[3];const m=Z?`${Math.max(200,Math.floor(Z))}px`:void 0;let c;e[4]!==m?(c={maxWidth:m},e[4]=m,e[5]=c):c=e[5];let A;e[6]!==C?(A=C?s.jsx(Q,{name:"attachment-2",className:"size-3.5 shrink-0 text-muted-foreground"}):null,e[6]=C,e[7]=A):A=e[7];let o;e[8]!==l.fileLabel||e[9]!==C||e[10]!==n?(o=C?n("review.card.forAgent"):l.fileLabel,e[8]=l.fileLabel,e[9]=C,e[10]=n,e[11]=o):o=e[11];let $;e[12]!==l.fileLabel||e[13]!==o?($=s.jsx("span",{className:"min-w-0 max-w-[200px] truncate text-xs font-medium text-foreground",title:l.fileLabel,children:o}),e[12]=l.fileLabel,e[13]=o,e[14]=$):$=e[14];let F;e[15]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"\u2022"}),e[15]=F):F=e[15];let E;e[16]!==l?(E=ce(l)?"shrink-0":"min-w-0 truncate",e[16]=l,e[17]=E):E=e[17];let i;e[18]!==E?(i=te("me-auto text-xs text-muted-foreground",E),e[18]=E,e[19]=i):i=e[19];let z;e[20]!==l||e[21]!==n?(z=ce(l)?n("inlineComment.range.wholeFile"):s.jsxs(s.Fragment,{children:[n("inlineComment.range.lines",{start:l.startLine,end:l.endLine}),l.side?` (${l.side})`:""]}),e[20]=l,e[21]=n,e[22]=z):z=e[22];let d;e[23]!==i||e[24]!==z?(d=s.jsx("span",{className:i,children:z}),e[23]=i,e[24]=z,e[25]=d):d=e[25];let K;e[26]===Symbol.for("react.memo_cache_sentinel")?(K={minHeight:0,minWidth:0},e[26]=K):K=e[26];let j;e[27]!==n?(j=n("inlineComment.actions.editComment"),e[27]=n,e[28]=j):j=e[28];let R;e[29]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Q,{name:"pencil",className:"h-3 w-3"}),e[29]=R):R=e[29];let h;e[30]!==y||e[31]!==j?(h=s.jsx(oe,{asChild:true,children:s.jsx("button",{type:"button",className:pe,style:K,onClick:y,"aria-label":j,children:R})}),e[30]=y,e[31]=j,e[32]=h):h=e[32];let P;e[33]!==n?(P=n("inlineComment.actions.editComment"),e[33]=n,e[34]=P):P=e[34];let O;e[35]!==P?(O=s.jsx(ae,{side:"top",sideOffset:6,children:P}),e[35]=P,e[36]=O):O=e[36];let k;e[37]!==h||e[38]!==O?(k=s.jsxs(re,{children:[h,O]}),e[37]=h,e[38]=O,e[39]=k):k=e[39];let D;e[40]===Symbol.for("react.memo_cache_sentinel")?(D={minHeight:0,minWidth:0},e[40]=D):D=e[40];let v;e[41]!==n?(v=n("inlineComment.actions.deleteComment"),e[41]=n,e[42]=v):v=e[42];let J;e[43]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(Q,{name:"close",className:"h-3 w-3"}),e[43]=J):J=e[43];let _;e[44]!==f||e[45]!==v?(_=s.jsx(oe,{asChild:true,children:s.jsx("button",{type:"button",className:pe,style:D,onClick:f,"aria-label":v,children:J})}),e[44]=f,e[45]=v,e[46]=_):_=e[46];let w;e[47]!==n?(w=n("inlineComment.actions.deleteComment"),e[47]=n,e[48]=w):w=e[48];let I;e[49]!==w?(I=s.jsx(ae,{side:"top",sideOffset:6,children:w}),e[49]=w,e[50]=I):I=e[50];let H;e[51]!==_||e[52]!==I?(H=s.jsxs(re,{children:[_,I]}),e[51]=_,e[52]=I,e[53]=H):H=e[53];let L;e[54]!==d||e[55]!==k||e[56]!==H||e[57]!==A||e[58]!==$?(L=s.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-2",children:[A,$,F,d,k,H]}),e[54]=d,e[55]=k,e[56]=H,e[57]=A,e[58]=$,e[59]=L):L=e[59];const q=g||!N,X=!g&&N&&"line-clamp-3";let a;e[60]!==X?(a=te("whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground",X),e[60]=X,e[61]=a):a=e[61];let u;e[62]!==S||e[63]!==a?(u=s.jsx("div",{className:a,children:S}),e[62]=S,e[63]=a,e[64]=u):u=e[64];let b;e[65]!==N||e[66]!==g||e[67]!==n?(b=N&&s.jsx(Me,{asChild:true,children:s.jsx(ee,{variant:"ghost",size:"sm",className:"mt-1 h-6 w-full justify-start px-0 text-xs text-muted-foreground hover:text-foreground",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Q,{name:"arrow-up-s",className:"me-1 size-3"}),n("inlineComment.actions.showLess")]}):s.jsxs(s.Fragment,{children:[s.jsx(Q,{name:"arrow-down-s",className:"me-1 size-3"}),n("inlineComment.actions.showMore")]})})}),e[65]=N,e[66]=g,e[67]=n,e[68]=b):b=e[68];let G;e[69]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx(Ae,{}),e[69]=G):G=e[69];let W;e[70]!==q||e[71]!==u||e[72]!==b?(W=s.jsx("div",{className:"px-3 pb-2 pt-1",children:s.jsxs($e,{open:q,onOpenChange:U,children:[u,b,G]})}),e[70]=q,e[71]=u,e[72]=b,e[73]=W):W=e[73];let t;return e[74]!==L||e[75]!==T||e[76]!==W||e[77]!==c?(t=s.jsxs("div",{className:T,style:c,"data-comment-card":"true",children:[L,W]}),e[74]=L,e[75]=T,e[76]=W,e[77]=c,e[78]=t):t=e[78],t}const Ke=120,Oe=r=>r.split("/").pop()||r;function Qe({initialText:r="",onTextChange:e,onSave:l,onCancel:y,fileLabel:f,lineRange:p,isEditing:Z=false,className:Y,maxWidth:C,bandColor:n,floating:g=false,band:U=true,wholeFile:S=false,saveLabel:B,saving:N=false,review:T}){const{t:m}=le(),{isMobile:c}=je(),A=ve(we(),"diff"),[o,$]=V.useState(r),[F,E]=V.useState(false),i=se.useRef(null),z=ye("enter"),d=()=>{const t=i.current;t&&(t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,Ke)}px`)},K=t=>{$(t),e?.(t)};V.useLayoutEffect(d,[o]);const j=se.useRef(p);se.useEffect(()=>{p&&(j.current=p)},[p]);const R=t=>{if(!t)return;const x=Math.min(t.start,t.end),M=Math.max(t.start,t.end);return{...t,start:x,end:M}},h=R(p),P=S?m("inlineComment.range.wholeFile"):h?h.start===h.end?m("review.range.line",{line:h.start}):m("inlineComment.range.lines",{start:h.start,end:h.end}):null,O=[f,h?m("inlineComment.range.lines",{start:h.start,end:h.end}):null].filter(Boolean).join(" \u2022 ")||m("inlineComment.actions.comment");se.useEffect(()=>{const t=i.current;if(!t)return;t.focus({preventScroll:true});const x=t.value.length;t.setSelectionRange(x,x),c&&t.scrollIntoView({behavior:"auto",block:"nearest"})},[c]);const k=Se(),D=se.useRef(null);V.useLayoutEffect(()=>{const t=D.current;t!==null&&(D.current=null,i.current?.setSelectionRange(t,t))},[o]);const v=(t,x,M)=>{const ne=i.current?.value??o;D.current=t+M.length,K(`${ne.slice(0,t)}${M}${ne.slice(x)}`),i.current?.focus()},J=V.useCallback(()=>i.current?.selectionStart??0,[]),_=V.useCallback(t=>i.current?Ne(i.current,t):null,[]),w=ke({text:o,getCaret:J,replaceRange:v,caretCoords:_}),I=De(),H=t=>{const x=t.currentTarget,M=k.takePastedImages(t.clipboardData,x.value,{start:x.selectionStart,end:x.selectionEnd});M&&(t.preventDefault(),v(M.from,M.to,M.insertion))},L=()=>{if(o.trim()&&!N){if(l(o,R(j.current))===false)return;k.attachCitedImages(o)}},q=t=>{Le(t)||w.handleKeyDown(t)||(t.key==="Enter"&&I.shouldSubmit(t)?(t.preventDefault(),L()):t.key==="Escape"&&(t.preventDefault(),y()))},X=async()=>{if(!(!T||!o.trim()||F)){E(true);try{await T.add(o,R(j.current))}finally{E(false)}}},a=T?.suggestionCode,u=()=>{if(!a)return;const t=i.current,x=t?.selectionStart??o.length,M=t?.selectionEnd??o.length,ne=x>0&&o[x-1]!==`
3
3
  `?`
4
4
  `:"";v(x,M,`${ne}\`\`\`suggestion
@@ -1 +1 @@
1
- import{a as y,R,f as C}from"./vendor-react--VO_rL_p.js";import{bn as A}from"./useAppFontEffects-CpxtKEGw.js";const d="data-oc-block-index",g="data-oc-block-key",L=s=>{const e=s.ownerDocument.defaultView;for(let t=s.parentElement;t&&e;t=t.parentElement)if(/auto|scroll/.test(e.getComputedStyle(t).overflowY))return t;return null},w=(s,e)=>{if(!s)return 0;const t=Number.parseFloat(s.ownerDocument.defaultView?.getComputedStyle(s)[e]??"");return Number.isFinite(t)?t:0},E=s=>Array.from(s.querySelectorAll("video, audio")).some(e=>e instanceof HTMLMediaElement&&!e.paused),D=(s,e)=>{let t=5381;for(let n=0;n<e.length;n+=1)t=(t<<5)+t+e.charCodeAt(n)|0;return`${s}:${e.length}:${t>>>0}`},p=new WeakMap,M=24;class N{container=null;scroller=null;attached=!1;near=new Set;pins=new Map;holds=0;selecting=!1;selectionRelease=null;sizes=new Map;kept=new Set;listeners=new Set;stop=null;frame=null;charsPerLine=80;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});isRendered(e){return this.attached?!this.scroller||this.holds>0||this.near.has(e)||this.pins.has(e):e<M}size(e){return this.sizes.get(e)}attach(e){this.detach(),this.container=e,this.scroller=L(e),this.attached=!0,p.set(e,this);const t=this.scroller;if(!t){this.notify();return}const n=e.ownerDocument,i=n.defaultView,r=()=>this.update(),c=()=>{this.frame!==null||!i||(this.frame=i.requestAnimationFrame(()=>{this.frame=null,this.update()}))},l=globalThis.ResizeObserver?new ResizeObserver(()=>{this.charsPerLine=Math.max(20,Math.round(e.clientWidth/7.5)),this.update(),c()}):null;l?.observe(t),l?.observe(e),this.charsPerLine=Math.max(20,Math.round(e.clientWidth/7.5)),c();const u=()=>{const a=n.getSelection(),h=a&&!a.isCollapsed&&a.rangeCount>0?a.getRangeAt(0):null,o=!!(h&&(e.contains(h.commonAncestorContainer)||h.intersectsNode(e)));h&&o&&!this.selectionRelease&&this.spansUnmounted(h)?this.selectionRelease=this.hold(void 0):!o&&this.selectionRelease&&(this.selectionRelease(),this.selectionRelease=null),o!==this.selecting&&(this.selecting=o,o||this.update())},f=a=>{if(!(a.target instanceof Element)||!a.target.closest("summary"))return;const h=a.target.closest(`[${d}]`)?.getAttribute(g);h&&this.kept.add(h)};t.addEventListener("scroll",r,{passive:!0}),e.addEventListener("click",f,!0),n.addEventListener("selectionchange",u),this.stop=()=>{this.frame!==null&&i?.cancelAnimationFrame(this.frame),this.frame=null,l?.disconnect(),t.removeEventListener("scroll",r),e.removeEventListener("click",f,!0),n.removeEventListener("selectionchange",u)}}detach(){this.stop?.(),this.stop=null,this.container&&p.delete(this.container),this.container=null,this.scroller=null;const e=this.selectionRelease;this.selectionRelease=null,this.selecting=!1,e?.()}hold(e,t=!1){e===void 0?this.holds+=1:this.pins.set(e,(this.pins.get(e)??0)+1),this.notify(t);let n=!1;return()=>{if(!n){if(n=!0,e===void 0)this.holds-=1;else{const i=(this.pins.get(e)??1)-1;i>0?this.pins.set(e,i):this.pins.delete(e)}this.update(),this.notify()}}}update(){const e=this.container,t=this.scroller,n=e?.querySelector("[data-oc-streamdown]");if(!e||!t||!n)return;const i=Array.from(n.children).filter(o=>o instanceof HTMLElement&&o.hasAttribute(d)),r=t.getBoundingClientRect();if(r.height===0)return;const c=r.top-r.height,l=r.bottom+r.height;let u=0,f=i.length;for(;u<f;){const o=u+f>>1;i[o].getBoundingClientRect().bottom<c?u=o+1:f=o}const a=new Set;for(let o=u;o<i.length&&!(i[o].getBoundingClientRect().top>l);o+=1)a.add(Number(i[o].getAttribute(d)));if(this.selecting)for(const o of this.near)a.add(o);if(this.holds===0)for(const o of i){const m=Number(o.getAttribute(d));a.has(m)||this.pins.has(m)||(this.isLive(o)?a.add(m):this.measure(o))}const h=a.size!==this.near.size||[...a].some(o=>!this.near.has(o));this.near=a,h&&this.notify()}isLive(e){if(e.hasAttribute("data-oc-block-placeholder"))return!1;const t=e.getAttribute(g);return t!==null&&this.kept.has(t)||E(e)}spansUnmounted(e){const t=r=>{const l=(r instanceof Element?r:r.parentElement)?.closest(`[${d}]`);return l&&this.container?.contains(l)?Number(l.getAttribute(d)):null},n=t(e.startContainer),i=t(e.endContainer);if(n===null||i===null)return!!this.container?.querySelector("[data-oc-block-placeholder]");for(let r=n;r<=i;r+=1)if(!this.isRendered(r))return!0;return!1}measure(e){const t=e.getAttribute(g);!t||e.hasAttribute("data-oc-block-placeholder")||this.sizes.set(t,{height:e.getBoundingClientRect().height,start:w(e.firstElementChild,"marginBlockStart"),end:w(e.lastElementChild,"marginBlockEnd")})}notify(e=!1){const t=()=>{for(const n of this.listeners)n()};e?y.flushSync(t):t()}}const b=s=>{const e=s.closest("[data-markdown-content]")??s.querySelector("[data-markdown-content]");return e?p.get(e):void 0},x=s=>b(s)!==void 0,v=(s,e={})=>{const t=b(s);if(!t)return()=>{};const n=e.block?.getAttribute(d);return t.hold(n==null?void 0:Number(n),e.sync)},K=R.createContext(null),S=s=>!!s.trim()&&!s.startsWith("#")&&!s.startsWith("//")&&!/^[a-z][a-z\d+.-]*:/i.test(s),k=s=>{try{return decodeURIComponent(s)}catch{return s}},B=(s,e)=>A(s.slice(0,s.lastIndexOf("/")+1)||"/",k(e.split(/[?#]/,1)[0]??"")),W=(s,e)=>{if(!e||s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey)return!1;const t=s.currentTarget.getAttribute("href")??"";if(t.startsWith("#")){s.preventDefault(),s.stopPropagation();const n=k(t.slice(1)).toLowerCase(),i=s.currentTarget.closest("[data-markdown-content]"),r=i?v(i,{sync:!0}):null;for(const c of i?.querySelectorAll("h1,h2,h3,h4,h5,h6")??[]){const l=(c.textContent??"").trim().toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").replace(/\s+/g,"-");if(n&&(c.id===n||l===n)){c.scrollIntoView({block:"start"});break}}return r?.(),!0}return S(t)?(s.preventDefault(),s.stopPropagation(),e.onOpenFile(B(e.filePath,t)),!0):!1},F=s=>{const e=C.c(6),{filePath:t,workspaceRoot:n,onOpenFile:i,enabled:r,colorScheme:c}=s;let l;return e[0]!==c||e[1]!==r||e[2]!==t||e[3]!==i||e[4]!==n?(l=r&&t?{filePath:t,workspaceRoot:n,onOpenFile:i,colorScheme:c}:void 0,e[0]=c,e[1]=r,e[2]=t,e[3]=i,e[4]=n,e[5]=l):l=e[5],l};export{g as B,K as M,d as a,D as b,N as c,x as d,v as h,S as i,W as o,B as r,F as u};
1
+ import{a as y,R,f as C}from"./vendor-react--VO_rL_p.js";import{bn as A}from"./useAppFontEffects-BDLOJuy5.js";const d="data-oc-block-index",g="data-oc-block-key",L=s=>{const e=s.ownerDocument.defaultView;for(let t=s.parentElement;t&&e;t=t.parentElement)if(/auto|scroll/.test(e.getComputedStyle(t).overflowY))return t;return null},w=(s,e)=>{if(!s)return 0;const t=Number.parseFloat(s.ownerDocument.defaultView?.getComputedStyle(s)[e]??"");return Number.isFinite(t)?t:0},E=s=>Array.from(s.querySelectorAll("video, audio")).some(e=>e instanceof HTMLMediaElement&&!e.paused),D=(s,e)=>{let t=5381;for(let n=0;n<e.length;n+=1)t=(t<<5)+t+e.charCodeAt(n)|0;return`${s}:${e.length}:${t>>>0}`},p=new WeakMap,M=24;class N{container=null;scroller=null;attached=!1;near=new Set;pins=new Map;holds=0;selecting=!1;selectionRelease=null;sizes=new Map;kept=new Set;listeners=new Set;stop=null;frame=null;charsPerLine=80;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});isRendered(e){return this.attached?!this.scroller||this.holds>0||this.near.has(e)||this.pins.has(e):e<M}size(e){return this.sizes.get(e)}attach(e){this.detach(),this.container=e,this.scroller=L(e),this.attached=!0,p.set(e,this);const t=this.scroller;if(!t){this.notify();return}const n=e.ownerDocument,i=n.defaultView,r=()=>this.update(),c=()=>{this.frame!==null||!i||(this.frame=i.requestAnimationFrame(()=>{this.frame=null,this.update()}))},l=globalThis.ResizeObserver?new ResizeObserver(()=>{this.charsPerLine=Math.max(20,Math.round(e.clientWidth/7.5)),this.update(),c()}):null;l?.observe(t),l?.observe(e),this.charsPerLine=Math.max(20,Math.round(e.clientWidth/7.5)),c();const u=()=>{const a=n.getSelection(),h=a&&!a.isCollapsed&&a.rangeCount>0?a.getRangeAt(0):null,o=!!(h&&(e.contains(h.commonAncestorContainer)||h.intersectsNode(e)));h&&o&&!this.selectionRelease&&this.spansUnmounted(h)?this.selectionRelease=this.hold(void 0):!o&&this.selectionRelease&&(this.selectionRelease(),this.selectionRelease=null),o!==this.selecting&&(this.selecting=o,o||this.update())},f=a=>{if(!(a.target instanceof Element)||!a.target.closest("summary"))return;const h=a.target.closest(`[${d}]`)?.getAttribute(g);h&&this.kept.add(h)};t.addEventListener("scroll",r,{passive:!0}),e.addEventListener("click",f,!0),n.addEventListener("selectionchange",u),this.stop=()=>{this.frame!==null&&i?.cancelAnimationFrame(this.frame),this.frame=null,l?.disconnect(),t.removeEventListener("scroll",r),e.removeEventListener("click",f,!0),n.removeEventListener("selectionchange",u)}}detach(){this.stop?.(),this.stop=null,this.container&&p.delete(this.container),this.container=null,this.scroller=null;const e=this.selectionRelease;this.selectionRelease=null,this.selecting=!1,e?.()}hold(e,t=!1){e===void 0?this.holds+=1:this.pins.set(e,(this.pins.get(e)??0)+1),this.notify(t);let n=!1;return()=>{if(!n){if(n=!0,e===void 0)this.holds-=1;else{const i=(this.pins.get(e)??1)-1;i>0?this.pins.set(e,i):this.pins.delete(e)}this.update(),this.notify()}}}update(){const e=this.container,t=this.scroller,n=e?.querySelector("[data-oc-streamdown]");if(!e||!t||!n)return;const i=Array.from(n.children).filter(o=>o instanceof HTMLElement&&o.hasAttribute(d)),r=t.getBoundingClientRect();if(r.height===0)return;const c=r.top-r.height,l=r.bottom+r.height;let u=0,f=i.length;for(;u<f;){const o=u+f>>1;i[o].getBoundingClientRect().bottom<c?u=o+1:f=o}const a=new Set;for(let o=u;o<i.length&&!(i[o].getBoundingClientRect().top>l);o+=1)a.add(Number(i[o].getAttribute(d)));if(this.selecting)for(const o of this.near)a.add(o);if(this.holds===0)for(const o of i){const m=Number(o.getAttribute(d));a.has(m)||this.pins.has(m)||(this.isLive(o)?a.add(m):this.measure(o))}const h=a.size!==this.near.size||[...a].some(o=>!this.near.has(o));this.near=a,h&&this.notify()}isLive(e){if(e.hasAttribute("data-oc-block-placeholder"))return!1;const t=e.getAttribute(g);return t!==null&&this.kept.has(t)||E(e)}spansUnmounted(e){const t=r=>{const l=(r instanceof Element?r:r.parentElement)?.closest(`[${d}]`);return l&&this.container?.contains(l)?Number(l.getAttribute(d)):null},n=t(e.startContainer),i=t(e.endContainer);if(n===null||i===null)return!!this.container?.querySelector("[data-oc-block-placeholder]");for(let r=n;r<=i;r+=1)if(!this.isRendered(r))return!0;return!1}measure(e){const t=e.getAttribute(g);!t||e.hasAttribute("data-oc-block-placeholder")||this.sizes.set(t,{height:e.getBoundingClientRect().height,start:w(e.firstElementChild,"marginBlockStart"),end:w(e.lastElementChild,"marginBlockEnd")})}notify(e=!1){const t=()=>{for(const n of this.listeners)n()};e?y.flushSync(t):t()}}const b=s=>{const e=s.closest("[data-markdown-content]")??s.querySelector("[data-markdown-content]");return e?p.get(e):void 0},x=s=>b(s)!==void 0,v=(s,e={})=>{const t=b(s);if(!t)return()=>{};const n=e.block?.getAttribute(d);return t.hold(n==null?void 0:Number(n),e.sync)},K=R.createContext(null),S=s=>!!s.trim()&&!s.startsWith("#")&&!s.startsWith("//")&&!/^[a-z][a-z\d+.-]*:/i.test(s),k=s=>{try{return decodeURIComponent(s)}catch{return s}},B=(s,e)=>A(s.slice(0,s.lastIndexOf("/")+1)||"/",k(e.split(/[?#]/,1)[0]??"")),W=(s,e)=>{if(!e||s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey)return!1;const t=s.currentTarget.getAttribute("href")??"";if(t.startsWith("#")){s.preventDefault(),s.stopPropagation();const n=k(t.slice(1)).toLowerCase(),i=s.currentTarget.closest("[data-markdown-content]"),r=i?v(i,{sync:!0}):null;for(const c of i?.querySelectorAll("h1,h2,h3,h4,h5,h6")??[]){const l=(c.textContent??"").trim().toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").replace(/\s+/g,"-");if(n&&(c.id===n||l===n)){c.scrollIntoView({block:"start"});break}}return r?.(),!0}return S(t)?(s.preventDefault(),s.stopPropagation(),e.onOpenFile(B(e.filePath,t)),!0):!1},F=s=>{const e=C.c(6),{filePath:t,workspaceRoot:n,onOpenFile:i,enabled:r,colorScheme:c}=s;let l;return e[0]!==c||e[1]!==r||e[2]!==t||e[3]!==i||e[4]!==n?(l=r&&t?{filePath:t,workspaceRoot:n,onOpenFile:i,colorScheme:c}:void 0,e[0]=c,e[1]=r,e[2]=t,e[3]=i,e[4]=n,e[5]=l):l=e[5],l};export{g as B,K as M,d as a,D as b,N as c,x as d,v as h,S as i,W as o,B as r,F as u};
@@ -1 +1 @@
1
- import{f as $,R as M,r as ce,j as o}from"./vendor-react--VO_rL_p.js";import{u as B,aD as de,aE as me,aF as ue,ay as W,aG as fe,aH as ne,aI as pe}from"./katex.min-B3YMLLh4.js";import{u as ee,a2 as G,I as F,a6 as he,a7 as xe,a5 as we,a0 as K,fW as ge,fX as be,fB as Se,fY as ye,n as ve,fZ as _e,f_ as je,f$ as Ce,ay as Ne,g0 as ke,c_ as Ie,cX as ze,b4 as De,x as se}from"./useAppFontEffects-CpxtKEGw.js";import{M as re}from"./vendor-base-ui-CHqK1aDI.js";import{o as oe,a as Ee,h as Le,s as Fe}from"./vendor-zod-DV_WH382.js";function ut(){const n=$.c(5),e=B(Te);let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t=de(),n[0]=t):t=n[0];const m=t;let r;n[1]!==e?(r=me(e),n[1]=e,n[2]=r):r=n[2];const a=r;let s;return n[3]!==a?(s={usesFramelessChrome:m,side:a},n[3]=a,n[4]=s):s=n[4],s}function Te(n){return n.desktopWindowControlsPosition}const Oe={close:"#FF5F57",minimize:"#FEBC2E",maximize:"#28C940"},Pe="rgba(0, 0, 0, 0.7)",Re=n=>{const e=$.c(3),{action:t}=n;if(t==="close"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(F,{name:"close",className:"size-[10px]"}),e[0]=r):r=e[0],r}if(t==="minimize"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(F,{name:"subtract",className:"size-[10px]"}),e[1]=r):r=e[1],r}let m;return e[2]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(F,{name:"add",className:"size-[10px]"}),e[2]=m):m=e[2],m},$e=n=>{const e=$.c(18),{action:t,isMaximized:m,onActivate:r}=n,{t:a}=ee(),s=Oe[t];let l;e[0]!==t||e[1]!==m||e[2]!==a?(l=a(t==="close"?"header.windowControls.close":t==="minimize"?"header.windowControls.minimize":m?"header.windowControls.restore":"header.windowControls.maximize"),e[0]=t,e[1]=m,e[2]=a,e[3]=l):l=e[3];const h=l;let c;e[4]!==t||e[5]!==r?(c=()=>r(t),e[4]=t,e[5]=r,e[6]=c):c=e[6];let i;e[7]!==s?(i={backgroundColor:s,color:Pe},e[7]=s,e[8]=i):i=e[8];let d;e[9]!==t?(d=o.jsx("span",{className:"flex items-center justify-center opacity-0 transition-opacity duration-75 group-hover/wctl:opacity-100",children:o.jsx(Re,{action:t})}),e[9]=t,e[10]=d):d=e[10];let f;e[11]!==i||e[12]!==d?(f=o.jsx("span",{className:"flex size-3.5 items-center justify-center rounded-full shadow-[inset_0_0_0_0.5px_rgba(0,0,0,0.28)] transition-[filter] duration-75 active:brightness-90",style:i,children:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let u;return e[14]!==h||e[15]!==c||e[16]!==f?(u=o.jsx("button",{type:"button",onClick:c,title:h,"aria-label":h,className:"app-region-no-drag flex h-8 w-[24px] items-center justify-center rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:f}),e[14]=h,e[15]=c,e[16]=f,e[17]=u):u=e[17],u},ft=M.memo(function(e){const t=$.c(27),{visible:m,position:r}=e,a=r===void 0?"right":r,{t:s}=ee(),[l,h]=M.useState(!1),c=B(Ae);let i,d;if(t[0]!==m?(i=()=>{if(!m)return;let N=!1;W("desktop_get_current_window_state").then(v=>{N||h(!!v?.maximized)}).catch(Me);const k=v=>{const C=v.detail;h(!!C?.maximized)};return window.addEventListener("openchamber:window-maximized-changed",k),()=>{N=!0,window.removeEventListener("openchamber:window-maximized-changed",k)}},d=[m],t[0]=m,t[1]=i,t[2]=d):(i=t[1],d=t[2]),ce.useEffect(i,d),!m)return null;const f=a==="left";let u,g,p,x,w;if(t[3]!==c||t[4]!==f||t[5]!==l||t[6]!==a||t[7]!==s){w=Symbol.for("react.early_return_sentinel");e:{const N=ue(a);let k;t[13]===Symbol.for("react.memo_cache_sentinel")?(k=S=>{if(S==="close"){W("desktop_close_current_window");return}if(S==="minimize"){W("desktop_minimize_current_window");return}W("desktop_toggle_current_window_maximized").then(y=>h(!!y?.maximized)).catch(We)},t[13]=k):k=t[13];const v=k;if(c==="traffic-lights"){const S=f?"me-1":"ms-1 me-3";let y;t[14]!==S?(y=G("app-region-no-drag group/wctl flex h-8 shrink-0 items-center",S),t[14]=S,t[15]=y):y=t[15];let D;t[16]!==s?(D=s("header.windowControls.groupAria"),t[16]=s,t[17]=D):D=t[17];let _;t[18]!==l?(_=I=>o.jsx($e,{action:I,isMaximized:l,onActivate:v},I),t[18]=l,t[19]=_):_=t[19],w=o.jsx("div",{dir:"ltr",className:y,"aria-label":D,children:N.map(_)});break e}const C=G("app-region-no-drag inline-flex items-center justify-center text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",f?"h-8 w-8 rounded-md":"h-12 w-11"),O=f?"app-region-no-drag me-1 flex h-8 shrink-0 items-center":"app-region-no-drag ms-1 flex h-12 shrink-0 items-center",T=S=>S==="minimize"?o.jsx("button",{type:"button",className:C,onClick:Be,title:s("header.windowControls.minimize"),"aria-label":s("header.windowControls.minimize"),children:o.jsx(F,{name:"subtract",className:"h-4 w-4"})},"minimize"):S==="maximize"?o.jsx("button",{type:"button",className:C,onClick:()=>{W("desktop_toggle_current_window_maximized").then(y=>h(!!y?.maximized)).catch(Ge)},title:s(l?"header.windowControls.restore":"header.windowControls.maximize"),"aria-label":s(l?"header.windowControls.restore":"header.windowControls.maximize"),children:o.jsx(F,{name:l?"fullscreen-exit":"checkbox-blank",className:"h-3.5 w-3.5"})},"maximize"):o.jsx("button",{type:"button",className:G(C,"hover:bg-[var(--status-error)] hover:text-[var(--status-error-foreground)]"),onClick:Ue,title:s("header.windowControls.close"),"aria-label":s("header.windowControls.close"),children:o.jsx(F,{name:"close",className:"h-4 w-4"})},"close");u="ltr",g=O,t[20]!==s?(p=s("header.windowControls.groupAria"),t[20]=s,t[21]=p):p=t[21],x=N.map(T)}t[3]=c,t[4]=f,t[5]=l,t[6]=a,t[7]=s,t[8]=u,t[9]=g,t[10]=p,t[11]=x,t[12]=w}else u=t[8],g=t[9],p=t[10],x=t[11],w=t[12];if(w!==Symbol.for("react.early_return_sentinel"))return w;let b;return t[22]!==u||t[23]!==g||t[24]!==p||t[25]!==x?(b=o.jsx("div",{dir:u,className:g,"aria-label":p,children:x}),t[22]=u,t[23]=g,t[24]=p,t[25]=x,t[26]=b):b=t[26],b});function Ae(n){return n.desktopWindowControlsStyle}function Me(){}function We(){}function Be(){W("desktop_minimize_current_window")}function Ge(){}function Ue(){W("desktop_close_current_window")}const te="new-session",Ze=10;function pt(n){const e=$.c(19),{children:t,variant:m,scopeProjectId:r,align:a,recentOnly:s}=n,l=m===void 0?"default":m,h=r===void 0?null:r,c=a===void 0?"start":a,i=s===void 0?!1:s,d=B(Ye),f=B(He);let u;e[0]!==t?(u=o.jsx(he,{asChild:!0,children:t}),e[0]=t,e[1]=u):u=e[1];const g=l==="compact"?"w-[280px]":"w-[360px]";let p;e[2]!==g?(p=G("overflow-hidden p-1 max-w-[calc(100vw-32px)]",g),e[2]=g,e[3]=p):p=e[3];let x;e[4]!==d||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==l?(x=d?o.jsx(qe,{onSelect:()=>f(!1),variant:l,scopeProjectId:h,recentOnly:i}):null,e[4]=d,e[5]=i,e[6]=h,e[7]=f,e[8]=l,e[9]=x):x=e[9];let w;e[10]!==c||e[11]!==p||e[12]!==x?(w=o.jsx(xe,{align:c,sideOffset:6,className:p,children:x}),e[10]=c,e[11]=p,e[12]=x,e[13]=w):w=e[13];let b;return e[14]!==d||e[15]!==f||e[16]!==u||e[17]!==w?(b=o.jsxs(we,{open:d,onOpenChange:f,modal:!1,disableGlobalShortcuts:!0,children:[u,w]}),e[14]=d,e[15]=f,e[16]=u,e[17]=w,e[18]=b):b=e[18],b}function He(n){return n.setSessionDropdownOpen}function Ye(n){return n.isSessionDropdownOpen}function qe(n){const e=$.c(34),{onSelect:t,variant:m,scopeProjectId:r,recentOnly:a}=n,s=K(Je),l=K(Xe);let h;e[0]!==s||e[1]!==r?(h={scopeProjectId:r,currentSessionId:s,maxParents:Ze,ignorePins:!0},e[0]=s,e[1]=r,e[2]=h):h=e[2];const c=ge(!0,h);let i,d;e[3]!==a?(i=()=>{a?be():Se()},d=[a],e[3]=a,e[4]=i,e[5]=d):(i=e[4],d=e[5]),M.useEffect(i,d);const f=K(Ve),{t:u}=ee();let g;e[6]!==t||e[7]!==f?(g=()=>{t(),f()},e[6]=t,e[7]=f,e[8]=g):g=e[8];const p=g;let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=new Set,e[9]=x):x=e[9];const[w,b]=M.useState(x),N=M.useRef(null),k=M.useRef(!1),v=l?te:s;let C;e[10]===Symbol.for("react.memo_cache_sentinel")?(C=z=>{b(R=>{const j=new Set(R);return j.has(z)?j.delete(z):j.add(z),j})},e[10]=C):C=e[10];const O=C;let T,S;e[11]!==w||e[12]!==v||e[13]!==c?(T=()=>{if(k.current||!v)return;const z=v===te?[]:ye(c,v);if(!z)return;if(z.some(j=>!w.has(j))){b(j=>new Set([...j,...z]));return}const R=requestAnimationFrame(()=>{const j=Array.from(N.current?.querySelectorAll("[data-switcher-item-id]")??[]).find(A=>A.dataset.switcherItemId===v);j&&(j.focus(),j.scrollIntoView({block:"nearest"}),k.current=!0)});return()=>cancelAnimationFrame(R)},S=[w,v,c],e[11]=w,e[12]=v,e[13]=c,e[14]=T,e[15]=S):(T=e[14],S=e[15]),M.useLayoutEffect(T,S);let y,D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=G("group relative flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),y=o.jsx(F,{name:"chat-new",className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),e[16]=y,e[17]=D):(y=e[16],D=e[17]);let _;e[18]!==u?(_=u("sessions.sidebar.header.actions.newSession"),e[18]=u,e[19]=_):_=e[19];let I;e[20]!==_?(I=o.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:_}),e[20]=_,e[21]=I):I=e[21];let P;e[22]!==p||e[23]!==I?(P=o.jsxs(re,{"data-switcher-item-id":te,onClick:p,className:D,children:[y,I]}),e[22]=p,e[23]=I,e[24]=P):P=e[24];let E;e[25]!==w||e[26]!==c||e[27]!==t||e[28]!==u||e[29]!==m?(E=c.length===0?o.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:u("sessions.switcher.empty")}):c.map(z=>o.jsx(ie,{item:z,depth:0,variant:m,expandedParents:w,toggleParent:O,closeDropdown:t},z.node.session.id)),e[25]=w,e[26]=c,e[27]=t,e[28]=u,e[29]=m,e[30]=E):E=e[30];let U;return e[31]!==P||e[32]!==E?(U=o.jsx(ve,{ref:N,outerClassName:"max-h-[60vh]",disableHorizontal:!0,children:o.jsxs("div",{className:"space-y-0.5",children:[P,E]})}),e[31]=P,e[32]=E,e[33]=U):U=e[33],U}function Ve(n){return n.openNewSessionDraft}function Xe(n){return n.newSessionDraft.open===!0}function Je(n){return n.currentSessionId}function ie(n){const e=$.c(31),{item:t,depth:m,variant:r,expandedParents:a,toggleParent:s,closeDropdown:l}=n,{node:h,secondaryMeta:c}=t,i=h.session,d=h.children.length>0;let f;e[0]!==a||e[1]!==i.id?(f=a.has(i.id),e[0]=a,e[1]=i.id,e[2]=f):f=e[2];const u=f;let g;e[3]!==d||e[4]!==i.id||e[5]!==s?(g=d?()=>s(i.id):void 0,e[3]=d,e[4]=i.id,e[5]=s,e[6]=g):g=e[6];let p;e[7]!==l||e[8]!==m||e[9]!==d||e[10]!==u||e[11]!==c||e[12]!==i||e[13]!==g||e[14]!==r?(p=o.jsx(Ke,{session:i,depth:m,variant:r,secondaryMeta:c,hasChildren:d,isExpanded:u,onToggleExpand:g,closeDropdown:l}),e[7]=l,e[8]=m,e[9]=d,e[10]=u,e[11]=c,e[12]=i,e[13]=g,e[14]=r,e[15]=p):p=e[15];let x;e[16]!==l||e[17]!==m||e[18]!==a||e[19]!==d||e[20]!==u||e[21]!==t.groupDirectory||e[22]!==t.projectId||e[23]!==h.children||e[24]!==c||e[25]!==s||e[26]!==r?(x=d&&u?h.children.map(b=>o.jsx(ie,{item:{node:b,projectId:t.projectId,groupDirectory:t.groupDirectory,secondaryMeta:c},depth:m+1,variant:r,expandedParents:a,toggleParent:s,closeDropdown:l},b.session.id)):null,e[16]=l,e[17]=m,e[18]=a,e[19]=d,e[20]=u,e[21]=t.groupDirectory,e[22]=t.projectId,e[23]=h.children,e[24]=c,e[25]=s,e[26]=r,e[27]=x):x=e[27];let w;return e[28]!==p||e[29]!==x?(w=o.jsxs(o.Fragment,{children:[p,x]}),e[28]=p,e[29]=x,e[30]=w):w=e[30],w}function Ke(n){const e=$.c(59),{session:t,depth:m,variant:r,secondaryMeta:a,hasChildren:s,isExpanded:l,onToggleExpand:h,closeDropdown:c}=n,{t:i}=ee(),d=K(et),f=K(Qe),u=_e(t.id),g=je(t.id),p=d===t.id;let x;e[0]!==t.title||e[1]!==i?(x=t.title?.trim()||i("sessions.sidebar.session.untitled"),e[0]=t.title,e[1]=i,e[2]=x):x=e[2];const w=x,b=Ce(t.id),N=b!==null,k=Ne(N),v=!N&&u&&(!p||g);let C;if(e[3]!==t){const L=ke(t)||Date.now();C=Ie(L),e[3]=t,e[4]=C}else C=e[4];const O=C;let T;e[5]!==a?.projectLabel?(T=a?.projectLabel?.trim()||null,e[5]=a?.projectLabel,e[6]=T):T=e[6];const S=T;let y;e[7]!==a?.branchLabel?(y=a?.branchLabel?.trim()||null,e[7]=a?.branchLabel,e[8]=y):y=e[8];const D=y,_=D&&D!=="HEAD"?D:null;let I;e[9]!==c||e[10]!==p||e[11]!==t||e[12]!==f?(I=()=>{if(p){c();return}const L=De(t);f(t.id,L??null),c()},e[9]=c,e[10]=p,e[11]=t,e[12]=f,e[13]=I):I=e[13];const P=I;let E;e[14]!==P?(E=L=>{if(L.target?.closest("[data-switcher-expand]")){L.preventDefault();return}P()},e[14]=P,e[15]=E):E=e[15];const U=t.id,z=p&&"bg-interactive-selection text-interactive-selection-foreground hover:bg-interactive-selection data-[highlighted]:bg-interactive-selection";let R;e[16]!==z?(R=G("group relative flex w-full cursor-pointer items-start gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover",z),e[16]=z,e[17]=R):R=e[17];const j=8+m*12;let A;e[18]!==j?(A={paddingInlineStart:j},e[18]=j,e[19]=A):A=e[19];let Z;e[20]!==s||e[21]!==l||e[22]!==h||e[23]!==i||e[24]!==r?(Z=r==="compact"&&s?o.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:L=>{L.preventDefault(),L.stopPropagation(),h?.()},className:"inline-flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground","aria-label":i(l?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:l?o.jsx(F,{name:"arrow-down-s",className:"h-3.5 w-3.5"}):o.jsx(F,{name:"arrow-right-s",className:"h-3.5 w-3.5"})}):null,e[20]=s,e[21]=l,e[22]=h,e[23]=i,e[24]=r,e[25]=Z):Z=e[25];let H;e[26]!==w?(H=o.jsx("span",{dir:"auto",className:"truncate oc-ui-start-align typography-ui-label font-normal leading-tight text-foreground",children:w}),e[26]=w,e[27]=H):H=e[27];let Y;e[28]!==Z||e[29]!==H?(Y=o.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[Z,H]}),e[28]=Z,e[29]=H,e[30]=Y):Y=e[30];let q;e[31]!==_||e[32]!==s||e[33]!==l||e[34]!==h||e[35]!==S||e[36]!==i||e[37]!==O||e[38]!==r?(q=r==="default"?o.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 truncate text-muted-foreground leading-tight",style:{fontSize:"calc(var(--text-ui-label) * 0.85)"},children:[s?o.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:L=>{L.preventDefault(),L.stopPropagation(),h?.()},className:"inline-flex h-3 w-3 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground","aria-label":i(l?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:l?o.jsx(F,{name:"arrow-down-s",className:"h-3 w-3"}):o.jsx(F,{name:"arrow-right-s",className:"h-3 w-3"})}):null,o.jsx("span",{className:"flex-shrink-0",children:O}),S?o.jsx("span",{className:"truncate",children:S}):null,_?o.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[o.jsx(F,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:_})]}):null]}):null,e[31]=_,e[32]=s,e[33]=l,e[34]=h,e[35]=S,e[36]=i,e[37]=O,e[38]=r,e[39]=q):q=e[39];let V;e[40]!==Y||e[41]!==q?(V=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[Y,q]}),e[40]=Y,e[41]=q,e[42]=V):V=e[42];let X;e[43]!==N||e[44]!==k||e[45]!==v||e[46]!==b?(X=N||v?o.jsx("span",{className:"flex h-3 w-3 flex-shrink-0 items-center justify-center self-center",children:o.jsx(ze,{state:b??"unread",runningClassName:G("h-2 w-2",k)})}):null,e[43]=N,e[44]=k,e[45]=v,e[46]=b,e[47]=X):X=e[47];let J;e[48]!==O||e[49]!==r?(J=r==="compact"?o.jsx("span",{className:"shrink-0 self-center typography-micro text-muted-foreground tabular-nums",children:O}):null,e[48]=O,e[49]=r,e[50]=J):J=e[50];let Q;return e[51]!==t.id||e[52]!==A||e[53]!==V||e[54]!==X||e[55]!==J||e[56]!==E||e[57]!==R?(Q=o.jsxs(re,{onClick:E,"data-slot":"session-switcher-item","data-switcher-item-id":U,className:R,style:A,children:[V,X,J]}),e[51]=t.id,e[52]=A,e[53]=V,e[54]=X,e[55]=J,e[56]=E,e[57]=R,e[58]=Q):Q=e[58],Q}function Qe(n){return n.setCurrentSession}function et(n){return n.currentSessionId}const ht=n=>!Number.isFinite(n)||n<=0?new Intl.NumberFormat(se(),{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(0):new Intl.NumberFormat(se(),{style:"currency",currency:"USD",minimumFractionDigits:n<.01?4:2,maximumFractionDigits:n<.01?4:2}).format(n),tt="ui-store",nt=oe({state:oe({contextSurfaceZones:Ee(Fe(),Le())})}),st=n=>{if(!n)return null;let e;try{e=JSON.parse(n)}catch{return null}const t=nt.safeParse(e);return t.success?pe.parse(t.data.state.contextSurfaceZones):null},xt=()=>{const n=e=>{if(e.key!==tt)return;const t=st(e.newValue);if(!t)return;const m=B.getState().contextSurfaceZones,r=new Set([...Object.keys(m),...Object.keys(t)].filter(fe));for(const a of r){const s=ne(t,a);s!==ne(B.getState().contextSurfaceZones,a)&&B.getState().moveContextSurfaceToZone(a,s)}};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)},ae=()=>{const n=[document.documentElement,document.body],e=document.getElementById("root");return e&&n.push(e),n},le=()=>{let n=!1;for(const e of ae())e.scrollTop!==0&&(e.scrollTop=0,n=!0),e.scrollLeft!==0&&(e.scrollLeft=0,n=!0);return n},ot=n=>n===document||ae().some(e=>e===n),wt=()=>{const n=$.c(1);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],n[0]=e):e=n[0],M.useEffect(it,e)};function rt(n){ot(n.target)&&le()}function it(){const n=rt;return document.addEventListener("scroll",n,{capture:!0,passive:!0}),le(),()=>document.removeEventListener("scroll",n,{capture:!0})}export{pt as S,ft as W,xt as a,wt as b,ht as f,ut as u};
1
+ import{f as $,R as M,r as ce,j as o}from"./vendor-react--VO_rL_p.js";import{u as B,aD as de,aE as me,aF as ue,ay as W,aG as fe,aH as ne,aI as pe}from"./katex.min-DklPh68d.js";import{u as ee,a2 as G,I as F,a6 as he,a7 as xe,a5 as we,a0 as K,fW as ge,fX as be,fB as Se,fY as ye,n as ve,fZ as _e,f_ as je,f$ as Ce,ay as Ne,g0 as ke,c_ as Ie,cX as ze,b4 as De,x as se}from"./useAppFontEffects-BDLOJuy5.js";import{M as re}from"./vendor-base-ui-CHqK1aDI.js";import{o as oe,a as Ee,h as Le,s as Fe}from"./vendor-zod-DV_WH382.js";function ut(){const n=$.c(5),e=B(Te);let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t=de(),n[0]=t):t=n[0];const m=t;let r;n[1]!==e?(r=me(e),n[1]=e,n[2]=r):r=n[2];const a=r;let s;return n[3]!==a?(s={usesFramelessChrome:m,side:a},n[3]=a,n[4]=s):s=n[4],s}function Te(n){return n.desktopWindowControlsPosition}const Oe={close:"#FF5F57",minimize:"#FEBC2E",maximize:"#28C940"},Pe="rgba(0, 0, 0, 0.7)",Re=n=>{const e=$.c(3),{action:t}=n;if(t==="close"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(F,{name:"close",className:"size-[10px]"}),e[0]=r):r=e[0],r}if(t==="minimize"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(F,{name:"subtract",className:"size-[10px]"}),e[1]=r):r=e[1],r}let m;return e[2]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(F,{name:"add",className:"size-[10px]"}),e[2]=m):m=e[2],m},$e=n=>{const e=$.c(18),{action:t,isMaximized:m,onActivate:r}=n,{t:a}=ee(),s=Oe[t];let l;e[0]!==t||e[1]!==m||e[2]!==a?(l=a(t==="close"?"header.windowControls.close":t==="minimize"?"header.windowControls.minimize":m?"header.windowControls.restore":"header.windowControls.maximize"),e[0]=t,e[1]=m,e[2]=a,e[3]=l):l=e[3];const h=l;let c;e[4]!==t||e[5]!==r?(c=()=>r(t),e[4]=t,e[5]=r,e[6]=c):c=e[6];let i;e[7]!==s?(i={backgroundColor:s,color:Pe},e[7]=s,e[8]=i):i=e[8];let d;e[9]!==t?(d=o.jsx("span",{className:"flex items-center justify-center opacity-0 transition-opacity duration-75 group-hover/wctl:opacity-100",children:o.jsx(Re,{action:t})}),e[9]=t,e[10]=d):d=e[10];let f;e[11]!==i||e[12]!==d?(f=o.jsx("span",{className:"flex size-3.5 items-center justify-center rounded-full shadow-[inset_0_0_0_0.5px_rgba(0,0,0,0.28)] transition-[filter] duration-75 active:brightness-90",style:i,children:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let u;return e[14]!==h||e[15]!==c||e[16]!==f?(u=o.jsx("button",{type:"button",onClick:c,title:h,"aria-label":h,className:"app-region-no-drag flex h-8 w-[24px] items-center justify-center rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:f}),e[14]=h,e[15]=c,e[16]=f,e[17]=u):u=e[17],u},ft=M.memo(function(e){const t=$.c(27),{visible:m,position:r}=e,a=r===void 0?"right":r,{t:s}=ee(),[l,h]=M.useState(!1),c=B(Ae);let i,d;if(t[0]!==m?(i=()=>{if(!m)return;let N=!1;W("desktop_get_current_window_state").then(v=>{N||h(!!v?.maximized)}).catch(Me);const k=v=>{const C=v.detail;h(!!C?.maximized)};return window.addEventListener("openchamber:window-maximized-changed",k),()=>{N=!0,window.removeEventListener("openchamber:window-maximized-changed",k)}},d=[m],t[0]=m,t[1]=i,t[2]=d):(i=t[1],d=t[2]),ce.useEffect(i,d),!m)return null;const f=a==="left";let u,g,p,x,w;if(t[3]!==c||t[4]!==f||t[5]!==l||t[6]!==a||t[7]!==s){w=Symbol.for("react.early_return_sentinel");e:{const N=ue(a);let k;t[13]===Symbol.for("react.memo_cache_sentinel")?(k=S=>{if(S==="close"){W("desktop_close_current_window");return}if(S==="minimize"){W("desktop_minimize_current_window");return}W("desktop_toggle_current_window_maximized").then(y=>h(!!y?.maximized)).catch(We)},t[13]=k):k=t[13];const v=k;if(c==="traffic-lights"){const S=f?"me-1":"ms-1 me-3";let y;t[14]!==S?(y=G("app-region-no-drag group/wctl flex h-8 shrink-0 items-center",S),t[14]=S,t[15]=y):y=t[15];let D;t[16]!==s?(D=s("header.windowControls.groupAria"),t[16]=s,t[17]=D):D=t[17];let _;t[18]!==l?(_=I=>o.jsx($e,{action:I,isMaximized:l,onActivate:v},I),t[18]=l,t[19]=_):_=t[19],w=o.jsx("div",{dir:"ltr",className:y,"aria-label":D,children:N.map(_)});break e}const C=G("app-region-no-drag inline-flex items-center justify-center text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",f?"h-8 w-8 rounded-md":"h-12 w-11"),O=f?"app-region-no-drag me-1 flex h-8 shrink-0 items-center":"app-region-no-drag ms-1 flex h-12 shrink-0 items-center",T=S=>S==="minimize"?o.jsx("button",{type:"button",className:C,onClick:Be,title:s("header.windowControls.minimize"),"aria-label":s("header.windowControls.minimize"),children:o.jsx(F,{name:"subtract",className:"h-4 w-4"})},"minimize"):S==="maximize"?o.jsx("button",{type:"button",className:C,onClick:()=>{W("desktop_toggle_current_window_maximized").then(y=>h(!!y?.maximized)).catch(Ge)},title:s(l?"header.windowControls.restore":"header.windowControls.maximize"),"aria-label":s(l?"header.windowControls.restore":"header.windowControls.maximize"),children:o.jsx(F,{name:l?"fullscreen-exit":"checkbox-blank",className:"h-3.5 w-3.5"})},"maximize"):o.jsx("button",{type:"button",className:G(C,"hover:bg-[var(--status-error)] hover:text-[var(--status-error-foreground)]"),onClick:Ue,title:s("header.windowControls.close"),"aria-label":s("header.windowControls.close"),children:o.jsx(F,{name:"close",className:"h-4 w-4"})},"close");u="ltr",g=O,t[20]!==s?(p=s("header.windowControls.groupAria"),t[20]=s,t[21]=p):p=t[21],x=N.map(T)}t[3]=c,t[4]=f,t[5]=l,t[6]=a,t[7]=s,t[8]=u,t[9]=g,t[10]=p,t[11]=x,t[12]=w}else u=t[8],g=t[9],p=t[10],x=t[11],w=t[12];if(w!==Symbol.for("react.early_return_sentinel"))return w;let b;return t[22]!==u||t[23]!==g||t[24]!==p||t[25]!==x?(b=o.jsx("div",{dir:u,className:g,"aria-label":p,children:x}),t[22]=u,t[23]=g,t[24]=p,t[25]=x,t[26]=b):b=t[26],b});function Ae(n){return n.desktopWindowControlsStyle}function Me(){}function We(){}function Be(){W("desktop_minimize_current_window")}function Ge(){}function Ue(){W("desktop_close_current_window")}const te="new-session",Ze=10;function pt(n){const e=$.c(19),{children:t,variant:m,scopeProjectId:r,align:a,recentOnly:s}=n,l=m===void 0?"default":m,h=r===void 0?null:r,c=a===void 0?"start":a,i=s===void 0?!1:s,d=B(Ye),f=B(He);let u;e[0]!==t?(u=o.jsx(he,{asChild:!0,children:t}),e[0]=t,e[1]=u):u=e[1];const g=l==="compact"?"w-[280px]":"w-[360px]";let p;e[2]!==g?(p=G("overflow-hidden p-1 max-w-[calc(100vw-32px)]",g),e[2]=g,e[3]=p):p=e[3];let x;e[4]!==d||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==l?(x=d?o.jsx(qe,{onSelect:()=>f(!1),variant:l,scopeProjectId:h,recentOnly:i}):null,e[4]=d,e[5]=i,e[6]=h,e[7]=f,e[8]=l,e[9]=x):x=e[9];let w;e[10]!==c||e[11]!==p||e[12]!==x?(w=o.jsx(xe,{align:c,sideOffset:6,className:p,children:x}),e[10]=c,e[11]=p,e[12]=x,e[13]=w):w=e[13];let b;return e[14]!==d||e[15]!==f||e[16]!==u||e[17]!==w?(b=o.jsxs(we,{open:d,onOpenChange:f,modal:!1,disableGlobalShortcuts:!0,children:[u,w]}),e[14]=d,e[15]=f,e[16]=u,e[17]=w,e[18]=b):b=e[18],b}function He(n){return n.setSessionDropdownOpen}function Ye(n){return n.isSessionDropdownOpen}function qe(n){const e=$.c(34),{onSelect:t,variant:m,scopeProjectId:r,recentOnly:a}=n,s=K(Je),l=K(Xe);let h;e[0]!==s||e[1]!==r?(h={scopeProjectId:r,currentSessionId:s,maxParents:Ze,ignorePins:!0},e[0]=s,e[1]=r,e[2]=h):h=e[2];const c=ge(!0,h);let i,d;e[3]!==a?(i=()=>{a?be():Se()},d=[a],e[3]=a,e[4]=i,e[5]=d):(i=e[4],d=e[5]),M.useEffect(i,d);const f=K(Ve),{t:u}=ee();let g;e[6]!==t||e[7]!==f?(g=()=>{t(),f()},e[6]=t,e[7]=f,e[8]=g):g=e[8];const p=g;let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=new Set,e[9]=x):x=e[9];const[w,b]=M.useState(x),N=M.useRef(null),k=M.useRef(!1),v=l?te:s;let C;e[10]===Symbol.for("react.memo_cache_sentinel")?(C=z=>{b(R=>{const j=new Set(R);return j.has(z)?j.delete(z):j.add(z),j})},e[10]=C):C=e[10];const O=C;let T,S;e[11]!==w||e[12]!==v||e[13]!==c?(T=()=>{if(k.current||!v)return;const z=v===te?[]:ye(c,v);if(!z)return;if(z.some(j=>!w.has(j))){b(j=>new Set([...j,...z]));return}const R=requestAnimationFrame(()=>{const j=Array.from(N.current?.querySelectorAll("[data-switcher-item-id]")??[]).find(A=>A.dataset.switcherItemId===v);j&&(j.focus(),j.scrollIntoView({block:"nearest"}),k.current=!0)});return()=>cancelAnimationFrame(R)},S=[w,v,c],e[11]=w,e[12]=v,e[13]=c,e[14]=T,e[15]=S):(T=e[14],S=e[15]),M.useLayoutEffect(T,S);let y,D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=G("group relative flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),y=o.jsx(F,{name:"chat-new",className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),e[16]=y,e[17]=D):(y=e[16],D=e[17]);let _;e[18]!==u?(_=u("sessions.sidebar.header.actions.newSession"),e[18]=u,e[19]=_):_=e[19];let I;e[20]!==_?(I=o.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:_}),e[20]=_,e[21]=I):I=e[21];let P;e[22]!==p||e[23]!==I?(P=o.jsxs(re,{"data-switcher-item-id":te,onClick:p,className:D,children:[y,I]}),e[22]=p,e[23]=I,e[24]=P):P=e[24];let E;e[25]!==w||e[26]!==c||e[27]!==t||e[28]!==u||e[29]!==m?(E=c.length===0?o.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:u("sessions.switcher.empty")}):c.map(z=>o.jsx(ie,{item:z,depth:0,variant:m,expandedParents:w,toggleParent:O,closeDropdown:t},z.node.session.id)),e[25]=w,e[26]=c,e[27]=t,e[28]=u,e[29]=m,e[30]=E):E=e[30];let U;return e[31]!==P||e[32]!==E?(U=o.jsx(ve,{ref:N,outerClassName:"max-h-[60vh]",disableHorizontal:!0,children:o.jsxs("div",{className:"space-y-0.5",children:[P,E]})}),e[31]=P,e[32]=E,e[33]=U):U=e[33],U}function Ve(n){return n.openNewSessionDraft}function Xe(n){return n.newSessionDraft.open===!0}function Je(n){return n.currentSessionId}function ie(n){const e=$.c(31),{item:t,depth:m,variant:r,expandedParents:a,toggleParent:s,closeDropdown:l}=n,{node:h,secondaryMeta:c}=t,i=h.session,d=h.children.length>0;let f;e[0]!==a||e[1]!==i.id?(f=a.has(i.id),e[0]=a,e[1]=i.id,e[2]=f):f=e[2];const u=f;let g;e[3]!==d||e[4]!==i.id||e[5]!==s?(g=d?()=>s(i.id):void 0,e[3]=d,e[4]=i.id,e[5]=s,e[6]=g):g=e[6];let p;e[7]!==l||e[8]!==m||e[9]!==d||e[10]!==u||e[11]!==c||e[12]!==i||e[13]!==g||e[14]!==r?(p=o.jsx(Ke,{session:i,depth:m,variant:r,secondaryMeta:c,hasChildren:d,isExpanded:u,onToggleExpand:g,closeDropdown:l}),e[7]=l,e[8]=m,e[9]=d,e[10]=u,e[11]=c,e[12]=i,e[13]=g,e[14]=r,e[15]=p):p=e[15];let x;e[16]!==l||e[17]!==m||e[18]!==a||e[19]!==d||e[20]!==u||e[21]!==t.groupDirectory||e[22]!==t.projectId||e[23]!==h.children||e[24]!==c||e[25]!==s||e[26]!==r?(x=d&&u?h.children.map(b=>o.jsx(ie,{item:{node:b,projectId:t.projectId,groupDirectory:t.groupDirectory,secondaryMeta:c},depth:m+1,variant:r,expandedParents:a,toggleParent:s,closeDropdown:l},b.session.id)):null,e[16]=l,e[17]=m,e[18]=a,e[19]=d,e[20]=u,e[21]=t.groupDirectory,e[22]=t.projectId,e[23]=h.children,e[24]=c,e[25]=s,e[26]=r,e[27]=x):x=e[27];let w;return e[28]!==p||e[29]!==x?(w=o.jsxs(o.Fragment,{children:[p,x]}),e[28]=p,e[29]=x,e[30]=w):w=e[30],w}function Ke(n){const e=$.c(59),{session:t,depth:m,variant:r,secondaryMeta:a,hasChildren:s,isExpanded:l,onToggleExpand:h,closeDropdown:c}=n,{t:i}=ee(),d=K(et),f=K(Qe),u=_e(t.id),g=je(t.id),p=d===t.id;let x;e[0]!==t.title||e[1]!==i?(x=t.title?.trim()||i("sessions.sidebar.session.untitled"),e[0]=t.title,e[1]=i,e[2]=x):x=e[2];const w=x,b=Ce(t.id),N=b!==null,k=Ne(N),v=!N&&u&&(!p||g);let C;if(e[3]!==t){const L=ke(t)||Date.now();C=Ie(L),e[3]=t,e[4]=C}else C=e[4];const O=C;let T;e[5]!==a?.projectLabel?(T=a?.projectLabel?.trim()||null,e[5]=a?.projectLabel,e[6]=T):T=e[6];const S=T;let y;e[7]!==a?.branchLabel?(y=a?.branchLabel?.trim()||null,e[7]=a?.branchLabel,e[8]=y):y=e[8];const D=y,_=D&&D!=="HEAD"?D:null;let I;e[9]!==c||e[10]!==p||e[11]!==t||e[12]!==f?(I=()=>{if(p){c();return}const L=De(t);f(t.id,L??null),c()},e[9]=c,e[10]=p,e[11]=t,e[12]=f,e[13]=I):I=e[13];const P=I;let E;e[14]!==P?(E=L=>{if(L.target?.closest("[data-switcher-expand]")){L.preventDefault();return}P()},e[14]=P,e[15]=E):E=e[15];const U=t.id,z=p&&"bg-interactive-selection text-interactive-selection-foreground hover:bg-interactive-selection data-[highlighted]:bg-interactive-selection";let R;e[16]!==z?(R=G("group relative flex w-full cursor-pointer items-start gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover",z),e[16]=z,e[17]=R):R=e[17];const j=8+m*12;let A;e[18]!==j?(A={paddingInlineStart:j},e[18]=j,e[19]=A):A=e[19];let Z;e[20]!==s||e[21]!==l||e[22]!==h||e[23]!==i||e[24]!==r?(Z=r==="compact"&&s?o.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:L=>{L.preventDefault(),L.stopPropagation(),h?.()},className:"inline-flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground","aria-label":i(l?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:l?o.jsx(F,{name:"arrow-down-s",className:"h-3.5 w-3.5"}):o.jsx(F,{name:"arrow-right-s",className:"h-3.5 w-3.5"})}):null,e[20]=s,e[21]=l,e[22]=h,e[23]=i,e[24]=r,e[25]=Z):Z=e[25];let H;e[26]!==w?(H=o.jsx("span",{dir:"auto",className:"truncate oc-ui-start-align typography-ui-label font-normal leading-tight text-foreground",children:w}),e[26]=w,e[27]=H):H=e[27];let Y;e[28]!==Z||e[29]!==H?(Y=o.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[Z,H]}),e[28]=Z,e[29]=H,e[30]=Y):Y=e[30];let q;e[31]!==_||e[32]!==s||e[33]!==l||e[34]!==h||e[35]!==S||e[36]!==i||e[37]!==O||e[38]!==r?(q=r==="default"?o.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 truncate text-muted-foreground leading-tight",style:{fontSize:"calc(var(--text-ui-label) * 0.85)"},children:[s?o.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:L=>{L.preventDefault(),L.stopPropagation(),h?.()},className:"inline-flex h-3 w-3 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground","aria-label":i(l?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:l?o.jsx(F,{name:"arrow-down-s",className:"h-3 w-3"}):o.jsx(F,{name:"arrow-right-s",className:"h-3 w-3"})}):null,o.jsx("span",{className:"flex-shrink-0",children:O}),S?o.jsx("span",{className:"truncate",children:S}):null,_?o.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[o.jsx(F,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:_})]}):null]}):null,e[31]=_,e[32]=s,e[33]=l,e[34]=h,e[35]=S,e[36]=i,e[37]=O,e[38]=r,e[39]=q):q=e[39];let V;e[40]!==Y||e[41]!==q?(V=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[Y,q]}),e[40]=Y,e[41]=q,e[42]=V):V=e[42];let X;e[43]!==N||e[44]!==k||e[45]!==v||e[46]!==b?(X=N||v?o.jsx("span",{className:"flex h-3 w-3 flex-shrink-0 items-center justify-center self-center",children:o.jsx(ze,{state:b??"unread",runningClassName:G("h-2 w-2",k)})}):null,e[43]=N,e[44]=k,e[45]=v,e[46]=b,e[47]=X):X=e[47];let J;e[48]!==O||e[49]!==r?(J=r==="compact"?o.jsx("span",{className:"shrink-0 self-center typography-micro text-muted-foreground tabular-nums",children:O}):null,e[48]=O,e[49]=r,e[50]=J):J=e[50];let Q;return e[51]!==t.id||e[52]!==A||e[53]!==V||e[54]!==X||e[55]!==J||e[56]!==E||e[57]!==R?(Q=o.jsxs(re,{onClick:E,"data-slot":"session-switcher-item","data-switcher-item-id":U,className:R,style:A,children:[V,X,J]}),e[51]=t.id,e[52]=A,e[53]=V,e[54]=X,e[55]=J,e[56]=E,e[57]=R,e[58]=Q):Q=e[58],Q}function Qe(n){return n.setCurrentSession}function et(n){return n.currentSessionId}const ht=n=>!Number.isFinite(n)||n<=0?new Intl.NumberFormat(se(),{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(0):new Intl.NumberFormat(se(),{style:"currency",currency:"USD",minimumFractionDigits:n<.01?4:2,maximumFractionDigits:n<.01?4:2}).format(n),tt="ui-store",nt=oe({state:oe({contextSurfaceZones:Ee(Fe(),Le())})}),st=n=>{if(!n)return null;let e;try{e=JSON.parse(n)}catch{return null}const t=nt.safeParse(e);return t.success?pe.parse(t.data.state.contextSurfaceZones):null},xt=()=>{const n=e=>{if(e.key!==tt)return;const t=st(e.newValue);if(!t)return;const m=B.getState().contextSurfaceZones,r=new Set([...Object.keys(m),...Object.keys(t)].filter(fe));for(const a of r){const s=ne(t,a);s!==ne(B.getState().contextSurfaceZones,a)&&B.getState().moveContextSurfaceToZone(a,s)}};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)},ae=()=>{const n=[document.documentElement,document.body],e=document.getElementById("root");return e&&n.push(e),n},le=()=>{let n=!1;for(const e of ae())e.scrollTop!==0&&(e.scrollTop=0,n=!0),e.scrollLeft!==0&&(e.scrollLeft=0,n=!0);return n},ot=n=>n===document||ae().some(e=>e===n),wt=()=>{const n=$.c(1);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],n[0]=e):e=n[0],M.useEffect(it,e)};function rt(n){ot(n.target)&&le()}function it(){const n=rt;return document.addEventListener("scroll",n,{capture:!0,passive:!0}),le(),()=>document.removeEventListener("scroll",n,{capture:!0})}export{pt as S,ft as W,xt as a,wt as b,ht as f,ut as u};