@openrails/contentkit-ui 0.103.0 → 0.103.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 (65) hide show
  1. package/README.md +6 -4
  2. package/dist/components/admin/content-manager.d.ts +1 -1
  3. package/dist/components/admin/content-manager.js +346 -304
  4. package/dist/components/admin/content-manager.js.map +1 -1
  5. package/dist/components/admin/page-review.js +106 -97
  6. package/dist/components/admin/page-review.js.map +1 -1
  7. package/dist/components/admin/reader-content-editor.d.ts +6 -0
  8. package/dist/components/admin/reader-content-editor.js +709 -0
  9. package/dist/components/admin/reader-content-editor.js.map +1 -0
  10. package/dist/components/admin/reader-manifest.js +120 -105
  11. package/dist/components/admin/reader-manifest.js.map +1 -1
  12. package/dist/components/content/editor-save.d.ts +32 -0
  13. package/dist/components/content/editor-save.js +51 -0
  14. package/dist/components/content/editor-save.js.map +1 -0
  15. package/dist/components/content/editors.d.ts +17 -2
  16. package/dist/components/content/editors.js +359 -328
  17. package/dist/components/content/editors.js.map +1 -1
  18. package/dist/components/content/offer-fields.d.ts +1 -1
  19. package/dist/components/content/offer-fields.js +86 -64
  20. package/dist/components/content/offer-fields.js.map +1 -1
  21. package/dist/components/content/release-date-picker.d.ts +4 -4
  22. package/dist/components/content/release-date-picker.js +106 -48
  23. package/dist/components/content/release-date-picker.js.map +1 -1
  24. package/dist/components/groups/memberships.d.ts +11 -1
  25. package/dist/components/groups/memberships.js +1 -1
  26. package/dist/components/groups/memberships.js.map +1 -1
  27. package/dist/components/media-folder-editor.d.ts +4 -0
  28. package/dist/components/media-folder-editor.js +177 -167
  29. package/dist/components/media-folder-editor.js.map +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/locales/admin/de.js +25 -0
  32. package/dist/locales/admin/de.js.map +1 -1
  33. package/dist/locales/admin/en.d.ts +25 -0
  34. package/dist/locales/admin/en.js +25 -0
  35. package/dist/locales/admin/en.js.map +1 -1
  36. package/dist/locales/admin/es.js +25 -0
  37. package/dist/locales/admin/es.js.map +1 -1
  38. package/dist/locales/admin/ja.js +25 -0
  39. package/dist/locales/admin/ja.js.map +1 -1
  40. package/dist/locales/admin/ko.js +25 -0
  41. package/dist/locales/admin/ko.js.map +1 -1
  42. package/dist/locales/admin/zh.js +25 -0
  43. package/dist/locales/admin/zh.js.map +1 -1
  44. package/dist/locales/discovery/de.js +1 -2
  45. package/dist/locales/discovery/de.js.map +1 -1
  46. package/dist/locales/discovery/en.d.ts +1 -2
  47. package/dist/locales/discovery/en.js +1 -2
  48. package/dist/locales/discovery/en.js.map +1 -1
  49. package/dist/locales/discovery/es.js +1 -2
  50. package/dist/locales/discovery/es.js.map +1 -1
  51. package/dist/locales/discovery/ja.js +1 -2
  52. package/dist/locales/discovery/ja.js.map +1 -1
  53. package/dist/locales/discovery/ko.js +1 -2
  54. package/dist/locales/discovery/ko.js.map +1 -1
  55. package/dist/locales/discovery/zh.js +1 -2
  56. package/dist/locales/discovery/zh.js.map +1 -1
  57. package/dist/locales/en.d.ts +26 -2
  58. package/dist/react/page-review.d.ts +1 -1
  59. package/dist/react/page-review.js +6 -5
  60. package/dist/react/page-review.js.map +1 -1
  61. package/dist/react/use-draft.d.ts +8 -0
  62. package/dist/react/use-draft.js +35 -0
  63. package/dist/react/use-draft.js.map +1 -0
  64. package/dist/styles.css +1 -1
  65. package/package.json +2 -1
@@ -6,16 +6,17 @@ import { Input as i } from "../../ui/input.js";
6
6
  import { Label as a } from "../../ui/label.js";
