@openrails/contentkit-ui 0.83.0 → 0.86.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 (219) hide show
  1. package/README.md +18 -7
  2. package/dist/client/beacons.d.ts +18 -6
  3. package/dist/client/beacons.js +26 -11
  4. package/dist/client/beacons.js.map +1 -1
  5. package/dist/client/client.d.ts +3 -0
  6. package/dist/client/client.js +29 -27
  7. package/dist/client/client.js.map +1 -1
  8. package/dist/client/codes.d.ts +6 -1
  9. package/dist/client/codes.js +4 -1
  10. package/dist/client/codes.js.map +1 -1
  11. package/dist/client/content/moderation.d.ts +14 -2
  12. package/dist/client/content/moderation.js +34 -0
  13. package/dist/client/content/moderation.js.map +1 -1
  14. package/dist/client/content/types.d.ts +13 -0
  15. package/dist/client/content/types.js.map +1 -1
  16. package/dist/client/discovery.d.ts +6 -0
  17. package/dist/client/discovery.js.map +1 -1
  18. package/dist/client/generated/error-codes.d.ts +1 -1
  19. package/dist/client/generated/error-codes.js +9 -1
  20. package/dist/client/generated/error-codes.js.map +1 -1
  21. package/dist/client/generated/routes.d.ts +91 -13
  22. package/dist/client/generated/routes.js +123 -2
  23. package/dist/client/generated/routes.js.map +1 -1
  24. package/dist/client/generated/wire.d.ts +81 -0
  25. package/dist/client/generated/wire.js.map +1 -1
  26. package/dist/client/index.d.ts +4 -2
  27. package/dist/client/media/queue.d.ts +4 -2
  28. package/dist/client/media/queue.js +18 -12
  29. package/dist/client/media/queue.js.map +1 -1
  30. package/dist/client/media/rules.d.ts +7 -1
  31. package/dist/client/media/rules.js +27 -21
  32. package/dist/client/media/rules.js.map +1 -1
  33. package/dist/client/reader-meta.d.ts +27 -0
  34. package/dist/client/reader-meta.js +99 -0
  35. package/dist/client/reader-meta.js.map +1 -0
  36. package/dist/client/stats.d.ts +32 -0
  37. package/dist/client/stats.js +35 -0
  38. package/dist/client/stats.js.map +1 -0
  39. package/dist/client/versions.d.ts +1 -1
  40. package/dist/client/versions.js +7 -2
  41. package/dist/client/versions.js.map +1 -1
  42. package/dist/client.js +30 -28
  43. package/dist/components/admin/content-manager.js +206 -206
  44. package/dist/components/admin/content-manager.js.map +1 -1
  45. package/dist/components/admin/group-manager.js +71 -70
  46. package/dist/components/admin/group-manager.js.map +1 -1
  47. package/dist/components/admin/media-item-panel.d.ts +24 -7
  48. package/dist/components/admin/media-item-panel.js +209 -197
  49. package/dist/components/admin/media-item-panel.js.map +1 -1
  50. package/dist/components/admin/poll-manager.js +25 -25
  51. package/dist/components/admin/reader-manifest.d.ts +18 -0
  52. package/dist/components/admin/reader-manifest.js +490 -0
  53. package/dist/components/admin/reader-manifest.js.map +1 -0
  54. package/dist/components/admin/stats-dashboard.d.ts +22 -0
  55. package/dist/components/admin/stats-dashboard.js +257 -0
  56. package/dist/components/admin/stats-dashboard.js.map +1 -0
  57. package/dist/components/content/card.js +43 -43
  58. package/dist/components/content/card.js.map +1 -1
  59. package/dist/components/content/editors.d.ts +2 -1
  60. package/dist/components/content/editors.js +479 -416
  61. package/dist/components/content/editors.js.map +1 -1
  62. package/dist/components/content/grid.js +47 -47
  63. package/dist/components/content/index.d.ts +2 -1
  64. package/dist/components/content/listing.js +34 -34
  65. package/dist/components/content/listing.js.map +1 -1
  66. package/dist/components/content/paywall.d.ts +17 -5
  67. package/dist/components/content/paywall.js +115 -100
  68. package/dist/components/content/paywall.js.map +1 -1
  69. package/dist/components/content/reader-stats.d.ts +12 -0
  70. package/dist/components/content/reader-stats.js +47 -0
  71. package/dist/components/content/reader-stats.js.map +1 -0
  72. package/dist/components/groups/banner.d.ts +1 -1
  73. package/dist/components/groups/banner.js +34 -34
  74. package/dist/components/groups/banner.js.map +1 -1
  75. package/dist/components/groups/directory.js +11 -11
  76. package/dist/components/groups/editor.js +294 -294
  77. package/dist/components/groups/editor.js.map +1 -1
  78. package/dist/components/groups/header.js +27 -27
  79. package/dist/components/groups/header.js.map +1 -1
  80. package/dist/components/groups/memberships.js +180 -180
  81. package/dist/components/groups/parts.d.ts +2 -4
  82. package/dist/components/groups/parts.js +69 -88
  83. package/dist/components/groups/parts.js.map +1 -1
  84. package/dist/components/media-folder-editor.js +239 -189
  85. package/dist/components/media-folder-editor.js.map +1 -1
  86. package/dist/components/notifications.js +17 -17
  87. package/dist/components/slot-upload.d.ts +2 -2
  88. package/dist/components/slot-upload.js +84 -79
  89. package/dist/components/slot-upload.js.map +1 -1
  90. package/dist/components/social/bans.js +34 -34
  91. package/dist/components/social/comments.js +59 -45
  92. package/dist/components/social/comments.js.map +1 -1
  93. package/dist/components/social/index.d.ts +1 -0
  94. package/dist/components/social/moderation.d.ts +5 -4
  95. package/dist/components/social/moderation.js +177 -160
  96. package/dist/components/social/moderation.js.map +1 -1
  97. package/dist/components/social/parts.js +22 -14
  98. package/dist/components/social/parts.js.map +1 -1
  99. package/dist/components/social/rules.d.ts +23 -0
  100. package/dist/components/social/rules.js +261 -0
  101. package/dist/components/social/rules.js.map +1 -0
  102. package/dist/components/video-player.d.ts +2 -0
  103. package/dist/components/video-player.js +318 -314
  104. package/dist/components/video-player.js.map +1 -1
  105. package/dist/i18n/context.d.ts +2 -0
  106. package/dist/i18n/context.js +23 -5
  107. package/dist/i18n/context.js.map +1 -1
  108. package/dist/index.d.ts +3 -1
  109. package/dist/index.js +28 -24
  110. package/dist/locales/admin/de.js +105 -0
  111. package/dist/locales/admin/de.js.map +1 -1
  112. package/dist/locales/admin/en.d.ts +105 -0
  113. package/dist/locales/admin/en.js +105 -0
  114. package/dist/locales/admin/en.js.map +1 -1
  115. package/dist/locales/admin/es.js +105 -0
  116. package/dist/locales/admin/es.js.map +1 -1
  117. package/dist/locales/admin/ja.js +105 -0
  118. package/dist/locales/admin/ja.js.map +1 -1
  119. package/dist/locales/admin/ko.js +105 -0
  120. package/dist/locales/admin/ko.js.map +1 -1
  121. package/dist/locales/admin/zh.js +105 -0
  122. package/dist/locales/admin/zh.js.map +1 -1
  123. package/dist/locales/content/de.js +6 -0
  124. package/dist/locales/content/de.js.map +1 -1
  125. package/dist/locales/content/en.d.ts +6 -0
  126. package/dist/locales/content/en.js +6 -0
  127. package/dist/locales/content/en.js.map +1 -1
  128. package/dist/locales/content/es.js +6 -0
  129. package/dist/locales/content/es.js.map +1 -1
  130. package/dist/locales/content/ja.js +6 -0
  131. package/dist/locales/content/ja.js.map +1 -1
  132. package/dist/locales/content/ko.js +6 -0
  133. package/dist/locales/content/ko.js.map +1 -1
  134. package/dist/locales/content/zh.js +6 -0
  135. package/dist/locales/content/zh.js.map +1 -1
  136. package/dist/locales/de.js +4 -1
  137. package/dist/locales/de.js.map +1 -1
  138. package/dist/locales/discovery/de.js +1 -0
  139. package/dist/locales/discovery/de.js.map +1 -1
  140. package/dist/locales/discovery/en.d.ts +1 -0
  141. package/dist/locales/discovery/en.js +1 -0
  142. package/dist/locales/discovery/en.js.map +1 -1
  143. package/dist/locales/discovery/es.js +1 -0
  144. package/dist/locales/discovery/es.js.map +1 -1
  145. package/dist/locales/discovery/ja.js +1 -0
  146. package/dist/locales/discovery/ja.js.map +1 -1
  147. package/dist/locales/discovery/ko.js +1 -0
  148. package/dist/locales/discovery/ko.js.map +1 -1
  149. package/dist/locales/discovery/zh.js +1 -0
  150. package/dist/locales/discovery/zh.js.map +1 -1
  151. package/dist/locales/en.d.ts +118 -0
  152. package/dist/locales/en.js +4 -1
  153. package/dist/locales/en.js.map +1 -1
  154. package/dist/locales/es.js +4 -1
  155. package/dist/locales/es.js.map +1 -1
  156. package/dist/locales/ja.js +4 -1
  157. package/dist/locales/ja.js.map +1 -1
  158. package/dist/locales/ko.js +4 -1
  159. package/dist/locales/ko.js.map +1 -1
  160. package/dist/locales/social/de.js +3 -0
  161. package/dist/locales/social/de.js.map +1 -1
  162. package/dist/locales/social/en.d.ts +3 -0
  163. package/dist/locales/social/en.js +3 -0
  164. package/dist/locales/social/en.js.map +1 -1
  165. package/dist/locales/social/es.js +3 -0
  166. package/dist/locales/social/es.js.map +1 -1
  167. package/dist/locales/social/ja.js +3 -0
  168. package/dist/locales/social/ja.js.map +1 -1
  169. package/dist/locales/social/ko.js +3 -0
  170. package/dist/locales/social/ko.js.map +1 -1
  171. package/dist/locales/social/zh.js +3 -0
  172. package/dist/locales/social/zh.js.map +1 -1
  173. package/dist/locales/zh.js +4 -1
  174. package/dist/locales/zh.js.map +1 -1
  175. package/dist/react/admin.d.ts +1 -1
  176. package/dist/react/admin.js +24 -23
  177. package/dist/react/admin.js.map +1 -1
  178. package/dist/react/canonical.d.ts +4 -3
  179. package/dist/react/canonical.js +34 -33
  180. package/dist/react/canonical.js.map +1 -1
  181. package/dist/react/comments.d.ts +29 -1
  182. package/dist/react/comments.js +30 -2
  183. package/dist/react/comments.js.map +1 -1
  184. package/dist/react/contents.js +144 -144
  185. package/dist/react/contents.js.map +1 -1
  186. package/dist/react/context.d.ts +1 -1
  187. package/dist/react/context.js.map +1 -1
  188. package/dist/react/detail.d.ts +12 -6
  189. package/dist/react/detail.js +31 -24
  190. package/dist/react/detail.js.map +1 -1
  191. package/dist/react/discovery.js +1 -1
  192. package/dist/react/discovery.js.map +1 -1
  193. package/dist/react/folder.d.ts +7 -2
  194. package/dist/react/folder.js +165 -147
  195. package/dist/react/folder.js.map +1 -1
  196. package/dist/react/groups.d.ts +0 -1
  197. package/dist/react/groups.js +13 -12
  198. package/dist/react/groups.js.map +1 -1
  199. package/dist/react/index.d.ts +5 -3
  200. package/dist/react/location.d.ts +11 -0
  201. package/dist/react/location.js +18 -0
  202. package/dist/react/location.js.map +1 -0
  203. package/dist/react/public.d.ts +8 -0
  204. package/dist/react/public.js +32 -27
  205. package/dist/react/public.js.map +1 -1
  206. package/dist/react/resources.js +6 -0
  207. package/dist/react/resources.js.map +1 -1
  208. package/dist/react/stats.d.ts +24 -0
  209. package/dist/react/stats.js +28 -0
  210. package/dist/react/stats.js.map +1 -0
  211. package/dist/react/use-resource.js +8 -7
  212. package/dist/react/use-resource.js.map +1 -1
  213. package/dist/react/versions.js +20 -20
  214. package/dist/react.js +26 -24
  215. package/dist/styles.css +1 -1
  216. package/dist/urls/index.d.ts +35 -10
  217. package/dist/urls.js +100 -70
  218. package/dist/urls.js.map +1 -1
  219. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { toContentKitError as e } from "../../client/errors.js";
