pinomad 0.11.0 → 0.13.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/README.md +1 -1
- package/dist/{chunk-wb10efyq.js → chunk-445cevpm.js} +1 -1
- package/dist/{chunk-jt34g8st.js → chunk-4fferbxw.js} +247 -27
- package/dist/{chunk-67gq282t.js → chunk-53xv3fny.js} +725 -75
- package/dist/{chunk-44pnts98.js → chunk-563fnad9.js} +1 -1
- package/dist/{chunk-b457q0tm.js → chunk-6th9xv39.js} +11 -8
- package/dist/{chunk-ncbqa8jk.js → chunk-7mn38n4f.js} +1 -1
- package/dist/{chunk-as6pyf00.js → chunk-90g1cg9n.js} +1 -1
- package/dist/{chunk-9h5vawnm.js → chunk-aapsc9g0.js} +270 -66
- package/dist/{chunk-n1m1tjrk.js → chunk-d4tq62yr.js} +57 -16
- package/dist/{chunk-gtdpjqa3.js → chunk-d9mq5d46.js} +205 -49
- package/dist/{chunk-y127fe1a.js → chunk-g3ahp7b9.js} +11 -0
- package/dist/{chunk-xqycs43g.js → chunk-kmzzjv53.js} +83 -8
- package/dist/{chunk-4dcs8sbj.js → chunk-m51mq8vh.js} +43 -21
- package/dist/{chunk-tj57aqav.js → chunk-maqv34cs.js} +2 -2
- package/dist/chunk-nq57fdnq.js +106 -0
- package/dist/{chunk-h5q2y57m.js → chunk-ra86wjp5.js} +10 -4
- package/dist/{chunk-sd5fkxjj.js → chunk-s0h7c7da.js} +1 -1
- package/dist/chunk-sd640dt7.js +22 -0
- package/dist/{chunk-6d16c2fv.js → chunk-t6fw0wa9.js} +13 -6
- package/dist/{chunk-vvj9b1gc.js → chunk-wd7aracm.js} +188 -54
- package/dist/pinomad.js +15 -14
- package/package.json +13 -11
- package/web/assets/astro-DOly5024.js +1 -0
- package/web/assets/c-BIGW1oBm.js +1 -0
- package/web/assets/core-BHm2gdHL.js +4 -0
- package/web/assets/cpp-DddhVWhK.js +1 -0
- package/web/assets/csharp-B_TYUkTI.js +1 -0
- package/web/assets/css-Z72CF80r.js +1 -0
- package/web/assets/dart-CtKP3W-j.js +1 -0
- package/web/assets/diff-D97Zzqfu.js +1 -0
- package/web/assets/dockerfile-BcOcwvcX.js +1 -0
- package/web/assets/elixir-DkJLSxtU.js +1 -0
- package/web/assets/engine-javascript-BHPwbUfN.js +141 -0
- package/web/assets/engine-oniguruma-CQjQPVHy.js +1 -0
- package/web/assets/fish-BvzEVeQv.js +1 -0
- package/web/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/web/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/web/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/web/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/web/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/web/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/web/assets/go-C27-OAKa.js +1 -0
- package/web/assets/graphql-ChdNCCLP.js +1 -0
- package/web/assets/haskell-Df6bDoY_.js +1 -0
- package/web/assets/hcl-BWvSN4gD.js +1 -0
- package/web/assets/highlighted-diff-DrHvSLK9.js +175 -0
- package/web/assets/highlights-1aLwssz-.js +4 -0
- package/web/assets/highlights-themes-C1p4pFYS.js +1 -0
- package/web/assets/html-BlS82ilI.js +1 -0
- package/web/assets/index-A_AUJoO6.css +1 -0
- package/web/assets/index-BafYMKiN.js +396 -0
- package/web/assets/ini-BEwlwnbL.js +1 -0
- package/web/assets/java-CylS5w8V.js +1 -0
- package/web/assets/javascript-wDzz0qaB.js +1 -0
- package/web/assets/json-Cp-IABpG.js +1 -0
- package/web/assets/jsonc-Des-eS-w.js +1 -0
- package/web/assets/jsx-g9-lgVsj.js +1 -0
- package/web/assets/kotlin-BdnUsdx6.js +1 -0
- package/web/assets/less-B1dDrJ26.js +1 -0
- package/web/assets/lua-BaeVxFsk.js +1 -0
- package/web/assets/make-CHLpvVh8.js +1 -0
- package/web/assets/markdown-Cvjx9yec.js +1 -0
- package/web/assets/nix-CwoSXNpI.js +1 -0
- package/web/assets/objective-c-DXmwc3jG.js +1 -0
- package/web/assets/php-DoruYMF0.js +1 -0
- package/web/assets/pierre-dark-CyvmCCZW.js +1 -0
- package/web/assets/pierre-dark-VKo95ZgA.js +1 -0
- package/web/assets/pierre-light-480U9XYS.js +1 -0
- package/web/assets/pierre-light-BVSW-Xev.js +1 -0
- package/web/assets/postcss-DnzrXTVv.js +1 -0
- package/web/assets/powershell-Dd0kTxKP.js +1 -0
- package/web/assets/prisma-Vru482bI.js +1 -0
- package/web/assets/proto-C7zT0LnQ.js +1 -0
- package/web/assets/python-B6aJPvgy.js +1 -0
- package/web/assets/ruby-B43yHlf9.js +1 -0
- package/web/assets/rust-DPvrY3IQ.js +1 -0
- package/web/assets/scala-CqE71os6.js +1 -0
- package/web/assets/scss-Cw6XMfVs.js +1 -0
- package/web/assets/shellscript-Yzrsuije.js +1 -0
- package/web/assets/shiki-BwyCm3kZ.js +2 -0
- package/web/assets/shiki-langs-CMlALLSg.js +2 -0
- package/web/assets/shiki-wasm-CgFRq91U.js +1 -0
- package/web/assets/sql-DkvoVjww.js +1 -0
- package/web/assets/stream-tokenizer-BlgIhw0y.js +4 -0
- package/web/assets/svelte-DoIXUgJc.js +1 -0
- package/web/assets/swift-C2oV4EkX.js +1 -0
- package/web/assets/terraform-BETggiCN.js +1 -0
- package/web/assets/theming-themes-DDvoqEqT.js +1 -0
- package/web/assets/toml-vGWfd6FD.js +1 -0
- package/web/assets/tsx-COt5Ahok.js +1 -0
- package/web/assets/typescript-BPQ3VLAy.js +1 -0
- package/web/assets/vue-CwSeJimo.js +1 -0
- package/web/assets/xml-sdJ4AIDG.js +1 -0
- package/web/assets/xterm-view-6GBZ9nXN.css +32 -0
- package/web/assets/xterm-view-BnKOnF3C.js +38 -0
- package/web/assets/yaml-Buea-lGh.js +1 -0
- package/web/assets/zig-VOosw3JB.js +1 -0
- package/web/index.html +2 -2
- package/dist/chunk-etf7ef97.js +0 -55
- package/dist/chunk-greb3dp6.js +0 -22
- package/web/assets/index-BhHrKpoo.js +0 -395
- package/web/assets/index-DoyHMPwf.css +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlights-themes-C1p4pFYS.js","assets/index-BafYMKiN.js","assets/index-A_AUJoO6.css","assets/theming-themes-DDvoqEqT.js","assets/highlights-1aLwssz-.js","assets/stream-tokenizer-BlgIhw0y.js","assets/shiki-BwyCm3kZ.js","assets/core-BHm2gdHL.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var io=Object.defineProperty;var ro=(e,t,n)=>t in e?io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var w=(e,t,n)=>ro(e,typeof t!="symbol"?t+"":t,n);import{_ as dt,r as G,j as X}from"./index-BafYMKiN.js";const qi="diffs-container";(()=>{try{return!1}catch{return!1}})();const oo=/(?=^From [a-f0-9]+ .+$)/m,Ki=/(?=^diff --git)/gm,so=new RegExp("(?<=\\n)"),ao=/^(---|\+\+\+)\s+([^\t\r\n]+)/,lo=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Yi="header-prefix",Xi="header-filename-suffix",Zi="header-metadata",Dn="header-custom",Le={dark:"pierre-dark",light:"pierre-light"},uo="data-theme-css",co="data-unsafe-css",ho="data-diffs-scrollbar-measure",Ji="--diffs-scrollbar-gutter-measured",fo=1e5,go={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},po=Object.freeze({fromStart:0,fromEnd:0}),Wn={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Qi=Object.freeze([]),mo={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};let Ie,an=0;var Mt=class extends Error{constructor(){super("Highlighter is disposed"),this.name="HighlighterDisposedError"}};function vo(){return Ie}function Tn(e){return e??Ie??"shiki-js"}function bo(e){if(Ie!=null&&Ie!==e)throw new Error(`Cannot load the "${e}" highlighter while "${Ie}" is in use. Only one highlighter type can be active at a time; dispose every "${Ie}" instance (disposeHighlighter() disposes the shared one) before switching.`)}function yo(e){bo(e),Ie=e,an++}function So(){an--,an===0&&(Ie=void 0)}const Ec=new Map,Rc=new Map,Ac=new Map,Co=new Set;function Hn(e=Le){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function xo(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Mn(e){let t;return()=>t??(t=e().then(n=>(t=n,n),n=>{throw t=void 0,n}))}function ko(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var wo=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},Bn=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},Lo=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function Eo(e={}){const t=new Map,n=new Map,i=new Map;let r=0;function o(m,v){if(t.has(m))throw new wo(m);t.set(m,v)}function s(m,v){return t.has(m)?!1:(t.set(m,v),!0)}function l(m){return t.has(m)}function a(m){const v=n.get(m);if(v!==void 0)return Promise.resolve(v);const C=i.get(m);if(C!==void 0)return C;const y=t.get(m);if(y===void 0&&e.fallbackLoader===void 0)return Promise.reject(new Bn(m));const x=r,L=Promise.resolve().then(()=>{var k;return y!==void 0?y():(k=e.fallbackLoader)==null?void 0:k.call(e,m)}).then(async k=>{if(k===void 0)throw new Bn(m);const R=ko(k),H=e.normalizeTheme===void 0?R:await e.normalizeTheme(R,m);return x===r&&n.set(m,H),i.get(m)===L&&i.delete(m),H}).catch(k=>{throw i.get(m)===L&&i.delete(m),k});return i.set(m,L),L}function u(m){return Promise.all(m.map(v=>a(v)))}function d(m,v){n.set(m,v)}function c(m){for(const[v,C]of m)d(v,C)}function f(m){return n.get(m)}function h(m){const v=[];for(const C of m){const y=n.get(C);if(y===void 0)throw new Lo(C);v.push(y)}return v}function g(m){return n.has(m)}function p(m){for(const v of m)if(!n.has(v))return!1;return!0}function b(m){const v=n.get(m);return v!==void 0?v:a(m)}function S(){r++,n.clear(),i.clear()}return{clearResolvedThemes:S,getResolvedOrResolveTheme:b,getResolvedTheme:f,getResolvedThemes:h,hasRegisteredTheme:l,hasResolvedTheme:g,hasResolvedThemes:p,registerTheme:o,registerThemeIfAbsent:s,resolveTheme:a,resolveThemes:u,seedResolvedTheme:d,seedResolvedThemes:c}}const Ro=new Map,Vn=new Map,Ao=Mn(()=>dt(()=>import("./highlights-themes-C1p4pFYS.js"),__vite__mapDeps([0,1,2]))),Do=Mn(()=>dt(()=>import("./theming-themes-DDvoqEqT.js"),__vite__mapDeps([3,1,2]))),To=Mn(()=>dt(()=>import("./core-BHm2gdHL.js").then(e=>e.b),[])),Ho=[["editor.lineHighlightBackground","editor.active_line.background"],["editor.selectionBackground","element.selected"],["editor.findMatchBackground","search.match_background"],["editor.findMatchHighlightBackground","search.match_background"],["editorBracketMatch.background","editor.document_highlight.bracket_background"],["editorError.foreground","error"],["editorWarning.foreground","warning"],["editorInfo.foreground","info"],["editorHint.foreground","hint"],["gitDecoration.addedResourceForeground","created","terminal.ansi.green"],["gitDecoration.deletedResourceForeground","deleted","terminal.ansi.red"],["gitDecoration.modifiedResourceForeground","modified","terminal.ansi.blue"]];function jn(e,t){var l;const n="themes"in t?t.themes[0]:t;if(n==null)throw new Error(`Theme "${e}" is an empty Zed theme family.`);const i={...n,name:e},r={};for(const[a,u]of Object.entries(i.style))typeof u=="string"&&(r[a]=u);const o=(l=i.style.players)==null?void 0:l[0];(o==null?void 0:o.cursor)!=null&&(r["editorCursor.foreground"]??(r["editorCursor.foreground"]=o.cursor)),(o==null?void 0:o.selection)!=null&&(r["editor.selectionBackground"]??(r["editor.selectionBackground"]=o.selection));for(const[a,...u]of Ho){if(r[a]!=null)continue;const d=u.find(c=>r[c]!=null);d!=null&&(r[a]=r[d])}if(i.cssVariables===!0)r["editor.foreground"]="var(--hls-foreground)",r["editor.background"]="var(--hls-background)";else if(typeof i.cssVariables=="object"){r["editor.foreground"]??(r["editor.foreground"]=r.text??r.foreground??"foreground"),r["editor.background"]??(r["editor.background"]=r.background??"background");const{prefix:a="--hls-",defaults:u}=i.cssVariables;for(const[d,c]of Object.entries(r)){const f=u==null?void 0:u[c];r[d]=`var(${a}${c}${f?`, ${f}`:""})`}}const s=i.appearance==="light"?"light":"dark";return{name:e,type:s,colors:r,zed:i,fg:r["editor.foreground"]??r.text??r.foreground??(s==="light"?"#333333":"#bbbbbb"),bg:r["editor.background"]??r.background??(s==="light"?"#ffffff":"#1e1e1e")}}function Mo(e){let t=Vn.get(e);return t!=null||(t=Eo({fallbackLoader:async n=>{if(typeof __DIFFS_WORKER__<"u"?__DIFFS_WORKER__:xo())throw new Error(`Theme "${n}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedThemes parameter.`);const i=Ro.get(n);if(e==="highlights"){const r=(i==null?void 0:i.zed)??(i==null?void 0:i.diffs);if(r!=null){const a=await r(),u="default"in a?a.default:a;if("zed"in u&&u.zed!=null)return u;if("style"in u||"themes"in u)return jn(n,u);throw new Error(`Theme "${n}" is a TextMate theme; register a Zed theme with registerCustomTheme(name, loader, 'zed') for Highlights.`)}const o=Ao(),{themes:s}=o instanceof Promise?await o:o,l=s[n];if(l!=null)return jn(n,(await l()).default);if((i==null?void 0:i.textmate)!=null)throw new Error(`Theme "${n}" is only registered for TextMate; use registerCustomTheme(name, loader, 'zed') for Highlights.`)}else{const r=(i==null?void 0:i.textmate)??(i==null?void 0:i.diffs);let o;if(r!=null){const d=await r();o="default"in d?d.default:d}else{const d=Do(),{themes:c}=d instanceof Promise?await d:d,f=c.getTheme(n);if(f==null&&(i==null?void 0:i.zed)!=null)throw new Error(`Theme "${n}" is only registered for Zed; use registerCustomTheme(name, loader, 'textmate') for Shiki.`);if(f==null)throw new Error(`No valid theme loader registered for "${n}"`);const h=await f.load();o="default"in h?h.default:h}if("style"in o||"themes"in o)throw new Error(`Theme "${n}" is a Zed theme; use preferredHighlighter: 'highlights' or register a TextMate theme for Shiki.`);const s=To(),{normalizeTheme:l,createCssVariablesTheme:a}=s instanceof Promise?await s:s;if("cssVariables"in o&&o.cssVariables!=null)return{...o,textmate:l(a(o.cssVariables))};if("textmate"in o&&o.textmate!=null)return{...o,textmate:l(o.textmate)};const u=l(o);return{name:u.name,type:u.type,fg:u.fg,bg:u.bg,colors:u.colors,textmate:u}}throw new Error(`No valid theme loader registered for "${n}"`)},normalizeTheme:(n,i)=>{if(n.name!==i)throw new Error(`resolvedTheme: themeName: ${i} does not match theme.name: ${n.name}`);return n}}),Vn.set(e,t)),t}function ln(e,t=Tn()){return typeof t!="string"&&t.isDisposed?!1:(typeof t=="string"?Mo(t):t.themeResolver).hasResolvedThemes(Hn(e))}let me;async function Io(e){const t=Tn(e);yo(t);try{if(t==="highlights"){const{HighlightsHighlighter:i}=await dt(async()=>{const{HighlightsHighlighter:r}=await import("./highlights-1aLwssz-.js");return{HighlightsHighlighter:r}},__vite__mapDeps([4,5,1,2]));return new i}const{ShikiHighlighter:n}=await dt(async()=>{const{ShikiHighlighter:i}=await import("./shiki-BwyCm3kZ.js");return{ShikiHighlighter:i}},__vite__mapDeps([6,1,2,5,7]));return await n.create(t)}finally{So()}}async function In({themes:e,langs:t,preferredHighlighter:n}){er();const i=me??(me=Io(vo()??n));let r;try{r=await i}catch(o){throw me===i&&(me=void 0),o}if(me===i&&(me=r),await Promise.all([r.themeResolver.resolveThemes(e),r.loadLanguages(t)]),r.isDisposed)throw new Mt;return r}function er(){me!=null&&!("then"in me)&&me.isDisposed&&(me=void 0)}function Ge({theme:e,lang:t,langs:n}={}){er();const i=me;if(!(i==null||"then"in i||e!=null&&!ln(e,i)||(t!=null||n!=null)&&!i.hasLoadedLanguages([...t!=null?[t]:[],...n??[]])))return i}async function Po(e){await In(e)}const Ke=new Set;let Ye=null;function tr(e){Ke.add(e),Ye??(Ye=requestAnimationFrame(nr))}function dn(e){Ke.delete(e)&&Ke.size===0&&Ye!=null&&(cancelAnimationFrame(Ye),Ye=null)}function nr(e){const t=new Set(Ke);Ke.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Ke.size>0?Ye=requestAnimationFrame(nr):Ye=null}function un(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 Pn(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ir(e,t){const n=(e==null?void 0:e.theme)??Le,i=(t==null?void 0:t.theme)??Le,r=Gn(e),o=Gn(t);return Pn(n,i)&&un(e,t,["theme","parseDiffOptions"])&&un(r,o)}function Gn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function cn(e,t){return(e==null?void 0:e.start)===(t==null?void 0:t.start)&&(e==null?void 0:e.end)===(t==null?void 0:t.end)&&(e==null?void 0:e.side)===(t==null?void 0:t.side)&&(e==null?void 0:e.endSide)===(t==null?void 0:t.endSide)}function ve(e){return{type:"text",value:e}}function z({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function It({name:e,width:t=16,height:n=16,properties:i}){return z({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[z({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function ht(e){return z({tagName:"div",properties:{"data-gutter":""},children:e})}function No(e,t,n,i={}){return z({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[z({tagName:"span",properties:{"data-line-number-content":""},children:[ve(`${t}`)]})]:void 0})}function he(e,t,n){return z({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 Fo(){return z({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[It({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}const Oo=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class ct{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}ct.prototype.normal={};ct.prototype.property={};ct.prototype.space=void 0;function rr(e,t){const n={},i={};for(const r of e)Object.assign(n,r.property),Object.assign(i,r.normal);return new ct(n,i,t)}function hn(e){return e.toLowerCase()}class oe{constructor(t,n){this.attribute=n,this.property=t}}oe.prototype.attribute="";oe.prototype.booleanish=!1;oe.prototype.boolean=!1;oe.prototype.commaOrSpaceSeparated=!1;oe.prototype.commaSeparated=!1;oe.prototype.defined=!1;oe.prototype.mustUseProperty=!1;oe.prototype.number=!1;oe.prototype.overloadedBoolean=!1;oe.prototype.property="";oe.prototype.spaceSeparated=!1;oe.prototype.space=void 0;let zo=0;const P=We(),q=We(),fn=We(),A=We(),V=We(),Ue=We(),ae=We();function We(){return 2**++zo}const gn=Object.freeze(Object.defineProperty({__proto__:null,boolean:P,booleanish:q,commaOrSpaceSeparated:ae,commaSeparated:Ue,number:A,overloadedBoolean:fn,spaceSeparated:V},Symbol.toStringTag,{value:"Module"})),_t=Object.keys(gn);class Nn extends oe{constructor(t,n,i,r){let o=-1;if(super(t,n),qn(this,"space",r),typeof i=="number")for(;++o<_t.length;){const s=_t[o];qn(this,_t[o],(i&gn[s])===gn[s])}}}Nn.prototype.defined=!0;function qn(e,t,n){n&&(e[t]=n)}function Ze(e){const t={},n={};for(const[i,r]of Object.entries(e.properties)){const o=new Nn(i,e.transform(e.attributes||{},i),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[hn(i)]=i,n[hn(o.attribute)]=i}return new ct(t,n,e.space)}const or=Ze({properties:{ariaActiveDescendant:null,ariaAtomic:q,ariaAutoComplete:null,ariaBusy:q,ariaChecked:q,ariaColCount:A,ariaColIndex:A,ariaColSpan:A,ariaControls:V,ariaCurrent:null,ariaDescribedBy:V,ariaDetails:null,ariaDisabled:q,ariaDropEffect:V,ariaErrorMessage:null,ariaExpanded:q,ariaFlowTo:V,ariaGrabbed:q,ariaHasPopup:null,ariaHidden:q,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V,ariaLevel:A,ariaLive:null,ariaModal:q,ariaMultiLine:q,ariaMultiSelectable:q,ariaOrientation:null,ariaOwns:V,ariaPlaceholder:null,ariaPosInSet:A,ariaPressed:q,ariaReadOnly:q,ariaRelevant:null,ariaRequired:q,ariaRoleDescription:V,ariaRowCount:A,ariaRowIndex:A,ariaRowSpan:A,ariaSelected:q,ariaSetSize:A,ariaSort:null,ariaValueMax:A,ariaValueMin:A,ariaValueNow:A,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function sr(e,t){return t in e?e[t]:t}function ar(e,t){return sr(e,t.toLowerCase())}const Uo=Ze({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ue,acceptCharset:V,accessKey:V,action:null,allow:null,allowFullScreen:P,allowPaymentRequest:P,allowUserMedia:P,alpha:P,alt:null,as:null,async:P,autoCapitalize:null,autoComplete:V,autoFocus:P,autoPlay:P,blocking:V,capture:null,charSet:null,checked:P,cite:null,className:V,closedBy:null,colorSpace:null,cols:A,colSpan:A,command:null,commandFor:null,content:null,contentEditable:q,controls:P,controlsList:V,coords:A|Ue,crossOrigin:null,data:null,dateTime:null,decoding:null,default:P,defer:P,dir:null,dirName:null,disabled:P,download:fn,draggable:q,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:P,formTarget:null,headers:V,height:A,hidden:fn,high:A,href:null,hrefLang:null,htmlFor:V,httpEquiv:V,id:null,imageSizes:null,imageSrcSet:null,inert:P,inputMode:null,integrity:null,is:null,isMap:P,itemId:null,itemProp:V,itemRef:V,itemScope:P,itemType:V,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:P,low:A,manifest:null,max:null,maxLength:A,media:null,method:null,min:null,minLength:A,multiple:P,muted:P,name:null,nonce:null,noModule:P,noValidate:P,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:P,optimum:A,pattern:null,ping:V,placeholder:null,playsInline:P,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:P,referrerPolicy:null,rel:V,required:P,reversed:P,rows:A,rowSpan:A,sandbox:V,scope:null,scoped:P,seamless:P,selected:P,shadowRootClonable:P,shadowRootCustomElementRegistry:P,shadowRootDelegatesFocus:P,shadowRootMode:null,shadowRootSerializable:P,shape:null,size:A,sizes:null,slot:null,span:A,spellCheck:q,src:null,srcDoc:null,srcLang:null,srcSet:null,start:A,step:null,style:null,tabIndex:A,target:null,title:null,translate:null,type:null,typeMustMatch:P,useMap:null,value:q,width:A,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V,axis:null,background:null,bgColor:null,border:A,borderColor:null,bottomMargin:A,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:P,declare:P,event:null,face:null,frame:null,frameBorder:null,hSpace:A,leftMargin:A,link:null,longDesc:null,lowSrc:null,marginHeight:A,marginWidth:A,noResize:P,noHref:P,noShade:P,noWrap:P,object:null,profile:null,prompt:null,rev:null,rightMargin:A,rules:null,scheme:null,scrolling:q,standby:null,summary:null,text:null,topMargin:A,valueType:null,version:null,vAlign:null,vLink:null,vSpace:A,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:P,disablePictureInPicture:P,disableRemotePlayback:P,exportParts:Ue,part:V,prefix:null,property:null,results:A,security:null,unselectable:null},space:"html",transform:ar}),_o=Ze({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ae,accentHeight:A,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:A,amplitude:A,arabicForm:null,ascent:A,attributeName:null,attributeType:null,azimuth:A,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:A,by:null,calcMode:null,capHeight:A,className:V,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:A,diffuseConstant:A,direction:null,display:null,dur:null,divisor:A,dominantBaseline:null,download:P,dx:null,dy:null,edgeMode:null,editable:null,elevation:A,enableBackground:null,end:null,event:null,exponent:A,externalResourcesRequired:null,fill:null,fillOpacity:A,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ue,g2:Ue,glyphName:Ue,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:A,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:A,horizOriginX:A,horizOriginY:A,id:null,ideographic:A,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:A,k:A,k1:A,k2:A,k3:A,k4:A,kernelMatrix:ae,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:A,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:A,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:A,overlineThickness:A,paintOrder:null,panose1:null,path:null,pathLength:A,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:A,pointsAtY:A,pointsAtZ:A,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ae,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ae,rev:ae,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ae,requiredFeatures:ae,requiredFonts:ae,requiredFormats:ae,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:A,specularExponent:A,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:A,strikethroughThickness:A,string:null,stroke:null,strokeDashArray:ae,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:A,strokeOpacity:A,strokeWidth:null,style:null,surfaceScale:A,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ae,tabIndex:A,tableValues:null,target:null,targetX:A,targetY:A,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ae,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:A,underlineThickness:A,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:A,values:null,vAlphabetic:A,vMathematical:A,vectorEffect:null,vHanging:A,vIdeographic:A,version:null,vertAdvY:A,vertOriginX:A,vertOriginY:A,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:A,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:sr}),lr=Ze({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),dr=Ze({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ar}),ur=Ze({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),$o=/[A-Z]/g,Kn=/-[a-z]/g,Wo=/^data[-\w.:]+$/i;function Bo(e,t){const n=hn(t);let i=t,r=oe;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Wo.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Kn,jo);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Kn.test(o)){let s=o.replace($o,Vo);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}r=Nn}return new r(i,t)}function Vo(e){return"-"+e.toLowerCase()}function jo(e){return e.charAt(1).toUpperCase()}const Go=rr([or,Uo,lr,dr,ur],"html"),cr=rr([or,_o,lr,dr,ur],"svg"),Yn={}.hasOwnProperty;function qo(e,t){const n=t||{};function i(r,...o){let s=i.invalid;const l=i.handlers;if(r&&Yn.call(r,e)){const a=String(r[e]);s=Yn.call(l,a)?l[a]:i.unknown}if(s)return s.call(this,r,...o)}return i.handlers=n.handlers||{},i.invalid=n.invalid,i.unknown=n.unknown,i}const Ko=/["&'<>`]/g,Yo=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Xo=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Zo=/[|\\{}()[\]^$+*?.]/g,Xn=new WeakMap;function Jo(e,t){if(e=e.replace(t.subset?Qo(t.subset):Ko,i),t.subset||t.escapeOnly)return e;return e.replace(Yo,n).replace(Xo,i);function n(r,o,s){return t.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,s.charCodeAt(o+2),t)}function i(r,o,s){return t.format(r.charCodeAt(0),s.charCodeAt(o+1),t)}}function Qo(e){let t=Xn.get(e);return t||(t=es(e),Xn.set(e,t)),t}function es(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Zo,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const ts=/[\dA-Fa-f]/;function ns(e,t,n){const i="&#x"+e.toString(16).toUpperCase();return n&&t&&!ts.test(String.fromCharCode(t))?i:i+";"}const is=/\d/;function rs(e,t,n){const i="&#"+String(e);return n&&t&&!is.test(String.fromCharCode(t))?i:i+";"}const os=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],$t={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},ss=["cent","copy","divide","gt","lt","not","para","times"],hr={}.hasOwnProperty,pn={};let ft;for(ft in $t)hr.call($t,ft)&&(pn[$t[ft]]=ft);const as=/[^\dA-Za-z]/;function ls(e,t,n,i){const r=String.fromCharCode(e);if(hr.call(pn,r)){const o=pn[r],s="&"+o;return n&&os.includes(o)&&!ss.includes(o)&&(!i||t&&t!==61&&as.test(String.fromCharCode(t)))?s:s+";"}return""}function ds(e,t,n){let i=ns(e,t,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=ls(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const o=rs(e,t,n.omitOptionalSemicolons);o.length<i.length&&(i=o)}return r&&(!n.useShortestReferences||r.length<i.length)?r:i}function Xe(e,t){return Jo(e,Object.assign({format:ds},t))}const us=/^>|^->|<!--|-->|--!>|<!-$/g,cs=[">"],hs=["<",">"];function fs(e,t,n,i){return i.settings.bogusComments?"<?"+Xe(e.value,Object.assign({},i.settings.characterReferences,{subset:cs}))+">":"<!--"+e.value.replace(us,r)+"-->";function r(o){return Xe(o,Object.assign({},i.settings.characterReferences,{subset:hs}))}}function gs(e,t,n,i){return"<!"+(i.settings.upperDoctype?"DOCTYPE":"doctype")+(i.settings.tightDoctype?"":" ")+"html>"}function Zn(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,r=n.indexOf(t);for(;r!==-1;)i++,r=n.indexOf(t,r+t.length);return i}function ps(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function ms(e){return e.join(" ").trim()}const vs=/[ \t\n\f\r]/g;function Fn(e){return typeof e=="object"?e.type==="text"?Jn(e.value):!1:Jn(e)}function Jn(e){return e.replace(vs,"")===""}const Y=gr(1),fr=gr(-1),bs=[];function gr(e){return t;function t(n,i,r){const o=n?n.children:bs;let s=(i||0)+e,l=o[s];if(!r)for(;l&&Fn(l);)s+=e,l=o[s];return l}}const ys={}.hasOwnProperty;function pr(e){return t;function t(n,i,r){return ys.call(e,n.tagName)&&e[n.tagName](n,i,r)}}const On=pr({body:Cs,caption:Wt,colgroup:Wt,dd:Ls,dt:ws,head:Wt,html:Ss,li:ks,optgroup:Es,option:Rs,p:xs,rp:Qn,rt:Qn,tbody:Ds,td:ei,tfoot:Ts,th:ei,thead:As,tr:Hs});function Wt(e,t,n){const i=Y(n,t,!0);return!i||i.type!=="comment"&&!(i.type==="text"&&Fn(i.value.charAt(0)))}function Ss(e,t,n){const i=Y(n,t);return!i||i.type!=="comment"}function Cs(e,t,n){const i=Y(n,t);return!i||i.type!=="comment"}function xs(e,t,n){const i=Y(n,t);return i?i.type==="element"&&(i.tagName==="address"||i.tagName==="article"||i.tagName==="aside"||i.tagName==="blockquote"||i.tagName==="details"||i.tagName==="div"||i.tagName==="dl"||i.tagName==="fieldset"||i.tagName==="figcaption"||i.tagName==="figure"||i.tagName==="footer"||i.tagName==="form"||i.tagName==="h1"||i.tagName==="h2"||i.tagName==="h3"||i.tagName==="h4"||i.tagName==="h5"||i.tagName==="h6"||i.tagName==="header"||i.tagName==="hgroup"||i.tagName==="hr"||i.tagName==="main"||i.tagName==="menu"||i.tagName==="nav"||i.tagName==="ol"||i.tagName==="p"||i.tagName==="pre"||i.tagName==="section"||i.tagName==="table"||i.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function ks(e,t,n){const i=Y(n,t);return!i||i.type==="element"&&i.tagName==="li"}function ws(e,t,n){const i=Y(n,t);return!!(i&&i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd"))}function Ls(e,t,n){const i=Y(n,t);return!i||i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd")}function Qn(e,t,n){const i=Y(n,t);return!i||i.type==="element"&&(i.tagName==="rp"||i.tagName==="rt")}function Es(e,t,n){const i=Y(n,t);return!i||i.type==="element"&&i.tagName==="optgroup"}function Rs(e,t,n){const i=Y(n,t);return!i||i.type==="element"&&(i.tagName==="option"||i.tagName==="optgroup")}function As(e,t,n){const i=Y(n,t);return!!(i&&i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot"))}function Ds(e,t,n){const i=Y(n,t);return!i||i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot")}function Ts(e,t,n){return!Y(n,t)}function Hs(e,t,n){const i=Y(n,t);return!i||i.type==="element"&&i.tagName==="tr"}function ei(e,t,n){const i=Y(n,t);return!i||i.type==="element"&&(i.tagName==="td"||i.tagName==="th")}const Ms=pr({body:Ns,colgroup:Fs,head:Ps,html:Is,tbody:Os});function Is(e){const t=Y(e,-1);return!t||t.type!=="comment"}function Ps(e){const t=new Set;for(const i of e.children)if(i.type==="element"&&(i.tagName==="base"||i.tagName==="title")){if(t.has(i.tagName))return!1;t.add(i.tagName)}const n=e.children[0];return!n||n.type==="element"}function Ns(e){const t=Y(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Fn(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function Fs(e,t,n){const i=fr(n,t),r=Y(e,-1,!0);return n&&i&&i.type==="element"&&i.tagName==="colgroup"&&On(i,n.children.indexOf(i),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function Os(e,t,n){const i=fr(n,t),r=Y(e,-1);return n&&i&&i.type==="element"&&(i.tagName==="thead"||i.tagName==="tbody")&&On(i,n.children.indexOf(i),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const gt={name:[[`
|
|
3
|
+
\f\r &/=>`.split(""),`
|
|
4
|
+
\f\r "&'/=>\``.split("")],[`\0
|
|
5
|
+
\f\r "&'/<=>`.split(""),`\0
|
|
6
|
+
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
7
|
+
\f\r &>`.split(""),`\0
|
|
8
|
+
\f\r "&'<=>\``.split("")],[`\0
|
|
9
|
+
\f\r "&'<=>\``.split(""),`\0
|
|
10
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function zs(e,t,n,i){const r=i.schema,o=r.space==="svg"?!1:i.settings.omitOptionalTags;let s=r.space==="svg"?i.settings.closeEmptyElements:i.settings.voids.includes(e.tagName.toLowerCase());const l=[];let a;r.space==="html"&&e.tagName==="svg"&&(i.schema=cr);const u=Us(i,e.properties),d=i.all(r.space==="html"&&e.tagName==="template"?e.content:e);return i.schema=r,d&&(s=!1),(u||!o||!Ms(e,t,n))&&(l.push("<",e.tagName,u?" "+u:""),s&&(r.space==="svg"||i.settings.closeSelfClosing)&&(a=u.charAt(u.length-1),(!i.settings.tightSelfClosing||a==="/"||a&&a!=='"'&&a!=="'")&&l.push(" "),l.push("/")),l.push(">")),l.push(d),!s&&(!o||!On(e,t,n))&&l.push("</"+e.tagName+">"),l.join("")}function Us(e,t){const n=[];let i=-1,r;if(t){for(r in t)if(t[r]!==null&&t[r]!==void 0){const o=_s(e,r,t[r]);o&&n.push(o)}}for(;++i<n.length;){const o=e.settings.tightAttributes?n[i].charAt(n[i].length-1):void 0;i!==n.length-1&&o!=='"'&&o!=="'"&&(n[i]+=" ")}return n.join("")}function _s(e,t,n){const i=Bo(e.schema,t),r=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,o=e.settings.allowDangerousCharacters?0:1;let s=e.quote,l;if(i.overloadedBoolean&&(n===i.attribute||n==="")?n=!0:(i.boolean||i.overloadedBoolean)&&(typeof n!="string"||n===i.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const a=Xe(i.attribute,Object.assign({},e.settings.characterReferences,{subset:gt.name[r][o]}));return n===!0||(n=Array.isArray(n)?(i.commaSeparated?ps:ms)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?a:(e.settings.preferUnquoted&&(l=Xe(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:gt.unquoted[r][o]}))),l!==n&&(e.settings.quoteSmart&&Zn(n,s)>Zn(n,e.alternative)&&(s=e.alternative),l=s+Xe(n,Object.assign({},e.settings.characterReferences,{subset:(s==="'"?gt.single:gt.double)[r][o],attribute:!0}))+s),a+(l&&"="+l))}const $s=["<","&"];function mr(e,t,n,i){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Xe(e.value,Object.assign({},i.settings.characterReferences,{subset:$s}))}function Ws(e,t,n,i){return i.settings.allowDangerousHtml?e.value:mr(e,t,n,i)}function Bs(e,t,n,i){return i.all(e)}const Vs=qo("type",{invalid:js,unknown:Gs,handlers:{comment:fs,doctype:gs,element:zs,raw:Ws,root:Bs,text:mr}});function js(e){throw new Error("Expected node, not `"+e+"`")}function Gs(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const qs={},Ks={},Ys=[];function mn(e,t){const n=t||qs,i=n.quote||'"',r=i==='"'?"'":'"';if(i!=='"'&&i!=="'")throw new Error("Invalid quote `"+i+"`, expected `'` or `\"`");return{one:Xs,all:Zs,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Oo,characterReferences:n.characterReferences||Ks,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?cr:Go,quote:i,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Xs(e,t,n){return Vs(e,t,n,this)}function Zs(e){const t=[],n=e&&e.children||Ys;let i=-1;for(;++i<n.length;)t[i]=this.one(n[i],i,e);return t.join("")}const Js=new Set(["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"]),Qs=new Set(["svg","template","script","style"]),ea={class:"class",className:"class",id:"id",role:"role",style:"style",tabIndex:"tabindex",tabindex:"tabindex",title:"title"},ta=/^data-[\w.:-]+$/,na=/[<&]/g,ia=/[\0"&'`]/g,ra={"<":"<","&":"&",'"':""","'":"'","`":"`","\0":"�"},oa=256;function Pe(e){const t=new Map;return Array.isArray(e)?zn(e,t):vr(e,t)}function zn(e,t){let n="";for(const i of e)n+=vr(i,t);return n}function vr(e,t){switch(e.type){case"text":return yr(e.value);case"element":return sa(e,t);case"root":return zn(e.children,t);default:return mn(e)}}function sa(e,t){var s;const{tagName:n}=e;if(n==="span"&&e.children.length===1&&e.children[0].type==="text"&&typeof((s=e.properties)==null?void 0:s.style)=="string"){let l=!0;for(const a in e.properties)if(a!=="style"&&e.properties[a]!=null){l=!1;break}if(l)return`<span ${br(e.properties.style,t)}>${yr(e.children[0].value)}</span>`}if(Qs.has(n))return mn(e);const i=aa(e.properties,t);if(i==null)return mn(e);const r=i===""?`<${n}>`:`<${n} ${i}>`,o=zn(e.children,t);return o===""&&Js.has(n.toLowerCase())?r:`${r}${o}</${n}>`}function br(e,t){let n=t.get(e);return n==null&&(n=`style="${Sr(e)}"`,t.size<oa&&t.set(e,n)),n}function aa(e,t){let n="";for(const i in e){const r=e[i];if(r==null)continue;const o=ea[i]??(ta.test(i)?i:void 0);if(o==null)return;if(r===!1||typeof r=="number"&&Number.isNaN(r))continue;const s=i==="style"&&typeof r=="string"?br(r,t):r===!0?o:`${o}="${Sr(Array.isArray(r)?r.join(" ").trim():String(r))}"`;n+=n===""?s:` ${s}`}return n}function yr(e){return e.indexOf("<")<0&&e.indexOf("&")<0?e:e.replace(na,Cr)}function Sr(e){return e.replace(ia,Cr)}function Cr(e){return ra[e]}function la(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function pt(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}var da=class{constructor(e,t){w(this,"mode");w(this,"options");w(this,"hoveredLine");w(this,"hoveredToken");w(this,"pre");w(this,"gutterUtilityLine");w(this,"gutterUtilityContainer");w(this,"gutterUtilityButton");w(this,"gutterUtilitySlot");w(this,"interactiveLinesAttr",!1);w(this,"interactiveLineNumbersAttr",!1);w(this,"hasPointerListeners",!1);w(this,"hasDocumentPointerListeners",!1);w(this,"selectedRange",null);w(this,"selectedRangeHighlightSide");w(this,"selectedRangeLineNumberOnly",!1);w(this,"editorActiveLine",null);w(this,"editorActiveLineSide");w(this,"editorLineNumberOnly",!1);w(this,"proposedSelectedRange");w(this,"renderedSelectedLinesState");w(this,"renderedEditorActiveLineState");w(this,"selectionAnchor");w(this,"pointerSession",{mode:"idle"});w(this,"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}}});w(this,"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&&pt(e.composedPath())||(Ce(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))});w(this,"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||(Ce(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))});w(this,"handlePointerLeave",e=>{var n,i,r,o;const{__debugPointerEvents:t}=this.options;if(Ce(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){Ce(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&((i=(n=this.options).onTokenLeave)==null||i.call(n,this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&((o=(r=this.options).onLineLeave)==null||o.call(r,{...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()});w(this,"handlePointerDown",e=>{if(e.pointerType==="mouse"&&e.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;const t=e.composedPath();pt(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))});w(this,"handleDocumentPointerMove",e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;const n={lineNumber:t.lineNumber,side:t.eventSide};if(la(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}});w(this,"handleDocumentPointerUp",e=>{const{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{const{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(n.current=i,this.updateSelection(i.lineNumber,i.side));const r=this.buildSelectedLineRange(n.anchor,n.current);t==null||t({...r}),this.selectionAnchor=void 0,this.notifySelectionEnd(r),this.notifySelectionCommitted(r),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}});w(this,"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()}});w(this,"renderSelection",()=>{dn(this.renderSelection);const e=this.getSelectionRenderState();if(this.pre==null)return;const{editorActiveLine:t,selectedLines:n}=e,i=!ri(this.renderedSelectedLinesState,n),r=!ri(this.renderedEditorActiveLineState,t);if(!i&&!r)return;i&&(this.renderedSelectedLinesState=void 0),r&&(this.renderedEditorActiveLineState=void 0);const o=this.pre.getAttribute("data-diff-type")==="split",s=i?this.resolveLineRenderRange(n,o,"selected-lines"):void 0,l=r?this.resolveLineRenderRange(t,o,"editor-active-line"):void 0,a=this.getLineRenderColumns(i?n:void 0,s,r?t:void 0,l),u=n.range==null||a.some(p=>p.renderSelectedLines),d=t.range==null||a.some(p=>p.renderEditorActiveLine);if(i)for(const p of this.pre.querySelectorAll("[data-selected-line]"))p.removeAttribute("data-selected-line");if(r)for(const p of this.pre.querySelectorAll("[data-editor-active-line]"))p.removeAttribute("data-editor-active-line");const c=s==null?void 0:Math.min(s.start,s.end),f=s==null?void 0:Math.max(s.start,s.end),h=c===f,g=l==null?void 0:l.start;for(const p of a){const{content:b,gutter:S,renderEditorActiveLine:m,renderSelectedLines:v}=p,C=Math.max(v?f??-1/0:-1/0,m?g??-1/0:-1/0),y=b.children.length;for(let x=0;x<y;x++){const L=b.children[x],k=S.children[x];if(!(L instanceof HTMLElement)||!(k instanceof HTMLElement))continue;const R=this.parseLineIndex(L,o);if((R??0)>C)break;if(R!=null){if(v&&c!=null&&f!=null&&R>=c&&R<=f){let H=h?"single":R===c?"first":R===f?"last":"";k.setAttribute("data-selected-line",H),n.lineNumberOnly||(L.setAttribute("data-selected-line",H),k.nextSibling instanceof HTMLElement&&L.nextSibling instanceof HTMLElement&&(L.nextSibling.hasAttribute("data-line-annotation")||L.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(h?(H="last",L.setAttribute("data-selected-line","first")):R===c?H="":R===f&&L.setAttribute("data-selected-line",""),L.nextSibling.setAttribute("data-selected-line",H),k.nextSibling.setAttribute("data-selected-line",H)))}m&&R===g&&(k.setAttribute("data-editor-active-line",""),t.lineNumberOnly||L.setAttribute("data-editor-active-line",""))}}}i&&u&&(this.renderedSelectedLinesState=n),r&&d&&(this.renderedEditorActiveLineState=t)});this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){var e,t,n,i,r,o,s;(e=this.pre)==null||e.removeEventListener("click",this.handlePointerClick),(t=this.pre)==null||t.removeEventListener("pointerdown",this.handlePointerDown),(n=this.pre)==null||n.removeEventListener("pointermove",this.handlePointerMove),(i=this.pre)==null||i.removeEventListener("pointerleave",this.handlePointerLeave),(r=this.pre)==null||r.removeAttribute("data-interactive-lines"),(o=this.pre)==null||o.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,(s=this.gutterUtilityContainer)==null||s.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(),dn(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}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.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){const n=!(e===this.selectedRange||cn(e??void 0,this.selectedRange??void 0)),i=(t==null?void 0:t.lineNumberOnly)??!1,r=(t==null?void 0:t.activeLineSide)!==this.selectedRangeHighlightSide||i!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!r||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t==null?void 0:t.activeLineSide,this.selectedRangeLineNumberOnly=i,this.renderSelection(),this.placeUtility(),n&&(t==null?void 0:t.notify)!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){const i=e!==this.editorActiveLine,r=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!i&&!r||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}handlePointerEvent({eventType:e,event:t}){var g,p;const{__debugPointerEvents:n}=this.options,i=t.composedPath();Ce(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);Ce(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:u,onTokenEnter:d,onTokenLeave:c,onHunkExpand:f,onMergeConflictActionClick:h}=this.options;switch(e){case"move":{const b=Bt(r)&&((g=this.hoveredLine)==null?void 0:g.lineElement)===r.lineElement;At(r)&&((p=this.hoveredToken)==null?void 0:p.tokenElement)===r.tokenElement||(this.hoveredToken!=null&&(c==null||c(this.hoveredToken,t),this.clearHoveredToken()),At(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),d==null||d(this.hoveredToken,t))),b||(this.hoveredLine!=null&&(a==null||a({...this.hoveredLine,event:t}),this.clearHoveredLine()),Bt(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l==null||l({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(ha(r)&&h!=null){h(r);break}if(ca(r)&&f!=null){f(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!Bt(r))break;At(r)&&u!=null&&u(this.toTokenEventBaseProps(r),t);const b=this.toEventBaseProps(r);s!=null&&r.numberColumn?s({...b,event:t}):o!=null&&o({...b,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:u,onHunkExpand:d,onMergeConflictActionClick:c,enableGutterUtility:f=!1,enableLineSelection:h=!1,onGutterUtilityClick:g}=this.options,p=g!=null,b=n!=="disabled"||i!=null||r!=null||o!=null||s!=null||l!=null||a!=null||u!=null||d!=null||c!=null||f||h||p;b&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,Ce(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const v=[];return(t==="both"||t==="click")&&(i!=null&&v.push("onLineClick"),r!=null&&v.push("onLineNumberClick"),d!=null&&v.push("expandable hunk separators"),c!=null&&v.push("merge conflict actions")),v})()),Ce(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),Ce(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!b&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const S=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",m=this.pointerSession.mode==="gutterSelecting";(!h&&S||!p&&m)&&(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)}startLineSelectionFromPointerDown(e){var l,a;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 u=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(u==null)return;const d=u.start<=u.end?s>=u.start:s<=u.end;this.selectionAnchor={lineNumber:d?this.selectedRange.start:this.selectedRange.end,side:d?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(((l=this.selectedRange)==null?void 0:l.start)===r&&((a=this.selectedRange)==null?void 0:a.end)===r){const u={lineNumber:r,side:o};this.selectionAnchor=u,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:u,pending:u},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{onGutterUtilityClick:t}=this.options;if(t==null)return;const n=this.currentSelectionEnds(),i=(n==null?void 0:n.bottom)??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),r=(n==null?void 0:n.top)??i;i==null||r==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:r,current:i},this.selectionAnchor={lineNumber:r.lineNumber,side:r.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}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){var t;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((t=this.gutterUtilitySlot)==null||t.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){const n=document.createElement("div");n.innerHTML=Pe(Fo());const i=n.firstElementChild;if(!(i instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");i.remove(),this.gutterUtilityButton=i}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);ot(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(){var e;(e=this.gutterUtilityContainer)==null||e.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(tt(r));if(ot(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(ot(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(ot(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&&pt(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=tt(e);if(t&&pt(n))return;const i=ga(e);return i!=null?tt(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){var r;const t=(r=pa(e))==null?void 0:r.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute("data-line")||t.hasAttribute("data-column-number")))return tt(t);const n=va(ma(e));if(n==null)return;const i=this.targetForSelectionPoint(n);return i!=null?tt(i.lineElement):void 0}hitTest(e){var i;if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=(i=this.pre)==null?void 0:i.getRootNode(),n=ii(t)?t:ii(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){var o,s;const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const l=((o=this.selectionAnchor)==null?void 0:o.side)??t,a=((s=this.selectionAnchor)==null?void 0:s.lineNumber)??e;r=this.buildSelectionRange(a,e,l,t)}cn(i??void 0,r??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,tr(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}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;const i=this.getIndexesFromSelection(e.range,t);if(i==null)throw console.error({rowRange:i,range:e.range}),new Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return i}getLineRenderColumns(e,t,n,i){if(this.pre==null||t==null&&i==null)return[];const{children:r}=this.pre;if(r.length>2)throw console.error(r),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const o=[];for(const s of r){const l=s.hasAttribute("data-deletions")?"deletions":s.hasAttribute("data-additions")?"additions":void 0,a=e!=null&&t!=null&&(e.highlightSide==null||l==null||e.highlightSide===l),u=n!=null&&i!=null&&(n.highlightSide==null||l==null||n.highlightSide===l);if(!a&&!u)continue;const[d,c]=s.children;if(!(d instanceof HTMLElement)||!(c instanceof HTMLElement))throw new Error("InteractionManager.renderSelection: missing gutter or content element");if(c.children.length!==d.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");o.push({content:c,gutter:d,renderEditorActiveLine:u,renderSelectedLines:a})}return o}notifySelectionCommitted(e){var t,n;(n=(t=this.options).onLineSelected)==null||n.call(t,e)}notifySelectionChangeDelta(){var e,t;(t=(e=this.options).onLineSelectionChange)==null||t.call(e,this.getCurrentSelectionRange()??null)}notifySelectionStart(e){var t,n;(n=(t=this.options).onLineSelectionStart)==null||n.call(t,e)}notifySelectionEnd(e){var t,n;(n=(t=this.options).onLineSelectionEnd)==null||n.call(t,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,u,d,c;for(const h of e){if(!(h instanceof HTMLElement))continue;if(c==null&&h.hasAttribute("data-merge-conflict-action")){const S=h.getAttribute("data-merge-conflict-action")??void 0,m=h.getAttribute("data-merge-conflict-conflict-index")??void 0,v=m!=null?Number.parseInt(m,10):NaN;fa(S)&&Number.isFinite(v)&&(c={kind:"merge-conflict-action",resolution:S,conflictIndex:v})}if(l==null&&h.hasAttribute("data-char")){l=h;const S=h.getAttribute("data-char");if(S!=null){const m=Number.parseInt(S,10);if(!Number.isNaN(m)){const v=h.textContent??"",C=m+v.length;(v.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(a={tokenElement:l,lineCharStart:m,lineCharEnd:C,tokenText:v});continue}}}const g=s==null?h.getAttribute("data-column-number")??void 0:void 0;if(g!=null){s=h,d=Number.parseInt(g,10),t=!0,n=si(h),o=h.getAttribute("data-line-index")??void 0;continue}const p=r==null?h.getAttribute("data-line")??void 0:void 0;if(p!=null){r=h,d=Number.parseInt(p,10),n=si(h),o=h.getAttribute("data-line-index")??void 0;continue}if(u==null&&(h.hasAttribute("data-expand-button")||h.hasAttribute("data-unmodified-lines"))){u={hunkIndex:void 0,direction:h.hasAttribute("data-expand-up")?"up":h.hasAttribute("data-expand-down")?"down":"both",all:h.hasAttribute("data-expand-all-button")};continue}const b=u!=null?h.getAttribute("data-expand-index")??void 0:void 0;if(u!=null&&b!=null){const S=Number.parseInt(b,10);Number.isNaN(S)||(u.hunkIndex=S);continue}if(i==null&&h.hasAttribute("data-code")){i=h;break}}if(c!=null)return c;if((u==null?void 0:u.hunkIndex)!=null)return{type:"line-info",hunkIndex:u.hunkIndex,direction:u.direction,all:u.all};if(r??(r=o!=null?ni(i,`[data-line][data-line-index="${o}"]`):void 0),s??(s=o!=null?ni(i,`[data-column-number][data-line-index="${o}"]`):void 0),i==null||r==null||s==null||n==null||d==null||Number.isNaN(d))return;const f=this.parseLineIndex(r,this.isSplitDiff());return a!=null?this.mode==="file"?{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:f,...a}:{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:oi(n,i),splitLineIndex:f,...a}:this.mode==="file"?{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:f}:{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:oi(n,i),splitLineIndex:f}}isSplitDiff(){var e;return((e=this.pre)==null?void 0:e.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 ti({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:u,onTokenLeave:d,renderGutterUtility:c,__debugPointerEvents:f,enableLineSelection:h,controlledSelection:g,onLineSelected:p,onLineSelectionStart:b,onLineSelectionChange:S,onLineSelectionEnd:m},v,C,y){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:ua({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:v,onMergeConflictActionClick:y,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:u,onTokenLeave:d,__debugPointerEvents:f,enableLineSelection:h,controlledSelection:g,onLineSelected:p,onLineSelectionStart:b,onLineSelectionChange:S,onLineSelectionEnd:m,getLineIndex:C}}function ua({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 ot(e){return e!=null&&"kind"in e&&e.kind==="line"}function At(e){return e!=null&&"kind"in e&&e.kind==="token"}function Bt(e){return ot(e)||At(e)}function ca(e){return"type"in e&&e.type==="line-info"}function ha(e){return"kind"in e&&e.kind==="merge-conflict-action"}function fa(e){return e==="current"||e==="incoming"||e==="both"}function ni(e,t){const n=e==null?void 0:e.querySelector(t);return n instanceof HTMLElement?n:void 0}function tt(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function ga(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 pa(e){var i;const t=e.closest('[slot^="annotation-"]'),n=(i=t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName==="SLOT"?e:void 0)==null?void 0:i.closest("[data-line-annotation]");return n instanceof HTMLElement?n:void 0}function ma(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 va(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 ii(e){return e!=null&&typeof e.elementFromPoint=="function"}function ba(e,t){return e===t||cn(e??void 0,t??void 0)}function ri(e,t){return(e==null?void 0:e.highlightSide)===t.highlightSide&&(e==null?void 0:e.lineNumberOnly)===t.lineNumberOnly&&ba((e==null?void 0:e.range)??null,t.range)}function oi(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function si(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 Ce(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}console.log(...n)}var ee,ya=(ee=class{constructor(){w(this,"observedNodes",new Map);w(this,"applyColumnUpdates",t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?Sa(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?Ca(i.numberInlineSize):n.numberWidth,s=r!==n.codeWidth,l=o!==n.numberWidth;!s&&!l||(n.codeWidth=r,n.numberWidth=o,n.applyColumnVariables&&xr(n,{codeWidthChanged:s,numberWidthChanged:l}))}})}static getResizeObserver(){const t=ee.resizeObserver??new ResizeObserver(ee.handleSharedResizeEntries);return ee.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=ee.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)}setup(t,{disableAnnotations:n,columnVariables:i="apply"}){const r=new Set,o=i==="apply";let s=0;const l=new Map(this.observedNodes);this.observedNodes.clear();for(const a of t.children){if(s===2)break;const u=(()=>{if(a instanceof HTMLElement&&a.tagName==="CODE")return a})();if(u==null)continue;s++;let d=l.get(u);if(d!=null&&d.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let c=u.firstElementChild;c instanceof HTMLElement||(c=null),d!=null?(this.observedNodes.set(u,d),l.delete(u),d.numberElement!==c?(d.numberElement!=null&&(this.unobserve(d.numberElement),l.delete(d.numberElement)),c!=null&&(this.observe(c),l.delete(c),this.observedNodes.set(c,d)),d.numberElement=c,d.numberWidth=0):d.numberElement!=null?(l.delete(d.numberElement),this.observedNodes.set(d.numberElement,d)):d.numberWidth=0,xa(d,o)):(d={type:"code",codeElement:u,numberElement:c,codeWidth:"auto",numberWidth:0,applyColumnVariables:o},this.observedNodes.set(u,d),this.observe(u),c!=null&&(this.observedNodes.set(c,d),this.observe(c)))}if(s>1&&!n){const a=t.querySelectorAll('[data-line-annotation*=","]'),u=new Map;for(const d of a){if(!(d instanceof HTMLElement))continue;const c=d.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(c)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:c,element:d});continue}let f=u.get(c);f==null&&(f=[],u.set(c,f)),f.push(d)}for(const[d,c]of u){if(c.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",d,c);continue}const[f,h]=c,g=f.firstElementChild,p=h.firstElementChild;if(!(f instanceof HTMLElement)||!(h instanceof HTMLElement)||!(g instanceof HTMLElement)||!(p instanceof HTMLElement))continue;let b=l.get(g);if(b!=null){this.observedNodes.set(g,b),this.observedNodes.set(p,b),l.delete(g),l.delete(p);continue}const S=g.getBoundingClientRect().height,m=p.getBoundingClientRect().height;b={type:"annotations",column1:{container:f,child:g,childHeight:S},column2:{container:h,child:p,childHeight:m},currentHeight:"auto"},r.add({child1:g,child2:p,item:b,newHeight:Math.max(S,m)})}for(const d of r)this.applyNewHeight(d.item,d.newHeight),this.observedNodes.set(d.child1,d.item),this.observedNodes.set(d.child2,d.item),this.observe(d.child1),this.observe(d.child2);r.clear()}for(const[a,u]of l)this.unobserve(a),u.type==="code"?ka(u):wa(u);l.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=ee,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),ee.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=ee,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==null||i.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),ee.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 u=(()=>{if(o===a.column1.child)return a.column1;if(o===a.column2.child)return a.column2})();if(u==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:o});continue}u.childHeight=s[0].blockSize,i.add(a)}else if(a.type==="code"){const u=n.get(a)??{},d=l[0].inlineSize;o===a.codeElement?u.codeInlineSize=d:o===a.numberElement&&(u.numberInlineSize=d),n.set(a,u)}}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))}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`))}},w(ee,"resizeObserver"),w(ee,"managersByElement",new Map),ee);function Sa(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function Ca(e){return Math.max(Math.ceil(e),0)}function xa(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?xr(e,{codeWidthChanged:!0,numberWidthChanged:!0}):kr(e))}function xr(e,{codeWidthChanged:t,numberWidthChanged:n}){const{codeElement:i,codeWidth:r,numberWidth:o}=e;if(t&&i.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),n&&i.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),t||n&&r!=="auto"){const s=typeof r=="number"?Math.max(r-o,0):0;i.style.setProperty("--diffs-column-content-width",`${s>0?`${s}px`:"auto"}`)}}function kr(e){e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width")}function ka(e){e.codeElement.isConnected&&kr(e)}function wa(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}function ai(e,t){const n=Array.isArray(e)?e:[e];return t!=null?t.hasLoadedLanguages(n):n.every(i=>i==="text"||i==="ansi"||Co.has(i))}function wr(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 La(e){var t;return z({tagName:"div",children:[z({tagName:"div",children:(t=e.annotations)==null?void 0:t.map(n=>z({tagName:"slot",properties:{name:n}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Ea(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 Ra({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i==null?void 0:i.type,"data-sticky":n?"":void 0};return z({tagName:"div",children:[t==="custom"?z({tagName:"slot",properties:{name:Dn}}):Aa({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:(i==null?void 0:i.type)??"file"}),...t==="custom"?[]:[Da(i)]],properties:r})}function Aa({name:e,prevName:t,iconType:n}){const i=[z({tagName:"slot",properties:{name:Yi}}),It({name:Ea(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(z({tagName:"div",children:[z({tagName:"bdi",children:[ve(t)]})],properties:{"data-prev-name":""}})),i.push(It({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(z({tagName:"div",children:[z({tagName:"bdi",children:[ve(e)]})],properties:{"data-title":""}})),i.push(z({tagName:"slot",properties:{name:Xi}})),z({tagName:"div",children:i,properties:{"data-header-content":""}})}function Da(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(z({tagName:"span",children:[ve(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(z({tagName:"span",children:[ve(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(z({tagName:"slot",properties:{name:Zi}})),z({tagName:"div",children:t,properties:{"data-metadata":""}})}function Ta(e){return z({tagName:"pre",properties:Ha(e)})}function Ha({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 Be=new Map,Ve={"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",odin:"odin",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",BUCK:"python",BUILD:"python",PACKAGE:"python",WORKSPACE:"python",Tiltfile:"python",bazel:"python",bxl:"python",bzl:"python",bzlmod:"python",star:"python",sky:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",mts:"typescript",cts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",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 Ee(e){const t=li(e);if(t!=null)return t;const n=e.split(/[/\\]/).pop()??e;return n===e?"text":li(n)??"text"}function li(e){var i;if(Be.has(e))return Be.get(e)??"text";if(Object.hasOwn(Ve,e))return Ve[e]??null;const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Be.has(t[1]))return Be.get(t[1])??"text";if(Object.hasOwn(Ve,t[1]))return Ve[t[1]]??"text"}const n=((i=e.match(/\.([^.]+)$/))==null?void 0:i[1])??"";return Be.has(n)?Be.get(n)??"text":Object.hasOwn(Ve,n)?Ve[n]??"text":null}function Ma(e,{theme:t,preferredHighlighter:n}){return{langs:Array.isArray(e)?e:[e??"text"],themes:Hn(t),preferredHighlighter:Tn(n)}}function ze(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function vn(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function fe(e){return`--${e==="token"?"diffs-token":"diffs"}-`}const Ia=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Pa=/^0(?:\.0+)?%?$/;function Na(e){var o;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 s=i.split(",");if(s.length===4)return(o=s[3])==null?void 0:o.trim()}}function Fa(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 Vt(e){if(e==null)return null;const t=Fa(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 di(e){if(e==null)return!1;const t=e.trim().toLowerCase();if(t==="transparent"||Ia.test(t))return!0;const n=Na(t);return n!=null&&Pa.test(n)}function Oa(e,t,n){if(t==null||n==null)return!1;const i=Vt(e),r=Vt(t),o=Vt(n);return i==null||r==null||o==null?!1:Math.abs(i-o)<Math.abs(i-r)}const ui=new WeakMap;function za(e){const t=ui.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;pe(i,"editor.background",r),pe(i,"editor.foreground",o),pe(i,"sideBar.background",s),pe(i,"sideBar.foreground",l),pe(i,"input.background",n["input.background"]??s),pe(i,"sideBarSectionHeader.foreground",n["sideBarSectionHeader.foreground"]??l),pe(i,"list.activeSelectionForeground",n["list.activeSelectionForeground"]??l),pe(i,"gitDecoration.addedResourceForeground",jt(n["gitDecoration.addedResourceForeground"],n["terminal.ansiGreen"],n["editorGutter.addedBackground"])),pe(i,"gitDecoration.modifiedResourceForeground",jt(n["gitDecoration.modifiedResourceForeground"],n["terminal.ansiBlue"],n["editorGutter.modifiedBackground"])),pe(i,"gitDecoration.deletedResourceForeground",jt(n["gitDecoration.deletedResourceForeground"],n["terminal.ansiRed"],n["editorGutter.deletedBackground"]));const a=(di(n["list.focusOutline"])?void 0:n["list.focusOutline"])??(di(n.focusBorder)?void 0:n.focusBorder);a!=null?i["list.focusOutline"]=a:delete i["list.focusOutline"];const u=n["list.hoverBackground"];u!=null&&(Ua(u,s)||Oa(u,s,l))&&delete i["list.hoverBackground"];const d=Object.freeze({...e,colors:Object.freeze(i)});return ui.set(e,d),d}function pe(e,t,n){n!=null&&n!==""&&(e[t]=n)}function jt(...e){for(const t of e)if(t!=null&&t!=="")return t}function Ua(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function _a({theme:e=Le,highlighter:t,prefix:n}){let i="";if(typeof e=="string"){const r=t.getTheme(e),o=Gt(r,t);i+=`color:${o.fg};`,i+=`background-color:${o.bg};`,i+=`${fe("global")}fg:${o.fg};`,i+=`${fe("global")}bg:${o.bg};`,i+=qt(r,n)}else{let r=t.getTheme(e.dark),o=Gt(r,t);i+=`${fe("global")}dark:${o.fg};`,i+=`${fe("global")}dark-bg:${o.bg};`,i+=qt(r,"dark"),r=t.getTheme(e.light),o=Gt(r,t),i+=`${fe("global")}light:${o.fg};`,i+=`${fe("global")}light-bg:${o.bg};`,i+=qt(r,"light")}return i}function Gt(e,t){var n;if(t.name==="highlights"&&((n=e.zed)==null?void 0:n.cssVariables)===!0){const i=fe("token");return{fg:`var(${i}foreground)`,bg:`var(${i}background)`}}return za(e)}function qt(e,t){var s,l,a,u,d,c;t=t!=null?`${t}-`:"";let n="";const i=((s=e.colors)==null?void 0:s["gitDecoration.addedResourceForeground"])??((l=e.colors)==null?void 0:l["terminal.ansiGreen"]);i!=null&&(n+=`${fe("global")}${t}addition-color:${i};`);const r=((a=e.colors)==null?void 0:a["gitDecoration.deletedResourceForeground"])??((u=e.colors)==null?void 0:u["terminal.ansiRed"]);r!=null&&(n+=`${fe("global")}${t}deletion-color:${r};`);const o=((d=e.colors)==null?void 0:d["gitDecoration.modifiedResourceForeground"])??((c=e.colors)==null?void 0:c["terminal.ansiBlue"]);return o!=null&&(n+=`${fe("global")}${t}modified-color:${o};`),n}function $a(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(ve(`
|
|
11
|
+
`)),e}const ci=new WeakMap;function Lr(e,t=!1){const{htmlStyle:n}=e;if(n!=null){let r=t?ci.get(n):void 0;if(r==null){r="";for(const o in n)r+=`${r===""?"":";"}${o}:${n[o]}`;t&&ci.set(n,r)}return r}let i=e.color!=null?`color:${e.color}`:"";if(e.bgColor!=null&&(i+=`;background-color:${e.bgColor}`),e.fontStyle!=null){e.fontStyle&1&&(i+=";font-style:italic"),e.fontStyle&2&&(i+=";font-weight:bold");const r=(e.fontStyle&4)!==0,o=(e.fontStyle&8)!==0;(r||o)&&(i+=`;text-decoration:${r?"underline":""}${r&&o?" ":""}${o?"line-through":""}`)}return i.replace(/^;/,"")}function Er(e,t,n){let i=!1,r;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){var o;return i||(r=n(),i=!0),((o=Object.getOwnPropertyDescriptor(e,t))==null?void 0:o.configurable)===!0&&Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r}),r},set(o){var s;if(((s=Object.getOwnPropertyDescriptor(e,t))==null?void 0:s.configurable)===!0)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:o});else{if(Object.isFrozen(e))throw new TypeError(`Cannot assign to read only array index '${t}'`);r=o,i=!0}}})}const mt=Symbol("no-token"),Kt=Symbol("multiple-tokens");function Rr(e){const t=Wa(e);if(t!=null)return t;let n=mt;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==null?void 0:a.type)==="element"){Ba(a,o);for(const u of a.children)Dt(u)}else Dt(a);i.push(a),r=[],o=void 0;return}for(const a of r)Dt(a);i.push(z({tagName:"span",properties:{"data-char":o},children:r})),r=[],o=void 0},l=a=>{if(a!==mt){if(a===Kt){n=Kt;return}if(n===mt){n=a;return}n!==a&&(n=Kt)}};for(const a of e.children){const u=a.type==="element"?Rr(a):mt;if(l(u),typeof u!="number"){s(),i.push(a);continue}o!=null&&o!==u&&s(),o??(o=u),r.push(a)}return s(),e.children=i,n}function Wa(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function Dt(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)Dt(t)}}function Ba(e,t){e.properties["data-char"]=t}function Va(e,{state:t,lazyLineAST:n=!1,cacheHtmlStyles:i=!1,useTokenTransformer:r=!1,mergeWhitespaces:o="always",decorations:s=[],lineOffsets:l=[]}){let a;for(const c of s){const f=a??(a=new Map),h={...c,start:hi(c.start,l),end:hi(c.end,l)},g=Math.min(h.end.line,e.length-1);for(let p=h.start.line;p<=g;p++){let b=f.get(p);b==null&&f.set(p,b=[]),b.push(h)}}const u=(c,f)=>{let h;if(r||o!=="never"){let S="",m=0;for(let v=0;v<c.length;v++){let C=c[v];if(r){const y=C.content.trim();if(y!==""&&y!==C.content){h??(h=c.slice(0,v));const x=C.content.indexOf(y);x>0&&h.push({content:C.content.slice(0,x),offset:C.offset}),h.push({...C,content:y,offset:C.offset+x});const L=x+y.length;L<C.content.length&&h.push({content:C.content.slice(L),offset:C.offset+L});continue}}else{const y=((C.fontStyle??0)&12)!==0;if(!y&&/^\s+$/.test(C.content)&&v<c.length-1){h??(h=c.slice(0,v)),S===""&&(m=C.offset),S+=C.content;continue}S!==""&&h!=null&&(y?h.push({content:S,offset:m}):C={...C,content:S+C.content,offset:m},S="")}h==null||h.push(C)}}h??(h=c);const g={type:"element",tagName:t==null?"span":"div",properties:t==null?{class:"line"}:{},children:[]},p=a==null?void 0:a.get(f),b=p==null?ja(g,h,r,i):Ga(g,h,p,f,r,i);return r&&b===0&&g.children.push({type:"element",tagName:"br",properties:{},children:[]}),r&&p!=null&&Rr(g),t==null?g:$a(g,f+1,t)};if(!n)return e.map(u);const d=new Array(e.length);for(let c=0;c<e.length;c++){const f=e[c];Er(d,c,()=>u(f,c))}return d}function ja(e,t,n,i){let r=0;for(const o of t)o.content!==""&&(e.children.push(Ar(o,Lr(o,i),o.content,r,n)),r+=o.content.length);return r}function Ga(e,t,n,i,r,o){var b,S,m;n.length>1&&n.sort((v,C)=>v.start.line!==C.start.line?v.start.line-C.start.line:v.start.character!==C.start.character?v.start.character-C.start.character:v.end.line!==C.end.line?C.end.line-v.end.line:C.end.character-v.end.character);const s=t.reduce((v,C)=>v+C.content.length,0),l=[];for(let v=0;v<n.length;v++){const C=n[v],y={decoration:C,order:v,from:C.start.line===i?C.start.character:0,to:C.end.line===i?C.end.character:s};l.push({position:Math.max(0,Math.min(y.from,s)),range:y,start:!0},{position:Math.max(0,Math.min(y.to,s)),range:y,start:!1})}l.sort((v,C)=>v.position-C.position);const a=[],u=[];let d=0;const c=(v,C)=>{let y=0,x=a.length;for(;y<x;){const L=y+x>>>1;a[L].order<v.order?y=L+1:x=L}C?a.splice(y,0,v):a[y]===v&&a.splice(y,1)},f=()=>{var y;let v=e,C=0;for(const x of a){if(((y=u[C])==null?void 0:y.range)!==x){u.length=C;const L={type:"element",tagName:"span",properties:{...x.decoration.properties},children:[]};v.children.push(L),u.push({range:x,node:L})}v=u[C++].node}return u.length=C,v};let h=e;const g=v=>{var x;const C=d;for(;((x=l[d])==null?void 0:x.position)===v;)d++;let y=!1;for(let L=C;L<d;L++){const{range:k,start:R}=l[L];!R&&k.from!==k.to&&v<s&&c(k,!1)}for(let L=C;L<d;L++){const{range:k,start:R}=l[L];R&&k.from<=v&&k.to>=v&&(k.to>v||k.from===v||v===s)&&(c(k,!0),k.from===k.to&&(y=!0))}if(y){f();for(let L=C;L<d;L++){const{range:k,start:R}=l[L];R&&k.from===k.to&&c(k,!1)}}v<s&&(h=f())};let p=0;for(const v of t){if(v.content==="")continue;const C=p,y=C+v.content.length,x=Lr(v,o);for(;p<y;){((b=l[d])==null?void 0:b.position)===p&&g(p);const L=Math.min(y,((S=l[d])==null?void 0:S.position)??y);h.children.push(Ar(v,x,p===C&&L===y?v.content:v.content.slice(p-C,L-C),C,r)),p=L}}return((m=l[d])==null?void 0:m.position)===p&&g(p),p}function Ar(e,t,n,i,r){const o=e.htmlAttrs!=null?{...e.htmlAttrs}:{};return t!==""&&(o.style=t),r&&(o["data-char"]=i),{type:"element",tagName:"span",properties:o,children:[{type:"text",value:n}]}}function hi(e,t){if(typeof e!="number")return e;let n=0,i=t.length;for(;n+1<i;){const r=n+i>>>1;t[r]<=e?n=r:i=r}return{line:n,character:e-(t[n]??0)}}function qa(e,t){for(const n of t)e.push(n)}function Ka(e,t,n){return{lang:e,...typeof t=="string"?{theme:t}:{themes:t},defaultColor:!1,cssVariablePrefix:fe("token"),tokenizeMaxLineLength:n,tokenizeTimeLimit:0}}function Dr(e,t){return(e==null?void 0:e.getPreferredHighlighter())??t.preferredHighlighter}function fi(e,t){return(e==null?void 0:e.cacheKey)!=null||(t==null?void 0:t.cacheKey)!=null?(e==null?void 0:e.cacheKey)===(t==null?void 0:t.cacheKey):(e==null?void 0:e.contents)===(t==null?void 0:t.contents)&&(e==null?void 0:e.name)===(t==null?void 0:t.name)&&(e==null?void 0:e.lang)===(t==null?void 0:t.lang)}const Ya="-1,-1";function Xa(e){return(e==null?void 0:e.some(t=>t.lineNumber===0))??!1}function gi(e){const t=e[0];return t!=null&&t.length>0?t:void 0}function Tr(e){return e.startingLine===0&&e.totalLines>0}function Za(e,t){return e.endsWith(`\r
|
|
12
|
+
`)?t+`\r
|
|
13
|
+
`:e.endsWith("\r")?t+"\r":e.endsWith(`
|
|
14
|
+
`)?t+`
|
|
15
|
+
`:t}function Ja(e,t){return z({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${t}`}})}const Qa=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
16
|
+
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
17
|
+
<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"/>
|
|
18
|
+
</symbol>
|
|
19
|
+
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
20
|
+
<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"/>
|
|
21
|
+
</symbol>
|
|
22
|
+
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
23
|
+
<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"/>
|
|
24
|
+
</symbol>
|
|
25
|
+
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
26
|
+
<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"/>
|
|
27
|
+
</symbol>
|
|
28
|
+
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
29
|
+
<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"/>
|
|
30
|
+
</symbol>
|
|
31
|
+
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
32
|
+
<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"/>
|
|
33
|
+
</symbol>
|
|
34
|
+
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
35
|
+
<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"/>
|
|
36
|
+
</symbol>
|
|
37
|
+
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
38
|
+
<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"/>
|
|
39
|
+
</symbol>
|
|
40
|
+
<symbol id="diffs-icon-eye-slash" viewBox="0 0 16 16">
|
|
41
|
+
<path d="m13.47 1.47-12 12 1.06 1.06 12-12zM8 14c-.92 0-1.802-.208-2.624-.547l1.173-1.174c.476.142.963.221 1.451.221 1.66 0 3.307-.949 4.626-2.196a10.4 10.4 0 0 0 1.494-1.751A5 5 0 0 0 14.443 8a5 5 0 0 0-.323-.553 10 10 0 0 0-1.238-1.5l1.061-1.062C15.222 6.173 16 7.511 16 8c0 1.05-3.582 6-8 6"/><path d="M8 11q-.084 0-.167-.005l3.162-3.162q.006.083.005.167a3 3 0 0 1-3 3M5.005 8.167l3.162-3.162a3 3 0 0 0-3.162 3.162"/><path d="M8 3.5c.485 0 .97.081 1.445.227l1.168-1.169C9.794 2.212 8.915 2 8 2 3.582 2 0 6.8 0 8c0 .555.766 1.88 2.027 3.144l1.06-1.06a9.5 9.5 0 0 1-1.203-1.461 4.3 4.3 0 0 1-.345-.617L1.536 8l.003-.006c.064-.149.176-.359.345-.617a9.8 9.8 0 0 1 1.482-1.73C4.675 4.427 6.326 3.5 8 3.5"/>
|
|
42
|
+
</symbol>
|
|
43
|
+
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
44
|
+
<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"/>
|
|
45
|
+
</symbol>
|
|
46
|
+
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
47
|
+
<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"/>
|
|
48
|
+
</symbol>
|
|
49
|
+
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
50
|
+
<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"/>
|
|
51
|
+
</symbol>
|
|
52
|
+
<symbol id="diffs-icon-symbol-added-duo" viewBox="0 0 16 16">
|
|
53
|
+
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/>
|
|
54
|
+
</symbol>
|
|
55
|
+
<symbol id="diffs-icon-symbol-added-fill" viewBox="0 0 16 16">
|
|
56
|
+
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 4a.75.75 0 0 0-.75.75v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5A.75.75 0 0 0 8 4" clip-rule="evenodd"/>
|
|
57
|
+
</symbol>
|
|
58
|
+
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
59
|
+
<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"/>
|
|
60
|
+
</symbol>
|
|
61
|
+
<symbol id="diffs-icon-symbol-deleted-duo" viewBox="0 0 16 16">
|
|
62
|
+
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/>
|
|
63
|
+
</symbol>
|
|
64
|
+
<symbol id="diffs-icon-symbol-deleted-fill" viewBox="0 0 16 16">
|
|
65
|
+
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M4.75 7.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5z" clip-rule="evenodd"/>
|
|
66
|
+
</symbol>
|
|
67
|
+
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
68
|
+
<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"/>
|
|
69
|
+
</symbol>
|
|
70
|
+
<symbol id="diffs-icon-symbol-diffstat-duo" viewBox="0 0 16 16">
|
|
71
|
+
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
|
|
72
|
+
</symbol>
|
|
73
|
+
<symbol id="diffs-icon-symbol-diffstat-fill" viewBox="0 0 16 16">
|
|
74
|
+
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5zM8 3.546a.75.75 0 0 0-.75.75V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2V4.296a.75.75 0 0 0-.75-.75" clip-rule="evenodd"/>
|
|
75
|
+
</symbol>
|
|
76
|
+
<symbol id="diffs-icon-symbol-extracted" viewBox="0 0 16 16">
|
|
77
|
+
<path d="M8.25 4.25a.75.75 0 0 1 0 1.5H6.81l3.302 3.302a1.5 1.5 0 1 1-1.06 1.06L5.75 6.811V8.25a.75.75 0 0 1-1.5 0V5A.75.75 0 0 1 5 4.25z"/><path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 1.5c-1.613 0-2.807.089-3.704.288-.88.196-1.382.477-1.706.802-.325.324-.606.826-.802 1.706C1.588 5.193 1.5 6.387 1.5 8s.089 2.807.288 3.704c.196.88.477 1.382.802 1.706.324.325.826.606 1.706.802.897.2 2.091.288 3.704.288s2.807-.089 3.704-.288c.88-.196 1.382-.477 1.706-.802.325-.324.606-.826.802-1.706.2-.897.288-2.091.288-3.704s-.089-2.807-.288-3.704c-.196-.88-.477-1.382-.802-1.706-.324-.325-.826-.606-1.706-.802C10.807 1.588 9.613 1.5 8 1.5" clip-rule="evenodd"/>
|
|
78
|
+
</symbol>
|
|
79
|
+
<symbol id="diffs-icon-symbol-extracted-duo" viewBox="0 0 16 16">
|
|
80
|
+
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8" clip-rule="evenodd" opacity=".2"/><path d="M8.25 4.25a.75.75 0 0 1 0 1.5H6.81l3.302 3.302a1.5 1.5 0 1 1-1.06 1.06L5.75 6.811V8.25a.75.75 0 0 1-1.5 0V5A.75.75 0 0 1 5 4.25z"/>
|
|
81
|
+
</symbol>
|
|
82
|
+
<symbol id="diffs-icon-symbol-extracted-fill" viewBox="0 0 16 16">
|
|
83
|
+
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5 4.25a.75.75 0 0 0-.75.75v3.25a.75.75 0 0 0 1.5 0V6.81l3.302 3.302a1.5 1.5 0 1 0 1.06-1.06L6.811 5.75H8.25a.75.75 0 0 0 0-1.5z" clip-rule="evenodd"/>
|
|
84
|
+
</symbol>
|
|
85
|
+
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
86
|
+
<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"/>
|
|
87
|
+
</symbol>
|
|
88
|
+
<symbol id="diffs-icon-symbol-ignored-duo" viewBox="0 0 16 16">
|
|
89
|
+
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M11.53 4.47a.75.75 0 0 1 0 1.06l-6 6a.75.75 0 0 1-1.06-1.06l6-6a.75.75 0 0 1 1.06 0"/>
|
|
90
|
+
</symbol>
|
|
91
|
+
<symbol id="diffs-icon-symbol-ignored-fill" viewBox="0 0 16 16">
|
|
92
|
+
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m3.53 4.47a.75.75 0 0 0-1.06 0l-6 6a.75.75 0 1 0 1.06 1.06l6-6a.75.75 0 0 0 0-1.06" clip-rule="evenodd"/>
|
|
93
|
+
</symbol>
|
|
94
|
+
<symbol id="diffs-icon-symbol-inlined" viewBox="0 0 16 16">
|
|
95
|
+
<path d="M7.75 11.75a.75.75 0 0 1 0-1.5h1.44L5.887 6.948a1.5 1.5 0 1 1 1.06-1.06l3.302 3.301V7.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-.75.75z"/><path fill-rule="evenodd" d="M8 16c-6.588 0-8-1.412-8-8s1.412-8 8-8 8 1.412 8 8-1.412 8-8 8m0-1.5c1.613 0 2.807-.089 3.704-.288.88-.196 1.382-.477 1.706-.802.325-.324.606-.826.802-1.706.2-.897.288-2.091.288-3.704s-.089-2.807-.288-3.704c-.196-.88-.477-1.382-.802-1.706-.324-.325-.826-.606-1.706-.802C10.807 1.588 9.613 1.5 8 1.5s-2.807.089-3.704.288c-.88.196-1.382.477-1.706.802-.325.324-.606.826-.802 1.706C1.588 5.193 1.5 6.387 1.5 8s.089 2.807.288 3.704c.196.88.477 1.382.802 1.706.324.325.826.606 1.706.802.897.2 2.091.288 3.704.288" clip-rule="evenodd"/>
|
|
96
|
+
</symbol>
|
|
97
|
+
<symbol id="diffs-icon-symbol-inlined-duo" viewBox="0 0 16 16">
|
|
98
|
+
<path fill-rule="evenodd" d="M8 16c-6.588 0-8-1.412-8-8s1.412-8 8-8 8 1.412 8 8-1.412 8-8 8" clip-rule="evenodd" opacity=".2"/><path d="M7.75 11.75a.75.75 0 0 1 0-1.5h1.44L5.887 6.948a1.5 1.5 0 1 1 1.06-1.06l3.302 3.301V7.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-.75.75z"/>
|
|
99
|
+
</symbol>
|
|
100
|
+
<symbol id="diffs-icon-symbol-inlined-fill" viewBox="0 0 16 16">
|
|
101
|
+
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5.5 4a1.5 1.5 0 1 0 .388 2.948l3.301 3.302H7.75a.75.75 0 0 0 0 1.5H11a.75.75 0 0 0 .75-.75V7.75a.75.75 0 0 0-1.5 0v1.44L6.948 5.887A1.5 1.5 0 0 0 5.5 4" clip-rule="evenodd"/>
|
|
102
|
+
</symbol>
|
|
103
|
+
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
104
|
+
<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"/>
|
|
105
|
+
</symbol>
|
|
106
|
+
<symbol id="diffs-icon-symbol-modified-duo" viewBox="0 0 16 16">
|
|
107
|
+
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0"/>
|
|
108
|
+
</symbol>
|
|
109
|
+
<symbol id="diffs-icon-symbol-modified-fill" viewBox="0 0 16 16">
|
|
110
|
+
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 5a3 3 0 1 0 0 6 3 3 0 0 0 0-6" clip-rule="evenodd"/>
|
|
111
|
+
</symbol>
|
|
112
|
+
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
113
|
+
<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"/>
|
|
114
|
+
</symbol>
|
|
115
|
+
<symbol id="diffs-icon-symbol-moved-duo" viewBox="0 0 16 16">
|
|
116
|
+
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M8.496 4.695a.75.75 0 0 0-.051 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.051 1.06L6.49 8.003 4.693 9.998a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
|
|
117
|
+
</symbol>
|
|
118
|
+
<symbol id="diffs-icon-symbol-moved-fill" viewBox="0 0 16 16">
|
|
119
|
+
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m1.555 4.745a.75.75 0 0 0-1.11 1.01L10.486 8l-2.04 2.245a.75.75 0 0 0 1.109 1.01l2.5-2.75a.75.75 0 0 0 0-1.01zm-4 0a.75.75 0 0 0-1.11 1.01l2.043 2.248-1.796 1.995a.75.75 0 0 0 1.116 1.004l2.25-2.5a.75.75 0 0 0-.003-1.007z" clip-rule="evenodd"/>
|
|
120
|
+
</symbol>
|
|
121
|
+
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
122
|
+
<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"/>
|
|
123
|
+
</symbol>
|
|
124
|
+
</svg>`;function el(e,t){return e==null||t==null?e===t:tl(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 pi={};function tl(e=pi,t=pi){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 nl(e){const t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}function il(){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 rl(){const e=document.createElement("style");return e.setAttribute(co,""),e}var ol=`@layer base,theme,rendered,unsafe;@layer base{:host{--diffs-font-fallback:"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace;--diffs-header-font-fallback:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;--diffs-mixer:light-dark(#000,#fff);--diffs-gap-fallback:8px;--diffs-scrollbar-gutter-fallback:6px;--diffs-scrollbar-gutter:var(--diffs-scrollbar-gutter-override,var(--diffs-scrollbar-gutter-measured,var(--diffs-scrollbar-gutter-fallback)));--diffs-added-light:#0dbe4e;--diffs-added-dark:#5ecc71;--diffs-modified-light:#009fff;--diffs-modified-dark:#69b1ff;--diffs-deleted-light:#ff2e3f;--diffs-deleted-dark:#ff6762;--diffs-warning-light:#d5a910;--diffs-warning-dark:#ffd452;color-scheme:light dark;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);font-feature-settings:var(--diffs-font-features);--diffs-bg:light-dark(var(--diffs-light-bg,#fff),var(--diffs-dark-bg,#000));--diffs-bg-buffer:var(--diffs-bg-buffer-override,light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));--diffs-bg-context:var(--diffs-bg-context-override,light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));--diffs-bg-context-gutter:var(--diffs-bg-context-gutter-override,light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)),color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));--diffs-bg-separator:var(--diffs-bg-separator-override,light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));--diffs-fg:light-dark(var(--diffs-light,#000),var(--diffs-dark,#fff));--diffs-fg-number:var(--diffs-fg-number-override,light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));--diffs-fg-conflict-marker:var(--diffs-fg-conflict-marker-override,var(--diffs-fg-number));--diffs-deletion-base:var(--diffs-deletion-color-override,light-dark(var(--diffs-light-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-light))),var(--diffs-dark-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-dark)))));--diffs-addition-base:var(--diffs-addition-color-override,light-dark(var(--diffs-light-addition-color,var(--diffs-addition-color,var(--diffs-added-light))),var(--diffs-dark-addition-color,var(--diffs-addition-color,var(--diffs-added-dark)))));--diffs-modified-base:var(--diffs-modified-color-override,light-dark(var(--diffs-light-modified-color,var(--diffs-modified-color,var(--diffs-modified-light))),var(--diffs-dark-modified-color,var(--diffs-modified-color,var(--diffs-modified-dark)))));--diffs-bg-deletion:var(--diffs-bg-deletion-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));--diffs-bg-deletion-emphasis:var(--diffs-bg-deletion-emphasis-override,light-dark(rgb(from var(--diffs-deletion-base) r g b / .15),rgb(from var(--diffs-deletion-base) r g b / .2)));--diffs-bg-addition:var(--diffs-bg-addition-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));--diffs-bg-addition-emphasis:var(--diffs-bg-addition-emphasis-override,light-dark(rgb(from var(--diffs-addition-base) r g b / .15),rgb(from var(--diffs-addition-base) r g b / .2)));--diffs-selection-base:var(--diffs-modified-base);--diffs-selection-number-fg:light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));background-color:var(--diffs-bg);color:var(--diffs-fg);display:block}pre,code,[data-error-wrapper]{isolation:isolate;font-family:var(--diffs-font-family,var(--diffs-font-fallback));outline:none;margin:0;padding:0;display:block}pre,code{background-color:var(--diffs-bg)}code{contain:content}input,button{font-family:inherit;font-size:inherit;line-height:inherit}*,:before,:after{box-sizing:border-box}[data-icon-sprite]{display:none}[data-diffs-header],[data-separator]{font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback))}[data-diffs-header][data-sticky]{z-index:1;background-color:var(--diffs-bg);position:sticky;top:0}[data-file-info]{color:var(--fg);background-color:color-mix(in lab, var(--bg) 98%, var(--fg));border-block:1px solid color-mix(in lab, var(--bg) 95%, var(--fg));padding:10px;font-weight:700}[data-diff],[data-file]{--diffs-grid-number-column-width:minmax(min-content, max-content);--diffs-code-grid:var(--diffs-grid-number-column-width) 1fr;&[data-dehydrated]{--diffs-code-grid:var(--diffs-grid-number-column-width) minmax(0, 1fr)}&:hover [data-code]::-webkit-scrollbar-thumb{background-color:var(--diffs-bg-context)}}@supports (-webkit-touch-callout:none){:host{--diffs-scrollbar-gutter-fallback:0px}}[data-line] span,[data-edit-prediction-suffix] span{color:light-dark(var(--diffs-token-light,var(--diffs-light)),var(--diffs-token-dark,var(--diffs-dark)));background-color:light-dark(var(--diffs-token-light-bg,inherit),var(--diffs-token-dark-bg,inherit))}[data-line],[data-gutter-buffer],[data-column-number],[data-line-annotation],[data-no-newline],[data-merge-conflict],[data-merge-conflict-actions],[data-editor-overlay]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-computed-editor-active-line-bg:var(--diffs-computed-selected-line-bg);--diffs-computed-hovered-line-bg:var(--diffs-computed-editor-active-line-bg);--diffs-hover-mix-target:var(--diffs-bg-hover-override,var(--diffs-mixer));--diffs-line-bg:var(--diffs-computed-hovered-line-bg);color:var(--diffs-fg);background-color:var(--diffs-line-bg,var(--diffs-bg))}[data-line],[data-no-newline]{&[data-decoration-bg]{--mix-deco-light:92%;--mix-deco-dark:85%;&[data-decoration-bg-depth="2"]{--mix-deco-light:88%;--mix-deco-dark:80%}&[data-decoration-bg-depth="3"]{--mix-deco-light:85%;--mix-deco-dark:78%}--diffs-hover-mix-target:var(--diffs-decoration-bg);--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) var(--mix-deco-light), var(--diffs-decoration-bg)),color-mix(in lab, var(--diffs-bg) var(--mix-deco-dark), var(--diffs-decoration-bg)))}}[data-line-annotation],[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context);--diffs-computed-decoration-bg:var(--diffs-annotation-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-merge-conflict-actions],[data-gutter-buffer=merge-conflict-action],[data-gutter-buffer=merge-conflict-marker-base],[data-gutter-buffer=merge-conflict-marker-separator],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator]{--diffs-computed-decoration-bg:var(--diffs-bg-context);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-start],[data-merge-conflict=marker-start]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-end],[data-merge-conflict=marker-end]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-has-merge-conflict] [data-line-annotation],[data-has-merge-conflict] [data-gutter-buffer=annotation]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}:where([data-background]){& [data-gutter-buffer],& [data-column-number]{--mix-light:91%;--mix-dark:85%}& [data-line],& [data-no-newline]{--mix-light:88%;--mix-dark:80%}& [data-gutter-buffer],& [data-column-number],& [data-line],& [data-no-newline]{--diffs-diff-line-mix-target:var(--diffs-bg);&[data-line-type=change-deletion]{--diffs-diff-line-mix-target:var(--diffs-bg-deletion-override,var(--diffs-deletion-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-deletion-override,var(--diffs-deletion-base));--diffs-diff-line-mix-target:var(--diffs-bg-deletion-number-override,var(--diffs-deletion-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-line-type=change-addition]{--diffs-diff-line-mix-target:var(--diffs-bg-addition-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--diffs-bg-addition-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=current]{--diffs-diff-line-mix-target:var(--conflict-bg-current-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--conflict-bg-current-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=incoming]{--diffs-diff-line-mix-target:var(--conflict-bg-incoming-override,var(--diffs-modified-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-modified-base);--diffs-diff-line-mix-target:var(--conflict-bg-incoming-number-override,var(--diffs-modified-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}}}[data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline],[data-editor-overlay]{--diffs-selection-mix-target:var(--diffs-bg-selection-override,var(--diffs-selection-base));--diffs-selection-emphasis-mix-target:var(--diffs-selection-mix-target);&:where([data-editor-overlay]),&:where([data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline])[data-selected-line]{--mix-selection-light:82%;--mix-selection-dark:75%;--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line])){--mix-selection-light:75%;--mix-selection-dark:60%;--diffs-selection-mix-target:var(--diffs-bg-selection-number-override,var(--diffs-selection-base));--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-line][data-selected-line]):is([data-line-type=change-addition],[data-line-type=change-deletion]){--diffs-selection-emphasis-mix-target:light-dark(color-mix(in lab, var(--diffs-diff-line-mix-target,var(--diffs-selection-mix-target)) var(--mix-selection-light), var(--diffs-selection-mix-target)),var(--diffs-selection-mix-target))}&:where([data-editor-overlay]),&[data-selected-line]{--diffs-computed-selected-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-light), var(--diffs-selection-mix-target)),color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-dark), var(--diffs-selection-mix-target)))}}[data-line][data-editor-active-line],[data-column-number][data-editor-active-line]{--diffs-computed-editor-active-line-bg:color-mix(in lab, var(--diffs-computed-selected-line-bg) var(--diffs-editor-active-line-source-mix,100%), var(--diffs-selection-emphasis-mix-target))}@media (pointer:fine){[data-line][data-hovered],[data-gutter-buffer][data-hovered],[data-column-number][data-hovered],[data-line-annotation][data-hovered],[data-no-newline][data-hovered],[data-merge-conflict][data-hovered],[data-merge-conflict-actions][data-hovered],[data-editor-overlay][data-hovered]{--diffs-computed-hovered-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 97%, var(--diffs-hover-mix-target)),color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 91%, var(--diffs-hover-mix-target)))}}[data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line]){color:var(--diffs-selection-number-fg)}[data-no-newline]{user-select:none;& span{opacity:.6}}[data-diff-type=split][data-overflow=scroll]{grid-template-columns:1fr 1fr;display:grid;& [data-additions]{border-left:1px solid var(--diffs-bg)}& [data-deletions]{border-right:1px solid var(--diffs-bg)}}[data-code]{grid-auto-flow:dense;grid-template-columns:var(--diffs-code-grid);overflow:var(--diffs-overflow-override,scroll) clip;overscroll-behavior-x:none;tab-size:var(--diffs-tab-size,2);padding-top:var(--diffs-gap-block,var(--diffs-gap-fallback));padding-bottom:max(0px, calc(var(--diffs-gap-block,var(--diffs-gap-fallback)) - var(--diffs-scrollbar-gutter)));scrollbar-gutter:stable;align-self:flex-start;display:grid}[data-diffs-scrollbar-measure]{opacity:0;pointer-events:none;scrollbar-gutter:auto;grid-template-columns:none;width:100px;height:100px;padding:0;position:absolute;top:-200px;left:-200px}[data-container-size]{container-type:inline-size}[data-code]::-webkit-scrollbar{width:0;height:var(--diffs-scrollbar-gutter)}[data-code]::-webkit-scrollbar-track{background:0 0}[data-code]::-webkit-scrollbar-thumb{background-color:#0000;background-clip:content-box;border:1px solid #0000;border-radius:3px}[data-code]::-webkit-scrollbar-corner{background-color:#0000}@supports ((-moz-appearance:none)){[data-code]{scrollbar-width:thin;scrollbar-color:var(--diffs-bg-context) transparent;padding-bottom:var(--diffs-gap-block,var(--diffs-gap-fallback))}}[data-diffs-header]~[data-diff],[data-diffs-header]~[data-file]{& [data-code],&[data-overflow=wrap],&[data-dehydrated][data-diff-type=split][data-overflow=scroll]{padding-top:0}}[data-gutter]{grid-template-rows:subgrid;grid-template-columns:subgrid;z-index:3;background-color:var(--diffs-bg);grid-column:1;display:grid;position:relative;& [data-gutter-buffer],& [data-column-number]{border-right:var(--diffs-gap-style,2px solid var(--diffs-bg))}}[data-content]{grid-template-rows:subgrid;grid-template-columns:subgrid;background-color:var(--diffs-bg);grid-column:2;min-width:0;display:grid}[data-overflow=scroll]:not([data-dehydrated],[data-custom-styles],:has(>[data-code]>[contenteditable],>[data-code]>*>:is([data-line-annotation],[data-separator],[data-merge-conflict],[data-merge-conflict-actions])))>[data-code]{display:flex;&>[data-gutter]{flex-shrink:0;display:block}&>[data-content]{flex:1 0 max-content;display:block}}[data-diff-type=split][data-overflow=wrap],[data-dehydrated][data-diff-type=split][data-overflow=scroll]{grid-auto-flow:dense;grid-template-columns:repeat(2, var(--diffs-code-grid));padding-block:var(--diffs-gap-block,var(--diffs-gap-fallback));display:grid;& [data-code]{display:contents}& [data-deletions]{& [data-gutter]{grid-column:1}& [data-content]{border-right:1px solid var(--diffs-bg);grid-column:2}}& [data-additions]{& [data-gutter]{border-left:1px solid var(--diffs-bg);grid-column:3}& [data-content]{grid-column:4}}}[data-dehydrated][data-diff-type=split][data-overflow=scroll] [data-content]{overflow:clip}[data-overflow=scroll] [data-gutter]{position:sticky;left:0}[data-interactive-lines] [data-line]{cursor:pointer}[data-interactive-line-numbers] [data-column-number]{cursor:pointer;touch-action:none}[data-content-buffer],[data-gutter-buffer]{user-select:none;min-height:1lh;position:relative}[data-gutter-buffer]{padding-left:2ch;padding-right:1ch;&:before{content:"";min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));display:block}}[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context-gutter);min-height:0}[data-gutter-buffer=buffer]{--diffs-line-bg:var(--diffs-bg-context-gutter)}[data-content-buffer]{background-position:5px 0;background-size:8px 8px;background-origin:border-box;background-image:repeating-linear-gradient(-45deg, transparent, transparent calc(3px * 1.414), var(--diffs-bg-buffer) calc(3px * 1.414), var(--diffs-bg-buffer) calc(4px * 1.414));grid-column:1}[data-separator]{box-sizing:content-box;background-color:var(--diffs-bg)}[data-separator=simple]{min-height:4px}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata],[data-separator=simple]{background-color:var(--diffs-bg-separator)}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata]{height:32px;position:relative}[data-separator-wrapper]{user-select:none;fill:currentColor;background-color:var(--diffs-bg);align-items:center;height:100%;display:flex;position:absolute;inset-inline:0}[data-content] [data-separator-wrapper]{display:none}[data-separator=metadata] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;color:var(--diffs-fg-number);white-space:nowrap;text-overflow:ellipsis;min-width:min-content;padding-inline:1ch;inset-inline:100% auto;overflow:hidden}[data-separator=line-info]{margin-block:var(--diffs-gap-block,var(--diffs-gap-fallback));& [data-separator-wrapper]{min-width:16px}}[data-separator=line-info-basic],[data-separator=metadata]{margin-block:0}[data-separator=line-info][data-separator-first]{margin-top:0}[data-separator=line-info][data-separator-last]{margin-bottom:0}[data-expand-index] [data-separator-wrapper]{grid-template-columns:32px auto;display:grid}[data-expand-index] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:32px 32px auto}[data-expand-button],[data-separator-content]{background-color:var(--diffs-bg-separator);flex:none;align-items:center;display:flex}[data-expand-index] [data-separator-content]:hover{cursor:pointer;text-decoration:underline}[data-expand-button]{cursor:pointer;min-width:32px;color:var(--diffs-fg-number);border-right:2px solid var(--diffs-bg);flex-shrink:0;justify-content:center;align-self:stretch;&:hover{color:var(--diffs-fg)}&[data-expand-all-button]{display:none}}[data-expand-down] [data-icon]{transform:scaleY(-1)}[data-separator-content]{height:100%;color:var(--diffs-fg-number);flex:auto;justify-content:flex-start;padding:0 1ch;overflow:hidden}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-content]{user-select:none;height:100%;overflow:clip}}[data-unmodified-lines]{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;display:block;overflow:hidden}@supports (width:1cqi){[data-unified]{& [data-separator=line-info] [data-separator-wrapper]{padding-inline:var(--diffs-gap-inline,var(--diffs-gap-fallback));width:100cqi;& [data-separator-content]{border-radius:6px}}& [data-separator=line-info][data-expand-index] [data-separator-wrapper] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-gutter]{& [data-separator=line-info] [data-separator-wrapper]{padding-left:var(--diffs-gap-inline,var(--diffs-gap-fallback))}& [data-separator=line-info] [data-separator-content]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-separator=line-info][data-expand-index] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-additions]{& [data-content] [data-separator=line-info]{background-color:var(--diffs-bg);& [data-separator-wrapper]{display:none}}& [data-gutter] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);border-top-right-radius:6px;border-bottom-right-radius:6px;height:100%;display:block;& [data-separator-content],& [data-expand-button]{display:none}}}[data-overflow=scroll] [data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]{width:calc(100cqi - var(--diffs-gap-inline,var(--diffs-gap-fallback)))}[data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;margin-right:var(--diffs-gap-inline,var(--diffs-gap-fallback));border-top-right-radius:6px;border-bottom-right-radius:6px;display:block;& [data-separator-content],& [data-expand-button]{display:none}}[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}}@media (pointer:fine){[data-separator=line-info] [data-separator-wrapper]{&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:unset}& [data-expand-down]{border-bottom-left-radius:6px;border-top-left-radius:unset}}}}}@media (pointer:coarse){[data-separator=line-info-basic] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px 34px auto;& [data-separator-content]{grid-column:unset;grid-row:unset}}@supports (width:1cqi){[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-expand-down]{border-bottom-left-radius:unset;border-top-left-radius:unset}}}}}@media (pointer:fine){[data-separator-wrapper][data-separator-multi-button]{grid-template-rows:50% 50%;display:grid;& [data-separator-content]{grid-area:1/2/-1;min-width:min-content}& [data-expand-button]{grid-column:1}}[data-separator=line-info] [data-separator-wrapper],[data-separator=line-info] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px auto}[data-separator=line-info-basic][data-expand-index] [data-separator-wrapper]{grid-template-columns:100% auto}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-multi-button]{& [data-expand-up]{border-bottom:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}& [data-expand-down]{border-top:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}}}}[data-additions] [data-gutter] [data-separator-wrapper],[data-additions] [data-separator=line-info-basic] [data-separator-wrapper],[data-content] [data-separator-wrapper]{display:none}[data-line-annotation]{min-height:var(--diffs-annotation-min-height,0);z-index:2}[data-merge-conflict-actions]{z-index:2}[data-separator=custom]{grid-template-columns:subgrid;display:grid}[data-line],[data-column-number],[data-no-newline]{padding-inline:1ch;position:relative}[data-indicators=classic] [data-line]{padding-inline-start:2ch}[data-indicators=classic]{& [data-line-type=change-addition],& [data-line-type=change-deletion]{&[data-no-newline],&[data-line]{&:before{user-select:none;width:1ch;height:1lh;display:inline-block;position:absolute;top:0;left:0}}}& [data-line-type=change-addition]{&[data-line],&[data-no-newline]{&:before{content:"+";color:var(--diffs-addition-base)}}}& [data-line-type=change-deletion]{&[data-line],&[data-no-newline]{&:before{content:"-";color:var(--diffs-deletion-base)}}}}[data-indicators=bars]{& [data-line-type=change-deletion],& [data-line-type=change-addition]{&[data-column-number]{&:before{content:"";user-select:none;contain:strict;width:4px;height:100%;display:block;position:absolute;top:0;left:0}}}& [data-line-type=change-deletion]{&[data-column-number]{&:before{background-image:linear-gradient(0deg, var(--diffs-bg-deletion) 50%, var(--diffs-deletion-base) 50%);background-repeat:repeat;background-size:2px 2px;background-size:calc(1lh / round(1lh / 2px)) calc(1lh / round(1lh / 2px))}}}& [data-line-type=change-addition]{&[data-column-number]{&:before{background-color:var(--diffs-addition-base)}}}}[data-overflow=wrap]{& [data-line]{white-space:pre-wrap;word-break:break-word}& [data-annotation-content]{word-break:break-word}}[data-overflow=scroll] [data-line]{white-space:pre;min-height:1lh}[data-overflow=scroll] [data-column-number]{min-height:1lh}[data-column-number]{box-sizing:content-box;text-align:right;user-select:none;color:var(--diffs-fg-number);padding-left:2ch}[data-line-number-content]{min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));z-index:1;display:inline-block;position:relative}[data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{min-width:4px;padding:0;&:before{min-width:0}}& [data-line-number-content]{display:none}& [data-gutter-utility-slot]{right:unset;justify-content:flex-start;left:0}&[data-indicators=bars] [data-gutter-utility-slot]{left:6px}}[data-file][data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{border-right:0;min-width:0}}[data-diff-span]{box-decoration-break:clone;border-radius:3px}[data-line-type=change-addition] [data-diff-span]{background-color:var(--diffs-bg-addition-emphasis)}[data-line-type=change-deletion] [data-diff-span]{background-color:var(--diffs-bg-deletion-emphasis)}[data-merge-conflict=marker-start],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator],[data-merge-conflict=marker-end]{color:var(--diffs-fg);padding-left:1ch}[data-merge-conflict=marker-start],[data-merge-conflict=marker-end]{align-items:center;display:flex;&:after{color:var(--diffs-fg-conflict-marker);font-size:.75rem;font-style:normal;line-height:1.25rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));padding-left:1ch}}[data-merge-conflict=marker-start]:after{content:"(Current Change)"}[data-merge-conflict=marker-end]:after{content:"(Incoming Change)"}[data-merge-conflict-actions-content]{min-height:1.75rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));color:var(--diffs-fg);align-items:center;gap:.25rem;padding-inline:.5rem;font-size:.75rem;line-height:1.2;display:flex}[data-merge-conflict-action]{appearance:none;color:var(--diffs-fg-number);font:inherit;cursor:pointer;background:0 0;border:0;padding:0;font-style:normal}[data-merge-conflict-action]:hover{color:var(--diffs-fg)}[data-merge-conflict-action=current]:hover{color:var(--diffs-addition-base)}[data-merge-conflict-action=incoming]:hover{color:var(--diffs-modified-base)}[data-merge-conflict-action-separator]{color:var(--diffs-fg-number);opacity:.6;user-select:none}[data-diffs-header=default]{background-color:var(--diffs-bg);justify-content:space-between;align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));min-height:calc(1lh + (var(--diffs-gap-block,var(--diffs-gap-fallback)) * 3));z-index:2;flex-direction:row;padding-inline:16px;display:flex;position:relative;top:0}[data-header-content]{align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));white-space:nowrap;flex-direction:row;min-width:0;display:flex}[data-header-content] [data-prev-name],[data-header-content] [data-title]{text-overflow:ellipsis;white-space:nowrap;direction:rtl;min-width:0;overflow:hidden}[data-prev-name]{opacity:.7}[data-rename-icon]{fill:currentColor;flex-grow:0;flex-shrink:0}[data-diffs-header=default] [data-metadata]{white-space:nowrap;align-items:center;gap:1ch;display:flex}[data-diffs-header=default] [data-additions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-addition-base)}[data-diffs-header=default] [data-deletions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-deletion-base)}[data-change-icon]{fill:currentColor;flex-shrink:0}[data-change-icon=change],[data-change-icon=rename-pure],[data-change-icon=rename-changed]{color:var(--diffs-modified-base)}[data-change-icon=new]{color:var(--diffs-addition-base)}[data-change-icon=deleted]{color:var(--diffs-deletion-base)}[data-change-icon=file]{opacity:.6}[data-annotation-content]{z-index:2;isolation:isolate;white-space:normal;align-self:flex-start;min-width:0;display:flow-root;position:relative}[data-overflow=scroll] [data-annotation-content],[data-overflow=scroll] [data-merge-conflict-actions-content]{width:var(--diffs-column-content-width,auto);left:var(--diffs-column-number-width,0);position:sticky}[data-annotation-slot]{text-wrap-mode:wrap;word-break:normal;white-space-collapse:collapse}[data-gutter-utility-slot]{touch-action:none;justify-content:flex-end;display:flex;position:absolute;top:0;bottom:0;right:0}[data-utility-button]{appearance:none;cursor:pointer;width:1lh;height:1lh;font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);background-color:var(--diffs-modified-base);color:var(--diffs-bg);fill:currentColor;z-index:4;touch-action:none;border:none;border-radius:4px;justify-content:center;align-items:center;margin-right:calc(-1lh + 1ch);padding:0;display:flex;position:relative;&:before{content:"";display:block;position:absolute;inset:0 0 0 -4px}}[data-decoration-bar-stack]{pointer-events:none;isolation:isolate;z-index:1;background-color:var(--diffs-decoration-bar-color,transparent);box-sizing:content-box;border-left:2px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg);width:6px;position:absolute;top:0;bottom:0;right:-2px;[data-decoration-bar-depth="1"] &{background-color:color-mix(in lab, var(--diffs-bg) 20%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="2"] &{background-color:color-mix(in lab, var(--diffs-bg) 45%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="3"] &{background-color:color-mix(in lab, var(--diffs-bg) 65%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-start] &{border-top-left-radius:5px;border-top-right-radius:5px}[data-decoration-bar-end] &{z-index:3;border-bottom-right-radius:5px;border-bottom-left-radius:5px}}[data-placeholder]{contain:strict}[data-error-wrapper]{padding:var(--diffs-gap-block,var(--diffs-gap-fallback)) var(--diffs-gap-inline,var(--diffs-gap-fallback));scrollbar-width:none;max-height:400px;overflow:auto;& [data-error-message]{color:var(--diffs-deletion-base);font-size:18px;font-weight:700}& [data-error-stack]{color:var(--diffs-fg-number)}}}@layer theme,rendered,unsafe;
|
|
125
|
+
`;let vt;function bn(e){if(vt!=null)return vt;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(ho,"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),vt=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),vt}function Hr(e){const t=e==null?"var(--diffs-scrollbar-gutter-fallback)":`${e}px`;return`${Ji}: ${t};`}const Mr="@layer base, theme, rendered, unsafe;",sl=new RegExp(`${ul(Ji)}\\s*:\\s*[^;]+;`);function al(e){return`${Mr}
|
|
126
|
+
@layer unsafe {
|
|
127
|
+
${e}
|
|
128
|
+
}`}function ll(e,t="system",n){const i=t==="system"?"":`
|
|
129
|
+
color-scheme: ${t};`,r=Hr(n),o=(t==="system"?["light","dark"]:[t]).map(s=>{const l=`
|
|
130
|
+
[data-line] span, [data-edit-prediction-suffix] span {
|
|
131
|
+
font-weight: var(--diffs-token-${s}-font-weight, inherit);
|
|
132
|
+
font-style: var(--diffs-token-${s}-font-style, inherit);
|
|
133
|
+
text-decoration: var(--diffs-token-${s}-text-decoration, inherit);
|
|
134
|
+
}`;return t==="system"&&s==="dark"?`@media (prefers-color-scheme: dark) {${l}
|
|
135
|
+
}`:l}).join(`
|
|
136
|
+
`);return`${Mr}
|
|
137
|
+
@layer base {
|
|
138
|
+
${o}
|
|
139
|
+
}
|
|
140
|
+
@layer rendered {
|
|
141
|
+
:host {${i}
|
|
142
|
+
${r}
|
|
143
|
+
${e}
|
|
144
|
+
}
|
|
145
|
+
}`}function dl(e,t){const n=Hr(t);return e.replace(sl,n)}function ul(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const cl=new WeakMap;function Un(e){const t=cl.get(e);return t??e}function Yt({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==null||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 hl(e,t){if(t==null)return;const n=e.shadowRoot??e.attachShadow({mode:"open"});n.innerHTML===""&&(n.innerHTML=t)}function fl(e,{type:t,diffIndicators:n,disableBackground:i,disableLineNumbers:r,overflow:o,split:s,totalLines:l,customProperties:a}){if(a!=null)for(const u in a){const d=a[u];d!=null&&e.setAttribute(u,`${d}`)}switch(t==="diff"?(e.setAttribute("data-diff",""),e.removeAttribute("data-file")):(e.setAttribute("data-file",""),e.removeAttribute("data-diff")),n){case"bars":case"classic":e.setAttribute("data-indicators",n);break;case"none":e.removeAttribute("data-indicators")}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 mi(e){if(typeof HTMLStyleElement<"u"&&e instanceof HTMLStyleElement)return!0;const t=e.tagName??e.nodeName;return typeof t=="string"&&t.toLowerCase()==="style"}let gl;function pl(){return gl??(gl="safari"in window&&"pushNotification"in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent))}function vi(e,t,n){const i=new Map;for(const r of e){const o=Un(r);i.set(o,(n==null?void 0:n.slotNames.get(o))??t(r))}return{provided:e,current:e,slotNames:i}}function ml(e,t,n){for(const i of t){const r=Un(i);e.slotNames.has(r)||e.slotNames.set(r,n(i))}e.provided=t,e.current=t}function vl(e,t,n){if(e==null)return n(t);const i=Un(t);let r=e.slotNames.get(i);return r==null&&(r=n(t),e.slotNames.set(i,r)),r}function bl(e){return(e==null?void 0:e.useTokenTransformer)===!0||(e==null?void 0:e.onTokenClick)!=null||(e==null?void 0:e.onTokenEnter)!=null||(e==null?void 0:e.onTokenLeave)!=null}function bi(e,t){const n=(e==null?void 0:e.offsetHeight)??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=""}}function yl({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===""){t==null||t.remove();return}return t??(t=Sl()),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Sl(){const e=document.createElement("style");return e.setAttribute(uo,""),e}var Cl=class extends Error{constructor(){super("WorkerPoolManager: operation canceled because the pool terminated"),this.name="WorkerPoolTerminatedError"}},xl=class extends Error{constructor(){super("WorkerPoolManager: operation canceled before the task completed"),this.name="WorkerPoolTaskCanceledError"}},kl=class extends Error{constructor(e,t){super(e,t),this.name="WorkerPoolWorkerError"}};const wl=new WeakSet;function Ll(e){return e instanceof Cl||e instanceof xl}function Ir(e){return Ll(e)||e instanceof kl&&wl.has(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(ol)),i.adoptedStyleSheets=[e]}connectedCallback(){const i=this.shadowRoot??this.attachShadow({mode:"open"});bn(i)}}customElements.define(qi,t)}function Xt(e){return{...go,...e}}function st(e,t){return yn(e,t)+El(e,t)}function yn(e,t){return t?0:e.diffHeaderHeight}function El(e,t){return e.paddingTop??(t?e.spacing:0)}function Pr(e){return e.paddingBottom??e.spacing}function Rl(e){switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}function j(e,t){return(e==null?void 0:e.cacheKey)!=null||(t==null?void 0:t.cacheKey)!=null?(e==null?void 0:e.cacheKey)===(t==null?void 0:t.cacheKey):e===t}function Nr(e,t){return(e==null?void 0:e.cacheKey)===(t==null?void 0:t.cacheKey)&&(e==null?void 0:e.contents)===(t==null?void 0:t.contents)&&(e==null?void 0:e.name)===(t==null?void 0:t.name)&&(e==null?void 0:e.lang)===(t==null?void 0:t.lang)}function Fr(e){return e.map(t=>({...t,hunkContent:t.hunkContent.map(n=>({...n}))}))}function Or(e){return{...e,hunks:Fr(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function de(e,t){return e-(t===0?0:1)}function re(e,t){return de(e,t)+t}const Al=1;function zr(e,...t){return`ck${Al}:${JSON.stringify([e,...t])}`}function Pt(e){return e!==""?e.split(so):[]}function Sn(e,t,n){const i=e==="clone"?Or(t):t;if(!i.isPartial)throw new Error("hydratePartialDiff: fileDiff must be partial");switch(i.type){case"change":case"rename-changed":return Dl(i,Hl(i,n),yi(i,n));case"rename-pure":{const r=yi(i,n);Ml(i,n);const o=Pt(r.contents);return i.isPartial=!1,i.deletionLines=o,i.additionLines=o,i.deletionCharacterCount=r.contents.length,i.additionCharacterCount=r.contents.length,Ur(i,null,r),i}}throw new Error(`hydratePartialDiff: ${i.type} diffs cannot be hydrated from loaded files`)}function Dl(e,t,n){const i=Pt(t.contents),r=Pt(n.contents),{hunks:o,splitLineCount:s,unifiedLineCount:l}=Tl(e.hunks,r.length);return e.hunks=o,e.splitLineCount=s,e.unifiedLineCount=l,e.isPartial=!1,e.deletionLines=i,e.additionLines=r,e.deletionCharacterCount=t.contents.length,e.additionCharacterCount=n.contents.length,Ur(e,t,n),e}function Tl(e,t){let n=0,i=0,r=0;const o=[];for(const s of e){const l=Math.max(s.additionStart-1,0),a=Math.max(s.deletionStart-1,0);let u=l,d=a,c=0,f=0,h=0,g=0;const p=[];for(const S of s.hunkContent){if(S.type==="context"){p.push({...S,additionLineIndex:u,deletionLineIndex:d}),u+=S.lines,d+=S.lines,h+=S.lines,g+=S.lines;continue}p.push({...S,additionLineIndex:u,deletionLineIndex:d}),u+=S.additions,d+=S.deletions,c+=S.additions,f+=S.deletions,h+=Math.max(S.additions,S.deletions),g+=S.additions+S.deletions}const b=Math.max(de(s.additionStart,s.additionCount)-r,0);o.push({...s,collapsedBefore:b,additionLineIndex:l,deletionLineIndex:a,additionLines:c,deletionLines:f,hunkContent:p,splitLineStart:n+b,unifiedLineStart:i+b,splitLineCount:h,unifiedLineCount:g}),n+=b+h,i+=b+g,r=re(s.additionStart,s.additionCount)}if(o.length>0){const s=o[o.length-1],l=re(s.additionStart,s.additionCount),a=Math.max(t-l,0);n+=a,i+=a}return{hunks:o,splitLineCount:n,unifiedLineCount:i}}function Hl(e,t){if(t.oldFile==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function yi(e,t){if(t.newFile==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function Ml(e,t){if(t.oldFile!==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function Il(e,t,n){return e.cacheKey!=null?`${e.cacheKey}:hydrated`:Pl(t,n)}function Ur(e,t,n){const i=Il(e,t,n);if(i==null){delete e.cacheKey;return}e.cacheKey=i}function Pl(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?zr("hydrated-files",e.cacheKey,t.cacheKey):void 0:(e==null?void 0:e.cacheKey)??(t==null?void 0:t.cacheKey)}function Re(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}const Nl=new TextEncoder,Fl=new TextDecoder("utf-8",{ignoreBOM:!0}),Ol=/[\uD800-\uDFFF]/,Cn=1024;let qe=new Uint8Array(Cn);function _r(){qe.length!==Cn&&(qe=new Uint8Array(Cn))}function K(e){if(e.length===0)return e;if(Ol.test(e))return JSON.parse(JSON.stringify(e));const t=e.length*3;qe.length<t&&(qe=new Uint8Array(t));const{written:n}=Nl.encodeInto(e,qe);return Fl.decode(qe.subarray(0,n))}const zl=new TextDecoder("utf-8",{ignoreBOM:!0}),Ul={'"':'"',"\\":"\\",a:"\x07",b:"\b",t:" ",n:`
|
|
146
|
+
`,v:"\v",f:"\f",r:"\r"};function _l(e){if(e[0]!=='"')return;let t="",n=1;for(;n<e.length;){const i=e[n];if(i==='"')return{fileName:t,rawLength:n+1};if(i!=="\\"){t+=i,n++;continue}const r=Ul[e[n+1]];if(r!=null){t+=r,n+=2;continue}const o=[];do{const s=$l(e,n+1);if(s==null)return;o.push(s),n+=4}while(e[n]==="\\"&&e[n+1]>="0"&&e[n+1]<="7");t+=zl.decode(new Uint8Array(o))}}function $l(e,t){const n=e.charCodeAt(t)-48,i=e.charCodeAt(t+1)-48,r=e.charCodeAt(t+2)-48;if(n>=0&&n<=3&&i>=0&&i<=7&&r>=0&&r<=7)return n*64+i*8+r}const Wl=4096,Bl=.5;function Vl(e){for(const t of e.hunks)for(let n=0;n<t.hunkContent.length;n++){const i=t.hunkContent[n];if(i.type!=="change")continue;const r=Gl(e,i);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}}function jl(e,t,n){const{hunkContent:i}=e;for(let r=1;r<i.length;r++){const o=i[r],s=i[r-1];if(o.type!=="change"||o.additions>0&&o.deletions>0||s.type!=="context")continue;const l=o.additions>0,a=l?t.additionLines:t.deletionLines,u=l?o.additionLineIndex:o.deletionLineIndex,d=l?o.additions:o.deletions,c=a[u]??"";if(c.trim()!=="")continue;let f=!0;for(let S=1;S<d;S++)if(a[u+S]!==c){f=!1;break}if(!f)continue;let h=0;for(;h<s.lines&&t.additionLines[s.additionLineIndex+s.lines-1-h]===c;)h++;if(h===0||r===1&&h===s.lines||n!=null&&(h=n(o,h),h===0))continue;o.additionLineIndex-=h,o.deletionLineIndex-=h;const g=o.additionLineIndex+o.additions,p=o.deletionLineIndex+o.deletions,b=i[r+1];(b==null?void 0:b.type)==="context"?(b.lines+=h,b.additionLineIndex=g,b.deletionLineIndex=p):i.splice(r+1,0,{type:"context",lines:h,additionLineIndex:g,deletionLineIndex:p}),s.lines-=h,s.lines===0&&(i.splice(r-1,1),r--)}}function Gl(e,t){const{deletions:n,additions:i,deletionLineIndex:r,additionLineIndex:o}=t,s=Math.min(n,i),l=Math.abs(i-n);if(s===0||l===0||s*(l+1)>Wl)return null;const a=[];for(let p=0;p<n;p++)a.push(Si(e.deletionLines[r+p]??""));const u=[];for(let p=0;p<i;p++)u.push(Si(e.additionLines[o+p]??""));const d=i>n;let c=0,f=-1;for(let p=0;p<=l;p++){let b=0;for(let S=0;S<s;S++)b+=Kl(a[S+(d?0:p)],u[S+(d?p:0)]);p===0?f=b+s*Bl:b>f&&(f=b,c=p)}if(c===0)return null;const h=[],g=(p,b,S,m)=>{(p>0||b>0)&&h.push({type:"change",deletions:p,additions:b,deletionLineIndex:S,additionLineIndex:m})};return d?(g(0,c,r,o),g(s,s,r,o+c),g(0,i-s-c,r+s,o+c+s)):(g(c,0,r,o),g(s,s,r+c,o),g(n-s-c,0,r+c+s,o+s)),h}const ql=/\s+/g;function Si(e){return e.replace(ql,"")}function Kl(e,t){if(e===t)return 1;const n=Math.max(e.length,t.length),i=Math.min(e.length,t.length);if(i===0)return 0;let r=0;for(;r<i&&e[r]===t[r];)r++;let o=0;for(;o<i-r&&e[e.length-1-o]===t[t.length-1-o];)o++;return(r+o)/n}const Yl=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function Xl(e,t,n=!1,i){const r=od(e),o=r?Ql(e):ed(e);let s;const l=[];for(const a of o){if(r&&!Ki.test(a)){if(s==null)s=K(a);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",a)}continue}else if(!r&&!td(a)){if(s==null)s=K(a);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",a)}continue}const u=$r(a,{cacheKey:void 0,isGitDiff:r,throwOnError:n});u!=null&&l.push(u)}return{patchMetadata:s,files:l}}function Zl(e,t){try{return $r(e,t)}finally{_r()}}function $r(e,{cacheKey:t,isGitDiff:n=Ki.test(e),oldFile:i,newFile:r,throwOnError:o=!1}={}){let s=0;const l=jr(e,"@@ ");let a;const u=i==null||r==null;let d=0,c=0;for(const f of l){const h=Wr(f),g=h[0];if(g==null){if(o)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",f);continue}const p=Vr(g);let b=0,S=0;if(p==null||a==null){if(a!=null){if(o)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",f);continue}a={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:u,additionLines:!u&&i!=null&&r!=null?xi(r.contents):[],deletionLines:!u&&i!=null&&r!=null?xi(i.contents):[],additionCharacterCount:!u&&i!=null&&r!=null?r.contents.length:0,deletionCharacterCount:!u&&i!=null&&r!=null?i.contents.length:0,cacheKey:Li(t)},a.additionLines.length===1&&(r==null?void 0:r.contents)===""&&(a.additionLines.length=0),a.deletionLines.length===1&&(i==null?void 0:i.contents)===""&&(a.deletionLines.length=0);for(const R of h){if(R.startsWith("diff --git")){const N=R.trim().match(Yl);if(N==null){if(o)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",R);continue}const I=nt(N[1],!0),E=nt(N[2],!0);a.name=K(E),I!==E&&(a.prevName=K(I));continue}const H=R.startsWith("---")||R.startsWith("+++")?R.match(ao):null;if(H!=null){const[,N,I]=H,E=nt(I,n);if(N==="---"&&E!=="/dev/null"){const T=K(E);a.prevName=T,a.name=T}else N==="+++"&&E!=="/dev/null"&&(a.name=K(E))}else if(n){if(R.startsWith("new mode ")&&(a.mode=K(R.slice(8).trim())),R.startsWith("old mode ")&&(a.prevMode=K(R.slice(8).trim())),R.startsWith("new file mode")&&(a.type="new",a.mode=K(R.slice(13).trim())),R.startsWith("deleted file mode")&&(a.type="deleted",a.mode=K(R.slice(17).trim())),R.startsWith("similarity index")&&(R.startsWith("similarity index 100%")?a.type="rename-pure":a.type="rename-changed"),R.startsWith("index ")){const[,N,I,E]=R.trim().match(lo)??[];N!=null&&(a.prevObjectId=K(N)),I!=null&&(a.newObjectId=K(I)),E!=null&&(a.mode=K(E))}(R.startsWith("rename from ")||R.startsWith("copy from "))&&(a.prevName=K(nt(R.slice(R.startsWith("rename")?12:10)))),(R.startsWith("rename to ")||R.startsWith("copy to "))&&(a.name=K(nt(R.slice(R.startsWith("rename")?10:8))))}}continue}let m,v;for(;h.length>0&&(h[h.length-1]===`
|
|
147
|
+
`||h[h.length-1]==="\r"||h[h.length-1]===`\r
|
|
148
|
+
`||h[h.length-1]==="");)h.pop();const{additionStart:C,deletionStart:y}=p;d=u?d:y-1,c=u?c:C-1;const x={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:C,additionLines:b,deletionCount:p.deletionCount,deletionStart:y,deletionLines:S,deletionLineIndex:d,additionLineIndex:c,hunkContent:[],hunkContext:Li(p.hunkContext),hunkSpecs:K(g),noEOFCRAdditions:!1,noEOFCRDeletions:!1};let L=0,k=0;for(let R=1;R<h.length;R++){const H=h[R];if(L>=x.additionCount&&k>=x.deletionCount&&!H.startsWith("\\")){if(!(nd(H)&&!id(H)))break;if(o)throw Error("parsePatchContent: hunk has more lines than expected")}const N=H[0];if(N!=="+"&&N!=="-"&&N!==" "&&N!=="\\"){if(o)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${N}", full line: "${H}"`),console.error("processFile: invalid rawLine:",H);continue}const I=sd(N);if(I==="addition"){if(o&&L>=x.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");const E=Zt(H);(m==null||m.type!=="change")&&(m=Jt("change",d,c),x.hunkContent.push(m)),c++,L++,u&&(a.additionLines.push(E),a.additionCharacterCount+=E.length),m.additions++,b++,v="addition"}else if(I==="deletion"){if(o&&k>=x.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");const E=Zt(H);(m==null||m.type!=="change")&&(m=Jt("change",d,c),x.hunkContent.push(m)),d++,k++,u&&(a.deletionLines.push(E),a.deletionCharacterCount+=E.length),m.deletions++,S++,v="deletion"}else if(I==="context"){if(o&&(k>=x.deletionCount||L>=x.additionCount))throw Error("parsePatchContent: hunk has too many context lines");const E=Zt(H);(m==null||m.type!=="context")&&(m=Jt("context",d,c),x.hunkContent.push(m)),c++,d++,L++,k++,u&&(a.deletionLines.push(E),a.additionLines.push(E),a.deletionCharacterCount+=E.length,a.additionCharacterCount+=E.length),m.lines++,v="context"}else if(I==="metadata"&&m!=null){if(m.type==="context"?(x.noEOFCRAdditions=!0,x.noEOFCRDeletions=!0):v==="deletion"?x.noEOFCRDeletions=!0:v==="addition"&&(x.noEOFCRAdditions=!0),u&&(v==="addition"||v==="context")){const E=a.additionLines.length-1;if(E>=0){const T=a.additionLines[E],U=Re(T);a.additionLines[E]=U,a.additionCharacterCount+=U.length-T.length}}if(u&&(v==="deletion"||v==="context")){const E=a.deletionLines.length-1;if(E>=0){const T=a.deletionLines[E],U=Re(T);a.deletionLines[E]=U,a.deletionCharacterCount+=U.length-T.length}}}}if(L!==x.additionCount||k!==x.deletionCount){if(o)throw Error("parsePatchContent: hunk line count mismatch");console.error(`parsePatchContent: hunk line count mismatch: "${g.trimEnd()}", declared old/new ${x.deletionCount}/${x.additionCount}, parsed old/new ${k}/${L}`);const R=de(x.additionStart,x.additionCount)+(L===0?0:1),H=de(x.deletionStart,x.deletionCount)+(k===0?0:1);if(!u){const N=R-x.additionStart,I=H-x.deletionStart;x.additionLineIndex+=N,x.deletionLineIndex+=I;for(const E of x.hunkContent)E.additionLineIndex+=N,E.deletionLineIndex+=I}x.additionStart=R,x.deletionStart=H,x.additionCount=L,x.deletionCount=k}x.additionLines=b,x.deletionLines=S,x.collapsedBefore=Math.max(de(x.additionStart,x.additionCount)-s,0),a.hunks.push(x),s=re(x.additionStart,x.additionCount);for(const R of x.hunkContent)R.type==="context"?(x.splitLineCount+=R.lines,x.unifiedLineCount+=R.lines):(x.splitLineCount+=Math.max(R.additions,R.deletions),x.unifiedLineCount+=R.deletions+R.additions);x.splitLineStart=a.splitLineCount+x.collapsedBefore,x.unifiedLineStart=a.unifiedLineCount+x.collapsedBefore,a.splitLineCount+=x.collapsedBefore+x.splitLineCount,a.unifiedLineCount+=x.collapsedBefore+x.unifiedLineCount}if(a!=null){if(o&&u&&!n&&a.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(a.hunks.length>0&&!u&&a.additionLines.length>0&&a.deletionLines.length>0){const f=a.hunks[a.hunks.length-1],h=re(f.additionStart,f.additionCount),g=a.additionLines.length,p=Math.max(g-h,0);a.splitLineCount+=p,a.unifiedLineCount+=p}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),Vl(a),a}}function Ci(e,t,n=!1){const i=[],r=Jl(e)?e.split(oo):[e];for(const o of r)try{i.push(Xl(o,t,n,t!=null?i.length:void 0))}catch(s){if(n)throw s;console.error(s)}finally{_r()}return i}function nt(e,t=!1){var r;const n=e.trim(),i=n.startsWith('"')?((r=_l(n))==null?void 0:r.fileName)??n:n;return t&&(i.startsWith("a/")||i.startsWith("b/"))?i.slice(2):i}function Jl(e){return e.startsWith("From ")||e.includes(`
|
|
149
|
+
From `)}function xi(e){const t=Wr(e);for(let n=0;n<t.length;n++)t[n]=K(t[n]);return t}function Wr(e){if(e.length===0)return[""];const t=[];let n=0;for(;;){const i=e.indexOf(`
|
|
150
|
+
`,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 Ql(e){return jr(e,"diff --git")}function ed(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=xn(e,i);if(r<=0&&o<=0){if(Br(e,i)){i>n&&t.push(e.slice(n,i)),n=i,s=!0,i=xn(e,l);continue}if(s&&e.startsWith("@@ -",i)){const u=Vr(e.slice(i,l));u!=null&&(r=u.deletionCount,o=u.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 td(e){return Br(e,0)}function Br(e,t){const n=xn(e,t);return ki(e,t,"---")&&ki(e,n,"+++")}function ki(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===`
|
|
151
|
+
`||o==="\r")break;if(o!==" "&&o!==" ")return!0}return!1}function xn(e,t){const n=e.indexOf(`
|
|
152
|
+
`,t);return n===-1?e.length:n+1}function nd(e){const t=e[0];return t==="+"||t==="-"||t===" "}function id(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){const n=e[t];if(n!==" "&&n!==" "&&n!==`
|
|
153
|
+
`&&n!=="\r")return!1}return!0}function Vr(e){if(!e.startsWith("@@ -"))return;let t=4;const n=bt(e,t);if(n==null)return;const i=n.value;t=n.endIndex;let r=1;if(e[t]===","){const d=bt(e,t+1);if(d==null)return;r=d.value,t=d.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;const o=bt(e,t);if(o==null)return;const s=o.value;t=o.endIndex;let l=1;if(e[t]===","){const d=bt(e,t+1);if(d==null)return;l=d.value,t=d.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let a;const u=t+3;return e[u]===" "&&(a=rd(e.slice(u+1))),{additionCount:l,additionStart:s,deletionCount:r,deletionStart:i,hunkContext:a}}function bt(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 rd(e){return e.endsWith(`\r
|
|
154
|
+
`)?e.slice(0,-2):e.endsWith(`
|
|
155
|
+
`)?e.slice(0,-1):e}function od(e){return e.startsWith("diff --git")||e.includes(`
|
|
156
|
+
diff --git`)}function jr(e,t){if(e.length===0)return[""];const n=`
|
|
157
|
+
${t}`,i=e.startsWith(t)?0:wi(e,n,0);if(i===-1)return[e];const r=[];i>0&&r.push(e.slice(0,i));let o=i;for(;;){const s=wi(e,n,o+1);if(s===-1)break;r.push(e.slice(o,s)),o=s}return r.push(e.slice(o)),r}function wi(e,t,n){const i=e.indexOf(t,n);return i===-1?-1:i+1}function Li(e){return e==null?e:K(e)}function sd(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function Zt(e){const t=e.slice(1);return K(t===""?`
|
|
158
|
+
`:t)}function Jt(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 _n{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=m=>{if(m=this.postProcess(m,i),r){setTimeout(function(){r(m)},0);return}else return m},l=n.length,a=t.length;let u=1,d=l+a;i.maxEditLength!=null&&(d=Math.min(d,i.maxEditLength));const c=(o=i.timeout)!==null&&o!==void 0?o:1/0,f=Date.now()+c,h=[{oldPos:-1,lastComponent:void 0}];let g=this.extractCommon(h[0],n,t,0,i);if(h[0].oldPos+1>=a&&g+1>=l)return s(this.buildValues(h[0].lastComponent,n,t));let p=-1/0,b=1/0;const S=()=>{for(let m=Math.max(p,-u);m<=Math.min(b,u);m+=2){let v;const C=h[m-1],y=h[m+1];C&&(h[m-1]=void 0);let x=!1;if(y){const k=y.oldPos-m;x=y&&0<=k&&k<l}const L=C&&C.oldPos+1<a;if(!x&&!L){h[m]=void 0;continue}if(!L||x&&C.oldPos<y.oldPos?v=this.addToPath(y,!0,!1,0,i):v=this.addToPath(C,!1,!0,1,i),g=this.extractCommon(v,n,t,m,i),v.oldPos+1>=a&&g+1>=l)return s(this.buildValues(v.lastComponent,n,t))||!0;h[m]=v,v.oldPos+1>=a&&(b=Math.min(b,m-1)),g+1>=l&&(p=Math.max(p,m+1))}u++};if(r)(function m(){setTimeout(function(){if(u>d||Date.now()>f)return r(void 0);S()||m()},0)})();else for(;u<=d&&Date.now()<=f;){const m=S();if(m)return m}}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,u=a-r,d=0;for(;u+1<s&&a+1<l&&this.equals(i[a+1],n[u+1],o);)u++,a++,d++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!o.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=a,u}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,u=0;for(;l<s;l++){const d=r[l];if(d.removed)d.value=this.join(i.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let c=n.slice(a,a+d.count);c=c.map(function(f,h){const g=i[u+h];return g.length>f.length?g:f}),d.value=this.join(c)}else d.value=this.join(n.slice(a,a+d.count));a+=d.count,d.added||(u+=d.count)}}return r}}class ad extends _n{}const ld=new ad;function dd(e,t,n){return ld.diff(e,t,n)}const Ei="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 ud extends _n{tokenize(t){const n=new RegExp(`(\\r?\\n)|[${Ei}]+|[^\\S\\n\\r]+|[^${Ei}]`,"ug");return t.match(n)||[]}}const cd=new ud;function hd(e,t,n){return cd.diff(e,t,n)}class fd extends _n{constructor(){super(...arguments),this.tokenize=pd}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
|
|
159
|
+
`))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
|
|
160
|
+
`))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
|
|
161
|
+
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
162
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,i)}}const gd=new fd;function Ri(e,t,n){return gd.diff(e,t,n)}function pd(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
163
|
+
`));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 md(e){for(let t=0;t<e.length;t++)if(e[t]<" "||e[t]>"~"||e[t]==='"'||e[t]==="\\")return!0;return!1}function He(e){if(!md(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 Ai={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Di(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:d}=l;Ri(n,i,Object.assign(Object.assign({},l),{callback:c=>{const f=u(c);d(f)}}))}else return u(Ri(n,i,l));function u(d){if(!d)return;d.push({value:"",lines:[]});function c(m){return m.map(function(v){return" "+v})}const f=[];let h=0,g=0,p=[],b=1,S=1;for(let m=0;m<d.length;m++){const v=d[m],C=v.lines||bd(v.value);if(v.lines=C,v.added||v.removed){if(!h){const y=d[m-1];h=b,g=S,y&&(p=a>0?c(y.lines.slice(-a)):[],h-=p.length,g-=p.length)}for(const y of C)p.push((v.added?"+":"-")+y);v.added?S+=C.length:b+=C.length}else{if(h)if(C.length<=a*2&&m<d.length-2)for(const y of c(C))p.push(y);else{const y=Math.min(C.length,a);for(const L of c(C.slice(0,y)))p.push(L);const x={oldStart:h,oldLines:b-h+y,newStart:g,newLines:S-g+y,lines:p};f.push(x),h=0,g=0,p=[]}b+=C.length,S+=C.length}}for(const m of f)for(let v=0;v<m.lines.length;v++)m.lines[v].endsWith(`
|
|
164
|
+
`)?m.lines[v]=m.lines[v].slice(0,-1):(m.lines.splice(v+1,0,"\"),v++);return{oldFileName:e,newFileName:t,oldHeader:r,newHeader:o,hunks:f}}}function kn(e,t){var n,i,r,o,s,l;if(t||(t=Ai),Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(d=>d.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return e.map(d=>kn(d,t)).join(`
|
|
165
|
+
`)}const a=[];if(e.isGit){if(t=Ai,!e.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!e.newFileName)throw new Error("newFileName must be specified for Git patches");let d=e.oldFileName,c=e.newFileName;e.isCreate&&d==="/dev/null"?d=c.replace(/^b\//,"a/"):e.isDelete&&c==="/dev/null"&&(c=d.replace(/^a\//,"b/")),a.push("diff --git "+He(d)+" "+He(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 "+He(((r=e.oldFileName)!==null&&r!==void 0?r:"").replace(/^a\//,""))),a.push("rename to "+He(((o=e.newFileName)!==null&&o!==void 0?o:"").replace(/^b\//,"")))),e.isCopy&&(a.push("copy from "+He(((s=e.oldFileName)!==null&&s!==void 0?s:"").replace(/^a\//,""))),a.push("copy to "+He(((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 u=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||u)&&(a.push("--- "+He(e.oldFileName)+(e.oldHeader?" "+e.oldHeader:"")),a.push("+++ "+He(e.newFileName)+(e.newHeader?" "+e.newHeader:"")));for(let d=0;d<e.hunks.length;d++){const c=e.hunks[d],f=c.oldLines===0?c.oldStart-1:c.oldStart,h=c.newLines===0?c.newStart-1:c.newStart;a.push("@@ -"+f+","+c.oldLines+" +"+h+","+c.newLines+" @@");for(const g of c.lines)a.push(g)}return a.join(`
|
|
166
|
+
`)+`
|
|
167
|
+
`}function vd(e,t,n,i,r,o,s){if(typeof s=="function"&&(s={callback:s}),s!=null&&s.callback){const{callback:l}=s;Di(e,t,n,i,r,o,Object.assign(Object.assign({},s),{callback:a=>{l(a?kn(a,s.headerOptions):void 0)}}))}else{const l=Di(e,t,n,i,r,o,s);return l?kn(l,s==null?void 0:s.headerOptions):void 0}}function bd(e){const t=e.endsWith(`
|
|
168
|
+
`),n=e.split(`
|
|
169
|
+
`).map(i=>i+`
|
|
170
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}const yd="/dev/null";function Ne(e,t,n,i=!1){if(e===null&&t===null)throw new Error("parseDiffFromFile: You must pass oldFile, newFile, or both");const r=e??Ti(),o=t??Ti(),s=vd(r.name,o.name,r.contents,o.contents,r.header,o.header,n),l=Zl(s,{cacheKey:(()=>{const u=e==null?void 0:e.cacheKey,d=t==null?void 0:t.cacheKey;return u!=null&&d!=null?zr("diff",u,d):void 0})(),oldFile:r,newFile:o,throwOnError:i});if(l==null)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");e===null?(l.type="new",l.prevName=void 0):t===null&&(l.type="deleted",l.prevName=void 0);const a=(t==null?void 0:t.lang)??(t===null?e==null?void 0:e.lang:void 0);return a!=null&&(l.lang=a),l}function Ti(){return{name:yd,contents:""}}var Sd=class{constructor(){w(this,"isDeletionsScrolling",!1);w(this,"isAdditionsScrolling",!1);w(this,"timeoutId",-1);w(this,"codeDeletions");w(this,"codeAdditions");w(this,"enabled",!1);w(this,"handleDeletionsScroll",()=>{var e,t;this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),(t=this.codeAdditions)==null||t.scrollTo({left:(e=this.codeDeletions)==null?void 0:e.scrollLeft}))});w(this,"handleAdditionsScroll",()=>{var e,t;this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),(t=this.codeDeletions)==null||t.scrollTo({left:(e=this.codeAdditions)==null?void 0:e.scrollLeft}))})}cleanUp(){var e,t;this.enabled&&((e=this.codeDeletions)==null||e.removeEventListener("scroll",this.handleDeletionsScroll),(t=this.codeAdditions)==null||t.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(e,t,n){var i,r;if(t==null||n==null)for(const o of e.children??[])o instanceof HTMLElement&&("deletions"in o.dataset?t=o:"additions"in o.dataset&&(n=o));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&((i=this.codeDeletions)==null||i.removeEventListener("scroll",this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener("scroll",this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&((r=this.codeAdditions)==null||r.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener("scroll",this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}};function xe(e,t){return Pn(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function yt(e){return z({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function St(e){return z({tagName:"div",children:[z({tagName:"span",children:[ve("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function Qt(e){return z({tagName:"div",children:[It({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 je({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(z({tagName:"div",children:[ve(t)],properties:{"data-separator-wrapper":""}})),(e==="line-info"||e==="line-info-basic")&&t!=null){const u=[];n!=null&&(i?(o||(u.push(Qt("up")),l++),s||(u.push(Qt("down")),l++)):(u.push(Qt(!o&&!s?"both":o?"down":"up")),l++)),u.push(z({tagName:"div",children:[z({tagName:"span",children:[ve(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),i&&n!=null&&u.push(z({tagName:"div",children:[ve("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),a.push(z({tagName:"div",children:u,properties:{"data-separator-wrapper":"","data-separator-multi-button":l>1?"":void 0}}))}return e==="custom"&&r!=null&&a.push(z({tagName:"slot",properties:{name:r}})),z({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 Cd(e,t){return`hunk-separator-${e}-${t}`}function xd(e){const t=e.at(-1);return t==null?0:Math.max(re(t.additionStart,t.additionCount),re(t.deletionStart,t.deletionCount))}function Nt({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 Ct({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 ut(e){return[de(e.additionStart,e.additionCount)+1,re(e.additionStart,e.additionCount)+1]}function Ae({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==null?void 0:n.get(i),l=Math.min(Math.max((s==null?void 0:s.fromStart)??0,0),o),a=Math.min(Math.max((s==null?void 0:s.fromEnd)??0,0),o),u=l+a,d=u>=o;return{fromStart:d?o:l,fromEnd:d?0:a,rangeSize:o,collapsedLines:Math.max(o-u,0),renderAll:d}}function kd(e){const t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;const n=e.additionLines.length-re(t.additionStart,t.additionCount),i=e.deletionLines.length-re(t.deletionStart,t.deletionCount);return n<=0&&i<=0?!1:n!==i}function Gr({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-re(n.additionStart,n.additionCount),r=e.deletionLines.length-re(n.deletionStart,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 De({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:i,errorPrefix:r}){if(t!==e.hunks.length-1)return;const o=Gr({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==null?void 0:n.get(e.hunks.length),l=Math.min(Math.max((s==null?void 0:s.fromStart)??0,0),o);return{fromStart:l,fromEnd:0,rangeSize:o,collapsedLines:o-l,renderAll:l>=o}}function qr({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:i}){if(n===!0||e.isPartial)return!0;for(const[l,a]of e.hunks.entries()){const[u,d]=ut(a);if(t<u){const c=Ae({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:l,collapsedContextThreshold:i}),f=u-c.rangeSize;return c.renderAll||t<f+c.fromStart||t>=u-c.fromEnd}if(t<d)return!0}const r=De({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:i,errorPrefix:"isAdditionLineRenderable"});if(r==null||r.renderAll)return!0;const o=e.hunks[e.hunks.length-1],[,s]=ut(o);return t<s+r.fromStart||t>=s+r.rangeSize}function wd({fileDiff:e,lineNumber:t,direction:n,expandedHunks:i,collapsedContextThreshold:r}){if(i===!0||e.isPartial)return t;const o=[];let s=1;for(const[a,u]of e.hunks.entries()){const[d,c]=ut(u),f=Ae({isPartial:e.isPartial,rangeSize:u.collapsedBefore,expandedHunks:i,hunkIndex:a,collapsedContextThreshold:r}),h=d-f.rangeSize;f.renderAll?o.push([h,d]):(f.fromStart>0&&o.push([h,h+f.fromStart]),f.fromEnd>0&&o.push([d-f.fromEnd,d])),o.push([d,c]),s=c}const l=De({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:i,collapsedContextThreshold:r,errorPrefix:"getNearestRenderableAdditionLine"});if(l!=null){const a=s;s=a+l.rangeSize,l.renderAll?o.push([a,s]):l.fromStart>0&&o.push([a,a+l.fromStart])}if(t>=s)return t;if(n==="down"){for(const[a,u]of o)if(u>t)return Math.max(a,t);return}for(let a=o.length-1;a>=0;a--){const[u,d]=o[a];if(u<=t)return Math.min(d-1,t)}}function Kr({type:e,metrics:t}){return t.hunkSeparatorHeight??Rl(e)}function Yr({type:e,metrics:t}){return e==="simple"||e==="metadata"||e==="line-info-basic"?0:t.spacing}function Ld({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 Ed(e){return e!=="simple"&&e!=="metadata"}function at({type:e,metrics:t,hunkIndex:n,hunkSpecs:i}){if(!Ld({type:e,hunkIndex:n,hunkSpecs:i}))return;const r=Kr({type:e,metrics:t}),o=Yr({type:e,metrics:t}),s=n>0?o:0,l=o;return{height:r,gapBefore:s,gapAfter:l,totalHeight:s+r+l}}function Oe({type:e,metrics:t}){if(!Ed(e))return;const n=Kr({type:e,metrics:t}),i=Yr({type:e,metrics:t});return{height:n,gapBefore:i,gapAfter:0,totalHeight:i+n}}function _e({diff:e,diffStyle:t,startingLine:n=0,totalLines:i=1/0,expandedHunks:r,collapsedContextThreshold:o=1,callback:s}){var u;const l=Rd({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,c=a.splitCount>=n+i;return t==="unified"?d:(t==="split"||d)&&c},shouldSkip(d,c){if(!a.isWindowedHighlight)return!1;const f=d>0&&a.unifiedCount+d<=n,h=c>0&&a.splitCount+c<=n;return t==="unified"?f:(t==="split"||f)&&h},incrementCounts(d,c){(t==="unified"||t==="both")&&(a.unifiedCount+=d),(t==="split"||t==="both")&&(a.splitCount+=c)},isInWindow(d,c){if(!a.isWindowedHighlight)return!0;const f=a.isInUnifiedWindow(d),h=a.isInSplitWindow(c);return t==="unified"?f:t==="split"?h:f||h},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,c=!1){return c||(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 v=function(E,T){return S==null||S.collapsedLines<=0||S.fromStart+S.fromEnd>0?0:t==="unified"?E===c.unifiedLineStart+c.unifiedLineCount-1?S.collapsedLines:0:T===c.splitLineStart+c.splitLineCount-1?S.collapsedLines:0},y=function(){return C?0:(C=!0,b.collapsedLines)};const c=e.hunks[d];if(c==null)throw new Error("iterateOverDiff: invalid hunk index");if(a.shouldBreak())break;const f=de(c.deletionStart,c.deletionCount),h=de(c.additionStart,c.additionCount),g=!e.isPartial&&c.deletionCount===0?f:c.deletionLineIndex,p=!e.isPartial&&c.additionCount===0?h:c.additionLineIndex,b=Ae({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:r,hunkIndex:d,collapsedContextThreshold:o}),S=d===a.finalHunkIndex?De({fileDiff:e,hunkIndex:d,expandedHunks:r,collapsedContextThreshold:o,errorPrefix:"iterateOverDiff"}):void 0,m=b.fromStart+b.fromEnd;let C=b.collapsedLines===0;if(a.shouldSkip(m,m))a.incrementCounts(m,m),y();else{let E=c.unifiedLineStart-b.rangeSize,T=c.splitLineStart-b.rangeSize,U=g-b.rangeSize,_=p-b.rangeSize,M=f+1-b.rangeSize,O=h+1-b.rangeSize;if(xt(a,b.fromStart,t,W=>a.emit({hunkIndex:d,hunk:c,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:M+W,lineIndex:U+W,noEOFCR:!1,unifiedLineIndex:E+W,splitLineIndex:T+W},additionLine:{unifiedLineIndex:E+W,splitLineIndex:T+W,lineIndex:_+W,lineNumber:O+W,noEOFCR:!1}}))||(E=c.unifiedLineStart-b.fromEnd,T=c.splitLineStart-b.fromEnd,U=g-b.fromEnd,_=p-b.fromEnd,M=f+1-b.fromEnd,O=h+1-b.fromEnd,xt(a,b.fromEnd,t,W=>a.emit({hunkIndex:d,hunk:c,collapsedBefore:y(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:M+W,lineIndex:U+W,noEOFCR:!1,unifiedLineIndex:E+W,splitLineIndex:T+W},additionLine:{unifiedLineIndex:E+W,splitLineIndex:T+W,lineIndex:_+W,lineNumber:O+W,noEOFCR:!1}}),()=>{y()})))break e}let x=c.unifiedLineStart,L=c.splitLineStart,k=g,R=p,H=f+1,N=h+1;const I=c.hunkContent.at(-1);for(const E of c.hunkContent){if(a.shouldBreak())break e;const T=E===I;if(E.type==="context"){if(a.shouldSkip(E.lines,E.lines))a.incrementCounts(E.lines,E.lines),y();else if(xt(a,E.lines,t,U=>{const _=T&&U===E.lines-1,M=x+U,O=L+U;return a.emit({hunkIndex:d,hunk:c,collapsedBefore:y(),collapsedAfter:v(M,O),type:"context",deletionLine:{lineNumber:H+U,lineIndex:k+U,noEOFCR:_&&c.noEOFCRDeletions,unifiedLineIndex:M,splitLineIndex:O},additionLine:{unifiedLineIndex:M,splitLineIndex:O,lineIndex:R+U,lineNumber:N+U,noEOFCR:_&&c.noEOFCRAdditions}})},()=>{y()}))break e;x+=E.lines,L+=E.lines,k+=E.lines,R+=E.lines,H+=E.lines,N+=E.lines}else{const U=Math.max(E.deletions,E.additions),_=E.deletions+E.additions;if(!a.shouldSkip(_,U)){const M=Td(a,E,t);(((u=M[0])==null?void 0:u[0])??0)>0&&y();for(const[O,W]of M)for(let Z=O;Z<W;Z++){const F=v(x+Z,t==="unified"?L+(Z<E.deletions?Z:Z-E.deletions):L+Z);if(a.emit(Hd({hunkIndex:d,hunk:c,collapsedBefore:y(),collapsedAfter:F,diffStyle:t,index:Z,unifiedLineIndex:x,splitLineIndex:L,additionLineIndex:R,deletionLineIndex:k,additionLineNumber:N,deletionLineNumber:H,content:E,isLastContent:T,unifiedCount:_,splitCount:U}),!0))break e}}y(),a.incrementCounts(_,U),x+=_,L+=U,k+=E.deletions,R+=E.additions,H+=E.deletions,N+=E.additions}}if(S!=null){const{collapsedLines:E,fromStart:T,fromEnd:U}=S,_=T+U;if(xt(a,_,t,M=>{const O=M===_-1;return a.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:O?E:0,type:"context-expanded",deletionLine:{lineNumber:H+M,lineIndex:k+M,noEOFCR:!1,unifiedLineIndex:x+M,splitLineIndex:L+M},additionLine:{unifiedLineIndex:x+M,splitLineIndex:L+M,lineIndex:R+M,lineNumber:N+M,noEOFCR:!1}})},void 0,()=>a.shouldBreak()))break e}}}function Rd({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:r}){if(n<=0||t==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const o=Ad({diff:e,expandedHunks:i,collapsedContextThreshold:r});let s=0,l=e.hunks.length-1,a=e.hunks.length;for(;s<=l;){const d=s+l>>1,c=o[d+1];if(c==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(t==="unified"?c.unifiedCount:c.splitCount)>n?(a=d,l=d-1):s=d+1}if(a>=e.hunks.length){const d=o[e.hunks.length];if(d==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:e.hunks.length,splitCount:d.splitCount,unifiedCount:d.unifiedCount}}const u=o[a];if(u==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:a,splitCount:u.splitCount,unifiedCount:u.unifiedCount}}function Ad({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 u=Ae({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:l,collapsedContextThreshold:n}),d=u.fromStart+u.fromEnd;i+=d+a.splitLineCount,r+=d+a.unifiedLineCount;const c=l===o?De({fileDiff:e,hunkIndex:l,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:"iterateOverDiff"}):void 0;if(c!=null){const f=c.fromStart+c.fromEnd;i+=f,r+=f}s.push({splitCount:i,unifiedCount:r})}return s}function Dd(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];const i=[];function r(l){const a=Math.max(0,e.viewportStart-l),u=Math.min(t,e.viewportEnd-l);u>a&&i.push([a,u])}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 xt(e,t,n,i,r,o){const[s,l]=Dd(e,t,n);s>0&&(e.incrementCounts(s,s),r==null||r());let a=s;for(;a<t;){if((o==null?void 0: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 Td(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,f){if(c+f<=e.viewportStart||c>=e.viewportEnd)return;const h=Math.max(0,e.viewportStart-c),g=Math.min(f,e.viewportEnd-c);return g>h?[h,g]:void 0}function a(c,f){return o==="split"?c:f==="additions"?[c[0]+t.deletions,c[1]+t.deletions]:c}function u(c,f){if(c==null)return;const[h,g]=a(c,f);g>h&&s.push([h,g])}if(i&&(u(l(e.unifiedCount,t.deletions),"deletions"),u(l(e.unifiedCount+t.deletions,t.additions),"additions")),r&&(u(l(e.splitCount,t.deletions),"deletions"),u(l(e.splitCount,t.additions),"additions")),s.length===0)return s;s.sort((c,f)=>c[0]-f[0]);const d=[s[0]];for(const[c,f]of s.slice(1)){const h=d[d.length-1];c<=h[1]?h[1]=Math.max(h[1],f):d.push([c,f])}return d}function Hd({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,diffStyle:r,index:o,unifiedLineIndex:s,splitLineIndex:l,additionLineIndex:a,deletionLineIndex:u,additionLineNumber:d,deletionLineNumber:c,content:f,isLastContent:h,unifiedCount:g,splitCount:p}){const b=o<f.deletions?s+o:void 0,S=r==="unified"?o>=f.deletions?s+o:void 0:o<f.additions?s+f.deletions+o:void 0,m=r==="unified"?l+(o<f.deletions?o:o-f.deletions):l+o,v=o<f.deletions?u+o:void 0,C=o<f.deletions?c+o:void 0,y=r==="unified"?o>=f.deletions?a+(o-f.deletions):void 0:o<f.additions?a+o:void 0,x=r==="unified"?o>=f.deletions?d+(o-f.deletions):void 0:o<f.additions?d+o:void 0,L=r==="unified"?h&&o===f.deletions-1&&t.noEOFCRDeletions:h&&o===p-1&&t.noEOFCRDeletions,k=r==="unified"?h&&o===g-1&&t.noEOFCRAdditions:h&&o===p-1&&t.noEOFCRAdditions,R=v!=null&&C!=null&&b!=null?{lineNumber:C,lineIndex:v,noEOFCR:L,unifiedLineIndex:b,splitLineIndex:m}:void 0,H=y!=null&&x!=null&&S!=null?{unifiedLineIndex:S,splitLineIndex:m,lineIndex:y,lineNumber:x,noEOFCR:k}:void 0;if(R==null&&H!=null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:void 0,additionLine:H};if(R!=null&&H==null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:R,additionLine:void 0};if(R==null||H==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:R,additionLine:H}}const Md={forcePlainText:!1};function Id(e,t,n,{forcePlainText:i,lazyLineAST:r=!1,startingLine:o,totalLines:s,expandedHunks:l,collapsedContextThreshold:a=1}=Md){i?(o??(o=0),s??(s=1/0)):(o=0,s=1/0);const u=o>0||s<1/0;r&&(r=!i&&!n.useTokenTransformer);const d=typeof n.theme=="string"?t.getTheme(n.theme).type:void 0,c=_a({theme:n.theme,highlighter:t}),f=i&&!u&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,h={deletionLines:[],additionLines:[]},{maxLineDiffLength:g}=n,p=!i&&!e.isPartial,b=i?l:void 0,S=new Map;function m(C){const y=p?0:C,x=S.get(y)??Fd();return S.set(y,x),x}function v(C,y,x,L){if(u){let k=x.at(-1);(k==null||k.targetIndex+k.count!==y)&&(k={targetIndex:y,originalOffset:L.length,count:0},x.push(k)),k.count++}L.push(C)}_e({diff:e,diffStyle:"both",startingLine:o,totalLines:s,expandedHunks:u?b:!0,collapsedContextThreshold:a,callback:({hunkIndex:C,additionLine:y,deletionLine:x,type:L})=>{const k=m(C),R=y!=null?y.splitLineIndex:x.splitLineIndex;L==="change"&&y!=null&&x!=null&&Nd({additionLine:e.additionLines[y.lineIndex],deletionLine:e.deletionLines[x.lineIndex],deletionLineIndex:k.deletionContent.length,additionLineIndex:k.additionContent.length,deletionDecorations:k.deletionDecorations,additionDecorations:k.additionDecorations,lineDiffType:f,maxLineDiffLength:g}),x!=null&&(v(e.deletionLines[x.lineIndex],x.lineIndex,k.deletionSegments,k.deletionContent),k.deletionInfo.push({type:L==="change"?"change-deletion":L,lineNumber:x.lineNumber,altLineNumber:L==="change"?void 0:y.lineNumber??void 0,lineIndex:`${x.unifiedLineIndex},${R}`})),y!=null&&(v(e.additionLines[y.lineIndex],y.lineIndex,k.additionSegments,k.additionContent),k.additionInfo.push({type:L==="change"?"change-addition":L,lineNumber:y.lineNumber,altLineNumber:L==="change"?void 0:x.lineNumber??void 0,lineIndex:`${y.unifiedLineIndex},${R}`}))}});for(const C of S.values()){if(C.deletionContent.length===0&&C.additionContent.length===0)continue;const y={name:e.prevName??e.name,contents:C.deletionContent.value},x={name:e.name,contents:C.additionContent.value},{deletionLines:L,additionLines:k}=Od({deletionFile:y,deletionInfo:C.deletionInfo,deletionDecorations:C.deletionDecorations,additionFile:x,additionInfo:C.additionInfo,additionDecorations:C.additionDecorations,highlighter:t,options:n,languageOverride:i?"text":e.lang,lazyLineAST:r});if(p){h.deletionLines=L,h.additionLines=k;continue}for(const[R,H,N]of[[h.deletionLines,L,C.deletionSegments],[h.additionLines,k,C.additionSegments]])if(N.length>0)for(const I of N)for(let E=0;E<I.count;E++)R[I.targetIndex+E]=H[I.originalOffset+E];else if(r){const I=R.length;for(let E=0;E<H.length;E++)Er(R,I+E,()=>H[E])}else qa(R,H)}return{code:h,themeStyles:c,baseThemeType:d}}function Pd(e,{deletionLineIndex:t,additionLineIndex:n,deletionDecorations:i,additionDecorations:r}){let o=0,s=0,l=-1,a=0,u=-1,d=0;for(const{value:c,added:f,removed:h}of e)h?(l===-1&&(l=o),o+=c.length,a=o):f?(u===-1&&(u=s),s+=c.length,d=s):(o+=c.length,s+=c.length);l!==-1&&i.push(Nt({line:t,spanStart:l,spanLength:a-l})),u!==-1&&r.push(Nt({line:n,spanStart:u,spanLength:d-u}))}function Nd({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:i,deletionDecorations:r,additionDecorations:o,lineDiffType:s,maxLineDiffLength:l}){if(e==null||t==null||s==="none"||(e=Re(e),t=Re(t),e.length>l||t.length>l))return;const a=s==="char"?dd(e,t):hd(e,t);if(s==="word-line"){Pd(a,{deletionLineIndex:n,additionLineIndex:i,deletionDecorations:r,additionDecorations:o});return}const u=[],d=[],c=s==="word-alt",f=a.at(-1);for(const g of a){const p=g===f;!g.added&&!g.removed?(Ct({item:g,arr:u,enableJoin:c,isNeutral:!0,isLastItem:p}),Ct({item:g,arr:d,enableJoin:c,isNeutral:!0,isLastItem:p})):g.removed?Ct({item:g,arr:u,enableJoin:c,isLastItem:p}):Ct({item:g,arr:d,enableJoin:c,isLastItem:p})}let h=0;for(const g of u)g[0]===1&&r.push(Nt({line:n,spanStart:h,spanLength:g[1].length})),h+=g[1].length;h=0;for(const g of d)g[0]===1&&o.push(Nt({line:i,spanStart:h,spanLength:g[1].length})),h+=g[1].length}function Fd(){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 Od({lazyLineAST:e,deletionFile:t,additionFile:n,deletionInfo:i,additionInfo:r,highlighter:o,deletionDecorations:s,additionDecorations:l,languageOverride:a,options:{theme:u,useTokenTransformer:d,tokenizeMaxLineLength:c}}){const f=(h,g,p)=>h.contents===""?[]:Va(o.codeToTokens(Re(h.contents),Ka(a??Ee(h.name),u,c)).tokens,{state:{lineInfo:g},useTokenTransformer:d,decorations:p,lazyLineAST:e,cacheHtmlStyles:o.name==="highlights"});return{deletionLines:f(t,i,s),additionLines:f(n,r,l)}}function we(e,t){const n=Ne({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,additionCharacterCount:n.additionCharacterCount,deletionCharacterCount:n.deletionCharacterCount,type:n.type}}function zd(e,t){const n=Math.max(e,1);let i=Array.from({length:n},(r,o)=>`${" ".repeat(o+1)}
|
|
171
|
+
`).join("");return i===t&&(i=Array.from({length:n},(r,o)=>`\0${" ".repeat(o)}
|
|
172
|
+
`).join("")),i}function Ud(e){for(const t of e)if(t.trim().length>0)return!1;return!0}function wn(e,t){return t.length>0&&t.length<e.deletionLines.length&&Ud(t)}function Ft(e,t,n,i){const r=e.deletionLines.join(""),o=zd(t.length,r),s=Ne({name:e.prevName??e.name,contents:r},{name:e.name,contents:o,lang:e.lang},i);return{hunks:s.hunks,splitLineCount:s.splitLineCount,unifiedLineCount:s.unifiedLineCount,additionLines:t,deletionLines:s.deletionLines,additionCharacterCount:n,deletionCharacterCount:s.deletionCharacterCount,type:s.type}}function Tt(e,t){return Ft(e,[""],0,t)}function Xr(e,t){if(e.additionLines.length===0)return Tt(e,t);if(wn(e,e.additionLines))return Ft(e,e.additionLines,e.additionCharacterCount,t);const n=e.additionLines,i=we(e,t);return Zr(i,n),i}function _d(e){return e.length>1&&e.at(-1)===""}function Zr(e,t){if(!_d(t))return;const n=t.length-e.additionLines.length;if(n<=0)return;const i=e.additionLines.length,r=e.hunks.at(-1);if(r!=null&&re(r.additionStart,r.additionCount)===i){for(const o of r.hunkContent)if(o.type==="change"&&o.additions<o.deletions&&o.additionLineIndex+o.additions===i){e.additionLines=t,o.additions+=n,r.additionCount+=n,r.additionLines+=n,zt(e);return}}}function $d(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return ke(e,we(e,n));const i=Array.from(t);if(i.length===0)return ke(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(const o of i){const s=e.additionLines[o],l=e.deletionLines[o];if(s==null||l==null||Re(s)===Re(l))return ke(e,we(e,n))}const r=Wd(e,i);if(r.size===0)return ke(e,we(e,n));for(const o of r)if(!Vd(e,o,n))return ke(e,we(e,n));return zt(e),kd(e)?ke(e,we(e,n)):ke(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function ke(e,t){return Object.assign(e,t),t}function Wd(e,t){const n=new Set;for(const i of t){const r=Bd(e,i);if(r==null)return new Set;n.add(r)}return n}function Bd(e,t){for(const[n,i]of e.hunks.entries()){const r=i.additionLineIndex+i.additionCount;if(t>=i.additionLineIndex&&t<r)return n}}function Vd(e,t,n){const i=e.hunks[t];if(i==null)return!1;const r=e.deletionLines.slice(i.deletionLineIndex,i.deletionLineIndex+i.deletionCount),o=e.additionLines.slice(i.additionLineIndex,i.additionLineIndex+i.additionCount),s=Ne({name:e.prevName??e.name,contents:r.join("")},{name:e.name,contents:o.join(""),lang:e.lang},{...n,context:0}),l=s.hunks[0];return l==null||s.hunks.length!==1?!1:(jd(i,l),Jr(e,t),!0)}function Jr(e,t){const n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}const i=e.additionLines.at(-1),r=e.deletionLines.at(-1);n.noEOFCRAdditions=i!=null&&i!==""&&!i.endsWith(`
|
|
173
|
+
`),n.noEOFCRDeletions=r!=null&&r!==""&&!r.endsWith(`
|
|
174
|
+
`)}function jd(e,t){const n=e.additionLineIndex,i=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(r=>Qr(r,n,i)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart=e.additionStart+t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=i+t.deletionLineIndex,e.deletionStart=e.deletionStart+t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,$n(e)}function Qr(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function $n(e){let t=0,n=0;for(const i of e.hunkContent)i.type==="context"?(t+=i.lines,n+=i.lines):(t+=Math.max(i.additions,i.deletions),n+=i.additions+i.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function zt(e){let t=0,n=0,i=0;for(const r of e.hunks)r.collapsedBefore=Math.max(de(r.additionStart,r.additionCount)-i,0),r.splitLineStart=t+r.collapsedBefore,r.unifiedLineStart=n+r.collapsedBefore,$n(r),t+=r.collapsedBefore+r.splitLineCount,n+=r.collapsedBefore+r.unifiedLineCount,i=re(r.additionStart,r.additionCount);if(e.hunks.length>0){const r=e.hunks[e.hunks.length-1],o=Math.max(e.additionLines.length-re(r.additionStart,r.additionCount),0);t+=o,n+=o}e.splitLineCount=t,e.unifiedLineCount=n}const Hi=new WeakMap;function Gd(e){return e.length>1&&e[e.length-1]===""?e.slice(0,-1):e}function qd(e,t){const n=Math.min(e.length,t.length);let i=0;for(;i<n&&e[i]===t[i];)i++;let r=e.length,o=t.length;for(;r>i&&o>i&&e[r-1]===t[o-1];)r--,o--;if(!(i===r&&i===o))return{start:i,deletionEnd:r,additionEnd:o}}function Ln(e,t,n){const i=e.hunks,r=e.additionLines,o=Gd(r),s=o===r?e:{...e,additionLines:o},l=iu(i,tu(s,t,n),e.deletionLines.length),a=su(s,l);if(e.additionLines=o,e.hunks=a,e.editSessionDirty=!0,uu(e),Zr(e,r),!!lu(i,e.hunks))return{regions:l.map(u=>u.previousSpan)}}function Kd(e,t,n,i){const r=new Set(t),o=Array.from(r).filter(d=>d>=0&&d<e.additionLines.length).sort((d,c)=>d-c);if(o.length===0)return;const s=d=>r.has(d)?i==null?void 0:i.get(d):e.additionLines[d],{hunks:l}=e;let a,u=0;for(const d of o){for(;u<l.length;){const h=l[u];if(d<Ot(h)+h.additionCount)break;u++}const c=l[u],f=c==null?void 0:Ot(c);if(f==null||d<f||a!=null&&a!==u)return Ln(e,n,s);a=u}if(a!=null){if(Yd(e,o,a,i,n)){e.editSessionDirty=!0;return}return Ln(e,n,s)}}function Yd(e,t,n,i,r){if(i==null||(r==null?void 0:r.ignoreWhitespace)===!0||(r==null?void 0:r.stripTrailingCr)===!0)return!1;const o=Xd(e),s=e.hunks[n];if(s.hunkContent.some(Zd))return!1;for(const l of t){const a=i.get(l),u=e.additionLines[l];if(a==null||u==null||o.has(a)||o.has(u))return!1;let d=!1;for(const c of s.hunkContent)if(c.type==="change"&&c.additions===c.deletions&&l>=c.additionLineIndex&&l<c.additionLineIndex+c.additions){d=!0;break}if(!d)return!1}return!0}function Xd(e){const t=Hi.get(e);if((t==null?void 0:t.lines)===e.deletionLines)return t.set;const n=new Set(e.deletionLines);return Hi.set(e,{lines:e.deletionLines,set:n}),n}function Zd(e){return(e==null?void 0:e.type)==="change"&&(e.additions===0||e.deletions===0)}function Jd(e,t){const n=new Map,{regions:i}=t;for(let r=0;r<=i.length;r++){const o=i[r-1],s=i[r],l=r===0?e.get(0):o==null?void 0:e.get(o.lastIndex+1),a=s==null?void 0:e.get(s.firstIndex),u=(l==null?void 0:l.fromStart)??0,d=(a==null?void 0:a.fromEnd)??0;(u>0||d>0)&&n.set(r,{fromStart:u,fromEnd:d})}return n}function Qd(e,t,n){const i=[];if(e.isPartial)return i;for(const[o,s]of e.hunks.entries()){const l=Ae({isPartial:e.isPartial,rangeSize:s.collapsedBefore,expandedHunks:t,hunkIndex:o,collapsedContextThreshold:n});if(l.rangeSize<=n)continue;const a=$e(s),u=a-l.rangeSize;l.fromStart>0&&i.push([u,u+l.fromStart]),l.fromEnd>0&&i.push([a-l.fromEnd,a])}const r=De({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:"captureExpansionAnchors"});if(r!=null&&r.fromStart>0&&r.rangeSize>n){const o=e.hunks[e.hunks.length-1],s=$e(o)+o.deletionCount;i.push([s,s+r.fromStart])}return i}function eu(e,t){const n=new Map;if(t.length===0)return n;const i=(o,s,l)=>{if(l<=s)return;let a=0,u=0;for(const[d,c]of t)c<=s||d>=l||(d<=s&&(a=Math.max(a,Math.min(c,l)-s)),c>=l&&(u=Math.max(u,l-Math.max(d,s))));(a>0||u>0)&&n.set(o,{fromStart:a,fromEnd:u})};for(const[o,s]of e.hunks.entries()){const l=$e(s);i(o,l-Math.max(s.collapsedBefore,0),l)}const r=e.hunks[e.hunks.length-1];return r!=null&&!e.isPartial&&e.deletionLines.length>0&&i(e.hunks.length,$e(r)+r.deletionCount,e.deletionLines.length),n}function Mi(e,t){return e.editSessionDirty!==!0?!1:(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join("")===""?we(e,t):Xr(e,t)),!0)}function tu(e,t,n){if(qd(e.deletionLines,e.additionLines)==null)return[];const i=Ne({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t);let r;const o=(u,d)=>{r??(r=nu(e.hunks));for(let c=0;c<=d;c++){const f=r.get(u.deletionLineIndex-c);if(!(f==null||f.additions!==u.additions||f.deletions!==u.deletions)){if(u.additions>0&&n!=null){for(let h=0;h<u.additions;h++)if(n(f.additionLineIndex+h)!==i.additionLines[u.additionLineIndex+h])return d}return c}}return d},s=[];let l=0,a=0;for(const u of i.hunks){jl(u,i,o);const d=u.additionCount>0?u.additionLineIndex-l:u.deletionLineIndex-a;l+=d,a+=d;for(const c of u.hunkContent){if(c.type==="context"){l+=c.lines,a+=c.lines;continue}const f=Qr(c,0,0);f.additions===0&&(f.additionLineIndex=l),f.deletions===0&&(f.deletionLineIndex=a),s.push(f),l+=f.additions,a+=f.deletions}}return s}function nu(e){const t=new Map;for(const n of e)for(const i of n.hunkContent)i.type==="change"&&(i.additions===0||i.deletions===0)&&t.set(i.deletionLineIndex,i);return t}function iu(e,t,n){var s,l;const i=e.map((a,u)=>{const d=$e(a);return{deletionStart:d,deletionEnd:d+a.deletionCount,blocks:[],previousSpan:{firstIndex:u,lastIndex:u}}}),r=[];let o=0;for(const a of t){const u=a.deletionLineIndex,d=u+a.deletions;for(;o<i.length&&i[o].deletionEnd<u;)r.push(i[o]),o++;let c=r.length>0&&ru(u,d,r[r.length-1])?r.pop():void 0;for(;o<i.length&&i[o].deletionStart<=d;)c=ou(c,i[o]),o++;if(c==null){let f=u,h=d;if((a.deletions===0||a.additions===0)&&n>a.deletions){const g=((s=r[r.length-1])==null?void 0:s.deletionEnd)??0,p=((l=i[o])==null?void 0:l.deletionStart)??n;u>g?f--:d<p&&h++}c={deletionStart:f,deletionEnd:h,blocks:[],previousSpan:void 0}}c.deletionStart=Math.min(c.deletionStart,u),c.deletionEnd=Math.max(c.deletionEnd,d),c.blocks.push(a),r.push(c)}for(;o<i.length;)r.push(i[o]),o++;return r}function ru(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function ou(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??(e.previousSpan={...t.previousSpan}),e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function su(e,t){const n=[];let i=0,r=0;for(const o of t){const s=o.deletionStart-i;if(s<0)throw new Error("buildRegionHunks: overlapping old-side regions");i+=s,r+=s;const l=r,a=[];for(const d of o.blocks){const c=d.deletionLineIndex-i,f=d.additionLineIndex-r;if(c<0||c!==f)throw new Error("buildRegionHunks: canonical block context mismatch");Ii(a,c,r,i),i+=c,r+=f,a.push({...d}),i+=d.deletions,r+=d.additions}const u=o.deletionEnd-i;if(u<0)throw new Error("buildRegionHunks: block exceeds its old-side region");Ii(a,u,r,i),i+=u,r+=u,n.push(au(e,{additionStart:l,additionEnd:r,deletionStart:o.deletionStart,deletionEnd:o.deletionEnd},a))}if(e.deletionLines.length-i!==e.additionLines.length-r)throw new Error("buildRegionHunks: trailing context mismatch");return n}function au(e,t,n){const i=t.additionEnd-t.additionStart,r=t.deletionEnd-t.deletionStart;let o=0,s=0;for(const a of n)a.type==="change"&&(o+=a.additions,s+=a.deletions);const l={collapsedBefore:0,additionStart:kt(t.additionStart,i),additionCount:i,additionLines:o,additionLineIndex:Ni(t.additionStart,i),deletionStart:kt(t.deletionStart,r),deletionCount:r,deletionLines:s,deletionLineIndex:Ni(t.deletionStart,r),hunkContent:n,hunkSpecs:`@@ -${kt(t.deletionStart,r)},${r} +${kt(t.additionStart,i)},${i} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return $n(l),l}function Ii(e,t,n,i){t>0&&e.push({type:"context",lines:t,additionLineIndex:n,deletionLineIndex:i})}function lu(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){const i=e[n],r=t[n];if($e(i)!==$e(r)||i.deletionCount!==r.deletionCount||Ot(i)!==Ot(r)||i.additionCount!==r.additionCount||i.splitLineCount!==r.splitLineCount||!du(i,r))return!0}return!1}function du(e,t){const n=Pi(e),i=Pi(t);for(;;){const r=n.next(),o=i.next();if(r.done===!0||o.done===!0)return r.done===o.done;if(r.value[0]!==o.value[0]||r.value[1]!==o.value[1])return!1}}function*Pi(e){for(const t of e.hunkContent){if(t.type==="context"){for(let i=0;i<t.lines;i++)yield[t.deletionLineIndex+i,t.additionLineIndex+i];continue}const n=Math.max(t.deletions,t.additions);for(let i=0;i<n;i++)yield[i<t.deletions?t.deletionLineIndex+i:void 0,i<t.additions?t.additionLineIndex+i:void 0]}}function Ot(e){return de(e.additionStart,e.additionCount)}function $e(e){return de(e.deletionStart,e.deletionCount)}function kt(e,t){return t===0?e:e+1}function Ni(e,t){return t===0?e-1:e}function uu(e){zt(e);for(let t=0;t<e.hunks.length;t++)Jr(e,t)}function lt(e){const t=e.lang??Ee(e.name),n=e.lang??(e.prevName!=null?Ee(e.prevName):"text");return t==="text"&&n==="text"}let cu=-1;var hu=class{constructor(e={theme:Le},t=ze,n,i){w(this,"options");w(this,"annotationSlotName");w(this,"onRenderUpdate");w(this,"workerManager");w(this,"__id",`diff-hunks-renderer:${++cu}`);w(this,"diff");w(this,"expandedHunks",new Map);w(this,"deletionAnnotations",{});w(this,"additionAnnotations",{});w(this,"computedLangs",["text"]);w(this,"renderCache");w(this,"pendingHighlightResult");w(this,"pendingStructuralRows");w(this,"editSessionActive",!1);w(this,"createAnnotationElement",e=>La(e));this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=i}cleanUp(){this.endEditSession(),this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){var e;this.diff=void 0,this.editSessionActive?(this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0):this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},(e=this.workerManager)==null||e.cleanUpTasks(this)}beginEditSession(e,t){const{editSessionActive:n}=this;this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,n&&this.renderCache!=null&&this.renderCache.diff!==e&&this.clearRenderCache();const{renderCache:i}=this;if(!e.isPartial&&e.additionLines.length===0){Object.assign(e,Tt(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(i==null||n&&i.diff===e)return;const{options:r}=this.getRenderOptions(e),o=i.diff===e,s=t!=null&&j(i.diff,t),{result:l}=i;if(!i.highlighted||l==null||!xe(i.options,r)||!o&&!s){this.clearRenderCache();return}o||(this.renderCache={diff:e,options:r,highlighted:!0,result:{...l,code:{...l.code,additionLines:[...l.code.additionLines]}},renderRange:i.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff==null&&this.clearRenderCache()}editorRenderReady(){var e;return((e=this.renderCache)==null?void 0:e.options.useTokenTransformer)===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){const{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!j(t.diff,e)||lt(e)||it(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&(n==null?void 0:n.isWorkingPool())===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(i=>{Ir(i)||this.onHighlightError(i)})):this.asyncHighlight(e).then(i=>this.applyRefreshedResult(e,i)).catch(i=>this.onHighlightError(i))}applyRefreshedResult(e,t){var o;const{diff:n,renderCache:i}=this;if(t==null||n==null||i==null||!j(n,e)||!j(i.diff,e)||this.editSessionActive)return;const{options:r}=this.getRenderOptions(n);xe(r,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},(o=this.onRenderUpdate)==null||o.call(this))}get diffCache(){var e;return((e=this.renderCache)==null?void 0:e.diff)??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){var r;const i={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t==="up"||t==="both")&&(i.fromStart+=n),(t==="down"||t==="both")&&(i.fromEnd+=n),((r=this.renderCache)==null?void 0:r.highlighted)!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,i)}getExpandedHunk(e){return this.expandedHunks.get(e)??po}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}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)}}updateRenderCache(e,t,n=!1,i,r){var h;this.pendingStructuralRows=void 0;const{renderCache:o}=this;if(o==null)return!1;const{result:s,diff:l}=o;if(s==null)return!1;if(l.isPartial)throw new Error("Could not update render cache for partial diff");const a=s.code.additionLines,u=this.pendingStructuralRows=n?new Map:void 0,d=[],c=new Map;if(u==null&&i!=null){const g=l.additionLines.length,p=mu(l.additionLines,r);for(const[b,S]of i){if(b<0||b>g||b===g&&(S===""||!p))continue;const m=l.additionLines[b]??"";m!==S&&(l.additionLines[b]=S,l.additionCharacterCount+=S.length-m.length,d.push(b),c.set(b,m),e.has(b)||(a[b]=Ht(b,Re(S))))}}for(const[g,p]of e){const b=((h=a[g])==null?void 0:h.properties)??{},S=p.map(x=>x[2]).join(""),m=g<l.additionLines.length,v=m?l.additionLines[g]??"":"",C=Re(v);if(u==null&&m&&(i==null?void 0:i.has(g))!==!0){const x=Za(v,S);l.additionLines[g]=x,l.additionCharacterCount+=x.length-v.length,C!==S&&(d.push(g),c.set(g,v))}const y={type:"element",tagName:"div",properties:{"data-line":b["data-line"]??g+1,"data-line-index":b["data-line-index"]??g,"data-line-type":b["data-line-type"]??"context"},children:p.map(([x,L,k])=>x===0&&L===""?k===""?{type:"element",tagName:"br",properties:{},children:[]}:{type:"text",value:k}:{type:"element",tagName:"span",properties:{"data-char":x,style:`color:${L};`},children:[{type:"text",value:k}]})};u!=null?u.set(g,y):a[g]=y}let f=!1;if(d.length>0)if(this.editSessionActive)if(l.additionLines.length<=1&&l.additionLines.join("")==="")this.applyRecomputePreservingSessionType(l,Tt(l,this.options.parseDiffOptions)),f=!0;else if(wn(l,l.additionLines))this.applyRecomputePreservingSessionType(l,Ft(l,l.additionLines,l.additionCharacterCount,this.options.parseDiffOptions)),f=!0;else{const g=Kd(l,d,this.options.parseDiffOptions,c);this.applyExpansionRemap(g),f=g!=null}else Object.assign(l,$d(l,d,this.options.parseDiffOptions));return s.baseThemeType=t,o.isDirty=!0,f}applyExpansionRemap(e){e!=null&&(this.expandedHunks=Jd(this.expandedHunks,e))}applyDocumentChange(e){const{pendingStructuralRows:t,renderCache:n}=this;this.pendingStructuralRows=void 0;const i=this.diff??(n==null?void 0:n.diff);if(i==null)return;const r=n==null?void 0:n.result;if(i.isPartial)throw new Error("Could not apply document change for partial diff");const{additionLines:o}=i,{lines:s,characterCount:l}=vu(e);if(i.additionLines=s,i.additionCharacterCount=l,r!=null&&(r.code.additionLines=pu(o,i.additionLines,r.code.additionLines,e)),i.additionLines.length<=1&&i.additionLines.join("")===""?(this.applyRecomputePreservingSessionType(i,Tt(i,this.options.parseDiffOptions)),r!=null&&(r.code.additionLines[0]=Ht(0,e.getLineText(0)))):this.editSessionActive?this.applySessionDocumentChange(i,o):Object.assign(i,Xr(i,this.options.parseDiffOptions)),t!=null&&r!=null)for(const[a,u]of t)a<r.code.additionLines.length&&(r.code.additionLines[a]=u);n!=null&&(n.isDirty=!0)}applySessionDocumentChange(e,t){const{parseDiffOptions:n}=this.options,i=e.additionLines;if(wn(e,i)){this.applyRecomputePreservingSessionType(e,Ft(e,i,e.additionCharacterCount,n));return}this.applyExpansionRemap(Ln(e,n,r=>t[r]))}applyRecomputePreservingSessionType(e,t){const n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){const n=t==="change"?e==="deletions"?"change-deletion":"change-addition":t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}getOptionsWithDefaults(){var y;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:u=100,hunkSeparators:d="line-info",lineDiffType:c="word-alt",maxLineDiffLength:f=1e3,overflow:h="scroll",stickyHeader:g=!1,theme:p=Le,headerRenderMode:b="default",tokenizeMaxLineLength:S=1e3,tokenizeMaxLength:m=fo,useTokenTransformer:v=!1,useCSSClasses:C=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:i,disableLineNumbers:r,disableVirtualizationBuffers:o,collapsed:s,expandUnchanged:l,collapsedContextThreshold:a,expansionLineCount:u,hunkSeparators:d,lineDiffType:c,maxLineDiffLength:f,overflow:h,stickyHeader:g,theme:((y=this.workerManager)==null?void 0:y.getDiffRenderOptions().theme)??p,headerRenderMode:b,tokenizeMaxLineLength:S,tokenizeMaxLength:m,useTokenTransformer:v,useCSSClasses:C}}initializeHighlighter(){return In(Ma(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:Dr(this.workerManager,this.options)}))}hydrate(e){var o;if(e==null)return;this.diff=e;const{options:t}=this.getRenderOptions(e),n=it(e,this.getTokenizeMaxLength());let i=(o=this.workerManager)==null?void 0:o.getDiffResultCache(e);i!=null&&!xe(t,i.options)&&(i=void 0),this.renderCache??(this.renderCache={diff:e,hydrated:!0,highlighted:!n&&!lt(e),options:t,result:n||i==null?void 0:i.result,renderRange:void 0});const r=this.getHighlightWorkerManager(e);r!=null?this.renderCache.result==null&&!n&&r.highlightDiffAST(this,this.diff):Ge({theme:this.getLocalHighlightTheme()})==null&&(this.computedLangs=tn(e),this.initializeHighlighter().catch(s=>{s instanceof Mt||this.onHighlightError(s)}))}getHighlightWorkerManager(e){const{editSessionActive:t,workerManager:n}=this;return!t&&(n==null?void 0:n.isWorkingPool())===!0&&!n.shouldHighlightOnMainThread(e)?n:void 0}cacheHighlightResult(e,t){const{editSessionActive:n,workerManager:i}=this;!n&&(i==null?void 0:i.isWorkingPool())===!0&&i.setDiffResultCache(e.cacheKey,t)}getLocalHighlightTheme(){var e;return((e=this.workerManager)==null?void 0:e.getDiffRenderOptions().theme)??this.options.theme??Le}getEffectiveCodeOptions(){var t;const e=((t=this.workerManager)==null?void 0:t.isWorkingPool())===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:(e==null?void 0:e.tokenizeMaxLineLength)??this.options.tokenizeMaxLineLength}}getRenderOptions(e){const t=(()=>{var l;if(((l=this.workerManager)==null?void 0:l.isWorkingPool())===!0){const a=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&a.useTokenTransformer!==!0?{...a,useTokenTransformer:!0}:a}const{theme:i,tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}=this.getOptionsWithDefaults();return{theme:i,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}})();this.getOptionsWithDefaults();const{renderCache:n}=this;return(n==null?void 0:n.result)==null?{options:t,forceHighlight:!0}:!j(e,n.diff)||!xe(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){const{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(j(this.renderCache.diff,e))return this.renderCache.diff;const n=!(e.additionLines.length>0||e.deletionLines.length>0)||lt(e)||it(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){var r;const{renderCache:i}=this;return i==null||j(i.diff,e)?!0:n?i.result==null&&i.hydrated!==!0||((r=this.workerManager)==null?void 0:r.isWorkingPool())===!0&&!this.workerManager.shouldHighlightOnMainThread(e)||Ge({theme:t.theme})!=null:i.result==null&&i.hydrated!==!0?!0:this.getHighlightWorkerManager(e)!=null?!i.highlighted:Ge({theme:t.theme})!=null}renderDiff(e=this.diff,t=Wn){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}const{expandUnchanged:n,collapsedContextThreshold:i}=this.getOptionsWithDefaults();let{options:r,forceHighlight:o}=this.getRenderOptions(e);const s=this.getReadyRenderResult(e,r);this.pendingHighlightResult=void 0,s!=null&&(this.renderCache={...s,diff:e,renderRange:void 0},o=!1),this.renderCache??(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||lt(e)||it(e,this.getTokenizeMaxLength()),u=this.canRenderDiff(e,r,a),d=!j(e,this.renderCache.diff),c=!wr(this.renderCache.renderRange,t),f=this.getHighlightWorkerManager(e);if(f!=null){const h=this.renderCache.result==null&&this.renderCache.highlighted&&!a&&!d&&vn(t);u&&!h&&(a||this.renderCache.result==null||!this.renderCache.highlighted&&(d||c))&&(this.renderCache.diff=e,this.renderCache.options=r,this.renderCache.highlighted=!1,(this.renderCache.result==null||d||c||o)&&(this.renderCache.result=f.getPlainDiffAST(e,t.startingLine,t.totalLines,vn(t)||n?!0:this.expandedHunks,i)),this.renderCache.renderRange=t),!a&&l&&(!this.renderCache.highlighted||o)&&f.highlightDiffAST(this,e)}else{this.computedLangs=tn(e);const h=Ge(),g=h!=null&&ln(r.theme,h),p=h!=null&&ai(this.computedLangs,h),b=!a&&p,S=Number.isFinite(t.totalLines);if(u&&h!=null&&g&&(o||a||!this.renderCache.highlighted&&b||this.renderCache.result==null)){const{result:m,options:v}=this.renderDiffWithHighlighter(e,h,a||!p,S);this.renderCache={diff:e,options:v,highlighted:b,result:m,renderRange:void 0},b&&this.cacheHighlightResult(e,{result:m,options:v})}(!g||!a&&!p)&&this.asyncHighlight(e,S).then(({result:m,options:v})=>{a||this.cacheHighlightResult(e,{result:m,options:v}),this.applyHighlightResult(e,m,v,!a)}).catch(m=>{m instanceof Mt||this.onHighlightError(m)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=Wn){this.diff=e;const{result:n}=await this.asyncHighlight(e,Number.isFinite(t.totalLines));return this.processDiffResult(e,t,n)}createPreElement(e,t,n){const{diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:s}=this.getOptionsWithDefaults();return Ta({type:"diff",diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:s,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e,t=!1){const n=it(e,this.getTokenizeMaxLength());this.computedLangs=n?["text"]:tn(e);let i=Ge();const r=i!=null&&ln(this.getLocalHighlightTheme(),i),o=n||i!=null&&ai(this.computedLangs,i);return(i==null||!r||!o)&&(i=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,i,n,t)}renderDiffWithHighlighter(e,t,n=!1,i=!1){const{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:o}=this.getOptionsWithDefaults(),s=Id(e,t,r,{forcePlainText:n,lazyLineAST:i,expandedHunks:n?!0:void 0,collapsedContextThreshold:o});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===""&&s.code.additionLines[0]==null){let l;if(_e({diff:e,diffStyle:"both",expandedHunks:n?!0:void 0,collapsedContextThreshold:o,callback:({additionLine:a})=>{if((a==null?void 0:a.lineIndex)===0)return l=a,!0}}),l==null)throw new Error("DiffHunksRenderer: missing empty addition line");s.code.additionLines[0]=Ht(0,"",l.unifiedLineIndex,l.splitLineIndex)}return{result:s,options:r}}onHighlightSuccess(e,t,n,i=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,i)}applyHighlightResult(e,t,n,i=!0){var s;const{diff:r,renderCache:o}=this;r==null||o==null||!j(r,e)||!xe(n,this.getRenderOptions(r).options)||(o.result==null||!o.highlighted||!xe(o.options,n)||!j(o.diff,r))&&(this.pendingHighlightResult={diff:r,options:n,highlighted:i,result:t},(s=this.onRenderUpdate)==null||s.call(this))}getMatchingWorkerResultCache(e,t){var i;if(this.editSessionActive)return;const n=(i=this.workerManager)==null?void 0:i.getDiffResultCache(e);if(!(n==null||!xe(t,n.options)))return n}getReadyRenderResult(e,t){const{pendingHighlightResult:n}=this;if(n!=null&&j(n.diff,e)&&xe(n.options,t))return n;const i=this.getMatchingWorkerResultCache(e,t);if(!(i==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...i}}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return(n==null?void 0:n.result)!=null&&n.highlighted&&j(e,n.diff)&&xe(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){var _;const{diffStyle:o,disableFileHeader:s,expandUnchanged:l,expansionLineCount:a,collapsedContextThreshold:u,hunkSeparators:d}=this.getOptionsWithDefaults(),c=((_=this.renderCache)==null?void 0:_.isDirty)??!1,f=o==="unified",h=bu(e,this.options.loadDiffFiles!=null),g=!e.isPartial||h;let p=[],b=[],S=[];const m=[],{additionLines:v,deletionLines:C}=n,y={rowCount:0,hunkSeparators:d,additionsContentAST:p,deletionsContentAST:b,unifiedContentAST:S,unifiedGutterAST:ht(),deletionsGutterAST:ht(),additionsGutterAST:ht(),expansionLineCount:a,hunkData:m,incrementRowCount(M=1){y.rowCount+=M},pushToGutter(M,O){switch(M){case"unified":y.unifiedGutterAST.children.push(O);break;case"deletions":y.deletionsGutterAST.children.push(O);break;case"additions":y.additionsGutterAST.children.push(O)}}},x=Gr({fileDiff:e,errorPrefix:"DiffHunksRenderer.processDiffResult"}),L={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"?(y.pushToGutter("additions",he(void 0,"buffer",this.size)),p==null||p.push(yt(this.size))):(y.pushToGutter("deletions",he(void 0,"buffer",this.size)),b==null||b.push(yt(this.size))),this.size=0,this.side=void 0}}},k=(M,O,W,Z,F)=>{y.pushToGutter(M,No(O,W,Z,F))};function R(M){L.flush(),o==="unified"?en("unified",M,y):(en("deletions",M,y),en("additions",M,y))}this.pushFileLevelAnnotations(e,o,t,y),_e({diff:e,diffStyle:o,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:l?!0:this.expandedHunks,collapsedContextThreshold:u,callback:({hunkIndex:M,hunk:O,collapsedBefore:W,collapsedAfter:Z,additionLine:F,deletionLine:D,type:$})=>{var Je,Qe;const J=D!=null?D.splitLineIndex:F.splitLineIndex,ue=F!=null?F.unifiedLineIndex:D.unifiedLineIndex;o==="split"&&$!=="change"&&L.flush(),W>0&&R({hunkIndex:M,collapsedLines:W,rangeSize:Math.max((O==null?void 0:O.collapsedBefore)??0,0),hunkSpecs:O==null?void 0:O.hunkSpecs,isFirstHunk:M===0,isLastHunk:!1,isExpandable:g});const be=o==="unified"?ue:J,ye={type:$,hunkIndex:M,lineIndex:be,unifiedLineIndex:ue,splitLineIndex:J,deletionLine:D,additionLine:F};if(o==="unified"){const B=(Je=this.getUnifiedInjectedRowsForLine)==null?void 0:Je.call(this,ye);(B==null?void 0:B.before)!=null&&Fi(B.before,y);let se=D!=null?C[D.lineIndex]:void 0,ne=F!=null?v[F.lineIndex]:void 0;if(se==null&&ne==null){const le="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(le,{file:e.name}),new Error(le)}const Te=$==="change"?F!=null?"change-addition":"change-deletion":$,ie=this.getUnifiedLineDecoration({type:$,lineType:Te,additionLineIndex:F==null?void 0:F.lineIndex,deletionLineIndex:D==null?void 0:D.lineIndex});k("unified",ie.gutterLineType,F!=null?F.lineNumber:D.lineNumber,`${ue},${J}`,ie.gutterProperties),ne!=null?ne=Lt(ne,ie.contentProperties,c&&F!=null?{"data-line":F.lineNumber,"data-line-index":`${ue},${J}`}:void 0):se!=null&&(se=Lt(se,ie.contentProperties,c&&D!=null?{"data-line":D.lineNumber,"data-line-index":`${ue},${J}`}:void 0)),wt({diffStyle:"unified",type:$,deletionLine:se,additionLine:ne,unifiedSpan:this.getAnnotations("unified",D==null?void 0:D.lineNumber,F==null?void 0:F.lineNumber,M,be),createAnnotationElement:le=>this.createAnnotationElement(le),context:y}),(B==null?void 0:B.after)!=null&&Fi(B.after,y)}else{const B=(Qe=this.getSplitInjectedRowsForLine)==null?void 0:Qe.call(this,ye);(B==null?void 0:B.before)!=null&&Oi(B.before,y,L);let se=D!=null?C[D.lineIndex]:void 0,ne=F!=null?v[F.lineIndex]:void 0;const Te=this.getSplitLineDecoration({side:"deletions",type:$,lineIndex:D==null?void 0:D.lineIndex}),ie=this.getSplitLineDecoration({side:"additions",type:$,lineIndex:F==null?void 0:F.lineIndex});if(se==null&&ne==null){const Q="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(Q,{file:e.name}),new Error(Q)}const le=(()=>{if($==="change"){if(ne==null)return"additions";if(se==null)return"deletions"}})();le!=null?(L.side!=null&&L.side!==le&&L.flush(),L.side=le,L.increment()):$==="change"&&L.flush();const et=this.getAnnotations("split",D==null?void 0:D.lineNumber,F==null?void 0:F.lineNumber,M,be);if(et!=null&&L.size>0&&L.flush(),D!=null){const Q=Lt(se,Te.contentProperties,c?{"data-line":D.lineNumber,"data-line-index":`${D.unifiedLineIndex},${J}`}:void 0);k("deletions",Te.gutterLineType,D.lineNumber,`${D.unifiedLineIndex},${J}`,Te.gutterProperties),Q!=null&&(se=Q)}if(F!=null){const Q=Lt(ne,ie.contentProperties,c?{"data-line":F.lineNumber,"data-line-index":`${F.unifiedLineIndex},${J}`}:void 0);k("additions",ie.gutterLineType,F.lineNumber,`${F.unifiedLineIndex},${J}`,ie.gutterProperties),Q!=null&&(ne=Q)}wt({diffStyle:"split",type:$,additionLine:ne,deletionLine:se,...et,createAnnotationElement:Q=>this.createAnnotationElement(Q),context:y}),(B==null?void 0:B.after)!=null&&Oi(B.after,y,L)}const Se=o==="split"&&O!=null&&J===O.splitLineStart+O.splitLineCount-1,te=M===e.hunks.length-1&&O!=null&&(o==="split"?J===O.splitLineStart+O.splitLineCount-1:ue===O.unifiedLineStart+O.unifiedLineCount-1),Fe=Se?O.noEOFCRDeletions:!1,Ut=Se?O.noEOFCRAdditions:!1,ge=((D==null?void 0:D.noEOFCR)??!1)||Fe,ce=((F==null?void 0:F.noEOFCR)??!1)||Ut;if(ce||ge){if(o==="split"&&L.flush(),ge){const B=$==="context"||$==="context-expanded"?$:"change-deletion";o==="unified"?(y.unifiedContentAST.push(St(B)),y.pushToGutter("unified",he(B,"metadata",1))):(y.deletionsContentAST.push(St(B)),y.pushToGutter("deletions",he(B,"metadata",1)),ce||(y.pushToGutter("additions",he(void 0,"buffer",1)),y.additionsContentAST.push(yt(1))))}if(ce&&!(f&&ge&&$!=="change")){const B=$==="context"||$==="context-expanded"?$:"change-addition";o==="unified"?(y.unifiedContentAST.push(St(B)),y.pushToGutter("unified",he(B,"metadata",1))):(y.additionsContentAST.push(St(B)),y.pushToGutter("additions",he(B,"metadata",1)),ge||(y.pushToGutter("deletions",he(void 0,"buffer",1)),y.deletionsContentAST.push(yt(1))))}y.incrementRowCount(1)}d!=="simple"&&d!=="metadata"&&(Z>0||te&&h)&&R({hunkIndex:$==="context-expanded"?M:M+1,collapsedLines:te&&h?"unknown":Z,rangeSize:x,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:g}),y.incrementRowCount(1)}}),o==="split"&&L.flush();const H=Math.max(xd(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),N=t.bufferBefore>0||t.bufferAfter>0,I=!f&&e.type!=="deleted",E=!f&&e.type!=="new",T=y.rowCount>0||N;p=I&&T?p:void 0,b=E&&T?b:void 0,S=f&&T?S:void 0;const U=this.createPreElement(b!=null&&p!=null,H);return{fileDiff:e,unifiedGutterAST:f&&T?y.unifiedGutterAST.children:void 0,unifiedContentAST:S,deletionsGutterAST:E&&T?y.deletionsGutterAST.children:void 0,deletionsContentAST:b,additionsGutterAST:I&&T?y.additionsGutterAST.children:void 0,additionsContentAST:p,hunkData:m,preNode:U,themeStyles:i,baseThemeType:r,headerElement:s?void 0:this.renderHeader(e),totalLines:H,rowCount:y.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=ht(n);return r.properties.style=`grid-row: span ${t.rowCount}`,[r,Ja(i,t.rowCount)]}renderFullAST(e,t=[]){const n=this.getOptionsWithDefaults().hunkSeparators==="line-info",i=this.renderCodeAST("unified",e);if(i!=null)return t.push(z({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(z({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(z({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(z({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(!Tr(n))return;const r=e.type!=="new"?this.getAnnotationNames(gi(this.deletionAnnotations)):[],o=e.type!=="deleted"?this.getAnnotationNames(gi(this.additionAnnotations)):[];if(r.length===0&&o.length===0)return;const s=-1,l=-1,{createAnnotationElement:a}=this;if(t==="unified"){wt({diffStyle:t,type:"context",unifiedSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r.concat(o)},createAnnotationElement:a,context:i});return}wt({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(this.annotationSlotName(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(this.annotationSlotName(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}}getAnnotationNames(e){return(e==null?void 0:e.map(t=>this.annotationSlotName(t)))??[]}renderHeader(e){const{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return Ra({fileOrDiff:e,mode:t,stickyHeader:n})}};const fu=new Intl.PluralRules("en-US");function gu(e){return`${e} unmodified line${fu.select(e)==="one"?"":"s"}`}function Fi(e,t){for(const n of e)t.unifiedContentAST.push(n.content),t.pushToGutter("unified",n.gutter),t.incrementRowCount(1)}function Oi(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 wt({diffStyle:e,type:t,deletionLine:n,additionLine:i,unifiedSpan:r,deletionSpan:o,additionSpan:s,createAnnotationElement:l,context:a}){let u=!1;if(e==="unified"){if(i!=null?a.unifiedContentAST.push(i):n!=null&&a.unifiedContentAST.push(n),r!=null){const d=t==="change"?n!=null?"change-deletion":"change-addition":t;a.unifiedContentAST.push(l(r)),a.pushToGutter("unified",he(d,"annotation",1)),u=!0}}else if(e==="split"){if(n!=null&&a.deletionsContentAST.push(n),i!=null&&a.additionsContentAST.push(i),o!=null){const d=t==="change"?n!=null?"change-deletion":"context":t;a.deletionsContentAST.push(l(o)),a.pushToGutter("deletions",he(d,"annotation",1)),u=!0}if(s!=null){const d=t==="change"?i!=null?"change-addition":"context":t;a.additionsContentAST.push(l(s)),a.pushToGutter("additions",he(d,"annotation",1)),u=!0}}u&&a.incrementRowCount(1)}function en(e,{hunkIndex:t,collapsedLines:n,rangeSize:i,hunkSpecs:r,isFirstHunk:o,isLastHunk:s,isExpandable:l},a){if(typeof n=="number"&&n<=0)return;const u=e==="unified"?a.unifiedContentAST:e==="deletions"?a.deletionsContentAST:a.additionsContentAST;if(a.hunkSeparators==="metadata"){r!=null&&(a.pushToGutter(e,je({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),u.push(je({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1));return}if(a.hunkSeparators==="simple"){t>0&&(a.pushToGutter(e,je({type:"simple",isFirstHunk:o,isLastHunk:!1})),u.push(je({type:"simple",isFirstHunk:o,isLastHunk:!1})),e!=="additions"&&a.incrementRowCount(1));return}const d=Cd(e,t),c=i>a.expansionLineCount,f=l?t:void 0,h=typeof n=="number"?gu(n):"More unchanged context may be available";a.pushToGutter(e,je({type:a.hunkSeparators,content:h,expandIndex:f,chunked:c,slotName:d,isFirstHunk:o,isLastHunk:s})),u.push(je({type:a.hunkSeparators,content:h,expandIndex:f,chunked:c,slotName:d,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1),a.hunkData.push({slotName:d,hunkIndex:t,lines:typeof n=="number"?n:0,lineCountKnown:typeof n=="number",type:e,expandable:l?{up:!o,down:!s,chunked:c}:void 0})}function Lt(e,t,n){return e==null||e.type!=="element"||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function zi(e){return e.length>0&&e[e.length-1]===""?e.length-1:e.length}function pu(e,t,n,i){const r=zi(e),o=zi(t),s=Math.min(r,o);let l=0;for(;l<s&&e[l]===t[l];)l++;let a=0;for(;a<s-l&&e[r-1-a]===t[o-1-a];)a++;const u=new Array(t.length);for(let d=0;d<l;d++)u[d]=n[d];for(let d=0;d<a;d++)u[o-1-d]=n[r-1-d];r<e.length&&o<t.length&&(u[t.length-1]=n[e.length-1]);for(let d=l;d<t.length;d++)u[d]??(u[d]=Ht(d,i.getLineText(d)));return u}function mu(e,t){var n;return t===e.length+1&&((n=e.at(-1))==null?void 0:n.endsWith(`
|
|
175
|
+
`))===!0}function Ht(e,t,n=e,i=e){return{type:"element",tagName:"div",properties:{"data-line":e+1,"data-line-index":`${n},${i}`,"data-line-type":"context"},children:[{type:"element",tagName:"span",properties:{"data-char":0},children:[{type:"text",value:t}]}]}}function vu(e){const t=[];let n=0;for(let i=0;i<e.lineCount;i++){const r=e.getLineText(i,!0);t.push(r),n+=r.length}return{lines:t,characterCount:n}}function tn(e){if(e.lang!=null)return[e.lang];const t=Ee(e.prevName??e.name),n=Ee(e.name);return t===n?[n]:[t,n]}function it(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function bu(e,t){return e.isPartial&&t&&(e.type==="change"||e.type==="rename-changed")}function yu(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Su(e,t){var n,i,r,o,s,l;return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&((n=e.expandable)==null?void 0:n.chunked)===((i=t.expandable)==null?void 0:i.chunked)&&((r=e.expandable)==null?void 0:r.up)===((o=t.expandable)==null?void 0:o.up)&&((s=e.expandable)==null?void 0:s.down)===((l=t.expandable)==null?void 0:l.down)}async function En(e,t=300){let n;try{await Promise.race([e(),new Promise(i=>{n=setTimeout(i,t)})])}finally{n!=null&&clearTimeout(n)}}function Rn({oldFile:e,newFile:t},n){if(!(e===void 0&&t===void 0)){if(e===void 0||t===void 0)throw new Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw new Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return t===null?{oldFile:e,newFile:t}:{oldFile:e,newFile:t}}}function Cu(e){return{theme:e==null?void 0:e.theme,disableLineNumbers:e==null?void 0:e.disableLineNumbers,overflow:e==null?void 0:e.overflow,collapsed:e==null?void 0:e.collapsed,disableFileHeader:e==null?void 0:e.disableFileHeader,disableVirtualizationBuffers:e==null?void 0:e.disableVirtualizationBuffers,stickyHeader:e==null?void 0:e.stickyHeader,preferredHighlighter:e==null?void 0:e.preferredHighlighter,useCSSClasses:e==null?void 0:e.useCSSClasses,useTokenTransformer:bl(e),tokenizeMaxLineLength:e==null?void 0:e.tokenizeMaxLineLength,tokenizeMaxLength:e==null?void 0:e.tokenizeMaxLength,diffStyle:e==null?void 0:e.diffStyle,diffIndicators:e==null?void 0:e.diffIndicators,disableBackground:e==null?void 0:e.disableBackground,hunkSeparators:typeof(e==null?void 0:e.hunkSeparators)=="function"?"custom":e==null?void 0:e.hunkSeparators,expandUnchanged:e==null?void 0:e.expandUnchanged,loadDiffFiles:e==null?void 0:e.loadDiffFiles,parseDiffOptions:e==null?void 0:e.parseDiffOptions,collapsedContextThreshold:e==null?void 0:e.collapsedContextThreshold,lineDiffType:e==null?void 0:e.lineDiffType,maxLineDiffLength:e==null?void 0:e.maxLineDiffLength,expansionLineCount:e==null?void 0:e.expansionLineCount,headerRenderMode:(e==null?void 0:e.renderCustomHeader)!=null?"custom":"default"}}function nn(e){return e.isPartial&&(e.type==="change"||e.type==="rename-changed"||e.type==="rename-pure")}function xu(e){const t={...e};return delete t.cacheKey,t}function Ui(e,t){if(e.isPartial||t.isPartial)throw new Error("FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated");const n=e.lang??Ee(e.name),i=t.lang??Ee(t.name),r=e.type!=="new",o=t.type!=="new";return e.name!==t.name||n!==i||r!==o||e.deletionLines.length!==t.deletionLines.length?!0:e.deletionLines.some((s,l)=>s!==t.deletionLines[l])}function ku(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function wu(e,t){const{oldFile:n}=e;return n==null?t.type==="new":t.type!=="new"&&n.name===(t.prevName??t.name)&&ku(n.lines,t.deletionLines)}let Lu=-1;var sn,eo=(sn=class{constructor(t={theme:Le},n,i){w(this,"options");w(this,"workerManager");w(this,"requestOwnerRender");w(this,"__id",`file-diff:${++Lu}`);w(this,"type","file-diff");w(this,"fileContainer");w(this,"spriteSVG");w(this,"pre");w(this,"codeUnified");w(this,"codeDeletions");w(this,"codeAdditions");w(this,"bufferBefore");w(this,"bufferAfter");w(this,"themeCSSStyle");w(this,"appliedThemeCSS");w(this,"hasAdoptedThemeCSS",!1);w(this,"unsafeCSSStyle");w(this,"appliedUnsafeCSS");w(this,"gutterUtilityContent");w(this,"headerElement");w(this,"headerPrefix");w(this,"headerFilenameSuffix");w(this,"headerMetadata");w(this,"headerCustom");w(this,"separatorCache",new Map);w(this,"errorWrapper");w(this,"placeHolder");w(this,"hunksRenderer");w(this,"resizeManager");w(this,"scrollSyncManager");w(this,"interactionManager");w(this,"annotationCache",new Map);w(this,"managersDirty",!1);w(this,"deletionFile");w(this,"additionFile");w(this,"fileDiff");w(this,"editSession");w(this,"renderedData");w(this,"pendingData");w(this,"forceRenderOverride");w(this,"renderRange");w(this,"pendingFiles");w(this,"appliedPreAttributes");w(this,"headerCache",{lastRenderedHTML:void 0,html:void 0,fileDiff:void 0});w(this,"lastRowCount");w(this,"mounted",!1);w(this,"enabled",!0);w(this,"editor");w(this,"refreshViewTimeout");w(this,"lineStateRefreshPending",!1);w(this,"deferredSelectedLines");w(this,"deferredEditorActiveLine");w(this,"handleHighlightRender",()=>{this.rerender()});w(this,"getLineIndex",(t,n="additions")=>this.getLineIndexForDiff(this.getDiffForLineIndex(),t,n));w(this,"getHoveredLine",()=>this.interactionManager.getHoveredLine());w(this,"getAnnotationSlotName",t=>{var n;return vl((n=this.editSession)==null?void 0:n.annotations,t,ze)});w(this,"handleExpandHunk",(t,n,i)=>{this.expandHunk(t,n,i)});w(this,"expandHunk",(t,n,i)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(t,n,i),this.rerender()});w(this,"handleEditSessionRender",()=>{this.rerender(),this.flushDeferredLineState()});var r;this.options=t,this.workerManager=n,this.requestOwnerRender=i,this.hunksRenderer=this.createHunksRenderer(t),this.resizeManager=new ya,this.scrollSyncManager=new Sd,this.interactionManager=new da("diff",ti(t,typeof t.hunkSeparators=="function"||(t.hunkSeparators??"line-info")==="line-info"||t.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex)),(r=this.workerManager)==null||r.subscribeToThemeChanges(this),this.enabled=!0}get lineAnnotations(){var t;return((t=this.renderedData)==null?void 0:t.lineAnnotations)??Qi}getTheme(){var t;return((t=this.workerManager)==null?void 0:t.getDiffRenderOptions().theme)??this.options.theme??Le}getHunksRendererOptions(t){return Cu(t)}createHunksRenderer(t){return new hu(this.getHunksRendererOptions(t),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(t,n,i){if(t==null)return;const r=t.hunks.at(-1);let o,s;e:for(const l of t.hunks){const a=i==="deletions"?l.deletionStart:l.additionStart,u=i==="deletions"?l.deletionCount:l.additionCount;let d=de(a,u)+1,c=l.splitLineStart,f=l.unifiedLineStart;if(n<d){const h=d-n;o=Math.max(f-h,0),s=Math.max(c-h,0);break e}if(n>=d+u){if(l===r){const h=n-(d+u);o=f+l.unifiedLineCount+h,s=c+l.splitLineCount+h;break e}continue}for(const h of l.hunkContent)if(h.type==="context")if(n<d+h.lines){const g=n-d;s=c+g,o=f+g;break e}else d+=h.lines,c+=h.lines,f+=h.lines;else{const g=i==="deletions"?h.deletions:h.additions;if(n<d+g){const p=n-d;o=f+(i==="additions"?h.deletions:0)+p,s=c+p;break e}else d+=g,c+=Math.max(h.deletions,h.additions),f+=h.deletions+h.additions}break e}if(!(o==null||s==null))return[o,s]}setOptions(t){t!=null&&(this.options=t,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(t)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(ti(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(t){this.options={...this.options,...t}}setThemeType(t){(this.options.themeType??"system")!==t&&(this.mergeOptions({themeType:t}),this.applyCachedThemeState(t))}applyCachedThemeState(t){if(typeof this.options.theme=="string"||this.fileContainer==null||this.appliedThemeCSS==null)return!1;const n=this.appliedThemeCSS.baseThemeType??t;return this.appliedThemeCSS.themeType===n?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,t,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Pn(this.appliedThemeCSS.theme,this.getTheme())}getLatestAnnotations(){var t,n,i;return((t=this.pendingData)==null?void 0:t.lineAnnotations)??((i=(n=this.editSession)==null?void 0:n.annotations)==null?void 0:i.current)??this.lineAnnotations}getAnnotationsForDiff(t){const{pendingData:n}=this;return n!=null&&j(t,n.fileDiff)?n.lineAnnotations:this.lineAnnotations}isNewAnnotations(t){var i;const n=(i=this.editSession)==null?void 0:i.annotations;return t===this.getLatestAnnotations()?!1:n==null||t!==n.provided&&t!==n.current}setLineAnnotations(t){var r;const n=(r=this.editSession)==null?void 0:r.annotations;if(n!=null){if(!this.isNewAnnotations(t))return;ml(n,t,ze)}const i=this.getWorkingDiff();i!=null&&(this.pendingData={fileDiff:i,lineAnnotations:t})}syncEditSessionAnnotationsFromEditor(t){var i;const n=(i=this.editSession)==null?void 0:i.annotations;return n==null||t===n.current?!1:(n.current=t,this.renderedData!=null&&(this.renderedData.lineAnnotations=t),this.pendingData=void 0,this.hunksRenderer.setLineAnnotations(t),this.renderAnnotations(),!0)}canPartiallyRender(t,n,i){return!(t||n||i||typeof this.options.hunkSeparators=="function")}setSelectedLines(t,n){this.lineStateRefreshPending?this.deferredSelectedLines=[t,n]:this.interactionManager.setSelection(t,n)}setEditorActiveLine(t,n){this.lineStateRefreshPending?this.deferredEditorActiveLine=[t,n]:this.interactionManager.setEditorActiveLine(t,{lineNumberOnly:n==null?void 0:n.lineNumberOnly,side:(n==null?void 0:n.side)??"additions"})}flushDeferredLineState(){const{deferredEditorActiveLine:t,deferredSelectedLines:n}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,t!=null&&this.setEditorActiveLine(...t),n!=null&&this.interactionManager.setSelection(...n)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}const{diffStyle:t="split",overflow:n="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:n==="wrap",columnVariables:this.shouldApplyColumnVariables(n)?"apply":"measure"}),n==="scroll"&&t==="split"?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(t){var n;return typeof this.options.hunkSeparators=="function"?!0:t==="scroll"&&(this.lineAnnotations.length>0||((n=this.pre)==null?void 0:n.hasAttribute("data-has-merge-conflict"))===!0)}getCodeScrollLeft(){var t,n,i;return Math.max(((t=this.codeUnified)==null?void 0:t.scrollLeft)??0,((n=this.codeDeletions)==null?void 0:n.scrollLeft)??0,((i=this.codeAdditions)==null?void 0:i.scrollLeft)??0)}setCodeScrollLeft(t){this.codeUnified!=null&&(this.codeUnified.scrollLeft=t),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=t),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=t)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(t=!1){var i,r,o,s,l,a;const{editor:n}=this;dn(this.handleEditSessionRender),this.emitPostRender(!0),n==null||n.cleanUp(t?"recycle":"discard"),t||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,(i=this.workerManager)==null||i.unsubscribeToThemeChanges(this),this.renderRange=void 0,t||(this.pendingFiles=void 0),this.isComponentManaged||(r=this.fileContainer)==null||r.remove(),this.fileContainer=void 0,this.mounted=!1,t||(this.renderedData=void 0,this.pendingData=void 0),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,(o=this.bufferBefore)==null||o.remove(),this.bufferBefore=void 0,(s=this.bufferAfter)==null||s.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,(l=this.placeHolder)==null||l.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,t||this.clearReusableHeader(),(a=this.errorWrapper)==null||a.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,t?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){var t;this.enabled=!0,(t=this.workerManager)==null||t.subscribeToThemeChanges(this)}hydrate({fileContainer:t,prerenderedHTML:n,preventEmit:i=!1,lineAnnotations:r,fileDiff:o,...s}){if(!this.enabled)throw new Error("FileDiff.hydrate: attempting to call hydrate after cleaned up");if(this.fileContainer!=null)throw new Error("FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated");const l=Rn(s,"FileDiff.hydrate"),a=l==null?void 0:l.oldFile,u=l==null?void 0:l.newFile;this.hydrateElements(t,n);const d=this.editor!=null;d||Du(this.pre,Ru({fileDiff:o,oldFile:a,newFile:u}),this.options.collapsed)||Tu(this.headerElement,Au({fileDiff:o,oldFile:a,newFile:u}),this.options.disableFileHeader)?this.render({...s,fileContainer:t,lineAnnotations:r,fileDiff:o,forceRender:d||s.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:o,lineAnnotations:r,...l}),i||this.emitPostRender()}hydrateElements(t,n){var i;this.fileContainer!==t&&this.emitPostRender(!0),hl(t,n);for(const r of((i=t.shadowRoot)==null?void 0:i.children)??[]){if(r instanceof SVGElement){this.spriteSVG=r;continue}if(r instanceof HTMLElement){if(r instanceof HTMLPreElement){this.pre=r;for(const o of r.children)!(o instanceof HTMLElement)||o.tagName.toLowerCase()!=="code"||("deletions"in o.dataset&&(this.codeDeletions=o),"additions"in o.dataset&&(this.codeAdditions=o),"unified"in o.dataset&&(this.codeUnified=o));continue}if("diffsHeader"in r.dataset){this.headerElement=r;continue}if(r instanceof HTMLStyleElement&&r.hasAttribute("data-theme-css")){this.themeCSSStyle=r;continue}if(r instanceof HTMLStyleElement&&r.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=r,this.appliedUnsafeCSS=r.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=t,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:t,oldFile:n,newFile:i,lineAnnotations:r}){const o=r??this.getLatestAnnotations();this.pendingData=void 0,this.additionFile=i,this.deletionFile=n,this.fileDiff=t??(n!==void 0&&i!==void 0?Ne(n,i,this.options.parseDiffOptions):void 0),this.renderedData=this.fileDiff!=null?{fileDiff:this.fileDiff,lineAnnotations:o}:void 0,this.fileDiff!=null&&this.adoptRenderData(this.fileDiff),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.getInputDiff()==null&&this.additionFile==null&&this.deletionFile==null||this.requestRender()||this.render({forceRender:!0,renderRange:this.renderRange})}requestRender(){const{requestOwnerRender:t}=this;return this.editSession!=null||t==null?!1:(this.forceRenderOverride=!0,t(),!0)}get isComponentManaged(){return this.requestOwnerRender!=null}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}loadFilesIfNecessary(){var s;const t=this.getInputDiff(),{loadDiffFiles:n}=this.options;if(t==null||!nn(t)||((s=this.pendingFiles)==null?void 0:s.fileDiff)===t)return;if(n==null)throw new Error("FileDiff: loadDiffFiles is required to load full files for a partial diff");const i=this.loadFilesForDiff(t,n),r=this.pendingFiles={fileDiff:t,promise:i},o=()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)};r.promise=i.finally(o)}__canAttachEditor(){const t=this.getInputDiff();return t!=null&&!t.isPartial}async prepareForEditing(){if(this.__canAttachEditor())return;const t=this.__prepareForEditing();if(t==null){const n=this.getInputDiff();throw(n==null?void 0:n.isPartial)===!0&&!nn(n)?new Error("FileDiff.prepareForEditing: this partial diff cannot be hydrated; provide a complete diff"):new Error("FileDiff.prepareForEditing: a partial diff requires loadDiffFiles")}if(await t,!this.__canAttachEditor())throw new Error("FileDiff.prepareForEditing: the diff did not finish loading")}__prepareForEditing(){var n;if(this.__canAttachEditor())return;const t=this.getInputDiff();if((t==null?void 0:t.isPartial)===!0&&!nn(t))throw new Error("FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit");return this.loadFilesIfNecessary(),(n=this.pendingFiles)==null?void 0:n.promise}async loadFilesForDiff(t,n){try{const i=await n(t);if(this.getInputDiff()!==t)return;await this.handleFilesLoaded(t,i)}catch(i){if(this.options.disableErrorHandling===!0)throw i;console.error(i)}}async handleFilesLoaded(t,n){if(!(this.getInputDiff()!==t||!t.isPartial)){if(Sn("merge",t,n),this.setHydratedState(n),this.installHydratedSessionDiff(t)){this.rerender();return}await En(()=>this.primeHighlightCache(t)),!(!this.enabled||this.getInputDiff()!==t)&&this.rerender()}}installHydratedSessionDiff(t){var n;if(t.isPartial)throw new Error("FileDiff.installHydratedSessionDiff: diffs cannot be partial for editing");return this.getInputDiff()!==t?!1:((n=this.editSession)==null?void 0:n.outgoingDiff)!=null?(this.installEditSession(t),!0):!1}updateInputDiff(t,n){var s,l,a,u;if(j(this.getInputDiff(),t))return!1;const i=this.getLatestAnnotations();this.fileDiff=t;const{editSession:r}=this,o=(r==null?void 0:r.outgoingDiff)??(r==null?void 0:r.diff);return r!=null&&(t.isPartial?r.inputDiff=t:this.installEditSession(t),this.editSession!=null&&(this.editSession.outgoingDiff=o)),((s=this.editSession)==null?void 0:s.annotations)!=null&&n!=null&&(this.editSession.annotations=vi(n,ze,this.editSession.annotations)),this.pendingData={fileDiff:((l=this.editSession)==null?void 0:l.diff)??t,lineAnnotations:((u=(a=this.editSession)==null?void 0:a.annotations)==null?void 0:u.current)??n??i},o!=null&&t.isPartial&&this.loadFilesIfNecessary(),!0}installEditSession(t,n,i){var d,c;const r=t.additionLines.join(""),o=n!=null?Pt(n.contents):void 0,s=i!=null&&wu(i,t);if(i!=null&&!s)throw new Error("FileDiff: retained session cannot resume against a different old file");if(n!=null&&n.contents!==r&&!s)throw new Error("FileDiff: retained edits are missing their diff session state");const l=n==null||n.name===t.name&&n.lang===t.lang&&n.contents===r,a=xu(t);n!=null&&o!=null&&!l&&(a.name=n.name,a.lang=n.lang),s&&i!=null&&n!=null&&o!=null&&(a.additionLines=o,a.additionCharacterCount=n.contents.length,a.type=i.type,a.hunks=i.hunks,a.editSessionDirty=!0,zt(a));const u=((d=this.editSession)==null?void 0:d.annotations)??vi(this.getLatestAnnotations(),ze);this.editSession={diff:a,inputDiff:t,annotations:u,outgoingDiff:(c=this.editSession)==null?void 0:c.outgoingDiff},this.pendingData={fileDiff:a,lineAnnotations:u.current},this.hunksRenderer.beginEditSession(a,l&&!s?t:void 0)}setHydratedState(t){var n;this.deletionFile=t.oldFile,this.additionFile=t.newFile,(n=this.workerManager)==null||n.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:t,deferManagers:n=!1,forceRender:i=!1,preventEmit:r=!1,lineAnnotations:o,fileContainer:s,containerWrapper:l,renderRange:a,...u}){var N,I;if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");i=this.forceRenderOverride??i,this.forceRenderOverride=void 0;const d=Rn(u,"FileDiff.render"),c=d==null?void 0:d.oldFile,f=d==null?void 0:d.newFile;(N=this.editor)==null||N.__postponeBgTokenizeToNextFrame();const{collapsed:h=!1,themeType:g="system",expandUnchanged:p=!1}=this.options,b=h?void 0:a,S=this.hasThemeChanged(),m=d!=null,v=m&&(!_i(c,this.deletionFile)||!_i(f,this.additionFile));let C=t!=null&&!j(t,this.getInputDiff());const y=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)?this.isNewAnnotations(o):!1;if(!h&&wr(b,this.renderRange)&&!i&&!y&&!S&&(t!=null&&!C||t==null&&!v)){const E=this.applyCachedThemeState(g);return E&&this.finalizeRender(),E}let x;t==null&&m&&(v||this.getInputDiff()==null)&&(x=Ne(d.oldFile,d.newFile,this.options.parseDiffOptions));const{renderRange:L}=this;this.renderRange=b,m?(this.deletionFile=c,this.additionFile=f):t!=null&&(this.deletionFile=void 0,this.additionFile=void 0),t!=null&&C?this.updateInputDiff(t,o):x!=null&&(C=!0,this.updateInputDiff(x,o)),C&&this.clearReusableHeader(),o!=null&&this.setLineAnnotations(o);const k=this.getWorkingDiff();if(k==null)return!1;k.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Mi(k,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),p&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.prepareRenderData(this.hunksRenderer.getDiffForNextRender(k));const{disableErrorHandling:R=!1,disableFileHeader:H=!1}=this.options;if(H&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),s=this.getOrCreateFileContainer(s,l),this.applyCachedThemeState(g),h){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const E=this.hunksRenderer.renderDiff(k,mo);E!=null&&this.applyThemeState(s,E.themeStyles,g,E.baseThemeType),(E==null?void 0:E.headerElement)!=null&&this.applyHeaderToDOM(E.headerElement,s,E.fileDiff),this.renderSeparators([]),this.adoptRenderData((E==null?void 0:E.fileDiff)??k),this.injectUnsafeCSS()}catch(E){if(R)throw E;console.error(E),E instanceof Error&&this.applyErrorToDOM(E,s)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{const E=this.getOrCreatePreNode(s);if(this.canPartiallyRender(i,y,v||C||S||!j(this.getRenderedDiff(),k))&&this.applyPartialRender({fileDiff:k,previousRenderRange:L,renderRange:b})){const T=this.getRenderedDiff();T!=null&&this.adoptRenderData(T)}else{const T=this.hunksRenderer.renderDiff(k,b);if(T==null)return((I=this.workerManager)==null?void 0:I.isInitialized())===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(s,T.themeStyles,g,T.baseThemeType),T.headerElement!=null&&this.applyHeaderToDOM(T.headerElement,s,T.fileDiff),T.additionsContentAST!=null||T.deletionsContentAST!=null||T.unifiedContentAST!=null?this.applyHunksToDOM(E,T):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(T.hunkData),this.adoptRenderData(T.fileDiff)}this.applyBuffers(E,b),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,n||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(E){if(R)throw E;console.error(E),E instanceof Error&&this.applyErrorToDOM(E,s)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(t=!1){var o,s;const{fileContainer:n,options:{onPostRender:i}}=this;if(t){if(!this.mounted||(this.mounted=!1,n==null))return;(s=(o=this.options).onPostRender)==null||s.call(o,n,this,"unmount");return}if(n==null)return;const r=this.mounted?"update":"mount";this.mounted=!0,i==null||i(n,this,r)}getInputDiff(){return this.fileDiff}getWorkingDiff(t=this.fileDiff){var n;return((n=this.editSession)==null?void 0:n.diff)??t}getRenderedDiff(){var t;return(t=this.renderedData)==null?void 0:t.fileDiff}__getNextRenderData({fileDiff:t,lineAnnotations:n}){var s;const i=(s=this.editSession)==null?void 0:s.annotations;if(i!=null)return{fileDiff:t,lineAnnotations:n!=null&&this.isNewAnnotations(n)?n:i.provided};const r=this.getWorkingDiff(t)??t,o=this.hunksRenderer.getDiffForNextRender(r);return{fileDiff:o,lineAnnotations:n!=null&&j(o,r)?n:this.getAnnotationsForDiff(o)}}prepareRenderData(t){this.hunksRenderer.setLineAnnotations(this.getAnnotationsForDiff(t))}adoptRenderData(t){const{pendingData:n}=this,i=n!=null&&j(t,n.fileDiff);this.renderedData={fileDiff:t,lineAnnotations:i?n.lineAnnotations:this.lineAnnotations},i&&(this.pendingData=void 0)}syncRenderViewToEditor(){const{editor:t,fileContainer:n}=this,i=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),o=this.getWorkingDiff();if(t==null||n==null||o==null||o.isPartial)return;const s=d=>{var p;if(!this.enabled||this.editor!==t||this.fileContainer!==n||this.getWorkingDiff()!==o)return;const c=(p=this.editSession)==null?void 0:p.outgoingDiff,f=this.getInputDiff(),h=c!=null&&f!=null&&c!==o,g=h&&c!=null&&f!=null?Ui(c,f):!1;t.__syncRenderView({highlighter:d,fileContainer:n,fileDiff:o,lineAnnotations:i,renderRange:r,externalDocument:h,resetHistory:g})},l=this.getTheme(),a=o.lang??Ee(o.name),u=Ge({theme:l,lang:a});u!=null?s(u):In({themes:Hn(l),langs:["text",a],preferredHighlighter:Dr(this.workerManager,this.options)}).then(s).catch(d=>{d instanceof Mt||console.error(d)})}computeEditorRenderRange(t){const n=this.getWorkingDiff();if(t==null||n==null||vn(t))return t;const{diffStyle:i="split",expandUnchanged:r=!1,collapsedContextThreshold:o=1}=this.options;let s,l;return _e({diff:n,diffStyle:i,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({additionLine:a})=>{a!=null&&(s??(s=a.lineNumber),l=a.lineNumber)}}),s==null||l==null?{...t,startingLine:0,totalLines:0}:{...t,startingLine:s-1,totalLines:l-s+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(t){const{lineAnnotations:n}=t;n!=null&&this.syncEditSessionAnnotationsFromEditor(n)}emitEditChange(t){const{onEditChange:n}=this.options;n==null||n(t)}__captureDocumentSessionState(t=!0){const n=this.getInputDiff();let{diff:i,outgoingDiff:r}=this.editSession??{};if(r!=null&&n!=null){if(!n.isPartial&&Ui(r,n))return;i=r}if(!(i==null||i.isPartial))return{diffSession:{oldFile:i.type!=="new"?{name:i.prevName??i.name,lines:t?[...i.deletionLines]:i.deletionLines}:null,type:i.type,hunks:t?Fr(i.hunks):i.hunks},hasChanges:i.editSessionDirty===!0}}__attachEditor(t){if(this.type!=="file-diff")throw new Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw new Error("FileDiff.__attachEditor: an editor is already attached");if(!this.__canAttachEditor())throw new Error("FileDiff.__attachEditor: a complete diff is required before editing");const n=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(t),n}catch(i){throw n(),i}}__resumeEditor(t){if(this.editor!==t)throw new Error("FileDiff.__resumeEditor: editor association changed");this.resumeEditorRendering(t)}resumeEditorRendering(t){var s,l,a,u;const n=this.getInputDiff(),i=(s=this.editSession)==null?void 0:s.outgoingDiff;i!=null&&n!=null&&!n.isPartial&&((l=this.editSession)==null?void 0:l.diff)===i&&this.installEditSession(n);const r=this.editSession==null&&n!=null&&!n.isPartial?n:void 0;r!=null?this.installEditSession(r,t.__getDocumentContents(Eu(r)),t.__getDocumentSessionState()):this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff),this.editor=t,((a=this.getInputDiff())==null?void 0:a.isPartial)===!0&&this.loadFilesIfNecessary();const o=(u=this.editSession)==null?void 0:u.diff;this.hunksRenderer.editorRenderReady()?(o!=null&&this.hunksRenderer.diffCache===o&&this.adoptRenderData(o),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(t,n){this.settleEditSession(n==="install",t)}settleEditSession(t,n){var S,m;const{editSession:i}=this;if(i==null)return;const{diff:r,inputDiff:o,annotations:s}=i,l=(s==null?void 0:s.provided)??this.lineAnnotations;if(this.editor!=null)throw new Error("FileDiff.__completeEditSession: detach the editor before completing the session");this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();const a=s==null?void 0:s.current;let u,d=null,c=null,f=!1,h;if(n==null)throw new Error("FileDiff.__completeEditSession: editor is required for completion");const g=Or(r),p={name:g.name,contents:g.additionLines.join("")};g.lang!=null&&(p.lang=g.lang);const b={fileDiff:g,editor:n,originalFileDiff:o,oldFile:g.type==="new"?null:{name:g.prevName??g.name,contents:g.deletionLines.join("")},newFile:p,lineAnnotations:a,originalLineAnnotations:l};Object.freeze(b);try{if(n.__emitEditComplete(b),((m=(S=this.options).onEditComplete)==null?void 0:m.call(S,b))==="accept"){if(g.cacheKey!=null&&g.cacheKey===o.cacheKey)throw new Error("FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey");u=g,d=b.oldFile,c=b.newFile}}catch(v){f=!0,h=v}if(t&&u!=null&&this.additionFile!=null&&(this.deletionFile=d,this.additionFile=c),this.editSession=void 0,this.fileDiff=t&&u!=null?u:o,this.pendingData={fileDiff:this.fileDiff,lineAnnotations:t&&u!=null?a??l:l},t&&this.fileContainer!=null&&this.rerender(),f)throw h}finalizeEditSessionHunks(){const t=this.getWorkingDiff();if(t==null||t.editSessionDirty!==!0)return!1;const{collapsedContextThreshold:n=1}=this.options,i=Qd(t,this.hunksRenderer.getExpandedHunksMap(),n);return Mi(t,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(eu(t,i)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(t,n){var r;const i=(r=this.editSession)==null?void 0:r.diff;if(i==null)throw new Error("FileDiff.applyDocumentChange: requires an active edit session");this.detachAdditionLines(),this.hunksRenderer.beginEditSession(i),this.hunksRenderer.applyDocumentChange(t),n!=null&&this.syncEditSessionAnnotationsFromEditor(n),this.rerender(),this.interactionManager.setSelectionDirty()}applySuspendedDocumentChange(t,n){this.applyDocumentChange(t,n),this.hunksRenderer.clearRenderCache()}updateRenderCache(t,n,i={}){var l;const r=(l=this.editSession)==null?void 0:l.diff;if(r==null)throw new Error("FileDiff.updateRenderCache: requires an active edit session");this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);const{shouldRefreshDiffsView:o,lineCountChangeInFlight:s}=i;if(this.hunksRenderer.updateRenderCache(t,n,s,i.changedDocumentLines,i.documentLineCount)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}o===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle==="split"?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){const{diff:t,inputDiff:n}=this.editSession??{};t!=null&&(t.additionLines===(n==null?void 0:n.additionLines)||t.additionLines===t.deletionLines)&&(t.additionLines=[...t.additionLines])}isLineRenderable(t){const n=this.getRenderedDiff();if(n==null)return!0;const{expandUnchanged:i=!1,collapsedContextThreshold:r=1}=this.options;return qr({fileDiff:n,lineNumber:t,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(t,n){const i=this.getRenderedDiff();if(i==null)return t;const{expandUnchanged:r=!1,collapsedContextThreshold:o=1}=this.options;return wd({fileDiff:i,lineNumber:t,direction:n,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o})}revealLine(t){const n=this.getRenderedDiff(),{expandUnchanged:i=!1,collapsedContextThreshold:r=1,expansionLineCount:o=100}=this.options;if(n==null||n.isPartial||i)return!1;const s=this.hunksRenderer.getExpandedHunksMap();for(const[d,c]of n.hunks.entries()){const[f,h]=ut(c);if(t<f){const g=Ae({isPartial:n.isPartial,rangeSize:c.collapsedBefore,expandedHunks:s,hunkIndex:d,collapsedContextThreshold:r}),p=f-g.rangeSize;if(g.renderAll||t<p+g.fromStart||t>=f-g.fromEnd)return!1;const b=t-(p+g.fromStart)+1,S=f-g.fromEnd-t;return b<=S?this.expandHunk(d,"up",b+o):this.expandHunk(d,"down",S+o),!0}if(t<h)return!1}const l=De({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:s,collapsedContextThreshold:r,errorPrefix:"FileDiff.revealLine"});if(l==null||l.renderAll)return!1;const a=n.hunks[n.hunks.length-1],[,u]=ut(a);return t<u+l.fromStart||t>=u+l.rangeSize?!1:(this.expandHunk(n.hunks.length,"up",t-(u+l.fromStart)+1+o),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){tr(this.handleEditSessionRender)}removeRenderedCode(){var t,n,i,r,o,s;this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),(t=this.bufferBefore)==null||t.remove(),this.bufferBefore=void 0,(n=this.bufferAfter)==null||n.remove(),this.bufferAfter=void 0,(i=this.codeUnified)==null||i.remove(),this.codeUnified=void 0,(r=this.codeDeletions)==null||r.remove(),this.codeDeletions=void 0,(o=this.codeAdditions)==null||o.remove(),this.codeAdditions=void 0,(s=this.pre)==null||s.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){var t;for(const{element:n}of this.separatorCache.values())n.remove();this.separatorCache.clear();for(const{element:n}of this.annotationCache.values())n.remove();this.annotationCache.clear(),(t=this.gutterUtilityContent)==null||t.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(t){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){const n=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",n.appendChild(this.placeHolder)}return this.setPlaceholderHeight(t)}setPlaceholderHeight(t){return this.placeHolder==null?!1:(this.placeHolder.style.setProperty("height",`${t}px`),!0)}async primeHighlightCache(t=this.getInputDiff()){const{workerManager:n}=this;if(t==null||n==null||!n.isWorkingPool()||t.cacheKey==null||lt(t))return;const i=this.options.tokenizeMaxLength??1e5;Math.max(t.additionLines.length,t.deletionLines.length)>i||await n.primeDiffHighlightCache(t).catch(r=>{Ir(r)||console.error(r)})}cleanChildNodes(){var t,n,i,r,o,s,l,a,u,d,c,f,h,g,p;this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),(t=this.bufferAfter)==null||t.remove(),(n=this.bufferBefore)==null||n.remove(),(i=this.codeAdditions)==null||i.remove(),(r=this.codeDeletions)==null||r.remove(),(o=this.codeUnified)==null||o.remove(),(s=this.errorWrapper)==null||s.remove(),(l=this.headerElement)==null||l.remove(),(a=this.headerPrefix)==null||a.remove(),(u=this.headerFilenameSuffix)==null||u.remove(),(d=this.headerMetadata)==null||d.remove(),(c=this.headerCustom)==null||c.remove(),(f=this.pre)==null||f.remove(),(h=this.spriteSVG)==null||h.remove(),(g=this.themeCSSStyle)==null||g.remove(),(p=this.unsafeCSSStyle)==null||p.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(t){const{hunkSeparators:n}=this.options;if(this.isComponentManaged||this.fileContainer==null||typeof n!="function"){for(const{element:r}of this.separatorCache.values())r.remove();this.separatorCache.clear();return}const i=new Map(this.separatorCache);for(const r of t){const o=r.slotName;let s=this.separatorCache.get(o);if(s==null||!Su(r,s.hunkData)){s==null||s.element.remove();const l=document.createElement("div");l.style.display="contents",l.slot=r.slotName;const a=n(r,this);a!=null&&l.appendChild(a),this.fileContainer.appendChild(l),s={element:l,hunkData:r},this.separatorCache.set(o,s)}i.delete(o)}for(const[r,{element:o}]of i.entries())this.separatorCache.delete(r),o.remove()}renderAnnotations(){if(this.isComponentManaged||this.fileContainer==null){for(const{element:r}of this.annotationCache.values())r.remove();this.annotationCache.clear();return}const t=new Map(this.annotationCache),{renderedData:n,options:{renderAnnotation:i}}=this;if(i!=null&&n!=null){const{fileDiff:r,lineAnnotations:o}=n;for(const[s,l]of o.entries()){const a=this.getAnnotationSlotName(l),u=`${s}-${a}`;let d=this.annotationCache.get(u);if(d==null||d.fileDiff!==r||!yu(l,d.annotation)){d==null||d.element.remove();const c=i(l,r);if(c==null)continue;d={element:nl(a),annotation:l,fileDiff:r},d.element.appendChild(c),this.fileContainer.appendChild(d.element),this.annotationCache.set(u,d)}t.delete(u)}}for(const[r,{element:o}]of t.entries())this.annotationCache.delete(r),o.remove()}renderGutterUtility(){var r,o;const{renderGutterUtility:t}=this.options;if(this.fileContainer==null||t==null){(r=this.gutterUtilityContent)==null||r.remove(),this.gutterUtilityContent=void 0;return}const n=t(this.interactionManager.getHoveredLine);if(n!=null&&this.gutterUtilityContent!=null)return;if(n==null){(o=this.gutterUtilityContent)==null||o.remove(),this.gutterUtilityContent=void 0;return}const i=il();i.appendChild(n),this.fileContainer.appendChild(i),this.gutterUtilityContent=i}getOrCreateFileContainer(t,n){var s;const{fileContainer:i}=this,r=t??i??document.createElement("diffs-container"),o=i!==r;return i!=null&&o&&((s=this.editor)==null||s.__captureFocusForDOMReplacement()),o&&this.emitPostRender(!0),this.fileContainer=r,i!=null&&o&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),n!=null&&this.fileContainer.parentNode!==n&&n.appendChild(this.fileContainer),o&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(t){const{shadowRoot:n}=t;if(n!=null)for(const i of n.children)i instanceof SVGElement?this.spriteSVG??(this.spriteSVG=i):mi(i)&&i.hasAttribute("data-theme-css")?(this.themeCSSStyle??(this.themeCSSStyle=i),this.hasAdoptedThemeCSS=!0):mi(i)&&i.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle??(this.unsafeCSSStyle=i),this.appliedUnsafeCSS??(this.appliedUnsafeCSS=this.options.unsafeCSS??void 0))}ensureSpriteSVG(t){const n=t.shadowRoot??t.attachShadow({mode:"open"});if(this.spriteSVG==null){const i=document.createElement("div");i.innerHTML=Qa;const r=i.firstChild;r instanceof SVGElement&&(this.spriteSVG=r)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==n&&n.appendChild(this.spriteSVG)}getOrCreatePreNode(t){var i,r;const n=t.shadowRoot??t.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,n.appendChild(this.pre)):this.pre.parentNode!==n&&((i=this.editor)==null||i.__captureFocusForDOMReplacement(),n.appendChild(this.pre),this.appliedPreAttributes=void 0),(r=this.placeHolder)==null||r.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(t){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(const n of Array.from(t.children))n instanceof HTMLElement&&(n.hasAttribute("data-unified")?this.codeUnified=n:n.hasAttribute("data-deletions")?this.codeDeletions=n:n.hasAttribute("data-additions")&&(this.codeAdditions=n))}applyHeaderToDOM(t,n,i){var p,b,S,m,v,C,y,x;this.cleanupErrorWrapper(),(p=this.placeHolder)==null||p.remove(),this.placeHolder=void 0;const{headerCache:{fileDiff:r,html:o,lastRenderedHTML:s}}=this,l=(i!==((b=this.editSession)==null?void 0:b.diff)&&j(r,i)?o:void 0)??Pe(t);if(this.headerCache.html=l,this.headerCache.fileDiff=i,l!==s){const L=document.createElement("div");L.innerHTML=l;const k=L.firstElementChild;if(!(k instanceof HTMLElement))return;this.headerElement!=null?(S=n.shadowRoot)==null||S.replaceChild(k,this.headerElement):(m=n.shadowRoot)==null||m.prepend(k),this.headerElement=k,this.headerCache.lastRenderedHTML=l}if(this.isComponentManaged)return;const{renderCustomHeader:a,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:c}=this.options;if(a!=null){const L=a(i)??void 0;this.headerCustom=this.upsertHeaderSlotElement(n,this.headerCustom,Dn,L),(v=this.headerPrefix)==null||v.remove(),(C=this.headerFilenameSuffix)==null||C.remove(),(y=this.headerMetadata)==null||y.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}const f=(u==null?void 0:u(i))??void 0,h=(d==null?void 0:d(i))??void 0,g=(c==null?void 0:c(i))??void 0;this.headerPrefix=this.upsertHeaderSlotElement(n,this.headerPrefix,Yi,f),this.headerFilenameSuffix=this.upsertHeaderSlotElement(n,this.headerFilenameSuffix,Xi,h),this.headerMetadata=this.upsertHeaderSlotElement(n,this.headerMetadata,Zi,g),(x=this.headerCustom)==null||x.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){var t,n,i,r;(t=this.headerPrefix)==null||t.remove(),(n=this.headerFilenameSuffix)==null||n.remove(),(i=this.headerMetadata)==null||i.remove(),(r=this.headerCustom)==null||r.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(t,n,i,r){if(r==null){n==null||n.remove();return}const o=n??this.createHeaderSlotElement(i);return n==null&&t.appendChild(o),this.replaceHeaderSlotContent(o,r),o}replaceHeaderSlotContent(t,n){t.replaceChildren(),n instanceof Element?t.appendChild(n):t.innerText=`${n}`}createHeaderSlotElement(t){const n=document.createElement("div");return n.slot=t,n}injectUnsafeCSS(){var i,r,o;const{unsafeCSS:t}=this.options;(i=this.pre)==null||i.toggleAttribute("data-custom-styles",!!t);const n=(r=this.fileContainer)==null?void 0:r.shadowRoot;if(n!=null){if(t==null||t===""){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}((o=this.unsafeCSSStyle)==null?void 0:o.parentNode)===n&&this.appliedUnsafeCSS===t||(this.unsafeCSSStyle??(this.unsafeCSSStyle=rl()),this.unsafeCSSStyle.parentNode!==n&&n.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=al(t),this.appliedUnsafeCSS=t)}}applyThemeState(t,n,i,r){var d,c,f;const o=t.shadowRoot??t.attachShadow({mode:"open"}),s=r??i,l=this.getTheme(),a=typeof l=="string"?l:{...l},u=bn(o);if(((d=this.themeCSSStyle)==null?void 0:d.parentNode)===o&&((c=this.appliedThemeCSS)==null?void 0:c.themeStyles)===n&&this.appliedThemeCSS.themeType===s&&this.appliedThemeCSS.scrollbarGutter===u){this.appliedThemeCSS.theme=a;return}if(this.hasAdoptedThemeCSS&&((f=this.themeCSSStyle)==null?void 0:f.parentNode)===o){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:a,themeStyles:n,themeType:s,baseThemeType:r,scrollbarGutter:u};return}this.themeCSSStyle=yl({shadowRoot:o,currentNode:this.themeCSSStyle,themeCSS:ll(n,s,u)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:a,themeStyles:n,themeType:s,baseThemeType:r,scrollbarGutter:u}:void 0}hydrateMeasuredScrollbar(){var n;const t=(n=this.fileContainer)==null?void 0:n.shadowRoot;t==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=dl(this.themeCSSStyle.textContent??"",bn(t)))}shouldGuardRebuildScroll(){return this.editor!=null&&pl()}applyHunksToDOM(t,n){this.shouldGuardRebuildScroll()?bi(t,()=>this.replaceCodeColumns(t,n)):this.replaceCodeColumns(t,n)}applyCodeColumnsInPlace(t,n,i){const r=this.getColumnPair(t);if(r==null)return!1;const o=Me(n[0]),s=Me(n[1]);return o==null||s==null?!1:(r.gutter.innerHTML=Pe(o),r.content.innerHTML=Pe(s),i!==this.lastRowCount&&(r.gutter.style.setProperty("grid-row",`span ${i}`),r.content.style.setProperty("grid-row",`span ${i}`)),!0)}replaceCodeColumns(t,n){var c,f,h,g,p,b,S,m,v,C;const{overflow:i="scroll"}=this.options,r=(this.options.hunkSeparators??"line-info")==="line-info",o=i==="wrap"?n.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,n);let s=!1;const l=[],a=this.hunksRenderer.renderCodeAST("unified",n),u=this.hunksRenderer.renderCodeAST("deletions",n),d=this.hunksRenderer.renderCodeAST("additions",n);(c=this.editor)==null||c.__captureFocusForDOMReplacement(),a!=null?(s=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,(f=this.codeDeletions)==null||f.remove(),this.codeDeletions=void 0,(h=this.codeAdditions)==null||h.remove(),this.codeAdditions=void 0,this.codeUnified=Yt({code:this.codeUnified,columnType:"unified",rowSpan:o,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,a,n.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(a)),l.push(this.codeUnified)):u!=null||d!=null?(u!=null?(s=this.codeDeletions==null||this.codeUnified!=null,(g=this.codeUnified)==null||g.remove(),this.codeUnified=void 0,this.codeDeletions=Yt({code:this.codeDeletions,columnType:"deletions",rowSpan:o,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,u,n.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(u)),l.push(this.codeDeletions)):((p=this.codeDeletions)==null||p.remove(),this.codeDeletions=void 0),d!=null?(s=s||this.codeAdditions==null||this.codeUnified!=null,(b=this.codeUnified)==null||b.remove(),this.codeUnified=void 0,this.codeAdditions=Yt({code:this.codeAdditions,columnType:"additions",rowSpan:o,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,d,n.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(d)),l.push(this.codeAdditions)):((S=this.codeAdditions)==null||S.remove(),this.codeAdditions=void 0)):((m=this.codeUnified)==null||m.remove(),this.codeUnified=void 0,(v=this.codeDeletions)==null||v.remove(),this.codeDeletions=void 0,(C=this.codeAdditions)==null||C.remove(),this.codeAdditions=void 0),l.length===0?t.textContent="":s&&t.replaceChildren(...l),this.lastRowCount=n.rowCount}applyPartialRender({fileDiff:t,previousRenderRange:n,renderRange:i}){const{pre:r,codeUnified:o,codeAdditions:s,codeDeletions:l,options:{diffStyle:a="split"}}=this;if(r==null||n==null||i==null||!Number.isFinite(n.totalLines)||!Number.isFinite(i.totalLines)||this.lastRowCount==null)return!1;const u=this.getCodeColumns(a,o,l,s);if(u==null)return!1;const d=n.startingLine,c=i.startingLine,f=d+n.totalLines,h=c+i.totalLines,g=Math.max(d,c),p=Math.min(f,h);if(p<=g)return!1;const b=Math.max(0,g-d),S=Math.max(0,f-p),m=this.trimColumns({columns:u,trimStart:b,trimEnd:S,previousStart:d,overlapStart:g,overlapEnd:p,diffStyle:a});if(m<0)throw new Error("FileDiff.applyPartialRender: failed to trim to overlap");if(this.lastRowCount<m)throw new Error("FileDiff.applyPartialRender: trimmed beyond DOM row count");let v=this.lastRowCount-m;const C=(k,R)=>{if(!(R<=0))return this.hunksRenderer.renderDiff(t,{startingLine:k,totalLines:R,bufferBefore:0,bufferAfter:0})},y=C(c,Math.max(g-c,0));if(y==null&&c<g)return!1;const x=C(p,Math.max(h-p,0));if(x==null&&h>p)return!1;const L=(k,R)=>{if(k!=null){if(a==="unified"&&!Array.isArray(u))this.insertPartialHTML(a,u,k,R);else if(a==="split"&&Array.isArray(u))this.insertPartialHTML(a,u,k,R);else throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");v+=k.rowCount,this.adoptRenderData(k.fileDiff)}};return this.cleanupErrorWrapper(),L(y,"afterbegin"),L(x,"beforeend"),this.lastRowCount!==v&&(this.applyRowSpan(a,u,v),this.lastRowCount=v),!0}insertPartialHTML(t,n,i,r){if(t==="unified"&&!Array.isArray(n)){const o=this.hunksRenderer.renderCodeAST("unified",i);this.renderPartialColumn(n,o,r)}else if(t==="split"&&Array.isArray(n)){const o=this.hunksRenderer.renderCodeAST("deletions",i),s=this.hunksRenderer.renderCodeAST("additions",i);this.renderPartialColumn(n[0],o,r),this.renderPartialColumn(n[1],s,r)}else throw new Error("FileDiff.insertPartialHTML: Invalid argument composition")}refreshSplitDiffView(){const t=this.getWorkingDiff();if(this.options.diffStyle!=="split"||t==null)return;const n=this.hunksRenderer.renderDiff(t,this.renderRange);if(n==null)return;const i=this.getCodeColumns("split",this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(i))return;const r=(o,s)=>{if(s==null)return;const l=this.hunksRenderer.renderCodeAST(o,n),a=Me(l==null?void 0:l[0]),u=Me(l==null?void 0:l[1]);for(const[d,c]of[[s.gutter,a],[s.content,u]])if(c!=null&&d.childElementCount===c.length)for(let f=0;f<c.length;f++){const h=d.children[f],g=c[f].properties["data-line-type"];g!=null&&h.dataset.lineType!==g&&(h.dataset.lineType=g)}};r("deletions",i[0]),r("additions",i[1]),this.adoptRenderData(n.fileDiff)}refreshUnifiedDiffView(){const t=this.getWorkingDiff();if(this.options.diffStyle!=="unified"||t==null)return;const n=this.hunksRenderer.renderDiff(t,this.renderRange);if(n==null)return;const i=this.getCodeColumns("unified",this.codeUnified,this.codeDeletions,this.codeAdditions);if(i==null||Array.isArray(i))return;const r=this.hunksRenderer.renderCodeAST("unified",n),o=Me(r==null?void 0:r[0]),s=Me(r==null?void 0:r[1]),l=()=>{for(const[a,u]of[[i.gutter,o],[i.content,s]])u!=null&&(a.innerHTML=Pe(u));n.rowCount!==this.lastRowCount&&(this.applyRowSpan("unified",i,n.rowCount),this.lastRowCount=n.rowCount),this.adoptRenderData(n.fileDiff)};this.shouldGuardRebuildScroll()?bi(this.pre,l):l(),this.renderSeparators(n.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(t,n,i){if(t==null||n==null)return;const r=Me(n[0]),o=Me(n[1]);if(r==null||o==null)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");const s=o.at(0);i==="beforeend"&&(s==null?void 0:s.type)==="element"&&typeof s.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(s.properties["data-buffer-size"],t.content.children[t.content.children.length-1],t.gutter.children[t.gutter.children.length-1],r,o,!0);const l=o.at(-1);i==="afterbegin"&&(l==null?void 0:l.type)==="element"&&typeof l.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(l.properties["data-buffer-size"],t.content.children[0],t.gutter.children[0],r,o,!1),t.gutter.insertAdjacentHTML(i,this.hunksRenderer.renderPartialHTML(r)),t.content.insertAdjacentHTML(i,this.hunksRenderer.renderPartialHTML(o))}mergeBuffersIfNecessary(t,n,i,r,o,s){if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement))return;const l=this.getBufferSize(n.dataset);l!=null&&(s?(r.shift(),o.shift()):(r.pop(),o.pop()),this.updateBufferSize(n,l+t),this.updateBufferSize(i,l+t))}applyRowSpan(t,n,i){const r=o=>{o!=null&&(o.gutter.style.setProperty("grid-row",`span ${i}`),o.content.style.setProperty("grid-row",`span ${i}`))};if(t==="unified"&&!Array.isArray(n))r(n);else if(t==="split"&&Array.isArray(n))r(n[0]),r(n[1]);else throw new Error("dun fuuuuked up")}trimColumnRows(t,n,i){let r=0,o=0,s=0,l=!1;const a=i>=0;if(t==null)return 0;const u=Array.from(t.content.children),d=Array.from(t.gutter.children);if(u.length!==d.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;s<u.length&&!(n<=0&&!a&&!l);){const c=d[s],f=u[s];if(s++,!(c instanceof HTMLElement)||!(f instanceof HTMLElement))throw console.error({gutterElement:c,contentElement:f}),new Error("FileDiff.trimColumnRows: invalid row elements");if(l&&(l=!1,c.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in f.dataset||c.dataset.gutterBuffer==="metadata"&&"noNewline"in f.dataset)){c.remove(),f.remove(),o++;continue}if("lineIndex"in c.dataset&&"lineIndex"in f.dataset){(n>0||a&&r>=i)&&(c.remove(),f.remove(),n>0&&(n--,n===0&&(l=!0)),o++),r++;continue}if("separator"in c.dataset&&"separator"in f.dataset){(n>0||a&&r>=i)&&(c.remove(),f.remove(),o++);continue}if(c.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in f.dataset){(n>0||a&&r>=i)&&(c.remove(),f.remove(),o++);continue}if(c.dataset.gutterBuffer==="metadata"&&"noNewline"in f.dataset){(n>0||a&&r>=i)&&(c.remove(),f.remove(),o++);continue}if(c.dataset.gutterBuffer==="buffer"&&"contentBuffer"in f.dataset){const h=this.getBufferSize(f.dataset);if(h==null)throw new Error("FileDiff.trimColumnRows: invalid element");if(n>0){const g=Math.min(n,h),p=h-g;p>0?(this.updateBufferSize(c,p),this.updateBufferSize(f,p),o+=g):(c.remove(),f.remove(),o+=h),n-=g,n===0&&p===0&&(l=!0)}else if(a){const g=r,p=r+h-1;if(i<=g)c.remove(),f.remove(),o+=h;else if(i<=p){const b=p-i+1,S=h-b;this.updateBufferSize(c,S),this.updateBufferSize(f,S),o+=b}}r+=h;continue}throw console.error({gutterElement:c,contentElement:f}),new Error("FileDiff.trimColumnRows: unknown row elements")}return o}trimColumns({columns:t,diffStyle:n,overlapEnd:i,overlapStart:r,previousStart:o,trimEnd:s,trimStart:l}){const a=Math.max(0,r-o),u=i-o;if(u<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");const d=l>0,c=s>0;if(!d&&!c)return 0;const f=d?a:0,h=c?u:-1;if(n==="unified"&&!Array.isArray(t))return this.trimColumnRows(t,f,h);if(n==="split"&&Array.isArray(t)){const g=this.trimColumnRows(t[0],f,h),p=this.trimColumnRows(t[1],f,h);if(t[0]!=null&&t[1]!=null&&g!==p)throw new Error("FileDiff.trimColumns: split columns out of sync");return t[0]!=null?g:p}else throw console.error({diffStyle:n,columns:t}),new Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(t){const n=Number.parseInt((t==null?void 0:t.bufferSize)??"",10);return Number.isNaN(n)?void 0:n}updateBufferSize(t,n){t.dataset.bufferSize=`${n}`,t.style.setProperty("grid-row",`span ${n}`),t.style.setProperty("min-height",`calc(${n} * 1lh)`)}getColumnPair(t){if(t==null)return;const n=t.children[0],i=t.children[1];if(!(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||n.dataset.gutter==null||i.dataset.content==null))return{gutter:n,content:i}}getCodeColumns(t,n,i,r){if(t==="unified")return this.getColumnPair(n);{const o=this.getColumnPair(i),s=this.getColumnPair(r);return o!=null||s!=null?[o,s]:void 0}}updateBuffers(t){this.pre!=null&&this.applyBuffers(this.pre,t)}applyBuffers(t,n){if(n==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}n.bufferBefore>0?(this.bufferBefore==null&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",t.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${n.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),n.bufferAfter>0?(this.bufferAfter==null&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",t.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${n.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(t,{additionsContentAST:n,deletionsContentAST:i,totalLines:r},o){const{diffIndicators:s="bars",disableBackground:l=!1,disableLineNumbers:a=!1,overflow:u="scroll",diffStyle:d="split"}=this.options,c={type:"diff",diffIndicators:s,disableBackground:l,disableLineNumbers:a,overflow:u,split:d==="unified"?!1:n!=null&&i!=null,totalLines:r,customProperties:o};el(c,this.appliedPreAttributes)||(fl(t,c),this.appliedPreAttributes=c)}applyErrorToDOM(t,n){var s;this.cleanupErrorWrapper(),(s=this.pre)==null||s.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const i=n.shadowRoot??n.attachShadow({mode:"open"});this.errorWrapper??(this.errorWrapper=document.createElement("div")),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",i.appendChild(this.errorWrapper);const r=document.createElement("div");r.dataset.errorMessage="",r.innerText=t.message,this.errorWrapper.appendChild(r);const o=document.createElement("pre");o.dataset.errorStack="",o.innerText=t.stack??"No Error Stack",this.errorWrapper.appendChild(o)}cleanupErrorWrapper(){var t;(t=this.errorWrapper)==null||t.remove(),this.errorWrapper=void 0}},w(sn,"LoadedCustomComponent",!0),sn);function Eu(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join("")}}function _i(e,t){return e==null||t==null?e==null&&t==null:Nr(e,t)}function Ru({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Au({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Du(e,t,n=!1){return!n&&e==null&&t}function Tu(e,t,n=!1){return e==null&&t&&!n}function Me(e){if(!(e==null||e.type!=="element"))return e.children??[]}function Hu({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:i,expandUnchanged:r,expandedHunks:o,collapsedContextThreshold:s,canHydratePartialDiff:l}){var f,h,g;let a=st(t,n),u=a;const d=r?!0:o,c=e.hunks.length-1;for(let p=0;p<e.hunks.length;p++){const b=e.hunks[p];if(b==null)throw new Error("computeEstimatedDiffHeights: invalid hunk index");const S=Ae({isPartial:e.isPartial,rangeSize:b.collapsedBefore,expandedHunks:d,hunkIndex:p,collapsedContextThreshold:s}),m=(S.fromStart+S.fromEnd)*t.lineHeight;if(a+=m,u+=m,S.collapsedLines>0){const y=((f=at({type:i,metrics:t,hunkIndex:p,hunkSpecs:b.hunkSpecs}))==null?void 0:f.totalHeight)??0;a+=y,u+=y}a+=b.splitLineCount*t.lineHeight,u+=b.unifiedLineCount*t.lineHeight;const v=Mu(b);a+=v.split*t.lineHeight,u+=v.unified*t.lineHeight;const C=p===c?De({fileDiff:e,hunkIndex:p,expandedHunks:d,collapsedContextThreshold:s,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(C!=null){const y=(C.fromStart+C.fromEnd)*t.lineHeight;if(a+=y,u+=y,C.collapsedLines>0){const x=((h=Oe({type:i,metrics:t}))==null?void 0:h.totalHeight)??0;a+=x,u+=x}}else if(p===c&&e.isPartial&&l){const y=((g=Oe({type:i,metrics:t}))==null?void 0:g.totalHeight)??0;a+=y,u+=y}}if(e.hunks.length>0){const p=Pr(t);a+=p,u+=p}return{splitHeight:a,unifiedHeight:u}}function Mu(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 Iu(e,t)}function Iu(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 An=3e3,Et=new Map;let Pu=-1;var Nu=class extends eo{constructor(t,n,i,r,o){super(t,r,o);w(this,"__id",`little-virtualized-file-diff:${++Pu}`);w(this,"renderType","virtualized");w(this,"top");w(this,"height",0);w(this,"metrics");w(this,"cache",{heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:Et,ghostTextRowsByIndex:new Map});w(this,"isVisible",!1);w(this,"isSetup",!1);w(this,"virtualizer");w(this,"layoutDirty",!0);w(this,"currentCollapsed");w(this,"pendingHydratedDiff");w(this,"pendingExpansions");w(this,"pendingRender");w(this,"onRender",t=>this.fileContainer==null?!1:(t&&(this.top=this.getVirtualizedTop()),this.render()));w(this,"expandHunk",(t,n,i)=>{this.getInputDiff()!=null&&(this.loadFilesIfNecessary(),this.isAdvancedMode()?(this.pendingExpansions??(this.pendingExpansions=[]),this.pendingExpansions.push({hunkIndex:t,direction:n,expansionLineCountOverride:i})):(this.hunksRenderer.expandHunk(t,n,i),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))});this.virtualizer=n,this.metrics=Xt(i)}setMetrics(t,n=!1){const i=Xt(t);!n&&un(this.metrics,i)||(this.metrics=i,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(t){this.syncLineAnnotations(t)&&(this.forceRenderOverride=!0)}syncLineAnnotations(t){return t==null||!this.isNewAnnotations(t)||t.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(t),!0)}syncEditSessionAnnotationsFromEditor(t){return super.syncEditSessionAnnotationsFromEditor(t)?(this.forceRenderOverride=!0,!0):!1}setFileAnnotationHeight(t){const n=this.cache.fileAnnotationHeight;return t===n?!1:(this.cache.fileAnnotationHeight=t,this.cache.measuredHeightDeltaTotal+=t-n,!0)}hasFileAnnotations(t){const n=this.getLayoutAnnotations();return Xa(n)?n.some(i=>i.lineNumber!==0?!1:t.type==="new"?i.side==="additions":t.type==="deleted"?i.side==="deletions":!0):!1}getLineHeight(t,n=!1){return this.getEstimatedLineHeight(n)+(this.cache.heightDeltas.get(t)??0)}getEstimatedLineHeight(t=!1){const n=t?2:1;return this.metrics.lineHeight*n}setOptions(t){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(t==null)return;const{options:n}=this,i=!ir(n,t),r=i&&$u(n,t);super.setOptions(t),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Wu(n,t)}),i&&(this.forceRenderOverride=!0),i&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(t){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(t)}resetLayoutCache({forceSimpleRecompute:t=!1,includeEstimatedHeights:n=!1,resetRenderRange:i=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=Et,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(n,i),t&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(t,n=!0){this.layoutDirty=!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&&n&&(this.renderRange=void 0)}applyGhostTextRows(t,n){const{cache:{heightDeltas:i,ghostTextRows:r,ghostTextRowsByIndex:o},metrics:{lineHeight:s}}=this;if(r===n)return!1;const l=this.getDiffStyle(),a=new Map;for(const[d,c]of n){const f=this.getLineIndexForDiff(t,d+1,"additions");f!=null&&a.set(l==="split"?f[1]:f[0],c)}let u=!1;for(const d of new Set([...o.keys(),...a.keys()])){const c=((a.get(d)??0)-(o.get(d)??0))*s;if(c===0)continue;const f=(i.get(d)??0)+c;f===0?i.delete(d):i.set(d,f),this.cache.measuredHeightDeltaTotal+=c,u=!0}return this.cache.ghostTextRows=n,this.cache.ghostTextRowsByIndex=a,u}reconcileHeights(){var u;let t=!1;const{options:{overflow:n="scroll"},metrics:{lineHeight:i}}=this,r=this.placeHolder!=null?this.getLayoutDiff():this.getRenderedDiff();if(this.fileContainer==null||r==null)return this.height!==0&&(t=!0),this.height=0,t;this.top=this.getVirtualizedTop(),t=this.applyGhostTextRows(r,((u=this.editor)==null?void 0:u.__getGhostTextRows())??Et);const{ghostTextRowsByIndex:o}=this.cache,s=n!=="scroll"||this.lineAnnotations.length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!s&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0)return t&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),t;const l=this.getDiffStyle(),a=l==="split"?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];if(this.renderRange!=null&&Tr(this.renderRange)){const d=Fu(a)??0;this.setFileAnnotationHeight(d)&&(t=!0)}for(const d of a){if(d==null)continue;const c=d.children[1];if(!(c instanceof HTMLElement))continue;const f=l==="split"&&d===this.codeDeletions;for(const h of c.children){if(!(h instanceof HTMLElement))continue;const g=h.dataset.lineIndex;if(g==null)continue;const p=Vu(g,l),b=o.get(p)??0;if(f&&b>0)continue;const S=this.cache.heightDeltas.get(p)??0;if(!s&&S===b*i)continue;let m=h.getBoundingClientRect().height+b*i,v=!1;h.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in h.nextElementSibling.dataset||"noNewline"in h.nextElementSibling.dataset)&&("noNewline"in h.nextElementSibling.dataset&&(v=!0),m+=h.nextElementSibling.getBoundingClientRect().height);const C=this.getEstimatedLineHeight(v),y=m-C;y!==S&&(t=!0,this.cache.measuredHeightDeltaTotal+=y-S,y===0?this.cache.heightDeltas.delete(p):this.cache.heightDeltas.set(p,y))}}return(t||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),t}flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(t,n,i,r){let o=!1,s=!1;const{pendingExpansions:l,pendingHydratedDiff:a,options:{collapsed:u=!1}}=this;if(a!=null&&(this.pendingHydratedDiff=void 0,a.expectedDiff===t&&(Object.assign(t,a.nextDiff),this.setHydratedState(a.files),this.installHydratedSessionDiff(t),this.forceRenderOverride=!0,o=!0,s=!0)),l!=null){this.pendingExpansions=void 0;for(const{hunkIndex:p,direction:b,expansionLineCountOverride:S}of l)this.hunksRenderer.expandHunk(p,b,S),this.forceRenderOverride=!0,s=!0}const d=this.updateInputDiff(t,r),{pendingRenderDiff:c,layoutDiffChanged:f,renderedDiffChanged:h,annotationsChanged:g}=this.updatePendingRender(t,r);return!this.forceRenderOverride&&(d||h||g)&&(this.forceRenderOverride=!0),((i==null?void 0:i.resetDiffLayoutCache)===!0||f)&&(o=!0),(f||(i==null?void 0:i.resetDiffLayoutCache)===!0&&i.includeEstimatedDiffHeights)&&(s=!0),(i==null?void 0:i.metrics)!=null&&(this.metrics=Xt(i.metrics),o=!0,s=!0),this.currentCollapsed!==u&&(this.currentCollapsed=u,o=!0),o?this.resetLayoutCache({includeEstimatedHeights:s}):s&&this.invalidateDerivedLayoutCache(!0),this.top=n,this.computeApproximateSize(!1,c),this.height}getLinePosition(t,n="additions"){const i=this.getLayoutDiff();if(i==null||t<1)return;const r=this.getLineIndexForDiff(i,t,n);if(r==null)return;const{disableFileHeader:o=!1,expandUnchanged:s=!1,collapsed:l=!1,collapsedContextThreshold:a=1}=this.options,u=this.getDiffStyle(),d=this.getHunkSeparatorType(),c=u==="split"?r[1]:r[0];this.approximateLayoutCheckpoints(i);const f=st(this.metrics,o),h=this.getLayoutCheckpointBeforeLineIndex(c);let g=(h==null?void 0:h.top)??f+this.cache.fileAnnotationHeight;if(l)return{top:yn(this.metrics,o),height:0};let p;return _e({diff:i,diffStyle:u,startingLine:(h==null?void 0:h.renderedLineIndex)??0,expandedHunks:s?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:b,hunk:S,collapsedBefore:m,collapsedAfter:v,deletionLine:C,additionLine:y})=>{const x=u==="split"?(y==null?void 0:y.splitLineIndex)??(C==null?void 0:C.splitLineIndex):(y==null?void 0:y.unifiedLineIndex)??(C==null?void 0:C.unifiedLineIndex);if(x==null)throw new Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(m>0){const k=at({type:d,metrics:this.metrics,hunkIndex:b,hunkSpecs:S==null?void 0:S.hunkSpecs});if(k!=null){if(g+=k.gapBefore,c>=x-m&&c<x)return p={top:g,height:k.height},!0;g+=k.height+k.gapAfter}}const L=this.getLineHeight(x,((y==null?void 0:y.noEOFCR)??!1)||((C==null?void 0:C.noEOFCR)??!1));if(x===c)return p={top:g,height:L},!0;if(g+=L,v>0){const k=Oe({type:d,metrics:this.metrics});if(k!=null){if(c>x&&c<=x+v)return p={top:g+k.gapBefore,height:k.height},!0;g+=k.totalHeight}}return!1}}),p}getEditorViewport(){return this.virtualizer.type==="simple"?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(t){const n=this.getLayoutDiff();if(n==null)return;const{disableFileHeader:i=!1,expandUnchanged:r=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options;if(o)return;const l=this.getDiffStyle(),a=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(n);const u=this.getLayoutCheckpointBeforeTop(t);let d=(u==null?void 0:u.top)??st(this.metrics,i)+this.cache.fileAnnotationHeight,c;return _e({diff:n,diffStyle:l,startingLine:(u==null?void 0:u.renderedLineIndex)??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:f,hunk:h,collapsedBefore:g,collapsedAfter:p,deletionLine:b,additionLine:S})=>{const m=l==="split"?(S==null?void 0:S.splitLineIndex)??(b==null?void 0:b.splitLineIndex):(S==null?void 0:S.unifiedLineIndex)??(b==null?void 0:b.unifiedLineIndex);if(m==null)throw new Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(g>0){const C=at({type:a,metrics:this.metrics,hunkIndex:f,hunkSpecs:h==null?void 0:h.hunkSpecs});C!=null&&(d+=C.totalHeight)}if(d>=t&&(b!=null?c={lineNumber:b.lineNumber,side:"deletions",top:d}:S!=null&&(c={lineNumber:S.lineNumber,side:"additions",top:d}),c!=null))return!0;const v=this.getLineHeight(m,((S==null?void 0:S.noEOFCR)??!1)||((b==null?void 0:b.noEOFCR)??!1));if(d+=v,p>0){const C=Oe({type:a,metrics:this.metrics});C!=null&&(d+=C.totalHeight)}return!1}}),c}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(t){const n=this.getLayoutDiff();if(this.top==null||n==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};const i=t!=null?this.computeRenderRangeFromWindow(n,this.top,t):this.renderRange;if(i==null)return;const{bufferBefore:r,bufferAfter:o,totalLines:s}=i;let l=0;if(s===0){const a=t??this.virtualizer.getWindowSpecs();this.top<a.top&&(l=o)}return{topOffset:this.top+r+l,height:this.height-(r+o)}}cleanUp(t=!1){var r;const n=this.cache.ghostTextRows.size>0;n&&(this.layoutDirty=!0);const i=t&&this.isAdvancedMode()&&this.fileContainer!=null&&(n||!j(this.getRenderedDiff(),this.getWorkingDiff()));this.fileContainer!=null&&this.isSimpleMode()&&((r=this.getSimpleVirtualizer())==null||r.disconnect(this.fileContainer)),t||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(t),i&&this.virtualizer.instanceChanged(this,!0)}async handleFilesLoaded(t,n){if(!(this.getInputDiff()!==t||!t.isPartial)){if(this.isAdvancedMode()){const i=Sn("clone",t,n);if(await En(()=>this.primeHighlightCache(i)),this.getInputDiff()!==t)return;this.pendingHydratedDiff={expectedDiff:t,nextDiff:i,files:n}}else{if(Sn("merge",t,n),this.setHydratedState(n),!this.installHydratedSessionDiff(t)&&(await En(()=>this.primeHighlightCache(t)),this.getInputDiff()!==t))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.getInputDiff())return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(t){if(super.isLineRenderable(t))return!0;const{pendingExpansions:n}=this,i=this.getRenderedDiff();if(n==null||n.length===0||i==null)return!1;const{expansionLineCount:r=100,collapsedContextThreshold:o=1}=this.options,s=new Map(this.hunksRenderer.getExpandedHunksMap());for(const l of n){const a={...s.get(l.hunkIndex)??{fromStart:0,fromEnd:0}},u=l.expansionLineCountOverride??r;(l.direction==="up"||l.direction==="both")&&(a.fromStart+=u),(l.direction==="down"||l.direction==="both")&&(a.fromEnd+=u),s.set(l.hunkIndex,a)}return qr({fileDiff:i,lineNumber:t,expandedHunks:s,collapsedContextThreshold:o})}invalidateEditSessionLayout(){var t,n;(t=this.getSimpleVirtualizer())==null||t.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),(n=this.getSimpleVirtualizer())==null||n.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.getInputDiff()==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(t){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,t&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!t&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.getInputDiff()==null&&this.additionFile==null&&this.deletionFile==null)return;const t=this.getWorkingDiff(),n=t==null?void 0:this.hunksRenderer.getDiffForNextRender(t);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,!(this.isSimpleMode()&&this.requestRender())&&this.virtualizer.instanceChanged(this,!j(this.getRenderedDiff(),n))}get isComponentManaged(){var t;return((t=this.getAdvancedVirtualizer())==null?void 0:t.isComponentManaged)??super.isComponentManaged}syncGhostTextRows(){var n;const t=this.getAdvancedVirtualizer();t!=null?(t.capturePendingLayoutAnchor(),this.layoutDirty=!0,t.instanceChanged(this,!0)):(n=this.getSimpleVirtualizer())==null||n.requestHeightReconcile(this)}applyDocumentChange(t,n,i=!1){var s,l;const{renderRange:r}=this;(s=this.getAdvancedVirtualizer())==null||s.capturePendingLayoutAnchor(),super.applyDocumentChange(t,n),(l=this.getSimpleVirtualizer())==null||l.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});const o=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(i&&r!=null&&o!=null){const a=this.virtualizer.getWindowSpecs(),u=this.computeRenderRangeFromWindow(o,this.top??0,a);u.bufferAfter!==r.bufferAfter&&this.updateBuffers(u)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(t=!1,n=this.getLayoutDiff()){var l;const i=this.isResizeDebuggingEnabled();if(!t&&!this.layoutDirty&&!i)return;const r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,n==null){this.layoutDirty=!1;return}this.applyGhostTextRows(n,((l=this.editor)==null?void 0:l.__getGhostTextRows())??Et);const{disableFileHeader:o=!1,collapsed:s=!1}=this.options;if(s){this.height+=yn(this.metrics,o),this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(n)+this.cache.measuredHeightDeltaTotal,i&&!r&&this.validateComputedHeight(n),this.layoutDirty=!1}getLayoutDiff(){var t;return((t=this.pendingRender)==null?void 0:t.diff)??this.getRenderedDiff()}getLayoutAnnotations(){const{pendingRender:t}=this;return t!=null?this.getAnnotationsForDiff(t.diff):this.lineAnnotations}getActiveEstimatedHeight(t=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(t);const n=this.getDiffStyle()==="split"?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(n==null)throw new Error("VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height");return n}ensureEstimatedDiffHeights(t=this.getLayoutDiff()){if(t==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;const{disableFileHeader:n=!1,expandUnchanged:i=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:o,unifiedHeight:s}=Hu({fileDiff:t,metrics:this.metrics,disableFileHeader:n,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:i,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:rn(t,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=o,this.cache.estimatedUnifiedHeight=s}validateComputedHeight(t=this.getLayoutDiff()){if(this.fileContainer==null||t==null)return;const n=this.fileContainer.getBoundingClientRect();n.height!==this.height?console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:t.name,elementHeight:n.height,computedHeight:this.height}):console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}render({fileContainer:t,fileDiff:n,forceRender:i=!1,lineAnnotations:r,...o}={}){var L;const s=Rn(o,"VirtualizedFileDiff.render"),l=s!=null,a=s==null?void 0:s.oldFile,u=s==null?void 0:s.newFile,d=l&&(!Bi(a,this.deletionFile)||!Bi(u,this.additionFile));let c=n??this.getInputDiff();n==null&&l&&(d||this.getInputDiff()==null)&&(c=Ne(s.oldFile,s.newFile,this.options.parseDiffOptions));const{forceRenderOverride:f,isSetup:h}=this;this.forceRenderOverride=void 0;const g=c!=null&&!j(this.getInputDiff(),c),p=g||d;if(t=this.getOrCreateFileContainer(t),c==null)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;g&&this.updateInputDiff(c,r);const{pendingRenderDiff:b,layoutDiffChanged:S,renderedDiffChanged:m,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.workingDiff===(this.getWorkingDiff(c)??c)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(c,r);if(S&&this.resetLayoutCache({includeEstimatedHeights:!0}),h)this.top??(this.top=this.getVirtualizedTop()),this.layoutDirty&&this.isSimpleMode()&&((L=this.getSimpleVirtualizer())==null||L.markDOMDirty(),this.computeApproximateSize(!1,b));else{this.computeApproximateSize(!1,b);const k=this.getSimpleVirtualizer();if(this.top??(this.top=this.getVirtualizedTop()),this.isAdvancedMode())this.isVisible=!0;else{if(k==null)throw new Error("VirtualizedFileDiff.render: simple virtualizer is not available");k.connect(t,this),this.isVisible=k.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!p||!h))return s!=null&&(this.deletionFile=a,this.additionFile=u),g&&this.clearReusableHeader(),this.renderPlaceholder(this.height);const C=this.virtualizer.getWindowSpecs(),y=this.top??0,x=this.computeRenderRangeFromWindow(b,y,C);return super.render({fileDiff:c,fileContainer:t,renderRange:x,lineAnnotations:r,forceRender:(f??i)||v||m||g,...s,...o})}finalizeRender(){var t,n;if(!j(this.getRenderedDiff(),(t=this.pendingRender)==null?void 0:t.diff))throw new Error("VirtualizedFileDiff.render: rendered a different diff than its prepared layout");this.pendingRender=void 0,this.isSimpleMode()&&((n=this.getSimpleVirtualizer())==null||n.requestHeightReconcile(this))}updatePendingRender(t,n){const i=this.getWorkingDiff(t)??t,r=this.getRenderedDiff(),{pendingRender:o}=this,s=(o==null?void 0:o.diff)??r,l=this.hunksRenderer.getDiffForNextRender(i);return this.pendingRender={workingDiff:i,diff:l},{pendingRenderDiff:l,annotationsChanged:this.syncLineAnnotations(n),layoutDiffChanged:!j(s,l),renderedDiffChanged:!j(r,l)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type==="simple"}isAdvancedMode(){return this.virtualizer.type==="advanced"}getVirtualizedTop(){return this.virtualizer.type==="advanced"?this.virtualizer.getLocalTopForInstance(this):this.fileContainer!=null?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return this.virtualizer.type==="simple"?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type==="advanced"?this.virtualizer:void 0}isResizeDebuggingEnabled(){var t;return((t=this.getSimpleVirtualizer())==null?void 0:t.config.resizeDebugging)??!1}getDiffStyle(){return this.options.diffStyle??"split"}getHunkSeparatorType(){return Bu(this.options.hunkSeparators)}approximateLayoutCheckpoints(t){var g,p,b;if(!this.layoutDirty&&this.cache.checkpoints.length>0||t.hunks.length===0||this.options.collapsed===!0)return;const{disableFileHeader:n=!1,expandUnchanged:i=!1,collapsedContextThreshold:r=1}=this.options,o=t.hunks.length-1,s=rn(t,this.options.loadDiffFiles!=null),l=this.getDiffStyle(),a=this.getHunkSeparatorType(),u=i?!0:this.hunksRenderer.getExpandedHunksMap(),d=Ou(this.cache.heightDeltas);let c=st(this.metrics,n)+this.cache.fileAnnotationHeight,f=0;const h=({rowCount:S,startLineIndex:m,preSeparatorHeight:v=0,postSeparatorHeight:C=0,metadataOffsets:y=[]})=>{if(S<=0)return;const x=f,L=f+S;let k=zu(x);for(;k<L;){const R=k-x,H=c+(R>0?v:0)+R*this.metrics.lineHeight+Uu(y,R)*this.metrics.lineHeight+$i(d,m,m+R);this.cache.checkpoints.push({renderedLineIndex:k,lineIndex:m+R,top:H}),k+=An}c+=v+S*this.metrics.lineHeight+y.length*this.metrics.lineHeight+$i(d,m,m+S)+C,f=L};for(let S=0;S<t.hunks.length;S++){const m=t.hunks[S];if(m==null)throw new Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");const v=Ae({isPartial:t.isPartial,rangeSize:m.collapsedBefore,expandedHunks:u,hunkIndex:S,collapsedContextThreshold:r}),C=v.collapsedLines>0?((g=at({type:a,metrics:this.metrics,hunkIndex:S,hunkSpecs:m.hunkSpecs}))==null?void 0:g.totalHeight)??0:0;h({rowCount:v.fromStart,startLineIndex:(l==="split"?m.splitLineStart:m.unifiedLineStart)-v.rangeSize});let y=C;h({rowCount:v.fromEnd,startLineIndex:(l==="split"?m.splitLineStart:m.unifiedLineStart)-v.fromEnd,preSeparatorHeight:y}),v.fromEnd>0&&(y=0);const x=S===o?De({fileDiff:t,hunkIndex:S,expandedHunks:u,collapsedContextThreshold:r,errorPrefix:"VirtualizedFileDiff"}):void 0,L=x!=null&&x.collapsedLines>0?((p=Oe({type:a,metrics:this.metrics}))==null?void 0:p.totalHeight)??0:S===o&&s?((b=Oe({type:a,metrics:this.metrics}))==null?void 0:b.totalHeight)??0:0,k=x!=null?x.fromStart+x.fromEnd:0,R=l==="split"?m.splitLineCount:m.unifiedLineCount,H=l==="split"?m.splitLineStart:m.unifiedLineStart;h({rowCount:R,startLineIndex:H,preSeparatorHeight:y,postSeparatorHeight:k===0?L:0,metadataOffsets:_u({diffStyle:l,hunk:m,rowCount:R})}),x!=null&&k>0&&h({rowCount:k,startLineIndex:H+R,postSeparatorHeight:L})}this.cache.totalLines=f}getLayoutCheckpointBeforeLineIndex(t){if(t<=0||this.cache.checkpoints.length===0)return;let n=0,i=this.cache.checkpoints.length-1,r;for(;n<=i;){const o=n+i>>1,s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");s.lineIndex<=t?(r=s,n=o+1):i=o-1}return r}getLayoutCheckpointBeforeTop(t,n){let i=0,r=this.cache.checkpoints.length-1,o=-1;for(;i<=r;){const s=i+r>>1,l=this.cache.checkpoints[s];if(l==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");l.top<=t?(o=s,i=s+1):r=s-1}if(n==null)return o>=0?this.cache.checkpoints[o]:void 0;for(let s=o;s>=0;s--){const l=this.cache.checkpoints[s];if(l==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");if(l.renderedLineIndex%n===0)return l}}getExpandedLineCount(t,n){let i=0;if(t.isPartial){for(const a of t.hunks)i+=n==="split"?a.splitLineCount:a.unifiedLineCount;return i}const{expandUnchanged:r=!1,collapsedContextThreshold:o=1}=this.options,s=r?!0:this.hunksRenderer.getExpandedHunksMap();for(const[a,u]of t.hunks.entries()){const d=n==="split"?u.splitLineCount:u.unifiedLineCount;i+=d;const c=Math.max(u.collapsedBefore,0),{fromStart:f,fromEnd:h,renderAll:g}=Ae({isPartial:t.isPartial,rangeSize:c,expandedHunks:s,hunkIndex:a,collapsedContextThreshold:o});c>0&&(i+=g?c:f+h)}const l=De({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:s,collapsedContextThreshold:o,errorPrefix:"VirtualizedFileDiff"});return l!=null&&(i+=l.fromStart+l.fromEnd),i}getLayoutLineCount(t,n){const i=this.getExpandedLineCount(t,n),r=n==="split"?t.splitLineCount:t.unifiedLineCount;return Math.max(i,r,t.additionLines.length,t.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(t,n,{top:i,bottom:r}){const{disableFileHeader:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:l=1}=this.options,{hunkLineCount:a,lineHeight:u}=this.metrics,d=this.getDiffStyle(),c=this.getHunkSeparatorType(),f=rn(t,this.options.loadDiffFiles!=null),h=this.height;let g=this.getLayoutLineCount(t,d);const p=st(this.metrics,o),b=t.hunks.length>0?Pr(this.metrics):0,{fileAnnotationHeight:S}=this.cache,m=p+S,v=Math.max(0,h-p-S-b),C=this.hasFileAnnotations(t),y=n+p,x=S>0&&C&&y<r&&y+S>i;if(n<i-h||n>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-p-b};if(g<=a||t.hunks.length===0)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(t),g=this.getLayoutLineCount(t,d);const L=Math.ceil(Math.max(r-i,0)/u),k=Math.ceil(L/a)*a+a,R=k/a,H=R,N=[],I=(i+r)/2,E=this.getLayoutCheckpointBeforeTop(Math.max(0,i-n-k*u*2),a);let T=n+((E==null?void 0:E.top)??m),U=(E==null?void 0:E.renderedLineIndex)??0,_,M,O;if(_e({diff:t,diffStyle:d,startingLine:(E==null?void 0:E.renderedLineIndex)??0,expandedHunks:s?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:l,callback:({hunkIndex:Se,hunk:te,collapsedBefore:Fe,collapsedAfter:Ut,deletionLine:ge,additionLine:ce})=>{var et;const Je=ce!=null?ce.splitLineIndex:ge.splitLineIndex,Qe=ce!=null?ce.unifiedLineIndex:ge.unifiedLineIndex,B=((ce==null?void 0:ce.noEOFCR)??!1)||((ge==null?void 0:ge.noEOFCR)??!1),se=Se===t.hunks.length-1&&te!=null&&(d==="split"?Je===te.splitLineStart+te.splitLineCount-1:Qe===te.unifiedLineStart+te.unifiedLineCount-1),ne=((et=Fe>0?at({type:c,metrics:this.metrics,hunkIndex:Se,hunkSpecs:te==null?void 0:te.hunkSpecs}):void 0)==null?void 0:et.totalHeight)??0;T+=ne;const Te=U%a===0,ie=Math.floor(U/a);if(Te&&(N[ie]=T-(n+m+ne),O!=null)){if(O<=0)return!0;O--}const le=this.getLineHeight(d==="split"?Je:Qe,B);if(T>i-le&&T<r&&(_??(_=ie)),M==null&&T+le>I&&(M=ie),O==null&&T>=r&&Te&&(O=H),U++,T+=le,Ut>0||se&&f){const Q=Oe({type:c,metrics:this.metrics});Q!=null&&(T<r&&T+Q.totalHeight>i&&(_??(_=ie)),M==null&&T+Q.totalHeight>I&&(M=ie),T+=Q.totalHeight)}return!1}}),_==null)if(x)_=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-p-b};M??(M=_);const W=Math.round(M-R/2),Z=Math.max(0,Math.ceil(g/a)-R),F=Math.max(0,Math.min(W,Z)),D=F*a,$=W<0?k+W*a:k,J=N[F]??0,ue=D===0?0:S+J,be=F+$/a,ye=be<N.length?v-N[be]:v-(T-n-m);return{startingLine:D,totalLines:$,bufferBefore:ue,bufferAfter:Math.max(0,ye)}}};function Fu(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===Ya&&(t=Math.max(t??0,r.getBoundingClientRect().height))}return t}function Ou(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 $i({lineIndexes:e,prefixTotals:t},n,i){if(n>=i||e.length===0)return 0;const r=Wi(e,n);return(t[Wi(e,i)]??0)-(t[r]??0)}function Wi(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 zu(e){return Math.ceil(e/An)*An}function Uu(e,t){let n=0;for(const i of e)i<t&&n++;return n}function _u({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 $u(e,t){return(e.diffStyle??"split")!==(t.diffStyle??"split")||(e.overflow??"scroll")!==(t.overflow??"scroll")||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??"bars")!==(t.diffIndicators??"bars")||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Wu(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function rn(e,t){return e.isPartial&&t&&(e.type==="change"||e.type==="rename-changed")}function Bu(e){return typeof e=="function"?"custom":e??"line-info"}function Bi(e,t){return e==null||t==null?e==null&&t==null:Nr(e,t)}function Vu(e,t){const[n,i]=e.split(",").map(Number);return t==="split"?i:n}function ju({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function Gu(e,t){const n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:qu(n,e.startContentIndex)}}function qu(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}let Ku;function Yu(){return Ku??(Ku=Xu())}function Xu(){try{if(typeof WebAssembly!="object")return!1;const e=new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));return new WebAssembly.Instance(e),!0}catch{return!1}}function Rt(e){const t=G.useRef(e);return G.useInsertionEffect(()=>void(t.current=e)),G.useCallback((...n)=>t.current(...n),[])}const Zu=G.createContext(void 0);function Ju(){return G.useContext(Zu)}const Qu={position:"absolute",top:0,bottom:0,textAlign:"center",whiteSpace:"normal",touchAction:"none"},ec={display:"contents"};function Vi(){return null}function tc({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:i,renderHeaderFilenameSuffix:r,renderHeaderMetadata:o,renderAnnotation:s,renderGutterUtility:l,renderMergeConflictUtility:a,lineAnnotations:u,getHoveredLine:d,getInstance:c,getAnnotationSlotName:f=ze}){const h=n==null?void 0:n(e),g=i==null?void 0:i(e),p=r==null?void 0:r(e),b=o==null?void 0:o(e);return X.jsxs(X.Fragment,{children:[h!=null?X.jsx("div",{slot:Dn,children:h}):X.jsxs(X.Fragment,{children:[g!=null&&X.jsx("div",{slot:"header-prefix",children:g}),p!=null&&X.jsx("div",{slot:"header-filename-suffix",children:p}),b!=null&&X.jsx("div",{slot:"header-metadata",children:b})]}),s!=null&&(u==null?void 0:u.map((S,m)=>X.jsx("div",{slot:f(S),children:s(S,e)},m))),t!=null&&a!=null&&c!=null&&t.map(S=>{if(S==null)return;const m=nc(S,e);return X.jsx("div",{slot:m,style:ec,children:a(S,c)},m)}),l!=null&&X.jsx("div",{slot:"gutter-utility-slot",style:Qu,children:l(d)})]})}function nc(e,t){const n=Gu(e,t);return n!=null?ju({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex}):void 0}const ic=G.createContext(void 0);function rc(e,t){return typeof window>"u"&&t!=null?X.jsxs(X.Fragment,{children:[X.jsx("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:t}}),e]}):X.jsx(X.Fragment,{children:e})}const oc=G.createContext(void 0);function sc(){return G.useContext(oc)}function ac(){const[e]=G.useState(()=>{let t=0,n;return{getSnapshot:()=>t,subscribe(i){return n=i,()=>{n=void 0}},forceUpdate(){t++,n==null||n()}}});return G.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot),e.forceUpdate}function lc(e,t){"use no memo";var n;return(n=e.current)==null?void 0:n.__getNextRenderData(t)}const dc=typeof window>"u"?G.useEffect:G.useLayoutEffect;function uc({fileDiff:e,oldFile:t,newFile:n,options:i,editorOptions:r,editStateKey:o,lineAnnotations:s,selectedLines:l,prerenderedHTML:a,metrics:u,hasGutterRenderUtility:d,hasCustomHeader:c,disableWorkerPool:f,edit:h,onEditChange:g,onEditComplete:p}){const b=sc(),S=l!==void 0,m=G.useContext(ic),v=Ju(),[C,y]=G.useState(),x=Rt(D=>g==null?void 0:g(D)),L=g!=null?x:void 0,k=G.useRef(null),R=Rt(D=>{const $=(p==null?void 0:p(D))??"reject";return $==="accept"&&(k.current={fileDiff:{installed:D.fileDiff,stale:D.originalFileDiff},filePair:e==null?{fileDiff:D.fileDiff,installed:{oldFile:D.oldFile,newFile:D.newFile},stale:{oldFile:t??null,newFile:n??null}}:null,annotations:{installed:D.lineAnnotations,stale:D.originalLineAnnotations}}),$}),H=p!=null?R:void 0,N=cc({acceptedCache:k,fileDiff:e,newFile:n,oldFile:t,parseDiffOptions:i==null?void 0:i.parseDiffOptions}),I=G.useRef(null),E=ac(),T=hc(k,N,s),U=lc(I,T)??{fileDiff:N,lineAnnotations:s??Qi},_=G.useRef(null),M=G.useRef(null),O=Rt(()=>{if(v==null)throw new Error("FileDiff: EditContext is not attached");return v("file-diff",r??{},o)}),W=Rt(D=>{if(D!=null){if(I.current!=null)throw new Error("useFileDiffInstance: An instance should not already exist when a node is created");b!=null?I.current=new Nu(on({controlledSelection:S,hasCustomHeader:c,hasGutterRenderUtility:d,onEditChange:L,onEditComplete:H,options:i}),b,u,f?void 0:m,E):I.current=new eo(on({controlledSelection:S,hasCustomHeader:c,hasGutterRenderUtility:d,onEditChange:L,onEditComplete:H,options:i}),f?void 0:m,E),I.current.hydrate({fileDiff:N,fileContainer:D,lineAnnotations:s,prerenderedHTML:a})}else{if(I.current==null)throw new Error("useFileDiffInstance: A FileDiff instance should exist when unmounting");M.current=null,I.current.cleanUp(),I.current=null,_.current=null}});dc(()=>{var te;const{current:D}=I;if(D==null)return;const $=on({controlledSelection:S,hasCustomHeader:c,hasGutterRenderUtility:d,onEditChange:L,onEditComplete:H,options:i}),J=!ir(D.options,$);if(D.setOptions($),!h&&(M.current=null,_.current!=null)){const{current:Fe}=_;_.current=null,Fe()}const ue=fc(N,s,k);if(D.render({forceRender:J,fileDiff:ue.fileDiff,lineAnnotations:ue.lineAnnotations}),l!==void 0&&D.setSelectedLines(l),!h||_.current!=null)return;if(v==null)throw new Error("FileDiff: EditContext is not attached");const be=()=>{I.current!==D||_.current!=null||!D.__canAttachEditor()||(_.current=gc(D,O),E())};if(D.__canAttachEditor()){M.current=null,be();return}const ye=D.__prepareForEditing();if(ye==null){M.current=null;return}if(((te=M.current)==null?void 0:te.promise)===ye)return;const Se={promise:ye};M.current=Se,ye.then(()=>{M.current===Se&&(be(),M.current=null)}).catch(Fe=>{M.current===Se&&(M.current=null,y(Fe))})});const Z=G.useCallback(()=>{var D;return(D=I.current)==null?void 0:D.getHoveredLine()},[]),F=G.useCallback(D=>{var $;return(($=I.current)==null?void 0:$.getAnnotationSlotName(D))??ze(D)},[]);if(C!=null)throw C;return{...U,ref:W,getHoveredLine:Z,getAnnotationSlotName:F}}function cc({acceptedCache:e,fileDiff:t,newFile:n,oldFile:i,parseDiffOptions:r}){return G.useMemo(()=>{if(t!=null)return t;const{current:o}=e,s=o==null?void 0:o.filePair;if(o!=null&&s!=null){if(ji(i,n,s.stale)||ji(i,n,s.installed))return s.fileDiff;o.filePair=null}return Ne(i??null,n??null,r)},[e,t,i,n,r])}function ji(e,t,n){return fi(e??void 0,n.oldFile??void 0)&&fi(t??void 0,n.newFile??void 0)}function hc(e,t,n){"use no memo";return to(t,n,e.current)}function to(e,t,n){return{fileDiff:(n==null?void 0:n.fileDiff)!=null&&j(e,n.fileDiff.stale)?n.fileDiff.installed:e,lineAnnotations:(n==null?void 0:n.annotations)!=null&&t===n.annotations.stale?n.annotations.installed:t}}function fc(e,t,n){var o;const{current:i}=n,r=to(e,t,i);return i==null||(i.fileDiff!=null&&!j(e,i.fileDiff.stale)&&(i.fileDiff=null),t!==((o=i.annotations)==null?void 0:o.stale)&&(i.annotations=null),i.fileDiff==null&&i.annotations==null&&i.filePair==null&&(n.current=null)),r}function on({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:i,onEditChange:r,onEditComplete:o}){return{...e,controlledSelection:t,renderCustomHeader:n?Vi:e==null?void 0:e.renderCustomHeader,renderGutterUtility:i?Vi:e==null?void 0:e.renderGutterUtility,onEditChange:r,onEditComplete:o}}function gc(e,t){const n=t();try{return n.edit(e)}catch(i){throw n.cleanUp(),i}}function pc({fileDiff:e,options:t,editorOptions:n,editStateKey:i,metrics:r,lineAnnotations:o,selectedLines:s,className:l,style:a,prerenderedHTML:u,renderAnnotation:d,renderCustomHeader:c,renderHeaderPrefix:f,renderHeaderFilenameSuffix:h,renderHeaderMetadata:g,renderGutterUtility:p,disableWorkerPool:b=!1,edit:S=!1,onEditChange:m,onEditComplete:v}){const{ref:C,getHoveredLine:y,getAnnotationSlotName:x,fileDiff:L,lineAnnotations:k}=uc({fileDiff:e,options:t,editorOptions:n,editStateKey:i,metrics:r,lineAnnotations:o,selectedLines:s,prerenderedHTML:u,hasGutterRenderUtility:p!=null,hasCustomHeader:c!=null,disableWorkerPool:b,edit:S,onEditChange:m,onEditComplete:v}),R=tc({fileDiff:L,renderCustomHeader:c,renderHeaderPrefix:f,renderHeaderFilenameSuffix:h,renderHeaderMetadata:g,renderAnnotation:d,renderGutterUtility:p,lineAnnotations:k,getHoveredLine:y,getAnnotationSlotName:x});return X.jsx(qi,{ref:C,className:l,style:a,children:rc(R,u)})}const mc=[":host{color-scheme:inherit;","--diffs-light-bg:var(--color-background-surface);","--diffs-dark-bg:var(--color-background-surface);","--diffs-font-family:var(--font-family-code)}"].join(""),no=Yu()?"highlights":"shiki-js",vc={themeType:"system",diffStyle:"unified",overflow:"scroll",disableFileHeader:!0,hunkSeparators:"simple",unsafeCSS:mc,preferredHighlighter:no},rt=new Map,bc=4;function yc(e){let t=rt.get(e);return t===void 0&&(t=Cc(Sc(e)),rt.size>=bc&&rt.delete(rt.keys().next().value),rt.set(e,t)),t}function Sc(e){try{return Ci(e,void 0,!0).flatMap(t=>t.files)}catch{try{return Ci(e,void 0,!1).flatMap(t=>t.files).slice(0,-1)}catch{return[]}}}function Cc(e){var i;const t=new Map,n=(r,o)=>{r!==void 0&&!t.has(r)&&t.set(r,o)};for(const r of e)n(r.name,r),n(r.prevName,r);for(const r of e)n(r.name.replace(/^b\//,""),r),n((i=r.prevName)==null?void 0:i.replace(/^a\//,""),r);return t}const Gi=new Map;function xc(e){const t=e.lang??Ee(e.name);let n=Gi.get(t);return n===void 0&&(n=Po({themes:["pierre-light","pierre-dark"],langs:[t],preferredHighlighter:no}).catch(()=>{}),Gi.set(t,n)),n}function kc({patch:e,path:t,fallback:n}){const i=yc(e).get(t);return i===void 0?n:(G.use(xc(i)),X.jsx(pc,{fileDiff:i,options:vc,disableWorkerPool:!0}))}const Tc=Object.freeze(Object.defineProperty({__proto__:null,default:kc},Symbol.toStringTag,{value:"Module"}));export{Co as A,Mt as H,Ec as R,yo as a,So as b,Rc as c,Ac as d,qa as e,Mo as f,fe as g,Pe as h,xo as i,Tc as j,Va as r,mn as t};
|