@aduptive/strapi-blockscene 1.0.0-alpha.9 → 2.0.0-alpha.10

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/dist/admin.cjs CHANGED
@@ -148,8 +148,8 @@ var require_groups = __commonJS({
148
148
  }
149
149
  function layoutColumns2(row, layout, schema) {
150
150
  const max = layout.maxColumns || MAX_COLUMNS;
151
- const read2 = (name) => Math.min(max, parseColumns(row?.[name]) ?? parseColumns(schema?.attributes?.[name]?.default) ?? 1);
152
- return { desktop: read2(layout.columnsField), mobile: layout.mobileColumnsField ? read2(layout.mobileColumnsField) : null };
151
+ const read3 = (name) => Math.min(max, parseColumns(row?.[name]) ?? parseColumns(schema?.attributes?.[name]?.default) ?? 1);
152
+ return { desktop: read3(layout.columnsField), mobile: layout.mobileColumnsField ? read3(layout.mobileColumnsField) : null };
153
153
  }
154
154
  module2.exports = {
155
155
  safeGroups: safeGroups2,
@@ -171,16 +171,111 @@ var require_groups = __commonJS({
171
171
  }
172
172
  });
173
173
 
174
- // admin/strapi4.tsx
175
- var strapi4_exports = {};
176
- __export(strapi4_exports, {
177
- default: () => strapi4_default
174
+ // server/diff.js
175
+ var require_diff = __commonJS({
176
+ "server/diff.js"(exports, module2) {
177
+ "use strict";
178
+ var IGNORED = ["id", "documentId", "locale", "localizations", "createdAt", "updatedAt", "publishedAt", "firstPublishedAt", "createdBy", "updatedBy", "strapi_stage", "strapi_assignee", "__temp_key__", "__pivot"];
179
+ var morph = (attr) => String(attr?.relation || "").toLowerCase().includes("morph");
180
+ var kept2 = (name, attr) => attr && !IGNORED.includes(name) && attr.type !== "password" && !(attr.type === "relation" && (morph(attr) || attr.visible === false));
181
+ var empty = (value) => value === null || value === void 0 || value === "";
182
+ function snapshotPopulate(uid, schemaOf, stack = []) {
183
+ const schema = schemaOf(uid);
184
+ if (!schema || stack.includes(uid)) return {};
185
+ const scalars = (component) => Object.entries(schemaOf(component)?.attributes || {}).filter(([name, attr]) => kept2(name, attr) && !["relation", "media", "component", "dynamiczone"].includes(attr.type)).map(([name]) => name);
186
+ const nested = (component) => ({ select: scalars(component).length ? scalars(component) : ["id"], populate: snapshotPopulate(component, schemaOf, [...stack, uid]) });
187
+ const out = {};
188
+ for (const [name, attr] of Object.entries(schema.attributes || {})) {
189
+ if (!kept2(name, attr)) continue;
190
+ if (attr.type === "relation") out[name] = { select: ["documentId", "locale"] };
191
+ else if (attr.type === "media") out[name] = { select: ["id"] };
192
+ else if (attr.type === "component") out[name] = nested(attr.component);
193
+ else if (attr.type === "dynamiczone") out[name] = { on: Object.fromEntries((attr.components || []).map((component) => [component, nested(component)])) };
194
+ }
195
+ return out;
196
+ }
197
+ function canonical2(data, schema, schemaOf, { relations = true } = {}, depth = 0) {
198
+ const out = {};
199
+ if (!data || typeof data !== "object" || depth > 20) return out;
200
+ const idOf = (file) => file && typeof file === "object" ? file.id : file;
201
+ const ref = (item) => item && typeof item === "object" && item.documentId ? { documentId: item.documentId, ...item.locale && { locale: item.locale } } : null;
202
+ for (const [name, attr] of Object.entries(schema?.attributes || {})) {
203
+ const value = data[name];
204
+ if (!kept2(name, attr) || empty(value)) continue;
205
+ if (attr.type === "relation") {
206
+ if (!relations) continue;
207
+ const refs = (Array.isArray(value) ? value : [value]).map(ref).filter(Boolean);
208
+ if (refs.length) out[name] = Array.isArray(value) ? refs : refs[0];
209
+ } else if (attr.type === "media") {
210
+ const ids = (Array.isArray(value) ? value : [value]).map(idOf).filter((id) => !empty(id));
211
+ if (ids.length) out[name] = attr.multiple ? ids : ids[0];
212
+ } else if (attr.type === "component") {
213
+ const child = schemaOf(attr.component);
214
+ if (attr.repeatable) {
215
+ if (Array.isArray(value) && value.length) out[name] = value.map((item) => canonical2(item, child, schemaOf, { relations }, depth + 1));
216
+ } else out[name] = canonical2(value, child, schemaOf, { relations }, depth + 1);
217
+ } else if (attr.type === "dynamiczone") {
218
+ if (Array.isArray(value) && value.length) out[name] = value.filter((row) => row && typeof row.__component === "string").map((row) => ({ __component: row.__component, ...canonical2(row, schemaOf(row.__component), schemaOf, { relations }, depth + 1) }));
219
+ } else out[name] = value;
220
+ }
221
+ return out;
222
+ }
223
+ var stable = (value) => JSON.stringify(value, (_, v) => v && typeof v === "object" && !Array.isArray(v) ? Object.fromEntries(Object.keys(v).sort().map((k) => [k, v[k]])) : v);
224
+ var same2 = (a, b) => stable(a ?? null) === stable(b ?? null);
225
+ function diffRows2(before = [], after = []) {
226
+ const a = before.map(stable), b = after.map(stable);
227
+ const n = a.length, m = b.length;
228
+ if (n * m > 25e4) return after.map((row, to) => ({ op: a[to] === b[to] ? "same" : "changed", from: to < n ? to : void 0, to, uid: row.__component }));
229
+ const lcs = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));
230
+ for (let i2 = n - 1; i2 >= 0; i2--) for (let j2 = m - 1; j2 >= 0; j2--) lcs[i2][j2] = a[i2] === b[j2] ? lcs[i2 + 1][j2 + 1] + 1 : Math.max(lcs[i2 + 1][j2], lcs[i2][j2 + 1]);
231
+ const out = [];
232
+ const gap = (fromRows2, toRows2) => {
233
+ const removed = [...fromRows2];
234
+ for (const to of toRows2) {
235
+ const k = removed.findIndex((from) => before[from].__component === after[to].__component);
236
+ if (k === -1) out.push({ op: "added", to, uid: after[to].__component });
237
+ else out.push({ op: "changed", from: removed.splice(k, 1)[0], to, uid: after[to].__component });
238
+ }
239
+ for (const from of removed) out.push({ op: "removed", from, uid: before[from].__component });
240
+ };
241
+ let i = 0, j = 0, fromRows = [], toRows = [];
242
+ while (i < n || j < m) {
243
+ if (i < n && j < m && a[i] === b[j]) {
244
+ gap(fromRows, toRows);
245
+ fromRows = [];
246
+ toRows = [];
247
+ out.push({ op: "same", from: i, to: j, uid: after[j].__component });
248
+ i++;
249
+ j++;
250
+ } else if (j < m && (i >= n || lcs[i][j + 1] >= lcs[i + 1][j])) toRows.push(j++);
251
+ else fromRows.push(i++);
252
+ }
253
+ gap(fromRows, toRows);
254
+ return out;
255
+ }
256
+ function summarize(before, after, schema) {
257
+ const zones = Object.entries(schema?.attributes || {}).filter(([, attr]) => attr?.type === "dynamiczone").map(([name]) => name);
258
+ const blocks = { added: 0, removed: 0, changed: 0 };
259
+ if (!before) return { initial: true, fields: [], blocks };
260
+ const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after || {})])];
261
+ const fields = names.filter((name) => !zones.includes(name) && !same2(before[name], after?.[name])).sort();
262
+ for (const name of zones) for (const { op } of diffRows2(before[name], after?.[name])) if (op !== "same") blocks[op]++;
263
+ return { fields, blocks };
264
+ }
265
+ module2.exports = { IGNORED, kept: kept2, snapshotPopulate, canonical: canonical2, stable, same: same2, diffRows: diffRows2, summarize };
266
+ }
178
267
  });
179
- module.exports = __toCommonJS(strapi4_exports);
180
- var React12 = __toESM(require("react"));
181
- var import_design_system7 = require("@strapi/design-system");
182
- var import_helper_plugin = require("@strapi/helper-plugin");
183
- var import_react_intl2 = require("react-intl");
268
+
269
+ // admin/strapi5.tsx
270
+ var strapi5_exports = {};
271
+ __export(strapi5_exports, {
272
+ default: () => strapi5_default
273
+ });
274
+ module.exports = __toCommonJS(strapi5_exports);
275
+ var React16 = __toESM(require("react"));
276
+ var import_design_system11 = require("@strapi/design-system");
277
+ var import_admin4 = require("@strapi/strapi/admin");
278
+ var import_strapi_admin2 = require("@strapi/content-manager/strapi-admin");
184
279
 
185
280
  // admin/Gallery.tsx
186
281
  var React6 = __toESM(require("react"));
@@ -253,9 +348,9 @@ function canInsert(zone, uid, values, components, count = 1) {
253
348
  zone?.components.includes(uid) && components[uid] && (Array.isArray(values?.[zone.name]) ? values[zone.name].length : 0) + count <= (zone.max ?? Infinity)
254
349
  );
255
350
  }
