@burdenoff/microfe-hookmovies 2026.705.2 → 2026.706.2

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 (31) hide show
  1. package/dist/hookmovies/HookMoviesRoutes.js +26 -6
  2. package/dist/hookmovies/HookMoviesRoutes.js.map +1 -1
  3. package/dist/hookmovies/components/index.js +7 -0
  4. package/dist/hookmovies/hooks/index.js +1 -0
  5. package/dist/hookmovies/hooks/useFiles.js +97 -0
  6. package/dist/hookmovies/hooks/useFiles.js.map +1 -0
  7. package/dist/hookmovies/hooks/useHookMoviesApi.js +204 -52
  8. package/dist/hookmovies/hooks/useHookMoviesApi.js.map +1 -1
  9. package/dist/hookmovies/pages/HomePage.js +2 -2
  10. package/dist/hookmovies/pages/HomePage.js.map +1 -1
  11. package/dist/hookmovies/pages/auditions/AuditionDetailPage.js +100 -45
  12. package/dist/hookmovies/pages/auditions/AuditionDetailPage.js.map +1 -1
  13. package/dist/hookmovies/pages/catalog/TitleDetailPage.js +1340 -266
  14. package/dist/hookmovies/pages/catalog/TitleDetailPage.js.map +1 -1
  15. package/dist/hookmovies/pages/catalog/TitlesPage.js +95 -74
  16. package/dist/hookmovies/pages/catalog/TitlesPage.js.map +1 -1
  17. package/dist/hookmovies/pages/consumer/DiscoveryPage.js +422 -0
  18. package/dist/hookmovies/pages/consumer/DiscoveryPage.js.map +1 -0
  19. package/dist/hookmovies/pages/consumer/HooksPage.js +252 -0
  20. package/dist/hookmovies/pages/consumer/HooksPage.js.map +1 -0
  21. package/dist/hookmovies/pages/consumer/PlayerPage.js +542 -0
  22. package/dist/hookmovies/pages/consumer/PlayerPage.js.map +1 -0
  23. package/dist/hookmovies/pages/consumer/TitleViewPage.js +424 -0
  24. package/dist/hookmovies/pages/consumer/TitleViewPage.js.map +1 -0
  25. package/dist/hookmovies/pages/distribution/RightsWindowsPage.js +1 -1
  26. package/dist/hookmovies/pages/distribution/RightsWindowsPage.js.map +1 -1
  27. package/dist/hookmovies/pages/library/EntitlementsPage.js +273 -75
  28. package/dist/hookmovies/pages/library/EntitlementsPage.js.map +1 -1
  29. package/dist/hookmovies/pages/library/ListsPage.js +186 -106
  30. package/dist/hookmovies/pages/library/ListsPage.js.map +1 -1
  31. package/package.json +1 -1
@@ -1,323 +1,1397 @@
1
1
  import { useHookMovies as e } from "../../context/HookMoviesContext.js";
2
- import { PageLayout as t } from "../../components/PageLayout.js";
3
- import { StatusBadge as n } from "../../components/StatusBadge.js";
4
- import { useArchiveTitle as r, useReviews as i, useTitle as a, useTransitionTitle as o } from "../../hooks/useHookMoviesApi.js";
5
- import { formatDate as s, formatEnumLabel as c } from "../../utils/formatters.js";
6
- import { ErrorState as l, LoadingState as u } from "../../components/StateViews.js";
7
- import { RatingDisplay as d } from "../../components/RatingDisplay.js";
8
- import { useState as f } from "react";
9
- import { Archive as p, ArrowLeft as m, Calendar as h, Clock as g, Globe as _, Languages as v, Layers as y, ShieldCheck as b, Sparkles as x, Star as S, Users as C } from "lucide-react";
10
- import { useParams as w } from "react-router-dom";
11
- import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
12
- import { GlassCard as O } from "@burdenoff/fe-libs/ui";
2
+ import { cn as t } from "../../utils/cn.js";
3
+ import { PageLayout as n } from "../../components/PageLayout.js";
4
+ import { StatusBadge as r } from "../../components/StatusBadge.js";
5
+ import { useAddCredit as i, useArchiveTitle as a, useCheckEntitlement as o, useClips as s, useCreateClip as c, useCreateEpisode as l, useCreateSeason as u, useDeleteClip as ee, usePeople as te, useRecordProgress as ne, useReviews as re, useStudios as ie, useTitle as ae, useTransitionTitle as oe, useUpdateTitle as se } from "../../hooks/useHookMoviesApi.js";
6
+ import { formatDate as ce, formatEnumLabel as d } from "../../utils/formatters.js";
7
+ import { FILE_FOLDERS as f, uploadFileToFiles as le, useFileUrl as p } from "../../hooks/useFiles.js";
8
+ import { ErrorState as ue, LoadingState as de } from "../../components/StateViews.js";
9
+ import { EmptyState as fe } from "../../components/EmptyState.js";
10
+ import { Pagination as pe } from "../../components/Pagination.js";
11
+ import { RatingDisplay as me } from "../../components/RatingDisplay.js";
12
+ import { useRef as he, useState as m } from "react";
13
+ import { Archive as ge, ArrowLeft as _e, Calendar as ve, CheckCircle2 as ye, Clapperboard as h, Clock as be, Film as g, Globe as xe, Image as _, Languages as Se, Layers as Ce, Loader2 as v, Lock as we, Pencil as Te, Play as Ee, Plus as y, ShieldCheck as De, Sparkles as Oe, Star as ke, Trash2 as b, Upload as x, UserPlus as Ae, Users as je, Video as Me, X as Ne } from "lucide-react";
14
+ import { useParams as Pe } from "react-router-dom";
15
+ import { Fragment as Fe, jsx as S, jsxs as C } from "react/jsx-runtime";
16
+ import { GlassCard as w } from "@burdenoff/fe-libs/ui";
13
17
  //#region src/hookmovies/pages/catalog/TitleDetailPage.tsx
