@openchamber/web 2.6.1 → 2.6.2-canary.20261104.6

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 (107) hide show
  1. package/dist/assets/{AboutDialog-D-IujH5P.js → AboutDialog-BLUUIZML.js} +1 -1
  2. package/dist/assets/{AboutLogo-Bghz4cno.js → AboutLogo-DiHHd_5t.js} +1 -1
  3. package/dist/assets/{ArchiveView-SQdNDg7X.js → ArchiveView-CwhPe3Y_.js} +1 -1
  4. package/dist/assets/{ChangeRequestDiffUnavailable-uZ8LXZIU.js → ChangeRequestDiffUnavailable-3YgjMJtr.js} +1 -1
  5. package/dist/assets/{ChangedPathLabel-BZHIGJ_0.js → ChangedPathLabel-B6Ig547I.js} +1 -1
  6. package/dist/assets/{CommandPalette-DjCVXkJM.js → CommandPalette-BChv7Yci.js} +1 -1
  7. package/dist/assets/{DiffView-CIlNcbDh.js → DiffView-pFcLbagS.js} +1 -1
  8. package/dist/assets/{FilesView-VMk-uSwN.js → FilesView-Bod-r3C6.js} +1 -1
  9. package/dist/assets/{GitView-BIg-1tUn.js → GitView-C4xsLAUw.js} +1 -1
  10. package/dist/assets/{GuestSurfacePane-BUmmCfBg.js → GuestSurfacePane-BTyjXjRj.js} +1 -1
  11. package/dist/assets/{HelpDialog-DlCrl3jK.js → HelpDialog-jRlVnJ_e.js} +1 -1
  12. package/dist/assets/{IntegrationsCatalogView-tZTRIaCg.js → IntegrationsCatalogView-CjJ3sWIM.js} +1 -1
  13. package/dist/assets/{JsonTreeView-D5DVoS6l.js → JsonTreeView-C7EScp5B.js} +1 -1
  14. package/dist/assets/{MarkdownDiffPreview-DoMO0ER1.js → MarkdownDiffPreview-cPqaSgaj.js} +1 -1
  15. package/dist/assets/{MarkdownRendererImpl-D1KCox5d.js → MarkdownRendererImpl-BcJ1sqsU.js} +3 -3
  16. package/dist/assets/{MemoryDebugPanel-X5DD6Cjd.js → MemoryDebugPanel-D0N9KDmI.js} +1 -1
  17. package/dist/assets/{NoteEditor-_UWC0M0H.js → NoteEditor-DxvVLbA7.js} +1 -1
  18. package/dist/assets/{OnboardingScreen-DBSPDpEj.js → OnboardingScreen-CMeQdpeM.js} +1 -1
  19. package/dist/assets/{OpenCodeStatusDialog-e8gdYqEY.js → OpenCodeStatusDialog-BAv0K4eb.js} +1 -1
  20. package/dist/assets/{OverviewView-Cf5_Harr.js → OverviewView-DyDBexdg.js} +1 -1
  21. package/dist/assets/{PatchDiff-DIWEk4tG.js → PatchDiff-CvabHkAC.js} +1 -1
  22. package/dist/assets/{PlanView-CV7_x4Hj.js → PlanView-DPpR2O_F.js} +1 -1
  23. package/dist/assets/{ProjectActionsDialog-B90g1jby.js → ProjectActionsDialog-B96GmKCc.js} +1 -1
  24. package/dist/assets/{ReplyUiBlock-D2m0ZgRL.js → ReplyUiBlock-BuiEYmcz.js} +1 -1
  25. package/dist/assets/{ReviewCards-D--SZYNA.js → ReviewCards-B219SHVL.js} +1 -1
  26. package/dist/assets/{RunOverview-CGv4KD-i.js → RunOverview-6n10wBYl.js} +1 -1
  27. package/dist/assets/{ScheduledTasksDialog-XjiWbQnf.js → ScheduledTasksDialog-CTkrlYii.js} +1 -1
  28. package/dist/assets/{SettingsView-Cz-oULIY.js → SettingsView-CenZZQat.js} +1 -1
  29. package/dist/assets/{SettingsWindow-BHUNfQBn.js → SettingsWindow-HEw9_GIT.js} +1 -1
  30. package/dist/assets/{SidebarSectionsManager-C1YsRka1.js → SidebarSectionsManager-CEl8jV_W.js} +1 -1
  31. package/dist/assets/{SourceBoardView-Cc3LeYUo.js → SourceBoardView-CJZ3s1XD.js} +1 -1
  32. package/dist/assets/{SpaceAccessDialog-f_DzFvFs.js → SpaceAccessDialog-Ngob2qn9.js} +1 -1
  33. package/dist/assets/{SpaceApplyDialog-CddUu8PS.js → SpaceApplyDialog-BxjDC_0D.js} +1 -1
  34. package/dist/assets/{SpaceRow-DnnOnMYM.js → SpaceRow-CckOV1g8.js} +1 -1
  35. package/dist/assets/{SpaceSetupOutput-BzQQtLdO.js → SpaceSetupOutput-lGqiVX-3.js} +1 -1
  36. package/dist/assets/{SpacesView-BZhH9crf.js → SpacesView-CP5k-k3v.js} +1 -1
  37. package/dist/assets/{SubmoduleDiffSummary-D6Wu1QuT.js → SubmoduleDiffSummary-Cdi9S4gX.js} +1 -1
  38. package/dist/assets/{ToolOutputDialog-BkmKHRdh.js → ToolOutputDialog-08mv6_M5.js} +1 -1
  39. package/dist/assets/{ToolPartDiffPreview-BurYz6UW.js → ToolPartDiffPreview-DRL47sfe.js} +1 -1
  40. package/dist/assets/{UiBlock-Bwx-T68z.js → UiBlock-C47vwIuG.js} +1 -1
  41. package/dist/assets/{UsageStatsView-WPrhgORf.js → UsageStatsView-DCpTVWz3.js} +1 -1
  42. package/dist/assets/{WalkthroughView-BMD1xSij.js → WalkthroughView-DeaBPhAn.js} +1 -1
  43. package/dist/assets/{WorktreesView-BFut-2yK.js → WorktreesView-B1YD_EPW.js} +1 -1
  44. package/dist/assets/{appThemeRegistry-Dk6CF03D.js → appThemeRegistry-hfPZ6say.js} +1 -1
  45. package/dist/assets/{ar-CuYBgoCL.js → ar-BrwaPZTB.js} +1 -1
  46. package/dist/assets/{codeHighlight-BYbxdxkk.js → codeHighlight-CXtTq4co.js} +1 -1
  47. package/dist/assets/{computeVirtualFileMetrics-COD-bZRh.js → computeVirtualFileMetrics-vVCRMHlo.js} +2 -2
  48. package/dist/assets/{contextFileOpenGuard-D_Eh6QOM.js → contextFileOpenGuard-BrUXbAMg.js} +1 -1
  49. package/dist/assets/{date-time-KFcfG8FZ.js → date-time-t6mCSZMr.js} +1 -1
  50. package/dist/assets/{de-Jo819vpe.js → de-DM_yQ7AG.js} +1 -1
  51. package/dist/assets/{es-CV0MRSsN.js → es-DMJlwy06.js} +1 -1
  52. package/dist/assets/{fileContentPoller-dM2aYiRt.js → fileContentPoller-B_D2WQHm.js} +1 -1
  53. package/dist/assets/{flexokiTheme-BL4fG_5M.js → flexokiTheme-DJhpTHWO.js} +1 -1
  54. package/dist/assets/{fr-CdmUjdKh.js → fr-BKEy-Z_2.js} +1 -1
  55. package/dist/assets/{he-B0Jv5rnl.js → he-BnqH_lWh.js} +1 -1
  56. package/dist/assets/{highlights-Cz6HBqYD.js → highlights-hXz5ezHu.js} +1 -1
  57. package/dist/assets/{index-BaQtYnl3.js → index-D6cItOu7.js} +1 -1
  58. package/dist/assets/{initializeSharedPreferences-CiaDh0AM.js → initializeSharedPreferences-BKG_0s4E.js} +1 -1
  59. package/dist/assets/{install-T6u73Zz0.js → install-csQoiut9.js} +1 -1
  60. package/dist/assets/{isDiffPlainText-B8tZAZQ4.js → isDiffPlainText-OMACajs1.js} +1 -1
  61. package/dist/assets/{isFilePlainText-CgNXAeJu.js → isFilePlainText-Z9Wi1AQY.js} +1 -1
  62. package/dist/assets/{ja-BGc1V8I_.js → ja-lqTz_4gG.js} +1 -1
  63. package/dist/assets/{katex.min-BM3LOlr3.js → katex.min-B7gF3rmE.js} +4 -4
  64. package/dist/assets/{ko-CadSaTs-.js → ko-DXd5Gg_L.js} +1 -1
  65. package/dist/assets/{main-b_PAxB6R.js → main-D0VV0_-r.js} +4 -4
  66. package/dist/assets/{main-BX74Pq6m.js → main-DC2rz5Pv.js} +2 -2
  67. package/dist/assets/{miniChat-CzVxcGLZ.js → miniChat-C6te7Cha.js} +2 -2
  68. package/dist/assets/{mobile-DfBoGVRE.js → mobile-h7Y89upC.js} +2 -2
  69. package/dist/assets/{nl-Ds8N-7nU.js → nl-X6CZmwET.js} +1 -1
  70. package/dist/assets/{pageTitle-DcFkBvgW.js → pageTitle-CAd4Kwsy.js} +1 -1
  71. package/dist/assets/{parseDiffFromFile-DEaa1di6.js → parseDiffFromFile-BuLpViZg.js} +1 -1
  72. package/dist/assets/{pierreDiffTint-CS5FWjsh.js → pierreDiffTint-Bda-Leur.js} +1 -1
  73. package/dist/assets/{pl-BAAqSvOD.js → pl-CmAyO7EH.js} +1 -1
  74. package/dist/assets/{pt-BR-CxTCCQt5.js → pt-BR-QNheuCzR.js} +1 -1
  75. package/dist/assets/{relocateRestoredSession-C8x_kYRX.js → relocateRestoredSession-hOOmUC2p.js} +2 -2
  76. package/dist/assets/{renderElectronMiniChatApp-Bwgx8afa.js → renderElectronMiniChatApp-Dg-2lMCR.js} +2 -2
  77. package/dist/assets/{renderMarkdownForExport-DzVoMkQY.js → renderMarkdownForExport-Dy3HSiOK.js} +1 -1
  78. package/dist/assets/{renderMobileApp-0o5iW3gX.js → renderMobileApp-BhpguGxm.js} +3 -3
  79. package/dist/assets/{resolveLanguages-O4KbMEYv.js → resolveLanguages-BF-kRWyQ.js} +1 -1
  80. package/dist/assets/{runtimeEndpointReset-IJE1o-nk.js → runtimeEndpointReset-DUwSilpj.js} +8 -8
  81. package/dist/assets/{scheduledTasksApi-Bt4F6fco.js → scheduledTasksApi-jkEn2fUL.js} +1 -1
  82. package/dist/assets/{shiki-DfHQjW4b.js → shiki-D0FPzA_f.js} +1 -1
  83. package/dist/assets/{space-apply-BWMKP1l4.js → space-apply-De-hlG-f.js} +1 -1
  84. package/dist/assets/{space-close-B5_k2AhX.js → space-close-BQzjlZ-w.js} +1 -1
  85. package/dist/assets/{spaceNetwork-Bww_OVgL.js → spaceNetwork-CVVlgvhL.js} +1 -1
  86. package/dist/assets/{stream-tokenizer-B87hBGmH.js → stream-tokenizer-w3w2i3zK.js} +1 -1
  87. package/dist/assets/{textMateThemeFromAppTheme-BA68BaAw.js → textMateThemeFromAppTheme-B38k_gpV.js} +1 -1
  88. package/dist/assets/{tr-vj7L-0nl.js → tr-4WQrywE1.js} +1 -1
  89. package/dist/assets/{uk-DYlYVGgJ.js → uk-Dos-a0OZ.js} +1 -1
  90. package/dist/assets/{useAppFontEffects-UKWR--vP.js → useAppFontEffects-6HvTeJY2.js} +15 -15
  91. package/dist/assets/{useBranchPullRequestRequest-DJNOWuS3.js → useBranchPullRequestRequest-B8yYsqiw.js} +1 -1
  92. package/dist/assets/{useCallableModelProviders-BVbgbn_M.js → useCallableModelProviders-BLdr2CgV.js} +1 -1
  93. package/dist/assets/{useDiffFindSurface-zju_sQ6_.js → useDiffFindSurface-BVO1E6le.js} +1 -1
  94. package/dist/assets/{useGitCleanLine-DA-nRAvz.js → useGitCleanLine-DEZFq7uh.js} +1 -1
  95. package/dist/assets/{useInlineCommentController-DgJBL64V.js → useInlineCommentController-BiX7K5jy.js} +1 -1
  96. package/dist/assets/{useMarkdownLocalAssets-DFwvtvsy.js → useMarkdownLocalAssets-DM7b941V.js} +1 -1
  97. package/dist/assets/{useRootScrollLock-ywfMiLmM.js → useRootScrollLock-BrNPOsn7.js} +2 -2
  98. package/dist/assets/{useWalkthroughReview-DeioHUwn.js → useWalkthroughReview-kBvgTX6M.js} +1 -1
  99. package/dist/assets/{useWholeFileComment-3Adypnae.js → useWholeFileComment-DrynMs0_.js} +1 -1
  100. package/dist/assets/{useWorktreeArchiveActions-D57vyZ1C.js → useWorktreeArchiveActions-CewTlnGF.js} +1 -1
  101. package/dist/assets/{vendor-codemirror-language-data-CVww3XgZ.js → vendor-codemirror-language-data-BJfFTbvV.js} +2 -2
  102. package/dist/assets/{zh-CN-CNdkQtjY.js → zh-CN-C4Ip1vNN.js} +1 -1
  103. package/dist/assets/{zh-TW-njZbI3nO.js → zh-TW-BmwR7rb1.js} +1 -1
  104. package/dist/index.html +2 -2
  105. package/dist/mini-chat.html +2 -2
  106. package/dist/mobile.html +2 -2
  107. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import{R as q,j as _,a as Re,f as ot,r as p}from"./vendor-react--VO_rL_p.js";import{p as Jt,a as Zt}from"./parseDiffFromFile-DEaa1di6.js";import{c as St}from"./isDiffPlainText-B8tZAZQ4.js";import{P as en,V as kt,F as tn}from"./pierreDiffTint-CS5FWjsh.js";import{R as nn,a as rn,V as on}from"./ReviewCards-D--SZYNA.js";import{u as Wt,aj as sn,ak as Rt,aL as an,T as ln,gr as cn,n as dn,Q as Ct,bE as un,bS as fn,aq as xe,bT as Et,bU as Tt,bV as hn}from"./useAppFontEffects-UKWR--vP.js";import"./katex.min-BM3LOlr3.js";import{a as It,I as pn,u as mn}from"./useInlineCommentController-DgJBL64V.js";import{u as gn,an as yn}from"./runtimeEndpointReset-IJE1o-nk.js";import{ensurePierreThemeRegistered as At,getResolvedShikiTheme as Mt}from"./appThemeRegistry-Dk6CF03D.js";import{DIFFS_HIGHLIGHTER as vn}from"./diffsHighlighter-BsxkaI3Q.js";const de=e=>{if(e.type==="review")return`review-${e.id}`;if(e.type==="new"){const n=Math.min(e.selection.start,e.selection.end),r=Math.max(e.selection.start,e.selection.end);return`new-comment-${e.selection.side??"additions"}-${n}-${r}`}return`draft-${e.draft.id}`},xn=(e,n)=>e&&!n?{lineNumber:Math.max(e.start,e.end),side:e.side??"additions",metadata:{type:"new",selection:e}}:null,bn=e=>{const{drafts:n,editingDraftId:r,reviewItems:t=[]}=e,i=[];for(const a of n){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 wn(e){const n=e.trim();if(!n)return null;if(/^-?\d+(\.\d+)?$/.test(n)){const r=Number.parseFloat(n);return Number.isFinite(r)?r:null}if(n.endsWith("px")){const r=Number.parseFloat(n.slice(0,-2));return Number.isFinite(r)?r:null}return null}function Pt(e){if(!(!e||e<=0))return Math.max(200,Math.floor(e))}function Ln(e){const{diffRootRef:n,drafts:r,selection:t,editingDraftId:i,commentText:a,onTextChange:l,fileLabel:u,onSave:d,onCancel:c,onEdit:f,onDelete:y,review:m,reviewItems:L,reviewField:E,excerptOf:w}=e,[j,X]=q.useState(0),[N,W]=q.useState(null),$=q.useMemo(()=>!t||i?null:de({type:"new",selection:t}),[i,t]),Y=q.useMemo(()=>{const v=r.map(A=>de({type:A.id===i?"edit":"saved",draft:A}));$&&v.push($);for(const A of L)v.push(de({type:"review",id:A.id}));return v},[r,i,L,$]),z=q.useCallback(v=>{const A=n.current;if(!A)return null;const F=A.querySelector("diffs-container");if(!(F instanceof HTMLElement))return null;const O=F.querySelector(`[data-annotation-id="${v}"]`);if(O instanceof HTMLElement)return O;const M=F.shadowRoot;return M?M.querySelector(`[data-annotation-id="${v}"]`):null},[n]);q.useEffect(()=>{if(Y.length===0)return;let v=!1,A=0;const F=12,O=()=>{v||Y.every(B=>!!z(B))||A>=F||(A+=1,requestAnimationFrame(()=>{v||(X(B=>B+1),O())}))};return O(),()=>{v=!0}},[Y,z]),q.useEffect(()=>{const v=n.current;if(!v)return;const A=()=>{const O=getComputedStyle(v),M=wn(O.getPropertyValue("--oc-context-panel-width")),B=v.getBoundingClientRect(),Z=M??B.width;W(Z>0?Z:null)};A();const F=new ResizeObserver(()=>{A()});return F.observe(v),window.addEventListener("resize",A),()=>{F.disconnect(),window.removeEventListener("resize",A)}},[n]);const re=q.useCallback(v=>{const F=n.current?.getBoundingClientRect(),O=v.closest("[data-annotation-content]"),M=O instanceof HTMLElement?O.getBoundingClientRect():v.getBoundingClientRect(),B=[M.width];F&&B.push(F.right-M.left);const Z=B.filter(Q=>Number.isFinite(Q)&&Q>0);return Z.length>0?Pt(Math.min(...Z)):Pt(N)},[n,N]),V=()=>{const v=n.current?.querySelector("diffs-container")?.shadowRoot,A=v?Array.from(v.querySelectorAll("[data-line][data-selected-line]")).at(-1):void 0;if(A)return getComputedStyle(A).getPropertyValue("--diffs-computed-selected-line-bg").trim()||void 0};return _.jsxs(_.Fragment,{children:[r.map(v=>{const A=de({type:v.id===i?"edit":"saved",draft:v}),F=z(A);if(!F)return null;const O=re(F);return v.id===i?Re.createPortal(_.jsx(It,{initialText:a,onTextChange:l,fileLabel:u,lineRange:{start:v.startLine,end:v.endLine,side:v.side==="original"?"deletions":"additions"},isEditing:!0,onSave:d,onCancel:c,maxWidth:O,bandColor:V()}),F,`draft-edit-${v.id}`):Re.createPortal(_.jsx(pn,{draft:v,onEdit:()=>f(v),onDelete:()=>y(v),maxWidth:O,forAgent:m!==null}),F,`draft-card-${v.id}`)}),t&&!i&&$&&(()=>{const v=z($);if(!v)return null;const A=re(v);return Re.createPortal(_.jsx(It,{initialText:a,onTextChange:l,fileLabel:u,lineRange:t,isEditing:!1,onSave:d,onCancel:c,maxWidth:A,bandColor:V(),review:E}),v,$)})(),m?L.map(v=>{const A=de({type:"review",id:v.id}),F=z(A);if(!F)return null;const O=re(F);return Re.createPortal(_.jsx("div",{className:"px-3 py-1.5",children:v.kind==="draft"?_.jsx(nn,{comment:v.comment,review:m,excerpt:w(v),fileLabel:u,maxWidth:O}):_.jsx(rn,{thread:v.thread,review:m,excerpt:w(v),maxWidth:O})}),F,A)}):null]})}const Ar=14,Mr=e=>e.slice(e.lastIndexOf("/",e.length-2)+1),zt=e=>e.replace(/\\/g,"/").replace(/^\/+/,"").trim(),Nt=(e,n)=>({id:`dir:${e}`,path:e,name:n,children:new Map,directFiles:[],files:[]}),Pr=e=>{const n=Nt("","");for(const r of e){const t=zt(r.path);if(!t)continue;const a=t.split("/").filter(Boolean).slice(0,-1);let l=n;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=Nt(u,d);f.files.push(r),l.children.set(d,f),l=f}}l.directFiles.push(r)}return n},Sn=e=>{let n=e,r=e.name;for(;n.directFiles.length===0&&n.children.size===1;){const[t]=n.children.values();n=t,r=`${r}/${t.name}`}return{node:n,label:r}},Nr=(e,n)=>{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}=Sn(d);r.push({key:c.id,kind:"directory",depth:a,label:f,directory:c}),n.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:${zt(d.path)}`,kind:"file",depth:a,file:d})};return t(e,0),r},Je=3,kn=1e6,Ft=new WeakMap,Rn=e=>{const n=Ft.get(e);if(n)return n;let r=!1;const t=[];for(const a of e.hunks){const l=[];for(const u of a.hunkContent){if(u.type==="context"){nt(l,{...u});continue}const d=Cn(e,u);(d.length>1||d[0]?.type==="context")&&(r=!0);for(const c of d)nt(l,c)}t.push(...Tn(a,l))}const i=r?An(e,t):e;return Ft.set(e,i),i},Ht=e=>e.replace(/\s+/g,""),Cn=(e,n)=>{if(n.deletions===0||n.additions===0)return[{...n}];const r=e.deletionLines.slice(n.deletionLineIndex,n.deletionLineIndex+n.deletions),t=e.additionLines.slice(n.additionLineIndex,n.additionLineIndex+n.additions),i=[];let a=0,l=0;for(const[u,d]of En(r,t))(u>a||d>l)&&i.push({type:"change",deletions:u-a,deletionLineIndex:n.deletionLineIndex+a,additions:d-l,additionLineIndex:n.additionLineIndex+l}),nt(i,{type:"context",lines:1,deletionLineIndex:n.deletionLineIndex+u,additionLineIndex:n.additionLineIndex+d}),a=u+1,l=d+1;return(a<n.deletions||l<n.additions)&&i.push({type:"change",deletions:n.deletions-a,deletionLineIndex:n.deletionLineIndex+a,additions:n.additions-l,additionLineIndex:n.additionLineIndex+l}),i},En=(e,n)=>{const r=e.map(Ht),t=n.map(Ht),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)<=kn){const c=d+1,f=new Uint32Array((u+1)*c);for(let L=u-1;L>=0;L-=1)for(let E=d-1;E>=0;E-=1)f[L*c+E]=r[a+L]===t[a+E]?f[(L+1)*c+E+1]+1:Math.max(f[(L+1)*c+E],f[L*c+E+1]);let y=0,m=0;for(;y<u&&m<d;)r[a+y]===t[a+m]?(i.push([a+y,a+m]),y+=1,m+=1):f[(y+1)*c+m]>=f[y*c+m+1]?y+=1:m+=1}for(let c=l;c>0;c-=1)i.push([r.length-c,t.length-c]);return i},nt=(e,n)=>{const r=e.at(-1);if(r?.type==="context"&&n.type==="context"){r.lines+=n.lines;return}e.push(n)},_t=(e,n,r)=>({type:"context",lines:r,deletionLineIndex:e.deletionLineIndex+n,additionLineIndex:e.additionLineIndex+n}),Tn=(e,n)=>{const r=[];let t=null;for(const[a,l]of n.entries()){if(l.type==="change"){if(!t){t=[];const d=n[a-1];if(d?.type==="context"){const c=Math.min(d.lines,Je);t.push(_t(d,d.lines-c,c))}}t.push(l);continue}if(!t)continue;if(a<n.length-1&&l.lines<=Je*2){t.push(l);continue}t.push(_t(l,0,Math.min(l.lines,Je))),r.push(t),t=null}t&&r.push(t);const i=n.at(-1);return r.map(a=>{const l=a.at(-1),u=l!==void 0&&i!==void 0&&Fe(l,"deletion")===Fe(i,"deletion")&&Fe(l,"addition")===Fe(i,"addition");return In(e,a,u)})},Fe=(e,n)=>n==="deletion"?e.deletionLineIndex+(e.type==="context"?e.lines:e.deletions):e.additionLineIndex+(e.type==="context"?e.lines:e.additions),In=(e,n,r)=>{let t=0,i=0,a=0,l=0,u=0;for(const w of n)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=n[0],c=a+t,f=a+i,y=$t(_e(e.additionStart,e.additionCount)+d.additionLineIndex-e.additionLineIndex,c),m=$t(_e(e.deletionStart,e.deletionCount)+d.deletionLineIndex-e.deletionLineIndex,f),E=d.additionLineIndex===e.additionLineIndex&&d.deletionLineIndex===e.deletionLineIndex?e.hunkContext:void 0;return{collapsedBefore:0,additionStart:y,additionCount:c,additionLines:t,additionLineIndex:d.additionLineIndex,deletionStart:m,deletionCount:f,deletionLines:i,deletionLineIndex:d.deletionLineIndex,hunkContent:n,hunkContext:E,hunkSpecs:`@@ -${m},${f} +${y},${c} @@${E?` ${E}`:""}
