@tryghost/activitypub 3.0.2 → 3.0.7

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 (58) hide show
  1. package/dist/activitypub.js +3 -3
  2. package/dist/at-sign-DjgaOOtV.mjs +15 -0
  3. package/dist/at-sign-DjgaOOtV.mjs.map +1 -0
  4. package/dist/avatar-flipboard-8NioODS5.mjs +19 -0
  5. package/dist/avatar-flipboard-8NioODS5.mjs.map +1 -0
  6. package/dist/bluesky-sharing-B4oF-0BN.mjs +150 -0
  7. package/dist/bluesky-sharing-B4oF-0BN.mjs.map +1 -0
  8. package/dist/copy-BxgO1lWX.mjs +15 -0
  9. package/dist/copy-BxgO1lWX.mjs.map +1 -0
  10. package/dist/deleted-feed-item-Ct4Zc7u3.mjs +133 -0
  11. package/dist/deleted-feed-item-Ct4Zc7u3.mjs.map +1 -0
  12. package/dist/edit-profile-DVsYbpNY.mjs +3651 -0
  13. package/dist/edit-profile-DVsYbpNY.mjs.map +1 -0
  14. package/dist/feed-D0aeoOOJ.mjs +207 -0
  15. package/dist/feed-D0aeoOOJ.mjs.map +1 -0
  16. package/dist/hash-B-J30lCU.mjs +17 -0
  17. package/dist/hash-B-J30lCU.mjs.map +1 -0
  18. package/dist/inbox-BrLsHadF.mjs +21 -0
  19. package/dist/inbox-BrLsHadF.mjs.map +1 -0
  20. package/dist/index-BMm_mIRT.mjs +138 -0
  21. package/dist/index-BMm_mIRT.mjs.map +1 -0
  22. package/dist/{index-DN0VoLV5.mjs → index-BdcW7GlH.mjs} +20 -20
  23. package/dist/{index-DN0VoLV5.mjs.map → index-BdcW7GlH.mjs.map} +1 -1
  24. package/dist/index-BftxScf5.mjs +4994 -0
  25. package/dist/index-BftxScf5.mjs.map +1 -0
  26. package/dist/index-DL7eG3Ac.mjs +367 -0
  27. package/dist/index-DL7eG3Ac.mjs.map +1 -0
  28. package/dist/index-DnpX9U7J.mjs +688 -0
  29. package/dist/index-DnpX9U7J.mjs.map +1 -0
  30. package/dist/index-DyFr7l3O.mjs +6508 -0
  31. package/dist/index-DyFr7l3O.mjs.map +1 -0
  32. package/dist/index-WlK4xdmR.mjs +219 -0
  33. package/dist/index-WlK4xdmR.mjs.map +1 -0
  34. package/dist/index-_vEj3NfZ.mjs +27062 -0
  35. package/dist/index-_vEj3NfZ.mjs.map +1 -0
  36. package/dist/moderation-KWQp9gQj.mjs +113 -0
  37. package/dist/moderation-KWQp9gQj.mjs.map +1 -0
  38. package/dist/note-CfQDRkeT.mjs +249 -0
  39. package/dist/note-CfQDRkeT.mjs.map +1 -0
  40. package/dist/reply-BrWarBVQ.mjs +15 -0
  41. package/dist/reply-BrWarBVQ.mjs.map +1 -0
  42. package/dist/separator-nDV4oVPB.mjs +39 -0
  43. package/dist/separator-nDV4oVPB.mjs.map +1 -0
  44. package/dist/settings-CCnMmVaW.mjs +79 -0
  45. package/dist/settings-CCnMmVaW.mjs.map +1 -0
  46. package/dist/step-1-HGv6537o.mjs +73 -0
  47. package/dist/step-1-HGv6537o.mjs.map +1 -0
  48. package/dist/step-2-hqeY_dIc.mjs +143 -0
  49. package/dist/step-2-hqeY_dIc.mjs.map +1 -0
  50. package/dist/step-3-8yg4QPpr.mjs +345 -0
  51. package/dist/step-3-8yg4QPpr.mjs.map +1 -0
  52. package/dist/tabs-BZytpdZ9.mjs +1096 -0
  53. package/dist/tabs-BZytpdZ9.mjs.map +1 -0
  54. package/dist/topic-filter-1kNAxvyr.mjs +39 -0
  55. package/dist/topic-filter-1kNAxvyr.mjs.map +1 -0
  56. package/package.json +1 -1
  57. package/dist/index-DF-NBA1D.mjs +0 -46011
  58. package/dist/index-DF-NBA1D.mjs.map +0 -1