14
- var k = {
15
- DRAFT: [
16
- "IN_REVIEW",
17
- "SCHEDULED",
18
- "PUBLISHED"
19
- ],
18
+ var Ie = {
19
+ DRAFT: ["IN_REVIEW"],
20
20
  IN_REVIEW: [
21
- "DRAFT",
22
21
  "SCHEDULED",
23
- "PUBLISHED"
22
+ "PUBLISHED",
23
+ "DRAFT"
24
24
  ],
25
- SCHEDULED: ["PUBLISHED", "DRAFT"],
25
+ SCHEDULED: ["PUBLISHED", "IN_REVIEW"],
26
26
  PUBLISHED: ["UNPUBLISHED"],
27
- UNPUBLISHED: ["PUBLISHED", "ARCHIVED"],
27
+ UNPUBLISHED: ["PUBLISHED"],
28
28
  ARCHIVED: []
29
- }, A = () => {
30
- let { id: A } = w(), { navigateTo: j } = e(), { data: M, isLoading: N, isError: P, refetch: F } = a(A), I = o(), L = r(), R = i({ titleId: A }, {
29
+ }, Le = [
30
+ "MOVIE",
31
+ "SERIES",
32
+ "SHORT_FILM",
33
+ "DOCUMENTARY",
34
+ "ANIME",
35
+ "SHORT_FORM",
36
+ "LONG_FORM",
37
+ "LIVE_EVENT",
38
+ "TRAILER",
39
+ "COLLECTION",
40
+ "FAST_CHANNEL"
41
+ ], Re = [
42
+ "ACTOR",
43
+ "DIRECTOR",
44
+ "WRITER",
45
+ "PRODUCER",
46
+ "CINEMATOGRAPHER",
47
+ "EDITOR",
48
+ "COMPOSER",
49
+ "VOICE_ACTOR",
50
+ "CREW"
51
+ ], T = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", E = "mb-1.5 block text-xs font-medium text-text-secondary", ze = (e) => e.split(",").map((e) => e.trim()).filter(Boolean), Be = (e) => e.trim() ? new Date(e).toISOString() : void 0, Ve = (e) => `${Math.floor(e / 60)}:${Math.floor(e % 60).toString().padStart(2, "0")}`, He = [
52
+ {
53
+ field: "posterFileId",
54
+ label: "Poster",
55
+ kind: "image",
56
+ folder: f.artwork,
57
+ accept: "image/*",
58
+ icon: _,
59
+ hint: "Vertical key art (2:3)."
60
+ },
61
+ {
62
+ field: "backdropFileId",
63
+ label: "Backdrop",
64
+ kind: "image",
65
+ folder: f.artwork,
66
+ accept: "image/*",
67
+ icon: _,
68
+ hint: "Wide hero art (16:9)."
69
+ },
70
+ {
71
+ field: "trailerFileId",
72
+ label: "Trailer",
73
+ kind: "video",
74
+ folder: f.masters,
75
+ accept: "video/*",
76
+ icon: g,
77
+ hint: "Promo trailer master."
78
+ },
79
+ {
80
+ field: "videoFileId",
81
+ label: "Video master",
82
+ kind: "video",
83
+ folder: f.masters,
84
+ accept: "video/*",
85
+ icon: h,
86
+ hint: "Full-length feature master."
87
+ }
88
+ ], Ue = ({ titleId: e, config: n, currentFileId: r }) => {
89
+ let i = se(), a = p(r), o = he(null), [s, c] = m(!1), [l, u] = m(null), ee = n.icon, te = async (t) => {
90
+ let r = t.target.files?.[0];
91
+ if (t.target.value = "", r) {
92
+ u(null), c(!0);
93
+ try {
94
+ let t = await le(r, n.folder), a = {};
95
+ a[n.field] = t.id, await i.mutateAsync({
96
+ id: e,
97
+ input: a
98
+ });
99
+ } catch (e) {
100
+ u(e instanceof Error ? e.message : "Upload failed");
101
+ } finally {
102
+ c(!1);
103
+ }
104
+ }
105
+ }, ne = async () => {
106
+ u(null), c(!0);
107
+ try {
108
+ let t = { [n.field]: null };
109
+ await i.mutateAsync({
110
+ id: e,
111
+ input: t
112
+ });
113
+ } catch (e) {
114
+ u(e instanceof Error ? e.message : "Could not remove file");
115
+ } finally {
116
+ c(!1);
117
+ }
118
+ };
119
+ return /* @__PURE__ */ C("div", {
120
+ className: "rounded-xl border border-border-seam bg-bg-surface p-4",
121
+ children: [
122
+ /* @__PURE__ */ C("div", {
123
+ className: "mb-3 flex items-center justify-between gap-2",
124
+ children: [/* @__PURE__ */ C("div", {
125
+ className: "flex items-center gap-2",
126
+ children: [/* @__PURE__ */ S(ee, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ S("h3", {
127
+ className: "text-sm font-medium text-text-primary",
128
+ children: n.label
129
+ })]
130
+ }), r && /* @__PURE__ */ S("span", {
131
+ className: "rounded-full bg-status-success-bg-subtle px-2 py-0.5 text-[10px] font-medium text-status-success-text",
132
+ children: "Set"
133
+ })]
134
+ }),
135
+ /* @__PURE__ */ S("div", {
136
+ className: t("relative flex items-center justify-center overflow-hidden rounded-lg border border-border-subtle bg-bg-sunken", n.kind === "image" ? "aspect-[3/4]" : "aspect-video"),
137
+ children: s ? /* @__PURE__ */ C("div", {
138
+ className: "flex flex-col items-center gap-2 text-text-secondary",
139
+ children: [/* @__PURE__ */ S(v, { className: "h-6 w-6 animate-spin" }), /* @__PURE__ */ S("span", {
140
+ className: "text-xs",
141
+ children: "Uploading…"
142
+ })]
143
+ }) : r ? a.isLoading ? /* @__PURE__ */ S(v, { className: "h-6 w-6 animate-spin text-text-secondary" }) : a.data ? n.kind === "image" ? /* @__PURE__ */ S("img", {
144
+ src: a.data,
145
+ alt: `${n.label} artwork`,
146
+ className: "h-full w-full object-cover"
147
+ }) : /* @__PURE__ */ S("video", {
148
+ src: a.data,
149
+ controls: !0,
150
+ preload: "metadata",
151
+ className: "h-full w-full bg-bg-canvas object-contain",
152
+ children: /* @__PURE__ */ S("track", { kind: "captions" })
153
+ }) : /* @__PURE__ */ C("div", {
154
+ className: "flex flex-col items-center gap-1 text-text-secondary",
155
+ children: [/* @__PURE__ */ S(ee, { className: "h-6 w-6" }), /* @__PURE__ */ S("span", {
156
+ className: "text-xs",
157
+ children: "Preview unavailable"
158
+ })]
159
+ }) : /* @__PURE__ */ C("button", {
160
+ type: "button",
161
+ onClick: () => o.current?.click(),
162
+ className: "flex h-full w-full flex-col items-center justify-center gap-2 text-text-secondary transition-colors hover:text-text-primary",
163
+ children: [/* @__PURE__ */ S(x, { className: "h-6 w-6" }), /* @__PURE__ */ C("span", {
164
+ className: "text-xs",
165
+ children: ["Upload ", n.label.toLowerCase()]
166
+ })]
167
+ })
168
+ }),
169
+ /* @__PURE__ */ S("p", {
170
+ className: "mt-2 text-[11px] text-text-secondary",
171
+ children: n.hint
172
+ }),
173
+ l && /* @__PURE__ */ S("p", {
174
+ className: "mt-2 text-xs text-status-error-text",
175
+ children: l
176
+ }),
177
+ /* @__PURE__ */ C("div", {
178
+ className: "mt-3 flex items-center gap-2",
179
+ children: [/* @__PURE__ */ C("button", {
180
+ type: "button",
181
+ disabled: s,
182
+ onClick: () => o.current?.click(),
183
+ className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-2.5 py-1 text-xs font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50",
184
+ children: [/* @__PURE__ */ S(x, { className: "h-3.5 w-3.5" }), r ? "Replace" : "Upload"]
185
+ }), r && /* @__PURE__ */ C("button", {
186
+ type: "button",
187
+ disabled: s,
188
+ onClick: () => void ne(),
189
+ className: "inline-flex items-center gap-1.5 rounded-lg border border-status-error-border px-2.5 py-1 text-xs font-medium text-status-error-text transition-colors hover:bg-status-error-bg-subtle disabled:opacity-50",
190
+ children: [/* @__PURE__ */ S(b, { className: "h-3.5 w-3.5" }), "Remove"]
191
+ })]
192
+ }),
193
+ /* @__PURE__ */ S("input", {
194
+ ref: o,
195
+ type: "file",
196
+ accept: n.accept,
197
+ className: "hidden",
198
+ onChange: (e) => void te(e),
199
+ "aria-label": `Upload ${n.label}`
200
+ })
201
+ ]
202
+ });
203
+ }, We = ({ clip: e, onDelete: t, deleting: n }) => {
204
+ let r = p(e.posterFileId), i = p(e.posterFileId ? void 0 : e.videoFileId);
205
+ return /* @__PURE__ */ C("div", {
206
+ className: "flex flex-col overflow-hidden rounded-xl border border-border-seam bg-bg-surface",
207
+ children: [/* @__PURE__ */ C("div", {
208
+ className: "relative aspect-[9/16] w-full overflow-hidden bg-bg-sunken",
209
+ children: [e.posterFileId ? r.isLoading ? /* @__PURE__ */ S("div", {
210
+ className: "flex h-full w-full items-center justify-center",
211
+ children: /* @__PURE__ */ S(v, { className: "h-5 w-5 animate-spin text-text-secondary" })
212
+ }) : r.data ? /* @__PURE__ */ S("img", {
213
+ src: r.data,
214
+ alt: e.caption ?? "Clip poster",
215
+ className: "h-full w-full object-cover"
216
+ }) : /* @__PURE__ */ S("div", {
217
+ className: "flex h-full w-full items-center justify-center text-text-secondary",
218
+ children: /* @__PURE__ */ S(g, { className: "h-6 w-6" })
219
+ }) : i.isLoading ? /* @__PURE__ */ S("div", {
220
+ className: "flex h-full w-full items-center justify-center",
221
+ children: /* @__PURE__ */ S(v, { className: "h-5 w-5 animate-spin text-text-secondary" })
222
+ }) : i.data ? /* @__PURE__ */ S("video", {
223
+ src: i.data,
224
+ controls: !0,
225
+ preload: "metadata",
226
+ className: "h-full w-full bg-bg-canvas object-contain",
227
+ children: /* @__PURE__ */ S("track", { kind: "captions" })
228
+ }) : /* @__PURE__ */ S("div", {
229
+ className: "flex h-full w-full items-center justify-center text-text-secondary",
230
+ children: /* @__PURE__ */ S(g, { className: "h-6 w-6" })
231
+ }), e.durationSeconds != null && /* @__PURE__ */ S("span", {
232
+ className: "absolute bottom-2 right-2 rounded bg-bg-canvas/80 px-1.5 py-0.5 text-[10px] font-medium text-text-primary",
233
+ children: Ve(e.durationSeconds)
234
+ })]
235
+ }), /* @__PURE__ */ C("div", {
236
+ className: "flex flex-1 flex-col gap-2 p-3",
237
+ children: [
238
+ /* @__PURE__ */ S("p", {
239
+ className: "line-clamp-2 text-sm text-text-primary",
240
+ children: e.caption ?? "Untitled clip"
241
+ }),
242
+ e.language && /* @__PURE__ */ S("span", {
243
+ className: "w-fit rounded-full bg-bg-sunken px-2 py-0.5 text-[10px] uppercase tracking-wide text-text-secondary",
244
+ children: e.language
245
+ }),
246
+ /* @__PURE__ */ C("button", {
247
+ type: "button",
248
+ disabled: n,
249
+ onClick: () => t(e),
250
+ className: "mt-auto inline-flex items-center justify-center gap-1.5 rounded-lg border border-status-error-border px-2.5 py-1 text-xs font-medium text-status-error-text transition-colors hover:bg-status-error-bg-subtle disabled:opacity-50",
251
+ children: [/* @__PURE__ */ S(b, { className: "h-3.5 w-3.5" }), n ? "Deleting…" : "Delete"]
252
+ })
253
+ ]
254
+ })]
255
+ });
256
+ }, Ge = 12, Ke = () => {
257
+ let { id: t } = Pe(), { navigateTo: p } = e(), { data: h, isLoading: g, isError: v, refetch: b } = ae(t), Ve = oe(), Ke = a(), qe = re({ titleId: t }, {
31
258
  limit: 10,
32
259
  offset: 0
33
- }), [z, B] = f(null);
34
- if (N) return /* @__PURE__ */ E(t, {
260
+ }), D = se(), O = i(), k = u(), A = l(), j = ne(), M = o(t), Je = ie({
261
+ limit: 200,
262
+ offset: 0
263
+ }), [Ye, Xe] = m(0), N = s(t, void 0, {
264
+ limit: Ge,
265
+ offset: Ye * Ge
266
+ }), Ze = c(), Qe = ee(), [$e, P] = m(null), [et, F] = m(!1), [I, tt] = m(null), [nt, rt] = m(""), [L, it] = m(""), [at, ot] = m(""), [st, ct] = m(!1), [lt, R] = m(null), [ut, dt] = m(null), z = he(null), [B, V] = m("none"), [H, ft] = m(""), [pt, mt] = m("MOVIE"), [ht, gt] = m(""), [_t, vt] = m(""), [yt, bt] = m(""), [xt, St] = m(""), [Ct, wt] = m(""), [U, Tt] = m(""), [W, Et] = m(""), [Dt, Ot] = m(""), [kt, At] = m(""), [jt, Mt] = m(!1), [Nt, Pt] = m(""), [G, Ft] = m(""), [It, Lt] = m("ACTOR"), [Rt, zt] = m(""), [K, Bt] = m(""), Vt = te({
267
+ limit: 50,
268
+ offset: 0
269
+ }, Nt), [q, Ht] = m(""), [Ut, Wt] = m(""), [Gt, Kt] = m(""), [qt, Jt] = m(""), [Yt, Xt] = m(""), [J, Zt] = m(""), [Qt, $t] = m(""), [en, tn] = m(""), [nn, rn] = m(""), [an, on] = m(""), [sn, cn] = m(!1);
270
+ if (g) return /* @__PURE__ */ S(n, {
35
271
  title: "Title",
36
- children: /* @__PURE__ */ E(u, { label: "Loading title…" })
272
+ children: /* @__PURE__ */ S(de, { label: "Loading title…" })
37
273
  });
38
- if (P || !M) return /* @__PURE__ */ E(t, {
274
+ if (v || !h) return /* @__PURE__ */ S(n, {
39
275
  title: "Title",
40
- children: /* @__PURE__ */ E(l, {
276
+ children: /* @__PURE__ */ S(ue, {
41
277
  title: "Title not found",
42
278
  message: "This title may have been archived or you may not have access.",
43
- onRetry: () => void F()
279
+ onRetry: () => void b()
44
280
  })
45
281
  });
46
- let V = async (e) => {
47
- B(null);
282
+ let Y = h.type === "SERIES", X = () => V("none"), ln = () => {
283
+ P(null), ft(h.title), mt(h.type), gt(h.synopsis ?? ""), vt(h.genres.join(", ")), bt(h.tags.join(", ")), St(h.originalLanguage ?? ""), wt(h.originCountry ?? ""), Tt(h.releaseYear ? String(h.releaseYear) : ""), Et(h.runtimeMinutes ? String(h.runtimeMinutes) : ""), Ot(h.certification ?? ""), At(h.studioId ?? ""), Mt(h.aiDisclosure), V("edit");
284
+ }, un = async (e) => {
285
+ P(null);
48
286
  try {
49
- await I.mutateAsync({
50
- id: M.id,
287
+ await Ve.mutateAsync({
288
+ id: h.id,
51
289
  status: e
52
290
  });
53
291
  } catch (e) {
54
- B(e instanceof Error ? e.message : "Transition failed");
292
+ P(e instanceof Error ? e.message : "Transition failed");
55
293
  }
56
- }, H = async () => {
57
- B(null);
294
+ }, dn = async () => {
295
+ P(null);
58
296
  try {
59
- await L.mutateAsync(M.id), j("catalog/titles");
297
+ await Ke.mutateAsync(h.id), p("catalog/titles");
60
298
  } catch (e) {
61
- B(e instanceof Error ? e.message : "Archive failed");
299
+ P(e instanceof Error ? e.message : "Archive failed");
62
300
  }
63
- }, U = R.data?.items ?? [], W = U.length > 0 ? U.reduce((e, t) => e + t.score, 0) / U.length : null, G = [];
64
- return M.releaseDate ? G.push({
65
- icon: h,
301
+ }, fn = async (e) => {
302
+ if (e.preventDefault(), P(null), !H.trim()) {
303
+ P("Title is required.");
304
+ return;
305
+ }
306
+ let t = {
307
+ title: H.trim(),
308
+ type: pt,
309
+ synopsis: ht.trim() || void 0,
310
+ genres: ze(_t),
311
+ tags: ze(yt),
312
+ originalLanguage: xt.trim() || void 0,
313
+ originCountry: Ct.trim() || void 0,
314
+ releaseYear: U.trim() ? Number(U) : void 0,
315
+ runtimeMinutes: W.trim() ? Number(W) : void 0,
316
+ certification: Dt.trim() || void 0,
317
+ studioId: kt || void 0,
318
+ aiDisclosure: jt
319
+ };
320
+ try {
321
+ await D.mutateAsync({
322
+ id: h.id,
323
+ input: t
324
+ }), X();
325
+ } catch (e) {
326
+ P(e instanceof Error ? e.message : "Failed to update title");
327
+ }
328
+ }, pn = async (e) => {
329
+ if (e.preventDefault(), P(null), !G) {
330
+ P("Select a person to credit.");
331
+ return;
332
+ }
333
+ try {
334
+ await O.mutateAsync({
335
+ personId: G,
336
+ titleId: h.id,
337
+ role: It,
338
+ characterName: Rt.trim() || void 0,
339
+ billingOrder: K.trim() ? Number(K) : void 0
340
+ }), Ft(""), zt(""), Bt(""), Pt(""), X();
341
+ } catch (e) {
342
+ P(e instanceof Error ? e.message : "Failed to add credit");
343
+ }
344
+ }, mn = async (e) => {
345
+ if (e.preventDefault(), P(null), !q.trim()) {
346
+ P("Season number is required.");
347
+ return;
348
+ }
349
+ try {
350
+ await k.mutateAsync({
351
+ titleId: h.id,
352
+ number: Number(q),
353
+ name: Ut.trim() || void 0,
354
+ synopsis: Gt.trim() || void 0,
355
+ airDate: Be(qt)
356
+ }), Ht(""), Wt(""), Kt(""), Jt(""), X();
357
+ } catch (e) {
358
+ P(e instanceof Error ? e.message : "Failed to add season");
359
+ }
360
+ }, hn = async (e) => {
361
+ if (e.preventDefault(), P(null), !J.trim()) {
362
+ P("Episode number is required.");
363
+ return;
364
+ }
365
+ if (!Qt.trim()) {
366
+ P("Episode name is required.");
367
+ return;
368
+ }
369
+ try {
370
+ await A.mutateAsync({
371
+ titleId: h.id,
372
+ number: Number(J),
373
+ name: Qt.trim(),
374
+ seasonId: Yt || void 0,
375
+ synopsis: en.trim() || void 0,
376
+ runtimeMinutes: nn.trim() ? Number(nn) : void 0,
377
+ airDate: Be(an)
378
+ }), Xt(""), Zt(""), $t(""), tn(""), rn(""), on(""), X();
379
+ } catch (e) {
380
+ P(e instanceof Error ? e.message : "Failed to add episode");
381
+ }
382
+ }, gn = async () => {
383
+ if (P(null), cn(!1), !M.data?.entitled) {
384
+ P("You are not entitled to watch this title.");
385
+ return;
386
+ }
387
+ try {
388
+ await j.mutateAsync({
389
+ titleId: h.id,
390
+ positionSeconds: (h.runtimeMinutes ?? 0) * 60,
391
+ completed: !0,
392
+ lastDevice: "web"
393
+ }), cn(!0);
394
+ } catch (e) {
395
+ P(e instanceof Error ? e.message : "Failed to record progress");
396
+ }
397
+ }, _n = async (e) => {
398
+ if (e.preventDefault(), R(null), !I) {
399
+ R("Select a clip video to upload.");
400
+ return;
401
+ }
402
+ ct(!0);
403
+ try {
404
+ let e = await le(I, f.clips);
405
+ await Ze.mutateAsync({
406
+ titleId: h.id,
407
+ videoFileId: e.id,
408
+ caption: nt.trim() || void 0,
409
+ durationSeconds: L.trim() ? Number(L) : void 0,
410
+ language: at.trim() || void 0
411
+ }), tt(null), rt(""), it(""), ot(""), z.current && (z.current.value = ""), F(!1), Xe(0);
412
+ } catch (e) {
413
+ R(e instanceof Error ? e.message : "Failed to add clip");
414
+ } finally {
415
+ ct(!1);
416
+ }
417
+ }, vn = async (e) => {
418
+ P(null), dt(e.id);
419
+ try {
420
+ await Qe.mutateAsync({
421
+ id: e.id,
422
+ titleId: h.id
423
+ });
424
+ } catch (e) {
425
+ P(e instanceof Error ? e.message : "Failed to delete clip");
426
+ } finally {
427
+ dt(null);
428
+ }
429
+ }, Z = qe.data?.items ?? [], Q = N.data?.items ?? [], yn = Z.length > 0 ? Z.reduce((e, t) => e + t.score, 0) / Z.length : null, $ = [];
430
+ h.releaseDate ? $.push({
431
+ icon: ve,
66
432
  label: "Release",
67
- value: s(M.releaseDate)
68
- }) : M.releaseYear && G.push({
69
- icon: h,
433
+ value: ce(h.releaseDate)
434
+ }) : h.releaseYear && $.push({
435
+ icon: ve,
70
436
  label: "Year",
71
- value: String(M.releaseYear)
72
- }), M.runtimeMinutes && G.push({
73
- icon: g,
437
+ value: String(h.releaseYear)
438
+ }), h.runtimeMinutes && $.push({
439
+ icon: be,
74
440
  label: "Runtime",
75
- value: `${M.runtimeMinutes} min`
76
- }), M.originalLanguage && G.push({
77
- icon: v,
441
+ value: `${h.runtimeMinutes} min`
442
+ }), h.originalLanguage && $.push({
443
+ icon: Se,
78
444
  label: "Language",
79
- value: M.originalLanguage
80
- }), M.originCountry && G.push({
81
- icon: _,
445
+ value: h.originalLanguage
446
+ }), h.originCountry && $.push({
447
+ icon: xe,
82
448
  label: "Country",
83
- value: M.originCountry
84
- }), M.certification && G.push({
85
- icon: b,
449
+ value: h.originCountry
450
+ }), h.certification && $.push({
451
+ icon: De,
86
452
  label: "Certification",
87
- value: M.certification
88
- }), /* @__PURE__ */ D(t, {
89
- title: /* @__PURE__ */ D("span", {
453
+ value: h.certification
454
+ });
455
+ let bn = Vt.data?.items ?? [];
456
+ return /* @__PURE__ */ C(n, {
457
+ title: /* @__PURE__ */ C("span", {
90
458
  className: "flex items-center gap-3",
91
- children: [/* @__PURE__ */ E("button", {
459
+ children: [/* @__PURE__ */ S("button", {
92
460
  type: "button",
93
- onClick: () => j("catalog/titles"),
461
+ onClick: () => p("catalog/titles"),
94
462
  className: "rounded-md p-1 text-text-secondary hover:text-text-primary",
95
463
  "aria-label": "Back to catalog",
96
- children: /* @__PURE__ */ E(m, { className: "h-5 w-5" })
97
- }), M.title]
464
+ children: /* @__PURE__ */ S(_e, { className: "h-5 w-5" })
465
+ }), h.title]
98
466
  }),
99
- description: `${c(M.type)}${M.studio ? ` · ${M.studio.name}` : ""}`,
100
- actions: /* @__PURE__ */ E(n, { status: M.status }),
101
- children: [z && /* @__PURE__ */ E("div", {
102
- className: "mb-4 rounded-lg border border-status-error-border bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
103
- children: z
104
- }), /* @__PURE__ */ D("div", {
105
- className: "grid grid-cols-1 gap-6 lg:grid-cols-3",
106
- children: [/* @__PURE__ */ D("div", {
107
- className: "space-y-6 lg:col-span-2",
108
- children: [
109
- M.synopsis && /* @__PURE__ */ D(O, {
110
- treatment: "metric",
111
- className: "border-border-seam p-5",
112
- children: [/* @__PURE__ */ E("h2", {
113
- className: "mb-2 text-sm font-semibold text-text-primary",
467
+ description: `${d(h.type)}${h.studio ? ` · ${h.studio.name}` : ""}`,
468
+ actions: /* @__PURE__ */ C("div", {
469
+ className: "flex items-center gap-2",
470
+ children: [/* @__PURE__ */ C("button", {
471
+ type: "button",
472
+ onClick: ln,
473
+ className: "inline-flex items-center gap-2 rounded-lg border border-border-seam px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken transition-colors",
474
+ children: [/* @__PURE__ */ S(Te, { className: "h-3.5 w-3.5" }), "Edit"]
475
+ }), /* @__PURE__ */ S(r, { status: h.status })]
476
+ }),
477
+ children: [
478
+ $e && /* @__PURE__ */ S("div", {
479
+ className: "mb-4 rounded-lg border border-status-error-border bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
480
+ children: $e
481
+ }),
482
+ B === "edit" && /* @__PURE__ */ C(w, {
483
+ treatment: "metric",
484
+ className: "mb-6 border-border-seam p-5",
485
+ children: [/* @__PURE__ */ C("div", {
486
+ className: "mb-4 flex items-center justify-between",
487
+ children: [/* @__PURE__ */ S("h2", {
488
+ className: "text-sm font-semibold text-text-primary",
489
+ children: "Edit title"
490
+ }), /* @__PURE__ */ S("button", {
491
+ type: "button",
492
+ onClick: X,
493
+ className: "rounded-md p-1 text-text-secondary hover:text-text-primary",
494
+ "aria-label": "Close edit form",
495
+ children: /* @__PURE__ */ S(Ne, { className: "h-4 w-4" })
496
+ })]
497
+ }), /* @__PURE__ */ C("form", {
498
+ onSubmit: fn,
499
+ className: "space-y-5",
500
+ children: [
501
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
502
+ htmlFor: "edit-title",
503
+ className: E,
504
+ children: "Title *"
505
+ }), /* @__PURE__ */ S("input", {
506
+ id: "edit-title",
507
+ type: "text",
508
+ value: H,
509
+ onChange: (e) => ft(e.target.value),
510
+ className: T,
511
+ required: !0
512
+ })] }),
513
+ /* @__PURE__ */ C("div", {
514
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
515
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
516
+ htmlFor: "edit-type",
517
+ className: E,
518
+ children: "Type"
519
+ }), /* @__PURE__ */ S("select", {
520
+ id: "edit-type",
521
+ value: pt,
522
+ onChange: (e) => mt(e.target.value),
523
+ className: T,
524
+ children: Le.map((e) => /* @__PURE__ */ S("option", {
525
+ value: e,
526
+ children: d(e)
527
+ }, e))
528
+ })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
529
+ htmlFor: "edit-studio",
530
+ className: E,
531
+ children: "Studio"
532
+ }), /* @__PURE__ */ C("select", {
533
+ id: "edit-studio",
534
+ value: kt,
535
+ onChange: (e) => At(e.target.value),
536
+ className: T,
537
+ children: [/* @__PURE__ */ S("option", {
538
+ value: "",
539
+ children: "No studio"
540
+ }), (Je.data?.items ?? []).map((e) => /* @__PURE__ */ S("option", {
541
+ value: e.id,
542
+ children: e.name
543
+ }, e.id))]
544
+ })] })]
545
+ }),
546
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
547
+ htmlFor: "edit-synopsis",
548
+ className: E,
114
549
  children: "Synopsis"
115
- }), /* @__PURE__ */ E("p", {
116
- className: "text-sm leading-relaxed text-text-secondary",
117
- children: M.synopsis
118
- })]
119
- }),
120
- /* @__PURE__ */ D(O, {
121
- treatment: "metric",
122
- className: "border-border-seam p-5",
123
- children: [/* @__PURE__ */ D("h2", {
124
- className: "mb-3 flex items-center gap-2 text-sm font-semibold text-text-primary",
550
+ }), /* @__PURE__ */ S("textarea", {
551
+ id: "edit-synopsis",
552
+ value: ht,
553
+ onChange: (e) => gt(e.target.value),
554
+ rows: 4,
555
+ className: T
556
+ })] }),
557
+ /* @__PURE__ */ C("div", {
558
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
559
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
560
+ htmlFor: "edit-genres",
561
+ className: E,
562
+ children: "Genres (comma-separated)"
563
+ }), /* @__PURE__ */ S("input", {
564
+ id: "edit-genres",
565
+ type: "text",
566
+ value: _t,
567
+ onChange: (e) => vt(e.target.value),
568
+ placeholder: "Drama, Thriller",
569
+ className: T
570
+ })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
571
+ htmlFor: "edit-tags",
572
+ className: E,
573
+ children: "Tags (comma-separated)"
574
+ }), /* @__PURE__ */ S("input", {
575
+ id: "edit-tags",
576
+ type: "text",
577
+ value: yt,
578
+ onChange: (e) => bt(e.target.value),
579
+ placeholder: "award-winner, indie",
580
+ className: T
581
+ })] })]
582
+ }),
583
+ /* @__PURE__ */ C("div", {
584
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-3",
125
585
  children: [
126
- /* @__PURE__ */ E(C, { className: "h-4 w-4" }),
127
- "Cast & Crew (",
128
- M.credits.length,
129
- ")"
586
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
587
+ htmlFor: "edit-language",
588
+ className: E,
589
+ children: "Original Language"
590
+ }), /* @__PURE__ */ S("input", {
591
+ id: "edit-language",
592
+ type: "text",
593
+ value: xt,
594
+ onChange: (e) => St(e.target.value),
595
+ placeholder: "en",
596
+ className: T
597
+ })] }),
598
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
599
+ htmlFor: "edit-country",
600
+ className: E,
601
+ children: "Origin Country"
602
+ }), /* @__PURE__ */ S("input", {
603
+ id: "edit-country",
604
+ type: "text",
605
+ value: Ct,
606
+ onChange: (e) => wt(e.target.value),
607
+ placeholder: "US",
608
+ className: T
609
+ })] }),
610
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
611
+ htmlFor: "edit-certification",
612
+ className: E,
613
+ children: "Certification"
614
+ }), /* @__PURE__ */ S("input", {
615
+ id: "edit-certification",
616
+ type: "text",
617
+ value: Dt,
618
+ onChange: (e) => Ot(e.target.value),
619
+ placeholder: "PG-13",
620
+ className: T
621
+ })] })
130
622
  ]