1
+ import{R as q,j as _,a as Re,f as ot,r as p}from"./vendor-react--VO_rL_p.js";import{p as Jt,a as Zt}from"./parseDiffFromFile-BuLpViZg.js";import{c as St}from"./isDiffPlainText-OMACajs1.js";import{P as en,V as kt,F as tn}from"./pierreDiffTint-Bda-Leur.js";import{R as nn,a as rn,V as on}from"./ReviewCards-B219SHVL.js";import{u as Wt,aj as sn,ak as Rt,aL as an,T as ln,gr as cn,n as dn,Q as Ct,bE as un,bS as fn,aq as xe,bT as Et,bU as Tt,bV as hn}from"./useAppFontEffects-6HvTeJY2.js";import"./katex.min-B7gF3rmE.js";import{a as It,I as pn,u as mn}from"./useInlineCommentController-BiX7K5jy.js";import{u as gn,an as yn}from"./runtimeEndpointReset-DUwSilpj.js";import{ensurePierreThemeRegistered as At,getResolvedShikiTheme as Mt}from"./appThemeRegistry-hfPZ6say.js";import{DIFFS_HIGHLIGHTER as vn}from"./diffsHighlighter-BsxkaI3Q.js";const de=e=>{if(e.type==="review")return`review-${e.id}`;if(e.type==="new"){const n=Math.min(e.selection.start,e.selection.end),r=Math.max(e.selection.start,e.selection.end);return`new-comment-${e.selection.side??"additions"}-${n}-${r}`}return`draft-${e.draft.id}`},xn=(e,n)=>e&&!n?{lineNumber:Math.max(e.start,e.end),side:e.side??"additions",metadata:{type:"new",selection:e}}:null,bn=e=>{const{drafts:n,editingDraftId:r,reviewItems:t=[]}=e,i=[];for(const a of n){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 wn(e){const n=e.trim();if(!n)return null;if(/^-?\d+(\.\d+)?$/.test(n)){const r=Number.parseFloat(n);return Number.isFinite(r)?r:null}if(n.endsWith("px")){const r=Number.parseFloat(n.slice(0,-2));return Number.isFinite(r)?r:null}return null}function Pt(e){if(!(!e||e<=0))return Math.max(200,Math.floor(e))}function Ln(e){const{diffRootRef:n,drafts:r,selection:t,editingDraftId:i,commentText:a,onTextChange:l,fileLabel:u,onSave:d,onCancel:c,onEdit:f,onDelete:y,review:m,reviewItems:L,reviewField:E,excerptOf:w}=e,[j,X]=q.useState(0),[N,W]=q.useState(null),$=q.useMemo(()=>!t||i?null:de({type:"new",selection:t}),[i,t]),Y=q.useMemo(()=>{const v=r.map(A=>de({type:A.id===i?"edit":"saved",draft:A}));$&&v.push($);for(const A of L)v.push(de({type:"review",id:A.id}));return v},[r,i,L,$]),z=q.useCallback(v=>{const A=n.current;if(!A)return null;const F=A.querySelector("diffs-container");if(!(F instanceof HTMLElement))return null;const O=F.querySelector(`[data-annotation-id="${v}"]`);if(O instanceof HTMLElement)return O;const M=F.shadowRoot;return M?M.querySelector(`[data-annotation-id="${v}"]`):null},[n]);q.useEffect(()=>{if(Y.length===0)return;let v=!1,A=0;const F=12,O=()=>{v||Y.every(B=>!!z(B))||A>=F||(A+=1,requestAnimationFrame(()=>{v||(X(B=>B+1),O())}))};return O(),()=>{v=!0}},[Y,z]),q.useEffect(()=>{const v=n.current;if(!v)return;const A=()=>{const O=getComputedStyle(v),M=wn(O.getPropertyValue("--oc-context-panel-width")),B=v.getBoundingClientRect(),Z=M??B.width;W(Z>0?Z:null)};A();const F=new ResizeObserver(()=>{A()});return F.observe(v),window.addEventListener("resize",A),()=>{F.disconnect(),window.removeEventListener("resize",A)}},[n]);const re=q.useCallback(v=>{const F=n.current?.getBoundingClientRect(),O=v.closest("[data-annotation-content]"),M=O instanceof HTMLElement?O.getBoundingClientRect():v.getBoundingClientRect(),B=[M.width];F&&B.push(F.right-M.left);const Z=B.filter(Q=>Number.isFinite(Q)&&Q>0);return Z.length>0?Pt(Math.min(...Z)):Pt(N)},[n,N]),V=()=>{const v=n.current?.querySelector("diffs-container")?.shadowRoot,A=v?Array.from(v.querySelectorAll("[data-line][data-selected-line]")).at(-1):void 0;if(A)return getComputedStyle(A).getPropertyValue("--diffs-computed-selected-line-bg").trim()||void 0};return _.jsxs(_.Fragment,{children:[r.map(v=>{const A=de({type:v.id===i?"edit":"saved",draft:v}),F=z(A);if(!F)return null;const O=re(F);return v.id===i?Re.createPortal(_.jsx(It,{initialText:a,onTextChange:l,fileLabel:u,lineRange:{start:v.startLine,end:v.endLine,side:v.side==="original"?"deletions":"additions"},isEditing:!0,onSave:d,onCancel:c,maxWidth:O,bandColor:V()}),F,`draft-edit-${v.id}`):Re.createPortal(_.jsx(pn,{draft:v,onEdit:()=>f(v),onDelete:()=>y(v),maxWidth:O,forAgent:m!==null}),F,`draft-card-${v.id}`)}),t&&!i&&$&&(()=>{const v=z($);if(!v)return null;const A=re(v);return Re.createPortal(_.jsx(It,{initialText:a,onTextChange:l,fileLabel:u,lineRange:t,isEditing:!1,onSave:d,onCancel:c,maxWidth:A,bandColor:V(),review:E}),v,$)})(),m?L.map(v=>{const A=de({type:"review",id:v.id}),F=z(A);if(!F)return null;const O=re(F);return Re.createPortal(_.jsx("div",{className:"px-3 py-1.5",children:v.kind==="draft"?_.jsx(nn,{comment:v.comment,review:m,excerpt:w(v),fileLabel:u,maxWidth:O}):_.jsx(rn,{thread:v.thread,review:m,excerpt:w(v),maxWidth:O})}),F,A)}):null]})}const Ar=14,Mr=e=>e.slice(e.lastIndexOf("/",e.length-2)+1),zt=e=>e.replace(/\\/g,"/").replace(/^\/+/,"").trim(),Nt=(e,n)=>({id:`dir:${e}`,path:e,name:n,children:new Map,directFiles:[],files:[]}),Pr=e=>{const n=Nt("","");for(const r of e){const t=zt(r.path);if(!t)continue;const a=t.split("/").filter(Boolean).slice(0,-1);let l=n;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=Nt(u,d);f.files.push(r),l.children.set(d,f),l=f}}l.directFiles.push(r)}return n},Sn=e=>{let n=e,r=e.name;for(;n.directFiles.length===0&&n.children.size===1;){const[t]=n.children.values();n=t,r=`${r}/${t.name}`}return{node:n,label:r}},Nr=(e,n)=>{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}=Sn(d);r.push({key:c.id,kind:"directory",depth:a,label:f,directory:c}),n.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:${zt(d.path)}`,kind:"file",depth:a,file:d})};return t(e,0),r},Je=3,kn=1e6,Ft=new WeakMap,Rn=e=>{const n=Ft.get(e);if(n)return n;let r=!1;const t=[];for(const a of e.hunks){const l=[];for(const u of a.hunkContent){if(u.type==="context"){nt(l,{...u});continue}const d=Cn(e,u);(d.length>1||d[0]?.type==="context")&&(r=!0);for(const c of d)nt(l,c)}t.push(...Tn(a,l))}const i=r?An(e,t):e;return Ft.set(e,i),i},Ht=e=>e.replace(/\s+/g,""),Cn=(e,n)=>{if(n.deletions===0||n.additions===0)return[{...n}];const r=e.deletionLines.slice(n.deletionLineIndex,n.deletionLineIndex+n.deletions),t=e.additionLines.slice(n.additionLineIndex,n.additionLineIndex+n.additions),i=[];let a=0,l=0;for(const[u,d]of En(r,t))(u>a||d>l)&&i.push({type:"change",deletions:u-a,deletionLineIndex:n.deletionLineIndex+a,additions:d-l,additionLineIndex:n.additionLineIndex+l}),nt(i,{type:"context",lines:1,deletionLineIndex:n.deletionLineIndex+u,additionLineIndex:n.additionLineIndex+d}),a=u+1,l=d+1;return(a<n.deletions||l<n.additions)&&i.push({type:"change",deletions:n.deletions-a,deletionLineIndex:n.deletionLineIndex+a,additions:n.additions-l,additionLineIndex:n.additionLineIndex+l}),i},En=(e,n)=>{const r=e.map(Ht),t=n.map(Ht),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)<=kn){const c=d+1,f=new Uint32Array((u+1)*c);for(let L=u-1;L>=0;L-=1)for(let E=d-1;E>=0;E-=1)f[L*c+E]=r[a+L]===t[a+E]?f[(L+1)*c+E+1]+1:Math.max(f[(L+1)*c+E],f[L*c+E+1]);let y=0,m=0;for(;y<u&&m<d;)r[a+y]===t[a+m]?(i.push([a+y,a+m]),y+=1,m+=1):f[(y+1)*c+m]>=f[y*c+m+1]?y+=1:m+=1}for(let c=l;c>0;c-=1)i.push([r.length-c,t.length-c]);return i},nt=(e,n)=>{const r=e.at(-1);if(r?.type==="context"&&n.type==="context"){r.lines+=n.lines;return}e.push(n)},_t=(e,n,r)=>({type:"context",lines:r,deletionLineIndex:e.deletionLineIndex+n,additionLineIndex:e.additionLineIndex+n}),Tn=(e,n)=>{const r=[];let t=null;for(const[a,l]of n.entries()){if(l.type==="change"){if(!t){t=[];const d=n[a-1];if(d?.type==="context"){const c=Math.min(d.lines,Je);t.push(_t(d,d.lines-c,c))}}t.push(l);continue}if(!t)continue;if(a<n.length-1&&l.lines<=Je*2){t.push(l);continue}t.push(_t(l,0,Math.min(l.lines,Je))),r.push(t),t=null}t&&r.push(t);const i=n.at(-1);return r.map(a=>{const l=a.at(-1),u=l!==void 0&&i!==void 0&&Fe(l,"deletion")===Fe(i,"deletion")&&Fe(l,"addition")===Fe(i,"addition");return In(e,a,u)})},Fe=(e,n)=>n==="deletion"?e.deletionLineIndex+(e.type==="context"?e.lines:e.deletions):e.additionLineIndex+(e.type==="context"?e.lines:e.additions),In=(e,n,r)=>{let t=0,i=0,a=0,l=0,u=0;for(const w of n)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=n[0],c=a+t,f=a+i,y=$t(_e(e.additionStart,e.additionCount)+d.additionLineIndex-e.additionLineIndex,c),m=$t(_e(e.deletionStart,e.deletionCount)+d.deletionLineIndex-e.deletionLineIndex,f),E=d.additionLineIndex===e.additionLineIndex&&d.deletionLineIndex===e.deletionLineIndex?e.hunkContext:void 0;return{collapsedBefore:0,additionStart:y,additionCount:c,additionLines:t,additionLineIndex:d.additionLineIndex,deletionStart:m,deletionCount:f,deletionLines:i,deletionLineIndex:d.deletionLineIndex,hunkContent:n,hunkContext:E,hunkSpecs:`@@ -${m},${f} +${y},${c} @@${E?` ${E}`:""}
2
2
  `,splitLineStart:0,splitLineCount:l,unifiedLineStart:0,unifiedLineCount:u,noEOFCRDeletions:r&&e.noEOFCRDeletions,noEOFCRAdditions:r&&e.noEOFCRAdditions}},_e=(e,n)=>e-(n===0?0:1),$t=(e,n)=>e+(n===0?0:1),An=(e,n)=>{let r=0,t=0,i=0;for(const l of n)l.collapsedBefore=Math.max(_e(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=_e(l.additionStart,l.additionCount)+l.additionCount;if(n.at(-1)&&!e.isPartial&&e.additionLines.length>0&&e.deletionLines.length>0){const l=Math.max(e.additionLines.length-i,0);r+=l,t+=l}return{...e,...e.isPartial?Mn(e,n):{hunks:n},splitLineCount:r,unifiedLineCount:t,cacheKey:e.cacheKey===void 0?void 0:`${e.cacheKey}:hide-whitespace`}},Mn=(e,n)=>{const r=[],t=[],i=(l,u,d,c)=>{for(let f=d;f<d+c;f+=1)u.push(l[f])};return{hunks:n.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(e.deletionLines,r,f.deletionLineIndex,f.type==="context"?f.lines:f.deletions),i(e.additionLines,t,f.additionLineIndex,f.type==="context"?f.lines:f.additions),y});return{...l,deletionLineIndex:u,additionLineIndex:d,hunkContent:c}}),deletionLines:r,additionLines:t}},Pn=e=>e.replace(/\r?\n$/,""),Nn=(e,n,r)=>{if(!e.isPartial)return r-1;for(const t of e.hunks){const i=n==="additions"?t.additionStart:t.deletionStart,a=n==="additions"?t.additionCount:t.deletionCount;if(r<i||r>=i+a)continue;return(n==="additions"?t.additionLineIndex:t.deletionLineIndex)+(r-i)}return null},Fn=(e,n,r,t)=>{const i=n==="additions"?e.additionLines:e.deletionLines,a=[];for(let l=Math.max(1,r);l<=t;l+=1){const u=Nn(e,n,l),d=u===null?void 0:i[u];d!==void 0&&a.push(Pn(d))}return a.join(`
3
3
  `)},Ze=/[\p{L}\p{N}_$]/u,Hn=(e,n)=>{if(n<0||n>e.length)return null;const r=n===e.length?e.length-1:n;if(r<0||!Ze.test(e[r]))return null;let t=r,i=r+1;for(;t>0&&Ze.test(e[t-1]);)t-=1;for(;i<e.length&&Ze.test(e[i]);)i+=1;return{word:e.slice(t,i),spanStart:t}},_n=e=>e?Array.from(e.children).filter(n=>n instanceof HTMLElement&&n.hasAttribute("data-code")):[],$n=(e,n)=>{const r=new Map,t=()=>{const d=e.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}));n.hidden=!c.some(f=>f.scrollWidth-f.clientWidth>1);for(const{entry:f,left:y,clientWidth:m,scrollWidth:L,scrollLeft:E}of c){const w=L-m>1;f.track.hidden=!w,w&&(f.track.style.left=`${y}px`,f.track.style.width=`${m}px`,f.spacer.style.width=`${L}px`,f.track.scrollLeft=E)}},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=!0;const f=document.createElement("div");f.className="h-px",c.appendChild(f),n.appendChild(c);const y=()=>{Math.abs(c.scrollLeft-d.scrollLeft)>=1&&(c.scrollLeft=d.scrollLeft)},m=()=>{Math.abs(d.scrollLeft-c.scrollLeft)>=1&&(d.scrollLeft=c.scrollLeft)};return d.addEventListener("scroll",y,{passive:!0}),c.addEventListener("scroll",m,{passive:!0}),i.observe(d),{column:d,content:null,track:c,spacer:f,detach:()=>{d.removeEventListener("scroll",y),c.removeEventListener("scroll",m),i.unobserve(d),c.remove()}}},u=()=>{const d=e.querySelector("diffs-container")?.shadowRoot??null,c=d?.querySelector("pre")??null,f=_n(c);for(const[y,m]of r)f.includes(y)||(m.detach(),m.content&&i.unobserve(m.content),r.delete(y));for(const y of f){const m=r.get(y)??l(y);r.set(y,m);const L=Array.from(y.children).find(E=>E.hasAttribute("data-content"))??null;L!==m.content&&(m.content&&i.unobserve(m.content),L&&i.observe(L),m.content=L)}a.disconnect(),a.observe(e,{childList:!0}),d&&a.observe(d,{childList:!0}),c&&a.observe(c,{childList:!0});for(const y of f)a.observe(y,{childList:!0});r.size===0&&(n.hidden=!0)};return u(),i.observe(e),()=>{a.disconnect(),i.disconnect();for(const d of r.values())d.detach();r.clear(),n.hidden=!0}},On=e=>{const n=ot.c(4),{containerRef:r}=e,t=q.useRef(null);let i,a;n[0]!==r?(i=()=>{const u=r.current,d=t.current;if(!(!u||!d))return $n(u,d)},a=[r],n[0]=r,n[1]=i,n[2]=a):(i=n[1],a=n[2]),q.useEffect(i,a);let l;return n[3]===Symbol.for("react.memo_cache_sentinel")?(l=_.jsx("div",{ref:t,hidden:!0,"aria-hidden":"true",className:"sticky bottom-0 z-10 h-2.5 bg-background"}),n[3]=l):l=n[3],l},Ot=[],Dn=`
4
4
  [data-gutter-buffer="annotation"] { min-height: 0; }