@@ -0,0 +1,688 @@
1
+ import { a6 as ie, Q as X, c as y, e as C, d as O, j as e, N as z, J as _, b2 as Ue, g as Me, R as Be, P as De, M as Pe, A as de, B as u, aa as ce, h as Te, k as Z, aI as Ie, F as xe, b as v, W as Fe, Z as he, b3 as Ae, _ as me, $ as G, a0 as W, a1 as q, H as K, b4 as Re, b5 as $e, a2 as J, a3 as fe, O as B, b6 as Ee, b7 as Le, b8 as He, b9 as oe, a4 as Se, a5 as Oe, u as pe, ba as ze, a as _e, ax as Ve, x as Qe, y as Ye, z as Ge, G as We, L as ae, E as qe, f as Ke, S as E, bb as Je, D as Xe, m as Ze, n as es, o as ss, p as ls, I as rs, Y as ns, bc as os, ab as as, ac as ts, bd as Q, K as is, av as ds, aw as cs, be as xs, bf as be, bg as hs } from "./index-_vEj3NfZ.mjs";
2
+ import { S as je } from "./separator-nDV4oVPB.mjs";
3
+ import { E as ms } from "./edit-profile-DVsYbpNY.mjs";
4
+ import { T as fs, a as ps, b as H, d as Y, c as S } from "./tabs-BZytpdZ9.mjs";
5
+ import { S as bs } from "./settings-CCnMmVaW.mjs";
6
+ import { C as js } from "./copy-BxgO1lWX.mjs";
7
+ /**
8
+ * @license lucide-react v0.553.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */
13
+ const us = [
14
+ [
15
+ "path",
16
+ {
17
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
18
+ key: "1a8usu"
19
+ }
20
+ ],
21
+ ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
22
+ ], gs = ie("pencil", us);
23
+ /**
24
+ * @license lucide-react v0.553.0 - ISC
25
+ *
26
+ * This source code is licensed under the ISC license.
27
+ * See the LICENSE file in the root directory of this source tree.
28
+ */
29
+ const ks = [
30
+ ["path", { d: "M2 21a8 8 0 0 1 11.873-7", key: "74fkxq" }],
31
+ ["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }],
32
+ ["path", { d: "m17 17 5 5", key: "p7ous7" }],
33
+ ["path", { d: "m22 17-5 5", key: "gqnmv0" }]
34
+ ], ws = ie("user-round-x", ks);
35
+ function vs(s) {
36
+ return typeof s.name == "string" ? s.name : typeof s.preferredUsername == "string" ? s.preferredUsername : typeof s.preferredUsername == "object" && s.preferredUsername !== null && "@value" in s.preferredUsername && typeof s.preferredUsername["@value"] == "string" ? s.preferredUsername["@value"] : "Unknown";
37
+ }
38
+ const ue = ({
39
+ noResultsMessage: s,
40
+ actors: n,
41
+ isLoading: r,
42
+ fetchNextPage: d,
43
+ hasNextPage: h,
44
+ isFetchingNextPage: c
45
+ }) => {
46
+ const t = X("index", "me"), { data: a } = t, o = y(null), i = y(null);
47
+ C(() => (o.current && o.current.disconnect(), o.current = new IntersectionObserver((l) => {
48
+ l[0].isIntersecting && h && !c && d();
49
+ }), i.current && o.current.observe(i.current), () => {
50
+ o.current && o.current.disconnect();
51
+ }), [h, c, d]);
52
+ const x = O();
53
+ return /* @__PURE__ */ e.jsxs("div", { className: "pt-3", "data-testid": "actor-list", children: [
54
+ h === !1 && n.length === 0 ? /* @__PURE__ */ e.jsxs(z, { children: [
55
+ /* @__PURE__ */ e.jsx(_, { children: /* @__PURE__ */ e.jsx(Ue, {}) }),
56
+ s
57
+ ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col", children: n.map(({ actor: l, isFollowing: f, blockedByMe: g, domainBlockedByMe: w }) => {
58
+ const j = l.handle || Me(l), N = j === (a == null ? void 0 : a.handle);
59
+ return /* @__PURE__ */ e.jsx(Be.Fragment, { children: /* @__PURE__ */ e.jsx(De, { actor: l, align: "center", isCurrentUser: N, side: "left", children: /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs(
60
+ Pe,
61
+ {
62
+ "data-testid": "actor-item",
63
+ onClick: () => {
64
+ Te(l, x);
65
+ },
66
+ children: [
67
+ /* @__PURE__ */ e.jsx(de, { author: l }),
68
+ /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "text-gray-600 break-anywhere", children: [
69
+ /* @__PURE__ */ e.jsx("span", { className: "mr-1 line-clamp-1 font-bold text-black dark:text-white", children: vs(l) }),
70
+ /* @__PURE__ */ e.jsx("div", { className: "line-clamp-1 text-sm", children: j })
71
+ ] }) }),
72
+ g || w ? /* @__PURE__ */ e.jsx(u, { className: "pointer-events-none ml-auto min-w-[90px]", variant: "destructive", children: "Blocked" }) : N ? null : /* @__PURE__ */ e.jsx(
73
+ ce,
74
+ {
75
+ className: "ml-auto",
76
+ "data-testid": "follow-button",
77
+ following: f,
78
+ handle: j,
79
+ type: "secondary"
80
+ }
81
+ )
82
+ ]
83
+ },
84
+ l.id
85
+ ) }) }) }, l.id);
86
+ }) }),
87
+ /* @__PURE__ */ e.jsx("div", { ref: i, className: "h-1" }),
88
+ (c || r) && /* @__PURE__ */ e.jsx("div", { className: "mt-6 flex flex-col items-center justify-center space-y-4 text-center", children: /* @__PURE__ */ e.jsx(Z, { size: "md" }) })
89
+ ] });
90
+ }, ys = ({
91
+ posts: s,
92
+ fetchNextPage: n,
93
+ hasNextPage: r,
94
+ isFetchingNextPage: d,
95
+ isLoading: h
96
+ }) => {
97
+ const c = y(null), t = y(null), a = y(null), o = Math.max(0, Math.floor(s.length * 0.75) - 1);
98
+ C(() => (c.current && c.current.disconnect(), c.current = new IntersectionObserver((x) => {
99
+ x[0].isIntersecting && r && !d && n();
100
+ }), t.current && c.current.observe(t.current), a.current && c.current.observe(a.current), () => {
101
+ c.current && c.current.disconnect();
102
+ }), [r, d, n]);
103
+ const i = O();
104
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
105
+ r === !1 && s.length === 0 && /* @__PURE__ */ e.jsxs(z, { children: [
106
+ /* @__PURE__ */ e.jsx(_, { children: /* @__PURE__ */ e.jsx(Ie, {}) }),
107
+ "You haven't liked anything yet."
108
+ ] }),
109
+ /* @__PURE__ */ e.jsxs("ul", { className: "mx-auto flex max-w-[640px] flex-col", "data-testid": "profile-likes-list", children: [
110
+ s.map((x, l) => /* @__PURE__ */ e.jsxs(
111
+ "li",
112
+ {
113
+ "data-testid": "profile-like-item",
114
+ "data-test-view-article": !0,
115
+ children: [
116
+ /* @__PURE__ */ e.jsx(
117
+ xe,
118
+ {
119
+ actor: x.actor,
120
+ allowDelete: x.object.authored,
121
+ commentCount: x.object.replyCount,
122
+ isLoading: h,
123
+ layout: "feed",
124
+ likeCount: x.object.likeCount,
125
+ object: x.object,
126
+ repostCount: x.object.repostCount,
127
+ type: x.type,
128
+ onClick: () => {
129
+ x.object.type === "Note" ? i(`/notes/${encodeURIComponent(x.object.id)}`) : x.object.type === "Article" && i(`/reader/${encodeURIComponent(x.object.id)}`);
130
+ }
131
+ }
132
+ ),
133
+ l < s.length - 1 && /* @__PURE__ */ e.jsx(je, {}),
134
+ l === o && /* @__PURE__ */ e.jsx("div", { ref: t, className: "h-1" })
135
+ ]
136
+ },
137
+ `likes-${x.id}`
138
+ )),
139
+ d && /* @__PURE__ */ e.jsx("li", { className: "flex flex-col items-center justify-center space-y-4 text-center", children: /* @__PURE__ */ e.jsx(Z, { size: "md" }) })
140
+ ] }),
141
+ /* @__PURE__ */ e.jsx("div", { ref: a, className: "h-1" })
142
+ ] });
143
+ }, Ns = ({
144
+ posts: s,
145
+ fetchNextPage: n,
146
+ hasNextPage: r,
147
+ isFetchingNextPage: d,
148
+ isLoading: h,
149
+ noResultsMessage: c
150
+ }) => {
151
+ const t = y(null), a = y(null), o = y(null), i = Math.max(0, Math.floor(s.length * 0.75) - 1);
152
+ C(() => (t.current && t.current.disconnect(), t.current = new IntersectionObserver((l) => {
153
+ l[0].isIntersecting && r && !d && n();
154
+ }), a.current && t.current.observe(a.current), o.current && t.current.observe(o.current), () => {
155
+ t.current && t.current.disconnect();
156
+ }), [r, d, n]);
157
+ const x = O();
158
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
159
+ r === !1 && s.length === 0 && /* @__PURE__ */ e.jsxs(z, { children: [
160
+ /* @__PURE__ */ e.jsx(_, { children: /* @__PURE__ */ e.jsx(gs, {}) }),
161
+ c
162
+ ] }),
163
+ /* @__PURE__ */ e.jsxs("ul", { className: "mx-auto flex max-w-[640px] flex-col", "data-testid": "profile-posts-list", children: [
164
+ s.map((l, f) => /* @__PURE__ */ e.jsxs(
165
+ "li",
166
+ {
167
+ "data-testid": "profile-post-item",
168
+ "data-test-view-article": !0,
169
+ children: [
170
+ /* @__PURE__ */ e.jsx(
171
+ xe,
172
+ {
173
+ actor: l.actor,
174
+ allowDelete: l.object.authored,
175
+ commentCount: l.object.replyCount,
176
+ isLoading: h,
177
+ layout: "feed",
178
+ likeCount: l.object.likeCount,
179
+ object: l.object,
180
+ repostCount: l.object.repostCount,
181
+ type: l.type,
182
+ onClick: () => {
183
+ l.object.type === "Note" ? x(`/notes/${encodeURIComponent(l.object.id)}`) : l.object.type === "Article" && x(`/reader/${encodeURIComponent(l.object.id)}`);
184
+ }
185
+ }
186
+ ),
187
+ f < s.length - 1 && /* @__PURE__ */ e.jsx(je, {}),
188
+ f === i && /* @__PURE__ */ e.jsx("div", { ref: a, className: "h-1" })
189
+ ]
190
+ },
191
+ `posts-${l.id}`
192
+ )),
193
+ d && /* @__PURE__ */ e.jsx("li", { className: "flex flex-col items-center justify-center space-y-4 text-center", children: /* @__PURE__ */ e.jsx(Z, { size: "md" }) })
194
+ ] }),
195
+ /* @__PURE__ */ e.jsx("div", { ref: o, className: "h-1" })
196
+ ] });
197
+ }, ge = ({
198
+ handle: s,
199
+ isUserBlocked: n,
200
+ isDomainBlocked: r,
201
+ onUnblockUser: d,
202
+ onUnblockDomain: h,
203
+ trigger: c,
204
+ onUnblockComplete: t,
205
+ isOpen: a,
206
+ onOpenChange: o
207
+ }) => {
208
+ const [i, x] = v(!1), [l, f] = v(() => {
209
+ const p = n && r, U = n && !r, R = !n && r;
210
+ let k = "idle";
211
+ return p ? k = "dual" : U ? k = "userOnly" : R && (k = "domainOnly"), {
212
+ mode: k,
213
+ userUnblocked: !1,
214
+ domainUnblocked: !1
215
+ };
216
+ }), g = a !== void 0, w = g ? a : i, [j, N] = v(!1), D = Fe(() => {
217
+ const p = n && r, U = n && !r, R = !n && r;
218
+ let k = "idle";
219
+ p ? k = "dual" : U ? k = "userOnly" : R && (k = "domainOnly"), f((M) => ({
220
+ ...M,
221
+ mode: k,
222
+ userUnblocked: !1,
223
+ domainUnblocked: !1
224
+ }));
225
+ }, [n, r]);
226
+ C(() => {
227
+ w && !j ? (D(), N(!0)) : w || N(!1);
228
+ }, [w, j, D]);
229
+ const F = () => {
230
+ g ? o == null || o(!0) : x(!0);
231
+ }, m = (p) => {
232
+ p || (g ? o == null || o(!1) : x(!1));
233
+ }, L = async () => {
234
+ await d(), f((p) => ({
235
+ ...p,
236
+ userUnblocked: !0
237
+ })), (l.mode !== "dual" || l.domainUnblocked) && (m(!1), t == null || t()), B.success("User unblocked");
238
+ }, P = async () => {
239
+ await h(), f((p) => ({
240
+ ...p,
241
+ domainUnblocked: !0
242
+ })), (l.mode !== "dual" || l.userUnblocked) && (m(!1), t == null || t()), B.success("Domain unblocked");
243
+ }, A = s.split("@").filter(Boolean)[1], T = () => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
244
+ /* @__PURE__ */ e.jsxs(G, { children: [
245
+ /* @__PURE__ */ e.jsx(W, { className: "mb-1 flex flex-col gap-1", children: "Unblock" }),
246
+ /* @__PURE__ */ e.jsx(q, { className: "!mt-4", asChild: !0, children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col rounded-md border", children: [
247
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between gap-6 p-5", children: [
248
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
249
+ /* @__PURE__ */ e.jsx(K, { children: "Unblock user" }),
250
+ /* @__PURE__ */ e.jsxs("p", { children: [
251
+ /* @__PURE__ */ e.jsx("span", { className: "font-semibold text-black", children: s }),
252
+ " will be able to follow you and engage with your public posts."
253
+ ] })
254
+ ] }),
255
+ /* @__PURE__ */ e.jsxs(u, { className: `gap-1 ${l.userUnblocked ? "pointer-events-none border-green bg-green text-white hover:bg-green hover:text-white" : "text-red hover:text-red-400"}`, variant: "outline", onClick: L, children: [
256
+ /* @__PURE__ */ e.jsx(Re, {}),
257
+ l.userUnblocked ? "User unblocked" : "Unblock user"
258
+ ] })
259
+ ] }),
260
+ /* @__PURE__ */ e.jsx("div", { className: "border-t" }),
261
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between gap-6 p-5", children: [
262
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
263
+ /* @__PURE__ */ e.jsx(K, { children: "Unblock domain" }),
264
+ /* @__PURE__ */ e.jsxs("p", { children: [
265
+ "Users from ",
266
+ /* @__PURE__ */ e.jsx("span", { className: "font-semibold text-black", children: A }),
267
+ " will be able to follow you and engage with your public posts."
268
+ ] })
269
+ ] }),
270
+ /* @__PURE__ */ e.jsxs(u, { className: `gap-1 ${l.domainUnblocked ? "pointer-events-none border-green bg-green text-white hover:bg-green hover:text-white" : "text-red hover:text-red-400"}`, variant: "outline", onClick: P, children: [
271
+ /* @__PURE__ */ e.jsx($e, {}),
272
+ l.domainUnblocked ? "Domain unblocked" : "Unblock domain"
273
+ ] })
274
+ ] })
275
+ ] }) })
276
+ ] }),
277
+ /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsx(u, { onClick: () => m(!1), children: "OK" }) })
278
+ ] }), I = () => {
279
+ const p = l.mode === "userOnly";
280
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
281
+ /* @__PURE__ */ e.jsxs(G, { children: [
282
+ /* @__PURE__ */ e.jsx(W, { className: "mb-1 flex flex-col gap-1", children: p ? "Unblock this user?" : "Unblock this domain?" }),
283
+ /* @__PURE__ */ e.jsx(q, { children: p ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
284
+ /* @__PURE__ */ e.jsx("span", { className: "font-semibold text-black", children: s }),
285
+ " will be able to follow you and engage with your public posts."
286
+ ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
287
+ "Users from ",
288
+ /* @__PURE__ */ e.jsx("span", { className: "font-semibold text-black", children: A }),
289
+ " will be able to follow you and engage with your public posts."
290
+ ] }) })
291
+ ] }),
292
+ /* @__PURE__ */ e.jsxs(J, { children: [
293
+ /* @__PURE__ */ e.jsx(fe, { children: "Cancel" }),
294
+ /* @__PURE__ */ e.jsx(u, { onClick: p ? L : P, children: "Unblock" })
295
+ ] })
296
+ ] });
297
+ };
298
+ return /* @__PURE__ */ e.jsxs(he, { open: w, onOpenChange: m, children: [
299
+ c && /* @__PURE__ */ e.jsx(Ae, { asChild: !0, onClick: F, children: c }),
300
+ /* @__PURE__ */ e.jsx(me, { className: `${l.mode === "dual" && "max-w-[600px]"}`, children: l.mode === "dual" ? T() : I() })
301
+ ] });
302
+ }, Cs = ({
303
+ account: s,
304
+ children: n,
305
+ onCopyHandle: r,
306
+ onBlockAccount: d,
307
+ onBlockDomain: h,
308
+ disabled: c = !1,
309
+ isBlocked: t = !1,
310
+ isDomainBlocked: a = !1
311
+ }) => {
312
+ const [o, i] = v(null), [x, l] = v(!1), f = (m) => {
313
+ m.stopPropagation(), r();
314
+ }, g = (m) => {
315
+ m.stopPropagation(), d();
316
+ }, w = (m) => {
317
+ m.stopPropagation(), h();
318
+ }, j = s == null ? void 0 : s.handle, N = j == null ? void 0 : j.split("@").filter(Boolean)[1], D = () => /* @__PURE__ */ e.jsx(he, { open: x, onOpenChange: l, children: /* @__PURE__ */ e.jsxs(me, { onClick: (m) => m.stopPropagation(), children: [
319
+ /* @__PURE__ */ e.jsxs(G, { children: [
320
+ /* @__PURE__ */ e.jsx(W, { className: "mb-1 flex flex-col gap-1", children: o === "user" ? "Block this user?" : "Block this domain?" }),
321
+ /* @__PURE__ */ e.jsx(q, { children: o === "user" ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
322
+ /* @__PURE__ */ e.jsx("span", { className: "font-semibold text-black", children: j }),
323
+ " will be able to see your public posts, but will no longer be able follow you or interact with your content on the social web."
324
+ ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
325
+ "All users from ",
326
+ /* @__PURE__ */ e.jsx("span", { className: "font-semibold text-black", children: N }),
327
+ " will be able to see your public posts, but won't be able to follow you or interact with your content."
328
+ ] }) })
329
+ ] }),
330
+ /* @__PURE__ */ e.jsxs(J, { children: [
331
+ o !== "domain" && /* @__PURE__ */ e.jsx(u, { className: "-ml-3 mr-auto hover:bg-transparent hover:opacity-80", variant: "ghost", onClick: (m) => {
332
+ m.stopPropagation(), i("domain");
333
+ }, children: "Block domain instead" }),
334
+ /* @__PURE__ */ e.jsx(fe, { onClick: (m) => m.stopPropagation(), children: "Cancel" }),
335
+ /* @__PURE__ */ e.jsx(
336
+ Se,
337
+ {
338
+ className: Oe({ variant: "destructive" }),
339
+ onClick: o === "user" ? g : w,
340
+ children: "Block"
341
+ }
342
+ )
343
+ ] })
344
+ ] }) }), F = () => s && /* @__PURE__ */ e.jsx(
345
+ ge,
346
+ {
347
+ handle: s.handle,
348
+ isDomainBlocked: s.domainBlockedByMe,
349
+ isOpen: x,
350
+ isUserBlocked: s.blockedByMe,
351
+ onOpenChange: l,
352
+ onUnblockDomain: h,
353
+ onUnblockUser: d
354
+ }
355
+ );
356
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
357
+ /* @__PURE__ */ e.jsxs(Ee, { children: [
358
+ /* @__PURE__ */ e.jsx(Le, { disabled: c, asChild: !0, onClick: (m) => m.stopPropagation(), children: n }),
359
+ /* @__PURE__ */ e.jsx(He, { align: "end", className: "p-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex w-48 flex-col", children: [
360
+ /* @__PURE__ */ e.jsx(oe, { asChild: !0, children: /* @__PURE__ */ e.jsx(u, { className: "justify-start", variant: "ghost", onClick: f, children: "Copy handle" }) }),
361
+ /* @__PURE__ */ e.jsx(oe, { asChild: !0, children: /* @__PURE__ */ e.jsx(u, { className: "justify-start text-red hover:bg-red/5 hover:text-red", variant: "ghost", onClick: (m) => {
362
+ m.stopPropagation(), !t && !a && i("user"), l(!0);
363
+ }, children: t ? "Unblock user" : a ? "Unblock domain" : "Block user" }) })
364
+ ] }) })
365
+ ] }),
366
+ t || a ? F() : D()
367
+ ] });
368
+ }, Us = ({
369
+ account: s,
370
+ onUnblock: n,
371
+ onDomainUnblock: r,
372
+ className: d = ""
373
+ }) => {
374
+ const [h, c] = v(!1), t = /* @__PURE__ */ e.jsx(
375
+ u,
376
+ {
377
+ className: `min-w-[90px] ${d}`,
378
+ variant: "destructive",
379
+ onMouseEnter: () => c(!0),
380
+ onMouseLeave: () => c(!1),
381
+ children: h ? "Unblock" : "Blocked"
382
+ }
383
+ );
384
+ return /* @__PURE__ */ e.jsx(
385
+ ge,
386
+ {
387
+ handle: s.handle,
388
+ isDomainBlocked: s.domainBlockedByMe,
389
+ isUserBlocked: s.blockedByMe,
390
+ trigger: t,
391
+ onUnblockDomain: r,
392
+ onUnblockUser: n
393
+ }
394
+ );
395
+ }, te = () => {
396
+ }, Ms = ({
397
+ account: s,
398
+ customFields: n,
399
+ isLoadingAccount: r,
400
+ postsTab: d,
401
+ likesTab: h,
402
+ followingTab: c,
403
+ followersTab: t
404
+ }) => {
405
+ const a = pe(), o = ze(), i = O(), { canGoBack: x } = _e(), l = a.handle ? `/profile/${a.handle}` : "/profile", f = !a.handle, g = a.handle ? a.tab || "" : o.pathname.split("/").pop() || "", w = Ve(() => f ? ["likes", "following", "followers"] : ["following", "followers"], [f]), j = w.includes(g) ? g : "posts", N = Qe("index"), D = Ye("index"), F = Ge("index"), m = We("index"), L = X("index", "me"), { data: P } = a.handle ? L : { data: void 0 }, A = a.handle === (P == null ? void 0 : P.handle) || !a.handle, T = s == null ? void 0 : s.blockedByMe, I = s == null ? void 0 : s.domainBlockedByMe, [p, U] = v(!1), [R, k] = v(!1), M = y(null);
406
+ C(() => () => {
407
+ M.current && window.clearTimeout(M.current);
408
+ }, []);
409
+ const ee = () => {
410
+ T ? D.mutate(s) : (N.mutate(s), B.success("User blocked")), U(!1);
411
+ }, se = () => {
412
+ I ? m.mutate({ url: s.apId, handle: s.handle }) : (F.mutate({ url: s.apId, handle: s.handle }), B.success("Domain blocked")), U(!1);
413
+ }, le = async () => {
414
+ var b;
415
+ if (!(s != null && s.handle) || !((b = navigator == null ? void 0 : navigator.clipboard) != null && b.writeText)) {
416
+ B.error("Unable to copy handle");
417
+ return;
418
+ }
419
+ try {
420
+ await navigator.clipboard.writeText(s.handle), k(!0), B.success("Handle copied"), M.current && window.clearTimeout(M.current), M.current = window.setTimeout(() => k(!1), 2e3);
421
+ } catch {
422
+ B.error("Failed to copy handle"), k(!1);
423
+ }
424
+ }, [$, ke] = v(!1), [we, re] = v(!1), ve = () => {
425
+ ke(!$);
426
+ }, V = y(null), [ne, ye] = v(!1);
427
+ C(() => {
428
+ V.current && ye(V.current.scrollHeight > 160);
429
+ }, [$, s == null ? void 0 : s.bio, n, r]), C(() => {
430
+ g && (w.includes(g) || i(l, { replace: !0 }));
431
+ }, [w, l, i, g]);
432
+ const Ne = (b) => b === "posts" ? l : `${l}/${b}`, Ce = (b) => {
433
+ b !== j && i(Ne(b), { replace: !0 });
434
+ };
435
+ return !r && !s ? /* @__PURE__ */ e.jsx(ae, { children: /* @__PURE__ */ e.jsx("div", { className: "mx-auto mt-4 flex w-full max-w-[620px] flex-col items-center [&_svg]:translate-x-px", children: /* @__PURE__ */ e.jsxs(qe, { children: [
436
+ /* @__PURE__ */ e.jsx(Ke, { children: /* @__PURE__ */ e.jsx(ws, {}) }),
437
+ /* @__PURE__ */ e.jsx("div", { children: "Profile not found" })
438
+ ] }) }) }) : /* @__PURE__ */ e.jsx(ae, { children: /* @__PURE__ */ e.jsx("div", { className: "z-0 mx-[max(-4vw,-32px)] -mt-9 flex flex-col items-center pb-16", children: /* @__PURE__ */ e.jsx("div", { className: "mx-auto w-full", children: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
439
+ s != null && s.bannerImageUrl ? /* @__PURE__ */ e.jsx("div", { className: "h-[15vw] min-h-[200px] w-full overflow-hidden bg-gradient-to-tr from-gray-200 to-gray-100", children: /* @__PURE__ */ e.jsx(
440
+ "img",
441
+ {
442
+ alt: s == null ? void 0 : s.name,
443
+ className: "size-full object-cover",
444
+ referrerPolicy: "no-referrer",
445
+ src: s == null ? void 0 : s.bannerImageUrl
446
+ }
447
+ ) }) : /* @__PURE__ */ e.jsx("div", { className: "h-[max(8vw,132px)] w-full overflow-hidden bg-gradient-to-tr from-white to-white dark:from-black dark:to-black" }),
448
+ /* @__PURE__ */ e.jsxs("div", { className: `mx-auto max-w-[620px] px-6 ${!(s != null && s.bannerImageUrl) && !x ? "-mt-8" : "-mt-12"}`, children: [
449
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-end justify-between", children: [
450
+ /* @__PURE__ */ e.jsx("div", { className: "-ml-2 rounded-full bg-white p-1 dark:bg-black", children: r ? /* @__PURE__ */ e.jsx(E, { className: "size-[92px] rounded-full" }) : /* @__PURE__ */ e.jsx(
451
+ de,
452
+ {
453
+ author: {
454
+ icon: {
455
+ url: s == null ? void 0 : s.avatarUrl
456
+ },
457
+ name: s == null ? void 0 : s.name,
458
+ handle: s == null ? void 0 : s.handle
459
+ },
460
+ size: "lg"
461
+ }
462
+ ) }),
463
+ !A && !r && /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
464
+ T || I ? /* @__PURE__ */ e.jsx(
465
+ Us,
466
+ {
467
+ account: s,
468
+ onDomainUnblock: se,
469
+ onUnblock: ee
470
+ }
471
+ ) : /* @__PURE__ */ e.jsx(
472
+ ce,
473
+ {
474
+ following: s == null ? void 0 : s.followedByMe,
475
+ handle: s == null ? void 0 : s.handle,
476
+ type: "primary",
477
+ onFollow: te,
478
+ onUnfollow: te
479
+ }
480
+ ),
481
+ /* @__PURE__ */ e.jsx(
482
+ Cs,
483
+ {
484
+ account: s,
485
+ isBlocked: T,
486
+ isDomainBlocked: I,
487
+ onBlockAccount: ee,
488
+ onBlockDomain: se,
489
+ onCopyHandle: le,
490
+ children: /* @__PURE__ */ e.jsx(u, { "aria-label": "Open profile menu", variant: "outline", children: /* @__PURE__ */ e.jsx(Je, {}) })
491
+ }
492
+ )
493
+ ] }),
494
+ A && !r && /* @__PURE__ */ e.jsxs(Xe, { open: we, onOpenChange: re, children: [
495
+ /* @__PURE__ */ e.jsx(Ze, { children: /* @__PURE__ */ e.jsx(bs, { children: /* @__PURE__ */ e.jsx(u, { variant: "secondary", children: "Edit profile" }) }) }),
496
+ /* @__PURE__ */ e.jsxs(es, { className: "w-full max-w-[520px]", onOpenAutoFocus: (b) => b.preventDefault(), children: [
497
+ /* @__PURE__ */ e.jsx(ss, { children: /* @__PURE__ */ e.jsx(ls, { children: "Profile settings" }) }),
498
+ s && /* @__PURE__ */ e.jsx(ms, { account: s, setIsEditingProfile: re })
499
+ ] })
500
+ ] })
501
+ ] }),
502
+ /* @__PURE__ */ e.jsx(rs, { className: "mt-4 truncate break-anywhere", children: r ? /* @__PURE__ */ e.jsx(E, { className: "w-32" }) : s == null ? void 0 : s.name }),
503
+ /* @__PURE__ */ e.jsxs("div", { className: "mb-4 flex items-center gap-2", children: [
504
+ /* @__PURE__ */ e.jsx("a", { className: "inline-flex max-w-full truncate text-[1.5rem] text-gray-800 hover:text-gray-900 dark:text-gray-600 dark:hover:text-gray-500", href: s == null ? void 0 : s.url, rel: "noopener noreferrer", target: "_blank", children: /* @__PURE__ */ e.jsx("span", { className: "truncate", children: r ? /* @__PURE__ */ e.jsx(E, { className: "w-full max-w-56" }) : s == null ? void 0 : s.handle }) }),
505
+ !r && /* @__PURE__ */ e.jsx(u, { className: "-ml-1.5 size-6 p-0 text-gray-800 hover:text-gray-900 dark:text-gray-700 dark:hover:text-gray-600", title: "Copy handle", variant: "link", onClick: le, children: R ? /* @__PURE__ */ e.jsx(ns, { size: 16 }) : /* @__PURE__ */ e.jsx(js, { size: 16 }) }),
506
+ (s == null ? void 0 : s.followsMe) && !r && /* @__PURE__ */ e.jsx(os, { className: "mt-px whitespace-nowrap", variant: "secondary", children: "Follows you" })
507
+ ] }),
508
+ ((s == null ? void 0 : s.bio) || (n == null ? void 0 : n.length) > 0) && /* @__PURE__ */ e.jsxs("div", { ref: V, className: `ap-profile-content relative text-[1.5rem] break-anywhere [&>p]:mb-3 ${$ ? "max-h-none pb-7" : "max-h-[160px] overflow-hidden"} relative`, children: [
509
+ r ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
510
+ /* @__PURE__ */ e.jsx(E, {}),
511
+ /* @__PURE__ */ e.jsx(E, { className: "w-full max-w-48" })
512
+ ] }) : /* @__PURE__ */ e.jsx("div", { dangerouslySetInnerHTML: { __html: as(ts((s == null ? void 0 : s.bio) ?? "", ["a", "br"])) } }),
513
+ n == null ? void 0 : n.map((b) => /* @__PURE__ */ e.jsxs("span", { className: "mt-3 line-clamp-1 flex flex-col text-[1.5rem]", children: [
514
+ /* @__PURE__ */ e.jsx("span", { className: "text-xs font-semibold", children: b.name }),
515
+ /* @__PURE__ */ e.jsx("span", { dangerouslySetInnerHTML: { __html: b.value }, className: "ap-profile-content truncate" })
516
+ ] })),
517
+ !$ && ne && /* @__PURE__ */ e.jsx("div", { className: "absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-white via-white/100 via-60% to-transparent dark:from-black dark:via-black/100" }),
518
+ ne && /* @__PURE__ */ e.jsx(
519
+ u,
520
+ {
521
+ className: "absolute bottom-0 h-auto p-0 text-md",
522
+ variant: "link",
523
+ onClick: ve,
524
+ children: $ ? "Show less" : "Show all"
525
+ }
526
+ )
527
+ ] }),
528
+ /* @__PURE__ */ e.jsxs(
529
+ fs,
530
+ {
531
+ className: "mt-5",
532
+ value: j,
533
+ variant: "underline",
534
+ onValueChange: (b) => Ce(b),
535
+ children: [
536
+ /* @__PURE__ */ e.jsxs(ps, { children: [
537
+ /* @__PURE__ */ e.jsx(H, { value: "posts", children: "Posts" }),
538
+ f && /* @__PURE__ */ e.jsxs(H, { value: "likes", children: [
539
+ "Likes",
540
+ /* @__PURE__ */ e.jsx(Y, { children: Q((s == null ? void 0 : s.likedCount) || 0) })
541
+ ] }),
542
+ /* @__PURE__ */ e.jsxs(H, { value: "following", children: [
543
+ "Following",
544
+ /* @__PURE__ */ e.jsx(Y, { children: Q((s == null ? void 0 : s.followingCount) || 0) })
545
+ ] }),
546
+ /* @__PURE__ */ e.jsxs(H, { value: "followers", children: [
547
+ "Followers",
548
+ /* @__PURE__ */ e.jsx(Y, { children: Q((s == null ? void 0 : s.followerCount) || 0) })
549
+ ] })
550
+ ] }),
551
+ /* @__PURE__ */ e.jsx(S, { value: "posts", children: (T || I) && !p ? /* @__PURE__ */ e.jsxs(z, { children: [
552
+ /* @__PURE__ */ e.jsx(_, { children: /* @__PURE__ */ e.jsx(is, {}) }),
553
+ /* @__PURE__ */ e.jsxs("div", { className: "mt-2 flex flex-col items-center gap-0.5", children: [
554
+ /* @__PURE__ */ e.jsxs(K, { children: [
555
+ s.name,
556
+ " is blocked"
557
+ ] }),
558
+ /* @__PURE__ */ e.jsx("p", { children: "You can view the posts, but it won't unblock the user." }),
559
+ /* @__PURE__ */ e.jsx(u, { className: "mt-4", variant: "secondary", onClick: () => U(!0), children: "View posts" })
560
+ ] })
561
+ ] }) : d }),
562
+ f && /* @__PURE__ */ e.jsx(S, { value: "likes", children: h }),
563
+ /* @__PURE__ */ e.jsx(S, { value: "following", children: c }),
564
+ /* @__PURE__ */ e.jsx(S, { value: "followers", children: t })
565
+ ]
566
+ },
567
+ a.handle || (s == null ? void 0 : s.handle) || "current-user"
568
+ )
569
+ ] })
570
+ ] }) }) }) });
571
+ }, Bs = ({ handle: s }) => {
572
+ const { postsByAccountQuery: n } = xs(s || "me", { enabled: !0 }), {
573
+ data: r,
574
+ fetchNextPage: d,
575
+ hasNextPage: h,
576
+ isFetchingNextPage: c,
577
+ isLoading: t
578
+ } = n, a = (r == null ? void 0 : r.pages.flatMap((o) => o.posts)) ?? Array.from({ length: 5 }, (o, i) => ({ id: `placeholder-${i}`, object: {} }));
579
+ return /* @__PURE__ */ e.jsx(
580
+ Ns,
581
+ {
582
+ fetchNextPage: d,
583
+ hasNextPage: h,
584
+ isFetchingNextPage: c,
585
+ isLoading: t,
586
+ noResultsMessage: s ? `${s} hasn't posted anything yet` : "You haven't posted anything yet.",
587
+ posts: a
588
+ }
589
+ );
590
+ }, Ds = () => {
591
+ const { postsLikedByAccountQuery: s } = hs({ enabled: !0 }), { data: n, fetchNextPage: r, hasNextPage: d, isFetchingNextPage: h, isLoading: c } = s, t = (n == null ? void 0 : n.pages.flatMap((a) => a.posts)) ?? Array.from({ length: 5 }, (a, o) => ({ id: `placeholder-${o}`, object: {} }));
592
+ return /* @__PURE__ */ e.jsx(
593
+ ys,
594
+ {
595
+ fetchNextPage: r,
596
+ hasNextPage: d,
597
+ isFetchingNextPage: h,
598
+ isLoading: c,
599
+ posts: t
600
+ }
601
+ );
602
+ }, Ps = ({ handle: s }) => {
603
+ const n = be(s === "" ? "me" : s, "following"), {
604
+ data: r,
605
+ fetchNextPage: d,
606
+ hasNextPage: h,
607
+ isFetchingNextPage: c,
608
+ isLoading: t
609
+ } = n, a = (r == null ? void 0 : r.pages.flatMap((o) => "following" in o ? o.following : "accounts" in o ? o.accounts.map((i) => ({
610
+ actor: {
611
+ id: i.id,
612
+ name: i.name,
613
+ handle: i.handle,
614
+ icon: {
615
+ url: i.avatarUrl
616
+ }
617
+ },
618
+ isFollowing: i.isFollowing,
619
+ blockedByMe: i.blockedByMe,
620
+ domainBlockedByMe: i.domainBlockedByMe
621
+ })) : [])) ?? [];
622
+ return /* @__PURE__ */ e.jsx(
623
+ ue,
624
+ {
625
+ actors: a,
626
+ fetchNextPage: d,
627
+ hasNextPage: h,
628
+ isFetchingNextPage: c,
629
+ isLoading: t,
630
+ noResultsMessage: `${s || "You"} have no following`
631
+ }
632
+ );
633
+ }, Ts = ({ handle: s }) => {
634
+ const n = be(s === "" ? "me" : s, "followers"), {
635
+ data: r,
636
+ fetchNextPage: d,
637
+ hasNextPage: h,
638
+ isFetchingNextPage: c,
639
+ isLoading: t
640
+ } = n, a = (r == null ? void 0 : r.pages.flatMap((o) => "followers" in o ? o.followers : "accounts" in o ? o.accounts.map((i) => ({
641
+ actor: {
642
+ id: i.id,
643
+ name: i.name,
644
+ handle: i.handle,
645
+ icon: {
646
+ url: i.avatarUrl
647
+ }
648
+ },
649
+ isFollowing: i.isFollowing
650
+ })) : [])) ?? [];
651
+ return /* @__PURE__ */ e.jsx(
652
+ ue,
653
+ {
654
+ actors: a,
655
+ fetchNextPage: d,
656
+ hasNextPage: h,
657
+ isFetchingNextPage: c,
658
+ isLoading: t,
659
+ noResultsMessage: `${s || "You"} have no followers yet`
660
+ }
661
+ );
662
+ }, Ls = ({}) => {
663
+ const s = pe(), { data: n, isLoading: r, error: d, refetch: h } = X("index", s.handle || "me");
664
+ if (C(() => {
665
+ h();
666
+ }, [s.handle, h]), d && ds(d) && d.statusCode !== 404)
667
+ return /* @__PURE__ */ e.jsx(cs, { errorCode: d.code, statusCode: d.statusCode });
668
+ const c = Object.keys((n == null ? void 0 : n.customFields) || {}).map((x) => ({
669
+ name: x,
670
+ value: n.customFields[x]
671
+ })) || [], t = /* @__PURE__ */ e.jsx(Bs, { handle: s.handle || "" }), a = /* @__PURE__ */ e.jsx(Ds, {}), o = /* @__PURE__ */ e.jsx(Ps, { handle: s.handle || "" }), i = /* @__PURE__ */ e.jsx(Ts, { handle: s.handle || "" });
672
+ return /* @__PURE__ */ e.jsx(
673
+ Ms,
674
+ {
675
+ account: n,
676
+ customFields: c,
677
+ followersTab: i,
678
+ followingTab: o,
679
+ isLoadingAccount: r,
680
+ likesTab: a,
681
+ postsTab: t
682
+ }
683
+ );
684
+ };
685
+ export {
686
+ Ls as default
687
+ };
688
+ //# sourceMappingURL=index-DnpX9U7J.mjs.map