@voltro/cms 0.81.0 → 0.83.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/CHANGELOG.md +1806 -6
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/extensionManifest-BK3ZcL2P.js +2782 -0
- package/dist/index.d.ts +3659 -158
- package/dist/index.js +3773 -219
- package/dist/web.d.ts +1447 -26
- package/dist/web.js +2 -2
- package/package.json +5 -4
- package/dist/ContentForm-DUW_rb_m.js +0 -278
|
@@ -0,0 +1,2782 @@
|
|
|
1
|
+
import { Schema as e } from "effect";
|
|
2
|
+
import { createElement as t, useEffect as n, useId as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
3
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
|
+
//#region src/fieldSchema.ts
|
|
5
|
+
var u = (e) => ({
|
|
6
|
+
...e,
|
|
7
|
+
pipe(...t) {
|
|
8
|
+
let n = e;
|
|
9
|
+
for (let e of t) n = e(n);
|
|
10
|
+
return u(n);
|
|
11
|
+
},
|
|
12
|
+
optional() {
|
|
13
|
+
return u({
|
|
14
|
+
...e,
|
|
15
|
+
isOptional: !0
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
requiredToPublish() {
|
|
19
|
+
return u({
|
|
20
|
+
...e,
|
|
21
|
+
isOptional: !0,
|
|
22
|
+
publishRequired: !0
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}), d = (e) => (t) => ({
|
|
26
|
+
...t,
|
|
27
|
+
maxLength: e,
|
|
28
|
+
editorHint: t.kind === "string" && e > 120 ? "textarea" : t.editorHint
|
|
29
|
+
}), f = (e) => (t) => ({
|
|
30
|
+
...t,
|
|
31
|
+
pattern: e.source
|
|
32
|
+
}), p = () => (e) => ({
|
|
33
|
+
...e,
|
|
34
|
+
unique: !0
|
|
35
|
+
}), m = (e, t) => u({
|
|
36
|
+
kind: e,
|
|
37
|
+
editorHint: t,
|
|
38
|
+
isOptional: !1
|
|
39
|
+
}), h = {
|
|
40
|
+
String: m("string", "text"),
|
|
41
|
+
Number: m("number", "number"),
|
|
42
|
+
Fraction: u({
|
|
43
|
+
kind: "number",
|
|
44
|
+
editorHint: "number",
|
|
45
|
+
isOptional: !1,
|
|
46
|
+
fraction: !0
|
|
47
|
+
}),
|
|
48
|
+
Boolean: m("boolean", "boolean"),
|
|
49
|
+
Date: m("date", "date"),
|
|
50
|
+
DateTime: m("datetime", "datetime"),
|
|
51
|
+
maxLength: d,
|
|
52
|
+
pattern: f,
|
|
53
|
+
unique: p,
|
|
54
|
+
Literal: (...e) => u({
|
|
55
|
+
kind: "literal",
|
|
56
|
+
editorHint: "select",
|
|
57
|
+
isOptional: !1,
|
|
58
|
+
literals: e
|
|
59
|
+
}),
|
|
60
|
+
RichText: (e = {}) => u({
|
|
61
|
+
kind: "richText",
|
|
62
|
+
editorHint: "richText",
|
|
63
|
+
isOptional: !1,
|
|
64
|
+
richText: e
|
|
65
|
+
}),
|
|
66
|
+
Media: () => u({
|
|
67
|
+
kind: "media",
|
|
68
|
+
editorHint: "media",
|
|
69
|
+
isOptional: !1
|
|
70
|
+
}),
|
|
71
|
+
Reference: (e) => u({
|
|
72
|
+
kind: "reference",
|
|
73
|
+
editorHint: "reference",
|
|
74
|
+
isOptional: !1,
|
|
75
|
+
referenceType: e
|
|
76
|
+
}),
|
|
77
|
+
Array: (e) => u({
|
|
78
|
+
kind: "array",
|
|
79
|
+
editorHint: "array",
|
|
80
|
+
isOptional: !1,
|
|
81
|
+
element: e
|
|
82
|
+
}),
|
|
83
|
+
Struct: (e) => u({
|
|
84
|
+
kind: "struct",
|
|
85
|
+
editorHint: "struct",
|
|
86
|
+
isOptional: !1,
|
|
87
|
+
struct: e
|
|
88
|
+
}),
|
|
89
|
+
Components: (e) => {
|
|
90
|
+
let t = e.map((e) => e.id), n = t.find((e, n) => t.indexOf(e) !== n);
|
|
91
|
+
if (n !== void 0) throw Error(`Schema.Components: component '${n}' is listed twice.`);
|
|
92
|
+
return u({
|
|
93
|
+
kind: "components",
|
|
94
|
+
editorHint: "components",
|
|
95
|
+
isOptional: !1,
|
|
96
|
+
components: e
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}, g = (e) => Object.keys(e).sort().map((t) => {
|
|
100
|
+
let n = e[t], r = n.struct ? `{${g(n.struct)}}` : n.element ? `[${g({ _: n.element })}]` : "";
|
|
101
|
+
return `${t}:${n.kind}${n.isOptional ? "?" : ""}${n.literals ? `(${n.literals.join("|")})` : ""}${n.referenceType ? `->${n.referenceType}` : ""}${r}`;
|
|
102
|
+
}).join(","), _ = (e) => {
|
|
103
|
+
let t = 2166136261;
|
|
104
|
+
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
105
|
+
return (t >>> 0).toString(16).padStart(8, "0");
|
|
106
|
+
}, v = (e) => {
|
|
107
|
+
if (!/^[a-z][a-zA-Z0-9]*$/.test(e.id)) throw Error(`defineComponent('${e.id}'): the id must be camelCase letters and digits.`);
|
|
108
|
+
let t = e.props;
|
|
109
|
+
return {
|
|
110
|
+
id: e.id,
|
|
111
|
+
displayName: e.displayName,
|
|
112
|
+
props: t,
|
|
113
|
+
fingerprint: _(`${e.id}|${g(t)}`),
|
|
114
|
+
...e.consent === void 0 ? {} : { consent: e.consent }
|
|
115
|
+
};
|
|
116
|
+
}, y = (e, t) => (n) => ({
|
|
117
|
+
...n,
|
|
118
|
+
derived: {
|
|
119
|
+
source: e,
|
|
120
|
+
transform: t
|
|
121
|
+
}
|
|
122
|
+
}), b = {
|
|
123
|
+
ä: "ae",
|
|
124
|
+
ö: "oe",
|
|
125
|
+
ü: "ue",
|
|
126
|
+
ß: "ss",
|
|
127
|
+
æ: "ae",
|
|
128
|
+
œ: "oe",
|
|
129
|
+
ø: "o",
|
|
130
|
+
å: "a",
|
|
131
|
+
ł: "l",
|
|
132
|
+
đ: "d",
|
|
133
|
+
þ: "th"
|
|
134
|
+
}, ee = (e) => String(e).normalize("NFC").toLowerCase().trim().replace(/[äöüßæœøåłđþ]/g, (e) => b[e] ?? e).normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, ""), x = (e) => Array.isArray(e) ? e.map((e) => typeof e == "object" && e ? String(e.componentId ?? "") : "") : [], S = (e, t) => {
|
|
135
|
+
let n = e.templates, r = n === void 0 ? void 0 : t[n.field];
|
|
136
|
+
if (n !== void 0 && typeof r == "string" && r !== "") return n.list.find((e) => e.id === r) ?? null;
|
|
137
|
+
}, te = (e, t) => {
|
|
138
|
+
let n = e.templates, r = S(e, t);
|
|
139
|
+
if (n === void 0 || r === void 0) return [];
|
|
140
|
+
if (r === null) return [{
|
|
141
|
+
field: n.field,
|
|
142
|
+
rule: "unknown",
|
|
143
|
+
message: `no template '${String(t[n.field])}' for ${e.name}`
|
|
144
|
+
}];
|
|
145
|
+
let i = x(t[n.components]), a = [];
|
|
146
|
+
for (let e of r.required ?? []) i.includes(e.id) || a.push({
|
|
147
|
+
field: n.components,
|
|
148
|
+
rule: "required",
|
|
149
|
+
message: `the ${r.displayName} template needs a ${e.displayName}`
|
|
150
|
+
});
|
|
151
|
+
r.first !== void 0 && i.length > 0 && i[0] !== r.first.id && a.push({
|
|
152
|
+
field: n.components,
|
|
153
|
+
rule: "position",
|
|
154
|
+
message: `the ${r.displayName} template starts with a ${r.first.displayName}`
|
|
155
|
+
});
|
|
156
|
+
for (let e of r.max ?? []) i.filter((t) => t === e.component.id).length > e.count && a.push({
|
|
157
|
+
field: n.components,
|
|
158
|
+
rule: "max",
|
|
159
|
+
message: `the ${r.displayName} template allows at most ${e.count} ${e.component.displayName}`
|
|
160
|
+
});
|
|
161
|
+
return a;
|
|
162
|
+
}, ne = (e, t) => {
|
|
163
|
+
let n = e.templates, r = n?.list.find((e) => e.id === t);
|
|
164
|
+
return n === void 0 || r === void 0 ? null : {
|
|
165
|
+
...r.values,
|
|
166
|
+
[n.field]: r.id,
|
|
167
|
+
[n.components]: (r.sections ?? []).map((e) => ({
|
|
168
|
+
componentId: e.component.id,
|
|
169
|
+
props: { ...e.props }
|
|
170
|
+
}))
|
|
171
|
+
};
|
|
172
|
+
}, re = (e, t, n) => {
|
|
173
|
+
let r = (t) => {
|
|
174
|
+
throw Error(`defineContentType('${e}'): templates ${t}`);
|
|
175
|
+
}, i = t[n.field];
|
|
176
|
+
(i === void 0 || i.kind !== "string" || !i.isOptional) && r(`field '${n.field}' must be a declared optional string field.`);
|
|
177
|
+
let a = t[n.components];
|
|
178
|
+
(a === void 0 || a.kind !== "components") && r(`components '${n.components}' must be a declared Schema.Components field.`);
|
|
179
|
+
let o = new Set((a?.components ?? []).map((e) => e.id)), s = /* @__PURE__ */ new Set();
|
|
180
|
+
for (let e of n.list) {
|
|
181
|
+
s.has(e.id) && r(`id '${e.id}' is declared twice.`), s.add(e.id);
|
|
182
|
+
let t = [
|
|
183
|
+
...(e.sections ?? []).map((e) => e.component),
|
|
184
|
+
...e.required ?? [],
|
|
185
|
+
...e.first ? [e.first] : [],
|
|
186
|
+
...(e.max ?? []).map((e) => e.component)
|
|
187
|
+
];
|
|
188
|
+
for (let i of t) o.has(i.id) || r(`'${e.id}' uses '${i.id}', which '${n.components}' does not allow.`);
|
|
189
|
+
}
|
|
190
|
+
}, ie = 3, C = (e, t) => t === 0 ? e.ordered : (e.sublists?.[t - 1] ?? (e.ordered ? "ordered" : "unordered")) === "ordered", ae = /* @__PURE__ */ new Set([
|
|
191
|
+
"bold",
|
|
192
|
+
"italic",
|
|
193
|
+
"underline"
|
|
194
|
+
]), w = (e) => typeof e == "object" && !!e && !Array.isArray(e), T = () => `rb_${crypto.randomUUID().replace(/-/g, "")}`, oe = () => ({
|
|
195
|
+
type: "doc",
|
|
196
|
+
blocks: []
|
|
197
|
+
}), E = (e) => typeof e == "string" ? {
|
|
198
|
+
type: "doc",
|
|
199
|
+
blocks: e.split(/\n{2,}/).map((e) => e.trim()).filter((e) => e !== "").map((e) => ({
|
|
200
|
+
id: T(),
|
|
201
|
+
type: "paragraph",
|
|
202
|
+
content: [{
|
|
203
|
+
type: "text",
|
|
204
|
+
text: e
|
|
205
|
+
}]
|
|
206
|
+
}))
|
|
207
|
+
} : !w(e) || e.type !== "doc" || !Array.isArray(e.blocks) ? e : {
|
|
208
|
+
...e,
|
|
209
|
+
blocks: e.blocks.map((e) => w(e) && (typeof e.id != "string" || e.id === "") ? {
|
|
210
|
+
...e,
|
|
211
|
+
id: T()
|
|
212
|
+
} : e)
|
|
213
|
+
}, D = (e, t, n, r) => {
|
|
214
|
+
if (!Array.isArray(t)) {
|
|
215
|
+
r.push({
|
|
216
|
+
path: e,
|
|
217
|
+
rule: "type",
|
|
218
|
+
message: "expected a list of inline nodes"
|
|
219
|
+
});
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
t.forEach((t, i) => {
|
|
223
|
+
let a = `${e}[${i}]`;
|
|
224
|
+
if (!w(t)) return void r.push({
|
|
225
|
+
path: a,
|
|
226
|
+
rule: "type",
|
|
227
|
+
message: "expected an inline node"
|
|
228
|
+
});
|
|
229
|
+
if (t.type === "text") {
|
|
230
|
+
typeof t.text != "string" && r.push({
|
|
231
|
+
path: a,
|
|
232
|
+
rule: "type",
|
|
233
|
+
message: "text must be a string"
|
|
234
|
+
});
|
|
235
|
+
let e = t.marks;
|
|
236
|
+
e !== void 0 && (!Array.isArray(e) || e.some((e) => !ae.has(String(e)))) && r.push({
|
|
237
|
+
path: a,
|
|
238
|
+
rule: "unknown",
|
|
239
|
+
message: `marks must be ${[...ae].join(" / ")}`
|
|
240
|
+
});
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (t.type === "link") {
|
|
244
|
+
if (n.links === void 0) return void r.push({
|
|
245
|
+
path: a,
|
|
246
|
+
rule: "richText",
|
|
247
|
+
message: "links are not allowed in this field"
|
|
248
|
+
});
|
|
249
|
+
(typeof t.target != "string" || t.target === "") && r.push({
|
|
250
|
+
path: a,
|
|
251
|
+
rule: "required",
|
|
252
|
+
message: "a link needs a target document"
|
|
253
|
+
}), (typeof t.text != "string" || t.text === "") && r.push({
|
|
254
|
+
path: a,
|
|
255
|
+
rule: "required",
|
|
256
|
+
message: "a link needs text"
|
|
257
|
+
});
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
r.push({
|
|
261
|
+
path: a,
|
|
262
|
+
rule: "unknown",
|
|
263
|
+
message: `unknown inline node '${String(t.type)}'`
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
}, se = (e, t, n) => {
|
|
267
|
+
let r = [];
|
|
268
|
+
if (!w(t) || t.type !== "doc" || !Array.isArray(t.blocks)) return [{
|
|
269
|
+
path: e,
|
|
270
|
+
rule: "type",
|
|
271
|
+
message: "expected a rich document ({ type: 'doc', blocks })"
|
|
272
|
+
}];
|
|
273
|
+
let i = /* @__PURE__ */ new Set();
|
|
274
|
+
return t.blocks.forEach((t, a) => {
|
|
275
|
+
let o = `${e}.blocks[${a}]`;
|
|
276
|
+
if (!w(t)) return void r.push({
|
|
277
|
+
path: o,
|
|
278
|
+
rule: "type",
|
|
279
|
+
message: "expected a block"
|
|
280
|
+
});
|
|
281
|
+
let s = t.id;
|
|
282
|
+
switch (typeof s != "string" || s === "" ? r.push({
|
|
283
|
+
path: `${o}.id`,
|
|
284
|
+
rule: "required",
|
|
285
|
+
message: "every block needs an id"
|
|
286
|
+
}) : i.has(s) ? r.push({
|
|
287
|
+
path: `${o}.id`,
|
|
288
|
+
rule: "unique",
|
|
289
|
+
message: `block id '${s}' is used twice`
|
|
290
|
+
}) : i.add(s), t.type) {
|
|
291
|
+
case "paragraph": return D(`${o}.content`, t.content, n, r);
|
|
292
|
+
case "heading": return t.level !== 2 && t.level !== 3 && r.push({
|
|
293
|
+
path: `${o}.level`,
|
|
294
|
+
rule: "literal",
|
|
295
|
+
message: "a heading is level 2 or 3"
|
|
296
|
+
}), D(`${o}.content`, t.content, n, r);
|
|
297
|
+
case "list": {
|
|
298
|
+
let e = t.items;
|
|
299
|
+
if (typeof t.ordered != "boolean" && r.push({
|
|
300
|
+
path: `${o}.ordered`,
|
|
301
|
+
rule: "type",
|
|
302
|
+
message: "ordered must be true or false"
|
|
303
|
+
}), !Array.isArray(e)) return void r.push({
|
|
304
|
+
path: `${o}.items`,
|
|
305
|
+
rule: "type",
|
|
306
|
+
message: "expected list items"
|
|
307
|
+
});
|
|
308
|
+
let i = t.levels;
|
|
309
|
+
i !== void 0 && (!Array.isArray(i) || i.length !== e.length ? r.push({
|
|
310
|
+
path: `${o}.levels`,
|
|
311
|
+
rule: "type",
|
|
312
|
+
message: "one level per item"
|
|
313
|
+
}) : i.forEach((e, t) => {
|
|
314
|
+
let n = t === 0 ? -1 : Number(i[t - 1]);
|
|
315
|
+
(!Number.isInteger(e) || e < 0 || e > 3 || e > n + 1) && r.push({
|
|
316
|
+
path: `${o}.levels[${t}]`,
|
|
317
|
+
rule: "level",
|
|
318
|
+
message: "an item sits at most 3 deep, and at most one deeper than the item before it"
|
|
319
|
+
});
|
|
320
|
+
}));
|
|
321
|
+
let a = t.sublists;
|
|
322
|
+
return a !== void 0 && (!Array.isArray(a) || a.length > 3 || a.some((e) => e !== "ordered" && e !== "unordered")) && r.push({
|
|
323
|
+
path: `${o}.sublists`,
|
|
324
|
+
rule: "type",
|
|
325
|
+
message: "at most 3 kinds of nested lists, each ordered or unordered"
|
|
326
|
+
}), e.forEach((e, t) => D(`${o}.items[${t}]`, e, n, r));
|
|
327
|
+
}
|
|
328
|
+
case "table": {
|
|
329
|
+
let e = t.rows;
|
|
330
|
+
return typeof t.header != "boolean" && r.push({
|
|
331
|
+
path: `${o}.header`,
|
|
332
|
+
rule: "type",
|
|
333
|
+
message: "header must be true or false"
|
|
334
|
+
}), Array.isArray(e) ? e.forEach((e, t) => {
|
|
335
|
+
if (!Array.isArray(e)) return void r.push({
|
|
336
|
+
path: `${o}.rows[${t}]`,
|
|
337
|
+
rule: "type",
|
|
338
|
+
message: "expected a row of cells"
|
|
339
|
+
});
|
|
340
|
+
e.forEach((e, i) => D(`${o}.rows[${t}][${i}]`, e, n, r));
|
|
341
|
+
}) : void r.push({
|
|
342
|
+
path: `${o}.rows`,
|
|
343
|
+
rule: "type",
|
|
344
|
+
message: "expected table rows"
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
case "image":
|
|
348
|
+
if (n.images === void 0) return void r.push({
|
|
349
|
+
path: o,
|
|
350
|
+
rule: "richText",
|
|
351
|
+
message: "images are not allowed in this field"
|
|
352
|
+
});
|
|
353
|
+
(typeof t.asset != "string" || t.asset === "") && r.push({
|
|
354
|
+
path: `${o}.asset`,
|
|
355
|
+
rule: "required",
|
|
356
|
+
message: "an image needs an asset"
|
|
357
|
+
}), t.caption !== void 0 && typeof t.caption != "string" && r.push({
|
|
358
|
+
path: `${o}.caption`,
|
|
359
|
+
rule: "type",
|
|
360
|
+
message: "a caption is text"
|
|
361
|
+
});
|
|
362
|
+
return;
|
|
363
|
+
default: r.push({
|
|
364
|
+
path: o,
|
|
365
|
+
rule: "unknown",
|
|
366
|
+
message: `unknown block '${String(t.type)}'`
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}), r;
|
|
370
|
+
}, ce = (e, t, n) => {
|
|
371
|
+
let r = [], i = (e, t) => {
|
|
372
|
+
t.forEach((t, i) => {
|
|
373
|
+
t.type === "link" && n.links !== void 0 && t.target !== "" && r.push({
|
|
374
|
+
path: `${e}[${i}]`,
|
|
375
|
+
targetType: n.links,
|
|
376
|
+
targetDocumentId: t.target
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
};
|
|
380
|
+
return t.blocks.forEach((t, a) => {
|
|
381
|
+
let o = `${e}.blocks[${a}]`;
|
|
382
|
+
switch (t.type) {
|
|
383
|
+
case "paragraph":
|
|
384
|
+
case "heading": return i(`${o}.content`, t.content);
|
|
385
|
+
case "list": return t.items.forEach((e, t) => i(`${o}.items[${t}]`, e));
|
|
386
|
+
case "table": return t.rows.forEach((e, t) => e.forEach((e, n) => i(`${o}.rows[${t}][${n}]`, e)));
|
|
387
|
+
case "image":
|
|
388
|
+
n.images !== void 0 && t.asset !== "" && r.push({
|
|
389
|
+
path: o,
|
|
390
|
+
targetType: n.images,
|
|
391
|
+
targetDocumentId: t.asset
|
|
392
|
+
});
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
}), r;
|
|
396
|
+
}, le = /[*_+[\]()\\]/, O = (e) => {
|
|
397
|
+
let t = [], n = "", r = [], i = () => {
|
|
398
|
+
if (n === "") return;
|
|
399
|
+
let e = t[t.length - 1];
|
|
400
|
+
e?.type === "text" && (e.marks ?? []).join() === r.join() && e.type === "text" ? t[t.length - 1] = {
|
|
401
|
+
...e,
|
|
402
|
+
text: e.text + n
|
|
403
|
+
} : t.push(r.length > 0 ? {
|
|
404
|
+
type: "text",
|
|
405
|
+
text: n,
|
|
406
|
+
marks: [...r]
|
|
407
|
+
} : {
|
|
408
|
+
type: "text",
|
|
409
|
+
text: n
|
|
410
|
+
}), n = "";
|
|
411
|
+
}, a = (e, t) => {
|
|
412
|
+
i(), r = t ? r.filter((t) => t !== e) : [...r, e];
|
|
413
|
+
}, o = 0;
|
|
414
|
+
for (; o < e.length;) {
|
|
415
|
+
let s = e[o];
|
|
416
|
+
if (s === "\\" && o + 1 < e.length && le.test(e[o + 1])) {
|
|
417
|
+
n += e[o + 1], o += 2;
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
if (e.startsWith("**", o)) {
|
|
421
|
+
let t = r.includes("bold");
|
|
422
|
+
if (t || e.indexOf("**", o + 2) !== -1) {
|
|
423
|
+
a("bold", t), o += 2;
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (e.startsWith("++", o)) {
|
|
428
|
+
let t = r.includes("underline");
|
|
429
|
+
if (t || e.indexOf("++", o + 2) !== -1) {
|
|
430
|
+
a("underline", t), o += 2;
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
if (s === "_") {
|
|
435
|
+
let t = r.includes("italic");
|
|
436
|
+
if (t || e.indexOf("_", o + 1) !== -1) {
|
|
437
|
+
a("italic", t), o += 1;
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (s === "[") {
|
|
442
|
+
let n = /^\[([^\]]+)\]\(doc:([^)\s]+)\)/.exec(e.slice(o));
|
|
443
|
+
if (n !== null) {
|
|
444
|
+
i(), t.push({
|
|
445
|
+
type: "link",
|
|
446
|
+
text: n[1],
|
|
447
|
+
target: n[2]
|
|
448
|
+
}), o += n[0].length;
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
n += s, o += 1;
|
|
453
|
+
}
|
|
454
|
+
return i(), t;
|
|
455
|
+
}, ue = (e) => e.replace(/[*_+[\]()\\]/g, (e) => `\\${e}`), k = (e) => e.map((e) => {
|
|
456
|
+
if (e.type === "link") return `[${ue(e.text)}](doc:${e.target})`;
|
|
457
|
+
let t = e.marks ?? [], n = t.includes("bold") ? "**" : "", r = t.includes("italic") ? "_" : "", i = t.includes("underline") ? "++" : "";
|
|
458
|
+
return `${n}${r}${i}${ue(e.text)}${i}${r}${n}`;
|
|
459
|
+
}).join(""), de = (e) => {
|
|
460
|
+
let t = (e) => e.map((e) => e.text).join("");
|
|
461
|
+
return e.blocks.map((e) => {
|
|
462
|
+
switch (e.type) {
|
|
463
|
+
case "paragraph":
|
|
464
|
+
case "heading": return t(e.content);
|
|
465
|
+
case "list": return e.items.map(t).join("\n");
|
|
466
|
+
case "table": return e.rows.map((e) => e.map(t).join(" ")).join("\n");
|
|
467
|
+
case "image": return e.caption ?? "";
|
|
468
|
+
}
|
|
469
|
+
}).filter((e) => e !== "").join("\n");
|
|
470
|
+
}, A = (e) => e.normalize("NFKC").trim().replace(/\s+/g, " ").toLowerCase(), fe = (e, t) => {
|
|
471
|
+
let n = /* @__PURE__ */ new Map();
|
|
472
|
+
for (let t of e.terms) {
|
|
473
|
+
n.set(A(t.term), t.term);
|
|
474
|
+
for (let e of t.synonyms ?? []) n.set(A(e), t.term);
|
|
475
|
+
}
|
|
476
|
+
let r = [], i = [];
|
|
477
|
+
for (let e of t) {
|
|
478
|
+
if (typeof e != "string" || e.trim() === "") continue;
|
|
479
|
+
let t = n.get(A(e));
|
|
480
|
+
if (t !== void 0) r.includes(t) || r.push(t);
|
|
481
|
+
else {
|
|
482
|
+
let t = e.normalize("NFKC").trim().replace(/\s+/g, " ");
|
|
483
|
+
i.some((e) => A(e) === A(t)) || i.push(t);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
terms: r,
|
|
488
|
+
unknown: i
|
|
489
|
+
};
|
|
490
|
+
}, pe = (e, t) => {
|
|
491
|
+
let { terms: n, unknown: r } = fe(e, t);
|
|
492
|
+
return [...n, ...r];
|
|
493
|
+
}, me = (e) => {
|
|
494
|
+
if (e.terms.length === 0) return "names no terms";
|
|
495
|
+
let t = /* @__PURE__ */ new Map();
|
|
496
|
+
for (let n of e.terms) for (let e of [n.term, ...n.synonyms ?? []]) {
|
|
497
|
+
let r = A(e), i = t.get(r);
|
|
498
|
+
if (i !== void 0 && i !== n.term) return `'${e}' means both '${i}' and '${n.term}'`;
|
|
499
|
+
t.set(r, n.term);
|
|
500
|
+
}
|
|
501
|
+
return null;
|
|
502
|
+
}, he = (e, t) => {
|
|
503
|
+
let n = e[t.parent];
|
|
504
|
+
return typeof n == "string" && n !== "" ? n : null;
|
|
505
|
+
}, ge = (e, t) => {
|
|
506
|
+
let n = t.order === void 0 ? void 0 : e[t.order];
|
|
507
|
+
return typeof n == "number" && Number.isFinite(n) ? n : Infinity;
|
|
508
|
+
}, _e = (e, t) => {
|
|
509
|
+
let n = e[t.segment];
|
|
510
|
+
return typeof n == "string" ? n : "";
|
|
511
|
+
}, ve = (e, t) => {
|
|
512
|
+
let n = /* @__PURE__ */ new Map();
|
|
513
|
+
for (let t of e) {
|
|
514
|
+
let e = t.row.documentId;
|
|
515
|
+
typeof e == "string" && !n.has(e) && n.set(e, t);
|
|
516
|
+
}
|
|
517
|
+
let r = /* @__PURE__ */ new Map();
|
|
518
|
+
for (let e of n.values()) {
|
|
519
|
+
let n = he(e.row, t), i = r.get(n) ?? [];
|
|
520
|
+
i.push(e), r.set(n, i);
|
|
521
|
+
}
|
|
522
|
+
let i = (e, n) => ge(e.row, t) - ge(n.row, t) || _e(e.row, t).localeCompare(_e(n.row, t)) || String(e.row.documentId).localeCompare(String(n.row.documentId)), a = [], o = /* @__PURE__ */ new Set(), s = (e, n) => {
|
|
523
|
+
for (let c of [...r.get(e) ?? []].sort(i)) {
|
|
524
|
+
let r = c.row.documentId, i = _e(c.row, t);
|
|
525
|
+
if (i === "" || o.has(r)) continue;
|
|
526
|
+
o.add(r);
|
|
527
|
+
let l = [...n, i];
|
|
528
|
+
a.push({
|
|
529
|
+
documentId: r,
|
|
530
|
+
parent: e,
|
|
531
|
+
depth: n.length,
|
|
532
|
+
segments: l,
|
|
533
|
+
path: l.join("/"),
|
|
534
|
+
row: c.row,
|
|
535
|
+
locale: c.locale,
|
|
536
|
+
fallback: c.fallback
|
|
537
|
+
}), s(r, l);
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
return s(null, []), {
|
|
541
|
+
nodes: a,
|
|
542
|
+
orphans: [...n.keys()].filter((e) => !o.has(e)).sort()
|
|
543
|
+
};
|
|
544
|
+
}, ye = (e) => e != null && e !== "", be = (e, t, n, r = {}) => {
|
|
545
|
+
let i = new Map(e.nodes.map((e) => [e.documentId, e])), a = r.ancestorsOnly === !0 ? t.parent === null ? void 0 : i.get(t.parent) : t, o = /* @__PURE__ */ new Set();
|
|
546
|
+
for (; a !== void 0 && !o.has(a.documentId);) {
|
|
547
|
+
if (o.add(a.documentId), ye(a.row[n])) return {
|
|
548
|
+
value: a.row[n],
|
|
549
|
+
from: a.documentId
|
|
550
|
+
};
|
|
551
|
+
a = a.parent === null ? void 0 : i.get(a.parent);
|
|
552
|
+
}
|
|
553
|
+
return {
|
|
554
|
+
value: void 0,
|
|
555
|
+
from: null
|
|
556
|
+
};
|
|
557
|
+
}, xe = e.Struct({
|
|
558
|
+
field: e.String,
|
|
559
|
+
rule: e.String,
|
|
560
|
+
message: e.String
|
|
561
|
+
}), Se = class extends e.TaggedError()("ContentValidationFailed", {
|
|
562
|
+
contentType: e.String,
|
|
563
|
+
violations: e.Array(xe)
|
|
564
|
+
}) {}, Ce = class extends e.TaggedError()("ContentNotFound", {
|
|
565
|
+
contentType: e.String,
|
|
566
|
+
id: e.String,
|
|
567
|
+
stage: e.Literal("draft", "published", "revision", "share")
|
|
568
|
+
}) {}, we = class extends e.TaggedError()("ContentGone", {
|
|
569
|
+
contentType: e.String,
|
|
570
|
+
path: e.String
|
|
571
|
+
}) {}, Te = class extends e.TaggedError()("ContentIdConflict", {
|
|
572
|
+
contentType: e.String,
|
|
573
|
+
id: e.String
|
|
574
|
+
}) {}, Ee = class extends e.TaggedError()("RevisionMismatch", {
|
|
575
|
+
contentType: e.String,
|
|
576
|
+
id: e.String,
|
|
577
|
+
expected: e.String,
|
|
578
|
+
actual: e.String
|
|
579
|
+
}) {}, De = class extends e.TaggedError()("ReleaseNotEditable", {
|
|
580
|
+
id: e.String,
|
|
581
|
+
status: e.String
|
|
582
|
+
}) {}, Oe = class extends e.TaggedError()("PreviewShareRejected", { reason: e.Literal("expiryInPast", "expiryTooFar") }) {}, ke = class extends e.TaggedError()("ReviewRequired", {
|
|
583
|
+
contentType: e.String,
|
|
584
|
+
id: e.String,
|
|
585
|
+
revisionId: e.String
|
|
586
|
+
}) {}, Ae = class extends e.TaggedError()("ReviewStepRefused", {
|
|
587
|
+
contentType: e.String,
|
|
588
|
+
id: e.String,
|
|
589
|
+
reason: e.Literal("notInReview", "selfApproval", "ambiguousOrder")
|
|
590
|
+
}) {}, je = class extends e.TaggedError()("ReferenceUnavailable", {
|
|
591
|
+
contentType: e.String,
|
|
592
|
+
id: e.String,
|
|
593
|
+
targets: e.Array(e.Struct({
|
|
594
|
+
path: e.String,
|
|
595
|
+
contentType: e.String,
|
|
596
|
+
documentId: e.String,
|
|
597
|
+
reason: e.Literal("blocked", "expired")
|
|
598
|
+
}))
|
|
599
|
+
}) {}, Me = class extends e.TaggedError()("QuotaExceeded", {
|
|
600
|
+
quota: e.String,
|
|
601
|
+
limit: e.Number,
|
|
602
|
+
used: e.Number
|
|
603
|
+
}) {}, j = (e) => Array.isArray(e) ? e.map(j) : typeof e == "object" && e && !(e instanceof Date) ? Object.fromEntries(Object.keys(e).sort().map((t) => [t, j(e[t])])) : e instanceof Date ? e.toISOString() : e === void 0 ? null : e, M = (e, t, n) => Object.keys(e).filter((e) => JSON.stringify(j(t[e])) !== JSON.stringify(j(n[e]))), Ne = (e, t) => {
|
|
604
|
+
let n = [...e].sort((e, t) => Number(e.number) - Number(t.number)), r = [], i;
|
|
605
|
+
for (let e of n) {
|
|
606
|
+
let n = (e.values ?? {})[t], a = JSON.stringify(j(n));
|
|
607
|
+
a !== i && (i = a, n != null && n !== "" && r.push({
|
|
608
|
+
value: n,
|
|
609
|
+
revisionId: String(e.id),
|
|
610
|
+
number: Number(e.number),
|
|
611
|
+
createdAt: e.createdAt,
|
|
612
|
+
createdBy: e.createdBy
|
|
613
|
+
}));
|
|
614
|
+
}
|
|
615
|
+
return r.reverse();
|
|
616
|
+
}, Pe = (e) => e.match(/\s+|[^\s]+/g) ?? [], Fe = 4e6, Ie = (e, t) => {
|
|
617
|
+
let n = Pe(e), r = Pe(t), i = [], a = (e, t) => {
|
|
618
|
+
if (t === "") return;
|
|
619
|
+
let n = i[i.length - 1];
|
|
620
|
+
n !== void 0 && n.op === e ? i[i.length - 1] = {
|
|
621
|
+
op: e,
|
|
622
|
+
text: n.text + t
|
|
623
|
+
} : i.push({
|
|
624
|
+
op: e,
|
|
625
|
+
text: t
|
|
626
|
+
});
|
|
627
|
+
};
|
|
628
|
+
if (n.length * r.length > Fe) return a("removed", e), a("added", t), i;
|
|
629
|
+
let o = Array.from({ length: n.length + 1 }, () => Array(r.length + 1).fill(0));
|
|
630
|
+
for (let e = n.length - 1; e >= 0; e--) for (let t = r.length - 1; t >= 0; t--) o[e][t] = n[e] === r[t] ? o[e + 1][t + 1] + 1 : Math.max(o[e + 1][t], o[e][t + 1]);
|
|
631
|
+
let s = 0, c = 0;
|
|
632
|
+
for (; s < n.length && c < r.length;) n[s] === r[c] ? (a("same", n[s]), s++, c++) : o[s + 1][c] >= o[s][c + 1] ? (a("removed", n[s]), s++) : (a("added", r[c]), c++);
|
|
633
|
+
for (; s < n.length;) a("removed", n[s++]);
|
|
634
|
+
for (; c < r.length;) a("added", r[c++]);
|
|
635
|
+
return i;
|
|
636
|
+
}, Le = (e) => typeof e == "object" && !!e && e.type === "doc" && Array.isArray(e.blocks), N = (e) => {
|
|
637
|
+
if (e == null) return "";
|
|
638
|
+
if (typeof e == "string") return e;
|
|
639
|
+
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
640
|
+
if (e instanceof Date) return e.toISOString();
|
|
641
|
+
if (Le(e)) return de(e);
|
|
642
|
+
if (Array.isArray(e)) return e.map(N).join("\n");
|
|
643
|
+
let t = e;
|
|
644
|
+
if (typeof t.componentId == "string" && typeof t.props == "object" && t.props !== null) {
|
|
645
|
+
let e = Object.values(t.props).map(N).filter((e) => e !== "");
|
|
646
|
+
return `${t.componentId}: ${e.join(" · ")}`;
|
|
647
|
+
}
|
|
648
|
+
return JSON.stringify(j(e));
|
|
649
|
+
}, Re = (e, t, n) => M(e, t, n).map((e) => ({
|
|
650
|
+
field: e,
|
|
651
|
+
segments: Ie(N(t[e]), N(n[e]))
|
|
652
|
+
})), ze = /* @__PURE__ */ new Set([
|
|
653
|
+
"status",
|
|
654
|
+
"publishAt",
|
|
655
|
+
"unpublishAt",
|
|
656
|
+
"revisionId",
|
|
657
|
+
"revision",
|
|
658
|
+
"documentId",
|
|
659
|
+
"site",
|
|
660
|
+
"environment",
|
|
661
|
+
"locale",
|
|
662
|
+
"tenantId",
|
|
663
|
+
"createdAt",
|
|
664
|
+
"updatedAt",
|
|
665
|
+
"createdBy",
|
|
666
|
+
"updatedBy"
|
|
667
|
+
]), P = (e, t, n) => ({
|
|
668
|
+
field: e,
|
|
669
|
+
rule: t,
|
|
670
|
+
message: n
|
|
671
|
+
}), F = (e) => typeof e == "object" && !!e && !Array.isArray(e), Be = (e) => e instanceof Date ? !Number.isNaN(e.getTime()) : typeof e == "string" && !Number.isNaN(new Date(e).getTime()), Ve = (e, t, n) => {
|
|
672
|
+
let r = [];
|
|
673
|
+
return t.maxLength !== void 0 && n.length > t.maxLength && r.push(P(e, "maxLength", `exceeds maxLength(${t.maxLength}) — got ${n.length} characters`)), t.pattern !== void 0 && !new RegExp(t.pattern).test(n) && r.push(P(e, "pattern", `does not match pattern /${t.pattern}/`)), r;
|
|
674
|
+
}, He = (e, t, n) => {
|
|
675
|
+
switch (t.kind) {
|
|
676
|
+
case "string":
|
|
677
|
+
case "media":
|
|
678
|
+
case "reference": return typeof n == "string" ? Ve(e, t, n) : [P(e, "type", `expected a string, got ${typeof n}`)];
|
|
679
|
+
case "number": return typeof n != "number" || !Number.isFinite(n) ? [P(e, "type", "expected a finite number")] : t.fraction !== !0 && !Number.isInteger(n) ? [P(e, "integer", "expected a whole number (declare Schema.Fraction for fractions)")] : [];
|
|
680
|
+
case "boolean": return typeof n == "boolean" ? [] : [P(e, "type", `expected a boolean, got ${typeof n}`)];
|
|
681
|
+
case "date":
|
|
682
|
+
case "datetime": return Be(n) ? [] : [P(e, "type", "expected a Date or a parseable date string")];
|
|
683
|
+
case "literal": {
|
|
684
|
+
let r = t.literals ?? [];
|
|
685
|
+
return typeof n != "string" || !r.includes(n) ? [P(e, "literal", `expected one of: ${r.join(", ")}`)] : [];
|
|
686
|
+
}
|
|
687
|
+
case "richText": return se(e, E(n), t.richText ?? {}).map((e) => P(e.path, e.rule, e.message));
|
|
688
|
+
case "array": {
|
|
689
|
+
if (!Array.isArray(n)) return [P(e, "type", "expected an array")];
|
|
690
|
+
let r = t.element;
|
|
691
|
+
if (r === void 0) return [];
|
|
692
|
+
let i = [];
|
|
693
|
+
return n.forEach((t, n) => i.push(...He(`${e}[${n}]`, r, t))), i;
|
|
694
|
+
}
|
|
695
|
+
case "struct": return F(n) ? Ue(e, t.struct ?? {}, n, "struct", !1) : [P(e, "type", "expected an object")];
|
|
696
|
+
case "components": {
|
|
697
|
+
if (!Array.isArray(n)) return [P(e, "type", "expected a list of components")];
|
|
698
|
+
let r = new Map((t.components ?? []).map((e) => [e.id, e])), i = [], a = /* @__PURE__ */ new Set();
|
|
699
|
+
return n.forEach((t, n) => {
|
|
700
|
+
let o = `${e}[${n}]`;
|
|
701
|
+
if (!F(t)) {
|
|
702
|
+
i.push(P(o, "type", "expected a component instance"));
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
let s = t.instanceId;
|
|
706
|
+
typeof s != "string" || s === "" ? i.push(P(`${o}.instanceId`, "required", "missing instance id")) : a.has(s) ? i.push(P(`${o}.instanceId`, "unique", `instance '${s}' appears twice`)) : a.add(s);
|
|
707
|
+
let c = r.get(String(t.componentId));
|
|
708
|
+
if (c === void 0) {
|
|
709
|
+
i.push(P(`${o}.componentId`, "unknown", `'${String(t.componentId)}' is not a component this field allows`));
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
let l = t.props;
|
|
713
|
+
if (!F(l)) {
|
|
714
|
+
i.push(P(`${o}.props`, "type", "expected an object"));
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
i.push(...Ue(`${o}.props`, c.props, l, `component '${c.id}'`, !0));
|
|
718
|
+
}), i;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}, Ue = (e, t, n, r, i) => {
|
|
722
|
+
let a = [];
|
|
723
|
+
for (let [r, o] of Object.entries(t)) {
|
|
724
|
+
let t = n[r];
|
|
725
|
+
if (t == null || i && t === "") {
|
|
726
|
+
o.isOptional || a.push(P(`${e}.${r}`, "required", "missing required field"));
|
|
727
|
+
continue;
|
|
728
|
+
}
|
|
729
|
+
a.push(...He(`${e}.${r}`, o, t));
|
|
730
|
+
}
|
|
731
|
+
for (let i of Object.keys(n)) i in t || a.push(P(`${e}.${i}`, "unknown", `not a declared field of this ${r}`));
|
|
732
|
+
return a;
|
|
733
|
+
}, We = (e, t) => {
|
|
734
|
+
let n = [];
|
|
735
|
+
for (let [r, i] of Object.entries(e.fields)) {
|
|
736
|
+
let e = t[r];
|
|
737
|
+
if (e == null) {
|
|
738
|
+
i.isOptional || n.push(P(r, "required", "missing required field"));
|
|
739
|
+
continue;
|
|
740
|
+
}
|
|
741
|
+
n.push(...He(r, i, e));
|
|
742
|
+
}
|
|
743
|
+
let r = t.id;
|
|
744
|
+
r !== void 0 && typeof r != "string" && n.push(P("id", "type", "expected a string id"));
|
|
745
|
+
for (let r of Object.keys(t)) r === "id" || r in e.fields || ze.has(r) || n.push(P(r, "unknown", `'${r}' is not a declared field of '${e.name}'`));
|
|
746
|
+
let i = e.taxonomy;
|
|
747
|
+
if (i !== void 0 && (i.unknown ?? "refuse") === "refuse" && Array.isArray(t[i.field])) {
|
|
748
|
+
let { unknown: e } = fe(i, t[i.field]);
|
|
749
|
+
e.length > 0 && n.push(P(i.field, "taxonomy", `not in the vocabulary: ${e.join(", ")}`));
|
|
750
|
+
}
|
|
751
|
+
return n;
|
|
752
|
+
}, Ge = (e, t) => Object.entries(e.fields).filter(([e, n]) => {
|
|
753
|
+
let r = t[e];
|
|
754
|
+
return n.publishRequired === !0 && (r == null || typeof r == "string" && r.trim() === "");
|
|
755
|
+
}).map(([e]) => P(e, "requiredToPublish", "needed before publishing")), Ke = (e, t) => {
|
|
756
|
+
let n = We(e, t);
|
|
757
|
+
if (n.length > 0) throw new Se({
|
|
758
|
+
contentType: e.name,
|
|
759
|
+
violations: n
|
|
760
|
+
});
|
|
761
|
+
}, qe = (e, t) => {
|
|
762
|
+
let n = { ...t }, r = e.taxonomy;
|
|
763
|
+
r !== void 0 && Array.isArray(n[r.field]) && (n[r.field] = pe(r, n[r.field]));
|
|
764
|
+
for (let t of e.derivedFields) {
|
|
765
|
+
let r = e.fields[t]?.derived;
|
|
766
|
+
r !== void 0 && (n[t] = r.transform(n[r.source], n));
|
|
767
|
+
}
|
|
768
|
+
for (let [t, r] of Object.entries(e.fields)) r.kind === "richText" && n[t] !== void 0 && n[t] !== null && (n[t] = E(n[t]));
|
|
769
|
+
for (let [t, r] of Object.entries(e.fields)) {
|
|
770
|
+
if (r.kind !== "components" || !Array.isArray(n[t])) continue;
|
|
771
|
+
let e = new Map((r.components ?? []).map((e) => [e.id, e]));
|
|
772
|
+
n[t] = n[t].map((t) => {
|
|
773
|
+
if (!F(t)) return t;
|
|
774
|
+
let n = e.get(String(t.componentId)), r = typeof t.instanceId == "string" && t.instanceId !== "" ? t.instanceId : Je();
|
|
775
|
+
return {
|
|
776
|
+
...t,
|
|
777
|
+
instanceId: r,
|
|
778
|
+
...n === void 0 ? {} : { fingerprint: n.fingerprint }
|
|
779
|
+
};
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
return n;
|
|
783
|
+
}, Je = () => `cins_${globalThis.crypto.randomUUID().replaceAll("-", "")}`, Ye = (e) => {
|
|
784
|
+
let { languages: t, countries: n, returning: r } = e.rule;
|
|
785
|
+
if ((t?.length ?? 0) === 0 && (n?.length ?? 0) === 0 && r === void 0) throw Error(`defineAudience('${e.id}'): the rule has no condition, so it would match every reader.`);
|
|
786
|
+
return e;
|
|
787
|
+
}, Xe = (e, t) => {
|
|
788
|
+
if (e.languages !== void 0 && e.languages.length > 0) {
|
|
789
|
+
let n = (t.languages ?? [])[0]?.toLowerCase();
|
|
790
|
+
if (n === void 0 || !e.languages.some((e) => n === e.toLowerCase() || n.startsWith(`${e.toLowerCase()}-`))) return !1;
|
|
791
|
+
}
|
|
792
|
+
if (e.countries !== void 0 && e.countries.length > 0) {
|
|
793
|
+
let n = t.country?.toUpperCase();
|
|
794
|
+
if (n === void 0 || !e.countries.some((e) => e.toUpperCase() === n)) return !1;
|
|
795
|
+
}
|
|
796
|
+
return e.returning === void 0 || (t.returning ?? !1) === e.returning;
|
|
797
|
+
}, Ze = (e, t, n) => {
|
|
798
|
+
let r = new Map(t.map((e) => [e.id, e]));
|
|
799
|
+
return e.find((e) => {
|
|
800
|
+
let t = r.get(e.audience);
|
|
801
|
+
return t !== void 0 && Xe(t.rule, n);
|
|
802
|
+
}) ?? null;
|
|
803
|
+
}, Qe = (e) => (e ?? "").split(",").map((e, t) => {
|
|
804
|
+
let [n, ...r] = e.trim().split(";"), i = Number(r.find((e) => e.trim().startsWith("q="))?.trim().slice(2) ?? "1");
|
|
805
|
+
return {
|
|
806
|
+
tag: (n ?? "").trim(),
|
|
807
|
+
q: Number.isFinite(i) ? i : 0,
|
|
808
|
+
i: t
|
|
809
|
+
};
|
|
810
|
+
}).filter((e) => e.tag !== "" && e.tag !== "*" && e.q > 0).sort((e, t) => t.q - e.q || e.i - t.i).map((e) => e.tag), $e = {
|
|
811
|
+
amp: "&",
|
|
812
|
+
lt: "<",
|
|
813
|
+
gt: ">",
|
|
814
|
+
quot: "\"",
|
|
815
|
+
apos: "'",
|
|
816
|
+
nbsp: "\xA0",
|
|
817
|
+
ndash: "–",
|
|
818
|
+
mdash: "—",
|
|
819
|
+
hellip: "…",
|
|
820
|
+
lsquo: "‘",
|
|
821
|
+
rsquo: "’",
|
|
822
|
+
ldquo: "“",
|
|
823
|
+
rdquo: "”",
|
|
824
|
+
copy: "©",
|
|
825
|
+
euro: "€"
|
|
826
|
+
}, et = (e) => e.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi, (e, t) => {
|
|
827
|
+
if (t[0] === "#") {
|
|
828
|
+
let n = t[1] === "x" || t[1] === "X" ? Number.parseInt(t.slice(2), 16) : Number.parseInt(t.slice(1), 10);
|
|
829
|
+
return Number.isFinite(n) && n > 0 && n <= 1114111 ? String.fromCodePoint(n) : e;
|
|
830
|
+
}
|
|
831
|
+
return $e[t.toLowerCase()] ?? e;
|
|
832
|
+
}), tt = /* @__PURE__ */ new Set([
|
|
833
|
+
"script",
|
|
834
|
+
"style",
|
|
835
|
+
"iframe",
|
|
836
|
+
"object",
|
|
837
|
+
"embed",
|
|
838
|
+
"noscript",
|
|
839
|
+
"template",
|
|
840
|
+
"svg",
|
|
841
|
+
"form",
|
|
842
|
+
"select",
|
|
843
|
+
"textarea",
|
|
844
|
+
"button"
|
|
845
|
+
]), nt = /* @__PURE__ */ new Set([
|
|
846
|
+
"span",
|
|
847
|
+
"div",
|
|
848
|
+
"section",
|
|
849
|
+
"article",
|
|
850
|
+
"main",
|
|
851
|
+
"header",
|
|
852
|
+
"footer",
|
|
853
|
+
"figure",
|
|
854
|
+
"blockquote",
|
|
855
|
+
"u",
|
|
856
|
+
"small",
|
|
857
|
+
"sup",
|
|
858
|
+
"sub",
|
|
859
|
+
"code",
|
|
860
|
+
"pre",
|
|
861
|
+
"thead",
|
|
862
|
+
"tbody",
|
|
863
|
+
"tfoot",
|
|
864
|
+
"font",
|
|
865
|
+
"center"
|
|
866
|
+
]), rt = (e) => {
|
|
867
|
+
let t = {};
|
|
868
|
+
for (let n of e.matchAll(/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)) t[n[1].toLowerCase()] = et(n[2] ?? n[3] ?? n[4] ?? "");
|
|
869
|
+
return t;
|
|
870
|
+
}, it = (e) => {
|
|
871
|
+
let t = [], n = e.replace(/<!--[\s\S]*?-->/g, ""), r = 0;
|
|
872
|
+
for (let e of n.matchAll(/<(\/?)([a-zA-Z][a-zA-Z0-9]*)([^>]*)>/g)) {
|
|
873
|
+
e.index > r && t.push({
|
|
874
|
+
kind: "text",
|
|
875
|
+
text: n.slice(r, e.index)
|
|
876
|
+
});
|
|
877
|
+
let i = e[3] ?? "";
|
|
878
|
+
t.push({
|
|
879
|
+
kind: "tag",
|
|
880
|
+
tag: {
|
|
881
|
+
name: e[2].toLowerCase(),
|
|
882
|
+
closing: e[1] === "/",
|
|
883
|
+
attrs: rt(i.replace(/\/\s*$/, "")),
|
|
884
|
+
selfClosing: /\/\s*$/.test(i)
|
|
885
|
+
}
|
|
886
|
+
}), r = e.index + e[0].length;
|
|
887
|
+
}
|
|
888
|
+
return r < n.length && t.push({
|
|
889
|
+
kind: "text",
|
|
890
|
+
text: n.slice(r)
|
|
891
|
+
}), t;
|
|
892
|
+
}, at = (e, t = {}) => {
|
|
893
|
+
let n = 0, r = t.newId ?? (() => `rb_import_${++n}`), i = [], a = [], o = (e, t) => {
|
|
894
|
+
a.some((n) => n.kind === e && n.detail === t) || a.push({
|
|
895
|
+
kind: e,
|
|
896
|
+
detail: t
|
|
897
|
+
});
|
|
898
|
+
}, s = [], c = null, l = [], u = null, d = null, f = null, p = null, m = !1, h = (e) => {
|
|
899
|
+
let t = et(e.replace(/[ \t\r\n\f]+/g, " "));
|
|
900
|
+
if (t === "" || t === " " && l.length === 0) return;
|
|
901
|
+
let n = l[l.length - 1];
|
|
902
|
+
if (c !== null && c.target !== null) {
|
|
903
|
+
n?.type === "link" && n.target === c.target ? l[l.length - 1] = {
|
|
904
|
+
...n,
|
|
905
|
+
text: n.text + t
|
|
906
|
+
} : l.push({
|
|
907
|
+
type: "link",
|
|
908
|
+
target: c.target,
|
|
909
|
+
text: t
|
|
910
|
+
});
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
n?.type === "text" && ((e) => (e ?? []).join() === s.join())(n.marks) ? l[l.length - 1] = {
|
|
914
|
+
...n,
|
|
915
|
+
text: n.text + t
|
|
916
|
+
} : l.push({
|
|
917
|
+
type: "text",
|
|
918
|
+
text: t,
|
|
919
|
+
...s.length > 0 ? { marks: [...s] } : {}
|
|
920
|
+
});
|
|
921
|
+
}, g = () => {
|
|
922
|
+
let e = [...l], t = e[0];
|
|
923
|
+
t !== void 0 && (e[0] = {
|
|
924
|
+
...t,
|
|
925
|
+
text: t.text.replace(/^[ \t\r\n\f]+/, "")
|
|
926
|
+
});
|
|
927
|
+
let n = e[e.length - 1];
|
|
928
|
+
return n !== void 0 && (e[e.length - 1] = {
|
|
929
|
+
...n,
|
|
930
|
+
text: n.text.replace(/[ \t\r\n\f]+$/, "")
|
|
931
|
+
}), e.filter((e) => e.text !== "");
|
|
932
|
+
}, _ = () => {
|
|
933
|
+
if (f === null || f.items.length === 0) return;
|
|
934
|
+
let { ordered: e, items: t, levels: n, sublists: a } = f, o = e ? "ordered" : "unordered", s = a.some((e) => e !== o) ? { sublists: a } : {};
|
|
935
|
+
i.push({
|
|
936
|
+
id: r(),
|
|
937
|
+
type: "list",
|
|
938
|
+
ordered: e,
|
|
939
|
+
items: t,
|
|
940
|
+
...n.some((e) => e > 0) ? {
|
|
941
|
+
levels: n,
|
|
942
|
+
...s
|
|
943
|
+
} : {}
|
|
944
|
+
});
|
|
945
|
+
}, v = (e = u) => {
|
|
946
|
+
let t = g();
|
|
947
|
+
if (l = [], t.length !== 0) {
|
|
948
|
+
if (e === "li" && f !== null) {
|
|
949
|
+
f.items.push(t), f.levels.push(Math.min(f.depth, 3));
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
if (e === "cell" && p?.row) {
|
|
953
|
+
p.row.push(t);
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
e === "h2" || e === "h3" ? i.push({
|
|
957
|
+
id: r(),
|
|
958
|
+
type: "heading",
|
|
959
|
+
level: e === "h2" ? 2 : 3,
|
|
960
|
+
content: t
|
|
961
|
+
}) : i.push({
|
|
962
|
+
id: r(),
|
|
963
|
+
type: "paragraph",
|
|
964
|
+
content: t
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
}, y = (e) => {
|
|
968
|
+
e.split(/\n\s*\n/).forEach((e, t) => {
|
|
969
|
+
t > 0 && v("p"), h(e);
|
|
970
|
+
});
|
|
971
|
+
};
|
|
972
|
+
for (let n of it(e)) {
|
|
973
|
+
if (d !== null) {
|
|
974
|
+
n.kind === "tag" && n.tag.closing && n.tag.name === d && (d = null);
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
if (n.kind === "text") {
|
|
978
|
+
u === null && f === null && p === null ? y(n.text) : h(n.text);
|
|
979
|
+
continue;
|
|
980
|
+
}
|
|
981
|
+
let { name: e, closing: a, attrs: g } = n.tag;
|
|
982
|
+
if (tt.has(e)) {
|
|
983
|
+
o("unsupportedTag", e), !a && !n.tag.selfClosing && (d = e);
|
|
984
|
+
continue;
|
|
985
|
+
}
|
|
986
|
+
switch (e) {
|
|
987
|
+
case "p":
|
|
988
|
+
a ? (v(), u = null) : (v("p"), u = "p");
|
|
989
|
+
break;
|
|
990
|
+
case "h1":
|
|
991
|
+
case "h2":
|
|
992
|
+
case "h3":
|
|
993
|
+
case "h4":
|
|
994
|
+
case "h5":
|
|
995
|
+
case "h6":
|
|
996
|
+
a ? (v(), u = null) : (v("p"), u = e === "h1" || e === "h2" ? "h2" : "h3");
|
|
997
|
+
break;
|
|
998
|
+
case "br":
|
|
999
|
+
h(" ");
|
|
1000
|
+
break;
|
|
1001
|
+
case "strong":
|
|
1002
|
+
case "b":
|
|
1003
|
+
case "em":
|
|
1004
|
+
case "i":
|
|
1005
|
+
case "u": {
|
|
1006
|
+
let t = e === "strong" || e === "b" ? "bold" : e === "u" ? "underline" : "italic";
|
|
1007
|
+
if (a) {
|
|
1008
|
+
let e = s.lastIndexOf(t);
|
|
1009
|
+
e >= 0 && s.splice(e, 1);
|
|
1010
|
+
} else s.push(t);
|
|
1011
|
+
break;
|
|
1012
|
+
}
|
|
1013
|
+
case "a":
|
|
1014
|
+
if (a) {
|
|
1015
|
+
c = null;
|
|
1016
|
+
break;
|
|
1017
|
+
}
|
|
1018
|
+
{
|
|
1019
|
+
let e = g.href ?? "", n = t.resolveLink?.(e) ?? null;
|
|
1020
|
+
n === null && e !== "" && o("externalLink", e), c = { target: n };
|
|
1021
|
+
}
|
|
1022
|
+
break;
|
|
1023
|
+
case "img": {
|
|
1024
|
+
let e = g.src ?? "", n = t.resolveImage?.(e) ?? null;
|
|
1025
|
+
if (n === null) {
|
|
1026
|
+
o("image", e), g.alt && h(g.alt);
|
|
1027
|
+
break;
|
|
1028
|
+
}
|
|
1029
|
+
let a = u;
|
|
1030
|
+
v(u === "li" || u === "cell" ? u : "p"), i.push({
|
|
1031
|
+
id: r(),
|
|
1032
|
+
type: "image",
|
|
1033
|
+
asset: n,
|
|
1034
|
+
...g.alt ? { caption: g.alt } : {}
|
|
1035
|
+
}), u = a;
|
|
1036
|
+
break;
|
|
1037
|
+
}
|
|
1038
|
+
case "ul":
|
|
1039
|
+
case "ol":
|
|
1040
|
+
if (a) {
|
|
1041
|
+
if (f !== null && f.depth > 0) {
|
|
1042
|
+
v("li"), f.depth--, u = "li";
|
|
1043
|
+
break;
|
|
1044
|
+
}
|
|
1045
|
+
v(), _(), f = null, u = null;
|
|
1046
|
+
} else if (f !== null) {
|
|
1047
|
+
v("li"), f.depth++, u = null;
|
|
1048
|
+
let t = Math.min(f.depth, 3) - 1;
|
|
1049
|
+
for (; f.sublists.length < t;) f.sublists.push(f.sublists[f.sublists.length - 1] ?? (f.ordered ? "ordered" : "unordered"));
|
|
1050
|
+
f.sublists.length === t && f.sublists.push(e === "ol" ? "ordered" : "unordered");
|
|
1051
|
+
} else v("p"), f = {
|
|
1052
|
+
ordered: e === "ol",
|
|
1053
|
+
items: [],
|
|
1054
|
+
levels: [],
|
|
1055
|
+
depth: 0,
|
|
1056
|
+
sublists: []
|
|
1057
|
+
}, u = null;
|
|
1058
|
+
break;
|
|
1059
|
+
case "li":
|
|
1060
|
+
a ? (v("li"), u = null) : (v(f === null ? "p" : "li"), u = "li");
|
|
1061
|
+
break;
|
|
1062
|
+
case "table":
|
|
1063
|
+
a ? (p !== null && p.rows.length > 0 && i.push({
|
|
1064
|
+
id: r(),
|
|
1065
|
+
type: "table",
|
|
1066
|
+
header: p.header,
|
|
1067
|
+
rows: p.rows
|
|
1068
|
+
}), p = null) : (v("p"), p = {
|
|
1069
|
+
header: !1,
|
|
1070
|
+
rows: [],
|
|
1071
|
+
row: null
|
|
1072
|
+
});
|
|
1073
|
+
break;
|
|
1074
|
+
case "tr":
|
|
1075
|
+
if (p === null) break;
|
|
1076
|
+
a ? (p.row && p.row.length > 0 && (p.rows.length === 0 && m && (p.header = !0), p.rows.push(p.row)), p.row = null, m = !1) : p.row = [];
|
|
1077
|
+
break;
|
|
1078
|
+
case "th":
|
|
1079
|
+
case "td":
|
|
1080
|
+
a ? (v("cell"), u = null) : (e === "th" && (m = !0), l = [], u = "cell");
|
|
1081
|
+
break;
|
|
1082
|
+
default: nt.has(e) || o("unsupportedTag", e);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
return v(u ?? "p"), _(), {
|
|
1086
|
+
document: {
|
|
1087
|
+
type: "doc",
|
|
1088
|
+
blocks: i
|
|
1089
|
+
},
|
|
1090
|
+
findings: a
|
|
1091
|
+
};
|
|
1092
|
+
}, ot = {
|
|
1093
|
+
bold: "bold",
|
|
1094
|
+
italic: "italic",
|
|
1095
|
+
underline: "underline"
|
|
1096
|
+
}, st = (e, t = {}) => {
|
|
1097
|
+
let n = 0, r = t.newId ?? (() => `rb_import_${++n}`), i = [], a = (e, t) => {
|
|
1098
|
+
i.some((n) => n.kind === e && n.detail === t) || i.push({
|
|
1099
|
+
kind: e,
|
|
1100
|
+
detail: t
|
|
1101
|
+
});
|
|
1102
|
+
}, o = (e) => {
|
|
1103
|
+
let n = [], r = (e) => {
|
|
1104
|
+
let t = n[n.length - 1];
|
|
1105
|
+
e.type === "text" && t?.type === "text" && (t.marks ?? []).join() === (e.marks ?? []).join() ? n[n.length - 1] = {
|
|
1106
|
+
...t,
|
|
1107
|
+
text: t.text + e.text
|
|
1108
|
+
} : e.text !== "" && n.push(e);
|
|
1109
|
+
};
|
|
1110
|
+
for (let n of e ?? []) switch (n.nodeType) {
|
|
1111
|
+
case "text": {
|
|
1112
|
+
let e = (n.marks ?? []).map((e) => ot[e.type]).filter((e) => e !== void 0);
|
|
1113
|
+
r({
|
|
1114
|
+
type: "text",
|
|
1115
|
+
text: n.value ?? "",
|
|
1116
|
+
...e.length > 0 ? { marks: e } : {}
|
|
1117
|
+
});
|
|
1118
|
+
break;
|
|
1119
|
+
}
|
|
1120
|
+
case "entry-hyperlink": {
|
|
1121
|
+
let e = n.data?.target?.sys?.id ?? "", i = t.resolveEntry?.(e) ?? null, s = o(n.content).map((e) => e.text).join("");
|
|
1122
|
+
i === null ? (a("externalLink", `entry:${e}`), r({
|
|
1123
|
+
type: "text",
|
|
1124
|
+
text: s
|
|
1125
|
+
})) : r({
|
|
1126
|
+
type: "link",
|
|
1127
|
+
target: i,
|
|
1128
|
+
text: s
|
|
1129
|
+
});
|
|
1130
|
+
break;
|
|
1131
|
+
}
|
|
1132
|
+
case "hyperlink":
|
|
1133
|
+
a("externalLink", n.data?.uri ?? "");
|
|
1134
|
+
for (let e of o(n.content)) r(e);
|
|
1135
|
+
break;
|
|
1136
|
+
default:
|
|
1137
|
+
a("unsupportedTag", n.nodeType);
|
|
1138
|
+
for (let e of o(n.content)) r(e);
|
|
1139
|
+
}
|
|
1140
|
+
let i = n[0];
|
|
1141
|
+
i !== void 0 && (n[0] = {
|
|
1142
|
+
...i,
|
|
1143
|
+
text: i.text.replace(/^[ \t\r\n\f]+/, "")
|
|
1144
|
+
});
|
|
1145
|
+
let s = n[n.length - 1];
|
|
1146
|
+
return s !== void 0 && (n[n.length - 1] = {
|
|
1147
|
+
...s,
|
|
1148
|
+
text: s.text.replace(/[ \t\r\n\f]+$/, "")
|
|
1149
|
+
}), n.filter((e) => e.text !== "");
|
|
1150
|
+
}, s = (e) => (e.content ?? []).flatMap((e, t) => {
|
|
1151
|
+
let n = e.nodeType === "paragraph" ? o(e.content) : o([e]);
|
|
1152
|
+
return t > 0 && n.length > 0 ? [{
|
|
1153
|
+
type: "text",
|
|
1154
|
+
text: " "
|
|
1155
|
+
}, ...n] : n;
|
|
1156
|
+
}), c = [];
|
|
1157
|
+
for (let n of e?.content ?? []) switch (n.nodeType) {
|
|
1158
|
+
case "paragraph": {
|
|
1159
|
+
let e = o(n.content);
|
|
1160
|
+
e.length > 0 && c.push({
|
|
1161
|
+
id: r(),
|
|
1162
|
+
type: "paragraph",
|
|
1163
|
+
content: e
|
|
1164
|
+
});
|
|
1165
|
+
break;
|
|
1166
|
+
}
|
|
1167
|
+
case "heading-1":
|
|
1168
|
+
case "heading-2":
|
|
1169
|
+
case "heading-3":
|
|
1170
|
+
case "heading-4":
|
|
1171
|
+
case "heading-5":
|
|
1172
|
+
case "heading-6": {
|
|
1173
|
+
let e = o(n.content);
|
|
1174
|
+
e.length > 0 && c.push({
|
|
1175
|
+
id: r(),
|
|
1176
|
+
type: "heading",
|
|
1177
|
+
level: n.nodeType === "heading-1" || n.nodeType === "heading-2" ? 2 : 3,
|
|
1178
|
+
content: e
|
|
1179
|
+
});
|
|
1180
|
+
break;
|
|
1181
|
+
}
|
|
1182
|
+
case "unordered-list":
|
|
1183
|
+
case "ordered-list": {
|
|
1184
|
+
let e = [], t = [], i = [], a = (e) => e.nodeType === "ordered-list" ? "ordered" : "unordered", o = (r, c) => {
|
|
1185
|
+
for (let l of r.content ?? []) {
|
|
1186
|
+
let r = (l.content ?? []).filter((e) => e.nodeType === "unordered-list" || e.nodeType === "ordered-list"), u = s({
|
|
1187
|
+
...l,
|
|
1188
|
+
content: (l.content ?? []).filter((e) => !r.includes(e))
|
|
1189
|
+
});
|
|
1190
|
+
u.length > 0 && (e.push(u), t.push(Math.min(c, 3, t.length === 0 ? 0 : t[t.length - 1] + 1)));
|
|
1191
|
+
for (let e of r) {
|
|
1192
|
+
let t = Math.min(c + 1, 3) - 1;
|
|
1193
|
+
for (; i.length < t;) i.push(i[i.length - 1] ?? a(n));
|
|
1194
|
+
i.length === t && i.push(a(e)), o(e, c + 1);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
|
+
o(n, 0);
|
|
1199
|
+
let l = a(n);
|
|
1200
|
+
e.length > 0 && c.push({
|
|
1201
|
+
id: r(),
|
|
1202
|
+
type: "list",
|
|
1203
|
+
ordered: l === "ordered",
|
|
1204
|
+
items: e,
|
|
1205
|
+
...t.some((e) => e > 0) ? {
|
|
1206
|
+
levels: t,
|
|
1207
|
+
...i.some((e) => e !== l) ? { sublists: i } : {}
|
|
1208
|
+
} : {}
|
|
1209
|
+
});
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
case "table": {
|
|
1213
|
+
let e = (n.content ?? []).map((e) => (e.content ?? []).map(s)), t = (n.content?.[0]?.content ?? []).some((e) => e.nodeType === "table-header-cell");
|
|
1214
|
+
e.length > 0 && c.push({
|
|
1215
|
+
id: r(),
|
|
1216
|
+
type: "table",
|
|
1217
|
+
header: t,
|
|
1218
|
+
rows: e
|
|
1219
|
+
});
|
|
1220
|
+
break;
|
|
1221
|
+
}
|
|
1222
|
+
case "embedded-asset-block": {
|
|
1223
|
+
let e = n.data?.target?.sys?.id ?? "", i = t.resolveAsset?.(e) ?? null;
|
|
1224
|
+
i === null ? a("image", `asset:${e}`) : c.push({
|
|
1225
|
+
id: r(),
|
|
1226
|
+
type: "image",
|
|
1227
|
+
asset: i
|
|
1228
|
+
});
|
|
1229
|
+
break;
|
|
1230
|
+
}
|
|
1231
|
+
case "hr": break;
|
|
1232
|
+
default: {
|
|
1233
|
+
a("unsupportedTag", n.nodeType);
|
|
1234
|
+
let e = o((n.content ?? []).flatMap((e) => e.nodeType === "paragraph" ? e.content ?? [] : [e]));
|
|
1235
|
+
e.length > 0 && c.push({
|
|
1236
|
+
id: r(),
|
|
1237
|
+
type: "paragraph",
|
|
1238
|
+
content: e
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
return {
|
|
1243
|
+
document: {
|
|
1244
|
+
type: "doc",
|
|
1245
|
+
blocks: c
|
|
1246
|
+
},
|
|
1247
|
+
findings: i
|
|
1248
|
+
};
|
|
1249
|
+
}, ct = (e, t) => e.nodes.find((e) => e.documentId === t && !e.fallback), lt = (e, t) => e.flatMap((e) => {
|
|
1250
|
+
let n = ct(e.tree, t);
|
|
1251
|
+
return n === void 0 ? [] : [{
|
|
1252
|
+
locale: e.locale,
|
|
1253
|
+
path: n.path
|
|
1254
|
+
}];
|
|
1255
|
+
}), ut = (e) => {
|
|
1256
|
+
let t = e instanceof Date ? e : typeof e == "string" || typeof e == "number" ? new Date(e) : null;
|
|
1257
|
+
return t === null || Number.isNaN(t.getTime()) ? null : t.toISOString();
|
|
1258
|
+
}, dt = (e, t = () => !0) => e.flatMap((n) => n.tree.nodes.filter((e) => !e.fallback && t(e)).map((r) => ({
|
|
1259
|
+
locale: n.locale,
|
|
1260
|
+
path: r.path,
|
|
1261
|
+
documentId: r.documentId,
|
|
1262
|
+
lastmod: ut(r.row.updatedAt),
|
|
1263
|
+
alternates: lt(e, r.documentId).filter((n) => {
|
|
1264
|
+
let i = e.find((e) => e.locale === n.locale)?.tree.nodes.find((e) => e.documentId === r.documentId);
|
|
1265
|
+
return i !== void 0 && t(i);
|
|
1266
|
+
})
|
|
1267
|
+
}))), I = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), ft = (e, t, n) => `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">\n${e.map((e) => {
|
|
1268
|
+
let r = e.alternates.length > 1 ? [...e.alternates.map((e) => ` <xhtml:link rel="alternate" hreflang="${I(e.locale)}" href="${I(t(e.locale, e.path))}" />`), ...e.alternates.filter((e) => e.locale === n).map((e) => ` <xhtml:link rel="alternate" hreflang="x-default" href="${I(t(e.locale, e.path))}" />`)] : [], i = e.lastmod === null ? [] : [` <lastmod>${e.lastmod}</lastmod>`];
|
|
1269
|
+
return [
|
|
1270
|
+
" <url>",
|
|
1271
|
+
` <loc>${I(t(e.locale, e.path))}</loc>`,
|
|
1272
|
+
...i,
|
|
1273
|
+
...r,
|
|
1274
|
+
" </url>"
|
|
1275
|
+
].join("\n");
|
|
1276
|
+
}).join("\n")}\n</urlset>\n`, pt = (e, t) => new Set(e.filter((e) => t[e.id] === e.version).map((e) => e.id)), mt = (e, t, n) => Array.isArray(e) ? e.map((e) => {
|
|
1277
|
+
if (typeof e != "object" || !e) return e;
|
|
1278
|
+
let r = e, i = t.get(String(r.componentId))?.consent;
|
|
1279
|
+
return i === void 0 || n.has(i) ? e : {
|
|
1280
|
+
instanceId: String(r.instanceId ?? ""),
|
|
1281
|
+
componentId: String(r.componentId),
|
|
1282
|
+
consentRequired: i,
|
|
1283
|
+
props: {}
|
|
1284
|
+
};
|
|
1285
|
+
}) : e, ht = (e, t, n) => {
|
|
1286
|
+
let r = { ...t };
|
|
1287
|
+
for (let [i, a] of Object.entries(e.fields)) a.kind === "components" && a.components !== void 0 && (r[i] = mt(t[i], new Map(a.components.map((e) => [e.id, e])), n));
|
|
1288
|
+
return r;
|
|
1289
|
+
}, gt = (e) => new Set(Object.values(e.fields).flatMap((e) => (e.components ?? []).flatMap((e) => e.consent === void 0 ? [] : [e.consent]))), _t = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], vt = (e) => {
|
|
1290
|
+
let t = new Map(e.ceiling.map((t) => [t, {
|
|
1291
|
+
tool: t,
|
|
1292
|
+
state: e.defaults.includes(t) ? "on" : "off",
|
|
1293
|
+
decidedAt: null
|
|
1294
|
+
}]));
|
|
1295
|
+
e.chain.forEach((e, n) => {
|
|
1296
|
+
let r = (e, r) => {
|
|
1297
|
+
let i = t.get(e);
|
|
1298
|
+
i !== void 0 && i.state !== "locked" && t.set(e, {
|
|
1299
|
+
tool: e,
|
|
1300
|
+
state: r,
|
|
1301
|
+
decidedAt: n
|
|
1302
|
+
});
|
|
1303
|
+
};
|
|
1304
|
+
for (let t of _t(e.locked)) r(t, "locked");
|
|
1305
|
+
for (let t of _t(e.off)) r(t, "off");
|
|
1306
|
+
for (let t of _t(e.on)) r(t, "on");
|
|
1307
|
+
});
|
|
1308
|
+
let n = e.ceiling.map((e) => t.get(e));
|
|
1309
|
+
return {
|
|
1310
|
+
tools: n.filter((e) => e.state === "on").map((e) => e.tool),
|
|
1311
|
+
explained: n
|
|
1312
|
+
};
|
|
1313
|
+
}, L = class extends Error {
|
|
1314
|
+
reason;
|
|
1315
|
+
_tag = "XliffInvalid";
|
|
1316
|
+
constructor(e) {
|
|
1317
|
+
super(`XLIFF not accepted: ${e}`), this.reason = e;
|
|
1318
|
+
}
|
|
1319
|
+
}, yt = (e) => e.kind === "string" && e.pattern === void 0 && e.derived === void 0 && e.literals === void 0, bt = (e, t) => {
|
|
1320
|
+
switch (t.type) {
|
|
1321
|
+
case "paragraph":
|
|
1322
|
+
case "heading": return [{
|
|
1323
|
+
id: `${e}/${t.id}`,
|
|
1324
|
+
source: k(t.content)
|
|
1325
|
+
}];
|
|
1326
|
+
case "list": return t.items.map((n, r) => ({
|
|
1327
|
+
id: `${e}/${t.id}/${r}`,
|
|
1328
|
+
source: k(n)
|
|
1329
|
+
}));
|
|
1330
|
+
case "table": return t.rows.flatMap((n, r) => n.map((n, i) => ({
|
|
1331
|
+
id: `${e}/${t.id}/${r}.${i}`,
|
|
1332
|
+
source: k(n)
|
|
1333
|
+
})));
|
|
1334
|
+
case "image": return t.caption === void 0 || t.caption === "" ? [] : [{
|
|
1335
|
+
id: `${e}/${t.id}/caption`,
|
|
1336
|
+
source: t.caption
|
|
1337
|
+
}];
|
|
1338
|
+
}
|
|
1339
|
+
}, xt = (e) => {
|
|
1340
|
+
let t = e?.blocks;
|
|
1341
|
+
return Array.isArray(t) ? t : [];
|
|
1342
|
+
}, St = (e) => Array.isArray(e) ? e : [], Ct = (e, t, n = "") => {
|
|
1343
|
+
let r = [];
|
|
1344
|
+
for (let [i, a] of Object.entries(e)) {
|
|
1345
|
+
let e = `${n}${i}`, o = t[i];
|
|
1346
|
+
if (yt(a)) typeof o == "string" && o.trim() !== "" && r.push({
|
|
1347
|
+
id: e,
|
|
1348
|
+
source: o
|
|
1349
|
+
});
|
|
1350
|
+
else if (a.kind === "richText") for (let t of xt(o)) r.push(...bt(e, t));
|
|
1351
|
+
else if (a.kind === "components") {
|
|
1352
|
+
let t = new Map((a.components ?? []).map((e) => [e.id, e]));
|
|
1353
|
+
for (let n of St(o)) {
|
|
1354
|
+
let i = n.componentId === void 0 ? void 0 : t.get(n.componentId);
|
|
1355
|
+
i !== void 0 && n.instanceId !== void 0 && r.push(...Ct(i.props, n.props ?? {}, `${e}/${n.instanceId}/`));
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
return r.filter((e) => e.source.trim() !== "");
|
|
1360
|
+
}, wt = (e) => {
|
|
1361
|
+
let t = 2166136261;
|
|
1362
|
+
for (let n of e) for (let e of `${n.id}\u0000${n.source}\u0001`) t ^= e.codePointAt(0) ?? 0, t = Math.imul(t, 16777619) >>> 0;
|
|
1363
|
+
return t.toString(16).padStart(8, "0");
|
|
1364
|
+
}, Tt = (e, t, n) => {
|
|
1365
|
+
let r = new Map(n.filter((e) => e.target !== void 0).map((e) => [e.id, e.target])), i = (e, t, n) => {
|
|
1366
|
+
let a = { ...t };
|
|
1367
|
+
for (let [o, s] of Object.entries(e)) {
|
|
1368
|
+
let e = `${n}${o}`, c = t[o];
|
|
1369
|
+
if (yt(s)) {
|
|
1370
|
+
let t = r.get(e);
|
|
1371
|
+
t !== void 0 && typeof c == "string" && (a[o] = t);
|
|
1372
|
+
} else if (s.kind === "richText" && typeof c == "object" && c) {
|
|
1373
|
+
let t = (e, t) => {
|
|
1374
|
+
let n = r.get(e);
|
|
1375
|
+
return n === void 0 ? t : O(n);
|
|
1376
|
+
};
|
|
1377
|
+
a[o] = {
|
|
1378
|
+
...c,
|
|
1379
|
+
blocks: xt(c).map((n) => {
|
|
1380
|
+
let i = `${e}/${n.id}`;
|
|
1381
|
+
switch (n.type) {
|
|
1382
|
+
case "paragraph":
|
|
1383
|
+
case "heading": return {
|
|
1384
|
+
...n,
|
|
1385
|
+
content: t(i, n.content)
|
|
1386
|
+
};
|
|
1387
|
+
case "list": return {
|
|
1388
|
+
...n,
|
|
1389
|
+
items: n.items.map((e, n) => t(`${i}/${n}`, e))
|
|
1390
|
+
};
|
|
1391
|
+
case "table": return {
|
|
1392
|
+
...n,
|
|
1393
|
+
rows: n.rows.map((e, n) => e.map((e, r) => t(`${i}/${n}.${r}`, e)))
|
|
1394
|
+
};
|
|
1395
|
+
case "image": {
|
|
1396
|
+
let e = r.get(`${i}/caption`);
|
|
1397
|
+
return e === void 0 ? n : {
|
|
1398
|
+
...n,
|
|
1399
|
+
caption: e
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
})
|
|
1404
|
+
};
|
|
1405
|
+
} else if (s.kind === "components" && Array.isArray(c)) {
|
|
1406
|
+
let t = new Map((s.components ?? []).map((e) => [e.id, e]));
|
|
1407
|
+
a[o] = St(c).map((n) => {
|
|
1408
|
+
let r = n.componentId === void 0 ? void 0 : t.get(n.componentId);
|
|
1409
|
+
return r === void 0 || n.instanceId === void 0 ? n : {
|
|
1410
|
+
...n,
|
|
1411
|
+
props: i(r.props, n.props ?? {}, `${e}/${n.instanceId}/`)
|
|
1412
|
+
};
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
return a;
|
|
1417
|
+
};
|
|
1418
|
+
return i(e, t, "");
|
|
1419
|
+
}, Et = (e, t) => {
|
|
1420
|
+
let n = new Set(e.map((e) => e.id)), r = new Map(t.map((e) => [e.id, e])), i = 0, a = 0;
|
|
1421
|
+
for (let e of t) n.has(e.id) && (e.target !== void 0 && e.target.trim() !== "" ? i++ : a++);
|
|
1422
|
+
return {
|
|
1423
|
+
translated: i,
|
|
1424
|
+
untranslated: a,
|
|
1425
|
+
unknown: t.filter((e) => !n.has(e.id)).map((e) => e.id),
|
|
1426
|
+
missing: e.filter((e) => !r.has(e.id)).map((e) => e.id)
|
|
1427
|
+
};
|
|
1428
|
+
}, R = (e) => e.replace(/[&<>"']/g, (e) => ({
|
|
1429
|
+
"&": "&",
|
|
1430
|
+
"<": "<",
|
|
1431
|
+
">": ">",
|
|
1432
|
+
"\"": """,
|
|
1433
|
+
"'": "'"
|
|
1434
|
+
})[e]), Dt = (e) => {
|
|
1435
|
+
let t = Object.entries(e.notes);
|
|
1436
|
+
return [
|
|
1437
|
+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
|
|
1438
|
+
`<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.1" srcLang="${R(e.srcLang)}" trgLang="${R(e.trgLang)}">`,
|
|
1439
|
+
` <file id="${R(e.fileId)}">`,
|
|
1440
|
+
...t.length === 0 ? [] : [
|
|
1441
|
+
" <notes>",
|
|
1442
|
+
...t.map(([e, t]) => ` <note category="${R(e)}">${R(t)}</note>`),
|
|
1443
|
+
" </notes>"
|
|
1444
|
+
],
|
|
1445
|
+
...e.units.flatMap((e) => [
|
|
1446
|
+
` <unit id="${R(e.id)}">`,
|
|
1447
|
+
` <segment${e.state === void 0 ? "" : ` state="${e.state}"`}>`,
|
|
1448
|
+
` <source>${R(e.source)}</source>`,
|
|
1449
|
+
...e.target === void 0 ? [] : [` <target>${R(e.target)}</target>`],
|
|
1450
|
+
" </segment>",
|
|
1451
|
+
" </unit>"
|
|
1452
|
+
]),
|
|
1453
|
+
" </file>",
|
|
1454
|
+
"</xliff>",
|
|
1455
|
+
""
|
|
1456
|
+
].join("\n");
|
|
1457
|
+
}, Ot = 5242880, kt = {
|
|
1458
|
+
lt: "<",
|
|
1459
|
+
gt: ">",
|
|
1460
|
+
amp: "&",
|
|
1461
|
+
quot: "\"",
|
|
1462
|
+
apos: "'"
|
|
1463
|
+
}, At = (e) => e.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);/g, (e, t) => {
|
|
1464
|
+
if (t.startsWith("#x")) return String.fromCodePoint(Number.parseInt(t.slice(2), 16));
|
|
1465
|
+
if (t.startsWith("#")) return String.fromCodePoint(Number.parseInt(t.slice(1), 10));
|
|
1466
|
+
let n = kt[t];
|
|
1467
|
+
if (n === void 0) throw new L(`unknown entity ${e}`);
|
|
1468
|
+
return n;
|
|
1469
|
+
}), z = (e) => e.slice(e.indexOf(":") + 1), jt = (e) => {
|
|
1470
|
+
if (e.length > Ot) throw new L("larger than 5 MB");
|
|
1471
|
+
if (/<!DOCTYPE|<!ENTITY/i.test(e)) throw new L("a DOCTYPE or entity declaration is not allowed");
|
|
1472
|
+
let t = {
|
|
1473
|
+
name: "#root",
|
|
1474
|
+
attrs: {},
|
|
1475
|
+
children: []
|
|
1476
|
+
}, n = [t], r = 0, i = () => n[n.length - 1];
|
|
1477
|
+
for (; r < e.length;) {
|
|
1478
|
+
let a = e.indexOf("<", r);
|
|
1479
|
+
if (a === -1) {
|
|
1480
|
+
i().children.push(At(e.slice(r)));
|
|
1481
|
+
break;
|
|
1482
|
+
}
|
|
1483
|
+
if (a > r && i().children.push(At(e.slice(r, a))), e.startsWith("<?", a)) {
|
|
1484
|
+
if (r = e.indexOf("?>", a) + 2, r < 2) throw new L("unterminated declaration");
|
|
1485
|
+
continue;
|
|
1486
|
+
}
|
|
1487
|
+
if (e.startsWith("<!--", a)) {
|
|
1488
|
+
if (r = e.indexOf("-->", a) + 3, r < 3) throw new L("unterminated comment");
|
|
1489
|
+
continue;
|
|
1490
|
+
}
|
|
1491
|
+
if (e.startsWith("<![CDATA[", a)) {
|
|
1492
|
+
let t = e.indexOf("]]>", a);
|
|
1493
|
+
if (t === -1) throw new L("unterminated CDATA");
|
|
1494
|
+
i().children.push(e.slice(a + 9, t)), r = t + 3;
|
|
1495
|
+
continue;
|
|
1496
|
+
}
|
|
1497
|
+
let o = e.indexOf(">", a);
|
|
1498
|
+
if (o === -1) throw new L("unterminated tag");
|
|
1499
|
+
let s = e.slice(a + 1, o);
|
|
1500
|
+
if (r = o + 1, s.startsWith("/")) {
|
|
1501
|
+
let e = z(s.slice(1).trim()), r = n.pop();
|
|
1502
|
+
if (r === void 0 || r === t || r.name !== e) throw new L(`unexpected </${e}>`);
|
|
1503
|
+
continue;
|
|
1504
|
+
}
|
|
1505
|
+
let c = s.endsWith("/"), l = c ? s.slice(0, -1) : s, u = /^\s*([A-Za-z_][\w.:-]*)/.exec(l);
|
|
1506
|
+
if (u === null) throw new L("malformed tag");
|
|
1507
|
+
let d = {};
|
|
1508
|
+
for (let e of l.slice(u[0].length).matchAll(/([A-Za-z_][\w.:-]*)\s*=\s*("([^"]*)"|'([^']*)')/g)) d[z(e[1])] = At(e[3] ?? e[4] ?? "");
|
|
1509
|
+
let f = {
|
|
1510
|
+
name: z(u[1]),
|
|
1511
|
+
attrs: d,
|
|
1512
|
+
children: []
|
|
1513
|
+
};
|
|
1514
|
+
i().children.push(f), c || n.push(f);
|
|
1515
|
+
}
|
|
1516
|
+
if (n.length !== 1) throw new L(`unclosed <${i().name}>`);
|
|
1517
|
+
let a = t.children.filter((e) => typeof e != "string");
|
|
1518
|
+
if (a.length !== 1) throw new L("not one root element");
|
|
1519
|
+
return a[0];
|
|
1520
|
+
}, B = (e, t) => e.children.filter((e) => typeof e != "string" && e.name === t), Mt = (e, t) => e.children.map((e) => {
|
|
1521
|
+
if (typeof e == "string") return e;
|
|
1522
|
+
throw new L(`inline <${e.name}> in ${t} is not supported`);
|
|
1523
|
+
}).join(""), Nt = /* @__PURE__ */ new Set([
|
|
1524
|
+
"initial",
|
|
1525
|
+
"translated",
|
|
1526
|
+
"reviewed",
|
|
1527
|
+
"final"
|
|
1528
|
+
]), Pt = (e) => {
|
|
1529
|
+
let t = jt(e);
|
|
1530
|
+
if (t.name !== "xliff") throw new L("the root element is not <xliff>");
|
|
1531
|
+
if (!/^2\./.test(t.attrs.version ?? "")) throw new L(`version ${t.attrs.version ?? "(none)"} is not XLIFF 2`);
|
|
1532
|
+
let n = t.attrs.srcLang, r = t.attrs.trgLang;
|
|
1533
|
+
if (!n || !r) throw new L("srcLang and trgLang are required");
|
|
1534
|
+
let i = B(t, "file");
|
|
1535
|
+
if (i.length !== 1) throw new L(`expected one <file>, found ${i.length}`);
|
|
1536
|
+
let a = i[0], o = {};
|
|
1537
|
+
for (let e of B(a, "notes")) for (let t of B(e, "note")) {
|
|
1538
|
+
let e = t.attrs.category;
|
|
1539
|
+
e !== void 0 && (o[e] = Mt(t, "a note"));
|
|
1540
|
+
}
|
|
1541
|
+
let s = B(a, "unit").map((e) => {
|
|
1542
|
+
let t = e.attrs.id;
|
|
1543
|
+
if (!t) throw new L("a <unit> without an id");
|
|
1544
|
+
let n = B(e, "segment"), r = [], i = [], a;
|
|
1545
|
+
for (let e of n) {
|
|
1546
|
+
let n = B(e, "source")[0];
|
|
1547
|
+
if (n === void 0) throw new L(`unit ${t}: a <segment> without <source>`);
|
|
1548
|
+
r.push(Mt(n, `unit ${t}`));
|
|
1549
|
+
let o = B(e, "target")[0];
|
|
1550
|
+
o !== void 0 && i.push(Mt(o, `unit ${t}`));
|
|
1551
|
+
let s = e.attrs.state;
|
|
1552
|
+
s !== void 0 && Nt.has(s) && (a = s);
|
|
1553
|
+
}
|
|
1554
|
+
return {
|
|
1555
|
+
id: t,
|
|
1556
|
+
source: r.join(""),
|
|
1557
|
+
...i.length === n.length && n.length > 0 ? { target: i.join("") } : {},
|
|
1558
|
+
...a === void 0 ? {} : { state: a }
|
|
1559
|
+
};
|
|
1560
|
+
});
|
|
1561
|
+
return {
|
|
1562
|
+
srcLang: n,
|
|
1563
|
+
trgLang: r,
|
|
1564
|
+
fileId: a.attrs.id ?? "",
|
|
1565
|
+
notes: o,
|
|
1566
|
+
units: s
|
|
1567
|
+
};
|
|
1568
|
+
}, V = {
|
|
1569
|
+
blockNames: {
|
|
1570
|
+
paragraph: "Paragraph",
|
|
1571
|
+
heading: "Heading",
|
|
1572
|
+
list: "List",
|
|
1573
|
+
table: "Table",
|
|
1574
|
+
image: "Image"
|
|
1575
|
+
},
|
|
1576
|
+
moveUp: "Move up",
|
|
1577
|
+
moveDown: "Move down",
|
|
1578
|
+
remove: "Remove",
|
|
1579
|
+
moveUpLabel: (e) => `Move ${e} up`,
|
|
1580
|
+
moveDownLabel: (e) => `Move ${e} down`,
|
|
1581
|
+
removeLabel: (e) => `Remove ${e}`,
|
|
1582
|
+
add: "Add",
|
|
1583
|
+
addBlock: "Add block",
|
|
1584
|
+
addComponent: "Add component",
|
|
1585
|
+
unknownComponent: (e) => `Unknown component '${e}'.`,
|
|
1586
|
+
level: "Level",
|
|
1587
|
+
numbered: "Numbered",
|
|
1588
|
+
numberedAt: (e) => `Numbered at level ${e}`,
|
|
1589
|
+
headerRow: "First row is the header",
|
|
1590
|
+
image: "Image",
|
|
1591
|
+
caption: "Caption",
|
|
1592
|
+
text: "Text",
|
|
1593
|
+
listItems: "Items, one per line (two spaces in front nest an item)",
|
|
1594
|
+
tableRows: "Rows, one per line, cells split by |",
|
|
1595
|
+
linkTo: "Link to",
|
|
1596
|
+
linkText: "Link text",
|
|
1597
|
+
insertLink: "Insert link",
|
|
1598
|
+
item: (e, t) => `${e} ${t}`,
|
|
1599
|
+
addItem: "Add entry",
|
|
1600
|
+
bold: "Bold",
|
|
1601
|
+
italic: "Italic",
|
|
1602
|
+
underline: "Underline"
|
|
1603
|
+
}, H = (e) => e === void 0 ? V : {
|
|
1604
|
+
...V,
|
|
1605
|
+
...e,
|
|
1606
|
+
blockNames: {
|
|
1607
|
+
...V.blockNames,
|
|
1608
|
+
...e.blockNames
|
|
1609
|
+
}
|
|
1610
|
+
}, U = (e) => e.type === "text" ? e.marks ?? [] : [], Ft = (e, t) => e.length === t.length && e.every((e) => t.includes(e)), W = (e, t) => ({
|
|
1611
|
+
type: "text",
|
|
1612
|
+
text: e,
|
|
1613
|
+
...t.length > 0 ? { marks: [...t].sort() } : {}
|
|
1614
|
+
}), G = (e) => {
|
|
1615
|
+
let t = [];
|
|
1616
|
+
for (let n of e) {
|
|
1617
|
+
if (n.text === "") continue;
|
|
1618
|
+
let e = t[t.length - 1];
|
|
1619
|
+
n.type === "text" && e?.type === "text" && Ft(U(e), U(n)) ? t[t.length - 1] = W(e.text + n.text, U(n)) : t.push(n.type === "text" ? W(n.text, U(n)) : n);
|
|
1620
|
+
}
|
|
1621
|
+
return t;
|
|
1622
|
+
}, It = (e) => e.map((e) => e.text).join(""), Lt = (e, t, n, r) => {
|
|
1623
|
+
if (n <= t) return !1;
|
|
1624
|
+
let i = 0;
|
|
1625
|
+
for (let a of e) {
|
|
1626
|
+
let e = i;
|
|
1627
|
+
if (i += a.text.length, !(i <= t || e >= n) && (a.type !== "text" || !U(a).includes(r))) return !1;
|
|
1628
|
+
}
|
|
1629
|
+
return !0;
|
|
1630
|
+
}, Rt = (e, t, n, r) => {
|
|
1631
|
+
if (n <= t) return e;
|
|
1632
|
+
let i = Lt(e, t, n, r), a = [], o = 0;
|
|
1633
|
+
for (let s of e) {
|
|
1634
|
+
let e = o;
|
|
1635
|
+
if (o += s.text.length, s.type !== "text" || o <= t || e >= n) {
|
|
1636
|
+
a.push(s);
|
|
1637
|
+
continue;
|
|
1638
|
+
}
|
|
1639
|
+
let c = Math.max(t, e) - e, l = Math.min(n, o) - e, u = U(s), d = i ? u.filter((e) => e !== r) : u.includes(r) ? u : [...u, r];
|
|
1640
|
+
a.push(W(s.text.slice(0, c), u), W(s.text.slice(c, l), d), W(s.text.slice(l), u));
|
|
1641
|
+
}
|
|
1642
|
+
return G(a);
|
|
1643
|
+
}, zt = (e, t, n) => {
|
|
1644
|
+
let r = [], i = 0;
|
|
1645
|
+
for (let a of e) {
|
|
1646
|
+
let e = i;
|
|
1647
|
+
i += a.text.length;
|
|
1648
|
+
let o = Math.max(t, e) - e, s = Math.min(n, i) - e;
|
|
1649
|
+
s <= o || (a.type === "link" ? r.push(o === 0 && s === a.text.length ? a : W(a.text.slice(o, s), [])) : r.push(W(a.text.slice(o, s), U(a))));
|
|
1650
|
+
}
|
|
1651
|
+
return r;
|
|
1652
|
+
}, Bt = (e, t, n, r) => {
|
|
1653
|
+
let i = zt(e, 0, t), [a] = n > t ? zt(e, t, t + 1) : [], o = a ?? i[i.length - 1], s = o === void 0 ? [] : U(o);
|
|
1654
|
+
return G([
|
|
1655
|
+
...i,
|
|
1656
|
+
W(r, s),
|
|
1657
|
+
...zt(e, n, 2 ** 53 - 1)
|
|
1658
|
+
]);
|
|
1659
|
+
}, Vt = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), Ht = (e) => e.map((e) => {
|
|
1660
|
+
if (e.type === "link") return `<a data-target="${Vt(e.target)}">${Vt(e.text)}</a>`;
|
|
1661
|
+
let t = Vt(e.text);
|
|
1662
|
+
return U(e).includes("underline") && (t = `<u>${t}</u>`), U(e).includes("italic") && (t = `<em>${t}</em>`), U(e).includes("bold") && (t = `<strong>${t}</strong>`), t;
|
|
1663
|
+
}).join(""), K = (e) => {
|
|
1664
|
+
let t = [], n = (e, r) => {
|
|
1665
|
+
if (e.nodeType === 3) {
|
|
1666
|
+
t.push(W(e.textContent ?? "", r));
|
|
1667
|
+
return;
|
|
1668
|
+
}
|
|
1669
|
+
if (e.nodeType !== 1) return;
|
|
1670
|
+
let i = e.nodeName.toLowerCase();
|
|
1671
|
+
if (i === "br") {
|
|
1672
|
+
t.push(W("\n", r));
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
if (i === "a" && e.getAttribute?.("data-target")) {
|
|
1676
|
+
t.push({
|
|
1677
|
+
type: "link",
|
|
1678
|
+
target: e.getAttribute("data-target"),
|
|
1679
|
+
text: e.textContent ?? ""
|
|
1680
|
+
});
|
|
1681
|
+
return;
|
|
1682
|
+
}
|
|
1683
|
+
let a = i === "strong" || i === "b" ? [.../* @__PURE__ */ new Set([...r, "bold"])] : i === "em" || i === "i" ? [.../* @__PURE__ */ new Set([...r, "italic"])] : i === "u" ? [.../* @__PURE__ */ new Set([...r, "underline"])] : r;
|
|
1684
|
+
for (let t of Array.from(e.childNodes)) n(t, a);
|
|
1685
|
+
};
|
|
1686
|
+
for (let t of Array.from(e.childNodes)) n(t, []);
|
|
1687
|
+
return G(t);
|
|
1688
|
+
}, Ut = (e, t, n) => {
|
|
1689
|
+
let r = 0, i = null, a = (e) => {
|
|
1690
|
+
if (i === null) {
|
|
1691
|
+
if (e === t && e.nodeType !== 3) {
|
|
1692
|
+
for (let t = 0; t < n && t < e.childNodes.length; t++) r += Wt(e.childNodes[t]);
|
|
1693
|
+
i = r;
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
if (e.nodeType === 3) {
|
|
1697
|
+
if (e === t) {
|
|
1698
|
+
i = r + n;
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
r += (e.textContent ?? "").length;
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1704
|
+
if (e.nodeName === "BR") {
|
|
1705
|
+
r += 1;
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1708
|
+
for (let t of Array.from(e.childNodes)) a(t);
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1711
|
+
return a(e), i ?? r;
|
|
1712
|
+
}, Wt = (e) => e.nodeType === 3 ? (e.textContent ?? "").length : e.nodeName === "BR" ? 1 : Array.from(e.childNodes).reduce((e, t) => e + Wt(t), 0), Gt = (e, t) => {
|
|
1713
|
+
let n = 0, r = null, i = (e) => {
|
|
1714
|
+
if (r === null) {
|
|
1715
|
+
if (e.nodeType === 3) {
|
|
1716
|
+
let i = (e.textContent ?? "").length;
|
|
1717
|
+
if (t <= n + i) {
|
|
1718
|
+
r = [e, t - n];
|
|
1719
|
+
return;
|
|
1720
|
+
}
|
|
1721
|
+
n += i;
|
|
1722
|
+
return;
|
|
1723
|
+
}
|
|
1724
|
+
if (e.nodeName === "BR") {
|
|
1725
|
+
if (t <= n) {
|
|
1726
|
+
r = [e.parentNode, Array.from(e.parentNode.childNodes).indexOf(e)];
|
|
1727
|
+
return;
|
|
1728
|
+
}
|
|
1729
|
+
n += 1;
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1732
|
+
for (let t of Array.from(e.childNodes)) i(t);
|
|
1733
|
+
}
|
|
1734
|
+
};
|
|
1735
|
+
return i(e), r ?? [e, e.childNodes.length];
|
|
1736
|
+
}, q = (e) => {
|
|
1737
|
+
let t = e.ownerDocument.getSelection();
|
|
1738
|
+
if (t === null || t.rangeCount === 0) return null;
|
|
1739
|
+
let n = t.getRangeAt(0);
|
|
1740
|
+
return !e.contains(n.startContainer) || !e.contains(n.endContainer) ? null : [Ut(e, n.startContainer, n.startOffset), Ut(e, n.endContainer, n.endOffset)];
|
|
1741
|
+
}, Kt = (e, t, n) => {
|
|
1742
|
+
let r = e.ownerDocument.getSelection();
|
|
1743
|
+
if (r === null) return;
|
|
1744
|
+
let i = e.ownerDocument.createRange(), [a, o] = Gt(e, t), [s, c] = Gt(e, n);
|
|
1745
|
+
i.setStart(a, o), i.setEnd(s, c), r.removeAllRanges(), r.addRange(i);
|
|
1746
|
+
}, qt = (e) => {
|
|
1747
|
+
let { id: r, labelledBy: i, content: o, onChange: s, words: c } = e, l = a(null), u = a("");
|
|
1748
|
+
n(() => {
|
|
1749
|
+
let e = l.current;
|
|
1750
|
+
if (e === null) return;
|
|
1751
|
+
let t = JSON.stringify(o);
|
|
1752
|
+
t !== u.current && (u.current = t, e.innerHTML = Ht(o));
|
|
1753
|
+
}, [o]);
|
|
1754
|
+
let d = (e, t) => {
|
|
1755
|
+
let n = l.current;
|
|
1756
|
+
n !== null && (u.current = JSON.stringify(e), n.innerHTML = Ht(e), t !== void 0 && Kt(n, t[0], t[1]), s(e));
|
|
1757
|
+
}, f = () => {
|
|
1758
|
+
let e = l.current;
|
|
1759
|
+
if (e === null) return;
|
|
1760
|
+
let t = K(e);
|
|
1761
|
+
u.current = JSON.stringify(t), s(t);
|
|
1762
|
+
}, p = (e) => {
|
|
1763
|
+
let t = l.current, n = t === null ? null : q(t);
|
|
1764
|
+
n !== null && n[0] !== n[1] && d(Rt(K(t), n[0], n[1], e), n);
|
|
1765
|
+
}, m = (e) => {
|
|
1766
|
+
let t = {
|
|
1767
|
+
b: "bold",
|
|
1768
|
+
i: "italic",
|
|
1769
|
+
u: "underline"
|
|
1770
|
+
}[e.key.toLowerCase()];
|
|
1771
|
+
if ((e.ctrlKey || e.metaKey) && t !== void 0) {
|
|
1772
|
+
e.preventDefault(), p(t);
|
|
1773
|
+
return;
|
|
1774
|
+
}
|
|
1775
|
+
if (e.key === "Enter") {
|
|
1776
|
+
if (e.preventDefault(), !e.shiftKey || l.current === null) return;
|
|
1777
|
+
let t = q(l.current);
|
|
1778
|
+
t !== null && d(Bt(K(l.current), t[0], t[1], "\n"), [t[0] + 1, t[0] + 1]);
|
|
1779
|
+
}
|
|
1780
|
+
}, h = (e) => {
|
|
1781
|
+
e.preventDefault();
|
|
1782
|
+
let t = l.current, n = e.clipboardData?.getData("text/plain") ?? "", r = t === null ? null : q(t);
|
|
1783
|
+
r !== null && n !== "" && d(Bt(K(t), r[0], r[1], n), [r[0] + n.length, r[0] + n.length]);
|
|
1784
|
+
}, g = (e) => {
|
|
1785
|
+
let t = l.current, n = t === null ? null : q(t);
|
|
1786
|
+
return n !== null && Lt(o, n[0], n[1], e);
|
|
1787
|
+
}, _ = (e) => e.preventDefault();
|
|
1788
|
+
return t("div", { "data-cms-rich-surface": !0 }, t("div", {
|
|
1789
|
+
role: "toolbar",
|
|
1790
|
+
"aria-controls": r,
|
|
1791
|
+
"data-cms-rich-marks": !0
|
|
1792
|
+
}, t("button", {
|
|
1793
|
+
type: "button",
|
|
1794
|
+
onMouseDown: _,
|
|
1795
|
+
onClick: () => p("bold"),
|
|
1796
|
+
"aria-pressed": g("bold"),
|
|
1797
|
+
"aria-label": c.bold
|
|
1798
|
+
}, t("strong", null, "B")), t("button", {
|
|
1799
|
+
type: "button",
|
|
1800
|
+
onMouseDown: _,
|
|
1801
|
+
onClick: () => p("italic"),
|
|
1802
|
+
"aria-pressed": g("italic"),
|
|
1803
|
+
"aria-label": c.italic
|
|
1804
|
+
}, t("em", null, "I")), t("button", {
|
|
1805
|
+
type: "button",
|
|
1806
|
+
onMouseDown: _,
|
|
1807
|
+
onClick: () => p("underline"),
|
|
1808
|
+
"aria-pressed": g("underline"),
|
|
1809
|
+
"aria-label": c.underline
|
|
1810
|
+
}, t("u", null, "U"))), t("div", {
|
|
1811
|
+
id: r,
|
|
1812
|
+
ref: l,
|
|
1813
|
+
role: "textbox",
|
|
1814
|
+
"aria-multiline": !0,
|
|
1815
|
+
"aria-labelledby": i,
|
|
1816
|
+
contentEditable: !0,
|
|
1817
|
+
suppressContentEditableWarning: !0,
|
|
1818
|
+
tabIndex: 0,
|
|
1819
|
+
onInput: f,
|
|
1820
|
+
onKeyDown: m,
|
|
1821
|
+
onPaste: h,
|
|
1822
|
+
"data-cms-rich-text": !0
|
|
1823
|
+
}));
|
|
1824
|
+
}, Jt = (e) => {
|
|
1825
|
+
let t = E(e ?? ""), n = t.blocks;
|
|
1826
|
+
return Array.isArray(n) ? t : {
|
|
1827
|
+
type: "doc",
|
|
1828
|
+
blocks: []
|
|
1829
|
+
};
|
|
1830
|
+
}, Yt = (e) => {
|
|
1831
|
+
let t = T();
|
|
1832
|
+
switch (e) {
|
|
1833
|
+
case "paragraph": return {
|
|
1834
|
+
id: t,
|
|
1835
|
+
type: e,
|
|
1836
|
+
content: []
|
|
1837
|
+
};
|
|
1838
|
+
case "heading": return {
|
|
1839
|
+
id: t,
|
|
1840
|
+
type: e,
|
|
1841
|
+
level: 2,
|
|
1842
|
+
content: []
|
|
1843
|
+
};
|
|
1844
|
+
case "list": return {
|
|
1845
|
+
id: t,
|
|
1846
|
+
type: e,
|
|
1847
|
+
ordered: !1,
|
|
1848
|
+
items: []
|
|
1849
|
+
};
|
|
1850
|
+
case "table": return {
|
|
1851
|
+
id: t,
|
|
1852
|
+
type: e,
|
|
1853
|
+
header: !0,
|
|
1854
|
+
rows: []
|
|
1855
|
+
};
|
|
1856
|
+
case "image": return {
|
|
1857
|
+
id: t,
|
|
1858
|
+
type: e,
|
|
1859
|
+
asset: ""
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
}, Xt = (e) => {
|
|
1863
|
+
switch (e.type) {
|
|
1864
|
+
case "paragraph":
|
|
1865
|
+
case "heading": return k(e.content);
|
|
1866
|
+
case "list": return e.items.map((t, n) => `${" ".repeat(e.levels?.[n] ?? 0)}${k(t)}`).join("\n");
|
|
1867
|
+
case "table": return e.rows.map((e) => e.map(k).join(" | ")).join("\n");
|
|
1868
|
+
case "image": return "";
|
|
1869
|
+
}
|
|
1870
|
+
}, Zt = (e) => {
|
|
1871
|
+
let t = [], n = [];
|
|
1872
|
+
for (let r of e.split("\n")) {
|
|
1873
|
+
if (r.trim() === "") continue;
|
|
1874
|
+
let e = /^[ \t]*/.exec(r)[0].replace(/\t/g, " ").length, i = Math.floor(e / 2), a = Math.min(i, 3, n.length === 0 ? 0 : n[n.length - 1] + 1);
|
|
1875
|
+
t.push(O(r.trim())), n.push(a);
|
|
1876
|
+
}
|
|
1877
|
+
return n.some((e) => e > 0) ? {
|
|
1878
|
+
items: t,
|
|
1879
|
+
levels: n
|
|
1880
|
+
} : { items: t };
|
|
1881
|
+
}, Qt = (e) => e.split("\n").map((e) => e.trim()).filter((e) => e !== ""), $t = (e, t) => {
|
|
1882
|
+
switch (e.type) {
|
|
1883
|
+
case "paragraph":
|
|
1884
|
+
case "heading": return {
|
|
1885
|
+
...e,
|
|
1886
|
+
content: O(t)
|
|
1887
|
+
};
|
|
1888
|
+
case "list": return {
|
|
1889
|
+
id: e.id,
|
|
1890
|
+
type: "list",
|
|
1891
|
+
ordered: e.ordered,
|
|
1892
|
+
...Zt(t),
|
|
1893
|
+
...e.sublists === void 0 ? {} : { sublists: e.sublists }
|
|
1894
|
+
};
|
|
1895
|
+
case "table": return {
|
|
1896
|
+
...e,
|
|
1897
|
+
rows: Qt(t).map((e) => e.split("|").map((e) => O(e.trim())))
|
|
1898
|
+
};
|
|
1899
|
+
case "image": return e;
|
|
1900
|
+
}
|
|
1901
|
+
}, en = ({ id: e, type: t, renderPicker: n, onInsert: r, words: i }) => {
|
|
1902
|
+
let [a, s] = o(""), [u, d] = o("");
|
|
1903
|
+
return /* @__PURE__ */ l("div", {
|
|
1904
|
+
"data-cms-rich-link": !0,
|
|
1905
|
+
children: [
|
|
1906
|
+
/* @__PURE__ */ c("label", {
|
|
1907
|
+
htmlFor: `${e}-link-target`,
|
|
1908
|
+
children: i.linkTo
|
|
1909
|
+
}),
|
|
1910
|
+
n({
|
|
1911
|
+
id: `${e}-link-target`,
|
|
1912
|
+
type: t,
|
|
1913
|
+
value: a,
|
|
1914
|
+
onChange: s
|
|
1915
|
+
}),
|
|
1916
|
+
/* @__PURE__ */ c("label", {
|
|
1917
|
+
htmlFor: `${e}-link-text`,
|
|
1918
|
+
children: i.linkText
|
|
1919
|
+
}),
|
|
1920
|
+
/* @__PURE__ */ c("input", {
|
|
1921
|
+
id: `${e}-link-text`,
|
|
1922
|
+
value: u,
|
|
1923
|
+
onChange: (e) => d(e.target.value)
|
|
1924
|
+
}),
|
|
1925
|
+
/* @__PURE__ */ c("button", {
|
|
1926
|
+
type: "button",
|
|
1927
|
+
disabled: a === "" || u.trim() === "",
|
|
1928
|
+
onClick: () => {
|
|
1929
|
+
r({
|
|
1930
|
+
type: "link",
|
|
1931
|
+
target: a,
|
|
1932
|
+
text: u.trim()
|
|
1933
|
+
}), s(""), d("");
|
|
1934
|
+
},
|
|
1935
|
+
children: i.insertLink
|
|
1936
|
+
})
|
|
1937
|
+
]
|
|
1938
|
+
});
|
|
1939
|
+
}, tn = (e) => {
|
|
1940
|
+
let { id: t, field: n, value: a, onChange: u, renderPicker: d, renderBlockAside: f } = e, p = H(e.strings), m = n.richText ?? {}, h = i(() => Jt(a), [a]), g = r(), [_, v] = o({}), [y, b] = o("paragraph"), ee = Object.keys(p.blockNames).filter((e) => e !== "image" || m.images !== void 0 && d !== void 0), x = (e) => u({
|
|
1941
|
+
type: "doc",
|
|
1942
|
+
blocks: e
|
|
1943
|
+
}), S = (e, t) => x(h.blocks.map((n, r) => r === e ? t : n)), te = (e, t) => {
|
|
1944
|
+
if (t < 0 || t >= h.blocks.length) return;
|
|
1945
|
+
let n = [...h.blocks], [r] = n.splice(e, 1);
|
|
1946
|
+
r !== void 0 && n.splice(t, 0, r), x(n);
|
|
1947
|
+
}, ne = (e, t, n) => {
|
|
1948
|
+
v((e) => ({
|
|
1949
|
+
...e,
|
|
1950
|
+
[t.id]: n
|
|
1951
|
+
})), S(e, $t(t, n));
|
|
1952
|
+
}, re = h.blocks.map((t, n) => {
|
|
1953
|
+
let r = `${p.blockNames[t.type]} ${n + 1}`, i = `${g}-${t.id}`, a = _[t.id] ?? Xt(t);
|
|
1954
|
+
return /* @__PURE__ */ l("fieldset", {
|
|
1955
|
+
"data-cms-rich-block": t.type,
|
|
1956
|
+
children: [
|
|
1957
|
+
/* @__PURE__ */ c("legend", { children: r }),
|
|
1958
|
+
t.type === "heading" ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("label", {
|
|
1959
|
+
htmlFor: `${i}-level`,
|
|
1960
|
+
children: p.level
|
|
1961
|
+
}), /* @__PURE__ */ l("select", {
|
|
1962
|
+
id: `${i}-level`,
|
|
1963
|
+
value: t.level,
|
|
1964
|
+
onChange: (e) => S(n, {
|
|
1965
|
+
...t,
|
|
1966
|
+
level: e.target.value === "3" ? 3 : 2
|
|
1967
|
+
}),
|
|
1968
|
+
children: [/* @__PURE__ */ c("option", {
|
|
1969
|
+
value: "2",
|
|
1970
|
+
children: "2"
|
|
1971
|
+
}), /* @__PURE__ */ c("option", {
|
|
1972
|
+
value: "3",
|
|
1973
|
+
children: "3"
|
|
1974
|
+
})]
|
|
1975
|
+
})] }) : null,
|
|
1976
|
+
t.type === "list" ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l("label", { children: [
|
|
1977
|
+
/* @__PURE__ */ c("input", {
|
|
1978
|
+
type: "checkbox",
|
|
1979
|
+
checked: t.ordered,
|
|
1980
|
+
onChange: (e) => S(n, {
|
|
1981
|
+
...t,
|
|
1982
|
+
ordered: e.target.checked
|
|
1983
|
+
})
|
|
1984
|
+
}),
|
|
1985
|
+
" ",
|
|
1986
|
+
p.numbered
|
|
1987
|
+
] }), Array.from({ length: Math.max(0, ...t.levels ?? []) }, (e, t) => t + 1).map((e) => /* @__PURE__ */ l("label", { children: [
|
|
1988
|
+
/* @__PURE__ */ c("input", {
|
|
1989
|
+
type: "checkbox",
|
|
1990
|
+
checked: C(t, e),
|
|
1991
|
+
onChange: (r) => S(n, {
|
|
1992
|
+
...t,
|
|
1993
|
+
sublists: Array.from({ length: Math.max(e, t.sublists?.length ?? 0) }, (n, i) => i === e - 1 ? r.target.checked ? "ordered" : "unordered" : C(t, i + 1) ? "ordered" : "unordered")
|
|
1994
|
+
})
|
|
1995
|
+
}),
|
|
1996
|
+
" ",
|
|
1997
|
+
p.numberedAt(e + 1)
|
|
1998
|
+
] }, e))] }) : null,
|
|
1999
|
+
t.type === "table" ? /* @__PURE__ */ l("label", { children: [
|
|
2000
|
+
/* @__PURE__ */ c("input", {
|
|
2001
|
+
type: "checkbox",
|
|
2002
|
+
checked: t.header,
|
|
2003
|
+
onChange: (e) => S(n, {
|
|
2004
|
+
...t,
|
|
2005
|
+
header: e.target.checked
|
|
2006
|
+
})
|
|
2007
|
+
}),
|
|
2008
|
+
" ",
|
|
2009
|
+
p.headerRow
|
|
2010
|
+
] }) : null,
|
|
2011
|
+
t.type === "image" ? /* @__PURE__ */ l(s, { children: [
|
|
2012
|
+
/* @__PURE__ */ c("label", {
|
|
2013
|
+
htmlFor: `${i}-asset`,
|
|
2014
|
+
children: p.image
|
|
2015
|
+
}),
|
|
2016
|
+
d?.({
|
|
2017
|
+
id: `${i}-asset`,
|
|
2018
|
+
type: m.images ?? "",
|
|
2019
|
+
value: t.asset,
|
|
2020
|
+
onChange: (e) => S(n, {
|
|
2021
|
+
...t,
|
|
2022
|
+
asset: e
|
|
2023
|
+
})
|
|
2024
|
+
}),
|
|
2025
|
+
/* @__PURE__ */ c("label", {
|
|
2026
|
+
htmlFor: `${i}-caption`,
|
|
2027
|
+
children: p.caption
|
|
2028
|
+
}),
|
|
2029
|
+
/* @__PURE__ */ c("input", {
|
|
2030
|
+
id: `${i}-caption`,
|
|
2031
|
+
value: t.caption ?? "",
|
|
2032
|
+
onChange: (e) => S(n, e.target.value === "" ? {
|
|
2033
|
+
id: t.id,
|
|
2034
|
+
type: "image",
|
|
2035
|
+
asset: t.asset
|
|
2036
|
+
} : {
|
|
2037
|
+
...t,
|
|
2038
|
+
caption: e.target.value
|
|
2039
|
+
})
|
|
2040
|
+
})
|
|
2041
|
+
] }) : e.surface === "visual" && (t.type === "paragraph" || t.type === "heading") ? /* @__PURE__ */ l(s, { children: [
|
|
2042
|
+
/* @__PURE__ */ c("span", {
|
|
2043
|
+
id: `${i}-label`,
|
|
2044
|
+
"data-cms-rich-label": !0,
|
|
2045
|
+
children: p.text
|
|
2046
|
+
}),
|
|
2047
|
+
/* @__PURE__ */ c(qt, {
|
|
2048
|
+
id: `${i}-text`,
|
|
2049
|
+
labelledBy: `${i}-label`,
|
|
2050
|
+
content: t.content,
|
|
2051
|
+
onChange: (e) => S(n, {
|
|
2052
|
+
...t,
|
|
2053
|
+
content: e
|
|
2054
|
+
}),
|
|
2055
|
+
words: {
|
|
2056
|
+
bold: p.bold,
|
|
2057
|
+
italic: p.italic,
|
|
2058
|
+
underline: p.underline
|
|
2059
|
+
}
|
|
2060
|
+
}),
|
|
2061
|
+
m.links !== void 0 && d !== void 0 && t.type === "paragraph" ? /* @__PURE__ */ c(en, {
|
|
2062
|
+
id: i,
|
|
2063
|
+
type: m.links,
|
|
2064
|
+
renderPicker: d,
|
|
2065
|
+
words: p,
|
|
2066
|
+
onInsert: (e) => S(n, {
|
|
2067
|
+
...t,
|
|
2068
|
+
content: G([
|
|
2069
|
+
...t.content,
|
|
2070
|
+
...It(t.content).match(/(^|\s)$/) ? [] : [{
|
|
2071
|
+
type: "text",
|
|
2072
|
+
text: " "
|
|
2073
|
+
}],
|
|
2074
|
+
e
|
|
2075
|
+
])
|
|
2076
|
+
})
|
|
2077
|
+
}) : null
|
|
2078
|
+
] }) : /* @__PURE__ */ l(s, { children: [
|
|
2079
|
+
/* @__PURE__ */ c("label", {
|
|
2080
|
+
htmlFor: `${i}-text`,
|
|
2081
|
+
children: t.type === "list" ? p.listItems : t.type === "table" ? p.tableRows : p.text
|
|
2082
|
+
}),
|
|
2083
|
+
/* @__PURE__ */ c("textarea", {
|
|
2084
|
+
id: `${i}-text`,
|
|
2085
|
+
value: a,
|
|
2086
|
+
onChange: (e) => ne(n, t, e.target.value)
|
|
2087
|
+
}),
|
|
2088
|
+
m.links !== void 0 && d !== void 0 && (t.type === "paragraph" || t.type === "list") ? /* @__PURE__ */ c(en, {
|
|
2089
|
+
id: i,
|
|
2090
|
+
type: m.links,
|
|
2091
|
+
renderPicker: d,
|
|
2092
|
+
words: p,
|
|
2093
|
+
onInsert: (e) => ne(n, t, `${a}${a === "" || a.endsWith(" ") || a.endsWith("\n") ? "" : " "}${k([e])}`)
|
|
2094
|
+
}) : null
|
|
2095
|
+
] }),
|
|
2096
|
+
/* @__PURE__ */ l("div", {
|
|
2097
|
+
"data-cms-rich-actions": !0,
|
|
2098
|
+
children: [
|
|
2099
|
+
/* @__PURE__ */ c("button", {
|
|
2100
|
+
type: "button",
|
|
2101
|
+
"aria-label": p.moveUpLabel(r),
|
|
2102
|
+
disabled: n === 0,
|
|
2103
|
+
onClick: () => te(n, n - 1),
|
|
2104
|
+
children: p.moveUp
|
|
2105
|
+
}),
|
|
2106
|
+
/* @__PURE__ */ c("button", {
|
|
2107
|
+
type: "button",
|
|
2108
|
+
"aria-label": p.moveDownLabel(r),
|
|
2109
|
+
disabled: n === h.blocks.length - 1,
|
|
2110
|
+
onClick: () => te(n, n + 1),
|
|
2111
|
+
children: p.moveDown
|
|
2112
|
+
}),
|
|
2113
|
+
/* @__PURE__ */ c("button", {
|
|
2114
|
+
type: "button",
|
|
2115
|
+
"aria-label": p.removeLabel(r),
|
|
2116
|
+
onClick: () => x(h.blocks.filter((e, t) => t !== n)),
|
|
2117
|
+
children: p.remove
|
|
2118
|
+
})
|
|
2119
|
+
]
|
|
2120
|
+
}),
|
|
2121
|
+
f?.(t.id, r) ?? null
|
|
2122
|
+
]
|
|
2123
|
+
}, t.id);
|
|
2124
|
+
});
|
|
2125
|
+
return /* @__PURE__ */ l("div", {
|
|
2126
|
+
id: t,
|
|
2127
|
+
"data-cms-rich-document": !0,
|
|
2128
|
+
children: [re, /* @__PURE__ */ l("div", {
|
|
2129
|
+
"data-cms-rich-add": !0,
|
|
2130
|
+
children: [
|
|
2131
|
+
/* @__PURE__ */ c("label", {
|
|
2132
|
+
htmlFor: `${t}-add`,
|
|
2133
|
+
children: p.addBlock
|
|
2134
|
+
}),
|
|
2135
|
+
/* @__PURE__ */ c("select", {
|
|
2136
|
+
id: `${t}-add`,
|
|
2137
|
+
value: y,
|
|
2138
|
+
onChange: (e) => b(e.target.value),
|
|
2139
|
+
children: ee.map((e) => /* @__PURE__ */ c("option", {
|
|
2140
|
+
value: e,
|
|
2141
|
+
children: p.blockNames[e]
|
|
2142
|
+
}, e))
|
|
2143
|
+
}),
|
|
2144
|
+
/* @__PURE__ */ c("button", {
|
|
2145
|
+
type: "button",
|
|
2146
|
+
onClick: () => x([...h.blocks, Yt(y)]),
|
|
2147
|
+
children: p.add
|
|
2148
|
+
})
|
|
2149
|
+
]
|
|
2150
|
+
})]
|
|
2151
|
+
});
|
|
2152
|
+
}, nn = ({ id: e, name: n, field: r, value: i, onChange: a }) => t("input", {
|
|
2153
|
+
type: "text",
|
|
2154
|
+
id: e,
|
|
2155
|
+
name: n,
|
|
2156
|
+
...r.maxLength === void 0 ? {} : { maxLength: r.maxLength },
|
|
2157
|
+
value: i == null ? "" : String(i),
|
|
2158
|
+
onChange: (e) => a(e.target.value)
|
|
2159
|
+
}), rn = ({ id: e, name: n, field: r, value: i, onChange: a }) => t("textarea", {
|
|
2160
|
+
id: e,
|
|
2161
|
+
name: n,
|
|
2162
|
+
...r.maxLength === void 0 ? {} : { maxLength: r.maxLength },
|
|
2163
|
+
value: i == null ? "" : String(i),
|
|
2164
|
+
onChange: (e) => a(e.target.value)
|
|
2165
|
+
}), an = ({ id: e, name: n, field: r, value: i, onChange: a }) => t("input", {
|
|
2166
|
+
type: "number",
|
|
2167
|
+
...r.fraction === !0 ? { step: "any" } : {},
|
|
2168
|
+
id: e,
|
|
2169
|
+
name: n,
|
|
2170
|
+
value: i == null ? "" : String(i),
|
|
2171
|
+
onChange: (e) => a(e.target.value === "" ? null : Number(e.target.value))
|
|
2172
|
+
}), on = ({ id: e, name: n, value: r, onChange: i }) => t("input", {
|
|
2173
|
+
type: "checkbox",
|
|
2174
|
+
id: e,
|
|
2175
|
+
name: n,
|
|
2176
|
+
checked: r === !0,
|
|
2177
|
+
onChange: (e) => i(e.target.checked)
|
|
2178
|
+
}), sn = (e) => ({ id: n, name: r, value: i, onChange: a }) => t("input", {
|
|
2179
|
+
type: e,
|
|
2180
|
+
id: n,
|
|
2181
|
+
name: r,
|
|
2182
|
+
value: i == null ? "" : String(i),
|
|
2183
|
+
onChange: (e) => a(e.target.value)
|
|
2184
|
+
}), cn = ({ id: e, name: n, field: r, value: i, onChange: a }) => t("select", {
|
|
2185
|
+
id: e,
|
|
2186
|
+
name: n,
|
|
2187
|
+
value: i == null ? "" : String(i),
|
|
2188
|
+
onChange: (e) => a(e.target.value)
|
|
2189
|
+
}, [t("option", {
|
|
2190
|
+
key: "",
|
|
2191
|
+
value: ""
|
|
2192
|
+
}, ""), ...(r.literals ?? []).map((e) => t("option", {
|
|
2193
|
+
key: e,
|
|
2194
|
+
value: e
|
|
2195
|
+
}, e))]), J = (e) => ({ id: n, name: r, value: i, onChange: a }) => t("textarea", {
|
|
2196
|
+
id: n,
|
|
2197
|
+
name: r,
|
|
2198
|
+
"data-cms-widget": e,
|
|
2199
|
+
value: i == null ? "" : typeof i == "string" ? i : JSON.stringify(i),
|
|
2200
|
+
onChange: (e) => a(e.target.value)
|
|
2201
|
+
}), ln = (e) => {
|
|
2202
|
+
let { id: n, label: r, element: i, value: o, onChange: s, widgets: c, strings: l } = e, u = H(l), d = Array.isArray(o) ? o : [], f = a(d);
|
|
2203
|
+
f.current = d;
|
|
2204
|
+
let p = pn(i.editorHint, c), m = (e, t) => {
|
|
2205
|
+
if (t < 0 || t >= d.length) return;
|
|
2206
|
+
let n = [...d], [r] = n.splice(e, 1);
|
|
2207
|
+
n.splice(t, 0, r), s(n);
|
|
2208
|
+
}, h = i.kind === "number" ? 0 : i.kind !== "boolean" && "", g = d.map((e, a) => {
|
|
2209
|
+
let o = u.item(r, a + 1), c = `${n}-${a}`;
|
|
2210
|
+
return t("fieldset", {
|
|
2211
|
+
key: a,
|
|
2212
|
+
"data-cms-array-entry": a
|
|
2213
|
+
}, t("legend", null, t("label", { htmlFor: c }, o)), t(p, {
|
|
2214
|
+
id: c,
|
|
2215
|
+
name: `${n}[${a}]`,
|
|
2216
|
+
field: i,
|
|
2217
|
+
value: e,
|
|
2218
|
+
onChange: (e) => s(f.current.map((t, n) => n === a ? e : t))
|
|
2219
|
+
}), t("div", { "data-cms-array-actions": !0 }, t("button", {
|
|
2220
|
+
type: "button",
|
|
2221
|
+
"aria-label": u.moveUpLabel(o),
|
|
2222
|
+
disabled: a === 0,
|
|
2223
|
+
onClick: () => m(a, a - 1)
|
|
2224
|
+
}, u.moveUp), t("button", {
|
|
2225
|
+
type: "button",
|
|
2226
|
+
"aria-label": u.moveDownLabel(o),
|
|
2227
|
+
disabled: a === d.length - 1,
|
|
2228
|
+
onClick: () => m(a, a + 1)
|
|
2229
|
+
}, u.moveDown), t("button", {
|
|
2230
|
+
type: "button",
|
|
2231
|
+
"aria-label": u.removeLabel(o),
|
|
2232
|
+
onClick: () => s(d.filter((e, t) => t !== a))
|
|
2233
|
+
}, u.remove)));
|
|
2234
|
+
});
|
|
2235
|
+
return t("div", {
|
|
2236
|
+
id: n,
|
|
2237
|
+
"data-cms-array": !0
|
|
2238
|
+
}, ...g, t("button", {
|
|
2239
|
+
type: "button",
|
|
2240
|
+
"data-cms-array-add": !0,
|
|
2241
|
+
onClick: () => s([...f.current, h])
|
|
2242
|
+
}, u.addItem));
|
|
2243
|
+
}, un = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "object" && !!e && typeof e.componentId == "string") : [], dn = (e) => {
|
|
2244
|
+
let { id: n, definitions: r, value: i, onChange: s, widgets: c, renderPicker: l, fieldLabel: u, strings: d } = e, f = H(d), p = un(i), m = a(p);
|
|
2245
|
+
m.current = p;
|
|
2246
|
+
let [h, g] = o(r[0]?.id ?? ""), _ = new Map(r.map((e) => [e.id, e])), v = (e) => s(e), y = (e, t) => v(m.current.map((n, r) => r === e ? {
|
|
2247
|
+
...n,
|
|
2248
|
+
props: t
|
|
2249
|
+
} : n)), b = (e, t) => {
|
|
2250
|
+
if (t < 0 || t >= p.length) return;
|
|
2251
|
+
let n = [...p], [r] = n.splice(e, 1);
|
|
2252
|
+
r !== void 0 && n.splice(t, 0, r), v(n);
|
|
2253
|
+
}, ee = p.map((e, n) => {
|
|
2254
|
+
let r = _.get(e.componentId), i = `${r?.displayName ?? e.componentId} ${n + 1}`;
|
|
2255
|
+
return t("fieldset", {
|
|
2256
|
+
key: e.instanceId ?? `new-${n}`,
|
|
2257
|
+
"data-cms-component": e.componentId
|
|
2258
|
+
}, t("legend", null, i), r === void 0 ? t("p", null, f.unknownComponent(e.componentId)) : t(mn, {
|
|
2259
|
+
contentType: { fields: r.props },
|
|
2260
|
+
value: e.props,
|
|
2261
|
+
onChange: (e) => y(n, e),
|
|
2262
|
+
...c ? { widgets: c } : {},
|
|
2263
|
+
...l ? { renderPicker: l } : {},
|
|
2264
|
+
...u ? { fieldLabel: (e) => u(`${r.id}.${e}`) } : {},
|
|
2265
|
+
...d ? { strings: d } : {}
|
|
2266
|
+
}), t("div", { "data-cms-component-actions": !0 }, t("button", {
|
|
2267
|
+
type: "button",
|
|
2268
|
+
"aria-label": f.moveUpLabel(i),
|
|
2269
|
+
disabled: n === 0,
|
|
2270
|
+
onClick: () => b(n, n - 1)
|
|
2271
|
+
}, f.moveUp), t("button", {
|
|
2272
|
+
type: "button",
|
|
2273
|
+
"aria-label": f.moveDownLabel(i),
|
|
2274
|
+
disabled: n === p.length - 1,
|
|
2275
|
+
onClick: () => b(n, n + 1)
|
|
2276
|
+
}, f.moveDown), t("button", {
|
|
2277
|
+
type: "button",
|
|
2278
|
+
"aria-label": f.removeLabel(i),
|
|
2279
|
+
onClick: () => v(p.filter((e, t) => t !== n))
|
|
2280
|
+
}, f.remove)));
|
|
2281
|
+
}), x = `${n}-add`;
|
|
2282
|
+
return t("div", {
|
|
2283
|
+
id: n,
|
|
2284
|
+
"data-cms-components": !0
|
|
2285
|
+
}, ...ee, t("div", { "data-cms-component-add": !0 }, t("label", { htmlFor: x }, f.addComponent), t("select", {
|
|
2286
|
+
id: x,
|
|
2287
|
+
value: h,
|
|
2288
|
+
onChange: (e) => g(e.target.value)
|
|
2289
|
+
}, r.map((e) => t("option", {
|
|
2290
|
+
key: e.id,
|
|
2291
|
+
value: e.id
|
|
2292
|
+
}, e.displayName))), t("button", {
|
|
2293
|
+
type: "button",
|
|
2294
|
+
disabled: !_.has(h),
|
|
2295
|
+
onClick: () => v([...p, {
|
|
2296
|
+
componentId: h,
|
|
2297
|
+
props: {}
|
|
2298
|
+
}])
|
|
2299
|
+
}, f.add)));
|
|
2300
|
+
}, fn = {
|
|
2301
|
+
text: nn,
|
|
2302
|
+
textarea: rn,
|
|
2303
|
+
number: an,
|
|
2304
|
+
boolean: on,
|
|
2305
|
+
date: sn("date"),
|
|
2306
|
+
datetime: sn("datetime-local"),
|
|
2307
|
+
select: cn,
|
|
2308
|
+
richText: tn,
|
|
2309
|
+
media: J("media"),
|
|
2310
|
+
reference: J("reference"),
|
|
2311
|
+
array: J("array"),
|
|
2312
|
+
struct: J("struct"),
|
|
2313
|
+
components: J("components")
|
|
2314
|
+
}, pn = (e, t) => t?.[e] ?? fn[e], mn = (e) => {
|
|
2315
|
+
let { contentType: n, value: i, onChange: o, widgets: s, fieldWidgets: c, renderPicker: l, renderFieldAside: u, renderBlockAside: d, fieldLabel: f, strings: p, richTextSurface: m } = e, h = r(), g = a(i);
|
|
2316
|
+
g.current = i;
|
|
2317
|
+
let _ = (e, t) => o({
|
|
2318
|
+
...g.current,
|
|
2319
|
+
[e]: t
|
|
2320
|
+
}), v = Object.entries(n.fields).map(([e, n]) => {
|
|
2321
|
+
let r = `${h}-${e}`, a = u?.(e) ?? null, o = f?.(e) ?? e, g = c?.[e];
|
|
2322
|
+
return g === void 0 && n.editorHint === "array" && s?.array === void 0 && n.element !== void 0 && n.element.kind !== "struct" && n.element.kind !== "array" ? t("div", {
|
|
2323
|
+
key: e,
|
|
2324
|
+
"data-cms-field": e,
|
|
2325
|
+
role: "group",
|
|
2326
|
+
"aria-labelledby": `${r}-label`
|
|
2327
|
+
}, t("span", {
|
|
2328
|
+
id: `${r}-label`,
|
|
2329
|
+
"data-cms-field-label": !0
|
|
2330
|
+
}, o), t(ln, {
|
|
2331
|
+
id: r,
|
|
2332
|
+
label: o,
|
|
2333
|
+
element: n.element,
|
|
2334
|
+
value: i[e],
|
|
2335
|
+
onChange: (t) => _(e, t),
|
|
2336
|
+
widgets: s,
|
|
2337
|
+
strings: p
|
|
2338
|
+
}), a) : g === void 0 && n.editorHint === "components" && s?.components === void 0 ? t("div", {
|
|
2339
|
+
key: e,
|
|
2340
|
+
"data-cms-field": e,
|
|
2341
|
+
role: "group",
|
|
2342
|
+
"aria-labelledby": `${r}-label`
|
|
2343
|
+
}, t("span", {
|
|
2344
|
+
id: `${r}-label`,
|
|
2345
|
+
"data-cms-field-label": !0
|
|
2346
|
+
}, o), t(dn, {
|
|
2347
|
+
id: r,
|
|
2348
|
+
definitions: n.components ?? [],
|
|
2349
|
+
value: i[e],
|
|
2350
|
+
onChange: (t) => _(e, t),
|
|
2351
|
+
widgets: s,
|
|
2352
|
+
renderPicker: l,
|
|
2353
|
+
fieldLabel: f,
|
|
2354
|
+
strings: p
|
|
2355
|
+
}), a) : g === void 0 && n.editorHint === "richText" && s?.richText === void 0 ? t("div", {
|
|
2356
|
+
key: e,
|
|
2357
|
+
"data-cms-field": e,
|
|
2358
|
+
role: "group",
|
|
2359
|
+
"aria-labelledby": `${r}-label`
|
|
2360
|
+
}, t("span", {
|
|
2361
|
+
id: `${r}-label`,
|
|
2362
|
+
"data-cms-field-label": !0
|
|
2363
|
+
}, o), t(tn, {
|
|
2364
|
+
id: r,
|
|
2365
|
+
name: e,
|
|
2366
|
+
field: n,
|
|
2367
|
+
value: i[e],
|
|
2368
|
+
onChange: (t) => _(e, t),
|
|
2369
|
+
...l ? { renderPicker: l } : {},
|
|
2370
|
+
...d ? { renderBlockAside: (t, n) => d(e, t, n) } : {},
|
|
2371
|
+
...p ? { strings: p } : {},
|
|
2372
|
+
...m ? { surface: m } : {}
|
|
2373
|
+
}), a) : t("div", {
|
|
2374
|
+
key: e,
|
|
2375
|
+
"data-cms-field": e,
|
|
2376
|
+
...n.publishRequired === !0 ? { "data-cms-required-to-publish": !0 } : {}
|
|
2377
|
+
}, t("label", { htmlFor: r }, o), t(g ?? pn(n.editorHint, s), {
|
|
2378
|
+
id: r,
|
|
2379
|
+
name: e,
|
|
2380
|
+
field: n,
|
|
2381
|
+
value: i[e],
|
|
2382
|
+
onChange: (t) => _(e, t)
|
|
2383
|
+
}), a);
|
|
2384
|
+
});
|
|
2385
|
+
return t("div", { "data-cms-form": !0 }, ...v);
|
|
2386
|
+
}, hn = 100, gn = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/, _n = /^\d{4}-\d{2}-\d{2}$/, Y = 6e4, vn = /* @__PURE__ */ new Map(), yn = (e) => {
|
|
2387
|
+
let t = vn.get(e);
|
|
2388
|
+
return t === void 0 && (t = new Intl.DateTimeFormat("en-US", {
|
|
2389
|
+
timeZone: e,
|
|
2390
|
+
hourCycle: "h23",
|
|
2391
|
+
year: "numeric",
|
|
2392
|
+
month: "2-digit",
|
|
2393
|
+
day: "2-digit",
|
|
2394
|
+
hour: "2-digit",
|
|
2395
|
+
minute: "2-digit",
|
|
2396
|
+
second: "2-digit"
|
|
2397
|
+
}), vn.set(e, t)), t;
|
|
2398
|
+
}, bn = (e) => {
|
|
2399
|
+
try {
|
|
2400
|
+
return yn(e), !0;
|
|
2401
|
+
} catch {
|
|
2402
|
+
return !1;
|
|
2403
|
+
}
|
|
2404
|
+
}, X = (e, t) => {
|
|
2405
|
+
let n = yn(t).formatToParts(new Date(e)), r = (e) => Number(n.find((t) => t.type === e)?.value);
|
|
2406
|
+
return (Date.UTC(r("year"), r("month") - 1, r("day"), r("hour"), r("minute"), r("second")) - Math.floor(e / 1e3) * 1e3) / Y;
|
|
2407
|
+
}, xn = (e, t) => {
|
|
2408
|
+
let n = gn.exec(e);
|
|
2409
|
+
if (n === null) throw RangeError(`not a local wall time (YYYY-MM-DDTHH:mm): ${e}`);
|
|
2410
|
+
let r = Date.UTC(Number(n[1]), Number(n[2]) - 1, Number(n[3]), Number(n[4]), Number(n[5])), i = X(r - 720 * Y, t), a = X(r + 720 * Y, t), o = [.../* @__PURE__ */ new Set([i, a])].map((e) => r - e * Y).filter((e) => X(e, t) * Y === r - e).sort((e, t) => e - t);
|
|
2411
|
+
return o.length === 0 ? {
|
|
2412
|
+
instant: /* @__PURE__ */ new Date(r - i * Y),
|
|
2413
|
+
adjusted: "gap"
|
|
2414
|
+
} : o.length > 1 ? {
|
|
2415
|
+
instant: new Date(o[0]),
|
|
2416
|
+
adjusted: "fold"
|
|
2417
|
+
} : { instant: new Date(o[0]) };
|
|
2418
|
+
}, Z = (e) => String(e).padStart(2, "0"), Sn = (e, t) => new Date(Date.UTC(e, t, 0)).getUTCDate(), Cn = (e, t, n) => {
|
|
2419
|
+
let [r, i, a, o, s] = [
|
|
2420
|
+
1,
|
|
2421
|
+
2,
|
|
2422
|
+
3,
|
|
2423
|
+
4,
|
|
2424
|
+
5
|
|
2425
|
+
].map((t) => Number(e[t]));
|
|
2426
|
+
if (t === "month") {
|
|
2427
|
+
let e = i - 1 + n, t = r + Math.floor(e / 12), c = e % 12 + 1, l = Math.min(a, Sn(t, c));
|
|
2428
|
+
return {
|
|
2429
|
+
local: `${t}-${Z(c)}-${Z(l)}T${Z(o)}:${Z(s)}`,
|
|
2430
|
+
clamped: l !== a
|
|
2431
|
+
};
|
|
2432
|
+
}
|
|
2433
|
+
let c = new Date(Date.UTC(r, i - 1, a + n * (t === "week" ? 7 : 1)));
|
|
2434
|
+
return {
|
|
2435
|
+
local: `${c.getUTCFullYear()}-${Z(c.getUTCMonth() + 1)}-${Z(c.getUTCDate())}T${Z(o)}:${Z(s)}`,
|
|
2436
|
+
clamped: !1
|
|
2437
|
+
};
|
|
2438
|
+
}, wn = (e, t) => t * (e === "day" ? 1440 : e === "week" ? 10080 : 40320), Tn = (e) => {
|
|
2439
|
+
let t = [], n = e.interval ?? 1;
|
|
2440
|
+
gn.test(e.start) || t.push("start must be a local wall time, YYYY-MM-DDTHH:mm"), bn(e.zone) || t.push(`unknown time zone '${e.zone}'`), (!Number.isInteger(e.count) || e.count < 1 || e.count > 100) && t.push("count must be between 1 and 100"), (!Number.isInteger(n) || n < 1 || n > 52) && t.push("interval must be between 1 and 52"), !Number.isInteger(e.durationMinutes) || e.durationMinutes < 1 ? t.push("an occurrence must last at least a minute") : e.durationMinutes >= wn(e.every, n) && t.push("an occurrence must end before the next one starts");
|
|
2441
|
+
for (let n of e.except ?? []) _n.test(n) || t.push(`not a local date (YYYY-MM-DD): ${n}`);
|
|
2442
|
+
return t;
|
|
2443
|
+
}, En = (e) => {
|
|
2444
|
+
let t = Tn(e);
|
|
2445
|
+
if (t.length > 0) throw RangeError(t.join("; "));
|
|
2446
|
+
let n = gn.exec(e.start), r = e.interval ?? 1, i = new Set(e.except ?? []), a = [];
|
|
2447
|
+
for (let t = 0; t < e.count; t++) {
|
|
2448
|
+
let { local: o, clamped: s } = Cn(n, e.every, t * r);
|
|
2449
|
+
if (i.has(o.slice(0, 10))) continue;
|
|
2450
|
+
let { instant: c, adjusted: l } = xn(o, e.zone), u = l ?? (s ? "clamped" : void 0);
|
|
2451
|
+
a.push({
|
|
2452
|
+
index: t,
|
|
2453
|
+
local: o,
|
|
2454
|
+
startsAt: c,
|
|
2455
|
+
endsAt: new Date(c.getTime() + e.durationMinutes * Y),
|
|
2456
|
+
...u === void 0 ? {} : { adjusted: u }
|
|
2457
|
+
});
|
|
2458
|
+
}
|
|
2459
|
+
return a;
|
|
2460
|
+
}, Dn = (e, t, n) => (Array.isArray(e) ? e : []).flatMap((e) => {
|
|
2461
|
+
let r = e;
|
|
2462
|
+
return typeof r == "object" && r && typeof r[t] == "string" ? [{
|
|
2463
|
+
id: r[t],
|
|
2464
|
+
name: String(r[n] ?? ""),
|
|
2465
|
+
raw: JSON.stringify(r)
|
|
2466
|
+
}] : [];
|
|
2467
|
+
}), On = (e, t, n, r, i) => {
|
|
2468
|
+
let a = new Map(e.map((e, t) => [e.id, t])), o = new Map(t.map((e, t) => [e.id, t])), s = t.find((e) => !a.has(e.id));
|
|
2469
|
+
if (s !== void 0) return {
|
|
2470
|
+
label: i.add(r(s)),
|
|
2471
|
+
key: `add:${n}:${s.id}`
|
|
2472
|
+
};
|
|
2473
|
+
let c = e.find((e) => !o.has(e.id));
|
|
2474
|
+
if (c !== void 0) return {
|
|
2475
|
+
label: i.remove(r(c)),
|
|
2476
|
+
key: `remove:${n}:${c.id}`
|
|
2477
|
+
};
|
|
2478
|
+
let l = t.flatMap((t, n) => e[n]?.id === t.id ? [] : [n]);
|
|
2479
|
+
if (l.length === 2 && l[1] === l[0] + 1 && t[l[0]]?.id === e[l[1]]?.id) {
|
|
2480
|
+
let [t, a] = [e[l[0]], e[l[1]]];
|
|
2481
|
+
return {
|
|
2482
|
+
label: i.swap(r(t), r(a)),
|
|
2483
|
+
key: `move:${n}:${t.id}:${a.id}:${l[0]}`
|
|
2484
|
+
};
|
|
2485
|
+
}
|
|
2486
|
+
let u = t.find((e, t) => (a.get(e.id) ?? t) > t);
|
|
2487
|
+
if (u !== void 0) return {
|
|
2488
|
+
label: i.moveUp(r(u)),
|
|
2489
|
+
key: `move:${n}:${u.id}:${o.get(u.id)}`
|
|
2490
|
+
};
|
|
2491
|
+
let d = t.find((e, t) => (a.get(e.id) ?? t) < t);
|
|
2492
|
+
if (d !== void 0) return {
|
|
2493
|
+
label: i.moveDown(r(d)),
|
|
2494
|
+
key: `move:${n}:${d.id}:${o.get(d.id)}`
|
|
2495
|
+
};
|
|
2496
|
+
let f = t.find((t) => t.raw !== e[a.get(t.id) ?? -1]?.raw);
|
|
2497
|
+
return {
|
|
2498
|
+
label: i.edit(f === void 0 ? i.fieldLabel(n) : r(f)),
|
|
2499
|
+
key: `edit:${n}${f === void 0 ? "" : `:${f.id}`}`
|
|
2500
|
+
};
|
|
2501
|
+
}, kn = (e, t, n, r) => {
|
|
2502
|
+
let i = M(e, t, n);
|
|
2503
|
+
if (i.length === 0) return null;
|
|
2504
|
+
if (i.length > 1) return {
|
|
2505
|
+
label: r.edit(i.map(r.fieldLabel).join(", ")),
|
|
2506
|
+
key: `edit:${i.join(",")}`
|
|
2507
|
+
};
|
|
2508
|
+
let a = i[0], o = e[a];
|
|
2509
|
+
if (o?.editorHint === "components") return On(Dn(t[a], "instanceId", "componentId"), Dn(n[a], "instanceId", "componentId"), a, (e) => r.componentLabel(e.name), r);
|
|
2510
|
+
if (o?.editorHint === "richText") {
|
|
2511
|
+
let e = (e) => Dn(e?.blocks, "id", "type"), i = On(e(t[a]), e(n[a]), a, (e) => r.blockLabel(e.name), r);
|
|
2512
|
+
return i.key.startsWith("edit:") ? {
|
|
2513
|
+
label: i.label,
|
|
2514
|
+
key: `edit:${a}`
|
|
2515
|
+
} : i;
|
|
2516
|
+
}
|
|
2517
|
+
return {
|
|
2518
|
+
label: r.edit(r.fieldLabel(a)),
|
|
2519
|
+
key: `edit:${a}`
|
|
2520
|
+
};
|
|
2521
|
+
}, An = {
|
|
2522
|
+
past: [],
|
|
2523
|
+
future: []
|
|
2524
|
+
}, jn = (e, t, n, r, i = {}) => {
|
|
2525
|
+
let a = e.past[e.past.length - 1];
|
|
2526
|
+
return a !== void 0 && a.key === n.key && r - a.at <= (i.mergeMs ?? 1500) ? {
|
|
2527
|
+
past: [...e.past.slice(0, -1), {
|
|
2528
|
+
...a,
|
|
2529
|
+
label: n.label,
|
|
2530
|
+
at: r
|
|
2531
|
+
}],
|
|
2532
|
+
future: []
|
|
2533
|
+
} : {
|
|
2534
|
+
past: [...e.past, {
|
|
2535
|
+
values: t,
|
|
2536
|
+
label: n.label,
|
|
2537
|
+
key: n.key,
|
|
2538
|
+
at: r
|
|
2539
|
+
}].slice(-(i.limit ?? 100)),
|
|
2540
|
+
future: []
|
|
2541
|
+
};
|
|
2542
|
+
}, Mn = (e, t) => {
|
|
2543
|
+
let n = e.past[e.past.length - 1];
|
|
2544
|
+
return n === void 0 ? null : {
|
|
2545
|
+
values: n.values,
|
|
2546
|
+
label: n.label,
|
|
2547
|
+
history: {
|
|
2548
|
+
past: e.past.slice(0, -1),
|
|
2549
|
+
future: [{
|
|
2550
|
+
...n,
|
|
2551
|
+
values: t
|
|
2552
|
+
}, ...e.future]
|
|
2553
|
+
}
|
|
2554
|
+
};
|
|
2555
|
+
}, Nn = (e, t) => {
|
|
2556
|
+
let n = e.future[0];
|
|
2557
|
+
return n === void 0 ? null : {
|
|
2558
|
+
values: n.values,
|
|
2559
|
+
label: n.label,
|
|
2560
|
+
history: {
|
|
2561
|
+
past: [...e.past, {
|
|
2562
|
+
...n,
|
|
2563
|
+
values: t
|
|
2564
|
+
}],
|
|
2565
|
+
future: e.future.slice(1)
|
|
2566
|
+
}
|
|
2567
|
+
};
|
|
2568
|
+
}, Q = "voltro.cms.visual/1", Pn = () => Array.from(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)), (e) => e.toString(16).padStart(2, "0")).join(""), Fn = /^[A-Za-z_][A-Za-z0-9_]*(\.\d+)?$/, In = (e, t) => {
|
|
2569
|
+
if (e.origin !== t.origin) return null;
|
|
2570
|
+
let n = e.data;
|
|
2571
|
+
if (typeof n != "object" || !n) return null;
|
|
2572
|
+
let r = n;
|
|
2573
|
+
return r.protocol === "voltro.cms.visual/1" && typeof r.nonce == "string" && r.nonce === t.nonce ? r : null;
|
|
2574
|
+
}, Ln = (e, t) => {
|
|
2575
|
+
let n = In(e, t);
|
|
2576
|
+
if (n === null) return null;
|
|
2577
|
+
let r = {
|
|
2578
|
+
protocol: Q,
|
|
2579
|
+
nonce: t.nonce
|
|
2580
|
+
};
|
|
2581
|
+
return n.kind === "ready" ? {
|
|
2582
|
+
...r,
|
|
2583
|
+
kind: "ready"
|
|
2584
|
+
} : typeof n.path != "string" || !Fn.test(n.path) ? null : n.kind === "select" ? {
|
|
2585
|
+
...r,
|
|
2586
|
+
kind: "select",
|
|
2587
|
+
path: n.path
|
|
2588
|
+
} : n.kind === "move" && Number.isInteger(n.to) && n.to >= 0 ? {
|
|
2589
|
+
...r,
|
|
2590
|
+
kind: "move",
|
|
2591
|
+
path: n.path,
|
|
2592
|
+
to: n.to
|
|
2593
|
+
} : null;
|
|
2594
|
+
}, Rn = (e, t) => {
|
|
2595
|
+
let n = In(e, t);
|
|
2596
|
+
return n === null || n.kind !== "values" || typeof n.values != "object" || n.values === null || Array.isArray(n.values) ? null : {
|
|
2597
|
+
protocol: Q,
|
|
2598
|
+
nonce: t.nonce,
|
|
2599
|
+
kind: "values",
|
|
2600
|
+
values: n.values
|
|
2601
|
+
};
|
|
2602
|
+
}, zn = (e, t) => ({
|
|
2603
|
+
protocol: Q,
|
|
2604
|
+
nonce: e.nonce,
|
|
2605
|
+
...t
|
|
2606
|
+
}), Bn = (e) => ({ "data-cms-source": e }), Vn = (e) => {
|
|
2607
|
+
let t = e;
|
|
2608
|
+
return (typeof t?.closest == "function" ? t.closest("[data-cms-source]") : null)?.getAttribute("data-cms-source") ?? null;
|
|
2609
|
+
}, Hn = (e) => {
|
|
2610
|
+
let [t = "", n] = e.split(".");
|
|
2611
|
+
return n === void 0 ? { field: t } : {
|
|
2612
|
+
field: t,
|
|
2613
|
+
index: Number(n)
|
|
2614
|
+
};
|
|
2615
|
+
}, Un = (e, t, n) => {
|
|
2616
|
+
let r = Math.max(0, Math.min(e.length - 1, n));
|
|
2617
|
+
if (t < 0 || t >= e.length || t === r) return e;
|
|
2618
|
+
let i = [...e], [a] = i.splice(t, 1);
|
|
2619
|
+
return i.splice(r, 0, a), i;
|
|
2620
|
+
}, Wn = (e, t) => {
|
|
2621
|
+
if (!Fn.test(t)) return null;
|
|
2622
|
+
let { field: n, index: r } = Hn(t), i = e.querySelector(`[data-cms-field="${n}"]`);
|
|
2623
|
+
return i === null || r === void 0 ? i : i.querySelectorAll("[data-cms-components] > [data-cms-component]")[r] ?? null;
|
|
2624
|
+
}, $ = ({ content: e, hrefOf: t }) => e.map((e, n) => {
|
|
2625
|
+
if (e.type === "link") {
|
|
2626
|
+
let r = t(e.target);
|
|
2627
|
+
return r === void 0 ? /* @__PURE__ */ c("span", { children: e.text }, n) : /* @__PURE__ */ c("a", {
|
|
2628
|
+
href: r,
|
|
2629
|
+
children: e.text
|
|
2630
|
+
}, n);
|
|
2631
|
+
}
|
|
2632
|
+
let r = e.marks ?? [], i = e.text;
|
|
2633
|
+
return r.includes("underline") && (i = /* @__PURE__ */ c("u", { children: i })), r.includes("italic") && (i = /* @__PURE__ */ c("em", { children: i })), r.includes("bold") && (i = /* @__PURE__ */ c("strong", { children: i })), /* @__PURE__ */ c("span", { children: i }, n);
|
|
2634
|
+
}), Gn = ({ block: e, hrefOf: t, renderImage: n }) => {
|
|
2635
|
+
switch (e.type) {
|
|
2636
|
+
case "paragraph": return /* @__PURE__ */ c("p", {
|
|
2637
|
+
"data-block-id": e.id,
|
|
2638
|
+
children: /* @__PURE__ */ c($, {
|
|
2639
|
+
content: e.content,
|
|
2640
|
+
hrefOf: t
|
|
2641
|
+
})
|
|
2642
|
+
});
|
|
2643
|
+
case "heading": return e.level === 2 ? /* @__PURE__ */ c("h2", {
|
|
2644
|
+
"data-block-id": e.id,
|
|
2645
|
+
children: /* @__PURE__ */ c($, {
|
|
2646
|
+
content: e.content,
|
|
2647
|
+
hrefOf: t
|
|
2648
|
+
})
|
|
2649
|
+
}) : /* @__PURE__ */ c("h3", {
|
|
2650
|
+
"data-block-id": e.id,
|
|
2651
|
+
children: /* @__PURE__ */ c($, {
|
|
2652
|
+
content: e.content,
|
|
2653
|
+
hrefOf: t
|
|
2654
|
+
})
|
|
2655
|
+
});
|
|
2656
|
+
case "list": {
|
|
2657
|
+
let n = e.levels ?? e.items.map(() => 0), r = (t) => C(e, t) ? "ol" : "ul", i = (a, o) => {
|
|
2658
|
+
let s = [], u = a;
|
|
2659
|
+
for (; u < e.items.length && n[u] >= o;) {
|
|
2660
|
+
let n = u, [a, d] = i(u + 1, o + 1), f = r(o + 1);
|
|
2661
|
+
s.push(/* @__PURE__ */ l("li", { children: [/* @__PURE__ */ c($, {
|
|
2662
|
+
content: e.items[n],
|
|
2663
|
+
hrefOf: t
|
|
2664
|
+
}), a.length > 0 ? /* @__PURE__ */ c(f, { children: a }) : null] }, n)), u = d;
|
|
2665
|
+
}
|
|
2666
|
+
return [s, u];
|
|
2667
|
+
}, a = r(0);
|
|
2668
|
+
return /* @__PURE__ */ c(a, {
|
|
2669
|
+
"data-block-id": e.id,
|
|
2670
|
+
children: i(0, 0)[0]
|
|
2671
|
+
});
|
|
2672
|
+
}
|
|
2673
|
+
case "table": {
|
|
2674
|
+
let [n, ...r] = e.header ? e.rows : [void 0, ...e.rows];
|
|
2675
|
+
return /* @__PURE__ */ l("table", {
|
|
2676
|
+
"data-block-id": e.id,
|
|
2677
|
+
children: [n === void 0 ? null : /* @__PURE__ */ c("thead", { children: /* @__PURE__ */ c("tr", { children: n.map((e, n) => /* @__PURE__ */ c("th", {
|
|
2678
|
+
scope: "col",
|
|
2679
|
+
children: /* @__PURE__ */ c($, {
|
|
2680
|
+
content: e,
|
|
2681
|
+
hrefOf: t
|
|
2682
|
+
})
|
|
2683
|
+
}, n)) }) }), /* @__PURE__ */ c("tbody", { children: r.map((e, n) => /* @__PURE__ */ c("tr", { children: (e ?? []).map((e, n) => /* @__PURE__ */ c("td", { children: /* @__PURE__ */ c($, {
|
|
2684
|
+
content: e,
|
|
2685
|
+
hrefOf: t
|
|
2686
|
+
}) }, n)) }, n)) })]
|
|
2687
|
+
});
|
|
2688
|
+
}
|
|
2689
|
+
case "image": return n === void 0 ? null : /* @__PURE__ */ c("div", {
|
|
2690
|
+
"data-block-id": e.id,
|
|
2691
|
+
children: n(e)
|
|
2692
|
+
});
|
|
2693
|
+
}
|
|
2694
|
+
}, Kn = ({ document: e, hrefOf: t = () => void 0, renderImage: n }) => {
|
|
2695
|
+
let r = E(e);
|
|
2696
|
+
return se("", r, {
|
|
2697
|
+
images: "*",
|
|
2698
|
+
links: "*"
|
|
2699
|
+
}).some((e) => e.rule === "type" || e.rule === "unknown") ? null : /* @__PURE__ */ c(s, { children: r.blocks.map((e) => /* @__PURE__ */ c(Gn, {
|
|
2700
|
+
block: e,
|
|
2701
|
+
hrefOf: t,
|
|
2702
|
+
renderImage: n
|
|
2703
|
+
}, e.id)) });
|
|
2704
|
+
}, qn = [
|
|
2705
|
+
"dashboard",
|
|
2706
|
+
"sidebar",
|
|
2707
|
+
"fieldWidget",
|
|
2708
|
+
"entryTab",
|
|
2709
|
+
"releaseCheck",
|
|
2710
|
+
"assetAction",
|
|
2711
|
+
"settings"
|
|
2712
|
+
], Jn = (e, t) => {
|
|
2713
|
+
let n = new Map((e.settings ?? []).map((e) => [e.key, e])), r = [];
|
|
2714
|
+
for (let [i, a] of Object.entries(t)) {
|
|
2715
|
+
let t = n.get(i);
|
|
2716
|
+
if (t === void 0) {
|
|
2717
|
+
r.push(`"${i}" is not a setting of ${e.id}`);
|
|
2718
|
+
continue;
|
|
2719
|
+
}
|
|
2720
|
+
t.kind === "number" ? typeof a != "number" || !Number.isFinite(a) ? r.push(`"${i}" is a number`) : (t.min !== void 0 && a < t.min || t.max !== void 0 && a > t.max) && r.push(`"${i}" is between ${t.min ?? "…"} and ${t.max ?? "…"}`) : t.kind === "boolean" ? typeof a != "boolean" && r.push(`"${i}" is true or false`) : (typeof a != "string" || !t.options.includes(a)) && r.push(`"${i}" is one of ${t.options.join(", ")}`);
|
|
2721
|
+
}
|
|
2722
|
+
return r;
|
|
2723
|
+
}, Yn = (e, t) => Object.fromEntries((e.settings ?? []).map((n) => {
|
|
2724
|
+
let r = t[n.key];
|
|
2725
|
+
return [n.key, Jn(e, { [n.key]: r }).length === 0 && r !== void 0 ? r : n.default];
|
|
2726
|
+
})), Xn = /* @__PURE__ */ new Set(["content:read", "content:write"]), Zn = /^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/, Qn = /^[A-Z][A-Z0-9_]{0,63}$/, $n = /^[a-z][a-z0-9-]{0,62}$/, er = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/, tr = (e) => Xn.has(e) || e.startsWith("egress:") && Zn.test(e.slice(7)) || e.startsWith("secret:") && Qn.test(e.slice(7)), nr = (e) => {
|
|
2727
|
+
let t = [];
|
|
2728
|
+
$n.test(e.id) || t.push(`id "${e.id}": lowercase letters, digits and dashes, starting with a letter`), e.name.trim() === "" && t.push("name is empty"), e.publisher.trim() === "" && t.push("publisher is empty"), er.test(e.version) || t.push(`version "${e.version}": major.minor.patch`);
|
|
2729
|
+
let n = /* @__PURE__ */ new Set();
|
|
2730
|
+
for (let r of e.capabilities) tr(r) ? n.has(r) && t.push(`capability "${r}" is listed twice`) : t.push(`capability "${r}" is not one an extension can ask for`), n.add(r);
|
|
2731
|
+
for (let n of e.slots) qn.includes(n) || t.push(`slot "${n}" is not a place in the editor`);
|
|
2732
|
+
let r = e.slots.includes("fieldWidget");
|
|
2733
|
+
r && (e.fields ?? []).length === 0 && t.push("a field widget names the fields it shows beside"), !r && e.fields !== void 0 && t.push("fields belong to the fieldWidget slot");
|
|
2734
|
+
for (let n of e.fields ?? []) /^[A-Za-z][A-Za-z0-9]*$/.test(n) || t.push(`field "${n}" is not a field name`);
|
|
2735
|
+
let i = e.slots.includes("settings");
|
|
2736
|
+
i && (e.settings ?? []).length === 0 && t.push("the settings slot lists its settings"), !i && e.settings !== void 0 && t.push("settings belong to the settings slot");
|
|
2737
|
+
let a = /* @__PURE__ */ new Set();
|
|
2738
|
+
for (let n of e.settings ?? []) /^[A-Za-z][A-Za-z0-9]*$/.test(n.key) || t.push(`setting "${n.key}" is not a key`), a.has(n.key) && t.push(`setting "${n.key}" is listed twice`), a.add(n.key), Jn({
|
|
2739
|
+
...e,
|
|
2740
|
+
settings: [n]
|
|
2741
|
+
}, { [n.key]: n.default }).length > 0 && t.push(`setting "${n.key}": its default is not a value it allows`);
|
|
2742
|
+
return t;
|
|
2743
|
+
}, rr = (e, t) => {
|
|
2744
|
+
let n = e.split(".").map(Number), r = t.split(".").map(Number);
|
|
2745
|
+
for (let e = 0; e < 3; e++) {
|
|
2746
|
+
let t = (n[e] ?? 0) - (r[e] ?? 0);
|
|
2747
|
+
if (t !== 0) return t;
|
|
2748
|
+
}
|
|
2749
|
+
return 0;
|
|
2750
|
+
}, ir = (e, t) => t.filter((t) => !e.includes(t)), ar = class extends e.TaggedError()("ExtensionAccessDenied", {
|
|
2751
|
+
extensionId: e.String,
|
|
2752
|
+
capability: e.String
|
|
2753
|
+
}) {}, or = e.Struct({
|
|
2754
|
+
id: e.String,
|
|
2755
|
+
name: e.String,
|
|
2756
|
+
version: e.String,
|
|
2757
|
+
publisher: e.String,
|
|
2758
|
+
capabilities: e.Array(e.String),
|
|
2759
|
+
slots: e.Array(e.String),
|
|
2760
|
+
fields: e.optional(e.Array(e.String)),
|
|
2761
|
+
settings: e.optional(e.Array(e.Union(e.Struct({
|
|
2762
|
+
key: e.String,
|
|
2763
|
+
label: e.String,
|
|
2764
|
+
kind: e.Literal("number"),
|
|
2765
|
+
default: e.Number,
|
|
2766
|
+
min: e.optional(e.Number),
|
|
2767
|
+
max: e.optional(e.Number)
|
|
2768
|
+
}), e.Struct({
|
|
2769
|
+
key: e.String,
|
|
2770
|
+
label: e.String,
|
|
2771
|
+
kind: e.Literal("boolean"),
|
|
2772
|
+
default: e.Boolean
|
|
2773
|
+
}), e.Struct({
|
|
2774
|
+
key: e.String,
|
|
2775
|
+
label: e.String,
|
|
2776
|
+
kind: e.Literal("choice"),
|
|
2777
|
+
default: e.String,
|
|
2778
|
+
options: e.Array(e.String)
|
|
2779
|
+
}))))
|
|
2780
|
+
});
|
|
2781
|
+
//#endregion
|
|
2782
|
+
export { pt as $, d as $t, xn as A, Ee as At, Bt as B, T as Bt, jn as C, Se as Ct, bn as D, De as Dt, hn as E, je as Et, Lt as F, pe as Ft, Tt as G, ce as Gt, V as H, O as Ht, K as I, ie as It, Dt as J, ne as Jt, Et as K, re as Kt, Ht as L, oe as Lt, pn as M, be as Mt, tn as N, fe as Nt, En as O, ke as Ot, qt as P, me as Pt, ht as Q, y as Qt, It as R, k as Rt, kn as S, Ce as St, Mn as T, Me as Tt, H as U, de as Ut, Rt as V, E as Vt, L as W, se as Wt, wt as X, h as Xt, Ct as Y, te as Yt, vt as Z, v as Zt, Ln as _, Re as _t, tr as a, et as at, zn as b, we as bt, Jn as c, Qe as ct, Q as d, qe as dt, f as en, gt as et, Wn as f, We as ft, Rn as g, Ie as gt, Hn as h, M as ht, rr as i, st as it, mn as j, ve as jt, Tn as k, Ae as kt, Yn as l, Xe as lt, Pn as m, Ke as mt, ar as n, p as nn, dt as nt, nr as o, at as ot, Un as p, Ge as pt, Pt as q, S as qt, or as r, ft as rt, ir as s, Ye as st, qn as t, ee as tn, lt as tt, Kn as u, Ze as ut, Bn as v, Ne as vt, Nn as w, Oe as wt, An as x, Te as xt, Vn as y, N as yt, G as z, C as zt };
|