@commentkit/comment-kit 1.0.0-beta.2 → 1.0.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 +20 -0
- package/README.md +2 -4
- package/dist/npm/chunks/{Guest-CKoV6pEK.js → Guest-VNoofLxw.js} +46 -46
- package/dist/npm/chunks/{MarkupEditor-DAo4qppg.js → MarkupEditor-DTXrS3DD.js} +2 -2
- package/dist/npm/chunks/Panel-B88JYH52.js +438 -0
- package/dist/npm/chunks/{Shortcuts-CHMcrjAM.js → Shortcuts-BSOKdMHt.js} +2 -2
- package/dist/npm/chunks/ThreadCard-izybwXIC.js +817 -0
- package/dist/npm/chunks/{ar-D3SPpN1T.js → ar-O7EPv0mI.js} +65 -38
- package/dist/npm/chunks/art-DK1JwPIo.js +155 -0
- package/dist/npm/chunks/{client-D1NizpDK.js → client-Iegfv6ZC.js} +14 -21
- package/dist/npm/chunks/{de-C8eC6c6f.js → de-PGyZVNHX.js} +52 -28
- package/dist/npm/chunks/{es-Bczf42tm.js → es-Bq1idl8M.js} +51 -27
- package/dist/npm/chunks/{extension--it1LAj-.js → extension-B7SelsS0.js} +1 -1
- package/dist/npm/chunks/{extension-XfuRGu2o.js → extension-DSA8S8Qz.js} +1 -1
- package/dist/npm/chunks/{format-Bw_tNOh9.js → format-B5tJGtPC.js} +2 -2
- package/dist/npm/chunks/{fr-BaQw-v2e.js → fr-BVB9GGco.js} +63 -39
- package/dist/npm/chunks/{hi-BamV-yXv.js → hi-DyBvrjzQ.js} +59 -35
- package/dist/npm/chunks/{it-DC14_EjN.js → it-BlMMMwZh.js} +52 -28
- package/dist/npm/chunks/{ja-B1mmTN7Y.js → ja-lAioBCJv.js} +56 -32
- package/dist/npm/chunks/live-YFyP1GnP.js +34 -0
- package/dist/npm/chunks/mount-Dx_8NhX3.js +1484 -0
- package/dist/npm/chunks/{nl-BfhqUsmX.js → nl-DR8mLHnn.js} +61 -37
- package/dist/npm/chunks/{pt-BR-CEPu4W5U.js → pt-BR-D7j6aDPx.js} +52 -28
- package/dist/npm/chunks/{report-Dh4fxd4J.js → report-DoDVi1qT.js} +5 -4
- package/dist/npm/chunks/{src-DujplxfI.js → src-C1Qp94nr.js} +93 -61
- package/dist/npm/chunks/{zh-CN-kgqjYwHQ.js → zh-CN-tzYg9NPH.js} +52 -28
- package/dist/npm/element.js +2 -2
- package/dist/npm/headless.js +1 -1
- package/dist/npm/index.js +2 -2
- package/dist/npm/react.js +1 -1
- package/dist/npm/svelte.js +1 -1
- package/dist/npm/types/anchor/index.d.ts +0 -1
- package/dist/npm/types/core/auth.d.ts +0 -2
- package/dist/npm/types/core/client.d.ts +7 -6
- package/dist/npm/types/core/types.d.ts +19 -0
- package/dist/npm/vue.js +1 -1
- package/package.json +1 -1
- package/dist/npm/chunks/Panel-BRBDHlGg.js +0 -399
- package/dist/npm/chunks/ThreadCard-D8FzIxbs.js +0 -570
- package/dist/npm/chunks/mount-5fFig0k6.js +0 -1447
|
@@ -1,1447 +0,0 @@
|
|
|
1
|
-
import { n as e, r as t } from "./rolldown-runtime-Y_bBpyJl.js";
|
|
2
|
-
import { a as n, n as r, o as i, s as a, u as o } from "./src-DujplxfI.js";
|
|
3
|
-
import { c as s, l as c, r as l } from "./client-D1NizpDK.js";
|
|
4
|
-
import { n as u, r as d, t as f } from "./anchor-DT-Ynhh1.js";
|
|
5
|
-
import { n as p } from "./privacy-DLhezjyi.js";
|
|
6
|
-
import { _ as m, a as h, c as g, d as _, f as v, g as y, h as b, l as x, m as S, n as C, p as w, t as T, v as E, y as D } from "./format-Bw_tNOh9.js";
|
|
7
|
-
//#region src/capture/context.ts
|
|
8
|
-
function ee() {
|
|
9
|
-
let e = navigator.userAgent, t = O(e, [
|
|
10
|
-
["Edge", /Edg\/([\d.]+)/],
|
|
11
|
-
["Opera", /OPR\/([\d.]+)/],
|
|
12
|
-
["Samsung Internet", /SamsungBrowser\/([\d.]+)/],
|
|
13
|
-
["Chrome", /Chrome\/([\d.]+)/],
|
|
14
|
-
["Firefox", /Firefox\/([\d.]+)/],
|
|
15
|
-
["Safari", /Version\/([\d.]+).*Safari/]
|
|
16
|
-
]), n = O(e, [
|
|
17
|
-
["iOS", /(?:iPhone|iPad|iPod).*OS ([\d_]+)/],
|
|
18
|
-
["Android", /Android ([\d.]+)/],
|
|
19
|
-
["Windows", /Windows NT ([\d.]+)/],
|
|
20
|
-
["macOS", /Mac OS X ([\d_]+)/],
|
|
21
|
-
["ChromeOS", /CrOS [^ ]+ ([\d.]+)/],
|
|
22
|
-
["Linux", /Linux()/]
|
|
23
|
-
]), r = innerWidth, i = matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
24
|
-
return {
|
|
25
|
-
viewport: {
|
|
26
|
-
width: r,
|
|
27
|
-
height: innerHeight,
|
|
28
|
-
dpr: Math.round((devicePixelRatio || 1) * 100) / 100,
|
|
29
|
-
zoom: Math.round((visualViewport?.scale ?? 1) * 100) / 100
|
|
30
|
-
},
|
|
31
|
-
device: {
|
|
32
|
-
browser: t?.[0],
|
|
33
|
-
browser_version: t?.[1]?.split(".")[0],
|
|
34
|
-
os: n?.[0],
|
|
35
|
-
os_version: n?.[1]?.replace(/_/g, "."),
|
|
36
|
-
type: i ? r >= 768 ? "tablet" : "mobile" : "desktop",
|
|
37
|
-
locale: navigator.language,
|
|
38
|
-
color_scheme: matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light",
|
|
39
|
-
user_agent: e.slice(0, 500)
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function O(e, t) {
|
|
44
|
-
for (let [n, r] of t) {
|
|
45
|
-
let t = e.match(r);
|
|
46
|
-
if (t) return [n, t[1] ?? ""];
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/capture/screenshot.ts
|
|
52
|
-
var k = 8e6, te = 15e3;
|
|
53
|
-
async function A(e = {}) {
|
|
54
|
-
let t = (e.redact ?? []).filter(F), n = innerWidth, r = innerHeight, i = null;
|
|
55
|
-
o() && (i = await import("./extension--it1LAj-.js").then((e) => e.captureTab(t)).catch(() => null)), i ?? (i = await j(t, n, r));
|
|
56
|
-
let a = i.getContext("2d");
|
|
57
|
-
return a && M(a, i.width / Math.max(1, n), e), {
|
|
58
|
-
blob: await N(i),
|
|
59
|
-
width: i.width,
|
|
60
|
-
height: i.height
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
async function j(e, n, r) {
|
|
64
|
-
let { default: i } = await import("./html2canvas-DfGb8yka.js").then((e) => /* @__PURE__ */ t(e.default, 1)), a = (t) => p(t) || e.some((e) => I(t, e)), o = Math.min(devicePixelRatio || 1, 2, Math.sqrt(k / Math.max(1, n * r)));
|
|
65
|
-
return P(i(document.documentElement, {
|
|
66
|
-
useCORS: !0,
|
|
67
|
-
logging: !1,
|
|
68
|
-
backgroundColor: getComputedStyle(document.body).backgroundColor || "#ffffff",
|
|
69
|
-
scale: o,
|
|
70
|
-
x: scrollX,
|
|
71
|
-
y: scrollY,
|
|
72
|
-
width: n,
|
|
73
|
-
height: r,
|
|
74
|
-
windowWidth: document.documentElement.clientWidth,
|
|
75
|
-
windowHeight: r,
|
|
76
|
-
ignoreElements: a,
|
|
77
|
-
onclone: (e) => import("./colors-CX-IPjvb.js").then(({ normalizeCaptureColors: t }) => t(e))
|
|
78
|
-
}), te);
|
|
79
|
-
}
|
|
80
|
-
function M(e, t, n) {
|
|
81
|
-
e.setTransform(1, 0, 0, 1, 0, 0);
|
|
82
|
-
let r = n.accent ?? "#ff5733";
|
|
83
|
-
if (n.region) {
|
|
84
|
-
let i = n.region;
|
|
85
|
-
e.save(), e.lineWidth = 3 * t, e.strokeStyle = r, e.setLineDash([8 * t, 6 * t]), e.strokeRect(i.x * t, i.y * t, i.w * t, i.h * t), e.restore();
|
|
86
|
-
}
|
|
87
|
-
if (n.pin) {
|
|
88
|
-
let i = n.pin.x * t, a = n.pin.y * t, o = 11 * t;
|
|
89
|
-
e.save(), e.shadowColor = "rgba(0,0,0,0.25)", e.shadowBlur = 6 * t, e.fillStyle = r, e.beginPath(), e.arc(i, a - o, o, Math.PI, 0), e.lineTo(i, a + o * .4), e.closePath(), e.fill(), e.shadowBlur = 0, e.fillStyle = "#ffffff", e.beginPath(), e.arc(i, a - o, o * .38, 0, Math.PI * 2), e.fill(), e.restore();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
function N(e) {
|
|
93
|
-
return new Promise((t, n) => {
|
|
94
|
-
e.toBlob((r) => {
|
|
95
|
-
if (r && r.type === "image/webp") return t(r);
|
|
96
|
-
e.toBlob((e) => e ? t(e) : n(/* @__PURE__ */ Error("Could not encode the screenshot.")), "image/png");
|
|
97
|
-
}, "image/webp", .86);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function P(e, t) {
|
|
101
|
-
return new Promise((n, r) => {
|
|
102
|
-
let i = setTimeout(() => r(/* @__PURE__ */ Error("The screenshot took too long. Your feedback will be sent without it.")), t);
|
|
103
|
-
e.then((e) => (clearTimeout(i), n(e)), (e) => (clearTimeout(i), r(e)));
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
function F(e) {
|
|
107
|
-
try {
|
|
108
|
-
return document.createDocumentFragment().querySelector(e), !0;
|
|
109
|
-
} catch {
|
|
110
|
-
return !1;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function I(e, t) {
|
|
114
|
-
try {
|
|
115
|
-
return e.matches(t) || !!e.closest(t);
|
|
116
|
-
} catch {
|
|
117
|
-
return !1;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
//#endregion
|
|
121
|
-
//#region src/ui/drafts.ts
|
|
122
|
-
var L = "commentkit:draft:v2:", R = !1;
|
|
123
|
-
function z(e) {
|
|
124
|
-
let t = 2166136261, n = 16777619;
|
|
125
|
-
for (let r = 0; r < e.length; r++) {
|
|
126
|
-
let i = e.charCodeAt(r);
|
|
127
|
-
t = Math.imul(t ^ i, 16777619), n = Math.imul(n ^ i, 2166136261);
|
|
128
|
-
}
|
|
129
|
-
return (t >>> 0).toString(36) + (n >>> 0).toString(36);
|
|
130
|
-
}
|
|
131
|
-
function B(e, ...t) {
|
|
132
|
-
return `${L}${e}:${z(t.map((e) => e ?? "").join(""))}`;
|
|
133
|
-
}
|
|
134
|
-
function ne(e, t = Date.now()) {
|
|
135
|
-
H(t);
|
|
136
|
-
try {
|
|
137
|
-
let n = JSON.parse(localStorage.getItem(e) ?? "null");
|
|
138
|
-
if (n && typeof n.text == "string" && typeof n.at == "number" && t - n.at < 6048e5) return n.text;
|
|
139
|
-
localStorage.removeItem(e);
|
|
140
|
-
} catch {}
|
|
141
|
-
return "";
|
|
142
|
-
}
|
|
143
|
-
function V(e, t, n = Date.now()) {
|
|
144
|
-
try {
|
|
145
|
-
t.trim() ? localStorage.setItem(e, JSON.stringify({
|
|
146
|
-
text: t.slice(0, 1e4),
|
|
147
|
-
at: n
|
|
148
|
-
})) : localStorage.removeItem(e);
|
|
149
|
-
} catch {}
|
|
150
|
-
}
|
|
151
|
-
function re(e) {
|
|
152
|
-
V(e, "");
|
|
153
|
-
}
|
|
154
|
-
function H(e = Date.now(), t = !1) {
|
|
155
|
-
if (!R || t) {
|
|
156
|
-
R = !0;
|
|
157
|
-
try {
|
|
158
|
-
for (let t = localStorage.length - 1; t >= 0; t--) {
|
|
159
|
-
let n = localStorage.key(t);
|
|
160
|
-
if (!n?.startsWith(L)) continue;
|
|
161
|
-
let r = 0;
|
|
162
|
-
try {
|
|
163
|
-
r = Number(JSON.parse(localStorage.getItem(n) ?? "null")?.at) || 0;
|
|
164
|
-
} catch {}
|
|
165
|
-
e - r >= 6048e5 && localStorage.removeItem(n);
|
|
166
|
-
}
|
|
167
|
-
} catch {}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region src/ui/files.ts
|
|
172
|
-
var U = {
|
|
173
|
-
png: "image/png",
|
|
174
|
-
jpg: "image/jpeg",
|
|
175
|
-
jpeg: "image/jpeg",
|
|
176
|
-
webp: "image/webp",
|
|
177
|
-
gif: "image/gif",
|
|
178
|
-
pdf: "application/pdf",
|
|
179
|
-
txt: "text/plain",
|
|
180
|
-
csv: "text/csv",
|
|
181
|
-
mp4: "video/mp4",
|
|
182
|
-
webm: "video/webm",
|
|
183
|
-
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
184
|
-
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
185
|
-
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
186
|
-
}, W = new Set(Object.values(U)), G = [...W, ...Object.keys(U).map((e) => `.${e}`)].join(",");
|
|
187
|
-
function ie(e, t, r) {
|
|
188
|
-
let i = [...e], a = null;
|
|
189
|
-
for (let e of t) {
|
|
190
|
-
let t = W.has(e.type) ? e.type : e.type ? void 0 : U[e.name.split(".").pop()?.toLowerCase() ?? ""];
|
|
191
|
-
t ? e.size > r ? a = n("fileTooBig", {
|
|
192
|
-
name: e.name || "file",
|
|
193
|
-
size: ae(r)
|
|
194
|
-
}) : i.length >= 10 ? a = n("tooManyFiles", { n: 10 }) : i.push(t === e.type ? e : new File([e], e.name, {
|
|
195
|
-
type: t,
|
|
196
|
-
lastModified: e.lastModified
|
|
197
|
-
})) : a = n("fileNotAllowed", { name: e.name || "file" });
|
|
198
|
-
}
|
|
199
|
-
return {
|
|
200
|
-
files: i,
|
|
201
|
-
problem: a
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
function ae(e) {
|
|
205
|
-
return `${Math.max(1, Math.round(e / 1048576))} MB`;
|
|
206
|
-
}
|
|
207
|
-
function oe(e) {
|
|
208
|
-
return {
|
|
209
|
-
onPaste: (t) => {
|
|
210
|
-
let n = [...t.clipboardData?.files ?? []];
|
|
211
|
-
n.length && (t.preventDefault(), e(n));
|
|
212
|
-
},
|
|
213
|
-
onDragOver: (e) => {
|
|
214
|
-
e.dataTransfer?.types.includes("Files") && (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
|
|
215
|
-
},
|
|
216
|
-
onDrop: (t) => {
|
|
217
|
-
let n = [...t.dataTransfer?.files ?? []];
|
|
218
|
-
n.length && (t.preventDefault(), e(n));
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
//#endregion
|
|
223
|
-
//#region src/ui/hooks.ts
|
|
224
|
-
function K(e, t) {
|
|
225
|
-
let [n, r] = b(() => t(e.get()));
|
|
226
|
-
return v(() => (r(t(e.get())), e.subscribe((e) => r(() => t(e)))), [e]), n;
|
|
227
|
-
}
|
|
228
|
-
function q(e) {
|
|
229
|
-
let [t, n] = b(0);
|
|
230
|
-
return v(() => {
|
|
231
|
-
if (!e) return;
|
|
232
|
-
let t = 0, r = () => {
|
|
233
|
-
t || (t = requestAnimationFrame(() => {
|
|
234
|
-
t = 0, n((e) => e + 1);
|
|
235
|
-
}));
|
|
236
|
-
}, i = new MutationObserver((e) => {
|
|
237
|
-
e.some((e) => !(e.target instanceof Element && e.target.closest("[data-commentkit-host]"))) && r();
|
|
238
|
-
});
|
|
239
|
-
i.observe(document.body, {
|
|
240
|
-
subtree: !0,
|
|
241
|
-
childList: !0,
|
|
242
|
-
attributes: !0,
|
|
243
|
-
characterData: !0
|
|
244
|
-
}), addEventListener("resize", r), addEventListener("scroll", r, !0), document.fonts?.ready.then(r).catch(() => void 0);
|
|
245
|
-
let a = setInterval(r, 2e3);
|
|
246
|
-
return () => {
|
|
247
|
-
i.disconnect(), removeEventListener("resize", r), removeEventListener("scroll", r, !0), clearInterval(a), cancelAnimationFrame(t);
|
|
248
|
-
};
|
|
249
|
-
}, [e]), t;
|
|
250
|
-
}
|
|
251
|
-
function se() {
|
|
252
|
-
let [e, t] = b(() => typeof navigator > "u" || navigator.onLine !== !1);
|
|
253
|
-
return v(() => {
|
|
254
|
-
let e = () => t(!0), n = () => t(!1);
|
|
255
|
-
return addEventListener("online", e), addEventListener("offline", n), () => {
|
|
256
|
-
removeEventListener("online", e), removeEventListener("offline", n);
|
|
257
|
-
};
|
|
258
|
-
}, []), e;
|
|
259
|
-
}
|
|
260
|
-
function J(e, t, n = !1) {
|
|
261
|
-
let r = !n && getComputedStyle(e.currentTarget).direction === "rtl", i = n ? [
|
|
262
|
-
"ArrowDown",
|
|
263
|
-
"j",
|
|
264
|
-
"J"
|
|
265
|
-
] : [r ? "ArrowLeft" : "ArrowRight"], a = n ? [
|
|
266
|
-
"ArrowUp",
|
|
267
|
-
"k",
|
|
268
|
-
"K"
|
|
269
|
-
] : [r ? "ArrowRight" : "ArrowLeft"], o = i.includes(e.key) ? 1 : a.includes(e.key) ? -1 : e.key === "Home" ? "first" : e.key === "End" ? "last" : null;
|
|
270
|
-
if (o === null) return;
|
|
271
|
-
let s = e.currentTarget, c = [...s.querySelectorAll(t)].filter((e) => !e.hasAttribute("disabled"));
|
|
272
|
-
if (!c.length) return;
|
|
273
|
-
e.preventDefault();
|
|
274
|
-
let l = c.indexOf(s.getRootNode().activeElement);
|
|
275
|
-
c[o === "first" ? 0 : o === "last" ? c.length - 1 : (Math.max(l, o > 0 ? -1 : 0) + o + c.length) % c.length]?.focus();
|
|
276
|
-
}
|
|
277
|
-
//#endregion
|
|
278
|
-
//#region src/ui/MentionBox.tsx
|
|
279
|
-
var Y = null;
|
|
280
|
-
function ce({ client: e, value: t, onChange: n, onMentions: r, onSubmit: i, placeholder: a, autofocus: o, disabled: s, canMention: c }) {
|
|
281
|
-
let l = w(null), [u, d] = b([]), [f, p] = b(null), [m, h] = b(0), [g, y] = b(/* @__PURE__ */ new Map());
|
|
282
|
-
v(() => {
|
|
283
|
-
o && l.current?.focus();
|
|
284
|
-
}, [o]), v(() => {
|
|
285
|
-
c && (Y ?? (Y = e.people().catch(() => [])), Y.then(d));
|
|
286
|
-
}, [e, c]);
|
|
287
|
-
let x = f === null ? [] : u.filter((e) => e.name.toLowerCase().includes(f.toLowerCase())).slice(0, 6), S = (e) => {
|
|
288
|
-
n(e);
|
|
289
|
-
let t = l.current?.selectionStart ?? e.length, i = e.slice(0, t), a = /(^|\s)@([\p{L}\p{N}._-]{0,30})$/u.exec(i);
|
|
290
|
-
p(c && a ? a[2] ?? "" : null), h(0), r([...g.entries()].filter(([t]) => e.includes(`@${t}`)).map(([, e]) => e));
|
|
291
|
-
}, C = (e) => {
|
|
292
|
-
let i = l.current;
|
|
293
|
-
if (!i || e.id === null) return;
|
|
294
|
-
let a = i.selectionStart ?? t.length, o = t.slice(0, a).replace(/@[\p{L}\p{N}._-]*$/u, `@${e.name} `), s = o + t.slice(a), c = new Map(g).set(e.name, Number(e.id));
|
|
295
|
-
y(c), p(null), n(s), r([...c.entries()].filter(([e]) => s.includes(`@${e}`)).map(([, e]) => e)), requestAnimationFrame(() => {
|
|
296
|
-
i.focus(), i.setSelectionRange(o.length, o.length);
|
|
297
|
-
});
|
|
298
|
-
};
|
|
299
|
-
return /* @__PURE__ */ _(D, { children: [/* @__PURE__ */ _("textarea", {
|
|
300
|
-
ref: l,
|
|
301
|
-
class: "ck-textarea",
|
|
302
|
-
value: t,
|
|
303
|
-
placeholder: a,
|
|
304
|
-
disabled: s,
|
|
305
|
-
maxLength: 1e4,
|
|
306
|
-
"aria-label": a,
|
|
307
|
-
"aria-autocomplete": "list",
|
|
308
|
-
"aria-controls": x.length ? "ck-suggest" : void 0,
|
|
309
|
-
"aria-activedescendant": x.length ? `ck-opt-${m}` : void 0,
|
|
310
|
-
onInput: (e) => S(e.target.value),
|
|
311
|
-
onKeyDown: (e) => {
|
|
312
|
-
x.length && [
|
|
313
|
-
"ArrowDown",
|
|
314
|
-
"ArrowUp",
|
|
315
|
-
"Enter",
|
|
316
|
-
"Tab"
|
|
317
|
-
].includes(e.key) ? (e.preventDefault(), e.key === "ArrowDown" ? h((e) => (e + 1) % x.length) : e.key === "ArrowUp" ? h((e) => (e - 1 + x.length) % x.length) : C(x[m])) : (e.key === "Enter" && (e.metaKey || e.ctrlKey) && (e.preventDefault(), i()), e.key !== "Escape" && e.stopPropagation());
|
|
318
|
-
}
|
|
319
|
-
}), x.length ? /* @__PURE__ */ _("div", {
|
|
320
|
-
class: "ck-suggest",
|
|
321
|
-
id: "ck-suggest",
|
|
322
|
-
role: "listbox",
|
|
323
|
-
children: x.map((e, t) => /* @__PURE__ */ _("button", {
|
|
324
|
-
type: "button",
|
|
325
|
-
role: "option",
|
|
326
|
-
id: `ck-opt-${t}`,
|
|
327
|
-
"aria-selected": t === m,
|
|
328
|
-
onMouseDown: (t) => {
|
|
329
|
-
t.preventDefault(), C(e);
|
|
330
|
-
},
|
|
331
|
-
children: [/* @__PURE__ */ _(T, { person: e }), /* @__PURE__ */ _("bdi", { children: e.name })]
|
|
332
|
-
}))
|
|
333
|
-
}) : null] });
|
|
334
|
-
}
|
|
335
|
-
//#endregion
|
|
336
|
-
//#region src/ui/Composer.tsx
|
|
337
|
-
var le = "commentkit:pending-compose";
|
|
338
|
-
function X({ client: e, draft: t, signedIn: r, onSignIn: i, onCancel: o, onSent: c, onError: l, share: u = null, onPending: d }) {
|
|
339
|
-
let f = K(e.state, (e) => e.config), p = S(() => de(e, t.anchor), [t.anchor]), [m, h] = b({
|
|
340
|
-
name: "",
|
|
341
|
-
email: ""
|
|
342
|
-
}), [g, y] = b(() => ne(p)), [x, T] = b([]), [E, O] = b(null), [k, te] = b(null), [j, M] = b(f?.features.screenshots === !1 ? "off" : "capturing"), [N, P] = b([]), [F, I] = b(null), [L, R] = b([]), [z, B] = b(!1), [H, U] = b(!1), W = !!(f?.features.console_capture || f?.features.network_capture), [G, ae] = b(f?.features.capture_consent_default === !0), q = se(), [J, Y] = b(!1), X = !r && !!u && !e.auth.pending(), [Z, _e] = b(null), ve = {
|
|
343
|
-
name: w(null),
|
|
344
|
-
email: w(null)
|
|
345
|
-
}, ye = w(null), Q = w(null);
|
|
346
|
-
v(() => {
|
|
347
|
-
if (j !== "capturing") return;
|
|
348
|
-
let n = !1;
|
|
349
|
-
return A({
|
|
350
|
-
redact: [...f?.privacy.redact_selectors ?? [], ...e.options.redact ?? []],
|
|
351
|
-
pin: t.region ? null : t.point,
|
|
352
|
-
region: t.region
|
|
353
|
-
}).then((e) => {
|
|
354
|
-
n || (O(e), M("ready"));
|
|
355
|
-
}, () => !n && M("failed")), () => {
|
|
356
|
-
n = !0;
|
|
357
|
-
};
|
|
358
|
-
}, []), v(() => {
|
|
359
|
-
if (!E) return;
|
|
360
|
-
let e = URL.createObjectURL(E.blob);
|
|
361
|
-
return te(e), () => URL.revokeObjectURL(e);
|
|
362
|
-
}, [E]);
|
|
363
|
-
let be = (e) => {
|
|
364
|
-
y(e), V(p, e);
|
|
365
|
-
};
|
|
366
|
-
v(() => {
|
|
367
|
-
Q.current = null;
|
|
368
|
-
}, [
|
|
369
|
-
g,
|
|
370
|
-
x,
|
|
371
|
-
E,
|
|
372
|
-
j,
|
|
373
|
-
N,
|
|
374
|
-
L,
|
|
375
|
-
G
|
|
376
|
-
]);
|
|
377
|
-
let xe = S(() => me(t.point), [t.point]), Se = (e) => {
|
|
378
|
-
let t = ie(L, e, f?.limits.max_upload_bytes ?? 10485760);
|
|
379
|
-
R(t.files), t.problem && l(new s(0, "file_rejected", t.problem));
|
|
380
|
-
}, Ce = async () => {
|
|
381
|
-
let r = null;
|
|
382
|
-
if (E && j === "ready") try {
|
|
383
|
-
let t = E.blob.type, n = `screenshot.${t === "image/webp" ? "webp" : t === "image/jpeg" ? "jpg" : "png"}`;
|
|
384
|
-
r = (await e.upload(E.blob, n, "screenshot")).id;
|
|
385
|
-
} catch {
|
|
386
|
-
l(Error(n("uploadFailed")));
|
|
387
|
-
}
|
|
388
|
-
let i = [];
|
|
389
|
-
for (let t of L) try {
|
|
390
|
-
i.push((await e.upload(t, t.name)).id);
|
|
391
|
-
} catch (e) {
|
|
392
|
-
l(e);
|
|
393
|
-
}
|
|
394
|
-
let o = {
|
|
395
|
-
...ee(),
|
|
396
|
-
...W && G ? a() : {},
|
|
397
|
-
screenshot_id: r,
|
|
398
|
-
markup: N.length ? N : void 0
|
|
399
|
-
};
|
|
400
|
-
return {
|
|
401
|
-
key: crypto.randomUUID(),
|
|
402
|
-
input: {
|
|
403
|
-
anchor: t.anchor,
|
|
404
|
-
body: g.trim(),
|
|
405
|
-
capture: o,
|
|
406
|
-
attachmentIds: i,
|
|
407
|
-
mentionIds: x
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
}, $ = async () => {
|
|
411
|
-
if (z || !g.trim() || !q) return;
|
|
412
|
-
if (U(!1), !r && !u && !J) {
|
|
413
|
-
Y(!0);
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
let n = X ? m.name.trim() ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m.email.trim()) ? null : "email" : "name" : null;
|
|
417
|
-
if (_e(n), n) return ve[n].current?.focus();
|
|
418
|
-
B(!0);
|
|
419
|
-
try {
|
|
420
|
-
let n = !r && !u;
|
|
421
|
-
if (X && u) {
|
|
422
|
-
let { startGuest: t } = await import("./Guest-CKoV6pEK.js");
|
|
423
|
-
n = await t(e, {
|
|
424
|
-
share: u,
|
|
425
|
-
...m
|
|
426
|
-
}) === "popup";
|
|
427
|
-
}
|
|
428
|
-
if (n) {
|
|
429
|
-
if (he(le, JSON.stringify({
|
|
430
|
-
draft: t,
|
|
431
|
-
scrollY
|
|
432
|
-
})), !await i()) return;
|
|
433
|
-
ge(le);
|
|
434
|
-
}
|
|
435
|
-
let a = Q.current ?? (Q.current = await Ce()), o = await e.createThread({
|
|
436
|
-
...a.input,
|
|
437
|
-
idempotencyKey: a.key
|
|
438
|
-
});
|
|
439
|
-
if (Q.current = null, o.pending_verification) return d?.(e.auth.pending()?.email ?? m.email);
|
|
440
|
-
re(p), c(o);
|
|
441
|
-
} catch (t) {
|
|
442
|
-
if (t instanceof s && ["pending_limit", "verification_required"].includes(t.code) && e.auth.pending()) return d?.(e.auth.pending().email);
|
|
443
|
-
let n = ue(t);
|
|
444
|
-
U(n ?? !0), n || l(t);
|
|
445
|
-
} finally {
|
|
446
|
-
B(!1);
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
return /* @__PURE__ */ _("div", {
|
|
450
|
-
class: "ck-card",
|
|
451
|
-
style: xe,
|
|
452
|
-
role: "dialog",
|
|
453
|
-
"aria-label": n("comment"),
|
|
454
|
-
"data-commentkit-ui": !0,
|
|
455
|
-
onKeyDown: (e) => e.key === "Escape" && o(),
|
|
456
|
-
...oe(Se),
|
|
457
|
-
children: [
|
|
458
|
-
/* @__PURE__ */ _("div", {
|
|
459
|
-
class: "ck-card-head",
|
|
460
|
-
children: [/* @__PURE__ */ _("span", {
|
|
461
|
-
class: "ck-card-title",
|
|
462
|
-
children: t.anchor.quote ? `“${t.anchor.quote.slice(0, 60)}”` : n("comment")
|
|
463
|
-
}), /* @__PURE__ */ _("button", {
|
|
464
|
-
class: "ck-ghost",
|
|
465
|
-
onClick: o,
|
|
466
|
-
"aria-label": n("cancel"),
|
|
467
|
-
children: /* @__PURE__ */ _(C, { name: "close" })
|
|
468
|
-
})]
|
|
469
|
-
}),
|
|
470
|
-
/* @__PURE__ */ _("div", {
|
|
471
|
-
class: "ck-card-body",
|
|
472
|
-
style: { position: "relative" },
|
|
473
|
-
children: [
|
|
474
|
-
q ? null : /* @__PURE__ */ _("div", {
|
|
475
|
-
class: "ck-note",
|
|
476
|
-
"data-tone": "warning",
|
|
477
|
-
role: "status",
|
|
478
|
-
children: n("offlineSend")
|
|
479
|
-
}),
|
|
480
|
-
H && q ? /* @__PURE__ */ _("div", {
|
|
481
|
-
class: "ck-note",
|
|
482
|
-
"data-tone": "warning",
|
|
483
|
-
role: "alert",
|
|
484
|
-
children: H === !0 ? /* @__PURE__ */ _(D, { children: [
|
|
485
|
-
n("sendFailed"),
|
|
486
|
-
" ",
|
|
487
|
-
/* @__PURE__ */ _("button", {
|
|
488
|
-
class: "ck-btn",
|
|
489
|
-
onClick: () => void $(),
|
|
490
|
-
children: n("retry")
|
|
491
|
-
})
|
|
492
|
-
] }) : `${H} ${n("savedHere")}`
|
|
493
|
-
}) : null,
|
|
494
|
-
/* @__PURE__ */ _(ce, {
|
|
495
|
-
client: e,
|
|
496
|
-
value: g,
|
|
497
|
-
onChange: be,
|
|
498
|
-
onMentions: T,
|
|
499
|
-
onSubmit: () => void $(),
|
|
500
|
-
placeholder: n("composerPlaceholder"),
|
|
501
|
-
autofocus: !0,
|
|
502
|
-
disabled: z,
|
|
503
|
-
canMention: r
|
|
504
|
-
}),
|
|
505
|
-
X || J && !r ? /* @__PURE__ */ _("div", {
|
|
506
|
-
class: "ck-note",
|
|
507
|
-
children: [
|
|
508
|
-
/* @__PURE__ */ _("strong", { children: n(X ? "guestIntro" : "signInToSend") }),
|
|
509
|
-
/* @__PURE__ */ _("div", { children: n(u ? "guestExplain" : "signInExplain") }),
|
|
510
|
-
X ? /* @__PURE__ */ _("div", {
|
|
511
|
-
class: "ck-guest",
|
|
512
|
-
children: ["name", "email"].map((e) => /* @__PURE__ */ _("div", {
|
|
513
|
-
class: "ck-field",
|
|
514
|
-
children: [
|
|
515
|
-
/* @__PURE__ */ _("label", {
|
|
516
|
-
for: `ck-guest-${e}`,
|
|
517
|
-
children: n(e === "name" ? "guestName" : "guestEmail")
|
|
518
|
-
}),
|
|
519
|
-
/* @__PURE__ */ _("input", {
|
|
520
|
-
id: `ck-guest-${e}`,
|
|
521
|
-
ref: ve[e],
|
|
522
|
-
class: "ck-input",
|
|
523
|
-
type: e === "email" ? "email" : "text",
|
|
524
|
-
autoComplete: e,
|
|
525
|
-
maxLength: e === "name" ? 120 : 254,
|
|
526
|
-
value: m[e],
|
|
527
|
-
"aria-invalid": Z === e,
|
|
528
|
-
"aria-describedby": Z === e ? "ck-guest-error" : void 0,
|
|
529
|
-
onInput: (t) => {
|
|
530
|
-
let n = t.target.value;
|
|
531
|
-
h((t) => ({
|
|
532
|
-
...t,
|
|
533
|
-
[e]: n
|
|
534
|
-
}));
|
|
535
|
-
},
|
|
536
|
-
onKeyDown: (e) => {
|
|
537
|
-
e.key !== "Escape" && e.stopPropagation(), e.key === "Enter" && $();
|
|
538
|
-
}
|
|
539
|
-
}),
|
|
540
|
-
Z === e ? /* @__PURE__ */ _("span", {
|
|
541
|
-
class: "ck-error",
|
|
542
|
-
id: "ck-guest-error",
|
|
543
|
-
role: "alert",
|
|
544
|
-
children: n(e === "name" ? "guestNameMissing" : "guestEmailInvalid")
|
|
545
|
-
}) : null
|
|
546
|
-
]
|
|
547
|
-
}))
|
|
548
|
-
}) : null
|
|
549
|
-
]
|
|
550
|
-
}) : null,
|
|
551
|
-
j === "capturing" ? /* @__PURE__ */ _("p", {
|
|
552
|
-
class: "ck-muted",
|
|
553
|
-
children: n("capturing")
|
|
554
|
-
}) : null,
|
|
555
|
-
j === "ready" && k ? /* @__PURE__ */ _(D, { children: [/* @__PURE__ */ _("div", {
|
|
556
|
-
class: "ck-shot",
|
|
557
|
-
children: /* @__PURE__ */ _("img", {
|
|
558
|
-
src: k,
|
|
559
|
-
alt: n("screenshot")
|
|
560
|
-
})
|
|
561
|
-
}), /* @__PURE__ */ _("div", {
|
|
562
|
-
class: "ck-shot-tools",
|
|
563
|
-
children: [
|
|
564
|
-
/* @__PURE__ */ _("span", {
|
|
565
|
-
class: "ck-muted",
|
|
566
|
-
style: { flex: "1 1 100%" },
|
|
567
|
-
children: n("screenshotIncluded")
|
|
568
|
-
}),
|
|
569
|
-
/* @__PURE__ */ _("button", {
|
|
570
|
-
class: "ck-chip",
|
|
571
|
-
onClick: () => void import("./MarkupEditor-DAo4qppg.js").then((e) => I(() => e.MarkupEditor), l),
|
|
572
|
-
children: [/* @__PURE__ */ _(C, {
|
|
573
|
-
name: "pen",
|
|
574
|
-
size: 14
|
|
575
|
-
}), n("markup")]
|
|
576
|
-
}),
|
|
577
|
-
/* @__PURE__ */ _("button", {
|
|
578
|
-
class: "ck-chip",
|
|
579
|
-
onClick: () => M("off"),
|
|
580
|
-
children: n("screenshotRemove")
|
|
581
|
-
})
|
|
582
|
-
]
|
|
583
|
-
})] }) : null,
|
|
584
|
-
j === "off" && E ? /* @__PURE__ */ _("button", {
|
|
585
|
-
class: "ck-chip",
|
|
586
|
-
style: { marginTop: "8px" },
|
|
587
|
-
onClick: () => M("ready"),
|
|
588
|
-
children: [/* @__PURE__ */ _(C, {
|
|
589
|
-
name: "image",
|
|
590
|
-
size: 14
|
|
591
|
-
}), n("screenshotAdd")]
|
|
592
|
-
}) : null,
|
|
593
|
-
W ? /* @__PURE__ */ _("label", {
|
|
594
|
-
class: "ck-check",
|
|
595
|
-
children: [/* @__PURE__ */ _("input", {
|
|
596
|
-
type: "checkbox",
|
|
597
|
-
checked: G,
|
|
598
|
-
onChange: (e) => ae(e.target.checked)
|
|
599
|
-
}), n("includeDiagnostics")]
|
|
600
|
-
}) : null,
|
|
601
|
-
/* @__PURE__ */ _(fe, {
|
|
602
|
-
files: L,
|
|
603
|
-
onRemove: (e) => R(L.filter((t) => t !== e))
|
|
604
|
-
})
|
|
605
|
-
]
|
|
606
|
-
}),
|
|
607
|
-
/* @__PURE__ */ _("div", {
|
|
608
|
-
class: "ck-card-foot",
|
|
609
|
-
children: [
|
|
610
|
-
/* @__PURE__ */ _(pe, {
|
|
611
|
-
input: ye,
|
|
612
|
-
onFiles: Se
|
|
613
|
-
}),
|
|
614
|
-
/* @__PURE__ */ _("span", { class: "ck-spacer" }),
|
|
615
|
-
/* @__PURE__ */ _("button", {
|
|
616
|
-
class: "ck-btn",
|
|
617
|
-
onClick: o,
|
|
618
|
-
children: n("cancel")
|
|
619
|
-
}),
|
|
620
|
-
/* @__PURE__ */ _("button", {
|
|
621
|
-
class: "ck-btn ck-primary",
|
|
622
|
-
disabled: z || !g.trim() || !q,
|
|
623
|
-
onClick: () => void $(),
|
|
624
|
-
children: n(z ? "sending" : J && !r ? "signIn" : "send")
|
|
625
|
-
})
|
|
626
|
-
]
|
|
627
|
-
}),
|
|
628
|
-
F && E ? /* @__PURE__ */ _(F, {
|
|
629
|
-
image: E.blob,
|
|
630
|
-
onCancel: () => I(null),
|
|
631
|
-
onDone: (e, t) => {
|
|
632
|
-
O({
|
|
633
|
-
...E,
|
|
634
|
-
blob: e
|
|
635
|
-
}), P(t), I(null);
|
|
636
|
-
}
|
|
637
|
-
}) : null
|
|
638
|
-
]
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
function ue(e) {
|
|
642
|
-
return e instanceof s ? e.code === "widget_disabled" ? n("paused") : e.code === "plan_required" ? n("readOnlyGuest") : e.status >= 400 && e.status < 500 && e.status !== 408 && e.status !== 429 ? e.message : null : null;
|
|
643
|
-
}
|
|
644
|
-
function de(e, t) {
|
|
645
|
-
return B(e.options.project, l(), t.type, t.selector, t.ck_id, t.source, t.quote);
|
|
646
|
-
}
|
|
647
|
-
function fe({ files: e, onRemove: t }) {
|
|
648
|
-
return e.length ? /* @__PURE__ */ _("div", {
|
|
649
|
-
class: "ck-files",
|
|
650
|
-
children: e.map((e) => /* @__PURE__ */ _("span", {
|
|
651
|
-
class: "ck-file",
|
|
652
|
-
children: [
|
|
653
|
-
/* @__PURE__ */ _("bdi", { children: e.name }),
|
|
654
|
-
" ",
|
|
655
|
-
/* @__PURE__ */ _("button", {
|
|
656
|
-
class: "ck-ghost",
|
|
657
|
-
"aria-label": n("removeFile", { name: e.name }),
|
|
658
|
-
onClick: () => t(e),
|
|
659
|
-
children: "×"
|
|
660
|
-
})
|
|
661
|
-
]
|
|
662
|
-
}))
|
|
663
|
-
}) : null;
|
|
664
|
-
}
|
|
665
|
-
function pe({ input: e, onFiles: t }) {
|
|
666
|
-
return /* @__PURE__ */ _(D, { children: [/* @__PURE__ */ _("input", {
|
|
667
|
-
ref: e,
|
|
668
|
-
type: "file",
|
|
669
|
-
multiple: !0,
|
|
670
|
-
hidden: !0,
|
|
671
|
-
accept: G,
|
|
672
|
-
onChange: (e) => {
|
|
673
|
-
let n = e.target;
|
|
674
|
-
t(Array.from(n.files ?? [])), n.value = "";
|
|
675
|
-
}
|
|
676
|
-
}), /* @__PURE__ */ _("button", {
|
|
677
|
-
class: "ck-ghost",
|
|
678
|
-
onClick: () => e.current?.click(),
|
|
679
|
-
"aria-label": n("attach"),
|
|
680
|
-
title: n("attach"),
|
|
681
|
-
children: /* @__PURE__ */ _(C, { name: "paperclip" })
|
|
682
|
-
})] });
|
|
683
|
-
}
|
|
684
|
-
function me(e) {
|
|
685
|
-
let t = Math.min(380, innerWidth - 24), n = Math.min(Math.max(12, e.x + 16), innerWidth - t - 12), r = e.y + 16;
|
|
686
|
-
return innerHeight - r > 360 ? {
|
|
687
|
-
left: `${n}px`,
|
|
688
|
-
top: `${r}px`
|
|
689
|
-
} : {
|
|
690
|
-
left: `${n}px`,
|
|
691
|
-
bottom: `${Math.max(12, innerHeight - e.y + 16)}px`
|
|
692
|
-
};
|
|
693
|
-
}
|
|
694
|
-
function he(e, t) {
|
|
695
|
-
try {
|
|
696
|
-
sessionStorage.setItem(e, t);
|
|
697
|
-
} catch {}
|
|
698
|
-
}
|
|
699
|
-
function ge(e) {
|
|
700
|
-
try {
|
|
701
|
-
sessionStorage.removeItem(e);
|
|
702
|
-
} catch {}
|
|
703
|
-
}
|
|
704
|
-
//#endregion
|
|
705
|
-
//#region src/ui/nav.ts
|
|
706
|
-
function Z(e, t, n) {
|
|
707
|
-
let r = x(e);
|
|
708
|
-
if (!r || !/^https?:$/.test(new URL(r).protocol) || _e(r)) return n(t);
|
|
709
|
-
let i = new URL(r);
|
|
710
|
-
i.searchParams.set("ck_thread", t), location.assign(i.toString());
|
|
711
|
-
}
|
|
712
|
-
function _e(e) {
|
|
713
|
-
try {
|
|
714
|
-
let t = new URL(e), n = new URL(l());
|
|
715
|
-
return t.origin === n.origin && t.pathname === n.pathname && t.search === n.search && (t.hash === n.hash || !t.hash.startsWith("#/"));
|
|
716
|
-
} catch {
|
|
717
|
-
return !1;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
//#endregion
|
|
721
|
-
//#region src/ui/Launcher.tsx
|
|
722
|
-
function ve({ client: e, position: t, commenting: r, panelOpen: i, onComment: a, onPanel: o, onSignIn: s, onSignOut: c, onShortcuts: l, waiting: u, onCode: d, covered: f }) {
|
|
723
|
-
let p = K(e.state, (e) => e.config?.read_only ?? !1), m = K(e.state, (e) => e.session), h = K(e.state, (e) => e.unread);
|
|
724
|
-
K(e.state, (e) => e.threads.length);
|
|
725
|
-
let [g, v] = b(!1);
|
|
726
|
-
return /* @__PURE__ */ _("div", {
|
|
727
|
-
class: "ck-launcher",
|
|
728
|
-
"data-pos": t,
|
|
729
|
-
"data-covered": f,
|
|
730
|
-
"data-commentkit-ui": !0,
|
|
731
|
-
children: [
|
|
732
|
-
g ? null : u ? /* @__PURE__ */ _("div", {
|
|
733
|
-
class: "ck-note ck-launcher-note",
|
|
734
|
-
role: "status",
|
|
735
|
-
children: [
|
|
736
|
-
n("pendingNote", { email: u }),
|
|
737
|
-
" ",
|
|
738
|
-
/* @__PURE__ */ _("button", {
|
|
739
|
-
class: "ck-btn",
|
|
740
|
-
onClick: d,
|
|
741
|
-
children: n("enterCode")
|
|
742
|
-
})
|
|
743
|
-
]
|
|
744
|
-
}) : p ? /* @__PURE__ */ _("div", {
|
|
745
|
-
class: "ck-note ck-launcher-note",
|
|
746
|
-
role: "status",
|
|
747
|
-
children: n("readOnlyShort")
|
|
748
|
-
}) : null,
|
|
749
|
-
/* @__PURE__ */ _("div", {
|
|
750
|
-
class: "ck-bar",
|
|
751
|
-
role: "toolbar",
|
|
752
|
-
"aria-label": "CommentKit",
|
|
753
|
-
children: [
|
|
754
|
-
/* @__PURE__ */ _("button", {
|
|
755
|
-
class: "ck-bar-btn",
|
|
756
|
-
"aria-pressed": r,
|
|
757
|
-
onClick: a,
|
|
758
|
-
title: n("commentHint"),
|
|
759
|
-
"aria-keyshortcuts": l ? "C" : void 0,
|
|
760
|
-
children: [/* @__PURE__ */ _(C, { name: "comment" }), /* @__PURE__ */ _("span", {
|
|
761
|
-
class: "ck-label",
|
|
762
|
-
children: n("comment")
|
|
763
|
-
})]
|
|
764
|
-
}),
|
|
765
|
-
m ? /* @__PURE__ */ _("button", {
|
|
766
|
-
class: "ck-bar-btn ck-icon-btn",
|
|
767
|
-
"aria-pressed": i,
|
|
768
|
-
onClick: o,
|
|
769
|
-
title: n("inbox"),
|
|
770
|
-
"aria-label": `${n("inbox")}${h ? ` (${h})` : ""}`,
|
|
771
|
-
children: [/* @__PURE__ */ _(C, { name: "inbox" }), h > 0 ? /* @__PURE__ */ _("span", {
|
|
772
|
-
class: "ck-badge",
|
|
773
|
-
children: h > 99 ? "99+" : h
|
|
774
|
-
}) : null]
|
|
775
|
-
}) : null,
|
|
776
|
-
/* @__PURE__ */ _("button", {
|
|
777
|
-
class: "ck-bar-btn ck-icon-btn",
|
|
778
|
-
"aria-haspopup": "menu",
|
|
779
|
-
"aria-expanded": g,
|
|
780
|
-
onClick: () => v(!g),
|
|
781
|
-
"aria-label": n("more"),
|
|
782
|
-
children: /* @__PURE__ */ _(C, { name: "more" })
|
|
783
|
-
})
|
|
784
|
-
]
|
|
785
|
-
}),
|
|
786
|
-
g ? /* @__PURE__ */ _("div", {
|
|
787
|
-
class: "ck-menu",
|
|
788
|
-
role: "menu",
|
|
789
|
-
onClick: () => v(!1),
|
|
790
|
-
onKeyDown: (e) => e.key === "Escape" ? (e.stopPropagation(), v(!1)) : J(e, "[role=menuitem]", !0),
|
|
791
|
-
children: [m ? /* @__PURE__ */ _(D, { children: [/* @__PURE__ */ _("div", {
|
|
792
|
-
class: "ck-muted",
|
|
793
|
-
style: { padding: "6px 10px" },
|
|
794
|
-
children: [
|
|
795
|
-
m.person.name,
|
|
796
|
-
" · ",
|
|
797
|
-
m.project.name
|
|
798
|
-
]
|
|
799
|
-
}), /* @__PURE__ */ _("button", {
|
|
800
|
-
role: "menuitem",
|
|
801
|
-
onClick: c,
|
|
802
|
-
children: n("signOut")
|
|
803
|
-
})] }) : /* @__PURE__ */ _("button", {
|
|
804
|
-
role: "menuitem",
|
|
805
|
-
onClick: s,
|
|
806
|
-
children: n("signInMember")
|
|
807
|
-
}), l ? /* @__PURE__ */ _("button", {
|
|
808
|
-
role: "menuitem",
|
|
809
|
-
"aria-keyshortcuts": "?",
|
|
810
|
-
onClick: l,
|
|
811
|
-
children: n("shortcutsTitle")
|
|
812
|
-
}) : null]
|
|
813
|
-
}) : null
|
|
814
|
-
]
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
function ye({ onCancel: e, onPick: t }) {
|
|
818
|
-
let [r] = b(() => {
|
|
819
|
-
let e = document.activeElement;
|
|
820
|
-
return e && e !== document.body && e !== document.documentElement && !u(e) ? e : null;
|
|
821
|
-
}), i = S(() => matchMedia("(pointer: coarse)").matches, []), [a, o] = b(null), [s, c] = b(null), l = w(null), d = w(null);
|
|
822
|
-
v(() => d.current?.focus({ preventScroll: !0 }), []);
|
|
823
|
-
let p = w(null), m = w({
|
|
824
|
-
timer: null,
|
|
825
|
-
fired: !1
|
|
826
|
-
}), g = () => {
|
|
827
|
-
m.current.timer && clearTimeout(m.current.timer), m.current.timer = null;
|
|
828
|
-
};
|
|
829
|
-
v(() => g, []), v(() => {
|
|
830
|
-
let e = getSelection(), n = e?.toString().trim();
|
|
831
|
-
if (e && n && e.rangeCount && !u(e.anchorNode?.parentElement ?? null)) {
|
|
832
|
-
let r = e.getRangeAt(0), i = r.getBoundingClientRect(), a = r.commonAncestorContainer instanceof Element ? r.commonAncestorContainer : r.commonAncestorContainer.parentElement;
|
|
833
|
-
t({
|
|
834
|
-
anchor: f({
|
|
835
|
-
element: a,
|
|
836
|
-
clientX: i.left,
|
|
837
|
-
clientY: i.top,
|
|
838
|
-
quote: n
|
|
839
|
-
}),
|
|
840
|
-
point: {
|
|
841
|
-
x: i.left,
|
|
842
|
-
y: i.bottom
|
|
843
|
-
},
|
|
844
|
-
region: {
|
|
845
|
-
x: i.left,
|
|
846
|
-
y: i.top,
|
|
847
|
-
w: i.width,
|
|
848
|
-
h: i.height
|
|
849
|
-
}
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
|
-
}, []);
|
|
853
|
-
let y = (e, t) => {
|
|
854
|
-
let n = l.current;
|
|
855
|
-
if (!n) return null;
|
|
856
|
-
n.style.pointerEvents = "none";
|
|
857
|
-
let r = document.elementsFromPoint(e, t).find((e) => !u(e) && e !== document.documentElement && e !== document.body) ?? document.body;
|
|
858
|
-
return n.style.pointerEvents = "auto", r;
|
|
859
|
-
}, x = (e) => {
|
|
860
|
-
let n = e.getBoundingClientRect(), r = n.left + Math.min(n.width / 2, 24), i = n.top + Math.min(n.height / 2, 24);
|
|
861
|
-
t({
|
|
862
|
-
anchor: f({
|
|
863
|
-
element: e,
|
|
864
|
-
clientX: r,
|
|
865
|
-
clientY: i
|
|
866
|
-
}),
|
|
867
|
-
point: {
|
|
868
|
-
x: r,
|
|
869
|
-
y: n.bottom
|
|
870
|
-
},
|
|
871
|
-
region: null
|
|
872
|
-
});
|
|
873
|
-
}, C = () => {
|
|
874
|
-
t({
|
|
875
|
-
anchor: {
|
|
876
|
-
type: "page",
|
|
877
|
-
page: {
|
|
878
|
-
x: 50,
|
|
879
|
-
y: Math.round(scrollY + Math.min(120, innerHeight / 3))
|
|
880
|
-
}
|
|
881
|
-
},
|
|
882
|
-
point: {
|
|
883
|
-
x: innerWidth / 2,
|
|
884
|
-
y: Math.min(120, innerHeight / 3)
|
|
885
|
-
},
|
|
886
|
-
region: null
|
|
887
|
-
});
|
|
888
|
-
};
|
|
889
|
-
return v(() => {
|
|
890
|
-
let t = (t) => {
|
|
891
|
-
t.key === "Escape" ? e() : t.key === "Enter" && !t.composedPath().some((e) => e instanceof HTMLButtonElement) && (t.preventDefault(), r ? x(r) : C());
|
|
892
|
-
};
|
|
893
|
-
return addEventListener("keydown", t), () => removeEventListener("keydown", t);
|
|
894
|
-
}, [e]), /* @__PURE__ */ _(D, { children: [
|
|
895
|
-
/* @__PURE__ */ _("div", {
|
|
896
|
-
class: "ck-mode-hint",
|
|
897
|
-
role: "toolbar",
|
|
898
|
-
"aria-label": n("comment"),
|
|
899
|
-
"data-commentkit-ui": !0,
|
|
900
|
-
children: [
|
|
901
|
-
/* @__PURE__ */ _("span", {
|
|
902
|
-
role: "status",
|
|
903
|
-
children: n(i ? "modeBarTouch" : "modeBar")
|
|
904
|
-
}),
|
|
905
|
-
r ? /* @__PURE__ */ _("button", {
|
|
906
|
-
class: "ck-chip",
|
|
907
|
-
ref: d,
|
|
908
|
-
onClick: () => x(r),
|
|
909
|
-
children: n("commentFocused")
|
|
910
|
-
}) : null,
|
|
911
|
-
/* @__PURE__ */ _("button", {
|
|
912
|
-
class: "ck-chip",
|
|
913
|
-
ref: r ? void 0 : d,
|
|
914
|
-
onClick: C,
|
|
915
|
-
children: n("commentOnPage")
|
|
916
|
-
})
|
|
917
|
-
]
|
|
918
|
-
}),
|
|
919
|
-
/* @__PURE__ */ _("div", {
|
|
920
|
-
ref: l,
|
|
921
|
-
class: "ck-catcher",
|
|
922
|
-
"data-commentkit-ui": !0,
|
|
923
|
-
onPointerMove: (e) => {
|
|
924
|
-
if (e.pointerType === "touch") {
|
|
925
|
-
let t = p.current;
|
|
926
|
-
t && (Math.abs(e.clientX - t.x) > 8 || Math.abs(e.clientY - t.y) > 8) && g();
|
|
927
|
-
return;
|
|
928
|
-
}
|
|
929
|
-
if (p.current) {
|
|
930
|
-
c({
|
|
931
|
-
x: p.current.x,
|
|
932
|
-
y: p.current.y,
|
|
933
|
-
x2: e.clientX,
|
|
934
|
-
y2: e.clientY
|
|
935
|
-
});
|
|
936
|
-
return;
|
|
937
|
-
}
|
|
938
|
-
let t = y(e.clientX, e.clientY);
|
|
939
|
-
o(t ? t.getBoundingClientRect() : null);
|
|
940
|
-
},
|
|
941
|
-
onPointerDown: (e) => {
|
|
942
|
-
if (e.button !== 0) return;
|
|
943
|
-
let n = y(e.clientX, e.clientY);
|
|
944
|
-
n && (p.current = {
|
|
945
|
-
x: e.clientX,
|
|
946
|
-
y: e.clientY,
|
|
947
|
-
target: n
|
|
948
|
-
}, m.current.fired = !1, e.pointerType === "touch" && (g(), m.current.timer = setTimeout(() => {
|
|
949
|
-
let e = p.current;
|
|
950
|
-
m.current.timer = null, e && (m.current.fired = !0, p.current = null, Q(e.x, e.y), t({
|
|
951
|
-
anchor: f({
|
|
952
|
-
element: e.target,
|
|
953
|
-
clientX: e.x,
|
|
954
|
-
clientY: e.y
|
|
955
|
-
}),
|
|
956
|
-
point: {
|
|
957
|
-
x: e.x,
|
|
958
|
-
y: e.y
|
|
959
|
-
},
|
|
960
|
-
region: null
|
|
961
|
-
}));
|
|
962
|
-
}, 500)), e.pointerType !== "touch" && l.current?.setPointerCapture(e.pointerId));
|
|
963
|
-
},
|
|
964
|
-
onPointerUp: (e) => {
|
|
965
|
-
g();
|
|
966
|
-
let n = p.current;
|
|
967
|
-
if (p.current = null, c(null), !n) return;
|
|
968
|
-
let r = Math.abs(e.clientX - n.x) > 8 || Math.abs(e.clientY - n.y) > 8;
|
|
969
|
-
if (e.pointerType === "touch" && r) return;
|
|
970
|
-
e.pointerType === "touch" && Q(e.clientX, e.clientY);
|
|
971
|
-
let i = e.pointerType !== "touch" && Math.abs(e.clientX - n.x) > 8 && Math.abs(e.clientY - n.y) > 8, a = i ? be(n.target, y(e.clientX, e.clientY) ?? n.target) : n.target;
|
|
972
|
-
t({
|
|
973
|
-
anchor: f({
|
|
974
|
-
element: a,
|
|
975
|
-
clientX: n.x,
|
|
976
|
-
clientY: n.y,
|
|
977
|
-
...i ? {
|
|
978
|
-
endX: e.clientX,
|
|
979
|
-
endY: e.clientY
|
|
980
|
-
} : {}
|
|
981
|
-
}),
|
|
982
|
-
point: {
|
|
983
|
-
x: i ? Math.max(n.x, e.clientX) : e.clientX,
|
|
984
|
-
y: i ? Math.max(n.y, e.clientY) : e.clientY
|
|
985
|
-
},
|
|
986
|
-
region: i ? {
|
|
987
|
-
x: Math.min(n.x, e.clientX),
|
|
988
|
-
y: Math.min(n.y, e.clientY),
|
|
989
|
-
w: Math.abs(e.clientX - n.x),
|
|
990
|
-
h: Math.abs(e.clientY - n.y)
|
|
991
|
-
} : null
|
|
992
|
-
});
|
|
993
|
-
},
|
|
994
|
-
onPointerCancel: () => {
|
|
995
|
-
g(), p.current = null, c(null);
|
|
996
|
-
},
|
|
997
|
-
onContextMenu: (t) => {
|
|
998
|
-
t.preventDefault(), !m.current.timer && !m.current.fired && !i && e();
|
|
999
|
-
}
|
|
1000
|
-
}),
|
|
1001
|
-
a && !s ? /* @__PURE__ */ _("div", {
|
|
1002
|
-
class: "ck-outline",
|
|
1003
|
-
style: h(a.left - 2, a.top - 2, a.width + 4, a.height + 4)
|
|
1004
|
-
}) : null,
|
|
1005
|
-
s ? /* @__PURE__ */ _("div", {
|
|
1006
|
-
class: "ck-region",
|
|
1007
|
-
style: h(Math.min(s.x, s.x2), Math.min(s.y, s.y2), Math.abs(s.x2 - s.x), Math.abs(s.y2 - s.y))
|
|
1008
|
-
}) : null
|
|
1009
|
-
] });
|
|
1010
|
-
}
|
|
1011
|
-
function Q(e, t) {
|
|
1012
|
-
let n = (r) => {
|
|
1013
|
-
Math.abs(r.clientX - e) > 24 || Math.abs(r.clientY - t) > 24 || (r.preventDefault(), r.stopPropagation(), removeEventListener("click", n, !0));
|
|
1014
|
-
};
|
|
1015
|
-
addEventListener("click", n, !0), setTimeout(() => removeEventListener("click", n, !0), 700);
|
|
1016
|
-
}
|
|
1017
|
-
function be(e, t) {
|
|
1018
|
-
if (e.contains(t)) return e;
|
|
1019
|
-
for (let n = t; n; n = n.parentElement) if (n.contains(e)) return n;
|
|
1020
|
-
return document.body;
|
|
1021
|
-
}
|
|
1022
|
-
//#endregion
|
|
1023
|
-
//#region src/ui/Pins.tsx
|
|
1024
|
-
function xe({ client: e, activeId: t, onOpen: n }) {
|
|
1025
|
-
let r = K(e.state, (e) => e.threads);
|
|
1026
|
-
return q(r.length > 0), /* @__PURE__ */ _("div", {
|
|
1027
|
-
class: "ck-pins",
|
|
1028
|
-
"data-commentkit-ui": !0,
|
|
1029
|
-
children: r.map((e) => {
|
|
1030
|
-
let r = d(e.anchor);
|
|
1031
|
-
return r.state === "detached" ? null : /* @__PURE__ */ _(D, { children: [r.rect && e.id === t ? /* @__PURE__ */ _("div", {
|
|
1032
|
-
class: "ck-pin-region",
|
|
1033
|
-
style: h(r.rect.x, r.rect.y, r.rect.w, r.rect.h)
|
|
1034
|
-
}) : null, /* @__PURE__ */ _("button", {
|
|
1035
|
-
class: "ck-pin",
|
|
1036
|
-
style: h(r.point.x, r.point.y),
|
|
1037
|
-
"data-status": e.status,
|
|
1038
|
-
"data-state": r.state,
|
|
1039
|
-
"aria-expanded": e.id === t,
|
|
1040
|
-
"aria-label": `${e.reference}: ${e.first_message?.body.slice(0, 80) ?? ""}`,
|
|
1041
|
-
onClick: () => n(e),
|
|
1042
|
-
children: /* @__PURE__ */ _("span", { children: e.number })
|
|
1043
|
-
})] });
|
|
1044
|
-
})
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1047
|
-
//#endregion
|
|
1048
|
-
//#region src/ui/Welcome.tsx
|
|
1049
|
-
function Se({ position: e, project: t, onStart: r, onDismiss: i }) {
|
|
1050
|
-
let a = e.startsWith("top") ? { top: "76px" } : { bottom: "76px" };
|
|
1051
|
-
return a[e.endsWith("left") ? "left" : "right"] = "20px", /* @__PURE__ */ _("div", {
|
|
1052
|
-
class: "ck-welcome",
|
|
1053
|
-
style: a,
|
|
1054
|
-
role: "region",
|
|
1055
|
-
"aria-labelledby": "ck-welcome-title",
|
|
1056
|
-
"data-commentkit-ui": !0,
|
|
1057
|
-
children: [
|
|
1058
|
-
/* @__PURE__ */ _("h2", {
|
|
1059
|
-
id: "ck-welcome-title",
|
|
1060
|
-
children: n("welcomeTitle", { project: t })
|
|
1061
|
-
}),
|
|
1062
|
-
/* @__PURE__ */ _("p", { children: n(matchMedia("(pointer: coarse)").matches ? "welcomeBodyTouch" : "welcomeBody") }),
|
|
1063
|
-
/* @__PURE__ */ _("div", {
|
|
1064
|
-
style: {
|
|
1065
|
-
display: "flex",
|
|
1066
|
-
gap: "8px"
|
|
1067
|
-
},
|
|
1068
|
-
children: [/* @__PURE__ */ _("button", {
|
|
1069
|
-
class: "ck-btn ck-primary",
|
|
1070
|
-
onClick: r,
|
|
1071
|
-
children: n("comment")
|
|
1072
|
-
}), /* @__PURE__ */ _("button", {
|
|
1073
|
-
class: "ck-btn",
|
|
1074
|
-
onClick: i,
|
|
1075
|
-
children: n("gotIt")
|
|
1076
|
-
})]
|
|
1077
|
-
})
|
|
1078
|
-
]
|
|
1079
|
-
});
|
|
1080
|
-
}
|
|
1081
|
-
//#endregion
|
|
1082
|
-
//#region src/ui/App.tsx
|
|
1083
|
-
var Ce = "commentkit:share", $ = "commentkit:welcomed";
|
|
1084
|
-
function we({ client: e }) {
|
|
1085
|
-
return K(e.state, (e) => e.config?.enabled !== !1) ? /* @__PURE__ */ _(Te, { client: e }) : /* @__PURE__ */ _("div", {
|
|
1086
|
-
class: "ck-toast",
|
|
1087
|
-
role: "status",
|
|
1088
|
-
children: n("paused")
|
|
1089
|
-
});
|
|
1090
|
-
}
|
|
1091
|
-
function Te({ client: e }) {
|
|
1092
|
-
let t = K(e.state, (e) => e.config), r = K(e.state, (e) => e.session), [i, a] = b({ name: "idle" }), [o, c] = b(null), [l, u] = b(!1), [d, f] = b(null), [p, m] = b(null);
|
|
1093
|
-
v(() => {
|
|
1094
|
-
l && !p && import("./Shortcuts-CHMcrjAM.js").then((e) => m(() => e.Shortcuts), N);
|
|
1095
|
-
}, [l]);
|
|
1096
|
-
let [h, g] = b(null), [x, S] = b(null), C = K(e.state, (e) => e.opening), [T] = b(() => ke()), [E, ee] = b(() => !!T && !je($)), O = w(null), [k, te] = b(null), A = e.options.shortcuts !== !1;
|
|
1097
|
-
v(() => {
|
|
1098
|
-
if (i.name === "idle") {
|
|
1099
|
-
let e = O.current;
|
|
1100
|
-
O.current = null, e?.isConnected && e.focus({ preventScroll: !0 });
|
|
1101
|
-
}
|
|
1102
|
-
}, [i.name]);
|
|
1103
|
-
let j = (e) => {
|
|
1104
|
-
if (i.name === "idle") {
|
|
1105
|
-
let e = document.querySelector("[data-commentkit-host]")?.shadowRoot?.activeElement;
|
|
1106
|
-
O.current = e instanceof HTMLElement ? e : null;
|
|
1107
|
-
}
|
|
1108
|
-
a(e);
|
|
1109
|
-
}, M = y((e) => {
|
|
1110
|
-
c(e), setTimeout(() => c((t) => t === e ? null : t), e.tone === "error" || e.action ? 6e3 : 3500);
|
|
1111
|
-
}, []), N = y((t) => {
|
|
1112
|
-
let r = e.auth.pending();
|
|
1113
|
-
if (t instanceof s && t.code === "verification_required" && r) return a({
|
|
1114
|
-
name: "verify",
|
|
1115
|
-
email: r.email,
|
|
1116
|
-
draft: null
|
|
1117
|
-
});
|
|
1118
|
-
M({
|
|
1119
|
-
text: t instanceof s ? t.message : n("errorGeneric"),
|
|
1120
|
-
tone: "error"
|
|
1121
|
-
});
|
|
1122
|
-
}, [M]);
|
|
1123
|
-
v(() => {
|
|
1124
|
-
if (!r) return;
|
|
1125
|
-
let t = () => e.loadPageThreads().catch(N);
|
|
1126
|
-
return t(), e.inbox().catch(() => void 0), e.connectRealtime((t) => {
|
|
1127
|
-
t.type === "thread.deleted" ? e.state.set((e) => ({ threads: e.threads.filter((e) => e.id !== t.thread_id) })) : e.refreshThread(t.thread_id);
|
|
1128
|
-
}).catch(() => void 0), Ae(t);
|
|
1129
|
-
}, [
|
|
1130
|
-
e,
|
|
1131
|
-
r,
|
|
1132
|
-
N
|
|
1133
|
-
]), v(() => {
|
|
1134
|
-
let e = new URL(location.href), t = e.searchParams.get("ck_thread");
|
|
1135
|
-
t && /^[0-9a-f-]{36}$/i.test(t) && (e.searchParams.delete("ck_thread"), history.replaceState(history.state, "", e.toString()), r ? a({
|
|
1136
|
-
name: "thread",
|
|
1137
|
-
threadId: t
|
|
1138
|
-
}) : Me("commentkit:pending-thread", t));
|
|
1139
|
-
}, [r]), v(() => {
|
|
1140
|
-
if (!r) return;
|
|
1141
|
-
let e = null;
|
|
1142
|
-
try {
|
|
1143
|
-
e = JSON.parse(sessionStorage.getItem("commentkit:pending-compose") ?? "null"), sessionStorage.removeItem(le);
|
|
1144
|
-
} catch {
|
|
1145
|
-
e = null;
|
|
1146
|
-
}
|
|
1147
|
-
e?.draft?.anchor && (scrollTo({
|
|
1148
|
-
top: e.scrollY,
|
|
1149
|
-
behavior: "auto"
|
|
1150
|
-
}), a({
|
|
1151
|
-
name: "composing",
|
|
1152
|
-
draft: e.draft
|
|
1153
|
-
}));
|
|
1154
|
-
}, [r]), v(() => {
|
|
1155
|
-
if (!r) return;
|
|
1156
|
-
let e = je("commentkit:pending-thread");
|
|
1157
|
-
e && (Ne("commentkit:pending-thread"), a({
|
|
1158
|
-
name: "thread",
|
|
1159
|
-
threadId: e
|
|
1160
|
-
}));
|
|
1161
|
-
}, [r]), v(() => {
|
|
1162
|
-
let t = e.auth.pending();
|
|
1163
|
-
!r && t && a({
|
|
1164
|
-
name: "verify",
|
|
1165
|
-
email: t.email,
|
|
1166
|
-
draft: null
|
|
1167
|
-
});
|
|
1168
|
-
}, []), v(() => {
|
|
1169
|
-
i.name === "verify" && !d && import("./Guest-CKoV6pEK.js").then((e) => f(() => e.GuestVerify), N);
|
|
1170
|
-
}, [i.name]), v(() => {
|
|
1171
|
-
i.name === "panel" && !h && import("./Panel-BRBDHlGg.js").then((e) => g(() => e.Panel), N), i.name === "thread" && !x && import("./ThreadCard-D8FzIxbs.js").then((e) => S(() => e.ThreadCard), N);
|
|
1172
|
-
}, [i.name]), v(() => {
|
|
1173
|
-
if (!C || !r) return;
|
|
1174
|
-
if (e.state.set({ opening: null }), /^[0-9a-f-]{36}$/i.test(C)) return R(C);
|
|
1175
|
-
let t = C.trim().toUpperCase(), i = e.state.get().threads.find((e) => e.reference.toUpperCase() === t);
|
|
1176
|
-
if (i) return R(i);
|
|
1177
|
-
e.listThreads({
|
|
1178
|
-
q: t,
|
|
1179
|
-
status: "all",
|
|
1180
|
-
limit: 5
|
|
1181
|
-
}).then((e) => {
|
|
1182
|
-
let r = e.data.find((e) => e.reference.toUpperCase() === t);
|
|
1183
|
-
r ? Z(r.page.url, r.id, R) : M({
|
|
1184
|
-
text: n("threadNotFound"),
|
|
1185
|
-
tone: "error"
|
|
1186
|
-
});
|
|
1187
|
-
}, N);
|
|
1188
|
-
}, [C, r]), v(() => {
|
|
1189
|
-
let t = (t) => {
|
|
1190
|
-
if (!(t.defaultPrevented || Oe(t) || Ee(t) || !A && t.key !== "Escape")) {
|
|
1191
|
-
if (l) t.key === "Escape" && u(!1);
|
|
1192
|
-
else if (t.key === "?" && !t.metaKey && !t.ctrlKey && !t.altKey) t.preventDefault(), u(!0);
|
|
1193
|
-
else if (t.key === "Escape" && i.name !== "idle") t.preventDefault(), a({ name: "idle" });
|
|
1194
|
-
else if ((t.key === "c" || t.key === "C") && !t.metaKey && !t.ctrlKey && !t.altKey && i.name === "idle") t.preventDefault(), L();
|
|
1195
|
-
else if ((t.key === "j" || t.key === "k") && !t.metaKey && !t.ctrlKey && !t.altKey && r && (i.name === "idle" || i.name === "thread")) {
|
|
1196
|
-
let n = e.state.get().threads;
|
|
1197
|
-
if (!n.length || De(t)) return;
|
|
1198
|
-
t.preventDefault();
|
|
1199
|
-
let r = i.name === "thread" ? n.findIndex((e) => e.id === i.threadId) : -1, a = n[(r + (t.key === "j" ? 1 : n.length - 1 + +(r < 0))) % n.length];
|
|
1200
|
-
a && R(a);
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
};
|
|
1204
|
-
return addEventListener("keydown", t, !0), () => removeEventListener("keydown", t, !0);
|
|
1205
|
-
});
|
|
1206
|
-
let P = t?.read_only ?? !1, F = n(r && r.role !== "guest" ? "readOnly" : "readOnlyGuest"), I = !r && i.name === "idle" ? e.auth.pending() : null, L = () => {
|
|
1207
|
-
if (P) return M({
|
|
1208
|
-
text: F,
|
|
1209
|
-
tone: "error"
|
|
1210
|
-
});
|
|
1211
|
-
ee(!1), j({ name: "commenting" });
|
|
1212
|
-
}, R = (e) => j({
|
|
1213
|
-
name: "thread",
|
|
1214
|
-
threadId: typeof e == "string" ? e : e.id
|
|
1215
|
-
}), z = async () => {
|
|
1216
|
-
let t = await e.signIn(T);
|
|
1217
|
-
return t === "signed_in" || (t === "redirecting" || M({
|
|
1218
|
-
text: n(t === "popup_blocked" ? "popupBlocked" : "signInCancelled"),
|
|
1219
|
-
tone: "error"
|
|
1220
|
-
}), !1);
|
|
1221
|
-
}, B = e.options.position ?? t?.appearance.position ?? "bottom-right";
|
|
1222
|
-
return /* @__PURE__ */ _(D, { children: [
|
|
1223
|
-
r ? /* @__PURE__ */ _(xe, {
|
|
1224
|
-
client: e,
|
|
1225
|
-
activeId: i.name === "thread" ? i.threadId : null,
|
|
1226
|
-
onOpen: R
|
|
1227
|
-
}) : null,
|
|
1228
|
-
i.name === "commenting" ? /* @__PURE__ */ _(ye, {
|
|
1229
|
-
onCancel: () => a({ name: "idle" }),
|
|
1230
|
-
onPick: (e) => a({
|
|
1231
|
-
name: "composing",
|
|
1232
|
-
draft: e
|
|
1233
|
-
})
|
|
1234
|
-
}) : null,
|
|
1235
|
-
i.name === "composing" ? /* @__PURE__ */ _(X, {
|
|
1236
|
-
client: e,
|
|
1237
|
-
draft: i.draft,
|
|
1238
|
-
signedIn: !!r,
|
|
1239
|
-
onSignIn: z,
|
|
1240
|
-
onCancel: () => a({ name: "idle" }),
|
|
1241
|
-
onSent: (e) => {
|
|
1242
|
-
M({ text: r?.role === "guest" || !r ? n("sentGuest") : n("sent") }), R(e);
|
|
1243
|
-
},
|
|
1244
|
-
share: T,
|
|
1245
|
-
onPending: (e) => {
|
|
1246
|
-
te(i.draft), a({
|
|
1247
|
-
name: "verify",
|
|
1248
|
-
email: e,
|
|
1249
|
-
draft: i.draft
|
|
1250
|
-
});
|
|
1251
|
-
},
|
|
1252
|
-
onError: N
|
|
1253
|
-
}) : null,
|
|
1254
|
-
i.name === "verify" && d ? /* @__PURE__ */ _(d, {
|
|
1255
|
-
client: e,
|
|
1256
|
-
email: i.email,
|
|
1257
|
-
onDone: (t) => {
|
|
1258
|
-
i.draft && re(de(e, i.draft.anchor)), M({ text: n("sentGuest") }), t[0] ? R(t[0]) : a({ name: "idle" });
|
|
1259
|
-
},
|
|
1260
|
-
onDifferentEmail: () => a(i.draft ? {
|
|
1261
|
-
name: "composing",
|
|
1262
|
-
draft: i.draft
|
|
1263
|
-
} : { name: "commenting" }),
|
|
1264
|
-
onClose: () => a({ name: "idle" })
|
|
1265
|
-
}) : null,
|
|
1266
|
-
i.name === "thread" && x ? /* @__PURE__ */ _(x, {
|
|
1267
|
-
client: e,
|
|
1268
|
-
threadId: i.threadId,
|
|
1269
|
-
onClose: () => a({ name: "idle" }),
|
|
1270
|
-
onError: N,
|
|
1271
|
-
notify: M
|
|
1272
|
-
}) : null,
|
|
1273
|
-
i.name === "panel" && h ? /* @__PURE__ */ _(h, {
|
|
1274
|
-
client: e,
|
|
1275
|
-
side: B.endsWith("left") ? "left" : "right",
|
|
1276
|
-
onClose: () => a({ name: "idle" }),
|
|
1277
|
-
onOpen: R,
|
|
1278
|
-
onError: N
|
|
1279
|
-
}) : null,
|
|
1280
|
-
E && !r && i.name === "idle" ? /* @__PURE__ */ _(Se, {
|
|
1281
|
-
position: B,
|
|
1282
|
-
project: t?.project.name ?? "",
|
|
1283
|
-
onStart: L,
|
|
1284
|
-
onDismiss: () => {
|
|
1285
|
-
ee(!1), Me($, "1");
|
|
1286
|
-
}
|
|
1287
|
-
}) : null,
|
|
1288
|
-
/* @__PURE__ */ _(ve, {
|
|
1289
|
-
client: e,
|
|
1290
|
-
position: B,
|
|
1291
|
-
commenting: i.name === "commenting",
|
|
1292
|
-
panelOpen: i.name === "panel",
|
|
1293
|
-
onComment: () => i.name === "commenting" ? a({ name: "idle" }) : L(),
|
|
1294
|
-
onPanel: () => i.name === "panel" ? a({ name: "idle" }) : j({ name: "panel" }),
|
|
1295
|
-
onSignIn: () => void z(),
|
|
1296
|
-
onSignOut: () => void e.signOut(),
|
|
1297
|
-
onShortcuts: A ? () => u(!0) : null,
|
|
1298
|
-
waiting: I?.email ?? null,
|
|
1299
|
-
onCode: () => I && j({
|
|
1300
|
-
name: "verify",
|
|
1301
|
-
email: I.email,
|
|
1302
|
-
draft: k
|
|
1303
|
-
}),
|
|
1304
|
-
covered: i.name !== "idle" && i.name !== "commenting" || l
|
|
1305
|
-
}),
|
|
1306
|
-
l && p ? /* @__PURE__ */ _(p, { onClose: () => u(!1) }) : null,
|
|
1307
|
-
P && i.name === "commenting" ? /* @__PURE__ */ _("div", {
|
|
1308
|
-
class: "ck-toast",
|
|
1309
|
-
role: "status",
|
|
1310
|
-
children: F
|
|
1311
|
-
}) : null,
|
|
1312
|
-
o ? /* @__PURE__ */ _("div", {
|
|
1313
|
-
class: "ck-toast",
|
|
1314
|
-
role: "status",
|
|
1315
|
-
"aria-live": "polite",
|
|
1316
|
-
"data-tone": o.tone,
|
|
1317
|
-
children: [o.text, o.action ? /* @__PURE__ */ _("button", {
|
|
1318
|
-
onClick: () => (c(null), o.action.run()),
|
|
1319
|
-
children: o.action.label
|
|
1320
|
-
}) : null]
|
|
1321
|
-
}) : null
|
|
1322
|
-
] });
|
|
1323
|
-
}
|
|
1324
|
-
function Ee(e) {
|
|
1325
|
-
return e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("ck-markup"));
|
|
1326
|
-
}
|
|
1327
|
-
function De(e) {
|
|
1328
|
-
return e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("ck-panel"));
|
|
1329
|
-
}
|
|
1330
|
-
function Oe(e) {
|
|
1331
|
-
return e.composedPath().some((e) => e instanceof HTMLElement && (e.isContentEditable || [
|
|
1332
|
-
"INPUT",
|
|
1333
|
-
"TEXTAREA",
|
|
1334
|
-
"SELECT"
|
|
1335
|
-
].includes(e.tagName)));
|
|
1336
|
-
}
|
|
1337
|
-
function ke() {
|
|
1338
|
-
let e = new URL(location.href), t = e.searchParams.get("ck");
|
|
1339
|
-
if (t && /^[A-Za-z0-9]{16,128}$/.test(t)) {
|
|
1340
|
-
e.searchParams.delete("ck"), history.replaceState(history.state, "", e.toString());
|
|
1341
|
-
try {
|
|
1342
|
-
sessionStorage.setItem(Ce, t);
|
|
1343
|
-
} catch {}
|
|
1344
|
-
return t;
|
|
1345
|
-
}
|
|
1346
|
-
try {
|
|
1347
|
-
return sessionStorage.getItem(Ce);
|
|
1348
|
-
} catch {
|
|
1349
|
-
return null;
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
function Ae(e) {
|
|
1353
|
-
let t = location.href, n = () => {
|
|
1354
|
-
location.href !== t && (t = location.href, e());
|
|
1355
|
-
}, r = setInterval(n, 500);
|
|
1356
|
-
return addEventListener("popstate", n), addEventListener("hashchange", n), () => {
|
|
1357
|
-
clearInterval(r), removeEventListener("popstate", n), removeEventListener("hashchange", n);
|
|
1358
|
-
};
|
|
1359
|
-
}
|
|
1360
|
-
function je(e) {
|
|
1361
|
-
try {
|
|
1362
|
-
return localStorage.getItem(e);
|
|
1363
|
-
} catch {
|
|
1364
|
-
return null;
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
function Me(e, t) {
|
|
1368
|
-
try {
|
|
1369
|
-
localStorage.setItem(e, t);
|
|
1370
|
-
} catch {}
|
|
1371
|
-
}
|
|
1372
|
-
function Ne(e) {
|
|
1373
|
-
try {
|
|
1374
|
-
localStorage.removeItem(e);
|
|
1375
|
-
} catch {}
|
|
1376
|
-
}
|
|
1377
|
-
//#endregion
|
|
1378
|
-
//#region src/ui/styles.css?inline
|
|
1379
|
-
var Pe = ":host{all:initial;--ck-accent:#ff5733;--ck-accent-ink:#121316;--ck-accent-soft:color-mix(in srgb, var(--ck-accent) 12%, var(--ck-bg));--ck-bg:#fff;--ck-bg-muted:#f6f5f2;--ck-bg-hover:#efede8;--ck-border:#e6e4de;--ck-hairline:#12131614;--ck-text:#121316;--ck-text-muted:#6b6a64;--ck-danger:#c2341b;--ck-success:#16794c;--ck-warning:#a15c00;--ck-review:#e5a400;--ck-progress:#3b82f6;--ck-shadow-sm:0 0 0 1px var(--ck-hairline), 0 1px 2px #1213160f, 0 2px 6px #1213160d;--ck-shadow:0 0 0 1px var(--ck-hairline), 0 4px 10px #1213160f, 0 16px 40px -6px #1213162e;--ck-radius:14px;--ck-radius-sm:8px;--ck-radius-md:10px;--ck-ease:cubic-bezier(.2, .8, .2, 1);--ck-font:ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;--ck-mono:ui-monospace, SFMono-Regular, Menlo, monospace;--ck-z:2147480000;font-family:var(--ck-font);color:var(--ck-text);font-size:14px;line-height:1.45}:host([data-theme=dark]){--ck-bg:#1a1b1e;--ck-bg-muted:#222327;--ck-bg-hover:#2b2c31;--ck-border:#33343a;--ck-hairline:#ffffff14;--ck-text:#f2f1ec;--ck-text-muted:#a3a29b;--ck-danger:#f0715a;--ck-success:#4cc38a;--ck-warning:#e3a33f;--ck-shadow-sm:0 0 0 1px var(--ck-hairline), 0 1px 2px #0006, 0 2px 6px #0000004d;--ck-shadow:0 0 0 1px var(--ck-hairline), 0 4px 10px #0000004d, 0 16px 40px -6px #0009}.ck-root{all:initial;font-family:var(--ck-font);letter-spacing:normal;word-spacing:normal;text-align:start;text-transform:none;text-indent:0;text-shadow:none;white-space:normal;color:var(--ck-text);cursor:auto;visibility:visible;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:14px;font-style:normal;font-weight:400;line-height:1.45;display:block}*,:before,:after{box-sizing:border-box}button,input,textarea,select{font:inherit;color:inherit}button{cursor:pointer;-webkit-tap-highlight-color:transparent}:focus-visible{outline:2px solid var(--ck-accent);outline-offset:2px}::placeholder{color:var(--ck-text-muted);opacity:.8}.ck-root *{scrollbar-width:thin;scrollbar-color:var(--ck-border) transparent}@keyframes ck-pop{0%{opacity:0;transform:translateY(6px)scale(.98)}}@keyframes ck-fade{0%{opacity:0}}@keyframes ck-sheet{0%{opacity:0;transform:translateY(32px)}}.ck-launcher{z-index:var(--ck-z);align-items:center;gap:8px;display:flex;position:fixed}.ck-launcher[data-pos=bottom-right]{right:20px;bottom:calc(20px + env(safe-area-inset-bottom,0px))}.ck-launcher[data-pos=bottom-left]{left:20px;bottom:calc(20px + env(safe-area-inset-bottom,0px))}.ck-launcher[data-pos=top-right]{top:20px;right:20px}.ck-launcher[data-pos=top-left]{top:20px;left:20px}.ck-bar{background:color-mix(in srgb, var(--ck-bg) 86%, transparent);-webkit-backdrop-filter:blur(14px)saturate(1.4);backdrop-filter:blur(14px)saturate(1.4);box-shadow:var(--ck-shadow);animation:ck-pop .22s var(--ck-ease);border-radius:999px;align-items:center;gap:2px;padding:4px;display:flex}.ck-bar-btn{letter-spacing:-.005em;white-space:nowrap;height:36px;transition:background-color .12s, color .12s, transform .12s var(--ck-ease);background:0 0;border:0;border-radius:999px;align-items:center;gap:7px;padding:0 14px;font-size:13.5px;font-weight:600;display:inline-flex}.ck-bar-btn:hover{background:var(--ck-bg-hover)}.ck-bar-btn:active,.ck-btn:active,.ck-chip:active{transform:scale(.97)}.ck-bar-btn svg,.ck-btn svg,.ck-ghost svg{flex:none}.ck-bar-btn[aria-pressed=true],.ck-primary{background:var(--ck-accent);color:var(--ck-accent-ink);box-shadow:inset 0 1px 0 #ffffff38, 0 1px 2px color-mix(in srgb, var(--ck-accent) 40%, transparent)}.ck-bar-btn[aria-pressed=true]:hover,.ck-primary:hover{background:var(--ck-accent);filter:brightness(.96)}.ck-icon-btn{width:36px;color:var(--ck-text-muted);justify-content:center;padding:0;position:relative}.ck-icon-btn:hover{color:var(--ck-text)}.ck-badge{background:var(--ck-danger);color:#fff;min-width:16px;height:16px;box-shadow:0 0 0 2px var(--ck-bg);border-radius:999px;place-items:center;padding:0 4px;font-size:10px;font-weight:700;line-height:1;display:grid;position:absolute;top:2px;right:2px}.ck-count{background:var(--ck-bg-hover);color:var(--ck-text-muted);font-variant-numeric:tabular-nums;border-radius:999px;padding:1px 7px;font-size:11.5px;font-weight:700}.ck-mode-hint{z-index:var(--ck-z);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);color:#f2f1ec;background:#121316e0;border-radius:18px;flex-wrap:wrap;justify-content:center;align-items:center;gap:6px 10px;max-width:calc(100vw - 24px);padding:8px 8px 8px 16px;font-size:13px;font-weight:600;animation:.16s ease-out ck-fade;display:flex;position:fixed;top:16px;left:50%;transform:translate(-50%);box-shadow:0 8px 24px #00000038}.ck-mode-hint .ck-chip{color:inherit;background:#ffffff14;border-color:#ffffff2e}.ck-mode-hint .ck-chip:hover{background:#ffffff29}.ck-catcher{z-index:calc(var(--ck-z) - 2);cursor:crosshair;touch-action:pan-x pan-y pinch-zoom;background:0 0;position:fixed;top:0;bottom:0;left:0;right:0}.ck-outline{z-index:calc(var(--ck-z) - 1);pointer-events:none;border:2px solid var(--ck-accent);background:color-mix(in srgb, var(--ck-accent) 8%, transparent);box-shadow:0 0 0 4px color-mix(in srgb, var(--ck-accent) 14%, transparent);border-radius:6px;transition:all 70ms ease-out;position:fixed}.ck-region{z-index:calc(var(--ck-z) - 1);pointer-events:none;border:2px dashed var(--ck-accent);background:color-mix(in srgb, var(--ck-accent) 10%, transparent);border-radius:6px;position:fixed}.ck-pins{width:0;height:0;z-index:calc(var(--ck-z) - 3);position:absolute;top:0;left:0}.ck-pin{transform-origin:0 100%;background:var(--ck-accent);width:30px;height:30px;color:var(--ck-accent-ink);font-variant-numeric:tabular-nums;transition:scale .14s var(--ck-ease), box-shadow .14s;border:2px solid #fff;border-radius:50% 50% 50% 6px;place-items:center;padding:0;font-size:11px;font-weight:800;animation:.2s ease-out ck-fade;display:grid;position:absolute;transform:translate(-50%,-100%)rotate(-45deg);box-shadow:0 0 0 1px #1213161a,0 4px 12px #12131647}.ck-pin:hover{scale:1.08;box-shadow:0 0 0 1px #1213161a,0 6px 16px #12131652}.ck-pin>span{rotate:45deg}.ck-pin[data-status=in_review]{background:var(--ck-review);color:#121316}.ck-pin[data-status=in_progress]{background:var(--ck-progress);color:#fff}.ck-pin[data-state=moved]{opacity:.85}.ck-pin[aria-expanded=true]{box-shadow:0 0 0 4px color-mix(in srgb, var(--ck-accent) 28%, transparent), 0 6px 16px #1213164d;scale:1.14}.ck-pin-region{pointer-events:none;border:2px dashed var(--ck-accent);border-radius:6px;position:absolute}.ck-card{z-index:var(--ck-z);background:var(--ck-bg);border-radius:var(--ck-radius);width:min(380px,100vw - 24px);max-height:min(560px,100vh - 24px);box-shadow:var(--ck-shadow);animation:ck-pop .18s var(--ck-ease);flex-direction:column;display:flex;position:fixed;overflow:hidden}.ck-card-head{border-bottom:1px solid var(--ck-hairline);align-items:center;gap:8px;min-height:52px;padding:10px 10px 10px 16px;display:flex}.ck-card-title{letter-spacing:-.01em;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-weight:650;overflow:hidden}.ck-card-body{flex:1;padding:14px 16px;overflow:auto}.ck-card-foot{border-top:1px solid var(--ck-hairline);background:color-mix(in srgb, var(--ck-bg-muted) 50%, var(--ck-bg));align-items:center;gap:8px;padding:10px 12px 12px 16px;display:flex}.ck-ghost{border-radius:var(--ck-radius-sm);color:var(--ck-text-muted);background:0 0;border:0;padding:6px 8px;font-weight:600;transition:background-color .12s,color .12s}.ck-ghost:hover{background:var(--ck-bg-hover);color:var(--ck-text)}.ck-btn{border-radius:var(--ck-radius-sm);background:var(--ck-bg);height:34px;box-shadow:var(--ck-shadow-sm);white-space:nowrap;transition:background-color .12s, filter .12s, transform .12s var(--ck-ease);border:0;justify-content:center;align-items:center;gap:6px;padding:0 14px;font-size:13.5px;font-weight:600;display:inline-flex}.ck-btn:hover{background:var(--ck-bg-muted)}.ck-btn.ck-primary{background:var(--ck-accent);color:var(--ck-accent-ink);box-shadow:inset 0 1px 0 #ffffff38, 0 0 0 1px color-mix(in srgb, var(--ck-accent) 80%, #000), 0 1px 2px #1213161f}.ck-btn.ck-primary:hover{background:var(--ck-accent);filter:brightness(.96)}.ck-btn:disabled{opacity:.5;cursor:not-allowed;filter:none;transform:none}.ck-spacer{flex:1}.ck-textarea{resize:vertical;border-radius:var(--ck-radius-md);border:1px solid var(--ck-border);background:var(--ck-bg);outline:none;width:100%;min-height:84px;max-height:220px;padding:10px 12px;line-height:1.5;transition:border-color .12s,box-shadow .12s;display:block}.ck-textarea:hover,.ck-input:hover{border-color:color-mix(in srgb, var(--ck-text-muted) 45%, var(--ck-border))}.ck-textarea:focus,.ck-input:focus{border-color:var(--ck-accent);box-shadow:0 0 0 3px color-mix(in srgb, var(--ck-accent) 18%, transparent);outline:none}.ck-input{border-radius:var(--ck-radius-sm);border:1px solid var(--ck-border);background:var(--ck-bg);width:100%;height:36px;padding:0 12px;transition:border-color .12s,box-shadow .12s}.ck-input[aria-invalid=true],.ck-textarea[aria-invalid=true]{border-color:var(--ck-danger)}.ck-muted{color:var(--ck-text-muted);font-size:12px}.ck-note{border-radius:var(--ck-radius-md);background:var(--ck-bg-muted);margin:8px 0 0;padding:10px 12px;font-size:13px;line-height:1.45}.ck-note[data-tone=warning]{background:color-mix(in srgb, var(--ck-review) 16%, var(--ck-bg))}.ck-note[data-tone=error]{background:color-mix(in srgb, var(--ck-danger) 10%, var(--ck-bg));color:var(--ck-danger)}.ck-shot{border-radius:var(--ck-radius-md);box-shadow:0 0 0 1px var(--ck-hairline);background:var(--ck-bg-muted);margin-top:10px;position:relative;overflow:hidden}.ck-shot img,.ck-shot canvas{width:100%;height:auto;display:block}.ck-msg .ck-shot img{object-fit:cover;object-position:top;max-height:150px}.ck-shot-tools{flex-wrap:wrap;gap:4px;margin-top:8px;display:flex}.ck-files{flex-wrap:wrap;gap:6px;margin-top:8px;display:flex}.ck-file{background:var(--ck-bg-muted);box-shadow:0 0 0 1px var(--ck-hairline);border-radius:6px;padding:4px 8px;font-size:12px}.ck-msg{gap:10px;padding:8px 0;display:flex}.ck-msg+.ck-msg{border-top:1px solid var(--ck-hairline);padding-top:12px}.ck-avatar{background:var(--ck-accent-soft);width:28px;height:28px;color:color-mix(in srgb, var(--ck-accent) 70%, var(--ck-text));letter-spacing:.02em;box-shadow:0 0 0 1px var(--ck-hairline);border-radius:50%;flex:none;place-items:center;font-size:11px;font-weight:700;display:grid;overflow:hidden}.ck-avatar img{object-fit:cover;width:100%;height:100%}.ck-msg-main{flex:1;min-width:0}.ck-msg-meta{color:var(--ck-text-muted);align-items:baseline;gap:6px;font-size:12px;display:flex}.ck-msg-name{color:var(--ck-text);font-size:13px;font-weight:650}.ck-msg-body{white-space:pre-wrap;overflow-wrap:anywhere;margin-top:2px;line-height:1.5}.ck-msg-body a{color:color-mix(in srgb, var(--ck-accent) 80%, var(--ck-text));text-underline-offset:2px}.ck-msg-body code{font-family:var(--ck-mono);background:var(--ck-bg-muted);box-shadow:0 0 0 1px var(--ck-hairline);border-radius:5px;padding:1px 5px;font-size:12px}.ck-reactions{flex-wrap:wrap;gap:4px;margin-top:6px;display:flex}.ck-reaction{border:1px solid var(--ck-border);background:var(--ck-bg);font-variant-numeric:tabular-nums;border-radius:999px;height:24px;padding:0 8px;font-size:12px;transition:background-color .12s,border-color .12s}.ck-reaction:hover{background:var(--ck-bg-muted)}.ck-reaction[aria-pressed=true]{border-color:color-mix(in srgb, var(--ck-accent) 60%, var(--ck-border));background:var(--ck-accent-soft)}.ck-status{--ck-tone:var(--ck-accent);background:color-mix(in srgb, var(--ck-tone) 12%, var(--ck-bg));color:color-mix(in srgb, var(--ck-tone) 45%, var(--ck-text));white-space:nowrap;border-radius:999px;align-items:center;gap:6px;padding:2px 9px 2px 8px;font-size:12px;font-weight:650;display:inline-flex}.ck-status:before{content:\"\";background:var(--ck-tone);border-radius:50%;width:7px;height:7px}.ck-status[data-status=in_progress]{--ck-tone:var(--ck-progress)}.ck-status[data-status=in_review]{--ck-tone:var(--ck-review)}.ck-status[data-status=resolved]{--ck-tone:var(--ck-success)}.ck-status[data-status=closed]{--ck-tone:var(--ck-text-muted)}.ck-review-ask{border-radius:var(--ck-radius-md);background:color-mix(in srgb, var(--ck-review) 14%, var(--ck-bg));box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--ck-review) 30%, transparent);margin-bottom:10px;padding:12px}.ck-actions{flex-wrap:wrap;gap:6px;margin-top:10px;display:flex}.ck-menu{z-index:2;background:var(--ck-bg);min-width:210px;box-shadow:var(--ck-shadow);animation:ck-pop .14s var(--ck-ease);border-radius:12px;padding:4px;position:absolute;top:48px;right:8px}.ck-menu button{text-align:start;border-radius:var(--ck-radius-sm);background:0 0;border:0;align-items:center;gap:8px;width:100%;padding:8px 10px;font-size:13.5px;display:flex}.ck-menu button:hover{background:var(--ck-bg-hover)}.ck-menu .ck-danger{color:var(--ck-danger)}.ck-panel{z-index:var(--ck-z);background:var(--ck-bg);border-radius:var(--ck-radius);width:min(400px,100vw - 24px);box-shadow:var(--ck-shadow);animation:ck-pop .2s var(--ck-ease);flex-direction:column;display:flex;position:fixed;top:12px;bottom:12px;overflow:hidden}.ck-panel[data-side=right]{right:12px}.ck-panel[data-side=left]{left:12px}.ck-tabs{border-radius:var(--ck-radius-md);background:var(--ck-bg-muted);gap:2px;margin:10px 12px 0;padding:3px;display:flex}.ck-tab{color:var(--ck-text-muted);white-space:nowrap;background:0 0;border:0;border-radius:7px;flex:1;justify-content:center;align-items:center;gap:6px;padding:6px 8px;font-size:13px;font-weight:600;transition:background-color .12s,color .12s;display:inline-flex}.ck-tab:hover{color:var(--ck-text)}.ck-tab[aria-selected=true]{color:var(--ck-text);background:var(--ck-bg);box-shadow:var(--ck-shadow-sm)}.ck-list{margin:0;padding:4px 6px;list-style:none}.ck-item{text-align:start;border-radius:var(--ck-radius-md);background:0 0;border:0;width:100%;padding:11px 10px;transition:background-color .12s;display:block}.ck-list>li+li,.ck-list>.ck-item+.ck-item{border-top:1px solid var(--ck-hairline)}.ck-item:hover{background:var(--ck-bg-muted)}.ck-item[data-unread=true]{background:var(--ck-accent-soft)}.ck-item-top{color:var(--ck-text-muted);flex-wrap:wrap;align-items:center;gap:8px;font-size:12px;display:flex}.ck-item-top>strong,.ck-item-top .ck-badge-soft{white-space:nowrap}.ck-item-top>strong{color:var(--ck-text);font-variant-numeric:tabular-nums;font-weight:650}.ck-item-text{-webkit-line-clamp:2;-webkit-box-orient:vertical;margin-top:4px;line-height:1.45;display:-webkit-box;overflow:hidden}.ck-empty{text-align:center;color:var(--ck-text-muted);padding:40px 20px}.ck-empty strong{color:var(--ck-text);margin-bottom:4px;font-weight:650;display:block}.ck-suggest{background:var(--ck-bg);max-height:180px;box-shadow:var(--ck-shadow);z-index:3;animation:ck-pop .12s var(--ck-ease);border-radius:12px;padding:4px;position:absolute;bottom:56px;left:14px;right:14px;overflow:auto}.ck-suggest button{border-radius:var(--ck-radius-sm);text-align:start;background:0 0;border:0;align-items:center;gap:8px;width:100%;padding:6px 8px;display:flex}.ck-suggest button[aria-selected=true],.ck-suggest button:hover{background:var(--ck-bg-hover)}.ck-toast{z-index:calc(var(--ck-z) + 1);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);color:#f2f1ec;max-width:min(420px,100vw - 24px);animation:ck-pop .18s var(--ck-ease);background:#121316eb;border-radius:12px;align-items:center;gap:12px;padding:10px 12px 10px 16px;font-size:13.5px;font-weight:600;display:flex;position:fixed;bottom:84px;left:50%;transform:translate(-50%);box-shadow:0 10px 30px #00000040}.ck-toast[data-tone=error]{background:var(--ck-danger);color:#fff}.ck-toast button{color:inherit;background:#ffffff24;border:0;border-radius:6px;flex:none;padding:4px 8px;font-weight:700}.ck-toast button:hover{background:#ffffff3d}.ck-welcome{z-index:var(--ck-z);background:var(--ck-bg);border-radius:var(--ck-radius);width:min(340px,100vw - 24px);box-shadow:var(--ck-shadow);animation:ck-pop .22s var(--ck-ease);padding:18px;position:fixed}.ck-welcome h2{letter-spacing:-.01em;margin:0 0 6px;font-size:15px;font-weight:650}.ck-welcome p{color:var(--ck-text-muted);margin:0 0 14px;line-height:1.5}.ck-markup{z-index:calc(var(--ck-z) + 2);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#0a0a0cc2;flex-direction:column;justify-content:center;align-items:center;gap:12px;padding:16px;display:flex;position:fixed;top:0;bottom:0;left:0;right:0}.ck-markup canvas{border-radius:var(--ck-radius-md);cursor:crosshair;touch-action:none;background:#fff;max-width:100%;max-height:calc(100vh - 120px);box-shadow:0 20px 50px #0006}.ck-markup-tools{background:var(--ck-bg);box-shadow:var(--ck-shadow);border-radius:999px;flex-wrap:wrap;justify-content:center;gap:4px;padding:5px;display:flex}.ck-filters{gap:6px;padding:10px 12px;display:flex}.ck-filters select{width:auto}.ck-pad{padding:10px 12px}.ck-branchbar{flex-wrap:wrap;gap:6px;padding:10px 12px 0;display:flex}.ck-chip{border:1px solid var(--ck-border);background:var(--ck-bg);height:28px;color:var(--ck-text-muted);cursor:pointer;text-overflow:ellipsis;white-space:nowrap;max-width:100%;transition:background-color .12s, border-color .12s, color .12s, transform .12s var(--ck-ease);border-radius:999px;align-items:center;gap:6px;padding:0 11px;font-size:12px;font-weight:600;display:inline-flex;overflow:hidden}.ck-chip:hover{color:var(--ck-text);background:var(--ck-bg-muted)}.ck-chip[aria-pressed=true]{background:var(--ck-text);color:var(--ck-bg);border-color:var(--ck-text)}.ck-chip:focus-visible{outline:2px solid var(--ck-accent);outline-offset:1px}.ck-build{font-family:var(--ck-mono);word-break:break-all;font-size:11px}.ck-badge-soft{background:color-mix(in srgb, var(--ck-warning) 14%, transparent);color:var(--ck-warning);border-radius:999px;padding:1px 7px;font-size:11px;font-weight:600}.ck-item-shot{object-fit:cover;object-position:top;border-radius:var(--ck-radius-sm);width:100%;max-height:120px;box-shadow:0 0 0 1px var(--ck-hairline);margin:8px 0 6px;display:block}.ck-skeleton{background:linear-gradient(90deg, var(--ck-bg-muted), var(--ck-bg-hover), var(--ck-bg-muted));background-size:200% 100%;border-radius:6px;height:12px;margin:10px 0;animation:1.2s linear infinite ck-shimmer}@keyframes ck-shimmer{to{background-position:-200% 0}}.ck-empty .ck-btn{margin-top:12px}.ck-root :focus{outline:none}.ck-root :focus-visible{outline:2px solid var(--ck-accent);outline-offset:2px;border-radius:6px}.ck-root [dir=rtl],.ck-root[dir=rtl]{direction:rtl}@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}.ck-launcher-note{background:var(--ck-bg);width:max-content;max-width:min(300px,100vw - 40px);box-shadow:var(--ck-shadow);animation:ck-pop .2s var(--ck-ease);margin:0;position:absolute;bottom:calc(100% + 8px);right:0}.ck-launcher[data-pos$=left] .ck-launcher-note{left:0;right:auto}.ck-launcher[data-pos^=top] .ck-launcher-note{top:calc(100% + 8px);bottom:auto}.ck-launcher .ck-menu{top:auto;bottom:52px;right:0}.ck-launcher[data-pos^=top] .ck-menu{top:52px;bottom:auto}.ck-launcher[data-pos$=left] .ck-menu{left:0;right:auto}.ck-scrim{z-index:calc(var(--ck-z) + 3);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:#0a0a0c73;place-items:center;padding:12px;animation:.14s ease-out ck-fade;display:grid;position:fixed;top:0;bottom:0;left:0;right:0}.ck-scrim .ck-card{max-height:calc(100vh - 24px);position:static!important}.ck-dialog h2{margin:0;font-size:15px;font-weight:650}.ck-keys{gap:10px;margin:0;display:grid}.ck-keys div{grid-template-columns:minmax(96px,auto) 1fr;align-items:baseline;gap:12px;display:grid}.ck-keys dd{color:var(--ck-text-muted);margin:0}kbd{font-family:var(--ck-mono);border:1px solid var(--ck-border);background:var(--ck-bg-muted);white-space:nowrap;border-bottom-width:2px;border-radius:6px;padding:2px 6px;font-size:11.5px}.ck-here{color:var(--ck-text-muted);white-space:nowrap;align-items:center;gap:6px;font-size:12px;display:inline-flex}.ck-dot{background:var(--ck-success);width:8px;height:8px;box-shadow:0 0 0 3px color-mix(in srgb, var(--ck-success) 20%, transparent);border-radius:50%}.ck-ghost.ck-danger{color:var(--ck-danger)}.ck-btn.ck-danger-btn,.ck-danger-btn{background:var(--ck-danger);color:#fff;box-shadow:inset 0 1px 0 #ffffff2e, 0 0 0 1px color-mix(in srgb, var(--ck-danger) 80%, #000)}.ck-danger-btn:hover{background:var(--ck-danger);filter:brightness(.95)}.ck-check{cursor:pointer;align-items:flex-start;gap:8px;margin-top:10px;font-size:13px;display:flex}.ck-check input{width:16px;height:16px;accent-color:var(--ck-accent);flex:none;margin:2px 0 0}.ck-label-box{z-index:1;background:var(--ck-bg);box-shadow:var(--ck-shadow);border-radius:12px;align-items:center;gap:6px;padding:6px;display:flex;position:fixed}.ck-label-box .ck-input{width:200px;font-weight:650}.ck-pad-x{margin:8px 12px 0}.ck-guest{gap:10px;margin-top:12px;display:grid}.ck-field{color:var(--ck-text-muted);gap:5px;font-size:12.5px;font-weight:600;display:grid}.ck-field .ck-input{color:var(--ck-text);font-size:14px;font-weight:400}.ck-error{color:var(--ck-danger);font-size:12px;font-weight:500}.ck-verify-text{margin:0 0 12px;line-height:1.5}.ck-card h2.ck-card-title{margin:0;font-size:14px}.ck-code{font-family:var(--ck-mono);letter-spacing:.32em;text-align:center;height:46px;font-size:20px}.ck-catcher{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}@media (max-width:520px){.ck-launcher[data-covered=true]{display:none}.ck-card{width:auto;max-height:min(70vh, calc(100vh - 24px - var(--ck-kb,0px)));border-radius:16px;animation-name:ck-sheet;left:12px!important;right:12px!important;bottom:calc(12px + var(--ck-kb,0px) + env(safe-area-inset-bottom,0px))!important;top:auto!important}.ck-card~.ck-toast,.ck-panel~.ck-toast{top:12px;bottom:auto}.ck-panel{width:100%;height:80vh;padding-bottom:env(safe-area-inset-bottom,0px);border-radius:18px 18px 0 0;animation-name:ck-sheet;top:auto;bottom:0;left:0!important;right:0!important}.ck-panel:before{content:\"\";background:var(--ck-border);border-radius:2px;flex:none;width:36px;height:4px;margin:8px auto 0;display:block}.ck-mode-hint{top:auto;bottom:calc(84px + env(safe-area-inset-bottom,0px))}}@media (pointer:coarse){.ck-bar-btn,.ck-btn,.ck-tab,.ck-chip,.ck-ghost,.ck-reaction{min-width:44px;min-height:44px}.ck-item{min-height:48px}.ck-pin:after{content:\"\";position:absolute;top:-10px;bottom:-10px;left:-10px;right:-10px}}", Fe = /* @__PURE__ */ e({
|
|
1380
|
-
Boundary: () => Re,
|
|
1381
|
-
mountWidget: () => Ie
|
|
1382
|
-
});
|
|
1383
|
-
function Ie(e, t = () => void 0) {
|
|
1384
|
-
let n = document.createElement("div");
|
|
1385
|
-
n.setAttribute("data-commentkit-host", ""), n.style.cssText = "position:absolute;top:0;left:0;width:0;height:0;z-index:2147483000;";
|
|
1386
|
-
let a = n.attachShadow({ mode: "open" });
|
|
1387
|
-
if ("adoptedStyleSheets" in Document.prototype && "replaceSync" in CSSStyleSheet.prototype) {
|
|
1388
|
-
let e = new CSSStyleSheet();
|
|
1389
|
-
e.replaceSync(Pe), a.adoptedStyleSheets = [e];
|
|
1390
|
-
} else {
|
|
1391
|
-
let e = document.createElement("style");
|
|
1392
|
-
e.textContent = Pe, a.appendChild(e);
|
|
1393
|
-
}
|
|
1394
|
-
let o = document.createElement("div");
|
|
1395
|
-
o.className = "ck-root", o.dir = i(), o.lang = r(), a.appendChild(o), document.documentElement.appendChild(n);
|
|
1396
|
-
let s = () => {
|
|
1397
|
-
let t = e.options.theme ?? e.state.get().config?.appearance.theme ?? "auto", r = t === "dark" || t === "auto" && matchMedia("(prefers-color-scheme: dark)").matches;
|
|
1398
|
-
n.setAttribute("data-theme", r ? "dark" : "light");
|
|
1399
|
-
let i = e.state.get().config?.appearance.accent;
|
|
1400
|
-
if (i && /^#[0-9a-f]{6}$/i.test(i)) {
|
|
1401
|
-
n.style.setProperty("--ck-accent", i);
|
|
1402
|
-
let [e, t, r] = [
|
|
1403
|
-
1,
|
|
1404
|
-
3,
|
|
1405
|
-
5
|
|
1406
|
-
].map((e) => {
|
|
1407
|
-
let t = parseInt(i.slice(e, e + 2), 16) / 255;
|
|
1408
|
-
return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
1409
|
-
});
|
|
1410
|
-
n.style.setProperty("--ck-accent-ink", .2126 * e + .7152 * t + .0722 * r > .18 ? "#121316" : "#ffffff");
|
|
1411
|
-
}
|
|
1412
|
-
};
|
|
1413
|
-
s();
|
|
1414
|
-
let c = matchMedia("(prefers-color-scheme: dark)");
|
|
1415
|
-
c.addEventListener?.("change", s);
|
|
1416
|
-
let l = e.state.subscribe(s), u = window.visualViewport, d = () => u && n.style.setProperty("--ck-kb", g(Math.max(0, innerHeight - u.height - u.offsetTop)));
|
|
1417
|
-
return u?.addEventListener("resize", d), u?.addEventListener("scroll", d), E(/* @__PURE__ */ _(Re, {
|
|
1418
|
-
onCrash: t,
|
|
1419
|
-
onError: (t) => e.reportCrash(t),
|
|
1420
|
-
children: /* @__PURE__ */ _(we, { client: e })
|
|
1421
|
-
}), o), () => {
|
|
1422
|
-
E(null, o), l(), c.removeEventListener?.("change", s), u?.removeEventListener("resize", d), u?.removeEventListener("scroll", d), n.remove();
|
|
1423
|
-
};
|
|
1424
|
-
}
|
|
1425
|
-
var Le = !1, Re = class extends m {
|
|
1426
|
-
constructor(...e) {
|
|
1427
|
-
super(...e), c(this, "state", { crashed: !1 });
|
|
1428
|
-
}
|
|
1429
|
-
componentDidCatch(e) {
|
|
1430
|
-
if (!this.state.crashed) {
|
|
1431
|
-
this.setState({ crashed: !0 });
|
|
1432
|
-
try {
|
|
1433
|
-
this.props.onError?.(e);
|
|
1434
|
-
} catch {}
|
|
1435
|
-
Le || (Le = !0, console.warn("[CommentKit] The widget stopped after an error and was removed. Your page is not affected.", e)), setTimeout(() => {
|
|
1436
|
-
try {
|
|
1437
|
-
this.props.onCrash();
|
|
1438
|
-
} catch {}
|
|
1439
|
-
});
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
render() {
|
|
1443
|
-
return this.state.crashed ? null : this.props.children;
|
|
1444
|
-
}
|
|
1445
|
-
};
|
|
1446
|
-
//#endregion
|
|
1447
|
-
export { Re as Boundary, me as a, se as c, oe as d, re as f, V as h, fe as i, K as l, ne as m, Ie as mountWidget, Z as n, ce as o, B as p, pe as r, J as s, Fe as t, ie as u };
|