@moonshot-ai/kimi-code 0.43.0 → 2.0.0
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.mjs +40378 -28041
- package/dist/search-worker.mjs +151 -8
- package/dist-web/assets/{CodeBlockNode-ClI5Zc7C.js → CodeBlockNode-BMkbTGvt.js} +3 -3
- package/dist-web/assets/Tooltip-CvCt2OpS.js +1 -0
- package/dist-web/assets/abnfDiagram-VRR7QNED-CMsWFmhV.js +1 -0
- package/dist-web/assets/arc-CXuu1fyI.js +1 -0
- package/dist-web/assets/architectureDiagram-ZJ3FMSHR-Bb_06Tis.js +36 -0
- package/dist-web/assets/{blockDiagram-677ZJIJ3-CGAoZfe5.js → blockDiagram-677ZJIJ3-dNCVszO9.js} +2 -2
- package/dist-web/assets/{c4Diagram-LMCZKHZV-DLgWFktO.js → c4Diagram-LMCZKHZV-Dsva6pwc.js} +2 -2
- package/dist-web/assets/channel-Dyw0qvA2.js +1 -0
- package/dist-web/assets/{chunk-2Q5K7J3B-D8ifWrnI.js → chunk-2Q5K7J3B-Df_GFe3n.js} +1 -1
- package/dist-web/assets/{chunk-32BRIVSS-DpG03lEd.js → chunk-32BRIVSS-BPgqH-Ub.js} +1 -1
- package/dist-web/assets/{chunk-5VM5RSS4-D5gZPx0N.js → chunk-5VM5RSS4-CUvXVaNK.js} +1 -1
- package/dist-web/assets/{chunk-EX3LRPZG-BHr3M6yM.js → chunk-EX3LRPZG-BRYxwC6w.js} +1 -1
- package/dist-web/assets/{chunk-JWPE2WC7-BxqMRrNb.js → chunk-JWPE2WC7-D24iyGyr.js} +1 -1
- package/dist-web/assets/{chunk-MOJQB5TN-DGD3Ca9J.js → chunk-MOJQB5TN-VIWv47K9.js} +3 -3
- package/dist-web/assets/{chunk-RYQCIY6F-Csv6QbcC.js → chunk-RYQCIY6F-BoueTeQN.js} +1 -1
- package/dist-web/assets/{chunk-V7JOEXUC-DpflSafv.js → chunk-V7JOEXUC-CzjVKRuS.js} +1 -1
- package/dist-web/assets/{chunk-VR4S4FIN-CHAEh_jD.js → chunk-VR4S4FIN-DN3fhyNm.js} +1 -1
- package/dist-web/assets/{chunk-XXDRQBXY-BW4XjZut.js → chunk-XXDRQBXY-DGdcv7YP.js} +1 -1
- package/dist-web/assets/classDiagram-OUVF2IWQ-CdLohFSG.js +1 -0
- package/dist-web/assets/classDiagram-v2-EOCWNBFH-CdLohFSG.js +1 -0
- package/dist-web/assets/cose-bilkent-JH36ORCC-gxrKFGCX.js +1 -0
- package/dist-web/assets/{cynefin-VYW2F7L2-DYKf_Z-v.js → cynefin-VYW2F7L2-D3UUATjS.js} +1 -1
- package/dist-web/assets/cynefinDiagram-TSTJHNR4-O0SkpuqV.js +62 -0
- package/dist-web/assets/dagre-VKFMJZFB-BBTY0HCS.js +4 -0
- package/dist-web/assets/{diagram-FQU43EPY-C1ljmLlO.js → diagram-FQU43EPY-DsY299GE.js} +3 -3
- package/dist-web/assets/diagram-G47NLZAW-nEZgArkk.js +24 -0
- package/dist-web/assets/diagram-NH7WQ7WH-BSozxDpD.js +24 -0
- package/dist-web/assets/{diagram-OA4YK3LP-JUEB_AtR.js → diagram-OA4YK3LP-wQHl6g_d.js} +4 -4
- package/dist-web/assets/diagram-WEI45ONY-Cr-V3eBB.js +41 -0
- package/dist-web/assets/ebnfDiagram-CCIWWBDH-BZW_-ozL.js +1 -0
- package/dist-web/assets/{erDiagram-Q63AITRT-DOSLOW_g.js → erDiagram-Q63AITRT-ma6YVYn1.js} +2 -2
- package/dist-web/assets/{flowDiagram-23GEKE2U-DUMMY9pi.js → flowDiagram-23GEKE2U-BMN1wm6S.js} +5 -5
- package/dist-web/assets/ganttDiagram-NO4QXBWP-ZiopqOWU.js +292 -0
- package/dist-web/assets/gitGraphDiagram-IHSO6WYX-C1RnDoR4.js +106 -0
- package/dist-web/assets/index-0m3MlJDE.js +151 -0
- package/dist-web/assets/index-B3oDj0jz.js +1428 -0
- package/dist-web/assets/{index-Brp-8WTi.js → index-BaplSJn2.js} +2 -2
- package/dist-web/assets/index-BxYISzcB.css +32 -0
- package/dist-web/assets/index-DusVyqlT.js +1033 -0
- package/dist-web/assets/{index10-DApEPd0n.js → index10-c69OEP3n.js} +1 -1
- package/dist-web/assets/{index11-DW3IQa8f.js → index11-Ckocwove.js} +1 -1
- package/dist-web/assets/{index5-COqqDMp9.js → index5-CvyQMVP4.js} +1 -1
- package/dist-web/assets/{index6-Dsp2NXNw.js → index6-BuCtox9U.js} +1 -1
- package/dist-web/assets/{index7-BRjOZjxG.js → index7-1944MZMc.js} +1 -1
- package/dist-web/assets/{index8-CrWWf7aj.js → index8-NUHwiS2h.js} +1 -1
- package/dist-web/assets/infoDiagram-FWYZ7A6U-Dvk0xdbs.js +2 -0
- package/dist-web/assets/{ishikawaDiagram-FXEZZL3T-B6KrpWbv.js → ishikawaDiagram-FXEZZL3T-DIq5ziHd.js} +4 -4
- package/dist-web/assets/{journeyDiagram-5HDEW3XC-JJbVJr8m.js → journeyDiagram-5HDEW3XC-BpYVPIMv.js} +2 -2
- package/dist-web/assets/{kanban-definition-HUTT4EX6-CeRZEVYd.js → kanban-definition-HUTT4EX6-BB6BytMt.js} +7 -7
- package/dist-web/assets/{linear-DPKx2NhO.js → linear-1b2KM_9_.js} +1 -1
- package/dist-web/assets/{mermaid.core-CgZTgv7Y.js → mermaid.core-DKNppTOJ.js} +12 -12
- package/dist-web/assets/{mindmap-definition-LN4V7U3C-Bd7aLAJp.js → mindmap-definition-LN4V7U3C-C2b0YpzO.js} +3 -3
- package/dist-web/assets/pegDiagram-2B236MQR-D6XtaX9M.js +1 -0
- package/dist-web/assets/pieDiagram-ENE6RG2P-CXk1aHpm.js +39 -0
- package/dist-web/assets/{quadrantDiagram-ABIIQ3AL-Bss2swqr.js → quadrantDiagram-ABIIQ3AL-_FP1pK7z.js} +4 -4
- package/dist-web/assets/railroadDiagram-RFXS5EU6-Dej7t1gg.js +1 -0
- package/dist-web/assets/{requirementDiagram-TGXJPOKE-BXFV4Te6.js → requirementDiagram-TGXJPOKE-BVF_sI9y.js} +3 -3
- package/dist-web/assets/sankeyDiagram-HTMAVEWB-BvrUbLRY.js +40 -0
- package/dist-web/assets/{sequenceDiagram-DBY2YBRQ-DyUTbMwM.js → sequenceDiagram-DBY2YBRQ-6chaE5cg.js} +4 -4
- package/dist-web/assets/sizeCapture-X5ZJPWSS-DvaC1t8J.js +1 -0
- package/dist-web/assets/stateDiagram-2N3HPSRC-D3xhTeeN.js +1 -0
- package/dist-web/assets/stateDiagram-v2-6OUMAXLB-C3BdpWyH.js +1 -0
- package/dist-web/assets/swimlanes-5IMT3BWC-BrUot17m.js +2 -0
- package/dist-web/assets/swimlanesDiagram-G3AALYLV-cfjcvW6J.js +8 -0
- package/dist-web/assets/{timeline-definition-FHXFAJF6-Blm9HJcK.js → timeline-definition-FHXFAJF6-waBA9ygA.js} +4 -4
- package/dist-web/assets/{vennDiagram-L72KCM5P-BhpzFpgZ.js → vennDiagram-L72KCM5P-z8BamcaO.js} +2 -2
- package/dist-web/assets/{vue.runtime.esm-bundler-BeN4Xi6a.js → vue.runtime.esm-bundler-Dcq6t2KV.js} +1 -1
- package/dist-web/assets/{wardleyDiagram-EHGQE667-DGcHOZD9.js → wardleyDiagram-EHGQE667-B1ypaFQi.js} +2 -2
- package/dist-web/assets/{xychartDiagram-FW5EYKEG---3Lbwvl.js → xychartDiagram-FW5EYKEG-CWMxWJzt.js} +2 -2
- package/dist-web/index.html +2 -2
- package/native/darwin/prebuilds/darwin-arm64/{darwin-modifiers.node → darwin-platform.node} +0 -0
- package/native/darwin/prebuilds/darwin-x64/{darwin-modifiers.node → darwin-platform.node} +0 -0
- package/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
- package/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
- package/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
- package/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
- package/package.json +8 -7
- package/dist-web/assets/Tooltip-Dvr1al-t.js +0 -1
- package/dist-web/assets/_commonjsHelpers-CqkleIqs.js +0 -1
- package/dist-web/assets/abnfDiagram-VRR7QNED-CwBLQmjz.js +0 -1
- package/dist-web/assets/arc-CxZ33vix.js +0 -1
- package/dist-web/assets/architectureDiagram-ZJ3FMSHR-CM71RpvG.js +0 -36
- package/dist-web/assets/channel-IY5GdLm-.js +0 -1
- package/dist-web/assets/classDiagram-OUVF2IWQ-CqrT8Lg9.js +0 -1
- package/dist-web/assets/classDiagram-v2-EOCWNBFH-CqrT8Lg9.js +0 -1
- package/dist-web/assets/cose-bilkent-JH36ORCC-BdAGtrTa.js +0 -1
- package/dist-web/assets/cynefinDiagram-TSTJHNR4-BtxdUqIq.js +0 -62
- package/dist-web/assets/dagre-VKFMJZFB-4bDkTcg2.js +0 -4
- package/dist-web/assets/diagram-G47NLZAW-Dr4-bBys.js +0 -24
- package/dist-web/assets/diagram-NH7WQ7WH-Cj9RyKgp.js +0 -24
- package/dist-web/assets/diagram-WEI45ONY-t5xRZNwv.js +0 -41
- package/dist-web/assets/ebnfDiagram-CCIWWBDH-DCeAYlnS.js +0 -1
- package/dist-web/assets/ganttDiagram-NO4QXBWP-NYl4Z3R4.js +0 -292
- package/dist-web/assets/gitGraphDiagram-IHSO6WYX-EeKfrgej.js +0 -106
- package/dist-web/assets/index-7SHxad1A.js +0 -962
- package/dist-web/assets/index-CBLflN6S.js +0 -153
- package/dist-web/assets/index-CI2T7J0T.js +0 -1428
- package/dist-web/assets/index-CRa2d3RK.css +0 -32
- package/dist-web/assets/infoDiagram-FWYZ7A6U-DaH4t3R3.js +0 -2
- package/dist-web/assets/pegDiagram-2B236MQR-CX4fQesk.js +0 -1
- package/dist-web/assets/pieDiagram-ENE6RG2P-DiFeh11k.js +0 -39
- package/dist-web/assets/railroadDiagram-RFXS5EU6-Dpqal8U_.js +0 -1
- package/dist-web/assets/rive-BTwUD7iz.js +0 -1
- package/dist-web/assets/rive-CeXCFBdn.js +0 -20
- package/dist-web/assets/rive_fallback-DXpHVJvQ.js +0 -1
- package/dist-web/assets/sankeyDiagram-HTMAVEWB-BHcMCK_w.js +0 -40
- package/dist-web/assets/sizeCapture-X5ZJPWSS-KpJKp6ok.js +0 -1
- package/dist-web/assets/stateDiagram-2N3HPSRC-B9WRkRTB.js +0 -1
- package/dist-web/assets/stateDiagram-v2-6OUMAXLB-DaA_2kTJ.js +0 -1
- package/dist-web/assets/swimlanes-5IMT3BWC-C0-5MIxj.js +0 -2
- package/dist-web/assets/swimlanesDiagram-G3AALYLV-DMbj4GHb.js +0 -8
- package/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
|
@@ -1,1428 +0,0 @@
|
|
|
1
|
-
import{t as pe,b as Ln,n as Or,c as Nr,a as Fr,d as zr,s as Ur,g as Vr,e as Br}from"./index-CBLflN6S.js";import{f as Ld}from"./index-CBLflN6S.js";import{bR as k}from"./index-7SHxad1A.js";const Ei="diffs-container",$r=(()=>{try{return!1}catch{return!1}})(),Wr=/(?=^From [a-f0-9]+ .+$)/m,Ti=/(?=^diff --git)/gm,Ul=/(?=^---\s+\S)/gm,Vl=/(?=^@@ )/gm,Gr=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,jr=/(?<=\n)/,qr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Kr=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Yr=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Xr=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Bl=/^<{7,}(?:\s.*)?$/,$l=/^\|{7,}(?:\s.*)?$/,Wl=/^={7,}$/,Gl=/^>{7,}(?:\s.*)?$/,on="header-prefix",sn="header-metadata",an="header-custom",_={dark:"pierre-dark",light:"pierre-light"},Ii="data-theme-css",Ri="data-unsafe-css",Qr="data-core-css",Jr="data-diffs-scrollbar-measure",Ai="--diffs-scrollbar-gutter-measured",jl=1,Zr=1e5,ln={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},_e={...ln,hunkLineCount:1},eo={paddingTop:8,paddingBottom:8,gap:8},to={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},no=Object.freeze({fromStart:0,fromEnd:0}),Ae={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Hi={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Ie=new Set;let Re=null;function Y(e){Ie.add(e),Re??=requestAnimationFrame(Mi)}function io(e){Ie.delete(e),Ie.size===0&&Re!=null&&(cancelAnimationFrame(Re),Re=null)}function Mi(e){const t=new Set(Ie);Ie.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Ie.size>0?Re=requestAnimationFrame(Mi):Re=null}function He(e,t,n){if(e===t||e==null||t==null)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const s of r)if(o.delete(s),!i.has(s)&&(!(s in t)||e[s]!==t[s]))return!1;for(const s of Array.from(o))if(!i.has(s))return!1;return!0}function De(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function dn(e,t){const n=e?.theme??_,i=t?.theme??_,r=kn(e),o=kn(t);return De(n,i)&&He(e,t,["theme","parseDiffOptions"])&&He(r,o)}function kn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function Wt(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Gt({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:i=!1,fitPerfectlyOverscroll:r=0,overscrollSize:o}){const s=n+o*2,l=i?n+r*2:s;if(t=Math.max(t,l),s>=t||i){const h=Math.max(e-r,0),c=Math.min(e+l,t);return{top:h,bottom:Math.max(c,h)}}let a=e+n/2-s/2,d=a+s;return a<0&&(a=0),d>t&&(d=t),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(d,t),a))}}function ro(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function W(e){return{type:"text",value:e}}function A({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function pt({name:e,width:t=16,height:n=16,properties:i}){return A({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[A({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function oo(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function Ee(e){return A({tagName:"div",properties:{"data-gutter":""},children:e})}function Di(e,t,n,i={}){return A({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[A({tagName:"span",properties:{"data-line-number-content":""},children:[W(`${t}`)]})]:void 0})}function j(e,t,n){return A({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function so(){return A({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[pt({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function ao(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}var Pi=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:"idle"};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.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.renderedSelectionRange=void 0}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,t){const n=!(e===this.selectedRange||Wt(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!n||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const 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=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&i==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&et(e.composedPath())||(he(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:s=!1}=this.options;t==="disabled"&&!s&&n==null&&i==null&&r==null&&o==null||(he(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:t}=this.options;if(he(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){he(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}){const{__debugPointerEvents:n}=this.options,i=t.composedPath();he(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);he(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:d,onTokenEnter:h,onTokenLeave:c,onHunkExpand:u,onMergeConflictActionClick:f}=this.options;switch(e){case"move":{const g=Tt(r)&&this.hoveredLine?.lineElement===r.lineElement;ut(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),ut(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),h?.(this.hoveredToken,t))),g||(this.hoveredLine!=null&&(a?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Tt(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(co(r)&&f!=null){f(r);break}if(ho(r)&&u!=null){u(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!Tt(r))break;ut(r)&&d!=null&&d(this.toTokenEventBaseProps(r),t);const g=this.toEventBaseProps(r);s!=null&&r.numberColumn?s({...g,event:t}):o?.({...g,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:d,onHunkExpand:h,onMergeConflictActionClick:c,enableGutterUtility:u=!1,enableLineSelection:f=!1,onGutterUtilityClick:g}=this.options,b=g!=null,y=n!=="disabled"||i!=null||r!=null||o!=null||s!=null||l!=null||a!=null||d!=null||h!=null||c!=null||u||f||b;y&&!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,he(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const C=[];return(t==="both"||t==="click")&&(i!=null&&C.push("onLineClick"),r!=null&&C.push("onLineNumberClick"),h!=null&&C.push("expandable hunk separators"),c!=null&&C.push("merge conflict actions")),C})()),he(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),he(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!y&&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);const m=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",p=this.pointerSession.mode==="gutterSelecting";(!f&&m||!b&&p)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=e!=null,r=t!=null||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&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;const t=e.composedPath();et(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(n==null)return;const{pre:i}=this;if(i==null)return;const{lineNumber:r,eventSide:o,lineIndex:s}=n;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const 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(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};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:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;if(n==null)return;const i=this.currentSelectionEnds(),r=i?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),o=i?.top??r;r==null||o==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:o,current:r},t&&(this.selectionAnchor={lineNumber:o.lineNumber,side:o.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{const{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;this.updateSelection(n.lineNumber,n.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;const i={lineNumber:n.lineNumber,side:n.eventSide};if(ao(this.pointerSession.pending,i))return;this.updateSelection(n.lineNumber,n.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(this.pointerSession.current=i,t&&this.updateSelection(i.lineNumber,i.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),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.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.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){const{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){const t=document.createElement("div");t.innerHTML=pe(so());const n=t.firstElementChild;if(!(n instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");n.remove(),this.gutterUtilityButton=n}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);Ve(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const 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(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(!(i==null||r==null))return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const n=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(Ze(r));if(Ve(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}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){const n=this.resolvePointerTarget(e);if(Ve(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode==="diff"?n.side:void 0}}resolveSelectionInfo(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(Ve(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const i=this.pathFromCoordinates(e,n);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){const n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&et(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=Ze(e);if(t&&et(n))return;const i=fo(e);return i!=null?Ze(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=go(po(e));if(t==null)return;const n=this.targetForSelectionPoint(t);return n!=null?Ze(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),n=En(t)?t:En(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:n}=this.options;return n!=null?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,s=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(s,e,o,t)}Wt(i??void 0,r??void 0)||(this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&i!=null?{start:t?n[1]:n[0],end:t?i[1]:i[0]}:void 0}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;const e=this.pre.querySelectorAll("[data-selected-line]");for(const l of e)l.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;const{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const n=this.pre.getAttribute("data-diff-type")==="split",i=this.getIndexesFromSelection(this.selectedRange,n);if(i==null)throw console.error({rowRange:i,selectedRange:this.selectedRange}),new Error("InteractionManager.renderSelection: No valid rowRange");const r=i.start===i.end,o=Math.min(i.start,i.end),s=Math.max(i.start,i.end);for(const l of t){const[a,d]=l.children,h=d.children.length;if(h!==a.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let c=0;c<h;c++){const u=d.children[c],f=a.children[c];if(!(u instanceof HTMLElement)||!(f instanceof HTMLElement))continue;const g=this.parseLineIndex(u,n);if((g??0)>s)break;if(g==null||g<o)continue;let b=r?"single":g===o?"first":g===s?"last":"";u.setAttribute("data-selected-line",b),f.setAttribute("data-selected-line",b),f.nextSibling instanceof HTMLElement&&u.nextSibling instanceof HTMLElement&&(u.nextSibling.hasAttribute("data-line-annotation")||u.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(r?(b="last",u.setAttribute("data-selected-line","first")):g===o?b="":g===s&&u.setAttribute("data-selected-line",""),u.nextSibling.setAttribute("data-selected-line",b),f.nextSibling.setAttribute("data-selected-line",b))}}};notifySelectionCommitted(){this.options.onLineSelected?.(this.getCurrentSelectionRange()??null)}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:n,side:i,tokenElement:r,tokenText:o}){return this.mode==="file"?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:r,tokenText:o}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,i){return{start:e,end:t,...n!=null?{side:n}:{},...n!==i&&i!=null?{endSide:i}:{}}}resolvePointerTarget(e){let t=!1,n,i,r,o,s,l,a,d,h,c;for(const f of e){if(!(f instanceof HTMLElement))continue;if(c==null&&f.hasAttribute("data-merge-conflict-action")){const m=f.getAttribute("data-merge-conflict-action")??void 0,p=f.getAttribute("data-merge-conflict-conflict-index")??void 0,C=p!=null?Number.parseInt(p,10):NaN;uo(m)&&Number.isFinite(C)&&(c={kind:"merge-conflict-action",resolution:m,conflictIndex:C})}if(l==null&&f.hasAttribute("data-char")){l=f;const m=f.getAttribute("data-char");if(m!=null){const p=Number.parseInt(m,10);if(!Number.isNaN(p)){const C=f.textContent??"",v=p+C.length;(C.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(a={tokenElement:l,lineCharStart:p,lineCharEnd:v,tokenText:C});continue}}}const g=s==null?f.getAttribute("data-column-number")??void 0:void 0;if(g!=null){s=f,h=Number.parseInt(g,10),t=!0,n=In(f),o=f.getAttribute("data-line-index")??void 0;continue}const b=r==null?f.getAttribute("data-line")??void 0:void 0;if(b!=null){r=f,h=Number.parseInt(b,10),n=In(f),o=f.getAttribute("data-line-index")??void 0;continue}if(d==null&&(f.hasAttribute("data-expand-button")||f.hasAttribute("data-unmodified-lines"))){d={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}const y=d!=null?f.getAttribute("data-expand-index")??void 0:void 0;if(d!=null&&y!=null){const m=Number.parseInt(y,10);Number.isNaN(m)||(d.hunkIndex=m);continue}if(i==null&&f.hasAttribute("data-code")){i=f;break}}if(c!=null)return c;if(d?.hunkIndex!=null)return{type:"line-info",hunkIndex:d.hunkIndex,direction:d.direction,all:d.all};if(r??=o!=null?wn(i,`[data-line][data-line-index="${o}"]`):void 0,s??=o!=null?wn(i,`[data-column-number][data-line-index="${o}"]`):void 0,i==null||r==null||s==null||n==null||h==null||Number.isNaN(h))return;const u=this.parseLineIndex(r,this.isSplitDiff());return a!=null?this.mode==="file"?{kind:"token",lineType:n,lineElement:r,lineNumber:h,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:u,...a}:{kind:"token",lineType:n,lineElement:r,lineNumber:h,numberColumn:t,numberElement:s,side:Tn(n,i),splitLineIndex:u,...a}:this.mode==="file"?{kind:"line",lineType:n,lineElement:r,lineNumber:h,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:u}:{kind:"line",lineType:n,lineElement:r,lineNumber:h,numberColumn:t,numberElement:s,side:Tn(n,i),splitLineIndex:u}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,t){const n=(e.getAttribute("data-line-index")??"").split(",").map(i=>Number.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Ke({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,renderGutterUtility:c,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:g,onLineSelected:b,onLineSelectionStart:y,onLineSelectionChange:m,onLineSelectionEnd:p},C,v,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:lo({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:C,onMergeConflictActionClick:x,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:g,onLineSelected:b,onLineSelectionStart:y,onLineSelectionChange:m,onLineSelectionEnd:p,getLineIndex:v}}function lo({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function Ve(e){return e!=null&&"kind"in e&&e.kind==="line"}function ut(e){return e!=null&&"kind"in e&&e.kind==="token"}function Tt(e){return Ve(e)||ut(e)}function ho(e){return"type"in e&&e.type==="line-info"}function co(e){return"kind"in e&&e.kind==="merge-conflict-action"}function uo(e){return e==="current"||e==="incoming"||e==="both"}function wn(e,t){const n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Ze(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function fo(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function po(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const n=e.getAttribute("name")??void 0;return n!=null&&n.startsWith("annotation-")?n:void 0}}function go(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function En(e){return e!=null&&typeof e.elementFromPoint=="function"}function Tn(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function In(e){const 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 et(e){for(const 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}function he(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if(t!=="click")return;break;case"move":if(t!=="move")return;break}console.log(...n)}var _i=class ue{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const t=ue.resizeObserver??new ResizeObserver(ue.handleSharedResizeEntries);return ue.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=ue.managersByElement.get(i.target);if(r==null)continue;const o=n.get(r);o==null?n.set(r,[i]):o.push(i)}for(const[i,r]of n)i.handleResizeEntries(r)}observedNodes=new Map;setup(t,n){const i=new Set;let r=0;const o=new Map(this.observedNodes);this.observedNodes.clear();for(const s of t.children){if(r===2)break;const l=(()=>{if(s instanceof HTMLElement&&s.tagName==="CODE")return s})();if(l==null)continue;r++;let a=o.get(l);if(a!=null&&a.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let d=l.firstElementChild;d instanceof HTMLElement||(d=null),a!=null?(this.observedNodes.set(l,a),o.delete(l),a.numberElement!==d?(a.numberElement!=null&&(this.unobserve(a.numberElement),o.delete(a.numberElement)),d!=null&&(this.observe(d),o.delete(d),this.observedNodes.set(d,a)),a.numberElement=d,a.numberWidth=0):a.numberElement!=null?(o.delete(a.numberElement),this.observedNodes.set(a.numberElement,a)):a.numberWidth=0):(a={type:"code",codeElement:l,numberElement:d,codeWidth:"auto",numberWidth:0},this.observedNodes.set(l,a),this.observe(l),d!=null&&(this.observedNodes.set(d,a),this.observe(d)))}if(r>1&&!n){const s=t.querySelectorAll('[data-line-annotation*=","]'),l=new Map;for(const a of s){if(!(a instanceof HTMLElement))continue;const d=a.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(d)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:d,element:a});continue}let h=l.get(d);h==null&&(h=[],l.set(d,h)),h.push(a)}for(const[a,d]of l){if(d.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",a,d);continue}const[h,c]=d,u=h.firstElementChild,f=c.firstElementChild;if(!(h instanceof HTMLElement)||!(c instanceof HTMLElement)||!(u instanceof HTMLElement)||!(f instanceof HTMLElement))continue;let g=o.get(u);if(g!=null){this.observedNodes.set(u,g),this.observedNodes.set(f,g),o.delete(u),o.delete(f);continue}const b=u.getBoundingClientRect().height,y=f.getBoundingClientRect().height;g={type:"annotations",column1:{container:h,child:u,childHeight:b},column2:{container:c,child:f,childHeight:y},currentHeight:"auto"},i.add({child1:u,child2:f,item:g,newHeight:Math.max(b,y)})}for(const a of i)this.applyNewHeight(a.item,a.newHeight),this.observedNodes.set(a.child1,a.item),this.observedNodes.set(a.child2,a.item),this.observe(a.child1),this.observe(a.child2);i.clear()}for(const[s,l]of o)this.unobserve(s),l.type==="code"?bo(l):Co(l);o.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=ue,i=n.get(t);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),ue.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=ue,r=n.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),ue.resizeObserver=void 0)}}handleResizeEntries(t){const n=new Map,i=new Set;for(const r of t){const{target:o,borderBoxSize:s,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const a=this.observedNodes.get(o);if(a==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(a.type==="annotations"){const d=(()=>{if(o===a.column1.child)return a.column1;if(o===a.column2.child)return a.column2})();if(d==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:o});continue}d.childHeight=s[0].blockSize,i.add(a)}else if(a.type==="code"){const d=n.get(a)??{},h=l[0].inlineSize;o===a.codeElement?d.codeInlineSize=h:o===a.numberElement&&(d.numberInlineSize=h),n.set(a,d)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(t){for(const n of t)this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight))}applyColumnUpdates=t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?mo(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?vo(i.numberInlineSize):n.numberWidth,s=r!==n.codeWidth,l=o!==n.numberWidth;if(!(!s&&!l)&&(n.codeWidth=r,n.numberWidth=o,s&&n.codeElement.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),l&&n.codeElement.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),s||l&&r!=="auto")){const a=typeof r=="number"?Math.max(r-o,0):0;n.codeElement.style.setProperty("--diffs-column-content-width",`${a>0?`${a}px`:"auto"}`)}}};applyNewHeight(t,n){n!==t.currentHeight&&(t.currentHeight=Math.max(n,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 mo(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function vo(e){return Math.max(Math.ceil(e),0)}function bo(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width"))}function Co(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")}const Se=new Map,It=new Map,jt=new Map,gt=new Set;function mt(e){for(const t of Array.isArray(e)?e:[e])if(!(t==="text"||t==="ansi")&&!gt.has(t))return!1;return!0}function Rn(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(gt.has(n.name))continue;let i=Se.get(n.name);i==null&&(i=n,Se.set(n.name,i)),gt.add(i.name),t.loadLanguageSync(i.data)}}function So(){Se.clear(),gt.clear()}function Oi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function Ni(e){if(Oi())throw new Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const t=It.get(e);if(t!=null)return t;try{let n=jt.get(e);if(n==null&&Object.prototype.hasOwnProperty.call(Ln,e)&&(n=Ln[e]),n==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const i=n().then(({default:r})=>{const o={name:e,data:r};return Se.has(e)||Se.set(e,o),o});return It.set(e,i),await i}finally{It.delete(e)}}function Fi(e){return Se.get(e)??Ni(e)}const vt=new Set;function Ye(e){const t=[],n=new Set;for(const c of yo(e.themes)){const u=zi(c)?c.getThemes():[c];for(const f of u){if(n.has(f.name))throw new Error(`Theme collection already contains theme "${f.name}"`);n.add(f.name),t.push(f)}}const i=Object.freeze([...t]),r=Object.freeze(i.filter(c=>c.colorScheme==="light")),o=Object.freeze(i.filter(c=>c.colorScheme==="dark")),s=new Map(i.map(c=>[c.name,c])),l=Object.freeze(i.map(c=>c.name)),a=Object.freeze(r.map(c=>c.name)),d=Object.freeze(o.map(c=>c.name));function h(c){if(c==null)return i;const{colorScheme:u,collection:f}=c;return f==null?u==="light"?r:u==="dark"?o:i:i.filter(g=>g.collection!==f?!1:u==null||g.colorScheme===u)}return{getTheme(c){return s.get(c)},getThemes(c){return h(c)},getThemeNames(c){return c?.collection==null?c?.colorScheme==="light"?a:c?.colorScheme==="dark"?d:l:h(c).map(u=>u.name)},hasTheme(c){return s.has(c)},orderBy(c){return Ye({themes:i.map((u,f)=>({descriptor:u,index:f})).sort((u,f)=>{const g=c(u.descriptor,f.descriptor);return g!==0?g:u.index-f.index}).map(u=>u.descriptor)})},pick(c){const u=[],f=new Set;for(const g of c){if(f.has(g))throw new Error(`Theme collection pick already includes theme "${g}"`);f.add(g);const b=s.get(g);if(b==null)throw new Error(`Theme collection does not contain theme "${g}"`);u.push(b)}return Ye({themes:u})},registerInto(c){for(const u of i)c.registerThemeIfAbsent(u.name,u.load)}}}function yo(e){return xo(e)?[e]:e}function xo(e){return zi(e)||Lo(e)}function Lo(e){return typeof e.name=="string"&&typeof e.load=="function"}function zi(e){return typeof e.getThemes=="function"}function Ui(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var Vi=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},ko=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},wo=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function Eo(){const e=new Map,t=new Map,n=new Map;let i=0;function r(m,p){if(e.has(m))throw new Vi(m);e.set(m,p)}function o(m,p){return e.has(m)?!1:(e.set(m,p),!0)}function s(m){return e.has(m)}function l(m){const p=t.get(m);if(p!==void 0)return Promise.resolve(p);const C=n.get(m);if(C!==void 0)return C;const v=e.get(m);if(v===void 0)return Promise.reject(new ko(m));const x=i,S=v().then(L=>{const E=Ui(L);return x===i&&t.set(m,E),n.get(m)===S&&n.delete(m),E}).catch(L=>{throw n.get(m)===S&&n.delete(m),L});return n.set(m,S),S}function a(m){return Promise.all(m.map(p=>l(p)))}function d(m,p){t.set(m,p)}function h(m){for(const[p,C]of m)d(p,C)}function c(m){return t.get(m)}function u(m){const p=[];for(const C of m){const v=t.get(C);if(v===void 0)throw new wo(C);p.push(v)}return p}function f(m){return t.has(m)}function g(m){for(const p of m)if(!t.has(p))return!1;return!0}function b(m){const p=t.get(m);return p!==void 0?p:l(m)}function y(){i++,t.clear(),n.clear()}return{clearResolvedThemes:y,getResolvedOrResolveTheme:b,getResolvedTheme:c,getResolvedThemes:u,hasRegisteredTheme:s,hasResolvedTheme:f,hasResolvedThemes:g,registerTheme:r,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:d,seedResolvedThemes:h}}const X=Eo();function An(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let i;if(typeof n=="string"){if(i=X.getResolvedTheme(n),i==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else i=n,n=n.name,X.getResolvedTheme(n)==null&&X.seedResolvedTheme(n,i);vt.has(n)||(vt.add(n),t.loadThemeSync(i))}}function To(){X.clearResolvedThemes(),vt.clear()}function hn({name:e,load:t,colorScheme:n,collection:i,displayName:r}){return{name:e,colorScheme:n,collection:i,displayName:r,load:Io(t)}}function Io(e){return async()=>Or(Ui(await e()))}const Ro="pierre",Ao=["pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],Bi=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],Ho=[...Bi,...Ao],Mo=new Set(Bi);function Do(e){return Mo.has(e)?"light":"dark"}const Po={"pierre-dark":"Pierre Dark","pierre-dark-soft":"Pierre Dark Soft","pierre-dark-vibrant":"Pierre Dark Vibrant","pierre-dark-protanopia-deuteranopia":"Pierre Dark Protanopia & Deuteranopia","pierre-dark-tritanopia":"Pierre Dark Tritanopia","pierre-light":"Pierre Light","pierre-light-soft":"Pierre Light Soft","pierre-light-vibrant":"Pierre Light Vibrant","pierre-light-protanopia-deuteranopia":"Pierre Light Protanopia & Deuteranopia","pierre-light-tritanopia":"Pierre Light Tritanopia"},_o={"pierre-dark":()=>k(()=>import("./pierre-dark-CyvmCCZW.js"),[]),"pierre-dark-soft":()=>k(()=>import("./pierre-dark-soft-BHGpRqa4.js"),[]),"pierre-dark-vibrant":()=>k(()=>import("./pierre-dark-vibrant-BWBVywrn.js"),[]),"pierre-dark-protanopia-deuteranopia":()=>k(()=>import("./pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js"),[]),"pierre-dark-tritanopia":()=>k(()=>import("./pierre-dark-tritanopia-Beq2gCRQ.js"),[]),"pierre-light":()=>k(()=>import("./pierre-light-480U9XYS.js"),[]),"pierre-light-soft":()=>k(()=>import("./pierre-light-soft-CVdyfjmI.js"),[]),"pierre-light-vibrant":()=>k(()=>import("./pierre-light-vibrant-DdTDNdfJ.js"),[]),"pierre-light-protanopia-deuteranopia":()=>k(()=>import("./pierre-light-protanopia-deuteranopia-CaVOBURG.js"),[]),"pierre-light-tritanopia":()=>k(()=>import("./pierre-light-tritanopia-B4_gpKOM.js"),[])};function Oo(e){return hn({name:e,collection:Ro,colorScheme:Do(e),displayName:Po[e],load:_o[e]})}const $i=Ye({themes:Ho.map(e=>Oo(e))}),No="shiki",Wi=["ayu-light","catppuccin-latte","everforest-light","github-light","github-light-default","github-light-high-contrast","gruvbox-light-hard","gruvbox-light-medium","gruvbox-light-soft","horizon-bright","kanagawa-lotus","light-plus","material-theme-lighter","min-light","night-owl-light","one-light","rose-pine-dawn","slack-ochin","snazzy-light","solarized-light","vitesse-light"],Fo=["andromeeda","aurora-x","ayu-dark","ayu-mirage","catppuccin-frappe","catppuccin-macchiato","catppuccin-mocha","dark-plus","dracula","dracula-soft","everforest-dark","github-dark","github-dark-default","github-dark-dimmed","github-dark-high-contrast","gruvbox-dark-hard","gruvbox-dark-medium","gruvbox-dark-soft","horizon","houston","kanagawa-dragon","kanagawa-wave","laserwave","material-theme","material-theme-darker","material-theme-ocean","material-theme-palenight","min-dark","monokai","night-owl","nord","one-dark-pro","plastic","poimandres","red","rose-pine","rose-pine-moon","slack-dark","solarized-dark","synthwave-84","tokyo-night","vesper","vitesse-black","vitesse-dark"],zo=new Set(Wi);function Uo(e){return zo.has(e)?"light":"dark"}const Vo={andromeeda:()=>k(()=>import("./andromeeda-C4gqWexZ.js"),[]),"aurora-x":()=>k(()=>import("./aurora-x-D-2ljcwZ.js"),[]),"ayu-dark":()=>k(()=>import("./ayu-dark-DYE7WIF3.js"),[]),"ayu-light":()=>k(()=>import("./ayu-light-BA47KaF1.js"),[]),"ayu-mirage":()=>k(()=>import("./ayu-mirage-32ctXXKs.js"),[]),"catppuccin-frappe":()=>k(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]),"catppuccin-latte":()=>k(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]),"catppuccin-macchiato":()=>k(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]),"catppuccin-mocha":()=>k(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]),"dark-plus":()=>k(()=>import("./dark-plus-C3mMm8J8.js"),[]),dracula:()=>k(()=>import("./dracula-BzJJZx-M.js"),[]),"dracula-soft":()=>k(()=>import("./dracula-soft-BXkSAIEj.js"),[]),"everforest-dark":()=>k(()=>import("./everforest-dark-BgDCqdQA.js"),[]),"everforest-light":()=>k(()=>import("./everforest-light-C8M2exoo.js"),[]),"github-dark":()=>k(()=>import("./github-dark-DHJKELXO.js"),[]),"github-dark-default":()=>k(()=>import("./github-dark-default-Cuk6v7N8.js"),[]),"github-dark-dimmed":()=>k(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]),"github-dark-high-contrast":()=>k(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]),"github-light":()=>k(()=>import("./github-light-DAi9KRSo.js"),[]),"github-light-default":()=>k(()=>import("./github-light-default-D7oLnXFd.js"),[]),"github-light-high-contrast":()=>k(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]),"gruvbox-dark-hard":()=>k(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]),"gruvbox-dark-medium":()=>k(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]),"gruvbox-dark-soft":()=>k(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]),"gruvbox-light-hard":()=>k(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]),"gruvbox-light-medium":()=>k(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]),"gruvbox-light-soft":()=>k(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]),horizon:()=>k(()=>import("./horizon-BUw7H-hv.js"),[]),"horizon-bright":()=>k(()=>import("./horizon-bright-CUuTKBJd.js"),[]),houston:()=>k(()=>import("./houston-DnULxvSX.js"),[]),"kanagawa-dragon":()=>k(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]),"kanagawa-lotus":()=>k(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]),"kanagawa-wave":()=>k(()=>import("./kanagawa-wave-DWedfzmr.js"),[]),laserwave:()=>k(()=>import("./laserwave-DUszq2jm.js"),[]),"light-plus":()=>k(()=>import("./light-plus-B7mTdjB0.js"),[]),"material-theme":()=>k(()=>import("./material-theme-D5KoaKCx.js"),[]),"material-theme-darker":()=>k(()=>import("./material-theme-darker-BfHTSMKl.js"),[]),"material-theme-lighter":()=>k(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]),"material-theme-ocean":()=>k(()=>import("./material-theme-ocean-CyktbL80.js"),[]),"material-theme-palenight":()=>k(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]),"min-dark":()=>k(()=>import("./min-dark-CafNBF8u.js"),[]),"min-light":()=>k(()=>import("./min-light-CTRr51gU.js"),[]),monokai:()=>k(()=>import("./monokai-D4h5O-jR.js"),[]),"night-owl":()=>k(()=>import("./night-owl-C39BiMTA.js"),[]),"night-owl-light":()=>k(()=>import("./night-owl-light-CMTm3GFP.js"),[]),nord:()=>k(()=>import("./nord-Ddv68eIx.js"),[]),"one-dark-pro":()=>k(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]),"one-light":()=>k(()=>import("./one-light-C3Wv6jpd.js"),[]),plastic:()=>k(()=>import("./plastic-3e1v2bzS.js"),[]),poimandres:()=>k(()=>import("./poimandres-CS3Unz2-.js"),[]),red:()=>k(()=>import("./red-bN70gL4F.js"),[]),"rose-pine":()=>k(()=>import("./rose-pine-qdsjHGoJ.js"),[]),"rose-pine-dawn":()=>k(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]),"rose-pine-moon":()=>k(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]),"slack-dark":()=>k(()=>import("./slack-dark-BthQWCQV.js"),[]),"slack-ochin":()=>k(()=>import("./slack-ochin-DqwNpetd.js"),[]),"snazzy-light":()=>k(()=>import("./snazzy-light-Bw305WKR.js"),[]),"solarized-dark":()=>k(()=>import("./solarized-dark-DXbdFlpD.js"),[]),"solarized-light":()=>k(()=>import("./solarized-light-L9t79GZl.js"),[]),"synthwave-84":()=>k(()=>import("./synthwave-84-CbfX1IO0.js"),[]),"tokyo-night":()=>k(()=>import("./tokyo-night-hegEt444.js"),[]),vesper:()=>k(()=>import("./vesper-DRje8inN.js"),[]),"vitesse-black":()=>k(()=>import("./vitesse-black-Bkuqu6BP.js"),[]),"vitesse-dark":()=>k(()=>import("./vitesse-dark-D0r3Knsf.js"),[]),"vitesse-light":()=>k(()=>import("./vitesse-light-CVO1_9PV.js"),[])};function Hn(e){return hn({name:e,collection:No,colorScheme:Uo(e),load:Vo[e]})}const Gi=Ye({themes:Object.freeze([...Wi.map(e=>Hn(e)),...Fo.map(e=>Hn(e))])});Ye({themes:[$i,Gi]});function ji(e){if(Oi())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(X.hasRegisteredTheme(e))return;const t=Gi.getTheme(e);if(t!=null){X.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function qi(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Bo(e){ji(e);const t=await X.resolveTheme(e);return qi(e,t),t}function $o(e){return X.getResolvedTheme(e)??Bo(e)}let $;async function xt({themes:e,langs:t,preferredHighlighter:n="shiki-js"}){$??=Nr({themes:[],langs:["text"],engine:n==="shiki-wasm"?Fr(k(()=>import("./wasm-CG6Dc4jp.js"),[])):zr()});const i=Wo($)?await $:$;$=i;const r=[];for(const s of t){if(s==="text"||s==="ansi")continue;const l=Fi(s);"then"in l?r.push(l):Rn(l,i)}const o=[];for(const s of e){const l=$o(s);"then"in l?o.push(l):An(l,$)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(s=>{Rn(s,i)}),Promise.all(o).then(s=>{An(s,i)})]),i}function ql(e=$){return e!=null&&!("then"in e)}function Ki(){if($!=null&&!("then"in $))return $}function Wo(e=$){return e!=null&&"then"in e}function Kl(e=$){return e==null}async function Yl(e){await xt(e)}async function Xl(){$!=null&&((await $).dispose(),So(),To(),$=void 0)}for(const e of $i.getThemes())X.registerThemeIfAbsent(e.name,e.load);function cn(e=_){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Ge(e){for(const t of cn(e))if(!vt.has(t))return!1;return!0}function Go(e){return X.hasResolvedThemes(e)}function Oe(e,t){return De(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function ae(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Lt(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 qt(e){return A({tagName:"div",children:[A({tagName:"div",children:e.annotations?.map(t=>A({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function jo(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 Yi({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return A({tagName:"div",children:[t==="custom"?A({tagName:"slot",properties:{name:an}}):qo({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...t==="custom"?[]:[Ko(i)]],properties:r})}function qo({name:e,prevName:t,iconType:n}){const i=[A({tagName:"slot",properties:{name:on}}),pt({name:jo(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(A({tagName:"div",children:[A({tagName:"bdi",children:[W(t)]})],properties:{"data-prev-name":""}})),i.push(pt({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(A({tagName:"div",children:[A({tagName:"bdi",children:[W(e)]})],properties:{"data-title":""}})),A({tagName:"div",children:i,properties:{"data-header-content":""}})}function Ko(e){const t=[];if(e!=null){let n=0,i=0;for(const r of e.hunks)n+=r.additionLines,i+=r.deletionLines;(i>0||n===0)&&t.push(A({tagName:"span",children:[W(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(A({tagName:"span",children:[W(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(A({tagName:"slot",properties:{name:sn}})),A({tagName:"div",children:t,properties:{"data-metadata":""}})}function Xi(e){return A({tagName:"pre",properties:Yo(e)})}function Yo({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?r?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}const Z=new Map;let bt=0;const Ne={"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","🔥":"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",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",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",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:"文言",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 Q(e){if(Z.has(e))return Z.get(e)??"text";if(Ne[e]!=null)return Ne[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Z.has(t[1]))return Z.get(t[1])??"text";if(Ne[t[1]]!=null)return Ne[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return Z.has(n)?Z.get(n)??"text":Ne[n]??"text"}function Ql(e,t){if(e<=bt)return!1;Z.clear();for(const n in t){const i=t[n];i!=null&&Z.set(n,i)}return bt=e,!0}function Jl(){return bt}function Xo(e,t){const n=Z.get(e);return n===t?!1:(n!=null&&console.warn(`setCustomExtension: overriding custom mapping for "${e}" from "${n}" to "${t}"`),Z.set(e,t),bt++,!0)}function Zl(){return Object.fromEntries(Z)}function un(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:cn(t),preferredHighlighter:n}}function ge(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function xe(e){return e.replace(/\n$|\r\n$/,"")}function Qo(e,t,n){const i=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(i==null){const r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),new Error(r)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,e.children.length===0&&e.children.push(W(`
|
|
2
|
-
`)),e}const tt=Symbol("no-token"),Rt=Symbol("multiple-tokens");function Qi(e){const t=Jo(e);if(t!=null)return t;let n=tt;const i=[];let r=[],o;const s=()=>{if(r.length===0||o==null){r=[],o=void 0;return}if(r.length===1){const a=r[0];if(a?.type==="element"){Zo(a,o);for(const d of a.children)ft(d)}else ft(a);i.push(a),r=[],o=void 0;return}for(const a of r)ft(a);i.push(A({tagName:"span",properties:{"data-char":o},children:r})),r=[],o=void 0},l=a=>{if(a!==tt){if(a===Rt){n=Rt;return}if(n===tt){n=a;return}n!==a&&(n=Rt)}};for(const a of e.children){const d=a.type==="element"?Qi(a):tt;if(l(d),typeof d!="number"){s(),i.push(a);continue}o!=null&&o!==d&&s(),o??=d,r.push(a)}return s(),e.children=i,n}function Jo(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function ft(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)ft(t)}}function Zo(e,t){e.properties["data-char"]=t}function es(e={}){const{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:i=l=>l}=e,r=new Map;function o(l){return Object.entries(l).map(([a,d])=>`${a}:${d}`).join(";")}function s(l){let a=t+ts(typeof l=="string"?l:o(l))+n;return a=i(a),r.has(a)||r.set(a,typeof l=="string"?l:{...l}),a}return{name:"@shikijs/transformers:style-to-class",pre(l){if(!l.properties.style)return;const a=s(l.properties.style);delete l.properties.style,this.addClassToHast(l,a)},tokens(l){for(const a of l)for(const d of a){if(!d.htmlStyle)continue;const h=s(d.htmlStyle);d.htmlStyle={},d.htmlAttrs||={},d.htmlAttrs.class?d.htmlAttrs.class+=` ${h}`:d.htmlAttrs.class=h}},getClassRegistry(){return r},getCSS(){let l="";for(const[a,d]of r.entries())l+=`.${a}{${typeof d=="string"?d:o(d)}}`;return l},clearRegistry(){r.clear()}}}function ts(e,t=0){let n=3735928559^t,i=1103547991^t;for(let r=0,o;r<e.length;r++)o=e.charCodeAt(r),n=Math.imul(n^o,2654435761),i=Math.imul(i^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&i)+(n>>>0)).toString(36).slice(0,6)}function Ji(e=!1,t=!1){const n={lineInfo:[]},i=[{line(r){return delete r.properties.class,r},pre(r){const o=oo(r),s=[];if(o!=null){let l=1;for(const a of o.children)a.type==="element"&&(e&&Qi(a),s.push(Qo(a,l,n)),l++);o.children=s}return r},...e?{tokens(r){for(const o of r){let s=0;for(const l of o){const a=l;a.__lineChar??=s,s+=l.content.length}}},preprocess(r,o){o.mergeWhitespaces="never"},span(r,o,s,l,a){if(a?.offset!=null&&a.content!=null){const d=a.__lineChar;return d!=null&&(r.properties["data-char"]=d),r}return r}}:null}];return t&&i.push(ns,Mn),{state:n,transformers:i,toClass:Mn}}const Mn=es({classPrefix:"hl-"}),ns={name:"token-style-normalizer",tokens(e){for(const t of e)for(const n of t){if(n.htmlStyle!=null)continue;const i={};n.color!=null&&(i.color=n.color),n.bgColor!=null&&(i["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(i["font-style"]="italic"),(n.fontStyle&2)!==0&&(i["font-weight"]="bold"),(n.fontStyle&4)!==0&&(i["text-decoration"]="underline")),Object.keys(i).length>0&&(n.htmlStyle=i)}}};function B(e){return`--${e==="token"?"diffs-token":"diffs"}-`}const is=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,rs=/^0(?:\.0+)?%?$/;function os(e){const t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;const n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const i=e.slice(t+1,-1).trim();if(i.length===0)return;const r=i.lastIndexOf("/");if(r!==-1)return i.slice(r+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=i.split(",");if(o.length===4)return o[3]?.trim()}}function ss(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;const n=t[1];let i,r=1;return n.length===3?i=n.split("").map(o=>o+o).join(""):n.length===6?i=n:(i=n.slice(0,6),r=parseInt(n.slice(6,8),16)/255),[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),r]}function At(e){if(e==null)return null;const t=ss(e);if(t==null)return null;const n=t[0]/255,i=t[1]/255,r=t[2]/255,o=s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(i)+.0722*o(r)}function Dn(e){if(e==null)return!1;const t=e.trim().toLowerCase();if(t==="transparent"||is.test(t))return!0;const n=os(t);return n!=null&&rs.test(n)}function as(e,t,n){if(t==null||n==null)return!1;const i=At(e),r=At(t),o=At(n);return i==null||r==null||o==null?!1:Math.abs(i-o)<Math.abs(i-r)}const Pn=new WeakMap;function Ht(e){const t=Pn.get(e);if(t!=null)return t;const n=e.colors??{},i={...n},r=n["editor.background"]??e.bg,o=n["editor.foreground"]??e.fg,s=n["sideBar.background"]??r,l=n["sideBar.foreground"]??o;ie(i,"editor.background",r),ie(i,"editor.foreground",o),ie(i,"sideBar.background",s),ie(i,"sideBar.foreground",l),ie(i,"input.background",n["input.background"]??s),ie(i,"sideBarSectionHeader.foreground",n["sideBarSectionHeader.foreground"]??l),ie(i,"list.activeSelectionForeground",n["list.activeSelectionForeground"]??l),ie(i,"gitDecoration.addedResourceForeground",Mt(n["gitDecoration.addedResourceForeground"],n["terminal.ansiGreen"],n["editorGutter.addedBackground"])),ie(i,"gitDecoration.modifiedResourceForeground",Mt(n["gitDecoration.modifiedResourceForeground"],n["terminal.ansiBlue"],n["editorGutter.modifiedBackground"])),ie(i,"gitDecoration.deletedResourceForeground",Mt(n["gitDecoration.deletedResourceForeground"],n["terminal.ansiRed"],n["editorGutter.deletedBackground"]));const a=(Dn(n["list.focusOutline"])?void 0:n["list.focusOutline"])??(Dn(n.focusBorder)?void 0:n.focusBorder);a!=null?i["list.focusOutline"]=a:delete i["list.focusOutline"];const d=n["list.hoverBackground"];d!=null&&(ls(d,s)||as(d,s,l))&&delete i["list.hoverBackground"];const h=Object.freeze({...e,colors:Object.freeze(i)});return Pn.set(e,h),h}function ie(e,t,n){n!=null&&n!==""&&(e[t]=n)}function Mt(...e){for(const t of e)if(t!=null&&t!=="")return t}function ls(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function fn({theme:e=_,highlighter:t,prefix:n}){let i="";if(typeof e=="string"){const r=t.getTheme(e),o=Ht(r);i+=`color:${o.fg};`,i+=`background-color:${o.bg};`,i+=`${B("global")}fg:${o.fg};`,i+=`${B("global")}bg:${o.bg};`,i+=Dt(r,n)}else{let r=t.getTheme(e.dark),o=Ht(r);i+=`${B("global")}dark:${o.fg};`,i+=`${B("global")}dark-bg:${o.bg};`,i+=Dt(r,"dark"),r=t.getTheme(e.light),o=Ht(r),i+=`${B("global")}light:${o.fg};`,i+=`${B("global")}light-bg:${o.bg};`,i+=Dt(r,"light")}return i}function Dt(e,t){t=t!=null?`${t}-`:"";let n="";const i=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];i!=null&&(n+=`${B("global")}${t}addition-color:${i};`);const r=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];r!=null&&(n+=`${B("global")}${t}deletion-color:${r};`);const o=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${B("global")}${t}modified-color:${o};`),n}function Kt(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t.children;"children"in t?t=t.children[0]:t=null}throw console.error(e),new Error("getLineNodes: Unable to find children")}function Ct({lines:e,startingLine:t=0,totalLines:n=1/0,callback:i}){const r=Math.min(t+n,e.length),o=(()=>{const s=e.at(-1);return s===""||s===`
|
|
3
|
-
`||s===`\r
|
|
4
|
-
`||s==="\r"?Math.max(0,e.length-2):e.length-1})();for(let s=t;s<r;s++){const l=s===o;if(i({lineIndex:s,lineNumber:s+1,content:e[s],isLastLine:l})===!0||l)break}}function St(e){return e!==""?e.split(jr):[]}const ds={forcePlainText:!1};function hs(e,t,{theme:n=_,tokenizeMaxLineLength:i,useTokenTransformer:r},{forcePlainText:o,startingLine:s,totalLines:l,lines:a}=ds){o?(s??=0,l??=1/0):(s=0,l=1/0);const d=s>0||l<1/0,{state:h,transformers:c}=Ji(r),u=o?"text":e.lang??Q(e.name),f=typeof n=="string"?t.getTheme(n).type:void 0,g=fn({theme:n,highlighter:t});h.lineInfo=p=>({type:"context",lineIndex:p-1+s,lineNumber:p+s});const b=typeof n=="string"?{lang:u,theme:n,transformers:c,defaultColor:!1,cssVariablePrefix:B("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0}:{lang:u,themes:n,transformers:c,defaultColor:!1,cssVariablePrefix:B("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0},y=Kt(t.codeToHast(d?cs(a??St(e.contents),s,l):xe(e.contents),b)),m=d?new Array(s):y;return d&&m.push(...y),{code:m,themeStyles:g,baseThemeType:f}}function cs(e,t,n){let i="";return Ct({lines:e,startingLine:t,totalLines:n,callback({content:r}){i+=r}}),i}const Zi="-1,-1";function Yt(e){return e?.some(t=>t.lineNumber===0)??!1}function Xt(e){const t=e[0];return t!=null&&t.length>0?t:void 0}function kt(e){return e.startingLine===0&&e.totalLines>0}function er(e,t){return A({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${t}`}})}function Qt(e){return(e.lang??Q(e.name))==="text"}function tr(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}let us=-1;var fs=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++us}`;highlighter;renderCache;computedLang="text";lineAnnotations={};lineCache;constructor(e={theme:_},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Ge(e.theme??_)?Ki():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(const t of e){const n=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=n,n.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0}clearRenderCache(){this.renderCache=void 0}hydrate(e){const{options:t}=this.getRenderOptions(e),n=Pt(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());let i=this.workerManager?.getFileResultCache(e);i!=null&&!Oe(t,i.options)&&(i=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!Qt(e),result:n?void 0:i?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter==null&&(this.computedLang=e.lang??Q(e.name),this.initializeHighlighter())}getRenderOptions(e){const t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();const{theme:i=_,tokenizeMaxLineLength:r=1e3}=this.options;return{theme:i,useTokenTransformer:tr(this.options),tokenizeMaxLineLength:r}})(),{renderCache:n}=this;return n?.result==null?{options:t,forceHighlight:!0}:!ae(e,n.file)||!Oe(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){if(e.cacheKey==null)return this.lineCache=void 0,St(e.contents);let{lineCache:t}=this;return(t==null||t.cacheKey!==e.cacheKey)&&(t={cacheKey:e.cacheKey,lines:St(e.contents)}),this.lineCache=t,t.lines}renderFile(e=this.renderCache?.file,t=Ae){if(e==null)return;let{options:n,forceHighlight:i}=this.getRenderOptions(e);const r=this.getMatchingWorkerResultCache(e,n);r!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...r},i=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};const o=this.getOrCreateLineCache(e),s=e.contents.length>0,l=!s||Qt(e)||Pt(o.length,this.getTokenizeMaxLength()),a=!ae(e,this.renderCache.file),d=!Lt(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(l||this.renderCache.result==null||!this.renderCache.highlighted&&(a||d))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||a||d||i)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,o)),this.renderCache.renderRange=t),!l&&s&&(!this.renderCache.highlighted||i)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??Q(e.name);const h=this.highlighter!=null&&Ge(n.theme),c=this.highlighter!=null&&mt(this.computedLang),u=!l&&c;if(this.highlighter!=null&&h&&(i||l||!this.renderCache.highlighted&&u||this.renderCache.result==null)){const{result:f,options:g}=this.renderFileWithHighlighter(e,this.highlighter,l||!c);this.renderCache={file:e,options:g,highlighted:u,result:f,renderRange:void 0}}(!h||!l&&!c)&&this.asyncHighlight(e).then(({result:f,options:g})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,f,g,!l)})}return this.renderCache.result!=null?this.processFileResult(this.renderCache.file,t,this.renderCache.result):void 0}async asyncRender(e,t=Ae){const{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){const t=Pt(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?"text":e.lang??Q(e.name);const n=this.highlighter!=null&&Go(cn(this.options.theme)),i=t||this.highlighter!=null&&mt(this.computedLang);return(this.highlighter==null||!n||!i)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e);return{result:hs(e,t,i,{forcePlainText:n}),options:i}}processFileResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){const{disableFileHeader:o=!1}=this.options,s=[],l=Ee(),a=this.getOrCreateLineCache(e);let d=0;const h=kt(t)?Xt(this.lineAnnotations):void 0;return h!=null&&(l.children.push(j("context","annotation",1)),s.push(qt({hunkIndex:-1,lineIndex:-1,annotations:h.map(c=>ge(c))})),d++),Ct({lines:a,startingLine:t.startingLine,totalLines:t.totalLines,callback:({lineIndex:c,lineNumber:u})=>{const f=n[c];if(f==null){const g="FileRenderer.processFileResult: Line doesnt exist";throw console.error(g,{name:e.name,lineIndex:c,lineNumber:u,lines:a}),new Error(g)}if(f!=null){l.children.push(Di("context",u,`${c}`)),s.push(f),d++;const g=this.lineAnnotations[u];g!=null&&(l.children.push(j("context","annotation",1)),s.push(qt({hunkIndex:0,lineIndex:u,annotations:g.map(b=>ge(b))})),d++)}}}),l.properties.style=`grid-row: span ${d}`,{gutterAST:l.children??[],contentAST:s,preAST:this.createPreElement(a.length),headerAST:o?void 0:this.renderHeader(e),totalLines:a.length,rowCount:d,themeStyles:i,baseThemeType:r,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderHeader(e){const{headerRenderMode:t="default",stickyHeader:n=!1}=this.options;return Yi({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return pe(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(A({tagName:"code",children:this.renderCodeAST(e),properties:{"data-code":""}})),{...e.preAST,children:t}}renderCodeAST(e){const t=Ee();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,er(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return t?pe(A({tagName:"code",children:e,properties:{"data-code":""}})):pe(e)}async initializeHighlighter(){return this.highlighter=await xt(un(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n,i=!0){if(this.renderCache==null)return;const r=!ae(e,this.renderCache.file)||!this.renderCache.highlighted||!Oe(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:i,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){const n=this.workerManager?.getFileResultCache(e);if(!(n==null||!Oe(t,n.options)))return n}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return n?.result!=null&&n.highlighted&&ae(e,n.file)&&Oe(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){const{disableLineNumbers:t=!1,overflow:n="scroll"}=this.options;return Xi({type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Pt(e,t){return e>t}const nr=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
5
|
-
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
6
|
-
<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"/>
|
|
7
|
-
</symbol>
|
|
8
|
-
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
9
|
-
<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"/>
|
|
10
|
-
</symbol>
|
|
11
|
-
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
12
|
-
<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"/>
|
|
13
|
-
</symbol>
|
|
14
|
-
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
15
|
-
<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"/>
|
|
16
|
-
</symbol>
|
|
17
|
-
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
18
|
-
<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"/>
|
|
19
|
-
</symbol>
|
|
20
|
-
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
21
|
-
<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"/>
|
|
22
|
-
</symbol>
|
|
23
|
-
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
24
|
-
<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"/>
|
|
25
|
-
</symbol>
|
|
26
|
-
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
27
|
-
<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"/>
|
|
28
|
-
</symbol>
|
|
29
|
-
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
30
|
-
<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"/>
|
|
31
|
-
</symbol>
|
|
32
|
-
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
33
|
-
<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"/>
|
|
34
|
-
</symbol>
|
|
35
|
-
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
36
|
-
<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"/>
|
|
37
|
-
</symbol>
|
|
38
|
-
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
39
|
-
<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"/>
|
|
40
|
-
</symbol>
|
|
41
|
-
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
42
|
-
<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"/>
|
|
43
|
-
</symbol>
|
|
44
|
-
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
45
|
-
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
|
|
46
|
-
</symbol>
|
|
47
|
-
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
48
|
-
<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"/>
|
|
49
|
-
</symbol>
|
|
50
|
-
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
51
|
-
<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"/>
|
|
52
|
-
</symbol>
|
|
53
|
-
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
54
|
-
<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"/>
|
|
55
|
-
</symbol>
|
|
56
|
-
</svg>`;function ps(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function ir(e,t){return e==null||t==null?e===t:gs(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}const _n={};function gs(e=_n,t=_n){if(e===t)return!0;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r of n)if(e[r]!==t[r])return!1;return!0}function pn(e){const t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}function rr(){const 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 or(){const e=document.createElement("style");return e.setAttribute(Ri,""),e}var sr=`@layer base {
|
|
57
|
-
:host {
|
|
58
|
-
--diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
|
|
59
|
-
"Courier New", monospace;
|
|
60
|
-
--diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
|
|
61
|
-
"Noto Sans", "Liberation Sans", Arial, sans-serif;
|
|
62
|
-
--diffs-mixer: light-dark(#000, #fff);
|
|
63
|
-
--diffs-gap-fallback: 8px;
|
|
64
|
-
--diffs-scrollbar-gutter-fallback: 6px;
|
|
65
|
-
--diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
|
|
66
|
-
--diffs-added-light: #0dbe4e;
|
|
67
|
-
--diffs-added-dark: #5ecc71;
|
|
68
|
-
--diffs-modified-light: #009fff;
|
|
69
|
-
--diffs-modified-dark: #69b1ff;
|
|
70
|
-
--diffs-deleted-light: #ff2e3f;
|
|
71
|
-
--diffs-deleted-dark: #ff6762;
|
|
72
|
-
color-scheme: light dark;
|
|
73
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
74
|
-
font-size: var(--diffs-font-size, 13px);
|
|
75
|
-
line-height: var(--diffs-line-height, 20px);
|
|
76
|
-
font-feature-settings: var(--diffs-font-features);
|
|
77
|
-
--diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));
|
|
78
|
-
--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))));
|
|
79
|
-
--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))));
|
|
80
|
-
--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))));
|
|
81
|
-
--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))));
|
|
82
|
-
--diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));
|
|
83
|
-
--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))));
|
|
84
|
-
--diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));
|
|
85
|
-
--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)))));
|
|
86
|
-
--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)))));
|
|
87
|
-
--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)))));
|
|
88
|
-
--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))));
|
|
89
|
-
--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)));
|
|
90
|
-
--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))));
|
|
91
|
-
--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)));
|
|
92
|
-
--diffs-selection-base: var(--diffs-modified-base);
|
|
93
|
-
--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)));
|
|
94
|
-
background-color: var(--diffs-bg);
|
|
95
|
-
color: var(--diffs-fg);
|
|
96
|
-
display: block;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
pre, code, [data-error-wrapper] {
|
|
100
|
-
isolation: isolate;
|
|
101
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
102
|
-
outline: none;
|
|
103
|
-
margin: 0;
|
|
104
|
-
padding: 0;
|
|
105
|
-
display: block;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
pre, code {
|
|
109
|
-
background-color: var(--diffs-bg);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
code {
|
|
113
|
-
contain: content;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
*, :before, :after {
|
|
117
|
-
box-sizing: border-box;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
[data-icon-sprite] {
|
|
121
|
-
display: none;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
[data-diffs-header], [data-separator] {
|
|
125
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
[data-diffs-header][data-sticky] {
|
|
129
|
-
z-index: 1;
|
|
130
|
-
background-color: var(--diffs-bg);
|
|
131
|
-
position: sticky;
|
|
132
|
-
top: 0;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
[data-file-info] {
|
|
136
|
-
color: var(--fg);
|
|
137
|
-
background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
|
|
138
|
-
border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
|
|
139
|
-
padding: 10px;
|
|
140
|
-
font-weight: 700;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
[data-diff], [data-file] {
|
|
144
|
-
--diffs-grid-number-column-width: minmax(min-content, max-content);
|
|
145
|
-
--diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
|
|
146
|
-
|
|
147
|
-
&[data-dehydrated] {
|
|
148
|
-
--diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
&:hover [data-code]::-webkit-scrollbar-thumb {
|
|
152
|
-
background-color: var(--diffs-bg-context);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
@supports (-webkit-touch-callout: none) {
|
|
157
|
-
:host {
|
|
158
|
-
--diffs-scrollbar-gutter-fallback: 0px;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
[data-line] span {
|
|
163
|
-
color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
|
|
164
|
-
background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
|
|
165
|
-
font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
|
|
166
|
-
font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
|
|
167
|
-
text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
[data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions] {
|
|
171
|
-
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
172
|
-
--diffs-computed-diff-line-bg: var(--diffs-bg);
|
|
173
|
-
--diffs-computed-selected-line-bg: var(--diffs-bg);
|
|
174
|
-
color: var(--diffs-fg);
|
|
175
|
-
background-color: var(--diffs-line-bg, var(--diffs-bg));
|
|
176
|
-
|
|
177
|
-
@media (pointer: fine) {
|
|
178
|
-
&:where([data-hovered]) {
|
|
179
|
-
--diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
|
|
180
|
-
var(--diffs-computed-selected-line-bg) 97%,
|
|
181
|
-
var(--diffs-bg-hover-override, var(--diffs-mixer))), color-mix(in lab,
|
|
182
|
-
var(--diffs-computed-selected-line-bg) 91%,
|
|
183
|
-
var(--diffs-bg-hover-override, var(--diffs-mixer))));
|
|
184
|
-
--diffs-line-bg: var(--diffs-computed-hovered-line-bg, inherit);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
[data-line], [data-no-newline] {
|
|
190
|
-
&[data-decoration-bg] {
|
|
191
|
-
--mix-deco-light: 92%;
|
|
192
|
-
--mix-deco-dark: 85%;
|
|
193
|
-
|
|
194
|
-
&[data-decoration-bg-depth="2"] {
|
|
195
|
-
--mix-deco-light: 88%;
|
|
196
|
-
--mix-deco-dark: 80%;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
&[data-decoration-bg-depth="3"] {
|
|
200
|
-
--mix-deco-light: 85%;
|
|
201
|
-
--mix-deco-dark: 78%;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
@media (pointer: fine) {
|
|
205
|
-
&[data-hovered]:not([data-selected-line]) {
|
|
206
|
-
--mix-deco-light: 85%;
|
|
207
|
-
--mix-deco-dark: 85%;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
&[data-hovered]:not([data-selected-line])[data-decoration-bg-depth="2"] {
|
|
211
|
-
--mix-deco-light: 83%;
|
|
212
|
-
--mix-deco-dark: 83%;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
&[data-hovered]:not([data-selected-line])[data-decoration-bg-depth="3"] {
|
|
216
|
-
--mix-deco-light: 81%;
|
|
217
|
-
--mix-deco-dark: 81%;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
222
|
-
var(--diffs-bg) var(--mix-deco-light),
|
|
223
|
-
var(--diffs-decoration-bg)), color-mix(in lab,
|
|
224
|
-
var(--diffs-bg) var(--mix-deco-dark),
|
|
225
|
-
var(--diffs-decoration-bg)));
|
|
226
|
-
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
227
|
-
--diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);
|
|
228
|
-
--diffs-line-bg: var(--diffs-computed-decoration-bg);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
[data-line-annotation], [data-gutter-buffer="annotation"] {
|
|
233
|
-
--diffs-annotation-bg: var(--diffs-bg-context);
|
|
234
|
-
--diffs-computed-decoration-bg: var(--diffs-annotation-bg);
|
|
235
|
-
--diffs-computed-diff-line-bg: var(--diffs-annotation-bg);
|
|
236
|
-
--diffs-computed-selected-line-bg: var(--diffs-annotation-bg);
|
|
237
|
-
--diffs-line-bg: var(--diffs-annotation-bg);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
[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"] {
|
|
241
|
-
--diffs-computed-decoration-bg: var(--diffs-bg-context);
|
|
242
|
-
--diffs-computed-diff-line-bg: var(--diffs-bg-context);
|
|
243
|
-
--diffs-computed-selected-line-bg: var(--diffs-bg-context);
|
|
244
|
-
--diffs-line-bg: var(--diffs-bg-context);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
[data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
|
|
248
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
249
|
-
var(--diffs-bg) 78%,
|
|
250
|
-
var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
|
|
251
|
-
var(--diffs-bg) 68%,
|
|
252
|
-
var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
|
|
253
|
-
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
254
|
-
--diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);
|
|
255
|
-
--diffs-line-bg: var(--diffs-computed-decoration-bg);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
[data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
|
|
259
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
260
|
-
var(--diffs-bg) 78%,
|
|
261
|
-
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
|
|
262
|
-
var(--diffs-bg) 68%,
|
|
263
|
-
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
|
|
264
|
-
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
265
|
-
--diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);
|
|
266
|
-
--diffs-line-bg: var(--diffs-computed-decoration-bg);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
[data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
|
|
270
|
-
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
271
|
-
--diffs-computed-diff-line-bg: var(--diffs-bg);
|
|
272
|
-
--diffs-computed-selected-line-bg: var(--diffs-bg);
|
|
273
|
-
--diffs-line-bg: var(--diffs-bg);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
:where([data-background]) {
|
|
277
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
278
|
-
--mix-light: 91%;
|
|
279
|
-
--mix-dark: 85%;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
& [data-line], & [data-no-newline] {
|
|
283
|
-
--mix-light: 88%;
|
|
284
|
-
--mix-dark: 80%;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
& [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
|
|
288
|
-
--diffs-diff-line-mix-target: var(--diffs-bg);
|
|
289
|
-
|
|
290
|
-
&[data-line-type="change-deletion"] {
|
|
291
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
|
|
292
|
-
|
|
293
|
-
@media (pointer: fine) {
|
|
294
|
-
&[data-hovered] {
|
|
295
|
-
--mix-light: 80%;
|
|
296
|
-
--mix-dark: 75%;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
301
|
-
color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
|
|
302
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
306
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
307
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
308
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
309
|
-
var(--diffs-diff-line-mix-target)));
|
|
310
|
-
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
311
|
-
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
&[data-line-type="change-addition"] {
|
|
315
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
|
|
316
|
-
|
|
317
|
-
@media (pointer: fine) {
|
|
318
|
-
&[data-hovered] {
|
|
319
|
-
--mix-light: 80%;
|
|
320
|
-
--mix-dark: 70%;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
325
|
-
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
326
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
330
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
331
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
332
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
333
|
-
var(--diffs-diff-line-mix-target)));
|
|
334
|
-
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
335
|
-
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
&[data-merge-conflict="current"] {
|
|
339
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
|
|
340
|
-
|
|
341
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
342
|
-
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
343
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
@media (pointer: fine) {
|
|
347
|
-
&[data-hovered] {
|
|
348
|
-
--mix-light: 80%;
|
|
349
|
-
--mix-dark: 70%;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
354
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
355
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
356
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
357
|
-
var(--diffs-diff-line-mix-target)));
|
|
358
|
-
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
359
|
-
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
&[data-merge-conflict="incoming"] {
|
|
363
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
|
|
364
|
-
|
|
365
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
366
|
-
color: var(--diffs-modified-base);
|
|
367
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
@media (pointer: fine) {
|
|
371
|
-
&[data-hovered] {
|
|
372
|
-
--mix-light: 80%;
|
|
373
|
-
--mix-dark: 70%;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
378
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
379
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
380
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
381
|
-
var(--diffs-diff-line-mix-target)));
|
|
382
|
-
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
383
|
-
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
[data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline] {
|
|
389
|
-
--diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
|
|
390
|
-
|
|
391
|
-
&:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
|
|
392
|
-
--mix-selection-light: 82%;
|
|
393
|
-
--mix-selection-dark: 75%;
|
|
394
|
-
|
|
395
|
-
@media (pointer: fine) {
|
|
396
|
-
&[data-hovered]:not([data-merge-conflict], [data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
397
|
-
--mix-selection-light: 75%;
|
|
398
|
-
--mix-selection-dark: 70%;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
&:where([data-gutter-buffer], [data-column-number])[data-selected-line] {
|
|
404
|
-
--mix-selection-light: 75%;
|
|
405
|
-
--mix-selection-dark: 60%;
|
|
406
|
-
--diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
|
|
407
|
-
|
|
408
|
-
@media (pointer: fine) {
|
|
409
|
-
&[data-hovered]:not([data-merge-conflict], [data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
410
|
-
--mix-selection-light: 70%;
|
|
411
|
-
--mix-selection-dark: 55%;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
&[data-selected-line] {
|
|
417
|
-
--diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
|
|
418
|
-
var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
|
|
419
|
-
var(--diffs-selection-mix-target)), color-mix(in lab,
|
|
420
|
-
var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
|
|
421
|
-
var(--diffs-selection-mix-target)));
|
|
422
|
-
--diffs-line-bg: var(--diffs-computed-selected-line-bg, inherit);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
[data-gutter-buffer], [data-column-number] {
|
|
427
|
-
&[data-selected-line] {
|
|
428
|
-
color: var(--diffs-selection-number-fg);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
[data-no-newline] {
|
|
433
|
-
user-select: none;
|
|
434
|
-
|
|
435
|
-
& span {
|
|
436
|
-
opacity: .6;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
[data-diff-type="split"][data-overflow="scroll"] {
|
|
441
|
-
grid-template-columns: 1fr 1fr;
|
|
442
|
-
display: grid;
|
|
443
|
-
|
|
444
|
-
& [data-additions] {
|
|
445
|
-
border-left: 1px solid var(--diffs-bg);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
& [data-deletions] {
|
|
449
|
-
border-right: 1px solid var(--diffs-bg);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
[data-code] {
|
|
454
|
-
grid-auto-flow: dense;
|
|
455
|
-
grid-template-columns: var(--diffs-code-grid);
|
|
456
|
-
overflow: var(--diffs-overflow-override, scroll) clip;
|
|
457
|
-
overscroll-behavior-x: none;
|
|
458
|
-
tab-size: var(--diffs-tab-size, 2);
|
|
459
|
-
padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
460
|
-
padding-bottom: max(0px,
|
|
461
|
-
calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
|
|
462
|
-
var(--diffs-scrollbar-gutter)));
|
|
463
|
-
scrollbar-gutter: stable;
|
|
464
|
-
align-self: flex-start;
|
|
465
|
-
display: grid;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
[data-diffs-scrollbar-measure] {
|
|
469
|
-
opacity: 0;
|
|
470
|
-
pointer-events: none;
|
|
471
|
-
scrollbar-gutter: auto;
|
|
472
|
-
grid-template-columns: none;
|
|
473
|
-
width: 100px;
|
|
474
|
-
height: 100px;
|
|
475
|
-
padding: 0;
|
|
476
|
-
position: absolute;
|
|
477
|
-
top: -200px;
|
|
478
|
-
left: -200px;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
[data-container-size] {
|
|
482
|
-
container-type: inline-size;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
[data-code]::-webkit-scrollbar {
|
|
486
|
-
width: 0;
|
|
487
|
-
height: var(--diffs-scrollbar-gutter);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
[data-code]::-webkit-scrollbar-track {
|
|
491
|
-
background: none;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
[data-code]::-webkit-scrollbar-thumb {
|
|
495
|
-
background-color: #0000;
|
|
496
|
-
background-clip: content-box;
|
|
497
|
-
border: 1px solid #0000;
|
|
498
|
-
border-radius: 3px;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
[data-code]::-webkit-scrollbar-corner {
|
|
502
|
-
background-color: #0000;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
@supports ((-moz-appearance: none)) {
|
|
506
|
-
[data-code] {
|
|
507
|
-
scrollbar-width: thin;
|
|
508
|
-
scrollbar-color: var(--diffs-bg-context) transparent;
|
|
509
|
-
padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
[data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
|
|
514
|
-
& [data-code], &[data-overflow="wrap"] {
|
|
515
|
-
padding-top: 0;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
[data-gutter] {
|
|
520
|
-
grid-template-rows: subgrid;
|
|
521
|
-
grid-template-columns: subgrid;
|
|
522
|
-
z-index: 3;
|
|
523
|
-
background-color: var(--diffs-bg);
|
|
524
|
-
grid-column: 1;
|
|
525
|
-
display: grid;
|
|
526
|
-
position: relative;
|
|
527
|
-
|
|
528
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
529
|
-
border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
[data-content] {
|
|
534
|
-
grid-template-rows: subgrid;
|
|
535
|
-
grid-template-columns: subgrid;
|
|
536
|
-
background-color: var(--diffs-bg);
|
|
537
|
-
grid-column: 2;
|
|
538
|
-
min-width: 0;
|
|
539
|
-
display: grid;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
[data-diff-type="split"][data-overflow="wrap"] {
|
|
543
|
-
grid-auto-flow: dense;
|
|
544
|
-
grid-template-columns: repeat(2, var(--diffs-code-grid));
|
|
545
|
-
padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
546
|
-
display: grid;
|
|
547
|
-
|
|
548
|
-
& [data-deletions] {
|
|
549
|
-
display: contents;
|
|
550
|
-
|
|
551
|
-
& [data-gutter] {
|
|
552
|
-
grid-column: 1;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
& [data-content] {
|
|
556
|
-
border-right: 1px solid var(--diffs-bg);
|
|
557
|
-
grid-column: 2;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
& [data-additions] {
|
|
562
|
-
display: contents;
|
|
563
|
-
|
|
564
|
-
& [data-gutter] {
|
|
565
|
-
border-left: 1px solid var(--diffs-bg);
|
|
566
|
-
grid-column: 3;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
& [data-content] {
|
|
570
|
-
grid-column: 4;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
[data-overflow="scroll"] [data-gutter] {
|
|
576
|
-
position: sticky;
|
|
577
|
-
left: 0;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
[data-interactive-lines] [data-line] {
|
|
581
|
-
cursor: pointer;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
[data-interactive-line-numbers] [data-column-number] {
|
|
585
|
-
cursor: pointer;
|
|
586
|
-
touch-action: none;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
[data-content-buffer], [data-gutter-buffer] {
|
|
590
|
-
user-select: none;
|
|
591
|
-
min-height: 1lh;
|
|
592
|
-
position: relative;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
[data-gutter-buffer] {
|
|
596
|
-
padding-left: 2ch;
|
|
597
|
-
padding-right: 1ch;
|
|
598
|
-
|
|
599
|
-
&:before {
|
|
600
|
-
content: "";
|
|
601
|
-
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
602
|
-
display: block;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
[data-gutter-buffer="annotation"] {
|
|
607
|
-
--diffs-annotation-bg: var(--diffs-bg-context-gutter);
|
|
608
|
-
min-height: 0;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
[data-gutter-buffer="buffer"] {
|
|
612
|
-
--diffs-line-bg: var(--diffs-bg-context-gutter);
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
[data-content-buffer] {
|
|
616
|
-
background-position: 5px 0;
|
|
617
|
-
background-size: 8px 8px;
|
|
618
|
-
background-origin: border-box;
|
|
619
|
-
background-image: repeating-linear-gradient(-45deg,
|
|
620
|
-
transparent,
|
|
621
|
-
transparent calc(3px * 1.414),
|
|
622
|
-
var(--diffs-bg-buffer) calc(3px * 1.414),
|
|
623
|
-
var(--diffs-bg-buffer) calc(4px * 1.414));
|
|
624
|
-
grid-column: 1;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
[data-separator] {
|
|
628
|
-
box-sizing: content-box;
|
|
629
|
-
background-color: var(--diffs-bg);
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
[data-separator="simple"] {
|
|
633
|
-
min-height: 4px;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
|
|
637
|
-
background-color: var(--diffs-bg-separator);
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
641
|
-
height: 32px;
|
|
642
|
-
position: relative;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
[data-separator-wrapper] {
|
|
646
|
-
user-select: none;
|
|
647
|
-
fill: currentColor;
|
|
648
|
-
background-color: var(--diffs-bg);
|
|
649
|
-
align-items: center;
|
|
650
|
-
height: 100%;
|
|
651
|
-
display: flex;
|
|
652
|
-
position: absolute;
|
|
653
|
-
inset-inline: 0;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
[data-content] [data-separator-wrapper] {
|
|
657
|
-
display: none;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
[data-separator="metadata"] [data-separator-wrapper] {
|
|
661
|
-
background-color: var(--diffs-bg-separator);
|
|
662
|
-
height: 100%;
|
|
663
|
-
color: var(--diffs-fg-number);
|
|
664
|
-
white-space: nowrap;
|
|
665
|
-
text-overflow: ellipsis;
|
|
666
|
-
min-width: min-content;
|
|
667
|
-
padding-inline: 1ch;
|
|
668
|
-
inset-inline: 100% auto;
|
|
669
|
-
overflow: hidden;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
[data-separator="line-info"] {
|
|
673
|
-
margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
674
|
-
|
|
675
|
-
& [data-separator-wrapper] {
|
|
676
|
-
min-width: 16px;
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
[data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
681
|
-
margin-block: 0;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
[data-separator="line-info"][data-separator-first] {
|
|
685
|
-
margin-top: 0;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
[data-separator="line-info"][data-separator-last] {
|
|
689
|
-
margin-bottom: 0;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
[data-expand-index] [data-separator-wrapper] {
|
|
693
|
-
grid-template-columns: 32px auto;
|
|
694
|
-
display: grid;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
[data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
|
|
698
|
-
grid-template-columns: 32px 32px auto;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
[data-expand-button], [data-separator-content] {
|
|
702
|
-
background-color: var(--diffs-bg-separator);
|
|
703
|
-
flex: none;
|
|
704
|
-
align-items: center;
|
|
705
|
-
display: flex;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
[data-expand-index] [data-separator-content]:hover {
|
|
709
|
-
cursor: pointer;
|
|
710
|
-
text-decoration: underline;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
[data-expand-button] {
|
|
714
|
-
cursor: pointer;
|
|
715
|
-
min-width: 32px;
|
|
716
|
-
color: var(--diffs-fg-number);
|
|
717
|
-
border-right: 2px solid var(--diffs-bg);
|
|
718
|
-
flex-shrink: 0;
|
|
719
|
-
justify-content: center;
|
|
720
|
-
align-self: stretch;
|
|
721
|
-
|
|
722
|
-
&:hover {
|
|
723
|
-
color: var(--diffs-fg);
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
&[data-expand-all-button] {
|
|
727
|
-
display: none;
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
[data-expand-down] [data-icon] {
|
|
732
|
-
transform: scaleY(-1);
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
[data-separator-content] {
|
|
736
|
-
height: 100%;
|
|
737
|
-
color: var(--diffs-fg-number);
|
|
738
|
-
flex: auto;
|
|
739
|
-
justify-content: flex-start;
|
|
740
|
-
padding: 0 1ch;
|
|
741
|
-
overflow: hidden;
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
745
|
-
& [data-separator-content] {
|
|
746
|
-
user-select: none;
|
|
747
|
-
height: 100%;
|
|
748
|
-
overflow: clip;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
[data-unmodified-lines] {
|
|
753
|
-
text-overflow: ellipsis;
|
|
754
|
-
white-space: nowrap;
|
|
755
|
-
flex: 0 auto;
|
|
756
|
-
min-width: 0;
|
|
757
|
-
display: block;
|
|
758
|
-
overflow: hidden;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
@supports (width: 1cqi) {
|
|
762
|
-
[data-unified] {
|
|
763
|
-
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
764
|
-
padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
765
|
-
width: 100cqi;
|
|
766
|
-
|
|
767
|
-
& [data-separator-content] {
|
|
768
|
-
border-radius: 6px;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
& [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
|
|
773
|
-
border-top-left-radius: unset;
|
|
774
|
-
border-bottom-left-radius: unset;
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
[data-gutter] {
|
|
779
|
-
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
780
|
-
padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
& [data-separator="line-info"] [data-separator-content] {
|
|
784
|
-
border-top-left-radius: 6px;
|
|
785
|
-
border-bottom-left-radius: 6px;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
& [data-separator="line-info"][data-expand-index] [data-separator-content] {
|
|
789
|
-
border-top-left-radius: unset;
|
|
790
|
-
border-bottom-left-radius: unset;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
[data-additions] {
|
|
795
|
-
& [data-content] [data-separator="line-info"] {
|
|
796
|
-
background-color: var(--diffs-bg);
|
|
797
|
-
|
|
798
|
-
& [data-separator-wrapper] {
|
|
799
|
-
display: none;
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
& [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
804
|
-
background-color: var(--diffs-bg-separator);
|
|
805
|
-
border-top-right-radius: 6px;
|
|
806
|
-
border-bottom-right-radius: 6px;
|
|
807
|
-
height: 100%;
|
|
808
|
-
display: block;
|
|
809
|
-
|
|
810
|
-
& [data-separator-content], & [data-expand-button] {
|
|
811
|
-
display: none;
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
[data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
817
|
-
width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
[data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
|
|
821
|
-
background-color: var(--diffs-bg-separator);
|
|
822
|
-
height: 100%;
|
|
823
|
-
margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
824
|
-
border-top-right-radius: 6px;
|
|
825
|
-
border-bottom-right-radius: 6px;
|
|
826
|
-
display: block;
|
|
827
|
-
|
|
828
|
-
& [data-separator-content], & [data-expand-button] {
|
|
829
|
-
display: none;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
834
|
-
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
835
|
-
border-top-left-radius: 6px;
|
|
836
|
-
border-bottom-left-radius: 6px;
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
@media (pointer: fine) {
|
|
841
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
842
|
-
&[data-separator-multi-button] {
|
|
843
|
-
& [data-expand-up] {
|
|
844
|
-
border-top-left-radius: 6px;
|
|
845
|
-
border-bottom-left-radius: unset;
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
& [data-expand-down] {
|
|
849
|
-
border-bottom-left-radius: 6px;
|
|
850
|
-
border-top-left-radius: unset;
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
@media (pointer: coarse) {
|
|
858
|
-
[data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
|
|
859
|
-
grid-template-columns: 34px 34px auto;
|
|
860
|
-
|
|
861
|
-
& [data-separator-content] {
|
|
862
|
-
grid-column: unset;
|
|
863
|
-
grid-row: unset;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
@supports (width: 1cqi) {
|
|
868
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
869
|
-
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
870
|
-
border-top-left-radius: 6px;
|
|
871
|
-
border-bottom-left-radius: 6px;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
&[data-separator-multi-button] {
|
|
875
|
-
& [data-expand-up] {
|
|
876
|
-
border-top-left-radius: 6px;
|
|
877
|
-
border-bottom-left-radius: 6px;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
& [data-expand-down] {
|
|
881
|
-
border-bottom-left-radius: unset;
|
|
882
|
-
border-top-left-radius: unset;
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
@media (pointer: fine) {
|
|
890
|
-
[data-separator-wrapper][data-separator-multi-button] {
|
|
891
|
-
grid-template-rows: 50% 50%;
|
|
892
|
-
display: grid;
|
|
893
|
-
|
|
894
|
-
& [data-separator-content] {
|
|
895
|
-
grid-area: 1 / 2 / -1;
|
|
896
|
-
min-width: min-content;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
& [data-expand-button] {
|
|
900
|
-
grid-column: 1;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
[data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
|
|
905
|
-
grid-template-columns: 34px auto;
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
[data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
|
|
909
|
-
grid-template-columns: 100% auto;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
913
|
-
& [data-separator-multi-button] {
|
|
914
|
-
& [data-expand-up] {
|
|
915
|
-
border-bottom: 1px solid var(--diffs-bg);
|
|
916
|
-
border-right: 2px solid var(--diffs-bg);
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
& [data-expand-down] {
|
|
920
|
-
border-top: 1px solid var(--diffs-bg);
|
|
921
|
-
border-right: 2px solid var(--diffs-bg);
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
[data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
|
|
928
|
-
display: none;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
[data-line-annotation] {
|
|
932
|
-
min-height: var(--diffs-annotation-min-height, 0);
|
|
933
|
-
z-index: 2;
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
[data-merge-conflict-actions] {
|
|
937
|
-
z-index: 2;
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
[data-separator="custom"] {
|
|
941
|
-
grid-template-columns: subgrid;
|
|
942
|
-
display: grid;
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
[data-line], [data-column-number], [data-no-newline] {
|
|
946
|
-
padding-inline: 1ch;
|
|
947
|
-
position: relative;
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
[data-indicators="classic"] [data-line] {
|
|
951
|
-
padding-inline-start: 2ch;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
[data-indicators="classic"] {
|
|
955
|
-
& [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
|
|
956
|
-
&[data-no-newline], &[data-line] {
|
|
957
|
-
&:before {
|
|
958
|
-
user-select: none;
|
|
959
|
-
width: 1ch;
|
|
960
|
-
height: 1lh;
|
|
961
|
-
display: inline-block;
|
|
962
|
-
position: absolute;
|
|
963
|
-
top: 0;
|
|
964
|
-
left: 0;
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
& [data-line-type="change-addition"] {
|
|
970
|
-
&[data-line], &[data-no-newline] {
|
|
971
|
-
&:before {
|
|
972
|
-
content: "+";
|
|
973
|
-
color: var(--diffs-addition-base);
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
& [data-line-type="change-deletion"] {
|
|
979
|
-
&[data-line], &[data-no-newline] {
|
|
980
|
-
&:before {
|
|
981
|
-
content: "-";
|
|
982
|
-
color: var(--diffs-deletion-base);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
[data-indicators="bars"] {
|
|
989
|
-
& [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
|
|
990
|
-
&[data-column-number] {
|
|
991
|
-
&:before {
|
|
992
|
-
content: "";
|
|
993
|
-
user-select: none;
|
|
994
|
-
contain: strict;
|
|
995
|
-
width: 4px;
|
|
996
|
-
height: 100%;
|
|
997
|
-
display: block;
|
|
998
|
-
position: absolute;
|
|
999
|
-
top: 0;
|
|
1000
|
-
left: 0;
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
& [data-line-type="change-deletion"] {
|
|
1006
|
-
&[data-column-number] {
|
|
1007
|
-
&:before {
|
|
1008
|
-
background-image: linear-gradient(0deg,
|
|
1009
|
-
var(--diffs-bg-deletion) 50%,
|
|
1010
|
-
var(--diffs-deletion-base) 50%);
|
|
1011
|
-
background-repeat: repeat;
|
|
1012
|
-
background-size: 2px 2px;
|
|
1013
|
-
background-size: calc(1lh / round(1lh / 2px))
|
|
1014
|
-
calc(1lh / round(1lh / 2px));
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
& [data-line-type="change-addition"] {
|
|
1020
|
-
&[data-column-number] {
|
|
1021
|
-
&:before {
|
|
1022
|
-
background-color: var(--diffs-addition-base);
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
[data-overflow="wrap"] {
|
|
1029
|
-
& [data-line], & [data-annotation-content] {
|
|
1030
|
-
white-space: pre-wrap;
|
|
1031
|
-
word-break: break-word;
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
[data-overflow="scroll"] [data-line] {
|
|
1036
|
-
white-space: pre;
|
|
1037
|
-
min-height: 1lh;
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
[data-column-number] {
|
|
1041
|
-
box-sizing: content-box;
|
|
1042
|
-
text-align: right;
|
|
1043
|
-
user-select: none;
|
|
1044
|
-
color: var(--diffs-fg-number);
|
|
1045
|
-
padding-left: 2ch;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
[data-line-number-content] {
|
|
1049
|
-
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
1050
|
-
z-index: 1;
|
|
1051
|
-
display: inline-block;
|
|
1052
|
-
position: relative;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
[data-disable-line-numbers] {
|
|
1056
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
1057
|
-
min-width: 4px;
|
|
1058
|
-
padding: 0;
|
|
1059
|
-
|
|
1060
|
-
&:before {
|
|
1061
|
-
min-width: 0;
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
& [data-line-number-content] {
|
|
1066
|
-
display: none;
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
& [data-gutter-utility-slot] {
|
|
1070
|
-
right: unset;
|
|
1071
|
-
justify-content: flex-start;
|
|
1072
|
-
left: 0;
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
&[data-indicators="bars"] [data-gutter-utility-slot] {
|
|
1076
|
-
left: 6px;
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
[data-file][data-disable-line-numbers] {
|
|
1081
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
1082
|
-
border-right: 0;
|
|
1083
|
-
min-width: 0;
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
[data-diff-span] {
|
|
1088
|
-
box-decoration-break: clone;
|
|
1089
|
-
border-radius: 3px;
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
[data-line-type="change-addition"] [data-diff-span] {
|
|
1093
|
-
background-color: var(--diffs-bg-addition-emphasis);
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
[data-line-type="change-deletion"] [data-diff-span] {
|
|
1097
|
-
background-color: var(--diffs-bg-deletion-emphasis);
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
|
|
1101
|
-
color: var(--diffs-fg);
|
|
1102
|
-
padding-left: 1ch;
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
|
|
1106
|
-
align-items: center;
|
|
1107
|
-
display: flex;
|
|
1108
|
-
|
|
1109
|
-
&:after {
|
|
1110
|
-
color: var(--diffs-fg-conflict-marker);
|
|
1111
|
-
font-size: .75rem;
|
|
1112
|
-
font-style: normal;
|
|
1113
|
-
line-height: 1.25rem;
|
|
1114
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1115
|
-
padding-left: 1ch;
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
[data-merge-conflict="marker-start"]:after {
|
|
1120
|
-
content: "(Current Change)";
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
[data-merge-conflict="marker-end"]:after {
|
|
1124
|
-
content: "(Incoming Change)";
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
[data-merge-conflict-actions-content] {
|
|
1128
|
-
min-height: 1.75rem;
|
|
1129
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1130
|
-
color: var(--diffs-fg);
|
|
1131
|
-
align-items: center;
|
|
1132
|
-
gap: .25rem;
|
|
1133
|
-
padding-inline: .5rem;
|
|
1134
|
-
font-size: .75rem;
|
|
1135
|
-
line-height: 1.2;
|
|
1136
|
-
display: flex;
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
[data-merge-conflict-action] {
|
|
1140
|
-
appearance: none;
|
|
1141
|
-
color: var(--diffs-fg-number);
|
|
1142
|
-
font: inherit;
|
|
1143
|
-
cursor: pointer;
|
|
1144
|
-
background: none;
|
|
1145
|
-
border: 0;
|
|
1146
|
-
padding: 0;
|
|
1147
|
-
font-style: normal;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
[data-merge-conflict-action]:hover {
|
|
1151
|
-
color: var(--diffs-fg);
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
[data-merge-conflict-action="current"]:hover {
|
|
1155
|
-
color: var(--diffs-addition-base);
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
[data-merge-conflict-action="incoming"]:hover {
|
|
1159
|
-
color: var(--diffs-modified-base);
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
[data-merge-conflict-action-separator] {
|
|
1163
|
-
color: var(--diffs-fg-number);
|
|
1164
|
-
opacity: .6;
|
|
1165
|
-
user-select: none;
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
[data-diffs-header="default"] {
|
|
1169
|
-
background-color: var(--diffs-bg);
|
|
1170
|
-
justify-content: space-between;
|
|
1171
|
-
align-items: center;
|
|
1172
|
-
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1173
|
-
min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
|
|
1174
|
-
z-index: 2;
|
|
1175
|
-
flex-direction: row;
|
|
1176
|
-
padding-inline: 16px;
|
|
1177
|
-
display: flex;
|
|
1178
|
-
position: relative;
|
|
1179
|
-
top: 0;
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
[data-header-content] {
|
|
1183
|
-
align-items: center;
|
|
1184
|
-
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1185
|
-
white-space: nowrap;
|
|
1186
|
-
flex-direction: row;
|
|
1187
|
-
min-width: 0;
|
|
1188
|
-
display: flex;
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
[data-header-content] [data-prev-name], [data-header-content] [data-title] {
|
|
1192
|
-
text-overflow: ellipsis;
|
|
1193
|
-
white-space: nowrap;
|
|
1194
|
-
direction: rtl;
|
|
1195
|
-
min-width: 0;
|
|
1196
|
-
overflow: hidden;
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
[data-prev-name] {
|
|
1200
|
-
opacity: .7;
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
[data-rename-icon] {
|
|
1204
|
-
fill: currentColor;
|
|
1205
|
-
flex-grow: 0;
|
|
1206
|
-
flex-shrink: 0;
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
[data-diffs-header="default"] [data-metadata] {
|
|
1210
|
-
white-space: nowrap;
|
|
1211
|
-
align-items: center;
|
|
1212
|
-
gap: 1ch;
|
|
1213
|
-
display: flex;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
[data-diffs-header="default"] [data-additions-count] {
|
|
1217
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1218
|
-
color: var(--diffs-addition-base);
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
[data-diffs-header="default"] [data-deletions-count] {
|
|
1222
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1223
|
-
color: var(--diffs-deletion-base);
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
[data-change-icon] {
|
|
1227
|
-
fill: currentColor;
|
|
1228
|
-
flex-shrink: 0;
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
[data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
|
|
1232
|
-
color: var(--diffs-modified-base);
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
[data-change-icon="new"] {
|
|
1236
|
-
color: var(--diffs-addition-base);
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
[data-change-icon="deleted"] {
|
|
1240
|
-
color: var(--diffs-deletion-base);
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
[data-change-icon="file"] {
|
|
1244
|
-
opacity: .6;
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
[data-annotation-content] {
|
|
1248
|
-
z-index: 2;
|
|
1249
|
-
isolation: isolate;
|
|
1250
|
-
align-self: flex-start;
|
|
1251
|
-
min-width: 0;
|
|
1252
|
-
display: flow-root;
|
|
1253
|
-
position: relative;
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
[data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
|
|
1257
|
-
width: var(--diffs-column-content-width, auto);
|
|
1258
|
-
left: var(--diffs-column-number-width, 0);
|
|
1259
|
-
position: sticky;
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
[data-annotation-slot] {
|
|
1263
|
-
text-wrap-mode: wrap;
|
|
1264
|
-
word-break: normal;
|
|
1265
|
-
white-space-collapse: collapse;
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
[data-gutter-utility-slot] {
|
|
1269
|
-
touch-action: none;
|
|
1270
|
-
justify-content: flex-end;
|
|
1271
|
-
display: flex;
|
|
1272
|
-
position: absolute;
|
|
1273
|
-
top: 0;
|
|
1274
|
-
bottom: 0;
|
|
1275
|
-
right: 0;
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
[data-utility-button] {
|
|
1279
|
-
appearance: none;
|
|
1280
|
-
cursor: pointer;
|
|
1281
|
-
width: 1lh;
|
|
1282
|
-
height: 1lh;
|
|
1283
|
-
font-size: var(--diffs-font-size, 13px);
|
|
1284
|
-
line-height: var(--diffs-line-height, 20px);
|
|
1285
|
-
background-color: var(--diffs-modified-base);
|
|
1286
|
-
color: var(--diffs-bg);
|
|
1287
|
-
fill: currentColor;
|
|
1288
|
-
z-index: 4;
|
|
1289
|
-
touch-action: none;
|
|
1290
|
-
border: none;
|
|
1291
|
-
border-radius: 4px;
|
|
1292
|
-
justify-content: center;
|
|
1293
|
-
align-items: center;
|
|
1294
|
-
margin-right: calc(-1lh + 1ch);
|
|
1295
|
-
padding: 0;
|
|
1296
|
-
display: flex;
|
|
1297
|
-
position: relative;
|
|
1298
|
-
|
|
1299
|
-
&:before {
|
|
1300
|
-
content: "";
|
|
1301
|
-
display: block;
|
|
1302
|
-
position: absolute;
|
|
1303
|
-
inset: 0 0 0 -4px;
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
[data-decoration-bar-stack] {
|
|
1308
|
-
pointer-events: none;
|
|
1309
|
-
isolation: isolate;
|
|
1310
|
-
z-index: 1;
|
|
1311
|
-
background-color: var(--diffs-decoration-bar-color, transparent);
|
|
1312
|
-
box-sizing: content-box;
|
|
1313
|
-
border-left: 2px solid var(--diffs-bg);
|
|
1314
|
-
border-right: 2px solid var(--diffs-bg);
|
|
1315
|
-
width: 6px;
|
|
1316
|
-
position: absolute;
|
|
1317
|
-
top: 0;
|
|
1318
|
-
bottom: 0;
|
|
1319
|
-
right: -2px;
|
|
1320
|
-
|
|
1321
|
-
[data-decoration-bar-depth="1"] & {
|
|
1322
|
-
background-color: color-mix(in lab,
|
|
1323
|
-
var(--diffs-bg) 20%,
|
|
1324
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
[data-decoration-bar-depth="2"] & {
|
|
1328
|
-
background-color: color-mix(in lab,
|
|
1329
|
-
var(--diffs-bg) 45%,
|
|
1330
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
[data-decoration-bar-depth="3"] & {
|
|
1334
|
-
background-color: color-mix(in lab,
|
|
1335
|
-
var(--diffs-bg) 65%,
|
|
1336
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
[data-decoration-bar-start] & {
|
|
1340
|
-
border-top-left-radius: 5px;
|
|
1341
|
-
border-top-right-radius: 5px;
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
[data-decoration-bar-end] & {
|
|
1345
|
-
z-index: 3;
|
|
1346
|
-
border-bottom-right-radius: 5px;
|
|
1347
|
-
border-bottom-left-radius: 5px;
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
[data-placeholder] {
|
|
1352
|
-
contain: strict;
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
[data-error-wrapper] {
|
|
1356
|
-
padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
|
|
1357
|
-
var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1358
|
-
scrollbar-width: none;
|
|
1359
|
-
max-height: 400px;
|
|
1360
|
-
overflow: auto;
|
|
1361
|
-
|
|
1362
|
-
& [data-error-message] {
|
|
1363
|
-
color: var(--diffs-deletion-base);
|
|
1364
|
-
font-size: 18px;
|
|
1365
|
-
font-weight: bold;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
& [data-error-stack] {
|
|
1369
|
-
color: var(--diffs-fg-number);
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
@layer theme, rendered, unsafe;
|
|
1375
|
-
`;let nt;function Me(e){if(nt!=null)return nt;const t=e.host;if(typeof HTMLElement<"u"&&t instanceof HTMLElement&&!t.isConnected)return;const n=document.createElement("div");n.setAttribute("data-code",""),n.setAttribute(Jr,"true");const i=document.createElement("div");return i.style.position="relative",i.style.width="200%",i.style.height="200%",n.appendChild(i),e.appendChild(n),nt=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),nt}function ar(e){return`${Ai}: ${e==null?"var(--diffs-scrollbar-gutter-fallback)":`${e}px`};`}const gn="@layer base, theme, rendered, unsafe;",ms=new RegExp(`${bs(Ai)}\\s*:\\s*[^;]+;`);function vs(e){return`${gn}
|
|
1376
|
-
${sr}
|
|
1377
|
-
@layer theme {
|
|
1378
|
-
${e}
|
|
1379
|
-
}`}function mn(e){return`${gn}
|
|
1380
|
-
@layer unsafe {
|
|
1381
|
-
${e}
|
|
1382
|
-
}`}function vn(e,t="system",n){return`${gn}
|
|
1383
|
-
@layer rendered {
|
|
1384
|
-
:host {${t==="system"?"":`
|
|
1385
|
-
color-scheme: ${t};`}
|
|
1386
|
-
${ar(n)}
|
|
1387
|
-
${e}
|
|
1388
|
-
}
|
|
1389
|
-
}`}function lr(e,t){const n=ar(t);return e.replace(ms,n)}function bs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function je({code:e,pre:t,columnType:n,rowSpan:i,containerSize:r=!1}={}){return e==null&&(e=document.createElement("code"),e.setAttribute("data-code",""),n!=null&&e.setAttribute(`data-${n}`,""),t?.appendChild(e)),i!=null?e.style.setProperty("grid-row",`span ${i}`):e.style.removeProperty("grid-row"),r?e.setAttribute("data-container-size",""):e.removeAttribute("data-container-size"),e}function dr(e,t){if(t==null)return;const n=e.shadowRoot??e.attachShadow({mode:"open"});n.innerHTML===""&&(n.innerHTML=t)}function bn(e,{type:t,diffIndicators:n,disableBackground:i,disableLineNumbers:r,overflow:o,split:s,totalLines:l,customProperties:a}){if(a!=null)for(const d in a){const h=a[d];h!=null&&e.setAttribute(d,`${h}`)}switch(t==="diff"?(e.setAttribute("data-diff",""),e.removeAttribute("data-file")):(e.setAttribute("data-file",""),e.removeAttribute("data-diff")),n){case"bars":case"classic":e.setAttribute("data-indicators",n);break;case"none":e.removeAttribute("data-indicators");break}return r?e.setAttribute("data-disable-line-numbers",""):e.removeAttribute("data-disable-line-numbers"),i?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",o),e.style.setProperty("--diffs-min-number-column-width-default",`${`${l}`.length}ch`),e}function Xe(e){if(typeof HTMLStyleElement<"u"&&e instanceof HTMLStyleElement)return!0;const t=e.tagName??e.nodeName;return typeof t=="string"&&t.toLowerCase()==="style"}function On(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:e?.useTokenTransformer,tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader!=null?"custom":"default"}}function Cn({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===""){t?.remove();return}return t??=Cs(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Cs(){const e=document.createElement("style");return e.setAttribute(Ii,""),e}if(typeof HTMLElement<"u"&&customElements.get("diffs-container")==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;const i=this.attachShadow({mode:"open"});e==null&&(e=new CSSStyleSheet,e.replaceSync(sr)),i.adoptedStyleSheets=[e]}connectedCallback(){Me(this.shadowRoot??this.attachShadow({mode:"open"}))}}customElements.define(Ei,t)}const Ss=[];let ys=-1;var xs=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++ys}`;type="file";fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;constructor(e={theme:_},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new fs(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new _i,this.interactionManager=new Pi("file",Ke(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Ke(this.options))}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;const 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&&!De(this.appliedThemeCSS.theme,this.options.theme??_)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}const{overflow:e="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,e==="wrap"),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.annotationCache.clear(),this.pre=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder=void 0,this.unsafeCSSStyle=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){const{fileContainer:t,prerenderedHTML:n,preventEmit:i=!1,file:r,lineAnnotations:o}=e;this.hydrateElements(t,n),Ls(this.pre,r,this.options.collapsed)||ks(this.headerElement,r,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:r,lineAnnotations:o}),i||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),dr(e,t);for(const n of Array.from(e.shadowRoot?.children??[])){if(n instanceof SVGElement){this.spriteSVG=n;continue}if(n instanceof HTMLElement){if(n instanceof HTMLPreElement){this.pre=n,this.appliedPreAttributes=void 0;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-theme-css")){this.themeCSSStyle=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=n,this.appliedUnsafeCSS=n.textContent;continue}if("diffsHeader"in n.dataset){this.headerElement=n,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(On(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return e!=null?this.fileRenderer.getOrCreateLineCache(e):Ss}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:i=!1,containerWrapper:r,deferManagers:o=!1,lineAnnotations:s,renderRange:l}){const{collapsed:a=!1,themeType:d="system"}=this.options;if(!this.enabled)throw new Error("File.render: attempting to call render after cleaned up");const h=a?void 0:l,c=this.renderRange,u=this.hasThemeChanged(),f=s!=null&&(s.length>0||this.lineAnnotations.length>0)?s!==this.lineAnnotations:!1,g=!ae(this.file,e);if(!a&&!n&&Lt(h,this.renderRange)&&!g&&!f&&!u)return this.applyCachedThemeState(d);this.renderRange=h,g&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(On(this.options)),this.syncInteractionOptions(),s!=null&&this.setLineAnnotations(s),this.fileRenderer.setLineAnnotations(this.lineAnnotations);const{disableErrorHandling:b=!1,disableFileHeader:y=!1}=this.options;if(y&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,r),this.applyCachedThemeState(d),a){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const m=this.fileRenderer.renderFile(e,Hi);m!=null&&this.applyThemeState(t,m.themeStyles,d,m.baseThemeType),m?.headerAST!=null&&this.applyHeaderToDOM(m.headerAST,t),this.injectUnsafeCSS()}catch(m){if(b)throw m;console.error(m),m instanceof Error&&this.applyErrorToDOM(m,t)}return i||this.emitPostRender(),!0}try{const m=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,f,g||u)||!this.applyPartialRender(c,h)){const p=this.fileRenderer.renderFile(e,h);if(p==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,p.themeStyles,d,p.baseThemeType),p.headerAST!=null&&this.applyHeaderToDOM(p.headerAST,t),this.applyFullRender(p,m)}this.applyBuffers(m,h),this.injectUnsafeCSS(),this.managersDirty=!0,o||this.flushManagers(),this.renderAnnotations(),this.renderGutterUtility()}catch(m){if(b)throw m;console.error(m),m instanceof Error&&this.applyErrorToDOM(m,t)}return i||this.emitPostRender(),!0}emitPostRender(e=!1){const{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,"unmount");return}if(t==null)return;const i=this.mounted?"update":"mount";this.mounted=!0,n?.(t,this,i)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(const{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){const t=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",t.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}primeHighlightCache(){const{file:e,workerManager:t}=this;e==null||e.cacheKey==null||t==null||Qt(e)||this.fileRenderer.getOrCreateLineCache(e).length>(this.options.tokenizeMaxLength??1e5)||t.primeFileHighlightCache(e)}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.gutterUtilityContent?.remove(),this.headerPrefix?.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.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=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.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(const{element:n}of this.annotationCache.values())n.remove();this.annotationCache.clear();return}const e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(const[n,i]of this.lineAnnotations.entries()){const r=`${n}-${ge(i)}`;let o=this.annotationCache.get(r);if(o==null||!ps(i,o.annotation)){o?.element.remove();const s=t(i);if(s==null)continue;o={element:pn(ge(i)),annotation:i},o.element.appendChild(s),this.fileContainer.appendChild(o.element),this.annotationCache.set(r,o)}e.delete(r)}for(const[n,{element:i}]of e.entries())this.annotationCache.delete(n),i.remove()}renderGutterUtility(){const{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const n=rr();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){const{unsafeCSS:e}=this.options,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??=or(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=mn(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,i){const r=e.shadowRoot??e.attachShadow({mode:"open"}),o=i??n,s=this.options.theme??_,l=typeof s=="string"?s:{...s},a=Me(r);if(this.themeCSSStyle?.parentNode===r&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===o&&this.appliedThemeCSS.scrollbarGutter===a){this.appliedThemeCSS.theme=l;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===r){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a};return}this.themeCSSStyle=Cn({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:vn(t,o,a)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a}:void 0}hydrateMeasuredScrollbar(){const e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=lr(this.themeCSSStyle.textContent??"",Me(e)))}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.code=je({code:this.code}),this.code.innerHTML=this.fileRenderer.renderPartialHTML(this.fileRenderer.renderCodeAST(e)),t.replaceChildren(this.code),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;const{file:n,code:i}=this,r=i!=null?this.getColumns(i):void 0;if(n==null||i==null||r==null)return!1;const o=e.startingLine,s=t.startingLine,l=e.totalLines===1/0?Number.POSITIVE_INFINITY:o+e.totalLines,a=t.totalLines===1/0?Number.POSITIVE_INFINITY:s+t.totalLines,d=Math.max(o,s),h=Math.min(l,a);if(h<=d||!this.trimDOMToOverlap(r.gutter,d,h)||!this.trimDOMToOverlap(r.content,d,h))return!1;let{length:c}=r.content.children;const u=(y,m)=>{if(!(m<=0))return this.fileRenderer.renderFile(n,{startingLine:y,totalLines:m,bufferBefore:0,bufferAfter:0})},f=s<d?u(s,d-s):void 0;if(f===void 0&&s<d)return!1;const g=a===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:Math.max(0,a-h),b=a>h?u(h,g):void 0;return b===void 0&&a>h?!1:(this.cleanupErrorWrapper(),f!=null&&(r.gutter.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(f.gutterAST)),r.content.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(f.contentAST)),c+=f.rowCount),b!=null&&(r.gutter.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(b.gutterAST)),r.content.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(b.contentAST)),c+=b.rowCount),this.lastRowCount!==c&&(r.gutter.style.setProperty("grid-row",`span ${c}`),r.content.style.setProperty("grid-row",`span ${c}`),this.lastRowCount=c),!0)}getColumns(e){const t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){const i=this.getDOMBoundaryIndices(e,[t,n]),r=i.get(t)??e.children.length,o=i.get(n)??e.children.length;if(r>o)return!1;for(let s=e.children.length-1;s>=o;s-=1)e.children[s]?.remove();for(let s=r-1;s>=0;s-=1)e.children[s]?.remove();return!0}getDOMBoundaryIndices(e,t){const n=[...new Set(t)].sort((l,a)=>l-a),i=new Map;if(n.length===0)return i;let r=0,o=n[r];const{children:s}=e;o===0&&(i.set(0,0),r+=1,o=n[r]);for(let l=0;l<s.length;l+=1){const a=s[l];if(!(a instanceof HTMLElement))continue;const d=this.getLineIndexFromDOMNode(a);if(d!=null){for(;o!=null&&d>=o;)i.set(o,l),r+=1,o=n[r];if(r>=n.length)break}}for(const l of n)i.has(l)||i.set(l,s.length);return i}getLineIndexFromDOMNode(e){const t=e.dataset.lineIndex;if(t==null)return;const n=Number(t);return Number.isNaN(n)?void 0:n}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}applyHeaderToDOM(e,t){const{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;const i=this.cachedHeaderHTML??pe(e);if(this.cachedHeaderHTML=i,i!==this.lastRenderedHeaderHTML){const l=document.createElement("div");l.innerHTML=i;const a=l.firstElementChild;if(!(a instanceof HTMLElement))return;this.headerElement!=null?t.shadowRoot?.replaceChild(a,this.headerElement):t.shadowRoot?.prepend(a),this.headerElement=a,this.lastRenderedHeaderHTML=i}if(this.isContainerManaged)return;const{renderHeaderPrefix:r,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){const l=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,an,l),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0}else{const l=r?.(n)??void 0,a=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,on,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,sn,a),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(i==null){t?.remove();return}const r=t??this.createHeaderSlotElement(n);return t==null&&e.appendChild(r),this.replaceHeaderSlotContent(r,i),r}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){const t=document.createElement("div");return t.slot=e,t}getOrCreateFileContainerNode(e,t){const{fileContainer:n}=this,i=e??n??document.createElement("diffs-container"),r=n!==i;return r&&this.emitPostRender(!0),this.fileContainer=i,n!=null&&r&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),r&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){const{shadowRoot:t}=e;if(t!=null)for(const n of t.children)n instanceof SVGElement?this.spriteSVG??=n:Xe(n)&&n.hasAttribute("data-theme-css")?(this.themeCSSStyle??=n,this.hasAdoptedThemeCSS=!0):Xe(n)&&n.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle??=n,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});if(this.spriteSVG==null){const n=document.createElement("div");n.innerHTML=nr;const i=n.firstChild;i instanceof SVGElement&&(this.spriteSVG=i)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});return this.pre==null?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(const t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute("data-code")){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){const{overflow:n="scroll",disableLineNumbers:i=!1}=this.options,r={type:"file",split:!1,overflow:n,disableLineNumbers:i,diffIndicators:"none",disableBackground:!0,totalLines:t};ir(r,this.appliedPreAttributes)||(bn(e,r),this.appliedPreAttributes=r)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const n=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",n.appendChild(this.errorWrapper);const i=document.createElement("div");i.dataset.errorMessage="",i.innerText=e.message,this.errorWrapper.appendChild(i);const r=document.createElement("pre");r.dataset.errorStack="",r.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(r)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Ls(e,t,n=!1){return!n&&e==null&&t!=null}function ks(e,t,n=!1){return e==null&&t!=null&&!n}function _t(e){return{...ln,...e}}function se(e,t){const n=ws(e,t);return t?n:e.diffHeaderHeight+n}function ws(e,t){return e.paddingTop??(t?e.spacing:0)}function yt(e){return e.paddingBottom??e.spacing}function Es(e){switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}const Ts=5e3;let Is=-1;function Rs(e,t){return(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.unsafeCSS!==t.unsafeCSS}var As=class extends xs{virtualizer;metrics;__id=`virtualized-file:${++Is}`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0};isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=ln,i,r=!1){super(e,i,r),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){!t&&He(this.metrics,e)||(this.metrics=e,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}hasLineAnnotations(){return this.lineAnnotations.some(e=>e.lineNumber>0)}getLineHeight(e,t=!1){const n=this.cache.heights.get(e);if(n!=null)return n;const i=t?2:1;return this.metrics.lineHeight*i}setOptions(e){if(this.isAdvancedMode())throw new Error("VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(e==null)return;const{options:t}=this,n=!dn(t,e),i=Rs(t,e);super.setOptions(e),i&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,i)}setThemeType(e){if(this.isAdvancedMode())throw new Error("VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(e)}resetLayoutCache(e=!1){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.renderRange!=null&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.file==null)return this.height!==0&&(e=!0),this.height=0,e;const{overflow:t="scroll"}=this.options;if(this.top=this.getVirtualizedTop(),t==="scroll"&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled()||this.code==null)return e;const n=this.code.children[1];if(!(n instanceof HTMLElement))return e;const i=Yt(this.lineAnnotations);if(this.renderRange!=null&&i&&kt(this.renderRange)){const r=Hs(n)??0;r!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=r,e=!0)}else!i&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(const r of n.children){if(!(r instanceof HTMLElement))continue;const o=r.dataset.lineIndex;if(o==null)continue;const s=Number(o);let l=r.getBoundingClientRect().height,a=!1;r.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in r.nextElementSibling.dataset||"noNewline"in r.nextElementSibling.dataset)&&("noNewline"in r.nextElementSibling.dataset&&(a=!0),l+=r.nextElementSibling.getBoundingClientRect().height);const d=this.getLineHeight(s,a);l!==d&&(e=!0,l===this.metrics.lineHeight*(a?2:1)?this.cache.heights.delete(s):this.cache.heights.set(s,l))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));prepareCodeViewItem(e,t,n,i){const r=this.syncLineAnnotations(i);let o=n?.resetFileLayoutCache===!0||r;n?.metrics!=null&&(this.metrics=n.metrics,o=!0);const{collapsed:s=!1}=this.options;return this.currentCollapsed!==s&&(this.currentCollapsed=s,o=!0),o&&this.resetLayoutCache(),this.file!==e&&(this.layoutDirty=!0),this.file=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e){if(this.file==null||e<1)return;const{disableFileHeader:t=!1,collapsed:n=!1}=this.options,i=Nn(this.getOrCreateLineCache(this.file));let r=se(this.metrics,t);if(n||i<0)return{top:r,height:0};const o=Math.min(Math.max(e-1,0),i),{overflow:s="scroll"}=this.options,{lineHeight:l}=this.metrics;if(r+=this.cache.fileAnnotationHeight,s==="scroll"&&!this.hasLineAnnotations())return{top:r+o*l,height:l};const a=this.getLayoutCheckpointBeforeLineIndex(o);r=a?.top??r;for(let d=a?.lineIndex??0;d<o;d++)r+=this.getLineHeight(d,!1);return{top:r,height:this.getLineHeight(o,!1)}}getNumericScrollAnchor(e){if(this.file==null||this.renderRange==null)return;const{disableFileHeader:t=!1,collapsed:n=!1,overflow:i="scroll"}=this.options;if(n||this.renderRange.totalLines<=0)return;const r=Nn(this.getOrCreateLineCache(this.file));if(r<0)return;const o=se(this.metrics,t),s=Math.min(this.renderRange.startingLine,r),l=Math.min(s+this.renderRange.totalLines-1,r);if(l<s)return;const{fileAnnotationHeight:a}=this.cache;if(i==="scroll"&&!this.hasLineAnnotations()){const{lineHeight:h}=this.metrics,c=o+(s===0?a:this.renderRange.bufferBefore),u=s+Math.max(Math.ceil((e-c)/h),0);return u>l?void 0:{lineNumber:u+1,top:o+a+u*h}}let d=o+(s===0?a:this.renderRange.bufferBefore);for(let h=s;h<=l;h++){if(d>=e)return{lineNumber:h+1,top:d};d+=this.getLineHeight(h)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.file==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};const t=e!=null?this.computeRenderRangeFromWindow(this.file,this.top,e):this.renderRange;if(t==null)return;const{bufferBefore:n,bufferAfter:i,totalLines:r}=t;let o=0;if(r===0){const s=e??this.virtualizer.getWindowSpecs();this.top<s.top&&(o=i)}return{topOffset:this.top+n+o,height:this.height-(n+i)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.isSetup=!1,super.cleanUp(e)}computeApproximateSize(e=!1){const t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;const n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.file==null){this.layoutDirty=!1;return}const{disableFileHeader:i=!1,collapsed:r=!1,overflow:o="scroll"}=this.options,{lineHeight:s}=this.metrics,l=this.getOrCreateLineCache(this.file),a=se(this.metrics,i),d=yt(this.metrics);if(this.height+=a,r){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,o==="scroll"&&!this.hasLineAnnotations()?this.height+=this.getOrCreateLineCache(this.file).length*s:Ct({lines:l,callback:({lineIndex:h})=>{this.addLayoutCheckpoint(h,this.height),this.height+=this.getLineHeight(h,!1)}}),l.length>0&&(this.height+=d),this.fileContainer!=null&&t&&!n){const h=this.fileContainer.getBoundingClientRect();h.height!==this.height?console.log("VirtualizedFile.computeApproximateSize: computed height doesnt match",{name:this.file.name,elementHeight:h.height,computedHeight:this.height}):console.log("VirtualizedFile.computeApproximateSize: computed height IS CORRECT")}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.file==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:i,...r}){const{forceRenderOverride:o,isSetup:s}=this;this.forceRenderOverride=void 0;const l=this.syncLineAnnotations(i);if(l&&this.resetLayoutCache(),this.file??=t,e=this.getOrCreateFileContainerNode(e),this.file==null)return console.error("VirtualizedFile.render: attempting to virtually render when we dont have file"),!1;if(s)this.top??=this.getVirtualizedTop();else{this.computeApproximateSize();const c=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(c==null)throw new Error("VirtualizedFile.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())return this.renderPlaceholder(this.height);const a=this.virtualizer.getWindowSpecs(),d=this.top??0,h=this.computeRenderRangeFromWindow(this.file,d,a);return super.render({file:this.file,fileContainer:e,renderRange:h,lineAnnotations:i,forceRender:(o??n)||l,...r})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return this.virtualizer.type==="simple"}isAdvancedMode(){return this.virtualizer.type==="advanced"}addLayoutCheckpoint(e,t){e%Ts===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,i;for(;t<=n;){const r=t+n>>1,o=this.cache.checkpoints[r];if(o==null)throw new Error("VirtualizedFile: invalid checkpoint index");o.lineIndex<=e?(i=o,t=r+1):n=r-1}return i}getLayoutCheckpointBeforeTop(e,t){let n=0,i=this.cache.checkpoints.length-1,r=-1;for(;n<=i;){const o=n+i>>1,s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFile: invalid checkpoint index");s.top<=e?(r=o,n=o+1):i=o-1}if(t==null)return r>=0?this.cache.checkpoints[r]:void 0;for(let o=r;o>=0;o--){const s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFile: invalid checkpoint index");if(s.lineIndex%t===0)return s}}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}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){const{disableFileHeader:r=!1,overflow:o="scroll"}=this.options,{hunkLineCount:s,lineHeight:l}=this.metrics,a=this.getOrCreateLineCache(e),d=a.length,h=this.height,c=se(this.metrics,r),u=d>0?yt(this.metrics):0,{fileAnnotationHeight:f}=this.cache,g=c+f,b=Math.max(0,h-c-f-u),y=Yt(this.lineAnnotations),m=t+c,p=f>0&&y&&m<i&&m+f>n;if(t<n-h||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-c-u};if(d<=s)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};const C=Math.ceil(Math.max(i-n,0)/l),v=Math.ceil(C/s)*s+s*2,x=v/s,S=(n+i)/2;if(o==="scroll"&&!this.hasLineAnnotations()){const ee=t+g,be=ee+b;if(!p&&!(ee<i&&be>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-c-u};const le=Math.floor(p&&S<t+g?0:(S-(t+g))/l),q=Math.floor(le/s)-Math.floor(x/2),ye=Math.ceil(d/s),P=Math.max(0,Math.min(q,ye))*s,V=q<0?v+q*s:v,z=P===0?0:f+P*l,de=Math.min(V,d-P);return{startingLine:P,totalLines:V,bufferBefore:z,bufferAfter:Math.max(0,(d-P-de)*l)}}const L=x,E=[],w=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-v*l*2),s);let R=t+(w?.top??g),H=w?.lineIndex??0,I,T,M;if(Ct({lines:a,startingLine:w?.lineIndex??0,callback:({lineIndex:ee})=>{const be=H%s===0,le=Math.floor(H/s);if(be&&(E[le]=R-(t+g),M!=null)){if(M<=0)return!0;M--}const q=this.getLineHeight(ee,!1);return R>n-q&&R<i&&(I??=le),R+q>S&&(T??=le),M==null&&R>=i&&be&&(M=L),H++,R+=q,!1}}),I==null)if(p)I=0,T=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-c-u};T??=I;const N=Math.round(T-x/2),G=Math.max(0,Math.ceil(d/s)-x),D=Math.max(0,Math.min(N,G)),F=D*s,O=N<0?v+N*s:v,J=E[D]??0,me=F===0?0:f+J,ve=D+O/s,Le=ve<E.length?b-E[ve]:b-(R-t-g);return{startingLine:F,totalLines:O,bufferBefore:me,bufferAfter:Math.max(0,Le)}}};function Hs(e){let t;for(const n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Zi&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function Nn(e){const t=e.at(-1);return t==null||t===""||t===`
|
|
1390
|
-
`||t===`\r
|
|
1391
|
-
`||t==="\r"?e.length-2:e.length-1}function Be(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}const Ms=new TextEncoder,Ds=new TextDecoder("utf-8",{ignoreBOM:!0}),Ps=/[\uD800-\uDFFF]/,Jt=1024;let Te=new Uint8Array(Jt);function hr(){Te.length!==Jt&&(Te=new Uint8Array(Jt))}function U(e){if(e.length===0)return e;if(Ps.test(e))return JSON.parse(JSON.stringify(e));const t=e.length*3;Te.length<t&&(Te=new Uint8Array(t));const{written:n}=Ms.encodeInto(e,Te);return Ds.decode(Te.subarray(0,n))}function _s(e,t,n){try{return Os(e,t,n)}finally{hr()}}function Os(e,t,n=!1){const i=js(e),r=i?Us(e):Vs(e);let o;const s=[];for(const l of r){if(i&&!Ti.test(l)){if(o==null)o=U(l);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",l)}continue}else if(!i&&!Bs(l)){if(o==null)o=U(l);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",l)}continue}const a=cr(l,{cacheKey:t!=null?`${t}-${s.length}`:void 0,isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function Ns(e,t){try{return cr(e,t)}finally{hr()}}function cr(e,{cacheKey:t,isGitDiff:n=Ti.test(e),oldFile:i,newFile:r,throwOnError:o=!1}={}){let s=0;const l=gr(e,"@@ ");let a;const d=i==null||r==null;let h=0,c=0;for(const u of l){const f=ur(u),g=f[0];if(g==null){if(o)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",u);continue}const b=pr(g);let y=0,m=0;if(b==null||a==null){if(a!=null){if(o)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",u);continue}a={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:d,additionLines:!d&&i!=null&&r!=null?Fn(r.contents):[],deletionLines:!d&&i!=null&&r!=null?Fn(i.contents):[],cacheKey:Vn(t)},a.additionLines.length===1&&r?.contents===""&&(a.additionLines.length=0),a.deletionLines.length===1&&i?.contents===""&&(a.deletionLines.length=0);for(const w of f){if(w.startsWith("diff --git")){const H=w.trim().match(Yr),I=H?.[1]??H?.[2],T=H?.[3]??H?.[4];if(I==null||T==null){if(o)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",w);continue}a.name=U(T.trim()),I!==T&&(a.prevName=U(I.trim()));continue}const R=w.startsWith("---")||w.startsWith("+++")?w.match(n?Kr:qr):null;if(R!=null){const[,H,I]=R;if(H==="---"&&I!=="/dev/null"){const T=U(I.trim());a.prevName=T,a.name=T}else H==="+++"&&I!=="/dev/null"&&(a.name=U(I.trim()))}else if(n){if(w.startsWith("new mode ")&&(a.mode=U(w.slice(8).trim())),w.startsWith("old mode ")&&(a.prevMode=U(w.slice(8).trim())),w.startsWith("new file mode")&&(a.type="new",a.mode=U(w.slice(13).trim())),w.startsWith("deleted file mode")&&(a.type="deleted",a.mode=U(w.slice(17).trim())),w.startsWith("similarity index")&&(w.startsWith("similarity index 100%")?a.type="rename-pure":a.type="rename-changed"),w.startsWith("index ")){const[,H,I,T]=w.trim().match(Xr)??[];H!=null&&(a.prevObjectId=U(H)),I!=null&&(a.newObjectId=U(I)),T!=null&&(a.mode=U(T))}w.startsWith("rename from ")&&(a.prevName=U(w.slice(12).trim())),w.startsWith("rename to ")&&(a.name=U(w.slice(10).trim()))}}continue}let p,C;for(;f.length>0&&(f[f.length-1]===`
|
|
1392
|
-
`||f[f.length-1]==="\r"||f[f.length-1]===`\r
|
|
1393
|
-
`||f[f.length-1]==="");)f.pop();const{additionStart:v,deletionStart:x}=b;h=d?h:x-1,c=d?c:v-1;const S={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:b.additionCount,additionStart:v,additionLines:y,deletionCount:b.deletionCount,deletionStart:x,deletionLines:m,deletionLineIndex:h,additionLineIndex:c,hunkContent:[],hunkContext:Vn(b.hunkContext),hunkSpecs:U(g),noEOFCRAdditions:!1,noEOFCRDeletions:!1};let L=0,E=0;for(let w=1;w<f.length;w++){const R=f[w];if(L>=S.additionCount&&E>=S.deletionCount&&!R.startsWith("\\")){if(o&&$s(R)&&!Ws(R))throw Error("parsePatchContent: hunk has more lines than expected");break}const H=R[0];if(H!=="+"&&H!=="-"&&H!==" "&&H!=="\\"){if(o)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${H}", full line: "${R}"`),console.error("processFile: invalid rawLine:",R);continue}const I=qs(H);if(I==="addition"){if(o&&L>=S.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");const T=Ot(R);(p==null||p.type!=="change")&&(p=Nt("change",h,c),S.hunkContent.push(p)),c++,L++,d&&a.additionLines.push(T),p.additions++,y++,C="addition"}else if(I==="deletion"){if(o&&E>=S.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");const T=Ot(R);(p==null||p.type!=="change")&&(p=Nt("change",h,c),S.hunkContent.push(p)),h++,E++,d&&a.deletionLines.push(T),p.deletions++,m++,C="deletion"}else if(I==="context"){if(o&&(E>=S.deletionCount||L>=S.additionCount))throw Error("parsePatchContent: hunk has too many context lines");const T=Ot(R);(p==null||p.type!=="context")&&(p=Nt("context",h,c),S.hunkContent.push(p)),c++,h++,L++,E++,d&&(a.deletionLines.push(T),a.additionLines.push(T)),p.lines++,C="context"}else if(I==="metadata"&&p!=null){if(p.type==="context"?(S.noEOFCRAdditions=!0,S.noEOFCRDeletions=!0):C==="deletion"?S.noEOFCRDeletions=!0:C==="addition"&&(S.noEOFCRAdditions=!0),d&&(C==="addition"||C==="context")){const T=a.additionLines.length-1;T>=0&&(a.additionLines[T]=xe(a.additionLines[T]))}if(d&&(C==="deletion"||C==="context")){const T=a.deletionLines.length-1;T>=0&&(a.deletionLines[T]=xe(a.deletionLines[T]))}}}if(o&&(L!==S.additionCount||E!==S.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");S.additionLines=y,S.deletionLines=m,S.collapsedBefore=Math.max(S.additionStart-1-s,0),a.hunks.push(S),s=S.additionStart+S.additionCount-1;for(const w of S.hunkContent)w.type==="context"?(S.splitLineCount+=w.lines,S.unifiedLineCount+=w.lines):(S.splitLineCount+=Math.max(w.additions,w.deletions),S.unifiedLineCount+=w.deletions+w.additions);S.splitLineStart=a.splitLineCount+S.collapsedBefore,S.unifiedLineStart=a.unifiedLineCount+S.collapsedBefore,a.splitLineCount+=S.collapsedBefore+S.splitLineCount,a.unifiedLineCount+=S.collapsedBefore+S.unifiedLineCount}if(a!=null){if(o&&d&&!n&&a.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(a.hunks.length>0&&!d&&a.additionLines.length>0&&a.deletionLines.length>0){const u=a.hunks[a.hunks.length-1],f=u.additionStart+u.additionCount-1,g=a.additionLines.length,b=Math.max(g-f,0);a.splitLineCount+=b,a.unifiedLineCount+=b}return n||(a.prevName!=null&&a.name!==a.prevName?a.hunks.length>0?a.type="rename-changed":a.type="rename-pure":(i==null||i.contents==="")&&r!=null&&r.contents!==""?a.type="new":i!=null&&i.contents!==""&&(r==null||r.contents==="")&&(a.type="deleted")),a.type!=="rename-pure"&&a.type!=="rename-changed"&&(a.prevName=void 0),a}}function Fs(e,t,n=!1){const i=[],r=zs(e)?e.split(Wr):[e];for(const o of r)try{i.push(_s(o,t!=null?`${t}-${i.length}`:void 0,n))}catch(s){if(n)throw s;console.error(s)}return i}function zs(e){return e.startsWith("From ")||e.includes(`
|
|
1394
|
-
From `)}function Fn(e){const t=ur(e);for(let n=0;n<t.length;n++)t[n]=U(t[n]);return t}function ur(e){if(e.length===0)return[""];const t=[];let n=0;for(;;){const i=e.indexOf(`
|
|
1395
|
-
`,n);if(i===-1)break;t.push(e.slice(n,i+1)),n=i+1}return n<e.length&&t.push(e.slice(n)),t}function Us(e){return gr(e,"diff --git")}function Vs(e){if(e.length===0)return[""];const t=[];let n=0,i=0,r=0,o=0,s=!1;for(;i<e.length;){const l=Zt(e,i);if(r<=0&&o<=0){if(fr(e,i)){i>n&&t.push(e.slice(n,i)),n=i,s=!0,i=Zt(e,l);continue}if(s&&e.startsWith("@@ -",i)){const d=pr(e.slice(i,l));d!=null&&(r=d.deletionCount,o=d.additionCount)}i=l;continue}const a=e[i];if(a==="\\"){i=l;continue}a===" "?(r=Math.max(r-1,0),o=Math.max(o-1,0)):a==="-"?r=Math.max(r-1,0):a==="+"&&(o=Math.max(o-1,0)),i=l}return t.push(e.slice(n)),t}function Bs(e){return fr(e,0)}function fr(e,t){const n=Zt(e,t);return zn(e,t,"---")&&zn(e,n,"+++")}function zn(e,t,n){if(!e.startsWith(n,t))return!1;const i=e[t+n.length];if(i!==" "&&i!==" ")return!1;for(let r=t+n.length+1;r<e.length;r++){const o=e[r];if(o===`
|
|
1396
|
-
`||o==="\r")break;if(o!==" "&&o!==" ")return!0}return!1}function Zt(e,t){const n=e.indexOf(`
|
|
1397
|
-
`,t);return n===-1?e.length:n+1}function $s(e){const t=e[0];return t==="+"||t==="-"||t===" "}function Ws(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){const n=e[t];if(n!==" "&&n!==" "&&n!==`
|
|
1398
|
-
`&&n!=="\r")return!1}return!0}function pr(e){if(!e.startsWith("@@ -"))return;let t=4;const n=it(e,t);if(n==null)return;const i=n.value;t=n.endIndex;let r=1;if(e[t]===","){const h=it(e,t+1);if(h==null)return;r=h.value,t=h.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;const o=it(e,t);if(o==null)return;const s=o.value;t=o.endIndex;let l=1;if(e[t]===","){const h=it(e,t+1);if(h==null)return;l=h.value,t=h.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let a;const d=t+3;return e[d]===" "&&(a=Gs(e.slice(d+1))),{additionCount:l,additionStart:s,deletionCount:r,deletionStart:i,hunkContext:a}}function it(e,t){let n=t,i=0;for(;n<e.length;n++){const r=e.charCodeAt(n)-48;if(r<0||r>9)break;i=i*10+r}if(n!==t)return{value:i,endIndex:n}}function Gs(e){return e.endsWith(`\r
|
|
1399
|
-
`)?e.slice(0,-2):e.endsWith(`
|
|
1400
|
-
`)?e.slice(0,-1):e}function js(e){return e.startsWith("diff --git")||e.includes(`
|
|
1401
|
-
diff --git`)}function gr(e,t){if(e.length===0)return[""];const n=`
|
|
1402
|
-
${t}`,i=e.startsWith(t)?0:Un(e,n,0);if(i===-1)return[e];const r=[];i>0&&r.push(e.slice(0,i));let o=i;for(;;){const s=Un(e,n,o+1);if(s===-1)break;r.push(e.slice(o,s)),o=s}return r.push(e.slice(o)),r}function Un(e,t,n){const i=e.indexOf(t,n);return i===-1?-1:i+1}function Vn(e){return e==null?e:U(e)}function qs(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function Ot(e){const t=e.slice(1);return U(t===""?`
|
|
1403
|
-
`:t)}function Nt(e,t,n){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}class Sn{diff(t,n,i={}){let r;typeof i=="function"?(r=i,i={}):"callback"in i&&(r=i.callback);const o=this.castInput(t,i),s=this.castInput(n,i),l=this.removeEmpty(this.tokenize(o,i)),a=this.removeEmpty(this.tokenize(s,i));return this.diffWithOptionsObj(l,a,i,r)}diffWithOptionsObj(t,n,i,r){var o;const s=p=>{if(p=this.postProcess(p,i),r){setTimeout(function(){r(p)},0);return}else return p},l=n.length,a=t.length;let d=1,h=l+a;i.maxEditLength!=null&&(h=Math.min(h,i.maxEditLength));const c=(o=i.timeout)!==null&&o!==void 0?o:1/0,u=Date.now()+c,f=[{oldPos:-1,lastComponent:void 0}];let g=this.extractCommon(f[0],n,t,0,i);if(f[0].oldPos+1>=a&&g+1>=l)return s(this.buildValues(f[0].lastComponent,n,t));let b=-1/0,y=1/0;const m=()=>{for(let p=Math.max(b,-d);p<=Math.min(y,d);p+=2){let C;const v=f[p-1],x=f[p+1];v&&(f[p-1]=void 0);let S=!1;if(x){const E=x.oldPos-p;S=x&&0<=E&&E<l}const L=v&&v.oldPos+1<a;if(!S&&!L){f[p]=void 0;continue}if(!L||S&&v.oldPos<x.oldPos?C=this.addToPath(x,!0,!1,0,i):C=this.addToPath(v,!1,!0,1,i),g=this.extractCommon(C,n,t,p,i),C.oldPos+1>=a&&g+1>=l)return s(this.buildValues(C.lastComponent,n,t))||!0;f[p]=C,C.oldPos+1>=a&&(y=Math.min(y,p-1)),g+1>=l&&(b=Math.max(b,p+1))}d++};if(r)(function p(){setTimeout(function(){if(d>h||Date.now()>u)return r(void 0);m()||p()},0)})();else for(;d<=h&&Date.now()<=u;){const p=m();if(p)return p}}addToPath(t,n,i,r,o){const s=t.lastComponent;return s&&!o.oneChangePerToken&&s.added===n&&s.removed===i?{oldPos:t.oldPos+r,lastComponent:{count:s.count+1,added:n,removed:i,previousComponent:s.previousComponent}}:{oldPos:t.oldPos+r,lastComponent:{count:1,added:n,removed:i,previousComponent:s}}}extractCommon(t,n,i,r,o){const s=n.length,l=i.length;let a=t.oldPos,d=a-r,h=0;for(;d+1<s&&a+1<l&&this.equals(i[a+1],n[d+1],o);)d++,a++,h++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return h&&!o.oneChangePerToken&&(t.lastComponent={count:h,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=a,d}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){const r=[];let o;for(;t;)r.push(t),o=t.previousComponent,delete t.previousComponent,t=o;r.reverse();const s=r.length;let l=0,a=0,d=0;for(;l<s;l++){const h=r[l];if(h.removed)h.value=this.join(i.slice(d,d+h.count)),d+=h.count;else{if(!h.added&&this.useLongestToken){let c=n.slice(a,a+h.count);c=c.map(function(u,f){const g=i[d+f];return g.length>u.length?g:u}),h.value=this.join(c)}else h.value=this.join(n.slice(a,a+h.count));a+=h.count,h.added||(d+=h.count)}}return r}}class Ks extends Sn{}const Ys=new Ks;function Xs(e,t,n){return Ys.diff(e,t,n)}const Bn="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}";class Qs extends Sn{tokenize(t){const n=new RegExp(`(\\r?\\n)|[${Bn}]+|[^\\S\\n\\r]+|[^${Bn}]`,"ug");return t.match(n)||[]}}const Js=new Qs;function Zs(e,t,n){return Js.diff(e,t,n)}class ea extends Sn{constructor(){super(...arguments),this.tokenize=na}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
|
|
1404
|
-
`))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
|
|
1405
|
-
`))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
|
|
1406
|
-
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
1407
|
-
`)&&(n=n.slice(0,-1))),super.equals(t,n,i)}}const ta=new ea;function $n(e,t,n){return ta.diff(e,t,n)}function na(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
1408
|
-
`));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let r=0;r<i.length;r++){const o=i[r];r%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}function ia(e){for(let t=0;t<e.length;t++)if(e[t]<" "||e[t]>"~"||e[t]==='"'||e[t]==="\\")return!0;return!1}function Ce(e){if(!ia(e))return e;let t='"';const n=new TextEncoder().encode(e);let i=0;for(;i<n.length;){const r=n[i];r===7?t+="\\a":r===8?t+="\\b":r===9?t+="\\t":r===10?t+="\\n":r===11?t+="\\v":r===12?t+="\\f":r===13?t+="\\r":r===34?t+='\\"':r===92?t+="\\\\":r>=32&&r<=126?t+=String.fromCharCode(r):t+="\\"+r.toString(8).padStart(3,"0"),i++}return t+='"',t}const Wn={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Gn(e,t,n,i,r,o,s){let l;s?typeof s=="function"?l={callback:s}:l=s:l={},typeof l.context>"u"&&(l.context=4);const 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){const{callback:h}=l;$n(n,i,Object.assign(Object.assign({},l),{callback:c=>{const u=d(c);h(u)}}))}else return d($n(n,i,l));function d(h){if(!h)return;h.push({value:"",lines:[]});function c(p){return p.map(function(C){return" "+C})}const u=[];let f=0,g=0,b=[],y=1,m=1;for(let p=0;p<h.length;p++){const C=h[p],v=C.lines||oa(C.value);if(C.lines=v,C.added||C.removed){if(!f){const x=h[p-1];f=y,g=m,x&&(b=a>0?c(x.lines.slice(-a)):[],f-=b.length,g-=b.length)}for(const x of v)b.push((C.added?"+":"-")+x);C.added?m+=v.length:y+=v.length}else{if(f)if(v.length<=a*2&&p<h.length-2)for(const x of c(v))b.push(x);else{const x=Math.min(v.length,a);for(const L of c(v.slice(0,x)))b.push(L);const S={oldStart:f,oldLines:y-f+x,newStart:g,newLines:m-g+x,lines:b};u.push(S),f=0,g=0,b=[]}y+=v.length,m+=v.length}}for(const p of u)for(let C=0;C<p.lines.length;C++)p.lines[C].endsWith(`
|
|
1409
|
-
`)?p.lines[C]=p.lines[C].slice(0,-1):(p.lines.splice(C+1,0,"\"),C++);return{oldFileName:e,newFileName:t,oldHeader:r,newHeader:o,hunks:u}}}function en(e,t){var n,i,r,o,s,l;if(t||(t=Wn),Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(h=>h.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(h=>en(h,t)).join(`
|
|
1410
|
-
`)}const a=[];if(e.isGit){if(t=Wn,!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 h=e.oldFileName,c=e.newFileName;e.isCreate&&h==="/dev/null"?h=c.replace(/^b\//,"a/"):e.isDelete&&c==="/dev/null"&&(c=h.replace(/^a\//,"b/")),a.push("diff --git "+Ce(h)+" "+Ce(c)),e.isDelete&&a.push("deleted file mode "+((n=e.oldMode)!==null&&n!==void 0?n:"100644")),e.isCreate&&a.push("new file mode "+((i=e.newMode)!==null&&i!==void 0?i:"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 "+Ce(((r=e.oldFileName)!==null&&r!==void 0?r:"").replace(/^a\//,""))),a.push("rename to "+Ce(((o=e.newFileName)!==null&&o!==void 0?o:"").replace(/^b\//,"")))),e.isCopy&&(a.push("copy from "+Ce(((s=e.oldFileName)!==null&&s!==void 0?s:"").replace(/^a\//,""))),a.push("copy to "+Ce(((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("===================================================================");const d=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||d)&&(a.push("--- "+Ce(e.oldFileName)+(e.oldHeader?" "+e.oldHeader:"")),a.push("+++ "+Ce(e.newFileName)+(e.newHeader?" "+e.newHeader:"")));for(let h=0;h<e.hunks.length;h++){const c=e.hunks[h],u=c.oldLines===0?c.oldStart-1:c.oldStart,f=c.newLines===0?c.newStart-1:c.newStart;a.push("@@ -"+u+","+c.oldLines+" +"+f+","+c.newLines+" @@");for(const g of c.lines)a.push(g)}return a.join(`
|
|
1411
|
-
`)+`
|
|
1412
|
-
`}function ra(e,t,n,i,r,o,s){if(typeof s=="function"&&(s={callback:s}),s?.callback){const{callback:l}=s;Gn(e,t,n,i,r,o,Object.assign(Object.assign({},s),{callback:a=>{l(a?en(a,s.headerOptions):void 0)}}))}else{const l=Gn(e,t,n,i,r,o,s);return l?en(l,s?.headerOptions):void 0}}function oa(e){const t=e.endsWith(`
|
|
1413
|
-
`),n=e.split(`
|
|
1414
|
-
`).map(i=>i+`
|
|
1415
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function tn(e,t,n,i=!1){const r=Ns(ra(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:i});if(r==null)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");return t.lang!=null&&(r.lang=t.lang),r}var sa=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,n){if(t==null||n==null)for(const i of e.children??[])i instanceof HTMLElement&&("deletions"in i.dataset?t=i:"additions"in i.dataset&&(n=i));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener("scroll",this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener("scroll",this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function Fe(e,t){return De(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function rt(e){return A({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function ot(e){return A({tagName:"div",children:[A({tagName:"span",children:[W("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function Ft(e){return A({tagName:"div",children:[pt({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 ke({type:e,content:t,expandIndex:n,chunked:i=!1,slotName:r,isFirstHunk:o,isLastHunk:s}){let l=0;const a=[];if(e==="metadata"&&t!=null&&a.push(A({tagName:"div",children:[W(t)],properties:{"data-separator-wrapper":""}})),(e==="line-info"||e==="line-info-basic")&&t!=null){const d=[];n!=null&&(i?(o||(d.push(Ft("up")),l++),s||(d.push(Ft("down")),l++)):(d.push(Ft(!o&&!s?"both":o?"down":"up")),l++)),d.push(A({tagName:"div",children:[A({tagName:"span",children:[W(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),i&&n!=null&&d.push(A({tagName:"div",children:[W("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),a.push(A({tagName:"div",children:d,properties:{"data-separator-wrapper":"","data-separator-multi-button":l>1?"":void 0}}))}return e==="custom"&&r!=null&&a.push(A({tagName:"slot",properties:{name:r}})),A({tagName:"div",children:a,properties:{"data-separator":a.length===0?"simple":e,"data-expand-index":n,"data-separator-first":o?"":void 0,"data-separator-last":s?"":void 0}})}function aa(e,t){return`hunk-separator-${e}-${t}`}function la(e){const t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function da(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function jn({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function st({item:e,arr:t,enableJoin:n,isNeutral:i=!1,isLastItem:r=!1}){const o=t[t.length-1];if(o==null||r||!n){t.push([i?0:1,e.value]);return}const s=o[0]===0;if(i===s||i&&e.value.length===1&&!s){o[1]+=e.value;return}t.push([i?0:1,e.value])}function Qe({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}){const o=Math.max(t,0);if(o===0||e)return{fromStart:0,fromEnd:0,rangeSize:o,collapsedLines:o,renderAll:!1};if(n===!0||o<=r)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const s=n?.get(i),l=Math.min(Math.max(s?.fromStart??0,0),o),a=Math.min(Math.max(s?.fromEnd??0,0),o),d=l+a,h=d>=o;return{fromStart:h?o:l,fromEnd:h?0:a,rangeSize:o,collapsedLines:Math.max(o-d,0),renderAll:h}}function mr({fileDiff:e,errorPrefix:t}){const n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;const i=e.additionLines.length-(n.additionLineIndex+n.additionCount),r=e.deletionLines.length-(n.deletionLineIndex+n.deletionCount);if(i<=0&&r<=0)return 0;if(i!==r)throw new Error(`${t}: trailing context mismatch (additions=${i}, deletions=${r}) for ${e.name}`);return Math.min(i,r)}function Je({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:i,errorPrefix:r}){if(t!==e.hunks.length-1)return;const o=mr({fileDiff:e,errorPrefix:r});if(o<=0)return;if(n===!0||o<=i)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const s=n?.get(e.hunks.length),l=Math.min(Math.max(s?.fromStart??0,0),o);return{fromStart:l,fromEnd:0,rangeSize:o,collapsedLines:o-l,renderAll:l>=o}}function vr({type:e,metrics:t}){return t.hunkSeparatorHeight??Es(e)}function br({type:e,metrics:t}){return e==="simple"||e==="metadata"||e==="line-info-basic"?0:t.spacing}function ha({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case"simple":return t>0;case"metadata":return n!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function ca(e){return e!=="simple"&&e!=="metadata"}function $e({type:e,metrics:t,hunkIndex:n,hunkSpecs:i}){if(!ha({type:e,hunkIndex:n,hunkSpecs:i}))return;const r=vr({type:e,metrics:t}),o=br({type:e,metrics:t}),s=n>0?o:0,l=o;return{height:r,gapBefore:s,gapAfter:l,totalHeight:s+r+l}}function We({type:e,metrics:t}){if(!ca(e))return;const n=vr({type:e,metrics:t}),i=br({type:e,metrics:t});return{height:n,gapBefore:i,gapAfter:0,totalHeight:i+n}}function qe({diff:e,diffStyle:t,startingLine:n=0,totalLines:i=1/0,expandedHunks:r,collapsedContextThreshold:o=1,callback:s}){const l=ua({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:o}),a={viewportStart:n,viewportEnd:n+i,isWindowedHighlight:n>0||i<1/0,splitCount:l.splitCount,unifiedCount:l.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!a.isWindowedHighlight)return!1;const d=a.unifiedCount>=n+i,h=a.splitCount>=n+i;return t==="unified"?d:(t==="split"||d)&&h},shouldSkip(d,h){if(!a.isWindowedHighlight)return!1;const c=a.unifiedCount+d<n,u=a.splitCount+h<n;return t==="unified"?c:(t==="split"||c)&&u},incrementCounts(d,h){(t==="unified"||t==="both")&&(a.unifiedCount+=d),(t==="split"||t==="both")&&(a.splitCount+=h)},isInWindow(d,h){if(!a.isWindowedHighlight)return!0;const c=a.isInUnifiedWindow(d),u=a.isInSplitWindow(h);return t==="unified"?c:t==="split"?u:c||u},isInUnifiedWindow(d){return!a.isWindowedHighlight||a.unifiedCount>=n-d&&a.unifiedCount<n+i},isInSplitWindow(d){return!a.isWindowedHighlight||a.splitCount>=n-d&&a.splitCount<n+i},emit(d,h=!1){return h||(t==="unified"?a.incrementCounts(1,0):t==="split"?a.incrementCounts(0,1):a.incrementCounts(1,1)),s(d)??!1}};e:for(let d=l.hunkIndex;d<e.hunks.length;d++){let g=function(E,w){return u==null||u.collapsedLines<=0||u.fromStart+u.fromEnd>0?0:t==="unified"?E===h.unifiedLineStart+h.unifiedLineCount-1?u.collapsedLines:0:w===h.splitLineStart+h.splitLineCount-1?u.collapsedLines:0},y=function(){return b?0:(b=!0,c.collapsedLines)};const h=e.hunks[d];if(h==null)throw new Error("iterateOverDiff: invalid hunk index");if(a.shouldBreak())break;const c=Qe({isPartial:e.isPartial,rangeSize:h.collapsedBefore,expandedHunks:r,hunkIndex:d,collapsedContextThreshold:o}),u=d===a.finalHunkIndex?Je({fileDiff:e,hunkIndex:d,expandedHunks:r,collapsedContextThreshold:o,errorPrefix:"iterateOverDiff"}):void 0,f=c.fromStart+c.fromEnd;let b=c.collapsedLines===0;if(a.shouldSkip(f,f))a.incrementCounts(f,f),y();else{let E=h.unifiedLineStart-c.rangeSize,w=h.splitLineStart-c.rangeSize,R=h.deletionLineIndex-c.rangeSize,H=h.additionLineIndex-c.rangeSize,I=h.deletionStart-c.rangeSize,T=h.additionStart-c.rangeSize;if(at(a,c.fromStart,t,M=>a.emit({hunkIndex:d,hunk:h,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:I+M,lineIndex:R+M,noEOFCR:!1,unifiedLineIndex:E+M,splitLineIndex:w+M},additionLine:{unifiedLineIndex:E+M,splitLineIndex:w+M,lineIndex:H+M,lineNumber:T+M,noEOFCR:!1}}))||(E=h.unifiedLineStart-c.fromEnd,w=h.splitLineStart-c.fromEnd,R=h.deletionLineIndex-c.fromEnd,H=h.additionLineIndex-c.fromEnd,I=h.deletionStart-c.fromEnd,T=h.additionStart-c.fromEnd,at(a,c.fromEnd,t,M=>a.emit({hunkIndex:d,hunk:h,collapsedBefore:y(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:I+M,lineIndex:R+M,noEOFCR:!1,unifiedLineIndex:E+M,splitLineIndex:w+M},additionLine:{unifiedLineIndex:E+M,splitLineIndex:w+M,lineIndex:H+M,lineNumber:T+M,noEOFCR:!1}}),()=>{y()})))break e}let m=h.unifiedLineStart,p=h.splitLineStart,C=h.deletionLineIndex,v=h.additionLineIndex,x=h.deletionStart,S=h.additionStart;const L=h.hunkContent.at(-1);for(const E of h.hunkContent){if(a.shouldBreak())break e;const w=E===L;if(E.type==="context"){if(a.shouldSkip(E.lines,E.lines))a.incrementCounts(E.lines,E.lines),y();else if(at(a,E.lines,t,R=>{const H=w&&R===E.lines-1,I=m+R,T=p+R;return a.emit({hunkIndex:d,hunk:h,collapsedBefore:y(),collapsedAfter:g(I,T),type:"context",deletionLine:{lineNumber:x+R,lineIndex:C+R,noEOFCR:H&&h.noEOFCRDeletions,unifiedLineIndex:I,splitLineIndex:T},additionLine:{unifiedLineIndex:I,splitLineIndex:T,lineIndex:v+R,lineNumber:S+R,noEOFCR:H&&h.noEOFCRAdditions}})},()=>{y()}))break e;m+=E.lines,p+=E.lines,C+=E.lines,v+=E.lines,x+=E.lines,S+=E.lines}else{const R=Math.max(E.deletions,E.additions),H=E.deletions+E.additions;if(!a.shouldSkip(H,R)){const I=ga(a,E,t);(I[0]?.[0]??0)>0&&y();for(const[T,M]of I)for(let N=T;N<M;N++){const G=g(m+N,t==="unified"?p+(N<E.deletions?N:N-E.deletions):p+N);if(a.emit(ma({hunkIndex:d,hunk:h,collapsedBefore:y(),collapsedAfter:G,diffStyle:t,index:N,unifiedLineIndex:m,splitLineIndex:p,additionLineIndex:v,deletionLineIndex:C,additionLineNumber:S,deletionLineNumber:x,content:E,isLastContent:w,unifiedCount:H,splitCount:R}),!0))break e}}y(),a.incrementCounts(H,R),m+=H,p+=R,C+=E.deletions,v+=E.additions,x+=E.deletions,S+=E.additions}}if(u!=null){const{collapsedLines:E,fromStart:w,fromEnd:R}=u,H=w+R;if(at(a,H,t,I=>{const T=I===H-1;return a.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:T?E:0,type:"context-expanded",deletionLine:{lineNumber:x+I,lineIndex:C+I,noEOFCR:!1,unifiedLineIndex:m+I,splitLineIndex:p+I},additionLine:{unifiedLineIndex:m+I,splitLineIndex:p+I,lineIndex:v+I,lineNumber:S+I,noEOFCR:!1}})},void 0,()=>a.shouldBreak()))break e}}}function ua({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:r}){if(n<=0||t==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const o=fa({diff:e,expandedHunks:i,collapsedContextThreshold:r});let s=0,l=e.hunks.length-1,a=e.hunks.length;for(;s<=l;){const h=s+l>>1,c=o[h+1];if(c==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(t==="unified"?c.unifiedCount:c.splitCount)>n?(a=h,l=h-1):s=h+1}if(a>=e.hunks.length){const h=o[e.hunks.length];if(h==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:e.hunks.length,splitCount:h.splitCount,unifiedCount:h.unifiedCount}}const d=o[a];if(d==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:a,splitCount:d.splitCount,unifiedCount:d.unifiedCount}}function fa({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let i=0,r=0;const o=e.hunks.length-1,s=[{splitCount:0,unifiedCount:0}];for(let l=0;l<e.hunks.length;l++){const a=e.hunks[l];if(a==null)throw new Error("iterateOverDiff: invalid hunk summary index");const d=Qe({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:l,collapsedContextThreshold:n}),h=d.fromStart+d.fromEnd;i+=h+a.splitLineCount,r+=h+a.unifiedLineCount;const c=l===o?Je({fileDiff:e,hunkIndex:l,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:"iterateOverDiff"}):void 0;if(c!=null){const u=c.fromStart+c.fromEnd;i+=u,r+=u}s.push({splitCount:i,unifiedCount:r})}return s}function pa(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];const i=[];function r(l){const a=Math.max(0,e.viewportStart-l),d=Math.min(t,e.viewportEnd-l);d>a&&i.push([a,d])}if(n!=="split"&&r(e.unifiedCount),n!=="unified"&&r(e.splitCount),i.length===0)return[0,0];let o=i[0][0],s=i[0][1];for(let l=1;l<i.length;l++){const a=i[l];o=Math.min(o,a[0]),s=Math.max(s,a[1])}return[o,s]}function at(e,t,n,i,r,o){const[s,l]=pa(e,t,n);s>0&&(e.incrementCounts(s,s),r?.());let a=s;for(;a<t;){if(o?.()===!0)return!0;if(a>=l){e.incrementCounts(t-a,t-a);break}if(e.isInWindow(0,0)){if(i(a)===!0)return!0}else e.incrementCounts(1,1);a++}return!1}function ga(e,t,n){if(!e.isWindowedHighlight)return[[0,n==="unified"?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];const i=n!=="split",r=n!=="unified",o=n==="unified"?"unified":"split",s=[];function l(c,u){if(c+u<=e.viewportStart||c>=e.viewportEnd)return;const f=Math.max(0,e.viewportStart-c),g=Math.min(u,e.viewportEnd-c);return g>f?[f,g]:void 0}function a(c,u){return o==="split"?c:u==="additions"?[c[0]+t.deletions,c[1]+t.deletions]:c}function d(c,u){if(c==null)return;const[f,g]=a(c,u);g>f&&s.push([f,g])}if(i&&(d(l(e.unifiedCount,t.deletions),"deletions"),d(l(e.unifiedCount+t.deletions,t.additions),"additions")),r&&(d(l(e.splitCount,t.deletions),"deletions"),d(l(e.splitCount,t.additions),"additions")),s.length===0)return s;s.sort((c,u)=>c[0]-u[0]);const h=[s[0]];for(const[c,u]of s.slice(1)){const f=h[h.length-1];c<=f[1]?f[1]=Math.max(f[1],u):h.push([c,u])}return h}function ma({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,diffStyle:r,index:o,unifiedLineIndex:s,splitLineIndex:l,additionLineIndex:a,deletionLineIndex:d,additionLineNumber:h,deletionLineNumber:c,content:u,isLastContent:f,unifiedCount:g,splitCount:b}){const y=o<u.deletions?s+o:void 0,m=r==="unified"?o>=u.deletions?s+o:void 0:o<u.additions?s+u.deletions+o:void 0,p=r==="unified"?l+(o<u.deletions?o:o-u.deletions):l+o,C=o<u.deletions?d+o:void 0,v=o<u.deletions?c+o:void 0,x=r==="unified"?o>=u.deletions?a+(o-u.deletions):void 0:o<u.additions?a+o:void 0,S=r==="unified"?o>=u.deletions?h+(o-u.deletions):void 0:o<u.additions?h+o:void 0,L=r==="unified"?f&&o===u.deletions-1&&t.noEOFCRDeletions:f&&o===b-1&&t.noEOFCRDeletions,E=r==="unified"?f&&o===g-1&&t.noEOFCRAdditions:f&&o===b-1&&t.noEOFCRAdditions,w=C!=null&&v!=null&&y!=null?{lineNumber:v,lineIndex:C,noEOFCR:L,unifiedLineIndex:y,splitLineIndex:p}:void 0,R=x!=null&&S!=null&&m!=null?{unifiedLineIndex:m,splitLineIndex:p,lineIndex:x,lineNumber:S,noEOFCR:E}:void 0;if(w==null&&R!=null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:void 0,additionLine:R};if(w!=null&&R==null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,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:n,collapsedBefore:i,deletionLine:w,additionLine:R}}const va={forcePlainText:!1};function ba(e,t,n,{forcePlainText:i,startingLine:r,totalLines:o,expandedHunks:s,collapsedContextThreshold:l=1}=va){i?(r??=0,o??=1/0):(r=0,o=1/0);const a=r>0||o<1/0,d=typeof n.theme=="string"?t.getTheme(n.theme).type:void 0,h=fn({theme:n.theme,highlighter:t}),c=i&&!a&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,u={deletionLines:[],additionLines:[]},{maxLineDiffLength:f}=n,g=!i&&!e.isPartial,b=i?s:void 0,y=new Map;function m(C){const v=g?0:C,x=y.get(v)??Sa();return y.set(v,x),x}function p(C,v,x,S){if(a){let L=x.at(-1);(L==null||L.targetIndex+L.count!==v)&&(L={targetIndex:v,originalOffset:S.length,count:0},x.push(L)),L.count++}S.push(C)}qe({diff:e,diffStyle:"both",startingLine:r,totalLines:o,expandedHunks:a?b:!0,collapsedContextThreshold:l,callback:({hunkIndex:C,additionLine:v,deletionLine:x,type:S})=>{const L=m(C),E=v!=null?v.splitLineIndex:x.splitLineIndex;S==="change"&&v!=null&&x!=null&&Ca({additionLine:e.additionLines[v.lineIndex],deletionLine:e.deletionLines[x.lineIndex],deletionLineIndex:L.deletionContent.length,additionLineIndex:L.additionContent.length,deletionDecorations:L.deletionDecorations,additionDecorations:L.additionDecorations,lineDiffType:c,maxLineDiffLength:f}),x!=null&&(p(e.deletionLines[x.lineIndex],x.lineIndex,L.deletionSegments,L.deletionContent),L.deletionInfo.push({type:S==="change"?"change-deletion":S,lineNumber:x.lineNumber,altLineNumber:S==="change"?void 0:v.lineNumber??void 0,lineIndex:`${x.unifiedLineIndex},${E}`})),v!=null&&(p(e.additionLines[v.lineIndex],v.lineIndex,L.additionSegments,L.additionContent),L.additionInfo.push({type:S==="change"?"change-addition":S,lineNumber:v.lineNumber,altLineNumber:S==="change"?void 0:x.lineNumber??void 0,lineIndex:`${v.unifiedLineIndex},${E}`}))}});for(const C of y.values()){if(C.deletionContent.length===0&&C.additionContent.length===0)continue;const v={name:e.prevName??e.name,contents:C.deletionContent.value},x={name:e.name,contents:C.additionContent.value},{deletionLines:S,additionLines:L}=ya({deletionFile:v,deletionInfo:C.deletionInfo,deletionDecorations:C.deletionDecorations,additionFile:x,additionInfo:C.additionInfo,additionDecorations:C.additionDecorations,highlighter:t,options:n,languageOverride:i?"text":e.lang});if(g){u.deletionLines=S,u.additionLines=L;continue}if(C.deletionSegments.length>0)for(const E of C.deletionSegments)for(let w=0;w<E.count;w++)u.deletionLines[E.targetIndex+w]=S[E.originalOffset+w];else u.deletionLines.push(...S);if(C.additionSegments.length>0)for(const E of C.additionSegments)for(let w=0;w<E.count;w++)u.additionLines[E.targetIndex+w]=L[E.originalOffset+w];else u.additionLines.push(...L)}return{code:u,themeStyles:h,baseThemeType:d}}function Ca({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:i,deletionDecorations:r,additionDecorations:o,lineDiffType:s,maxLineDiffLength:l}){if(e==null||t==null||s==="none"||(e=xe(e),t=xe(t),e.length>l||t.length>l))return;const a=s==="char"?Xs(e,t):Zs(e,t),d=[],h=[],c=s==="word-alt",u=a.at(-1);for(const g of a){const b=g===u;!g.added&&!g.removed?(st({item:g,arr:d,enableJoin:c,isNeutral:!0,isLastItem:b}),st({item:g,arr:h,enableJoin:c,isNeutral:!0,isLastItem:b})):g.removed?st({item:g,arr:d,enableJoin:c,isLastItem:b}):st({item:g,arr:h,enableJoin:c,isLastItem:b})}let f=0;for(const g of d)g[0]===1&&r.push(jn({line:n,spanStart:f,spanLength:g[1].length})),f+=g[1].length;f=0;for(const g of h)g[0]===1&&o.push(jn({line:i,spanStart:f,spanLength:g[1].length})),f+=g[1].length}function Sa(){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 ya({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:i,highlighter:r,deletionDecorations:o,additionDecorations:s,languageOverride:l,options:{theme:a=_,...d}}){const h=l??Q(e.name),c=l??Q(t.name),{state:u,transformers:f}=Ji(d.useTokenTransformer),g=typeof a=="string"?{...d,lang:"text",theme:a,transformers:f,decorations:void 0,defaultColor:!1,cssVariablePrefix:B("token"),tokenizeTimeLimit:0}:{...d,lang:"text",themes:a,transformers:f,decorations:void 0,defaultColor:!1,cssVariablePrefix:B("token"),tokenizeTimeLimit:0};return{deletionLines:e.contents===""?[]:(g.lang=h,u.lineInfo=n,g.decorations=o,Kt(r.codeToHast(xe(e.contents),g))),additionLines:t.contents===""?[]:(g.lang=c,g.decorations=s,u.lineInfo=i,Kt(r.codeToHast(xe(t.contents),g)))}}function nn(e){const t=e.lang??Q(e.name),n=e.lang??(e.prevName!=null?Q(e.prevName):"text");return t==="text"&&n==="text"}let xa=-1;var Cr=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++xa}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang="text";renderCache;constructor(e={theme:_},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Ge(e.theme??_)?Ki():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}clearRenderCache(){this.renderCache=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){const i={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t==="up"||t==="both")&&(i.fromStart+=n),(t==="down"||t==="both")&&(i.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,i)}getExpandedHunk(e){return this.expandedHunks.get(e)??no}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(const t of e){const n=(()=>{switch(t.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),i=n[t.lineNumber]??[];n[t.lineNumber]=i,i.push(t)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return t!=="change"?{gutterLineType:t}:{gutterLineType:e==="deletions"?"change-deletion":"change-addition"}}createAnnotationElement=e=>qt(e);getOptionsWithDefaults(){const{diffIndicators:e="bars",diffStyle:t="split",disableBackground:n=!1,disableFileHeader:i=!1,disableLineNumbers:r=!1,disableVirtualizationBuffers:o=!1,collapsed:s=!1,expandUnchanged:l=!1,collapsedContextThreshold:a=1,expansionLineCount:d=100,hunkSeparators:h="line-info",lineDiffType:c="word-alt",maxLineDiffLength:u=1e3,overflow:f="scroll",stickyHeader:g=!1,theme:b=_,headerRenderMode:y="default",tokenizeMaxLineLength:m=1e3,tokenizeMaxLength:p=Zr,useTokenTransformer:C=!1,useCSSClasses:v=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:i,disableLineNumbers:r,disableVirtualizationBuffers:o,collapsed:s,expandUnchanged:l,collapsedContextThreshold:a,expansionLineCount:d,hunkSeparators:h,lineDiffType:c,maxLineDiffLength:u,overflow:f,stickyHeader:g,theme:this.workerManager?.getDiffRenderOptions().theme??b,headerRenderMode:y,tokenizeMaxLineLength:m,tokenizeMaxLength:p,useTokenTransformer:C,useCSSClasses:v}}async initializeHighlighter(){return this.highlighter=await xt(un(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;const{options:t}=this.getRenderOptions(e),n=Ut(e,this.getTokenizeMaxLength());let i=this.workerManager?.getDiffResultCache(e);i!=null&&!Fe(t,i.options)&&(i=void 0),this.renderCache??={diff:e,highlighted:!n&&!nn(e),options:t,result:n?void 0:i?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter==null&&(this.computedLang=e.lang??Q(e.name),this.initializeHighlighter())}getRenderOptions(e){const t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();const{theme:i,tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}=this.getOptionsWithDefaults();return{theme:i,useTokenTransformer:tr(this.options),tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}})();this.getOptionsWithDefaults();const{renderCache:n}=this;return n?.result==null?{options:t,forceHighlight:!0}:!Be(e,n.diff)||!Fe(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Ae){if(e==null)return;const{expandUnchanged:n=!1,collapsedContextThreshold:i}=this.getOptionsWithDefaults();let{options:r,forceHighlight:o}=this.getRenderOptions(e);const s=this.getMatchingWorkerResultCache(e,r);s!=null&&!this.hasHighlightedRenderCache(e,r)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...s},o=!1),this.renderCache??={diff:e,highlighted:!1,options:r,result:void 0,renderRange:void 0};const l=e.additionLines.length>0||e.deletionLines.length>0,a=!l||nn(e)||Ut(e,this.getTokenizeMaxLength()),d=!Be(e,this.renderCache.diff),h=!Lt(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(a||this.renderCache.result==null||!this.renderCache.highlighted&&(d||h))&&(this.renderCache.diff=e,this.renderCache.options=r,this.renderCache.highlighted=!1,(this.renderCache.result==null||d||h||o)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,da(t)||n?!0:this.expandedHunks,i)),this.renderCache.renderRange=t),!a&&l&&(!this.renderCache.highlighted||o)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??Q(e.name);const c=this.highlighter!=null&&Ge(r.theme),u=this.highlighter!=null&&mt(this.computedLang),f=!a&&u;if(this.highlighter!=null&&c&&(o||a||!this.renderCache.highlighted&&f||this.renderCache.result==null)){const{result:g,options:b}=this.renderDiffWithHighlighter(e,this.highlighter,a||!u);this.renderCache={diff:e,options:b,highlighted:f,result:g,renderRange:void 0}}(!c||!a&&!u)&&this.asyncHighlight(e).then(({result:g,options:b})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,g,b,!a)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=Ae){const{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){const{diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:s}=this.getOptionsWithDefaults();return Xi({type:"diff",diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:s,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){const t=Ut(e,this.getTokenizeMaxLength());this.computedLang=t?"text":e.lang??Q(e.name);const n=this.highlighter!=null&&Ge(this.options.theme??_),i=t||this.highlighter!=null&&mt(this.computedLang);return(this.highlighter==null||!n||!i)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e),{collapsedContextThreshold:r}=this.getOptionsWithDefaults();return{result:ba(e,t,i,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:r}),options:i}}onHighlightSuccess(e,t,n,i=!0){if(this.renderCache==null)return;const r=!this.renderCache.highlighted||!Fe(this.renderCache.options,n)||!Be(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:i,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){const n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!Fe(t,n.options)))return n}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Be(e,n.diff)&&Fe(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){const{diffStyle:o,disableFileHeader:s,expandUnchanged:l,expansionLineCount:a,collapsedContextThreshold:d,hunkSeparators:h}=this.getOptionsWithDefaults();this.diff=e;const c=o==="unified";let u=[],f=[],g=[];const b=[],{additionLines:y,deletionLines:m}=n,p={rowCount:0,hunkSeparators:h,additionsContentAST:u,deletionsContentAST:f,unifiedContentAST:g,unifiedGutterAST:Ee(),deletionsGutterAST:Ee(),additionsGutterAST:Ee(),expansionLineCount:a,hunkData:b,incrementRowCount(T=1){p.rowCount+=T},pushToGutter(T,M){switch(T){case"unified":p.unifiedGutterAST.children.push(M);break;case"deletions":p.deletionsGutterAST.children.push(M);break;case"additions":p.additionsGutterAST.children.push(M);break}}},C=mr({fileDiff:e,errorPrefix:"DiffHunksRenderer.processDiffResult"}),v={size:0,side:void 0,increment(){this.size+=1},flush(){if(o!=="unified"){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side==="additions"?(p.pushToGutter("additions",j(void 0,"buffer",this.size)),u?.push(rt(this.size))):(p.pushToGutter("deletions",j(void 0,"buffer",this.size)),f?.push(rt(this.size))),this.size=0,this.side=void 0}}},x=(T,M,N,G,D)=>{p.pushToGutter(T,Di(M,N,G,D))};function S(T){v.flush(),o==="unified"?zt("unified",T,p):(zt("deletions",T,p),zt("additions",T,p))}this.pushFileLevelAnnotations(e,o,t,p),qe({diff:e,diffStyle:o,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:l?!0:this.expandedHunks,collapsedContextThreshold:d,callback:({hunkIndex:T,hunk:M,collapsedBefore:N,collapsedAfter:G,additionLine:D,deletionLine:F,type:O})=>{const J=F!=null?F.splitLineIndex:D.splitLineIndex,me=D!=null?D.unifiedLineIndex:F.unifiedLineIndex;o==="split"&&O!=="change"&&v.flush(),N>0&&S({hunkIndex:T,collapsedLines:N,rangeSize:Math.max(M?.collapsedBefore??0,0),hunkSpecs:M?.hunkSpecs,isFirstHunk:T===0,isLastHunk:!1,isExpandable:!e.isPartial});const ve=o==="unified"?me:J,Le={type:O,hunkIndex:T,lineIndex:ve,unifiedLineIndex:me,splitLineIndex:J,deletionLine:F,additionLine:D};if(o==="unified"){const P=this.getUnifiedInjectedRowsForLine?.(Le);P?.before!=null&&Yn(P.before,p);let V=F!=null?m[F.lineIndex]:void 0,z=D!=null?y[D.lineIndex]:void 0;if(V==null&&z==null){const ne="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(ne,{file:e.name}),new Error(ne)}const de=O==="change"?D!=null?"change-addition":"change-deletion":O,te=this.getUnifiedLineDecoration({type:O,lineType:de,additionLineIndex:D?.lineIndex,deletionLineIndex:F?.lineIndex});x("unified",te.gutterLineType,D!=null?D.lineNumber:F.lineNumber,`${me},${J}`,te.gutterProperties),z!=null?z=dt(z,te.contentProperties):V!=null&&(V=dt(V,te.contentProperties)),lt({diffStyle:"unified",type:O,deletionLine:V,additionLine:z,unifiedSpan:this.getAnnotations("unified",F?.lineNumber,D?.lineNumber,T,ve),createAnnotationElement:ne=>this.createAnnotationElement(ne),context:p}),P?.after!=null&&Yn(P.after,p)}else{const P=this.getSplitInjectedRowsForLine?.(Le);P?.before!=null&&Xn(P.before,p,v);let V=F!=null?m[F.lineIndex]:void 0,z=D!=null?y[D.lineIndex]:void 0;const de=this.getSplitLineDecoration({side:"deletions",type:O,lineIndex:F?.lineIndex}),te=this.getSplitLineDecoration({side:"additions",type:O,lineIndex:D?.lineIndex});if(V==null&&z==null){const K="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(K,{file:e.name}),new Error(K)}const ne=(()=>{if(O==="change"){if(z==null)return"additions";if(V==null)return"deletions"}})();if(ne!=null){if(v.side!=null&&v.side!==ne)throw new Error("DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits");v.side=ne,v.increment()}const Pe=this.getAnnotations("split",F?.lineNumber,D?.lineNumber,T,ve);if(Pe!=null&&v.size>0&&v.flush(),F!=null){const K=dt(V,de.contentProperties);x("deletions",de.gutterLineType,F.lineNumber,`${F.unifiedLineIndex},${J}`,de.gutterProperties),K!=null&&(V=K)}if(D!=null){const K=dt(z,te.contentProperties);x("additions",te.gutterLineType,D.lineNumber,`${D.unifiedLineIndex},${J}`,te.gutterProperties),K!=null&&(z=K)}lt({diffStyle:"split",type:O,additionLine:z,deletionLine:V,...Pe,createAnnotationElement:K=>this.createAnnotationElement(K),context:p}),P?.after!=null&&Xn(P.after,p,v)}const ee=o==="split"&&M!=null&&J===M.splitLineStart+M.splitLineCount-1,be=ee?M.noEOFCRDeletions:!1,le=ee?M.noEOFCRAdditions:!1,q=(F?.noEOFCR??!1)||be,ye=(D?.noEOFCR??!1)||le;if(ye||q){if(o==="split"&&v.flush(),q){const P=O==="context"||O==="context-expanded"?O:"change-deletion";o==="unified"?(p.unifiedContentAST.push(ot(P)),p.pushToGutter("unified",j(P,"metadata",1))):(p.deletionsContentAST.push(ot(P)),p.pushToGutter("deletions",j(P,"metadata",1)),ye||(p.pushToGutter("additions",j(void 0,"buffer",1)),p.additionsContentAST.push(rt(1))))}if(ye){const P=O==="context"||O==="context-expanded"?O:"change-addition";o==="unified"?(p.unifiedContentAST.push(ot(P)),p.pushToGutter("unified",j(P,"metadata",1))):(p.additionsContentAST.push(ot(P)),p.pushToGutter("additions",j(P,"metadata",1)),q||(p.pushToGutter("deletions",j(void 0,"buffer",1)),p.deletionsContentAST.push(rt(1))))}p.incrementRowCount(1)}G>0&&h!=="simple"&&S({hunkIndex:O==="context-expanded"?T:T+1,collapsedLines:G,rangeSize:C,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),p.incrementRowCount(1)}}),o==="split"&&v.flush();const L=Math.max(la(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),E=t.bufferBefore>0||t.bufferAfter>0,w=!c&&e.type!=="deleted",R=!c&&e.type!=="new",H=p.rowCount>0||E;u=w&&H?u:void 0,f=R&&H?f:void 0,g=c&&H?g:void 0;const I=this.createPreElement(f!=null&&u!=null,L);return{unifiedGutterAST:c&&H?p.unifiedGutterAST.children:void 0,unifiedContentAST:g,deletionsGutterAST:R&&H?p.deletionsGutterAST.children:void 0,deletionsContentAST:f,additionsGutterAST:w&&H?p.additionsGutterAST.children:void 0,additionsContentAST:u,hunkData:b,preNode:I,themeStyles:i,baseThemeType:r,headerElement:s?void 0:this.renderHeader(this.diff),totalLines:L,rowCount:p.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){const n=e==="unified"?t.unifiedGutterAST:e==="deletions"?t.deletionsGutterAST:t.additionsGutterAST,i=e==="unified"?t.unifiedContentAST:e==="deletions"?t.deletionsContentAST:t.additionsContentAST;if(n==null||i==null)return;const r=Ee(n);return r.properties.style=`grid-row: span ${t.rowCount}`,[r,er(i,t.rowCount)]}renderFullAST(e,t=[]){const n=this.getOptionsWithDefaults().hunkSeparators==="line-info",i=this.renderCodeAST("unified",e);if(i!=null)return t.push(A({tagName:"code",children:i,properties:{"data-code":"","data-container-size":n?"":void 0,"data-unified":""}})),{...e.preNode,children:t};const r=this.renderCodeAST("deletions",e);r!=null&&t.push(A({tagName:"code",children:r,properties:{"data-code":"","data-container-size":n?"":void 0,"data-deletions":""}}));const o=this.renderCodeAST("additions",e);return o!=null&&t.push(A({tagName:"code",children:o,properties:{"data-code":"","data-container-size":n?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return pe(this.renderFullAST(e,t))}renderPartialHTML(e,t){return t==null?pe(e):pe(A({tagName:"code",children:e,properties:{"data-code":"","data-container-size":this.getOptionsWithDefaults().hunkSeparators==="line-info"?"":void 0,[`data-${t}`]:""}}))}pushFileLevelAnnotations(e,t,n,i){if(!kt(n))return;const r=e.type!=="new"?qn(Xt(this.deletionAnnotations)):[],o=e.type!=="deleted"?qn(Xt(this.additionAnnotations)):[];if(r.length===0&&o.length===0)return;const s=-1,l=-1,{createAnnotationElement:a}=this;if(t==="unified"){lt({diffStyle:t,type:"context",unifiedSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r.concat(o)},createAnnotationElement:a,context:i});return}lt({diffStyle:t,type:"context",deletionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r},additionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:o},createAnnotationElement:a,context:i})}getAnnotations(e,t,n,i,r){const o={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(t!=null)for(const l of this.deletionAnnotations[t]??[])o.annotations.push(ge(l));const s={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(n!=null)for(const l of this.additionAnnotations[n]??[])(e==="unified"?o:s).annotations.push(ge(l));if(e==="unified")return o.annotations.length>0?o:void 0;if(!(s.annotations.length===0&&o.annotations.length===0))return{deletionSpan:o,additionSpan:s}}renderHeader(e){const{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return Yi({fileOrDiff:e,mode:t,stickyHeader:n})}};function qn(e){return e?.map(t=>ge(t))??[]}const La=new Intl.PluralRules("en-US");function Kn(e){return`${e} unmodified line${La.select(e)==="one"?"":"s"}`}function Yn(e,t){for(const n of e)t.unifiedContentAST.push(n.content),t.pushToGutter("unified",n.gutter),t.incrementRowCount(1)}function Xn(e,t,n){for(const{deletion:i,addition:r}of e){if(i==null&&r==null)continue;const o=i!=null&&r!=null?void 0:i==null?"deletions":"additions";(o==null||n.side!==o)&&n.flush(),i!=null&&(t.deletionsContentAST.push(i.content),t.pushToGutter("deletions",i.gutter)),r!=null&&(t.additionsContentAST.push(r.content),t.pushToGutter("additions",r.gutter)),o!=null&&(n.side=o,n.increment()),t.incrementRowCount(1)}}function lt({diffStyle:e,type:t,deletionLine:n,additionLine:i,unifiedSpan:r,deletionSpan:o,additionSpan:s,createAnnotationElement:l,context:a}){let d=!1;if(e==="unified"){if(i!=null?a.unifiedContentAST.push(i):n!=null&&a.unifiedContentAST.push(n),r!=null){const h=t==="change"?n!=null?"change-deletion":"change-addition":t;a.unifiedContentAST.push(l(r)),a.pushToGutter("unified",j(h,"annotation",1)),d=!0}}else if(e==="split"){if(n!=null&&a.deletionsContentAST.push(n),i!=null&&a.additionsContentAST.push(i),o!=null){const h=t==="change"?n!=null?"change-deletion":"context":t;a.deletionsContentAST.push(l(o)),a.pushToGutter("deletions",j(h,"annotation",1)),d=!0}if(s!=null){const h=t==="change"?i!=null?"change-addition":"context":t;a.additionsContentAST.push(l(s)),a.pushToGutter("additions",j(h,"annotation",1)),d=!0}}d&&a.incrementRowCount(1)}function zt(e,{hunkIndex:t,collapsedLines:n,rangeSize:i,hunkSpecs:r,isFirstHunk:o,isLastHunk:s,isExpandable:l},a){if(n<=0)return;const d=e==="unified"?a.unifiedContentAST:e==="deletions"?a.deletionsContentAST:a.additionsContentAST;if(a.hunkSeparators==="metadata"){r!=null&&(a.pushToGutter(e,ke({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),d.push(ke({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1));return}if(a.hunkSeparators==="simple"){t>0&&(a.pushToGutter(e,ke({type:"simple",isFirstHunk:o,isLastHunk:!1})),d.push(ke({type:"simple",isFirstHunk:o,isLastHunk:!1})),e!=="additions"&&a.incrementRowCount(1));return}const h=aa(e,t),c=i>a.expansionLineCount,u=l?t:void 0;a.pushToGutter(e,ke({type:a.hunkSeparators,content:Kn(n),expandIndex:u,chunked:c,slotName:h,isFirstHunk:o,isLastHunk:s})),d.push(ke({type:a.hunkSeparators,content:Kn(n),expandIndex:u,chunked:c,slotName:h,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1),a.hunkData.push({slotName:h,hunkIndex:t,lines:n,type:e,expandable:l?{up:!o,down:!s,chunked:c}:void 0})}function dt(e,t){return e==null||e.type!=="element"||t==null?e:{...e,properties:{...e.properties,...t}}}function Ut(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function ka(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function wa(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function Ea(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:e?.useTokenTransformer,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,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader!=null?"custom":"default"}}let Ta=-1;var Sr=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Ta}`;type="file-diff";fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;constructor(e={theme:_},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new _i,this.scrollSyncManager=new sa,this.interactionManager=new Pi("diff",Ke(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()};getHunksRendererOptions(e){return Ea(e)}createHunksRenderer(e){return new Cr(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t="additions")=>{if(this.fileDiff==null)return;const n=this.fileDiff.hunks.at(-1);let i,r;e:for(const o of this.fileDiff.hunks){let s=t==="deletions"?o.deletionStart:o.additionStart;const l=t==="deletions"?o.deletionCount:o.additionCount;let a=o.splitLineStart,d=o.unifiedLineStart;if(e<s){const h=s-e;i=Math.max(d-h,0),r=Math.max(a-h,0);break e}if(e>=s+l){if(o===n){const h=e-(s+l);i=d+o.unifiedLineCount+h,r=a+o.splitLineCount+h;break e}continue}for(const h of o.hunkContent)if(h.type==="context")if(e<s+h.lines){const c=e-s;r=a+c,i=d+c;break e}else s+=h.lines,a+=h.lines,d+=h.lines;else{const c=t==="deletions"?h.deletions:h.additions;if(e<s+c){const u=e-s;i=d+(t==="additions"?h.deletions:0)+u,r=a+u;break e}else s+=c,a+=Math.max(h.deletions,h.additions),d+=h.deletions+h.additions}break e}if(!(i==null||r==null))return[i,r]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Ke(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;const 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&&!De(this.appliedThemeCSS.theme,this.options.theme??_)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators=="function")}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}const{diffStyle:e="split",overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,t==="wrap"),t==="scroll"&&e==="split"?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),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.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){const{fileContainer:t,prerenderedHTML:n,preventEmit:i=!1,lineAnnotations:r,oldFile:o,newFile:s,fileDiff:l}=e;this.hydrateElements(t,n),Aa(this.pre,Ia({fileDiff:l,oldFile:o,newFile:s}),this.options.collapsed)||Ha(this.headerElement,Ra({fileDiff:l,oldFile:o,newFile:s}),this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:l,oldFile:o,newFile:s,lineAnnotations:r}),i||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),dr(e,t);for(const n of e.shadowRoot?.children??[]){if(n instanceof SVGElement){this.spriteSVG=n;continue}if(n instanceof HTMLElement){if(n instanceof HTMLPreElement){this.pre=n;for(const i of n.children)!(i instanceof HTMLElement)||i.tagName.toLowerCase()!=="code"||("deletions"in i.dataset&&(this.codeDeletions=i),"additions"in i.dataset&&(this.codeAdditions=i),"unified"in i.dataset&&(this.codeUnified=i));continue}if("diffsHeader"in n.dataset){this.headerElement=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-theme-css")){this.themeCSSStyle=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=n,this.appliedUnsafeCSS=n.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:n,lineAnnotations:i}){this.lineAnnotations=i??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!=null&&n!=null?tn(t,n,this.options.parseDiffOptions):void 0),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.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()};render({oldFile:e,newFile:t,fileDiff:n,deferManagers:i=!1,forceRender:r=!1,preventEmit:o=!1,lineAnnotations:s,fileContainer:l,containerWrapper:a,renderRange:d}){if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");const{collapsed:h=!1,themeType:c="system"}=this.options,u=h?void 0:d,f=this.hasThemeChanged(),g=e!=null&&t!=null&&(!ae(e,this.deletionFile)||!ae(t,this.additionFile));let b=n!=null&&n!==this.fileDiff;const y=s!=null&&(s.length>0||this.lineAnnotations.length>0)?s!==this.lineAnnotations:!1;if(!h&&Lt(u,this.renderRange)&&!r&&!y&&!f&&(n!=null&&n===this.fileDiff||n==null&&!g))return this.applyCachedThemeState(c);const{renderRange:m}=this;if(this.renderRange=u,this.deletionFile=e,this.additionFile=t,n!=null?this.fileDiff=n:e!=null&&t!=null&&g&&(b=!0,this.fileDiff=tn(e,t,this.options.parseDiffOptions)),b&&(this.cachedHeaderHTML=void 0),s!=null&&this.setLineAnnotations(s),this.fileDiff==null)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);const{disableErrorHandling:p=!1,disableFileHeader:C=!1}=this.options;if(C&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),l=this.getOrCreateFileContainer(l,a),this.applyCachedThemeState(c),h){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const v=this.hunksRenderer.renderDiff(this.fileDiff,Hi);v!=null&&this.applyThemeState(l,v.themeStyles,c,v.baseThemeType),v?.headerElement!=null&&this.applyHeaderToDOM(v.headerElement,l),this.renderSeparators([]),this.injectUnsafeCSS()}catch(v){if(p)throw v;console.error(v),v instanceof Error&&this.applyErrorToDOM(v,l)}return o||this.emitPostRender(),!0}try{const v=this.getOrCreatePreNode(l);if(!(this.canPartiallyRender(r,y,g||b||f)&&this.applyPartialRender({previousRenderRange:m,renderRange:u}))){const x=this.hunksRenderer.renderDiff(this.fileDiff,u);if(x==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(l,x.themeStyles,c,x.baseThemeType),x.headerElement!=null&&this.applyHeaderToDOM(x.headerElement,l),x.additionsContentAST!=null||x.deletionsContentAST!=null||x.unifiedContentAST!=null?this.applyHunksToDOM(v,x):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(x.hunkData)}this.applyBuffers(v,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,i||this.flushManagers()}catch(v){if(p)throw v;console.error(v),v instanceof Error&&this.applyErrorToDOM(v,l)}return o||this.emitPostRender(),!0}emitPostRender(e=!1){const{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,"unmount");return}if(t==null)return;const i=this.mounted?"update":"mount";this.mounted=!0,n?.(t,this,i)}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(const{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(const{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){const t=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",t.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}primeHighlightCache(){const{fileDiff:e,workerManager:t}=this;if(e==null||t==null||nn(e))return;const n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||t.primeDiffHighlightCache(e)}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.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.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.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){const{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!="function"){for(const{element:i}of this.separatorCache.values())i.remove();this.separatorCache.clear();return}const n=new Map(this.separatorCache);for(const i of e){const r=i.slotName;let o=this.separatorCache.get(r);if(o==null||!wa(i,o.hunkData)){o?.element.remove();const s=document.createElement("div");s.style.display="contents",s.slot=i.slotName;const l=t(i,this);l!=null&&s.appendChild(l),this.fileContainer.appendChild(s),o={element:s,hunkData:i},this.separatorCache.set(r,o)}n.delete(r)}for(const[i,{element:r}]of n.entries())this.separatorCache.delete(i),r.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(const{element:n}of this.annotationCache.values())n.remove();this.annotationCache.clear();return}const e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(const[n,i]of this.lineAnnotations.entries()){const r=`${n}-${ge(i)}`;let o=this.annotationCache.get(r);if(o==null||!ka(i,o.annotation)){o?.element.remove();const s=t(i);if(s==null)continue;o={element:pn(ge(i)),annotation:i},o.element.appendChild(s),this.fileContainer.appendChild(o.element),this.annotationCache.set(r,o)}e.delete(r)}for(const[n,{element:i}]of e.entries())this.annotationCache.delete(n),i.remove()}renderGutterUtility(){const{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const n=rr();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){const{fileContainer:n}=this,i=e??n??document.createElement("diffs-container"),r=n!==i;return r&&this.emitPostRender(!0),this.fileContainer=i,n!=null&&r&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),r&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){const{shadowRoot:t}=e;if(t!=null)for(const n of t.children)n instanceof SVGElement?this.spriteSVG??=n:Xe(n)&&n.hasAttribute("data-theme-css")?(this.themeCSSStyle??=n,this.hasAdoptedThemeCSS=!0):Xe(n)&&n.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle??=n,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});if(this.spriteSVG==null){const n=document.createElement("div");n.innerHTML=nr;const i=n.firstChild;i instanceof SVGElement&&(this.spriteSVG=i)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});return this.pre==null?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(const 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){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;const{fileDiff:n}=this,i=this.cachedHeaderHTML??pe(e);if(this.cachedHeaderHTML=i,i!==this.lastRenderedHeaderHTML){const d=document.createElement("div");d.innerHTML=i;const h=d.firstElementChild;if(!(h instanceof HTMLElement))return;this.headerElement!=null?t.shadowRoot?.replaceChild(h,this.headerElement):t.shadowRoot?.prepend(h),this.headerElement=h,this.lastRenderedHeaderHTML=i}if(this.isContainerManaged||n==null)return;const{renderCustomHeader:r,renderHeaderPrefix:o,renderHeaderMetadata:s}=this.options;if(r!=null){const d=r(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,an,d),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0;return}const l=o?.(n)??void 0,a=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,on,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,sn,a),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(i==null){t?.remove();return}const r=t??this.createHeaderSlotElement(n);return t==null&&e.appendChild(r),this.replaceHeaderSlotContent(r,i),r}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){const t=document.createElement("div");return t.slot=e,t}injectUnsafeCSS(){const{unsafeCSS:e}=this.options,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??=or(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=mn(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,i){const r=e.shadowRoot??e.attachShadow({mode:"open"}),o=i??n,s=this.options.theme??_,l=typeof s=="string"?s:{...s},a=Me(r);if(this.themeCSSStyle?.parentNode===r&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===o&&this.appliedThemeCSS.scrollbarGutter===a){this.appliedThemeCSS.theme=l;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===r){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a};return}this.themeCSSStyle=Cn({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:vn(t,o,a)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a}:void 0}hydrateMeasuredScrollbar(){const e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=lr(this.themeCSSStyle.textContent??"",Me(e)))}applyHunksToDOM(e,t){const{overflow:n="scroll"}=this.options,i=(this.options.hunkSeparators??"line-info")==="line-info",r=n==="wrap"?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let o=!1;const s=[],l=this.hunksRenderer.renderCodeAST("unified",t),a=this.hunksRenderer.renderCodeAST("deletions",t),d=this.hunksRenderer.renderCodeAST("additions",t);l!=null?(o=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=je({code:this.codeUnified,columnType:"unified",rowSpan:r,containerSize:i}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(l),s.push(this.codeUnified)):a!=null||d!=null?(a!=null?(o=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=je({code:this.codeDeletions,columnType:"deletions",rowSpan:r,containerSize:i}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(a),s.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),d!=null?(o=o||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=je({code:this.codeAdditions,columnType:"additions",rowSpan:r,containerSize:i}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(d),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="":o&&e.replaceChildren(...s),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){const{pre:n,codeUnified:i,codeAdditions:r,codeDeletions:o,options:{diffStyle:s="split"}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;const l=this.getCodeColumns(s,i,o,r);if(l==null)return!1;const a=e.startingLine,d=t.startingLine,h=a+e.totalLines,c=d+t.totalLines,u=Math.max(a,d),f=Math.min(h,c);if(f<=u)return!1;const g=Math.max(0,u-a),b=Math.max(0,h-f),y=this.trimColumns({columns:l,trimStart:g,trimEnd:b,previousStart:a,overlapStart:u,overlapEnd:f,diffStyle:s});if(y<0)throw new Error("applyPartialRender: failed to trim to overlap");if(this.lastRowCount<y)throw new Error("applyPartialRender: trimmed beyond DOM row count");let m=this.lastRowCount-y;const p=(S,L)=>{if(!(L<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:S,totalLines:L,bufferBefore:0,bufferAfter:0})},C=p(d,Math.max(u-d,0));if(C==null&&d<u)return!1;const v=p(f,Math.max(c-f,0));if(v==null&&c>f)return!1;const x=(S,L)=>{if(S!=null){if(s==="unified"&&!Array.isArray(l))this.insertPartialHTML(s,l,S,L);else if(s==="split"&&Array.isArray(l))this.insertPartialHTML(s,l,S,L);else throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");m+=S.rowCount}};return this.cleanupErrorWrapper(),x(C,"afterbegin"),x(v,"beforeend"),this.lastRowCount!==m&&(this.applyRowSpan(s,l,m),this.lastRowCount=m),!0}insertPartialHTML(e,t,n,i){if(e==="unified"&&!Array.isArray(t)){const r=this.hunksRenderer.renderCodeAST("unified",n);this.renderPartialColumn(t,r,i)}else if(e==="split"&&Array.isArray(t)){const r=this.hunksRenderer.renderCodeAST("deletions",n),o=this.hunksRenderer.renderCodeAST("additions",n);this.renderPartialColumn(t[0],r,i),this.renderPartialColumn(t[1],o,i)}else throw new Error("FileDiff.insertPartialHTML: Invalid argument composition")}renderPartialColumn(e,t,n){if(e==null||t==null)return;const i=Qn(t[0]),r=Qn(t[1]);if(i==null||r==null)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");const o=r.at(0);n==="beforeend"&&o?.type==="element"&&typeof o.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(o.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],i,r,!0);const s=r.at(-1);n==="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],i,r,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r))}mergeBuffersIfNecessary(e,t,n,i,r,o){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;const s=this.getBufferSize(t.dataset);s!=null&&(o?(i.shift(),r.shift()):(i.pop(),r.pop()),this.updateBufferSize(t,s+e),this.updateBufferSize(n,s+e))}applyRowSpan(e,t,n){const i=r=>{r!=null&&(r.gutter.style.setProperty("grid-row",`span ${n}`),r.content.style.setProperty("grid-row",`span ${n}`))};if(e==="unified"&&!Array.isArray(t))i(t);else if(e==="split"&&Array.isArray(t))i(t[0]),i(t[1]);else throw new Error("dun fuuuuked up")}trimColumnRows(e,t,n){let i=0,r=0,o=0,s=!1;const l=n>=0;if(e==null)return 0;const a=Array.from(e.content.children),d=Array.from(e.gutter.children);if(a.length!==d.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;o<a.length&&!(t<=0&&!l&&!s);){const h=d[o],c=a[o];if(o++,!(h instanceof HTMLElement)||!(c instanceof HTMLElement))throw console.error({gutterElement:h,contentElement:c}),new Error("FileDiff.trimColumnRows: invalid row elements");if(s&&(s=!1,h.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in c.dataset||h.dataset.gutterBuffer==="metadata"&&"noNewline"in c.dataset)){h.remove(),c.remove(),r++;continue}if("lineIndex"in h.dataset&&"lineIndex"in c.dataset){(t>0||l&&i>=n)&&(h.remove(),c.remove(),t>0&&(t--,t===0&&(s=!0)),r++),i++;continue}if("separator"in h.dataset&&"separator"in c.dataset){(t>0||l&&i>=n)&&(h.remove(),c.remove(),r++);continue}if(h.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in c.dataset){(t>0||l&&i>=n)&&(h.remove(),c.remove(),r++);continue}if(h.dataset.gutterBuffer==="metadata"&&"noNewline"in c.dataset){(t>0||l&&i>=n)&&(h.remove(),c.remove(),r++);continue}if(h.dataset.gutterBuffer==="buffer"&&"contentBuffer"in c.dataset){const u=this.getBufferSize(c.dataset);if(u==null)throw new Error("FileDiff.trimColumnRows: invalid element");if(t>0){const f=Math.min(t,u),g=u-f;g>0?(this.updateBufferSize(h,g),this.updateBufferSize(c,g),r+=f):(h.remove(),c.remove(),r+=u),t-=f,t===0&&g===0&&(s=!0)}else if(l){const f=i,g=i+u-1;if(n<=f)h.remove(),c.remove(),r+=u;else if(n<=g){const b=g-n+1,y=u-b;this.updateBufferSize(h,y),this.updateBufferSize(c,y),r+=b}}i+=u;continue}throw console.error({gutterElement:h,contentElement:c}),new Error("FileDiff.trimColumnRows: unknown row elements")}return r}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:i,previousStart:r,trimEnd:o,trimStart:s}){const l=Math.max(0,i-r),a=n-r;if(a<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");const d=s>0,h=o>0;if(!d&&!h)return 0;const c=d?l:0,u=h?a:-1;if(t==="unified"&&!Array.isArray(e))return this.trimColumnRows(e,c,u);if(t==="split"&&Array.isArray(e)){const f=this.trimColumnRows(e[0],c,u),g=this.trimColumnRows(e[1],c,u);if(e[0]!=null&&e[1]!=null&&f!==g)throw new Error("FileDiff.trimColumns: split columns out of sync");return e[0]!=null?f:g}else throw console.error({diffStyle:t,columns:e}),new Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(e){const t=Number.parseInt(e?.bufferSize??"",10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty("grid-row",`span ${t}`),e.style.setProperty("min-height",`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,i){function r(o){if(o==null)return;const s=o.children[0],l=o.children[1];if(!(!(s instanceof HTMLElement)||!(l instanceof HTMLElement)||s.dataset.gutter==null||l.dataset.content==null))return{gutter:s,content:l}}if(e==="unified")return r(t);{const o=r(n),s=r(i);return o!=null||s!=null?[o,s]:void 0}}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:n,totalLines:i},r){const{diffIndicators:o="bars",disableBackground:s=!1,disableLineNumbers:l=!1,overflow:a="scroll",diffStyle:d="split"}=this.options,h={type:"diff",diffIndicators:o,disableBackground:s,disableLineNumbers:l,overflow:a,split:d==="unified"?!1:t!=null&&n!=null,totalLines:i,customProperties:r};ir(h,this.appliedPreAttributes)||(bn(e,h),this.appliedPreAttributes=h)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const n=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",n.appendChild(this.errorWrapper);const i=document.createElement("div");i.dataset.errorMessage="",i.innerText=e.message,this.errorWrapper.appendChild(i);const r=document.createElement("pre");r.dataset.errorStack="",r.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(r)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Ia({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Ra({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Aa(e,t,n=!1){return!n&&e==null&&t}function Ha(e,t,n=!1){return e==null&&t&&!n}function Qn(e){if(!(e==null||e.type!=="element"))return e.children??[]}function Ma({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:i,expandUnchanged:r,expandedHunks:o,collapsedContextThreshold:s}){let l=se(t,n),a=l;const d=r?!0:o,h=e.hunks.length-1;for(let c=0;c<e.hunks.length;c++){const u=e.hunks[c];if(u==null)throw new Error("computeEstimatedDiffHeights: invalid hunk index");const f=Qe({isPartial:e.isPartial,rangeSize:u.collapsedBefore,expandedHunks:d,hunkIndex:c,collapsedContextThreshold:s}),g=(f.fromStart+f.fromEnd)*t.lineHeight;if(l+=g,a+=g,f.collapsedLines>0){const m=$e({type:i,metrics:t,hunkIndex:c,hunkSpecs:u.hunkSpecs})?.totalHeight??0;l+=m,a+=m}l+=u.splitLineCount*t.lineHeight,a+=u.unifiedLineCount*t.lineHeight;const b=Da(u);l+=b.split*t.lineHeight,a+=b.unified*t.lineHeight;const y=c===h?Je({fileDiff:e,hunkIndex:c,expandedHunks:d,collapsedContextThreshold:s,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(y!=null){const m=(y.fromStart+y.fromEnd)*t.lineHeight;if(l+=m,a+=m,y.collapsedLines>0){const p=We({type:i,metrics:t})?.totalHeight??0;l+=p,a+=p}}}if(e.hunks.length>0){const c=yt(t);l+=c,a+=c}return{splitHeight:l,unifiedHeight:a}}function Da(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};const t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type==="context"){const n=t.lines>0?1:0;return{split:n,unified:n}}return Pa(e,t)}function Pa(e,t){const n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),i=t.deletions>0&&e.noEOFCRDeletions,r=t.additions>0&&e.noEOFCRAdditions;return{split:i||r?1:0,unified:n}}const rn=5e3;let _a=-1;var Oa=class extends Sr{__id=`little-virtualized-file-diff:${++_a}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n,i,r=!1){super(e,i,r),this.virtualizer=t,this.metrics=_t(n)}setMetrics(e,t=!1){const n=_t(e);!t&&He(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){const t=this.cache.fileAnnotationHeight;return e===t?!1:(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!Yt(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber!==0?!1:e.type==="new"?t.side==="additions":e.type==="deleted"?t.side==="deletions":!0)}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){const 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;const{options:t}=this,n=!dn(t,e),i=n&&Ba(t,e);super.setOptions(e),i&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:$a(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,i)}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}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1;const{overflow:t="scroll"}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t==="scroll"&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;const n=this.getDiffStyle(),i=n==="split"?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],r=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&r&&kt(this.renderRange)){const o=Na(i)??0;this.setFileAnnotationHeight(o)&&(e=!0)}else!r&&this.setFileAnnotationHeight(0)&&(e=!0);for(const o of i){if(o==null)continue;const s=o.children[1];if(s instanceof HTMLElement)for(const l of s.children){if(!(l instanceof HTMLElement))continue;const a=l.dataset.lineIndex;if(a==null)continue;const d=Ga(a,n);let h=l.getBoundingClientRect().height,c=!1;l.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in l.nextElementSibling.dataset||"noNewline"in l.nextElementSibling.dataset)&&("noNewline"in l.nextElementSibling.dataset&&(c=!0),h+=l.nextElementSibling.getBoundingClientRect().height);const u=this.getEstimatedLineHeight(c),f=this.cache.heightDeltas.get(d)??0,g=h-u;g!==f&&(e=!0,this.cache.measuredHeightDeltaTotal+=g-f,g===0?this.cache.heightDeltas.delete(d):this.cache.heightDeltas.set(d,g))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render());prepareCodeViewItem(e,t,n,i){const r=!Be(this.fileDiff,e),o=this.syncLineAnnotations(i);let s=n?.resetDiffLayoutCache===!0||r||o,l=r||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=_t(n.metrics),s=!0,l=!0);const{collapsed:a=!1}=this.options;return this.currentCollapsed!==a&&(this.currentCollapsed=a,s=!0),s&&this.resetLayoutCache({includeEstimatedHeights:l}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t="additions"){if(this.fileDiff==null||e<1)return;const n=this.getLineIndex(e,t);if(n==null)return;const{disableFileHeader:i=!1,expandUnchanged:r=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,l=this.getDiffStyle(),a=this.getHunkSeparatorType(),d=l==="split"?n[1]:n[0];this.approximateLayoutCheckpoints();const h=se(this.metrics,i),c=this.getLayoutCheckpointBeforeLineIndex(d);let u=c?.top??h+this.cache.fileAnnotationHeight;if(o)return{top:h,height:0};let f;return qe({diff:this.fileDiff,diffStyle:l,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:g,hunk:b,collapsedBefore:y,collapsedAfter:m,deletionLine:p,additionLine:C})=>{const v=l==="split"?C?.splitLineIndex??p?.splitLineIndex:C?.unifiedLineIndex??p?.unifiedLineIndex;if(v==null)throw new Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(y>0){const S=$e({type:a,metrics:this.metrics,hunkIndex:g,hunkSpecs:b?.hunkSpecs});if(S!=null){if(u+=S.gapBefore,d>=v-y&&d<v)return f={top:u,height:S.height},!0;u+=S.height+S.gapAfter}}const x=this.getLineHeight(v,(C?.noEOFCR??!1)||(p?.noEOFCR??!1));if(v===d)return f={top:u,height:x},!0;if(u+=x,m>0){const S=We({type:a,metrics:this.metrics});if(S!=null){if(d>v&&d<=v+m)return f={top:u+S.gapBefore,height:S.height},!0;u+=S.totalHeight}}return!1}}),f}getNumericScrollAnchor(e){if(this.fileDiff==null)return;const{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:i=!1,collapsedContextThreshold:r=1}=this.options;if(i)return;const o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();const l=this.getLayoutCheckpointBeforeTop(e);let a=l?.top??se(this.metrics,t)+this.cache.fileAnnotationHeight,d;return qe({diff:this.fileDiff,diffStyle:o,startingLine:l?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,callback:({hunkIndex:h,hunk:c,collapsedBefore:u,collapsedAfter:f,deletionLine:g,additionLine:b})=>{const y=o==="split"?b?.splitLineIndex??g?.splitLineIndex:b?.unifiedLineIndex??g?.unifiedLineIndex;if(y==null)throw new Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(u>0){const p=$e({type:s,metrics:this.metrics,hunkIndex:h,hunkSpecs:c?.hunkSpecs});p!=null&&(a+=p.totalHeight)}if(a>=e&&(g!=null?d={lineNumber:g.lineNumber,side:"deletions",top:a}:b!=null&&(d={lineNumber:b.lineNumber,side:"additions",top:a}),d!=null))return!0;const m=this.getLineHeight(y,(b?.noEOFCR??!1)||(g?.noEOFCR??!1));if(a+=m,f>0){const p=We({type:s,metrics:this.metrics});p!=null&&(a+=p.totalHeight)}return!1}}),d}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};const t=e!=null?this.computeRenderRangeFromWindow(this.fileDiff,this.top,e):this.renderRange;if(t==null)return;const{bufferBefore:n,bufferAfter:i,totalLines:r}=t;let o=0;if(r===0){const s=e??this.virtualizer.getWindowSpecs();this.top<s.top&&(o=i)}return{topOffset:this.top+n+o,height:this.height-(n+i)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSimpleMode()&&this.computeApproximateSize(),this.virtualizer.instanceChanged(this,!0)};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(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}computeApproximateSize(e=!1){const t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;const n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,this.fileDiff==null){this.layoutDirty=!1;return}const{disableFileHeader:i=!1,collapsed:r=!1}=this.options,o=se(this.metrics,i);if(this.height+=o,r){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight()+this.cache.measuredHeightDeltaTotal,t&&!n&&this.validateComputedHeight(),this.layoutDirty=!1}getActiveEstimatedHeight(){this.ensureEstimatedDiffHeights();const e=this.getDiffStyle()==="split"?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(e==null)throw new Error("VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height");return e}ensureEstimatedDiffHeights(){if(this.fileDiff==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;const{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,{splitHeight:i,unifiedHeight:r}=Ma({fileDiff:this.fileDiff,metrics:this.metrics,disableFileHeader:e,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:t,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=r}validateComputedHeight(){if(this.fileContainer==null||this.fileDiff==null)return;const e=this.fileContainer.getBoundingClientRect();e.height!==this.height?console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:this.fileDiff.name,elementHeight:e.height,computedHeight:this.height}):console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:i,forceRender:r=!1,lineAnnotations:o,...s}={}){const{forceRenderOverride:l,isSetup:a}=this;this.forceRenderOverride=void 0;const d=this.syncLineAnnotations(o);if(d&&this.resetLayoutCache({includeEstimatedHeights:!1}),this.fileDiff??=i??(t!=null&&n!=null?tn(t,n,this.options.parseDiffOptions):void 0),e=this.getOrCreateFileContainer(e),this.fileDiff==null)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;if(a)this.top??=this.getVirtualizedTop();else{this.computeApproximateSize();const f=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(f==null)throw new Error("VirtualizedFileDiff.render: simple virtualizer is not available");f.connect(e,this),this.isVisible=f.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);const h=this.virtualizer.getWindowSpecs(),c=this.top??0,u=this.computeRenderRangeFromWindow(this.fileDiff,c,h);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:u,oldFile:t,newFile:n,lineAnnotations:o,forceRender:(l??r)||d,...s})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}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}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??"split"}getHunkSeparatorType(){return Wa(this.options.hunkSeparators)}approximateLayoutCheckpoints(){if(this.cache.checkpoints.length>0||this.fileDiff==null||this.fileDiff.hunks.length===0||this.options.collapsed===!0)return;const{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,i=this.fileDiff.hunks.length-1,r=this.getDiffStyle(),o=this.getHunkSeparatorType(),s=t?!0:this.hunksRenderer.getExpandedHunksMap(),l=Fa(this.cache.heightDeltas);let a=se(this.metrics,e)+this.cache.fileAnnotationHeight,d=0;const h=({rowCount:c,startLineIndex:u,preSeparatorHeight:f=0,postSeparatorHeight:g=0,metadataOffsets:b=[]})=>{if(c<=0)return;const y=d,m=d+c;let p=za(y);for(;p<m;){const C=p-y,v=a+(C>0?f:0)+C*this.metrics.lineHeight+Ua(b,C)*this.metrics.lineHeight+Jn(l,u,u+C);this.cache.checkpoints.push({renderedLineIndex:p,lineIndex:u+C,top:v}),p+=rn}a+=f+c*this.metrics.lineHeight+b.length*this.metrics.lineHeight+Jn(l,u,u+c)+g,d=m};for(let c=0;c<this.fileDiff.hunks.length;c++){const u=this.fileDiff.hunks[c];if(u==null)throw new Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");const f=Qe({isPartial:this.fileDiff.isPartial,rangeSize:u.collapsedBefore,expandedHunks:s,hunkIndex:c,collapsedContextThreshold:n}),g=f.collapsedLines>0?$e({type:o,metrics:this.metrics,hunkIndex:c,hunkSpecs:u.hunkSpecs})?.totalHeight??0:0;h({rowCount:f.fromStart,startLineIndex:(r==="split"?u.splitLineStart:u.unifiedLineStart)-f.rangeSize});let b=g;h({rowCount:f.fromEnd,startLineIndex:(r==="split"?u.splitLineStart:u.unifiedLineStart)-f.fromEnd,preSeparatorHeight:b}),f.fromEnd>0&&(b=0);const y=c===i?Je({fileDiff:this.fileDiff,hunkIndex:c,expandedHunks:s,collapsedContextThreshold:n,errorPrefix:"VirtualizedFileDiff"}):void 0,m=y!=null&&y.collapsedLines>0?We({type:o,metrics:this.metrics})?.totalHeight??0:0,p=y!=null?y.fromStart+y.fromEnd:0,C=r==="split"?u.splitLineCount:u.unifiedLineCount,v=r==="split"?u.splitLineStart:u.unifiedLineStart;h({rowCount:C,startLineIndex:v,preSeparatorHeight:b,postSeparatorHeight:p===0?m:0,metadataOffsets:Va({diffStyle:r,hunk:u,rowCount:C})}),y!=null&&p>0&&h({rowCount:p,startLineIndex:v+C,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,i;for(;t<=n;){const r=t+n>>1,o=this.cache.checkpoints[r];if(o==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");o.lineIndex<=e?(i=o,t=r+1):n=r-1}return i}getLayoutCheckpointBeforeTop(e,t){let n=0,i=this.cache.checkpoints.length-1,r=-1;for(;n<=i;){const o=n+i>>1,s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");s.top<=e?(r=o,n=o+1):i=o-1}if(t==null)return r>=0?this.cache.checkpoints[r]:void 0;for(let o=r;o>=0;o--){const s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");if(s.renderedLineIndex%t===0)return s}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(const l of e.hunks)n+=t==="split"?l.splitLineCount:l.unifiedLineCount;return n}const{expandUnchanged:i=!1,collapsedContextThreshold:r=1}=this.options,o=i?!0:this.hunksRenderer.getExpandedHunksMap();for(const[l,a]of e.hunks.entries()){const d=t==="split"?a.splitLineCount:a.unifiedLineCount;n+=d;const h=Math.max(a.collapsedBefore,0),{fromStart:c,fromEnd:u,renderAll:f}=Qe({isPartial:e.isPartial,rangeSize:h,expandedHunks:o,hunkIndex:l,collapsedContextThreshold:r});h>0&&(n+=f?h:c+u)}const s=Je({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:o,collapsedContextThreshold:r,errorPrefix:"VirtualizedFileDiff"});return s!=null&&(n+=s.fromStart+s.fromEnd),n}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){const{disableFileHeader:r=!1,expandUnchanged:o=!1,collapsedContextThreshold:s=1}=this.options,{hunkLineCount:l,lineHeight:a}=this.metrics,d=this.getDiffStyle(),h=this.getHunkSeparatorType(),c=this.height;let u=this.cache.totalLines>0?this.cache.totalLines:this.getExpandedLineCount(e,d);const f=se(this.metrics,r),g=e.hunks.length>0?yt(this.metrics):0,{fileAnnotationHeight:b}=this.cache,y=f+b,m=Math.max(0,c-f-b-g),p=this.hasFileAnnotations(e),C=t+f,v=b>0&&p&&C<i&&C+b>n;if(t<n-c||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-f-g};if(u<=l||e.hunks.length===0)return{startingLine:0,totalLines:l,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(),u=this.cache.totalLines>0?this.cache.totalLines:u;const x=Math.ceil(Math.max(i-n,0)/a),S=Math.ceil(x/l)*l+l,L=S/l,E=L,w=[],R=(n+i)/2,H=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-S*a*2),l);let I=t+(H?.top??y),T=H?.renderedLineIndex??0,M,N,G;if(qe({diff:e,diffStyle:d,startingLine:H?.renderedLineIndex??0,expandedHunks:o?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:le,hunk:q,collapsedBefore:ye,collapsedAfter:P,deletionLine:V,additionLine:z})=>{const de=z!=null?z.splitLineIndex:V.splitLineIndex,te=z!=null?z.unifiedLineIndex:V.unifiedLineIndex,ne=(z?.noEOFCR??!1)||(V?.noEOFCR??!1),Pe=(ye>0?$e({type:h,metrics:this.metrics,hunkIndex:le,hunkSpecs:q?.hunkSpecs}):void 0)?.totalHeight??0;I+=Pe;const K=T%l===0,wt=Math.floor(T/l);if(K&&(w[wt]=I-(t+y+Pe),G!=null)){if(G<=0)return!0;G--}const Et=this.getLineHeight(d==="split"?de:te,ne);return I>n-Et&&I<i&&(M??=wt),N==null&&I+Et>R&&(N=wt),G==null&&I>=i&&K&&(G=E),T++,I+=Et,P>0&&(I+=We({type:h,metrics:this.metrics})?.totalHeight??0),!1}}),M==null)if(v)M=0,N=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-f-g};N??=M;const D=Math.round(N-L/2),F=Math.max(0,Math.ceil(u/l)-L),O=Math.max(0,Math.min(D,F)),J=O*l,me=D<0?S+D*l:S,ve=w[O]??0,Le=J===0?0:b+ve,ee=O+me/l,be=ee<w.length?m-w[ee]:m-(I-t-y);return{startingLine:J,totalLines:me,bufferBefore:Le,bufferAfter:Math.max(0,be)}}};function Na(e){let t;for(const n of e){if(n==null)continue;const i=n.children[1];if(i instanceof HTMLElement)for(const r of i.children)r instanceof HTMLElement&&r.dataset.lineAnnotation===Zi&&(t=Math.max(t??0,r.getBoundingClientRect().height))}return t}function Fa(e){const t=Array.from(e).sort((o,s)=>o[0]-s[0]),n=[],i=[0];let r=0;for(const[o,s]of t)n.push(o),r+=s,i.push(r);return{lineIndexes:n,prefixTotals:i}}function Jn({lineIndexes:e,prefixTotals:t},n,i){if(n>=i||e.length===0)return 0;const r=Zn(e,n);return(t[Zn(e,i)]??0)-(t[r]??0)}function Zn(e,t){let n=0,i=e.length;for(;n<i;){const r=n+i>>1,o=e[r];if(o==null)throw new Error("VirtualizedFileDiff: invalid prefix index");o<t?n=r+1:i=r}return n}function za(e){return Math.ceil(e/rn)*rn}function Ua(e,t){let n=0;for(const i of e)i<t&&n++;return n}function Va({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];const i=t.hunkContent.at(-1);if(i==null)return[];if(i.type==="context")return[n-1];const r=Math.max(i.deletions,i.additions),o=i.deletions+i.additions;if(e==="split")return r>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];const s=[],l=n-o;return i.deletions>0&&t.noEOFCRDeletions&&s.push(l+i.deletions-1),i.additions>0&&t.noEOFCRAdditions&&s.push(n-1),s}function Ba(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.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function $a(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Wa(e){return typeof e=="function"?"custom":e??"line-info"}function Ga(e,t){const[n,i]=e.split(",").map(Number);return t==="split"?i:n}function re(e){const t=window.devicePixelRatio??1;return Math.round(e*t)/t}const ja=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","diffStyle","diffIndicators","disableBackground","expandUnchanged","collapsedContextThreshold","lineDiffType","maxLineDiffLength","expansionLineCount","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],qa=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],ei=["renderCustomHeader","renderHeaderPrefix","renderHeaderMetadata","renderAnnotation","renderGutterUtility","onPostRender","onGutterUtilityClick","onLineClick","onLineNumberClick","onLineEnter","onLineLeave","onTokenClick","onTokenEnter","onTokenLeave"],ti=["onLineSelected","onLineSelectionStart","onLineSelectionChange","onLineSelectionEnd"],yr=Symbol("CodeView.itemOptionsState");function ni(e,t){Object.defineProperty(e,yr,{configurable:!1,enumerable:!1,value:t})}function ze(e){return e[yr]}function ce(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}const Ka=120,ii="--diffs-overflow-override",yn=12e6,xr=1e6,Lr=2e6,Ya=yn-Lr,ri=yn-xr,Xa=(()=>{const{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),i=e.platform==="MacIntel"&&e.maxTouchPoints>1;return(n||i)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})();var ed=class fe{static __STOP=!1;static __lastScrollPosition=0;type="advanced";config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=_e;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement("div");stickyContainer=document.createElement("div");stickyOffset=document.createElement("div");elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isContainerManaged;constructor(t={theme:_},n,i=!1){this.options=t,this.computeMetricsCache(t.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=n,this.isContainerManaged=i,this.stickyOffset.style.contain="layout size",this.stickyContainer.style.position="sticky",this.stickyContainer.style.width="100%",this.stickyContainer.style.contain="layout style inline-size",this.stickyContainer.style.isolation="isolate",this.stickyContainer.style.display="flex",this.stickyContainer.style.flexDirection="column"}getLayout(){return this.options.layout??eo}computeMetricsCache(t){return this.itemMetricsCache={hunkLineCount:t?.hunkLineCount??_e.hunkLineCount,lineHeight:t?.lineHeight??_e.lineHeight,diffHeaderHeight:t?.diffHeaderHeight??_e.diffHeaderHeight,hunkSeparatorHeight:t?.hunkSeparatorHeight,spacing:t?.spacing??_e.spacing,paddingTop:t?.paddingTop,paddingBottom:t?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??to}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return $r&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(t){if(!this.shouldValidateItemHeights()||t.element==null)return;const n=t.instance.getAdvancedStickySpecs();if(n==null)return;const i=n.height,r=t.element.getBoundingClientRect().height;i!==r&&console.error("CodeView: reconciled item height does not match DOM height",{id:t.item.id,type:t.type,index:t.index,version:t.version,expectedHeight:i,actualHeight:r,delta:r-i,stickyTopOffset:n.topOffset,virtualizedHeight:t.instance.getVirtualizedHeight(),top:t.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:t.element,instance:t.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;const{firstIndex:t,lastIndex:n,stickyHeight:i,stickyTop:r,stickyBottom:o}=this.renderState;if(t===-1||n===-1)return;const s=this.stickyContainer.getBoundingClientRect().height;Math.abs(s-i)<1||console.error("CodeView: sticky container height does not match computed layout",{computedStickyHeight:i,actualStickyHeight:s,delta:s-i,stickyTop:r,stickyBottom:o,firstIndex:t,lastIndex:n,firstStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[n]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents="none",this.pointerEventsDisabled=!0),Xa&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(ii,"hidden"),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Ka)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&(this.stickyContainer.style.removeProperty("pointer-events"),this.pointerEventsDisabled=!1),this.codeOverflowFix&&(this.stickyContainer.style.setProperty(ii,"auto"),this.codeOverflowFix=!1)};syncLayout(){const{gap:t,paddingBottom:n,paddingTop:i}=this.getLayout();this.stickyContainer.style.gap=`${t}px`,this.container?.style.setProperty("margin-top",`${i}px`),this.container?.style.setProperty("margin-bottom",`${n}px`)}setup(t){if(this.root!=null)throw new Error("CodeView.setup: already setup");this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor="none",this.root.hasAttribute("tabindex")||(this.root.tabIndex=-1),this.container??=document.createElement("div"),this.container.style.contain="layout style",this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener("scroll",this.handleScroll,{passive:!0}),this.root.addEventListener("wheel",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("touchstart",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("pointerdown",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("keydown",this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{fe.__STOP?(fe.__STOP=!1,this.scrollTo({type:"position",position:fe.__lastScrollPosition,behavior:"instant"})):(fe.__lastScrollPosition=this.getScrollTop(),fe.__STOP=!0)}}reset(){this.restoreScrollInteractions(),this.cleanAllRenderedItems(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear(),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent="",this.stickyOffset.style.height="",this.container?.style.removeProperty("height"),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator()}cleanUp(){this.reset(),this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener("scroll",this.handleScroll),this.root?.removeEventListener("wheel",this.clearPendingScroll),this.root?.removeEventListener("touchstart",this.clearPendingScroll),this.root?.removeEventListener("pointerdown",this.clearPendingScroll),this.root?.removeEventListener("keydown",this.clearPendingScroll),this.root?.style.removeProperty("overflow-anchor"),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent="",this.root=void 0,this.container=void 0}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let t=this.renderState.firstIndex;t<=this.renderState.lastIndex;t++){const n=this.items[t];if(n==null)throw new Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${t}`);this.releaseRenderedItem(n)}}primeScrollTarget(t){if(t.type==="position")return;const n=this.idToItem.get(t.id);n?.instance.primeHighlightCache()}getElementPoolLimit(){const t=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:n}=this.itemMetricsCache;return Math.max(8,Math.ceil(t/Math.max(n,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let t=this.elementPool.pop();for(;t!=null&&!this.isElementPoolGenerationCurrent(t);)t=this.elementPool.pop();return t??=document.createElement(Ei),this.markElementPoolGenerationCurrent(t),t}releaseRenderedItem(t){const{element:n}=t;n!=null&&this.renderedItemOwnsFocus(n)&&(this.shouldFixContainerFocus=!0),t.instance.cleanUp(!0),t.element=void 0,n!=null&&(n.remove(),this.cleanElement(n),this.queueElementForPool(n))}renderedItemOwnsFocus(t){const{activeElement:n}=document;return n===t||t.contains(n)||t.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(t){const{shadowRoot:n}=t;if(n!=null)for(const i of Array.from(n.children))tl(i)||i.remove();this.isContainerManaged||t.replaceChildren()}queueElementForPool(t){const n=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(t)||this.getElementPoolSize()>=n||(this.isElementClean(t)?this.elementPool.push(t):this.pendingElementPool.push(t))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;const{pendingElementPool:t}=this;this.pendingElementPool=[];const n=this.getElementPoolLimit();for(const i of t)this.isElementPoolGenerationCurrent(i)&&this.isElementClean(i)&&this.elementPool.length<n?this.elementPool.push(i):this.isElementPoolGenerationCurrent(i)&&this.getElementPoolSize()<n&&this.pendingElementPool.push(i)}isElementClean(t){return t.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(t){this.elementPoolTracker.set(t,this.elementPoolVersion)}isElementPoolGenerationCurrent(t){return this.elementPoolTracker.get(t)===this.elementPoolVersion}resolveEffectiveScrollBehavior(t,n){return ro()?"instant":t.behavior!=="smooth-auto"?t.behavior??"instant":Math.abs(n-this.getScrollTop())<=this.getHeight()*10?"smooth":"instant"}scrollTo(t){if(this.root==null)return;const n=this.normalizeScrollTarget(t);if(n==null)return;const i=this.resolveScrollTargetTop(n);i!=null&&(this.primeScrollTarget(n),this.resolveEffectiveScrollBehavior(n,i)==="smooth"?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=n,this.render())}setSelectedLines(t,n){this.applySelectedLines(t,n)}getSelectedLines(){return this.selectedLines}clearSelectedLines(t){this.applySelectedLines(null,t)}getItem(t){return this.idToItem.get(t)?.item}updateItem(t){const n=this.idToItem.get(t.id);return n==null?(console.error(`CodeView.updateItem: unknown item id "${t.id}"`),!1):this.syncItemRecord(n,t)?(this.markItemLayoutDirty(n),this.scrollDirty=!0,this.render(),this.syncSelection(),!0):!1}updateItemId(t,n){if(t===n)return!0;const i=this.idToItem.get(t);return i==null?(console.error(`CodeView.updateItemId: unknown item id "${t}"`),!1):this.idToItem.has(n)?(console.error(`CodeView.updateItemId: duplicate item id "${n}"`),!1):(this.idToItem.delete(t),i.item.id=n,this.idToItem.set(n,i),this.updateItemOptionsId(i.instance.options,n),this.selectedLines?.id===t&&(this.selectedLines={...this.selectedLines,id:n},this.options.onSelectedLinesChange?.(this.selectedLines)),this.renamePendingScrollTarget(t,n),this.renamePendingLayoutAnchor(t,n),this.render(),!0)}addItem(t){this.addItems([t]),this.syncSelection()}addItems(t){this.appendItemsInternal(t),this.syncSelection()}setItems(t){t.length===0?this.reset():this.items.length===0?this.appendItemsInternal(t):this.tryAppendItems(t)||this.reconcileItems(t),this.syncSelection()}appendItemsInternal(t,n=!0){if(t.length===0)return;const i=this.getLayout();let r=this.items.length===0?0:this.scrollHeight+i.gap;const o=r;for(let s=0;s<t.length;s++){const l=t[s];if(l==null)throw new Error("CodeView.appendItemsInternal: missing input item");if(this.idToItem.has(l.id))throw new Error(`CodeView.addItem: duplicate id "${l.id}"`);const a=this.createItem(l,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=Qa(a),r+=a.height+i.gap}this.scrollHeight=r-i.gap,this.scrollDirty=!0,n&&(this.canSkipRenderForAppend(o)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(t){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&t>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(t){if(t==null)return;this.capturePendingLayoutAnchor();const{options:n}=this,i=this.getLayout(),{itemMetricsCache:r}=this;Ja(n,t)&&this.invalidateElementPool(),this.options=t;const o=this.computeMetricsCache(t.itemMetrics),s=!He(r,o),l=!He(i,this.getLayout());l&&this.syncLayout();const a=s||Za(n,t);if(a){const d=this.pendingLayoutReset;this.pendingLayoutReset={metrics:s?o:d?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:d?.includeEstimatedDiffHeights===!0||s||el(n,t)}}(l||a)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),dn(n,t)||this.renderOptionsRevision++,!this.isContainerManaged&&this.items.length>0&&this.render()}capturePendingLayoutAnchor(){this.root==null||this.items.length===0||this.pendingScrollTarget!=null||(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop()))}render(t=!1){fe.__STOP||(t?(io(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):Y(this.computeRenderRangeAndEmit))}instanceChanged(t,n){const i=this.instanceToItem.get(t);if(i==null)throw new Error("CodeView.instanceChanged: An instance has changed that is not registered");n&&this.markItemLayoutDirty(i),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getRenderedItems(){const{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1||n===-1||n<t)return[];const i=[];for(let r=t;r<=n;r++){const o=this.items[r];o?.element!=null&&(o.type==="diff"?i.push({id:o.item.id,type:"diff",item:o.item,version:o.version,element:o.element,instance:o.instance}):i.push({id:o.item.id,type:"file",item:o.item,version:o.version,element:o.element,instance:o.instance}))}return i}setSlotCoordinator(t){return t===this.slotCoordinator?!1:(this.slotCoordinator=t,this.slotSnapshot=void 0,!0)}getSlotSnapshot(t){return di(this.getRenderedItems(),t)}subscribeToScroll(t){return this.scrollListeners.add(t),()=>{this.scrollListeners.delete(t)}}getLocalTopForInstance(t){const n=this.instanceToItem.get(t);if(n==null)throw new Error("CodeView.getLocalTopForInstance: unknown virtualized instance");return n.top}getTopForItem(t){const n=this.idToItem.get(t);if(n!=null)return n.top+this.getLayout().paddingTop}createItem(t,n,i){const{itemMetricsCache:r}=this;if(t.type==="diff"){const s=new Oa(this.createDiffOptions(t.id),this,r,this.workerManager,this.isContainerManaged);return{type:"diff",item:t,version:t.version,index:n,top:i,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:s}}const o=new As(this.createFileOptions(t.id),this,r,this.workerManager,this.isContainerManaged);return{type:"file",item:t,version:t.version,index:n,top:i,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:o}}applySelectedLines(t,n){const{selectedLines:i}=this;t==null&&i==null||t!=null&&i?.id===t.id&&Wt(i.range,t.range)||(i!=null&&i.id!==t?.id&&this.idToItem.get(i.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=t,this.idToItem.get(t?.id??"")?.instance.setSelectedLines(t?.range??null,n))}syncSelection(){if(this.selectedLines==null)return;const t=this.idToItem.get(this.selectedLines.id);if(t==null){this.selectedLines=null;return}t.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}renamePendingScrollTarget(t,n){const{pendingScrollTarget:i}=this;i==null||i.type==="position"||i.id!==t||(this.pendingScrollTarget={...i,id:n})}renamePendingLayoutAnchor(t,n){this.pendingLayoutAnchor?.id===t&&(this.pendingLayoutAnchor.id=n)}createFileOptionsPrototype(){const t={};for(const n of qa)ce(t,n,()=>this.options[n]);ce(t,"stickyHeader",()=>this.options.stickyHeaders),ce(t,"collapsed",n=>this.getItemOptions(ze(n),"file")?.item.collapsed===!0);for(const n of ei)this.defineItemSharedCallback(t,"file",n);for(const n of ti)this.defineItemSelectionCallback(t,"file",n);return t}createDiffOptionsPrototype(){const t={};for(const n of ja)ce(t,n,()=>this.options[n]);ce(t,"stickyHeader",()=>this.options.stickyHeaders),ce(t,"hunkSeparators",()=>this.options.hunkSeparators),ce(t,"collapsed",n=>this.getItemOptions(ze(n),"diff")?.item.collapsed===!0);for(const n of ei)this.defineItemSharedCallback(t,"diff",n);for(const n of ti)this.defineItemSelectionCallback(t,"diff",n);return t}createFileOptions(t){const n=Object.create(this.fileOptionsPrototype);return ni(n,{id:t}),n}createDiffOptions(t){const n=Object.create(this.diffOptionsPrototype);return ni(n,{id:t}),n}updateItemOptionsId(t,n){ze(t).id=n}getItemOptions(t,n){const i=this.idToItem.get(t.id);if(!(i==null||i.type!==n))return i}defineItemSharedCallback(t,n,i){ce(t,i,r=>{if(this.options[i]==null)return;const o=ze(r),s=o.callbackCache??={};let l=s[i];return l==null&&(l=((...a)=>{const d=this.getItemOptions(o,n);if(d==null)return;const h=this.options[i];return h?.(...a,d)}),s[i]=l),l})}defineItemSelectionCallback(t,n,i){ce(t,i,r=>{if(this.options.enableLineSelection!==!0)return;const o=ze(r),s=o.callbackCache??={};let l=s[i];return l==null&&(l=(a=>{const d=this.getItemOptions(o,n);if(d==null)return;const h=a==null?null:{id:d.item.id,range:a};this.options.controlledSelection!==!0&&(a!=null||this.selectedLines?.id===d.item.id)&&this.applySelectedLines(h,{notify:!1}),this.options.onSelectedLinesChange?.(h);const c=this.options[i];return c?.(a,d)}),s[i]=l),l})}markLayoutDirtyFromIndex(t){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??t,t)}markItemLayoutDirty(t){if(this.items[t.index]!==t)throw new Error(`CodeView.markItemLayoutDirty: unknown item id "${t.item.id}"`);this.markLayoutDirtyFromIndex(t.index)}tryAppendItems(t){if(t.length<=this.items.length)return!1;for(let n=0;n<this.items.length;n++){const i=this.items[n];if(i==null)throw new Error("CodeView.tryAppendItems: missing existing item");const r=t[n];if(r==null||i.item.id!==r.id||i.type!==r.type)return!1}for(let n=0;n<this.items.length;n++){const i=this.items[n];if(i==null)throw new Error("CodeView.tryAppendItems: missing existing item");const r=t[n];if(r==null)throw new Error("CodeView.tryAppendItems: append candidate missing prefix item");this.syncItemRecord(i,r)&&this.markLayoutDirtyFromIndex(n)}return this.appendItemsInternal(t.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(t){const{items:n,idToItem:i}=this,r=new Set(n),o=[],s=new Map,l=new Map;let a;for(let d=0;d<t.length;d++){const h=t[d];if(h==null)throw new Error("CodeView.reconcileItems: missing input item");if(s.has(h.id))throw new Error(`CodeView.setItems: duplicate id "${h.id}"`);const c=i.get(h.id),u=c!=null&&c.type===h.type?c:this.createItem(h,d,0);u.index=d,c!=null&&c.type===h.type?(r.delete(c),this.syncItemRecord(u,h)&&(a=Math.min(a??d,d))):a=Math.min(a??d,d),n[d]!==u&&(a=Math.min(a??d,d)),o.push(u),s.set(h.id,u),l.set(u.instance,u)}for(let d=0;d<n.length;d++){const h=n[d];if(h==null||!r.has(h))continue;this.releaseRenderedItem(h);const c=Math.max(o.length-1,0);a=Math.min(a??c,c)}a!=null&&(this.items=o,this.idToItem=s,this.instanceToItem=l,this.renderState.firstIndex>=o.length?this.resetRenderState():this.renderState.lastIndex>=o.length&&(this.renderState.lastIndex=o.length-1),this.markLayoutDirtyFromIndex(a),this.scrollDirty=!0,this.render())}syncItemRecord(t,n){if(t.type!==n.type)throw new Error(`CodeView.syncItemRecord: type mismatch for id "${n.id}"`);return t.version===n.version?!1:(t.item=n,t.version=n.version,t.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(t){const{paddingBottom:n,paddingTop:i}=this.getLayout();return Math.max(i+t+n-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>ri}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),yn):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(t){const n=this.getMaxPagedScrollTop();return Math.max(0,Math.min(t,n))}clampScrollTop(t){const n=this.getMaxScrollTop();return Math.max(0,Math.min(t,n))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(t){const n=this.getMaxScrollPageOffset();return Math.max(0,Math.min(t,n))}resolveScrollPageWindow(t,n){let i=re(this.clampPagedScrollTop(n)),r=this.clampScrollPageOffset(t-i);return i=re(this.clampPagedScrollTop(t-r)),r=this.clampScrollPageOffset(t-i),{pagedScrollTop:i,scrollPageOffset:r}}resolvePagedScrollPosition(t){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(t),scrollPageOffset:0};const n=this.clampScrollPageOffset(this.scrollPageOffset),i=t-n,r=this.getMaxPagedScrollTop(),o=this.getMaxScrollPageOffset(),s=i>ri&&n<o,l=i<xr&&n>0;return i<0||i>r||s||l?this.resolveScrollPageWindow(t,l?Math.min(Ya,r):Lr):{pagedScrollTop:re(this.clampPagedScrollTop(i)),scrollPageOffset:n}}needsScrollPageUpdate(t){const n=re(this.clampScrollTop(t)),{scrollPageOffset:i}=this.resolvePagedScrollPosition(n);return i!==this.scrollPageOffset}getPagedLayoutTop(t){return this.shouldRebaseScroll()?Math.max(t-this.scrollPageOffset,0):t}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(t){const n=this.idToItem.get(t.id);if(n==null){console.warn(`CodeView.scrollTo: unknown item id "${t.id}"`);return}if(t.type==="item")return{top:n.top,height:n.height};if(t.type==="range"){const r=this.getRangeScrollPosition(n,t);if(r==null){console.warn(`CodeView.scrollTo: unable to resolve range ${oi(t.range)} for item "${t.id}"`);return}return{top:n.top+r.top,height:r.height}}const i=this.getLineScrollPosition(n,t);if(i==null){console.warn(`CodeView.scrollTo: unable to resolve line ${t.lineNumber} for item "${t.id}"`);return}return{top:n.top+i.top,height:i.height}}normalizeScrollTarget(t){if(t.type==="position"||t.align!=="nearest")return t;const n=this.getScrollTargetRect(t);if(n==null)return;const i=t.offset??0,r=this.getLayout().paddingTop+n.top,o=r+n.height,s=this.getScrollTop(),l=s+(t.type==="line"||t.type==="range"?this.getStickyHeaderOffset():0),a=s+this.getHeight();if(!(r-i<=l&&o+i>=a)){if(r-i<l)return{...t,align:"start"};if(o+i>a)return{...t,align:"end"}}}resolveScrollTargetTop(t){if(t.type==="position"){const r=this.clampScrollTop(t.position);return r!==t.position?r:this.clampScrollTop(t.position-this.getStickyHeaderOffset())}const n=this.idToItem.get(t.id);if(n==null){console.warn(`CodeView.scrollTo: unknown item id "${t.id}"`);return}if(t.type==="item")return this.clampScrollTop(this.resolveAlignedScrollPosition(n.top,n.height,t.align,t.offset));if(t.type==="range"){const r=this.getRangeScrollPosition(n,t);if(r==null){console.warn(`CodeView.scrollTo: unable to resolve range ${oi(t.range)} for item "${t.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(n.top+r.top,r.height,t.align,t.offset,this.getStickyHeaderOffset()))}const i=this.getLineScrollPosition(n,t);if(i==null){console.warn(`CodeView.scrollTo: unable to resolve line ${t.lineNumber} for item "${t.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(n.top+i.top,i.height,t.align,t.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(t,n,i,r=0,o=0){t+=this.getLayout().paddingTop;const s=this.getHeight();return i==="center"&&n+r<s?t-(s-n)/2+r:i==="end"?t-(s-n)+r:t-o-r}getLineScrollPosition(t,n){return t.type==="diff"?t.instance.getLinePosition(n.lineNumber,n.side):t.instance.getLinePosition(n.lineNumber)}getRangeScrollPosition(t,n){const{range:i}=n,r=this.getLineScrollPosition(t,{type:"line",id:n.id,lineNumber:i.start,side:i.side}),o=this.getLineScrollPosition(t,{type:"line",id:n.id,lineNumber:i.end,side:i.endSide??i.side});if(r==null||o==null)return;const s=r.top,l=s+r.height,a=o.top,d=a+o.height,h=Math.min(s,a);return{top:h,height:Math.max(l,d)-h}}computeTargetScrollTopForFrame(t,n){if(this.pendingScrollTarget==null)return t;const i=this.resolveScrollTargetTop(this.pendingScrollTarget);if(i==null)return t;const{scrollAnimation:r}=this;return r==null?i:this.computeSpringStep(r,i,n).position}computeSpringStep(t,n,i){const r=Math.max(0,i-t.lastTimestamp),{omega:o}=this.getSmoothScrollSettings(),s=Math.exp(-o*r),l=t.position-n,a=t.velocity+o*l;return{position:n+(l+a*r)*s,velocity:(a*(1-o*r)-o*l)*s}}advanceScrollAnimation(t,n){if(this.pendingScrollTarget==null)return;const i=this.resolveScrollTargetTop(this.pendingScrollTarget);if(i==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}const r=this.scrollAnimation;if(r==null)return i;r.position+=n;const{position:o,velocity:s}=this.computeSpringStep(r,i,t);r.lastTimestamp=t,r.position=o,r.velocity=s;const{positionEpsilon:l,velocityEpsilon:a}=this.getSmoothScrollSettings();return Math.abs(i-o)<=l&&Math.abs(s)<=a?(r.position=i,r.velocity=0,this.scrollAnimation=void 0,i):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(fe.__STOP||this.container==null)return;const n=this.getHeight(),i=this.getScrollTop();let r=i,o=this.pendingLayoutAnchor!=null,s=this.getScrollAnchor(r);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,o=!0),o&&s!=null){const S=this.resolveAnchoredScrollTop(s);if(S!=null){const L=S-r;r=S,this.scrollAnimation!=null&&(this.scrollAnimation.position+=L)}}o&&(r=this.clampScrollTop(r),this.syncContainerHeight());const l=this.computeTargetScrollTopForFrame(r,t),a=!o&&(this.renderState.scrollTop===-1||Math.abs(l-this.renderState.scrollTop)>n+this.config.overscrollSize*2);a&&(s=void 0),this.windowSpecs=Gt({scrollTop:l,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:a,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let d=i;(this.pendingScrollTarget!=null&&l!==d||this.needsScrollPageUpdate(l))&&(this.applyScrollFix(l,d,this.windowSpecs),d=l);const{top:h,bottom:c}=this.windowSpecs,{firstIndex:u,lastIndex:f}=this.renderState;if(u>=0)for(let S=u;S<=f;S++){const L=this.items[S];if(L==null)throw new Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${S}`);L.top>h-L.height&&L.top<=c||this.releaseRenderedItem(L)}let g;const b=new Set,y=this.findFirstVisibleIndex(h),m=this.findLastVisibleIndex(c);for(let S=y;S<=m;S++){const L=this.items[S];if(L==null)throw new Error("CodeView.computeRenderRangeAndEmit: missing item");const{instance:E}=L;L.element==null?(L.element=this.acquireElement(),li(this.stickyContainer,L.element,g),E.virtualizedSetup(),ai(L,L.element)&&(L.renderedOptionsRevision=this.renderOptionsRevision,b.add(L)),g=L.element):(li(this.stickyContainer,L.element,g),ai(L,void 0,L.renderedOptionsRevision!==this.renderOptionsRevision)&&(L.renderedOptionsRevision=this.renderOptionsRevision,b.add(L)),g=L.element)}this.renderState.firstIndex=y<=m?y:-1,this.renderState.lastIndex=m,this.flushSlotCoordinator(),this.reconcileRenderedItems(b),this.syncContainerHeight(),this.updateStickyPositioning();const p=s!=null?this.resolveAnchoredScrollTop(s):void 0;s===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);const C=p!=null?p-r:0;let v=l,x=!1;if(this.pendingScrollTarget!=null){const S=this.advanceScrollAnimation(t,C);S!=null?(v=S,x=!0):v=r}else v=p??l;v!==d&&(this.applyScrollFix(v,d,this.windowSpecs),d=v),x&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=re(d),this.flushManagers(b),this.validateStickyContainerHeight(),this.fixContainerFocus(),(a||this.scrollAnimation!=null)&&this.render()};flushManagers(t){for(const n of t)n.instance.flushManagers()}syncContainerHeight(){const t=this.getPagedScrollHeight();this.container==null||this.containerHeight===t||(this.container.style.height=`${t}px`,this.containerHeight=t)}getStickyBounds(t){const{firstIndex:n,lastIndex:i}=t!=null?{firstIndex:this.findFirstVisibleIndex(t.top),lastIndex:this.findLastVisibleIndex(t.bottom)}:this.renderState;if(n===-1||i===-1||n>i)return;const r=this.items[n]?.instance.getAdvancedStickySpecs(t),o=this.items[i]?.instance.getAdvancedStickySpecs(t);if(!(r==null||o==null))return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(o.topOffset+o.height)}}applyStickyPositioning({stickyTop:t,stickyBottom:n}){const i=this.getHeight(),{itemMetricsCache:r}=this,o=n-t;this.renderState.stickyHeight=o,this.renderState.stickyTop=t,this.renderState.stickyBottom=n,this.stickyOffset.style.height=`${t}px`;const s=(Math.random()*r.lineHeight>>0)*-1,l=-Math.max(o+s,0)+i;this.stickyContainer.style.top=`${l}px`,this.stickyContainer.style.bottom=`${l+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(t){this.syncContainerHeight();const n=this.getStickyBounds(t);n!=null&&this.applyStickyPositioning(n)}reconcileRenderedItems(t){const{firstIndex:n,lastIndex:i}=this.renderState;if(n===-1)return;let r=-1,o=!1;for(let s=n;s<this.items.length&&!(!o&&s>i);s++){const l=this.items[s];if(l==null)throw new Error("CodeView.reconcileRenderedItems: Invalid item");r===-1?r=l.top:l.top!==r&&(l.top=r,l.instance.syncVirtualizedTop(),o=!0),(t==null?s<=i:t.has(l))&&(l.instance.reconcileHeights()&&(o=!0,l.height=l.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(l)),r+=l.instance.getVirtualizedHeight(),s<this.items.length-1&&(r+=this.getLayout().gap)}o&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){const t=this.getStickyBounds();if(t==null)return;const{stickyTop:n,stickyBottom:i}=t;i-n===this.renderState.stickyHeight&&n===this.renderState.stickyTop&&i===this.renderState.stickyBottom||this.applyStickyPositioning(t)}handleScroll=()=>{fe.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=t=>{for(const n of t)if(n.target===this.stickyContainer){if(n.borderBoxSize[0].blockSize!==this.renderState.stickyHeight){const i=this.getScrollTop(),r=this.getScrollAnchor(i);this.reconcileRenderedItems(),this.updateStickyPositioning();const o=r!=null?this.resolveAnchoredScrollTop(r):void 0;if(o!=null){const s=o-i;this.applyScrollFix(o,i,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=s)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0)}}else this.scrollDirty=!0,this.heightDirty=!0,this.render()};getScrollAnchorViewportTop(t,n){return t<n?n+this.getStickyHeaderOffset():n}getScrollAnchor(t){if(this.pendingLayoutAnchor!=null)return this.pendingLayoutAnchor;const{firstIndex:n,lastIndex:i,stickyTop:r,stickyBottom:o}=this.renderState;if(n===-1||i===-1)return;const s=this.getHeight();if(!(r===-1||o===-1))for(let l=n;l<=i;l++){const a=this.items[l];if(a==null)continue;const d=this.getLayout().paddingTop+a.top;if(d+a.height<=t)continue;if(d>=t+s)break;if(d>=t)return{type:"item",id:a.item.id,viewportOffset:d-t};const h=this.getScrollAnchorViewportTop(d,t)-d,c=a.instance.getNumericScrollAnchor(h);if(c!=null){const u=d+c.top;return{type:"line",id:a.item.id,lineNumber:c.lineNumber,side:c.side,viewportOffset:u-t}}}}resolveAnchoredScrollTop(t){const n=this.idToItem.get(t.id);if(n==null)return;const{paddingTop:i}=this.getLayout();if(t.type==="item"){const s=i+n.top;return this.clampScrollTop(s-t.viewportOffset)}const r=n.type==="diff"?n.instance.getLinePosition(t.lineNumber,t.side):n.instance.getLinePosition(t.lineNumber);if(r==null)return;const o=i+n.top+r.top;return this.clampScrollTop(o-t.viewportOffset)}applyScrollFix(t,n,i){if(this.root==null)return;const r=re(this.clampScrollTop(t)),o=re(n),{scrollPageOffset:s}=this,l=re(this.clampPagedScrollTop(o-s)),{pagedScrollTop:a,scrollPageOffset:d}=this.resolvePagedScrollPosition(r),h=a,c=s!==d;r===this.renderState.scrollTop&&r===o&&h===l&&!c||(this.suspendScrollInteractions(),(h!==l||c)&&(this.scrollPageOffset=d,this.syncPagedScrollScaffolding(i)),h!==l&&this.root.scrollTo({top:h,behavior:"instant"}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(t){const n=this.resolveScrollTargetTop(t);return n==null?!0:re(this.getScrollTop())===re(n)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;const t=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(t+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;const{onSnapshotChange:t}=this.slotCoordinator,n=di(this.getRenderedItems(),this.slotCoordinator);il(this.slotSnapshot,n)||(this.slotSnapshot=n,t(n))}notifyScroll(){if(this.scrollListeners.size===0)return;const t=this.getScrollTop();for(const n of this.scrollListeners)n(t,this)}findFirstVisibleIndex(t){let n=0,i=this.items.length-1,r=this.items.length;for(;n<=i;){const o=n+i>>1,s=this.items[o];if(s==null)throw new Error("CodeView.findFirstVisibleIndex: invalid item index");s.top+s.height>t?(r=o,i=o-1):n=o+1}return r}findLastVisibleIndex(t){let n=0,i=this.items.length-1,r=-1;for(;n<=i;){const o=n+i>>1,s=this.items[o];if(s==null)throw new Error("CodeView.findLastVisibleIndex: invalid item index");s.top<=t?(r=o,n=o+1):i=o-1}return r}recomputeLayout(t=0,n){if(this.items.length===0){this.scrollHeight=0;return}const i=this.getLayout();let r=0;if(t>0){const o=this.items[t-1];if(o==null)throw new Error("CodeView.recomputeLayout: invalid dirty index");r=o.top+o.height+i.gap}for(let o=t;o<this.items.length;o++){const s=this.items[o];if(s==null)throw new Error("CodeView.recomputeLayout: invalid item index");s.top=r,s.type==="diff"?s.height=s.instance.prepareCodeViewItem(s.item.fileDiff,r,n,s.item.annotations??[]):s.height=s.instance.prepareCodeViewItem(s.item.file,r,n,s.item.annotations??[]),r+=s.height,o<this.items.length-1&&(r+=i.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function Qa(e){return e.instance.cleanUp(!0),e.type==="diff"?e.instance.prepareCodeViewItem(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.prepareCodeViewItem(e.item.file,e.top,void 0,e.item.annotations??[])}function Ja(e,t){return!De(e.theme??_,t.theme??_)||(e.themeType??"system")!==(t.themeType??"system")||e.unsafeCSS!==t.unsafeCSS}function Za(e,t){return(e.overflow??"scroll")!==(t.overflow??"scroll")||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??"split")!==(t.diffStyle??"split")||(e.diffIndicators??"bars")!==(t.diffIndicators??"bars")||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function el(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function tl(e){return e instanceof SVGElement?!0:Xe(e)&&(e.hasAttribute("data-core-css")||e.hasAttribute("data-theme-css")||e.hasAttribute("data-unsafe-css"))}function oi(e){const t=si(e.start,e.side),n=si(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function si(e,t){return t==null?`${e}`:`${t==="deletions"?"D":"A"}${e}`}function ai(e,t,n=!1){return e.type==="diff"?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function li(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function nl(e){return(e.annotations?.length??0)>0}function di(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:i}){if(e.length===0)return;if(t||i)return e;if(!n)return;const r=[];for(const o of e)nl(o.item)&&r.push(o);return r.length>0?r:void 0}function il(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const i=e[n],r=t[n];if(i==null||r==null||i.id!==r.id||i.type!==r.type||i.element!==r.element||i.version!==r.version)return!1}return!0}var rl=class kr{options;tokensStable=[];tokensUnstable=[];lastUnstableCodeChunk="";lastStableGrammarState;constructor(t){this.options=t}async enqueue(t){const n=(this.lastUnstableCodeChunk+t).split(`
|
|
1416
|
-
`),i=[];let r=[];const o=this.tokensUnstable.length;return n.forEach((s,l)=>{const a=l===n.length-1,d=this.options.highlighter.codeToTokens(s,{...this.options,grammarState:this.lastStableGrammarState}),h=d.tokens[0];a||h.push({content:`
|
|
1417
|
-
`,offset:0}),a?(r=h,this.lastUnstableCodeChunk=s):(this.lastStableGrammarState=d.grammarState,i.push(...h))}),this.tokensStable.push(...i),this.tokensUnstable=r,{recall:o,stable:i,unstable:r}}close(){const t=this.tokensUnstable;return this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0,{stable:t}}clear(){this.tokensStable=[],this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0}clone(){const t=new kr(this.options);return t.lastUnstableCodeChunk=this.lastUnstableCodeChunk,t.tokensUnstable=this.tokensUnstable,t.tokensStable=this.tokensStable,t.lastStableGrammarState=this.lastStableGrammarState,t}},hi=class extends TransformStream{tokenizer;options;constructor(e){const t=new rl(e),{allowRecalls:n=!1}=e;super({async transform(i,r){const{stable:o,unstable:s,recall:l}=await t.enqueue(i);n&&l>0&&r.enqueue({recall:l});for(const a of o)r.enqueue(a);if(n)for(const a of s)r.enqueue(a)},async flush(i){const{stable:r}=t.close();if(!n)for(const o of r)i.enqueue(o)}}),this.tokenizer=t,this.options=e}};function ol(e){const t=document.createElement("span");return t.style=Ur(e.htmlStyle??Vr(e)),t.textContent=e.content,t}let sl=-1;var td=class{options;__id=`file-stream:${++sl}`;highlighter;stream;abortController;fileContainer;pre;code;gutterElement;contentElement;themeCSSStyle;appliedThemeCSS;currentRowCount=0;constructor(e={theme:_}){this.options=e,this.currentLineIndex=this.options.startingLineIndex??1}cleanUp(){this.abortController?.abort(),this.abortController=void 0}setThemeType(e){(this.options.themeType??"system")!==e&&(this.options={...this.options,themeType:e},!(typeof this.options.theme=="string"||this.fileContainer==null||this.appliedThemeCSS==null)&&this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType))}async initializeHighlighter(){return this.highlighter=await xt(un(this.options.lang,this.options)),this.highlighter}queuedSetupArgs;async setup(e,t){const n=this.queuedSetupArgs!=null;if(this.queuedSetupArgs=[e,t],n)return;this.highlighter??=await this.initializeHighlighter();const[i,r]=this.queuedSetupArgs;this.queuedSetupArgs=void 0;const o=i;this.setupStream(o,r,this.highlighter)}setupStream(e,t,n){const{disableLineNumbers:i=!1,overflow:r="scroll",theme:o=_,themeType:s="system"}=this.options,l=this.getOrCreateFileContainer();l.parentElement==null&&t.appendChild(l),this.pre??=document.createElement("pre"),this.pre.parentElement==null&&l.shadowRoot?.appendChild(this.pre);const a=typeof o=="string"?n.getTheme(o).type:void 0,d=fn({theme:o,highlighter:n});this.applyThemeState(l,d,s,a);const h=bn(this.pre,{type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:i,overflow:r,split:!1,totalLines:0});h.textContent="",this.pre=h,this.code=je({code:this.code,pre:h}),this.gutterElement=void 0,this.contentElement=void 0,this.currentRowCount=0,this.currentLineElement=void 0,this.currentLineIndex=this.options.startingLineIndex??1,this.abortController?.abort(),this.abortController=new AbortController;const{onStreamStart:c,onStreamClose:u,onStreamAbort:f}=this.options;this.stream?.cancel().catch(()=>{}),this.stream=e,this.stream.pipeThrough(typeof o=="string"?new hi({...this.options,theme:o,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:B("token"),tokenizeTimeLimit:0}):new hi({...this.options,themes:o,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:B("token"),tokenizeTimeLimit:0})).pipeTo(new WritableStream({start(g){c?.(g)},close(){u?.()},abort(g){f?.(g)},write:this.handleWrite}),{signal:this.abortController.signal}).catch(g=>{g.name!=="AbortError"&&console.error("FileStream pipe error:",g)})}queuedTokens=[];handleWrite=e=>{"recall"in e&&this.queuedTokens.length>=e.recall?this.queuedTokens.length=this.queuedTokens.length-e.recall:this.queuedTokens.push(e),Y(this.render),this.options.onStreamWrite?.(e)};currentLineIndex;currentLineElement;render=()=>{this.options.onPreRender?.(this);const{gutter:e,content:t}=this.getOrCreateStreamColumns(),n=document.createDocumentFragment(),i=document.createDocumentFragment();for(const r of this.queuedTokens)if("recall"in r){if(this.currentLineElement==null)throw new Error("FileStream.render: no current line element, shouldnt be possible to get here");if(r.recall>this.currentLineElement.childNodes.length)throw new Error("FileStream.render: Token recall exceed the current line, there's probably a bug...");for(let o=0;o<r.recall;o++)this.currentLineElement.lastChild?.remove()}else{const o=ol(r);if(this.currentLineElement==null){const{gutterLine:s,contentLine:l}=this.createLine();n.appendChild(s),i.appendChild(l)}if(this.currentLineElement?.appendChild(o),r.content===`
|
|
1418
|
-
`){this.currentLineIndex++;const{gutterLine:s,contentLine:l}=this.createLine();n.appendChild(s),i.appendChild(l)}}n.childNodes.length>0&&e.appendChild(n),i.childNodes.length>0&&t.appendChild(i),this.queuedTokens.length=0,this.options.onPostRender?.(this)};getOrCreateStreamColumns(){if(this.code==null)throw new Error("FileStream: expected code element to exist");if(this.gutterElement!=null&&this.contentElement!=null)return{gutter:this.gutterElement,content:this.contentElement};const e=document.createElement("div");e.dataset.gutter="";const t=document.createElement("div");return t.dataset.content="",this.code.appendChild(e),this.code.appendChild(t),this.gutterElement=e,this.contentElement=t,{gutter:e,content:t}}updateRowSpan(){this.gutterElement!=null&&(this.gutterElement.style.gridRow=`span ${this.currentRowCount}`),this.contentElement!=null&&(this.contentElement.style.gridRow=`span ${this.currentRowCount}`)}createLine(){const e=this.currentLineIndex,t=`${e-1}`,n=document.createElement("div");n.dataset.columnNumber=`${e}`,n.dataset.lineType="context",n.dataset.lineIndex=t;const i=document.createElement("span");i.dataset.lineNumberContent="",i.textContent=`${e}`,n.appendChild(i);const r=document.createElement("div");return r.dataset.line=`${e}`,r.dataset.lineType="context",r.dataset.lineIndex=t,this.currentRowCount+=1,this.updateRowSpan(),this.currentLineElement=r,{gutterLine:n,contentLine:r}}getOrCreateFileContainer(e){return e!=null&&e===this.fileContainer||e==null&&this.fileContainer!=null?this.fileContainer:(this.fileContainer!=null&&e!=null&&e!==this.fileContainer&&(this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0),this.fileContainer=e??document.createElement("diffs-container"),this.fileContainer)}applyThemeState(e,t,n,i){const r=e.shadowRoot??e.attachShadow({mode:"open"}),o=i??n,s=this.options.theme??_,l=typeof s=="string"?s:{...s},a=Me(r);if(this.themeCSSStyle?.parentNode===r&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===o&&this.appliedThemeCSS.scrollbarGutter===a){this.appliedThemeCSS.theme=l;return}this.themeCSSStyle=Cn({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:vn(t,o,a)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a}:void 0}};function wr(e,t){const{resolution:n,hunkIndex:i,startContentIndex:r,endContentIndex:o,indexesToDelete:s=new Set}=t,l=e.hunks[i];if(l==null)throw console.error({diff:e,hunkIndex:i}),new Error(`resolveRegion: Invalid hunk index: ${i}`);if(r<0||o>=l.hunkContent.length||r>o)throw new Error(`resolveRegion: Invalid content range, ${r}, ${o}`);const{hunks:a,additionLines:d,deletionLines:h}=e,c={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:e.cacheKey!=null?`${e.cacheKey}:${n[0]}-${i}:${r}-${o}`:void 0},u={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},f=i===a.length-1&&o===l.hunkContent.length-1,g=!e.isPartial;for(const[y,m]of a.entries()){al(e,c,u,m.deletionLineIndex-m.collapsedBefore,m.additionLineIndex-m.collapsedBefore,m.collapsedBefore,g);const p={...m,hunkContent:[],additionStart:u.nextAdditionStart,deletionStart:u.nextDeletionStart,additionLineIndex:u.nextAdditionLineIndex,deletionLineIndex:u.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:u.splitLineCount,unifiedLineStart:u.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(const[C,v]of m.hunkContent.entries())if(y!==i||C<r||C>o){ci(v,c,h,d);const x={...v,additionLineIndex:u.nextAdditionLineIndex,deletionLineIndex:u.nextDeletionLineIndex};p.hunkContent.push(x),Vt(x,u,p)}else if(s.has(C))p.hunkContent.push({type:"context",lines:0,deletionLineIndex:u.nextDeletionLineIndex,additionLineIndex:u.nextAdditionLineIndex});else if(v.type==="context"){ci(v,c,h,d);const x={...v,deletionLineIndex:u.nextDeletionLineIndex,additionLineIndex:u.nextAdditionLineIndex};p.hunkContent.push(x),Vt(x,u,p)}else{ll(n,v,c,h,d);const x={type:"context",lines:n==="deletions"?v.deletions:n==="additions"?v.additions:v.deletions+v.additions,deletionLineIndex:u.nextDeletionLineIndex,additionLineIndex:u.nextAdditionLineIndex};p.hunkContent.push(x),Vt(x,u,p)}if(y===i&&f){const C=n==="deletions"?m.noEOFCRDeletions:m.noEOFCRAdditions;p.noEOFCRAdditions=C,p.noEOFCRDeletions=C}c.hunks.push(p)}const b=a.at(-1);return b!=null&&!e.isPartial&&Er(c,h,d,b.deletionLineIndex+b.deletionCount,b.additionLineIndex+b.additionCount,Math.min(h.length-(b.deletionLineIndex+b.deletionCount),d.length-(b.additionLineIndex+b.additionCount))),c.splitLineCount=u.splitLineCount,c.unifiedLineCount=u.unifiedLineCount,c}function Er(e,t,n,i,r,o){for(let s=0;s<o;s++){const l=t[i+s],a=n[r+s];if(l==null||a==null)throw new Error("pushCollapsedContextLines: missing collapsed context line");e.deletionLines.push(l),e.additionLines.push(a)}}function al(e,t,n,i,r,o,s){o<=0||(s&&(Er(t,e.deletionLines,e.additionLines,i,r,o),n.nextAdditionLineIndex+=o,n.nextDeletionLineIndex+=o),n.nextAdditionStart+=o,n.nextDeletionStart+=o,n.splitLineCount+=o,n.unifiedLineCount+=o)}function ci(e,t,n,i){if(e.type==="context")for(let r=0;r<e.lines;r++){const o=i[e.additionLineIndex+r];if(o==null)throw console.error({additionLines:i,content:e,i:r}),new Error("pushContentLinesToDiff: Context line does not exist");t.deletionLines.push(o),t.additionLines.push(o)}else{const r=Math.max(e.deletions,e.additions);for(let o=0;o<r;o++){if(o<e.deletions){const s=n[e.deletionLineIndex+o];if(s==null)throw console.error({deletionLines:n,content:e,i:o}),new Error("pushContentLinesToDiff: Deletion line does not exist");t.deletionLines.push(s)}if(o<e.additions){const s=i[e.additionLineIndex+o];if(s==null)throw console.error({additionLines:i,content:e,i:o}),new Error("pushContentLinesToDiff: Addition line does not exist");t.additionLines.push(s)}}}}function ll(e,t,n,i,r){if(e==="deletions"||e==="both")for(let o=0;o<t.deletions;o++){const s=i[t.deletionLineIndex+o];if(s==null)throw console.error({deletionLines:i,content:t,i:o}),new Error("pushResolveLinesToDiff: Deletion line does not exist");n.deletionLines.push(s),n.additionLines.push(s)}if(e==="additions"||e==="both")for(let o=0;o<t.additions;o++){const s=r[t.additionLineIndex+o];if(s==null)throw console.error({additionLines:r,content:t,i:o}),new Error("pushResolveLinesToDiff: Addition line does not exist");n.deletionLines.push(s),n.additionLines.push(s)}}function Vt(e,t,n){e.type==="context"?(t.nextAdditionLineIndex+=e.lines,t.nextDeletionLineIndex+=e.lines,t.nextAdditionStart+=e.lines,t.nextDeletionStart+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines,n.additionCount+=e.lines,n.deletionCount+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines):(t.nextAdditionLineIndex+=e.additions,t.nextDeletionLineIndex+=e.deletions,t.nextAdditionStart+=e.additions,t.nextDeletionStart+=e.deletions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions,n.deletionCount+=e.deletions,n.deletionLines+=e.deletions,n.additionCount+=e.additions,n.additionLines+=e.additions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions)}function Tr(e){const t=typeof e=="string"?e:e.type;return t==="accept"||t==="incoming"?"additions":t==="reject"||t==="current"?"deletions":"both"}function dl(e,t,n){return wr(e,{resolution:Tr(n),hunkIndex:t.hunkIndex,startContentIndex:t.startContentIndex,endContentIndex:t.endContentIndex,indexesToDelete:hl(t)})}function hl(e){const t=new Set;return e.baseContentIndex!=null&&t.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&t.add(e.endMarkerContentIndex),t}function Ir({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function Rr(e,t){const n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:ml(n,e.startContentIndex)}}function ui(e,t=6){t=Math.max(t,1);const n={deletionLines:[],additionLines:[],conflictStack:[],conflictBuilders:[],actions:[],hunks:[],nextConflictIndex:0,splitLineCount:0,unifiedLineCount:0,lastHunkEnd:0,activeHunk:void 0,maxContextLines:t,maxContextLines2:t*2},i=e.contents,r=i.length;if(r>0){let c=0,u=0,f=i.indexOf(`
|
|
1419
|
-
`,c);for(;f!==-1;)fi(n,i.slice(c,f+1),u),c=f+1,u++,f=i.indexOf(`
|
|
1420
|
-
`,c);c<r&&fi(n,i.slice(c),u)}if(n.conflictStack.length>0)throw new Error("parseMergeConflictDiffFromFile: unfinished merge conflict marker stack");n.activeHunk!=null&&n.activeHunk.hunkContent.length>0&&(xn(n,n.activeHunk,"trailing"),Mr(n));for(let c=0;c<n.conflictBuilders.length;c++){const u=n.conflictBuilders[c];if(u==null||!u.completed)throw new Error(`parseMergeConflictDiffFromFile: failed to build merge conflict action ${c}`)}if(n.hunks.length>0&&n.additionLines.length>0&&n.deletionLines.length>0){const c=n.hunks[n.hunks.length-1],u=Math.max(n.additionLines.length-(c.additionStart+c.additionCount-1),0);n.splitLineCount+=u,n.unifiedLineCount+=u}const o=n.deletionLines.join(""),s=n.additionLines.join(""),l=Ci(e,"current",o),a=Ci(e,"incoming",s);let d="change";s===""?d="deleted":o===""&&(d="new");const h={name:e.name,prevName:void 0,type:d,hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,isPartial:!1,deletionLines:n.deletionLines,additionLines:n.additionLines,cacheKey:e.cacheKey!=null?`${e.cacheKey}:merge-conflict-diff`:void 0};return{fileDiff:h,currentFile:l,incomingFile:a,actions:n.actions,markerRows:Pr(h,n.actions)}}function fi(e,t,n){const i=e.conflictStack[e.conflictStack.length-1];if(i==null){if(t.length>=7&&t.charCodeAt(0)===60&&bi(t)==="start"){mi(e,t,n);return}pi(e,t);return}const r=bi(t);if(r==="start"){mi(e,t,n);return}if(r==="base"){i.stage="base",i.baseMarkerLineIndex=n,i.markerLines.base=t;return}if(r==="separator"){i.stage="incoming",i.separatorLineIndex=n,i.markerLines.separator=t;return}if(r==="end"){const o=e.conflictStack.pop();if(o==null)throw new Error("parseMergeConflictDiffFromFile: encountered end marker before start marker");fl(e,o,n,t);return}i.stage==="current"?gi(e,"deletion",t,i.conflictIndex,"current"):i.stage==="base"?pi(e,t,i.conflictIndex):gi(e,"addition",t,i.conflictIndex,"incoming")}function Ar(e){return e.activeHunk??=Dr(e.additionLines.length+1,e.deletionLines.length+1),e.activeHunk}function Hr(e,t,n,i){const r=e.conflictBuilders[t];if(r==null)throw new Error(`parseMergeConflictDiffFromFile: failed to locate conflict action ${t}`);const o=r.action,s=e.hunks.length;if(o.hunkIndex<0)o.hunkIndex=s;else if(o.hunkIndex!==s)throw new Error(`parseMergeConflictDiffFromFile: conflict ${t} spans multiple hunks and cannot be anchored`);if(o.startContentIndex<0&&(o.startContentIndex=i),o.endContentIndex=i,o.endMarkerContentIndex=i,n==="current"){o.currentContentIndex??=i;return}if(n==="base"){o.baseContentIndex??=i;return}o.incomingContentIndex=i}function cl(e,t,n,i){const r=e.hunkContent,o=r[r.length-1];return o?.type==="change"?(t==="addition"?o.additions++:o.deletions++,r.length-1):(r.push({type:"change",additions:t==="addition"?1:0,deletions:t==="deletion"?1:0,additionLineIndex:n,deletionLineIndex:i}),r.length-1)}function xn(e,t,n){let i=t.contextBufferCount,r=t.contextBufferAdditionStart,o=t.contextBufferDeletionStart;if(n==="leading"&&i>e.maxContextLines){const h=i-e.maxContextLines;r+=h,o+=h,i=e.maxContextLines,t.additionStart+=h,t.deletionStart+=h,t.additionLineIndex+=h,t.deletionLineIndex+=h}if(n==="trailing"&&i>e.maxContextLines&&(i=e.maxContextLines),i===0){t.contextBufferCount=0,t.contextBufferBaseConflicts=void 0;return}const s=t.hunkContent,l=s[s.length-1];let a;l?.type==="context"?(l.lines+=i,a=s.length-1):(s.push({type:"context",lines:i,additionLineIndex:r,deletionLineIndex:o}),a=s.length-1),t.additionCount+=i,t.deletionCount+=i;const d=t.contextBufferBaseConflicts;if(d!=null){const h=r-t.contextBufferAdditionStart;for(const[c,u]of d)c>=h&&c<h+i&&Hr(e,u,"base",a)}t.contextBufferCount=0,t.contextBufferBaseConflicts=void 0}function Mr(e){if(e.activeHunk==null)return;const t=e.activeHunk;if(e.activeHunk=void 0,t.hunkContent.length===0)return;let n=0,i=0;for(const s of t.hunkContent)s.type==="context"?(n+=s.lines,i+=s.lines):(n+=Math.max(s.additions,s.deletions),i+=s.additions+s.deletions);const r=Math.max(t.additionStart-1-e.lastHunkEnd,0),o={collapsedBefore:r,additionStart:t.additionStart,additionCount:t.additionCount,additionLines:t.additionLines,additionLineIndex:t.additionLineIndex,deletionStart:t.deletionStart,deletionCount:t.deletionCount,deletionLines:t.deletionLines,deletionLineIndex:t.deletionLineIndex,hunkContent:t.hunkContent,hunkContext:void 0,hunkSpecs:`@@ -${vi(t.deletionStart,t.deletionCount)} +${vi(t.additionStart,t.additionCount)} @@
|
|
1421
|
-
`,splitLineStart:e.splitLineCount+r,splitLineCount:n,unifiedLineStart:e.unifiedLineCount+r,unifiedLineCount:i,noEOFCRAdditions:!1,noEOFCRDeletions:!1};e.hunks.push(o),e.splitLineCount+=r+n,e.unifiedLineCount+=r+i,e.lastHunkEnd=t.additionStart+t.additionCount-1}function ul(e){if(e.activeHunk==null)return;const t=e.activeHunk,n=t.contextBufferCount,i=n-e.maxContextLines2,r=t.contextBufferAdditionStart+n-e.maxContextLines,o=t.contextBufferDeletionStart+n-e.maxContextLines;let s;if(t.contextBufferBaseConflicts!=null){const d=n-e.maxContextLines;for(const[h,c]of t.contextBufferBaseConflicts)h>=d&&(s??=new Map,s.set(h-d,c))}xn(e,t,"trailing");const l=t.additionCount,a=t.deletionCount;Mr(e),e.activeHunk=Dr(t.additionStart+l+i,t.deletionStart+a+i),e.activeHunk.contextBufferAdditionStart=r,e.activeHunk.contextBufferDeletionStart=o,e.activeHunk.contextBufferCount=e.maxContextLines,e.activeHunk.contextBufferBaseConflicts=s}function pi(e,t,n=-1){const i=Ar(e);i.contextBufferCount===0&&(i.contextBufferAdditionStart=e.additionLines.length,i.contextBufferDeletionStart=e.deletionLines.length),e.additionLines.push(t),e.deletionLines.push(t),n>=0&&(i.contextBufferBaseConflicts??=new Map,i.contextBufferBaseConflicts.set(i.contextBufferCount,n)),i.contextBufferCount++}function gi(e,t,n,i,r){let o=Ar(e);o.hunkContent.length>0&&o.contextBufferCount>e.maxContextLines2&&(ul(e),o=e.activeHunk),xn(e,o,o.hunkContent.length===0?"leading":"before-change");const s=e.additionLines.length,l=e.deletionLines.length;t==="addition"?e.additionLines.push(n):e.deletionLines.push(n);const a=cl(o,t,s,l);t==="addition"?(o.additionCount++,o.additionLines++):(o.deletionCount++,o.deletionLines++),Hr(e,i,r,a)}function fl(e,t,n,i){if(t.separatorLineIndex==null||t.markerLines.separator==null)throw new Error(`parseMergeConflictDiffFromFile: conflict ${t.conflictIndex} is missing a separator marker`);const r=e.conflictBuilders[t.conflictIndex];if(r==null)throw new Error(`parseMergeConflictDiffFromFile: failed to finalize conflict ${t.conflictIndex}`);const o=r.action;o.markerLines.separator=t.markerLines.separator,o.markerLines.end=i,t.markerLines.base!=null&&(o.markerLines.base=t.markerLines.base),o.conflict={conflictIndex:t.conflictIndex,startLineIndex:t.startLineIndex,startLineNumber:t.startLineIndex+1,separatorLineIndex:t.separatorLineIndex,separatorLineNumber:t.separatorLineIndex+1,endLineIndex:n,endLineNumber:n+1,baseMarkerLineIndex:t.baseMarkerLineIndex,baseMarkerLineNumber:t.baseMarkerLineIndex!=null?t.baseMarkerLineIndex+1:void 0};const s=o.currentContentIndex??o.incomingContentIndex;if(o.currentContentIndex??=s,o.incomingContentIndex??=s,o.startContentIndex<0&&s!=null&&(o.startContentIndex=s),o.endContentIndex<0&&s!=null&&(o.endContentIndex=s),o.endMarkerContentIndex<0&&s!=null&&(o.endMarkerContentIndex=s),o.hunkIndex<0||o.startContentIndex<0||o.endContentIndex<0||o.endMarkerContentIndex<0)throw new Error(`parseMergeConflictDiffFromFile: failed to anchor merge conflict ${t.conflictIndex}`);e.actions[o.conflictIndex]=o,r.completed=!0}function mi(e,t,n){const i=e.nextConflictIndex;e.nextConflictIndex++,e.conflictStack.push({conflictIndex:i,stage:"current",startLineIndex:n,markerLines:{start:t}}),e.conflictBuilders[i]={completed:!1,action:{conflict:{conflictIndex:i,startLineIndex:n,startLineNumber:n+1,separatorLineIndex:n,separatorLineNumber:n+1,endLineIndex:n,endLineNumber:n+1,baseMarkerLineIndex:void 0,baseMarkerLineNumber:void 0},conflictIndex:i,hunkIndex:-1,startContentIndex:-1,endContentIndex:-1,endMarkerContentIndex:-1,markerLines:{start:t,separator:"",end:""}}}}function Dr(e,t){return{additionStart:e,deletionStart:t,additionCount:0,deletionCount:0,additionLines:0,deletionLines:0,additionLineIndex:Math.max(e-1,0),deletionLineIndex:Math.max(t-1,0),hunkContent:[],contextBufferAdditionStart:Math.max(e-1,0),contextBufferDeletionStart:Math.max(t-1,0),contextBufferCount:0,contextBufferBaseConflicts:void 0}}function vi(e,t){return t===1?`${e}`:`${e},${t}`}function bi(e){if(e.length<7)return;const t=e.charCodeAt(0);if(t!==60&&t!==62&&t!==61&&t!==124)return;const n=pl(e);if(n<7)return;let i=1;for(;i<n&&e.charCodeAt(i)===t;)i++;if(!(i<7)){if(t===61)return i===n?"separator":void 0;if(!(i!==n&&!gl(e.charCodeAt(i))))return t===60?"start":t===62?"end":"base"}}function pl(e){let t=e.length;return t>0&&e.charCodeAt(t-1)===10&&t--,t>0&&e.charCodeAt(t-1)===13&&t--,t}function gl(e){return e===9||e===10||e===11||e===12||e===13||e===32}function Ci(e,t,n){return{...e,contents:n,cacheKey:e.cacheKey!=null?`${e.cacheKey}:merge-conflict-${t}`:void 0}}function Pr(e,t){const n=[],i=new Array(e.hunks.length),r=(s,l)=>{const a=e.hunks[s];if(a==null)return 0;let d=i[s];if(d==null){d=new Array(a.hunkContent.length+1);let h=a.unifiedLineStart;d[0]=h;for(let c=0;c<a.hunkContent.length;c++){const u=a.hunkContent[c];h+=u.type==="context"?u.lines:u.deletions+u.additions,d[c+1]=h}i[s]=d}return d[Math.max(l,0)]??a.unifiedLineStart},o=(s,l)=>{const a=r(s,l),d=i[s]?.[Math.max(l+1,0)]??r(s,l+1);return Math.max(a,d-1)};for(const s of t){if(s==null)continue;const l=e.hunks[s.hunkIndex];if(l==null)continue;const a=r(s.hunkIndex,s.startContentIndex);if(n.push(we(s,"marker-start",s.startContentIndex,s.markerLines.start,a)),s.baseContentIndex!=null){const f=s.currentContentIndex,g=s.incomingContentIndex;if(f==null||g==null)continue;const b=s.markerLines.base;if(b==null)continue;const y=l.hunkContent[f],m=l.hunkContent[s.baseContentIndex],p=l.hunkContent[g];if(y?.type!=="change"||m?.type!=="context"||p?.type!=="change")continue;const C=r(s.hunkIndex,f),v=r(s.hunkIndex,g);n.push(we(s,"marker-base",s.baseContentIndex,b,C+y.deletions)),n.push(we(s,"marker-separator",s.baseContentIndex,s.markerLines.separator,v),we(s,"marker-end",s.endMarkerContentIndex,s.markerLines.end,o(s.hunkIndex,s.endMarkerContentIndex)));continue}const d=s.currentContentIndex;if(d==null)continue;const h=l.hunkContent[d];if(h?.type!=="change")continue;const c=r(s.hunkIndex,d),u=h.deletions>0?c+h.deletions:a;n.push(we(s,"marker-separator",d,s.markerLines.separator,u),we(s,"marker-end",s.endMarkerContentIndex,s.markerLines.end,o(s.hunkIndex,s.endMarkerContentIndex)))}return n}function we(e,t,n,i,r){return{type:t,hunkIndex:e.hunkIndex,contentIndex:n,conflictIndex:e.conflictIndex,lineText:i,lineIndex:r}}function ml(e,t){let n=e.unifiedLineStart;for(let i=0;i<t;i++){const r=e.hunkContent[i];n+=r.type==="context"?r.lines:r.deletions+r.additions}return n}var Si=class extends Cr{pendingConflictActions=[];pendingMarkerRows=[];injectedRows=new Map;options;constructor(e={theme:_},t,n){super(void 0,t,n),this.options=e}setConflictState(e,t,n){this.pendingConflictActions=e,this.pendingMarkerRows=t,this.syncInjectedRows(e,t,n)}syncInjectedRows(e,t,n){this.injectedRows.clear();for(const i of e){const r=i!=null?Rr(i,n):void 0;if(i==null||r==null)continue;const o={type:"actions",hunkIndex:r.hunkIndex,lineIndex:r.lineIndex,conflictIndex:i.conflictIndex};this.addInjectedRow(o)}for(const i of t)this.addInjectedRow(i)}addInjectedRow(e){const t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);n==null?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=Ae){return e!=null&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}async asyncRender(e,t=Ae){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.asyncRender(e,t)}createPreElement(e,t){return super.createPreElement(e,t,{"data-has-merge-conflict":""})}getUnifiedLineDecoration({type:e,lineType:t}){const n=e==="change"?t==="change-deletion"?"current":"incoming":void 0;return{gutterLineType:e==="change"?"context":t,gutterProperties:yi(n),contentProperties:xi(e,n)}}getSplitLineDecoration({side:e,type:t}){const n=t==="change"?e==="deletions"?"current":"incoming":void 0;return{gutterLineType:t==="change"?"context":t,gutterProperties:yi(n),contentProperties:xi(t,n)}}getUnifiedInjectedRowsForLine=e=>{const t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(t==null||t.length===0)return;const{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),i=[],r=[];for(const o of t){if(o.type==="actions"){i.push({content:vl({row:o,includeDefaultActions:n==="default",includeSlot:!0}),gutter:Li("action")});continue}(o.type==="marker-end"?r:i).push({content:bl(o),gutter:Li("marker",o.type)})}return{before:i.length>0?i:void 0,after:r.length>0?r:void 0}};getOptionsWithDefaults(){const e=super.getOptionsWithDefaults();return e.diffStyle="unified",e.lineDiffType="none",e.mergeConflictActionsType=this.options.mergeConflictActionsType??"default",e}};function yi(e){return e!=null?{"data-merge-conflict":e}:void 0}function xi(e,t){if(t!=null){if(e==="change")return t==="current"||t==="incoming"?{"data-line-type":"context","data-merge-conflict":t}:void 0;if(t==="marker-start"||t==="marker-base"||t==="marker-separator"||t==="marker-end")return{"data-merge-conflict":t}}}function Li(e,t){const n=j(void 0,"annotation",1);return n.properties["data-gutter-buffer"]=e==="action"?"merge-conflict-action":`merge-conflict-${t??"marker"}`,n}function vl({row:e,includeDefaultActions:t,includeSlot:n}){const i=t?Cl(e.conflictIndex):[];return i.push(A({tagName:"slot",properties:{name:Ir({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":""}})),A({tagName:"div",properties:{"data-merge-conflict-actions":""},children:[A({tagName:"div",properties:{"data-merge-conflict-actions-content":""},children:i})]})}function bl(e){return A({tagName:"div",properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":""},children:[W(e.lineText.replace(/(?:\r\n|\n|\r)$/,""))]})}function Cl(e){return[Bt({resolution:"current",label:"Accept current change",conflictIndex:e}),ki(),Bt({resolution:"incoming",label:"Accept incoming change",conflictIndex:e}),ki(),Bt({resolution:"both",label:"Accept both",conflictIndex:e})]}function Bt({resolution:e,label:t,conflictIndex:n}){return A({tagName:"button",properties:{type:"button","data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[W(t)]})}function ki(){return A({tagName:"span",properties:{"data-merge-conflict-action-separator":""},children:[W("|")]})}function Sl(e,t){return e.hunkIndex===t.hunkIndex&&e.startContentIndex===t.startContentIndex&&e.endContentIndex===t.endContentIndex&&e.currentContentIndex===t.currentContentIndex&&e.baseContentIndex===t.baseContentIndex&&e.incomingContentIndex===t.incomingContentIndex&&e.endMarkerContentIndex===t.endMarkerContentIndex&&e.conflictIndex===t.conflictIndex&&yl(e.conflict,t.conflict)}function yl(e,t){return e.conflictIndex===t.conflictIndex&&e.startLineIndex===t.startLineIndex&&e.startLineNumber===t.startLineNumber&&e.separatorLineIndex===t.separatorLineIndex&&e.separatorLineNumber===t.separatorLineNumber&&e.endLineIndex===t.endLineIndex&&e.endLineNumber===t.endLineNumber&&e.baseMarkerLineIndex===t.baseMarkerLineIndex&&e.baseMarkerLineNumber===t.baseMarkerLineNumber}let xl=-1;var nd=class extends Sr{options;__id=`unresolved-file:${++xl}`;type="unresolved-file";computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0};conflictActions=[];markerRows=[];conflictActionCache=new Map;constructor(e={theme:_},t,n=!1){super(void 0,t,n),this.options=e,this.setOptions(e)}setOptions(e){if(e!=null){if(e.onMergeConflictAction!=null&&e.onMergeConflictResolve!=null)throw new Error("UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.");this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions()}}syncInteractionOptions(){this.interactionManager.setOptions(Ke(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,this.handleMergeConflictActionClick))}createHunksRenderer(e){return new Si(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){return Hl(e,this.options)}applyPreNodeAttributes(e,t){super.applyPreNodeAttributes(e,t,{"data-has-merge-conflict":""})}cleanUp(){this.emitPostRender(!0),this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:e,fileDiff:t,actions:n,markerRows:i}){const{maxContextLines:r,onMergeConflictAction:o}=this.options;e:if(o!=null){const s=t!=null;if(s!==(n!=null)||s!==(i!=null))throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together");if(t!=null&&n!=null&&i!=null){this.computedCache={file:e??this.computedCache.file,fileDiff:t,actions:n,markerRows:i};break e}else if(e!=null||this.computedCache.file!=null){if(e!=null&&this.computedCache.file!=null&&!ae(e,this.computedCache.file)&&this.computedCache.fileDiff!=null&&this.computedCache.actions!=null)throw new Error("UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.");if(e??=this.computedCache.file,e==null)throw new Error("UnresolvedFile.getOrComputeDiff: file is null, should be impossible");if(!ae(e,this.computedCache.file)||this.computedCache.fileDiff==null||this.computedCache.actions==null){const l=ui(e,r);this.computedCache={file:e,fileDiff:l.fileDiff,actions:l.actions,markerRows:l.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break e}else{t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break e}}else{if(t!=null||n!=null||i!=null)throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(e!=null&&this.computedCache.file!=null&&!ae(e,this.computedCache.file))throw new Error("UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.");if(this.computedCache.file??=e,this.computedCache.fileDiff==null&&this.computedCache.file!=null){const s=ui(this.computedCache.file,r);this.computedCache.fileDiff=s.fileDiff,this.computedCache.actions=s.actions,this.computedCache.markerRows=s.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break e}if(!(t==null||n==null||i==null))return{fileDiff:t,actions:n,markerRows:i}}hydrate(e){const{file:t,fileDiff:n,actions:i,markerRows:r,lineAnnotations:o,fileContainer:s,prerenderedHTML:l,preventEmit:a=!1}=e,d=this.getOrComputeDiff({file:t,fileDiff:n,actions:i,markerRows:r});d!=null&&(this.hydrateElements(s,l),this.setActiveMergeConflictState(d.actions,d.markerRows),Rl(this.pre,d.fileDiff,this.options.collapsed)||Al(this.headerElement,d.fileDiff,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):(this.hydrationSetup({fileDiff:d.fileDiff,lineAnnotations:o}),this.pre!=null&&this.renderMergeConflictActionSlots()),a||this.emitPostRender())}rerender(){!this.enabled||this.fileDiff==null||this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){const{file:t,fileDiff:n,actions:i,markerRows:r,lineAnnotations:o,preventEmit:s=!1,...l}=e,a=this.getOrComputeDiff({file:t,fileDiff:n,actions:i,markerRows:r});if(a==null)return!1;this.setActiveMergeConflictState(a.actions,a.markerRows);const d=super.render({...l,fileDiff:a.fileDiff,lineAnnotations:o,preventEmit:!0});return d&&(this.renderMergeConflictActionSlots(),s||this.emitPostRender()),d}resolveConflict(e,t,n=this.computedCache.fileDiff){const i=this.conflictActions[e];if(n==null||i==null)return;if(i.conflictIndex!==e)throw console.error({conflictIndex:e,action:i}),new Error("UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match");const r=dl(n,i,t),o=this.computedCache.file,{file:s,actions:l,markerRows:a}=Ll({fileDiff:r,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:o,resolution:t});return{file:s,fileDiff:r,actions:l,markerRows:a}}resolveConflictAndRender(e,t){const n=this.conflictActions[e];if(n==null)return;if(n.conflictIndex!==e)throw console.error({conflictIndex:e,action:n}),new Error("UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match");const i={resolution:t,conflict:n.conflict},{file:r,fileDiff:o,actions:s,markerRows:l}=this.resolveConflict(e,t)??{};r==null||o==null||s==null||l==null||(this.computedCache={file:r,fileDiff:o,actions:s,markerRows:l},this.setActiveMergeConflictState(s,l),this.workerManager!=null?this.hunksRenderer.renderDiff(o):this.render({forceRender:!0}),this.options.onMergeConflictResolve?.(r,i))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,this.computedCache.fileDiff!=null&&this.hunksRenderer instanceof Si&&this.hunksRenderer.setConflictState(this.options.mergeConflictActionsType==="none"?[]:e,t,this.computedCache.fileDiff)}handleMergeConflictActionClick=e=>{const t=this.conflictActions[e.conflictIndex];if(t==null)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),new Error("UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match");const n={resolution:e.resolution,conflict:t.conflict};if(this.options.onMergeConflictAction!=null){this.options.onMergeConflictAction(n,this);return}this.resolveConflictAndRender(e.conflictIndex,e.resolution)};renderMergeConflictActionSlots(){const{fileDiff:e}=this.computedCache;if(this.isContainerManaged||this.fileContainer==null||typeof this.options.mergeConflictActionsType!="function"||this.conflictActions.length===0||e==null){this.clearMergeConflictActionCache();return}const t=new Map(this.conflictActionCache);for(let n=0;n<this.conflictActions.length;n++){const i=this.conflictActions[n];if(i==null)continue;if(i.conflictIndex!==n)throw console.error({conflictIndex:n,action:i}),new Error("UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match");const r=Rr(i,e);if(r==null)continue;const o=i.conflictIndex,s=Ir({hunkIndex:r.hunkIndex,lineIndex:r.lineIndex,conflictIndex:o}),l=`${n}-${s}`;let a=this.conflictActionCache.get(l);if(a==null||!Sl(a.action,i)){a?.element.remove();const d=this.renderMergeConflictAction(i);if(d==null)continue;const h=pn(s);h.appendChild(d),this.fileContainer.appendChild(h),a={element:h,action:i},this.conflictActionCache.set(l,a)}t.delete(l)}for(const[n,{element:i}]of t.entries())this.conflictActionCache.delete(n),i.remove()}renderMergeConflictAction(e){if(typeof this.options.mergeConflictActionsType!="function")return;const t=this.options.mergeConflictActionsType(e,this);if(t!=null){if(t instanceof HTMLElement)return t;if(typeof DocumentFragment<"u"&&t instanceof DocumentFragment){const n=document.createElement("div");return n.style.display="contents",n.appendChild(t),n}}}clearMergeConflictActionCache(){for(const{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}};function Ll({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:i,resolution:r}){const o=t[n];if(o==null)throw new Error("rebuildFileAndActions: missing resolved action for unresolved file rebuild");const s=El(t,n,o,r),l=Pr(e,s);return{file:kl({fileDiff:e,resolvedAction:o,resolvedConflictIndex:n,previousFile:i,resolution:r}),actions:s,markerRows:l}}function kl({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:i,resolution:r}){const o=St(n?.contents??""),{conflict:s}=e,l=wl(o,s,r),a=[...o.slice(0,s.startLineIndex),...l,...o.slice(s.endLineIndex+1)].join("");return{name:n?.name??i.name,contents:a,cacheKey:n?.cacheKey!=null?`${n.cacheKey}:mc-${t}-${r}`:void 0}}function wl(e,t,n){const i=e.slice(t.startLineIndex+1,t.baseMarkerLineIndex??t.separatorLineIndex),r=e.slice(t.separatorLineIndex+1,t.endLineIndex);return n==="current"?i:n==="incoming"?r:[...i,...r]}function El(e,t,n,i){const r=Tl(n.conflict,i);return e.map((o,s)=>{if(s!==t&&o!=null)return o.conflict.startLineIndex>n.conflict.endLineIndex?{...o,conflict:Il(o.conflict,r)}:o})}function Tl(e,t){const n=(e.baseMarkerLineIndex??e.separatorLineIndex)-e.startLineIndex-1,i=e.endLineIndex-e.separatorLineIndex-1;return(t==="current"?n:t==="incoming"?i:n+i)-(e.endLineIndex-e.startLineIndex+1)}function Il(e,t){return{...e,startLineIndex:e.startLineIndex+t,startLineNumber:e.startLineNumber+t,separatorLineIndex:e.separatorLineIndex+t,separatorLineNumber:e.separatorLineNumber+t,endLineIndex:e.endLineIndex+t,endLineNumber:e.endLineNumber+t,baseMarkerLineIndex:e.baseMarkerLineIndex!=null?e.baseMarkerLineIndex+t:void 0,baseMarkerLineNumber:e.baseMarkerLineNumber!=null?e.baseMarkerLineNumber+t:void 0}}function Rl(e,t,n=!1){return!n&&e==null&&t!=null}function Al(e,t,n=!1){return e==null&&t!=null&&!n}function Hl(e,t){return{...t,...e,hunkSeparators:typeof e?.hunkSeparators=="function"?"custom":e?.hunkSeparators,mergeConflictActionsType:typeof e?.mergeConflictActionsType=="function"?"custom":e?.mergeConflictActionsType}}function Ml(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}const _r=1e3,Dl=_r*4,Pl=[0,1e-6,.99999,1],_l={overscrollSize:_r,intersectionObserverMargin:Dl,resizeDebugging:!1};let ht=0,Ol=-1;var id=class oe{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++Ol}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(t){this.config={..._l,...t}}setup(t,n){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Pl,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{oe.__STOP?(oe.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:oe.__lastScrollPosition}),Y(this.computeRenderRangeAndEmit)):(oe.__lastScrollPosition=this.getScrollTop(),oe.__STOP=!0)};for(const[i,r]of this.connectQueue.entries())this.connect(i,r);this.connectQueue.clear(),this.markDOMDirty(),Y(this.computeRenderRangeAndEmit)}}instanceChanged(t,n){this.instancesChanged.add(t),n&&this.markDOMDirty(),Y(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=Gt({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(t,n){const i=this.getScrollTop(),r=this.getHeight(),o=this.config.intersectionObserverMargin,s=i-o,l=i+r+o;return!(t<s-n||t>l)}handleContainerResize=t=>{if(this.root==null)return;let n=!1;for(const i of t){const r=i.borderBoxSize[0].blockSize;this.root instanceof Document?r!==this.scrollHeight&&(this.scrollHeightDirty=!0,n=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:r-ht,newSize:r}),ht=r)):i.target===this.root?r!==this.height&&(this.heightDirty=!0,n=!0):i.target===this.contentContainer&&(this.scrollHeightDirty=!0,n=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:r-ht,newSize:r}),ht=r))}n&&Y(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(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(t){return this.getScrollTop()+Ue(t,this.getScrollContainerElement())}connect(t,n){if(this.observers.has(t))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(t,n):(this.intersectionObserver.observe(t),this.observers.set(t,n),this.instancesChanged.add(n),this.markDOMDirty(),Y(this.computeRenderRangeAndEmit)),()=>this.disconnect(t)}disconnect(t){const n=this.observers.get(t);this.connectQueue.delete(t),n!=null&&(this.intersectionObserver?.unobserve(t),this.observers.delete(t),this.visibleInstances.delete(t)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),Y(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{oe.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,Y(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{oe.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,Y(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{oe.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,Y(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(oe.__STOP)return;const t=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let n=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const o=Gt({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&Ml(this.windowSpecs,o)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=o}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const i=this.getScrollAnchor(this.height),r=new Set;for(const o of t?this.observers.values():this.visibleInstances.values())o.onRender(t)&&r.add(o);for(const o of this.instancesChanged)r.has(o)||o.onRender(t)&&r.add(o);this.scrollFix(i);for(const o of r)o.reconcileHeights();n||=this.instancesChanged.size>0,n&&this.markDOMDirty(),(n||t)&&Y(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(t){if(t==null)return;const n=this.getScrollContainerElement(),{lineIndex:i,lineOffset:r,fileElement:o,fileOffset:s,fileTypeOffset:l}=t;if(i!=null&&r!=null){const d=o.shadowRoot?.querySelector(`[data-line][data-line-index="${i}"]`);if(d instanceof HTMLElement){const h=Ue(d,n);if(h!==r){const c=h-r;this.applyScrollFix(c)}return}}const a=Ue(o,n);if(l==="top")a!==s&&this.applyScrollFix(a-s);else{const d=a+o.getBoundingClientRect().height;d!==s&&this.applyScrollFix(d-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){const n=this.getScrollContainerElement();let i;for(const[r]of this.visibleInstances.entries()){const o=Ue(r,n),s=o+r.offsetHeight;let l,a;s<=0?(l=s,a="bottom"):(l=o,a="top");let d,h;if(s>0&&o<t)for(const u of r.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(u instanceof HTMLElement))continue;const f=u.dataset.lineIndex;if(f==null)continue;const g=Ue(u,n);if(!(g<0)){d=f,h=g;break}}if(i?.lineOffset!=null&&h==null)continue;let c=!1;(i==null||h!=null&&(i.lineOffset==null||h<i.lineOffset)||h==null&&i.lineOffset==null&&(l>=0&&(i.fileOffset<0||l<i.fileOffset)||l<0&&i.fileOffset<0&&l>i.fileOffset))&&(c=!0),c&&(i={fileElement:r,fileTypeOffset:a,fileOffset:l,lineIndex:d,lineOffset:h})}return i}handleIntersectionChange=t=>{this.scrollDirty=!0;for(const{target:n,isIntersecting:i}of t){if(!(n instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const r=this.observers.get(n);r!=null&&(i&&!this.visibleInstances.has(n)?(r.setVisibility(!0),this.visibleInstances.set(n,r),this.visibleInstancesDirty=!0):!i&&this.visibleInstances.has(n)&&(r.setVisibility(!1),this.visibleInstances.delete(n),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&Y(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=Math.max(0,Math.min(t,this.getScrollHeight()-this.getHeight())),this.scrollTop=t,t}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 Ue(e,t){const n=e.getBoundingClientRect(),i=t?.getBoundingClientRect().top??0;return n.top-i}function rd(e){const t=[];for(const n of e){const i=Se.get(n);if(i==null)throw new Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(i)}return t}function od(e){for(const t of Array.isArray(e)?e:[e])if(!Se.has(t))return!1;return!0}function sd(e,t,n=[]){if(e==="text"||e==="ansi")throw new Error("registerCustomLanguage: 'text' and 'ansi' are reserved language names");if(jt.has(e)){console.error(`registerCustomLanguage: lang: ${e} is already registered`);return}jt.set(e,t);for(const i of n)Xo(i,e)}async function ad(e){const t=[],n=[];for(const i of e){if(i==="text"||i==="ansi")continue;const r=Fi(i)??Ni(i);"then"in r?n.push(r):t.push(r)}return n.length>0&&await Promise.all(n).then(i=>{for(const r of i){if(r==null)throw new Error("resolvedLanguages: unable to resolve language");t.push(r)}}),t}function ld(e){return X.getResolvedThemes(e)}function Nl(e,t){try{const n=hn({name:e,load:t});X.registerTheme(n.name,n.load)}catch(n){if(n instanceof Vi){console.error("SharedHighlight.registerCustomTheme: theme name already registered",e);return}throw n}}function dd(e,t,n=!1){const i=Br({name:e,variablePrefix:B("global"),variableDefaults:t,fontStyle:n});Nl(e,()=>Promise.resolve(i))}async function hd(e){for(const n of e)ji(n);const t=await X.resolveThemes(e);for(let n=0;n<e.length;n++)qi(e[n],t[n]);return t}function cd(e,t){return e==null||t==null?e===t:e.busyWorkers===t.busyWorkers&&e.diffCacheSize===t.diffCacheSize&&e.fileCacheSize===t.fileCacheSize&&e.managerState===t.managerState&&e.activeTasks===t.activeTasks&&e.queuedTasks===t.queuedTasks&&e.themeSubscribers===t.themeSubscribers&&e.totalWorkers===t.totalWorkers&&e.workersFailed===t.workersFailed}function ud(e){const t=document.createElement("div");t.dataset.line=`${e}`;const n=document.createElement("div");n.dataset.columnNumber="",n.textContent=`${e}`;const i=document.createElement("div");return i.dataset.columnContent="",t.appendChild(n),t.appendChild(i),{row:t,content:i}}function fd(e,t=!1){return A({tagName:"style",children:[W(t?vs(e):mn(e))],properties:{[Qr]:t?"":void 0,[Ri]:t?void 0:""}})}function pd(e){return A({tagName:"style",children:[W(e)],properties:{[Ii]:""}})}function gd(e,t,n){const i=e.hunks[t];if(i==null)throw console.error({hunkIndex:t,diff:e}),new Error("diffAcceptRejectHunk: Invalid hunk index");return wr(e,{resolution:Tr(n),hunkIndex:t,...typeof n=="object"?{startContentIndex:n.changeIndex,endContentIndex:n.changeIndex}:{startContentIndex:0,endContentIndex:Math.max(0,(i.hunkContent.length??1)-1)}})}function md(e){return e.includes(`\r
|
|
1422
|
-
`)?"CRLF":e.includes("\r")?"CR":e.includes(`
|
|
1423
|
-
`)?"LF":"none"}function vd(e){const t=Fs(e);if(t.length!==1)throw console.error(t),new Error("PatchDiff: Provided patch must include only 1 patch, with 1 diff");const{files:n}=t[0];if(n.length!==1)throw console.error(n),new Error("FileDiff: Provided patch must contain exactly 1 file diff");return n[0]}function bd(e){const t=e[0];if(t!=="+"&&t!=="-"&&t!==" "&&t!=="\\"){console.error(`parseLineType: Invalid firstChar: "${t}", full line: "${e}"`);return}const n=e.substring(1);return{line:n===""?`
|
|
1424
|
-
`:n,type:t===" "?"context":t==="\\"?"metadata":t==="+"?"addition":"deletion"}}function Cd(e,t){return{...e,lang:t}}function Sd(e,t=10){const n=[];let i;for(const o of e.split(`
|
|
1425
|
-
`)){const s=o.match(Gr);if(s!=null){i!=null&&(i.hunkLines.length>0&&(ct(i,t,"trailing"),$t(i,n)),i=void 0);const l=parseInt(s[3]),a=parseInt(s[1]),d=parseInt(s[4]??"1"),h=parseInt(s[2]??"1");isNaN(l)||isNaN(a)||isNaN(d)||isNaN(h)?n.push(o):i={additionStart:l,deletionStart:a,additionCount:0,deletionCount:0,hunkLines:[],contextLines:[]};continue}if(i==null){n.push(o);continue}if(o.startsWith(" "))i.contextLines.push(o);else if(o!==""){if(i.hunkLines.length>0&&i.contextLines.length>t*2){const l=i.contextLines.length-t*2,a=i.contextLines.slice(-t);ct(i,t,"trailing");const{additionCount:d,deletionCount:h}=i;$t(i,n),i={additionStart:i.additionStart+d+l,deletionStart:i.deletionStart+h+l,deletionCount:0,additionCount:0,contextLines:a,hunkLines:[]}}ct(i,t,i.hunkLines.length===0?"leading":"before-change"),i.hunkLines.push(o),o.startsWith("+")?i.additionCount+=1:o.startsWith("-")&&(i.deletionCount+=1)}}i!=null&&i.hunkLines.length>0&&(ct(i,t,"trailing"),$t(i,n));const r=n.join(`
|
|
1426
|
-
`);return e.endsWith(`
|
|
1427
|
-
`)?`${r}
|
|
1428
|
-
`:r}function ct(e,t,n){if(n==="leading"&&e.contextLines.length>t){const i=e.contextLines.length-t;e.contextLines.splice(0,i),e.additionStart+=i,e.deletionStart+=i}return n==="trailing"&&e.contextLines.length>t&&(e.contextLines.length=t),e.contextLines.length>0&&(e.hunkLines.push(...e.contextLines),e.additionCount+=e.contextLines.length,e.deletionCount+=e.contextLines.length,e.contextLines.length=0),e}function $t(e,t){t.push(`@@ -${wi(e.deletionStart,e.deletionCount)} +${wi(e.additionStart,e.additionCount)} @@`),t.push(...e.hunkLines)}function wi(e,t){return t===1?`${e}`:`${e},${t}`}export{Yr as ALTERNATE_FILE_NAMES_GIT,gt as AttachedLanguages,vt as AttachedThemes,Wr as COMMIT_METADATA_SPLIT,Qr as CORE_CSS_ATTRIBUTE,an as CUSTOM_HEADER_SLOT_ID,hi as CodeToTokenTransformStream,ed as CodeView,_e as DEFAULT_CODE_VIEW_FILE_METRICS,eo as DEFAULT_CODE_VIEW_LAYOUT,jl as DEFAULT_COLLAPSED_CONTEXT_THRESHOLD,no as DEFAULT_EXPANDED_REGION,Ae as DEFAULT_RENDER_RANGE,to as DEFAULT_SMOOTH_SCROLL_SETTINGS,_ as DEFAULT_THEMES,Zr as DEFAULT_TOKENIZE_MAX_LENGTH,ln as DEFAULT_VIRTUAL_FILE_METRICS,$r as DIFFS_DEVELOPMENT_BUILD,Ai as DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY,Jr as DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE,Ei as DIFFS_TAG_NAME,Cr as DiffHunksRenderer,Hi as EMPTY_RENDER_RANGE,Ne as EXTENSION_TO_FILE_FORMAT,qr as FILENAME_HEADER_REGEX,Kr as FILENAME_HEADER_REGEX_GIT,Vl as FILE_CONTEXT_BLOB,xs as File,Sr as FileDiff,fs as FileRenderer,td as FileStream,Ti as GIT_DIFF_FILE_BREAK_REGEX,sn as HEADER_METADATA_SLOT_ID,on as HEADER_PREFIX_SLOT_ID,Gr as HUNK_HEADER,Xr as INDEX_LINE_METADATA,Pi as InteractionManager,$l as MERGE_CONFLICT_BASE_MARKER_REGEX,Gl as MERGE_CONFLICT_END_MARKER_REGEX,Wl as MERGE_CONFLICT_SEPARATOR_MARKER_REGEX,Bl as MERGE_CONFLICT_START_MARKER_REGEX,jt as RegisteredCustomLanguages,_i as ResizeManager,Se as ResolvedLanguages,It as ResolvingLanguages,jr as SPLIT_WITH_NEWLINES,nr as SVGSpriteSheet,sa as ScrollSyncManager,rl as ShikiStreamTokenizer,Ii as THEME_CSS_ATTRIBUTE,Ul as UNIFIED_DIFF_FILE_BREAK_REGEX,Ri as UNSAFE_CSS_ATTRIBUTE,nd as UnresolvedFile,As as VirtualizedFile,Oa as VirtualizedFileDiff,id as Virtualizer,ka as areDiffLineAnnotationsEqual,Fe as areDiffRenderOptionsEqual,Be as areDiffTargetsEqual,Oe as areFileRenderOptionsEqual,ae as areFilesEqual,wa as areHunkDataEqual,mt as areLanguagesAttached,ps as areLineAnnotationsEqual,He as areObjectsEqual,dn as areOptionsEqual,ir as arePrePropertiesEqual,Lt as areRenderRangesEqual,Wt as areSelectionsEqual,Ge as areThemesAttached,De as areThemesEqual,Ml as areVirtualWindowSpecsEqual,cd as areWorkerStatsEqual,Rn as attachResolvedLanguages,An as attachResolvedThemes,xe as cleanLastNewline,So as cleanUpResolvedLanguages,To as cleanUpResolvedThemes,Ld as codeToHtml,qt as createAnnotationElement,pn as createAnnotationWrapperNode,Br as createCSSVariablesTheme,jn as createDiffSpanDecoration,rt as createEmptyRowBuffer,Yi as createFileHeaderElement,j as createGutterGap,Di as createGutterItem,rr as createGutterUtilityContentNode,so as createGutterUtilityElement,Ee as createGutterWrapper,A as createHastElement,pt as createIconElement,ot as createNoNewlineElement,Xi as createPreElement,Yo as createPreWrapperProperties,ud as createRowNodes,ke as createSeparator,ol as createSpanFromToken,fd as createStyleElement,W as createTextNodeElement,pd as createThemeStyleElement,Ji as createTransformerWithState,or as createUnsafeCSSStyleNode,Gt as createWindowFromScrollPosition,io as dequeueRender,U as detachString,gd as diffAcceptRejectHunk,Xl as disposeHighlighter,oo as findCodeElement,B as formatCSSVariablePrefix,Zl as getCustomExtensionsMap,Jl as getCustomExtensionsVersion,Q as getFiletypeFromFileName,Ki as getHighlighterIfLoaded,un as getHighlighterOptions,fn as getHighlighterThemeStyles,aa as getHunkSeparatorSlotName,jo as getIconForType,ge as getLineAnnotationName,md as getLineEndingType,Kt as getLineNodes,je as getOrCreateCodeNode,rd as getResolvedLanguages,Fi as getResolvedOrResolveLanguage,$o as getResolvedOrResolveTheme,ld as getResolvedThemes,xt as getSharedHighlighter,vd as getSingularPatch,cn as getThemes,la as getTotalLineCountFromHunks,Hl as getUnresolvedDiffHunksRendererOptions,od as hasResolvedLanguages,Go as hasResolvedThemes,da as isDefaultRenderRange,ql as isHighlighterLoaded,Wo as isHighlighterLoading,Kl as isHighlighterNull,Oi as isWorkerContext,tn as parseDiffFromFile,bd as parseLineType,Fs as parsePatchFiles,lr as patchScrollbarGutterSize,Ke as pluckInteractionOptions,ro as prefersReducedMotion,Yl as preloadHighlighter,dr as prerenderHTMLIfNecessary,Ns as processFile,Qo as processLine,_s as processPatch,st as pushOrJoinSpan,Y as queueRender,dd as registerCustomCSSVariableTheme,sd as registerCustomLanguage,Nl as registerCustomTheme,hr as releaseStringDetachBuffer,ba as renderDiffWithHighlighter,hs as renderFileWithHighlighter,Ql as replaceCustomExtensions,dl as resolveConflict,Ni as resolveLanguage,ad as resolveLanguages,wr as resolveRegion,Bo as resolveTheme,hd as resolveThemes,Xo as setCustomExtension,Cd as setLanguageOverride,bn as setPreNodeProperties,Sd as trimPatchContext,vs as wrapCoreCSS,vn as wrapThemeCSS,mn as wrapUnsafeCSS};
|