@commentkit/comment-kit 2.0.1 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +14 -6
  3. package/dist/node/cli/api.js +61 -15
  4. package/dist/node/cli/credentials.js +8 -0
  5. package/dist/node/cli/doctor.js +68 -5
  6. package/dist/node/cli/main.js +275 -52
  7. package/dist/node/cli/website.js +140 -0
  8. package/dist/node/types/next.d.ts +4 -4
  9. package/dist/npm/THIRD_PARTY_NOTICES.txt +47 -0
  10. package/dist/npm/chunks/{AgentSend-DOy3jhyF.js → AgentSend-B4rxdY68.js} +3 -3
  11. package/dist/npm/chunks/Checklist-Cy68X5qC.js +269 -0
  12. package/dist/npm/chunks/Composer-D65l6Jg4.js +734 -0
  13. package/dist/npm/chunks/DatePicker-BPzzqW3f.js +161 -0
  14. package/dist/npm/chunks/{Guest-7hcN765o.js → Guest-C-ZhARI0.js} +18 -17
  15. package/dist/npm/chunks/{MarkupEditor-6bJGpWGO.js → MarkupEditor-BOb2jFTR.js} +8 -8
  16. package/dist/npm/chunks/{Panel-ChPUB68C.js → Panel-DgdCgaC-.js} +217 -218
  17. package/dist/npm/chunks/{Settings-CB5eEKnf.js → Settings-BbWu2Rd5.js} +34 -33
  18. package/dist/npm/chunks/{Shortcuts-eAyjJ89P.js → Shortcuts-C5wEx-Mq.js} +25 -23
  19. package/dist/npm/chunks/SignInFirst-BlMbutED.js +36 -0
  20. package/dist/npm/chunks/{StyleEditor-CZTdAA5c.js → StyleEditor-BN2z7mUs.js} +4 -4
  21. package/dist/npm/chunks/{StylePanel-B4pHQUL9.js → StylePanel-BZk-r-kl.js} +3 -3
  22. package/dist/npm/chunks/TaskFields-B2-YvIwV.js +617 -0
  23. package/dist/npm/chunks/ThreadCard-xKy4JbXK.js +1142 -0
  24. package/dist/npm/chunks/{Viewer-DY6zb90M.js → Viewer-DL6M3wAT.js} +9 -8
  25. package/dist/npm/chunks/{agent-MTQHr9ei.js → agent-D1VQvc14.js} +12 -12
  26. package/dist/npm/chunks/{ar-L5cQ-NPe.js → ar-DtfC6tHi.js} +53 -12
  27. package/dist/npm/chunks/{card-bits-CTdrkYn8.js → card-bits-B94SwnS9.js} +12 -10
  28. package/dist/npm/chunks/{client-7eVxvg5j.js → client-CULjcQxz.js} +13 -11
  29. package/dist/npm/chunks/{confetti-BIs5s14P.js → confetti-K_xKxQGa.js} +1 -1
  30. package/dist/npm/chunks/{context-Cf6khm7A.js → context-0MfEgoip.js} +1 -1
  31. package/dist/npm/chunks/{de-D0C-v6tP.js → de-CSyX5Cz-.js} +53 -12
  32. package/dist/npm/chunks/{dpop-0A76OPa9.js → dpop-DpxIN5kL.js} +1 -1
  33. package/dist/npm/chunks/entrance-CO0AzUKy.js +90 -0
  34. package/dist/npm/chunks/{es-Bw4Dj9tN.js → es-D7SAi7fz.js} +53 -12
  35. package/dist/npm/chunks/{extension-DFVOvciD.js → extension-DpfiPOjC.js} +1 -1
  36. package/dist/npm/chunks/{extension-SmoH5AA4.js → extension-faFfCApb.js} +2 -2
  37. package/dist/npm/chunks/{files-4lV9YQIX.js → files-BkHuRlcW.js} +2 -2
  38. package/dist/npm/chunks/{fr-TkuQaIAa.js → fr-CIr2nUyu.js} +53 -12
  39. package/dist/npm/chunks/{hi-DXSH2U8d.js → hi-BTocxOL5.js} +53 -12
  40. package/dist/npm/chunks/{i18n-aVSu9TcJ.js → i18n-CDw_D17c.js} +17 -21
  41. package/dist/npm/chunks/icons-BJLm_C0M.js +141 -0
  42. package/dist/npm/chunks/{identify-BGYh2dVo.js → identify-963WDKul.js} +1 -1
  43. package/dist/npm/chunks/{it-CiWA_bch.js → it-DCExRo0r.js} +53 -12
  44. package/dist/npm/chunks/{ja-C-QmR3yz.js → ja-CgWpTdWi.js} +52 -11
  45. package/dist/npm/chunks/late-words-QnNheaDY.js +59 -0
  46. package/dist/npm/chunks/{live-BExWHzQ7.js → live-BI72WQBA.js} +31 -23
  47. package/dist/npm/chunks/{nl-CEmZRqjX.js → nl-DhTQ8oJ_.js} +53 -12
  48. package/dist/npm/chunks/{page-key-HSY3Lze5.js → page-key-CW8Mtf60.js} +1 -1
  49. package/dist/npm/chunks/{pick-B3sR7jtS.js → pick-BRhngGMq.js} +1 -1
  50. package/dist/npm/chunks/{pkce-CfZhiNBi.js → pkce-BEeLAZhN.js} +1 -1
  51. package/dist/npm/chunks/{pt-BR-b-a8sxO8.js → pt-BR-DrO6LV4n.js} +53 -12
  52. package/dist/npm/chunks/{report-DaVuoRYS.js → report-DAzQvgUh.js} +1 -1
  53. package/dist/npm/chunks/{show-BoN8AC-F.js → show-Ka3g4eCJ.js} +7 -7
  54. package/dist/npm/chunks/signin-Car5vP1U.js +101 -0
  55. package/dist/npm/chunks/{source-mk3rGBBQ.js → source-dd_it90W.js} +1 -1
  56. package/dist/npm/chunks/{src-C8rZFyL_.js → src-fTYV50pw.js} +21 -15
  57. package/dist/npm/chunks/start-CE5eR33Z.js +1916 -0
  58. package/dist/npm/chunks/states-DLMCvwes.js +3 -0
  59. package/dist/npm/chunks/{upload-B2mkgMeJ.js → upload-Dcv9CCly.js} +1 -1
  60. package/dist/npm/chunks/uploads-CmeoNVO2.js +1236 -0
  61. package/dist/npm/chunks/{wrap-DW6EFbVQ.js → wrap-B0mzrRhc.js} +27 -27
  62. package/dist/npm/chunks/{zh-CN-JTscW8u8.js → zh-CN-Bb8UzT1V.js} +53 -12
  63. package/dist/npm/element.js +7 -1
  64. package/dist/npm/headless.js +2 -2
  65. package/dist/npm/index.js +2 -2
  66. package/dist/npm/react.js +1 -1
  67. package/dist/npm/svelte.js +1 -1
  68. package/dist/npm/types/adapters/vue.d.ts +12 -0
  69. package/dist/npm/types/core/auth.d.ts +1 -0
  70. package/dist/npm/types/core/client.d.ts +5 -1
  71. package/dist/npm/types/core/types.d.ts +17 -2
  72. package/dist/npm/vue.js +5 -1
  73. package/package.json +2 -1
  74. package/dist/npm/chunks/Checklist-CW_SwMpS.js +0 -282
  75. package/dist/npm/chunks/Composer-Bveq5QrK.js +0 -727
  76. package/dist/npm/chunks/TaskFields-C8BX0Sgg.js +0 -289
  77. package/dist/npm/chunks/ThreadCard-B1EsX3PR.js +0 -1160
  78. package/dist/npm/chunks/late-words-80_VWt8S.js +0 -14
  79. package/dist/npm/chunks/signin-BOWr_WCo.js +0 -75
  80. package/dist/npm/chunks/start-CV4j78_q.js +0 -1894
  81. package/dist/npm/chunks/states-b9Bv3Ci7.js +0 -3
  82. package/dist/npm/chunks/uploads-8AxyRq7g.js +0 -1147
