@openrails/contentkit-ui 0.104.0-rc.3 → 0.105.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.
@@ -18,84 +18,84 @@ import { imageRefs as _e } from "../../client/contents.js";
18
18
  import { useAdminLocation as y, useFlowClient as b, useStaffAccess as x } from "../../react/admin.js";
19
19
  import { labelOf as S } from "../groups/parts.js";
20
20
  import { useContent as ve } from "../../react/contents.js";
21
- import { ContentSections as C } from "../content/editors.js";
22
- import { createDraft as w, uploadTarget as T } from "./bulk-drafts.js";
21
+ import { ContentSections as C, allowsIndividualSales as w } from "../content/editors.js";
22
+ import { createDraft as T, uploadTarget as ye } from "./bulk-drafts.js";
23
23
  import { ReaderContentEditor as E } from "./reader-content-editor.js";
24
- import { UploadQueueBody as D } from "./upload-queue.js";
25
- import { useEffect as O, useId as ye, useMemo as k, useRef as A, useState as j } from "react";
26
- import { Fragment as be, jsx as M, jsxs as N } from "react/jsx-runtime";
27
- import { Image01Icon as P } from "@hugeicons/core-free-icons";
28
- import { HugeiconsIcon as F } from "@hugeicons/react";
24
+ import { UploadQueueBody as be } from "./upload-queue.js";
25
+ import { useEffect as D, useId as xe, useMemo as O, useRef as k, useState as A } from "react";
26
+ import { Fragment as Se, jsx as j, jsxs as M } from "react/jsx-runtime";
27
+ import { Image01Icon as N } from "@hugeicons/core-free-icons";
28
+ import { HugeiconsIcon as P } from "@hugeicons/react";
29
29
  //#region src/components/admin/content-manager.tsx