131
- }), M.credits.length === 0 ? /* @__PURE__ */ E("p", {
132
- className: "text-sm text-text-secondary",
133
- children: "No credits recorded yet."
134
- }) : /* @__PURE__ */ E("ul", {
135
- className: "divide-y divide-border-seam",
136
- children: [...M.credits].sort((e, t) => e.billingOrder - t.billingOrder).map((e) => /* @__PURE__ */ D("li", {
137
- className: "flex items-center justify-between py-2",
138
- children: [/* @__PURE__ */ D("div", {
139
- className: "min-w-0",
140
- children: [/* @__PURE__ */ E("p", {
141
- className: "truncate text-sm font-medium text-text-primary",
142
- children: e.person?.name ?? "Unknown person"
143
- }), e.characterName && /* @__PURE__ */ D("p", {
144
- className: "text-xs text-text-secondary",
145
- children: ["as ", e.characterName]
146
- })]
147
- }), /* @__PURE__ */ E("span", {
148
- className: "rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary",
149
- children: c(e.role)
623
+ }),
624
+ /* @__PURE__ */ C("div", {
625
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
626
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
627
+ htmlFor: "edit-year",
628
+ className: E,
629
+ children: "Release Year"
630
+ }), /* @__PURE__ */ S("input", {
631
+ id: "edit-year",
632
+ type: "number",
633
+ value: U,
634
+ onChange: (e) => Tt(e.target.value),
635
+ placeholder: "2026",
636
+ className: T
637
+ })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
638
+ htmlFor: "edit-runtime",
639
+ className: E,
640
+ children: "Runtime (minutes)"
641
+ }), /* @__PURE__ */ S("input", {
642
+ id: "edit-runtime",
643
+ type: "number",
644
+ value: W,
645
+ onChange: (e) => Et(e.target.value),
646
+ placeholder: "120",
647
+ className: T
648
+ })] })]
649
+ }),
650
+ /* @__PURE__ */ C("label", {
651
+ className: "flex items-center gap-2 text-sm text-text-primary",
652
+ children: [/* @__PURE__ */ S("input", {
653
+ type: "checkbox",
654
+ checked: jt,
655
+ onChange: (e) => Mt(e.target.checked),
656
+ className: "h-4 w-4 rounded border-border-subtle"
657
+ }), "This title contains AI-generated or AI-altered content"]
658
+ }),
659
+ /* @__PURE__ */ C("div", {
660
+ className: "flex items-center gap-3 pt-1",
661
+ children: [/* @__PURE__ */ S("button", {
662
+ type: "submit",
663
+ disabled: D.isPending,
664
+ className: "inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50 transition-opacity",
665
+ children: D.isPending ? "Saving…" : "Save changes"
666
+ }), /* @__PURE__ */ S("button", {
667
+ type: "button",
668
+ onClick: X,
669
+ className: "rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken transition-colors",
670
+ children: "Cancel"
671
+ })]
672
+ })
673
+ ]
674
+ })]
675
+ }),
676
+ /* @__PURE__ */ C("div", {
677
+ className: "grid grid-cols-1 gap-6 lg:grid-cols-3",
678
+ children: [/* @__PURE__ */ C("div", {
679
+ className: "space-y-6 lg:col-span-2",
680
+ children: [
681
+ /* @__PURE__ */ C(w, {
682
+ treatment: "metric",
683
+ className: "border-border-seam p-5",
684
+ children: [/* @__PURE__ */ C("div", {
685
+ className: "mb-4",
686
+ children: [/* @__PURE__ */ C("h2", {
687
+ className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
688
+ children: [/* @__PURE__ */ S(_, { className: "h-4 w-4" }), "Artwork & Media"]
689
+ }), /* @__PURE__ */ S("p", {
690
+ className: "mt-1 text-xs text-text-secondary",
691
+ children: "Poster and backdrop art, plus the trailer and full-length video master. Files are stored in the workspace files service; the title keeps only a reference."
150
692
  })]
151
- }, e.id))
152
- })]
153
- }),
154
- (M.seasons.length > 0 || M.episodes.length > 0) && /* @__PURE__ */ D(O, {
155
- treatment: "metric",
156
- className: "border-border-seam p-5",
157
- children: [/* @__PURE__ */ D("h2", {
158
- className: "mb-3 flex items-center gap-2 text-sm font-semibold text-text-primary",
693
+ }), /* @__PURE__ */ S("div", {
694
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4",
695
+ children: He.map((e) => /* @__PURE__ */ S(Ue, {
696
+ titleId: h.id,
697
+ config: e,
698
+ currentFileId: h[e.field]
699
+ }, e.field))
700
+ })]
701
+ }),
702
+ h.synopsis && /* @__PURE__ */ C(w, {
703
+ treatment: "metric",
704
+ className: "border-border-seam p-5",
705
+ children: [/* @__PURE__ */ S("h2", {
706
+ className: "mb-2 text-sm font-semibold text-text-primary",
707
+ children: "Synopsis"
708
+ }), /* @__PURE__ */ S("p", {
709
+ className: "text-sm leading-relaxed text-text-secondary",
710
+ children: h.synopsis
711
+ })]
712
+ }),
713
+ /* @__PURE__ */ C(w, {
714
+ treatment: "metric",
715
+ className: "border-border-seam p-5",
159
716
  children: [
160
- /* @__PURE__ */ E(y, { className: "h-4 w-4" }),
161
- "Episodes (",
162
- M.episodes.length,
163
- ")"
717
+ /* @__PURE__ */ C("div", {
718
+ className: "mb-3 flex items-center justify-between gap-3",
719
+ children: [/* @__PURE__ */ C("h2", {
720
+ className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
721
+ children: [
722
+ /* @__PURE__ */ S(je, { className: "h-4 w-4" }),
723
+ "Cast & Crew (",
724
+ h.credits.length,
725
+ ")"
726
+ ]
727
+ }), /* @__PURE__ */ C("button", {
728
+ type: "button",
729
+ onClick: () => {
730
+ P(null), V(B === "credit" ? "none" : "credit");
731
+ },
732
+ className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-2.5 py-1 text-xs font-medium text-text-primary hover:bg-bg-sunken transition-colors",
733
+ children: [/* @__PURE__ */ S(Ae, { className: "h-3.5 w-3.5" }), "Add credit"]
734
+ })]
735
+ }),
736
+ B === "credit" && /* @__PURE__ */ C("form", {
737
+ onSubmit: pn,
738
+ className: "mb-4 space-y-4 rounded-lg border border-border-seam bg-bg-surface p-4",
739
+ children: [
740
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
741
+ htmlFor: "credit-search",
742
+ className: E,
743
+ children: "Search people"
744
+ }), /* @__PURE__ */ S("input", {
745
+ id: "credit-search",
746
+ type: "text",
747
+ value: Nt,
748
+ onChange: (e) => Pt(e.target.value),
749
+ placeholder: "Type a name to filter…",
750
+ className: T
751
+ })] }),
752
+ /* @__PURE__ */ C("div", {
753
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
754
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
755
+ htmlFor: "credit-person",
756
+ className: E,
757
+ children: "Person *"
758
+ }), /* @__PURE__ */ C("select", {
759
+ id: "credit-person",
760
+ value: G,
761
+ onChange: (e) => Ft(e.target.value),
762
+ className: T,
763
+ required: !0,
764
+ children: [/* @__PURE__ */ S("option", {
765
+ value: "",
766
+ children: Vt.isLoading ? "Loading people…" : bn.length === 0 ? "No people found" : "Select a person"
767
+ }), bn.map((e) => /* @__PURE__ */ C("option", {
768
+ value: e.id,
769
+ children: [e.name, e.knownFor ? ` — ${e.knownFor}` : ""]
770
+ }, e.id))]
771
+ })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
772
+ htmlFor: "credit-role",
773
+ className: E,
774
+ children: "Role"
775
+ }), /* @__PURE__ */ S("select", {
776
+ id: "credit-role",
777
+ value: It,
778
+ onChange: (e) => Lt(e.target.value),
779
+ className: T,
780
+ children: Re.map((e) => /* @__PURE__ */ S("option", {
781
+ value: e,
782
+ children: d(e)
783
+ }, e))
784
+ })] })]
785
+ }),
786
+ /* @__PURE__ */ C("div", {
787
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
788
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
789
+ htmlFor: "credit-character",
790
+ className: E,
791
+ children: "Character name"
792
+ }), /* @__PURE__ */ S("input", {
793
+ id: "credit-character",
794
+ type: "text",
795
+ value: Rt,
796
+ onChange: (e) => zt(e.target.value),
797
+ placeholder: "e.g. Captain Rao",
798
+ className: T
799
+ })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
800
+ htmlFor: "credit-billing",
801
+ className: E,
802
+ children: "Billing order"
803
+ }), /* @__PURE__ */ S("input", {
804
+ id: "credit-billing",
805
+ type: "number",
806
+ value: K,
807
+ onChange: (e) => Bt(e.target.value),
808
+ placeholder: "1",
809
+ className: T
810
+ })] })]
811
+ }),
812
+ /* @__PURE__ */ C("div", {
813
+ className: "flex items-center gap-3",
814
+ children: [/* @__PURE__ */ C("button", {
815
+ type: "submit",
816
+ disabled: O.isPending,
817
+ className: "inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50 transition-opacity",
818
+ children: [/* @__PURE__ */ S(y, { className: "h-4 w-4" }), O.isPending ? "Adding…" : "Add credit"]
819
+ }), /* @__PURE__ */ S("button", {
820
+ type: "button",
821
+ onClick: X,
822
+ className: "rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken transition-colors",
823
+ children: "Cancel"
824
+ })]
825
+ })
826
+ ]
827
+ }),
828
+ h.credits.length === 0 ? /* @__PURE__ */ S("p", {
829
+ className: "text-sm text-text-secondary",
830
+ children: "No credits recorded yet."
831
+ }) : /* @__PURE__ */ S("ul", {
832
+ className: "divide-y divide-border-seam",
833
+ children: [...h.credits].sort((e, t) => e.billingOrder - t.billingOrder).map((e) => /* @__PURE__ */ C("li", {
834
+ className: "flex items-center justify-between py-2",
835
+ children: [/* @__PURE__ */ C("div", {
836
+ className: "min-w-0",
837
+ children: [/* @__PURE__ */ S("p", {
838
+ className: "truncate text-sm font-medium text-text-primary",
839
+ children: e.person?.name ?? "Unknown person"
840
+ }), e.characterName && /* @__PURE__ */ C("p", {
841
+ className: "text-xs text-text-secondary",
842
+ children: ["as ", e.characterName]
843
+ })]
844
+ }), /* @__PURE__ */ S("span", {
845
+ className: "rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary",
846
+ children: d(e.role)
847
+ })]
848
+ }, e.id))
849
+ })
164
850
  ]