256
- function candidatesFor(uid, meta = {}, config = {}) {
257
- const version = config.previewVersion ? `?v=${encodeURIComponent(config.previewVersion)}` : "";
258
- const base = (config.previewBaseUrl || "/block-previews").replace(/\/$/, "");
351
+ function candidatesFor(uid, meta = {}, config2 = {}) {
352
+ const version = config2.previewVersion ? `?v=${encodeURIComponent(config2.previewVersion)}` : "";
353
+ const base = (config2.previewBaseUrl || "/block-previews").replace(/\/$/, "");
259
354
  return [
260
355
  meta.manualImage,
261
356
  meta.image,
@@ -290,12 +385,12 @@ var fieldsOf = (schema) => Object.entries(schema?.attributes || {}).filter(([nam
290
385
  var TYPOLOGIES = ["hero", "text", "media", "listing", "cards", "cta", "form", "layout"];
291
386
  var FACETS = { media: ["image", "video", "gallery"], content: ["richtext", "list", "dynamic", "form"] };
292
387
  var typologyRank = (t) => TYPOLOGIES.indexOf(t) + 1 || 99;
293
- var pickable = (zone, config) => {
294
- const closers = Object.values(config.groups || {});
388
+ var pickable = (zone, config2) => {
389
+ const closers = Object.values(config2.groups || {});
295
390
  return zone.components.filter((uid) => !closers.includes(uid));
296
391
  };
297
- function entryOf(uid, schema, config) {
298
- const meta = config.components?.[uid] || {};
392
+ function entryOf(uid, schema, config2) {
393
+ const meta = config2.components?.[uid] || {};
299
394
  return {
300
395
  uid,
301
396
  label: meta.label || schema.info?.displayName || uid,
@@ -305,27 +400,27 @@ function entryOf(uid, schema, config) {
305
400
  tags: meta.tags || [],
306
401
  keywords: meta.keywords || "",
307
402
  fields: fieldsOf(schema),
308
- candidates: candidatesFor(uid, meta, config),
403
+ candidates: candidatesFor(uid, meta, config2),
309
404
  template: meta.template || "generic",
310
405
  // Insert variants from the code config ({ id, label, values }); the first is what a quick insert uses.
311
406
  variants: Array.isArray(meta.variants) ? meta.variants : []
312
407
  };
313
408
  }
314
- var allEntries = (zone, components, config) => pickable(zone, config).flatMap((uid) => components[uid] ? [entryOf(uid, components[uid], config)] : []);
315
- function entriesFor(zone, components, config, query, filter = {}) {
316
- const needle = query.trim().toLocaleLowerCase();
409
+ var allEntries = (zone, components, config2) => pickable(zone, config2).flatMap((uid) => components[uid] ? [entryOf(uid, components[uid], config2)] : []);
410
+ function entriesFor(zone, components, config2, query2, filter = {}) {
411
+ const needle = query2.trim().toLocaleLowerCase();
317
412
  const any = (picked, values) => !picked?.length || picked.some((value) => values.includes(value));
318
- return allEntries(zone, components, config).filter(
413
+ return allEntries(zone, components, config2).filter(
319
414
  (entry) => (!filter.typology || entry.typology === filter.typology) && (!filter.uids || filter.uids.includes(entry.uid)) && any(filter.tags, entry.tags) && any(filter.media, entry.facets) && any(filter.content, entry.facets) && `${entry.label} ${entry.description} ${entry.typology} ${entry.tags.join(" ")} ${entry.uid} ${entry.keywords}`.toLocaleLowerCase().includes(needle)
320
415
  ).sort((a, b) => typologyRank(a.typology) - typologyRank(b.typology) || a.label.localeCompare(b.label));
321
416
  }
322
- function optionsFor(zone, components, config) {
417
+ function optionsFor(zone, components, config2) {
323
418
  const count = (values) => {
324
419
  const counts = /* @__PURE__ */ new Map();
325
420
  for (const value of values) counts.set(value, (counts.get(value) || 0) + 1);
326
421
  return [...counts.entries()];
327
422
  };
328
- const entries = allEntries(zone, components, config);
423
+ const entries = allEntries(zone, components, config2);
329
424
  const facets = entries.flatMap((entry) => entry.facets);
330
425
  return {
331
426
  total: entries.length,
@@ -370,9 +465,9 @@ function initialState(editor, remembered) {
370
465
  return "closed";
371
466
  }
372
467
  var withoutField = (rows, name) => rows.map((row) => row.filter((field) => field?.name !== name)).filter((row) => row.length);
373
- function dropField4(layout, name) {
468
+ function dropField(layout, name) {
374
469
  if (!name || !layout?.components) return layout;
375
- return { ...layout, components: Object.fromEntries(Object.entries(layout.components).map(([uid, component]) => [uid, Array.isArray(component?.layouts?.edit) ? { ...component, layouts: { ...component.layouts, edit: withoutField(component.layouts.edit, name) } } : component])) };
470
+ return { ...layout, components: Object.fromEntries(Object.entries(layout.components).map(([uid, component]) => [uid, Array.isArray(component?.layout) ? { ...component, layout: withoutField(component.layout, name) } : component])) };
376
471
  }
377
472
  function humanize(name) {
378
473
  const text = String(name || "").replace(/[_\-\s]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").trim().split(" ").filter(Boolean).map((word) => /^[A-Z0-9]{2,}$/.test(word) && /[A-Z]/.test(word) ? word : word.toLowerCase()).join(" ");
@@ -403,23 +498,33 @@ function fieldText(fields, owner, name, label, locale, on) {
403
498
  }
404
499
  return Object.keys(out).length ? out : null;
405
500
  }
501
+ function layoutType(layout, types = {}) {
502
+ const names = (layout?.layout || []).flat(2).map((field) => field?.name);
503
+ const found = Object.entries(types || {}).filter(([, [displayName, ...attributes]]) => displayName === layout?.settings?.displayName && names.every((name) => attributes.includes(name)));
504
+ return found.length === 1 ? found[0][0] : found.length ? false : null;
505
+ }
406
506
  var labelsOff = (catalog) => !catalog?.editor?.enabled || !catalog.editor.friendlyLabels && !Object.keys(catalog.fields || {}).length;
407
507
  var withHelp = (description, help) => description ? `${description} ${help}` : help;
408
- function labelEditLayout4(layout, catalog, locale) {
409
- const uid = layout?.contentType?.uid;
410
- if (labelsOff(catalog) || !uid || catalog.contentTypes?.[uid]?.enabled === false) return layout;
508
+ function labelEditLayout(layout, catalog, locale, helpAction2) {
509
+ if (labelsOff(catalog) || !Array.isArray(layout?.layout) || !layout.layout.length) return layout;
510
+ const uid = layoutType(layout, catalog.types);
511
+ if (uid === false || uid && catalog.contentTypes?.[uid]?.enabled === false) return layout;
411
512
  const fix = (owner) => (field) => {
412
- const text = field?.metadatas && fieldText(catalog.fields, owner, field.name, field.metadatas.label, locale, catalog.editor.friendlyLabels);
513
+ const text = field && fieldText(catalog.fields, owner, field.name, field.label, locale, catalog.editor.friendlyLabels);
413
514
  if (!text) return field;
414
- const { help, ...rest } = text;
415
- const metadatas = { ...field.metadatas, ...rest };
416
- return { ...field, metadatas: help === void 0 ? metadatas : { ...metadatas, description: withHelp(metadatas.description, help) } };
515
+ const { description, help, ...rest } = text;
516
+ const hint = description ?? field.hint;
517
+ return {
518
+ ...field,
519
+ ...rest,
520
+ ...description !== void 0 && { hint },
521
+ ...help !== void 0 && (helpAction2 ? { labelAction: helpAction2(help, field.labelAction) } : { hint: withHelp(hint, help) })
522
+ };
417
523
  };
418
- const rows = (target, owner) => Array.isArray(target?.layouts?.edit) ? { ...target, layouts: { ...target.layouts, edit: target.layouts.edit.map((row) => row.map(fix(owner))) } } : target;
419
524
  return {
420
525
  ...layout,
421
- contentType: rows(layout.contentType, uid),
422
- components: Object.fromEntries(Object.entries(layout.components || {}).map(([cuid, component]) => [cuid, rows(component, cuid)]))
526
+ layout: layout.layout.map((panel) => panel.map((row) => row.map(fix(uid)))),
527
+ components: Object.fromEntries(Object.entries(layout.components || {}).map(([cuid, component]) => [cuid, Array.isArray(component?.layout) ? { ...component, layout: component.layout.map((row) => row.map(fix(cuid))) } : component]))
423
528
  };
424
529
  }
425
530
 
@@ -573,18 +678,18 @@ var stageBackground = (theme) => {
573
678
 
574
679
  // admin/accordions.mjs
575
680
  function zoneLists(root = document) {
576
- return [...root.querySelectorAll("ol[aria-describedby]")].filter((list) => list.querySelector(":scope > li button[aria-expanded]"));
681
+ return [...root.querySelectorAll("ol[aria-describedby]")].filter((list2) => list2.querySelector(":scope > li button[aria-expanded]"));
577
682
  }
578
683
  function findZoneList(label, root = document) {
579
684
  const lists = zoneLists(root);
580
- const text = (list) => (list.parentElement?.textContent || "").trim().toLocaleLowerCase();
581
- return lists.find((list) => text(list).startsWith(String(label).toLocaleLowerCase())) || (lists.length === 1 ? lists[0] : null);
685
+ const text = (list2) => (list2.parentElement?.textContent || "").trim().toLocaleLowerCase();
686
+ return lists.find((list2) => text(list2).startsWith(String(label).toLocaleLowerCase())) || (lists.length === 1 ? lists[0] : null);
582
687
  }
583
- function toggles(list) {
584
- return [...list.querySelectorAll(":scope > li")].map((item) => item.querySelector("button[aria-expanded]")).filter(Boolean);
688
+ function toggles(list2) {
689
+ return [...list2.querySelectorAll(":scope > li")].map((item) => item.querySelector("button[aria-expanded]")).filter(Boolean);
585
690
  }
586
691
  var FOLDED = "data-blockscene-folded";
587
- var shownToggles = (list) => toggles(list).filter((button) => !button.closest(`li[${FOLDED}]`));
692
+ var shownToggles = (list2) => toggles(list2).filter((button) => !button.closest(`li[${FOLDED}]`));
588
693
  function planRows(rects, view, margin = 0) {
589
694
  const now = [], later = [];
590
695
  const gap = (r) => Math.max(view.top - margin - r.bottom, r.top - view.bottom - margin, 0);
@@ -607,9 +712,9 @@ function stopAll() {
607
712
  var PER_FRAME = 3;
608
713
  var idle = (run) => typeof requestIdleCallback === "function" ? requestIdleCallback(run, { timeout: 300 }) : setTimeout(() => run({ timeRemaining: () => 8 }), 16);
609
714
  var frame = (run) => typeof requestAnimationFrame === "function" ? requestAnimationFrame(run) : setTimeout(run, 16);
610
- function setAll(list, open, batch = (run) => run()) {
611
- jobs.get(list)?.();
612
- jobs.delete(list);
715
+ function setAll(list2, open, batch = (run) => run()) {
716
+ jobs.get(list2)?.();
717
+ jobs.delete(list2);
613
718
  const header = (li) => li.querySelector("button[aria-expanded]");
614
719
  const differs = (li) => {
615
720
  const b = li.isConnected && header(li);
@@ -622,9 +727,9 @@ function setAll(list, open, batch = (run) => run()) {
622
727
  });
623
728
  return buttons.length;
624
729
  };
625
- const rows = [...list.querySelectorAll(":scope > li")].filter((li) => !li.hasAttribute(FOLDED) && differs(li));
730
+ const rows = [...list2.querySelectorAll(":scope > li")].filter((li) => !li.hasAttribute(FOLDED) && differs(li));
626
731
  if (!rows.length) return 0;
627
- const root = scroller(list);
732
+ const root = scroller(list2);
628
733
  const view = () => root ? root.getBoundingClientRect() : { top: 0, bottom: window.innerHeight };
629
734
  const height = view().bottom - view().top;
630
735
  const { now, later } = planRows(rows.map((li) => li.getBoundingClientRect()), view(), open ? height : 0);
@@ -655,7 +760,7 @@ function setAll(list, open, batch = (run) => run()) {
655
760
  if (queue.size && !handle && !stopped) handle = frame(flush);
656
761
  }, { root, rootMargin: `${Math.round(height)}px 0px` });
657
762
  later.forEach((i) => observer.observe(rows[i]));
658
- jobs.set(list, () => {
763
+ jobs.set(list2, () => {
659
764
  stopped = true;
660
765
  observer.disconnect();
661
766
  });
@@ -669,10 +774,10 @@ function setAll(list, open, batch = (run) => run()) {
669
774
  if (stopped) return;
670
775
  click(pending2.splice(0, deadline.timeRemaining() > 10 ? PER_FRAME : 1));
671
776
  if (pending2.length) idle(slice);
672
- else jobs.delete(list);
777
+ else jobs.delete(list2);
673
778
  };
674
779
  idle(slice);
675
- jobs.set(list, () => {
780
+ jobs.set(list2, () => {
676
781
  stopped = true;
677
782
  });
678
783
  return changed;
@@ -4133,9 +4238,9 @@ function useAnchors(zones, onOpen) {
4133
4238
  sync.current = () => {
4134
4239
  const next = [];
4135
4240
  for (const zone of latest.current) {
4136
- const list = zone.uids?.length ? findZoneList(zone.label) : null;
4137
- if (!list) continue;
4138
- toggles(list).forEach((button, index) => {
4241
+ const list2 = zone.uids?.length ? findZoneList(zone.label) : null;
4242
+ if (!list2) continue;
4243
+ toggles(list2).forEach((button, index) => {
4139
4244
  const uid = zone.uids[index];
4140
4245
  if (!uid) return;
4141
4246
  let el = button.querySelector(
@@ -4195,7 +4300,7 @@ function useAnchors(zones, onOpen) {
4195
4300
  }, []);
4196
4301
  return anchors;
4197
4302
  }
4198
- function RowPreviews({ zones, components, catalog, Modal: Modal2 }) {
4303
+ function RowPreviews({ zones, components, catalog, Modal: Modal3 }) {
4199
4304
  const t = useMessages();
4200
4305
  const [resolved, setResolved] = React2.useState({});
4201
4306
  const [open, setOpen] = React2.useState(null);
@@ -4244,7 +4349,7 @@ function RowPreviews({ zones, components, catalog, Modal: Modal2 }) {
4244
4349
  )
4245
4350
  ),
4246
4351
  open && srcOf(open) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4247
- Modal2,
4352
+ Modal3,
4248
4353
  {
4249
4354
  open: true,
4250
4355
  onOpenChange: (value) => {
@@ -4315,9 +4420,52 @@ function cloneRow(row, components, { relation } = {}) {
4315
4420
  };
4316
4421
  return walk(row, components?.[row?.__component], []);
4317
4422
  }
4318
- function integerKeys(rows, n) {
4319
- const max = Math.max(-1, ...rows.map((row) => Number(row?.__temp_key__)).filter(Number.isFinite));
4320
- return Array.from({ length: n }, (_, i) => max + 1 + i);
4423
+ function relationSlots(row, components) {
4424
+ const slots = [];
4425
+ const walk = (value, uid, path) => {
4426
+ const schema = components?.[uid];
4427
+ if (!value || !schema) return;
4428
+ for (const [key, attr] of Object.entries(schema.attributes || {})) {
4429
+ if (attr?.type === "relation" && value.id != null)
4430
+ slots.push({ path: [...path, key].join("."), uid, id: value.id, field: key, target: attr.targetModel || attr.target });
4431
+ else if (attr?.type === "component" && value[key]) {
4432
+ if (attr.repeatable) (Array.isArray(value[key]) ? value[key] : []).forEach((entry, i) => walk(entry, attr.component, [...path, key, i]));
4433
+ else walk(value[key], attr.component, [...path, key]);
4434
+ }
4435
+ }
4436
+ };
4437
+ walk(row, row?.__component, []);
4438
+ return slots;
4439
+ }
4440
+ var plain = (r) => ({ id: r.id ?? r.apiData?.id, documentId: r.documentId ?? r.apiData?.documentId, locale: r.locale ?? r.apiData?.locale ?? null, status: r.status });
4441
+ function currentRelations(server, value) {
4442
+ const gone = new Set((value?.disconnect || []).map((r) => plain(r).id));
4443
+ const out = (server || []).map(plain).filter((r) => !gone.has(r.id));
4444
+ for (const r of (value?.connect || []).map(plain)) if (!out.some((o) => o.id === r.id)) out.push(r);
4445
+ return out;
4446
+ }
4447
+ function toConnect(relations, target) {
4448
+ const keys = relations.length ? (0, import_fractional_indexing2.generateNKeysBetween)(null, null, relations.length) : [];
4449
+ return {
4450
+ connect: relations.map((r, i) => ({
4451
+ id: r.id,
4452
+ apiData: { id: r.id, documentId: r.documentId, locale: r.locale, isTemporary: true },
4453
+ status: r.status,
4454
+ label: r.label ?? r.documentId,
4455
+ href: `../collection-types/${target}/${r.documentId}${r.locale ? `?plugins[i18n][locale]=${r.locale}` : ""}`,
4456
+ __temp_key__: keys[i]
4457
+ })),
4458
+ disconnect: []
4459
+ };
4460
+ }
4461
+ function fractionalKeys(rows, at, n) {
4462
+ const key = (row) => typeof row?.__temp_key__ === "string" ? row.__temp_key__ : null;
4463
+ try {
4464
+ return (0, import_fractional_indexing2.generateNKeysBetween)(key(rows[at - 1]), key(rows[at]), n);
4465
+ } catch {
4466
+ const max = rows.map(key).filter(Boolean).sort().pop() ?? null;
4467
+ return (0, import_fractional_indexing2.generateNKeysBetween)(max, null, n);
4468
+ }
4321
4469
  }
4322
4470
  var insertRows = (rows, at, items2, keys) => [
4323
4471
  ...rows.slice(0, at),
@@ -4384,13 +4532,13 @@ function movedRow(prev, next, actor) {
4384
4532
  if (i === n) return null;
4385
4533
  let j = n - 1;
4386
4534
  while (k[j] === m[j]) j--;
4387
- const same = (a, b) => (0, import_groups2.blockKey)(a) === (0, import_groups2.blockKey)(b) || a?.id == null && b?.id == null && a?.__component === b?.__component;
4535
+ const same2 = (a, b) => (0, import_groups2.blockKey)(a) === (0, import_groups2.blockKey)(b) || a?.id == null && b?.id == null && a?.__component === b?.__component;
4388
4536
  const shifted = (from, to, by) => {
4389
4537
  for (let x = from; x <= to; x++) if (m[x] !== k[x + by]) return false;
4390
4538
  return true;
4391
4539
  };
4392
- const down = same(prev[i], next[j]) && shifted(i, j - 1, 1);
4393
- const up = same(prev[j], next[i]) && shifted(i + 1, j, -1);
4540
+ const down = same2(prev[i], next[j]) && shifted(i, j - 1, 1);
4541
+ const up = same2(prev[j], next[i]) && shifted(i + 1, j, -1);
4394
4542
  if (down && up) return actor === k[i] ? { from: i, to: j } : actor === k[j] ? { from: j, to: i } : null;
4395
4543
  return down ? { from: i, to: j } : up ? { from: j, to: i } : null;
4396
4544
  }
@@ -4757,7 +4905,7 @@ var set = (el, name, value) => {
4757
4905
  if (value === null) el.hasAttribute(name) && el.removeAttribute(name);
4758
4906
  else if (el.getAttribute(name) !== value) el.setAttribute(name, value);
4759
4907
  };
4760
- var items = (list) => [...list.querySelectorAll(":scope > li")];
4908
+ var items = (list2) => [...list2.querySelectorAll(":scope > li")];
4761
4909
  var Fold = import_styled_components3.default.span`
4762
4910
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 28px; height: 28px; margin-left: 8px;
4763
4911
  border-radius: 4px; cursor: pointer; color: ${({ theme }) => theme.colors.primary600};
@@ -4812,8 +4960,8 @@ function GroupRows({ zones, form, groups, docKey, labelOf, layouts = null, compo
4812
4960
  const li = !target?.closest?.(`[${GRID_BOX}]`) && target?.closest?.("ol[aria-describedby] > li");
4813
4961
  if (!li) return null;
4814
4962
  for (const zone of latest.current.zones) {
4815
- const list2 = findZoneList(zone.label);
4816
- if (li.parentElement === list2) return blockKey(latest.current.form.rows(zone.name)[items(list2).indexOf(li)]) || null;
4963
+ const list3 = findZoneList(zone.label);
4964
+ if (li.parentElement === list3) return blockKey(latest.current.form.rows(zone.name)[items(list3).indexOf(li)]) || null;
4817
4965
  }
4818
4966
  return null;
4819
4967
  };
@@ -4843,8 +4991,8 @@ function GroupRows({ zones, form, groups, docKey, labelOf, layouts = null, compo
4843
4991
  const { zones: zones2, form: form2, docKey: docKey2, labelOf: labelOf2, layouts: layouts2 } = latest.current;
4844
4992
  if (dragging.current) {
4845
4993
  const placeholder = zones2.some((zone) => {
4846
- const list2 = findZoneList(zone.label);
4847
- return list2 && items(list2).some((li) => !li.querySelector("button[aria-expanded]"));
4994
+ const list3 = findZoneList(zone.label);
4995
+ return list3 && items(list3).some((li) => !li.querySelector("button[aria-expanded]"));
4848
4996
  });
4849
4997
  if (placeholder) previewed.current = true;
4850
4998
  else if (previewed.current) end();
@@ -4854,10 +5002,10 @@ function GroupRows({ zones, form, groups, docKey, labelOf, layouts = null, compo
4854
5002
  const seen = /* @__PURE__ */ new Set();
4855
5003
  if (on)
4856
5004
  for (const zone of zones2) {
4857
- const list2 = zone.count ? findZoneList(zone.label) : null;
5005
+ const list3 = zone.count ? findZoneList(zone.label) : null;
4858
5006
  const rows = form2.rows(zone.name);
4859
- const lis = list2 ? items(list2) : [];
4860
- if (!list2 || lis.length !== rows.length) continue;
5007
+ const lis = list3 ? items(list3) : [];
5008
+ if (!list3 || lis.length !== rows.length) continue;
4861
5009
  const outline = groupOutline(rows, groups);
4862
5010
  const idOf = (i) => `${docKey2}|${zone.name}|${blockKey(rows[i])}`;
4863
5011
  const unfold = [...form2.errorRows?.(zone.name) || []];
@@ -4936,16 +5084,16 @@ function GroupRows({ zones, form, groups, docKey, labelOf, layouts = null, compo
4936
5084
  sync.current();
4937
5085
  };
4938
5086
  const line = theme?.colors?.primary600 || "#4945ff";
4939
- const list = "ol[aria-describedby] > li";
5087
+ const list2 = "ol[aria-describedby] > li";
4940
5088
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
4941
5089
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("style", { children: `
4942
- ${list}[${DEPTH}] { padding-left: calc(var(--bs-depth) * ${STEP}); background: repeating-linear-gradient(to right, ${line} 0 2px, transparent 2px ${STEP}) 1.1rem 0 / calc(var(--bs-depth) * ${STEP}) 100% no-repeat; }
4943
- ${list}[${FOLDED}]:not([data-bp-block-modal]) { display: none !important; }
4944
- ${list}[data-bp-block-modal] { padding-left: 0 !important; background-image: none !important; }
4945
- ${list}[${KIND}="close"] [data-handler-id] { display: none !important; }
4946
- ${list}[${KIND}="close"] button[aria-expanded]:first-of-type { min-height: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; opacity: 0.7; }
4947
- ${list}[${KIND}="close"] button[aria-expanded]:first-of-type + * { padding-top: 0 !important; padding-bottom: 0 !important; }
4948
- ${list}[${KIND}="close"] button[aria-expanded] [data-blockscene-row-thumb] { display: none; }` }),
5090
+ ${list2}[${DEPTH}] { padding-left: calc(var(--bs-depth) * ${STEP}); background: repeating-linear-gradient(to right, ${line} 0 2px, transparent 2px ${STEP}) 1.1rem 0 / calc(var(--bs-depth) * ${STEP}) 100% no-repeat; }
5091
+ ${list2}[${FOLDED}]:not([data-bp-block-modal]) { display: none !important; }
5092
+ ${list2}[data-bp-block-modal] { padding-left: 0 !important; background-image: none !important; }
5093
+ ${list2}[${KIND}="close"] [data-handler-id] { display: none !important; }
5094
+ ${list2}[${KIND}="close"] button[aria-expanded]:first-of-type { min-height: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; opacity: 0.7; }
5095
+ ${list2}[${KIND}="close"] button[aria-expanded]:first-of-type + * { padding-top: 0 !important; padding-bottom: 0 !important; }
5096
+ ${list2}[${KIND}="close"] button[aria-expanded] [data-blockscene-row-thumb] { display: none; }` }),
4949
5097
  anchors.map(
4950
5098
  (a) => (0, import_react_dom2.createPortal)(
4951
5099
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -5092,9 +5240,9 @@ function useAnchors2(zones, enabled, selecting) {
5092
5240
  const next = [];
5093
5241
  if (enabled)
5094
5242
  for (const zone of latest.current.zones) {
5095
- const list = zone.count ? findZoneList(zone.label) : null;
5096
- if (!list) continue;
5097
- toggles(list).forEach((toggle, index) => {
5243
+ const list2 = zone.count ? findZoneList(zone.label) : null;
5244
+ if (!list2) continue;
5245
+ toggles(list2).forEach((toggle, index) => {
5098
5246
  const trash = trashOf(toggle);
5099
5247
  if (!trash || index >= zone.count) return;
5100
5248
  const holder = trash.parentElement !== actionsOf(toggle) && trash.parentElement?.children.length === 1 ? trash.parentElement : trash;
@@ -5219,7 +5367,7 @@ var HiddenBadge = import_styled_components4.default.span`
5219
5367
  text-transform: uppercase; letter-spacing: 0.04em;
5220
5368
  color: ${({ theme }) => theme.colors.warning700}; background: ${({ theme }) => theme.colors.warning100};
5221
5369
  `;
5222
- function RowActions({ zones, actions, Modal: Modal2 }) {
5370
+ function RowActions({ zones, actions, Modal: Modal3 }) {
5223
5371
  const a = actions;
5224
5372
  const e = a?.editor || {};
5225
5373
  const anchors = useAnchors2(zones, Boolean(a) && Boolean(a.hiddenName || e.duplicate !== false || e.clipboard !== false || a.selection), a?.selection?.zone || null);
@@ -5233,9 +5381,9 @@ function RowActions({ zones, actions, Modal: Modal2 }) {
5233
5381
  const button = event.target?.closest?.("button");
5234
5382
  if (!button || bypass.current) return;
5235
5383
  for (const zone of latest.current.zones) {
5236
- const list = findZoneList(zone.label);
5237
- if (!list?.contains(button)) continue;
5238
- const headers = toggles(list);
5384
+ const list2 = findZoneList(zone.label);
5385
+ if (!list2?.contains(button)) continue;
5386
+ const headers = toggles(list2);
5239
5387
  const index = headers.findIndex((toggle) => trashOf(toggle) === button);
5240
5388
  if (index < 0) return;
5241
5389
  event.preventDefault();
@@ -5348,7 +5496,7 @@ ol[aria-describedby] > li button[data-strapi-accordion-toggle] > span:last-child
5348
5496
  `${zone}:${index}`
5349
5497
  );
5350
5498
  }),
5351
- confirm && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Modal2, { open: true, width: "48rem", onOpenChange: (open) => !open && setConfirm(null), trigger: null, title: t.confirmDeleteTitle, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_design_system.Flex, { direction: "column", alignItems: "stretch", gap: 4, "data-testid": "row-confirm-delete", children: [
5499
+ confirm && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Modal3, { open: true, width: "48rem", onOpenChange: (open) => !open && setConfirm(null), trigger: null, title: t.confirmDeleteTitle, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_design_system.Flex, { direction: "column", alignItems: "stretch", gap: 4, "data-testid": "row-confirm-delete", children: [
5352
5500
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system.Typography, { children: t.f("confirmDelete", { name: confirm.label }) }),
5353
5501
  confirm.marker && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system.Typography, { variant: "pi", textColor: "neutral600", children: t.confirmDeleteMarker }),
5354
5502
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_design_system.Flex, { gap: 2, justifyContent: "flex-end", children: [
@@ -5740,7 +5888,7 @@ var readCollapsed = () => {
5740
5888
  };
5741
5889
  var TYPE_ICONS2 = { hero: "hero", text: "text", media: "image", listing: "list", cards: "cards", cta: "link", form: "form", layout: "layout" };
5742
5890
  var FILTER_MENUS = ["tags", "media", "content"];
5743
- var toggled = (list, value) => list.includes(value) ? list.filter((item) => item !== value) : [...list, value];
5891
+ var toggled = (list2, value) => list2.includes(value) ? list2.filter((item) => item !== value) : [...list2, value];
5744
5892
  function FilterMenu({ name, label, options, picked, onChange, labelOf }) {
5745
5893
  const [open, setOpen] = React6.useState(false);
5746
5894
  const ref = React6.useRef(null);
@@ -5970,10 +6118,10 @@ var flip = (panel, scrim, card, back) => {
5970
6118
  return panel.animate(back ? frames.reverse() : frames, timing);
5971
6119
  };
5972
6120
  var newChannel = () => crypto.randomUUID?.() || `${Date.now()}-${Math.random().toString(36).slice(2)}`;
5973
- function useLiveSource(entry, config, get, contentType, locale, variant) {
5974
- const editor = config?.editor || {};
6121
+ function useLiveSource(entry, config2, get, contentType, locale, variant) {
6122
+ const editor = config2?.editor || {};
5975
6123
  const [native, setNative] = React6.useState(null);
5976
- const plain = editor.blockPreviewUrl ? blockPreviewSrc(editor.blockPreviewUrl, entry.uid, { variant, locale: locale || "" }) : null;
6124
+ const plain2 = editor.blockPreviewUrl ? blockPreviewSrc(editor.blockPreviewUrl, entry.uid, { variant, locale: locale || "" }) : null;
5977
6125
  React6.useEffect(() => {
5978
6126
  if (editor.blockPreviewUrl || editor.previewUrl || !contentType || !get) return;
5979
6127
  let active = true;
@@ -5986,7 +6134,7 @@ function useLiveSource(entry, config, get, contentType, locale, variant) {
5986
6134
  };
5987
6135
  }, [editor.blockPreviewUrl, editor.previewUrl, contentType, locale, get]);
5988
6136
  const channel = React6.useMemo(newChannel, []);
5989
- if (editor.blockPreviewUrl) return plain ? { kind: "plain", src: plain, origin: "", channel } : null;
6137
+ if (editor.blockPreviewUrl) return plain2 ? { kind: "plain", src: plain2, origin: "", channel } : null;
5990
6138
  const base = editor.previewUrl || native;
5991
6139
  if (!base) return null;
5992
6140
  try {
@@ -5998,7 +6146,7 @@ function useLiveSource(entry, config, get, contentType, locale, variant) {
5998
6146
  }
5999
6147
  }
6000
6148
  var LIVE_TIMEOUT = 8e3;
6001
- function Magnify({ entry, palette, config, components, get, contentType, locale, starred, onStar, onInsert, onClose, cardOf }) {
6149
+ function Magnify({ entry, palette, config: config2, components, get, contentType, locale, starred, onStar, onInsert, onClose, cardOf }) {
6002
6150
  const t = useMessages();
6003
6151
  const panel = React6.useRef(null);
6004
6152
  const scrim = React6.useRef(null);
@@ -6012,7 +6160,7 @@ function Magnify({ entry, palette, config, components, get, contentType, locale,
6012
6160
  const [state, setState] = React6.useState("loading");
6013
6161
  const [variantId, setVariantId] = React6.useState(entry.variants[0]?.id);
6014
6162
  const variant = entry.variants.find((item) => item.id === variantId);
6015
- const live = useLiveSource(entry, config, get, contentType, locale, variantId);
6163
+ const live = useLiveSource(entry, config2, get, contentType, locale, variantId);
6016
6164
  const send = () => {
6017
6165
  let blocks = [];
6018
6166
  try {
@@ -6157,7 +6305,7 @@ function PickerModal({
6157
6305
  open,
6158
6306
  onOpenChange,
6159
6307
  onSelect,
6160
- Modal: Modal2,
6308
+ Modal: Modal3,
6161
6309
  Toggle,
6162
6310
  get,
6163
6311
  put,
@@ -6169,7 +6317,7 @@ function PickerModal({
6169
6317
  {
6170
6318
  zone,
6171
6319
  components,
6172
- Modal: Modal2,
6320
+ Modal: Modal3,
6173
6321
  Toggle,
6174
6322
  get,
6175
6323
  put,
@@ -6184,7 +6332,7 @@ function ZoneGallery({
6184
6332
  zone,
6185
6333
  components,
6186
6334
  add,
6187
- Modal: Modal2,
6335
+ Modal: Modal3,
6188
6336
  Toggle,
6189
6337
  get,
6190
6338
  put,
@@ -6198,7 +6346,7 @@ function ZoneGallery({
6198
6346
  const [ownOpen, setOwnOpen] = React6.useState(false);
6199
6347
  const open = controlled ? controlled.open : ownOpen;
6200
6348
  const setOpen = controlled ? controlled.onOpenChange : setOwnOpen;
6201
- const [query, setQuery] = React6.useState("");
6349
+ const [query2, setQuery] = React6.useState("");
6202
6350
  const [view, setView] = React6.useState("all");
6203
6351
  const [picked, setPicked] = React6.useState(NO_FILTERS);
6204
6352
  const [detail, setDetail] = React6.useState(null);
@@ -6206,7 +6354,7 @@ function ZoneGallery({
6206
6354
  const [prefs, setPrefs] = React6.useState({ starred: [], recent: [] });
6207
6355
  const [showFields, setShowFields] = React6.useState(readShowFields);
6208
6356
  const [columns, setColumns] = React6.useState(readColumns);
6209
- const [config, setConfig] = React6.useState(null);
6357
+ const [config2, setConfig] = React6.useState(null);
6210
6358
  const [error, setError] = React6.useState("");
6211
6359
  React6.useEffect(() => {
6212
6360
  if (controlled) return;
@@ -6245,18 +6393,18 @@ function ZoneGallery({
6245
6393
  });
6246
6394
  };
6247
6395
  const star = (uid) => savePrefs({ ...prefs, starred: toggled(prefs.starred, uid) });
6248
- const options = config ? optionsFor(zone, components, config) : null;
6249
- const inZone = (list) => options ? list.filter((uid) => options.uids.includes(uid)) : [];
6396
+ const options = config2 ? optionsFor(zone, components, config2) : null;
6397
+ const inZone = (list2) => options ? list2.filter((uid) => options.uids.includes(uid)) : [];
6250
6398
  const filter = {
6251
6399
  ...picked,
6252
6400
  typology: TYPOLOGIES.includes(view) ? view : void 0,
6253
6401
  uids: view === "recent" ? prefs.recent : view === "starred" ? prefs.starred : void 0
6254
6402
  };
6255
- let entries = config ? entriesFor(zone, components, config, query, filter) : [];
6403
+ let entries = config2 ? entriesFor(zone, components, config2, query2, filter) : [];
6256
6404
  if (view === "recent") entries = [...entries].sort((a, b) => prefs.recent.indexOf(a.uid) - prefs.recent.indexOf(b.uid));
6257
6405
  const chosen = entries.find((entry) => entry.uid === detail);
6258
6406
  const chips = FILTER_MENUS.flatMap((menu) => picked[menu].map((value) => ({ menu, value })));
6259
- const filtering = query.trim() !== "" || view !== "all" || chips.length > 0;
6407
+ const filtering = query2.trim() !== "" || view !== "all" || chips.length > 0;
6260
6408
  const reset = () => {
6261
6409
  setQuery("");
6262
6410
  setView("all");
@@ -6309,7 +6457,7 @@ function ZoneGallery({
6309
6457
  key
6310
6458
  );
6311
6459
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
6312
- Modal2,
6460
+ Modal3,
6313
6461
  {
6314
6462
  open,
6315
6463
  onOpenChange: setOpen,
@@ -6354,7 +6502,7 @@ function ZoneGallery({
6354
6502
  import_design_system2.Searchbar,
6355
6503
  {
6356
6504
  name: `block-search-${zone.name}`,
6357
- value: query,
6505
+ value: query2,
6358
6506
  placeholder: t.search,
6359
6507
  clearLabel: t.clear,
6360
6508
  onClear: () => setQuery(""),
@@ -6419,7 +6567,7 @@ function ZoneGallery({
6419
6567
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system2.Button, { variant: "tertiary", size: "S", onClick: () => setPicked(NO_FILTERS), "data-testid": "gallery-clear-all", children: t.clearAll })
6420
6568
  ] }),
6421
6569
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system2.Typography, { variant: "pi", textColor: "neutral600", children: t.example }),
6422
- error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system2.Typography, { role: "alert", textColor: "danger600", children: error }) : !config ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system2.Typography, { children: t.loading }) : entries.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ref: grid, style: { position: "relative", flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
6570
+ error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system2.Typography, { role: "alert", textColor: "danger600", children: error }) : !config2 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system2.Typography, { children: t.loading }) : entries.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ref: grid, style: { position: "relative", flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
6423
6571
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
6424
6572
  import_design_system2.Flex,
6425
6573
  {
@@ -6434,7 +6582,7 @@ function ZoneGallery({
6434
6582
  Card,
6435
6583
  {
6436
6584
  entry,
6437
- palette: config.palette,
6585
+ palette: config2.palette,
6438
6586
  showFields,
6439
6587
  starred: prefs.starred.includes(entry.uid),
6440
6588
  active: detail === entry.uid,
@@ -6451,8 +6599,8 @@ function ZoneGallery({
6451
6599
  Magnify,
6452
6600
  {
6453
6601
  entry: chosen,
6454
- palette: config.palette,
6455
- config,
6602
+ palette: config2.palette,
6603
+ config: config2,
6456
6604
  components,
6457
6605
  get,
6458
6606
  contentType,
@@ -6516,14 +6664,14 @@ function useInitialAccordions({
6516
6664
  const timer = setInterval(() => {
6517
6665
  const pending2 = latest.current.filter((zone) => zone.count > 0);
6518
6666
  const ready = pending2.length > 0 && pending2.every((zone) => {
6519
- const list = findZoneList(zone.label);
6520
- return list && toggles(list).length >= zone.count;
6667
+ const list2 = findZoneList(zone.label);
6668
+ return list2 && toggles(list2).length >= zone.count;
6521
6669
  }) && (editor.initialState !== "remember" || user.current);
6522
6670
  if (!ready && ++tries < 25) return;
6523
6671
  stop();
6524
6672
  for (const zone of pending2) {
6525
- const list = findZoneList(zone.label);
6526
- if (!list) continue;
6673
+ const list2 = findZoneList(zone.label);
6674
+ if (!list2) continue;
6527
6675
  const key = memoryKey({
6528
6676
  base: memoryBase(),
6529
6677
  userId: user.current,
@@ -6531,7 +6679,7 @@ function useInitialAccordions({
6531
6679
  zone: zone.name
6532
6680
  });
6533
6681
  setAll(
6534
- list,
6682
+ list2,
6535
6683
  initialState(editor, readMemory(storage2(), key)) === "open",
6536
6684
  import_react_dom4.unstable_batchedUpdates
6537
6685
  );
@@ -6550,8 +6698,8 @@ function useZoneAnchor(zone, enabled) {
6550
6698
  const sync = () => {
6551
6699
  let host = null, after = null;
6552
6700
  if (filled) {
6553
- const list = findZoneList(zone.label);
6554
- host = list && [...list.parentElement?.children || []].find((child) => child !== list && child.textContent?.trim()) || null;
6701
+ const list2 = findZoneList(zone.label);
6702
+ host = list2 && [...list2.parentElement?.children || []].find((child) => child !== list2 && child.textContent?.trim()) || null;
6555
6703
  } else {
6556
6704
  after = [...document.querySelectorAll("button")].find((button) => isNativeAddButton(button, zone)) || null;
6557
6705
  host = after?.parentElement || null;
@@ -6591,16 +6739,16 @@ function useRowStates(zone, enabled) {
6591
6739
  React6.useEffect(() => {
6592
6740
  if (!enabled) return;
6593
6741
  let frame2 = 0;
6594
- const read2 = () => {
6742
+ const read3 = () => {
6595
6743
  frame2 = 0;
6596
- const list = findZoneList(zone.label);
6597
- const values = list ? shownToggles(list).map((button) => button.getAttribute("aria-expanded") === "true") : [];
6744
+ const list2 = findZoneList(zone.label);
6745
+ const values = list2 ? shownToggles(list2).map((button) => button.getAttribute("aria-expanded") === "true") : [];
6598
6746
  const closed = values.includes(false), open = values.includes(true);
6599
6747
  setState((prev) => prev.closed === closed && prev.open === open ? prev : { closed, open });
6600
6748
  };
6601
- read2();
6749
+ read3();
6602
6750
  const observer = new MutationObserver(() => {
6603
- if (!frame2) frame2 = requestAnimationFrame(read2);
6751
+ if (!frame2) frame2 = requestAnimationFrame(read3);
6604
6752
  });
6605
6753
  observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["aria-expanded", FOLDED] });
6606
6754
  return () => {
@@ -6620,8 +6768,8 @@ function ZoneControls({ zone, editor, contentType, userId, actions, extra, Menu:
6620
6768
  if (!anchor) return null;
6621
6769
  const toggle = toggleShown && accordionToggle(rows.closed, rows.open, editor);
6622
6770
  const apply = (open) => {
6623
- const list = findZoneList(zone.label);
6624
- if (list) setAll(list, open, import_react_dom4.unstable_batchedUpdates);
6771
+ const list2 = findZoneList(zone.label);
6772
+ if (list2) setAll(list2, open, import_react_dom4.unstable_batchedUpdates);
6625
6773
  writeMemory(
6626
6774
  storage2(),
6627
6775
  memoryKey({ base: memoryBase(), userId, contentType, zone: zone.name }),
@@ -6716,14 +6864,14 @@ var import_design_system4 = require("@strapi/design-system");
6716
6864
  // admin/pane.mjs
6717
6865
  var TOOLBAR = ["modes", "history", "devices", "status", "actions"];
6718
6866
  var RIGHT = ["status", "actions"];
6719
- function toolbarLayout(list) {
6720
- const ids = Array.isArray(list) ? list.filter((id, i) => TOOLBAR.includes(id) && list.indexOf(id) === i) : TOOLBAR;
6867
+ function toolbarLayout(list2) {
6868
+ const ids = Array.isArray(list2) ? list2.filter((id, i) => TOOLBAR.includes(id) && list2.indexOf(id) === i) : TOOLBAR;
6721
6869
  const at = ids.findIndex((id) => RIGHT.includes(id));
6722
6870
  return at < 0 ? { before: ids, right: [], after: [] } : { before: ids.slice(0, at), right: ids.filter((id) => RIGHT.includes(id)), after: ids.slice(at).filter((id) => !RIGHT.includes(id)) };
6723
6871
  }
6724
- function deviceEntries(list, devices) {
6725
- const valid = Array.isArray(list) && list.length > 0 && list.every((item) => item in devices || item && typeof item === "object" && typeof item.label === "string" && Number.isInteger(item.width) && item.width > 0);
6726
- return (valid ? list : Object.keys(devices)).map((item) => typeof item === "string" ? { id: item, name: item, width: devices[item], icon: item } : { id: `px-${item.width}`, label: item.label, width: item.width, icon: item.width < 600 ? "mobile" : item.width < 1100 ? "tablet" : "desktop" });
6872
+ function deviceEntries(list2, devices) {
6873
+ const valid = Array.isArray(list2) && list2.length > 0 && list2.every((item) => item in devices || item && typeof item === "object" && typeof item.label === "string" && Number.isInteger(item.width) && item.width > 0);
6874
+ return (valid ? list2 : Object.keys(devices)).map((item) => typeof item === "string" ? { id: item, name: item, width: devices[item], icon: item } : { id: `px-${item.width}`, label: item.label, width: item.width, icon: item.width < 600 ? "mobile" : item.width < 1100 ? "tablet" : "desktop" });
6727
6875
  }
6728
6876
  var panels = [];
6729
6877
  var PANEL_ID = /^[A-Za-z0-9][\w-]{0,39}$/;
@@ -7129,6 +7277,34 @@ function ZoneBarTools({ state }) {
7129
7277
  ) })
7130
7278
  ] });
7131
7279
  }
7280
+ function GroupDiagnostics({ scope, groups, problems }) {
7281
+ const t = useMessages();
7282
+ const insertClose = (error) => {
7283
+ const end = (0, import_groups.groupRange)(scope.latest.current, error.index, groups)[1];
7284
+ scope.insertRows(end + 1, { __component: error.expected });
7285
+ };
7286
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system4.Box, { role: "alert", "data-testid": "page-preview-diagnostics", padding: 2, background: "danger100", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { children: [
7287
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("summary", { style: { cursor: "pointer" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system4.Typography, { variant: "pi", fontWeight: "bold", textColor: "danger700", children: t.f("diagSummary", { count: problems.length }) }) }),
7288
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { style: { margin: "6px 0 0 16px", padding: 0 }, children: problems.map((error) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { style: { marginBottom: 8 }, children: [
7289
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system4.Typography, { variant: "pi", textColor: "neutral800", ...tagProps(scope.host.ds, "p"), children: t.f(
7290
+ error.code === "closeBeforeOpen" ? "diagCloseBeforeOpen" : error.code === "mismatch" ? "diagMismatch" : "diagUnclosed",
7291
+ { n: error.index + 1, uid: error.uid, open: error.open || "", expected: error.expected || "" }
7292
+ ) }),
7293
+ error.code === "unclosed" && scope.canEdit && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system4.Box, { paddingTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
7294
+ import_design_system4.Button,
7295
+ {
7296
+ size: "S",
7297
+ variant: "danger-light",
7298
+ "data-testid": `diag-insert-close-${error.index}`,
7299
+ onClick: () => insertClose(error),
7300
+ style: { height: "auto", minHeight: 32, whiteSpace: "normal", textAlign: "left", paddingTop: 6, paddingBottom: 6 },
7301
+ children: t.f("diagInsertClose", { n: error.index + 1, expected: error.expected })
7302
+ }
7303
+ ) }),
7304
+ error.code === "closeBeforeOpen" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system4.Typography, { variant: "pi", textColor: "neutral600", ...tagProps(scope.host.ds, "p"), style: { marginTop: 2 }, children: t.diagStrayHint })
7305
+ ] }, `${error.code}-${error.index}`)) })
7306
+ ] }) });
7307
+ }
7132
7308
  function PagePreview({
7133
7309
  editor,
7134
7310
  state,
@@ -7136,13 +7312,13 @@ function PagePreview({
7136
7312
  groups = null,
7137
7313
  hiddenAttribute = null,
7138
7314
  form = null,
7139
- Modal: Modal2,
7315
+ Modal: Modal3,
7140
7316
  Toggle
7141
7317
  }) {
7142
7318
  const t = useMessages();
7143
- const { values, zone, zoneLabel: zoneLabel2, canEdit, latest, insertRows: insertRows2 } = usePreviewZone(host);
7319
+ const { values, zone, zoneLabel, canEdit, latest, insertRows: insertRows2 } = usePreviewZone(host);
7144
7320
  const { history, mode, setMode, block: blockModal, setBlock: setBlockModal, inserting, setInserting } = state;
7145
- const { onChange, get, put, notify, MediaLibrary: MediaLibraryDialog, Actions, ds } = host;
7321
+ const { onChange, get, put, notify, MediaLibrary: MediaLibraryDialog, Actions: Actions2, ds } = host;
7146
7322
  const deviceList = deviceEntries(editor?.previewDevices, DEVICES);
7147
7323
  const [deviceId, setDeviceState] = React8.useState(() => read(DEVICE_KEY));
7148
7324
  const device = deviceList.find((entry) => entry.id === deviceId) || deviceList[0];
@@ -7218,7 +7394,7 @@ function PagePreview({
7218
7394
  const live = React8.useRef({
7219
7395
  mode,
7220
7396
  canEdit,
7221
- zoneLabel: zoneLabel2,
7397
+ zoneLabel,
7222
7398
  components: host.components,
7223
7399
  setMode,
7224
7400
  onChange,
@@ -7228,7 +7404,7 @@ function PagePreview({
7228
7404
  live.current = {
7229
7405
  mode,
7230
7406
  canEdit,
7231
- zoneLabel: zoneLabel2,
7407
+ zoneLabel,
7232
7408
  components: host.components,
7233
7409
  setMode,
7234
7410
  onChange,
@@ -7421,7 +7597,7 @@ function PagePreview({
7421
7597
  channel,
7422
7598
  type
7423
7599
  );
7424
- const { mode: mode2, canEdit: canEdit2, zoneLabel: zoneLabel3, components, setMode: setMode2, onChange: onChange2 } = live.current;
7600
+ const { mode: mode2, canEdit: canEdit2, zoneLabel: zoneLabel2, components, setMode: setMode2, onChange: onChange2 } = live.current;
7425
7601
  if (is("ready")) {
7426
7602
  clearTimeout(timeout);
7427
7603
  setReady(true);
@@ -7500,9 +7676,9 @@ function PagePreview({
7500
7676
  const uid = index >= 0 ? latest.current[index]?.__component : "";
7501
7677
  if (index < 0) return;
7502
7678
  if (is("select")) {
7503
- const list = findZoneList(zoneLabel3);
7504
- const item = list?.querySelectorAll(":scope > li")[index];
7505
- const header = list ? toggles(list)[index] : null;
7679
+ const list2 = findZoneList(zoneLabel2);
7680
+ const item = list2?.querySelectorAll(":scope > li")[index];
7681
+ const header = list2 ? toggles(list2)[index] : null;
7506
7682
  if (header?.getAttribute("aria-expanded") === "false") header.click();
7507
7683
  item?.scrollIntoView({ block: "center", behavior: "smooth" });
7508
7684
  if (item) {
@@ -7563,9 +7739,9 @@ function PagePreview({
7563
7739
  iframe.current?.contentWindow?.postMessage({ protocol: PROTOCOL, channel, type: "hover", key }, origin);
7564
7740
  };
7565
7741
  const onOver = (event) => {
7566
- const list = findZoneList(live.current.zoneLabel);
7742
+ const list2 = findZoneList(live.current.zoneLabel);
7567
7743
  const target = event.target;
7568
- const index = list?.contains(target) ? [...list.querySelectorAll(":scope > li")].findIndex((li) => li.contains(target)) : -1;
7744
+ const index = list2?.contains(target) ? [...list2.querySelectorAll(":scope > li")].findIndex((li) => li.contains(target)) : -1;
7569
7745
  post(index >= 0 ? blockKey(latest.current[index]) : null);
7570
7746
  };
7571
7747
  const onOut = (event) => {
@@ -7741,7 +7917,7 @@ ${/* Strapi 4's scrolled header is fixed to the viewport's right edge: beside th
7741
7917
  children: [
7742
7918
  !ready && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system4.Typography, { variant: "pi", role: "status", textColor: "neutral600", children: failed ? t.previewFailed : t.previewLoading }),
7743
7919
  failed && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system4.Button, { size: "S", variant: "secondary", onClick: retry, children: t.retry }),
7744
- layout.right.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Actions, { parts: layout.right })
7920
+ layout.right.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Actions2, { parts: layout.right })
7745
7921
  ]
7746
7922
  }
7747
7923
  ),
@@ -7820,7 +7996,7 @@ ${/* Strapi 4's scrolled header is fixed to the viewport's right edge: beside th
7820
7996
  max: insertAttr.max
7821
7997
  },
7822
7998
  components: host.components,
7823
- Modal: Modal2,
7999
+ Modal: Modal3,
7824
8000
  Toggle,
7825
8001
  get,
7826
8002
  put,
@@ -7981,11 +8157,430 @@ ${/* Strapi 4's scrolled header is fixed to the viewport's right edge: beside th
7981
8157
  );
7982
8158
  }
7983
8159
 
7984
- // admin/Settings.tsx
8160
+ // admin/host5.tsx
7985
8161
  var React9 = __toESM(require("react"));
7986
8162
  var import_design_system5 = require("@strapi/design-system");
7987
- var import_styled_components7 = __toESM(require("styled-components"));
8163
+ var import_react_intl2 = require("react-intl");
8164
+ var import_admin = require("@strapi/strapi/admin");
8165
+ var import_strapi_admin = require("@strapi/content-manager/strapi-admin");
7988
8166
  var import_jsx_runtime10 = require("react/jsx-runtime");
8167
+ function usePreviewHost5() {
8168
+ const c = (0, import_strapi_admin.unstable_useContentManagerContext)();
8169
+ const rbac = (0, import_strapi_admin.useDocumentRBAC)("BlockscenePagePreview", (state) => state);
8170
+ const values = (0, import_admin.useForm)("BlockscenePagePreview", (state) => state.values);
8171
+ const initialValues = (0, import_admin.useForm)("BlockscenePagePreview", (state) => state.initialValues);
8172
+ const setValues = (0, import_admin.useForm)("BlockscenePagePreview", (state) => state.setValues);
8173
+ const onChange = (0, import_admin.useForm)("BlockscenePagePreview", (state) => state.onChange);
8174
+ const addFieldRow = (0, import_admin.useForm)("BlockscenePagePreview", (state) => state.addFieldRow);
8175
+ const moveFieldRow = (0, import_admin.useForm)("BlockscenePagePreview", (state) => state.moveFieldRow);
8176
+ const { get, put } = (0, import_admin.useFetchClient)();
8177
+ const { toggleNotification } = (0, import_admin.useNotification)();
8178
+ const components = (0, import_admin.useStrapiApp)("BlockscenePagePreview", (state) => state.components);
8179
+ const fields = c.layout?.edit?.layout?.flat(3) || [];
8180
+ const latest = React9.useRef(values);
8181
+ latest.current = values;
8182
+ const readable = React9.useCallback(
8183
+ (name) => c.isCreatingEntry || (rbac.canReadFields || []).includes(name),
8184
+ [c.isCreatingEntry, rbac.canReadFields]
8185
+ );
8186
+ return {
8187
+ ds: 2,
8188
+ model: c.model,
8189
+ documentId: c.id,
8190
+ locale: c.form?.initialValues?.locale,
8191
+ creating: Boolean(c.isCreatingEntry),
8192
+ loading: Boolean(c.isLoading),
8193
+ disabled: Boolean(c.form?.disabled),
8194
+ contentType: c.contentType,
8195
+ components: c.components,
8196
+ values,
8197
+ history: typeof setValues === "function" ? { epoch: initialValues, setValues } : null,
8198
+ readable,
8199
+ editable: (name) => ((c.isCreatingEntry ? rbac.canCreateFields : rbac.canUpdateFields) || []).includes(name) && fields.find((f) => f.name === name)?.disabled !== true && typeof addFieldRow === "function",
8200
+ fieldLabel: (name) => fields.find((f) => f.name === name)?.label || name,
8201
+ onChange,
8202
+ // Append then move: Strapi < 5.8.1 addFieldRow(field, value, index) overwrites the row at index instead of inserting.
8203
+ insertRows: (zone, at, items2) => {
8204
+ const length = Array.isArray(latest.current?.[zone]) ? latest.current[zone].length : 0;
8205
+ items2.forEach((item, i) => {
8206
+ addFieldRow(zone, item);
8207
+ if (at + i < length + i) moveFieldRow(zone, length + i, at + i);
8208
+ });
8209
+ },
8210
+ get,
8211
+ put,
8212
+ notify: (type, message) => toggleNotification({ type, message }),
8213
+ MediaLibrary: components?.["media-library"],
8214
+ useNativeBase,
8215
+ Actions
8216
+ };
8217
+ }
8218
+ function useNativeBase(skip, model, documentId, locale) {
8219
+ const { get } = (0, import_admin.useFetchClient)();
8220
+ const [native, setNative] = React9.useState(null);
8221
+ React9.useEffect(() => {
8222
+ if (skip || !model) return;
8223
+ let active = true;
8224
+ const query2 = new URLSearchParams({
8225
+ status: "draft",
8226
+ ...documentId ? { documentId: String(documentId) } : {},
8227
+ ...locale ? { locale } : {}
8228
+ });
8229
+ get(`/content-manager/preview/url/${model}?${query2}`).then(({ data }) => {
8230
+ if (active && typeof data?.data?.url === "string")
8231
+ setNative(`${new URL(data.data.url).origin}/block-preview/page`);
8232
+ }).catch(() => {
8233
+ if (active) setNative(null);
8234
+ });
8235
+ return () => {
8236
+ active = false;
8237
+ };
8238
+ }, [get, model, documentId, locale, skip]);
8239
+ return skip ? null : native;
8240
+ }
8241
+ function Actions({ parts }) {
8242
+ const c = (0, import_strapi_admin.unstable_useContentManagerContext)();
8243
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8244
+ ToolbarActions,
8245
+ {
8246
+ model: c.model,
8247
+ collectionType: c.collectionType,
8248
+ documentId: c.isCreatingEntry ? void 0 : c.id,
8249
+ locale: c.form?.initialValues?.locale,
8250
+ parts
8251
+ }
8252
+ );
8253
+ }
8254
+ var ACTION_TYPES = ["update", "publish"];
8255
+ var nativeButtons = () => document.querySelectorAll(
8256
+ '#main-content button:not([data-testid="page-preview-pane"] button)'
8257
+ );
8258
+ function ToolbarActions({ model, collectionType, documentId, locale, parts }) {
8259
+ const plugins = (0, import_admin.useStrapiApp)(
8260
+ "BlocksceneToolbar",
8261
+ (state) => state.plugins
8262
+ );
8263
+ const [{ query: query2 }] = (0, import_admin.useQueryParams)();
8264
+ const { document: doc, meta } = (0, import_strapi_admin.unstable_useDocument)(
8265
+ { model, collectionType, documentId, params: { locale } },
8266
+ { skip: !documentId }
8267
+ );
8268
+ const { toggleNotification } = (0, import_admin.useNotification)();
8269
+ const t = useMessages();
8270
+ const { formatMessage } = (0, import_react_intl2.useIntl)();
8271
+ const modified = (0, import_admin.useForm)("BlocksceneToolbar", (state) => state.modified);
8272
+ const status = documentId ? doc?.status : void 0;
8273
+ const descriptions = (plugins["content-manager"]?.apis?.getDocumentActions?.("panel") || []).filter((d) => ACTION_TYPES.includes(d.type));
8274
+ const props = {
8275
+ activeTab: query2.status || "draft",
8276
+ model,
8277
+ documentId,
8278
+ document: doc,
8279
+ meta,
8280
+ collectionType
8281
+ };
8282
+ const run = async (action, event) => {
8283
+ const native = [...nativeButtons()].find(
8284
+ (b) => b.textContent?.trim() === action.label
8285
+ );
8286
+ if (native) {
8287
+ native.click();
8288
+ return;
8289
+ }
8290
+ const mute = await action.onClick?.(event);
8291
+ if (action.dialog && !mute && action.dialog.type === "notification")
8292
+ toggleNotification({
8293
+ title: action.dialog.title,
8294
+ message: action.dialog.content,
8295
+ type: action.dialog.status
8296
+ });
8297
+ };
8298
+ const typeOf = (action) => action.type || descriptions.find(
8299
+ (d) => typeof action.id === "string" && action.id.startsWith(`${d.name || d.displayName}-`)
8300
+ )?.type;
8301
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_admin.DescriptionComponentRenderer, { props, descriptions, children: (actions) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 2, alignItems: "center", "data-testid": "page-preview-actions", children: [
8302
+ parts.includes("status") && (status || modified) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 2, alignItems: "center", style: { order: parts.indexOf("status") }, children: [
8303
+ status && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8304
+ import_design_system5.Status,
8305
+ {
8306
+ size: "S",
8307
+ role: "status",
8308
+ "data-testid": "page-preview-status",
8309
+ variant: status === "draft" ? "secondary" : status === "published" ? "success" : "alternative",
8310
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({ id: `content-manager.containers.List.${status}`, defaultMessage: status.charAt(0).toUpperCase() + status.slice(1) }) })
8311
+ }
8312
+ ),
8313
+ modified && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.unsaved })
8314
+ ] }),
8315
+ parts.includes("actions") && [...actions].sort(
8316
+ (a, b) => ACTION_TYPES.indexOf(typeOf(a)) - ACTION_TYPES.indexOf(typeOf(b))
8317
+ ).map((action) => {
8318
+ const reason = action.disabled ? typeOf(action) === "publish" ? t.publishDisabledHint : t.saveDisabledHint : void 0;
8319
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { title: reason, style: { order: parts.indexOf("actions") }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8320
+ import_design_system5.Button,
8321
+ {
8322
+ size: "S",
8323
+ variant: typeOf(action) === "publish" ? "default" : "secondary",
8324
+ disabled: action.disabled,
8325
+ loading: action.loading,
8326
+ "aria-description": reason,
8327
+ onClick: (e) => run(action, e),
8328
+ children: action.label
8329
+ }
8330
+ ) }, action.id);
8331
+ })
8332
+ ] }) });
8333
+ }
8334
+
8335
+ // admin/History.tsx
8336
+ var React10 = __toESM(require("react"));
8337
+ var import_design_system6 = require("@strapi/design-system");
8338
+ var import_admin2 = require("@strapi/strapi/admin");
8339
+
8340
+ // admin/versions.mjs
8341
+ var import_fractional_indexing3 = require("fractional-indexing");
8342
+ var import_diff = __toESM(require_diff(), 1);
8343
+ var targetOf = (attr) => attr.targetModel || attr.target;
8344
+ var list = (value) => Array.isArray(value) ? value : value == null ? [] : [value];
8345
+ var withKeys = (rows) => {
8346
+ const keys = rows.length ? (0, import_fractional_indexing3.generateNKeysBetween)(null, null, rows.length) : [];
8347
+ return rows.map((row, i) => ({ ...row, __temp_key__: keys[i] }));
8348
+ };
8349
+ function formDiff(snapshot, formValues, schema, components) {
8350
+ const schemaOf = (uid) => components?.[uid];
8351
+ const version = (0, import_diff.canonical)(snapshot, schema, schemaOf, { relations: false });
8352
+ const form = (0, import_diff.canonical)(formValues, schema, schemaOf, { relations: false });
8353
+ const zones = [];
8354
+ const fields = [];
8355
+ for (const [name, attr] of Object.entries(schema?.attributes || {})) {
8356
+ if (!(0, import_diff.kept)(name, attr) || attr.type === "relation") continue;
8357
+ if (attr.type === "dynamiczone") {
8358
+ const ops = (0, import_diff.diffRows)(form[name] || [], version[name] || []).filter((op) => op.op !== "same");
8359
+ if (ops.length) zones.push({ name, ops });
8360
+ } else if (!(0, import_diff.same)(form[name], version[name])) fields.push(name);
8361
+ }
8362
+ return { fields, zones };
8363
+ }
8364
+ function loadVersion(snapshot, { schema, components, current = {}, media = {}, relations = {}, server = {}, editable = () => true }) {
8365
+ const schemaOf = (uid) => components?.[uid];
8366
+ const report = { left: [], removed: [], blocks: 0, media: 0, relations: 0 };
8367
+ const file = (id) => media[id] || (report.media++, null);
8368
+ const resolve = (attr, refs) => {
8369
+ const targets = relations[targetOf(attr)] || [];
8370
+ const found = [];
8371
+ for (const ref of refs) {
8372
+ const hit = targets.find((r) => r.documentId === ref.documentId && (r.locale || null) === (ref.locale || null)) || targets.find((r) => r.documentId === ref.documentId);
8373
+ if (hit) found.push(hit);
8374
+ else report.relations++;
8375
+ }
8376
+ return found;
8377
+ };
8378
+ const build = (data, schema2) => {
8379
+ const out = {};
8380
+ for (const [name, attr] of Object.entries(schema2?.attributes || {})) {
8381
+ const value = data?.[name];
8382
+ if (!(0, import_diff.kept)(name, attr)) continue;
8383
+ if (attr.type === "relation") out[name] = toConnect(resolve(attr, list(value)), targetOf(attr));
8384
+ else if (value === void 0 || value === null) continue;
8385
+ else if (attr.type === "media") {
8386
+ if (attr.multiple) out[name] = list(value).map(file).filter(Boolean);
8387
+ else out[name] = file(value);
8388
+ } else if (attr.type === "component") {
8389
+ const child = schemaOf(attr.component);
8390
+ out[name] = attr.repeatable ? withKeys(list(value).map((item) => build(item, child))) : build(value, child);
8391
+ } else if (attr.type === "dynamiczone") out[name] = zone(attr, value);
8392
+ else out[name] = structuredClone(value);
8393
+ }
8394
+ return out;
8395
+ };
8396
+ const zone = (attr, rows) => withKeys(list(rows).filter((row) => {
8397
+ const ok = row && attr.components?.includes(row.__component) && schemaOf(row.__component);
8398
+ if (!ok) report.blocks++;
8399
+ return ok;
8400
+ }).map((row) => ({ ...build(row, schemaOf(row.__component)), __component: row.__component })));
8401
+ const values = { ...current };
8402
+ for (const name of Object.keys(snapshot || {})) if (!schema?.attributes?.[name]) report.removed.push(name);
8403
+ for (const [name, attr] of Object.entries(schema?.attributes || {})) {
8404
+ if (!(0, import_diff.kept)(name, attr)) continue;
8405
+ const value = snapshot?.[name];
8406
+ const empty = value === void 0 || value === null;
8407
+ if (!editable(name)) {
8408
+ if (!empty || current[name] != null) report.left.push(name);
8409
+ continue;
8410
+ }
8411
+ if (attr.type === "relation") {
8412
+ if (!Array.isArray(server[name])) {
8413
+ report.left.push(name);
8414
+ continue;
8415
+ }
8416
+ const wanted = resolve(attr, list(value));
8417
+ const has = new Set(server[name].map((r) => r.documentId));
8418
+ const keep = new Set(wanted.map((r) => r.documentId));
8419
+ values[name] = {
8420
+ connect: toConnect(wanted.filter((r) => !has.has(r.documentId)), targetOf(attr)).connect,
8421
+ disconnect: server[name].filter((r) => !keep.has(r.documentId)).map((r) => ({ id: r.id, status: r.status, apiData: { id: r.id, documentId: r.documentId, locale: r.locale } }))
8422
+ };
8423
+ } else if (attr.type === "component" || attr.type === "dynamiczone") {
8424
+ if (attr.type === "dynamiczone") values[name] = zone(attr, value);
8425
+ else if (attr.repeatable) values[name] = withKeys(list(value).map((item) => build(item, schemaOf(attr.component))));
8426
+ else values[name] = empty ? null : build(value, schemaOf(attr.component));
8427
+ } else if (attr.type === "media") {
8428
+ values[name] = attr.multiple ? list(value).map(file).filter(Boolean) : empty ? null : file(value);
8429
+ } else if (!empty) values[name] = structuredClone(value);
8430
+ else if (current[name] != null && current[name] !== "") values[name] = null;
8431
+ }
8432
+ return { values, report };
8433
+ }
8434
+
8435
+ // admin/History.tsx
8436
+ var import_jsx_runtime11 = require("react/jsx-runtime");
8437
+ var HISTORY_READ = [{ action: "plugin::blockscene.history.read", subject: null }];
8438
+ var PAGE = 10;
8439
+ function summaryText(t, s) {
8440
+ if (!s) return "";
8441
+ if (s.missing) return t.historyMissing;
8442
+ if (s.initial) return t.historyInitial;
8443
+ const parts = [];
8444
+ const b = s.blocks || {};
8445
+ if (b.added || b.removed || b.changed) parts.push(t.f("historyBlocksSummary", { added: b.added || 0, removed: b.removed || 0, changed: b.changed || 0 }));
8446
+ if (s.fields?.length) parts.push(t.f("historyFieldsSummary", { fields: s.fields.join(", ") }));
8447
+ return parts.join(" \xB7 ") || t.historyNoChange;
8448
+ }
8449
+ function History({ model, documentId, schema, components, editable, disabled, get, relationsOf: relationsOf2 }) {
8450
+ const t = useMessages();
8451
+ const { allowedActions, isLoading } = (0, import_admin2.useRBAC)(HISTORY_READ);
8452
+ const [{ query: query2 }] = (0, import_admin2.useQueryParams)();
8453
+ const locale = typeof query2?.plugins?.i18n?.locale === "string" ? query2.plugins.i18n.locale : "";
8454
+ const values = (0, import_admin2.useForm)("BlocksceneVersions", (state) => state.values);
8455
+ const initialValues = (0, import_admin2.useForm)("BlocksceneVersions", (state) => state.initialValues);
8456
+ const setValues = (0, import_admin2.useForm)("BlocksceneVersions", (state) => state.setValues);
8457
+ const [events, setEvents] = React10.useState(null);
8458
+ const [failed, setFailed] = React10.useState(false);
8459
+ const [shown, setShown] = React10.useState(PAGE);
8460
+ const [open, setOpen] = React10.useState(null);
8461
+ const [report, setReport] = React10.useState(null);
8462
+ const [loading, setLoading] = React10.useState(false);
8463
+ const [refresh, reload] = React10.useReducer((n) => n + 1, 0);
8464
+ const allowed = Boolean(allowedActions?.canRead);
8465
+ React10.useEffect(() => {
8466
+ if (!allowed || !documentId) return;
8467
+ let active = true;
8468
+ setFailed(false);
8469
+ get(`/blockscene/history/${encodeURIComponent(model)}/${encodeURIComponent(documentId)}${locale ? `?locale=${encodeURIComponent(locale)}` : ""}`).then(({ data }) => active && setEvents(Array.isArray(data?.results) ? data.results : [])).catch(() => active && setFailed(true));
8470
+ return () => {
8471
+ active = false;
8472
+ };
8473
+ }, [allowed, get, model, documentId, locale, initialValues, refresh]);
8474
+ React10.useEffect(() => {
8475
+ setOpen(null);
8476
+ setReport(null);
8477
+ setShown(PAGE);
8478
+ }, [model, documentId, locale]);
8479
+ if (isLoading || !allowed || !documentId) return null;
8480
+ const name = (uid) => components?.[uid]?.info?.displayName || uid;
8481
+ const when2 = (at) => {
8482
+ try {
8483
+ return new Date(at).toLocaleString(t.locale, { dateStyle: "medium", timeStyle: "short" });
8484
+ } catch {
8485
+ return at;
8486
+ }
8487
+ };
8488
+ const summary = (s) => summaryText(t, s);
8489
+ const select = async (event) => {
8490
+ setReport(null);
8491
+ if (open?.event?.id === event.id) return setOpen(null);
8492
+ setOpen({ event, loading: true });
8493
+ try {
8494
+ const { data } = await get(`/blockscene/history-events/${event.id}`);
8495
+ setOpen({ event, ...data });
8496
+ } catch {
8497
+ setOpen({ event, failed: true });
8498
+ }
8499
+ };
8500
+ const load2 = async () => {
8501
+ if (!open?.snapshot || typeof setValues !== "function" || disabled) return;
8502
+ setLoading(true);
8503
+ setReport(null);
8504
+ try {
8505
+ const server = {};
8506
+ for (const [field, attr] of Object.entries(schema?.attributes || {}))
8507
+ if (attr?.type === "relation" && editable(field)) server[field] = await relationsOf2(get, { uid: model, id: documentId, field }, locale).catch(() => void 0);
8508
+ const { values: next, report: report2 } = loadVersion(open.snapshot, { schema, components, current: values, media: open.media, relations: open.relations, server, editable });
8509
+ setValues(next);
8510
+ setReport(report2);
8511
+ } catch {
8512
+ setReport({ failed: true });
8513
+ } finally {
8514
+ setLoading(false);
8515
+ }
8516
+ };
8517
+ const diff = open?.snapshot ? formDiff(open.snapshot, values, schema, components) : null;
8518
+ const same2 = diff && !diff.fields.length && !diff.zones.length;
8519
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system6.Flex, { direction: "column", alignItems: "stretch", gap: 2, "data-testid": "blockscene-versions", children: [
8520
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system6.Flex, { justifyContent: "space-between", alignItems: "center", children: [
8521
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "sigma", tag: "h3", textColor: "neutral600", children: t.historyTitle }),
8522
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Button, { variant: "tertiary", size: "S", onClick: reload, children: t.historyRefresh })
8523
+ ] }),
8524
+ failed ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", role: "alert", textColor: "danger600", children: t.historyFailed }) : !events ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", textColor: "neutral600", children: t.historyLoading }) : !events.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", textColor: "neutral600", children: t.historyEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system6.Flex, { tag: "ol", direction: "column", alignItems: "stretch", gap: 1, style: { listStyle: "none", margin: 0, padding: 0 }, children: [
8525
+ events.slice(0, shown).map((event) => {
8526
+ const active = open?.event?.id === event.id;
8527
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("li", { "data-testid": `history-event-${event.id}`, children: [
8528
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
8529
+ import_design_system6.Box,
8530
+ {
8531
+ tag: "button",
8532
+ type: "button",
8533
+ onClick: () => select(event),
8534
+ "aria-expanded": active,
8535
+ padding: 2,
8536
+ hasRadius: true,
8537
+ width: "100%",
8538
+ background: active ? "primary100" : "neutral0",
8539
+ borderColor: active ? "primary200" : "neutral150",
8540
+ style: { textAlign: "left", cursor: "pointer", borderStyle: "solid", borderWidth: 1 },
8541
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system6.Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
8542
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "omega", fontWeight: "bold", children: t.historyActions[event.action] || event.action }),
8543
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system6.Typography, { variant: "pi", textColor: "neutral600", children: [
8544
+ event.actorName || (event.actor === "system" ? t.historySystem : event.actor),
8545
+ " \xB7 ",
8546
+ when2(event.at)
8547
+ ] }),
8548
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", textColor: event.summary?.missing ? "warning700" : "neutral700", children: summary(event.summary) })
8549
+ ] })
8550
+ }
8551
+ ),
8552
+ active && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Box, { padding: 3, background: "neutral100", hasRadius: true, marginTop: 1, children: open.loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", children: t.historyLoading }) : open.failed ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", role: "alert", textColor: "danger600", children: t.historyLoadFailed }) : !open.snapshot ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", textColor: "neutral600", children: t.historyNotKept }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system6.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
8553
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", fontWeight: "bold", children: t.historyCompare }),
8554
+ same2 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", textColor: "neutral600", children: t.historySame }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
8555
+ diff.fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", children: t.f("historyDiffFields", { fields: diff.fields.join(", ") }) }),
8556
+ diff.zones.map((zone) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Flex, { tag: "ul", direction: "column", alignItems: "stretch", gap: 1, style: { margin: 0, paddingLeft: 16 }, "data-testid": `history-diff-${zone.name}`, children: zone.ops.map((op, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system6.Typography, { variant: "pi", textColor: op.op === "added" ? "success700" : op.op === "removed" ? "danger700" : "warning700", children: [
8557
+ t.diffOps[op.op],
8558
+ ": ",
8559
+ name(op.uid),
8560
+ op.to !== void 0 ? ` (#${op.to + 1})` : op.from !== void 0 ? ` (#${op.from + 1})` : ""
8561
+ ] }) }, i)) }, zone.name))
8562
+ ] }),
8563
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", textColor: "neutral600", children: t.historyDiffNote }),
8564
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Button, { size: "S", onClick: load2, loading, disabled: disabled || loading, "data-testid": "history-load", children: t.historyLoad }) }),
8565
+ report && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Box, { role: "status", padding: 2, background: report.failed ? "danger100" : "success100", hasRadius: true, children: report.failed ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", textColor: "danger700", children: t.historyLoadFailed }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system6.Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
8566
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", textColor: "success700", children: t.historyLoaded }),
8567
+ report.left.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", textColor: "warning700", "data-testid": "history-left", children: t.f("historyLeft", { fields: report.left.join(", ") }) }),
8568
+ report.removed.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", textColor: "warning700", children: t.f("historyRemovedFields", { fields: report.removed.join(", ") }) }),
8569
+ (report.media || report.relations || report.blocks) > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Typography, { variant: "pi", textColor: "warning700", children: t.f("historyMissingItems", { media: report.media, relations: report.relations, blocks: report.blocks }) })
8570
+ ] }) })
8571
+ ] }) })
8572
+ ] }, event.id);
8573
+ }),
8574
+ events.length > shown && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Button, { variant: "tertiary", size: "S", onClick: () => setShown(shown + PAGE), children: t.historyShowMore }) })
8575
+ ] })
8576
+ ] });
8577
+ }
8578
+
8579
+ // admin/Settings.tsx
8580
+ var React11 = __toESM(require("react"));
8581
+ var import_design_system7 = require("@strapi/design-system");
8582
+ var import_styled_components7 = __toESM(require("styled-components"));
8583
+ var import_jsx_runtime12 = require("react/jsx-runtime");
7989
8584
  var COLOR2 = /^#[0-9A-Fa-f]{6}$/;
7990
8585
  var Grid2 = import_styled_components7.default.div` display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; `;
7991
8586
  var Card2 = import_styled_components7.default.div`
@@ -7998,17 +8593,17 @@ var Bar = import_styled_components7.default.div`
7998
8593
  box-shadow: 0 1px 4px rgba(33, 33, 52, 0.1);
7999
8594
  `;
8000
8595
  function useMainRect2(anchor) {
8001
- const [rect, setRect] = React9.useState({ left: 0, width: 0 });
8002
- React9.useEffect(() => {
8003
- const read2 = () => {
8596
+ const [rect, setRect] = React11.useState({ left: 0, width: 0 });
8597
+ React11.useEffect(() => {
8598
+ const read3 = () => {
8004
8599
  let host = document.getElementById("main-content");
8005
8600
  for (let el = anchor.current?.parentElement; !host && el; el = el.parentElement) if (["auto", "scroll"].includes(getComputedStyle(el).overflowY) && el.scrollHeight > el.clientHeight) host = el;
8006
8601
  const r = (host || document.querySelector("main"))?.getBoundingClientRect();
8007
8602
  if (r) setRect({ left: Math.round(r.left), width: Math.round(r.width) });
8008
8603
  };
8009
- read2();
8010
- window.addEventListener("resize", read2);
8011
- return () => window.removeEventListener("resize", read2);
8604
+ read3();
8605
+ window.addEventListener("resize", read3);
8606
+ return () => window.removeEventListener("resize", read3);
8012
8607
  });
8013
8608
  return rect;
8014
8609
  }
@@ -8016,11 +8611,11 @@ var Swatches = import_styled_components7.default.div` display: grid; grid-templa
8016
8611
  var Label = import_styled_components7.default.label` display: flex; flex-direction: column; gap: 4px; font-size: 12px; `;
8017
8612
  function ColorField({ name, label, value, onChange, disabled }) {
8018
8613
  const valid = COLOR2.test(value);
8019
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Label, { children: [
8020
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", children: label }),
8021
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 2, children: [
8022
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "color", "aria-label": label, value: valid ? value : "#000000", disabled, onChange: (e) => onChange(e.target.value.toUpperCase()), style: { width: 40, height: 32, padding: 0, border: 0, background: "none" } }),
8023
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8614
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Label, { children: [
8615
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", children: label }),
8616
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 2, children: [
8617
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "color", "aria-label": label, value: valid ? value : "#000000", disabled, onChange: (e) => onChange(e.target.value.toUpperCase()), style: { width: 40, height: 32, padding: 0, border: 0, background: "none" } }),
8618
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8024
8619
  "input",
8025
8620
  {
8026
8621
  name,
@@ -8036,14 +8631,14 @@ function ColorField({ name, label, value, onChange, disabled }) {
8036
8631
  ] });
8037
8632
  }
8038
8633
  function TagsField({ name, label, hint, value, onChange, disabled }) {
8039
- const [text, setText] = React9.useState(value.join(", "));
8040
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Label, { children: [
8041
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", children: label }),
8042
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { name, value: text, disabled, onChange: (e) => {
8634
+ const [text, setText] = React11.useState(value.join(", "));
8635
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Label, { children: [
8636
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", children: label }),
8637
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { name, value: text, disabled, onChange: (e) => {
8043
8638
  setText(e.target.value);
8044
8639
  onChange([...new Set(e.target.value.split(",").map((tag) => tag.replace(/[<>]/g, "").trim().slice(0, 24)).filter(Boolean))].slice(0, 10));
8045
8640
  }, style: { padding: "6px 8px", border: "1px solid #dcdce4", borderRadius: 4, fontSize: 13 } }),
8046
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: hint })
8641
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: hint })
8047
8642
  ] });
8048
8643
  }
8049
8644
  var FIELD_UID = /^(plugin|global)::[\w.-]+$/;
@@ -8051,11 +8646,11 @@ var LAZY_MAX = 20;
8051
8646
  var parseUids = (text) => [...new Set(text.split(/[\s,]+/).filter(Boolean))];
8052
8647
  var badUids = (uids = []) => uids.length > LAZY_MAX || uids.some((uid) => !FIELD_UID.test(uid));
8053
8648
  function UidListField({ TextField: TextField2, value, onChange, ...props }) {
8054
- const [text, setText] = React9.useState(value.join(", "));
8055
- React9.useEffect(() => {
8649
+ const [text, setText] = React11.useState(value.join(", "));
8650
+ React11.useEffect(() => {
8056
8651
  if (parseUids(text).join() !== value.join()) setText(value.join(", "));
8057
8652
  }, [value.join()]);
8058
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TextField2, { ...props, value: text, onChange: (v) => {
8653
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TextField2, { ...props, value: text, onChange: (v) => {
8059
8654
  setText(v);
8060
8655
  onChange(parseUids(v));
8061
8656
  } });
@@ -8077,50 +8672,50 @@ var Checks = import_styled_components7.default.fieldset`
8077
8672
  var TOOLBAR2 = ["modes", "history", "devices", "status", "actions"];
8078
8673
  var DEVICE_NAMES = ["fit", "mobile", "tablet", "desktop"];
8079
8674
  var DEVICE_LABEL = /^[^<>]{1,24}$/;
8080
- var badDevices = (list = []) => list.length < 1 || list.length > 8 || list.some((item) => typeof item !== "string" && (!DEVICE_LABEL.test(String(item.label || "").trim()) || !(Number.isInteger(item.width) && item.width >= 240 && item.width <= 3840))) || new Set(list.map((item) => typeof item === "string" ? item : item.width)).size !== list.length;
8675
+ var badDevices = (list2 = []) => list2.length < 1 || list2.length > 8 || list2.some((item) => typeof item !== "string" && (!DEVICE_LABEL.test(String(item.label || "").trim()) || !(Number.isInteger(item.width) && item.width >= 240 && item.width <= 3840))) || new Set(list2.map((item) => typeof item === "string" ? item : item.width)).size !== list2.length;
8081
8676
  var Row = import_styled_components7.default.div` display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 13px; color: ${({ theme }) => theme.colors.neutral800}; `;
8082
8677
  function PaneEditor({ id, toolbar, devices, set: set2, t, disabled, TextField: TextField2 }) {
8083
- const move = (list, index, by) => {
8084
- const next = [...list];
8678
+ const move = (list2, index, by) => {
8679
+ const next = [...list2];
8085
8680
  [next[index], next[index + by]] = [next[index + by], next[index]];
8086
8681
  return next;
8087
8682
  };
8088
- const arrows = (list, index, key) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
8089
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tool, { icon: "up", label: t.moveUp, disabled: disabled || index < 0 || index === 0, onClick: () => set2(key, move(list, index, -1)) }),
8090
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tool, { icon: "down", label: t.moveDown, disabled: disabled || index < 0 || index === list.length - 1, onClick: () => set2(key, move(list, index, 1)) })
8683
+ const arrows = (list2, index, key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
8684
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Tool, { icon: "up", label: t.moveUp, disabled: disabled || index < 0 || index === 0, onClick: () => set2(key, move(list2, index, -1)) }),
8685
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Tool, { icon: "down", label: t.moveDown, disabled: disabled || index < 0 || index === list2.length - 1, onClick: () => set2(key, move(list2, index, 1)) })
8091
8686
  ] });
8092
- const check = (list, item, key) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8687
+ const check = (list2, item, key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8093
8688
  "input",
8094
8689
  {
8095
8690
  type: "checkbox",
8096
8691
  name: `${id}-${key}-${item}`,
8097
- checked: list.includes(item),
8692
+ checked: list2.includes(item),
8098
8693
  disabled,
8099
- onChange: (e) => set2(key, e.target.checked ? [...list, item] : list.filter((entry) => entry !== item))
8694
+ onChange: (e) => set2(key, e.target.checked ? [...list2, item] : list2.filter((entry) => entry !== item))
8100
8695
  }
8101
8696
  );
8102
8697
  const width = (index, patch) => set2("previewDevices", devices.map((item, i) => i === index ? { ...item, ...patch } : item));
8103
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 3, "data-testid": `pane-editor-${id}`, children: [
8104
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.paneHelp }),
8105
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { children: [...toolbar, ...TOOLBAR2.filter((item) => !toolbar.includes(item))].map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Row, { "data-testid": `${id}-toolbar-${item}`, children: [
8698
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 3, "data-testid": `pane-editor-${id}`, children: [
8699
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.paneHelp }),
8700
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { children: [...toolbar, ...TOOLBAR2.filter((item) => !toolbar.includes(item))].map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Row, { "data-testid": `${id}-toolbar-${item}`, children: [
8106
8701
  arrows(toolbar, toolbar.indexOf(item), "previewToolbar"),
8107
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { style: { display: "inline-flex", gap: 6, alignItems: "center" }, children: [
8702
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { style: { display: "inline-flex", gap: 6, alignItems: "center" }, children: [
8108
8703
  check(toolbar, item, "previewToolbar"),
8109
8704
  t.toolbar[item]
8110
8705
  ] })
8111
8706
  ] }, item)) }),
8112
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "delta", tag: "h3", children: t.paneDevices }),
8113
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.paneDevicesHelp }),
8114
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { children: [...devices, ...DEVICE_NAMES.filter((item) => !devices.includes(item))].map((item) => {
8707
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "delta", tag: "h3", children: t.paneDevices }),
8708
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.paneDevicesHelp }),
8709
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { children: [...devices, ...DEVICE_NAMES.filter((item) => !devices.includes(item))].map((item) => {
8115
8710
  const index = devices.indexOf(item);
8116
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Row, { "data-testid": `${id}-device-${typeof item === "string" ? item : index}`, children: [
8711
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Row, { "data-testid": `${id}-device-${typeof item === "string" ? item : index}`, children: [
8117
8712
  arrows(devices, index, "previewDevices"),
8118
- typeof item === "string" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { style: { display: "inline-flex", gap: 6, alignItems: "center" }, children: [
8713
+ typeof item === "string" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { style: { display: "inline-flex", gap: 6, alignItems: "center" }, children: [
8119
8714
  check(devices, item, "previewDevices"),
8120
8715
  t.device[item]
8121
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
8122
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { style: { flex: "1 1 160px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TextField2, { name: `${id}-device-label-${index}`, label: t.paneWidthLabel, value: item.label, disabled, onChange: (v) => width(index, { label: v }) }) }),
8123
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { style: { width: 140 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8716
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
8717
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { style: { flex: "1 1 160px" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TextField2, { name: `${id}-device-label-${index}`, label: t.paneWidthLabel, value: item.label, disabled, onChange: (v) => width(index, { label: v }) }) }),
8718
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { style: { width: 140 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8124
8719
  TextField2,
8125
8720
  {
8126
8721
  name: `${id}-device-width-${index}`,
@@ -8130,12 +8725,12 @@ function PaneEditor({ id, toolbar, devices, set: set2, t, disabled, TextField: T
8130
8725
  onChange: (v) => width(index, { width: /^\d{1,4}$/.test(v.trim()) ? Number(v.trim()) : NaN })
8131
8726
  }
8132
8727
  ) }),
8133
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tool, { icon: "close", label: t.paneRemoveWidth, disabled, onClick: () => set2("previewDevices", devices.filter((_, i) => i !== index)) })
8728
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Tool, { icon: "close", label: t.paneRemoveWidth, disabled, onClick: () => set2("previewDevices", devices.filter((_, i) => i !== index)) })
8134
8729
  ] })
8135
8730
  ] }, typeof item === "string" ? item : `px-${index}`);
8136
8731
  }) }),
8137
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8138
- import_design_system5.Button,
8732
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8733
+ import_design_system7.Button,
8139
8734
  {
8140
8735
  variant: "secondary",
8141
8736
  size: "S",
@@ -8145,15 +8740,15 @@ function PaneEditor({ id, toolbar, devices, set: set2, t, disabled, TextField: T
8145
8740
  children: t.paneAddWidth
8146
8741
  }
8147
8742
  ) }),
8148
- badDevices(devices) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { role: "alert", variant: "pi", textColor: "danger600", children: t.paneInvalid })
8743
+ badDevices(devices) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { role: "alert", variant: "pi", textColor: "danger600", children: t.paneInvalid })
8149
8744
  ] });
8150
8745
  }
8151
8746
  var DAYS = (n) => Number.isInteger(n) && n >= 1 && n <= 3650;
8152
8747
  var badRetention = (h) => !h || !DAYS(h.retentionDays) || !DAYS(h.eventDays) || !DAYS(h.trashDays) || h.eventDays < h.retentionDays || !(Number.isInteger(h.maxSnapshots) && h.maxSnapshots >= 1 && h.maxSnapshots <= 1e3);
8153
8748
  function HistorySettings({ types, history, set: set2, t, disabled, ToggleField: ToggleField2, TextField: TextField2 }) {
8154
8749
  const all = history.contentTypes === "all";
8155
- const list = all ? [] : history.contentTypes;
8156
- const number = (key) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { style: { minWidth: 200 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8750
+ const list2 = all ? [] : history.contentTypes;
8751
+ const number = (key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { style: { minWidth: 200 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8157
8752
  TextField2,
8158
8753
  {
8159
8754
  name: `history-${key}`,
@@ -8163,33 +8758,33 @@ function HistorySettings({ types, history, set: set2, t, disabled, ToggleField:
8163
8758
  onChange: (v) => set2(key, /^\d{1,5}$/.test(v.trim()) ? Number(v.trim()) : NaN)
8164
8759
  }
8165
8760
  ) });
8166
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 4, "data-testid": "history-settings", children: [
8167
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "beta", tag: "h2", children: t.historySettings }),
8168
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.historySettingsHelp }),
8169
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "history-enabled", label: t.historyEnabled, value: history.enabled, disabled, onChange: (v) => set2("enabled", v) }),
8170
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "history-all", label: t.historyAll, value: all, disabled: disabled || !history.enabled, onChange: (v) => set2("contentTypes", v ? "all" : types.map((type) => type.uid)) }),
8171
- !all && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Checks, { disabled: disabled || !history.enabled, children: [
8172
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("legend", { children: t.historyTypes }),
8173
- types.map((type) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
8174
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8761
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 4, "data-testid": "history-settings", children: [
8762
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "beta", tag: "h2", children: t.historySettings }),
8763
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.historySettingsHelp }),
8764
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "history-enabled", label: t.historyEnabled, value: history.enabled, disabled, onChange: (v) => set2("enabled", v) }),
8765
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "history-all", label: t.historyAll, value: all, disabled: disabled || !history.enabled, onChange: (v) => set2("contentTypes", v ? "all" : types.map((type) => type.uid)) }),
8766
+ !all && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Checks, { disabled: disabled || !history.enabled, children: [
8767
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("legend", { children: t.historyTypes }),
8768
+ types.map((type) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { children: [
8769
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8175
8770
  "input",
8176
8771
  {
8177
8772
  type: "checkbox",
8178
8773
  name: `history-type-${type.uid}`,
8179
- checked: list.includes(type.uid),
8180
- onChange: (e) => set2("contentTypes", e.target.checked ? [...list, type.uid] : list.filter((uid) => uid !== type.uid))
8774
+ checked: list2.includes(type.uid),
8775
+ onChange: (e) => set2("contentTypes", e.target.checked ? [...list2, type.uid] : list2.filter((uid) => uid !== type.uid))
8181
8776
  }
8182
8777
  ),
8183
8778
  type.displayName
8184
8779
  ] }, type.uid))
8185
8780
  ] }),
8186
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 4, wrap: "wrap", alignItems: "flex-end", children: [
8781
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 4, wrap: "wrap", alignItems: "flex-end", children: [
8187
8782
  number("retentionDays"),
8188
8783
  number("maxSnapshots"),
8189
8784
  number("eventDays"),
8190
8785
  number("trashDays")
8191
8786
  ] }),
8192
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: badRetention(history) ? "danger600" : "neutral600", role: badRetention(history) ? "alert" : void 0, children: badRetention(history) ? t.historyInvalid : `${t.historyRetentionHelp} ${t.trashDaysHelp}` })
8787
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: badRetention(history) ? "danger600" : "neutral600", role: badRetention(history) ? "alert" : void 0, children: badRetention(history) ? t.historyInvalid : `${t.historyRetentionHelp} ${t.trashDaysHelp}` })
8193
8788
  ] }) });
8194
8789
  }
8195
8790
  function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: SelectField2, TextField: TextField2 }) {
@@ -8203,10 +8798,10 @@ function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: Selec
8203
8798
  };
8204
8799
  const fields = (type.attributes || []).filter((attr) => !SYSTEM_FIELDS2.includes(attr.name));
8205
8800
  const id = (name, index) => `sidebar-${name}-${type.uid}${index === void 0 ? "" : `-${index}`}`;
8206
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 3, paddingLeft: 4, "data-testid": `sidebar-editor-${type.uid}`, children: [
8207
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "delta", tag: "h3", children: t.f("sidebarTitle", { name: type.displayName }) }),
8208
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.sidebarHelp }),
8209
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { style: { maxWidth: 240 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8801
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 3, paddingLeft: 4, "data-testid": `sidebar-editor-${type.uid}`, children: [
8802
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "delta", tag: "h3", children: t.f("sidebarTitle", { name: type.displayName }) }),
8803
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.sidebarHelp }),
8804
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { style: { maxWidth: 240 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8210
8805
  SelectField2,
8211
8806
  {
8212
8807
  name: id("position"),
@@ -8217,21 +8812,21 @@ function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: Selec
8217
8812
  onChange: (v) => set2("sidebarPosition", v, "left")
8218
8813
  }
8219
8814
  ) }),
8220
- items2.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Item, { "data-testid": id("item", index), children: [
8221
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 4, alignItems: "flex-end", wrap: "wrap", children: [
8222
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { style: { flex: "1 1 200px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TextField2, { name: id("label", index), label: t.sidebarItemLabel, value: item.label, disabled, onChange: (v) => edit(index, { label: v }) }) }),
8223
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { style: { minWidth: 180 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8815
+ items2.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Item, { "data-testid": id("item", index), children: [
8816
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 4, alignItems: "flex-end", wrap: "wrap", children: [
8817
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { style: { flex: "1 1 200px" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TextField2, { name: id("label", index), label: t.sidebarItemLabel, value: item.label, disabled, onChange: (v) => edit(index, { label: v }) }) }),
8818
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { style: { minWidth: 180 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8224
8819
  SelectField2,
8225
8820
  {
8226
8821
  name: id("icon", index),
8227
8822
  label: t.sidebarIcon,
8228
8823
  value: item.icon || "none",
8229
8824
  disabled,
8230
- options: [{ value: "none", label: t.noIcon }, ...SIDEBAR_ICONS.map((value) => ({ value, label: t.icons[value], icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { name: value, size: 16 }) }))],
8825
+ options: [{ value: "none", label: t.noIcon }, ...SIDEBAR_ICONS.map((value) => ({ value, label: t.icons[value], icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: value, size: 16 }) }))],
8231
8826
  onChange: (v) => edit(index, { icon: v === "none" ? void 0 : v })
8232
8827
  }
8233
8828
  ) }),
8234
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { style: { minWidth: 160 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8829
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { style: { minWidth: 160 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8235
8830
  SelectField2,
8236
8831
  {
8237
8832
  name: id("open", index),
@@ -8242,16 +8837,16 @@ function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: Selec
8242
8837
  onChange: (v) => edit(index, { open: v })
8243
8838
  }
8244
8839
  ) }),
8245
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 1, paddingBottom: 1, children: [
8246
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tool, { icon: "up", label: t.moveUp, disabled: disabled || index === 0, onClick: () => move(index, -1) }),
8247
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tool, { icon: "down", label: t.moveDown, disabled: disabled || index === items2.length - 1, onClick: () => move(index, 1) }),
8248
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tool, { icon: "close", label: t.sidebarRemove, disabled, onClick: () => save(items2.filter((_, i) => i !== index)) })
8840
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 1, paddingBottom: 1, children: [
8841
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Tool, { icon: "up", label: t.moveUp, disabled: disabled || index === 0, onClick: () => move(index, -1) }),
8842
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Tool, { icon: "down", label: t.moveDown, disabled: disabled || index === items2.length - 1, onClick: () => move(index, 1) }),
8843
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Tool, { icon: "close", label: t.sidebarRemove, disabled, onClick: () => save(items2.filter((_, i) => i !== index)) })
8249
8844
  ] })
8250
8845
  ] }),
8251
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Checks, { disabled, children: [
8252
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("legend", { children: t.sidebarFields }),
8253
- fields.map((attr) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
8254
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8846
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Checks, { disabled, children: [
8847
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("legend", { children: t.sidebarFields }),
8848
+ fields.map((attr) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { children: [
8849
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8255
8850
  "input",
8256
8851
  {
8257
8852
  type: "checkbox",
@@ -8263,11 +8858,11 @@ function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: Selec
8263
8858
  attr.name
8264
8859
  ] }, attr.name))
8265
8860
  ] }),
8266
- badItem(item) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { role: "alert", variant: "pi", textColor: "danger600", children: t.sidebarInvalid })
8861
+ badItem(item) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { role: "alert", variant: "pi", textColor: "danger600", children: t.sidebarInvalid })
8267
8862
  ] }, index)),
8268
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 2, alignItems: "center", children: [
8269
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8270
- import_design_system5.Button,
8863
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 2, alignItems: "center", children: [
8864
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8865
+ import_design_system7.Button,
8271
8866
  {
8272
8867
  variant: "secondary",
8273
8868
  size: "S",
@@ -8277,7 +8872,7 @@ function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: Selec
8277
8872
  children: t.sidebarAdd
8278
8873
  }
8279
8874
  ),
8280
- items2.length >= SIDEBAR_MAX && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.f("sidebarLimit", { max: SIDEBAR_MAX }) })
8875
+ items2.length >= SIDEBAR_MAX && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.f("sidebarLimit", { max: SIDEBAR_MAX }) })
8281
8876
  ] })
8282
8877
  ] });
8283
8878
  }
@@ -8286,18 +8881,18 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8286
8881
  const t = useMessages();
8287
8882
  const { get, put, del } = useClient();
8288
8883
  const { canRead, canUpdate, isLoading } = usePermissions2();
8289
- const [data, setData] = React9.useState(null);
8290
- const [catalog, setCatalog] = React9.useState(null);
8291
- const [settings, setSettings] = React9.useState(null);
8292
- const [media, setMedia] = React9.useState({});
8293
- const [sources, setSources] = React9.useState({});
8294
- const [dirty, setDirty] = React9.useState(false);
8295
- const [saving, setSaving] = React9.useState(false);
8296
- const [status, setStatus] = React9.useState("");
8297
- const [failed, setFailed] = React9.useState(false);
8298
- const [filter, setFilter] = React9.useState("");
8299
- const [picking, setPicking] = React9.useState(null);
8300
- React9.useEffect(() => {
8884
+ const [data, setData] = React11.useState(null);
8885
+ const [catalog, setCatalog] = React11.useState(null);
8886
+ const [settings, setSettings] = React11.useState(null);
8887
+ const [media, setMedia] = React11.useState({});
8888
+ const [sources, setSources] = React11.useState({});
8889
+ const [dirty, setDirty] = React11.useState(false);
8890
+ const [saving, setSaving] = React11.useState(false);
8891
+ const [status, setStatus] = React11.useState("");
8892
+ const [failed, setFailed] = React11.useState(false);
8893
+ const [filter, setFilter] = React11.useState("");
8894
+ const [picking, setPicking] = React11.useState(null);
8895
+ React11.useEffect(() => {
8301
8896
  if (!canRead || isLoading) return;
8302
8897
  let active = true;
8303
8898
  Promise.all([get("/blockscene/settings"), get("/blockscene/catalog")]).then(([s, c]) => {
@@ -8375,36 +8970,36 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8375
8970
  return index === 0 && manual ? t.manual : t.automatic;
8376
8971
  };
8377
8972
  const ready = !isLoading && canRead && !failed && settings && catalog;
8378
- const header = React9.useRef(null);
8379
- const [floating, setFloating] = React9.useState(false);
8973
+ const header = React11.useRef(null);
8974
+ const [floating, setFloating] = React11.useState(false);
8380
8975
  const main = useMainRect2(header);
8381
- React9.useEffect(() => {
8976
+ React11.useEffect(() => {
8382
8977
  const el = header.current;
8383
8978
  if (!el || typeof IntersectionObserver === "undefined") return;
8384
8979
  const observer = new IntersectionObserver(([entry]) => setFloating(!entry.isIntersecting && entry.boundingClientRect.top < 0));
8385
8980
  observer.observe(el);
8386
8981
  return () => observer.disconnect();
8387
8982
  }, [ready]);
8388
- const controls = (suffix) => ready && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 3, alignItems: "center", wrap: "wrap", children: [
8389
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { role: "status", "aria-live": "polite", textColor: dirty ? "warning700" : "neutral600", "data-testid": `${dirty ? "unsaved-indicator" : "save-status"}${suffix}`, children: dirty ? t.unsaved : status || t.noChanges }),
8390
- !suffix && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Button, { variant: "tertiary", onClick: restore, disabled: !canUpdate || saving, "data-testid": "restore-blockscene-settings", children: data.projectDefaults ? t.restoreProject : t.resetAll }),
8391
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Button, { onClick: save, disabled: !canUpdate || invalid || !dirty, loading: saving, "data-testid": `save-blockscene-settings${suffix}`, children: t.save })
8983
+ const controls = (suffix) => ready && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 3, alignItems: "center", wrap: "wrap", children: [
8984
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { role: "status", "aria-live": "polite", textColor: dirty ? "warning700" : "neutral600", "data-testid": `${dirty ? "unsaved-indicator" : "save-status"}${suffix}`, children: dirty ? t.unsaved : status || t.noChanges }),
8985
+ !suffix && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Button, { variant: "tertiary", onClick: restore, disabled: !canUpdate || saving, "data-testid": "restore-blockscene-settings", children: data.projectDefaults ? t.restoreProject : t.resetAll }),
8986
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Button, { onClick: save, disabled: !canUpdate || invalid || !dirty, loading: saving, "data-testid": `save-blockscene-settings${suffix}`, children: t.save })
8392
8987
  ] });
8393
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { padding: 8, background: "neutral100", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 5, children: [
8394
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ref: header, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 4, alignItems: "center", justifyContent: "space-between", wrap: "wrap", children: [
8395
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "alpha", tag: "h1", children: t.settingsTitle }),
8988
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { padding: 8, background: "neutral100", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 5, children: [
8989
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref: header, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 4, alignItems: "center", justifyContent: "space-between", wrap: "wrap", children: [
8990
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "alpha", tag: "h1", children: t.settingsTitle }),
8396
8991
  controls("")
8397
8992
  ] }) }),
8398
- floating && main.width > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Bar, { style: { left: main.left, width: main.width }, "data-testid": "settings-floating-bar", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 4, alignItems: "center", justifyContent: "space-between", wrap: "wrap", children: [
8399
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "beta", tag: "p", children: t.settingsTitle }),
8993
+ floating && main.width > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Bar, { style: { left: main.left, width: main.width }, "data-testid": "settings-floating-bar", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 4, alignItems: "center", justifyContent: "space-between", wrap: "wrap", children: [
8994
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "beta", tag: "p", children: t.settingsTitle }),
8400
8995
  controls("-floating")
8401
8996
  ] }) }),
8402
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { textColor: "neutral600", children: t.settingsIntro }),
8403
- isLoading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { children: "\u2026" }) : !canRead ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { role: "alert", children: t.denied }) : failed ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { role: "alert", children: t.loadFailed }) : !settings || !catalog ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { children: t.loading }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
8404
- data.disabled && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { padding: 4, background: "warning100", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { role: "alert", textColor: "warning700", children: t.disabledByServer }) }),
8405
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
8406
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "beta", tag: "h2", children: t.palette }),
8407
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Swatches, { children: Object.keys(DEFAULT_PALETTE).map((key) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
8997
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { textColor: "neutral600", children: t.settingsIntro }),
8998
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { children: "\u2026" }) : !canRead ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { role: "alert", children: t.denied }) : failed ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { role: "alert", children: t.loadFailed }) : !settings || !catalog ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { children: t.loading }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
8999
+ data.disabled && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { padding: 4, background: "warning100", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { role: "alert", textColor: "warning700", children: t.disabledByServer }) }),
9000
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
9001
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "beta", tag: "h2", children: t.palette }),
9002
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Swatches, { children: Object.keys(DEFAULT_PALETTE).map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8408
9003
  ColorField,
8409
9004
  {
8410
9005
  name: `palette-${key}`,
@@ -8418,43 +9013,43 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8418
9013
  },
8419
9014
  key
8420
9015
  )) }),
8421
- badColor && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { role: "alert", textColor: "danger600", children: t.invalidColor }),
8422
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.previewLabel }),
8423
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Swatches, { "data-testid": "palette-preview", children: TEMPLATES.map((template) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", gap: 1, children: [
8424
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { style: { aspectRatio: "16 / 9", overflow: "hidden" }, hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Wireframe, { template, palette: settings.palette }) }),
8425
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.templates[template] })
9016
+ badColor && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { role: "alert", textColor: "danger600", children: t.invalidColor }),
9017
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.previewLabel }),
9018
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Swatches, { "data-testid": "palette-preview", children: TEMPLATES.map((template) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", gap: 1, children: [
9019
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { style: { aspectRatio: "16 / 9", overflow: "hidden" }, hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Wireframe, { template, palette: settings.palette }) }),
9020
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.templates[template] })
8426
9021
  ] }, template)) }),
8427
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Button, { variant: "tertiary", size: "S", disabled: !canUpdate, onClick: () => update((s) => {
9022
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Button, { variant: "tertiary", size: "S", disabled: !canUpdate, onClick: () => update((s) => {
8428
9023
  s.palette = { ...DEFAULT_PALETTE };
8429
9024
  return s;
8430
9025
  }), children: t.resetPalette }) })
8431
9026
  ] }) }),
8432
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
8433
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "beta", tag: "h2", children: t.editor }),
8434
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "editor-enabled", label: t.enabled, value: editor.enabled, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
9027
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
9028
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "beta", tag: "h2", children: t.editor }),
9029
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "editor-enabled", label: t.enabled, value: editor.enabled, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
8435
9030
  s.editor.enabled = v;
8436
9031
  return s;
8437
9032
  }) }),
8438
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.enabledHelp }),
8439
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "editor-showOpenAll", label: t.showOpenAll, value: editor.showOpenAll, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
9033
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.enabledHelp }),
9034
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "editor-showOpenAll", label: t.showOpenAll, value: editor.showOpenAll, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
8440
9035
  s.editor.showOpenAll = v;
8441
9036
  return s;
8442
9037
  }) }),
8443
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "editor-showCloseAll", label: t.showCloseAll, value: editor.showCloseAll, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
9038
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "editor-showCloseAll", label: t.showCloseAll, value: editor.showCloseAll, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
8444
9039
  s.editor.showCloseAll = v;
8445
9040
  return s;
8446
9041
  }) }),
8447
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.toggleHelp }),
8448
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "editor-showRowThumbnails", label: t.showRowThumbnails, value: editor.showRowThumbnails !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
9042
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.toggleHelp }),
9043
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "editor-showRowThumbnails", label: t.showRowThumbnails, value: editor.showRowThumbnails !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
8449
9044
  s.editor.showRowThumbnails = v;
8450
9045
  return s;
8451
9046
  }) }),
8452
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "editor-friendlyLabels", label: t.friendlyLabels, value: editor.friendlyLabels !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
9047
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "editor-friendlyLabels", label: t.friendlyLabels, value: editor.friendlyLabels !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
8453
9048
  s.editor.friendlyLabels = v;
8454
9049
  return s;
8455
9050
  }) }),
8456
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.friendlyLabelsHelp }),
8457
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9051
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.friendlyLabelsHelp }),
9052
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8458
9053
  SelectField2,
8459
9054
  {
8460
9055
  name: "editor-initialState",
@@ -8468,8 +9063,8 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8468
9063
  })
8469
9064
  }
8470
9065
  ),
8471
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.rememberHelp }),
8472
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9066
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.rememberHelp }),
9067
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8473
9068
  TextField2,
8474
9069
  {
8475
9070
  name: "editor-blockPreviewUrl",
@@ -8483,8 +9078,8 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8483
9078
  })
8484
9079
  }
8485
9080
  ),
8486
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.blockPreviewUrlHelp }),
8487
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9081
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.blockPreviewUrlHelp }),
9082
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8488
9083
  TextField2,
8489
9084
  {
8490
9085
  name: "editor-previewUrl",
@@ -8498,9 +9093,9 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8498
9093
  })
8499
9094
  }
8500
9095
  ),
8501
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.previewUrlHelp }),
8502
- !editor.previewUrl && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "warning700", "data-testid": "preview-url-empty", children: t.previewUrlEmpty }),
8503
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9096
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.previewUrlHelp }),
9097
+ !editor.previewUrl && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "warning700", "data-testid": "preview-url-empty", children: t.previewUrlEmpty }),
9098
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8504
9099
  SelectField2,
8505
9100
  {
8506
9101
  name: "editor-previewMode",
@@ -8514,9 +9109,9 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8514
9109
  })
8515
9110
  }
8516
9111
  ),
8517
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.previewModeHelp }),
8518
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "delta", tag: "h3", children: t.paneTitle }),
8519
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9112
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.previewModeHelp }),
9113
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "delta", tag: "h3", children: t.paneTitle }),
9114
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8520
9115
  PaneEditor,
8521
9116
  {
8522
9117
  id: "editor",
@@ -8531,12 +9126,12 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8531
9126
  })
8532
9127
  }
8533
9128
  ),
8534
- lazyEditors && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
8535
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "editor-lazyEditors", label: t.lazyEditors, value: editor.lazyEditors !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
9129
+ lazyEditors && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
9130
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "editor-lazyEditors", label: t.lazyEditors, value: editor.lazyEditors !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
8536
9131
  s.editor.lazyEditors = v;
8537
9132
  return s;
8538
9133
  }) }),
8539
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9134
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8540
9135
  UidListField,
8541
9136
  {
8542
9137
  TextField: TextField2,
@@ -8551,31 +9146,31 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8551
9146
  })
8552
9147
  }
8553
9148
  ),
8554
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: badLazy ? "danger600" : "neutral600", role: badLazy ? "alert" : void 0, children: badLazy ? t.f("lazyFieldsInvalid", { max: LAZY_MAX }) : t.lazyEditorsHelp }),
8555
- data.blockPreviewAvailable && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
8556
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "editor-blockPreviewInForm", label: t.blockPreviewInForm, value: editor.blockPreviewInForm, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
9149
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: badLazy ? "danger600" : "neutral600", role: badLazy ? "alert" : void 0, children: badLazy ? t.f("lazyFieldsInvalid", { max: LAZY_MAX }) : t.lazyEditorsHelp }),
9150
+ data.blockPreviewAvailable && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
9151
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "editor-blockPreviewInForm", label: t.blockPreviewInForm, value: editor.blockPreviewInForm, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
8557
9152
  s.editor.blockPreviewInForm = v;
8558
9153
  return s;
8559
9154
  }) }),
8560
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.blockPreviewInFormHelp })
9155
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.blockPreviewInFormHelp })
8561
9156
  ] })
8562
9157
  ] })
8563
9158
  ] }) }),
8564
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 4, "data-testid": "row-actions-settings", children: [
8565
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "beta", tag: "h2", children: t.rowActionsTitle }),
8566
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "editor-confirmDelete", label: t.confirmDeleteOption, value: editor.confirmDelete !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
9159
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 4, "data-testid": "row-actions-settings", children: [
9160
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "beta", tag: "h2", children: t.rowActionsTitle }),
9161
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "editor-confirmDelete", label: t.confirmDeleteOption, value: editor.confirmDelete !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
8567
9162
  s.editor.confirmDelete = v;
8568
9163
  return s;
8569
9164
  }) }),
8570
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "editor-duplicate", label: t.duplicateOption, value: editor.duplicate !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
9165
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "editor-duplicate", label: t.duplicateOption, value: editor.duplicate !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
8571
9166
  s.editor.duplicate = v;
8572
9167
  return s;
8573
9168
  }) }),
8574
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToggleField2, { name: "editor-clipboard", label: t.clipboardOption, value: editor.clipboard !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
9169
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToggleField2, { name: "editor-clipboard", label: t.clipboardOption, value: editor.clipboard !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
8575
9170
  s.editor.clipboard = v;
8576
9171
  return s;
8577
9172
  }) }),
8578
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9173
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8579
9174
  SelectField2,
8580
9175
  {
8581
9176
  name: "editor-hiddenBlocks",
@@ -8589,9 +9184,9 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8589
9184
  })
8590
9185
  }
8591
9186
  ),
8592
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: data.hiddenAttribute ? t.hiddenBlocksHelp : t.hiddenAttributeOff })
9187
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: data.hiddenAttribute ? t.hiddenBlocksHelp : t.hiddenAttributeOff })
8593
9188
  ] }) }),
8594
- data.historyTypes && settings.history && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9189
+ data.historyTypes && settings.history && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8595
9190
  HistorySettings,
8596
9191
  {
8597
9192
  types: data.historyTypes,
@@ -8606,9 +9201,9 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8606
9201
  })
8607
9202
  }
8608
9203
  ),
8609
- (data.contentTypes || []).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 4, "data-testid": "content-types", children: [
8610
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "beta", tag: "h2", children: t.contentTypes }),
8611
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: t.contentTypesHelp }),
9204
+ (data.contentTypes || []).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 4, "data-testid": "content-types", children: [
9205
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "beta", tag: "h2", children: t.contentTypes }),
9206
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.contentTypesHelp }),
8612
9207
  data.contentTypes.map((type) => {
8613
9208
  const entry = settings.contentTypes?.[type.uid] || {};
8614
9209
  const set2 = (key, value, fallback) => update((s) => {
@@ -8620,9 +9215,9 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8620
9215
  else delete s.contentTypes[type.uid];
8621
9216
  return s;
8622
9217
  });
8623
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
8624
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 6, alignItems: "flex-end", wrap: "wrap", "data-testid": `content-type-${type.uid}`, children: [
8625
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { style: { minWidth: 220 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9218
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
9219
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 6, alignItems: "flex-end", wrap: "wrap", "data-testid": `content-type-${type.uid}`, children: [
9220
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { style: { minWidth: 220 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8626
9221
  ToggleField2,
8627
9222
  {
8628
9223
  name: `type-enabled-${type.uid}`,
@@ -8632,7 +9227,7 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8632
9227
  onChange: (v) => set2("enabled", v, true)
8633
9228
  }
8634
9229
  ) }),
8635
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { style: { minWidth: 240 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9230
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { style: { minWidth: 240 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8636
9231
  SelectField2,
8637
9232
  {
8638
9233
  name: `type-mode-${type.uid}`,
@@ -8644,9 +9239,9 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8644
9239
  }
8645
9240
  ) })
8646
9241
  ] }),
8647
- entry.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SidebarEditor, { type, entry, set: set2, t, disabled: !canUpdate || saving, SelectField: SelectField2, TextField: TextField2 }),
8648
- entry.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 3, paddingLeft: 4, children: [
8649
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9242
+ entry.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SidebarEditor, { type, entry, set: set2, t, disabled: !canUpdate || saving, SelectField: SelectField2, TextField: TextField2 }),
9243
+ entry.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 3, paddingLeft: 4, children: [
9244
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8650
9245
  ToggleField2,
8651
9246
  {
8652
9247
  name: `type-pane-${type.uid}`,
@@ -8659,7 +9254,7 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8659
9254
  }
8660
9255
  }
8661
9256
  ),
8662
- (entry.previewToolbar || entry.previewDevices) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9257
+ (entry.previewToolbar || entry.previewDevices) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8663
9258
  PaneEditor,
8664
9259
  {
8665
9260
  id: `type-${type.uid}`,
@@ -8674,18 +9269,18 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8674
9269
  ] })
8675
9270
  ] }, type.uid);
8676
9271
  }),
8677
- badSidebar && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { role: "alert", textColor: "danger600", children: t.sidebarInvalidSave })
9272
+ badSidebar && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { role: "alert", textColor: "danger600", children: t.sidebarInvalidSave })
8678
9273
  ] }) }),
8679
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
8680
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "beta", tag: "h2", children: t.components }),
8681
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Searchbar, { name: "component-filter", value: filter, placeholder: t.filter, clearLabel: t.clear, onClear: () => setFilter(""), onChange: (e) => setFilter(e.target.value), children: t.filter }),
8682
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", "data-testid": "components-count", children: t.f("countAll", { count: components.length }) }),
8683
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Grid2, { "data-testid": "components-grid", children: components.map((component) => {
9274
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Box, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
9275
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "beta", tag: "h2", children: t.components }),
9276
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Searchbar, { name: "component-filter", value: filter, placeholder: t.filter, clearLabel: t.clear, onClear: () => setFilter(""), onChange: (e) => setFilter(e.target.value), children: t.filter }),
9277
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", "data-testid": "components-count", children: t.f("countAll", { count: components.length }) }),
9278
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Grid2, { "data-testid": "components-grid", children: components.map((component) => {
8684
9279
  const entry = settings.components[component.uid] || {};
8685
9280
  const meta = { ...catalog.components?.[component.uid] || {}, ...media[component.uid] || {} };
8686
9281
  const candidates = candidatesFor(component.uid, meta, catalog);
8687
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Card2, { "data-testid": `settings-${component.uid}`, children: [
8688
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9282
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Card2, { "data-testid": `settings-${component.uid}`, children: [
9283
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8689
9284
  Thumb,
8690
9285
  {
8691
9286
  candidates,
@@ -8696,23 +9291,23 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8696
9291
  onResolved: (index) => setSources((current) => current[component.uid] === index ? current : { ...current, [component.uid]: index })
8697
9292
  }
8698
9293
  ),
8699
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "flex-start", gap: 2, children: [
8700
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { fontWeight: "bold", textColor: "neutral800", children: component.displayName }),
8701
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: [
9294
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "flex-start", gap: 2, children: [
9295
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { fontWeight: "bold", textColor: "neutral800", children: component.displayName }),
9296
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: [
8702
9297
  component.uid,
8703
9298
  " \xB7 ",
8704
9299
  component.category
8705
9300
  ] }),
8706
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Typography, { variant: "pi", "data-testid": `source-${component.uid}`, children: [
9301
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Typography, { variant: "pi", "data-testid": `source-${component.uid}`, children: [
8707
9302
  t.source,
8708
9303
  ": ",
8709
9304
  sourceOf(component.uid, Boolean(meta.manualImage)),
8710
9305
  meta.manualName ? ` (${meta.manualName})` : ""
8711
9306
  ] }),
8712
- meta.manualMissing && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", role: "alert", textColor: "danger600", children: t.brokenMedia }),
8713
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { gap: 2, wrap: "wrap", children: [
8714
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Button, { variant: "secondary", size: "S", disabled: !canUpdate || saving, onClick: () => setPicking(component.uid), children: entry.mediaId ? t.replace : t.choose }),
8715
- entry.mediaId && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Button, { variant: "tertiary", size: "S", disabled: !canUpdate || saving, onClick: () => {
9307
+ meta.manualMissing && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", role: "alert", textColor: "danger600", children: t.brokenMedia }),
9308
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 2, wrap: "wrap", children: [
9309
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Button, { variant: "secondary", size: "S", disabled: !canUpdate || saving, onClick: () => setPicking(component.uid), children: entry.mediaId ? t.replace : t.choose }),
9310
+ entry.mediaId && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Button, { variant: "tertiary", size: "S", disabled: !canUpdate || saving, onClick: () => {
8716
9311
  update((s) => {
8717
9312
  delete s.components[component.uid]?.mediaId;
8718
9313
  if (!Object.keys(s.components[component.uid] || {}).length) delete s.components[component.uid];
@@ -8725,7 +9320,7 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8725
9320
  });
8726
9321
  }, children: t.useAutomatic })
8727
9322
  ] }),
8728
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9323
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8729
9324
  SelectField2,
8730
9325
  {
8731
9326
  name: `template-${component.uid}`,
@@ -8739,7 +9334,7 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8739
9334
  })
8740
9335
  }
8741
9336
  ),
8742
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9337
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8743
9338
  SelectField2,
8744
9339
  {
8745
9340
  name: `typology-${component.uid}`,
@@ -8750,7 +9345,7 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8750
9345
  onChange: (v) => setComponent(component.uid, "typology", v === "auto" ? void 0 : v)
8751
9346
  }
8752
9347
  ),
8753
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9348
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8754
9349
  TagsField,
8755
9350
  {
8756
9351
  name: `tags-${component.uid}`,
@@ -8761,12 +9356,12 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8761
9356
  onChange: (tags) => setComponent(component.uid, "tags", tags.length ? tags : void 0)
8762
9357
  }
8763
9358
  ),
8764
- meta.variants?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", "data-testid": `variants-${component.uid}`, children: [
9359
+ meta.variants?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", "data-testid": `variants-${component.uid}`, children: [
8765
9360
  t.variantsFromCode,
8766
9361
  ": ",
8767
9362
  meta.variants.map((item) => localized(item.label, t.locale) || item.id).join(", ")
8768
9363
  ] }),
8769
- catalog.groups?.[component.uid] && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9364
+ catalog.groups?.[component.uid] && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8770
9365
  LayoutFields,
8771
9366
  {
8772
9367
  component,
@@ -8781,7 +9376,7 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8781
9376
  ] }, component.uid);
8782
9377
  }) })
8783
9378
  ] }) }),
8784
- picking && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MediaPicker2, { onClose: () => setPicking(null), onSelect: (asset) => {
9379
+ picking && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MediaPicker2, { onClose: () => setPicking(null), onSelect: (asset) => {
8785
9380
  const uid = picking;
8786
9381
  setPicking(null);
8787
9382
  if (!asset?.id) return;
@@ -8797,8 +9392,8 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
8797
9392
  function LayoutFields({ component, layout, set: set2, t, disabled, SelectField: SelectField2 }) {
8798
9393
  const fields = (component.layoutFields || []).map((name) => ({ value: name, label: name }));
8799
9394
  const change = (key, value) => set2(key === "columnsField" && value === "none" ? void 0 : Object.fromEntries(Object.entries({ ...layout, [key]: value }).filter(([, v]) => v !== "none" && v !== void 0)));
8800
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system5.Flex, { direction: "column", alignItems: "stretch", gap: 2, "data-testid": `layout-${component.uid}`, style: { width: "100%" }, children: [
8801
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9395
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { direction: "column", alignItems: "stretch", gap: 2, "data-testid": `layout-${component.uid}`, style: { width: "100%" }, children: [
9396
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8802
9397
  SelectField2,
8803
9398
  {
8804
9399
  name: `layout-columns-${component.uid}`,
@@ -8809,8 +9404,8 @@ function LayoutFields({ component, layout, set: set2, t, disabled, SelectField:
8809
9404
  onChange: (v) => change("columnsField", v)
8810
9405
  }
8811
9406
  ),
8812
- layout?.columnsField && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
8813
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9407
+ layout?.columnsField && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
9408
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8814
9409
  SelectField2,
8815
9410
  {
8816
9411
  name: `layout-mobile-${component.uid}`,
@@ -8821,7 +9416,7 @@ function LayoutFields({ component, layout, set: set2, t, disabled, SelectField:
8821
9416
  onChange: (v) => change("mobileColumnsField", v)
8822
9417
  }
8823
9418
  ),
8824
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9419
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8825
9420
  SelectField2,
8826
9421
  {
8827
9422
  name: `layout-max-${component.uid}`,
@@ -8833,7 +9428,7 @@ function LayoutFields({ component, layout, set: set2, t, disabled, SelectField:
8833
9428
  }
8834
9429
  )
8835
9430
  ] }),
8836
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system5.Typography, { variant: "pi", textColor: "neutral600", children: fields.length ? t.layoutHelp : t.layoutNoFields })
9431
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: fields.length ? t.layoutHelp : t.layoutNoFields })
8837
9432
  ] });
8838
9433
  }
8839
9434
  function register(app, Component2, to) {
@@ -8852,13 +9447,13 @@ function register(app, Component2, to) {
8852
9447
  }
8853
9448
 
8854
9449
  // admin/catalog.ts
8855
- var React11 = __toESM(require("react"));
9450
+ var React13 = __toESM(require("react"));
8856
9451
 
8857
9452
  // admin/FieldHelp.tsx
8858
- var React10 = __toESM(require("react"));
9453
+ var React12 = __toESM(require("react"));
8859
9454
  var import_styled_components8 = __toESM(require("styled-components"));
8860
- var import_design_system6 = require("@strapi/design-system");
8861
- var import_jsx_runtime11 = require("react/jsx-runtime");
9455
+ var import_design_system8 = require("@strapi/design-system");
9456
+ var import_jsx_runtime13 = require("react/jsx-runtime");
8862
9457
  var HelpButton = import_styled_components8.default.button`
8863
9458
  display: inline-flex; padding: 0; border: 0; border-radius: 50%; background: none; cursor: help; color: inherit;
8864
9459
  &:hover, &:focus-visible { color: ${({ theme }) => theme.colors.primary600}; }
@@ -8866,13 +9461,13 @@ var HelpButton = import_styled_components8.default.button`
8866
9461
  `;
8867
9462
  function FieldHelp({ text, previous, title }) {
8868
9463
  const m = useMessages();
8869
- const kept = React10.isValidElement(previous) && previous.props.title ? React10.cloneElement(previous, { title }) : previous;
8870
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system6.Flex, { gap: 1, alignItems: "center", children: [
8871
- kept,
8872
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.Tooltip, { label: text, style: { maxWidth: 320 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(HelpButton, { type: "button", "aria-label": m.fieldHelp, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "info", size: 14 }) }) })
9464
+ const kept2 = React12.isValidElement(previous) && previous.props.title ? React12.cloneElement(previous, { title }) : previous;
9465
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_design_system8.Flex, { gap: 1, alignItems: "center", children: [
9466
+ kept2,
9467
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_design_system8.Tooltip, { label: text, style: { maxWidth: 320 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(HelpButton, { type: "button", "aria-label": m.fieldHelp, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: "info", size: 14 }) }) })
8873
9468
  ] });
8874
9469
  }
8875
- var helpAction = (text, previous) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FieldHelp, { text, previous, title: React10.isValidElement(previous) && previous.props.title || { id: "blockscene.fieldHelp" } });
9470
+ var helpAction = (text, previous) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FieldHelp, { text, previous, title: React12.isValidElement(previous) && previous.props.title || { id: "blockscene.fieldHelp" } });
8876
9471
 
8877
9472
  // admin/catalog.ts
8878
9473
  var cached = null;
@@ -8885,8 +9480,8 @@ var load = (get) => flight || (flight = get("/blockscene/catalog").then(({ data
8885
9480
  flight = null;
8886
9481
  }));
8887
9482
  function useCatalog(get) {
8888
- const [catalog, setCatalog] = React11.useState(null);
8889
- React11.useEffect(() => {
9483
+ const [catalog, setCatalog] = React13.useState(null);
9484
+ React13.useEffect(() => {
8890
9485
  let active = true;
8891
9486
  load(get).then((data) => {
8892
9487
  if (active) setCatalog(data);
@@ -8921,83 +9516,624 @@ var labelsHook = (get, relabel, drop) => (args) => {
8921
9516
  }
8922
9517
  };
8923
9518
 
8924
- // admin/strapi4.tsx
8925
- var import_jsx_runtime12 = require("react/jsx-runtime");
8926
- function Modal({ open, onOpenChange, trigger, title, children, width = "80vw" }) {
8927
- const id = React12.useId();
8928
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
8929
- trigger,
8930
- open && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.ModalLayout, { onClose: () => onOpenChange(false), labelledBy: id, width, children: [
8931
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.ModalHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { id, variant: "beta", children: title }) }),
8932
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.ModalBody, { children })
9519
+ // admin/LazyInput.tsx
9520
+ var React14 = __toESM(require("react"));
9521
+ var import_design_system9 = require("@strapi/design-system");
9522
+ var import_styled_components9 = __toESM(require("styled-components"));
9523
+
9524
+ // admin/sanitize.mjs
9525
+ var DROP = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "IFRAME", "FRAME", "OBJECT", "EMBED", "LINK", "META", "BASE", "FORM", "TEMPLATE", "NOSCRIPT"]);
9526
+ var URL_ATTRS = /* @__PURE__ */ new Set(["href", "src", "xlink:href", "action", "formaction", "srcset", "poster", "background"]);
9527
+ var unsafeUrl = (value) => /^(javascript|vbscript|data:text\/html)/i.test(String(value).replace(/[\u0000- ]/g, ""));
9528
+ var STYLE_PROPS = /* @__PURE__ */ new Set([
9529
+ "color",
9530
+ "background-color",
9531
+ "text-align",
9532
+ "font-size",
9533
+ "font-weight",
9534
+ "font-style",
9535
+ "font-family",
9536
+ "text-decoration",
9537
+ "text-transform",
9538
+ "line-height",
9539
+ "letter-spacing",
9540
+ "vertical-align",
9541
+ "width",
9542
+ "height",
9543
+ "border-color"
9544
+ ]);
9545
+ function safeStyle(value) {
9546
+ return String(value).split(";").map((part) => part.split(":")).filter(([prop, ...rest]) => {
9547
+ const name = prop?.trim().toLowerCase();
9548
+ const val = rest.join(":").trim();
9549
+ return STYLE_PROPS.has(name) && val && !/url\s*\(|expression|[\\<>]|@import/i.test(val);
9550
+ }).map(([prop, ...rest]) => `${prop.trim().toLowerCase()}: ${rest.join(":").trim()}`).join("; ");
9551
+ }
9552
+ function cleanTree(root) {
9553
+ for (const el of [...root.children]) {
9554
+ if (DROP.has(String(el.tagName).toUpperCase())) {
9555
+ el.remove();
9556
+ continue;
9557
+ }
9558
+ for (const { name, value } of [...el.attributes]) {
9559
+ const key = name.toLowerCase();
9560
+ if (key === "style") {
9561
+ const kept2 = safeStyle(value);
9562
+ if (kept2) el.setAttribute(name, kept2);
9563
+ else el.removeAttribute(name);
9564
+ } else if (key.startsWith("on") || key === "srcdoc" || URL_ATTRS.has(key) && unsafeUrl(value)) el.removeAttribute(name);
9565
+ }
9566
+ cleanTree(el);
9567
+ }
9568
+ return root;
9569
+ }
9570
+ function sanitizeHtml(html) {
9571
+ if (typeof html !== "string" || !html.trim() || typeof DOMParser === "undefined") return "";
9572
+ return cleanTree(new DOMParser().parseFromString(html, "text/html").body).innerHTML;
9573
+ }
9574
+
9575
+ // admin/LazyInput.tsx
9576
+ var import_jsx_runtime14 = require("react/jsx-runtime");
9577
+ var config = { on: false, fields: [] };
9578
+ var listeners = /* @__PURE__ */ new Set();
9579
+ function setLazyConfig(next) {
9580
+ if (next.on === config.on && next.fields.join() === config.fields.join()) return;
9581
+ config = next;
9582
+ listeners.forEach((run) => run());
9583
+ }
9584
+ var subscribe = (run) => {
9585
+ listeners.add(run);
9586
+ return () => {
9587
+ listeners.delete(run);
9588
+ };
9589
+ };
9590
+ var read2 = () => config;
9591
+ var lazyFor = (uid) => config.on && config.fields.includes(uid);
9592
+ var Preview = import_styled_components9.default.div`
9593
+ min-height: 240px; border: 1px solid ${({ theme }) => theme.colors.neutral200}; border-radius: 4px; overflow: hidden;
9594
+ background: ${({ theme, $disabled }) => $disabled ? theme.colors.neutral150 : theme.colors.neutral0};
9595
+ color: ${({ theme }) => theme.colors.neutral800}; font-size: 1.4rem; line-height: 1.5;
9596
+ cursor: ${({ $disabled }) => $disabled ? "default" : "text"};
9597
+ &:hover { border-color: ${({ theme, $disabled }) => $disabled ? theme.colors.neutral200 : theme.colors.primary600}; }
9598
+ &:focus-visible { outline: 2px solid ${({ theme }) => theme.colors.primary600}; outline-offset: 2px; }
9599
+ /* Stands in for the editor toolbar, so mounting the editor barely moves the page. */
9600
+ & > [data-bar] { height: 40px; display: flex; align-items: center; padding: 0 12px; border-bottom: 1px solid ${({ theme }) => theme.colors.neutral200}; }
9601
+ & > [data-body] { padding: 8px 12px; overflow-wrap: anywhere; }
9602
+ & [data-body] img { max-width: 100%; height: auto; }
9603
+ & [data-body] :is(ul, ol) { padding-left: 2.4rem; list-style: revert; }
9604
+ & [data-body] :is(h1, h2, h3, h4, h5, h6) { font-weight: 600; margin: 0.6em 0 0.3em; }
9605
+ & [data-body] h1 { font-size: 2.4rem; } & [data-body] h2 { font-size: 2rem; } & [data-body] h3 { font-size: 1.8rem; } & [data-body] h4 { font-size: 1.6rem; }
9606
+ & [data-body] p { margin: 0.4em 0; }
9607
+ & [data-body] a { color: ${({ theme }) => theme.colors.primary600}; text-decoration: underline; }
9608
+ `;
9609
+ function Placeholder({ name, label, hint, error, required, labelAction, placeholder, value, disabled, onActivate }) {
9610
+ const t = useMessages();
9611
+ const html = React14.useMemo(() => typeof value === "string" ? sanitizeHtml(value) : value == null ? "" : null, [value]);
9612
+ const activate = disabled ? void 0 : (event) => {
9613
+ event.preventDefault();
9614
+ onActivate();
9615
+ };
9616
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system9.Field.Root, { id: name, name, error, hint, required, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_design_system9.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
9617
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system9.Field.Label, { action: labelAction, children: label }),
9618
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
9619
+ Preview,
9620
+ {
9621
+ id: name,
9622
+ "data-blockscene-lazy": name,
9623
+ $disabled: Boolean(disabled),
9624
+ role: disabled ? void 0 : "button",
9625
+ tabIndex: disabled ? void 0 : 0,
9626
+ "aria-disabled": disabled || void 0,
9627
+ "aria-label": disabled ? void 0 : `${label || name}: ${t.lazyEdit}`,
9628
+ onClick: activate,
9629
+ onFocus: activate,
9630
+ onKeyDown: disabled ? void 0 : (e) => {
9631
+ if (e.key === "Enter" || e.key === " ") activate?.(e);
9632
+ },
9633
+ children: [
9634
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-bar": true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system9.Typography, { variant: "pi", textColor: "neutral500", children: disabled ? "" : t.lazyEdit }) }),
9635
+ html === null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-body": true, children: JSON.stringify(value) }) : html ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-body": true, dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-body": true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system9.Typography, { textColor: "neutral500", children: placeholder || "" }) })
9636
+ ]
9637
+ }
9638
+ ),
9639
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system9.Field.Hint, {}),
9640
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system9.Field.Error, {})
9641
+ ] }) });
9642
+ }
9643
+ function lazyInput(uid, Real) {
9644
+ const Lazy = React14.forwardRef((props, ref) => {
9645
+ React14.useSyncExternalStore(subscribe, read2);
9646
+ const [active, setActive] = React14.useState(() => !lazyFor(uid));
9647
+ const box = React14.useRef(null);
9648
+ const focus = React14.useRef(false);
9649
+ React14.useEffect(() => {
9650
+ if (!active || !focus.current) return;
9651
+ focus.current = false;
9652
+ let frame2 = 0;
9653
+ const started = performance.now();
9654
+ const poll = () => {
9655
+ const editable = box.current?.querySelector(".ck-editor__editable");
9656
+ if (editable?.isContentEditable) return editable.focus();
9657
+ if (performance.now() - started < 5e3) frame2 = requestAnimationFrame(poll);
9658
+ };
9659
+ poll();
9660
+ return () => cancelAnimationFrame(frame2);
9661
+ }, [active]);
9662
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ref: box, style: { display: "contents" }, children: active || !lazyFor(uid) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Real, { ...props, ref }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Placeholder, { ...props, onActivate: () => {
9663
+ focus.current = true;
9664
+ setActive(true);
9665
+ } }) });
9666
+ });
9667
+ Lazy.displayName = `BlocksceneLazy(${uid})`;
9668
+ return Lazy;
9669
+ }
9670
+ function wrapCustomFields(app) {
9671
+ const all = app?.customFields?.getAll?.() || {};
9672
+ for (const [uid, field] of Object.entries(all)) {
9673
+ const load2 = field?.components?.Input;
9674
+ if (typeof load2 !== "function" || load2.blockscene) continue;
9675
+ const wrapped = () => Promise.resolve(load2()).then((mod) => lazyFor(uid) ? { ...mod, default: lazyInput(uid, mod?.default ?? mod) } : mod);
9676
+ wrapped.blockscene = true;
9677
+ field.components.Input = wrapped;
9678
+ }
9679
+ }
9680
+
9681
+ // admin/Activity.tsx
9682
+ var React15 = __toESM(require("react"));
9683
+ var import_design_system10 = require("@strapi/design-system");
9684
+ var import_admin3 = require("@strapi/strapi/admin");
9685
+ var import_jsx_runtime15 = require("react/jsx-runtime");
9686
+ var ACTIVITY = [{ action: "plugin::blockscene.activity.read", subject: null }];
9687
+ var TRASH = ["read", "restore", "purge"].map((name) => ({ action: `plugin::blockscene.trash.${name}`, subject: null }));
9688
+ var ACTIONS = ["create", "update", "publish", "unpublish", "discard", "delete", "restore", "purge"];
9689
+ var DAY = 24 * 60 * 60 * 1e3;
9690
+ var contentMenuLink = (Component2) => ({
9691
+ to: "plugins/blockscene",
9692
+ icon: () => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { name: "clock", size: 20 }),
9693
+ intlLabel: { id: "blockscene.contentMenu", defaultMessage: "Activity and trash" },
9694
+ permissions: [...ACTIVITY, TRASH[0]],
9695
+ // Not an `async` function: Strapi 5 warns on AsyncFunction loaders.
9696
+ Component: () => Promise.resolve({ default: Component2 })
9697
+ });
9698
+ var when = (t, at) => {
9699
+ try {
9700
+ return new Date(at).toLocaleString(t.locale, { dateStyle: "medium", timeStyle: "short" });
9701
+ } catch {
9702
+ return at;
9703
+ }
9704
+ };
9705
+ var editUrl = (type, documentId, locale) => {
9706
+ const base = window.location.pathname.split("/plugins/blockscene")[0];
9707
+ const kind = type?.kind === "singleType" ? "single-types" : "collection-types";
9708
+ return `${base}/content-manager/${kind}/${type.uid}${kind === "single-types" ? "" : `/${encodeURIComponent(documentId)}`}${locale ? `?plugins[i18n][locale]=${encodeURIComponent(locale)}` : ""}`;
9709
+ };
9710
+ var query = (params) => new URLSearchParams(Object.entries(params).filter(([, v]) => v !== "" && v != null).map(([k, v]) => [k, String(v)])).toString();
9711
+ var Select = ({ label, value, onChange, options, name }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Box, { style: { minWidth: 180 }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Field.Root, { name, children: [
9712
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Field.Label, { children: label }),
9713
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.SingleSelect, { value, onChange: (v) => onChange(String(v)), children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.SingleSelectOption, { value: o.value, children: o.label }, o.value)) })
9714
+ ] }) });
9715
+ var Input = ({ label, value, onChange, name, type = "text" }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Box, { style: { minWidth: 160 }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Field.Root, { name, children: [
9716
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Field.Label, { children: label }),
9717
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.TextInput, { name, type, value, onChange: (e) => onChange(e.target.value) })
9718
+ ] }) });
9719
+ function Pager({ t, pagination, setPage }) {
9720
+ if (!pagination?.total) return null;
9721
+ const { page, pageCount, total } = pagination;
9722
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { justifyContent: "space-between", alignItems: "center", paddingTop: 4, children: [
9723
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", textColor: "neutral600", children: t.f("contentPage", { page, pages: Math.max(pageCount, 1), total }) }),
9724
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { gap: 2, children: [
9725
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { variant: "tertiary", size: "S", disabled: page <= 1, onClick: () => setPage(page - 1), children: t.contentPrevious }),
9726
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { variant: "tertiary", size: "S", disabled: page >= pageCount, onClick: () => setPage(page + 1), children: t.contentNext })
8933
9727
  ] })
8934
9728
  ] });
8935
9729
  }
8936
- var Menu2 = ({ label, testid, items: items2 }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { "data-testid": testid, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.SimpleMenu, { variant: "tertiary", size: "S", "aria-label": label, title: label, endIcon: null, label: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: "more", size: 16 }), children: items2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.MenuItem, { onClick: item.onSelect, "data-testid": item.testid, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { as: "span", gap: 2, alignItems: "center", children: [
8937
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: item.icon, size: 16 }),
8938
- item.label
8939
- ] }) }, item.testid)) }) });
8940
- function overlayVariant(c, components, zone, at, uid, values) {
8941
- const row = variantRow(components[uid], components, values, (n) => [...Array(n).keys()]);
8942
- for (const name of Object.keys(values)) if (name in row) c.onChange({ target: { name: `${zone}.${at}.${name}`, value: row[name] } });
8943
- }
8944
- function useRowForm(c, components) {
8945
- const toggleNotification = (0, import_helper_plugin.useNotification)();
8946
- const latest = React12.useRef(c.modifiedData);
8947
- latest.current = c.modifiedData;
8948
- if (typeof c.onChange !== "function") return null;
9730
+ function useList(get, path, params, refresh = 0) {
9731
+ const [state, setState] = React15.useState({ data: null, failed: false });
9732
+ const key = `${path}?${query(params)}`;
9733
+ React15.useEffect(() => {
9734
+ let active = true;
9735
+ setState((s) => ({ data: s.data, failed: false, loading: true }));
9736
+ get(`/blockscene${key}`).then(({ data }) => active && setState({ data, failed: false })).catch(() => active && setState({ data: null, failed: true }));
9737
+ return () => {
9738
+ active = false;
9739
+ };
9740
+ }, [get, key, refresh]);
9741
+ return state;
9742
+ }
9743
+ var Doc = ({ t, type, row, documentId, locale }) => {
9744
+ const title = row.title || t.contentUntitled;
9745
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
9746
+ row.exists && type ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Link, { href: editUrl(type, documentId, locale), children: title }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { fontWeight: "bold", children: title }),
9747
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Typography, { variant: "pi", textColor: "neutral600", children: [
9748
+ type?.displayName || row.contentType,
9749
+ locale ? ` \xB7 ${locale}` : "",
9750
+ row.exists === false ? ` \xB7 ${t.contentGone}` : ""
9751
+ ] })
9752
+ ] });
9753
+ };
9754
+ function ActivityTab({ t, get }) {
9755
+ const [filters, setFilters] = React15.useState({ actor: "", contentType: "", action: "", from: "", to: "", q: "" });
9756
+ const [search, setSearch] = React15.useState("");
9757
+ const [page, setPage] = React15.useState(1);
9758
+ const set2 = (key, value) => {
9759
+ setFilters((f) => ({ ...f, [key]: value }));
9760
+ setPage(1);
9761
+ };
9762
+ const day = (value, end) => {
9763
+ if (!value) return "";
9764
+ const d = /* @__PURE__ */ new Date(`${value}T${end ? "23:59:59.999" : "00:00:00"}`);
9765
+ return Number.isFinite(d.getTime()) ? d.toISOString() : "";
9766
+ };
9767
+ const { data, failed } = useList(get, "/activity", { ...filters, from: day(filters.from, false), to: day(filters.to, true), page, pageSize: 25 });
9768
+ const types = new Map((data?.types || []).map((type) => [type.uid, type]));
9769
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
9770
+ data && !data.enabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Box, { padding: 3, background: "warning100", hasRadius: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", textColor: "warning700", children: t.contentOff }) }),
9771
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { tag: "form", gap: 3, wrap: "wrap", alignItems: "flex-end", onSubmit: (e) => {
9772
+ e.preventDefault();
9773
+ set2("q", search.trim());
9774
+ }, children: [
9775
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
9776
+ Select,
9777
+ {
9778
+ name: "actor",
9779
+ label: t.activityPerson,
9780
+ value: filters.actor,
9781
+ onChange: (v) => set2("actor", v),
9782
+ options: [{ value: "", label: t.activityAnyone }, ...(data?.actors || []).map((a) => ({ value: a.actor, label: a.actorName || (a.actor === "system" ? t.historySystem : a.actor) }))]
9783
+ }
9784
+ ),
9785
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
9786
+ Select,
9787
+ {
9788
+ name: "contentType",
9789
+ label: t.activityType,
9790
+ value: filters.contentType,
9791
+ onChange: (v) => set2("contentType", v),
9792
+ options: [{ value: "", label: t.activityAnyType }, ...(data?.types || []).map((type) => ({ value: type.uid, label: type.displayName }))]
9793
+ }
9794
+ ),
9795
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
9796
+ Select,
9797
+ {
9798
+ name: "action",
9799
+ label: t.activityAction,
9800
+ value: filters.action,
9801
+ onChange: (v) => set2("action", v),
9802
+ options: [{ value: "", label: t.activityAnyAction }, ...ACTIONS.map((a) => ({ value: a, label: t.historyActions[a] || a }))]
9803
+ }
9804
+ ),
9805
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Input, { name: "from", type: "date", label: t.activityFrom, value: filters.from, onChange: (v) => set2("from", v) }),
9806
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Input, { name: "to", type: "date", label: t.activityTo, value: filters.to, onChange: (v) => set2("to", v) }),
9807
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Input, { name: "q", label: t.activitySearch, value: search, onChange: setSearch }),
9808
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { type: "submit", variant: "secondary", children: t.activitySearchButton }),
9809
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { type: "button", variant: "tertiary", onClick: () => {
9810
+ setSearch("");
9811
+ setFilters({ actor: "", contentType: "", action: "", from: "", to: "", q: "" });
9812
+ setPage(1);
9813
+ }, children: t.contentClear })
9814
+ ] }),
9815
+ failed ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { role: "alert", textColor: "danger600", children: t.activityFailed }) : !data ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { textColor: "neutral600", children: t.contentLoading }) : !data.results.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { textColor: "neutral600", children: t.activityEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Box, { children: [
9816
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Table, { colCount: 4, rowCount: data.results.length + 1, "data-testid": "blockscene-activity", children: [
9817
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Thead, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Tr, { children: [
9818
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Th, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "sigma", children: t.activityWhen }) }),
9819
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Th, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "sigma", children: t.activityDocument }) }),
9820
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Th, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "sigma", children: t.activityWho }) }),
9821
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Th, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "sigma", children: t.activityWhat }) })
9822
+ ] }) }),
9823
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Tbody, { children: data.results.map((event) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Tr, { "data-testid": `activity-${event.id}`, children: [
9824
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Td, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", children: when(t, event.at) }) }),
9825
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Td, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Doc, { t, type: types.get(event.contentType), row: event, documentId: event.relatedDocumentId, locale: event.locale }) }),
9826
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Td, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", children: event.actorName || (event.actor === "system" ? t.historySystem : event.actor) }) }),
9827
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Td, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
9828
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "omega", fontWeight: "bold", children: t.historyActions[event.action] || event.action }),
9829
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", textColor: event.summary?.missing ? "warning700" : "neutral700", children: ["delete", "purge"].includes(event.action) ? "" : [event.summary?.restoredFrom ? t.activityRestoredFrom : "", summaryText(t, event.summary)].filter(Boolean).join(" \xB7 ") })
9830
+ ] }) })
9831
+ ] }, event.id)) })
9832
+ ] }),
9833
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Pager, { t, pagination: data.pagination, setPage })
9834
+ ] })
9835
+ ] });
9836
+ }
9837
+ function Report({ t, report }) {
9838
+ const locale = (value) => value ?? t.contentNone;
9839
+ const line = (item) => item.code === "incoming" ? t.f("report.incoming", item) : t.f(`report.${item.code}`, { ...item, locale: locale(item.locale), locales: (item.locales || []).map(locale).join(", "), fields: (item.fields || []).join(", ") });
9840
+ const incoming = report.incoming && (report.incoming.reconnect || report.incoming.gone || report.incoming.replaced || report.incoming.published) ? [{ code: "incoming", ...report.incoming }] : [];
9841
+ const warnings = [...report.warnings || [], ...incoming];
9842
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { direction: "column", alignItems: "stretch", gap: 2, "data-testid": "restore-report", children: [
9843
+ report.blocking?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Box, { padding: 3, background: "danger100", hasRadius: true, children: [
9844
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", fontWeight: "bold", textColor: "danger700", children: t.restoreBlocked }),
9845
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { style: { margin: "4px 0 0", paddingLeft: 16 }, children: report.blocking.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", textColor: "danger700", children: line(item) }) }, i)) })
9846
+ ] }),
9847
+ warnings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Box, { padding: 3, background: "warning100", hasRadius: true, children: [
9848
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", fontWeight: "bold", textColor: "warning700", children: t.restoreWarnings }),
9849
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { style: { margin: "4px 0 0", paddingLeft: 16 }, children: warnings.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", textColor: "warning700", children: line(item) }) }, i)) })
9850
+ ] })
9851
+ ] });
9852
+ }
9853
+ function Preview2({ t, id, get, onClose }) {
9854
+ const [row, setRow] = React15.useState(null);
9855
+ const [failed, setFailed] = React15.useState(false);
9856
+ React15.useEffect(() => {
9857
+ get(`/blockscene/trash/${id}`).then(({ data }) => setRow(data)).catch(() => setFailed(true));
9858
+ }, [get, id]);
9859
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Modal.Root, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Modal.Content, { style: { width: "min(900px, 92vw)" }, children: [
9860
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Modal.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Modal.Title, { children: row?.title || t.trashPreview }) }),
9861
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Modal.Body, { children: failed ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { role: "alert", textColor: "danger600", children: t.trashFailed }) : !row ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { children: t.contentLoading }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { direction: "column", alignItems: "stretch", gap: 5, "data-testid": "trash-preview", children: [
9862
+ row.incoming > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", textColor: "neutral600", children: t.f("trashIncoming", { count: row.incoming }) }),
9863
+ row.entries.map((entry, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
9864
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Typography, { variant: "delta", tag: "h3", children: [
9865
+ entry.locale || t.contentNone,
9866
+ entry.status ? ` \xB7 ${entry.status === "published" ? t.trashPublished : t.trashDraft}` : ""
9867
+ ] }),
9868
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "sigma", textColor: "neutral600", children: t.trashFields }),
9869
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dl", { style: { display: "grid", gridTemplateColumns: "minmax(120px, max-content) 1fr", gap: "4px 16px", margin: 0 }, children: entry.fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(React15.Fragment, { children: [
9870
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dt", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", fontWeight: "bold", children: field.name }) }),
9871
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dd", { style: { margin: 0, wordBreak: "break-word" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", children: field.count !== void 0 ? t.f("trashItems", { count: field.count }) : field.value }) })
9872
+ ] }, field.name)) }),
9873
+ entry.blocks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
9874
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "sigma", textColor: "neutral600", children: t.trashBlocks }),
9875
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ol", { style: { margin: 0, paddingLeft: 20 }, children: entry.blocks.map((block, j) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", children: block.name }) }, j)) })
9876
+ ] })
9877
+ ] }, i))
9878
+ ] }) }),
9879
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Modal.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Modal.Close, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { variant: "tertiary", children: t.trashClose }) }) })
9880
+ ] }) });
9881
+ }
9882
+ function TrashTab({ t, get, post, del, can }) {
9883
+ const { toggleNotification } = (0, import_admin3.useNotification)();
9884
+ const [contentType, setType] = React15.useState("");
9885
+ const [restored, setRestored] = React15.useState(false);
9886
+ const [page, setPage] = React15.useState(1);
9887
+ const [refresh, reload] = React15.useReducer((n) => n + 1, 0);
9888
+ const { data, failed } = useList(get, "/trash", { contentType, status: restored ? "restored" : "trashed", page, pageSize: 20 }, refresh);
9889
+ const [preview, setPreview] = React15.useState(null);
9890
+ const [restore, setRestore] = React15.useState(null);
9891
+ const [remove, setRemove] = React15.useState(null);
9892
+ const [busy, setBusy] = React15.useState(false);
9893
+ const types = new Map((data?.types || []).map((type) => [type.uid, type]));
9894
+ const title = (row) => row.title || t.contentUntitled;
9895
+ const check = async (row) => {
9896
+ setRestore({ row, report: null });
9897
+ try {
9898
+ const { data: data2 } = await get(`/blockscene/trash/${row.id}/check`);
9899
+ setRestore({ row, report: data2 });
9900
+ } catch {
9901
+ setRestore({ row, report: { blocking: [], warnings: [] }, failed: true });
9902
+ }
9903
+ };
9904
+ const confirmRestore = async () => {
9905
+ setBusy(true);
9906
+ try {
9907
+ const { data: result } = await post(`/blockscene/trash/${restore.row.id}/restore`, {});
9908
+ setRestore({ ...restore, done: result });
9909
+ reload();
9910
+ } catch (error) {
9911
+ const details = error?.response?.data?.error?.details;
9912
+ if (details) setRestore({ ...restore, report: details });
9913
+ else {
9914
+ setRestore(null);
9915
+ toggleNotification({ type: "danger", message: t.restoreFailed });
9916
+ }
9917
+ } finally {
9918
+ setBusy(false);
9919
+ }
9920
+ };
9921
+ const confirmRemove = async () => {
9922
+ setBusy(true);
9923
+ try {
9924
+ await del(`/blockscene/trash/${remove.id}`);
9925
+ toggleNotification({ type: "success", message: t.trashDeleted });
9926
+ reload();
9927
+ } catch {
9928
+ toggleNotification({ type: "danger", message: t.trashDeleteFailed });
9929
+ } finally {
9930
+ setBusy(false);
9931
+ setRemove(null);
9932
+ }
9933
+ };
9934
+ const expires = (at) => {
9935
+ const days = Math.floor((new Date(at).getTime() - Date.now()) / DAY);
9936
+ return days < 1 ? t.trashExpiresToday : t.f("trashExpiresIn", { days });
9937
+ };
9938
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
9939
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { gap: 4, wrap: "wrap", alignItems: "flex-end", children: [
9940
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
9941
+ Select,
9942
+ {
9943
+ name: "trash-type",
9944
+ label: t.activityType,
9945
+ value: contentType,
9946
+ onChange: (v) => {
9947
+ setType(v);
9948
+ setPage(1);
9949
+ },
9950
+ options: [{ value: "", label: t.activityAnyType }, ...(data?.types || []).map((type) => ({ value: type.uid, label: type.displayName }))]
9951
+ }
9952
+ ),
9953
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { gap: 2, paddingBottom: 2, children: [
9954
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Switch, { "aria-label": t.trashShowRestored, checked: restored, onCheckedChange: (v) => {
9955
+ setRestored(v);
9956
+ setPage(1);
9957
+ } }),
9958
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", children: t.trashShowRestored })
9959
+ ] })
9960
+ ] }),
9961
+ failed ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { role: "alert", textColor: "danger600", children: t.trashFailed }) : !data ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { textColor: "neutral600", children: t.contentLoading }) : !data.results.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { textColor: "neutral600", children: t.trashEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Box, { children: [
9962
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Table, { colCount: 5, rowCount: data.results.length + 1, "data-testid": "blockscene-trash", children: [
9963
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Thead, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Tr, { children: [
9964
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Th, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "sigma", children: t.activityDocument }) }),
9965
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Th, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "sigma", children: t.trashLocales }) }),
9966
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Th, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "sigma", children: t.trashDeletedBy }) }),
9967
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Th, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "sigma", children: restored ? t.trashRestoredAs : t.trashExpires }) }),
9968
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Th, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "sigma", children: " " }) })
9969
+ ] }) }),
9970
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Tbody, { children: data.results.map((row) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Tr, { "data-testid": `trash-${row.id}`, children: [
9971
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Td, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Doc, { t, type: types.get(row.contentType), row: { ...row, exists: void 0 }, documentId: row.relatedDocumentId, locale: null }) }),
9972
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Td, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", children: (row.locales || []).map((l) => l ?? t.contentNone).join(", ") }) }),
9973
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Td, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { direction: "column", alignItems: "flex-start", children: [
9974
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", children: row.actorName || (row.actor === "system" ? t.historySystem : row.actor) }),
9975
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", textColor: "neutral600", children: when(t, row.deletedAt) })
9976
+ ] }) }),
9977
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Td, { children: [
9978
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", children: restored ? row.restoredAt ? when(t, row.restoredAt) : "" : expires(row.expiresAt) }),
9979
+ restored && row.restoredAs && types.get(row.contentType) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Link, { href: editUrl(types.get(row.contentType), row.restoredAs, null), children: t.contentOpen }) })
9980
+ ] }),
9981
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Td, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { gap: 2, justifyContent: "flex-end", children: [
9982
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { variant: "tertiary", size: "S", onClick: () => setPreview(row.id), children: t.trashPreview }),
9983
+ !restored && can.canRestore && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { variant: "secondary", size: "S", onClick: () => check(row), "data-testid": `trash-restore-${row.id}`, children: t.trashRestore }),
9984
+ can.canPurge && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { variant: "danger-light", size: "S", onClick: () => setRemove(row), "data-testid": `trash-delete-${row.id}`, children: t.trashDelete })
9985
+ ] }) })
9986
+ ] }, row.id)) })
9987
+ ] }),
9988
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Pager, { t, pagination: data.pagination, setPage })
9989
+ ] }),
9990
+ preview !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Preview2, { t, id: preview, get, onClose: () => setPreview(null) }),
9991
+ restore && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Dialog.Root, { open: true, onOpenChange: (open) => !open && !busy && setRestore(null), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Dialog.Content, { children: [
9992
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Dialog.Header, { children: t.f("restoreTitle", { title: title(restore.row) }) }),
9993
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Flex, { direction: "column", alignItems: "stretch", gap: 3, width: "100%", children: restore.done ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Flex, { direction: "column", alignItems: "flex-start", gap: 2, role: "status", "data-testid": "restore-done", children: [
9994
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { textColor: "success700", children: restore.done.already ? t.restoreAlready : t.restoreDone }),
9995
+ restore.done.documentId && types.get(restore.row.contentType) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Link, { href: editUrl(types.get(restore.row.contentType), restore.done.documentId, restore.done.locales?.[0] ?? null), children: t.restoreOpen }),
9996
+ !restore.done.already && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Report, { t, report: { warnings: restore.done.warnings, incoming: restore.done.incoming && { ...restore.done.incoming, reconnect: restore.done.incoming.reconnected } } })
9997
+ ] }) : !restore.report ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { children: t.restoreChecking }) : restore.failed ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { role: "alert", textColor: "danger600", children: t.restoreFailed }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
9998
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Typography, { variant: "pi", children: [
9999
+ t.restoreIntro,
10000
+ " ",
10001
+ restore.report.documentId ? t.restoreInto : t.restoreNew
10002
+ ] }),
10003
+ restore.report.locales?.length > 0 && restore.report.locales[0] !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { variant: "pi", children: t.f("restoreLocales", { locales: restore.report.locales.join(", ") }) }),
10004
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Report, { t, report: restore.report })
10005
+ ] }) }) }),
10006
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Dialog.Footer, { children: [
10007
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Dialog.Cancel, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { variant: "tertiary", disabled: busy, children: restore.done ? t.trashClose : t.restoreCancel }) }),
10008
+ !restore.done && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { onClick: confirmRestore, loading: busy, disabled: busy || !restore.report || restore.failed || restore.report.blocking?.length > 0, "data-testid": "restore-confirm", children: t.restoreConfirm })
10009
+ ] })
10010
+ ] }) }),
10011
+ remove && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Dialog.Root, { open: true, onOpenChange: (open) => !open && !busy && setRemove(null), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Dialog.Content, { children: [
10012
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Dialog.Header, { children: t.trashDeleteTitle }),
10013
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Typography, { children: t.f("trashDeleteConfirm", { title: title(remove) }) }) }),
10014
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Dialog.Footer, { children: [
10015
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Dialog.Cancel, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { variant: "tertiary", disabled: busy, children: t.restoreCancel }) }),
10016
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { variant: "danger", onClick: confirmRemove, loading: busy, disabled: busy, "data-testid": "delete-confirm", children: t.trashDelete })
10017
+ ] })
10018
+ ] }) })
10019
+ ] });
10020
+ }
10021
+ function ContentPage() {
10022
+ const t = useMessages();
10023
+ const { get, post, del } = (0, import_admin3.useFetchClient)();
10024
+ const activity = (0, import_admin3.useRBAC)(ACTIVITY);
10025
+ const trash = (0, import_admin3.useRBAC)(TRASH);
10026
+ const [tab, setTab] = React15.useState(null);
10027
+ if (activity.isLoading || trash.isLoading) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_admin3.Page.Loading, {});
10028
+ const canActivity = Boolean(activity.allowedActions?.canRead), canTrash = Boolean(trash.allowedActions?.canRead);
10029
+ if (!canActivity && !canTrash) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_admin3.Page.NoPermissions, {});
10030
+ const current = tab || (canActivity ? "activity" : "trash");
10031
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_admin3.Page.Main, { children: [
10032
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_admin3.Page.Title, { children: t.contentTitle }),
10033
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_admin3.Layouts.Header, { title: t.contentTitle, subtitle: t.contentSubtitle }),
10034
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_admin3.Layouts.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Tabs.Root, { value: current, onValueChange: setTab, children: [
10035
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Tabs.List, { "aria-label": t.contentTitle, children: [
10036
+ canActivity && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Tabs.Trigger, { value: "activity", children: t.activityTab }),
10037
+ canTrash && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Tabs.Trigger, { value: "trash", children: t.trashTab })
10038
+ ] }),
10039
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Box, { paddingTop: 6, paddingBottom: 6, background: "neutral0", hasRadius: true, paddingLeft: 6, paddingRight: 6, marginTop: 4, children: [
10040
+ canActivity && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Tabs.Content, { value: "activity", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ActivityTab, { t, get }) }),
10041
+ canTrash && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Tabs.Content, { value: "trash", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TrashTab, { t, get, post, del, can: trash.allowedActions }) })
10042
+ ] })
10043
+ ] }) })
10044
+ ] });
10045
+ }
10046
+
10047
+ // admin/strapi5.tsx
10048
+ var import_jsx_runtime16 = require("react/jsx-runtime");
10049
+ function Modal2({ open, onOpenChange, trigger, title, children, width = "80vw" }) {
10050
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.Modal.Root, { open, onOpenChange, children: [
10051
+ trigger && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.Modal.Trigger, { children: trigger }),
10052
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.Modal.Content, { style: { width, maxWidth: "92vw" }, children: [
10053
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.Modal.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.Modal.Title, { children: title }) }),
10054
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.Modal.Body, { children })
10055
+ ] })
10056
+ ] });
10057
+ }
10058
+ async function relationsOf(get, { uid, id, field }, locale) {
10059
+ const out = [];
10060
+ for (let page = 1; page <= 20; page++) {
10061
+ const query2 = new URLSearchParams({ page: String(page), pageSize: "100", ...locale ? { locale } : {} });
10062
+ const { data } = await get(`/content-manager/relations/${uid}/${id}/${field}?${query2}`);
10063
+ out.push(...data?.results || []);
10064
+ if (page >= (data?.pagination?.pageCount || 1)) break;
10065
+ }
10066
+ return out.reverse();
10067
+ }
10068
+ function useRowForm(c, values, get) {
10069
+ const onChange = (0, import_admin4.useForm)("Blockscene", (state) => state.onChange);
10070
+ const errors = (0, import_admin4.useForm)("Blockscene", (state) => state.errors);
10071
+ const { toggleNotification } = (0, import_admin4.useNotification)();
10072
+ const latest = React16.useRef(values);
10073
+ latest.current = values;
10074
+ const locale = c.form?.initialValues?.locale || void 0;
10075
+ if (typeof onChange !== "function") return null;
8949
10076
  return {
8950
- model: c.slug,
8951
- locale: c.initialData?.locale || void 0,
10077
+ model: c.model,
10078
+ locale,
8952
10079
  rows: (zone) => Array.isArray(latest.current?.[zone]) ? latest.current[zone] : [],
8953
- setRows: (zone, rows) => c.onChange({ target: { name: zone, value: rows } }),
8954
- errorRows: (zone) => errorRows(c.formErrors, zone),
8955
- keys: (rows, _at, n) => integerKeys(rows, n),
10080
+ setRows: (zone, rows) => onChange(zone, rows),
10081
+ errorRows: (zone) => errorRows(errors, zone),
10082
+ keys: fractionalKeys,
8956
10083
  notify: (type, message) => toggleNotification({ type, message }),
8957
- prepare: async (rows) => rows.map((row) => cloneRow(row, components))
10084
+ prepare: (rows) => Promise.all(rows.map(async (row) => {
10085
+ const server = /* @__PURE__ */ new Map();
10086
+ for (const slot of relationSlots(row, c.components)) server.set(slot.path, await relationsOf(get, slot, locale));
10087
+ return cloneRow(row, c.components, {
10088
+ relation: (value, attr, path) => toConnect(currentRelations(server.get(path.join(".")) || [], value), attr.targetModel || attr.target)
10089
+ });
10090
+ }))
8958
10091
  };
8959
10092
  }