7
7
  import { Select as o, SelectContent as s, SelectItem as c, SelectTrigger as l, SelectValue as u } from "../../ui/select.js";
8
8
  import { ErrorLine as d, useAction as f } from "../social/parts.js";
9
- import { LoadFailed as p, Rows as m } from "./shell.js";
10
- import { Switch as h } from "../../ui/switch.js";
9
+ import { LoadFailed as p, Rows as ee } from "./shell.js";
10
+ import { Switch as m } from "../../ui/switch.js";
11
+ import { useEditorSaveTask as h } from "../content/editor-save.js";
11
12
  import { emptyReaderMeta as g, matchAudio as _, readerMetaProblems as v, readerNames as y } from "../../client/reader-meta.js";
12
13
  import { useReaderPlan as b } from "../../react/versions.js";
13
- import { useId as x, useMemo as S, useState as C } from "react";
14
- import { jsx as w, jsxs as T } from "react/jsx-runtime";
15
- import { cn as E } from "cn";
14
+ import { useId as x, useMemo as S, useRef as C, useState as w } from "react";
15
+ import { jsx as T, jsxs as E } from "react/jsx-runtime";
16
+ import { cn as D } from "cn";
16
17
  //#region src/components/admin/reader-manifest.tsx
17
- var D = "__none__", O = (e, t) => t === void 0 ? e === void 0 ? D : `page:${e}` : `anchor:${t}`, k = (e) => e.startsWith("anchor:") ? { anchor: e.slice(7) } : e.startsWith("page:") ? { page: e.slice(5) } : {};
18
- function A(e) {
18
+ var O = "__none__", k = (e, t) => t === void 0 ? e === void 0 ? O : `page:${e}` : `anchor:${t}`, A = (e) => e.startsWith("anchor:") ? { anchor: e.slice(7) } : e.startsWith("page:") ? { page: e.slice(5) } : {};
19
+ function te(e) {
19
20
  let t = e.defaults?.auto_advance_seconds;
20
21
  return {
21
22
  schema_version: 1,
@@ -38,61 +39,75 @@ function A(e) {
38
39
  }
39
40
  var j = (e) => e.trim() === "" ? NaN : Number(e), M = (e) => e === void 0 || Number.isNaN(e) ? "" : String(e);
40
41
  function N({ content: i, version: a, client: o, onError: s, className: c, appearance: l }) {
41
- let { t: u } = e(), h = n(o), x = b(i, a, { client: h }), D = S(() => x.plan ? y(x.plan) : {
42
+ let { t: u } = e(), m = n(o), x = b(i, a, { client: m }), O = S(() => x.plan ? y(x.plan) : {
42
43
  pages: [],
43
44
  files: []
44
- }, [x.plan]), [O, k] = C(null), [j, M] = C(null), [N, z] = C(!1), [B, V] = C(!1), [q, J] = C(null), Y = f("reader.save", s);
45
- x.plan && x.plan !== O && !N && (k(x.plan), M(x.plan.reader ? structuredClone(x.plan.reader) : g()));
46
- let X = S(() => j ? v(j, D) : [], [j, D]), Z = (e) => {
45
+ }, [x.plan]), [k, A] = w(null), [j, M] = w(null), [N, z] = w(!1), [B, V] = w(!1), [q, J] = w(null), Y = f("reader.save", s);
46
+ x.plan && x.plan !== k && !N && (A(x.plan), M(x.plan.reader ? structuredClone(x.plan.reader) : g()));
47
+ let X = S(() => j ? v(j, O) : [], [j, O]), Z = (e) => {
47
48
  M((t) => t && e(t)), z(!0), V(!1);
48
- }, Q = (() => {
49
- if (x.loading && !x.plan && !x.pending) return /* @__PURE__ */ w(m, { count: 2 });
50
- if (x.pending) return /* @__PURE__ */ w("p", {
49
+ }, Q = C(j);
50
+ Q.current = j;
51
+ let $ = async () => {
52
+ if (!j || X.length) return !1;
53
+ V(!1);
54
+ let e = j;
55
+ return !await Y.run(async () => (await m.versions.setReader(i, a, te(e)), !0)) || Q.current !== e ? !1 : (z(!1), V(!0), !0);
56
+ };
57
+ h(`reader-meta:${a}`, {
58
+ label: u("readerManifest.title"),
59
+ dirty: N,
60
+ pending: Y.pending,
61
+ valid: !X.length,
62
+ save: $,
63
+ order: 30
64
+ });
65
+ let ne = (() => {
66
+ if (x.loading && !x.plan && !x.pending) return /* @__PURE__ */ T(ee, { count: 2 });
67
+ if (x.pending) return /* @__PURE__ */ T("p", {
51
68
  className: "text-muted-foreground",
52
69
  children: u("readerManifest.pending")
53
70
  });
54
- if (x.error && !x.plan) return /* @__PURE__ */ w(p, {
71
+ if (x.error && !x.plan) return /* @__PURE__ */ T(p, {
55
72
  error: x.error,
56
73
  message: u("readerManifest.loadFailed"),
57
74
  retry: x.reload
58
75
  });
59
76
  if (!j) return null;
60
77
  let e = j.anchors ?? [], t = e.map((e) => e.id).filter(Boolean);
61
- return /* @__PURE__ */ T("form", {
78
+ return /* @__PURE__ */ E("form", {
62
79
  className: "grid gap-4",
63
80
  onSubmit: (e) => {
64
- e.preventDefault(), !X.length && (V(!1), Y.run(async () => (await h.versions.setReader(i, a, A(j)), !0)).then((e) => {
65
- e && (z(!1), V(!0));
66
- }));
81
+ e.preventDefault(), $();
67
82
  },
68
83
  children: [
69
- /* @__PURE__ */ w("p", {
84
+ /* @__PURE__ */ T("p", {
70
85
  className: "text-muted-foreground",
71
86
  children: u("readerManifest.summary", {
72
- pages: D.pages.length,
73
- files: D.files.length
87
+ pages: O.pages.length,
88
+ files: O.files.length
74
89
  })
75
90
  }),
76
- /* @__PURE__ */ w(R, {
91
+ /* @__PURE__ */ T(R, {
77
92
  meta: j,
78
93
  edit: Z
79
94
  }),
80
- /* @__PURE__ */ w(L, {
95
+ /* @__PURE__ */ T(L, {
81
96
  title: u("readerManifest.anchors"),
82
97
  add: u("readerManifest.addAnchor"),
83
- disabled: !D.pages.length,
98
+ disabled: !O.pages.length,
84
99
  onAdd: () => Z((e) => ({
85
100
  ...e,
86
101
  anchors: [...e.anchors ?? [], {
87
102
  id: P(e.anchors ?? []),
88
- page: D.pages[0],
103
+ page: O.pages[0],
89
104
  offset_percent: 0
90
105
  }]
91
106
  })),
92
- children: e.map((e, t) => /* @__PURE__ */ w(H, {
107
+ children: e.map((e, t) => /* @__PURE__ */ T(H, {
93
108
  index: t,
94
109
  anchor: e,
95
- pages: D.pages,
110
+ pages: O.pages,
96
111
  onChange: (e) => Z((n) => ({
97
112
  ...n,
98
113
  anchors: F(n.anchors, t, e)
@@ -103,24 +118,24 @@ function N({ content: i, version: a, client: o, onError: s, className: c, appear
103
118
  }))
104
119
  }, t))
105
120
  }),
106
- /* @__PURE__ */ T(L, {
121
+ /* @__PURE__ */ E(L, {
107
122
  title: u("readerManifest.foreground"),
108
123
  add: u("readerManifest.addCue"),
109
- disabled: !D.files.length || !D.pages.length,
124
+ disabled: !O.files.length || !O.pages.length,
110
125
  onAdd: () => Z((e) => ({
111
126
  ...e,
112
127
  foreground: [...e.foreground ?? [], {
113
- file: D.files[0],
114
- page: D.pages[0]
128
+ file: O.files[0],
129
+ page: O.pages[0]
115
130
  }]
116
131
  })),
117
- extra: /* @__PURE__ */ w(r, {
132
+ extra: /* @__PURE__ */ T(r, {
118
133
  type: "button",
119
134
  size: "sm",
120
135
  variant: "outline",
121
- disabled: !D.files.length,
136
+ disabled: !O.files.length,
122
137
  onClick: () => {
123
- let e = _(D, t);
138
+ let e = _(O, t);
124
139
  J(e), e.foreground.length && Z((t) => ({
125
140
  ...t,
126
141
  foreground: e.foreground
@@ -128,10 +143,10 @@ function N({ content: i, version: a, client: o, onError: s, className: c, appear
128
143
  },
129
144
  children: u("readerManifest.match")
130
145
  }),
131
- children: [q && /* @__PURE__ */ w(G, { match: q }), (j.foreground ?? []).map((e, n) => /* @__PURE__ */ w(U, {
146
+ children: [q && /* @__PURE__ */ T(G, { match: q }), (j.foreground ?? []).map((e, n) => /* @__PURE__ */ T(U, {
132
147
  index: n,
133
148
  cue: e,
134
- names: D,
149
+ names: O,
135
150
  anchors: t,
136
151
  onChange: (e) => Z((t) => ({
137
152
  ...t,
@@ -143,18 +158,18 @@ function N({ content: i, version: a, client: o, onError: s, className: c, appear
143
158
  }))
144
159
  }, n))]
145
160
  }),
146
- /* @__PURE__ */ w(L, {
161
+ /* @__PURE__ */ T(L, {
147
162
  title: u("readerManifest.background"),
148
163
  add: u("readerManifest.addTrack"),
149
- disabled: !D.files.length,
164
+ disabled: !O.files.length,
150
165
  onAdd: () => Z((e) => ({
151
166
  ...e,
152
- background: [...e.background ?? [], { file: D.files[0] }]
167
+ background: [...e.background ?? [], { file: O.files[0] }]
153
168
  })),
154
- children: (j.background ?? []).map((e, n) => /* @__PURE__ */ w(W, {
169
+ children: (j.background ?? []).map((e, n) => /* @__PURE__ */ T(W, {
155
170
  index: n,
156
171
  cue: e,
157
- names: D,
172
+ names: O,
158
173
  anchors: t,
159
174
  onChange: (e) => Z((t) => ({
160
175
  ...t,
@@ -166,27 +181,27 @@ function N({ content: i, version: a, client: o, onError: s, className: c, appear
166
181
  }))
167
182
  }, n))
168
183
  }),
169
- X.length > 0 && /* @__PURE__ */ w(K, { problems: X }),
170
- /* @__PURE__ */ w(d, { error: Y.error }),
171
- /* @__PURE__ */ T("div", {
184
+ X.length > 0 && /* @__PURE__ */ T(K, { problems: X }),
185
+ /* @__PURE__ */ T(d, { error: Y.error }),
186
+ /* @__PURE__ */ E("div", {
172
187
  className: "flex flex-wrap items-center gap-3",
173
188
  children: [
174
- /* @__PURE__ */ w(r, {
189
+ /* @__PURE__ */ T(r, {
175
190
  type: "submit",
176
191
  size: "sm",
177
192
  disabled: Y.pending || !N || X.length > 0,
178
193
  children: Y.pending ? u("common.saving") : u("common.save")
179
194
  }),
180
- N && /* @__PURE__ */ w(r, {
195
+ N && /* @__PURE__ */ T(r, {
181
196
  type: "button",
182
197
  size: "sm",
183
198
  variant: "ghost",
184
199
  onClick: () => {
185
- z(!1), k(null), J(null);
200
+ z(!1), A(null), J(null);
186
201
  },
187
202
  children: u("readerManifest.revert")
188
203
  }),
189
- B && /* @__PURE__ */ w("span", {
204
+ B && /* @__PURE__ */ T("span", {
190
205
  role: "status",
191
206
  className: "text-muted-foreground",
192
207
  children: u("readerManifest.saved")
@@ -196,14 +211,14 @@ function N({ content: i, version: a, client: o, onError: s, className: c, appear
196
211
  ]
197
212
  });
198
213
  })();
199
- return /* @__PURE__ */ T(t, {
214
+ return /* @__PURE__ */ E(t, {
200
215
  appearance: l,
201
- className: E("grid gap-3 text-sm", c),
216
+ className: D("grid gap-3 text-sm", c),
202
217
  "data-ckui": "reader-manifest",
203
- children: [/* @__PURE__ */ w("h4", {
218
+ children: [/* @__PURE__ */ T("h4", {
204
219
  className: "font-medium",
205
220
  children: u("readerManifest.title")
206
- }), Q]
221
+ }), ne]
207
222
  });
208
223
  }
209
224
  function P(e) {
@@ -213,17 +228,17 @@ function P(e) {
213
228
  }
214
229
  var F = (e, t, n) => (e ?? []).map((e, r) => r === t ? n : e), I = (e, t) => (e ?? []).filter((e, n) => n !== t);
215
230
  function L({ title: e, add: t, disabled: n, onAdd: i, extra: a, children: o }) {
216
- return /* @__PURE__ */ T("fieldset", {
231
+ return /* @__PURE__ */ E("fieldset", {
217
232
  className: "grid gap-2 rounded-md border border-border p-3",
218
233
  children: [
219
- /* @__PURE__ */ w("legend", {
234
+ /* @__PURE__ */ T("legend", {
220
235
  className: "px-1 font-medium",
221
236
  children: e
222
237
  }),
223
238
  o,
224
- /* @__PURE__ */ T("div", {
239
+ /* @__PURE__ */ E("div", {
225
240
  className: "flex flex-wrap gap-2",
226
- children: [/* @__PURE__ */ w(r, {
241
+ children: [/* @__PURE__ */ T(r, {
227
242
  type: "button",
228
243
  size: "sm",
229
244
  variant: "outline",
@@ -237,12 +252,12 @@ function L({ title: e, add: t, disabled: n, onAdd: i, extra: a, children: o }) {
237
252
  }
238
253
  function R({ meta: t, edit: n }) {
239
254
  let { t: r } = e(), o = x(), s = t.defaults?.auto_advance_seconds;
240
- return /* @__PURE__ */ T("div", {
255
+ return /* @__PURE__ */ E("div", {
241
256
  className: "grid max-w-xs gap-1.5",
242
- children: [/* @__PURE__ */ w(a, {
257
+ children: [/* @__PURE__ */ T(a, {
243
258
  htmlFor: `${o}-auto`,
244
259
  children: r("readerManifest.autoAdvance")
245
- }), /* @__PURE__ */ w(i, {
260
+ }), /* @__PURE__ */ T(i, {
246
261
  id: `${o}-auto`,
247
262
  className: "h-8",
248
263
  type: "number",
@@ -257,38 +272,38 @@ function R({ meta: t, edit: n }) {
257
272
  });
258
273
  }
259
274
  function z({ label: e, value: t, names: n, onChange: r }) {
260
- return /* @__PURE__ */ T(o, {
275
+ return /* @__PURE__ */ E(o, {
261
276
  value: t,
262
277
  onValueChange: (e) => r(String(e)),
263
- children: [/* @__PURE__ */ w(l, {
278
+ children: [/* @__PURE__ */ T(l, {
264
279
  size: "sm",
265
280
  "aria-label": e,
266
- children: /* @__PURE__ */ w(u, { children: (e) => e })
267
- }), /* @__PURE__ */ w(s, { children: n.map((e) => /* @__PURE__ */ w(c, {
281
+ children: /* @__PURE__ */ T(u, { children: (e) => e })
282
+ }), /* @__PURE__ */ T(s, { children: n.map((e) => /* @__PURE__ */ T(c, {
268
283
  value: e,
269
284
  children: e
270
285
  }, e)) })]
271
286
  });
272
287
  }
273
288
  function B({ label: t, value: n, pages: r, anchors: i, none: a, onChange: d }) {
274
- let { t: f } = e(), p = (e) => e === D ? a ?? "" : e.startsWith("anchor:") ? f("readerManifest.anchorNamed", { id: e.slice(7) }) : f("readerManifest.pageNamed", { name: e.slice(5) });
275
- return /* @__PURE__ */ T(o, {
289
+ let { t: f } = e(), p = (e) => e === O ? a ?? "" : e.startsWith("anchor:") ? f("readerManifest.anchorNamed", { id: e.slice(7) }) : f("readerManifest.pageNamed", { name: e.slice(5) });
290
+ return /* @__PURE__ */ E(o, {
276
291
  value: n,
277
292
  onValueChange: (e) => d(String(e)),
278
- children: [/* @__PURE__ */ w(l, {
293
+ children: [/* @__PURE__ */ T(l, {
279
294
  size: "sm",
280
295
  "aria-label": t,
281
- children: /* @__PURE__ */ w(u, { children: p })
282
- }), /* @__PURE__ */ T(s, { children: [
283
- a !== void 0 && /* @__PURE__ */ w(c, {
284
- value: D,
296
+ children: /* @__PURE__ */ T(u, { children: p })
297
+ }), /* @__PURE__ */ E(s, { children: [
298
+ a !== void 0 && /* @__PURE__ */ T(c, {
299
+ value: O,
285
300
  children: a
286
301
  }),
287
- i.map((e) => /* @__PURE__ */ w(c, {
302
+ i.map((e) => /* @__PURE__ */ T(c, {
288
303
  value: `anchor:${e}`,
289
304
  children: p(`anchor:${e}`)
290
305
  }, `a-${e}`)),
291
- r.map((e) => /* @__PURE__ */ w(c, {
306
+ r.map((e) => /* @__PURE__ */ T(c, {
292
307
  value: `page:${e}`,
293
308
  children: p(`page:${e}`)
294
309
  }, `p-${e}`))
@@ -297,7 +312,7 @@ function B({ label: t, value: n, pages: r, anchors: i, none: a, onChange: d }) {
297
312
  }
298
313
  function V({ label: t, onRemove: n }) {
299
314
  let { t: i } = e();
300
- return /* @__PURE__ */ w(r, {
315
+ return /* @__PURE__ */ T(r, {
301
316
  type: "button",
302
317
  size: "sm",
303
318
  variant: "ghost",
@@ -308,11 +323,11 @@ function V({ label: t, onRemove: n }) {
308
323
  }
309
324
  function H({ index: t, anchor: n, pages: r, onChange: a, onRemove: o }) {
310
325
  let { t: s } = e(), c = t + 1;
311
- return /* @__PURE__ */ T("div", {
326
+ return /* @__PURE__ */ E("div", {
312
327
  className: "flex flex-wrap items-center gap-2",
313
328
  "data-ckui": "reader-anchor",
314
329
  children: [
315
- /* @__PURE__ */ w(i, {
330
+ /* @__PURE__ */ T(i, {
316
331
  className: "h-8 w-28",
317
332
  "aria-label": s("readerManifest.anchorId", { n: c }),
318
333
  value: n.id,
@@ -321,7 +336,7 @@ function H({ index: t, anchor: n, pages: r, onChange: a, onRemove: o }) {
321
336
  id: e.target.value
322
337
  })
323
338
  }),
324
- /* @__PURE__ */ w(z, {
339
+ /* @__PURE__ */ T(z, {
325
340
  label: s("readerManifest.anchorPage", { n: c }),
326
341
  value: n.page,
327
342
  names: r,
@@ -330,7 +345,7 @@ function H({ index: t, anchor: n, pages: r, onChange: a, onRemove: o }) {
330
345
  page: e
331
346
  })
332
347
  }),
333
- /* @__PURE__ */ w(i, {
348
+ /* @__PURE__ */ T(i, {
334
349
  className: "h-8 w-24",
335
350
  type: "number",
336
351
  min: 0,
@@ -343,7 +358,7 @@ function H({ index: t, anchor: n, pages: r, onChange: a, onRemove: o }) {
343
358
  offset_percent: j(e.target.value)
344
359
  })
345
360
  }),
346
- /* @__PURE__ */ w(i, {
361
+ /* @__PURE__ */ T(i, {
347
362
  className: "h-8 w-28",
348
363
  type: "number",
349
364
  min: 0,
@@ -356,7 +371,7 @@ function H({ index: t, anchor: n, pages: r, onChange: a, onRemove: o }) {
356
371
  duration_seconds: e.target.value.trim() === "" ? void 0 : j(e.target.value)
357
372
  })
358
373
  }),
359
- /* @__PURE__ */ w(V, {
374
+ /* @__PURE__ */ T(V, {
360
375
  label: s("readerManifest.removeAnchor", { n: c }),
361
376
  onRemove: o
362
377
  })
@@ -365,11 +380,11 @@ function H({ index: t, anchor: n, pages: r, onChange: a, onRemove: o }) {
365
380
  }
366
381
  function U({ index: t, cue: n, names: r, anchors: i, onChange: a, onRemove: o }) {
367
382
  let { t: s } = e(), c = t + 1;
368
- return /* @__PURE__ */ T("div", {
383
+ return /* @__PURE__ */ E("div", {
369
384
  className: "flex flex-wrap items-center gap-2",
370
385
  "data-ckui": "reader-foreground",
371
386
  children: [
372
- /* @__PURE__ */ w(z, {
387
+ /* @__PURE__ */ T(z, {
373
388
  label: s("readerManifest.cueFile", { n: c }),
374
389
  value: n.file,
375
390
  names: r.files,
@@ -378,17 +393,17 @@ function U({ index: t, cue: n, names: r, anchors: i, onChange: a, onRemove: o })
378
393
  file: e
379
394
  })
380
395
  }),
381
- /* @__PURE__ */ w(B, {
396
+ /* @__PURE__ */ T(B, {
382
397
  label: s("readerManifest.cueAt", { n: c }),
383
- value: O(n.page, n.anchor),
398
+ value: k(n.page, n.anchor),
384
399
  pages: r.pages,
385
400
  anchors: i,
386
401
  onChange: (e) => a({
387
402
  file: n.file,
388
- ...k(e)
403
+ ...A(e)
389
404
  })
390
405
  }),
391
- /* @__PURE__ */ w(V, {
406
+ /* @__PURE__ */ T(V, {
392
407
  label: s("readerManifest.removeCue", { n: c }),
393
408
  onRemove: o
394
409
  })
@@ -396,7 +411,7 @@ function U({ index: t, cue: n, names: r, anchors: i, onChange: a, onRemove: o })
396
411
  });
397
412
  }
398
413
  function W({ index: t, cue: n, names: r, anchors: a, onChange: o, onRemove: s }) {
399
- let { t: c } = e(), l = t + 1, u = k(O(n.from_page, n.from_anchor)), d = k(O(n.to_page, n.to_anchor)), f = (e, t) => o({
414
+ let { t: c } = e(), l = t + 1, u = A(k(n.from_page, n.from_anchor)), d = A(k(n.to_page, n.to_anchor)), f = (e, t) => o({
400
415
  file: n.file,
401
416
  loop: n.loop,
402
417
  layer: n.layer,
@@ -405,11 +420,11 @@ function W({ index: t, cue: n, names: r, anchors: a, onChange: o, onRemove: s })
405
420
  to_page: t.page,
406
421
  to_anchor: t.anchor
407
422
  });
408
- return /* @__PURE__ */ T("div", {
423
+ return /* @__PURE__ */ E("div", {
409
424
  className: "flex flex-wrap items-center gap-2",
410
425
  "data-ckui": "reader-background",
411
426
  children: [
412
- /* @__PURE__ */ w(z, {
427
+ /* @__PURE__ */ T(z, {
413
428
  label: c("readerManifest.trackFile", { n: l }),
414
429
  value: n.file,
415
430
  names: r.files,
@@ -418,25 +433,25 @@ function W({ index: t, cue: n, names: r, anchors: a, onChange: o, onRemove: s })
418
433
  file: e
419
434
  })
420
435
  }),
421
- /* @__PURE__ */ w(B, {
436
+ /* @__PURE__ */ T(B, {
422
437
  label: c("readerManifest.trackFrom", { n: l }),
423
438
  none: c("readerManifest.start"),
424
- value: O(n.from_page, n.from_anchor),
439
+ value: k(n.from_page, n.from_anchor),
425
440
  pages: r.pages,
426
441
  anchors: a,
427
- onChange: (e) => f(k(e), d)
442
+ onChange: (e) => f(A(e), d)
428
443
  }),
429
- /* @__PURE__ */ w(B, {
444
+ /* @__PURE__ */ T(B, {
430
445
  label: c("readerManifest.trackTo", { n: l }),
431
446
  none: c("readerManifest.end"),
432
- value: O(n.to_page, n.to_anchor),
447
+ value: k(n.to_page, n.to_anchor),
433
448
  pages: r.pages,
434
449
  anchors: a,
435
- onChange: (e) => f(u, k(e))
450
+ onChange: (e) => f(u, A(e))
436
451
  }),
437
- /* @__PURE__ */ T("label", {
452
+ /* @__PURE__ */ E("label", {
438
453
  className: "flex items-center gap-1.5",
439
- children: [/* @__PURE__ */ w(h, {
454
+ children: [/* @__PURE__ */ T(m, {
440
455
  size: "sm",
441
456
  checked: !!n.loop,
442
457
  onCheckedChange: (e) => o({
@@ -446,7 +461,7 @@ function W({ index: t, cue: n, names: r, anchors: a, onChange: o, onRemove: s })
446
461
  "aria-label": c("readerManifest.loopN", { n: l })
447
462
  }), c("readerManifest.loop")]
448
463
  }),
449
- /* @__PURE__ */ w(i, {
464
+ /* @__PURE__ */ T(i, {
450
465
  className: "h-8 w-28",
451
466
  "aria-label": c("readerManifest.layer", { n: l }),
452
467
  placeholder: c("readerManifest.layerPlaceholder"),
@@ -456,7 +471,7 @@ function W({ index: t, cue: n, names: r, anchors: a, onChange: o, onRemove: s })
456
471
  layer: e.target.value || void 0
457
472
  })
458
473
  }),
459
- /* @__PURE__ */ w(V, {
474
+ /* @__PURE__ */ T(V, {
460
475
  label: c("readerManifest.removeTrack", { n: l }),
461
476
  onRemove: s
462
477
  })
@@ -465,23 +480,23 @@ function W({ index: t, cue: n, names: r, anchors: a, onChange: o, onRemove: s })
465
480
  }
466
481
  function G({ match: t }) {
467
482
  let { t: n } = e();
468
- return /* @__PURE__ */ T("div", {
483
+ return /* @__PURE__ */ E("div", {
469
484
  className: "grid gap-1 rounded-md bg-muted p-2 text-xs",
470
485
  role: "status",
471
486
  children: [
472
- /* @__PURE__ */ w("p", { children: t.foreground.length ? n("readerManifest.matched", { count: t.foreground.length }) : n("readerManifest.matchedNone") }),
473
- t.unmatchedPages.length > 0 && /* @__PURE__ */ w("p", { children: n("readerManifest.pagesWithoutAudio", { names: t.unmatchedPages.join(", ") }) }),
474
- t.unmatchedFiles.length > 0 && /* @__PURE__ */ w("p", { children: n("readerManifest.audioWithoutPlace", { names: t.unmatchedFiles.join(", ") }) })
487
+ /* @__PURE__ */ T("p", { children: t.foreground.length ? n("readerManifest.matched", { count: t.foreground.length }) : n("readerManifest.matchedNone") }),
488
+ t.unmatchedPages.length > 0 && /* @__PURE__ */ T("p", { children: n("readerManifest.pagesWithoutAudio", { names: t.unmatchedPages.join(", ") }) }),
489
+ t.unmatchedFiles.length > 0 && /* @__PURE__ */ T("p", { children: n("readerManifest.audioWithoutPlace", { names: t.unmatchedFiles.join(", ") }) })
475
490
  ]
476
491
  });
477
492
  }
478
493
  function K({ problems: t }) {
479
494
  let { t: n } = e(), r = (e) => n(`readerManifest.at_${e.at}`, { n: e.index + 1 });
480
- return /* @__PURE__ */ w("ul", {
495
+ return /* @__PURE__ */ T("ul", {
481
496
  className: "grid gap-0.5 text-destructive",
482
497
  role: "alert",
483
498
  "data-ckui": "reader-problems",
484
- children: t.map((e, t) => /* @__PURE__ */ w("li", { children: n(`readerManifest.problem_${e.problem}`, { where: r(e) }) }, t))
499
+ children: t.map((e, t) => /* @__PURE__ */ T("li", { children: n(`readerManifest.problem_${e.problem}`, { where: r(e) }) }, t))
485
500
  });
486
501
  }
487
502
  //#endregion