@compn3rd/pi-web-code-review 0.1.2 → 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.
- package/CHANGELOG.md +24 -0
- package/README.md +21 -10
- package/dist/browser/index.js +762 -612
- package/docs/compatibility.md +29 -45
- package/docs/composer-design.md +5 -5
- package/docs/development.md +14 -3
- package/docs/screenshots/0.2.0/focus-desktop.png +0 -0
- package/docs/screenshots/0.2.0/focus-light.png +0 -0
- package/docs/screenshots/0.2.0/focus-phone.png +0 -0
- package/docs/screenshots/0.2.0/phone-compare.png +0 -0
- package/docs/screenshots/0.2.0/phone-editor.png +0 -0
- package/docs/screenshots/0.2.0/phone-files.png +0 -0
- package/docs/screenshots/0.2.0/phone-notes.png +0 -0
- package/docs/screenshots/0.2.0/phone-settings.png +0 -0
- package/docs/screenshots/0.2.0/workbench-desktop.png +0 -0
- package/docs/screenshots/0.2.0/workbench-light.png +0 -0
- package/docs/screenshots/0.2.0/workbench-phone.png +0 -0
- package/docs/usage.md +14 -4
- package/package.json +7 -5
package/dist/browser/index.js
CHANGED
|
@@ -1,35 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// src/browser/styling.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return typeof e == "object" && !!e && "registerRoot" in e && typeof e.registerRoot == "function" && "createController" in e && typeof e.createController == "function" && "subscribe" in e && typeof e.subscribe == "function";
|
|
4
|
+
}
|
|
5
|
+
var t = {
|
|
6
|
+
pluginId: "pi-web",
|
|
7
|
+
id: "stylesheet-integration",
|
|
8
|
+
version: 1,
|
|
9
|
+
parse(t) {
|
|
10
|
+
if (!e(t)) throw Error("Code Review requires stylesheet-integration v1");
|
|
11
|
+
return t;
|
|
12
|
+
}
|
|
13
|
+
}, n = globalThis, r = n.ShadowRoot && (n.ShadyCSS === void 0 || n.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, i = Symbol(), a = /* @__PURE__ */ new WeakMap(), o = class {
|
|
14
|
+
constructor(e, t, n) {
|
|
15
|
+
if (this._$cssResult$ = !0, n !== i) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
5
16
|
this.cssText = e, this.t = t;
|
|
6
17
|
}
|
|
7
18
|
get styleSheet() {
|
|
8
|
-
let e = this.o,
|
|
9
|
-
if (
|
|
10
|
-
let
|
|
11
|
-
|
|
19
|
+
let e = this.o, t = this.t;
|
|
20
|
+
if (r && e === void 0) {
|
|
21
|
+
let n = t !== void 0 && t.length === 1;
|
|
22
|
+
n && (e = a.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), n && a.set(t, e));
|
|
12
23
|
}
|
|
13
24
|
return e;
|
|
14
25
|
}
|
|
15
26
|
toString() {
|
|
16
27
|
return this.cssText;
|
|
17
28
|
}
|
|
18
|
-
},
|
|
29
|
+
}, s = (e) => new o(typeof e == "string" ? e : e + "", void 0, i), c = (e, ...t) => new o(e.length === 1 ? e[0] : t.reduce((t, n, r) => t + ((e) => {
|
|
19
30
|
if (!0 === e._$cssResult$) return e.cssText;
|
|
20
31
|
if (typeof e == "number") return e;
|
|
21
32
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + e + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
22
|
-
})(n) + e[r + 1], e[0]), e,
|
|
23
|
-
if (
|
|
24
|
-
else for (let
|
|
25
|
-
let
|
|
26
|
-
i !== void 0 &&
|
|
33
|
+
})(n) + e[r + 1], e[0]), e, i), l = (e, t) => {
|
|
34
|
+
if (r) e.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
35
|
+
else for (let r of t) {
|
|
36
|
+
let t = document.createElement("style"), i = n.litNonce;
|
|
37
|
+
i !== void 0 && t.setAttribute("nonce", i), t.textContent = r.cssText, e.appendChild(t);
|
|
27
38
|
}
|
|
28
|
-
},
|
|
39
|
+
}, u = r ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => {
|
|
29
40
|
let t = "";
|
|
30
41
|
for (let n of e.cssRules) t += n.cssText;
|
|
31
|
-
return
|
|
32
|
-
})(e) : e, { is:
|
|
42
|
+
return s(t);
|
|
43
|
+
})(e) : e, { is: d, defineProperty: f, getOwnPropertyDescriptor: p, getOwnPropertyNames: m, getOwnPropertySymbols: h, getPrototypeOf: g } = Object, _ = globalThis, v = _.trustedTypes, ee = v ? v.emptyScript : "", te = _.reactiveElementPolyfillSupport, y = (e, t) => e, ne = {
|
|
33
44
|
toAttribute(e, t) {
|
|
34
45
|
switch (t) {
|
|
35
46
|
case Boolean:
|
|
@@ -58,7 +69,7 @@ var e = globalThis, t = e.ShadowRoot && (e.ShadyCSS === void 0 || e.ShadyCSS.nat
|
|
|
58
69
|
}
|
|
59
70
|
return n;
|
|
60
71
|
}
|
|
61
|
-
}, re = (e, t) => !
|
|
72
|
+
}, re = (e, t) => !d(e, t), ie = {
|
|
62
73
|
attribute: !0,
|
|
63
74
|
type: String,
|
|
64
75
|
converter: ne,
|
|
@@ -66,8 +77,8 @@ var e = globalThis, t = e.ShadowRoot && (e.ShadyCSS === void 0 || e.ShadyCSS.nat
|
|
|
66
77
|
useDefault: !1,
|
|
67
78
|
hasChanged: re
|
|
68
79
|
};
|
|
69
|
-
Symbol.metadata ??= Symbol("metadata"),
|
|
70
|
-
var
|
|
80
|
+
Symbol.metadata ??= Symbol("metadata"), _.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
81
|
+
var b = class extends HTMLElement {
|
|
71
82
|
static addInitializer(e) {
|
|
72
83
|
this._$Ei(), (this.l ??= []).push(e);
|
|
73
84
|
}
|
|
@@ -77,11 +88,11 @@ var v = class extends HTMLElement {
|
|
|
77
88
|
static createProperty(e, t = ie) {
|
|
78
89
|
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
79
90
|
let n = Symbol(), r = this.getPropertyDescriptor(e, n, t);
|
|
80
|
-
r !== void 0 &&
|
|
91
|
+
r !== void 0 && f(this.prototype, e, r);
|
|
81
92
|
}
|
|
82
93
|
}
|
|
83
94
|
static getPropertyDescriptor(e, t, n) {
|
|
84
|
-
let { get: r, set: i } =
|
|
95
|
+
let { get: r, set: i } = p(this.prototype, e) ?? {
|
|
85
96
|
get() {
|
|
86
97
|
return this[t];
|
|
87
98
|
},
|
|
@@ -103,14 +114,14 @@ var v = class extends HTMLElement {
|
|
|
103
114
|
return this.elementProperties.get(e) ?? ie;
|
|
104
115
|
}
|
|
105
116
|
static _$Ei() {
|
|
106
|
-
if (this.hasOwnProperty(
|
|
107
|
-
let e =
|
|
117
|
+
if (this.hasOwnProperty(y("elementProperties"))) return;
|
|
118
|
+
let e = g(this);
|
|
108
119
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
109
120
|
}
|
|
110
121
|
static finalize() {
|
|
111
|
-
if (this.hasOwnProperty(
|
|
112
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
113
|
-
let e = this.properties, t = [...
|
|
122
|
+
if (this.hasOwnProperty(y("finalized"))) return;
|
|
123
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(y("properties"))) {
|
|
124
|
+
let e = this.properties, t = [...m(e), ...h(e)];
|
|
114
125
|
for (let n of t) this.createProperty(n, e[n]);
|
|
115
126
|
}
|
|
116
127
|
let e = this[Symbol.metadata];
|
|
@@ -129,8 +140,8 @@ var v = class extends HTMLElement {
|
|
|
129
140
|
let t = [];
|
|
130
141
|
if (Array.isArray(e)) {
|
|
131
142
|
let n = new Set(e.flat(1 / 0).reverse());
|
|
132
|
-
for (let e of n) t.unshift(
|
|
133
|
-
} else e !== void 0 && t.push(
|
|
143
|
+
for (let e of n) t.unshift(u(e));
|
|
144
|
+
} else e !== void 0 && t.push(u(e));
|
|
134
145
|
return t;
|
|
135
146
|
}
|
|
136
147
|
static _$Eu(e, t) {
|
|
@@ -156,7 +167,7 @@ var v = class extends HTMLElement {
|
|
|
156
167
|
}
|
|
157
168
|
createRenderRoot() {
|
|
158
169
|
let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
159
|
-
return
|
|
170
|
+
return l(e, this.constructor.elementStyles), e;
|
|
160
171
|
}
|
|
161
172
|
connectedCallback() {
|
|
162
173
|
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
|
|
@@ -251,60 +262,59 @@ var v = class extends HTMLElement {
|
|
|
251
262
|
updated(e) {}
|
|
252
263
|
firstUpdated(e) {}
|
|
253
264
|
};
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
var ae = globalThis, oe = (e) => e, se = ae.trustedTypes, ce = se ? se.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, le = "$lit$", y = `lit$${Math.random().toFixed(9).slice(2)}$`, ue = "?" + y, de = `<${ue}>`, b = document, x = () => b.createComment(""), S = (e) => e === null || typeof e != "object" && typeof e != "function", fe = Array.isArray, pe = (e) => fe(e) || typeof e?.[Symbol.iterator] == "function", me = "[ \n\f\r]", C = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, he = /-->/g, ge = />/g, w = RegExp(`>|${me}(?:([^\\s"'>=/]+)(${me}*=${me}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), _e = /'/g, ve = /"/g, ye = /^(?:script|style|textarea|title)$/i, T = ((e) => (t, ...n) => ({
|
|
265
|
+
b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[y("elementProperties")] = /* @__PURE__ */ new Map(), b[y("finalized")] = /* @__PURE__ */ new Map(), te?.({ ReactiveElement: b }), (_.reactiveElementVersions ??= []).push("2.1.2");
|
|
266
|
+
// node_modules/lit-html/lit-html.js
|
|
267
|
+
var ae = globalThis, oe = (e) => e, se = ae.trustedTypes, ce = se ? se.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, le = "$lit$", x = `lit$${Math.random().toFixed(9).slice(2)}$`, ue = "?" + x, de = `<${ue}>`, S = document, C = () => S.createComment(""), fe = (e) => e === null || typeof e != "object" && typeof e != "function", pe = Array.isArray, me = (e) => pe(e) || typeof e?.[Symbol.iterator] == "function", he = "[ \n\f\r]", w = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ge = /-->/g, _e = />/g, T = RegExp(`>|${he}(?:([^\\s"'>=/]+)(${he}*=${he}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), ve = /'/g, ye = /"/g, be = /^(?:script|style|textarea|title)$/i, E = ((e) => (t, ...n) => ({
|
|
258
268
|
_$litType$: e,
|
|
259
269
|
strings: t,
|
|
260
270
|
values: n
|
|
261
|
-
}))(1),
|
|
262
|
-
function
|
|
263
|
-
if (!
|
|
271
|
+
}))(1), D = Symbol.for("lit-noChange"), O = Symbol.for("lit-nothing"), xe = /* @__PURE__ */ new WeakMap(), k = S.createTreeWalker(S, 129);
|
|
272
|
+
function Se(e, t) {
|
|
273
|
+
if (!pe(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
264
274
|
return ce === void 0 ? t : ce.createHTML(t);
|
|
265
275
|
}
|
|
266
|
-
var
|
|
267
|
-
let n = e.length - 1, r = [], i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o =
|
|
276
|
+
var Ce = (e, t) => {
|
|
277
|
+
let n = e.length - 1, r = [], i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = w;
|
|
268
278
|
for (let t = 0; t < n; t++) {
|
|
269
279
|
let n = e[t], s, c, l = -1, u = 0;
|
|
270
|
-
for (; u < n.length && (o.lastIndex = u, c = o.exec(n), c !== null);) u = o.lastIndex, o ===
|
|
271
|
-
let d = o ===
|
|
272
|
-
a += o ===
|
|
280
|
+
for (; u < n.length && (o.lastIndex = u, c = o.exec(n), c !== null);) u = o.lastIndex, o === w ? c[1] === "!--" ? o = ge : c[1] === void 0 ? c[2] === void 0 ? c[3] !== void 0 && (o = T) : (be.test(c[2]) && (i = RegExp("</" + c[2], "g")), o = T) : o = _e : o === T ? c[0] === ">" ? (o = i ?? w, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, s = c[1], o = c[3] === void 0 ? T : c[3] === "\"" ? ye : ve) : o === ye || o === ve ? o = T : o === ge || o === _e ? o = w : (o = T, i = void 0);
|
|
281
|
+
let d = o === T && e[t + 1].startsWith("/>") ? " " : "";
|
|
282
|
+
a += o === w ? n + de : l >= 0 ? (r.push(s), n.slice(0, l) + le + n.slice(l) + x + d) : n + x + (l === -2 ? t : d);
|
|
273
283
|
}
|
|
274
|
-
return [
|
|
275
|
-
},
|
|
284
|
+
return [Se(e, a + (e[n] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
285
|
+
}, we = class e {
|
|
276
286
|
constructor({ strings: t, _$litType$: n }, r) {
|
|
277
287
|
let i;
|
|
278
288
|
this.parts = [];
|
|
279
|
-
let a = 0, o = 0, s = t.length - 1, c = this.parts, [l, u] =
|
|
280
|
-
if (this.el = e.createElement(l, r),
|
|
289
|
+
let a = 0, o = 0, s = t.length - 1, c = this.parts, [l, u] = Ce(t, n);
|
|
290
|
+
if (this.el = e.createElement(l, r), k.currentNode = this.el.content, n === 2 || n === 3) {
|
|
281
291
|
let e = this.el.content.firstChild;
|
|
282
292
|
e.replaceWith(...e.childNodes);
|
|
283
293
|
}
|
|
284
|
-
for (; (i =
|
|
294
|
+
for (; (i = k.nextNode()) !== null && c.length < s;) {
|
|
285
295
|
if (i.nodeType === 1) {
|
|
286
296
|
if (i.hasAttributes()) for (let e of i.getAttributeNames()) if (e.endsWith(le)) {
|
|
287
|
-
let t = u[o++], n = i.getAttribute(e).split(
|
|
297
|
+
let t = u[o++], n = i.getAttribute(e).split(x), r = /([.?@])?(.*)/.exec(t);
|
|
288
298
|
c.push({
|
|
289
299
|
type: 1,
|
|
290
300
|
index: a,
|
|
291
301
|
name: r[2],
|
|
292
302
|
strings: n,
|
|
293
|
-
ctor: r[1] === "." ?
|
|
303
|
+
ctor: r[1] === "." ? Oe : r[1] === "?" ? ke : r[1] === "@" ? Ae : De
|
|
294
304
|
}), i.removeAttribute(e);
|
|
295
|
-
} else e.startsWith(
|
|
305
|
+
} else e.startsWith(x) && (c.push({
|
|
296
306
|
type: 6,
|
|
297
307
|
index: a
|
|
298
308
|
}), i.removeAttribute(e));
|
|
299
|
-
if (
|
|
300
|
-
let e = i.textContent.split(
|
|
309
|
+
if (be.test(i.tagName)) {
|
|
310
|
+
let e = i.textContent.split(x), t = e.length - 1;
|
|
301
311
|
if (t > 0) {
|
|
302
312
|
i.textContent = se ? se.emptyScript : "";
|
|
303
|
-
for (let n = 0; n < t; n++) i.append(e[n],
|
|
313
|
+
for (let n = 0; n < t; n++) i.append(e[n], C()), k.nextNode(), c.push({
|
|
304
314
|
type: 2,
|
|
305
315
|
index: ++a
|
|
306
316
|
});
|
|
307
|
-
i.append(e[t],
|
|
317
|
+
i.append(e[t], C());
|
|
308
318
|
}
|
|
309
319
|
}
|
|
310
320
|
} else if (i.nodeType === 8) {
|
|
@@ -314,26 +324,26 @@ var Se = (e, t) => {
|
|
|
314
324
|
});
|
|
315
325
|
else {
|
|
316
326
|
let e = -1;
|
|
317
|
-
for (; (e = i.data.indexOf(
|
|
327
|
+
for (; (e = i.data.indexOf(x, e + 1)) !== -1;) c.push({
|
|
318
328
|
type: 7,
|
|
319
329
|
index: a
|
|
320
|
-
}), e +=
|
|
330
|
+
}), e += x.length - 1;
|
|
321
331
|
}
|
|
322
332
|
}
|
|
323
333
|
a++;
|
|
324
334
|
}
|
|
325
335
|
}
|
|
326
336
|
static createElement(e, t) {
|
|
327
|
-
let n =
|
|
337
|
+
let n = S.createElement("template");
|
|
328
338
|
return n.innerHTML = e, n;
|
|
329
339
|
}
|
|
330
340
|
};
|
|
331
|
-
function
|
|
332
|
-
if (t ===
|
|
333
|
-
let i = r === void 0 ? n._$Cl : n._$Co?.[r], a =
|
|
334
|
-
return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(e), i._$AT(e, n, r)), r === void 0 ? n._$Cl = i : (n._$Co ??= [])[r] = i), i !== void 0 && (t =
|
|
341
|
+
function A(e, t, n = e, r) {
|
|
342
|
+
if (t === D) return t;
|
|
343
|
+
let i = r === void 0 ? n._$Cl : n._$Co?.[r], a = fe(t) ? void 0 : t._$litDirective$;
|
|
344
|
+
return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(e), i._$AT(e, n, r)), r === void 0 ? n._$Cl = i : (n._$Co ??= [])[r] = i), i !== void 0 && (t = A(e, i._$AS(e, t.values), i, r)), t;
|
|
335
345
|
}
|
|
336
|
-
var
|
|
346
|
+
var Te = class {
|
|
337
347
|
constructor(e, t) {
|
|
338
348
|
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
339
349
|
}
|
|
@@ -344,28 +354,28 @@ var we = class {
|
|
|
344
354
|
return this._$AM._$AU;
|
|
345
355
|
}
|
|
346
356
|
u(e) {
|
|
347
|
-
let { el: { content: t }, parts: n } = this._$AD, r = (e?.creationScope ??
|
|
348
|
-
|
|
349
|
-
let i =
|
|
357
|
+
let { el: { content: t }, parts: n } = this._$AD, r = (e?.creationScope ?? S).importNode(t, !0);
|
|
358
|
+
k.currentNode = r;
|
|
359
|
+
let i = k.nextNode(), a = 0, o = 0, s = n[0];
|
|
350
360
|
for (; s !== void 0;) {
|
|
351
361
|
if (a === s.index) {
|
|
352
362
|
let t;
|
|
353
|
-
s.type === 2 ? t = new
|
|
363
|
+
s.type === 2 ? t = new Ee(i, i.nextSibling, this, e) : s.type === 1 ? t = new s.ctor(i, s.name, s.strings, this, e) : s.type === 6 && (t = new je(i, this, e)), this._$AV.push(t), s = n[++o];
|
|
354
364
|
}
|
|
355
|
-
a !== s?.index && (i =
|
|
365
|
+
a !== s?.index && (i = k.nextNode(), a++);
|
|
356
366
|
}
|
|
357
|
-
return
|
|
367
|
+
return k.currentNode = S, r;
|
|
358
368
|
}
|
|
359
369
|
p(e) {
|
|
360
370
|
let t = 0;
|
|
361
371
|
for (let n of this._$AV) n !== void 0 && (n.strings === void 0 ? n._$AI(e[t]) : (n._$AI(e, n, t), t += n.strings.length - 2)), t++;
|
|
362
372
|
}
|
|
363
|
-
},
|
|
373
|
+
}, Ee = class e {
|
|
364
374
|
get _$AU() {
|
|
365
375
|
return this._$AM?._$AU ?? this._$Cv;
|
|
366
376
|
}
|
|
367
377
|
constructor(e, t, n, r) {
|
|
368
|
-
this.type = 2, this._$AH =
|
|
378
|
+
this.type = 2, this._$AH = O, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = n, this.options = r, this._$Cv = r?.isConnected ?? !0;
|
|
369
379
|
}
|
|
370
380
|
get parentNode() {
|
|
371
381
|
let e = this._$AA.parentNode, t = this._$AM;
|
|
@@ -378,7 +388,7 @@ var we = class {
|
|
|
378
388
|
return this._$AB;
|
|
379
389
|
}
|
|
380
390
|
_$AI(e, t = this) {
|
|
381
|
-
e =
|
|
391
|
+
e = A(this, e, t), fe(e) ? e === O || e == null || e === "" ? (this._$AH !== O && this._$AR(), this._$AH = O) : e !== this._$AH && e !== D && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? me(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e);
|
|
382
392
|
}
|
|
383
393
|
O(e) {
|
|
384
394
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -387,24 +397,24 @@ var we = class {
|
|
|
387
397
|
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
388
398
|
}
|
|
389
399
|
_(e) {
|
|
390
|
-
this._$AH !==
|
|
400
|
+
this._$AH !== O && fe(this._$AH) ? this._$AA.nextSibling.data = e : this.T(S.createTextNode(e)), this._$AH = e;
|
|
391
401
|
}
|
|
392
402
|
$(e) {
|
|
393
|
-
let { values: t, _$litType$: n } = e, r = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el =
|
|
403
|
+
let { values: t, _$litType$: n } = e, r = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = we.createElement(Se(n.h, n.h[0]), this.options)), n);
|
|
394
404
|
if (this._$AH?._$AD === r) this._$AH.p(t);
|
|
395
405
|
else {
|
|
396
|
-
let e = new
|
|
406
|
+
let e = new Te(r, this), n = e.u(this.options);
|
|
397
407
|
e.p(t), this.T(n), this._$AH = e;
|
|
398
408
|
}
|
|
399
409
|
}
|
|
400
410
|
_$AC(e) {
|
|
401
|
-
let t =
|
|
402
|
-
return t === void 0 &&
|
|
411
|
+
let t = xe.get(e.strings);
|
|
412
|
+
return t === void 0 && xe.set(e.strings, t = new we(e)), t;
|
|
403
413
|
}
|
|
404
414
|
k(t) {
|
|
405
|
-
|
|
415
|
+
pe(this._$AH) || (this._$AH = [], this._$AR());
|
|
406
416
|
let n = this._$AH, r, i = 0;
|
|
407
|
-
for (let a of t) i === n.length ? n.push(r = new e(this.O(
|
|
417
|
+
for (let a of t) i === n.length ? n.push(r = new e(this.O(C()), this.O(C()), this, this.options)) : r = n[i], r._$AI(a), i++;
|
|
408
418
|
i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i);
|
|
409
419
|
}
|
|
410
420
|
_$AR(e = this._$AA.nextSibling, t) {
|
|
@@ -416,7 +426,7 @@ var we = class {
|
|
|
416
426
|
setConnected(e) {
|
|
417
427
|
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
418
428
|
}
|
|
419
|
-
},
|
|
429
|
+
}, De = class {
|
|
420
430
|
get tagName() {
|
|
421
431
|
return this.element.tagName;
|
|
422
432
|
}
|
|
@@ -424,47 +434,47 @@ var we = class {
|
|
|
424
434
|
return this._$AM._$AU;
|
|
425
435
|
}
|
|
426
436
|
constructor(e, t, n, r, i) {
|
|
427
|
-
this.type = 1, this._$AH =
|
|
437
|
+
this.type = 1, this._$AH = O, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = i, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(/* @__PURE__ */ new String()), this.strings = n) : this._$AH = O;
|
|
428
438
|
}
|
|
429
439
|
_$AI(e, t = this, n, r) {
|
|
430
440
|
let i = this.strings, a = !1;
|
|
431
|
-
if (i === void 0) e =
|
|
441
|
+
if (i === void 0) e = A(this, e, t, 0), a = !fe(e) || e !== this._$AH && e !== D, a && (this._$AH = e);
|
|
432
442
|
else {
|
|
433
443
|
let r = e, o, s;
|
|
434
|
-
for (e = i[0], o = 0; o < i.length - 1; o++) s =
|
|
444
|
+
for (e = i[0], o = 0; o < i.length - 1; o++) s = A(this, r[n + o], t, o), s === D && (s = this._$AH[o]), a ||= !fe(s) || s !== this._$AH[o], s === O ? e = O : e !== O && (e += (s ?? "") + i[o + 1]), this._$AH[o] = s;
|
|
435
445
|
}
|
|
436
446
|
a && !r && this.j(e);
|
|
437
447
|
}
|
|
438
448
|
j(e) {
|
|
439
|
-
e ===
|
|
449
|
+
e === O ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
440
450
|
}
|
|
441
|
-
},
|
|
451
|
+
}, Oe = class extends De {
|
|
442
452
|
constructor() {
|
|
443
453
|
super(...arguments), this.type = 3;
|
|
444
454
|
}
|
|
445
455
|
j(e) {
|
|
446
|
-
this.element[this.name] = e ===
|
|
456
|
+
this.element[this.name] = e === O ? void 0 : e;
|
|
447
457
|
}
|
|
448
|
-
},
|
|
458
|
+
}, ke = class extends De {
|
|
449
459
|
constructor() {
|
|
450
460
|
super(...arguments), this.type = 4;
|
|
451
461
|
}
|
|
452
462
|
j(e) {
|
|
453
|
-
this.element.toggleAttribute(this.name, !!e && e !==
|
|
463
|
+
this.element.toggleAttribute(this.name, !!e && e !== O);
|
|
454
464
|
}
|
|
455
|
-
},
|
|
465
|
+
}, Ae = class extends De {
|
|
456
466
|
constructor(e, t, n, r, i) {
|
|
457
467
|
super(e, t, n, r, i), this.type = 5;
|
|
458
468
|
}
|
|
459
469
|
_$AI(e, t = this) {
|
|
460
|
-
if ((e =
|
|
461
|
-
let n = this._$AH, r = e ===
|
|
470
|
+
if ((e = A(this, e, t, 0) ?? O) === D) return;
|
|
471
|
+
let n = this._$AH, r = e === O && n !== O || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, i = e !== O && (n === O || r);
|
|
462
472
|
r && this.element.removeEventListener(this.name, this, n), i && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
463
473
|
}
|
|
464
474
|
handleEvent(e) {
|
|
465
475
|
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
466
476
|
}
|
|
467
|
-
},
|
|
477
|
+
}, je = class {
|
|
468
478
|
constructor(e, t, n) {
|
|
469
479
|
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = n;
|
|
470
480
|
}
|
|
@@ -472,18 +482,18 @@ var we = class {
|
|
|
472
482
|
return this._$AM._$AU;
|
|
473
483
|
}
|
|
474
484
|
_$AI(e) {
|
|
475
|
-
|
|
485
|
+
A(this, e);
|
|
476
486
|
}
|
|
477
|
-
},
|
|
478
|
-
|
|
479
|
-
var
|
|
487
|
+
}, Me = ae.litHtmlPolyfillSupport;
|
|
488
|
+
Me?.(we, Ee), (ae.litHtmlVersions ??= []).push("3.3.3");
|
|
489
|
+
var Ne = (e, t, n) => {
|
|
480
490
|
let r = n?.renderBefore ?? t, i = r._$litPart$;
|
|
481
491
|
if (i === void 0) {
|
|
482
492
|
let e = n?.renderBefore ?? null;
|
|
483
|
-
r._$litPart$ = i = new
|
|
493
|
+
r._$litPart$ = i = new Ee(t.insertBefore(C(), e), e, void 0, n ?? {});
|
|
484
494
|
}
|
|
485
495
|
return i._$AI(e), i;
|
|
486
|
-
},
|
|
496
|
+
}, Pe = globalThis, j = class extends b {
|
|
487
497
|
constructor() {
|
|
488
498
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
489
499
|
}
|
|
@@ -493,7 +503,7 @@ var Me = (e, t, n) => {
|
|
|
493
503
|
}
|
|
494
504
|
update(e) {
|
|
495
505
|
let t = this.render();
|
|
496
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do =
|
|
506
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Ne(t, this.renderRoot, this.renderOptions);
|
|
497
507
|
}
|
|
498
508
|
connectedCallback() {
|
|
499
509
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -502,15 +512,176 @@ var Me = (e, t, n) => {
|
|
|
502
512
|
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
503
513
|
}
|
|
504
514
|
render() {
|
|
505
|
-
return
|
|
515
|
+
return D;
|
|
506
516
|
}
|
|
507
517
|
};
|
|
508
|
-
|
|
509
|
-
var
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
518
|
+
j._$litElement$ = !0, j.finalized = !0, Pe.litElementHydrateSupport?.({ LitElement: j });
|
|
519
|
+
var Fe = Pe.litElementPolyfillSupport;
|
|
520
|
+
Fe?.({ LitElement: j }), (Pe.litElementVersions ??= []).push("4.2.2");
|
|
521
|
+
// src/browser/styles.ts
|
|
522
|
+
var Ie = c`
|
|
523
|
+
:host { display: block; width: 100%; min-width: 0; container-type: inline-size; color: var(--pi-text, #e5e7ee); font: 14px var(--pi-font, system-ui, sans-serif); }
|
|
524
|
+
* { box-sizing: border-box; }
|
|
525
|
+
.review-panel { --review-border: var(--pi-border, #353943); --review-muted: var(--pi-muted, #989eaf); --review-surface: var(--pi-surface, #1e2128); --review-accent: var(--pi-accent, #a4b7fa); background: var(--pi-bg, #16181d); }
|
|
526
|
+
h2, h3, p { margin: 0; } p { line-height: 1.6; }
|
|
527
|
+
button, select, input, textarea { font: inherit; color: inherit; }
|
|
528
|
+
button, select, input, textarea { background: var(--review-surface); border: 1px solid var(--review-border); border-radius: 5px; padding: 7px 10px; }
|
|
529
|
+
button { cursor: pointer; } button:disabled { opacity: .5; cursor: default; }
|
|
530
|
+
button:hover:not(:disabled) { border-color: var(--review-accent); }
|
|
531
|
+
:is(button, select, input, textarea, summary):focus-visible { outline: 2px solid var(--review-accent); outline-offset: 2px; }
|
|
532
|
+
button.primary { background: var(--review-accent); color: var(--pi-bg, #16181d); border-color: transparent; font-weight: 600; }
|
|
533
|
+
.hint { color: var(--review-muted); font-size: 12px; }
|
|
534
|
+
.review-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; }
|
|
535
|
+
.review-header h2 { font-size: 20px; letter-spacing: -.4px; }
|
|
536
|
+
.review-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; }
|
|
537
|
+
.draft-count { color: var(--pi-warning, #d1bb90); }
|
|
538
|
+
.source-bar { display: flex; align-items: stretch; justify-content: space-between; border-block: 1px solid var(--review-border); }
|
|
539
|
+
.source-tabs { display: flex; min-width: 0; flex-wrap: wrap; }
|
|
540
|
+
.source-tabs button { border: 0; border-right: 1px solid var(--review-border); border-radius: 0; padding: 8px 16px; min-height: 36px; background: transparent; color: var(--review-muted); }
|
|
541
|
+
.source-tabs button[aria-pressed=true] { color: var(--pi-text, #e5e7ee); background: color-mix(in srgb, var(--review-accent) 15%, transparent); box-shadow: inset 0 -2px var(--review-accent); }
|
|
542
|
+
.source-bar > button { border: 0; border-radius: 0; background: transparent; }
|
|
543
|
+
.source-controls { padding: 0 16px; }
|
|
544
|
+
.toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
|
|
545
|
+
.source-controls .toolbar > label { flex: 1; min-width: 120px; }
|
|
546
|
+
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
|
|
547
|
+
.source-controls input, .source-controls select { width: 100%; min-width: 0; }
|
|
548
|
+
.source-controls details { margin: 10px 0; } summary { cursor: pointer; overflow-wrap: anywhere; }
|
|
549
|
+
.source-help { margin: 10px 0; }
|
|
550
|
+
.notice { padding: 12px 16px; overflow-wrap: anywhere; } .notice:empty { display: none; }
|
|
551
|
+
[role=alert], .stale { color: var(--pi-warning, #ecb65b); }
|
|
552
|
+
.review-workspace { display: grid; grid-template-columns: minmax(160px, 19%) minmax(0, 1fr) minmax(220px, 24%); }
|
|
553
|
+
.file-nav { background: var(--review-surface); border-right: 1px solid var(--review-border); min-width: 0; padding: 12px 8px; }
|
|
554
|
+
.file-list > summary { font-size: 12px; padding: 8px; color: var(--review-muted); }
|
|
555
|
+
.file-list { max-height: 65vh; overflow: auto; }
|
|
556
|
+
.file-list button { display: flex; align-items: center; width: 100%; min-height: 32px; text-align: left; border: 0; background: transparent; padding: 8px; font-size: 12px; }
|
|
557
|
+
.file-list button[aria-current=page] { background: color-mix(in srgb, var(--review-accent) 20%, transparent); }
|
|
558
|
+
.file-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
559
|
+
.viewer { min-width: 0; }
|
|
560
|
+
.file-heading { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--review-border); overflow-wrap: anywhere; }
|
|
561
|
+
.file-heading h3 { font-size: 13px; min-width: 0; }
|
|
562
|
+
.file-heading .hint { flex-basis: 100%; font-size: 11px; }
|
|
563
|
+
.view-tools { display: flex; gap: 8px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--review-border); }
|
|
564
|
+
.view-tools .file-switch { display: none; }
|
|
565
|
+
.view-tools .wrap-control { margin-left: auto; }
|
|
566
|
+
.wrap-control { flex-direction: row; align-items: center; min-height: 32px; color: var(--review-muted); white-space: nowrap; }
|
|
567
|
+
input[type=checkbox], input[type=radio] { accent-color: var(--review-accent); width: 17px; height: 17px; }
|
|
568
|
+
.mobile-notes { display: none; }
|
|
569
|
+
.file-step { min-width: 32px; }
|
|
570
|
+
.code { max-height: 70vh; overflow: auto; }
|
|
571
|
+
.row { display: flex; align-items: stretch; width: max-content; min-width: 100%; font: 12px var(--pi-mono, ui-monospace, monospace); line-height: 1.8; }
|
|
572
|
+
.row code { white-space: pre; padding: 3px 10px 3px 0; font: inherit; }
|
|
573
|
+
.line { flex: 0 0 44px; width: 44px; align-self: stretch; border: 0; border-radius: 0; background: transparent; color: var(--review-muted); padding: 3px 8px; font: inherit; text-align: right; }
|
|
574
|
+
.sign { flex: 0 0 20px; padding-top: 3px; color: var(--review-muted); }
|
|
575
|
+
.wrap .row { width: 100%; min-width: 0; } .wrap .row code { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
|
|
576
|
+
.add { background: color-mix(in srgb, var(--pi-success, #4ba36a) 16%, transparent); }
|
|
577
|
+
.remove { background: color-mix(in srgb, var(--pi-danger, #d85d6b) 16%, transparent); }
|
|
578
|
+
.meta { color: var(--review-muted); background: color-mix(in srgb, var(--review-accent) 8%, transparent); }
|
|
579
|
+
.selected { background: color-mix(in srgb, var(--review-accent) 25%, transparent); }
|
|
580
|
+
.comment-marker { align-self: center; margin: 0 8px 0 auto; min-width: 28px; font-size: 11px; padding: 2px 6px; }
|
|
581
|
+
.editor, .inline-comment, article { padding: 14px; background: var(--review-surface); border: 1px solid var(--review-border); border-radius: 7px; overflow-wrap: anywhere; }
|
|
582
|
+
.editor { border-color: var(--review-accent); margin: 12px; }
|
|
583
|
+
.code .editor, .code .inline-comment { position: sticky; left: 12px; width: calc(100% - 24px); margin: 12px; }
|
|
584
|
+
.editor strong { font-size: 12px; display: block; margin-bottom: 12px; }
|
|
585
|
+
.editor textarea { width: 100%; min-height: 90px; resize: vertical; background: var(--pi-bg, #16181d); line-height: 1.6; }
|
|
586
|
+
.editor .range { margin: 12px 0; color: var(--review-muted); font-size: 12px; }
|
|
587
|
+
input[type=number] { width: 6em; }
|
|
588
|
+
.editor .toolbar { margin-bottom: 0; }
|
|
589
|
+
.inline-comment { font-size: 12px; line-height: 1.7; }
|
|
590
|
+
.inline-comment .toolbar { margin-bottom: 0; }
|
|
591
|
+
.workbench .inline-comment { display: none; }
|
|
592
|
+
.hintbar { padding: 12px 16px; border-top: 1px solid var(--review-border); font-size: 11px; color: var(--review-muted); }
|
|
593
|
+
.phone-hint { display: none; }
|
|
594
|
+
.saved-review { min-width: 0; background: var(--review-surface); border-left: 1px solid var(--review-border); padding: 18px 14px; }
|
|
595
|
+
.saved-review > details > summary { font-size: 13px; font-weight: 600; }
|
|
596
|
+
.saved-review p.hint { margin: 12px 0; }
|
|
597
|
+
article { margin: 12px 0; font-size: 12px; }
|
|
598
|
+
article strong { font-size: 11px; }
|
|
599
|
+
.markdown { margin: 10px 0; line-height: 1.7; }
|
|
600
|
+
.markdown p, .inline-comment p { margin: 8px 0; }
|
|
601
|
+
.markdown pre, .inline-comment pre { overflow: auto; }
|
|
602
|
+
a { color: var(--review-accent); }
|
|
603
|
+
.markdown-export textarea { width: 100%; margin-top: 10px; }
|
|
604
|
+
.empty-state { padding: 48px 20px; text-align: center; color: var(--review-muted); }
|
|
605
|
+
.empty-state h3 { margin-bottom: 10px; font-size: 17px; }
|
|
606
|
+
.focus .review-workspace { display: block; max-width: 1100px; margin: 0 auto; }
|
|
607
|
+
.focus .file-nav { display: none; }
|
|
608
|
+
.focus .view-tools .file-switch { display: inline-block; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
|
|
609
|
+
.focus .saved-review { border: 1px solid var(--review-border); border-radius: 6px; margin: 16px; }
|
|
610
|
+
dialog { color: var(--pi-text, #e5e7ee); background: var(--review-surface); border: 1px solid var(--review-border); border-radius: 12px; padding: 24px; width: min(480px, calc(100% - 24px)); max-height: 85dvh; overflow: auto; box-shadow: 0 24px 80px #0006; }
|
|
611
|
+
dialog::backdrop { background: #090c14a8; }
|
|
612
|
+
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
|
|
613
|
+
.dialog-heading h2 { font-size: 18px; }
|
|
614
|
+
.dialog-heading button { min-height: 44px; min-width: 44px; }
|
|
615
|
+
.layout-option { display: flex; flex-direction: row; align-items: start; gap: 12px; padding: 16px; border: 1px solid var(--review-border); border-radius: 7px; margin: 12px 0; cursor: pointer; }
|
|
616
|
+
.layout-option:has(:checked) { border-color: var(--review-accent); background: color-mix(in srgb, var(--review-accent) 12%, transparent); }
|
|
617
|
+
.layout-option .hint { display: block; margin-top: 6px; line-height: 1.7; }
|
|
618
|
+
.layout-option input { flex-shrink: 0; }
|
|
619
|
+
.settings-status { margin: 10px 0; }
|
|
620
|
+
.settings-save { width: 100%; margin-top: 16px; min-height: 44px; }
|
|
621
|
+
.sheet .file-list { max-height: none; }
|
|
622
|
+
.sheet .file-list button { min-height: 48px; }
|
|
623
|
+
.sheet .saved-review { padding: 0; border: 0; }
|
|
624
|
+
@container (max-width: 1000px) {
|
|
625
|
+
.review-workspace { grid-template-columns: minmax(150px, 24%) minmax(0, 1fr); }
|
|
626
|
+
.saved-review { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--review-border); }
|
|
627
|
+
.review-header { flex-wrap: wrap; }
|
|
628
|
+
}
|
|
629
|
+
@container (max-width: 640px) {
|
|
630
|
+
.review-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 12px; gap: 12px 8px; }
|
|
631
|
+
.review-header h2 { font-size: 18px; }
|
|
632
|
+
.review-actions { display: contents; }
|
|
633
|
+
.review-actions > span { grid-row: 2; font-size: 11px; }
|
|
634
|
+
.review-actions .attach { grid-row: 2; grid-column: 2; max-width: 100%; font-size: 11px; }
|
|
635
|
+
.review-actions .settings-button { grid-row: 1; grid-column: 2; justify-self: end; font-size: 11px; }
|
|
636
|
+
.source-tabs { flex: 1; }
|
|
637
|
+
.source-tabs button { flex: 1; min-height: 44px; padding: 8px; font-size: 12px; }
|
|
638
|
+
.source-bar > button { font-size: 12px; }
|
|
639
|
+
.review-workspace, .focus .review-workspace { display: block; margin: 0; }
|
|
640
|
+
.file-nav, .workbench .saved-review { display: none; }
|
|
641
|
+
.view-tools { padding: 10px 12px; flex-wrap: wrap; }
|
|
642
|
+
.view-tools .file-switch, .mobile-notes { display: inline-block; }
|
|
643
|
+
.view-tools .file-switch { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
644
|
+
.view-tools .file-step { display: none; }
|
|
645
|
+
.file-heading { padding: 12px; }
|
|
646
|
+
.code { max-height: none; }
|
|
647
|
+
.row { min-height: 44px; }
|
|
648
|
+
.line { min-height: 44px; flex-basis: 36px; width: 36px; }
|
|
649
|
+
.row code { padding-top: 10px; } .sign { padding-top: 10px; flex-basis: 18px; }
|
|
650
|
+
.editor textarea { font-size: 16px; min-height: 130px; }
|
|
651
|
+
.editor strong { font-size: 11px; }
|
|
652
|
+
.editor .range summary { padding: 8px 0; min-height: 44px; }
|
|
653
|
+
input, select { font-size: 16px; }
|
|
654
|
+
.toolbar button, .review-actions button, .view-tools button { min-height: 44px; }
|
|
655
|
+
.editor .hint, .desktop-hint { display: none; }
|
|
656
|
+
.phone-hint { display: inline; }
|
|
657
|
+
.comment-marker { min-height: 44px; min-width: 32px; }
|
|
658
|
+
.inline-comment { font-size: 13px; }
|
|
659
|
+
.sheet .saved-review { display: block; }
|
|
660
|
+
.sheet .file-list button { min-height: 56px; }
|
|
661
|
+
}
|
|
662
|
+
@media (max-width: 640px) {
|
|
663
|
+
dialog.sheet { margin: auto 0 0; width: 100%; max-width: none; max-height: 80dvh; border-radius: 16px 16px 0 0; padding: 20px 20px max(24px, env(safe-area-inset-bottom)); }
|
|
664
|
+
}
|
|
665
|
+
@media (pointer: coarse) { button, select { min-height: 44px; } }
|
|
666
|
+
`, Le = "pi-web-code-review:preferences:v1", Re = {
|
|
667
|
+
layout: "workbench",
|
|
668
|
+
wrapCode: !0
|
|
669
|
+
};
|
|
670
|
+
function ze() {
|
|
671
|
+
try {
|
|
672
|
+
let e = JSON.parse(localStorage.getItem("pi-web-code-review:preferences:v1") ?? "null");
|
|
673
|
+
if (typeof e == "object" && e && "layout" in e && "wrapCode" in e && (e.layout === "workbench" || e.layout === "focus") && typeof e.wrapCode == "boolean") return {
|
|
674
|
+
layout: e.layout,
|
|
675
|
+
wrapCode: e.wrapCode
|
|
676
|
+
};
|
|
677
|
+
} catch {}
|
|
678
|
+
return { ...Re };
|
|
679
|
+
}
|
|
680
|
+
function Be(e) {
|
|
681
|
+
localStorage.setItem(Le, JSON.stringify(e));
|
|
682
|
+
}
|
|
683
|
+
// node_modules/marked/lib/marked.esm.js
|
|
684
|
+
function Ve() {
|
|
514
685
|
return {
|
|
515
686
|
async: !1,
|
|
516
687
|
breaks: !1,
|
|
@@ -524,35 +695,35 @@ function Fe() {
|
|
|
524
695
|
walkTokens: null
|
|
525
696
|
};
|
|
526
697
|
}
|
|
527
|
-
var
|
|
528
|
-
function
|
|
529
|
-
|
|
698
|
+
var M = Ve();
|
|
699
|
+
function He(e) {
|
|
700
|
+
M = e;
|
|
530
701
|
}
|
|
531
|
-
var
|
|
532
|
-
function
|
|
702
|
+
var N = { exec: () => null };
|
|
703
|
+
function P(e) {
|
|
533
704
|
let t = [];
|
|
534
705
|
return (n) => {
|
|
535
706
|
let r = Math.max(0, Math.min(3, n - 1)), i = t[r];
|
|
536
707
|
return i || (i = e(r), t[r] = i), i;
|
|
537
708
|
};
|
|
538
709
|
}
|
|
539
|
-
function
|
|
710
|
+
function F(e, t = "") {
|
|
540
711
|
let n = typeof e == "string" ? e : e.source, r = {
|
|
541
712
|
replace: (e, t) => {
|
|
542
713
|
let i = typeof t == "string" ? t : t.source;
|
|
543
|
-
return i = i.replace(
|
|
714
|
+
return i = i.replace(I.caret, "$1"), n = n.replace(e, i), r;
|
|
544
715
|
},
|
|
545
716
|
getRegex: () => new RegExp(n, t)
|
|
546
717
|
};
|
|
547
718
|
return r;
|
|
548
719
|
}
|
|
549
|
-
var
|
|
720
|
+
var Ue = ((e = "") => {
|
|
550
721
|
try {
|
|
551
722
|
return !!RegExp("(?<=1)(?<!1)" + e);
|
|
552
723
|
} catch {
|
|
553
724
|
return !1;
|
|
554
725
|
}
|
|
555
|
-
})(),
|
|
726
|
+
})(), I = {
|
|
556
727
|
codeRemoveIndent: /^(?: {0,3}\t| {1,4})/gm,
|
|
557
728
|
outputLinkReplace: /\\([\[\]])/g,
|
|
558
729
|
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
@@ -607,131 +778,131 @@ var Le = ((e = "") => {
|
|
|
607
778
|
notSpaceStart: /^\S*/,
|
|
608
779
|
endingNewline: /\n$/,
|
|
609
780
|
listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
610
|
-
nextBulletRegex:
|
|
611
|
-
hrRegex:
|
|
612
|
-
fencesBeginRegex:
|
|
613
|
-
headingBeginRegex:
|
|
614
|
-
htmlBeginRegex:
|
|
615
|
-
blockquoteBeginRegex:
|
|
616
|
-
},
|
|
617
|
-
blockquote:
|
|
618
|
-
code:
|
|
619
|
-
def:
|
|
620
|
-
fences:
|
|
621
|
-
heading:
|
|
622
|
-
hr:
|
|
623
|
-
html:
|
|
624
|
-
lheading:
|
|
625
|
-
list:
|
|
626
|
-
newline:
|
|
627
|
-
paragraph:
|
|
628
|
-
table:
|
|
629
|
-
text:
|
|
630
|
-
},
|
|
631
|
-
...
|
|
632
|
-
lheading:
|
|
633
|
-
table:
|
|
634
|
-
paragraph:
|
|
635
|
-
},
|
|
636
|
-
...
|
|
637
|
-
html:
|
|
781
|
+
nextBulletRegex: P((e) => RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),
|
|
782
|
+
hrRegex: P((e) => RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),
|
|
783
|
+
fencesBeginRegex: P((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
|
|
784
|
+
headingBeginRegex: P((e) => RegExp(`^ {0,${e}}#`)),
|
|
785
|
+
htmlBeginRegex: P((e) => RegExp(`^ {0,${e}}(?:</?(?:${R})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`, "i")),
|
|
786
|
+
blockquoteBeginRegex: P((e) => RegExp(`^ {0,${e}}>`))
|
|
787
|
+
}, We = /^(?:[ \t]*(?:\n|$))+/, Ge = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Ke = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, L = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, qe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = / {0,3}(?:[*+-]|\d{1,9}[.)])/, Ye = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Xe = F(Ye).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Ze = F(Ye).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Qe = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, $e = /^[^\n]+/, et = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, tt = F(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", et).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), nt = F(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, Je).getRegex(), R = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", rt = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, it = F("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", rt).replace("tag", R).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), at = (e) => F(Qe).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", e).replace("html", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", R).getRegex(), ot = at(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), st = at(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), ct = {
|
|
788
|
+
blockquote: F(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", st).getRegex(),
|
|
789
|
+
code: Ge,
|
|
790
|
+
def: tt,
|
|
791
|
+
fences: Ke,
|
|
792
|
+
heading: qe,
|
|
793
|
+
hr: L,
|
|
794
|
+
html: it,
|
|
795
|
+
lheading: Xe,
|
|
796
|
+
list: nt,
|
|
797
|
+
newline: We,
|
|
798
|
+
paragraph: ot,
|
|
799
|
+
table: N,
|
|
800
|
+
text: $e
|
|
801
|
+
}, lt = F("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", R).getRegex(), ut = {
|
|
802
|
+
...ct,
|
|
803
|
+
lheading: Ze,
|
|
804
|
+
table: lt,
|
|
805
|
+
paragraph: F(Qe).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", lt).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", R).getRegex()
|
|
806
|
+
}, dt = {
|
|
807
|
+
...ct,
|
|
808
|
+
html: F("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", rt).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
638
809
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
639
810
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
640
|
-
fences:
|
|
811
|
+
fences: N,
|
|
641
812
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
642
|
-
paragraph:
|
|
643
|
-
},
|
|
644
|
-
_backpedal:
|
|
645
|
-
anyPunctuation:
|
|
646
|
-
anyPunctuationOutsideCode:
|
|
647
|
-
autolink:
|
|
648
|
-
blockSkip:
|
|
649
|
-
br:
|
|
650
|
-
code:
|
|
651
|
-
del:
|
|
652
|
-
delLDelim:
|
|
653
|
-
delRDelim:
|
|
654
|
-
emStrongLDelim:
|
|
655
|
-
emStrongRDelimAst:
|
|
656
|
-
emStrongRDelimUnd:
|
|
657
|
-
escape:
|
|
658
|
-
link:
|
|
659
|
-
nolink:
|
|
660
|
-
punctuation:
|
|
661
|
-
reflink:
|
|
662
|
-
reflinkSearch:
|
|
663
|
-
tag:
|
|
664
|
-
text:
|
|
665
|
-
url:
|
|
666
|
-
},
|
|
667
|
-
...
|
|
668
|
-
emStrongLDelim:
|
|
669
|
-
emStrongRDelimAst:
|
|
670
|
-
emStrongRDelimUnd:
|
|
671
|
-
link:
|
|
672
|
-
reflink:
|
|
673
|
-
},
|
|
674
|
-
...
|
|
675
|
-
emStrongRDelimAst:
|
|
676
|
-
emStrongLDelim:
|
|
677
|
-
delLDelim:
|
|
678
|
-
delRDelim:
|
|
679
|
-
url:
|
|
813
|
+
paragraph: F(Qe).replace("hr", L).replace("heading", " *#{1,6} *[^\n]").replace("lheading", Xe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
814
|
+
}, ft = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, pt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, mt = /^( {2,}|\\)\n(?!\s*$)[ \t]*/, ht = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, z = /[\p{P}\p{S}]/u, B = /[\s\p{P}\p{S}]/u, V = /[^\s\p{P}\p{S}]/u, gt = F(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, B).getRegex(), _t = /[\p{Pi}\p{Ps}"']/u, vt = /(?!~)[\p{P}\p{S}]/u, yt = /(?!~)[\s\p{P}\p{S}]/u, bt = /(?:[^\s\p{P}\p{S}]|~)/u, xt = F(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Ue ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), St = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Ct = F(St, "u").replace(/punct/g, z).getRegex(), wt = F(St, "u").replace(/punct/g, vt).getRegex(), Tt = F(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, _t).replace(/punct/g, z).getRegex(), Et = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Dt = F(Et, "gu").replace(/notPunctSpace/g, V).replace(/punctSpace/g, B).replace(/punct/g, z).getRegex(), Ot = F(Et, "gu").replace(/notPunctSpace/g, bt).replace(/punctSpace/g, yt).replace(/punct/g, vt).getRegex(), kt = F("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, V).replace(/punctSpace/g, B).replace(/punct/g, z).getRegex(), At = F("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, V).replace(/punctSpace/g, B).replace(/punct/g, z).getRegex(), jt = F("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, V).replace(/punctSpace/g, B).replace(/punct/g, z).getRegex(), Mt = F(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, z).getRegex(), Nt = F("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, V).replace(/punctSpace/g, B).replace(/punct/g, z).getRegex(), Pt = F(/\\(punct)/, "gu").replace(/punct/g, z).getRegex(), Ft = F(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/, "gu").replace(/punct/g, z).getRegex(), It = F(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Lt = F(rt).replace("(?:-->|$)", "-->").getRegex(), Rt = F("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Lt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), zt = /\[(?:\\[\s\S]|[^\[\]\\])*\]/, Bt = F(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", zt).getRegex(), Vt = F(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label", Bt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Ht = F(/^!?\[(label)\]\[(ref)\]/).replace("label", Bt).replace("ref", et).getRegex(), Ut = F(/^!?\[(ref)\](?:\[\])?/).replace("ref", et).getRegex(), Wt = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/, Gt = F(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", zt).getRegex(), Kt = F("reflink|nolink(?!\\()", "g").replace("reflink", F(/^!?\[(label)\]\[(ref)\]/).replace("label", Gt).replace("ref", Wt).getRegex()).replace("nolink", F(/^!?\[(ref)\](?:\[\])?/).replace("ref", Wt).getRegex()).getRegex(), qt = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Jt = F(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), Yt = {
|
|
815
|
+
_backpedal: N,
|
|
816
|
+
anyPunctuation: Pt,
|
|
817
|
+
anyPunctuationOutsideCode: Ft,
|
|
818
|
+
autolink: It,
|
|
819
|
+
blockSkip: xt,
|
|
820
|
+
br: mt,
|
|
821
|
+
code: pt,
|
|
822
|
+
del: N,
|
|
823
|
+
delLDelim: N,
|
|
824
|
+
delRDelim: N,
|
|
825
|
+
emStrongLDelim: Ct,
|
|
826
|
+
emStrongRDelimAst: Dt,
|
|
827
|
+
emStrongRDelimUnd: At,
|
|
828
|
+
escape: ft,
|
|
829
|
+
link: Vt,
|
|
830
|
+
nolink: Ut,
|
|
831
|
+
punctuation: gt,
|
|
832
|
+
reflink: Ht,
|
|
833
|
+
reflinkSearch: Kt,
|
|
834
|
+
tag: Rt,
|
|
835
|
+
text: ht,
|
|
836
|
+
url: N
|
|
837
|
+
}, Xt = {
|
|
838
|
+
...Yt,
|
|
839
|
+
emStrongLDelim: Tt,
|
|
840
|
+
emStrongRDelimAst: kt,
|
|
841
|
+
emStrongRDelimUnd: jt,
|
|
842
|
+
link: F(/^!?\[(label)\]\((.*?)\)/).replace("label", Bt).getRegex(),
|
|
843
|
+
reflink: F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Bt).getRegex()
|
|
844
|
+
}, Zt = {
|
|
845
|
+
...Yt,
|
|
846
|
+
emStrongRDelimAst: Ot,
|
|
847
|
+
emStrongLDelim: wt,
|
|
848
|
+
delLDelim: Mt,
|
|
849
|
+
delRDelim: Nt,
|
|
850
|
+
url: F(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Jt).replace("protocol", qt).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),
|
|
680
851
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
681
852
|
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
682
|
-
text:
|
|
683
|
-
},
|
|
684
|
-
...
|
|
685
|
-
br:
|
|
686
|
-
text:
|
|
687
|
-
},
|
|
688
|
-
normal:
|
|
689
|
-
gfm:
|
|
690
|
-
pedantic:
|
|
853
|
+
text: F(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", qt).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex()
|
|
854
|
+
}, Qt = {
|
|
855
|
+
...Zt,
|
|
856
|
+
br: F(mt).replace("{2,}", "*").getRegex(),
|
|
857
|
+
text: F(Zt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
858
|
+
}, $t = {
|
|
859
|
+
normal: ct,
|
|
860
|
+
gfm: ut,
|
|
861
|
+
pedantic: dt
|
|
691
862
|
}, H = {
|
|
692
|
-
normal:
|
|
693
|
-
gfm:
|
|
694
|
-
breaks:
|
|
695
|
-
pedantic:
|
|
696
|
-
},
|
|
863
|
+
normal: Yt,
|
|
864
|
+
gfm: Zt,
|
|
865
|
+
breaks: Qt,
|
|
866
|
+
pedantic: Xt
|
|
867
|
+
}, en = {
|
|
697
868
|
"&": "&",
|
|
698
869
|
"<": "<",
|
|
699
870
|
">": ">",
|
|
700
871
|
"\"": """,
|
|
701
872
|
"'": "'"
|
|
702
|
-
},
|
|
873
|
+
}, tn = (e) => en[e];
|
|
703
874
|
function U(e, t) {
|
|
704
875
|
if (t) {
|
|
705
|
-
if (
|
|
706
|
-
} else if (
|
|
876
|
+
if (I.escapeTest.test(e)) return e.replace(I.escapeReplace, tn);
|
|
877
|
+
} else if (I.escapeTestNoEncode.test(e)) return e.replace(I.escapeReplaceNoEncode, tn);
|
|
707
878
|
return e;
|
|
708
879
|
}
|
|
709
|
-
function
|
|
710
|
-
return
|
|
880
|
+
function nn(e) {
|
|
881
|
+
return I.numericCharacterReference.test(e) ? e.replace(I.numericCharacterReferenceOrAmpersand, (e, t, n) => {
|
|
711
882
|
if (t === void 0 && n === void 0) return "&";
|
|
712
883
|
let r = t === void 0 ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
|
|
713
884
|
return r === 0 || r > 1114111 || r >= 55296 && r <= 57343 ? "�" : r === 38 ? "&" : String.fromCodePoint(r);
|
|
714
885
|
}) : e;
|
|
715
886
|
}
|
|
716
|
-
function
|
|
887
|
+
function rn(e) {
|
|
717
888
|
try {
|
|
718
|
-
e = encodeURI(e).replace(
|
|
889
|
+
e = encodeURI(e).replace(I.percentDecode, "%");
|
|
719
890
|
} catch {
|
|
720
891
|
return null;
|
|
721
892
|
}
|
|
722
893
|
return e;
|
|
723
894
|
}
|
|
724
|
-
function
|
|
725
|
-
let n = e.replace(
|
|
895
|
+
function an(e, t) {
|
|
896
|
+
let n = e.replace(I.findPipe, (e, t, n) => {
|
|
726
897
|
let r = !1, i = t;
|
|
727
898
|
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
728
899
|
return r ? "|" : " |";
|
|
729
|
-
}).split(
|
|
900
|
+
}).split(I.splitPipe), r = 0;
|
|
730
901
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) {
|
|
731
902
|
if (n.length > t) n.splice(t);
|
|
732
903
|
else for (; n.length < t;) n.push("");
|
|
733
904
|
}
|
|
734
|
-
for (; r < n.length; r++) n[r] = n[r].trim().replace(
|
|
905
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(I.slashPipe, "|");
|
|
735
906
|
return n;
|
|
736
907
|
}
|
|
737
908
|
function W(e, t, n) {
|
|
@@ -746,15 +917,15 @@ function W(e, t, n) {
|
|
|
746
917
|
}
|
|
747
918
|
return e.slice(0, r - i);
|
|
748
919
|
}
|
|
749
|
-
function
|
|
920
|
+
function on(e) {
|
|
750
921
|
let t = e.split("\n"), n = t.length - 1;
|
|
751
|
-
for (; n >= 0 &&
|
|
922
|
+
for (; n >= 0 && I.blankLine.test(t[n]);) n--;
|
|
752
923
|
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
753
924
|
}
|
|
754
|
-
function
|
|
925
|
+
function sn(e) {
|
|
755
926
|
return e.trim().toLowerCase().toUpperCase().toLowerCase();
|
|
756
927
|
}
|
|
757
|
-
function
|
|
928
|
+
function cn(e, t) {
|
|
758
929
|
if (e.indexOf(t[0]) === -1 && e.indexOf(t[1]) === -1) return -1;
|
|
759
930
|
let n = 0;
|
|
760
931
|
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
@@ -762,7 +933,7 @@ function en(e, t) {
|
|
|
762
933
|
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
763
934
|
return n > 0 ? -2 : -1;
|
|
764
935
|
}
|
|
765
|
-
function
|
|
936
|
+
function ln(e, t = 0) {
|
|
766
937
|
let n = t, r = "";
|
|
767
938
|
for (let t of e) if (t === " ") {
|
|
768
939
|
let e = 4 - n % 4;
|
|
@@ -770,7 +941,7 @@ function tn(e, t = 0) {
|
|
|
770
941
|
} else r += t, n++;
|
|
771
942
|
return r;
|
|
772
943
|
}
|
|
773
|
-
function
|
|
944
|
+
function un(e, t, n, r, i) {
|
|
774
945
|
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1"), c = e[0].charAt(0) === "!", l = r.state.inLink, u = r.state.linkEmitted, d = r.state.inRawBlock;
|
|
775
946
|
r.state.inLink = !0, r.state.linkEmitted = !1;
|
|
776
947
|
let f = r.inlineTokens(s), p = r.state.linkEmitted;
|
|
@@ -790,7 +961,7 @@ function nn(e, t, n, r, i) {
|
|
|
790
961
|
tokens: f
|
|
791
962
|
};
|
|
792
963
|
}
|
|
793
|
-
function
|
|
964
|
+
function dn(e, t, n) {
|
|
794
965
|
let r = e.match(n.other.indentCodeCompensation);
|
|
795
966
|
if (r === null) return t;
|
|
796
967
|
let i = r[1];
|
|
@@ -801,7 +972,7 @@ function rn(e, t, n) {
|
|
|
801
972
|
return e.slice(Math.min(r.length, i.length));
|
|
802
973
|
}).join("\n");
|
|
803
974
|
}
|
|
804
|
-
function
|
|
975
|
+
function fn(e, t, n, r) {
|
|
805
976
|
if (!t.includes("<")) return !1;
|
|
806
977
|
for (let i = 0; i < t.length; i++) {
|
|
807
978
|
if (t[i] === "\\") {
|
|
@@ -824,12 +995,12 @@ function an(e, t, n, r) {
|
|
|
824
995
|
}
|
|
825
996
|
return !1;
|
|
826
997
|
}
|
|
827
|
-
var
|
|
998
|
+
var pn = class {
|
|
828
999
|
options;
|
|
829
1000
|
rules;
|
|
830
1001
|
lexer;
|
|
831
1002
|
constructor(e) {
|
|
832
|
-
this.options = e ||
|
|
1003
|
+
this.options = e || M;
|
|
833
1004
|
}
|
|
834
1005
|
space(e) {
|
|
835
1006
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -841,7 +1012,7 @@ var on = class {
|
|
|
841
1012
|
code(e) {
|
|
842
1013
|
let t = this.rules.block.code.exec(e);
|
|
843
1014
|
if (t) {
|
|
844
|
-
let e = this.options.pedantic ? t[0] :
|
|
1015
|
+
let e = this.options.pedantic ? t[0] : on(t[0]);
|
|
845
1016
|
return {
|
|
846
1017
|
type: "code",
|
|
847
1018
|
raw: e,
|
|
@@ -853,7 +1024,7 @@ var on = class {
|
|
|
853
1024
|
fences(e) {
|
|
854
1025
|
let t = this.rules.block.fences.exec(e);
|
|
855
1026
|
if (t) {
|
|
856
|
-
let e = t[0], n =
|
|
1027
|
+
let e = t[0], n = dn(e, t[3] || "", this.rules);
|
|
857
1028
|
return {
|
|
858
1029
|
type: "code",
|
|
859
1030
|
raw: e,
|
|
@@ -915,7 +1086,6 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
915
1086
|
if (u?.type === "list") {
|
|
916
1087
|
let t = u, a = t.raw + "\n" + e.join("\n"), o = this.list(a);
|
|
917
1088
|
i[i.length - 1] = o, n = n.substring(0, n.length - u.raw.length) + o.raw, r = r.substring(0, r.length - t.raw.length) + o.raw, e = a.substring(i.at(-1).raw.length).split("\n");
|
|
918
|
-
continue;
|
|
919
1089
|
}
|
|
920
1090
|
}
|
|
921
1091
|
return {
|
|
@@ -944,12 +1114,12 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
944
1114
|
if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
945
1115
|
let l = r();
|
|
946
1116
|
e = e.substring(t[0].length);
|
|
947
|
-
let u = t[2].split("\n", 1)[0], d = t[1].length, f = this.options.pedantic ?
|
|
1117
|
+
let u = t[2].split("\n", 1)[0], d = t[1].length, f = this.options.pedantic ? ln(u, d) : u.replace(this.rules.other.leadingSpaceTab, (e) => ln(e, d)), p = e.split("\n", 1)[0], m = !f.trim(), h = 0;
|
|
948
1118
|
if (this.options.pedantic ? (h = 2, a = f.trimStart()) : m ? h = d + 1 : (h = f.search(this.rules.other.nonSpaceChar), h = h > 4 ? 1 : h, a = f.slice(h), h += d), m && this.rules.other.blankLine.test(p) && (e = e.substring(p.length + 1), i = !0), !i) {
|
|
949
1119
|
let t = this.rules.other.nextBulletRegex(h), n = this.rules.other.hrRegex(h), r = this.rules.other.fencesBeginRegex(h), i = this.rules.other.headingBeginRegex(h), o = this.rules.other.htmlBeginRegex(h), s = this.rules.other.blockquoteBeginRegex(h);
|
|
950
1120
|
for (; e;) {
|
|
951
1121
|
let c = e.split("\n", 1)[0], l;
|
|
952
|
-
if (p = c, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, " "), l = p) : l = p.replace(this.rules.other.leadingSpaceTab, (e) =>
|
|
1122
|
+
if (p = c, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, " "), l = p) : l = p.replace(this.rules.other.leadingSpaceTab, (e) => ln(e)), r.test(p) || i.test(p) || o.test(p) || s.test(p) || t.test(p) || n.test(p)) break;
|
|
953
1123
|
if (l.search(this.rules.other.nonSpaceChar) >= h || !p.trim()) a += "\n" + l.slice(h);
|
|
954
1124
|
else {
|
|
955
1125
|
if (m || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || r.test(f) || i.test(f) || n.test(f)) break;
|
|
@@ -1010,7 +1180,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1010
1180
|
html(e) {
|
|
1011
1181
|
let t = this.rules.block.html.exec(e);
|
|
1012
1182
|
if (t) {
|
|
1013
|
-
let e =
|
|
1183
|
+
let e = on(t[0]);
|
|
1014
1184
|
return {
|
|
1015
1185
|
type: "html",
|
|
1016
1186
|
block: !0,
|
|
@@ -1023,8 +1193,8 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1023
1193
|
def(e) {
|
|
1024
1194
|
let t = this.rules.block.def.exec(e);
|
|
1025
1195
|
if (t) {
|
|
1026
|
-
if (!this.rules.other.startAngleBracket.test(t[2]) &&
|
|
1027
|
-
let e =
|
|
1196
|
+
if (!this.rules.other.startAngleBracket.test(t[2]) && cn(t[2], "()") !== -1) return;
|
|
1197
|
+
let e = sn(t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
1028
1198
|
return {
|
|
1029
1199
|
type: "def",
|
|
1030
1200
|
tag: e,
|
|
@@ -1037,7 +1207,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1037
1207
|
table(e) {
|
|
1038
1208
|
let t = this.rules.block.table.exec(e);
|
|
1039
1209
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
1040
|
-
let n =
|
|
1210
|
+
let n = an(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
|
|
1041
1211
|
type: "table",
|
|
1042
1212
|
raw: W(t[0], "\n"),
|
|
1043
1213
|
header: [],
|
|
@@ -1052,7 +1222,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1052
1222
|
header: !0,
|
|
1053
1223
|
align: a.align[e]
|
|
1054
1224
|
});
|
|
1055
|
-
for (let e of i) a.rows.push(
|
|
1225
|
+
for (let e of i) a.rows.push(an(e, a.header.length).map((e, t) => ({
|
|
1056
1226
|
text: e,
|
|
1057
1227
|
tokens: this.lexer.inline(e),
|
|
1058
1228
|
header: !1,
|
|
@@ -1119,14 +1289,14 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1119
1289
|
let t = this.rules.inline.link.exec(e);
|
|
1120
1290
|
if (t) {
|
|
1121
1291
|
let n = t[0].charAt(0) === "!" ? 2 : 1;
|
|
1122
|
-
if (!this.options.pedantic &&
|
|
1292
|
+
if (!this.options.pedantic && fn(e, t[1], n, this.rules)) return;
|
|
1123
1293
|
let r = t[2].trim();
|
|
1124
1294
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
|
|
1125
1295
|
if (!this.rules.other.endAngleBracket.test(r)) return;
|
|
1126
1296
|
let e = W(r.slice(0, -1), "\\");
|
|
1127
1297
|
if ((r.length - e.length) % 2 == 0) return;
|
|
1128
1298
|
} else {
|
|
1129
|
-
let e =
|
|
1299
|
+
let e = cn(t[2], "()");
|
|
1130
1300
|
if (e === -2) return;
|
|
1131
1301
|
if (e > -1) {
|
|
1132
1302
|
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
@@ -1138,7 +1308,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1138
1308
|
let e = this.rules.other.pedanticHrefTitle.exec(i);
|
|
1139
1309
|
e && (i = e[1], a = e[3]);
|
|
1140
1310
|
} else a = t[3] ? t[3].slice(1, -1) : "";
|
|
1141
|
-
return i = i.trim(), this.rules.other.startAngleBracket.test(i) && (i = this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? i.slice(1) : i.slice(1, -1)),
|
|
1311
|
+
return i = i.trim(), this.rules.other.startAngleBracket.test(i) && (i = this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? i.slice(1) : i.slice(1, -1)), un(t, {
|
|
1142
1312
|
href: i && i.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
1143
1313
|
title: a && a.replace(this.rules.inline.anyPunctuation, "$1")
|
|
1144
1314
|
}, t[0], this.lexer, this.rules);
|
|
@@ -1148,8 +1318,8 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1148
1318
|
let n;
|
|
1149
1319
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
1150
1320
|
let r = n[0].charAt(0) === "!" ? 2 : 1;
|
|
1151
|
-
if (!this.options.pedantic &&
|
|
1152
|
-
let i = t[
|
|
1321
|
+
if (!this.options.pedantic && fn(e, n[1], r, this.rules)) return;
|
|
1322
|
+
let i = t[sn((n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "))];
|
|
1153
1323
|
if (!i) {
|
|
1154
1324
|
let e = n[0].charAt(0);
|
|
1155
1325
|
return {
|
|
@@ -1158,7 +1328,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1158
1328
|
text: e
|
|
1159
1329
|
};
|
|
1160
1330
|
}
|
|
1161
|
-
return
|
|
1331
|
+
return un(n, i, n[0], this.lexer, this.rules);
|
|
1162
1332
|
}
|
|
1163
1333
|
}
|
|
1164
1334
|
emStrong(e, t, n = "") {
|
|
@@ -1291,7 +1461,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1291
1461
|
return {
|
|
1292
1462
|
type: "text",
|
|
1293
1463
|
raw: t[0],
|
|
1294
|
-
text: e ? t[0] :
|
|
1464
|
+
text: e ? t[0] : nn(t[0]),
|
|
1295
1465
|
escaped: e
|
|
1296
1466
|
};
|
|
1297
1467
|
}
|
|
@@ -1303,7 +1473,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1303
1473
|
inlineQueue;
|
|
1304
1474
|
tokenizer;
|
|
1305
1475
|
constructor(e) {
|
|
1306
|
-
this.tokens = [], this.tokens.links = Object.create(null), this.options = e ||
|
|
1476
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || M, this.options.tokenizer = this.options.tokenizer || new pn(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
1307
1477
|
inLink: !1,
|
|
1308
1478
|
inRawBlock: !1,
|
|
1309
1479
|
linkEmitted: !1,
|
|
@@ -1311,15 +1481,15 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1311
1481
|
top: !0
|
|
1312
1482
|
};
|
|
1313
1483
|
let t = {
|
|
1314
|
-
other:
|
|
1315
|
-
block:
|
|
1484
|
+
other: I,
|
|
1485
|
+
block: $t.normal,
|
|
1316
1486
|
inline: H.normal
|
|
1317
1487
|
};
|
|
1318
|
-
this.options.pedantic ? (t.block =
|
|
1488
|
+
this.options.pedantic ? (t.block = $t.pedantic, t.inline = H.pedantic) : this.options.gfm && (t.block = $t.gfm, t.inline = this.options.breaks ? H.breaks : H.gfm), this.tokenizer.rules = t;
|
|
1319
1489
|
}
|
|
1320
1490
|
static get rules() {
|
|
1321
1491
|
return {
|
|
1322
|
-
block:
|
|
1492
|
+
block: $t,
|
|
1323
1493
|
inline: H
|
|
1324
1494
|
};
|
|
1325
1495
|
}
|
|
@@ -1330,7 +1500,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1330
1500
|
return new e(n).inlineTokens(t);
|
|
1331
1501
|
}
|
|
1332
1502
|
lex(e) {
|
|
1333
|
-
e = e.replace(
|
|
1503
|
+
e = e.replace(I.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
|
|
1334
1504
|
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
1335
1505
|
let t = this.inlineQueue[e];
|
|
1336
1506
|
this.inlineTokens(t.src, t.tokens);
|
|
@@ -1338,7 +1508,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1338
1508
|
return this.inlineQueue = [], this.tokens;
|
|
1339
1509
|
}
|
|
1340
1510
|
blockTokens(e, t = [], n = !1) {
|
|
1341
|
-
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(
|
|
1511
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(I.tabCharGlobal, " ").replace(I.spaceLine, ""));
|
|
1342
1512
|
let r = 1 / 0;
|
|
1343
1513
|
for (; e;) {
|
|
1344
1514
|
if (e.length < r) r = e.length;
|
|
@@ -1360,27 +1530,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1360
1530
|
n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.at(-1).src = n.text) : t.push(i);
|
|
1361
1531
|
continue;
|
|
1362
1532
|
}
|
|
1363
|
-
if (i = this.tokenizer.fences(e)) {
|
|
1364
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
1365
|
-
continue;
|
|
1366
|
-
}
|
|
1367
|
-
if (i = this.tokenizer.heading(e)) {
|
|
1368
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
1369
|
-
continue;
|
|
1370
|
-
}
|
|
1371
|
-
if (i = this.tokenizer.hr(e)) {
|
|
1372
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
1373
|
-
continue;
|
|
1374
|
-
}
|
|
1375
|
-
if (i = this.tokenizer.blockquote(e)) {
|
|
1376
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
1377
|
-
continue;
|
|
1378
|
-
}
|
|
1379
|
-
if (i = this.tokenizer.list(e)) {
|
|
1380
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
1381
|
-
continue;
|
|
1382
|
-
}
|
|
1383
|
-
if (i = this.tokenizer.html(e)) {
|
|
1533
|
+
if ((i = this.tokenizer.fences(e)) || (i = this.tokenizer.heading(e)) || (i = this.tokenizer.hr(e)) || (i = this.tokenizer.blockquote(e)) || (i = this.tokenizer.list(e)) || (i = this.tokenizer.html(e))) {
|
|
1384
1534
|
e = e.substring(i.raw.length), t.push(i);
|
|
1385
1535
|
continue;
|
|
1386
1536
|
}
|
|
@@ -1393,11 +1543,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1393
1543
|
}, t.push(i));
|
|
1394
1544
|
continue;
|
|
1395
1545
|
}
|
|
1396
|
-
if (i = this.tokenizer.table(e)) {
|
|
1397
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
1398
|
-
continue;
|
|
1399
|
-
}
|
|
1400
|
-
if (i = this.tokenizer.lheading(e)) {
|
|
1546
|
+
if ((i = this.tokenizer.table(e)) || (i = this.tokenizer.lheading(e))) {
|
|
1401
1547
|
e = e.substring(i.raw.length), t.push(i);
|
|
1402
1548
|
continue;
|
|
1403
1549
|
}
|
|
@@ -1411,15 +1557,11 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1411
1557
|
if (this.state.top && (i = this.tokenizer.paragraph(a))) {
|
|
1412
1558
|
let r = t.at(-1);
|
|
1413
1559
|
n && r?.type === "paragraph" ? (r.raw += (r.raw.endsWith("\n") ? "" : "\n") + i.raw, r.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r.text) : t.push(i), n = a.length !== e.length, e = e.substring(i.raw.length);
|
|
1414
|
-
|
|
1415
|
-
}
|
|
1416
|
-
if (i = this.tokenizer.text(e)) {
|
|
1560
|
+
} else if (i = this.tokenizer.text(e)) {
|
|
1417
1561
|
e = e.substring(i.raw.length);
|
|
1418
1562
|
let n = t.at(-1);
|
|
1419
1563
|
n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n.text) : t.push(i);
|
|
1420
|
-
|
|
1421
|
-
}
|
|
1422
|
-
if (e) {
|
|
1564
|
+
} else if (e) {
|
|
1423
1565
|
this.infiniteLoopError(e.charCodeAt(0));
|
|
1424
1566
|
break;
|
|
1425
1567
|
}
|
|
@@ -1438,7 +1580,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1438
1580
|
for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return !0;
|
|
1439
1581
|
for (let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
|
|
1440
1582
|
let e = t[0], n = e.lastIndexOf("[");
|
|
1441
|
-
if (e.charAt(0) !== "!" && Object.hasOwn(this.tokens.links,
|
|
1583
|
+
if (e.charAt(0) !== "!" && Object.hasOwn(this.tokens.links, sn(e.slice(n + 1, -1))) && !(n > 1 && this.linkInText(e.slice(1, n - 1)))) return !0;
|
|
1442
1584
|
}
|
|
1443
1585
|
return !1;
|
|
1444
1586
|
}
|
|
@@ -1457,7 +1599,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1457
1599
|
if (this.tokens.links && e.includes("[")) {
|
|
1458
1600
|
let e = this.tokenizer.rules.inline.reflinkSearch, t = (n) => {
|
|
1459
1601
|
let r = n.lastIndexOf("[");
|
|
1460
|
-
if (!Object.hasOwn(this.tokens.links,
|
|
1602
|
+
if (!Object.hasOwn(this.tokens.links, sn(n.slice(r + 1, -1)))) return n;
|
|
1461
1603
|
if (r > 1 && n.charAt(0) !== "!") {
|
|
1462
1604
|
let i = n.slice(1, r - 1);
|
|
1463
1605
|
if (this.linkInText(i)) return "[" + i.replace(e, t) + "][" + "a".repeat(n.length - r - 2) + "]";
|
|
@@ -1480,15 +1622,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1480
1622
|
r || (i = ""), r = !1;
|
|
1481
1623
|
let o;
|
|
1482
1624
|
if (this.options.extensions?.inline?.some((n) => (o = n.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1)) continue;
|
|
1483
|
-
if (o = this.tokenizer.escape(e)) {
|
|
1484
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1485
|
-
continue;
|
|
1486
|
-
}
|
|
1487
|
-
if (o = this.tokenizer.tag(e)) {
|
|
1488
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1489
|
-
continue;
|
|
1490
|
-
}
|
|
1491
|
-
if (o = this.tokenizer.link(e)) {
|
|
1625
|
+
if ((o = this.tokenizer.escape(e)) || (o = this.tokenizer.tag(e)) || (o = this.tokenizer.link(e))) {
|
|
1492
1626
|
e = e.substring(o.raw.length), t.push(o);
|
|
1493
1627
|
continue;
|
|
1494
1628
|
}
|
|
@@ -1498,27 +1632,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1498
1632
|
o.type === "text" && n?.type === "text" ? (n.raw += o.raw, n.text += o.text) : t.push(o);
|
|
1499
1633
|
continue;
|
|
1500
1634
|
}
|
|
1501
|
-
if (o = this.tokenizer.emStrong(e, n, i)) {
|
|
1502
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1503
|
-
continue;
|
|
1504
|
-
}
|
|
1505
|
-
if (o = this.tokenizer.codespan(e)) {
|
|
1506
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1507
|
-
continue;
|
|
1508
|
-
}
|
|
1509
|
-
if (o = this.tokenizer.br(e)) {
|
|
1510
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1511
|
-
continue;
|
|
1512
|
-
}
|
|
1513
|
-
if (o = this.tokenizer.del(e, n, i)) {
|
|
1514
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1515
|
-
continue;
|
|
1516
|
-
}
|
|
1517
|
-
if (o = this.tokenizer.autolink(e)) {
|
|
1518
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1519
|
-
continue;
|
|
1520
|
-
}
|
|
1521
|
-
if (!this.state.inLink && (o = this.tokenizer.url(e))) {
|
|
1635
|
+
if ((o = this.tokenizer.emStrong(e, n, i)) || (o = this.tokenizer.codespan(e)) || (o = this.tokenizer.br(e)) || (o = this.tokenizer.del(e, n, i)) || (o = this.tokenizer.autolink(e)) || !this.state.inLink && (o = this.tokenizer.url(e))) {
|
|
1522
1636
|
e = e.substring(o.raw.length), t.push(o);
|
|
1523
1637
|
continue;
|
|
1524
1638
|
}
|
|
@@ -1533,9 +1647,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1533
1647
|
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (i = o.raw.slice(-1)), r = !0;
|
|
1534
1648
|
let n = t.at(-1);
|
|
1535
1649
|
n?.type === "text" ? (n.raw += o.raw, n.text += o.text) : t.push(o);
|
|
1536
|
-
|
|
1537
|
-
}
|
|
1538
|
-
if (e) {
|
|
1650
|
+
} else if (e) {
|
|
1539
1651
|
this.infiniteLoopError(e.charCodeAt(0));
|
|
1540
1652
|
break;
|
|
1541
1653
|
}
|
|
@@ -1547,17 +1659,17 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1547
1659
|
if (this.options.silent) console.error(t);
|
|
1548
1660
|
else throw Error(t);
|
|
1549
1661
|
}
|
|
1550
|
-
},
|
|
1662
|
+
}, mn = class {
|
|
1551
1663
|
options;
|
|
1552
1664
|
parser;
|
|
1553
1665
|
constructor(e) {
|
|
1554
|
-
this.options = e ||
|
|
1666
|
+
this.options = e || M;
|
|
1555
1667
|
}
|
|
1556
1668
|
space(e) {
|
|
1557
1669
|
return "";
|
|
1558
1670
|
}
|
|
1559
1671
|
code({ text: e, lang: t, escaped: n }) {
|
|
1560
|
-
let r = (t || "").match(
|
|
1672
|
+
let r = (t || "").match(I.notSpaceStart)?.[0], i = e ? e.replace(I.endingNewline, "") + "\n" : "";
|
|
1561
1673
|
return r ? "<pre><code class=\"language-" + U(r) + "\">" + (n ? i : U(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : U(i, !0)) + "</code></pre>\n";
|
|
1562
1674
|
}
|
|
1563
1675
|
blockquote({ tokens: e }) {
|
|
@@ -1637,7 +1749,7 @@ ${e}</tr>
|
|
|
1637
1749
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1638
1750
|
}
|
|
1639
1751
|
link({ href: e, title: t, text: n, tokens: r, autolink: i }) {
|
|
1640
|
-
let a = i ? U(n, !0) : this.parser.parseInline(r), o =
|
|
1752
|
+
let a = i ? U(n, !0) : this.parser.parseInline(r), o = rn(e);
|
|
1641
1753
|
if (o === null) return a;
|
|
1642
1754
|
e = U(o, i);
|
|
1643
1755
|
let s = "<a href=\"" + e + "\"";
|
|
@@ -1645,7 +1757,7 @@ ${e}</tr>
|
|
|
1645
1757
|
}
|
|
1646
1758
|
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1647
1759
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1648
|
-
let i =
|
|
1760
|
+
let i = rn(e);
|
|
1649
1761
|
if (i === null) return U(n);
|
|
1650
1762
|
e = i;
|
|
1651
1763
|
let a = `<img src="${U(e)}" alt="${U(n)}"`;
|
|
@@ -1654,7 +1766,7 @@ ${e}</tr>
|
|
|
1654
1766
|
text(e) {
|
|
1655
1767
|
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : U(e.text);
|
|
1656
1768
|
}
|
|
1657
|
-
},
|
|
1769
|
+
}, hn = class {
|
|
1658
1770
|
strong({ text: e }) {
|
|
1659
1771
|
return e;
|
|
1660
1772
|
}
|
|
@@ -1690,7 +1802,7 @@ ${e}</tr>
|
|
|
1690
1802
|
renderer;
|
|
1691
1803
|
textRenderer;
|
|
1692
1804
|
constructor(e) {
|
|
1693
|
-
this.options = e ||
|
|
1805
|
+
this.options = e || M, this.options.renderer = this.options.renderer || new mn(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new hn();
|
|
1694
1806
|
}
|
|
1695
1807
|
static parse(t, n) {
|
|
1696
1808
|
return new e(n).parse(t);
|
|
@@ -1842,7 +1954,7 @@ ${e}</tr>
|
|
|
1842
1954
|
options;
|
|
1843
1955
|
block;
|
|
1844
1956
|
constructor(e) {
|
|
1845
|
-
this.options = e ||
|
|
1957
|
+
this.options = e || M;
|
|
1846
1958
|
}
|
|
1847
1959
|
static passThroughHooks = /* @__PURE__ */ new Set([
|
|
1848
1960
|
"preprocess",
|
|
@@ -1879,15 +1991,15 @@ function J(e, t) {
|
|
|
1879
1991
|
else e.push(t);
|
|
1880
1992
|
}
|
|
1881
1993
|
var Y = new class {
|
|
1882
|
-
defaults =
|
|
1994
|
+
defaults = Ve();
|
|
1883
1995
|
options = this.setOptions;
|
|
1884
1996
|
parse = this.parseMarkdown(!0);
|
|
1885
1997
|
parseInline = this.parseMarkdown(!1);
|
|
1886
1998
|
Parser = K;
|
|
1887
|
-
Renderer =
|
|
1888
|
-
TextRenderer =
|
|
1999
|
+
Renderer = mn;
|
|
2000
|
+
TextRenderer = hn;
|
|
1889
2001
|
Lexer = G;
|
|
1890
|
-
Tokenizer =
|
|
2002
|
+
Tokenizer = pn;
|
|
1891
2003
|
Hooks = q;
|
|
1892
2004
|
constructor(...e) {
|
|
1893
2005
|
this.use(...e);
|
|
@@ -1939,7 +2051,7 @@ var Y = new class {
|
|
|
1939
2051
|
}
|
|
1940
2052
|
"childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
|
|
1941
2053
|
}), n.extensions = t), e.renderer) {
|
|
1942
|
-
let t = this.defaults.renderer || new
|
|
2054
|
+
let t = this.defaults.renderer || new mn(this.defaults);
|
|
1943
2055
|
for (let n in e.renderer) {
|
|
1944
2056
|
if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
|
|
1945
2057
|
if (["options", "parser"].includes(n)) continue;
|
|
@@ -1952,7 +2064,7 @@ var Y = new class {
|
|
|
1952
2064
|
n.renderer = t;
|
|
1953
2065
|
}
|
|
1954
2066
|
if (e.tokenizer) {
|
|
1955
|
-
let t = this.defaults.tokenizer || new
|
|
2067
|
+
let t = this.defaults.tokenizer || new pn(this.defaults);
|
|
1956
2068
|
for (let n in e.tokenizer) {
|
|
1957
2069
|
if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
|
|
1958
2070
|
if ([
|
|
@@ -2058,17 +2170,16 @@ function X(e, t) {
|
|
|
2058
2170
|
return Y.parse(e, t);
|
|
2059
2171
|
}
|
|
2060
2172
|
X.options = X.setOptions = function(e) {
|
|
2061
|
-
return Y.setOptions(e), X.defaults = Y.defaults,
|
|
2062
|
-
}, X.getDefaults =
|
|
2063
|
-
function
|
|
2064
|
-
return Y.use(...e), X.defaults = Y.defaults,
|
|
2173
|
+
return Y.setOptions(e), X.defaults = Y.defaults, He(X.defaults), X;
|
|
2174
|
+
}, X.getDefaults = Ve, X.defaults = M;
|
|
2175
|
+
function gn(...e) {
|
|
2176
|
+
return Y.use(...e), X.defaults = Y.defaults, He(X.defaults), X;
|
|
2065
2177
|
}
|
|
2066
|
-
X.use =
|
|
2178
|
+
X.use = gn, X.walkTokens = function(e, t) {
|
|
2067
2179
|
return Y.walkTokens(e, t);
|
|
2068
|
-
}, X.parseInline = Y.parseInline, X.Parser = K, X.parser = K.parse, X.Renderer =
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
function un(e) {
|
|
2180
|
+
}, X.parseInline = Y.parseInline, X.Parser = K, X.parser = K.parse, X.Renderer = mn, X.TextRenderer = hn, X.Lexer = G, X.lexer = G.lex, X.Tokenizer = pn, X.Hooks = q, X.parse = X, X.options, X.setOptions, X.walkTokens, X.parseInline, K.parse, G.lex;
|
|
2181
|
+
// src/browser/markdown.ts
|
|
2182
|
+
function _n(e) {
|
|
2072
2183
|
return [
|
|
2073
2184
|
"space",
|
|
2074
2185
|
"def",
|
|
@@ -2093,7 +2204,7 @@ function un(e) {
|
|
|
2093
2204
|
"table"
|
|
2094
2205
|
].includes(e.type);
|
|
2095
2206
|
}
|
|
2096
|
-
function
|
|
2207
|
+
function vn(e) {
|
|
2097
2208
|
try {
|
|
2098
2209
|
let t = new URL(e);
|
|
2099
2210
|
return t.protocol === "https:" || t.protocol === "http:" ? t.href : void 0;
|
|
@@ -2101,10 +2212,10 @@ function dn(e) {
|
|
|
2101
2212
|
return;
|
|
2102
2213
|
}
|
|
2103
2214
|
}
|
|
2104
|
-
function
|
|
2215
|
+
function yn(e, t) {
|
|
2105
2216
|
let n = (e) => e.map(r);
|
|
2106
2217
|
function r(t) {
|
|
2107
|
-
if (!
|
|
2218
|
+
if (!_n(t)) return t.raw;
|
|
2108
2219
|
let r = t;
|
|
2109
2220
|
switch (r.type) {
|
|
2110
2221
|
case "space":
|
|
@@ -2136,7 +2247,7 @@ function fn(e, t) {
|
|
|
2136
2247
|
case "list_item": return e`<li>${n(r.tokens)}</li>`;
|
|
2137
2248
|
case "checkbox": return e`<input type="checkbox" disabled ?checked=${r.checked} aria-label="Task completed">`;
|
|
2138
2249
|
case "link": {
|
|
2139
|
-
let t =
|
|
2250
|
+
let t = vn(r.href), i = n(r.tokens);
|
|
2140
2251
|
return t === void 0 ? i : e`<a href=${t} target="_blank" rel="noreferrer noopener">${i}</a>`;
|
|
2141
2252
|
}
|
|
2142
2253
|
case "image": return r.text;
|
|
@@ -2146,22 +2257,21 @@ function fn(e, t) {
|
|
|
2146
2257
|
}
|
|
2147
2258
|
return n(new G({ gfm: !0 }).lex(t));
|
|
2148
2259
|
}
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
function pn(e) {
|
|
2260
|
+
// src/protocol.ts
|
|
2261
|
+
function bn(e) {
|
|
2152
2262
|
return typeof e == "string" && /^[a-z0-9_][a-z0-9_./~^@{}-]{0,255}$/iu.test(e) && !e.includes("..");
|
|
2153
2263
|
}
|
|
2154
|
-
function
|
|
2264
|
+
function xn(e) {
|
|
2155
2265
|
return typeof e == "string" && /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(e);
|
|
2156
2266
|
}
|
|
2157
|
-
function
|
|
2158
|
-
return
|
|
2267
|
+
function Sn(e) {
|
|
2268
|
+
return Dn(e) && bn(e.baseRef) && bn(e.headRef) && (e.mode === "merge-base" || e.mode === "direct") && xn(e.base) && xn(e.head);
|
|
2159
2269
|
}
|
|
2160
|
-
function
|
|
2161
|
-
if (!
|
|
2270
|
+
function Cn(e) {
|
|
2271
|
+
if (!Sn(e)) throw Error("Invalid Git comparison");
|
|
2162
2272
|
return e;
|
|
2163
2273
|
}
|
|
2164
|
-
function
|
|
2274
|
+
function wn(e) {
|
|
2165
2275
|
return e === void 0 ? "" : JSON.stringify([
|
|
2166
2276
|
e.baseRef,
|
|
2167
2277
|
e.headRef,
|
|
@@ -2170,83 +2280,81 @@ function _n(e) {
|
|
|
2170
2280
|
e.head
|
|
2171
2281
|
]);
|
|
2172
2282
|
}
|
|
2173
|
-
function
|
|
2283
|
+
function Tn(e) {
|
|
2174
2284
|
return e === "git-staged" || e === "git-unstaged" || e === "git-compare";
|
|
2175
2285
|
}
|
|
2176
|
-
function
|
|
2286
|
+
function En(e) {
|
|
2177
2287
|
return typeof e == "string" && e.length > 0 && e.length <= 4096 && !/^[a-z]:/iu.test(e) && !e.startsWith("/") && !e.includes("\\") && !/[\u0000-\u001f\u007f]/u.test(e) && e.split("/").every((e) => e !== "" && e !== "." && e !== "..");
|
|
2178
2288
|
}
|
|
2179
|
-
function
|
|
2289
|
+
function Dn(e) {
|
|
2180
2290
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
2181
2291
|
}
|
|
2182
|
-
function
|
|
2183
|
-
if (!Array.isArray(e) || e.length > 2e3 || !e.every(
|
|
2292
|
+
function On(e) {
|
|
2293
|
+
if (!Array.isArray(e) || e.length > 2e3 || !e.every(En)) throw Error("Invalid or oversized Git file list");
|
|
2184
2294
|
return e;
|
|
2185
2295
|
}
|
|
2186
|
-
function
|
|
2296
|
+
function kn(e) {
|
|
2187
2297
|
if (typeof e != "string" || e.length > 2e5) throw Error("Invalid or oversized Git diff");
|
|
2188
2298
|
return e;
|
|
2189
2299
|
}
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
let i = Cn(n), a = wn(n);
|
|
2300
|
+
// node_modules/@noble/hashes/_u64.js
|
|
2301
|
+
var An = (e) => e / 2 ** 32 | 0, jn = (e) => e >>> 0;
|
|
2302
|
+
function Mn(e, t, n, r) {
|
|
2303
|
+
let i = An(n), a = jn(n);
|
|
2195
2304
|
e.setUint32(t, r ? a : i, r), e.setUint32(t + 4, r ? i : a, r);
|
|
2196
2305
|
}
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
function En(e) {
|
|
2306
|
+
// node_modules/@noble/hashes/utils.js
|
|
2307
|
+
function Nn(e) {
|
|
2200
2308
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in e && e.BYTES_PER_ELEMENT === 1;
|
|
2201
2309
|
}
|
|
2202
|
-
var
|
|
2203
|
-
function
|
|
2204
|
-
if (typeof e != "number") throw TypeError(
|
|
2205
|
-
if (!Number.isSafeInteger(e) || e < 0) throw RangeError(
|
|
2310
|
+
var Pn = (e) => e ? `"${e}" ` : "";
|
|
2311
|
+
function Fn(e, t = "") {
|
|
2312
|
+
if (typeof e != "number") throw TypeError(Pn(t) + "expected number, got " + typeof e);
|
|
2313
|
+
if (!Number.isSafeInteger(e) || e < 0) throw RangeError(Pn(t) + "expected integer >= 0, got " + e);
|
|
2206
2314
|
return e;
|
|
2207
2315
|
}
|
|
2208
|
-
function
|
|
2209
|
-
if (
|
|
2210
|
-
t !== void 0 &&
|
|
2211
|
-
let r =
|
|
2316
|
+
function In(e, t, n = "") {
|
|
2317
|
+
if (Nn(e) && (t === void 0 || e.length === t)) return e;
|
|
2318
|
+
t !== void 0 && Fn(t, "length");
|
|
2319
|
+
let r = Nn(e), i = t === void 0 ? "" : ` of length ${t}`, a = r ? `length=${e.length}` : `type=${typeof e}`, o = Pn(n) + "expected Uint8Array" + i + ", got " + a;
|
|
2212
2320
|
throw r ? RangeError(o) : TypeError(o);
|
|
2213
2321
|
}
|
|
2214
|
-
var
|
|
2322
|
+
var Ln = (e, t) => {
|
|
2215
2323
|
if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError((t === "object" ? "" : `"${t}" `) + "expected object, got type=" + typeof e);
|
|
2216
|
-
},
|
|
2217
|
-
|
|
2324
|
+
}, Rn = (e, t) => {
|
|
2325
|
+
Ln(e, t);
|
|
2218
2326
|
let n = Object.getPrototypeOf(e);
|
|
2219
2327
|
if (n !== Object.prototype && n !== null) throw TypeError(`"${t}" expected plain object`);
|
|
2220
2328
|
if (Object.hasOwn(e, "__proto__")) throw TypeError(`"${t}.__proto__" is not allowed`);
|
|
2221
2329
|
};
|
|
2222
|
-
function
|
|
2330
|
+
function zn(e, t = !0) {
|
|
2223
2331
|
if (e.destroyed) throw Error("hash was destroyed");
|
|
2224
2332
|
if (t && e.finished) throw Error("digest() was already called");
|
|
2225
2333
|
}
|
|
2226
|
-
function
|
|
2227
|
-
|
|
2334
|
+
function Bn(e, t) {
|
|
2335
|
+
In(e, void 0, "output");
|
|
2228
2336
|
let n = t.outputLen;
|
|
2229
2337
|
if (!(e.length >= n)) throw RangeError("\"output\" expected length >= " + n);
|
|
2230
2338
|
}
|
|
2231
|
-
function
|
|
2339
|
+
function Vn(...e) {
|
|
2232
2340
|
for (let t = 0; t < e.length; t++) e[t].fill(0);
|
|
2233
2341
|
}
|
|
2234
|
-
function
|
|
2342
|
+
function Hn(e) {
|
|
2235
2343
|
return new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
2236
2344
|
}
|
|
2237
2345
|
function Z(e, t) {
|
|
2238
2346
|
return e << 32 - t | e >>> t;
|
|
2239
2347
|
}
|
|
2240
|
-
function
|
|
2241
|
-
return
|
|
2348
|
+
function Un(e, t, n = "opts") {
|
|
2349
|
+
return Rn(e, "defaults"), t !== void 0 && Rn(t, n), Object.assign(Object.create(null), e, t);
|
|
2242
2350
|
}
|
|
2243
|
-
function
|
|
2351
|
+
function Wn(e, t = {}) {
|
|
2244
2352
|
if (typeof e != "function") throw TypeError("\"hashCons\" expected function, got type=" + typeof e);
|
|
2245
|
-
t =
|
|
2353
|
+
t = Un({}, t, "info");
|
|
2246
2354
|
let n = (t, n) => e(n).update(t).digest(), r = e(void 0);
|
|
2247
2355
|
return n.outputLen = r.outputLen, n.blockLen = r.blockLen, n.canXOF = r.canXOF, n.create = (t) => e(t), Object.assign(n, t), Object.freeze(n);
|
|
2248
2356
|
}
|
|
2249
|
-
var
|
|
2357
|
+
var Gn = (e) => ({ oid: Uint8Array.from([
|
|
2250
2358
|
6,
|
|
2251
2359
|
9,
|
|
2252
2360
|
96,
|
|
@@ -2259,15 +2367,14 @@ var Rn = (e) => ({ oid: Uint8Array.from([
|
|
|
2259
2367
|
2,
|
|
2260
2368
|
e
|
|
2261
2369
|
]) });
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
function zn(e, t, n) {
|
|
2370
|
+
// node_modules/@noble/hashes/_md.js
|
|
2371
|
+
function Kn(e, t, n) {
|
|
2265
2372
|
return e & t ^ ~e & n;
|
|
2266
2373
|
}
|
|
2267
|
-
function
|
|
2374
|
+
function qn(e, t, n) {
|
|
2268
2375
|
return e & t ^ e & n ^ t & n;
|
|
2269
2376
|
}
|
|
2270
|
-
var
|
|
2377
|
+
var Jn = class {
|
|
2271
2378
|
blockLen;
|
|
2272
2379
|
outputLen;
|
|
2273
2380
|
canXOF = !1;
|
|
@@ -2280,28 +2387,26 @@ var Vn = class {
|
|
|
2280
2387
|
pos = 0;
|
|
2281
2388
|
destroyed = !1;
|
|
2282
2389
|
constructor(e, t, n, r) {
|
|
2283
|
-
this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = r, this.buffer = new Uint8Array(e), this.view =
|
|
2390
|
+
this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = r, this.buffer = new Uint8Array(e), this.view = Hn(this.buffer);
|
|
2284
2391
|
}
|
|
2285
2392
|
update(e) {
|
|
2286
|
-
|
|
2393
|
+
zn(this), In(e);
|
|
2287
2394
|
let { view: t, buffer: n, blockLen: r } = this, i = e.length, a = !1;
|
|
2288
2395
|
for (let o = 0; o < i;) {
|
|
2289
2396
|
let s = Math.min(r - this.pos, i - o);
|
|
2290
2397
|
if (s === r) {
|
|
2291
|
-
let t =
|
|
2398
|
+
let t = Hn(e);
|
|
2292
2399
|
for (; r <= i - o; o += r) this.process(t, o);
|
|
2293
2400
|
a = !0;
|
|
2294
|
-
|
|
2295
|
-
}
|
|
2296
|
-
n.set(o === 0 && s === i ? e : e.subarray(o, o + s), this.pos), this.pos += s, o += s, this.pos === r && (this.process(t, 0), this.pos = 0, a = !0);
|
|
2401
|
+
} else n.set(o === 0 && s === i ? e : e.subarray(o, o + s), this.pos), this.pos += s, o += s, this.pos === r && (this.process(t, 0), this.pos = 0, a = !0);
|
|
2297
2402
|
}
|
|
2298
2403
|
return this.length += e.length, a && this.roundClean(), this;
|
|
2299
2404
|
}
|
|
2300
2405
|
digestInto(e) {
|
|
2301
|
-
|
|
2406
|
+
zn(this), Bn(e, this), this.finished = !0;
|
|
2302
2407
|
let { buffer: t, view: n, blockLen: r, isLE: i } = this, { pos: a } = this;
|
|
2303
|
-
t[a++] = 128, t.fill(0, a), this.padOffset > r - a && (this.process(n, 0), t.fill(0)),
|
|
2304
|
-
let o = e === t ? n :
|
|
2408
|
+
t[a++] = 128, t.fill(0, a), this.padOffset > r - a && (this.process(n, 0), t.fill(0)), Mn(n, r - 8, this.length * 8, i), this.process(n, 0), this.roundClean();
|
|
2409
|
+
let o = e === t ? n : Hn(e), s = this.outputLen, c = s / 4, l = this.get();
|
|
2305
2410
|
if (s % 4 || c > l.length) throw Error("invalid outputLen");
|
|
2306
2411
|
for (let e = 0; e < c; e++) o.setUint32(4 * e, l[e], i);
|
|
2307
2412
|
}
|
|
@@ -2318,7 +2423,7 @@ var Vn = class {
|
|
|
2318
2423
|
clone() {
|
|
2319
2424
|
return this._cloneInto();
|
|
2320
2425
|
}
|
|
2321
|
-
},
|
|
2426
|
+
}, Yn = /* @__PURE__ */ Uint32Array.from([
|
|
2322
2427
|
1779033703,
|
|
2323
2428
|
3144134277,
|
|
2324
2429
|
1013904242,
|
|
@@ -2327,7 +2432,7 @@ var Vn = class {
|
|
|
2327
2432
|
2600822924,
|
|
2328
2433
|
528734635,
|
|
2329
2434
|
1541459225
|
|
2330
|
-
]),
|
|
2435
|
+
]), Xn = /* @__PURE__ */ Uint32Array.from([
|
|
2331
2436
|
1116352408,
|
|
2332
2437
|
1899447441,
|
|
2333
2438
|
3049323471,
|
|
@@ -2392,7 +2497,7 @@ var Vn = class {
|
|
|
2392
2497
|
2756734187,
|
|
2393
2498
|
3204031479,
|
|
2394
2499
|
3329325298
|
|
2395
|
-
]), Q = /* @__PURE__ */ new Uint32Array(64),
|
|
2500
|
+
]), Q = /* @__PURE__ */ new Uint32Array(64), Zn = class extends Jn {
|
|
2396
2501
|
A = 0;
|
|
2397
2502
|
B = 0;
|
|
2398
2503
|
C = 0;
|
|
@@ -2431,22 +2536,22 @@ var Vn = class {
|
|
|
2431
2536
|
}
|
|
2432
2537
|
let { A: n, B: r, C: i, D: a, E: o, F: s, G: c, H: l } = this;
|
|
2433
2538
|
for (let e = 0; e < 64; e++) {
|
|
2434
|
-
let t = Z(o, 6) ^ Z(o, 11) ^ Z(o, 25), u = l + t +
|
|
2539
|
+
let t = Z(o, 6) ^ Z(o, 11) ^ Z(o, 25), u = l + t + Kn(o, s, c) + Xn[e] + Q[e] | 0, d = (Z(n, 2) ^ Z(n, 13) ^ Z(n, 22)) + qn(n, r, i) | 0;
|
|
2435
2540
|
l = c, c = s, s = o, o = a + u | 0, a = i, i = r, r = n, n = u + d | 0;
|
|
2436
2541
|
}
|
|
2437
2542
|
n = n + this.A | 0, r = r + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, o = o + this.E | 0, s = s + this.F | 0, c = c + this.G | 0, l = l + this.H | 0, this.set(n, r, i, a, o, s, c, l);
|
|
2438
2543
|
}
|
|
2439
2544
|
roundClean() {
|
|
2440
|
-
|
|
2545
|
+
Vn(Q);
|
|
2441
2546
|
}
|
|
2442
2547
|
destroy() {
|
|
2443
|
-
this.destroyed = !0, this.set(0, 0, 0, 0, 0, 0, 0, 0),
|
|
2548
|
+
this.destroyed = !0, this.set(0, 0, 0, 0, 0, 0, 0, 0), Vn(this.buffer);
|
|
2444
2549
|
}
|
|
2445
|
-
},
|
|
2550
|
+
}, Qn = class extends Zn {
|
|
2446
2551
|
constructor() {
|
|
2447
|
-
super(32,
|
|
2552
|
+
super(32, Yn);
|
|
2448
2553
|
}
|
|
2449
|
-
},
|
|
2554
|
+
}, $n = /* @__PURE__ */ Wn(() => new Qn(), /* @__PURE__ */ Gn(1)), er = "pi-web-code-review:v1:";
|
|
2450
2555
|
function $(e) {
|
|
2451
2556
|
return JSON.stringify([
|
|
2452
2557
|
e.machine.id,
|
|
@@ -2454,13 +2559,13 @@ function $(e) {
|
|
|
2454
2559
|
e.workspace.id
|
|
2455
2560
|
]);
|
|
2456
2561
|
}
|
|
2457
|
-
function
|
|
2458
|
-
return
|
|
2562
|
+
function tr(e) {
|
|
2563
|
+
return En(e.path) && (e.source === "files" || Tn(e.source)) && (e.source === "git-compare" ? Sn(e.comparison) : e.comparison === void 0) && (e.side === "new" || e.source !== "files") && Number.isSafeInteger(e.start) && Number.isSafeInteger(e.end) && e.start > 0 && e.end >= e.start;
|
|
2459
2564
|
}
|
|
2460
|
-
function
|
|
2461
|
-
if (!
|
|
2565
|
+
function nr(e) {
|
|
2566
|
+
if (!Dn(e)) return !1;
|
|
2462
2567
|
let { path: t, source: n, side: r, start: i, end: a, id: o, body: s, hash: c, createdAt: l, comparison: u } = e;
|
|
2463
|
-
return u !== void 0 && !
|
|
2568
|
+
return u !== void 0 && !Sn(u) ? !1 : typeof t == "string" && (n === "files" || Tn(n)) && (r === "old" || r === "new") && typeof i == "number" && typeof a == "number" && tr({
|
|
2464
2569
|
path: t,
|
|
2465
2570
|
source: n,
|
|
2466
2571
|
side: r,
|
|
@@ -2469,7 +2574,7 @@ function Yn(e) {
|
|
|
2469
2574
|
...u === void 0 ? {} : { comparison: u }
|
|
2470
2575
|
}) && typeof o == "string" && o !== "" && typeof s == "string" && s.trim() !== "" && typeof c == "string" && /^[a-f0-9]{64}$/u.test(c) && typeof l == "number" && Number.isFinite(l);
|
|
2471
2576
|
}
|
|
2472
|
-
var
|
|
2577
|
+
var rr = class {
|
|
2473
2578
|
storage;
|
|
2474
2579
|
legacy;
|
|
2475
2580
|
constructor(e, t) {
|
|
@@ -2479,15 +2584,15 @@ var Xn = class {
|
|
|
2479
2584
|
return this.storage.transact(e, (n) => {
|
|
2480
2585
|
let r = n;
|
|
2481
2586
|
if (r === void 0) {
|
|
2482
|
-
let t = this.legacy.getItem(
|
|
2587
|
+
let t = this.legacy.getItem(er + e);
|
|
2483
2588
|
r = t === null ? {
|
|
2484
2589
|
version: 1,
|
|
2485
2590
|
comments: []
|
|
2486
2591
|
} : JSON.parse(t);
|
|
2487
2592
|
}
|
|
2488
|
-
if (!
|
|
2593
|
+
if (!Dn(r) || r.version !== 1 || !Array.isArray(r.comments)) throw Error("Unrecognized review storage; existing data was retained");
|
|
2489
2594
|
let i = r.comments;
|
|
2490
|
-
if (!i.every(
|
|
2595
|
+
if (!i.every(nr) || new Set(i.map((e) => e.id)).size !== i.length) throw Error("Invalid review storage; existing data was retained");
|
|
2491
2596
|
let a = t(i);
|
|
2492
2597
|
return {
|
|
2493
2598
|
value: {
|
|
@@ -2503,14 +2608,14 @@ var Xn = class {
|
|
|
2503
2608
|
}
|
|
2504
2609
|
add(e, t) {
|
|
2505
2610
|
return this.change(e, (e) => {
|
|
2506
|
-
if (!
|
|
2611
|
+
if (!nr(t)) throw Error("Invalid review comment");
|
|
2507
2612
|
if (e.some((e) => e.id === t.id)) throw Error("Duplicate review comment");
|
|
2508
2613
|
return [...e, t];
|
|
2509
2614
|
});
|
|
2510
2615
|
}
|
|
2511
2616
|
update(e, t) {
|
|
2512
2617
|
return this.change(e, (e) => {
|
|
2513
|
-
if (!
|
|
2618
|
+
if (!nr(t)) throw Error("Invalid review comment");
|
|
2514
2619
|
if (!e.some((e) => e.id === t.id)) throw Error("This comment was removed in another tab");
|
|
2515
2620
|
return e.map((e) => e.id === t.id ? t : e);
|
|
2516
2621
|
});
|
|
@@ -2519,11 +2624,11 @@ var Xn = class {
|
|
|
2519
2624
|
return this.change(e, (e) => e.filter((e) => e.id !== t));
|
|
2520
2625
|
}
|
|
2521
2626
|
removeUnchanged(e, t, n = () => !0) {
|
|
2522
|
-
let r = new Map(t.map((e) => [e.id,
|
|
2523
|
-
return this.change(e, (e) => n() ? e.filter((e) => r.get(e.id) !==
|
|
2627
|
+
let r = new Map(t.map((e) => [e.id, ir(e)]));
|
|
2628
|
+
return this.change(e, (e) => n() ? e.filter((e) => r.get(e.id) !== ir(e)) : e);
|
|
2524
2629
|
}
|
|
2525
2630
|
};
|
|
2526
|
-
function
|
|
2631
|
+
function ir(e) {
|
|
2527
2632
|
return JSON.stringify([
|
|
2528
2633
|
e.id,
|
|
2529
2634
|
e.path,
|
|
@@ -2534,29 +2639,29 @@ function Zn(e) {
|
|
|
2534
2639
|
e.body,
|
|
2535
2640
|
e.hash,
|
|
2536
2641
|
e.createdAt,
|
|
2537
|
-
|
|
2642
|
+
wn(e.comparison)
|
|
2538
2643
|
]);
|
|
2539
2644
|
}
|
|
2540
|
-
function
|
|
2645
|
+
function ar(e, t) {
|
|
2541
2646
|
return e === "files" ? "File" : e === "git-staged" ? "Git staged" : e === "git-unstaged" ? "Git unstaged" : t === void 0 ? "Git comparison" : `Git ${`${t.baseRef}${t.mode === "merge-base" ? "..." : ".."}${t.headRef}`} (${t.base.slice(0, 12)}..${t.head.slice(0, 12)})`;
|
|
2542
2647
|
}
|
|
2543
|
-
function
|
|
2544
|
-
return `${e.path}:${String(e.start)}${e.end === e.start ? "" : `-${String(e.end)}`} (${
|
|
2648
|
+
function or(e) {
|
|
2649
|
+
return `${e.path}:${String(e.start)}${e.end === e.start ? "" : `-${String(e.end)}`} (${ar(e.source, e.comparison)}${e.side === "old" ? ", deleted" : ""})`;
|
|
2545
2650
|
}
|
|
2546
|
-
function
|
|
2651
|
+
function sr(e) {
|
|
2547
2652
|
if (e.length === 0) return "";
|
|
2548
2653
|
let t = [...e].sort((e, t) => e.path < t.path ? -1 : e.path > t.path ? 1 : e.start - t.start || e.createdAt - t.createdAt);
|
|
2549
2654
|
return [`### Code review comments (${String(t.length)})`, ...t.map((e, t) => {
|
|
2550
2655
|
let n = `C${String(t + 1)}`;
|
|
2551
|
-
return `---\n\n#### ${n}: ${
|
|
2656
|
+
return `---\n\n#### ${n}: ${or(e).replace(/[\\`*_{}[\]<>()#!|]/gu, "\\$&")}\n\n${e.body.trim()}\n\n*-- end of ${n} --*`;
|
|
2552
2657
|
})].join("\n\n");
|
|
2553
2658
|
}
|
|
2554
|
-
function
|
|
2659
|
+
function cr() {
|
|
2555
2660
|
return [...crypto.getRandomValues(/* @__PURE__ */ new Uint32Array(4))].map((e) => e.toString(16).padStart(8, "0")).join("");
|
|
2556
2661
|
}
|
|
2557
|
-
function
|
|
2558
|
-
if (t === "git-compare" ? !
|
|
2559
|
-
let i = r === void 0 ? {} : { comparison: r }, a = [
|
|
2662
|
+
function lr(e, t, n, r) {
|
|
2663
|
+
if (t === "git-compare" ? !Sn(r) : r !== void 0) throw Error("Invalid snapshot comparison");
|
|
2664
|
+
let i = r === void 0 ? {} : { comparison: r }, a = [...$n(new TextEncoder().encode(r === void 0 ? n : `${wn(r)}\n${n}`))].map((e) => e.toString(16).padStart(2, "0")).join(""), o = n.replaceAll("\r\n", "\n").split("\n");
|
|
2560
2665
|
if (o.at(-1) === "" && o.pop(), o.length > 5e3) throw Error("Source has too many lines to review inline (limit: 5,000)");
|
|
2561
2666
|
if (t === "files") return {
|
|
2562
2667
|
path: e,
|
|
@@ -2606,16 +2711,15 @@ function nr(e, t, n, r) {
|
|
|
2606
2711
|
rows: d
|
|
2607
2712
|
};
|
|
2608
2713
|
}
|
|
2609
|
-
function
|
|
2610
|
-
if (!
|
|
2714
|
+
function ur(e, t) {
|
|
2715
|
+
if (!tr(e) || e.path !== t.path || e.source !== t.source || wn(e.comparison) !== wn(t.comparison)) return !1;
|
|
2611
2716
|
let n = new Set(t.rows.filter((t) => t.side === e.side).map((e) => e.line));
|
|
2612
2717
|
if (e.end - e.start >= n.size) return !1;
|
|
2613
2718
|
for (let t = e.start; t <= e.end; t++) if (!n.has(t)) return !1;
|
|
2614
2719
|
return !0;
|
|
2615
2720
|
}
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
function ir(e) {
|
|
2721
|
+
// src/browser/panel.ts
|
|
2722
|
+
function dr(e) {
|
|
2619
2723
|
let t = e.state?.selectedSession;
|
|
2620
2724
|
return JSON.stringify([
|
|
2621
2725
|
$(e),
|
|
@@ -2627,7 +2731,7 @@ function ir(e) {
|
|
|
2627
2731
|
t?.archived
|
|
2628
2732
|
]);
|
|
2629
2733
|
}
|
|
2630
|
-
var
|
|
2734
|
+
var fr = class extends j {
|
|
2631
2735
|
static properties = {
|
|
2632
2736
|
context: { attribute: !1 },
|
|
2633
2737
|
revision: { type: Number }
|
|
@@ -2635,6 +2739,10 @@ var ar = class extends A {
|
|
|
2635
2739
|
chips;
|
|
2636
2740
|
store;
|
|
2637
2741
|
lifetime;
|
|
2742
|
+
preferences = ze();
|
|
2743
|
+
settingsLayout = this.preferences.layout;
|
|
2744
|
+
dialogKind;
|
|
2745
|
+
preferenceError = "";
|
|
2638
2746
|
source = "files";
|
|
2639
2747
|
baseRef = "main";
|
|
2640
2748
|
headRef = "HEAD";
|
|
@@ -2668,7 +2776,7 @@ var ar = class extends A {
|
|
|
2668
2776
|
super.connectedCallback(), this.connection++, this.loadComments(), this.refresh();
|
|
2669
2777
|
}
|
|
2670
2778
|
disconnectedCallback() {
|
|
2671
|
-
this.connection++, this.feedbackRead++, this.listing?.abort(), this.reading?.abort(), this.comparing?.abort(), super.disconnectedCallback();
|
|
2779
|
+
this.connection++, this.feedbackRead++, this.closeDialog(), this.listing?.abort(), this.reading?.abort(), this.comparing?.abort(), super.disconnectedCallback();
|
|
2672
2780
|
}
|
|
2673
2781
|
updated(e) {
|
|
2674
2782
|
if (e.has("revision") && e.get("revision") !== void 0 && this.refresh(), this.focusEditor) {
|
|
@@ -2677,7 +2785,7 @@ var ar = class extends A {
|
|
|
2677
2785
|
}
|
|
2678
2786
|
}
|
|
2679
2787
|
updateContext(e) {
|
|
2680
|
-
let t =
|
|
2788
|
+
let t = dr(e);
|
|
2681
2789
|
t !== this.selection && (this.selection = t, this.selectionRevision++), this.context = e;
|
|
2682
2790
|
}
|
|
2683
2791
|
refreshFeedback(e) {
|
|
@@ -2725,7 +2833,7 @@ var ar = class extends A {
|
|
|
2725
2833
|
try {
|
|
2726
2834
|
let e = this.context.peer;
|
|
2727
2835
|
if (e?.request === void 0) throw Error("Git review backend unavailable");
|
|
2728
|
-
let n =
|
|
2836
|
+
let n = Cn(await e.request("compare", {
|
|
2729
2837
|
source: "git-compare",
|
|
2730
2838
|
baseRef: this.baseRef.trim(),
|
|
2731
2839
|
headRef: this.headRef.trim(),
|
|
@@ -2758,11 +2866,11 @@ var ar = class extends A {
|
|
|
2758
2866
|
if (this.source === "files") {
|
|
2759
2867
|
let n = this.context.files.capabilityVersion === 1 ? await this.context.files.listFiles(this.directory, { signal: t }) : await this.context.files.listFiles(this.directory);
|
|
2760
2868
|
if (n.truncated || n.entries.length > 2e3) throw Error("Directory is too large; enter a narrower directory");
|
|
2761
|
-
e = n.entries.filter((e) =>
|
|
2869
|
+
e = n.entries.filter((e) => En(e.path));
|
|
2762
2870
|
} else {
|
|
2763
2871
|
let n = this.context.peer;
|
|
2764
2872
|
if (n?.request === void 0) throw Error("Git review backend is unavailable. Enable the plugin on this machine and restart its session daemon");
|
|
2765
|
-
e =
|
|
2873
|
+
e = On(await n.request("changes", {
|
|
2766
2874
|
source: this.source,
|
|
2767
2875
|
...this.comparison === void 0 ? {} : { comparison: { ...this.comparison } }
|
|
2768
2876
|
}, { signal: t })).map((e) => ({
|
|
@@ -2786,7 +2894,7 @@ var ar = class extends A {
|
|
|
2786
2894
|
let n = this.signal(t), r = this.source, i = this.comparison;
|
|
2787
2895
|
this.viewLoading = !0, this.error = "", this.requestUpdate();
|
|
2788
2896
|
try {
|
|
2789
|
-
if (!
|
|
2897
|
+
if (!En(e)) throw Error("Enter a workspace-relative file path");
|
|
2790
2898
|
let t;
|
|
2791
2899
|
if (r === "files") {
|
|
2792
2900
|
let r = this.context.files.capabilityVersion === 1 ? await this.context.files.readFile(e, { signal: n }) : await this.context.files.readFile(e);
|
|
@@ -2795,13 +2903,13 @@ var ar = class extends A {
|
|
|
2795
2903
|
} else {
|
|
2796
2904
|
let a = this.context.peer;
|
|
2797
2905
|
if (a?.request === void 0) throw Error("Git review backend unavailable");
|
|
2798
|
-
t =
|
|
2906
|
+
t = kn(await a.request("diff", {
|
|
2799
2907
|
source: r,
|
|
2800
2908
|
path: e,
|
|
2801
2909
|
...i === void 0 ? {} : { comparison: { ...i } }
|
|
2802
2910
|
}, { signal: n }));
|
|
2803
2911
|
}
|
|
2804
|
-
let a =
|
|
2912
|
+
let a = lr(e, r, t, i);
|
|
2805
2913
|
if (n.aborted) return;
|
|
2806
2914
|
this.view = a, this.editor !== void 0 && (this.focusEditor = !0), this.editor !== void 0 && (this.editor.path !== e || this.editor.source !== r || this.editor.hash !== a.hash) && (this.notice = "The source changed. Your unfinished comment remains in the draft editor, but cannot be saved against this snapshot. Copy its text before cancelling.");
|
|
2807
2915
|
} catch (e) {
|
|
@@ -2811,7 +2919,7 @@ var ar = class extends A {
|
|
|
2811
2919
|
}
|
|
2812
2920
|
}
|
|
2813
2921
|
selectSource(e) {
|
|
2814
|
-
(e === "files" ||
|
|
2922
|
+
(e === "files" || Tn(e)) && (this.comparing?.abort(), this.comparing = void 0, this.listing?.abort(), this.listLoading = !1, this.source = e, this.comparison = void 0, this.view = void 0, this.entries = [], this.reading?.abort(), this.reading = void 0, this.viewLoading = !1, e === "git-compare" ? this.applyComparison() : this.loadList());
|
|
2815
2923
|
}
|
|
2816
2924
|
selectLine(e, t) {
|
|
2817
2925
|
let n = this.view;
|
|
@@ -2832,13 +2940,13 @@ var ar = class extends A {
|
|
|
2832
2940
|
}
|
|
2833
2941
|
async saveEditor() {
|
|
2834
2942
|
let e = this.editor;
|
|
2835
|
-
if (this.saving || e === void 0 || e.body.trim() === "" || this.viewLoading || e.hash !== this.view?.hash || !
|
|
2943
|
+
if (this.saving || e === void 0 || e.body.trim() === "" || this.viewLoading || e.hash !== this.view?.hash || !ur(e, this.view)) return;
|
|
2836
2944
|
let t = this.context, n = $(t), r = this.connection;
|
|
2837
2945
|
this.saving = !0, this.feedbackRead++, this.requestUpdate();
|
|
2838
2946
|
try {
|
|
2839
2947
|
let i = {
|
|
2840
2948
|
...e,
|
|
2841
|
-
id: e.id ??
|
|
2949
|
+
id: e.id ?? cr(),
|
|
2842
2950
|
createdAt: e.createdAt ?? Date.now()
|
|
2843
2951
|
}, a = this.requireStore();
|
|
2844
2952
|
if (this.requireChips().withdrawWorkspace(n), await (e.id === void 0 ? a.add(n, i) : a.update(n, i)), this.editor === e && (this.editor = void 0), r !== this.connection || !this.isConnected || this.lifetime?.aborted === !0) return;
|
|
@@ -2863,17 +2971,11 @@ var ar = class extends A {
|
|
|
2863
2971
|
}
|
|
2864
2972
|
}
|
|
2865
2973
|
editComment(e) {
|
|
2866
|
-
|
|
2867
|
-
if (this.editor !== void 0) {
|
|
2868
|
-
this.notice = "Save or cancel the current comment first.", this.requestUpdate();
|
|
2869
|
-
return;
|
|
2870
|
-
}
|
|
2871
|
-
this.editor = { ...e }, this.focusEditor = !0, this.comparing?.abort(), this.comparing = void 0, this.source = e.source, this.comparison = e.comparison, this.view = void 0, this.entries = [], e.comparison !== void 0 && (this.baseRef = e.comparison.baseRef, this.headRef = e.comparison.headRef, this.comparisonMode = e.comparison.mode), this.loadList(), this.openFile(e.path);
|
|
2872
|
-
}
|
|
2974
|
+
this.saving || (this.editor === void 0 ? (this.editor = { ...e }, this.focusEditor = !0, this.comparing?.abort(), this.comparing = void 0, this.source = e.source, this.comparison = e.comparison, this.view = void 0, this.entries = [], e.comparison !== void 0 && (this.baseRef = e.comparison.baseRef, this.headRef = e.comparison.headRef, this.comparisonMode = e.comparison.mode), this.loadList(), this.openFile(e.path)) : (this.notice = "Save or cancel the current comment first.", this.requestUpdate()));
|
|
2873
2975
|
}
|
|
2874
2976
|
async attachReview() {
|
|
2875
2977
|
if (this.saving) return;
|
|
2876
|
-
let e = this.context, t = this.connection, n =
|
|
2978
|
+
let e = this.context, t = this.connection, n = dr(e), r = this.selectionRevision, i = () => this.isConnected && this.connection === t && this.selectionRevision === r && dr(this.context) === n && !this.saving && this.lifetime?.aborted !== !0;
|
|
2877
2979
|
try {
|
|
2878
2980
|
await this.requireChips().attach(e, i);
|
|
2879
2981
|
} catch (e) {
|
|
@@ -2886,58 +2988,142 @@ var ar = class extends A {
|
|
|
2886
2988
|
[e]: e === "body" ? t.target.value : Number(t.target.value)
|
|
2887
2989
|
}, this.requestUpdate());
|
|
2888
2990
|
}
|
|
2991
|
+
openDialog(e) {
|
|
2992
|
+
this.dialogKind = e, this.settingsLayout = this.preferences.layout, this.requestUpdate(), this.updateComplete.then(() => {
|
|
2993
|
+
if (!this.isConnected || this.dialogKind !== e) return;
|
|
2994
|
+
let t = this.renderRoot.querySelector("dialog");
|
|
2995
|
+
t !== null && !t.open && t.showModal();
|
|
2996
|
+
});
|
|
2997
|
+
}
|
|
2998
|
+
closeDialog() {
|
|
2999
|
+
this.renderRoot.querySelector("dialog")?.close(), this.dialogKind = void 0, this.requestUpdate();
|
|
3000
|
+
}
|
|
3001
|
+
setPreferences(e) {
|
|
3002
|
+
this.preferences = e;
|
|
3003
|
+
try {
|
|
3004
|
+
Be(e), this.preferenceError = "";
|
|
3005
|
+
} catch {
|
|
3006
|
+
this.preferenceError = "Review settings could not be saved in this browser. Your choice applies for this panel only.";
|
|
3007
|
+
}
|
|
3008
|
+
this.requestUpdate();
|
|
3009
|
+
}
|
|
3010
|
+
stepFile(e) {
|
|
3011
|
+
let t = this.entries.filter((e) => e.type === "file"), n = t[t.findIndex((e) => e.path === this.view?.path) + e];
|
|
3012
|
+
n !== void 0 && this.openFile(n.path);
|
|
3013
|
+
}
|
|
2889
3014
|
renderEditor() {
|
|
2890
3015
|
let e = this.editor;
|
|
2891
3016
|
if (e === void 0) return null;
|
|
2892
|
-
let t = !this.viewLoading && e.hash === this.view?.hash &&
|
|
2893
|
-
return
|
|
2894
|
-
<strong>${
|
|
2895
|
-
|
|
2896
|
-
this.changeEditor("start", e);
|
|
2897
|
-
}}></label>
|
|
2898
|
-
<label>End line <input ?disabled=${this.saving} type="number" min="1" step="1" .value=${String(e.end)} @input=${(e) => {
|
|
2899
|
-
this.changeEditor("end", e);
|
|
2900
|
-
}}></label></div>
|
|
2901
|
-
${t ? null : T`<p role="alert">Choose a valid range in the current snapshot on one side. Omitted diff lines cannot be selected. Changed snapshots cannot be re-anchored automatically.</p>`}
|
|
3017
|
+
let t = !this.viewLoading && e.hash === this.view?.hash && ur(e, this.view);
|
|
3018
|
+
return E`<section class="editor" aria-label="Comment editor">
|
|
3019
|
+
<strong>${or(e)} · ${e.id === void 0 ? "Unsaved draft" : "Unsaved edit"}</strong>
|
|
3020
|
+
${t ? null : E`<p role="alert">Choose a valid range in the current snapshot on one side. Omitted diff lines cannot be selected. Changed snapshots cannot be re-anchored automatically.</p>`}
|
|
2902
3021
|
<label>Comment (Markdown)<textarea ?disabled=${this.saving} rows="4" .value=${e.body} @input=${(e) => {
|
|
2903
3022
|
this.changeEditor("body", e);
|
|
2904
3023
|
}} @keydown=${(e) => {
|
|
2905
3024
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && !e.isComposing && (e.preventDefault(), this.saveEditor());
|
|
2906
3025
|
}}></textarea></label>
|
|
2907
|
-
<
|
|
3026
|
+
<details class="range"><summary>Line range · ${e.start}–${e.end}</summary>
|
|
3027
|
+
<div class="toolbar"><label>Start line <input ?disabled=${this.saving} type="number" min="1" step="1" .value=${String(e.start)} @input=${(e) => {
|
|
3028
|
+
this.changeEditor("start", e);
|
|
3029
|
+
}}></label>
|
|
3030
|
+
<label>End line <input ?disabled=${this.saving} type="number" min="1" step="1" .value=${String(e.end)} @input=${(e) => {
|
|
3031
|
+
this.changeEditor("end", e);
|
|
3032
|
+
}}></label></div>
|
|
3033
|
+
</details>
|
|
3034
|
+
<div class="toolbar"><button class="ui-button primary" ?disabled=${this.saving || !t || e.body.trim() === ""} @click=${() => {
|
|
2908
3035
|
this.saveEditor();
|
|
2909
3036
|
}}>Save comment</button>
|
|
2910
|
-
<button ?disabled=${this.saving} @click=${() => {
|
|
3037
|
+
<button class="ui-button" ?disabled=${this.saving} @click=${() => {
|
|
2911
3038
|
this.editor = void 0, this.notice = "", this.requestUpdate();
|
|
2912
3039
|
}}>Cancel edit</button><span class="hint">Ctrl / ⌘ + Enter to save</span></div>
|
|
2913
3040
|
</section>`;
|
|
3041
|
+
}
|
|
3042
|
+
renderFiles() {
|
|
3043
|
+
return E`<details class="file-list ui-file-list" open><summary>${this.source === "files" ? this.directory || "Workspace files" : `${ar(this.source, this.comparison)} files`}</summary>
|
|
3044
|
+
${this.source === "files" && this.directory !== "" ? E`<button class="ui-button" @click=${() => {
|
|
3045
|
+
this.directory = this.directory.split("/").slice(0, -1).join("/"), this.loadList();
|
|
3046
|
+
}}>Parent directory</button>` : null}
|
|
3047
|
+
${this.entries.map((e) => E`<button class="ui-button ui-file-row" title=${e.path} aria-current=${e.path === this.view?.path ? "page" : "false"} ?disabled=${this.listLoading} @click=${() => {
|
|
3048
|
+
e.type === "directory" ? (this.directory = e.path, this.loadList()) : (this.closeDialog(), this.openFile(e.path));
|
|
3049
|
+
}}><span class="file-label ui-file-label">${e.type === "directory" ? "📁 " : ""}${e.name}</span></button>`)}
|
|
3050
|
+
${!this.listLoading && this.comparing === void 0 && this.entries.length === 0 ? E`<p class="hint">No files in this view.</p>` : null}
|
|
3051
|
+
</details>`;
|
|
3052
|
+
}
|
|
3053
|
+
renderSaved() {
|
|
3054
|
+
return E`<p class="hint">Saved locally · not sent. Only saved comments attach. Send from the conversation.</p>
|
|
3055
|
+
${this.editor === void 0 ? null : E`<p class="hint draft-count">1 unsaved draft · ${or(this.editor)}</p>`}
|
|
3056
|
+
${this.comments.length === 0 ? E`<p class="hint">No comments yet. Select a line number to add one.</p>` : null}
|
|
3057
|
+
${this.comments.map((e) => E`<article><strong>${or(e)}</strong>
|
|
3058
|
+
${e.path === this.view?.path && e.source === this.view.source && e.hash !== this.view.hash ? E`<p class="stale">Source changed since this comment was saved. Verify its coordinates before sending.</p>` : null}
|
|
3059
|
+
<div class="markdown">${yn(E, e.body)}</div>
|
|
3060
|
+
<div class="toolbar"><button class="ui-button" ?disabled=${this.saving} @click=${() => {
|
|
3061
|
+
this.closeDialog(), this.editComment(e);
|
|
3062
|
+
}}>Edit comment</button><button class="ui-button" ?disabled=${this.saving} @click=${() => {
|
|
3063
|
+
this.removeComment(e);
|
|
3064
|
+
}}>Remove comment</button></div>
|
|
3065
|
+
</article>`)}
|
|
3066
|
+
<details class="markdown-export"><summary>Feedback Markdown</summary><textarea aria-label="Feedback Markdown" readonly rows="8" .value=${sr(this.comments)}></textarea></details>`;
|
|
3067
|
+
}
|
|
3068
|
+
renderDialog() {
|
|
3069
|
+
return E`<dialog class=${this.dialogKind === "settings" ? "settings" : "sheet"} aria-labelledby="review-dialog-title" @close=${() => {
|
|
3070
|
+
this.dialogKind = void 0, this.requestUpdate();
|
|
3071
|
+
}}>
|
|
3072
|
+
<div class="dialog-heading"><h2 id="review-dialog-title">${this.dialogKind === "settings" ? "Review settings" : this.dialogKind === "files" ? "Review files" : "Review notes"}</h2><button class="ui-button" aria-label="Close dialog" @click=${() => {
|
|
3073
|
+
this.closeDialog();
|
|
3074
|
+
}}>✕</button></div>
|
|
3075
|
+
${this.dialogKind === "settings" ? E`<form @submit=${(e) => {
|
|
3076
|
+
e.preventDefault(), this.setPreferences({
|
|
3077
|
+
...this.preferences,
|
|
3078
|
+
layout: this.settingsLayout
|
|
3079
|
+
}), this.closeDialog();
|
|
3080
|
+
}}>
|
|
3081
|
+
<p class="hint">Layout · saved for this browser</p>
|
|
3082
|
+
<label class="layout-option"><input type="radio" name="layout" value="workbench" .checked=${this.settingsLayout === "workbench"} @change=${() => {
|
|
3083
|
+
this.settingsLayout = "workbench", this.requestUpdate();
|
|
3084
|
+
}}><span><strong>Workbench</strong><span class="hint">Files, code and notes side by side. On phones, files and notes open as sheets.</span></span></label>
|
|
3085
|
+
<label class="layout-option"><input type="radio" name="layout" value="focus" .checked=${this.settingsLayout === "focus"} @change=${() => {
|
|
3086
|
+
this.settingsLayout = "focus", this.requestUpdate();
|
|
3087
|
+
}}><span><strong>Focus</strong><span class="hint">A wide code view with inline feedback. On phones, review one file at a time.</span></span></label>
|
|
3088
|
+
<p class="hint">Switch layouts without losing your current file, line range or draft. This preference applies across workspaces on this browser.</p>
|
|
3089
|
+
<button class="ui-button primary settings-save">Apply layout</button>
|
|
3090
|
+
</form>` : this.dialogKind === "files" ? this.renderFiles() : this.dialogKind === "notes" ? this.renderSaved() : null}
|
|
3091
|
+
</dialog>`;
|
|
2914
3092
|
}
|
|
2915
3093
|
render() {
|
|
2916
|
-
let e = this.view, t = this.editor !== void 0 && this.editor.hash === e?.hash &&
|
|
2917
|
-
return
|
|
2918
|
-
<header class="review-header"><
|
|
2919
|
-
<
|
|
2920
|
-
<button class="primary" ?disabled=${this.saving || this.comments.length === 0} @click=${() => {
|
|
3094
|
+
let e = this.view, t = this.editor !== void 0 && this.editor.hash === e?.hash && ur(this.editor, e), n = this.entries.filter((e) => e.type === "file"), r = n.findIndex((t) => t.path === e?.path);
|
|
3095
|
+
return E`<section class=${`review-panel ${this.preferences.layout}${this.preferences.wrapCode ? " wrap" : ""}`} aria-label="Code Review">
|
|
3096
|
+
<header class="review-header"><h2>Code review</h2><div class="review-actions">
|
|
3097
|
+
<span>${this.comments.length} saved <span class="draft-count">· ${this.editor === void 0 ? "No draft" : "1 unsaved draft"}</span></span>
|
|
3098
|
+
<button class="ui-button primary attach" title="Attach saved comments as a chip; send from the conversation" ?disabled=${this.saving || this.comments.length === 0} @click=${() => {
|
|
2921
3099
|
this.attachReview();
|
|
2922
3100
|
}}>Attach review to composer</button>
|
|
2923
|
-
<
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
3101
|
+
<button class="ui-button settings-button" @click=${() => {
|
|
3102
|
+
this.openDialog("settings");
|
|
3103
|
+
}}>Review settings</button>
|
|
3104
|
+
</div></header>
|
|
3105
|
+
<div class="source-bar ui-toolbar"><div class="source-tabs ui-toolbar-group" role="group" aria-label="Review source selection">
|
|
3106
|
+
${[
|
|
3107
|
+
["files", "Files"],
|
|
3108
|
+
["git-unstaged", "Unstaged"],
|
|
3109
|
+
["git-staged", "Staged"],
|
|
3110
|
+
["git-compare", "Compare"]
|
|
3111
|
+
].map(([e, t]) => E`<button class="ui-button" data-source=${e} aria-pressed=${String(this.source === e)} @click=${() => {
|
|
3112
|
+
this.source !== e && this.selectSource(e);
|
|
3113
|
+
}}>${t}</button>`)}
|
|
3114
|
+
</div><button class="ui-button" @click=${() => {
|
|
2930
3115
|
this.refresh();
|
|
2931
3116
|
}}>Refresh</button></div>
|
|
2932
|
-
|
|
3117
|
+
<div class="source-controls">
|
|
3118
|
+
${this.source === "files" ? E`<details><summary>Open a file by path</summary><form class="toolbar" @submit=${(e) => {
|
|
2933
3119
|
e.preventDefault();
|
|
2934
3120
|
let t = e.currentTarget;
|
|
2935
3121
|
if (t instanceof HTMLFormElement) {
|
|
2936
3122
|
let e = new FormData(t).get("path");
|
|
2937
3123
|
typeof e == "string" && this.openFile(e);
|
|
2938
3124
|
}
|
|
2939
|
-
}}><label>File path <input name="path" placeholder="src/example.ts"></label><button>Open file</button></form>` : null}
|
|
2940
|
-
${this.source === "git-compare" ?
|
|
3125
|
+
}}><label>File path <input name="path" placeholder="src/example.ts"></label><button class="ui-button">Open file</button></form></details>` : null}
|
|
3126
|
+
${this.source === "git-compare" ? E`<form class="toolbar" aria-label="Compare revisions" @submit=${(e) => {
|
|
2941
3127
|
e.preventDefault(), this.applyComparison();
|
|
2942
3128
|
}}>
|
|
2943
3129
|
<label>Base revision <input name="base" required maxlength="256" .value=${this.baseRef} placeholder="main" @input=${(e) => {
|
|
@@ -2946,29 +3132,41 @@ var ar = class extends A {
|
|
|
2946
3132
|
<label>Target revision <input name="head" required maxlength="256" .value=${this.headRef} placeholder="HEAD" @input=${(e) => {
|
|
2947
3133
|
e.target instanceof HTMLInputElement && (this.headRef = e.target.value);
|
|
2948
3134
|
}}></label>
|
|
2949
|
-
<label>Comparison <select name="mode" .value=${this.comparisonMode} @change=${(e) => {
|
|
3135
|
+
<label>Comparison <select class="ui-select" name="mode" .value=${this.comparisonMode} @change=${(e) => {
|
|
2950
3136
|
e.target instanceof HTMLSelectElement && (e.target.value === "merge-base" || e.target.value === "direct") && (this.comparisonMode = e.target.value);
|
|
2951
|
-
}}><option value="merge-base">
|
|
2952
|
-
<button>Compare</button>
|
|
2953
|
-
</form><p>
|
|
3137
|
+
}}><option value="merge-base">Since merge base (A...B)</option><option value="direct">Between revisions (A..B)</option></select></label>
|
|
3138
|
+
<button class="ui-button">Compare</button>
|
|
3139
|
+
</form><details class="source-help"><summary>About revision comparisons</summary><p class="hint">Committed work only. Use main → HEAD with merge base for a branch review, or HEAD~3 → HEAD with between revisions for accumulated work. Compare or Refresh resolves revisions again; files use the frozen commits shown in their heading.</p></details>` : null}
|
|
2954
3140
|
</div>
|
|
2955
|
-
${this.error === "" ? null :
|
|
2956
|
-
${
|
|
2957
|
-
|
|
2958
|
-
|
|
3141
|
+
${this.error === "" ? null : E`<p class="notice" role="alert">${this.error}</p>`}
|
|
3142
|
+
${this.preferenceError === "" ? null : E`<p class="notice" role="alert">${this.preferenceError}</p>`}
|
|
3143
|
+
${Object.values(this.feedbackErrors).every((e) => e === "") ? null : E`
|
|
3144
|
+
${Object.values(this.feedbackErrors).filter(Boolean).map((e) => E`<p class="notice" role="alert">${e}</p>`)}
|
|
3145
|
+
<button class="ui-button" @click=${() => {
|
|
2959
3146
|
this.reportFeedbackError("", "acceptance"), this.reportFeedbackError("", "action"), this.reportFeedbackError("", "read");
|
|
2960
3147
|
}}>Dismiss feedback warning</button>`}
|
|
2961
|
-
<p role="status" aria-live="polite">${this.listLoading || this.viewLoading || this.comparing !== void 0 ? "Loading…" : this.notice}</p>
|
|
2962
|
-
<div class="review-workspace"><nav aria-label="Review files"
|
|
2963
|
-
|
|
2964
|
-
this.
|
|
2965
|
-
}}
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
}}
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
3148
|
+
<p class="notice" role="status" aria-live="polite">${this.listLoading || this.viewLoading || this.comparing !== void 0 ? "Loading…" : this.notice}</p>
|
|
3149
|
+
<div class="review-workspace"><nav class="file-nav" aria-label="Review files">${this.renderFiles()}</nav><main class="viewer">
|
|
3150
|
+
<div class="view-tools"><button class="ui-button file-switch" @click=${() => {
|
|
3151
|
+
this.openDialog("files");
|
|
3152
|
+
}} title=${e?.path ?? "Review files"}>${this.preferences.layout === "focus" ? e?.path.split("/").pop() ?? "Choose file" : `Files (${String(this.entries.length)})`} ▾</button>
|
|
3153
|
+
<button class="ui-button mobile-notes" @click=${() => {
|
|
3154
|
+
this.openDialog("notes");
|
|
3155
|
+
}}>Notes (${this.comments.length})</button>
|
|
3156
|
+
<button class="ui-button file-step" aria-label="Previous file" ?disabled=${this.listLoading || r <= 0} @click=${() => {
|
|
3157
|
+
this.stepFile(-1);
|
|
3158
|
+
}}>←</button>
|
|
3159
|
+
<button class="ui-button file-step" aria-label="Next file" ?disabled=${this.listLoading || r >= n.length - 1} @click=${() => {
|
|
3160
|
+
this.stepFile(1);
|
|
3161
|
+
}}>→</button>
|
|
3162
|
+
<label class="wrap-control"><input type="checkbox" .checked=${this.preferences.wrapCode} @change=${(e) => {
|
|
3163
|
+
e.target instanceof HTMLInputElement && this.setPreferences({
|
|
3164
|
+
...this.preferences,
|
|
3165
|
+
wrapCode: e.target.checked
|
|
3166
|
+
});
|
|
3167
|
+
}}>Wrap code</label>
|
|
3168
|
+
</div>
|
|
3169
|
+
${e === void 0 ? E`<div class="empty-state"><h3>${this.viewLoading ? "Opening file…" : "Choose a file to start reviewing"}</h3><p>Select a file from the list or open a workspace-relative path above.</p></div>` : E`<div class="file-heading"><h3>${e.path}</h3><span class="hint">${ar(e.source, e.comparison)}</span></div>
|
|
2972
3170
|
<div class="code" aria-label="Review source" aria-busy=${String(this.viewLoading)}>${e.rows.map((n) => {
|
|
2973
3171
|
let r = n.line === void 0 || n.side === void 0 ? void 0 : {
|
|
2974
3172
|
path: e.path,
|
|
@@ -2977,75 +3175,26 @@ var ar = class extends A {
|
|
|
2977
3175
|
start: n.line,
|
|
2978
3176
|
end: n.line
|
|
2979
3177
|
}, i = r !== void 0 && this.editor?.path === e.path && this.editor.source === e.source && this.editor.hash === e.hash && this.editor.side === n.side && r.start >= this.editor.start && r.start <= this.editor.end, a = r === void 0 ? [] : this.comments.filter((t) => t.path === e.path && t.source === e.source && t.hash === e.hash && t.side === n.side && t.start === n.line);
|
|
2980
|
-
return
|
|
2981
|
-
${r === void 0 ?
|
|
3178
|
+
return E`<div class=${`row ${n.kind}${i ? " selected" : ""}`}>
|
|
3179
|
+
${r === void 0 ? E`<span class="line"></span>` : E`<button class="line" aria-label=${`${n.side === "old" ? "Deleted" : "Current"} line ${String(n.line)}`} aria-pressed=${String(i)} ?disabled=${this.viewLoading} @click=${(e) => {
|
|
2982
3180
|
this.selectLine(n, e.shiftKey);
|
|
2983
3181
|
}}>${n.line}</button>`}
|
|
2984
|
-
<
|
|
2985
|
-
|
|
3182
|
+
<span class="sign" aria-hidden="true">${n.kind === "add" ? "+" : n.kind === "remove" ? "−" : ""}</span><code>${(Tn(e.source) && n.kind !== "meta" ? n.text.slice(1) : n.text) || " "}</code>
|
|
3183
|
+
${a.length === 0 ? null : E`<button class="comment-marker" aria-label=${`View ${String(a.length)} saved comments at line ${String(n.line)}`} @click=${() => {
|
|
3184
|
+
this.openDialog("notes");
|
|
3185
|
+
}}>${a.length}</button>`}
|
|
3186
|
+
</div>${t && this.editor?.side === n.side && this.editor?.start === n.line ? this.renderEditor() : null}${a.map((e) => E`<div class="inline-comment">${yn(E, e.body)}<div class="toolbar"><button class="ui-button" ?disabled=${this.saving} @click=${() => {
|
|
3187
|
+
this.editComment(e);
|
|
3188
|
+
}}>Edit comment</button></div></div>`)}`;
|
|
3189
|
+
})}</div>${e.rows.length === 0 ? E`<p class="notice">No text lines to review.</p>` : null}`}
|
|
2986
3190
|
${t ? null : this.renderEditor()}
|
|
2987
|
-
</
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
<div class="toolbar"><button ?disabled=${this.saving} @click=${() => {
|
|
2995
|
-
this.editComment(t);
|
|
2996
|
-
}}>Edit comment</button><button ?disabled=${this.saving} @click=${() => {
|
|
2997
|
-
this.removeComment(t);
|
|
2998
|
-
}}>Remove comment</button></div>
|
|
2999
|
-
</article>`)}
|
|
3000
|
-
<details><summary>Feedback Markdown</summary><textarea aria-label="Feedback Markdown" readonly rows="8" .value=${er(this.comments)}></textarea></details>
|
|
3001
|
-
</section></section>`;
|
|
3002
|
-
}
|
|
3003
|
-
static styles = o`
|
|
3004
|
-
:host { display: block; color: var(--pi-text, #ddd); font: 14px system-ui, sans-serif; }
|
|
3005
|
-
* { box-sizing: border-box; }
|
|
3006
|
-
:host { container-type: inline-size; width: 100%; min-width: 0; }
|
|
3007
|
-
.review-panel { padding: 16px; } h2, h3 { margin: 0; } p { line-height: 1.5; }
|
|
3008
|
-
.hint { color: var(--pi-muted, #aaa); font-size: 12px; }
|
|
3009
|
-
.review-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--pi-border, #666); padding-bottom: 16px; }
|
|
3010
|
-
.review-header p { margin: 6px 0 0; }
|
|
3011
|
-
.review-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
|
|
3012
|
-
.source-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 20px; padding: 8px 0; }
|
|
3013
|
-
.source-controls form { flex: 1; } .source-controls label { flex: 1; min-width: 140px; }
|
|
3014
|
-
.source-controls > p { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--pi-muted, #aaa); }
|
|
3015
|
-
.review-workspace { display: grid; grid-template-columns: minmax(160px, 22%) minmax(0, 1fr); border: 1px solid var(--pi-border, #666); border-radius: 8px; overflow: hidden; }
|
|
3016
|
-
nav { background: var(--pi-surface, #222); border-right: 1px solid var(--pi-border, #666); min-width: 0; padding: 12px; }
|
|
3017
|
-
.viewer { min-width: 0; }
|
|
3018
|
-
.file-heading { padding: 12px 16px; overflow-wrap: anywhere; } .file-heading p { margin-bottom: 0; }
|
|
3019
|
-
.empty-state { padding: 48px 24px; text-align: center; color: var(--pi-muted, #aaa); }
|
|
3020
|
-
.saved-review { margin-top: 24px; } summary { cursor: pointer; overflow-wrap: anywhere; }
|
|
3021
|
-
[role=status]:empty { display: none; }
|
|
3022
|
-
@container (max-width: 640px) {
|
|
3023
|
-
.review-panel { padding: 10px; } .review-workspace { grid-template-columns: minmax(0, 1fr); }
|
|
3024
|
-
nav { border-right: 0; border-bottom: 1px solid var(--pi-border, #666); }
|
|
3025
|
-
.review-actions { align-items: flex-start; } .file-list { max-height: 150px !important; }
|
|
3026
|
-
}
|
|
3027
|
-
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin: 8px 0; }
|
|
3028
|
-
label { display: flex; flex-direction: column; gap: 4px; }
|
|
3029
|
-
button, select, input, textarea { color: inherit; background: var(--pi-surface, #222); border: 1px solid var(--pi-border, #666); border-radius: 4px; padding: 6px; font: inherit; }
|
|
3030
|
-
button { cursor: pointer; } button:hover:not(:disabled) { border-color: var(--pi-accent, #6cf); }
|
|
3031
|
-
.primary { background: var(--pi-accent, #6cf); color: var(--pi-surface, #222); border-color: transparent; font-weight: 600; }
|
|
3032
|
-
:is(button, input, select, textarea):focus-visible { outline: 2px solid var(--pi-accent, #6cf); outline-offset: 2px; }
|
|
3033
|
-
button:disabled { opacity: .5; cursor: default; } button:focus-visible { outline: 2px solid var(--pi-accent, #6cf); }
|
|
3034
|
-
textarea { box-sizing: border-box; width: 100%; resize: vertical; } input[type=number] { width: 6em; }
|
|
3035
|
-
.file-list { max-height: 65vh; overflow: auto; } .file-list button { display: block; width: 100%; text-align: left; margin: 4px 0; overflow-wrap: anywhere; border-color: transparent; background: transparent; }
|
|
3036
|
-
.file-list button[aria-current=page] { background: var(--pi-selection-bg, #336699); border-color: var(--pi-accent, #6cf); }
|
|
3037
|
-
.code { max-height: 65vh; overflow: auto; border-top: 1px solid var(--pi-border, #666); }
|
|
3038
|
-
.code .editor, .code .inline-comment { position: sticky; left: 0; width: calc(100% - 24px); margin: 10px 12px; background: var(--pi-surface, #222); }
|
|
3039
|
-
.editor { border-left: 3px solid var(--pi-accent, #6cf) !important; }
|
|
3040
|
-
.editor strong { display: block; margin-bottom: 8px; }
|
|
3041
|
-
.row { display: flex; min-width: max-content; } .row code { white-space: pre; padding: 2px 8px; font: 12px ui-monospace, monospace; }
|
|
3042
|
-
.line { flex: 0 0 4em; border-radius: 0; padding: 2px; font: 12px ui-monospace, monospace; text-align: right; }
|
|
3043
|
-
.add { background: #22883325; } .remove { background: #bb222225; } .meta { color: var(--pi-muted, #999); }
|
|
3044
|
-
.selected { background: var(--pi-selection-bg, #336699); } .inline-comment, article, .editor { padding: 10px; margin: 8px 0; border: 1px solid var(--pi-border, #666); border-radius: 6px; white-space: normal; overflow-wrap: anywhere; }
|
|
3045
|
-
.inline-comment { max-width: 75ch; } [role=alert], .stale { color: var(--pi-warning, #ecb65b); }
|
|
3046
|
-
.markdown pre, .inline-comment pre { overflow: auto; } a { color: var(--pi-accent, #6cf); }
|
|
3047
|
-
`;
|
|
3048
|
-
}, or = class {
|
|
3191
|
+
<div class="hintbar"><span class="desktop-hint">Click a line number to comment · Shift-click to extend a range</span><span class="phone-hint">Tap a line number to comment · Adjust range in the editor</span></div>
|
|
3192
|
+
</main><aside class="saved-review" aria-label="Saved review"><details ?open=${this.preferences.layout === "workbench"}><summary>Saved comments (${this.comments.length})</summary>${this.renderSaved()}</details></aside></div>
|
|
3193
|
+
${this.renderDialog()}
|
|
3194
|
+
</section>`;
|
|
3195
|
+
}
|
|
3196
|
+
static styles = Ie;
|
|
3197
|
+
}, pr = class {
|
|
3049
3198
|
store;
|
|
3050
3199
|
notify;
|
|
3051
3200
|
attachments = /* @__PURE__ */ new Map();
|
|
@@ -3078,7 +3227,7 @@ var ar = class extends A {
|
|
|
3078
3227
|
}, f = {
|
|
3079
3228
|
id: d.id,
|
|
3080
3229
|
label: `Review (${String(l.length)})`,
|
|
3081
|
-
text:
|
|
3230
|
+
text: sr(l),
|
|
3082
3231
|
onRemove: (e) => this.settle(d, e)
|
|
3083
3232
|
};
|
|
3084
3233
|
r.setChip(f), this.attachments.set(d.target, d), this.notify(a, "Review attached to this conversation. Send normally; failed sends retain it.");
|
|
@@ -3119,7 +3268,7 @@ var ar = class extends A {
|
|
|
3119
3268
|
throw n() || this.notify(e.workspace, "The review was accepted, but saved feedback could not be cleared. Check the conversation before attaching it again.", t, "acceptance"), t;
|
|
3120
3269
|
}
|
|
3121
3270
|
}
|
|
3122
|
-
},
|
|
3271
|
+
}, mr = class {
|
|
3123
3272
|
factory;
|
|
3124
3273
|
committed;
|
|
3125
3274
|
name;
|
|
@@ -3136,24 +3285,16 @@ var ar = class extends A {
|
|
|
3136
3285
|
r = !0, t(e);
|
|
3137
3286
|
};
|
|
3138
3287
|
n.onupgradeneeded = () => {
|
|
3139
|
-
|
|
3140
|
-
n.transaction?.abort();
|
|
3141
|
-
return;
|
|
3142
|
-
}
|
|
3143
|
-
n.result.createObjectStore("workspaces");
|
|
3288
|
+
r || this.disposed ? n.transaction?.abort() : n.result.createObjectStore("workspaces");
|
|
3144
3289
|
}, n.onerror = () => {
|
|
3145
3290
|
i(n.error ?? /* @__PURE__ */ Error("Could not open review storage"));
|
|
3146
3291
|
}, n.onblocked = () => {
|
|
3147
3292
|
i(/* @__PURE__ */ Error("Review storage upgrade is blocked; close older review tabs and retry"));
|
|
3148
3293
|
}, n.onsuccess = () => {
|
|
3149
3294
|
let i = n.result;
|
|
3150
|
-
|
|
3151
|
-
i.close(), t(/* @__PURE__ */ Error("Review storage is closed"));
|
|
3152
|
-
return;
|
|
3153
|
-
}
|
|
3154
|
-
i.onversionchange = () => {
|
|
3295
|
+
r || this.disposed ? (i.close(), t(/* @__PURE__ */ Error("Review storage is closed"))) : (i.onversionchange = () => {
|
|
3155
3296
|
i.close(), this.database = void 0;
|
|
3156
|
-
}, e(i);
|
|
3297
|
+
}, e(i));
|
|
3157
3298
|
};
|
|
3158
3299
|
});
|
|
3159
3300
|
return this.database = e, e.catch(() => {
|
|
@@ -3191,49 +3332,59 @@ var ar = class extends A {
|
|
|
3191
3332
|
e.close();
|
|
3192
3333
|
}, () => {});
|
|
3193
3334
|
}
|
|
3194
|
-
},
|
|
3195
|
-
apiVersion:
|
|
3335
|
+
}, hr = {
|
|
3336
|
+
apiVersion: 5,
|
|
3337
|
+
requires: [t],
|
|
3196
3338
|
name: "Code Review",
|
|
3197
|
-
activate({ html: e, runtimePluginId:
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3339
|
+
activate({ html: e, runtimePluginId: n, lifetimeSignal: r }) {
|
|
3340
|
+
let i;
|
|
3341
|
+
class a extends fr {
|
|
3342
|
+
constructor() {
|
|
3343
|
+
if (super(), i === void 0) throw Error("Code Review styling has not started");
|
|
3344
|
+
i.createController(this, { sharedUi: !0 });
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
customElements.define(`pi-web-code-review-${cr()}`, a);
|
|
3348
|
+
let o, s, c = !1, l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = (e, t, n) => {
|
|
3349
|
+
if (c || r.aborted) return;
|
|
3350
|
+
let i = {
|
|
3351
|
+
...u.get(e) ?? {
|
|
3204
3352
|
acceptance: "",
|
|
3205
3353
|
action: "",
|
|
3206
3354
|
read: ""
|
|
3207
3355
|
},
|
|
3208
|
-
[
|
|
3356
|
+
[n]: t
|
|
3209
3357
|
};
|
|
3210
|
-
|
|
3211
|
-
},
|
|
3358
|
+
i.acceptance === "" && i.action === "" && i.read === "" ? u.delete(e) : u.set(e, i), s === e && o?.setFeedbackError(t, n);
|
|
3359
|
+
}, f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h;
|
|
3212
3360
|
try {
|
|
3213
|
-
|
|
3361
|
+
h = new BroadcastChannel("pi-web-code-review:commits");
|
|
3214
3362
|
} catch (e) {
|
|
3215
3363
|
console.error("[Code Review] Cross-tab notifications unavailable", e);
|
|
3216
3364
|
}
|
|
3217
|
-
let
|
|
3218
|
-
if (
|
|
3365
|
+
let g = (e) => {
|
|
3366
|
+
if (c || r.aborted) return;
|
|
3219
3367
|
let t = {};
|
|
3220
|
-
|
|
3221
|
-
|
|
3368
|
+
p.set(e, t), v.load(e).then((n) => {
|
|
3369
|
+
r.aborted || p.get(e) !== t || (f.set(e, n.length || void 0), m.get(e)?.());
|
|
3222
3370
|
}, () => {
|
|
3223
|
-
|
|
3371
|
+
r.aborted || p.get(e) !== t || (f.set(e, "!"), m.get(e)?.());
|
|
3224
3372
|
});
|
|
3225
|
-
},
|
|
3226
|
-
|
|
3227
|
-
}),
|
|
3228
|
-
|
|
3373
|
+
}, _ = new mr(globalThis.indexedDB, (e) => {
|
|
3374
|
+
c || r.aborted || (g(e), h?.postMessage(e));
|
|
3375
|
+
}), v = new rr(_, { getItem: (e) => localStorage.getItem(e) }), ee = new pr(v, (e, t, n, i = "action") => {
|
|
3376
|
+
n !== void 0 && console.error(`[Code Review] ${t}`, n), !(c || r.aborted) && (n === void 0 ? l.set(e, t) : (l.delete(e), d(e, t, i)), s === e && o?.refreshFeedback(n === void 0 ? t : void 0), g(e), o?.context.host.requestRender());
|
|
3229
3377
|
});
|
|
3230
|
-
|
|
3231
|
-
typeof e.data != "string" ||
|
|
3378
|
+
h !== void 0 && (h.onmessage = (e) => {
|
|
3379
|
+
typeof e.data != "string" || r.aborted || (ee.storageChanged(e.data), s === e.data && o?.refreshFeedback(), g(e.data));
|
|
3232
3380
|
});
|
|
3233
3381
|
let te = () => {
|
|
3234
|
-
|
|
3382
|
+
h?.close(), h = void 0;
|
|
3235
3383
|
};
|
|
3236
|
-
return
|
|
3384
|
+
return r.addEventListener("abort", te, { once: !0 }), {
|
|
3385
|
+
start({ capabilities: e }) {
|
|
3386
|
+
i = e.resolve(t);
|
|
3387
|
+
},
|
|
3237
3388
|
contributions: {
|
|
3238
3389
|
actions: [{
|
|
3239
3390
|
id: "open",
|
|
@@ -3241,7 +3392,7 @@ var ar = class extends A {
|
|
|
3241
3392
|
group: "Workspace",
|
|
3242
3393
|
enabled: ({ state: e }) => e.selectedWorkspace !== void 0,
|
|
3243
3394
|
run: (e) => {
|
|
3244
|
-
e.selectWorkspaceTool(`${
|
|
3395
|
+
e.selectWorkspaceTool(`${n}:review`);
|
|
3245
3396
|
}
|
|
3246
3397
|
}],
|
|
3247
3398
|
workspacePanels: [{
|
|
@@ -3252,26 +3403,25 @@ var ar = class extends A {
|
|
|
3252
3403
|
invalidationResources: ["workspace.files"],
|
|
3253
3404
|
badge: (e) => {
|
|
3254
3405
|
let t = $(e);
|
|
3255
|
-
return
|
|
3406
|
+
return m.set(t, () => {
|
|
3256
3407
|
e.host.requestRender();
|
|
3257
|
-
}),
|
|
3408
|
+
}), f.has(t) || (f.set(t, void 0), g(t)), f.get(t);
|
|
3258
3409
|
},
|
|
3259
3410
|
onInvalidate: (e) => {
|
|
3260
|
-
|
|
3411
|
+
o !== void 0 && s === $(e) && o.revision++;
|
|
3261
3412
|
},
|
|
3262
3413
|
render: (t) => {
|
|
3263
|
-
let
|
|
3264
|
-
return (
|
|
3265
|
-
|
|
3266
|
-
},
|
|
3414
|
+
let n = $(t);
|
|
3415
|
+
return (o === void 0 || s !== n) && (o?.remove(), o = new a(), s = n, o.store = v, o.chips = ee, o.lifetime = r, o.revision = 0, o.updateContext(t), o.onFeedbackError = (e, t) => {
|
|
3416
|
+
d(n, e, t);
|
|
3417
|
+
}, o.setFeedbackError(u.get(n)?.acceptance ?? "", "acceptance"), o.setFeedbackError(u.get(n)?.action ?? "", "action"), o.setFeedbackError(u.get(n)?.read ?? "", "read"), o.refreshFeedback(l.get(n))), o.updateContext(t), e`${o}`;
|
|
3267
3418
|
}
|
|
3268
3419
|
}]
|
|
3269
3420
|
},
|
|
3270
3421
|
dispose() {
|
|
3271
|
-
|
|
3422
|
+
c = !0, te(), r.removeEventListener("abort", te), ee.dispose(), _.dispose(), l.clear(), u.clear(), p.clear(), m.clear(), o?.remove(), o = void 0;
|
|
3272
3423
|
}
|
|
3273
3424
|
};
|
|
3274
3425
|
}
|
|
3275
3426
|
};
|
|
3276
|
-
|
|
3277
|
-
export { cr as default };
|
|
3427
|
+
export { hr as default };
|