8960
- function Picker() {
8961
- const c = (0, import_helper_plugin.useCMEditViewDataManager)();
8962
- const { get, put } = (0, import_helper_plugin.useFetchClient)();
10093
+ function useScope() {
10094
+ const c = (0, import_strapi_admin2.unstable_useContentManagerContext)();
10095
+ const rbac = (0, import_strapi_admin2.useDocumentRBAC)("Blockscene", (state) => state);
10096
+ const { get, put } = (0, import_admin4.useFetchClient)();
10097
+ const formValues = (0, import_admin4.useForm)("Blockscene", (state) => state.values);
8963
10098
  const catalog = useCatalog(get);
8964
- const components = c.allLayoutData?.components || {};
8965
- const form = useRowForm(c, components);
8966
- const schema = c.layout || c.allLayoutData?.contentType;
8967
- const allowed = (c.isCreatingEntry ? c.createActionAllowedFields : c.updateActionAllowedFields) || [];
10099
+ const creating = !c.id && !c.form?.initialValues?.id && !c.form?.initialValues?.documentId;
10100
+ const allowed = (creating ? rbac.canCreateFields : rbac.canUpdateFields) || [];
10101
+ const fields = c.layout?.edit?.layout?.flat(3) || [];
8968
10102
  const zones = editableZones(
8969
- schema,
8970
- c.modifiedData,
8971
- (name) => allowed.includes(name) && schema?.metadatas?.[name]?.edit?.editable !== false,
8972
- !c.addComponentToDynamicZone
8973
- ).map((zone) => ({ ...zone, label: zoneLabel(schema, zone.name) }));
8974
- const add = (zone, uid, values) => {
8975
- const close = catalog?.groups?.[uid];
8976
- if (!canInsert(zone, uid, c.modifiedData, components, close ? 2 : 1) || close && !zone.components.includes(close))
8977
- return false;
8978
- const at = Array.isArray(c.modifiedData?.[zone.name]) ? c.modifiedData[zone.name].length : 0;
8979
- c.addComponentToDynamicZone(
8980
- zone.name,
8981
- components[uid],
8982
- components,
8983
- Boolean(c.formErrors?.[zone.name])
8984
- );
8985
- if (values) overlayVariant(c, components, zone.name, at, uid, values);
8986
- if (close)
8987
- c.addComponentToDynamicZone(
8988
- zone.name,
8989
- components[close],
8990
- components,
8991
- Boolean(c.formErrors?.[zone.name])
8992
- );
8993
- return true;
8994
- };
8995
- if (!catalog?.editor?.enabled || catalog.contentTypes?.[c.slug]?.enabled === false) return null;
8996
- const docKey = `${c.slug}:${c.isCreatingEntry ? "new" : c.initialData?.id}:${c.initialData?.locale || ""}`;
8997
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { hidden: true, "data-blockscene-editor": "", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Workspace, { c, schema, zones, components, add, catalog, docKey, form, get, put }) });
10103
+ c.contentType,
10104
+ formValues ?? c.form?.values,
10105
+ (name) => allowed.includes(name) && (creating || (rbac.canReadFields || []).includes(name)) && fields.find((field) => field.name === name)?.disabled !== true,
10106
+ c.isLoading || c.form?.disabled || !c.form?.addFieldRow
10107
+ ).map((zone) => ({
10108
+ ...zone,
10109
+ label: fields.find((field) => field.name === zone.name)?.label || zone.name
10110
+ }));
10111
+ const typeSettings = catalog?.contentTypes?.[c.model] || {};
10112
+ const gallery = zones.length > 0 && Boolean(catalog?.editor?.enabled) && typeSettings.enabled !== false;
10113
+ const history = !creating && Boolean(c.id) && Boolean(catalog?.history?.contentTypes?.includes(c.model));
10114
+ return { c, rbac, get, put, formValues, catalog, creating, zones, typeSettings, gallery, history };
8998
10115
  }
