@knpkv/rly 0.1.1 → 0.2.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.
Files changed (40) hide show
  1. package/README.md +37 -1
  2. package/dist/{Dialog-DwSIPb-B.js → Dialog-xSrBk0Vv.js} +21 -19
  3. package/dist/Dialog-xSrBk0Vv.js.map +1 -0
  4. package/dist/components.css +3 -2
  5. package/dist/diff/bounded/index.js +1054 -0
  6. package/dist/diff/bounded/index.js.map +1 -0
  7. package/dist/diff/index.js +1531 -1790
  8. package/dist/diff/index.js.map +1 -1
  9. package/dist/diff/workbench/index.js +5 -0
  10. package/dist/diff/workbench/index.js.map +1 -0
  11. package/dist/dts/diff/DiffCodeView.d.ts.map +1 -1
  12. package/dist/dts/diff/annotation.d.ts +13 -0
  13. package/dist/dts/diff/annotation.d.ts.map +1 -0
  14. package/dist/dts/diff/bounded/BoundedDiffCodeView.d.ts +21 -0
  15. package/dist/dts/diff/bounded/BoundedDiffCodeView.d.ts.map +1 -0
  16. package/dist/dts/diff/bounded/index.d.ts +3 -0
  17. package/dist/dts/diff/bounded/index.d.ts.map +1 -0
  18. package/dist/dts/diff/index.d.ts +2 -7
  19. package/dist/dts/diff/index.d.ts.map +1 -1
  20. package/dist/dts/diff/rendered-line.d.ts +8 -0
  21. package/dist/dts/diff/rendered-line.d.ts.map +1 -0
  22. package/dist/dts/diff/types.d.ts +22 -3
  23. package/dist/dts/diff/types.d.ts.map +1 -1
  24. package/dist/dts/diff/workbench/index.d.ts +7 -0
  25. package/dist/dts/diff/workbench/index.d.ts.map +1 -0
  26. package/dist/dts/primitives/Button.d.ts +1 -1
  27. package/dist/dts/primitives/Button.d.ts.map +1 -1
  28. package/dist/index.js +2 -2
  29. package/dist/patterns/index.js +1 -1
  30. package/dist/{patterns-DEbg7R-A.js → patterns-5N-j-AD2.js} +2 -2
  31. package/dist/patterns-5N-j-AD2.js.map +1 -0
  32. package/dist/primitives/index.js +1 -1
  33. package/dist/workbench-tHBnbqSx.js +331 -0
  34. package/dist/workbench-tHBnbqSx.js.map +1 -0
  35. package/package.json +12 -3
  36. package/registry/components.json +12 -6
  37. package/registry/schema.json +1 -1
  38. package/registry/search.json +17 -3
  39. package/dist/Dialog-DwSIPb-B.js.map +0 -1
  40. package/dist/patterns-DEbg7R-A.js.map +0 -1
