@openchamber/web 1.24.0 → 1.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.test.js +29 -6
- package/bin/lib/cli-http.js +5 -1
- package/bin/lib/commands-status.js +5 -0
- package/dist/assets/{CodeMirrorCommentWidgets-C9kV-n7r.js → CodeMirrorCommentWidgets-B_vBPQYm.js} +1 -1
- package/dist/assets/DiffView-Ce0oBXXQ.js +4 -0
- package/dist/assets/{FilesView-vjJx7VaM.js → FilesView-DtXueAWP.js} +6 -6
- package/dist/assets/GitView-k0hUF8KB.js +6 -0
- package/dist/assets/GuestAttachDialog-DIf2U85Z.js +1 -0
- package/dist/assets/{JsonTreeView-D_4G5X6-.js → JsonTreeView-4AnJ04Pw.js} +1 -1
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/{LinearIssuesView-1uKhePfH.js → LinearIssuesView-z_9p2GuO.js} +1 -1
- package/dist/assets/{MarkdownImageGallery-Ix7N_2wp.js → MarkdownImageGallery-BC-BNN-s.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-Deel_y5S.js → MarkdownRendererImpl-DyaBTUbH.js} +6 -6
- package/dist/assets/{OnboardingScreen-ToIakxb_.js → OnboardingScreen-DKU_yTb6.js} +1 -1
- package/dist/assets/{PatchDiff-BjMgezr1.js → PatchDiff-DpGmHRnV.js} +1 -1
- package/dist/assets/PierreDiffViewer-CgLl_tp7.js +210 -0
- package/dist/assets/{PlanView-BGAzxDwD.js → PlanView-CrfB4qqY.js} +4 -4
- package/dist/assets/PluginPane-B5cn-jPy.js +3 -0
- package/dist/assets/SettingsView-DMKKwezx.js +29 -0
- package/dist/assets/SettingsWindow-DwbnVzOC.js +1 -0
- package/dist/assets/{SubmoduleDiffSummary--YFqK6Ih.js → SubmoduleDiffSummary-hkGcvs0E.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DRWBvdaJ.js → ToolOutputDialog-DuoIOc0j.js} +6 -6
- package/dist/assets/{ToolPartDiffPreview-BxZJCU28.js → ToolPartDiffPreview-t1Bvq_2Y.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-DCXjBGRf.js → VirtualizedFileDiff-BK4aU5qJ.js} +1 -1
- package/dist/assets/{WalkthroughView-CfIPvWWa.js → WalkthroughView-Bk6TPNFw.js} +2 -2
- package/dist/assets/{appThemeRegistry-DDROzcUO.js → appThemeRegistry-DnOVbJjF.js} +1 -1
- package/dist/assets/commitAndPush-DLWNZkkY.js +1 -0
- package/dist/assets/{computeVirtualFileMetrics-DHgQIkUq.js → computeVirtualFileMetrics-BVTujWSX.js} +1 -1
- package/dist/assets/{de-CX_f-T5U.js → de-zEHaAIi3.js} +4 -4
- package/dist/assets/{es-BERmWNn_.js → es-CBDgEzgk.js} +4 -4
- package/dist/assets/{fr-BjYYE_-z.js → fr-DjiTptT_.js} +4 -4
- package/dist/assets/index-AgOdanig.css +1 -0
- package/dist/assets/index-B-2_X4DD.js +40 -0
- package/dist/assets/{index-WjufPkIV.js → index-CkA4p2IK.js} +1 -1
- package/dist/assets/{isDiffPlainText-D9faP70y.js → isDiffPlainText-D3yX_vx4.js} +1 -1
- package/dist/assets/{isFilePlainText-6qOcz5Ky.js → isFilePlainText-CZR9TcHV.js} +1 -1
- package/dist/assets/ja-CerMgj3r.js +16 -0
- package/dist/assets/{ko-Dty1aUod.js → ko-DHYDAze5.js} +4 -4
- package/dist/assets/main-BDka4W43.js +896 -0
- package/dist/assets/main-Dl7Dyge_.js +2 -0
- package/dist/assets/markdownCore-DFmr0rUR.js +5 -0
- package/dist/assets/miniChat-CLKQPPpO.js +2 -0
- package/dist/assets/mobile--giD2Q1L.js +2 -0
- package/dist/assets/{patchFileDiff-BvU6KOQC.js → patchFileDiff-DRh-AQvd.js} +1 -1
- package/dist/assets/{pl-CX-_ROkr.js → pl-BTB_93bq.js} +6 -6
- package/dist/assets/{pt-BR-DhRR1arx.js → pt-BR-BwA3oyCK.js} +4 -4
- package/dist/assets/renderElectronMiniChatApp-DmB7zpVK.js +2 -0
- package/dist/assets/renderMobileApp-pMfOuQfl.js +25 -0
- package/dist/assets/runtimeEndpointReset-Gqhmkm3U.js +25 -0
- package/dist/assets/{scheduledTasksApi-DW3xqMQ8.js → scheduledTasksApi-CeRAIUmW.js} +1 -1
- package/dist/assets/{shikiHighlight-DsxD9QEa.js → shikiHighlight-BfjuB3CD.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-Da7ed8qM.js → textMateThemeFromAppTheme-BP60t9SX.js} +1 -1
- package/dist/assets/tr-CcPsJoNM.js +7 -0
- package/dist/assets/{uk-CD21CXFV.js → uk-B68WibXi.js} +4 -4
- package/dist/assets/{useAppFontEffects-hfv2s6mZ.js → useAppFontEffects-DcdrFv2Z.js} +147 -147
- package/dist/assets/{useInlineCommentController-BmtfVbo8.js → useInlineCommentController-Cq4SUjsA.js} +2 -2
- package/dist/assets/useRootScrollLock-CSdR6Wnm.js +2 -0
- package/dist/assets/{vendor-codemirror-language-data-BPMJpOpT.js → vendor-codemirror-language-data-BFm1Ju2w.js} +2 -2
- package/dist/assets/vendor-katex-Cp579UoJ.css +1 -0
- package/dist/assets/{vendor-tanstack-react-virtual-g05Cx3z9.js → vendor-tanstack-react-virtual-ClYN8CzB.js} +1 -1
- package/dist/assets/{vendor-tanstack-virtual-core-Dubg10g5.js → vendor-tanstack-virtual-core-BewVQryB.js} +1 -1
- package/dist/assets/{vendor-zod-fZppILAM.js → vendor-zod-CgAdXWZO.js} +4 -4
- package/dist/assets/{web-components-U-hWbgJo.js → web-components-2vo9YsZc.js} +1 -1
- package/dist/assets/zh-CN-DbFHYXwP.js +16 -0
- package/dist/assets/{zh-TW-CRp5dJU2.js → zh-TW-DmXAwdty.js} +4 -4
- package/dist/index.html +6 -4
- package/dist/mini-chat.html +6 -4
- package/dist/mobile.html +6 -4
- package/package.json +6 -5
- package/server/index.js +29 -7
- package/server/lib/agent-tool/DOCUMENTATION.md +17 -4
- package/server/lib/agent-tool/runtime.js +62 -15
- package/server/lib/agent-tool/runtime.test.js +88 -2
- package/server/lib/changelog/update-notes.js +2 -1
- package/server/lib/changelog/update-notes.test.js +19 -0
- package/server/lib/event-stream/DOCUMENTATION.md +23 -0
- package/server/lib/event-stream/delta-coalescer.js +0 -0
- package/server/lib/event-stream/delta-coalescer.test.js +292 -0
- package/server/lib/event-stream/global-hub.js +53 -23
- package/server/lib/event-stream/global-hub.test.js +160 -0
- package/server/lib/event-stream/global-ws-bridge.js +1 -0
- package/server/lib/event-stream/index.js +4 -0
- package/server/lib/fs/DOCUMENTATION.md +2 -1
- package/server/lib/fs/routes.js +56 -4
- package/server/lib/fs/routes.test.js +116 -0
- package/server/lib/git/DOCUMENTATION.md +18 -5
- package/server/lib/git/routes.js +1 -1
- package/server/lib/git/serial-refresh.js +93 -0
- package/server/lib/git/serial-refresh.test.js +112 -0
- package/server/lib/git/service.js +325 -70
- package/server/lib/git/service.test.js +291 -0
- package/server/lib/github/pr-status.js +5 -5
- package/server/lib/github/pr-status.test.js +1 -1
- package/server/lib/github/routes.js +4 -4
- package/server/lib/guests/DOCUMENTATION.md +5 -3
- package/server/lib/guests/background.test.js +83 -0
- package/server/lib/guests/catalog.js +20 -9
- package/server/lib/guests/catalog.test.js +5 -5
- package/server/lib/guests/routes.js +2 -2
- package/server/lib/message-queue/DOCUMENTATION.md +10 -1
- package/server/lib/message-queue/runtime.js +21 -1
- package/server/lib/message-queue/runtime.test.js +52 -5
- package/server/lib/notifications/routes.js +5 -0
- package/server/lib/openchamber-sessions/routes.js +18 -18
- package/server/lib/openchamber-sessions/routes.test.js +49 -0
- package/server/lib/opencode/DOCUMENTATION.md +1 -1
- package/server/lib/opencode/bootstrap-runtime.js +1 -0
- package/server/lib/opencode/feature-routes-runtime.js +5 -0
- package/server/lib/opencode/session-runtime.js +68 -0
- package/server/lib/opencode/session-runtime.test.js +43 -0
- package/server/lib/opencode/settings-helpers.js +3 -0
- package/server/lib/opencode/settings-registry.json +8 -0
- package/server/lib/permission-auto-accept/DOCUMENTATION.md +8 -0
- package/server/lib/permission-auto-accept/runtime.js +13 -0
- package/server/lib/permission-auto-accept/runtime.test.js +37 -1
- package/server/lib/projects/project-config.js +2 -2
- package/server/lib/realtime-proxy-terminal.test.js +150 -0
- package/server/lib/realtime-proxy.js +2 -0
- package/server/lib/routing/DOCUMENTATION.md +83 -0
- package/server/lib/routing/defaults.js +98 -0
- package/server/lib/routing/feature-flag.js +11 -0
- package/server/lib/routing/history.js +34 -0
- package/server/lib/routing/jev.js +98 -0
- package/server/lib/routing/routes.http.test.js +100 -0
- package/server/lib/routing/routes.js +81 -0
- package/server/lib/routing/runtime.js +217 -0
- package/server/lib/routing/runtime.test.js +188 -0
- package/server/lib/routing/store.js +249 -0
- package/server/lib/routing/store.test.js +96 -0
- package/server/lib/scheduled-tasks/runtime.js +2 -2
- package/server/lib/scheduled-tasks/runtime.test.js +14 -0
- package/server/lib/security/request-security.js +9 -5
- package/server/lib/security/request-security.test.js +37 -0
- package/server/lib/small-model/DOCUMENTATION.md +14 -2
- package/server/lib/small-model/call.js +37 -6
- package/server/lib/small-model/call.test.js +182 -0
- package/server/lib/terminal/DOCUMENTATION.md +21 -2
- package/server/lib/terminal/runtime.js +10 -3
- package/server/lib/terminal/runtime.test.js +22 -0
- package/server/lib/terminal/shutdown.js +106 -0
- package/server/lib/terminal/shutdown.test.js +84 -0
- package/server/lib/tts/service.test.js +78 -0
- package/server/lib/ui-auth/DOCUMENTATION.md +8 -0
- package/server/lib/ui-auth/session-cookie.js +51 -0
- package/server/lib/ui-auth/session-cookie.test.js +46 -0
- package/server/lib/ui-auth/ui-auth.js +13 -9
- package/server/lib/ui-auth/ui-auth.test.js +56 -0
- package/dist/assets/DiffView-B7YkbY-u.js +0 -4
- package/dist/assets/DirtyBranchSwitchDialog-CU0A93Zx.js +0 -1
- package/dist/assets/GitView-BLhlMYEY.js +0 -6
- package/dist/assets/GuestAttachDialog-B-fwE8r3.js +0 -3
- package/dist/assets/PierreDiffViewer-53Ghfnlr.js +0 -161
- package/dist/assets/SettingsView-n2X-jfBB.js +0 -29
- package/dist/assets/SettingsWindow-Bi8LE9XI.js +0 -1
- package/dist/assets/index-DpzTz2UH.css +0 -1
- package/dist/assets/index-Dy8xgawx.js +0 -40
- package/dist/assets/ja-DxqeAk9N.js +0 -16
- package/dist/assets/main-BOYSXfYn.js +0 -896
- package/dist/assets/main-Bjcre_GE.js +0 -2
- package/dist/assets/markdownCore-DPrwM1rU.js +0 -5
- package/dist/assets/miniChat-Dz_bPgMc.js +0 -2
- package/dist/assets/mobile-BbZPBJrK.js +0 -2
- package/dist/assets/renderElectronMiniChatApp-uNEUkeAI.js +0 -2
- package/dist/assets/renderMobileApp-BK1kFlcJ.js +0 -25
- package/dist/assets/runtimeEndpointReset-BULHvOwb.js +0 -25
- package/dist/assets/tr-cIQtYBpg.js +0 -7
- package/dist/assets/useRootScrollLock-Cwc4kSl2.js +0 -1
- package/dist/assets/zh-CN-BWvlPHY-.js +0 -16
- /package/dist/assets/{vendor-katex-k3Ppq1Ha.js → vendor-katex-CHD9BdDO.js} +0 -0
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import{R as I,j as M,c as ye,r as l}from"./vendor-react-BUCujlKS.js";import{a as Ke}from"./web-components-U-hWbgJo.js";import{f as Ie}from"./computeVirtualFileMetrics-DHgQIkUq.js";import{V as Ye,F as Xe}from"./VirtualizedFileDiff-DCXjBGRf.js";import{V as Je}from"./Virtualizer-D_a8gKmg.js";import{eL as Qe,eM as ze,bf as Ze,c4 as et,h as Ne}from"./useAppFontEffects-hfv2s6mZ.js";import{I as He,a as tt,u as nt}from"./useInlineCommentController-BmtfVbo8.js";import"./index-Dy8xgawx.js";import{ag as rt}from"./runtimeEndpointReset-BULHvOwb.js";import{ensurePierreThemeRegistered as $e,getResolvedShikiTheme as qe}from"./appThemeRegistry-DDROzcUO.js";const ve=i=>{if(i.type==="new"){const n=Math.min(i.selection.start,i.selection.end),r=Math.max(i.selection.start,i.selection.end);return`new-comment-${i.selection.side??"additions"}-${n}-${r}`}return`draft-${i.draft.id}`},it=i=>{const{drafts:n,editingDraftId:r,selection:a}=i,d=[];for(const w of n){if(!Number.isFinite(w.endLine))continue;const E=Math.max(1,Math.floor(w.endLine)),C=w.side==="original"?"deletions":"additions";d.push({lineNumber:E,side:C,metadata:{type:w.id===r?"edit":"saved",draft:w}})}return a&&!r&&d.push({lineNumber:Math.max(a.start,a.end),side:a.side??"additions",metadata:{type:"new",selection:a}}),d};function ot(i){const n=i.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 Be(i){if(!(!i||i<=0))return Math.max(200,Math.floor(i))}function st(i){const{diffRootRef:n,drafts:r,selection:a,editingDraftId:d,commentText:w,onTextChange:E,fileLabel:C,onSave:u,onCancel:$,onEdit:z,onDelete:N}=i,[V,O]=I.useState(0),[ee,P]=I.useState(null),H=I.useMemo(()=>!a||d?null:ve({type:"new",selection:a}),[d,a]),te=I.useMemo(()=>{const o=r.map(b=>ve({type:b.id===d?"edit":"saved",draft:b}));return H&&o.push(H),o},[r,d,H]),K=I.useCallback(o=>{const b=n.current;if(!b)return null;const S=b.querySelector("diffs-container");if(!(S instanceof HTMLElement))return null;const k=S.querySelector(`[data-annotation-id="${o}"]`);if(k instanceof HTMLElement)return k;const T=S.shadowRoot;return T?T.querySelector(`[data-annotation-id="${o}"]`):null},[n]);I.useEffect(()=>{if(te.length===0)return;let o=!1,b=0;const S=12,k=()=>{o||te.every(F=>!!K(F))||b>=S||(b+=1,requestAnimationFrame(()=>{o||(O(F=>F+1),k())}))};return k(),()=>{o=!0}},[te,K]),I.useEffect(()=>{const o=n.current;if(!o)return;const b=()=>{const k=getComputedStyle(o),T=ot(k.getPropertyValue("--oc-context-panel-width")),F=o.getBoundingClientRect(),W=T??F.width;P(W>0?W:null)};b();const S=new ResizeObserver(()=>{b()});return S.observe(o),window.addEventListener("resize",b),()=>{S.disconnect(),window.removeEventListener("resize",b)}},[n]);const Y=I.useCallback(o=>{const S=n.current?.getBoundingClientRect(),k=o.closest("[data-annotation-content]"),T=k instanceof HTMLElement?k.getBoundingClientRect():o.getBoundingClientRect(),F=[T.width];S&&F.push(S.right-T.left);const W=F.filter(ce=>Number.isFinite(ce)&&ce>0);return W.length>0?Be(Math.min(...W)):Be(ee)},[n,ee]);return M.jsxs(M.Fragment,{children:[r.map(o=>{const b=ve({type:o.id===d?"edit":"saved",draft:o}),S=K(b);if(!S)return null;const k=Y(S);return o.id===d?ye.createPortal(M.jsx(He,{initialText:w,onTextChange:E,fileLabel:C,lineRange:{start:o.startLine,end:o.endLine,side:o.side==="original"?"deletions":"additions"},isEditing:!0,onSave:u,onCancel:$,maxWidth:k}),S,`draft-edit-${o.id}`):ye.createPortal(M.jsx(tt,{draft:o,onEdit:()=>z(o),onDelete:()=>N(o),maxWidth:k}),S,`draft-card-${o.id}`)}),a&&!d&&H&&(()=>{const o=K(H);if(!o)return null;const b=Y(o);return ye.createPortal(M.jsx(He,{initialText:w,onTextChange:E,fileLabel:C,lineRange:a,isEditing:!1,onSave:u,onCancel:$,maxWidth:b}),o,H)})()]})}const De=[],at=`
|
|
2
|
-
[data-gutter-buffer="annotation"] { min-height: 0; }
|
|
3
|
-
[data-code] { min-height: 2.5rem; align-content: start; }
|
|
4
|
-
`,Oe=5e5,lt=`
|
|
5
|
-
:host {
|
|
6
|
-
font-family: var(--font-mono);
|
|
7
|
-
font-size: var(--text-code);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
pre, [data-code] {
|
|
11
|
-
font-family: var(--font-mono);
|
|
12
|
-
font-size: var(--text-code);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/* Mobile touch selection support */
|
|
16
|
-
[data-line-number] {
|
|
17
|
-
touch-action: manipulation;
|
|
18
|
-
-webkit-tap-highlight-color: transparent;
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/* Ensure interactive line numbers work on touch */
|
|
23
|
-
pre[data-interactive-line-numbers] [data-line-number] {
|
|
24
|
-
touch-action: manipulation;
|
|
25
|
-
}
|
|
26
|
-
`,We=`
|
|
27
|
-
${lt}
|
|
28
|
-
|
|
29
|
-
/* While a multi-line content drag is being mapped to a line selection the
|
|
30
|
-
row highlight is the feedback; the native blue text selection on top of
|
|
31
|
-
it reads as double-selection, so it is painted transparent for the drag's
|
|
32
|
-
duration only (single-line selections keep the normal look for copying). */
|
|
33
|
-
:host([data-oc-comment-drag]) {
|
|
34
|
-
user-select: none;
|
|
35
|
-
-webkit-user-select: none;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/* Gutter "+" comment utility: theme primary, and smaller than Pierre's
|
|
39
|
-
1lh default, which reads oversized next to our 13px line numbers. */
|
|
40
|
-
[data-utility-button] {
|
|
41
|
-
width: 16px;
|
|
42
|
-
height: 16px;
|
|
43
|
-
align-self: center;
|
|
44
|
-
margin-right: calc(-16px + 1ch);
|
|
45
|
-
border-radius: 5px;
|
|
46
|
-
background-color: var(--primary-base);
|
|
47
|
-
color: var(--primary-foreground);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
:host {
|
|
51
|
-
--diffs-bg-separator-override: var(--surface-elevated);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
[data-diff-header],
|
|
55
|
-
[data-diff] {
|
|
56
|
-
[data-separator] {
|
|
57
|
-
height: 24px !important;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
[data-separator="line-info-basic"] {
|
|
62
|
-
height: 24px !important;
|
|
63
|
-
background: var(--diffs-bg) !important;
|
|
64
|
-
position: relative;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
[data-diff-type="single"] [data-gutter],
|
|
68
|
-
[data-diff-type="split"] [data-deletions] [data-gutter] {
|
|
69
|
-
[data-separator-wrapper] {
|
|
70
|
-
position: absolute;
|
|
71
|
-
left: 100%;
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
gap: unset;
|
|
75
|
-
width: max-content;
|
|
76
|
-
background: transparent;
|
|
77
|
-
color: var(--diffs-fg-number);
|
|
78
|
-
font-family: var(--diffs-header-font-family, var(--font-sans));
|
|
79
|
-
font-size: 0.75rem;
|
|
80
|
-
line-height: 1;
|
|
81
|
-
margin-left: calc(-2ch - 2px);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
[data-separator-wrapper][data-separator-multi-button] {
|
|
85
|
-
margin-left: calc(-3ch - 2px);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
[data-expand-button],
|
|
89
|
-
[data-separator-content] {
|
|
90
|
-
display: block;
|
|
91
|
-
align-self: unset;
|
|
92
|
-
min-width: unset;
|
|
93
|
-
min-height: unset;
|
|
94
|
-
padding: 0;
|
|
95
|
-
flex-shrink: 0;
|
|
96
|
-
grid-column: unset;
|
|
97
|
-
border: none;
|
|
98
|
-
width: auto;
|
|
99
|
-
height: auto;
|
|
100
|
-
background-color: transparent;
|
|
101
|
-
color: inherit;
|
|
102
|
-
font: inherit;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
[data-expand-button]:not([data-expand-all-button]) {
|
|
106
|
-
&[data-expand-down]::before {
|
|
107
|
-
content: '\\2191';
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
&[data-expand-up]::before {
|
|
111
|
-
content: '\\2193';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
&[data-expand-both]::before {
|
|
115
|
-
content: '\\2195';
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
svg {
|
|
119
|
-
display: none;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
[data-separator-content] {
|
|
124
|
-
background: transparent;
|
|
125
|
-
margin-left: calc(2px + 1ch);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
[data-expand-all-button] {
|
|
129
|
-
position: relative;
|
|
130
|
-
margin-left: 14px;
|
|
131
|
-
text-transform: lowercase;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
[data-expand-all-button]::before {
|
|
135
|
-
content: '';
|
|
136
|
-
display: block;
|
|
137
|
-
position: absolute;
|
|
138
|
-
top: 50%;
|
|
139
|
-
left: -8px;
|
|
140
|
-
margin-top: -1px;
|
|
141
|
-
width: 3px;
|
|
142
|
-
height: 3px;
|
|
143
|
-
border-radius: 2px;
|
|
144
|
-
background-color: var(--diffs-fg-number);
|
|
145
|
-
pointer-events: none;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
[data-separator-content]:hover,
|
|
149
|
-
[data-expand-button]:hover,
|
|
150
|
-
[data-expand-all-button]:hover {
|
|
151
|
-
color: var(--diffs-fg);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
[data-expand-all-button]:hover {
|
|
155
|
-
text-decoration: underline;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
`;function ct(i){let n=2166136261;for(let r=0;r<i.length;r+=1)n^=i.charCodeAt(r),n=n+((n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24))>>>0;return n.toString(16)}function je(i){const n=i.length>400?`${i.slice(0,200)}${i.slice(-200)}`:i;return`${i.length}:${ct(n)}`}const dt=(i,n,r,a)=>{const d=a.side==="deletions",E=(r?(d?r.deletionLines:r.additionLines).join(""):d?i:n).split(`
|
|
159
|
-
`),C=Math.min(a.start,a.end),u=Math.max(a.start,a.end),$=Math.max(1,C),z=Math.min(E.length,u);return $>z?"":E.slice($-1,z).join(`
|
|
160
|
-
`)},ut=(i,n)=>i===n?!0:!i||!n?!1:i.start===n.start&&i.end===n.end&&i.side===n.side,ft=i=>i==="auto"||i==="scroll"||i==="overlay",ht=i=>{let n=i?.parentElement??null;for(;n;){const r=window.getComputedStyle(n);if(ft(r.overflowY))return n;n=n.parentElement}return null},mt=(i,n)=>{if(!i||!n||typeof window>"u")return()=>{};const r=ht(i);if(!r)return()=>{};const a=n.getBoundingClientRect().height;if(!a)return()=>{};const d=i.getBoundingClientRect().top-r.getBoundingClientRect().top,w=n.style.minHeight;n.style.minHeight=`${Math.ceil(a)}px`;let E=!1;return()=>{if(E)return;E=!0,n.style.minHeight=w;const u=i.getBoundingClientRect().top-r.getBoundingClientRect().top-d;u&&(r.scrollTop+=u)}},pt=(i,n)=>{if(typeof window>"u")return()=>{};let r=null,a=null,d=!1;const w=()=>{d||(a?.disconnect(),a=null,r=window.requestAnimationFrame(()=>{r=window.requestAnimationFrame(()=>{d||n()})}))},E=()=>i.querySelector("diffs-container")?.shadowRoot??void 0,C=(u=E())=>!!u?.querySelector("[data-line]");return C()?w():typeof MutationObserver<"u"?(a=new MutationObserver(()=>{const u=E();if(u){if(C(u)){w();return}a?.disconnect(),a=new MutationObserver(()=>{C(u)&&w()}),a.observe(u,{childList:!0,subtree:!0})}}),a.observe(i,{childList:!0,subtree:!0})):r=window.requestAnimationFrame(w),()=>{d=!0,a?.disconnect(),r!==null&&window.cancelAnimationFrame(r)}},ge=new WeakMap,gt={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function yt(i){const n=i.closest("[data-diff-virtual-root]");if(n instanceof HTMLElement){const r=n.querySelector("[data-diff-virtual-content]");return{key:n,root:n,content:r instanceof HTMLElement?r:void 0}}return{key:document,root:document,content:void 0}}function vt(i){if(typeof document>"u")return null;const n=yt(i);let r=ge.get(n.key);if(!r){const d=new Je;d.setup(n.root,n.content),r={virtualizer:d,refs:0},ge.set(n.key,r)}r.refs+=1;let a=!1;return{virtualizer:r.virtualizer,root:n.root,release:()=>{if(a)return;a=!0;const d=ge.get(n.key);d&&(d.refs-=1,!(d.refs>0)&&(d.virtualizer.cleanUp(),ge.delete(n.key)))}}}const bt=(i,n,r)=>{if(typeof window>"u")return()=>{};const a=[],d=()=>{try{i.rerender()}catch{}const w=n?.root;w instanceof HTMLElement?w.dispatchEvent(new Event("scroll",{bubbles:!1})):document.dispatchEvent(new Event("scroll",{bubbles:!1})),window.dispatchEvent(new Event("resize")),r()};return a.push(window.requestAnimationFrame(d)),a.push(window.requestAnimationFrame(()=>{a.push(window.requestAnimationFrame(d))})),()=>{for(const w of a)window.cancelAnimationFrame(w)}},Pt=({original:i,modified:n,fileDiff:r,language:a,fileName:d,renderSideBySide:w,wrapLines:E,layout:C="fill",enableComments:u=!0,hunkActions:$})=>{const z=Qe(),N=z?.currentTheme.metadata.variant==="dark",V=z?.availableThemes.find(e=>e.metadata.id===z.lightThemeId)??ze(!1),O=z?.availableThemes.find(e=>e.metadata.id===z.darkThemeId)??ze(!0),{isMobile:ee}=Ze(),P=$?.anchors??De,[H,te]=I.useState(()=>({fileDiff:void 0,anchors:De,targets:new Map})),K=nt({source:"diff",fileLabel:d||"unknown",language:a,getCodeForRange:e=>dt(i,n,r,e),toStoreRange:e=>({startLine:e.start,endLine:e.end,side:e.side==="deletions"?"original":"modified"}),fromDraftRange:e=>({start:e.startLine,end:e.endLine,side:e.side==="original"?"deletions":"additions"})}),{drafts:Y,selection:o,setSelection:b,commentText:S,setCommentText:k,editingDraftId:T,saveComment:F,cancel:W,startEdit:ce,deleteDraft:Ve}=K,de=l.useRef(null),U=l.useRef(null),ne=l.useRef(""),q=l.useRef(!1),ue=l.useRef(null);l.useEffect(()=>{de.current=o},[o]),l.useEffect(()=>{U.current=T},[T]),l.useEffect(()=>{ne.current=S},[S]);const fe=l.useCallback(e=>{if(!u||q.current)return;const t=de.current;if(!(!e&&t&&ne.current.trim())){if(ee&&t&&e&&e.side===t.side){const s=Math.min(t.start,e.start),c=Math.max(t.end,e.end);b({...e,start:s,end:c})}else b(e);e&&(U.current||k(""))}},[u,ee,k,b]),Ue=l.useCallback(()=>{W()},[W]),Ee=l.useCallback(e=>{const t=document.createElement("div");if(t.style.position="relative",e.metadata.type==="hunk-action")return t.dataset.hunkActionTarget=String(e.metadata.index),t.style.height="0px",t;const s=ve(e.metadata);return t.dataset.annotationId=s,t.dataset.annotationSide=e.side,t.dataset.annotationLine=String(e.lineNumber),t},[]),Te=l.useCallback((e,t,s)=>{const c=new Map;if(s!=="unmount"){const f=Number.parseFloat(getComputedStyle(document.documentElement).fontSize)*2,y=new Map,x=[];for(const R of e.shadowRoot?.querySelectorAll("slot")??[])for(const L of R.assignedElements()){const v=L.querySelector("[data-hunk-action-target]"),h=Number(v?.dataset.hunkActionTarget);if(!v||!Number.isInteger(h)||h<0)continue;c.set(h,v);const m=R.closest("[data-code]");if(!m)continue;let g=y.get(m);g||(g=m.getBoundingClientRect(),y.set(m,g));const j=v.getBoundingClientRect().top,ae=Math.max(g.top+4,Math.min(j+4,g.bottom-f-4));x.push({target:v,offset:ae-j})}for(const{target:R,offset:L}of x){const v=`${L}px`;R.style.getPropertyValue("--oc-hunk-action-offset")!==v&&R.style.setProperty("--oc-hunk-action-offset",v)}}const p=t.fileDiff;te(f=>f.fileDiff===p&&f.anchors===P&&f.targets.size===c.size&&[...c].every(([y,x])=>f.targets.get(y)===x)?f:{fileDiff:p,anchors:P,targets:c})},[P]),_e=l.useCallback((e,t)=>{F(e,t??o??void 0)},[F,o]),_=l.useCallback(e=>{b(e);const t=A.current;if(t)try{q.current=!0,t.setSelectedLines(e),ue.current=e}catch{}finally{q.current=!1}},[b]),re=l.useRef(null),be=l.useRef(null);l.useEffect(()=>{if(!u)return;const e=J.current;if(!e)return;const t=()=>{const h=e.querySelector("diffs-container");return h instanceof HTMLElement?h.shadowRoot:null},s=h=>{const m=e.querySelector("diffs-container");m instanceof HTMLElement&&(h?m.setAttribute("data-oc-comment-drag",""):m.removeAttribute("data-oc-comment-drag"))},c=(h,m)=>{const j=t()?.elementFromPoint(h,m)??document.elementFromPoint(h,m);if(!(j instanceof Element))return null;const ae=!!j.closest("[data-column-number]"),le=j.closest("[data-line]");if(!(le instanceof HTMLElement))return null;const Le=Number.parseInt(le.getAttribute("data-line")??"",10);if(!Number.isFinite(Le)||Le<=0)return null;const Ge=le.getAttribute("data-line-type")==="change-deletion"||le.closest("[data-code][data-deletions]")!=null?"deletions":"additions";return{line:Le,side:Ge,numberColumn:ae}};let p=null,f=!1,y=null;const x=h=>{re.current=h;const m=A.current;if(m)try{q.current=!0,m.setSelectedLines(h)}catch{}finally{q.current=!1}},R=h=>{if(h.button!==0||h.pointerType!=="mouse")return;const m=c(h.clientX,h.clientY);if(!m||m.numberColumn){p=null;return}p={line:m.line,side:m.side},f=!1,y=h.pointerId},L=h=>{if(p==null||h.pointerId!==y)return;const m=c(h.clientX,h.clientY);if(m){if(!f){if(m.line===p.line)return;f=!0,s(!0),window.getSelection()?.removeAllRanges();const g=t();g&&"getSelection"in g&&g.getSelection()?.removeAllRanges()}x({start:Math.min(p.line,m.line),end:Math.max(p.line,m.line),side:p.side})}},v=h=>{if(p==null||h.pointerId!==y)return;const m=f;if(p=null,f=!1,y=null,s(!1),!m)return;const g=re.current;re.current=null,g&&(de.current&&ne.current.trim()&&!U.current||(_(g),U.current||k("")))};return e.addEventListener("pointerdown",R),document.addEventListener("pointermove",L,{passive:!0}),document.addEventListener("pointerup",v),()=>{e.removeEventListener("pointerdown",R),document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",v),s(!1)}},[_,u,k]);const Me=l.useCallback(e=>{if(!u)return;const t=re.current,s=t&&e.start>=t.start&&e.end<=t.end&&(e.side==null||e.side===t.side);be.current!==null&&(window.clearTimeout(be.current),be.current=null),re.current=null,_(s&&t?t:e),U.current||k("")},[_,u,k]),Ce=l.useCallback(e=>{if(!u||e.numberColumn||window.getSelection()?.toString().trim())return;const t=e.annotationSide,s={start:e.lineNumber,end:e.lineNumber,side:t},c=de.current;if(c&&c.start===s.start&&c.end===s.end&&c.side===s.side){if(!ne.current.trim()){b(null);const p=A.current;try{q.current=!0,p?.setSelectedLines(null)}finally{q.current=!1}}return}c&&ne.current.trim()&&!U.current||(_(s),U.current||k(""))},[_,u,k,b]),Pe=l.useCallback(e=>{const t=e.closest("[data-line-type]")?.getAttribute("data-line-type")??e.getAttribute("data-line-type");if(t==="change-deletion")return"deletions";if(t==="change-addition")return"additions";const s=e.getAttribute("data-column-side")??e.getAttribute("data-side")??e.closest("[data-column-side]")?.getAttribute("data-column-side");if(s==="deletions"||s==="left"||s==="original")return"deletions";if(s==="additions"||s==="right"||s==="modified")return"additions";const c=e.closest("[data-line-type]");if(c instanceof HTMLElement){const p=c.getBoundingClientRect(),f=e.getBoundingClientRect(),y=p.left+p.width/2;return f.left+f.width/2<y?"deletions":"additions"}return"additions"},[]);$e(V),$e(O);const X=`${V.metadata.id}:${O.metadata.id}:${N?"dark":"light"}`,ie=l.useMemo(()=>{if(r){const e=r.deletionLines.reduce((s,c)=>s+c.length,0),t=r.additionLines.reduce((s,c)=>s+c.length,0);return Math.max(e,t)>Oe}return Math.max(i.length,n.length)>Oe},[r,n.length,i.length]),J=l.useRef(null),Q=l.useRef(null),A=l.useRef(null),oe=l.useRef(null),we=l.useRef(null),ke=l.useRef(null),Re=l.useRef(void 0),he=l.useRef(void 0),me=l.useRef(void 0),pe=l.useRef(void 0),[,xe]=I.useReducer(e=>e+1,0),Z=rt(ie?"unified":w?"split":"unified"),B=l.useMemo(()=>qe(V),[V]),D=l.useMemo(()=>qe(O),[O]);I.useLayoutEffect(()=>{const e=J.current;if(!e)return;const t=e.querySelector("diffs-container");if(!t)return;const s=N?D:B,c=(j,ae)=>j.colors?.[ae],p=c(B,"terminal.ansiGreen"),f=c(B,"terminal.ansiRed"),y=c(B,"terminal.ansiBlue"),x=c(D,"terminal.ansiGreen"),R=c(D,"terminal.ansiRed"),L=c(D,"terminal.ansiBlue");t.style.setProperty("--shiki-light",B.fg),t.style.setProperty("--shiki-light-bg",B.bg),p&&t.style.setProperty("--shiki-light-addition-color",p),f&&t.style.setProperty("--shiki-light-deletion-color",f),y&&t.style.setProperty("--shiki-light-modified-color",y),t.style.setProperty("--shiki-dark",D.fg),t.style.setProperty("--shiki-dark-bg",D.bg),x&&t.style.setProperty("--shiki-dark-addition-color",x),R&&t.style.setProperty("--shiki-dark-deletion-color",R),L&&t.style.setProperty("--shiki-dark-modified-color",L),t.style.setProperty("--diffs-bg",s.bg),t.style.setProperty("--diffs-fg",s.fg);const v=N?x:p,h=N?R:f,m=N?L:y;v&&t.style.setProperty("--diffs-addition-color-override",v),h&&t.style.setProperty("--diffs-deletion-color-override",h),m&&t.style.setProperty("--diffs-modified-color-override",m);const g=t.shadowRoot?.querySelector("pre");g&&(g.style.setProperty("--shiki-light",B.fg),g.style.setProperty("--shiki-light-bg",B.bg),p&&g.style.setProperty("--shiki-light-addition-color",p),f&&g.style.setProperty("--shiki-light-deletion-color",f),y&&g.style.setProperty("--shiki-light-modified-color",y),g.style.setProperty("--shiki-dark",D.fg),g.style.setProperty("--shiki-dark-bg",D.bg),x&&g.style.setProperty("--shiki-dark-addition-color",x),R&&g.style.setProperty("--shiki-dark-deletion-color",R),L&&g.style.setProperty("--shiki-dark-modified-color",L),g.style.setProperty("--diffs-bg",s.bg),g.style.setProperty("--diffs-fg",s.fg),v&&g.style.setProperty("--diffs-addition-color-override",v),h&&g.style.setProperty("--diffs-deletion-color-override",h),m&&g.style.setProperty("--diffs-modified-color-override",m))},[D,X,N,B]);const G=l.useMemo(()=>({theme:{dark:O.metadata.id,light:V.metadata.id},themeType:N?"dark":"light",diffStyle:w?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",maxLineDiffLength:ie?0:1e3,maxLineLengthForHighlighting:ie?1:1e3,tokenizeMaxLineLength:ie?1:1e3,collapsedContextThreshold:0,expansionLineCount:20,overflow:E?"wrap":"scroll",disableFileHeader:!0,enableLineSelection:u,enableGutterUtility:u,onGutterUtilityClick:u?Me:void 0,onLineClick:u?Ce:void 0,onLineSelected:u?fe:void 0,unsafeCSS:P.length>0?`${We}
|
|
161
|
-
${at}`:We,renderAnnotation:u||P.length>0?Ee:void 0,onPostRender:P.length>0?Te:void 0}),[Te,P.length,O.metadata.id,u,N,ie,V.metadata.id,w,E,fe,Me,Ce,Ee]),se=l.useMemo(()=>{const e=u?it({drafts:Y,editingDraftId:T,selection:o}):[];for(const t of P)e.push({side:t.side,lineNumber:t.lineNumber,metadata:{type:"hunk-action",index:t.index}});return e},[T,u,Y,P,o]),Se=l.useRef(se);if(l.useEffect(()=>{Se.current=se},[se]),l.useEffect(()=>{const e=Q.current;return()=>{A.current?.cleanUp(),A.current=null,oe.current?.release(),oe.current=null,we.current=null,ke.current=null,Re.current=void 0,he.current=void 0,me.current=void 0,pe.current=void 0,e&&(e.innerHTML="")}},[]),l.useEffect(()=>{if(typeof window>"u")return;const e=Q.current,t=J.current;if(!e||!Z)return;const s=mt(t,e);let c=oe.current;c||(c=vt(e),oe.current=c),oe.current=c;const p=c?.virtualizer??null,f=r?void 0:{name:d||"",contents:i,lang:a,cacheKey:`old:${X}:${d}:${je(i)}`},y=r?void 0:{name:d||"",contents:n,lang:a,cacheKey:`new:${X}:${d}:${je(n)}`},x=r?he.current!==r:he.current!==void 0||!f||!y||!me.current||!pe.current||!Ie(me.current,f)||!Ie(pe.current,y),R=A.current,L=!!(R&&(we.current!==p||ke.current!==Z||p&&(Re.current!==G.hunkSeparators||x)));L&&(R?.cleanUp(),A.current=null,e.innerHTML="");let v=A.current;const h=!L&&R?!Ke(R.options,G):!1;if(v?v.setOptions(G):(v=c?new Ye(G,c.virtualizer,gt,Z):new Xe(G,Z),A.current=v,ue.current=null),we.current=p,ke.current=Z,Re.current=p?G.hunkSeparators:void 0,he.current=r,me.current=f,pe.current=y,r)v.render({fileDiff:r,forceRender:h,lineAnnotations:Se.current,containerWrapper:e});else{if(!f||!y)return;v.render({oldFile:f,newFile:y,forceRender:h,lineAnnotations:Se.current,containerWrapper:e})}const m=pt(e,()=>{s(),bt(v,c,xe)});return()=>{m(),s()}},[X,r,d,a,n,G,i,Z]),l.useEffect(()=>{const e=A.current;if(e){try{e.setLineAnnotations(se)}catch(t){console.error("Failed to apply diff line annotations",t);try{e.setLineAnnotations([])}catch{}}requestAnimationFrame(()=>{if(A.current===e){try{e.rerender()}catch{}xe()}})}},[se]),l.useEffect(()=>{const e=A.current;if(!e||o!==null)return;const t=ue.current;if(!ut(o,t))try{q.current=!0,e.setSelectedLines(o),ue.current=o}catch{}finally{q.current=!1}},[o]),l.useEffect(()=>{if(!u)return;const e=Q.current;if(!e)return;let t=null,s=()=>{};const c=()=>{const f=e.querySelector("diffs-container")?.shadowRoot;if(!f){t=requestAnimationFrame(c);return}const y=x=>{if(!(x instanceof MouseEvent)||x.button!==0||!(x.target instanceof Element))return;const R=x.target.closest("[data-column-number]");if(!(R instanceof HTMLElement))return;const L=R.getAttribute("data-column-number"),v=L?parseInt(L,10):NaN;if(Number.isNaN(v))return;const h=Pe(R);fe({start:v,end:v,side:h}),x.preventDefault(),x.stopPropagation()};f.addEventListener("click",y,!0),s=()=>{f.removeEventListener("click",y,!0)}};return c(),()=>{t!==null&&cancelAnimationFrame(t),s()}},[X,u,d,fe,Pe]),l.useEffect(()=>{const e=Q.current;if(!e)return;let t=null,s=null;const p=setTimeout(()=>{const f=e.querySelector("diffs-container");if(!(f instanceof HTMLElement))return;const y=f.shadowRoot;t=new MutationObserver(()=>{s&&cancelAnimationFrame(s),s=requestAnimationFrame(()=>{xe(),s=null})}),t.observe(f,{childList:!0,subtree:!0}),y&&t.observe(y,{childList:!0,subtree:!0})},100);return()=>{clearTimeout(p),s&&cancelAnimationFrame(s),t?.disconnect()}},[X,d]),typeof window>"u")return null;const Ae=u?M.jsx(st,{diffRootRef:J,drafts:Y,selection:o,editingDraftId:T,commentText:S,onTextChange:k,fileLabel:d?.split("/").pop()??"",onSave:_e,onCancel:Ue,onEdit:e=>{_({start:e.startLine,end:e.endLine,side:e.side==="original"?"deletions":"additions"}),ce(e)},onDelete:Ve}):null,Fe=$&&r&&H.fileDiff===r&&H.anchors===P?[...H.targets].map(([e,t])=>ye.createPortal($.render(e),t,`hunk-${e}`)):null;return C==="fill"?M.jsx("div",{className:Ne("flex flex-col relative","size-full"),"data-diff-virtual-root":!0,children:M.jsxs("div",{className:"flex-1 relative min-h-0",children:[M.jsx(et,{outerClassName:"pierre-diff-wrapper size-full",disableHorizontal:!1,fillContainer:!0,"data-diff-virtual-content":!0,children:M.jsx("div",{ref:J,className:"size-full relative",children:M.jsx("div",{ref:Q,className:"size-full"})})}),Ae,Fe]})}):M.jsxs("div",{className:Ne("relative","w-full"),children:[M.jsx("div",{ref:J,className:"pierre-diff-wrapper w-full overflow-x-auto overflow-y-visible relative",children:M.jsx("div",{ref:Q,className:"w-full"})}),Ae,Fe]})};export{Pt as P};
|