@pi-chamber/web 0.2.1 → 0.2.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/dist/assets/{CommitSection-BQBmpPVE.js → CommitSection-DPjTv8fA.js} +1 -1
- package/dist/assets/{DiagramEditor-Cp22TGpq.js → DiagramEditor-ChOor9l9.js} +1 -1
- package/dist/assets/{DiagramView-E4HJ4ZPU.js → DiagramView-3hAT86v_.js} +1 -1
- package/dist/assets/{DiffView-d23o9CKP.js → DiffView-D1dyOiw2.js} +2 -2
- package/dist/assets/FilesView-BCzghrc7.js +14 -0
- package/dist/assets/{GitView-CkUONO1-.js → GitView-CYF1E1p4.js} +4 -4
- package/dist/assets/{JsonTreeView-By2oGMNK.js → JsonTreeView-CrJO6LNu.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DUghE55t.js → MarkdownRendererImpl-BmKjrkGD.js} +2 -2
- package/dist/assets/{PatchDiff-BjN6zMtK.js → PatchDiff-DgvPLx6x.js} +1 -1
- package/dist/assets/{PierreDiffViewer-B38_7NnU.js → PierreDiffViewer-InnT0JVA.js} +2 -2
- package/dist/assets/{SessionSwitcherDropdown-NbVfnqQQ.js → SessionSwitcherDropdown-C0OdvirK.js} +102 -102
- package/dist/assets/{SettingsView-C2dCv0r7.js → SettingsView-JAfC_cBL.js} +1 -1
- package/dist/assets/{SettingsWindow-DsMhdX5H.js → SettingsWindow-BBEsjcJE.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DVesARmI.js → ToolOutputDialog-gzwcb8nI.js} +4 -4
- package/dist/assets/{ToolPartDiffPreview-C2N_oIO-.js → ToolPartDiffPreview-C45V5bhy.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-B7eVR6Pt.js → VirtualizedFileDiff-uKfnkQWb.js} +1 -1
- package/dist/assets/{collapsible-CPkWB1VR.js → collapsible-Bq8sDiKS.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-BsZulefS.js → computeVirtualFileMetrics-BPgZ_RSe.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-BmmlK5E3.js → contextFileOpenGuard-CydO7PkI.js} +1 -1
- package/dist/assets/{index-C84KrQoy.js → index-BSuNNtBh.js} +1 -1
- package/dist/assets/{index-BhXma4dv.js → index-CH7o4-_q.js} +1 -1
- package/dist/assets/index-o4Eea60G.css +1 -0
- package/dist/assets/{isDiffPlainText-DsuyxFXo.js → isDiffPlainText-f9b4cKNo.js} +1 -1
- package/dist/assets/{isFilePlainText-CCYoe7us.js → isFilePlainText-BjESb-gU.js} +1 -1
- package/dist/assets/{main-ClYgYVm1.js → main-B508FBXr.js} +2 -2
- package/dist/assets/main-nG4uFyAy.js +133 -0
- package/dist/assets/{markdownCore-D2uqals1.js → markdownCore-BFmf8a-O.js} +2 -2
- package/dist/assets/{miniChat-DmX9SjxM.js → miniChat-BTlz8IPL.js} +2 -2
- package/dist/assets/{mobile-C-PCxN62.js → mobile-DBkrRt80.js} +2 -2
- package/dist/assets/renderElectronMiniChatApp-DW3fSR5w.js +1 -0
- package/dist/assets/renderMobileApp-9qkroKty.js +14 -0
- package/dist/assets/{runtimeSurface-CouGjZ3A.js → runtimeSurface-Bec4O8FD.js} +1 -1
- package/dist/assets/{useInlineCommentController-buNJ3xB4.js → useInlineCommentController-CHmIm0Rr.js} +2 -2
- package/dist/assets/usePanelSlide-DCX8qQ4K.js +56 -0
- package/dist/assets/{useWindowTitle-CnF4pKz0.js → useWindowTitle-CE5N_NeU.js} +3 -3
- package/dist/assets/{vendor-codemirror-autocomplete-3xMyV7a2.js → vendor-codemirror-autocomplete-BS2SpSAZ.js} +1 -1
- package/dist/assets/{vendor-codemirror-commands-Bzf12ODH.js → vendor-codemirror-commands-RrgJ8H_6.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-angular-0K6s6cvb.js → vendor-codemirror-lang-angular-ADhO_TUK.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-cpp-B0aL03z-.js → vendor-codemirror-lang-cpp-BGCWj7Om.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-css-C4jEScp7.js → vendor-codemirror-lang-css-Ba8JZ6fp.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-go-CgrfVBPr.js → vendor-codemirror-lang-go-DyTiHXo4.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-html-C1Svvdey.js → vendor-codemirror-lang-html-DK27qQri.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-java-DNPz7_Bx.js → vendor-codemirror-lang-java-CvFfnhPQ.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-javascript-CrbeaEAU.js → vendor-codemirror-lang-javascript-BUlYhQ3o.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-jinja-DL8BR_RG.js → vendor-codemirror-lang-jinja-wBMtAEvT.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-json-BTvAjwkJ.js → vendor-codemirror-lang-json-CqayksDf.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-less-CPABt6NZ.js → vendor-codemirror-lang-less-Ct3-H1PB.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-liquid-BLOLOBMg.js → vendor-codemirror-lang-liquid-XspREksq.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-markdown-BloD9GN-.js → vendor-codemirror-lang-markdown-CvO36Y1p.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-php-FIZMTuWM.js → vendor-codemirror-lang-php-BlUF9cCe.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-python-CR2g6ukK.js → vendor-codemirror-lang-python-_2bIYTiJ.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-rust-lsPqn4k4.js → vendor-codemirror-lang-rust-BdTYih_U.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sass-CtECMwzH.js → vendor-codemirror-lang-sass-E6MhfOFk.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sql-BtmZrrZH.js → vendor-codemirror-lang-sql-B1BRhQSF.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-vue-Br6DrntY.js → vendor-codemirror-lang-vue-BYQJRa1Q.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-wast-DT7IlCnb.js → vendor-codemirror-lang-wast-D706yuyC.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-xml-wNr-LZOf.js → vendor-codemirror-lang-xml--MfWU6Dj.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-yaml-BTKFwfc2.js → vendor-codemirror-lang-yaml-CRUFIbRX.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-BuDklWi8.js → vendor-codemirror-language-E2vgV9K3.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-qBLdzwMc.js → vendor-codemirror-language-data-q1yHU1R9.js} +2 -2
- package/dist/assets/{vendor-codemirror-search-BzyfPoRb.js → vendor-codemirror-search-8kyQdB3f.js} +1 -1
- package/dist/assets/{vendor-codemirror-state-Wdz6Qsow.js → vendor-codemirror-state-CNWM3Q8V.js} +1 -1
- package/dist/assets/{vendor-codemirror-view-pXtfpqbT.js → vendor-codemirror-view-DSzLbZiS.js} +1 -1
- package/dist/assets/{vendor-replit-codemirror-vim-BUqe2Slv.js → vendor-replit-codemirror-vim-BJY5fGLS.js} +1 -1
- package/dist/assets/{web-components-BhO08KaW.js → web-components-CLirSfwt.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/package.json +1 -1
- package/dist/assets/FilesView-DIDB-xK7.js +0 -14
- package/dist/assets/index-BZXqJcua.css +0 -1
- package/dist/assets/main-CmrF_CaW.js +0 -133
- package/dist/assets/renderElectronMiniChatApp-BhXZtZlU.js +0 -1
- package/dist/assets/renderMobileApp-DUSTAPWw.js +0 -23
- package/dist/assets/usePanelSlide-BRwyEEzi.js +0 -47
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as F,j as O,b as we,r as d}from"./vendor-react-DYyjh7Q0.js";import{B as $e}from"./web-components-BhO08KaW.js";import{f as Te}from"./computeVirtualFileMetrics-BsZulefS.js";import{V as Ne,F as Be}from"./VirtualizedFileDiff-B7eVR6Pt.js";import{bj as je,aW as Ue,aC as Ge,f as ke}from"./SessionSwitcherDropdown-NbVfnqQQ.js";import{ac as Qe}from"./usePanelSlide-BRwyEEzi.js";import{I as Ce,a as Ke,u as Ye}from"./useInlineCommentController-buNJ3xB4.js";import{ensurePierreThemeRegistered as Me,getResolvedShikiTheme as Oe}from"./appThemeRegistry-BK0dHKa6.js";import{M as Le}from"./index-BhXma4dv.js";const he=new Set;let Re=null;function I(s){he.add(s),Re??=requestAnimationFrame(Pe)}function Pe(s){const e=new Set(he);he.clear();for(const t of e)try{t(s)}catch(n){console.error(n)}he.size>0?Re=requestAnimationFrame(Pe):Re=null}function De({scrollTop:s,scrollHeight:e,height:t,fitPerfectly:n=!1,fitPerfectlyOverscroll:r=0,overscrollSize:l}){const u=t+l*2,h=n?t+r*2:u;if(e=Math.max(e,h),u>=e||n){const m=Math.max(s-r,0),S=Math.min(s+h,e);return{top:m,bottom:Math.max(S,m)}}let a=s+t/2-u/2,g=a+u;return a<0&&(a=0),g>e&&(g=e),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(g,e),a))}}function Ze(s,e){return s==null||e==null?s===e:s.top===e.top&&s.bottom===e.bottom}const He=1e3,Xe=He*4,Je=[0,1e-6,.99999,1],et={overscrollSize:He,intersectionObserverMargin:Xe,resizeDebugging:!1};let ue=0,tt=-1;var nt=class H{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++tt}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...et,...e}}setup(e,t){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Je,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{H.__STOP?(H.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:H.__lastScrollPosition}),I(this.computeRenderRangeAndEmit)):(H.__lastScrollPosition=this.getScrollTop(),H.__STOP=!0)};for(const[n,r]of this.connectQueue.entries())this.connect(n,r);this.connectQueue.clear(),this.markDOMDirty(),I(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),I(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=De({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const n=this.getScrollTop(),r=this.getHeight(),l=this.config.intersectionObserverMargin,u=n-l,h=n+r+l;return!(e<u-t||e>h)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(const n of e){const r=n.borderBoxSize[0].blockSize;this.root instanceof Document?r!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:r-ue,newSize:r}),ue=r)):n.target===this.root?r!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:r-ue,newSize:r}),ue=r))}t&&I(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+se(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),I(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),I(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{H.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,I(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{H.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,I(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{H.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,I(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(H.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let t=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const l=De({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&Ze(this.windowSpecs,l)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=l}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const n=this.getScrollAnchor(this.height),r=new Set;for(const l of e?this.observers.values():this.visibleInstances.values())l.onRender(e)&&r.add(l);for(const l of this.instancesChanged)r.has(l)||l.onRender(e)&&r.add(l);this.scrollFix(n);for(const l of r)l.reconcileHeights();t||=this.instancesChanged.size>0,t&&this.markDOMDirty(),(t||e)&&I(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:l,fileOffset:u,fileTypeOffset:h}=e;if(n!=null&&r!=null){const g=l.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(g instanceof HTMLElement){const m=se(g,t);if(m!==r){const S=m-r;this.applyScrollFix(S)}return}}const a=se(l,t);if(h==="top")a!==u&&this.applyScrollFix(a-u);else{const g=a+l.getBoundingClientRect().height;g!==u&&this.applyScrollFix(g-u)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const t=this.getScrollContainerElement();let n;for(const[r]of this.visibleInstances.entries()){const l=se(r,t),u=l+r.offsetHeight;let h,a;u<=0?(h=u,a="bottom"):(h=l,a="top");let g,m;if(u>0&&l<e)for(const L of r.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(L instanceof HTMLElement))continue;const B=L.dataset.lineIndex;if(B==null)continue;const j=se(L,t);if(!(j<0)){g=B,m=j;break}}if(n?.lineOffset!=null&&m==null)continue;let S=!1;(n==null||m!=null&&(n.lineOffset==null||m<n.lineOffset)||m==null&&n.lineOffset==null&&(h>=0&&(n.fileOffset<0||h<n.fileOffset)||h<0&&n.fileOffset<0&&h>n.fileOffset))&&(S=!0),S&&(n={fileElement:r,fileTypeOffset:a,fileOffset:h,lineIndex:g,lineOffset:m})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const r=this.observers.get(t);r!=null&&(n&&!this.visibleInstances.has(t)?(r.setVisibility(!0),this.visibleInstances.set(t,r),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(r.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&I(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function se(s,e){const t=s.getBoundingClientRect(),n=e?.getBoundingClientRect().top??0;return t.top-n}const pe=s=>{if(s.type==="new"){const e=Math.min(s.selection.start,s.selection.end),t=Math.max(s.selection.start,s.selection.end);return`new-comment-${s.selection.side??"additions"}-${e}-${t}`}return`draft-${s.draft.id}`},it=s=>{const{drafts:e,editingDraftId:t,selection:n}=s,r=[];for(const l of e){if(!Number.isFinite(l.endLine))continue;const u=Math.max(1,Math.floor(l.endLine)),h=l.side==="original"?"deletions":"additions";r.push({lineNumber:u,side:h,metadata:{type:l.id===t?"edit":"saved",draft:l}})}return n&&!t&&r.push({lineNumber:Math.max(n.start,n.end),side:n.side??"additions",metadata:{type:"new",selection:n}}),r};function rt(s){const e=s.trim();if(!e)return null;if(/^-?\d+(\.\d+)?$/.test(e)){const t=Number.parseFloat(e);return Number.isFinite(t)?t:null}if(e.endsWith("px")){const t=Number.parseFloat(e.slice(0,-2));return Number.isFinite(t)?t:null}return null}function ze(s){if(!(!s||s<=0))return Math.max(200,Math.floor(s))}function st(s){const{diffRootRef:e,drafts:t,selection:n,editingDraftId:r,commentText:l,onTextChange:u,fileLabel:h,onSave:a,onCancel:g,onEdit:m,onDelete:S}=s,[L,B]=F.useState(0),[j,X]=F.useState(null),b=F.useMemo(()=>!n||r?null:pe({type:"new",selection:n}),[r,n]),_=F.useMemo(()=>{const c=t.map(y=>pe({type:y.id===r?"edit":"saved",draft:y}));return b&&c.push(b),c},[t,r,b]),$=F.useCallback(c=>{const y=e.current;if(!y)return null;const w=y.querySelector("diffs-container");if(!(w instanceof HTMLElement))return null;const k=w.querySelector(`[data-annotation-id="${c}"]`);if(k instanceof HTMLElement)return k;const A=w.shadowRoot;return A?A.querySelector(`[data-annotation-id="${c}"]`):null},[e]);F.useEffect(()=>{if(_.length===0)return;let c=!1,y=0;const w=12,k=()=>{c||_.every(D=>!!$(D))||y>=w||(y+=1,requestAnimationFrame(()=>{c||(B(D=>D+1),k())}))};return k(),()=>{c=!0}},[_,$]),F.useEffect(()=>{const c=e.current;if(!c)return;const y=()=>{const k=getComputedStyle(c),A=rt(k.getPropertyValue("--oc-context-panel-width")),D=c.getBoundingClientRect(),N=A??D.width;X(N>0?N:null)};y();const w=new ResizeObserver(()=>{y()});return w.observe(c),window.addEventListener("resize",y),()=>{w.disconnect(),window.removeEventListener("resize",y)}},[e]);const G=F.useCallback(c=>{const w=e.current?.getBoundingClientRect(),k=c.closest("[data-annotation-content]"),A=k instanceof HTMLElement?k.getBoundingClientRect():c.getBoundingClientRect(),D=[A.width];w&&D.push(w.right-A.left);const N=D.filter(J=>Number.isFinite(J)&&J>0);return N.length>0?ze(Math.min(...N)):ze(j)},[e,j]);return O.jsxs(O.Fragment,{children:[t.map(c=>{const y=pe({type:c.id===r?"edit":"saved",draft:c}),w=$(y);if(!w)return null;const k=G(w);return c.id===r?we.createPortal(O.jsx(Ce,{initialText:l,onTextChange:u,fileLabel:h,lineRange:{start:c.startLine,end:c.endLine,side:c.side==="original"?"deletions":"additions"},isEditing:!0,onSave:a,onCancel:g,maxWidth:k}),w,`draft-edit-${c.id}`):we.createPortal(O.jsx(Ke,{draft:c,onEdit:()=>m(c),onDelete:()=>S(c),maxWidth:k}),w,`draft-card-${c.id}`)}),n&&!r&&b&&(()=>{const c=$(b);if(!c)return null;const y=G(c);return we.createPortal(O.jsx(Ce,{initialText:l,onTextChange:u,fileLabel:h,lineRange:n,isEditing:!1,onSave:a,onCancel:g,maxWidth:y}),c,b)})()]})}const Ie=5e5,ot=`
|
|
1
|
+
import{R as F,j as O,b as we,r as d}from"./vendor-react-DYyjh7Q0.js";import{B as $e}from"./web-components-CLirSfwt.js";import{f as Te}from"./computeVirtualFileMetrics-BPgZ_RSe.js";import{V as Ne,F as Be}from"./VirtualizedFileDiff-uKfnkQWb.js";import{bi as je,aV as Ue,ay as Ge,f as ke}from"./SessionSwitcherDropdown-C0OdvirK.js";import{am as Qe}from"./usePanelSlide-DCX8qQ4K.js";import{I as Ce,a as Ke,u as Ye}from"./useInlineCommentController-CHmIm0Rr.js";import{ensurePierreThemeRegistered as Me,getResolvedShikiTheme as Oe}from"./appThemeRegistry-BK0dHKa6.js";import{M as Le}from"./index-CH7o4-_q.js";const he=new Set;let Re=null;function I(s){he.add(s),Re??=requestAnimationFrame(Pe)}function Pe(s){const e=new Set(he);he.clear();for(const t of e)try{t(s)}catch(n){console.error(n)}he.size>0?Re=requestAnimationFrame(Pe):Re=null}function De({scrollTop:s,scrollHeight:e,height:t,fitPerfectly:n=!1,fitPerfectlyOverscroll:r=0,overscrollSize:l}){const u=t+l*2,h=n?t+r*2:u;if(e=Math.max(e,h),u>=e||n){const m=Math.max(s-r,0),S=Math.min(s+h,e);return{top:m,bottom:Math.max(S,m)}}let a=s+t/2-u/2,g=a+u;return a<0&&(a=0),g>e&&(g=e),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(g,e),a))}}function Ze(s,e){return s==null||e==null?s===e:s.top===e.top&&s.bottom===e.bottom}const He=1e3,Xe=He*4,Je=[0,1e-6,.99999,1],et={overscrollSize:He,intersectionObserverMargin:Xe,resizeDebugging:!1};let ue=0,tt=-1;var nt=class H{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++tt}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...et,...e}}setup(e,t){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Je,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{H.__STOP?(H.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:H.__lastScrollPosition}),I(this.computeRenderRangeAndEmit)):(H.__lastScrollPosition=this.getScrollTop(),H.__STOP=!0)};for(const[n,r]of this.connectQueue.entries())this.connect(n,r);this.connectQueue.clear(),this.markDOMDirty(),I(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),I(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=De({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const n=this.getScrollTop(),r=this.getHeight(),l=this.config.intersectionObserverMargin,u=n-l,h=n+r+l;return!(e<u-t||e>h)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(const n of e){const r=n.borderBoxSize[0].blockSize;this.root instanceof Document?r!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:r-ue,newSize:r}),ue=r)):n.target===this.root?r!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:r-ue,newSize:r}),ue=r))}t&&I(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+se(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),I(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),I(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{H.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,I(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{H.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,I(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{H.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,I(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(H.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let t=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const l=De({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&Ze(this.windowSpecs,l)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=l}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const n=this.getScrollAnchor(this.height),r=new Set;for(const l of e?this.observers.values():this.visibleInstances.values())l.onRender(e)&&r.add(l);for(const l of this.instancesChanged)r.has(l)||l.onRender(e)&&r.add(l);this.scrollFix(n);for(const l of r)l.reconcileHeights();t||=this.instancesChanged.size>0,t&&this.markDOMDirty(),(t||e)&&I(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:l,fileOffset:u,fileTypeOffset:h}=e;if(n!=null&&r!=null){const g=l.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(g instanceof HTMLElement){const m=se(g,t);if(m!==r){const S=m-r;this.applyScrollFix(S)}return}}const a=se(l,t);if(h==="top")a!==u&&this.applyScrollFix(a-u);else{const g=a+l.getBoundingClientRect().height;g!==u&&this.applyScrollFix(g-u)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const t=this.getScrollContainerElement();let n;for(const[r]of this.visibleInstances.entries()){const l=se(r,t),u=l+r.offsetHeight;let h,a;u<=0?(h=u,a="bottom"):(h=l,a="top");let g,m;if(u>0&&l<e)for(const L of r.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(L instanceof HTMLElement))continue;const B=L.dataset.lineIndex;if(B==null)continue;const j=se(L,t);if(!(j<0)){g=B,m=j;break}}if(n?.lineOffset!=null&&m==null)continue;let S=!1;(n==null||m!=null&&(n.lineOffset==null||m<n.lineOffset)||m==null&&n.lineOffset==null&&(h>=0&&(n.fileOffset<0||h<n.fileOffset)||h<0&&n.fileOffset<0&&h>n.fileOffset))&&(S=!0),S&&(n={fileElement:r,fileTypeOffset:a,fileOffset:h,lineIndex:g,lineOffset:m})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const r=this.observers.get(t);r!=null&&(n&&!this.visibleInstances.has(t)?(r.setVisibility(!0),this.visibleInstances.set(t,r),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(r.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&I(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function se(s,e){const t=s.getBoundingClientRect(),n=e?.getBoundingClientRect().top??0;return t.top-n}const pe=s=>{if(s.type==="new"){const e=Math.min(s.selection.start,s.selection.end),t=Math.max(s.selection.start,s.selection.end);return`new-comment-${s.selection.side??"additions"}-${e}-${t}`}return`draft-${s.draft.id}`},it=s=>{const{drafts:e,editingDraftId:t,selection:n}=s,r=[];for(const l of e){if(!Number.isFinite(l.endLine))continue;const u=Math.max(1,Math.floor(l.endLine)),h=l.side==="original"?"deletions":"additions";r.push({lineNumber:u,side:h,metadata:{type:l.id===t?"edit":"saved",draft:l}})}return n&&!t&&r.push({lineNumber:Math.max(n.start,n.end),side:n.side??"additions",metadata:{type:"new",selection:n}}),r};function rt(s){const e=s.trim();if(!e)return null;if(/^-?\d+(\.\d+)?$/.test(e)){const t=Number.parseFloat(e);return Number.isFinite(t)?t:null}if(e.endsWith("px")){const t=Number.parseFloat(e.slice(0,-2));return Number.isFinite(t)?t:null}return null}function ze(s){if(!(!s||s<=0))return Math.max(200,Math.floor(s))}function st(s){const{diffRootRef:e,drafts:t,selection:n,editingDraftId:r,commentText:l,onTextChange:u,fileLabel:h,onSave:a,onCancel:g,onEdit:m,onDelete:S}=s,[L,B]=F.useState(0),[j,X]=F.useState(null),b=F.useMemo(()=>!n||r?null:pe({type:"new",selection:n}),[r,n]),_=F.useMemo(()=>{const c=t.map(y=>pe({type:y.id===r?"edit":"saved",draft:y}));return b&&c.push(b),c},[t,r,b]),$=F.useCallback(c=>{const y=e.current;if(!y)return null;const w=y.querySelector("diffs-container");if(!(w instanceof HTMLElement))return null;const k=w.querySelector(`[data-annotation-id="${c}"]`);if(k instanceof HTMLElement)return k;const A=w.shadowRoot;return A?A.querySelector(`[data-annotation-id="${c}"]`):null},[e]);F.useEffect(()=>{if(_.length===0)return;let c=!1,y=0;const w=12,k=()=>{c||_.every(D=>!!$(D))||y>=w||(y+=1,requestAnimationFrame(()=>{c||(B(D=>D+1),k())}))};return k(),()=>{c=!0}},[_,$]),F.useEffect(()=>{const c=e.current;if(!c)return;const y=()=>{const k=getComputedStyle(c),A=rt(k.getPropertyValue("--oc-context-panel-width")),D=c.getBoundingClientRect(),N=A??D.width;X(N>0?N:null)};y();const w=new ResizeObserver(()=>{y()});return w.observe(c),window.addEventListener("resize",y),()=>{w.disconnect(),window.removeEventListener("resize",y)}},[e]);const G=F.useCallback(c=>{const w=e.current?.getBoundingClientRect(),k=c.closest("[data-annotation-content]"),A=k instanceof HTMLElement?k.getBoundingClientRect():c.getBoundingClientRect(),D=[A.width];w&&D.push(w.right-A.left);const N=D.filter(J=>Number.isFinite(J)&&J>0);return N.length>0?ze(Math.min(...N)):ze(j)},[e,j]);return O.jsxs(O.Fragment,{children:[t.map(c=>{const y=pe({type:c.id===r?"edit":"saved",draft:c}),w=$(y);if(!w)return null;const k=G(w);return c.id===r?we.createPortal(O.jsx(Ce,{initialText:l,onTextChange:u,fileLabel:h,lineRange:{start:c.startLine,end:c.endLine,side:c.side==="original"?"deletions":"additions"},isEditing:!0,onSave:a,onCancel:g,maxWidth:k}),w,`draft-edit-${c.id}`):we.createPortal(O.jsx(Ke,{draft:c,onEdit:()=>m(c),onDelete:()=>S(c),maxWidth:k}),w,`draft-card-${c.id}`)}),n&&!r&&b&&(()=>{const c=$(b);if(!c)return null;const y=G(c);return we.createPortal(O.jsx(Ce,{initialText:l,onTextChange:u,fileLabel:h,lineRange:n,isEditing:!1,onSave:a,onCancel:g,maxWidth:y}),c,b)})()]})}const Ie=5e5,ot=`
|
|
2
2
|
:host {
|
|
3
3
|
font-family: var(--font-mono);
|
|
4
4
|
font-size: var(--text-code);
|
|
@@ -133,4 +133,4 @@ import{R as F,j as O,b as we,r as d}from"./vendor-react-DYyjh7Q0.js";import{B as
|
|
|
133
133
|
}
|
|
134
134
|
`;function at(s){let e=2166136261;for(let t=0;t<s.length;t+=1)e^=s.charCodeAt(t),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16)}function Ae(s){const e=s.length>400?`${s.slice(0,200)}${s.slice(-200)}`:s;return`${s.length}:${at(e)}`}const ct=(s,e,t,n)=>{const r=n.side==="deletions",u=(t?(r?t.deletionLines:t.additionLines).join(""):r?s:e).split(`
|
|
135
135
|
`),h=Math.min(n.start,n.end),a=Math.max(n.start,n.end),g=Math.max(1,h),m=Math.min(u.length,a);return g>m?"":u.slice(g-1,m).join(`
|
|
136
|
-
`)},dt=(s,e)=>s===e?!0:!s||!e?!1:s.start===e.start&&s.end===e.end&&s.side===e.side,ut=s=>s==="auto"||s==="scroll"||s==="overlay",ft=s=>{let e=s?.parentElement??null;for(;e;){const t=window.getComputedStyle(e);if(ut(t.overflowY))return e;e=e.parentElement}return null},ht=(s,e)=>{if(!s||!e||typeof window>"u")return()=>{};const t=ft(s);if(!t)return()=>{};const n=e.getBoundingClientRect().height;if(!n)return()=>{};const r=s.getBoundingClientRect().top-t.getBoundingClientRect().top,l=e.style.minHeight;e.style.minHeight=`${Math.ceil(n)}px`;let u=!1;return()=>{if(u)return;u=!0,e.style.minHeight=l;const a=s.getBoundingClientRect().top-t.getBoundingClientRect().top-r;a&&(t.scrollTop+=a)}},pt=(s,e)=>{if(typeof window>"u")return()=>{};let t=null,n=null,r=!1;const l=()=>{r||(n?.disconnect(),n=null,t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{r||e()})}))},u=()=>s.querySelector("diffs-container")?.shadowRoot??void 0,h=(a=u())=>!!a?.querySelector("[data-line]");return h()?l():typeof MutationObserver<"u"?(n=new MutationObserver(()=>{const a=u();if(a){if(h(a)){l();return}n?.disconnect(),n=new MutationObserver(()=>{h(a)&&l()}),n.observe(a,{childList:!0,subtree:!0})}}),n.observe(s,{childList:!0,subtree:!0})):t=window.requestAnimationFrame(l),()=>{r=!0,n?.disconnect(),t!==null&&window.cancelAnimationFrame(t)}},fe=new WeakMap,mt={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function gt(s){const e=s.closest("[data-diff-virtual-root]");if(e instanceof HTMLElement){const t=e.querySelector("[data-diff-virtual-content]");return{key:e,root:e,content:t instanceof HTMLElement?t:void 0}}return{key:document,root:document,content:void 0}}function vt(s){if(typeof document>"u")return null;const e=gt(s);let t=fe.get(e.key);if(!t){const r=new nt;r.setup(e.root,e.content),t={virtualizer:r,refs:0},fe.set(e.key,t)}t.refs+=1;let n=!1;return{virtualizer:t.virtualizer,root:e.root,release:()=>{if(n)return;n=!0;const r=fe.get(e.key);r&&(r.refs-=1,!(r.refs>0)&&(r.virtualizer.cleanUp(),fe.delete(e.key)))}}}const yt=(s,e,t)=>{if(typeof window>"u")return()=>{};const n=[],r=()=>{try{s.rerender()}catch{}const l=e?.root;l instanceof HTMLElement?l.dispatchEvent(new Event("scroll",{bubbles:!1})):document.dispatchEvent(new Event("scroll",{bubbles:!1})),window.dispatchEvent(new Event("resize")),t()};return n.push(window.requestAnimationFrame(r)),n.push(window.requestAnimationFrame(()=>{n.push(window.requestAnimationFrame(r))})),()=>{for(const l of n)window.cancelAnimationFrame(l)}},Ot=({original:s,modified:e,fileDiff:t,language:n,fileName:r,renderSideBySide:l,wrapLines:u,layout:h="fill",enableComments:a=!0})=>{const g=je(),m=g?.currentTheme.metadata.variant==="dark",S=g?.availableThemes.find(i=>i.metadata.id===g.lightThemeId)??Le(!1),L=g?.availableThemes.find(i=>i.metadata.id===g.darkThemeId)??Le(!0),{isMobile:B}=Ue(),j=Ye({source:"diff",fileLabel:r||"unknown",language:n,getCodeForRange:i=>ct(s,e,t,i),toStoreRange:i=>({startLine:i.start,endLine:i.end,side:i.side==="deletions"?"original":"modified"}),fromDraftRange:i=>({start:i.startLine,end:i.endLine,side:i.side==="original"?"deletions":"additions"})}),{drafts:X,selection:b,setSelection:_,commentText:$,setCommentText:G,editingDraftId:c,saveComment:y,cancel:w,startEdit:k,deleteDraft:A}=j,D=d.useRef(null),N=d.useRef(null),J=d.useRef(""),ee=d.useRef(!1),oe=d.useRef(null);d.useEffect(()=>{D.current=b},[b]),d.useEffect(()=>{N.current=c},[c]),d.useEffect(()=>{J.current=$},[$]);const le=d.useCallback(i=>{if(!a||ee.current)return;const o=D.current;if(!(!i&&o&&J.current.trim())){if(B&&o&&i&&i.side===o.side){const f=Math.min(o.start,i.start),p=Math.max(o.end,i.end);_({...i,start:f,end:p})}else _(i);i&&(N.current||G(""))}},[a,B,G,_]),Fe=d.useCallback(()=>{w()},[w]),Se=d.useCallback(i=>{const o=document.createElement("div");o.style.position="relative";const f=pe(i.metadata);return o.dataset.annotationId=f,o.dataset.annotationSide=i.side,o.dataset.annotationLine=String(i.lineNumber),o},[]),_e=d.useCallback((i,o)=>{y(i,o??b??void 0)},[y,b]),We=d.useCallback(i=>{_(i);const o=P.current;if(o)try{ee.current=!0,o.setSelectedLines(i),oe.current=i}catch{}finally{ee.current=!1}},[_]),Ee=d.useCallback(i=>{const o=i.closest("[data-line-type]")?.getAttribute("data-line-type")??i.getAttribute("data-line-type");if(o==="change-deletion")return"deletions";if(o==="change-addition")return"additions";const f=i.getAttribute("data-column-side")??i.getAttribute("data-side")??i.closest("[data-column-side]")?.getAttribute("data-column-side");if(f==="deletions"||f==="left"||f==="original")return"deletions";if(f==="additions"||f==="right"||f==="modified")return"additions";const p=i.closest("[data-line-type]");if(p instanceof HTMLElement){const E=p.getBoundingClientRect(),v=i.getBoundingClientRect(),R=E.left+E.width/2;return v.left+v.width/2<R?"deletions":"additions"}return"additions"},[]);Me(S),Me(L);const Q=`${S.metadata.id}:${L.metadata.id}:${m?"dark":"light"}`,te=d.useMemo(()=>{if(t){const i=t.deletionLines.reduce((f,p)=>f+p.length,0),o=t.additionLines.reduce((f,p)=>f+p.length,0);return Math.max(i,o)>Ie}return Math.max(s.length,e.length)>Ie},[t,e.length,s.length]),ne=d.useRef(null),K=d.useRef(null),P=d.useRef(null),ie=d.useRef(null),me=d.useRef(null),ge=d.useRef(null),ve=d.useRef(void 0),ae=d.useRef(void 0),ce=d.useRef(void 0),de=d.useRef(void 0),[,ye]=F.useReducer(i=>i+1,0),Y=Qe(te?"unified":l?"split":"unified"),W=d.useMemo(()=>Oe(S),[S]),q=d.useMemo(()=>Oe(L),[L]);F.useLayoutEffect(()=>{const i=ne.current;if(!i)return;const o=i.querySelector("diffs-container");if(!o)return;const f=m?q:W,p=(qe,Ve)=>qe.colors?.[Ve],E=p(W,"terminal.ansiGreen"),v=p(W,"terminal.ansiRed"),R=p(W,"terminal.ansiBlue"),C=p(q,"terminal.ansiGreen"),M=p(q,"terminal.ansiRed"),z=p(q,"terminal.ansiBlue");o.style.setProperty("--shiki-light",W.fg),o.style.setProperty("--shiki-light-bg",W.bg),E&&o.style.setProperty("--shiki-light-addition-color",E),v&&o.style.setProperty("--shiki-light-deletion-color",v),R&&o.style.setProperty("--shiki-light-modified-color",R),o.style.setProperty("--shiki-dark",q.fg),o.style.setProperty("--shiki-dark-bg",q.bg),C&&o.style.setProperty("--shiki-dark-addition-color",C),M&&o.style.setProperty("--shiki-dark-deletion-color",M),z&&o.style.setProperty("--shiki-dark-modified-color",z),o.style.setProperty("--diffs-bg",f.bg),o.style.setProperty("--diffs-fg",f.fg);const x=m?C:E,V=m?M:v,Z=m?z:R;x&&o.style.setProperty("--diffs-addition-color-override",x),V&&o.style.setProperty("--diffs-deletion-color-override",V),Z&&o.style.setProperty("--diffs-modified-color-override",Z);const T=o.shadowRoot?.querySelector("pre");T&&(T.style.setProperty("--shiki-light",W.fg),T.style.setProperty("--shiki-light-bg",W.bg),E&&T.style.setProperty("--shiki-light-addition-color",E),v&&T.style.setProperty("--shiki-light-deletion-color",v),R&&T.style.setProperty("--shiki-light-modified-color",R),T.style.setProperty("--shiki-dark",q.fg),T.style.setProperty("--shiki-dark-bg",q.bg),C&&T.style.setProperty("--shiki-dark-addition-color",C),M&&T.style.setProperty("--shiki-dark-deletion-color",M),z&&T.style.setProperty("--shiki-dark-modified-color",z),T.style.setProperty("--diffs-bg",f.bg),T.style.setProperty("--diffs-fg",f.fg),x&&T.style.setProperty("--diffs-addition-color-override",x),V&&T.style.setProperty("--diffs-deletion-color-override",V),Z&&T.style.setProperty("--diffs-modified-color-override",Z))},[q,Q,m,W]);const U=d.useMemo(()=>({theme:{dark:L.metadata.id,light:S.metadata.id},themeType:m?"dark":"light",diffStyle:l?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",maxLineDiffLength:te?0:1e3,maxLineLengthForHighlighting:te?1:1e3,tokenizeMaxLineLength:te?1:1e3,collapsedContextThreshold:0,expansionLineCount:20,overflow:u?"wrap":"scroll",disableFileHeader:!0,enableLineSelection:a,enableHoverUtility:!1,onLineSelected:a?le:void 0,unsafeCSS:lt,renderAnnotation:a?Se:void 0}),[L.metadata.id,a,m,te,S.metadata.id,l,u,le,Se]),re=d.useMemo(()=>a?it({drafts:X,editingDraftId:c,selection:b}):[],[c,a,X,b]),be=d.useRef(re);if(d.useEffect(()=>{be.current=re},[re]),d.useEffect(()=>{const i=K.current;return()=>{P.current?.cleanUp(),P.current=null,ie.current?.release(),ie.current=null,me.current=null,ge.current=null,ve.current=void 0,ae.current=void 0,ce.current=void 0,de.current=void 0,i&&(i.innerHTML="")}},[]),d.useEffect(()=>{if(typeof window>"u")return;const i=K.current,o=ne.current;if(!i||!Y)return;const f=ht(o,i);let p=ie.current;p||(p=vt(i),ie.current=p),ie.current=p;const E=p?.virtualizer??null,v=t?void 0:{name:r||"",contents:s,lang:n,cacheKey:`old:${Q}:${r}:${Ae(s)}`},R=t?void 0:{name:r||"",contents:e,lang:n,cacheKey:`new:${Q}:${r}:${Ae(e)}`},C=t?ae.current!==t:ae.current!==void 0||!v||!R||!ce.current||!de.current||!Te(ce.current,v)||!Te(de.current,R),M=P.current,z=!!(M&&(me.current!==E||ge.current!==Y||E&&(ve.current!==U.hunkSeparators||C)));z&&(M?.cleanUp(),P.current=null,i.innerHTML="");let x=P.current;const V=!z&&M?!$e(M.options,U):!1;if(x?x.setOptions(U):(x=p?new Ne(U,p.virtualizer,mt,Y):new Be(U,Y),P.current=x,oe.current=null),me.current=E,ge.current=Y,ve.current=E?U.hunkSeparators:void 0,ae.current=t,ce.current=v,de.current=R,t)x.render({fileDiff:t,forceRender:V,lineAnnotations:be.current,containerWrapper:i});else{if(!v||!R)return;x.render({oldFile:v,newFile:R,forceRender:V,lineAnnotations:be.current,containerWrapper:i})}const Z=pt(i,()=>{f(),yt(x,p,ye)});return()=>{Z(),f()}},[Q,t,r,n,e,U,s,Y]),d.useEffect(()=>{const i=P.current;if(i){try{i.setLineAnnotations(re)}catch(o){console.error("Failed to apply diff line annotations",o);try{i.setLineAnnotations([])}catch{}}requestAnimationFrame(()=>{if(P.current===i){try{i.rerender()}catch{}ye()}})}},[re]),d.useEffect(()=>{const i=P.current;if(!i||b!==null)return;const o=oe.current;if(!dt(b,o))try{ee.current=!0,i.setSelectedLines(b),oe.current=b}catch{}finally{ee.current=!1}},[b]),d.useEffect(()=>{if(!a)return;const i=K.current;if(!i)return;let o=null,f=()=>{};const p=()=>{const v=i.querySelector("diffs-container")?.shadowRoot;if(!v){o=requestAnimationFrame(p);return}const R=C=>{if(!(C instanceof MouseEvent)||C.button!==0||!(C.target instanceof Element))return;const M=C.target.closest("[data-column-number]");if(!(M instanceof HTMLElement))return;const z=M.getAttribute("data-column-number"),x=z?parseInt(z,10):NaN;if(Number.isNaN(x))return;const V=Ee(M);le({start:x,end:x,side:V}),C.preventDefault(),C.stopPropagation()};v.addEventListener("click",R,!0),f=()=>{v.removeEventListener("click",R,!0)}};return p(),()=>{o!==null&&cancelAnimationFrame(o),f()}},[Q,a,r,le,Ee]),d.useEffect(()=>{const i=K.current;if(!i)return;let o=null,f=null;const E=setTimeout(()=>{const v=i.querySelector("diffs-container");if(!(v instanceof HTMLElement))return;const R=v.shadowRoot;o=new MutationObserver(()=>{f&&cancelAnimationFrame(f),f=requestAnimationFrame(()=>{ye(),f=null})}),o.observe(v,{childList:!0,subtree:!0}),R&&o.observe(R,{childList:!0,subtree:!0})},100);return()=>{clearTimeout(E),f&&cancelAnimationFrame(f),o?.disconnect()}},[Q,r]),typeof window>"u")return null;const xe=a?O.jsx(st,{diffRootRef:ne,drafts:X,selection:b,editingDraftId:c,commentText:$,onTextChange:G,fileLabel:r?.split("/").pop()??"",onSave:_e,onCancel:Fe,onEdit:i=>{We({start:i.startLine,end:i.endLine,side:i.side==="original"?"deletions":"additions"}),k(i)},onDelete:A}):null;return h==="fill"?O.jsx("div",{className:ke("flex flex-col relative","size-full"),"data-diff-virtual-root":!0,children:O.jsxs("div",{className:"flex-1 relative min-h-0",children:[O.jsx(Ge,{outerClassName:"pierre-diff-wrapper size-full",disableHorizontal:!1,fillContainer:!0,"data-diff-virtual-content":!0,children:O.jsx("div",{ref:ne,className:"size-full relative",children:O.jsx("div",{ref:K,className:"size-full"})})}),xe]})}):O.jsxs("div",{className:ke("relative","w-full"),children:[O.jsx("div",{ref:ne,className:"pierre-diff-wrapper w-full overflow-x-auto overflow-y-visible relative",children:O.jsx("div",{ref:K,className:"w-full"})}),xe]})};export{Ot as P};
|
|
136
|
+
`)},dt=(s,e)=>s===e?!0:!s||!e?!1:s.start===e.start&&s.end===e.end&&s.side===e.side,ut=s=>s==="auto"||s==="scroll"||s==="overlay",ft=s=>{let e=s?.parentElement??null;for(;e;){const t=window.getComputedStyle(e);if(ut(t.overflowY))return e;e=e.parentElement}return null},ht=(s,e)=>{if(!s||!e||typeof window>"u")return()=>{};const t=ft(s);if(!t)return()=>{};const n=e.getBoundingClientRect().height;if(!n)return()=>{};const r=s.getBoundingClientRect().top-t.getBoundingClientRect().top,l=e.style.minHeight;e.style.minHeight=`${Math.ceil(n)}px`;let u=!1;return()=>{if(u)return;u=!0,e.style.minHeight=l;const a=s.getBoundingClientRect().top-t.getBoundingClientRect().top-r;a&&(t.scrollTop+=a)}},pt=(s,e)=>{if(typeof window>"u")return()=>{};let t=null,n=null,r=!1;const l=()=>{r||(n?.disconnect(),n=null,t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{r||e()})}))},u=()=>s.querySelector("diffs-container")?.shadowRoot??void 0,h=(a=u())=>!!a?.querySelector("[data-line]");return h()?l():typeof MutationObserver<"u"?(n=new MutationObserver(()=>{const a=u();if(a){if(h(a)){l();return}n?.disconnect(),n=new MutationObserver(()=>{h(a)&&l()}),n.observe(a,{childList:!0,subtree:!0})}}),n.observe(s,{childList:!0,subtree:!0})):t=window.requestAnimationFrame(l),()=>{r=!0,n?.disconnect(),t!==null&&window.cancelAnimationFrame(t)}},fe=new WeakMap,mt={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function gt(s){const e=s.closest("[data-diff-virtual-root]");if(e instanceof HTMLElement){const t=e.querySelector("[data-diff-virtual-content]");return{key:e,root:e,content:t instanceof HTMLElement?t:void 0}}return{key:document,root:document,content:void 0}}function vt(s){if(typeof document>"u")return null;const e=gt(s);let t=fe.get(e.key);if(!t){const r=new nt;r.setup(e.root,e.content),t={virtualizer:r,refs:0},fe.set(e.key,t)}t.refs+=1;let n=!1;return{virtualizer:t.virtualizer,root:e.root,release:()=>{if(n)return;n=!0;const r=fe.get(e.key);r&&(r.refs-=1,!(r.refs>0)&&(r.virtualizer.cleanUp(),fe.delete(e.key)))}}}const yt=(s,e,t)=>{if(typeof window>"u")return()=>{};const n=[],r=()=>{try{s.rerender()}catch{}const l=e?.root;l instanceof HTMLElement?l.dispatchEvent(new Event("scroll",{bubbles:!1})):document.dispatchEvent(new Event("scroll",{bubbles:!1})),window.dispatchEvent(new Event("resize")),t()};return n.push(window.requestAnimationFrame(r)),n.push(window.requestAnimationFrame(()=>{n.push(window.requestAnimationFrame(r))})),()=>{for(const l of n)window.cancelAnimationFrame(l)}},Ot=({original:s,modified:e,fileDiff:t,language:n,fileName:r,renderSideBySide:l,wrapLines:u,layout:h="fill",enableComments:a=!0})=>{const g=je(),m=g?.currentTheme.metadata.variant==="dark",S=g?.availableThemes.find(i=>i.metadata.id===g.lightThemeId)??Le(!1),L=g?.availableThemes.find(i=>i.metadata.id===g.darkThemeId)??Le(!0),{isMobile:B}=Ue(),j=Ye({source:"diff",fileLabel:r||"unknown",language:n,getCodeForRange:i=>ct(s,e,t,i),toStoreRange:i=>({startLine:i.start,endLine:i.end,side:i.side==="deletions"?"original":"modified"}),fromDraftRange:i=>({start:i.startLine,end:i.endLine,side:i.side==="original"?"deletions":"additions"})}),{drafts:X,selection:b,setSelection:_,commentText:$,setCommentText:G,editingDraftId:c,saveComment:y,cancel:w,startEdit:k,deleteDraft:A}=j,D=d.useRef(null),N=d.useRef(null),J=d.useRef(""),ee=d.useRef(!1),oe=d.useRef(null);d.useEffect(()=>{D.current=b},[b]),d.useEffect(()=>{N.current=c},[c]),d.useEffect(()=>{J.current=$},[$]);const le=d.useCallback(i=>{if(!a||ee.current)return;const o=D.current;if(!(!i&&o&&J.current.trim())){if(B&&o&&i&&i.side===o.side){const f=Math.min(o.start,i.start),p=Math.max(o.end,i.end);_({...i,start:f,end:p})}else _(i);i&&(N.current||G(""))}},[a,B,G,_]),Fe=d.useCallback(()=>{w()},[w]),Se=d.useCallback(i=>{const o=document.createElement("div");o.style.position="relative";const f=pe(i.metadata);return o.dataset.annotationId=f,o.dataset.annotationSide=i.side,o.dataset.annotationLine=String(i.lineNumber),o},[]),_e=d.useCallback((i,o)=>{y(i,o??b??void 0)},[y,b]),We=d.useCallback(i=>{_(i);const o=P.current;if(o)try{ee.current=!0,o.setSelectedLines(i),oe.current=i}catch{}finally{ee.current=!1}},[_]),Ee=d.useCallback(i=>{const o=i.closest("[data-line-type]")?.getAttribute("data-line-type")??i.getAttribute("data-line-type");if(o==="change-deletion")return"deletions";if(o==="change-addition")return"additions";const f=i.getAttribute("data-column-side")??i.getAttribute("data-side")??i.closest("[data-column-side]")?.getAttribute("data-column-side");if(f==="deletions"||f==="left"||f==="original")return"deletions";if(f==="additions"||f==="right"||f==="modified")return"additions";const p=i.closest("[data-line-type]");if(p instanceof HTMLElement){const E=p.getBoundingClientRect(),v=i.getBoundingClientRect(),R=E.left+E.width/2;return v.left+v.width/2<R?"deletions":"additions"}return"additions"},[]);Me(S),Me(L);const Q=`${S.metadata.id}:${L.metadata.id}:${m?"dark":"light"}`,te=d.useMemo(()=>{if(t){const i=t.deletionLines.reduce((f,p)=>f+p.length,0),o=t.additionLines.reduce((f,p)=>f+p.length,0);return Math.max(i,o)>Ie}return Math.max(s.length,e.length)>Ie},[t,e.length,s.length]),ne=d.useRef(null),K=d.useRef(null),P=d.useRef(null),ie=d.useRef(null),me=d.useRef(null),ge=d.useRef(null),ve=d.useRef(void 0),ae=d.useRef(void 0),ce=d.useRef(void 0),de=d.useRef(void 0),[,ye]=F.useReducer(i=>i+1,0),Y=Qe(te?"unified":l?"split":"unified"),W=d.useMemo(()=>Oe(S),[S]),q=d.useMemo(()=>Oe(L),[L]);F.useLayoutEffect(()=>{const i=ne.current;if(!i)return;const o=i.querySelector("diffs-container");if(!o)return;const f=m?q:W,p=(qe,Ve)=>qe.colors?.[Ve],E=p(W,"terminal.ansiGreen"),v=p(W,"terminal.ansiRed"),R=p(W,"terminal.ansiBlue"),C=p(q,"terminal.ansiGreen"),M=p(q,"terminal.ansiRed"),z=p(q,"terminal.ansiBlue");o.style.setProperty("--shiki-light",W.fg),o.style.setProperty("--shiki-light-bg",W.bg),E&&o.style.setProperty("--shiki-light-addition-color",E),v&&o.style.setProperty("--shiki-light-deletion-color",v),R&&o.style.setProperty("--shiki-light-modified-color",R),o.style.setProperty("--shiki-dark",q.fg),o.style.setProperty("--shiki-dark-bg",q.bg),C&&o.style.setProperty("--shiki-dark-addition-color",C),M&&o.style.setProperty("--shiki-dark-deletion-color",M),z&&o.style.setProperty("--shiki-dark-modified-color",z),o.style.setProperty("--diffs-bg",f.bg),o.style.setProperty("--diffs-fg",f.fg);const x=m?C:E,V=m?M:v,Z=m?z:R;x&&o.style.setProperty("--diffs-addition-color-override",x),V&&o.style.setProperty("--diffs-deletion-color-override",V),Z&&o.style.setProperty("--diffs-modified-color-override",Z);const T=o.shadowRoot?.querySelector("pre");T&&(T.style.setProperty("--shiki-light",W.fg),T.style.setProperty("--shiki-light-bg",W.bg),E&&T.style.setProperty("--shiki-light-addition-color",E),v&&T.style.setProperty("--shiki-light-deletion-color",v),R&&T.style.setProperty("--shiki-light-modified-color",R),T.style.setProperty("--shiki-dark",q.fg),T.style.setProperty("--shiki-dark-bg",q.bg),C&&T.style.setProperty("--shiki-dark-addition-color",C),M&&T.style.setProperty("--shiki-dark-deletion-color",M),z&&T.style.setProperty("--shiki-dark-modified-color",z),T.style.setProperty("--diffs-bg",f.bg),T.style.setProperty("--diffs-fg",f.fg),x&&T.style.setProperty("--diffs-addition-color-override",x),V&&T.style.setProperty("--diffs-deletion-color-override",V),Z&&T.style.setProperty("--diffs-modified-color-override",Z))},[q,Q,m,W]);const U=d.useMemo(()=>({theme:{dark:L.metadata.id,light:S.metadata.id},themeType:m?"dark":"light",diffStyle:l?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",maxLineDiffLength:te?0:1e3,maxLineLengthForHighlighting:te?1:1e3,tokenizeMaxLineLength:te?1:1e3,collapsedContextThreshold:0,expansionLineCount:20,overflow:u?"wrap":"scroll",disableFileHeader:!0,enableLineSelection:a,enableHoverUtility:!1,onLineSelected:a?le:void 0,unsafeCSS:lt,renderAnnotation:a?Se:void 0}),[L.metadata.id,a,m,te,S.metadata.id,l,u,le,Se]),re=d.useMemo(()=>a?it({drafts:X,editingDraftId:c,selection:b}):[],[c,a,X,b]),be=d.useRef(re);if(d.useEffect(()=>{be.current=re},[re]),d.useEffect(()=>{const i=K.current;return()=>{P.current?.cleanUp(),P.current=null,ie.current?.release(),ie.current=null,me.current=null,ge.current=null,ve.current=void 0,ae.current=void 0,ce.current=void 0,de.current=void 0,i&&(i.innerHTML="")}},[]),d.useEffect(()=>{if(typeof window>"u")return;const i=K.current,o=ne.current;if(!i||!Y)return;const f=ht(o,i);let p=ie.current;p||(p=vt(i),ie.current=p),ie.current=p;const E=p?.virtualizer??null,v=t?void 0:{name:r||"",contents:s,lang:n,cacheKey:`old:${Q}:${r}:${Ae(s)}`},R=t?void 0:{name:r||"",contents:e,lang:n,cacheKey:`new:${Q}:${r}:${Ae(e)}`},C=t?ae.current!==t:ae.current!==void 0||!v||!R||!ce.current||!de.current||!Te(ce.current,v)||!Te(de.current,R),M=P.current,z=!!(M&&(me.current!==E||ge.current!==Y||E&&(ve.current!==U.hunkSeparators||C)));z&&(M?.cleanUp(),P.current=null,i.innerHTML="");let x=P.current;const V=!z&&M?!$e(M.options,U):!1;if(x?x.setOptions(U):(x=p?new Ne(U,p.virtualizer,mt,Y):new Be(U,Y),P.current=x,oe.current=null),me.current=E,ge.current=Y,ve.current=E?U.hunkSeparators:void 0,ae.current=t,ce.current=v,de.current=R,t)x.render({fileDiff:t,forceRender:V,lineAnnotations:be.current,containerWrapper:i});else{if(!v||!R)return;x.render({oldFile:v,newFile:R,forceRender:V,lineAnnotations:be.current,containerWrapper:i})}const Z=pt(i,()=>{f(),yt(x,p,ye)});return()=>{Z(),f()}},[Q,t,r,n,e,U,s,Y]),d.useEffect(()=>{const i=P.current;if(i){try{i.setLineAnnotations(re)}catch(o){console.error("Failed to apply diff line annotations",o);try{i.setLineAnnotations([])}catch{}}requestAnimationFrame(()=>{if(P.current===i){try{i.rerender()}catch{}ye()}})}},[re]),d.useEffect(()=>{const i=P.current;if(!i||b!==null)return;const o=oe.current;if(!dt(b,o))try{ee.current=!0,i.setSelectedLines(b),oe.current=b}catch{}finally{ee.current=!1}},[b]),d.useEffect(()=>{if(!a)return;const i=K.current;if(!i)return;let o=null,f=()=>{};const p=()=>{const v=i.querySelector("diffs-container")?.shadowRoot;if(!v){o=requestAnimationFrame(p);return}const R=C=>{if(!(C instanceof MouseEvent)||C.button!==0||!(C.target instanceof Element))return;const M=C.target.closest("[data-column-number]");if(!(M instanceof HTMLElement))return;const z=M.getAttribute("data-column-number"),x=z?parseInt(z,10):NaN;if(Number.isNaN(x))return;const V=Ee(M);le({start:x,end:x,side:V}),C.preventDefault(),C.stopPropagation()};v.addEventListener("click",R,!0),f=()=>{v.removeEventListener("click",R,!0)}};return p(),()=>{o!==null&&cancelAnimationFrame(o),f()}},[Q,a,r,le,Ee]),d.useEffect(()=>{const i=K.current;if(!i)return;let o=null,f=null;const E=setTimeout(()=>{const v=i.querySelector("diffs-container");if(!(v instanceof HTMLElement))return;const R=v.shadowRoot;o=new MutationObserver(()=>{f&&cancelAnimationFrame(f),f=requestAnimationFrame(()=>{ye(),f=null})}),o.observe(v,{childList:!0,subtree:!0}),R&&o.observe(R,{childList:!0,subtree:!0})},100);return()=>{clearTimeout(E),f&&cancelAnimationFrame(f),o?.disconnect()}},[Q,r]),typeof window>"u")return null;const xe=a?O.jsx(st,{diffRootRef:ne,drafts:X,selection:b,editingDraftId:c,commentText:$,onTextChange:G,fileLabel:r?.split("/").pop()??"",onSave:_e,onCancel:Fe,onEdit:i=>{We({start:i.startLine,end:i.endLine,side:i.side==="original"?"deletions":"additions"}),k(i)},onDelete:A}):null;return h==="fill"?O.jsx("div",{className:ke("flex flex-col relative","size-full"),"data-diff-virtual-root":!0,children:O.jsxs("div",{className:"flex-1 relative min-h-0",children:[O.jsx(Ge,{outerClassName:"pierre-diff-wrapper size-full",disableHorizontal:!1,fillContainer:!0,"data-diff-virtual-content":!0,children:O.jsx("div",{ref:ne,className:"size-full relative",children:O.jsx("div",{ref:K,className:"size-full"})})}),xe]})}):O.jsxs("div",{className:ke("relative","w-full"),children:[O.jsx("div",{ref:ne,className:"pierre-diff-wrapper w-full overflow-x-auto overflow-y-visible relative","data-no-drawer-swipe":"true",children:O.jsx("div",{ref:K,className:"w-full"})}),xe]})};export{Ot as P};
|