30
- function I(e = {}) {
30
+ function F(e = {}) {
31
31
  return x(["contents"], e);
32
32
  }
33
- function xe(e) {
33
+ function Ce(e) {
34
34
  return e.moderation === "rejected" ? "rejected" : e.moderation === "held" ? "held" : e.state === "draft" ? "draft" : e.live ? "published" : "scheduled";
35
35
  }
36
- var Se = (e) => (e ?? []).map((e) => typeof e == "string" ? {
36
+ var we = (e) => (e ?? []).map((e) => typeof e == "string" ? {
37
37
  value: e,
38
38
  label: e
39
- } : e), Ce = {
39
+ } : e), Te = {
40
40
  published: "default",
41
41
  scheduled: "secondary",
42
42
  draft: "outline",
43
43
  held: "secondary",
44
44
  rejected: "destructive"
45
- }, L = [
45
+ }, I = [
46
46
  "draft",
47
47
  "scheduled",
48
48
  "published"
49
49
  ];
50
- function R({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, ...c }) {
50
+ function L({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, ...c }) {
51
51
  let l = b({
52
52
  client: e,
53
53
  baseUrl: t,
54
54
  auth: n
55
55
  });
56
- return /* @__PURE__ */ M(g, {
56
+ return /* @__PURE__ */ j(g, {
57
57
  flow: "content-manager",
58
58
  appearance: i,
59
59
  className: a,
60
60
  language: o,
61
61
  messages: s,
62
62
  guard: r,
63
- children: /* @__PURE__ */ M(z, {
63
+ children: /* @__PURE__ */ j(R, {
64
64
  ...c,
65
65
  client: l
66
66
  })
67
67
  });
68
68
  }
69
- function z({ basePath: e, navigation: n, ...r }) {
70
- let { t: i } = t(), a = y(e, n), o = I({ client: r.client }), s = A(/* @__PURE__ */ new Map()).current, c = (e, t = !1) => {
69
+ function R({ basePath: e, navigation: n, ...r }) {
70
+ let { t: i } = t(), a = y(e, n), o = F({ client: r.client }), s = k(/* @__PURE__ */ new Map()).current, c = (e, t = !1) => {
71
71
  s.set(e.code, e.id), a.go(e.code, void 0, t ? { replace: !0 } : void 0);
72
- }, l = B(r.client, r.kind, a.view && a.view !== "new" ? a.view : null, s), u = H(r.client, a.view === "new" ? a.query.get("with") ?? "" : "");
73
- return o.loading ? /* @__PURE__ */ M(v, {}) : o.allowed.contents ? a.view ? a.view !== "new" && !l.id ? l.error ? /* @__PURE__ */ M(fe, {
72
+ }, l = z(r.client, r.kind, a.view && a.view !== "new" ? a.view : null, s), u = V(r.client, a.view === "new" ? a.query.get("with") ?? "" : "");
73
+ return o.loading ? /* @__PURE__ */ j(v, {}) : o.allowed.contents ? a.view ? a.view !== "new" && !l.id ? l.error ? /* @__PURE__ */ j(fe, {
74
74
  error: l.error,
75
75
  message: i("contentManager.loadFailed"),
76
76
  retry: l.retry
77
- }) : l.missing ? /* @__PURE__ */ M(_, { children: i("contentManager.notFound") }) : /* @__PURE__ */ M(v, {}) : /* @__PURE__ */ N(be, { children: [/* @__PURE__ */ M(d, {
77
+ }) : l.missing ? /* @__PURE__ */ j(_, { children: i("contentManager.notFound") }) : /* @__PURE__ */ j(v, {}) : /* @__PURE__ */ M(Se, { children: [/* @__PURE__ */ j(d, {
78
78
  variant: "ghost",
79
79
  size: "sm",
80
80
  className: "justify-self-start",
81
81
  onClick: () => a.go(""),
82
82
  children: i("contentManager.back")
83
- }), /* @__PURE__ */ M(Y, {
83
+ }), /* @__PURE__ */ j(J, {
84
84
  management: !0,
85
85
  ...r,
86
86
  id: a.view === "new" ? null : l.id,
87
87
  entities: u,
88
88
  onCreated: (e) => c(e, !0),
89
89
  onDeleted: () => a.go("", void 0, { replace: !0 })
90
- })] }) : /* @__PURE__ */ M(K, {
90
+ })] }) : /* @__PURE__ */ j(K, {
91
91
  ...r,
92
92
  loc: a,
93
93
  open: c
94
- }) : /* @__PURE__ */ M(_, { children: i("contentManager.noAccess") });
94
+ }) : /* @__PURE__ */ j(_, { children: i("contentManager.noAccess") });
95
95
  }
96
- function B(t, n, r, i) {
97
- let [a, o] = j(null), [s, c] = j(0), l = r ? i.get(r) : void 0;
98
- O(() => {
96
+ function z(t, n, r, i) {
97
+ let [a, o] = A(null), [s, c] = A(0), l = r ? i.get(r) : void 0;
98
+ D(() => {
99
99
  if (!r || l) return;
100
100
  let a = new AbortController();
101
101
  return t.contents.manage({
@@ -140,17 +140,17 @@ function B(t, n, r, i) {
140
140
  retry: u
141
141
  };
142
142
  }
143
- var V = (e) => ({
143
+ var B = (e) => ({
144
144
  ...e,
145
145
  count: 0
146
146
  });
147
- function H(e, t) {
148
- let [n, r] = j(null);
149
- return O(() => {
147
+ function V(e, t) {
148
+ let [n, r] = A(null);
149
+ return D(() => {
150
150
  if (!t) return;
151
151
  let n = new AbortController(), i = async (t) => {
152
152
  let r = await e.codes.resolve(t, { signal: n.signal }), i = await e.entities.getForManagement(r.content_id, void 0, n.signal);
153
- return i.scope ? [V(i), i.scope] : [V(i)];
153
+ return i.scope ? [B(i), i.scope] : [B(i)];
154
154
  };
155
155
  return Promise.all(t.split(",").filter(Boolean).map((e) => i(e).catch(() => []))).then((e) => {
156
156
  n.signal.aborted || r({
@@ -160,12 +160,12 @@ function H(e, t) {
160
160
  }), () => n.abort();
161
161
  }, [e, t]), t && n?.codes === t ? n.entities : void 0;
162
162
  }
163
- var we = [
163
+ var H = [
164
164
  20,
165
165
  50,
166
166
  100
167
167
  ], U = 4;
168
- function W(e, t, n) {
168
+ function Ee(e, t, n) {
169
169
  switch (t.level) {
170
170
  case "public": return e("contentManager.free");
171
171
  case "tier": return (t.tiers ?? []).map((e) => S(n, e)).join(", ") || e("contentManager.premium");
@@ -174,7 +174,7 @@ function W(e, t, n) {
174
174
  case "group_ppv": return e("contentManager.membersPpv");
175
175
  }
176
176
  }
177
- var Te = (e) => e ? e.startsWith("tier:") ? {
177
+ var W = (e) => e ? e.startsWith("tier:") ? {
178
178
  access: "tier",
179
179
  tier: e.slice(5)
180
180
  } : { access: e } : {};
@@ -192,26 +192,26 @@ async function G(e, t) {
192
192
  })), n;
193
193
  }
194
194
  function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le, labels: g, pageSize: _ = 20, selectable: ge = !0, onError: _e }) {
195
- let y = t(), { t: b } = y, x = ye(), ve = Se(oe)[0]?.value, C = n.query.get("q") ?? "", E = L.find((e) => e === n.query.get("status")) ?? "", k = n.query.get("access") ?? "", P = n.query.get("deleted") === "1", F = me(n.query), I = Number(n.query.get("size")), R = we.find((e) => e === I) ?? _, z = {
195
+ let y = t(), { t: b } = y, x = xe(), ve = we(oe)[0]?.value, C = n.query.get("q") ?? "", E = I.find((e) => e === n.query.get("status")) ?? "", O = n.query.get("access") ?? "", N = n.query.get("deleted") === "1", P = me(n.query), F = Number(n.query.get("size")), L = H.find((e) => e === F) ?? _, R = {
196
196
  q: C,
197
197
  status: E,
198
- access: k || void 0,
199
- deleted: P ? "1" : void 0,
200
- size: R === _ ? void 0 : R
201
- }, B = (e) => n.go("", {
202
- ...z,
198
+ access: O || void 0,
199
+ deleted: N ? "1" : void 0,
200
+ size: L === _ ? void 0 : L
201
+ }, z = (e) => n.go("", {
202
+ ...R,
203
203
  ...e
204
- }), V = !!(C || E || k), [H, U] = j(C);
205
- O(() => U(C), [C]), O(() => {
206
- if (H.trim() === C) return;
207
- let e = setTimeout(() => B({ q: H.trim() }), 300);
204
+ }), B = !!(C || E || O), [V, U] = A(C);
205
+ D(() => U(C), [C]), D(() => {
206
+ if (V.trim() === C) return;
207
+ let e = setTimeout(() => z({ q: V.trim() }), 300);
208
208
  return () => clearTimeout(e);
209
- }, [H]);
210
- let { kinds: K } = c({ client: u }), J = K?.tiers ?? [], Y = K?.kinds[h]?.presentation, De = Y === "reader" || Y === "player", [Oe, ke] = j(!1), Ae = A(/* @__PURE__ */ new Map()).current, je = r(_e), Me = async (e) => {
211
- let { content: t, ref: n } = await w(u, h, ve ?? K?.languages[0] ?? "en", e, b("readerEditor.untitled"));
212
- return Ae.set(t.id, t), n;
213
- }, Ne = (e) => {
214
- let t = Ae.get(e.id);
209
+ }, [V]);
210
+ let { kinds: K } = c({ client: u }), q = K?.tiers ?? [], J = K?.kinds[h]?.presentation, ke = J === "reader" || J === "player", [Ae, je] = A(!1), Me = k(/* @__PURE__ */ new Map()).current, Ne = r(_e), Pe = async (e) => {
211
+ let { content: t, ref: n } = await T(u, h, ve ?? K?.languages[0] ?? "en", e, b("readerEditor.untitled"));
212
+ return Me.set(t.id, t), n;
213
+ }, Fe = (e) => {
214
+ let t = Me.get(e.id);
215
215
  if (t) return l(t);
216
216
  u.contents.manage({
217
217
  kind: h,
@@ -219,60 +219,60 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
219
219
  limit: 1
220
220
  }).then(([e]) => {
221
221
  e && l(e);
222
- }, (e) => je(e, "upload"));
223
- }, { store: Pe, scope: Fe } = a(u), Ie = P ? "deleted" : E || void 0, Le = {
222
+ }, (e) => Ne(e, "upload"));
223
+ }, { store: Ie, scope: Le } = a(u), Re = N ? "deleted" : E || void 0, ze = {
224
224
  type: "contents",
225
- scope: P ? "deleted" : void 0
226
- }, Re = {
225
+ scope: N ? "deleted" : void 0
226
+ }, Be = {
227
227
  q: C || void 0,
228
- state: Ie,
229
- ...Te(k)
230
- }, X = o(Pe, i("contents-page", Fe, h, C, Ie, k, ve, R), Le, F, R, (e, t) => u.contents.manage({
228
+ state: Re,
229
+ ...W(O)
230
+ }, Y = o(Ie, i("contents-page", Le, h, C, Re, O, ve, L), ze, P, L, (e, t) => u.contents.manage({
231
231
  ...e,
232
- ...Re,
232
+ ...Be,
233
233
  kind: h,
234
234
  language: ve
235
- }, t)), ze = s(Pe, i("contents-count", Fe, h, C, Ie, k), Le, (e) => u.contents.manageCount({
236
- ...Re,
235
+ }, t)), Ve = s(Ie, i("contents-count", Le, h, C, Re, O), ze, (e) => u.contents.manageCount({
236
+ ...Be,
237
237
  kind: h
238
- }, e)), Z = X.items, Be = ze.data?.total, Ve = X.loading, He = de("content.save", _e), { confirm: Ue, dialog: We } = he(), [Ge, Ke] = j(/* @__PURE__ */ new Set());
239
- O(() => Ke(/* @__PURE__ */ new Set()), [
238
+ }, e)), X = Y.items, He = Ve.data?.total, Ue = Y.loading, Z = de("content.save", _e), { confirm: We, dialog: Ge } = he(), [Ke, qe] = A(/* @__PURE__ */ new Set());
239
+ D(() => qe(/* @__PURE__ */ new Set()), [
240
240
  h,
241
241
  C,
242
- Ie,
243
- k,
244
- F,
245
- R
242
+ Re,
243
+ O,
244
+ P,
245
+ L
246
246
  ]);
247
- let [qe, Je] = j(/* @__PURE__ */ new Set()), [Ye, Xe] = j({}), [Q, Ze] = j({ pending: !1 }), Qe = J[0], $e = (e) => !!Qe && (e.access.level === "public" || e.access.level === "tier"), et = (e, t) => t ? {
247
+ let [Je, Ye] = A(/* @__PURE__ */ new Set()), [Xe, Ze] = A({}), [Q, Qe] = A({ pending: !1 }), $e = q[0], et = (e) => !!$e && (e.access.level === "public" || e.access.level === "tier"), tt = (e, t) => t ? {
248
248
  level: "tier",
249
- tiers: [Qe]
250
- } : { level: "public" }, tt = async (t, n) => {
251
- Je((e) => new Set(e).add(t.id)), Xe(({ [t.id]: e, ...n }) => n);
249
+ tiers: [$e]
250
+ } : { level: "public" }, nt = async (t, n) => {
251
+ Ye((e) => new Set(e).add(t.id)), Ze(({ [t.id]: e, ...n }) => n);
252
252
  try {
253
- await u.contents.update(t.id, { access: et(t, n) });
253
+ await u.contents.update(t.id, { access: tt(t, n) });
254
254
  } catch (n) {
255
255
  let r = e(n);
256
- Xe((e) => ({
256
+ Ze((e) => ({
257
257
  ...e,
258
258
  [t.id]: r
259
259
  }));
260
260
  } finally {
261
- Je((e) => {
261
+ Ye((e) => {
262
262
  let n = new Set(e);
263
263
  return n.delete(t.id), n;
264
264
  });
265
265
  }
266
- }, nt = async (e) => {
267
- await Ue({
266
+ }, rt = async (e) => {
267
+ await We({
268
268
  title: b("contentManager.deleteTitle", { title: e.title }),
269
269
  description: b("contentManager.deleteBody"),
270
270
  confirm: b("contentManager.delete")
271
- }) && await He.run(() => u.contents.remove(e.id));
272
- }, $ = Z.filter((e) => Ge.has(e.id)), rt = async (e, t) => {
273
- Ze({ pending: !0 });
271
+ }) && await Z.run(() => u.contents.remove(e.id));
272
+ }, $ = X.filter((e) => Ke.has(e.id)), it = async (e, t) => {
273
+ Qe({ pending: !0 });
274
274
  let n = await G(e, t), r = e.length - n;
275
- Ke(/* @__PURE__ */ new Set()), Ze({
275
+ qe(/* @__PURE__ */ new Set()), Qe({
276
276
  pending: !1,
277
277
  summary: n ? b("contentManager.bulkPartial", {
278
278
  done: r,
@@ -280,68 +280,68 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
280
280
  failed: n
281
281
  }) : y.plural("contentManager.bulkDone", r)
282
282
  });
283
- }, it = async () => {
284
- await Ue({
283
+ }, at = async () => {
284
+ await We({
285
285
  title: y.plural("contentManager.bulkDeleteTitle", $.length),
286
286
  description: b("contentManager.bulkDeleteBody"),
287
287
  confirm: b("contentManager.delete")
288
- }) && await rt($, (e) => u.contents.remove(e.id));
289
- }, at = Z.length > 0 && $.length === Z.length;
290
- return /* @__PURE__ */ N("div", {
288
+ }) && await it($, (e) => u.contents.remove(e.id));
289
+ }, ot = X.length > 0 && $.length === X.length;
290
+ return /* @__PURE__ */ M("div", {
291
291
  className: "grid gap-4",
292
292
  children: [
293
- /* @__PURE__ */ N("div", {
293
+ /* @__PURE__ */ M("div", {
294
294
  className: "flex flex-wrap items-center justify-between gap-2",
295
- children: [/* @__PURE__ */ M("h2", {
295
+ children: [/* @__PURE__ */ j("h2", {
296
296
  className: "text-base font-semibold",
297
297
  children: b("contentManager.title")
298
- }), /* @__PURE__ */ N("div", {
298
+ }), /* @__PURE__ */ M("div", {
299
299
  className: "flex gap-2",
300
- children: [De && !P && /* @__PURE__ */ M(d, {
300
+ children: [ke && !N && /* @__PURE__ */ j(d, {
301
301
  size: "sm",
302
302
  variant: "outline",
303
- "aria-expanded": Oe,
304
- onClick: () => ke((e) => !e),
303
+ "aria-expanded": Ae,
304
+ onClick: () => je((e) => !e),
305
305
  children: b("contentManager.bulkUpload")
306
- }), /* @__PURE__ */ M(d, {
306
+ }), /* @__PURE__ */ j(d, {
307
307
  size: "sm",
308
308
  onClick: () => n.go("new"),
309
309
  children: b("contentManager.new")
310
310
  })]
311
311
  })]
312
312
  }),
313
- De && Oe && !P && /* @__PURE__ */ N("section", {
313
+ ke && Ae && !N && /* @__PURE__ */ M("section", {
314
314
  className: "grid gap-3 rounded-lg border border-border p-3",
315
315
  "aria-label": b("contentManager.bulkUpload"),
316
316
  "data-ckui": "bulk-upload",
317
- children: [/* @__PURE__ */ M("p", {
317
+ children: [/* @__PURE__ */ j("p", {
318
318
  className: "text-sm text-muted-foreground",
319
- children: b(Y === "reader" ? "contentManager.bulkHintArchive" : "contentManager.bulkHintFile")
320
- }), /* @__PURE__ */ M(D, {
319
+ children: b(J === "reader" ? "contentManager.bulkHintArchive" : "contentManager.bulkHintFile")
320
+ }), /* @__PURE__ */ j(be, {
321
321
  client: u,
322
- createItem: Me,
323
- target: (e, t, n) => T(u, e, t, n),
324
- accept: Y === "reader" ? ".zip,application/zip" : "video/*",
322
+ createItem: Pe,
323
+ target: (e, t, n) => ye(u, e, t, n),
324
+ accept: J === "reader" ? ".zip,application/zip" : "video/*",
325
325
  concurrency: 2,
326
326
  storageKey: `ckui.bulk.${h}`,
327
- onOpen: Ne,
327
+ onOpen: Fe,
328
328
  onError: _e
329
329
  })]
330
330
  }),
331
- /* @__PURE__ */ N("div", {
331
+ /* @__PURE__ */ M("div", {
332
332
  className: "flex gap-2",
333
333
  role: "group",
334
334
  "aria-label": b("contentManager.title"),
335
- children: [/* @__PURE__ */ M(d, {
335
+ children: [/* @__PURE__ */ j(d, {
336
336
  size: "sm",
337
- variant: P ? "outline" : "default",
338
- "aria-pressed": !P,
337
+ variant: N ? "outline" : "default",
338
+ "aria-pressed": !N,
339
339
  onClick: () => n.go("", { q: C }),
340
340
  children: b("contentManager.items")
341
- }), /* @__PURE__ */ M(d, {
341
+ }), /* @__PURE__ */ j(d, {
342
342
  size: "sm",
343
- variant: P ? "default" : "outline",
344
- "aria-pressed": P,
343
+ variant: N ? "default" : "outline",
344
+ "aria-pressed": N,
345
345
  onClick: () => n.go("", {
346
346
  q: C,
347
347
  deleted: "1"
@@ -349,68 +349,68 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
349
349
  children: b("contentManager.deleted")
350
350
  })]
351
351
  }),
352
- /* @__PURE__ */ N("div", {
352
+ /* @__PURE__ */ M("div", {
353
353
  className: "flex flex-wrap items-center gap-2",
354
354
  children: [
355
- /* @__PURE__ */ N("form", {
355
+ /* @__PURE__ */ M("form", {
356
356
  className: "min-w-48 flex-1",
357
357
  role: "search",
358
358
  onSubmit: (e) => {
359
- e.preventDefault(), B({ q: H.trim() });
359
+ e.preventDefault(), z({ q: V.trim() });
360
360
  },
361
- children: [/* @__PURE__ */ M(p, {
361
+ children: [/* @__PURE__ */ j(p, {
362
362
  htmlFor: `${x}-q`,
363
363
  className: "sr-only",
364
364
  children: b("contentManager.search")
365
- }), /* @__PURE__ */ M(f, {
365
+ }), /* @__PURE__ */ j(f, {
366
366
  id: `${x}-q`,
367
367
  className: "h-8",
368
368
  type: "search",
369
- value: H,
369
+ value: V,
370
370
  placeholder: b("contentManager.search"),
371
371
  onChange: (e) => U(e.target.value)
372
372
  })]
373
373
  }),
374
- !P && /* @__PURE__ */ N(ne, {
374
+ !N && /* @__PURE__ */ M(ne, {
375
375
  value: E,
376
- onValueChange: (e) => B({ status: String(e ?? "") }),
377
- children: [/* @__PURE__ */ M(ie, {
376
+ onValueChange: (e) => z({ status: String(e ?? "") }),
377
+ children: [/* @__PURE__ */ j(ie, {
378
378
  size: "sm",
379
379
  "aria-label": b("contentManager.status"),
380
- children: /* @__PURE__ */ M(ae, { children: (e) => b(e ? `contentManager.${e}` : "contentManager.allStatuses") })
381
- }), /* @__PURE__ */ N(re, { children: [/* @__PURE__ */ M(m, {
380
+ children: /* @__PURE__ */ j(ae, { children: (e) => b(e ? `contentManager.${e}` : "contentManager.allStatuses") })
381
+ }), /* @__PURE__ */ M(re, { children: [/* @__PURE__ */ j(m, {
382
382
  value: "",
383
383
  children: b("contentManager.allStatuses")
384
- }), L.map((e) => /* @__PURE__ */ M(m, {
384
+ }), I.map((e) => /* @__PURE__ */ j(m, {
385
385
  value: e,
386
386
  children: b(`contentManager.${e}`)
387
387
  }, e))] })]
388
388
  }),
389
- /* @__PURE__ */ N(ne, {
390
- value: k,
391
- onValueChange: (e) => B({ access: String(e ?? "") || void 0 }),
392
- children: [/* @__PURE__ */ M(ie, {
389
+ /* @__PURE__ */ M(ne, {
390
+ value: O,
391
+ onValueChange: (e) => z({ access: String(e ?? "") || void 0 }),
392
+ children: [/* @__PURE__ */ j(ie, {
393
393
  size: "sm",
394
394
  "aria-label": b("contentManager.access"),
395
- children: /* @__PURE__ */ M(ae, { children: (e) => e ? e.startsWith("tier:") ? S(g, e.slice(5)) : W(b, { level: e }, g) : b("contentManager.anyAccess") })
396
- }), /* @__PURE__ */ N(re, { children: [
397
- /* @__PURE__ */ M(m, {
395
+ children: /* @__PURE__ */ j(ae, { children: (e) => e ? e.startsWith("tier:") ? S(g, e.slice(5)) : Ee(b, { level: e }, g) : b("contentManager.anyAccess") })
396
+ }), /* @__PURE__ */ M(re, { children: [
397
+ /* @__PURE__ */ j(m, {
398
398
  value: "",
399
399
  children: b("contentManager.anyAccess")
400
400
  }),
401
- /* @__PURE__ */ M(m, {
401
+ /* @__PURE__ */ j(m, {
402
402
  value: "public",
403
403
  children: b("contentManager.free")
404
404
  }),
405
- J.length > 0 && /* @__PURE__ */ M(m, {
405
+ q.length > 0 && /* @__PURE__ */ j(m, {
406
406
  value: "tier",
407
407
  children: b("contentManager.premium")
408
408
  }),
409
- J.length > 1 && J.map((e) => /* @__PURE__ */ M(m, {
409
+ q.length > 1 && q.map((e) => /* @__PURE__ */ j(m, {
410
410
  value: `tier:${e}`,
411
411
  children: S(g, e)
412
412
  }, e)),
413
- /* @__PURE__ */ M(m, {
413
+ w(K, h) && /* @__PURE__ */ j(m, {
414
414
  value: "ppv",
415
415
  children: b("contentManager.ppv")
416
416
  })
@@ -418,150 +418,150 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
418
418
  })
419
419
  ]
420
420
  }),
421
- /* @__PURE__ */ M(se, { error: He.error }),
422
- Q.summary && /* @__PURE__ */ M("p", {
421
+ /* @__PURE__ */ j(se, { error: Z.error }),
422
+ Q.summary && /* @__PURE__ */ j("p", {
423
423
  role: "status",
424
424
  className: "text-sm text-muted-foreground",
425
425
  children: Q.summary
426
426
  }),
427
- ge && $.length > 0 && /* @__PURE__ */ N("div", {
427
+ ge && $.length > 0 && /* @__PURE__ */ M("div", {
428
428
  className: "flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/40 p-2 text-sm",
429
429
  "data-ckui": "bulk-bar",
430
430
  children: [
431
- /* @__PURE__ */ M("span", {
431
+ /* @__PURE__ */ j("span", {
432
432
  className: "font-medium",
433
433
  children: b("contentManager.selected", { count: $.length })
434
434
  }),
435
- P ? /* @__PURE__ */ M(d, {
435
+ N ? /* @__PURE__ */ j(d, {
436
436
  size: "sm",
437
437
  variant: "outline",
438
438
  disabled: Q.pending,
439
- onClick: () => void rt($, (e) => u.contents.restore(e.id)),
439
+ onClick: () => void it($, (e) => u.contents.restore(e.id)),
440
440
  children: b("moderation.restore")
441
- }) : /* @__PURE__ */ N(be, { children: [
442
- Qe && /* @__PURE__ */ M(d, {
441
+ }) : /* @__PURE__ */ M(Se, { children: [
442
+ $e && /* @__PURE__ */ j(d, {
443
443
  size: "sm",
444
444
  variant: "outline",
445
445
  disabled: Q.pending,
446
- onClick: () => void rt($.filter($e), (e) => u.contents.update(e.id, { access: et(e, !0) })),
446
+ onClick: () => void it($.filter(et), (e) => u.contents.update(e.id, { access: tt(e, !0) })),
447
447
  children: b("contentManager.makePremium")
448
448
  }),
449
- Qe && /* @__PURE__ */ M(d, {
449
+ $e && /* @__PURE__ */ j(d, {
450
450
  size: "sm",
451
451
  variant: "outline",
452
452
  disabled: Q.pending,
453
- onClick: () => void rt($.filter($e), (e) => u.contents.update(e.id, { access: et(e, !1) })),
453
+ onClick: () => void it($.filter(et), (e) => u.contents.update(e.id, { access: tt(e, !1) })),
454
454
  children: b("contentManager.makeFree")
455
455
  }),
456
- /* @__PURE__ */ M(d, {
456
+ /* @__PURE__ */ j(d, {
457
457
  size: "sm",
458
458
  variant: "destructive",
459
459
  disabled: Q.pending,
460
- onClick: () => void it(),
460
+ onClick: () => void at(),
461
461
  children: b("contentManager.delete")
462
462
  })
463
463
  ] }),
464
- /* @__PURE__ */ M(d, {
464
+ /* @__PURE__ */ j(d, {
465
465
  size: "sm",
466
466
  variant: "ghost",
467
467
  disabled: Q.pending,
468
- onClick: () => Ke(/* @__PURE__ */ new Set()),
468
+ onClick: () => qe(/* @__PURE__ */ new Set()),
469
469
  children: b("contentManager.clearSelection")
470
470
  })
471
471
  ]
472
472
  }),
473
- Ve && !Z.length ? /* @__PURE__ */ M(v, {}) : X.error && !Z.length ? /* @__PURE__ */ M(fe, {
474
- error: X.error,
473
+ Ue && !X.length ? /* @__PURE__ */ j(v, {}) : Y.error && !X.length ? /* @__PURE__ */ j(fe, {
474
+ error: Y.error,
475
475
  message: b("contentManager.loadFailed"),
476
- retry: X.reload
477
- }) : Z.length ? /* @__PURE__ */ N("ul", {
476
+ retry: Y.reload
477
+ }) : X.length ? /* @__PURE__ */ M("ul", {
478
478
  className: "grid divide-y divide-border rounded-lg border border-border",
479
- "aria-busy": Ve,
480
- children: [ge && /* @__PURE__ */ N("li", {
479
+ "aria-busy": Ue,
480
+ children: [ge && /* @__PURE__ */ M("li", {
481
481
  className: "flex items-center gap-3 px-3 py-2 text-xs text-muted-foreground",
482
- children: [/* @__PURE__ */ M("input", {
482
+ children: [/* @__PURE__ */ j("input", {
483
483
  type: "checkbox",
484
484
  className: "size-4 shrink-0 accent-primary",
485
- checked: at,
485
+ checked: ot,
486
486
  "aria-label": b("contentManager.selectPage"),
487
- onChange: (e) => Ke(e.target.checked ? new Set(Z.map((e) => e.id)) : /* @__PURE__ */ new Set())
488
- }), /* @__PURE__ */ M("span", { children: b("contentManager.selectPage") })]
489
- }), Z.map((e) => {
490
- let t = xe(e), n = t === "published" ? le?.(e) : void 0, r = qe.has(e.id), i = e.access.level === "tier";
491
- return /* @__PURE__ */ N("li", {
487
+ onChange: (e) => qe(e.target.checked ? new Set(X.map((e) => e.id)) : /* @__PURE__ */ new Set())
488
+ }), /* @__PURE__ */ j("span", { children: b("contentManager.selectPage") })]
489
+ }), X.map((e) => {
490
+ let t = Ce(e), n = t === "published" ? le?.(e) : void 0, r = Je.has(e.id), i = e.access.level === "tier";
491
+ return /* @__PURE__ */ M("li", {
492
492
  className: "flex flex-wrap items-start gap-3 p-3",
493
493
  "data-ckui": "content-row",
494
- "data-status": P ? "deleted" : t,
494
+ "data-status": N ? "deleted" : t,
495
495
  children: [
496
- ge && /* @__PURE__ */ M("input", {
496
+ ge && /* @__PURE__ */ j("input", {
497
497
  type: "checkbox",
498
498
  className: "mt-1 size-4 shrink-0 accent-primary",
499
- checked: Ge.has(e.id),
499
+ checked: Ke.has(e.id),
500
500
  "aria-label": b("contentManager.select", { title: e.title }),
501
- onChange: (t) => Ke((n) => {
501
+ onChange: (t) => qe((n) => {
502
502
  let r = new Set(n);
503
503
  return t.target.checked ? r.add(e.id) : r.delete(e.id), r;
504
504
  })
505
505
  }),
506
- /* @__PURE__ */ M(q, { url: e.cover?.url }),
507
- /* @__PURE__ */ N("div", {
506
+ /* @__PURE__ */ j(De, { url: e.cover?.url }),
507
+ /* @__PURE__ */ M("div", {
508
508
  className: "grid min-w-0 flex-1 gap-1",
509
509
  children: [
510
- P ? /* @__PURE__ */ M("span", {
510
+ N ? /* @__PURE__ */ j("span", {
511
511
  className: "font-medium break-words line-through",
512
512
  children: e.title
513
- }) : /* @__PURE__ */ M("button", {
513
+ }) : /* @__PURE__ */ j("button", {
514
514
  type: "button",
515
515
  className: "text-left font-medium break-words hover:underline",
516
516
  onClick: () => l(e),
517
517
  children: e.title
518
518
  }),
519
- /* @__PURE__ */ N("div", {
519
+ /* @__PURE__ */ M("div", {
520
520
  className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground",
521
521
  children: [
522
- !P && /* @__PURE__ */ M(te, {
523
- variant: Ce[t],
522
+ !N && /* @__PURE__ */ j(te, {
523
+ variant: Te[t],
524
524
  children: b(`contentManager.${t}`)
525
525
  }),
526
- /* @__PURE__ */ M(te, {
526
+ /* @__PURE__ */ j(te, {
527
527
  variant: i ? "secondary" : "outline",
528
528
  "data-ckui": "access-badge",
529
- children: W(b, e.access, g)
529
+ children: Ee(b, e.access, g)
530
530
  }),
531
- /* @__PURE__ */ M("span", {
531
+ /* @__PURE__ */ j("span", {
532
532
  className: "font-mono",
533
533
  children: e.code
534
534
  }),
535
- /* @__PURE__ */ M("span", { children: e.language }),
536
- e.published_at && t === "published" ? /* @__PURE__ */ M("time", {
535
+ /* @__PURE__ */ j("span", { children: e.language }),
536
+ e.published_at && t === "published" ? /* @__PURE__ */ j("time", {
537
537
  dateTime: e.published_at,
538
538
  title: ue(y, e.published_at),
539
539
  children: b("contentManager.liveOn", { date: ue(y, e.published_at, !1) })
540
- }) : /* @__PURE__ */ M(ce, { at: P && e.deleted_at ? e.deleted_at : e.updated_at }),
541
- t === "scheduled" && e.publish_at && /* @__PURE__ */ M("span", { children: b("pollManager.goesLive", { date: ue(y, e.publish_at) }) })
540
+ }) : /* @__PURE__ */ j(ce, { at: N && e.deleted_at ? e.deleted_at : e.updated_at }),
541
+ t === "scheduled" && e.publish_at && /* @__PURE__ */ j("span", { children: b("pollManager.goesLive", { date: ue(y, e.publish_at) }) })
542
542
  ]
543
543
  }),
544
- /* @__PURE__ */ M(se, { error: Ye[e.id] ?? null })
544
+ /* @__PURE__ */ j(se, { error: Xe[e.id] ?? null })
545
545
  ]
546
546
  }),
547
- /* @__PURE__ */ M("div", {
547
+ /* @__PURE__ */ j("div", {
548
548
  className: "flex flex-wrap items-center gap-2",
549
- children: P ? /* @__PURE__ */ M(d, {
549
+ children: N ? /* @__PURE__ */ j(d, {
550
550
  size: "sm",
551
551
  variant: "outline",
552
- disabled: He.pending,
553
- onClick: () => void He.run(() => u.contents.restore(e.id)),
552
+ disabled: Z.pending,
553
+ onClick: () => void Z.run(() => u.contents.restore(e.id)),
554
554
  children: b("moderation.restore")
555
- }) : /* @__PURE__ */ N(be, { children: [
556
- $e(e) && /* @__PURE__ */ N(d, {
555
+ }) : /* @__PURE__ */ M(Se, { children: [
556
+ et(e) && /* @__PURE__ */ M(d, {
557
557
  size: "sm",
558
558
  variant: "outline",
559
559
  disabled: r,
560
560
  "aria-busy": r,
561
- onClick: () => void tt(e, !i),
562
- children: [r && /* @__PURE__ */ M(Ee, {}), b(i ? "contentManager.makeFree" : "contentManager.makePremium")]
561
+ onClick: () => void nt(e, !i),
562
+ children: [r && /* @__PURE__ */ j(Oe, {}), b(i ? "contentManager.makeFree" : "contentManager.makePremium")]
563
563
  }),
564
- n && /* @__PURE__ */ M("a", {
564
+ n && /* @__PURE__ */ j("a", {
565
565
  className: ee({
566
566
  size: "sm",
567
567
  variant: "ghost"
@@ -569,17 +569,17 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
569
569
  href: n,
570
570
  children: b("contentManager.view")
571
571
  }),
572
- /* @__PURE__ */ M(d, {
572
+ /* @__PURE__ */ j(d, {
573
573
  size: "sm",
574
574
  variant: "outline",
575
575
  onClick: () => l(e),
576
576
  children: b("comments.edit")
577
577
  }),
578
- /* @__PURE__ */ M(d, {
578
+ /* @__PURE__ */ j(d, {
579
579
  size: "sm",
580
580
  variant: "destructive",
581
- disabled: He.pending,
582
- onClick: () => void nt(e),
581
+ disabled: Z.pending,
582
+ onClick: () => void rt(e),
583
583
  children: b("comments.delete")
584
584
  })
585
585
  ] })
@@ -587,74 +587,74 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
587
587
  ]
588
588
  }, e.id);
589
589
  })]
590
- }) : /* @__PURE__ */ N("div", {
590
+ }) : /* @__PURE__ */ M("div", {
591
591
  className: "grid justify-items-start gap-2",
592
- children: [/* @__PURE__ */ M("p", {
592
+ children: [/* @__PURE__ */ j("p", {
593
593
  className: "text-muted-foreground",
594
- children: b(V ? "contentManager.noMatches" : P ? "contentManager.noDeleted" : "contentManager.emptyAll")
595
- }), V ? /* @__PURE__ */ M(d, {
594
+ children: b(B ? "contentManager.noMatches" : N ? "contentManager.noDeleted" : "contentManager.emptyAll")
595
+ }), B ? /* @__PURE__ */ j(d, {
596
596
  size: "sm",
597
597
  variant: "outline",
598
- onClick: () => n.go("", { deleted: P ? "1" : void 0 }),
598
+ onClick: () => n.go("", { deleted: N ? "1" : void 0 }),
599
599
  children: b("contentManager.clearFilters")
600
- }) : !P && /* @__PURE__ */ M(d, {
600
+ }) : !N && /* @__PURE__ */ j(d, {
601
601
  size: "sm",
602
602
  onClick: () => n.go("new"),
603
603
  children: b("contentManager.new")
604
604
  })]
605
605
  }),
606
- /* @__PURE__ */ M(pe, {
607
- page: F,
608
- hasNext: X.hasNext,
609
- disabled: Ve,
610
- total: Be,
611
- truncated: ze.data?.truncated,
612
- pageSize: R,
613
- pageSizes: we,
606
+ /* @__PURE__ */ j(pe, {
607
+ page: P,
608
+ hasNext: Y.hasNext,
609
+ disabled: Ue,
610
+ total: He,
611
+ truncated: Ve.data?.truncated,
612
+ pageSize: L,
613
+ pageSizes: H,
614
614
  onPageSize: (e) => n.go("", {
615
- ...z,
615
+ ...R,
616
616
  size: e === _ ? void 0 : e,
617
617
  page: void 0
618
618
  }),
619
619
  onPage: (e) => n.go("", {
620
- ...z,
620
+ ...R,
621
621
  page: e > 1 ? e : void 0
622
622
  })
623
623
  }),
624
- We
624
+ Ge
625
625
  ]
626
626
  });
627
627
  }
628
- function q({ url: e }) {
629
- return e ? /* @__PURE__ */ M("img", {
628
+ function De({ url: e }) {
629
+ return e ? /* @__PURE__ */ j("img", {
630
630
  src: e,
631
631
  alt: "",
632
632
  loading: "lazy",
633
633
  className: "aspect-[7/10] w-12 shrink-0 rounded-sm bg-muted object-cover"
634
- }) : /* @__PURE__ */ M("span", {
634
+ }) : /* @__PURE__ */ j("span", {
635
635
  "aria-hidden": !0,
636
636
  className: "grid aspect-[7/10] w-12 shrink-0 place-items-center rounded-sm bg-muted text-muted-foreground",
637
- children: /* @__PURE__ */ M(F, {
638
- icon: P,
637
+ children: /* @__PURE__ */ j(P, {
638
+ icon: N,
639
639
  strokeWidth: 1.5,
640
640
  className: "size-5"
641
641
  })
642
642
  });
643
643
  }
644
- function Ee() {
645
- return /* @__PURE__ */ M("span", {
644
+ function Oe() {
645
+ return /* @__PURE__ */ j("span", {
646
646
  "aria-hidden": !0,
647
647
  className: "size-3 animate-spin rounded-full border-2 border-current border-t-transparent"
648
648
  });
649
649
  }
650
- var J = {
650
+ var q = {
651
651
  title: "",
652
652
  description: "",
653
653
  publishAt: "",
654
654
  body: ""
655
655
  };
656
- function Y(e) {
657
- let { client: n, scope: r } = a(e.client), i = A(null), [o, s] = j({
656
+ function J(e) {
657
+ let { client: n, scope: r } = a(e.client), i = k(null), [o, s] = A({
658
658
  id: e.id,
659
659
  kind: e.kind,
660
660
  client: n,
@@ -672,11 +672,11 @@ function Y(e) {
672
672
  }, s(l);
673
673
  }
674
674
  let { kinds: u, error: d, reload: ee } = c({ client: n }), { t: te } = t();
675
- if (!u) return d ? /* @__PURE__ */ M(fe, {
675
+ if (!u) return d ? /* @__PURE__ */ j(fe, {
676
676
  error: d,
677
677
  message: te("contentManager.loadFailed"),
678
678
  retry: ee
679
- }) : /* @__PURE__ */ M(v, {});
679
+ }) : /* @__PURE__ */ j(v, {});
680
680
  let f = {
681
681
  ...e,
682
682
  client: n,
@@ -687,273 +687,273 @@ function Y(e) {
687
687
  }, e.onCreated?.(t);
688
688
  }
689
689
  };
690
- return u.kinds[e.kind]?.presentation === "reader" ? /* @__PURE__ */ M(E, {
690
+ return u.kinds[e.kind]?.presentation === "reader" ? /* @__PURE__ */ j(E, {
691
691
  ...f,
692
692
  model: u
693
- }, l.key) : /* @__PURE__ */ M(De, { ...f }, l.key);
693
+ }, l.key) : /* @__PURE__ */ j(ke, { ...f }, l.key);
694
694
  }
695
- function De({ id: i, client: a, kind: o, languages: s, renderEditor: ee, contentHref: ce, labels: ue, ownerGroup: de, entities: g, onCreated: _, onDeleted: pe, onError: v, management: me }) {
696
- let y = n(a), b = t(), { t: x } = b, S = ye(), w = Se(s), [T, E] = j(w[0]?.value ?? "en"), D = ve(i, o, T, { client: y }), A = c({ client: y }).kinds, P = !!A?.kinds[o]?.versions.hidden, F = r(v), [I, L] = j(i ? null : J), [R, z] = j(null), [B, V] = j(null), { confirm: H, dialog: we } = he(), U = D.content;
697
- O(() => {
698
- if (!U) return;
699
- let e = U.text?.[T];
700
- L((t) => t ?? {
695
+ function ke({ id: i, client: a, kind: o, languages: s, renderEditor: ee, contentHref: ce, labels: ue, ownerGroup: de, entities: g, onCreated: _, onDeleted: pe, onError: v, management: me }) {
696
+ let y = n(a), b = t(), { t: x } = b, S = xe(), w = we(s), [T, ye] = A(w[0]?.value ?? "en"), E = ve(i, o, T, { client: y }), be = c({ client: y }).kinds, k = !!be?.kinds[o]?.versions.hidden, N = r(v), [P, F] = A(i ? null : q), [I, L] = A(null), [R, z] = A(null), { confirm: B, dialog: V } = he(), H = E.content;
697
+ D(() => {
698
+ if (!H) return;
699
+ let e = H.text?.[T];
700
+ F((t) => t ?? {
701
701
  title: e?.title ?? "",
702
702
  description: e?.description ?? "",
703
703
  body: e?.body ?? "",
704
- publishAt: U.publish_at && !U.live ? ge(new Date(U.publish_at)) : ""
704
+ publishAt: H.publish_at && !H.live ? ge(new Date(H.publish_at)) : ""
705
705
  });
706
- }, [U, T]);
707
- let { imageSrc: W } = D, Te = k(() => (I?.body ?? "").replace(_e(), (e, t) => {
708
- let n = W(t);
706
+ }, [H, T]);
707
+ let { imageSrc: U } = E, Ee = O(() => (P?.body ?? "").replace(_e(), (e, t) => {
708
+ let n = U(t);
709
709
  return n && n !== t ? n.replaceAll("&", "&") : e;
710
- }), [I?.body, W]);
711
- if (i && !I) return D.error ? /* @__PURE__ */ M(fe, {
712
- error: D.error,
710
+ }), [P?.body, U]);
711
+ if (i && !P) return E.error ? /* @__PURE__ */ j(fe, {
712
+ error: E.error,
713
713
  message: x("contentManager.loadFailed"),
714
- retry: D.reload
715
- }) : /* @__PURE__ */ N("div", {
714
+ retry: E.reload
715
+ }) : /* @__PURE__ */ M("div", {
716
716
  className: "grid gap-3",
717
717
  "aria-busy": !0,
718
- children: [/* @__PURE__ */ M(h, { className: "h-9 w-full" }), /* @__PURE__ */ M(h, { className: "h-48 w-full" })]
718
+ children: [/* @__PURE__ */ j(h, { className: "h-9 w-full" }), /* @__PURE__ */ j(h, { className: "h-48 w-full" })]
719
719
  });
720
- let G = I, K = (e) => L((t) => ({
720
+ let W = P, G = (e) => F((t) => ({
721
721
  ...t,
722
722
  ...e
723
- })), q = (t) => {
723
+ })), K = (t) => {
724
724
  let n = e(t);
725
- z(n), F(n, "content.save");
726
- }, Ee = () => ({
727
- title: G.title.trim(),
728
- description: G.description.trim(),
729
- body: G.body
730
- }), Y = async () => {
731
- if (z(null), V(null), !G.title.trim()) return z(x("contentManager.titleRequired"));
725
+ L(n), N(n, "content.save");
726
+ }, De = () => ({
727
+ title: W.title.trim(),
728
+ description: W.description.trim(),
729
+ body: W.body
730
+ }), Oe = async () => {
731
+ if (L(null), z(null), !W.title.trim()) return L(x("contentManager.titleRequired"));
732
732
  try {
733
- if (!U) {
734
- let e = await D.create({
733
+ if (!H) {
734
+ let e = await E.create({
735
735
  kind: o,
736
- text: { [T]: Ee() },
736
+ text: { [T]: De() },
737
737
  owner_group_id: de
738
- }), t = (g ?? []).filter((e) => A?.kinds[o]?.entities?.includes(e.kind) && !A.entity_kinds[e.kind]?.version_level);
738
+ }), t = (g ?? []).filter((e) => be?.kinds[o]?.entities?.includes(e.kind) && !be.entity_kinds[e.kind]?.version_level);
739
739
  t.length && await y.entities.setOfContent(e.id, {
740
740
  kinds: [...new Set(t.map((e) => e.kind))],
741
741
  memberships: t.map((e) => ({ group_id: e.id }))
742
- }, T).catch(q), _?.(e);
742
+ }, T).catch(K), _?.(e);
743
743
  return;
744
744
  }
745
- await D.putText(Ee()), V(x("pollEditor.saved"));
745
+ await E.putText(De()), z(x("pollEditor.saved"));
746
746
  } catch (e) {
747
- q(e);
747
+ K(e);
748
748
  }
749
- }, De = async (e) => {
750
- z(null), V(null);
749
+ }, J = async (e) => {
750
+ L(null), z(null);
751
751
  try {
752
- e ? await D.publish(G.publishAt ? new Date(G.publishAt).toISOString() : void 0) : await D.unpublish(), V(x(e ? "contentManager.publishedNotice" : "contentManager.unpublishedNotice"));
752
+ e ? await E.publish(W.publishAt ? new Date(W.publishAt).toISOString() : void 0) : await E.unpublish(), z(x(e ? "contentManager.publishedNotice" : "contentManager.unpublishedNotice"));
753
753
  } catch (e) {
754
- q(e);
754
+ K(e);
755
755
  }
756
756
  }, ke = async () => {
757
- if (U && await H({
758
- title: x("contentManager.deleteTitle", { title: U.title }),
757
+ if (H && await B({
758
+ title: x("contentManager.deleteTitle", { title: H.title }),
759
759
  description: x("contentManager.deleteBody"),
760
760
  confirm: x("contentManager.delete")
761
761
  })) try {
762
- await D.remove(), pe?.(U);
762
+ await E.remove(), pe?.(H);
763
763
  } catch (e) {
764
- q(e);
764
+ K(e);
765
765
  }
766
- }, Ae = U ? xe(U) : "draft", je = U && Ae === "published" ? ce?.(U) : void 0, Me = {
767
- value: Te,
768
- onChange: (e) => K({ body: D.storedBody(e) }),
769
- uploadImage: U ? (e) => D.uploadImage(e) : void 0,
770
- disabled: D.saving,
766
+ }, je = H ? Ce(H) : "draft", Me = H && je === "published" ? ce?.(H) : void 0, Ne = {
767
+ value: Ee,
768
+ onChange: (e) => G({ body: E.storedBody(e) }),
769
+ uploadImage: H ? (e) => E.uploadImage(e) : void 0,
770
+ disabled: E.saving,
771
771
  placeholder: x("contentManager.bodyPlaceholder"),
772
772
  "aria-label": x("contentManager.body")
773
773
  };
774
- return /* @__PURE__ */ N(be, { children: [/* @__PURE__ */ N("form", {
774
+ return /* @__PURE__ */ M(Se, { children: [/* @__PURE__ */ M("form", {
775
775
  className: "grid gap-4",
776
776
  "data-ckui": "content-form",
777
777
  onSubmit: (e) => {
778
- e.preventDefault(), Y();
778
+ e.preventDefault(), Oe();
779
779
  },
780
780
  children: [
781
- /* @__PURE__ */ N("div", {
781
+ /* @__PURE__ */ M("div", {
782
782
  className: "flex flex-wrap items-center gap-2",
783
783
  children: [
784
- /* @__PURE__ */ M("h2", {
784
+ /* @__PURE__ */ j("h2", {
785
785
  className: "text-base font-semibold",
786
- children: x(U ? "contentManager.editTitle" : "contentManager.newTitle")
786
+ children: x(H ? "contentManager.editTitle" : "contentManager.newTitle")
787
787
  }),
788
- U && /* @__PURE__ */ M(te, {
789
- variant: Ce[Ae],
790
- children: x(`contentManager.${Ae}`)
788
+ H && /* @__PURE__ */ j(te, {
789
+ variant: Te[je],
790
+ children: x(`contentManager.${je}`)
791
791
  }),
792
- je && /* @__PURE__ */ M("a", {
792
+ Me && /* @__PURE__ */ j("a", {
793
793
  className: "text-xs text-muted-foreground hover:underline",
794
- href: je,
794
+ href: Me,
795
795
  children: x("contentManager.view")
796
796
  })
797
797
  ]
798
798
  }),
799
- U?.moderation && /* @__PURE__ */ M(l, {
800
- variant: U.moderation === "rejected" ? "destructive" : "default",
801
- children: /* @__PURE__ */ M(u, { children: U.moderation_reason ? x(`contentManager.${U.moderation === "rejected" ? "rejectedBecause" : "heldBecause"}`, { reason: U.moderation_reason }) : x(`contentManager.${U.moderation === "rejected" ? "rejectedNote" : "heldNote"}`) })
799
+ H?.moderation && /* @__PURE__ */ j(l, {
800
+ variant: H.moderation === "rejected" ? "destructive" : "default",
801
+ children: /* @__PURE__ */ j(u, { children: H.moderation_reason ? x(`contentManager.${H.moderation === "rejected" ? "rejectedBecause" : "heldBecause"}`, { reason: H.moderation_reason }) : x(`contentManager.${H.moderation === "rejected" ? "rejectedNote" : "heldNote"}`) })
802
802
  }),
803
- w.length > 1 && /* @__PURE__ */ N("div", {
803
+ w.length > 1 && /* @__PURE__ */ M("div", {
804
804
  className: "grid gap-1.5",
805
- children: [/* @__PURE__ */ M(p, {
805
+ children: [/* @__PURE__ */ j(p, {
806
806
  htmlFor: `${S}-lang`,
807
807
  children: x("contentManager.language")
808
- }), /* @__PURE__ */ N(ne, {
808
+ }), /* @__PURE__ */ M(ne, {
809
809
  value: T,
810
810
  onValueChange: (e) => {
811
- E(String(e ?? "")), L(U ? null : J);
811
+ ye(String(e ?? "")), F(H ? null : q);
812
812
  },
813
- children: [/* @__PURE__ */ M(ie, {
813
+ children: [/* @__PURE__ */ j(ie, {
814
814
  id: `${S}-lang`,
815
815
  className: "w-full",
816
- children: /* @__PURE__ */ M(ae, { children: (e) => w.find((t) => t.value === e)?.label ?? e })
817
- }), /* @__PURE__ */ M(re, { children: w.map((e) => /* @__PURE__ */ M(m, {
816
+ children: /* @__PURE__ */ j(ae, { children: (e) => w.find((t) => t.value === e)?.label ?? e })
817
+ }), /* @__PURE__ */ j(re, { children: w.map((e) => /* @__PURE__ */ j(m, {
818
818
  value: e.value,
819
819
  children: e.label
820
820
  }, e.value)) })]
821
821
  })]
822
822
  }),
823
- /* @__PURE__ */ N("div", {
823
+ /* @__PURE__ */ M("div", {
824
824
  className: "grid gap-1.5",
825
- children: [/* @__PURE__ */ M(p, {
825
+ children: [/* @__PURE__ */ j(p, {
826
826
  htmlFor: `${S}-title`,
827
827
  children: x("contentManager.itemTitle")
828
- }), /* @__PURE__ */ M(f, {
828
+ }), /* @__PURE__ */ j(f, {
829
829
  id: `${S}-title`,
830
- value: G.title,
830
+ value: W.title,
831
831
  required: !0,
832
832
  maxLength: 300,
833
- onChange: (e) => K({ title: e.target.value })
833
+ onChange: (e) => G({ title: e.target.value })
834
834
  })]
835
835
  }),
836
- /* @__PURE__ */ M("div", {
836
+ /* @__PURE__ */ j("div", {
837
837
  className: "grid gap-4 sm:grid-cols-2",
838
- children: /* @__PURE__ */ N("div", {
838
+ children: /* @__PURE__ */ M("div", {
839
839
  className: "grid gap-1.5",
840
- children: [/* @__PURE__ */ M(p, {
840
+ children: [/* @__PURE__ */ j(p, {
841
841
  htmlFor: `${S}-publish`,
842
842
  children: x("contentManager.publishAt")
843
- }), /* @__PURE__ */ M(f, {
843
+ }), /* @__PURE__ */ j(f, {
844
844
  id: `${S}-publish`,
845
845
  type: "datetime-local",
846
- value: G.publishAt,
847
- onChange: (e) => K({ publishAt: e.target.value })
846
+ value: W.publishAt,
847
+ onChange: (e) => G({ publishAt: e.target.value })
848
848
  })]
849
849
  })
850
850
  }),
851
- /* @__PURE__ */ N("div", {
851
+ /* @__PURE__ */ M("div", {
852
852
  className: "grid gap-1.5",
853
- children: [/* @__PURE__ */ M(p, {
853
+ children: [/* @__PURE__ */ j(p, {
854
854
  htmlFor: `${S}-description`,
855
855
  children: x("contentManager.description")
856
- }), /* @__PURE__ */ M(oe, {
856
+ }), /* @__PURE__ */ j(oe, {
857
857
  id: `${S}-description`,
858
858
  rows: 2,
859
- value: G.description,
860
- onChange: (e) => K({ description: e.target.value })
859
+ value: W.description,
860
+ onChange: (e) => G({ description: e.target.value })
861
861
  })]
862
862
  }),
863
- (P || !U) && /* @__PURE__ */ M(Oe, {
864
- item: U,
865
- src: D.coverSrc,
866
- saving: D.saving,
867
- onFile: (e) => void D.setCover(e).catch(q)
863
+ (k || !H) && /* @__PURE__ */ j(Ae, {
864
+ item: H,
865
+ src: E.coverSrc,
866
+ saving: E.saving,
867
+ onFile: (e) => void E.setCover(e).catch(K)
868
868
  }),
869
- /* @__PURE__ */ N("div", {
869
+ /* @__PURE__ */ M("div", {
870
870
  className: "grid gap-1.5",
871
871
  children: [
872
- /* @__PURE__ */ M("span", {
872
+ /* @__PURE__ */ j("span", {
873
873
  className: "text-sm font-medium",
874
874
  children: x("contentManager.body")
875
875
  }),
876
- ee ? ee(Me) : /* @__PURE__ */ M(oe, {
877
- "aria-label": Me["aria-label"],
876
+ ee ? ee(Ne) : /* @__PURE__ */ j(oe, {
877
+ "aria-label": Ne["aria-label"],
878
878
  rows: 12,
879
- value: G.body,
880
- placeholder: Me.placeholder,
881
- onChange: (e) => K({ body: e.target.value })
879
+ value: W.body,
880
+ placeholder: Ne.placeholder,
881
+ onChange: (e) => G({ body: e.target.value })
882
882
  }),
883
- !U && /* @__PURE__ */ M("p", {
883
+ !H && /* @__PURE__ */ j("p", {
884
884
  className: "text-xs text-muted-foreground",
885
885
  children: x("contentManager.imagesAfterCreate")
886
886
  })
887
887
  ]
888
888
  }),
889
- R && /* @__PURE__ */ M(se, { children: typeof R == "string" ? R : le(b, R) }),
890
- B && !R && /* @__PURE__ */ M("p", {
889
+ I && /* @__PURE__ */ j(se, { children: typeof I == "string" ? I : le(b, I) }),
890
+ R && !I && /* @__PURE__ */ j("p", {
891
891
  role: "status",
892
892
  className: "text-sm text-muted-foreground",
893
- children: B
893
+ children: R
894
894
  }),
895
- /* @__PURE__ */ N("div", {
895
+ /* @__PURE__ */ M("div", {
896
896
  className: "flex flex-wrap gap-2 border-t border-border pt-4",
897
897
  children: [
898
- /* @__PURE__ */ M(d, {
898
+ /* @__PURE__ */ j(d, {
899
899
  type: "submit",
900
- disabled: D.saving,
901
- children: D.saving ? x("common.saving") : x(U ? "common.save" : "contentManager.createDraft")
900
+ disabled: E.saving,
901
+ children: E.saving ? x("common.saving") : x(H ? "common.save" : "contentManager.createDraft")
902
902
  }),
903
- U && !U.live && /* @__PURE__ */ M(d, {
903
+ H && !H.live && /* @__PURE__ */ j(d, {
904
904
  type: "button",
905
905
  variant: "outline",
906
- disabled: D.saving,
907
- onClick: () => void De(!0),
906
+ disabled: E.saving,
907
+ onClick: () => void J(!0),
908
908
  children: x("contentManager.publish")
909
909
  }),
910
- U?.state === "published" && /* @__PURE__ */ M(d, {
910
+ H?.state === "published" && /* @__PURE__ */ j(d, {
911
911
  type: "button",
912
912
  variant: "outline",
913
- disabled: D.saving,
914
- onClick: () => void De(!1),
913
+ disabled: E.saving,
914
+ onClick: () => void J(!1),
915
915
  children: x("contentManager.unpublish")
916
916
  }),
917
- U && /* @__PURE__ */ M(d, {
917
+ H && /* @__PURE__ */ j(d, {
918
918
  type: "button",
919
919
  variant: "destructive",
920
920
  className: "ms-auto",
921
- disabled: D.saving,
921
+ disabled: E.saving,
922
922
  onClick: () => void ke(),
923
923
  children: x("contentManager.delete")
924
924
  })
925
925
  ]
926
926
  }),
927
- we
927
+ V
928
928
  ]
929
- }), U && /* @__PURE__ */ M(C, {
929
+ }), H && /* @__PURE__ */ j(C, {
930
930
  management: me,
931
- content: U,
931
+ content: H,
932
932
  client: y,
933
933
  onError: v,
934
934
  labels: ue
935
935
  })] });
936
936
  }
937
- function Oe({ item: e, src: n, saving: r, onFile: i }) {
938
- let { t: a } = t(), o = A(null);
939
- return /* @__PURE__ */ N("div", {
937
+ function Ae({ item: e, src: n, saving: r, onFile: i }) {
938
+ let { t: a } = t(), o = k(null);
939
+ return /* @__PURE__ */ M("div", {
940
940
  className: "grid gap-1.5",
941
941
  "data-ckui": "content-cover",
942
- children: [/* @__PURE__ */ M("span", {
942
+ children: [/* @__PURE__ */ j("span", {
943
943
  className: "text-sm font-medium",
944
944
  children: a("contentManager.cover")
945
- }), e ? /* @__PURE__ */ N("div", {
945
+ }), e ? /* @__PURE__ */ M("div", {
946
946
  className: "flex flex-wrap items-center gap-3",
947
947
  children: [
948
- n ? /* @__PURE__ */ M("img", {
948
+ n ? /* @__PURE__ */ j("img", {
949
949
  src: n,
950
950
  alt: "",
951
951
  className: "h-20 w-36 rounded-md border border-border object-cover"
952
- }) : /* @__PURE__ */ M("span", {
952
+ }) : /* @__PURE__ */ j("span", {
953
953
  className: "text-muted-foreground",
954
954
  children: a("contentManager.noCover")
955
955
  }),
956
- /* @__PURE__ */ M(d, {
956
+ /* @__PURE__ */ j(d, {
957
957
  type: "button",
958
958
  size: "sm",
959
959
  variant: "outline",
@@ -961,7 +961,7 @@ function Oe({ item: e, src: n, saving: r, onFile: i }) {
961
961
  onClick: () => o.current?.click(),
962
962
  children: a(n ? "pollEditor.replaceImage" : "contentManager.addCover")
963
963
  }),
964
- n && /* @__PURE__ */ M(d, {
964
+ n && /* @__PURE__ */ j(d, {
965
965
  type: "button",
966
966
  size: "sm",
967
967
  variant: "ghost",
@@ -969,7 +969,7 @@ function Oe({ item: e, src: n, saving: r, onFile: i }) {
969
969
  onClick: () => i(null),
970
970
  children: a("pollEditor.removeImage")
971
971
  }),
972
- /* @__PURE__ */ M("input", {
972
+ /* @__PURE__ */ j("input", {
973
973
  ref: o,
974
974
  type: "file",
975
975
  accept: "image/*",
@@ -981,13 +981,13 @@ function Oe({ item: e, src: n, saving: r, onFile: i }) {
981
981
  }
982
982
  })
983
983
  ]
984
- }) : /* @__PURE__ */ M("p", {
984
+ }) : /* @__PURE__ */ j("p", {
985
985
  className: "text-xs text-muted-foreground",
986
986
  children: a("contentManager.imagesAfterCreate")
987
987
  })]
988
988
  });
989
989
  }
990
990
  //#endregion
991
- export { Y as ContentEditor, R as ContentManager, W as accessLabel, xe as contentStatus, I as useContentManagerAccess };
991
+ export { J as ContentEditor, L as ContentManager, Ee as accessLabel, Ce as contentStatus, F as useContentManagerAccess };
992
992
 
993
993
  //# sourceMappingURL=content-manager.js.map