@commentkit/comment-kit 1.6.0 → 2.0.0

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