8999
- function Workspace({ c, schema, zones, components, add, catalog, docKey, form, get, put }) {
9000
- const typeSettings = catalog.contentTypes?.[c.slug] || {};
10116
+ var Menu2 = ({ label, testid, items: items2 }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.Box, { "data-testid": testid, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.SimpleMenu, { variant: "tertiary", size: "S", "aria-label": label, title: label, endIcon: null, label: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "more", size: 16 }), children: items2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.MenuItem, { onSelect: item.onSelect, "data-testid": item.testid, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.Flex, { gap: 2, alignItems: "center", children: [
10117
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: item.icon, size: 16 }),
10118
+ item.label
10119
+ ] }) }, item.testid)) }) });
10120
+ function Editor() {
10121
+ const scope = useScope();
10122
+ const { catalog, typeSettings, gallery } = scope;
10123
+ const lazy = Boolean(catalog?.editor?.enabled && catalog.editor.lazyEditors !== false && typeSettings.enabled !== false);
10124
+ const lazyFields = (catalog?.editor?.lazyFields || []).join(",");
10125
+ React16.useEffect(() => {
10126
+ if (catalog) setLazyConfig({ on: lazy, fields: lazyFields ? lazyFields.split(",") : [] });
10127
+ }, [catalog, lazy, lazyFields]);
10128
+ const kept2 = React16.useRef(false);
10129
+ if (!scope.c.isLoading) kept2.current = gallery;
10130
+ if (!kept2.current) return null;
10131
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Guard, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { hidden: true, "data-blockscene-editor": "", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Workspace, { scope }) }) });
10132
+ }
10133
+ function Workspace({ scope }) {
10134
+ const { c, get, put, formValues, catalog, creating, zones, typeSettings } = scope;
10135
+ const user = (0, import_admin4.useAuth)("Blockscene", (state2) => state2.user);
10136
+ const form = useRowForm(c, formValues ?? c.form?.values, get);
9001
10137
  const editor = {
9002
10138
  ...catalog.editor,
9003
10139
  previewMode: typeSettings.previewMode || catalog.editor.previewMode,
@@ -9006,32 +10142,49 @@ function Workspace({ c, schema, zones, components, add, catalog, docKey, form, g
9006
10142
  previewToolbar: typeSettings.previewToolbar || catalog.editor.previewToolbar,
9007
10143
  previewDevices: typeSettings.previewDevices || catalog.editor.previewDevices
9008
10144
  };
9009
- const host = usePreviewHost4(c, schema, components, get, put);
10145
+ const host = usePreviewHost5();
9010
10146
  const state = useEditorState(editor, host);
9011
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
9012
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10147
+ const add = (zone, uid, preset) => {
10148
+ const values = formValues ?? c.form.values;
10149
+ const close = catalog?.groups?.[uid];
10150
+ if (c.form.disabled || !canInsert(zone, uid, values, c.components, close ? 2 : 1) || close && !zone.components.includes(close))
10151
+ return false;
10152
+ const at = Array.isArray(values?.[zone.name]) ? values[zone.name].length : 0;
10153
+ c.form.addFieldRow(
10154
+ zone.name,
10155
+ {
10156
+ ...variantRow(c.components[uid], c.components, preset),
10157
+ __component: uid
10158
+ },
10159
+ at
10160
+ );
10161
+ if (close) c.form.addFieldRow(zone.name, { __component: close }, at + 1);
10162
+ return true;
10163
+ };
10164
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
10165
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
9013
10166
  Gallery,
9014
10167
  {
9015
10168
  zones,
9016
- components,
10169
+ components: c.components,
9017
10170
  add,
9018
- Modal,
10171
+ Modal: Modal2,
9019
10172
  Toggle: ToggleField,
10173
+ Menu: Menu2,
9020
10174
  get,
9021
10175
  put,
9022
10176
  editor: catalog.editor,
9023
10177
  catalog,
9024
- docKey,
9025
- contentType: c.slug,
9026
- userId: import_helper_plugin.auth.getUserInfo?.()?.id,
10178
+ docKey: `${c.model}:${creating ? "new" : c.id}:${c.form?.initialValues?.locale || ""}`,
10179
+ contentType: c.model,
10180
+ userId: user?.id,
9027
10181
  form,
9028
- Menu: Menu2,
9029
- zoneTools: state.preview.base ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ZoneBarTools, { state }) : null,
10182
+ zoneTools: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ZoneBarTools, { state }),
9030
10183
  openBlock: state.openBlock,
9031
10184
  openInsert: state.openInsert
9032
10185
  }
9033
10186
  ),
