@commentkit/comment-kit 1.0.0 → 1.5.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 (77) hide show
  1. package/CHANGELOG.md +133 -1
  2. package/README.md +12 -5
  3. package/SECURITY.md +3 -1
  4. package/dist/npm/THIRD_PARTY_NOTICES.txt +22 -23
  5. package/dist/npm/chunks/AgentSend-DyWxNQ0p.js +64 -0
  6. package/dist/npm/chunks/Checklist-VYkSl6Q9.js +259 -0
  7. package/dist/npm/chunks/Composer-CnsGQirF.js +679 -0
  8. package/dist/npm/chunks/Guest-DkIvY5zt.js +170 -0
  9. package/dist/npm/chunks/MarkupEditor-DxTI9nJH.js +334 -0
  10. package/dist/npm/chunks/Panel-riaMYxt-.js +863 -0
  11. package/dist/npm/chunks/Settings-CB4zxQAL.js +206 -0
  12. package/dist/npm/chunks/{Shortcuts-BSOKdMHt.js → Shortcuts-D1cbajg_.js} +21 -17
  13. package/dist/npm/chunks/StyleEditor-BtTv3I8_.js +44 -0
  14. package/dist/npm/chunks/StylePanel-BI-n5Me1.js +199 -0
  15. package/dist/npm/chunks/TaskFields-HwrD0FrH.js +272 -0
  16. package/dist/npm/chunks/ThreadCard-CjaC8BTa.js +1026 -0
  17. package/dist/npm/chunks/Viewer-BnWshSXb.js +110 -0
  18. package/dist/npm/chunks/agent-Cr6NB6We.js +146 -0
  19. package/dist/npm/chunks/anchor-OCQnjp_6.js +294 -0
  20. package/dist/npm/chunks/{ar-O7EPv0mI.js → ar-BQ9K9Oqf.js} +189 -8
  21. package/dist/npm/chunks/card-bits-CxteYiZ9.js +126 -0
  22. package/dist/npm/chunks/client-CJ1tpI62.js +754 -0
  23. package/dist/npm/chunks/colors-0Ied7PE2.js +101 -0
  24. package/dist/npm/chunks/confetti-DKeKR7-6.js +41 -0
  25. package/dist/npm/chunks/{de-PGyZVNHX.js → de-CcPi8xdC.js} +160 -8
  26. package/dist/npm/chunks/drafts-CpQdHhcK.js +51 -0
  27. package/dist/npm/chunks/{es-Bq1idl8M.js → es-DXgkjDCG.js} +160 -8
  28. package/dist/npm/chunks/extension-BIGfr4Gh.js +50 -0
  29. package/dist/npm/chunks/{extension-B7SelsS0.js → extension-DkDSW4qw.js} +2 -2
  30. package/dist/npm/chunks/{fr-BVB9GGco.js → fr-IjJaUbWh.js} +160 -8
  31. package/dist/npm/chunks/{hi-DyBvrjzQ.js → hi-BhKQK2MU.js} +160 -8
  32. package/dist/npm/chunks/html2canvas-pro.esm-lgs6tb4C.js +8378 -0
  33. package/dist/npm/chunks/i18n-DAJGndZ2.js +904 -0
  34. package/dist/npm/chunks/{it-BlMMMwZh.js → it-DKiSCkiD.js} +160 -8
  35. package/dist/npm/chunks/{ja-lAioBCJv.js → ja-BI1WagDg.js} +160 -8
  36. package/dist/npm/chunks/{live-YFyP1GnP.js → live-B-mo27Qq.js} +1 -1
  37. package/dist/npm/chunks/lock-C82sC17d.js +30 -0
  38. package/dist/npm/chunks/{nl-DR8mLHnn.js → nl-CJw3VUQ5.js} +160 -8
  39. package/dist/npm/chunks/pick-CYPkLLFJ.js +120 -0
  40. package/dist/npm/chunks/{pt-BR-D7j6aDPx.js → pt-BR-CjBolC5g.js} +160 -8
  41. package/dist/npm/chunks/{pusher-BSsQoE1K.js → realtime-D22tI_AS.js} +58 -4
  42. package/dist/npm/chunks/source-CTQmAh0Y.js +146 -0
  43. package/dist/npm/chunks/src-CgBEoWl0.js +150 -0
  44. package/dist/npm/chunks/start-DW9_DKmf.js +1783 -0
  45. package/dist/npm/chunks/upload-BmrpZE5G.js +42 -0
  46. package/dist/npm/chunks/uploads-CipONvCy.js +541 -0
  47. package/dist/npm/chunks/{zh-CN-tzYg9NPH.js → zh-CN-BrZGx2S0.js} +160 -8
  48. package/dist/npm/element.js +4 -5
  49. package/dist/npm/headless.js +3 -3
  50. package/dist/npm/index.js +2 -2
  51. package/dist/npm/react.js +1 -1
  52. package/dist/npm/svelte.js +1 -1
  53. package/dist/npm/types/adapters/vue.d.ts +14 -0
  54. package/dist/npm/types/anchor/index.d.ts +22 -1
  55. package/dist/npm/types/core/api.d.ts +3 -0
  56. package/dist/npm/types/core/auth.d.ts +11 -0
  57. package/dist/npm/types/core/client.d.ts +128 -6
  58. package/dist/npm/types/core/types.d.ts +78 -4
  59. package/dist/npm/types/headless.d.ts +1 -1
  60. package/dist/npm/types/index.d.ts +6 -1
  61. package/dist/npm/vue.js +5 -1
  62. package/package.json +7 -5
  63. package/dist/npm/chunks/Guest-VNoofLxw.js +0 -157
  64. package/dist/npm/chunks/MarkupEditor-DTXrS3DD.js +0 -199
  65. package/dist/npm/chunks/Panel-B88JYH52.js +0 -438
  66. package/dist/npm/chunks/ThreadCard-izybwXIC.js +0 -817
  67. package/dist/npm/chunks/anchor-DT-Ynhh1.js +0 -270
  68. package/dist/npm/chunks/art-DK1JwPIo.js +0 -155
  69. package/dist/npm/chunks/client-Iegfv6ZC.js +0 -620
  70. package/dist/npm/chunks/colors-CX-IPjvb.js +0 -86
  71. package/dist/npm/chunks/extension-DSA8S8Qz.js +0 -26
  72. package/dist/npm/chunks/format-B5tJGtPC.js +0 -524
  73. package/dist/npm/chunks/html2canvas-DfGb8yka.js +0 -4024
  74. package/dist/npm/chunks/mount-Dx_8NhX3.js +0 -1484
  75. package/dist/npm/chunks/privacy-DLhezjyi.js +0 -30
  76. package/dist/npm/chunks/realtime-CBRW9BB3.js +0 -34
  77. package/dist/npm/chunks/src-C1Qp94nr.js +0 -549
