@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,108 +0,0 @@
1
- import { _ as e, f as t, l as n, m as r, s as i, u as a } from "./i18n-C4v0M-6z.js";
2
- import { f as o, n as s } from "./start-i9M-r3aH.js";
3
- // src/ui/Viewer.tsx
4
- s(".ck-viewer{z-index:calc(var(--ck-z) + 3);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);background:#0a0a0cd1;grid-template-rows:auto 1fr;place-items:center;padding:12px 56px 24px;animation:.16s ease-out ck-fade;display:grid;position:fixed;top:0;bottom:0;left:0;right:0}.ck-viewer-bar{color:#f2f1ec;justify-self:stretch;align-items:center;gap:4px;min-height:40px;display:flex}.ck-viewer-name{white-space:nowrap;text-overflow:ellipsis;flex:1;align-items:baseline;gap:10px;min-width:0;font-size:13px;font-weight:600;display:flex;overflow:hidden}.ck-viewer-count{color:#f2f1eca6;font-variant-numeric:tabular-nums;font-weight:500}.ck-viewer-btn,.ck-viewer-nav{color:#f2f1ec;background:#ffffff1a;border:0;border-radius:999px;place-items:center;width:36px;height:36px;padding:0;text-decoration:none;transition:background-color .12s,scale .15s ease-out;display:grid}.ck-viewer-btn:active,.ck-viewer-nav:active{scale:.96}.ck-viewer-img{object-fit:contain;border-radius:var(--ck-radius-md);outline:1px solid var(--ck-img-outline);outline-offset:-1px;max-width:100%;max-height:calc(100dvh - 96px);animation:ck-pop .18s var(--ck-ease);background:#fff;box-shadow:0 20px 60px #00000073}.ck-viewer-nav{width:40px;height:40px;position:absolute;top:50%;translate:0 -50%}.ck-viewer-nav[data-dir=prev]: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))){left:8px}.ck-viewer-nav[data-dir=prev]: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))){left:8px}.ck-viewer-nav[data-dir=prev]:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){right:8px}.ck-viewer-nav[data-dir=prev]:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){right:8px}.ck-viewer-nav[data-dir=next]:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:8px}.ck-viewer-nav[data-dir=next]:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:8px}.ck-viewer-nav[data-dir=next]:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:8px}.ck-viewer-nav[data-dir=next]:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:8px}.ck-viewer-nav[data-dir=prev] svg{scale:-1 1}.ck-root[dir=rtl] .ck-viewer-nav[data-dir=prev] svg{scale:1}.ck-root[dir=rtl] .ck-viewer-nav[data-dir=next] svg{scale:-1 1}.ck-viewer :focus-visible{outline-color:#fff}@media (hover:hover){.ck-viewer-btn:hover,.ck-viewer-nav:hover{background:#fff3}}@media (max-width:520px){.ck-viewer{padding:8px 8px 16px}.ck-viewer-nav{top:auto;bottom:16px;translate:none}}@media (pointer:coarse){.ck-viewer-btn,.ck-viewer-nav{width:44px;height:44px}}");
5
- var c = (e) => getComputedStyle(e).direction === "rtl";
6
- function l({ images: s, start: l = 0, onClose: u }) {
7
- let [d, f] = r(Math.min(Math.max(0, l), s.length - 1)), p = t(null), m = s[d], h = s.length > 1, g = (e) => f((t) => (t + e + s.length) % s.length);
8
- if (a(() => {
9
- let e = p.current?.getRootNode()?.activeElement ?? document.activeElement;
10
- return p.current?.focus({ preventScroll: !0 }), () => {
11
- e instanceof HTMLElement && e.isConnected && e.focus({ preventScroll: !0 });
12
- };
13
- }, []), !m) return null;
14
- let _ = m.href ?? m.src;
15
- return /* @__PURE__ */ n("div", {
16
- class: "ck-viewer",
17
- role: "dialog",
18
- "aria-modal": "true",
19
- "aria-label": i("imageViewer"),
20
- "data-commentkit-ui": !0,
21
- onClick: (e) => e.target === e.currentTarget && u(),
22
- onKeyDown: (e) => {
23
- if (e.stopPropagation(), e.key === "Escape") u();
24
- else if (h && (e.key === "ArrowRight" || e.key === "ArrowLeft")) g(e.key === "ArrowRight" === c(e.currentTarget) ? -1 : 1);
25
- else if (e.key === "Tab") {
26
- let t = [...e.currentTarget.querySelectorAll("button, a[href]")], n = t.indexOf(e.currentTarget.getRootNode().activeElement);
27
- e.preventDefault(), t[(n + (e.shiftKey ? -1 : 1) + t.length) % t.length]?.focus();
28
- }
29
- },
30
- children: [
31
- /* @__PURE__ */ n("div", {
32
- class: "ck-viewer-bar",
33
- children: [
34
- /* @__PURE__ */ n("span", {
35
- class: "ck-viewer-name",
36
- children: [/* @__PURE__ */ n("bdi", { children: m.name }), h ? /* @__PURE__ */ n("span", {
37
- class: "ck-viewer-count",
38
- children: i("countOf", {
39
- n: d + 1,
40
- total: s.length
41
- })
42
- }) : null]
43
- }),
44
- /* @__PURE__ */ n("a", {
45
- class: "ck-viewer-btn",
46
- href: _,
47
- target: "_blank",
48
- rel: "noopener noreferrer",
49
- download: m.name,
50
- "aria-label": i("download"),
51
- title: i("download"),
52
- children: /* @__PURE__ */ n(o, {
53
- name: "down",
54
- size: 16
55
- })
56
- }),
57
- /* @__PURE__ */ n("a", {
58
- class: "ck-viewer-btn",
59
- href: _,
60
- target: "_blank",
61
- rel: "noopener noreferrer",
62
- "aria-label": i("openInTab"),
63
- title: i("openInTab"),
64
- children: /* @__PURE__ */ n(o, {
65
- name: "link",
66
- size: 16
67
- })
68
- }),
69
- /* @__PURE__ */ n("button", {
70
- class: "ck-viewer-btn",
71
- ref: p,
72
- "aria-label": i("close"),
73
- onClick: u,
74
- children: /* @__PURE__ */ n(o, {
75
- name: "close",
76
- size: 16
77
- })
78
- })
79
- ]
80
- }),
81
- /* @__PURE__ */ n("img", {
82
- class: "ck-viewer-img",
83
- src: m.src,
84
- alt: m.name
85
- }),
86
- h ? /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ n("button", {
87
- class: "ck-viewer-nav",
88
- "data-dir": "prev",
89
- "aria-label": i("previousImage"),
90
- onClick: () => g(-1),
91
- children: /* @__PURE__ */ n(o, {
92
- name: "chevron",
93
- size: 18
94
- })
95
- }), /* @__PURE__ */ n("button", {
96
- class: "ck-viewer-nav",
97
- "data-dir": "next",
98
- "aria-label": i("nextImage"),
99
- onClick: () => g(1),
100
- children: /* @__PURE__ */ n(o, {
101
- name: "chevron",
102
- size: 18
103
- })
104
- })] }) : null
105
- ]
106
- });
107
- }
108
- export { l as Viewer };
@@ -1,124 +0,0 @@
1
- import { p as e } from "./client-EFTWxHbJ.js";
2
- import { _ as t, i as n, l as r, s as i } from "./i18n-C4v0M-6z.js";
3
- import { c as a, f as o } from "./start-i9M-r3aH.js";
4
- // src/core/contract-lists.ts
5
- var s = [
6
- "👍",
7
- "❤️",
8
- "🎉",
9
- "👀",
10
- "✅",
11
- "🙏",
12
- "👎",
13
- "😄",
14
- "😍",
15
- "🤔",
16
- "😮",
17
- "😢",
18
- "🔥",
19
- "🚀",
20
- "💯",
21
- "👏",
22
- "🙌",
23
- "💡",
24
- "⚠️",
25
- "❌",
26
- "⭐",
27
- "🎨",
28
- "🐛",
29
- "✨"
30
- ], c = {
31
- png: "image/png",
32
- jpg: "image/jpeg",
33
- jpeg: "image/jpeg",
34
- webp: "image/webp",
35
- gif: "image/gif",
36
- pdf: "application/pdf",
37
- txt: "text/plain",
38
- csv: "text/csv",
39
- mp4: "video/mp4",
40
- webm: "video/webm",
41
- docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
42
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
43
- pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
44
- }, l = c, u = new Set(Object.values(c)), d = [...u, ...Object.keys(c).map((e) => `.${e}`)].join(",");
45
- function f(e, t, r) {
46
- let a = [...e], o = null;
47
- for (let e of t) {
48
- let t = u.has(e.type) ? e.type : e.type ? void 0 : l[e.name.split(".").pop()?.toLowerCase() ?? ""];
49
- t ? e.size > r ? o = i("fileTooBig", {
50
- name: e.name || "file",
51
- size: p(r)
52
- }) : a.length >= 10 ? o = n("tooManyFiles", 10) : a.push(t === e.type ? e : new File([e], e.name, {
53
- type: t,
54
- lastModified: e.lastModified
55
- })) : o = i("fileNotAllowed", { name: e.name || "file" });
56
- }
57
- return {
58
- files: a,
59
- problem: o
60
- };
61
- }
62
- function p(e) {
63
- return `${Math.max(1, Math.round(e / 1048576))} MB`;
64
- }
65
- function m(e) {
66
- return {
67
- onPaste: (t) => {
68
- let n = [...t.clipboardData?.files ?? []];
69
- n.length && (t.preventDefault(), e(n));
70
- },
71
- onDragOver: (e) => {
72
- e.dataTransfer?.types.includes("Files") && (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
73
- },
74
- onDrop: (t) => {
75
- let n = [...t.dataTransfer?.files ?? []];
76
- n.length && (t.preventDefault(), e(n));
77
- }
78
- };
79
- }
80
- // src/ui/card-bits.tsx
81
- function h(t, n, r, a) {
82
- return t.updateThread(n.id, { status: n.status }).catch((t) => (t instanceof e && t.status === 403 ? r({
83
- text: i("undoTooLate", { ref: n.reference }),
84
- tone: "error"
85
- }) : a(t), null));
86
- }
87
- function g(t) {
88
- return t instanceof e && (t.code === "widget_disabled" || t.code === "plan_required" || t.status >= 400 && t.status < 500 && t.status !== 408 && t.status !== 429) ? a(t) : null;
89
- }
90
- function _({ input: e, onFiles: n }) {
91
- return /* @__PURE__ */ r(t, { children: [/* @__PURE__ */ r("input", {
92
- ref: e,
93
- type: "file",
94
- multiple: !0,
95
- hidden: !0,
96
- accept: d,
97
- onChange: (e) => {
98
- let t = e.target;
99
- n(Array.from(t.files ?? [])), t.value = "";
100
- }
101
- }), /* @__PURE__ */ r("button", {
102
- class: "ck-ghost",
103
- onClick: () => e.current?.click(),
104
- "aria-label": i("attach"),
105
- title: i("attach"),
106
- children: /* @__PURE__ */ r(o, { name: "paperclip" })
107
- })] });
108
- }
109
- function v(e, t = {
110
- top: e.y,
111
- bottom: e.y
112
- }) {
113
- let n = Math.min(380, innerWidth - 24), r = e.x + 16, i = r + n > innerWidth - 12 && e.x - 16 - n >= 12 ? e.x - 16 - n : Math.min(Math.max(12, r), innerWidth - n - 12), a = innerHeight - (t.bottom + 16) - 12, o = t.top - 16 - 12, s = (e) => `min(560px, ${Math.max(240, Math.round(e))}px)`;
114
- return a >= 360 || a >= o ? {
115
- left: `${i}px`,
116
- top: `${Math.min(t.bottom + 16, innerHeight - 252)}px`,
117
- maxHeight: s(a)
118
- } : {
119
- left: `${i}px`,
120
- bottom: `${Math.max(12, innerHeight - t.top + 16)}px`,
121
- maxHeight: s(o)
122
- };
123
- }
124
- export { f as a, h as i, g as n, m as o, v as r, s, _ as t };
@@ -1,40 +0,0 @@
1
- // src/ui/confetti.ts
2
- var e = [
3
- "#ff5733",
4
- "#ffcc00",
5
- "#34c759",
6
- "#007aff",
7
- "#af52de",
8
- "#ff2d92"
9
- ];
10
- function t(t) {
11
- if (!t || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
12
- let n = t.getRootNode(), r = n.host ? n.querySelector(".ck-root") : document.body;
13
- if (!r) return;
14
- let i = t.getBoundingClientRect(), a = document.createElement("canvas");
15
- a.className = "ck-confetti", a.setAttribute("aria-hidden", "true");
16
- let o = Math.min(2, devicePixelRatio || 1);
17
- a.width = innerWidth * o, a.height = innerHeight * o, r.appendChild(a);
18
- let s = a.getContext("2d");
19
- if (!s) return a.remove();
20
- s.scale(o, o);
21
- let c = i.left + i.width / 2, l = i.top + Math.min(i.height, 120), u = Array.from({ length: 40 }, (t, n) => {
22
- let r = -Math.PI / 2 + (Math.random() - .5) * 1.6, i = 5 + Math.random() * 5;
23
- return {
24
- x: c,
25
- y: l,
26
- vx: Math.cos(r) * i,
27
- vy: Math.sin(r) * i,
28
- size: 4 + Math.random() * 4,
29
- spin: Math.random() * 6,
30
- color: e[n % e.length]
31
- };
32
- }), d = performance.now(), f = (e) => {
33
- let t = e - d;
34
- s.clearRect(0, 0, innerWidth, innerHeight);
35
- for (let e of u) e.vy += .25, e.vx *= .99, e.x += e.vx, e.y += e.vy, s.save(), s.globalAlpha = Math.max(0, 1 - t / 900), s.translate(e.x, e.y), s.rotate(e.spin * t / 300), s.fillStyle = e.color, s.fillRect(-e.size / 2, -e.size / 4, e.size, e.size / 2), s.restore();
36
- t < 900 ? requestAnimationFrame(f) : a.remove();
37
- };
38
- requestAnimationFrame(f);
39
- }
40
- export { t as celebrate };
@@ -1,50 +0,0 @@
1
- // src/ui/drafts.ts
2
- var e = "commentkit:draft:v2:", t = !1;
3
- function n(e) {
4
- let t = 2166136261, n = 16777619;
5
- for (let r = 0; r < e.length; r++) {
6
- let i = e.charCodeAt(r);
7
- t = Math.imul(t ^ i, 16777619), n = Math.imul(n ^ i, 2166136261);
8
- }
9
- return (t >>> 0).toString(36) + (n >>> 0).toString(36);
10
- }
11
- function r(t, ...r) {
12
- return `${e}${t}:${n(r.map((e) => e ?? "").join(""))}`;
13
- }
14
- function i(e, t = Date.now()) {
15
- s(t);
16
- try {
17
- let n = JSON.parse(localStorage.getItem(e) ?? "null");
18
- if (n && typeof n.text == "string" && typeof n.at == "number" && t - n.at < 6048e5) return n.text;
19
- localStorage.removeItem(e);
20
- } catch {}
21
- return "";
22
- }
23
- function a(e, t, n = Date.now()) {
24
- try {
25
- t.trim() ? localStorage.setItem(e, JSON.stringify({
26
- text: t.slice(0, 1e4),
27
- at: n
28
- })) : localStorage.removeItem(e);
29
- } catch {}
30
- }
31
- function o(e) {
32
- a(e, "");
33
- }
34
- function s(n = Date.now(), r = !1) {
35
- if (!t || r) {
36
- t = !0;
37
- try {
38
- for (let t = localStorage.length - 1; t >= 0; t--) {
39
- let r = localStorage.key(t);
40
- if (!r?.startsWith(e)) continue;
41
- let i = 0;
42
- try {
43
- i = Number(JSON.parse(localStorage.getItem(r) ?? "null")?.at) || 0;
44
- } catch {}
45
- n - i >= 6048e5 && localStorage.removeItem(r);
46
- }
47
- } catch {}
48
- }
49
- }
50
- export { a as i, r as n, i as r, o as t };
@@ -1,53 +0,0 @@
1
- import { askExtension as e } from "./extension-BST6LH1q.js";
2
- import { t } from "./Composer-CAyj-c8e.js";
3
- // src/capture/extension.ts
4
- var n = 8e6, r = "[data-commentkit-host]", i = "#d4d4d8";
5
- function a(e = []) {
6
- let n = [t, ...e].join(","), i = [], a = (e) => {
7
- let o;
8
- try {
9
- o = e.querySelectorAll(n);
10
- } catch {
11
- o = e.querySelectorAll(t);
12
- }
13
- for (let t of o) {
14
- if (t.closest(r) || e instanceof ShadowRoot && e.host.closest(r)) continue;
15
- let n = t.getBoundingClientRect();
16
- n.width <= 0 || n.height <= 0 || n.right <= 0 || n.bottom <= 0 || n.left >= innerWidth || n.top >= innerHeight || i.push({
17
- x: n.left,
18
- y: n.top,
19
- w: n.width,
20
- h: n.height
21
- });
22
- }
23
- for (let t of e.querySelectorAll("*")) t.shadowRoot && !t.matches(r) && a(t.shadowRoot);
24
- };
25
- return a(document), i;
26
- }
27
- async function o(t = []) {
28
- let o = innerWidth, l = innerHeight, u = a(t), d = [...document.querySelectorAll(r)], f = d.map((e) => [e.style.getPropertyValue("visibility"), e.style.getPropertyPriority("visibility")]);
29
- d.forEach((e) => e.style.setProperty("visibility", "hidden", "important"));
30
- let p;
31
- try {
32
- await s(), await s(), p = (await e("capture"))?.dataUrl;
33
- } finally {
34
- d.forEach((e, t) => e.style.setProperty("visibility", f[t][0], f[t][1]));
35
- }
36
- if (typeof p != "string" || !p.startsWith("data:image/")) throw Error("The extension returned no screenshot.");
37
- let m = await c(p), h = m.width / Math.max(1, o), g = Math.min(h, 2, Math.sqrt(n / Math.max(1, o * l))), _ = document.createElement("canvas");
38
- _.width = Math.round(o * g), _.height = Math.round(l * g);
39
- let v = _.getContext("2d");
40
- if (!v) throw Error("Canvas is not available.");
41
- v.drawImage(m, 0, 0, _.width, _.height), v.fillStyle = i;
42
- for (let e of u) v.fillRect(e.x * g, e.y * g, e.w * g, e.h * g);
43
- return _;
44
- }
45
- function s() {
46
- return new Promise((e) => requestAnimationFrame(() => e()));
47
- }
48
- function c(e) {
49
- let [t, n = ""] = e.split(",", 2), r = atob(n), i = new Uint8Array(r.length);
50
- for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
51
- return createImageBitmap(new Blob([i], { type: t.slice(5).split(";")[0] }));
52
- }
53
- export { o as captureTab };
@@ -1,33 +0,0 @@
1
- import { i as e } from "./client-EFTWxHbJ.js";
2
- // src/ui/live.ts
3
- var t = 1500, n = 1e4;
4
- function r(e, r, a, o = Math.random) {
5
- let s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = (e) => c.set(e, Date.now()), u = [
6
- e.on("thread:created", ({ thread: e }) => l(e.id)),
7
- e.on("thread:updated", ({ thread: e }) => l(e.id)),
8
- e.on("message:created", ({ message: e }) => l(e.thread_id))
9
- ], d = (t) => e.state.get().threads.some((e) => e.id === t), f = () => e.state.get().session?.realtime_key ?? null, p = (e) => r() === e.thread_id || d(e.thread_id) ? !0 : e.page_path == null || e.page_path === i(), m = (t) => {
10
- s.delete(t), e.refreshThread(t), r() === t && !d(t) && a(t);
11
- };
12
- return {
13
- onPing(r) {
14
- let i = r?.thread_id;
15
- if (typeof i != "string" || !i) return;
16
- if (r.type === "thread.deleted") {
17
- clearTimeout(s.get(i)), s.delete(i), e.state.set((e) => ({ threads: e.threads.filter((e) => e.id !== i) }));
18
- return;
19
- }
20
- let a = r.by ?? r.actor ?? null, l = c.get(i);
21
- a && a === f() && l !== void 0 && Date.now() - l < n || !s.has(i) && p(r) && s.set(i, setTimeout(() => m(i), Math.floor(o() * t)));
22
- },
23
- stop() {
24
- for (let e of s.values()) clearTimeout(e);
25
- s.clear(), u.forEach((e) => e());
26
- }
27
- };
28
- }
29
- function i() {
30
- let t = new URL(e());
31
- return t.pathname + (t.hash.startsWith("#/") ? t.hash : "");
32
- }
33
- export { r as liveUpdates };
@@ -1,27 +0,0 @@
1
- // src/core/report.ts
2
- var e = 0, t = (e) => e.replace(/(https?:\/\/[^\s?#)]+)[?#][^\s)]*/g, "$1");
3
- function n(n, r, i, a, o = "crash", s) {
4
- if (e >= 3 || typeof fetch != "function") return;
5
- e++;
6
- let c = a instanceof Error ? a : Error(String(a));
7
- try {
8
- fetch(`${n}/api/v1/client-errors`, {
9
- method: "POST",
10
- keepalive: !0,
11
- credentials: "omit",
12
- headers: {
13
- "Content-Type": "application/json",
14
- "X-CommentKit-SDK": i
15
- },
16
- body: JSON.stringify({
17
- key: r,
18
- version: i,
19
- kind: o,
20
- message: t(`${c.name}: ${c.message}`).slice(0, 300),
21
- stack: t(c.stack ?? "").slice(0, 2e3),
22
- ...s ? { nonce: s } : {}
23
- })
24
- }).catch(() => void 0);
25
- } catch {}
26
- }
27
- export { n as reportCrash };
@@ -1,148 +0,0 @@
1
- import { c as e, o as t, p as n, t as r } from "./client-EFTWxHbJ.js";
2
- // src/activation.ts
3
- var i = "commentkit:active", a = "data-commentkit-extension";
4
- function o() {
5
- return document.documentElement.hasAttribute(a);
6
- }
7
- function s(e = location.origin) {
8
- let t = new URL(e).hostname;
9
- return t === "localhost" || t === "127.0.0.1" || t === "[::1]" || t.endsWith(".localhost") || t.endsWith(".test");
10
- }
11
- function c(e, t = !0) {
12
- if (!t || s() || o()) return !0;
13
- let n = new URLSearchParams(location.search);
14
- if (n.has("ck") || n.has("ck_thread") || n.has("ck_signin") || n.has("ck_code")) return !0;
15
- try {
16
- let t = `commentkit:v1:${e}`;
17
- return !!localStorage.getItem(t) || !!sessionStorage.getItem(t) || localStorage.getItem(i) === "1";
18
- } catch {
19
- return !1;
20
- }
21
- }
22
- function l(e) {
23
- try {
24
- e ? localStorage.setItem(i, "1") : localStorage.removeItem(i);
25
- } catch {}
26
- }
27
- function u(e) {
28
- let t = (t) => {
29
- (t.metaKey || t.ctrlKey) && t.shiftKey && t.key.toLowerCase() === "k" && (t.preventDefault(), t.stopImmediatePropagation(), e());
30
- };
31
- return addEventListener("keydown", t, !0), () => removeEventListener("keydown", t, !0);
32
- }
33
- // src/index.ts
34
- var d = null;
35
- function f() {
36
- let e = (e) => typeof e == "string" && e.trim() ? e.trim().slice(0, 255) : null;
37
- try {
38
- let t = typeof __COMMENTKIT_BUILD__ < "u" ? __COMMENTKIT_BUILD__ : globalThis.__COMMENTKIT_BUILD__;
39
- if (typeof t == "string" && (t = JSON.parse(t)), !t || typeof t != "object") return {
40
- branch: null,
41
- commit: null
42
- };
43
- let n = t;
44
- return {
45
- branch: e(n.branch),
46
- commit: e(n.commit)
47
- };
48
- } catch {
49
- return {
50
- branch: null,
51
- commit: null
52
- };
53
- }
54
- }
55
- function p(e) {
56
- if (d) return d;
57
- if (typeof window > "u") return g();
58
- try {
59
- return m(e);
60
- } catch (e) {
61
- return console.warn("[CommentKit] The widget could not start.", e), g();
62
- }
63
- }
64
- function m(i) {
65
- if (!i?.project || !t.test(i.project)) return console.warn("[CommentKit] init() needs your publishable project key (pk_live_… or pk_test_…). Find it in your CommentKit project under Setup."), g();
66
- let a = f(), s = {
67
- ...i,
68
- ...e(i.branch || a.branch, i.commit || a.commit)
69
- }, p = new r(s), m = null, _ = null, v = null, y = null, b = p.auth.takeSignInLink(), x = b || h(), S = () => {
70
- let e = Date.now(), t = () => {
71
- document.visibilityState === "hidden" || Date.now() - e < 15e3 || (e = Date.now(), p.loadConfig().then((e) => !e.enabled && !x && w(), () => void 0));
72
- }, n = setInterval(t, 6e4);
73
- return document.addEventListener("visibilitychange", t), () => {
74
- clearInterval(n), document.removeEventListener("visibilitychange", t);
75
- };
76
- }, C = () => m ? Promise.resolve() : (v ?? (v = (async () => {
77
- try {
78
- let e = await p.loadConfig();
79
- if (!e.enabled && !x) return;
80
- let t = import("./start-i9M-r3aH.js").then((e) => e.t), n = t.then((e) => e.setLocale(s.locale));
81
- t.catch(() => void 0), n.catch(() => void 0), await p.auth.completeRedirect().catch(() => !1), o() && await import("./extension-BST6LH1q.js").then((e) => e.extensionHandoff(p.auth)).catch(() => !1), await p.loadSession().catch(() => null);
82
- let { installDiagnostics: r, mountWidget: i } = await t;
83
- _ = r({
84
- console: e.features.console_capture,
85
- network: e.features.network_capture,
86
- endpoint: p.endpoint
87
- }), await n, m = i(p, w, () => {
88
- w(), l(!1);
89
- }), y = S(), p.emit("ready", { session: p.state.get().session });
90
- } catch (e) {
91
- let t = e instanceof n;
92
- console.warn(t ? `[CommentKit] The widget could not start: ${e.message} (${e.code}). See https://commentkit.dev/docs/errors#${e.code}` : "[CommentKit] The widget could not start.", e), t && p.emit("error", { error: e }), (!t || e.status >= 500) && p.reportCrash(e, "start");
93
- } finally {
94
- v = null;
95
- }
96
- })()), v), w = () => {
97
- y?.(), y = null, m?.(), m = null, _?.(), _ = null;
98
- }, T = u(() => {
99
- m ? p.state.set({ request: {
100
- kind: "inbox",
101
- at: Date.now()
102
- } }) : (l(!0), C());
103
- });
104
- return o() && import("./extension-BST6LH1q.js").then((e) => e.extensionHello()).catch(() => void 0), (b || c(s.project, s.hideOnProduction ?? !0)) && C(), d = {
105
- client: p,
106
- show: C,
107
- hide: w,
108
- open: (e) => (p.state.set({ opening: String(e).slice(0, 64) }), C()),
109
- comment: async (e = !0) => {
110
- e && l(!0), await C(), p.state.set({ request: {
111
- kind: e ? "comment" : "stop",
112
- at: Date.now()
113
- } });
114
- },
115
- signIn: async () => await p.signIn() === "signed_in",
116
- signOut: () => p.signOut(),
117
- session: () => p.state.get().session,
118
- on: (e, t) => p.on(e, t),
119
- destroy() {
120
- w(), T(), p.destroy(), d = null;
121
- }
122
- }, d;
123
- }
124
- function h() {
125
- let e = new URLSearchParams(location.search);
126
- if (e.has("ck") || e.has("ck_thread")) return !0;
127
- try {
128
- return !!sessionStorage.getItem("commentkit:share");
129
- } catch {
130
- return !1;
131
- }
132
- }
133
- function g() {
134
- let e = async () => void 0;
135
- return {
136
- client: void 0,
137
- show: e,
138
- hide: () => void 0,
139
- open: e,
140
- comment: e,
141
- signIn: async () => !1,
142
- signOut: e,
143
- session: () => null,
144
- on: () => () => void 0,
145
- destroy: () => void 0
146
- };
147
- }
148
- export { o as n, p as t };