@openrails/contentkit-ui 0.99.3 → 0.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dist/client/generated/wire.d.ts +1 -0
- package/dist/client/generated/wire.js.map +1 -1
- package/dist/components/admin/group-manager.js +124 -117
- package/dist/components/admin/group-manager.js.map +1 -1
- package/dist/components/admin/user-comment-standing.js +8 -6
- package/dist/components/admin/user-comment-standing.js.map +1 -1
- package/dist/components/content/card.js +2 -2
- package/dist/components/content/card.js.map +1 -1
- package/dist/components/content/editors.d.ts +2 -2
- package/dist/components/content/editors.js +447 -328
- package/dist/components/content/editors.js.map +1 -1
- package/dist/components/content/filters.js +36 -18
- package/dist/components/content/filters.js.map +1 -1
- package/dist/components/content/grid.js +1 -1
- package/dist/components/content/grid.js.map +1 -1
- package/dist/components/groups/directory.js +13 -7
- package/dist/components/groups/directory.js.map +1 -1
- package/dist/components/groups/memberships.js +13 -7
- package/dist/components/groups/memberships.js.map +1 -1
- package/dist/components/rendition-img.js +73 -55
- package/dist/components/rendition-img.js.map +1 -1
- package/dist/components/social/moderation.js +14 -5
- package/dist/components/social/moderation.js.map +1 -1
- package/dist/react/read.d.ts +3 -2
- package/dist/react/read.js +68 -61
- package/dist/react/read.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,224 +1,318 @@
|
|
|
1
1
|
import { useLanguageName as e, useMessages as t } from "../../i18n/context.js";
|
|
2
2
|
import { useContentKitClient as n } from "../../react/context.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
3
|
+
import { useContentScope as r } from "../../react/use-resource.js";
|
|
4
|
+
import { useKinds as i } from "../../react/groups.js";
|
|
5
|
+
import { useMediaRead as a } from "../../react/read.js";
|
|
6
|
+
import { usePresets as o } from "../../react/public.js";
|
|
7
|
+
import { Button as s } from "../../ui/button.js";
|
|
8
|
+
import { SortableList as c } from "../sortable-list.js";
|
|
9
|
+
import { MediaFolderEditor as l } from "../media-folder-editor.js";
|
|
10
|
+
import { Badge as u } from "../../ui/badge.js";
|
|
11
|
+
import { Input as d } from "../../ui/input.js";
|
|
12
|
+
import { Label as f } from "../../ui/label.js";
|
|
13
|
+
import { Select as p, SelectContent as m, SelectItem as h, SelectTrigger as g, SelectValue as _ } from "../../ui/select.js";
|
|
14
|
+
import { Skeleton as v } from "../../ui/skeleton.js";
|
|
15
|
+
import { ErrorLine as y, useAction as b } from "../social/parts.js";
|
|
16
|
+
import { Switch as x } from "../../ui/switch.js";
|
|
17
|
+
import { fromLocalInput as S, parseAttributes as C, toLocalInput as w } from "../../client/group-fields.js";
|
|
18
|
+
import { GroupPicker as T, labelOf as E, useGroupNames as D } from "../groups/parts.js";
|
|
19
|
+
import { OfferFields as O } from "./offer-fields.js";
|
|
20
|
+
import { AttributeFields as k, formOf as A } from "../groups/fields.js";
|
|
21
|
+
import { MembershipEditor as j } from "../groups/memberships.js";
|
|
22
|
+
import { ReaderManifestEditor as ee } from "../admin/reader-manifest.js";
|
|
22
23
|
import { PageReview as M } from "../admin/page-review.js";
|
|
23
|
-
import { VideoMediaEditor as N, videoPaths as
|
|
24
|
-
import { useEffect as
|
|
25
|
-
import { Fragment as
|
|
26
|
-
import { cn as
|
|
24
|
+
import { VideoMediaEditor as N, videoPaths as te } from "../admin/media-item-panel.js";
|
|
25
|
+
import { useEffect as P, useId as ne, useMemo as F, useRef as I, useState as L } from "react";
|
|
26
|
+
import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
27
|
+
import { cn as V } from "cn";
|
|
27
28
|
//#region src/components/content/editors.tsx
|
|
28
|
-
var
|
|
29
|
+
var H = "__none__", re = [
|
|
29
30
|
"listed",
|
|
30
31
|
"members",
|
|
31
32
|
"unlisted"
|
|
32
|
-
],
|
|
33
|
+
], ie = [
|
|
33
34
|
"open",
|
|
34
35
|
"closed",
|
|
35
36
|
"hidden"
|
|
36
|
-
],
|
|
37
|
+
], ae = [
|
|
37
38
|
"public",
|
|
38
39
|
"tier",
|
|
39
40
|
"ppv",
|
|
40
41
|
"group",
|
|
41
42
|
"group_ppv"
|
|
42
|
-
],
|
|
43
|
-
function
|
|
44
|
-
return /* @__PURE__ */
|
|
43
|
+
], U = (e) => e === "group" || e === "group_ppv";
|
|
44
|
+
function W({ title: e, ckui: t, children: n }) {
|
|
45
|
+
return /* @__PURE__ */ B("section", {
|
|
45
46
|
className: "grid gap-3 border-t border-border pt-4",
|
|
46
47
|
"data-ckui": t,
|
|
47
|
-
children: [/* @__PURE__ */
|
|
48
|
+
children: [/* @__PURE__ */ z("h3", {
|
|
48
49
|
className: "font-medium",
|
|
49
50
|
children: e
|
|
50
51
|
}), n]
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function G({ show: e }) {
|
|
54
55
|
let { t: n } = t();
|
|
55
|
-
return e ? /* @__PURE__ */
|
|
56
|
+
return e ? /* @__PURE__ */ z("span", {
|
|
56
57
|
role: "status",
|
|
57
58
|
className: "text-muted-foreground",
|
|
58
59
|
children: n("contentEditor.saved")
|
|
59
60
|
}) : null;
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
let { kinds: n } =
|
|
62
|
+
function K(e, t) {
|
|
63
|
+
let { kinds: n } = i({ client: t });
|
|
63
64
|
return {
|
|
64
65
|
model: n,
|
|
65
66
|
spec: n?.kinds[e]
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
e
|
|
76
|
-
e.
|
|
77
|
-
|
|
78
|
-
])
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
function q(e) {
|
|
70
|
+
let [t, n] = L(e), r = I({
|
|
71
|
+
value: e,
|
|
72
|
+
dirty: /* @__PURE__ */ new Set(),
|
|
73
|
+
edits: /* @__PURE__ */ new Map()
|
|
74
|
+
});
|
|
75
|
+
return P(() => {
|
|
76
|
+
let t = { ...e };
|
|
77
|
+
for (let e of r.current.dirty) t[e] = r.current.value[e];
|
|
78
|
+
r.current.value = t, n(t);
|
|
79
|
+
}, [e]), {
|
|
80
|
+
value: t,
|
|
81
|
+
edit: (e) => {
|
|
82
|
+
let t = r.current, i = typeof e == "function" ? e(t.value) : e;
|
|
83
|
+
for (let e of /* @__PURE__ */ new Set([...Object.keys(t.value), ...Object.keys(i)])) Object.is(t.value[e], i[e]) || (t.dirty.add(e), t.edits.set(e, (t.edits.get(e) ?? 0) + 1));
|
|
84
|
+
t.value = i, n(i);
|
|
85
|
+
},
|
|
86
|
+
checkpoint: () => {
|
|
87
|
+
let e = new Map(r.current.edits);
|
|
88
|
+
return (t) => {
|
|
89
|
+
let i = r.current, a = { ...t };
|
|
90
|
+
for (let n of /* @__PURE__ */ new Set([...Object.keys(i.value), ...Object.keys(t)])) i.edits.get(n) === e.get(n) ? i.dirty.delete(n) : a[n] = i.value[n];
|
|
91
|
+
return i.value = a, n(a), i.dirty.size === 0;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function J(e, t, n) {
|
|
97
|
+
let [r, i] = L({
|
|
98
|
+
id: e,
|
|
99
|
+
client: t,
|
|
100
|
+
scope: n,
|
|
101
|
+
key: 0
|
|
102
|
+
});
|
|
103
|
+
if (r.id !== e || r.client !== t || r.scope !== n) {
|
|
104
|
+
let a = {
|
|
105
|
+
id: e,
|
|
106
|
+
client: t,
|
|
107
|
+
scope: n,
|
|
108
|
+
key: r.key + 1
|
|
109
|
+
};
|
|
110
|
+
return i(a), a.key;
|
|
111
|
+
}
|
|
112
|
+
return r.key;
|
|
113
|
+
}
|
|
114
|
+
function Y(e, t) {
|
|
115
|
+
let { client: n, store: i, scope: a, language: o } = r(t), s = I(!0);
|
|
116
|
+
return P(() => (s.current = !0, () => {
|
|
117
|
+
s.current = !1;
|
|
118
|
+
}), []), async () => {
|
|
119
|
+
let t = await n.contents.get(e.id, o ?? e.language);
|
|
120
|
+
return s.current && i.patch((t) => t.type === "content" && t.id === e.id && (t.readScope ?? "{}") === a, (e) => (e && e.revision > t.revision && (t = e), t)), t;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function X(e) {
|
|
124
|
+
let { client: t, scope: n } = r(e.client), i = J(e.content.id, t, n);
|
|
125
|
+
return /* @__PURE__ */ z(oe, {
|
|
126
|
+
...e,
|
|
127
|
+
client: t
|
|
128
|
+
}, i);
|
|
129
|
+
}
|
|
130
|
+
function oe({ content: e, ...r }) {
|
|
131
|
+
let { t: i } = t(), a = n(r.client), { spec: o } = K(e.kind, r.client), c = F(() => o?.attributes ?? {}, [o]), l = q(F(() => ({
|
|
132
|
+
listing: e.listing,
|
|
133
|
+
comments: e.comments
|
|
134
|
+
}), [e.listing, e.comments])), u = q(F(() => A(c, e.attributes), [c, e.attributes])), { listing: d, comments: v } = l.value, x = Y(e, r.client), [S, w] = L(null), [T, E] = L(!1), D = b("content.save", r.onError);
|
|
135
|
+
return /* @__PURE__ */ z(W, {
|
|
81
136
|
title: i("contentEditor.details"),
|
|
82
137
|
ckui: "content-details",
|
|
83
|
-
children: /* @__PURE__ */
|
|
138
|
+
children: /* @__PURE__ */ B("form", {
|
|
84
139
|
className: "grid gap-3",
|
|
85
140
|
onSubmit: (t) => {
|
|
86
|
-
t.preventDefault(),
|
|
141
|
+
t.preventDefault(), w(null), E(!1);
|
|
87
142
|
let n;
|
|
88
143
|
try {
|
|
89
|
-
n =
|
|
144
|
+
n = C(c, u.value);
|
|
90
145
|
} catch (e) {
|
|
91
|
-
return
|
|
146
|
+
return w(e.message);
|
|
92
147
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
148
|
+
let r = l.checkpoint(), i = u.checkpoint();
|
|
149
|
+
D.run(() => a.contents.update(e.id, {
|
|
150
|
+
listing: d,
|
|
151
|
+
comments: v,
|
|
96
152
|
attributes: n,
|
|
97
153
|
revision: e.revision
|
|
98
|
-
})).then((e) =>
|
|
154
|
+
})).then((e) => {
|
|
155
|
+
if (!e) return;
|
|
156
|
+
let t = r({
|
|
157
|
+
listing: e.listing,
|
|
158
|
+
comments: e.comments
|
|
159
|
+
}), n = i(A(c, e.attributes));
|
|
160
|
+
E(t && n);
|
|
161
|
+
});
|
|
99
162
|
},
|
|
100
163
|
children: [
|
|
101
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ B("div", {
|
|
102
165
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
103
|
-
children: [/* @__PURE__ */
|
|
104
|
-
value:
|
|
105
|
-
onValueChange: (e) =>
|
|
106
|
-
|
|
166
|
+
children: [/* @__PURE__ */ z(f, { children: i("contentEditor.listing") }), /* @__PURE__ */ B(p, {
|
|
167
|
+
value: d,
|
|
168
|
+
onValueChange: (e) => {
|
|
169
|
+
l.edit((t) => ({
|
|
170
|
+
...t,
|
|
171
|
+
listing: e
|
|
172
|
+
})), E(!1);
|
|
173
|
+
},
|
|
174
|
+
children: [/* @__PURE__ */ z(g, {
|
|
107
175
|
size: "sm",
|
|
108
176
|
"aria-label": i("contentEditor.listing"),
|
|
109
|
-
children: /* @__PURE__ */
|
|
110
|
-
}), /* @__PURE__ */
|
|
177
|
+
children: /* @__PURE__ */ z(_, { children: (e) => i(`contentEditor.listing_${e}`) })
|
|
178
|
+
}), /* @__PURE__ */ z(m, { children: re.map((e) => /* @__PURE__ */ z(h, {
|
|
111
179
|
value: e,
|
|
112
180
|
children: i(`contentEditor.listing_${e}`)
|
|
113
181
|
}, e)) })]
|
|
114
182
|
})]
|
|
115
183
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ B("div", {
|
|
117
185
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
118
|
-
children: [/* @__PURE__ */
|
|
119
|
-
value:
|
|
120
|
-
onValueChange: (e) =>
|
|
121
|
-
|
|
186
|
+
children: [/* @__PURE__ */ z(f, { children: i("contentEditor.comments") }), /* @__PURE__ */ B(p, {
|
|
187
|
+
value: v,
|
|
188
|
+
onValueChange: (e) => {
|
|
189
|
+
l.edit((t) => ({
|
|
190
|
+
...t,
|
|
191
|
+
comments: e
|
|
192
|
+
})), E(!1);
|
|
193
|
+
},
|
|
194
|
+
children: [/* @__PURE__ */ z(g, {
|
|
122
195
|
size: "sm",
|
|
123
196
|
"aria-label": i("contentEditor.comments"),
|
|
124
|
-
children: /* @__PURE__ */
|
|
125
|
-
}), /* @__PURE__ */
|
|
197
|
+
children: /* @__PURE__ */ z(_, { children: (e) => i(`contentEditor.comments_${e}`) })
|
|
198
|
+
}), /* @__PURE__ */ z(m, { children: ie.map((e) => /* @__PURE__ */ z(h, {
|
|
126
199
|
value: e,
|
|
127
200
|
children: i(`contentEditor.comments_${e}`)
|
|
128
201
|
}, e)) })]
|
|
129
202
|
})]
|
|
130
203
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ z(k, {
|
|
132
205
|
declared: c,
|
|
133
|
-
form:
|
|
134
|
-
onChange: (e, t) =>
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
206
|
+
form: u.value,
|
|
207
|
+
onChange: (e, t) => {
|
|
208
|
+
u.edit((n) => ({
|
|
209
|
+
...n,
|
|
210
|
+
[e]: t
|
|
211
|
+
})), E(!1);
|
|
212
|
+
},
|
|
138
213
|
labels: r.labels
|
|
139
214
|
}),
|
|
140
|
-
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
/* @__PURE__ */
|
|
215
|
+
S && /* @__PURE__ */ z(y, { children: S }),
|
|
216
|
+
/* @__PURE__ */ z(y, { error: D.error }),
|
|
217
|
+
/* @__PURE__ */ B("div", {
|
|
143
218
|
className: "flex items-center gap-3",
|
|
144
|
-
children: [
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
219
|
+
children: [
|
|
220
|
+
/* @__PURE__ */ z(s, {
|
|
221
|
+
type: "submit",
|
|
222
|
+
size: "sm",
|
|
223
|
+
disabled: D.pending,
|
|
224
|
+
children: D.pending ? i("common.saving") : i("common.save")
|
|
225
|
+
}),
|
|
226
|
+
/* @__PURE__ */ z(s, {
|
|
227
|
+
type: "button",
|
|
228
|
+
variant: "ghost",
|
|
229
|
+
size: "sm",
|
|
230
|
+
disabled: D.pending,
|
|
231
|
+
onClick: () => {
|
|
232
|
+
let e = l.checkpoint(), t = u.checkpoint();
|
|
233
|
+
D.run(x).then((n) => {
|
|
234
|
+
n && (e({
|
|
235
|
+
listing: n.listing,
|
|
236
|
+
comments: n.comments
|
|
237
|
+
}), t(A(c, n.attributes)), w(null), E(!1));
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
children: i("common.cancel")
|
|
241
|
+
}),
|
|
242
|
+
/* @__PURE__ */ z(G, { show: T })
|
|
243
|
+
]
|
|
150
244
|
})
|
|
151
245
|
]
|
|
152
246
|
})
|
|
153
247
|
});
|
|
154
248
|
}
|
|
155
|
-
function
|
|
156
|
-
let { t: c } = t(), l =
|
|
249
|
+
function se({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, client: s }) {
|
|
250
|
+
let { t: c } = t(), l = ne(), u = r?.tiers ?? [], v = r?.kinds[i], y = Object.entries(r?.entity_kinds ?? {}).filter(([, e]) => e.sellable || e.auth_scope).map(([e]) => e), [b, C] = L(), O = b ?? y[0] ?? "", k = D(e.group_id ? [e.group_id] : [], { client: s }), A = e.group_id ? k.get(e.group_id) : void 0, j = (t) => n({
|
|
157
251
|
...e,
|
|
158
252
|
...t
|
|
159
|
-
}),
|
|
160
|
-
return /* @__PURE__ */
|
|
253
|
+
}), ee = v?.presentation === "reader", M = !!v?.segments;
|
|
254
|
+
return /* @__PURE__ */ B("div", {
|
|
161
255
|
className: "grid gap-3",
|
|
162
256
|
"data-ckui": "rule-fields",
|
|
163
257
|
children: [
|
|
164
|
-
/* @__PURE__ */
|
|
258
|
+
/* @__PURE__ */ B("div", {
|
|
165
259
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
166
|
-
children: [/* @__PURE__ */
|
|
260
|
+
children: [/* @__PURE__ */ z(f, { children: c("contentEditor.access") }), /* @__PURE__ */ B(p, {
|
|
167
261
|
value: e.level,
|
|
168
262
|
onValueChange: (t) => {
|
|
169
263
|
let r = t;
|
|
170
264
|
n({
|
|
171
265
|
level: r,
|
|
172
|
-
group_id:
|
|
266
|
+
group_id: U(r) ? e.group_id || a : void 0,
|
|
173
267
|
preview: e.preview,
|
|
174
268
|
free_after: e.free_after
|
|
175
269
|
});
|
|
176
270
|
},
|
|
177
|
-
children: [/* @__PURE__ */
|
|
271
|
+
children: [/* @__PURE__ */ z(g, {
|
|
178
272
|
size: "sm",
|
|
179
273
|
"aria-label": c("contentEditor.access"),
|
|
180
|
-
children: /* @__PURE__ */
|
|
181
|
-
}), /* @__PURE__ */
|
|
274
|
+
children: /* @__PURE__ */ z(_, { children: (e) => c(`contentEditor.level_${e}`) })
|
|
275
|
+
}), /* @__PURE__ */ z(m, { children: ae.filter((e) => (e !== "tier" || u.length) && (!e.startsWith("group") || y.length)).map((e) => /* @__PURE__ */ z(h, {
|
|
182
276
|
value: e,
|
|
183
277
|
children: c(`contentEditor.level_${e}`)
|
|
184
278
|
}, e)) })]
|
|
185
279
|
})]
|
|
186
280
|
}),
|
|
187
|
-
e.level === "tier" && /* @__PURE__ */
|
|
281
|
+
e.level === "tier" && /* @__PURE__ */ B("fieldset", {
|
|
188
282
|
className: "flex flex-wrap gap-3",
|
|
189
|
-
children: [/* @__PURE__ */
|
|
283
|
+
children: [/* @__PURE__ */ z("legend", {
|
|
190
284
|
className: "sr-only",
|
|
191
285
|
children: c("contentEditor.tiers")
|
|
192
|
-
}),
|
|
286
|
+
}), u.map((t) => /* @__PURE__ */ B("label", {
|
|
193
287
|
className: "flex items-center gap-2",
|
|
194
|
-
children: [/* @__PURE__ */
|
|
288
|
+
children: [/* @__PURE__ */ z(x, {
|
|
195
289
|
checked: e.tiers?.includes(t) ?? !1,
|
|
196
290
|
onCheckedChange: (n) => j({ tiers: n ? [...e.tiers ?? [], t] : (e.tiers ?? []).filter((e) => e !== t) }),
|
|
197
|
-
"aria-label":
|
|
198
|
-
}),
|
|
291
|
+
"aria-label": E(o, t)
|
|
292
|
+
}), E(o, t)]
|
|
199
293
|
}, t))]
|
|
200
294
|
}),
|
|
201
|
-
|
|
295
|
+
U(e.level) && /* @__PURE__ */ B("div", {
|
|
202
296
|
className: "flex flex-wrap items-end gap-2",
|
|
203
297
|
children: [
|
|
204
|
-
A || e.group_id ? /* @__PURE__ */
|
|
298
|
+
A || e.group_id ? /* @__PURE__ */ z("span", {
|
|
205
299
|
className: "rounded-md border border-border px-2 py-0.5",
|
|
206
300
|
"data-ckui": "rule-group",
|
|
207
301
|
children: A ? A.name || A.slug : e.group_id
|
|
208
302
|
}) : null,
|
|
209
|
-
y.length > 1 && /* @__PURE__ */
|
|
303
|
+
y.length > 1 && /* @__PURE__ */ B(p, {
|
|
210
304
|
value: O,
|
|
211
|
-
onValueChange: (e) =>
|
|
212
|
-
children: [/* @__PURE__ */
|
|
305
|
+
onValueChange: (e) => C(String(e)),
|
|
306
|
+
children: [/* @__PURE__ */ z(g, {
|
|
213
307
|
size: "sm",
|
|
214
308
|
"aria-label": c("groupEditor.edgeKind"),
|
|
215
|
-
children: /* @__PURE__ */
|
|
216
|
-
}), /* @__PURE__ */
|
|
309
|
+
children: /* @__PURE__ */ z(_, { children: (e) => E(o, e) })
|
|
310
|
+
}), /* @__PURE__ */ z(m, { children: y.map((e) => /* @__PURE__ */ z(h, {
|
|
217
311
|
value: e,
|
|
218
|
-
children:
|
|
312
|
+
children: E(o, e)
|
|
219
313
|
}, e)) })]
|
|
220
314
|
}),
|
|
221
|
-
O && /* @__PURE__ */
|
|
315
|
+
O && /* @__PURE__ */ z(T, {
|
|
222
316
|
kind: O,
|
|
223
317
|
label: c("contentEditor.group"),
|
|
224
318
|
client: s,
|
|
@@ -226,15 +320,15 @@ function X({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, clie
|
|
|
226
320
|
}, O)
|
|
227
321
|
]
|
|
228
322
|
}),
|
|
229
|
-
e.level !== "public" && /* @__PURE__ */
|
|
323
|
+
e.level !== "public" && /* @__PURE__ */ B("div", {
|
|
230
324
|
className: "grid gap-3 sm:grid-cols-3",
|
|
231
325
|
children: [
|
|
232
|
-
|
|
326
|
+
ee && /* @__PURE__ */ B("div", {
|
|
233
327
|
className: "grid gap-1.5",
|
|
234
|
-
children: [/* @__PURE__ */
|
|
328
|
+
children: [/* @__PURE__ */ z(f, {
|
|
235
329
|
htmlFor: `${l}-pages`,
|
|
236
330
|
children: c("contentEditor.previewPages")
|
|
237
|
-
}), /* @__PURE__ */
|
|
331
|
+
}), /* @__PURE__ */ z(d, {
|
|
238
332
|
id: `${l}-pages`,
|
|
239
333
|
className: "h-8",
|
|
240
334
|
type: "number",
|
|
@@ -246,12 +340,12 @@ function X({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, clie
|
|
|
246
340
|
} })
|
|
247
341
|
})]
|
|
248
342
|
}),
|
|
249
|
-
|
|
343
|
+
M && /* @__PURE__ */ B("div", {
|
|
250
344
|
className: "grid gap-1.5",
|
|
251
|
-
children: [/* @__PURE__ */
|
|
345
|
+
children: [/* @__PURE__ */ z(f, {
|
|
252
346
|
htmlFor: `${l}-segments`,
|
|
253
347
|
children: c("contentEditor.previewSegments")
|
|
254
|
-
}), /* @__PURE__ */
|
|
348
|
+
}), /* @__PURE__ */ z(d, {
|
|
255
349
|
id: `${l}-segments`,
|
|
256
350
|
className: "h-8",
|
|
257
351
|
type: "number",
|
|
@@ -263,17 +357,17 @@ function X({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, clie
|
|
|
263
357
|
} })
|
|
264
358
|
})]
|
|
265
359
|
}),
|
|
266
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ B("div", {
|
|
267
361
|
className: "grid gap-1.5",
|
|
268
|
-
children: [/* @__PURE__ */
|
|
362
|
+
children: [/* @__PURE__ */ z(f, {
|
|
269
363
|
htmlFor: `${l}-free`,
|
|
270
364
|
children: c("contentEditor.freeAfter")
|
|
271
|
-
}), /* @__PURE__ */
|
|
365
|
+
}), /* @__PURE__ */ z(d, {
|
|
272
366
|
id: `${l}-free`,
|
|
273
367
|
className: "h-8",
|
|
274
368
|
type: "datetime-local",
|
|
275
|
-
value:
|
|
276
|
-
onChange: (e) => j({ free_after:
|
|
369
|
+
value: w(e.free_after),
|
|
370
|
+
onChange: (e) => j({ free_after: S(e.target.value) })
|
|
277
371
|
})]
|
|
278
372
|
})
|
|
279
373
|
]
|
|
@@ -281,8 +375,8 @@ function X({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, clie
|
|
|
281
375
|
]
|
|
282
376
|
});
|
|
283
377
|
}
|
|
284
|
-
var
|
|
285
|
-
function
|
|
378
|
+
var ce = (e) => !U(e.level) || !!e.group_id;
|
|
379
|
+
function le(e) {
|
|
286
380
|
let t = e.preview && (e.preview.pages || e.preview.segments) ? {
|
|
287
381
|
pages: e.preview.pages || void 0,
|
|
288
382
|
segments: e.preview.segments || void 0
|
|
@@ -295,70 +389,95 @@ function re(e) {
|
|
|
295
389
|
free_after: e.level === "public" ? void 0 : e.free_after
|
|
296
390
|
};
|
|
297
391
|
}
|
|
298
|
-
function
|
|
299
|
-
let { t:
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
392
|
+
function ue(e) {
|
|
393
|
+
let { client: t, scope: n } = r(e.client), i = J(e.content.id, t, n);
|
|
394
|
+
return /* @__PURE__ */ z(de, {
|
|
395
|
+
...e,
|
|
396
|
+
client: t
|
|
397
|
+
}, i);
|
|
398
|
+
}
|
|
399
|
+
function de({ content: e, ...r }) {
|
|
400
|
+
let { t: i } = t(), a = n(r.client), { model: o } = K(e.kind, r.client), c = q(e.access), l = Y(e, r.client), [u, d] = L(!1), f = b("content.save", r.onError), p = b("offer.save", r.onError);
|
|
401
|
+
return /* @__PURE__ */ B(W, {
|
|
303
402
|
title: i("contentEditor.accessTitle"),
|
|
304
403
|
ckui: "access-editor",
|
|
305
404
|
children: [
|
|
306
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ B("form", {
|
|
307
406
|
className: "grid gap-3",
|
|
308
407
|
onSubmit: (t) => {
|
|
309
|
-
t.preventDefault(), d(!1)
|
|
310
|
-
|
|
408
|
+
t.preventDefault(), d(!1);
|
|
409
|
+
let n = c.checkpoint();
|
|
410
|
+
f.run(() => a.contents.update(e.id, {
|
|
411
|
+
access: le(c.value),
|
|
311
412
|
revision: e.revision
|
|
312
|
-
})).then((e) => e && d(
|
|
413
|
+
})).then((e) => e && d(n(e.access)));
|
|
313
414
|
},
|
|
314
415
|
children: [
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
value: c,
|
|
317
|
-
onChange:
|
|
318
|
-
|
|
416
|
+
/* @__PURE__ */ z(se, {
|
|
417
|
+
value: c.value,
|
|
418
|
+
onChange: (e) => {
|
|
419
|
+
c.edit(e), d(!1);
|
|
420
|
+
},
|
|
421
|
+
model: o,
|
|
319
422
|
kind: e.kind,
|
|
320
423
|
owner: e.owner_group_id,
|
|
321
424
|
labels: r.labels,
|
|
322
425
|
client: a
|
|
323
426
|
}),
|
|
324
|
-
/* @__PURE__ */
|
|
325
|
-
/* @__PURE__ */
|
|
427
|
+
/* @__PURE__ */ z(y, { error: f.error }),
|
|
428
|
+
/* @__PURE__ */ B("div", {
|
|
326
429
|
className: "flex items-center gap-3",
|
|
327
|
-
children: [
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ z(s, {
|
|
432
|
+
type: "submit",
|
|
433
|
+
size: "sm",
|
|
434
|
+
disabled: f.pending || !ce(c.value),
|
|
435
|
+
children: f.pending ? i("common.saving") : i("common.save")
|
|
436
|
+
}),
|
|
437
|
+
/* @__PURE__ */ z(s, {
|
|
438
|
+
type: "button",
|
|
439
|
+
variant: "ghost",
|
|
440
|
+
size: "sm",
|
|
441
|
+
disabled: f.pending,
|
|
442
|
+
onClick: () => {
|
|
443
|
+
let e = c.checkpoint();
|
|
444
|
+
f.run(l).then((t) => {
|
|
445
|
+
t && (e(t.access), d(!1));
|
|
446
|
+
});
|
|
447
|
+
},
|
|
448
|
+
children: i("common.cancel")
|
|
449
|
+
}),
|
|
450
|
+
/* @__PURE__ */ z(G, { show: u })
|
|
451
|
+
]
|
|
333
452
|
})
|
|
334
453
|
]
|
|
335
454
|
}),
|
|
336
|
-
/* @__PURE__ */
|
|
455
|
+
/* @__PURE__ */ z(O, {
|
|
337
456
|
offer: e.offer,
|
|
338
457
|
pending: p.pending,
|
|
339
458
|
onSell: (t) => void p.run(() => a.offers.sell({ content: e.id }, t)),
|
|
340
459
|
onWithdraw: () => void p.run(() => a.offers.withdraw({ content: e.id }))
|
|
341
460
|
}),
|
|
342
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ z(y, { error: p.error })
|
|
343
462
|
]
|
|
344
463
|
});
|
|
345
464
|
}
|
|
346
|
-
function
|
|
347
|
-
return e.label || [...e.languages.map(t), ...e.traits.map((e) =>
|
|
465
|
+
function Z(e, t, n) {
|
|
466
|
+
return e.label || [...e.languages.map(t), ...e.traits.map((e) => E(n, e))].join(" · ");
|
|
348
467
|
}
|
|
349
|
-
function
|
|
350
|
-
let { t:
|
|
468
|
+
function fe({ content: r, media: i = !0, ...a }) {
|
|
469
|
+
let { t: o } = t(), l = n(a.client), d = e(), { model: f, spec: p } = K(r.kind, a.client), m = b("content.save", a.onError), h = b("content.save", a.onError), [g, _] = L(null), v = F(() => [...r.versions].sort((e, t) => e.position - t.position), [r.versions]);
|
|
351
470
|
if (!p) return null;
|
|
352
471
|
if (p.versions.hidden) {
|
|
353
|
-
let e =
|
|
354
|
-
return !e || !i && !p.segments ? null : /* @__PURE__ */
|
|
355
|
-
title:
|
|
472
|
+
let e = v[0];
|
|
473
|
+
return !e || !i && !p.segments ? null : /* @__PURE__ */ B(W, {
|
|
474
|
+
title: o("contentEditor.media"),
|
|
356
475
|
ckui: "version-media",
|
|
357
|
-
children: [p.segments && /* @__PURE__ */
|
|
476
|
+
children: [p.segments && /* @__PURE__ */ z($, {
|
|
358
477
|
content: r,
|
|
359
478
|
version: e,
|
|
360
479
|
...a
|
|
361
|
-
}), i && /* @__PURE__ */
|
|
480
|
+
}), i && /* @__PURE__ */ z(ge, {
|
|
362
481
|
content: r,
|
|
363
482
|
version: e,
|
|
364
483
|
model: f,
|
|
@@ -367,54 +486,54 @@ function ae({ content: r, media: i = !0, ...a }) {
|
|
|
367
486
|
});
|
|
368
487
|
}
|
|
369
488
|
let x = f?.languages ?? [];
|
|
370
|
-
return /* @__PURE__ */
|
|
371
|
-
title:
|
|
489
|
+
return /* @__PURE__ */ B(W, {
|
|
490
|
+
title: o("contentEditor.versions"),
|
|
372
491
|
ckui: "versions-editor",
|
|
373
492
|
children: [
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
items:
|
|
493
|
+
/* @__PURE__ */ z(c, {
|
|
494
|
+
items: v,
|
|
376
495
|
id: (e) => e.id,
|
|
377
|
-
name: (e) =>
|
|
378
|
-
label:
|
|
379
|
-
disabled: m.pending ||
|
|
496
|
+
name: (e) => Z(e, d, a.labels),
|
|
497
|
+
label: o("contentEditor.versions"),
|
|
498
|
+
disabled: m.pending || v.length < 2,
|
|
380
499
|
onMove: (e, t) => {
|
|
381
|
-
let n =
|
|
382
|
-
n.splice(t, 0, i), m.run(() =>
|
|
500
|
+
let n = v.map((e) => e.id), [i] = n.splice(e, 1);
|
|
501
|
+
n.splice(t, 0, i), m.run(() => l.contents.orderVersions(r.id, n));
|
|
383
502
|
},
|
|
384
|
-
children: (e, t) => /* @__PURE__ */
|
|
503
|
+
children: (e, t) => /* @__PURE__ */ B("div", {
|
|
385
504
|
className: "grid gap-2 rounded-md border border-border p-2",
|
|
386
505
|
"data-ckui": "version-row",
|
|
387
506
|
"data-version": e.id,
|
|
388
|
-
children: [/* @__PURE__ */
|
|
507
|
+
children: [/* @__PURE__ */ B("div", {
|
|
389
508
|
className: "flex flex-wrap items-center gap-2",
|
|
390
509
|
children: [
|
|
391
|
-
|
|
392
|
-
/* @__PURE__ */
|
|
510
|
+
v.length > 1 && t,
|
|
511
|
+
/* @__PURE__ */ z("span", {
|
|
393
512
|
className: "min-w-0 flex-1 font-medium break-words",
|
|
394
|
-
children:
|
|
513
|
+
children: Z(e, d, a.labels)
|
|
395
514
|
}),
|
|
396
|
-
/* @__PURE__ */
|
|
515
|
+
/* @__PURE__ */ z(u, {
|
|
397
516
|
variant: e.live ? "default" : "outline",
|
|
398
|
-
children:
|
|
517
|
+
children: o(e.live ? "contentEditor.live" : e.state === "draft" ? "contentManager.draft" : "contentManager.scheduled")
|
|
399
518
|
}),
|
|
400
|
-
e.access && /* @__PURE__ */
|
|
519
|
+
e.access && /* @__PURE__ */ z(u, {
|
|
401
520
|
variant: "secondary",
|
|
402
|
-
children:
|
|
521
|
+
children: o(`contentEditor.level_${e.access.level}`)
|
|
403
522
|
}),
|
|
404
|
-
e.pages ? /* @__PURE__ */
|
|
523
|
+
e.pages ? /* @__PURE__ */ z("span", {
|
|
405
524
|
className: "text-xs text-muted-foreground",
|
|
406
|
-
children:
|
|
525
|
+
children: o("contentEditor.pageCount", { count: e.pages })
|
|
407
526
|
}) : null,
|
|
408
|
-
/* @__PURE__ */
|
|
527
|
+
/* @__PURE__ */ z(s, {
|
|
409
528
|
type: "button",
|
|
410
529
|
size: "xs",
|
|
411
530
|
variant: "ghost",
|
|
412
531
|
"aria-expanded": g === e.id,
|
|
413
532
|
onClick: () => _(g === e.id ? null : e.id),
|
|
414
|
-
children:
|
|
533
|
+
children: o(g === e.id ? "contentEditor.close" : "contentEditor.edit")
|
|
415
534
|
})
|
|
416
535
|
]
|
|
417
|
-
}), g === e.id && /* @__PURE__ */
|
|
536
|
+
}), g === e.id && /* @__PURE__ */ z(me, {
|
|
418
537
|
content: r,
|
|
419
538
|
version: e,
|
|
420
539
|
model: f,
|
|
@@ -423,126 +542,126 @@ function ae({ content: r, media: i = !0, ...a }) {
|
|
|
423
542
|
})]
|
|
424
543
|
})
|
|
425
544
|
}),
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
545
|
+
/* @__PURE__ */ z(y, { error: m.error }),
|
|
546
|
+
/* @__PURE__ */ z(pe, {
|
|
428
547
|
languages: x,
|
|
429
548
|
many: p?.versions.languages === "many",
|
|
430
549
|
pending: h.pending,
|
|
431
|
-
onAdd: (e) => void h.run(() =>
|
|
550
|
+
onAdd: (e) => void h.run(() => l.contents.addVersion(r.id, e)).then((e) => e && _(e.id))
|
|
432
551
|
}),
|
|
433
|
-
/* @__PURE__ */
|
|
552
|
+
/* @__PURE__ */ z(y, { error: h.error })
|
|
434
553
|
]
|
|
435
554
|
});
|
|
436
555
|
}
|
|
437
|
-
function
|
|
556
|
+
function Q({ languages: n, value: r, many: i, onChange: a }) {
|
|
438
557
|
let { t: o } = t(), s = e();
|
|
439
|
-
return i ? /* @__PURE__ */
|
|
558
|
+
return i ? /* @__PURE__ */ B("fieldset", {
|
|
440
559
|
className: "flex flex-wrap gap-3",
|
|
441
|
-
children: [/* @__PURE__ */
|
|
560
|
+
children: [/* @__PURE__ */ z("legend", {
|
|
442
561
|
className: "sr-only",
|
|
443
562
|
children: o("contentEditor.versionLanguages")
|
|
444
|
-
}), n.map((e) => /* @__PURE__ */
|
|
563
|
+
}), n.map((e) => /* @__PURE__ */ B("label", {
|
|
445
564
|
className: "flex items-center gap-1.5",
|
|
446
|
-
children: [/* @__PURE__ */
|
|
565
|
+
children: [/* @__PURE__ */ z(x, {
|
|
447
566
|
size: "sm",
|
|
448
567
|
checked: r.includes(e),
|
|
449
568
|
onCheckedChange: (t) => a(t ? [...r, e] : r.filter((t) => t !== e)),
|
|
450
569
|
"aria-label": s(e)
|
|
451
570
|
}), s(e)]
|
|
452
571
|
}, e))]
|
|
453
|
-
}) : /* @__PURE__ */
|
|
454
|
-
value: r[0] ??
|
|
455
|
-
onValueChange: (e) => a(e ===
|
|
456
|
-
children: [/* @__PURE__ */
|
|
572
|
+
}) : /* @__PURE__ */ B(p, {
|
|
573
|
+
value: r[0] ?? H,
|
|
574
|
+
onValueChange: (e) => a(e === H ? [] : [String(e)]),
|
|
575
|
+
children: [/* @__PURE__ */ z(g, {
|
|
457
576
|
size: "sm",
|
|
458
577
|
"aria-label": o("contentEditor.versionLanguage"),
|
|
459
|
-
children: /* @__PURE__ */
|
|
460
|
-
}), /* @__PURE__ */
|
|
578
|
+
children: /* @__PURE__ */ z(_, { children: (e) => e === H ? o("contentEditor.chooseLanguage") : s(e) })
|
|
579
|
+
}), /* @__PURE__ */ z(m, { children: n.map((e) => /* @__PURE__ */ z(h, {
|
|
461
580
|
value: e,
|
|
462
581
|
children: s(e)
|
|
463
582
|
}, e)) })]
|
|
464
583
|
});
|
|
465
584
|
}
|
|
466
|
-
function
|
|
467
|
-
let { t: a } = t(), [
|
|
468
|
-
return /* @__PURE__ */
|
|
585
|
+
function pe({ languages: e, many: n, pending: r, onAdd: i }) {
|
|
586
|
+
let { t: a } = t(), [o, c] = L([]);
|
|
587
|
+
return /* @__PURE__ */ B("div", {
|
|
469
588
|
className: "flex flex-wrap items-center gap-2",
|
|
470
589
|
"data-ckui": "add-version",
|
|
471
|
-
children: [/* @__PURE__ */
|
|
590
|
+
children: [/* @__PURE__ */ z(Q, {
|
|
472
591
|
languages: e,
|
|
473
|
-
value:
|
|
592
|
+
value: o,
|
|
474
593
|
many: n,
|
|
475
594
|
onChange: c
|
|
476
|
-
}), /* @__PURE__ */
|
|
595
|
+
}), /* @__PURE__ */ z(s, {
|
|
477
596
|
type: "button",
|
|
478
597
|
size: "sm",
|
|
479
598
|
variant: "outline",
|
|
480
|
-
disabled: r || !
|
|
599
|
+
disabled: r || !o.length,
|
|
481
600
|
onClick: () => {
|
|
482
|
-
i({ languages:
|
|
601
|
+
i({ languages: o }), c([]);
|
|
483
602
|
},
|
|
484
603
|
children: a("contentEditor.addVersion")
|
|
485
604
|
})]
|
|
486
605
|
});
|
|
487
606
|
}
|
|
488
|
-
function
|
|
489
|
-
let { t: c } = t(), l =
|
|
490
|
-
return /* @__PURE__ */
|
|
607
|
+
function me({ content: e, version: r, model: i, media: a, ...o }) {
|
|
608
|
+
let { t: c } = t(), l = ne(), u = n(o.client), p = i?.kinds[e.kind], [m, h] = L(r.languages), [g, _] = L(r.traits), [v, C] = L(r.label ?? ""), [T, D] = L(r.state === "draft"), [k, A] = L(w(r.publish_at)), [j, M] = L(!!r.access), [N, te] = L(r.access ?? e.access), [P, F] = L(!1), I = b("content.save", o.onError), R = b("content.save", o.onError), V = b("offer.save", o.onError);
|
|
609
|
+
return /* @__PURE__ */ B("div", {
|
|
491
610
|
className: "grid gap-4 pt-2",
|
|
492
611
|
children: [
|
|
493
|
-
/* @__PURE__ */
|
|
612
|
+
/* @__PURE__ */ B("form", {
|
|
494
613
|
className: "grid gap-3",
|
|
495
614
|
onSubmit: (t) => {
|
|
496
|
-
t.preventDefault(),
|
|
615
|
+
t.preventDefault(), F(!1), I.run(() => u.contents.updateVersion(e.id, r.id, {
|
|
497
616
|
languages: m,
|
|
498
617
|
traits: g,
|
|
499
|
-
label:
|
|
500
|
-
state:
|
|
501
|
-
publish_at:
|
|
502
|
-
...
|
|
503
|
-
})).then((e) => e &&
|
|
618
|
+
label: v.trim(),
|
|
619
|
+
state: T ? "draft" : "published",
|
|
620
|
+
publish_at: S(k),
|
|
621
|
+
...j ? { access: le(N) } : { clear_access: !!r.access }
|
|
622
|
+
})).then((e) => e && F(!0));
|
|
504
623
|
},
|
|
505
624
|
children: [
|
|
506
|
-
/* @__PURE__ */
|
|
625
|
+
/* @__PURE__ */ z(Q, {
|
|
507
626
|
languages: i?.languages ?? [],
|
|
508
627
|
value: m,
|
|
509
628
|
many: p?.versions.languages === "many",
|
|
510
629
|
onChange: h
|
|
511
630
|
}),
|
|
512
|
-
!!p?.versions.traits?.length && /* @__PURE__ */
|
|
631
|
+
!!p?.versions.traits?.length && /* @__PURE__ */ B("fieldset", {
|
|
513
632
|
className: "flex flex-wrap gap-3",
|
|
514
|
-
children: [/* @__PURE__ */
|
|
633
|
+
children: [/* @__PURE__ */ z("legend", {
|
|
515
634
|
className: "sr-only",
|
|
516
635
|
children: c("contentEditor.traits")
|
|
517
|
-
}), p.versions.traits.map((e) => /* @__PURE__ */
|
|
636
|
+
}), p.versions.traits.map((e) => /* @__PURE__ */ B("label", {
|
|
518
637
|
className: "flex items-center gap-1.5",
|
|
519
|
-
children: [/* @__PURE__ */
|
|
638
|
+
children: [/* @__PURE__ */ z(x, {
|
|
520
639
|
size: "sm",
|
|
521
640
|
checked: g.includes(e),
|
|
522
641
|
onCheckedChange: (t) => _(t ? [...g, e] : g.filter((t) => t !== e)),
|
|
523
|
-
"aria-label":
|
|
524
|
-
}),
|
|
642
|
+
"aria-label": E(o.labels, e)
|
|
643
|
+
}), E(o.labels, e)]
|
|
525
644
|
}, e))]
|
|
526
645
|
}),
|
|
527
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ B("div", {
|
|
528
647
|
className: "grid gap-3 sm:grid-cols-2",
|
|
529
|
-
children: [/* @__PURE__ */
|
|
648
|
+
children: [/* @__PURE__ */ B("div", {
|
|
530
649
|
className: "grid gap-1.5",
|
|
531
|
-
children: [/* @__PURE__ */
|
|
650
|
+
children: [/* @__PURE__ */ z(f, {
|
|
532
651
|
htmlFor: `${l}-label`,
|
|
533
652
|
children: c("contentEditor.versionLabel")
|
|
534
|
-
}), /* @__PURE__ */
|
|
653
|
+
}), /* @__PURE__ */ z(d, {
|
|
535
654
|
id: `${l}-label`,
|
|
536
655
|
className: "h-8",
|
|
537
|
-
value:
|
|
538
|
-
onChange: (e) =>
|
|
656
|
+
value: v,
|
|
657
|
+
onChange: (e) => C(e.target.value)
|
|
539
658
|
})]
|
|
540
|
-
}), /* @__PURE__ */
|
|
659
|
+
}), /* @__PURE__ */ B("div", {
|
|
541
660
|
className: "grid gap-1.5",
|
|
542
|
-
children: [/* @__PURE__ */
|
|
661
|
+
children: [/* @__PURE__ */ z(f, {
|
|
543
662
|
htmlFor: `${l}-at`,
|
|
544
663
|
children: c("contentEditor.versionPublishAt")
|
|
545
|
-
}), /* @__PURE__ */
|
|
664
|
+
}), /* @__PURE__ */ z(d, {
|
|
546
665
|
id: `${l}-at`,
|
|
547
666
|
className: "h-8",
|
|
548
667
|
type: "datetime-local",
|
|
@@ -551,97 +670,97 @@ function ce({ content: e, version: r, model: i, media: a, ...s }) {
|
|
|
551
670
|
})]
|
|
552
671
|
})]
|
|
553
672
|
}),
|
|
554
|
-
/* @__PURE__ */
|
|
673
|
+
/* @__PURE__ */ B("label", {
|
|
555
674
|
className: "flex items-center gap-2",
|
|
556
|
-
children: [/* @__PURE__ */
|
|
675
|
+
children: [/* @__PURE__ */ z(x, {
|
|
557
676
|
size: "sm",
|
|
558
|
-
checked:
|
|
559
|
-
onCheckedChange:
|
|
677
|
+
checked: T,
|
|
678
|
+
onCheckedChange: D
|
|
560
679
|
}), c("contentEditor.versionDraft")]
|
|
561
680
|
}),
|
|
562
|
-
/* @__PURE__ */
|
|
681
|
+
/* @__PURE__ */ B("label", {
|
|
563
682
|
className: "flex items-center gap-2",
|
|
564
|
-
children: [/* @__PURE__ */
|
|
683
|
+
children: [/* @__PURE__ */ z(x, {
|
|
565
684
|
size: "sm",
|
|
566
|
-
checked:
|
|
567
|
-
onCheckedChange:
|
|
685
|
+
checked: j,
|
|
686
|
+
onCheckedChange: M
|
|
568
687
|
}), c("contentEditor.ownAccess")]
|
|
569
688
|
}),
|
|
570
|
-
|
|
571
|
-
value:
|
|
572
|
-
onChange:
|
|
689
|
+
j && /* @__PURE__ */ z(se, {
|
|
690
|
+
value: N,
|
|
691
|
+
onChange: te,
|
|
573
692
|
model: i,
|
|
574
693
|
kind: e.kind,
|
|
575
694
|
owner: e.owner_group_id,
|
|
576
|
-
labels:
|
|
577
|
-
client:
|
|
695
|
+
labels: o.labels,
|
|
696
|
+
client: u
|
|
578
697
|
}),
|
|
579
|
-
/* @__PURE__ */
|
|
580
|
-
/* @__PURE__ */
|
|
698
|
+
/* @__PURE__ */ z(y, { error: I.error }),
|
|
699
|
+
/* @__PURE__ */ B("div", {
|
|
581
700
|
className: "flex flex-wrap items-center gap-3",
|
|
582
701
|
children: [
|
|
583
|
-
/* @__PURE__ */
|
|
702
|
+
/* @__PURE__ */ z(s, {
|
|
584
703
|
type: "submit",
|
|
585
704
|
size: "sm",
|
|
586
|
-
disabled:
|
|
587
|
-
children:
|
|
705
|
+
disabled: I.pending || !m.length || j && !ce(N),
|
|
706
|
+
children: I.pending ? c("common.saving") : c("common.save")
|
|
588
707
|
}),
|
|
589
|
-
/* @__PURE__ */
|
|
590
|
-
/* @__PURE__ */
|
|
708
|
+
/* @__PURE__ */ z(G, { show: P }),
|
|
709
|
+
/* @__PURE__ */ z(s, {
|
|
591
710
|
type: "button",
|
|
592
711
|
size: "sm",
|
|
593
712
|
variant: "destructive",
|
|
594
713
|
className: "ms-auto",
|
|
595
|
-
disabled:
|
|
596
|
-
onClick: () => void
|
|
714
|
+
disabled: R.pending,
|
|
715
|
+
onClick: () => void R.run(() => u.contents.removeVersion(e.id, r.id)),
|
|
597
716
|
children: c("contentEditor.deleteVersion")
|
|
598
717
|
})
|
|
599
718
|
]
|
|
600
719
|
}),
|
|
601
|
-
/* @__PURE__ */
|
|
720
|
+
/* @__PURE__ */ z(y, { error: R.error })
|
|
602
721
|
]
|
|
603
722
|
}),
|
|
604
|
-
/* @__PURE__ */
|
|
723
|
+
/* @__PURE__ */ z(O, {
|
|
605
724
|
offer: r.offer,
|
|
606
|
-
pending:
|
|
607
|
-
onSell: (t) => void
|
|
725
|
+
pending: V.pending,
|
|
726
|
+
onSell: (t) => void V.run(() => u.offers.sell({
|
|
608
727
|
content: e.id,
|
|
609
728
|
version: r.id
|
|
610
729
|
}, t)),
|
|
611
|
-
onWithdraw: () => void
|
|
730
|
+
onWithdraw: () => void V.run(() => u.offers.withdraw({
|
|
612
731
|
content: e.id,
|
|
613
732
|
version: r.id
|
|
614
733
|
}))
|
|
615
734
|
}),
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
p?.segments && /* @__PURE__ */
|
|
735
|
+
/* @__PURE__ */ z(y, { error: V.error }),
|
|
736
|
+
p?.segments && /* @__PURE__ */ z($, {
|
|
618
737
|
content: e,
|
|
619
738
|
version: r,
|
|
620
|
-
...
|
|
739
|
+
...o
|
|
621
740
|
}),
|
|
622
|
-
a && /* @__PURE__ */
|
|
741
|
+
a && /* @__PURE__ */ z(he, {
|
|
623
742
|
content: e,
|
|
624
743
|
version: r,
|
|
625
|
-
...
|
|
744
|
+
...o
|
|
626
745
|
}),
|
|
627
|
-
a && /* @__PURE__ */
|
|
746
|
+
a && /* @__PURE__ */ z(ge, {
|
|
628
747
|
content: e,
|
|
629
748
|
version: r,
|
|
630
749
|
model: i,
|
|
631
|
-
...
|
|
750
|
+
...o
|
|
632
751
|
}),
|
|
633
|
-
a && p?.presentation === "reader" && /* @__PURE__ */
|
|
752
|
+
a && p?.presentation === "reader" && /* @__PURE__ */ z(ee, {
|
|
634
753
|
content: e.id,
|
|
635
754
|
version: r.id,
|
|
636
|
-
client:
|
|
637
|
-
onError:
|
|
755
|
+
client: o.client,
|
|
756
|
+
onError: o.onError
|
|
638
757
|
})
|
|
639
758
|
]
|
|
640
759
|
});
|
|
641
760
|
}
|
|
642
|
-
function
|
|
643
|
-
let { t:
|
|
644
|
-
if (
|
|
761
|
+
function he({ content: e, version: r, ...i }) {
|
|
762
|
+
let { t: a } = t(), c = n(i.client), { presets: l } = o({ client: c }), u = b("content.save", i.onError), d = I(null), [f, p] = L(null);
|
|
763
|
+
if (P(() => () => void (f && URL.revokeObjectURL(f)), [f]), !l.some((t) => t.kind === e.kind && t.name === "cover")) return null;
|
|
645
764
|
let m = f ?? r.cover?.url, h = (t) => void u.run(async () => {
|
|
646
765
|
if (!t) return p(null), c.contents.setCover(e.id, r.id, null);
|
|
647
766
|
let n = {
|
|
@@ -651,47 +770,47 @@ function le({ content: e, version: r, ...i }) {
|
|
|
651
770
|
}, i = await c.media.uploadNamed(n, t, { path: await c.media.presetPath(e.kind, "cover", t) }), a = await c.contents.setCover(e.id, r.id, i.name);
|
|
652
771
|
return typeof URL.createObjectURL == "function" && p(URL.createObjectURL(t)), a;
|
|
653
772
|
});
|
|
654
|
-
return /* @__PURE__ */
|
|
773
|
+
return /* @__PURE__ */ B("div", {
|
|
655
774
|
className: "grid gap-1.5",
|
|
656
775
|
"data-ckui": "version-cover",
|
|
657
776
|
children: [
|
|
658
|
-
/* @__PURE__ */
|
|
777
|
+
/* @__PURE__ */ z("span", {
|
|
659
778
|
className: "text-sm font-medium",
|
|
660
|
-
children:
|
|
779
|
+
children: a("contentManager.cover")
|
|
661
780
|
}),
|
|
662
|
-
/* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ B("div", {
|
|
663
782
|
className: "flex flex-wrap items-center gap-3",
|
|
664
783
|
children: [
|
|
665
|
-
m ? /* @__PURE__ */
|
|
784
|
+
m ? /* @__PURE__ */ z("img", {
|
|
666
785
|
src: m,
|
|
667
786
|
alt: "",
|
|
668
787
|
className: "h-20 w-36 rounded-md border border-border object-cover"
|
|
669
|
-
}) : /* @__PURE__ */
|
|
788
|
+
}) : /* @__PURE__ */ z("span", {
|
|
670
789
|
className: "text-muted-foreground",
|
|
671
|
-
children:
|
|
790
|
+
children: a("contentManager.noCover")
|
|
672
791
|
}),
|
|
673
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ z(s, {
|
|
674
793
|
type: "button",
|
|
675
794
|
size: "sm",
|
|
676
795
|
variant: "outline",
|
|
677
796
|
disabled: u.pending,
|
|
678
797
|
onClick: () => d.current?.click(),
|
|
679
|
-
children:
|
|
798
|
+
children: a(m ? "pollEditor.replaceImage" : "contentManager.addCover")
|
|
680
799
|
}),
|
|
681
|
-
r.cover?.image && /* @__PURE__ */
|
|
800
|
+
r.cover?.image && /* @__PURE__ */ z(s, {
|
|
682
801
|
type: "button",
|
|
683
802
|
size: "sm",
|
|
684
803
|
variant: "ghost",
|
|
685
804
|
disabled: u.pending,
|
|
686
805
|
onClick: () => h(null),
|
|
687
|
-
children:
|
|
806
|
+
children: a("pollEditor.removeImage")
|
|
688
807
|
}),
|
|
689
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ z("input", {
|
|
690
809
|
ref: d,
|
|
691
810
|
type: "file",
|
|
692
811
|
accept: "image/*",
|
|
693
812
|
hidden: !0,
|
|
694
|
-
"aria-label":
|
|
813
|
+
"aria-label": a("contentManager.cover"),
|
|
695
814
|
onChange: (e) => {
|
|
696
815
|
let t = e.target.files?.[0];
|
|
697
816
|
e.target.value = "", t && h(t);
|
|
@@ -699,12 +818,12 @@ function le({ content: e, version: r, ...i }) {
|
|
|
699
818
|
})
|
|
700
819
|
]
|
|
701
820
|
}),
|
|
702
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ z(y, { error: u.error })
|
|
703
822
|
]
|
|
704
823
|
});
|
|
705
824
|
}
|
|
706
|
-
function
|
|
707
|
-
let { t: s } = t(),
|
|
825
|
+
function ge({ content: n, version: r, model: i, ...o }) {
|
|
826
|
+
let { t: s } = t(), c = e(), u = F(() => ({
|
|
708
827
|
kind: n.kind,
|
|
709
828
|
id: n.id,
|
|
710
829
|
version: r.id
|
|
@@ -712,25 +831,25 @@ function ue({ content: n, version: r, model: a, ...o }) {
|
|
|
712
831
|
n.kind,
|
|
713
832
|
n.id,
|
|
714
833
|
r.id
|
|
715
|
-
]), d =
|
|
834
|
+
]), d = a(u, {
|
|
716
835
|
editor: !0,
|
|
717
836
|
client: o.client
|
|
718
|
-
}), f =
|
|
837
|
+
}), f = F(() => (i?.languages ?? []).map((e) => ({
|
|
719
838
|
value: e,
|
|
720
|
-
label:
|
|
721
|
-
})), [
|
|
722
|
-
return !d.read && d.loading ? /* @__PURE__ */
|
|
839
|
+
label: c(e)
|
|
840
|
+
})), [i, c]);
|
|
841
|
+
return !d.read && d.loading ? /* @__PURE__ */ z(v, { className: "h-24 w-full" }) : d.read?.uploads && te(d.read.uploads).source ? /* @__PURE__ */ z(N, {
|
|
723
842
|
item: u,
|
|
724
843
|
languages: f,
|
|
725
844
|
client: o.client,
|
|
726
845
|
onError: o.onError
|
|
727
|
-
}) : /* @__PURE__ */
|
|
846
|
+
}) : /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(l, {
|
|
728
847
|
item: u,
|
|
729
848
|
commit: r.live ? "manual" : "auto",
|
|
730
849
|
label: s("contentEditor.media"),
|
|
731
850
|
client: o.client,
|
|
732
851
|
onError: o.onError
|
|
733
|
-
}),
|
|
852
|
+
}), i?.kinds[n.kind]?.presentation === "reader" && /* @__PURE__ */ z(M, {
|
|
734
853
|
content: n.id,
|
|
735
854
|
version: r.id,
|
|
736
855
|
client: o.client,
|
|
@@ -738,47 +857,47 @@ function ue({ content: n, version: r, model: a, ...o }) {
|
|
|
738
857
|
})] });
|
|
739
858
|
}
|
|
740
859
|
function $({ content: e, version: r, ...i }) {
|
|
741
|
-
let { t: a } = t(),
|
|
860
|
+
let { t: a } = t(), o = n(i.client), c = () => r.segments.map((e) => ({
|
|
742
861
|
title: e.title ?? "",
|
|
743
862
|
start: String(e.start),
|
|
744
863
|
end: String(e.end),
|
|
745
|
-
release:
|
|
746
|
-
})), [l,
|
|
747
|
-
|
|
748
|
-
let [f, p] =
|
|
749
|
-
p(!1),
|
|
864
|
+
release: w(e.release_at)
|
|
865
|
+
})), [l, u] = L(c);
|
|
866
|
+
P(() => u(c()), [JSON.stringify(r.segments)]);
|
|
867
|
+
let [f, p] = L(!1), m = b("content.save", i.onError), h = (e, t) => {
|
|
868
|
+
p(!1), u((n) => n.map((n, r) => r === e ? {
|
|
750
869
|
...n,
|
|
751
870
|
...t
|
|
752
871
|
} : n));
|
|
753
872
|
}, g = l.every((e) => /^\d+$/.test(e.start) && /^\d+$/.test(e.end) && Number(e.end) > Number(e.start));
|
|
754
|
-
return /* @__PURE__ */
|
|
873
|
+
return /* @__PURE__ */ B("div", {
|
|
755
874
|
className: "grid gap-2",
|
|
756
875
|
"data-ckui": "segments-editor",
|
|
757
876
|
children: [
|
|
758
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ z("h4", {
|
|
759
878
|
className: "text-sm font-medium",
|
|
760
879
|
children: a("contentEditor.segments")
|
|
761
880
|
}),
|
|
762
|
-
l.length === 0 && /* @__PURE__ */
|
|
881
|
+
l.length === 0 && /* @__PURE__ */ z("p", {
|
|
763
882
|
className: "text-muted-foreground",
|
|
764
883
|
children: a("contentEditor.noSegments")
|
|
765
884
|
}),
|
|
766
|
-
l.map((e, t) => /* @__PURE__ */
|
|
885
|
+
l.map((e, t) => /* @__PURE__ */ B("div", {
|
|
767
886
|
className: "flex flex-wrap items-center gap-2",
|
|
768
887
|
"data-ckui": "segment-row",
|
|
769
888
|
children: [
|
|
770
|
-
/* @__PURE__ */
|
|
889
|
+
/* @__PURE__ */ z("span", {
|
|
771
890
|
className: "w-6 text-xs text-muted-foreground tabular-nums",
|
|
772
891
|
children: t + 1
|
|
773
892
|
}),
|
|
774
|
-
/* @__PURE__ */
|
|
893
|
+
/* @__PURE__ */ z(d, {
|
|
775
894
|
className: "h-8 w-40",
|
|
776
895
|
"aria-label": a("contentEditor.segmentTitle", { n: t + 1 }),
|
|
777
896
|
placeholder: a("contentEditor.segmentTitlePlaceholder"),
|
|
778
897
|
value: e.title,
|
|
779
898
|
onChange: (e) => h(t, { title: e.target.value })
|
|
780
899
|
}),
|
|
781
|
-
/* @__PURE__ */
|
|
900
|
+
/* @__PURE__ */ z(d, {
|
|
782
901
|
className: "h-8 w-20",
|
|
783
902
|
type: "number",
|
|
784
903
|
min: 0,
|
|
@@ -786,11 +905,11 @@ function $({ content: e, version: r, ...i }) {
|
|
|
786
905
|
value: e.start,
|
|
787
906
|
onChange: (e) => h(t, { start: e.target.value })
|
|
788
907
|
}),
|
|
789
|
-
/* @__PURE__ */
|
|
908
|
+
/* @__PURE__ */ z("span", {
|
|
790
909
|
"aria-hidden": !0,
|
|
791
910
|
children: "–"
|
|
792
911
|
}),
|
|
793
|
-
/* @__PURE__ */
|
|
912
|
+
/* @__PURE__ */ z(d, {
|
|
794
913
|
className: "h-8 w-20",
|
|
795
914
|
type: "number",
|
|
796
915
|
min: 1,
|
|
@@ -798,32 +917,32 @@ function $({ content: e, version: r, ...i }) {
|
|
|
798
917
|
value: e.end,
|
|
799
918
|
onChange: (e) => h(t, { end: e.target.value })
|
|
800
919
|
}),
|
|
801
|
-
/* @__PURE__ */
|
|
920
|
+
/* @__PURE__ */ z(d, {
|
|
802
921
|
className: "h-8 w-48",
|
|
803
922
|
type: "datetime-local",
|
|
804
923
|
"aria-label": a("contentEditor.segmentRelease", { n: t + 1 }),
|
|
805
924
|
value: e.release,
|
|
806
925
|
onChange: (e) => h(t, { release: e.target.value })
|
|
807
926
|
}),
|
|
808
|
-
/* @__PURE__ */
|
|
927
|
+
/* @__PURE__ */ z(s, {
|
|
809
928
|
type: "button",
|
|
810
929
|
size: "xs",
|
|
811
930
|
variant: "ghost",
|
|
812
|
-
onClick: () =>
|
|
931
|
+
onClick: () => u((e) => e.filter((e, n) => n !== t)),
|
|
813
932
|
children: a("common.remove")
|
|
814
933
|
})
|
|
815
934
|
]
|
|
816
935
|
}, t)),
|
|
817
|
-
/* @__PURE__ */
|
|
936
|
+
/* @__PURE__ */ B("div", {
|
|
818
937
|
className: "flex flex-wrap items-center gap-2",
|
|
819
938
|
children: [
|
|
820
|
-
/* @__PURE__ */
|
|
939
|
+
/* @__PURE__ */ z(s, {
|
|
821
940
|
type: "button",
|
|
822
941
|
size: "sm",
|
|
823
942
|
variant: "outline",
|
|
824
943
|
onClick: () => {
|
|
825
944
|
let e = l.at(-1), t = e && Number(e.end) || 0;
|
|
826
|
-
|
|
945
|
+
u((e) => [...e, {
|
|
827
946
|
title: "",
|
|
828
947
|
start: String(t),
|
|
829
948
|
end: String(t + 1),
|
|
@@ -832,7 +951,7 @@ function $({ content: e, version: r, ...i }) {
|
|
|
832
951
|
},
|
|
833
952
|
children: a("contentEditor.addSegment")
|
|
834
953
|
}),
|
|
835
|
-
/* @__PURE__ */
|
|
954
|
+
/* @__PURE__ */ z(s, {
|
|
836
955
|
type: "button",
|
|
837
956
|
size: "sm",
|
|
838
957
|
disabled: m.pending || !g,
|
|
@@ -843,49 +962,49 @@ function $({ content: e, version: r, ...i }) {
|
|
|
843
962
|
title: e.title.trim() || void 0,
|
|
844
963
|
start: Number(e.start),
|
|
845
964
|
end: Number(e.end),
|
|
846
|
-
release_at:
|
|
965
|
+
release_at: S(e.release),
|
|
847
966
|
released: !1
|
|
848
967
|
}));
|
|
849
|
-
m.run(() =>
|
|
968
|
+
m.run(() => o.contents.setSegments(e.id, r.id, t)).then((e) => e && p(!0));
|
|
850
969
|
},
|
|
851
970
|
children: a("contentEditor.saveSegments")
|
|
852
971
|
}),
|
|
853
|
-
/* @__PURE__ */
|
|
972
|
+
/* @__PURE__ */ z(G, { show: f })
|
|
854
973
|
]
|
|
855
974
|
}),
|
|
856
|
-
/* @__PURE__ */
|
|
975
|
+
/* @__PURE__ */ z(y, { error: m.error })
|
|
857
976
|
]
|
|
858
977
|
});
|
|
859
978
|
}
|
|
860
|
-
function
|
|
861
|
-
let r = e(), i =
|
|
979
|
+
function _e({ content: t, ...n }) {
|
|
980
|
+
let r = e(), i = F(() => t.versions.map((e) => ({
|
|
862
981
|
id: e.id,
|
|
863
|
-
label:
|
|
982
|
+
label: Z(e, r, n.labels)
|
|
864
983
|
})), [
|
|
865
984
|
t.versions,
|
|
866
985
|
r,
|
|
867
986
|
n.labels
|
|
868
|
-
]), { spec: a } =
|
|
869
|
-
return /* @__PURE__ */
|
|
870
|
-
className:
|
|
987
|
+
]), { spec: a } = K(t.kind, n.client);
|
|
988
|
+
return /* @__PURE__ */ B("div", {
|
|
989
|
+
className: V("grid gap-6", n.className),
|
|
871
990
|
"data-ckui": "content-sections",
|
|
872
991
|
children: [
|
|
873
|
-
/* @__PURE__ */
|
|
992
|
+
/* @__PURE__ */ z(X, {
|
|
874
993
|
content: t,
|
|
875
994
|
...n
|
|
876
995
|
}),
|
|
877
|
-
/* @__PURE__ */
|
|
996
|
+
/* @__PURE__ */ z(ue, {
|
|
878
997
|
content: t,
|
|
879
998
|
...n
|
|
880
999
|
}),
|
|
881
|
-
/* @__PURE__ */
|
|
1000
|
+
/* @__PURE__ */ z(fe, {
|
|
882
1001
|
content: t,
|
|
883
1002
|
...n
|
|
884
1003
|
}),
|
|
885
|
-
!!a?.entities?.length && /* @__PURE__ */
|
|
1004
|
+
!!a?.entities?.length && /* @__PURE__ */ z("section", {
|
|
886
1005
|
className: "grid gap-3 border-t border-border pt-4",
|
|
887
1006
|
"data-ckui": "content-groups",
|
|
888
|
-
children: /* @__PURE__ */
|
|
1007
|
+
children: /* @__PURE__ */ z(j, {
|
|
889
1008
|
management: n.management,
|
|
890
1009
|
content: t.id,
|
|
891
1010
|
contentKind: t.kind,
|
|
@@ -899,6 +1018,6 @@ function de({ content: t, ...n }) {
|
|
|
899
1018
|
});
|
|
900
1019
|
}
|
|
901
1020
|
//#endregion
|
|
902
|
-
export {
|
|
1021
|
+
export { ue as AccessEditor, X as ContentDetailsEditor, _e as ContentSections, $ as SegmentsEditor, he as VersionCover, fe as VersionsEditor, Z as versionLabel };
|
|
903
1022
|
|
|
904
1023
|
//# sourceMappingURL=editors.js.map
|