9034
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10187
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
9035
10188
  PagePreview,
9036
10189
  {
9037
10190
  editor,
@@ -9040,102 +10193,73 @@ function Workspace({ c, schema, zones, components, add, catalog, docKey, form, g
9040
10193
  groups: catalog.groups || null,
9041
10194
  hiddenAttribute: catalog.editor.hiddenBlocks !== "off" ? catalog.hiddenAttribute : null,
9042
10195
  form,
9043
- Modal,
10196
+ Modal: Modal2,
9044
10197
  Toggle: ToggleField
9045
10198
  }
9046
10199
  )
9047
10200
  ] });
9048
10201
  }
9049
- function usePreviewHost4(c, schema, components, get, put) {
9050
- const toggleNotification = (0, import_helper_plugin.useNotification)();
9051
- const { components: library } = (0, import_helper_plugin.useLibrary)();
9052
- const creating = Boolean(c.isCreatingEntry);
9053
- const readable = React12.useCallback(
9054
- (name) => creating || (c.readActionAllowedFields || []).includes(name),
9055
- [creating, c.readActionAllowedFields]
9056
- );
10202
+ function Panel2() {
10203
+ const { c, rbac, get, catalog, gallery, history } = useScope();
10204
+ const canReadHistory = Boolean((0, import_admin4.useRBAC)(HISTORY_READ).allowedActions?.canRead);
10205
+ const preview = usePreviewZone(usePreviewHost5());
10206
+ const groups = gallery ? catalog?.groups : null;
10207
+ const problems = groups && preview.zone ? (0, import_groups.validateGroups)(preview.rows, groups) : [];
10208
+ const versions = history && canReadHistory;
10209
+ if (!versions && !problems.length) return null;
9057
10210
  return {
9058
- ds: 1,
9059
- model: c.slug,
9060
- documentId: creating ? void 0 : c.initialData?.id,
9061
- locale: c.initialData?.locale || void 0,
9062
- creating,
9063
- loading: false,
9064
- disabled: false,
9065
- contentType: schema,
9066
- components,
9067
- values: c.modifiedData,
9068
- history: null,
9069
- readable,
9070
- editable: (name) => ((creating ? c.createActionAllowedFields : c.updateActionAllowedFields) || []).includes(name) && schema?.metadatas?.[name]?.edit?.editable !== false && typeof c.addComponentToDynamicZone === "function" && typeof c.onChange === "function",
9071
- fieldLabel: (name) => zoneLabel(schema, name),
9072
- onChange: (name, value) => c.onChange({ target: { name, value } }),
9073
- // Native insertion at a position (4.11+): the edit view's own default data structure, relations emptied.
9074
- // An insert variant's values are overlaid on the first row as in the gallery insert (Picker `add`).
9075
- insertRows: (zone, at, items2, values) => {
9076
- items2.forEach((item, i) => c.addComponentToDynamicZone(zone, components[item.__component], components, Boolean(c.formErrors?.[zone]), at + i));
9077
- if (values && items2[0]) overlayVariant(c, components, zone, at, items2[0].__component, values);
9078
- },
9079
- get,
9080
- put,
9081
- notify: (type, message) => toggleNotification({ type, message }),
9082
- MediaLibrary: library?.["media-library"],
9083
- useNativeBase: () => null,
9084
- Actions: Actions4
10211
+ title: "Blockscene",
10212
+ content: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Guard, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
10213
+ problems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(GroupDiagnostics, { scope: preview, groups, problems }),
10214
+ versions && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10215
+ History,
10216
+ {
10217
+ model: c.model,
10218
+ documentId: c.id,
10219
+ schema: c.contentType,
10220
+ components: c.components,
10221
+ editable: (name) => (rbac.canUpdateFields || []).some((field) => field === name || field.startsWith(`${name}.`)),
10222
+ disabled: Boolean(c.form?.disabled),
10223
+ get,
10224
+ relationsOf
10225
+ }
10226
+ )
10227
+ ] }) })
9085
10228
  };
