t3 0.0.3 → 0.0.4
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/client/assets/DiffPanel-DxvQMXZW.js +1491 -0
- package/dist/client/assets/{angular-html-shv80_GZ.js → angular-html-PO6YH8f-.js} +1 -1
- package/dist/client/assets/{angular-ts-BjWAylHW.js → angular-ts-DaJ2RvnO.js} +1 -1
- package/dist/client/assets/{apl-CkYWz8C0.js → apl-zEuTt-He.js} +1 -1
- package/dist/client/assets/{astro-CXyQY2Fi.js → astro-DwysnkhD.js} +1 -1
- package/dist/client/assets/{blade-CDM8qZbe.js → blade-GgAGAlM8.js} +1 -1
- package/dist/client/assets/{c-CUmJm7m_.js → c-DzeHBMp7.js} +1 -1
- package/dist/client/assets/{cobol-wxQNEWxu.js → cobol-iVCIJtWR.js} +1 -1
- package/dist/client/assets/{coffee-2P2zwF_h.js → coffee-BxMkYhOP.js} +1 -1
- package/dist/client/assets/{cpp-BTyeRVXV.js → cpp-BEfmDGKr.js} +1 -1
- package/dist/client/assets/{crystal-frSE8Mxi.js → crystal-CGJ9U7K8.js} +1 -1
- package/dist/client/assets/{css-BgTyfICB.js → css-D-J6muk9.js} +1 -1
- package/dist/client/assets/{edge-BY65SEnm.js → edge-B5l1ep6K.js} +1 -1
- package/dist/client/assets/{elixir-BLt8zeU8.js → elixir-DT7C4nRI.js} +1 -1
- package/dist/client/assets/{elm-CsZMXfMm.js → elm-DacHZu0P.js} +1 -1
- package/dist/client/assets/{erb-D78ZlEy1.js → erb-B4qeW_5R.js} +1 -1
- package/dist/client/assets/{git-rebase-DvAgC2qb.js → git-rebase-Dk3SbS0p.js} +1 -1
- package/dist/client/assets/{glimmer-js-ComKKhUt.js → glimmer-js-DEVFfhxl.js} +1 -1
- package/dist/client/assets/{glimmer-ts-CHaw-kHb.js → glimmer-ts-CsEJRls5.js} +1 -1
- package/dist/client/assets/{glsl-CzysIiSS.js → glsl-Im5_mbH8.js} +1 -1
- package/dist/client/assets/{graphql-JB5TILB9.js → graphql-DrNOYYdo.js} +1 -1
- package/dist/client/assets/{hack-BBDevESF.js → hack-D53MnsWT.js} +1 -1
- package/dist/client/assets/{haml-RVvrlpmx.js → haml-B4euY0vY.js} +1 -1
- package/dist/client/assets/{handlebars-B6i0Kg7r.js → handlebars-CtMln1GB.js} +1 -1
- package/dist/client/assets/{html-Cqmhl3Dv.js → html-B7CTON1n.js} +1 -1
- package/dist/client/assets/{html-derivative-D3F6P6wT.js → html-derivative-DwHkcKJ3.js} +1 -1
- package/dist/client/assets/{http-94c20x_x.js → http-BmGf_D9h.js} +1 -1
- package/dist/client/assets/{hurl-CoBvslGX.js → hurl-nnTeLb9y.js} +1 -1
- package/dist/client/assets/index-D2CnaX3V.css +1 -0
- package/dist/client/assets/{index-CWbABLMQ.js → index-nhQz5h-9.js} +79 -79
- package/dist/client/assets/{java-NRmbTstg.js → java-d7p4YLBX.js} +1 -1
- package/dist/client/assets/{javascript-clEikEAO.js → javascript-BcWERNKv.js} +1 -1
- package/dist/client/assets/{jinja-Zxps0pS4.js → jinja-CB7zbi6K.js} +1 -1
- package/dist/client/assets/{jison-CW-VQKc0.js → jison-BBAjjhmY.js} +1 -1
- package/dist/client/assets/{json-t_Zs8_eG.js → json-CNf-D-Ai.js} +1 -1
- package/dist/client/assets/{jsx-CUmrXn6v.js → jsx-DdT20ddY.js} +1 -1
- package/dist/client/assets/{julia-BZtXsPO1.js → julia-Bp0laiQT.js} +1 -1
- package/dist/client/assets/{just-DbayLjXg.js → just-C2n1JzZf.js} +1 -1
- package/dist/client/assets/{latex-Bx9vQriq.js → latex-BX6qSGK7.js} +1 -1
- package/dist/client/assets/{liquid-B9_lc15A.js → liquid-DgouKodz.js} +1 -1
- package/dist/client/assets/{lua-D7ivNc2F.js → lua-B-JF8LJ7.js} +1 -1
- package/dist/client/assets/{marko-CKTUP3wb.js → marko-DdaUBozC.js} +1 -1
- package/dist/client/assets/{mdc-DFmdtGcy.js → mdc-Tak-aC9z.js} +1 -1
- package/dist/client/assets/{nginx-B6XJm_FX.js → nginx-C26ntnSE.js} +1 -1
- package/dist/client/assets/{nim-D0sDLUjH.js → nim-KDX5BPuj.js} +1 -1
- package/dist/client/assets/{perl-BPnjaHZd.js → perl-BwpIuvHY.js} +1 -1
- package/dist/client/assets/{php-xnmFg-xe.js → php-CmeyInUZ.js} +1 -1
- package/dist/client/assets/{pug-C-ps4Q3A.js → pug-t16F4unN.js} +1 -1
- package/dist/client/assets/{qml-Blgq0sES.js → qml-DKXIwoU2.js} +1 -1
- package/dist/client/assets/{r-Bw2YX0iz.js → r-Bm5SLw35.js} +1 -1
- package/dist/client/assets/{razor-CVMxbgJD.js → razor-Cg7E03DE.js} +1 -1
- package/dist/client/assets/{regexp-BfboaxDC.js → regexp-B4BXgdkL.js} +1 -1
- package/dist/client/assets/{rst-DSEOyg4a.js → rst-CErMU3C_.js} +1 -1
- package/dist/client/assets/{ruby-BHaAeBnD.js → ruby-C-LB4XJd.js} +1 -1
- package/dist/client/assets/{sas-De8g3GnH.js → sas-KXri-Pyv.js} +1 -1
- package/dist/client/assets/{scss-WFF9AEc1.js → scss-5RriKTs7.js} +1 -1
- package/dist/client/assets/{shellscript-D0b3xhF8.js → shellscript-d2-2QqxY.js} +1 -1
- package/dist/client/assets/{shellsession-CEPeMTvi.js → shellsession-BBXyPthj.js} +1 -1
- package/dist/client/assets/{soy-CkuE1c8h.js → soy-B5WN_6xP.js} +1 -1
- package/dist/client/assets/{sql-CBLYRRTG.js → sql-ByWEVmCC.js} +1 -1
- package/dist/client/assets/{stata-CHnQmpJo.js → stata-ZtX2PbNh.js} +1 -1
- package/dist/client/assets/{surrealql-2jE3UuBR.js → surrealql-DIyL-cuf.js} +1 -1
- package/dist/client/assets/{svelte-18k8aay7.js → svelte-Dv8xlo7a.js} +1 -1
- package/dist/client/assets/{templ-C_KMacdx.js → templ-DEm7cZue.js} +1 -1
- package/dist/client/assets/{tex-BVp_GiMd.js → tex-GXsn56xP.js} +1 -1
- package/dist/client/assets/{ts-tags-Bi_bBn8w.js → ts-tags-ByCXY4T3.js} +1 -1
- package/dist/client/assets/{tsx-B7mt-RUJ.js → tsx-By_LD9k9.js} +1 -1
- package/dist/client/assets/{twig-DhHOZ6Vd.js → twig-Du6sgCzz.js} +1 -1
- package/dist/client/assets/{typescript-LV7sesr2.js → typescript-DodIuvim.js} +1 -1
- package/dist/client/assets/{vue-mzEQ7_PJ.js → vue-D-NASAgP.js} +1 -1
- package/dist/client/assets/{vue-html-UCqCdVGl.js → vue-html-xVY24NdN.js} +1 -1
- package/dist/client/assets/{vue-vine-Dnznzfmf.js → vue-vine-D6iwmyYT.js} +1 -1
- package/dist/client/assets/{xml-3N76prFb.js → xml-Bnub5Bnx.js} +1 -1
- package/dist/client/assets/{xsl-Ckd3D0dQ.js → xsl-gWFBcUcI.js} +1 -1
- package/dist/client/assets/{yaml-det4gTgr.js → yaml-Bh8YueBH.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/index.cjs +96 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +96 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/DiffPanel-D4FZnMmT.js +0 -1491
- package/dist/client/assets/index-DtnLdTtl.css +0 -1
|
@@ -0,0 +1,1491 @@
|
|
|
1
|
+
import{$ as e,A as t,At as n,B as r,Bt as i,C as a,Ct as o,D as s,Dt as c,E as l,Et as u,F as d,Ft as f,G as p,Gt as m,H as h,Ht as g,I as _,It as v,J as y,Jt as b,K as x,Kt as S,L as C,Lt as w,M as T,Mt as E,N as D,Nt as O,O as k,Ot as A,P as j,Pt as M,Q as N,R as P,Rt as ee,S as F,St as te,T as I,Tt as ne,U as re,Ut as ie,V as ae,Vt as oe,W as se,Wt as ce,X as L,Y as le,Z as R,_ as ue,_t as de,a as fe,at as z,b as pe,bt as me,c as B,ct as he,d as ge,dt as V,et as H,f as U,ft as _e,g as ve,gt as ye,h as be,ht as xe,i as Se,it as Ce,j as we,jt as Te,k as Ee,kt as De,l as Oe,lt as ke,mt as Ae,n as je,nt as Me,o as Ne,ot as Pe,p as Fe,pt as Ie,q as Le,r as Re,rt as ze,s as Be,st as Ve,t as He,tt as Ue,u as We,ut as Ge,v as Ke,vt as qe,w as Je,wt as Ye,x as Xe,xt as Ze,y as Qe,yt as $e,z as et,zt as tt}from"./index-nhQz5h-9.js";var nt=me(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),rt=me(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),it={position:`absolute`,top:0,bottom:0,textAlign:`center`};function W(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}var G=m();function at(e,t){return typeof window>`u`&&t!=null?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,G.jsx)(G.Fragment,{children:e})}var K=new Set,q=new Set,ot=null,st=!1;function J(e){if(st){K.add(e);return}q.add(e),ot??=requestAnimationFrame(ct)}function ct(e){st=!0;for(let t of q)try{t(e)}catch(e){console.error(e)}q.clear(),K.size>0?(q=new Set(K),K.clear(),ot=requestAnimationFrame(ct)):ot=null,st=!1}function lt(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}function ut({scrollTop:e,scrollHeight:t,height:n,containerOffset:r=0,fitPerfectly:i,overscrollSize:a}){let o=n+a*2,s=i?n:o;if(t=Math.max(t,s),o>=t||i){let n=Math.max(e-r,0),i=Math.min(e+s,t)-r;return{top:n,bottom:Math.max(i,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c-r,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t)-r,c))}}var dt=1e3,ft=dt*4,pt=[0,1e-6,.99999,1],mt={overscrollSize:dt,intersectionObserverMargin:ft,resizeDebugging:!1},ht=0,gt=-1,_t=class e{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++gt}`;config;type=`basic`;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={...mt,...e}}setup(t,n){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:pt,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:e.__lastScrollPosition}),J(this.computeRenderRangeAndEmit)):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)};for(let[e,t]of this.connectQueue.entries())this.connect(e,t);this.connectQueue.clear(),this.markDOMDirty(),J(this.computeRenderRangeAndEmit)}}instanceChanged(e){this.instancesChanged.add(e),this.markDOMDirty(),J(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=ut({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),fitPerfectly:!1,overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){let n=this.getScrollTop(),r=this.getHeight(),i=this.config.intersectionObserverMargin,a=n-i,o=n+r+i;return!(e<a-t||e>o)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(let n of e){let e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: content size change`,this.__id,{sizeChange:e-ht,newSize:e}),ht=e)):n.target===this.root?e!==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:e-ht,newSize:e}),ht=e))}t&&J(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw 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 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()+Y(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw 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(),J(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){let 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(),J(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{e.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,J(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{e.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,J(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{e.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,J(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(e.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;if(this.instancesChanged.size===0){let e=ut({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),fitPerfectly:!1,overscrollSize:this.config.overscrollSize});if(lt(this.windowSpecs,e)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;this.windowSpecs=e}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let n=this.getScrollAnchor(this.height),r=new Set;for(let e of t?this.observers.values():this.visibleInstances.values())e.onRender(t)&&r.add(e);for(let e of this.instancesChanged)r.has(e)||e.onRender(t)&&r.add(e);this.scrollFix(n),this.instancesChanged.size>0&&this.markDOMDirty();for(let e of r)e.reconcileHeights();(this.instancesChanged.size>0||t)&&J(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;let t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:i,fileOffset:a,fileTypeOffset:o}=e;if(n!=null&&r!=null){let e=i.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(e instanceof HTMLElement){let n=Y(e,t);if(n!==r){let e=n-r;this.applyScrollFix(e)}return}}let s=Y(i,t);if(o===`top`)s!==a&&this.applyScrollFix(s-a);else{let e=s+i.getBoundingClientRect().height;e!==a&&this.applyScrollFix(e-a)}}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){let t=this.getScrollContainerElement(),n;for(let[r]of this.visibleInstances.entries()){let i=Y(r,t),a=i+r.offsetHeight,o,s;a<=0?(o=a,s=`bottom`):(o=i,s=`top`);let c,l;if(a>0&&i<e)for(let e of r.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`)??[]){if(!(e instanceof HTMLElement))continue;let n=e.dataset.lineIndex;if(n==null)continue;let r=Y(e,t);if(!(r<0)){c=n,l=r;break}}if(n?.lineOffset!=null&&l==null)continue;let u=!1;(n==null||l!=null&&(n.lineOffset==null||l<n.lineOffset)||l==null&&n.lineOffset==null&&(o>=0&&(n.fileOffset<0||o<n.fileOffset)||o<0&&n.fileOffset<0&&o>n.fileOffset))&&(u=!0),u&&(n={fileElement:r,fileTypeOffset:s,fileOffset:o,lineIndex:c,lineOffset:l})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(let{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw Error(`Virtualizer.handleIntersectionChange: target not an HTMLElement`);let e=this.observers.get(t);if(e==null)throw Error(`Virtualizer.handleIntersectionChange: no instance for target`);n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0)}this.visibleInstancesDirty&&J(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 Y(e,t){let n=e.getBoundingClientRect(),r=t?.getBoundingClientRect().top??0;return n.top-r}var X=b(S(),1),vt=(0,X.createContext)(void 0);function yt({children:e,config:t,className:n,style:r,contentClassName:i,contentStyle:a}){let[o]=(0,X.useState)(()=>typeof window<`u`?new _t(t):void 0),s=(0,X.useCallback)(e=>{e==null?o?.cleanUp():o?.setup(e)},[o]);return(0,G.jsx)(vt.Provider,{value:o,children:(0,G.jsx)(`div`,{className:n,style:r,ref:s,children:(0,G.jsx)(`div`,{className:i,style:a,children:e})})})}function bt(){return(0,X.useContext)(vt)}function xt(e){let t=(0,X.useRef)(e);return(0,X.useInsertionEffect)(()=>void(t.current=e)),(0,X.useCallback)((...e)=>t.current(...e),[])}function St(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Ct(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function wt(){return _({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[C({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}var Tt=class{hoveredLine;pre;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.detachDocumentPointerListeners(),this.clearPointerSession(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection()}setSelectionDirty(){this.renderedSelectionRange=void 0}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e){let t=!(e===this.selectedRange||Ct(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!t||(this.selectedRange=e,this.renderSelection(),t&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{if(this.hoveredLine!=null){if(this.mode===`diff`&&this.hoveredLine.type===`diff-line`)return{lineNumber:this.hoveredLine.lineNumber,side:this.hoveredLine.annotationSide};if(this.mode===`file`&&this.hoveredLine.type===`line`)return{lineNumber:this.hoveredLine.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r}=this.options;t==null&&n==null&&r==null||this.options.onGutterUtilityClick!=null&&jt(e.composedPath())||(Q(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e}))};handlePointerMove=e=>{let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,enableGutterUtility:i=!1}=this.options;t===`disabled`&&!i&&n==null&&r==null||(Q(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Q(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null){Q(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no .hoveredLine`);return}this.gutterUtilityContainer?.remove(),this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();Q(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Q(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onHunkExpand:l}=this.options;switch(e){case`move`:if(Z(i)&&this.hoveredLine?.lineElement===i.lineElement)break;this.hoveredLine!=null&&(this.gutterUtilityContainer?.remove(),c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Z(i)&&(this.setHoveredLine(this.toEventBaseProps(i)),this.gutterUtilityContainer!=null&&i.numberElement.appendChild(this.gutterUtilityContainer),s?.({...this.hoveredLine,event:t}));break;case`click`:{if(i==null)break;if(Ot(i)&&l!=null){l(i.hunkIndex,i.direction,t.shiftKey);break}if(!Z(i))break;let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onHunkExpand:s,enableGutterUtility:c=!1,enableLineSelection:l=!1,onGutterUtilityClick:u}=this.options,d=u!=null,f=n!==`disabled`||r!=null||i!=null||s!=null||a!=null||o!=null||c||l||d;f&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,Q(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),s!=null&&e.push(`expandable hunk separators`)),e})()),Q(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Q(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!f&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let p=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,m=this.pointerSession.mode===`gutterSelecting`;(!l&&p||!d&&m)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();jt(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e,t):this.startLineSelectionFromPointerDown(e,t)};startLineSelectionFromPointerDown(e,t){let{enableLineSelection:n=!1}=this.options;if(!n)return;let r=this.getSelectionPointerInfo(t,!0);if(r==null)return;let{pre:i}=this;if(i==null)return;e.preventDefault();let{lineNumber:a,eventSide:o,lineIndex:s}=r;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,i.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?s>=t.start:s<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(a,o,!1),this.notifySelectionStart(this.selectedRange),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===a&&this.selectedRange?.end===a){let t={lineNumber:a,side:o};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.selectedRange=null,this.selectionAnchor={lineNumber:a,side:o},this.updateSelection(a,o,!1),this.notifySelectionStart(this.selectedRange),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e,t){let{enableLineSelection:n=!1,onGutterUtilityClick:r}=this.options;if(r==null)return;let i=this.getSelectionPointFromPath(t);i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:i},n&&(this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.selectedRange)),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{let{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;let n=this.getSelectionPointFromPath(e.composedPath());if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;let t=this.getSelectionPointerInfo(e.composedPath(),!1);if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;let t=this.getSelectionPointerInfo(e.composedPath(),!1);if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(St(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.selectedRange),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;let r=this.getSelectionPointFromPath(e.composedPath());r!=null&&(this.pointerSession.current=r,t&&this.updateSelection(r.lineNumber,r.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=p(wt());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}getSelectionPointerInfo(e,t){let n=this.resolvePointerTarget(e);if(Z(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}getSelectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Z(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}updateSelection(e,t,n=!0){let{selectedRange:r}=this,i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}Ct(r??void 0,i??void 0)||(this.selectedRange=i,n&&this.notifySelectionChangeDelta(),this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection))}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;let e=this.pre.querySelectorAll(`[data-selected-line]`);for(let t of e)t.removeAttribute(`data-selected-line`);if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;let{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let n=this.pre.getAttribute(`data-diff-type`)===`split`,r=this.getIndexesFromSelection(this.selectedRange,n);if(r==null)throw console.error({rowRange:r,selectedRange:this.selectedRange}),Error(`InteractionManager.renderSelection: No valid rowRange`);let i=r.start===r.end,a=Math.min(r.start,r.end),o=Math.max(r.start,r.end);for(let e of t){let[t,r]=e.children,s=r.children.length;if(s!==t.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);for(let e=0;e<s;e++){let s=r.children[e],c=t.children[e];if(!(s instanceof HTMLElement)||!(c instanceof HTMLElement))continue;let l=this.parseLineIndex(s,n);if((l??0)>o)break;if(l==null||l<a)continue;let u=i?`single`:l===a?`first`:l===o?`last`:``;s.setAttribute(`data-selected-line`,u),c.setAttribute(`data-selected-line`,u),c.nextSibling instanceof HTMLElement&&s.nextSibling instanceof HTMLElement&&s.nextSibling.hasAttribute(`data-line-annotation`)&&(i?(u=`last`,s.setAttribute(`data-selected-line`,`first`)):l===a?u=``:l===o&&s.setAttribute(`data-selected-line`,``),s.nextSibling.setAttribute(`data-selected-line`,u),c.nextSibling.setAttribute(`data-selected-line`,u))}}};notifySelectionCommitted(){this.options.onLineSelected?.(this.selectedRange??null)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.selectedRange??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c;for(let l of e){if(!(l instanceof HTMLElement))continue;let e=o==null?l.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=l,c=Number.parseInt(e,10),t=!0,n=At(l),a=l.getAttribute(`data-line-index`)??void 0;continue}let u=i==null?l.getAttribute(`data-line`)??void 0:void 0;if(u!=null){i=l,c=Number.parseInt(u,10),n=At(l),a=l.getAttribute(`data-line-index`)??void 0;continue}if(s==null&&l.hasAttribute(`data-expand-button`)){s={hunkIndex:void 0,direction:l.hasAttribute(`data-expand-up`)?`up`:l.hasAttribute(`data-expand-down`)?`down`:`both`};continue}let d=s==null?void 0:l.getAttribute(`data-expand-index`)??void 0;if(s!=null&&d!=null){let e=Number.parseInt(d,10);Number.isNaN(e)||(s.hunkIndex=e);continue}if(r==null&&l.hasAttribute(`data-code`)){r=l;break}}if(s?.hunkIndex!=null)return{type:`line-info`,hunkIndex:s.hunkIndex,direction:s.direction};if(i??=a==null?void 0:kt(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:kt(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||c==null||Number.isNaN(c))return;let l=this.parseLineIndex(i,this.isSplitDiff());if(this.mode===`file`)return{kind:`line`,lineType:n,lineElement:i,lineNumber:c,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:l};let u=(()=>{switch(n){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return r.hasAttribute(`data-deletions`)?`deletions`:`additions`}})();return{kind:`line`,lineType:n,lineElement:i,lineNumber:c,numberColumn:t,numberElement:o,side:u,splitLineIndex:l}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Et({enableGutterUtility:e,enableHoverUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,renderGutterUtility:c,renderHoverUtility:l,__debugPointerEvents:u,enableLineSelection:d,onLineSelected:f,onLineSelectionStart:p,onLineSelectionChange:m,onLineSelectionEnd:h},g,_){return{enableGutterUtility:Dt({enableGutterUtility:e,enableHoverUtility:t,renderGutterUtility:c,renderHoverUtility:l,onGutterUtilityClick:r}),usesCustomGutterUtility:c!=null||l!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:g,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,__debugPointerEvents:u,enableLineSelection:d,onLineSelected:f,onLineSelectionStart:p,onLineSelectionChange:m,onLineSelectionEnd:h,getLineIndex:_}}function Dt({enableGutterUtility:e,enableHoverUtility:t,renderGutterUtility:n,renderHoverUtility:r,onGutterUtilityClick:i}){if(e!==void 0&&t!==void 0)throw Error(`Cannot use both 'enableGutterUtility' and deprecated 'enableHoverUtility'. Use only 'enableGutterUtility'.`);if(n!=null&&r!=null)throw Error(`Cannot use both 'renderGutterUtility' and deprecated 'renderHoverUtility'. Use only 'renderGutterUtility'.`);if(i!=null&&(n!=null||r!=null))throw Error(`Cannot use both 'onGutterUtilityClick' and render utility callbacks ('renderGutterUtility'/'renderHoverUtility'). Use only one gutter utility API.`);return e??t??!1}function Z(e){return e!=null&&`kind`in e&&e.kind===`line`}function Ot(e){return`type`in e&&e.type===`line-info`}function kt(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function At(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function jt(e){for(let t of e)if(t instanceof HTMLElement&&t.hasAttribute(`data-utility-button`))return!0;return!1}function Q(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return;break}console.log(...n)}var Mt=class{observedNodes=new Map;timeoutID;queuedUpdates=new Map;cleanUp(){this.resizeObserver?.disconnect(),this.observedNodes.clear(),this.timeoutID!=null&&clearTimeout(this.timeoutID)}resizeObserver;setup(e,t){this.resizeObserver??=new ResizeObserver(this.handleResizeObserver);let n=e.querySelectorAll(`code`),r=new Map(this.observedNodes);this.observedNodes.clear();for(let e of n){let t=r.get(e);if(t!=null){this.observedNodes.set(e,t),r.delete(e);continue}let n=e.querySelector(`[data-gutter]`);n instanceof HTMLElement||(n=null),t={type:`code`,codeElement:e,numberElement:n,codeWidth:`auto`,numberWidth:0},this.observedNodes.set(e,t),this.resizeObserver.observe(e),n!=null&&(this.observedNodes.set(n,t),this.resizeObserver.observe(n))}if(n.length>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let{lineAnnotation:t=``}=e.dataset;if(!/^\d+,\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,o=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(o instanceof HTMLElement))continue;let s=r.get(a);if(s!=null){this.observedNodes.set(a,s),this.observedNodes.set(o,s),r.delete(a),r.delete(o);continue}s={type:`annotations`,column1:{container:n,child:a,childHeight:a.getBoundingClientRect().height},column2:{container:i,child:o,childHeight:o.getBoundingClientRect().height},currentHeight:`auto`};let c=Math.max(s.column1.childHeight,s.column2.childHeight);this.applyNewHeight(s,c),this.observedNodes.set(a,s),this.observedNodes.set(o,s),this.resizeObserver.observe(a),this.resizeObserver.observe(o)}}for(let e of r.keys())e.isConnected&&(e.style.removeProperty(`--diffs-column-content-width`),e.style.removeProperty(`--diffs-column-number-width`),e.style.removeProperty(`--diffs-column-width`),e.parentElement instanceof HTMLElement&&e.parentElement.style.removeProperty(`--diffs-annotation-min-height`)),this.resizeObserver.unobserve(e);r.clear()}handleResizeObserver=e=>{for(let t of e){let{target:e,borderBoxSize:n}=t;if(!(e instanceof HTMLElement)){console.error(`FileDiff.handleResizeObserver: Invalid element for ResizeObserver`,t);continue}let r=this.observedNodes.get(e);if(r==null){console.error(`FileDiff.handleResizeObserver: Not a valid observed node`,t);continue}let i=n[0];if(r.type===`annotations`){let t=(()=>{if(e===r.column1.child)return r.column1;if(e===r.column2.child)return r.column2})();if(t==null){console.error(`FileDiff.handleResizeObserver: Couldn't find a column for`,{item:r,target:e});continue}t.childHeight=i.blockSize;let n=Math.max(r.column1.childHeight,r.column2.childHeight);this.applyNewHeight(r,n)}else r.type===`code`&&(this.queuedUpdates.set(e,[r,i]),this.queueColumnUpdate())}};queueColumnUpdate(){this.timeoutID!=null&&clearTimeout(this.timeoutID),this.timeoutID=setTimeout(this.handleColumnChange,1e3/30)}handleColumnChange=()=>{this.timeoutID=void 0;for(let[e,[t,n]]of this.queuedUpdates)if(e===t.codeElement){let e=Math.max(Math.floor(n.inlineSize),0);if(e!==t.codeWidth){t.codeWidth=e;let n=Math.max(t.codeWidth-t.numberWidth,0);t.codeElement.style.setProperty(`--diffs-column-content-width`,`${n===0?`auto`:`${n}px`}`),t.codeElement.style.setProperty(`--diffs-column-width`,`${t.codeWidth===0?`auto`:`${t.codeWidth}px`}`)}}else if(e===t.numberElement){let e=Math.max(Math.ceil(n.inlineSize),0);if(e!==t.numberWidth&&(t.numberWidth=e,t.codeElement.style.setProperty(`--diffs-column-number-width`,`${t.numberWidth===0?`auto`:`${t.numberWidth}px`}`),t.codeWidth!==`auto`)){let e=Math.max(t.codeWidth-t.numberWidth,0);t.codeElement.style.setProperty(`--diffs-column-content-width`,`${e===0?`auto`:`${e}px`}`)}}this.queuedUpdates.clear()};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function Nt(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function Pt(e){for(let t of Array.isArray(e)?e:[e])if(!x.has(t))return!1;return!0}function Ft(e){for(let t of h(e))if(!Le.has(t))return!1;return!0}function It(e){return _({tagName:`div`,children:[_({tagName:`div`,children:e.annotations?.map(e=>_({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Lt(e,t){return _({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function Rt(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function zt({fileOrDiff:e,themeStyles:t,themeType:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":``,"data-change-type":r?.type,"data-theme-type":n===`system`?void 0:n,style:t};return _({tagName:`div`,children:[Bt({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),Vt(r)],properties:i})}function Bt({name:e,prevName:t,iconType:n}){let r=[_({tagName:`slot`,properties:{name:Ve}}),C({name:Rt(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(_({tagName:`div`,children:[P(t)],properties:{"data-prev-name":``}})),r.push(C({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(_({tagName:`div`,children:[P(e)],properties:{"data-title":``}})),_({tagName:`div`,children:r,properties:{"data-header-content":``}})}function Vt(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(_({tagName:`span`,children:[P(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(_({tagName:`span`,children:[P(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(_({tagName:`slot`,properties:{name:Pe}})),_({tagName:`div`,children:t,properties:{"data-metadata":``}})}function Ht(e){return _({tagName:`pre`,properties:Ut(e)})}function Ut({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,themeType:a,themeStyles:o,totalLines:s,type:c}){let l={"data-diff":c===`diff`?``:void 0,"data-file":c===`file`?``:void 0,"data-diff-type":c===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,"data-theme-type":a===`system`?void 0:a,style:o,tabIndex:0};return l.style+=`--diffs-min-number-column-width-default:${`${s}`.length}ch;`,l}function Wt(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:h(t),preferredHighlighter:n}}var Gt=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
2
|
+
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
3
|
+
<path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
|
|
4
|
+
</symbol>
|
|
5
|
+
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
6
|
+
<path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>
|
|
7
|
+
</symbol>
|
|
8
|
+
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
9
|
+
<path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>
|
|
10
|
+
</symbol>
|
|
11
|
+
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
12
|
+
<path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>
|
|
13
|
+
</symbol>
|
|
14
|
+
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
15
|
+
<path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>
|
|
16
|
+
</symbol>
|
|
17
|
+
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
18
|
+
<path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>
|
|
19
|
+
</symbol>
|
|
20
|
+
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
21
|
+
<path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>
|
|
22
|
+
</symbol>
|
|
23
|
+
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
24
|
+
<path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>
|
|
25
|
+
</symbol>
|
|
26
|
+
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
27
|
+
<path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>
|
|
28
|
+
</symbol>
|
|
29
|
+
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
30
|
+
<path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>
|
|
31
|
+
</symbol>
|
|
32
|
+
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
33
|
+
<path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
34
|
+
</symbol>
|
|
35
|
+
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
36
|
+
<path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
37
|
+
</symbol>
|
|
38
|
+
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
39
|
+
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
|
|
40
|
+
</symbol>
|
|
41
|
+
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
42
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
|
|
43
|
+
</symbol>
|
|
44
|
+
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
45
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>
|
|
46
|
+
</symbol>
|
|
47
|
+
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
48
|
+
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
|
|
49
|
+
</symbol>
|
|
50
|
+
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
51
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
|
|
52
|
+
</symbol>
|
|
53
|
+
</svg>`;function Kt(e,t){return e==null||t==null?e===t:e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.themeStyles===t.themeStyles&&e.themeType===t.themeType&&e.totalLines===t.totalLines}function qt(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function Jt(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e}function Yt(){let e=document.createElement(`style`);return e.setAttribute(_e,``),e}var Xt=`@layer base, theme, unsafe;
|
|
54
|
+
|
|
55
|
+
@layer base {
|
|
56
|
+
:host {
|
|
57
|
+
--diffs-bg: #fff;
|
|
58
|
+
--diffs-fg: #000;
|
|
59
|
+
--diffs-font-fallback:
|
|
60
|
+
'SF Mono', Monaco, Consolas, 'Ubuntu Mono', 'Liberation Mono',
|
|
61
|
+
'Courier New', monospace;
|
|
62
|
+
--diffs-header-font-fallback:
|
|
63
|
+
system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
64
|
+
'Noto Sans', 'Liberation Sans', Arial, sans-serif;
|
|
65
|
+
|
|
66
|
+
--diffs-mixer: light-dark(black, white);
|
|
67
|
+
--diffs-gap-fallback: 8px;
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
// Available CSS Color Overrides
|
|
71
|
+
--diffs-bg-buffer-override
|
|
72
|
+
--diffs-bg-hover-override
|
|
73
|
+
--diffs-bg-context-override
|
|
74
|
+
--diffs-bg-separator-override
|
|
75
|
+
|
|
76
|
+
--diffs-fg-number-override
|
|
77
|
+
--diffs-fg-number-addition-override
|
|
78
|
+
--diffs-fg-number-deletion-override
|
|
79
|
+
|
|
80
|
+
--diffs-deletion-color-override
|
|
81
|
+
--diffs-addition-color-override
|
|
82
|
+
--diffs-modified-color-override
|
|
83
|
+
|
|
84
|
+
--diffs-bg-deletion-override
|
|
85
|
+
--diffs-bg-deletion-number-override
|
|
86
|
+
--diffs-bg-deletion-hover-override
|
|
87
|
+
--diffs-bg-deletion-emphasis-override
|
|
88
|
+
|
|
89
|
+
--diffs-bg-addition-override
|
|
90
|
+
--diffs-bg-addition-number-override
|
|
91
|
+
--diffs-bg-addition-hover-override
|
|
92
|
+
--diffs-bg-addition-emphasis-override
|
|
93
|
+
|
|
94
|
+
// Line Selection Color Overrides (for enableLineSelection)
|
|
95
|
+
--diffs-selection-color-override
|
|
96
|
+
--diffs-bg-selection-override
|
|
97
|
+
--diffs-bg-selection-number-override
|
|
98
|
+
--diffs-bg-selection-background-override
|
|
99
|
+
--diffs-bg-selection-number-background-override
|
|
100
|
+
|
|
101
|
+
// Available CSS Layout Overrides
|
|
102
|
+
--diffs-gap-inline
|
|
103
|
+
--diffs-gap-block
|
|
104
|
+
--diffs-gap-style
|
|
105
|
+
--diffs-tab-size
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
color-scheme: light dark;
|
|
109
|
+
display: block;
|
|
110
|
+
font-family: var(
|
|
111
|
+
--diffs-header-font-family,
|
|
112
|
+
var(--diffs-header-font-fallback)
|
|
113
|
+
);
|
|
114
|
+
font-size: var(--diffs-font-size, 13px);
|
|
115
|
+
line-height: var(--diffs-line-height, 20px);
|
|
116
|
+
font-feature-settings: var(--diffs-font-features);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* NOTE(mdo): Some semantic HTML elements (e.g. \`pre\`, \`code\`) have default
|
|
120
|
+
* user-agent styles. These must be overridden to use our custom styles. */
|
|
121
|
+
pre,
|
|
122
|
+
code,
|
|
123
|
+
[data-error-wrapper] {
|
|
124
|
+
isolation: isolate;
|
|
125
|
+
margin: 0;
|
|
126
|
+
padding: 0;
|
|
127
|
+
display: block;
|
|
128
|
+
outline: none;
|
|
129
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
pre,
|
|
133
|
+
code {
|
|
134
|
+
background-color: var(--diffs-bg);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
code {
|
|
138
|
+
contain: content;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
*,
|
|
142
|
+
*::before,
|
|
143
|
+
*::after {
|
|
144
|
+
box-sizing: border-box;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
[data-icon-sprite] {
|
|
148
|
+
display: none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* NOTE(mdo): Headers and separators are within pre/code, so we need to reset
|
|
152
|
+
* their font-family explicitly. */
|
|
153
|
+
[data-diffs-header],
|
|
154
|
+
[data-separator] {
|
|
155
|
+
font-family: var(
|
|
156
|
+
--diffs-header-font-family,
|
|
157
|
+
var(--diffs-header-font-fallback)
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
[data-file-info] {
|
|
162
|
+
padding: 10px;
|
|
163
|
+
font-weight: 700;
|
|
164
|
+
color: var(--fg);
|
|
165
|
+
/* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor
|
|
166
|
+
* and vscode use an older build of chrome that appears to have a bug with
|
|
167
|
+
* color-mix and 'in oklch', so use 'in lab' instead */
|
|
168
|
+
background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
|
|
169
|
+
border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
[data-diffs-header],
|
|
173
|
+
[data-diff],
|
|
174
|
+
[data-file],
|
|
175
|
+
[data-error-wrapper],
|
|
176
|
+
[data-virtualizer-buffer] {
|
|
177
|
+
--diffs-bg: light-dark(var(--diffs-light-bg), var(--diffs-dark-bg));
|
|
178
|
+
/* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor
|
|
179
|
+
* and vscode use an older build of chrome that appears to have a bug with
|
|
180
|
+
* color-mix and 'in oklch', so use 'in lab' instead */
|
|
181
|
+
--diffs-bg-buffer: var(
|
|
182
|
+
--diffs-bg-buffer-override,
|
|
183
|
+
light-dark(
|
|
184
|
+
color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)),
|
|
185
|
+
color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))
|
|
186
|
+
)
|
|
187
|
+
);
|
|
188
|
+
--diffs-bg-hover: var(
|
|
189
|
+
--diffs-bg-hover-override,
|
|
190
|
+
light-dark(
|
|
191
|
+
color-mix(in lab, var(--diffs-bg) 97%, var(--diffs-mixer)),
|
|
192
|
+
color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-mixer))
|
|
193
|
+
)
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
--diffs-bg-context: var(
|
|
197
|
+
--diffs-bg-context-override,
|
|
198
|
+
light-dark(
|
|
199
|
+
color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)),
|
|
200
|
+
color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))
|
|
201
|
+
)
|
|
202
|
+
);
|
|
203
|
+
--diffs-bg-context-number: var(
|
|
204
|
+
--diffs-bg-context-number-override,
|
|
205
|
+
light-dark(
|
|
206
|
+
color-mix(in lab, var(--diffs-bg-context) 80%, var(--diffs-bg)),
|
|
207
|
+
color-mix(in lab, var(--diffs-bg-context) 60%, var(--diffs-bg))
|
|
208
|
+
)
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
--diffs-bg-separator: var(
|
|
212
|
+
--diffs-bg-separator-override,
|
|
213
|
+
light-dark(
|
|
214
|
+
color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)),
|
|
215
|
+
color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))
|
|
216
|
+
)
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
--diffs-fg: light-dark(var(--diffs-light), var(--diffs-dark));
|
|
220
|
+
--diffs-fg-number: var(
|
|
221
|
+
--diffs-fg-number-override,
|
|
222
|
+
light-dark(
|
|
223
|
+
color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)),
|
|
224
|
+
color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))
|
|
225
|
+
)
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
--diffs-deletion-base: var(
|
|
229
|
+
--diffs-deletion-color-override,
|
|
230
|
+
light-dark(
|
|
231
|
+
var(
|
|
232
|
+
--diffs-light-deletion-color,
|
|
233
|
+
var(--diffs-deletion-color, rgb(255, 0, 0))
|
|
234
|
+
),
|
|
235
|
+
var(
|
|
236
|
+
--diffs-dark-deletion-color,
|
|
237
|
+
var(--diffs-deletion-color, rgb(255, 0, 0))
|
|
238
|
+
)
|
|
239
|
+
)
|
|
240
|
+
);
|
|
241
|
+
--diffs-addition-base: var(
|
|
242
|
+
--diffs-addition-color-override,
|
|
243
|
+
light-dark(
|
|
244
|
+
var(
|
|
245
|
+
--diffs-light-addition-color,
|
|
246
|
+
var(--diffs-addition-color, rgb(0, 255, 0))
|
|
247
|
+
),
|
|
248
|
+
var(
|
|
249
|
+
--diffs-dark-addition-color,
|
|
250
|
+
var(--diffs-addition-color, rgb(0, 255, 0))
|
|
251
|
+
)
|
|
252
|
+
)
|
|
253
|
+
);
|
|
254
|
+
--diffs-modified-base: var(
|
|
255
|
+
--diffs-modified-color-override,
|
|
256
|
+
light-dark(
|
|
257
|
+
var(
|
|
258
|
+
--diffs-light-modified-color,
|
|
259
|
+
var(--diffs-modified-color, rgb(0, 0, 255))
|
|
260
|
+
),
|
|
261
|
+
var(
|
|
262
|
+
--diffs-dark-modified-color,
|
|
263
|
+
var(--diffs-modified-color, rgb(0, 0, 255))
|
|
264
|
+
)
|
|
265
|
+
)
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
/* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor
|
|
269
|
+
* and vscode use an older build of chrome that appears to have a bug with
|
|
270
|
+
* color-mix and 'in oklch', so use 'in lab' instead */
|
|
271
|
+
--diffs-bg-deletion: var(
|
|
272
|
+
--diffs-bg-deletion-override,
|
|
273
|
+
light-dark(
|
|
274
|
+
color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)),
|
|
275
|
+
color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))
|
|
276
|
+
)
|
|
277
|
+
);
|
|
278
|
+
--diffs-bg-deletion-number: var(
|
|
279
|
+
--diffs-bg-deletion-number-override,
|
|
280
|
+
light-dark(
|
|
281
|
+
color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-deletion-base)),
|
|
282
|
+
color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-deletion-base))
|
|
283
|
+
)
|
|
284
|
+
);
|
|
285
|
+
--diffs-bg-deletion-hover: var(
|
|
286
|
+
--diffs-bg-deletion-hover-override,
|
|
287
|
+
light-dark(
|
|
288
|
+
color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base)),
|
|
289
|
+
color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-deletion-base))
|
|
290
|
+
)
|
|
291
|
+
);
|
|
292
|
+
--diffs-bg-deletion-emphasis: var(
|
|
293
|
+
--diffs-bg-deletion-emphasis-override,
|
|
294
|
+
light-dark(
|
|
295
|
+
rgb(from var(--diffs-deletion-base) r g b / 0.15),
|
|
296
|
+
rgb(from var(--diffs-deletion-base) r g b / 0.2)
|
|
297
|
+
)
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
--diffs-bg-addition: var(
|
|
301
|
+
--diffs-bg-addition-override,
|
|
302
|
+
light-dark(
|
|
303
|
+
color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)),
|
|
304
|
+
color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))
|
|
305
|
+
)
|
|
306
|
+
);
|
|
307
|
+
--diffs-bg-addition-number: var(
|
|
308
|
+
--diffs-bg-addition-number-override,
|
|
309
|
+
light-dark(
|
|
310
|
+
color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-addition-base)),
|
|
311
|
+
color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-addition-base))
|
|
312
|
+
)
|
|
313
|
+
);
|
|
314
|
+
--diffs-bg-addition-hover: var(
|
|
315
|
+
--diffs-bg-addition-hover-override,
|
|
316
|
+
light-dark(
|
|
317
|
+
color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base)),
|
|
318
|
+
color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-addition-base))
|
|
319
|
+
)
|
|
320
|
+
);
|
|
321
|
+
--diffs-bg-addition-emphasis: var(
|
|
322
|
+
--diffs-bg-addition-emphasis-override,
|
|
323
|
+
light-dark(
|
|
324
|
+
rgb(from var(--diffs-addition-base) r g b / 0.15),
|
|
325
|
+
rgb(from var(--diffs-addition-base) r g b / 0.2)
|
|
326
|
+
)
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
--diffs-selection-base: var(--diffs-modified-base);
|
|
330
|
+
--diffs-selection-number-fg: light-dark(
|
|
331
|
+
color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)),
|
|
332
|
+
color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer))
|
|
333
|
+
);
|
|
334
|
+
--diffs-bg-selection: var(
|
|
335
|
+
--diffs-bg-selection-override,
|
|
336
|
+
light-dark(
|
|
337
|
+
color-mix(in lab, var(--diffs-bg) 82%, var(--diffs-selection-base)),
|
|
338
|
+
color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base))
|
|
339
|
+
)
|
|
340
|
+
);
|
|
341
|
+
--diffs-bg-selection-number: var(
|
|
342
|
+
--diffs-bg-selection-number-override,
|
|
343
|
+
light-dark(
|
|
344
|
+
color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base)),
|
|
345
|
+
color-mix(in lab, var(--diffs-bg) 60%, var(--diffs-selection-base))
|
|
346
|
+
)
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
background-color: var(--diffs-bg);
|
|
350
|
+
color: var(--diffs-fg);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
[data-diff],
|
|
354
|
+
[data-file] {
|
|
355
|
+
/* This feels a bit crazy to me... so I need to think about it a bit more... */
|
|
356
|
+
--diffs-grid-number-column-width: minmax(min-content, max-content);
|
|
357
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
|
|
358
|
+
|
|
359
|
+
&[data-dehydrated] {
|
|
360
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
&[data-theme-type='light'],
|
|
364
|
+
& {
|
|
365
|
+
[data-line] span {
|
|
366
|
+
color: light-dark(
|
|
367
|
+
var(--diffs-token-light, var(--diffs-light)),
|
|
368
|
+
var(--diffs-token-dark, var(--diffs-dark))
|
|
369
|
+
);
|
|
370
|
+
font-weight: var(--diffs-token-light-font-weight, inherit);
|
|
371
|
+
font-style: var(--diffs-token-light-font-style, inherit);
|
|
372
|
+
-webkit-text-decoration: var(--diffs-token-light-text-decoration, inherit);
|
|
373
|
+
text-decoration: var(--diffs-token-light-text-decoration, inherit);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
&[data-theme-type='dark'] [data-line] span {
|
|
378
|
+
font-weight: var(--diffs-token-dark-font-weight, inherit);
|
|
379
|
+
font-style: var(--diffs-token-dark-font-style, inherit);
|
|
380
|
+
-webkit-text-decoration: var(--diffs-token-dark-text-decoration, inherit);
|
|
381
|
+
text-decoration: var(--diffs-token-dark-text-decoration, inherit);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
&:hover [data-code]::-webkit-scrollbar-thumb {
|
|
385
|
+
background-color: var(--diffs-bg-context);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
[data-line] span {
|
|
390
|
+
background-color: light-dark(
|
|
391
|
+
var(--diffs-token-light-bg, inherit),
|
|
392
|
+
var(--diffs-token-dark-bg, inherit)
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
[data-line],
|
|
397
|
+
[data-gutter-buffer],
|
|
398
|
+
[data-line-annotation],
|
|
399
|
+
[data-no-newline] {
|
|
400
|
+
color: var(--diffs-fg);
|
|
401
|
+
background-color: var(--diffs-line-bg, var(--diffs-bg));
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
[data-no-newline] {
|
|
405
|
+
-webkit-user-select: none;
|
|
406
|
+
user-select: none;
|
|
407
|
+
|
|
408
|
+
span {
|
|
409
|
+
opacity: 0.6;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
@media (prefers-color-scheme: dark) {
|
|
414
|
+
[data-diffs-header],
|
|
415
|
+
[data-error-wrapper],
|
|
416
|
+
[data-diff],
|
|
417
|
+
[data-file] {
|
|
418
|
+
color-scheme: dark;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
[data-content] [data-line] span {
|
|
422
|
+
font-weight: var(--diffs-token-dark-font-weight, inherit);
|
|
423
|
+
font-style: var(--diffs-token-dark-font-style, inherit);
|
|
424
|
+
-webkit-text-decoration: var(--diffs-token-dark-text-decoration, inherit);
|
|
425
|
+
text-decoration: var(--diffs-token-dark-text-decoration, inherit);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
[data-diffs-header],
|
|
430
|
+
[data-diff],
|
|
431
|
+
[data-file] {
|
|
432
|
+
&[data-theme-type='light'] {
|
|
433
|
+
color-scheme: light;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
&[data-theme-type='dark'] {
|
|
437
|
+
color-scheme: dark;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
[data-diff-type='split'][data-overflow='scroll'] {
|
|
442
|
+
display: grid;
|
|
443
|
+
grid-template-columns: 1fr 1fr;
|
|
444
|
+
|
|
445
|
+
[data-additions] {
|
|
446
|
+
border-left: 1px solid var(--diffs-bg);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
[data-deletions] {
|
|
450
|
+
border-right: 1px solid var(--diffs-bg);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
[data-code] {
|
|
455
|
+
display: grid;
|
|
456
|
+
grid-auto-flow: dense;
|
|
457
|
+
grid-template-columns: var(--diffs-code-grid);
|
|
458
|
+
overflow: scroll clip;
|
|
459
|
+
overscroll-behavior-x: none;
|
|
460
|
+
tab-size: var(--diffs-tab-size, 2);
|
|
461
|
+
align-self: flex-start;
|
|
462
|
+
padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
463
|
+
padding-bottom: max(
|
|
464
|
+
0px,
|
|
465
|
+
calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) - 6px)
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
[data-container-size] {
|
|
470
|
+
container-type: inline-size;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
[data-code]::-webkit-scrollbar {
|
|
474
|
+
width: 0;
|
|
475
|
+
height: 6px;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
[data-code]::-webkit-scrollbar-track {
|
|
479
|
+
background: transparent;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
[data-code]::-webkit-scrollbar-thumb {
|
|
483
|
+
background-color: transparent;
|
|
484
|
+
border: 1px solid transparent;
|
|
485
|
+
background-clip: content-box;
|
|
486
|
+
border-radius: 3px;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
[data-code]::-webkit-scrollbar-corner {
|
|
490
|
+
background-color: transparent;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/*
|
|
494
|
+
* If we apply these rules globally it will mean that webkit will opt into the
|
|
495
|
+
* standards compliant version of custom css scrollbars, which we do not want
|
|
496
|
+
* because the custom stuff will look better
|
|
497
|
+
*/
|
|
498
|
+
@supports (-moz-appearance: none) {
|
|
499
|
+
[data-code] {
|
|
500
|
+
scrollbar-width: thin;
|
|
501
|
+
scrollbar-color: var(--diffs-bg-context) transparent;
|
|
502
|
+
padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
[data-diffs-header] ~ [data-diff],
|
|
507
|
+
[data-diffs-header] ~ [data-file] {
|
|
508
|
+
[data-code],
|
|
509
|
+
&[data-overflow='wrap'] {
|
|
510
|
+
padding-top: 0;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
[data-gutter] {
|
|
515
|
+
display: grid;
|
|
516
|
+
grid-template-rows: subgrid;
|
|
517
|
+
grid-template-columns: subgrid;
|
|
518
|
+
grid-column: 1;
|
|
519
|
+
z-index: 3;
|
|
520
|
+
position: relative;
|
|
521
|
+
background-color: var(--diffs-bg);
|
|
522
|
+
|
|
523
|
+
[data-gutter-buffer],
|
|
524
|
+
[data-column-number] {
|
|
525
|
+
border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
[data-content] {
|
|
530
|
+
display: grid;
|
|
531
|
+
grid-template-rows: subgrid;
|
|
532
|
+
grid-template-columns: subgrid;
|
|
533
|
+
grid-column: 2;
|
|
534
|
+
min-width: 0;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
[data-diff-type='split'][data-overflow='wrap'] {
|
|
538
|
+
display: grid;
|
|
539
|
+
grid-auto-flow: dense;
|
|
540
|
+
grid-template-columns: repeat(2, var(--diffs-code-grid));
|
|
541
|
+
padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
542
|
+
|
|
543
|
+
[data-deletions] {
|
|
544
|
+
display: contents;
|
|
545
|
+
|
|
546
|
+
[data-gutter] {
|
|
547
|
+
grid-column: 1;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
[data-content] {
|
|
551
|
+
grid-column: 2;
|
|
552
|
+
border-right: 1px solid var(--diffs-bg);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
[data-additions] {
|
|
557
|
+
display: contents;
|
|
558
|
+
|
|
559
|
+
[data-gutter] {
|
|
560
|
+
grid-column: 3;
|
|
561
|
+
border-left: 1px solid var(--diffs-bg);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
[data-content] {
|
|
565
|
+
grid-column: 4;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
[data-overflow='scroll'] [data-gutter] {
|
|
571
|
+
position: sticky;
|
|
572
|
+
left: 0;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
[data-line-annotation][data-selected-line] {
|
|
576
|
+
background-color: unset;
|
|
577
|
+
|
|
578
|
+
&::before {
|
|
579
|
+
content: '';
|
|
580
|
+
/* FIXME(amadeus): This needs to be audited ... */
|
|
581
|
+
position: sticky;
|
|
582
|
+
top: 0;
|
|
583
|
+
left: 0;
|
|
584
|
+
display: block;
|
|
585
|
+
border-right: var(--diffs-gap-style, 1px solid var(--diffs-bg));
|
|
586
|
+
background-color: var(--diffs-bg-selection-number);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
[data-annotation-content] {
|
|
590
|
+
background-color: var(--diffs-bg-selection);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
[data-interactive-lines] [data-line] {
|
|
595
|
+
cursor: pointer;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
[data-content-buffer],
|
|
599
|
+
[data-gutter-buffer] {
|
|
600
|
+
position: relative;
|
|
601
|
+
-webkit-user-select: none;
|
|
602
|
+
user-select: none;
|
|
603
|
+
min-height: 1lh;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
[data-gutter-buffer='annotation'] {
|
|
607
|
+
min-height: 0;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
[data-gutter-buffer='buffer'] {
|
|
611
|
+
background-size: 8px 8px;
|
|
612
|
+
background-position: 0 0;
|
|
613
|
+
background-origin: border-box;
|
|
614
|
+
background-color: var(--diffs-bg);
|
|
615
|
+
/* This is incredibley expensive... */
|
|
616
|
+
background-image: repeating-linear-gradient(
|
|
617
|
+
-45deg,
|
|
618
|
+
transparent,
|
|
619
|
+
transparent calc(3px * 1.414),
|
|
620
|
+
rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(3px * 1.414),
|
|
621
|
+
rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(4px * 1.414)
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
[data-content-buffer] {
|
|
626
|
+
grid-column: 1;
|
|
627
|
+
/* We multiply by 1.414 (√2) to better approximate the diagonal repeat distance */
|
|
628
|
+
background-size: 8px 8px;
|
|
629
|
+
background-position: 5px 0;
|
|
630
|
+
background-origin: border-box;
|
|
631
|
+
background-color: var(--diffs-bg);
|
|
632
|
+
/* This is incredibley expensive... */
|
|
633
|
+
background-image: repeating-linear-gradient(
|
|
634
|
+
-45deg,
|
|
635
|
+
transparent,
|
|
636
|
+
transparent calc(3px * 1.414),
|
|
637
|
+
var(--diffs-bg-buffer) calc(3px * 1.414),
|
|
638
|
+
var(--diffs-bg-buffer) calc(4px * 1.414)
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
[data-separator] {
|
|
643
|
+
box-sizing: content-box;
|
|
644
|
+
background-color: var(--diffs-bg);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
[data-separator='simple'] {
|
|
648
|
+
min-height: 4px;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
[data-separator='line-info'],
|
|
652
|
+
[data-separator='line-info-basic'],
|
|
653
|
+
[data-separator='metadata'],
|
|
654
|
+
[data-separator='simple'] {
|
|
655
|
+
background-color: var(--diffs-bg-separator);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
[data-separator='line-info'],
|
|
659
|
+
[data-separator='line-info-basic'],
|
|
660
|
+
[data-separator='metadata'] {
|
|
661
|
+
height: 32px;
|
|
662
|
+
position: relative;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
[data-separator-wrapper] {
|
|
666
|
+
-webkit-user-select: none;
|
|
667
|
+
user-select: none;
|
|
668
|
+
fill: currentColor;
|
|
669
|
+
position: absolute;
|
|
670
|
+
inset-inline: 0;
|
|
671
|
+
display: flex;
|
|
672
|
+
align-items: center;
|
|
673
|
+
background-color: var(--diffs-bg);
|
|
674
|
+
height: 100%;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
[data-content] [data-separator-wrapper] {
|
|
678
|
+
display: none;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
[data-separator='metadata'] [data-separator-wrapper] {
|
|
682
|
+
inset-inline: 100% auto;
|
|
683
|
+
padding-inline: 1ch;
|
|
684
|
+
height: 100%;
|
|
685
|
+
background-color: var(--diffs-bg-separator);
|
|
686
|
+
color: var(--diffs-fg-number);
|
|
687
|
+
white-space: nowrap;
|
|
688
|
+
overflow: hidden;
|
|
689
|
+
text-overflow: ellipsis;
|
|
690
|
+
min-width: min-content;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
[data-separator='line-info'] {
|
|
694
|
+
margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
[data-separator='line-info-basic'],
|
|
698
|
+
[data-separator='metadata'] {
|
|
699
|
+
margin-block: 0;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
[data-separator='line-info'][data-separator-first] {
|
|
703
|
+
margin-top: 0;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
[data-separator='line-info'][data-separator-last] {
|
|
707
|
+
margin-bottom: 0;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
[data-expand-index] [data-separator-wrapper] {
|
|
711
|
+
display: grid;
|
|
712
|
+
grid-template-columns: 32px auto;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
[data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
|
|
716
|
+
grid-template-columns: 32px 32px auto;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
[data-expand-button],
|
|
720
|
+
[data-separator-content] {
|
|
721
|
+
display: flex;
|
|
722
|
+
flex: 0 0 auto;
|
|
723
|
+
align-items: center;
|
|
724
|
+
background-color: var(--diffs-bg-separator);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
[data-expand-button] {
|
|
728
|
+
justify-content: center;
|
|
729
|
+
flex-shrink: 0;
|
|
730
|
+
cursor: pointer;
|
|
731
|
+
min-width: 32px;
|
|
732
|
+
align-self: stretch;
|
|
733
|
+
color: var(--diffs-fg-number);
|
|
734
|
+
border-right: 2px solid var(--diffs-bg);
|
|
735
|
+
|
|
736
|
+
&:hover {
|
|
737
|
+
color: var(--diffs-fg);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
[data-expand-down] [data-icon] {
|
|
742
|
+
transform: scaleY(-1);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
[data-separator-content] {
|
|
746
|
+
flex: 1 1 auto;
|
|
747
|
+
padding: 0 1ch;
|
|
748
|
+
height: 100%;
|
|
749
|
+
color: var(--diffs-fg-number);
|
|
750
|
+
|
|
751
|
+
overflow: hidden;
|
|
752
|
+
justify-content: flex-start;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
[data-separator='line-info'],
|
|
756
|
+
[data-separator='line-info-basic'] {
|
|
757
|
+
[data-separator-content] {
|
|
758
|
+
height: 100%;
|
|
759
|
+
-webkit-user-select: none;
|
|
760
|
+
user-select: none;
|
|
761
|
+
overflow: clip;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
@supports (width: 1cqi) {
|
|
766
|
+
[data-unified] {
|
|
767
|
+
[data-separator='line-info'] [data-separator-wrapper] {
|
|
768
|
+
padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
769
|
+
width: 100cqi;
|
|
770
|
+
|
|
771
|
+
[data-separator-content] {
|
|
772
|
+
border-radius: 6px;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
[data-separator='line-info'][data-expand-index]
|
|
777
|
+
[data-separator-wrapper]
|
|
778
|
+
[data-separator-content] {
|
|
779
|
+
border-top-left-radius: unset;
|
|
780
|
+
border-bottom-left-radius: unset;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
[data-gutter] {
|
|
785
|
+
[data-separator='line-info'] [data-separator-wrapper] {
|
|
786
|
+
padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
[data-separator='line-info'] [data-separator-content] {
|
|
790
|
+
border-top-left-radius: 6px;
|
|
791
|
+
border-bottom-left-radius: 6px;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
[data-separator='line-info'][data-expand-index] [data-separator-content] {
|
|
795
|
+
border-top-left-radius: unset;
|
|
796
|
+
border-bottom-left-radius: unset;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
[data-additions] {
|
|
801
|
+
[data-content] [data-separator='line-info'] {
|
|
802
|
+
background-color: var(--diffs-bg);
|
|
803
|
+
|
|
804
|
+
[data-separator-wrapper] {
|
|
805
|
+
display: none;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
[data-gutter] [data-separator='line-info'] [data-separator-wrapper] {
|
|
810
|
+
display: block;
|
|
811
|
+
height: 100%;
|
|
812
|
+
background-color: var(--diffs-bg-separator);
|
|
813
|
+
border-top-right-radius: 6px;
|
|
814
|
+
border-bottom-right-radius: 6px;
|
|
815
|
+
|
|
816
|
+
[data-separator-content],
|
|
817
|
+
[data-expand-button] {
|
|
818
|
+
display: none;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
[data-overflow='scroll']
|
|
824
|
+
[data-additions]
|
|
825
|
+
[data-gutter]
|
|
826
|
+
[data-separator='line-info']
|
|
827
|
+
[data-separator-wrapper] {
|
|
828
|
+
width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
[data-overflow='wrap']
|
|
832
|
+
[data-additions]
|
|
833
|
+
[data-content]
|
|
834
|
+
[data-separator='line-info']
|
|
835
|
+
[data-separator-wrapper] {
|
|
836
|
+
background-color: var(--diffs-bg-separator);
|
|
837
|
+
display: block;
|
|
838
|
+
height: 100%;
|
|
839
|
+
margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
840
|
+
border-top-right-radius: 6px;
|
|
841
|
+
border-bottom-right-radius: 6px;
|
|
842
|
+
|
|
843
|
+
[data-separator-content],
|
|
844
|
+
[data-expand-button] {
|
|
845
|
+
display: none;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
[data-separator='line-info'] [data-separator-wrapper] {
|
|
850
|
+
[data-expand-both],
|
|
851
|
+
[data-expand-down],
|
|
852
|
+
[data-expand-up] {
|
|
853
|
+
border-top-left-radius: 6px;
|
|
854
|
+
border-bottom-left-radius: 6px;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
@media (pointer: fine) {
|
|
859
|
+
[data-separator='line-info'] [data-separator-wrapper] {
|
|
860
|
+
&[data-separator-multi-button] {
|
|
861
|
+
[data-expand-up] {
|
|
862
|
+
border-top-left-radius: 6px;
|
|
863
|
+
border-bottom-left-radius: unset;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
[data-expand-down] {
|
|
867
|
+
border-bottom-left-radius: 6px;
|
|
868
|
+
border-top-left-radius: unset;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
@media (pointer: coarse) {
|
|
876
|
+
[data-separator='line-info-basic']
|
|
877
|
+
[data-separator-wrapper][data-separator-multi-button] {
|
|
878
|
+
grid-template-columns: 34px 34px auto;
|
|
879
|
+
|
|
880
|
+
[data-separator-content] {
|
|
881
|
+
grid-column: unset;
|
|
882
|
+
grid-row: unset;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
@supports (width: 1cqi) {
|
|
887
|
+
[data-separator='line-info'] [data-separator-wrapper] {
|
|
888
|
+
[data-expand-both],
|
|
889
|
+
[data-expand-down],
|
|
890
|
+
[data-expand-up] {
|
|
891
|
+
border-top-left-radius: 6px;
|
|
892
|
+
border-bottom-left-radius: 6px;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
&[data-separator-multi-button] {
|
|
896
|
+
[data-expand-up] {
|
|
897
|
+
border-top-left-radius: 6px;
|
|
898
|
+
border-bottom-left-radius: 6px;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
[data-expand-down] {
|
|
902
|
+
border-bottom-left-radius: unset;
|
|
903
|
+
border-top-left-radius: unset;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
@media (pointer: fine) {
|
|
911
|
+
[data-separator-wrapper][data-separator-multi-button] {
|
|
912
|
+
display: grid;
|
|
913
|
+
grid-template-rows: 50% 50%;
|
|
914
|
+
|
|
915
|
+
[data-separator-content] {
|
|
916
|
+
grid-column: 2;
|
|
917
|
+
grid-row: 1 / -1;
|
|
918
|
+
min-width: min-content;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
[data-expand-button] {
|
|
922
|
+
grid-column: 1;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
[data-separator='line-info'] [data-separator-wrapper],
|
|
927
|
+
[data-separator='line-info']
|
|
928
|
+
[data-separator-wrapper][data-separator-multi-button] {
|
|
929
|
+
grid-template-columns: 34px auto;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
[data-separator='line-info-basic'][data-expand-index]
|
|
933
|
+
[data-separator-wrapper] {
|
|
934
|
+
grid-template-columns: 100% auto;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
[data-separator='line-info'],
|
|
938
|
+
[data-separator='line-info-basic'] {
|
|
939
|
+
[data-separator-multi-button] {
|
|
940
|
+
[data-expand-up] {
|
|
941
|
+
border-bottom: 1px solid var(--diffs-bg);
|
|
942
|
+
border-right: 2px solid var(--diffs-bg);
|
|
943
|
+
}
|
|
944
|
+
[data-expand-down] {
|
|
945
|
+
border-top: 1px solid var(--diffs-bg);
|
|
946
|
+
border-right: 2px solid var(--diffs-bg);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
[data-additions] [data-gutter] [data-separator-wrapper],
|
|
953
|
+
[data-additions] [data-separator='line-info-basic'] [data-separator-wrapper],
|
|
954
|
+
[data-content] [data-separator-wrapper] {
|
|
955
|
+
display: none;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
[data-line-annotation],
|
|
959
|
+
[data-gutter-buffer='annotation'] {
|
|
960
|
+
--diffs-line-bg: var(--diffs-bg-context);
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
[data-line-annotation] {
|
|
964
|
+
min-height: var(--diffs-annotation-min-height, 0);
|
|
965
|
+
z-index: 2;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
[data-separator='custom'] {
|
|
969
|
+
display: grid;
|
|
970
|
+
grid-template-columns: subgrid;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
[data-line],
|
|
974
|
+
[data-column-number],
|
|
975
|
+
[data-no-newline] {
|
|
976
|
+
position: relative;
|
|
977
|
+
padding-inline: 1ch;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
[data-indicators='classic'] [data-line] {
|
|
981
|
+
padding-inline-start: 2ch;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
[data-indicators='classic'] {
|
|
985
|
+
[data-line-type='change-addition'],
|
|
986
|
+
[data-line-type='change-deletion'] {
|
|
987
|
+
&[data-no-newline],
|
|
988
|
+
&[data-line] {
|
|
989
|
+
&::before {
|
|
990
|
+
display: inline-block;
|
|
991
|
+
width: 1ch;
|
|
992
|
+
height: 1lh;
|
|
993
|
+
position: absolute;
|
|
994
|
+
top: 0;
|
|
995
|
+
left: 0;
|
|
996
|
+
-webkit-user-select: none;
|
|
997
|
+
user-select: none;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
[data-line-type='change-addition'] {
|
|
1003
|
+
&[data-line],
|
|
1004
|
+
&[data-no-newline] {
|
|
1005
|
+
&::before {
|
|
1006
|
+
content: '+';
|
|
1007
|
+
color: var(--diffs-addition-base);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
[data-line-type='change-deletion'] {
|
|
1013
|
+
&[data-line],
|
|
1014
|
+
&[data-no-newline] {
|
|
1015
|
+
&::before {
|
|
1016
|
+
content: '-';
|
|
1017
|
+
color: var(--diffs-deletion-base);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
[data-indicators='bars'] {
|
|
1024
|
+
[data-line-type='change-deletion'],
|
|
1025
|
+
[data-line-type='change-addition'] {
|
|
1026
|
+
&[data-column-number] {
|
|
1027
|
+
&::before {
|
|
1028
|
+
content: '';
|
|
1029
|
+
display: block;
|
|
1030
|
+
width: 4px;
|
|
1031
|
+
height: 100%;
|
|
1032
|
+
position: absolute;
|
|
1033
|
+
top: 0;
|
|
1034
|
+
left: 0;
|
|
1035
|
+
-webkit-user-select: none;
|
|
1036
|
+
user-select: none;
|
|
1037
|
+
contain: strict;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
[data-line-type='change-deletion'] {
|
|
1043
|
+
&[data-column-number] {
|
|
1044
|
+
&::before {
|
|
1045
|
+
background-image: linear-gradient(
|
|
1046
|
+
0deg,
|
|
1047
|
+
var(--diffs-bg-deletion) 50%,
|
|
1048
|
+
var(--diffs-deletion-base) 50%
|
|
1049
|
+
);
|
|
1050
|
+
background-repeat: repeat;
|
|
1051
|
+
background-size: 2px 2px;
|
|
1052
|
+
background-size: calc(1lh / round(1lh / 2px))
|
|
1053
|
+
calc(1lh / round(1lh / 2px));
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
[data-line-type='change-addition'] {
|
|
1059
|
+
&[data-column-number] {
|
|
1060
|
+
&::before {
|
|
1061
|
+
background-color: var(--diffs-addition-base);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
[data-overflow='wrap'] {
|
|
1068
|
+
[data-line],
|
|
1069
|
+
[data-annotation-content] {
|
|
1070
|
+
white-space: pre-wrap;
|
|
1071
|
+
word-break: break-word;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
[data-overflow='scroll'] [data-line] {
|
|
1076
|
+
white-space: pre;
|
|
1077
|
+
min-height: 1lh;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
[data-column-number] {
|
|
1081
|
+
box-sizing: content-box;
|
|
1082
|
+
text-align: right;
|
|
1083
|
+
-webkit-user-select: none;
|
|
1084
|
+
user-select: none;
|
|
1085
|
+
background-color: var(--diffs-bg);
|
|
1086
|
+
color: var(--diffs-fg-number);
|
|
1087
|
+
padding-left: 2ch;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
[data-line-number-content] {
|
|
1091
|
+
display: inline-block;
|
|
1092
|
+
min-width: var(
|
|
1093
|
+
--diffs-min-number-column-width,
|
|
1094
|
+
var(--diffs-min-number-column-width-default, 3ch)
|
|
1095
|
+
);
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
[data-disable-line-numbers] {
|
|
1099
|
+
[data-column-number] {
|
|
1100
|
+
min-width: 4px;
|
|
1101
|
+
padding: 0;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
[data-line-number-content] {
|
|
1105
|
+
display: none;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
[data-gutter-utility-slot] {
|
|
1109
|
+
right: unset;
|
|
1110
|
+
left: 0;
|
|
1111
|
+
justify-content: flex-start;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
&[data-indicators='bars'] [data-gutter-utility-slot] {
|
|
1115
|
+
/* Using 5px here because theres a 1px separator after the bar */
|
|
1116
|
+
left: 5px;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
[data-file][data-disable-line-numbers] {
|
|
1121
|
+
[data-gutter-buffer],
|
|
1122
|
+
[data-column-number] {
|
|
1123
|
+
min-width: 0;
|
|
1124
|
+
border-right: 0;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
[data-interactive-line-numbers] [data-column-number] {
|
|
1129
|
+
cursor: pointer;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
[data-diff-span] {
|
|
1133
|
+
border-radius: 3px;
|
|
1134
|
+
-webkit-box-decoration-break: clone;
|
|
1135
|
+
box-decoration-break: clone;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
[data-line-type='change-addition'] {
|
|
1139
|
+
&[data-column-number] {
|
|
1140
|
+
color: var(
|
|
1141
|
+
--diffs-fg-number-addition-override,
|
|
1142
|
+
var(--diffs-addition-base)
|
|
1143
|
+
);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
> [data-diff-span] {
|
|
1147
|
+
background-color: var(--diffs-bg-addition-emphasis);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
[data-line-type='change-deletion'] {
|
|
1152
|
+
&[data-column-number] {
|
|
1153
|
+
color: var(
|
|
1154
|
+
--diffs-fg-number-deletion-override,
|
|
1155
|
+
var(--diffs-deletion-base)
|
|
1156
|
+
);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
[data-diff-span] {
|
|
1160
|
+
background-color: var(--diffs-bg-deletion-emphasis);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
[data-background] [data-line-type='change-addition'] {
|
|
1165
|
+
--diffs-line-bg: var(--diffs-bg-addition);
|
|
1166
|
+
|
|
1167
|
+
&[data-column-number] {
|
|
1168
|
+
background-color: var(--diffs-bg-addition-number);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
[data-background] [data-line-type='change-deletion'] {
|
|
1173
|
+
--diffs-line-bg: var(--diffs-bg-deletion);
|
|
1174
|
+
|
|
1175
|
+
&[data-column-number] {
|
|
1176
|
+
background-color: var(--diffs-bg-deletion-number);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
@media (pointer: fine) {
|
|
1181
|
+
[data-column-number],
|
|
1182
|
+
[data-line] {
|
|
1183
|
+
&[data-hovered] {
|
|
1184
|
+
background-color: var(--diffs-bg-hover);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
[data-background] {
|
|
1189
|
+
[data-column-number],
|
|
1190
|
+
[data-line] {
|
|
1191
|
+
&[data-hovered] {
|
|
1192
|
+
&[data-line-type='change-deletion'] {
|
|
1193
|
+
background-color: var(--diffs-bg-deletion-hover);
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
&[data-line-type='change-addition'] {
|
|
1197
|
+
background-color: var(--diffs-bg-addition-hover);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
[data-diffs-header] {
|
|
1205
|
+
position: relative;
|
|
1206
|
+
display: flex;
|
|
1207
|
+
flex-direction: row;
|
|
1208
|
+
justify-content: space-between;
|
|
1209
|
+
align-items: center;
|
|
1210
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1211
|
+
min-height: calc(
|
|
1212
|
+
1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3)
|
|
1213
|
+
);
|
|
1214
|
+
padding-inline: 16px;
|
|
1215
|
+
top: 0;
|
|
1216
|
+
z-index: 2;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
[data-header-content] {
|
|
1220
|
+
display: flex;
|
|
1221
|
+
flex-direction: row;
|
|
1222
|
+
align-items: center;
|
|
1223
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1224
|
+
min-width: 0;
|
|
1225
|
+
white-space: nowrap;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
[data-header-content] [data-prev-name],
|
|
1229
|
+
[data-header-content] [data-title] {
|
|
1230
|
+
direction: rtl;
|
|
1231
|
+
overflow: hidden;
|
|
1232
|
+
text-overflow: ellipsis;
|
|
1233
|
+
min-width: 0;
|
|
1234
|
+
white-space: nowrap;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
[data-prev-name] {
|
|
1238
|
+
opacity: 0.7;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
[data-rename-icon] {
|
|
1242
|
+
fill: currentColor;
|
|
1243
|
+
flex-shrink: 0;
|
|
1244
|
+
flex-grow: 0;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
[data-diffs-header] [data-metadata] {
|
|
1248
|
+
display: flex;
|
|
1249
|
+
align-items: center;
|
|
1250
|
+
gap: 1ch;
|
|
1251
|
+
white-space: nowrap;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
[data-diffs-header] [data-additions-count] {
|
|
1255
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1256
|
+
color: var(--diffs-addition-base);
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
[data-diffs-header] [data-deletions-count] {
|
|
1260
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1261
|
+
color: var(--diffs-deletion-base);
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
[data-annotation-content] {
|
|
1265
|
+
position: relative;
|
|
1266
|
+
display: flow-root;
|
|
1267
|
+
align-self: flex-start;
|
|
1268
|
+
z-index: 2;
|
|
1269
|
+
min-width: 0;
|
|
1270
|
+
isolation: isolate;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/* Sticky positioning has a composite costs, so we should _only_ pay it if we
|
|
1274
|
+
* need to */
|
|
1275
|
+
[data-overflow='scroll'] [data-annotation-content] {
|
|
1276
|
+
position: sticky;
|
|
1277
|
+
width: var(--diffs-column-content-width, auto);
|
|
1278
|
+
left: var(--diffs-column-number-width, 0);
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
/* Undo some of the stuff that the 'pre' tag does */
|
|
1282
|
+
[data-annotation-slot] {
|
|
1283
|
+
text-wrap-mode: wrap;
|
|
1284
|
+
word-break: normal;
|
|
1285
|
+
white-space-collapse: collapse;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
[data-change-icon] {
|
|
1289
|
+
fill: currentColor;
|
|
1290
|
+
flex-shrink: 0;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
[data-change-icon='change'],
|
|
1294
|
+
[data-change-icon='rename-pure'],
|
|
1295
|
+
[data-change-icon='rename-changed'] {
|
|
1296
|
+
color: var(--diffs-modified-base);
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
[data-change-icon='new'] {
|
|
1300
|
+
color: var(--diffs-addition-base);
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
[data-change-icon='deleted'] {
|
|
1304
|
+
color: var(--diffs-deletion-base);
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
[data-change-icon='file'] {
|
|
1308
|
+
opacity: 0.6;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
/* Line selection highlighting */
|
|
1312
|
+
[data-selected-line] {
|
|
1313
|
+
&[data-gutter-buffer='annotation'],
|
|
1314
|
+
&[data-column-number] {
|
|
1315
|
+
color: var(--diffs-selection-number-fg);
|
|
1316
|
+
background-color: var(--diffs-bg-selection-number);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
&[data-line] {
|
|
1320
|
+
background-color: var(--diffs-bg-selection);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
[data-line-type='change-addition'],
|
|
1325
|
+
[data-line-type='change-deletion'] {
|
|
1326
|
+
&[data-selected-line] {
|
|
1327
|
+
&[data-line],
|
|
1328
|
+
&[data-line][data-hovered] {
|
|
1329
|
+
background-color: light-dark(
|
|
1330
|
+
color-mix(
|
|
1331
|
+
in lab,
|
|
1332
|
+
var(--diffs-line-bg, var(--diffs-bg)) 82%,
|
|
1333
|
+
var(--diffs-selection-base)
|
|
1334
|
+
),
|
|
1335
|
+
color-mix(
|
|
1336
|
+
in lab,
|
|
1337
|
+
var(--diffs-line-bg, var(--diffs-bg)) 75%,
|
|
1338
|
+
var(--diffs-selection-base)
|
|
1339
|
+
)
|
|
1340
|
+
);
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
&[data-column-number],
|
|
1344
|
+
&[data-column-number][data-hovered] {
|
|
1345
|
+
color: var(--diffs-selection-number-fg);
|
|
1346
|
+
background-color: light-dark(
|
|
1347
|
+
color-mix(
|
|
1348
|
+
in lab,
|
|
1349
|
+
var(--diffs-line-bg, var(--diffs-bg)) 75%,
|
|
1350
|
+
var(--diffs-selection-base)
|
|
1351
|
+
),
|
|
1352
|
+
color-mix(
|
|
1353
|
+
in lab,
|
|
1354
|
+
var(--diffs-line-bg, var(--diffs-bg)) 60%,
|
|
1355
|
+
var(--diffs-selection-base)
|
|
1356
|
+
)
|
|
1357
|
+
);
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
[data-gutter-utility-slot] {
|
|
1363
|
+
position: absolute;
|
|
1364
|
+
top: 0;
|
|
1365
|
+
bottom: 0;
|
|
1366
|
+
right: 0;
|
|
1367
|
+
display: flex;
|
|
1368
|
+
justify-content: flex-end;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
[data-unmodified-lines] {
|
|
1372
|
+
display: block;
|
|
1373
|
+
overflow: hidden;
|
|
1374
|
+
min-width: 0;
|
|
1375
|
+
text-overflow: ellipsis;
|
|
1376
|
+
white-space: nowrap;
|
|
1377
|
+
flex: 0 1 auto;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
[data-error-wrapper] {
|
|
1381
|
+
overflow: auto;
|
|
1382
|
+
padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
|
|
1383
|
+
var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1384
|
+
max-height: 400px;
|
|
1385
|
+
scrollbar-width: none;
|
|
1386
|
+
|
|
1387
|
+
[data-error-message] {
|
|
1388
|
+
font-weight: bold;
|
|
1389
|
+
font-size: 18px;
|
|
1390
|
+
color: var(--diffs-deletion-base);
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
[data-error-stack] {
|
|
1394
|
+
color: var(--diffs-fg-number);
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
[data-placeholder] {
|
|
1399
|
+
contain: strict;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
[data-utility-button] {
|
|
1403
|
+
display: flex;
|
|
1404
|
+
align-items: center;
|
|
1405
|
+
justify-content: center;
|
|
1406
|
+
border: none;
|
|
1407
|
+
appearance: none;
|
|
1408
|
+
width: 1lh;
|
|
1409
|
+
height: 1lh;
|
|
1410
|
+
margin-right: calc((1lh - 1ch) * -1);
|
|
1411
|
+
padding: 0;
|
|
1412
|
+
cursor: pointer;
|
|
1413
|
+
font-size: var(--diffs-font-size, 13px);
|
|
1414
|
+
line-height: var(--diffs-line-height, 20px);
|
|
1415
|
+
border-radius: 4px;
|
|
1416
|
+
background-color: var(--diffs-modified-base);
|
|
1417
|
+
color: var(--diffs-bg);
|
|
1418
|
+
fill: currentColor;
|
|
1419
|
+
position: relative;
|
|
1420
|
+
z-index: 4;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
`,Zt=`@layer base, theme, unsafe;`;function Qt(e){return`${Zt}
|
|
1424
|
+
@layer unsafe {
|
|
1425
|
+
${e}
|
|
1426
|
+
}`}function $t({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function en(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function tn(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,themeStyles:s,themeType:c,totalLines:l}){switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),c===`system`?e.removeAttribute(`data-theme-type`):e.setAttribute(`data-theme-type`,c),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`);break}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.tabIndex=0,e.style=s,e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${l}`.length}ch`),e}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(Xt)),t.adoptedStyleSheets=[e]}}customElements.define(H,t)}function nn(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function rn(e,t){return ae(e?.theme??N,t?.theme??N)&&nn(e,t,[`theme`])}function an({fileDiff:e,deletionFile:t,additionFile:n,renderHeaderPrefix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderHoverUtility:s,lineAnnotations:c,getHoveredLine:l}){let u=o??s,d=r?.({fileDiff:e,deletionFile:t,additionFile:n}),f=i?.({fileDiff:e,deletionFile:t,additionFile:n});return(0,G.jsxs)(G.Fragment,{children:[d!=null&&(0,G.jsx)(`div`,{slot:`header-prefix`,children:d}),f!=null&&(0,G.jsx)(`div`,{slot:`header-metadata`,children:f}),a!=null&&c?.map((e,t)=>(0,G.jsx)(`div`,{slot:W(e),children:a(e)},t)),u!=null&&(0,G.jsx)(`div`,{slot:`gutter-utility-slot`,style:it,children:u(l)})]})}var on=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function sn(e){return _({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function cn(e){return _({tagName:`div`,children:[_({tagName:`span`,children:[P(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function ln(e){return _({tagName:`div`,children:[C({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function $({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=[];if(e===`metadata`&&t!=null&&s.push(_({tagName:`div`,children:[P(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||e.push(ln(`up`)),o||e.push(ln(`down`))):e.push(ln(!a&&!o?`both`:a?`down`:`up`))),e.push(_({tagName:`div`,children:[_({tagName:`span`,children:[P(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),s.push(_({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":e.length>2?``:void 0}}))}return e===`custom`&&i!=null&&s.push(_({tagName:`slot`,properties:{name:i}})),_({tagName:`div`,children:s,properties:{"data-separator":s.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function un(e,t){return`hunk-separator-${e}-${t}`}function dn(e){let t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function fn(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}var pn=-1,mn=class{__id=`diff-hunks-renderer:${++pn}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;constructor(e={theme:N},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Ft(e.theme??N)?re():void 0)}cleanUp(){this.highlighter=void 0,this.diff=void 0,this.renderCache=void 0,this.workerManager?.cleanUpPendingTasks(this),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.renderCache=void 0,this.workerManager?.cleanUpPendingTasks(this)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){this.getOptionsWithDefaults().themeType!==e&&this.mergeOptions({themeType:e})}expandHunk(e,t){let{expansionLineCount:n}=this.getOptionsWithDefaults(),r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&(this.renderCache=void 0),this.expandedHunks.set(e,r)}expandHunkFully(e){this.renderCache?.highlighted!==!0&&(this.renderCache=void 0),this.expandedHunks.set(e,{fromStart:1/0,fromEnd:1/0})}getExpandedHunk(e){return this.expandedHunks.get(e)??L}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,theme:m=N,themeType:h=`system`,tokenizeMaxLineLength:g=1e3,useCSSClasses:_=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,theme:this.workerManager?.getDiffRenderOptions().theme??m,themeType:h,tokenizeMaxLineLength:g,useCSSClasses:_}}async initializeHighlighter(){return this.highlighter=await se(Wt(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=this.workerManager?.getDiffResultCache(e);n!=null&&!hn(t,n.options)&&(n=void 0),this.renderCache??={diff:e,highlighted:!0,options:t,result:n?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0&&this.renderCache.result==null?this.workerManager.highlightDiffAST(this,this.diff):this.asyncHighlight(e).then(({result:t,options:n})=>{this.onHighlightSuccess(e,t,n)})}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n}=this.getOptionsWithDefaults();return{theme:e,tokenizeMaxLineLength:t,lineDiffType:n}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||e!==n.diff||!hn(t,n.options)?{options:t,forceRender:!0}:{options:t,forceRender:!1}}renderDiff(e=this.renderCache?.diff,t=R){if(e==null)return;let{expandUnchanged:n=!1,collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=this.workerManager?.getDiffResultCache(e);a!=null&&this.renderCache==null&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...a});let{options:o,forceRender:s}=this.getRenderOptions(e);if(this.renderCache??={diff:e,highlighted:!1,options:o,result:void 0,renderRange:void 0},this.workerManager?.isWorkingPool()===!0)(this.renderCache.result==null||!this.renderCache.highlighted&&!Nt(this.renderCache.renderRange,t))&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,fn(t)||n?!0:this.expandedHunks,i),this.renderCache.renderRange=t),t.totalLines>0&&(!this.renderCache.highlighted||s)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??r(e.name);let t=this.highlighter!=null&&Ft(o.theme),n=this.highlighter!=null&&Pt(this.computedLang);if(this.highlighter!=null&&t&&(s||!this.renderCache.highlighted&&n||this.renderCache.result==null)){let{result:t,options:r}=this.renderDiffWithHighlighter(e,this.highlighter,!n);this.renderCache={diff:e,options:r,highlighted:n,result:t,renderRange:void 0}}(!t||!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.onHighlightSuccess(e,t,n)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=R){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n,r){let{diffIndicators:i,disableBackground:a,disableLineNumbers:o,overflow:s,themeType:c}=this.getOptionsWithDefaults();return Ht({type:`diff`,diffIndicators:i,disableBackground:a,disableLineNumbers:o,overflow:s,themeStyles:n,split:e,themeType:r??c,totalLines:t})}async asyncHighlight(e){this.computedLang=e.lang??r(e.name);let t=this.highlighter!=null&&Ft(this.options.theme??N),n=this.highlighter!=null&&Pt(this.computedLang);return(this.highlighter==null||!t||!n)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults();return{result:Ee(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i}),options:r}}onHighlightSuccess(e,t,n){if(this.renderCache==null)return;let r=this.renderCache.diff!==e||!this.renderCache.highlighted||!hn(this.renderCache.options,n);this.renderCache={diff:e,options:n,highlighted:!0,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}onHighlightError(e){console.error(e)}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults();this.diff=e;let f=a===`unified`,p=[],m=[],h=[],g=[],{additionLines:_,deletionLines:v}=n,y={rowCount:0,hunkSeparators:u,additionsContentAST:p,deletionsContentAST:m,unifiedContentAST:h,unifiedGutterAST:d(),deletionsGutterAST:d(),additionsGutterAST:d(),expansionLineCount:c,hunkData:g,incrementRowCount(e=1){y.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:y.unifiedGutterAST.children.push(t);break;case`deletions`:y.deletionsGutterAST.children.push(t);break;case`additions`:y.additionsGutterAST.children.push(t);break}}},b=yn(e),x=0,S;function C(e,t,n,r){y.pushToGutter(e,j(t,n,r))}function w(){if(a!==`unified`){if(x<=0||S==null){x=0,S=void 0;return}S===`additions`?(y.pushToGutter(`additions`,D(void 0,`buffer`,x)),p?.push(sn(x))):(y.pushToGutter(`deletions`,D(void 0,`buffer`,x)),m?.push(sn(x))),x=0,S=void 0}}function T(e){w(),a===`unified`?vn(`unified`,e,y):(vn(`deletions`,e,y),vn(`additions`,e,y))}we({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,d=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&w(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:!e.isPartial});let f=a===`unified`?d:l;if(a===`unified`){let n=s==null?void 0:v[s.lineIndex],r=o==null?void 0:_[o.lineIndex];if(n==null&&r==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}C(`unified`,c===`change`?o==null?`change-deletion`:`change-addition`:c,o==null?s.lineNumber:o.lineNumber,`${d},${l}`),_n({diffStyle:`unified`,type:c,deletionLine:n,additionLine:r,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,f),context:y})}else{let n=s==null?void 0:v[s.lineIndex],r=o==null?void 0:_[o.lineIndex];if(n==null&&r==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let i=(()=>{if(c===`change`){if(r==null)return`additions`;if(n==null)return`deletions`}})();if(i!=null){if(S!=null&&S!==i)throw Error(`DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits`);S=i,x++}let a=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,f);a!=null&&x>0&&w(),s!=null&&C(`deletions`,c===`change`?`change-deletion`:c,s.lineNumber,`${s.unifiedLineIndex},${l}`),o!=null&&C(`additions`,c===`change`?`change-addition`:c,o.lineNumber,`${o.unifiedLineIndex},${l}`),_n({diffStyle:`split`,type:c,additionLine:r,deletionLine:n,...a,context:y})}let p=s?.noEOFCR??!1,m=o?.noEOFCR??!1;if(m||p){if(p){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(y.unifiedContentAST.push(cn(e)),y.pushToGutter(`unified`,D(e,`metadata`,1))):(y.deletionsContentAST.push(cn(e)),y.pushToGutter(`deletions`,D(e,`metadata`,1)),m||(y.pushToGutter(`additions`,D(void 0,`buffer`,1)),y.additionsContentAST.push(sn(1))))}if(m){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(y.unifiedContentAST.push(cn(e)),y.pushToGutter(`unified`,D(e,`metadata`,1))):(y.additionsContentAST.push(cn(e)),y.pushToGutter(`additions`,D(e,`metadata`,1)),p||(y.pushToGutter(`deletions`,D(void 0,`buffer`,1)),y.deletionsContentAST.push(sn(1))))}y.incrementRowCount(1)}i>0&&u!==`simple`&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:i,rangeSize:b,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),y.incrementRowCount(1)}}),a===`split`&&w();let E=Math.max(dn(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),O=t.bufferBefore>0||t.bufferAfter>0,k=!f&&e.type!==`deleted`,A=!f&&e.type!==`new`,M=y.rowCount>0||O;p=k&&M?p:void 0,m=A&&M?m:void 0,h=f&&M?h:void 0;let N=this.createPreElement(m!=null&&p!=null,E,r,i);return{unifiedGutterAST:f&&M?y.unifiedGutterAST.children:void 0,unifiedContentAST:h,deletionsGutterAST:A&&M?y.deletionsGutterAST.children:void 0,deletionsContentAST:m,additionsGutterAST:k&&M?y.additionsGutterAST.children:void 0,additionsContentAST:p,hunkData:g,preNode:N,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff,r,i),totalLines:E,rowCount:y.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=d(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,Lt(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(_({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(_({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(_({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return p(this.renderFullAST(e,t))}renderPartialHTML(e,t){return p(t==null?e:_({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(W(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(W(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(!(o.annotations.length===0&&a.annotations.length===0))return{deletionSpan:a,additionSpan:o}}renderHeader(e,t,n){let{themeType:r}=this.getOptionsWithDefaults();return zt({fileOrDiff:e,themeStyles:t,themeType:n??r})}};function hn(e,t){return ae(e.theme,t.theme)&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType}function gn(e){return`${e} unmodified line${e>1?`s`:``}`}function _n({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,context:s}){let c=!1;if(e===`unified`){if(r==null?n!=null&&s.unifiedContentAST.push(n):s.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;s.unifiedContentAST.push(It(i)),s.pushToGutter(`unified`,D(e,`annotation`,1)),c=!0}}else if(e===`split`){if(n!=null&&s.deletionsContentAST.push(n),r!=null&&s.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;s.deletionsContentAST.push(It(a)),s.pushToGutter(`deletions`,D(e,`annotation`,1)),c=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;s.additionsContentAST.push(It(o)),s.pushToGutter(`additions`,D(e,`annotation`,1)),c=!0}}c&&s.incrementRowCount(1)}function vn(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,$({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push($({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,$({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push($({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=un(e,t),d=r>c.expansionLineCount,f=s?t:void 0;c.pushToGutter(e,$({type:c.hunkSeparators,content:gn(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push($({type:c.hunkSeparators,content:gn(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:n,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function yn(e){let t=e.hunks.at(-1);if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let n=e.additionLines.length-(t.additionLineIndex+t.additionCount),r=e.deletionLines.length-(t.deletionLineIndex+t.deletionCount);if(n!==r)throw Error(`DiffHunksRenderer.processDiffResult: trailing context mismatch (additions=${n}, deletions=${r}) for ${e.name}`);return Math.min(n,r)}function bn(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function xn(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function Sn(e){let t=e[0];if(t!==`+`&&t!==`-`&&t!==` `&&t!==`\\`){console.error(`parseLineType: Invalid firstChar: "${t}", full line: "${e}"`);return}let n=e.substring(1);return{line:n===``?`
|
|
1427
|
+
`:n,type:t===` `?`context`:t===`\\`?`metadata`:t===`+`?`addition`:`deletion`}}function Cn(e,t,n=!1){let r=z.test(e),i=e.split(r?z:V),a,o=[];for(let e of i){if(r&&!z.test(e)){if(a==null)a=e;else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}else if(!r&&!V.test(e)){if(a==null)a=e;else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let i=wn(e,{cacheKey:t==null?void 0:`${t}-${o.length}`,isGitDiff:r,throwOnError:n});i!=null&&o.push(i)}return{patchMetadata:a,files:o}}function wn(e,{cacheKey:t,isGitDiff:n=z.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=e.split(Ce),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=e.split(Ge),f=s.shift();if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=f.match(he),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?i.contents.split(Ge):[],deletionLines:!l&&r!=null&&i!=null?r.contents.split(Ge):[],cacheKey:t},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0),s.unshift(f);for(let e of s){let t=e.match(n?ze:Me);if(e.startsWith(`diff --git`)){let[,,t,,n]=e.trim().match(y)??[];c.name=n.trim(),t!==n&&(c.prevName=t.trim())}else if(t!=null){let[,e,n]=t;e===`---`&&n!==`/dev/null`?(c.prevName=n.trim(),c.name=n.trim()):e===`+++`&&n!==`/dev/null`&&(c.name=n.trim())}else if(n){if(e.startsWith(`new mode `)&&(c.mode=e.replace(`new mode`,``).trim()),e.startsWith(`old mode `)&&(c.prevMode=e.replace(`old mode`,``).trim()),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=e.replace(`new file mode`,``).trim()),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=e.replace(`deleted file mode`,``).trim()),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(ke)??[];t!=null&&(c.prevObjectId=t),n!=null&&(c.newObjectId=n),r!=null&&(c.mode=r)}e.startsWith(`rename from `)&&(c.prevName=e.replace(`rename from `,``)),e.startsWith(`rename to `)&&(c.name=e.replace(`rename to `,``).trim())}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
1428
|
+
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
1429
|
+
`||s[s.length-1]===``);)s.pop();let v=parseInt(p[3]),b=parseInt(p[1]);u=l?u:b-1,d=l?d:v-1;let x={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:parseInt(p[4]??`1`),additionStart:v,additionLines:m,deletionCount:parseInt(p[2]??`1`),deletionStart:b,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:p[5],hunkSpecs:f,noEOFCRAdditions:!1,noEOFCRDeletions:!1};if(isNaN(x.additionCount)||isNaN(x.deletionCount)||isNaN(x.additionStart)||isNaN(x.deletionStart)){if(a)throw Error(`parsePatchContent: invalid hunk metadata`);console.error(`parsePatchContent: invalid hunk metadata`,x);continue}for(let e of s){let t=Sn(e);if(t==null){console.error(`processFile: invalid rawLine:`,e);continue}let{type:n,line:r}=t;if(n===`addition`)(g==null||g.type!==`change`)&&(g=En(`change`,u,d),x.hunkContent.push(g)),d++,l&&c.additionLines.push(r),g.additions++,m++,_=`addition`;else if(n===`deletion`)(g==null||g.type!==`change`)&&(g=En(`change`,u,d),x.hunkContent.push(g)),u++,l&&c.deletionLines.push(r),g.deletions++,h++,_=`deletion`;else if(n===`context`)(g==null||g.type!==`context`)&&(g=En(`context`,u,d),x.hunkContent.push(g)),d++,u++,l&&(c.deletionLines.push(r),c.additionLines.push(r)),g.lines++,_=`context`;else if(n===`metadata`&&g!=null){if(g.type===`context`?(x.noEOFCRAdditions=!0,x.noEOFCRDeletions=!0):_===`deletion`?x.noEOFCRDeletions=!0:_===`addition`&&(x.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=et(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=et(c.deletionLines[e]))}}}x.additionLines=m,x.deletionLines=h,x.collapsedBefore=Math.max(x.additionStart-1-o,0),c.hunks.push(x),o=x.additionStart+x.additionCount-1;for(let e of x.hunkContent)e.type===`context`?(x.splitLineCount+=e.lines,x.unifiedLineCount+=e.lines):(x.splitLineCount+=Math.max(e.additions,e.deletions),x.unifiedLineCount+=e.deletions+e.additions);x.splitLineStart=c.splitLineCount+x.collapsedBefore,x.unifiedLineStart=c.unifiedLineCount+x.collapsedBefore,c.splitLineCount+=x.collapsedBefore+x.splitLineCount,c.unifiedLineCount+=x.collapsedBefore+x.unifiedLineCount}if(c!=null){if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=e.additionStart+e.additionCount-1,n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:i!=null&&i.contents===``?c.type=`deleted`:r!=null&&r.contents===``&&(c.type=`new`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),c}}function Tn(e,t,n=!1){let r=[];for(let i of e.split(le))try{r.push(Cn(i,t==null?void 0:`${t}-${r.length}`,n))}catch(e){if(n)throw e;console.error(e)}return r}function En(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}function Dn(e,n,r,i=!1){let a=wn(t(e.name,n.name,e.contents,n.contents,e.header,n.header,r),{cacheKey:(()=>{if(e.cacheKey!=null&&n.cacheKey!=null)return`${e.cacheKey}:${n.cacheKey}`})(),oldFile:e,newFile:n,throwOnError:i});if(a==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);return a}var On=-1,kn=class{static LoadedCustomComponent=!0;__id=`file-diff:${++On}`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;unsafeCSSStyle;gutterUtilityContent;headerElement;headerPrefix;headerMetadata;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;lastRowCount;enabled=!0;constructor(e={theme:N},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=new mn({...e,hunkSeparators:typeof e.hunkSeparators==`function`?`custom`:e.hunkSeparators},this.handleHighlightRender,this.workerManager),this.resizeManager=new Mt,this.scrollSyncManager=new on,this.interactionManager=new Tt(`diff`,Et(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getLineIndex=(e,t=`additions`)=>{if(this.fileDiff==null)return;let n=this.fileDiff.hunks.at(-1),r,i;hunkIterator:for(let a of this.fileDiff.hunks){let o=t===`deletions`?a.deletionStart:a.additionStart,s=t===`deletions`?a.deletionCount:a.additionCount,c=a.splitLineStart,l=a.unifiedLineStart;if(e<o){let t=o-e;r=Math.max(l-t,0),i=Math.max(c-t,0);break hunkIterator}if(e>=o+s){if(a===n){let t=e-(o+s);r=l+a.unifiedLineCount+t,i=c+a.splitLineCount+t;break hunkIterator}continue}for(let n of a.hunkContent)if(n.type===`context`)if(e<o+n.lines){let t=e-o;i=c+t,r=l+t;break hunkIterator}else o+=n.lines,c+=n.lines,l+=n.lines;else{let a=t===`deletions`?n.deletions:n.additions;if(e<o+a){let a=e-o;r=l+(t===`additions`?n.deletions:0)+a,i=c+a;break hunkIterator}else o+=a,c+=Math.max(n.deletions,n.additions),l+=n.deletions+n.additions}break hunkIterator}if(!(r==null||i==null))return[r,i]};setOptions(e){e!=null&&(this.options=e,this.hunksRenderer.setOptions({...this.options,hunkSeparators:typeof e.hunkSeparators==`function`?`custom`:e.hunkSeparators}),this.interactionManager.setOptions(Et(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){if((this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.hunksRenderer.setThemeType(e),this.headerElement!=null&&(e===`system`?delete this.headerElement.dataset.themeType:this.headerElement.dataset.themeType=e),this.pre!=null))switch(e){case`system`:delete this.pre.dataset.themeType;break;case`light`:case`dark`:this.pre.dataset.themeType=e;break}}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e){this.interactionManager.setSelection(e)}cleanUp(e=!1){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.parentNode?.removeChild(this.fileContainer),this.fileContainer?.shadowRoot!=null&&(this.fileContainer.shadowRoot.innerHTML=``),this.fileContainer=void 0,this.pre!=null&&(this.pre.innerHTML=``,this.pre=void 0),this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.lastRenderedHeaderHTML=void 0,this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{overflow:t=`scroll`,diffStyle:n=`split`}=this.options,{fileContainer:r,prerenderedHTML:i}=e;en(r,i);for(let e of r.shadowRoot?.children??[]){if(e instanceof SVGElement){this.spriteSVG=e;continue}if(e instanceof HTMLElement){if(e instanceof HTMLPreElement){this.pre=e;for(let t of e.children)!(t instanceof HTMLElement)||t.tagName.toLowerCase()!==`code`||(`deletions`in t.dataset&&(this.codeDeletions=t),`additions`in t.dataset&&(this.codeAdditions=t),`unified`in t.dataset&&(this.codeUnified=t));continue}if(`diffsHeader`in e.dataset){this.headerElement=e;continue}if(e instanceof HTMLStyleElement&&e.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=e;continue}}}if(this.pre!=null&&this.syncCodeNodesFromPre(this.pre),this.pre==null)this.render(e);else{let{lineAnnotations:i,oldFile:a,newFile:o,fileDiff:s}=e;this.fileContainer=r,delete this.pre.dataset.dehydrated,this.lineAnnotations=i??this.lineAnnotations,this.additionFile=o,this.deletionFile=a,this.fileDiff=s??(a!=null&&o!=null?Dn(a,o):void 0),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,t===`wrap`),t===`scroll`&&n===`split`&&this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions)}}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({oldFile:this.deletionFile,newFile:this.additionFile,fileDiff:this.fileDiff,forceRender:!0,renderRange:this.renderRange})}handleExpandHunk=(e,t,n=!1)=>{if(n){this.expandHunkFully(e);return}this.expandHunk(e,t)};expandHunk(e,t){this.hunksRenderer.expandHunk(e,t),this.rerender()}expandHunkFully(e){this.hunksRenderer.expandHunkFully(e),this.rerender()}render({oldFile:e,newFile:t,fileDiff:n,forceRender:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let{collapsed:c=!1}=this.options,l=c?void 0:s,u=e!=null&&t!=null&&(!T(e,this.deletionFile)||!T(t,this.additionFile)),d=n!=null&&n!==this.fileDiff,f=i!=null&&(i.length>0||this.lineAnnotations.length>0)?i!==this.lineAnnotations:!1;if(!c&&Nt(l,this.renderRange)&&!r&&!f&&(n!=null&&n===this.fileDiff||n==null&&!u))return!1;let{renderRange:p}=this;if(this.renderRange=l,this.deletionFile=e,this.additionFile=t,n==null?e!=null&&t!=null&&u&&(d=!0,this.fileDiff=Dn(e,t)):this.fileDiff=n,i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.hunksRenderer.setOptions({...this.options,hunkSeparators:typeof this.options.hunkSeparators==`function`?`custom`:this.options.hunkSeparators}),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{diffStyle:m=`split`,disableErrorHandling:h=!1,disableFileHeader:g=!1,overflow:_=`scroll`}=this.options;if(g&&(this.headerElement!=null&&(this.headerElement.parentNode?.removeChild(this.headerElement),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.headerPrefix!=null&&(this.headerPrefix.parentNode?.removeChild(this.headerPrefix),this.headerPrefix=void 0),this.headerMetadata!=null&&(this.headerMetadata.parentNode?.removeChild(this.headerMetadata),this.headerMetadata=void 0)),a=this.getOrCreateFileContainer(a,o),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,Ue);e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(r,f,u||d)&&this.applyPartialRender({previousRenderRange:p,renderRange:l}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,l);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.parentNode?.removeChild(this.pre),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,l),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.interactionManager.setup(e),this.resizeManager.setup(e,_===`wrap`),_===`scroll`&&m===`split`?this.scrollSyncManager.setup(e,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return!0}removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.parentNode?.removeChild(e);this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.parentNode?.removeChild(e);this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.gutterUtilityContent?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.pre=void 0,this.spriteSVG=void 0,this.unsafeCSSStyle=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.parentNode?.removeChild(e);this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!xn(r,i.hunkData)){i?.element.parentNode?.removeChild(i.element);let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName,n.appendChild(t(r,this)),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.parentNode?.removeChild(t)}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.parentNode?.removeChild(e);this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${W(r)}`,a=this.annotationCache.get(i);if(a==null||!bn(r,a.annotation)){a?.element.parentElement?.removeChild(a.element);let e=t(r);if(e==null)continue;a={element:qt(W(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.parentNode?.removeChild(n)}renderGutterUtility(){let e=this.options.renderGutterUtility??this.options.renderHoverUtility;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.parentNode?.removeChild(this.gutterUtilityContent),this.gutterUtilityContent=void 0;return}let n=Jt();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let n=this.fileContainer;if(this.fileContainer=e??this.fileContainer??document.createElement(`diffs-container`),n!=null&&n!==this.fileContainer&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=Gt;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t,this.fileContainer.shadowRoot?.appendChild(this.spriteSVG))}return this.fileContainer}getFileContainer(){return this.fileContainer}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(`unified`in t.dataset?this.codeUnified=t:`deletions`in t.dataset?this.codeDeletions=t:`additions`in t.dataset&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let n=p(e);if(n!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=n;let r=e.firstElementChild;if(!(r instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(r):t.shadowRoot?.replaceChild(r,this.headerElement),this.headerElement=r,this.lastRenderedHeaderHTML=n}if(this.isContainerManaged)return;let{renderHeaderPrefix:r,renderHeaderMetadata:i}=this.options;this.headerPrefix!=null&&this.headerPrefix.parentNode?.removeChild(this.headerPrefix),this.headerMetadata!=null&&this.headerMetadata.parentNode?.removeChild(this.headerMetadata);let a=r?.({deletionFile:this.deletionFile,additionFile:this.additionFile,fileDiff:this.fileDiff})??void 0,o=i?.({deletionFile:this.deletionFile,additionFile:this.additionFile,fileDiff:this.fileDiff})??void 0;a!=null&&(this.headerPrefix=document.createElement(`div`),this.headerPrefix.slot=Ve,a instanceof Element?this.headerPrefix.appendChild(a):this.headerPrefix.innerText=`${a}`,t.appendChild(this.headerPrefix)),o!=null&&(this.headerMetadata=document.createElement(`div`),this.headerMetadata.slot=Pe,o instanceof Element?this.headerMetadata.appendChild(o):this.headerMetadata.innerText=`${o}`,t.appendChild(this.headerMetadata))}injectUnsafeCSS(){if(this.fileContainer?.shadowRoot==null)return;let{unsafeCSS:e}=this.options;e==null||e===``||(this.unsafeCSSStyle??(this.unsafeCSSStyle=Yt(),this.fileContainer.shadowRoot.appendChild(this.unsafeCSSStyle)),this.unsafeCSSStyle.innerText=Qt(e))}applyHunksToDOM(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=$t({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=$t({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=$t({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=An(t[0]),i=An(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}else throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,r){function i(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}if(e===`unified`)return i(t);{let e=i(n),t=i(r);return e!=null||t!=null?[e,t]:void 0}}applyBuffers(e,t){let{disableVirtualizationBuffers:n=!1}=this.options;if(n||t==null){this.bufferBefore!=null&&(this.bufferBefore.parentNode?.removeChild(this.bufferBefore),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.parentNode?.removeChild(this.bufferAfter),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.parentNode?.removeChild(this.bufferBefore),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.parentNode?.removeChild(this.bufferAfter),this.bufferAfter=void 0)}applyPreNodeAttributes(e,{themeStyles:t,baseThemeType:n,additionsContentAST:r,deletionsContentAST:i,totalLines:a}){let{diffIndicators:o=`bars`,disableBackground:s=!1,disableLineNumbers:c=!1,overflow:l=`scroll`,themeType:u=`system`,diffStyle:d=`split`}=this.options,f={type:`diff`,diffIndicators:o,disableBackground:s,disableLineNumbers:c,overflow:l,split:d===`unified`?!1:r!=null&&i!=null,themeStyles:t,themeType:n??u,totalLines:a};Kt(f,this.appliedPreAttributes)||(tn(e,f),this.appliedPreAttributes=f)}applyErrorToDOM(e,t){this.cleanupErrorWrapper();let n=this.getOrCreatePreNode(t);n.innerHTML=``,n.parentNode?.removeChild(n),this.pre=void 0,this.appliedPreAttributes=void 0;let r=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.innerHTML=``,r.appendChild(this.errorWrapper);let i=document.createElement(`div`);i.dataset.errorMessage=``,i.innerText=e.message,this.errorWrapper.appendChild(i);let a=document.createElement(`pre`);a.dataset.errorStack=``,a.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(a)}cleanupErrorWrapper(){this.errorWrapper?.parentNode?.removeChild(this.errorWrapper),this.errorWrapper=void 0}};function An(e){if(!(e==null||e.type!==`element`))return e.children??[]}function jn(t,n){let r={...e,...n};return r.hunkSeparatorHeight=Mn(t,n?.hunkSeparatorHeight),r}function Mn(e,t){if(t!=null)return t;switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}var Nn=-1,Pn=class extends kn{__id=`little-virtualized-file-diff:${++Nn}`;top;height=0;metrics;heightCache=new Map;isVisible=!1;virtualizer;constructor(e,t,n,r,i=!1){super(e,r,i);let{hunkSeparators:a=`line-info`}=this.options;this.virtualizer=t,this.metrics=jn(typeof a==`function`?`custom`:a,n)}getLineHeight(e,t=!1){let n=this.heightCache.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(e==null)return;let t=this.options.diffStyle,n=this.options.overflow,r=this.options.collapsed;super.setOptions(e),(t!==this.options.diffStyle||n!==this.options.overflow||r!==this.options.collapsed)&&(this.heightCache.clear(),this.computeApproximateSize(),this.renderRange=void 0),this.virtualizer.instanceChanged(this)}reconcileHeights(){let{overflow:e=`scroll`}=this.options;if(this.fileContainer!=null&&(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer)),this.fileContainer==null||this.fileDiff==null){this.height=0;return}if(e===`scroll`&&this.lineAnnotations.length===0&&!this.virtualizer.config.resizeDebugging)return;let t=this.getDiffStyle(),n=!1,r=t===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];for(let e of r){if(e==null)continue;let r=e.children[1];if(r instanceof HTMLElement)for(let e of r.children){if(!(e instanceof HTMLElement))continue;let r=e.dataset.lineIndex;if(r==null)continue;let i=In(r,t),a=e.getBoundingClientRect().height,o=!1;e.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in e.nextElementSibling.dataset||`noNewline`in e.nextElementSibling.dataset)&&(`noNewline`in e.nextElementSibling.dataset&&(o=!0),a+=e.nextElementSibling.getBoundingClientRect().height);let s=this.getLineHeight(i,o);a!==s&&(n=!0,a===this.metrics.lineHeight*(o?2:1)?this.heightCache.delete(i):this.heightCache.set(i,a))}}(n||this.virtualizer.config.resizeDebugging)&&this.computeApproximateSize()}onRender=e=>this.fileContainer==null?!1:(e&&(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer)),this.render());cleanUp(){this.fileContainer!=null&&this.virtualizer.disconnect(this.fileContainer),super.cleanUp()}expandHunk(e,t){this.hunksRenderer.expandHunk(e,t),this.computeApproximateSize(),this.renderRange=void 0,this.virtualizer.instanceChanged(this)}expandHunkFully(e){this.hunksRenderer.expandHunkFully(e),this.computeApproximateSize(),this.renderRange=void 0,this.virtualizer.instanceChanged(this)}setVisibility(e){this.fileContainer!=null&&(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}computeApproximateSize(){let e=this.height===0;if(this.height=0,this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1,hunkSeparators:a=`line-info`}=this.options,{diffHeaderHeight:o,fileGap:s,hunkSeparatorHeight:c}=this.metrics,l=this.getDiffStyle(),u=a!==`simple`&&a!==`metadata`&&a!==`line-info-basic`?s:0;if(t?a!==`simple`&&a!==`metadata`&&(this.height+=s):this.height+=o,!r&&(we({diff:this.fileDiff,diffStyle:l,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:e,collapsedBefore:t,collapsedAfter:n,deletionLine:r,additionLine:i})=>{let o=i==null?r.splitLineIndex:i.splitLineIndex,s=i==null?r.unifiedLineIndex:i.unifiedLineIndex,d=(i?.noEOFCR??!1)||(r?.noEOFCR??!1);t>0&&(e>0&&(this.height+=u),this.height+=c+u),this.height+=this.getLineHeight(l===`split`?o:s,d),n>0&&a!==`simple`&&(this.height+=u+c)}}),this.fileDiff.hunks.length>0&&(this.height+=s),this.fileContainer!=null&&this.virtualizer.config.resizeDebugging&&!e)){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:this.fileDiff.name,elementHeight:e.height,computedHeight:this.height})}}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:r,...i}={}){let a=this.fileContainer==null;if(this.fileDiff??=r??(t!=null&&n!=null?Dn(t,n):void 0),e=this.getOrCreateFileContainer(e),this.fileDiff==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(a?(this.computeApproximateSize(),this.virtualizer.connect(e,this),this.top??=this.virtualizer.getOffsetInScrollContainer(e),this.isVisible=this.virtualizer.isInstanceVisible(this.top,this.height)):this.top??=this.virtualizer.getOffsetInScrollContainer(e),!this.isVisible)return this.renderPlaceholder(this.height);let o=this.virtualizer.getWindowSpecs(),s=this.computeRenderRangeFromWindow(this.fileDiff,this.top,o);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:s,oldFile:t,newFile:n,...i})}getDiffStyle(){return this.options.diffStyle??`split`}getExpandedRegion(e,t,n){if(n<=0||e)return{fromStart:0,fromEnd:0,collapsedLines:Math.max(n,0),renderAll:!1};let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;if(r||n<=i)return{fromStart:n,fromEnd:0,collapsedLines:0,renderAll:!0};let a=this.hunksRenderer.getExpandedHunk(t),o=Math.min(Math.max(a.fromStart,0),n),s=Math.min(Math.max(a.fromEnd,0),n),c=o+s,l=c>=n;return{fromStart:o,fromEnd:s,collapsedLines:Math.max(n-c,0),renderAll:l}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}for(let[r,i]of e.hunks.entries()){let a=t===`split`?i.splitLineCount:i.unifiedLineCount;n+=a;let o=Math.max(i.collapsedBefore,0),{fromStart:s,fromEnd:c,renderAll:l}=this.getExpandedRegion(e.isPartial,r,o);o>0&&(n+=l?o:s+c)}let r=e.hunks.at(-1);if(r!=null&&Fn(e)){let t=e.additionLines.length-(r.additionLineIndex+r.additionCount),i=e.deletionLines.length-(r.deletionLineIndex+r.deletionCount);if(r!=null&&t!==i)throw Error(`VirtualizedFileDiff: trailing context mismatch (additions=${t}, deletions=${i}) for ${e.name}`);let a=Math.min(t,i);if(r!=null&&a>0){let{fromStart:t,renderAll:r}=this.getExpandedRegion(e.isPartial,e.hunks.length,a);n+=r?a:t}}return n}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1,hunkSeparators:s=`line-info`}=this.options,{diffHeaderHeight:c,fileGap:l,hunkLineCount:u,hunkSeparatorHeight:d,lineHeight:f}=this.metrics,p=this.getDiffStyle(),m=this.height,h=this.getExpandedLineCount(e,p),g=i?l:c;if(t<n-m||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-g-l};if(h<=u||e.hunks.length===0)return{startingLine:0,totalLines:u,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/f),v=Math.ceil(_/u)*u+u,y=v/u,b=y,x=[],S=(n+r)/2,C=s===`simple`||s===`metadata`||s===`line-info-basic`?0:l,w=t+g,T=0,E,D,O;if(we({diff:e,diffStyle:p,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,collapsedBefore:i,collapsedAfter:a,deletionLine:o,additionLine:c})=>{let l=c==null?o.splitLineIndex:c.splitLineIndex,f=c==null?o.unifiedLineIndex:c.unifiedLineIndex,m=(c?.noEOFCR??!1)||(o?.noEOFCR??!1),h=i>0?d+C+(e>0?C:0):0;e===0&&s===`simple`&&(h=0),w+=h;let _=T%u===0;if(_&&(x.push(w-(t+g+h)),O!=null)){if(O<=0)return!0;O--}let v=this.getLineHeight(p===`split`?l:f,m),y=Math.floor(T/u);return w>n-v&&w<r&&(E??=y),D==null&&w+v>S&&(D=y),O==null&&w>=r&&_&&(O=b),T++,w+=v,a>0&&s!==`simple`&&(w+=d+C),!1}}),E==null)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-g-l};let k=x.length;D??=E;let A=Math.round(D-y/2),j=Math.max(0,k-y),M=Math.max(0,Math.min(A,j)),N=M*u,P=A<0?v+A*u:v,ee=x[M]??0,F=M+P/u;return{startingLine:N,totalLines:P,bufferBefore:ee,bufferAfter:F<x.length?m-g-x[F]-l:m-(w-t)-l}}};function Fn(e){let t=e.hunks.at(-1);return t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0?!1:t.additionLineIndex+t.additionCount<e.additionLines.length||t.deletionLineIndex+t.deletionCount<e.deletionLines.length}function In(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}var Ln=typeof window>`u`?X.useEffect:X.useLayoutEffect;function Rn({oldFile:e,newFile:t,fileDiff:n,options:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:o,metrics:s}){let c=bt(),l=(0,X.useContext)(k),u=(0,X.useRef)(null),d=xt(a=>{if(a!=null){if(u.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);c==null?u.current=new kn(r,l,!0):u.current=new Pn(r,c,s,l,!0),u.current.hydrate({fileDiff:n,oldFile:e,newFile:t,fileContainer:a,lineAnnotations:i,prerenderedHTML:o})}else{if(u.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);u.current.cleanUp(),u.current=null}});return Ln(()=>{if(u.current==null)return;let o=u.current,s=!rn(o.options,r);o.setOptions(r),o.render({forceRender:s,fileDiff:n,oldFile:e,newFile:t,lineAnnotations:i}),a!==void 0&&o.setSelectedLines(a)}),{ref:d,getHoveredLine:(0,X.useCallback)(()=>u.current?.getHoveredLine(),[])}}function zn({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:a,style:o,prerenderedHTML:s,renderAnnotation:c,renderHeaderPrefix:l,renderHeaderMetadata:u,renderGutterUtility:d,renderHoverUtility:f}){let{ref:p,getHoveredLine:m}=Rn({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:s});return(0,G.jsx)(H,{ref:p,className:a,style:o,children:at(an({fileDiff:e,renderHeaderPrefix:l,renderHeaderMetadata:u,renderAnnotation:c,renderGutterUtility:d,lineAnnotations:r,renderHoverUtility:f,getHoveredLine:m}),s)})}function Bn(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var Vn=[];function Hn(e){let{itemSizes:t,cols:r=1,loopFocus:i=!0,dense:a=!1,orientation:s=`both`,direction:l,highlightedIndex:d,onHighlightedIndexChange:f,rootRef:p,enableHomeAndEndKeys:m=!1,stopEventPropagation:h=!1,disabledIndices:g,modifierKeys:_=Vn}=e,[v,y]=X.useState(0),b=r>1,x=X.useRef(null),S=w(x,p),C=X.useRef([]),T=X.useRef(!1),D=d??v,O=E((e,t=!1)=>{if((f??y)(e),t){let t=C.current[e];Xe(x.current,t,l,s)}}),k=E(e=>{if(e.size===0||T.current)return;T.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,r=n?t.indexOf(n):-1;r!==-1&&O(r),Xe(x.current,n,l,s)}),j=X.useMemo(()=>({"aria-orientation":s===`both`?void 0:s,ref:S,onFocus(e){!x.current||!pe(e.target)||e.target.setSelectionRange(0,e.target.value.length??0)},onKeyDown(e){let d=m?B:We;if(!d.has(e.key)||Un(e,_)||!x.current)return;let f=l===`rtl`,p=f?ge:U,v={horizontal:p,vertical:Oe,both:p}[s],y=f?U:ge,S={horizontal:y,vertical:Fe,both:y}[s];if(pe(e.target)&&!Bn(e.target)){let t=e.target.selectionStart,n=e.target.selectionEnd,r=e.target.value??``;if(t==null||e.shiftKey||t!==n||e.key!==S&&t<r.length||e.key!==v&&t>0)return}let w=D,T=De(C,g),E=A(C,g);if(b){let n=t||Array.from({length:C.current.length},()=>({width:1,height:1})),l=o(n,r,a),d=l.findIndex(e=>e!=null&&!Te(C,e,g)),p=l.reduce((e,t,n)=>t!=null&&!Te(C,t,g)?n:e,-1);w=l[c({current:l.map(e=>e?C.current[e]:null)},{event:e,orientation:s,loopFocus:i,cols:r,disabledIndices:u([...g||C.current.map((e,t)=>Te(C,t)?t:void 0),void 0],l),minIndex:d,maxIndex:p,prevIndex:ne(D>E?T:D,n,l,r,e.key===`ArrowDown`?`bl`:e.key===`ArrowRight`?`tr`:`tl`),rtl:f})]}let k={horizontal:[p],vertical:[Oe],both:[p,Oe]}[s],j={horizontal:[y],vertical:[Fe],both:[y,Fe]}[s],M=b?d:{horizontal:m?ve:be,vertical:m?Qe:Ke,both:d}[s];m&&(e.key===`Home`?w=T:e.key===`End`&&(w=E)),w===D&&(k.includes(e.key)||j.includes(e.key))&&(w=i&&w===E&&k.includes(e.key)?T:i&&w===T&&j.includes(e.key)?E:Ye(C,{startingIndex:w,decrement:j.includes(e.key),disabledIndices:g})),w!==D&&!n(C,w)&&(h&&e.stopPropagation(),M.has(e.key)&&e.preventDefault(),O(w,!0),queueMicrotask(()=>{C.current[w]?.focus()}))}}),[r,a,l,g,C,m,D,b,t,i,S,_,O,s,h]);return X.useMemo(()=>({props:j,highlightedIndex:D,onHighlightedIndexChange:O,elementsRef:C,disabledIndices:g,onMapChange:k,relayKeyboardEvent:j.onKeyDown}),[j,D,O,C,g,k])}function Un(e,t){for(let n of ue.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Wn(e){let{render:t,className:n,refs:r=f,props:i=f,state:a=v,stateAttributesMapping:o,highlightedIndex:s,onHighlightedIndexChange:c,orientation:l,dense:u,itemSizes:d,loopFocus:p,cols:m,enableHomeAndEndKeys:h,onMapChange:g,stopEventPropagation:_=!0,rootRef:y,disabledIndices:b,modifierKeys:x,highlightItemOnHover:S=!1,tag:C=`div`,...w}=e,{props:T,highlightedIndex:E,onHighlightedIndexChange:D,elementsRef:O,onMapChange:k,relayKeyboardEvent:A}=Hn({itemSizes:d,cols:m,loopFocus:p,dense:u,orientation:l,highlightedIndex:s,onHighlightedIndexChange:c,rootRef:y,stopEventPropagation:_,enableHomeAndEndKeys:h,direction:Ze(),disabledIndices:b,modifierKeys:x}),j=M(C,e,{state:a,ref:r,props:[T,...i,w],stateAttributesMapping:o}),N=X.useMemo(()=>({highlightedIndex:E,onHighlightedIndexChange:D,highlightItemOnHover:S,relayKeyboardEvent:A}),[E,D,S,A]);return(0,G.jsx)(te.Provider,{value:N,children:(0,G.jsx)(Be,{elementsRef:O,onMapChange:e=>{g?.(e),k(e)},children:j})})}let Gn=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({});var Kn={multiple(e){return e?{[Gn.multiple]:``}:null}};const qn=X.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:o=`horizontal`,multiple:s=!1,value:c,className:l,render:u,...d}=e,f=Ne(!0),p=X.useMemo(()=>{if(c===void 0)return n??[]},[c,n]),m=X.useMemo(()=>c!==void 0||n!==void 0,[c,n]),h=(f?.disabled??!1)||r,[g,_]=F({controlled:c,default:p,name:`ToggleGroup`,state:`value`}),v=E((e,t,n)=>{let r;if(s?(r=g.slice(),t?r.push(e):r.splice(g.indexOf(e),1)):r=t?[e]:[],Array.isArray(r)){if(a?.(r,n),n.isCanceled)return;_(r)}}),y={disabled:h,multiple:s,orientation:o},b=X.useMemo(()=>({disabled:h,orientation:o,setGroupValue:v,value:g,isValueInitialized:m}),[h,o,v,g,m]),x={role:`group`},S=M(`div`,e,{enabled:!!f,state:y,ref:t,props:[x,d],stateAttributesMapping:Kn});return(0,G.jsx)(je.Provider,{value:b,children:f?S:(0,G.jsx)(Wn,{render:u,className:l,state:y,refs:[t],props:[x,d],stateAttributesMapping:Kn,loopFocus:i,enableHomeAndEndKeys:!0})})});var Jn=tt(),Yn=X.createContext({size:`default`,variant:`default`});function Xn(e){let t=(0,Jn.c)(24),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,variant:a,size:o,orientation:s,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`default`:a,l=o===void 0?`default`:o,u=s===void 0?`horizontal`:s,d,f;t[7]!==l||t[8]!==c?(f={size:l,variant:c},t[7]=l,t[8]=c,t[9]=f):f=t[9],d=f;let p=d,m=u===`horizontal`?`*:pointer-coarse:after:min-w-auto`:`*:pointer-coarse:after:min-h-auto`,h=c===`default`?`gap-0.5`:u===`horizontal`?`*:not-first:not-data-[slot=separator]:before:-start-[0.5px] *:not-last:not-data-[slot=separator]:before:-end-[0.5px] *:not-first:rounded-s-none *:not-last:rounded-e-none *:not-first:border-s-0 *:not-last:border-e-0 *:not-first:before:rounded-s-none *:not-last:before:rounded-e-none`:`*:not-first:not-data-[slot=separator]:before:-top-[0.5px] *:not-last:not-data-[slot=separator]:before:-bottom-[0.5px] flex-col *:not-first:rounded-t-none *:not-last:rounded-b-none *:not-first:border-t-0 *:not-last:border-b-0 *:not-first:before:rounded-t-none *:not-last:before:rounded-b-none *:data-[slot=toggle]:not-last:before:hidden dark:*:last:before:hidden dark:*:first:before:block`,g;t[10]!==r||t[11]!==m||t[12]!==h?(g=O(`flex w-fit *:focus-visible:z-10 dark:*:[[data-slot=separator]:has(+[data-slot=toggle]:hover)]:before:bg-input/64 dark:*:[[data-slot=separator]:has(+[data-slot=toggle][data-pressed])]:before:bg-input dark:*:[[data-slot=toggle]:hover+[data-slot=separator]]:before:bg-input/64 dark:*:[[data-slot=toggle][data-pressed]+[data-slot=separator]]:before:bg-input`,m,h,r),t[10]=r,t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==n||t[15]!==p?(_=(0,G.jsx)(Yn.Provider,{value:p,children:n}),t[14]=n,t[15]=p,t[16]=_):_=t[16];let v;return t[17]!==u||t[18]!==i||t[19]!==l||t[20]!==g||t[21]!==_||t[22]!==c?(v=(0,G.jsx)(qn,{className:g,"data-size":l,"data-slot":`toggle-group`,"data-variant":c,orientation:u,...i,children:_}),t[17]=u,t[18]=i,t[19]=l,t[20]=g,t[21]=_,t[22]=c,t[23]=v):v=t[23],v}function Zn(e){let t=(0,Jn.c)(12),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:o,size:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=X.useContext(Yn),c=o??s.variant,l=a??s.size,u;return t[6]!==n||t[7]!==r||t[8]!==i||t[9]!==l||t[10]!==c?(u=(0,G.jsx)(He,{className:r,"data-size":l,"data-variant":c,size:l,variant:c,...i,children:n}),t[6]=n,t[7]=r,t[8]=i,t[9]=l,t[10]=c,t[11]=u):u=t[11],u}var Qn=`
|
|
1430
|
+
[data-diffs-header],
|
|
1431
|
+
[data-diff],
|
|
1432
|
+
[data-file],
|
|
1433
|
+
[data-error-wrapper],
|
|
1434
|
+
[data-virtualizer-buffer] {
|
|
1435
|
+
--diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1436
|
+
--diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1437
|
+
--diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
1438
|
+
--diffs-token-light-bg: transparent;
|
|
1439
|
+
--diffs-token-dark-bg: transparent;
|
|
1440
|
+
|
|
1441
|
+
--diffs-bg-context-override: color-mix(in srgb, var(--background) 97%, var(--foreground));
|
|
1442
|
+
--diffs-bg-hover-override: color-mix(in srgb, var(--background) 94%, var(--foreground));
|
|
1443
|
+
--diffs-bg-separator-override: color-mix(in srgb, var(--background) 95%, var(--foreground));
|
|
1444
|
+
--diffs-bg-buffer-override: color-mix(in srgb, var(--background) 90%, var(--foreground));
|
|
1445
|
+
|
|
1446
|
+
--diffs-bg-addition-override: color-mix(in srgb, var(--background) 92%, var(--success));
|
|
1447
|
+
--diffs-bg-addition-number-override: color-mix(in srgb, var(--background) 88%, var(--success));
|
|
1448
|
+
--diffs-bg-addition-hover-override: color-mix(in srgb, var(--background) 85%, var(--success));
|
|
1449
|
+
--diffs-bg-addition-emphasis-override: color-mix(in srgb, var(--background) 80%, var(--success));
|
|
1450
|
+
|
|
1451
|
+
--diffs-bg-deletion-override: color-mix(in srgb, var(--background) 92%, var(--destructive));
|
|
1452
|
+
--diffs-bg-deletion-number-override: color-mix(in srgb, var(--background) 88%, var(--destructive));
|
|
1453
|
+
--diffs-bg-deletion-hover-override: color-mix(in srgb, var(--background) 85%, var(--destructive));
|
|
1454
|
+
--diffs-bg-deletion-emphasis-override: color-mix(
|
|
1455
|
+
in srgb,
|
|
1456
|
+
var(--background) 80%,
|
|
1457
|
+
var(--destructive)
|
|
1458
|
+
);
|
|
1459
|
+
|
|
1460
|
+
background-color: var(--diffs-bg) !important;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
[data-file-info] {
|
|
1464
|
+
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
1465
|
+
border-block-color: var(--border) !important;
|
|
1466
|
+
color: var(--foreground) !important;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
[data-diffs-header] {
|
|
1470
|
+
position: sticky !important;
|
|
1471
|
+
top: 0;
|
|
1472
|
+
z-index: 4;
|
|
1473
|
+
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
1474
|
+
border-bottom: 1px solid var(--border) !important;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
[data-title] {
|
|
1478
|
+
cursor: pointer;
|
|
1479
|
+
transition:
|
|
1480
|
+
color 120ms ease,
|
|
1481
|
+
text-decoration-color 120ms ease;
|
|
1482
|
+
text-decoration: underline;
|
|
1483
|
+
text-decoration-color: transparent;
|
|
1484
|
+
text-underline-offset: 2px;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
[data-title]:hover {
|
|
1488
|
+
color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;
|
|
1489
|
+
text-decoration-color: currentColor;
|
|
1490
|
+
}
|
|
1491
|
+
`;function $n(e,t=`diff-panel`){if(!e)return null;let n=e.trim();if(n.length===0)return null;try{let e=Tn(n,I(n,t)).flatMap(e=>e.files);return e.length>0?{kind:`files`,files:e}:{kind:`raw`,text:n,reason:`Unsupported diff format. Showing raw patch.`}}catch{return{kind:`raw`,text:n,reason:`Failed to parse patch. Showing raw patch.`}}}function er(e){let t=e.name??e.prevName??``;return t.startsWith(`a/`)||t.startsWith(`b/`)?t.slice(2):t}function tr(e){return e.cacheKey??`${e.prevName??`none`}:${e.name}`}function nr(e){return new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(e))}function rr({mode:e=`inline`}){let t=g(),{resolvedTheme:n}=s(),[r,o]=(0,X.useState)(`stacked`),c=(0,X.useRef)(null),u=(0,X.useRef)(null),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),h=ce({strict:!1,select:e=>e.threadId?ee.makeUnsafe(e.threadId):null}),_=ie({strict:!1,select:e=>Se(e)}),v=h,y=ye(e=>v?e.threads.find(e=>e.id===v):void 0),b=y?.projectId??null,x=ye(e=>b?e.projects.find(e=>e.id===b):void 0),S=y?.worktreePath??x?.cwd,C=i(a(S??null)).data?.isRepo??!0,{turnDiffSummaries:w,inferredCheckpointTurnCountByTurnId:T}=Re(y),E=(0,X.useMemo)(()=>[...w].toSorted((e,t)=>{let n=e.checkpointTurnCount??T[e.turnId]??0,r=t.checkpointTurnCount??T[t.turnId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[T,w]),D=_.diffTurnId??null,k=D===null?null:_.diffFilePath??null,A=D===null?void 0:E.find(e=>e.turnId===D)??E[0],j=A&&(A.checkpointTurnCount??T[A.turnId]),M=(0,X.useMemo)(()=>typeof j==`number`?{fromTurnCount:Math.max(0,j-1),toTurnCount:j}:null,[j]),N=(0,X.useMemo)(()=>{let e=E.map(e=>e.checkpointTurnCount??T[e.turnId]).filter(e=>typeof e==`number`);if(e.length===0)return;let t=Math.max(...e);return t>0?t:void 0},[T,E]),P=(0,X.useMemo)(()=>!A&&typeof N==`number`?{fromTurnCount:0,toTurnCount:N}:null,[N,A]),F=A?M:P,te=(0,X.useMemo)(()=>A||E.length===0?null:`conversation:${E.map(e=>e.turnId).join(`,`)}`,[E,A]),I=i(Ie({threadId:v,fromTurnCount:F?.fromTurnCount??null,toTurnCount:F?.toTurnCount??null,cacheScope:A?`turn:${A.turnId}`:te,enabled:C})),ne=A?I.data?.diff:void 0,re=A?void 0:I.data?.diff,ae=I.isLoading,se=I.error instanceof Error?I.error.message:I.error?`Failed to load checkpoint diff.`:null,L=A?ne:re,le=typeof L==`string`&&L.trim().length===0,R=(0,X.useMemo)(()=>$n(L,`diff-panel:${n}`),[n,L]),ue=(0,X.useMemo)(()=>!R||R.kind!==`files`?[]:R.files.toSorted((e,t)=>er(e).localeCompare(er(t),void 0,{numeric:!0,sensitivity:`base`})),[R]);(0,X.useEffect)(()=>{!k||!c.current||Array.from(c.current.querySelectorAll(`[data-diff-file-path]`)).find(e=>e.dataset.diffFilePath===k)?.scrollIntoView({block:`nearest`})},[k,ue]);let z=(0,X.useCallback)(e=>{let t=de();if(!t)return;let n=S?xe(e,S):e;t.shell.openInEditor(n,Ae()).catch(e=>{console.warn(`Failed to open diff file in editor.`,e)})},[S]),pe=e=>{y&&t({to:`/$threadId`,params:{threadId:y.id},search:t=>({...fe(t),diff:`1`,diffTurnId:e})})},me=()=>{y&&t({to:`/$threadId`,params:{threadId:y.id},search:e=>({...fe(e),diff:`1`})})},B=(0,X.useCallback)(()=>{let e=u.current;if(!e){f(!1),m(!1);return}let t=Math.max(0,e.scrollWidth-e.clientWidth);f(e.scrollLeft>4),m(e.scrollLeft<t-4)},[]),he=(0,X.useCallback)(e=>{let t=u.current;t&&t.scrollBy({left:e,behavior:`smooth`})},[]),ge=(0,X.useCallback)(e=>{let t=u.current;t&&(t.scrollWidth<=t.clientWidth+1||Math.abs(e.deltaY)<=Math.abs(e.deltaX)||(e.preventDefault(),t.scrollBy({left:e.deltaY,behavior:`auto`})))},[]);(0,X.useEffect)(()=>{let e=u.current;if(!e)return;let t=window.requestAnimationFrame(()=>B()),n=()=>B();e.addEventListener(`scroll`,n,{passive:!0});let r=new ResizeObserver(()=>B());return r.observe(e),()=>{window.cancelAnimationFrame(t),e.removeEventListener(`scroll`,n),r.disconnect()}},[B]),(0,X.useEffect)(()=>{let e=window.requestAnimationFrame(()=>B());return()=>{window.cancelAnimationFrame(e)}},[E,D,B]),(0,X.useEffect)(()=>{let e=u.current;e&&e.querySelector(`[data-turn-chip-selected='true']`)?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`smooth`})},[A?.turnId,D]);let V=oe&&e!==`sheet`,H=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`relative min-w-0 flex-1 [-webkit-app-region:no-drag]`,children:[d&&(0,G.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 left-8 z-10 w-7 bg-linear-to-r from-card to-transparent`}),p&&(0,G.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-8 z-10 w-7 bg-linear-to-l from-card to-transparent`}),(0,G.jsx)(`button`,{type:`button`,className:O(`absolute left-0 top-1/2 z-20 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md border bg-background/90 text-muted-foreground transition-colors`,d?`border-border/70 hover:border-border hover:text-foreground`:`cursor-not-allowed border-border/40 text-muted-foreground/40`),onClick:()=>he(-180),disabled:!d,"aria-label":`Scroll turn list left`,children:(0,G.jsx)($e,{className:`size-3.5`})}),(0,G.jsx)(`button`,{type:`button`,className:O(`absolute right-0 top-1/2 z-20 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md border bg-background/90 text-muted-foreground transition-colors`,p?`border-border/70 hover:border-border hover:text-foreground`:`cursor-not-allowed border-border/40 text-muted-foreground/40`),onClick:()=>he(180),disabled:!p,"aria-label":`Scroll turn list right`,children:(0,G.jsx)(qe,{className:`size-3.5`})}),(0,G.jsxs)(`div`,{ref:u,className:`turn-chip-strip flex gap-1 overflow-x-auto px-8 py-0.5`,onWheel:ge,children:[(0,G.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md`,onClick:me,"data-turn-chip-selected":D===null,children:(0,G.jsx)(`div`,{className:O(`rounded-md border px-2 py-1 text-left transition-colors`,D===null?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`),children:(0,G.jsx)(`div`,{className:`text-[10px] leading-tight font-medium`,children:`All turns`})})}),E.map(e=>(0,G.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md`,onClick:()=>pe(e.turnId),title:e.turnId,"data-turn-chip-selected":e.turnId===A?.turnId,children:(0,G.jsx)(`div`,{className:O(`rounded-md border px-2 py-1 text-left transition-colors`,e.turnId===A?.turnId?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`),children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] leading-tight font-medium`,children:[`Turn`,` `,e.checkpointTurnCount??T[e.turnId]??`?`]}),(0,G.jsx)(`span`,{className:`text-[9px] leading-tight opacity-70`,children:nr(e.completedAt)})]})})},e.turnId))]})]}),(0,G.jsxs)(Xn,{className:`shrink-0 [-webkit-app-region:no-drag]`,variant:`outline`,size:`xs`,value:[r],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&o(t)},children:[(0,G.jsx)(Zn,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,G.jsx)(rt,{className:`size-3`})}),(0,G.jsx)(Zn,{"aria-label":`Split diff view`,value:`split`,children:(0,G.jsx)(nt,{className:`size-3`})})]})]}),U=O(`flex items-center justify-between gap-2 px-4`,V?`drag-region h-[52px] border-b border-border`:`h-12`);return(0,G.jsxs)(`div`,{className:O(`flex h-full min-w-0 flex-col bg-background`,e===`inline`?`w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border`:`w-full`),children:[V?(0,G.jsx)(`div`,{className:U,children:H}):(0,G.jsx)(`div`,{className:`border-b border-border`,children:(0,G.jsx)(`div`,{className:U,children:H})}),y?C?E.length===0?(0,G.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):(0,G.jsx)(G.Fragment,{children:(0,G.jsxs)(`div`,{ref:c,className:`diff-panel-viewport min-h-0 min-w-0 flex-1 overflow-hidden`,children:[se&&!R&&(0,G.jsx)(`div`,{className:`px-3`,children:(0,G.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:se})}),R?R.kind===`files`?(0,G.jsx)(yt,{className:`diff-render-surface h-full min-h-0 overflow-auto px-2 pb-2`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:ue.map(e=>{let t=er(e),i=`${tr(e)}:${n}`;return(0,G.jsx)(`div`,{"data-diff-file-path":t,className:`diff-render-file mb-2 rounded-md first:mt-2 last:mb-0`,onClickCapture:e=>{(e.nativeEvent.composedPath?.()??[]).some(e=>e instanceof Element?e.hasAttribute(`data-title`):!1)&&z(t)},children:(0,G.jsx)(zn,{fileDiff:e,options:{diffStyle:r===`split`?`split`:`unified`,lineDiffType:`none`,theme:l(n),themeType:n,unsafeCSS:Qn}})},i)})}):(0,G.jsx)(`div`,{className:`h-full overflow-auto p-2`,children:(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:R.reason}),(0,G.jsx)(`pre`,{className:`max-h-[72vh] overflow-auto rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,children:R.text})]})}):(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,G.jsx)(`p`,{children:ae?`Loading checkpoint diff...`:le?`No net changes in this selection.`:`No patch available for this selection.`})})]})}):(0,G.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,G.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`})]})}export{Je as DiffWorkerPoolProvider,rr as default};
|