@@ -0,0 +1,1026 @@
1
+ import { p as e } from "./client-CJ1tpI62.js";
2
+ import { a as t } from "./anchor-OCQnjp_6.js";
3
+ import { a as n, d as r, f as i, i as a, l as o, m as s, p as c, r as l, s as u, u as d, v as f } from "./i18n-DAJGndZ2.js";
4
+ import { r as p } from "./agent-Cr6NB6We.js";
5
+ import { i as m, n as ee, o as te, r as h, s as g, t as ne } from "./card-bits-CxteYiZ9.js";
6
+ import { i as re, n as _, r as ie, t as ae } from "./drafts-CpQdHhcK.js";
7
+ import { a as v, c as y, i as b, l as oe, n as se, t as ce, u as le } from "./uploads-CipONvCy.js";
8
+ import { r as ue, t as de } from "./Checklist-VYkSl6Q9.js";
9
+ import { TaskFields as fe } from "./TaskFields-HwrD0FrH.js";
10
+ import { _ as pe, a as me, b as x, c as he, d as S, f as ge, g as _e, i as ve, l as ye, n as C, p as be, r as xe, u as Se, v as Ce, x as we, y as Te } from "./start-DW9_DKmf.js";
11
+ //#region src/ui/StyleChanges.tsx
12
+ function Ee({ thread: e, element: t, editable: n, client: a, onChange: l, onError: f = () => void 0 }) {
13
+ let p = c(() => v(e.style_changes), [e.style_changes]), [m, ee] = s(!1), [te, h] = s(!1), [g, ne] = s(null), re = i(null), _ = t instanceof HTMLElement || t instanceof SVGElement ? t : null;
14
+ return r(() => {
15
+ if (!m || !_) return;
16
+ let e = re.current = new b(_);
17
+ return e.apply(p), () => e.revert();
18
+ }, [
19
+ m,
20
+ _,
21
+ p
22
+ ]), d(() => {
23
+ ee(!1), h(!1);
24
+ }, [e.id]), te && _ && a && g ? /* @__PURE__ */ o(g, {
25
+ client: a,
26
+ thread: e,
27
+ element: _,
28
+ onSaved: (e) => l?.(e),
29
+ onClose: () => h(!1),
30
+ onError: f
31
+ }) : p.length ? /* @__PURE__ */ o("section", {
32
+ class: "ck-style-card",
33
+ "aria-label": u("styleSuggested"),
34
+ children: [/* @__PURE__ */ o("div", {
35
+ class: "ck-style-card-head",
36
+ children: [/* @__PURE__ */ o("span", { children: u("styleSuggested") }), _ ? /* @__PURE__ */ o("span", { children: [n && a ? /* @__PURE__ */ o("button", {
37
+ class: "ck-ghost ck-ghost-sm",
38
+ "aria-label": u("styleEdit"),
39
+ disabled: te,
40
+ onClick: () => {
41
+ re.current?.revert(), ee(!1), h(!0), g || import("./StyleEditor-BtTv3I8_.js").then((e) => ne(() => e.StyleEditor), f);
42
+ },
43
+ children: u("edit")
44
+ }) : null, /* @__PURE__ */ o("button", {
45
+ class: "ck-chip",
46
+ "aria-pressed": m,
47
+ onClick: () => ee(!m),
48
+ children: u("stylePreview")
49
+ })] }) : null]
50
+ }), /* @__PURE__ */ o("ul", { children: p.map((e) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o("code", { children: y(e) }) })) })]
51
+ }) : null;
52
+ }
53
+ //#endregion
54
+ //#region src/ui/ThreadCard.tsx
55
+ C(".ck-msg{gap:10px;padding:6px 0;display:flex}.ck-msg+.ck-msg{border-top:1px solid var(--ck-hairline);padding-top:10px}.ck-msg-main{flex:1;min-width:0}.ck-msg-meta{color:var(--ck-text-muted);align-items:baseline;gap:6px;font-size:12px;display:flex}.ck-msg-body{white-space:pre-wrap;overflow-wrap:anywhere;margin-top:2px;line-height:1.5}.ck-msg-body a{color:color-mix(in srgb, var(--ck-accent) 80%, var(--ck-text));text-underline-offset:2px}.ck-msg-body code{font-family:var(--ck-mono);background:var(--ck-bg-muted);box-shadow:0 0 0 1px var(--ck-hairline);border-radius:5px;padding:1px 5px;font-size:12px}.ck-reactions{flex-wrap:wrap;gap:4px;margin-top:6px;display:flex}.ck-reaction{border:1px solid var(--ck-border);background:var(--ck-bg);font-variant-numeric:tabular-nums;border-radius:999px;height:24px;padding:0 8px;font-size:12px;transition:background-color .12s,border-color .12s}.ck-reaction[aria-pressed=true]{border-color:color-mix(in srgb, var(--ck-accent) 60%, var(--ck-border));background:var(--ck-accent-soft)}.ck-review-ask{border-radius:var(--ck-radius-md);background:color-mix(in srgb, var(--ck-review) 14%, var(--ck-bg));box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--ck-review) 30%, transparent);margin-bottom:10px;padding:12px}.ck-build{overflow-wrap:anywhere}.ck-msg-skeleton{gap:10px;display:flex}.ck-msg-skeleton>div{flex:1}.ck-skeleton-avatar{border-radius:50%;flex:none;width:28px;height:28px;margin:0;display:block}@media (pointer:coarse){.ck-reaction{min-width:36px;min-height:36px}}@media (hover:hover){.ck-reaction:hover{background:var(--ck-bg-muted)}}.ck-msg-body,.ck-review-ask{text-wrap:pretty}.ck-quoting{border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);border-inline-start:3px solid var(--ck-accent);color:var(--ck-text-muted);align-items:center;gap:8px;margin-bottom:6px;padding:6px 6px 6px 10px;font-size:12.5px;display:flex}.ck-quoting>span{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.ck-quoting strong{color:var(--ck-text);font-weight:650}.ck-msg-meta{flex-wrap:wrap}.ck-msg-meta time{cursor:default}.ck-msg-actions{opacity:0;gap:2px;margin-inline-start:auto;transition:opacity .12s;display:inline-flex}.ck-msg:hover .ck-msg-actions,.ck-msg:focus-within .ck-msg-actions{opacity:1}.ck-msg-body s{color:var(--ck-text-muted)}.ck-quote-msg{border-top:0;border-bottom:0;text-align:start;text-overflow:ellipsis;white-space:nowrap;border-inline-end:0;width:100%;margin:4px 0 6px;overflow:hidden}.ck-quote-msg strong{color:var(--ck-text);font-weight:650}.ck-reaction-add{opacity:.55}.ck-no-replies{margin:8px 0 0;font-size:12.5px}.ck-jump{box-shadow:var(--ck-shadow-sm);animation:ck-pop .14s var(--ck-ease);z-index:1;position:absolute;top:-38px;left:50%;transform:translate(-50%)}.ck-details{margin:0 0 8px;font-size:12.5px}.ck-details-toggle{color:var(--ck-text-muted);background:0 0;border:0;border-radius:6px;align-items:center;gap:6px;padding:2px 0;font-size:12.5px;font-weight:600;display:inline-flex}.ck-details-toggle:after{content:\"\";border-inline-end:1.5px solid;width:5px;height:5px;transition:transform .15s var(--ck-ease);border-bottom:1.5px solid;transform:rotate(45deg)translateY(-2px)}.ck-details-toggle[aria-expanded=true]:after{transform:rotate(225deg)translate(-1px,-1px)}.ck-details dl{border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);gap:4px;margin:6px 0 0;padding:8px 10px;display:grid}.ck-details dl>div{grid-template-columns:72px 1fr;gap:8px;display:grid}.ck-details dt{color:var(--ck-text-muted)}.ck-details dd{overflow-wrap:anywhere;font-variant-numeric:tabular-nums;min-width:0;margin:0}.ck-details a{color:inherit;text-underline-offset:2px}@media (hover:hover){.ck-quote-msg:hover{color:var(--ck-text)}}@media (hover:none){.ck-msg-actions{opacity:1}}button.ck-shot{cursor:zoom-in;text-align:start;background:0 0;border:0;width:100%;padding:0;display:block}.ck-grid{border-radius:var(--ck-radius-md);grid-template-columns:repeat(2,1fr);gap:4px;margin-top:8px;display:grid;overflow:hidden}.ck-grid[data-count=\"3\"] .ck-grid-item:first-child{grid-row:span 2}.ck-grid-item{aspect-ratio:4/3;background:var(--ck-bg-muted);cursor:zoom-in;border:0;padding:0;position:relative;overflow:hidden}.ck-grid[data-count=\"3\"] .ck-grid-item:first-child{aspect-ratio:auto}.ck-grid-item img{object-fit:cover;outline:1px solid var(--ck-img-outline);outline-offset:-1px;width:100%;height:100%;transition:scale .2s var(--ck-ease);display:block}.ck-grid-more{color:#fff;font-variant-numeric:tabular-nums;background:#1213168c;place-items:center;font-size:18px;font-weight:700;display:grid;position:absolute;top:0;bottom:0;left:0;right:0}@media (hover:hover){.ck-grid-item:hover img,button.ck-shot:hover img{scale:1.02}}.ck-picker-wrap{display:inline-flex;position:relative}.ck-reaction-more{width:30px;color:var(--ck-text-muted);place-items:center;padding:0;display:inline-grid}.ck-picker{z-index:4;bottom:calc(100% + 6px);background:var(--ck-bg);box-shadow:var(--ck-shadow);animation:ck-pop .14s var(--ck-ease);border:1px solid #0000;border-radius:12px;grid-template-columns:repeat(8,32px);gap:2px;padding:6px;display:grid;position:absolute}.ck-picker: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:0}.ck-picker: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:0}.ck-picker:-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:0}.ck-picker: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:0}.ck-picker button{background:0 0;border:0;border-radius:8px;place-items:center;width:32px;height:32px;padding:0;font-size:18px;transition:background-color .12s,scale .15s ease-out;display:grid}.ck-picker button[aria-pressed=true]{background:var(--ck-accent-soft)}.ck-picker button:active{scale:.92}.ck-picker .ck-emoji{width:20px;height:20px}@media (hover:hover){.ck-picker button:hover{background:var(--ck-bg-hover)}.ck-reaction-more:hover{color:var(--ck-text)}}@media (max-width:520px){.ck-picker{grid-template-columns:repeat(6,36px)}.ck-picker button{width:36px;height:36px}}.ck-extra{gap:8px;margin:0 0 10px;display:grid}.ck-description{border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);margin:0 0 8px;padding:8px 10px;font-size:13px}.ck-description summary{cursor:pointer;color:var(--ck-text-muted);font-size:12.5px;font-weight:600}.ck-description p{white-space:pre-wrap;overflow-wrap:anywhere;max-height:240px;margin:6px 0 0;overflow:auto}.ck-extra-add{gap:8px;display:flex}.ck-extra-add .ck-ghost{padding:2px 6px}.ck-checklist{border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);padding:8px 10px}.ck-checklist-head{font-variant-numeric:tabular-nums;align-items:center;gap:10px;font-size:12px;display:flex}.ck-checklist-bar{background:var(--ck-border);border-radius:2px;flex:1;height:4px;overflow:hidden}.ck-checklist-bar>span{background:var(--ck-success);height:100%;transition:width .2s var(--ck-ease);display:block}.ck-checklist ul{gap:2px;margin:6px 0 0;padding:0;list-style:none;display:grid}.ck-checklist li{align-items:center;gap:4px;display:flex}.ck-checklist li .ck-check{flex:1;min-width:0;margin:0;font-size:13px}.ck-checklist li[data-done] bdi{color:var(--ck-text-muted);text-decoration:line-through}.ck-checklist li .ck-ghost{opacity:0;flex:none;place-items:center;width:24px;height:24px;min-height:0;padding:0;transition:opacity .12s;display:grid}.ck-checklist li:hover .ck-ghost,.ck-checklist li:focus-within .ck-ghost{opacity:1}@media (hover:none){.ck-checklist li .ck-ghost{opacity:1}}.ck-checklist-add .ck-input{height:30px;font-size:13px}.ck-previews{gap:6px;margin-top:6px;display:grid}.ck-preview{border-inline-start:3px solid var(--ck-border);border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);color:var(--ck-text);gap:1px;padding:8px 10px;font-size:12.5px;text-decoration:none;transition:background-color .12s;display:grid}.ck-preview strong{text-overflow:ellipsis;white-space:nowrap;font-weight:650;overflow:hidden}.ck-preview-site{color:var(--ck-text-muted);font-size:11.5px}.ck-preview-text{color:var(--ck-text-muted);-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}@media (hover:hover){.ck-preview:hover{background:var(--ck-bg-hover)}}.ck-card-embedded{width:auto;height:100%;max-height:none;box-shadow:none;animation:ck-slide-in .22s var(--ck-ease);border:0;border-radius:0;flex-direction:column;display:flex;position:static;top:auto;bottom:auto;left:auto;right:auto}.ck-card-embedded .ck-card-body{flex:1;min-height:0}.ck-back svg{scale:-1 1}.ck-root[dir=rtl] .ck-back svg{scale:1}.ck-step svg{rotate:-90deg}.ck-step[data-dir=next] svg{rotate:90deg}.ck-card-pos{font-variant-numeric:tabular-nums;white-space:nowrap;font-size:12px}@keyframes ck-slide-in{0%{opacity:0;translate:24px}}.ck-root[dir=rtl] .ck-card-embedded{animation-name:ck-slide-in-rtl}@keyframes ck-slide-in-rtl{0%{opacity:0;translate:-24px}}.ck-msg[data-reply] .ck-msg-body{background:var(--ck-bg-muted);border-radius:4px 12px 12px;max-width:100%;padding:6px 10px;display:inline-block}.ck-msg[data-reply][data-mine]{flex-direction:row-reverse}.ck-msg[data-reply][data-mine] .ck-msg-main{flex-direction:column;align-items:flex-end;display:flex}.ck-msg[data-reply][data-mine] .ck-msg-meta{flex-direction:row-reverse}.ck-msg[data-reply][data-mine] .ck-msg-actions{margin-inline-start:0;margin-inline-end:auto}.ck-msg[data-reply][data-mine] .ck-msg-body{background:var(--ck-accent-soft);border-radius:12px 4px 12px 12px}.ck-msg[data-reply][data-mine] .ck-reactions{justify-content:flex-end}.ck-msg+.ck-msg[data-reply]{border-top:0;padding-top:6px}.ck-msg[data-new]{animation:ck-reply-in .24s var(--ck-ease)}@keyframes ck-reply-in{0%{opacity:0;translate:0 8px}}.ck-mention-card{z-index:5;background:var(--ck-bg);box-shadow:var(--ck-shadow);pointer-events:none;animation:ck-pop .12s var(--ck-ease);border:1px solid #0000;border-radius:10px;align-items:center;gap:8px;padding:6px 10px 6px 6px;font-size:13px;display:flex;position:fixed}.ck-mention-card .ck-avatar{width:22px;height:22px;font-size:9px}.ck-thread-skeleton{gap:14px;display:grid}.ck-skeleton-meta{width:40%;height:10px}.ck-thread-skeleton .ck-msg-skeleton:nth-child(3){opacity:.7}.ck-thread-skeleton .ck-msg-skeleton:nth-child(4){opacity:.45}");
56
+ var De = g.slice(0, 6), Oe = /* @__PURE__ */ new Map();
57
+ function w({ client: r, threadId: v, version: y = 0, onClose: b, onError: C, notify: w, embedded: T }) {
58
+ let E = me(r.state, (e) => e.session), Ne = me(r.state, (e) => e.config?.read_only ?? !1), Pe = ve(), Fe = i(null), D = me(r.state, (e) => e.threads.find((e) => e.id === v) ?? null), [O, k] = s(D), [A, j] = s([]), [M, Ie] = s(null), Le = _(r.options.project, "reply", v), [N, Re] = s(() => ie(Le)), ze = (e) => {
59
+ e !== N && (I.current = null), Re(e), re(Le, e);
60
+ }, P = se(r, (t) => C(new e(0, "file_rejected", t))), [Be, Ve] = s(null), [He, Ue] = s(null), We = (e, t) => {
61
+ Ve({
62
+ images: e,
63
+ start: t
64
+ }), He || import("./Viewer-BnWshSXb.js").then((e) => Ue(() => e.Viewer), C);
65
+ }, Ge = i(null), [Ke, qe] = s([]), [F, Je] = s(!1), [Ye, Xe] = s(!1), I = i(null), [Ze, Qe] = s(!1), [L, R] = s(null), [z, $e] = s(null), [et, B] = s(!1), [tt, nt] = s(!1), [V, rt] = s(null);
66
+ d(() => {
67
+ if (!V) return;
68
+ let e = (e) => {
69
+ e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("ck-picker-wrap")) || rt(null);
70
+ };
71
+ return addEventListener("pointerdown", e, !0), () => removeEventListener("pointerdown", e, !0);
72
+ }, [V]);
73
+ let [H, it] = s([]), at = c(() => H.map((e) => e.name), [H]), [U, W] = s(null), ot = i(/* @__PURE__ */ new Set()), [st, ct] = s(!1), [lt, ut] = s(!0), G = i(null), dt = (e = !1) => G.current?.scrollTo({
74
+ top: G.current.scrollHeight,
75
+ behavior: e && !Ae() ? "smooth" : "auto"
76
+ });
77
+ d(() => {
78
+ et || dt();
79
+ }, [A.length]);
80
+ let ft = () => !et && dt();
81
+ d(() => {
82
+ E && le(r).then(it);
83
+ }, [E?.person.id]);
84
+ let K = i(v);
85
+ K.current = v;
86
+ let q = i(null), pt = (e) => {
87
+ q.current?.(), q.current = null;
88
+ let t = () => {
89
+ K.current === e && r.state.get().unread > 0 && r.markRead({ threadId: e }).catch(() => void 0);
90
+ };
91
+ if (r.inboxLoaded || r.state.get().unread > 0) return t();
92
+ let n = r.state.subscribe(() => {
93
+ r.inboxLoaded && (n(), q.current = null, t());
94
+ });
95
+ q.current = n;
96
+ };
97
+ d(() => () => q.current?.(), []);
98
+ let J = async (t = !1) => {
99
+ let n = v;
100
+ try {
101
+ let [e, i] = await Promise.all([r.getThread(n), r.allMessages(n, { refresh: t })]);
102
+ if (K.current !== n) return;
103
+ k(e), ot.current.size || i.forEach((e) => ot.current.add(e.id)), j(i), !Oe.has(n) && typeof e.watching == "boolean" && ut(e.watching), pt(n);
104
+ } catch (t) {
105
+ if (K.current !== n) return;
106
+ let r = t instanceof e && (t.status === 404 || t.status === 403);
107
+ if (D && !r) {
108
+ C(t);
109
+ return;
110
+ }
111
+ if (D) {
112
+ C(new e(404, "thread_not_found", u("threadNotFound"))), b();
113
+ return;
114
+ }
115
+ Ie({
116
+ gone: r,
117
+ text: r ? u("threadNotFound") : he(t)
118
+ });
119
+ }
120
+ };
121
+ d(() => {
122
+ k(D), j([]), Re(ie(Le)), P.clear(), $e(null), B(!1), W(null), ot.current = /* @__PURE__ */ new Set(), ct(!1), Xe(!1), I.current = null, ut(Oe.get(v) ?? D?.watching ?? !0), J();
123
+ }, [v]), d(() => {
124
+ D && O && D.updated_at !== O.updated_at && J(!0);
125
+ }, [D?.updated_at]);
126
+ let mt = i(y);
127
+ d(() => {
128
+ y !== mt.current && (mt.current = y, J(!0));
129
+ }, [y]);
130
+ let Y = c(() => O ? t(O.anchor) : null, [O]);
131
+ if (d(() => {
132
+ !T && Y?.element && Y.state !== "detached" && Y.element.scrollIntoView({
133
+ block: "center",
134
+ behavior: Ae() ? "auto" : "smooth"
135
+ });
136
+ }, [Y?.element]), d(() => {
137
+ O && Fe.current?.focus({ preventScroll: !0 });
138
+ }, [O?.id]), d(() => {
139
+ let e = (e) => {
140
+ if (T && (e.key === "j" || e.key === "k") && !e.metaKey && !e.ctrlKey && !e.altKey && r.options.shortcuts !== !1 && !e.composedPath().some((e) => e instanceof HTMLElement && (e.isContentEditable || [
141
+ "INPUT",
142
+ "TEXTAREA",
143
+ "SELECT"
144
+ ].includes(e.tagName)))) {
145
+ let t = e.key === "j" ? T.onNext : T.onPrev;
146
+ t && (e.preventDefault(), t());
147
+ } else e.key !== "e" && e.key !== "E" || e.metaKey || e.ctrlKey || e.altKey || !O || r.options.shortcuts === !1 || e.composedPath().some((e) => e instanceof HTMLElement && (e.isContentEditable || [
148
+ "INPUT",
149
+ "TEXTAREA",
150
+ "SELECT"
151
+ ].includes(e.tagName))) || E?.capabilities.comment && !Ne && O.status !== "resolved" && (e.preventDefault(), Q("resolved"));
152
+ };
153
+ return addEventListener("keydown", e), () => removeEventListener("keydown", e);
154
+ }), !O) return /* @__PURE__ */ o("div", {
155
+ class: T ? "ck-card ck-card-embedded" : "ck-card",
156
+ style: T ? void 0 : h({
157
+ x: innerWidth - 400,
158
+ y: 80
159
+ }),
160
+ role: T ? "region" : "dialog",
161
+ "aria-label": u("loadingThread"),
162
+ "aria-busy": !M,
163
+ "data-commentkit-ui": !0,
164
+ children: [/* @__PURE__ */ o("div", {
165
+ class: "ck-card-head",
166
+ children: [
167
+ T ? /* @__PURE__ */ o("button", {
168
+ class: "ck-ghost ck-back",
169
+ "aria-label": u("backToList"),
170
+ onClick: T.onBack,
171
+ children: /* @__PURE__ */ o(S, {
172
+ name: "chevron",
173
+ size: 16
174
+ })
175
+ }) : null,
176
+ /* @__PURE__ */ o("span", {
177
+ class: "ck-card-title",
178
+ children: M ? "" : u("loadingThread")
179
+ }),
180
+ /* @__PURE__ */ o("button", {
181
+ class: "ck-ghost",
182
+ "aria-label": u("close"),
183
+ onClick: T ? T.onBack : b,
184
+ children: /* @__PURE__ */ o(S, { name: "close" })
185
+ })
186
+ ]
187
+ }), M ? /* @__PURE__ */ o("div", {
188
+ class: "ck-card-body ck-empty",
189
+ role: "alert",
190
+ children: [
191
+ /* @__PURE__ */ o(ue, { name: M.gone ? "gone" : "error" }),
192
+ /* @__PURE__ */ o("span", { children: M.text }),
193
+ /* @__PURE__ */ o("button", {
194
+ class: "ck-btn",
195
+ onClick: M.gone ? b : () => {
196
+ Ie(null), J();
197
+ },
198
+ children: u(M.gone ? "close" : "retry")
199
+ })
200
+ ]
201
+ }) : /* @__PURE__ */ o("div", {
202
+ class: "ck-card-body ck-thread-skeleton",
203
+ children: [/* @__PURE__ */ o("div", { class: "ck-skeleton ck-skeleton-meta" }), [
204
+ 0,
205
+ 1,
206
+ 2
207
+ ].map(() => /* @__PURE__ */ o("div", {
208
+ class: "ck-msg-skeleton",
209
+ children: [/* @__PURE__ */ o("span", { class: "ck-skeleton ck-skeleton-avatar" }), /* @__PURE__ */ o("div", { children: [
210
+ /* @__PURE__ */ o("div", { class: "ck-skeleton" }),
211
+ /* @__PURE__ */ o("div", { class: "ck-skeleton" }),
212
+ /* @__PURE__ */ o("div", { class: "ck-skeleton" })
213
+ ] })]
214
+ }))]
215
+ })]
216
+ });
217
+ let X = E?.capabilities, Z = !!X?.comment && !Ne, ht = r.options.tools?.attachments !== !1, gt = E && O.author.id === E.person.id && O.author.type === (E.person.type === "guest" ? "guest" : "user"), _t = Y ? {
218
+ x: Y.point.x - scrollX,
219
+ y: Y.point.y - scrollY
220
+ } : {
221
+ x: innerWidth - 400,
222
+ y: 80
223
+ }, vt = h({
224
+ x: Math.min(Math.max(_t.x, 0), innerWidth),
225
+ y: Math.min(Math.max(_t.y, 0), innerHeight - 40)
226
+ }), yt = E?.role === "guest" ? u("feedbackRef", { ref: O.reference }) : O.reference, bt = (t) => {
227
+ if (!(t instanceof e && t.status === 412)) return C(t);
228
+ R(null), w({
229
+ text: u("editConflict"),
230
+ tone: "info"
231
+ }), J();
232
+ }, Q = async (e) => {
233
+ let t = O;
234
+ try {
235
+ k(await r.updateThread(O.id, { status: e })), e === "resolved" && import("./confetti-DKeKR7-6.js").then((e) => e.celebrate(G.current)).catch(() => void 0), e === "resolved" ? w({
236
+ text: u("resolvedToast", { ref: O.reference }),
237
+ tone: "success",
238
+ action: {
239
+ label: u("undo"),
240
+ run: () => void m(r, t, w, C).then((e) => e && K.current === e.id && k(e))
241
+ }
242
+ }) : e === "open" && (t.status === "resolved" || t.status === "closed") && w({
243
+ text: u("reopenedToast", { ref: O.reference }),
244
+ tone: "info"
245
+ });
246
+ } catch (e) {
247
+ bt(e);
248
+ }
249
+ }, xt = () => r.watch(O.id, !lt).then((e) => {
250
+ let t = e?.watching ?? !lt;
251
+ Oe.set(O.id, t), ut(t), w({ text: u(t ? "followed" : "muted", { ref: O.reference }) });
252
+ }, C), St = () => {
253
+ if (!L || F) return;
254
+ Je(!0);
255
+ let e = Ce(L.body, H.map((e) => e.name)), t = H.filter((t) => /^\d+$/.test(t.id ?? "") && e.has(t.name)).map((e) => Number(e.id));
256
+ r.editMessage(L.id, L.body, ...t.length ? [{ mentionIds: t }] : []).then((e) => {
257
+ j((t) => t.map((t) => t.id === e.id ? e : t)), R(null), w({
258
+ text: u("editedToast"),
259
+ tone: "success"
260
+ }), e.id === A[0]?.id && r.refreshThread(O.id);
261
+ }, bt).finally(() => Je(!1));
262
+ }, Ct = async () => {
263
+ if (N.trim() && !F) {
264
+ Je(!0), Xe(!1);
265
+ try {
266
+ let e = await P.ready(), t = e.ids;
267
+ e.missing && w({
268
+ text: u("sentWithoutFiles"),
269
+ tone: "info"
270
+ });
271
+ let n = await r.reply(O.id, N.trim(), {
272
+ replyTo: z?.id ?? null,
273
+ mentionIds: Ke,
274
+ attachmentIds: t,
275
+ idempotencyKey: I.current ?? (I.current = crypto.randomUUID())
276
+ });
277
+ I.current = null, j((e) => e.some((e) => e.id === n.id) ? e : [...e, n]), $e(null), B(!1), Re(""), P.clear(), ae(Le), (O.status === "resolved" || O.status === "closed") && k({
278
+ ...O,
279
+ status: "open"
280
+ });
281
+ } catch (e) {
282
+ Xe(ee(e) ?? !0);
283
+ } finally {
284
+ Je(!1);
285
+ }
286
+ }
287
+ }, wt = async (e, t) => {
288
+ let n = e.reactions?.find((e) => e.emoji === t)?.mine ?? !1, i = (e) => {
289
+ let r = (e.reactions ?? []).map((e) => e.emoji === t ? {
290
+ ...e,
291
+ count: e.count + (n ? -1 : 1),
292
+ mine: !n
293
+ } : e).filter((e) => e.count > 0);
294
+ return !n && !r.some((e) => e.emoji === t) && r.push({
295
+ emoji: t,
296
+ count: 1,
297
+ mine: !0
298
+ }), {
299
+ ...e,
300
+ reactions: r
301
+ };
302
+ };
303
+ j(A.map((t) => t.id === e.id ? i(t) : t));
304
+ try {
305
+ await r.react(e.id, t, !n);
306
+ } catch (e) {
307
+ C(e), J();
308
+ }
309
+ }, Tt = (e) => P.add(e), Et = (e) => {
310
+ let t = A.findIndex((t) => t.id === e.id);
311
+ j((t) => t.filter((t) => t.id !== e.id)), w({
312
+ text: u("replyDeleted"),
313
+ action: {
314
+ label: u("undo"),
315
+ run: () => K.current === O.id && j((n) => n.some((t) => t.id === e.id) ? n : [
316
+ ...n.slice(0, t),
317
+ e,
318
+ ...n.slice(t)
319
+ ])
320
+ },
321
+ expires: ke,
322
+ onExpire: () => void r.deleteMessage(e.id).then(() => r.refreshThread(O.id), (e) => {
323
+ C(e), K.current === O.id && J();
324
+ })
325
+ });
326
+ }, Dt = () => {
327
+ let e = r.state.get().threads;
328
+ r.state.set((e) => ({ threads: e.threads.filter((e) => e.id !== O.id) })), b(), w({
329
+ text: u("threadDeleted", { ref: O.reference }),
330
+ action: {
331
+ label: u("undo"),
332
+ run: () => r.state.set((t) => ({ threads: t.threads.some((e) => e.id === O.id) ? t.threads : e.filter((e) => e.id === O.id).concat(t.threads) }))
333
+ },
334
+ expires: ke,
335
+ onExpire: () => void r.deleteThread(O.id).catch((e) => {
336
+ C(e), r.refreshThread(O.id);
337
+ })
338
+ });
339
+ }, Ot = async (e, t) => {
340
+ try {
341
+ await navigator.clipboard.writeText(e), w({ text: t });
342
+ } catch {
343
+ C(Error(u("errorGeneric")));
344
+ }
345
+ }, kt = (() => {
346
+ let e = x(O.page.url);
347
+ if (!e) return "";
348
+ let t = new URL(e);
349
+ return t.searchParams.set("ck_thread", O.id), t.toString();
350
+ })(), At = x(O.capture?.screenshot?.thumbnail_url, "image"), jt = x(O.capture?.screenshot?.url), Mt = O.status === "resolved" || O.status === "closed", Nt = x(O.page.url), $ = O.capture?.device, Pt = O.capture?.viewport, Ft = [
351
+ [u("detailCreated"), /* @__PURE__ */ o("time", {
352
+ dateTime: O.created_at,
353
+ children: l(O.created_at)
354
+ })],
355
+ ...O.resolved_at && O.status === "resolved" ? [[u("detailResolved"), /* @__PURE__ */ o("time", {
356
+ dateTime: O.resolved_at,
357
+ children: l(O.resolved_at)
358
+ })]] : [],
359
+ ...Nt ? [[u("detailPage"), /* @__PURE__ */ o("a", {
360
+ href: Nt,
361
+ target: "_blank",
362
+ rel: "noopener noreferrer",
363
+ children: /* @__PURE__ */ o("bdi", { children: O.page.title || O.page.path })
364
+ })]] : [],
365
+ ...$?.browser || $?.os ? [[u("detailBrowser"), /* @__PURE__ */ o("bdi", { children: [$.browser && `${$.browser}${$.browser_version ? ` ${$.browser_version.split(".")[0]}` : ""}`, $.os && `${$.os}${$.os_version ? ` ${$.os_version}` : ""}`].filter(Boolean).join(" · ") })]] : [],
366
+ ...Pt?.width ? [[u("detailWindow"), /* @__PURE__ */ o("bdi", {
367
+ dir: "ltr",
368
+ children: `${Pt.width} × ${Pt.height}`
369
+ })]] : []
370
+ ];
371
+ return /* @__PURE__ */ o("div", {
372
+ class: T ? "ck-card ck-card-embedded" : "ck-card",
373
+ style: T ? void 0 : vt,
374
+ role: T ? "region" : "dialog",
375
+ "aria-label": yt,
376
+ "data-commentkit-ui": !0,
377
+ onKeyDown: T ? (e) => e.key === "Escape" && !e.defaultPrevented && (e.stopPropagation(), T.onBack()) : void 0,
378
+ children: [
379
+ /* @__PURE__ */ o("div", {
380
+ class: "ck-card-head",
381
+ style: { position: "relative" },
382
+ children: [
383
+ T ? /* @__PURE__ */ o("button", {
384
+ class: "ck-ghost ck-back",
385
+ "aria-label": u("backToList"),
386
+ title: u("backToList"),
387
+ onClick: T.onBack,
388
+ children: /* @__PURE__ */ o(S, {
389
+ name: "chevron",
390
+ size: 16
391
+ })
392
+ }) : null,
393
+ /* @__PURE__ */ o("span", {
394
+ class: "ck-card-title",
395
+ ref: Fe,
396
+ tabIndex: -1,
397
+ children: yt
398
+ }),
399
+ /* @__PURE__ */ o(be, { status: O.status }),
400
+ T?.position ? /* @__PURE__ */ o("span", {
401
+ class: "ck-muted ck-card-pos",
402
+ children: u("countOf", {
403
+ n: T.position.n,
404
+ total: T.position.total
405
+ })
406
+ }) : null,
407
+ T?.onPrev ? /* @__PURE__ */ o("button", {
408
+ class: "ck-ghost ck-step",
409
+ "aria-label": u("previousThread"),
410
+ title: `${u("previousThread")} (K)`,
411
+ "aria-keyshortcuts": "K",
412
+ onClick: T.onPrev,
413
+ children: /* @__PURE__ */ o(S, {
414
+ name: "chevron",
415
+ size: 15
416
+ })
417
+ }) : null,
418
+ T?.onNext ? /* @__PURE__ */ o("button", {
419
+ class: "ck-ghost ck-step",
420
+ "data-dir": "next",
421
+ "aria-label": u("nextThread"),
422
+ title: `${u("nextThread")} (J)`,
423
+ "aria-keyshortcuts": "J",
424
+ onClick: T.onNext,
425
+ children: /* @__PURE__ */ o(S, {
426
+ name: "chevron",
427
+ size: 15
428
+ })
429
+ }) : null,
430
+ /* @__PURE__ */ o("button", {
431
+ class: "ck-ghost",
432
+ "aria-label": u("more"),
433
+ "aria-haspopup": "menu",
434
+ "aria-expanded": Ze,
435
+ onClick: () => Qe(!Ze),
436
+ children: /* @__PURE__ */ o(S, { name: "more" })
437
+ }),
438
+ T ? null : /* @__PURE__ */ o("button", {
439
+ class: "ck-ghost",
440
+ "aria-label": u("close"),
441
+ onClick: b,
442
+ children: /* @__PURE__ */ o(S, { name: "close" })
443
+ }),
444
+ Ze ? /* @__PURE__ */ o("div", {
445
+ class: "ck-menu",
446
+ role: "menu",
447
+ onClick: () => Qe(!1),
448
+ onKeyDown: (e) => e.key === "Escape" ? (e.stopPropagation(), Qe(!1)) : xe(e, "[role=menuitem]", !0),
449
+ children: [
450
+ T ? /* @__PURE__ */ o("button", {
451
+ role: "menuitem",
452
+ onClick: () => T.onShow(O),
453
+ children: u("showOnPage")
454
+ }) : null,
455
+ kt ? /* @__PURE__ */ o("button", {
456
+ role: "menuitem",
457
+ onClick: () => void Ot(kt, u("copied")),
458
+ children: u("copyLink")
459
+ }) : null,
460
+ X?.export_for_agents ? /* @__PURE__ */ o("button", {
461
+ role: "menuitem",
462
+ onClick: () => void Ot(p(O, A), u("copiedForAgent")),
463
+ children: u("copyForAgent")
464
+ }) : null,
465
+ X?.set_any_status && Z ? /* @__PURE__ */ o(f, { children: [
466
+ /* @__PURE__ */ o("button", {
467
+ role: "menuitem",
468
+ onClick: () => void Q("in_progress"),
469
+ children: u("markInProgress")
470
+ }),
471
+ /* @__PURE__ */ o("button", {
472
+ role: "menuitem",
473
+ onClick: () => void Q("in_review"),
474
+ children: u("markInReview")
475
+ }),
476
+ /* @__PURE__ */ o("button", {
477
+ role: "menuitem",
478
+ onClick: () => void Q("closed"),
479
+ children: u("closeThread")
480
+ })
481
+ ] }) : null,
482
+ /* @__PURE__ */ o("button", {
483
+ role: "menuitem",
484
+ onClick: () => void xt(),
485
+ children: u(lt ? "mute" : "unmute")
486
+ }),
487
+ Z && (X?.manage || gt && O.message_count <= 1) ? /* @__PURE__ */ o("button", {
488
+ role: "menuitem",
489
+ class: "ck-danger",
490
+ onClick: Dt,
491
+ children: u("delete")
492
+ }) : null
493
+ ]
494
+ }) : null
495
+ ]
496
+ }),
497
+ /* @__PURE__ */ o(fe, {
498
+ client: r,
499
+ thread: O,
500
+ editable: !!X?.triage && Z,
501
+ onChange: (e) => K.current === e.id && k(e),
502
+ onError: bt
503
+ }),
504
+ /* @__PURE__ */ o("div", {
505
+ class: "ck-card-body",
506
+ ref: G,
507
+ onScroll: (e) => {
508
+ let t = e.currentTarget;
509
+ B(t.scrollHeight - t.scrollTop - t.clientHeight > 120), W(null);
510
+ },
511
+ onMouseOver: (e) => {
512
+ let t = e.target.closest?.(".ck-mention");
513
+ if (!t) return W(null);
514
+ let n = t.textContent?.replace(/^@/, "") ?? "", r = H.find((e) => e.name === n) ?? H.find((e) => n.startsWith(e.name));
515
+ if (!r) return;
516
+ let i = t.getBoundingClientRect();
517
+ W({
518
+ person: r,
519
+ x: i.left,
520
+ y: i.bottom + 6
521
+ });
522
+ },
523
+ onMouseLeave: () => W(null),
524
+ children: [
525
+ Y?.state === "detached" ? /* @__PURE__ */ o("div", {
526
+ class: "ck-note",
527
+ "data-tone": "warning",
528
+ children: u("detached")
529
+ }) : null,
530
+ Y?.state === "moved" ? /* @__PURE__ */ o("p", {
531
+ class: "ck-muted",
532
+ children: u("moved")
533
+ }) : null,
534
+ Te(O) ? /* @__PURE__ */ o("p", {
535
+ class: "ck-muted",
536
+ title: `${O.breakpoint}px`,
537
+ children: u(`screen_${we(O.breakpoint)}`)
538
+ }) : null,
539
+ O.page.branch && r.options.branch ? /* @__PURE__ */ o("p", {
540
+ class: "ck-muted ck-build",
541
+ children: u("leftOnBranch", {
542
+ branch: O.page.branch,
543
+ commit: O.page.commit_sha ? ` @ ${O.page.commit_sha.slice(0, 7)}` : ""
544
+ })
545
+ }) : null,
546
+ O.anchor.quote ? /* @__PURE__ */ o("blockquote", {
547
+ class: "ck-quote",
548
+ "aria-label": u("quotedText"),
549
+ children: /* @__PURE__ */ o("bdi", { children: O.anchor.quote })
550
+ }) : null,
551
+ O.description?.trim() ? /* @__PURE__ */ o("details", {
552
+ class: "ck-description",
553
+ open: O.description.length <= 280,
554
+ children: [/* @__PURE__ */ o("summary", { children: u("description") }), /* @__PURE__ */ o("p", { children: /* @__PURE__ */ o("bdi", { children: O.description }) })]
555
+ }) : null,
556
+ /* @__PURE__ */ o(de, {
557
+ client: r,
558
+ thread: O,
559
+ editable: Z && (!!X?.triage || !!gt),
560
+ onChange: (e) => K.current === e.id && k(e),
561
+ onError: C
562
+ }),
563
+ O.style_changes?.length ? /* @__PURE__ */ o(Ee, {
564
+ thread: O,
565
+ element: Y?.state === "detached" ? null : Y?.element ?? null,
566
+ editable: Z && (!!X?.triage || !!gt),
567
+ client: r,
568
+ onChange: (e) => K.current === e.id && k(e),
569
+ onError: bt
570
+ }) : null,
571
+ /* @__PURE__ */ o("div", {
572
+ class: "ck-details",
573
+ children: [/* @__PURE__ */ o("button", {
574
+ class: "ck-details-toggle",
575
+ "aria-expanded": tt,
576
+ "aria-controls": "ck-details",
577
+ onClick: () => nt(!tt),
578
+ children: u("details")
579
+ }), tt ? /* @__PURE__ */ o("dl", {
580
+ id: "ck-details",
581
+ children: Ft.map(([e, t]) => /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ o("dt", { children: e }), /* @__PURE__ */ o("dd", { children: t })] }))
582
+ }) : null]
583
+ }),
584
+ O.status === "in_review" && !X?.set_any_status && Z ? /* @__PURE__ */ o("div", {
585
+ class: "ck-review-ask",
586
+ children: [/* @__PURE__ */ o("div", { children: u("reviewAsk") }), /* @__PURE__ */ o("div", {
587
+ class: "ck-actions",
588
+ children: [/* @__PURE__ */ o("button", {
589
+ class: "ck-btn ck-primary",
590
+ onClick: () => void Q("resolved"),
591
+ children: [
592
+ /* @__PURE__ */ o(S, {
593
+ name: "check",
594
+ size: 14
595
+ }),
596
+ " ",
597
+ u("looksGood")
598
+ ]
599
+ }), /* @__PURE__ */ o("button", {
600
+ class: "ck-btn",
601
+ onClick: () => ct(!0),
602
+ children: u("notYet")
603
+ })]
604
+ })]
605
+ }) : null,
606
+ A.map((e, t) => {
607
+ let i = _e(e.author, E), s = t === 0;
608
+ return /* @__PURE__ */ o("div", {
609
+ class: "ck-msg",
610
+ id: `ck-msg-${e.id}`,
611
+ "data-mine": i || void 0,
612
+ "data-reply": !s || void 0,
613
+ "data-new": !ot.current.has(e.id) || void 0,
614
+ children: [/* @__PURE__ */ o(ye, { person: e.author }), /* @__PURE__ */ o("div", {
615
+ class: "ck-msg-main",
616
+ children: [
617
+ /* @__PURE__ */ o("div", {
618
+ class: "ck-msg-meta",
619
+ children: [
620
+ /* @__PURE__ */ o("bdi", {
621
+ class: "ck-msg-name",
622
+ children: e.author.name
623
+ }),
624
+ /* @__PURE__ */ o("time", {
625
+ dateTime: e.created_at,
626
+ title: l(e.created_at),
627
+ children: n(e.created_at)
628
+ }),
629
+ e.edited_at ? /* @__PURE__ */ o("span", {
630
+ title: l(e.edited_at),
631
+ children: ["· ", u("edited")]
632
+ }) : null,
633
+ L?.id === e.id ? null : /* @__PURE__ */ o("span", {
634
+ class: "ck-msg-actions",
635
+ children: [
636
+ Z ? /* @__PURE__ */ o("button", {
637
+ class: "ck-ghost ck-ghost-sm",
638
+ "aria-label": u("replyTo", { name: e.author.name }),
639
+ title: u("quoteReply"),
640
+ onClick: () => $e(e),
641
+ children: /* @__PURE__ */ o(S, {
642
+ name: "reply",
643
+ size: 14
644
+ })
645
+ }) : null,
646
+ /* @__PURE__ */ o("button", {
647
+ class: "ck-ghost ck-ghost-sm",
648
+ "aria-label": u("copyText"),
649
+ title: u("copyText"),
650
+ onClick: () => void Ot(e.body, u("copiedText")),
651
+ children: /* @__PURE__ */ o(S, {
652
+ name: "copy",
653
+ size: 14
654
+ })
655
+ }),
656
+ Z && i ? /* @__PURE__ */ o("button", {
657
+ class: "ck-ghost ck-ghost-sm",
658
+ onClick: () => R({
659
+ id: e.id,
660
+ body: e.body
661
+ }),
662
+ children: u("edit")
663
+ }) : null,
664
+ Z && (i || X?.manage) && !s ? /* @__PURE__ */ o("button", {
665
+ class: "ck-ghost ck-ghost-sm ck-danger",
666
+ onClick: () => Et(e),
667
+ children: u("delete")
668
+ }) : null
669
+ ]
670
+ })
671
+ ]
672
+ }),
673
+ e.reply_to ? /* @__PURE__ */ o("button", {
674
+ class: "ck-quote ck-quote-msg",
675
+ onClick: () => document.querySelector("[data-commentkit-host]")?.shadowRoot?.getElementById(`ck-msg-${e.reply_to.id}`)?.scrollIntoView({
676
+ block: "center",
677
+ behavior: Ae() ? "auto" : "smooth"
678
+ }),
679
+ children: [
680
+ /* @__PURE__ */ o("strong", { children: /* @__PURE__ */ o("bdi", { children: e.reply_to.author.name }) }),
681
+ " ",
682
+ /* @__PURE__ */ o("bdi", { children: e.reply_to.excerpt })
683
+ ]
684
+ }) : null,
685
+ L?.id === e.id ? /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ o("textarea", {
686
+ class: "ck-textarea",
687
+ "aria-label": u("edit"),
688
+ value: L.body,
689
+ disabled: F,
690
+ onInput: (t) => R({
691
+ id: e.id,
692
+ body: t.target.value
693
+ }),
694
+ onKeyDown: (e) => {
695
+ e.stopPropagation(), e.key === "Escape" ? R(null) : e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), St());
696
+ }
697
+ }), /* @__PURE__ */ o("div", {
698
+ class: "ck-actions",
699
+ children: [/* @__PURE__ */ o("button", {
700
+ class: "ck-btn",
701
+ onClick: () => R(null),
702
+ children: u("cancel")
703
+ }), /* @__PURE__ */ o("button", {
704
+ class: "ck-btn ck-primary",
705
+ disabled: F || !L.body.trim(),
706
+ onClick: St,
707
+ children: u(F ? "saving" : "save")
708
+ })]
709
+ })] }) : /* @__PURE__ */ o("div", {
710
+ class: "ck-msg-body",
711
+ dir: "auto",
712
+ children: /* @__PURE__ */ o(ge, {
713
+ text: e.body,
714
+ people: at
715
+ })
716
+ }),
717
+ L?.id === e.id ? null : /* @__PURE__ */ o(Me, {
718
+ client: r,
719
+ text: e.body
720
+ }),
721
+ (() => {
722
+ let t = (e.attachments ?? []).filter((e) => e.kind !== "screenshot"), n = [...s && At ? [{
723
+ src: jt ?? At,
724
+ name: u("screenshot"),
725
+ href: jt
726
+ }] : [], ...t.filter(je).map((e) => ({
727
+ src: x(e.url, "image") ?? x(e.thumbnail_url, "image"),
728
+ name: e.name,
729
+ href: x(e.url)
730
+ }))], r = [...s && At ? [At] : [], ...t.filter(je).map((e) => x(e.thumbnail_url, "image") ?? x(e.url, "image"))], i = t.filter((e) => !je(e));
731
+ return /* @__PURE__ */ o(f, { children: [r.length === 1 ? /* @__PURE__ */ o("button", {
732
+ class: "ck-shot",
733
+ "aria-label": u("openImage", { name: n[0].name }),
734
+ onClick: () => We(n, 0),
735
+ children: /* @__PURE__ */ o("img", {
736
+ src: r[0],
737
+ alt: n[0].name,
738
+ loading: "lazy",
739
+ onLoad: ft
740
+ })
741
+ }) : r.length ? /* @__PURE__ */ o("div", {
742
+ class: "ck-grid",
743
+ "data-count": Math.min(r.length, 4),
744
+ children: r.slice(0, 4).map((e, t) => /* @__PURE__ */ o("button", {
745
+ class: "ck-grid-item",
746
+ "aria-label": u("openImage", { name: n[t].name }),
747
+ onClick: () => We(n, t),
748
+ children: [/* @__PURE__ */ o("img", {
749
+ src: e,
750
+ alt: n[t].name,
751
+ loading: "lazy",
752
+ onLoad: ft
753
+ }), t === 3 && r.length > 4 ? /* @__PURE__ */ o("span", {
754
+ class: "ck-grid-more",
755
+ "aria-hidden": "true",
756
+ children: ["+", r.length - 4]
757
+ }) : null]
758
+ }))
759
+ }) : null, i.length ? /* @__PURE__ */ o("div", {
760
+ class: "ck-files",
761
+ children: i.map((e) => {
762
+ let t = x(e.url);
763
+ return t ? /* @__PURE__ */ o("a", {
764
+ class: "ck-file",
765
+ href: t,
766
+ target: "_blank",
767
+ rel: "noopener noreferrer",
768
+ children: /* @__PURE__ */ o("bdi", { children: e.name })
769
+ }) : /* @__PURE__ */ o("span", {
770
+ class: "ck-file",
771
+ children: /* @__PURE__ */ o("bdi", { children: e.name })
772
+ });
773
+ })
774
+ }) : null] });
775
+ })(),
776
+ /* @__PURE__ */ o("div", {
777
+ class: "ck-reactions",
778
+ children: [
779
+ (e.reactions ?? []).map((t) => {
780
+ let n = `${a("reactionLabel", t.count, { emoji: t.emoji })}${t.mine ? `, ${u("youReacted")}` : ""}`;
781
+ return /* @__PURE__ */ o("button", {
782
+ class: "ck-reaction",
783
+ "aria-pressed": t.mine,
784
+ "aria-label": n,
785
+ title: n,
786
+ onClick: () => void wt(e, t.emoji),
787
+ children: [
788
+ /* @__PURE__ */ o(Se, { char: t.emoji }),
789
+ " ",
790
+ t.count
791
+ ]
792
+ });
793
+ }),
794
+ Z && De.filter((t) => !(e.reactions ?? []).some((e) => e.emoji === t)).slice(0, 3).map((t) => /* @__PURE__ */ o("button", {
795
+ class: "ck-reaction ck-reaction-add",
796
+ "aria-label": u("reactWith", { emoji: t }),
797
+ title: u("reactWith", { emoji: t }),
798
+ onClick: () => void wt(e, t),
799
+ children: /* @__PURE__ */ o(Se, { char: t })
800
+ })),
801
+ Z ? /* @__PURE__ */ o("span", {
802
+ class: "ck-picker-wrap",
803
+ children: [/* @__PURE__ */ o("button", {
804
+ class: "ck-reaction ck-reaction-more",
805
+ "aria-label": u("moreReactions"),
806
+ title: u("moreReactions"),
807
+ "aria-expanded": V === e.id,
808
+ "aria-haspopup": "true",
809
+ onClick: () => rt(V === e.id ? null : e.id),
810
+ children: /* @__PURE__ */ o(S, {
811
+ name: "smile",
812
+ size: 14
813
+ })
814
+ }), V === e.id ? /* @__PURE__ */ o("div", {
815
+ class: "ck-picker",
816
+ role: "group",
817
+ "aria-label": u("moreReactions"),
818
+ ref: pe,
819
+ onKeyDown: (e) => {
820
+ e.key === "Escape" ? (e.stopPropagation(), rt(null)) : xe(e, "button", !1);
821
+ },
822
+ children: g.map((t) => {
823
+ let n = (e.reactions ?? []).some((e) => e.emoji === t && e.mine);
824
+ return /* @__PURE__ */ o("button", {
825
+ "aria-pressed": n,
826
+ "aria-label": u("reactWith", { emoji: t }),
827
+ onClick: () => (rt(null), void wt(e, t)),
828
+ children: /* @__PURE__ */ o(Se, { char: t })
829
+ });
830
+ })
831
+ }) : null]
832
+ }) : null
833
+ ]
834
+ }),
835
+ s && A.length === 1 ? /* @__PURE__ */ o("p", {
836
+ class: "ck-muted ck-no-replies",
837
+ children: u("noReplies")
838
+ }) : null
839
+ ]
840
+ })]
841
+ });
842
+ })
843
+ ]
844
+ }),
845
+ /* @__PURE__ */ o("div", {
846
+ class: "ck-card-foot",
847
+ style: {
848
+ flexDirection: "column",
849
+ alignItems: "stretch",
850
+ position: "relative"
851
+ },
852
+ ...Z && ht ? te(Tt) : {},
853
+ children: [et ? /* @__PURE__ */ o("button", {
854
+ class: "ck-chip ck-jump",
855
+ onClick: () => (B(!1), dt(!0)),
856
+ children: [/* @__PURE__ */ o(S, {
857
+ name: "down",
858
+ size: 14
859
+ }), u("jumpToLatest")]
860
+ }) : null, Z ? /* @__PURE__ */ o(f, { children: [
861
+ Pe ? null : /* @__PURE__ */ o("div", {
862
+ class: "ck-note",
863
+ "data-tone": "warning",
864
+ role: "status",
865
+ children: u("offline")
866
+ }),
867
+ Ye && Pe ? /* @__PURE__ */ o("div", {
868
+ class: "ck-note",
869
+ "data-tone": "warning",
870
+ role: "alert",
871
+ children: Ye === !0 ? /* @__PURE__ */ o(f, { children: [
872
+ u("replyFailed"),
873
+ " ",
874
+ /* @__PURE__ */ o("button", {
875
+ class: "ck-btn",
876
+ disabled: F,
877
+ onClick: () => void Ct(),
878
+ children: u("retry")
879
+ })
880
+ ] }) : Ye
881
+ }) : null,
882
+ /* @__PURE__ */ o(oe, {
883
+ client: r,
884
+ value: N,
885
+ onChange: ze,
886
+ onMentions: qe,
887
+ onSubmit: () => void Ct(),
888
+ placeholder: u(st ? "notYetPlaceholder" : Mt ? "replyToReopen" : "replyPlaceholder"),
889
+ autofocus: st || !!z,
890
+ disabled: F,
891
+ canMention: !0,
892
+ above: z ? /* @__PURE__ */ o("div", {
893
+ class: "ck-quoting",
894
+ role: "status",
895
+ children: [
896
+ /* @__PURE__ */ o(S, {
897
+ name: "reply",
898
+ size: 14
899
+ }),
900
+ /* @__PURE__ */ o("span", { children: [
901
+ /* @__PURE__ */ o("strong", { children: /* @__PURE__ */ o("bdi", { children: z.author.name }) }),
902
+ " ",
903
+ /* @__PURE__ */ o("bdi", { children: z.body.slice(0, 140) })
904
+ ] }),
905
+ /* @__PURE__ */ o("button", {
906
+ class: "ck-ghost ck-ghost-sm",
907
+ "aria-label": u("quoteCancel"),
908
+ onClick: () => $e(null),
909
+ children: /* @__PURE__ */ o(S, {
910
+ name: "close",
911
+ size: 14
912
+ })
913
+ })
914
+ ]
915
+ }) : null
916
+ }),
917
+ /* @__PURE__ */ o(ce, {
918
+ items: P.items,
919
+ onRemove: P.remove,
920
+ onRetry: P.retry,
921
+ onOpen: (e) => We(P.items.filter((e) => e.preview).map((e) => ({
922
+ src: e.preview,
923
+ name: e.file.name
924
+ })), e)
925
+ }),
926
+ /* @__PURE__ */ o("div", {
927
+ class: "ck-actions",
928
+ style: { marginTop: 0 },
929
+ children: [
930
+ ht ? /* @__PURE__ */ o(ne, {
931
+ input: Ge,
932
+ onFiles: Tt
933
+ }) : null,
934
+ Mt ? /* @__PURE__ */ o("button", {
935
+ class: "ck-btn",
936
+ onClick: () => void Q("open"),
937
+ children: u("reopen")
938
+ }) : /* @__PURE__ */ o("button", {
939
+ class: "ck-btn",
940
+ title: u("resolveHint"),
941
+ "aria-keyshortcuts": r.options.shortcuts === !1 ? void 0 : "E",
942
+ onClick: () => void Q("resolved"),
943
+ children: [
944
+ /* @__PURE__ */ o(S, {
945
+ name: "check",
946
+ size: 14
947
+ }),
948
+ " ",
949
+ u("resolve")
950
+ ]
951
+ }),
952
+ /* @__PURE__ */ o("span", { class: "ck-spacer" }),
953
+ /* @__PURE__ */ o("button", {
954
+ class: "ck-btn ck-primary",
955
+ disabled: F || !N.trim() || !Pe,
956
+ onClick: () => void Ct(),
957
+ children: u(F ? "sending" : "reply")
958
+ })
959
+ ]
960
+ })
961
+ ] }) : /* @__PURE__ */ o("div", {
962
+ class: "ck-note",
963
+ role: "status",
964
+ children: u(Ne ? "readOnlyReply" : "noReplyAccess")
965
+ })]
966
+ }),
967
+ Be && He ? /* @__PURE__ */ o(He, {
968
+ images: Be.images,
969
+ start: Be.start,
970
+ onClose: () => Ve(null)
971
+ }) : null,
972
+ U ? /* @__PURE__ */ o("div", {
973
+ class: "ck-mention-card",
974
+ style: {
975
+ left: `${Math.min(U.x, innerWidth - 220)}px`,
976
+ top: `${U.y}px`
977
+ },
978
+ "aria-hidden": "true",
979
+ children: [/* @__PURE__ */ o(ye, { person: U.person }), /* @__PURE__ */ o("bdi", {
980
+ class: "ck-msg-name",
981
+ children: U.person.name
982
+ })]
983
+ }) : null
984
+ ]
985
+ });
986
+ }
987
+ var ke = 6e3;
988
+ function Ae() {
989
+ return matchMedia("(prefers-reduced-motion: reduce)").matches;
990
+ }
991
+ function je(e) {
992
+ return e.mime.startsWith("image/") && !!(x(e.url, "image") || x(e.thumbnail_url, "image"));
993
+ }
994
+ function Me({ client: e, text: t }) {
995
+ let n = c(() => [...new Set([...t.matchAll(/https?:\/\/[^\s<>"')\u200b-\u200f\u202a-\u202e\u2060-\u2069\ufeff]+/g)].map((e) => x(e[0])).filter((e) => !!e))].slice(0, 2), [t]), [r, i] = s([]);
996
+ return d(() => {
997
+ let t = !0;
998
+ return i([]), n.length && Promise.all(n.map((t) => e.linkPreview(t))).then((e) => t && i(e.filter((e) => !!e))), () => {
999
+ t = !1;
1000
+ };
1001
+ }, [n.join(" ")]), r.length ? /* @__PURE__ */ o("div", {
1002
+ class: "ck-previews",
1003
+ children: r.map((e) => {
1004
+ let t = x(e.url);
1005
+ return t ? /* @__PURE__ */ o("a", {
1006
+ class: "ck-preview",
1007
+ href: t,
1008
+ target: "_blank",
1009
+ rel: "noopener noreferrer nofollow ugc",
1010
+ children: [
1011
+ /* @__PURE__ */ o("span", {
1012
+ class: "ck-preview-site",
1013
+ children: /* @__PURE__ */ o("bdi", { children: e.site })
1014
+ }),
1015
+ /* @__PURE__ */ o("strong", { children: /* @__PURE__ */ o("bdi", { children: e.title }) }),
1016
+ e.description ? /* @__PURE__ */ o("span", {
1017
+ class: "ck-preview-text",
1018
+ children: /* @__PURE__ */ o("bdi", { children: e.description })
1019
+ }) : null
1020
+ ]
1021
+ }) : null;
1022
+ })
1023
+ }) : null;
1024
+ }
1025
+ //#endregion
1026
+ export { w as ThreadCard };