@@ -1,1894 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-QGRDbDUS.js";
2
- import { n as t } from "./src-C8rZFyL_.js";
3
- import { o as n, v as r } from "./client-7eVxvg5j.js";
4
- import { i, o as a, t as o } from "./anchor-BsQNVkHj.js";
5
- import { _ as s, a as c, b as l, c as u, d, f, g as p, h as m, l as h, m as g, n as _, o as v, r as y, s as b, u as x, v as S, x as C, y as w } from "./i18n-aVSu9TcJ.js";
6
- import { a as T, i as E, n as D, r as O } from "./drafts-B0ctr1g9.js";
7
- // src/capture/diagnostics.ts
8
- var k = 20, A = /token|key|secret|passw|^pass$|auth|code|session|sig|credential|^x-amz-|ck_invite/i, j = /[\w.%+-]{1,64}@[A-Za-z0-9-]{1,63}(?:\.[A-Za-z0-9-]{1,63}){0,8}\.[A-Za-z]{2,24}/g, M = /(^|[^\w-])(\+?\d(?:[\s().-]{0,2}\d){8,})(?!\w)/g, N = (e) => e.replace(j, "[email]").replace(M, "$1[number]"), P = /eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+/, F = 1e3, I = [], L = [], R = !1, z = "";
9
- function ee(e) {
10
- if (R || !(e.console || e.network)) return () => void 0;
11
- R = !0, z = `${new URL(e.endpoint ?? "https://commentkit.dev").origin}/api/v1/`;
12
- let t, n = !1;
13
- return import("./wrap-DW6EFbVQ.js").then((r) => n || (t = r.wrap(e)), () => void 0), () => {
14
- n = !0, t?.(), B(), R = !1;
15
- };
16
- }
17
- function te() {
18
- return {
19
- console: I.length ? [...I] : void 0,
20
- network: L.length ? [...L] : void 0
21
- };
22
- }
23
- function B() {
24
- I.length = 0, L.length = 0;
25
- }
26
- function ne(e, t, n, r) {
27
- try {
28
- if (new URL(t, location.href).href.startsWith(z)) return;
29
- } catch {}
30
- re(L, {
31
- method: e.slice(0, 10),
32
- url: H(t).slice(0, 2e3),
33
- status: n,
34
- duration_ms: Math.round(performance.now() - r)
35
- });
36
- }
37
- function re(e, t) {
38
- e.push(t), e.length > k && e.shift();
39
- }
40
- function V(e) {
41
- if (e.length < 24 || !/^[\w~+/=.-]+$/.test(e) || !/\d/.test(e) || !/[a-z]/i.test(e) || /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)) return !1;
42
- let t = /* @__PURE__ */ new Map();
43
- for (let n of e) t.set(n, (t.get(n) ?? 0) + 1);
44
- let n = 0;
45
- for (let r of t.values()) n -= r / e.length * Math.log2(r / e.length);
46
- return n >= 3.5;
47
- }
48
- function H(e) {
49
- try {
50
- let t = new URL(e, location.href);
51
- t.username = "", t.password = "", t.pathname = t.pathname.split("/").map((e) => P.test(e) || V(e) && /[A-Za-z\d]{16}/.test(e) && !e.includes(".") ? "[redacted]" : N(W(e)) === W(e) ? e : N(W(e))).join("/");
52
- for (let [e, n] of [...t.searchParams]) A.test(e) || V(n) ? t.searchParams.set(e, "[redacted]") : N(n) !== n && t.searchParams.set(e, N(n));
53
- return t.hash && (A.test(t.hash) || t.hash.split(/[#&=/]/).some(V) || N(W(t.hash)) !== W(t.hash)) && (t.hash = "#[redacted]"), t.toString();
54
- } catch {
55
- return "[unparseable url]";
56
- }
57
- }
58
- function U(e) {
59
- return e.replace(/Bearer\s+[A-Za-z0-9._~+/-]+=*/gi, "Bearer [redacted]").replace(new RegExp(P.source, "g"), "[redacted-jwt]").replace(/https?:\/\/[^\s"'<>]+/g, (e) => H(e)).replace(/\b((?:[\w-]*[_-])?(?:token|secret|password|passwd|pwd|api[_-]?key|access[_-]?key|private[_-]?key|session[_-]?id|signature|authorization|auth[_-]?code))(["']?\s*[:=]\s*["']?)(?!\[redacted)[^\s"'&,;]+/gi, "$1$2[redacted]").replace(/[\w~+=-]{24,}/g, (e) => V(e) ? "[redacted]" : e);
60
- }
61
- var W = (e) => {
62
- try {
63
- return decodeURIComponent(e);
64
- } catch {
65
- return e;
66
- }
67
- };
68
- function G(e) {
69
- return N(U(e.slice(0, F))).slice(0, F);
70
- }
71
- // src/ui/format.tsx
72
- function ie(e, t = innerWidth) {
73
- return !!e.breakpoint && Math.abs(e.breakpoint - t) > 200;
74
- }
75
- var ae = (e) => e < 600 ? "phone" : e < 1024 ? "tablet" : "wide", K = (e) => `${Math.round(e * 100) / 100}px`, q = (e, t, n, r) => ({
76
- left: K(e),
77
- top: K(t),
78
- ...n === void 0 ? {} : { width: K(n) },
79
- ...r === void 0 ? {} : { height: K(r) }
80
- });
81
- function oe({ text: e, people: t = [] }) {
82
- let n = _e(t), r = [], i = 0;
83
- for (let t of e.matchAll(se)) {
84
- let a = t.index ?? 0;
85
- a > i && r.push(J(e.slice(i, a), n)), r.push(/* @__PURE__ */ x("pre", {
86
- class: "ck-pre",
87
- children: /* @__PURE__ */ x("code", { children: t[2].replace(/^\n|\n$/g, "") })
88
- })), i = a + t[0].length;
89
- }
90
- return i < e.length && r.push(J(e.slice(i), n)), /* @__PURE__ */ x(l, { children: r });
91
- }
92
- var se = /```([\w-]*)\n?([\s\S]*?)```/g;
93
- function J(e, t) {
94
- let n = e.replace(/^\n/, "").split("\n");
95
- return n.map((e, r) => /* @__PURE__ */ x(l, { children: [ve(e, t), r < n.length - 1 ? /* @__PURE__ */ x("br", {}) : null] }));
96
- }
97
- var ce = null;
98
- function le(e) {
99
- ce = e;
100
- }
101
- function ue(e) {
102
- return [...e.includes("‍") ? e : e.replace(/\ufe0f/g, "")].map((e) => e.codePointAt(0).toString(16)).join("-");
103
- }
104
- function de({ char: e }) {
105
- let [t, n] = s(!1);
106
- return !ce || t ? /* @__PURE__ */ x(l, { children: e }) : /* @__PURE__ */ x("img", {
107
- class: "ck-emoji",
108
- src: `${ce}/emoji/${ue(e)}.svg`,
109
- alt: e,
110
- draggable: !1,
111
- loading: "lazy",
112
- onError: () => n(!0)
113
- });
114
- }
115
- var fe = String.raw`\p{Extended_Pictographic}(?:\ufe0f|\p{Emoji_Modifier}|\u200d\p{Extended_Pictographic}\ufe0f?)*`, pe = String.raw`\*\*[^*\n]+\*\*|~~[^~\n]+~~|\x60[^\x60\n]+\x60|\*[^*\s][^*\n]*\*|(?:^|[\s(\[])_[^_\n]+_(?![\p{L}\p{N}_])`, me = String.raw`https?:\/\/[^\s<>"')\u200b-\u200f\u202a-\u202e\u2060-\u2069\ufeff]+`, he = `${pe}|${me}`, ge = /* @__PURE__ */ new Map();
116
- function _e(e) {
117
- let t = e.join("\0"), n = ge.get(t);
118
- if (!n) {
119
- let r = [...e].filter(Boolean).sort((e, t) => t.length - e.length).map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")), i = `(?:^|[\\s(\\[])@(?:${r.length ? `${r.join("|")}|` : ""}[\\p{L}\\p{N}._-]+)`;
120
- n = RegExp(`${he}|${i}|${fe}`, "gu"), ge.set(t, n);
121
- }
122
- return n;
123
- }
124
- function ve(e, t) {
125
- let n = [], r = 0;
126
- for (let i of e.matchAll(t)) {
127
- let a = i[0], o = i.index ?? 0;
128
- if (/^[\s(\[]/.test(a) && /[_@]/.test(a[1] ?? "") && (o += 1, a = a.slice(1)), o > r && n.push(e.slice(r, o)), a.startsWith("**")) n.push(/* @__PURE__ */ x("strong", { children: ve(a.slice(2, -2), t) }));
129
- else if (a.startsWith("~~")) n.push(/* @__PURE__ */ x("s", { children: ve(a.slice(2, -2), t) }));
130
- else if (a.startsWith("`")) n.push(/* @__PURE__ */ x("code", { children: a.slice(1, -1) }));
131
- else if (a.startsWith("*") || a.startsWith("_")) n.push(/* @__PURE__ */ x("em", { children: ve(a.slice(1, -1), t) }));
132
- else if (a.startsWith("@")) n.push(/* @__PURE__ */ x("span", {
133
- class: "ck-mention",
134
- children: /* @__PURE__ */ x("bdi", { children: a })
135
- }));
136
- else if (/^\p{Extended_Pictographic}/u.test(a)) n.push(/* @__PURE__ */ x(de, { char: a }));
137
- else {
138
- let e = ye(a);
139
- n.push(e ? /* @__PURE__ */ x("a", {
140
- href: e,
141
- target: "_blank",
142
- rel: "noopener noreferrer nofollow ugc",
143
- children: a
144
- }) : a);
145
- }
146
- r = o + a.length;
147
- }
148
- return r < e.length && n.push(e.slice(r)), n;
149
- }
150
- function ye(e, t = "link") {
151
- if (!e) return null;
152
- try {
153
- let n = new URL(e);
154
- return n.protocol === "https:" || n.protocol === "http:" || t === "link" && n.protocol === "mailto:" ? n.href : null;
155
- } catch {
156
- return null;
157
- }
158
- }
159
- function be({ person: e }) {
160
- let [t, n] = s(!1), r = e.name.split(/\s+/).map((e) => [...e][0]).slice(0, 2).join("").toUpperCase() || "?";
161
- return /* @__PURE__ */ x("span", {
162
- class: "ck-avatar",
163
- "aria-hidden": "true",
164
- children: !t && e.avatar_url && /^https:\/\//.test(e.avatar_url) ? /* @__PURE__ */ x("img", {
165
- src: e.avatar_url,
166
- alt: "",
167
- referrerPolicy: "no-referrer",
168
- onError: () => n(!0)
169
- }) : r
170
- });
171
- }
172
- var xe = (e) => u(`status_${e}`);
173
- function Se({ status: e }) {
174
- let t = xe(e);
175
- return /* @__PURE__ */ x("span", {
176
- class: "ck-status",
177
- "data-status": e,
178
- title: t,
179
- children: t
180
- });
181
- }
182
- function Y({ name: e, size: t = 18 }) {
183
- return /* @__PURE__ */ x("svg", {
184
- width: t,
185
- height: t,
186
- viewBox: "0 0 24 24",
187
- fill: "none",
188
- stroke: "currentColor",
189
- "stroke-width": e === "more" ? 3.2 : 2,
190
- "stroke-linecap": "round",
191
- "stroke-linejoin": "round",
192
- "aria-hidden": "true",
193
- children: /* @__PURE__ */ x("path", { d: {
194
- agent: "M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9zM18.5 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z",
195
- comment: "M4 5h16v11H8l-4 4z",
196
- inbox: "M4 13l2-8h12l2 8M4 13v6h16v-6M4 13h5l1 2h4l1-2h5",
197
- close: "M6 6l12 12M18 6L6 18",
198
- more: "M5 12h.01M12 12h.01M19 12h.01",
199
- image: "M4 5h16v14H4zM4 15l4-4 4 4 3-3 5 5M15 9h.01",
200
- paperclip: "M17.5 8.5v7a5.5 5.5 0 0 1-11 0V7a3.75 3.75 0 0 1 7.5 0v8.25a2 2 0 0 1-4 0V8.5",
201
- pen: "M4 20l4-1 11-11-3-3L5 16zM14 6l3 3",
202
- check: "M5 12l4 4 10-10",
203
- user: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 20a8 8 0 0 1 16 0",
204
- bold: "M7 5h6a3.5 3.5 0 0 1 0 7H7zM7 12h7a3.5 3.5 0 0 1 0 7H7z",
205
- italic: "M10 5h8M6 19h8M14 5l-4 14",
206
- strike: "M5 12h14M16 7.5A4 3 0 0 0 12 5c-2.5 0-4 1.3-4 3s1.5 2.4 4 3M8 16.5c.6 1.5 2.1 2.5 4 2.5 2.5 0 4-1.3 4-3",
207
- code: "M9 8l-4 4 4 4M15 8l4 4-4 4",
208
- reply: "M10 8L5 12l5 4M5 12h9a5 5 0 0 1 5 5v1",
209
- copy: "M9 9h10v10H9zM5 15V5h10",
210
- info: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 11v5M12 8h.01",
211
- alert: "M12 4l9 16H3zM12 10v4M12 17h.01",
212
- down: "M12 5v14M6 13l6 6 6-6",
213
- search: "M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14zM20 20l-4-4",
214
- clock: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 7v5l3 2",
215
- device: "M4 5h16v11H4zM9 20h6M12 16v4",
216
- chevron: "M9 6l6 6-6 6",
217
- flag: "M5 21V4h11l-2 4 2 4H5",
218
- pin: "M12 21s7-6.5 7-12a7 7 0 1 0-14 0c0 5.5 7 12 7 12zM12 11.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z",
219
- area: "M4 8V4h4M16 4h4v4M20 16v4h-4M8 20H4v-4",
220
- quote: "M7 7h4v4c0 3-2 5-4 5M14 7h4v4c0 3-2 5-4 5",
221
- page: "M6 3h9l4 4v14H6zM14 3v5h5",
222
- smile: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM8.5 14a4.5 4.5 0 0 0 7 0M9 9.5h.01M15 9.5h.01",
223
- link: "M10 14a4 4 0 0 0 6 0l3-3a4 4 0 0 0-6-6l-1 1M14 10a4 4 0 0 0-6 0l-3 3a4 4 0 0 0 6 6l1-1"
224
- }[e] })
225
- });
226
- }
227
- function Ce(e) {
228
- e?.focus({ preventScroll: !0 });
229
- }
230
- function we(e) {
231
- if (!e) return;
232
- let t = e.getBoundingClientRect(), n = e.parentElement?.closest(".ck-panel, .ck-card")?.getBoundingClientRect() ?? {
233
- left: 0,
234
- right: innerWidth
235
- }, r = Math.min(0, n.right - 8 - t.right);
236
- t.left + r < n.left + 8 && (r = n.left + 8 - t.left), r && (e.style.translate = `${Math.round(r)}px 0`);
237
- }
238
- // src/ui/hooks.ts
239
- function X(e, t) {
240
- let [n, r] = s(() => t(e.get()));
241
- return d(() => (r(t(e.get())), e.subscribe((e) => r(() => t(e)))), [e]), n;
242
- }
243
- function Te(e) {
244
- let [, t] = s(0), [n] = s(() => ({
245
- version: 0,
246
- watch: () => void 0
247
- }));
248
- return d(() => {
249
- if (!e) return;
250
- let r = 0, i = 0, a = 0, o = 0, s = -1e9, c = !1, l = () => {
251
- r = 0, c && (c = !1, n.version++, s = performance.now()), t((e) => e + 1);
252
- }, u = () => {
253
- r || (r = requestAnimationFrame(l));
254
- }, d = (e = 0) => {
255
- c = !0;
256
- let t = performance.now(), n = Math.max(t + e, s + 100);
257
- i && n >= o || (clearTimeout(i), o = n, i = window.setTimeout(() => {
258
- i = 0, u();
259
- }, n - t));
260
- }, f = () => d(), p = -1e9, m = () => {
261
- let e = performance.now();
262
- n.scrolling = e - p < 60, p = e, clearTimeout(a), a = window.setTimeout(() => {
263
- n.scrolling = !1, u();
264
- }, 150), u();
265
- }, h = new MutationObserver((e) => {
266
- let t = -1;
267
- for (let n of e) if (!(n.target instanceof Element && n.target.closest("[data-commentkit-host]")) && !(t = n.type === "childList" ? 0 : 250)) break;
268
- t >= 0 && d(t);
269
- });
270
- h.observe(document.documentElement, {
271
- subtree: !0,
272
- childList: !0,
273
- attributes: !0,
274
- characterData: !0
275
- });
276
- let g = typeof ResizeObserver == "function" ? new ResizeObserver(u) : null, _ = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Set(), y = (e) => {
277
- for (let t of v) e.has(t) || t.removeEventListener("scroll", m, !0);
278
- for (let t of e) v.has(t) || t.addEventListener("scroll", m, !0);
279
- v = e;
280
- };
281
- n.watch = (e) => {
282
- let t = /* @__PURE__ */ new Set([
283
- document.documentElement,
284
- document.body,
285
- ...e
286
- ]);
287
- for (let e of _) t.has(e) || g?.unobserve(e);
288
- for (let e of t) _.has(e) || g?.observe(e);
289
- _ = t;
290
- let n = /* @__PURE__ */ new Set();
291
- for (let t of e) for (let e = t.ownerDocument.defaultView; e && e !== window && !n.has(e); e = e.parent) n.add(e);
292
- y(n);
293
- }, n.watch([]);
294
- let b = [
295
- "load",
296
- "transitionend",
297
- "animationend"
298
- ];
299
- addEventListener("resize", f), addEventListener("scroll", m, !0), b.forEach((e) => addEventListener(e, u, !0)), document.fonts?.ready.then(u).catch(() => void 0);
300
- let x = setInterval(f, 2e3);
301
- return () => {
302
- h.disconnect(), g?.disconnect(), n.watch = () => void 0, y(/* @__PURE__ */ new Set()), removeEventListener("resize", f), removeEventListener("scroll", m, !0), b.forEach((e) => removeEventListener(e, u, !0)), clearInterval(x), clearTimeout(i), clearTimeout(a), cancelAnimationFrame(r), n.scrolling = !1;
303
- };
304
- }, [e]), n;
305
- }
306
- function Ee() {
307
- let [e, t] = s(() => typeof navigator > "u" || navigator.onLine !== !1);
308
- return d(() => {
309
- let e = () => t(!0), n = () => t(!1);
310
- return addEventListener("online", e), addEventListener("offline", n), () => {
311
- removeEventListener("online", e), removeEventListener("offline", n);
312
- };
313
- }, []), e;
314
- }
315
- function De(e, t, n = !1) {
316
- let r = !n && getComputedStyle(e.currentTarget).direction === "rtl", i = n ? [
317
- "ArrowDown",
318
- "j",
319
- "J"
320
- ] : [r ? "ArrowLeft" : "ArrowRight"], a = n ? [
321
- "ArrowUp",
322
- "k",
323
- "K"
324
- ] : [r ? "ArrowRight" : "ArrowLeft"], o = i.includes(e.key) ? 1 : a.includes(e.key) ? -1 : e.key === "Home" ? "first" : e.key === "End" ? "last" : null;
325
- if (o === null) return;
326
- let s = e.currentTarget, c = [...s.querySelectorAll(t)].filter((e) => !e.hasAttribute("disabled"));
327
- if (!c.length) return;
328
- e.preventDefault();
329
- let l = c.indexOf(s.getRootNode().activeElement);
330
- c[o === "first" ? 0 : o === "last" ? c.length - 1 : (Math.max(l, o > 0 ? -1 : 0) + o + c.length) % c.length]?.focus();
331
- }
332
- function Z(e, t, n) {
333
- let [r, i] = s(null);
334
- return d(() => {
335
- e && !r && t().then((e) => i(() => e), n);
336
- }, [e]), r;
337
- }
338
- function Oe(e, t, n) {
339
- f(() => {
340
- if (!e) return;
341
- let r = (e) => t.current && !e.composedPath().includes(t.current) && n();
342
- return addEventListener("pointerdown", r, !0), () => removeEventListener("pointerdown", r, !0);
343
- }, [e]);
344
- }
345
- function ke(e) {
346
- return e.composedPath().some((e) => e instanceof HTMLElement && (e.isContentEditable || [
347
- "INPUT",
348
- "TEXTAREA",
349
- "SELECT"
350
- ].includes(e.tagName)));
351
- }
352
- function Ae(e) {
353
- let t = e.target;
354
- return (t === document.body || t === document.documentElement || t instanceof Element && t.hasAttribute("data-commentkit-host")) && !ke(e);
355
- }
356
- function je() {
357
- return typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
358
- }
359
- function Me() {
360
- return matchMedia("(pointer: coarse)").matches && !matchMedia("(any-pointer: fine)").matches;
361
- }
362
- // src/ui/errors.ts
363
- var Ne = {
364
- network_error: "networkError",
365
- upload_failed: "uploadFailed",
366
- share_expired: "shareExpired",
367
- no_access: "noAccess",
368
- wrong_project: "noAccess",
369
- guest_removed: "verifyRemoved",
370
- origin_not_allowed: "originNotAllowed",
371
- origin_required: "originNotAllowed",
372
- widget_disabled: "paused",
373
- plan_required: "readOnlyGuest",
374
- not_found: "threadNotFound",
375
- forbidden: "forbidden",
376
- rate_limited: "tooFast",
377
- guest_codes_paused: "guestCodesPaused",
378
- edit_conflict: "editConflict",
379
- internal_error: "serverError",
380
- insecure_context: "insecureContext"
381
- }, Pe = /* @__PURE__ */ new Set(["file_rejected", "thread_not_found"]);
382
- function Fe(e) {
383
- if (!(e instanceof r)) return u("errorGeneric");
384
- if (Pe.has(e.code)) return e.message;
385
- let t = Ne[e.code] ?? (e.status === 410 ? "shareExpired" : e.status === 429 ? "tooFast" : null);
386
- return t ? u(t) : _() === "en" && e.status >= 400 && e.message ? e.message : u("errorGeneric");
387
- }
388
- // src/ui/draft-key.ts
389
- var Ie = "commentkit:pending-compose";
390
- function Le(e, t, n = e.pageKey()) {
391
- return D(e.options.project, n, t.type, t.selector, t.ck_id, t.source, t.quote);
392
- }
393
- // src/ui/privacy.ts
394
- var Re = (e, t) => e?.privacy?.mode === "strict" ? "strict" : t, ze = [], Be = null;
395
- function Ve(e) {
396
- Be = e, e && ze.forEach((t) => Ue(e, t));
397
- }
398
- function He(e) {
399
- ze.includes(e) || (ze.push(e), Be && Ue(Be, e));
400
- }
401
- function Ue(e, t) {
402
- if ("adoptedStyleSheets" in e && "replaceSync" in CSSStyleSheet.prototype) {
403
- let n = new CSSStyleSheet();
404
- n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n];
405
- } else {
406
- let n = document.createElement("style");
407
- n.textContent = t, e.insertBefore(n, e.querySelector(".ck-root"));
408
- }
409
- }
410
- // src/ui/deep-links.ts
411
- var We = "commentkit:share";
412
- function Ge(e, t) {
413
- let n = new URL(location.href).searchParams.get(e);
414
- return !n || !t.test(n) ? null : (Ye(location.href.replace(/^[^#]*/, (t) => t.replace(RegExp(`([?&])${e}=[^&]*(&?)`), (e, t, n) => n ? t : ""))), n);
415
- }
416
- function Ke(e, t) {
417
- let [, n = "", r = ""] = /^([^#]*)(.*)$/s.exec(e) ?? [];
418
- return `${n}${n.includes("?") ? "&" : "?"}ck_thread=${encodeURIComponent(t)}${r}`;
419
- }
420
- function qe() {
421
- let e = Ge("ck", /^[A-Za-z0-9]{16,128}$/);
422
- return e && E(We, e), e ?? E(We);
423
- }
424
- var Je = () => Ge("ck_thread", /^[0-9a-f-]{36}$/i);
425
- function Ye(e) {
426
- try {
427
- history.replaceState(history.state, "", e);
428
- } catch {}
429
- }
430
- function Xe(e, t = () => location.href) {
431
- let n = location.href, r = t(), i = () => {
432
- if (location.href !== n) {
433
- n = location.href;
434
- try {
435
- let n = t(), i = n !== r;
436
- r = n, e(i);
437
- } catch {}
438
- }
439
- }, a = setInterval(i, 500);
440
- return addEventListener("popstate", i), addEventListener("hashchange", i), () => {
441
- clearInterval(a), removeEventListener("popstate", i), removeEventListener("hashchange", i);
442
- };
443
- }
444
- // src/ui/prefs.ts
445
- var Ze = "commentkit:v1:prefs", Qe = /* @__PURE__ */ new Set(), $e = null;
446
- function et(e = !0) {
447
- if ($e !== null) return $e;
448
- try {
449
- let t = JSON.parse(O(Ze) ?? "{}")?.shortcuts;
450
- return typeof t == "boolean" ? t : e;
451
- } catch {
452
- return e;
453
- }
454
- }
455
- function tt(e) {
456
- return e.options.shortcuts !== !1 && et(!!e.state.get().session?.capabilities.triage);
457
- }
458
- function nt(e) {
459
- $e = e, O(Ze, JSON.stringify({ shortcuts: e })), Qe.forEach((e) => e());
460
- }
461
- function rt(e) {
462
- return Qe.add(e), () => void Qe.delete(e);
463
- }
464
- // src/ui/chunks.ts
465
- function it(e, n, r, i, a, o) {
466
- let s = Z(a, () => t(() => import("./Settings-CB5eEKnf.js")).then((e) => e.Settings), o), c = Z(i, () => t(() => import("./Shortcuts-eAyjJ89P.js")).then((e) => e.Shortcuts), o), l = Z(r.name === "commenting" || r.name === "composing", () => t(() => import("./Composer-Bveq5QrK.js")).then((t) => (e.state.get().config?.features.screenshots !== !1 && t.warmCapture(), t.Composer)), o), u = Z(r.name === "verify", () => t(() => import("./Guest-7hcN765o.js")).then((e) => e.GuestVerify), o), d = Z(r.name === "panel", () => t(() => import("./Panel-ChPUB68C.js")).then((e) => e.Panel), o), p = Z(r.name === "thread" || r.name === "panel" ? r.threadId : null, () => t(() => import("./ThreadCard-B1EsX3PR.js")).then((e) => e.ThreadCard), o), m = () => [[...e.state.get().config?.privacy?.redact_selectors ?? [], ...e.options.redact ?? []], Re(e.state.get().config, e.options.privacy)], h = Z(!0, () => Promise.all([t(() => import("./context-BuMl7A07.js").then((e) => e.t)), t(() => import("./pick-B3sR7jtS.js"))]).then(([e, t]) => (e.install(), e.configurePrivacy(...m()), {
467
- configurePrivacy: e.configurePrivacy,
468
- picker: t
469
- })), o);
470
- return f(() => h?.configurePrivacy(...m()), [h, n]), {
471
- Settings: s,
472
- Shortcuts: c,
473
- Composer: l,
474
- GuestVerify: u,
475
- Panel: d,
476
- ThreadCard: p,
477
- anchors: h
478
- };
479
- }
480
- // src/ui/dock.ts
481
- var at = "commentkit:dock";
482
- function ot(e, t) {
483
- let [n, r] = s(() => {
484
- let e = O(at);
485
- return e && /^(top|bottom)-(left|center|right)$/.test(e) ? e : null;
486
- });
487
- return [n ?? e.options.position ?? t?.appearance.position ?? "bottom-right", (e) => {
488
- r(e), O(at, e);
489
- }];
490
- }
491
- // src/ui/keys.ts
492
- var st = (e) => !e.metaKey && !e.ctrlKey && !e.altKey, ct = (e, t) => e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains(t));
493
- function lt(e, t) {
494
- let { key: n } = e;
495
- if (e.defaultPrevented || ke(e) || ct(e, "ck-markup") || ct(e, "ck-pop") || n !== "Escape" && !(t.keys && Ae(e))) return null;
496
- if (t.help) return n === "Escape" ? "closeHelp" : null;
497
- let { view: r, threads: i } = t;
498
- if (n === "?" && st(e)) return "help";
499
- if (n === "Escape" && r.name !== "idle") return "back";
500
- if ((n === "c" || n === "C") && st(e) && r.name === "idle") return "comment";
501
- if ((n === "j" || n === "k") && st(e) && t.signedIn && (r.name === "idle" || r.name === "thread")) {
502
- if (!i.length || ct(e, "ck-panel")) return null;
503
- let t = r.name === "thread" ? i.findIndex((e) => e.id === r.threadId) : -1;
504
- return i[(t + (n === "j" ? 1 : i.length - 1 + +(t < 0))) % i.length] ?? null;
505
- }
506
- return null;
507
- }
508
- function ut(e, t) {
509
- f(() => {
510
- let n = (n) => {
511
- let r = lt(n, e());
512
- r && (r !== "closeHelp" && n.preventDefault(), t(r));
513
- };
514
- return addEventListener("keydown", n, !0), () => removeEventListener("keydown", n, !0);
515
- });
516
- }
517
- function dt(e, t, n, r) {
518
- let i = t.name === "commenting", a = g(!1);
519
- d(() => {
520
- (a.current || i) && e.emit("mode", { commenting: i }), a.current = !0;
521
- }, [i]);
522
- let o = X(e.state, (e) => e.request);
523
- d(() => {
524
- o && (e.state.set({ request: null }), o.kind === "comment" ? i || r.comment() : o.kind === "stop" ? r.go({ name: "stop" }) : n ? r.togglePanel() : r.signIn());
525
- }, [o]);
526
- }
527
- // src/ui/Launcher.tsx
528
- function ft({ client: e, position: t, onMove: n, commenting: r, panelOpen: i, onComment: a, onPanel: o, onSignIn: c, onSignOut: f, onShortcuts: p, onApprove: m, onHide: h, onSettings: _, waiting: v, onCode: y, covered: b }) {
529
- let S = X(e.state, (e) => e.config?.read_only ?? !1), C = X(e.state, (e) => e.session), w = X(e.state, (e) => e.unread), [T, E] = s(!1), [D, O] = s(null), k = g(null), A = g(null), j = g(null);
530
- d(() => void (T && A.current?.querySelector("[role=menuitem]")?.focus()), [T]), Oe(T, A, () => E(!1));
531
- let M = je();
532
- return /* @__PURE__ */ x("div", {
533
- class: "ck-launcher",
534
- "data-pos": t,
535
- "data-covered": b,
536
- "data-dragging": D ? "true" : void 0,
537
- "data-commentkit-ui": !0,
538
- ref: A,
539
- style: D ? {
540
- left: K(D.x),
541
- top: K(D.y),
542
- right: "auto",
543
- bottom: "auto",
544
- translate: "none"
545
- } : void 0,
546
- children: [
547
- T ? null : v ? /* @__PURE__ */ x("div", {
548
- class: "ck-note ck-launcher-note",
549
- role: "status",
550
- children: [
551
- u("pendingNote", { email: v }),
552
- " ",
553
- /* @__PURE__ */ x("button", {
554
- class: "ck-btn",
555
- onClick: y,
556
- children: u("enterCode")
557
- })
558
- ]
559
- }) : S ? /* @__PURE__ */ x("div", {
560
- class: "ck-note ck-launcher-note",
561
- role: "status",
562
- children: u("readOnlyShort")
563
- }) : null,
564
- /* @__PURE__ */ x("div", {
565
- class: "ck-bar",
566
- role: "group",
567
- "aria-label": "CommentKit",
568
- children: [
569
- /* @__PURE__ */ x("button", {
570
- class: "ck-bar-btn",
571
- "aria-pressed": r,
572
- onClick: a,
573
- title: u("commentHint"),
574
- "aria-keyshortcuts": p ? "C" : void 0,
575
- children: [/* @__PURE__ */ x(Y, { name: "comment" }), /* @__PURE__ */ x("span", {
576
- class: "ck-label",
577
- children: u("comment")
578
- })]
579
- }),
580
- C ? /* @__PURE__ */ x("button", {
581
- class: "ck-bar-btn ck-icon-btn",
582
- "aria-pressed": i,
583
- onClick: o,
584
- title: u("inbox"),
585
- "aria-label": `${u("inbox")}${w ? ` (${w})` : ""}`,
586
- children: [/* @__PURE__ */ x(Y, { name: "inbox" }), w > 0 ? /* @__PURE__ */ x("span", {
587
- class: "ck-badge",
588
- children: w > 99 ? "99+" : w
589
- }) : null]
590
- }) : null,
591
- /* @__PURE__ */ x("button", {
592
- class: "ck-bar-btn ck-icon-btn",
593
- ref: j,
594
- "aria-haspopup": "menu",
595
- "aria-expanded": T,
596
- onClick: () => E(!T),
597
- "aria-label": u("more"),
598
- title: u("more"),
599
- children: /* @__PURE__ */ x(Y, { name: "more" })
600
- }),
601
- /* @__PURE__ */ x("button", {
602
- class: "ck-grip",
603
- "aria-label": u("moveToolbar"),
604
- title: u("moveToolbar"),
605
- "aria-keyshortcuts": "ArrowLeft ArrowRight ArrowUp ArrowDown",
606
- onPointerDown: (e) => {
607
- if (e.button !== 0) return;
608
- let t = e.currentTarget.closest(".ck-launcher").getBoundingClientRect();
609
- k.current = {
610
- dx: e.clientX - t.left,
611
- dy: e.clientY - t.top
612
- }, e.currentTarget.setPointerCapture(e.pointerId);
613
- },
614
- onPointerMove: (e) => {
615
- let t = k.current;
616
- t && O({
617
- x: e.clientX - t.dx,
618
- y: e.clientY - t.dy
619
- });
620
- },
621
- onPointerUp: (e) => {
622
- let t = k.current;
623
- if (k.current = null, !t || !D) return O(null);
624
- O(null), n(pt(e.clientX, e.clientY));
625
- },
626
- onPointerCancel: () => (k.current = null, O(null)),
627
- onKeyDown: (e) => {
628
- let r = mt(t, e.key);
629
- r && (e.preventDefault(), n(r));
630
- },
631
- children: /* @__PURE__ */ x("svg", {
632
- width: "8",
633
- height: "14",
634
- viewBox: "0 0 8 14",
635
- "aria-hidden": "true",
636
- children: [
637
- /* @__PURE__ */ x("circle", {
638
- cx: "2",
639
- cy: "2",
640
- r: "1.2"
641
- }),
642
- /* @__PURE__ */ x("circle", {
643
- cx: "6",
644
- cy: "2",
645
- r: "1.2"
646
- }),
647
- /* @__PURE__ */ x("circle", {
648
- cx: "2",
649
- cy: "7",
650
- r: "1.2"
651
- }),
652
- /* @__PURE__ */ x("circle", {
653
- cx: "6",
654
- cy: "7",
655
- r: "1.2"
656
- }),
657
- /* @__PURE__ */ x("circle", {
658
- cx: "2",
659
- cy: "12",
660
- r: "1.2"
661
- }),
662
- /* @__PURE__ */ x("circle", {
663
- cx: "6",
664
- cy: "12",
665
- r: "1.2"
666
- })
667
- ]
668
- })
669
- })
670
- ]
671
- }),
672
- T ? /* @__PURE__ */ x("div", {
673
- class: "ck-menu ck-pop",
674
- role: "menu",
675
- onClick: () => (E(!1), j.current?.focus()),
676
- onKeyDown: (e) => e.key === "Escape" ? (e.stopPropagation(), E(!1), j.current?.focus()) : De(e, "[role=menuitem]", !0),
677
- children: [
678
- C ? /* @__PURE__ */ x(l, { children: [
679
- /* @__PURE__ */ x("div", {
680
- class: "ck-menu-head",
681
- title: `${C.person.name} · ${C.project.name}`,
682
- children: [
683
- /* @__PURE__ */ x("bdi", { children: C.person.name }),
684
- " · ",
685
- /* @__PURE__ */ x("bdi", { children: C.project.name })
686
- ]
687
- }),
688
- /* @__PURE__ */ x("button", {
689
- role: "menuitem",
690
- onClick: _,
691
- children: u("settings")
692
- }),
693
- m ? /* @__PURE__ */ x("button", {
694
- role: "menuitem",
695
- onClick: m,
696
- children: u("signOffApprove")
697
- }) : null
698
- ] }) : /* @__PURE__ */ x("button", {
699
- role: "menuitem",
700
- onClick: c,
701
- children: u("signInMember")
702
- }),
703
- p ? /* @__PURE__ */ x("button", {
704
- role: "menuitem",
705
- "aria-keyshortcuts": "?",
706
- onClick: p,
707
- children: u("shortcutsTitle")
708
- }) : null,
709
- /* @__PURE__ */ x("button", {
710
- role: "menuitem",
711
- class: "ck-menu-two",
712
- "aria-keyshortcuts": M ? "Meta+Shift+K" : "Control+Shift+K",
713
- onClick: h,
714
- children: [u("hideWidget"), Me() ? null : /* @__PURE__ */ x("span", {
715
- class: "ck-muted",
716
- children: u("hideWidgetHint", { keys: M ? "⌘ Shift K" : "Ctrl Shift K" })
717
- })]
718
- }),
719
- C ? /* @__PURE__ */ x("button", {
720
- role: "menuitem",
721
- class: "ck-danger",
722
- onClick: f,
723
- children: u("signOut")
724
- }) : null
725
- ]
726
- }) : null
727
- ]
728
- });
729
- }
730
- function pt(e, t) {
731
- return `${t < innerHeight / 2 ? "top" : "bottom"}-${e < innerWidth / 3 ? "left" : e > innerWidth * 2 / 3 ? "right" : "center"}`;
732
- }
733
- function mt(e, t) {
734
- let [n, r] = e.split("-"), i = [
735
- "left",
736
- "center",
737
- "right"
738
- ], a = i.indexOf(r);
739
- return t === "ArrowLeft" && a > 0 ? `${n}-${i[a - 1]}` : t === "ArrowRight" && a < 2 ? `${n}-${i[a + 1]}` : t === "ArrowUp" && n === "bottom" ? `top-${r}` : t === "ArrowDown" && n === "top" ? `bottom-${r}` : null;
740
- }
741
- function ht({ onCancel: e, onPick: t, quote: n = !0, move: r = !1, picker: c = null }) {
742
- let [p] = s(() => {
743
- let e = document.activeElement;
744
- return e && e !== document.body && e !== document.documentElement && !i(e) ? e : null;
745
- }), m = S(() => matchMedia("(pointer: coarse)").matches, []), [h, _] = s(null), v = g(c);
746
- d(() => {
747
- let e = !0, r = (r) => {
748
- if (!e) return;
749
- v.current = r, r.prepare();
750
- let i = n ? r.selected() : null, o = i?.toString().trim();
751
- if (i && o) {
752
- let e = a(i.startContainer, i.getBoundingClientRect()), n = i.commonAncestorContainer.nodeType === 1 ? i.commonAncestorContainer : i.commonAncestorContainer.parentElement;
753
- t({
754
- anchor: y({
755
- element: n,
756
- clientX: e.left,
757
- clientY: e.top,
758
- quote: o
759
- }),
760
- point: {
761
- x: e.left,
762
- y: e.bottom
763
- },
764
- region: {
765
- x: e.left,
766
- y: e.top,
767
- w: e.width,
768
- h: e.height
769
- }
770
- });
771
- }
772
- };
773
- return c ? r(c) : import("./pick-B3sR7jtS.js").then(r, () => {}), () => void (e = !1);
774
- }, []);
775
- let y = (e) => o({
776
- ...e,
777
- extra: v.current?.extra
778
- }), [b, C] = s(null), w = g(null), T = g(null), [E, D] = s([]), O = g(null), k = g(null);
779
- f(() => k.current?.focus({ preventScroll: !0 }), []);
780
- let A = g(null), j = g({
781
- timer: null,
782
- fired: !1
783
- }), M = () => {
784
- j.current.timer && clearTimeout(j.current.timer), j.current.timer = null;
785
- };
786
- d(() => M, []);
787
- let N = (e, t) => {
788
- let n = O.current;
789
- if (!n) return null;
790
- let r = v.current;
791
- n.style.pointerEvents = "none";
792
- let a = r ? r.deepAt(e, t) : document.elementsFromPoint(e, t).find((e) => !i(e) && e !== document.documentElement && e !== document.body) ?? document.body;
793
- return n.style.pointerEvents = "auto", r ? r.paintedAt(a, (n) => {
794
- let i = I(e, t);
795
- return !!i && n.contains(i.node) && r.overText(e, t, i);
796
- }) : a;
797
- }, P = (e) => {
798
- if (!v.current) return;
799
- let n = a(e), r = n.left + Math.min(n.width / 2, 24), i = n.top + Math.min(n.height / 2, 24);
800
- t({
801
- anchor: y({
802
- element: e,
803
- clientX: r,
804
- clientY: i
805
- }),
806
- point: {
807
- x: r,
808
- y: n.top + n.height
809
- },
810
- region: null
811
- });
812
- }, F = () => {
813
- t({
814
- anchor: {
815
- type: "page",
816
- page: {
817
- x: 50,
818
- y: Math.round(scrollY + Math.min(120, innerHeight / 3))
819
- }
820
- },
821
- point: {
822
- x: innerWidth / 2,
823
- y: Math.min(120, innerHeight / 3)
824
- },
825
- region: null
826
- });
827
- }, I = (e, t) => {
828
- let n = O.current, r = v.current;
829
- if (!n || !r) return null;
830
- n.style.pointerEvents = "none";
831
- try {
832
- return r.caretAt(e, t);
833
- } finally {
834
- n.style.pointerEvents = "auto";
835
- }
836
- };
837
- return f(() => {
838
- let t = (t) => {
839
- if (t.key === "Escape") e();
840
- else if (r && t.key === "Enter") {
841
- let e = document.activeElement;
842
- if (!e || e === document.body || e.hasAttribute("data-commentkit-host")) return;
843
- t.preventDefault(), P(e);
844
- } else t.key === "Enter" && !t.composedPath().some((e) => e instanceof HTMLButtonElement) && (t.preventDefault(), p ? P(p) : F());
845
- };
846
- return addEventListener("keydown", t), () => removeEventListener("keydown", t);
847
- }, [e, r]), /* @__PURE__ */ x(l, { children: [
848
- /* @__PURE__ */ x("div", {
849
- class: "ck-mode-frame",
850
- "aria-hidden": "true",
851
- "data-commentkit-ui": !0
852
- }),
853
- /* @__PURE__ */ x("div", {
854
- class: "ck-mode-hint",
855
- role: "group",
856
- "aria-label": u("comment"),
857
- "data-commentkit-ui": !0,
858
- children: [
859
- /* @__PURE__ */ x("span", {
860
- role: "status",
861
- children: u(r ? m ? "movePinHintTouch" : "movePinHint" : n ? m ? "modeBarTouch" : "modeBar" : m ? "modeBarTouchNoText" : "modeBarNoText")
862
- }),
863
- r ? null : p ? /* @__PURE__ */ x("button", {
864
- class: "ck-chip",
865
- ref: k,
866
- onClick: () => P(p),
867
- children: u("commentFocused")
868
- }) : null,
869
- r ? null : /* @__PURE__ */ x("button", {
870
- class: "ck-chip",
871
- ref: p ? void 0 : k,
872
- onClick: F,
873
- children: u("commentOnPage")
874
- }),
875
- /* @__PURE__ */ x("button", {
876
- class: "ck-chip",
877
- ref: r ? k : void 0,
878
- onClick: e,
879
- children: u("cancel")
880
- })
881
- ]
882
- }),
883
- /* @__PURE__ */ x("div", {
884
- ref: O,
885
- class: "ck-catcher",
886
- "data-commentkit-ui": !0,
887
- onPointerMove: (e) => {
888
- if (e.pointerType === "touch") {
889
- let t = A.current;
890
- t && (Math.abs(e.clientX - t.x) > 8 || Math.abs(e.clientY - t.y) > 8) && M();
891
- return;
892
- }
893
- if (A.current && w.current) {
894
- let t = I(e.clientX, e.clientY);
895
- if (!t) return;
896
- let n = v.current, r = n.between(w.current, t);
897
- if (!r) return;
898
- T.current = r, D(n.boxesOf(r).filter((e) => e.width > 0 && e.height > 0).slice(0, 200));
899
- return;
900
- }
901
- if (A.current) {
902
- C({
903
- x: A.current.x,
904
- y: A.current.y,
905
- x2: e.clientX,
906
- y2: e.clientY
907
- });
908
- return;
909
- }
910
- let t = N(e.clientX, e.clientY);
911
- _(t ? a(t) : null);
912
- },
913
- onPointerDown: (e) => {
914
- if (e.button !== 0 || !v.current) return;
915
- let r = N(e.clientX, e.clientY);
916
- if (r) {
917
- if (A.current = {
918
- x: e.clientX,
919
- y: e.clientY,
920
- target: r
921
- }, j.current.fired = !1, w.current = null, T.current = null, n && e.pointerType !== "touch" && !e.shiftKey) {
922
- let t = I(e.clientX, e.clientY);
923
- t && v.current.overText(e.clientX, e.clientY, t) && (w.current = t);
924
- }
925
- e.pointerType === "touch" && (e.preventDefault(), M(), j.current.timer = setTimeout(() => {
926
- let e = A.current;
927
- j.current.timer = null, e && (j.current.fired = !0, A.current = null, gt(e.x, e.y), t({
928
- anchor: y({
929
- element: e.target,
930
- clientX: e.x,
931
- clientY: e.y
932
- }),
933
- point: {
934
- x: e.x,
935
- y: e.y
936
- },
937
- region: null
938
- }));
939
- }, 500)), e.pointerType !== "touch" && O.current?.setPointerCapture(e.pointerId);
940
- }
941
- },
942
- onPointerUp: (e) => {
943
- M();
944
- let n = A.current;
945
- if (A.current = null, C(null), D([]), !n) return;
946
- let r = T.current;
947
- w.current = null, T.current = null;
948
- let i = r?.toString().trim();
949
- if (r && i) {
950
- let e = a(r.startContainer, r.getBoundingClientRect()), o = r.commonAncestorContainer.nodeType === 1 ? r.commonAncestorContainer : r.commonAncestorContainer.parentElement ?? n.target;
951
- t({
952
- anchor: y({
953
- element: o,
954
- clientX: e.left,
955
- clientY: e.top,
956
- quote: i
957
- }),
958
- point: {
959
- x: e.left,
960
- y: e.bottom
961
- },
962
- region: {
963
- x: e.left,
964
- y: e.top,
965
- w: e.width,
966
- h: e.height
967
- }
968
- });
969
- return;
970
- }
971
- let o = Math.abs(e.clientX - n.x) > 8 || Math.abs(e.clientY - n.y) > 8;
972
- if (e.pointerType === "touch" && o) return;
973
- e.pointerType === "touch" && gt(e.clientX, e.clientY);
974
- let s = e.pointerType !== "touch" && Math.abs(e.clientX - n.x) > 8 && Math.abs(e.clientY - n.y) > 8, c = s ? _t(n.target, N(e.clientX, e.clientY) ?? n.target) : n.target;
975
- t({
976
- anchor: y({
977
- element: c,
978
- clientX: n.x,
979
- clientY: n.y,
980
- ...s ? {
981
- endX: e.clientX,
982
- endY: e.clientY
983
- } : {}
984
- }),
985
- point: {
986
- x: s ? Math.max(n.x, e.clientX) : e.clientX,
987
- y: s ? Math.max(n.y, e.clientY) : e.clientY
988
- },
989
- region: s ? {
990
- x: Math.min(n.x, e.clientX),
991
- y: Math.min(n.y, e.clientY),
992
- w: Math.abs(e.clientX - n.x),
993
- h: Math.abs(e.clientY - n.y)
994
- } : null
995
- });
996
- },
997
- onPointerCancel: () => {
998
- M(), A.current = null, C(null);
999
- },
1000
- onContextMenu: (t) => {
1001
- t.preventDefault(), j.current.timer || j.current.fired || m || e();
1002
- }
1003
- }),
1004
- h && !b && !E.length ? /* @__PURE__ */ x("div", {
1005
- class: "ck-outline",
1006
- style: q(h.left - 2, h.top - 2, h.width + 4, h.height + 4)
1007
- }) : null,
1008
- E.map((e) => /* @__PURE__ */ x("div", {
1009
- class: "ck-text-box",
1010
- style: q(e.left, e.top, e.width, e.height)
1011
- })),
1012
- b && !w.current ? /* @__PURE__ */ x("div", {
1013
- class: "ck-region",
1014
- style: q(Math.min(b.x, b.x2), Math.min(b.y, b.y2), Math.abs(b.x2 - b.x), Math.abs(b.y2 - b.y))
1015
- }) : null
1016
- ] });
1017
- }
1018
- function gt(e, t) {
1019
- Q();
1020
- let n = (n) => {
1021
- Math.abs(n.clientX - e) > 24 || Math.abs(n.clientY - t) > 24 || (n.preventDefault(), n.stopPropagation(), Q());
1022
- };
1023
- addEventListener("click", n, !0);
1024
- let r = setTimeout(Q, 700);
1025
- Q = () => {
1026
- removeEventListener("click", n, !0), clearTimeout(r), Q = () => void 0;
1027
- };
1028
- }
1029
- var Q = () => void 0;
1030
- function _t(e, t) {
1031
- if (e.contains(t)) return e;
1032
- for (let n = t; n; n = n.parentElement) if (n.contains(e)) return n;
1033
- return document.body;
1034
- }
1035
- // src/ui/nav.ts
1036
- function vt(e, t, n) {
1037
- let r = ye(e);
1038
- if (!r || !/^https?:$/.test(new URL(r).protocol) || yt(r)) return n(t);
1039
- location.assign(Ke(r, t));
1040
- }
1041
- function yt(e) {
1042
- try {
1043
- let t = new URL(e), r = new URL(n());
1044
- return t.origin === r.origin && t.pathname === r.pathname && t.search === r.search && (t.hash === r.hash || !t.hash.startsWith("#/"));
1045
- } catch {
1046
- return !1;
1047
- }
1048
- }
1049
- // src/ui/Pins.tsx
1050
- var bt = "M31.5 4.8C17.3 4.4 7 15.2 7 29c0 13 8.5 21.2 20.9 23 1.6.2 2.1 1.2 2.1 2.5v6.9c0 1.7 1.2 2.1 2.5.9 5.7-4.9 16-13.6 21.1-22.1 3.5-5.8 4.7-11.8 3.2-18.1C54.3 11.5 44.7 4.6 31.5 4.8Z", xt = 6;
1051
- function St({ client: e, activeId: t, onOpen: n, notify: r, onError: c }) {
1052
- let f = X(e.state, (e) => e.threads), p = X(e.state, (e) => !!e.session?.capabilities.triage && !e.config?.read_only), m = Te(f.length > 0), h = Z(!0, () => import("./placement-BF_HOUDD.js")), _ = S(() => h?.createPlacer(), [h]), [, v] = s(0), [y] = s(() => /* @__PURE__ */ new Map()), [b] = s(() => /* @__PURE__ */ new Map());
1053
- d(() => {
1054
- let e = new Set(f.map((e) => e.id));
1055
- _?.keep(e);
1056
- for (let t of [y, b]) for (let n of t.keys()) e.has(n) || t.delete(n);
1057
- }, [f, _]), d(() => {
1058
- let e = _?.wait();
1059
- if (e == null) return;
1060
- let t = setTimeout(() => v((e) => e + 1), e);
1061
- return () => clearTimeout(t);
1062
- });
1063
- let C = g(null), w = g(null), T = typeof matchMedia == "function" && matchMedia("(hover: hover)").matches, E = f.map((e) => ({
1064
- thread: e,
1065
- at: _ ? _(e.id, e.anchor, m.version) : null
1066
- })), D = (e) => {
1067
- let t = e?.getBoundingClientRect() ?? {
1068
- left: -scrollX,
1069
- top: -scrollY,
1070
- width: 100
1071
- };
1072
- return (e, n) => ({
1073
- x: (e - t.left) / (t.width / 100 || 1),
1074
- y: (n - t.top) / (t.width / 100 || 1)
1075
- });
1076
- }, O = D(C.current), k = D(w.current), A = E.flatMap(({ thread: e, at: t }) => {
1077
- let n = e.anchor.quote;
1078
- if (!t || e.anchor.type !== "text" || !n) return [];
1079
- let r = y.get(e.id);
1080
- r?.[0] !== m.version && y.set(e.id, r = [m.version, Dt(t.element, n)]);
1081
- let i = t.element.getBoundingClientRect(), o = a(t.element);
1082
- return [...r[1]?.getClientRects() ?? []].map((e) => new DOMRect(e.x + o.x - i.x, e.y + o.y - i.y, e.width, e.height)).filter((e) => e.width > 0 && e.height > 0 && t.inView(e.left + e.width / 2, e.top + e.height / 2)).slice(0, 50).map((n) => ({
1083
- id: e.id,
1084
- fixed: t.fixed,
1085
- x: n.left,
1086
- y: n.top,
1087
- w: n.width,
1088
- h: n.height
1089
- }));
1090
- }), j = g(A);
1091
- j.current = A, d(() => m.watch(E.flatMap(({ at: e }) => e?.element ? [e.element] : []))), d(() => {
1092
- if (!T) return;
1093
- let e = 0, t = null, n = (n) => {
1094
- e || (e = requestAnimationFrame(() => {
1095
- e = 0;
1096
- let r = n.clientX, i = n.clientY, a = j.current.find((e) => r >= e.x && r <= e.x + e.w && i >= e.y && i <= e.y + e.h)?.id ?? null;
1097
- a !== t && (t = a, z(a, a ? 250 : 120));
1098
- }));
1099
- };
1100
- return addEventListener("pointermove", n, { passive: !0 }), () => {
1101
- removeEventListener("pointermove", n), cancelAnimationFrame(e);
1102
- };
1103
- }, [A.length > 0]);
1104
- let [M, N] = s(null), [P, F] = s(null), I = g(null), L = g(!1), R = g(null), z = (e, t) => {
1105
- R.current && clearTimeout(R.current), R.current = setTimeout(() => N(e), t);
1106
- };
1107
- d(() => () => void (R.current && clearTimeout(R.current)), []);
1108
- let ee = (t, n, a) => {
1109
- let s = document.elementsFromPoint(n, a).find((e) => !i(e) && e !== document.documentElement);
1110
- s && Ct(e, t, o({
1111
- element: s,
1112
- clientX: n,
1113
- clientY: a
1114
- }), r, c);
1115
- }, te = (e) => {
1116
- e.style.translate = "", F(null);
1117
- }, B = {
1118
- page: [],
1119
- fixed: []
1120
- };
1121
- for (let e of A) {
1122
- let n = (e.fixed ? k : O)(e.x, e.y);
1123
- B[e.fixed ? "fixed" : "page"].push(/* @__PURE__ */ x("div", {
1124
- class: "ck-shade",
1125
- "data-active": e.id === t || e.id === M || void 0,
1126
- style: q(n.x, n.y, e.w, e.h),
1127
- "aria-hidden": "true"
1128
- }));
1129
- }
1130
- for (let { thread: e, at: r } of E) {
1131
- if (!r) continue;
1132
- let i = r.fixed ? k : O, a = P === e.id, { x: o, y: s } = r, c = !a && r.clipped, d = !1;
1133
- !c && !a && e.id !== t && (d = m.scrolling ? !!b.get(e.id) : wt(r.element, o, s), b.set(e.id, d));
1134
- let f = c || d, h = M === e.id && !P && e.id !== t && !f, g = i(o, s), _ = r.resolved.rect && e.id === t && !c ? i(r.resolved.rect.x - scrollX, r.resolved.rect.y - scrollY) : null;
1135
- B[r.fixed ? "fixed" : "page"].push(/* @__PURE__ */ x(l, { children: [
1136
- _ ? /* @__PURE__ */ x("div", {
1137
- class: "ck-pin-region",
1138
- style: q(_.x, _.y, r.resolved.rect.w, r.resolved.rect.h)
1139
- }) : null,
1140
- /* @__PURE__ */ x("button", {
1141
- class: "ck-pin",
1142
- style: q(g.x, g.y),
1143
- "data-status": e.status,
1144
- "data-state": r.resolved.state,
1145
- "data-dragging": a || void 0,
1146
- "data-covered": f || void 0,
1147
- "data-clipped": c || void 0,
1148
- tabIndex: f ? -1 : void 0,
1149
- "data-movable": p || void 0,
1150
- "aria-expanded": e.id === t,
1151
- "aria-label": `${e.reference} · ${u(`status_${e.status}`)}: ${e.first_message?.body.slice(0, 80) ?? ""}`,
1152
- "aria-roledescription": p ? u("pinMovable") : void 0,
1153
- onPointerEnter: () => T && z(e.id, 250),
1154
- onPointerLeave: () => T && z(null, 120),
1155
- onFocus: () => z(e.id, 0),
1156
- onBlur: () => z(null, 0),
1157
- onPointerDown: (t) => {
1158
- if (!p || t.button !== 0) return;
1159
- let n = t.currentTarget.parentElement?.getBoundingClientRect().width;
1160
- I.current = {
1161
- id: e.id,
1162
- x: t.clientX,
1163
- y: t.clientY,
1164
- moved: !1,
1165
- scale: (n ?? 100) / 100 || 1
1166
- }, t.currentTarget.setPointerCapture?.(t.pointerId);
1167
- },
1168
- onPointerMove: (t) => {
1169
- let n = I.current;
1170
- if (n && n.id === e.id) {
1171
- if (!n.moved) {
1172
- if (Math.hypot(t.clientX - n.x, t.clientY - n.y) < xt) return;
1173
- n.moved = !0, N(null), F(e.id);
1174
- }
1175
- t.currentTarget.style.translate = `${(t.clientX - n.x) / n.scale}px ${(t.clientY - n.y) / n.scale}px`;
1176
- }
1177
- },
1178
- onPointerUp: (t) => {
1179
- let n = I.current;
1180
- I.current = null, n?.moved && (L.current = !0, te(t.currentTarget), ee(e, t.clientX, t.clientY));
1181
- },
1182
- onPointerCancel: (e) => {
1183
- I.current = null, te(e.currentTarget);
1184
- },
1185
- onClick: () => {
1186
- if (L.current) return void (L.current = !1);
1187
- n(e);
1188
- },
1189
- onKeyDown: (e) => e.key === "Escape" && N(null),
1190
- children: [/* @__PURE__ */ x("svg", {
1191
- viewBox: "5 3 54 62",
1192
- "aria-hidden": "true",
1193
- children: /* @__PURE__ */ x("path", { d: bt })
1194
- }), /* @__PURE__ */ x("span", {
1195
- "data-long": e.number > 999 || void 0,
1196
- children: e.number > 9999 ? `${e.number / 1e3 | 0}k` : e.number
1197
- })]
1198
- }),
1199
- h ? /* @__PURE__ */ x(Et, {
1200
- thread: e,
1201
- x: o,
1202
- y: s,
1203
- to: i
1204
- }) : null
1205
- ] }, e.id));
1206
- }
1207
- return /* @__PURE__ */ x(l, { children: [/* @__PURE__ */ x("div", {
1208
- class: "ck-pins",
1209
- ref: C,
1210
- "data-commentkit-ui": !0,
1211
- children: B.page
1212
- }), /* @__PURE__ */ x("div", {
1213
- class: "ck-pins",
1214
- ref: w,
1215
- "data-fixed": !0,
1216
- "data-commentkit-ui": !0,
1217
- children: B.fixed
1218
- })] });
1219
- }
1220
- function Ct(e, t, n, r, i) {
1221
- let a = t.anchor, o = (n) => e.state.set((e) => ({ threads: e.threads.map((e) => e.id === t.id ? {
1222
- ...e,
1223
- anchor: n
1224
- } : e) }));
1225
- o(n), e.updateThread(t.id, { anchor: n }).then(() => {
1226
- r({
1227
- text: u("pinMoved", { ref: t.reference }),
1228
- tone: "success",
1229
- action: {
1230
- label: u("undo"),
1231
- run: () => void e.updateThread(t.id, { anchor: a }).catch(i)
1232
- }
1233
- });
1234
- }, (e) => {
1235
- o(a), i(e);
1236
- });
1237
- }
1238
- function wt(e, t, n) {
1239
- if (!e?.isConnected || t < 0 || n < 0 || t >= innerWidth || n >= innerHeight) return !1;
1240
- let r = document.elementsFromPoint(t, n).find((e) => !i(e)), a = Tt(e), o = r && Tt(r);
1241
- return !!o && o !== document.documentElement && o !== document.body && !a.contains(o) && !o.contains(a);
1242
- }
1243
- function Tt(e) {
1244
- for (let t; t = e.getRootNode().host ?? (e.ownerDocument !== document && e.ownerDocument.defaultView?.frameElement);) e = t;
1245
- return e;
1246
- }
1247
- function Et({ thread: e, x: t, y: n, to: r }) {
1248
- let i = n > 180, a = h() === "rtl" ? t - 18 - 260 : t + 18, o = r(Math.min(Math.max(8, a), innerWidth - 260 - 8), i ? n - 16 : n + 24);
1249
- return /* @__PURE__ */ x("div", {
1250
- class: "ck-peek",
1251
- style: {
1252
- ...q(o.x, o.y, 260),
1253
- translate: i ? "0 -100%" : void 0
1254
- },
1255
- "aria-hidden": "true",
1256
- children: [
1257
- /* @__PURE__ */ x("div", {
1258
- class: "ck-peek-top",
1259
- children: [
1260
- /* @__PURE__ */ x(be, { person: e.author }),
1261
- /* @__PURE__ */ x("bdi", {
1262
- class: "ck-msg-name",
1263
- children: e.author.name
1264
- }),
1265
- /* @__PURE__ */ x("span", {
1266
- class: "ck-time",
1267
- children: v(e.created_at)
1268
- })
1269
- ]
1270
- }),
1271
- e.anchor.quote ? /* @__PURE__ */ x("div", {
1272
- class: "ck-quote ck-peek-quote",
1273
- children: /* @__PURE__ */ x("bdi", { children: e.anchor.quote })
1274
- }) : null,
1275
- /* @__PURE__ */ x("div", {
1276
- class: "ck-peek-text",
1277
- dir: "auto",
1278
- children: e.first_message?.body
1279
- }),
1280
- /* @__PURE__ */ x("div", {
1281
- class: "ck-peek-foot",
1282
- children: [/* @__PURE__ */ x(Se, { status: e.status }), /* @__PURE__ */ x("span", {
1283
- class: "ck-muted",
1284
- children: c("messageCount", e.message_count)
1285
- })]
1286
- })
1287
- ]
1288
- });
1289
- }
1290
- function Dt(e, t) {
1291
- let n = t.replace(/\s+/g, " ").trim().toLowerCase();
1292
- if (!n) return null;
1293
- let r = [], i = "", a = e.ownerDocument, o = a.createTreeWalker(e, NodeFilter.SHOW_TEXT);
1294
- for (let e = o.nextNode(); e; e = o.nextNode()) {
1295
- for (let t = 0; t < e.data.length; t++) {
1296
- let n = /\s/.test(e.data[t]) ? " " : e.data[t].toLowerCase();
1297
- n === " " && i.endsWith(" ") || (i += n, r.push({
1298
- node: e,
1299
- offset: t
1300
- }));
1301
- }
1302
- if (i.length > 2e4) break;
1303
- }
1304
- let s = i.indexOf(n);
1305
- if (s < 0) return null;
1306
- let c = r[s], l = r[s + n.length - 1], u = a.createRange();
1307
- return u.setStart(c.node, c.offset), u.setEnd(l.node, l.offset + 1), u;
1308
- }
1309
- // src/ui/session.ts
1310
- function Ot(e, t, { view: n, open: r, go: i, openThread: a, notify: o, reportError: c }) {
1311
- let l = X(e.state, (e) => e.opening), f = g(null), p = g(null);
1312
- p.current = n.name === "thread" ? n.threadId : n.name === "panel" ? n.threadId ?? null : null;
1313
- let [m, h] = s(0);
1314
- return d(() => () => f.current?.stop(), []), d(() => {
1315
- let n = () => {
1316
- let e = Je();
1317
- e && (t ? r({
1318
- name: "thread",
1319
- threadId: e
1320
- }) : O("commentkit:pending-thread", e));
1321
- }, a = () => t && void e.loadPageThreads().catch(c);
1322
- At(e, c) || a(), n();
1323
- let o, s = !1;
1324
- if (t) {
1325
- e.inbox().catch(() => void 0);
1326
- let t = e.state.get().config, n = () => h((e) => e + 1);
1327
- import("./live-BExWHzQ7.js").then((r) => {
1328
- if (s) return;
1329
- o = r.catchUp(e, n);
1330
- let a = r.comeBack();
1331
- if (a.draft && (scrollTo({
1332
- top: a.scrollY,
1333
- behavior: "auto"
1334
- }), i({
1335
- name: "composing",
1336
- draft: a.draft
1337
- })), a.thread && i({
1338
- name: "thread",
1339
- threadId: a.thread
1340
- }), t?.features.realtime && t.realtime) return f.current ?? (f.current = r.liveUpdates(e, () => p.current, n)), e.connectRealtime((e) => f.current?.onPing(e));
1341
- }).catch(() => void 0);
1342
- }
1343
- let l = Xe((e) => (e && a(), n()), () => e.pageKey());
1344
- return () => {
1345
- s = !0, o?.(), l();
1346
- };
1347
- }, [
1348
- e,
1349
- t,
1350
- c
1351
- ]), d(() => {
1352
- let n = e.auth.pending();
1353
- !t && n && i({
1354
- name: "verify",
1355
- email: n.email,
1356
- draft: null
1357
- });
1358
- }, []), d(() => {
1359
- l && t && (e.state.set({ opening: null }), import("./live-BExWHzQ7.js").then((t) => t.openReference(e, l, a, vt, () => o({
1360
- text: u("threadNotFound"),
1361
- tone: "error"
1362
- }), c), c));
1363
- }, [l, t]), {
1364
- cardVersion: m,
1365
- openId: p.current
1366
- };
1367
- }
1368
- var kt = null;
1369
- function At(e, t) {
1370
- let n = e.state.get().session, r = !n?.capabilities.triage, i = n && `${n.person.type}:${n.person.id}:${r}`, a = !!i && i !== kt && !!e.options.branch && r !== e.state.get().allBranches;
1371
- return kt = i, a && e.setAllBranches(r).catch(t), a;
1372
- }
1373
- function jt(e, t, n, r) {
1374
- let i = async () => {
1375
- let n = null, i = e.on("error", ({ error: e }) => n = e), a = await e.signIn(t).finally(i);
1376
- return a === "signed_in" || (a === "redirecting" || r({
1377
- text: a === "popup_blocked" ? u("popupBlocked") : n ? Fe(n) : u("signInCancelled"),
1378
- tone: "error"
1379
- }), !1);
1380
- }, a = g(n);
1381
- return d(() => {
1382
- let t = a.current;
1383
- a.current = n, t && !n && import("./live-BExWHzQ7.js").then((n) => n.forgetPerson(e.options.project, t)).catch(() => void 0);
1384
- }, [n]), {
1385
- signIn: i,
1386
- signOut: () => void e.signOut()
1387
- };
1388
- }
1389
- var Mt = /* @__PURE__ */ new WeakSet();
1390
- function Nt() {
1391
- let e = g([]), [t, n] = s(e.current), r = p((t, r = !1) => {
1392
- n(e.current = e.current.filter((e) => e !== t)), !Mt.has(t) && (Mt.add(t), r || t.onExpire?.());
1393
- }, []);
1394
- d(() => {
1395
- let e = t.filter((e) => (e.tone === "error" || e.action) && !e.expires);
1396
- if (!e.length) return;
1397
- let n = (t) => {
1398
- t.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("ck-toast")) || e.forEach((e) => r(e));
1399
- };
1400
- return addEventListener("pointerdown", n, !0), () => removeEventListener("pointerdown", n, !0);
1401
- }, [t]), d(() => {
1402
- let t = () => e.current.forEach((e) => r(e));
1403
- return addEventListener("pagehide", t), () => {
1404
- removeEventListener("pagehide", t), t();
1405
- };
1406
- }, []);
1407
- let i = g(null), a = g([]);
1408
- return d(() => () => a.current.forEach(clearTimeout), []), {
1409
- toasts: t,
1410
- notify: p((t) => {
1411
- let o = (e, t) => a.current.push(setTimeout(e, t)), s = [...e.current, t], c = s.filter((e) => e === t || e.text !== t.text);
1412
- for (let e of s) e !== t && (e.text === t.text || c.indexOf(e) < c.length - 3) && r(e);
1413
- n(e.current = e.current.concat(t));
1414
- let l = () => i.current?.matches(":hover, :focus-within") ? o(l, 1e3) : r(t);
1415
- (t.expires || t.tone !== "error" && !t.action) && o(l, t.expires ?? 4e3);
1416
- }, []),
1417
- dismiss: r,
1418
- region: i
1419
- };
1420
- }
1421
- function Pt({ toasts: { toasts: e, dismiss: t, region: n }, children: r }) {
1422
- return /* @__PURE__ */ x("div", {
1423
- class: "ck-toast-region",
1424
- role: "status",
1425
- "aria-live": "polite",
1426
- ref: n,
1427
- "data-commentkit-ui": !0,
1428
- children: [r, e.map((e) => /* @__PURE__ */ x("div", {
1429
- class: "ck-toast",
1430
- "data-tone": e.tone,
1431
- children: [
1432
- e.tone ? /* @__PURE__ */ x("span", {
1433
- class: "ck-toast-icon",
1434
- "aria-hidden": "true",
1435
- children: /* @__PURE__ */ x(Y, {
1436
- name: e.tone === "error" ? "alert" : e.tone === "success" ? "check" : "info",
1437
- size: 15
1438
- })
1439
- }) : null,
1440
- /* @__PURE__ */ x("span", { children: e.text }),
1441
- e.action ? /* @__PURE__ */ x("button", {
1442
- onClick: () => (t(e, !0), e.action.run()),
1443
- children: e.action.label
1444
- }) : null,
1445
- e.tone === "error" || e.action ? /* @__PURE__ */ x("button", {
1446
- class: "ck-toast-close",
1447
- "aria-label": u("close"),
1448
- title: u("close"),
1449
- onClick: () => t(e),
1450
- children: /* @__PURE__ */ x(Y, {
1451
- name: "close",
1452
- size: 14
1453
- })
1454
- }) : null
1455
- ]
1456
- }, e.text))]
1457
- });
1458
- }
1459
- // src/ui/view.ts
1460
- var Ft = { name: "idle" };
1461
- function It(e, t) {
1462
- let n = e.name === "panel" && e.order || [];
1463
- switch (t.name) {
1464
- case "stop": return e.name === "commenting" ? Ft : e;
1465
- case "back": return e.name === "panel" ? {
1466
- name: "panel",
1467
- order: n
1468
- } : e;
1469
- case "step": {
1470
- if (e.name !== "panel" || !e.threadId) return e;
1471
- let r = n.indexOf(e.threadId);
1472
- return r < 0 ? e : {
1473
- ...e,
1474
- threadId: n[(r + t.by + n.length) % n.length]
1475
- };
1476
- }
1477
- case "edit": return e.name === "verify" ? e.draft ? {
1478
- name: "composing",
1479
- draft: e.draft
1480
- } : { name: "commenting" } : e;
1481
- default: return t;
1482
- }
1483
- }
1484
- function Lt() {
1485
- let [e, t] = m(It, Ft), n = g(null);
1486
- d(() => {
1487
- if (e.name === "idle") {
1488
- let e = n.current;
1489
- n.current = null, e?.isConnected && e.focus({ preventScroll: !0 });
1490
- }
1491
- }, [e.name]);
1492
- let [r, i] = s(!1), a = g(null), o = p((e) => {
1493
- if (!a.current) {
1494
- if (e === !0 || matchMedia("(prefers-reduced-motion: reduce)").matches) return t(Ft);
1495
- i(!0), a.current = setTimeout(() => {
1496
- a.current = null, i(!1), t(Ft);
1497
- }, 120);
1498
- }
1499
- }, []);
1500
- return d(() => () => void (a.current && clearTimeout(a.current)), []), {
1501
- view: e,
1502
- go: t,
1503
- open: (r) => {
1504
- if (e.name === "idle") {
1505
- let e = document.querySelector("[data-commentkit-host]")?.shadowRoot?.activeElement;
1506
- n.current = e instanceof HTMLElement ? e : null;
1507
- }
1508
- a.current && (clearTimeout(a.current), a.current = null, i(!1)), t(r);
1509
- },
1510
- close: o,
1511
- closing: r
1512
- };
1513
- }
1514
- // src/ui/Welcome.tsx
1515
- function Rt({ id: e, position: t, title: n, body: r, primary: i, secondary: a, onPrimary: o, onSecondary: s }) {
1516
- return /* @__PURE__ */ x("div", {
1517
- class: "ck-welcome",
1518
- "data-pos": t,
1519
- role: "region",
1520
- "aria-labelledby": e,
1521
- "data-commentkit-ui": !0,
1522
- children: [
1523
- /* @__PURE__ */ x("h2", {
1524
- id: e,
1525
- children: n
1526
- }),
1527
- /* @__PURE__ */ x("p", { children: r }),
1528
- /* @__PURE__ */ x("div", {
1529
- class: "ck-actions",
1530
- children: [/* @__PURE__ */ x("button", {
1531
- class: "ck-btn",
1532
- onClick: s,
1533
- children: a
1534
- }), /* @__PURE__ */ x("button", {
1535
- class: "ck-btn ck-primary",
1536
- onClick: o,
1537
- children: i
1538
- })]
1539
- })
1540
- ]
1541
- });
1542
- }
1543
- function zt({ position: e, project: t, onStart: n, onDismiss: r }) {
1544
- return /* @__PURE__ */ x(Rt, {
1545
- id: "ck-welcome-title",
1546
- position: e,
1547
- title: u("welcomeTitle", { project: t }),
1548
- body: u(matchMedia("(pointer: coarse)").matches ? "welcomeBodyTouch" : "welcomeBody"),
1549
- primary: u("comment"),
1550
- secondary: u("gotIt"),
1551
- onPrimary: n,
1552
- onSecondary: r
1553
- });
1554
- }
1555
- function Bt({ position: e, project: t, onContinue: n, onDismiss: r }) {
1556
- return /* @__PURE__ */ x(Rt, {
1557
- id: "ck-signin-link-title",
1558
- position: e,
1559
- title: u("signInLinkTitle", { project: t }),
1560
- body: u("signInLinkBody"),
1561
- primary: u("signIn"),
1562
- secondary: u("notNow"),
1563
- onPrimary: n,
1564
- onSecondary: r
1565
- });
1566
- }
1567
- // src/ui/App.tsx
1568
- var Vt = "commentkit:welcomed";
1569
- function Ht({ client: e, onHide: t = () => void 0 }) {
1570
- let n = X(e.state, ({ config: e }) => e?.enabled === !1 && (e.disabled_reason || "paused")[0]);
1571
- return n ? n == "v" ? null : /* @__PURE__ */ x("div", {
1572
- class: "ck-toast",
1573
- role: "status",
1574
- children: u(n == "n" ? "notLive" : "paused")
1575
- }) : /* @__PURE__ */ x(Ut, {
1576
- client: e,
1577
- onHide: t
1578
- });
1579
- }
1580
- function Ut({ client: e, onHide: n }) {
1581
- let i = X(e.state, (e) => e.config), a = X(e.state, (e) => e.session), o = a && `${a.person.type}:${a.person.id}`;
1582
- T(o);
1583
- let c = Nt(), { notify: f } = c, { view: m, go: h, open: g, close: _, closing: v } = Lt(), [y, b] = s(!1), [S, C] = s(!1), w = p((t) => {
1584
- let n = e.auth.pending();
1585
- if (t instanceof r && t.code === "verification_required" && n) return h({
1586
- name: "verify",
1587
- email: n.email,
1588
- draft: null
1589
- });
1590
- f({
1591
- text: Fe(t),
1592
- tone: "error"
1593
- });
1594
- }, [f]), { Settings: E, Shortcuts: D, Composer: k, GuestVerify: A, Panel: j, ThreadCard: M, anchors: N } = it(e, i, m, y, S, w), P = Z(e.auth.finishLink, () => t(() => import("./Guest-7hcN765o.js")).then((e) => e.GuestFinish), w), [F] = s(qe), [I, L] = s(() => !!F && !O(Vt)), [R, z] = s(() => e.auth.hasSignInLink()), [ee, te] = s(null), [, B] = s(0);
1595
- d(() => rt(() => B((e) => e + 1)), []), d(() => () => Q(), []);
1596
- let ne = tt(e), re = ne && a?.capabilities.triage && !Me() ? () => b(!0) : null, V = i?.read_only ?? !1, H = u(a && a.role !== "guest" ? "readOnly" : "readOnlyGuest"), U = !a && m.name === "idle" ? e.auth.pending() : null, W = () => {
1597
- if (V) return f({
1598
- text: H,
1599
- tone: "error"
1600
- });
1601
- L(!1), g({ name: "commenting" });
1602
- }, G = (e) => g({
1603
- name: "thread",
1604
- threadId: typeof e == "string" ? e : e.id
1605
- }), ie = () => m.name === "panel" ? _() : g({ name: "panel" }), ae = (t) => {
1606
- let n = e.state.get().threads.find((e) => e.id === t);
1607
- return n ? () => h({
1608
- name: "commenting",
1609
- move: n
1610
- }) : void 0;
1611
- }, { signIn: K, signOut: q } = jt(e, F, o, f), { cardVersion: oe, openId: se } = Ot(e, a, {
1612
- view: m,
1613
- open: g,
1614
- go: h,
1615
- openThread: G,
1616
- notify: f,
1617
- reportError: w
1618
- });
1619
- ut(() => ({
1620
- view: m,
1621
- help: y,
1622
- keys: ne,
1623
- signedIn: !!a,
1624
- threads: e.state.get().threads
1625
- }), (e) => e === "help" ? b(!0) : e === "closeHelp" ? b(!1) : e === "comment" ? W() : e === "back" ? m.name === "commenting" ? h({ name: "idle" }) : _(!0) : G(e)), dt(e, m, a, {
1626
- comment: W,
1627
- go: h,
1628
- togglePanel: ie,
1629
- signIn: () => void K()
1630
- });
1631
- let [J, ce] = ot(e, i);
1632
- return /* @__PURE__ */ x(l, { children: [
1633
- a ? /* @__PURE__ */ x(St, {
1634
- client: e,
1635
- activeId: se,
1636
- onOpen: G,
1637
- notify: f,
1638
- onError: w
1639
- }) : null,
1640
- m.name === "commenting" && N ? /* @__PURE__ */ x(ht, {
1641
- picker: N.picker,
1642
- quote: e.options.tools?.text !== !1 && !m.move,
1643
- move: !!m.move,
1644
- onCancel: () => h({ name: "idle" }),
1645
- onPick: (t) => {
1646
- let n = m.move;
1647
- if (!n) return h({
1648
- name: "composing",
1649
- draft: t
1650
- });
1651
- h({ name: "idle" }), Ct(e, n, t.anchor, f, w);
1652
- }
1653
- }) : null,
1654
- /* @__PURE__ */ x("div", {
1655
- class: "ck-layer",
1656
- "data-closing": v || void 0,
1657
- "data-pos": J,
1658
- children: [
1659
- m.name === "composing" && k ? /* @__PURE__ */ x(k, {
1660
- client: e,
1661
- draft: m.draft,
1662
- signedIn: !!a,
1663
- onSignIn: K,
1664
- onCancel: _,
1665
- share: F,
1666
- onError: w,
1667
- onSent: (e, t) => {
1668
- f({
1669
- text: t ? u(t === "screenshot" ? "sentWithoutScreenshot" : "sentWithoutFiles") : a?.role === "guest" || !a ? u("sentGuest") : u("sent"),
1670
- tone: t ? "info" : "success"
1671
- }), G(e);
1672
- },
1673
- onPending: (e) => {
1674
- te(m.draft), h({
1675
- name: "verify",
1676
- email: e,
1677
- draft: m.draft
1678
- });
1679
- }
1680
- }) : null,
1681
- m.name === "verify" && A ? /* @__PURE__ */ x(A, {
1682
- client: e,
1683
- email: m.email,
1684
- onDifferentEmail: () => h({ name: "edit" }),
1685
- onClose: _,
1686
- onDone: (t) => {
1687
- if (m.draft) {
1688
- let t = Le(e, m.draft.anchor);
1689
- O(t, null), O(t.replace(/[^:]*~/, ""), null);
1690
- }
1691
- f({
1692
- text: u("sentGuest"),
1693
- tone: "success"
1694
- }), t[0] ? G(t[0]) : h({ name: "idle" });
1695
- }
1696
- }) : null,
1697
- m.name === "thread" && M ? /* @__PURE__ */ x(M, {
1698
- client: e,
1699
- threadId: m.threadId,
1700
- version: oe,
1701
- onClose: _,
1702
- onError: w,
1703
- notify: f,
1704
- onMovePin: ae(m.threadId)
1705
- }) : null,
1706
- m.name === "panel" && j ? /* @__PURE__ */ x(j, {
1707
- client: e,
1708
- side: J.endsWith("left") ? "left" : "right",
1709
- dock: J.startsWith("top") ? "top" : "bottom",
1710
- onClose: _,
1711
- version: oe,
1712
- onError: w,
1713
- notify: f,
1714
- reveal: m.signOff,
1715
- onOpen: (e, t) => h({
1716
- name: "panel",
1717
- threadId: typeof e == "string" ? e : e.id,
1718
- order: t
1719
- }),
1720
- detail: m.threadId && M ? (() => {
1721
- let t = m.order ?? [], n = t.indexOf(m.threadId), r = (e) => t.length > 1 && n >= 0 ? () => h({
1722
- name: "step",
1723
- by: e
1724
- }) : void 0;
1725
- return /* @__PURE__ */ x(M, {
1726
- client: e,
1727
- threadId: m.threadId,
1728
- version: oe,
1729
- onClose: _,
1730
- onError: w,
1731
- notify: f,
1732
- onMovePin: ae(m.threadId),
1733
- embedded: {
1734
- onBack: () => h({ name: "back" }),
1735
- onPrev: r(-1),
1736
- onNext: r(1),
1737
- position: n < 0 ? null : {
1738
- n: n + 1,
1739
- total: t.length
1740
- },
1741
- onShow: (e) => {
1742
- h({ name: "idle" }), vt(e.page.url, e.id, G);
1743
- }
1744
- }
1745
- });
1746
- })() : null
1747
- }) : null
1748
- ]
1749
- }),
1750
- P ? /* @__PURE__ */ x(P, {
1751
- client: e,
1752
- position: J,
1753
- notify: f,
1754
- onOpen: G
1755
- }) : R && !a && !U && m.name === "idle" ? /* @__PURE__ */ x(Bt, {
1756
- position: J,
1757
- project: i?.project.name ?? "",
1758
- onContinue: () => {
1759
- z(!1), K().then(() => z(e.auth.hasSignInLink()));
1760
- },
1761
- onDismiss: () => z(!1)
1762
- }) : I && !a && !V && m.name === "idle" ? /* @__PURE__ */ x(zt, {
1763
- position: J,
1764
- project: i?.project.name ?? "",
1765
- onStart: W,
1766
- onDismiss: () => {
1767
- L(!1), O(Vt, "1");
1768
- }
1769
- }) : null,
1770
- /* @__PURE__ */ x(ft, {
1771
- client: e,
1772
- position: J,
1773
- onMove: ce,
1774
- commenting: m.name === "commenting",
1775
- panelOpen: m.name === "panel",
1776
- onComment: () => m.name === "commenting" ? h({ name: "idle" }) : W(),
1777
- onPanel: ie,
1778
- onSignIn: () => void K(),
1779
- onSignOut: q,
1780
- onShortcuts: re,
1781
- onApprove: a?.capabilities.comment && !V ? () => g({
1782
- name: "panel",
1783
- signOff: Date.now()
1784
- }) : null,
1785
- onSettings: () => C(!0),
1786
- onHide: n,
1787
- waiting: U?.email ?? null,
1788
- onCode: () => U && g({
1789
- name: "verify",
1790
- email: U.email,
1791
- draft: ee
1792
- }),
1793
- covered: m.name !== "idle" && m.name !== "commenting" || y || S
1794
- }),
1795
- y && D ? /* @__PURE__ */ x(D, { onClose: () => b(!1) }) : null,
1796
- S && E ? /* @__PURE__ */ x(E, {
1797
- client: e,
1798
- onClose: () => C(!1),
1799
- onShortcuts: re,
1800
- onHide: n,
1801
- onSignOut: q
1802
- }) : null,
1803
- /* @__PURE__ */ x(Pt, {
1804
- toasts: c,
1805
- children: V && m.name === "commenting" ? /* @__PURE__ */ x("div", {
1806
- class: "ck-toast",
1807
- children: H
1808
- }) : null
1809
- })
1810
- ] });
1811
- }
1812
- // src/ui/styles.css?inline
1813
- var Wt = ":host{all:initial;--ck-accent:#c2341b;--ck-accent-ink:#fff;--ck-mark:#ff5733;--ck-mark-ink:#121316;--ck-accent-soft:color-mix(in srgb, var(--ck-accent) 12%, var(--ck-bg));--ck-bg:#fff;--ck-bg-muted:#f7f7f8;--ck-bg-hover:#eeeef0;--ck-border:#e3e3e7;--ck-control:#84858f;--ck-ring:#65677a;--ck-hairline:#12131614;--ck-text:#121316;--ck-text-muted:#5e5f6e;--ck-danger:#c10007;--ck-success:#16794c;--ck-warning:#a15c00;--ck-open:#a6a09b;--ck-review:#8e51ff;--ck-progress:#2563eb;--ck-shadow-sm:0 0 0 1px #1313161a, 0 2px 2px -1px #0000000f, 0 4px 4px -2px #0000000a;--ck-shadow:0 0 0 1px var(--ck-hairline), 0 10px 32px #222a3526, 0 1px 1px #0000000d, 0 4px 6px #222a3514, 0 24px 68px #2f30371a;--ck-radius:12px;--ck-radius-sm:6px;--ck-radius-md:8px;--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:1000;--ck-fs-2xs:10px;--ck-fs-xs:11px;--ck-fs-sm:12px;--ck-fs-md:13px;--ck-fs:14px;--ck-fs-lg:16px;--ck-fs-xl:20px;--ck-radius-pill:999px;--ck-fast:.12s;--ck-dur:.2s;--ck-img-outline:#0000001a}@supports not (color:color-mix(in srgb, red, red)){:host{--ck-accent-soft:var(--ck-bg-muted)}}@media print{:host,.ck-root{display:none!important}}:host([data-theme=dark]){--ck-bg:#212126;--ck-bg-muted:#1a1a1e;--ck-bg-hover:#2a2a30;--ck-border:#36363c;--ck-control:#7c7d87;--ck-ring:#a1a2ae;--ck-hairline:#ffffff1a;--ck-text:#fff;--ck-text-muted:#9394a1;--ck-img-outline:#ffffff1a;--ck-danger:#ffa2a2;--ck-success:#4cc38a;--ck-warning:#e3a33f;--ck-shadow-sm:0 0 0 1px var(--ck-hairline), 0 2px 2px -1px #0000004d, 0 4px 4px -2px #0003;--ck-shadow:0 0 0 1px var(--ck-hairline), 0 8px 24px #0006, 0 24px 68px #0000004d}.ck-root{all:initial;font-family:var(--ck-font);font-size:var(--ck-fs);color:var(--ck-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.45;display:block}*,:before,:after{box-sizing:border-box}button,input,textarea,select{font:inherit;color:inherit}button{cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:manipulation}button,a{-webkit-tap-highlight-color:transparent}button:-webkit-any(:disabled,[aria-disabled=true]){opacity:.5;cursor:default}button:is(:disabled,[aria-disabled=true]){opacity:.5;cursor:default}::placeholder{color:var(--ck-text-muted);opacity:1}.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%{translate:0 100%}}.ck-bar-btn,.ck-btn,.ck-chip,.ck-ghost,.ck-input,.ck-grip,.ck-menu button,.ck-toast button,.ck-shade{transition:background-color var(--ck-fast), color var(--ck-fast), border-color var(--ck-fast), box-shadow var(--ck-fast), filter var(--ck-fast), opacity var(--ck-fast), scale var(--ck-fast) ease-out}.ck-bar-btn:active,.ck-btn:active,.ck-chip:active,.ck-ghost:active{scale:.96}.ck-launcher{z-index:var(--ck-z);align-items:center;gap:8px;display:flex;position:fixed}.ck-launcher[data-pos$=right],.ck-welcome[data-pos$=right]{right:20px}.ck-launcher[data-pos$=left],.ck-welcome[data-pos$=left]{left:20px}.ck-launcher[data-pos^=top]{top:20px}.ck-launcher[data-pos^=bottom]{bottom:calc(20px + env(safe-area-inset-bottom,0px))}.ck-launcher[data-pos$=center],.ck-welcome[data-pos$=center]{left:50%;translate:-50%}.ck-bar{background:var(--ck-bg);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);border-radius:var(--ck-radius-pill);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) var(--ck-ease);align-items:center;gap:2px;padding:4px;display:flex}.ck-bar-btn{border-radius:var(--ck-radius-pill);height:36px;font-size:var(--ck-fs-md);white-space:nowrap;background:0 0;border:0;align-items:center;gap:6px;padding:0 12px;font-weight:600;display:inline-flex}.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-expanded=true]{background:var(--ck-bg-hover)}.ck-icon-btn{width:36px;color:var(--ck-text-muted);justify-content:center;padding:0;position:relative}.ck-badge{border-radius:var(--ck-radius-pill);background:var(--ck-danger);min-width:16px;height:16px;color:var(--ck-bg);font-size:var(--ck-fs-2xs);box-shadow:0 0 0 2px var(--ck-bg);font-variant-numeric:tabular-nums;place-items:center;padding:0 4px;font-weight:700;line-height:1;display:grid;position:absolute;top:2px;right:2px}.ck-grip{border-radius:var(--ck-radius-pill);width:24px;height:32px;color:var(--ck-text-muted);cursor:grab;touch-action:none;opacity:.75;background:0 0;border:0;place-items:center;margin-inline-start:-4px;margin-inline-end:0;padding:0;display:grid}.ck-grip svg{fill:currentColor}.ck-launcher[data-dragging]{opacity:.92}.ck-launcher[data-dragging] .ck-grip{cursor:grabbing}.ck-mode-hint{z-index:var(--ck-z);padding:8px;border-radius:var(--ck-radius);background:var(--ck-text);background:color-mix(in srgb, var(--ck-text) 90%, transparent);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);width:max-content;max-width:calc(100% - 24px);color:var(--ck-bg);font-size:var(--ck-fs-md);box-shadow:var(--ck-shadow);flex-wrap:wrap;justify-content:center;align-items:center;gap:8px 12px;padding-inline-start:16px;font-weight:600;display:flex;position:fixed;top:16px;left:50%;translate:-50%}.ck-mode-hint .ck-chip{background:color-mix(in srgb, currentColor 8%, transparent);color:inherit;border-color:color-mix(in srgb, currentColor 60%, transparent)}.ck-mode-frame{z-index:calc(var(--ck-z) - 1);pointer-events:none;box-shadow:inset 0 0 0 1.5px color-mix(in srgb, var(--ck-accent) 75%, transparent), inset 0 0 14px 2px color-mix(in srgb, var(--ck-accent) 16%, transparent);position:fixed;top:0;bottom:0;left:0;right:0}.ck-catcher{z-index:calc(var(--ck-z) - 2);cursor:crosshair;touch-action:pan-x pan-y pinch-zoom;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;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);border-radius:var(--ck-radius-sm);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);position:fixed}.ck-region{z-index:calc(var(--ck-z) - 1);pointer-events:none;border-radius:var(--ck-radius-sm);position:fixed}.ck-region,.ck-pending-region{--ck-dash:linear-gradient(90deg, var(--ck-accent) 50%, transparent 0);--ck-dash-v:linear-gradient(0deg, var(--ck-accent) 50%, transparent 0);background:var(--ck-dash) 0 0 / 12px 2px repeat-x, var(--ck-dash) 0 100% / 12px 2px repeat-x, var(--ck-dash-v) 0 0 / 2px 12px repeat-y, var(--ck-dash-v) 100% 0 / 2px 12px repeat-y, color-mix(in srgb, var(--ck-accent) 8%, transparent);animation:.6s linear infinite ck-ants}@keyframes ck-ants{to{background-position:12px 0,-12px 100%,0 -12px,100% 12px,0 0}}.ck-text-box{z-index:var(--ck-z);pointer-events:none;background:color-mix(in srgb, var(--ck-accent) 30%, transparent);border-radius:2px;position:fixed}.ck-pins{width:100px;height:0;z-index:calc(var(--ck-z) - 3);position:absolute;top:0;left:0}.ck-pins[data-fixed]{position:fixed}.ck-pin{--ck-pin:var(--ck-mark);transform-origin:49% 97%;width:28px;height:32px;color:var(--ck-mark-ink);font-size:var(--ck-fs-xs);font-variant-numeric:tabular-nums;filter:drop-shadow(0 0 .6px #fff)drop-shadow(0 0 .6px #fff)drop-shadow(0 3px 6px #12131647);transition:scale var(--ck-fast) var(--ck-ease), filter var(--ck-fast);animation:ck-fade var(--ck-dur) ease-out;background:0 0;border:0;padding:0;font-weight:700;position:absolute;transform:translate(-49%,-97%)}.ck-pin svg{width:100%;height:100%;position:absolute;top:0;bottom:0;left:0;right:0;overflow:visible}.ck-pin path{fill:var(--ck-pin);stroke:#121316;stroke-width:2px;stroke-linejoin:round}.ck-pin>span{text-align:center;line-height:1;position:absolute;top:41%;left:0;right:0;translate:0 -50%}.ck-pin[data-status=in_review]{--ck-pin:color-mix(in srgb, var(--ck-review) 90%, #000);color:#fff}.ck-pin[data-status=in_progress]{--ck-pin:var(--ck-progress);color:#fff}.ck-pin[data-status=resolved]{--ck-pin:var(--ck-success);color:var(--ck-bg)}.ck-pin>span[data-long]{letter-spacing:-.08em;font-size:9px}.ck-pin[data-state=moved]{opacity:.85}.ck-pin[data-covered]{opacity:0;pointer-events:none;transition:opacity var(--ck-fast) ease-out}.ck-pin[data-clipped]{display:none}.ck-pin[aria-expanded=true]{filter:drop-shadow(0 0 .6px #fff) drop-shadow(0 0 .6px #fff) drop-shadow(0 0 5px color-mix(in srgb, var(--ck-pin) 60%, transparent)) drop-shadow(0 4px 8px #1213164d);scale:1.14}.ck-pin:focus-visible{border-radius:50%}.ck-pin-region{pointer-events:none;border:2px dashed var(--ck-accent);border-radius:var(--ck-radius-sm);position:absolute}.ck-pin[data-movable]{touch-action:none}.ck-pin[data-dragging]{cursor:grabbing;filter:drop-shadow(0 0 .6px #fff)drop-shadow(0 8px 14px #12131659);z-index:2;transition:none;scale:1.18}.ck-pin[aria-expanded=true]:before{content:\"\";width:28px;height:28px;box-shadow:0 0 0 2px var(--ck-pin);pointer-events:none;opacity:0;border-radius:50%;margin:-14px 0 0 -14px;animation:.9s ease-out 2 ck-ping;position:absolute;top:40%;left:50%}@keyframes ck-ping{0%{opacity:.8;scale:.6}to{opacity:0;scale:2.2}}.ck-peek{z-index:3;background:var(--ck-bg);border-radius:var(--ck-radius-md);box-shadow:var(--ck-shadow);pointer-events:none;animation:ck-fade var(--ck-fast) ease-out;font-size:var(--ck-fs-md);padding:12px;position:absolute}.ck-peek-top{align-items:center;gap:8px;display:flex}.ck-peek-top .ck-avatar{--ck-av:20px}.ck-peek-top .ck-time{color:var(--ck-text-muted);font-size:var(--ck-fs-sm);margin-inline-start:auto}.ck-peek-quote{-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:8px 0 0;display:-webkit-box;overflow:hidden}.ck-peek-text{-webkit-line-clamp:3;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin-top:4px;line-height:1.45;display:-webkit-box;overflow:hidden}.ck-peek-foot{font-size:var(--ck-fs-sm);align-items:center;gap:8px;margin-top:8px;display:flex}@keyframes ck-pin-drop{0%{opacity:0;translate:0 -8px;scale:.4}}.ck-shade{pointer-events:none;background:color-mix(in srgb, var(--ck-accent) 16%, transparent);box-shadow:inset 0 -2px 0 color-mix(in srgb, var(--ck-accent) 55%, transparent);border-radius:2px;position:absolute}.ck-shade[data-active]{background:color-mix(in srgb, var(--ck-accent) 28%, transparent)}.ck-card{z-index:calc(var(--ck-z) + 1);width:min(380px,100vw - 24px);max-height:min(560px,100vh - 24px);background:var(--ck-bg);border-radius:var(--ck-radius);max-height:min(560px,100dvh - 24px);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) 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:4px;min-height:48px;padding:8px;padding-inline-start:16px;display:flex}.ck-card-title,.ck-peek-top bdi{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-weight:600;overflow:hidden}.ck-card h2.ck-card-title{font-size:var(--ck-fs);margin:0}.ck-card-body{background:linear-gradient(var(--ck-bg) 40%, #0000) top/100% 24px no-repeat local, linear-gradient(#0000, var(--ck-bg) 60%) bottom/100% 24px no-repeat local, linear-gradient(var(--ck-border), #0000) top/100% 8px no-repeat, linear-gradient(#0000, var(--ck-border)) bottom/100% 8px no-repeat;flex:1;min-height:0;padding:12px 16px;overflow:auto}.ck-card>:not(.ck-card-body){flex-shrink:0}.ck-card-foot{border-top:1px solid var(--ck-hairline);background:var(--ck-bg-muted);background:color-mix(in srgb, var(--ck-bg-muted) 50%, var(--ck-bg));align-items:center;gap:8px;padding:8px 12px 12px;padding-inline-start:16px;display:flex}.ck-card-body>p.ck-muted{margin:0 0 8px;line-height:1.4}.ck-ghost{border-radius:var(--ck-radius-sm);color:var(--ck-text-muted);background:0 0;border:0;padding:6px 8px;font-weight:600}.ck-card-head .ck-ghost{flex:none;place-items:center;width:32px;height:32px;padding:0;display:inline-grid}.ck-ghost-sm{min-height:24px;font-size:var(--ck-fs-sm);padding:0 4px}.ck-ghost.ck-danger{color:var(--ck-danger)}.ck-btn{border-radius:var(--ck-radius-sm);background:var(--ck-bg);height:32px;box-shadow:var(--ck-shadow-sm);font-size:var(--ck-fs-md);white-space:nowrap;border:0;justify-content:center;align-items:center;gap:6px;padding:0 12px;font-weight:600;display:inline-flex}.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 2px 2px -1px #00000029}.ck-spacer{flex:1}.ck-actions{flex-wrap:wrap;gap:8px;margin-top:12px;display:flex}.ck-chip{border-radius:var(--ck-radius-pill);border:1px solid var(--ck-control);background:var(--ck-bg);height:28px;color:var(--ck-text-muted);font-size:var(--ck-fs-sm);cursor:pointer;white-space:nowrap;align-items:center;gap:4px;max-width:100%;padding:0 12px;font-weight:600;display:inline-flex;overflow:hidden}.ck-chip[aria-pressed=true],.ck-chip[aria-expanded=true]{background:var(--ck-accent-soft);color:var(--ck-accent-text);border-color:var(--ck-accent);border-color:color-mix(in srgb, var(--ck-accent) 45%, var(--ck-border))}.ck-chip .ck-count{margin-inline-start:2px}.ck-input{border-radius:var(--ck-radius-sm);border:1px solid var(--ck-control);background:var(--ck-bg);width:100%;height:32px;padding:0 11px}.ck-input[aria-invalid=true]{border-color:var(--ck-danger)}.ck-input::-webkit-search-cancel-button{-webkit-appearance:none;appearance:none}.ck-field{font-size:var(--ck-fs-md);color:var(--ck-text-muted);gap:4px;font-weight:500;display:grid}.ck-field .ck-input{color:var(--ck-text);font-weight:400;font-size:var(--ck-fs)}.ck-muted{color:var(--ck-text-muted);font-size:var(--ck-fs-sm)}.ck-note{border-radius:var(--ck-radius-md);background:var(--ck-bg-muted);font-size:var(--ck-fs-md);overflow-wrap:anywhere;margin:8px 0 0;padding:8px 12px;line-height:1.45}.ck-note[data-tone=warning]{background:var(--ck-bg-muted);background:color-mix(in srgb, var(--ck-warning) 12%, var(--ck-bg))}.ck-note[data-tone=error]{background:var(--ck-bg-muted);background:color-mix(in srgb, var(--ck-danger) 10%, var(--ck-bg));color:var(--ck-danger)}.ck-avatar{--ck-av:28px;width:var(--ck-av);height:var(--ck-av);background:var(--ck-accent-soft);color:var(--ck-accent-text);font-size:max(8px, calc(var(--ck-av) * .4));box-shadow:0 0 0 1px var(--ck-hairline);border-radius:50%;flex:none;place-items:center;font-weight:700;display:grid;overflow:hidden}.ck-avatar img{object-fit:cover;outline:1px solid var(--ck-img-outline);outline-offset:-1px;width:100%;height:100%}.ck-msg-name{color:var(--ck-text);font-weight:600;font-size:var(--ck-fs-md)}.ck-status{--ck-tone:var(--ck-open);font-size:var(--ck-fs-sm);border-radius:var(--ck-radius-pill);background:var(--ck-bg-muted);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;align-items:center;gap:6px;padding:2px 8px;font-weight:600;display:inline-flex}.ck-status:before{content:\"\";background:var(--ck-tone);border-radius:50%;width:8px;height:8px}.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-mention{color:var(--ck-accent-text);font-weight:600}.ck-pre{overscroll-behavior-x:contain;border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);box-shadow:0 0 0 1px var(--ck-hairline);white-space:pre;margin:6px 0;padding:8px 12px;overflow-x:auto}.ck-quote{border-radius:var(--ck-radius-sm);border-inline-start:3px solid color-mix(in srgb, var(--ck-accent) 70%, var(--ck-border));background:var(--ck-bg-muted);color:var(--ck-text-muted);font-size:var(--ck-fs-sm);overflow-wrap:anywhere;margin:0 0 8px;padding:4px 8px;line-height:1.45;display:block}.ck-emoji{vertical-align:-.2em;width:1.15em;height:1.15em;margin:0 .04em;display:inline-block}.ck-time{white-space:nowrap;font-variant-numeric:tabular-nums;flex:none;line-height:1.67}.ck-menu{z-index:2;background:var(--ck-bg);border-radius:var(--ck-radius-md);min-width:210px;max-width:min(320px,100vw - 24px);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) var(--ck-ease);padding:4px;position:absolute;top:48px}.ck-menu:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:8px}.ck-menu:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:8px}.ck-menu:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:8px}.ck-menu:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:8px}.ck-menu button{text-align:start;border-radius:var(--ck-radius-sm);width:100%;font-size:var(--ck-fs-md);background:0 0;border:0;align-items:center;gap:8px;padding:8px 12px;display:flex}.ck-menu .ck-danger{color:var(--ck-danger)}.ck-menu-head{border-bottom:1px solid var(--ck-hairline);font-size:var(--ck-fs-sm);color:var(--ck-text-muted);text-overflow:ellipsis;white-space:nowrap;margin-bottom:4px;padding:4px 12px 8px;overflow:hidden}.ck-menu-two{flex-direction:column;align-items:flex-start!important;gap:0!important}.ck-menu-two .ck-muted{font-size:var(--ck-fs-xs)}[dir=rtl] .ck-search .ck-ghost,[dir=rtl] .ck-badge{left:8px;right:auto}[dir=rtl] .ck-search .ck-ghost{left:4px}[dir=rtl] .ck-badge{left:2px}.ck-launcher .ck-menu{top:auto;bottom:52px;left:auto;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-launcher-note{background:var(--ck-bg);width:max-content;max-width:min(300px,100vw - 40px);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) 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[data-pos$=center] .ck-launcher-note,.ck-launcher[data-pos$=center] .ck-menu{left:50%;right:auto;translate:-50%}.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);transform-origin:100% 100%;animation:ck-grow var(--ck-dur) 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]{transform-origin:0 100%;left:12px}@media (min-width:521px) and (min-height:481px){.ck-panel[data-dock=bottom]{bottom:calc(76px + env(safe-area-inset-bottom,0px))}.ck-panel[data-dock=top]{top:76px}}.ck-panel[data-dock=top][data-side=right]{transform-origin:100% 0}.ck-panel[data-dock=top][data-side=left]{transform-origin:0 0}.ck-toast{z-index:calc(var(--ck-z) + 1);border-radius:var(--ck-radius-md);background:var(--ck-bg);max-width:min(360px,100vw - 24px);color:var(--ck-text);font-size:var(--ck-fs-md);box-shadow:var(--ck-shadow);animation:ck-pop var(--ck-dur) var(--ck-ease);align-items:center;gap:8px;padding:8px;padding-inline-start:12px;font-weight:500;line-height:1.4;display:flex;position:fixed;bottom:84px;left:50%;translate:-50%}.ck-toast>span{overflow-wrap:anywhere;min-width:0}.ck-toast-region{z-index:calc(var(--ck-z) + 1);left:50%;bottom:calc(84px + var(--ck-kb,0px) + env(safe-area-inset-bottom,0px));pointer-events:none;flex-direction:column;align-items:center;gap:8px;width:max-content;max-width:calc(100vw - 24px);display:flex;position:fixed;translate:-50%}.ck-toast-region .ck-toast{pointer-events:auto;position:relative;bottom:auto;left:auto;translate:none}.ck-layer:has(.ck-card,.ck-panel)~.ck-toast-region{flex-direction:column-reverse;top:12px;bottom:auto}.ck-toast-icon{width:20px;height:20px;color:var(--ck-text-muted);border-radius:50%;flex:none;place-items:center;display:grid}.ck-toast[data-tone=success] .ck-toast-icon{color:var(--ck-success)}.ck-toast[data-tone=error] .ck-toast-icon{color:var(--ck-danger)}.ck-toast button{border-radius:var(--ck-radius-sm);min-height:24px;color:var(--ck-accent-text);background:0 0;border:0;flex:none;padding:4px 8px;font-weight:600}.ck-toast .ck-toast-close{width:24px;color:var(--ck-text-muted);place-items:center;padding:0;display:grid}.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 var(--ck-dur) var(--ck-ease);padding:16px;position:fixed}.ck-welcome[data-pos^=top]{top:76px}.ck-welcome[data-pos^=bottom]{bottom:calc(76px + env(safe-area-inset-bottom,0px))}.ck-welcome h2{font-size:var(--ck-fs-lg);overflow-wrap:anywhere;margin:0 0 4px;font-weight:600}.ck-welcome p{color:var(--ck-text-muted);margin:0 0 16px;line-height:1.5}.ck-welcome .ck-actions{justify-content:flex-end;margin:0}.ck-card:has(.ck-markup,.ck-viewer){z-index:calc(var(--ck-z) + 3)}.ck-panel:has(.ck-viewer){z-index:calc(var(--ck-z) + 3)}.ck-root :focus{outline:none}.ck-root :focus-visible{outline:2px solid var(--ck-ring);outline-offset:2px}.ck-mode-hint :focus-visible{outline-color:currentColor}.ck-card-body,.ck-menu,.ck-markup{overscroll-behavior:contain}.ck-card,.ck-panel,.ck-menu,.ck-bar,.ck-toast,.ck-welcome,.ck-btn,.ck-launcher-note,.ck-peek,.ck-mode-hint{border:1px solid #0000}@media (prefers-reduced-motion:reduce){*,:before,:after{transition:none!important;animation:none!important}}.ck-note,.ck-empty,.ck-toast span,.ck-welcome p{text-wrap:pretty}.ck-empty strong,.ck-welcome h2{text-wrap:balance}@keyframes ck-grow{0%{opacity:0;scale:.94}}@keyframes ck-panel-out{to{opacity:0;scale:.94}}@keyframes ck-out{to{opacity:0;translate:0 6px;scale:.97}}@keyframes ck-sheet-out{to{translate:0 100%}}.ck-layer[data-closing] .ck-panel{animation:ck-panel-out var(--ck-fast) var(--ck-ease) forwards;pointer-events:none}.ck-layer[data-closing] .ck-card:not(.ck-card-embedded){animation:ck-out var(--ck-fast) var(--ck-ease) forwards;pointer-events:none}@media (max-width:520px){.ck-launcher[data-covered=true]{display:none}.ck-card{width:auto;max-height:70vh;max-height:min(70dvh, calc(100dvh - 24px - var(--ck-kb,0px)));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-panel{bottom:var(--ck-kb,0px);height:80vh;height:min(80dvh, calc(100dvh - 12px - var(--ck-kb,0px)));border-radius:var(--ck-radius) var(--ck-radius) 0 0;width:100%;padding-bottom:env(safe-area-inset-bottom,0px);animation-name:ck-sheet;top:auto;left:0!important;right:0!important}.ck-mode-hint{top:auto;bottom:calc(84px + env(safe-area-inset-bottom,0px))}.ck-mode-hint~.ck-toast-region{top:12px;bottom:auto}.ck-root:has(.ck-toast) .ck-launcher-note{display:none}.ck-layer[data-closing] .ck-panel,.ck-layer[data-closing] .ck-card:not(.ck-card-embedded){animation:ck-sheet-out var(--ck-fast) var(--ck-ease) forwards}}@media (pointer:coarse){.ck-bar-btn,.ck-btn,.ck-ghost,.ck-chip,.ck-menu button,.ck-toast button{min-width:44px;min-height:44px}.ck-search .ck-ghost{min-width:36px;min-height:36px}.ck-root .ck-input{font-size:var(--ck-fs-lg);min-height:44px}.ck-pin:after{content:\"\";position:absolute;top:-10px;bottom:-10px;left:-10px;right:-10px}.ck-grip{display:none}}@media (hover:hover){.ck-bar-btn:hover,.ck-ghost:hover,.ck-menu button:hover,.ck-toast button:hover{background:var(--ck-bg-hover)}.ck-bar-btn[aria-pressed=true]:hover,.ck-primary:hover,.ck-btn.ck-primary:hover{background:var(--ck-accent);filter:brightness(.96)}.ck-icon-btn:hover,.ck-ghost:hover,.ck-format .ck-ghost:hover,.ck-msg-actions .ck-ghost:hover,.ck-chip:hover{color:var(--ck-text)}.ck-mode-hint .ck-chip:hover{color:inherit;background:color-mix(in srgb, currentColor 16%, transparent)}.ck-pin:hover{scale:1.08}.ck-pin[data-movable]:hover{cursor:grab}.ck-btn:hover,.ck-chip:hover{background:var(--ck-bg-muted)}.ck-input:hover{border-color:var(--ck-text-muted)}.ck-grip:hover{opacity:1}}";
1814
- // src/ui/mount.tsx
1815
- function Gt(e, t = () => void 0, n = t) {
1816
- let r = document.createElement("div");
1817
- r.setAttribute("data-commentkit-host", ""), r.style.cssText = "display:block;position:absolute;top:0;left:0;width:0;height:0;z-index:2147483000;visibility:visible;".replace(/;/g, "!important;");
1818
- let i = r.attachShadow({ mode: "open" });
1819
- if ("adoptedStyleSheets" in Document.prototype && "replaceSync" in CSSStyleSheet.prototype) {
1820
- let e = new CSSStyleSheet();
1821
- e.replaceSync(Wt), i.adoptedStyleSheets = [e];
1822
- } else {
1823
- let e = document.createElement("style");
1824
- e.textContent = Wt, i.appendChild(e);
1825
- }
1826
- let a = document.createElement("div");
1827
- a.className = "ck-root", a.dir = h(), a.lang = _(), i.appendChild(a), Ve(i), le(e.assets);
1828
- let o = !1, s = () => o || r.isConnected || document.documentElement.appendChild(r), c = () => typeof requestIdleCallback == "function" ? requestIdleCallback(s, { timeout: 2e3 }) : setTimeout(s, 50);
1829
- "commentkitLoader" in document.documentElement.dataset && document.readyState !== "complete" ? addEventListener("load", c) : s();
1830
- let l = () => {
1831
- let t = e.state.get();
1832
- (t.request || t.opening) && s();
1833
- let n = e.state.get().theme ?? e.options.theme ?? e.state.get().config?.appearance.theme ?? "auto", i = n === "dark" || n === "auto" && matchMedia("(prefers-color-scheme: dark)").matches;
1834
- r.setAttribute("data-theme", i ? "dark" : "light");
1835
- let a = e.state.get().config?.appearance.accent, o = !!a && /^#[0-9a-f]{6}$/i.test(a), c = Kt(o ? a : "#c2341b");
1836
- if (o) {
1837
- let e = c;
1838
- for (; $(e) > .1833 && $(e) < .2047;) e = qt(e, [
1839
- 0,
1840
- 0,
1841
- 0
1842
- ], .98).map(Math.round);
1843
- let t = e === c ? a : `rgb(${e})`, n = $(e) > .194 ? "#121316" : "#ffffff";
1844
- r.style.setProperty("--ck-accent", t), r.style.setProperty("--ck-mark", t), r.style.setProperty("--ck-accent-ink", n), r.style.setProperty("--ck-mark-ink", n);
1845
- }
1846
- let l = $(qt(c, Kt(i ? "#212126" : "#ffffff"), .12)) + .05, u = Kt(i ? "#ffffff" : "#121316"), d = c;
1847
- for (let e = 1, t; e > 0 && (t = $(d = qt(c, u, e)) + .05) / l < 4.5 && l / t < 4.5; e -= .05);
1848
- r.style.setProperty("--ck-accent-text", `rgb(${d.map(Math.round)})`);
1849
- };
1850
- l();
1851
- let u = matchMedia("(prefers-color-scheme: dark)");
1852
- u.addEventListener?.("change", l);
1853
- let d = e.state.subscribe(l), f = window.visualViewport, p = () => f && r.style.setProperty("--ck-kb", K(f.scale > 1.01 ? 0 : Math.max(0, Math.round(innerHeight - f.height - f.offsetTop))));
1854
- return f?.addEventListener("resize", p), f?.addEventListener("scroll", p), w(/* @__PURE__ */ x(Yt, {
1855
- onCrash: t,
1856
- onError: (t) => e.reportCrash(t),
1857
- children: /* @__PURE__ */ x(Ht, {
1858
- client: e,
1859
- onHide: n
1860
- })
1861
- }), a), Object.assign(() => {
1862
- o = !0, removeEventListener("load", c), w(null, a), Ve(null), d(), u.removeEventListener?.("change", l), f?.removeEventListener("resize", p), f?.removeEventListener("scroll", p), r.remove();
1863
- }, { attach: s });
1864
- }
1865
- var Kt = (e) => e.slice(1).match(/../g).map((e) => parseInt(e, 16)), qt = (e, t, n) => e.map((e, r) => e * n + t[r] * (1 - n)), $ = (e) => {
1866
- let [t, n, r] = e.map((e) => (e /= 255) <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
1867
- return .2126 * t + .7152 * n + .0722 * r;
1868
- }, Jt = !1, Yt = class extends C {
1869
- constructor(...e) {
1870
- super(...e), this.state = { crashed: !1 };
1871
- }
1872
- componentDidCatch(e) {
1873
- if (!this.state.crashed) {
1874
- this.setState({ crashed: !0 });
1875
- try {
1876
- this.props.onError?.(e);
1877
- } catch {}
1878
- Jt || (Jt = !0, console.warn("[CommentKit] The widget stopped after an error and was removed. Your page is not affected.", e)), setTimeout(() => {
1879
- try {
1880
- this.props.onCrash();
1881
- } catch {}
1882
- });
1883
- }
1884
- }
1885
- render() {
1886
- return this.state.crashed ? null : this.props.children;
1887
- }
1888
- }, Xt = /* @__PURE__ */ e({
1889
- en: () => y,
1890
- installDiagnostics: () => ee,
1891
- mountWidget: () => Gt,
1892
- setLocale: () => b
1893
- });
1894
- export { we as A, H as B, Y as C, Se as D, oe as E, te as F, re as I, ne as L, ye as M, ae as N, q as O, I as P, U as R, se as S, pe as T, Ee as _, et as a, be as b, Re as c, Ne as d, y as en, Fe as f, Z as g, De as h, nt as i, ee as installDiagnostics, ie as j, Ce as k, Ie as l, je as m, Gt as mountWidget, tt as n, Ke as o, Ae as p, rt as r, He as s, b as setLocale, Xt as t, Le as u, Oe as v, me as w, de as x, X as y, G as z };