9086
10229
  }
9087
- var zoneLabel = (schema, name) => schema?.layouts?.edit?.flat().find((field) => field?.name === name)?.metadatas?.label || schema?.metadatas?.[name]?.edit?.label || name;
9088
- function Actions4({ parts }) {
9089
- const c = (0, import_helper_plugin.useCMEditViewDataManager)();
9090
- const t = useMessages();
9091
- const { formatMessage } = (0, import_react_intl2.useIntl)();
9092
- const dirty = React12.useMemo(
9093
- () => c.isCreatingEntry ? Object.keys(c.modifiedData || {}).length > 0 : JSON.stringify(c.initialData) !== JSON.stringify(c.modifiedData),
9094
- [c.initialData, c.modifiedData, c.isCreatingEntry]
9095
- );
9096
- const published = typeof c.initialData?.publishedAt === "string";
9097
- const status = c.hasDraftAndPublish && !c.isCreatingEntry ? published ? "published" : "draft" : void 0;
9098
- const save = formatMessage({ id: "content-manager.containers.Edit.submit", defaultMessage: "Save" });
9099
- const publish = formatMessage(published ? { id: "app.utils.unpublish", defaultMessage: "Unpublish" } : { id: "app.utils.publish", defaultMessage: "Publish" });
9100
- const native = (label) => [...document.querySelectorAll("#main-content button")].find((b) => b.textContent?.trim() === label);
9101
- const actions = [
9102
- // Publish is the primary action, Save the secondary one (as in the Strapi 5 pane toolbar).
9103
- { label: save, variant: "secondary", disabled: !dirty, loading: c.status === "submit-pending", reason: t.saveDisabledHint },
9104
- ...c.hasDraftAndPublish && !c.isCreatingEntry ? [{ label: publish, variant: "default", disabled: dirty, loading: c.status === (published ? "unpublish-pending" : "publish-pending"), reason: t.publishDisabledHint }] : []
9105
- ].filter((action) => native(action.label));
9106
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 2, alignItems: "center", "data-testid": "page-preview-actions", children: [
9107
- parts.includes("status") && (status || dirty) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 2, alignItems: "center", style: { order: parts.indexOf("status") }, children: [
9108
- status && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Status, { size: "S", showBullet: false, role: "status", "data-testid": "page-preview-status", variant: published ? "success" : "secondary", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { as: "span", variant: "omega", fontWeight: "bold", children: formatMessage({ id: `content-manager.containers.List.${status}`, defaultMessage: status === "published" ? "Published" : "Draft" }) }) }),
9109
- dirty && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { variant: "pi", textColor: "neutral600", children: t.unsaved })
9110
- ] }),
9111
- parts.includes("actions") && actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { title: action.disabled ? action.reason : void 0, style: { order: parts.indexOf("actions") }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9112
- import_design_system7.Button,
9113
- {
9114
- size: "S",
9115
- variant: action.variant,
9116
- disabled: action.disabled,
9117
- loading: action.loading,
9118
- "aria-description": action.disabled ? action.reason : void 0,
9119
- onClick: () => native(action.label)?.click(),
9120
- children: action.label
9121
- }
9122
- ) }, action.label))
9123
- ] });
9124
- }
9125
- var ToggleField = ({ name, label, value, onChange, disabled }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system7.Flex, { gap: 3, children: [
9126
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9127
- import_design_system7.Switch,
10230
+ var ToggleField = ({ name, label, value, onChange, disabled }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.Flex, { gap: 3, children: [
10231
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10232
+ import_design_system11.Switch,
9128
10233
  {
9129
10234
  name,
9130
10235
  "aria-label": label,
9131
- selected: Boolean(value),
10236
+ checked: Boolean(value),
9132
10237
  disabled,
9133
- onChange: () => onChange(!value)
10238
+ onCheckedChange: onChange
9134
10239
  }
9135
10240
  ),
9136
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.Typography, { children: label })
10241
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.Typography, { children: label })
10242
+ ] });
10243
+ var TextField = ({
10244
+ name,
10245
+ label,
10246
+ value,
10247
+ onChange,
10248
+ disabled,
10249
+ placeholder
10250
+ }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.Field.Root, { name, children: [
10251
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.Field.Label, { children: label }),
10252
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10253
+ import_design_system11.TextInput,
10254
+ {
10255
+ name,
10256
+ value,
10257
+ disabled,
10258
+ placeholder,
10259
+ onChange: (e) => onChange(e.target.value)
10260
+ }
10261
+ )
9137
10262
  ] });
