webmux 0.31.0 → 0.31.2
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/backend/dist/server.js +49 -26
- package/bin/webmux.js +40 -13
- package/frontend/dist/assets/{DiffDialog-AFwqV11h.js → DiffDialog-DXkWdnXl.js} +1 -1
- package/frontend/dist/assets/index-DLB0OmuO.js +33 -0
- package/frontend/dist/assets/index-HGkEqxw6.css +1 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-CDyziN6b.js +0 -33
- package/frontend/dist/assets/index-yjEx8o8T.css +0 -1
package/backend/dist/server.js
CHANGED
|
@@ -14975,12 +14975,26 @@ import { randomUUID } from "crypto";
|
|
|
14975
14975
|
// backend/src/adapters/git.ts
|
|
14976
14976
|
import { readdirSync, rmSync, statSync } from "fs";
|
|
14977
14977
|
import { resolve as resolve6, join as join5 } from "path";
|
|
14978
|
+
function spawnGit(args, cwd) {
|
|
14979
|
+
try {
|
|
14980
|
+
return {
|
|
14981
|
+
ok: true,
|
|
14982
|
+
result: Bun.spawnSync(["git", ...args], {
|
|
14983
|
+
cwd,
|
|
14984
|
+
stdout: "pipe",
|
|
14985
|
+
stderr: "pipe"
|
|
14986
|
+
})
|
|
14987
|
+
};
|
|
14988
|
+
} catch (error) {
|
|
14989
|
+
return { ok: false, stderr: `spawn error (cwd=${cwd}): ${errorMessage(error)}` };
|
|
14990
|
+
}
|
|
14991
|
+
}
|
|
14978
14992
|
function runGit(args, cwd) {
|
|
14979
|
-
const
|
|
14980
|
-
|
|
14981
|
-
|
|
14982
|
-
|
|
14983
|
-
}
|
|
14993
|
+
const spawned = spawnGit(args, cwd);
|
|
14994
|
+
if (!spawned.ok) {
|
|
14995
|
+
throw new Error(`git ${args.join(" ")} failed: ${spawned.stderr}`);
|
|
14996
|
+
}
|
|
14997
|
+
const { result } = spawned;
|
|
14984
14998
|
if (result.exitCode !== 0) {
|
|
14985
14999
|
const stderr = new TextDecoder().decode(result.stderr).trim();
|
|
14986
15000
|
throw new Error(`git ${args.join(" ")} failed: ${stderr || `exit ${result.exitCode}`}`);
|
|
@@ -14988,11 +15002,11 @@ function runGit(args, cwd) {
|
|
|
14988
15002
|
return new TextDecoder().decode(result.stdout).trim();
|
|
14989
15003
|
}
|
|
14990
15004
|
function tryRunGit(args, cwd) {
|
|
14991
|
-
const
|
|
14992
|
-
|
|
14993
|
-
|
|
14994
|
-
|
|
14995
|
-
}
|
|
15005
|
+
const spawned = spawnGit(args, cwd);
|
|
15006
|
+
if (!spawned.ok) {
|
|
15007
|
+
return { ok: false, stderr: spawned.stderr };
|
|
15008
|
+
}
|
|
15009
|
+
const { result } = spawned;
|
|
14996
15010
|
if (result.exitCode !== 0) {
|
|
14997
15011
|
return {
|
|
14998
15012
|
ok: false,
|
|
@@ -15113,6 +15127,16 @@ function listGitWorktrees(cwd) {
|
|
|
15113
15127
|
const output = runGit(["worktree", "list", "--porcelain"], cwd);
|
|
15114
15128
|
return parseGitWorktreePorcelain(output);
|
|
15115
15129
|
}
|
|
15130
|
+
function worktreeEntryPathExists(entry) {
|
|
15131
|
+
try {
|
|
15132
|
+
return statSync(entry.path).isDirectory();
|
|
15133
|
+
} catch {
|
|
15134
|
+
return false;
|
|
15135
|
+
}
|
|
15136
|
+
}
|
|
15137
|
+
function filterLiveWorktreeEntries(entries) {
|
|
15138
|
+
return entries.filter(worktreeEntryPathExists);
|
|
15139
|
+
}
|
|
15116
15140
|
function listLocalGitBranches(cwd) {
|
|
15117
15141
|
const output = runGit(["for-each-ref", "--format=%(refname:short)", "refs/heads"], cwd);
|
|
15118
15142
|
return output.split(`
|
|
@@ -15173,6 +15197,9 @@ class BunGitGateway {
|
|
|
15173
15197
|
listWorktrees(cwd) {
|
|
15174
15198
|
return listGitWorktrees(cwd);
|
|
15175
15199
|
}
|
|
15200
|
+
listLiveWorktrees(cwd) {
|
|
15201
|
+
return filterLiveWorktreeEntries(listGitWorktrees(cwd));
|
|
15202
|
+
}
|
|
15176
15203
|
listLocalBranches(cwd) {
|
|
15177
15204
|
return listLocalGitBranches(cwd);
|
|
15178
15205
|
}
|
|
@@ -15736,7 +15763,7 @@ class LifecycleService {
|
|
|
15736
15763
|
}
|
|
15737
15764
|
listProjectWorktrees() {
|
|
15738
15765
|
const projectRoot2 = resolve7(this.deps.projectRoot);
|
|
15739
|
-
return this.deps.git.
|
|
15766
|
+
return this.deps.git.listLiveWorktrees(projectRoot2).filter((entry) => !entry.bare && resolve7(entry.path) !== projectRoot2);
|
|
15740
15767
|
}
|
|
15741
15768
|
async readManagedMetas() {
|
|
15742
15769
|
const metas = await Promise.all(this.listProjectWorktrees().map(async (entry) => {
|
|
@@ -16566,7 +16593,7 @@ function startPrMonitor(getWorktreeGitDirs, linkedRepos, projectDir, intervalMs
|
|
|
16566
16593
|
}
|
|
16567
16594
|
|
|
16568
16595
|
// backend/src/services/linear-auto-create-service.ts
|
|
16569
|
-
var
|
|
16596
|
+
var LINEAR_AUTO_CREATE_POLL_INTERVAL_MS = 60000;
|
|
16570
16597
|
var processedIssueIds = new Set;
|
|
16571
16598
|
var AUTO_CREATE_LABEL = "webmux";
|
|
16572
16599
|
function filterAutoCreateIssues(issues, existingBranches) {
|
|
@@ -16580,12 +16607,9 @@ function filterAutoCreateIssues(issues, existingBranches) {
|
|
|
16580
16607
|
return !existingBranches.some((branch) => branchMatchesIssue(branch, issue.branchName));
|
|
16581
16608
|
});
|
|
16582
16609
|
}
|
|
16583
|
-
async function
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
return;
|
|
16587
|
-
}
|
|
16588
|
-
const result = await fetchAssignedIssues({ skipCache: true });
|
|
16610
|
+
async function runLinearAutoCreateOnce(deps) {
|
|
16611
|
+
const fetchIssues = deps.fetchIssues ?? fetchAssignedIssues;
|
|
16612
|
+
const result = await fetchIssues({ skipCache: true });
|
|
16589
16613
|
if (!result.ok) {
|
|
16590
16614
|
log.error(`[linear-auto-create] failed to fetch issues: ${result.error}`);
|
|
16591
16615
|
return;
|
|
@@ -16616,9 +16640,9 @@ ${issue.description ?? ""}`.trim()
|
|
|
16616
16640
|
}
|
|
16617
16641
|
}
|
|
16618
16642
|
}
|
|
16619
|
-
function startLinearAutoCreateMonitor(deps) {
|
|
16620
|
-
log.info(
|
|
16621
|
-
return startSerializedInterval(() =>
|
|
16643
|
+
function startLinearAutoCreateMonitor(deps, options = {}) {
|
|
16644
|
+
log.info(`[linear-auto-create] monitor started (interval: ${LINEAR_AUTO_CREATE_POLL_INTERVAL_MS}ms)`);
|
|
16645
|
+
return startSerializedInterval(() => runLinearAutoCreateOnce(deps), LINEAR_AUTO_CREATE_POLL_INTERVAL_MS, options.intervalDeps);
|
|
16622
16646
|
}
|
|
16623
16647
|
function resetProcessedIssues() {
|
|
16624
16648
|
processedIssueIds.clear();
|
|
@@ -16626,7 +16650,7 @@ function resetProcessedIssues() {
|
|
|
16626
16650
|
|
|
16627
16651
|
// backend/src/services/auto-remove-service.ts
|
|
16628
16652
|
async function runAutoRemove(deps) {
|
|
16629
|
-
const worktrees = deps.git.
|
|
16653
|
+
const worktrees = deps.git.listLiveWorktrees(deps.projectRoot).filter((e) => !e.bare && e.branch !== null && e.path !== deps.projectRoot);
|
|
16630
16654
|
for (const entry of worktrees) {
|
|
16631
16655
|
const branch = entry.branch;
|
|
16632
16656
|
if (deps.isRemoving(branch))
|
|
@@ -18208,7 +18232,7 @@ class ReconciliationService {
|
|
|
18208
18232
|
return await this.inFlight;
|
|
18209
18233
|
}
|
|
18210
18234
|
async runReconcile(normalizedRepoRoot) {
|
|
18211
|
-
const worktrees = this.deps.git.
|
|
18235
|
+
const worktrees = this.deps.git.listLiveWorktrees(normalizedRepoRoot);
|
|
18212
18236
|
const sessionName = buildProjectSessionName(normalizedRepoRoot);
|
|
18213
18237
|
let windows = [];
|
|
18214
18238
|
try {
|
|
@@ -18417,8 +18441,7 @@ function startLinearAutoCreate() {
|
|
|
18417
18441
|
stopLinearAutoCreate = startLinearAutoCreateMonitor({
|
|
18418
18442
|
lifecycleService,
|
|
18419
18443
|
git,
|
|
18420
|
-
projectRoot: PROJECT_DIR
|
|
18421
|
-
isActive: hasRecentDashboardActivity
|
|
18444
|
+
projectRoot: PROJECT_DIR
|
|
18422
18445
|
});
|
|
18423
18446
|
}
|
|
18424
18447
|
function stopLinearAutoCreateMonitor() {
|
|
@@ -18614,7 +18637,7 @@ async function hasValidControlToken(req) {
|
|
|
18614
18637
|
async function getWorktreeGitDirs() {
|
|
18615
18638
|
const gitDirs = new Map;
|
|
18616
18639
|
const projectRoot2 = resolve9(PROJECT_DIR);
|
|
18617
|
-
for (const entry of git.
|
|
18640
|
+
for (const entry of git.listLiveWorktrees(projectRoot2)) {
|
|
18618
18641
|
if (entry.bare || resolve9(entry.path) === projectRoot2 || !entry.branch)
|
|
18619
18642
|
continue;
|
|
18620
18643
|
gitDirs.set(entry.branch, git.resolveWorktreeGitDir(entry.path));
|
package/bin/webmux.js
CHANGED
|
@@ -50,12 +50,26 @@ var __require = import.meta.require;
|
|
|
50
50
|
// backend/src/adapters/git.ts
|
|
51
51
|
import { readdirSync, rmSync, statSync } from "fs";
|
|
52
52
|
import { resolve, join } from "path";
|
|
53
|
+
function spawnGit(args, cwd) {
|
|
54
|
+
try {
|
|
55
|
+
return {
|
|
56
|
+
ok: true,
|
|
57
|
+
result: Bun.spawnSync(["git", ...args], {
|
|
58
|
+
cwd,
|
|
59
|
+
stdout: "pipe",
|
|
60
|
+
stderr: "pipe"
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
} catch (error) {
|
|
64
|
+
return { ok: false, stderr: `spawn error (cwd=${cwd}): ${errorMessage(error)}` };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
53
67
|
function runGit(args, cwd) {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
68
|
+
const spawned = spawnGit(args, cwd);
|
|
69
|
+
if (!spawned.ok) {
|
|
70
|
+
throw new Error(`git ${args.join(" ")} failed: ${spawned.stderr}`);
|
|
71
|
+
}
|
|
72
|
+
const { result } = spawned;
|
|
59
73
|
if (result.exitCode !== 0) {
|
|
60
74
|
const stderr = new TextDecoder().decode(result.stderr).trim();
|
|
61
75
|
throw new Error(`git ${args.join(" ")} failed: ${stderr || `exit ${result.exitCode}`}`);
|
|
@@ -63,11 +77,11 @@ function runGit(args, cwd) {
|
|
|
63
77
|
return new TextDecoder().decode(result.stdout).trim();
|
|
64
78
|
}
|
|
65
79
|
function tryRunGit(args, cwd) {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
80
|
+
const spawned = spawnGit(args, cwd);
|
|
81
|
+
if (!spawned.ok) {
|
|
82
|
+
return { ok: false, stderr: spawned.stderr };
|
|
83
|
+
}
|
|
84
|
+
const { result } = spawned;
|
|
71
85
|
if (result.exitCode !== 0) {
|
|
72
86
|
return {
|
|
73
87
|
ok: false,
|
|
@@ -188,6 +202,16 @@ function listGitWorktrees(cwd) {
|
|
|
188
202
|
const output = runGit(["worktree", "list", "--porcelain"], cwd);
|
|
189
203
|
return parseGitWorktreePorcelain(output);
|
|
190
204
|
}
|
|
205
|
+
function worktreeEntryPathExists(entry) {
|
|
206
|
+
try {
|
|
207
|
+
return statSync(entry.path).isDirectory();
|
|
208
|
+
} catch {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function filterLiveWorktreeEntries(entries) {
|
|
213
|
+
return entries.filter(worktreeEntryPathExists);
|
|
214
|
+
}
|
|
191
215
|
function listLocalGitBranches(cwd) {
|
|
192
216
|
const output = runGit(["for-each-ref", "--format=%(refname:short)", "refs/heads"], cwd);
|
|
193
217
|
return output.split(`
|
|
@@ -248,6 +272,9 @@ class BunGitGateway {
|
|
|
248
272
|
listWorktrees(cwd) {
|
|
249
273
|
return listGitWorktrees(cwd);
|
|
250
274
|
}
|
|
275
|
+
listLiveWorktrees(cwd) {
|
|
276
|
+
return filterLiveWorktreeEntries(listGitWorktrees(cwd));
|
|
277
|
+
}
|
|
251
278
|
listLocalBranches(cwd) {
|
|
252
279
|
return listLocalGitBranches(cwd);
|
|
253
280
|
}
|
|
@@ -17754,7 +17781,7 @@ class LifecycleService {
|
|
|
17754
17781
|
}
|
|
17755
17782
|
listProjectWorktrees() {
|
|
17756
17783
|
const projectRoot2 = resolve8(this.deps.projectRoot);
|
|
17757
|
-
return this.deps.git.
|
|
17784
|
+
return this.deps.git.listLiveWorktrees(projectRoot2).filter((entry) => !entry.bare && resolve8(entry.path) !== projectRoot2);
|
|
17758
17785
|
}
|
|
17759
17786
|
async readManagedMetas() {
|
|
17760
17787
|
const metas = await Promise.all(this.listProjectWorktrees().map(async (entry) => {
|
|
@@ -18507,7 +18534,7 @@ class ReconciliationService {
|
|
|
18507
18534
|
return await this.inFlight;
|
|
18508
18535
|
}
|
|
18509
18536
|
async runReconcile(normalizedRepoRoot) {
|
|
18510
|
-
const worktrees = this.deps.git.
|
|
18537
|
+
const worktrees = this.deps.git.listLiveWorktrees(normalizedRepoRoot);
|
|
18511
18538
|
const sessionName = buildProjectSessionName(normalizedRepoRoot);
|
|
18512
18539
|
let windows = [];
|
|
18513
18540
|
try {
|
|
@@ -19351,7 +19378,7 @@ import { fileURLToPath } from "url";
|
|
|
19351
19378
|
// package.json
|
|
19352
19379
|
var package_default = {
|
|
19353
19380
|
name: "webmux",
|
|
19354
|
-
version: "0.31.
|
|
19381
|
+
version: "0.31.2",
|
|
19355
19382
|
description: "Web dashboard for workmux \u2014 browser UI with embedded terminals, PR monitoring, and CI integration",
|
|
19356
19383
|
type: "module",
|
|
19357
19384
|
repository: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as ue,a as rt,b as Be,g as we,r as at,c as lt,N as ot,d as dt,p as ct,e as ft,s as de,f as ut,u as Re,h as Y,i as ht,j as pt,k as D,B as bt,l as We,m as ee,n as X,o as ye,q as mt,v as gt,w as Q,x as ce,C as vt,y as Ee,z as Se,A as wt,D as Le,E as yt,F as se,G as xt}from"./index-
|
|
1
|
+
import{t as ue,a as rt,b as Be,g as we,r as at,c as lt,N as ot,d as dt,p as ct,e as ft,s as de,f as ut,u as Re,h as Y,i as ht,j as pt,k as D,B as bt,l as We,m as ee,n as X,o as ye,q as mt,v as gt,w as Q,x as ce,C as vt,y as Ee,z as Se,A as wt,D as Le,E as yt,F as se,G as xt}from"./index-DLB0OmuO.js";import"./vendor-xterm-DvXGiZvM.js";function Tt(s,n,t=!1,e=!1,i=!1,o=!1){var r=s,f="";if(t)var c=s;ue(()=>{var u=rt;if(f!==(f=n()??"")){if(t){u.nodes=null,c.innerHTML=f,f!==""&&Be(we(c),c.lastChild);return}if(u.nodes!==null&&(at(u.nodes.start,u.nodes.end),u.nodes=null),f!==""){var g=e?ot:i?dt:void 0,x=lt(e?"svg":i?"math":"template",g);x.innerHTML=f;var S=e||i?x:x.content;if(Be(we(S),S.lastChild),e||i)for(;we(S);)r.before(we(S));else r.before(S)}}})}var A;(function(s){s.INSERT="insert",s.DELETE="delete",s.CONTEXT="context"})(A||(A={}));const Nt={LINE_BY_LINE:"line-by-line"},Ct={NONE:"none"},Et={WORD:"word"};var he;(function(s){s.AUTO="auto",s.DARK="dark",s.LIGHT="light"})(he||(he={}));const St=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],Lt=RegExp("["+St.join("\\")+"]","g");function Dt(s){return s.replace(Lt,"\\$&")}function je(s){return s&&s.replace(/\\/g,"/")}function _t(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 Je(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 ke(s,n){const t=s.split(".");return t.length>1?t[t.length-1]:n}function ze(s,n){return n.reduce((t,e)=>t||s.startsWith(e),!1)}const Ue=["a/","b/","i/","w/","c/","o/"];function ae(s,n,t){const e=t!==void 0?[...Ue,t]:Ue,i=n?new RegExp(`^${Dt(n)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,o=""]=i.exec(s)||[],r=e.find(c=>o.indexOf(c)===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 Pt(s,n){return ae(s,"---",n)}function It(s,n){return ae(s,"+++",n)}function Mt(s,n={}){const t=[];let e=null,i=null,o=null,r=null,f=null,c=null,u=null;const g="--- ",x="+++ ",S="@@",a=/^old mode (\d{6})/,d=/^new mode (\d{6})/,m=/^deleted file mode (\d{6})/,p=/^new file mode (\d{6})/,y=/^copy from "?(.+)"?/,N=/^copy to "?(.+)"?/,T=/^rename from "?(.+)"?/,P=/^rename to "?(.+)"?/,L=/^similarity index (\d+)%/,I=/^dissimilarity index (\d+)%/,ie=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,l=/^Binary files (.*) and (.*) differ/,h=/^GIT binary patch/,w=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,C=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,M=/^new file mode (\d{6})/,V=/^deleted file mode (\d{6}),(\d{6})/,k=s.replace(/\/g,"").replace(/\r\n?/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`);function E(){i!==null&&e!==null&&(e.blocks.push(i),i=null)}function R(){e!==null&&(!e.oldName&&c!==null&&(e.oldName=c),!e.newName&&u!==null&&(e.newName=u),e.newName&&(t.push(e),e=null)),c=null,u=null}function $(){E(),R(),e={blocks:[],deletedLines:0,addedLines:0}}function j(b){E();let _;e!==null&&((_=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(b))?(e.isCombined=!1,o=parseInt(_[1],10),f=parseInt(_[2],10)):(_=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(b))?(e.isCombined=!0,o=parseInt(_[1],10),r=parseInt(_[2],10),f=parseInt(_[3],10)):(b.startsWith(S)&&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:b}}function O(b){if(e===null||i===null||o===null||f===null)return;const _={content:b},v=e.isCombined?["+ "," +","++"]:["+"],z=e.isCombined?["- "," -","--"]:["-"];ze(b,v)?(e.addedLines++,_.type=A.INSERT,_.oldNumber=void 0,_.newNumber=f++):ze(b,z)?(e.deletedLines++,_.type=A.DELETE,_.oldNumber=o++,_.newNumber=void 0):(_.type=A.CONTEXT,_.oldNumber=o++,_.newNumber=f++),i.lines.push(_)}function q(b,_){let v=_;for(;v<k.length-3;){if(b.startsWith("diff"))return!1;if(k[v].startsWith(g)&&k[v+1].startsWith(x)&&k[v+2].startsWith(S))return!0;v++}return!1}return k.forEach((b,_)=>{if(!b||b.startsWith("*"))return;let v;const z=k[_-1],le=k[_+1],be=k[_+2];if(b.startsWith("diff --git")||b.startsWith("diff --combined")){if($(),(v=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(b))&&(c=ae(v[1],void 0,n.dstPrefix),u=ae(v[2],void 0,n.srcPrefix)),e===null)throw new Error("Where is my file !!!");e.isGitDiff=!0;return}if(b.startsWith("Binary files")&&!(e!=null&&e.isGitDiff)){if($(),(v=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(b))&&(c=ae(v[1],void 0,n.dstPrefix),u=ae(v[2],void 0,n.srcPrefix)),e===null)throw new Error("Where is my file !!!");e.isBinary=!0;return}if((!e||!e.isGitDiff&&e&&b.startsWith(g)&&le.startsWith(x)&&be.startsWith(S))&&$(),e!=null&&e.isTooBig)return;if(e&&(typeof n.diffMaxChanges=="number"&&e.addedLines+e.deletedLines>n.diffMaxChanges||typeof n.diffMaxLineLength=="number"&&b.length>n.diffMaxLineLength)){e.isTooBig=!0,e.addedLines=0,e.deletedLines=0,e.blocks=[],i=null;const oe=typeof n.diffTooBigMessage=="function"?n.diffTooBigMessage(t.length):"Diff too big to be displayed";j(oe);return}if(b.startsWith(g)&&le.startsWith(x)||b.startsWith(x)&&z.startsWith(g)){if(e&&!e.oldName&&b.startsWith("--- ")&&(v=Pt(b,n.srcPrefix))){e.oldName=v,e.language=ke(e.oldName,e.language);return}if(e&&!e.newName&&b.startsWith("+++ ")&&(v=It(b,n.dstPrefix))){e.newName=v,e.language=ke(e.newName,e.language);return}}if(e&&(b.startsWith(S)||e.isGitDiff&&e.oldName&&e.newName&&!i)){j(b);return}if(i&&(b.startsWith("+")||b.startsWith("-")||b.startsWith(" "))){O(b);return}const re=!q(b,_);if(e===null)throw new Error("Where is my file !!!");(v=a.exec(b))?e.oldMode=v[1]:(v=d.exec(b))?e.newMode=v[1]:(v=m.exec(b))?(e.deletedFileMode=v[1],e.isDeleted=!0):(v=p.exec(b))?(e.newFileMode=v[1],e.isNew=!0):(v=y.exec(b))?(re&&(e.oldName=v[1]),e.isCopy=!0):(v=N.exec(b))?(re&&(e.newName=v[1]),e.isCopy=!0):(v=T.exec(b))?(re&&(e.oldName=v[1]),e.isRename=!0):(v=P.exec(b))?(re&&(e.newName=v[1]),e.isRename=!0):(v=l.exec(b))?(e.isBinary=!0,e.oldName=ae(v[1],void 0,n.srcPrefix),e.newName=ae(v[2],void 0,n.dstPrefix),j("Binary file")):h.test(b)?(e.isBinary=!0,j(b)):(v=L.exec(b))?e.unchangedPercentage=parseInt(v[1],10):(v=I.exec(b))?e.changedPercentage=parseInt(v[1],10):(v=ie.exec(b))?(e.checksumBefore=v[1],e.checksumAfter=v[2],v[3]&&(e.mode=v[3])):(v=w.exec(b))?(e.checksumBefore=[v[2],v[3]],e.checksumAfter=v[1]):(v=C.exec(b))?(e.oldMode=[v[2],v[3]],e.newMode=v[1]):(v=M.exec(b))?(e.newFileMode=v[1],e.isNew=!0):(v=V.exec(b))&&(e.deletedFileMode=v[1],e.isDeleted=!0)}),E(),R(),t}class Qe{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)),c=this.removeEmpty(this.tokenize(r,e));return this.diffWithOptionsObj(f,c,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,c=n.length;let u=1,g=f+c;e.maxEditLength!=null&&(g=Math.min(g,e.maxEditLength));const x=(o=e.timeout)!==null&&o!==void 0?o:1/0,S=Date.now()+x,a=[{oldPos:-1,lastComponent:void 0}];let d=this.extractCommon(a[0],t,n,0,e);if(a[0].oldPos+1>=c&&d+1>=f)return r(this.buildValues(a[0].lastComponent,t,n));let m=-1/0,p=1/0;const y=()=>{for(let N=Math.max(m,-u);N<=Math.min(p,u);N+=2){let T;const P=a[N-1],L=a[N+1];P&&(a[N-1]=void 0);let I=!1;if(L){const l=L.oldPos-N;I=L&&0<=l&&l<f}const ie=P&&P.oldPos+1<c;if(!I&&!ie){a[N]=void 0;continue}if(!ie||I&&P.oldPos<L.oldPos?T=this.addToPath(L,!0,!1,0,e):T=this.addToPath(P,!1,!0,1,e),d=this.extractCommon(T,t,n,N,e),T.oldPos+1>=c&&d+1>=f)return r(this.buildValues(T.lastComponent,t,n))||!0;a[N]=T,T.oldPos+1>=c&&(p=Math.min(p,N-1)),d+1>=f&&(m=Math.max(m,N+1))}u++};if(i)(function N(){setTimeout(function(){if(u>g||Date.now()>S)return i(void 0);y()||N()},0)})();else for(;u<=g&&Date.now()<=S;){const N=y();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 c=n.oldPos,u=c-i,g=0;for(;u+1<r&&c+1<f&&this.equals(e[c+1],t[u+1],o);)u++,c++,g++,o.oneChangePerToken&&(n.lastComponent={count:1,previousComponent:n.lastComponent,added:!1,removed:!1});return g&&!o.oneChangePerToken&&(n.lastComponent={count:g,previousComponent:n.lastComponent,added:!1,removed:!1}),n.oldPos=c,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,c=0,u=0;for(;f<r;f++){const g=i[f];if(g.removed)g.value=this.join(e.slice(u,u+g.count)),u+=g.count;else{if(!g.added&&this.useLongestToken){let x=t.slice(c,c+g.count);x=x.map(function(S,a){const d=e[u+a];return d.length>S.length?d:S}),g.value=this.join(x)}else g.value=this.join(t.slice(c,c+g.count));c+=g.count,g.added||(u+=g.count)}}return i}}class Ot extends Qe{}const Ft=new Ot;function Ht(s,n,t){return Ft.diff(s,n,t)}const Ge="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 At extends Qe{tokenize(n){const t=new RegExp(`(\\r?\\n)|[${Ge}]+|[^\\S\\n\\r]+|[^${Ge}]`,"ug");return n.match(t)||[]}}const Bt=new At;function Rt(s,n,t){return Bt.diff(s,n,t)}function Wt(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 Me(s){return(n,t)=>{const e=s(n).trim(),i=s(t).trim();return Wt(e,i)/(e.length+i.length)}}function Oe(s){function n(e,i,o=new Map){let r=1/0,f;for(let c=0;c<e.length;++c)for(let u=0;u<i.length;++u){const g=JSON.stringify([e[c],i[u]]);let x;o.has(g)&&(x=o.get(g))||(x=s(e[c],i[u]),o.set(g,x)),x<r&&(r=x,f={indexA:c,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 c=e.slice(0,f.indexA),u=i.slice(0,f.indexB),g=[e[f.indexA]],x=[i[f.indexB]],S=f.indexA+1,a=f.indexB+1,d=e.slice(S),m=i.slice(a),p=t(c,u,o+1,r),y=t(g,x,o+1,r),N=t(d,m,o+1,r);let T=y;return(f.indexA>0||f.indexB>0)&&(T=p.concat(T)),(e.length>S||i.length>a)&&(T=T.concat(N)),T}return t}const G={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},Te={matching:Ct.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:Et.WORD,colorScheme:he.LIGHT},te="/",Ze=Me(s=>s.value),jt=Oe(Ze);function De(s){return s.indexOf("dev/null")!==-1}function kt(s){return s.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}function zt(s){return s.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function xe(s){switch(s){case A.CONTEXT:return G.CONTEXT;case A.INSERT:return G.INSERTS;case A.DELETE:return G.DELETES}}function Fe(s){switch(s){case he.DARK:return"d2h-dark-color-scheme";case he.AUTO:return"d2h-auto-color-scheme";case he.LIGHT:default:return"d2h-light-color-scheme"}}function Ut(s){return s?2:1}function pe(s){return s.slice(0).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function ne(s,n,t=!0){const e=Ut(n);return{prefix:s.substring(0,e),content:t?pe(s.substring(e)):s.substring(e)}}function Ne(s){const n=je(s.oldName),t=je(s.newName);if(n!==t&&!De(n)&&!De(t)){const e=[],i=[],o=n.split(te),r=t.split(te),f=o.length,c=r.length;let u=0,g=f-1,x=c-1;for(;u<g&&u<x&&o[u]===r[u];)e.push(r[u]),u+=1;for(;g>u&&x>u&&o[g]===r[x];)i.unshift(r[x]),g-=1,x-=1;const S=e.join(te),a=i.join(te),d=o.slice(u,g+1).join(te),m=r.slice(u,x+1).join(te);return S.length&&a.length?S+te+"{"+d+" → "+m+"}"+te+a:S.length?S+te+"{"+d+" → "+m+"}":a.length?"{"+d+" → "+m+"}"+te+a:n+" → "+t}else return De(t)?n:t}function He(s){return`d2h-${_t(Ne(s)).toString().slice(-6)}`}function Ae(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 et(s,n,t,e={}){const{matching:i,maxLineLengthHighlight:o,matchWordsThreshold:r,diffStyle:f}=Object.assign(Object.assign({},Te),e),c=ne(s,t,!1),u=ne(n,t,!1);if(c.content.length>o||u.content.length>o)return{oldLine:{prefix:c.prefix,content:pe(c.content)},newLine:{prefix:u.prefix,content:pe(u.content)}};const g=f==="char"?Ht(c.content,u.content):Rt(c.content,u.content),x=[];if(f==="word"&&i==="words"){const a=g.filter(p=>p.removed),d=g.filter(p=>p.added);jt(d,a).forEach(p=>{p[0].length===1&&p[1].length===1&&Ze(p[0][0],p[1][0])<r&&(x.push(p[0][0]),x.push(p[1][0]))})}const S=g.reduce((a,d)=>{const m=d.added?"ins":d.removed?"del":null,p=x.indexOf(d)>-1?' class="d2h-change"':"",y=pe(d.value);return m!==null?`${a}<${m}${p}>${y}</${m}>`:`${a}${y}`},"");return{oldLine:{prefix:c.prefix,content:kt(S)},newLine:{prefix:u.prefix,content:zt(S)}}}const Ve="file-summary",Gt="icon",Vt={colorScheme:Te.colorScheme};class $t{constructor(n,t={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},Vt),t)}render(n){const t=n.map(e=>this.hoganUtils.render(Ve,"line",{fileHtmlId:He(e),oldName:e.oldName,newName:e.newName,fileName:Ne(e),deletedLines:"-"+e.deletedLines,addedLines:"+"+e.addedLines},{fileIcon:this.hoganUtils.template(Gt,Ae(e))})).join(`
|
|
4
4
|
`);return this.hoganUtils.render(Ve,"wrapper",{colorScheme:Fe(this.config.colorScheme),filesNumber:n.length,files:t})}}const tt=Object.assign(Object.assign({},Te),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),me="generic",$e="line-by-line",Xt="icon",qt="tag";class Kt{constructor(n,t={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},tt),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(`
|