165
- }), /* @__PURE__ */ E("ul", {
166
- className: "divide-y divide-border-seam",
167
- children: [...M.episodes].sort((e, t) => e.number - t.number).map((e) => /* @__PURE__ */ D("li", {
168
- className: "flex items-center justify-between py-2",
169
- children: [/* @__PURE__ */ D("div", {
170
- className: "min-w-0",
171
- children: [/* @__PURE__ */ D("p", {
172
- className: "truncate text-sm font-medium text-text-primary",
851
+ }),
852
+ /* @__PURE__ */ C(w, {
853
+ treatment: "metric",
854
+ className: "border-border-seam p-5",
855
+ children: [
856
+ /* @__PURE__ */ C("div", {
857
+ className: "mb-3 flex flex-wrap items-center justify-between gap-3",
858
+ children: [/* @__PURE__ */ C("h2", {
859
+ className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
173
860
  children: [
174
- e.number,
175
- ". ",
176
- e.name
861
+ /* @__PURE__ */ S(Ce, { className: "h-4 w-4" }),
862
+ "Episodes (",
863
+ h.episodes.length,
864
+ ")"
177
865
  ]
178
- }), e.synopsis && /* @__PURE__ */ E("p", {
179
- className: "line-clamp-1 text-xs text-text-secondary",
180
- children: e.synopsis
866
+ }), Y && /* @__PURE__ */ C("div", {
867
+ className: "flex items-center gap-2",
868
+ children: [/* @__PURE__ */ C("button", {
869
+ type: "button",
870
+ onClick: () => {
871
+ P(null), V(B === "season" ? "none" : "season");
872
+ },
873
+ className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-2.5 py-1 text-xs font-medium text-text-primary hover:bg-bg-sunken transition-colors",
874
+ children: [/* @__PURE__ */ S(y, { className: "h-3.5 w-3.5" }), "Add season"]
875
+ }), /* @__PURE__ */ C("button", {
876
+ type: "button",
877
+ onClick: () => {
878
+ P(null), V(B === "episode" ? "none" : "episode");
879
+ },
880
+ className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-2.5 py-1 text-xs font-medium text-text-primary hover:bg-bg-sunken transition-colors",
881
+ children: [/* @__PURE__ */ S(y, { className: "h-3.5 w-3.5" }), "Add episode"]
882
+ })]
181
883
  })]
182
- }), e.runtimeMinutes && /* @__PURE__ */ D("span", {
183
- className: "text-xs text-text-secondary",
184
- children: [e.runtimeMinutes, " min"]
884
+ }),
885
+ Y && B === "season" && /* @__PURE__ */ C("form", {
886
+ onSubmit: mn,
887
+ className: "mb-4 space-y-4 rounded-lg border border-border-seam bg-bg-surface p-4",
888
+ children: [
889
+ /* @__PURE__ */ C("div", {
890
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
891
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
892
+ htmlFor: "season-number",
893
+ className: E,
894
+ children: "Season number *"
895
+ }), /* @__PURE__ */ S("input", {
896
+ id: "season-number",
897
+ type: "number",
898
+ value: q,
899
+ onChange: (e) => Ht(e.target.value),
900
+ placeholder: "1",
901
+ className: T,
902
+ required: !0
903
+ })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
904
+ htmlFor: "season-name",
905
+ className: E,
906
+ children: "Name"
907
+ }), /* @__PURE__ */ S("input", {
908
+ id: "season-name",
909
+ type: "text",
910
+ value: Ut,
911
+ onChange: (e) => Wt(e.target.value),
912
+ placeholder: "Season 1",
913
+ className: T
914
+ })] })]
915
+ }),
916
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
917
+ htmlFor: "season-synopsis",
918
+ className: E,
919
+ children: "Synopsis"
920
+ }), /* @__PURE__ */ S("textarea", {
921
+ id: "season-synopsis",
922
+ value: Gt,
923
+ onChange: (e) => Kt(e.target.value),
924
+ rows: 3,
925
+ className: T
926
+ })] }),
927
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
928
+ htmlFor: "season-airdate",
929
+ className: E,
930
+ children: "Air date"
931
+ }), /* @__PURE__ */ S("input", {
932
+ id: "season-airdate",
933
+ type: "date",
934
+ value: qt,
935
+ onChange: (e) => Jt(e.target.value),
936
+ className: T
937
+ })] }),
938
+ /* @__PURE__ */ C("div", {
939
+ className: "flex items-center gap-3",
940
+ children: [/* @__PURE__ */ C("button", {
941
+ type: "submit",
942
+ disabled: k.isPending,
943
+ className: "inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50 transition-opacity",
944
+ children: [/* @__PURE__ */ S(y, { className: "h-4 w-4" }), k.isPending ? "Adding…" : "Add season"]
945
+ }), /* @__PURE__ */ S("button", {
946
+ type: "button",
947
+ onClick: X,
948
+ className: "rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken transition-colors",
949
+ children: "Cancel"
950
+ })]
951
+ })
952
+ ]
953
+ }),
954
+ Y && B === "episode" && /* @__PURE__ */ C("form", {
955
+ onSubmit: hn,
956
+ className: "mb-4 space-y-4 rounded-lg border border-border-seam bg-bg-surface p-4",
957
+ children: [
958
+ /* @__PURE__ */ C("div", {
959
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
960
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
961
+ htmlFor: "episode-season",
962
+ className: E,
963
+ children: "Season"
964
+ }), /* @__PURE__ */ C("select", {
965
+ id: "episode-season",
966
+ value: Yt,
967
+ onChange: (e) => Xt(e.target.value),
968
+ className: T,
969
+ children: [/* @__PURE__ */ S("option", {
970
+ value: "",
971
+ children: "No season"
972
+ }), [...h.seasons].sort((e, t) => e.number - t.number).map((e) => /* @__PURE__ */ S("option", {
973
+ value: e.id,
974
+ children: e.name ? `${e.number}. ${e.name}` : `Season ${e.number}`
975
+ }, e.id))]
976
+ })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
977
+ htmlFor: "episode-number",
978
+ className: E,
979
+ children: "Episode number *"
980
+ }), /* @__PURE__ */ S("input", {
981
+ id: "episode-number",
982
+ type: "number",
983
+ value: J,
984
+ onChange: (e) => Zt(e.target.value),
985
+ placeholder: "1",
986
+ className: T,
987
+ required: !0
988
+ })] })]
989
+ }),
990
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
991
+ htmlFor: "episode-name",
992
+ className: E,
993
+ children: "Name *"
994
+ }), /* @__PURE__ */ S("input", {
995
+ id: "episode-name",
996
+ type: "text",
997
+ value: Qt,
998
+ onChange: (e) => $t(e.target.value),
999
+ placeholder: "Pilot",
1000
+ className: T,
1001
+ required: !0
1002
+ })] }),
1003
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
1004
+ htmlFor: "episode-synopsis",
1005
+ className: E,
1006
+ children: "Synopsis"
1007
+ }), /* @__PURE__ */ S("textarea", {
1008
+ id: "episode-synopsis",
1009
+ value: en,
1010
+ onChange: (e) => tn(e.target.value),
1011
+ rows: 3,
1012
+ className: T
1013
+ })] }),
1014
+ /* @__PURE__ */ C("div", {
1015
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
1016
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
1017
+ htmlFor: "episode-runtime",
1018
+ className: E,
1019
+ children: "Runtime (minutes)"
1020
+ }), /* @__PURE__ */ S("input", {
1021
+ id: "episode-runtime",
1022
+ type: "number",
1023
+ value: nn,
1024
+ onChange: (e) => rn(e.target.value),
1025
+ placeholder: "45",
1026
+ className: T
1027
+ })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
1028
+ htmlFor: "episode-airdate",
1029
+ className: E,
1030
+ children: "Air date"
1031
+ }), /* @__PURE__ */ S("input", {
1032
+ id: "episode-airdate",
1033
+ type: "date",
1034
+ value: an,
1035
+ onChange: (e) => on(e.target.value),
1036
+ className: T
1037
+ })] })]
1038
+ }),
1039
+ /* @__PURE__ */ C("div", {
1040
+ className: "flex items-center gap-3",
1041
+ children: [/* @__PURE__ */ C("button", {
1042
+ type: "submit",
1043
+ disabled: A.isPending,
1044
+ className: "inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50 transition-opacity",
1045
+ children: [/* @__PURE__ */ S(y, { className: "h-4 w-4" }), A.isPending ? "Adding…" : "Add episode"]
1046
+ }), /* @__PURE__ */ S("button", {
1047
+ type: "button",
1048
+ onClick: X,
1049
+ className: "rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken transition-colors",
1050
+ children: "Cancel"
1051
+ })]
1052
+ })
1053
+ ]
1054
+ }),
1055
+ h.episodes.length === 0 ? /* @__PURE__ */ S("p", {
1056
+ className: "text-sm text-text-secondary",
1057
+ children: Y ? "No episodes yet. Add a season, then episodes, to build out this series." : "No episodes recorded for this title."
1058
+ }) : /* @__PURE__ */ S("ul", {
1059
+ className: "divide-y divide-border-seam",
1060
+ children: [...h.episodes].sort((e, t) => e.number - t.number).map((e) => /* @__PURE__ */ C("li", {
1061
+ className: "flex items-center justify-between py-2",
1062
+ children: [/* @__PURE__ */ C("div", {
1063
+ className: "min-w-0",
1064
+ children: [/* @__PURE__ */ C("p", {
1065
+ className: "truncate text-sm font-medium text-text-primary",
1066
+ children: [
1067
+ e.number,
1068
+ ". ",
1069
+ e.name
1070
+ ]
1071
+ }), e.synopsis && /* @__PURE__ */ S("p", {
1072
+ className: "line-clamp-1 text-xs text-text-secondary",
1073
+ children: e.synopsis
1074
+ })]
1075
+ }), e.runtimeMinutes && /* @__PURE__ */ C("span", {
1076
+ className: "text-xs text-text-secondary",
1077
+ children: [e.runtimeMinutes, " min"]
1078
+ })]
1079
+ }, e.id))
1080
+ })
1081
+ ]
1082
+ }),
1083
+ /* @__PURE__ */ C(w, {
1084
+ treatment: "metric",
1085
+ className: "border-border-seam p-5",
1086
+ children: [/* @__PURE__ */ C("div", {
1087
+ className: "mb-3 flex items-center justify-between",
1088
+ children: [/* @__PURE__ */ C("h2", {
1089
+ className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
1090
+ children: [
1091
+ /* @__PURE__ */ S(ke, { className: "h-4 w-4" }),
1092
+ "Reviews (",
1093
+ Z.length,
1094
+ ")"
1095
+ ]
1096
+ }), yn !== null && /* @__PURE__ */ S(me, {
1097
+ value: yn / 2,
1098
+ count: Z.length
185
1099
  })]
186
- }, e.id))
187
- })]
188
- }),
189
- /* @__PURE__ */ D(O, {
190
- treatment: "metric",
191
- className: "border-border-seam p-5",
192
- children: [/* @__PURE__ */ D("div", {
193
- className: "mb-3 flex items-center justify-between",
194
- children: [/* @__PURE__ */ D("h2", {
195
- className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
196
- children: [
197
- /* @__PURE__ */ E(S, { className: "h-4 w-4" }),
198
- "Reviews (",
199
- U.length,
200
- ")"
201
- ]
202
- }), W !== null && /* @__PURE__ */ E(d, {
203
- value: W / 2,
204
- count: U.length
1100
+ }), Z.length === 0 ? /* @__PURE__ */ S("p", {
1101
+ className: "text-sm text-text-secondary",
1102
+ children: "No reviews yet."
1103
+ }) : /* @__PURE__ */ S("ul", {
1104
+ className: "space-y-3",
1105
+ children: Z.map((e) => /* @__PURE__ */ C("li", {
1106
+ className: "rounded-lg border border-border-seam bg-bg-surface p-3",
1107
+ children: [/* @__PURE__ */ C("div", {
1108
+ className: "flex items-center justify-between",
1109
+ children: [/* @__PURE__ */ C("span", {
1110
+ className: "text-sm font-semibold text-text-primary",
1111
+ children: [e.score, "/10"]
1112
+ }), /* @__PURE__ */ C("div", {
1113
+ className: "flex items-center gap-2",
1114
+ children: [e.verifiedWatch && /* @__PURE__ */ S("span", {
1115
+ className: "rounded-full bg-status-success-bg-subtle px-2 py-0.5 text-[10px] text-status-success-text",
1116
+ children: "Verified"
1117
+ }), /* @__PURE__ */ S(r, { status: e.status })]
1118
+ })]
1119
+ }), e.body && /* @__PURE__ */ S("p", {
1120
+ className: "mt-1 text-sm text-text-secondary",
1121
+ children: e.body
1122
+ })]
1123
+ }, e.id))
205
1124
  })]
206
- }), U.length === 0 ? /* @__PURE__ */ E("p", {
207
- className: "text-sm text-text-secondary",
208
- children: "No reviews yet."
209
- }) : /* @__PURE__ */ E("ul", {
210
- className: "space-y-3",
211
- children: U.map((e) => /* @__PURE__ */ D("li", {
212
- className: "rounded-lg border border-border-seam bg-bg-surface p-3",
213
- children: [/* @__PURE__ */ D("div", {
214
- className: "flex items-center justify-between",
215
- children: [/* @__PURE__ */ D("span", {
216
- className: "text-sm font-semibold text-text-primary",
217
- children: [e.score, "/10"]
218
- }), /* @__PURE__ */ D("div", {
219
- className: "flex items-center gap-2",
220
- children: [e.verifiedWatch && /* @__PURE__ */ E("span", {
221
- className: "rounded-full bg-status-success-bg-subtle px-2 py-0.5 text-[10px] text-status-success-text",
222
- children: "Verified"
223
- }), /* @__PURE__ */ E(n, { status: e.status })]
1125
+ }),
1126
+ /* @__PURE__ */ C(w, {
1127
+ treatment: "metric",
1128
+ className: "border-border-seam p-5",
1129
+ children: [
1130
+ /* @__PURE__ */ C("div", {
1131
+ className: "mb-3 flex flex-wrap items-center justify-between gap-3",
1132
+ children: [/* @__PURE__ */ C("h2", {
1133
+ className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
1134
+ children: [
1135
+ /* @__PURE__ */ S(Me, { className: "h-4 w-4" }),
1136
+ "Clips (",
1137
+ N.data?.totalCount ?? Q.length,
1138
+ ")"
1139
+ ]
1140
+ }), /* @__PURE__ */ C("button", {
1141
+ type: "button",
1142
+ onClick: () => {
1143
+ R(null), F((e) => !e);
1144
+ },
1145
+ className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-2.5 py-1 text-xs font-medium text-text-primary transition-colors hover:bg-bg-sunken",
1146
+ children: [/* @__PURE__ */ S(y, { className: "h-3.5 w-3.5" }), "Add clip"]
224
1147
  })]
225
- }), e.body && /* @__PURE__ */ E("p", {
226
- className: "mt-1 text-sm text-text-secondary",
227
- children: e.body
1148
+ }),
1149
+ et && /* @__PURE__ */ C("form", {
1150
+ onSubmit: _n,
1151
+ className: "mb-4 space-y-4 rounded-lg border border-border-seam bg-bg-surface p-4",
1152
+ children: [
1153
+ /* @__PURE__ */ C("div", { children: [
1154
+ /* @__PURE__ */ S("label", {
1155
+ htmlFor: "clip-file",
1156
+ className: E,
1157
+ children: "Clip video * (short vertical MP4)"
1158
+ }),
1159
+ /* @__PURE__ */ S("input", {
1160
+ id: "clip-file",
1161
+ ref: z,
1162
+ type: "file",
1163
+ accept: "video/*",
1164
+ onChange: (e) => tt(e.target.files?.[0] ?? null),
1165
+ className: T
1166
+ }),
1167
+ I && /* @__PURE__ */ C("p", {
1168
+ className: "mt-1 truncate text-xs text-text-secondary",
1169
+ children: ["Selected: ", I.name]
1170
+ })
1171
+ ] }),
1172
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
1173
+ htmlFor: "clip-caption",
1174
+ className: E,
1175
+ children: "Caption"
1176
+ }), /* @__PURE__ */ S("input", {
1177
+ id: "clip-caption",
1178
+ type: "text",
1179
+ value: nt,
1180
+ onChange: (e) => rt(e.target.value),
1181
+ placeholder: "e.g. Official teaser",
1182
+ className: T
1183
+ })] }),
1184
+ /* @__PURE__ */ C("div", {
1185
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
1186
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
1187
+ htmlFor: "clip-duration",
1188
+ className: E,
1189
+ children: "Duration (seconds)"
1190
+ }), /* @__PURE__ */ S("input", {
1191
+ id: "clip-duration",
1192
+ type: "number",
1193
+ min: 0,
1194
+ value: L,
1195
+ onChange: (e) => it(e.target.value),
1196
+ placeholder: "30",
1197
+ className: T
1198
+ })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
1199
+ htmlFor: "clip-language",
1200
+ className: E,
1201
+ children: "Language"
1202
+ }), /* @__PURE__ */ S("input", {
1203
+ id: "clip-language",
1204
+ type: "text",
1205
+ value: at,
1206
+ onChange: (e) => ot(e.target.value),
1207
+ placeholder: "en",
1208
+ className: T
1209
+ })] })]
1210
+ }),
1211
+ lt && /* @__PURE__ */ S("p", {
1212
+ className: "text-xs text-status-error-text",
1213
+ children: lt
1214
+ }),
1215
+ /* @__PURE__ */ C("div", {
1216
+ className: "flex items-center gap-3",
1217
+ children: [/* @__PURE__ */ C("button", {
1218
+ type: "submit",
1219
+ disabled: st,
1220
+ className: "inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-opacity hover:opacity-90 disabled:opacity-50",
1221
+ children: [/* @__PURE__ */ S(x, { className: "h-4 w-4" }), st ? "Uploading…" : "Add clip"]
1222
+ }), /* @__PURE__ */ S("button", {
1223
+ type: "button",
1224
+ onClick: () => {
1225
+ F(!1), R(null);
1226
+ },
1227
+ className: "rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken",
1228
+ children: "Cancel"
1229
+ })]
1230
+ })
1231
+ ]
1232
+ }),
1233
+ N.isLoading ? /* @__PURE__ */ S(de, {
1234
+ label: "Loading clips…",
1235
+ className: "min-h-[20vh]"
1236
+ }) : N.isError ? /* @__PURE__ */ S(ue, {
1237
+ title: "Could not load clips",
1238
+ message: "Something went wrong fetching this title's clips.",
1239
+ onRetry: () => void N.refetch(),
1240
+ className: "min-h-[20vh]"
1241
+ }) : Q.length === 0 ? /* @__PURE__ */ S(fe, {
1242
+ title: "No clips yet",
1243
+ description: "Upload a short vertical clip to promote this title."
1244
+ }) : /* @__PURE__ */ C(Fe, { children: [/* @__PURE__ */ S("div", {
1245
+ className: "grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4",
1246
+ children: Q.map((e) => /* @__PURE__ */ S(We, {
1247
+ clip: e,
1248
+ deleting: ut === e.id,
1249
+ onDelete: (e) => void vn(e)
1250
+ }, e.id))
1251
+ }), /* @__PURE__ */ S(pe, {
1252
+ page: Ye,
1253
+ hasMore: N.data?.pageInfo.hasMore ?? !1,
1254
+ shownCount: Q.length,
1255
+ onPageChange: Xe
1256
+ })] })
1257
+ ]
1258
+ })
1259
+ ]
1260
+ }), /* @__PURE__ */ C("div", {
1261
+ className: "space-y-6",
1262
+ children: [
1263
+ /* @__PURE__ */ C(w, {
1264
+ treatment: "metric",
1265
+ className: "border-border-seam p-5",
1266
+ children: [/* @__PURE__ */ C("h2", {
1267
+ className: "mb-3 flex items-center gap-2 text-sm font-semibold text-text-primary",
1268
+ children: [/* @__PURE__ */ S(Ee, { className: "h-4 w-4" }), "Watch"]
1269
+ }), M.isLoading ? /* @__PURE__ */ S("p", {
1270
+ className: "text-sm text-text-secondary",
1271
+ children: "Checking access…"
1272
+ }) : M.isError ? /* @__PURE__ */ C("div", {
1273
+ className: "space-y-2",
1274
+ children: [/* @__PURE__ */ S("p", {
1275
+ className: "text-sm text-status-error-text",
1276
+ children: "Could not check entitlement."
1277
+ }), /* @__PURE__ */ S("button", {
1278
+ type: "button",
1279
+ onClick: () => void M.refetch(),
1280
+ className: "rounded-lg border border-border-seam px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken transition-colors",
1281
+ children: "Retry"
228
1282
  })]
229
- }, e.id))
230
- })]
231
- })
232
- ]
233
- }), /* @__PURE__ */ D("div", {
234
- className: "space-y-6",
235
- children: [
236
- /* @__PURE__ */ D(O, {
237
- treatment: "metric",
238
- className: "border-border-seam p-5",
239
- children: [
240
- /* @__PURE__ */ E("h2", {
241
- className: "mb-3 text-sm font-semibold text-text-primary",
242
- children: "Publication"
243
- }),
244
- /* @__PURE__ */ D("div", {
245
- className: "flex flex-wrap gap-2",
246
- children: [k[M.status].map((e) => /* @__PURE__ */ E("button", {
1283
+ }) : M.data?.entitled ? /* @__PURE__ */ C("div", {
1284
+ className: "space-y-3",
1285
+ children: [M.data.modes.length > 0 && /* @__PURE__ */ S("div", {
1286
+ className: "flex flex-wrap gap-1.5",
1287
+ children: M.data.modes.map((e) => /* @__PURE__ */ S("span", {
1288
+ className: "rounded-full bg-status-success-bg-subtle px-2.5 py-0.5 text-xs text-status-success-text",
1289
+ children: d(e)
1290
+ }, e))
1291
+ }), sn ? /* @__PURE__ */ C("p", {
1292
+ className: "flex items-center gap-2 text-sm text-status-success-text",
1293
+ children: [/* @__PURE__ */ S(ye, { className: "h-4 w-4" }), "Marked as watched — see Continue Watching."]
1294
+ }) : /* @__PURE__ */ C("button", {
247
1295
  type: "button",
248
- disabled: I.isPending,
249
- onClick: () => void V(e),
250
- className: "rounded-lg bg-action-primary-bg px-3 py-1.5 text-xs font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50 transition-opacity",
251
- children: c(e)
252
- }, e)), k[M.status].length === 0 && /* @__PURE__ */ E("p", {
253
- className: "text-xs text-text-secondary",
254
- children: "No further transitions available."
1296
+ disabled: j.isPending,
1297
+ onClick: () => void gn(),
1298
+ className: "inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50 transition-opacity",
1299
+ children: [/* @__PURE__ */ S(Ee, { className: "h-4 w-4" }), j.isPending ? "Saving…" : "Mark as watched"]
255
1300
  })]
256
- }),
257
- M.status !== "ARCHIVED" && /* @__PURE__ */ D("button", {
258
- type: "button",
259
- disabled: L.isPending,
260
- onClick: () => void H(),
261
- className: "mt-3 inline-flex items-center gap-2 rounded-lg border border-status-error-border px-3 py-1.5 text-xs font-medium text-status-error-text hover:bg-status-error-bg-subtle disabled:opacity-50 transition-colors",
262
- children: [/* @__PURE__ */ E(p, { className: "h-3.5 w-3.5" }), "Archive Title"]
263
- })
264
- ]
265
- }),
266
- /* @__PURE__ */ D(O, {
267
- treatment: "metric",
268
- className: "border-border-seam p-5",
269
- children: [/* @__PURE__ */ E("h2", {
270
- className: "mb-3 text-sm font-semibold text-text-primary",
271
- children: "Details"
272
- }), /* @__PURE__ */ D("dl", {
273
- className: "space-y-2",
274
- children: [G.map((e) => {
275
- let t = e.icon;
276
- return /* @__PURE__ */ D("div", {
277
- className: "flex items-center justify-between text-sm",
278
- children: [/* @__PURE__ */ D("dt", {
279
- className: "flex items-center gap-2 text-text-secondary",
280
- children: [/* @__PURE__ */ E(t, { className: "h-3.5 w-3.5" }), e.label]
281
- }), /* @__PURE__ */ E("dd", {
282
- className: "font-medium text-text-primary",
283
- children: e.value
1301
+ }) : /* @__PURE__ */ C("div", {
1302
+ className: "flex items-start gap-2 rounded-lg border border-border-seam bg-bg-sunken px-3 py-2.5",
1303
+ children: [/* @__PURE__ */ S(we, { className: "mt-0.5 h-4 w-4 shrink-0 text-text-secondary" }), /* @__PURE__ */ S("p", {
1304
+ className: "text-sm text-text-secondary",
1305
+ children: "You are not entitled to watch this title. Grant an entitlement or add a rights window to enable playback."
1306
+ })]
1307
+ })]
1308
+ }),
1309
+ /* @__PURE__ */ C(w, {
1310
+ treatment: "metric",
1311
+ className: "border-border-seam p-5",
1312
+ children: [
1313
+ /* @__PURE__ */ S("h2", {
1314
+ className: "mb-3 text-sm font-semibold text-text-primary",
1315
+ children: "Publication"
1316
+ }),
1317
+ /* @__PURE__ */ C("div", {
1318
+ className: "flex flex-wrap gap-2",
1319
+ children: [Ie[h.status].map((e) => /* @__PURE__ */ S("button", {
1320
+ type: "button",
1321
+ disabled: Ve.isPending,
1322
+ onClick: () => void un(e),
1323
+ className: "rounded-lg bg-action-primary-bg px-3 py-1.5 text-xs font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50 transition-opacity",
1324
+ children: d(e)
1325
+ }, e)), Ie[h.status].length === 0 && /* @__PURE__ */ S("p", {
1326
+ className: "text-xs text-text-secondary",
1327
+ children: "No further transitions available."
284
1328
  })]
285
- }, e.label);
286
- }), M.aiDisclosure && /* @__PURE__ */ D("div", {
287
- className: "flex items-center gap-2 pt-1 text-sm text-text-secondary",
288
- children: [/* @__PURE__ */ E(x, { className: "h-3.5 w-3.5" }), "Contains AI-generated content"]
1329
+ }),
1330
+ h.status !== "ARCHIVED" && /* @__PURE__ */ C("button", {
1331
+ type: "button",
1332
+ disabled: Ke.isPending,
1333
+ onClick: () => void dn(),
1334
+ className: "mt-3 inline-flex items-center gap-2 rounded-lg border border-status-error-border px-3 py-1.5 text-xs font-medium text-status-error-text hover:bg-status-error-bg-subtle disabled:opacity-50 transition-colors",
1335
+ children: [/* @__PURE__ */ S(ge, { className: "h-3.5 w-3.5" }), "Archive Title"]
1336
+ })
1337
+ ]
1338
+ }),
1339
+ /* @__PURE__ */ C(w, {
1340
+ treatment: "metric",
1341
+ className: "border-border-seam p-5",
1342
+ children: [/* @__PURE__ */ S("h2", {
1343
+ className: "mb-3 text-sm font-semibold text-text-primary",
1344
+ children: "Details"
1345
+ }), /* @__PURE__ */ C("dl", {
1346
+ className: "space-y-2",
1347
+ children: [$.map((e) => {
1348
+ let t = e.icon;
1349
+ return /* @__PURE__ */ C("div", {
1350
+ className: "flex items-center justify-between text-sm",
1351
+ children: [/* @__PURE__ */ C("dt", {
1352
+ className: "flex items-center gap-2 text-text-secondary",
1353
+ children: [/* @__PURE__ */ S(t, { className: "h-3.5 w-3.5" }), e.label]
1354
+ }), /* @__PURE__ */ S("dd", {
1355
+ className: "font-medium text-text-primary",
1356
+ children: e.value
1357
+ })]
1358
+ }, e.label);
1359
+ }), h.aiDisclosure && /* @__PURE__ */ C("div", {
1360
+ className: "flex items-center gap-2 pt-1 text-sm text-text-secondary",
1361
+ children: [/* @__PURE__ */ S(Oe, { className: "h-3.5 w-3.5" }), "Contains AI-generated content"]
1362
+ })]
289
1363
  })]
290
- })]
291
- }),
292
- (M.genres.length > 0 || M.tags.length > 0) && /* @__PURE__ */ D(O, {
293
- treatment: "metric",
294
- className: "border-border-seam p-5",
295
- children: [M.genres.length > 0 && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("h3", {
296
- className: "mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",
297
- children: "Genres"
298
- }), /* @__PURE__ */ E("div", {
299
- className: "mb-3 flex flex-wrap gap-1.5",
300
- children: M.genres.map((e) => /* @__PURE__ */ E("span", {
301
- className: "rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-primary",
302
- children: e
303
- }, e))
304
- })] }), M.tags.length > 0 && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("h3", {
305
- className: "mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",
306
- children: "Tags"
307
- }), /* @__PURE__ */ E("div", {
308
- className: "flex flex-wrap gap-1.5",
309
- children: M.tags.map((e) => /* @__PURE__ */ E("span", {
310
- className: "rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary",
311
- children: e
312
- }, e))
313
- })] })]
314
- })
315
- ]
316
- })]
317
- })]
1364
+ }),
1365
+ (h.genres.length > 0 || h.tags.length > 0) && /* @__PURE__ */ C(w, {
1366
+ treatment: "metric",
1367
+ className: "border-border-seam p-5",
1368
+ children: [h.genres.length > 0 && /* @__PURE__ */ C(Fe, { children: [/* @__PURE__ */ S("h3", {
1369
+ className: "mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",
1370
+ children: "Genres"
1371
+ }), /* @__PURE__ */ S("div", {
1372
+ className: "mb-3 flex flex-wrap gap-1.5",
1373
+ children: h.genres.map((e) => /* @__PURE__ */ S("span", {
1374
+ className: "rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-primary",
1375
+ children: e
1376
+ }, e))
1377
+ })] }), h.tags.length > 0 && /* @__PURE__ */ C(Fe, { children: [/* @__PURE__ */ S("h3", {
1378
+ className: "mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",
1379
+ children: "Tags"
1380
+ }), /* @__PURE__ */ S("div", {
1381
+ className: "flex flex-wrap gap-1.5",
1382
+ children: h.tags.map((e) => /* @__PURE__ */ S("span", {
1383
+ className: "rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary",
1384
+ children: e
1385
+ }, e))
1386
+ })] })]
1387
+ })
1388
+ ]
1389
+ })]
1390
+ })
1391
+ ]
318
1392
  });
319
1393
  };
320
1394
  //#endregion
321
- export { A as TitleDetailPage };
1395
+ export { Ke as TitleDetailPage };
322
1396
 
323
1397
  //# sourceMappingURL=TitleDetailPage.js.map