@measured/puck 0.17.1 → 0.17.2-canary.98a70fd

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  resolveRootData,
14
14
  rootDroppableId,
15
15
  setupZone
16
- } from "./chunk-7IH6SUIT.mjs";
16
+ } from "./chunk-LNGCTWA7.mjs";
17
17
 
18
18
  // ../../node_modules/classnames/index.js
19
19
  var require_classnames = __commonJS({
@@ -193,8 +193,9 @@ var styles_module_default2 = { "InputWrapper": "_InputWrapper_1l5m8_1", "Input":
193
193
  // components/AutoField/index.tsx
194
194
  import {
195
195
  useCallback as useCallback5,
196
+ useContext as useContext3,
196
197
  useEffect as useEffect9,
197
- useMemo as useMemo4,
198
+ useMemo as useMemo5,
198
199
  useState as useState10
199
200
  } from "react";
200
201
 
@@ -1176,21 +1177,66 @@ import { jsx as jsx7 } from "react/jsx-runtime";
1176
1177
  var getClassName4 = get_class_name_factory_default("DragIcon", styles_module_default5);
1177
1178
  var DragIcon = ({ isDragDisabled }) => /* @__PURE__ */ jsx7("div", { className: getClassName4({ disabled: isDragDisabled }), children: /* @__PURE__ */ jsx7("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ jsx7("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
1178
1179
 
1180
+ // components/AutoField/context.tsx
1181
+ init_react_import();
1182
+ import { createContext as createContext2, useContext as useContext2, useMemo } from "react";
1183
+ import { jsx as jsx8 } from "react/jsx-runtime";
1184
+ var NestedFieldContext = createContext2({});
1185
+ var useNestedFieldContext = () => {
1186
+ const context = useContext2(NestedFieldContext);
1187
+ return __spreadProps(__spreadValues({}, context), {
1188
+ readOnlyFields: context.readOnlyFields || {}
1189
+ });
1190
+ };
1191
+ var NestedFieldProvider = ({
1192
+ children,
1193
+ name,
1194
+ subName,
1195
+ wildcardName = name,
1196
+ readOnlyFields
1197
+ }) => {
1198
+ const subPath = `${name}.${subName}`;
1199
+ const wildcardSubPath = `${wildcardName}.${subName}`;
1200
+ const subReadOnlyFields = useMemo(
1201
+ () => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
1202
+ const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
1203
+ if (isLocal) {
1204
+ const subPathPattern = new RegExp(
1205
+ `^(${name}|${wildcardName}).`.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\./g, "\\.").replace(/\*/g, "\\*")
1206
+ );
1207
+ const localName = readOnlyKey.replace(subPathPattern, "");
1208
+ return __spreadProps(__spreadValues({}, acc), {
1209
+ [localName]: readOnlyFields[readOnlyKey]
1210
+ });
1211
+ }
1212
+ return acc;
1213
+ }, {}),
1214
+ [name, subName, wildcardName, readOnlyFields]
1215
+ );
1216
+ return /* @__PURE__ */ jsx8(
1217
+ NestedFieldContext.Provider,
1218
+ {
1219
+ value: { readOnlyFields: subReadOnlyFields, localName: subName },
1220
+ children
1221
+ }
1222
+ );
1223
+ };
1224
+
1179
1225
  // components/DragDropContext/index.tsx
1180
1226
  init_react_import();
1181
1227
  import {
1182
1228
  DragDropContext as DndDragDropContext
1183
1229
  } from "@measured/dnd";
1184
- import { Fragment as Fragment4, jsx as jsx8 } from "react/jsx-runtime";
1185
- var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ jsx8(Fragment4, { children });
1230
+ import { Fragment as Fragment4, jsx as jsx9 } from "react/jsx-runtime";
1231
+ var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ jsx9(Fragment4, { children });
1186
1232
  var DragDropContext = (props) => {
1187
1233
  const { status } = useAppContext();
1188
1234
  const El = status !== "LOADING" ? DndDragDropContext : DefaultDragDropContext;
1189
- return /* @__PURE__ */ jsx8(El, __spreadValues({}, props));
1235
+ return /* @__PURE__ */ jsx9(El, __spreadValues({}, props));
1190
1236
  };
1191
1237
 
1192
1238
  // components/AutoField/fields/ArrayField/index.tsx
1193
- import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1239
+ import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
1194
1240
  var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
1195
1241
  var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
1196
1242
  var ArrayField = ({
@@ -1201,10 +1247,10 @@ var ArrayField = ({
1201
1247
  label,
1202
1248
  readOnly,
1203
1249
  id,
1204
- Label = (props) => /* @__PURE__ */ jsx9("div", __spreadValues({}, props))
1250
+ Label = (props) => /* @__PURE__ */ jsx10("div", __spreadValues({}, props))
1205
1251
  }) => {
1206
1252
  const { state, setUi, selectedItem, getPermissions } = useAppContext();
1207
- const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
1253
+ const { readOnlyFields, localName = name } = useNestedFieldContext();
1208
1254
  const value = _value;
1209
1255
  const arrayState = state.ui.arrayState[id] || {
1210
1256
  items: Array.from(value || []).map((item, idx) => {
@@ -1265,14 +1311,14 @@ var ArrayField = ({
1265
1311
  return null;
1266
1312
  }
1267
1313
  const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
1268
- return /* @__PURE__ */ jsx9(
1314
+ return /* @__PURE__ */ jsx10(
1269
1315
  Label,
1270
1316
  {
1271
1317
  label: label || name,
1272
- icon: /* @__PURE__ */ jsx9(List, { size: 16 }),
1318
+ icon: /* @__PURE__ */ jsx10(List, { size: 16 }),
1273
1319
  el: "div",
1274
1320
  readOnly,
1275
- children: /* @__PURE__ */ jsx9(
1321
+ children: /* @__PURE__ */ jsx10(
1276
1322
  DragDropContext,
1277
1323
  {
1278
1324
  onDragEnd: (event) => {
@@ -1301,7 +1347,7 @@ var ArrayField = ({
1301
1347
  });
1302
1348
  }
1303
1349
  },
1304
- children: /* @__PURE__ */ jsx9(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
1350
+ children: /* @__PURE__ */ jsx10(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
1305
1351
  return /* @__PURE__ */ jsxs4(
1306
1352
  "div",
1307
1353
  __spreadProps(__spreadValues({}, provided.droppableProps), {
@@ -1326,7 +1372,7 @@ var ArrayField = ({
1326
1372
  localState.arrayState.items.map((item, i) => {
1327
1373
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
1328
1374
  const data = Array.from(localState.value || [])[i] || {};
1329
- return /* @__PURE__ */ jsx9(
1375
+ return /* @__PURE__ */ jsx10(
1330
1376
  Draggable,
1331
1377
  {
1332
1378
  id: _arrayId,
@@ -1361,7 +1407,7 @@ var ArrayField = ({
1361
1407
  field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
1362
1408
  /* @__PURE__ */ jsxs4("div", { className: getClassNameItem("rhs"), children: [
1363
1409
  !readOnly && /* @__PURE__ */ jsxs4("div", { className: getClassNameItem("actions"), children: [
1364
- /* @__PURE__ */ jsx9("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx9(
1410
+ /* @__PURE__ */ jsx10("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx10(
1365
1411
  IconButton,
1366
1412
  {
1367
1413
  type: "button",
@@ -1384,10 +1430,10 @@ var ArrayField = ({
1384
1430
  );
1385
1431
  },
1386
1432
  title: "Duplicate",
1387
- children: /* @__PURE__ */ jsx9(Copy, { size: 16 })
1433
+ children: /* @__PURE__ */ jsx10(Copy, { size: 16 })
1388
1434
  }
1389
1435
  ) }),
1390
- /* @__PURE__ */ jsx9("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx9(
1436
+ /* @__PURE__ */ jsx10("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx10(
1391
1437
  IconButton,
1392
1438
  {
1393
1439
  type: "button",
@@ -1410,40 +1456,57 @@ var ArrayField = ({
1410
1456
  );
1411
1457
  },
1412
1458
  title: "Delete",
1413
- children: /* @__PURE__ */ jsx9(Trash, { size: 16 })
1459
+ children: /* @__PURE__ */ jsx10(Trash, { size: 16 })
1414
1460
  }
1415
1461
  ) })
1416
1462
  ] }),
1417
- /* @__PURE__ */ jsx9("div", { children: /* @__PURE__ */ jsx9(DragIcon, {}) })
1463
+ /* @__PURE__ */ jsx10("div", { children: /* @__PURE__ */ jsx10(DragIcon, {}) })
1418
1464
  ] })
1419
1465
  ]
1420
1466
  }
1421
1467
  ),
1422
- /* @__PURE__ */ jsx9("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx9("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
1423
- (fieldName) => {
1424
- const subField = field.arrayFields[fieldName];
1425
- const subFieldName = `${name}[${i}].${fieldName}`;
1426
- const wildcardFieldName = `${name}[*].${fieldName}`;
1427
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
1428
- return /* @__PURE__ */ jsx9(
1429
- AutoFieldPrivate,
1468
+ /* @__PURE__ */ jsx10("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx10("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
1469
+ (subName) => {
1470
+ const subField = field.arrayFields[subName];
1471
+ const indexName = `${name}[${i}]`;
1472
+ const subPath = `${indexName}.${subName}`;
1473
+ const localIndexName = `${localName}[${i}]`;
1474
+ const localWildcardName = `${localName}[*]`;
1475
+ const localSubPath = `${localIndexName}.${subName}`;
1476
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
1477
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
1478
+ const label2 = subField.label || subName;
1479
+ return /* @__PURE__ */ jsx10(
1480
+ NestedFieldProvider,
1430
1481
  {
1431
- name: subFieldName,
1432
- label: subField.label || fieldName,
1433
- id: `${_arrayId}_${fieldName}`,
1434
- readOnly: subReadOnly,
1435
- field: subField,
1436
- value: data[fieldName],
1437
- onChange: (val, ui) => {
1438
- onChange(
1439
- replace(value, i, __spreadProps(__spreadValues({}, data), {
1440
- [fieldName]: val
1441
- })),
1442
- ui
1443
- );
1444
- }
1482
+ name: localIndexName,
1483
+ wildcardName: localWildcardName,
1484
+ subName,
1485
+ readOnlyFields,
1486
+ children: /* @__PURE__ */ jsx10(
1487
+ AutoFieldPrivate,
1488
+ {
1489
+ name: subPath,
1490
+ label: label2,
1491
+ id: `${_arrayId}_${subName}`,
1492
+ readOnly: subReadOnly,
1493
+ field: __spreadProps(__spreadValues({}, subField), {
1494
+ label: label2
1495
+ // May be used by custom fields
1496
+ }),
1497
+ value: data[subName],
1498
+ onChange: (val, ui) => {
1499
+ onChange(
1500
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
1501
+ [subName]: val
1502
+ })),
1503
+ ui
1504
+ );
1505
+ }
1506
+ }
1507
+ )
1445
1508
  },
1446
- subFieldName
1509
+ subPath
1447
1510
  );
1448
1511
  }
1449
1512
  ) }) })
@@ -1453,7 +1516,7 @@ var ArrayField = ({
1453
1516
  );
1454
1517
  }),
1455
1518
  provided.placeholder,
1456
- !addDisabled && /* @__PURE__ */ jsx9(
1519
+ !addDisabled && /* @__PURE__ */ jsx10(
1457
1520
  "button",
1458
1521
  {
1459
1522
  type: "button",
@@ -1467,7 +1530,7 @@ var ArrayField = ({
1467
1530
  const newArrayState = regenerateArrayState(newValue);
1468
1531
  onChange(newValue, mapArrayStateToUi(newArrayState));
1469
1532
  },
1470
- children: /* @__PURE__ */ jsx9(Plus, { size: 21 })
1533
+ children: /* @__PURE__ */ jsx10(Plus, { size: 21 })
1471
1534
  }
1472
1535
  )
1473
1536
  ]
@@ -1482,7 +1545,7 @@ var ArrayField = ({
1482
1545
 
1483
1546
  // components/AutoField/fields/DefaultField/index.tsx
1484
1547
  init_react_import();
1485
- import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
1548
+ import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1486
1549
  var getClassName6 = get_class_name_factory_default("Input", styles_module_default2);
1487
1550
  var DefaultField = ({
1488
1551
  field,
@@ -1494,16 +1557,16 @@ var DefaultField = ({
1494
1557
  Label,
1495
1558
  id
1496
1559
  }) => {
1497
- return /* @__PURE__ */ jsx10(
1560
+ return /* @__PURE__ */ jsx11(
1498
1561
  Label,
1499
1562
  {
1500
1563
  label: label || name,
1501
1564
  icon: /* @__PURE__ */ jsxs5(Fragment6, { children: [
1502
- field.type === "text" && /* @__PURE__ */ jsx10(Type, { size: 16 }),
1503
- field.type === "number" && /* @__PURE__ */ jsx10(Hash, { size: 16 })
1565
+ field.type === "text" && /* @__PURE__ */ jsx11(Type, { size: 16 }),
1566
+ field.type === "number" && /* @__PURE__ */ jsx11(Hash, { size: 16 })
1504
1567
  ] }),
1505
1568
  readOnly,
1506
- children: /* @__PURE__ */ jsx10(
1569
+ children: /* @__PURE__ */ jsx11(
1507
1570
  "input",
1508
1571
  {
1509
1572
  className: getClassName6("input"),
@@ -1537,7 +1600,7 @@ import { useEffect as useEffect8 } from "react";
1537
1600
  // components/ExternalInput/index.tsx
1538
1601
  init_react_import();
1539
1602
  import {
1540
- useMemo,
1603
+ useMemo as useMemo2,
1541
1604
  useEffect as useEffect7,
1542
1605
  useState as useState8,
1543
1606
  useCallback as useCallback4,
@@ -1558,7 +1621,7 @@ var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Mod
1558
1621
 
1559
1622
  // components/Modal/index.tsx
1560
1623
  import { createPortal } from "react-dom";
1561
- import { jsx as jsx11 } from "react/jsx-runtime";
1624
+ import { jsx as jsx12 } from "react/jsx-runtime";
1562
1625
  var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
1563
1626
  var Modal = ({
1564
1627
  children,
@@ -1570,10 +1633,10 @@ var Modal = ({
1570
1633
  setRootEl(document.getElementById("puck-portal-root"));
1571
1634
  }, []);
1572
1635
  if (!rootEl) {
1573
- return /* @__PURE__ */ jsx11("div", {});
1636
+ return /* @__PURE__ */ jsx12("div", {});
1574
1637
  }
1575
1638
  return createPortal(
1576
- /* @__PURE__ */ jsx11("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ jsx11(
1639
+ /* @__PURE__ */ jsx12("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ jsx12(
1577
1640
  "div",
1578
1641
  {
1579
1642
  className: getClassName7("inner"),
@@ -1593,11 +1656,11 @@ init_react_import();
1593
1656
  var styles_module_default8 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
1594
1657
 
1595
1658
  // components/Heading/index.tsx
1596
- import { jsx as jsx12 } from "react/jsx-runtime";
1659
+ import { jsx as jsx13 } from "react/jsx-runtime";
1597
1660
  var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
1598
1661
  var Heading = ({ children, rank, size = "m" }) => {
1599
1662
  const Tag = rank ? `h${rank}` : "span";
1600
- return /* @__PURE__ */ jsx12(
1663
+ return /* @__PURE__ */ jsx13(
1601
1664
  Tag,
1602
1665
  {
1603
1666
  className: getClassName8({
@@ -1620,7 +1683,7 @@ init_react_import();
1620
1683
  var Button_module_default = { "Button": "_Button_1t64k_1", "Button--medium": "_Button--medium_1t64k_29", "Button--large": "_Button--large_1t64k_37", "Button-icon": "_Button-icon_1t64k_44", "Button--primary": "_Button--primary_1t64k_48", "Button--secondary": "_Button--secondary_1t64k_67", "Button--flush": "_Button--flush_1t64k_84", "Button--disabled": "_Button--disabled_1t64k_88", "Button--fullWidth": "_Button--fullWidth_1t64k_95", "Button-spinner": "_Button-spinner_1t64k_100" };
1621
1684
 
1622
1685
  // components/Button/Button.tsx
1623
- import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
1686
+ import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
1624
1687
  var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
1625
1688
  var Button = ({
1626
1689
  children,
@@ -1663,9 +1726,9 @@ var Button = ({
1663
1726
  rel: newTab ? "noreferrer" : void 0,
1664
1727
  href,
1665
1728
  children: [
1666
- icon && /* @__PURE__ */ jsx13("div", { className: getClassName9("icon"), children: icon }),
1729
+ icon && /* @__PURE__ */ jsx14("div", { className: getClassName9("icon"), children: icon }),
1667
1730
  children,
1668
- loading && /* @__PURE__ */ jsx13("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ jsx13(Loader, { size: 14 }) })
1731
+ loading && /* @__PURE__ */ jsx14("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ jsx14(Loader, { size: 14 }) })
1669
1732
  ]
1670
1733
  }
1671
1734
  );
@@ -1673,7 +1736,7 @@ var Button = ({
1673
1736
  };
1674
1737
 
1675
1738
  // components/ExternalInput/index.tsx
1676
- import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
1739
+ import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
1677
1740
  var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
1678
1741
  var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
1679
1742
  var dataCache = {};
@@ -1696,10 +1759,10 @@ var ExternalInput = ({
1696
1759
  const hasFilterFields = !!filterFields;
1697
1760
  const [filters, setFilters] = useState8(field.initialFilters || {});
1698
1761
  const [filtersToggled, setFiltersToggled] = useState8(hasFilterFields);
1699
- const mappedData = useMemo(() => {
1762
+ const mappedData = useMemo2(() => {
1700
1763
  return data.map(mapRow);
1701
1764
  }, [data]);
1702
- const keys = useMemo(() => {
1765
+ const keys = useMemo2(() => {
1703
1766
  const validKeys = /* @__PURE__ */ new Set();
1704
1767
  for (const item of mappedData) {
1705
1768
  for (const key of Object.keys(item)) {
@@ -1746,7 +1809,7 @@ var ExternalInput = ({
1746
1809
  id,
1747
1810
  children: [
1748
1811
  /* @__PURE__ */ jsxs7("div", { className: getClassName10("actions"), children: [
1749
- /* @__PURE__ */ jsx14(
1812
+ /* @__PURE__ */ jsx15(
1750
1813
  "button",
1751
1814
  {
1752
1815
  type: "button",
@@ -1754,12 +1817,12 @@ var ExternalInput = ({
1754
1817
  className: getClassName10("button"),
1755
1818
  disabled: readOnly,
1756
1819
  children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ jsxs7(Fragment7, { children: [
1757
- /* @__PURE__ */ jsx14(Link, { size: "16" }),
1758
- /* @__PURE__ */ jsx14("span", { children: field.placeholder })
1820
+ /* @__PURE__ */ jsx15(Link, { size: "16" }),
1821
+ /* @__PURE__ */ jsx15("span", { children: field.placeholder })
1759
1822
  ] })
1760
1823
  }
1761
1824
  ),
1762
- value && /* @__PURE__ */ jsx14(
1825
+ value && /* @__PURE__ */ jsx15(
1763
1826
  "button",
1764
1827
  {
1765
1828
  type: "button",
@@ -1768,11 +1831,11 @@ var ExternalInput = ({
1768
1831
  onChange(null);
1769
1832
  },
1770
1833
  disabled: readOnly,
1771
- children: /* @__PURE__ */ jsx14(LockOpen, { size: 16 })
1834
+ children: /* @__PURE__ */ jsx15(LockOpen, { size: 16 })
1772
1835
  }
1773
1836
  )
1774
1837
  ] }),
1775
- /* @__PURE__ */ jsx14(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ jsxs7(
1838
+ /* @__PURE__ */ jsx15(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ jsxs7(
1776
1839
  "form",
1777
1840
  {
1778
1841
  className: getClassNameModal({
@@ -1786,11 +1849,11 @@ var ExternalInput = ({
1786
1849
  search(searchQuery, filters);
1787
1850
  },
1788
1851
  children: [
1789
- /* @__PURE__ */ jsx14("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ jsxs7("div", { className: getClassNameModal("searchForm"), children: [
1852
+ /* @__PURE__ */ jsx15("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ jsxs7("div", { className: getClassNameModal("searchForm"), children: [
1790
1853
  /* @__PURE__ */ jsxs7("label", { className: getClassNameModal("search"), children: [
1791
- /* @__PURE__ */ jsx14("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
1792
- /* @__PURE__ */ jsx14("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ jsx14(Search, { size: "18" }) }),
1793
- /* @__PURE__ */ jsx14(
1854
+ /* @__PURE__ */ jsx15("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
1855
+ /* @__PURE__ */ jsx15("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ jsx15(Search, { size: "18" }) }),
1856
+ /* @__PURE__ */ jsx15(
1794
1857
  "input",
1795
1858
  {
1796
1859
  className: getClassNameModal("searchInput"),
@@ -1806,8 +1869,8 @@ var ExternalInput = ({
1806
1869
  )
1807
1870
  ] }),
1808
1871
  /* @__PURE__ */ jsxs7("div", { className: getClassNameModal("searchActions"), children: [
1809
- /* @__PURE__ */ jsx14(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
1810
- hasFilterFields && /* @__PURE__ */ jsx14("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ jsx14(
1872
+ /* @__PURE__ */ jsx15(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
1873
+ hasFilterFields && /* @__PURE__ */ jsx15("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ jsx15(
1811
1874
  IconButton,
1812
1875
  {
1813
1876
  title: "Toggle filters",
@@ -1816,15 +1879,15 @@ var ExternalInput = ({
1816
1879
  e.stopPropagation();
1817
1880
  setFiltersToggled(!filtersToggled);
1818
1881
  },
1819
- children: /* @__PURE__ */ jsx14(SlidersHorizontal, { size: 20 })
1882
+ children: /* @__PURE__ */ jsx15(SlidersHorizontal, { size: 20 })
1820
1883
  }
1821
1884
  ) })
1822
1885
  ] })
1823
- ] }) : /* @__PURE__ */ jsx14(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
1886
+ ] }) : /* @__PURE__ */ jsx15(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
1824
1887
  /* @__PURE__ */ jsxs7("div", { className: getClassNameModal("grid"), children: [
1825
- hasFilterFields && /* @__PURE__ */ jsx14("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
1888
+ hasFilterFields && /* @__PURE__ */ jsx15("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
1826
1889
  const filterField = filterFields[fieldName];
1827
- return /* @__PURE__ */ jsx14(
1890
+ return /* @__PURE__ */ jsx15(
1828
1891
  AutoFieldPrivate,
1829
1892
  {
1830
1893
  field: filterField,
@@ -1843,7 +1906,7 @@ var ExternalInput = ({
1843
1906
  }) }),
1844
1907
  /* @__PURE__ */ jsxs7("div", { className: getClassNameModal("tableWrapper"), children: [
1845
1908
  /* @__PURE__ */ jsxs7("table", { className: getClassNameModal("table"), children: [
1846
- /* @__PURE__ */ jsx14("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ jsx14("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ jsx14(
1909
+ /* @__PURE__ */ jsx15("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ jsx15("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ jsx15(
1847
1910
  "th",
1848
1911
  {
1849
1912
  className: getClassNameModal("th"),
@@ -1852,8 +1915,8 @@ var ExternalInput = ({
1852
1915
  },
1853
1916
  key
1854
1917
  )) }) }),
1855
- /* @__PURE__ */ jsx14("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
1856
- return /* @__PURE__ */ jsx14(
1918
+ /* @__PURE__ */ jsx15("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
1919
+ return /* @__PURE__ */ jsx15(
1857
1920
  "tr",
1858
1921
  {
1859
1922
  style: { whiteSpace: "nowrap" },
@@ -1862,16 +1925,16 @@ var ExternalInput = ({
1862
1925
  onChange(mapProp(data[i]));
1863
1926
  setOpen(false);
1864
1927
  },
1865
- children: keys.map((key) => /* @__PURE__ */ jsx14("td", { className: getClassNameModal("td"), children: item[key] }, key))
1928
+ children: keys.map((key) => /* @__PURE__ */ jsx15("td", { className: getClassNameModal("td"), children: item[key] }, key))
1866
1929
  },
1867
1930
  i
1868
1931
  );
1869
1932
  }) })
1870
1933
  ] }),
1871
- /* @__PURE__ */ jsx14("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx14(Loader, { size: 24 }) })
1934
+ /* @__PURE__ */ jsx15("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx15(Loader, { size: 24 }) })
1872
1935
  ] })
1873
1936
  ] }),
1874
- /* @__PURE__ */ jsx14("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx14(Footer, { items: mappedData }) })
1937
+ /* @__PURE__ */ jsx15("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx15(Footer, { items: mappedData }) })
1875
1938
  ]
1876
1939
  }
1877
1940
  ) })
@@ -1881,7 +1944,7 @@ var ExternalInput = ({
1881
1944
  };
1882
1945
 
1883
1946
  // components/AutoField/fields/ExternalField/index.tsx
1884
- import { jsx as jsx15 } from "react/jsx-runtime";
1947
+ import { jsx as jsx16 } from "react/jsx-runtime";
1885
1948
  var ExternalField = ({
1886
1949
  field,
1887
1950
  onChange,
@@ -1905,7 +1968,7 @@ var ExternalField = ({
1905
1968
  if (field.type !== "external") {
1906
1969
  return null;
1907
1970
  }
1908
- return /* @__PURE__ */ jsx15(Label, { label: label || name, icon: /* @__PURE__ */ jsx15(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ jsx15(
1971
+ return /* @__PURE__ */ jsx16(Label, { label: label || name, icon: /* @__PURE__ */ jsx16(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ jsx16(
1909
1972
  ExternalInput,
1910
1973
  {
1911
1974
  name,
@@ -1930,7 +1993,7 @@ var ExternalField = ({
1930
1993
 
1931
1994
  // components/AutoField/fields/RadioField/index.tsx
1932
1995
  init_react_import();
1933
- import { useMemo as useMemo2 } from "react";
1996
+ import { useMemo as useMemo3 } from "react";
1934
1997
 
1935
1998
  // lib/safe-json-parse.ts
1936
1999
  init_react_import();
@@ -1944,7 +2007,7 @@ var safeJsonParse = (str) => {
1944
2007
  };
1945
2008
 
1946
2009
  // components/AutoField/fields/RadioField/index.tsx
1947
- import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
2010
+ import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
1948
2011
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
1949
2012
  var RadioField = ({
1950
2013
  field,
@@ -1956,26 +2019,26 @@ var RadioField = ({
1956
2019
  label,
1957
2020
  Label
1958
2021
  }) => {
1959
- const flatOptions = useMemo2(
2022
+ const flatOptions = useMemo3(
1960
2023
  () => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
1961
2024
  [field]
1962
2025
  );
1963
2026
  if (field.type !== "radio" || !field.options) {
1964
2027
  return null;
1965
2028
  }
1966
- return /* @__PURE__ */ jsx16(
2029
+ return /* @__PURE__ */ jsx17(
1967
2030
  Label,
1968
2031
  {
1969
- icon: /* @__PURE__ */ jsx16(CircleCheckBig, { size: 16 }),
2032
+ icon: /* @__PURE__ */ jsx17(CircleCheckBig, { size: 16 }),
1970
2033
  label: label || name,
1971
2034
  readOnly,
1972
2035
  el: "div",
1973
- children: /* @__PURE__ */ jsx16("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ jsxs8(
2036
+ children: /* @__PURE__ */ jsx17("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ jsxs8(
1974
2037
  "label",
1975
2038
  {
1976
2039
  className: getClassName11("radio"),
1977
2040
  children: [
1978
- /* @__PURE__ */ jsx16(
2041
+ /* @__PURE__ */ jsx17(
1979
2042
  "input",
1980
2043
  {
1981
2044
  type: "radio",
@@ -1995,7 +2058,7 @@ var RadioField = ({
1995
2058
  checked: value === option.value
1996
2059
  }
1997
2060
  ),
1998
- /* @__PURE__ */ jsx16("div", { className: getClassName11("radioInner"), children: option.label || option.value })
2061
+ /* @__PURE__ */ jsx17("div", { className: getClassName11("radioInner"), children: option.label || option.value })
1999
2062
  ]
2000
2063
  },
2001
2064
  option.label + option.value
@@ -2006,8 +2069,8 @@ var RadioField = ({
2006
2069
 
2007
2070
  // components/AutoField/fields/SelectField/index.tsx
2008
2071
  init_react_import();
2009
- import { useMemo as useMemo3 } from "react";
2010
- import { jsx as jsx17 } from "react/jsx-runtime";
2072
+ import { useMemo as useMemo4 } from "react";
2073
+ import { jsx as jsx18 } from "react/jsx-runtime";
2011
2074
  var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
2012
2075
  var SelectField = ({
2013
2076
  field,
@@ -2019,20 +2082,20 @@ var SelectField = ({
2019
2082
  readOnly,
2020
2083
  id
2021
2084
  }) => {
2022
- const flatOptions = useMemo3(
2085
+ const flatOptions = useMemo4(
2023
2086
  () => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
2024
2087
  [field]
2025
2088
  );
2026
2089
  if (field.type !== "select" || !field.options) {
2027
2090
  return null;
2028
2091
  }
2029
- return /* @__PURE__ */ jsx17(
2092
+ return /* @__PURE__ */ jsx18(
2030
2093
  Label,
2031
2094
  {
2032
2095
  label: label || name,
2033
- icon: /* @__PURE__ */ jsx17(ChevronDown, { size: 16 }),
2096
+ icon: /* @__PURE__ */ jsx18(ChevronDown, { size: 16 }),
2034
2097
  readOnly,
2035
- children: /* @__PURE__ */ jsx17(
2098
+ children: /* @__PURE__ */ jsx18(
2036
2099
  "select",
2037
2100
  {
2038
2101
  id,
@@ -2049,7 +2112,7 @@ var SelectField = ({
2049
2112
  }
2050
2113
  },
2051
2114
  value,
2052
- children: field.options.map((option) => /* @__PURE__ */ jsx17(
2115
+ children: field.options.map((option) => /* @__PURE__ */ jsx18(
2053
2116
  "option",
2054
2117
  {
2055
2118
  label: option.label,
@@ -2065,7 +2128,7 @@ var SelectField = ({
2065
2128
 
2066
2129
  // components/AutoField/fields/TextareaField/index.tsx
2067
2130
  init_react_import();
2068
- import { jsx as jsx18 } from "react/jsx-runtime";
2131
+ import { jsx as jsx19 } from "react/jsx-runtime";
2069
2132
  var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
2070
2133
  var TextareaField = ({
2071
2134
  onChange,
@@ -2076,7 +2139,7 @@ var TextareaField = ({
2076
2139
  Label,
2077
2140
  id
2078
2141
  }) => {
2079
- return /* @__PURE__ */ jsx18(Label, { label: label || name, icon: /* @__PURE__ */ jsx18(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ jsx18(
2142
+ return /* @__PURE__ */ jsx19(Label, { label: label || name, icon: /* @__PURE__ */ jsx19(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ jsx19(
2080
2143
  "textarea",
2081
2144
  {
2082
2145
  id,
@@ -2103,7 +2166,7 @@ init_react_import();
2103
2166
  var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
2104
2167
 
2105
2168
  // components/AutoField/fields/ObjectField/index.tsx
2106
- import { jsx as jsx19 } from "react/jsx-runtime";
2169
+ import { jsx as jsx20 } from "react/jsx-runtime";
2107
2170
  var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
2108
2171
  var ObjectField = ({
2109
2172
  field,
@@ -2115,43 +2178,54 @@ var ObjectField = ({
2115
2178
  readOnly,
2116
2179
  id
2117
2180
  }) => {
2118
- const { selectedItem } = useAppContext();
2181
+ const { readOnlyFields, localName = name } = useNestedFieldContext();
2119
2182
  if (field.type !== "object" || !field.objectFields) {
2120
2183
  return null;
2121
2184
  }
2122
- const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
2123
2185
  const data = value || {};
2124
- return /* @__PURE__ */ jsx19(
2186
+ return /* @__PURE__ */ jsx20(
2125
2187
  Label,
2126
2188
  {
2127
2189
  label: label || name,
2128
- icon: /* @__PURE__ */ jsx19(EllipsisVertical, { size: 16 }),
2190
+ icon: /* @__PURE__ */ jsx20(EllipsisVertical, { size: 16 }),
2129
2191
  el: "div",
2130
2192
  readOnly,
2131
- children: /* @__PURE__ */ jsx19("div", { className: getClassName14(), children: /* @__PURE__ */ jsx19("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
2132
- const subField = field.objectFields[fieldName];
2133
- const subFieldName = `${name}.${fieldName}`;
2134
- const wildcardFieldName = `${name}.${fieldName}`;
2135
- const subReadOnly = readOnly ? readOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
2136
- return /* @__PURE__ */ jsx19(
2137
- AutoFieldPrivate,
2193
+ children: /* @__PURE__ */ jsx20("div", { className: getClassName14(), children: /* @__PURE__ */ jsx20("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
2194
+ const subField = field.objectFields[subName];
2195
+ const subPath = `${name}.${subName}`;
2196
+ const localSubPath = `${localName || name}.${subName}`;
2197
+ const subReadOnly = readOnly ? readOnly : readOnlyFields[localSubPath];
2198
+ const label2 = subField.label || subName;
2199
+ return /* @__PURE__ */ jsx20(
2200
+ NestedFieldProvider,
2138
2201
  {
2139
- name: subFieldName,
2140
- label: subField.label || fieldName,
2141
- id: `${id}_${fieldName}`,
2142
- readOnly: subReadOnly,
2143
- field: subField,
2144
- value: data[fieldName],
2145
- onChange: (val, ui) => {
2146
- onChange(
2147
- __spreadProps(__spreadValues({}, data), {
2148
- [fieldName]: val
2202
+ name: localName || id,
2203
+ subName,
2204
+ readOnlyFields,
2205
+ children: /* @__PURE__ */ jsx20(
2206
+ AutoFieldPrivate,
2207
+ {
2208
+ name: subPath,
2209
+ label: subPath,
2210
+ id: `${id}_${subName}`,
2211
+ readOnly: subReadOnly,
2212
+ field: __spreadProps(__spreadValues({}, subField), {
2213
+ label: label2
2214
+ // May be used by custom fields
2149
2215
  }),
2150
- ui
2151
- );
2152
- }
2216
+ value: data[subName],
2217
+ onChange: (val, ui) => {
2218
+ onChange(
2219
+ __spreadProps(__spreadValues({}, data), {
2220
+ [subName]: val
2221
+ }),
2222
+ ui
2223
+ );
2224
+ }
2225
+ }
2226
+ )
2153
2227
  },
2154
- subFieldName
2228
+ subPath
2155
2229
  );
2156
2230
  }) }) })
2157
2231
  }
@@ -2177,7 +2251,7 @@ var useSafeId = () => {
2177
2251
  };
2178
2252
 
2179
2253
  // components/AutoField/index.tsx
2180
- import { Fragment as Fragment8, jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
2254
+ import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
2181
2255
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
2182
2256
  var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
2183
2257
  var FieldLabel = ({
@@ -2191,14 +2265,14 @@ var FieldLabel = ({
2191
2265
  const El = el;
2192
2266
  return /* @__PURE__ */ jsxs9(El, { className, children: [
2193
2267
  /* @__PURE__ */ jsxs9("div", { className: getClassName15("label"), children: [
2194
- icon ? /* @__PURE__ */ jsx20("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ jsx20(Fragment8, {}),
2268
+ icon ? /* @__PURE__ */ jsx21("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ jsx21(Fragment8, {}),
2195
2269
  label,
2196
- readOnly && /* @__PURE__ */ jsx20("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ jsx20(Lock, { size: "12" }) })
2270
+ readOnly && /* @__PURE__ */ jsx21("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ jsx21(Lock, { size: "12" }) })
2197
2271
  ] }),
2198
2272
  children
2199
2273
  ] });
2200
2274
  };
2201
- var FieldLabelInternal2 = ({
2275
+ var FieldLabelInternal = ({
2202
2276
  children,
2203
2277
  icon,
2204
2278
  label,
@@ -2206,14 +2280,14 @@ var FieldLabelInternal2 = ({
2206
2280
  readOnly
2207
2281
  }) => {
2208
2282
  const { overrides } = useAppContext();
2209
- const Wrapper = useMemo4(
2283
+ const Wrapper = useMemo5(
2210
2284
  () => overrides.fieldLabel || FieldLabel,
2211
2285
  [overrides]
2212
2286
  );
2213
2287
  if (!label) {
2214
- return /* @__PURE__ */ jsx20(Fragment8, { children });
2288
+ return /* @__PURE__ */ jsx21(Fragment8, { children });
2215
2289
  }
2216
- return /* @__PURE__ */ jsx20(
2290
+ return /* @__PURE__ */ jsx21(
2217
2291
  Wrapper,
2218
2292
  {
2219
2293
  label,
@@ -2227,8 +2301,8 @@ var FieldLabelInternal2 = ({
2227
2301
  };
2228
2302
  function AutoFieldInternal(props) {
2229
2303
  var _a, _b, _c, _d, _e, _f, _g, _h;
2230
- const { dispatch, overrides } = useAppContext();
2231
- const { id, Label = FieldLabelInternal2 } = props;
2304
+ const { dispatch, overrides, selectedItem } = useAppContext();
2305
+ const { id, Label = FieldLabelInternal } = props;
2232
2306
  const field = props.field;
2233
2307
  const label = field.label;
2234
2308
  const defaultId = useSafeId();
@@ -2288,20 +2362,30 @@ function AutoFieldInternal(props) {
2288
2362
  return null;
2289
2363
  }
2290
2364
  const CustomField = field.render;
2291
- return /* @__PURE__ */ jsx20("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx20("div", { className: getClassName15(), children: /* @__PURE__ */ jsx20(CustomField, __spreadValues({}, mergedProps)) }) });
2365
+ return /* @__PURE__ */ jsx21("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx21("div", { className: getClassName15(), children: /* @__PURE__ */ jsx21(CustomField, __spreadValues({}, mergedProps)) }) });
2292
2366
  }
2293
2367
  const children = defaultFields[field.type](mergedProps);
2294
2368
  const Render2 = render[field.type];
2295
- return /* @__PURE__ */ jsx20(
2296
- "div",
2369
+ const nestedFieldContext = useContext3(NestedFieldContext);
2370
+ return /* @__PURE__ */ jsx21(
2371
+ NestedFieldContext.Provider,
2297
2372
  {
2298
- className: getClassNameWrapper(),
2299
- onFocus,
2300
- onBlur,
2301
- onClick: (e) => {
2302
- e.stopPropagation();
2373
+ value: {
2374
+ readOnlyFields: nestedFieldContext.readOnlyFields || (selectedItem == null ? void 0 : selectedItem.readOnly) || {},
2375
+ localName: nestedFieldContext.localName
2303
2376
  },
2304
- children: /* @__PURE__ */ jsx20(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
2377
+ children: /* @__PURE__ */ jsx21(
2378
+ "div",
2379
+ {
2380
+ className: getClassNameWrapper(),
2381
+ onFocus,
2382
+ onBlur,
2383
+ onClick: (e) => {
2384
+ e.stopPropagation();
2385
+ },
2386
+ children: /* @__PURE__ */ jsx21(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
2387
+ }
2388
+ )
2305
2389
  }
2306
2390
  );
2307
2391
  }
@@ -2329,11 +2413,11 @@ function AutoFieldPrivate(props) {
2329
2413
  value: localValue,
2330
2414
  onChange: onChangeLocal
2331
2415
  };
2332
- return /* @__PURE__ */ jsx20(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2416
+ return /* @__PURE__ */ jsx21(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2333
2417
  }
2334
2418
  function AutoField(props) {
2335
- const DefaultLabel = useMemo4(() => {
2336
- const DefaultLabel2 = (labelProps) => /* @__PURE__ */ jsx20(
2419
+ const DefaultLabel = useMemo5(() => {
2420
+ const DefaultLabel2 = (labelProps) => /* @__PURE__ */ jsx21(
2337
2421
  "div",
2338
2422
  __spreadProps(__spreadValues({}, labelProps), {
2339
2423
  className: getClassName15({ readOnly: props.readOnly })
@@ -2341,7 +2425,7 @@ function AutoField(props) {
2341
2425
  );
2342
2426
  return DefaultLabel2;
2343
2427
  }, [props.readOnly]);
2344
- return /* @__PURE__ */ jsx20(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2428
+ return /* @__PURE__ */ jsx21(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2345
2429
  }
2346
2430
 
2347
2431
  // components/Drawer/index.tsx
@@ -2353,14 +2437,14 @@ var styles_module_default10 = { "Drawer": "_Drawer_1oa7v_1", "DrawerItem--disabl
2353
2437
 
2354
2438
  // components/Drawer/index.tsx
2355
2439
  import {
2356
- createContext as createContext2,
2357
- useContext as useContext2,
2358
- useMemo as useMemo5
2440
+ createContext as createContext3,
2441
+ useContext as useContext4,
2442
+ useMemo as useMemo6
2359
2443
  } from "react";
2360
- import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
2444
+ import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
2361
2445
  var getClassName16 = get_class_name_factory_default("Drawer", styles_module_default10);
2362
2446
  var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
2363
- var drawerContext = createContext2({
2447
+ var drawerContext = createContext3({
2364
2448
  droppableId: ""
2365
2449
  });
2366
2450
  var DrawerDraggable = ({
@@ -2369,7 +2453,7 @@ var DrawerDraggable = ({
2369
2453
  index,
2370
2454
  isDragDisabled
2371
2455
  }) => {
2372
- return /* @__PURE__ */ jsx21(
2456
+ return /* @__PURE__ */ jsx22(
2373
2457
  Draggable,
2374
2458
  {
2375
2459
  id,
@@ -2391,21 +2475,21 @@ var DrawerItem = ({
2391
2475
  index,
2392
2476
  isDragDisabled
2393
2477
  }) => {
2394
- const ctx = useContext2(drawerContext);
2478
+ const ctx = useContext4(drawerContext);
2395
2479
  const resolvedId = `${ctx.droppableId}::${id || name}`;
2396
- const CustomInner = useMemo5(
2397
- () => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ jsx21("div", { className: getClassNameItem2("default"), children: children2 })),
2480
+ const CustomInner = useMemo6(
2481
+ () => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ jsx22("div", { className: getClassNameItem2("default"), children: children2 })),
2398
2482
  [children]
2399
2483
  );
2400
- return /* @__PURE__ */ jsx21(
2484
+ return /* @__PURE__ */ jsx22(
2401
2485
  DrawerDraggable,
2402
2486
  {
2403
2487
  id: resolvedId,
2404
2488
  index,
2405
2489
  isDragDisabled,
2406
- children: /* @__PURE__ */ jsx21(CustomInner, { name, children: /* @__PURE__ */ jsx21("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs10("div", { className: getClassNameItem2("draggable"), children: [
2407
- /* @__PURE__ */ jsx21("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
2408
- /* @__PURE__ */ jsx21("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx21(DragIcon, { isDragDisabled }) })
2490
+ children: /* @__PURE__ */ jsx22(CustomInner, { name, children: /* @__PURE__ */ jsx22("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs10("div", { className: getClassNameItem2("draggable"), children: [
2491
+ /* @__PURE__ */ jsx22("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
2492
+ /* @__PURE__ */ jsx22("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx22(DragIcon, { isDragDisabled }) })
2409
2493
  ] }) }) })
2410
2494
  }
2411
2495
  );
@@ -2416,7 +2500,7 @@ var Drawer = ({
2416
2500
  direction = "vertical"
2417
2501
  }) => {
2418
2502
  const droppableId = `component-list:${_droppableId}`;
2419
- return /* @__PURE__ */ jsx21(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ jsx21(Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ jsxs10(
2503
+ return /* @__PURE__ */ jsx22(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ jsx22(Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ jsxs10(
2420
2504
  "div",
2421
2505
  __spreadProps(__spreadValues({}, provided.droppableProps), {
2422
2506
  ref: provided.innerRef,
@@ -2425,7 +2509,7 @@ var Drawer = ({
2425
2509
  }),
2426
2510
  children: [
2427
2511
  children,
2428
- /* @__PURE__ */ jsx21("span", { style: { display: "none" }, children: provided.placeholder })
2512
+ /* @__PURE__ */ jsx22("span", { style: { display: "none" }, children: provided.placeholder })
2429
2513
  ]
2430
2514
  })
2431
2515
  ) }) });
@@ -2434,13 +2518,13 @@ Drawer.Item = DrawerItem;
2434
2518
 
2435
2519
  // components/DropZone/index.tsx
2436
2520
  init_react_import();
2437
- import { useContext as useContext3, useEffect as useEffect12 } from "react";
2521
+ import { useContext as useContext5, useEffect as useEffect12 } from "react";
2438
2522
 
2439
2523
  // components/DraggableComponent/index.tsx
2440
2524
  init_react_import();
2441
2525
  import {
2442
2526
  useEffect as useEffect11,
2443
- useMemo as useMemo6,
2527
+ useMemo as useMemo7,
2444
2528
  useState as useState12
2445
2529
  } from "react";
2446
2530
  import { Draggable as Draggable2 } from "@measured/dnd";
@@ -2488,7 +2572,7 @@ var isIos = () => [
2488
2572
  navigator.userAgent.includes("Mac") && "ontouchend" in document;
2489
2573
 
2490
2574
  // components/DraggableComponent/index.tsx
2491
- import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
2575
+ import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
2492
2576
  var getClassName17 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
2493
2577
  var space = 8;
2494
2578
  var actionsOverlayTop = space * 6.5;
@@ -2497,7 +2581,7 @@ var actionsRight = space;
2497
2581
  var DefaultActionBar = ({
2498
2582
  label,
2499
2583
  children
2500
- }) => /* @__PURE__ */ jsx22(ActionBar, { label, children: /* @__PURE__ */ jsx22(ActionBar.Group, { children }) });
2584
+ }) => /* @__PURE__ */ jsx23(ActionBar, { label, children: /* @__PURE__ */ jsx23(ActionBar.Group, { children }) });
2501
2585
  var DraggableComponent = ({
2502
2586
  children,
2503
2587
  id,
@@ -2530,14 +2614,14 @@ var DraggableComponent = ({
2530
2614
  setDisableSecondaryAnimation(true);
2531
2615
  }
2532
2616
  }, []);
2533
- const CustomActionBar = useMemo6(
2617
+ const CustomActionBar = useMemo7(
2534
2618
  () => overrides.actionBar || DefaultActionBar,
2535
2619
  [overrides.actionBar]
2536
2620
  );
2537
2621
  const permissions = getPermissions({
2538
2622
  item: selectedItem
2539
2623
  });
2540
- return /* @__PURE__ */ jsx22(
2624
+ return /* @__PURE__ */ jsx23(
2541
2625
  El,
2542
2626
  {
2543
2627
  draggableId: id,
@@ -2567,15 +2651,15 @@ var DraggableComponent = ({
2567
2651
  onClick,
2568
2652
  children: [
2569
2653
  debug,
2570
- isLoading && /* @__PURE__ */ jsx22("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ jsx22(Loader, {}) }),
2571
- isSelected && /* @__PURE__ */ jsx22(
2654
+ isLoading && /* @__PURE__ */ jsx23("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ jsx23(Loader, {}) }),
2655
+ isSelected && /* @__PURE__ */ jsx23(
2572
2656
  "div",
2573
2657
  {
2574
2658
  className: getClassName17("actionsOverlay"),
2575
2659
  style: {
2576
2660
  top: actionsOverlayTop / zoomConfig.zoom
2577
2661
  },
2578
- children: /* @__PURE__ */ jsx22(
2662
+ children: /* @__PURE__ */ jsx23(
2579
2663
  "div",
2580
2664
  {
2581
2665
  className: getClassName17("actions"),
@@ -2585,15 +2669,15 @@ var DraggableComponent = ({
2585
2669
  right: actionsRight / zoomConfig.zoom
2586
2670
  },
2587
2671
  children: /* @__PURE__ */ jsxs11(CustomActionBar, { label, children: [
2588
- permissions.duplicate && /* @__PURE__ */ jsx22(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ jsx22(Copy, { size: 16 }) }),
2589
- permissions.delete && /* @__PURE__ */ jsx22(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ jsx22(Trash, { size: 16 }) })
2672
+ permissions.duplicate && /* @__PURE__ */ jsx23(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ jsx23(Copy, { size: 16 }) }),
2673
+ permissions.delete && /* @__PURE__ */ jsx23(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ jsx23(Trash, { size: 16 }) })
2590
2674
  ] })
2591
2675
  }
2592
2676
  )
2593
2677
  }
2594
2678
  ),
2595
- /* @__PURE__ */ jsx22("div", { className: getClassName17("overlay") }),
2596
- /* @__PURE__ */ jsx22("div", { className: getClassName17("contents"), children })
2679
+ /* @__PURE__ */ jsx23("div", { className: getClassName17("overlay") }),
2680
+ /* @__PURE__ */ jsx23("div", { className: getClassName17("contents"), children })
2597
2681
  ]
2598
2682
  })
2599
2683
  )
@@ -2609,7 +2693,7 @@ var styles_module_default12 = { "DropZone": "_DropZone_djoti_1", "DropZone-conte
2609
2693
  // components/DropZone/context.tsx
2610
2694
  init_react_import();
2611
2695
  import {
2612
- createContext as createContext3,
2696
+ createContext as createContext4,
2613
2697
  useCallback as useCallback6,
2614
2698
  useState as useState13
2615
2699
  } from "react";
@@ -2628,8 +2712,8 @@ var getZoneId = (zoneCompound) => {
2628
2712
  };
2629
2713
 
2630
2714
  // components/DropZone/context.tsx
2631
- import { Fragment as Fragment9, jsx as jsx23 } from "react/jsx-runtime";
2632
- var dropZoneContext = createContext3(null);
2715
+ import { Fragment as Fragment9, jsx as jsx24 } from "react/jsx-runtime";
2716
+ var dropZoneContext = createContext4(null);
2633
2717
  var DropZoneProvider = ({
2634
2718
  children,
2635
2719
  value
@@ -2706,7 +2790,7 @@ var DropZoneProvider = ({
2706
2790
  [value, setPathData]
2707
2791
  );
2708
2792
  const [zoneWillDrag, setZoneWillDrag] = useState13("");
2709
- return /* @__PURE__ */ jsx23(Fragment9, { children: value && /* @__PURE__ */ jsx23(
2793
+ return /* @__PURE__ */ jsx24(Fragment9, { children: value && /* @__PURE__ */ jsx24(
2710
2794
  dropZoneContext.Provider,
2711
2795
  {
2712
2796
  value: __spreadValues({
@@ -2732,12 +2816,12 @@ var DropZoneProvider = ({
2732
2816
  };
2733
2817
 
2734
2818
  // components/DropZone/index.tsx
2735
- import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
2819
+ import { Fragment as Fragment10, jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
2736
2820
  var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
2737
2821
  function DropZoneEdit({ zone, allow, disallow, style }) {
2738
2822
  var _a;
2739
2823
  const appContext2 = useAppContext();
2740
- const ctx = useContext3(dropZoneContext);
2824
+ const ctx = useContext5(dropZoneContext);
2741
2825
  const {
2742
2826
  // These all need setting via context
2743
2827
  data,
@@ -2787,7 +2871,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
2787
2871
  const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
2788
2872
  const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
2789
2873
  if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
2790
- return /* @__PURE__ */ jsx24("div", { children: "DropZone requires context to work." });
2874
+ return /* @__PURE__ */ jsx25("div", { children: "DropZone requires context to work." });
2791
2875
  }
2792
2876
  const {
2793
2877
  hoveringArea = "root",
@@ -2828,7 +2912,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
2828
2912
  }
2829
2913
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
2830
2914
  const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
2831
- return /* @__PURE__ */ jsx24(
2915
+ return /* @__PURE__ */ jsx25(
2832
2916
  "div",
2833
2917
  {
2834
2918
  className: getClassName18({
@@ -2845,7 +2929,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
2845
2929
  onMouseUp: () => {
2846
2930
  setZoneWillDrag("");
2847
2931
  },
2848
- children: /* @__PURE__ */ jsx24(
2932
+ children: /* @__PURE__ */ jsx25(
2849
2933
  Droppable,
2850
2934
  {
2851
2935
  droppableId: zoneCompound,
@@ -2900,13 +2984,13 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
2900
2984
  className: getClassName18("item"),
2901
2985
  style: { zIndex: isDragging ? 1 : void 0 },
2902
2986
  children: [
2903
- /* @__PURE__ */ jsx24(
2987
+ /* @__PURE__ */ jsx25(
2904
2988
  DropZoneProvider,
2905
2989
  {
2906
2990
  value: __spreadProps(__spreadValues({}, ctx), {
2907
2991
  areaId: componentId
2908
2992
  }),
2909
- children: /* @__PURE__ */ jsx24(
2993
+ children: /* @__PURE__ */ jsx25(
2910
2994
  DraggableComponent,
2911
2995
  {
2912
2996
  label,
@@ -2974,12 +3058,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
2974
3058
  style: {
2975
3059
  pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
2976
3060
  },
2977
- children: /* @__PURE__ */ jsx24("div", { className: getClassName18("renderWrapper"), children: /* @__PURE__ */ jsx24(Render2, __spreadValues({}, defaultedProps)) })
3061
+ children: /* @__PURE__ */ jsx25("div", { className: getClassName18("renderWrapper"), children: /* @__PURE__ */ jsx25(Render2, __spreadValues({}, defaultedProps)) })
2978
3062
  }
2979
3063
  )
2980
3064
  }
2981
3065
  ),
2982
- userIsDragging && /* @__PURE__ */ jsx24(
3066
+ userIsDragging && /* @__PURE__ */ jsx25(
2983
3067
  "div",
2984
3068
  {
2985
3069
  className: getClassName18("hitbox"),
@@ -2996,7 +3080,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
2996
3080
  );
2997
3081
  }),
2998
3082
  provided == null ? void 0 : provided.placeholder,
2999
- (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ jsx24(
3083
+ (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ jsx25(
3000
3084
  "div",
3001
3085
  {
3002
3086
  "data-puck-placeholder": true,
@@ -3017,7 +3101,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
3017
3101
  );
3018
3102
  }
3019
3103
  function DropZoneRender({ zone }) {
3020
- const ctx = useContext3(dropZoneContext);
3104
+ const ctx = useContext5(dropZoneContext);
3021
3105
  const { data, areaId = "root", config } = ctx || {};
3022
3106
  let zoneCompound = rootDroppableId;
3023
3107
  let content = (data == null ? void 0 : data.content) || [];
@@ -3028,14 +3112,14 @@ function DropZoneRender({ zone }) {
3028
3112
  zoneCompound = `${areaId}:${zone}`;
3029
3113
  content = setupZone(data, zoneCompound).zones[zoneCompound];
3030
3114
  }
3031
- return /* @__PURE__ */ jsx24(Fragment10, { children: content.map((item) => {
3115
+ return /* @__PURE__ */ jsx25(Fragment10, { children: content.map((item) => {
3032
3116
  const Component = config.components[item.type];
3033
3117
  if (Component) {
3034
- return /* @__PURE__ */ jsx24(
3118
+ return /* @__PURE__ */ jsx25(
3035
3119
  DropZoneProvider,
3036
3120
  {
3037
3121
  value: { data, config, areaId: item.props.id },
3038
- children: /* @__PURE__ */ jsx24(
3122
+ children: /* @__PURE__ */ jsx25(
3039
3123
  Component.render,
3040
3124
  __spreadProps(__spreadValues({}, item.props), {
3041
3125
  puck: { renderDropZone: DropZone }
@@ -3049,11 +3133,11 @@ function DropZoneRender({ zone }) {
3049
3133
  }) });
3050
3134
  }
3051
3135
  function DropZone(props) {
3052
- const ctx = useContext3(dropZoneContext);
3136
+ const ctx = useContext5(dropZoneContext);
3053
3137
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
3054
- return /* @__PURE__ */ jsx24(DropZoneEdit, __spreadValues({}, props));
3138
+ return /* @__PURE__ */ jsx25(DropZoneEdit, __spreadValues({}, props));
3055
3139
  }
3056
- return /* @__PURE__ */ jsx24(DropZoneRender, __spreadValues({}, props));
3140
+ return /* @__PURE__ */ jsx25(DropZoneRender, __spreadValues({}, props));
3057
3141
  }
3058
3142
 
3059
3143
  // components/Puck/index.tsx
@@ -3061,7 +3145,7 @@ init_react_import();
3061
3145
  import {
3062
3146
  useCallback as useCallback11,
3063
3147
  useEffect as useEffect18,
3064
- useMemo as useMemo15,
3148
+ useMemo as useMemo16,
3065
3149
  useReducer,
3066
3150
  useState as useState21
3067
3151
  } from "react";
@@ -3073,11 +3157,11 @@ import { useState as useState14 } from "react";
3073
3157
  // lib/get-frame.ts
3074
3158
  init_react_import();
3075
3159
  var getFrame = () => {
3076
- let frame = document.querySelector("#preview-frame");
3077
- if ((frame == null ? void 0 : frame.tagName) === "IFRAME") {
3078
- frame = frame.contentDocument;
3160
+ let frameEl = document.querySelector("#preview-frame");
3161
+ if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
3162
+ return frameEl.contentDocument || document;
3079
3163
  }
3080
- return frame;
3164
+ return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
3081
3165
  };
3082
3166
 
3083
3167
  // lib/use-placeholder-style.ts
@@ -3136,7 +3220,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "Si
3136
3220
 
3137
3221
  // lib/use-breadcrumbs.ts
3138
3222
  init_react_import();
3139
- import { useContext as useContext4, useMemo as useMemo7 } from "react";
3223
+ import { useContext as useContext6, useMemo as useMemo8 } from "react";
3140
3224
  var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
3141
3225
  const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
3142
3226
  const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
@@ -3186,8 +3270,8 @@ var useBreadcrumbs = (renderCount) => {
3186
3270
  state: { data },
3187
3271
  selectedItem
3188
3272
  } = useAppContext();
3189
- const dzContext = useContext4(dropZoneContext);
3190
- return useMemo7(() => {
3273
+ const dzContext = useContext6(dropZoneContext);
3274
+ return useMemo8(() => {
3191
3275
  const breadcrumbs = convertPathDataToBreadcrumbs(
3192
3276
  selectedItem,
3193
3277
  dzContext == null ? void 0 : dzContext.pathData,
@@ -3201,7 +3285,7 @@ var useBreadcrumbs = (renderCount) => {
3201
3285
  };
3202
3286
 
3203
3287
  // components/SidebarSection/index.tsx
3204
- import { jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
3288
+ import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
3205
3289
  var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
3206
3290
  var SidebarSection = ({
3207
3291
  children,
@@ -3220,9 +3304,9 @@ var SidebarSection = ({
3220
3304
  className: getClassName19({ noBorderTop, noPadding }),
3221
3305
  style: { background },
3222
3306
  children: [
3223
- /* @__PURE__ */ jsx25("div", { className: getClassName19("title"), children: /* @__PURE__ */ jsxs13("div", { className: getClassName19("breadcrumbs"), children: [
3307
+ /* @__PURE__ */ jsx26("div", { className: getClassName19("title"), children: /* @__PURE__ */ jsxs13("div", { className: getClassName19("breadcrumbs"), children: [
3224
3308
  showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs13("div", { className: getClassName19("breadcrumb"), children: [
3225
- /* @__PURE__ */ jsx25(
3309
+ /* @__PURE__ */ jsx26(
3226
3310
  "button",
3227
3311
  {
3228
3312
  type: "button",
@@ -3231,12 +3315,12 @@ var SidebarSection = ({
3231
3315
  children: breadcrumb.label
3232
3316
  }
3233
3317
  ),
3234
- /* @__PURE__ */ jsx25(ChevronRight, { size: 16 })
3318
+ /* @__PURE__ */ jsx26(ChevronRight, { size: 16 })
3235
3319
  ] }, i)) : null,
3236
- /* @__PURE__ */ jsx25("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx25(Heading, { rank: "2", size: "xs", children: title }) })
3320
+ /* @__PURE__ */ jsx26("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx26(Heading, { rank: "2", size: "xs", children: title }) })
3237
3321
  ] }) }),
3238
- /* @__PURE__ */ jsx25("div", { className: getClassName19("content"), children }),
3239
- isLoading && /* @__PURE__ */ jsx25("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ jsx25(Loader, { size: 32 }) })
3322
+ /* @__PURE__ */ jsx26("div", { className: getClassName19("content"), children }),
3323
+ isLoading && /* @__PURE__ */ jsx26("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ jsx26(Loader, { size: 32 }) })
3240
3324
  ]
3241
3325
  }
3242
3326
  );
@@ -3439,6 +3523,9 @@ function reduceData(data, action, config) {
3439
3523
  });
3440
3524
  }
3441
3525
  if (action.type === "move") {
3526
+ if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
3527
+ return data;
3528
+ }
3442
3529
  const newData = setupZone(
3443
3530
  setupZone(data, action.sourceZone),
3444
3531
  action.destinationZone
@@ -3617,7 +3704,7 @@ init_react_import();
3617
3704
  var styles_module_default14 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
3618
3705
 
3619
3706
  // components/MenuBar/index.tsx
3620
- import { Fragment as Fragment11, jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
3707
+ import { Fragment as Fragment11, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
3621
3708
  var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
3622
3709
  function MenuBar({
3623
3710
  appState,
@@ -3631,7 +3718,7 @@ function MenuBar({
3631
3718
  history: { back, forward, historyStore }
3632
3719
  } = useAppContext();
3633
3720
  const { hasFuture = false, hasPast = false } = historyStore || {};
3634
- return /* @__PURE__ */ jsx26(
3721
+ return /* @__PURE__ */ jsx27(
3635
3722
  "div",
3636
3723
  {
3637
3724
  className: getClassName20({ menuOpen }),
@@ -3647,10 +3734,10 @@ function MenuBar({
3647
3734
  },
3648
3735
  children: /* @__PURE__ */ jsxs14("div", { className: getClassName20("inner"), children: [
3649
3736
  /* @__PURE__ */ jsxs14("div", { className: getClassName20("history"), children: [
3650
- /* @__PURE__ */ jsx26(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ jsx26(Undo2, { size: 21 }) }),
3651
- /* @__PURE__ */ jsx26(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ jsx26(Redo2, { size: 21 }) })
3737
+ /* @__PURE__ */ jsx27(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ jsx27(Undo2, { size: 21 }) }),
3738
+ /* @__PURE__ */ jsx27(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ jsx27(Redo2, { size: 21 }) })
3652
3739
  ] }),
3653
- /* @__PURE__ */ jsx26(Fragment11, { children: renderHeaderActions && renderHeaderActions({
3740
+ /* @__PURE__ */ jsx27(Fragment11, { children: renderHeaderActions && renderHeaderActions({
3654
3741
  state: appState,
3655
3742
  dispatch
3656
3743
  }) })
@@ -3671,15 +3758,15 @@ init_react_import();
3671
3758
  var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields--isLoading": "_PuckFields--isLoading_jp3lw_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_jp3lw_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_jp3lw_25" };
3672
3759
 
3673
3760
  // components/Puck/components/Fields/index.tsx
3674
- import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo8, useState as useState15 } from "react";
3761
+ import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo9, useState as useState15 } from "react";
3675
3762
 
3676
3763
  // lib/use-parent.ts
3677
3764
  init_react_import();
3678
- import { useContext as useContext5 } from "react";
3765
+ import { useContext as useContext7 } from "react";
3679
3766
  var useParent = (itemSelector) => {
3680
3767
  var _a;
3681
3768
  const { selectedItem, state } = useAppContext();
3682
- const { pathData } = useContext5(dropZoneContext) || {};
3769
+ const { pathData } = useContext7(dropZoneContext) || {};
3683
3770
  const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
3684
3771
  const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
3685
3772
  const lastItem = breadcrumbs[breadcrumbs.length - 1];
@@ -3688,7 +3775,7 @@ var useParent = (itemSelector) => {
3688
3775
  };
3689
3776
 
3690
3777
  // components/Puck/components/Fields/index.tsx
3691
- import { Fragment as Fragment12, jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
3778
+ import { Fragment as Fragment12, jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
3692
3779
  var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
3693
3780
  var defaultPageFields = {
3694
3781
  title: { type: "text" }
@@ -3696,7 +3783,7 @@ var defaultPageFields = {
3696
3783
  var DefaultFields = ({
3697
3784
  children
3698
3785
  }) => {
3699
- return /* @__PURE__ */ jsx27(Fragment12, { children });
3786
+ return /* @__PURE__ */ jsx28(Fragment12, { children });
3700
3787
  };
3701
3788
  var useResolvedFields = () => {
3702
3789
  var _a, _b;
@@ -3705,7 +3792,7 @@ var useResolvedFields = () => {
3705
3792
  const { data } = state;
3706
3793
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
3707
3794
  const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
3708
- const defaultFields = useMemo8(
3795
+ const defaultFields = useMemo9(
3709
3796
  () => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
3710
3797
  [selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
3711
3798
  );
@@ -3787,7 +3874,7 @@ var Fields = () => {
3787
3874
  const componentResolving = selectedItem ? ((_a = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a.loadingCount) > 0 : ((_b = componentState["puck-root"]) == null ? void 0 : _b.loadingCount) > 0;
3788
3875
  const isLoading = fieldsResolving || componentResolving;
3789
3876
  const rootProps = data.root.props || data.root;
3790
- const Wrapper = useMemo8(() => overrides.fields || DefaultFields, [overrides]);
3877
+ const Wrapper = useMemo9(() => overrides.fields || DefaultFields, [overrides]);
3791
3878
  return /* @__PURE__ */ jsxs15(
3792
3879
  "form",
3793
3880
  {
@@ -3796,7 +3883,7 @@ var Fields = () => {
3796
3883
  e.preventDefault();
3797
3884
  },
3798
3885
  children: [
3799
- /* @__PURE__ */ jsx27(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
3886
+ /* @__PURE__ */ jsx28(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
3800
3887
  const field = fields[fieldName];
3801
3888
  if (!(field == null ? void 0 : field.type)) return null;
3802
3889
  const onChange = (value, updatedUi) => {
@@ -3867,7 +3954,7 @@ var Fields = () => {
3867
3954
  item: selectedItem
3868
3955
  });
3869
3956
  const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
3870
- return /* @__PURE__ */ jsx27(
3957
+ return /* @__PURE__ */ jsx28(
3871
3958
  AutoFieldPrivate,
3872
3959
  {
3873
3960
  field,
@@ -3885,7 +3972,7 @@ var Fields = () => {
3885
3972
  root: true
3886
3973
  });
3887
3974
  const id = `root_${field.type}_${fieldName}`;
3888
- return /* @__PURE__ */ jsx27(
3975
+ return /* @__PURE__ */ jsx28(
3889
3976
  AutoFieldPrivate,
3890
3977
  {
3891
3978
  field,
@@ -3899,7 +3986,7 @@ var Fields = () => {
3899
3986
  );
3900
3987
  }
3901
3988
  }) }),
3902
- isLoading && /* @__PURE__ */ jsx27("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx27("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx27(Loader, { size: 16 }) }) })
3989
+ isLoading && /* @__PURE__ */ jsx28("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx28("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx28(Loader, { size: 16 }) }) })
3903
3990
  ]
3904
3991
  }
3905
3992
  );
@@ -3920,7 +4007,7 @@ init_react_import();
3920
4007
  var styles_module_default17 = { "ComponentList": "_ComponentList_odh9d_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_odh9d_5", "ComponentList-content": "_ComponentList-content_odh9d_9", "ComponentList-title": "_ComponentList-title_odh9d_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_odh9d_53" };
3921
4008
 
3922
4009
  // components/ComponentList/index.tsx
3923
- import { jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
4010
+ import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
3924
4011
  var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
3925
4012
  var ComponentListItem = ({
3926
4013
  name,
@@ -3931,7 +4018,7 @@ var ComponentListItem = ({
3931
4018
  const canInsert = getPermissions({
3932
4019
  type: name
3933
4020
  }).insert;
3934
- return /* @__PURE__ */ jsx28(
4021
+ return /* @__PURE__ */ jsx29(
3935
4022
  Drawer.Item,
3936
4023
  {
3937
4024
  label,
@@ -3964,14 +4051,14 @@ var ComponentList = ({
3964
4051
  }),
3965
4052
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
3966
4053
  children: [
3967
- /* @__PURE__ */ jsx28("div", { children: title }),
3968
- /* @__PURE__ */ jsx28("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ jsx28(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx28(ChevronDown, { size: 12 }) })
4054
+ /* @__PURE__ */ jsx29("div", { children: title }),
4055
+ /* @__PURE__ */ jsx29("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ jsx29(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx29(ChevronDown, { size: 12 }) })
3969
4056
  ]
3970
4057
  }
3971
4058
  ),
3972
- /* @__PURE__ */ jsx28("div", { className: getClassName22("content"), children: /* @__PURE__ */ jsx28(Drawer, { droppableId: title, children: children || Object.keys(config.components).map((componentKey, i) => {
4059
+ /* @__PURE__ */ jsx29("div", { className: getClassName22("content"), children: /* @__PURE__ */ jsx29(Drawer, { droppableId: title, children: children || Object.keys(config.components).map((componentKey, i) => {
3973
4060
  var _a;
3974
- return /* @__PURE__ */ jsx28(
4061
+ return /* @__PURE__ */ jsx29(
3975
4062
  ComponentListItem,
3976
4063
  {
3977
4064
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -3986,7 +4073,7 @@ var ComponentList = ({
3986
4073
  ComponentList.Item = ComponentListItem;
3987
4074
 
3988
4075
  // lib/use-component-list.tsx
3989
- import { jsx as jsx29 } from "react/jsx-runtime";
4076
+ import { jsx as jsx30 } from "react/jsx-runtime";
3990
4077
  var useComponentList = (config, ui) => {
3991
4078
  const [componentList, setComponentList] = useState16();
3992
4079
  useEffect14(() => {
@@ -3999,7 +4086,7 @@ var useComponentList = (config, ui) => {
3999
4086
  if (category.visible === false || !category.components) {
4000
4087
  return null;
4001
4088
  }
4002
- return /* @__PURE__ */ jsx29(
4089
+ return /* @__PURE__ */ jsx30(
4003
4090
  ComponentList,
4004
4091
  {
4005
4092
  id: categoryKey,
@@ -4008,7 +4095,7 @@ var useComponentList = (config, ui) => {
4008
4095
  var _a2;
4009
4096
  matchedComponents.push(componentName);
4010
4097
  const componentConf = config.components[componentName] || {};
4011
- return /* @__PURE__ */ jsx29(
4098
+ return /* @__PURE__ */ jsx30(
4012
4099
  ComponentList.Item,
4013
4100
  {
4014
4101
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -4028,7 +4115,7 @@ var useComponentList = (config, ui) => {
4028
4115
  );
4029
4116
  if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
4030
4117
  _componentList.push(
4031
- /* @__PURE__ */ jsx29(
4118
+ /* @__PURE__ */ jsx30(
4032
4119
  ComponentList,
4033
4120
  {
4034
4121
  id: "other",
@@ -4036,7 +4123,7 @@ var useComponentList = (config, ui) => {
4036
4123
  children: remainingComponents.map((componentName, i) => {
4037
4124
  var _a2;
4038
4125
  const componentConf = config.components[componentName] || {};
4039
- return /* @__PURE__ */ jsx29(
4126
+ return /* @__PURE__ */ jsx30(
4040
4127
  ComponentList.Item,
4041
4128
  {
4042
4129
  name: componentName,
@@ -4058,31 +4145,31 @@ var useComponentList = (config, ui) => {
4058
4145
  };
4059
4146
 
4060
4147
  // components/Puck/components/Components/index.tsx
4061
- import { useMemo as useMemo9 } from "react";
4062
- import { jsx as jsx30 } from "react/jsx-runtime";
4148
+ import { useMemo as useMemo10 } from "react";
4149
+ import { jsx as jsx31 } from "react/jsx-runtime";
4063
4150
  var Components = () => {
4064
4151
  const { config, state, overrides } = useAppContext();
4065
4152
  const componentList = useComponentList(config, state.ui);
4066
- const Wrapper = useMemo9(() => overrides.components || "div", [overrides]);
4067
- return /* @__PURE__ */ jsx30(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx30(ComponentList, { id: "all" }) });
4153
+ const Wrapper = useMemo10(() => overrides.components || "div", [overrides]);
4154
+ return /* @__PURE__ */ jsx31(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx31(ComponentList, { id: "all" }) });
4068
4155
  };
4069
4156
 
4070
4157
  // components/Puck/components/Preview/index.tsx
4071
4158
  init_react_import();
4072
- import { useCallback as useCallback8, useMemo as useMemo10 } from "react";
4159
+ import { useCallback as useCallback8, useMemo as useMemo11 } from "react";
4073
4160
 
4074
4161
  // components/AutoFrame/index.tsx
4075
4162
  init_react_import();
4076
4163
  import {
4077
- createContext as createContext4,
4078
- useContext as useContext6,
4164
+ createContext as createContext5,
4165
+ useContext as useContext8,
4079
4166
  useEffect as useEffect15,
4080
- useRef as useRef3,
4167
+ useRef as useRef2,
4081
4168
  useState as useState17
4082
4169
  } from "react";
4083
4170
  import hash from "object-hash";
4084
4171
  import { createPortal as createPortal2 } from "react-dom";
4085
- import { Fragment as Fragment13, jsx as jsx31 } from "react/jsx-runtime";
4172
+ import { Fragment as Fragment13, jsx as jsx32 } from "react/jsx-runtime";
4086
4173
  var styleSelector = 'style, link[rel="stylesheet"]';
4087
4174
  var collectStyles = (doc) => {
4088
4175
  const collected = [];
@@ -4282,10 +4369,10 @@ var CopyHostStyles = ({
4282
4369
  observer.disconnect();
4283
4370
  };
4284
4371
  }, []);
4285
- return /* @__PURE__ */ jsx31(Fragment13, { children });
4372
+ return /* @__PURE__ */ jsx32(Fragment13, { children });
4286
4373
  };
4287
- var autoFrameContext = createContext4({});
4288
- var useFrame = () => useContext6(autoFrameContext);
4374
+ var autoFrameContext = createContext5({});
4375
+ var useFrame = () => useContext8(autoFrameContext);
4289
4376
  function AutoFrame(_a) {
4290
4377
  var _b = _a, {
4291
4378
  children,
@@ -4302,7 +4389,7 @@ function AutoFrame(_a) {
4302
4389
  ]);
4303
4390
  const [loaded, setLoaded] = useState17(false);
4304
4391
  const [ctx, setCtx] = useState17({});
4305
- const ref = useRef3(null);
4392
+ const ref = useRef2(null);
4306
4393
  const [mountTarget, setMountTarget] = useState17();
4307
4394
  useEffect15(() => {
4308
4395
  var _a2;
@@ -4314,7 +4401,7 @@ function AutoFrame(_a) {
4314
4401
  setMountTarget((_a2 = ref.current.contentDocument) == null ? void 0 : _a2.getElementById("frame-root"));
4315
4402
  }
4316
4403
  }, [ref, loaded]);
4317
- return /* @__PURE__ */ jsx31(
4404
+ return /* @__PURE__ */ jsx32(
4318
4405
  "iframe",
4319
4406
  __spreadProps(__spreadValues({}, props), {
4320
4407
  className,
@@ -4324,7 +4411,7 @@ function AutoFrame(_a) {
4324
4411
  onLoad: () => {
4325
4412
  setLoaded(true);
4326
4413
  },
4327
- children: /* @__PURE__ */ jsx31(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx31(CopyHostStyles, { debug, onStylesLoaded, children: createPortal2(children, mountTarget) }) })
4414
+ children: /* @__PURE__ */ jsx32(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx32(CopyHostStyles, { debug, onStylesLoaded, children: createPortal2(children, mountTarget) }) })
4328
4415
  })
4329
4416
  );
4330
4417
  }
@@ -4336,7 +4423,7 @@ init_react_import();
4336
4423
  var styles_module_default18 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
4337
4424
 
4338
4425
  // components/Puck/components/Preview/index.tsx
4339
- import { Fragment as Fragment14, jsx as jsx32 } from "react/jsx-runtime";
4426
+ import { Fragment as Fragment14, jsx as jsx33 } from "react/jsx-runtime";
4340
4427
  var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
4341
4428
  var Preview = ({ id = "puck-preview" }) => {
4342
4429
  const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
@@ -4345,13 +4432,13 @@ var Preview = ({ id = "puck-preview" }) => {
4345
4432
  var _a, _b;
4346
4433
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
4347
4434
  id: "puck-root"
4348
- }, pageProps)) : /* @__PURE__ */ jsx32(Fragment14, { children: pageProps.children });
4435
+ }, pageProps)) : /* @__PURE__ */ jsx33(Fragment14, { children: pageProps.children });
4349
4436
  },
4350
4437
  [config.root]
4351
4438
  );
4352
- const Frame = useMemo10(() => overrides.iframe, [overrides]);
4439
+ const Frame = useMemo11(() => overrides.iframe, [overrides]);
4353
4440
  const rootProps = state.data.root.props || state.data.root;
4354
- return /* @__PURE__ */ jsx32(
4441
+ return /* @__PURE__ */ jsx33(
4355
4442
  "div",
4356
4443
  {
4357
4444
  className: getClassName23(),
@@ -4359,7 +4446,7 @@ var Preview = ({ id = "puck-preview" }) => {
4359
4446
  onClick: () => {
4360
4447
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
4361
4448
  },
4362
- children: iframe.enabled ? /* @__PURE__ */ jsx32(
4449
+ children: iframe.enabled ? /* @__PURE__ */ jsx33(
4363
4450
  AutoFrame_default,
4364
4451
  {
4365
4452
  id: "preview-frame",
@@ -4368,27 +4455,27 @@ var Preview = ({ id = "puck-preview" }) => {
4368
4455
  onStylesLoaded: () => {
4369
4456
  setStatus("READY");
4370
4457
  },
4371
- children: /* @__PURE__ */ jsx32(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
4372
- const inner = /* @__PURE__ */ jsx32(
4458
+ children: /* @__PURE__ */ jsx33(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
4459
+ const inner = /* @__PURE__ */ jsx33(
4373
4460
  Page,
4374
4461
  __spreadProps(__spreadValues({}, rootProps), {
4375
4462
  puck: { renderDropZone: DropZone, isEditing: true },
4376
4463
  editMode: true,
4377
- children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
4464
+ children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
4378
4465
  })
4379
4466
  );
4380
4467
  if (Frame) {
4381
- return /* @__PURE__ */ jsx32(Frame, { document: document2, children: inner });
4468
+ return /* @__PURE__ */ jsx33(Frame, { document: document2, children: inner });
4382
4469
  }
4383
4470
  return inner;
4384
4471
  } })
4385
4472
  }
4386
- ) : /* @__PURE__ */ jsx32("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ jsx32(
4473
+ ) : /* @__PURE__ */ jsx33("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ jsx33(
4387
4474
  Page,
4388
4475
  __spreadProps(__spreadValues({}, rootProps), {
4389
4476
  puck: { renderDropZone: DropZone, isEditing: true },
4390
4477
  editMode: true,
4391
- children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
4478
+ children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
4392
4479
  })
4393
4480
  ) })
4394
4481
  }
@@ -4438,7 +4525,7 @@ var scrollIntoView = (el) => {
4438
4525
  };
4439
4526
 
4440
4527
  // components/LayerTree/index.tsx
4441
- import { useContext as useContext7 } from "react";
4528
+ import { useContext as useContext9 } from "react";
4442
4529
 
4443
4530
  // lib/is-child-of-zone.ts
4444
4531
  init_react_import();
@@ -4452,7 +4539,7 @@ var isChildOfZone = (item, maybeChild, ctx) => {
4452
4539
  };
4453
4540
 
4454
4541
  // components/LayerTree/index.tsx
4455
- import { Fragment as Fragment15, jsx as jsx33, jsxs as jsxs17 } from "react/jsx-runtime";
4542
+ import { Fragment as Fragment15, jsx as jsx34, jsxs as jsxs17 } from "react/jsx-runtime";
4456
4543
  var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
4457
4544
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
4458
4545
  var LayerTree = ({
@@ -4465,15 +4552,15 @@ var LayerTree = ({
4465
4552
  label
4466
4553
  }) => {
4467
4554
  const zones = data.zones || {};
4468
- const ctx = useContext7(dropZoneContext);
4555
+ const ctx = useContext9(dropZoneContext);
4469
4556
  return /* @__PURE__ */ jsxs17(Fragment15, { children: [
4470
4557
  label && /* @__PURE__ */ jsxs17("div", { className: getClassName24("zoneTitle"), children: [
4471
- /* @__PURE__ */ jsx33("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
4558
+ /* @__PURE__ */ jsx34("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx34(Layers, { size: "16" }) }),
4472
4559
  " ",
4473
4560
  label
4474
4561
  ] }),
4475
4562
  /* @__PURE__ */ jsxs17("ul", { className: getClassName24(), children: [
4476
- zoneContent.length === 0 && /* @__PURE__ */ jsx33("div", { className: getClassName24("helper"), children: "No items" }),
4563
+ zoneContent.length === 0 && /* @__PURE__ */ jsx34("div", { className: getClassName24("helper"), children: "No items" }),
4477
4564
  zoneContent.map((item, i) => {
4478
4565
  var _a;
4479
4566
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
@@ -4501,7 +4588,7 @@ var LayerTree = ({
4501
4588
  childIsSelected
4502
4589
  }),
4503
4590
  children: [
4504
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs17(
4591
+ /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs17(
4505
4592
  "button",
4506
4593
  {
4507
4594
  type: "button",
@@ -4534,22 +4621,22 @@ var LayerTree = ({
4534
4621
  setHoveringComponent(null);
4535
4622
  },
4536
4623
  children: [
4537
- containsZone && /* @__PURE__ */ jsx33(
4624
+ containsZone && /* @__PURE__ */ jsx34(
4538
4625
  "div",
4539
4626
  {
4540
4627
  className: getClassNameLayer("chevron"),
4541
4628
  title: isSelected ? "Collapse" : "Expand",
4542
- children: /* @__PURE__ */ jsx33(ChevronDown, { size: "12" })
4629
+ children: /* @__PURE__ */ jsx34(ChevronDown, { size: "12" })
4543
4630
  }
4544
4631
  ),
4545
4632
  /* @__PURE__ */ jsxs17("div", { className: getClassNameLayer("title"), children: [
4546
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ jsx33(Type, { size: "16" }) : /* @__PURE__ */ jsx33(LayoutGrid, { size: "16" }) }),
4547
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("name"), children: label2 })
4633
+ /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ jsx34(Type, { size: "16" }) : /* @__PURE__ */ jsx34(LayoutGrid, { size: "16" }) }),
4634
+ /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("name"), children: label2 })
4548
4635
  ] })
4549
4636
  ]
4550
4637
  }
4551
4638
  ) }),
4552
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx33(
4639
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx34(
4553
4640
  LayerTree,
4554
4641
  {
4555
4642
  config,
@@ -4571,8 +4658,8 @@ var LayerTree = ({
4571
4658
  };
4572
4659
 
4573
4660
  // components/Puck/components/Outline/index.tsx
4574
- import { useCallback as useCallback9, useMemo as useMemo11 } from "react";
4575
- import { Fragment as Fragment16, jsx as jsx34, jsxs as jsxs18 } from "react/jsx-runtime";
4661
+ import { useCallback as useCallback9, useMemo as useMemo12 } from "react";
4662
+ import { Fragment as Fragment16, jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
4576
4663
  var Outline = () => {
4577
4664
  const { dispatch, state, overrides, config } = useAppContext();
4578
4665
  const { data, ui } = state;
@@ -4586,9 +4673,9 @@ var Outline = () => {
4586
4673
  },
4587
4674
  []
4588
4675
  );
4589
- const Wrapper = useMemo11(() => overrides.outline || "div", [overrides]);
4590
- return /* @__PURE__ */ jsx34(Wrapper, { children: /* @__PURE__ */ jsx34(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsxs18(Fragment16, { children: [
4591
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ jsx34(
4676
+ const Wrapper = useMemo12(() => overrides.outline || "div", [overrides]);
4677
+ return /* @__PURE__ */ jsx35(Wrapper, { children: /* @__PURE__ */ jsx35(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsxs18(Fragment16, { children: [
4678
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ jsx35(
4592
4679
  LayerTree,
4593
4680
  {
4594
4681
  config,
@@ -4601,7 +4688,7 @@ var Outline = () => {
4601
4688
  ),
4602
4689
  Object.entries(findZonesForArea(data, "root")).map(
4603
4690
  ([zoneKey, zone]) => {
4604
- return /* @__PURE__ */ jsx34(
4691
+ return /* @__PURE__ */ jsx35(
4605
4692
  LayerTree,
4606
4693
  {
4607
4694
  config,
@@ -4625,7 +4712,8 @@ import { useHotkeys } from "react-hotkeys-hook";
4625
4712
  function usePuckHistory({
4626
4713
  dispatch,
4627
4714
  initialAppState,
4628
- historyStore
4715
+ historyStore,
4716
+ iframeEnabled
4629
4717
  }) {
4630
4718
  const back = () => {
4631
4719
  var _a;
@@ -4643,6 +4731,16 @@ function usePuckHistory({
4643
4731
  historyStore.forward();
4644
4732
  }
4645
4733
  };
4734
+ const backIframe = () => {
4735
+ if (iframeEnabled) {
4736
+ back();
4737
+ }
4738
+ };
4739
+ const forwardIframe = () => {
4740
+ if (iframeEnabled) {
4741
+ forward();
4742
+ }
4743
+ };
4646
4744
  const setHistories = (histories) => {
4647
4745
  var _a;
4648
4746
  dispatch({
@@ -4661,9 +4759,23 @@ function usePuckHistory({
4661
4759
  historyStore.setHistoryIndex(index);
4662
4760
  }
4663
4761
  };
4762
+ const frame = getFrame();
4763
+ const resolvedFrame = frame !== document ? frame : void 0;
4664
4764
  useHotkeys("meta+z", back, { preventDefault: true });
4665
4765
  useHotkeys("meta+shift+z", forward, { preventDefault: true });
4666
4766
  useHotkeys("meta+y", forward, { preventDefault: true });
4767
+ useHotkeys("meta+z", backIframe, {
4768
+ preventDefault: true,
4769
+ document: resolvedFrame
4770
+ });
4771
+ useHotkeys("meta+shift+z", forwardIframe, {
4772
+ preventDefault: true,
4773
+ document: resolvedFrame
4774
+ });
4775
+ useHotkeys("meta+y", forwardIframe, {
4776
+ preventDefault: true,
4777
+ document: resolvedFrame
4778
+ });
4667
4779
  return {
4668
4780
  back,
4669
4781
  forward,
@@ -4850,25 +4962,25 @@ var getBox = function getBox2(el) {
4850
4962
  import {
4851
4963
  useCallback as useCallback10,
4852
4964
  useEffect as useEffect17,
4853
- useMemo as useMemo13,
4854
- useRef as useRef4,
4965
+ useMemo as useMemo14,
4966
+ useRef as useRef3,
4855
4967
  useState as useState20
4856
4968
  } from "react";
4857
4969
 
4858
4970
  // components/ViewportControls/index.tsx
4859
4971
  init_react_import();
4860
- import { useEffect as useEffect16, useMemo as useMemo12, useState as useState19 } from "react";
4972
+ import { useEffect as useEffect16, useMemo as useMemo13, useState as useState19 } from "react";
4861
4973
 
4862
4974
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
4863
4975
  init_react_import();
4864
4976
  var styles_module_default20 = { "ViewportControls": "_ViewportControls_g1wgg_1", "ViewportControls-divider": "_ViewportControls-divider_g1wgg_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_g1wgg_21", "ViewportButton--isActive": "_ViewportButton--isActive_g1wgg_34", "ViewportButton-inner": "_ViewportButton-inner_g1wgg_34" };
4865
4977
 
4866
4978
  // components/ViewportControls/index.tsx
4867
- import { jsx as jsx35, jsxs as jsxs19 } from "react/jsx-runtime";
4979
+ import { jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
4868
4980
  var icons = {
4869
- Smartphone: /* @__PURE__ */ jsx35(Smartphone, { size: 16 }),
4870
- Tablet: /* @__PURE__ */ jsx35(Tablet, { size: 16 }),
4871
- Monitor: /* @__PURE__ */ jsx35(Monitor, { size: 16 })
4981
+ Smartphone: /* @__PURE__ */ jsx36(Smartphone, { size: 16 }),
4982
+ Tablet: /* @__PURE__ */ jsx36(Tablet, { size: 16 }),
4983
+ Monitor: /* @__PURE__ */ jsx36(Monitor, { size: 16 })
4872
4984
  };
4873
4985
  var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
4874
4986
  var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
@@ -4884,7 +4996,7 @@ var ViewportButton = ({
4884
4996
  useEffect16(() => {
4885
4997
  setIsActive(width === state.ui.viewports.current.width);
4886
4998
  }, [width, state.ui.viewports.current.width]);
4887
- return /* @__PURE__ */ jsx35("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx35(
4999
+ return /* @__PURE__ */ jsx36("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx36(
4888
5000
  IconButton,
4889
5001
  {
4890
5002
  title,
@@ -4893,7 +5005,7 @@ var ViewportButton = ({
4893
5005
  e.stopPropagation();
4894
5006
  onClick({ width, height });
4895
5007
  },
4896
- children: /* @__PURE__ */ jsx35("span", { className: getClassNameButton("inner"), children })
5008
+ children: /* @__PURE__ */ jsx36("span", { className: getClassNameButton("inner"), children })
4897
5009
  }
4898
5010
  ) });
4899
5011
  };
@@ -4917,7 +5029,7 @@ var ViewportControls = ({
4917
5029
  const defaultsContainAutoZoom = defaultZoomOptions.find(
4918
5030
  (option) => option.value === autoZoom
4919
5031
  );
4920
- const zoomOptions = useMemo12(
5032
+ const zoomOptions = useMemo13(
4921
5033
  () => [
4922
5034
  ...defaultZoomOptions,
4923
5035
  ...defaultsContainAutoZoom ? [] : [
@@ -4930,7 +5042,7 @@ var ViewportControls = ({
4930
5042
  [autoZoom]
4931
5043
  );
4932
5044
  return /* @__PURE__ */ jsxs19("div", { className: getClassName25(), children: [
4933
- viewports.map((viewport, i) => /* @__PURE__ */ jsx35(
5045
+ viewports.map((viewport, i) => /* @__PURE__ */ jsx36(
4934
5046
  ViewportButton,
4935
5047
  {
4936
5048
  height: viewport.height,
@@ -4941,8 +5053,8 @@ var ViewportControls = ({
4941
5053
  },
4942
5054
  i
4943
5055
  )),
4944
- /* @__PURE__ */ jsx35("div", { className: getClassName25("divider") }),
4945
- /* @__PURE__ */ jsx35(
5056
+ /* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
5057
+ /* @__PURE__ */ jsx36(
4946
5058
  IconButton,
4947
5059
  {
4948
5060
  title: "Zoom viewport out",
@@ -4956,10 +5068,10 @@ var ViewportControls = ({
4956
5068
  )].value
4957
5069
  );
4958
5070
  },
4959
- children: /* @__PURE__ */ jsx35(ZoomOut, { size: 16 })
5071
+ children: /* @__PURE__ */ jsx36(ZoomOut, { size: 16 })
4960
5072
  }
4961
5073
  ),
4962
- /* @__PURE__ */ jsx35(
5074
+ /* @__PURE__ */ jsx36(
4963
5075
  IconButton,
4964
5076
  {
4965
5077
  title: "Zoom viewport in",
@@ -4973,11 +5085,11 @@ var ViewportControls = ({
4973
5085
  )].value
4974
5086
  );
4975
5087
  },
4976
- children: /* @__PURE__ */ jsx35(ZoomIn, { size: 16 })
5088
+ children: /* @__PURE__ */ jsx36(ZoomIn, { size: 16 })
4977
5089
  }
4978
5090
  ),
4979
- /* @__PURE__ */ jsx35("div", { className: getClassName25("divider") }),
4980
- /* @__PURE__ */ jsx35(
5091
+ /* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
5092
+ /* @__PURE__ */ jsx36(
4981
5093
  "select",
4982
5094
  {
4983
5095
  className: getClassName25("zoomSelect"),
@@ -4985,7 +5097,7 @@ var ViewportControls = ({
4985
5097
  onChange: (e) => {
4986
5098
  onZoom(parseFloat(e.currentTarget.value));
4987
5099
  },
4988
- children: zoomOptions.map((option) => /* @__PURE__ */ jsx35(
5100
+ children: zoomOptions.map((option) => /* @__PURE__ */ jsx36(
4989
5101
  "option",
4990
5102
  {
4991
5103
  value: option.value,
@@ -5000,7 +5112,7 @@ var ViewportControls = ({
5000
5112
 
5001
5113
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
5002
5114
  init_react_import();
5003
- var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_avf1c_1", "PuckCanvas-controls": "_PuckCanvas-controls_avf1c_16", "PuckCanvas-inner": "_PuckCanvas-inner_avf1c_21", "PuckCanvas-root": "_PuckCanvas-root_avf1c_32", "PuckCanvas--ready": "_PuckCanvas--ready_avf1c_57", "PuckCanvas-loader": "_PuckCanvas-loader_avf1c_62", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_avf1c_72" };
5115
+ var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_18jay_1", "PuckCanvas-controls": "_PuckCanvas-controls_18jay_16", "PuckCanvas-inner": "_PuckCanvas-inner_18jay_21", "PuckCanvas-root": "_PuckCanvas-root_18jay_30", "PuckCanvas--ready": "_PuckCanvas--ready_18jay_55", "PuckCanvas-loader": "_PuckCanvas-loader_18jay_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_18jay_70" };
5004
5116
 
5005
5117
  // lib/get-zoom-config.ts
5006
5118
  init_react_import();
@@ -5033,20 +5145,20 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
5033
5145
  };
5034
5146
 
5035
5147
  // components/Puck/components/Canvas/index.tsx
5036
- import { Fragment as Fragment17, jsx as jsx36, jsxs as jsxs20 } from "react/jsx-runtime";
5148
+ import { Fragment as Fragment17, jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
5037
5149
  var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
5038
5150
  var ZOOM_ON_CHANGE = true;
5039
5151
  var Canvas = () => {
5040
5152
  const { status, iframe } = useAppContext();
5041
5153
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
5042
5154
  const { ui } = state;
5043
- const frameRef = useRef4(null);
5155
+ const frameRef = useRef3(null);
5044
5156
  const [showTransition, setShowTransition] = useState20(false);
5045
- const defaultRender = useMemo13(() => {
5046
- const PuckDefault = ({ children }) => /* @__PURE__ */ jsx36(Fragment17, { children });
5157
+ const defaultRender = useMemo14(() => {
5158
+ const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment17, { children });
5047
5159
  return PuckDefault;
5048
5160
  }, []);
5049
- const CustomPreview = useMemo13(
5161
+ const CustomPreview = useMemo14(
5050
5162
  () => overrides.preview || defaultRender,
5051
5163
  [overrides]
5052
5164
  );
@@ -5117,7 +5229,7 @@ var Canvas = () => {
5117
5229
  recordHistory: true
5118
5230
  }),
5119
5231
  children: [
5120
- ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx36("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx36(
5232
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx37("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx37(
5121
5233
  ViewportControls,
5122
5234
  {
5123
5235
  autoZoom: zoomConfig.autoZoom,
@@ -5143,7 +5255,7 @@ var Canvas = () => {
5143
5255
  }
5144
5256
  ) }),
5145
5257
  /* @__PURE__ */ jsxs20("div", { className: getClassName26("inner"), ref: frameRef, children: [
5146
- /* @__PURE__ */ jsx36(
5258
+ /* @__PURE__ */ jsx37(
5147
5259
  "div",
5148
5260
  {
5149
5261
  className: getClassName26("root"),
@@ -5155,10 +5267,10 @@ var Canvas = () => {
5155
5267
  overflow: iframe.enabled ? void 0 : "auto"
5156
5268
  },
5157
5269
  suppressHydrationWarning: true,
5158
- children: /* @__PURE__ */ jsx36(CustomPreview, { children: /* @__PURE__ */ jsx36(Preview, {}) })
5270
+ children: /* @__PURE__ */ jsx37(CustomPreview, { children: /* @__PURE__ */ jsx37(Preview, {}) })
5159
5271
  }
5160
5272
  ),
5161
- /* @__PURE__ */ jsx36("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx36(Loader, { size: 24 }) })
5273
+ /* @__PURE__ */ jsx37("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx37(Loader, { size: 24 }) })
5162
5274
  ] })
5163
5275
  ]
5164
5276
  }
@@ -5202,7 +5314,7 @@ var insertComponent = (componentType, zone, index, {
5202
5314
 
5203
5315
  // lib/use-loaded-overrides.ts
5204
5316
  init_react_import();
5205
- import { useMemo as useMemo14 } from "react";
5317
+ import { useMemo as useMemo15 } from "react";
5206
5318
 
5207
5319
  // lib/load-overrides.ts
5208
5320
  init_react_import();
@@ -5241,18 +5353,18 @@ var useLoadedOverrides = ({
5241
5353
  overrides,
5242
5354
  plugins
5243
5355
  }) => {
5244
- return useMemo14(() => {
5356
+ return useMemo15(() => {
5245
5357
  return loadOverrides({ overrides, plugins });
5246
5358
  }, [plugins, overrides]);
5247
5359
  };
5248
5360
 
5249
5361
  // components/DefaultOverride/index.tsx
5250
5362
  init_react_import();
5251
- import { Fragment as Fragment18, jsx as jsx37 } from "react/jsx-runtime";
5252
- var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx37(Fragment18, { children });
5363
+ import { Fragment as Fragment18, jsx as jsx38 } from "react/jsx-runtime";
5364
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment18, { children });
5253
5365
 
5254
5366
  // components/Puck/index.tsx
5255
- import { Fragment as Fragment19, jsx as jsx38, jsxs as jsxs21 } from "react/jsx-runtime";
5367
+ import { Fragment as Fragment19, jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
5256
5368
  var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
5257
5369
  var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
5258
5370
  function Puck({
@@ -5275,13 +5387,13 @@ function Puck({
5275
5387
  dnd,
5276
5388
  initialHistory: _initialHistory
5277
5389
  }) {
5278
- var _a;
5390
+ var _a, _b;
5279
5391
  const iframe = __spreadValues({
5280
5392
  enabled: true,
5281
5393
  waitForStyles: true
5282
5394
  }, _iframe);
5283
5395
  const [generatedAppState] = useState21(() => {
5284
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
5396
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
5285
5397
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
5286
5398
  let clientUiState = {};
5287
5399
  if (typeof window !== "undefined") {
@@ -5301,7 +5413,7 @@ function Puck({
5301
5413
  clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
5302
5414
  viewports: __spreadProps(__spreadValues({}, initial.viewports), {
5303
5415
  current: __spreadProps(__spreadValues({}, initial.viewports.current), {
5304
- height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || ((_c = viewports[closestViewport]) == null ? void 0 : _c.height) || "auto",
5416
+ height: ((_b2 = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b2.height) || ((_c = viewports[closestViewport]) == null ? void 0 : _c.height) || "auto",
5305
5417
  width: ((_e = (_d = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _d.current) == null ? void 0 : _e.width) || ((_f = viewports[closestViewport]) == null ? void 0 : _f.width)
5306
5418
  })
5307
5419
  })
@@ -5364,7 +5476,12 @@ function Puck({
5364
5476
  flushZones(initialAppState)
5365
5477
  );
5366
5478
  const { data, ui } = appState;
5367
- const history = usePuckHistory({ dispatch, initialAppState, historyStore });
5479
+ const history = usePuckHistory({
5480
+ dispatch,
5481
+ initialAppState,
5482
+ historyStore,
5483
+ iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
5484
+ });
5368
5485
  const [menuOpen, setMenuOpen] = useState21(false);
5369
5486
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
5370
5487
  const setItemSelector = useCallback11(
@@ -5422,28 +5539,28 @@ function Puck({
5422
5539
  window.removeEventListener("resize", handleResize);
5423
5540
  };
5424
5541
  }, []);
5425
- const defaultHeaderRender = useMemo15(() => {
5542
+ const defaultHeaderRender = useMemo16(() => {
5426
5543
  if (renderHeader) {
5427
5544
  console.warn(
5428
5545
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
5429
5546
  );
5430
5547
  const RenderHeader = (_a2) => {
5431
- var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
5548
+ var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
5432
5549
  const Comp = renderHeader;
5433
- return /* @__PURE__ */ jsx38(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
5550
+ return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
5434
5551
  };
5435
5552
  return RenderHeader;
5436
5553
  }
5437
5554
  return DefaultOverride;
5438
5555
  }, [renderHeader]);
5439
- const defaultHeaderActionsRender = useMemo15(() => {
5556
+ const defaultHeaderActionsRender = useMemo16(() => {
5440
5557
  if (renderHeaderActions) {
5441
5558
  console.warn(
5442
5559
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
5443
5560
  );
5444
5561
  const RenderHeader = (props) => {
5445
5562
  const Comp = renderHeaderActions;
5446
- return /* @__PURE__ */ jsx38(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
5563
+ return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
5447
5564
  };
5448
5565
  return RenderHeader;
5449
5566
  }
@@ -5453,15 +5570,15 @@ function Puck({
5453
5570
  overrides,
5454
5571
  plugins
5455
5572
  });
5456
- const CustomPuck = useMemo15(
5573
+ const CustomPuck = useMemo16(
5457
5574
  () => loadedOverrides.puck || DefaultOverride,
5458
5575
  [loadedOverrides]
5459
5576
  );
5460
- const CustomHeader = useMemo15(
5577
+ const CustomHeader = useMemo16(
5461
5578
  () => loadedOverrides.header || defaultHeaderRender,
5462
5579
  [loadedOverrides]
5463
5580
  );
5464
- const CustomHeaderActions = useMemo15(
5581
+ const CustomHeaderActions = useMemo16(
5465
5582
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
5466
5583
  [loadedOverrides]
5467
5584
  );
@@ -5470,9 +5587,9 @@ function Puck({
5470
5587
  setMounted(true);
5471
5588
  }, []);
5472
5589
  const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
5473
- const selectedComponentLabel = selectedItem ? (_a = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _a : selectedItem.type.toString() : "";
5590
+ const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
5474
5591
  return /* @__PURE__ */ jsxs21("div", { className: `Puck ${getClassName27()}`, children: [
5475
- /* @__PURE__ */ jsx38(
5592
+ /* @__PURE__ */ jsx39(
5476
5593
  AppProvider,
5477
5594
  {
5478
5595
  value: {
@@ -5494,7 +5611,7 @@ function Puck({
5494
5611
  getPermissions: () => ({}),
5495
5612
  refreshPermissions: () => null
5496
5613
  },
5497
- children: /* @__PURE__ */ jsx38(appContext.Consumer, { children: ({ resolveData }) => /* @__PURE__ */ jsx38(
5614
+ children: /* @__PURE__ */ jsx39(appContext.Consumer, { children: ({ resolveData }) => /* @__PURE__ */ jsx39(
5498
5615
  DragDropContext,
5499
5616
  {
5500
5617
  autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
@@ -5546,7 +5663,7 @@ function Puck({
5546
5663
  });
5547
5664
  }
5548
5665
  },
5549
- children: /* @__PURE__ */ jsx38(
5666
+ children: /* @__PURE__ */ jsx39(
5550
5667
  DropZoneProvider,
5551
5668
  {
5552
5669
  value: {
@@ -5560,7 +5677,7 @@ function Puck({
5560
5677
  mode: "edit",
5561
5678
  areaId: "root"
5562
5679
  },
5563
- children: /* @__PURE__ */ jsx38(CustomPuck, { children: children || /* @__PURE__ */ jsx38(
5680
+ children: /* @__PURE__ */ jsx39(CustomPuck, { children: children || /* @__PURE__ */ jsx39(
5564
5681
  "div",
5565
5682
  {
5566
5683
  className: getLayoutClassName({
@@ -5570,57 +5687,57 @@ function Puck({
5570
5687
  rightSideBarVisible
5571
5688
  }),
5572
5689
  children: /* @__PURE__ */ jsxs21("div", { className: getLayoutClassName("inner"), children: [
5573
- /* @__PURE__ */ jsx38(
5690
+ /* @__PURE__ */ jsx39(
5574
5691
  CustomHeader,
5575
5692
  {
5576
- actions: /* @__PURE__ */ jsx38(Fragment19, { children: /* @__PURE__ */ jsx38(CustomHeaderActions, { children: /* @__PURE__ */ jsx38(
5693
+ actions: /* @__PURE__ */ jsx39(Fragment19, { children: /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
5577
5694
  Button,
5578
5695
  {
5579
5696
  onClick: () => {
5580
5697
  onPublish && onPublish(data);
5581
5698
  },
5582
- icon: /* @__PURE__ */ jsx38(Globe, { size: "14px" }),
5699
+ icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
5583
5700
  children: "Publish"
5584
5701
  }
5585
5702
  ) }) }),
5586
- children: /* @__PURE__ */ jsx38("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsxs21("div", { className: getLayoutClassName("headerInner"), children: [
5703
+ children: /* @__PURE__ */ jsx39("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsxs21("div", { className: getLayoutClassName("headerInner"), children: [
5587
5704
  /* @__PURE__ */ jsxs21(
5588
5705
  "div",
5589
5706
  {
5590
5707
  className: getLayoutClassName("headerToggle"),
5591
5708
  children: [
5592
- /* @__PURE__ */ jsx38(
5709
+ /* @__PURE__ */ jsx39(
5593
5710
  "div",
5594
5711
  {
5595
5712
  className: getLayoutClassName(
5596
5713
  "leftSideBarToggle"
5597
5714
  ),
5598
- children: /* @__PURE__ */ jsx38(
5715
+ children: /* @__PURE__ */ jsx39(
5599
5716
  IconButton,
5600
5717
  {
5601
5718
  onClick: () => {
5602
5719
  toggleSidebars("left");
5603
5720
  },
5604
5721
  title: "Toggle left sidebar",
5605
- children: /* @__PURE__ */ jsx38(PanelLeft, { focusable: "false" })
5722
+ children: /* @__PURE__ */ jsx39(PanelLeft, { focusable: "false" })
5606
5723
  }
5607
5724
  )
5608
5725
  }
5609
5726
  ),
5610
- /* @__PURE__ */ jsx38(
5727
+ /* @__PURE__ */ jsx39(
5611
5728
  "div",
5612
5729
  {
5613
5730
  className: getLayoutClassName(
5614
5731
  "rightSideBarToggle"
5615
5732
  ),
5616
- children: /* @__PURE__ */ jsx38(
5733
+ children: /* @__PURE__ */ jsx39(
5617
5734
  IconButton,
5618
5735
  {
5619
5736
  onClick: () => {
5620
5737
  toggleSidebars("right");
5621
5738
  },
5622
5739
  title: "Toggle right sidebar",
5623
- children: /* @__PURE__ */ jsx38(PanelRight, { focusable: "false" })
5740
+ children: /* @__PURE__ */ jsx39(PanelRight, { focusable: "false" })
5624
5741
  }
5625
5742
  )
5626
5743
  }
@@ -5628,7 +5745,7 @@ function Puck({
5628
5745
  ]
5629
5746
  }
5630
5747
  ),
5631
- /* @__PURE__ */ jsx38(
5748
+ /* @__PURE__ */ jsx39(
5632
5749
  "div",
5633
5750
  {
5634
5751
  className: getLayoutClassName("headerTitle"),
@@ -5636,7 +5753,7 @@ function Puck({
5636
5753
  headerTitle || rootProps.title || "Page",
5637
5754
  headerPath && /* @__PURE__ */ jsxs21(Fragment19, { children: [
5638
5755
  " ",
5639
- /* @__PURE__ */ jsx38(
5756
+ /* @__PURE__ */ jsx39(
5640
5757
  "code",
5641
5758
  {
5642
5759
  className: getLayoutClassName(
@@ -5654,36 +5771,36 @@ function Puck({
5654
5771
  {
5655
5772
  className: getLayoutClassName("headerTools"),
5656
5773
  children: [
5657
- /* @__PURE__ */ jsx38(
5774
+ /* @__PURE__ */ jsx39(
5658
5775
  "div",
5659
5776
  {
5660
5777
  className: getLayoutClassName("menuButton"),
5661
- children: /* @__PURE__ */ jsx38(
5778
+ children: /* @__PURE__ */ jsx39(
5662
5779
  IconButton,
5663
5780
  {
5664
5781
  onClick: () => {
5665
5782
  return setMenuOpen(!menuOpen);
5666
5783
  },
5667
5784
  title: "Toggle menu bar",
5668
- children: menuOpen ? /* @__PURE__ */ jsx38(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx38(ChevronDown, { focusable: "false" })
5785
+ children: menuOpen ? /* @__PURE__ */ jsx39(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx39(ChevronDown, { focusable: "false" })
5669
5786
  }
5670
5787
  )
5671
5788
  }
5672
5789
  ),
5673
- /* @__PURE__ */ jsx38(
5790
+ /* @__PURE__ */ jsx39(
5674
5791
  MenuBar,
5675
5792
  {
5676
5793
  appState,
5677
5794
  dispatch,
5678
5795
  onPublish,
5679
5796
  menuOpen,
5680
- renderHeaderActions: () => /* @__PURE__ */ jsx38(CustomHeaderActions, { children: /* @__PURE__ */ jsx38(
5797
+ renderHeaderActions: () => /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
5681
5798
  Button,
5682
5799
  {
5683
5800
  onClick: () => {
5684
5801
  onPublish && onPublish(data);
5685
5802
  },
5686
- icon: /* @__PURE__ */ jsx38(Globe, { size: "14px" }),
5803
+ icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
5687
5804
  children: "Publish"
5688
5805
  }
5689
5806
  ) }),
@@ -5697,18 +5814,18 @@ function Puck({
5697
5814
  }
5698
5815
  ),
5699
5816
  /* @__PURE__ */ jsxs21("div", { className: getLayoutClassName("leftSideBar"), children: [
5700
- /* @__PURE__ */ jsx38(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx38(Components, {}) }),
5701
- /* @__PURE__ */ jsx38(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx38(Outline, {}) })
5817
+ /* @__PURE__ */ jsx39(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx39(Components, {}) }),
5818
+ /* @__PURE__ */ jsx39(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx39(Outline, {}) })
5702
5819
  ] }),
5703
- /* @__PURE__ */ jsx38(Canvas, {}),
5704
- /* @__PURE__ */ jsx38("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ jsx38(
5820
+ /* @__PURE__ */ jsx39(Canvas, {}),
5821
+ /* @__PURE__ */ jsx39("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ jsx39(
5705
5822
  SidebarSection,
5706
5823
  {
5707
5824
  noPadding: true,
5708
5825
  noBorderTop: true,
5709
5826
  showBreadcrumbs: true,
5710
5827
  title: selectedItem ? selectedComponentLabel : "Page",
5711
- children: /* @__PURE__ */ jsx38(Fields, {})
5828
+ children: /* @__PURE__ */ jsx39(Fields, {})
5712
5829
  }
5713
5830
  ) })
5714
5831
  ] })
@@ -5720,7 +5837,7 @@ function Puck({
5720
5837
  ) })
5721
5838
  }
5722
5839
  ),
5723
- /* @__PURE__ */ jsx38("div", { id: "puck-portal-root", className: getClassName27("portal") })
5840
+ /* @__PURE__ */ jsx39("div", { id: "puck-portal-root", className: getClassName27("portal") })
5724
5841
  ] });
5725
5842
  }
5726
5843
  Puck.Components = Components;
@@ -5730,7 +5847,7 @@ Puck.Preview = Preview;
5730
5847
 
5731
5848
  // components/Render/index.tsx
5732
5849
  init_react_import();
5733
- import { jsx as jsx39 } from "react/jsx-runtime";
5850
+ import { jsx as jsx40 } from "react/jsx-runtime";
5734
5851
  function Render({
5735
5852
  config,
5736
5853
  data
@@ -5743,7 +5860,7 @@ function Render({
5743
5860
  const rootProps = defaultedData.root.props || defaultedData.root;
5744
5861
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
5745
5862
  if ((_a = config.root) == null ? void 0 : _a.render) {
5746
- return /* @__PURE__ */ jsx39(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ jsx39(
5863
+ return /* @__PURE__ */ jsx40(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ jsx40(
5747
5864
  config.root.render,
5748
5865
  __spreadProps(__spreadValues({}, rootProps), {
5749
5866
  puck: {
@@ -5753,11 +5870,11 @@ function Render({
5753
5870
  title,
5754
5871
  editMode: false,
5755
5872
  id: "puck-root",
5756
- children: /* @__PURE__ */ jsx39(DropZone, { zone: rootDroppableId })
5873
+ children: /* @__PURE__ */ jsx40(DropZone, { zone: rootDroppableId })
5757
5874
  })
5758
5875
  ) });
5759
5876
  }
5760
- return /* @__PURE__ */ jsx39(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ jsx39(DropZone, { zone: rootDroppableId }) });
5877
+ return /* @__PURE__ */ jsx40(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ jsx40(DropZone, { zone: rootDroppableId }) });
5761
5878
  }
5762
5879
 
5763
5880
  // lib/migrate.ts