9138
- var TextField = ({ name, label, value, onChange, disabled, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.TextInput, { name, label, value, disabled, placeholder, onChange: (e) => onChange(e.target.value) });
9139
10263
  var SelectField = ({
9140
10264
  name,
9141
10265
  label,
@@ -9143,63 +10267,74 @@ var SelectField = ({
9143
10267
  onChange,
9144
10268
  disabled,
9145
10269
  options
9146
- }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9147
- import_design_system7.SingleSelect,
9148
- {
9149
- name,
9150
- label,
9151
- value,
9152
- disabled,
9153
- onChange: (v) => onChange(String(v)),
9154
- children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system7.SingleSelectOption, { value: o.value, children: o.label }, o.value))
9155
- }
9156
- );
10270
+ }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.Field.Root, { name, children: [
10271
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.Field.Label, { children: label }),
10272
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10273
+ import_design_system11.SingleSelect,
10274
+ {
10275
+ value,
10276
+ disabled,
10277
+ startIcon: options.find((o) => o.value === value)?.icon,
10278
+ onChange: (v) => onChange(String(v)),
10279
+ children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.SingleSelectOption, { value: o.value, startIcon: o.icon, children: o.label }, o.value))
10280
+ }
10281
+ )
10282
+ ] });
9157
10283
  function MediaPicker({ onClose, onSelect }) {
9158
- const { components } = (0, import_helper_plugin.useLibrary)();
9159
- const Dialog = components?.["media-library"];
9160
- if (!Dialog) {
9161
- onClose();
9162
- return null;
9163
- }
9164
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9165
- Dialog,
10284
+ const components = (0, import_admin4.useStrapiApp)(
10285
+ "Blockscene",
10286
+ (state) => state.components
10287
+ );
10288
+ const Dialog3 = components?.["media-library"];
10289
+ React16.useEffect(() => {
10290
+ if (!Dialog3) onClose();
10291
+ }, [Dialog3, onClose]);
10292
+ if (!Dialog3) return null;
10293
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10294
+ Dialog3,
9166
10295
  {
9167
10296
  onClose,
9168
10297
  allowedTypes: ["images"],
10298
+ multiple: false,
9169
10299
  onSelectAssets: (assets) => onSelect(assets?.[0])
9170
10300
  }
9171
10301
  );