@@ -1 +1 @@
1
- import{r as a}from"./vendor-react--VO_rL_p.js";import{k as u,j as p}from"./katex.min-BM3LOlr3.js";import{V as f}from"./useAppFontEffects-UKWR--vP.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 d=e?`/api/small-model?directory=${encodeURIComponent(e)}`:"/api/small-model",o=await p(d,{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(l=>typeof l=="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{k as u,j as p}from"./katex.min-B7gF3rmE.js";import{V as f}from"./useAppFontEffects-6HvTeJY2.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 d=e?`/api/small-model?directory=${encodeURIComponent(e)}`:"/api/small-model",o=await p(d,{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(l=>typeof l=="string"))}catch{}})(),()=>{r=!0}},[i,e,t]),c}export{h as u};
@@ -1 +1 @@
1
- import{f as de,R as n,j as M}from"./vendor-react--VO_rL_p.js";import{h as me}from"./useBranchPullRequestRequest-DJNOWuS3.js";import{u as pe,Q as he,cu as fe,I as te,y as ge,B as re,eG as xe,eH as ye}from"./useAppFontEffects-UKWR--vP.js";import"./katex.min-BM3LOlr3.js";const be="data-diff-find-bar",Pe=t=>{const e=de.c(87),{query:i,onQueryChange:y,total:c,currentIndex:p,isSearching:s,failedCount:E,onNext:g,onPrevious:x,onClose:m,focusNonce:d,className:P}=t,L=E===void 0?0:E,{t:o}=pe(),R=n.useRef(null);let k,C;e[0]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{R.current?.focus()},C=[],e[0]=k,e[1]=C):(k=e[0],C=e[1]),n.useEffect(k,C);let F,b;e[2]!==d?(F=()=>{d&&d>0&&(R.current?.focus(),R.current?.select())},b=[d],e[2]=d,e[3]=F,e[4]=b):(F=e[3],b=e[4]),n.useEffect(F,b);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 N=I;let h;e[8]!==p||e[9]!==N||e[10]!==o||e[11]!==c?(h=c>0?o("diffFind.countAria",{current:p+1,total:c}):N?o("diffFind.noMatches"):void 0,e[8]=p,e[9]=N,e[10]=o,e[11]=c,e[12]=h):h=e[12];const _=h;let a;e[13]!==s||e[14]!==_||e[15]!==o?(a=s?[_,o("diffFind.searchingAria")].filter(Boolean).join(", "):_,e[13]=s,e[14]=_,e[15]=o,e[16]=a):a=e[16];const l=a;let u;e[17]!==m||e[18]!==g||e[19]!==x?(u=T=>{fe(T)||(T.key==="Enter"?(T.preventDefault(),T.shiftKey?x():g()):T.key==="Escape"&&(T.preventDefault(),m()))},e[17]=m,e[18]=g,e[19]=x,e[20]=u):u=e[20];const S=u;let v;e[21]!==P?(v=he("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]=v):v=e[22];let Q;e[23]===Symbol.for("react.memo_cache_sentinel")?(Q=M.jsx(te,{name:"search",className:"ms-0.5 size-3.5 text-muted-foreground"}),e[23]=Q):Q=e[23];let $;e[24]!==y?($=T=>y(T.target.value),e[24]=y,e[25]=$):$=e[25];let j;e[26]!==o?(j=o("diffFind.placeholder"),e[26]=o,e[27]=j):j=e[27];let z;e[28]!==o?(z=o("diffFind.placeholder"),e[28]=o,e[29]=z):z=e[29];let D;e[30]!==S||e[31]!==i||e[32]!==$||e[33]!==j||e[34]!==z?(D=M.jsx(ge,{ref:R,value:i,onChange:$,onKeyDown:S,placeholder:j,"aria-label":z,className:"h-7 w-40 rounded-md px-2 py-0 text-sm md:w-56"}),e[30]=S,e[31]=i,e[32]=$,e[33]=j,e[34]=z,e[35]=D):D=e[35];let B;e[36]!==p||e[37]!==N||e[38]!==s||e[39]!==o||e[40]!==c?(B=N&&c===0?o("diffFind.noMatches"):c>0?`${p+1}/${c}${s?"+":""}`:"",e[36]=p,e[37]=N,e[38]=s,e[39]=o,e[40]=c,e[41]=B):B=e[41];let r;e[42]!==l||e[43]!==B?(r=M.jsx("span",{className:"min-w-12 px-1 text-center typography-micro text-muted-foreground tabular-nums","aria-live":"polite","aria-label":l,children:B}),e[42]=l,e[43]=B,e[44]=r):r=e[44];let f;e[45]!==o?(f=o("diffFind.previousAria"),e[45]=o,e[46]=f):f=e[46];let w;e[47]!==o?(w=o("diffFind.previousAria"),e[47]=o,e[48]=w):w=e[48];const A=c===0;let O;e[49]===Symbol.for("react.memo_cache_sentinel")?(O=M.jsx(te,{name:"arrow-up",className:"size-3.5"}),e[49]=O):O=e[49];let H;e[50]!==x||e[51]!==f||e[52]!==w||e[53]!==A?(H=M.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:x,title:f,"aria-label":w,disabled:A,children:O}),e[50]=x,e[51]=f,e[52]=w,e[53]=A,e[54]=H):H=e[54];let K;e[55]!==o?(K=o("diffFind.nextAria"),e[55]=o,e[56]=K):K=e[56];let W;e[57]!==o?(W=o("diffFind.nextAria"),e[57]=o,e[58]=W):W=e[58];const se=c===0;let Y;e[59]===Symbol.for("react.memo_cache_sentinel")?(Y=M.jsx(te,{name:"arrow-down",className:"size-3.5"}),e[59]=Y):Y=e[59];let U;e[60]!==g||e[61]!==K||e[62]!==W||e[63]!==se?(U=M.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:g,title:K,"aria-label":W,disabled:se,children:Y}),e[60]=g,e[61]=K,e[62]=W,e[63]=se,e[64]=U):U=e[64];let q;e[65]!==o?(q=o("diffFind.closeAria"),e[65]=o,e[66]=q):q=e[66];let G;e[67]!==o?(G=o("diffFind.closeAria"),e[67]=o,e[68]=G):G=e[68];let Z;e[69]===Symbol.for("react.memo_cache_sentinel")?(Z=M.jsx(te,{name:"close",className:"size-3.5"}),e[69]=Z):Z=e[69];let J;e[70]!==m||e[71]!==q||e[72]!==G?(J=M.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:m,title:q,"aria-label":G,children:Z}),e[70]=m,e[71]=q,e[72]=G,e[73]=J):J=e[73];let V;e[74]!==D||e[75]!==r||e[76]!==H||e[77]!==U||e[78]!==J?(V=M.jsxs("div",{className:"flex items-center gap-1",children:[Q,D,r,H,U,J]}),e[74]=D,e[75]=r,e[76]=H,e[77]=U,e[78]=J,e[79]=V):V=e[79];let X;e[80]!==L||e[81]!==o?(X=L>0&&M.jsx("p",{className:"w-0 min-w-full px-1 pb-0.5 typography-micro text-status-warning",children:o("diffFind.failedCount",{count:L})}),e[80]=L,e[81]=o,e[82]=X):X=e[82];let ee;return e[83]!==v||e[84]!==V||e[85]!==X?(ee=M.jsxs("div",{"data-diff-find-bar":"",className:v,children:[V,X]}),e[83]=v,e[84]=V,e[85]=X,e[86]=ee):ee=e[86],ee},Se=/[.*+?^${}()|[\]\\]/g,we=t=>t.replace(Se,"\\$&"),Fe=t=>t.replace(/\r?\n$/,""),Ee=(t,e,i)=>{const y=new RegExp(we(e),i?"g":"gi"),c=[];for(const p of t.matchAll(y))c.push({spanStart:p.index??0,spanLength:p[0].length});return c},ne=(t,e,i,y,c,p,s)=>{if(y<1)return;const E=Fe(c);for(const g of Ee(E,p,s))t.push({filePath:e,side:i,lineNumber:y,spanStart:g.spanStart,spanLength:g.spanLength})},Re=(t,e,i,y)=>{if(i.length===0)return[];const c=y.caseSensitive??!1,p=y.layout==="inline",s=[];for(const E of t.hunks){let g=E.additionStart,x=E.deletionStart;for(const m of E.hunkContent){if(m.type==="context"){for(let d=0;d<m.lines;d+=1)p||ne(s,e,"deletions",x+d,t.deletionLines[m.deletionLineIndex+d],i,c),ne(s,e,"additions",g+d,t.additionLines[m.additionLineIndex+d],i,c);g+=m.lines,x+=m.lines;continue}for(let d=0;d<m.deletions;d+=1)ne(s,e,"deletions",x+d,t.deletionLines[m.deletionLineIndex+d],i,c);x+=m.deletions;for(let d=0;d<m.additions;d+=1)ne(s,e,"additions",g+d,t.additionLines[m.additionLineIndex+d],i,c);g+=m.additions}}return s},ve=120,_e=(t,e)=>t&&e?me(t):t,oe=[],ae=(t,e)=>t.filePath===e.filePath&&t.side===e.side&&t.lineNumber===e.lineNumber&&t.spanStart===e.spanStart,ce=(t,e)=>{const i=t.get(e.filePath);return i!==void 0&&i.revision===e.revision},ie=(t,e)=>t.has(e.filePath)&&t.get(e.filePath)===e.revision,le=(t,e)=>{const i=[],y=c=>{for(const p of c){const s=e.get(p.filePath);s?.nestedSources&&s.revision===p.revision?y(s.nestedSources):i.push(p)}};return y(t),i},je=({sources:t,caseSensitive:e=!1})=>{const[i,y]=n.useState(!1),[c,p]=n.useState(""),[s,E]=n.useState(""),[g,x]=n.useState(0),[m,d]=n.useState(()=>new Map),P=n.useRef(m),[L,o]=n.useState(()=>new Map),R=n.useRef(L),k=n.useRef(t);k.current=t;const C=n.useRef(i);C.current=i;const F=n.useRef(!1),b=n.useRef(null),I=n.useCallback(async()=>{if(!F.current){F.current=!0;try{for(;;){if(!C.current)return;const r=le(k.current,P.current).find(O=>!ce(P.current,O)&&!ie(R.current,O));if(!r)return;let f;try{f=await r.load()}catch{const O=new Map(R.current).set(r.filePath,r.revision);R.current=O,o(O);continue}const w=f!==null&&"nestedSources"in f?{revision:r.revision,diff:null,nestedSources:f.nestedSources}:{revision:r.revision,diff:f,nestedSources:null},A=new Map(P.current).set(r.filePath,w);P.current=A,d(A)}}finally{F.current=!1}}},[]);n.useEffect(()=>{i&&I()},[i,I,t]),n.useEffect(()=>{if(c===s)return;const r=window.setTimeout(()=>{E(c),x(0)},ve);return()=>window.clearTimeout(r)},[s,c]);const N=n.useMemo(()=>le(t,m),[m,t]),h=n.useMemo(()=>{if(!i)return oe;const r=s.trim();if(r.length===0)return oe;const f=[];for(const w of N){const A=m.get(w.filePath)?.diff;A&&f.push(...Re(A,w.filePath,r,{caseSensitive:e,layout:w.layout}))}return f},[s,e,i,m,N]),_=n.useRef(h);_.current=h;const[a,l]=n.useState({matches:h,query:s});if(a.matches!==h){const r=a.query===s?a.matches[g]:void 0,f=r?h.findIndex(A=>ae(A,r)):-1,w=f>=0?f:h.length===0?0:Math.min(g,h.length-1);l({matches:h,query:s}),w!==g&&x(w)}const u=n.useCallback(r=>{b.current=null,p(r)},[]),S=n.useCallback(()=>{if(!C.current&&R.current.size>0){const r=new Map;R.current=r,o(r)}y(!0)},[]),v=n.useCallback(()=>{b.current=null,S()},[S]),Q=n.useCallback(()=>{b.current=null,y(!1)},[]),$=n.useCallback((r,f)=>{if(p(r),E(r),S(),f){b.current={...f,query:r};return}b.current=null,x(0)},[S]),j=i&&N.some(r=>!ce(m,r)&&!ie(L,r)),z=i?N.filter(r=>ie(L,r)).length:0;n.useEffect(()=>{const r=b.current;if(!r)return;if(!i||r.query!==s){b.current=null;return}const f=h.findIndex(w=>ae(w,r));if(f>=0){b.current=null,x(h.length===0?0:(f+1)%h.length);return}j||(b.current=null,x(0))},[s,i,j,h]);const D=n.useCallback(()=>{x(r=>{const f=_.current.length;return f===0?0:(r+1)%f})},[]),B=n.useCallback(()=>{x(r=>{const f=_.current.length;return f===0?0:(r-1+f)%f})},[]);return{isOpen:i,open:v,close:Q,query:c,setQuery:u,matches:h,currentIndex:g,currentMatch:h[g]??null,isSearching:j,failedCount:z,next:D,previous:B,openWithQuery:$}},Ce=(t,e)=>t instanceof HTMLElement&&!e?.contains(t)&&(t.isContentEditable||t.matches("input, textarea")),Ne=5e3,Ie="[data-find-surface]",ue=(t,e)=>{if(!(t instanceof Element))return!1;const i=t.closest(Ie);return i!==null&&i!==e},Oe=({find:t,visible:e,rootRef:i,reveal:y})=>{const{isOpen:c,matches:p,currentMatch:s,currentIndex:E,open:g,close:x,openWithQuery:m}=t,d=n.useRef(new Map),[P,L]=n.useState(0),o=n.useRef(y);o.current=y;const R=n.useMemo(()=>{const a=new Map;for(const l of p){const u=a.get(l.filePath);u?u.push(l):a.set(l.filePath,[l])}return a},[p]),k=n.useRef({isOpen:c,currentMatch:s,matchesByFile:R});k.current={isOpen:c,currentMatch:s,matchesByFile:R};const C=n.useCallback((a,l)=>{const u=k.current,S=u.currentMatch;if(!u.isOpen||!S||S.filePath!==a){l.setFindHighlights([],0);return}const v=u.matchesByFile.get(a)??[];l.setFindHighlights(v,v.indexOf(S))},[]),F=n.useRef(null),b=n.useCallback(()=>{const a=F.current;a?.frame!=null&&window.cancelAnimationFrame(a.frame),F.current=null},[]),I=n.useCallback(a=>{const l=F.current;l?.frame!=null&&window.cancelAnimationFrame(l.frame);const u={match:a,frame:null,deadline:performance.now()+Ne};F.current=u;const S=()=>{if(u.frame=null,F.current!==u)return;if(d.current.get(a.filePath)?.scrollToLine({lineNumber:a.lineNumber,side:a.side,align:"center"})){F.current=null;return}performance.now()<u.deadline&&(u.frame=window.requestAnimationFrame(S))};u.frame=window.requestAnimationFrame(S)},[]);n.useEffect(()=>b,[b]);const N=n.useCallback((a,l)=>{if(!l){d.current.delete(a);return}d.current.set(a,l),k.current.isOpen&&C(a,l);const u=F.current;u&&u.match.filePath===a&&I(u.match)},[C,I]);n.useEffect(()=>{for(const[a,l]of d.current)C(a,l)},[C,s,c,R]);const h=n.useRef(null);n.useEffect(()=>{if(!c||!s){h.current=null,b();return}const a=`${E}:${s.filePath}:${s.side}:${s.lineNumber}:${s.spanStart}`;h.current!==a&&(h.current=a,o.current(s,d.current.has(s.filePath)),I(s))},[b,E,s,c,I]),xe("find_in_file",a=>{if(!e||a.defaultPrevented||Ce(document.activeElement,i.current)||ue(a.target,i.current))return!1;g(),L(l=>l+1)}),n.useEffect(()=>{if(!e||!c)return;const a=l=>{if(l.key!=="Escape"||l.defaultPrevented||fe(l))return;const{target:u}=l;if(!(u instanceof Node))return;const S=document.activeElement,v=!S||S===document.body;!i.current?.contains(u)&&!v||ue(u,i.current)||!(u instanceof Element&&u.closest(`[${be}]`)!==null)&&ye(u)||(l.preventDefault(),l.stopPropagation(),x())};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[x,c,i,e]);const _=n.useCallback((a,l)=>{m(l.word,{filePath:a,side:l.side,lineNumber:l.lineNumber,spanStart:l.spanStart}),L(u=>u+1)},[m]);return{registerViewer:N,openOnWord:_,focusNonce:P}};export{Pe as D,Oe as a,_e as r,je as u};
1
+ import{f as de,R as n,j as M}from"./vendor-react--VO_rL_p.js";import{h as me}from"./useBranchPullRequestRequest-B8yYsqiw.js";import{u as pe,Q as he,cu as fe,I as te,y as ge,B as re,eG as xe,eH as ye}from"./useAppFontEffects-6HvTeJY2.js";import"./katex.min-B7gF3rmE.js";const be="data-diff-find-bar",Pe=t=>{const e=de.c(87),{query:i,onQueryChange:y,total:c,currentIndex:p,isSearching:s,failedCount:E,onNext:g,onPrevious:x,onClose:m,focusNonce:d,className:P}=t,L=E===void 0?0:E,{t:o}=pe(),R=n.useRef(null);let k,C;e[0]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{R.current?.focus()},C=[],e[0]=k,e[1]=C):(k=e[0],C=e[1]),n.useEffect(k,C);let F,b;e[2]!==d?(F=()=>{d&&d>0&&(R.current?.focus(),R.current?.select())},b=[d],e[2]=d,e[3]=F,e[4]=b):(F=e[3],b=e[4]),n.useEffect(F,b);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 N=I;let h;e[8]!==p||e[9]!==N||e[10]!==o||e[11]!==c?(h=c>0?o("diffFind.countAria",{current:p+1,total:c}):N?o("diffFind.noMatches"):void 0,e[8]=p,e[9]=N,e[10]=o,e[11]=c,e[12]=h):h=e[12];const _=h;let a;e[13]!==s||e[14]!==_||e[15]!==o?(a=s?[_,o("diffFind.searchingAria")].filter(Boolean).join(", "):_,e[13]=s,e[14]=_,e[15]=o,e[16]=a):a=e[16];const l=a;let u;e[17]!==m||e[18]!==g||e[19]!==x?(u=T=>{fe(T)||(T.key==="Enter"?(T.preventDefault(),T.shiftKey?x():g()):T.key==="Escape"&&(T.preventDefault(),m()))},e[17]=m,e[18]=g,e[19]=x,e[20]=u):u=e[20];const S=u;let v;e[21]!==P?(v=he("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]=v):v=e[22];let Q;e[23]===Symbol.for("react.memo_cache_sentinel")?(Q=M.jsx(te,{name:"search",className:"ms-0.5 size-3.5 text-muted-foreground"}),e[23]=Q):Q=e[23];let $;e[24]!==y?($=T=>y(T.target.value),e[24]=y,e[25]=$):$=e[25];let j;e[26]!==o?(j=o("diffFind.placeholder"),e[26]=o,e[27]=j):j=e[27];let z;e[28]!==o?(z=o("diffFind.placeholder"),e[28]=o,e[29]=z):z=e[29];let D;e[30]!==S||e[31]!==i||e[32]!==$||e[33]!==j||e[34]!==z?(D=M.jsx(ge,{ref:R,value:i,onChange:$,onKeyDown:S,placeholder:j,"aria-label":z,className:"h-7 w-40 rounded-md px-2 py-0 text-sm md:w-56"}),e[30]=S,e[31]=i,e[32]=$,e[33]=j,e[34]=z,e[35]=D):D=e[35];let B;e[36]!==p||e[37]!==N||e[38]!==s||e[39]!==o||e[40]!==c?(B=N&&c===0?o("diffFind.noMatches"):c>0?`${p+1}/${c}${s?"+":""}`:"",e[36]=p,e[37]=N,e[38]=s,e[39]=o,e[40]=c,e[41]=B):B=e[41];let r;e[42]!==l||e[43]!==B?(r=M.jsx("span",{className:"min-w-12 px-1 text-center typography-micro text-muted-foreground tabular-nums","aria-live":"polite","aria-label":l,children:B}),e[42]=l,e[43]=B,e[44]=r):r=e[44];let f;e[45]!==o?(f=o("diffFind.previousAria"),e[45]=o,e[46]=f):f=e[46];let w;e[47]!==o?(w=o("diffFind.previousAria"),e[47]=o,e[48]=w):w=e[48];const A=c===0;let O;e[49]===Symbol.for("react.memo_cache_sentinel")?(O=M.jsx(te,{name:"arrow-up",className:"size-3.5"}),e[49]=O):O=e[49];let H;e[50]!==x||e[51]!==f||e[52]!==w||e[53]!==A?(H=M.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:x,title:f,"aria-label":w,disabled:A,children:O}),e[50]=x,e[51]=f,e[52]=w,e[53]=A,e[54]=H):H=e[54];let K;e[55]!==o?(K=o("diffFind.nextAria"),e[55]=o,e[56]=K):K=e[56];let W;e[57]!==o?(W=o("diffFind.nextAria"),e[57]=o,e[58]=W):W=e[58];const se=c===0;let Y;e[59]===Symbol.for("react.memo_cache_sentinel")?(Y=M.jsx(te,{name:"arrow-down",className:"size-3.5"}),e[59]=Y):Y=e[59];let U;e[60]!==g||e[61]!==K||e[62]!==W||e[63]!==se?(U=M.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:g,title:K,"aria-label":W,disabled:se,children:Y}),e[60]=g,e[61]=K,e[62]=W,e[63]=se,e[64]=U):U=e[64];let q;e[65]!==o?(q=o("diffFind.closeAria"),e[65]=o,e[66]=q):q=e[66];let G;e[67]!==o?(G=o("diffFind.closeAria"),e[67]=o,e[68]=G):G=e[68];let Z;e[69]===Symbol.for("react.memo_cache_sentinel")?(Z=M.jsx(te,{name:"close",className:"size-3.5"}),e[69]=Z):Z=e[69];let J;e[70]!==m||e[71]!==q||e[72]!==G?(J=M.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:m,title:q,"aria-label":G,children:Z}),e[70]=m,e[71]=q,e[72]=G,e[73]=J):J=e[73];let V;e[74]!==D||e[75]!==r||e[76]!==H||e[77]!==U||e[78]!==J?(V=M.jsxs("div",{className:"flex items-center gap-1",children:[Q,D,r,H,U,J]}),e[74]=D,e[75]=r,e[76]=H,e[77]=U,e[78]=J,e[79]=V):V=e[79];let X;e[80]!==L||e[81]!==o?(X=L>0&&M.jsx("p",{className:"w-0 min-w-full px-1 pb-0.5 typography-micro text-status-warning",children:o("diffFind.failedCount",{count:L})}),e[80]=L,e[81]=o,e[82]=X):X=e[82];let ee;return e[83]!==v||e[84]!==V||e[85]!==X?(ee=M.jsxs("div",{"data-diff-find-bar":"",className:v,children:[V,X]}),e[83]=v,e[84]=V,e[85]=X,e[86]=ee):ee=e[86],ee},Se=/[.*+?^${}()|[\]\\]/g,we=t=>t.replace(Se,"\\$&"),Fe=t=>t.replace(/\r?\n$/,""),Ee=(t,e,i)=>{const y=new RegExp(we(e),i?"g":"gi"),c=[];for(const p of t.matchAll(y))c.push({spanStart:p.index??0,spanLength:p[0].length});return c},ne=(t,e,i,y,c,p,s)=>{if(y<1)return;const E=Fe(c);for(const g of Ee(E,p,s))t.push({filePath:e,side:i,lineNumber:y,spanStart:g.spanStart,spanLength:g.spanLength})},Re=(t,e,i,y)=>{if(i.length===0)return[];const c=y.caseSensitive??!1,p=y.layout==="inline",s=[];for(const E of t.hunks){let g=E.additionStart,x=E.deletionStart;for(const m of E.hunkContent){if(m.type==="context"){for(let d=0;d<m.lines;d+=1)p||ne(s,e,"deletions",x+d,t.deletionLines[m.deletionLineIndex+d],i,c),ne(s,e,"additions",g+d,t.additionLines[m.additionLineIndex+d],i,c);g+=m.lines,x+=m.lines;continue}for(let d=0;d<m.deletions;d+=1)ne(s,e,"deletions",x+d,t.deletionLines[m.deletionLineIndex+d],i,c);x+=m.deletions;for(let d=0;d<m.additions;d+=1)ne(s,e,"additions",g+d,t.additionLines[m.additionLineIndex+d],i,c);g+=m.additions}}return s},ve=120,_e=(t,e)=>t&&e?me(t):t,oe=[],ae=(t,e)=>t.filePath===e.filePath&&t.side===e.side&&t.lineNumber===e.lineNumber&&t.spanStart===e.spanStart,ce=(t,e)=>{const i=t.get(e.filePath);return i!==void 0&&i.revision===e.revision},ie=(t,e)=>t.has(e.filePath)&&t.get(e.filePath)===e.revision,le=(t,e)=>{const i=[],y=c=>{for(const p of c){const s=e.get(p.filePath);s?.nestedSources&&s.revision===p.revision?y(s.nestedSources):i.push(p)}};return y(t),i},je=({sources:t,caseSensitive:e=!1})=>{const[i,y]=n.useState(!1),[c,p]=n.useState(""),[s,E]=n.useState(""),[g,x]=n.useState(0),[m,d]=n.useState(()=>new Map),P=n.useRef(m),[L,o]=n.useState(()=>new Map),R=n.useRef(L),k=n.useRef(t);k.current=t;const C=n.useRef(i);C.current=i;const F=n.useRef(!1),b=n.useRef(null),I=n.useCallback(async()=>{if(!F.current){F.current=!0;try{for(;;){if(!C.current)return;const r=le(k.current,P.current).find(O=>!ce(P.current,O)&&!ie(R.current,O));if(!r)return;let f;try{f=await r.load()}catch{const O=new Map(R.current).set(r.filePath,r.revision);R.current=O,o(O);continue}const w=f!==null&&"nestedSources"in f?{revision:r.revision,diff:null,nestedSources:f.nestedSources}:{revision:r.revision,diff:f,nestedSources:null},A=new Map(P.current).set(r.filePath,w);P.current=A,d(A)}}finally{F.current=!1}}},[]);n.useEffect(()=>{i&&I()},[i,I,t]),n.useEffect(()=>{if(c===s)return;const r=window.setTimeout(()=>{E(c),x(0)},ve);return()=>window.clearTimeout(r)},[s,c]);const N=n.useMemo(()=>le(t,m),[m,t]),h=n.useMemo(()=>{if(!i)return oe;const r=s.trim();if(r.length===0)return oe;const f=[];for(const w of N){const A=m.get(w.filePath)?.diff;A&&f.push(...Re(A,w.filePath,r,{caseSensitive:e,layout:w.layout}))}return f},[s,e,i,m,N]),_=n.useRef(h);_.current=h;const[a,l]=n.useState({matches:h,query:s});if(a.matches!==h){const r=a.query===s?a.matches[g]:void 0,f=r?h.findIndex(A=>ae(A,r)):-1,w=f>=0?f:h.length===0?0:Math.min(g,h.length-1);l({matches:h,query:s}),w!==g&&x(w)}const u=n.useCallback(r=>{b.current=null,p(r)},[]),S=n.useCallback(()=>{if(!C.current&&R.current.size>0){const r=new Map;R.current=r,o(r)}y(!0)},[]),v=n.useCallback(()=>{b.current=null,S()},[S]),Q=n.useCallback(()=>{b.current=null,y(!1)},[]),$=n.useCallback((r,f)=>{if(p(r),E(r),S(),f){b.current={...f,query:r};return}b.current=null,x(0)},[S]),j=i&&N.some(r=>!ce(m,r)&&!ie(L,r)),z=i?N.filter(r=>ie(L,r)).length:0;n.useEffect(()=>{const r=b.current;if(!r)return;if(!i||r.query!==s){b.current=null;return}const f=h.findIndex(w=>ae(w,r));if(f>=0){b.current=null,x(h.length===0?0:(f+1)%h.length);return}j||(b.current=null,x(0))},[s,i,j,h]);const D=n.useCallback(()=>{x(r=>{const f=_.current.length;return f===0?0:(r+1)%f})},[]),B=n.useCallback(()=>{x(r=>{const f=_.current.length;return f===0?0:(r-1+f)%f})},[]);return{isOpen:i,open:v,close:Q,query:c,setQuery:u,matches:h,currentIndex:g,currentMatch:h[g]??null,isSearching:j,failedCount:z,next:D,previous:B,openWithQuery:$}},Ce=(t,e)=>t instanceof HTMLElement&&!e?.contains(t)&&(t.isContentEditable||t.matches("input, textarea")),Ne=5e3,Ie="[data-find-surface]",ue=(t,e)=>{if(!(t instanceof Element))return!1;const i=t.closest(Ie);return i!==null&&i!==e},Oe=({find:t,visible:e,rootRef:i,reveal:y})=>{const{isOpen:c,matches:p,currentMatch:s,currentIndex:E,open:g,close:x,openWithQuery:m}=t,d=n.useRef(new Map),[P,L]=n.useState(0),o=n.useRef(y);o.current=y;const R=n.useMemo(()=>{const a=new Map;for(const l of p){const u=a.get(l.filePath);u?u.push(l):a.set(l.filePath,[l])}return a},[p]),k=n.useRef({isOpen:c,currentMatch:s,matchesByFile:R});k.current={isOpen:c,currentMatch:s,matchesByFile:R};const C=n.useCallback((a,l)=>{const u=k.current,S=u.currentMatch;if(!u.isOpen||!S||S.filePath!==a){l.setFindHighlights([],0);return}const v=u.matchesByFile.get(a)??[];l.setFindHighlights(v,v.indexOf(S))},[]),F=n.useRef(null),b=n.useCallback(()=>{const a=F.current;a?.frame!=null&&window.cancelAnimationFrame(a.frame),F.current=null},[]),I=n.useCallback(a=>{const l=F.current;l?.frame!=null&&window.cancelAnimationFrame(l.frame);const u={match:a,frame:null,deadline:performance.now()+Ne};F.current=u;const S=()=>{if(u.frame=null,F.current!==u)return;if(d.current.get(a.filePath)?.scrollToLine({lineNumber:a.lineNumber,side:a.side,align:"center"})){F.current=null;return}performance.now()<u.deadline&&(u.frame=window.requestAnimationFrame(S))};u.frame=window.requestAnimationFrame(S)},[]);n.useEffect(()=>b,[b]);const N=n.useCallback((a,l)=>{if(!l){d.current.delete(a);return}d.current.set(a,l),k.current.isOpen&&C(a,l);const u=F.current;u&&u.match.filePath===a&&I(u.match)},[C,I]);n.useEffect(()=>{for(const[a,l]of d.current)C(a,l)},[C,s,c,R]);const h=n.useRef(null);n.useEffect(()=>{if(!c||!s){h.current=null,b();return}const a=`${E}:${s.filePath}:${s.side}:${s.lineNumber}:${s.spanStart}`;h.current!==a&&(h.current=a,o.current(s,d.current.has(s.filePath)),I(s))},[b,E,s,c,I]),xe("find_in_file",a=>{if(!e||a.defaultPrevented||Ce(document.activeElement,i.current)||ue(a.target,i.current))return!1;g(),L(l=>l+1)}),n.useEffect(()=>{if(!e||!c)return;const a=l=>{if(l.key!=="Escape"||l.defaultPrevented||fe(l))return;const{target:u}=l;if(!(u instanceof Node))return;const S=document.activeElement,v=!S||S===document.body;!i.current?.contains(u)&&!v||ue(u,i.current)||!(u instanceof Element&&u.closest(`[${be}]`)!==null)&&ye(u)||(l.preventDefault(),l.stopPropagation(),x())};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[x,c,i,e]);const _=n.useCallback((a,l)=>{m(l.word,{filePath:a,side:l.side,lineNumber:l.lineNumber,spanStart:l.spanStart}),L(u=>u+1)},[m]);return{registerViewer:N,openOnWord:_,focusNonce:P}};export{Pe as D,Oe as a,_e as r,je as u};
@@ -1,2 +1,2 @@
1
- import{R as w,f as fe,j as t}from"./vendor-react--VO_rL_p.js";import{u as It}from"./vendor-tanstack-react-virtual-CqfECoM0.js";import{gd as Et,u as ue,aa as tt,ab as st,I as _,ac as it,eE as Dt,Q as oe,K as Tt,B as ee,gC as zt,b0 as Rt,t as Te,q as ze,D as Re,l as Oe,F as Fe,o as et,gD as Ot,aL as Ft,$ as nt,gE as at,n as ot,gF as Pt,aS as Lt,A as de,C as $t,bE as pt,bF as gt,gG as De,gH as xt,bS as He,gI as yt,gJ as bt,gK as Mt,gL as vt,gM as Ge,gN as wt,gO as jt,gP as Ht,gQ as Gt,gR as Nt,gS as _t,gT as Bt,gU as Kt,gV as Ct,gW as St,fl as qe,bq as rt,br as lt,bs as ct,bt as dt,bu as ut,gX as Ut,gY as qt,gZ as Jt,g_ as Wt,g$ as Xt,bR as Le,h0 as kt,h1 as Qt,x as mt,h2 as Yt,h3 as Zt}from"./useAppFontEffects-UKWR--vP.js";import{u as _e,bR as Vt,bS as es,aI as Be}from"./katex.min-BM3LOlr3.js";import{a as ts,b as ss,c as is,f as ns,T as Je}from"./useBranchPullRequestRequest-DJNOWuS3.js";import{C as as}from"./ChangedPathLabel-BZHIGJ_0.js";import{O as os,K as rs,L as ls,ar as cs}from"./runtimeEndpointReset-IJE1o-nk.js";const ds=w.memo(function(e){const s=fe.c(66),{file:i,actionLabel:f,actionSymbol:h,onAction:m,onViewDiff:u,onRevert:l,isReverting:g,stats:I,rowPaddingClassName:y,indentPx:r,actionAtStart:N,nameOnly:S,showRevert:O}=e,k=r===void 0?0:r,j=N===void 0?!1:N,c=S===void 0?!1:S,x=O===void 0?!0:O;let F;s[0]!==i?(F=Et(i),s[0]=i,s[1]=F):F=s[1];const E=F,{t:M}=ue();let J;s[2]!==E.descriptionKey||s[3]!==M?(J=M(E.descriptionKey),s[2]=E.descriptionKey,s[3]=M,s[4]=J):J=s[4];const H=J,B=I?.insertions??0,D=I?.deletions??0;let T;s[5]!==m||s[6]!==u?(T=ie=>{ie.key===" "?(ie.preventDefault(),m()):ie.key==="Enter"&&(ie.preventDefault(),u())},s[5]=m,s[6]=u,s[7]=T):T=s[7];const A=T;let b;s[8]!==m?(b=ie=>{ie.preventDefault(),ie.stopPropagation(),m()},s[8]=m,s[9]=b):b=s[9];const $=b;let C;s[10]!==l?(C=ie=>{ie.preventDefault(),ie.stopPropagation(),l()},s[10]=l,s[11]=C):C=s[11];const z=C;let P;s[12]!==f||s[13]!==h||s[14]!==$?(P=t.jsx("button",{type:"button",onClick:$,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":f,title:f,children:h}),s[12]=f,s[13]=h,s[14]=$,s[15]=P):P=s[15];const X=P;let K;s[16]===Symbol.for("react.memo_cache_sentinel")?(K={color:"var(--status-success)"},s[16]=K):K=s[16];let U;s[17]!==B?(U=t.jsxs("span",{style:K,children:["+",B]}),s[17]=B,s[18]=U):U=s[18];let q,Q;s[19]===Symbol.for("react.memo_cache_sentinel")?(q=t.jsx("span",{className:"text-muted-foreground mx-0.5",children:"/"}),Q={color:"var(--status-error)"},s[19]=q,s[20]=Q):(q=s[19],Q=s[20]);let R;s[21]!==D?(R=t.jsxs("span",{style:Q,children:["-",D]}),s[21]=D,s[22]=R):R=s[22];let L;s[23]!==U||s[24]!==R?(L=t.jsxs("span",{className:"shrink-0 typography-micro",children:[U,q,R]}),s[23]=U,s[24]=R,s[25]=L):L=s[25];const W=L;let se;s[26]!==i.path||s[27]!==z||s[28]!==g||s[29]!==x||s[30]!==M?(se=x?t.jsxs(tt,{children:[t.jsx(st,{asChild:!0,children:t.jsx("button",{type:"button",onClick:z,disabled:g,className:"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":M("gitView.changes.revertFileAria",{path:i.path}),children:g?t.jsx(_,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(_,{name:"arrow-go-back",className:"size-3.5"})})}),t.jsx(it,{sideOffset:8,children:M("gitView.changes.revertFileTooltip")})]}):null,s[26]=i.path,s[27]=z,s[28]=g,s[29]=x,s[30]=M,s[31]=se):se=s[31];const Y=se,n=`group flex items-center gap-2 py-1.5 cursor-pointer ${y??"px-3"}`;let d;s[32]!==k?(d=k>0?{paddingInlineStart:`${k}px`}:void 0,s[32]=k,s[33]=d):d=s[33];const p=j?X:null;let v;s[34]!==E.color?(v={color:E.color},s[34]=E.color,s[35]=v):v=s[35];let o;s[36]!==E.code||s[37]!==H||s[38]!==v?(o=t.jsx("span",{className:"typography-micro font-semibold w-4 text-center uppercase",style:v,title:H,"aria-label":H,children:E.code}),s[36]=E.code,s[37]=H,s[38]=v,s[39]=o):o=s[39];let V;s[40]!==i.path?(V=t.jsx(Dt,{filePath:i.path,className:"h-3.5 w-3.5 shrink-0"}),s[40]=i.path,s[41]=V):V=s[41];let G;e:{if(i.path.lastIndexOf("/")===-1||c){let re;s[42]===Symbol.for("react.memo_cache_sentinel")?(re={direction:"rtl",unicodeBidi:"plaintext"},s[42]=re):re=s[42];const he=i.path;let le;s[43]!==i.path?(le=ts(i.path),s[43]=i.path,s[44]=le):le=s[44];let me;s[45]!==i.path||s[46]!==le?(me=t.jsx("span",{className:"oc-ui-start-align flex-1 min-w-0 truncate typography-ui-label text-foreground",style:re,title:he,children:le}),s[45]=i.path,s[46]=le,s[47]=me):me=s[47],G=me;break e}let ne;s[48]!==i.path?(ne=t.jsx(as,{path:i.path,className:"flex-1 typography-ui-label"}),s[48]=i.path,s[49]=ne):ne=s[49],G=ne}let te;s[50]!==j||s[51]!==X||s[52]!==g||s[53]!==Y||s[54]!==W?(te=j?t.jsxs(t.Fragment,{children:[W,Y]}):t.jsxs("span",{className:"flex shrink-0 items-center justify-items-end gap-2 md:grid",children:[t.jsx("span",{className:oe("md:col-start-1 md:row-start-1",g?"md:invisible":"md:group-hover:invisible md:group-focus-within:invisible"),children:W}),t.jsxs("span",{className:oe("flex items-center gap-2 md:col-start-1 md:row-start-1",!g&&"md:invisible md:group-hover:visible md:group-focus-within:visible"),children:[Y,X]})]}),s[50]=j,s[51]=X,s[52]=g,s[53]=Y,s[54]=W,s[55]=te):te=s[55];let ae;return s[56]!==A||s[57]!==u||s[58]!==n||s[59]!==d||s[60]!==p||s[61]!==o||s[62]!==V||s[63]!==G||s[64]!==te?(ae=t.jsxs("div",{className:n,role:"button",tabIndex:0,onClick:u,onKeyDown:A,style:d,children:[p,o,V,G,te]}),s[56]=A,s[57]=u,s[58]=n,s[59]=d,s[60]=p,s[61]=o,s[62]=V,s[63]=G,s[64]=te,s[65]=ae):ae=s[65],ae}),us=1e3,ft=34,We=30,$e="ps-0 pe-2",Xe=(a,e)=>`${a} ${e}`,Ms=({groups:a,diffStats:e,revertingPaths:s,isRevertingAll:i=!1,headerBackgroundClassName:f="bg-sidebar",onVisiblePathsChange:h,onRevertAll:m,onRevertDirectory:u})=>{const{t:l}=ue(),g=w.useRef(null),y=_e(n=>n.gitChangesViewMode)==="tree",r=w.useMemo(()=>a.filter(n=>n.entries.length>0),[a]),[N,S]=w.useState(new Set),[O,k]=w.useState(new Set),[j,c]=w.useState(!1),[x,F]=w.useState(null),E=Tt(),{confirm:M}=E,J=w.useCallback(async(n,d)=>{await M({title:l("gitView.changes.revertFileDialogTitle"),message:l("gitView.changes.revertFileDescription",{path:d}),action:l("gitView.changes.revertFileConfirm"),destructive:!0})&&n.onRevertFile(d)},[M,l]),H=w.useMemo(()=>r.map(n=>ss(n.entries)),[r]),B=w.useMemo(()=>{const n=[];return r.forEach((d,p)=>{Array.from(H[p]?.children.values()??[]).forEach(v=>{n.push(Xe(d.id,is(v).node.path))})}),n},[H,r]);w.useEffect(()=>{y&&k(n=>{const d=new Set,p=new Set(B);return n.forEach(v=>{(v.slice(v.indexOf(" ")+1).includes("/")||p.has(v))&&d.add(v)}),B.forEach(v=>d.add(v)),d})},[y,B]);const D=w.useMemo(()=>{const n=[];return r.forEach((d,p)=>{if(n.push({type:"header",key:`header:${d.id}`,groupIndex:p}),!N.has(d.id)){if(y){const v=new Set;O.forEach(V=>{V.startsWith(`${d.id} `)&&v.add(V.slice(d.id.length+1))}),ns(H[p],v).forEach(V=>{V.kind==="file"?n.push({type:"file",key:`${d.id}:${V.key}`,groupIndex:p,file:V.file,depth:V.depth}):n.push({type:"directory",key:`${d.id}:${V.key}`,groupIndex:p,directory:V.directory,label:V.label,depth:V.depth})});return}d.entries.forEach(v=>{n.push({type:"file",key:`${d.id}:file:${v.path}`,groupIndex:p,file:v,depth:0})})}}),m&&r.length>0&&n.push({type:"revert-all",key:"revert-all"}),n},[N,O,y,m,H,r]),T=D.length,A=T>=us,b=It({count:T,enabled:A,getScrollElement:()=>g.current,estimateSize:()=>ft,overscan:12,getItemKey:n=>D[n]?.key??n}),$=b.getVirtualItems(),C=w.useMemo(()=>{if(!A)return 0;const n=g.current?.scrollTop??0;return $.find(p=>p.end>n)?.index??0},[A,$,g]);w.useEffect(()=>{if(!h)return;const n=d=>d&&d.type==="file"?d.file.path:null;if(T===0){h([]);return}if(!A){const d=[];for(const p of D)if(p.type==="file"&&(d.push(p.file.path),d.length>=We))break;h(d);return}h(D.slice(C,C+Math.ceil((g.current?.clientHeight??0)/ft)+We).map(d=>n(d)).filter(d=>!!d).slice(0,We))},[h,T,D,A,C]);const z=w.useCallback(n=>{S(d=>{const p=new Set(d);return p.has(n)?p.delete(n):p.add(n),p})},[]),P=w.useCallback((n,d)=>{k(p=>{const v=new Set(p),o=Xe(n,d);return v.has(o)?v.delete(o):v.add(o),v})},[]),X=w.useMemo(()=>{const n=new Set;return r.forEach(d=>d.entries.forEach(p=>n.add(p.path))),Array.from(n)},[r]),K=X.length,U=x?i||x.paths.some(n=>s.has(n)):!1,q=w.useCallback(async()=>{!m||i||X.length===0||(await m(X),c(!1))},[X,i,m]),Q=w.useCallback(async()=>{!u||!x||U||(await u(x.paths),F(null))},[U,u,x]),R=w.useCallback((n,d)=>{const p=N.has(n.id),v=n.entries.length;return t.jsxs("div",{className:oe("sticky top-0 z-10 flex items-center gap-2 py-2",f,$e,!d&&"mt-1 border-t border-edge-muted"),children:[t.jsx("button",{type:"button",onClick:()=>n.onActionAll(n.entries.map(o=>o.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":n.actionAllLabel,title:n.actionAllLabel,children:n.actionSymbol}),t.jsxs("button",{type:"button",onClick:()=>z(n.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":!p,children:[t.jsx("h3",{className:"truncate typography-ui-header font-semibold text-foreground",children:n.title}),t.jsx("span",{className:"typography-meta text-muted-foreground",children:v}),t.jsx(_,{name:"arrow-down-s",className:oe("size-3.5 shrink-0 text-muted-foreground transition-transform",p&&"-rotate-90 rtl:rotate-90")})]})]})},[N,f,z]),L=w.useCallback((n,d,p,v)=>{const o=O.has(Xe(n.id,d.path)),V=d.files.map(te=>te.path),G=i||V.some(te=>s.has(te));return t.jsxs("div",{className:oe("group flex items-center gap-2 py-1.5 text-muted-foreground hover:text-foreground",$e),style:{paddingInlineStart:`${v*Je}px`},children:[t.jsxs("button",{type:"button",onClick:()=>P(n.id,d.path),"aria-expanded":o,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":o?l("gitView.changes.collapseDirectoryAria",{path:d.path}):l("gitView.changes.expandDirectoryAria",{path:d.path}),children:[t.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center",children:t.jsx(_,{name:"arrow-right-s",className:oe("size-3.5 transition-transform",o&&"rotate-90 rtl:-rotate-90")})}),t.jsx("span",{className:"min-w-0 truncate typography-ui-label",title:d.path,children:p}),o?null:t.jsx("span",{className:"shrink-0 typography-micro tabular-nums text-muted-foreground",children:d.files.length})]}),t.jsxs("span",{className:oe("flex shrink-0 items-center gap-2 transition-opacity",!G&&"md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100"),children:[n.showRevertActions!==!1&&u?t.jsx("button",{type:"button",onClick:()=>F({path:d.path,paths:V,count:V.length}),disabled:G,className:"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":l("gitView.changes.revertDirectoryAria",{path:d.path}),title:l("gitView.changes.revertDirectoryTooltip"),children:G?t.jsx(_,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(_,{name:"arrow-go-back",className:"size-3.5"})}):null,t.jsx("button",{type:"button",onClick:()=>n.onActionAll(d.files.map(te=>te.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":l(n.actionSymbol==="+"?"gitView.changes.stageDirectoryAria":"gitView.changes.unstageDirectoryAria",{path:d.path}),title:l(n.actionSymbol==="+"?"gitView.changes.stageDirectoryAria":"gitView.changes.unstageDirectoryAria",{path:d.path}),children:n.actionSymbol})]})]})},[O,i,u,s,l,P]),W=w.useCallback((n,d)=>{if(n.type==="revert-all")return t.jsx("div",{className:oe("flex justify-end py-2",$e),children:t.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>c(!0),disabled:i,className:"gap-1.5 text-[var(--status-error)] hover:bg-[var(--status-error)]/10 hover:text-[var(--status-error)]",children:[t.jsx(_,{name:"arrow-go-back",className:"size-3.5"}),l("gitView.changes.revertAll")]})});const p=r[n.groupIndex];if(!p)return null;if(n.type==="header")return R(p,d);if(n.type==="directory")return L(p,n.directory,n.label,n.depth);const v=n.file;return t.jsx(ds,{file:v,actionLabel:p.getActionLabel(v.path),actionSymbol:p.actionSymbol,onAction:()=>p.onActionFile(v.path),stats:e?.[p.statsScope]?.[v.path],onViewDiff:()=>p.onViewDiff(v.path),onRevert:()=>{J(p,v.path)},isReverting:s.has(v.path)||i,rowPaddingClassName:$e,indentPx:n.depth*Je,actionAtStart:!y,nameOnly:y,showRevert:p.showRevertActions!==!1})},[e,i,y,L,R,J,s,l,r]),se=n=>n.type!=="file"&&n.type!=="directory"?null:Array.from({length:n.depth},(d,p)=>t.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 w-px bg-edge",style:{insetInlineStart:`${p*Je+8}px`}},p)),Y=w.useCallback(n=>{if(y)return!1;const d=D[n],p=D[n-1];return!d||!p||d.type!=="file"&&d.type!=="directory"||p.type!=="file"&&p.type!=="directory"?!1:p.groupIndex===d.groupIndex},[y,D]);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(zt,{ref:g,className:"overlay-scrollbar-target overlay-scrollbar-container min-h-0 w-full flex-1 overflow-x-hidden overflow-y-auto",children:A?t.jsx("div",{style:{height:b.getTotalSize(),position:"relative"},children:$.map(n=>{const d=D[n.index];return d?t.jsxs("div",{"data-index":n.index,ref:b.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},className:oe(Y(n.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:[se(d),W(d,n.index===0)]},d.key):null})}):t.jsx("div",{role:"list","aria-label":l("gitView.changes.changedFilesAria"),children:D.map((n,d)=>t.jsxs("div",{className:oe("relative",Y(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:[se(n),W(n,d===0)]},n.key))})}),t.jsx(Rt,{containerRef:g,disableHorizontal:!0})]}),E.dialog,t.jsx(Te,{open:j,onOpenChange:n=>{!i&&!n&&c(!1)},children:t.jsxs(ze,{className:"max-w-md",children:[t.jsxs(Re,{children:[t.jsx(Oe,{children:l("gitView.changes.revertAllDialogTitle")}),t.jsx(Fe,{children:K===1?l("gitView.changes.revertAllDescriptionSingle",{count:K}):l("gitView.changes.revertAllDescriptionPlural",{count:K})})]}),t.jsxs(et,{children:[t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>c(!1),disabled:i,children:l("gitView.common.cancel")}),t.jsx(ee,{variant:"destructive",size:"sm",onClick:()=>{q()},disabled:i,children:l(i?"gitView.changes.reverting":"gitView.changes.revertAll")})]})]})}),t.jsx(Te,{open:!!x,onOpenChange:n=>{!U&&!n&&F(null)},children:t.jsxs(ze,{className:"max-w-md",children:[t.jsxs(Re,{children:[t.jsx(Oe,{children:l("gitView.changes.revertDirectoryDialogTitle")}),t.jsx(Fe,{children:x?x.count===1?l("gitView.changes.revertDirectoryDescriptionSingle",{count:x.count,path:x.path}):l("gitView.changes.revertDirectoryDescriptionPlural",{count:x.count,path:x.path}):null})]}),t.jsxs(et,{children:[t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>F(null),disabled:U,children:l("gitView.common.cancel")}),t.jsx(ee,{variant:"destructive",size:"sm",onClick:()=>{Q()},disabled:U||!x,children:l(U?"gitView.changes.reverting":"gitView.changes.revertDirectory")})]})]})})]})},Qe=38,Me=200,ms=a=>{const e=fe.c(26),{value:s,onChange:i,onSubmit:f,placeholder:h,disabled:m,hasTouchInput:u,isMobile:l}=a,g=m===void 0?!1:m,I=u===void 0?!1:u,y=l===void 0?!1:l,{t:r}=ue(),N=w.useRef(null),S=Ot(N),O=_e(fs);let k;e[0]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{const b=N.current;if(!b)return;const $=document.activeElement===b,C=()=>{b.style.height=`${Qe}px`;const P=b.scrollHeight,X=Math.min(Math.max(P,Qe),Me);b.style.height=`${X}px`,b.style.overflowY=P>Me?"auto":"hidden",P>Me&&!$&&(b.scrollTop=b.scrollHeight)};C();const z=window.requestAnimationFrame(C);return()=>{window.cancelAnimationFrame(z)}},e[0]=k):k=e[0];let j;e[1]!==s?(j=[s],e[1]=s,e[2]=j):j=e[2],w.useLayoutEffect(k,j);let c;e[3]!==i?(c=b=>i(b.target.value),e[3]=i,e[4]=c):c=e[4];let x;e[5]!==f?(x=b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&!b.shiftKey&&!b.altKey&&(b.preventDefault(),f?.())},e[5]=f,e[6]=x):x=e[6];let F;e[7]!==h||e[8]!==r?(F=h??r("gitView.commit.messagePlaceholder"),e[7]=h,e[8]=r,e[9]=F):F=e[9];const E=I?"on":"off",M=I?"sentences":"off",J=y||O,H=g&&"opacity-50";let B;e[10]!==H?(B=oe("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",H),e[10]=H,e[11]=B):B=e[11];let D;e[12]===Symbol.for("react.memo_cache_sentinel")?(D={minHeight:Qe,maxHeight:Me},e[12]=D):D=e[12];let T;e[13]!==g||e[14]!==M||e[15]!==J||e[16]!==B||e[17]!==c||e[18]!==x||e[19]!==F||e[20]!==E||e[21]!==s?(T=t.jsx("textarea",{ref:N,value:s,onChange:c,onKeyDown:x,placeholder:F,rows:1,disabled:g,autoCorrect:E,autoCapitalize:M,spellCheck:J,className:B,style:D}),e[13]=g,e[14]=M,e[15]=J,e[16]=B,e[17]=c,e[18]=x,e[19]=F,e[20]=E,e[21]=s,e[22]=T):T=e[22];let A;return e[23]!==S||e[24]!==T?(A=t.jsxs(t.Fragment,{children:[T,S]}),e[23]=S,e[24]=T,e[25]=A):A=e[25],A};function fs(a){return a.inputSpellcheckEnabled}const hs=a=>{const e=fe.c(30),{highlights:s,onInsert:i}=a,{t:f}=ue();if(s.length===0)return null;let h;e[0]!==s||e[1]!==i?(h=()=>{i(s)},e[0]=s,e[1]=i,e[2]=h):h=e[2];const m=h;let u;e[3]!==f?(u=f("gitView.commit.aiHighlights.title"),e[3]=f,e[4]=u):u=e[4];let l;e[5]!==u?(l=t.jsx("p",{className:"typography-micro text-muted-foreground",children:u}),e[5]=u,e[6]=l):l=e[6];let g;e[7]!==f?(g=f("gitView.commit.aiHighlights.insertAria"),e[7]=f,e[8]=g):g=e[8];let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(_,{name:"arrow-down",className:"size-4"}),e[9]=I):I=e[9];let y;e[10]!==m||e[11]!==g?(y=t.jsx(st,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"icon",className:"size-6",onClick:m,"aria-label":g,children:I})}),e[10]=m,e[11]=g,e[12]=y):y=e[12];let r;e[13]!==f?(r=f("gitView.commit.aiHighlights.insertTooltip"),e[13]=f,e[14]=r):r=e[14];let N;e[15]!==r?(N=t.jsx(it,{sideOffset:8,children:r}),e[15]=r,e[16]=N):N=e[16];let S;e[17]!==y||e[18]!==N?(S=t.jsxs(tt,{children:[y,N]}),e[17]=y,e[18]=N,e[19]=S):S=e[19];let O;e[20]!==l||e[21]!==S?(O=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l,S]}),e[20]=l,e[21]=S,e[22]=O):O=e[22];let k;e[23]!==s?(k=s.map(ps),e[23]=s,e[24]=k):k=e[24];let j;e[25]!==k?(j=t.jsx("ul",{className:"space-y-1",children:k}),e[25]=k,e[26]=j):j=e[26];let c;return e[27]!==O||e[28]!==j?(c=t.jsxs("div",{className:"space-y-2 rounded-xl oc-tile px-3 py-2",children:[O,j]}),e[27]=O,e[28]=j,e[29]=c):c=e[29],c};function ps(a,e){return t.jsx("li",{className:"typography-meta text-foreground",children:a},`${a}-${e}`)}const Hs=a=>{const e=fe.c(83),{stagedCount:s,commitMessage:i,onCommitMessageChange:f,generatedHighlights:h,onInsertHighlights:m,onGenerateMessage:u,isGeneratingMessage:l,onCommit:g,onCommitAndPush:I,commitAction:y,networkOperationBlocked:r,hasPendingIndexMutation:N,gitmojiEnabled:S,onOpenGitmojiPicker:O}=a,k=r===void 0?!1:r,j=N===void 0?!1:N,{t:c}=ue(),x=s>0;let F;e[0]!==y||e[1]!==i||e[2]!==j||e[3]!==x?(F=i.trim()&&x&&y===null&&!j,e[0]=y,e[1]=i,e[2]=j,e[3]=x,e[4]=F):F=e[4];const E=F,{isMobile:M,hasTouchInput:J}=Ft();let H;e[5]!==c?(H=c("gitView.commit.title"),e[5]=c,e[6]=H):H=e[6];let B;e[7]!==H?(B=t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:H}),e[7]=H,e[8]=B):B=e[8];let D;e[9]!==x||e[10]!==c?(D=x?null:t.jsx("span",{className:"min-w-0 truncate typography-meta text-muted-foreground",children:c("gitView.commit.stageFilesHint")}),e[9]=x,e[10]=c,e[11]=D):D=e[11];let T;e[12]!==B||e[13]!==D?(T=t.jsxs("div",{className:"flex w-full items-baseline gap-2 px-0 pt-2 pb-1",children:[B,D]}),e[12]=B,e[13]=D,e[14]=T):T=e[14];let A;e[15]!==h||e[16]!==m?(A=t.jsx(hs,{highlights:h,onInsert:m}),e[15]=h,e[16]=m,e[17]=A):A=e[17];let b;e[18]!==E||e[19]!==l||e[20]!==g?(b=()=>{E&&!l&&g()},e[18]=E,e[19]=l,e[20]=g,e[21]=b):b=e[21];let $;e[22]!==c?($=c("gitView.commit.messagePlaceholder"),e[22]=c,e[23]=$):$=e[23];const C=y!==null;let z;e[24]!==i||e[25]!==J||e[26]!==M||e[27]!==f||e[28]!==$||e[29]!==C||e[30]!==b?(z=t.jsx(ms,{value:i,onChange:f,onSubmit:b,placeholder:$,disabled:C,hasTouchInput:J,isMobile:M}),e[24]=i,e[25]=J,e[26]=M,e[27]=f,e[28]=$,e[29]=C,e[30]=b,e[31]=z):z=e[31];let P;e[32]!==S||e[33]!==O||e[34]!==c?(P=S&&t.jsxs(ee,{variant:"outline",size:"sm",onClick:O,className:"w-fit",type:"button",children:[t.jsx(_,{name:"emotion-happy",className:"size-4"}),c("gitView.commit.addGitmoji")]}),e[32]=S,e[33]=O,e[34]=c,e[35]=P):P=e[35];const X=l||y!==null||j||s===0;let K;e[36]!==c?(K=c("gitView.commit.generateAria"),e[36]=c,e[37]=K):K=e[37];let U;e[38]!==l?(U=l?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"ai-generate-2",className:"size-4 text-primary"}),e[38]=l,e[39]=U):U=e[39];let q;e[40]!==c?(q=c("gitView.commit.generate"),e[40]=c,e[41]=q):q=e[41];let Q;e[42]!==q?(Q=t.jsx("span",{className:"commit-actions__label",children:q}),e[42]=q,e[43]=Q):Q=e[43];let R;e[44]!==u||e[45]!==X||e[46]!==K||e[47]!==U||e[48]!==Q?(R=t.jsxs(ee,{variant:"outline",size:"sm",onClick:u,disabled:X,type:"button","aria-label":K,className:"commit-actions__btn",children:[U,Q]}),e[44]=u,e[45]=X,e[46]=K,e[47]=U,e[48]=Q,e[49]=R):R=e[49];let L;e[50]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx("div",{className:"flex-1"}),e[50]=L):L=e[50];let W;e[51]!==g?(W=G=>g(G.currentTarget),e[51]=g,e[52]=W):W=e[52];const se=!E||l;let Y;e[53]!==c?(Y=c("gitView.commit.commitAria"),e[53]=c,e[54]=Y):Y=e[54];let n;e[55]!==y||e[56]!==c?(n=y==="commit"?t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label",children:c("gitView.commit.committing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"git-commit",className:"size-4"}),t.jsx("span",{className:"commit-actions__label",children:c("gitView.commit.commit")})]}),e[55]=y,e[56]=c,e[57]=n):n=e[57];let d;e[58]!==W||e[59]!==se||e[60]!==Y||e[61]!==n?(d=t.jsx(ee,{size:"sm",variant:"outline",onClick:W,disabled:se,className:"commit-actions__btn whitespace-nowrap","aria-label":Y,children:n}),e[58]=W,e[59]=se,e[60]=Y,e[61]=n,e[62]=d):d=e[62];let p;e[63]!==E||e[64]!==y||e[65]!==l||e[66]!==M||e[67]!==k||e[68]!==I||e[69]!==c?(p=M?t.jsxs(tt,{children:[t.jsx(st,{asChild:!0,children:t.jsx(ee,{variant:"default",size:"sm",onClick:G=>I(G.currentTarget),disabled:!E||l||k,className:"h-7 w-7 p-0","aria-label":c("gitView.commit.pushAria"),children:y==="commitAndPush"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"arrow-up",className:"size-3.5"})})}),t.jsx(it,{side:"top",children:t.jsx("p",{children:c("gitView.commit.push")})})]}):t.jsx(ee,{size:"sm",variant:"default",onClick:G=>I(G.currentTarget),disabled:!E||l||k,className:"commit-actions__btn","aria-label":c("gitView.commit.pushAria"),children:y==="commitAndPush"?t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:c("gitView.commit.pushing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"arrow-up",className:"size-3.5"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:c("gitView.commit.push")})]})}),e[63]=E,e[64]=y,e[65]=l,e[66]=M,e[67]=k,e[68]=I,e[69]=c,e[70]=p):p=e[70];let v;e[71]!==R||e[72]!==d||e[73]!==p?(v=t.jsxs("div",{className:"@container/commit-actions flex items-center gap-2 min-w-0",children:[R,L,d,p]}),e[71]=R,e[72]=d,e[73]=p,e[74]=v):v=e[74];let o;e[75]!==z||e[76]!==P||e[77]!==v||e[78]!==A?(o=t.jsxs("div",{className:"flex flex-col gap-3 px-0 pt-1 pb-3",children:[A,z,P,v]}),e[75]=z,e[76]=P,e[77]=v,e[78]=A,e[79]=o):o=e[79];let V;return e[80]!==o||e[81]!==T?(V=t.jsxs("section",{className:"border-0 bg-transparent rounded-none",children:[T,o]}),e[80]=o,e[81]=T,e[82]=V):V=e[82],V},Gs=a=>{const e=fe.c(153),{open:s,onOpenChange:i,conflictFiles:f,directory:h,operation:m,onAbort:u,onClearState:l,onNavigatedToChat:g}=a;let I;e[0]!==f?(I=f===void 0?[]:f,e[0]=f,e[1]=I):I=e[1];const y=I,{t:r}=ue(),N=nt(gs),S=nt(xs),O=at(ys),k=at(bs),[j,c]=w.useState(!1),[x,F]=w.useState(null),[E,M]=w.useState(null);let J,H;e[2]!==h||e[3]!==s||e[4]!==r?(J=()=>{!s||!h||(c(!0),M(null),F(null),Pt(h).then(Z=>{F(Z)}).catch(Z=>{const ce=Z instanceof Error?Z.message:r("gitView.conflict.loadFailed");M(ce)}).finally(()=>{c(!1)}))},H=[s,h,r],e[2]=h,e[3]=s,e[4]=r,e[5]=J,e[6]=H):(J=e[5],H=e[6]),w.useEffect(J,H);let B;e[7]!==x||e[8]!==h||e[9]!==m?(B=async()=>{if(!x)return null;const Z=m==="merge"?"merge":"rebase",ce=x.headInfo||(m==="merge"?"MERGE_HEAD":"REBASE_HEAD"),Ne=m==="merge"?"git commit --no-edit":"git rebase --continue",Ce=await Lt(h),pe=Ce.render("git.conflict.resolve.visible",{operation_label:Z,head_ref:ce}),ge=Ce.render("git.conflict.resolve.instructions",{operation_label:Z,directory:h,operation:m,head_info:x.headInfo||"N/A",continue_cmd:Ne}),xe=`${Z} conflict context (JSON)
1
+ import{R as w,f as fe,j as t}from"./vendor-react--VO_rL_p.js";import{u as It}from"./vendor-tanstack-react-virtual-CqfECoM0.js";import{gd as Et,u as ue,aa as tt,ab as st,I as _,ac as it,eE as Dt,Q as oe,K as Tt,B as ee,gC as zt,b0 as Rt,t as Te,q as ze,D as Re,l as Oe,F as Fe,o as et,gD as Ot,aL as Ft,$ as nt,gE as at,n as ot,gF as Pt,aS as Lt,A as de,C as $t,bE as pt,bF as gt,gG as De,gH as xt,bS as He,gI as yt,gJ as bt,gK as Mt,gL as vt,gM as Ge,gN as wt,gO as jt,gP as Ht,gQ as Gt,gR as Nt,gS as _t,gT as Bt,gU as Kt,gV as Ct,gW as St,fl as qe,bq as rt,br as lt,bs as ct,bt as dt,bu as ut,gX as Ut,gY as qt,gZ as Jt,g_ as Wt,g$ as Xt,bR as Le,h0 as kt,h1 as Qt,x as mt,h2 as Yt,h3 as Zt}from"./useAppFontEffects-6HvTeJY2.js";import{u as _e,bR as Vt,bS as es,aI as Be}from"./katex.min-B7gF3rmE.js";import{a as ts,b as ss,c as is,f as ns,T as Je}from"./useBranchPullRequestRequest-B8yYsqiw.js";import{C as as}from"./ChangedPathLabel-B6Ig547I.js";import{O as os,K as rs,L as ls,ar as cs}from"./runtimeEndpointReset-DUwSilpj.js";const ds=w.memo(function(e){const s=fe.c(66),{file:i,actionLabel:f,actionSymbol:h,onAction:m,onViewDiff:u,onRevert:l,isReverting:g,stats:I,rowPaddingClassName:y,indentPx:r,actionAtStart:N,nameOnly:S,showRevert:O}=e,k=r===void 0?0:r,j=N===void 0?!1:N,c=S===void 0?!1:S,x=O===void 0?!0:O;let F;s[0]!==i?(F=Et(i),s[0]=i,s[1]=F):F=s[1];const E=F,{t:M}=ue();let J;s[2]!==E.descriptionKey||s[3]!==M?(J=M(E.descriptionKey),s[2]=E.descriptionKey,s[3]=M,s[4]=J):J=s[4];const H=J,B=I?.insertions??0,D=I?.deletions??0;let T;s[5]!==m||s[6]!==u?(T=ie=>{ie.key===" "?(ie.preventDefault(),m()):ie.key==="Enter"&&(ie.preventDefault(),u())},s[5]=m,s[6]=u,s[7]=T):T=s[7];const A=T;let b;s[8]!==m?(b=ie=>{ie.preventDefault(),ie.stopPropagation(),m()},s[8]=m,s[9]=b):b=s[9];const $=b;let C;s[10]!==l?(C=ie=>{ie.preventDefault(),ie.stopPropagation(),l()},s[10]=l,s[11]=C):C=s[11];const z=C;let P;s[12]!==f||s[13]!==h||s[14]!==$?(P=t.jsx("button",{type:"button",onClick:$,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":f,title:f,children:h}),s[12]=f,s[13]=h,s[14]=$,s[15]=P):P=s[15];const X=P;let K;s[16]===Symbol.for("react.memo_cache_sentinel")?(K={color:"var(--status-success)"},s[16]=K):K=s[16];let U;s[17]!==B?(U=t.jsxs("span",{style:K,children:["+",B]}),s[17]=B,s[18]=U):U=s[18];let q,Q;s[19]===Symbol.for("react.memo_cache_sentinel")?(q=t.jsx("span",{className:"text-muted-foreground mx-0.5",children:"/"}),Q={color:"var(--status-error)"},s[19]=q,s[20]=Q):(q=s[19],Q=s[20]);let R;s[21]!==D?(R=t.jsxs("span",{style:Q,children:["-",D]}),s[21]=D,s[22]=R):R=s[22];let L;s[23]!==U||s[24]!==R?(L=t.jsxs("span",{className:"shrink-0 typography-micro",children:[U,q,R]}),s[23]=U,s[24]=R,s[25]=L):L=s[25];const W=L;let se;s[26]!==i.path||s[27]!==z||s[28]!==g||s[29]!==x||s[30]!==M?(se=x?t.jsxs(tt,{children:[t.jsx(st,{asChild:!0,children:t.jsx("button",{type:"button",onClick:z,disabled:g,className:"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":M("gitView.changes.revertFileAria",{path:i.path}),children:g?t.jsx(_,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(_,{name:"arrow-go-back",className:"size-3.5"})})}),t.jsx(it,{sideOffset:8,children:M("gitView.changes.revertFileTooltip")})]}):null,s[26]=i.path,s[27]=z,s[28]=g,s[29]=x,s[30]=M,s[31]=se):se=s[31];const Y=se,n=`group flex items-center gap-2 py-1.5 cursor-pointer ${y??"px-3"}`;let d;s[32]!==k?(d=k>0?{paddingInlineStart:`${k}px`}:void 0,s[32]=k,s[33]=d):d=s[33];const p=j?X:null;let v;s[34]!==E.color?(v={color:E.color},s[34]=E.color,s[35]=v):v=s[35];let o;s[36]!==E.code||s[37]!==H||s[38]!==v?(o=t.jsx("span",{className:"typography-micro font-semibold w-4 text-center uppercase",style:v,title:H,"aria-label":H,children:E.code}),s[36]=E.code,s[37]=H,s[38]=v,s[39]=o):o=s[39];let V;s[40]!==i.path?(V=t.jsx(Dt,{filePath:i.path,className:"h-3.5 w-3.5 shrink-0"}),s[40]=i.path,s[41]=V):V=s[41];let G;e:{if(i.path.lastIndexOf("/")===-1||c){let re;s[42]===Symbol.for("react.memo_cache_sentinel")?(re={direction:"rtl",unicodeBidi:"plaintext"},s[42]=re):re=s[42];const he=i.path;let le;s[43]!==i.path?(le=ts(i.path),s[43]=i.path,s[44]=le):le=s[44];let me;s[45]!==i.path||s[46]!==le?(me=t.jsx("span",{className:"oc-ui-start-align flex-1 min-w-0 truncate typography-ui-label text-foreground",style:re,title:he,children:le}),s[45]=i.path,s[46]=le,s[47]=me):me=s[47],G=me;break e}let ne;s[48]!==i.path?(ne=t.jsx(as,{path:i.path,className:"flex-1 typography-ui-label"}),s[48]=i.path,s[49]=ne):ne=s[49],G=ne}let te;s[50]!==j||s[51]!==X||s[52]!==g||s[53]!==Y||s[54]!==W?(te=j?t.jsxs(t.Fragment,{children:[W,Y]}):t.jsxs("span",{className:"flex shrink-0 items-center justify-items-end gap-2 md:grid",children:[t.jsx("span",{className:oe("md:col-start-1 md:row-start-1",g?"md:invisible":"md:group-hover:invisible md:group-focus-within:invisible"),children:W}),t.jsxs("span",{className:oe("flex items-center gap-2 md:col-start-1 md:row-start-1",!g&&"md:invisible md:group-hover:visible md:group-focus-within:visible"),children:[Y,X]})]}),s[50]=j,s[51]=X,s[52]=g,s[53]=Y,s[54]=W,s[55]=te):te=s[55];let ae;return s[56]!==A||s[57]!==u||s[58]!==n||s[59]!==d||s[60]!==p||s[61]!==o||s[62]!==V||s[63]!==G||s[64]!==te?(ae=t.jsxs("div",{className:n,role:"button",tabIndex:0,onClick:u,onKeyDown:A,style:d,children:[p,o,V,G,te]}),s[56]=A,s[57]=u,s[58]=n,s[59]=d,s[60]=p,s[61]=o,s[62]=V,s[63]=G,s[64]=te,s[65]=ae):ae=s[65],ae}),us=1e3,ft=34,We=30,$e="ps-0 pe-2",Xe=(a,e)=>`${a} ${e}`,Ms=({groups:a,diffStats:e,revertingPaths:s,isRevertingAll:i=!1,headerBackgroundClassName:f="bg-sidebar",onVisiblePathsChange:h,onRevertAll:m,onRevertDirectory:u})=>{const{t:l}=ue(),g=w.useRef(null),y=_e(n=>n.gitChangesViewMode)==="tree",r=w.useMemo(()=>a.filter(n=>n.entries.length>0),[a]),[N,S]=w.useState(new Set),[O,k]=w.useState(new Set),[j,c]=w.useState(!1),[x,F]=w.useState(null),E=Tt(),{confirm:M}=E,J=w.useCallback(async(n,d)=>{await M({title:l("gitView.changes.revertFileDialogTitle"),message:l("gitView.changes.revertFileDescription",{path:d}),action:l("gitView.changes.revertFileConfirm"),destructive:!0})&&n.onRevertFile(d)},[M,l]),H=w.useMemo(()=>r.map(n=>ss(n.entries)),[r]),B=w.useMemo(()=>{const n=[];return r.forEach((d,p)=>{Array.from(H[p]?.children.values()??[]).forEach(v=>{n.push(Xe(d.id,is(v).node.path))})}),n},[H,r]);w.useEffect(()=>{y&&k(n=>{const d=new Set,p=new Set(B);return n.forEach(v=>{(v.slice(v.indexOf(" ")+1).includes("/")||p.has(v))&&d.add(v)}),B.forEach(v=>d.add(v)),d})},[y,B]);const D=w.useMemo(()=>{const n=[];return r.forEach((d,p)=>{if(n.push({type:"header",key:`header:${d.id}`,groupIndex:p}),!N.has(d.id)){if(y){const v=new Set;O.forEach(V=>{V.startsWith(`${d.id} `)&&v.add(V.slice(d.id.length+1))}),ns(H[p],v).forEach(V=>{V.kind==="file"?n.push({type:"file",key:`${d.id}:${V.key}`,groupIndex:p,file:V.file,depth:V.depth}):n.push({type:"directory",key:`${d.id}:${V.key}`,groupIndex:p,directory:V.directory,label:V.label,depth:V.depth})});return}d.entries.forEach(v=>{n.push({type:"file",key:`${d.id}:file:${v.path}`,groupIndex:p,file:v,depth:0})})}}),m&&r.length>0&&n.push({type:"revert-all",key:"revert-all"}),n},[N,O,y,m,H,r]),T=D.length,A=T>=us,b=It({count:T,enabled:A,getScrollElement:()=>g.current,estimateSize:()=>ft,overscan:12,getItemKey:n=>D[n]?.key??n}),$=b.getVirtualItems(),C=w.useMemo(()=>{if(!A)return 0;const n=g.current?.scrollTop??0;return $.find(p=>p.end>n)?.index??0},[A,$,g]);w.useEffect(()=>{if(!h)return;const n=d=>d&&d.type==="file"?d.file.path:null;if(T===0){h([]);return}if(!A){const d=[];for(const p of D)if(p.type==="file"&&(d.push(p.file.path),d.length>=We))break;h(d);return}h(D.slice(C,C+Math.ceil((g.current?.clientHeight??0)/ft)+We).map(d=>n(d)).filter(d=>!!d).slice(0,We))},[h,T,D,A,C]);const z=w.useCallback(n=>{S(d=>{const p=new Set(d);return p.has(n)?p.delete(n):p.add(n),p})},[]),P=w.useCallback((n,d)=>{k(p=>{const v=new Set(p),o=Xe(n,d);return v.has(o)?v.delete(o):v.add(o),v})},[]),X=w.useMemo(()=>{const n=new Set;return r.forEach(d=>d.entries.forEach(p=>n.add(p.path))),Array.from(n)},[r]),K=X.length,U=x?i||x.paths.some(n=>s.has(n)):!1,q=w.useCallback(async()=>{!m||i||X.length===0||(await m(X),c(!1))},[X,i,m]),Q=w.useCallback(async()=>{!u||!x||U||(await u(x.paths),F(null))},[U,u,x]),R=w.useCallback((n,d)=>{const p=N.has(n.id),v=n.entries.length;return t.jsxs("div",{className:oe("sticky top-0 z-10 flex items-center gap-2 py-2",f,$e,!d&&"mt-1 border-t border-edge-muted"),children:[t.jsx("button",{type:"button",onClick:()=>n.onActionAll(n.entries.map(o=>o.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":n.actionAllLabel,title:n.actionAllLabel,children:n.actionSymbol}),t.jsxs("button",{type:"button",onClick:()=>z(n.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":!p,children:[t.jsx("h3",{className:"truncate typography-ui-header font-semibold text-foreground",children:n.title}),t.jsx("span",{className:"typography-meta text-muted-foreground",children:v}),t.jsx(_,{name:"arrow-down-s",className:oe("size-3.5 shrink-0 text-muted-foreground transition-transform",p&&"-rotate-90 rtl:rotate-90")})]})]})},[N,f,z]),L=w.useCallback((n,d,p,v)=>{const o=O.has(Xe(n.id,d.path)),V=d.files.map(te=>te.path),G=i||V.some(te=>s.has(te));return t.jsxs("div",{className:oe("group flex items-center gap-2 py-1.5 text-muted-foreground hover:text-foreground",$e),style:{paddingInlineStart:`${v*Je}px`},children:[t.jsxs("button",{type:"button",onClick:()=>P(n.id,d.path),"aria-expanded":o,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":o?l("gitView.changes.collapseDirectoryAria",{path:d.path}):l("gitView.changes.expandDirectoryAria",{path:d.path}),children:[t.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center",children:t.jsx(_,{name:"arrow-right-s",className:oe("size-3.5 transition-transform",o&&"rotate-90 rtl:-rotate-90")})}),t.jsx("span",{className:"min-w-0 truncate typography-ui-label",title:d.path,children:p}),o?null:t.jsx("span",{className:"shrink-0 typography-micro tabular-nums text-muted-foreground",children:d.files.length})]}),t.jsxs("span",{className:oe("flex shrink-0 items-center gap-2 transition-opacity",!G&&"md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100"),children:[n.showRevertActions!==!1&&u?t.jsx("button",{type:"button",onClick:()=>F({path:d.path,paths:V,count:V.length}),disabled:G,className:"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":l("gitView.changes.revertDirectoryAria",{path:d.path}),title:l("gitView.changes.revertDirectoryTooltip"),children:G?t.jsx(_,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(_,{name:"arrow-go-back",className:"size-3.5"})}):null,t.jsx("button",{type:"button",onClick:()=>n.onActionAll(d.files.map(te=>te.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":l(n.actionSymbol==="+"?"gitView.changes.stageDirectoryAria":"gitView.changes.unstageDirectoryAria",{path:d.path}),title:l(n.actionSymbol==="+"?"gitView.changes.stageDirectoryAria":"gitView.changes.unstageDirectoryAria",{path:d.path}),children:n.actionSymbol})]})]})},[O,i,u,s,l,P]),W=w.useCallback((n,d)=>{if(n.type==="revert-all")return t.jsx("div",{className:oe("flex justify-end py-2",$e),children:t.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>c(!0),disabled:i,className:"gap-1.5 text-[var(--status-error)] hover:bg-[var(--status-error)]/10 hover:text-[var(--status-error)]",children:[t.jsx(_,{name:"arrow-go-back",className:"size-3.5"}),l("gitView.changes.revertAll")]})});const p=r[n.groupIndex];if(!p)return null;if(n.type==="header")return R(p,d);if(n.type==="directory")return L(p,n.directory,n.label,n.depth);const v=n.file;return t.jsx(ds,{file:v,actionLabel:p.getActionLabel(v.path),actionSymbol:p.actionSymbol,onAction:()=>p.onActionFile(v.path),stats:e?.[p.statsScope]?.[v.path],onViewDiff:()=>p.onViewDiff(v.path),onRevert:()=>{J(p,v.path)},isReverting:s.has(v.path)||i,rowPaddingClassName:$e,indentPx:n.depth*Je,actionAtStart:!y,nameOnly:y,showRevert:p.showRevertActions!==!1})},[e,i,y,L,R,J,s,l,r]),se=n=>n.type!=="file"&&n.type!=="directory"?null:Array.from({length:n.depth},(d,p)=>t.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 w-px bg-edge",style:{insetInlineStart:`${p*Je+8}px`}},p)),Y=w.useCallback(n=>{if(y)return!1;const d=D[n],p=D[n-1];return!d||!p||d.type!=="file"&&d.type!=="directory"||p.type!=="file"&&p.type!=="directory"?!1:p.groupIndex===d.groupIndex},[y,D]);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(zt,{ref:g,className:"overlay-scrollbar-target overlay-scrollbar-container min-h-0 w-full flex-1 overflow-x-hidden overflow-y-auto",children:A?t.jsx("div",{style:{height:b.getTotalSize(),position:"relative"},children:$.map(n=>{const d=D[n.index];return d?t.jsxs("div",{"data-index":n.index,ref:b.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},className:oe(Y(n.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:[se(d),W(d,n.index===0)]},d.key):null})}):t.jsx("div",{role:"list","aria-label":l("gitView.changes.changedFilesAria"),children:D.map((n,d)=>t.jsxs("div",{className:oe("relative",Y(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:[se(n),W(n,d===0)]},n.key))})}),t.jsx(Rt,{containerRef:g,disableHorizontal:!0})]}),E.dialog,t.jsx(Te,{open:j,onOpenChange:n=>{!i&&!n&&c(!1)},children:t.jsxs(ze,{className:"max-w-md",children:[t.jsxs(Re,{children:[t.jsx(Oe,{children:l("gitView.changes.revertAllDialogTitle")}),t.jsx(Fe,{children:K===1?l("gitView.changes.revertAllDescriptionSingle",{count:K}):l("gitView.changes.revertAllDescriptionPlural",{count:K})})]}),t.jsxs(et,{children:[t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>c(!1),disabled:i,children:l("gitView.common.cancel")}),t.jsx(ee,{variant:"destructive",size:"sm",onClick:()=>{q()},disabled:i,children:l(i?"gitView.changes.reverting":"gitView.changes.revertAll")})]})]})}),t.jsx(Te,{open:!!x,onOpenChange:n=>{!U&&!n&&F(null)},children:t.jsxs(ze,{className:"max-w-md",children:[t.jsxs(Re,{children:[t.jsx(Oe,{children:l("gitView.changes.revertDirectoryDialogTitle")}),t.jsx(Fe,{children:x?x.count===1?l("gitView.changes.revertDirectoryDescriptionSingle",{count:x.count,path:x.path}):l("gitView.changes.revertDirectoryDescriptionPlural",{count:x.count,path:x.path}):null})]}),t.jsxs(et,{children:[t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>F(null),disabled:U,children:l("gitView.common.cancel")}),t.jsx(ee,{variant:"destructive",size:"sm",onClick:()=>{Q()},disabled:U||!x,children:l(U?"gitView.changes.reverting":"gitView.changes.revertDirectory")})]})]})})]})},Qe=38,Me=200,ms=a=>{const e=fe.c(26),{value:s,onChange:i,onSubmit:f,placeholder:h,disabled:m,hasTouchInput:u,isMobile:l}=a,g=m===void 0?!1:m,I=u===void 0?!1:u,y=l===void 0?!1:l,{t:r}=ue(),N=w.useRef(null),S=Ot(N),O=_e(fs);let k;e[0]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{const b=N.current;if(!b)return;const $=document.activeElement===b,C=()=>{b.style.height=`${Qe}px`;const P=b.scrollHeight,X=Math.min(Math.max(P,Qe),Me);b.style.height=`${X}px`,b.style.overflowY=P>Me?"auto":"hidden",P>Me&&!$&&(b.scrollTop=b.scrollHeight)};C();const z=window.requestAnimationFrame(C);return()=>{window.cancelAnimationFrame(z)}},e[0]=k):k=e[0];let j;e[1]!==s?(j=[s],e[1]=s,e[2]=j):j=e[2],w.useLayoutEffect(k,j);let c;e[3]!==i?(c=b=>i(b.target.value),e[3]=i,e[4]=c):c=e[4];let x;e[5]!==f?(x=b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&!b.shiftKey&&!b.altKey&&(b.preventDefault(),f?.())},e[5]=f,e[6]=x):x=e[6];let F;e[7]!==h||e[8]!==r?(F=h??r("gitView.commit.messagePlaceholder"),e[7]=h,e[8]=r,e[9]=F):F=e[9];const E=I?"on":"off",M=I?"sentences":"off",J=y||O,H=g&&"opacity-50";let B;e[10]!==H?(B=oe("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",H),e[10]=H,e[11]=B):B=e[11];let D;e[12]===Symbol.for("react.memo_cache_sentinel")?(D={minHeight:Qe,maxHeight:Me},e[12]=D):D=e[12];let T;e[13]!==g||e[14]!==M||e[15]!==J||e[16]!==B||e[17]!==c||e[18]!==x||e[19]!==F||e[20]!==E||e[21]!==s?(T=t.jsx("textarea",{ref:N,value:s,onChange:c,onKeyDown:x,placeholder:F,rows:1,disabled:g,autoCorrect:E,autoCapitalize:M,spellCheck:J,className:B,style:D}),e[13]=g,e[14]=M,e[15]=J,e[16]=B,e[17]=c,e[18]=x,e[19]=F,e[20]=E,e[21]=s,e[22]=T):T=e[22];let A;return e[23]!==S||e[24]!==T?(A=t.jsxs(t.Fragment,{children:[T,S]}),e[23]=S,e[24]=T,e[25]=A):A=e[25],A};function fs(a){return a.inputSpellcheckEnabled}const hs=a=>{const e=fe.c(30),{highlights:s,onInsert:i}=a,{t:f}=ue();if(s.length===0)return null;let h;e[0]!==s||e[1]!==i?(h=()=>{i(s)},e[0]=s,e[1]=i,e[2]=h):h=e[2];const m=h;let u;e[3]!==f?(u=f("gitView.commit.aiHighlights.title"),e[3]=f,e[4]=u):u=e[4];let l;e[5]!==u?(l=t.jsx("p",{className:"typography-micro text-muted-foreground",children:u}),e[5]=u,e[6]=l):l=e[6];let g;e[7]!==f?(g=f("gitView.commit.aiHighlights.insertAria"),e[7]=f,e[8]=g):g=e[8];let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(_,{name:"arrow-down",className:"size-4"}),e[9]=I):I=e[9];let y;e[10]!==m||e[11]!==g?(y=t.jsx(st,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"icon",className:"size-6",onClick:m,"aria-label":g,children:I})}),e[10]=m,e[11]=g,e[12]=y):y=e[12];let r;e[13]!==f?(r=f("gitView.commit.aiHighlights.insertTooltip"),e[13]=f,e[14]=r):r=e[14];let N;e[15]!==r?(N=t.jsx(it,{sideOffset:8,children:r}),e[15]=r,e[16]=N):N=e[16];let S;e[17]!==y||e[18]!==N?(S=t.jsxs(tt,{children:[y,N]}),e[17]=y,e[18]=N,e[19]=S):S=e[19];let O;e[20]!==l||e[21]!==S?(O=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l,S]}),e[20]=l,e[21]=S,e[22]=O):O=e[22];let k;e[23]!==s?(k=s.map(ps),e[23]=s,e[24]=k):k=e[24];let j;e[25]!==k?(j=t.jsx("ul",{className:"space-y-1",children:k}),e[25]=k,e[26]=j):j=e[26];let c;return e[27]!==O||e[28]!==j?(c=t.jsxs("div",{className:"space-y-2 rounded-xl oc-tile px-3 py-2",children:[O,j]}),e[27]=O,e[28]=j,e[29]=c):c=e[29],c};function ps(a,e){return t.jsx("li",{className:"typography-meta text-foreground",children:a},`${a}-${e}`)}const Hs=a=>{const e=fe.c(83),{stagedCount:s,commitMessage:i,onCommitMessageChange:f,generatedHighlights:h,onInsertHighlights:m,onGenerateMessage:u,isGeneratingMessage:l,onCommit:g,onCommitAndPush:I,commitAction:y,networkOperationBlocked:r,hasPendingIndexMutation:N,gitmojiEnabled:S,onOpenGitmojiPicker:O}=a,k=r===void 0?!1:r,j=N===void 0?!1:N,{t:c}=ue(),x=s>0;let F;e[0]!==y||e[1]!==i||e[2]!==j||e[3]!==x?(F=i.trim()&&x&&y===null&&!j,e[0]=y,e[1]=i,e[2]=j,e[3]=x,e[4]=F):F=e[4];const E=F,{isMobile:M,hasTouchInput:J}=Ft();let H;e[5]!==c?(H=c("gitView.commit.title"),e[5]=c,e[6]=H):H=e[6];let B;e[7]!==H?(B=t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:H}),e[7]=H,e[8]=B):B=e[8];let D;e[9]!==x||e[10]!==c?(D=x?null:t.jsx("span",{className:"min-w-0 truncate typography-meta text-muted-foreground",children:c("gitView.commit.stageFilesHint")}),e[9]=x,e[10]=c,e[11]=D):D=e[11];let T;e[12]!==B||e[13]!==D?(T=t.jsxs("div",{className:"flex w-full items-baseline gap-2 px-0 pt-2 pb-1",children:[B,D]}),e[12]=B,e[13]=D,e[14]=T):T=e[14];let A;e[15]!==h||e[16]!==m?(A=t.jsx(hs,{highlights:h,onInsert:m}),e[15]=h,e[16]=m,e[17]=A):A=e[17];let b;e[18]!==E||e[19]!==l||e[20]!==g?(b=()=>{E&&!l&&g()},e[18]=E,e[19]=l,e[20]=g,e[21]=b):b=e[21];let $;e[22]!==c?($=c("gitView.commit.messagePlaceholder"),e[22]=c,e[23]=$):$=e[23];const C=y!==null;let z;e[24]!==i||e[25]!==J||e[26]!==M||e[27]!==f||e[28]!==$||e[29]!==C||e[30]!==b?(z=t.jsx(ms,{value:i,onChange:f,onSubmit:b,placeholder:$,disabled:C,hasTouchInput:J,isMobile:M}),e[24]=i,e[25]=J,e[26]=M,e[27]=f,e[28]=$,e[29]=C,e[30]=b,e[31]=z):z=e[31];let P;e[32]!==S||e[33]!==O||e[34]!==c?(P=S&&t.jsxs(ee,{variant:"outline",size:"sm",onClick:O,className:"w-fit",type:"button",children:[t.jsx(_,{name:"emotion-happy",className:"size-4"}),c("gitView.commit.addGitmoji")]}),e[32]=S,e[33]=O,e[34]=c,e[35]=P):P=e[35];const X=l||y!==null||j||s===0;let K;e[36]!==c?(K=c("gitView.commit.generateAria"),e[36]=c,e[37]=K):K=e[37];let U;e[38]!==l?(U=l?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"ai-generate-2",className:"size-4 text-primary"}),e[38]=l,e[39]=U):U=e[39];let q;e[40]!==c?(q=c("gitView.commit.generate"),e[40]=c,e[41]=q):q=e[41];let Q;e[42]!==q?(Q=t.jsx("span",{className:"commit-actions__label",children:q}),e[42]=q,e[43]=Q):Q=e[43];let R;e[44]!==u||e[45]!==X||e[46]!==K||e[47]!==U||e[48]!==Q?(R=t.jsxs(ee,{variant:"outline",size:"sm",onClick:u,disabled:X,type:"button","aria-label":K,className:"commit-actions__btn",children:[U,Q]}),e[44]=u,e[45]=X,e[46]=K,e[47]=U,e[48]=Q,e[49]=R):R=e[49];let L;e[50]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx("div",{className:"flex-1"}),e[50]=L):L=e[50];let W;e[51]!==g?(W=G=>g(G.currentTarget),e[51]=g,e[52]=W):W=e[52];const se=!E||l;let Y;e[53]!==c?(Y=c("gitView.commit.commitAria"),e[53]=c,e[54]=Y):Y=e[54];let n;e[55]!==y||e[56]!==c?(n=y==="commit"?t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label",children:c("gitView.commit.committing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"git-commit",className:"size-4"}),t.jsx("span",{className:"commit-actions__label",children:c("gitView.commit.commit")})]}),e[55]=y,e[56]=c,e[57]=n):n=e[57];let d;e[58]!==W||e[59]!==se||e[60]!==Y||e[61]!==n?(d=t.jsx(ee,{size:"sm",variant:"outline",onClick:W,disabled:se,className:"commit-actions__btn whitespace-nowrap","aria-label":Y,children:n}),e[58]=W,e[59]=se,e[60]=Y,e[61]=n,e[62]=d):d=e[62];let p;e[63]!==E||e[64]!==y||e[65]!==l||e[66]!==M||e[67]!==k||e[68]!==I||e[69]!==c?(p=M?t.jsxs(tt,{children:[t.jsx(st,{asChild:!0,children:t.jsx(ee,{variant:"default",size:"sm",onClick:G=>I(G.currentTarget),disabled:!E||l||k,className:"h-7 w-7 p-0","aria-label":c("gitView.commit.pushAria"),children:y==="commitAndPush"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"arrow-up",className:"size-3.5"})})}),t.jsx(it,{side:"top",children:t.jsx("p",{children:c("gitView.commit.push")})})]}):t.jsx(ee,{size:"sm",variant:"default",onClick:G=>I(G.currentTarget),disabled:!E||l||k,className:"commit-actions__btn","aria-label":c("gitView.commit.pushAria"),children:y==="commitAndPush"?t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:c("gitView.commit.pushing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"arrow-up",className:"size-3.5"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:c("gitView.commit.push")})]})}),e[63]=E,e[64]=y,e[65]=l,e[66]=M,e[67]=k,e[68]=I,e[69]=c,e[70]=p):p=e[70];let v;e[71]!==R||e[72]!==d||e[73]!==p?(v=t.jsxs("div",{className:"@container/commit-actions flex items-center gap-2 min-w-0",children:[R,L,d,p]}),e[71]=R,e[72]=d,e[73]=p,e[74]=v):v=e[74];let o;e[75]!==z||e[76]!==P||e[77]!==v||e[78]!==A?(o=t.jsxs("div",{className:"flex flex-col gap-3 px-0 pt-1 pb-3",children:[A,z,P,v]}),e[75]=z,e[76]=P,e[77]=v,e[78]=A,e[79]=o):o=e[79];let V;return e[80]!==o||e[81]!==T?(V=t.jsxs("section",{className:"border-0 bg-transparent rounded-none",children:[T,o]}),e[80]=o,e[81]=T,e[82]=V):V=e[82],V},Gs=a=>{const e=fe.c(153),{open:s,onOpenChange:i,conflictFiles:f,directory:h,operation:m,onAbort:u,onClearState:l,onNavigatedToChat:g}=a;let I;e[0]!==f?(I=f===void 0?[]:f,e[0]=f,e[1]=I):I=e[1];const y=I,{t:r}=ue(),N=nt(gs),S=nt(xs),O=at(ys),k=at(bs),[j,c]=w.useState(!1),[x,F]=w.useState(null),[E,M]=w.useState(null);let J,H;e[2]!==h||e[3]!==s||e[4]!==r?(J=()=>{!s||!h||(c(!0),M(null),F(null),Pt(h).then(Z=>{F(Z)}).catch(Z=>{const ce=Z instanceof Error?Z.message:r("gitView.conflict.loadFailed");M(ce)}).finally(()=>{c(!1)}))},H=[s,h,r],e[2]=h,e[3]=s,e[4]=r,e[5]=J,e[6]=H):(J=e[5],H=e[6]),w.useEffect(J,H);let B;e[7]!==x||e[8]!==h||e[9]!==m?(B=async()=>{if(!x)return null;const Z=m==="merge"?"merge":"rebase",ce=x.headInfo||(m==="merge"?"MERGE_HEAD":"REBASE_HEAD"),Ne=m==="merge"?"git commit --no-edit":"git rebase --continue",Ce=await Lt(h),pe=Ce.render("git.conflict.resolve.visible",{operation_label:Z,head_ref:ce}),ge=Ce.render("git.conflict.resolve.instructions",{operation_label:Z,directory:h,operation:m,head_info:x.headInfo||"N/A",continue_cmd:Ne}),xe=`${Z} conflict context (JSON)
2
2
  ${JSON.stringify({directory:h,operation:x.operation,headInfo:x.headInfo,statusPorcelain:x.statusPorcelain,unmergedFiles:x.unmergedFiles,diff:x.diff},null,2)}`;return{visibleText:pe,instructionsText:ge,payloadText:xe}},e[7]=x,e[8]=h,e[9]=m,e[10]=B):B=e[10];const D=B;let T;e[11]!==D||e[12]!==r?(T=async()=>{try{return await D()}catch(Z){const ce=Z;de.error(r("magicPrompts.toast.loadFailed"),{description:ce instanceof Error?ce.message:void 0});return}},e[11]=D,e[12]=r,e[13]=T):T=e[13];const A=T;let b;e[14]!==u||e[15]!==i?(b=()=>{u(),i(!1)},e[14]=u,e[15]=i,e[16]=b):b=e[16];const $=b;let C;e[17]!==l||e[18]!==i?(C=()=>{l?.(),i(!1)},e[17]=l,e[18]=i,e[19]=C):C=e[19];const z=C;let P;e[20]!==S||e[21]!==l||e[22]!==g||e[23]!==i||e[24]!==A||e[25]!==O||e[26]!==k||e[27]!==r?(P=async()=>{const Z=await A();if(Z!==void 0){if(!Z){de.error(r("gitView.conflict.noDetailsAvailable"));return}if(!S){de.error(r("gitView.conflict.noActiveSession"),{description:r("gitView.conflict.noActiveSessionDescription")});return}O(Z.visibleText,"replace"),k([{text:Z.instructionsText,synthetic:!0},{text:Z.payloadText,synthetic:!0}]),l?.(),i(!1),g?.()}},e[20]=S,e[21]=l,e[22]=g,e[23]=i,e[24]=A,e[25]=O,e[26]=k,e[27]=r,e[28]=P):P=e[28];const X=P;let K;e[29]!==h||e[30]!==l||e[31]!==g||e[32]!==i||e[33]!==N||e[34]!==A||e[35]!==r?(K=async()=>{const Z=await A();if(Z!==void 0){if(!Z){de.error(r("gitView.conflict.noDetailsAvailable"));return}N({directoryOverride:h,initialPrompt:Z.visibleText,syntheticParts:[{text:Z.instructionsText,synthetic:!0},{text:Z.payloadText,synthetic:!0}]}),l?.(),i(!1),g?.()}},e[29]=h,e[30]=l,e[31]=g,e[32]=i,e[33]=N,e[34]=A,e[35]=r,e[36]=K):K=e[36];const U=K;let q,Q,R,L,W,se,Y,n,d,p,v,o,V,G,te,ae,ie,ne,re,he,le,me;if(e[37]!==x||e[38]!==y||e[39]!==S||e[40]!==$||e[41]!==z||e[42]!==X||e[43]!==U||e[44]!==j||e[45]!==E||e[46]!==i||e[47]!==s||e[48]!==m||e[49]!==r){const Z=r(m==="merge"?"gitView.operation.merge":"gitView.operation.rebase"),ce=x?.unmergedFiles||y;R=Te,le=s,me=i,Q=ze,he="max-w-md w-[calc(100vw-2rem)]",G="flex flex-col gap-4 overflow-hidden";let Ne;e[72]===Symbol.for("react.memo_cache_sentinel")?(Ne=t.jsx(_,{name:"alert",className:"size-5 shrink-0 text-[var(--status-warning)]"}),e[72]=Ne):Ne=e[72];const Ce=t.jsxs("div",{className:"flex items-center gap-2",children:[Ne,t.jsx(Oe,{children:r("gitView.conflict.detectedTitle",{operation:Z})})]});let pe;e[73]!==m||e[74]!==r?(pe=r("gitView.conflict.detectedDescription",{operation:m}),e[73]=m,e[74]=r,e[75]=pe):pe=e[75];let ge;e[76]!==pe?(ge=t.jsx(Fe,{children:pe}),e[76]=pe,e[77]=ge):ge=e[77],e[78]!==Ce||e[79]!==ge?(te=t.jsxs(Re,{children:[Ce,ge]}),e[78]=Ce,e[79]=ge,e[80]=te):te=e[80],e[81]!==j||e[82]!==r?(ae=j&&t.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-muted-foreground",children:[t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"typography-meta",children:r("gitView.conflict.loading")})]}),e[81]=j,e[82]=r,e[83]=ae):ae=e[83],e[84]!==E||e[85]!==r?(ie=E&&t.jsx("div",{className:"rounded-lg bg-[var(--status-error-bg)] p-3 text-[var(--status-error)] typography-meta break-words",children:r("gitView.conflict.errorLoadingDetails",{message:E})}),e[84]=E,e[85]=r,e[86]=ie):ie=e[86],e[87]!==ce||e[88]!==r?(ne=ce.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:r("gitView.conflict.conflictedFiles")}),t.jsx("span",{className:"typography-micro px-1.5 py-0.5 rounded bg-[var(--surface-elevated)] text-muted-foreground",children:ce.length})]}),t.jsx(ot,{outerClassName:"max-h-40 rounded-lg bg-[var(--surface-elevated)]",className:"p-3",disableHorizontal:!0,children:t.jsx("ul",{className:"space-y-1",children:ce.map(vs)})})]}),e[87]=ce,e[88]=r,e[89]=ne):ne=e[89],e[90]!==x||e[91]!==r?(re=x?.headInfo&&t.jsxs("div",{className:"space-y-1 overflow-hidden",children:[t.jsx("p",{className:"typography-meta text-muted-foreground",children:r("gitView.conflict.headInfo")}),t.jsx(ot,{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:!0,children:x.headInfo})]}),e[90]=x,e[91]=r,e[92]=re):re=e[92],v="flex flex-col gap-2 pt-2";let xe;e[93]!==U?(xe=()=>{U()},e[93]=U,e[94]=xe):xe=e[94];const Ke=j||!x;let Se;e[95]!==j?(Se=j?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"add",className:"size-4"}),e[95]=j,e[96]=Se):Se=e[96];let ke;e[97]!==r?(ke=r("gitView.conflict.resolveNewSession"),e[97]=r,e[98]=ke):ke=e[98],e[99]!==xe||e[100]!==Ke||e[101]!==Se||e[102]!==ke?(o=t.jsxs(ee,{variant:"default",onClick:xe,disabled:Ke,className:"w-full gap-2",children:[Se,ke]}),e[99]=xe,e[100]=Ke,e[101]=Se,e[102]=ke,e[103]=o):o=e[103];let Ve;e[104]!==X?(Ve=()=>{X()},e[104]=X,e[105]=Ve):Ve=e[105];const Ue=j||!x||!S;let Ae;e[106]!==j?(Ae=j?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"chat-1",className:"size-4"}),e[106]=j,e[107]=Ae):Ae=e[107];let Ie;e[108]!==r?(Ie=r("gitView.conflict.resolveCurrentSession"),e[108]=r,e[109]=Ie):Ie=e[109],e[110]!==Ve||e[111]!==Ue||e[112]!==Ae||e[113]!==Ie?(V=t.jsxs(ee,{variant:"outline",onClick:Ve,disabled:Ue,className:"w-full gap-2",children:[Ae,Ie]}),e[110]=Ve,e[111]=Ue,e[112]=Ae,e[113]=Ie,e[114]=V):V=e[114],d="flex gap-2 pt-1";let Ee;e[115]!==r?(Ee=r("gitView.conflict.continueLater"),e[115]=r,e[116]=Ee):Ee=e[116],e[117]!==z||e[118]!==Ee?(p=t.jsx(ee,{variant:"ghost",size:"sm",onClick:z,className:"flex-1",children:Ee}),e[117]=z,e[118]=Ee,e[119]=p):p=e[119],q=ee,L="destructive",W="sm",se=$,Y="flex-1",n=r("gitView.conflict.abortOperation",{operation:Z}),e[37]=x,e[38]=y,e[39]=S,e[40]=$,e[41]=z,e[42]=X,e[43]=U,e[44]=j,e[45]=E,e[46]=i,e[47]=s,e[48]=m,e[49]=r,e[50]=q,e[51]=Q,e[52]=R,e[53]=L,e[54]=W,e[55]=se,e[56]=Y,e[57]=n,e[58]=d,e[59]=p,e[60]=v,e[61]=o,e[62]=V,e[63]=G,e[64]=te,e[65]=ae,e[66]=ie,e[67]=ne,e[68]=re,e[69]=he,e[70]=le,e[71]=me}else q=e[50],Q=e[51],R=e[52],L=e[53],W=e[54],se=e[55],Y=e[56],n=e[57],d=e[58],p=e[59],v=e[60],o=e[61],V=e[62],G=e[63],te=e[64],ae=e[65],ie=e[66],ne=e[67],re=e[68],he=e[69],le=e[70],me=e[71];let ye;e[120]!==q||e[121]!==L||e[122]!==W||e[123]!==se||e[124]!==Y||e[125]!==n?(ye=t.jsx(q,{variant:L,size:W,onClick:se,className:Y,children:n}),e[120]=q,e[121]=L,e[122]=W,e[123]=se,e[124]=Y,e[125]=n,e[126]=ye):ye=e[126];let be;e[127]!==d||e[128]!==p||e[129]!==ye?(be=t.jsxs("div",{className:d,children:[p,ye]}),e[127]=d,e[128]=p,e[129]=ye,e[130]=be):be=e[130];let ve;e[131]!==v||e[132]!==o||e[133]!==V||e[134]!==be?(ve=t.jsxs("div",{className:v,children:[o,V,be]}),e[131]=v,e[132]=o,e[133]=V,e[134]=be,e[135]=ve):ve=e[135];let we;e[136]!==G||e[137]!==te||e[138]!==ae||e[139]!==ie||e[140]!==ne||e[141]!==re||e[142]!==ve?(we=t.jsxs("div",{className:G,children:[te,ae,ie,ne,re,ve]}),e[136]=G,e[137]=te,e[138]=ae,e[139]=ie,e[140]=ne,e[141]=re,e[142]=ve,e[143]=we):we=e[143];let je;e[144]!==Q||e[145]!==he||e[146]!==we?(je=t.jsx(Q,{className:he,children:we}),e[144]=Q,e[145]=he,e[146]=we,e[147]=je):je=e[147];let Pe;return e[148]!==R||e[149]!==le||e[150]!==me||e[151]!==je?(Pe=t.jsx(R,{open:le,onOpenChange:me,children:je}),e[148]=R,e[149]=le,e[150]=me,e[151]=je,e[152]=Pe):Pe=e[152],Pe};function gs(a){return a.openNewSessionDraft}function xs(a){return a.currentSessionId}function ys(a){return a.setPendingInputText}function bs(a){return a.setPendingSyntheticParts}function vs(a){return t.jsx("li",{className:"typography-micro text-foreground font-mono truncate block",title:a,children:a},a)}const _s=({open:a,onOpenChange:e,targetBranch:s,changedFileCount:i,onCommitAndSwitch:f,onGenerateMessage:h,onRevertAndSwitch:m})=>{const{t:u}=ue(),[l,g]=w.useState(""),[I,y]=w.useState(null),[r,N]=w.useState(!1),S=I!==null;w.useEffect(()=>{a||(g(""),N(!1))},[a]);const O=async()=>{y("generate");try{const c=await h();c&&g(c)}catch(c){de.error(c instanceof Error?c.message:u("gitView.dirtySwitch.actionFailed"))}finally{y(null)}},k=async()=>{y("commit");try{let c=l.trim();if(!c){if(c=(await h()).trim(),!c){de.error(u("gitView.toast.enterCommitMessage"));return}g(c)}await f(c,r)}catch(c){de.error(c instanceof Error?c.message:u("gitView.dirtySwitch.actionFailed"))}finally{y(null)}},j=async()=>{y("revert");try{await m()}catch(c){de.error(c instanceof Error?c.message:u("gitView.dirtySwitch.actionFailed"))}finally{y(null)}};return t.jsx(Te,{open:a,onOpenChange:c=>{S||e(c)},children:t.jsx(ze,{className:"max-w-md w-[calc(100vw-2rem)]",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs(Re,{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(_,{name:"alert",className:"size-5 shrink-0 text-[var(--status-warning)]"}),t.jsx(Oe,{children:u("gitView.dirtySwitch.title")})]}),t.jsx(Fe,{children:i===1?u("gitView.dirtySwitch.descriptionSingle",{branch:s}):u("gitView.dirtySwitch.descriptionPlural",{branch:s,count:i})})]}),t.jsxs("div",{className:"oc-raised oc-field flex items-center gap-2 rounded-lg px-3 py-2",children:[t.jsx("input",{value:l,onChange:c=>g(c.target.value),placeholder:u("gitView.commit.messagePlaceholder"),disabled:S,onKeyDown:c=>{c.key==="Enter"&&!S&&(c.preventDefault(),k())},className:"min-w-0 flex-1 bg-transparent typography-meta text-foreground outline-none placeholder:text-muted-foreground"}),t.jsx("button",{type:"button",onClick:()=>{O()},disabled:S,"aria-label":u("gitView.commit.generate"),title:u("gitView.commit.generate"),className:"shrink-0 text-muted-foreground hover:text-foreground disabled:opacity-50",children:I==="generate"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"ai-generate-2",className:"size-4 text-primary"})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx($t,{checked:r,onChange:N,disabled:S,ariaLabel:u("gitView.dirtySwitch.pushAfterCommit")}),t.jsx("span",{className:"typography-ui-label text-foreground cursor-pointer select-none",onClick:()=>!S&&N(!r),children:u("gitView.dirtySwitch.pushAfterCommit")})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[t.jsxs(ee,{variant:"destructive",size:"sm",onClick:()=>{j()},disabled:S,className:"gap-2",children:[I==="revert"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):null,u("gitView.dirtySwitch.revertAndSwitch")]}),t.jsxs(ee,{variant:"default",size:"sm",onClick:()=>{k()},disabled:S,className:"gap-2",children:[I==="commit"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):null,u("gitView.dirtySwitch.commitAndSwitch")]})]})]})})})},Ye="max-w-none",ws="flex flex-wrap items-center gap-2",At=a=>{const e=fe.c(6),{error:s,children:i}=a,f=s?"alert":void 0,h=s&&"text-[var(--status-error)]";let m;e[0]!==h?(m=oe(Ge,h),e[0]=h,e[1]=m):m=e[1];let u;return e[2]!==i||e[3]!==f||e[4]!==m?(u=t.jsx("p",{role:f,className:m,children:i}),e[2]=i,e[3]=f,e[4]=m,e[5]=u):u=e[5],u},js=a=>{if(!a||a.target.operation!=="checkout-hydration")return[];const e=[...a.target.requirements],s=[...(a.hydration?.submodules??[]).map(i=>({kind:"submodule",item:i})),...(a.hydration?.lfs??[]).map(i=>({kind:"lfs",item:i}))];for(const{kind:i,item:f}of s){const h=f.endpoint;h&&(e.some(m=>m.kind===i&&m.path===f.path&&m.endpoint.fingerprint===h.fingerprint)||e.push({kind:i,path:f.path,endpoint:h}))}return e},Ns=a=>{const e=fe.c(48),{directory:s,className:i}=a,{t:f}=ue(),{git:h,sourceControl:m}=pt(),u=gt(s,m),l=De(Ss),g=De(ks),I=xt(),y=He(Vs),r=He(As);let N;e[0]!==r?(N=yt(r),e[0]=r,e[1]=N):N=e[1];const S=N,[O,k]=w.useState(""),[j,c]=w.useState(!1),x=w.useRef(0);let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=()=>(x.current=x.current+1,k(""),c(!1),()=>{x.current=x.current+1}),e[2]=F):F=e[2];let E;e[3]!==u.scope||e[4]!==h||e[5]!==m?(E=[u.scope,h,m],e[3]=u.scope,e[4]=h,e[5]=m,e[6]=E):E=e[6],w.useLayoutEffect(F,E);const M=u.read;let J;e[7]!==I?(J=K=>Vt(K)&&Nt(K,I),e[7]=I,e[8]=J):J=e[8];let H;e[9]!==l||e[10]!==g||e[11]!==J?(H=bt(l,g,J),e[9]=l,e[10]=g,e[11]=J,e[12]=H):H=e[12];const B=H;let D,T,A,b,$,C,z;if(e[13]!==i||e[14]!==s||e[15]!==h||e[16]!==l||e[17]!==B||e[18]!==S||e[19]!==O||e[20]!==M||e[21]!==y||e[22]!==m||e[23]!==f){A=Symbol.for("react.early_return_sentinel");e:{const K=M?Mt(M):null,U=K?.providers[0]?.primaryRemote??K?.remotes[0]?.name??"origin",q=(M?.repository.remotes??[]).filter(R=>R.name!==U&&K?.remotes.find(L=>L.name===R.name)?.readiness!=="ready"),Q=async(R,L)=>{if(O)return;const W=x.current,se=Be(),Y=()=>x.current===W&&se===Be();k(R),c(!1);const n=await qt({directory:s,identity:L,remoteName:R},{git:h,sourceControl:m});Y()&&(n.status!=="applied"&&c(!0),k(""))};if(!q.length||!h.configureTransportBinding){A=null;break e}D=Ct,e[31]!==f?(b=f("gitView.remotes.title"),e[31]=f,e[32]=b):b=e[32],e[33]!==f?($=f("gitView.remotes.description"),e[33]=f,e[34]=$):$=e[34],e[35]!==i?(C=oe("min-w-0",i),e[35]=i,e[36]=C):C=e[36],z=St,T=q.map(R=>{const L=vt(R.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:R.name}),t.jsx("p",{className:oe(Ge,"truncate"),title:R.fetch.displayUrl,children:R.fetch.displayUrl})]}),t.jsx(wt,{activeProfile:null,identities:B,onSelect:W=>{Q(R.name,W)},isApplying:O===R.name,applicability:W=>jt(W,L,S),triggerClassName:"shrink-0 border border-border",onOpen:()=>{y(m,l.map(Is))}})]},R.name)})}e[13]=i,e[14]=s,e[15]=h,e[16]=l,e[17]=B,e[18]=S,e[19]=O,e[20]=M,e[21]=y,e[22]=m,e[23]=f,e[24]=D,e[25]=T,e[26]=A,e[27]=b,e[28]=$,e[29]=C,e[30]=z}else D=e[24],T=e[25],A=e[26],b=e[27],$=e[28],C=e[29],z=e[30];if(A!==Symbol.for("react.early_return_sentinel"))return A;let P;e[37]!==j||e[38]!==f?(P=j?t.jsx(At,{error:!0,children:f("settings.sourceControl.instance.status.operationFailed")}):null,e[37]=j,e[38]=f,e[39]=P):P=e[39];let X;return e[40]!==D||e[41]!==T||e[42]!==P||e[43]!==b||e[44]!==$||e[45]!==C||e[46]!==z?(X=t.jsxs(D,{title:b,description:$,className:C,contentClassName:z,children:[T,P]}),e[40]=D,e[41]=T,e[42]=P,e[43]=b,e[44]=$,e[45]=C,e[46]=z,e[47]=X):X=e[47],X},Cs=({directory:a,className:e})=>{const{t:s}=ue(),{git:i,sourceControl:f}=pt(),h=gt(a,f),m=Ht(a,i,f),[u,l]=w.useState(""),[g,I]=w.useState(""),[y,r]=w.useState(null),[N,S]=w.useState(!1),[O,k]=w.useState(!1),[j,c]=w.useState(!1),x=w.useRef(0),F=De(o=>o.profiles),E=De(o=>o.globalIdentity),M=De(o=>o.loadProfiles),J=De(o=>o.loadGlobalIdentity),H=xt(),B=He(o=>o.refreshIdentityAccounts),D=He(o=>o.identities),T=w.useMemo(()=>yt(D),[D]),A=Gt(a),b=m.entry?.reads.at(-1)?.operation,$=b?.target.operation==="checkout-hydration"&&b.target.remote.name===u?js(b):[],C=$.find(o=>JSON.stringify([o.kind,o.path,o.endpoint.fingerprint])===g),z=h.read,P=z?.repository.remotes.find(o=>o.name===u),X=C&&z?.binding?.auxiliary.find(o=>o.kind===C.kind&&o.endpoint.fingerprint===C.endpoint.fingerprint);w.useLayoutEffect(()=>(x.current+=1,l(""),I(""),r(null),S(!1),k(!1),c(!1),()=>{x.current+=1}),[h.scope,i,f]),w.useLayoutEffect(()=>{},[C?.endpoint.fingerprint]),w.useEffect(()=>{j&&(M(),J())},[M,J,j]);const K=w.useMemo(()=>bt(F,E,o=>Vt(o)&&Nt(o,H)),[H,F,E]),U=C?.endpoint.displayUrl??"",q=w.useMemo(()=>U?vt(U):null,[U]),Q=w.useCallback(o=>q?jt(o,q,T):{applicable:!0},[q,T]),R=w.useMemo(()=>{const o=K.filter(G=>Q(G).applicable);return(A?.userName&&A.userEmail?o.find(G=>G.userName===A.userName&&G.userEmail===A.userEmail):void 0)??o.find(G=>G.account&&q?.host&&(_t(G.account.instance)===q.host||Bt(T[G.account.instance]??"")===q.host))??null},[Q,K,q,T,A]),L=(y?.endpoint===C?.endpoint.fingerprint?K.find(o=>o.id===y?.id):null)??R,W=L?es(L):null,se=!!(h.status==="ready"&&z?.binding&&P&&C&&i.configureAuxiliaryBinding&&!N&&L&&Q(L).applicable&&(W!=="account"||L?.account)&&(W!=="ssh"||L?.sshCredentialId)),Y=!!(h.status==="ready"&&X&&P&&i.configureAuxiliaryBinding&&!N),n=async()=>{if(!u||m.blocked)return;const o=m.start();if(o){k(!1);try{await Jt({directory:a,git:i,sourceControl:f,parentRemoteName:u,onOperation:o.onOperation})}catch(V){V instanceof Wt||k(!0)}finally{o.finish()}}},d=async o=>{if(o==="configure"&&!se||o==="remove"&&!Y||!h.isCurrent()||!z?.binding||!P||!C||!i.configureAuxiliaryBinding)return;const V=x.current,G=Be(),te=()=>x.current===V&&G===Be(),ae={directory:a,expectedRepositoryId:z.repository.repositoryId,expectedRevision:z.revision,expectedConfigRevision:z.repository.configRevision,parentRemote:u,expectedParentFingerprint:P.fetch.fingerprint,kind:C.kind,path:C.path,expectedEndpointFingerprint:C.endpoint.fingerprint},ie=o==="remove"?{...ae,operation:o}:L&&Xt(L,ae);if(!ie)return;const ne=Le.captureMutation(h.scope,z);S(!0),k(!1);try{const re=await i.configureAuxiliaryBinding(ie);Le.setMutationResult(ne,re.binding)||await Le.reconcile(ne,f)}catch{te()&&k(!0),await Le.reconcile(ne,f)}finally{ne.release(),te()&&S(!1)}},p=!!($.length&&b&&"error"in b&&b.error.code==="AUTHENTICATION_REQUIRED"),v=o=>s(o==="submodule"?"gitView.hydration.kind.submodule":"gitView.hydration.kind.lfs");return t.jsxs(os,{open:j,onOpenChange:c,className:oe("min-w-0",e),children:[t.jsxs(rs,{className:"w-auto justify-start gap-1.5",children:[t.jsx(Kt,{children:s("gitView.hydration.title")}),t.jsx(_,{name:j?"arrow-up-s":"arrow-down-s",className:"h-4 w-4 text-muted-foreground"})]}),t.jsx(ls,{children:t.jsxs(Ct,{description:s("gitView.hydration.description"),className:"min-w-0 pt-2",contentClassName:St,children:[t.jsx(qe,{label:s("gitView.hydration.parentRemote"),controlClassName:Ye,children:t.jsxs(rt,{value:u,onValueChange:o=>{l(o),I(""),r(null)},disabled:!z?.binding||N||m.blocked,children:[t.jsx(lt,{className:"w-fit max-w-[28ch]","aria-label":s("gitView.hydration.parentRemote"),children:t.jsx(ct,{placeholder:s("settings.sourceControl.transport.remoteLabel")})}),t.jsx(dt,{children:z?.binding?.remotes.filter(o=>o.readiness==="ready").map(o=>t.jsx(ut,{value:o.name,children:o.name},o.name))})]})}),t.jsx(Ut,{entry:m.entry,onRefresh:()=>{m.refresh()},onCancel:()=>{m.cancel()}}),p?t.jsx("p",{className:Ge,children:s("gitView.hydration.authorizationNeeded")}):null,$.length?t.jsx(qe,{label:s("gitView.hydration.endpoint"),controlClassName:Ye,children:t.jsxs(rt,{value:g,onValueChange:I,disabled:N,children:[t.jsx(lt,{className:"w-fit max-w-[28ch]","aria-label":s("gitView.hydration.endpoint"),children:t.jsx(ct,{placeholder:s("gitView.hydration.chooseEndpoint"),children:C?`${C.path} · ${v(C.kind)} · ${C.endpoint.displayUrl}`:void 0})}),t.jsx(dt,{children:$.map(o=>{const V=JSON.stringify([o.kind,o.path,o.endpoint.fingerprint]);return t.jsxs(ut,{value:V,children:[o.path," · ",v(o.kind)," · ",o.endpoint.displayUrl]},V)})})]})}):null,C?t.jsx(t.Fragment,{children:t.jsx(qe,{label:s("gitView.hydration.identity"),controlClassName:Ye,children:t.jsx(wt,{activeProfile:L,identities:K,onSelect:o=>r({endpoint:C.endpoint.fingerprint,id:o.id}),isApplying:N,applicability:Q,triggerClassName:"w-full max-w-none border border-border",menuAlign:"start",onOpen:()=>{B(f,F.map(o=>o.account))}})})}):null,b?.hydration?.status==="client-missing"?t.jsx("p",{role:"alert",className:oe(Ge,"text-[var(--status-warning)]"),children:s("gitView.hydration.lfsMissing")}):null,O?t.jsx(At,{error:!0,children:s("settings.sourceControl.instance.status.operationFailed")}):null,t.jsxs("div",{className:ws,children:[t.jsx(ee,{size:"sm",variant:"outline",disabled:!u||m.blocked||N,onClick:()=>{n()},children:s("gitView.hydration.retry")}),C?t.jsxs(t.Fragment,{children:[t.jsx(ee,{size:"sm",disabled:!se,onClick:()=>{d("configure")},children:s("settings.common.actions.saveChanges")}),X?t.jsx(ee,{size:"sm",variant:"ghost",disabled:!Y,onClick:()=>{d("remove")},children:s("settings.common.actions.delete")}):null]}):null]})]})})]})};function Ss(a){return a.profiles}function ks(a){return a.globalIdentity}function Vs(a){return a.refreshIdentityAccounts}function As(a){return a.identities}function Is(a){return a.account}const Ze="border-t border-edge pt-4",Bs=a=>{const e=fe.c(11),{open:s,onOpenChange:i,directory:f}=a,{t:h}=ue(),m=_e(Es),u=_e(Ds);let l;e[0]!==f||e[1]!==i||e[2]!==s||e[3]!==u||e[4]!==m||e[5]!==h?(l=s?t.jsxs(ze,{className:"@container min-w-0 max-h-[85dvh] overflow-y-auto",children:[t.jsxs(Re,{children:[t.jsx(Oe,{children:h("gitView.context.configure")}),t.jsx(Fe,{children:h("gitView.context.description")})]}),t.jsx(Ns,{directory:f,className:Ze}),t.jsx(Cs,{directory:f,className:Ze}),t.jsxs(et,{className:Ze,children:[t.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{i(!1),m("git"),u(!0)},children:h("gitView.context.settings")}),t.jsx(ee,{size:"sm",variant:"outline",onClick:()=>i(!1),children:h("dialog.common.actions.close")})]})]}):null,e[0]=f,e[1]=i,e[2]=s,e[3]=u,e[4]=m,e[5]=h,e[6]=l):l=e[6];let g;return e[7]!==i||e[8]!==s||e[9]!==l?(g=t.jsx(Te,{open:s,onOpenChange:i,children:l}),e[7]=i,e[8]=s,e[9]=l,e[10]=g):g=e[10],g};function Es(a){return a.setSettingsPage}function Ds(a){return a.setSettingsDialogOpen}const Ks=({mergeInProgress:a,rebaseInProgress:e,onContinue:s,onAbort:i,onResolveWithAI:f,conflictCount:h=0,isLoading:m=!1})=>{const{t:u}=ue(),[l,g]=w.useState(null),I=a&&a.head,y=e&&(e.headName||e.onto),r=I?"merge":y?"rebase":null;if(!r)return null;const N=async()=>{g("continue");try{await s()}finally{g(null)}},S=async()=>{g("abort");try{await i()}finally{g(null)}},O=l!==null,k=h>0,j=u(r==="merge"?"gitView.operation.merge":"gitView.operation.rebase");let c="";a?c=a.message?u("gitView.operation.mergingMessage",{message:a.message}):u("gitView.operation.mergeInProgressWithHead",{head:a.head}):e&&(c=e.headName?u("gitView.operation.rebasingOnto",{headName:e.headName,onto:e.onto||""}):u("gitView.operation.rebaseInProgress"));const x=k?h===1?u("gitView.operation.inProgressTitleOneConflict",{operation:j,count:h}):u("gitView.operation.inProgressTitleManyConflicts",{operation:j,count:h}):u("gitView.operation.inProgressTitle",{operation:j}),F=u(k?"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:x}),c&&t.jsx("p",{className:"typography-micro break-words text-muted-foreground",children:c})]}),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:F}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsxs(ee,{variant:"ghost",size:"sm",onClick:S,disabled:O||m,className:"gap-1.5",children:[l==="abort"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"close",className:"size-4"}),u("gitView.operation.abort")]}),k?f&&t.jsx(ee,{variant:"default",size:"sm",onClick:f,disabled:O||m,children:u("gitView.operation.resolveWithAi")}):t.jsxs(ee,{variant:"default",size:"sm",onClick:N,disabled:O||m,className:"gap-1.5",children:[l==="continue"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"check",className:"size-4"}),u("gitView.operation.continue")]})]})]})]})})},ht=()=>Math.floor(Math.random()*1e3);function Us(){const a=fe.c(11),{t:e}=ue(),{triggerFireworks:s}=cs(),i=kt();let f;a[0]!==i||a[1]!==e||a[2]!==s?(f=(g,I)=>{const{pushAfter:y,origin:r}=I,N=i?Qt(i,g,mt(),ht()):null;return N?de.success(N.title,{description:N.description}):de.success(e("gitView.toast.commitCreated")),N&&!y&&s({kind:"deletion",origin:r}),N!==null},a[0]=i,a[1]=e,a[2]=s,a[3]=f):f=a[3];const h=f;let m;a[4]!==i||a[5]!==e||a[6]!==s?(m=g=>{const{deletion:I,origin:y}=g,r=i?Yt(i,new Date,mt(),ht()):null;r?de.success(r.title,{description:r.description}):de.success(e("gitView.publish.succeeded")),s({kind:I?"deletion":"push",origin:y})},a[4]=i,a[5]=e,a[6]=s,a[7]=m):m=a[7];const u=m;let l;return a[8]!==h||a[9]!==u?(l={committed:h,pushed:u},a[8]=h,a[9]=u,a[10]=l):l=a[10],l}function qs(a){const e=fe.c(4),s=kt(),[i]=w.useState(Ts);let f;return e[0]!==s||e[1]!==a||e[2]!==i?(f=(s?Zt(s,i.at,i.seed):null)??a,e[0]=s,e[1]=a,e[2]=i,e[3]=f):f=e[3],f}function Ts(){return{at:new Date,seed:Math.floor(Math.random()*1e3)}}export{Ms as C,_s as D,Ks as I,Bs as R,Us as a,Hs as b,Gs as c,qs as u};
@@ -1,4 +1,4 @@
1
- import{f as de,r as Z,j as n,R as Q}from"./vendor-react--VO_rL_p.js";import{u as ne,Q as J,T as oe,B as te,I as V,aL as fe,av as he,cp as xe,cq as pe,cr as ge,cs as Ce,ct as be,z as ae,cu as ye,$ as ie,aK as ve,cv as ee,cw as we,cx as Se,cy as re,A as je,cz as Ne}from"./useAppFontEffects-UKWR--vP.js";import{K as De,L as Le,O as ke}from"./runtimeEndpointReset-IJE1o-nk.js";import{b2 as le,aI as Ie}from"./katex.min-BM3LOlr3.js";const ce="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 He(o){const e=de.c(71),{draft:a,onEdit:j,onDelete:h,className:N,maxWidth:Y,forAgent:U}=o,C=U===void 0?!1:U,{t:s}=ne(),[p,W]=Z.useState(!1),D=a.text;let G;e[0]!==D?(G=D.length>150||D.split(`
1
+ import{f as de,r as Z,j as n,R as Q}from"./vendor-react--VO_rL_p.js";import{u as ne,Q as J,T as oe,B as te,I as V,aL as fe,av as he,cp as xe,cq as pe,cr as ge,cs as Ce,ct as be,z as ae,cu as ye,$ as ie,aK as ve,cv as ee,cw as we,cx as Se,cy as re,A as je,cz as Ne}from"./useAppFontEffects-6HvTeJY2.js";import{K as De,L as Le,O as ke}from"./runtimeEndpointReset-DUwSilpj.js";import{b2 as le,aI as Ie}from"./katex.min-B7gF3rmE.js";const ce="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 He(o){const e=de.c(71),{draft:a,onEdit:j,onDelete:h,className:N,maxWidth:Y,forAgent:U}=o,C=U===void 0?!1:U,{t:s}=ne(),[p,W]=Z.useState(!1),D=a.text;let G;e[0]!==D?(G=D.length>150||D.split(`
2
2
  `).length>3,e[0]=D,e[1]=G):G=e[1];const L=G;let R;e[2]!==N?(R=J("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",N),e[2]=N,e[3]=R):R=e[3];const c=Y?`${Math.max(200,Math.floor(Y))}px`:void 0;let g;e[4]!==c?(g={maxWidth:c},e[4]=c,e[5]=g):g=e[5];let i;e[6]!==C?(i=C?n.jsx(V,{name:"attachment-2",className:"size-3.5 shrink-0 text-muted-foreground"}):null,e[6]=C,e[7]=i):i=e[7];let y;e[8]!==a.fileLabel||e[9]!==C||e[10]!==s?(y=C?s("review.card.forAgent"):a.fileLabel,e[8]=a.fileLabel,e[9]=C,e[10]=s,e[11]=y):y=e[11];let k;e[12]!==a.fileLabel||e[13]!==y?(k=n.jsx("span",{className:"min-w-0 max-w-[200px] truncate text-xs font-medium text-foreground",title:a.fileLabel,children:y}),e[12]=a.fileLabel,e[13]=y,e[14]=k):k=e[14];let F;e[15]===Symbol.for("react.memo_cache_sentinel")?(F=n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"•"}),e[15]=F):F=e[15];let m;e[16]!==a?(m=oe(a)?"shrink-0":"min-w-0 truncate",e[16]=a,e[17]=m):m=e[17];let d;e[18]!==m?(d=J("me-auto text-xs text-muted-foreground",m),e[18]=m,e[19]=d):d=e[19];let P;e[20]!==a||e[21]!==s?(P=oe(a)?s("inlineComment.range.wholeFile"):n.jsxs(n.Fragment,{children:[s("inlineComment.range.lines",{start:a.startLine,end:a.endLine}),a.side?` (${a.side})`:""]}),e[20]=a,e[21]=s,e[22]=P):P=e[22];let l;e[23]!==d||e[24]!==P?(l=n.jsx("span",{className:d,children:P}),e[23]=d,e[24]=P,e[25]=l):l=e[25];let E;e[26]===Symbol.for("react.memo_cache_sentinel")?(E={minHeight:0,minWidth:0},e[26]=E):E=e[26];let v;e[27]!==s?(v=s("inlineComment.actions.editComment"),e[27]=s,e[28]=v):v=e[28];let u;e[29]!==s?(u=s("inlineComment.actions.editComment"),e[29]=s,e[30]=u):u=e[30];let $;e[31]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(V,{name:"pencil",className:"h-3 w-3"}),e[31]=$):$=e[31];let M;e[32]!==j||e[33]!==v||e[34]!==u?(M=n.jsx("button",{type:"button",className:ce,style:E,onClick:j,"aria-label":v,title:u,children:$}),e[32]=j,e[33]=v,e[34]=u,e[35]=M):M=e[35];let A;e[36]===Symbol.for("react.memo_cache_sentinel")?(A={minHeight:0,minWidth:0},e[36]=A):A=e[36];let w;e[37]!==s?(w=s("inlineComment.actions.deleteComment"),e[37]=s,e[38]=w):w=e[38];let S;e[39]!==s?(S=s("inlineComment.actions.deleteComment"),e[39]=s,e[40]=S):S=e[40];let H;e[41]===Symbol.for("react.memo_cache_sentinel")?(H=n.jsx(V,{name:"close",className:"h-3 w-3"}),e[41]=H):H=e[41];let B;e[42]!==h||e[43]!==w||e[44]!==S?(B=n.jsx("button",{type:"button",className:ce,style:A,onClick:h,"aria-label":w,title:S,children:H}),e[42]=h,e[43]=w,e[44]=S,e[45]=B):B=e[45];let b;e[46]!==l||e[47]!==M||e[48]!==B||e[49]!==i||e[50]!==k?(b=n.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-2",children:[i,k,F,l,M,B]}),e[46]=l,e[47]=M,e[48]=B,e[49]=i,e[50]=k,e[51]=b):b=e[51];const q=p||!L,X=!p&&L&&"line-clamp-3";let T;e[52]!==X?(T=J("whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground",X),e[52]=X,e[53]=T):T=e[53];let z;e[54]!==D||e[55]!==T?(z=n.jsx("div",{className:T,children:D}),e[54]=D,e[55]=T,e[56]=z):z=e[56];let K;e[57]!==L||e[58]!==p||e[59]!==s?(K=L&&n.jsx(De,{asChild:!0,children:n.jsx(te,{variant:"ghost",size:"sm",className:"mt-1 h-6 w-full justify-start px-0 text-xs text-muted-foreground hover:text-foreground",children:p?n.jsxs(n.Fragment,{children:[n.jsx(V,{name:"arrow-up-s",className:"me-1 size-3"}),s("inlineComment.actions.showLess")]}):n.jsxs(n.Fragment,{children:[n.jsx(V,{name:"arrow-down-s",className:"me-1 size-3"}),s("inlineComment.actions.showMore")]})})}),e[57]=L,e[58]=p,e[59]=s,e[60]=K):K=e[60];let _;e[61]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(Le,{}),e[61]=_):_=e[61];let r;e[62]!==q||e[63]!==z||e[64]!==K?(r=n.jsx("div",{className:"px-3 pb-2 pt-1",children:n.jsxs(ke,{open:q,onOpenChange:W,children:[z,K,_]})}),e[62]=q,e[63]=z,e[64]=K,e[65]=r):r=e[65];let f;return e[66]!==b||e[67]!==R||e[68]!==r||e[69]!==g?(f=n.jsxs("div",{className:R,style:g,"data-comment-card":"true",children:[b,r]}),e[66]=b,e[67]=R,e[68]=r,e[69]=g,e[70]=f):f=e[70],f}const Re=120,Ee=o=>o.split("/").pop()||o;function Oe({initialText:o="",onTextChange:e,onSave:a,onCancel:j,fileLabel:h,lineRange:N,isEditing:Y=!1,className:U,maxWidth:C,bandColor:s,floating:p=!1,band:W=!0,wholeFile:D=!1,saveLabel:G,saving:L=!1,review:R}){const{t:c}=ne(),{isMobile:g}=fe(),[i,y]=Q.useState(o),[k,F]=Q.useState(!1),m=Z.useRef(null),d=he("enter"),P=()=>{const t=m.current;t&&(t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,Re)}px`)},l=t=>{y(t),e?.(t)};Q.useLayoutEffect(P,[i]);const E=Z.useRef(N);Z.useEffect(()=>{N&&(E.current=N)},[N]);const v=t=>{if(!t)return;const x=Math.min(t.start,t.end),I=Math.max(t.start,t.end);return{...t,start:x,end:I}},u=v(N),$=D?c("inlineComment.range.wholeFile"):u?u.start===u.end?c("review.range.line",{line:u.start}):c("inlineComment.range.lines",{start:u.start,end:u.end}):null,M=[h,u?c("inlineComment.range.lines",{start:u.start,end:u.end}):null].filter(Boolean).join(" • ")||c("inlineComment.actions.comment");Z.useEffect(()=>{const t=m.current;if(!t)return;t.focus({preventScroll:!0});const x=t.value.length;t.setSelectionRange(x,x),g&&t.scrollIntoView({behavior:"auto",block:"nearest"})},[g]);const A=xe(),w=Z.useRef(null);Q.useLayoutEffect(()=>{const t=w.current;t!==null&&(w.current=null,m.current?.setSelectionRange(t,t))},[i]);const S=(t,x,I)=>{const O=m.current?.value??i;w.current=t+I.length,l(`${O.slice(0,t)}${I}${O.slice(x)}`),m.current?.focus()},H=Q.useCallback(()=>m.current?.selectionStart??0,[]),B=Q.useCallback(t=>m.current?pe(m.current,t):null,[]),b=ge({text:i,getCaret:H,replaceRange:S,caretCoords:B}),q=Ce(),X=t=>{const x=t.currentTarget,I=A.takePastedImages(t.clipboardData,x.value,{start:x.selectionStart,end:x.selectionEnd});I&&(t.preventDefault(),S(I.from,I.to,I.insertion))},T=()=>{i.trim()&&!L&&(a(i,v(E.current)),A.attachCitedImages(i))},z=t=>{ye(t)||b.handleKeyDown(t)||(t.key==="Enter"&&q.shouldSubmit(t)?(t.preventDefault(),T()):t.key==="Escape"&&(t.preventDefault(),j()))},K=async()=>{if(!(!R||!i.trim()||k)){F(!0);try{await R.add(i,v(E.current))}finally{F(!1)}}},_=R?.suggestionCode,r=()=>{if(!_)return;const t=m.current,x=t?.selectionStart??i.length,I=t?.selectionEnd??i.length,O=x>0&&i[x-1]!==`
3
3
  `?`
4
4
  `:"";S(x,I,`${O}\`\`\`suggestion
@@ -1 +1 @@
1
- import{a as k,R as y,f as R}from"./vendor-react--VO_rL_p.js";import{bi as C}from"./useAppFontEffects-UKWR--vP.js";const d="data-oc-block-index",g="data-oc-block-key",A=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},b=(s,e)=>{if(!s)return 0;const t=Number.parseFloat(s.ownerDocument.defaultView?.getComputedStyle(s)[e]??"");return Number.isFinite(t)?t:0},L=s=>Array.from(s.querySelectorAll("video, audio")).some(e=>e instanceof HTMLMediaElement&&!e.paused),O=(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,E=24;class D{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<E}size(e){return this.sizes.get(e)}attach(e){this.detach(),this.container=e,this.scroller=A(e),this.attached=!0,p.set(e,this);const t=this.scroller;if(!t){this.notify();return}const n=e.ownerDocument,o=n.defaultView,r=()=>this.update(),c=()=>{this.frame!==null||!o||(this.frame=o.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,i=!!(h&&(e.contains(h.commonAncestorContainer)||h.intersectsNode(e)));h&&i&&!this.selectionRelease&&this.spansUnmounted(h)?this.selectionRelease=this.hold(void 0):!i&&this.selectionRelease&&(this.selectionRelease(),this.selectionRelease=null),i!==this.selecting&&(this.selecting=i,i||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&&o?.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 o=(this.pins.get(e)??1)-1;o>0?this.pins.set(e,o):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 o=Array.from(n.children).filter(i=>i instanceof HTMLElement&&i.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=o.length;for(;u<f;){const i=u+f>>1;o[i].getBoundingClientRect().bottom<c?u=i+1:f=i}const a=new Set;for(let i=u;i<o.length&&!(o[i].getBoundingClientRect().top>l);i+=1)a.add(Number(o[i].getAttribute(d)));if(this.selecting)for(const i of this.near)a.add(i);if(this.holds===0)for(const i of o){const m=Number(i.getAttribute(d));a.has(m)||this.pins.has(m)||(this.isLive(i)?a.add(m):this.measure(i))}const h=a.size!==this.near.size||[...a].some(i=>!this.near.has(i));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)||L(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),o=t(e.endContainer);if(n===null||o===null)return!!this.container?.querySelector("[data-oc-block-placeholder]");for(let r=n;r<=o;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:b(e.firstElementChild,"marginBlockStart"),end:b(e.lastElementChild,"marginBlockEnd")})}notify(e=!1){const t=()=>{for(const n of this.listeners)n()};e?k.flushSync(t):t()}}const M=(s,e={})=>{const t=s.closest("[data-markdown-content]")??s.querySelector("[data-markdown-content]"),n=t?p.get(t):void 0;if(!n)return()=>{};const o=e.block?.getAttribute(d);return n.hold(o==null?void 0:Number(o),e.sync)},N=y.createContext(null),S=s=>!!s.trim()&&!s.startsWith("#")&&!s.startsWith("//")&&!/^[a-z][a-z\d+.-]*:/i.test(s),w=s=>{try{return decodeURIComponent(s)}catch{return s}},v=(s,e)=>C(s.slice(0,s.lastIndexOf("/")+1)||"/",w(e.split(/[?#]/,1)[0]??"")),x=(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=w(t.slice(1)).toLowerCase(),o=s.currentTarget.closest("[data-markdown-content]"),r=o?M(o,{sync:!0}):null;for(const c of o?.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(v(e.filePath,t)),!0):!1},K=s=>{const e=R.c(6),{filePath:t,workspaceRoot:n,onOpenFile:o,enabled:r,colorScheme:c}=s;let l;return e[0]!==c||e[1]!==r||e[2]!==t||e[3]!==o||e[4]!==n?(l=r&&t?{filePath:t,workspaceRoot:n,onOpenFile:o,colorScheme:c}:void 0,e[0]=c,e[1]=r,e[2]=t,e[3]=o,e[4]=n,e[5]=l):l=e[5],l};export{g as B,N as M,d as a,O as b,D as c,M as h,S as i,x as o,v as r,K as u};
1
+ import{a as k,R as y,f as R}from"./vendor-react--VO_rL_p.js";import{bi as C}from"./useAppFontEffects-6HvTeJY2.js";const d="data-oc-block-index",g="data-oc-block-key",A=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},b=(s,e)=>{if(!s)return 0;const t=Number.parseFloat(s.ownerDocument.defaultView?.getComputedStyle(s)[e]??"");return Number.isFinite(t)?t:0},L=s=>Array.from(s.querySelectorAll("video, audio")).some(e=>e instanceof HTMLMediaElement&&!e.paused),O=(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,E=24;class D{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<E}size(e){return this.sizes.get(e)}attach(e){this.detach(),this.container=e,this.scroller=A(e),this.attached=!0,p.set(e,this);const t=this.scroller;if(!t){this.notify();return}const n=e.ownerDocument,o=n.defaultView,r=()=>this.update(),c=()=>{this.frame!==null||!o||(this.frame=o.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,i=!!(h&&(e.contains(h.commonAncestorContainer)||h.intersectsNode(e)));h&&i&&!this.selectionRelease&&this.spansUnmounted(h)?this.selectionRelease=this.hold(void 0):!i&&this.selectionRelease&&(this.selectionRelease(),this.selectionRelease=null),i!==this.selecting&&(this.selecting=i,i||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&&o?.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 o=(this.pins.get(e)??1)-1;o>0?this.pins.set(e,o):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 o=Array.from(n.children).filter(i=>i instanceof HTMLElement&&i.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=o.length;for(;u<f;){const i=u+f>>1;o[i].getBoundingClientRect().bottom<c?u=i+1:f=i}const a=new Set;for(let i=u;i<o.length&&!(o[i].getBoundingClientRect().top>l);i+=1)a.add(Number(o[i].getAttribute(d)));if(this.selecting)for(const i of this.near)a.add(i);if(this.holds===0)for(const i of o){const m=Number(i.getAttribute(d));a.has(m)||this.pins.has(m)||(this.isLive(i)?a.add(m):this.measure(i))}const h=a.size!==this.near.size||[...a].some(i=>!this.near.has(i));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)||L(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),o=t(e.endContainer);if(n===null||o===null)return!!this.container?.querySelector("[data-oc-block-placeholder]");for(let r=n;r<=o;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:b(e.firstElementChild,"marginBlockStart"),end:b(e.lastElementChild,"marginBlockEnd")})}notify(e=!1){const t=()=>{for(const n of this.listeners)n()};e?k.flushSync(t):t()}}const M=(s,e={})=>{const t=s.closest("[data-markdown-content]")??s.querySelector("[data-markdown-content]"),n=t?p.get(t):void 0;if(!n)return()=>{};const o=e.block?.getAttribute(d);return n.hold(o==null?void 0:Number(o),e.sync)},N=y.createContext(null),S=s=>!!s.trim()&&!s.startsWith("#")&&!s.startsWith("//")&&!/^[a-z][a-z\d+.-]*:/i.test(s),w=s=>{try{return decodeURIComponent(s)}catch{return s}},v=(s,e)=>C(s.slice(0,s.lastIndexOf("/")+1)||"/",w(e.split(/[?#]/,1)[0]??"")),x=(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=w(t.slice(1)).toLowerCase(),o=s.currentTarget.closest("[data-markdown-content]"),r=o?M(o,{sync:!0}):null;for(const c of o?.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(v(e.filePath,t)),!0):!1},K=s=>{const e=R.c(6),{filePath:t,workspaceRoot:n,onOpenFile:o,enabled:r,colorScheme:c}=s;let l;return e[0]!==c||e[1]!==r||e[2]!==t||e[3]!==o||e[4]!==n?(l=r&&t?{filePath:t,workspaceRoot:n,onOpenFile:o,colorScheme:c}:void 0,e[0]=c,e[1]=r,e[2]=t,e[3]=o,e[4]=n,e[5]=l):l=e[5],l};export{g as B,N as M,d as a,O as b,D as c,M as h,S as i,x as o,v as r,K as u};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/useAppFontEffects-UKWR--vP.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/katex.min-BM3LOlr3.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-Csf1sqWl.js","assets/vendor-opencode-client-CqFY51gT.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/vendor-streamdown-BbSYZ3NF.js","assets/vendor-markdown-BTUqNk6W.js","assets/vendor-mdast-util-from-markdown-CZHjOE75.js","assets/vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js","assets/vendor-micromark-util-decode-string-fHsnqYdj.js","assets/vendor-decode-named-character-reference-C3-224fz.js","assets/vendor-micromark-util-normalize-identifier-C9ANKk3v.js","assets/vendor-micromark-AWM-NZXP.js","assets/vendor-micromark-util-combine-extensions-d8XJZrgA.js","assets/vendor-micromark-util-chunked-DrRIdSP-.js","assets/vendor-micromark-factory-space-PzSHLgmq.js","assets/vendor-micromark-util-character-CW3Cu1MS.js","assets/vendor-micromark-core-commonmark-kzTLNXAm.js","assets/vendor-micromark-util-classify-character-tcLuZZwM.js","assets/vendor-micromark-util-resolve-all-PQCKh0dx.js","assets/vendor-micromark-util-subtokenize-BF1Jf29a.js","assets/vendor-micromark-factory-destination-Sj0xfi0V.js","assets/vendor-micromark-factory-label-amyP0HdC.js","assets/vendor-micromark-factory-title-khnLkZK6.js","assets/vendor-micromark-factory-whitespace-eIB00uTl.js","assets/vendor-micromark-util-html-tag-name-DbKNfynz.js","assets/vendor-unist-util-stringify-position-Ch_qCilz.js","assets/vendor-mdast-util-to-string-C_aolqmU.js","assets/vendor-unist-util-visit-DhPeCsfG.js","assets/vendor-unist-util-visit-parents-DlviEg7Z.js","assets/vendor-unist-util-is-BPZGFiMU.js","assets/vendor-hast-util-raw-DvvLJg15.js","assets/vendor-ungap-structured-clone--gfxRhYI.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-parse5-DwmzEj2o.js","assets/vendor-entities-wUUgTZDW.js","assets/vendor-web-namespaces-bsVAaBS1.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-unist-util-position-60F3QETU.js","assets/vendor-hast-util-from-parse5-Ba3T6RJI.js","assets/vendor-devlop-0Dp3JUBc.js","assets/vendor-property-information-Boo8Xpef.js","assets/vendor-hastscript-BrPNioaz.js","assets/vendor-comma-separated-tokens-CRUGqg4f.js","assets/vendor-space-separated-tokens-D7QSIrTI.js","assets/vendor-hast-util-parse-selector-TXfch5wI.js","assets/vendor-vfile-location-LfEFwJ2h.js","assets/vendor-hast-util-to-parse5-BoysVIPW.js","assets/vendor-hast-util-sanitize-2aGO5ay8.js","assets/vendor-micromark-extension-gfm-CsfPlnlB.js","assets/vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js","assets/vendor-micromark-extension-gfm-footnote-OFl1FCH2.js","assets/vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js","assets/vendor-micromark-extension-gfm-table-dgw4LfUw.js","assets/vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js","assets/vendor-mdast-util-gfm-CroMDYLM.js","assets/vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-mdast-util-find-and-replace-DB9iC-bx.js","assets/vendor-escape-string-regexp-BaJN9MlJ.js","assets/vendor-mdast-util-gfm-footnote-C-csI7OF.js","assets/vendor-mdast-util-gfm-strikethrough-BcskTdio.js","assets/vendor-mdast-util-gfm-table-DhPwQIyj.js","assets/vendor-markdown-table-DvhhVmnL.js","assets/vendor-mdast-util-to-markdown-Cl3qaiyc.js","assets/vendor-longest-streak-CtXnX3Xp.js","assets/vendor-mdast-util-phrasing-4oVbNLC3.js","assets/vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js","assets/vendor-mdast-util-to-hast-CWnLaQSO.js","assets/vendor-micromark-util-sanitize-uri-BbwQ7CLk.js","assets/vendor-trim-lines-D8znQY54.js","assets/vendor-micromark-extension-cjk-friendly-BzZDGrF5.js","assets/vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js","assets/vendor-get-east-asian-width-CPhS2cOv.js","assets/vendor-micromark-util-symbol-JJPacVTp.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js","assets/vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js","assets/vendor-hast-util-from-html-isomorphic-B0Kn01s9.js","assets/vendor-hast-util-from-dom-DeNf9aYW.js","assets/vendor-katex-DBqql0K7.js","assets/vendor-hast-util-to-text-0GXLnBvt.js","assets/vendor-hast-util-is-element-CuOmiqQi.js","assets/vendor-unist-util-find-after-CMaZmLxc.js","assets/vendor-micromark-extension-math-BRFoDziv.js","assets/vendor-mdast-util-math-wB-IJCL0.js","assets/vendor-remend-r8cP_t-e.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-marked-DN3zOnEe.js","assets/vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js","assets/vendor-style-to-js-CI2G4dgu.js","assets/vendor-style-to-object-BAv4SQXc.js","assets/vendor-inline-style-parser-BlqBsVO4.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-estree-util-is-identifier-name-BgBfM8ME.js","assets/vendor-vfile-message-DqhD22jI.js","assets/vendor-unified-1CQKw2_w.js","assets/vendor-bail-FqpXQuLt.js","assets/vendor-extend-B94qxKr5.js","assets/vendor-is-plain-obj-C1gvLhAf.js","assets/vendor-trough-B_b8ryxu.js","assets/vendor-vfile-BCWrK60u.js","assets/vendor-html-url-attributes-D46m5wfe.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/katex-Dejpsg4Y.css","assets/vendor-base-ui-zhBy6TEG.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-floating-ui-react-dom-Cy8dRGoy.js","assets/vendor-use-sync-external-store-CfLJGVyr.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-dnd-kit-core-Br1Cs7RV.js","assets/vendor-dnd-kit-utilities-DZ9KbT5S.js","assets/vendor-dnd-kit-accessibility-CYclfhtC.js","assets/vendor-dnd-kit-sortable-DpfLEOLv.js","assets/vendor-tanstack-react-virtual-CqfECoM0.js","assets/vendor-tanstack-virtual-core-BdFnkr_2.js","assets/vendor-framer-motion-C_wK4GIM.js","assets/vendor-motion-dom-HXPOMxb7.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-codemirror-commands-CjjsURR-.js","assets/vendor-codemirror-state-Cd8udR5z.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-Ciie9ey-.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-codemirror-language-8HZTPOnt.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CZEcqU6G.js","assets/vendor-codemirror-streamparser-CmlTsbN2.js","assets/vendor-codemirror-lang-javascript-DmqaSK_j.js","assets/vendor-lezer-javascript-CWSwshuO.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BGedy2gC.js","assets/vendor-codemirror-lang-json-DVAYKmoO.js","assets/vendor-lezer-json-Cn1mncjr.js","assets/vendor-codemirror-lang-css-BLpgXfL2.js","assets/vendor-lezer-css-B2Hx_Nps.js","assets/vendor-codemirror-lang-html-S3jxr3Mo.js","assets/vendor-lezer-html-Cr8K5DGw.js","assets/vendor-codemirror-lang-markdown-D1jveRI5.js","assets/vendor-lezer-markdown-TQKzBB8i.js","assets/vendor-codemirror-language-data-CVww3XgZ.js","assets/vendor-codemirror-lang-python-B-5UC9Ui.js","assets/vendor-lezer-python-BUoImtUb.js","assets/vendor-sonner-Dw26OnzC.js","assets/vendor-cmdk-BtSpU-Io.js","assets/vendor-radix-ui-react-dialog-OIW6VLWw.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D4RvEbuR.js","assets/vendor-radix-ui-react-context-BbFoxCHu.js","assets/vendor-radix-ui-react-id-aGag8i_5.js","assets/vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js","assets/vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js","assets/vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js","assets/vendor-radix-ui-react-primitive-CrN9dRDb.js","assets/vendor-radix-ui-react-slot-BjbalUfz.js","assets/vendor-radix-ui-react-use-callback-ref-CcC_buIU.js","assets/vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js","assets/vendor-radix-ui-react-focus-scope-D1noLHmd.js","assets/vendor-radix-ui-react-portal-BlUEzfrF.js","assets/vendor-radix-ui-react-presence-BGqFfiW4.js","assets/vendor-radix-ui-react-focus-guards-CSS2IbZC.js","assets/vendor-react-remove-scroll-Der_cv-1.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-Clwl9llp.js","assets/vendor-react-style-singleton-D_xJlTqU.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-BdLl6ZIw.js","assets/vendor-use-callback-ref-CXJF1lEr.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-legendapp-list-wfKYGEOv.js","assets/vendor-class-variance-authority-5VPnzWs2.js"])))=>i.map(i=>d[i]);
2
- import{f as F,R,r as we,j as i}from"./vendor-react--VO_rL_p.js";import{u as O,bq as ge,br as xe,bs as be,bg as $,bt as Se,bu as ee,bv as ve,bw as ae,aK as _e,aI as te}from"./katex.min-BM3LOlr3.js";import{u as J,Q as G,I as A,a3 as ye,a4 as je,a2 as Ne,$ as q,fI as Ce,fJ as Ie,n as Ee,fK as Le,fL as ke,au as De,fM as Re,cm as ze,cj as Ae,b7 as Te,x as ne,fN as se,fO as Fe,fP as Pe,fQ as $e,fR as Oe,fi as Ge,fS as Me,X as le,fT as He}from"./useAppFontEffects-UKWR--vP.js";import{M as ce}from"./vendor-base-ui-zhBy6TEG.js";import{o as oe,a as We,f as Ve,s as Be}from"./vendor-zod-Csf1sqWl.js";import{_ as de}from"./vendor-vite-runtime-DD1OZmLC.js";function Ft(){const n=F.c(5),e=O(Ue);let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t=ge(),n[0]=t):t=n[0];const a=t;let s;n[1]!==e?(s=xe(e),n[1]=e,n[2]=s):s=n[2];const r=s;let o;return n[3]!==r?(o={usesFramelessChrome:a,side:r},n[3]=r,n[4]=o):o=n[4],o}function Ue(n){return n.desktopWindowControlsPosition}const Ze={close:"#FF5F57",minimize:"#FEBC2E",maximize:"#28C940"},Ye="rgba(0, 0, 0, 0.7)",qe=n=>{const e=F.c(3),{action:t}=n;if(t==="close"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx(A,{name:"close",className:"size-[10px]"}),e[0]=s):s=e[0],s}if(t==="minimize"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx(A,{name:"subtract",className:"size-[10px]"}),e[1]=s):s=e[1],s}let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(A,{name:"add",className:"size-[10px]"}),e[2]=a):a=e[2],a},Ke=n=>{const e=F.c(18),{action:t,isMaximized:a,onActivate:s}=n,{t:r}=J(),o=Ze[t];let c;e[0]!==t||e[1]!==a||e[2]!==r?(c=r(t==="close"?"header.windowControls.close":t==="minimize"?"header.windowControls.minimize":a?"header.windowControls.restore":"header.windowControls.maximize"),e[0]=t,e[1]=a,e[2]=r,e[3]=c):c=e[3];const u=c;let d;e[4]!==t||e[5]!==s?(d=()=>s(t),e[4]=t,e[5]=s,e[6]=d):d=e[6];let l;e[7]!==o?(l={backgroundColor:o,color:Ye},e[7]=o,e[8]=l):l=e[8];let m;e[9]!==t?(m=i.jsx("span",{className:"flex items-center justify-center opacity-0 transition-opacity duration-75 group-hover/wctl:opacity-100",children:i.jsx(qe,{action:t})}),e[9]=t,e[10]=m):m=e[10];let h;e[11]!==l||e[12]!==m?(h=i.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:l,children:m}),e[11]=l,e[12]=m,e[13]=h):h=e[13];let p;return e[14]!==u||e[15]!==d||e[16]!==h?(p=i.jsx("button",{type:"button",onClick:d,title:u,"aria-label":u,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:h}),e[14]=u,e[15]=d,e[16]=h,e[17]=p):p=e[17],p},Pt=R.memo(function(e){const t=F.c(27),{visible:a,position:s}=e,r=s===void 0?"right":s,{t:o}=J(),[c,u]=R.useState(!1),d=O(Je);let l,m;if(t[0]!==a?(l=()=>{if(!a)return;let N=!1;$("desktop_get_current_window_state").then(_=>{N||u(!!_?.maximized)}).catch(Qe);const C=_=>{const y=_.detail;u(!!y?.maximized)};return window.addEventListener("openchamber:window-maximized-changed",C),()=>{N=!0,window.removeEventListener("openchamber:window-maximized-changed",C)}},m=[a],t[0]=a,t[1]=l,t[2]=m):(l=t[1],m=t[2]),we.useEffect(l,m),!a)return null;const h=r==="left";let p,f,w,g,S;if(t[3]!==d||t[4]!==h||t[5]!==c||t[6]!==r||t[7]!==o){S=Symbol.for("react.early_return_sentinel");e:{const N=be(r);let C;t[13]===Symbol.for("react.memo_cache_sentinel")?(C=x=>{if(x==="close"){$("desktop_close_current_window");return}if(x==="minimize"){$("desktop_minimize_current_window");return}$("desktop_toggle_current_window_maximized").then(v=>u(!!v?.maximized)).catch(Xe)},t[13]=C):C=t[13];const _=C;if(d==="traffic-lights"){const x=h?"me-1":"ms-1 me-3";let v;t[14]!==x?(v=G("app-region-no-drag group/wctl flex h-8 shrink-0 items-center",x),t[14]=x,t[15]=v):v=t[15];let I;t[16]!==o?(I=o("header.windowControls.groupAria"),t[16]=o,t[17]=I):I=t[17];let E;t[18]!==c?(E=T=>i.jsx(Ke,{action:T,isMaximized:c,onActivate:_},T),t[18]=c,t[19]=E):E=t[19],S=i.jsx("div",{dir:"ltr",className:v,"aria-label":I,children:N.map(E)});break e}const y=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",h?"h-8 w-8 rounded-md":"h-12 w-11"),k=h?"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",D=x=>x==="minimize"?i.jsx("button",{type:"button",className:y,onClick:et,title:o("header.windowControls.minimize"),"aria-label":o("header.windowControls.minimize"),children:i.jsx(A,{name:"subtract",className:"h-4 w-4"})},"minimize"):x==="maximize"?i.jsx("button",{type:"button",className:y,onClick:()=>{$("desktop_toggle_current_window_maximized").then(v=>u(!!v?.maximized)).catch(tt)},title:o(c?"header.windowControls.restore":"header.windowControls.maximize"),"aria-label":o(c?"header.windowControls.restore":"header.windowControls.maximize"),children:i.jsx(A,{name:c?"fullscreen-exit":"checkbox-blank",className:"h-3.5 w-3.5"})},"maximize"):i.jsx("button",{type:"button",className:G(y,"hover:bg-[var(--status-error)] hover:text-[var(--status-error-foreground)]"),onClick:nt,title:o("header.windowControls.close"),"aria-label":o("header.windowControls.close"),children:i.jsx(A,{name:"close",className:"h-4 w-4"})},"close");p="ltr",f=k,t[20]!==o?(w=o("header.windowControls.groupAria"),t[20]=o,t[21]=w):w=t[21],g=N.map(D)}t[3]=d,t[4]=h,t[5]=c,t[6]=r,t[7]=o,t[8]=p,t[9]=f,t[10]=w,t[11]=g,t[12]=S}else p=t[8],f=t[9],w=t[10],g=t[11],S=t[12];if(S!==Symbol.for("react.early_return_sentinel"))return S;let b;return t[22]!==p||t[23]!==f||t[24]!==w||t[25]!==g?(b=i.jsx("div",{dir:p,className:f,"aria-label":w,children:g}),t[22]=p,t[23]=f,t[24]=w,t[25]=g,t[26]=b):b=t[26],b});function Je(n){return n.desktopWindowControlsStyle}function Qe(){}function Xe(){}function et(){$("desktop_minimize_current_window")}function tt(){}function nt(){$("desktop_close_current_window")}const X="new-session";function $t(n){const e=F.c(18),{children:t,variant:a,scopeProjectId:s,align:r}=n,o=a===void 0?"default":a,c=s===void 0?null:s,u=r===void 0?"start":r,d=O(ot),l=O(st);let m;e[0]!==t?(m=i.jsx(ye,{asChild:!0,children:t}),e[0]=t,e[1]=m):m=e[1];const h=o==="compact"?"w-[280px]":"w-[360px]";let p;e[2]!==h?(p=G("overflow-hidden p-1 max-w-[calc(100vw-32px)]",h),e[2]=h,e[3]=p):p=e[3];let f;e[4]!==d||e[5]!==c||e[6]!==l||e[7]!==o?(f=d?i.jsx(it,{onSelect:()=>l(!1),variant:o,scopeProjectId:c}):null,e[4]=d,e[5]=c,e[6]=l,e[7]=o,e[8]=f):f=e[8];let w;e[9]!==u||e[10]!==p||e[11]!==f?(w=i.jsx(je,{align:u,sideOffset:6,className:p,children:f}),e[9]=u,e[10]=p,e[11]=f,e[12]=w):w=e[12];let g;return e[13]!==d||e[14]!==l||e[15]!==m||e[16]!==w?(g=i.jsxs(Ne,{open:d,onOpenChange:l,modal:!1,disableGlobalShortcuts:!0,children:[m,w]}),e[13]=d,e[14]=l,e[15]=m,e[16]=w,e[17]=g):g=e[17],g}function st(n){return n.setSessionDropdownOpen}function ot(n){return n.isSessionDropdownOpen}function it(n){const e=F.c(31),{onSelect:t,variant:a,scopeProjectId:s}=n,r=q(lt),o=q(at);let c;e[0]!==r||e[1]!==s?(c={scopeProjectId:s,currentSessionId:r},e[0]=r,e[1]=s,e[2]=c):c=e[2];const u=Ce(!0,c),d=q(rt),{t:l}=J();let m;e[3]!==t||e[4]!==d?(m=()=>{t(),d()},e[3]=t,e[4]=d,e[5]=m):m=e[5];const h=m;let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[6]=p):p=e[6];const[f,w]=R.useState(p),g=R.useRef(null),S=R.useRef(!1),b=o?X:r;let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=j=>{w(Y=>{const L=new Set(Y);return L.has(j)?L.delete(j):L.add(j),L})},e[7]=N):N=e[7];const C=N;let _,y;e[8]!==f||e[9]!==b||e[10]!==u?(_=()=>{if(S.current||!b)return;const j=b===X?[]:Ie(u,b);if(!j)return;if(j.some(L=>!f.has(L))){w(L=>new Set([...L,...j]));return}const Y=requestAnimationFrame(()=>{const L=Array.from(g.current?.querySelectorAll("[data-switcher-item-id]")??[]).find(P=>P.dataset.switcherItemId===b);L&&(L.focus(),L.scrollIntoView({block:"nearest"}),S.current=!0)});return()=>cancelAnimationFrame(Y)},y=[f,b,u],e[8]=f,e[9]=b,e[10]=u,e[11]=_,e[12]=y):(_=e[11],y=e[12]),R.useLayoutEffect(_,y);let k,D;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=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"),D=i.jsx(A,{name:"chat-new",className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),e[13]=k,e[14]=D):(k=e[13],D=e[14]);let x;e[15]!==l?(x=l("sessions.sidebar.header.actions.newSession"),e[15]=l,e[16]=x):x=e[16];let v;e[17]!==x?(v=i.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:x}),e[17]=x,e[18]=v):v=e[18];let I;e[19]!==h||e[20]!==v?(I=i.jsxs(ce,{"data-switcher-item-id":X,onClick:h,className:k,children:[D,v]}),e[19]=h,e[20]=v,e[21]=I):I=e[21];let E;e[22]!==f||e[23]!==u||e[24]!==t||e[25]!==l||e[26]!==a?(E=u.length===0?i.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:l("sessions.switcher.empty")}):u.map(j=>i.jsx(ue,{item:j,depth:0,variant:a,expandedParents:f,toggleParent:C,closeDropdown:t},j.node.session.id)),e[22]=f,e[23]=u,e[24]=t,e[25]=l,e[26]=a,e[27]=E):E=e[27];let T;return e[28]!==I||e[29]!==E?(T=i.jsx(Ee,{ref:g,outerClassName:"max-h-[60vh]",disableHorizontal:!0,children:i.jsxs("div",{className:"space-y-0.5",children:[I,E]})}),e[28]=I,e[29]=E,e[30]=T):T=e[30],T}function rt(n){return n.openNewSessionDraft}function at(n){return n.newSessionDraft.open===!0}function lt(n){return n.currentSessionId}function ue(n){const e=F.c(31),{item:t,depth:a,variant:s,expandedParents:r,toggleParent:o,closeDropdown:c}=n,{node:u,secondaryMeta:d}=t,l=u.session,m=u.children.length>0;let h;e[0]!==r||e[1]!==l.id?(h=r.has(l.id),e[0]=r,e[1]=l.id,e[2]=h):h=e[2];const p=h;let f;e[3]!==m||e[4]!==l.id||e[5]!==o?(f=m?()=>o(l.id):void 0,e[3]=m,e[4]=l.id,e[5]=o,e[6]=f):f=e[6];let w;e[7]!==c||e[8]!==a||e[9]!==m||e[10]!==p||e[11]!==d||e[12]!==l||e[13]!==f||e[14]!==s?(w=i.jsx(ct,{session:l,depth:a,variant:s,secondaryMeta:d,hasChildren:m,isExpanded:p,onToggleExpand:f,closeDropdown:c}),e[7]=c,e[8]=a,e[9]=m,e[10]=p,e[11]=d,e[12]=l,e[13]=f,e[14]=s,e[15]=w):w=e[15];let g;e[16]!==c||e[17]!==a||e[18]!==r||e[19]!==m||e[20]!==p||e[21]!==t.groupDirectory||e[22]!==t.projectId||e[23]!==u.children||e[24]!==d||e[25]!==o||e[26]!==s?(g=m&&p?u.children.map(b=>i.jsx(ue,{item:{node:b,projectId:t.projectId,groupDirectory:t.groupDirectory,secondaryMeta:d},depth:a+1,variant:s,expandedParents:r,toggleParent:o,closeDropdown:c},b.session.id)):null,e[16]=c,e[17]=a,e[18]=r,e[19]=m,e[20]=p,e[21]=t.groupDirectory,e[22]=t.projectId,e[23]=u.children,e[24]=d,e[25]=o,e[26]=s,e[27]=g):g=e[27];let S;return e[28]!==w||e[29]!==g?(S=i.jsxs(i.Fragment,{children:[w,g]}),e[28]=w,e[29]=g,e[30]=S):S=e[30],S}function ct(n){const e=F.c(55),{session:t,depth:a,variant:s,secondaryMeta:r,hasChildren:o,isExpanded:c,onToggleExpand:u,closeDropdown:d}=n,{t:l}=J(),m=q(ut),h=q(dt),p=Le(t.id),f=m===t.id;let w;e[0]!==t.title||e[1]!==l?(w=t.title?.trim()||l("sessions.sidebar.session.untitled"),e[0]=t.title,e[1]=l,e[2]=w):w=e[2];const g=w,S=ke(t.id),b=S!==null,N=De(b),C=!b&&p&&!f;let _;if(e[3]!==t){const z=Re(t)||Date.now();_=ze(z),e[3]=t,e[4]=_}else _=e[4];const y=_;let k;e[5]!==r?.projectLabel?(k=r?.projectLabel?.trim()||null,e[5]=r?.projectLabel,e[6]=k):k=e[6];const D=k;let x;e[7]!==r?.branchLabel?(x=r?.branchLabel?.trim()||null,e[7]=r?.branchLabel,e[8]=x):x=e[8];const v=x,I=v&&v!=="HEAD"?v:null;let E;e[9]!==d||e[10]!==f||e[11]!==t||e[12]!==h?(E=()=>{if(f){d();return}const z=Te(t);h(t.id,z??null),d()},e[9]=d,e[10]=f,e[11]=t,e[12]=h,e[13]=E):E=e[13];const T=E;let j;e[14]!==T?(j=z=>{if(z.target?.closest("[data-switcher-expand]")){z.preventDefault();return}T()},e[14]=T,e[15]=j):j=e[15];const Y=t.id,L=f&&"bg-interactive-selection text-interactive-selection-foreground hover:bg-interactive-selection data-[highlighted]:bg-interactive-selection";let P;e[16]!==L?(P=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",L),e[16]=L,e[17]=P):P=e[17];const Q=8+a*12;let M;e[18]!==Q?(M={paddingInlineStart:Q},e[18]=Q,e[19]=M):M=e[19];let H;e[20]!==o||e[21]!==c||e[22]!==u||e[23]!==l||e[24]!==s?(H=s==="compact"&&o?i.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:z=>{z.preventDefault(),z.stopPropagation(),u?.()},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":l(c?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:c?i.jsx(A,{name:"arrow-down-s",className:"h-3.5 w-3.5"}):i.jsx(A,{name:"arrow-right-s",className:"h-3.5 w-3.5"})}):null,e[20]=o,e[21]=c,e[22]=u,e[23]=l,e[24]=s,e[25]=H):H=e[25];let W;e[26]!==g?(W=i.jsx("span",{dir:"auto",className:"truncate oc-ui-start-align typography-ui-label font-normal leading-tight text-foreground",children:g}),e[26]=g,e[27]=W):W=e[27];let V;e[28]!==H||e[29]!==W?(V=i.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[H,W]}),e[28]=H,e[29]=W,e[30]=V):V=e[30];let B;e[31]!==I||e[32]!==o||e[33]!==c||e[34]!==u||e[35]!==D||e[36]!==l||e[37]!==y||e[38]!==s?(B=s==="default"?i.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:[o?i.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:z=>{z.preventDefault(),z.stopPropagation(),u?.()},className:"inline-flex h-3 w-3 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground","aria-label":l(c?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:c?i.jsx(A,{name:"arrow-down-s",className:"h-3 w-3"}):i.jsx(A,{name:"arrow-right-s",className:"h-3 w-3"})}):null,i.jsx("span",{className:"flex-shrink-0",children:y}),D?i.jsx("span",{className:"truncate",children:D}):null,I?i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[i.jsx(A,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),i.jsx("span",{className:"truncate",children:I})]}):null]}):null,e[31]=I,e[32]=o,e[33]=c,e[34]=u,e[35]=D,e[36]=l,e[37]=y,e[38]=s,e[39]=B):B=e[39];let U;e[40]!==V||e[41]!==B?(U=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[V,B]}),e[40]=V,e[41]=B,e[42]=U):U=e[42];let Z;e[43]!==b||e[44]!==N||e[45]!==C||e[46]!==S?(Z=b||C?i.jsx("span",{className:"flex h-3 w-3 flex-shrink-0 items-center justify-center self-center",children:i.jsx(Ae,{state:S??"unread",runningClassName:G("h-2 w-2",N)})}):null,e[43]=b,e[44]=N,e[45]=C,e[46]=S,e[47]=Z):Z=e[47];let K;return e[48]!==t.id||e[49]!==M||e[50]!==U||e[51]!==Z||e[52]!==j||e[53]!==P?(K=i.jsxs(ce,{onClick:j,"data-slot":"session-switcher-item","data-switcher-item-id":Y,className:P,style:M,children:[U,Z]}),e[48]=t.id,e[49]=M,e[50]=U,e[51]=Z,e[52]=j,e[53]=P,e[54]=K):K=e[54],K}function dt(n){return n.setCurrentSession}function ut(n){return n.currentSessionId}const Ot=n=>!Number.isFinite(n)||n<=0?new Intl.NumberFormat(ne(),{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(0):new Intl.NumberFormat(ne(),{style:"currency",currency:"USD",minimumFractionDigits:n<.01?4:2,maximumFractionDigits:n<.01?4:2}).format(n),mt="ui-store",ft=oe({state:oe({contextSurfaceZones:We(Be(),Ve())})}),pt=n=>{if(!n)return null;let e;try{e=JSON.parse(n)}catch{return null}const t=ft.safeParse(e);return t.success?ve.parse(t.data.state.contextSurfaceZones):null},Gt=()=>{const n=e=>{if(e.key!==mt)return;const t=pt(e.newValue);if(!t)return;const a=O.getState().contextSurfaceZones,s=new Set([...Object.keys(a),...Object.keys(t)].filter(Se));for(const r of s){const o=ee(t,r);o!==ee(O.getState().contextSurfaceZones,r)&&O.getState().moveContextSurfaceToZone(r,o)}};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)},ht=R.lazy(()=>de(()=>import("./useAppFontEffects-UKWR--vP.js").then(n=>n.sg),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.GuestAttachDialog}))),me=R.lazy(()=>de(()=>import("./useAppFontEffects-UKWR--vP.js").then(n=>n.sf),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.PluginPane}))),Mt=()=>{const n=F.c(11),e=se(wt),t=se(gt),a=Fe(xt),s=Pe(bt);let r;n[0]!==s?(r=s.map(St),n[0]=s,n[1]=r):r=n[1];let o;n[2]!==t||n[3]!==e?(o=e?i.jsx(R.Suspense,{fallback:null,children:i.jsx(ht,{guestId:e.guestId,item:e.item,onOpenChange:d=>{d||t()}})}):null,n[2]=t,n[3]=e,n[4]=o):o=n[4];let c;n[5]!==a?(c=a?i.jsx("div",{"aria-hidden":"true",className:"pointer-events-none fixed top-0 -inset-s-[9999px] h-px w-px overflow-hidden",children:i.jsx(R.Suspense,{fallback:null,children:i.jsx(me,{mode:ae(a),surface:"panel",headless:!0})})}):null,n[5]=a,n[6]=c):c=n[6];let u;return n[7]!==r||n[8]!==o||n[9]!==c?(u=i.jsxs(i.Fragment,{children:[r,o,c]}),n[7]=r,n[8]=o,n[9]=c,n[10]=u):u=n[10],u};function wt(n){return n.request}function gt(n){return n.close}function xt(n){return n.guestId}function bt(n){return n.requests}function St(n){return i.jsx("div",{"aria-hidden":"true",inert:!0,className:"pointer-events-none fixed top-0 -inset-s-[9999px] h-px w-px overflow-hidden",children:i.jsx(R.Suspense,{fallback:null,children:i.jsx(me,{mode:ae(n.guestId),surface:"background",headless:!0,backgroundAction:n})})},n.id)}const ie=45e3,re=10*6e4,vt=[1e3,2e3,4e3],fe={isHidden:()=>!1,onVisible:()=>()=>{}},_t=()=>()=>{},yt=()=>typeof document>"u"?fe:{isHidden:()=>document.visibilityState==="hidden",onVisible:n=>{let e=document.visibilityState==="hidden";const t=()=>{const s=document.visibilityState==="hidden";e&&!s&&n(),e=s},a=()=>{e&&document.visibilityState!=="hidden"&&t()};return document.addEventListener("visibilitychange",t),window.addEventListener("focus",a),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("focus",a)}}},jt=(n,e,t=window.setTimeout.bind(window),a=window.clearTimeout.bind(window),s=fe,r=_t,o=e,c=Date.now)=>{let u=!1,d,l=0,m=!1,h=!1,p=!1,f=!1,w=Number.NEGATIVE_INFINITY;const g=async(N,C=!0)=>{h=!0,p=!1;const _=await N().catch(()=>!1);if(h=!1,u)return;if(m||=_,C&&_&&(w=c()),f){f=!1,g(e);return}if(!m&&p){g(e);return}const y=m?void 0:vt[l];y!==void 0&&(l+=1);const k=re-(c()-w),D=k>0?Math.min(ie,k):C?ie:0;d=t(()=>{if(d=void 0,s.isHidden())return;const x=!m||c()-w>=re;g(x?e:o,x)},y??D)},S=s.onVisible(()=>{if(!u){if(d!==void 0&&a(d),d=void 0,h){f=!0;return}g(e)}}),b=r(()=>{if(!(u||m)){if(h){p=!0;return}d!==void 0&&a(d),d=void 0,g(e)}});return g(n),()=>{u=!0,S(),b(),d!==void 0&&a(d)}},Ht=n=>{const e=F.c(3);let t,a;e[0]!==n?(t=()=>{const s=Ct;let r=s();const o=_e(()=>{r(),r=s()});return()=>{o(),r()}},a=[n],e[0]=n,e[1]=t,e[2]=a):(t=e[1],a=e[2]),R.useEffect(t,a)};function Nt(){return le.getState().refreshSessionHead()}function Ct(){const n=te();let e=!0;const t=async s=>(s?await $e(Oe()):await Ge(),!e||te()!==n?!1:(Me(),le.getState().status==="ready")),a=jt(()=>t(!0),()=>t(!1),window.setTimeout.bind(window),window.clearTimeout.bind(window),yt(),s=>He(r=>{r===n&&s()}),Nt);return()=>{e=!1,a()}}const pe=()=>{const n=[document.documentElement,document.body],e=document.getElementById("root");return e&&n.push(e),n},he=()=>{let n=!1;for(const e of pe())e.scrollTop!==0&&(e.scrollTop=0,n=!0),e.scrollLeft!==0&&(e.scrollLeft=0,n=!0);return n},It=n=>n===document||pe().some(e=>e===n),Wt=()=>{const n=F.c(1);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],n[0]=e):e=n[0],R.useEffect(Lt,e)};function Et(n){It(n.target)&&he()}function Lt(){const n=Et;return document.addEventListener("scroll",n,{capture:!0,passive:!0}),he(),()=>document.removeEventListener("scroll",n,{capture:!0})}export{Mt as G,$t as S,Pt as W,Gt as a,Wt as b,Ht as c,Ot as f,Ft as u};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/useAppFontEffects-6HvTeJY2.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/katex.min-B7gF3rmE.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-Csf1sqWl.js","assets/vendor-opencode-client-CqFY51gT.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/vendor-streamdown-BbSYZ3NF.js","assets/vendor-markdown-BTUqNk6W.js","assets/vendor-mdast-util-from-markdown-CZHjOE75.js","assets/vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js","assets/vendor-micromark-util-decode-string-fHsnqYdj.js","assets/vendor-decode-named-character-reference-C3-224fz.js","assets/vendor-micromark-util-normalize-identifier-C9ANKk3v.js","assets/vendor-micromark-AWM-NZXP.js","assets/vendor-micromark-util-combine-extensions-d8XJZrgA.js","assets/vendor-micromark-util-chunked-DrRIdSP-.js","assets/vendor-micromark-factory-space-PzSHLgmq.js","assets/vendor-micromark-util-character-CW3Cu1MS.js","assets/vendor-micromark-core-commonmark-kzTLNXAm.js","assets/vendor-micromark-util-classify-character-tcLuZZwM.js","assets/vendor-micromark-util-resolve-all-PQCKh0dx.js","assets/vendor-micromark-util-subtokenize-BF1Jf29a.js","assets/vendor-micromark-factory-destination-Sj0xfi0V.js","assets/vendor-micromark-factory-label-amyP0HdC.js","assets/vendor-micromark-factory-title-khnLkZK6.js","assets/vendor-micromark-factory-whitespace-eIB00uTl.js","assets/vendor-micromark-util-html-tag-name-DbKNfynz.js","assets/vendor-unist-util-stringify-position-Ch_qCilz.js","assets/vendor-mdast-util-to-string-C_aolqmU.js","assets/vendor-unist-util-visit-DhPeCsfG.js","assets/vendor-unist-util-visit-parents-DlviEg7Z.js","assets/vendor-unist-util-is-BPZGFiMU.js","assets/vendor-hast-util-raw-DvvLJg15.js","assets/vendor-ungap-structured-clone--gfxRhYI.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-parse5-DwmzEj2o.js","assets/vendor-entities-wUUgTZDW.js","assets/vendor-web-namespaces-bsVAaBS1.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-unist-util-position-60F3QETU.js","assets/vendor-hast-util-from-parse5-Ba3T6RJI.js","assets/vendor-devlop-0Dp3JUBc.js","assets/vendor-property-information-Boo8Xpef.js","assets/vendor-hastscript-BrPNioaz.js","assets/vendor-comma-separated-tokens-CRUGqg4f.js","assets/vendor-space-separated-tokens-D7QSIrTI.js","assets/vendor-hast-util-parse-selector-TXfch5wI.js","assets/vendor-vfile-location-LfEFwJ2h.js","assets/vendor-hast-util-to-parse5-BoysVIPW.js","assets/vendor-hast-util-sanitize-2aGO5ay8.js","assets/vendor-micromark-extension-gfm-CsfPlnlB.js","assets/vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js","assets/vendor-micromark-extension-gfm-footnote-OFl1FCH2.js","assets/vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js","assets/vendor-micromark-extension-gfm-table-dgw4LfUw.js","assets/vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js","assets/vendor-mdast-util-gfm-CroMDYLM.js","assets/vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-mdast-util-find-and-replace-DB9iC-bx.js","assets/vendor-escape-string-regexp-BaJN9MlJ.js","assets/vendor-mdast-util-gfm-footnote-C-csI7OF.js","assets/vendor-mdast-util-gfm-strikethrough-BcskTdio.js","assets/vendor-mdast-util-gfm-table-DhPwQIyj.js","assets/vendor-markdown-table-DvhhVmnL.js","assets/vendor-mdast-util-to-markdown-Cl3qaiyc.js","assets/vendor-longest-streak-CtXnX3Xp.js","assets/vendor-mdast-util-phrasing-4oVbNLC3.js","assets/vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js","assets/vendor-mdast-util-to-hast-CWnLaQSO.js","assets/vendor-micromark-util-sanitize-uri-BbwQ7CLk.js","assets/vendor-trim-lines-D8znQY54.js","assets/vendor-micromark-extension-cjk-friendly-BzZDGrF5.js","assets/vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js","assets/vendor-get-east-asian-width-CPhS2cOv.js","assets/vendor-micromark-util-symbol-JJPacVTp.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js","assets/vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js","assets/vendor-hast-util-from-html-isomorphic-B0Kn01s9.js","assets/vendor-hast-util-from-dom-DeNf9aYW.js","assets/vendor-katex-DBqql0K7.js","assets/vendor-hast-util-to-text-0GXLnBvt.js","assets/vendor-hast-util-is-element-CuOmiqQi.js","assets/vendor-unist-util-find-after-CMaZmLxc.js","assets/vendor-micromark-extension-math-BRFoDziv.js","assets/vendor-mdast-util-math-wB-IJCL0.js","assets/vendor-remend-r8cP_t-e.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-marked-DN3zOnEe.js","assets/vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js","assets/vendor-style-to-js-CI2G4dgu.js","assets/vendor-style-to-object-BAv4SQXc.js","assets/vendor-inline-style-parser-BlqBsVO4.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-estree-util-is-identifier-name-BgBfM8ME.js","assets/vendor-vfile-message-DqhD22jI.js","assets/vendor-unified-1CQKw2_w.js","assets/vendor-bail-FqpXQuLt.js","assets/vendor-extend-B94qxKr5.js","assets/vendor-is-plain-obj-C1gvLhAf.js","assets/vendor-trough-B_b8ryxu.js","assets/vendor-vfile-BCWrK60u.js","assets/vendor-html-url-attributes-D46m5wfe.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/katex-Dejpsg4Y.css","assets/vendor-base-ui-zhBy6TEG.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-floating-ui-react-dom-Cy8dRGoy.js","assets/vendor-use-sync-external-store-CfLJGVyr.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-dnd-kit-core-Br1Cs7RV.js","assets/vendor-dnd-kit-utilities-DZ9KbT5S.js","assets/vendor-dnd-kit-accessibility-CYclfhtC.js","assets/vendor-dnd-kit-sortable-DpfLEOLv.js","assets/vendor-tanstack-react-virtual-CqfECoM0.js","assets/vendor-tanstack-virtual-core-BdFnkr_2.js","assets/vendor-framer-motion-C_wK4GIM.js","assets/vendor-motion-dom-HXPOMxb7.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-codemirror-commands-CjjsURR-.js","assets/vendor-codemirror-state-Cd8udR5z.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-Ciie9ey-.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-codemirror-language-8HZTPOnt.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CZEcqU6G.js","assets/vendor-codemirror-streamparser-CmlTsbN2.js","assets/vendor-codemirror-lang-javascript-DmqaSK_j.js","assets/vendor-lezer-javascript-CWSwshuO.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BGedy2gC.js","assets/vendor-codemirror-lang-json-DVAYKmoO.js","assets/vendor-lezer-json-Cn1mncjr.js","assets/vendor-codemirror-lang-css-BLpgXfL2.js","assets/vendor-lezer-css-B2Hx_Nps.js","assets/vendor-codemirror-lang-html-S3jxr3Mo.js","assets/vendor-lezer-html-Cr8K5DGw.js","assets/vendor-codemirror-lang-markdown-D1jveRI5.js","assets/vendor-lezer-markdown-TQKzBB8i.js","assets/vendor-codemirror-language-data-BJfFTbvV.js","assets/vendor-codemirror-lang-python-B-5UC9Ui.js","assets/vendor-lezer-python-BUoImtUb.js","assets/vendor-sonner-Dw26OnzC.js","assets/vendor-cmdk-BtSpU-Io.js","assets/vendor-radix-ui-react-dialog-OIW6VLWw.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D4RvEbuR.js","assets/vendor-radix-ui-react-context-BbFoxCHu.js","assets/vendor-radix-ui-react-id-aGag8i_5.js","assets/vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js","assets/vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js","assets/vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js","assets/vendor-radix-ui-react-primitive-CrN9dRDb.js","assets/vendor-radix-ui-react-slot-BjbalUfz.js","assets/vendor-radix-ui-react-use-callback-ref-CcC_buIU.js","assets/vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js","assets/vendor-radix-ui-react-focus-scope-D1noLHmd.js","assets/vendor-radix-ui-react-portal-BlUEzfrF.js","assets/vendor-radix-ui-react-presence-BGqFfiW4.js","assets/vendor-radix-ui-react-focus-guards-CSS2IbZC.js","assets/vendor-react-remove-scroll-Der_cv-1.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-Clwl9llp.js","assets/vendor-react-style-singleton-D_xJlTqU.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-BdLl6ZIw.js","assets/vendor-use-callback-ref-CXJF1lEr.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-legendapp-list-wfKYGEOv.js","assets/vendor-class-variance-authority-5VPnzWs2.js"])))=>i.map(i=>d[i]);
2
+ import{f as F,R,r as we,j as i}from"./vendor-react--VO_rL_p.js";import{u as O,bq as ge,br as xe,bs as be,bg as $,bt as Se,bu as ee,bv as ve,bw as ae,aK as _e,aI as te}from"./katex.min-B7gF3rmE.js";import{u as J,Q as G,I as A,a3 as ye,a4 as je,a2 as Ne,$ as q,fI as Ce,fJ as Ie,n as Ee,fK as Le,fL as ke,au as De,fM as Re,cm as ze,cj as Ae,b7 as Te,x as ne,fN as se,fO as Fe,fP as Pe,fQ as $e,fR as Oe,fi as Ge,fS as Me,X as le,fT as He}from"./useAppFontEffects-6HvTeJY2.js";import{M as ce}from"./vendor-base-ui-zhBy6TEG.js";import{o as oe,a as We,f as Ve,s as Be}from"./vendor-zod-Csf1sqWl.js";import{_ as de}from"./vendor-vite-runtime-DD1OZmLC.js";function Ft(){const n=F.c(5),e=O(Ue);let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t=ge(),n[0]=t):t=n[0];const a=t;let s;n[1]!==e?(s=xe(e),n[1]=e,n[2]=s):s=n[2];const r=s;let o;return n[3]!==r?(o={usesFramelessChrome:a,side:r},n[3]=r,n[4]=o):o=n[4],o}function Ue(n){return n.desktopWindowControlsPosition}const Ze={close:"#FF5F57",minimize:"#FEBC2E",maximize:"#28C940"},Ye="rgba(0, 0, 0, 0.7)",qe=n=>{const e=F.c(3),{action:t}=n;if(t==="close"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx(A,{name:"close",className:"size-[10px]"}),e[0]=s):s=e[0],s}if(t==="minimize"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx(A,{name:"subtract",className:"size-[10px]"}),e[1]=s):s=e[1],s}let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(A,{name:"add",className:"size-[10px]"}),e[2]=a):a=e[2],a},Ke=n=>{const e=F.c(18),{action:t,isMaximized:a,onActivate:s}=n,{t:r}=J(),o=Ze[t];let c;e[0]!==t||e[1]!==a||e[2]!==r?(c=r(t==="close"?"header.windowControls.close":t==="minimize"?"header.windowControls.minimize":a?"header.windowControls.restore":"header.windowControls.maximize"),e[0]=t,e[1]=a,e[2]=r,e[3]=c):c=e[3];const u=c;let d;e[4]!==t||e[5]!==s?(d=()=>s(t),e[4]=t,e[5]=s,e[6]=d):d=e[6];let l;e[7]!==o?(l={backgroundColor:o,color:Ye},e[7]=o,e[8]=l):l=e[8];let m;e[9]!==t?(m=i.jsx("span",{className:"flex items-center justify-center opacity-0 transition-opacity duration-75 group-hover/wctl:opacity-100",children:i.jsx(qe,{action:t})}),e[9]=t,e[10]=m):m=e[10];let h;e[11]!==l||e[12]!==m?(h=i.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:l,children:m}),e[11]=l,e[12]=m,e[13]=h):h=e[13];let p;return e[14]!==u||e[15]!==d||e[16]!==h?(p=i.jsx("button",{type:"button",onClick:d,title:u,"aria-label":u,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:h}),e[14]=u,e[15]=d,e[16]=h,e[17]=p):p=e[17],p},Pt=R.memo(function(e){const t=F.c(27),{visible:a,position:s}=e,r=s===void 0?"right":s,{t:o}=J(),[c,u]=R.useState(!1),d=O(Je);let l,m;if(t[0]!==a?(l=()=>{if(!a)return;let N=!1;$("desktop_get_current_window_state").then(_=>{N||u(!!_?.maximized)}).catch(Qe);const C=_=>{const y=_.detail;u(!!y?.maximized)};return window.addEventListener("openchamber:window-maximized-changed",C),()=>{N=!0,window.removeEventListener("openchamber:window-maximized-changed",C)}},m=[a],t[0]=a,t[1]=l,t[2]=m):(l=t[1],m=t[2]),we.useEffect(l,m),!a)return null;const h=r==="left";let p,f,w,g,S;if(t[3]!==d||t[4]!==h||t[5]!==c||t[6]!==r||t[7]!==o){S=Symbol.for("react.early_return_sentinel");e:{const N=be(r);let C;t[13]===Symbol.for("react.memo_cache_sentinel")?(C=x=>{if(x==="close"){$("desktop_close_current_window");return}if(x==="minimize"){$("desktop_minimize_current_window");return}$("desktop_toggle_current_window_maximized").then(v=>u(!!v?.maximized)).catch(Xe)},t[13]=C):C=t[13];const _=C;if(d==="traffic-lights"){const x=h?"me-1":"ms-1 me-3";let v;t[14]!==x?(v=G("app-region-no-drag group/wctl flex h-8 shrink-0 items-center",x),t[14]=x,t[15]=v):v=t[15];let I;t[16]!==o?(I=o("header.windowControls.groupAria"),t[16]=o,t[17]=I):I=t[17];let E;t[18]!==c?(E=T=>i.jsx(Ke,{action:T,isMaximized:c,onActivate:_},T),t[18]=c,t[19]=E):E=t[19],S=i.jsx("div",{dir:"ltr",className:v,"aria-label":I,children:N.map(E)});break e}const y=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",h?"h-8 w-8 rounded-md":"h-12 w-11"),k=h?"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",D=x=>x==="minimize"?i.jsx("button",{type:"button",className:y,onClick:et,title:o("header.windowControls.minimize"),"aria-label":o("header.windowControls.minimize"),children:i.jsx(A,{name:"subtract",className:"h-4 w-4"})},"minimize"):x==="maximize"?i.jsx("button",{type:"button",className:y,onClick:()=>{$("desktop_toggle_current_window_maximized").then(v=>u(!!v?.maximized)).catch(tt)},title:o(c?"header.windowControls.restore":"header.windowControls.maximize"),"aria-label":o(c?"header.windowControls.restore":"header.windowControls.maximize"),children:i.jsx(A,{name:c?"fullscreen-exit":"checkbox-blank",className:"h-3.5 w-3.5"})},"maximize"):i.jsx("button",{type:"button",className:G(y,"hover:bg-[var(--status-error)] hover:text-[var(--status-error-foreground)]"),onClick:nt,title:o("header.windowControls.close"),"aria-label":o("header.windowControls.close"),children:i.jsx(A,{name:"close",className:"h-4 w-4"})},"close");p="ltr",f=k,t[20]!==o?(w=o("header.windowControls.groupAria"),t[20]=o,t[21]=w):w=t[21],g=N.map(D)}t[3]=d,t[4]=h,t[5]=c,t[6]=r,t[7]=o,t[8]=p,t[9]=f,t[10]=w,t[11]=g,t[12]=S}else p=t[8],f=t[9],w=t[10],g=t[11],S=t[12];if(S!==Symbol.for("react.early_return_sentinel"))return S;let b;return t[22]!==p||t[23]!==f||t[24]!==w||t[25]!==g?(b=i.jsx("div",{dir:p,className:f,"aria-label":w,children:g}),t[22]=p,t[23]=f,t[24]=w,t[25]=g,t[26]=b):b=t[26],b});function Je(n){return n.desktopWindowControlsStyle}function Qe(){}function Xe(){}function et(){$("desktop_minimize_current_window")}function tt(){}function nt(){$("desktop_close_current_window")}const X="new-session";function $t(n){const e=F.c(18),{children:t,variant:a,scopeProjectId:s,align:r}=n,o=a===void 0?"default":a,c=s===void 0?null:s,u=r===void 0?"start":r,d=O(ot),l=O(st);let m;e[0]!==t?(m=i.jsx(ye,{asChild:!0,children:t}),e[0]=t,e[1]=m):m=e[1];const h=o==="compact"?"w-[280px]":"w-[360px]";let p;e[2]!==h?(p=G("overflow-hidden p-1 max-w-[calc(100vw-32px)]",h),e[2]=h,e[3]=p):p=e[3];let f;e[4]!==d||e[5]!==c||e[6]!==l||e[7]!==o?(f=d?i.jsx(it,{onSelect:()=>l(!1),variant:o,scopeProjectId:c}):null,e[4]=d,e[5]=c,e[6]=l,e[7]=o,e[8]=f):f=e[8];let w;e[9]!==u||e[10]!==p||e[11]!==f?(w=i.jsx(je,{align:u,sideOffset:6,className:p,children:f}),e[9]=u,e[10]=p,e[11]=f,e[12]=w):w=e[12];let g;return e[13]!==d||e[14]!==l||e[15]!==m||e[16]!==w?(g=i.jsxs(Ne,{open:d,onOpenChange:l,modal:!1,disableGlobalShortcuts:!0,children:[m,w]}),e[13]=d,e[14]=l,e[15]=m,e[16]=w,e[17]=g):g=e[17],g}function st(n){return n.setSessionDropdownOpen}function ot(n){return n.isSessionDropdownOpen}function it(n){const e=F.c(31),{onSelect:t,variant:a,scopeProjectId:s}=n,r=q(lt),o=q(at);let c;e[0]!==r||e[1]!==s?(c={scopeProjectId:s,currentSessionId:r},e[0]=r,e[1]=s,e[2]=c):c=e[2];const u=Ce(!0,c),d=q(rt),{t:l}=J();let m;e[3]!==t||e[4]!==d?(m=()=>{t(),d()},e[3]=t,e[4]=d,e[5]=m):m=e[5];const h=m;let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[6]=p):p=e[6];const[f,w]=R.useState(p),g=R.useRef(null),S=R.useRef(!1),b=o?X:r;let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=j=>{w(Y=>{const L=new Set(Y);return L.has(j)?L.delete(j):L.add(j),L})},e[7]=N):N=e[7];const C=N;let _,y;e[8]!==f||e[9]!==b||e[10]!==u?(_=()=>{if(S.current||!b)return;const j=b===X?[]:Ie(u,b);if(!j)return;if(j.some(L=>!f.has(L))){w(L=>new Set([...L,...j]));return}const Y=requestAnimationFrame(()=>{const L=Array.from(g.current?.querySelectorAll("[data-switcher-item-id]")??[]).find(P=>P.dataset.switcherItemId===b);L&&(L.focus(),L.scrollIntoView({block:"nearest"}),S.current=!0)});return()=>cancelAnimationFrame(Y)},y=[f,b,u],e[8]=f,e[9]=b,e[10]=u,e[11]=_,e[12]=y):(_=e[11],y=e[12]),R.useLayoutEffect(_,y);let k,D;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=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"),D=i.jsx(A,{name:"chat-new",className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),e[13]=k,e[14]=D):(k=e[13],D=e[14]);let x;e[15]!==l?(x=l("sessions.sidebar.header.actions.newSession"),e[15]=l,e[16]=x):x=e[16];let v;e[17]!==x?(v=i.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:x}),e[17]=x,e[18]=v):v=e[18];let I;e[19]!==h||e[20]!==v?(I=i.jsxs(ce,{"data-switcher-item-id":X,onClick:h,className:k,children:[D,v]}),e[19]=h,e[20]=v,e[21]=I):I=e[21];let E;e[22]!==f||e[23]!==u||e[24]!==t||e[25]!==l||e[26]!==a?(E=u.length===0?i.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:l("sessions.switcher.empty")}):u.map(j=>i.jsx(ue,{item:j,depth:0,variant:a,expandedParents:f,toggleParent:C,closeDropdown:t},j.node.session.id)),e[22]=f,e[23]=u,e[24]=t,e[25]=l,e[26]=a,e[27]=E):E=e[27];let T;return e[28]!==I||e[29]!==E?(T=i.jsx(Ee,{ref:g,outerClassName:"max-h-[60vh]",disableHorizontal:!0,children:i.jsxs("div",{className:"space-y-0.5",children:[I,E]})}),e[28]=I,e[29]=E,e[30]=T):T=e[30],T}function rt(n){return n.openNewSessionDraft}function at(n){return n.newSessionDraft.open===!0}function lt(n){return n.currentSessionId}function ue(n){const e=F.c(31),{item:t,depth:a,variant:s,expandedParents:r,toggleParent:o,closeDropdown:c}=n,{node:u,secondaryMeta:d}=t,l=u.session,m=u.children.length>0;let h;e[0]!==r||e[1]!==l.id?(h=r.has(l.id),e[0]=r,e[1]=l.id,e[2]=h):h=e[2];const p=h;let f;e[3]!==m||e[4]!==l.id||e[5]!==o?(f=m?()=>o(l.id):void 0,e[3]=m,e[4]=l.id,e[5]=o,e[6]=f):f=e[6];let w;e[7]!==c||e[8]!==a||e[9]!==m||e[10]!==p||e[11]!==d||e[12]!==l||e[13]!==f||e[14]!==s?(w=i.jsx(ct,{session:l,depth:a,variant:s,secondaryMeta:d,hasChildren:m,isExpanded:p,onToggleExpand:f,closeDropdown:c}),e[7]=c,e[8]=a,e[9]=m,e[10]=p,e[11]=d,e[12]=l,e[13]=f,e[14]=s,e[15]=w):w=e[15];let g;e[16]!==c||e[17]!==a||e[18]!==r||e[19]!==m||e[20]!==p||e[21]!==t.groupDirectory||e[22]!==t.projectId||e[23]!==u.children||e[24]!==d||e[25]!==o||e[26]!==s?(g=m&&p?u.children.map(b=>i.jsx(ue,{item:{node:b,projectId:t.projectId,groupDirectory:t.groupDirectory,secondaryMeta:d},depth:a+1,variant:s,expandedParents:r,toggleParent:o,closeDropdown:c},b.session.id)):null,e[16]=c,e[17]=a,e[18]=r,e[19]=m,e[20]=p,e[21]=t.groupDirectory,e[22]=t.projectId,e[23]=u.children,e[24]=d,e[25]=o,e[26]=s,e[27]=g):g=e[27];let S;return e[28]!==w||e[29]!==g?(S=i.jsxs(i.Fragment,{children:[w,g]}),e[28]=w,e[29]=g,e[30]=S):S=e[30],S}function ct(n){const e=F.c(55),{session:t,depth:a,variant:s,secondaryMeta:r,hasChildren:o,isExpanded:c,onToggleExpand:u,closeDropdown:d}=n,{t:l}=J(),m=q(ut),h=q(dt),p=Le(t.id),f=m===t.id;let w;e[0]!==t.title||e[1]!==l?(w=t.title?.trim()||l("sessions.sidebar.session.untitled"),e[0]=t.title,e[1]=l,e[2]=w):w=e[2];const g=w,S=ke(t.id),b=S!==null,N=De(b),C=!b&&p&&!f;let _;if(e[3]!==t){const z=Re(t)||Date.now();_=ze(z),e[3]=t,e[4]=_}else _=e[4];const y=_;let k;e[5]!==r?.projectLabel?(k=r?.projectLabel?.trim()||null,e[5]=r?.projectLabel,e[6]=k):k=e[6];const D=k;let x;e[7]!==r?.branchLabel?(x=r?.branchLabel?.trim()||null,e[7]=r?.branchLabel,e[8]=x):x=e[8];const v=x,I=v&&v!=="HEAD"?v:null;let E;e[9]!==d||e[10]!==f||e[11]!==t||e[12]!==h?(E=()=>{if(f){d();return}const z=Te(t);h(t.id,z??null),d()},e[9]=d,e[10]=f,e[11]=t,e[12]=h,e[13]=E):E=e[13];const T=E;let j;e[14]!==T?(j=z=>{if(z.target?.closest("[data-switcher-expand]")){z.preventDefault();return}T()},e[14]=T,e[15]=j):j=e[15];const Y=t.id,L=f&&"bg-interactive-selection text-interactive-selection-foreground hover:bg-interactive-selection data-[highlighted]:bg-interactive-selection";let P;e[16]!==L?(P=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",L),e[16]=L,e[17]=P):P=e[17];const Q=8+a*12;let M;e[18]!==Q?(M={paddingInlineStart:Q},e[18]=Q,e[19]=M):M=e[19];let H;e[20]!==o||e[21]!==c||e[22]!==u||e[23]!==l||e[24]!==s?(H=s==="compact"&&o?i.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:z=>{z.preventDefault(),z.stopPropagation(),u?.()},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":l(c?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:c?i.jsx(A,{name:"arrow-down-s",className:"h-3.5 w-3.5"}):i.jsx(A,{name:"arrow-right-s",className:"h-3.5 w-3.5"})}):null,e[20]=o,e[21]=c,e[22]=u,e[23]=l,e[24]=s,e[25]=H):H=e[25];let W;e[26]!==g?(W=i.jsx("span",{dir:"auto",className:"truncate oc-ui-start-align typography-ui-label font-normal leading-tight text-foreground",children:g}),e[26]=g,e[27]=W):W=e[27];let V;e[28]!==H||e[29]!==W?(V=i.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[H,W]}),e[28]=H,e[29]=W,e[30]=V):V=e[30];let B;e[31]!==I||e[32]!==o||e[33]!==c||e[34]!==u||e[35]!==D||e[36]!==l||e[37]!==y||e[38]!==s?(B=s==="default"?i.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:[o?i.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:z=>{z.preventDefault(),z.stopPropagation(),u?.()},className:"inline-flex h-3 w-3 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground","aria-label":l(c?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:c?i.jsx(A,{name:"arrow-down-s",className:"h-3 w-3"}):i.jsx(A,{name:"arrow-right-s",className:"h-3 w-3"})}):null,i.jsx("span",{className:"flex-shrink-0",children:y}),D?i.jsx("span",{className:"truncate",children:D}):null,I?i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[i.jsx(A,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),i.jsx("span",{className:"truncate",children:I})]}):null]}):null,e[31]=I,e[32]=o,e[33]=c,e[34]=u,e[35]=D,e[36]=l,e[37]=y,e[38]=s,e[39]=B):B=e[39];let U;e[40]!==V||e[41]!==B?(U=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[V,B]}),e[40]=V,e[41]=B,e[42]=U):U=e[42];let Z;e[43]!==b||e[44]!==N||e[45]!==C||e[46]!==S?(Z=b||C?i.jsx("span",{className:"flex h-3 w-3 flex-shrink-0 items-center justify-center self-center",children:i.jsx(Ae,{state:S??"unread",runningClassName:G("h-2 w-2",N)})}):null,e[43]=b,e[44]=N,e[45]=C,e[46]=S,e[47]=Z):Z=e[47];let K;return e[48]!==t.id||e[49]!==M||e[50]!==U||e[51]!==Z||e[52]!==j||e[53]!==P?(K=i.jsxs(ce,{onClick:j,"data-slot":"session-switcher-item","data-switcher-item-id":Y,className:P,style:M,children:[U,Z]}),e[48]=t.id,e[49]=M,e[50]=U,e[51]=Z,e[52]=j,e[53]=P,e[54]=K):K=e[54],K}function dt(n){return n.setCurrentSession}function ut(n){return n.currentSessionId}const Ot=n=>!Number.isFinite(n)||n<=0?new Intl.NumberFormat(ne(),{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(0):new Intl.NumberFormat(ne(),{style:"currency",currency:"USD",minimumFractionDigits:n<.01?4:2,maximumFractionDigits:n<.01?4:2}).format(n),mt="ui-store",ft=oe({state:oe({contextSurfaceZones:We(Be(),Ve())})}),pt=n=>{if(!n)return null;let e;try{e=JSON.parse(n)}catch{return null}const t=ft.safeParse(e);return t.success?ve.parse(t.data.state.contextSurfaceZones):null},Gt=()=>{const n=e=>{if(e.key!==mt)return;const t=pt(e.newValue);if(!t)return;const a=O.getState().contextSurfaceZones,s=new Set([...Object.keys(a),...Object.keys(t)].filter(Se));for(const r of s){const o=ee(t,r);o!==ee(O.getState().contextSurfaceZones,r)&&O.getState().moveContextSurfaceToZone(r,o)}};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)},ht=R.lazy(()=>de(()=>import("./useAppFontEffects-6HvTeJY2.js").then(n=>n.sg),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.GuestAttachDialog}))),me=R.lazy(()=>de(()=>import("./useAppFontEffects-6HvTeJY2.js").then(n=>n.sf),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.PluginPane}))),Mt=()=>{const n=F.c(11),e=se(wt),t=se(gt),a=Fe(xt),s=Pe(bt);let r;n[0]!==s?(r=s.map(St),n[0]=s,n[1]=r):r=n[1];let o;n[2]!==t||n[3]!==e?(o=e?i.jsx(R.Suspense,{fallback:null,children:i.jsx(ht,{guestId:e.guestId,item:e.item,onOpenChange:d=>{d||t()}})}):null,n[2]=t,n[3]=e,n[4]=o):o=n[4];let c;n[5]!==a?(c=a?i.jsx("div",{"aria-hidden":"true",className:"pointer-events-none fixed top-0 -inset-s-[9999px] h-px w-px overflow-hidden",children:i.jsx(R.Suspense,{fallback:null,children:i.jsx(me,{mode:ae(a),surface:"panel",headless:!0})})}):null,n[5]=a,n[6]=c):c=n[6];let u;return n[7]!==r||n[8]!==o||n[9]!==c?(u=i.jsxs(i.Fragment,{children:[r,o,c]}),n[7]=r,n[8]=o,n[9]=c,n[10]=u):u=n[10],u};function wt(n){return n.request}function gt(n){return n.close}function xt(n){return n.guestId}function bt(n){return n.requests}function St(n){return i.jsx("div",{"aria-hidden":"true",inert:!0,className:"pointer-events-none fixed top-0 -inset-s-[9999px] h-px w-px overflow-hidden",children:i.jsx(R.Suspense,{fallback:null,children:i.jsx(me,{mode:ae(n.guestId),surface:"background",headless:!0,backgroundAction:n})})},n.id)}const ie=45e3,re=10*6e4,vt=[1e3,2e3,4e3],fe={isHidden:()=>!1,onVisible:()=>()=>{}},_t=()=>()=>{},yt=()=>typeof document>"u"?fe:{isHidden:()=>document.visibilityState==="hidden",onVisible:n=>{let e=document.visibilityState==="hidden";const t=()=>{const s=document.visibilityState==="hidden";e&&!s&&n(),e=s},a=()=>{e&&document.visibilityState!=="hidden"&&t()};return document.addEventListener("visibilitychange",t),window.addEventListener("focus",a),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("focus",a)}}},jt=(n,e,t=window.setTimeout.bind(window),a=window.clearTimeout.bind(window),s=fe,r=_t,o=e,c=Date.now)=>{let u=!1,d,l=0,m=!1,h=!1,p=!1,f=!1,w=Number.NEGATIVE_INFINITY;const g=async(N,C=!0)=>{h=!0,p=!1;const _=await N().catch(()=>!1);if(h=!1,u)return;if(m||=_,C&&_&&(w=c()),f){f=!1,g(e);return}if(!m&&p){g(e);return}const y=m?void 0:vt[l];y!==void 0&&(l+=1);const k=re-(c()-w),D=k>0?Math.min(ie,k):C?ie:0;d=t(()=>{if(d=void 0,s.isHidden())return;const x=!m||c()-w>=re;g(x?e:o,x)},y??D)},S=s.onVisible(()=>{if(!u){if(d!==void 0&&a(d),d=void 0,h){f=!0;return}g(e)}}),b=r(()=>{if(!(u||m)){if(h){p=!0;return}d!==void 0&&a(d),d=void 0,g(e)}});return g(n),()=>{u=!0,S(),b(),d!==void 0&&a(d)}},Ht=n=>{const e=F.c(3);let t,a;e[0]!==n?(t=()=>{const s=Ct;let r=s();const o=_e(()=>{r(),r=s()});return()=>{o(),r()}},a=[n],e[0]=n,e[1]=t,e[2]=a):(t=e[1],a=e[2]),R.useEffect(t,a)};function Nt(){return le.getState().refreshSessionHead()}function Ct(){const n=te();let e=!0;const t=async s=>(s?await $e(Oe()):await Ge(),!e||te()!==n?!1:(Me(),le.getState().status==="ready")),a=jt(()=>t(!0),()=>t(!1),window.setTimeout.bind(window),window.clearTimeout.bind(window),yt(),s=>He(r=>{r===n&&s()}),Nt);return()=>{e=!1,a()}}const pe=()=>{const n=[document.documentElement,document.body],e=document.getElementById("root");return e&&n.push(e),n},he=()=>{let n=!1;for(const e of pe())e.scrollTop!==0&&(e.scrollTop=0,n=!0),e.scrollLeft!==0&&(e.scrollLeft=0,n=!0);return n},It=n=>n===document||pe().some(e=>e===n),Wt=()=>{const n=F.c(1);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],n[0]=e):e=n[0],R.useEffect(Lt,e)};function Et(n){It(n.target)&&he()}function Lt(){const n=Et;return document.addEventListener("scroll",n,{capture:!0,passive:!0}),he(),()=>document.removeEventListener("scroll",n,{capture:!0})}export{Mt as G,$t as S,Pt as W,Gt as a,Wt as b,Ht as c,Ot as f,Ft as u};