@ovvi/git 1.10.18 → 1.10.19
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/main.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-7KWJC2W6.js +0 -1268
- package/dist/chunk-7KWJC2W6.js.map +0 -7
- package/dist/chunk-WCYTONXE.js +0 -1268
- package/dist/chunk-WCYTONXE.js.map +0 -7
- package/dist/diff-3FNU73HZ.js +0 -189
- package/dist/diff-3FNU73HZ.js.map +0 -7
- package/dist/diff-4MDBQ4TI.js +0 -189
- package/dist/diff-4MDBQ4TI.js.map +0 -7
- package/dist/diff-G67YB4ZU.js +0 -189
- package/dist/diff-G67YB4ZU.js.map +0 -7
- package/dist/diff-GWAK3YVD.js +0 -189
- package/dist/diff-GWAK3YVD.js.map +0 -7
- package/dist/diff-NSSRY2DD.js +0 -189
- package/dist/diff-NSSRY2DD.js.map +0 -7
package/dist/diff-G67YB4ZU.js
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import{b as io}from"./chunk-PCGAFWTT.js";import{a as pe}from"./chunk-C56AI53H.js";import{B as no,C as Ce,D as xe,E as P,F as Ge,G as vt,H as oo,I as be,J as ro,K as so,M as ao,a as Un,b as Bn,c as Mi,d as Wn,e as Vn,f as $n,g as Wt,h as Vt,i as $t,j as Gt,k as de,l as Gn,m as qn,n as jn,o as qt,p as Kn,q as Xn,r as Yn,s as Fi,t as Qn,u as Jn,v as $e,w as Zn,x as it,y as eo,z as to}from"./chunk-RZFIF3I4.js";import"./chunk-LD5MXC65.js";import"./chunk-CNR63UD5.js";import{a as _e,d as _t,e as Ut,f as Ti,g as Ai,h as z,i as Di,j as On,l as Hi,m as Ii,n as Bt,o as zn,p as _n}from"./chunk-FCFY7OXT.js";import"./chunk-4C666HHU.js";function nt(e=de){let t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function bt(e,t=it()){return typeof t!="string"&&t.isDisposed?!1:(typeof t=="string"?no(t):t.themeResolver).hasResolvedThemes(nt(e))}var Re;async function lo(e){let t=it(e);eo(t);try{if(t==="highlights"){let{HighlightsHighlighter:n}=await import("./highlights-2J3UG3HR.js");return new n}let{ShikiHighlighter:i}=await import("./shiki-5JXJLENZ.js");return await i.create(t)}finally{to()}}async function ot({themes:e,langs:t,preferredHighlighter:i}){uo();let n=Re??=lo(Zn()??i),o;try{o=await n}catch(r){throw Re===n&&(Re=void 0),r}if(Re===n&&(Re=o),await Promise.all([o.themeResolver.resolveThemes(e),o.loadLanguages(t)]),o.isDisposed)throw new $e;return o}function uo(){Re!=null&&!("then"in Re)&&Re.isDisposed&&(Re=void 0)}function Fe({theme:e,lang:t,langs:i}={}){uo();let n=Re;if(!(n==null||"then"in n||e!=null&&!bt(e,n)||(t!=null||i!=null)&&!n.hasLoadedLanguages([...t!=null?[t]:[],...i??[]])))return n}async function Pi(e){await ot(e)}var rt=new Set,st=null;function ee(e){rt.add(e),st??=requestAnimationFrame(co)}function qe(e){rt.delete(e)&&rt.size===0&&st!=null&&(cancelAnimationFrame(st),st=null)}function co(e){let t=new Set(rt);rt.clear();for(let i of t)try{i(e)}catch(n){console.error(n)}rt.size>0?st=requestAnimationFrame(co):st=null}function St(e,t,i){if(e===t||e==null||t==null)return e===t;let n=new Set(i),o=Object.keys(e),r=new Set(Object.keys(t));for(let s of o)if(r.delete(s),!n.has(s)&&(!(s in t)||e[s]!==t[s]))return!1;for(let s of Array.from(r))if(!n.has(s))return!1;return!0}function at(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ho(e,t){let i=e?.theme??de,n=t?.theme??de,o=fo(e),r=fo(t);return at(i,n)&&St(e,t,["theme","parseDiffOptions"])&&St(o,r)}function fo(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function jt(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Ni({scrollTop:e,scrollHeight:t,height:i,fitPerfectly:n=!1,fitPerfectlyOverscroll:o=0,overscrollSize:r}){let s=i+r*2,l=n?i+o*2:s;if(t=Math.max(t,l),s>=t||n){let d=Math.max(e-o,0),c=Math.min(e+l,t);return{top:d,bottom:Math.max(c,d)}}let a=e+i/2-s/2,u=a+s;return a<0&&(a=0),u>t&&(u=t),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(u,t),a))}}function po(){return P({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[Ge({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function mo(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function yt(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||t.getAttribute("slot")==="gutter-utility-slot"||t.getAttribute("name")==="gutter-utility-slot"))return!0;return!1}var Co=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;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.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),qe(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:i=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),i?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,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(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let i=!(e===this.selectedRange||jt(e??void 0,this.selectedRange??void 0)),n=t?.lineNumberOnly??!1,o=t?.activeLineSide!==this.selectedRangeHighlightSide||n!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!i&&!o||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=n,this.renderSelection(),this.placeUtility(),i&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:i}={}){let n=e!==this.editorActiveLine,o=i!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!n&&!o||(this.editorActiveLine=e,this.editorActiveLineSide=i,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode==="diff"&&e.type==="diff-line")return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode==="file"&&e.type==="line")return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:i,onLineNumberClick:n,onTokenClick:o,onMergeConflictActionClick:r}=this.options;t==null&&i==null&&n==null&&r==null&&o==null||this.options.onGutterUtilityClick!=null&&yt(e.composedPath())||(Pe(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;let{lineHoverHighlight:t="disabled",onLineEnter:i,onLineLeave:n,onTokenEnter:o,onTokenLeave:r,enableGutterUtility:s=!1}=this.options;t==="disabled"&&!s&&i==null&&n==null&&o==null&&r==null||(Pe(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Pe(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){Pe(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:i}=this.options,n=t.composedPath();Pe(i,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:n});let o=this.resolvePointerTarget(n);Pe(i,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",o);let{onLineClick:r,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:u,onTokenEnter:d,onTokenLeave:c,onHunkExpand:h,onMergeConflictActionClick:f}=this.options;switch(e){case"move":{let m=Oi(o)&&this.hoveredLine?.lineElement===o.lineElement;Kt(o)&&this.hoveredToken?.tokenElement===o.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),Kt(o)&&(this.setHoveredToken(this.toTokenEventBaseProps(o)),d?.(this.hoveredToken,t))),m||(this.hoveredLine!=null&&(a?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Oi(o)?(this.setHoveredLine(this.toEventBaseProps(o)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(o==null)break;if(cs(o)&&f!=null){f(o);break}if(us(o)&&h!=null){h(o.hunkIndex,o.all||t.shiftKey?"both":o.direction,o.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!Oi(o))break;Kt(o)&&u!=null&&u(this.toTokenEventBaseProps(o),t);let m=this.toEventBaseProps(o);s!=null&&o.numberColumn?s({...m,event:t}):r?.({...m,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:i="disabled",onLineClick:n,onLineNumberClick:o,onLineEnter:r,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:u,onHunkExpand:d,onMergeConflictActionClick:c,enableGutterUtility:h=!1,enableLineSelection:f=!1,onGutterUtilityClick:m}=this.options,p=m!=null,b=i!=="disabled"||n!=null||o!=null||r!=null||s!=null||l!=null||a!=null||u!=null||d!=null||c!=null||h||f||p;b&&!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,Pe(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{let x=[];return(t==="both"||t==="click")&&(n!=null&&x.push("onLineClick"),o!=null&&x.push("onLineNumberClick"),d!=null&&x.push("expandable hunk separators"),c!=null&&x.push("merge conflict actions")),x})()),Pe(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),Pe(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!b&&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 S=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",g=this.pointerSession.mode==="gutterSelecting";(!f&&S||!p&&g)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:i=!1}=this.options,n=e!=null,o=t!=null||i;n&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!n&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),o&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!o&&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();yt(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let i=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(i==null)return;let{pre:n}=this;if(n==null)return;let{lineNumber:o,eventSide:r,lineIndex:s}=i;if(e.shiftKey&&this.selectedRange!=null){let l=this.getIndexesFromSelection(this.selectedRange,n.getAttribute("data-diff-type")==="split");if(l==null)return;let a=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:a?this.selectedRange.start:this.selectedRange.end,side:a?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(o,r,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===o&&this.selectedRange?.end===o){let l={lineNumber:o,side:r};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:o,side:r},this.updateSelection(o,r,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let i=this.currentSelectionEnds(),n=i?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),o=i?.top??n;n==null||o==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:o,current:n},this.selectionAnchor={lineNumber:o.lineNumber,side:o.side},this.updateSelection(n.lineNumber,n.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let i={lineNumber:t.lineNumber,side:t.eventSide};if(mo(this.pointerSession.pending,i))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{let{pointerSession:i}=this;if(e.pointerId!==i.pointerId)return;e.preventDefault();let n=this.resolveSelectionPoint(e,{source:"coordinates-first"});n!=null&&(i.current=n,this.updateSelection(n.lineNumber,n.side));let o=this.buildSelectedLineRange(i.anchor,i.current);t?.({...o}),this.selectionAnchor=void 0,this.notifySelectionEnd(o),this.notifySelectionCommitted(o),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};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.clearProposedSelection(),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",""))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer==null&&(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==null&&(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 t=document.createElement("div");t.innerHTML=Ce(po());let i=t.firstElementChild;if(!(i instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");i.remove(),this.gutterUtilityButton=i}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);xt(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},i={lineNumber:e.end,side:e.endSide??e.side},n=this.selectionPointRowIndex(t),o=this.selectionPointRowIndex(i);if(!(n==null||o==null))return n>o?{top:i,bottom:t}:{top:t,bottom:i}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let i=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,n=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${i}"]`);for(let o of n){if(!(o instanceof HTMLElement))continue;let r=this.resolvePointerTarget(Ct(o));if(xt(r)&&!(this.mode==="diff"&&e.side!=null&&r.side!==e.side))return r}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){let i=this.resolvePointerTarget(e);if(xt(i)&&!(t&&!i.numberColumn)&&i.splitLineIndex!=null)return{lineIndex:i.splitLineIndex,lineNumber:i.lineNumber,eventSide:this.mode==="diff"?i.side:void 0}}resolveSelectionInfo(e,t){let i=this.resolveSelectionPath(e,t);return i!=null?this.selectionInfoFromPath(i,t.requireNumberColumn):void 0}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(xt(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){let i=this.resolveSelectionPath(e,t);return i!=null?this.selectionPointFromPath(i):void 0}resolveSelectionPath(e,t){let i=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),i);case"coordinates-first":{let n=this.pathFromCoordinates(e,i);return n!==void 0?n??void 0:this.pathFromEventPath(e.composedPath(),i)}}}pathFromCoordinates(e,t){let i=this.hitTest(e);if(i!==void 0)return i===null?null:this.pathFromElement(i,t)??null}pathFromEventPath(e,t){if(!(t&&yt(e))){for(let i of e)if(i instanceof Element)return this.pathFromElement(i,t)}}pathFromElement(e,t){let i=Ct(e);if(t&&yt(i))return;let n=hs(e);return n!=null?Ct(n):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){let t=ps(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute("data-line")||t.hasAttribute("data-column-number")))return Ct(t);let i=gs(ms(e));if(i==null)return;let n=this.targetForSelectionPoint(i);return n!=null?Ct(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),i=vo(t)?t:vo(document)?document:void 0;if(i!=null)return i.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:i}=this.options;return i!=null?i(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,i=!0){let n=this.getCurrentSelectionRange(),o;if(e==null)o=null;else{let r=this.selectionAnchor?.side??t,s=this.selectionAnchor?.lineNumber??e;o=this.buildSelectionRange(s,e,r,t)}jt(n??void 0,o??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=o:(this.selectedRange=o,ee(this.renderSelection)),this.placeUtility(),i&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let i=this.getLineIndex(e.start,e.side),n=this.getLineIndex(e.end,e.endSide??e.side);return i!=null&&n!=null?{start:t?i[1]:i[0],end:t?n[1]:n[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,i){if(e.range==null)return;let n=this.getIndexesFromSelection(e.range,t);if(n==null)throw console.error({rowRange:n,range:e.range}),new Error(`InteractionManager.renderSelection: No valid ${i} rowRange`);return n}getLineRenderColumns(e,t,i,n){if(this.pre==null||t==null&&n==null)return[];let{children:o}=this.pre;if(o.length>2)throw console.error(o),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");let r=[];for(let s of o){let l=s.hasAttribute("data-deletions")?"deletions":s.hasAttribute("data-additions")?"additions":void 0,a=e!=null&&t!=null&&(e.highlightSide==null||l==null||e.highlightSide===l),u=i!=null&&n!=null&&(i.highlightSide==null||l==null||i.highlightSide===l);if(!a&&!u)continue;let[d,c]=s.children;if(!(d instanceof HTMLElement)||!(c instanceof HTMLElement))throw new Error("InteractionManager.renderSelection: missing gutter or content element");if(c.children.length!==d.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");r.push({content:c,gutter:d,renderEditorActiveLine:u,renderSelectedLines:a})}return r}renderSelection=()=>{qe(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:i}=e,n=!bo(this.renderedSelectedLinesState,i),o=!bo(this.renderedEditorActiveLineState,t);if(!n&&!o)return;n&&(this.renderedSelectedLinesState=void 0),o&&(this.renderedEditorActiveLineState=void 0);let r=this.pre.getAttribute("data-diff-type")==="split",s=n?this.resolveLineRenderRange(i,r,"selected-lines"):void 0,l=o?this.resolveLineRenderRange(t,r,"editor-active-line"):void 0,a=this.getLineRenderColumns(n?i:void 0,s,o?t:void 0,l),u=i.range==null||a.some(p=>p.renderSelectedLines),d=t.range==null||a.some(p=>p.renderEditorActiveLine);if(n)for(let p of this.pre.querySelectorAll("[data-selected-line]"))p.removeAttribute("data-selected-line");if(o)for(let p of this.pre.querySelectorAll("[data-editor-active-line]"))p.removeAttribute("data-editor-active-line");let c=s==null?void 0:Math.min(s.start,s.end),h=s==null?void 0:Math.max(s.start,s.end),f=c===h,m=l?.start;for(let p of a){let{content:b,gutter:S,renderEditorActiveLine:g,renderSelectedLines:x}=p,E=Math.max(x?h??-1/0:-1/0,g?m??-1/0:-1/0),y=b.children.length;for(let C=0;C<y;C++){let L=b.children[C],D=S.children[C];if(!(L instanceof HTMLElement)||!(D instanceof HTMLElement))continue;let w=this.parseLineIndex(L,r);if((w??0)>E)break;if(w!=null){if(x&&c!=null&&h!=null&&w>=c&&w<=h){let R=f?"single":w===c?"first":w===h?"last":"";D.setAttribute("data-selected-line",R),i.lineNumberOnly||(L.setAttribute("data-selected-line",R),D.nextSibling instanceof HTMLElement&&L.nextSibling instanceof HTMLElement&&(L.nextSibling.hasAttribute("data-line-annotation")||L.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(f?(R="last",L.setAttribute("data-selected-line","first")):w===c?R="":w===h&&L.setAttribute("data-selected-line",""),L.nextSibling.setAttribute("data-selected-line",R),D.nextSibling.setAttribute("data-selected-line",R)))}g&&w===m&&(D.setAttribute("data-editor-active-line",""),t.lineNumberOnly||L.setAttribute("data-editor-active-line",""))}}}n&&u&&(this.renderedSelectedLinesState=i),o&&d&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??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}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:i,side:n,tokenElement:o,tokenText:r}){return this.mode==="file"?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:i,tokenElement:o,tokenText:r}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:i,side:n,tokenElement:o,tokenText:r}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,i,n){return{start:e,end:t,...i!=null?{side:i}:{},...i!==n&&n!=null?{endSide:n}:{}}}resolvePointerTarget(e){let t=!1,i,n,o,r,s,l,a,u,d,c;for(let f of e){if(!(f instanceof HTMLElement))continue;if(c==null&&f.hasAttribute("data-merge-conflict-action")){let S=f.getAttribute("data-merge-conflict-action")??void 0,g=f.getAttribute("data-merge-conflict-conflict-index")??void 0,x=g!=null?Number.parseInt(g,10):NaN;fs(S)&&Number.isFinite(x)&&(c={kind:"merge-conflict-action",resolution:S,conflictIndex:x})}if(l==null&&f.hasAttribute("data-char")){l=f;let S=f.getAttribute("data-char");if(S!=null){let g=Number.parseInt(S,10);if(!Number.isNaN(g)){let x=f.textContent??"",E=g+x.length;(x.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(a={tokenElement:l,lineCharStart:g,lineCharEnd:E,tokenText:x});continue}}}let m=s==null?f.getAttribute("data-column-number")??void 0:void 0;if(m!=null){s=f,d=Number.parseInt(m,10),t=!0,i=yo(f),r=f.getAttribute("data-line-index")??void 0;continue}let p=o==null?f.getAttribute("data-line")??void 0:void 0;if(p!=null){o=f,d=Number.parseInt(p,10),i=yo(f),r=f.getAttribute("data-line-index")??void 0;continue}if(u==null&&(f.hasAttribute("data-expand-button")||f.hasAttribute("data-unmodified-lines"))){u={hunkIndex:void 0,direction:f.hasAttribute("data-expand-up")?"up":f.hasAttribute("data-expand-down")?"down":"both",all:f.hasAttribute("data-expand-all-button")};continue}let b=u!=null?f.getAttribute("data-expand-index")??void 0:void 0;if(u!=null&&b!=null){let S=Number.parseInt(b,10);Number.isNaN(S)||(u.hunkIndex=S);continue}if(n==null&&f.hasAttribute("data-code")){n=f;break}}if(c!=null)return c;if(u?.hunkIndex!=null)return{type:"line-info",hunkIndex:u.hunkIndex,direction:u.direction,all:u.all};if(o??=r!=null?go(n,`[data-line][data-line-index="${r}"]`):void 0,s??=r!=null?go(n,`[data-column-number][data-line-index="${r}"]`):void 0,n==null||o==null||s==null||i==null||d==null||Number.isNaN(d))return;let h=this.parseLineIndex(o,this.isSplitDiff());return a!=null?this.mode==="file"?{kind:"token",lineType:i,lineElement:o,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:h,...a}:{kind:"token",lineType:i,lineElement:o,lineNumber:d,numberColumn:t,numberElement:s,side:So(i,n),splitLineIndex:h,...a}:this.mode==="file"?{kind:"line",lineType:i,lineElement:o,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:h}:{kind:"line",lineType:i,lineElement:o,lineNumber:d,numberColumn:t,numberElement:s,side:So(i,n),splitLineIndex:h}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,t){let i=(e.getAttribute("data-line-index")??"").split(",").map(n=>Number.parseInt(n,10)).filter(n=>!Number.isNaN(n));if(t&&i.length===2)return i[1];if(!t)return i[0]}};function zi({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:i,onGutterUtilityClick:n,onLineClick:o,onLineEnter:r,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:u,onTokenLeave:d,renderGutterUtility:c,__debugPointerEvents:h,enableLineSelection:f,controlledSelection:m,onLineSelected:p,onLineSelectionStart:b,onLineSelectionChange:S,onLineSelectionEnd:g},x,E,y){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:ds({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:n}),usesCustomGutterUtility:c!=null,lineHoverHighlight:i,onGutterUtilityClick:n,onHunkExpand:x,onMergeConflictActionClick:y,onLineClick:o,onLineEnter:r,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:u,onTokenLeave:d,__debugPointerEvents:h,enableLineSelection:f,controlledSelection:m,onLineSelected:p,onLineSelectionStart:b,onLineSelectionChange:S,onLineSelectionEnd:g,getLineIndex:E}}function ds({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:i}){if(i!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function xt(e){return e!=null&&"kind"in e&&e.kind==="line"}function Kt(e){return e!=null&&"kind"in e&&e.kind==="token"}function Oi(e){return xt(e)||Kt(e)}function us(e){return"type"in e&&e.type==="line-info"}function cs(e){return"kind"in e&&e.kind==="merge-conflict-action"}function fs(e){return e==="current"||e==="incoming"||e==="both"}function go(e,t){let i=e?.querySelector(t);return i instanceof HTMLElement?i:void 0}function Ct(e){let t=[],i=e;for(;i!=null;)t.push(i),i=i.parentNode;return t}function hs(e){let t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;let i=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(i instanceof HTMLElement))return;let n=i.previousElementSibling;return n instanceof HTMLElement&&(n.hasAttribute("data-line")||n.hasAttribute("data-column-number"))?n:void 0}function ps(e){let t=e.closest('[slot^="annotation-"]'),i=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName==="SLOT"?e:void 0)?.closest("[data-line-annotation]");return i instanceof HTMLElement?i:void 0}function ms(e){let t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){let i=e.getAttribute("name")??void 0;return i!=null&&i.startsWith("annotation-")?i:void 0}}function gs(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let i=Number.parseInt(t[2],10);if(!(!Number.isFinite(i)||i<=0))return{lineNumber:i,side:t[1]}}function vo(e){return e!=null&&typeof e.elementFromPoint=="function"}function vs(e,t){return e===t||jt(e??void 0,t??void 0)}function bo(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&vs(e?.range??null,t.range)}function So(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function yo(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 Pe(e="none",t,...i){switch(e){case"none":return;case"both":break;case"click":if(t!=="click")return;break;case"move":if(t!=="move")return}console.log(...i)}var xo=class Ne{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=Ne.resizeObserver??new ResizeObserver(Ne.handleSharedResizeEntries);return Ne.resizeObserver=t,t}static handleSharedResizeEntries(t){let i=new Map;for(let n of t){let o=Ne.managersByElement.get(n.target);if(o==null)continue;let r=i.get(o);r==null?i.set(o,[n]):r.push(n)}for(let[n,o]of i)n.handleResizeEntries(o)}observedNodes=new Map;setup(t,{disableAnnotations:i,columnVariables:n="apply"}){let o=new Set,r=n==="apply",s=0,l=new Map(this.observedNodes);this.observedNodes.clear();for(let a of t.children){if(s===2)break;let u=(()=>{if(a instanceof HTMLElement&&a.tagName==="CODE")return a})();if(u==null)continue;s++;let d=l.get(u);if(d!=null&&d.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let c=u.firstElementChild;c instanceof HTMLElement||(c=null),d!=null?(this.observedNodes.set(u,d),l.delete(u),d.numberElement!==c?(d.numberElement!=null&&(this.unobserve(d.numberElement),l.delete(d.numberElement)),c!=null&&(this.observe(c),l.delete(c),this.observedNodes.set(c,d)),d.numberElement=c,d.numberWidth=0):d.numberElement!=null?(l.delete(d.numberElement),this.observedNodes.set(d.numberElement,d)):d.numberWidth=0,ys(d,r)):(d={type:"code",codeElement:u,numberElement:c,codeWidth:"auto",numberWidth:0,applyColumnVariables:r},this.observedNodes.set(u,d),this.observe(u),c!=null&&(this.observedNodes.set(c,d),this.observe(c)))}if(s>1&&!i){let a=t.querySelectorAll('[data-line-annotation*=","]'),u=new Map;for(let d of a){if(!(d instanceof HTMLElement))continue;let c=d.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(c)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:c,element:d});continue}let h=u.get(c);h==null&&(h=[],u.set(c,h)),h.push(d)}for(let[d,c]of u){if(c.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",d,c);continue}let[h,f]=c,m=h.firstElementChild,p=f.firstElementChild;if(!(h instanceof HTMLElement)||!(f instanceof HTMLElement)||!(m instanceof HTMLElement)||!(p instanceof HTMLElement))continue;let b=l.get(m);if(b!=null){this.observedNodes.set(m,b),this.observedNodes.set(p,b),l.delete(m),l.delete(p);continue}let S=m.getBoundingClientRect().height,g=p.getBoundingClientRect().height;b={type:"annotations",column1:{container:h,child:m,childHeight:S},column2:{container:f,child:p,childHeight:g},currentHeight:"auto"},o.add({child1:m,child2:p,item:b,newHeight:Math.max(S,g)})}for(let d of o)this.applyNewHeight(d.item,d.newHeight),this.observedNodes.set(d.child1,d.item),this.observedNodes.set(d.child2,d.item),this.observe(d.child1),this.observe(d.child2);o.clear()}for(let[a,u]of l)this.unobserve(a),u.type==="code"?Cs(u):xs(u);l.clear()}cleanUp(){for(let t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){let{managersByElement:i}=Ne,n=i.get(t);if(n!==this){if(n!=null&&n!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");i.set(t,this),Ne.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:i,resizeObserver:n}=Ne,o=i.get(t);if(o!=null){if(o!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");i.delete(t),n?.unobserve(t),n!=null&&i.size===0&&(n.disconnect(),Ne.resizeObserver=void 0)}}handleResizeEntries(t){let i=new Map,n=new Set;for(let o of t){let{target:r,borderBoxSize:s,contentBoxSize:l}=o;if(!(r instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",o);continue}let a=this.observedNodes.get(r);if(a==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",o);continue}if(a.type==="annotations"){let u=(()=>{if(r===a.column1.child)return a.column1;if(r===a.column2.child)return a.column2})();if(u==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:r});continue}u.childHeight=s[0].blockSize,n.add(a)}else if(a.type==="code"){let u=i.get(a)??{},d=l[0].inlineSize;r===a.codeElement?u.codeInlineSize=d:r===a.numberElement&&(u.numberInlineSize=d),i.set(a,u)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(i),i.clear()}applyAnnotationUpdates(t){for(let i of t)this.applyNewHeight(i,Math.max(i.column1.childHeight,i.column2.childHeight))}applyColumnUpdates=t=>{for(let[i,n]of t){let o=n.codeInlineSize!=null?bs(n.codeInlineSize):i.codeWidth,r=n.numberInlineSize!=null?Ss(n.numberInlineSize):i.numberWidth,s=o!==i.codeWidth,l=r!==i.numberWidth;!s&&!l||(i.codeWidth=o,i.numberWidth=r,i.applyColumnVariables&&Lo(i,{codeWidthChanged:s,numberWidthChanged:l}))}};applyNewHeight(t,i){i!==t.currentHeight&&(t.currentHeight=Math.max(i,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};function bs(e){let t=Math.max(Math.floor(e),0);return t===0?"auto":t}function Ss(e){return Math.max(Math.ceil(e),0)}function ys(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?Lo(e,{codeWidthChanged:!0,numberWidthChanged:!0}):Eo(e))}function Lo(e,{codeWidthChanged:t,numberWidthChanged:i}){let{codeElement:n,codeWidth:o,numberWidth:r}=e;if(t&&n.style.setProperty("--diffs-column-width",`${typeof o=="number"?`${o}px`:"auto"}`),i&&n.style.setProperty("--diffs-column-number-width",`${r===0?"auto":`${r}px`}`),t||i&&o!=="auto"){let s=typeof o=="number"?Math.max(o-r,0):0;n.style.setProperty("--diffs-column-content-width",`${s>0?`${s}px`:"auto"}`)}}function Eo(e){e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width")}function Cs(e){e.codeElement.isConnected&&Eo(e)}function xs(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}function _i(e,t){let i=Array.isArray(e)?e:[e];return t!=null?t.hasLoadedLanguages(i):i.every(n=>n==="text"||n==="ansi"||io.has(n))}function Xt(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 ko(e){return P({tagName:"div",children:[P({tagName:"div",children:e.annotations?.map(t=>P({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function wo(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 Ro({fileOrDiff:e,mode:t,stickyHeader:i}){let n="type"in e?e:void 0,o={"data-diffs-header":t,"data-change-type":n?.type,"data-sticky":i?"":void 0};return P({tagName:"div",children:[t==="custom"?P({tagName:"slot",properties:{name:Gt}}):Ls({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:n?.type??"file"}),...t==="custom"?[]:[Es(n)]],properties:o})}function Ls({name:e,prevName:t,iconType:i}){let n=[P({tagName:"slot",properties:{name:Wt}}),Ge({name:wo(i),properties:{"data-change-icon":i}})];return t!=null&&(n.push(P({tagName:"div",children:[P({tagName:"bdi",children:[xe(t)]})],properties:{"data-prev-name":""}})),n.push(Ge({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),n.push(P({tagName:"div",children:[P({tagName:"bdi",children:[xe(e)]})],properties:{"data-title":""}})),n.push(P({tagName:"slot",properties:{name:Vt}})),P({tagName:"div",children:n,properties:{"data-header-content":""}})}function Es(e){let t=[];if(e!=null){let i=0,n=0;for(let o of e.hunks)i+=o.additionLines,n+=o.deletionLines;(n>0||i===0)&&t.push(P({tagName:"span",children:[xe(`-${n}`)],properties:{"data-deletions-count":""}})),(i>0||n===0)&&t.push(P({tagName:"span",children:[xe(`+${i}`)],properties:{"data-additions-count":""}}))}return t.push(P({tagName:"slot",properties:{name:$t}})),P({tagName:"div",children:t,properties:{"data-metadata":""}})}function To(e){return P({tagName:"pre",properties:ks(e)})}function ks({diffIndicators:e,disableBackground:t,disableLineNumbers:i,overflow:n,split:o,totalLines:r,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?o?"split":"single":void 0,"data-overflow":n,"data-disable-line-numbers":i?"":void 0,"data-background":t?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,style:`--diffs-min-number-column-width-default:${`${r}`.length}ch;`}}var lt=new Map;var dt={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","\u{1F525}":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",odin:"odin",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",BUCK:"python",BUILD:"python",PACKAGE:"python",WORKSPACE:"python",Tiltfile:"python",bazel:"python",bxl:"python",bzl:"python",bzlmod:"python",star:"python",sky:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",mts:"typescript",cts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"\u6587\u8A00",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function Se(e){let t=Ao(e);if(t!=null)return t;let i=e.split(/[/\\]/).pop()??e;return i===e?"text":Ao(i)??"text"}function Ao(e){if(lt.has(e))return lt.get(e)??"text";if(Object.hasOwn(dt,e))return dt[e]??null;let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(lt.has(t[1]))return lt.get(t[1])??"text";if(Object.hasOwn(dt,t[1]))return dt[t[1]]??"text"}let i=e.match(/\.([^.]+)$/)?.[1]??"";return lt.has(i)?lt.get(i)??"text":Object.hasOwn(dt,i)?dt[i]??"text":null}function Do(e,{theme:t,preferredHighlighter:i}){return{langs:Array.isArray(e)?e:[e??"text"],themes:nt(t),preferredHighlighter:it(i)}}function je(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function Lt(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}var ws=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Rs=/^0(?:\.0+)?%?$/;function Ts(e){let t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;let i=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(i))return;let n=e.slice(t+1,-1).trim();if(n.length===0)return;let o=n.lastIndexOf("/");if(o!==-1)return n.slice(o+1).trim();if(/^(?:rgba|hsla)$/i.test(i)){let r=n.split(",");if(r.length===4)return r[3]?.trim()}}function As(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let i=t[1],n,o=1;return i.length===3?n=i.split("").map(r=>r+r).join(""):i.length===6?n=i:(n=i.slice(0,6),o=parseInt(i.slice(6,8),16)/255),[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),o]}function Ui(e){if(e==null)return null;let t=As(e);if(t==null)return null;let i=t[0]/255,n=t[1]/255,o=t[2]/255,r=s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4;return .2126*r(i)+.7152*r(n)+.0722*r(o)}function Bi(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t==="transparent"||ws.test(t))return!0;let i=Ts(t);return i!=null&&Rs.test(i)}function Ho(e,t,i){if(t==null||i==null)return!1;let n=Ui(e),o=Ui(t),r=Ui(i);return n==null||o==null||r==null?!1:Math.abs(n-r)<Math.abs(n-o)}var Io=new WeakMap;function Vi(e){let t=Io.get(e);if(t!=null)return t;let i=e.colors??{},n={...i},o=i["editor.background"]??e.bg,r=i["editor.foreground"]??e.fg,s=i["sideBar.background"]??o,l=i["sideBar.foreground"]??r;Te(n,"editor.background",o),Te(n,"editor.foreground",r),Te(n,"sideBar.background",s),Te(n,"sideBar.foreground",l),Te(n,"input.background",i["input.background"]??s),Te(n,"sideBarSectionHeader.foreground",i["sideBarSectionHeader.foreground"]??l),Te(n,"list.activeSelectionForeground",i["list.activeSelectionForeground"]??l),Te(n,"gitDecoration.addedResourceForeground",Wi(i["gitDecoration.addedResourceForeground"],i["terminal.ansiGreen"],i["editorGutter.addedBackground"])),Te(n,"gitDecoration.modifiedResourceForeground",Wi(i["gitDecoration.modifiedResourceForeground"],i["terminal.ansiBlue"],i["editorGutter.modifiedBackground"])),Te(n,"gitDecoration.deletedResourceForeground",Wi(i["gitDecoration.deletedResourceForeground"],i["terminal.ansiRed"],i["editorGutter.deletedBackground"]));let a=(Bi(i["list.focusOutline"])?void 0:i["list.focusOutline"])??(Bi(i.focusBorder)?void 0:i.focusBorder);a!=null?n["list.focusOutline"]=a:delete n["list.focusOutline"];let u=i["list.hoverBackground"];u!=null&&(Ds(u,s)||Ho(u,s,l))&&delete n["list.hoverBackground"];let d=Object.freeze({...e,colors:Object.freeze(n)});return Io.set(e,d),d}function Te(e,t,i){i!=null&&i!==""&&(e[t]=i)}function Wi(...e){for(let t of e)if(t!=null&&t!=="")return t}function Ds(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Mo({theme:e=de,highlighter:t,prefix:i}){let n="";if(typeof e=="string"){let o=t.getTheme(e),r=$i(o,t);n+=`color:${r.fg};`,n+=`background-color:${r.bg};`,n+=`${pe("global")}fg:${r.fg};`,n+=`${pe("global")}bg:${r.bg};`,n+=Gi(o,i)}else{let o=t.getTheme(e.dark),r=$i(o,t);n+=`${pe("global")}dark:${r.fg};`,n+=`${pe("global")}dark-bg:${r.bg};`,n+=Gi(o,"dark"),o=t.getTheme(e.light),r=$i(o,t),n+=`${pe("global")}light:${r.fg};`,n+=`${pe("global")}light-bg:${r.bg};`,n+=Gi(o,"light")}return n}function $i(e,t){if(t.name==="highlights"&&e.zed?.cssVariables===!0){let i=pe("token");return{fg:`var(${i}foreground)`,bg:`var(${i}background)`}}return Vi(e)}function Gi(e,t){t=t!=null?`${t}-`:"";let i="",n=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];n!=null&&(i+=`${pe("global")}${t}addition-color:${n};`);let o=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];o!=null&&(i+=`${pe("global")}${t}deletion-color:${o};`);let r=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return r!=null&&(i+=`${pe("global")}${t}modified-color:${r};`),i}function Fo(e,t,i){return{lang:e,...typeof t=="string"?{theme:t}:{themes:t},defaultColor:!1,cssVariablePrefix:pe("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0}}function Yt(e,t){return e?.getPreferredHighlighter()??t.preferredHighlighter}var Po="-1,-1";function No(e){return e?.some(t=>t.lineNumber===0)??!1}function qi(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function Qt(e){return e.startingLine===0&&e.totalLines>0}function Oo(e,t){return e.endsWith(`\r
|
|
2
|
-
`)?t+`\r
|
|
3
|
-
`:e.endsWith("\r")?t+"\r":e.endsWith(`
|
|
4
|
-
`)?t+`
|
|
5
|
-
`:t}function zo(e,t){return P({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${t}`}})}var _o=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
6
|
-
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
7
|
-
<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"/>
|
|
8
|
-
</symbol>
|
|
9
|
-
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
10
|
-
<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"/>
|
|
11
|
-
</symbol>
|
|
12
|
-
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
13
|
-
<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"/>
|
|
14
|
-
</symbol>
|
|
15
|
-
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
16
|
-
<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"/>
|
|
17
|
-
</symbol>
|
|
18
|
-
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
19
|
-
<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"/>
|
|
20
|
-
</symbol>
|
|
21
|
-
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
22
|
-
<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"/>
|
|
23
|
-
</symbol>
|
|
24
|
-
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
25
|
-
<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"/>
|
|
26
|
-
</symbol>
|
|
27
|
-
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
28
|
-
<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"/>
|
|
29
|
-
</symbol>
|
|
30
|
-
<symbol id="diffs-icon-eye-slash" viewBox="0 0 16 16">
|
|
31
|
-
<path d="m13.47 1.47-12 12 1.06 1.06 12-12zM8 14c-.92 0-1.802-.208-2.624-.547l1.173-1.174c.476.142.963.221 1.451.221 1.66 0 3.307-.949 4.626-2.196a10.4 10.4 0 0 0 1.494-1.751A5 5 0 0 0 14.443 8a5 5 0 0 0-.323-.553 10 10 0 0 0-1.238-1.5l1.061-1.062C15.222 6.173 16 7.511 16 8c0 1.05-3.582 6-8 6"/><path d="M8 11q-.084 0-.167-.005l3.162-3.162q.006.083.005.167a3 3 0 0 1-3 3M5.005 8.167l3.162-3.162a3 3 0 0 0-3.162 3.162"/><path d="M8 3.5c.485 0 .97.081 1.445.227l1.168-1.169C9.794 2.212 8.915 2 8 2 3.582 2 0 6.8 0 8c0 .555.766 1.88 2.027 3.144l1.06-1.06a9.5 9.5 0 0 1-1.203-1.461 4.3 4.3 0 0 1-.345-.617L1.536 8l.003-.006c.064-.149.176-.359.345-.617a9.8 9.8 0 0 1 1.482-1.73C4.675 4.427 6.326 3.5 8 3.5"/>
|
|
32
|
-
</symbol>
|
|
33
|
-
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
34
|
-
<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"/>
|
|
35
|
-
</symbol>
|
|
36
|
-
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
37
|
-
<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"/>
|
|
38
|
-
</symbol>
|
|
39
|
-
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
40
|
-
<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"/>
|
|
41
|
-
</symbol>
|
|
42
|
-
<symbol id="diffs-icon-symbol-added-duo" viewBox="0 0 16 16">
|
|
43
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><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"/>
|
|
44
|
-
</symbol>
|
|
45
|
-
<symbol id="diffs-icon-symbol-added-fill" viewBox="0 0 16 16">
|
|
46
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 4a.75.75 0 0 0-.75.75v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5A.75.75 0 0 0 8 4" clip-rule="evenodd"/>
|
|
47
|
-
</symbol>
|
|
48
|
-
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
49
|
-
<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"/>
|
|
50
|
-
</symbol>
|
|
51
|
-
<symbol id="diffs-icon-symbol-deleted-duo" viewBox="0 0 16 16">
|
|
52
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><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"/>
|
|
53
|
-
</symbol>
|
|
54
|
-
<symbol id="diffs-icon-symbol-deleted-fill" viewBox="0 0 16 16">
|
|
55
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M4.75 7.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5z" clip-rule="evenodd"/>
|
|
56
|
-
</symbol>
|
|
57
|
-
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
58
|
-
<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"/>
|
|
59
|
-
</symbol>
|
|
60
|
-
<symbol id="diffs-icon-symbol-diffstat-duo" viewBox="0 0 16 16">
|
|
61
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><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"/>
|
|
62
|
-
</symbol>
|
|
63
|
-
<symbol id="diffs-icon-symbol-diffstat-fill" viewBox="0 0 16 16">
|
|
64
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5zM8 3.546a.75.75 0 0 0-.75.75V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2V4.296a.75.75 0 0 0-.75-.75" clip-rule="evenodd"/>
|
|
65
|
-
</symbol>
|
|
66
|
-
<symbol id="diffs-icon-symbol-extracted" viewBox="0 0 16 16">
|
|
67
|
-
<path d="M8.25 4.25a.75.75 0 0 1 0 1.5H6.81l3.302 3.302a1.5 1.5 0 1 1-1.06 1.06L5.75 6.811V8.25a.75.75 0 0 1-1.5 0V5A.75.75 0 0 1 5 4.25z"/><path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 1.5c-1.613 0-2.807.089-3.704.288-.88.196-1.382.477-1.706.802-.325.324-.606.826-.802 1.706C1.588 5.193 1.5 6.387 1.5 8s.089 2.807.288 3.704c.196.88.477 1.382.802 1.706.324.325.826.606 1.706.802.897.2 2.091.288 3.704.288s2.807-.089 3.704-.288c.88-.196 1.382-.477 1.706-.802.325-.324.606-.826.802-1.706.2-.897.288-2.091.288-3.704s-.089-2.807-.288-3.704c-.196-.88-.477-1.382-.802-1.706-.324-.325-.826-.606-1.706-.802C10.807 1.588 9.613 1.5 8 1.5" clip-rule="evenodd"/>
|
|
68
|
-
</symbol>
|
|
69
|
-
<symbol id="diffs-icon-symbol-extracted-duo" viewBox="0 0 16 16">
|
|
70
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8" clip-rule="evenodd" opacity=".2"/><path d="M8.25 4.25a.75.75 0 0 1 0 1.5H6.81l3.302 3.302a1.5 1.5 0 1 1-1.06 1.06L5.75 6.811V8.25a.75.75 0 0 1-1.5 0V5A.75.75 0 0 1 5 4.25z"/>
|
|
71
|
-
</symbol>
|
|
72
|
-
<symbol id="diffs-icon-symbol-extracted-fill" viewBox="0 0 16 16">
|
|
73
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5 4.25a.75.75 0 0 0-.75.75v3.25a.75.75 0 0 0 1.5 0V6.81l3.302 3.302a1.5 1.5 0 1 0 1.06-1.06L6.811 5.75H8.25a.75.75 0 0 0 0-1.5z" clip-rule="evenodd"/>
|
|
74
|
-
</symbol>
|
|
75
|
-
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
76
|
-
<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"/>
|
|
77
|
-
</symbol>
|
|
78
|
-
<symbol id="diffs-icon-symbol-ignored-duo" viewBox="0 0 16 16">
|
|
79
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M11.53 4.47a.75.75 0 0 1 0 1.06l-6 6a.75.75 0 0 1-1.06-1.06l6-6a.75.75 0 0 1 1.06 0"/>
|
|
80
|
-
</symbol>
|
|
81
|
-
<symbol id="diffs-icon-symbol-ignored-fill" viewBox="0 0 16 16">
|
|
82
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m3.53 4.47a.75.75 0 0 0-1.06 0l-6 6a.75.75 0 1 0 1.06 1.06l6-6a.75.75 0 0 0 0-1.06" clip-rule="evenodd"/>
|
|
83
|
-
</symbol>
|
|
84
|
-
<symbol id="diffs-icon-symbol-inlined" viewBox="0 0 16 16">
|
|
85
|
-
<path d="M7.75 11.75a.75.75 0 0 1 0-1.5h1.44L5.887 6.948a1.5 1.5 0 1 1 1.06-1.06l3.302 3.301V7.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-.75.75z"/><path fill-rule="evenodd" d="M8 16c-6.588 0-8-1.412-8-8s1.412-8 8-8 8 1.412 8 8-1.412 8-8 8m0-1.5c1.613 0 2.807-.089 3.704-.288.88-.196 1.382-.477 1.706-.802.325-.324.606-.826.802-1.706.2-.897.288-2.091.288-3.704s-.089-2.807-.288-3.704c-.196-.88-.477-1.382-.802-1.706-.324-.325-.826-.606-1.706-.802C10.807 1.588 9.613 1.5 8 1.5s-2.807.089-3.704.288c-.88.196-1.382.477-1.706.802-.325.324-.606.826-.802 1.706C1.588 5.193 1.5 6.387 1.5 8s.089 2.807.288 3.704c.196.88.477 1.382.802 1.706.324.325.826.606 1.706.802.897.2 2.091.288 3.704.288" clip-rule="evenodd"/>
|
|
86
|
-
</symbol>
|
|
87
|
-
<symbol id="diffs-icon-symbol-inlined-duo" viewBox="0 0 16 16">
|
|
88
|
-
<path fill-rule="evenodd" d="M8 16c-6.588 0-8-1.412-8-8s1.412-8 8-8 8 1.412 8 8-1.412 8-8 8" clip-rule="evenodd" opacity=".2"/><path d="M7.75 11.75a.75.75 0 0 1 0-1.5h1.44L5.887 6.948a1.5 1.5 0 1 1 1.06-1.06l3.302 3.301V7.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-.75.75z"/>
|
|
89
|
-
</symbol>
|
|
90
|
-
<symbol id="diffs-icon-symbol-inlined-fill" viewBox="0 0 16 16">
|
|
91
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5.5 4a1.5 1.5 0 1 0 .388 2.948l3.301 3.302H7.75a.75.75 0 0 0 0 1.5H11a.75.75 0 0 0 .75-.75V7.75a.75.75 0 0 0-1.5 0v1.44L6.948 5.887A1.5 1.5 0 0 0 5.5 4" clip-rule="evenodd"/>
|
|
92
|
-
</symbol>
|
|
93
|
-
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
94
|
-
<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"/>
|
|
95
|
-
</symbol>
|
|
96
|
-
<symbol id="diffs-icon-symbol-modified-duo" viewBox="0 0 16 16">
|
|
97
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0"/>
|
|
98
|
-
</symbol>
|
|
99
|
-
<symbol id="diffs-icon-symbol-modified-fill" viewBox="0 0 16 16">
|
|
100
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 5a3 3 0 1 0 0 6 3 3 0 0 0 0-6" clip-rule="evenodd"/>
|
|
101
|
-
</symbol>
|
|
102
|
-
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
103
|
-
<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"/>
|
|
104
|
-
</symbol>
|
|
105
|
-
<symbol id="diffs-icon-symbol-moved-duo" viewBox="0 0 16 16">
|
|
106
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M8.496 4.695a.75.75 0 0 0-.051 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-.051 1.06L6.49 8.003 4.693 9.998a.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"/>
|
|
107
|
-
</symbol>
|
|
108
|
-
<symbol id="diffs-icon-symbol-moved-fill" viewBox="0 0 16 16">
|
|
109
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m1.555 4.745a.75.75 0 0 0-1.11 1.01L10.486 8l-2.04 2.245a.75.75 0 0 0 1.109 1.01l2.5-2.75a.75.75 0 0 0 0-1.01zm-4 0a.75.75 0 0 0-1.11 1.01l2.043 2.248-1.796 1.995a.75.75 0 0 0 1.116 1.004l2.25-2.5a.75.75 0 0 0-.003-1.007z" clip-rule="evenodd"/>
|
|
110
|
-
</symbol>
|
|
111
|
-
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
112
|
-
<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"/>
|
|
113
|
-
</symbol>
|
|
114
|
-
</svg>`;function Bo(e,t){return e==null||t==null?e===t:Hs(e.customProperties,t.customProperties)&&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.totalLines===t.totalLines}var Uo={};function Hs(e=Uo,t=Uo){if(e===t)return!0;let i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(let o of i)if(e[o]!==t[o])return!1;return!0}function Wo(e){let t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}function Vo(){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.style.touchAction="none",e}function $o(){let e=document.createElement("style");return e.setAttribute(qn,""),e}var Go=`@layer base,theme,rendered,unsafe;@layer base{:host{--diffs-font-fallback:"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace;--diffs-header-font-fallback:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;--diffs-mixer:light-dark(#000,#fff);--diffs-gap-fallback:8px;--diffs-scrollbar-gutter-fallback:6px;--diffs-scrollbar-gutter:var(--diffs-scrollbar-gutter-override,var(--diffs-scrollbar-gutter-measured,var(--diffs-scrollbar-gutter-fallback)));--diffs-added-light:#0dbe4e;--diffs-added-dark:#5ecc71;--diffs-modified-light:#009fff;--diffs-modified-dark:#69b1ff;--diffs-deleted-light:#ff2e3f;--diffs-deleted-dark:#ff6762;--diffs-warning-light:#d5a910;--diffs-warning-dark:#ffd452;color-scheme:light dark;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);font-feature-settings:var(--diffs-font-features);--diffs-bg:light-dark(var(--diffs-light-bg,#fff),var(--diffs-dark-bg,#000));--diffs-bg-buffer:var(--diffs-bg-buffer-override,light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));--diffs-bg-context:var(--diffs-bg-context-override,light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));--diffs-bg-context-gutter:var(--diffs-bg-context-gutter-override,light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)),color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));--diffs-bg-separator:var(--diffs-bg-separator-override,light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));--diffs-fg:light-dark(var(--diffs-light,#000),var(--diffs-dark,#fff));--diffs-fg-number:var(--diffs-fg-number-override,light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));--diffs-fg-conflict-marker:var(--diffs-fg-conflict-marker-override,var(--diffs-fg-number));--diffs-deletion-base:var(--diffs-deletion-color-override,light-dark(var(--diffs-light-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-light))),var(--diffs-dark-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-dark)))));--diffs-addition-base:var(--diffs-addition-color-override,light-dark(var(--diffs-light-addition-color,var(--diffs-addition-color,var(--diffs-added-light))),var(--diffs-dark-addition-color,var(--diffs-addition-color,var(--diffs-added-dark)))));--diffs-modified-base:var(--diffs-modified-color-override,light-dark(var(--diffs-light-modified-color,var(--diffs-modified-color,var(--diffs-modified-light))),var(--diffs-dark-modified-color,var(--diffs-modified-color,var(--diffs-modified-dark)))));--diffs-bg-deletion:var(--diffs-bg-deletion-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));--diffs-bg-deletion-emphasis:var(--diffs-bg-deletion-emphasis-override,light-dark(rgb(from var(--diffs-deletion-base) r g b / .15),rgb(from var(--diffs-deletion-base) r g b / .2)));--diffs-bg-addition:var(--diffs-bg-addition-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));--diffs-bg-addition-emphasis:var(--diffs-bg-addition-emphasis-override,light-dark(rgb(from var(--diffs-addition-base) r g b / .15),rgb(from var(--diffs-addition-base) r g b / .2)));--diffs-selection-base:var(--diffs-modified-base);--diffs-selection-number-fg:light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));background-color:var(--diffs-bg);color:var(--diffs-fg);display:block}pre,code,[data-error-wrapper]{isolation:isolate;font-family:var(--diffs-font-family,var(--diffs-font-fallback));outline:none;margin:0;padding:0;display:block}pre,code{background-color:var(--diffs-bg)}code{contain:content}input,button{font-family:inherit;font-size:inherit;line-height:inherit}*,:before,:after{box-sizing:border-box}[data-icon-sprite]{display:none}[data-diffs-header],[data-separator]{font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback))}[data-diffs-header][data-sticky]{z-index:1;background-color:var(--diffs-bg);position:sticky;top:0}[data-file-info]{color:var(--fg);background-color:color-mix(in lab, var(--bg) 98%, var(--fg));border-block:1px solid color-mix(in lab, var(--bg) 95%, var(--fg));padding:10px;font-weight:700}[data-diff],[data-file]{--diffs-grid-number-column-width:minmax(min-content, max-content);--diffs-code-grid:var(--diffs-grid-number-column-width) 1fr;&[data-dehydrated]{--diffs-code-grid:var(--diffs-grid-number-column-width) minmax(0, 1fr)}&:hover [data-code]::-webkit-scrollbar-thumb{background-color:var(--diffs-bg-context)}}@supports (-webkit-touch-callout:none){:host{--diffs-scrollbar-gutter-fallback:0px}}[data-line] span,[data-edit-prediction-suffix] span{color:light-dark(var(--diffs-token-light,var(--diffs-light)),var(--diffs-token-dark,var(--diffs-dark)));background-color:light-dark(var(--diffs-token-light-bg,inherit),var(--diffs-token-dark-bg,inherit))}[data-line],[data-gutter-buffer],[data-column-number],[data-line-annotation],[data-no-newline],[data-merge-conflict],[data-merge-conflict-actions],[data-editor-overlay]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-computed-editor-active-line-bg:var(--diffs-computed-selected-line-bg);--diffs-computed-hovered-line-bg:var(--diffs-computed-editor-active-line-bg);--diffs-hover-mix-target:var(--diffs-bg-hover-override,var(--diffs-mixer));--diffs-line-bg:var(--diffs-computed-hovered-line-bg);color:var(--diffs-fg);background-color:var(--diffs-line-bg,var(--diffs-bg))}[data-line],[data-no-newline]{&[data-decoration-bg]{--mix-deco-light:92%;--mix-deco-dark:85%;&[data-decoration-bg-depth="2"]{--mix-deco-light:88%;--mix-deco-dark:80%}&[data-decoration-bg-depth="3"]{--mix-deco-light:85%;--mix-deco-dark:78%}--diffs-hover-mix-target:var(--diffs-decoration-bg);--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) var(--mix-deco-light), var(--diffs-decoration-bg)),color-mix(in lab, var(--diffs-bg) var(--mix-deco-dark), var(--diffs-decoration-bg)))}}[data-line-annotation],[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context);--diffs-computed-decoration-bg:var(--diffs-annotation-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-merge-conflict-actions],[data-gutter-buffer=merge-conflict-action],[data-gutter-buffer=merge-conflict-marker-base],[data-gutter-buffer=merge-conflict-marker-separator],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator]{--diffs-computed-decoration-bg:var(--diffs-bg-context);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-start],[data-merge-conflict=marker-start]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-end],[data-merge-conflict=marker-end]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-has-merge-conflict] [data-line-annotation],[data-has-merge-conflict] [data-gutter-buffer=annotation]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}:where([data-background]){& [data-gutter-buffer],& [data-column-number]{--mix-light:91%;--mix-dark:85%}& [data-line],& [data-no-newline]{--mix-light:88%;--mix-dark:80%}& [data-gutter-buffer],& [data-column-number],& [data-line],& [data-no-newline]{--diffs-diff-line-mix-target:var(--diffs-bg);&[data-line-type=change-deletion]{--diffs-diff-line-mix-target:var(--diffs-bg-deletion-override,var(--diffs-deletion-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-deletion-override,var(--diffs-deletion-base));--diffs-diff-line-mix-target:var(--diffs-bg-deletion-number-override,var(--diffs-deletion-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-line-type=change-addition]{--diffs-diff-line-mix-target:var(--diffs-bg-addition-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--diffs-bg-addition-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=current]{--diffs-diff-line-mix-target:var(--conflict-bg-current-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--conflict-bg-current-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=incoming]{--diffs-diff-line-mix-target:var(--conflict-bg-incoming-override,var(--diffs-modified-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-modified-base);--diffs-diff-line-mix-target:var(--conflict-bg-incoming-number-override,var(--diffs-modified-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}}}[data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline],[data-editor-overlay]{--diffs-selection-mix-target:var(--diffs-bg-selection-override,var(--diffs-selection-base));--diffs-selection-emphasis-mix-target:var(--diffs-selection-mix-target);&:where([data-editor-overlay]),&:where([data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline])[data-selected-line]{--mix-selection-light:82%;--mix-selection-dark:75%;--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line])){--mix-selection-light:75%;--mix-selection-dark:60%;--diffs-selection-mix-target:var(--diffs-bg-selection-number-override,var(--diffs-selection-base));--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-line][data-selected-line]):is([data-line-type=change-addition],[data-line-type=change-deletion]){--diffs-selection-emphasis-mix-target:light-dark(color-mix(in lab, var(--diffs-diff-line-mix-target,var(--diffs-selection-mix-target)) var(--mix-selection-light), var(--diffs-selection-mix-target)),var(--diffs-selection-mix-target))}&:where([data-editor-overlay]),&[data-selected-line]{--diffs-computed-selected-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-light), var(--diffs-selection-mix-target)),color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-dark), var(--diffs-selection-mix-target)))}}[data-line][data-editor-active-line],[data-column-number][data-editor-active-line]{--diffs-computed-editor-active-line-bg:color-mix(in lab, var(--diffs-computed-selected-line-bg) var(--diffs-editor-active-line-source-mix,100%), var(--diffs-selection-emphasis-mix-target))}@media (pointer:fine){[data-line][data-hovered],[data-gutter-buffer][data-hovered],[data-column-number][data-hovered],[data-line-annotation][data-hovered],[data-no-newline][data-hovered],[data-merge-conflict][data-hovered],[data-merge-conflict-actions][data-hovered],[data-editor-overlay][data-hovered]{--diffs-computed-hovered-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 97%, var(--diffs-hover-mix-target)),color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 91%, var(--diffs-hover-mix-target)))}}[data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line]){color:var(--diffs-selection-number-fg)}[data-no-newline]{user-select:none;& span{opacity:.6}}[data-diff-type=split][data-overflow=scroll]{grid-template-columns:1fr 1fr;display:grid;& [data-additions]{border-left:1px solid var(--diffs-bg)}& [data-deletions]{border-right:1px solid var(--diffs-bg)}}[data-code]{grid-auto-flow:dense;grid-template-columns:var(--diffs-code-grid);overflow:var(--diffs-overflow-override,scroll) clip;overscroll-behavior-x:none;tab-size:var(--diffs-tab-size,2);padding-top:var(--diffs-gap-block,var(--diffs-gap-fallback));padding-bottom:max(0px, calc(var(--diffs-gap-block,var(--diffs-gap-fallback)) - var(--diffs-scrollbar-gutter)));scrollbar-gutter:stable;align-self:flex-start;display:grid}[data-diffs-scrollbar-measure]{opacity:0;pointer-events:none;scrollbar-gutter:auto;grid-template-columns:none;width:100px;height:100px;padding:0;position:absolute;top:-200px;left:-200px}[data-container-size]{container-type:inline-size}[data-code]::-webkit-scrollbar{width:0;height:var(--diffs-scrollbar-gutter)}[data-code]::-webkit-scrollbar-track{background:0 0}[data-code]::-webkit-scrollbar-thumb{background-color:#0000;background-clip:content-box;border:1px solid #0000;border-radius:3px}[data-code]::-webkit-scrollbar-corner{background-color:#0000}@supports ((-moz-appearance:none)){[data-code]{scrollbar-width:thin;scrollbar-color:var(--diffs-bg-context) transparent;padding-bottom:var(--diffs-gap-block,var(--diffs-gap-fallback))}}[data-diffs-header]~[data-diff],[data-diffs-header]~[data-file]{& [data-code],&[data-overflow=wrap],&[data-dehydrated][data-diff-type=split][data-overflow=scroll]{padding-top:0}}[data-gutter]{grid-template-rows:subgrid;grid-template-columns:subgrid;z-index:3;background-color:var(--diffs-bg);grid-column:1;display:grid;position:relative;& [data-gutter-buffer],& [data-column-number]{border-right:var(--diffs-gap-style,2px solid var(--diffs-bg))}}[data-content]{grid-template-rows:subgrid;grid-template-columns:subgrid;background-color:var(--diffs-bg);grid-column:2;min-width:0;display:grid}[data-overflow=scroll]:not([data-dehydrated],[data-custom-styles],:has(>[data-code]>[contenteditable],>[data-code]>*>:is([data-line-annotation],[data-separator],[data-merge-conflict],[data-merge-conflict-actions])))>[data-code]{display:flex;&>[data-gutter]{flex-shrink:0;display:block}&>[data-content]{flex:1 0 max-content;display:block}}[data-diff-type=split][data-overflow=wrap],[data-dehydrated][data-diff-type=split][data-overflow=scroll]{grid-auto-flow:dense;grid-template-columns:repeat(2, var(--diffs-code-grid));padding-block:var(--diffs-gap-block,var(--diffs-gap-fallback));display:grid;& [data-code]{display:contents}& [data-deletions]{& [data-gutter]{grid-column:1}& [data-content]{border-right:1px solid var(--diffs-bg);grid-column:2}}& [data-additions]{& [data-gutter]{border-left:1px solid var(--diffs-bg);grid-column:3}& [data-content]{grid-column:4}}}[data-dehydrated][data-diff-type=split][data-overflow=scroll] [data-content]{overflow:clip}[data-overflow=scroll] [data-gutter]{position:sticky;left:0}[data-interactive-lines] [data-line]{cursor:pointer}[data-interactive-line-numbers] [data-column-number]{cursor:pointer;touch-action:none}[data-content-buffer],[data-gutter-buffer]{user-select:none;min-height:1lh;position:relative}[data-gutter-buffer]{padding-left:2ch;padding-right:1ch;&:before{content:"";min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));display:block}}[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context-gutter);min-height:0}[data-gutter-buffer=buffer]{--diffs-line-bg:var(--diffs-bg-context-gutter)}[data-content-buffer]{background-position:5px 0;background-size:8px 8px;background-origin:border-box;background-image:repeating-linear-gradient(-45deg, transparent, transparent calc(3px * 1.414), var(--diffs-bg-buffer) calc(3px * 1.414), var(--diffs-bg-buffer) calc(4px * 1.414));grid-column:1}[data-separator]{box-sizing:content-box;background-color:var(--diffs-bg)}[data-separator=simple]{min-height:4px}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata],[data-separator=simple]{background-color:var(--diffs-bg-separator)}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata]{height:32px;position:relative}[data-separator-wrapper]{user-select:none;fill:currentColor;background-color:var(--diffs-bg);align-items:center;height:100%;display:flex;position:absolute;inset-inline:0}[data-content] [data-separator-wrapper]{display:none}[data-separator=metadata] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;color:var(--diffs-fg-number);white-space:nowrap;text-overflow:ellipsis;min-width:min-content;padding-inline:1ch;inset-inline:100% auto;overflow:hidden}[data-separator=line-info]{margin-block:var(--diffs-gap-block,var(--diffs-gap-fallback));& [data-separator-wrapper]{min-width:16px}}[data-separator=line-info-basic],[data-separator=metadata]{margin-block:0}[data-separator=line-info][data-separator-first]{margin-top:0}[data-separator=line-info][data-separator-last]{margin-bottom:0}[data-expand-index] [data-separator-wrapper]{grid-template-columns:32px auto;display:grid}[data-expand-index] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:32px 32px auto}[data-expand-button],[data-separator-content]{background-color:var(--diffs-bg-separator);flex:none;align-items:center;display:flex}[data-expand-index] [data-separator-content]:hover{cursor:pointer;text-decoration:underline}[data-expand-button]{cursor:pointer;min-width:32px;color:var(--diffs-fg-number);border-right:2px solid var(--diffs-bg);flex-shrink:0;justify-content:center;align-self:stretch;&:hover{color:var(--diffs-fg)}&[data-expand-all-button]{display:none}}[data-expand-down] [data-icon]{transform:scaleY(-1)}[data-separator-content]{height:100%;color:var(--diffs-fg-number);flex:auto;justify-content:flex-start;padding:0 1ch;overflow:hidden}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-content]{user-select:none;height:100%;overflow:clip}}[data-unmodified-lines]{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;display:block;overflow:hidden}@supports (width:1cqi){[data-unified]{& [data-separator=line-info] [data-separator-wrapper]{padding-inline:var(--diffs-gap-inline,var(--diffs-gap-fallback));width:100cqi;& [data-separator-content]{border-radius:6px}}& [data-separator=line-info][data-expand-index] [data-separator-wrapper] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-gutter]{& [data-separator=line-info] [data-separator-wrapper]{padding-left:var(--diffs-gap-inline,var(--diffs-gap-fallback))}& [data-separator=line-info] [data-separator-content]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-separator=line-info][data-expand-index] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-additions]{& [data-content] [data-separator=line-info]{background-color:var(--diffs-bg);& [data-separator-wrapper]{display:none}}& [data-gutter] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);border-top-right-radius:6px;border-bottom-right-radius:6px;height:100%;display:block;& [data-separator-content],& [data-expand-button]{display:none}}}[data-overflow=scroll] [data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]{width:calc(100cqi - var(--diffs-gap-inline,var(--diffs-gap-fallback)))}[data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;margin-right:var(--diffs-gap-inline,var(--diffs-gap-fallback));border-top-right-radius:6px;border-bottom-right-radius:6px;display:block;& [data-separator-content],& [data-expand-button]{display:none}}[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}}@media (pointer:fine){[data-separator=line-info] [data-separator-wrapper]{&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:unset}& [data-expand-down]{border-bottom-left-radius:6px;border-top-left-radius:unset}}}}}@media (pointer:coarse){[data-separator=line-info-basic] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px 34px auto;& [data-separator-content]{grid-column:unset;grid-row:unset}}@supports (width:1cqi){[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-expand-down]{border-bottom-left-radius:unset;border-top-left-radius:unset}}}}}@media (pointer:fine){[data-separator-wrapper][data-separator-multi-button]{grid-template-rows:50% 50%;display:grid;& [data-separator-content]{grid-area:1/2/-1;min-width:min-content}& [data-expand-button]{grid-column:1}}[data-separator=line-info] [data-separator-wrapper],[data-separator=line-info] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px auto}[data-separator=line-info-basic][data-expand-index] [data-separator-wrapper]{grid-template-columns:100% auto}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-multi-button]{& [data-expand-up]{border-bottom:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}& [data-expand-down]{border-top:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}}}}[data-additions] [data-gutter] [data-separator-wrapper],[data-additions] [data-separator=line-info-basic] [data-separator-wrapper],[data-content] [data-separator-wrapper]{display:none}[data-line-annotation]{min-height:var(--diffs-annotation-min-height,0);z-index:2}[data-merge-conflict-actions]{z-index:2}[data-separator=custom]{grid-template-columns:subgrid;display:grid}[data-line],[data-column-number],[data-no-newline]{padding-inline:1ch;position:relative}[data-indicators=classic] [data-line]{padding-inline-start:2ch}[data-indicators=classic]{& [data-line-type=change-addition],& [data-line-type=change-deletion]{&[data-no-newline],&[data-line]{&:before{user-select:none;width:1ch;height:1lh;display:inline-block;position:absolute;top:0;left:0}}}& [data-line-type=change-addition]{&[data-line],&[data-no-newline]{&:before{content:"+";color:var(--diffs-addition-base)}}}& [data-line-type=change-deletion]{&[data-line],&[data-no-newline]{&:before{content:"-";color:var(--diffs-deletion-base)}}}}[data-indicators=bars]{& [data-line-type=change-deletion],& [data-line-type=change-addition]{&[data-column-number]{&:before{content:"";user-select:none;contain:strict;width:4px;height:100%;display:block;position:absolute;top:0;left:0}}}& [data-line-type=change-deletion]{&[data-column-number]{&:before{background-image:linear-gradient(0deg, var(--diffs-bg-deletion) 50%, var(--diffs-deletion-base) 50%);background-repeat:repeat;background-size:2px 2px;background-size:calc(1lh / round(1lh / 2px)) calc(1lh / round(1lh / 2px))}}}& [data-line-type=change-addition]{&[data-column-number]{&:before{background-color:var(--diffs-addition-base)}}}}[data-overflow=wrap]{& [data-line]{white-space:pre-wrap;word-break:break-word}& [data-annotation-content]{word-break:break-word}}[data-overflow=scroll] [data-line]{white-space:pre;min-height:1lh}[data-overflow=scroll] [data-column-number]{min-height:1lh}[data-column-number]{box-sizing:content-box;text-align:right;user-select:none;color:var(--diffs-fg-number);padding-left:2ch}[data-line-number-content]{min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));z-index:1;display:inline-block;position:relative}[data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{min-width:4px;padding:0;&:before{min-width:0}}& [data-line-number-content]{display:none}& [data-gutter-utility-slot]{right:unset;justify-content:flex-start;left:0}&[data-indicators=bars] [data-gutter-utility-slot]{left:6px}}[data-file][data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{border-right:0;min-width:0}}[data-diff-span]{box-decoration-break:clone;border-radius:3px}[data-line-type=change-addition] [data-diff-span]{background-color:var(--diffs-bg-addition-emphasis)}[data-line-type=change-deletion] [data-diff-span]{background-color:var(--diffs-bg-deletion-emphasis)}[data-merge-conflict=marker-start],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator],[data-merge-conflict=marker-end]{color:var(--diffs-fg);padding-left:1ch}[data-merge-conflict=marker-start],[data-merge-conflict=marker-end]{align-items:center;display:flex;&:after{color:var(--diffs-fg-conflict-marker);font-size:.75rem;font-style:normal;line-height:1.25rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));padding-left:1ch}}[data-merge-conflict=marker-start]:after{content:"(Current Change)"}[data-merge-conflict=marker-end]:after{content:"(Incoming Change)"}[data-merge-conflict-actions-content]{min-height:1.75rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));color:var(--diffs-fg);align-items:center;gap:.25rem;padding-inline:.5rem;font-size:.75rem;line-height:1.2;display:flex}[data-merge-conflict-action]{appearance:none;color:var(--diffs-fg-number);font:inherit;cursor:pointer;background:0 0;border:0;padding:0;font-style:normal}[data-merge-conflict-action]:hover{color:var(--diffs-fg)}[data-merge-conflict-action=current]:hover{color:var(--diffs-addition-base)}[data-merge-conflict-action=incoming]:hover{color:var(--diffs-modified-base)}[data-merge-conflict-action-separator]{color:var(--diffs-fg-number);opacity:.6;user-select:none}[data-diffs-header=default]{background-color:var(--diffs-bg);justify-content:space-between;align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));min-height:calc(1lh + (var(--diffs-gap-block,var(--diffs-gap-fallback)) * 3));z-index:2;flex-direction:row;padding-inline:16px;display:flex;position:relative;top:0}[data-header-content]{align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));white-space:nowrap;flex-direction:row;min-width:0;display:flex}[data-header-content] [data-prev-name],[data-header-content] [data-title]{text-overflow:ellipsis;white-space:nowrap;direction:rtl;min-width:0;overflow:hidden}[data-prev-name]{opacity:.7}[data-rename-icon]{fill:currentColor;flex-grow:0;flex-shrink:0}[data-diffs-header=default] [data-metadata]{white-space:nowrap;align-items:center;gap:1ch;display:flex}[data-diffs-header=default] [data-additions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-addition-base)}[data-diffs-header=default] [data-deletions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-deletion-base)}[data-change-icon]{fill:currentColor;flex-shrink:0}[data-change-icon=change],[data-change-icon=rename-pure],[data-change-icon=rename-changed]{color:var(--diffs-modified-base)}[data-change-icon=new]{color:var(--diffs-addition-base)}[data-change-icon=deleted]{color:var(--diffs-deletion-base)}[data-change-icon=file]{opacity:.6}[data-annotation-content]{z-index:2;isolation:isolate;white-space:normal;align-self:flex-start;min-width:0;display:flow-root;position:relative}[data-overflow=scroll] [data-annotation-content],[data-overflow=scroll] [data-merge-conflict-actions-content]{width:var(--diffs-column-content-width,auto);left:var(--diffs-column-number-width,0);position:sticky}[data-annotation-slot]{text-wrap-mode:wrap;word-break:normal;white-space-collapse:collapse}[data-gutter-utility-slot]{touch-action:none;justify-content:flex-end;display:flex;position:absolute;top:0;bottom:0;right:0}[data-utility-button]{appearance:none;cursor:pointer;width:1lh;height:1lh;font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);background-color:var(--diffs-modified-base);color:var(--diffs-bg);fill:currentColor;z-index:4;touch-action:none;border:none;border-radius:4px;justify-content:center;align-items:center;margin-right:calc(-1lh + 1ch);padding:0;display:flex;position:relative;&:before{content:"";display:block;position:absolute;inset:0 0 0 -4px}}[data-decoration-bar-stack]{pointer-events:none;isolation:isolate;z-index:1;background-color:var(--diffs-decoration-bar-color,transparent);box-sizing:content-box;border-left:2px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg);width:6px;position:absolute;top:0;bottom:0;right:-2px;[data-decoration-bar-depth="1"] &{background-color:color-mix(in lab, var(--diffs-bg) 20%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="2"] &{background-color:color-mix(in lab, var(--diffs-bg) 45%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="3"] &{background-color:color-mix(in lab, var(--diffs-bg) 65%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-start] &{border-top-left-radius:5px;border-top-right-radius:5px}[data-decoration-bar-end] &{z-index:3;border-bottom-right-radius:5px;border-bottom-left-radius:5px}}[data-placeholder]{contain:strict}[data-error-wrapper]{padding:var(--diffs-gap-block,var(--diffs-gap-fallback)) var(--diffs-gap-inline,var(--diffs-gap-fallback));scrollbar-width:none;max-height:400px;overflow:auto;& [data-error-message]{color:var(--diffs-deletion-base);font-size:18px;font-weight:700}& [data-error-stack]{color:var(--diffs-fg-number)}}}@layer theme,rendered,unsafe;
|
|
115
|
-
`;var Jt;function Et(e){if(Jt!=null)return Jt;let t=e.host;if(typeof HTMLElement<"u"&&t instanceof HTMLElement&&!t.isConnected)return;let i=document.createElement("div");i.setAttribute("data-code",""),i.setAttribute(jn,"true");let n=document.createElement("div");return n.style.position="relative",n.style.width="200%",n.style.height="200%",i.appendChild(n),e.appendChild(i),Jt=Math.max(i.offsetHeight-i.clientHeight,0),i.remove(),Jt}function ji(e){let t=e==null?"var(--diffs-scrollbar-gutter-fallback)":`${e}px`;return`${qt}: ${t};`}var qo="@layer base, theme, rendered, unsafe;",Is=new RegExp(`${Ms(qt)}\\s*:\\s*[^;]+;`);function jo(e){return`${qo}
|
|
116
|
-
@layer unsafe {
|
|
117
|
-
${e}
|
|
118
|
-
}`}function Ko(e,t="system",i){let n=t==="system"?"":`
|
|
119
|
-
color-scheme: ${t};`,o=ji(i),r=(t==="system"?["light","dark"]:[t]).map(s=>{let l=`
|
|
120
|
-
[data-line] span, [data-edit-prediction-suffix] span {
|
|
121
|
-
font-weight: var(--diffs-token-${s}-font-weight, inherit);
|
|
122
|
-
font-style: var(--diffs-token-${s}-font-style, inherit);
|
|
123
|
-
text-decoration: var(--diffs-token-${s}-text-decoration, inherit);
|
|
124
|
-
}`;return t==="system"&&s==="dark"?`@media (prefers-color-scheme: dark) {${l}
|
|
125
|
-
}`:l}).join(`
|
|
126
|
-
`);return`${qo}
|
|
127
|
-
@layer base {
|
|
128
|
-
${r}
|
|
129
|
-
}
|
|
130
|
-
@layer rendered {
|
|
131
|
-
:host {${n}
|
|
132
|
-
${o}
|
|
133
|
-
${e}
|
|
134
|
-
}
|
|
135
|
-
}`}function Xo(e,t){let i=ji(t);return e.replace(Is,i)}function Ms(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Fs=new WeakMap;function Zt(e){let t=Fs.get(e);return t??e}function ei({code:e,pre:t,columnType:i,rowSpan:n,containerSize:o=!1}={}){return e==null&&(e=document.createElement("code"),e.setAttribute("data-code",""),i!=null&&e.setAttribute(`data-${i}`,""),t?.appendChild(e)),n!=null?e.style.setProperty("grid-row",`span ${n}`):e.style.removeProperty("grid-row"),o?e.setAttribute("data-container-size",""):e.removeAttribute("data-container-size"),e}function Yo(e,t){if(t==null)return;let i=e.shadowRoot??e.attachShadow({mode:"open"});i.innerHTML===""&&(i.innerHTML=t)}function Qo(e,{type:t,diffIndicators:i,disableBackground:n,disableLineNumbers:o,overflow:r,split:s,totalLines:l,customProperties:a}){if(a!=null)for(let u in a){let d=a[u];d!=null&&e.setAttribute(u,`${d}`)}switch(t==="diff"?(e.setAttribute("data-diff",""),e.removeAttribute("data-file")):(e.setAttribute("data-file",""),e.removeAttribute("data-diff")),i){case"bars":case"classic":e.setAttribute("data-indicators",i);break;case"none":e.removeAttribute("data-indicators")}return o?e.setAttribute("data-disable-line-numbers",""):e.removeAttribute("data-disable-line-numbers"),n?e.removeAttribute("data-background"):e.setAttribute("data-background",""),t==="diff"?e.setAttribute("data-diff-type",s?"split":"single"):e.removeAttribute("data-diff-type"),e.setAttribute("data-overflow",r),e.style.setProperty("--diffs-min-number-column-width-default",`${`${l}`.length}ch`),e}function Ki(e){if(typeof HTMLStyleElement<"u"&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t=="string"&&t.toLowerCase()==="style"}var Ps;function Jo(){return Ps??="safari"in window&&"pushNotification"in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Xi(e,t,i){let n=new Map;for(let o of e){let r=Zt(o);n.set(r,i?.slotNames.get(r)??t(o))}return{provided:e,current:e,slotNames:n}}function Zo(e,t,i){for(let n of t){let o=Zt(n);e.slotNames.has(o)||e.slotNames.set(o,i(n))}e.provided=t,e.current=t}function er(e,t,i){if(e==null)return i(t);let n=Zt(t),o=e.slotNames.get(n);return o==null&&(o=i(t),e.slotNames.set(n,o)),o}function tr(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Yi(e,t){let i=e?.offsetHeight??0;if(e==null||i===0){t();return}e.style.minHeight=`${i}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=""}}function ir({shadowRoot:e,currentNode:t,themeCSS:i}){if(i.trim()===""){t?.remove();return}return t??=Ns(),t.textContent=i,t.parentNode!==e&&e.appendChild(t),t}function Ns(){let e=document.createElement("style");return e.setAttribute(Gn,""),e}var Os=class extends Error{constructor(){super("WorkerPoolManager: operation canceled because the pool terminated"),this.name="WorkerPoolTerminatedError"}},zs=class extends Error{constructor(){super("WorkerPoolManager: operation canceled before the task completed"),this.name="WorkerPoolTaskCanceledError"}},_s=class extends Error{constructor(e,t){super(e,t),this.name="WorkerPoolWorkerError"}},Us=new WeakSet;function Bs(e){return e instanceof Os||e instanceof zs}function ti(e){return Bs(e)||e instanceof _s&&Us.has(e)}if(typeof HTMLElement<"u"&&customElements.get("diffs-container")==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let n=this.attachShadow({mode:"open"});e==null&&(e=new CSSStyleSheet,e.replaceSync(Go)),n.adoptedStyleSheets=[e]}connectedCallback(){let n=this.shadowRoot??this.attachShadow({mode:"open"});Et(n)}}customElements.define(Un,t)}function ii(e){return{...Xn,...e}}function Ke(e,t){return ni(e,t)+Ws(e,t)}function ni(e,t){return t?0:e.diffHeaderHeight}function Ws(e,t){return e.paddingTop??(t?e.spacing:0)}function oi(e){return e.paddingBottom??e.spacing}function nr(e){switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}function $(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function ri(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Qi(e){return e.map(t=>({...t,hunkContent:t.hunkContent.map(i=>({...i}))}))}function si(e){return{...e,hunks:Qi(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function J(e,t){return e-(t===0?0:1)}function Z(e,t){return J(e,t)+t}function Xe(e,...t){return`ck1:${JSON.stringify([e,...t])}`}function ut(e){return e!==""?e.split(Wn):[]}function kt(e,t,i){let n=e==="clone"?si(t):t;if(!n.isPartial)throw new Error("hydratePartialDiff: fileDiff must be partial");switch(n.type){case"change":case"rename-changed":return Vs(n,Gs(n,i),or(n,i));case"rename-pure":{let o=or(n,i);qs(n,i);let r=ut(o.contents);return n.isPartial=!1,n.deletionLines=r,n.additionLines=r,n.deletionCharacterCount=o.contents.length,n.additionCharacterCount=o.contents.length,rr(n,null,o),n}}throw new Error(`hydratePartialDiff: ${n.type} diffs cannot be hydrated from loaded files`)}function Vs(e,t,i){let n=ut(t.contents),o=ut(i.contents),{hunks:r,splitLineCount:s,unifiedLineCount:l}=$s(e.hunks,o.length);return e.hunks=r,e.splitLineCount=s,e.unifiedLineCount=l,e.isPartial=!1,e.deletionLines=n,e.additionLines=o,e.deletionCharacterCount=t.contents.length,e.additionCharacterCount=i.contents.length,rr(e,t,i),e}function $s(e,t){let i=0,n=0,o=0,r=[];for(let s of e){let l=Math.max(s.additionStart-1,0),a=Math.max(s.deletionStart-1,0),u=l,d=a,c=0,h=0,f=0,m=0,p=[];for(let S of s.hunkContent){if(S.type==="context"){p.push({...S,additionLineIndex:u,deletionLineIndex:d}),u+=S.lines,d+=S.lines,f+=S.lines,m+=S.lines;continue}p.push({...S,additionLineIndex:u,deletionLineIndex:d}),u+=S.additions,d+=S.deletions,c+=S.additions,h+=S.deletions,f+=Math.max(S.additions,S.deletions),m+=S.additions+S.deletions}let b=Math.max(J(s.additionStart,s.additionCount)-o,0);r.push({...s,collapsedBefore:b,additionLineIndex:l,deletionLineIndex:a,additionLines:c,deletionLines:h,hunkContent:p,splitLineStart:i+b,unifiedLineStart:n+b,splitLineCount:f,unifiedLineCount:m}),i+=b+f,n+=b+m,o=Z(s.additionStart,s.additionCount)}if(r.length>0){let s=r[r.length-1],l=Z(s.additionStart,s.additionCount),a=Math.max(t-l,0);i+=a,n+=a}return{hunks:r,splitLineCount:i,unifiedLineCount:n}}function Gs(e,t){if(t.oldFile==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function or(e,t){if(t.newFile==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function qs(e,t){if(t.oldFile!==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function js(e,t,i){return e.cacheKey!=null?`${e.cacheKey}:hydrated`:Ks(t,i)}function rr(e,t,i){let n=js(e,t,i);if(n==null){delete e.cacheKey;return}e.cacheKey=n}function Ks(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?Xe("hydrated-files",e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}function me(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Xs=new TextEncoder,Ys=new TextDecoder("utf-8",{ignoreBOM:!0}),Qs=/[\uD800-\uDFFF]/,Ji=1024,ct=new Uint8Array(Ji);function Zi(){ct.length!==Ji&&(ct=new Uint8Array(Ji))}function Q(e){if(e.length===0)return e;if(Qs.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;ct.length<t&&(ct=new Uint8Array(t));let{written:i}=Xs.encodeInto(e,ct);return Ys.decode(ct.subarray(0,i))}var Js=new TextDecoder("utf-8",{ignoreBOM:!0}),Zs={'"':'"',"\\":"\\",a:"\x07",b:"\b",t:" ",n:`
|
|
136
|
-
`,v:"\v",f:"\f",r:"\r"};function sr(e){if(e[0]!=='"')return;let t="",i=1;for(;i<e.length;){let n=e[i];if(n==='"')return{fileName:t,rawLength:i+1};if(n!=="\\"){t+=n,i++;continue}let o=Zs[e[i+1]];if(o!=null){t+=o,i+=2;continue}let r=[];do{let s=ea(e,i+1);if(s==null)return;r.push(s),i+=4}while(e[i]==="\\"&&e[i+1]>="0"&&e[i+1]<="7");t+=Js.decode(new Uint8Array(r))}}function ea(e,t){let i=e.charCodeAt(t)-48,n=e.charCodeAt(t+1)-48,o=e.charCodeAt(t+2)-48;if(i>=0&&i<=3&&n>=0&&n<=7&&o>=0&&o<=7)return i*64+n*8+o}function lr(e){for(let t of e.hunks)for(let i=0;i<t.hunkContent.length;i++){let n=t.hunkContent[i];if(n.type!=="change")continue;let o=ta(e,n);o!=null&&(t.hunkContent.splice(i,1,...o),i+=o.length-1)}}function dr(e,t,i){let{hunkContent:n}=e;for(let o=1;o<n.length;o++){let r=n[o],s=n[o-1];if(r.type!=="change"||r.additions>0&&r.deletions>0||s.type!=="context")continue;let l=r.additions>0,a=l?t.additionLines:t.deletionLines,u=l?r.additionLineIndex:r.deletionLineIndex,d=l?r.additions:r.deletions,c=a[u]??"";if(c.trim()!=="")continue;let h=!0;for(let S=1;S<d;S++)if(a[u+S]!==c){h=!1;break}if(!h)continue;let f=0;for(;f<s.lines&&t.additionLines[s.additionLineIndex+s.lines-1-f]===c;)f++;if(f===0||o===1&&f===s.lines||i!=null&&(f=i(r,f),f===0))continue;r.additionLineIndex-=f,r.deletionLineIndex-=f;let m=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,b=n[o+1];b?.type==="context"?(b.lines+=f,b.additionLineIndex=m,b.deletionLineIndex=p):n.splice(o+1,0,{type:"context",lines:f,additionLineIndex:m,deletionLineIndex:p}),s.lines-=f,s.lines===0&&(n.splice(o-1,1),o--)}}function ta(e,t){let{deletions:i,additions:n,deletionLineIndex:o,additionLineIndex:r}=t,s=Math.min(i,n),l=Math.abs(n-i);if(s===0||l===0||s*(l+1)>4096)return null;let a=[];for(let p=0;p<i;p++)a.push(ar(e.deletionLines[o+p]??""));let u=[];for(let p=0;p<n;p++)u.push(ar(e.additionLines[r+p]??""));let d=n>i,c=0,h=-1;for(let p=0;p<=l;p++){let b=0;for(let S=0;S<s;S++)b+=na(a[S+(d?0:p)],u[S+(d?p:0)]);p===0?h=b+s*.5:b>h&&(h=b,c=p)}if(c===0)return null;let f=[],m=(p,b,S,g)=>{(p>0||b>0)&&f.push({type:"change",deletions:p,additions:b,deletionLineIndex:S,additionLineIndex:g})};return d?(m(0,c,o,r),m(s,s,o,r+c),m(0,n-s-c,o+s,r+c+s)):(m(c,0,o,r),m(s,s,o+c,r),m(i-s-c,0,o+c+s,r+s)),f}var ia=/\s+/g;function ar(e){return e.replace(ia,"")}function na(e,t){if(e===t)return 1;let i=Math.max(e.length,t.length),n=Math.min(e.length,t.length);if(n===0)return 0;let o=0;for(;o<n&&e[o]===t[o];)o++;let r=0;for(;r<n-o&&e[e.length-1-r]===t[t.length-1-r];)r++;return(o+r)/i}var oa=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function ra(e,t,i=!1,n){let o=ha(e),r=o?aa(e):la(e),s,l=[];for(let a of r){if(o&&!Mi.test(a)){if(s==null)s=Q(a);else{if(i)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",a)}continue}else if(!o&&!da(a)){if(s==null)s=Q(a);else{if(i)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",a)}continue}let u=pr(a,{cacheKey:t!=null?n==null?Xe("patch-file",t,String(l.length)):Xe("patch-file",t,String(n),String(l.length)):void 0,isGitDiff:o,throwOnError:i});u!=null&&l.push(u)}return{patchMetadata:s,files:l}}function on(e,t){try{return pr(e,t)}finally{Zi()}}function pr(e,{cacheKey:t,isGitDiff:i=Mi.test(e),oldFile:n,newFile:o,throwOnError:r=!1}={}){let s=0,l=br(e,"@@ "),a,u=n==null||o==null,d=0,c=0;for(let h of l){let f=mr(h),m=f[0];if(m==null){if(r)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",h);continue}let p=vr(m),b=0,S=0;if(p==null||a==null){if(a!=null){if(r)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",h);continue}a={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:u,additionLines:!u&&n!=null&&o!=null?ur(o.contents):[],deletionLines:!u&&n!=null&&o!=null?ur(n.contents):[],additionCharacterCount:!u&&n!=null&&o!=null?o.contents.length:0,deletionCharacterCount:!u&&n!=null&&o!=null?n.contents.length:0,cacheKey:hr(t)},a.additionLines.length===1&&o?.contents===""&&(a.additionLines.length=0),a.deletionLines.length===1&&n?.contents===""&&(a.deletionLines.length=0);for(let w of f){if(w.startsWith("diff --git")){let F=w.trim().match(oa);if(F==null){if(r)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",w);continue}let A=wt(F[1],!0),T=wt(F[2],!0);a.name=Q(T),A!==T&&(a.prevName=Q(A));continue}let R=w.startsWith("---")||w.startsWith("+++")?w.match(Vn):null;if(R!=null){let[,F,A]=R,T=wt(A,i);if(F==="---"&&T!=="/dev/null"){let O=Q(T);a.prevName=O,a.name=O}else F==="+++"&&T!=="/dev/null"&&(a.name=Q(T))}else if(i){if(w.startsWith("new mode ")&&(a.mode=Q(w.slice(8).trim())),w.startsWith("old mode ")&&(a.prevMode=Q(w.slice(8).trim())),w.startsWith("new file mode")&&(a.type="new",a.mode=Q(w.slice(13).trim())),w.startsWith("deleted file mode")&&(a.type="deleted",a.mode=Q(w.slice(17).trim())),w.startsWith("similarity index")&&(w.startsWith("similarity index 100%")?a.type="rename-pure":a.type="rename-changed"),w.startsWith("index ")){let[,F,A,T]=w.trim().match($n)??[];F!=null&&(a.prevObjectId=Q(F)),A!=null&&(a.newObjectId=Q(A)),T!=null&&(a.mode=Q(T))}(w.startsWith("rename from ")||w.startsWith("copy from "))&&(a.prevName=Q(wt(w.slice(w.startsWith("rename")?12:10)))),(w.startsWith("rename to ")||w.startsWith("copy to "))&&(a.name=Q(wt(w.slice(w.startsWith("rename")?10:8))))}}continue}let g,x;for(;f.length>0&&(f[f.length-1]===`
|
|
137
|
-
`||f[f.length-1]==="\r"||f[f.length-1]===`\r
|
|
138
|
-
`||f[f.length-1]==="");)f.pop();let{additionStart:E,deletionStart:y}=p;d=u?d:y-1,c=u?c:E-1;let C={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:E,additionLines:b,deletionCount:p.deletionCount,deletionStart:y,deletionLines:S,deletionLineIndex:d,additionLineIndex:c,hunkContent:[],hunkContext:hr(p.hunkContext),hunkSpecs:Q(m),noEOFCRAdditions:!1,noEOFCRDeletions:!1},L=0,D=0;for(let w=1;w<f.length;w++){let R=f[w];if(L>=C.additionCount&&D>=C.deletionCount&&!R.startsWith("\\")){if(!(ua(R)&&!ca(R)))break;if(r)throw Error("parsePatchContent: hunk has more lines than expected")}let F=R[0];if(F!=="+"&&F!=="-"&&F!==" "&&F!=="\\"){if(r)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${F}", full line: "${R}"`),console.error("processFile: invalid rawLine:",R);continue}let A=pa(F);if(A==="addition"){if(r&&L>=C.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let T=en(R);(g==null||g.type!=="change")&&(g=tn("change",d,c),C.hunkContent.push(g)),c++,L++,u&&(a.additionLines.push(T),a.additionCharacterCount+=T.length),g.additions++,b++,x="addition"}else if(A==="deletion"){if(r&&D>=C.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let T=en(R);(g==null||g.type!=="change")&&(g=tn("change",d,c),C.hunkContent.push(g)),d++,D++,u&&(a.deletionLines.push(T),a.deletionCharacterCount+=T.length),g.deletions++,S++,x="deletion"}else if(A==="context"){if(r&&(D>=C.deletionCount||L>=C.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let T=en(R);(g==null||g.type!=="context")&&(g=tn("context",d,c),C.hunkContent.push(g)),c++,d++,L++,D++,u&&(a.deletionLines.push(T),a.additionLines.push(T),a.deletionCharacterCount+=T.length,a.additionCharacterCount+=T.length),g.lines++,x="context"}else if(A==="metadata"&&g!=null){if(g.type==="context"?(C.noEOFCRAdditions=!0,C.noEOFCRDeletions=!0):x==="deletion"?C.noEOFCRDeletions=!0:x==="addition"&&(C.noEOFCRAdditions=!0),u&&(x==="addition"||x==="context")){let T=a.additionLines.length-1;if(T>=0){let O=a.additionLines[T],B=me(O);a.additionLines[T]=B,a.additionCharacterCount+=B.length-O.length}}if(u&&(x==="deletion"||x==="context")){let T=a.deletionLines.length-1;if(T>=0){let O=a.deletionLines[T],B=me(O);a.deletionLines[T]=B,a.deletionCharacterCount+=B.length-O.length}}}}if(L!==C.additionCount||D!==C.deletionCount){if(r)throw Error("parsePatchContent: hunk line count mismatch");console.error(`parsePatchContent: hunk line count mismatch: "${m.trimEnd()}", declared old/new ${C.deletionCount}/${C.additionCount}, parsed old/new ${D}/${L}`);let w=J(C.additionStart,C.additionCount)+(L===0?0:1),R=J(C.deletionStart,C.deletionCount)+(D===0?0:1);if(!u){let F=w-C.additionStart,A=R-C.deletionStart;C.additionLineIndex+=F,C.deletionLineIndex+=A;for(let T of C.hunkContent)T.additionLineIndex+=F,T.deletionLineIndex+=A}C.additionStart=w,C.deletionStart=R,C.additionCount=L,C.deletionCount=D}C.additionLines=b,C.deletionLines=S,C.collapsedBefore=Math.max(J(C.additionStart,C.additionCount)-s,0),a.hunks.push(C),s=Z(C.additionStart,C.additionCount);for(let w of C.hunkContent)w.type==="context"?(C.splitLineCount+=w.lines,C.unifiedLineCount+=w.lines):(C.splitLineCount+=Math.max(w.additions,w.deletions),C.unifiedLineCount+=w.deletions+w.additions);C.splitLineStart=a.splitLineCount+C.collapsedBefore,C.unifiedLineStart=a.unifiedLineCount+C.collapsedBefore,a.splitLineCount+=C.collapsedBefore+C.splitLineCount,a.unifiedLineCount+=C.collapsedBefore+C.unifiedLineCount}if(a!=null){if(r&&u&&!i&&a.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(a.hunks.length>0&&!u&&a.additionLines.length>0&&a.deletionLines.length>0){let h=a.hunks[a.hunks.length-1],f=Z(h.additionStart,h.additionCount),m=a.additionLines.length,p=Math.max(m-f,0);a.splitLineCount+=p,a.unifiedLineCount+=p}return i||(a.prevName!=null&&a.name!==a.prevName?a.hunks.length>0?a.type="rename-changed":a.type="rename-pure":(n==null||n.contents==="")&&o!=null&&o.contents!==""?a.type="new":n!=null&&n.contents!==""&&(o==null||o.contents==="")&&(a.type="deleted")),a.type!=="rename-pure"&&a.type!=="rename-changed"&&(a.prevName=void 0),lr(a),a}}function rn(e,t,i=!1){let n=[],o=sa(e)?e.split(Bn):[e];for(let r of o)try{n.push(ra(r,t,i,t!=null?n.length:void 0))}catch(s){if(i)throw s;console.error(s)}finally{Zi()}return n}function wt(e,t=!1){let i=e.trim(),n=i.startsWith('"')?sr(i)?.fileName??i:i;return t&&(n.startsWith("a/")||n.startsWith("b/"))?n.slice(2):n}function sa(e){return e.startsWith("From ")||e.includes(`
|
|
139
|
-
From `)}function ur(e){let t=mr(e);for(let i=0;i<t.length;i++)t[i]=Q(t[i]);return t}function mr(e){if(e.length===0)return[""];let t=[],i=0;for(;;){let n=e.indexOf(`
|
|
140
|
-
`,i);if(n===-1)break;t.push(e.slice(i,n+1)),i=n+1}return i<e.length&&t.push(e.slice(i)),t}function aa(e){return br(e,"diff --git")}function la(e){if(e.length===0)return[""];let t=[],i=0,n=0,o=0,r=0,s=!1;for(;n<e.length;){let l=nn(e,n);if(o<=0&&r<=0){if(gr(e,n)){n>i&&t.push(e.slice(i,n)),i=n,s=!0,n=nn(e,l);continue}if(s&&e.startsWith("@@ -",n)){let u=vr(e.slice(n,l));u!=null&&(o=u.deletionCount,r=u.additionCount)}n=l;continue}let a=e[n];if(a==="\\"){n=l;continue}a===" "?(o=Math.max(o-1,0),r=Math.max(r-1,0)):a==="-"?o=Math.max(o-1,0):a==="+"&&(r=Math.max(r-1,0)),n=l}return t.push(e.slice(i)),t}function da(e){return gr(e,0)}function gr(e,t){let i=nn(e,t);return cr(e,t,"---")&&cr(e,i,"+++")}function cr(e,t,i){if(!e.startsWith(i,t))return!1;let n=e[t+i.length];if(n!==" "&&n!==" ")return!1;for(let o=t+i.length+1;o<e.length;o++){let r=e[o];if(r===`
|
|
141
|
-
`||r==="\r")break;if(r!==" "&&r!==" ")return!0}return!1}function nn(e,t){let i=e.indexOf(`
|
|
142
|
-
`,t);return i===-1?e.length:i+1}function ua(e){let t=e[0];return t==="+"||t==="-"||t===" "}function ca(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let i=e[t];if(i!==" "&&i!==" "&&i!==`
|
|
143
|
-
`&&i!=="\r")return!1}return!0}function vr(e){if(!e.startsWith("@@ -"))return;let t=4,i=ai(e,t);if(i==null)return;let n=i.value;t=i.endIndex;let o=1;if(e[t]===","){let d=ai(e,t+1);if(d==null)return;o=d.value,t=d.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let r=ai(e,t);if(r==null)return;let s=r.value;t=r.endIndex;let l=1;if(e[t]===","){let d=ai(e,t+1);if(d==null)return;l=d.value,t=d.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let a,u=t+3;return e[u]===" "&&(a=fa(e.slice(u+1))),{additionCount:l,additionStart:s,deletionCount:o,deletionStart:n,hunkContext:a}}function ai(e,t){let i=t,n=0;for(;i<e.length;i++){let o=e.charCodeAt(i)-48;if(o<0||o>9)break;n=n*10+o}if(i!==t)return{value:n,endIndex:i}}function fa(e){return e.endsWith(`\r
|
|
144
|
-
`)?e.slice(0,-2):e.endsWith(`
|
|
145
|
-
`)?e.slice(0,-1):e}function ha(e){return e.startsWith("diff --git")||e.includes(`
|
|
146
|
-
diff --git`)}function br(e,t){if(e.length===0)return[""];let i=`
|
|
147
|
-
${t}`,n=e.startsWith(t)?0:fr(e,i,0);if(n===-1)return[e];let o=[];n>0&&o.push(e.slice(0,n));let r=n;for(;;){let s=fr(e,i,r+1);if(s===-1)break;o.push(e.slice(r,s)),r=s}return o.push(e.slice(r)),o}function fr(e,t,i){let n=e.indexOf(t,i);return n===-1?-1:n+1}function hr(e){return e==null?e:Q(e)}function pa(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function en(e){let t=e.slice(1);return Q(t===""?`
|
|
148
|
-
`:t)}function tn(e,t,i){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:i,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:i,deletionLineIndex:t}}var Ae=class{diff(t,i,n={}){let o;typeof n=="function"?(o=n,n={}):"callback"in n&&(o=n.callback);let r=this.castInput(t,n),s=this.castInput(i,n),l=this.removeEmpty(this.tokenize(r,n)),a=this.removeEmpty(this.tokenize(s,n));return this.diffWithOptionsObj(l,a,n,o)}diffWithOptionsObj(t,i,n,o){var r;let s=g=>{if(g=this.postProcess(g,n),o){setTimeout(function(){o(g)},0);return}else return g},l=i.length,a=t.length,u=1,d=l+a;n.maxEditLength!=null&&(d=Math.min(d,n.maxEditLength));let c=(r=n.timeout)!==null&&r!==void 0?r:1/0,h=Date.now()+c,f=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(f[0],i,t,0,n);if(f[0].oldPos+1>=a&&m+1>=l)return s(this.buildValues(f[0].lastComponent,i,t));let p=-1/0,b=1/0,S=()=>{for(let g=Math.max(p,-u);g<=Math.min(b,u);g+=2){let x,E=f[g-1],y=f[g+1];E&&(f[g-1]=void 0);let C=!1;if(y){let D=y.oldPos-g;C=y&&0<=D&&D<l}let L=E&&E.oldPos+1<a;if(!C&&!L){f[g]=void 0;continue}if(!L||C&&E.oldPos<y.oldPos?x=this.addToPath(y,!0,!1,0,n):x=this.addToPath(E,!1,!0,1,n),m=this.extractCommon(x,i,t,g,n),x.oldPos+1>=a&&m+1>=l)return s(this.buildValues(x.lastComponent,i,t))||!0;f[g]=x,x.oldPos+1>=a&&(b=Math.min(b,g-1)),m+1>=l&&(p=Math.max(p,g+1))}u++};if(o)(function g(){setTimeout(function(){if(u>d||Date.now()>h)return o(void 0);S()||g()},0)})();else for(;u<=d&&Date.now()<=h;){let g=S();if(g)return g}}addToPath(t,i,n,o,r){let s=t.lastComponent;return s&&!r.oneChangePerToken&&s.added===i&&s.removed===n?{oldPos:t.oldPos+o,lastComponent:{count:s.count+1,added:i,removed:n,previousComponent:s.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:i,removed:n,previousComponent:s}}}extractCommon(t,i,n,o,r){let s=i.length,l=n.length,a=t.oldPos,u=a-o,d=0;for(;u+1<s&&a+1<l&&this.equals(n[a+1],i[u+1],r);)u++,a++,d++,r.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!r.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=a,u}equals(t,i,n){return n.comparator?n.comparator(t,i):t===i||!!n.ignoreCase&&t.toLowerCase()===i.toLowerCase()}removeEmpty(t){let i=[];for(let n=0;n<t.length;n++)t[n]&&i.push(t[n]);return i}castInput(t,i){return t}tokenize(t,i){return Array.from(t)}join(t){return t.join("")}postProcess(t,i){return t}get useLongestToken(){return!1}buildValues(t,i,n){let o=[],r;for(;t;)o.push(t),r=t.previousComponent,delete t.previousComponent,t=r;o.reverse();let s=o.length,l=0,a=0,u=0;for(;l<s;l++){let d=o[l];if(d.removed)d.value=this.join(n.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let c=i.slice(a,a+d.count);c=c.map(function(h,f){let m=n[u+f];return m.length>h.length?m:h}),d.value=this.join(c)}else d.value=this.join(i.slice(a,a+d.count));a+=d.count,d.added||(u+=d.count)}}return o}};var sn=class extends Ae{},Sr=new sn;function an(e,t,i){return Sr.diff(e,t,i)}function ln(e,t){let i;for(i=0;i<e.length&&i<t.length;i++)if(e[i]!=t[i])return e.slice(0,i);return e.slice(0,i)}function dn(e,t){let i;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(i=0;i<e.length&&i<t.length;i++)if(e[e.length-(i+1)]!=t[t.length-(i+1)])return e.slice(-i);return e.slice(-i)}function li(e,t,i){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return i+e.slice(t.length)}function di(e,t,i){if(!t)return e+i;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+i}function ft(e,t){return li(e,t,"")}function Rt(e,t){return di(e,t,"")}function un(e,t){return t.slice(0,ma(e,t))}function ma(e,t){let i=0;e.length>t.length&&(i=e.length-t.length);let n=t.length;e.length<t.length&&(n=e.length);let o=Array(n),r=0;o[0]=0;for(let s=1;s<n;s++){for(t[s]==t[r]?o[s]=o[r]:o[s]=r;r>0&&t[s]!=t[r];)r=o[r];t[s]==t[r]&&r++}r=0;for(let s=i;s<e.length;s++){for(;r>0&&e[s]!=t[r];)r=o[r];e[s]==t[r]&&r++}return r}function cn(e,t){let i=[];for(let n of Array.from(t.segment(e))){let o=n.segment;i.length&&/\s/.test(i[i.length-1])&&/\s/.test(o)?i[i.length-1]+=o:i.push(o)}return i}function ui(e,t){if(t)return ht(e,t)[1];let i;for(i=e.length-1;i>=0&&e[i].match(/\s/);i--);return e.substring(i+1)}function Ye(e,t){if(t)return ht(e,t)[0];let i=e.match(/^\s*/);return i?i[0]:""}function ht(e,t){if(!t)return[Ye(e),ui(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');let i=cn(e,t),n=i[0],o=i[i.length-1],r=/\s/.test(n)?n:"",s=/\s/.test(o)?o:"";return[r,s]}var ci="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",ga=new RegExp(`[${ci}]+|\\s+|[^${ci}]`,"ug"),fn=class extends Ae{equals(t,i,n){return n.ignoreCase&&(t=t.toLowerCase(),i=i.toLowerCase()),t.trim()===i.trim()}tokenize(t,i={}){let n;if(i.intlSegmenter){let s=i.intlSegmenter;if(s.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');n=cn(t,s)}else n=t.match(ga)||[];let o=[],r=null;return n.forEach(s=>{/\s/.test(s)?r==null?o.push(s):o.push(o.pop()+s):r!=null&&/\s/.test(r)?o[o.length-1]==r?o.push(o.pop()+s):o.push(r+s):o.push(s),r=s}),o}join(t){return t.map((i,n)=>n==0?i:i.replace(/^\s+/,"")).join("")}postProcess(t,i){if(!t||i.oneChangePerToken)return t;let n=null,o=null,r=null;return t.forEach(s=>{s.added?o=s:s.removed?r=s:((o||r)&&yr(n,r,o,s,i.intlSegmenter),n=s,o=null,r=null)}),(o||r)&&yr(n,r,o,null,i.intlSegmenter),t}},va=new fn;function yr(e,t,i,n,o){if(t&&i){let[r,s]=ht(t.value,o),[l,a]=ht(i.value,o);if(e){let u=ln(r,l);e.value=di(e.value,l,u),t.value=ft(t.value,u),i.value=ft(i.value,u)}if(n){let u=dn(s,a);n.value=li(n.value,a,u),t.value=Rt(t.value,u),i.value=Rt(i.value,u)}}else if(i){if(e){let r=Ye(i.value,o);i.value=i.value.substring(r.length)}if(n){let r=Ye(n.value,o);n.value=n.value.substring(r.length)}}else if(e&&n){let r=Ye(n.value,o),[s,l]=ht(t.value,o),a=ln(r,s);t.value=ft(t.value,a);let u=dn(ft(r,a),l);t.value=Rt(t.value,u),n.value=li(n.value,r,u),e.value=di(e.value,r,r.slice(0,r.length-u.length))}else if(n){let r=Ye(n.value,o),s=ui(t.value,o),l=un(s,r);t.value=Rt(t.value,l)}else if(e){let r=ui(e.value,o),s=Ye(t.value,o),l=un(r,s);t.value=ft(t.value,l)}}var hn=class extends Ae{tokenize(t){let i=new RegExp(`(\\r?\\n)|[${ci}]+|[^\\S\\n\\r]+|[^${ci}]`,"ug");return t.match(i)||[]}},Cr=new hn;function pn(e,t,i){return Cr.diff(e,t,i)}var mn=class extends Ae{constructor(){super(...arguments),this.tokenize=Sa}equals(t,i,n){return n.ignoreWhitespace?((!n.newlineIsToken||!t.includes(`
|
|
149
|
-
`))&&(t=t.trim()),(!n.newlineIsToken||!i.includes(`
|
|
150
|
-
`))&&(i=i.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(t.endsWith(`
|
|
151
|
-
`)&&(t=t.slice(0,-1)),i.endsWith(`
|
|
152
|
-
`)&&(i=i.slice(0,-1))),super.equals(t,i,n)}},ba=new mn;function gn(e,t,i){return ba.diff(e,t,i)}function Sa(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
153
|
-
`));let i=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let o=0;o<n.length;o++){let r=n[o];o%2&&!t.newlineIsToken?i[i.length-1]+=r:i.push(r)}return i}function ya(e){for(let t=0;t<e.length;t++)if(e[t]<" "||e[t]>"~"||e[t]==='"'||e[t]==="\\")return!0;return!1}function Ue(e){if(!ya(e))return e;let t='"',i=new TextEncoder().encode(e),n=0;for(;n<i.length;){let o=i[n];o===7?t+="\\a":o===8?t+="\\b":o===9?t+="\\t":o===10?t+="\\n":o===11?t+="\\v":o===12?t+="\\f":o===13?t+="\\r":o===34?t+='\\"':o===92?t+="\\\\":o>=32&&o<=126?t+=String.fromCharCode(o):t+="\\"+o.toString(8).padStart(3,"0"),n++}return t+='"',t}var vn={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function bn(e,t,i,n,o,r,s){let l;s?typeof s=="function"?l={callback:s}:l=s:l={},typeof l.context>"u"&&(l.context=4);let a=l.context;if(l.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(l.callback){let{callback:d}=l;gn(i,n,Object.assign(Object.assign({},l),{callback:c=>{let h=u(c);d(h)}}))}else return u(gn(i,n,l));function u(d){if(!d)return;d.push({value:"",lines:[]});function c(g){return g.map(function(x){return" "+x})}let h=[],f=0,m=0,p=[],b=1,S=1;for(let g=0;g<d.length;g++){let x=d[g],E=x.lines||Ca(x.value);if(x.lines=E,x.added||x.removed){if(!f){let y=d[g-1];f=b,m=S,y&&(p=a>0?c(y.lines.slice(-a)):[],f-=p.length,m-=p.length)}for(let y of E)p.push((x.added?"+":"-")+y);x.added?S+=E.length:b+=E.length}else{if(f)if(E.length<=a*2&&g<d.length-2)for(let y of c(E))p.push(y);else{let y=Math.min(E.length,a);for(let L of c(E.slice(0,y)))p.push(L);let C={oldStart:f,oldLines:b-f+y,newStart:m,newLines:S-m+y,lines:p};h.push(C),f=0,m=0,p=[]}b+=E.length,S+=E.length}}for(let g of h)for(let x=0;x<g.lines.length;x++)g.lines[x].endsWith(`
|
|
154
|
-
`)?g.lines[x]=g.lines[x].slice(0,-1):(g.lines.splice(x+1,0,"\"),x++);return{oldFileName:e,newFileName:t,oldHeader:o,newHeader:r,hunks:h}}}function fi(e,t){var i,n,o,r,s,l;if(t||(t=vn),Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(d=>d.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return e.map(d=>fi(d,t)).join(`
|
|
155
|
-
`)}let a=[];if(e.isGit){if(t=vn,!e.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!e.newFileName)throw new Error("newFileName must be specified for Git patches");let d=e.oldFileName,c=e.newFileName;e.isCreate&&d==="/dev/null"?d=c.replace(/^b\//,"a/"):e.isDelete&&c==="/dev/null"&&(c=d.replace(/^a\//,"b/")),a.push("diff --git "+Ue(d)+" "+Ue(c)),e.isDelete&&a.push("deleted file mode "+((i=e.oldMode)!==null&&i!==void 0?i:"100644")),e.isCreate&&a.push("new file mode "+((n=e.newMode)!==null&&n!==void 0?n:"100644")),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(a.push("old mode "+e.oldMode),a.push("new mode "+e.newMode)),e.isRename&&(a.push("rename from "+Ue(((o=e.oldFileName)!==null&&o!==void 0?o:"").replace(/^a\//,""))),a.push("rename to "+Ue(((r=e.newFileName)!==null&&r!==void 0?r:"").replace(/^b\//,"")))),e.isCopy&&(a.push("copy from "+Ue(((s=e.oldFileName)!==null&&s!==void 0?s:"").replace(/^a\//,""))),a.push("copy to "+Ue(((l=e.newFileName)!==null&&l!==void 0?l:"").replace(/^b\//,""))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&a.push("Index: "+e.oldFileName),t.includeUnderline&&a.push("===================================================================");let u=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||u)&&(a.push("--- "+Ue(e.oldFileName)+(e.oldHeader?" "+e.oldHeader:"")),a.push("+++ "+Ue(e.newFileName)+(e.newHeader?" "+e.newHeader:"")));for(let d=0;d<e.hunks.length;d++){let c=e.hunks[d],h=c.oldLines===0?c.oldStart-1:c.oldStart,f=c.newLines===0?c.newStart-1:c.newStart;a.push("@@ -"+h+","+c.oldLines+" +"+f+","+c.newLines+" @@");for(let m of c.lines)a.push(m)}return a.join(`
|
|
156
|
-
`)+`
|
|
157
|
-
`}function Sn(e,t,i,n,o,r,s){if(typeof s=="function"&&(s={callback:s}),s?.callback){let{callback:l}=s;bn(e,t,i,n,o,r,Object.assign(Object.assign({},s),{callback:a=>{l(a?fi(a,s.headerOptions):void 0)}}))}else{let l=bn(e,t,i,n,o,r,s);return l?fi(l,s?.headerOptions):void 0}}function Ca(e){let t=e.endsWith(`
|
|
158
|
-
`),i=e.split(`
|
|
159
|
-
`).map(n=>n+`
|
|
160
|
-
`);return t?i.pop():i.push(i.pop().slice(0,-1)),i}var xa="/dev/null";function Le(e,t,i,n=!1){if(e===null&&t===null)throw new Error("parseDiffFromFile: You must pass oldFile, newFile, or both");let o=e??xr(),r=t??xr(),s=Sn(o.name,r.name,o.contents,r.contents,o.header,r.header,i),l=on(s,{cacheKey:(()=>{let u=e?.cacheKey,d=t?.cacheKey;return u!=null&&d!=null?Xe("diff",u,d):void 0})(),oldFile:o,newFile:r,throwOnError:n});if(l==null)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");e===null?(l.type="new",l.prevName=void 0):t===null&&(l.type="deleted",l.prevName=void 0);let a=t?.lang??(t===null?e?.lang:void 0);return a!=null&&(l.lang=a),l}function xr(){return{name:xa,contents:""}}var Lr=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,this.enabled=!1)}setup(e,t,i){if(t==null||i==null)for(let n of e.children??[])n instanceof HTMLElement&&("deletions"in n.dataset?t=n:"additions"in n.dataset&&(i=n));if(i==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!==i&&(this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=i,i.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 De(e,t){return at(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Tt(e){return P({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function At(e){return P({tagName:"div",children:[P({tagName:"span",children:[xe("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function yn(e){return P({tagName:"div",children:[Ge({name:e==="both"?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{role:"button","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 Qe({type:e,content:t,expandIndex:i,chunked:n=!1,slotName:o,isFirstHunk:r,isLastHunk:s}){let l=0,a=[];if(e==="metadata"&&t!=null&&a.push(P({tagName:"div",children:[xe(t)],properties:{"data-separator-wrapper":""}})),(e==="line-info"||e==="line-info-basic")&&t!=null){let u=[];i!=null&&(n?(r||(u.push(yn("up")),l++),s||(u.push(yn("down")),l++)):(u.push(yn(!r&&!s?"both":r?"down":"up")),l++)),u.push(P({tagName:"div",children:[P({tagName:"span",children:[xe(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),n&&i!=null&&u.push(P({tagName:"div",children:[xe("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),a.push(P({tagName:"div",children:u,properties:{"data-separator-wrapper":"","data-separator-multi-button":l>1?"":void 0}}))}return e==="custom"&&o!=null&&a.push(P({tagName:"slot",properties:{name:o}})),P({tagName:"div",children:a,properties:{"data-separator":a.length===0?"simple":e,"data-expand-index":i,"data-separator-first":r?"":void 0,"data-separator-last":s?"":void 0}})}function Er(e,t){return`hunk-separator-${e}-${t}`}function kr(e){let t=e.at(-1);return t==null?0:Math.max(Z(t.additionStart,t.additionCount),Z(t.deletionStart,t.deletionCount))}function Dt({line:e,spanStart:t,spanLength:i}){return{start:{line:e,character:t},end:{line:e,character:t+i},properties:{"data-diff-span":""},alwaysWrap:!0}}function Ht({item:e,arr:t,enableJoin:i,isNeutral:n=!1,isLastItem:o=!1}){let r=t[t.length-1];if(r==null||o||!i){t.push([n?0:1,e.value]);return}let s=r[0]===0;if(n===s||n&&e.value.length===1&&!s){r[1]+=e.value;return}t.push([n?0:1,e.value])}function pt(e){return[J(e.additionStart,e.additionCount)+1,Z(e.additionStart,e.additionCount)+1]}function ue({isPartial:e,rangeSize:t,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:o}){let r=Math.max(t,0);if(r===0||e)return{fromStart:0,fromEnd:0,rangeSize:r,collapsedLines:r,renderAll:!1};if(i===!0||r<=o)return{fromStart:r,fromEnd:0,rangeSize:r,collapsedLines:0,renderAll:!0};let s=i?.get(n),l=Math.min(Math.max(s?.fromStart??0,0),r),a=Math.min(Math.max(s?.fromEnd??0,0),r),u=l+a,d=u>=r;return{fromStart:d?r:l,fromEnd:d?0:a,rangeSize:r,collapsedLines:Math.max(r-u,0),renderAll:d}}function wr(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let i=e.additionLines.length-Z(t.additionStart,t.additionCount),n=e.deletionLines.length-Z(t.deletionStart,t.deletionCount);return i<=0&&n<=0?!1:i!==n}function Cn({fileDiff:e,errorPrefix:t}){let i=e.hunks[e.hunks.length-1];if(i==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let n=e.additionLines.length-Z(i.additionStart,i.additionCount),o=e.deletionLines.length-Z(i.deletionStart,i.deletionCount);if(n<=0&&o<=0)return 0;if(n!==o)throw new Error(`${t}: trailing context mismatch (additions=${n}, deletions=${o}) for ${e.name}`);return Math.min(n,o)}function ce({fileDiff:e,hunkIndex:t,expandedHunks:i,collapsedContextThreshold:n,errorPrefix:o}){if(t!==e.hunks.length-1)return;let r=Cn({fileDiff:e,errorPrefix:o});if(r<=0)return;if(i===!0||r<=n)return{fromStart:r,fromEnd:0,rangeSize:r,collapsedLines:0,renderAll:!0};let s=i?.get(e.hunks.length),l=Math.min(Math.max(s?.fromStart??0,0),r);return{fromStart:l,fromEnd:0,rangeSize:r,collapsedLines:r-l,renderAll:l>=r}}function hi({fileDiff:e,lineNumber:t,expandedHunks:i,collapsedContextThreshold:n}){if(i===!0||e.isPartial)return!0;for(let[l,a]of e.hunks.entries()){let[u,d]=pt(a);if(t<u){let c=ue({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:i,hunkIndex:l,collapsedContextThreshold:n}),h=u-c.rangeSize;return c.renderAll||t<h+c.fromStart||t>=u-c.fromEnd}if(t<d)return!0}let o=ce({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:i,collapsedContextThreshold:n,errorPrefix:"isAdditionLineRenderable"});if(o==null||o.renderAll)return!0;let r=e.hunks[e.hunks.length-1],[,s]=pt(r);return t<s+o.fromStart||t>=s+o.rangeSize}function Rr({fileDiff:e,lineNumber:t,direction:i,expandedHunks:n,collapsedContextThreshold:o}){if(n===!0||e.isPartial)return t;let r=[],s=1;for(let[a,u]of e.hunks.entries()){let[d,c]=pt(u),h=ue({isPartial:e.isPartial,rangeSize:u.collapsedBefore,expandedHunks:n,hunkIndex:a,collapsedContextThreshold:o}),f=d-h.rangeSize;h.renderAll?r.push([f,d]):(h.fromStart>0&&r.push([f,f+h.fromStart]),h.fromEnd>0&&r.push([d-h.fromEnd,d])),r.push([d,c]),s=c}let l=ce({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:o,errorPrefix:"getNearestRenderableAdditionLine"});if(l!=null){let a=s;s=a+l.rangeSize,l.renderAll?r.push([a,s]):l.fromStart>0&&r.push([a,a+l.fromStart])}if(t>=s)return t;if(i==="down"){for(let[a,u]of r)if(u>t)return Math.max(a,t);return}for(let a=r.length-1;a>=0;a--){let[u,d]=r[a];if(u<=t)return Math.min(d-1,t)}}function Tr({type:e,metrics:t}){return t.hunkSeparatorHeight??nr(e)}function Ar({type:e,metrics:t}){return e==="simple"||e==="metadata"||e==="line-info-basic"?0:t.spacing}function La({type:e,hunkIndex:t,hunkSpecs:i}){switch(e){case"simple":return t>0;case"metadata":return i!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function Ea(e){return e!=="simple"&&e!=="metadata"}function Je({type:e,metrics:t,hunkIndex:i,hunkSpecs:n}){if(!La({type:e,hunkIndex:i,hunkSpecs:n}))return;let o=Tr({type:e,metrics:t}),r=Ar({type:e,metrics:t}),s=i>0?r:0,l=r;return{height:o,gapBefore:s,gapAfter:l,totalHeight:s+o+l}}function Oe({type:e,metrics:t}){if(!Ea(e))return;let i=Tr({type:e,metrics:t}),n=Ar({type:e,metrics:t});return{height:i,gapBefore:n,gapAfter:0,totalHeight:n+i}}function Ee({diff:e,diffStyle:t,startingLine:i=0,totalLines:n=1/0,expandedHunks:o,collapsedContextThreshold:r=1,callback:s}){let l=ka({diff:e,diffStyle:t,startingLine:i,expandedHunks:o,collapsedContextThreshold:r}),a={viewportStart:i,viewportEnd:i+n,isWindowedHighlight:i>0||n<1/0,splitCount:l.splitCount,unifiedCount:l.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!a.isWindowedHighlight)return!1;let u=a.unifiedCount>=i+n,d=a.splitCount>=i+n;return t==="unified"?u:(t==="split"||u)&&d},shouldSkip(u,d){if(!a.isWindowedHighlight)return!1;let c=u>0&&a.unifiedCount+u<=i,h=d>0&&a.splitCount+d<=i;return t==="unified"?c:(t==="split"||c)&&h},incrementCounts(u,d){(t==="unified"||t==="both")&&(a.unifiedCount+=u),(t==="split"||t==="both")&&(a.splitCount+=d)},isInWindow(u,d){if(!a.isWindowedHighlight)return!0;let c=a.isInUnifiedWindow(u),h=a.isInSplitWindow(d);return t==="unified"?c:t==="split"?h:c||h},isInUnifiedWindow(u){return!a.isWindowedHighlight||a.unifiedCount>=i-u&&a.unifiedCount<i+n},isInSplitWindow(u){return!a.isWindowedHighlight||a.splitCount>=i-u&&a.splitCount<i+n},emit(u,d=!1){return d||(t==="unified"?a.incrementCounts(1,0):t==="split"?a.incrementCounts(0,1):a.incrementCounts(1,1)),s(u)??!1}};e:for(let u=l.hunkIndex;u<e.hunks.length;u++){let g=function(A,T){return b==null||b.collapsedLines<=0||b.fromStart+b.fromEnd>0?0:t==="unified"?A===d.unifiedLineStart+d.unifiedLineCount-1?b.collapsedLines:0:T===d.splitLineStart+d.splitLineCount-1?b.collapsedLines:0},E=function(){return x?0:(x=!0,p.collapsedLines)},d=e.hunks[u];if(d==null)throw new Error("iterateOverDiff: invalid hunk index");if(a.shouldBreak())break;let c=J(d.deletionStart,d.deletionCount),h=J(d.additionStart,d.additionCount),f=!e.isPartial&&d.deletionCount===0?c:d.deletionLineIndex,m=!e.isPartial&&d.additionCount===0?h:d.additionLineIndex,p=ue({isPartial:e.isPartial,rangeSize:d.collapsedBefore,expandedHunks:o,hunkIndex:u,collapsedContextThreshold:r}),b=u===a.finalHunkIndex?ce({fileDiff:e,hunkIndex:u,expandedHunks:o,collapsedContextThreshold:r,errorPrefix:"iterateOverDiff"}):void 0,S=p.fromStart+p.fromEnd,x=p.collapsedLines===0;if(a.shouldSkip(S,S))a.incrementCounts(S,S),E();else{let A=d.unifiedLineStart-p.rangeSize,T=d.splitLineStart-p.rangeSize,O=f-p.rangeSize,B=m-p.rangeSize,I=c+1-p.rangeSize,N=h+1-p.rangeSize;if(pi(a,p.fromStart,t,W=>a.emit({hunkIndex:u,hunk:d,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:I+W,lineIndex:O+W,noEOFCR:!1,unifiedLineIndex:A+W,splitLineIndex:T+W},additionLine:{unifiedLineIndex:A+W,splitLineIndex:T+W,lineIndex:B+W,lineNumber:N+W,noEOFCR:!1}}))||(A=d.unifiedLineStart-p.fromEnd,T=d.splitLineStart-p.fromEnd,O=f-p.fromEnd,B=m-p.fromEnd,I=c+1-p.fromEnd,N=h+1-p.fromEnd,pi(a,p.fromEnd,t,W=>a.emit({hunkIndex:u,hunk:d,collapsedBefore:E(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:I+W,lineIndex:O+W,noEOFCR:!1,unifiedLineIndex:A+W,splitLineIndex:T+W},additionLine:{unifiedLineIndex:A+W,splitLineIndex:T+W,lineIndex:B+W,lineNumber:N+W,noEOFCR:!1}}),()=>{E()})))break e}let y=d.unifiedLineStart,C=d.splitLineStart,L=f,D=m,w=c+1,R=h+1,F=d.hunkContent.at(-1);for(let A of d.hunkContent){if(a.shouldBreak())break e;let T=A===F;if(A.type==="context"){if(a.shouldSkip(A.lines,A.lines))a.incrementCounts(A.lines,A.lines),E();else if(pi(a,A.lines,t,O=>{let B=T&&O===A.lines-1,I=y+O,N=C+O;return a.emit({hunkIndex:u,hunk:d,collapsedBefore:E(),collapsedAfter:g(I,N),type:"context",deletionLine:{lineNumber:w+O,lineIndex:L+O,noEOFCR:B&&d.noEOFCRDeletions,unifiedLineIndex:I,splitLineIndex:N},additionLine:{unifiedLineIndex:I,splitLineIndex:N,lineIndex:D+O,lineNumber:R+O,noEOFCR:B&&d.noEOFCRAdditions}})},()=>{E()}))break e;y+=A.lines,C+=A.lines,L+=A.lines,D+=A.lines,w+=A.lines,R+=A.lines}else{let O=Math.max(A.deletions,A.additions),B=A.deletions+A.additions;if(!a.shouldSkip(B,O)){let I=Ta(a,A,t);(I[0]?.[0]??0)>0&&E();for(let[N,W]of I)for(let te=N;te<W;te++){let _=g(y+te,t==="unified"?C+(te<A.deletions?te:te-A.deletions):C+te);if(a.emit(Aa({hunkIndex:u,hunk:d,collapsedBefore:E(),collapsedAfter:_,diffStyle:t,index:te,unifiedLineIndex:y,splitLineIndex:C,additionLineIndex:D,deletionLineIndex:L,additionLineNumber:R,deletionLineNumber:w,content:A,isLastContent:T,unifiedCount:B,splitCount:O}),!0))break e}}E(),a.incrementCounts(B,O),y+=B,C+=O,L+=A.deletions,D+=A.additions,w+=A.deletions,R+=A.additions}}if(b!=null){let{collapsedLines:A,fromStart:T,fromEnd:O}=b,B=T+O;if(pi(a,B,t,I=>{let N=I===B-1;return a.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:N?A:0,type:"context-expanded",deletionLine:{lineNumber:w+I,lineIndex:L+I,noEOFCR:!1,unifiedLineIndex:y+I,splitLineIndex:C+I},additionLine:{unifiedLineIndex:y+I,splitLineIndex:C+I,lineIndex:D+I,lineNumber:R+I,noEOFCR:!1}})},void 0,()=>a.shouldBreak()))break e}}}function ka({diff:e,diffStyle:t,startingLine:i,expandedHunks:n,collapsedContextThreshold:o}){if(i<=0||t==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};let r=wa({diff:e,expandedHunks:n,collapsedContextThreshold:o}),s=0,l=e.hunks.length-1,a=e.hunks.length;for(;s<=l;){let d=s+l>>1,c=r[d+1];if(c==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(t==="unified"?c.unifiedCount:c.splitCount)>i?(a=d,l=d-1):s=d+1}if(a>=e.hunks.length){let d=r[e.hunks.length];if(d==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:e.hunks.length,splitCount:d.splitCount,unifiedCount:d.unifiedCount}}let u=r[a];if(u==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:a,splitCount:u.splitCount,unifiedCount:u.unifiedCount}}function wa({diff:e,expandedHunks:t,collapsedContextThreshold:i}){let n=0,o=0,r=e.hunks.length-1,s=[{splitCount:0,unifiedCount:0}];for(let l=0;l<e.hunks.length;l++){let a=e.hunks[l];if(a==null)throw new Error("iterateOverDiff: invalid hunk summary index");let u=ue({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:l,collapsedContextThreshold:i}),d=u.fromStart+u.fromEnd;n+=d+a.splitLineCount,o+=d+a.unifiedLineCount;let c=l===r?ce({fileDiff:e,hunkIndex:l,expandedHunks:t,collapsedContextThreshold:i,errorPrefix:"iterateOverDiff"}):void 0;if(c!=null){let h=c.fromStart+c.fromEnd;n+=h,o+=h}s.push({splitCount:n,unifiedCount:o})}return s}function Ra(e,t,i){if(!e.isWindowedHighlight||t<=0)return[0,t];let n=[];function o(l){let a=Math.max(0,e.viewportStart-l),u=Math.min(t,e.viewportEnd-l);u>a&&n.push([a,u])}if(i!=="split"&&o(e.unifiedCount),i!=="unified"&&o(e.splitCount),n.length===0)return[0,0];let r=n[0][0],s=n[0][1];for(let l=1;l<n.length;l++){let a=n[l];r=Math.min(r,a[0]),s=Math.max(s,a[1])}return[r,s]}function pi(e,t,i,n,o,r){let[s,l]=Ra(e,t,i);s>0&&(e.incrementCounts(s,s),o?.());let a=s;for(;a<t;){if(r?.()===!0)return!0;if(a>=l){e.incrementCounts(t-a,t-a);break}if(e.isInWindow(0,0)){if(n(a)===!0)return!0}else e.incrementCounts(1,1);a++}return!1}function Ta(e,t,i){if(!e.isWindowedHighlight)return[[0,i==="unified"?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let n=i!=="split",o=i!=="unified",r=i==="unified"?"unified":"split",s=[];function l(c,h){if(c+h<=e.viewportStart||c>=e.viewportEnd)return;let f=Math.max(0,e.viewportStart-c),m=Math.min(h,e.viewportEnd-c);return m>f?[f,m]:void 0}function a(c,h){return r==="split"?c:h==="additions"?[c[0]+t.deletions,c[1]+t.deletions]:c}function u(c,h){if(c==null)return;let[f,m]=a(c,h);m>f&&s.push([f,m])}if(n&&(u(l(e.unifiedCount,t.deletions),"deletions"),u(l(e.unifiedCount+t.deletions,t.additions),"additions")),o&&(u(l(e.splitCount,t.deletions),"deletions"),u(l(e.splitCount,t.additions),"additions")),s.length===0)return s;s.sort((c,h)=>c[0]-h[0]);let d=[s[0]];for(let[c,h]of s.slice(1)){let f=d[d.length-1];c<=f[1]?f[1]=Math.max(f[1],h):d.push([c,h])}return d}function Aa({hunkIndex:e,hunk:t,collapsedAfter:i,collapsedBefore:n,diffStyle:o,index:r,unifiedLineIndex:s,splitLineIndex:l,additionLineIndex:a,deletionLineIndex:u,additionLineNumber:d,deletionLineNumber:c,content:h,isLastContent:f,unifiedCount:m,splitCount:p}){let b=r<h.deletions?s+r:void 0,S=o==="unified"?r>=h.deletions?s+r:void 0:r<h.additions?s+h.deletions+r:void 0,g=o==="unified"?l+(r<h.deletions?r:r-h.deletions):l+r,x=r<h.deletions?u+r:void 0,E=r<h.deletions?c+r:void 0,y=o==="unified"?r>=h.deletions?a+(r-h.deletions):void 0:r<h.additions?a+r:void 0,C=o==="unified"?r>=h.deletions?d+(r-h.deletions):void 0:r<h.additions?d+r:void 0,L=o==="unified"?f&&r===h.deletions-1&&t.noEOFCRDeletions:f&&r===p-1&&t.noEOFCRDeletions,D=o==="unified"?f&&r===m-1&&t.noEOFCRAdditions:f&&r===p-1&&t.noEOFCRAdditions,w=x!=null&&E!=null&&b!=null?{lineNumber:E,lineIndex:x,noEOFCR:L,unifiedLineIndex:b,splitLineIndex:g}:void 0,R=y!=null&&C!=null&&S!=null?{unifiedLineIndex:S,splitLineIndex:g,lineIndex:y,lineNumber:C,noEOFCR:D}:void 0;if(w==null&&R!=null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:i,collapsedBefore:n,deletionLine:void 0,additionLine:R};if(w!=null&&R==null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:i,collapsedBefore:n,deletionLine:w,additionLine:void 0};if(w==null||R==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:i,collapsedBefore:n,deletionLine:w,additionLine:R}}var Da={forcePlainText:!1};function Dr(e,t,i,{forcePlainText:n,lazyLineAST:o=!1,startingLine:r,totalLines:s,expandedHunks:l,collapsedContextThreshold:a=1}=Da){n?(r??=0,s??=1/0):(r=0,s=1/0);let u=r>0||s<1/0;o&&=!n&&!i.useTokenTransformer;let d=typeof i.theme=="string"?t.getTheme(i.theme).type:void 0,c=Mo({theme:i.theme,highlighter:t}),h=n&&!u&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":i.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=i,p=!n&&!e.isPartial,b=n?l:void 0,S=new Map;function g(E){let y=p?0:E,C=S.get(y)??Ma();return S.set(y,C),C}function x(E,y,C,L){if(u){let D=C.at(-1);(D==null||D.targetIndex+D.count!==y)&&(D={targetIndex:y,originalOffset:L.length,count:0},C.push(D)),D.count++}L.push(E)}Ee({diff:e,diffStyle:"both",startingLine:r,totalLines:s,expandedHunks:u?b:!0,collapsedContextThreshold:a,callback:({hunkIndex:E,additionLine:y,deletionLine:C,type:L})=>{let D=g(E),w=y!=null?y.splitLineIndex:C.splitLineIndex;L==="change"&&y!=null&&C!=null&&Ia({additionLine:e.additionLines[y.lineIndex],deletionLine:e.deletionLines[C.lineIndex],deletionLineIndex:D.deletionContent.length,additionLineIndex:D.additionContent.length,deletionDecorations:D.deletionDecorations,additionDecorations:D.additionDecorations,lineDiffType:h,maxLineDiffLength:m}),C!=null&&(x(e.deletionLines[C.lineIndex],C.lineIndex,D.deletionSegments,D.deletionContent),D.deletionInfo.push({type:L==="change"?"change-deletion":L,lineNumber:C.lineNumber,altLineNumber:L==="change"?void 0:y.lineNumber??void 0,lineIndex:`${C.unifiedLineIndex},${w}`})),y!=null&&(x(e.additionLines[y.lineIndex],y.lineIndex,D.additionSegments,D.additionContent),D.additionInfo.push({type:L==="change"?"change-addition":L,lineNumber:y.lineNumber,altLineNumber:L==="change"?void 0:C.lineNumber??void 0,lineIndex:`${y.unifiedLineIndex},${w}`}))}});for(let E of S.values()){if(E.deletionContent.length===0&&E.additionContent.length===0)continue;let y={name:e.prevName??e.name,contents:E.deletionContent.value},C={name:e.name,contents:E.additionContent.value},{deletionLines:L,additionLines:D}=Fa({deletionFile:y,deletionInfo:E.deletionInfo,deletionDecorations:E.deletionDecorations,additionFile:C,additionInfo:E.additionInfo,additionDecorations:E.additionDecorations,highlighter:t,options:i,languageOverride:n?"text":e.lang,lazyLineAST:o});if(p){f.deletionLines=L,f.additionLines=D;continue}for(let[w,R,F]of[[f.deletionLines,L,E.deletionSegments],[f.additionLines,D,E.additionSegments]])if(F.length>0)for(let A of F)for(let T=0;T<A.count;T++)w[A.targetIndex+T]=R[A.originalOffset+T];else if(o){let A=w.length;for(let T=0;T<R.length;T++)ro(w,A+T,()=>R[T])}else ao(w,R)}return{code:f,themeStyles:c,baseThemeType:d}}function Ha(e,{deletionLineIndex:t,additionLineIndex:i,deletionDecorations:n,additionDecorations:o}){let r=0,s=0,l=-1,a=0,u=-1,d=0;for(let{value:c,added:h,removed:f}of e)f?(l===-1&&(l=r),r+=c.length,a=r):h?(u===-1&&(u=s),s+=c.length,d=s):(r+=c.length,s+=c.length);l!==-1&&n.push(Dt({line:t,spanStart:l,spanLength:a-l})),u!==-1&&o.push(Dt({line:i,spanStart:u,spanLength:d-u}))}function Ia({deletionLine:e,additionLine:t,deletionLineIndex:i,additionLineIndex:n,deletionDecorations:o,additionDecorations:r,lineDiffType:s,maxLineDiffLength:l}){if(e==null||t==null||s==="none"||(e=me(e),t=me(t),e.length>l||t.length>l))return;let a=s==="char"?an(e,t):pn(e,t);if(s==="word-line"){Ha(a,{deletionLineIndex:i,additionLineIndex:n,deletionDecorations:o,additionDecorations:r});return}let u=[],d=[],c=s==="word-alt",h=a.at(-1);for(let m of a){let p=m===h;!m.added&&!m.removed?(Ht({item:m,arr:u,enableJoin:c,isNeutral:!0,isLastItem:p}),Ht({item:m,arr:d,enableJoin:c,isNeutral:!0,isLastItem:p})):m.removed?Ht({item:m,arr:u,enableJoin:c,isLastItem:p}):Ht({item:m,arr:d,enableJoin:c,isLastItem:p})}let f=0;for(let m of u)m[0]===1&&o.push(Dt({line:i,spanStart:f,spanLength:m[1].length})),f+=m[1].length;f=0;for(let m of d)m[0]===1&&r.push(Dt({line:n,spanStart:f,spanLength:m[1].length})),f+=m[1].length}function Ma(){return{deletionContent:{push(e){this.value+=e,this.length++},value:"",length:0},additionContent:{push(e){this.value+=e,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Fa({lazyLineAST:e,deletionFile:t,additionFile:i,deletionInfo:n,additionInfo:o,highlighter:r,deletionDecorations:s,additionDecorations:l,languageOverride:a,options:{theme:u,useTokenTransformer:d,tokenizeMaxLineLength:c}}){let h=(f,m,p)=>f.contents===""?[]:so(r.codeToTokens(me(f.contents),Fo(a??Se(f.name),u,c)).tokens,{state:{lineInfo:m},useTokenTransformer:d,decorations:p,lazyLineAST:e,cacheHtmlStyles:r.name==="highlights"});return{deletionLines:h(t,n,s),additionLines:h(i,o,l)}}function He(e,t){let i=Le({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t);return{hunks:i.hunks,splitLineCount:i.splitLineCount,unifiedLineCount:i.unifiedLineCount,additionLines:i.additionLines,deletionLines:i.deletionLines,additionCharacterCount:i.additionCharacterCount,deletionCharacterCount:i.deletionCharacterCount,type:i.type}}function Pa(e,t){let i=Math.max(e,1),n=Array.from({length:i},(o,r)=>`${" ".repeat(r+1)}
|
|
161
|
-
`).join("");return n===t&&(n=Array.from({length:i},(o,r)=>`\0${" ".repeat(r)}
|
|
162
|
-
`).join("")),n}function Na(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function mi(e,t){return t.length>0&&t.length<e.deletionLines.length&&Na(t)}function It(e,t,i,n){let o=e.deletionLines.join(""),r=Pa(t.length,o),s=Le({name:e.prevName??e.name,contents:o},{name:e.name,contents:r,lang:e.lang},n);return{hunks:s.hunks,splitLineCount:s.splitLineCount,unifiedLineCount:s.unifiedLineCount,additionLines:t,deletionLines:s.deletionLines,additionCharacterCount:i,deletionCharacterCount:s.deletionCharacterCount,type:s.type}}function Mt(e,t){return It(e,[""],0,t)}function gi(e,t){if(e.additionLines.length===0)return Mt(e,t);if(mi(e,e.additionLines))return It(e,e.additionLines,e.additionCharacterCount,t);let i=e.additionLines,n=He(e,t);return xn(n,i),n}function Oa(e){return e.length>1&&e.at(-1)===""}function xn(e,t){if(!Oa(t))return;let i=t.length-e.additionLines.length;if(i<=0)return;let n=e.additionLines.length,o=e.hunks.at(-1);if(o!=null&&Z(o.additionStart,o.additionCount)===n){for(let r of o.hunkContent)if(r.type==="change"&&r.additions<r.deletions&&r.additionLineIndex+r.additions===n){e.additionLines=t,r.additions+=i,o.additionCount+=i,o.additionLines+=i,mt(e);return}}}function Hr(e,t,i){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return ze(e,He(e,i));let n=Array.from(t);if(n.length===0)return ze(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let r of n){let s=e.additionLines[r],l=e.deletionLines[r];if(s==null||l==null||me(s)===me(l))return ze(e,He(e,i))}let o=za(e,n);if(o.size===0)return ze(e,He(e,i));for(let r of o)if(!Ua(e,r,i))return ze(e,He(e,i));return mt(e),wr(e)?ze(e,He(e,i)):ze(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function ze(e,t){return Object.assign(e,t),t}function za(e,t){let i=new Set;for(let n of t){let o=_a(e,n);if(o==null)return new Set;i.add(o)}return i}function _a(e,t){for(let[i,n]of e.hunks.entries()){let o=n.additionLineIndex+n.additionCount;if(t>=n.additionLineIndex&&t<o)return i}}function Ua(e,t,i){let n=e.hunks[t];if(n==null)return!1;let o=e.deletionLines.slice(n.deletionLineIndex,n.deletionLineIndex+n.deletionCount),r=e.additionLines.slice(n.additionLineIndex,n.additionLineIndex+n.additionCount),s=Le({name:e.prevName??e.name,contents:o.join("")},{name:e.name,contents:r.join(""),lang:e.lang},{...i,context:0}),l=s.hunks[0];return l==null||s.hunks.length!==1?!1:(Ba(n,l),Ln(e,t),!0)}function Ln(e,t){let i=e.hunks[t];if(i==null)return;if(t!==e.hunks.length-1){i.noEOFCRAdditions=!1,i.noEOFCRDeletions=!1;return}let n=e.additionLines.at(-1),o=e.deletionLines.at(-1);i.noEOFCRAdditions=n!=null&&n!==""&&!n.endsWith(`
|
|
163
|
-
`),i.noEOFCRDeletions=o!=null&&o!==""&&!o.endsWith(`
|
|
164
|
-
`)}function Ba(e,t){let i=e.additionLineIndex,n=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(o=>En(o,i,n)),e.additionLineIndex=i+t.additionLineIndex,e.additionStart=e.additionStart+t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=n+t.deletionLineIndex,e.deletionStart=e.deletionStart+t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,vi(e)}function En(e,t,i){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+i}}function vi(e){let t=0,i=0;for(let n of e.hunkContent)n.type==="context"?(t+=n.lines,i+=n.lines):(t+=Math.max(n.additions,n.deletions),i+=n.additions+n.deletions);e.splitLineCount=t,e.unifiedLineCount=i}function mt(e){let t=0,i=0,n=0;for(let o of e.hunks)o.collapsedBefore=Math.max(J(o.additionStart,o.additionCount)-n,0),o.splitLineStart=t+o.collapsedBefore,o.unifiedLineStart=i+o.collapsedBefore,vi(o),t+=o.collapsedBefore+o.splitLineCount,i+=o.collapsedBefore+o.unifiedLineCount,n=Z(o.additionStart,o.additionCount);if(e.hunks.length>0){let o=e.hunks[e.hunks.length-1],r=Math.max(e.additionLines.length-Z(o.additionStart,o.additionCount),0);t+=r,i+=r}e.splitLineCount=t,e.unifiedLineCount=i}var Ir=new WeakMap;function Wa(e){return e.length>1&&e[e.length-1]===""?e.slice(0,-1):e}function Va(e,t){let i=Math.min(e.length,t.length),n=0;for(;n<i&&e[n]===t[n];)n++;let o=e.length,r=t.length;for(;o>n&&r>n&&e[o-1]===t[r-1];)o--,r--;if(!(n===o&&n===r))return{start:n,deletionEnd:o,additionEnd:r}}function Si(e,t,i){let n=e.hunks,o=e.additionLines,r=Wa(o),s=r===o?e:{...e,additionLines:r},l=Xa(n,ja(s,t,i),e.deletionLines.length),a=Ja(s,l);if(e.additionLines=r,e.hunks=a,e.editSessionDirty=!0,il(e),xn(e,o),!!el(n,e.hunks))return{regions:l.map(u=>u.previousSpan)}}function Nr(e,t,i,n){let o=new Set(t),r=Array.from(o).filter(d=>d>=0&&d<e.additionLines.length).sort((d,c)=>d-c);if(r.length===0)return;let s=d=>o.has(d)?n?.get(d):e.additionLines[d],{hunks:l}=e,a,u=0;for(let d of r){for(;u<l.length;){let f=l[u];if(d<yi(f)+f.additionCount)break;u++}let c=l[u],h=c==null?void 0:yi(c);if(h==null||d<h||a!=null&&a!==u)return Si(e,i,s);a=u}if(a!=null){if($a(e,r,a,n,i)){e.editSessionDirty=!0;return}return Si(e,i,s)}}function $a(e,t,i,n,o){if(n==null||o?.ignoreWhitespace===!0||o?.stripTrailingCr===!0)return!1;let r=Ga(e),s=e.hunks[i];if(s.hunkContent.some(qa))return!1;for(let l of t){let a=n.get(l),u=e.additionLines[l];if(a==null||u==null||r.has(a)||r.has(u))return!1;let d=!1;for(let c of s.hunkContent)if(c.type==="change"&&c.additions===c.deletions&&l>=c.additionLineIndex&&l<c.additionLineIndex+c.additions){d=!0;break}if(!d)return!1}return!0}function Ga(e){let t=Ir.get(e);if(t?.lines===e.deletionLines)return t.set;let i=new Set(e.deletionLines);return Ir.set(e,{lines:e.deletionLines,set:i}),i}function qa(e){return e?.type==="change"&&(e.additions===0||e.deletions===0)}function Or(e,t){let i=new Map,{regions:n}=t;for(let o=0;o<=n.length;o++){let r=n[o-1],s=n[o],l=o===0?e.get(0):r==null?void 0:e.get(r.lastIndex+1),a=s==null?void 0:e.get(s.firstIndex),u=l?.fromStart??0,d=a?.fromEnd??0;(u>0||d>0)&&i.set(o,{fromStart:u,fromEnd:d})}return i}function zr(e,t,i){let n=[];if(e.isPartial)return n;for(let[r,s]of e.hunks.entries()){let l=ue({isPartial:e.isPartial,rangeSize:s.collapsedBefore,expandedHunks:t,hunkIndex:r,collapsedContextThreshold:i});if(l.rangeSize<=i)continue;let a=Ze(s),u=a-l.rangeSize;l.fromStart>0&&n.push([u,u+l.fromStart]),l.fromEnd>0&&n.push([a-l.fromEnd,a])}let o=ce({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:i,errorPrefix:"captureExpansionAnchors"});if(o!=null&&o.fromStart>0&&o.rangeSize>i){let r=e.hunks[e.hunks.length-1],s=Ze(r)+r.deletionCount;n.push([s,s+o.fromStart])}return n}function _r(e,t){let i=new Map;if(t.length===0)return i;let n=(r,s,l)=>{if(l<=s)return;let a=0,u=0;for(let[d,c]of t)c<=s||d>=l||(d<=s&&(a=Math.max(a,Math.min(c,l)-s)),c>=l&&(u=Math.max(u,l-Math.max(d,s))));(a>0||u>0)&&i.set(r,{fromStart:a,fromEnd:u})};for(let[r,s]of e.hunks.entries()){let l=Ze(s);n(r,l-Math.max(s.collapsedBefore,0),l)}let o=e.hunks[e.hunks.length-1];return o!=null&&!e.isPartial&&e.deletionLines.length>0&&n(e.hunks.length,Ze(o)+o.deletionCount,e.deletionLines.length),i}function kn(e,t){return e.editSessionDirty!==!0?!1:(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join("")===""?He(e,t):gi(e,t)),!0)}function ja(e,t,i){if(Va(e.deletionLines,e.additionLines)==null)return[];let n=Le({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t),o,r=(u,d)=>{o??=Ka(e.hunks);for(let c=0;c<=d;c++){let h=o.get(u.deletionLineIndex-c);if(!(h==null||h.additions!==u.additions||h.deletions!==u.deletions)){if(u.additions>0&&i!=null){for(let f=0;f<u.additions;f++)if(i(h.additionLineIndex+f)!==n.additionLines[u.additionLineIndex+f])return d}return c}}return d},s=[],l=0,a=0;for(let u of n.hunks){dr(u,n,r);let d=u.additionCount>0?u.additionLineIndex-l:u.deletionLineIndex-a;l+=d,a+=d;for(let c of u.hunkContent){if(c.type==="context"){l+=c.lines,a+=c.lines;continue}let h=En(c,0,0);h.additions===0&&(h.additionLineIndex=l),h.deletions===0&&(h.deletionLineIndex=a),s.push(h),l+=h.additions,a+=h.deletions}}return s}function Ka(e){let t=new Map;for(let i of e)for(let n of i.hunkContent)n.type==="change"&&(n.additions===0||n.deletions===0)&&t.set(n.deletionLineIndex,n);return t}function Xa(e,t,i){let n=e.map((s,l)=>{let a=Ze(s);return{deletionStart:a,deletionEnd:a+s.deletionCount,blocks:[],previousSpan:{firstIndex:l,lastIndex:l}}}),o=[],r=0;for(let s of t){let l=s.deletionLineIndex,a=l+s.deletions;for(;r<n.length&&n[r].deletionEnd<l;)o.push(n[r]),r++;let u=o.length>0&&Ya(l,a,o[o.length-1])?o.pop():void 0;for(;r<n.length&&n[r].deletionStart<=a;)u=Qa(u,n[r]),r++;if(u==null){let d=l,c=a;if((s.deletions===0||s.additions===0)&&i>s.deletions){let h=o[o.length-1]?.deletionEnd??0,f=n[r]?.deletionStart??i;l>h?d--:a<f&&c++}u={deletionStart:d,deletionEnd:c,blocks:[],previousSpan:void 0}}u.deletionStart=Math.min(u.deletionStart,l),u.deletionEnd=Math.max(u.deletionEnd,a),u.blocks.push(s),o.push(u)}for(;r<n.length;)o.push(n[r]),r++;return o}function Ya(e,t,i){return e<=i.deletionEnd&&t>=i.deletionStart}function Qa(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function Ja(e,t){let i=[],n=0,o=0;for(let r of t){let s=r.deletionStart-n;if(s<0)throw new Error("buildRegionHunks: overlapping old-side regions");n+=s,o+=s;let l=o,a=[];for(let d of r.blocks){let c=d.deletionLineIndex-n,h=d.additionLineIndex-o;if(c<0||c!==h)throw new Error("buildRegionHunks: canonical block context mismatch");Mr(a,c,o,n),n+=c,o+=h,a.push({...d}),n+=d.deletions,o+=d.additions}let u=r.deletionEnd-n;if(u<0)throw new Error("buildRegionHunks: block exceeds its old-side region");Mr(a,u,o,n),n+=u,o+=u,i.push(Za(e,{additionStart:l,additionEnd:o,deletionStart:r.deletionStart,deletionEnd:r.deletionEnd},a))}if(e.deletionLines.length-n!==e.additionLines.length-o)throw new Error("buildRegionHunks: trailing context mismatch");return i}function Za(e,t,i){let n=t.additionEnd-t.additionStart,o=t.deletionEnd-t.deletionStart,r=0,s=0;for(let a of i)a.type==="change"&&(r+=a.additions,s+=a.deletions);let l={collapsedBefore:0,additionStart:bi(t.additionStart,n),additionCount:n,additionLines:r,additionLineIndex:Pr(t.additionStart,n),deletionStart:bi(t.deletionStart,o),deletionCount:o,deletionLines:s,deletionLineIndex:Pr(t.deletionStart,o),hunkContent:i,hunkSpecs:`@@ -${bi(t.deletionStart,o)},${o} +${bi(t.additionStart,n)},${n} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return vi(l),l}function Mr(e,t,i,n){t>0&&e.push({type:"context",lines:t,additionLineIndex:i,deletionLineIndex:n})}function el(e,t){if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++){let n=e[i],o=t[i];if(Ze(n)!==Ze(o)||n.deletionCount!==o.deletionCount||yi(n)!==yi(o)||n.additionCount!==o.additionCount||n.splitLineCount!==o.splitLineCount||!tl(n,o))return!0}return!1}function tl(e,t){let i=Fr(e),n=Fr(t);for(;;){let o=i.next(),r=n.next();if(o.done===!0||r.done===!0)return o.done===r.done;if(o.value[0]!==r.value[0]||o.value[1]!==r.value[1])return!1}}function*Fr(e){for(let t of e.hunkContent){if(t.type==="context"){for(let n=0;n<t.lines;n++)yield[t.deletionLineIndex+n,t.additionLineIndex+n];continue}let i=Math.max(t.deletions,t.additions);for(let n=0;n<i;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function yi(e){return J(e.additionStart,e.additionCount)}function Ze(e){return J(e.deletionStart,e.deletionCount)}function bi(e,t){return t===0?e:e+1}function Pr(e,t){return t===0?e-1:e}function il(e){mt(e);for(let t=0;t<e.hunks.length;t++)Ln(e,t)}function et(e){let t=e.lang??Se(e.name),i=e.lang??(e.prevName!=null?Se(e.prevName):"text");return t==="text"&&i==="text"}var nl=-1,Vr=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++nl}`;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=["text"];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:de},t=je,i,n){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=i,this.workerManager=n}cleanUp(){this.endEditSession(),this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.diff=void 0,this.editSessionActive?(this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0):this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}beginEditSession(e,t){let{editSessionActive:i}=this;this.editSessionActive=!0,i||(this.pendingHighlightResult=void 0),this.diff=e,i&&this.renderCache!=null&&this.renderCache.diff!==e&&this.clearRenderCache();let{renderCache:n}=this;if(!e.isPartial&&e.additionLines.length===0){Object.assign(e,Mt(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(n==null||i&&n.diff===e)return;let{options:o}=this.getRenderOptions(e),r=n.diff===e,s=t!=null&&$(n.diff,t),{result:l}=n;if(!n.highlighted||l==null||!De(n.options,o)||!r&&!s){this.clearRenderCache();return}r||(this.renderCache={diff:e,options:o,highlighted:!0,result:{...l,code:{...l.code,additionLines:[...l.code.additionLines]}},renderRange:n.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff==null&&this.clearRenderCache()}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:i}=this;return e==null||t==null||!$(t.diff,e)||et(e)||Ft(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&i?.isWorkingPool()===!0&&e.cacheKey!=null?(i.evictDiffFromCache(e.cacheKey),i.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,i.getDiffResultCache(e))}).catch(n=>{ti(n)||this.onHighlightError(n)})):this.asyncHighlight(e).then(n=>this.applyRefreshedResult(e,n)).catch(n=>this.onHighlightError(n))}applyRefreshedResult(e,t){let{diff:i,renderCache:n}=this;if(t==null||i==null||n==null||!$(i,e)||!$(n.diff,e)||this.editSessionActive)return;let{options:o}=this.getRenderOptions(i);De(o,t.options)&&(this.pendingHighlightResult={diff:i,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,i=this.getOptionsWithDefaults().expansionLineCount){let n={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t==="up"||t==="both")&&(n.fromStart+=i),(t==="down"||t==="both")&&(n.fromEnd+=i),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,n)}getExpandedHunk(e){return this.expandedHunks.get(e)??Yn}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let i=(()=>{switch(t.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),n=i[t.lineNumber]??[];i[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,i=!1,n,o){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return!1;let{result:s,diff:l}=r;if(s==null)return!1;if(l.isPartial)throw new Error("Could not update render cache for partial diff");let a=s.code.additionLines,u=this.pendingStructuralRows=i?new Map:void 0,d=[],c=new Map;if(u==null&&n!=null){let f=l.additionLines.length,m=al(l.additionLines,o);for(let[p,b]of n){if(p<0||p>f||p===f&&(b===""||!m))continue;let S=l.additionLines[p]??"";S!==b&&(l.additionLines[p]=b,l.additionCharacterCount+=b.length-S.length,d.push(p),c.set(p,S),e.has(p)||(a[p]=Li(p,me(b))))}}for(let[f,m]of e){let p=a[f]?.properties??{},b=m.map(y=>y[2]).join(""),S=f<l.additionLines.length,g=S?l.additionLines[f]??"":"",x=me(g);if(u==null&&S&&n?.has(f)!==!0){let y=Oo(g,b);l.additionLines[f]=y,l.additionCharacterCount+=y.length-g.length,x!==b&&(d.push(f),c.set(f,g))}let E={type:"element",tagName:"div",properties:{"data-line":p["data-line"]??f+1,"data-line-index":p["data-line-index"]??f,"data-line-type":p["data-line-type"]??"context"},children:m.map(([y,C,L])=>y===0&&C===""?L===""?{type:"element",tagName:"br",properties:{},children:[]}:{type:"text",value:L}:{type:"element",tagName:"span",properties:{"data-char":y,style:`color:${C};`},children:[{type:"text",value:L}]})};u!=null?u.set(f,E):a[f]=E}let h=!1;if(d.length>0)if(this.editSessionActive)if(l.additionLines.length<=1&&l.additionLines.join("")==="")this.applyRecomputePreservingSessionType(l,Mt(l,this.options.parseDiffOptions)),h=!0;else if(mi(l,l.additionLines))this.applyRecomputePreservingSessionType(l,It(l,l.additionLines,l.additionCharacterCount,this.options.parseDiffOptions)),h=!0;else{let f=Nr(l,d,this.options.parseDiffOptions,c);this.applyExpansionRemap(f),h=f!=null}else Object.assign(l,Hr(l,d,this.options.parseDiffOptions));return s.baseThemeType=t,r.isDirty=!0,h}applyExpansionRemap(e){e!=null&&(this.expandedHunks=Or(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:i}=this;this.pendingStructuralRows=void 0;let n=this.diff??i?.diff;if(n==null)return;let o=i?.result;if(n.isPartial)throw new Error("Could not apply document change for partial diff");let{additionLines:r}=n,{lines:s,characterCount:l}=ll(e);if(n.additionLines=s,n.additionCharacterCount=l,o!=null&&(o.code.additionLines=sl(r,n.additionLines,o.code.additionLines,e)),n.additionLines.length<=1&&n.additionLines.join("")===""?(this.applyRecomputePreservingSessionType(n,Mt(n,this.options.parseDiffOptions)),o!=null&&(o.code.additionLines[0]=Li(0,e.getLineText(0)))):this.editSessionActive?this.applySessionDocumentChange(n,r):Object.assign(n,gi(n,this.options.parseDiffOptions)),t!=null&&o!=null)for(let[a,u]of t)a<o.code.additionLines.length&&(o.code.additionLines[a]=u);i!=null&&(i.isDirty=!0)}applySessionDocumentChange(e,t){let{parseDiffOptions:i}=this.options,n=e.additionLines;if(mi(e,n)){this.applyRecomputePreservingSessionType(e,It(e,n,e.additionCharacterCount,i));return}this.applyExpansionRemap(Si(e,i,o=>t[o]))}applyRecomputePreservingSessionType(e,t){let i=this.editSessionActive?e.type:void 0;Object.assign(e,t),i!=null&&(e.type=i),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let i=t==="change"?e==="deletions"?"change-deletion":"change-addition":t;return{gutterLineType:i,contentProperties:{"data-line-type":i}}}createAnnotationElement=e=>ko(e);getOptionsWithDefaults(){let{diffIndicators:e="bars",diffStyle:t="split",disableBackground:i=!1,disableFileHeader:n=!1,disableLineNumbers:o=!1,disableVirtualizationBuffers:r=!1,collapsed:s=!1,expandUnchanged:l=!1,collapsedContextThreshold:a=1,expansionLineCount:u=100,hunkSeparators:d="line-info",lineDiffType:c="word-alt",maxLineDiffLength:h=1e3,overflow:f="scroll",stickyHeader:m=!1,theme:p=de,headerRenderMode:b="default",tokenizeMaxLineLength:S=1e3,tokenizeMaxLength:g=Kn,useTokenTransformer:x=!1,useCSSClasses:E=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:i,disableFileHeader:n,disableLineNumbers:o,disableVirtualizationBuffers:r,collapsed:s,expandUnchanged:l,collapsedContextThreshold:a,expansionLineCount:u,hunkSeparators:d,lineDiffType:c,maxLineDiffLength:h,overflow:f,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??p,headerRenderMode:b,tokenizeMaxLineLength:S,tokenizeMaxLength:g,useTokenTransformer:x,useCSSClasses:E}}initializeHighlighter(){return ot(Do(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:Yt(this.workerManager,this.options)}))}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),i=Ft(e,this.getTokenizeMaxLength()),n=this.workerManager?.getDiffResultCache(e);n!=null&&!De(t,n.options)&&(n=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!i&&!et(e),options:t,result:i?void 0:n?.result,renderRange:void 0};let o=this.getHighlightWorkerManager(e);o!=null?this.renderCache.result==null&&!i&&o.highlightDiffAST(this,this.diff):Fe({theme:this.getLocalHighlightTheme()})==null&&(this.computedLangs=Rn(e),this.initializeHighlighter().catch(r=>{r instanceof $e||this.onHighlightError(r)}))}getHighlightWorkerManager(e){let{editSessionActive:t,workerManager:i}=this;return!t&&i?.isWorkingPool()===!0&&!i.shouldHighlightOnMainThread(e)?i:void 0}cacheHighlightResult(e,t){let{editSessionActive:i,workerManager:n}=this;!i&&n?.isWorkingPool()===!0&&n.setDiffResultCache(e.cacheKey,t)}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??de}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let l=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&l.useTokenTransformer!==!0?{...l,useTokenTransformer:!0}:l}let{theme:n,tokenizeMaxLineLength:o,lineDiffType:r,maxLineDiffLength:s}=this.getOptionsWithDefaults();return{theme:n,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:o,lineDiffType:r,maxLineDiffLength:s}})();this.getOptionsWithDefaults();let{renderCache:i}=this;return i?.result==null?{options:t,forceHighlight:!0}:!$(e,i.diff)||!De(t,i.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if($(this.renderCache.diff,e))return this.renderCache.diff;let i=!(e.additionLines.length>0||e.deletionLines.length>0)||et(e)||Ft(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,i)?e:this.renderCache.diff}canRenderDiff(e,t,i){let{renderCache:n}=this;return n==null||$(n.diff,e)?!0:i?n.result==null&&n.hydrated!==!0||this.workerManager?.isWorkingPool()===!0&&!this.workerManager.shouldHighlightOnMainThread(e)||Fe({theme:t.theme})!=null:n.result==null&&n.hydrated!==!0?!0:this.getHighlightWorkerManager(e)!=null?!n.highlighted:Fe({theme:t.theme})!=null}renderDiff(e=this.diff,t=Fi){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:i,collapsedContextThreshold:n}=this.getOptionsWithDefaults(),{options:o,forceHighlight:r}=this.getRenderOptions(e),s=this.getReadyRenderResult(e,o);this.pendingHighlightResult=void 0,s!=null&&(this.renderCache={...s,diff:e,renderRange:void 0},r=!1),this.renderCache??={diff:e,highlighted:!1,options:o,result:void 0,renderRange:void 0};let l=e.additionLines.length>0||e.deletionLines.length>0,a=!l||et(e)||Ft(e,this.getTokenizeMaxLength()),u=this.canRenderDiff(e,o,a),d=!$(e,this.renderCache.diff),c=!Xt(this.renderCache.renderRange,t),h=this.getHighlightWorkerManager(e);if(h!=null){let f=this.renderCache.result==null&&this.renderCache.highlighted&&!a&&!d&&Lt(t);u&&!f&&(a||this.renderCache.result==null||!this.renderCache.highlighted&&(d||c))&&(this.renderCache.diff=e,this.renderCache.options=o,this.renderCache.highlighted=!1,(this.renderCache.result==null||d||c||r)&&(this.renderCache.result=h.getPlainDiffAST(e,t.startingLine,t.totalLines,Lt(t)||i?!0:this.expandedHunks,n)),this.renderCache.renderRange=t),!a&&l&&(!this.renderCache.highlighted||r)&&h.highlightDiffAST(this,e)}else{this.computedLangs=Rn(e);let f=Fe(),m=f!=null&&bt(o.theme,f),p=f!=null&&_i(this.computedLangs,f),b=!a&&p,S=Number.isFinite(t.totalLines);if(u&&f!=null&&m&&(r||a||!this.renderCache.highlighted&&b||this.renderCache.result==null)){let{result:g,options:x}=this.renderDiffWithHighlighter(e,f,a||!p,S);this.renderCache={diff:e,options:x,highlighted:b,result:g,renderRange:void 0},b&&this.cacheHighlightResult(e,{result:g,options:x})}(!m||!a&&!p)&&this.asyncHighlight(e,S).then(({result:g,options:x})=>{a||this.cacheHighlightResult(e,{result:g,options:x}),this.applyHighlightResult(e,g,x,!a)}).catch(g=>{g instanceof $e||this.onHighlightError(g)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=Fi){this.diff=e;let{result:i}=await this.asyncHighlight(e,Number.isFinite(t.totalLines));return this.processDiffResult(e,t,i)}createPreElement(e,t,i){let{diffIndicators:n,disableBackground:o,disableLineNumbers:r,overflow:s}=this.getOptionsWithDefaults();return To({type:"diff",diffIndicators:n,disableBackground:o,disableLineNumbers:r,overflow:s,split:e,totalLines:t,customProperties:i})}async asyncHighlight(e,t=!1){let i=Ft(e,this.getTokenizeMaxLength());this.computedLangs=i?["text"]:Rn(e);let n=Fe(),o=n!=null&&bt(this.getLocalHighlightTheme(),n),r=i||n!=null&&_i(this.computedLangs,n);return(n==null||!o||!r)&&(n=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,n,i,t)}renderDiffWithHighlighter(e,t,i=!1,n=!1){let{options:o}=this.getRenderOptions(e),{collapsedContextThreshold:r}=this.getOptionsWithDefaults(),s=Dr(e,t,o,{forcePlainText:i,lazyLineAST:n,expandedHunks:i?!0:void 0,collapsedContextThreshold:r});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===""&&s.code.additionLines[0]==null){let l;if(Ee({diff:e,diffStyle:"both",expandedHunks:i?!0:void 0,collapsedContextThreshold:r,callback:({additionLine:a})=>{if(a?.lineIndex===0)return l=a,!0}}),l==null)throw new Error("DiffHunksRenderer: missing empty addition line");s.code.additionLines[0]=Li(0,"",l.unifiedLineIndex,l.splitLineIndex)}return{result:s,options:o}}onHighlightSuccess(e,t,i,n=!0){this.editSessionActive||this.applyHighlightResult(e,t,i,n)}applyHighlightResult(e,t,i,n=!0){let{diff:o,renderCache:r}=this;o==null||r==null||!$(o,e)||!De(i,this.getRenderOptions(o).options)||(r.result==null||!r.highlighted||!De(r.options,i)||!$(r.diff,o))&&(this.pendingHighlightResult={diff:o,options:i,highlighted:n,result:t},this.onRenderUpdate?.())}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let i=this.workerManager?.getDiffResultCache(e);if(!(i==null||!De(t,i.options)))return i}getReadyRenderResult(e,t){let{pendingHighlightResult:i}=this;if(i!=null&&$(i.diff,e)&&De(i.options,t))return i;let n=this.getMatchingWorkerResultCache(e,t);if(!(n==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...n}}hasHighlightedRenderCache(e,t){let{renderCache:i}=this;return i?.result!=null&&i.highlighted&&$(e,i.diff)&&De(t,i.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:i,themeStyles:n,baseThemeType:o}){let{diffStyle:r,disableFileHeader:s,expandUnchanged:l,expansionLineCount:a,collapsedContextThreshold:u,hunkSeparators:d}=this.getOptionsWithDefaults(),c=this.renderCache?.isDirty??!1,h=r==="unified",f=dl(e,this.options.loadDiffFiles!=null),m=!e.isPartial||f,p=[],b=[],S=[],g=[],{additionLines:x,deletionLines:E}=i,y={rowCount:0,hunkSeparators:d,additionsContentAST:p,deletionsContentAST:b,unifiedContentAST:S,unifiedGutterAST:vt(),deletionsGutterAST:vt(),additionsGutterAST:vt(),expansionLineCount:a,hunkData:g,incrementRowCount(I=1){y.rowCount+=I},pushToGutter(I,N){switch(I){case"unified":y.unifiedGutterAST.children.push(N);break;case"deletions":y.deletionsGutterAST.children.push(N);break;case"additions":y.additionsGutterAST.children.push(N)}}},C=Cn({fileDiff:e,errorPrefix:"DiffHunksRenderer.processDiffResult"}),L={size:0,side:void 0,increment(){this.size+=1},flush(){if(r!=="unified"){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side==="additions"?(y.pushToGutter("additions",be(void 0,"buffer",this.size)),p?.push(Tt(this.size))):(y.pushToGutter("deletions",be(void 0,"buffer",this.size)),b?.push(Tt(this.size))),this.size=0,this.side=void 0}}},D=(I,N,W,te,_)=>{y.pushToGutter(I,oo(N,W,te,_))};function w(I){L.flush(),r==="unified"?wn("unified",I,y):(wn("deletions",I,y),wn("additions",I,y))}this.pushFileLevelAnnotations(e,r,t,y),Ee({diff:e,diffStyle:r,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:l?!0:this.expandedHunks,collapsedContextThreshold:u,callback:({hunkIndex:I,hunk:N,collapsedBefore:W,collapsedAfter:te,additionLine:_,deletionLine:q,type:j})=>{let re=q!=null?q.splitLineIndex:_.splitLineIndex,ge=_!=null?_.unifiedLineIndex:q.unifiedLineIndex;r==="split"&&j!=="change"&&L.flush(),W>0&&w({hunkIndex:I,collapsedLines:W,rangeSize:Math.max(N?.collapsedBefore??0,0),hunkSpecs:N?.hunkSpecs,isFirstHunk:I===0,isLastHunk:!1,isExpandable:m});let Me=r==="unified"?ge:re,fe={type:j,hunkIndex:I,lineIndex:Me,unifiedLineIndex:ge,splitLineIndex:re,deletionLine:q,additionLine:_};if(r==="unified"){let G=this.getUnifiedInjectedRowsForLine?.(fe);G?.before!=null&&Ur(G.before,y);let ie=q!=null?E[q.lineIndex]:void 0,ne=_!=null?x[_.lineIndex]:void 0;if(ie==null&&ne==null){let oe="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(oe,{file:e.name}),new Error(oe)}let ke=j==="change"?_!=null?"change-addition":"change-deletion":j,le=this.getUnifiedLineDecoration({type:j,lineType:ke,additionLineIndex:_?.lineIndex,deletionLineIndex:q?.lineIndex});D("unified",le.gutterLineType,_!=null?_.lineNumber:q.lineNumber,`${ge},${re}`,le.gutterProperties),ne!=null?ne=xi(ne,le.contentProperties,c&&_!=null?{"data-line":_.lineNumber,"data-line-index":`${ge},${re}`}:void 0):ie!=null&&(ie=xi(ie,le.contentProperties,c&&q!=null?{"data-line":q.lineNumber,"data-line-index":`${ge},${re}`}:void 0)),Ci({diffStyle:"unified",type:j,deletionLine:ie,additionLine:ne,unifiedSpan:this.getAnnotations("unified",q?.lineNumber,_?.lineNumber,I,Me),createAnnotationElement:oe=>this.createAnnotationElement(oe),context:y}),G?.after!=null&&Ur(G.after,y)}else{let G=this.getSplitInjectedRowsForLine?.(fe);G?.before!=null&&Br(G.before,y,L);let ie=q!=null?E[q.lineIndex]:void 0,ne=_!=null?x[_.lineIndex]:void 0,ke=this.getSplitLineDecoration({side:"deletions",type:j,lineIndex:q?.lineIndex}),le=this.getSplitLineDecoration({side:"additions",type:j,lineIndex:_?.lineIndex});if(ie==null&&ne==null){let X="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(X,{file:e.name}),new Error(X)}let oe=(()=>{if(j==="change"){if(ne==null)return"additions";if(ie==null)return"deletions"}})();oe!=null?(L.side!=null&&L.side!==oe&&L.flush(),L.side=oe,L.increment()):j==="change"&&L.flush();let ye=this.getAnnotations("split",q?.lineNumber,_?.lineNumber,I,Me);if(ye!=null&&L.size>0&&L.flush(),q!=null){let X=xi(ie,ke.contentProperties,c?{"data-line":q.lineNumber,"data-line-index":`${q.unifiedLineIndex},${re}`}:void 0);D("deletions",ke.gutterLineType,q.lineNumber,`${q.unifiedLineIndex},${re}`,ke.gutterProperties),X!=null&&(ie=X)}if(_!=null){let X=xi(ne,le.contentProperties,c?{"data-line":_.lineNumber,"data-line-index":`${_.unifiedLineIndex},${re}`}:void 0);D("additions",le.gutterLineType,_.lineNumber,`${_.unifiedLineIndex},${re}`,le.gutterProperties),X!=null&&(ne=X)}Ci({diffStyle:"split",type:j,additionLine:ne,deletionLine:ie,...ye,createAnnotationElement:X=>this.createAnnotationElement(X),context:y}),G?.after!=null&&Br(G.after,y,L)}let he=r==="split"&&N!=null&&re===N.splitLineStart+N.splitLineCount-1,se=I===e.hunks.length-1&&N!=null&&(r==="split"?re===N.splitLineStart+N.splitLineCount-1:ge===N.unifiedLineStart+N.unifiedLineCount-1),We=he?N.noEOFCRDeletions:!1,tt=he?N.noEOFCRAdditions:!1,ve=(q?.noEOFCR??!1)||We,ae=(_?.noEOFCR??!1)||tt;if(ae||ve){if(r==="split"&&L.flush(),ve){let G=j==="context"||j==="context-expanded"?j:"change-deletion";r==="unified"?(y.unifiedContentAST.push(At(G)),y.pushToGutter("unified",be(G,"metadata",1))):(y.deletionsContentAST.push(At(G)),y.pushToGutter("deletions",be(G,"metadata",1)),ae||(y.pushToGutter("additions",be(void 0,"buffer",1)),y.additionsContentAST.push(Tt(1))))}if(ae&&!(h&&ve&&j!=="change")){let G=j==="context"||j==="context-expanded"?j:"change-addition";r==="unified"?(y.unifiedContentAST.push(At(G)),y.pushToGutter("unified",be(G,"metadata",1))):(y.additionsContentAST.push(At(G)),y.pushToGutter("additions",be(G,"metadata",1)),ve||(y.pushToGutter("deletions",be(void 0,"buffer",1)),y.deletionsContentAST.push(Tt(1))))}y.incrementRowCount(1)}d!=="simple"&&d!=="metadata"&&(te>0||se&&f)&&w({hunkIndex:j==="context-expanded"?I:I+1,collapsedLines:se&&f?"unknown":te,rangeSize:C,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),y.incrementRowCount(1)}}),r==="split"&&L.flush();let R=Math.max(kr(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),F=t.bufferBefore>0||t.bufferAfter>0,A=!h&&e.type!=="deleted",T=!h&&e.type!=="new",O=y.rowCount>0||F;p=A&&O?p:void 0,b=T&&O?b:void 0,S=h&&O?S:void 0;let B=this.createPreElement(b!=null&&p!=null,R);return{fileDiff:e,unifiedGutterAST:h&&O?y.unifiedGutterAST.children:void 0,unifiedContentAST:S,deletionsGutterAST:T&&O?y.deletionsGutterAST.children:void 0,deletionsContentAST:b,additionsGutterAST:A&&O?y.additionsGutterAST.children:void 0,additionsContentAST:p,hunkData:g,preNode:B,themeStyles:n,baseThemeType:o,headerElement:s?void 0:this.renderHeader(e),totalLines:R,rowCount:y.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){let i=e==="unified"?t.unifiedGutterAST:e==="deletions"?t.deletionsGutterAST:t.additionsGutterAST,n=e==="unified"?t.unifiedContentAST:e==="deletions"?t.deletionsContentAST:t.additionsContentAST;if(i==null||n==null)return;let o=vt(i);return o.properties.style=`grid-row: span ${t.rowCount}`,[o,zo(n,t.rowCount)]}renderFullAST(e,t=[]){let i=this.getOptionsWithDefaults().hunkSeparators==="line-info",n=this.renderCodeAST("unified",e);if(n!=null)return t.push(P({tagName:"code",children:n,properties:{"data-code":"","data-container-size":i?"":void 0,"data-unified":""}})),{...e.preNode,children:t};let o=this.renderCodeAST("deletions",e);o!=null&&t.push(P({tagName:"code",children:o,properties:{"data-code":"","data-container-size":i?"":void 0,"data-deletions":""}}));let r=this.renderCodeAST("additions",e);return r!=null&&t.push(P({tagName:"code",children:r,properties:{"data-code":"","data-container-size":i?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Ce(this.renderFullAST(e,t))}renderPartialHTML(e,t){return t==null?Ce(e):Ce(P({tagName:"code",children:e,properties:{"data-code":"","data-container-size":this.getOptionsWithDefaults().hunkSeparators==="line-info"?"":void 0,[`data-${t}`]:""}}))}pushFileLevelAnnotations(e,t,i,n){if(!Qt(i))return;let o=e.type!=="new"?this.getAnnotationNames(qi(this.deletionAnnotations)):[],r=e.type!=="deleted"?this.getAnnotationNames(qi(this.additionAnnotations)):[];if(o.length===0&&r.length===0)return;let s=-1,l=-1,{createAnnotationElement:a}=this;if(t==="unified"){Ci({diffStyle:t,type:"context",unifiedSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:o.concat(r)},createAnnotationElement:a,context:n});return}Ci({diffStyle:t,type:"context",deletionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:o},additionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r},createAnnotationElement:a,context:n})}getAnnotations(e,t,i,n,o){let r={type:"annotation",hunkIndex:n,lineIndex:o,annotations:[]};if(t!=null)for(let l of this.deletionAnnotations[t]??[])r.annotations.push(this.annotationSlotName(l));let s={type:"annotation",hunkIndex:n,lineIndex:o,annotations:[]};if(i!=null)for(let l of this.additionAnnotations[i]??[])(e==="unified"?r:s).annotations.push(this.annotationSlotName(l));if(e==="unified")return r.annotations.length>0?r:void 0;if(!(s.annotations.length===0&&r.annotations.length===0))return{deletionSpan:r,additionSpan:s}}getAnnotationNames(e){return e?.map(t=>this.annotationSlotName(t))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:i}=this.getOptionsWithDefaults();return Ro({fileOrDiff:e,mode:t,stickyHeader:i})}},ol=new Intl.PluralRules("en-US");function rl(e){return`${e} unmodified line${ol.select(e)==="one"?"":"s"}`}function Ur(e,t){for(let i of e)t.unifiedContentAST.push(i.content),t.pushToGutter("unified",i.gutter),t.incrementRowCount(1)}function Br(e,t,i){for(let{deletion:n,addition:o}of e){if(n==null&&o==null)continue;let r=n!=null&&o!=null?void 0:n==null?"deletions":"additions";(r==null||i.side!==r)&&i.flush(),n!=null&&(t.deletionsContentAST.push(n.content),t.pushToGutter("deletions",n.gutter)),o!=null&&(t.additionsContentAST.push(o.content),t.pushToGutter("additions",o.gutter)),r!=null&&(i.side=r,i.increment()),t.incrementRowCount(1)}}function Ci({diffStyle:e,type:t,deletionLine:i,additionLine:n,unifiedSpan:o,deletionSpan:r,additionSpan:s,createAnnotationElement:l,context:a}){let u=!1;if(e==="unified"){if(n!=null?a.unifiedContentAST.push(n):i!=null&&a.unifiedContentAST.push(i),o!=null){let d=t==="change"?i!=null?"change-deletion":"change-addition":t;a.unifiedContentAST.push(l(o)),a.pushToGutter("unified",be(d,"annotation",1)),u=!0}}else if(e==="split"){if(i!=null&&a.deletionsContentAST.push(i),n!=null&&a.additionsContentAST.push(n),r!=null){let d=t==="change"?i!=null?"change-deletion":"context":t;a.deletionsContentAST.push(l(r)),a.pushToGutter("deletions",be(d,"annotation",1)),u=!0}if(s!=null){let d=t==="change"?n!=null?"change-addition":"context":t;a.additionsContentAST.push(l(s)),a.pushToGutter("additions",be(d,"annotation",1)),u=!0}}u&&a.incrementRowCount(1)}function wn(e,{hunkIndex:t,collapsedLines:i,rangeSize:n,hunkSpecs:o,isFirstHunk:r,isLastHunk:s,isExpandable:l},a){if(typeof i=="number"&&i<=0)return;let u=e==="unified"?a.unifiedContentAST:e==="deletions"?a.deletionsContentAST:a.additionsContentAST;if(a.hunkSeparators==="metadata"){o!=null&&(a.pushToGutter(e,Qe({type:"metadata",content:o,isFirstHunk:r,isLastHunk:s})),u.push(Qe({type:"metadata",content:o,isFirstHunk:r,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1));return}if(a.hunkSeparators==="simple"){t>0&&(a.pushToGutter(e,Qe({type:"simple",isFirstHunk:r,isLastHunk:!1})),u.push(Qe({type:"simple",isFirstHunk:r,isLastHunk:!1})),e!=="additions"&&a.incrementRowCount(1));return}let d=Er(e,t),c=n>a.expansionLineCount,h=l?t:void 0,f=typeof i=="number"?rl(i):"More unchanged context may be available";a.pushToGutter(e,Qe({type:a.hunkSeparators,content:f,expandIndex:h,chunked:c,slotName:d,isFirstHunk:r,isLastHunk:s})),u.push(Qe({type:a.hunkSeparators,content:f,expandIndex:h,chunked:c,slotName:d,isFirstHunk:r,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1),a.hunkData.push({slotName:d,hunkIndex:t,lines:typeof i=="number"?i:0,lineCountKnown:typeof i=="number",type:e,expandable:l?{up:!r,down:!s,chunked:c}:void 0})}function xi(e,t,i){return e==null||e.type!=="element"||t==null&&i==null?e:{...e,properties:{...e.properties,...t,...i}}}function Wr(e){return e.length>0&&e[e.length-1]===""?e.length-1:e.length}function sl(e,t,i,n){let o=Wr(e),r=Wr(t),s=Math.min(o,r),l=0;for(;l<s&&e[l]===t[l];)l++;let a=0;for(;a<s-l&&e[o-1-a]===t[r-1-a];)a++;let u=new Array(t.length);for(let d=0;d<l;d++)u[d]=i[d];for(let d=0;d<a;d++)u[r-1-d]=i[o-1-d];o<e.length&&r<t.length&&(u[t.length-1]=i[e.length-1]);for(let d=l;d<t.length;d++)u[d]??=Li(d,n.getLineText(d));return u}function al(e,t){return t===e.length+1&&e.at(-1)?.endsWith(`
|
|
165
|
-
`)===!0}function Li(e,t,i=e,n=e){return{type:"element",tagName:"div",properties:{"data-line":e+1,"data-line-index":`${i},${n}`,"data-line-type":"context"},children:[{type:"element",tagName:"span",properties:{"data-char":0},children:[{type:"text",value:t}]}]}}function ll(e){let t=[],i=0;for(let n=0;n<e.lineCount;n++){let o=e.getLineText(n,!0);t.push(o),i+=o.length}return{lines:t,characterCount:i}}function Rn(e){if(e.lang!=null)return[e.lang];let t=Se(e.prevName??e.name),i=Se(e.name);return t===i?[i]:[t,i]}function Ft(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function dl(e,t){return e.isPartial&&t&&(e.type==="change"||e.type==="rename-changed")}function $r(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Gr(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function Pt(e,t=300){let i;try{await Promise.race([e(),new Promise(n=>{i=setTimeout(n,t)})])}finally{i!=null&&clearTimeout(i)}}function Nt({oldFile:e,newFile:t},i){if(!(e===void 0&&t===void 0)){if(e===void 0||t===void 0)throw new Error(`${i}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw new Error(`${i}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return t===null?{oldFile:e,newFile:t}:{oldFile:e,newFile:t}}}function qr(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:tr(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators=="function"?"custom":e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,parseDiffOptions:e?.parseDiffOptions,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader!=null?"custom":"default"}}function Tn(e){return e.isPartial&&(e.type==="change"||e.type==="rename-changed"||e.type==="rename-pure")}function ul(e){let t={...e};return delete t.cacheKey,t}function jr(e,t){if(e.isPartial||t.isPartial)throw new Error("FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated");let i=e.lang??Se(e.name),n=t.lang??Se(t.name),o=e.type!=="new",r=t.type!=="new";return e.name!==t.name||i!==n||o!==r||e.deletionLines.length!==t.deletionLines.length?!0:e.deletionLines.some((s,l)=>s!==t.deletionLines[l])}function cl(e,t){return e.length===t.length&&e.every((i,n)=>i===t[n])}function fl(e,t){let{oldFile:i}=e;return i==null?t.type==="new":t.type!=="new"&&i.name===(t.prevName??t.name)&&cl(i.lines,t.deletionLines)}var hl=-1,Xr=class{options;workerManager;requestOwnerRender;static LoadedCustomComponent=!0;__id=`file-diff:${++hl}`;type="file-diff";fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;get lineAnnotations(){return this.renderedData?.lineAnnotations??Qn}managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedData;pendingData;forceRenderOverride;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:de},t,i){this.options=e,this.workerManager=t,this.requestOwnerRender=i,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new xo,this.scrollSyncManager=new Lr,this.interactionManager=new Co("diff",zi(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()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??de}getHunksRendererOptions(e){return qr(e)}createHunksRenderer(e){return new Vr(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t="additions")=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,i){if(e==null)return;let n=e.hunks.at(-1),o,r;e:for(let s of e.hunks){let l=i==="deletions"?s.deletionStart:s.additionStart,a=i==="deletions"?s.deletionCount:s.additionCount,u=J(l,a)+1,d=s.splitLineStart,c=s.unifiedLineStart;if(t<u){let h=u-t;o=Math.max(c-h,0),r=Math.max(d-h,0);break e}if(t>=u+a){if(s===n){let h=t-(u+a);o=c+s.unifiedLineCount+h,r=d+s.splitLineCount+h;break e}continue}for(let h of s.hunkContent)if(h.type==="context")if(t<u+h.lines){let f=t-u;r=d+f,o=c+f;break e}else u+=h.lines,d+=h.lines,c+=h.lines;else{let f=i==="deletions"?h.deletions:h.additions;if(t<u+f){let m=t-u;o=c+(i==="additions"?h.deletions:0)+m,r=d+m;break e}else u+=f,d+=Math.max(h.deletions,h.additions),c+=h.deletions+h.additions}break e}if(!(o==null||r==null))return[o,r]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(zi(this.options,typeof this.options.hunkSeparators=="function"||(this.options.hunkSeparators??"line-info")==="line-info"||this.options.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??"system")!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme=="string"||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!at(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>er(this.editSession?.annotations,e,je);getLatestAnnotations(){return this.pendingData?.lineAnnotations??this.editSession?.annotations?.current??this.lineAnnotations}getAnnotationsForDiff(e){let{pendingData:t}=this;return t!=null&&$(e,t.fileDiff)?t.lineAnnotations:this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.getLatestAnnotations()?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t!=null){if(!this.isNewAnnotations(e))return;Zo(t,e,je)}let i=this.getWorkingDiff();i!=null&&(this.pendingData={fileDiff:i,lineAnnotations:e})}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.renderedData!=null&&(this.renderedData.lineAnnotations=e),this.pendingData=void 0,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,i){return!(e||t||i||typeof this.options.hunkSeparators=="function")}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??"additions"})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e="split",overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t==="wrap",columnVariables:this.shouldApplyColumnVariables(t)?"apply":"measure"}),t==="scroll"&&e==="split"?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators=="function"?!0:e==="scroll"&&(this.lineAnnotations.length>0||this.pre?.hasAttribute("data-has-merge-conflict")===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;qe(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?"recycle":"discard"),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isComponentManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.renderedData=void 0,this.pendingData=void 0),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre?.remove(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement?.remove(),this.headerElement=void 0,this.clearHeaderSlots(),this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:i=!1,lineAnnotations:n,fileDiff:o,...r}){if(!this.enabled)throw new Error("FileDiff.hydrate: attempting to call hydrate after cleaned up");if(this.fileContainer!=null)throw new Error("FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated");let s=Nt(r,"FileDiff.hydrate"),l=s?.oldFile,a=s?.newFile;this.hydrateElements(e,t);let u=this.editor!=null;u||vl(this.pre,ml({fileDiff:o,oldFile:l,newFile:a}),this.options.collapsed)||bl(this.headerElement,gl({fileDiff:o,oldFile:l,newFile:a}),this.options.disableFileHeader)?this.render({...r,fileContainer:e,lineAnnotations:n,fileDiff:o,forceRender:u||r.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:o,lineAnnotations:n,...s}),i||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Yo(e,t);for(let i of e.shadowRoot?.children??[]){if(i instanceof SVGElement){this.spriteSVG=i;continue}if(i instanceof HTMLElement){if(i instanceof HTMLPreElement){this.pre=i;for(let n of i.children)!(n instanceof HTMLElement)||n.tagName.toLowerCase()!=="code"||("deletions"in n.dataset&&(this.codeDeletions=n),"additions"in n.dataset&&(this.codeAdditions=n),"unified"in n.dataset&&(this.codeUnified=n));continue}if("diffsHeader"in i.dataset){this.headerElement=i;continue}if(i instanceof HTMLStyleElement&&i.hasAttribute("data-theme-css")){this.themeCSSStyle=i;continue}if(i instanceof HTMLStyleElement&&i.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=i,this.appliedUnsafeCSS=i.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:i,lineAnnotations:n}){let o=n??this.getLatestAnnotations();this.pendingData=void 0,this.additionFile=i,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&i!==void 0?Le(t,i,this.options.parseDiffOptions):void 0),this.renderedData=this.fileDiff!=null?{fileDiff:this.fileDiff,lineAnnotations:o}:void 0,this.fileDiff!=null&&this.adoptRenderData(this.fileDiff),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.getInputDiff()==null&&this.additionFile==null&&this.deletionFile==null||this.requestRender()||this.render({forceRender:!0,renderRange:this.renderRange})}requestRender(){let{requestOwnerRender:e}=this;return this.editSession!=null||e==null?!1:(this.forceRenderOverride=!0,e(),!0)}get isComponentManaged(){return this.requestOwnerRender!=null}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,i)=>{this.expandHunk(e,t,i)};expandHunk=(e,t,i)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(e,t,i),this.rerender()};loadFilesIfNecessary(){let e=this.getInputDiff(),{loadDiffFiles:t}=this.options;if(e==null||!Tn(e)||this.pendingFiles?.fileDiff===e)return;if(t==null)throw new Error("FileDiff: loadDiffFiles is required to load full files for a partial diff");let i=this.loadFilesForDiff(e,t),n=this.pendingFiles={fileDiff:e,promise:i},o=()=>{this.pendingFiles===n&&(this.pendingFiles=void 0)};n.promise=i.finally(o)}__canAttachEditor(){let e=this.getInputDiff();return e!=null&&!e.isPartial}async prepareForEditing(){if(this.__canAttachEditor())return;let e=this.__prepareForEditing();if(e==null){let t=this.getInputDiff();throw t?.isPartial===!0&&!Tn(t)?new Error("FileDiff.prepareForEditing: this partial diff cannot be hydrated; provide a complete diff"):new Error("FileDiff.prepareForEditing: a partial diff requires loadDiffFiles")}if(await e,!this.__canAttachEditor())throw new Error("FileDiff.prepareForEditing: the diff did not finish loading")}__prepareForEditing(){if(this.__canAttachEditor())return;let e=this.getInputDiff();if(e?.isPartial===!0&&!Tn(e))throw new Error("FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit");return this.loadFilesIfNecessary(),this.pendingFiles?.promise}async loadFilesForDiff(e,t){try{let i=await t(e);if(this.getInputDiff()!==e)return;await this.handleFilesLoaded(e,i)}catch(i){if(this.options.disableErrorHandling===!0)throw i;console.error(i)}}async handleFilesLoaded(e,t){if(!(this.getInputDiff()!==e||!e.isPartial)){if(kt("merge",e,t),this.setHydratedState(t),this.installHydratedSessionDiff(e)){this.rerender();return}await Pt(()=>this.primeHighlightCache(e)),!(!this.enabled||this.getInputDiff()!==e)&&this.rerender()}}installHydratedSessionDiff(e){if(e.isPartial)throw new Error("FileDiff.installHydratedSessionDiff: diffs cannot be partial for editing");return this.getInputDiff()!==e?!1:this.editSession?.outgoingDiff!=null?(this.installEditSession(e),!0):!1}updateInputDiff(e,t){if($(this.getInputDiff(),e))return!1;let i=this.getLatestAnnotations();this.fileDiff=e;let{editSession:n}=this,o=n?.outgoingDiff??n?.diff;return n!=null&&(e.isPartial?n.inputDiff=e:this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=o)),this.editSession?.annotations!=null&&t!=null&&(this.editSession.annotations=Xi(t,je,this.editSession.annotations)),this.pendingData={fileDiff:this.editSession?.diff??e,lineAnnotations:this.editSession?.annotations?.current??t??i},o!=null&&e.isPartial&&this.loadFilesIfNecessary(),!0}installEditSession(e,t,i){let n=e.additionLines.join(""),o=t!=null?ut(t.contents):void 0,r=i!=null&&fl(i,e);if(i!=null&&!r)throw new Error("FileDiff: retained session cannot resume against a different old file");if(t!=null&&t.contents!==n&&!r)throw new Error("FileDiff: retained edits are missing their diff session state");let s=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===n,l=ul(e);t!=null&&o!=null&&!s&&(l.name=t.name,l.lang=t.lang),r&&i!=null&&t!=null&&o!=null&&(l.additionLines=o,l.additionCharacterCount=t.contents.length,l.type=i.type,l.hunks=i.hunks,l.editSessionDirty=!0,mt(l));let a=this.editSession?.annotations??Xi(this.getLatestAnnotations(),je);this.editSession={diff:l,inputDiff:e,annotations:a,outgoingDiff:this.editSession?.outgoingDiff},this.pendingData={fileDiff:l,lineAnnotations:a.current},this.hunksRenderer.beginEditSession(l,s&&!r?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:i=!1,preventEmit:n=!1,lineAnnotations:o,fileContainer:r,containerWrapper:s,renderRange:l,...a}){if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");i=this.forceRenderOverride??i,this.forceRenderOverride=void 0;let u=Nt(a,"FileDiff.render"),d=u?.oldFile,c=u?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:h=!1,themeType:f="system",expandUnchanged:m=!1}=this.options,p=h?void 0:l,b=this.hasThemeChanged(),S=u!=null,g=S&&(!Kr(d,this.deletionFile)||!Kr(c,this.additionFile)),x=e!=null&&!$(e,this.getInputDiff()),E=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)?this.isNewAnnotations(o):!1;if(!h&&Xt(p,this.renderRange)&&!i&&!E&&!b&&(e!=null&&!x||e==null&&!g)){let R=this.applyCachedThemeState(f);return R&&this.finalizeRender(),R}let y;e==null&&S&&(g||this.getInputDiff()==null)&&(y=Le(u.oldFile,u.newFile,this.options.parseDiffOptions));let{renderRange:C}=this;this.renderRange=p,S?(this.deletionFile=d,this.additionFile=c):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&x?this.updateInputDiff(e,o):y!=null&&(x=!0,this.updateInputDiff(y,o)),x&&this.clearReusableHeader(),o!=null&&this.setLineAnnotations(o);let L=this.getWorkingDiff();if(L==null)return!1;L.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(kn(L,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.prepareRenderData(this.hunksRenderer.getDiffForNextRender(L));let{disableErrorHandling:D=!1,disableFileHeader:w=!1}=this.options;if(w&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),r=this.getOrCreateFileContainer(r,s),this.applyCachedThemeState(f),h){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let R=this.hunksRenderer.renderDiff(L,Jn);R!=null&&this.applyThemeState(r,R.themeStyles,f,R.baseThemeType),R?.headerElement!=null&&this.applyHeaderToDOM(R.headerElement,r,R.fileDiff),this.renderSeparators([]),this.adoptRenderData(R?.fileDiff??L),this.injectUnsafeCSS()}catch(R){if(D)throw R;console.error(R),R instanceof Error&&this.applyErrorToDOM(R,r)}return this.finalizeRender(),n||this.emitPostRender(),!0}try{let R=this.getOrCreatePreNode(r);if(this.canPartiallyRender(i,E,g||x||b||!$(this.getRenderedDiff(),L))&&this.applyPartialRender({fileDiff:L,previousRenderRange:C,renderRange:p})){let F=this.getRenderedDiff();F!=null&&this.adoptRenderData(F)}else{let F=this.hunksRenderer.renderDiff(L,p);if(F==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(r,F.themeStyles,f,F.baseThemeType),F.headerElement!=null&&this.applyHeaderToDOM(F.headerElement,r,F.fileDiff),F.additionsContentAST!=null||F.deletionsContentAST!=null||F.unifiedContentAST!=null?this.applyHunksToDOM(R,F):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(F.hunkData),this.adoptRenderData(F.fileDiff)}this.applyBuffers(R,p),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(R){if(D)throw R;console.error(R),R instanceof Error&&this.applyErrorToDOM(R,r)}return n||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:i}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,"unmount");return}if(t==null)return;let n=this.mounted?"update":"mount";this.mounted=!0,i?.(t,this,n)}getInputDiff(){return this.fileDiff}getWorkingDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedData?.fileDiff}__getNextRenderData({fileDiff:e,lineAnnotations:t}){let i=this.editSession?.annotations;if(i!=null)return{fileDiff:e,lineAnnotations:t!=null&&this.isNewAnnotations(t)?t:i.provided};let n=this.getWorkingDiff(e)??e,o=this.hunksRenderer.getDiffForNextRender(n);return{fileDiff:o,lineAnnotations:t!=null&&$(o,n)?t:this.getAnnotationsForDiff(o)}}prepareRenderData(e){this.hunksRenderer.setLineAnnotations(this.getAnnotationsForDiff(e))}adoptRenderData(e){let{pendingData:t}=this,i=t!=null&&$(e,t.fileDiff);this.renderedData={fileDiff:e,lineAnnotations:i?t.lineAnnotations:this.lineAnnotations},i&&(this.pendingData=void 0)}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,i=this.getLatestAnnotations(),n=this.computeEditorRenderRange(this.renderRange),o=this.getWorkingDiff();if(e==null||t==null||o==null||o.isPartial)return;let r=u=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getWorkingDiff()!==o)return;let d=this.editSession?.outgoingDiff,c=this.getInputDiff(),h=d!=null&&c!=null&&d!==o,f=h&&d!=null&&c!=null?jr(d,c):!1;e.__syncRenderView({highlighter:u,fileContainer:t,fileDiff:o,lineAnnotations:i,renderRange:n,externalDocument:h,resetHistory:f})},s=this.getTheme(),l=o.lang??Se(o.name),a=Fe({theme:s,lang:l});a!=null?r(a):ot({themes:nt(s),langs:["text",l],preferredHighlighter:Yt(this.workerManager,this.options)}).then(r).catch(u=>{u instanceof $e||console.error(u)})}computeEditorRenderRange(e){let t=this.getWorkingDiff();if(e==null||t==null||Lt(e))return e;let{diffStyle:i="split",expandUnchanged:n=!1,collapsedContextThreshold:o=1}=this.options,r,s;return Ee({diff:t,diffStyle:i,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({additionLine:l})=>{l!=null&&(r??=l.lineNumber,s=l.lineNumber)}}),r==null||s==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:r-1,totalLines:s-r+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let t=this.getInputDiff(),{diff:i,outgoingDiff:n}=this.editSession??{};if(n!=null&&t!=null){if(!t.isPartial&&jr(n,t))return;i=n}if(!(i==null||i.isPartial))return{diffSession:{oldFile:i.type!=="new"?{name:i.prevName??i.name,lines:e?[...i.deletionLines]:i.deletionLines}:null,type:i.type,hunks:e?Qi(i.hunks):i.hunks},hasChanges:i.editSessionDirty===!0}}__attachEditor(e){if(this.type!=="file-diff")throw new Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw new Error("FileDiff.__attachEditor: an editor is already attached");if(!this.__canAttachEditor())throw new Error("FileDiff.__attachEditor: a complete diff is required before editing");let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(i){throw t(),i}}__resumeEditor(e){if(this.editor!==e)throw new Error("FileDiff.__resumeEditor: editor association changed");this.resumeEditorRendering(e)}resumeEditorRendering(e){let t=this.getInputDiff(),i=this.editSession?.outgoingDiff;i!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===i&&this.installEditSession(t);let n=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;n!=null?this.installEditSession(n,e.__getDocumentContents(pl(n)),e.__getDocumentSessionState()):this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff),this.editor=e,this.getInputDiff()?.isPartial===!0&&this.loadFilesIfNecessary();let o=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(o!=null&&this.hunksRenderer.diffCache===o&&this.adoptRenderData(o),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t==="install",e)}settleEditSession(e,t){let{editSession:i}=this;if(i==null)return;let{diff:n,inputDiff:o,annotations:r}=i,s=r?.provided??this.lineAnnotations;if(this.editor!=null)throw new Error("FileDiff.__completeEditSession: detach the editor before completing the session");this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let l=r?.current,a,u=null,d=null,c=!1,h;if(t==null)throw new Error("FileDiff.__completeEditSession: editor is required for completion");let f=si(n),m={name:f.name,contents:f.additionLines.join("")};f.lang!=null&&(m.lang=f.lang);let p={fileDiff:f,editor:t,originalFileDiff:o,oldFile:f.type==="new"?null:{name:f.prevName??f.name,contents:f.deletionLines.join("")},newFile:m,lineAnnotations:l,originalLineAnnotations:s};Object.freeze(p);try{if(t.__emitEditComplete(p),this.options.onEditComplete?.(p)==="accept"){if(f.cacheKey!=null&&f.cacheKey===o.cacheKey)throw new Error("FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey");a=f,u=p.oldFile,d=p.newFile}}catch(b){c=!0,h=b}if(e&&a!=null&&this.additionFile!=null&&(this.deletionFile=u,this.additionFile=d),this.editSession=void 0,this.fileDiff=e&&a!=null?a:o,this.pendingData={fileDiff:this.fileDiff,lineAnnotations:e&&a!=null?l??s:s},e&&this.fileContainer!=null&&this.rerender(),c)throw h}finalizeEditSessionHunks(){let e=this.getWorkingDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,i=zr(e,this.hunksRenderer.getExpandedHunksMap(),t);return kn(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(_r(e,i)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let i=this.editSession?.diff;if(i==null)throw new Error("FileDiff.applyDocumentChange: requires an active edit session");this.detachAdditionLines(),this.hunksRenderer.beginEditSession(i),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}applySuspendedDocumentChange(e,t){this.applyDocumentChange(e,t),this.hunksRenderer.clearRenderCache()}updateRenderCache(e,t,i={}){let n=this.editSession?.diff;if(n==null)throw new Error("FileDiff.updateRenderCache: requires an active edit session");this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n);let{shouldRefreshDiffsView:o,lineCountChangeInFlight:r}=i;if(this.hunksRenderer.updateRenderCache(e,t,r,i.changedDocumentLines,i.documentLineCount)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}o===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle==="split"?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let{diff:e,inputDiff:t}=this.editSession??{};e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:i=!1,collapsedContextThreshold:n=1}=this.options;return hi({fileDiff:t,lineNumber:e,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n})}getNearestRenderableLine(e,t){let i=this.getRenderedDiff();if(i==null)return e;let{expandUnchanged:n=!1,collapsedContextThreshold:o=1}=this.options;return Rr({fileDiff:i,lineNumber:e,direction:t,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:i=!1,collapsedContextThreshold:n=1,expansionLineCount:o=100}=this.options;if(t==null||t.isPartial||i)return!1;let r=this.hunksRenderer.getExpandedHunksMap();for(let[u,d]of t.hunks.entries()){let[c,h]=pt(d);if(e<c){let f=ue({isPartial:t.isPartial,rangeSize:d.collapsedBefore,expandedHunks:r,hunkIndex:u,collapsedContextThreshold:n}),m=c-f.rangeSize;if(f.renderAll||e<m+f.fromStart||e>=c-f.fromEnd)return!1;let p=e-(m+f.fromStart)+1,b=c-f.fromEnd-e;return p<=b?this.expandHunk(u,"up",p+o):this.expandHunk(u,"down",b+o),!0}if(e<h)return!1}let s=ce({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:r,collapsedContextThreshold:n,errorPrefix:"FileDiff.revealLine"});if(s==null||s.renderAll)return!1;let l=t.hunks[t.hunks.length-1],[,a]=pt(l);return e<a+s.fromStart||e>=a+s.rangeSize?!1:(this.expandHunk(t.hunks.length,"up",e-(a+s.fromStart)+1+o),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){ee(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};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.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let t=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",t.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder==null?!1:(this.placeHolder.style.setProperty("height",`${e}px`),!0)}async primeHighlightCache(e=this.getInputDiff()){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||et(e))return;let i=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>i||await t.primeDiffHighlightCache(e).catch(n=>{ti(n)||console.error(n)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.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.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isComponentManaged||this.fileContainer==null||typeof t!="function"){for(let{element:n}of this.separatorCache.values())n.remove();this.separatorCache.clear();return}let i=new Map(this.separatorCache);for(let n of e){let o=n.slotName,r=this.separatorCache.get(o);if(r==null||!Gr(n,r.hunkData)){r?.element.remove();let s=document.createElement("div");s.style.display="contents",s.slot=n.slotName;let l=t(n,this);l!=null&&s.appendChild(l),this.fileContainer.appendChild(s),r={element:s,hunkData:n},this.separatorCache.set(o,r)}i.delete(o)}for(let[n,{element:o}]of i.entries())this.separatorCache.delete(n),o.remove()}renderAnnotations(){if(this.isComponentManaged||this.fileContainer==null){for(let{element:n}of this.annotationCache.values())n.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderedData:t,options:{renderAnnotation:i}}=this;if(i!=null&&t!=null){let{fileDiff:n,lineAnnotations:o}=t;for(let[r,s]of o.entries()){let l=this.getAnnotationSlotName(s),a=`${r}-${l}`,u=this.annotationCache.get(a);if(u==null||u.fileDiff!==n||!$r(s,u.annotation)){u?.element.remove();let d=i(s,n);if(d==null)continue;u={element:Wo(l),annotation:s,fileDiff:n},u.element.appendChild(d),this.fileContainer.appendChild(u.element),this.annotationCache.set(a,u)}e.delete(a)}}for(let[n,{element:o}]of e.entries())this.annotationCache.delete(n),o.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;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?.remove(),this.gutterUtilityContent=void 0;return}let i=Vo();i.appendChild(t),this.fileContainer.appendChild(i),this.gutterUtilityContent=i}getOrCreateFileContainer(e,t){let{fileContainer:i}=this,n=e??i??document.createElement("diffs-container"),o=i!==n;return i!=null&&o&&this.editor?.__captureFocusForDOMReplacement(),o&&this.emitPostRender(!0),this.fileContainer=n,i!=null&&o&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),o&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let i of t.children)i instanceof SVGElement?this.spriteSVG??=i:Ki(i)&&i.hasAttribute("data-theme-css")?(this.themeCSSStyle??=i,this.hasAdoptedThemeCSS=!0):Ki(i)&&i.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle??=i,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:"open"});if(this.spriteSVG==null){let i=document.createElement("div");i.innerHTML=_o;let n=i.firstChild;n instanceof SVGElement&&(this.spriteSVG=n)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}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&&(this.editor?.__captureFocusForDOMReplacement(),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&&(t.hasAttribute("data-unified")?this.codeUnified=t:t.hasAttribute("data-deletions")?this.codeDeletions=t:t.hasAttribute("data-additions")&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,i){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:n,html:o,lastRenderedHTML:r}}=this,s=(i!==this.editSession?.diff&&$(n,i)?o:void 0)??Ce(e);if(this.headerCache.html=s,this.headerCache.fileDiff=i,s!==r){let m=document.createElement("div");m.innerHTML=s;let p=m.firstElementChild;if(!(p instanceof HTMLElement))return;this.headerElement!=null?t.shadowRoot?.replaceChild(p,this.headerElement):t.shadowRoot?.prepend(p),this.headerElement=p,this.headerCache.lastRenderedHTML=s}if(this.isComponentManaged)return;let{renderCustomHeader:l,renderHeaderPrefix:a,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d}=this.options;if(l!=null){let m=l(i)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Gt,m),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(i)??void 0,h=u?.(i)??void 0,f=d?.(i)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Wt,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Vt,h),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,$t,f),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,i,n){if(n==null){t?.remove();return}let o=t??this.createHeaderSlotElement(i);return t==null&&e.appendChild(o),this.replaceHeaderSlotContent(o,n),o}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement("div");return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options;this.pre?.toggleAttribute("data-custom-styles",!!e);let t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===""){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=$o(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=jo(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,i,n){let o=e.shadowRoot??e.attachShadow({mode:"open"}),r=n??i,s=this.getTheme(),l=typeof s=="string"?s:{...s},a=Et(o);if(this.themeCSSStyle?.parentNode===o&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===r&&this.appliedThemeCSS.scrollbarGutter===a){this.appliedThemeCSS.theme=l;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===o){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:l,themeStyles:t,themeType:r,baseThemeType:n,scrollbarGutter:a};return}this.themeCSSStyle=ir({shadowRoot:o,currentNode:this.themeCSSStyle,themeCSS:Ko(t,r,a)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:l,themeStyles:t,themeType:r,baseThemeType:n,scrollbarGutter:a}:void 0}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=Xo(this.themeCSSStyle.textContent??"",Et(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Jo()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Yi(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,i){let n=this.getColumnPair(e);if(n==null)return!1;let o=Be(t[0]),r=Be(t[1]);return o==null||r==null?!1:(n.gutter.innerHTML=Ce(o),n.content.innerHTML=Ce(r),i!==this.lastRowCount&&(n.gutter.style.setProperty("grid-row",`span ${i}`),n.content.style.setProperty("grid-row",`span ${i}`)),!0)}replaceCodeColumns(e,t){let{overflow:i="scroll"}=this.options,n=(this.options.hunkSeparators??"line-info")==="line-info",o=i==="wrap"?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let r=!1,s=[],l=this.hunksRenderer.renderCodeAST("unified",t),a=this.hunksRenderer.renderCodeAST("deletions",t),u=this.hunksRenderer.renderCodeAST("additions",t);this.editor?.__captureFocusForDOMReplacement(),l!=null?(r=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=ei({code:this.codeUnified,columnType:"unified",rowSpan:o,containerSize:n}),this.applyCodeColumnsInPlace(this.codeUnified,l,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(l)),s.push(this.codeUnified)):a!=null||u!=null?(a!=null?(r=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=ei({code:this.codeDeletions,columnType:"deletions",rowSpan:o,containerSize:n}),this.applyCodeColumnsInPlace(this.codeDeletions,a,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(a)),s.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),u!=null?(r=r||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=ei({code:this.codeAdditions,columnType:"additions",rowSpan:o,containerSize:n}),this.applyCodeColumnsInPlace(this.codeAdditions,u,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(u)),s.push(this.codeAdditions)):(this.codeAdditions?.remove(),this.codeAdditions=void 0)):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0),s.length===0?e.textContent="":r&&e.replaceChildren(...s),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:i}){let{pre:n,codeUnified:o,codeAdditions:r,codeDeletions:s,options:{diffStyle:l="split"}}=this;if(n==null||t==null||i==null||!Number.isFinite(t.totalLines)||!Number.isFinite(i.totalLines)||this.lastRowCount==null)return!1;let a=this.getCodeColumns(l,o,s,r);if(a==null)return!1;let u=t.startingLine,d=i.startingLine,c=u+t.totalLines,h=d+i.totalLines,f=Math.max(u,d),m=Math.min(c,h);if(m<=f)return!1;let p=Math.max(0,f-u),b=Math.max(0,c-m),S=this.trimColumns({columns:a,trimStart:p,trimEnd:b,previousStart:u,overlapStart:f,overlapEnd:m,diffStyle:l});if(S<0)throw new Error("FileDiff.applyPartialRender: failed to trim to overlap");if(this.lastRowCount<S)throw new Error("FileDiff.applyPartialRender: trimmed beyond DOM row count");let g=this.lastRowCount-S,x=(L,D)=>{if(!(D<=0))return this.hunksRenderer.renderDiff(e,{startingLine:L,totalLines:D,bufferBefore:0,bufferAfter:0})},E=x(d,Math.max(f-d,0));if(E==null&&d<f)return!1;let y=x(m,Math.max(h-m,0));if(y==null&&h>m)return!1;let C=(L,D)=>{if(L!=null){if(l==="unified"&&!Array.isArray(a))this.insertPartialHTML(l,a,L,D);else if(l==="split"&&Array.isArray(a))this.insertPartialHTML(l,a,L,D);else throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");g+=L.rowCount,this.adoptRenderData(L.fileDiff)}};return this.cleanupErrorWrapper(),C(E,"afterbegin"),C(y,"beforeend"),this.lastRowCount!==g&&(this.applyRowSpan(l,a,g),this.lastRowCount=g),!0}insertPartialHTML(e,t,i,n){if(e==="unified"&&!Array.isArray(t)){let o=this.hunksRenderer.renderCodeAST("unified",i);this.renderPartialColumn(t,o,n)}else if(e==="split"&&Array.isArray(t)){let o=this.hunksRenderer.renderCodeAST("deletions",i),r=this.hunksRenderer.renderCodeAST("additions",i);this.renderPartialColumn(t[0],o,n),this.renderPartialColumn(t[1],r,n)}else throw new Error("FileDiff.insertPartialHTML: Invalid argument composition")}refreshSplitDiffView(){let e=this.getWorkingDiff();if(this.options.diffStyle!=="split"||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let i=this.getCodeColumns("split",this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(i))return;let n=(o,r)=>{if(r==null)return;let s=this.hunksRenderer.renderCodeAST(o,t),l=Be(s?.[0]),a=Be(s?.[1]);for(let[u,d]of[[r.gutter,l],[r.content,a]])if(d!=null&&u.childElementCount===d.length)for(let c=0;c<d.length;c++){let h=u.children[c],f=d[c].properties["data-line-type"];f!=null&&h.dataset.lineType!==f&&(h.dataset.lineType=f)}};n("deletions",i[0]),n("additions",i[1]),this.adoptRenderData(t.fileDiff)}refreshUnifiedDiffView(){let e=this.getWorkingDiff();if(this.options.diffStyle!=="unified"||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let i=this.getCodeColumns("unified",this.codeUnified,this.codeDeletions,this.codeAdditions);if(i==null||Array.isArray(i))return;let n=this.hunksRenderer.renderCodeAST("unified",t),o=Be(n?.[0]),r=Be(n?.[1]),s=()=>{for(let[l,a]of[[i.gutter,o],[i.content,r]])a!=null&&(l.innerHTML=Ce(a));t.rowCount!==this.lastRowCount&&(this.applyRowSpan("unified",i,t.rowCount),this.lastRowCount=t.rowCount),this.adoptRenderData(t.fileDiff)};this.shouldGuardRebuildScroll()?Yi(this.pre,s):s(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,i){if(e==null||t==null)return;let n=Be(t[0]),o=Be(t[1]);if(n==null||o==null)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");let r=o.at(0);i==="beforeend"&&r?.type==="element"&&typeof r.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(r.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],n,o,!0);let s=o.at(-1);i==="afterbegin"&&s?.type==="element"&&typeof s.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(s.properties["data-buffer-size"],e.content.children[0],e.gutter.children[0],n,o,!1),e.gutter.insertAdjacentHTML(i,this.hunksRenderer.renderPartialHTML(n)),e.content.insertAdjacentHTML(i,this.hunksRenderer.renderPartialHTML(o))}mergeBuffersIfNecessary(e,t,i,n,o,r){if(!(t instanceof HTMLElement)||!(i instanceof HTMLElement))return;let s=this.getBufferSize(t.dataset);s!=null&&(r?(n.shift(),o.shift()):(n.pop(),o.pop()),this.updateBufferSize(t,s+e),this.updateBufferSize(i,s+e))}applyRowSpan(e,t,i){let n=o=>{o!=null&&(o.gutter.style.setProperty("grid-row",`span ${i}`),o.content.style.setProperty("grid-row",`span ${i}`))};if(e==="unified"&&!Array.isArray(t))n(t);else if(e==="split"&&Array.isArray(t))n(t[0]),n(t[1]);else throw new Error("dun fuuuuked up")}trimColumnRows(e,t,i){let n=0,o=0,r=0,s=!1,l=i>=0;if(e==null)return 0;let a=Array.from(e.content.children),u=Array.from(e.gutter.children);if(a.length!==u.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;r<a.length&&!(t<=0&&!l&&!s);){let d=u[r],c=a[r];if(r++,!(d instanceof HTMLElement)||!(c instanceof HTMLElement))throw console.error({gutterElement:d,contentElement:c}),new Error("FileDiff.trimColumnRows: invalid row elements");if(s&&(s=!1,d.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in c.dataset||d.dataset.gutterBuffer==="metadata"&&"noNewline"in c.dataset)){d.remove(),c.remove(),o++;continue}if("lineIndex"in d.dataset&&"lineIndex"in c.dataset){(t>0||l&&n>=i)&&(d.remove(),c.remove(),t>0&&(t--,t===0&&(s=!0)),o++),n++;continue}if("separator"in d.dataset&&"separator"in c.dataset){(t>0||l&&n>=i)&&(d.remove(),c.remove(),o++);continue}if(d.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in c.dataset){(t>0||l&&n>=i)&&(d.remove(),c.remove(),o++);continue}if(d.dataset.gutterBuffer==="metadata"&&"noNewline"in c.dataset){(t>0||l&&n>=i)&&(d.remove(),c.remove(),o++);continue}if(d.dataset.gutterBuffer==="buffer"&&"contentBuffer"in c.dataset){let h=this.getBufferSize(c.dataset);if(h==null)throw new Error("FileDiff.trimColumnRows: invalid element");if(t>0){let f=Math.min(t,h),m=h-f;m>0?(this.updateBufferSize(d,m),this.updateBufferSize(c,m),o+=f):(d.remove(),c.remove(),o+=h),t-=f,t===0&&m===0&&(s=!0)}else if(l){let f=n,m=n+h-1;if(i<=f)d.remove(),c.remove(),o+=h;else if(i<=m){let p=m-i+1,b=h-p;this.updateBufferSize(d,b),this.updateBufferSize(c,b),o+=p}}n+=h;continue}throw console.error({gutterElement:d,contentElement:c}),new Error("FileDiff.trimColumnRows: unknown row elements")}return o}trimColumns({columns:e,diffStyle:t,overlapEnd:i,overlapStart:n,previousStart:o,trimEnd:r,trimStart:s}){let l=Math.max(0,n-o),a=i-o;if(a<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");let u=s>0,d=r>0;if(!u&&!d)return 0;let c=u?l:0,h=d?a:-1;if(t==="unified"&&!Array.isArray(e))return this.trimColumnRows(e,c,h);if(t==="split"&&Array.isArray(e)){let f=this.trimColumnRows(e[0],c,h),m=this.trimColumnRows(e[1],c,h);if(e[0]!=null&&e[1]!=null&&f!==m)throw new Error("FileDiff.trimColumns: split columns out of sync");return e[0]!=null?f:m}else throw console.error({diffStyle:t,columns:e}),new 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)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],i=e.children[1];if(!(!(t instanceof HTMLElement)||!(i instanceof HTMLElement)||t.dataset.gutter==null||i.dataset.content==null))return{gutter:t,content:i}}getCodeColumns(e,t,i,n){if(e==="unified")return this.getColumnPair(t);{let o=this.getColumnPair(i),r=this.getColumnPair(n);return o!=null||r!=null?[o,r]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore==null&&(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.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter==null&&(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.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:i,totalLines:n},o){let{diffIndicators:r="bars",disableBackground:s=!1,disableLineNumbers:l=!1,overflow:a="scroll",diffStyle:u="split"}=this.options,d={type:"diff",diffIndicators:r,disableBackground:s,disableLineNumbers:l,overflow:a,split:u==="unified"?!1:t!=null&&i!=null,totalLines:n,customProperties:o};Bo(d,this.appliedPreAttributes)||(Qo(e,d),this.appliedPreAttributes=d)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let i=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",i.appendChild(this.errorWrapper);let n=document.createElement("div");n.dataset.errorMessage="",n.innerText=e.message,this.errorWrapper.appendChild(n);let o=document.createElement("pre");o.dataset.errorStack="",o.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(o)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function pl(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join("")}}function Kr(e,t){return e==null||t==null?e==null&&t==null:ri(e,t)}function ml({fileDiff:e,oldFile:t,newFile:i}){return e!=null&&e.hunks.length>0||t!=null||i!=null}function gl({fileDiff:e,oldFile:t,newFile:i}){return e!=null||t!=null||i!=null}function vl(e,t,i=!1){return!i&&e==null&&t}function bl(e,t,i=!1){return e==null&&t&&!i}function Be(e){if(!(e==null||e.type!=="element"))return e.children??[]}function Yr({fileDiff:e,metrics:t,disableFileHeader:i,hunkSeparators:n,expandUnchanged:o,expandedHunks:r,collapsedContextThreshold:s,canHydratePartialDiff:l}){let a=Ke(t,i),u=a,d=o?!0:r,c=e.hunks.length-1;for(let h=0;h<e.hunks.length;h++){let f=e.hunks[h];if(f==null)throw new Error("computeEstimatedDiffHeights: invalid hunk index");let m=ue({isPartial:e.isPartial,rangeSize:f.collapsedBefore,expandedHunks:d,hunkIndex:h,collapsedContextThreshold:s}),p=(m.fromStart+m.fromEnd)*t.lineHeight;if(a+=p,u+=p,m.collapsedLines>0){let g=Je({type:n,metrics:t,hunkIndex:h,hunkSpecs:f.hunkSpecs})?.totalHeight??0;a+=g,u+=g}a+=f.splitLineCount*t.lineHeight,u+=f.unifiedLineCount*t.lineHeight;let b=Sl(f);a+=b.split*t.lineHeight,u+=b.unified*t.lineHeight;let S=h===c?ce({fileDiff:e,hunkIndex:h,expandedHunks:d,collapsedContextThreshold:s,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(S!=null){let g=(S.fromStart+S.fromEnd)*t.lineHeight;if(a+=g,u+=g,S.collapsedLines>0){let x=Oe({type:n,metrics:t})?.totalHeight??0;a+=x,u+=x}}else if(h===c&&e.isPartial&&l){let g=Oe({type:n,metrics:t})?.totalHeight??0;a+=g,u+=g}}if(e.hunks.length>0){let h=oi(t);a+=h,u+=h}return{splitHeight:a,unifiedHeight:u}}function Sl(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type==="context"){let i=t.lines>0?1:0;return{split:i,unified:i}}return yl(e,t)}function yl(e,t){let i=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),n=t.deletions>0&&e.noEOFCRDeletions,o=t.additions>0&&e.noEOFCRAdditions;return{split:n||o?1:0,unified:i}}var ki=3e3,Ei=new Map,Cl=-1,Dn=class extends Xr{__id=`little-virtualized-file-diff:${++Cl}`;renderType="virtualized";top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:Ei,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,i,n,o){super(e,n,o),this.virtualizer=t,this.metrics=ii(i)}setMetrics(e,t=!1){let i=ii(e);!t&&St(this.metrics,i)||(this.metrics=i,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&(this.forceRenderOverride=!0)}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.forceRenderOverride=!0,!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e===t?!1:(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLayoutAnnotations();return No(t)?t.some(i=>i.lineNumber!==0?!1:e.type==="new"?i.side==="additions":e.type==="deleted"?i.side==="deletions":!0):!1}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(e==null)return;let{options:t}=this,i=!ho(t,e),n=i&&Rl(t,e);super.setOptions(e),n&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Tl(t,e)}),i&&(this.forceRenderOverride=!0),i&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,n)}setThemeType(e){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:i=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=Ei,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,i),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:i,ghostTextRows:n,ghostTextRowsByIndex:o},metrics:{lineHeight:r}}=this;if(n===t)return!1;let s=this.getDiffStyle(),l=new Map;for(let[u,d]of t){let c=this.getLineIndexForDiff(e,u+1,"additions");c!=null&&l.set(s==="split"?c[1]:c[0],d)}let a=!1;for(let u of new Set([...o.keys(),...l.keys()])){let d=((l.get(u)??0)-(o.get(u)??0))*r;if(d===0)continue;let c=(i.get(u)??0)+d;c===0?i.delete(u):i.set(u,c),this.cache.measuredHeightDeltaTotal+=d,a=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=l,a}reconcileHeights(){let e=!1,{options:{overflow:t="scroll"},metrics:{lineHeight:i}}=this,n=this.placeHolder!=null?this.getLayoutDiff():this.getRenderedDiff();if(this.fileContainer==null||n==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(n,this.editor?.__getGhostTextRows()??Ei);let{ghostTextRowsByIndex:o}=this.cache,r=t!=="scroll"||this.lineAnnotations.length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!r&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0)return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let s=this.getDiffStyle(),l=s==="split"?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];if(this.renderRange!=null&&Qt(this.renderRange)){let a=xl(l)??0;this.setFileAnnotationHeight(a)&&(e=!0)}for(let a of l){if(a==null)continue;let u=a.children[1];if(!(u instanceof HTMLElement))continue;let d=s==="split"&&a===this.codeDeletions;for(let c of u.children){if(!(c instanceof HTMLElement))continue;let h=c.dataset.lineIndex;if(h==null)continue;let f=Dl(h,s),m=o.get(f)??0;if(d&&m>0)continue;let p=this.cache.heightDeltas.get(f)??0;if(!r&&p===m*i)continue;let b=c.getBoundingClientRect().height+m*i,S=!1;c.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in c.nextElementSibling.dataset||"noNewline"in c.nextElementSibling.dataset)&&("noNewline"in c.nextElementSibling.dataset&&(S=!0),b+=c.nextElementSibling.getBoundingClientRect().height);let g=this.getEstimatedLineHeight(S),x=b-g;x!==p&&(e=!0,this.cache.measuredHeightDeltaTotal+=x-p,x===0?this.cache.heightDeltas.delete(f):this.cache.heightDeltas.set(f,x))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,i,n){let o=!1,r=!1,{pendingExpansions:s,pendingHydratedDiff:l,options:{collapsed:a=!1}}=this;if(l!=null&&(this.pendingHydratedDiff=void 0,l.expectedDiff===e&&(Object.assign(e,l.nextDiff),this.setHydratedState(l.files),this.installHydratedSessionDiff(e),this.forceRenderOverride=!0,o=!0,r=!0)),s!=null){this.pendingExpansions=void 0;for(let{hunkIndex:m,direction:p,expansionLineCountOverride:b}of s)this.hunksRenderer.expandHunk(m,p,b),this.forceRenderOverride=!0,r=!0}let u=this.updateInputDiff(e,n),{pendingRenderDiff:d,layoutDiffChanged:c,renderedDiffChanged:h,annotationsChanged:f}=this.updatePendingRender(e,n);return!this.forceRenderOverride&&(u||h||f)&&(this.forceRenderOverride=!0),(i?.resetDiffLayoutCache===!0||c)&&(o=!0),(c||i?.resetDiffLayoutCache===!0&&i.includeEstimatedDiffHeights)&&(r=!0),i?.metrics!=null&&(this.metrics=ii(i.metrics),o=!0,r=!0),this.currentCollapsed!==a&&(this.currentCollapsed=a,o=!0),o?this.resetLayoutCache({includeEstimatedHeights:r}):r&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,d),this.height}getLinePosition(e,t="additions"){let i=this.getLayoutDiff();if(i==null||e<1)return;let n=this.getLineIndexForDiff(i,e,t);if(n==null)return;let{disableFileHeader:o=!1,expandUnchanged:r=!1,collapsed:s=!1,collapsedContextThreshold:l=1}=this.options,a=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=a==="split"?n[1]:n[0];this.approximateLayoutCheckpoints(i);let c=Ke(this.metrics,o),h=this.getLayoutCheckpointBeforeLineIndex(d),f=h?.top??c+this.cache.fileAnnotationHeight;if(s)return{top:ni(this.metrics,o),height:0};let m;return Ee({diff:i,diffStyle:a,startingLine:h?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:l,callback:({hunkIndex:p,hunk:b,collapsedBefore:S,collapsedAfter:g,deletionLine:x,additionLine:E})=>{let y=a==="split"?E?.splitLineIndex??x?.splitLineIndex:E?.unifiedLineIndex??x?.unifiedLineIndex;if(y==null)throw new Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(S>0){let L=Je({type:u,metrics:this.metrics,hunkIndex:p,hunkSpecs:b?.hunkSpecs});if(L!=null){if(f+=L.gapBefore,d>=y-S&&d<y)return m={top:f,height:L.height},!0;f+=L.height+L.gapAfter}}let C=this.getLineHeight(y,(E?.noEOFCR??!1)||(x?.noEOFCR??!1));if(y===d)return m={top:f,height:C},!0;if(f+=C,g>0){let L=Oe({type:u,metrics:this.metrics});if(L!=null){if(d>y&&d<=y+g)return m={top:f+L.gapBefore,height:L.height},!0;f+=L.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type==="simple"?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:i=!1,expandUnchanged:n=!1,collapsed:o=!1,collapsedContextThreshold:r=1}=this.options;if(o)return;let s=this.getDiffStyle(),l=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let a=this.getLayoutCheckpointBeforeTop(e),u=a?.top??Ke(this.metrics,i)+this.cache.fileAnnotationHeight,d;return Ee({diff:t,diffStyle:s,startingLine:a?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,callback:({hunkIndex:c,hunk:h,collapsedBefore:f,collapsedAfter:m,deletionLine:p,additionLine:b})=>{let S=s==="split"?b?.splitLineIndex??p?.splitLineIndex:b?.unifiedLineIndex??p?.unifiedLineIndex;if(S==null)throw new Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(f>0){let x=Je({type:l,metrics:this.metrics,hunkIndex:c,hunkSpecs:h?.hunkSpecs});x!=null&&(u+=x.totalHeight)}if(u>=e&&(p!=null?d={lineNumber:p.lineNumber,side:"deletions",top:u}:b!=null&&(d={lineNumber:b.lineNumber,side:"additions",top:u}),d!=null))return!0;let g=this.getLineHeight(S,(b?.noEOFCR??!1)||(p?.noEOFCR??!1));if(u+=g,m>0){let x=Oe({type:l,metrics:this.metrics});x!=null&&(u+=x.totalHeight)}return!1}}),d}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let i=e!=null?this.computeRenderRangeFromWindow(t,this.top,e):this.renderRange;if(i==null)return;let{bufferBefore:n,bufferAfter:o,totalLines:r}=i,s=0;if(r===0){let l=e??this.virtualizer.getWindowSpecs();this.top<l.top&&(s=o)}return{topOffset:this.top+n+s,height:this.height-(n+o)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let i=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!$(this.getRenderedDiff(),this.getWorkingDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),i&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,i)=>{this.getInputDiff()!=null&&(this.loadFilesIfNecessary(),this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:i})):(this.hunksRenderer.expandHunk(e,t,i),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.getInputDiff()!==e||!e.isPartial)){if(this.isAdvancedMode()){let i=kt("clone",e,t);if(await Pt(()=>this.primeHighlightCache(i)),this.getInputDiff()!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:i,files:t}}else{if(kt("merge",e,t),this.setHydratedState(t),!this.installHydratedSessionDiff(e)&&(await Pt(()=>this.primeHighlightCache(e)),this.getInputDiff()!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.getInputDiff())return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,i=this.getRenderedDiff();if(t==null||t.length===0||i==null)return!1;let{expansionLineCount:n=100,collapsedContextThreshold:o=1}=this.options,r=new Map(this.hunksRenderer.getExpandedHunksMap());for(let s of t){let l={...r.get(s.hunkIndex)??{fromStart:0,fromEnd:0}},a=s.expansionLineCountOverride??n;(s.direction==="up"||s.direction==="both")&&(l.fromStart+=a),(s.direction==="down"||s.direction==="both")&&(l.fromEnd+=a),r.set(s.hunkIndex,l)}return hi({fileDiff:i,lineNumber:e,expandedHunks:r,collapsedContextThreshold:o})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.getInputDiff()==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.getInputDiff()==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getWorkingDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,!(this.isSimpleMode()&&this.requestRender())&&this.virtualizer.instanceChanged(this,!$(this.getRenderedDiff(),t))}get isComponentManaged(){return this.getAdvancedVirtualizer()?.isComponentManaged??super.isComponentManaged}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e!=null?(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0)):this.getSimpleVirtualizer()?.requestHeightReconcile(this)}applyDocumentChange(e,t,i=!1){let{renderRange:n}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let o=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(i&&n!=null&&o!=null){let r=this.virtualizer.getWindowSpecs(),s=this.computeRenderRangeFromWindow(o,this.top??0,r);s.bufferAfter!==n.bufferAfter&&this.updateBuffers(s)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let i=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!i)return;let n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??Ei);let{disableFileHeader:o=!1,collapsed:r=!1}=this.options;if(r){this.height+=ni(this.metrics,o),this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,i&&!n&&this.validateComputedHeight(t),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getLayoutAnnotations(){let{pendingRender:e}=this;return e!=null?this.getAnnotationsForDiff(e.diff):this.lineAnnotations}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()==="split"?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw new Error("VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height");return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:i=!1,collapsedContextThreshold:n=1}=this.options,{splitHeight:o,unifiedHeight:r}=Yr({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:i,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n,canHydratePartialDiff:An(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=o,this.cache.estimatedUnifiedHeight=r}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height!==this.height?console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:e.name,elementHeight:t.height,computedHeight:this.height}):console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}render({fileContainer:e,fileDiff:t,forceRender:i=!1,lineAnnotations:n,...o}={}){let r=Nt(o,"VirtualizedFileDiff.render"),s=r!=null,l=r?.oldFile,a=r?.newFile,u=s&&(!Zr(l,this.deletionFile)||!Zr(a,this.additionFile)),d=t??this.getInputDiff();t==null&&s&&(u||this.getInputDiff()==null)&&(d=Le(r.oldFile,r.newFile,this.options.parseDiffOptions));let{forceRenderOverride:c,isSetup:h}=this;this.forceRenderOverride=void 0;let f=d!=null&&!$(this.getInputDiff(),d),m=f||u;if(e=this.getOrCreateFileContainer(e),d==null)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;f&&this.updateInputDiff(d,n);let{pendingRenderDiff:p,layoutDiffChanged:b,renderedDiffChanged:S,annotationsChanged:g}=this.pendingRender!=null&&this.pendingRender.workingDiff===(this.getWorkingDiff(d)??d)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(n)}:this.updatePendingRender(d,n);if(b&&this.resetLayoutCache({includeEstimatedHeights:!0}),h)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,p));else{this.computeApproximateSize(!1,p);let C=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(C==null)throw new Error("VirtualizedFileDiff.render: simple virtualizer is not available");C.connect(e,this),this.isVisible=C.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!h))return r!=null&&(this.deletionFile=l,this.additionFile=a),f&&this.clearReusableHeader(),this.renderPlaceholder(this.height);let x=this.virtualizer.getWindowSpecs(),E=this.top??0,y=this.computeRenderRangeFromWindow(p,E,x);return super.render({fileDiff:d,fileContainer:e,renderRange:y,lineAnnotations:n,forceRender:(c??i)||g||S||f,...r,...o})}finalizeRender(){if(!$(this.getRenderedDiff(),this.pendingRender?.diff))throw new Error("VirtualizedFileDiff.render: rendered a different diff than its prepared layout");this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let i=this.getWorkingDiff(e)??e,n=this.getRenderedDiff(),{pendingRender:o}=this,r=o?.diff??n,s=this.hunksRenderer.getDiffForNextRender(i);return this.pendingRender={workingDiff:i,diff:s},{pendingRenderDiff:s,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!$(r,s),renderedDiffChanged:!$(n,s)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type==="simple"}isAdvancedMode(){return this.virtualizer.type==="advanced"}getVirtualizedTop(){return this.virtualizer.type==="advanced"?this.virtualizer.getLocalTopForInstance(this):this.fileContainer!=null?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return this.virtualizer.type==="simple"?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type==="advanced"?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??"split"}getHunkSeparatorType(){return Al(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:i=!1,collapsedContextThreshold:n=1}=this.options,o=e.hunks.length-1,r=An(e,this.options.loadDiffFiles!=null),s=this.getDiffStyle(),l=this.getHunkSeparatorType(),a=i?!0:this.hunksRenderer.getExpandedHunksMap(),u=Ll(this.cache.heightDeltas),d=Ke(this.metrics,t)+this.cache.fileAnnotationHeight,c=0,h=({rowCount:f,startLineIndex:m,preSeparatorHeight:p=0,postSeparatorHeight:b=0,metadataOffsets:S=[]})=>{if(f<=0)return;let g=c,x=c+f,E=El(g);for(;E<x;){let y=E-g,C=d+(y>0?p:0)+y*this.metrics.lineHeight+kl(S,y)*this.metrics.lineHeight+Qr(u,m,m+y);this.cache.checkpoints.push({renderedLineIndex:E,lineIndex:m+y,top:C}),E+=ki}d+=p+f*this.metrics.lineHeight+S.length*this.metrics.lineHeight+Qr(u,m,m+f)+b,c=x};for(let f=0;f<e.hunks.length;f++){let m=e.hunks[f];if(m==null)throw new Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");let p=ue({isPartial:e.isPartial,rangeSize:m.collapsedBefore,expandedHunks:a,hunkIndex:f,collapsedContextThreshold:n}),b=p.collapsedLines>0?Je({type:l,metrics:this.metrics,hunkIndex:f,hunkSpecs:m.hunkSpecs})?.totalHeight??0:0;h({rowCount:p.fromStart,startLineIndex:(s==="split"?m.splitLineStart:m.unifiedLineStart)-p.rangeSize});let S=b;h({rowCount:p.fromEnd,startLineIndex:(s==="split"?m.splitLineStart:m.unifiedLineStart)-p.fromEnd,preSeparatorHeight:S}),p.fromEnd>0&&(S=0);let g=f===o?ce({fileDiff:e,hunkIndex:f,expandedHunks:a,collapsedContextThreshold:n,errorPrefix:"VirtualizedFileDiff"}):void 0,x=g!=null&&g.collapsedLines>0?Oe({type:l,metrics:this.metrics})?.totalHeight??0:f===o&&r?Oe({type:l,metrics:this.metrics})?.totalHeight??0:0,E=g!=null?g.fromStart+g.fromEnd:0,y=s==="split"?m.splitLineCount:m.unifiedLineCount,C=s==="split"?m.splitLineStart:m.unifiedLineStart;h({rowCount:y,startLineIndex:C,preSeparatorHeight:S,postSeparatorHeight:E===0?x:0,metadataOffsets:wl({diffStyle:s,hunk:m,rowCount:y})}),g!=null&&E>0&&h({rowCount:E,startLineIndex:C+y,postSeparatorHeight:x})}this.cache.totalLines=c}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,i=this.cache.checkpoints.length-1,n;for(;t<=i;){let o=t+i>>1,r=this.cache.checkpoints[o];if(r==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");r.lineIndex<=e?(n=r,t=o+1):i=o-1}return n}getLayoutCheckpointBeforeTop(e,t){let i=0,n=this.cache.checkpoints.length-1,o=-1;for(;i<=n;){let r=i+n>>1,s=this.cache.checkpoints[r];if(s==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");s.top<=e?(o=r,i=r+1):n=r-1}if(t==null)return o>=0?this.cache.checkpoints[o]:void 0;for(let r=o;r>=0;r--){let s=this.cache.checkpoints[r];if(s==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");if(s.renderedLineIndex%t===0)return s}}getExpandedLineCount(e,t){let i=0;if(e.isPartial){for(let l of e.hunks)i+=t==="split"?l.splitLineCount:l.unifiedLineCount;return i}let{expandUnchanged:n=!1,collapsedContextThreshold:o=1}=this.options,r=n?!0:this.hunksRenderer.getExpandedHunksMap();for(let[l,a]of e.hunks.entries()){let u=t==="split"?a.splitLineCount:a.unifiedLineCount;i+=u;let d=Math.max(a.collapsedBefore,0),{fromStart:c,fromEnd:h,renderAll:f}=ue({isPartial:e.isPartial,rangeSize:d,expandedHunks:r,hunkIndex:l,collapsedContextThreshold:o});d>0&&(i+=f?d:c+h)}let s=ce({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:o,errorPrefix:"VirtualizedFileDiff"});return s!=null&&(i+=s.fromStart+s.fromEnd),i}getLayoutLineCount(e,t){let i=this.getExpandedLineCount(e,t),n=t==="split"?e.splitLineCount:e.unifiedLineCount;return Math.max(i,n,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:i,bottom:n}){let{disableFileHeader:o=!1,expandUnchanged:r=!1,collapsedContextThreshold:s=1}=this.options,{hunkLineCount:l,lineHeight:a}=this.metrics,u=this.getDiffStyle(),d=this.getHunkSeparatorType(),c=An(e,this.options.loadDiffFiles!=null),h=this.height,f=this.getLayoutLineCount(e,u),m=Ke(this.metrics,o),p=e.hunks.length>0?oi(this.metrics):0,{fileAnnotationHeight:b}=this.cache,S=m+b,g=Math.max(0,h-m-b-p),x=this.hasFileAnnotations(e),E=t+m,y=b>0&&x&&E<n&&E+b>i;if(t<i-h||t>n)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-m-p};if(f<=l||e.hunks.length===0)return{startingLine:0,totalLines:l,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),f=this.getLayoutLineCount(e,u);let C=Math.ceil(Math.max(n-i,0)/a),L=Math.ceil(C/l)*l+l,D=L/l,w=D,R=[],F=(i+n)/2,A=this.getLayoutCheckpointBeforeTop(Math.max(0,i-t-L*a*2),l),T=t+(A?.top??S),O=A?.renderedLineIndex??0,B,I,N;if(Ee({diff:e,diffStyle:u,startingLine:A?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:he,hunk:se,collapsedBefore:We,collapsedAfter:tt,deletionLine:ve,additionLine:ae})=>{let G=ae!=null?ae.splitLineIndex:ve.splitLineIndex,ie=ae!=null?ae.unifiedLineIndex:ve.unifiedLineIndex,ne=(ae?.noEOFCR??!1)||(ve?.noEOFCR??!1),ke=he===e.hunks.length-1&&se!=null&&(u==="split"?G===se.splitLineStart+se.splitLineCount-1:ie===se.unifiedLineStart+se.unifiedLineCount-1),le=(We>0?Je({type:d,metrics:this.metrics,hunkIndex:he,hunkSpecs:se?.hunkSpecs}):void 0)?.totalHeight??0;T+=le;let oe=O%l===0,ye=Math.floor(O/l);if(oe&&(R[ye]=T-(t+S+le),N!=null)){if(N<=0)return!0;N--}let X=this.getLineHeight(u==="split"?G:ie,ne);if(T>i-X&&T<n&&(B??=ye),I==null&&T+X>F&&(I=ye),N==null&&T>=n&&oe&&(N=w),O++,T+=X,tt>0||ke&&c){let Ve=Oe({type:d,metrics:this.metrics});Ve!=null&&(T<n&&T+Ve.totalHeight>i&&(B??=ye),I==null&&T+Ve.totalHeight>F&&(I=ye),T+=Ve.totalHeight)}return!1}}),B==null)if(y)B=0,I=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-m-p};I??=B;let W=Math.round(I-D/2),te=Math.max(0,Math.ceil(f/l)-D),_=Math.max(0,Math.min(W,te)),q=_*l,j=W<0?L+W*l:L,re=R[_]??0,ge=q===0?0:b+re,Me=_+j/l,fe=Me<R.length?g-R[Me]:g-(T-t-S);return{startingLine:q,totalLines:j,bufferBefore:ge,bufferAfter:Math.max(0,fe)}}};function xl(e){let t;for(let i of e){if(i==null)continue;let n=i.children[1];if(n instanceof HTMLElement)for(let o of n.children)o instanceof HTMLElement&&o.dataset.lineAnnotation===Po&&(t=Math.max(t??0,o.getBoundingClientRect().height))}return t}function Ll(e){let t=Array.from(e).sort((r,s)=>r[0]-s[0]),i=[],n=[0],o=0;for(let[r,s]of t)i.push(r),o+=s,n.push(o);return{lineIndexes:i,prefixTotals:n}}function Qr({lineIndexes:e,prefixTotals:t},i,n){if(i>=n||e.length===0)return 0;let o=Jr(e,i);return(t[Jr(e,n)]??0)-(t[o]??0)}function Jr(e,t){let i=0,n=e.length;for(;i<n;){let o=i+n>>1,r=e[o];if(r==null)throw new Error("VirtualizedFileDiff: invalid prefix index");r<t?i=o+1:n=o}return i}function El(e){return Math.ceil(e/ki)*ki}function kl(e,t){let i=0;for(let n of e)n<t&&i++;return i}function wl({diffStyle:e,hunk:t,rowCount:i}){if(i<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let n=t.hunkContent.at(-1);if(n==null)return[];if(n.type==="context")return[i-1];let o=Math.max(n.deletions,n.additions),r=n.deletions+n.additions;if(e==="split")return o>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[i-1]:[];let s=[],l=i-r;return n.deletions>0&&t.noEOFCRDeletions&&s.push(l+n.deletions-1),n.additions>0&&t.noEOFCRAdditions&&s.push(i-1),s}function Rl(e,t){return(e.diffStyle??"split")!==(t.diffStyle??"split")||(e.overflow??"scroll")!==(t.overflow??"scroll")||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??"bars")!==(t.diffIndicators??"bars")||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Tl(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function An(e,t){return e.isPartial&&t&&(e.type==="change"||e.type==="rename-changed")}function Al(e){return typeof e=="function"?"custom":e??"line-info"}function Zr(e,t){return e==null||t==null?e==null&&t==null:ri(e,t)}function Dl(e,t){let[i,n]=e.split(",").map(Number);return t==="split"?n:i}function es(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}var ts=1e3,Hl=ts*4,Il=[0,1e-6,.99999,1],Ml={overscrollSize:ts,intersectionObserverMargin:Hl,resizeDebugging:!1},wi=0,Fl=-1,Hn=class Ie{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++Fl}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;reconcileQueue=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(t){this.config={...Ml,...t}}setup(t,i){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Il,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(i),window.__INSTANCE=this,window.__TOGGLE=()=>{Ie.__STOP?(Ie.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:Ie.__lastScrollPosition}),ee(this.computeRenderRangeAndEmit)):(Ie.__lastScrollPosition=this.getScrollTop(),Ie.__STOP=!0)};for(let[n,o]of this.connectQueue.entries())this.connect(n,o);this.connectQueue.clear(),this.markDOMDirty(),ee(this.computeRenderRangeAndEmit)}}instanceChanged(t,i){this.instancesChanged.add(t),i&&this.markDOMDirty(),ee(this.computeRenderRangeAndEmit)}requestHeightReconcile(t){this.reconcileQueue.add(t),ee(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=Ni({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}getRoot(){return this.root}isInstanceVisible(t,i){let n=this.getScrollTop(),o=this.getHeight(),r=this.config.intersectionObserverMargin,s=n-r,l=n+o+r;return!(t<s-i||t>l)}handleContainerResize=t=>{if(this.root==null)return;let i=!1;for(let n of t){let o=n.borderBoxSize[0].blockSize;this.root instanceof Document?o!==this.scrollHeight&&(this.scrollHeightDirty=!0,i=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:o-wi,newSize:o}),wi=o)):n.target===this.root?o!==this.height&&(this.heightDirty=!0,i=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,i=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:o-wi,newSize:o}),wi=o))}i&&ee(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(t){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),t??=this.root.firstElementChild??void 0,t instanceof HTMLElement&&(this.contentContainer=t,this.resizeObserver?.observe(t))}cleanUp(){qe(this.computeRenderRangeAndEmit),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.reconcileQueue.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.scrollHeightDirty=!0}getOffsetInScrollContainer(t){return this.getScrollTop()+Ot(t,this.getScrollContainerElement())}connect(t,i){if(this.observers.has(t))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(t,i):(this.intersectionObserver.observe(t),this.observers.set(t,i),this.instancesChanged.add(i),this.markDOMDirty(),ee(this.computeRenderRangeAndEmit)),()=>this.disconnect(t)}disconnect(t){let i=this.observers.get(t);this.connectQueue.delete(t),i!=null&&(this.intersectionObserver?.unobserve(t),this.observers.delete(t),this.instancesChanged.delete(i),this.reconcileQueue.delete(i),this.visibleInstances.delete(t)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),ee(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{Ie.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,ee(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{Ie.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,ee(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{Ie.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,ee(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(Ie.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty,i=this.instancesChanged.size>0;if(this.instancesChanged.size===0){let r=Ni({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&es(this.windowSpecs,r)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.reconcileQueue.size===0)return;this.windowSpecs=r}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let n=this.getScrollAnchor(this.height),o=new Set;for(let r of t?this.observers.values():this.visibleInstances.values())r.onRender(t)&&o.add(r);for(let r of this.instancesChanged)o.has(r)||r.onRender(t)&&o.add(r);this.scrollFix(n);for(let r of o)this.reconcileQueue.delete(r),r.reconcileHeights();for(let r of this.reconcileQueue)r.reconcileHeights()&&(i=!0);this.reconcileQueue.clear(),i||=this.instancesChanged.size>0,i&&this.markDOMDirty(),(i||t)&&ee(this.computeRenderRangeAndEmit),o.clear(),this.instancesChanged.clear()};scrollFix(t){if(t==null)return;let i=this.getScrollContainerElement(),{lineIndex:n,lineOffset:o,fileElement:r,fileOffset:s,fileTypeOffset:l}=t;if(n!=null&&o!=null){let u=r.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(u instanceof HTMLElement){let d=Ot(u,i);if(d!==o){let c=d-o;this.applyScrollFix(c)}return}}let a=Ot(r,i);if(l==="top")a!==s&&this.applyScrollFix(a-s);else{let u=a+r.getBoundingClientRect().height;u!==s&&this.applyScrollFix(u-s)}}applyScrollFix(t){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+t,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+t,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(t){let i=this.getScrollContainerElement(),n;for(let[o]of this.visibleInstances.entries()){let r=Ot(o,i),s=r+o.offsetHeight,l,a;s<=0?(l=s,a="bottom"):(l=r,a="top");let u,d;if(s>0&&r<t)for(let h of o.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(h instanceof HTMLElement))continue;let f=h.dataset.lineIndex;if(f==null)continue;let m=Ot(h,i);if(!(m<0)){u=f,d=m;break}}if(n?.lineOffset!=null&&d==null)continue;let c=!1;(n==null||d!=null&&(n.lineOffset==null||d<n.lineOffset)||d==null&&n.lineOffset==null&&(l>=0&&(n.fileOffset<0||l<n.fileOffset)||l<0&&n.fileOffset<0&&l>n.fileOffset))&&(c=!0),c&&(n={fileElement:o,fileTypeOffset:a,fileOffset:l,lineIndex:u,lineOffset:d})}return n}handleIntersectionChange=t=>{this.scrollDirty=!0;for(let{target:i,isIntersecting:n}of t){if(!(i instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");let o=this.observers.get(i);o!=null&&(n&&!this.visibleInstances.has(i)?(o.setVisibility(!0),this.visibleInstances.set(i,o),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(i)&&(o.setVisibility(!1),this.visibleInstances.delete(i),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&ee(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let t=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return t=this.clampScrollTop(t),this.scrollTop=t,t}scrollTo({top:t,behavior:i="auto"}){let{root:n}=this;if(n==null)return;let o=this.clampScrollTop(t);n instanceof Document?window.scrollTo({top:o,behavior:i}):n.scrollTo({top:o,behavior:i}),this.scrollDirty=!0,ee(this.computeRenderRangeAndEmit)}clampScrollTop(t){return Math.max(0,Math.min(t,this.getScrollHeight()-this.getHeight()))}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 Ot(e,t){let i=e.getBoundingClientRect(),n=t?.getBoundingClientRect().top??0;return i.top-n}var In=1500,is={change:"M","rename-pure":"R","rename-changed":"R",new:"A",deleted:"D"},Mn=e=>requestAnimationFrame(()=>requestAnimationFrame(e));function Pl(e){let t=(e.getTime()-Date.now())/1e3,i=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]],[n,o]=i.find(([,r])=>Math.abs(t)>=r)??["second",1];return new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}).format(Math.round(t/o),n)}function rs(e){let t=0,i=0;for(let n of e.hunks)t+=n.additionLines,i+=n.deletionLines;return{added:t,removed:i}}function ns(e){let{added:t,removed:i}=rs(e);return[z("span","added",t?`+${t}`:""),z("span","removed",i?`\u2212${i}`:"")]}function os(e){return z("span",`letter ${is[e.type]}`,is[e.type])}function Nl(e){return e.hunks.flatMap(t=>{let i=t.additionStart,n=t.deletionStart;return t.hunkContent.flatMap(o=>{if(o.type==="context")return i+=o.lines,n+=o.lines,[];let r=o.additions?{id:e.name,lineNumber:i,side:"additions"}:{id:e.name,lineNumber:n,side:"deletions"};return i+=o.additions,n+=o.deletions,[r]})})}function Ol(e,t){for(let i of e.hunks){let n=i.additionStart,o=i.deletionStart;for(let r of i.hunkContent){let s=r.type==="context",l=s?r.lines:r.deletions;if(t>=o&&t<o+l)return s?n+t-o:n+r.additions;n+=s?r.lines:r.additions,o+=l}}}function Fn(e){return`${e.deletionLines.join("")}\0${e.additionLines.join("")}`}async function Pp(e,t,i){let n=e.ovvi,o=z("div");o.id="diff";let r=z("nav","list ovvi-sidebar"),s=z("main","diff"),l=z("div","content"),a=z("p","failure"),u=z("div","placeholder");u.hidden=!0,u.innerHTML='<span class="symbol"></span><h2></h2>';let d=z("div","find");d.hidden=!0,d.innerHTML=`<input class="find-field" placeholder="Filter" aria-label="Filter" spellcheck="false"><span
|
|
166
|
-
class="find-count" role="status"></span><button class="find-icon" aria-label="Close Filter" title="Close"></button>`;let c=d.querySelector("input"),h=d.querySelector(".find-count"),f=z("header","about");l.append(f),s.append(l),o.append(r,s,a,u,d),e.element.append(o);let m,p=[],b=new Map,S=[],g=-1,x="",E=new Map,y=Ii(),C=(y.layout??_e.settings.get("diff-layout"))==="split",L=y.wrap??_e.settings.get("wrap"),D=y.list??_e.settings.get("file-list");r.toggleAttribute("data-closed",!D);let w=new Hn;w.setup(s,l);let R=new WeakMap,F=new IntersectionObserver(v=>N(()=>{for(let k of v){let H=R.get(k.target);!k.isIntersecting||!H||H.near||(H.near=!0,I(H))}}),{root:s,rootMargin:`${In}px 0px`});e.keep(()=>{F.disconnect();for(let v of b.values())v.view?.cleanUp();w.cleanUp()});let A={theme:{dark:"pierre-dark",light:"pierre-light"},themeType:_e.theme.dark?"dark":"light",diffStyle:C?"split":"unified",overflow:le(),lineDiffType:"word",hunkSeparators:"line-info-basic",disableFileHeader:!0,unsafeCSS:`
|
|
167
|
-
:host {
|
|
168
|
-
--diffs-light-bg: transparent !important;
|
|
169
|
-
--diffs-dark-bg: transparent !important;
|
|
170
|
-
--diffs-addition-color-override: var(--finished);
|
|
171
|
-
--diffs-deletion-color-override: var(--error);
|
|
172
|
-
--diffs-modified-color-override: var(--working);
|
|
173
|
-
--diffs-bg-separator-override: transparent;
|
|
174
|
-
}
|
|
175
|
-
[data-line-type=change-addition] {
|
|
176
|
-
--diffs-computed-diff-line-bg: color-mix(in srgb, var(--finished) 10%, transparent) !important;
|
|
177
|
-
}
|
|
178
|
-
[data-line-type=change-deletion] {
|
|
179
|
-
--diffs-computed-diff-line-bg: color-mix(in srgb, var(--error) 10%, transparent) !important;
|
|
180
|
-
}
|
|
181
|
-
[data-line-type=change-addition] [data-diff-span] {
|
|
182
|
-
background-color: color-mix(in srgb, var(--finished) 28%, transparent) !important;
|
|
183
|
-
}
|
|
184
|
-
[data-line-type=change-deletion] [data-diff-span] {
|
|
185
|
-
background-color: color-mix(in srgb, var(--error) 28%, transparent) !important;
|
|
186
|
-
}
|
|
187
|
-
[data-separator] { border-block: 0.5px solid var(--divider) }
|
|
188
|
-
[data-separator-content] { background: none !important; color: var(--dim) }`};function T(v){return{...A,onLineClick:({event:k,lineNumber:H,annotationSide:M})=>{(k.metaKey||k.altKey)&&v.diff.type!=="deleted"&&Me(v.diff.name,M==="additions"?H:Ol(v.diff,H),Ut(k))}}}function O(v){let k=v.diff,H=z("div","file"),M=z("button","disclosure","\u203A");M.ariaLabel="Show or hide the file",M.onclick=()=>ae(k.name,!v.folded);let[V,Y]=Di(k.name),we=z("span","name",V),U=z("span","folder",k.prevName&&k.prevName!==k.name?`from ${k.prevName}`:Y);return H.title=k.name,H.append(M,Hi(k.name),we,U,...ns(k),os(k),B(k)),H}function B(v){let k=z("span","actions"),H=z("label","mark"),M=z("input");if(M.type="checkbox",M.ariaLabel=`Viewed ${v.name}`,M.checked=E.has(v.name),M.onchange=()=>{M.checked?E.set(v.name,Fn(v)):E.delete(v.name),ae(v.name,M.checked),r.querySelector(`[data-id="${CSS.escape(v.name)}"]`)?.classList.toggle("viewed",M.checked)},H.append(M,"Viewed"),k.append(H),v.type!=="deleted"){let V=z("button","open","Open File");V.ariaLabel=`Open ${v.name}`,V.onclick=Y=>Me(v.name,void 0,Ut(Y)),V.oncontextmenu=Y=>{Ai(Y,`${t}/${v.name}`,{})},k.append(V)}return k}function I(v){let k=v.folded||!v.diff.hunks.length;if(v.node.classList.toggle("folded",k),v.lines.hidden=k,v.row.querySelector(".disclosure").classList.toggle("shut",v.folded),!(k||v.view)){if(!v.near){v.lines.style.height=`${(C?v.diff.splitLineCount:v.diff.unifiedLineCount)*20+v.diff.hunks.length*32+16}px`;return}v.lines.style.height="",v.view=new Dn(T(v),w),v.view.render({fileDiff:v.diff,fileContainer:v.lines})}}function N(v){if(!s.scrollTop)return v();let k=s.getBoundingClientRect().top,H=[...b.values()].find(V=>V.node.getBoundingClientRect().bottom>k),M=H?fe(H.node)-s.scrollTop:0;v(),H?.node.isConnected&&(s.scrollTop=H.node.hidden?0:fe(H.node)-M)}function W(v){if(f.replaceChildren(),document.title=v?.subject??"",!v)return;let k=new Date(v.date),H=z("dl"),M=(V,...Y)=>{let we=z("dd");we.append(...Y),H.append(z("dt","",V),we)};M("Author",v.author,z("span","dim",` <${v.email}>`)),M("Date",Pl(k),z("span","dim",` \xB7 ${k.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}`)),M("Commit",_n(v.hash,10)),v.parents.length&&M(v.parents.length>1?"Parents":"Parent",...v.parents.map(V=>{let Y=z("button","hash",V.slice(0,10));return Y.ariaLabel=`Parent ${V}`,Y.onclick=we=>Ti(`${_t(t)} ${V}`,{how:Ut(we,!1),plugin:"git"}),Y.oncontextmenu=we=>{Ai(we,`${_t(t)} ${V}`,{plugin:"git"})},Y})),f.append(z("h1","",v.subject),...v.body?[z("p","body",v.body)]:[],H)}function te(v){m=v,p=rn(m).flatMap(k=>k.files),N(()=>q(p)),j(p),_()}function _(){let v=H=>H.toLowerCase().includes(x);N(()=>{for(let[H,M]of b)M.node.hidden=!v(H)});for(let H of r.querySelectorAll(".row"))H.hidden=!v(H.dataset.id);let k=p.filter(H=>v(H.name));h.textContent=x?String(k.length):"",S=k.flatMap(Nl),re(p.length>0&&!k.length)}function q(v){let k=b,H=[];b=new Map;for(let U of v){let K=k.get(U.name);if(k.delete(U.name),K)if(Fn(K.diff)!==Fn(U)||K.diff.type!==U.type||K.diff.prevName!==U.prevName)K.diff=U,E.delete(U.name)&&(K.folded=!1),H.push(K);else{b.set(U.name,K);continue}else{let{added:Ri,removed:ls}=rs(U),gt=z("section","box");gt.hidden=!U.name.toLowerCase().includes(x),K={diff:U,node:gt,row:gt,lines:document.createElement("diffs-container"),folded:Ri+ls>2e3},R.set(gt,K),F.observe(gt)}K.row=O(K),K.node.replaceChildren(K.row,K.lines),b.set(U.name,K)}for(let[U,K]of k)E.delete(U),F.unobserve(K.node),K.view?.cleanUp();let M=[f,...[...b.values()].map(U=>U.node)];(M.some((U,K)=>l.children[K]!==U)||l.children.length!==M.length)&&l.replaceChildren(...M);for(let U of b.values())I(U);let{top:V,bottom:Y}=s.getBoundingClientRect(),we=[...b.values()].filter(U=>{let{top:K,bottom:Ri}=U.node.getBoundingClientRect();return!U.near&&Ri>V-In&&K<Y+In});for(let U of we)U.near=!0,I(U);for(let U of H)U.view?.render({fileDiff:U.diff,fileContainer:U.lines})}function j(v){let k=z("header","title");k.append(z("h2","","Files"),z("span","count",v.length?String(v.length):"")),r.replaceChildren(k);for(let H of v){let M=z("button",E.has(H.name)?"row viewed":"row");M.dataset.id=H.name;let[V,Y]=Di(H.name);M.append(Hi(H.name),z("span","name",V),z("span","folder",Y),...ns(H),os(H)),M.title=H.name,M.ariaLabel=H.name,M.onclick=()=>G(H.name),r.append(M)}}function re(v){r.hidden=!p.length,u.hidden=(!!p.length||m===void 0)&&!v,u.querySelector("h2").textContent=v?"No matching files":"No changes",u.style.setProperty("--symbol",`var(${On(v?"magnifyingglass":"checkmark.circle")})`),ge()}function ge(){n.controls.set("diff.file-list",{enabled:p.length>0,value:D&&p.length>0})}function Me(v,k,H){Ti(`${t}/${v}`,{how:H,at:k?String(k):void 0})}function fe(v){return v.getBoundingClientRect().top-s.getBoundingClientRect().top+s.scrollTop}let he=0,se=0;s.addEventListener("wheel",()=>he++,{passive:!0}),s.addEventListener("pointerdown",()=>he++);function We(v){let k=b.get(v.id),H=k.folded?void 0:k.view?.getLinePosition(v.lineNumber,v.side);return H?fe(k.lines)+H.top+H.height/2:fe(k.node)}function tt(v){let k=b.get(v.id);if(!k)return;k.folded&&ae(v.id,!1),k.near=!0,I(k);let H=()=>s.scrollTop=We(v)-s.clientHeight/2;H();let M={change:g,moves:he};A.overflow==="wrap"&&Mn(()=>g===M.change&&he===M.moves&&H())}function ve(){S[g]&&tt(S[g])}function ae(v,k){let H=b.get(v);H.folded=k,I(H),k&&fe(H.node)<s.scrollTop&&(s.scrollTop=fe(H.node))}function G(v){let k=b.get(v);k.node.hidden&&zt(),k.folded&&ae(v,!1),s.scrollTop=fe(k.node);let H=V=>p.findIndex(Y=>Y.name===V),M=S.findIndex(V=>H(V.id)>=H(v));g=(M<0?S.length:M)-.5,se=he}n.on("theme",v=>{A.themeType=v.dark?"dark":"light";for(let k of b.values())k.view?.setThemeType(A.themeType)});let ie=zn(async()=>ke(await ne())),ne=()=>_e.git.diff(t,i).catch(v=>v);function ke(v){v instanceof Error?m===void 0&&(a.textContent=v.message):v!==m&&te(v)}function le(){return C||L?"wrap":"scroll"}function oe(v){C=v.split??C,L=v.wrap??L,n.controls.set("diff.wrap",{enabled:!C}),A.diffStyle=C?"split":"unified",A.overflow=le(),N(()=>{for(let k of b.values())k.view?k.view.setOptions(T(k)):I(k)}),Mn(ve)}function ye(v=!0){D=!D,r.toggleAttribute("data-closed",!D),v&&Bt({list:D}),ge(),parseFloat(getComputedStyle(r).transitionDuration)||Mn(ve)}r.addEventListener("transitionend",v=>v.target===r&&v.propertyName==="visibility"&&ve());function X(v){if(!S.length)return;let k=s.scrollTop+32,H=S[g]?We(S[g]):-1;if(se!==he&&(H<=k||H>=s.scrollTop+s.clientHeight)){let V=S.findIndex(Y=>We(Y)>k);g=(V<0?S.length:V)-.5}se=he;let M=v>0?Math.floor(g)+1:Math.ceil(g)-1;g=Math.min(Math.max(M,0),S.length-1),tt(S[g])}function Ve(v){if(v>0&&s.scrollTop>=s.scrollHeight-s.clientHeight-1)return;let k=[...b].filter(([,M])=>!M.node.hidden).map(([M,V])=>({id:M,at:fe(V.node)})),H=v>0?k.find(({at:M})=>M>s.scrollTop+1):k.findLast(({at:M})=>M<s.scrollTop-1);H&&G(H.id)}n.on("control",({id:v,value:k})=>{v==="diff.home"?_e.card.go(_t(t)):v==="diff.layout"?(Bt({layout:String(k)}),oe({split:k==="split"})):v==="diff.wrap"?(Bt({wrap:k===!0}),oe({wrap:k===!0})):v==="diff.file-list"?ye():v==="diff.previous"?X(-1):v==="diff.next"&&X(1)}),n.on("findNext",()=>X(1)),n.on("findPrevious",()=>X(-1)),n.on("find",()=>{d.hidden=!1,c.select(),c.focus()});function zt(){d.hidden=!0,c.value="",c.blur(),Pn()}function Pn(){x!==c.value.toLowerCase()&&(x=c.value.toLowerCase(),g=-1,se=-1,_())}c.oninput=Pn,c.onkeydown=v=>{if(v.key==="Escape")zt();else if(v.key==="Enter")c.blur();else return;v.preventDefault()},d.querySelector("button").onclick=zt;let Nn=v=>{if(!(!e.shown||v.metaKey||v.ctrlKey||v.target===c)){if(v.key==="]")X(1);else if(v.key==="[")X(-1);else if(v.key==="}")Ve(1);else if(v.key==="{")Ve(-1);else if(v.key==="Escape"&&!d.hidden)zt();else return;v.preventDefault()}};document.addEventListener("keydown",Nn),e.keep(()=>document.removeEventListener("keydown",Nn)),n.files.watch(t,()=>(i==="uncommitted"||m===void 0)&&void ie()),ge(),n.controls.set("diff.wrap",{enabled:!C,value:L}),n.controls.set("diff.layout",{value:C?"split":"unified"}),n.on("settings",v=>{let k=Ii();"diff-layout"in v&&k.layout===void 0&&(n.controls.set("diff.layout",{value:String(v["diff-layout"])}),oe({split:v["diff-layout"]==="split"})),"wrap"in v&&k.wrap===void 0&&(n.controls.set("diff.wrap",{value:v.wrap===!0}),oe({wrap:v.wrap===!0})),"file-list"in v&&k.list===void 0&&v["file-list"]===!0!==D&&ye(!1)});let[ss,as]=await Promise.all([ne(),i==="uncommitted"?void 0:_e.git.show(t,i).catch(()=>{}),Pi({themes:[...new Set(Object.values(A.theme))],langs:[]}).catch(console.error)]);W(as),ke(ss),e.at&&p.some(v=>v.name===e.at)&&G(e.at),n.on("place",({at:v})=>v&&p.some(k=>k.name===v)&&G(v))}export{Pp as make};
|
|
189
|
-
//# sourceMappingURL=diff-G67YB4ZU.js.map
|