@@ -0,0 +1,1054 @@
1
+ "use client";
2
+ import { Fragment as e, createElement as t, useRef as n } from "react";
3
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ (() => {
5
+ try {
6
+ return process.env.NODE_ENV === "development";
7
+ } catch {
8
+ return !1;
9
+ }
10
+ })();
11
+ var a = /(?=^diff --git)/gm, o = /^(---|\+\+\+)\s+([^\t\r\n]+)/, s = /^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/, c = /^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/, l = /^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;
12
+ Object.freeze({
13
+ fromStart: 0,
14
+ fromEnd: 0
15
+ });
16
+ //#endregion
17
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.2.12_@shikijs+themes@4.3.1_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@pierre/diffs/dist/utils/cleanLastNewline.js
18
+ function u(e) {
19
+ return e.replace(/\n$|\r\n$/, "");
20
+ }
21
+ //#endregion
22
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.2.12_@shikijs+themes@4.3.1_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@pierre/diffs/dist/utils/detachString.js
23
+ var d = new TextEncoder(), f = new TextDecoder("utf-8", { ignoreBOM: !0 }), p = /[\uD800-\uDFFF]/, m = 1024, h = new Uint8Array(m);
24
+ function g() {
25
+ h.length !== m && (h = new Uint8Array(m));
26
+ }
27
+ function _(e) {
28
+ if (e.length === 0) return e;
29
+ if (p.test(e)) return JSON.parse(JSON.stringify(e));
30
+ let t = e.length * 3;
31
+ h.length < t && (h = new Uint8Array(t));
32
+ let { written: n } = d.encodeInto(e, h);
33
+ return f.decode(h.subarray(0, n));
34
+ }
35
+ //#endregion
36
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.2.12_@shikijs+themes@4.3.1_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@pierre/diffs/dist/utils/parsePatchFiles.js
37
+ function v(e, t) {
38
+ try {
39
+ return y(e, t);
40
+ } finally {
41
+ g();
42
+ }
43
+ }
44
+ function y(e, { cacheKey: t, isGitDiff: n = a.test(e), oldFile: r, newFile: i, throwOnError: d = !1 } = {}) {
45
+ let f = 0, p = C(e, "@@ "), m, h = r == null || i == null, g = 0, v = 0;
46
+ for (let e of p) {
47
+ let a = ee(e), p = a[0];
48
+ if (p == null) {
49
+ if (d) throw Error("parsePatchContent: invalid hunk");
50
+ console.error("parsePatchContent: invalid hunk", e);
51
+ continue;
52
+ }
53
+ let y = re(p), x = 0, S = 0;
54
+ if (y == null || m == null) {
55
+ if (m != null) {
56
+ if (d) throw Error("parsePatchContent: Invalid hunk");
57
+ console.error("parsePatchContent: Invalid hunk", e);
58
+ continue;
59
+ }
60
+ m = {
61
+ name: "",
62
+ type: "change",
63
+ hunks: [],
64
+ splitLineCount: 0,
65
+ unifiedLineCount: 0,
66
+ isPartial: h,
67
+ additionLines: !h && r != null && i != null ? b(i.contents) : [],
68
+ deletionLines: !h && r != null && i != null ? b(r.contents) : [],
69
+ cacheKey: ie(t)
70
+ }, m.additionLines.length === 1 && i?.contents === "" && (m.additionLines.length = 0), m.deletionLines.length === 1 && r?.contents === "" && (m.deletionLines.length = 0);
71
+ for (let e of a) {
72
+ if (e.startsWith("diff --git")) {
73
+ let t = e.trim().match(c), n = t?.[1] ?? t?.[2], r = t?.[3] ?? t?.[4];
74
+ if (n == null || r == null) {
75
+ if (d) throw Error("parsePatchContent: invalid git diff header");
76
+ console.error("parsePatchContent: invalid git diff header", e);
77
+ continue;
78
+ }
79
+ m.name = _(r.trim()), n !== r && (m.prevName = _(n.trim()));
80
+ continue;
81
+ }
82
+ let t = e.startsWith("---") || e.startsWith("+++") ? e.match(n ? s : o) : null;
83
+ if (t != null) {
84
+ let [, e, n] = t;
85
+ if (e === "---" && n !== "/dev/null") {
86
+ let e = _(n.trim());
87
+ m.prevName = e, m.name = e;
88
+ } else e === "+++" && n !== "/dev/null" && (m.name = _(n.trim()));
89
+ } else if (n) {
90
+ if (e.startsWith("new mode ") && (m.mode = _(e.slice(8).trim())), e.startsWith("old mode ") && (m.prevMode = _(e.slice(8).trim())), e.startsWith("new file mode") && (m.type = "new", m.mode = _(e.slice(13).trim())), e.startsWith("deleted file mode") && (m.type = "deleted", m.mode = _(e.slice(17).trim())), e.startsWith("similarity index") && (e.startsWith("similarity index 100%") ? m.type = "rename-pure" : m.type = "rename-changed"), e.startsWith("index ")) {
91
+ let [, t, n, r] = e.trim().match(l) ?? [];
92
+ t != null && (m.prevObjectId = _(t)), n != null && (m.newObjectId = _(n)), r != null && (m.mode = _(r));
93
+ }
94
+ e.startsWith("rename from ") && (m.prevName = _(e.slice(12).trim())), e.startsWith("rename to ") && (m.name = _(e.slice(10).trim()));
95
+ }
96
+ }
97
+ continue;
98
+ }
99
+ let C, w;
100
+ for (; a.length > 0 && (a[a.length - 1] === "\n" || a[a.length - 1] === "\r" || a[a.length - 1] === "\r\n" || a[a.length - 1] === "");) a.pop();
101
+ let { additionStart: D, deletionStart: O } = y;
102
+ g = h ? g : O - 1, v = h ? v : D - 1;
103
+ let k = {
104
+ collapsedBefore: 0,
105
+ splitLineCount: 0,
106
+ splitLineStart: 0,
107
+ unifiedLineCount: 0,
108
+ unifiedLineStart: 0,
109
+ additionCount: y.additionCount,
110
+ additionStart: D,
111
+ additionLines: x,
112
+ deletionCount: y.deletionCount,
113
+ deletionStart: O,
114
+ deletionLines: S,
115
+ deletionLineIndex: g,
116
+ additionLineIndex: v,
117
+ hunkContent: [],
118
+ hunkContext: ie(y.hunkContext),
119
+ hunkSpecs: _(p),
120
+ noEOFCRAdditions: !1,
121
+ noEOFCRDeletions: !1
122
+ }, A = 0, j = 0;
123
+ for (let e = 1; e < a.length; e++) {
124
+ let t = a[e];
125
+ if (A >= k.additionCount && j >= k.deletionCount && !t.startsWith("\\")) {
126
+ if (d && te(t) && !ne(t)) throw Error("parsePatchContent: hunk has more lines than expected");
127
+ break;
128
+ }
129
+ let n = t[0];
130
+ if (n !== "+" && n !== "-" && n !== " " && n !== "\\") {
131
+ if (d) throw Error("parsePatchContent: invalid hunk line");
132
+ console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`), console.error("processFile: invalid rawLine:", t);
133
+ continue;
134
+ }
135
+ let r = ae(n);
136
+ if (r === "addition") {
137
+ if (d && A >= k.additionCount) throw Error("parsePatchContent: hunk has too many addition lines");
138
+ let e = T(t);
139
+ (C == null || C.type !== "change") && (C = E("change", g, v), k.hunkContent.push(C)), v++, A++, h && m.additionLines.push(e), C.additions++, x++, w = "addition";
140
+ } else if (r === "deletion") {
141
+ if (d && j >= k.deletionCount) throw Error("parsePatchContent: hunk has too many deletion lines");
142
+ let e = T(t);
143
+ (C == null || C.type !== "change") && (C = E("change", g, v), k.hunkContent.push(C)), g++, j++, h && m.deletionLines.push(e), C.deletions++, S++, w = "deletion";
144
+ } else if (r === "context") {
145
+ if (d && (j >= k.deletionCount || A >= k.additionCount)) throw Error("parsePatchContent: hunk has too many context lines");
146
+ let e = T(t);
147
+ (C == null || C.type !== "context") && (C = E("context", g, v), k.hunkContent.push(C)), v++, g++, A++, j++, h && (m.deletionLines.push(e), m.additionLines.push(e)), C.lines++, w = "context";
148
+ } else if (r === "metadata" && C != null) {
149
+ if (C.type === "context" ? (k.noEOFCRAdditions = !0, k.noEOFCRDeletions = !0) : w === "deletion" ? k.noEOFCRDeletions = !0 : w === "addition" && (k.noEOFCRAdditions = !0), h && (w === "addition" || w === "context")) {
150
+ let e = m.additionLines.length - 1;
151
+ e >= 0 && (m.additionLines[e] = u(m.additionLines[e]));
152
+ }
153
+ if (h && (w === "deletion" || w === "context")) {
154
+ let e = m.deletionLines.length - 1;
155
+ e >= 0 && (m.deletionLines[e] = u(m.deletionLines[e]));
156
+ }
157
+ }
158
+ }
159
+ if (d && (A !== k.additionCount || j !== k.deletionCount)) throw Error("parsePatchContent: hunk line count mismatch");
160
+ k.additionLines = x, k.deletionLines = S, k.collapsedBefore = Math.max(k.additionStart - 1 - f, 0), m.hunks.push(k), f = k.additionStart + k.additionCount - 1;
161
+ for (let e of k.hunkContent) e.type === "context" ? (k.splitLineCount += e.lines, k.unifiedLineCount += e.lines) : (k.splitLineCount += Math.max(e.additions, e.deletions), k.unifiedLineCount += e.deletions + e.additions);
162
+ k.splitLineStart = m.splitLineCount + k.collapsedBefore, k.unifiedLineStart = m.unifiedLineCount + k.collapsedBefore, m.splitLineCount += k.collapsedBefore + k.splitLineCount, m.unifiedLineCount += k.collapsedBefore + k.unifiedLineCount;
163
+ }
164
+ if (m != null) {
165
+ if (d && h && !n && m.hunks.length === 0) throw Error("parsePatchContent: unified file has no hunks");
166
+ if (m.hunks.length > 0 && !h && m.additionLines.length > 0 && m.deletionLines.length > 0) {
167
+ let e = m.hunks[m.hunks.length - 1], t = e.additionStart + e.additionCount - 1, n = m.additionLines.length, r = Math.max(n - t, 0);
168
+ m.splitLineCount += r, m.unifiedLineCount += r;
169
+ }
170
+ return n || (m.prevName != null && m.name !== m.prevName ? m.hunks.length > 0 ? m.type = "rename-changed" : m.type = "rename-pure" : (r == null || r.contents === "") && i != null && i.contents !== "" ? m.type = "new" : r != null && r.contents !== "" && (i == null || i.contents === "") && (m.type = "deleted")), m.type !== "rename-pure" && m.type !== "rename-changed" && (m.prevName = void 0), m;
171
+ }
172
+ }
173
+ function b(e) {
174
+ let t = ee(e);
175
+ for (let e = 0; e < t.length; e++) t[e] = _(t[e]);
176
+ return t;
177
+ }
178
+ function ee(e) {
179
+ if (e.length === 0) return [""];
180
+ let t = [], n = 0;
181
+ for (;;) {
182
+ let r = e.indexOf("\n", n);
183
+ if (r === -1) break;
184
+ t.push(e.slice(n, r + 1)), n = r + 1;
185
+ }
186
+ return n < e.length && t.push(e.slice(n)), t;
187
+ }
188
+ function te(e) {
189
+ let t = e[0];
190
+ return t === "+" || t === "-" || t === " ";
191
+ }
192
+ function ne(e) {
193
+ if (!e.startsWith("--")) return !1;
194
+ for (let t = 2; t < e.length; t++) {
195
+ let n = e[t];
196
+ if (n !== " " && n !== " " && n !== "\n" && n !== "\r") return !1;
197
+ }
198
+ return !0;
199
+ }
200
+ function re(e) {
201
+ if (!e.startsWith("@@ -")) return;
202
+ let t = 4, n = x(e, t);
203
+ if (n == null) return;
204
+ let r = n.value;
205
+ t = n.endIndex;
206
+ let i = 1;
207
+ if (e[t] === ",") {
208
+ let n = x(e, t + 1);
209
+ if (n == null) return;
210
+ i = n.value, t = n.endIndex;
211
+ }
212
+ if (e[t] !== " " || e[t + 1] !== "+") return;
213
+ t += 2;
214
+ let a = x(e, t);
215
+ if (a == null) return;
216
+ let o = a.value;
217
+ t = a.endIndex;
218
+ let s = 1;
219
+ if (e[t] === ",") {
220
+ let n = x(e, t + 1);
221
+ if (n == null) return;
222
+ s = n.value, t = n.endIndex;
223
+ }
224
+ if (e[t] !== " " || e[t + 1] !== "@" || e[t + 2] !== "@") return;
225
+ let c, l = t + 3;
226
+ return e[l] === " " && (c = S(e.slice(l + 1))), {
227
+ additionCount: s,
228
+ additionStart: o,
229
+ deletionCount: i,
230
+ deletionStart: r,
231
+ hunkContext: c
232
+ };
233
+ }
234
+ function x(e, t) {
235
+ let n = t, r = 0;
236
+ for (; n < e.length; n++) {
237
+ let t = e.charCodeAt(n) - 48;
238
+ if (t < 0 || t > 9) break;
239
+ r = r * 10 + t;
240
+ }
241
+ if (n !== t) return {
242
+ value: r,
243
+ endIndex: n
244
+ };
245
+ }
246
+ function S(e) {
247
+ return e.endsWith("\r\n") ? e.slice(0, -2) : e.endsWith("\n") ? e.slice(0, -1) : e;
248
+ }
249
+ function C(e, t) {
250
+ if (e.length === 0) return [""];
251
+ let n = `\n${t}`, r = e.startsWith(t) ? 0 : w(e, n, 0);
252
+ if (r === -1) return [e];
253
+ let i = [];
254
+ r > 0 && i.push(e.slice(0, r));
255
+ let a = r;
256
+ for (;;) {
257
+ let t = w(e, n, a + 1);
258
+ if (t === -1) break;
259
+ i.push(e.slice(a, t)), a = t;
260
+ }
261
+ return i.push(e.slice(a)), i;
262
+ }
263
+ function w(e, t, n) {
264
+ let r = e.indexOf(t, n);
265
+ return r === -1 ? -1 : r + 1;
266
+ }
267
+ function ie(e) {
268
+ return e == null ? e : _(e);
269
+ }
270
+ function ae(e) {
271
+ return e === " " ? "context" : e === "\\" ? "metadata" : e === "+" ? "addition" : "deletion";
272
+ }
273
+ function T(e) {
274
+ let t = e.slice(1);
275
+ return _(t === "" ? "\n" : t);
276
+ }
277
+ function E(e, t, n) {
278
+ return e === "change" ? {
279
+ type: "change",
280
+ additions: 0,
281
+ deletions: 0,
282
+ additionLineIndex: n,
283
+ deletionLineIndex: t
284
+ } : {
285
+ type: "context",
286
+ lines: 0,
287
+ additionLineIndex: n,
288
+ deletionLineIndex: t
289
+ };
290
+ }
291
+ //#endregion
292
+ //#region ../../node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/diff/base.js
293
+ var D = class {
294
+ diff(e, t, n = {}) {
295
+ let r;
296
+ typeof n == "function" ? (r = n, n = {}) : "callback" in n && (r = n.callback);
297
+ let i = this.castInput(e, n), a = this.castInput(t, n), o = this.removeEmpty(this.tokenize(i, n)), s = this.removeEmpty(this.tokenize(a, n));
298
+ return this.diffWithOptionsObj(o, s, n, r);
299
+ }
300
+ diffWithOptionsObj(e, t, n, r) {
301
+ let i = (e) => {
302
+ if (e = this.postProcess(e, n), r) {
303
+ setTimeout(function() {
304
+ r(e);
305
+ }, 0);
306
+ return;
307
+ } else return e;
308
+ }, a = t.length, o = e.length, s = 1, c = a + o;
309
+ n.maxEditLength != null && (c = Math.min(c, n.maxEditLength));
310
+ let l = n.timeout ?? Infinity, u = Date.now() + l, d = [{
311
+ oldPos: -1,
312
+ lastComponent: void 0
313
+ }], f = this.extractCommon(d[0], t, e, 0, n);
314
+ if (d[0].oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(d[0].lastComponent, t, e));
315
+ let p = -Infinity, m = Infinity, h = () => {
316
+ for (let r = Math.max(p, -s); r <= Math.min(m, s); r += 2) {
317
+ let s, c = d[r - 1], l = d[r + 1];
318
+ c && (d[r - 1] = void 0);
319
+ let u = !1;
320
+ if (l) {
321
+ let e = l.oldPos - r;
322
+ u = l && 0 <= e && e < a;
323
+ }
324
+ let h = c && c.oldPos + 1 < o;
325
+ if (!u && !h) {
326
+ d[r] = void 0;
327
+ continue;
328
+ }
329
+ if (s = !h || u && c.oldPos < l.oldPos ? this.addToPath(l, !0, !1, 0, n) : this.addToPath(c, !1, !0, 1, n), f = this.extractCommon(s, t, e, r, n), s.oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(s.lastComponent, t, e)) || !0;
330
+ d[r] = s, s.oldPos + 1 >= o && (m = Math.min(m, r - 1)), f + 1 >= a && (p = Math.max(p, r + 1));
331
+ }
332
+ s++;
333
+ };
334
+ if (r) (function e() {
335
+ setTimeout(function() {
336
+ if (s > c || Date.now() > u) return r(void 0);
337
+ h() || e();
338
+ }, 0);
339
+ })();
340
+ else for (; s <= c && Date.now() <= u;) {
341
+ let e = h();
342
+ if (e) return e;
343
+ }
344
+ }
345
+ addToPath(e, t, n, r, i) {
346
+ let a = e.lastComponent;
347
+ return a && !i.oneChangePerToken && a.added === t && a.removed === n ? {
348
+ oldPos: e.oldPos + r,
349
+ lastComponent: {
350
+ count: a.count + 1,
351
+ added: t,
352
+ removed: n,
353
+ previousComponent: a.previousComponent
354
+ }
355
+ } : {
356
+ oldPos: e.oldPos + r,
357
+ lastComponent: {
358
+ count: 1,
359
+ added: t,
360
+ removed: n,
361
+ previousComponent: a
362
+ }
363
+ };
364
+ }
365
+ extractCommon(e, t, n, r, i) {
366
+ let a = t.length, o = n.length, s = e.oldPos, c = s - r, l = 0;
367
+ for (; c + 1 < a && s + 1 < o && this.equals(n[s + 1], t[c + 1], i);) c++, s++, l++, i.oneChangePerToken && (e.lastComponent = {
368
+ count: 1,
369
+ previousComponent: e.lastComponent,
370
+ added: !1,
371
+ removed: !1
372
+ });
373
+ return l && !i.oneChangePerToken && (e.lastComponent = {
374
+ count: l,
375
+ previousComponent: e.lastComponent,
376
+ added: !1,
377
+ removed: !1
378
+ }), e.oldPos = s, c;
379
+ }
380
+ equals(e, t, n) {
381
+ return n.comparator ? n.comparator(e, t) : e === t || !!n.ignoreCase && e.toLowerCase() === t.toLowerCase();
382
+ }
383
+ removeEmpty(e) {
384
+ let t = [];
385
+ for (let n = 0; n < e.length; n++) e[n] && t.push(e[n]);
386
+ return t;
387
+ }
388
+ castInput(e, t) {
389
+ return e;
390
+ }
391
+ tokenize(e, t) {
392
+ return Array.from(e);
393
+ }
394
+ join(e) {
395
+ return e.join("");
396
+ }
397
+ postProcess(e, t) {
398
+ return e;
399
+ }
400
+ get useLongestToken() {
401
+ return !1;
402
+ }
403
+ buildValues(e, t, n) {
404
+ let r = [], i;
405
+ for (; e;) r.push(e), i = e.previousComponent, delete e.previousComponent, e = i;
406
+ r.reverse();
407
+ let a = r.length, o = 0, s = 0, c = 0;
408
+ for (; o < a; o++) {
409
+ let e = r[o];
410
+ if (e.removed) e.value = this.join(n.slice(c, c + e.count)), c += e.count;
411
+ else {
412
+ if (!e.added && this.useLongestToken) {
413
+ let r = t.slice(s, s + e.count);
414
+ r = r.map(function(e, t) {
415
+ let r = n[c + t];
416
+ return r.length > e.length ? r : e;
417
+ }), e.value = this.join(r);
418
+ } else e.value = this.join(t.slice(s, s + e.count));
419
+ s += e.count, e.added || (c += e.count);
420
+ }
421
+ }
422
+ return r;
423
+ }
424
+ };
425
+ new class extends D {}();
426
+ //#endregion
427
+ //#region ../../node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/util/string.js
428
+ function O(e, t) {
429
+ let n;
430
+ for (n = 0; n < e.length && n < t.length; n++) if (e[n] != t[n]) return e.slice(0, n);
431
+ return e.slice(0, n);
432
+ }
433
+ function k(e, t) {
434
+ let n;
435
+ if (!e || !t || e[e.length - 1] != t[t.length - 1]) return "";
436
+ for (n = 0; n < e.length && n < t.length; n++) if (e[e.length - (n + 1)] != t[t.length - (n + 1)]) return e.slice(-n);
437
+ return e.slice(-n);
438
+ }
439
+ function A(e, t, n) {
440
+ if (e.slice(0, t.length) != t) throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);
441
+ return n + e.slice(t.length);
442
+ }
443
+ function j(e, t, n) {
444
+ if (!t) return e + n;
445
+ if (e.slice(-t.length) != t) throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);
446
+ return e.slice(0, -t.length) + n;
447
+ }
448
+ function M(e, t) {
449
+ return A(e, t, "");
450
+ }
451
+ function N(e, t) {
452
+ return j(e, t, "");
453
+ }
454
+ function P(e, t) {
455
+ return t.slice(0, oe(e, t));
456
+ }
457
+ function oe(e, t) {
458
+ let n = 0;
459
+ e.length > t.length && (n = e.length - t.length);
460
+ let r = t.length;
461
+ e.length < t.length && (r = e.length);
462
+ let i = Array(r), a = 0;
463
+ i[0] = 0;
464
+ for (let e = 1; e < r; e++) {
465
+ for (t[e] == t[a] ? i[e] = i[a] : i[e] = a; a > 0 && t[e] != t[a];) a = i[a];
466
+ t[e] == t[a] && a++;
467
+ }
468
+ a = 0;
469
+ for (let r = n; r < e.length; r++) {
470
+ for (; a > 0 && e[r] != t[a];) a = i[a];
471
+ e[r] == t[a] && a++;
472
+ }
473
+ return a;
474
+ }
475
+ function F(e, t) {
476
+ let n = [];
477
+ for (let r of Array.from(t.segment(e))) {
478
+ let e = r.segment;
479
+ n.length && /\s/.test(n[n.length - 1]) && /\s/.test(e) ? n[n.length - 1] += e : n.push(e);
480
+ }
481
+ return n;
482
+ }
483
+ function I(e, t) {
484
+ if (t) return R(e, t)[1];
485
+ let n;
486
+ for (n = e.length - 1; n >= 0 && e[n].match(/\s/); n--);
487
+ return e.substring(n + 1);
488
+ }
489
+ function L(e, t) {
490
+ if (t) return R(e, t)[0];
491
+ let n = e.match(/^\s*/);
492
+ return n ? n[0] : "";
493
+ }
494
+ function R(e, t) {
495
+ if (!t) return [L(e), I(e)];
496
+ if (t.resolvedOptions().granularity != "word") throw Error("The segmenter passed must have a granularity of \"word\"");
497
+ let n = F(e, t), r = n[0], i = n[n.length - 1];
498
+ return [/\s/.test(r) ? r : "", /\s/.test(i) ? i : ""];
499
+ }
500
+ //#endregion
501
+ //#region ../../node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/diff/word.js
502
+ var z = "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}", se = RegExp(`[${z}]+|\\s+|[^${z}]`, "ug");
503
+ new class extends D {
504
+ equals(e, t, n) {
505
+ return n.ignoreCase && (e = e.toLowerCase(), t = t.toLowerCase()), e.trim() === t.trim();
506
+ }
507
+ tokenize(e, t = {}) {
508
+ let n;
509
+ if (t.intlSegmenter) {
510
+ let r = t.intlSegmenter;
511
+ if (r.resolvedOptions().granularity != "word") throw Error("The segmenter passed must have a granularity of \"word\"");
512
+ n = F(e, r);
513
+ } else n = e.match(se) || [];
514
+ let r = [], i = null;
515
+ return n.forEach((e) => {
516
+ /\s/.test(e) ? i == null ? r.push(e) : r.push(r.pop() + e) : i != null && /\s/.test(i) ? r[r.length - 1] == i ? r.push(r.pop() + e) : r.push(i + e) : r.push(e), i = e;
517
+ }), r;
518
+ }
519
+ join(e) {
520
+ return e.map((e, t) => t == 0 ? e : e.replace(/^\s+/, "")).join("");
521
+ }
522
+ postProcess(e, t) {
523
+ if (!e || t.oneChangePerToken) return e;
524
+ let n = null, r = null, i = null;
525
+ return e.forEach((e) => {
526
+ e.added ? r = e : e.removed ? i = e : ((r || i) && B(n, i, r, e, t.intlSegmenter), n = e, r = null, i = null);
527
+ }), (r || i) && B(n, i, r, null, t.intlSegmenter), e;
528
+ }
529
+ }();
530
+ function B(e, t, n, r, i) {
531
+ if (t && n) {
532
+ let [a, o] = R(t.value, i), [s, c] = R(n.value, i);
533
+ if (e) {
534
+ let r = O(a, s);
535
+ e.value = j(e.value, s, r), t.value = M(t.value, r), n.value = M(n.value, r);
536
+ }
537
+ if (r) {
538
+ let e = k(o, c);
539
+ r.value = A(r.value, c, e), t.value = N(t.value, e), n.value = N(n.value, e);
540
+ }
541
+ } else if (n) {
542
+ if (e) {
543
+ let e = L(n.value, i);
544
+ n.value = n.value.substring(e.length);
545
+ }
546
+ if (r) {
547
+ let e = L(r.value, i);
548
+ r.value = r.value.substring(e.length);
549
+ }
550
+ } else if (e && r) {
551
+ let n = L(r.value, i), [a, o] = R(t.value, i), s = O(n, a);
552
+ t.value = M(t.value, s);
553
+ let c = k(M(n, s), o);
554
+ t.value = N(t.value, c), r.value = A(r.value, n, c), e.value = j(e.value, n, n.slice(0, n.length - c.length));
555
+ } else if (r) {
556
+ let e = L(r.value, i), n = P(I(t.value, i), e);
557
+ t.value = N(t.value, n);
558
+ } else if (e) {
559
+ let n = P(I(e.value, i), L(t.value, i));
560
+ t.value = M(t.value, n);
561
+ }
562
+ }
563
+ new class extends D {
564
+ tokenize(e) {
565
+ let t = RegExp(`(\\r?\\n)|[${z}]+|[^\\S\\n\\r]+|[^${z}]`, "ug");
566
+ return e.match(t) || [];
567
+ }
568
+ }();
569
+ var ce = new class extends D {
570
+ constructor() {
571
+ super(...arguments), this.tokenize = H;
572
+ }
573
+ equals(e, t, n) {
574
+ return n.ignoreWhitespace ? ((!n.newlineIsToken || !e.includes("\n")) && (e = e.trim()), (!n.newlineIsToken || !t.includes("\n")) && (t = t.trim())) : n.ignoreNewlineAtEof && !n.newlineIsToken && (e.endsWith("\n") && (e = e.slice(0, -1)), t.endsWith("\n") && (t = t.slice(0, -1))), super.equals(e, t, n);
575
+ }
576
+ }();
577
+ function V(e, t, n) {
578
+ return ce.diff(e, t, n);
579
+ }
580
+ function H(e, t) {
581
+ t.stripTrailingCr && (e = e.replace(/\r\n/g, "\n"));
582
+ let n = [], r = e.split(/(\n|\r\n)/);
583
+ r[r.length - 1] || r.pop();
584
+ for (let e = 0; e < r.length; e++) {
585
+ let i = r[e];
586
+ e % 2 && !t.newlineIsToken ? n[n.length - 1] += i : n.push(i);
587
+ }
588
+ return n;
589
+ }
590
+ //#endregion
591
+ //#region ../../node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/diff/sentence.js
592
+ function le(e) {
593
+ return e == "." || e == "!" || e == "?";
594
+ }
595
+ new class extends D {
596
+ tokenize(e) {
597
+ let t = [], n = 0;
598
+ for (let r = 0; r < e.length; r++) {
599
+ if (r == e.length - 1) {
600
+ t.push(e.slice(n));
601
+ break;
602
+ }
603
+ if (le(e[r]) && e[r + 1].match(/\s/)) {
604
+ for (t.push(e.slice(n, r + 1)), r = n = r + 1; e[r + 1]?.match(/\s/);) r++;
605
+ t.push(e.slice(n, r + 1)), n = r + 1;
606
+ }
607
+ }
608
+ return t;
609
+ }
610
+ }(), new class extends D {
611
+ tokenize(e) {
612
+ return e.split(/([{}:;,]|\s+)/);
613
+ }
614
+ }(), new class extends D {
615
+ constructor() {
616
+ super(...arguments), this.tokenize = H;
617
+ }
618
+ get useLongestToken() {
619
+ return !0;
620
+ }
621
+ castInput(e, t) {
622
+ let { undefinedReplacement: n, stringifyReplacer: r = (e, t) => t === void 0 ? n : t } = t;
623
+ return typeof e == "string" ? e : JSON.stringify(U(e, null, null, r), null, " ");
624
+ }
625
+ equals(e, t, n) {
626
+ return super.equals(e.replace(/,([\r\n])/g, "$1"), t.replace(/,([\r\n])/g, "$1"), n);
627
+ }
628
+ }();
629
+ function U(e, t, n, r, i) {
630
+ t ||= [], n ||= [], r && (e = r(i === void 0 ? "" : i, e));
631
+ let a;
632
+ for (a = 0; a < t.length; a += 1) if (t[a] === e) return n[a];
633
+ let o;
634
+ if (Object.prototype.toString.call(e) === "[object Array]") {
635
+ for (t.push(e), o = Array(e.length), n.push(o), a = 0; a < e.length; a += 1) o[a] = U(e[a], t, n, r, String(a));
636
+ return t.pop(), n.pop(), o;
637
+ }
638
+ if (e && e.toJSON && (e = e.toJSON()), typeof e == "object" && e) {
639
+ t.push(e), o = {}, n.push(o);
640
+ let i = [], s;
641
+ for (s in e)
642
+ /* istanbul ignore else */
643
+ Object.prototype.hasOwnProperty.call(e, s) && i.push(s);
644
+ for (i.sort(), a = 0; a < i.length; a += 1) s = i[a], o[s] = U(e[s], t, n, r, s);
645
+ t.pop(), n.pop();
646
+ } else o = e;
647
+ return o;
648
+ }
649
+ new class extends D {
650
+ tokenize(e) {
651
+ return e.slice();
652
+ }
653
+ join(e) {
654
+ return e;
655
+ }
656
+ removeEmpty(e) {
657
+ return e;
658
+ }
659
+ }();
660
+ //#endregion
661
+ //#region ../../node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/patch/create.js
662
+ function ue(e) {
663
+ for (let t = 0; t < e.length; t++) if (e[t] < " " || e[t] > "~" || e[t] === "\"" || e[t] === "\\") return !0;
664
+ return !1;
665
+ }
666
+ function W(e) {
667
+ if (!ue(e)) return e;
668
+ let t = "\"", n = new TextEncoder().encode(e), r = 0;
669
+ for (; r < n.length;) {
670
+ let e = n[r];
671
+ e === 7 ? t += "\\a" : e === 8 ? t += "\\b" : e === 9 ? t += "\\t" : e === 10 ? t += "\\n" : e === 11 ? t += "\\v" : e === 12 ? t += "\\f" : e === 13 ? t += "\\r" : e === 34 ? t += "\\\"" : e === 92 ? t += "\\\\" : e >= 32 && e <= 126 ? t += String.fromCharCode(e) : t += "\\" + e.toString(8).padStart(3, "0"), r++;
672
+ }
673
+ return t += "\"", t;
674
+ }
675
+ var G = {
676
+ includeIndex: !0,
677
+ includeUnderline: !0,
678
+ includeFileHeaders: !0
679
+ };
680
+ function de(e, t, n, r, i, a, o) {
681
+ let s;
682
+ s = o ? typeof o == "function" ? { callback: o } : o : {}, s.context === void 0 && (s.context = 4);
683
+ let c = s.context;
684
+ if (s.newlineIsToken) throw Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
685
+ if (s.callback) {
686
+ let { callback: e } = s;
687
+ V(n, r, Object.assign(Object.assign({}, s), { callback: (t) => {
688
+ let n = l(t);
689
+ e(n);
690
+ } }));
691
+ } else return l(V(n, r, s));
692
+ function l(n) {
693
+ if (!n) return;
694
+ n.push({
695
+ value: "",
696
+ lines: []
697
+ });
698
+ function r(e) {
699
+ return e.map(function(e) {
700
+ return " " + e;
701
+ });
702
+ }
703
+ let o = [], s = 0, l = 0, u = [], d = 1, f = 1;
704
+ for (let e = 0; e < n.length; e++) {
705
+ let t = n[e], i = t.lines || pe(t.value);
706
+ if (t.lines = i, t.added || t.removed) {
707
+ if (!s) {
708
+ let t = n[e - 1];
709
+ s = d, l = f, t && (u = c > 0 ? r(t.lines.slice(-c)) : [], s -= u.length, l -= u.length);
710
+ }
711
+ for (let e of i) u.push((t.added ? "+" : "-") + e);
712
+ t.added ? f += i.length : d += i.length;
713
+ } else {
714
+ if (s) if (i.length <= c * 2 && e < n.length - 2) for (let e of r(i)) u.push(e);
715
+ else {
716
+ let e = Math.min(i.length, c);
717
+ for (let t of r(i.slice(0, e))) u.push(t);
718
+ let t = {
719
+ oldStart: s,
720
+ oldLines: d - s + e,
721
+ newStart: l,
722
+ newLines: f - l + e,
723
+ lines: u
724
+ };
725
+ o.push(t), s = 0, l = 0, u = [];
726
+ }
727
+ d += i.length, f += i.length;
728
+ }
729
+ }
730
+ for (let e of o) for (let t = 0; t < e.lines.length; t++) e.lines[t].endsWith("\n") ? e.lines[t] = e.lines[t].slice(0, -1) : (e.lines.splice(t + 1, 0, "\"), t++);
731
+ return {
732
+ oldFileName: e,
733
+ newFileName: t,
734
+ oldHeader: i,
735
+ newHeader: a,
736
+ hunks: o
737
+ };
738
+ }
739
+ }
740
+ function K(e, t) {
741
+ if (t ||= G, Array.isArray(e)) {
742
+ if (e.length > 1 && !t.includeFileHeaders && !e.every((e) => e.isGit)) throw 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?)");
743
+ return e.map((e) => K(e, t)).join("\n");
744
+ }
745
+ let n = [];
746
+ if (e.isGit) {
747
+ if (t = G, !e.oldFileName) throw Error("oldFileName must be specified for Git patches");
748
+ if (!e.newFileName) throw Error("newFileName must be specified for Git patches");
749
+ let r = e.oldFileName, i = e.newFileName;
750
+ e.isCreate && r === "/dev/null" ? r = i.replace(/^b\//, "a/") : e.isDelete && i === "/dev/null" && (i = r.replace(/^a\//, "b/")), n.push("diff --git " + W(r) + " " + W(i)), e.isDelete && n.push("deleted file mode " + (e.oldMode ?? "100644")), e.isCreate && n.push("new file mode " + (e.newMode ?? "100644")), e.oldMode && e.newMode && !e.isDelete && !e.isCreate && (n.push("old mode " + e.oldMode), n.push("new mode " + e.newMode)), e.isRename && (n.push("rename from " + W((e.oldFileName ?? "").replace(/^a\//, ""))), n.push("rename to " + W((e.newFileName ?? "").replace(/^b\//, "")))), e.isCopy && (n.push("copy from " + W((e.oldFileName ?? "").replace(/^a\//, ""))), n.push("copy to " + W((e.newFileName ?? "").replace(/^b\//, ""))));
751
+ } else t.includeIndex && e.oldFileName == e.newFileName && e.oldFileName !== void 0 && n.push("Index: " + e.oldFileName), t.includeUnderline && n.push("===================================================================");
752
+ let r = e.hunks.length > 0;
753
+ t.includeFileHeaders && e.oldFileName !== void 0 && e.newFileName !== void 0 && (!e.isGit || r) && (n.push("--- " + W(e.oldFileName) + (e.oldHeader ? " " + e.oldHeader : "")), n.push("+++ " + W(e.newFileName) + (e.newHeader ? " " + e.newHeader : "")));
754
+ for (let t = 0; t < e.hunks.length; t++) {
755
+ let r = e.hunks[t], i = r.oldLines === 0 ? r.oldStart - 1 : r.oldStart, a = r.newLines === 0 ? r.newStart - 1 : r.newStart;
756
+ n.push("@@ -" + i + "," + r.oldLines + " +" + a + "," + r.newLines + " @@");
757
+ for (let e of r.lines) n.push(e);
758
+ }
759
+ return n.join("\n") + "\n";
760
+ }
761
+ function fe(e, t, n, r, i, a, o) {
762
+ if (typeof o == "function" && (o = { callback: o }), o?.callback) {
763
+ let { callback: s } = o;
764
+ de(e, t, n, r, i, a, Object.assign(Object.assign({}, o), { callback: (e) => {
765
+ s(e ? K(e, o.headerOptions) : void 0);
766
+ } }));
767
+ } else {
768
+ let s = de(e, t, n, r, i, a, o);
769
+ return s ? K(s, o?.headerOptions) : void 0;
770
+ }
771
+ }
772
+ function pe(e) {
773
+ let t = e.endsWith("\n"), n = e.split("\n").map((e) => e + "\n");
774
+ return t ? n.pop() : n.push(n.pop().slice(0, -1)), n;
775
+ }
776
+ //#endregion
777
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.2.12_@shikijs+themes@4.3.1_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@pierre/diffs/dist/utils/parseDiffFromFile.js
778
+ function me(e, t, n, r = !1) {
779
+ let i = v(fe(e.name, t.name, e.contents, t.contents, e.header, t.header, n), {
780
+ cacheKey: (() => {
781
+ if (e.cacheKey != null && t.cacheKey != null) return `${e.cacheKey}:${t.cacheKey}`;
782
+ })(),
783
+ oldFile: e,
784
+ newFile: t,
785
+ throwOnError: r
786
+ });
787
+ if (i == null) throw Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");
788
+ return t.lang != null && (i.lang = t.lang), i;
789
+ }
790
+ //#endregion
791
+ //#region src/internal/component.ts
792
+ var q = (e, t) => {
793
+ let n = e[t];
794
+ if (n === void 0) throw Error(`Missing CSS Module class: ${t}`);
795
+ return n;
796
+ }, he = (e, t) => {
797
+ let n = e.shadowRoot;
798
+ if (n === null) return null;
799
+ let r = t.side === "additions" ? "data-additions" : "data-deletions", i = t.side === "additions" ? "change-addition" : "change-deletion", a = t.side === "additions" ? "data-line" : "data-alt-line";
800
+ return n.querySelector(`[${r}] [data-line="${t.lineNumber}"]`) ?? n.querySelector(`[data-line="${t.lineNumber}"][data-line-type="${i}"]`) ?? n.querySelector(`[${a}="${t.lineNumber}"][data-line-type="context"]`) ?? n.querySelector(`[${a}="${t.lineNumber}"][data-line-type="context-expanded"]`) ?? n.querySelector(`[${r}] [data-alt-line="${t.lineNumber}"]`) ?? n.querySelector(`[${r}][data-line="${t.lineNumber}"]`) ?? n.querySelector(`[${r}][data-alt-line="${t.lineNumber}"]`);
801
+ }, ge = (e, t) => {
802
+ let n = e.closest("diffs-container");
803
+ return n === null ? null : he(n, t);
804
+ }, _e = (e, t) => {
805
+ let n = ge(e, t);
806
+ n !== null && (n.tabIndex = -1, n.focus({ preventScroll: !0 }));
807
+ }, J = ({ annotation: e, className: r, returnFocus: i }) => {
808
+ let a = n(null), o = () => {
809
+ if (i !== void 0) {
810
+ i();
811
+ return;
812
+ }
813
+ a.current !== null && _e(a.current, e.location);
814
+ };
815
+ return t("div", {
816
+ ref: a,
817
+ "aria-label": e.accessibilityLabel,
818
+ className: r,
819
+ "data-rly-diff-annotation": e.id,
820
+ "data-rly-diff-annotation-item": e.location.itemId,
821
+ "data-rly-diff-annotation-line": e.location.lineNumber,
822
+ "data-rly-diff-annotation-side": e.location.side,
823
+ onKeyDown: (e) => {
824
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), o());
825
+ },
826
+ role: "group",
827
+ tabIndex: 0
828
+ }, e.render({
829
+ annotationId: e.id,
830
+ location: e.location,
831
+ returnFocus: o
832
+ }));
833
+ }, ve = (e) => {
834
+ let t = /* @__PURE__ */ new Set();
835
+ for (let n of e) {
836
+ if (n.id.trim().length === 0 || n.accessibilityLabel.trim().length === 0) throw Error("Diff annotation id and accessibility label must not be blank");
837
+ if (n.location.itemId.trim().length === 0) throw Error(`Diff annotation ${n.id} location item id must not be blank`);
838
+ if (!Number.isInteger(n.location.lineNumber) || n.location.lineNumber < 1) throw Error(`Diff annotation ${n.id} line number must be a positive integer`);
839
+ if (t.has(n.id)) throw Error(`Diff annotation id ${n.id} must be unique`);
840
+ t.add(n.id);
841
+ }
842
+ }, Y = {
843
+ root: "rly_BoundedDiffCodeView-module__root",
844
+ file: "rly_BoundedDiffCodeView-module__file",
845
+ noChanges: "rly_BoundedDiffCodeView-module__noChanges",
846
+ fileName: "rly_BoundedDiffCodeView-module__fileName",
847
+ scroller: "rly_BoundedDiffCodeView-module__scroller",
848
+ table: "rly_BoundedDiffCodeView-module__table",
849
+ hunk: "rly_BoundedDiffCodeView-module__hunk",
850
+ lineNumber: "rly_BoundedDiffCodeView-module__lineNumber",
851
+ marker: "rly_BoundedDiffCodeView-module__marker",
852
+ code: "rly_BoundedDiffCodeView-module__code",
853
+ wrappedCode: "rly_BoundedDiffCodeView-module__wrappedCode",
854
+ deletion: "rly_BoundedDiffCodeView-module__deletion",
855
+ change: "rly_BoundedDiffCodeView-module__change",
856
+ deletionCode: "rly_BoundedDiffCodeView-module__deletionCode",
857
+ addition: "rly_BoundedDiffCodeView-module__addition",
858
+ additionCode: "rly_BoundedDiffCodeView-module__additionCode",
859
+ context: "rly_BoundedDiffCodeView-module__context",
860
+ annotationRow: "rly_BoundedDiffCodeView-module__annotationRow",
861
+ annotationCell: "rly_BoundedDiffCodeView-module__annotationCell",
862
+ annotation: "rly_BoundedDiffCodeView-module__annotation"
863
+ }, ye = (e, t) => ({
864
+ lineNumber: e,
865
+ side: t
866
+ }), X = (e, t) => e[t]?.replace(/\r?\n$/, "") ?? "", be = (e) => e.hunkSpecs?.trim() ?? `@@ -${e.deletionStart},${e.deletionCount} +${e.additionStart},${e.additionCount} @@`, xe = (e) => {
867
+ if (e.before.contents !== e.after.contents) return me({
868
+ ...e.before.cacheKey === void 0 ? {} : { cacheKey: e.before.cacheKey },
869
+ contents: e.before.contents,
870
+ name: e.before.name
871
+ }, {
872
+ ...e.after.cacheKey === void 0 ? {} : { cacheKey: e.after.cacheKey },
873
+ contents: e.after.contents,
874
+ name: e.after.name
875
+ }, void 0, !0);
876
+ }, Se = (e, t) => Array.from({ length: t.lines }, (n, r) => ({
877
+ addition: {
878
+ content: X(e.additionLines, t.additionLineIndex + r),
879
+ number: t.additionLineIndex + r + 1
880
+ },
881
+ deletion: {
882
+ content: X(e.deletionLines, t.deletionLineIndex + r),
883
+ number: t.deletionLineIndex + r + 1
884
+ },
885
+ kind: "context"
886
+ })), Ce = (e, t) => Array.from({ length: Math.max(t.deletions, t.additions) }, (n, r) => ({
887
+ ...r < t.additions ? { addition: {
888
+ content: X(e.additionLines, t.additionLineIndex + r),
889
+ number: t.additionLineIndex + r + 1
890
+ } } : {},
891
+ ...r < t.deletions ? { deletion: {
892
+ content: X(e.deletionLines, t.deletionLineIndex + r),
893
+ number: t.deletionLineIndex + r + 1
894
+ } } : {},
895
+ kind: "change"
896
+ })), we = (e) => e.hunks.flatMap((t) => [{
897
+ kind: "hunk",
898
+ label: be(t)
899
+ }, ...t.hunkContent.flatMap((t) => t.type === "context" ? Se(e, t) : Ce(e, t))]), Te = (e) => e.hunks.flatMap((t) => [{
900
+ kind: "hunk",
901
+ label: be(t)
902
+ }, ...t.hunkContent.flatMap((t) => t.type === "context" ? Array.from({ length: t.lines }, (n, r) => ({
903
+ additionNumber: t.additionLineIndex + r + 1,
904
+ content: X(e.additionLines, t.additionLineIndex + r),
905
+ deletionNumber: t.deletionLineIndex + r + 1,
906
+ kind: "context"
907
+ })) : [...Array.from({ length: t.deletions }, (n, r) => ({
908
+ content: X(e.deletionLines, t.deletionLineIndex + r),
909
+ deletionNumber: t.deletionLineIndex + r + 1,
910
+ kind: "deletion"
911
+ })), ...Array.from({ length: t.additions }, (n, r) => ({
912
+ additionNumber: t.additionLineIndex + r + 1,
913
+ content: X(e.additionLines, t.additionLineIndex + r),
914
+ kind: "addition"
915
+ }))])]), Z = (e, t, n, i, a, o) => /* @__PURE__ */ r("code", {
916
+ className: a ? Y.wrappedCode : Y.code,
917
+ "data-rly-diff-item": t,
918
+ ...o === void 0 ? {} : {
919
+ "data-rly-diff-line-alternate": o.lineNumber,
920
+ "data-rly-diff-line-side-alternate": o.side
921
+ },
922
+ "data-rly-diff-line": n,
923
+ "data-rly-diff-line-side": i,
924
+ tabIndex: -1,
925
+ children: e.length === 0 ? " " : e
926
+ }), Q = (e, t, n, r) => {
927
+ let i = `[data-rly-diff-item="${CSS.escape(t)}"]`;
928
+ (e?.querySelector(`${i}[data-rly-diff-line="${n}"][data-rly-diff-line-side="${r}"]`) ?? e?.querySelector(`${i}[data-rly-diff-line-alternate="${n}"][data-rly-diff-line-side-alternate="${r}"]`))?.focus({ preventScroll: !0 });
929
+ }, $ = (e, t, n, r) => n === void 0 ? [] : e.filter((e) => e.location.itemId === t && e.location.lineNumber === n && e.location.side === r), Ee = (e, t, n, a) => [...$(e, t, n.deletion?.number, "deletions").map((e) => /* @__PURE__ */ i("tr", {
930
+ className: Y.annotationRow,
931
+ children: [/* @__PURE__ */ r("td", {
932
+ className: Y.annotationCell,
933
+ colSpan: 2,
934
+ children: /* @__PURE__ */ r(J, {
935
+ annotation: e,
936
+ className: q(Y, "annotation"),
937
+ returnFocus: () => Q(a(), t, e.location.lineNumber, e.location.side)
938
+ })
939
+ }), /* @__PURE__ */ r("td", { colSpan: 2 })]
940
+ }, e.id)), ...$(e, t, n.addition?.number, "additions").map((e) => /* @__PURE__ */ i("tr", {
941
+ className: Y.annotationRow,
942
+ children: [/* @__PURE__ */ r("td", { colSpan: 2 }), /* @__PURE__ */ r("td", {
943
+ className: Y.annotationCell,
944
+ colSpan: 2,
945
+ children: /* @__PURE__ */ r(J, {
946
+ annotation: e,
947
+ className: q(Y, "annotation"),
948
+ returnFocus: () => Q(a(), t, e.location.lineNumber, e.location.side)
949
+ })
950
+ })]
951
+ }, e.id))], De = (t, n, a, o, s) => /* @__PURE__ */ r("table", {
952
+ "aria-label": `Changes in ${t.name}`,
953
+ className: Y.table,
954
+ children: /* @__PURE__ */ r("tbody", { children: we(t).map((t, c) => t.kind === "hunk" ? /* @__PURE__ */ r("tr", {
955
+ className: Y.hunk,
956
+ children: /* @__PURE__ */ r("td", {
957
+ colSpan: 4,
958
+ children: t.label
959
+ })
960
+ }, `${c}:${t.label}`) : /* @__PURE__ */ i(e, { children: [/* @__PURE__ */ i("tr", {
961
+ className: Y[t.kind],
962
+ children: [
963
+ /* @__PURE__ */ r("td", {
964
+ className: Y.lineNumber,
965
+ children: t.deletion?.number
966
+ }),
967
+ /* @__PURE__ */ r("td", {
968
+ className: Y.deletionCode,
969
+ children: t.deletion === void 0 ? null : Z(t.deletion.content, n, t.deletion.number, "deletions", s)
970
+ }),
971
+ /* @__PURE__ */ r("td", {
972
+ className: Y.lineNumber,
973
+ children: t.addition?.number
974
+ }),
975
+ /* @__PURE__ */ r("td", {
976
+ className: Y.additionCode,
977
+ children: t.addition === void 0 ? null : Z(t.addition.content, n, t.addition.number, "additions", s)
978
+ })
979
+ ]
980
+ }), Ee(a, n, t, o)] }, `${c}:${t.deletion?.number ?? ""}:${t.addition?.number ?? ""}`)) })
981
+ }), Oe = (e, t, n, i) => [...n.deletionNumber === void 0 ? [] : [ye(n.deletionNumber, "deletions")], ...n.additionNumber === void 0 ? [] : [ye(n.additionNumber, "additions")]].flatMap(({ lineNumber: n, side: a }) => $(e, t, n, a).map((e) => /* @__PURE__ */ r("tr", {
982
+ className: Y.annotationRow,
983
+ children: /* @__PURE__ */ r("td", {
984
+ className: Y.annotationCell,
985
+ colSpan: 4,
986
+ children: /* @__PURE__ */ r(J, {
987
+ annotation: e,
988
+ className: q(Y, "annotation"),
989
+ returnFocus: () => Q(i(), t, n, a)
990
+ })
991
+ })
992
+ }, e.id))), ke = (t, n, a, o, s) => /* @__PURE__ */ r("table", {
993
+ "aria-label": `Changes in ${t.name}`,
994
+ className: Y.table,
995
+ children: /* @__PURE__ */ r("tbody", { children: Te(t).map((t, c) => t.kind === "hunk" ? /* @__PURE__ */ r("tr", {
996
+ className: Y.hunk,
997
+ children: /* @__PURE__ */ r("td", {
998
+ colSpan: 4,
999
+ children: t.label
1000
+ })
1001
+ }, `${c}:${t.label}`) : /* @__PURE__ */ i(e, { children: [/* @__PURE__ */ i("tr", {
1002
+ className: Y[t.kind],
1003
+ children: [
1004
+ /* @__PURE__ */ r("td", {
1005
+ className: Y.lineNumber,
1006
+ children: t.deletionNumber
1007
+ }),
1008
+ /* @__PURE__ */ r("td", {
1009
+ className: Y.lineNumber,
1010
+ children: t.additionNumber
1011
+ }),
1012
+ /* @__PURE__ */ r("td", {
1013
+ className: Y.marker,
1014
+ children: t.kind === "addition" ? "+" : t.kind === "deletion" ? "−" : " "
1015
+ }),
1016
+ /* @__PURE__ */ r("td", { children: Z(t.content, n, t.kind === "deletion" ? t.deletionNumber ?? 0 : t.additionNumber ?? 0, t.kind === "deletion" ? "deletions" : "additions", s, t.kind === "context" && t.deletionNumber !== void 0 ? {
1017
+ lineNumber: t.deletionNumber,
1018
+ side: "deletions"
1019
+ } : void 0) })
1020
+ ]
1021
+ }), Oe(a, n, t, o)] }, `${c}:${t.deletionNumber ?? ""}:${t.additionNumber ?? ""}`)) })
1022
+ }), Ae = ({ annotations: e = [], className: t, empty: a = "No renderable source changes.", initialItems: o, mode: s = "split", wrap: c = !1 }) => {
1023
+ ve(e);
1024
+ let l = n(null);
1025
+ return o.length === 0 ? /* @__PURE__ */ r("p", {
1026
+ className: t,
1027
+ children: a
1028
+ }) : /* @__PURE__ */ r("div", {
1029
+ ref: l,
1030
+ className: t === void 0 ? q(Y, "root") : `${q(Y, "root")} ${t}`,
1031
+ "data-rly-diff-code-view": "",
1032
+ "data-rly-diff-mode": s,
1033
+ children: o.map((t) => {
1034
+ let n = xe(t);
1035
+ return n === void 0 ? /* @__PURE__ */ r("p", {
1036
+ className: Y.noChanges,
1037
+ children: "No textual changes in this file."
1038
+ }, t.id) : /* @__PURE__ */ i("section", {
1039
+ className: Y.file,
1040
+ children: [o.length > 1 ? /* @__PURE__ */ r("h3", {
1041
+ className: Y.fileName,
1042
+ children: n.name
1043
+ }) : null, /* @__PURE__ */ r("div", {
1044
+ className: Y.scroller,
1045
+ children: s === "split" ? De(n, t.id, e, () => l.current, c) : ke(n, t.id, e, () => l.current, c)
1046
+ })]
1047
+ }, t.id);
1048
+ })
1049
+ });
1050
+ };
1051
+ //#endregion
1052
+ export { Ae as BoundedDiffCodeView };
1053
+
1054
+ //# sourceMappingURL=index.js.map