9172
10302
  }
9173
10303
  function usePermissions() {
9174
- const { allowedActions, isLoading } = (0, import_helper_plugin.useRBAC)(permissions);
10304
+ const { allowedActions, isLoading } = (0, import_admin4.useRBAC)(
10305
+ Object.values(permissions).flat()
10306
+ );
9175
10307
  return {
9176
10308
  canRead: allowedActions.canRead,
9177
10309
  canUpdate: allowedActions.canUpdate,
9178
10310
  isLoading
9179
10311
  };
9180
10312
  }
9181
- var SettingsPage = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Guard, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10313
+ var SettingsPage = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Guard, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
9182
10314
  Settings,
9183
10315
  {
9184
- useClient: import_helper_plugin.useFetchClient,
10316
+ useClient: import_admin4.useFetchClient,
9185
10317
  usePermissions,
9186
10318
  MediaPicker,
9187
10319
  ToggleField,
9188
10320
  SelectField,
9189
- TextField
10321
+ TextField,
10322
+ lazyEditors: true
9190
10323
  }
9191
10324
  ) });
9192
- var strapi4_default = {
10325
+ var strapiApp = null;
10326
+ var strapi5_default = {
9193
10327
  register(app) {
9194
- register(app, SettingsPage, "/settings/blockscene");
10328
+ strapiApp = app;
10329
+ register(app, SettingsPage, "blockscene");
9195
10330
  app.registerPlugin({ id: "blockscene", name: "Blockscene", apis: { registerPanel: (panel) => registerPanel(panel, ICON_NAMES) } });
10331
+ app.addMenuLink(contentMenuLink(() => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Guard, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ContentPage, {}) })));
9196
10332
  },
9197
10333
  registerTrads,
9198
10334
  bootstrap(app) {
9199
- app.registerHook("Admin/CM/pages/EditView/mutate-edit-view-layout", labelsHook(() => (0, import_helper_plugin.getFetchClient)().get, labelEditLayout4, dropField4));
9200
- app.injectContentManagerComponent("editView", "right-links", {
9201
- name: "blockscene",
9202
- Component: () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Guard, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Picker, {}) })
9203
- });
10335
+ app.getPlugin("content-manager").apis.addEditViewSidePanel([Panel2]);
10336
+ app.getPlugin("content-manager").injectComponent("editView", "right-links", { name: "blockscene", Component: Editor });
10337
+ app.registerHook("Admin/CM/pages/EditView/mutate-edit-view-layout", labelsHook(() => (0, import_admin4.getFetchClient)().get, labelEditLayout, dropField));
10338
+ wrapCustomFields(strapiApp);
9204
10339
  }
9205
10340
  };