2
2
  import { useMessages as t } from "../../i18n/context.js";
3
3
  import { useErrorReporter as n, useGuarded as r } from "../../react/context.js";
4
- import { Button as i } from "../../ui/button.js";
5
- import { keyOf as a, useContentScope as o, usePaged as s } from "../../react/use-resource.js";
4
+ import { keyOf as i, useContentScope as a, usePaged as o } from "../../react/use-resource.js";
5
+ import { Button as s } from "../../ui/button.js";
6
6
  import { useModerationQueue as c } from "../../react/comments.js";
7
7
  import { Badge as l } from "../../ui/badge.js";
8
8
  import { Input as u } from "../../ui/input.js";
@@ -11,74 +11,83 @@ import { Select as f, SelectContent as p, SelectItem as m, SelectTrigger as h, S
11
11
  import { Skeleton as _ } from "../../ui/skeleton.js";
12
12
  import { ErrorLine as v, RelativeTime as y, UserAvatar as b, UserName as x, contentError as S } from "./parts.js";
13
13
  import { AdminRoot as C, NoAccess as w, Pager as T, Rows as E, pageOf as D } from "../admin/shell.js";
14
- import { CommentBanDialog as ee, CommentBans as O } from "./bans.js";
15
- import { useAdminLocation as k, useFlowClient as A, useStaffAccess as j } from "../../react/admin.js";
16
- import { Tabs as M, TabsContent as N, TabsList as P, TabsTrigger as F } from "../../ui/tabs.js";
17
- import { useEffect as I, useId as L, useMemo as R, useState as z } from "react";
18
- import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
19
- import { cn as te } from "cn";
14
+ import { CommentBanDialog as O, CommentBans as k } from "./bans.js";
15
+ import { useAdminLocation as A, useFlowClient as j, useStaffAccess as M } from "../../react/admin.js";
16
+ import { Tabs as N, TabsContent as P, TabsList as F, TabsTrigger as I } from "../../ui/tabs.js";
17
+ import { BannedWords as L, IPBans as R } from "./rules.js";
18
+ import { useEffect as z, useId as ee, useMemo as te, useState as B } from "react";
19
+ import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
20
+ import { cn as W } from "cn";
20
21
  //#region src/components/social/moderation.tsx
21
- var U = [
22
+ var G = [
22
23
  "comments",
23
24
  "queue",
24
- "bans"
25
+ "bans",
26
+ "words",
27
+ "ips"
25
28
  ];
26
- function W(e = {}) {
27
- return j(U, e);
29
+ function K(e = {}) {
30
+ return M(G, e);
28
31
  }
29
- function G({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, sections: c = U, ...l }) {
30
- let u = A({
32
+ function q({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, sections: c = G, ...l }) {
33
+ let u = j({
31
34
  client: e,
32
35
  baseUrl: t,
33
36
  auth: n
34
37
  });
35
- return /* @__PURE__ */ V(C, {
38
+ return /* @__PURE__ */ H(C, {
36
39
  flow: "comment-moderation",
37
40
  appearance: i,
38
41
  className: a,
39
42
  language: o,
40
43
  messages: s,
41
44
  guard: r,
42
- children: /* @__PURE__ */ V(K, {
45
+ children: /* @__PURE__ */ H(J, {
43
46
  ...l,
44
47
  client: u,
45
48
  sections: c
46
49
  })
47
50
  });
48
51
  }
49
- function K({ sections: e, basePath: n, navigation: r, ...i }) {
50
- let { t: a } = t(), o = k(n, r), s = W({ client: i.client }), c = e.filter((e) => s.allowed[e]), l = {
52
+ function J({ sections: e, basePath: n, navigation: r, ...i }) {
53
+ let { t: a } = t(), o = A(n, r), s = K({ client: i.client }), c = e.filter((e) => s.allowed[e]), l = {
51
54
  comments: a("moderation.all"),
52
55
  queue: a("moderation.queue"),
53
- bans: a("moderation.bans")
54
- }, u = /* @__PURE__ */ V("h2", {
56
+ bans: a("moderation.bans"),
57
+ words: a("moderationRules.words"),
58
+ ips: a("moderationRules.ips")
59
+ }, u = /* @__PURE__ */ H("h2", {
55
60
  className: "text-base font-semibold",
56
61
  children: a("moderation.title")
57
62
  });
58
- if (s.loading) return /* @__PURE__ */ H(B, { children: [u, /* @__PURE__ */ V(E, {})] });
59
- if (!c.length) return /* @__PURE__ */ H(B, { children: [u, /* @__PURE__ */ V(w, { children: a("moderation.noAccess") })] });
63
+ if (s.loading) return /* @__PURE__ */ U(V, { children: [u, /* @__PURE__ */ H(E, {})] });
64
+ if (!c.length) return /* @__PURE__ */ U(V, { children: [u, /* @__PURE__ */ H(w, { children: a("moderation.noAccess") })] });
60
65
  let d = (t) => t === e[0] ? "" : t, f = o.view || e[0], p = c.includes(f) ? f : c[0], m = d(p);
61
- return /* @__PURE__ */ H(B, { children: [u, /* @__PURE__ */ H(M, {
66
+ return /* @__PURE__ */ U(V, { children: [u, /* @__PURE__ */ U(N, {
62
67
  value: p,
63
68
  onValueChange: (e) => o.go(d(e)),
64
- children: [c.length > 1 && /* @__PURE__ */ V(P, { children: c.map((e) => /* @__PURE__ */ V(F, {
65
- value: e,
66
- children: l[e]
67
- }, e)) }), /* @__PURE__ */ H(N, {
69
+ children: [c.length > 1 && /* @__PURE__ */ H(F, {
70
+ className: "flex-wrap group-data-horizontal/tabs:h-auto",
71
+ children: c.map((e) => /* @__PURE__ */ H(I, {
72
+ value: e,
73
+ className: "h-7.5",
74
+ children: l[e]
75
+ }, e))
76
+ }), /* @__PURE__ */ U(P, {
68
77
  value: p,
69
78
  className: "pt-3",
70
79
  children: [
71
- p === "comments" && /* @__PURE__ */ V(J, {
80
+ p === "comments" && /* @__PURE__ */ H(X, {
72
81
  ...i,
73
82
  loc: o,
74
83
  view: m
75
84
  }),
76
- p === "queue" && /* @__PURE__ */ V(Y, {
85
+ p === "queue" && /* @__PURE__ */ H(Z, {
77
86
  ...i,
78
87
  loc: o,
79
88
  view: m
80
89
  }),
81
- p === "bans" && /* @__PURE__ */ V(O, {
90
+ p === "bans" && /* @__PURE__ */ H(k, {
82
91
  scope: "global",
83
92
  pageSize: i.pageSize,
84
93
  page: D(o.query),
@@ -86,72 +95,80 @@ function K({ sections: e, basePath: n, navigation: r, ...i }) {
86
95
  userHref: i.userHref,
87
96
  client: i.client,
88
97
  onError: i.onError
98
+ }),
99
+ p === "words" && /* @__PURE__ */ H(L, {
100
+ client: i.client,
101
+ onError: i.onError
102
+ }),
103
+ p === "ips" && /* @__PURE__ */ H(R, {
104
+ client: i.client,
105
+ onError: i.onError
89
106
  })
90
107
  ]
91
108
  })]
92
109
  })] });
93
110
  }
94
- function q(e) {
111
+ function Y(e) {
95
112
  return e.deleted ? "deleted" : e.moderation === "held" ? "held" : e.moderation === "rejected" ? "rejected" : "published";
96
113
  }
97
- function J({ loc: c, view: _, client: S, ...C }) {
98
- let { t: w } = t(), E = L(), O = R(() => (C.contentKinds ?? []).map((e) => typeof e == "string" ? {
114
+ function X({ loc: c, view: _, client: S, ...C }) {
115
+ let { t: w } = t(), E = ee(), k = te(() => (C.contentKinds ?? []).map((e) => typeof e == "string" ? {
99
116
  value: e,
100
117
  label: e
101
- } : e), [C.contentKinds]), k = c.query.get("kind") ?? "", A = c.query.get("author") ?? "", j = D(c.query), M = C.pageSize ?? 25, N = (e) => c.go(_, {
102
- kind: k,
103
- author: A,
118
+ } : e), [C.contentKinds]), A = c.query.get("kind") ?? "", j = c.query.get("author") ?? "", M = D(c.query), N = C.pageSize ?? 25, P = (e) => c.go(_, {
119
+ kind: A,
120
+ author: j,
104
121
  ...e
105
- }), [P, F] = z(A);
106
- I(() => F(A), [A]);
107
- let { store: B, scope: U } = o(S), W = s(B, a("admin-comments-page", U, k, A, M), { type: "admin-comments" }, j, M, (e, t) => S.comments.adminList({
122
+ }), [F, I] = B(j);
123
+ z(() => I(j), [j]);
124
+ let { store: L, scope: R } = a(S), V = o(L, i("admin-comments-page", R, A, j, N), { type: "admin-comments" }, M, N, (e, t) => S.comments.adminList({
108
125
  ...e,
109
- contentKind: k || void 0,
110
- author: A || void 0
111
- }, t)), G = n(C.onError), K = r(), [J, Y] = z(null), [X, Q] = z(null), $ = (t, n) => {
112
- Y(null), K(n).catch((n) => {
126
+ contentKind: A || void 0,
127
+ author: j || void 0
128
+ }, t)), G = n(C.onError), K = r(), [q, J] = B(null), [X, Z] = B(null), Q = (t, n) => {
129
+ J(null), K(n).catch((n) => {
113
130
  let r = e(n);
114
- Y(r), G(r, t);
131
+ J(r), G(r, t);
115
132
  });
116
- }, ne = A ? W.items.find((e) => e.user_id === A)?.author?.username ?? A : "";
117
- return /* @__PURE__ */ H("div", {
133
+ }, ne = j ? V.items.find((e) => e.user_id === j)?.author?.username ?? j : "";
134
+ return /* @__PURE__ */ U("div", {
118
135
  className: "grid gap-3",
119
136
  children: [
120
- /* @__PURE__ */ H("div", {
137
+ /* @__PURE__ */ U("div", {
121
138
  className: "flex flex-wrap items-end gap-2",
122
- children: [O.length > 0 && /* @__PURE__ */ H(f, {
123
- value: k,
124
- onValueChange: (e) => N({ kind: String(e ?? "") }),
125
- children: [/* @__PURE__ */ V(h, {
139
+ children: [k.length > 0 && /* @__PURE__ */ U(f, {
140
+ value: A,
141
+ onValueChange: (e) => P({ kind: String(e ?? "") }),
142
+ children: [/* @__PURE__ */ H(h, {
126
143
  size: "sm",
127
144
  "aria-label": w("moderation.kind"),
128
- children: /* @__PURE__ */ V(g, { children: (e) => e ? O.find((t) => t.value === e)?.label ?? e : w("moderation.allKinds") })
129
- }), /* @__PURE__ */ H(p, { children: [/* @__PURE__ */ V(m, {
145
+ children: /* @__PURE__ */ H(g, { children: (e) => e ? k.find((t) => t.value === e)?.label ?? e : w("moderation.allKinds") })
146
+ }), /* @__PURE__ */ U(p, { children: [/* @__PURE__ */ H(m, {
130
147
  value: "",
131
148
  children: w("moderation.allKinds")
132
- }), O.map((e) => /* @__PURE__ */ V(m, {
149
+ }), k.map((e) => /* @__PURE__ */ H(m, {
133
150
  value: e.value,
134
151
  children: e.label
135
152
  }, e.value))] })]
136
- }), /* @__PURE__ */ H("form", {
153
+ }), /* @__PURE__ */ U("form", {
137
154
  className: "flex min-w-56 flex-1 items-end gap-2",
138
155
  onSubmit: (e) => {
139
- e.preventDefault(), N({ author: P.trim() });
156
+ e.preventDefault(), P({ author: F.trim() });
140
157
  },
141
- children: [/* @__PURE__ */ H("div", {
158
+ children: [/* @__PURE__ */ U("div", {
142
159
  className: "grid flex-1 gap-1",
143
- children: [/* @__PURE__ */ V(d, {
160
+ children: [/* @__PURE__ */ H(d, {
144
161
  htmlFor: `${E}-author`,
145
162
  className: "sr-only",
146
163
  children: w("moderation.author")
147
- }), /* @__PURE__ */ V(u, {
164
+ }), /* @__PURE__ */ H(u, {
148
165
  id: `${E}-author`,
149
166
  className: "h-8",
150
- value: P,
167
+ value: F,
151
168
  placeholder: w("moderation.authorPlaceholder"),
152
- onChange: (e) => F(e.target.value)
169
+ onChange: (e) => I(e.target.value)
153
170
  })]
154
- }), /* @__PURE__ */ V(i, {
171
+ }), /* @__PURE__ */ H(s, {
155
172
  type: "submit",
156
173
  size: "sm",
157
174
  variant: "outline",
@@ -159,64 +176,64 @@ function J({ loc: c, view: _, client: S, ...C }) {
159
176
  })]
160
177
  })]
161
178
  }),
162
- A && /* @__PURE__ */ H("div", {
179
+ j && /* @__PURE__ */ U("div", {
163
180
  className: "flex flex-wrap items-center gap-2",
164
181
  "data-ckui": "author-filter",
165
- children: [/* @__PURE__ */ V("span", { children: w("moderation.byAuthor", { name: ne }) }), /* @__PURE__ */ V(i, {
182
+ children: [/* @__PURE__ */ H("span", { children: w("moderation.byAuthor", { name: ne }) }), /* @__PURE__ */ H(s, {
166
183
  size: "sm",
167
184
  variant: "ghost",
168
- onClick: () => N({ author: "" }),
185
+ onClick: () => P({ author: "" }),
169
186
  children: w("moderation.clearAuthor")
170
187
  })]
171
188
  }),
172
- /* @__PURE__ */ V(v, { error: J }),
173
- /* @__PURE__ */ V(Z, {
174
- loading: W.loading,
175
- error: W.error,
189
+ /* @__PURE__ */ H(v, { error: q }),
190
+ /* @__PURE__ */ H($, {
191
+ loading: V.loading,
192
+ error: V.error,
176
193
  empty: w("moderation.empty"),
177
- count: W.items.length,
178
- reload: W.reload,
179
- children: W.items.map((e) => {
180
- let t = e.author?.username ?? e.anon_name ?? e.user_id ?? w("comments.anonymous"), n = q(e), r = C.itemHref?.({
194
+ count: V.items.length,
195
+ reload: V.reload,
196
+ children: V.items.map((e) => {
197
+ let t = e.author?.username ?? e.anon_name ?? e.user_id ?? w("comments.anonymous"), n = Y(e), r = C.itemHref?.({
181
198
  kind: e.content_kind,
182
199
  id: e.content_id
183
200
  });
184
- return /* @__PURE__ */ H("li", {
201
+ return /* @__PURE__ */ U("li", {
185
202
  className: "grid gap-2 p-3",
186
203
  "data-ckui": "admin-comment",
187
204
  "data-status": n,
188
205
  children: [
189
- /* @__PURE__ */ H("div", {
206
+ /* @__PURE__ */ U("div", {
190
207
  className: "flex flex-wrap items-center gap-x-2 gap-y-1",
191
208
  children: [
192
- /* @__PURE__ */ V(b, {
209
+ /* @__PURE__ */ H(b, {
193
210
  user: e.author,
194
211
  name: t,
195
212
  size: "sm"
196
213
  }),
197
- /* @__PURE__ */ V(x, {
214
+ /* @__PURE__ */ H(x, {
198
215
  user: e.author,
199
216
  name: t,
200
217
  href: C.userHref
201
218
  }),
202
- /* @__PURE__ */ V(y, {
219
+ /* @__PURE__ */ H(y, {
203
220
  at: e.created_at,
204
221
  className: "text-xs text-muted-foreground"
205
222
  }),
206
- /* @__PURE__ */ V(l, {
223
+ /* @__PURE__ */ H(l, {
207
224
  variant: n === "published" ? "outline" : n === "held" ? "secondary" : "destructive",
208
225
  children: w(`moderation.${n}`)
209
226
  }),
210
- e.reply_to_id && /* @__PURE__ */ V(l, {
227
+ e.reply_to_id && /* @__PURE__ */ H(l, {
211
228
  variant: "outline",
212
229
  children: w("moderation.reply")
213
230
  }),
214
- /* @__PURE__ */ H("span", {
231
+ /* @__PURE__ */ U("span", {
215
232
  className: "text-xs text-muted-foreground",
216
233
  children: [
217
234
  w("moderation.on"),
218
235
  " ",
219
- r ? /* @__PURE__ */ H("a", {
236
+ r ? /* @__PURE__ */ U("a", {
220
237
  className: "hover:underline",
221
238
  href: r,
222
239
  children: [
@@ -229,38 +246,38 @@ function J({ loc: c, view: _, client: S, ...C }) {
229
246
  })
230
247
  ]
231
248
  }),
232
- /* @__PURE__ */ V("p", {
233
- className: te("line-clamp-4 break-words whitespace-pre-wrap", e.deleted && "text-muted-foreground line-through"),
249
+ /* @__PURE__ */ H("p", {
250
+ className: W("line-clamp-4 break-words whitespace-pre-wrap", e.deleted && "text-muted-foreground line-through"),
234
251
  children: e.body
235
252
  }),
236
- e.moderation_reason && /* @__PURE__ */ V("p", {
253
+ e.moderation_reason && /* @__PURE__ */ H("p", {
237
254
  className: "text-xs text-muted-foreground",
238
255
  children: w("moderation.heldBecause", { reason: e.moderation_reason })
239
256
  }),
240
- /* @__PURE__ */ H("div", {
257
+ /* @__PURE__ */ U("div", {
241
258
  className: "flex flex-wrap gap-2",
242
259
  children: [
243
- e.deleted ? /* @__PURE__ */ V(i, {
260
+ e.deleted ? /* @__PURE__ */ H(s, {
244
261
  size: "sm",
245
262
  variant: "outline",
246
- onClick: () => $("comment.restore", () => S.comments.restore(e.id)),
263
+ onClick: () => Q("comment.restore", () => S.comments.restore(e.id)),
247
264
  children: w("moderation.restore")
248
- }) : /* @__PURE__ */ V(i, {
265
+ }) : /* @__PURE__ */ H(s, {
249
266
  size: "sm",
250
267
  variant: "destructive",
251
- onClick: () => $("comment.delete", () => S.comments.delete(e.id)),
268
+ onClick: () => Q("comment.delete", () => S.comments.delete(e.id)),
252
269
  children: w("moderation.delete")
253
270
  }),
254
- e.user_id && e.user_id !== A && /* @__PURE__ */ V(i, {
271
+ e.user_id && e.user_id !== j && /* @__PURE__ */ H(s, {
255
272
  size: "sm",
256
273
  variant: "ghost",
257
- onClick: () => N({ author: e.user_id }),
274
+ onClick: () => P({ author: e.user_id }),
258
275
  children: w("moderation.theirComments")
259
276
  }),
260
- e.user_id && /* @__PURE__ */ V(i, {
277
+ e.user_id && /* @__PURE__ */ H(s, {
261
278
  size: "sm",
262
279
  variant: "ghost",
263
- onClick: () => Q({
280
+ onClick: () => Z({
264
281
  id: e.user_id,
265
282
  name: t
266
283
  }),
@@ -272,19 +289,19 @@ function J({ loc: c, view: _, client: S, ...C }) {
272
289
  }, e.id);
273
290
  })
274
291
  }),
275
- /* @__PURE__ */ V(T, {
276
- page: j,
277
- hasNext: W.hasNext,
278
- disabled: W.loading,
292
+ /* @__PURE__ */ H(T, {
293
+ page: M,
294
+ hasNext: V.hasNext,
295
+ disabled: V.loading,
279
296
  onPage: (e) => c.go(_, {
280
- kind: k,
281
- author: A,
297
+ kind: A,
298
+ author: j,
282
299
  page: e > 1 ? e : void 0
283
300
  })
284
301
  }),
285
- X && /* @__PURE__ */ V(ee, {
302
+ X && /* @__PURE__ */ H(O, {
286
303
  open: !0,
287
- onOpenChange: (e) => !e && Q(null),
304
+ onOpenChange: (e) => !e && Z(null),
288
305
  user: X,
289
306
  scopes: ["global"],
290
307
  client: S,
@@ -293,93 +310,93 @@ function J({ loc: c, view: _, client: S, ...C }) {
293
310
  ]
294
311
  });
295
312
  }
296
- function Y({ loc: e, view: n, ...r }) {
297
- let { t: a } = t(), o = e.query.get("kind") === "content" ? "content" : "comment", s = c({
298
- kind: o,
313
+ function Z({ loc: e, view: n, ...r }) {
314
+ let { t: i } = t(), a = e.query.get("kind") === "content" ? "content" : "comment", o = c({
315
+ kind: a,
299
316
  pageSize: r.pageSize,
300
317
  client: r.client
301
318
  });
302
- return /* @__PURE__ */ H("div", {
319
+ return /* @__PURE__ */ U("div", {
303
320
  className: "grid gap-3",
304
321
  children: [
305
- /* @__PURE__ */ V("div", {
322
+ /* @__PURE__ */ H("div", {
306
323
  className: "flex gap-2",
307
324
  role: "group",
308
- "aria-label": a("moderation.queue"),
309
- children: ["comment", "content"].map((t) => /* @__PURE__ */ V(i, {
325
+ "aria-label": i("moderation.queue"),
326
+ children: ["comment", "content"].map((t) => /* @__PURE__ */ H(s, {
310
327
  size: "sm",
311
- variant: o === t ? "default" : "outline",
312
- "aria-pressed": o === t,
328
+ variant: a === t ? "default" : "outline",
329
+ "aria-pressed": a === t,
313
330
  onClick: () => e.go(n, { kind: t === "comment" ? void 0 : t }),
314
- children: a(t === "content" ? "moderation.queueContent" : "moderation.queueComments")
331
+ children: i(t === "content" ? "moderation.queueContent" : "moderation.queueComments")
315
332
  }, t))
316
333
  }),
317
- /* @__PURE__ */ V(Z, {
318
- loading: s.loading,
319
- error: s.error,
320
- empty: a("moderation.queueEmpty"),
321
- count: s.items.length,
322
- reload: s.reload,
323
- children: s.items.map((e) => /* @__PURE__ */ V(X, {
334
+ /* @__PURE__ */ H($, {
335
+ loading: o.loading,
336
+ error: o.error,
337
+ empty: i("moderation.queueEmpty"),
338
+ count: o.items.length,
339
+ reload: o.reload,
340
+ children: o.items.map((e) => /* @__PURE__ */ H(Q, {
324
341
  item: e,
325
342
  itemHref: r.itemHref,
326
343
  userHref: r.userHref,
327
- onResolve: s.resolve,
328
- reload: s.reload,
344
+ onResolve: o.resolve,
345
+ reload: o.reload,
329
346
  onError: r.onError
330
347
  }, e.id))
331
348
  }),
332
- s.hasMore && /* @__PURE__ */ V(i, {
349
+ o.hasMore && /* @__PURE__ */ H(s, {
333
350
  variant: "outline",
334
351
  className: "justify-self-center",
335
- disabled: s.loadingMore,
336
- onClick: () => void s.loadMore(),
337
- children: a("moderation.loadMore")
352
+ disabled: o.loadingMore,
353
+ onClick: () => void o.loadMore(),
354
+ children: i("moderation.loadMore")
338
355
  })
339
356
  ]
340
357
  });
341
358
  }
342
- function X(a) {
343
- let o = t(), { t: s } = o, c = n(a.onError), l = r(), { item: d } = a, [f, p] = z(!1), [m, h] = z(""), [g, _] = z(!1), [C, w] = z(null), T = d.author?.username ?? d.anon_name ?? d.author_id ?? s("comments.anonymous"), E = a.itemHref?.({
359
+ function Q(i) {
360
+ let a = t(), { t: o } = a, c = n(i.onError), l = r(), { item: d } = i, [f, p] = B(!1), [m, h] = B(""), [g, _] = B(!1), [C, w] = B(null), T = d.author?.username ?? d.anon_name ?? d.author_id ?? o("comments.anonymous"), E = i.itemHref?.({
344
361
  kind: d.ref.content_kind,
345
362
  id: d.ref.content_id
346
363
  }), D = async (t) => {
347
364
  _(!0), w(null);
348
365
  try {
349
- await l(() => a.onResolve(d, t, t === "reject" && m.trim() || void 0));
366
+ await l(() => i.onResolve(d, t, t === "reject" && m.trim() || void 0));
350
367
  } catch (t) {
351
368
  let n = e(t);
352
- c(n, "moderation.resolve"), n.code === "not_found" || n.code === "conflict" ? (w(s("moderation.stale")), a.reload()) : w(S(o, n));
369
+ c(n, "moderation.resolve"), n.code === "not_found" || n.code === "conflict" ? (w(o("moderation.stale")), i.reload()) : w(S(a, n));
353
370
  } finally {
354
371
  _(!1);
355
372
  }
356
373
  };
357
- return /* @__PURE__ */ H("li", {
374
+ return /* @__PURE__ */ U("li", {
358
375
  className: "grid gap-2 p-3",
359
376
  "data-ckui": "held-item",
360
377
  children: [
361
- /* @__PURE__ */ H("div", {
378
+ /* @__PURE__ */ U("div", {
362
379
  className: "flex flex-wrap items-center gap-x-2 gap-y-1",
363
380
  children: [
364
- /* @__PURE__ */ V(b, {
381
+ /* @__PURE__ */ H(b, {
365
382
  user: d.author,
366
383
  name: T,
367
384
  size: "sm"
368
385
  }),
369
- /* @__PURE__ */ V(x, {
386
+ /* @__PURE__ */ H(x, {
370
387
  user: d.author,
371
388
  name: T,
372
- href: a.userHref
389
+ href: i.userHref
373
390
  }),
374
- /* @__PURE__ */ V(y, {
391
+ /* @__PURE__ */ H(y, {
375
392
  at: d.held_at,
376
393
  className: "text-xs text-muted-foreground"
377
394
  }),
378
- E && /* @__PURE__ */ H("a", {
395
+ E && /* @__PURE__ */ U("a", {
379
396
  className: "text-xs text-muted-foreground hover:underline",
380
397
  href: E,
381
398
  children: [
382
- s("moderation.on"),
399
+ o("moderation.on"),
383
400
  " ",
384
401
  d.ref.content_kind,
385
402
  "/",
@@ -388,77 +405,77 @@ function X(a) {
388
405
  })
389
406
  ]
390
407
  }),
391
- d.title && /* @__PURE__ */ V("p", {
408
+ d.title && /* @__PURE__ */ H("p", {
392
409
  className: "font-medium",
393
410
  children: d.title
394
411
  }),
395
- /* @__PURE__ */ V("p", {
412
+ /* @__PURE__ */ H("p", {
396
413
  className: "line-clamp-6 break-words whitespace-pre-wrap",
397
414
  children: d.body
398
415
  }),
399
- (d.reason || d.error) && /* @__PURE__ */ V("p", {
416
+ (d.reason || d.error) && /* @__PURE__ */ H("p", {
400
417
  className: "text-xs text-muted-foreground",
401
- children: s("moderation.heldBecause", { reason: d.reason || d.error || "" })
418
+ children: o("moderation.heldBecause", { reason: d.reason || d.error || "" })
402
419
  }),
403
- f && /* @__PURE__ */ V(u, {
420
+ f && /* @__PURE__ */ H(u, {
404
421
  value: m,
405
422
  maxLength: 500,
406
- placeholder: s("moderation.rejectReason"),
407
- "aria-label": s("moderation.rejectReason"),
423
+ placeholder: o("moderation.rejectReason"),
424
+ "aria-label": o("moderation.rejectReason"),
408
425
  onChange: (e) => h(e.target.value),
409
426
  autoFocus: !0
410
427
  }),
411
- /* @__PURE__ */ H("div", {
428
+ /* @__PURE__ */ U("div", {
412
429
  className: "flex flex-wrap gap-2",
413
430
  children: [
414
- /* @__PURE__ */ V(i, {
431
+ /* @__PURE__ */ H(s, {
415
432
  size: "sm",
416
433
  disabled: g,
417
434
  onClick: () => void D("approve"),
418
- children: s("moderation.approve")
435
+ children: o("moderation.approve")
419
436
  }),
420
- /* @__PURE__ */ V(i, {
437
+ /* @__PURE__ */ H(s, {
421
438
  size: "sm",
422
439
  variant: "destructive",
423
440
  disabled: g,
424
441
  onClick: () => f ? void D("reject") : p(!0),
425
- children: s("moderation.reject")
442
+ children: o("moderation.reject")
426
443
  }),
427
- f && /* @__PURE__ */ V(i, {
444
+ f && /* @__PURE__ */ H(s, {
428
445
  size: "sm",
429
446
  variant: "ghost",
430
447
  onClick: () => p(!1),
431
- children: s("common.cancel")
448
+ children: o("common.cancel")
432
449
  })
433
450
  ]
434
451
  }),
435
- C && /* @__PURE__ */ V(v, { children: C })
452
+ C && /* @__PURE__ */ H(v, { children: C })
436
453
  ]
437
454
  });
438
455
  }
439
- function Z(e) {
456
+ function $(e) {
440
457
  let n = t(), { t: r } = n;
441
- return e.loading && !e.count ? /* @__PURE__ */ H("div", {
458
+ return e.loading && !e.count ? /* @__PURE__ */ U("div", {
442
459
  className: "grid gap-3",
443
460
  "aria-busy": !0,
444
- children: [/* @__PURE__ */ V(_, { className: "h-16 w-full" }), /* @__PURE__ */ V(_, { className: "h-16 w-full" })]
445
- }) : e.error && !e.count ? /* @__PURE__ */ H("div", {
461
+ children: [/* @__PURE__ */ H(_, { className: "h-16 w-full" }), /* @__PURE__ */ H(_, { className: "h-16 w-full" })]
462
+ }) : e.error && !e.count ? /* @__PURE__ */ U("div", {
446
463
  className: "grid justify-items-start gap-2",
447
- children: [/* @__PURE__ */ V(v, { children: e.error.code === "forbidden" || e.error.code === "unauthorized" ? S(n, e.error) : r("moderation.loadFailed") }), /* @__PURE__ */ V(i, {
464
+ children: [/* @__PURE__ */ H(v, { children: e.error.code === "forbidden" || e.error.code === "unauthorized" ? S(n, e.error) : r("moderation.loadFailed") }), /* @__PURE__ */ H(s, {
448
465
  size: "sm",
449
466
  variant: "outline",
450
467
  onClick: e.reload,
451
468
  children: r("common.retry")
452
469
  })]
453
- }) : e.count ? /* @__PURE__ */ V("ul", {
470
+ }) : e.count ? /* @__PURE__ */ H("ul", {
454
471
  className: "grid divide-y divide-border rounded-lg border border-border",
455
472
  children: e.children
456
- }) : /* @__PURE__ */ V("p", {
473
+ }) : /* @__PURE__ */ H("p", {
457
474
  className: "text-muted-foreground",
458
475
  children: e.empty
459
476
  });
460
477
  }
461
478
  //#endregion
462
- export { G as CommentModeration, W as useCommentModerationAccess };
479
+ export { q as CommentModeration, K as useCommentModerationAccess };
463
480
 
464
481
  //# sourceMappingURL=moderation.js.map