webmux 0.34.0 → 0.35.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.
@@ -0,0 +1,112 @@
1
+ import{M as ye,c as pt,h as Ve,s as Le,A as mt,k as bt,b as gt,N as vt,i as wt,z as yt,x as xt,L as se,J as ge,y as Tt,Q as Xe,E as Q,f as Nt,o as Ct,P as Oe,r as L,u as Et,e as ue,B as St,R as qe,p as Ke,j as q,I as ie,D as $,C as Lt,t as _e,g as ee,H as ve,n as _t,K as he,G as Fe,m as He,a as Dt,v as Pt,O as It,w as Mt,d as le,F as te,q as oe,l as Ot}from"./index-CU9BHgDe.js";import"./vendor-xterm-DvXGiZvM.js";function Ft(s,n,t=!1,e=!1,i=!1,o=!1){var r=s,f="";if(t)var d=s;ye(()=>{var u=pt;if(f!==(f=n()??"")){if(t){u.nodes=null,d.innerHTML=f,f!==""&&Ve(Le(d),d.lastChild);return}if(u.nodes!==null&&(mt(u.nodes.start,u.nodes.end),u.nodes=null),f!==""){var b=e?gt:i?vt:void 0,y=bt(e?"svg":i?"math":"template",b);y.innerHTML=f;var E=e||i?y:y.content;if(Ve(Le(E),E.lastChild),e||i)for(;Le(E);)r.before(Le(E));else r.before(E)}}})}var R;(function(s){s.INSERT="insert",s.DELETE="delete",s.CONTEXT="context"})(R||(R={}));const Ht={LINE_BY_LINE:"line-by-line"},At={NONE:"none"},Bt={WORD:"word"};var xe;(function(s){s.AUTO="auto",s.DARK="dark",s.LIGHT="light"})(xe||(xe={}));const kt=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],Rt=RegExp("["+kt.join("\\")+"]","g");function Wt(s){return s.replace(Rt,"\\$&")}function Ye(s){return s&&s.replace(/\\/g,"/")}function jt(s){let n,t,e,i=0;for(n=0,e=s.length;n<e;n++)t=s.charCodeAt(n),i=(i<<5)-i+t,i|=0;return i}function lt(s){const n=s.length;let t=-1/0;for(let e=0;e<n;e++)t=Math.max(t,s[e]);return t}function Je(s,n){const t=s.split(".");return t.length>1?t[t.length-1]:n}function Qe(s,n){return n.reduce((t,e)=>t||s.startsWith(e),!1)}const Ze=["a/","b/","i/","w/","c/","o/"];function pe(s,n,t){const e=t!==void 0?[...Ze,t]:Ze,i=n?new RegExp(`^${Wt(n)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,o=""]=i.exec(s)||[],r=e.find(d=>o.indexOf(d)===0);return(r?o.slice(r.length):o).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function zt(s,n){return pe(s,"---",n)}function Ut(s,n){return pe(s,"+++",n)}function Gt(s,n={}){const t=[];let e=null,i=null,o=null,r=null,f=null,d=null,u=null;const b="--- ",y="+++ ",E="@@",a=/^old mode (\d{6})/,c=/^new mode (\d{6})/,w=/^deleted file mode (\d{6})/,h=/^new file mode (\d{6})/,x=/^copy from "?(.+)"?/,N=/^copy to "?(.+)"?/,T=/^rename from "?(.+)"?/,D=/^rename to "?(.+)"?/,S=/^similarity index (\d+)%/,I=/^dissimilarity index (\d+)%/,ce=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,l=/^Binary files (.*) and (.*) differ/,p=/^GIT binary patch/,g=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,C=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,A=/^new file mode (\d{6})/,X=/^deleted file mode (\d{6}),(\d{6})/,G=s.replace(/\/g,"").replace(/\r\n?/g,`
2
+ `).split(`
3
+ `);function P(){i!==null&&e!==null&&(e.blocks.push(i),i=null)}function M(){e!==null&&(!e.oldName&&d!==null&&(e.oldName=d),!e.newName&&u!==null&&(e.newName=u),e.newName&&(t.push(e),e=null)),d=null,u=null}function j(){P(),M(),e={blocks:[],deletedLines:0,addedLines:0}}function k(m){P();let _;e!==null&&((_=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(m))?(e.isCombined=!1,o=parseInt(_[1],10),f=parseInt(_[2],10)):(_=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(m))?(e.isCombined=!0,o=parseInt(_[1],10),r=parseInt(_[2],10),f=parseInt(_[3],10)):(m.startsWith(E)&&console.error("Failed to parse lines, starting in 0!"),o=0,f=0,e.isCombined=!1)),i={lines:[],oldStartLine:o,oldStartLine2:r,newStartLine:f,header:m}}function O(m){if(e===null||i===null||o===null||f===null)return;const _={content:m},v=e.isCombined?["+ "," +","++"]:["+"],z=e.isCombined?["- "," -","--"]:["-"];Qe(m,v)?(e.addedLines++,_.type=R.INSERT,_.oldNumber=void 0,_.newNumber=f++):Qe(m,z)?(e.deletedLines++,_.type=R.DELETE,_.oldNumber=o++,_.newNumber=void 0):(_.type=R.CONTEXT,_.oldNumber=o++,_.newNumber=f++),i.lines.push(_)}function ne(m,_){let v=_;for(;v<G.length-3;){if(m.startsWith("diff"))return!1;if(G[v].startsWith(b)&&G[v+1].startsWith(y)&&G[v+2].startsWith(E))return!0;v++}return!1}return G.forEach((m,_)=>{if(!m||m.startsWith("*"))return;let v;const z=G[_-1],fe=G[_+1],Ne=G[_+2];if(m.startsWith("diff --git")||m.startsWith("diff --combined")){if(j(),(v=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(m))&&(d=pe(v[1],void 0,n.dstPrefix),u=pe(v[2],void 0,n.srcPrefix)),e===null)throw new Error("Where is my file !!!");e.isGitDiff=!0;return}if(m.startsWith("Binary files")&&!(e!=null&&e.isGitDiff)){if(j(),(v=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(m))&&(d=pe(v[1],void 0,n.dstPrefix),u=pe(v[2],void 0,n.srcPrefix)),e===null)throw new Error("Where is my file !!!");e.isBinary=!0;return}if((!e||!e.isGitDiff&&e&&m.startsWith(b)&&fe.startsWith(y)&&Ne.startsWith(E))&&j(),e!=null&&e.isTooBig)return;if(e&&(typeof n.diffMaxChanges=="number"&&e.addedLines+e.deletedLines>n.diffMaxChanges||typeof n.diffMaxLineLength=="number"&&m.length>n.diffMaxLineLength)){e.isTooBig=!0,e.addedLines=0,e.deletedLines=0,e.blocks=[],i=null;const me=typeof n.diffTooBigMessage=="function"?n.diffTooBigMessage(t.length):"Diff too big to be displayed";k(me);return}if(m.startsWith(b)&&fe.startsWith(y)||m.startsWith(y)&&z.startsWith(b)){if(e&&!e.oldName&&m.startsWith("--- ")&&(v=zt(m,n.srcPrefix))){e.oldName=v,e.language=Je(e.oldName,e.language);return}if(e&&!e.newName&&m.startsWith("+++ ")&&(v=Ut(m,n.dstPrefix))){e.newName=v,e.language=Je(e.newName,e.language);return}}if(e&&(m.startsWith(E)||e.isGitDiff&&e.oldName&&e.newName&&!i)){k(m);return}if(i&&(m.startsWith("+")||m.startsWith("-")||m.startsWith(" "))){O(m);return}const de=!ne(m,_);if(e===null)throw new Error("Where is my file !!!");(v=a.exec(m))?e.oldMode=v[1]:(v=c.exec(m))?e.newMode=v[1]:(v=w.exec(m))?(e.deletedFileMode=v[1],e.isDeleted=!0):(v=h.exec(m))?(e.newFileMode=v[1],e.isNew=!0):(v=x.exec(m))?(de&&(e.oldName=v[1]),e.isCopy=!0):(v=N.exec(m))?(de&&(e.newName=v[1]),e.isCopy=!0):(v=T.exec(m))?(de&&(e.oldName=v[1]),e.isRename=!0):(v=D.exec(m))?(de&&(e.newName=v[1]),e.isRename=!0):(v=l.exec(m))?(e.isBinary=!0,e.oldName=pe(v[1],void 0,n.srcPrefix),e.newName=pe(v[2],void 0,n.dstPrefix),k("Binary file")):p.test(m)?(e.isBinary=!0,k(m)):(v=S.exec(m))?e.unchangedPercentage=parseInt(v[1],10):(v=I.exec(m))?e.changedPercentage=parseInt(v[1],10):(v=ce.exec(m))?(e.checksumBefore=v[1],e.checksumAfter=v[2],v[3]&&(e.mode=v[3])):(v=g.exec(m))?(e.checksumBefore=[v[2],v[3]],e.checksumAfter=v[1]):(v=C.exec(m))?(e.oldMode=[v[2],v[3]],e.newMode=v[1]):(v=A.exec(m))?(e.newFileMode=v[1],e.isNew=!0):(v=X.exec(m))&&(e.deletedFileMode=v[1],e.isDeleted=!0)}),P(),M(),t}class ot{diff(n,t,e={}){let i;typeof e=="function"?(i=e,e={}):"callback"in e&&(i=e.callback);const o=this.castInput(n,e),r=this.castInput(t,e),f=this.removeEmpty(this.tokenize(o,e)),d=this.removeEmpty(this.tokenize(r,e));return this.diffWithOptionsObj(f,d,e,i)}diffWithOptionsObj(n,t,e,i){var o;const r=N=>{if(N=this.postProcess(N,e),i){setTimeout(function(){i(N)},0);return}else return N},f=t.length,d=n.length;let u=1,b=f+d;e.maxEditLength!=null&&(b=Math.min(b,e.maxEditLength));const y=(o=e.timeout)!==null&&o!==void 0?o:1/0,E=Date.now()+y,a=[{oldPos:-1,lastComponent:void 0}];let c=this.extractCommon(a[0],t,n,0,e);if(a[0].oldPos+1>=d&&c+1>=f)return r(this.buildValues(a[0].lastComponent,t,n));let w=-1/0,h=1/0;const x=()=>{for(let N=Math.max(w,-u);N<=Math.min(h,u);N+=2){let T;const D=a[N-1],S=a[N+1];D&&(a[N-1]=void 0);let I=!1;if(S){const l=S.oldPos-N;I=S&&0<=l&&l<f}const ce=D&&D.oldPos+1<d;if(!I&&!ce){a[N]=void 0;continue}if(!ce||I&&D.oldPos<S.oldPos?T=this.addToPath(S,!0,!1,0,e):T=this.addToPath(D,!1,!0,1,e),c=this.extractCommon(T,t,n,N,e),T.oldPos+1>=d&&c+1>=f)return r(this.buildValues(T.lastComponent,t,n))||!0;a[N]=T,T.oldPos+1>=d&&(h=Math.min(h,N-1)),c+1>=f&&(w=Math.max(w,N+1))}u++};if(i)(function N(){setTimeout(function(){if(u>b||Date.now()>E)return i(void 0);x()||N()},0)})();else for(;u<=b&&Date.now()<=E;){const N=x();if(N)return N}}addToPath(n,t,e,i,o){const r=n.lastComponent;return r&&!o.oneChangePerToken&&r.added===t&&r.removed===e?{oldPos:n.oldPos+i,lastComponent:{count:r.count+1,added:t,removed:e,previousComponent:r.previousComponent}}:{oldPos:n.oldPos+i,lastComponent:{count:1,added:t,removed:e,previousComponent:r}}}extractCommon(n,t,e,i,o){const r=t.length,f=e.length;let d=n.oldPos,u=d-i,b=0;for(;u+1<r&&d+1<f&&this.equals(e[d+1],t[u+1],o);)u++,d++,b++,o.oneChangePerToken&&(n.lastComponent={count:1,previousComponent:n.lastComponent,added:!1,removed:!1});return b&&!o.oneChangePerToken&&(n.lastComponent={count:b,previousComponent:n.lastComponent,added:!1,removed:!1}),n.oldPos=d,u}equals(n,t,e){return e.comparator?e.comparator(n,t):n===t||!!e.ignoreCase&&n.toLowerCase()===t.toLowerCase()}removeEmpty(n){const t=[];for(let e=0;e<n.length;e++)n[e]&&t.push(n[e]);return t}castInput(n,t){return n}tokenize(n,t){return Array.from(n)}join(n){return n.join("")}postProcess(n,t){return n}get useLongestToken(){return!1}buildValues(n,t,e){const i=[];let o;for(;n;)i.push(n),o=n.previousComponent,delete n.previousComponent,n=o;i.reverse();const r=i.length;let f=0,d=0,u=0;for(;f<r;f++){const b=i[f];if(b.removed)b.value=this.join(e.slice(u,u+b.count)),u+=b.count;else{if(!b.added&&this.useLongestToken){let y=t.slice(d,d+b.count);y=y.map(function(E,a){const c=e[u+a];return c.length>E.length?c:E}),b.value=this.join(y)}else b.value=this.join(t.slice(d,d+b.count));d+=b.count,b.added||(u+=b.count)}}return i}}class $t extends ot{}const Vt=new $t;function Xt(s,n,t){return Vt.diff(s,n,t)}const et="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 qt extends ot{tokenize(n){const t=new RegExp(`(\\r?\\n)|[${et}]+|[^\\S\\n\\r]+|[^${et}]`,"ug");return n.match(t)||[]}}const Kt=new qt;function Yt(s,n,t){return Kt.diff(s,n,t)}function Jt(s,n){if(s.length===0)return n.length;if(n.length===0)return s.length;const t=[];let e;for(e=0;e<=n.length;e++)t[e]=[e];let i;for(i=0;i<=s.length;i++)t[0][i]=i;for(e=1;e<=n.length;e++)for(i=1;i<=s.length;i++)n.charAt(e-1)===s.charAt(i-1)?t[e][i]=t[e-1][i-1]:t[e][i]=Math.min(t[e-1][i-1]+1,Math.min(t[e][i-1]+1,t[e-1][i]+1));return t[n.length][s.length]}function We(s){return(n,t)=>{const e=s(n).trim(),i=s(t).trim();return Jt(e,i)/(e.length+i.length)}}function je(s){function n(e,i,o=new Map){let r=1/0,f;for(let d=0;d<e.length;++d)for(let u=0;u<i.length;++u){const b=JSON.stringify([e[d],i[u]]);let y;o.has(b)&&(y=o.get(b))||(y=s(e[d],i[u]),o.set(b,y)),y<r&&(r=y,f={indexA:d,indexB:u,score:r})}return f}function t(e,i,o=0,r=new Map){const f=n(e,i,r);if(!f||e.length+i.length<3)return[[e,i]];const d=e.slice(0,f.indexA),u=i.slice(0,f.indexB),b=[e[f.indexA]],y=[i[f.indexB]],E=f.indexA+1,a=f.indexB+1,c=e.slice(E),w=i.slice(a),h=t(d,u,o+1,r),x=t(b,y,o+1,r),N=t(c,w,o+1,r);let T=x;return(f.indexA>0||f.indexB>0)&&(T=h.concat(T)),(e.length>E||i.length>a)&&(T=T.concat(N)),T}return t}const V={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},Pe={matching:At.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:Bt.WORD,colorScheme:xe.LIGHT},re="/",ct=We(s=>s.value),Qt=je(ct);function Ae(s){return s.indexOf("dev/null")!==-1}function Zt(s){return s.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}function en(s){return s.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function De(s){switch(s){case R.CONTEXT:return V.CONTEXT;case R.INSERT:return V.INSERTS;case R.DELETE:return V.DELETES}}function ze(s){switch(s){case xe.DARK:return"d2h-dark-color-scheme";case xe.AUTO:return"d2h-auto-color-scheme";case xe.LIGHT:default:return"d2h-light-color-scheme"}}function tn(s){return s?2:1}function Te(s){return s.slice(0).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}function ae(s,n,t=!0){const e=tn(n);return{prefix:s.substring(0,e),content:t?Te(s.substring(e)):s.substring(e)}}function Ie(s){const n=Ye(s.oldName),t=Ye(s.newName);if(n!==t&&!Ae(n)&&!Ae(t)){const e=[],i=[],o=n.split(re),r=t.split(re),f=o.length,d=r.length;let u=0,b=f-1,y=d-1;for(;u<b&&u<y&&o[u]===r[u];)e.push(r[u]),u+=1;for(;b>u&&y>u&&o[b]===r[y];)i.unshift(r[y]),b-=1,y-=1;const E=e.join(re),a=i.join(re),c=o.slice(u,b+1).join(re),w=r.slice(u,y+1).join(re);return E.length&&a.length?E+re+"{"+c+" → "+w+"}"+re+a:E.length?E+re+"{"+c+" → "+w+"}":a.length?"{"+c+" → "+w+"}"+re+a:n+" → "+t}else return Ae(t)?n:t}function Ue(s){return`d2h-${jt(Ie(s)).toString().slice(-6)}`}function Ge(s){let n="file-changed";return s.isRename||s.isCopy?n="file-renamed":s.isNew?n="file-added":s.isDeleted?n="file-deleted":s.newName!==s.oldName&&(n="file-renamed"),n}function dt(s,n,t,e={}){const{matching:i,maxLineLengthHighlight:o,matchWordsThreshold:r,diffStyle:f}=Object.assign(Object.assign({},Pe),e),d=ae(s,t,!1),u=ae(n,t,!1);if(d.content.length>o||u.content.length>o)return{oldLine:{prefix:d.prefix,content:Te(d.content)},newLine:{prefix:u.prefix,content:Te(u.content)}};const b=f==="char"?Xt(d.content,u.content):Yt(d.content,u.content),y=[];if(f==="word"&&i==="words"){const a=b.filter(h=>h.removed),c=b.filter(h=>h.added);Qt(c,a).forEach(h=>{h[0].length===1&&h[1].length===1&&ct(h[0][0],h[1][0])<r&&(y.push(h[0][0]),y.push(h[1][0]))})}const E=b.reduce((a,c)=>{const w=c.added?"ins":c.removed?"del":null,h=y.indexOf(c)>-1?' class="d2h-change"':"",x=Te(c.value);return w!==null?`${a}<${w}${h}>${x}</${w}>`:`${a}${x}`},"");return{oldLine:{prefix:d.prefix,content:Zt(E)},newLine:{prefix:u.prefix,content:en(E)}}}const tt="file-summary",nn="icon",sn={colorScheme:Pe.colorScheme};class rn{constructor(n,t={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},sn),t)}render(n){const t=n.map(e=>this.hoganUtils.render(tt,"line",{fileHtmlId:Ue(e),oldName:e.oldName,newName:e.newName,fileName:Ie(e),deletedLines:"-"+e.deletedLines,addedLines:"+"+e.addedLines},{fileIcon:this.hoganUtils.template(nn,Ge(e))})).join(`
4
+ `);return this.hoganUtils.render(tt,"wrapper",{colorScheme:ze(this.config.colorScheme),filesNumber:n.length,files:t})}}const ft=Object.assign(Object.assign({},Pe),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Ee="generic",nt="line-by-line",an="icon",ln="tag";class on{constructor(n,t={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},ft),t)}render(n){const t=n.map(e=>{let i;return e.blocks.length?i=this.generateFileHtml(e):i=this.generateEmptyDiff(),this.makeFileDiffHtml(e,i)}).join(`
5
+ `);return this.hoganUtils.render(Ee,"wrapper",{colorScheme:ze(this.config.colorScheme),content:t})}makeFileDiffHtml(n,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(n.blocks)&&n.blocks.length===0)return"";const e=this.hoganUtils.template(nt,"file-diff"),i=this.hoganUtils.template(Ee,"file-path"),o=this.hoganUtils.template(an,"file"),r=this.hoganUtils.template(ln,Ge(n));return e.render({file:n,fileHtmlId:Ue(n),diffs:t,filePath:i.render({fileDiffName:Ie(n)},{fileIcon:o,fileTag:r})})}generateEmptyDiff(){return this.hoganUtils.render(Ee,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:V})}generateFileHtml(n){const t=je(We(e=>ae(e.content,n.isCombined).content));return n.blocks.map(e=>{let i=this.hoganUtils.render(Ee,"block-header",{CSSLineClass:V,blockHeader:n.isTooBig?e.header:Te(e.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(e).forEach(([o,r,f])=>{if(r.length&&f.length&&!o.length)this.applyRematchMatching(r,f,t).map(([d,u])=>{const{left:b,right:y}=this.processChangedLines(n,n.isCombined,d,u);i+=b,i+=y});else if(o.length)o.forEach(d=>{const{prefix:u,content:b}=ae(d.content,n.isCombined);i+=this.generateSingleLineHtml(n,{type:V.CONTEXT,prefix:u,content:b,oldNumber:d.oldNumber,newNumber:d.newNumber})});else if(r.length||f.length){const{left:d,right:u}=this.processChangedLines(n,n.isCombined,r,f);i+=d,i+=u}else console.error("Unknown state reached while processing groups of lines",o,r,f)}),i}).join(`
6
+ `)}applyLineGroupping(n){const t=[];let e=[],i=[];for(let o=0;o<n.lines.length;o++){const r=n.lines[o];(r.type!==R.INSERT&&i.length||r.type===R.CONTEXT&&e.length>0)&&(t.push([[],e,i]),e=[],i=[]),r.type===R.CONTEXT?t.push([[r],[],[]]):r.type===R.INSERT&&e.length===0?t.push([[],[],[r]]):r.type===R.INSERT&&e.length>0?i.push(r):r.type===R.DELETE&&e.push(r)}return(e.length||i.length)&&(t.push([[],e,i]),e=[],i=[]),t}applyRematchMatching(n,t,e){const i=n.length*t.length,o=lt(n.concat(t).map(f=>f.content.length));return i<this.config.matchingMaxComparisons&&o<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?e(n,t):[[n,t]]}processChangedLines(n,t,e,i){const o={right:"",left:""},r=Math.max(e.length,i.length);for(let f=0;f<r;f++){const d=e[f],u=i[f],b=d!==void 0&&u!==void 0?dt(d.content,u.content,t,this.config):void 0,y=d!==void 0&&d.oldNumber!==void 0?Object.assign(Object.assign({},b!==void 0?{prefix:b.oldLine.prefix,content:b.oldLine.content,type:V.DELETE_CHANGES}:Object.assign(Object.assign({},ae(d.content,t)),{type:De(d.type)})),{oldNumber:d.oldNumber,newNumber:d.newNumber}):void 0,E=u!==void 0&&u.newNumber!==void 0?Object.assign(Object.assign({},b!==void 0?{prefix:b.newLine.prefix,content:b.newLine.content,type:V.INSERT_CHANGES}:Object.assign(Object.assign({},ae(u.content,t)),{type:De(u.type)})),{oldNumber:u.oldNumber,newNumber:u.newNumber}):void 0,{left:a,right:c}=this.generateLineHtml(n,y,E);o.left+=a,o.right+=c}return o}generateLineHtml(n,t,e){return{left:this.generateSingleLineHtml(n,t),right:this.generateSingleLineHtml(n,e)}}generateSingleLineHtml(n,t){if(t===void 0)return"";const e=this.hoganUtils.render(nt,"numbers",{oldNumber:t.oldNumber||"",newNumber:t.newNumber||""});return this.hoganUtils.render(Ee,"line",{type:t.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:t.prefix===" "?"&nbsp;":t.prefix,content:t.content,lineNumber:e,line:t,file:n})}}const ut=Object.assign(Object.assign({},Pe),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Se="generic",cn="side-by-side",dn="icon",fn="tag";class un{constructor(n,t={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},ut),t)}render(n){const t=n.map(e=>{let i;return e.blocks.length?i=this.generateFileHtml(e):i=this.generateEmptyDiff(),this.makeFileDiffHtml(e,i)}).join(`
7
+ `);return this.hoganUtils.render(Se,"wrapper",{colorScheme:ze(this.config.colorScheme),content:t})}makeFileDiffHtml(n,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(n.blocks)&&n.blocks.length===0)return"";const e=this.hoganUtils.template(cn,"file-diff"),i=this.hoganUtils.template(Se,"file-path"),o=this.hoganUtils.template(dn,"file"),r=this.hoganUtils.template(fn,Ge(n));return e.render({file:n,fileHtmlId:Ue(n),diffs:t,filePath:i.render({fileDiffName:Ie(n)},{fileIcon:o,fileTag:r})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Se,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:V})}}generateFileHtml(n){const t=je(We(e=>ae(e.content,n.isCombined).content));return n.blocks.map(e=>{const i={left:this.makeHeaderHtml(e.header,n),right:this.makeHeaderHtml("")};return this.applyLineGroupping(e).forEach(([o,r,f])=>{if(r.length&&f.length&&!o.length)this.applyRematchMatching(r,f,t).map(([d,u])=>{const{left:b,right:y}=this.processChangedLines(n.isCombined,d,u);i.left+=b,i.right+=y});else if(o.length)o.forEach(d=>{const{prefix:u,content:b}=ae(d.content,n.isCombined),{left:y,right:E}=this.generateLineHtml({type:V.CONTEXT,prefix:u,content:b,number:d.oldNumber},{type:V.CONTEXT,prefix:u,content:b,number:d.newNumber});i.left+=y,i.right+=E});else if(r.length||f.length){const{left:d,right:u}=this.processChangedLines(n.isCombined,r,f);i.left+=d,i.right+=u}else console.error("Unknown state reached while processing groups of lines",o,r,f)}),i}).reduce((e,i)=>({left:e.left+i.left,right:e.right+i.right}),{left:"",right:""})}applyLineGroupping(n){const t=[];let e=[],i=[];for(let o=0;o<n.lines.length;o++){const r=n.lines[o];(r.type!==R.INSERT&&i.length||r.type===R.CONTEXT&&e.length>0)&&(t.push([[],e,i]),e=[],i=[]),r.type===R.CONTEXT?t.push([[r],[],[]]):r.type===R.INSERT&&e.length===0?t.push([[],[],[r]]):r.type===R.INSERT&&e.length>0?i.push(r):r.type===R.DELETE&&e.push(r)}return(e.length||i.length)&&(t.push([[],e,i]),e=[],i=[]),t}applyRematchMatching(n,t,e){const i=n.length*t.length,o=lt(n.concat(t).map(f=>f.content.length));return i<this.config.matchingMaxComparisons&&o<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?e(n,t):[[n,t]]}makeHeaderHtml(n,t){return this.hoganUtils.render(Se,"block-header",{CSSLineClass:V,blockHeader:t!=null&&t.isTooBig?n:Te(n),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(n,t,e){const i={right:"",left:""},o=Math.max(t.length,e.length);for(let r=0;r<o;r++){const f=t[r],d=e[r],u=f!==void 0&&d!==void 0?dt(f.content,d.content,n,this.config):void 0,b=f!==void 0&&f.oldNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.oldLine.prefix,content:u.oldLine.content,type:V.DELETE_CHANGES}:Object.assign(Object.assign({},ae(f.content,n)),{type:De(f.type)})),{number:f.oldNumber}):void 0,y=d!==void 0&&d.newNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.newLine.prefix,content:u.newLine.content,type:V.INSERT_CHANGES}:Object.assign(Object.assign({},ae(d.content,n)),{type:De(d.type)})),{number:d.newNumber}):void 0,{left:E,right:a}=this.generateLineHtml(b,y);i.left+=E,i.right+=a}return i}generateLineHtml(n,t){return{left:this.generateSingleHtml(n),right:this.generateSingleHtml(t)}}generateSingleHtml(n){const t="d2h-code-side-linenumber",e="d2h-code-side-line";return this.hoganUtils.render(Se,"line",{type:(n==null?void 0:n.type)||`${V.CONTEXT} d2h-emptyplaceholder`,lineClass:n!==void 0?t:`${t} d2h-code-side-emptyplaceholder`,contentClass:n!==void 0?e:`${e} d2h-code-side-emptyplaceholder`,prefix:(n==null?void 0:n.prefix)===" "?"&nbsp;":n==null?void 0:n.prefix,content:n==null?void 0:n.content,lineNumber:n==null?void 0:n.number})}}var Be={},st;function hn(){return st||(st=1,(function(s){(function(n){var t=/\S/,e=/\"/g,i=/\n/g,o=/\r/g,r=/\\/g,f=/\u2028/,d=/\u2029/;n.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},n.scan=function(p,g){var C=p.length,A=0,X=1,G=2,P=A,M=null,j=null,k="",O=[],ne=!1,m=0,_=0,v="{{",z="}}";function fe(){k.length>0&&(O.push({tag:"_t",text:new String(k)}),k="")}function Ne(){for(var Z=!0,J=_;J<O.length;J++)if(Z=n.tags[O[J].tag]<n.tags._v||O[J].tag=="_t"&&O[J].text.match(t)===null,!Z)return!1;return Z}function de(Z,J){if(fe(),Z&&Ne())for(var F=_,U;F<O.length;F++)O[F].text&&((U=O[F+1])&&U.tag==">"&&(U.indent=O[F].text.toString()),O.splice(F,1));else J||O.push({tag:`
8
+ `});ne=!1,_=O.length}function me(Z,J){var F="="+z,U=Z.indexOf(F,J),K=b(Z.substring(Z.indexOf("=",J)+1,U)).split(" ");return v=K[0],z=K[K.length-1],U+F.length-1}for(g&&(g=g.split(" "),v=g[0],z=g[1]),m=0;m<C;m++)P==A?y(v,p,m)?(--m,fe(),P=X):p.charAt(m)==`
9
+ `?de(ne):k+=p.charAt(m):P==X?(m+=v.length-1,j=n.tags[p.charAt(m+1)],M=j?p.charAt(m+1):"_v",M=="="?(m=me(p,m),P=A):(j&&m++,P=G),ne=m):y(z,p,m)?(O.push({tag:M,n:b(k),otag:v,ctag:z,i:M=="/"?ne-v.length:m+z.length}),k="",m+=z.length-1,P=A,M=="{"&&(z=="}}"?m++:u(O[O.length-1]))):k+=p.charAt(m);return de(ne,!0),O};function u(l){l.n.substr(l.n.length-1)==="}"&&(l.n=l.n.substring(0,l.n.length-1))}function b(l){return l.trim?l.trim():l.replace(/^\s*|\s*$/g,"")}function y(l,p,g){if(p.charAt(g)!=l.charAt(0))return!1;for(var C=1,A=l.length;C<A;C++)if(p.charAt(g+C)!=l.charAt(C))return!1;return!0}var E={_t:!0,"\n":!0,$:!0,"/":!0};function a(l,p,g,C){var A=[],X=null,G=null,P=null;for(G=g[g.length-1];l.length>0;){if(P=l.shift(),G&&G.tag=="<"&&!(P.tag in E))throw new Error("Illegal content in < super tag.");if(n.tags[P.tag]<=n.tags.$||c(P,C))g.push(P),P.nodes=a(l,P.tag,g,C);else if(P.tag=="/"){if(g.length===0)throw new Error("Closing tag without opener: /"+P.n);if(X=g.pop(),P.n!=X.n&&!w(P.n,X.n,C))throw new Error("Nesting error: "+X.n+" vs. "+P.n);return X.end=P.i,A}else P.tag==`
10
+ `&&(P.last=l.length==0||l[0].tag==`
11
+ `);A.push(P)}if(g.length>0)throw new Error("missing closing tag: "+g.pop().n);return A}function c(l,p){for(var g=0,C=p.length;g<C;g++)if(p[g].o==l.n)return l.tag="#",!0}function w(l,p,g){for(var C=0,A=g.length;C<A;C++)if(g[C].c==l&&g[C].o==p)return!0}function h(l){var p=[];for(var g in l)p.push('"'+T(g)+'": function(c,p,t,i) {'+l[g]+"}");return"{ "+p.join(",")+" }"}function x(l){var p=[];for(var g in l.partials)p.push('"'+T(g)+'":{name:"'+T(l.partials[g].name)+'", '+x(l.partials[g])+"}");return"partials: {"+p.join(",")+"}, subs: "+h(l.subs)}n.stringify=function(l,p,g){return"{code: function (c,p,i) { "+n.wrapMain(l.code)+" },"+x(l)+"}"};var N=0;n.generate=function(l,p,g){N=0;var C={code:"",subs:{},partials:{}};return n.walk(l,C),g.asString?this.stringify(C,p,g):this.makeTemplate(C,p,g)},n.wrapMain=function(l){return'var t=this;t.b(i=i||"");'+l+"return t.fl();"},n.template=n.Template,n.makeTemplate=function(l,p,g){var C=this.makePartials(l);return C.code=new Function("c","p","i",this.wrapMain(l.code)),new this.template(C,p,this,g)},n.makePartials=function(l){var p,g={subs:{},partials:l.partials,name:l.name};for(p in g.partials)g.partials[p]=this.makePartials(g.partials[p]);for(p in l.subs)g.subs[p]=new Function("c","p","t","i",l.subs[p]);return g};function T(l){return l.replace(r,"\\\\").replace(e,'\\"').replace(i,"\\n").replace(o,"\\r").replace(f,"\\u2028").replace(d,"\\u2029")}function D(l){return~l.indexOf(".")?"d":"f"}function S(l,p){var g="<"+(p.prefix||""),C=g+l.n+N++;return p.partials[C]={name:l.n,partials:{}},p.code+='t.b(t.rp("'+T(C)+'",c,p,"'+(l.indent||"")+'"));',C}n.codegen={"#":function(l,p){p.code+="if(t.s(t."+D(l.n)+'("'+T(l.n)+'",c,p,1),c,p,0,'+l.i+","+l.end+',"'+l.otag+" "+l.ctag+'")){t.rs(c,p,function(c,p,t){',n.walk(l.nodes,p),p.code+="});c.pop();}"},"^":function(l,p){p.code+="if(!t.s(t."+D(l.n)+'("'+T(l.n)+'",c,p,1),c,p,1,0,0,"")){',n.walk(l.nodes,p),p.code+="};"},">":S,"<":function(l,p){var g={partials:{},code:"",subs:{},inPartial:!0};n.walk(l.nodes,g);var C=p.partials[S(l,p)];C.subs=g.subs,C.partials=g.partials},$:function(l,p){var g={subs:{},code:"",partials:p.partials,prefix:l.n};n.walk(l.nodes,g),p.subs[l.n]=g.code,p.inPartial||(p.code+='t.sub("'+T(l.n)+'",c,p,i);')},"\n":function(l,p){p.code+=ce('"\\n"'+(l.last?"":" + i"))},_v:function(l,p){p.code+="t.b(t.v(t."+D(l.n)+'("'+T(l.n)+'",c,p,0)));'},_t:function(l,p){p.code+=ce('"'+T(l.text)+'"')},"{":I,"&":I};function I(l,p){p.code+="t.b(t.t(t."+D(l.n)+'("'+T(l.n)+'",c,p,0)));'}function ce(l){return"t.b("+l+");"}n.walk=function(l,p){for(var g,C=0,A=l.length;C<A;C++)g=n.codegen[l[C].tag],g&&g(l[C],p);return p},n.parse=function(l,p,g){return g=g||{},a(l,"",[],g.sectionTags||[])},n.cache={},n.cacheKey=function(l,p){return[l,!!p.asString,!!p.disableLambda,p.delimiters,!!p.modelGet].join("||")},n.compile=function(l,p){p=p||{};var g=n.cacheKey(l,p),C=this.cache[g];if(C){var A=C.partials;for(var X in A)delete A[X].instance;return C}return C=this.generate(this.parse(this.scan(l,p.delimiters),l,p),l,p),this.cache[g]=C}})(s)})(Be)),Be}var ke={},it;function pn(){return it||(it=1,(function(s){(function(n){n.Template=function(a,c,w,h){a=a||{},this.r=a.code||this.r,this.c=w,this.options=h||{},this.text=c||"",this.partials=a.partials||{},this.subs=a.subs||{},this.buf=""},n.Template.prototype={r:function(a,c,w){return""},v:y,t:b,render:function(c,w,h){return this.ri([c],w||{},h)},ri:function(a,c,w){return this.r(a,c,w)},ep:function(a,c){var w=this.partials[a],h=c[w.name];if(w.instance&&w.base==h)return w.instance;if(typeof h=="string"){if(!this.c)throw new Error("No compiler available.");h=this.c.compile(h,this.options)}if(!h)return null;if(this.partials[a].base=h,w.subs){c.stackText||(c.stackText={});for(key in w.subs)c.stackText[key]||(c.stackText[key]=this.activeSub!==void 0&&c.stackText[this.activeSub]?c.stackText[this.activeSub]:this.text);h=e(h,w.subs,w.partials,this.stackSubs,this.stackPartials,c.stackText)}return this.partials[a].instance=h,h},rp:function(a,c,w,h){var x=this.ep(a,w);return x?x.ri(c,w,h):""},rs:function(a,c,w){var h=a[a.length-1];if(!E(h)){w(a,c,this);return}for(var x=0;x<h.length;x++)a.push(h[x]),w(a,c,this),a.pop()},s:function(a,c,w,h,x,N,T){var D;return E(a)&&a.length===0?!1:(typeof a=="function"&&(a=this.ms(a,c,w,h,x,N,T)),D=!!a,!h&&D&&c&&c.push(typeof a=="object"?a:c[c.length-1]),D)},d:function(a,c,w,h){var x,N=a.split("."),T=this.f(N[0],c,w,h),D=this.options.modelGet,S=null;if(a==="."&&E(c[c.length-2]))T=c[c.length-1];else for(var I=1;I<N.length;I++)x=t(N[I],T,D),x!==void 0?(S=T,T=x):T="";return h&&!T?!1:(!h&&typeof T=="function"&&(c.push(S),T=this.mv(T,c,w),c.pop()),T)},f:function(a,c,w,h){for(var x=!1,N=null,T=!1,D=this.options.modelGet,S=c.length-1;S>=0;S--)if(N=c[S],x=t(a,N,D),x!==void 0){T=!0;break}return T?(!h&&typeof x=="function"&&(x=this.mv(x,c,w)),x):h?!1:""},ls:function(a,c,w,h,x,N){var T=this.options.delimiters;return this.options.delimiters=N,this.b(this.ct(b(a.call(c,x,w)),c,h)),this.options.delimiters=T,!1},ct:function(a,c,w){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(a,this.options).render(c,w)},b:function(a){this.buf+=a},fl:function(){var a=this.buf;return this.buf="",a},ms:function(a,c,w,h,x,N,T){var D,S=c[c.length-1],I=a.call(S);return typeof I=="function"?h?!0:(D=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(I,S,c,w,D.substring(x,N),T)):I},mv:function(a,c,w){var h=c[c.length-1],x=a.call(h);return typeof x=="function"?this.ct(b(x.call(h)),h,w):x},sub:function(a,c,w,h){var x=this.subs[a];x&&(this.activeSub=a,x(c,w,this,h),this.activeSub=!1)}};function t(a,c,w){var h;return c&&typeof c=="object"&&(c[a]!==void 0?h=c[a]:w&&c.get&&typeof c.get=="function"&&(h=c.get(a))),h}function e(a,c,w,h,x,N){function T(){}T.prototype=a;function D(){}D.prototype=a.subs;var S,I=new T;I.subs=new D,I.subsText={},I.buf="",h=h||{},I.stackSubs=h,I.subsText=N;for(S in c)h[S]||(h[S]=c[S]);for(S in h)I.subs[S]=h[S];x=x||{},I.stackPartials=x;for(S in w)x[S]||(x[S]=w[S]);for(S in x)I.partials[S]=x[S];return I}var i=/&/g,o=/</g,r=/>/g,f=/\'/g,d=/\"/g,u=/[&<>\"\']/;function b(a){return String(a??"")}function y(a){return a=b(a),u.test(a)?a.replace(i,"&amp;").replace(o,"&lt;").replace(r,"&gt;").replace(f,"&#39;").replace(d,"&quot;"):a}var E=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(s)})(ke)),ke}var Re,rt;function mn(){if(rt)return Re;rt=1;var s=hn();return s.Template=pn().Template,s.template=s.Template,Re=s,Re}var B=mn();const W={};W["file-summary-line"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<li class="d2h-file-list-line">'),e.b(`
12
+ `+t),e.b(' <span class="d2h-file-name-wrapper">'),e.b(`
13
+ `+t),e.b(e.rp("<fileIcon0",s,n," ")),e.b(' <a href="#'),e.b(e.v(e.f("fileHtmlId",s,n,0))),e.b('" class="d2h-file-name">'),e.b(e.v(e.f("fileName",s,n,0))),e.b("</a>"),e.b(`
14
+ `+t),e.b(' <span class="d2h-file-stats">'),e.b(`
15
+ `+t),e.b(' <span class="d2h-lines-added">'),e.b(e.v(e.f("addedLines",s,n,0))),e.b("</span>"),e.b(`
16
+ `+t),e.b(' <span class="d2h-lines-deleted">'),e.b(e.v(e.f("deletedLines",s,n,0))),e.b("</span>"),e.b(`
17
+ `+t),e.b(" </span>"),e.b(`
18
+ `+t),e.b(" </span>"),e.b(`
19
+ `+t),e.b("</li>"),e.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});W["file-summary-wrapper"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<div class="d2h-file-list-wrapper '),e.b(e.v(e.f("colorScheme",s,n,0))),e.b('">'),e.b(`
20
+ `+t),e.b(' <div class="d2h-file-list-header">'),e.b(`
21
+ `+t),e.b(' <span class="d2h-file-list-title">Files changed ('),e.b(e.v(e.f("filesNumber",s,n,0))),e.b(")</span>"),e.b(`
22
+ `+t),e.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),e.b(`
23
+ `+t),e.b(' <a class="d2h-file-switch d2h-show">show</a>'),e.b(`
24
+ `+t),e.b(" </div>"),e.b(`
25
+ `+t),e.b(' <ol class="d2h-file-list">'),e.b(`
26
+ `+t),e.b(" "),e.b(e.t(e.f("files",s,n,0))),e.b(`
27
+ `+t),e.b(" </ol>"),e.b(`
28
+ `+t),e.b("</div>"),e.fl()},partials:{},subs:{}});W["generic-block-header"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b("<tr>"),e.b(`
29
+ `+t),e.b(' <td class="'),e.b(e.v(e.f("lineClass",s,n,0))),e.b(" "),e.b(e.v(e.d("CSSLineClass.INFO",s,n,0))),e.b('"></td>'),e.b(`
30
+ `+t),e.b(' <td class="'),e.b(e.v(e.d("CSSLineClass.INFO",s,n,0))),e.b('">'),e.b(`
31
+ `+t),e.b(' <div class="'),e.b(e.v(e.f("contentClass",s,n,0))),e.b('">'),e.s(e.f("blockHeader",s,n,1),s,n,0,156,173,"{{ }}")&&(e.rs(s,n,function(i,o,r){r.b(r.t(r.f("blockHeader",i,o,0)))}),s.pop()),e.s(e.f("blockHeader",s,n,1),s,n,1,0,0,"")||e.b("&nbsp;"),e.b("</div>"),e.b(`
32
+ `+t),e.b(" </td>"),e.b(`
33
+ `+t),e.b("</tr>"),e.fl()},partials:{},subs:{}});W["generic-empty-diff"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b("<tr>"),e.b(`
34
+ `+t),e.b(' <td class="'),e.b(e.v(e.d("CSSLineClass.INFO",s,n,0))),e.b('">'),e.b(`
35
+ `+t),e.b(' <div class="'),e.b(e.v(e.f("contentClass",s,n,0))),e.b('">'),e.b(`
36
+ `+t),e.b(" File without changes"),e.b(`
37
+ `+t),e.b(" </div>"),e.b(`
38
+ `+t),e.b(" </td>"),e.b(`
39
+ `+t),e.b("</tr>"),e.fl()},partials:{},subs:{}});W["generic-file-path"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-file-name-wrapper">'),e.b(`
40
+ `+t),e.b(e.rp("<fileIcon0",s,n," ")),e.b(' <span class="d2h-file-name">'),e.b(e.v(e.f("fileDiffName",s,n,0))),e.b("</span>"),e.b(`
41
+ `+t),e.b(e.rp("<fileTag1",s,n," ")),e.b("</span>"),e.b(`
42
+ `+t),e.b('<label class="d2h-file-collapse">'),e.b(`
43
+ `+t),e.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),e.b(`
44
+ `+t),e.b(" Viewed"),e.b(`
45
+ `+t),e.b("</label>"),e.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});W["generic-line"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b("<tr>"),e.b(`
46
+ `+t),e.b(' <td class="'),e.b(e.v(e.f("lineClass",s,n,0))),e.b(" "),e.b(e.v(e.f("type",s,n,0))),e.b('">'),e.b(`
47
+ `+t),e.b(" "),e.b(e.t(e.f("lineNumber",s,n,0))),e.b(`
48
+ `+t),e.b(" </td>"),e.b(`
49
+ `+t),e.b(' <td class="'),e.b(e.v(e.f("type",s,n,0))),e.b('">'),e.b(`
50
+ `+t),e.b(' <div class="'),e.b(e.v(e.f("contentClass",s,n,0))),e.b('">'),e.b(`
51
+ `+t),e.s(e.f("prefix",s,n,1),s,n,0,162,238,"{{ }}")&&(e.rs(s,n,function(i,o,r){r.b(' <span class="d2h-code-line-prefix">'),r.b(r.t(r.f("prefix",i,o,0))),r.b("</span>"),r.b(`
52
+ `+t)}),s.pop()),e.s(e.f("prefix",s,n,1),s,n,1,0,0,"")||(e.b(' <span class="d2h-code-line-prefix">&nbsp;</span>'),e.b(`
53
+ `+t)),e.s(e.f("content",s,n,1),s,n,0,371,445,"{{ }}")&&(e.rs(s,n,function(i,o,r){r.b(' <span class="d2h-code-line-ctn">'),r.b(r.t(r.f("content",i,o,0))),r.b("</span>"),r.b(`
54
+ `+t)}),s.pop()),e.s(e.f("content",s,n,1),s,n,1,0,0,"")||(e.b(' <span class="d2h-code-line-ctn"><br></span>'),e.b(`
55
+ `+t)),e.b(" </div>"),e.b(`
56
+ `+t),e.b(" </td>"),e.b(`
57
+ `+t),e.b("</tr>"),e.fl()},partials:{},subs:{}});W["generic-wrapper"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<div class="d2h-wrapper '),e.b(e.v(e.f("colorScheme",s,n,0))),e.b('">'),e.b(`
58
+ `+t),e.b(" "),e.b(e.t(e.f("content",s,n,0))),e.b(`
59
+ `+t),e.b("</div>"),e.fl()},partials:{},subs:{}});W["icon-file-added"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),e.b(`
60
+ `+t),e.b(' width="14">'),e.b(`
61
+ `+t),e.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),e.b(`
62
+ `+t),e.b("</svg>"),e.fl()},partials:{},subs:{}});W["icon-file-changed"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),e.b(`
63
+ `+t),e.b(' viewBox="0 0 14 16" width="14">'),e.b(`
64
+ `+t),e.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),e.b(`
65
+ `+t),e.b("</svg>"),e.fl()},partials:{},subs:{}});W["icon-file-deleted"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),e.b(`
66
+ `+t),e.b(' viewBox="0 0 14 16" width="14">'),e.b(`
67
+ `+t),e.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),e.b(`
68
+ `+t),e.b("</svg>"),e.fl()},partials:{},subs:{}});W["icon-file-renamed"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),e.b(`
69
+ `+t),e.b(' viewBox="0 0 14 16" width="14">'),e.b(`
70
+ `+t),e.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),e.b(`
71
+ `+t),e.b("</svg>"),e.fl()},partials:{},subs:{}});W["icon-file"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),e.b(`
72
+ `+t),e.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),e.b(`
73
+ `+t),e.b("</svg>"),e.fl()},partials:{},subs:{}});W["line-by-line-file-diff"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<div id="'),e.b(e.v(e.f("fileHtmlId",s,n,0))),e.b('" class="d2h-file-wrapper" data-lang="'),e.b(e.v(e.d("file.language",s,n,0))),e.b('">'),e.b(`
74
+ `+t),e.b(' <div class="d2h-file-header">'),e.b(`
75
+ `+t),e.b(" "),e.b(e.t(e.f("filePath",s,n,0))),e.b(`
76
+ `+t),e.b(" </div>"),e.b(`
77
+ `+t),e.b(' <div class="d2h-file-diff">'),e.b(`
78
+ `+t),e.b(' <div class="d2h-code-wrapper">'),e.b(`
79
+ `+t),e.b(' <table class="d2h-diff-table">'),e.b(`
80
+ `+t),e.b(' <tbody class="d2h-diff-tbody">'),e.b(`
81
+ `+t),e.b(" "),e.b(e.t(e.f("diffs",s,n,0))),e.b(`
82
+ `+t),e.b(" </tbody>"),e.b(`
83
+ `+t),e.b(" </table>"),e.b(`
84
+ `+t),e.b(" </div>"),e.b(`
85
+ `+t),e.b(" </div>"),e.b(`
86
+ `+t),e.b("</div>"),e.fl()},partials:{},subs:{}});W["line-by-line-numbers"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<div class="line-num1">'),e.b(e.v(e.f("oldNumber",s,n,0))),e.b("</div>"),e.b(`
87
+ `+t),e.b('<div class="line-num2">'),e.b(e.v(e.f("newNumber",s,n,0))),e.b("</div>"),e.fl()},partials:{},subs:{}});W["side-by-side-file-diff"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<div id="'),e.b(e.v(e.f("fileHtmlId",s,n,0))),e.b('" class="d2h-file-wrapper" data-lang="'),e.b(e.v(e.d("file.language",s,n,0))),e.b('">'),e.b(`
88
+ `+t),e.b(' <div class="d2h-file-header">'),e.b(`
89
+ `+t),e.b(" "),e.b(e.t(e.f("filePath",s,n,0))),e.b(`
90
+ `+t),e.b(" </div>"),e.b(`
91
+ `+t),e.b(' <div class="d2h-files-diff">'),e.b(`
92
+ `+t),e.b(' <div class="d2h-file-side-diff">'),e.b(`
93
+ `+t),e.b(' <div class="d2h-code-wrapper">'),e.b(`
94
+ `+t),e.b(' <table class="d2h-diff-table">'),e.b(`
95
+ `+t),e.b(' <tbody class="d2h-diff-tbody">'),e.b(`
96
+ `+t),e.b(" "),e.b(e.t(e.d("diffs.left",s,n,0))),e.b(`
97
+ `+t),e.b(" </tbody>"),e.b(`
98
+ `+t),e.b(" </table>"),e.b(`
99
+ `+t),e.b(" </div>"),e.b(`
100
+ `+t),e.b(" </div>"),e.b(`
101
+ `+t),e.b(' <div class="d2h-file-side-diff">'),e.b(`
102
+ `+t),e.b(' <div class="d2h-code-wrapper">'),e.b(`
103
+ `+t),e.b(' <table class="d2h-diff-table">'),e.b(`
104
+ `+t),e.b(' <tbody class="d2h-diff-tbody">'),e.b(`
105
+ `+t),e.b(" "),e.b(e.t(e.d("diffs.right",s,n,0))),e.b(`
106
+ `+t),e.b(" </tbody>"),e.b(`
107
+ `+t),e.b(" </table>"),e.b(`
108
+ `+t),e.b(" </div>"),e.b(`
109
+ `+t),e.b(" </div>"),e.b(`
110
+ `+t),e.b(" </div>"),e.b(`
111
+ `+t),e.b("</div>"),e.fl()},partials:{},subs:{}});W["tag-file-added"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),e.fl()},partials:{},subs:{}});W["tag-file-changed"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),e.fl()},partials:{},subs:{}});W["tag-file-deleted"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),e.fl()},partials:{},subs:{}});W["tag-file-renamed"]=new B.Template({code:function(s,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),e.fl()},partials:{},subs:{}});class bn{constructor({compiledTemplates:n={},rawTemplates:t={}}){const e=Object.entries(t).reduce((i,[o,r])=>{const f=B.compile(r,{asString:!1});return Object.assign(Object.assign({},i),{[o]:f})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},W),n),e)}static compile(n){return B.compile(n,{asString:!1})}render(n,t,e,i,o){const r=this.templateKey(n,t);try{return this.preCompiledTemplates[r].render(e,i,o)}catch{throw new Error(`Could not find template to render '${r}'`)}}template(n,t){return this.preCompiledTemplates[this.templateKey(n,t)]}templateKey(n,t){return`${n}-${t}`}}const gn=Object.assign(Object.assign(Object.assign({},ft),ut),{outputFormat:Ht.LINE_BY_LINE,drawFileList:!0});function vn(s,n={}){const t=Object.assign(Object.assign({},gn),n),e=typeof s=="string"?Gt(s,t):s,i=new bn(t),{colorScheme:o}=t,r={colorScheme:o},f=t.drawFileList?new rn(i,r).render(e):"",d=t.outputFormat==="side-by-side"?new un(i,t).render(e):new on(i,t).render(e);return f+d}var Y={},at;function wn(){if(at)return Y;at=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.ColorSchemeType=Y.DiffStyleType=Y.LineMatchingType=Y.OutputFormatType=Y.LineType=void 0;var s;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(s||(Y.LineType=s={})),Y.OutputFormatType={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},Y.LineMatchingType={LINES:"lines",WORDS:"words",NONE:"none"},Y.DiffStyleType={WORD:"word",CHAR:"char"};var n;return(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(n||(Y.ColorSchemeType=n={})),Y}var yn=wn();H[te]="src/lib/DiffDialog.svelte";var xn=le(oe('<div class="text-sm text-muted py-8 text-center">Loading diff...</div>'),H[te],[[78,4]]),Tn=le(oe('<div class="text-sm text-danger py-8 text-center"> </div>'),H[te],[[80,4]]),Nn=le(oe('<div class="text-sm text-muted py-8 text-center">No changes</div>'),H[te],[[82,4]]),Cn=le(oe('<div class="text-[11px] text-warning px-3 py-1">Truncated (exceeded 200KB)</div>'),H[te],[[111,10]]),En=le(oe('<div class="diff-container overflow-auto max-h-[60vh] md:max-h-[70vh] rounded-md border border-edge svelte-12rjmc4"><!> <!></div>'),H[te],[[109,6]]),Sn=le(oe('<div class="overflow-auto max-h-[60vh] md:max-h-[70vh] rounded-md border border-edge"><div class="px-3 py-2 text-[11px] text-muted border-b border-edge bg-surface font-mono">git status --short</div> <pre class="git-status-output svelte-12rjmc4"> </pre></div>'),H[te],[[116,6,[[117,8],[120,8]]]]),Ln=le(oe('<li class="flex items-baseline gap-2 px-3 py-1.5 border-b border-edge last:border-b-0"><code class="text-[11px] text-accent shrink-0"> </code> <span class="text-[12px] text-primary"> </span></li>'),H[te],[[125,10,[[126,12],[127,12]]]]),_n=le(oe('<ul class="commit-list overflow-auto max-h-[60vh] md:max-h-[70vh] rounded-md border border-edge list-none m-0 p-0"></ul>'),H[te],[[123,6]]),Dn=le(oe('<div class="flex gap-1 mb-3"><button type="button">Current diff</button> <button type="button"> </button> <button type="button"> </button></div> <!>',1),H[te],[[84,4,[[85,6],[92,6],[99,6]]]]),Pn=le(oe('<div class="mb-4 flex flex-wrap items-center justify-between gap-3"><h2 class="text-base">Changes &mdash; <span class="font-mono text-sm"> </span></h2> <!></div> <!> <div class="flex justify-end mt-4"><!></div>',1),H[te],[[70,2,[[71,4,[[71,42]]]]],[134,2]]);function H(s,n){wt(new.target),yt(n,!0,H);let t=xt(n,"cursorUrl",3,null),e=se(ge(""),"uncommitted"),i=se(ge(!1),"uncommittedTruncated"),o=se(ge(""),"gitStatus"),r=se(ge(Tt([])),"unpushedCommits"),f=se(ge(!0),"loading"),d=se(ge(""),"error");Xe(()=>{Q(f,!0),Q(d,""),Nt.fetchWorktreeDiff({params:{name:n.branch}}).then(h=>{Q(e,h.uncommitted,!0),Q(i,h.uncommittedTruncated,!0),Q(o,h.gitStatus,!0),Q(r,h.unpushedCommits,!0)}).catch(h=>{Q(d,Ct(h),!0)}).finally(()=>{Q(f,!1)})});const u={outputFormat:"line-by-line",colorScheme:yn.ColorSchemeType.DARK,drawFileList:!1};let b=se(Oe(()=>L(e)?vn(L(e),u):""),"renderedUncommitted"),y=se(Oe(()=>L(o)?L(o).split(`
112
+ `).filter(h=>h.length>0).length:0),"gitStatusLineCount"),E=se(Oe(()=>!!L(e)||L(y)>0||L(r).length>0),"hasContent"),a=se(ge("diff"),"activeTab"),c=!1;Xe(()=>{!L(f)&&!L(d)&&!c&&(c=!0,Q(a,L(e)?"diff":L(y)>0?"status":"unpushed",!0))});var w={...Et()};return ue(()=>St(s,{get onclose(){return n.onclose},wide:!0,maxWidth:"90vw",className:"diff-dialog",children:qe(H,(h,x)=>{var N=Pn(),T=Ke(N),D=q(T),S=ie(q(D)),I=q(S,!0);$(S),$(D);var ce=ie(D,2);{var l=M=>{ue(()=>Lt(M,{get url(){return t()}}),"component",H,73,6,{componentTag:"CursorButton"})};ue(()=>_e(ce,M=>{t()&&M(l)}),"if",H,72,4)}$(T);var p=ie(T,2);{var g=M=>{var j=xn();ee(M,j)},C=M=>{var j=Tn(),k=q(j,!0);$(j),ye(()=>ve(k,L(d))),ee(M,j)},A=M=>{var j=Nn();ee(M,j)},X=M=>{var j=Dn(),k=Ke(j),O=q(k);let ne;var m=ie(O,2);let _;var v=q(m);$(m);var z=ie(m,2);let fe;var Ne=q(z);$(z),$(k);var de=ie(k,2);{var me=F=>{var U=En(),K=q(U);{var we=be=>{var Me=Cn();ee(be,Me)};ue(()=>_e(K,be=>{L(i)&&be(we)}),"if",H,110,8)}var Ce=ie(K,2);Ft(Ce,()=>L(b)),$(U),ee(F,U)},Z=F=>{var U=Sn(),K=ie(q(U),2),we=q(K,!0);$(K),$(U),ye(()=>ve(we,L(o))),ee(F,U)},J=F=>{var U=_n();ue(()=>_t(U,21,()=>L(r),K=>K.hash,(K,we)=>{var Ce=Ln(),be=q(Ce),Me=q(be,!0);$(be);var $e=ie(be,2),ht=q($e,!0);$($e),$(Ce),ye(()=>{ve(Me,L(we).hash),ve(ht,L(we).message)}),ee(K,Ce)}),"each",H,124,8),$(U),ee(F,U)};ue(()=>_e(de,F=>{he(L(a),"diff")&&L(e)?F(me):he(L(a),"status")&&L(y)>0?F(Z,1):he(L(a),"unpushed")&&L(r).length>0&&F(J,2)}),"if",H,108,4)}ye(()=>{ne=Fe(O,1,"tab-btn svelte-12rjmc4",null,ne,{active:he(L(a),"diff")}),O.disabled=!L(e),_=Fe(m,1,"tab-btn svelte-12rjmc4",null,_,{active:he(L(a),"status")}),m.disabled=he(L(y),0),ve(v,`Git status (${L(y)??""})`),fe=Fe(z,1,"tab-btn svelte-12rjmc4",null,fe,{active:he(L(a),"unpushed")}),z.disabled=he(L(r).length,0),ve(Ne,`Unpushed commits (${L(r).length??""})`)}),He("click",O,function(){return Q(a,"diff")}),He("click",m,function(){return Q(a,"status")}),He("click",z,function(){return Q(a,"unpushed")}),ee(M,j)};ue(()=>_e(p,M=>{L(f)?M(g):L(d)?M(C,1):L(E)?M(X,-1):M(A,2)}),"if",H,77,2)}var G=ie(p,2),P=q(G);ue(()=>Dt(P,{type:"button",get onclick(){return n.onclose},children:qe(H,(M,j)=>{Pt();var k=It("Close");ee(M,k)}),$$slots:{default:!0}}),"component",H,135,4,{componentTag:"Btn"}),$(G),ye(()=>ve(I,n.branch)),ee(h,N)}),$$slots:{default:!0}}),"component",H,69,0,{componentTag:"BaseDialog"}),Mt(w)}Ot(["click"]);export{H as default};