@measured/puck 0.17.0-canary.552c8f9 → 0.17.0-canary.5e57623

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -13,18 +13,18 @@ var __typeError = (msg) => {
13
13
  throw TypeError(msg);
14
14
  };
15
15
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16
- var __spreadValues = (a2, b2) => {
17
- for (var prop in b2 || (b2 = {}))
18
- if (__hasOwnProp.call(b2, prop))
19
- __defNormalProp(a2, prop, b2[prop]);
16
+ var __spreadValues = (a, b) => {
17
+ for (var prop in b || (b = {}))
18
+ if (__hasOwnProp.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
20
  if (__getOwnPropSymbols)
21
- for (var prop of __getOwnPropSymbols(b2)) {
22
- if (__propIsEnum.call(b2, prop))
23
- __defNormalProp(a2, prop, b2[prop]);
21
+ for (var prop of __getOwnPropSymbols(b)) {
22
+ if (__propIsEnum.call(b, prop))
23
+ __defNormalProp(a, prop, b[prop]);
24
24
  }
25
- return a2;
25
+ return a;
26
26
  };
27
- var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
27
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
28
  var __objRest = (source, exclude) => {
29
29
  var target = {};
30
30
  for (var prop in source)
@@ -73,15 +73,15 @@ var __async = (__this, __arguments, generator) => {
73
73
  var fulfilled = (value) => {
74
74
  try {
75
75
  step(generator.next(value));
76
- } catch (e2) {
77
- reject(e2);
76
+ } catch (e) {
77
+ reject(e);
78
78
  }
79
79
  };
80
80
  var rejected = (value) => {
81
81
  try {
82
82
  step(generator.throw(value));
83
- } catch (e2) {
84
- reject(e2);
83
+ } catch (e) {
84
+ reject(e);
85
85
  }
86
86
  };
87
87
  var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
@@ -109,8 +109,8 @@ var require_classnames = __commonJS({
109
109
  var nativeCodeString = "[native code]";
110
110
  function classNames() {
111
111
  var classes = [];
112
- for (var i2 = 0; i2 < arguments.length; i2++) {
113
- var arg = arguments[i2];
112
+ for (var i = 0; i < arguments.length; i++) {
113
+ var arg = arguments[i];
114
114
  if (!arg) continue;
115
115
  var argType = typeof arg;
116
116
  if (argType === "string" || argType === "number") {
@@ -163,6 +163,7 @@ __export(core_exports, {
163
163
  FieldLabel: () => FieldLabel,
164
164
  Group: () => Group,
165
165
  IconButton: () => IconButton,
166
+ Label: () => Label,
166
167
  Puck: () => Puck,
167
168
  Render: () => Render,
168
169
  dropZoneContext: () => dropZoneContext,
@@ -239,9 +240,9 @@ var getClassNameFactory = (rootClass, styles2, config = { baseClass: "" }) => (o
239
240
  for (let modifier in modifiers) {
240
241
  prefixedModifiers[styles2[`${rootClass}--${modifier}`]] = modifiers[modifier];
241
242
  }
242
- const c2 = styles2[rootClass];
243
+ const c = styles2[rootClass];
243
244
  return config.baseClass + (0, import_classnames.default)(__spreadValues({
244
- [c2]: !!c2
245
+ [c]: !!c
245
246
  }, prefixedModifiers));
246
247
  } else {
247
248
  return config.baseClass + styles2[rootClass] || "";
@@ -251,7 +252,7 @@ var get_class_name_factory_default = getClassNameFactory;
251
252
 
252
253
  // css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css#css-module
253
254
  init_react_import();
254
- var styles_module_default = { "ActionBar": "_ActionBar_151w5_1", "ActionBar-actionsLabel": "_ActionBar-actionsLabel_151w5_16", "ActionBar-group": "_ActionBar-group_151w5_29", "ActionBar-action": "_ActionBar-action_151w5_16" };
255
+ var styles_module_default = { "ActionBar": "_ActionBar_1lbm7_1", "ActionBar-label": "_ActionBar-label_1lbm7_18", "ActionBar-action": "_ActionBar-action_1lbm7_30", "ActionBar-group": "_ActionBar-group_1lbm7_38" };
255
256
 
256
257
  // components/ActionBar/index.tsx
257
258
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -259,10 +260,19 @@ var getClassName = get_class_name_factory_default("ActionBar", styles_module_def
259
260
  var ActionBar = ({
260
261
  label,
261
262
  children
262
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: getClassName(), children: [
263
- label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("actionsLabel"), children: label }),
264
- children
265
- ] });
263
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
264
+ "div",
265
+ {
266
+ className: getClassName(),
267
+ onClick: (e) => {
268
+ e.stopPropagation();
269
+ },
270
+ children: [
271
+ label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionBar.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("label"), children: label }) }),
272
+ children
273
+ ]
274
+ }
275
+ );
266
276
  var Action = ({
267
277
  children,
268
278
  label,
@@ -278,7 +288,9 @@ var Action = ({
278
288
  }
279
289
  );
280
290
  var Group = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("group"), children });
291
+ var Label = ({ label }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("label"), children: label });
281
292
  ActionBar.Action = Action;
293
+ ActionBar.Label = Label;
282
294
  ActionBar.Group = Group;
283
295
 
284
296
  // components/AutoField/index.tsx
@@ -380,6 +392,13 @@ var Copy = createLucideIcon("Copy", [
380
392
  ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
381
393
  ]);
382
394
 
395
+ // ../../node_modules/lucide-react/dist/esm/icons/corner-left-up.js
396
+ init_react_import();
397
+ var CornerLeftUp = createLucideIcon("CornerLeftUp", [
398
+ ["polyline", { points: "14 9 9 4 4 9", key: "m9oyvo" }],
399
+ ["path", { d: "M20 20h-7a4 4 0 0 1-4-4V4", key: "1blwi3" }]
400
+ ]);
401
+
383
402
  // ../../node_modules/lucide-react/dist/esm/icons/globe.js
384
403
  init_react_import();
385
404
  var Globe = createLucideIcon("Globe", [
@@ -664,10 +683,10 @@ var IconButton = ({
664
683
  disabled,
665
684
  fullWidth
666
685
  }),
667
- onClick: (e2) => {
686
+ onClick: (e) => {
668
687
  if (!onClick) return;
669
688
  setLoading(true);
670
- Promise.resolve(onClick(e2)).then(() => {
689
+ Promise.resolve(onClick(e)).then(() => {
671
690
  setLoading(false);
672
691
  });
673
692
  },
@@ -768,7 +787,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
768
787
  const [resolvedPermissions, setResolvedPermissions] = (0, import_react4.useState)({});
769
788
  const resolveDataForItem = (0, import_react4.useCallback)(
770
789
  (item, force = false) => __async(void 0, null, function* () {
771
- var _a, _b, _c3;
790
+ var _a, _b, _c;
772
791
  const componentConfig = item.type === "root" ? config.root : config.components[item.type];
773
792
  if (!componentConfig) {
774
793
  return;
@@ -785,7 +804,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
785
804
  lastPermissions: ((_b = cache3[item.props.id]) == null ? void 0 : _b.lastPermissions) || null,
786
805
  permissions: initialPermissions,
787
806
  appState,
788
- lastData: ((_c3 = cache3[item.props.id]) == null ? void 0 : _c3.lastData) || null
807
+ lastData: ((_c = cache3[item.props.id]) == null ? void 0 : _c.lastData) || null
789
808
  }
790
809
  );
791
810
  setCache((_cache) => __spreadProps(__spreadValues({}, _cache), {
@@ -794,7 +813,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
794
813
  lastPermissions: resolvedPermissions2
795
814
  }
796
815
  }));
797
- setResolvedPermissions((p2) => __spreadProps(__spreadValues({}, p2), {
816
+ setResolvedPermissions((p) => __spreadProps(__spreadValues({}, p), {
798
817
  [item.props.id]: resolvedPermissions2
799
818
  }));
800
819
  unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
@@ -941,12 +960,12 @@ init_react_import();
941
960
  var cache2 = {};
942
961
  function resolveRootData(data, config) {
943
962
  return __async(this, null, function* () {
944
- var _a, _b, _c3, _d, _e;
963
+ var _a, _b, _c, _d, _e;
945
964
  if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
946
965
  if (((_b = cache2.lastChange) == null ? void 0 : _b.original) === data.root) {
947
966
  return cache2.lastChange.resolved;
948
967
  }
949
- const changed = getChanged(data.root, (_c3 = cache2.lastChange) == null ? void 0 : _c3.original);
968
+ const changed = getChanged(data.root, (_c = cache2.lastChange) == null ? void 0 : _c.original);
950
969
  const rootWithProps = data.root;
951
970
  const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
952
971
  changed,
@@ -1316,7 +1335,7 @@ var ArrayField = ({
1316
1335
  label,
1317
1336
  readOnly,
1318
1337
  id,
1319
- Label = (props) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", __spreadValues({}, props))
1338
+ Label: Label2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", __spreadValues({}, props))
1320
1339
  }) => {
1321
1340
  const { state, setUi, selectedItem, getPermissions } = useAppContext();
1322
1341
  const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
@@ -1381,7 +1400,7 @@ var ArrayField = ({
1381
1400
  }
1382
1401
  const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
1383
1402
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1384
- Label,
1403
+ Label2,
1385
1404
  {
1386
1405
  label: label || name,
1387
1406
  icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(List, { size: 16 }),
@@ -1426,27 +1445,27 @@ var ArrayField = ({
1426
1445
  hasItems: Array.isArray(value) && value.length > 0,
1427
1446
  addDisabled
1428
1447
  }),
1429
- onMouseOver: (e2) => {
1430
- e2.stopPropagation();
1448
+ onMouseOver: (e) => {
1449
+ e.stopPropagation();
1431
1450
  setHovering(true);
1432
1451
  },
1433
- onMouseOut: (e2) => {
1434
- e2.stopPropagation();
1452
+ onMouseOut: (e) => {
1453
+ e.stopPropagation();
1435
1454
  setHovering(false);
1436
1455
  },
1437
- onClick: (e2) => {
1438
- e2.preventDefault();
1456
+ onClick: (e) => {
1457
+ e.preventDefault();
1439
1458
  },
1440
1459
  children: [
1441
- localState.arrayState.items.map((item, i2) => {
1442
- const { _arrayId = `${id}-${i2}`, _originalIndex = i2 } = item;
1443
- const data = Array.from(localState.value || [])[i2] || {};
1460
+ localState.arrayState.items.map((item, i) => {
1461
+ const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
1462
+ const data = Array.from(localState.value || [])[i] || {};
1444
1463
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1445
1464
  Draggable,
1446
1465
  {
1447
1466
  id: _arrayId,
1448
- index: i2,
1449
- className: (_2, snapshot2) => getClassNameItem({
1467
+ index: i,
1468
+ className: (_, snapshot2) => getClassNameItem({
1450
1469
  isExpanded: arrayState.openId === _arrayId,
1451
1470
  isDragging: snapshot2 == null ? void 0 : snapshot2.isDragging,
1452
1471
  readOnly
@@ -1473,7 +1492,7 @@ var ArrayField = ({
1473
1492
  },
1474
1493
  className: getClassNameItem("summary"),
1475
1494
  children: [
1476
- field.getItemSummary ? field.getItemSummary(data, i2) : `Item #${_originalIndex}`,
1495
+ field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
1477
1496
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("rhs"), children: [
1478
1497
  !readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("actions"), children: [
1479
1498
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -1481,15 +1500,15 @@ var ArrayField = ({
1481
1500
  {
1482
1501
  type: "button",
1483
1502
  disabled: !!addDisabled,
1484
- onClick: (e2) => {
1485
- e2.stopPropagation();
1503
+ onClick: (e) => {
1504
+ e.stopPropagation();
1486
1505
  const existingValue = [
1487
1506
  ...value || []
1488
1507
  ];
1489
1508
  existingValue.splice(
1490
- i2,
1509
+ i,
1491
1510
  0,
1492
- existingValue[i2]
1511
+ existingValue[i]
1493
1512
  );
1494
1513
  onChange(
1495
1514
  existingValue,
@@ -1507,16 +1526,16 @@ var ArrayField = ({
1507
1526
  {
1508
1527
  type: "button",
1509
1528
  disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
1510
- onClick: (e2) => {
1511
- e2.stopPropagation();
1529
+ onClick: (e) => {
1530
+ e.stopPropagation();
1512
1531
  const existingValue = [
1513
1532
  ...value || []
1514
1533
  ];
1515
1534
  const existingItems = [
1516
1535
  ...arrayState.items || []
1517
1536
  ];
1518
- existingValue.splice(i2, 1);
1519
- existingItems.splice(i2, 1);
1537
+ existingValue.splice(i, 1);
1538
+ existingItems.splice(i, 1);
1520
1539
  onChange(
1521
1540
  existingValue,
1522
1541
  mapArrayStateToUi({
@@ -1537,7 +1556,7 @@ var ArrayField = ({
1537
1556
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
1538
1557
  (fieldName) => {
1539
1558
  const subField = field.arrayFields[fieldName];
1540
- const subFieldName = `${name}[${i2}].${fieldName}`;
1559
+ const subFieldName = `${name}[${i}].${fieldName}`;
1541
1560
  const wildcardFieldName = `${name}[*].${fieldName}`;
1542
1561
  const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
1543
1562
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -1551,7 +1570,7 @@ var ArrayField = ({
1551
1570
  value: data[fieldName],
1552
1571
  onChange: (val, ui) => {
1553
1572
  onChange(
1554
- replace(value, i2, __spreadProps(__spreadValues({}, data), {
1573
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
1555
1574
  [fieldName]: val
1556
1575
  })),
1557
1576
  ui
@@ -1606,11 +1625,11 @@ var DefaultField = ({
1606
1625
  value,
1607
1626
  name,
1608
1627
  label,
1609
- Label,
1628
+ Label: Label2,
1610
1629
  id
1611
1630
  }) => {
1612
1631
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1613
- Label,
1632
+ Label2,
1614
1633
  {
1615
1634
  label: label || name,
1616
1635
  icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
@@ -1626,11 +1645,11 @@ var DefaultField = ({
1626
1645
  type: field.type,
1627
1646
  name,
1628
1647
  value: typeof value === "undefined" ? "" : value.toString(),
1629
- onChange: (e2) => {
1648
+ onChange: (e) => {
1630
1649
  if (field.type === "number") {
1631
- onChange(Number(e2.currentTarget.value));
1650
+ onChange(Number(e.currentTarget.value));
1632
1651
  } else {
1633
- onChange(e2.currentTarget.value);
1652
+ onChange(e.currentTarget.value);
1634
1653
  }
1635
1654
  },
1636
1655
  readOnly,
@@ -1685,7 +1704,7 @@ var Modal = ({
1685
1704
  "div",
1686
1705
  {
1687
1706
  className: getClassName7("inner"),
1688
- onClick: (e2) => e2.stopPropagation(),
1707
+ onClick: (e) => e.stopPropagation(),
1689
1708
  children
1690
1709
  }
1691
1710
  ) }),
@@ -1757,10 +1776,10 @@ var Button = ({
1757
1776
  fullWidth,
1758
1777
  [size]: true
1759
1778
  }),
1760
- onClick: (e2) => {
1779
+ onClick: (e) => {
1761
1780
  if (!onClick) return;
1762
1781
  setLoading(true);
1763
- Promise.resolve(onClick(e2)).then(() => {
1782
+ Promise.resolve(onClick(e)).then(() => {
1764
1783
  setLoading(false);
1765
1784
  });
1766
1785
  },
@@ -1889,8 +1908,8 @@ var ExternalInput = ({
1889
1908
  hasData: mappedData.length > 0,
1890
1909
  filtersToggled
1891
1910
  }),
1892
- onSubmit: (e2) => {
1893
- e2.preventDefault();
1911
+ onSubmit: (e) => {
1912
+ e.preventDefault();
1894
1913
  search(searchQuery, filters);
1895
1914
  },
1896
1915
  children: [
@@ -1905,8 +1924,8 @@ var ExternalInput = ({
1905
1924
  name: "q",
1906
1925
  type: "search",
1907
1926
  placeholder: field.placeholder,
1908
- onChange: (e2) => {
1909
- setSearchQuery(e2.currentTarget.value);
1927
+ onChange: (e) => {
1928
+ setSearchQuery(e.currentTarget.value);
1910
1929
  },
1911
1930
  autoComplete: "off",
1912
1931
  value: searchQuery
@@ -1919,9 +1938,9 @@ var ExternalInput = ({
1919
1938
  IconButton,
1920
1939
  {
1921
1940
  title: "Toggle filters",
1922
- onClick: (e2) => {
1923
- e2.preventDefault();
1924
- e2.stopPropagation();
1941
+ onClick: (e) => {
1942
+ e.preventDefault();
1943
+ e.stopPropagation();
1925
1944
  setFiltersToggled(!filtersToggled);
1926
1945
  },
1927
1946
  children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlidersHorizontal, { size: 20 })
@@ -1960,19 +1979,19 @@ var ExternalInput = ({
1960
1979
  },
1961
1980
  key
1962
1981
  )) }) }),
1963
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i2) => {
1982
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
1964
1983
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1965
1984
  "tr",
1966
1985
  {
1967
1986
  style: { whiteSpace: "nowrap" },
1968
1987
  className: getClassNameModal("tr"),
1969
1988
  onClick: () => {
1970
- onChange(mapProp(data[i2]));
1989
+ onChange(mapProp(data[i]));
1971
1990
  setOpen(false);
1972
1991
  },
1973
1992
  children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
1974
1993
  },
1975
- i2
1994
+ i
1976
1995
  );
1977
1996
  }) })
1978
1997
  ] }),
@@ -1996,11 +2015,11 @@ var ExternalField = ({
1996
2015
  value,
1997
2016
  name,
1998
2017
  label,
1999
- Label,
2018
+ Label: Label2,
2000
2019
  id,
2001
2020
  readOnly
2002
2021
  }) => {
2003
- var _a, _b, _c3;
2022
+ var _a, _b, _c;
2004
2023
  const validField = field;
2005
2024
  const deprecatedField = field;
2006
2025
  (0, import_react11.useEffect)(() => {
@@ -2013,7 +2032,7 @@ var ExternalField = ({
2013
2032
  if (field.type !== "external") {
2014
2033
  return null;
2015
2034
  }
2016
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Label, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2035
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2017
2036
  ExternalInput,
2018
2037
  {
2019
2038
  name,
@@ -2022,7 +2041,7 @@ var ExternalField = ({
2022
2041
  placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
2023
2042
  mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
2024
2043
  mapRow: validField.mapRow,
2025
- fetchList: ((_c3 = deprecatedField.adaptor) == null ? void 0 : _c3.fetchList) ? () => __async(void 0, null, function* () {
2044
+ fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
2026
2045
  return yield deprecatedField.adaptor.fetchList(
2027
2046
  deprecatedField.adaptorParams
2028
2047
  );
@@ -2048,13 +2067,13 @@ var RadioField = ({
2048
2067
  name,
2049
2068
  id,
2050
2069
  label,
2051
- Label
2070
+ Label: Label2
2052
2071
  }) => {
2053
2072
  if (field.type !== "radio" || !field.options) {
2054
2073
  return null;
2055
2074
  }
2056
2075
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2057
- Label,
2076
+ Label2,
2058
2077
  {
2059
2078
  icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckCircle, { size: 16 }),
2060
2079
  label: label || name,
@@ -2072,12 +2091,12 @@ var RadioField = ({
2072
2091
  className: getClassName11("radioInput"),
2073
2092
  value: option.value,
2074
2093
  name,
2075
- onChange: (e2) => {
2076
- if (e2.currentTarget.value === "true" || e2.currentTarget.value === "false") {
2077
- onChange(JSON.parse(e2.currentTarget.value));
2094
+ onChange: (e) => {
2095
+ if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
2096
+ onChange(JSON.parse(e.currentTarget.value));
2078
2097
  return;
2079
2098
  }
2080
- onChange(e2.currentTarget.value);
2099
+ onChange(e.currentTarget.value);
2081
2100
  },
2082
2101
  disabled: readOnly,
2083
2102
  checked: value === option.value
@@ -2100,7 +2119,7 @@ var SelectField = ({
2100
2119
  field,
2101
2120
  onChange,
2102
2121
  label,
2103
- Label,
2122
+ Label: Label2,
2104
2123
  value,
2105
2124
  name,
2106
2125
  readOnly,
@@ -2110,7 +2129,7 @@ var SelectField = ({
2110
2129
  return null;
2111
2130
  }
2112
2131
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2113
- Label,
2132
+ Label2,
2114
2133
  {
2115
2134
  label: label || name,
2116
2135
  icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDown, { size: 16 }),
@@ -2121,12 +2140,12 @@ var SelectField = ({
2121
2140
  id,
2122
2141
  className: getClassName12("input"),
2123
2142
  disabled: readOnly,
2124
- onChange: (e2) => {
2125
- if (e2.currentTarget.value === "true" || e2.currentTarget.value === "false") {
2126
- onChange(JSON.parse(e2.currentTarget.value));
2143
+ onChange: (e) => {
2144
+ if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
2145
+ onChange(JSON.parse(e.currentTarget.value));
2127
2146
  return;
2128
2147
  }
2129
- onChange(e2.currentTarget.value);
2148
+ onChange(e.currentTarget.value);
2130
2149
  },
2131
2150
  value,
2132
2151
  children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
@@ -2153,10 +2172,10 @@ var TextareaField = ({
2153
2172
  value,
2154
2173
  name,
2155
2174
  label,
2156
- Label,
2175
+ Label: Label2,
2157
2176
  id
2158
2177
  }) => {
2159
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2178
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2160
2179
  "textarea",
2161
2180
  {
2162
2181
  id,
@@ -2164,7 +2183,7 @@ var TextareaField = ({
2164
2183
  autoComplete: "off",
2165
2184
  name,
2166
2185
  value: typeof value === "undefined" ? "" : value,
2167
- onChange: (e2) => onChange(e2.currentTarget.value),
2186
+ onChange: (e) => onChange(e.currentTarget.value),
2168
2187
  readOnly,
2169
2188
  tabIndex: readOnly ? -1 : void 0,
2170
2189
  rows: 5
@@ -2191,7 +2210,7 @@ var ObjectField = ({
2191
2210
  value,
2192
2211
  name,
2193
2212
  label,
2194
- Label,
2213
+ Label: Label2,
2195
2214
  readOnly,
2196
2215
  id
2197
2216
  }) => {
@@ -2202,7 +2221,7 @@ var ObjectField = ({
2202
2221
  const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
2203
2222
  const data = value || {};
2204
2223
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2205
- Label,
2224
+ Label2,
2206
2225
  {
2207
2226
  label: label || name,
2208
2227
  icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MoreVertical, { size: 16 }),
@@ -2306,9 +2325,9 @@ var FieldLabelInternal2 = ({
2306
2325
  );
2307
2326
  };
2308
2327
  function AutoFieldInternal(props) {
2309
- var _a, _b, _c3, _d, _e, _f, _g, _h;
2328
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2310
2329
  const { dispatch, overrides } = useAppContext();
2311
- const { id, Label = FieldLabelInternal2 } = props;
2330
+ const { id, Label: Label2 = FieldLabelInternal2 } = props;
2312
2331
  const field = props.field;
2313
2332
  const label = field.label;
2314
2333
  const defaultId = useSafeId();
@@ -2326,7 +2345,7 @@ function AutoFieldInternal(props) {
2326
2345
  const render = __spreadProps(__spreadValues({}, overrides.fieldTypes), {
2327
2346
  array: ((_a = overrides.fieldTypes) == null ? void 0 : _a.array) || defaultFields.array,
2328
2347
  external: ((_b = overrides.fieldTypes) == null ? void 0 : _b.external) || defaultFields.external,
2329
- object: ((_c3 = overrides.fieldTypes) == null ? void 0 : _c3.object) || defaultFields.object,
2348
+ object: ((_c = overrides.fieldTypes) == null ? void 0 : _c.object) || defaultFields.object,
2330
2349
  select: ((_d = overrides.fieldTypes) == null ? void 0 : _d.select) || defaultFields.select,
2331
2350
  textarea: ((_e = overrides.fieldTypes) == null ? void 0 : _e.textarea) || defaultFields.textarea,
2332
2351
  radio: ((_f = overrides.fieldTypes) == null ? void 0 : _f.radio) || defaultFields.radio,
@@ -2336,13 +2355,13 @@ function AutoFieldInternal(props) {
2336
2355
  const mergedProps = __spreadProps(__spreadValues({}, props), {
2337
2356
  field,
2338
2357
  label,
2339
- Label,
2358
+ Label: Label2,
2340
2359
  id: resolvedId
2341
2360
  });
2342
2361
  const onFocus = (0, import_react13.useCallback)(
2343
- (e2) => {
2344
- if (mergedProps.name && e2.target.nodeName === "INPUT") {
2345
- e2.stopPropagation();
2362
+ (e) => {
2363
+ if (mergedProps.name && e.target.nodeName === "INPUT") {
2364
+ e.stopPropagation();
2346
2365
  dispatch({
2347
2366
  type: "setUi",
2348
2367
  ui: {
@@ -2353,8 +2372,8 @@ function AutoFieldInternal(props) {
2353
2372
  },
2354
2373
  [mergedProps.name]
2355
2374
  );
2356
- const onBlur = (0, import_react13.useCallback)((e2) => {
2357
- if ("name" in e2.target) {
2375
+ const onBlur = (0, import_react13.useCallback)((e) => {
2376
+ if ("name" in e.target) {
2358
2377
  dispatch({
2359
2378
  type: "setUi",
2360
2379
  ui: {
@@ -2472,982 +2491,18 @@ var import_react_dom2 = require("react-dom");
2472
2491
 
2473
2492
  // components/DraggableComponent/collision/dynamic/index.ts
2474
2493
  init_react_import();
2475
-
2476
- // ../../node_modules/@dnd-kit/abstract/index.js
2477
- init_react_import();
2478
-
2479
- // ../../node_modules/@dnd-kit/state/dist/index.mjs
2480
- init_react_import();
2481
-
2482
- // ../../node_modules/@preact/signals-core/dist/signals-core.mjs
2483
- init_react_import();
2484
- var i = Symbol.for("preact-signals");
2485
- function t() {
2486
- if (r > 1) {
2487
- r--;
2488
- return;
2489
- }
2490
- let i2, t2 = false;
2491
- while (void 0 !== s) {
2492
- let o2 = s;
2493
- s = void 0;
2494
- f++;
2495
- while (void 0 !== o2) {
2496
- const n2 = o2.o;
2497
- o2.o = void 0;
2498
- o2.f &= -3;
2499
- if (!(8 & o2.f) && v(o2)) try {
2500
- o2.c();
2501
- } catch (o3) {
2502
- if (!t2) {
2503
- i2 = o3;
2504
- t2 = true;
2505
- }
2506
- }
2507
- o2 = n2;
2508
- }
2509
- }
2510
- f = 0;
2511
- r--;
2512
- if (t2) throw i2;
2513
- }
2514
- function o(i2) {
2515
- if (r > 0) return i2();
2516
- r++;
2517
- try {
2518
- return i2();
2519
- } finally {
2520
- t();
2521
- }
2522
- }
2523
- var n;
2524
- var s;
2525
- function h(i2) {
2526
- const t2 = n;
2527
- n = void 0;
2528
- try {
2529
- return i2();
2530
- } finally {
2531
- n = t2;
2532
- }
2533
- }
2534
- var r = 0;
2535
- var f = 0;
2536
- var e = 0;
2537
- function c(i2) {
2538
- if (void 0 === n) return;
2539
- let t2 = i2.n;
2540
- if (void 0 === t2 || t2.t !== n) {
2541
- t2 = { i: 0, S: i2, p: n.s, n: void 0, t: n, e: void 0, x: void 0, r: t2 };
2542
- if (void 0 !== n.s) n.s.n = t2;
2543
- n.s = t2;
2544
- i2.n = t2;
2545
- if (32 & n.f) i2.S(t2);
2546
- return t2;
2547
- } else if (-1 === t2.i) {
2548
- t2.i = 0;
2549
- if (void 0 !== t2.n) {
2550
- t2.n.p = t2.p;
2551
- if (void 0 !== t2.p) t2.p.n = t2.n;
2552
- t2.p = n.s;
2553
- t2.n = void 0;
2554
- n.s.n = t2;
2555
- n.s = t2;
2556
- }
2557
- return t2;
2558
- }
2559
- }
2560
- function u(i2) {
2561
- this.v = i2;
2562
- this.i = 0;
2563
- this.n = void 0;
2564
- this.t = void 0;
2565
- }
2566
- u.prototype.brand = i;
2567
- u.prototype.h = function() {
2568
- return true;
2569
- };
2570
- u.prototype.S = function(i2) {
2571
- if (this.t !== i2 && void 0 === i2.e) {
2572
- i2.x = this.t;
2573
- if (void 0 !== this.t) this.t.e = i2;
2574
- this.t = i2;
2575
- }
2576
- };
2577
- u.prototype.U = function(i2) {
2578
- if (void 0 !== this.t) {
2579
- const t2 = i2.e, o2 = i2.x;
2580
- if (void 0 !== t2) {
2581
- t2.x = o2;
2582
- i2.e = void 0;
2583
- }
2584
- if (void 0 !== o2) {
2585
- o2.e = t2;
2586
- i2.x = void 0;
2587
- }
2588
- if (i2 === this.t) this.t = o2;
2589
- }
2590
- };
2591
- u.prototype.subscribe = function(i2) {
2592
- return E(() => {
2593
- const t2 = this.value, o2 = n;
2594
- n = void 0;
2595
- try {
2596
- i2(t2);
2597
- } finally {
2598
- n = o2;
2599
- }
2600
- });
2601
- };
2602
- u.prototype.valueOf = function() {
2603
- return this.value;
2604
- };
2605
- u.prototype.toString = function() {
2606
- return this.value + "";
2607
- };
2608
- u.prototype.toJSON = function() {
2609
- return this.value;
2610
- };
2611
- u.prototype.peek = function() {
2612
- const i2 = n;
2613
- n = void 0;
2614
- try {
2615
- return this.value;
2616
- } finally {
2617
- n = i2;
2618
- }
2619
- };
2620
- Object.defineProperty(u.prototype, "value", { get() {
2621
- const i2 = c(this);
2622
- if (void 0 !== i2) i2.i = this.i;
2623
- return this.v;
2624
- }, set(i2) {
2625
- if (i2 !== this.v) {
2626
- if (f > 100) throw new Error("Cycle detected");
2627
- this.v = i2;
2628
- this.i++;
2629
- e++;
2630
- r++;
2631
- try {
2632
- for (let i3 = this.t; void 0 !== i3; i3 = i3.x) i3.t.N();
2633
- } finally {
2634
- t();
2635
- }
2636
- }
2637
- } });
2638
- function d(i2) {
2639
- return new u(i2);
2640
- }
2641
- function v(i2) {
2642
- for (let t2 = i2.s; void 0 !== t2; t2 = t2.n) if (t2.S.i !== t2.i || !t2.S.h() || t2.S.i !== t2.i) return true;
2643
- return false;
2644
- }
2645
- function l(i2) {
2646
- for (let t2 = i2.s; void 0 !== t2; t2 = t2.n) {
2647
- const o2 = t2.S.n;
2648
- if (void 0 !== o2) t2.r = o2;
2649
- t2.S.n = t2;
2650
- t2.i = -1;
2651
- if (void 0 === t2.n) {
2652
- i2.s = t2;
2653
- break;
2654
- }
2655
- }
2656
- }
2657
- function y(i2) {
2658
- let t2, o2 = i2.s;
2659
- while (void 0 !== o2) {
2660
- const i3 = o2.p;
2661
- if (-1 === o2.i) {
2662
- o2.S.U(o2);
2663
- if (void 0 !== i3) i3.n = o2.n;
2664
- if (void 0 !== o2.n) o2.n.p = i3;
2665
- } else t2 = o2;
2666
- o2.S.n = o2.r;
2667
- if (void 0 !== o2.r) o2.r = void 0;
2668
- o2 = i3;
2669
- }
2670
- i2.s = t2;
2671
- }
2672
- function a(i2) {
2673
- u.call(this, void 0);
2674
- this.x = i2;
2675
- this.s = void 0;
2676
- this.g = e - 1;
2677
- this.f = 4;
2678
- }
2679
- (a.prototype = new u()).h = function() {
2680
- this.f &= -3;
2681
- if (1 & this.f) return false;
2682
- if (32 == (36 & this.f)) return true;
2683
- this.f &= -5;
2684
- if (this.g === e) return true;
2685
- this.g = e;
2686
- this.f |= 1;
2687
- if (this.i > 0 && !v(this)) {
2688
- this.f &= -2;
2689
- return true;
2690
- }
2691
- const i2 = n;
2692
- try {
2693
- l(this);
2694
- n = this;
2695
- const i3 = this.x();
2696
- if (16 & this.f || this.v !== i3 || 0 === this.i) {
2697
- this.v = i3;
2698
- this.f &= -17;
2699
- this.i++;
2700
- }
2701
- } catch (i3) {
2702
- this.v = i3;
2703
- this.f |= 16;
2704
- this.i++;
2705
- }
2706
- n = i2;
2707
- y(this);
2708
- this.f &= -2;
2709
- return true;
2710
- };
2711
- a.prototype.S = function(i2) {
2712
- if (void 0 === this.t) {
2713
- this.f |= 36;
2714
- for (let i3 = this.s; void 0 !== i3; i3 = i3.n) i3.S.S(i3);
2715
- }
2716
- u.prototype.S.call(this, i2);
2717
- };
2718
- a.prototype.U = function(i2) {
2719
- if (void 0 !== this.t) {
2720
- u.prototype.U.call(this, i2);
2721
- if (void 0 === this.t) {
2722
- this.f &= -33;
2723
- for (let i3 = this.s; void 0 !== i3; i3 = i3.n) i3.S.U(i3);
2724
- }
2725
- }
2726
- };
2727
- a.prototype.N = function() {
2728
- if (!(2 & this.f)) {
2729
- this.f |= 6;
2730
- for (let i2 = this.t; void 0 !== i2; i2 = i2.x) i2.t.N();
2731
- }
2732
- };
2733
- Object.defineProperty(a.prototype, "value", { get() {
2734
- if (1 & this.f) throw new Error("Cycle detected");
2735
- const i2 = c(this);
2736
- this.h();
2737
- if (void 0 !== i2) i2.i = this.i;
2738
- if (16 & this.f) throw this.v;
2739
- return this.v;
2740
- } });
2741
- function w(i2) {
2742
- return new a(i2);
2743
- }
2744
- function _(i2) {
2745
- const o2 = i2.u;
2746
- i2.u = void 0;
2747
- if ("function" == typeof o2) {
2748
- r++;
2749
- const s2 = n;
2750
- n = void 0;
2751
- try {
2752
- o2();
2753
- } catch (t2) {
2754
- i2.f &= -2;
2755
- i2.f |= 8;
2756
- g(i2);
2757
- throw t2;
2758
- } finally {
2759
- n = s2;
2760
- t();
2761
- }
2762
- }
2763
- }
2764
- function g(i2) {
2765
- for (let t2 = i2.s; void 0 !== t2; t2 = t2.n) t2.S.U(t2);
2766
- i2.x = void 0;
2767
- i2.s = void 0;
2768
- _(i2);
2769
- }
2770
- function p(i2) {
2771
- if (n !== this) throw new Error("Out-of-order effect");
2772
- y(this);
2773
- n = i2;
2774
- this.f &= -2;
2775
- if (8 & this.f) g(this);
2776
- t();
2777
- }
2778
- function b(i2) {
2779
- this.x = i2;
2780
- this.u = void 0;
2781
- this.s = void 0;
2782
- this.o = void 0;
2783
- this.f = 32;
2784
- }
2785
- b.prototype.c = function() {
2786
- const i2 = this.S();
2787
- try {
2788
- if (8 & this.f) return;
2789
- if (void 0 === this.x) return;
2790
- const t2 = this.x();
2791
- if ("function" == typeof t2) this.u = t2;
2792
- } finally {
2793
- i2();
2794
- }
2795
- };
2796
- b.prototype.S = function() {
2797
- if (1 & this.f) throw new Error("Cycle detected");
2798
- this.f |= 1;
2799
- this.f &= -9;
2800
- _(this);
2801
- l(this);
2802
- r++;
2803
- const i2 = n;
2804
- n = this;
2805
- return p.bind(this, i2);
2806
- };
2807
- b.prototype.N = function() {
2808
- if (!(2 & this.f)) {
2809
- this.f |= 2;
2810
- this.o = s;
2811
- s = this;
2812
- }
2813
- };
2814
- b.prototype.d = function() {
2815
- this.f |= 8;
2816
- if (!(1 & this.f)) g(this);
2817
- };
2818
- function E(i2) {
2819
- const t2 = new b(i2);
2820
- try {
2821
- t2.c();
2822
- } catch (i3) {
2823
- t2.d();
2824
- throw i3;
2825
- }
2826
- return t2.d.bind(t2);
2827
- }
2828
-
2829
- // ../../node_modules/@dnd-kit/state/dist/index.mjs
2830
- function computed(compute, comparator) {
2831
- if (comparator) {
2832
- let previousValue;
2833
- return w(() => {
2834
- const value = compute();
2835
- if (value && previousValue && comparator(previousValue, value)) {
2836
- return previousValue;
2837
- }
2838
- previousValue = value;
2839
- return value;
2840
- });
2841
- }
2842
- return w(compute);
2843
- }
2844
- function reactive({ get }, _2) {
2845
- return {
2846
- init(value) {
2847
- return d(value);
2848
- },
2849
- get() {
2850
- const current = get.call(this);
2851
- return current.value;
2852
- },
2853
- set(newValue) {
2854
- const current = get.call(this);
2855
- if (current.peek() === newValue) {
2856
- return;
2857
- }
2858
- current.value = newValue;
2859
- }
2860
- };
2861
- }
2862
- function derived(target, _2) {
2863
- const map = /* @__PURE__ */ new WeakMap();
2864
- return function() {
2865
- let result = map.get(this);
2866
- if (!result) {
2867
- result = computed(target.bind(this));
2868
- map.set(this, result);
2869
- }
2870
- return result.value;
2871
- };
2872
- }
2873
- function effects(...entries) {
2874
- const effects2 = entries.map(E);
2875
- return () => effects2.forEach((cleanup) => cleanup());
2876
- }
2877
-
2878
- // ../../node_modules/@dnd-kit/geometry/dist/index.mjs
2879
- init_react_import();
2880
- var __create2 = Object.create;
2881
- var __defProp2 = Object.defineProperty;
2882
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
2883
- var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
2884
- var __typeError2 = (msg) => {
2885
- throw TypeError(msg);
2886
- };
2887
- var __pow = Math.pow;
2888
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2889
- var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
2890
- var __decoratorStart = (base) => {
2891
- var _a;
2892
- return [, , , __create2((_a = base == null ? void 0 : base[__knownSymbol("metadata")]) != null ? _a : null)];
2893
- };
2894
- var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
2895
- var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError2("Function expected") : fn;
2896
- var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError2("Already initialized") : fns.push(__expectFn(fn || null)) });
2897
- var __decoratorMetadata = (array, target) => __defNormalProp2(target, __knownSymbol("metadata"), array[3]);
2898
- var __runInitializers = (array, flags, self, value) => {
2899
- for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
2900
- return value;
2901
- };
2902
- var __decorateElement = (array, flags, name, decorators, target, extra) => {
2903
- var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
2904
- var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
2905
- var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
2906
- var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc2(k < 4 ? target : { get [name]() {
2907
- return __privateGet2(this, extra);
2908
- }, set [name](x) {
2909
- return __privateSet2(this, extra, x);
2910
- } }, name));
2911
- k ? p2 && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
2912
- for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
2913
- ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
2914
- if (k) {
2915
- ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn(target, x) : (x) => name in x };
2916
- if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet2 : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
2917
- if (k > 2) access.set = p2 ? (x, y2) => __privateSet2(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
2918
- }
2919
- it = (0, decorators[i2])(k ? k < 4 ? p2 ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
2920
- if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
2921
- else if (typeof it !== "object" || it === null) __typeError2("Object expected");
2922
- else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
2923
- }
2924
- return k || __decoratorMetadata(array, target), desc && __defProp2(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
2925
- };
2926
- var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
2927
- var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError2('Cannot use the "in" operator on this value') : member.has(obj);
2928
- var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
2929
- var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2930
- var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
2931
- var __privateMethod = (obj, member, method) => (__accessCheck2(obj, member, "access private method"), method);
2932
- var Point = class _Point {
2933
- /**
2934
- * @param {number} Coordinate of the point on the horizontal axis
2935
- * @param {number} Coordinate of the point on the vertical axis
2936
- */
2937
- constructor(x, y2) {
2938
- this.x = x;
2939
- this.y = y2;
2940
- }
2941
- /**
2942
- * Returns the delta between this point and another point.
2943
- *
2944
- * @param {Point} a - A point
2945
- * @param {Point} b - Another point
2946
- */
2947
- static delta(a2, b2) {
2948
- return new _Point(a2.x - b2.x, a2.y - b2.y);
2949
- }
2950
- /**
2951
- * Returns the distance (hypotenuse) between this point and another point.
2952
- *
2953
- * @param {Point} a - A point
2954
- * @param {Point} b - Another point
2955
- */
2956
- static distance(a2, b2) {
2957
- return Math.hypot(a2.x - b2.x, a2.y - b2.y);
2958
- }
2959
- /**
2960
- * Returns true if both points are equal.
2961
- *
2962
- * @param {Point} a - A point
2963
- * @param {Point} b - Another point
2964
- */
2965
- static equals(a2, b2) {
2966
- return a2.x === b2.x && a2.y === b2.y;
2967
- }
2968
- static from({ x, y: y2 }) {
2969
- return new _Point(x, y2);
2970
- }
2971
- };
2972
- var SENSITIVITY = 10;
2973
- var _direction_dec;
2974
- var _delta_dec;
2975
- var _current_dec;
2976
- var _previous_dec;
2977
- var _initial_dec;
2978
- var _velocity_dec;
2979
- var _timestamp;
2980
- var _init;
2981
- var _velocity;
2982
- var _initial;
2983
- var _previous;
2984
- var _current;
2985
- _velocity_dec = [reactive], _initial_dec = [reactive], _previous_dec = [reactive], _current_dec = [reactive], _delta_dec = [derived], _direction_dec = [derived];
2986
- var Position = class {
2987
- constructor(initialValue) {
2988
- __runInitializers(_init, 5, this);
2989
- __privateAdd2(this, _timestamp, 0);
2990
- __privateAdd2(this, _velocity, __runInitializers(_init, 8, this, {
2991
- x: 0,
2992
- y: 0
2993
- })), __runInitializers(_init, 11, this);
2994
- __privateAdd2(this, _initial, __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
2995
- __privateAdd2(this, _previous, __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
2996
- __privateAdd2(this, _current, __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
2997
- const point = Point.from(initialValue);
2998
- this.initial = point;
2999
- this.current = point;
3000
- this.previous = point;
3001
- }
3002
- get delta() {
3003
- return Point.delta(this.current, this.initial);
3004
- }
3005
- get direction() {
3006
- const delta = {
3007
- x: this.current.x - this.previous.x,
3008
- y: this.current.y - this.previous.y
3009
- };
3010
- if (!delta.x && !delta.y) {
3011
- return null;
3012
- }
3013
- if (Math.abs(delta.x) > Math.abs(delta.y)) {
3014
- return delta.x > 0 ? "right" : "left";
3015
- }
3016
- return delta.y > 0 ? "down" : "up";
3017
- }
3018
- reset(coordinates) {
3019
- const point = Point.from(coordinates);
3020
- o(() => {
3021
- __privateSet2(this, _timestamp, 0);
3022
- this.velocity = { x: 0, y: 0 };
3023
- this.current = point;
3024
- this.previous = point;
3025
- this.initial = point;
3026
- });
3027
- }
3028
- update(coordinates) {
3029
- const { current } = this;
3030
- const point = Point.from(coordinates);
3031
- if (Point.equals(current, point)) {
3032
- return;
3033
- }
3034
- const delta = {
3035
- x: point.x - current.x,
3036
- y: point.y - current.y
3037
- };
3038
- const timestamp = Date.now();
3039
- const timeDelta = timestamp - __privateGet2(this, _timestamp);
3040
- const velocity = (delta2) => Math.round(delta2 / timeDelta * 100);
3041
- if (Math.abs(delta.x) < SENSITIVITY || Math.abs(delta.y) < SENSITIVITY) {
3042
- this.previous = current;
3043
- }
3044
- __privateSet2(this, _timestamp, timestamp);
3045
- this.velocity = {
3046
- x: velocity(delta.x),
3047
- y: velocity(delta.y)
3048
- };
3049
- this.current = point;
3050
- }
3051
- };
3052
- _init = __decoratorStart(null);
3053
- _timestamp = /* @__PURE__ */ new WeakMap();
3054
- _velocity = /* @__PURE__ */ new WeakMap();
3055
- _initial = /* @__PURE__ */ new WeakMap();
3056
- _previous = /* @__PURE__ */ new WeakMap();
3057
- _current = /* @__PURE__ */ new WeakMap();
3058
- __decorateElement(_init, 4, "velocity", _velocity_dec, Position, _velocity);
3059
- __decorateElement(_init, 4, "initial", _initial_dec, Position, _initial);
3060
- __decorateElement(_init, 4, "previous", _previous_dec, Position, _previous);
3061
- __decorateElement(_init, 4, "current", _current_dec, Position, _current);
3062
- __decorateElement(_init, 2, "delta", _delta_dec, Position);
3063
- __decorateElement(_init, 2, "direction", _direction_dec, Position);
3064
- __decoratorMetadata(_init, Position);
3065
- function exceedsDistance({ x, y: y2 }, distance) {
3066
- const dx = Math.abs(x);
3067
- const dy = Math.abs(y2);
3068
- if (typeof distance === "number") {
3069
- return Math.sqrt(__pow(dx, 2) + __pow(dy, 2)) > distance;
3070
- }
3071
- if ("x" in distance && "y" in distance) {
3072
- return dx > distance.x && dy > distance.y;
3073
- }
3074
- if ("x" in distance) {
3075
- return dx > distance.x;
3076
- }
3077
- if ("y" in distance) {
3078
- return dy > distance.y;
3079
- }
3080
- return false;
3081
- }
3082
- var Axis = /* @__PURE__ */ ((Axis2) => {
3083
- Axis2["Horizontal"] = "x";
3084
- Axis2["Vertical"] = "y";
3085
- return Axis2;
3086
- })(Axis || {});
3087
- var Axes = Object.values(Axis);
3088
-
3089
- // ../../node_modules/@dnd-kit/abstract/index.js
3090
- var __create3 = Object.create;
3091
- var __defProp3 = Object.defineProperty;
3092
- var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
3093
- var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
3094
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
3095
- var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
3096
- var __knownSymbol2 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
3097
- var __typeError3 = (msg) => {
3098
- throw TypeError(msg);
3099
- };
3100
- var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3101
- var __name2 = (target, value) => __defProp3(target, "name", { value, configurable: true });
3102
- var __objRest2 = (source, exclude) => {
3103
- var target = {};
3104
- for (var prop in source)
3105
- if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
3106
- target[prop] = source[prop];
3107
- if (source != null && __getOwnPropSymbols2)
3108
- for (var prop of __getOwnPropSymbols2(source)) {
3109
- if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
3110
- target[prop] = source[prop];
3111
- }
3112
- return target;
3113
- };
3114
- var __decoratorStart2 = (base) => {
3115
- var _a;
3116
- return [, , , __create3((_a = base == null ? void 0 : base[__knownSymbol2("metadata")]) != null ? _a : null)];
3117
- };
3118
- var __decoratorStrings2 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
3119
- var __expectFn2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError3("Function expected") : fn;
3120
- var __decoratorContext2 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings2[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError3("Already initialized") : fns.push(__expectFn2(fn || null)) });
3121
- var __decoratorMetadata2 = (array, target) => __defNormalProp3(target, __knownSymbol2("metadata"), array[3]);
3122
- var __runInitializers2 = (array, flags, self, value) => {
3123
- for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
3124
- return value;
3125
- };
3126
- var __decorateElement2 = (array, flags, name, decorators, target, extra) => {
3127
- var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
3128
- var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings2[k + 5];
3129
- var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
3130
- var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc3(k < 4 ? target : { get [name]() {
3131
- return __privateGet3(this, extra);
3132
- }, set [name](x) {
3133
- return __privateSet3(this, extra, x);
3134
- } }, name));
3135
- k ? p2 && k < 4 && __name2(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name2(target, name);
3136
- for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
3137
- ctx = __decoratorContext2(k, name, done = {}, array[3], extraInitializers);
3138
- if (k) {
3139
- ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn2(target, x) : (x) => name in x };
3140
- if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet3 : __privateMethod2)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
3141
- if (k > 2) access.set = p2 ? (x, y2) => __privateSet3(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
3142
- }
3143
- it = (0, decorators[i2])(k ? k < 4 ? p2 ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
3144
- if (k ^ 4 || it === void 0) __expectFn2(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
3145
- else if (typeof it !== "object" || it === null) __typeError3("Object expected");
3146
- else __expectFn2(fn = it.get) && (desc.get = fn), __expectFn2(fn = it.set) && (desc.set = fn), __expectFn2(fn = it.init) && initializers.unshift(fn);
3147
- }
3148
- return k || __decoratorMetadata2(array, target), desc && __defProp3(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
3149
- };
3150
- var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
3151
- var __privateIn2 = (member, obj) => Object(obj) !== obj ? __typeError3('Cannot use the "in" operator on this value') : member.has(obj);
3152
- var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
3153
- var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3154
- var __privateSet3 = (obj, member, value, setter) => (__accessCheck3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
3155
- var __privateMethod2 = (obj, member, method) => (__accessCheck3(obj, member, "access private method"), method);
3156
- function configure(plugin, options) {
3157
- return {
3158
- plugin,
3159
- options
3160
- };
3161
- }
3162
- function configurator(plugin) {
3163
- return (options) => {
3164
- return configure(plugin, options);
3165
- };
3166
- }
3167
- var _disabled_dec;
3168
- var _init2;
3169
- var _disabled;
3170
- _disabled_dec = [reactive];
3171
- var Plugin = class {
3172
- constructor(manager, options) {
3173
- this.manager = manager;
3174
- this.options = options;
3175
- __privateAdd3(this, _disabled, __runInitializers2(_init2, 8, this, false)), __runInitializers2(_init2, 11, this);
3176
- }
3177
- /**
3178
- * Enable a disabled plugin instance.
3179
- * Triggers effects.
3180
- */
3181
- enable() {
3182
- this.disabled = false;
3183
- }
3184
- /**
3185
- * Disable an enabled plugin instance.
3186
- * Triggers effects.
3187
- */
3188
- disable() {
3189
- this.disabled = true;
3190
- }
3191
- /**
3192
- * Whether the plugin instance is disabled.
3193
- * Does not trigger effects when accessed.
3194
- */
3195
- isDisabled() {
3196
- return h(() => {
3197
- return this.disabled;
3198
- });
3199
- }
3200
- /**
3201
- * Configure a plugin instance with new options.
3202
- */
3203
- configure(options) {
3204
- this.options = options;
3205
- }
3206
- /**
3207
- * Destroy a plugin instance.
3208
- */
3209
- destroy() {
3210
- }
3211
- /**
3212
- * Configure a plugin constructor with options.
3213
- * This method is used to configure the options that the
3214
- * plugin constructor will use to create plugin instances.
3215
- */
3216
- static configure(options) {
3217
- return configure(this, options);
3218
- }
3219
- };
3220
- _init2 = __decoratorStart2(null);
3221
- _disabled = /* @__PURE__ */ new WeakMap();
3222
- __decorateElement2(_init2, 4, "disabled", _disabled_dec, Plugin, _disabled);
3223
- __decoratorMetadata2(_init2, Plugin);
3224
- var _previousValues;
3225
- _previousValues = /* @__PURE__ */ new WeakMap();
3226
- var _previousCoordinates;
3227
- var _collisions;
3228
- _previousCoordinates = /* @__PURE__ */ new WeakMap();
3229
- _collisions = /* @__PURE__ */ new WeakMap();
3230
- var CollisionPriority = /* @__PURE__ */ ((CollisionPriority2) => {
3231
- CollisionPriority2[CollisionPriority2["Lowest"] = 0] = "Lowest";
3232
- CollisionPriority2[CollisionPriority2["Low"] = 1] = "Low";
3233
- CollisionPriority2[CollisionPriority2["Normal"] = 2] = "Normal";
3234
- CollisionPriority2[CollisionPriority2["High"] = 3] = "High";
3235
- CollisionPriority2[CollisionPriority2["Highest"] = 4] = "Highest";
3236
- return CollisionPriority2;
3237
- })(CollisionPriority || {});
3238
- var CollisionType = /* @__PURE__ */ ((CollisionType2) => {
3239
- CollisionType2[CollisionType2["Collision"] = 0] = "Collision";
3240
- CollisionType2[CollisionType2["ShapeIntersection"] = 1] = "ShapeIntersection";
3241
- CollisionType2[CollisionType2["PointerIntersection"] = 2] = "PointerIntersection";
3242
- return CollisionType2;
3243
- })(CollisionType || {});
3244
- var _disabled_dec2;
3245
- var _data_dec;
3246
- var _id_dec;
3247
- var _manager_dec;
3248
- var _init22;
3249
- var _manager;
3250
- var _id;
3251
- var _data;
3252
- var _disabled2;
3253
- _manager_dec = [reactive], _id_dec = [reactive], _data_dec = [reactive], _disabled_dec2 = [reactive];
3254
- var Entity = class {
3255
- /**
3256
- * Creates a new instance of the `Entity` class.
3257
- *
3258
- * @param input - An object containing the initial properties of the entity.
3259
- * @param manager - The manager that controls the drag and drop operations.
3260
- */
3261
- constructor(input, manager) {
3262
- __privateAdd3(this, _manager, __runInitializers2(_init22, 8, this)), __runInitializers2(_init22, 11, this);
3263
- __privateAdd3(this, _id, __runInitializers2(_init22, 12, this)), __runInitializers2(_init22, 15, this);
3264
- __privateAdd3(this, _data, __runInitializers2(_init22, 16, this)), __runInitializers2(_init22, 19, this);
3265
- __privateAdd3(this, _disabled2, __runInitializers2(_init22, 20, this)), __runInitializers2(_init22, 23, this);
3266
- this.effects = void 0;
3267
- const { effects: effects5, id, data = {}, disabled = false } = input;
3268
- let previousId = id;
3269
- this.manager = manager;
3270
- this.id = id;
3271
- this.data = data;
3272
- this.disabled = disabled;
3273
- this.effects = () => {
3274
- var _a;
3275
- return [
3276
- () => {
3277
- const { id: id2, manager: manager2 } = this;
3278
- if (id2 === previousId) {
3279
- return;
3280
- }
3281
- manager2 == null ? void 0 : manager2.registry.register(this);
3282
- return () => manager2 == null ? void 0 : manager2.registry.unregister(this);
3283
- },
3284
- ...(_a = effects5 == null ? void 0 : effects5()) != null ? _a : []
3285
- ];
3286
- };
3287
- this.destroy = this.destroy.bind(this);
3288
- if (manager) {
3289
- queueMicrotask(() => {
3290
- var _a;
3291
- (_a = this.manager) == null ? void 0 : _a.registry.register(this);
3292
- });
3293
- }
3294
- }
3295
- /**
3296
- * A method that registers the entity with the manager.
3297
- * @returns CleanupFunction | void
3298
- */
3299
- register() {
3300
- var _a;
3301
- return (_a = this.manager) == null ? void 0 : _a.registry.register(this);
3302
- }
3303
- /**
3304
- * A method that unregisters the entity from the manager.
3305
- * @returns void
3306
- */
3307
- unregister() {
3308
- var _a;
3309
- (_a = this.manager) == null ? void 0 : _a.registry.unregister(this);
3310
- }
3311
- /**
3312
- * A method that cleans up the entity when it is no longer needed.
3313
- * @returns void
3314
- */
3315
- destroy() {
3316
- var _a;
3317
- (_a = this.manager) == null ? void 0 : _a.registry.unregister(this);
3318
- }
3319
- };
3320
- _init22 = __decoratorStart2(null);
3321
- _manager = /* @__PURE__ */ new WeakMap();
3322
- _id = /* @__PURE__ */ new WeakMap();
3323
- _data = /* @__PURE__ */ new WeakMap();
3324
- _disabled2 = /* @__PURE__ */ new WeakMap();
3325
- __decorateElement2(_init22, 4, "manager", _manager_dec, Entity, _manager);
3326
- __decorateElement2(_init22, 4, "id", _id_dec, Entity, _id);
3327
- __decorateElement2(_init22, 4, "data", _data_dec, Entity, _data);
3328
- __decorateElement2(_init22, 4, "disabled", _disabled_dec2, Entity, _disabled2);
3329
- __decoratorMetadata2(_init22, Entity);
3330
- var _isDragSource_dec;
3331
- var _status_dec;
3332
- var _type_dec;
3333
- var _modifiers_dec;
3334
- var _c;
3335
- var _init3;
3336
- var _modifiers;
3337
- var _type;
3338
- var _status;
3339
- var Draggable2 = class extends (_c = Entity, _modifiers_dec = [reactive], _type_dec = [reactive], _status_dec = [reactive], _isDragSource_dec = [derived], _c) {
3340
- constructor(_a, manager) {
3341
- var _b = _a, { modifiers, type, sensors } = _b, input = __objRest2(_b, ["modifiers", "type", "sensors"]);
3342
- super(input, manager);
3343
- __runInitializers2(_init3, 5, this);
3344
- this.sensors = void 0;
3345
- __privateAdd3(this, _modifiers, __runInitializers2(_init3, 8, this)), __runInitializers2(_init3, 11, this);
3346
- __privateAdd3(this, _type, __runInitializers2(_init3, 12, this)), __runInitializers2(_init3, 15, this);
3347
- __privateAdd3(this, _status, __runInitializers2(_init3, 16, this, "idle")), __runInitializers2(_init3, 19, this);
3348
- this.type = type;
3349
- this.sensors = sensors;
3350
- this.modifiers = modifiers;
3351
- }
3352
- get isDragSource() {
3353
- var _a, _b;
3354
- return ((_b = (_a = this.manager) == null ? void 0 : _a.dragOperation.source) == null ? void 0 : _b.id) === this.id;
3355
- }
3356
- };
3357
- _init3 = __decoratorStart2(_c);
3358
- _modifiers = /* @__PURE__ */ new WeakMap();
3359
- _type = /* @__PURE__ */ new WeakMap();
3360
- _status = /* @__PURE__ */ new WeakMap();
3361
- __decorateElement2(_init3, 4, "modifiers", _modifiers_dec, Draggable2, _modifiers);
3362
- __decorateElement2(_init3, 4, "type", _type_dec, Draggable2, _type);
3363
- __decorateElement2(_init3, 4, "status", _status_dec, Draggable2, _status);
3364
- __decorateElement2(_init3, 2, "isDragSource", _isDragSource_dec, Draggable2);
3365
- __decoratorMetadata2(_init3, Draggable2);
3366
- var _isDropTarget_dec;
3367
- var _shape_dec;
3368
- var _collisionPriority_dec;
3369
- var _collisionDetector_dec;
3370
- var _type_dec2;
3371
- var _accept_dec;
3372
- var _c2;
3373
- var _init4;
3374
- var _accept;
3375
- var _type2;
3376
- var _collisionDetector;
3377
- var _collisionPriority;
3378
- var _shape;
3379
- var Droppable2 = class extends (_c2 = Entity, _accept_dec = [reactive], _type_dec2 = [reactive], _collisionDetector_dec = [reactive], _collisionPriority_dec = [reactive], _shape_dec = [reactive], _isDropTarget_dec = [derived], _c2) {
3380
- constructor(_a, manager) {
3381
- var _b = _a, { accept, collisionDetector, collisionPriority, type } = _b, input = __objRest2(_b, ["accept", "collisionDetector", "collisionPriority", "type"]);
3382
- super(input, manager);
3383
- __runInitializers2(_init4, 5, this);
3384
- __privateAdd3(this, _accept, __runInitializers2(_init4, 8, this)), __runInitializers2(_init4, 11, this);
3385
- __privateAdd3(this, _type2, __runInitializers2(_init4, 12, this)), __runInitializers2(_init4, 15, this);
3386
- __privateAdd3(this, _collisionDetector, __runInitializers2(_init4, 16, this)), __runInitializers2(_init4, 19, this);
3387
- __privateAdd3(this, _collisionPriority, __runInitializers2(_init4, 20, this)), __runInitializers2(_init4, 23, this);
3388
- __privateAdd3(this, _shape, __runInitializers2(_init4, 24, this)), __runInitializers2(_init4, 27, this);
3389
- this.accept = accept;
3390
- this.collisionDetector = collisionDetector;
3391
- this.collisionPriority = collisionPriority;
3392
- this.type = type;
3393
- }
3394
- /**
3395
- * Checks whether or not the droppable accepts a given draggable.
3396
- *
3397
- * @param {Draggable} draggable
3398
- * @returns {boolean}
3399
- */
3400
- accepts(draggable) {
3401
- const { accept } = this;
3402
- if (!accept) {
3403
- return true;
3404
- }
3405
- if (typeof accept === "function") {
3406
- return accept(draggable);
3407
- }
3408
- if (!draggable.type) {
3409
- return false;
3410
- }
3411
- if (Array.isArray(accept)) {
3412
- return accept.includes(draggable.type);
3413
- }
3414
- return draggable.type === accept;
3415
- }
3416
- get isDropTarget() {
3417
- var _a, _b;
3418
- return ((_b = (_a = this.manager) == null ? void 0 : _a.dragOperation.target) == null ? void 0 : _b.id) === this.id;
3419
- }
3420
- };
3421
- _init4 = __decoratorStart2(_c2);
3422
- _accept = /* @__PURE__ */ new WeakMap();
3423
- _type2 = /* @__PURE__ */ new WeakMap();
3424
- _collisionDetector = /* @__PURE__ */ new WeakMap();
3425
- _collisionPriority = /* @__PURE__ */ new WeakMap();
3426
- _shape = /* @__PURE__ */ new WeakMap();
3427
- __decorateElement2(_init4, 4, "accept", _accept_dec, Droppable2, _accept);
3428
- __decorateElement2(_init4, 4, "type", _type_dec2, Droppable2, _type2);
3429
- __decorateElement2(_init4, 4, "collisionDetector", _collisionDetector_dec, Droppable2, _collisionDetector);
3430
- __decorateElement2(_init4, 4, "collisionPriority", _collisionPriority_dec, Droppable2, _collisionPriority);
3431
- __decorateElement2(_init4, 4, "shape", _shape_dec, Droppable2, _shape);
3432
- __decorateElement2(_init4, 2, "isDropTarget", _isDropTarget_dec, Droppable2);
3433
- __decoratorMetadata2(_init4, Droppable2);
3434
- var Sensor = class extends Plugin {
3435
- constructor(manager, options) {
3436
- super(manager, options);
3437
- this.manager = manager;
3438
- this.options = options;
3439
- }
3440
- };
2494
+ var import_abstract8 = require("@dnd-kit/abstract");
3441
2495
 
3442
2496
  // components/DraggableComponent/collision/directional/index.ts
3443
2497
  init_react_import();
2498
+ var import_abstract = require("@dnd-kit/abstract");
3444
2499
 
3445
2500
  // components/DraggableComponent/collision/collision-debug.ts
3446
2501
  init_react_import();
3447
2502
  var DEBUG = false;
3448
2503
  var debugElements = {};
3449
2504
  var timeout;
3450
- var collisionDebug = (a2, b2, id, color, label) => {
2505
+ var collisionDebug = (a, b, id, color, label) => {
3451
2506
  if (!DEBUG) return;
3452
2507
  const debugId = `${id}-debug`;
3453
2508
  clearTimeout(timeout);
@@ -3478,13 +2533,13 @@ var collisionDebug = (a2, b2, id, color, label) => {
3478
2533
  document.body.appendChild(svg);
3479
2534
  debugElements[debugId] = { svg, line, text };
3480
2535
  }
3481
- line.setAttribute("x1", a2.x.toString());
3482
- line.setAttribute("x2", b2.x.toString());
3483
- line.setAttribute("y1", a2.y.toString());
3484
- line.setAttribute("y2", b2.y.toString());
2536
+ line.setAttribute("x1", a.x.toString());
2537
+ line.setAttribute("x2", b.x.toString());
2538
+ line.setAttribute("y1", a.y.toString());
2539
+ line.setAttribute("y2", b.y.toString());
3485
2540
  line.setAttribute("style", `stroke:${color};stroke-width:2`);
3486
- text.setAttribute("x", (a2.x - (a2.x - b2.x) / 2).toString());
3487
- text.setAttribute("y", (a2.y - (a2.y - b2.y) / 2).toString());
2541
+ text.setAttribute("x", (a.x - (a.x - b.x) / 2).toString());
2542
+ text.setAttribute("y", (a.y - (a.y - b.y) / 2).toString());
3488
2543
  if (label) {
3489
2544
  text.innerHTML = label;
3490
2545
  }
@@ -3518,7 +2573,7 @@ var directionalCollision = (input, previous) => {
3518
2573
  return {
3519
2574
  id: droppable.id,
3520
2575
  value: 1,
3521
- type: CollisionType.Collision
2576
+ type: import_abstract.CollisionType.Collision
3522
2577
  };
3523
2578
  }
3524
2579
  return null;
@@ -3560,6 +2615,7 @@ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0)
3560
2615
 
3561
2616
  // components/DraggableComponent/collision/dynamic/track-movement-interval.ts
3562
2617
  init_react_import();
2618
+ var import_geometry = require("@dnd-kit/geometry");
3563
2619
  var INTERVAL_SENSITIVITY = 10;
3564
2620
  var intervalCache = {
3565
2621
  current: { x: 0, y: 0 },
@@ -3575,13 +2631,25 @@ var trackMovementInterval = (point, dragAxis = "dynamic") => {
3575
2631
  };
3576
2632
  intervalCache.direction = getDirection(dragAxis, intervalCache.delta) || intervalCache.direction;
3577
2633
  if (Math.abs(intervalCache.delta.x) > INTERVAL_SENSITIVITY || Math.abs(intervalCache.delta.y) > INTERVAL_SENSITIVITY) {
3578
- intervalCache.previous = Point.from(point);
2634
+ intervalCache.previous = import_geometry.Point.from(point);
3579
2635
  }
3580
2636
  return intervalCache;
3581
2637
  };
3582
2638
 
3583
2639
  // ../../node_modules/@dnd-kit/collision/dist/index.js
3584
2640
  init_react_import();
2641
+ var import_abstract2 = require("@dnd-kit/abstract");
2642
+ var import_geometry2 = require("@dnd-kit/geometry");
2643
+ var import_abstract3 = require("@dnd-kit/abstract");
2644
+ var import_geometry3 = require("@dnd-kit/geometry");
2645
+ var import_abstract4 = require("@dnd-kit/abstract");
2646
+ var import_geometry4 = require("@dnd-kit/geometry");
2647
+ var import_abstract5 = require("@dnd-kit/abstract");
2648
+ var import_geometry5 = require("@dnd-kit/geometry");
2649
+ var import_abstract6 = require("@dnd-kit/abstract");
2650
+ var import_geometry6 = require("@dnd-kit/geometry");
2651
+ var import_abstract7 = require("@dnd-kit/abstract");
2652
+ var import_geometry7 = require("@dnd-kit/geometry");
3585
2653
  var pointerIntersection = ({
3586
2654
  dragOperation,
3587
2655
  droppable
@@ -3595,12 +2663,12 @@ var pointerIntersection = ({
3595
2663
  return null;
3596
2664
  }
3597
2665
  if (droppable.shape.containsPoint(pointerCoordinates)) {
3598
- const distance = Point.distance(droppable.shape.center, pointerCoordinates);
2666
+ const distance = import_geometry2.Point.distance(droppable.shape.center, pointerCoordinates);
3599
2667
  return {
3600
2668
  id,
3601
2669
  value: 1 / distance,
3602
- type: CollisionType.PointerIntersection,
3603
- priority: CollisionPriority.High
2670
+ type: import_abstract2.CollisionType.PointerIntersection,
2671
+ priority: import_abstract2.CollisionPriority.High
3604
2672
  };
3605
2673
  }
3606
2674
  return null;
@@ -3633,8 +2701,8 @@ var closestCorners = (input) => {
3633
2701
  const distance = corners.reduce(
3634
2702
  (acc, corner) => {
3635
2703
  var _a;
3636
- return acc + Point.distance(
3637
- Point.from(corner),
2704
+ return acc + import_geometry4.Point.distance(
2705
+ import_geometry4.Point.from(corner),
3638
2706
  (_a = shape == null ? void 0 : shape.current.center) != null ? _a : position.current
3639
2707
  );
3640
2708
  },
@@ -3644,15 +2712,15 @@ var closestCorners = (input) => {
3644
2712
  return {
3645
2713
  id: droppable.id,
3646
2714
  value: 1 / value,
3647
- type: CollisionType.Collision,
3648
- priority: CollisionPriority.Normal
2715
+ type: import_abstract4.CollisionType.Collision,
2716
+ priority: import_abstract4.CollisionPriority.Normal
3649
2717
  };
3650
2718
  };
3651
2719
 
3652
2720
  // components/DraggableComponent/collision/dynamic/index.ts
3653
2721
  var flushNext = "";
3654
2722
  var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
3655
- var _a, _b, _c3, _d, _e;
2723
+ var _a, _b, _c, _d, _e;
3656
2724
  const { dragOperation, droppable } = input;
3657
2725
  const { position } = dragOperation;
3658
2726
  const dragShape = (_a = dragOperation.shape) == null ? void 0 : _a.current;
@@ -3682,7 +2750,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
3682
2750
  collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow");
3683
2751
  if (collision) {
3684
2752
  return __spreadProps(__spreadValues({}, collision), {
3685
- priority: CollisionPriority.Highest
2753
+ priority: import_abstract8.CollisionPriority.Highest
3686
2754
  });
3687
2755
  }
3688
2756
  }
@@ -3699,14 +2767,14 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
3699
2767
  const collision = {
3700
2768
  id: droppable.id,
3701
2769
  value: intersectionRatio,
3702
- priority: CollisionPriority.High,
3703
- type: CollisionType.Collision
2770
+ priority: import_abstract8.CollisionPriority.High,
2771
+ type: import_abstract8.CollisionType.Collision
3704
2772
  };
3705
2773
  const shouldFlushId = flushNext === droppable.id;
3706
2774
  flushNext = "";
3707
2775
  return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
3708
2776
  }
3709
- if (((_c3 = dragOperation.source) == null ? void 0 : _c3.id) !== droppable.id) {
2777
+ if (((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
3710
2778
  const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
3711
2779
  const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
3712
2780
  if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
@@ -3729,7 +2797,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
3729
2797
  );
3730
2798
  flushNext = droppable.id;
3731
2799
  return __spreadProps(__spreadValues({}, fallbackCollision), {
3732
- priority: CollisionPriority.Low
2800
+ priority: import_abstract8.CollisionPriority.Low
3733
2801
  });
3734
2802
  }
3735
2803
  collisionDebug(
@@ -3739,7 +2807,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
3739
2807
  "orange",
3740
2808
  direction || ""
3741
2809
  );
3742
- return __spreadProps(__spreadValues({}, fallbackCollision), { priority: CollisionPriority.Lowest });
2810
+ return __spreadProps(__spreadValues({}, fallbackCollision), { priority: import_abstract8.CollisionPriority.Lowest });
3743
2811
  }
3744
2812
  }
3745
2813
  }
@@ -3774,6 +2842,25 @@ function useSortableSafe(input) {
3774
2842
  return (0, import_sortable.useSortable)(input);
3775
2843
  }
3776
2844
 
2845
+ // lib/get-deep-scroll-position.ts
2846
+ init_react_import();
2847
+ function getDeepScrollPosition(element) {
2848
+ let totalScroll = {
2849
+ x: 0,
2850
+ y: 0
2851
+ };
2852
+ let current = element;
2853
+ while (current && current !== document.documentElement) {
2854
+ const parent = current.parentElement;
2855
+ if (parent) {
2856
+ totalScroll.x += parent.scrollLeft;
2857
+ totalScroll.y += parent.scrollTop;
2858
+ }
2859
+ current = parent;
2860
+ }
2861
+ return totalScroll;
2862
+ }
2863
+
3777
2864
  // components/DraggableComponent/index.tsx
3778
2865
  var import_jsx_runtime21 = require("react/jsx-runtime");
3779
2866
  var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
@@ -3784,8 +2871,23 @@ var actionsTop = -(actionsOverlayTop - 8);
3784
2871
  var actionsSide = space;
3785
2872
  var DefaultActionBar = ({
3786
2873
  label,
3787
- children
3788
- }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar, { label, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Group, { children }) });
2874
+ children,
2875
+ parentAction
2876
+ }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ActionBar, { children: [
2877
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ActionBar.Group, { children: [
2878
+ parentAction,
2879
+ label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Label, { label })
2880
+ ] }),
2881
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Group, { children })
2882
+ ] });
2883
+ var convertIdToSelector = (id, zoneCompound, data) => {
2884
+ const content = zoneCompound && data.zones && zoneCompound !== "default-zone" ? data.zones[zoneCompound] : data.content;
2885
+ const index = content.findIndex((item) => item.props.id === id);
2886
+ return {
2887
+ zone: zoneCompound || "",
2888
+ index
2889
+ };
2890
+ };
3789
2891
  var DraggableComponent = ({
3790
2892
  children,
3791
2893
  depth,
@@ -3847,6 +2949,7 @@ var DraggableComponent = ({
3847
2949
  group: zoneCompound,
3848
2950
  type: "component",
3849
2951
  data: {
2952
+ areaId: ctx == null ? void 0 : ctx.areaId,
3850
2953
  zone: zoneCompound,
3851
2954
  index,
3852
2955
  componentType,
@@ -3877,22 +2980,22 @@ var DraggableComponent = ({
3877
2980
  );
3878
2981
  const [portalEl, setPortalEl] = (0, import_react16.useState)();
3879
2982
  (0, import_react16.useEffect)(() => {
3880
- var _a, _b;
2983
+ var _a, _b, _c;
3881
2984
  setPortalEl(
3882
- (_b = iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : document.getElementById("puck-preview")) != null ? _b : document.body
2985
+ iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
3883
2986
  );
3884
- }, [iframe.enabled]);
2987
+ }, [iframe.enabled, ref.current]);
3885
2988
  const getStyle = (0, import_react16.useCallback)(() => {
3886
- var _a, _b;
2989
+ var _a, _b, _c;
3887
2990
  if (!ref.current) return;
3888
2991
  const rect = ref.current.getBoundingClientRect();
3889
- const doc = ref.current.ownerDocument;
3890
- const view = doc.defaultView;
3891
- const portalContainerEl = iframe.enabled ? null : document.getElementById("puck-preview");
2992
+ const deepScrollPosition = getDeepScrollPosition(ref.current);
2993
+ const portalContainerEl = iframe.enabled ? null : (_a = ref.current) == null ? void 0 : _a.closest("[data-puck-preview]");
3892
2994
  const portalContainerRect = portalContainerEl == null ? void 0 : portalContainerEl.getBoundingClientRect();
2995
+ const portalScroll = portalContainerEl ? getDeepScrollPosition(portalContainerEl) : { x: 0, y: 0 };
3893
2996
  const scroll = {
3894
- x: ((view == null ? void 0 : view.scrollX) || 0) - ((_a = portalContainerRect == null ? void 0 : portalContainerRect.left) != null ? _a : 0),
3895
- y: ((view == null ? void 0 : view.scrollY) || 0) - ((_b = portalContainerRect == null ? void 0 : portalContainerRect.top) != null ? _b : 0)
2997
+ x: deepScrollPosition.x - portalScroll.x - ((_b = portalContainerRect == null ? void 0 : portalContainerRect.left) != null ? _b : 0),
2998
+ y: deepScrollPosition.y - portalScroll.y - ((_c = portalContainerRect == null ? void 0 : portalContainerRect.top) != null ? _c : 0)
3896
2999
  };
3897
3000
  const style2 = {
3898
3001
  left: `${rect.left + scroll.x}px`,
@@ -3901,11 +3004,20 @@ var DraggableComponent = ({
3901
3004
  width: `${rect.width}px`
3902
3005
  };
3903
3006
  return style2;
3904
- }, [ref, iframe]);
3007
+ }, [ref.current]);
3905
3008
  const [style, setStyle] = (0, import_react16.useState)();
3906
3009
  const sync = (0, import_react16.useCallback)(() => {
3907
3010
  setStyle(getStyle());
3908
- }, [ref, iframe]);
3011
+ }, [ref.current, iframe]);
3012
+ (0, import_react16.useEffect)(() => {
3013
+ if (ref.current) {
3014
+ const observer = new ResizeObserver(sync);
3015
+ observer.observe(ref.current);
3016
+ return () => {
3017
+ observer.disconnect();
3018
+ };
3019
+ }
3020
+ }, [ref.current]);
3909
3021
  (0, import_react16.useEffect)(() => {
3910
3022
  ctx == null ? void 0 : ctx.registerPath({
3911
3023
  index,
@@ -3920,8 +3032,8 @@ var DraggableComponent = ({
3920
3032
  item: selectedItem
3921
3033
  });
3922
3034
  const onClick = (0, import_react16.useCallback)(
3923
- (e2) => {
3924
- e2.stopPropagation();
3035
+ (e) => {
3036
+ e.stopPropagation();
3925
3037
  dispatch({
3926
3038
  type: "setUi",
3927
3039
  ui: {
@@ -3931,28 +3043,38 @@ var DraggableComponent = ({
3931
3043
  },
3932
3044
  [index, zoneCompound, id]
3933
3045
  );
3934
- const onDuplicate = (0, import_react16.useCallback)(
3935
- (e2) => {
3936
- e2.stopPropagation();
3937
- dispatch({
3938
- type: "duplicate",
3939
- sourceIndex: index,
3940
- sourceZone: zoneCompound
3941
- });
3942
- },
3943
- [index, zoneCompound]
3944
- );
3945
- const onDelete = (0, import_react16.useCallback)(
3946
- (e2) => {
3947
- e2.stopPropagation();
3948
- dispatch({
3949
- type: "remove",
3950
- index,
3951
- zone: zoneCompound
3952
- });
3953
- },
3954
- [index, zoneCompound]
3955
- );
3046
+ const onSelectParent = (0, import_react16.useCallback)(() => {
3047
+ if (!(ctx == null ? void 0 : ctx.areaId)) {
3048
+ return;
3049
+ }
3050
+ const parentAreaId = ctx.areaId;
3051
+ const parentZone = path[path.length - 3];
3052
+ const parentItemSelector = convertIdToSelector(
3053
+ parentAreaId,
3054
+ parentZone,
3055
+ state.data
3056
+ );
3057
+ dispatch({
3058
+ type: "setUi",
3059
+ ui: {
3060
+ itemSelector: parentItemSelector
3061
+ }
3062
+ });
3063
+ }, [ctx, path]);
3064
+ const onDuplicate = (0, import_react16.useCallback)(() => {
3065
+ dispatch({
3066
+ type: "duplicate",
3067
+ sourceIndex: index,
3068
+ sourceZone: zoneCompound
3069
+ });
3070
+ }, [index, zoneCompound]);
3071
+ const onDelete = (0, import_react16.useCallback)(() => {
3072
+ dispatch({
3073
+ type: "remove",
3074
+ index,
3075
+ zone: zoneCompound
3076
+ });
3077
+ }, [index, zoneCompound]);
3956
3078
  const [hover, setHover] = (0, import_react16.useState)(false);
3957
3079
  const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
3958
3080
  (0, import_react16.useEffect)(() => {
@@ -3960,7 +3082,7 @@ var DraggableComponent = ({
3960
3082
  return;
3961
3083
  }
3962
3084
  const el = ref.current;
3963
- const _onMouseOver = (e2) => {
3085
+ const _onMouseOver = (e) => {
3964
3086
  if (userIsDragging) {
3965
3087
  if (thisIsDragging) {
3966
3088
  setHover(true);
@@ -3970,10 +3092,10 @@ var DraggableComponent = ({
3970
3092
  } else {
3971
3093
  setHover(true);
3972
3094
  }
3973
- e2.stopPropagation();
3095
+ e.stopPropagation();
3974
3096
  };
3975
- const _onMouseOut = (e2) => {
3976
- e2.stopPropagation();
3097
+ const _onMouseOut = (e) => {
3098
+ e.stopPropagation();
3977
3099
  setHover(false);
3978
3100
  };
3979
3101
  el.setAttribute("data-puck-component", id);
@@ -4055,6 +3177,7 @@ var DraggableComponent = ({
4055
3177
  }
4056
3178
  setDragAxis(autoDragAxis);
4057
3179
  }, [ref, userDragAxis, autoDragAxis]);
3180
+ const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CornerLeftUp, { size: 16 }) });
4058
3181
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4059
3182
  DropZoneProvider,
4060
3183
  {
@@ -4100,10 +3223,17 @@ var DraggableComponent = ({
4100
3223
  paddingRight: actionsSide
4101
3224
  },
4102
3225
  ref: syncActionsPosition,
4103
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(CustomActionBar, { label: DEBUG2 ? id : label, children: [
4104
- permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Copy, { size: 16 }) }),
4105
- permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Trash, { size: 16 }) })
4106
- ] })
3226
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3227
+ CustomActionBar,
3228
+ {
3229
+ parentAction,
3230
+ label: DEBUG2 ? id : label,
3231
+ children: [
3232
+ permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Copy, { size: 16 }) }),
3233
+ permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Trash, { size: 16 }) })
3234
+ ]
3235
+ }
3236
+ )
4107
3237
  }
4108
3238
  )
4109
3239
  }
@@ -4378,12 +3508,12 @@ function DropZoneEdit({
4378
3508
  "--min-empty-height": `${minEmptyHeight}px`
4379
3509
  }),
4380
3510
  children: [
4381
- isRootZone && DEBUG3 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
3511
+ isRootZone && DEBUG3 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "data-puck-component": true, children: [
4382
3512
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: deepestZone || rootDroppableId }),
4383
3513
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: deepestArea || "No area" })
4384
3514
  ] }),
4385
- contentWithPreview.map((item, i2) => {
4386
- var _a, _b, _c3, _d, _e;
3515
+ contentWithPreview.map((item, i) => {
3516
+ var _a, _b, _c, _d, _e;
4387
3517
  const componentId = item.props.id;
4388
3518
  const puckProps = {
4389
3519
  renderDropZone: DropZone,
@@ -4409,7 +3539,7 @@ function DropZoneEdit({
4409
3539
  };
4410
3540
  var Preview2 = Preview3;
4411
3541
  componentType = preview.componentType;
4412
- label = (_d = (_c3 = config.components[componentType]) == null ? void 0 : _c3.label) != null ? _d : preview.componentType;
3542
+ label = (_d = (_c = config.components[componentType]) == null ? void 0 : _c.label) != null ? _d : preview.componentType;
4413
3543
  Render2 = Preview3;
4414
3544
  }
4415
3545
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
@@ -4423,7 +3553,7 @@ function DropZoneEdit({
4423
3553
  componentType,
4424
3554
  zoneCompound,
4425
3555
  depth: depth + 1,
4426
- index: i2,
3556
+ index: i,
4427
3557
  isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
4428
3558
  isSelected,
4429
3559
  label,
@@ -4509,6 +3639,8 @@ var getZoneId = (zoneCompound) => {
4509
3639
 
4510
3640
  // components/DragDropContext/NestedDroppablePlugin.ts
4511
3641
  init_react_import();
3642
+ var import_abstract9 = require("@dnd-kit/abstract");
3643
+ var import_state = require("@dnd-kit/state");
4512
3644
 
4513
3645
  // lib/throttle.ts
4514
3646
  init_react_import();
@@ -4543,9 +3675,9 @@ function isPositionInsideRect(position, rect) {
4543
3675
  var BUFFER_ZONE = 8;
4544
3676
  var REFRESH_ON_MOVE = true;
4545
3677
  var depthSort = (candidates) => {
4546
- return candidates.sort((a2, b2) => {
4547
- const aData = a2.data;
4548
- const bData = b2.data;
3678
+ return candidates.sort((a, b) => {
3679
+ const aData = a.data;
3680
+ const bData = b.data;
4549
3681
  if (aData.depth > bData.depth) {
4550
3682
  return 1;
4551
3683
  }
@@ -4570,24 +3702,6 @@ var getZoneId2 = (candidate) => {
4570
3702
  }
4571
3703
  return id;
4572
3704
  };
4573
- var getAreaId = (candidate) => {
4574
- if (candidate.type === "component") {
4575
- const data = candidate.data;
4576
- if (data.containsActiveZone) {
4577
- return candidate.id;
4578
- }
4579
- }
4580
- return null;
4581
- };
4582
- var getDeepestId = (candidates, idFn) => {
4583
- let id = null;
4584
- for (let i2 = 0; i2 < candidates.length; i2++) {
4585
- const candidate = candidates[i2];
4586
- id = idFn(candidate);
4587
- if (id) break;
4588
- }
4589
- return id;
4590
- };
4591
3705
  var expandHitBox = (rect) => {
4592
3706
  return {
4593
3707
  bottom: rect.bottom + BUFFER_ZONE,
@@ -4646,12 +3760,17 @@ var findDeepestCandidate = (position, manager) => {
4646
3760
  if (candidateData2.areaId === draggedCandidateId) {
4647
3761
  return false;
4648
3762
  }
3763
+ } else if (candidate.type === "component") {
3764
+ const candidateData2 = candidate.data;
3765
+ if (!candidateData2.inDroppableZone) {
3766
+ return false;
3767
+ }
4649
3768
  }
4650
3769
  return true;
4651
3770
  });
4652
3771
  filteredCandidates.reverse();
4653
3772
  const zone = getZoneId2(filteredCandidates[0]);
4654
- const area = getDeepestId(filteredCandidates, getAreaId);
3773
+ const area = filteredCandidates[0].data.areaId || null;
4655
3774
  return { zone, area };
4656
3775
  }
4657
3776
  return {
@@ -4661,13 +3780,13 @@ var findDeepestCandidate = (position, manager) => {
4661
3780
  };
4662
3781
  var createNestedDroppablePlugin = ({
4663
3782
  onChange
4664
- }) => class NestedDroppablePlugin extends Plugin {
3783
+ }) => class NestedDroppablePlugin extends import_abstract9.Plugin {
4665
3784
  constructor(manager, options) {
4666
3785
  super(manager);
4667
3786
  if (typeof window === "undefined") {
4668
3787
  return;
4669
3788
  }
4670
- const cleanupEffect = effects(() => {
3789
+ const cleanupEffect = (0, import_state.effects)(() => {
4671
3790
  const handleMove = (position) => {
4672
3791
  if (REFRESH_ON_MOVE) {
4673
3792
  for (const droppable of manager.registry.droppables.value) {
@@ -4776,7 +3895,7 @@ function duplicateRelatedZones(item, data, newId) {
4776
3895
  (dupeOfDupes2, item2, index) => __spreadValues(__spreadValues({}, dupeOfDupes2), duplicateRelatedZones(zone[index], data, item2.props.id).zones),
4777
3896
  acc
4778
3897
  );
4779
- const [_2, zoneId] = getZoneId(key);
3898
+ const [_, zoneId] = getZoneId(key);
4780
3899
  return __spreadProps(__spreadValues({}, dupeOfDupes), {
4781
3900
  [key]: zone,
4782
3901
  [`${newId}:${zoneId}`]: dupedZone
@@ -5096,9 +4215,12 @@ var import_utilities2 = require("@dnd-kit/dom/utilities");
5096
4215
 
5097
4216
  // components/DragDropContext/PointerSensor.ts
5098
4217
  init_react_import();
4218
+ var import_state3 = require("@dnd-kit/state");
4219
+ var import_abstract10 = require("@dnd-kit/abstract");
4220
+ var import_geometry8 = require("@dnd-kit/geometry");
5099
4221
  var import_utilities = require("@dnd-kit/dom/utilities");
5100
4222
  var _clearTimeout;
5101
- var _PointerSensor = class _PointerSensor extends Sensor {
4223
+ var _PointerSensor = class _PointerSensor extends import_abstract10.Sensor {
5102
4224
  constructor(manager, options) {
5103
4225
  super(manager);
5104
4226
  this.manager = manager;
@@ -5110,7 +4232,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
5110
4232
  this.handleCancel = this.handleCancel.bind(this);
5111
4233
  this.handlePointerUp = this.handlePointerUp.bind(this);
5112
4234
  this.handleKeyDown = this.handleKeyDown.bind(this);
5113
- E(() => {
4235
+ (0, import_state3.effect)(() => {
5114
4236
  const unbindGlobal = this.bindGlobal(options != null ? options : {});
5115
4237
  return () => {
5116
4238
  unbindGlobal();
@@ -5118,7 +4240,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
5118
4240
  });
5119
4241
  }
5120
4242
  bind(source, options = this.options) {
5121
- const unbind = E(() => {
4243
+ const unbind = (0, import_state3.effect)(() => {
5122
4244
  var _a;
5123
4245
  const target = (_a = source.handle) != null ? _a : source.element;
5124
4246
  const listener = (event) => {
@@ -5240,15 +4362,15 @@ var _PointerSensor = class _PointerSensor extends Sensor {
5240
4362
  const constraints = typeof activationConstraints === "function" ? activationConstraints(event, this.source) : activationConstraints;
5241
4363
  const { distance, delay } = constraints != null ? constraints : {};
5242
4364
  if (distance) {
5243
- if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
4365
+ if (distance.tolerance != null && (0, import_geometry8.exceedsDistance)(delta, distance.tolerance)) {
5244
4366
  return this.handleCancel();
5245
4367
  }
5246
- if (exceedsDistance(delta, distance.value)) {
4368
+ if ((0, import_geometry8.exceedsDistance)(delta, distance.value)) {
5247
4369
  return this.handleStart(this.source, event);
5248
4370
  }
5249
4371
  }
5250
4372
  if (delay) {
5251
- if (exceedsDistance(delta, delay.tolerance)) {
4373
+ if ((0, import_geometry8.exceedsDistance)(delta, delay.tolerance)) {
5252
4374
  return this.handleCancel();
5253
4375
  }
5254
4376
  }
@@ -5281,7 +4403,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
5281
4403
  return;
5282
4404
  }
5283
4405
  event.preventDefault();
5284
- o(() => {
4406
+ (0, import_state3.batch)(() => {
5285
4407
  manager.actions.setDragSource(source.id);
5286
4408
  manager.actions.start({ coordinates: initialCoordinates, event });
5287
4409
  });
@@ -5333,7 +4455,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
5333
4455
  }
5334
4456
  };
5335
4457
  _clearTimeout = new WeakMap();
5336
- _PointerSensor.configure = configurator(_PointerSensor);
4458
+ _PointerSensor.configure = (0, import_abstract10.configurator)(_PointerSensor);
5337
4459
  var PointerSensor = _PointerSensor;
5338
4460
  function preventDefault(event) {
5339
4461
  event.preventDefault();
@@ -5369,7 +4491,10 @@ function useDragListener(type, fn, deps = []) {
5369
4491
  }
5370
4492
  var previewContext = (0, import_react20.createContext)(null);
5371
4493
  var AREA_CHANGE_DEBOUNCE_MS = 100;
5372
- var DragDropContextClient = ({ children }) => {
4494
+ var DragDropContextClient = ({
4495
+ children,
4496
+ disableAutoScroll
4497
+ }) => {
5373
4498
  const { state, config, dispatch, resolveData } = useAppContext();
5374
4499
  const [preview, setPreview] = (0, import_react20.useState)(null);
5375
4500
  const previewRef = (0, import_react20.useRef)(null);
@@ -5377,45 +4502,63 @@ var DragDropContextClient = ({ children }) => {
5377
4502
  const [deepest, setDeepest] = (0, import_react20.useState)(null);
5378
4503
  const [nextDeepest, setNextDeepest] = (0, import_react20.useState)(null);
5379
4504
  const deepestRef = (0, import_react20.useRef)(deepest);
5380
- const dbDeepestRef = (0, import_react20.useRef)(deepest);
5381
- const setDeepestDb = (0, import_use_debounce2.useDebouncedCallback)((params) => {
5382
- setDeepest(params);
5383
- dbDeepestRef.current = params;
5384
- }, AREA_CHANGE_DEBOUNCE_MS);
5385
- const setDeepestDbMaybe = (0, import_react20.useCallback)(
5386
- (params) => {
5387
- var _a, _b;
5388
- if (deepestRef.current === null || ((_a = deepestRef.current) == null ? void 0 : _a.zone) === "void" || params.zone && params.area && ((_b = dbDeepestRef.current) == null ? void 0 : _b.area) === params.area) {
5389
- setDeepest(params);
5390
- } else {
5391
- setDeepestDb(params);
5392
- }
5393
- if (!dbDeepestRef.current) {
5394
- dbDeepestRef.current = params;
5395
- }
4505
+ const debouncedParamsRef = (0, import_react20.useRef)(null);
4506
+ const setDeepestAndCollide = (0, import_react20.useCallback)(
4507
+ (params, manager) => {
4508
+ setDeepest(params);
4509
+ setTimeout(() => {
4510
+ manager.collisionObserver.forceUpdate(true);
4511
+ }, 50);
4512
+ debouncedParamsRef.current = null;
5396
4513
  },
5397
- [deepest]
4514
+ []
4515
+ );
4516
+ const setDeepestDb = (0, import_use_debounce2.useDebouncedCallback)(
4517
+ setDeepestAndCollide,
4518
+ AREA_CHANGE_DEBOUNCE_MS
5398
4519
  );
4520
+ (0, import_react20.useEffect)(() => {
4521
+ deepestRef.current = deepest;
4522
+ }, [deepest]);
4523
+ const cancelDb = () => {
4524
+ setDeepestDb.cancel();
4525
+ debouncedParamsRef.current = null;
4526
+ };
5399
4527
  const [plugins] = (0, import_react20.useState)(() => [
5400
- ...import_dom.defaultPreset.plugins,
4528
+ ...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
5401
4529
  createNestedDroppablePlugin({
5402
4530
  onChange: (params, manager) => {
5403
- var _a, _b, _c3;
5404
- const paramsChanged = !deepestRef.current || params.area !== ((_a = deepestRef.current) == null ? void 0 : _a.area) || params.zone !== ((_b = deepestRef.current) == null ? void 0 : _b.zone);
5405
- if (paramsChanged) {
5406
- if (manager.dragOperation.status.dragging) {
5407
- setDeepestDbMaybe(params);
4531
+ const lastParams = deepestRef.current;
4532
+ const areaChanged = params.area !== (lastParams == null ? void 0 : lastParams.area);
4533
+ const zoneChanged = params.zone !== (lastParams == null ? void 0 : lastParams.zone);
4534
+ const isDragging = manager.dragOperation.status.dragging;
4535
+ if (areaChanged || zoneChanged) {
4536
+ setNextDeepest(params);
4537
+ }
4538
+ if (params.zone !== "void" && (lastParams == null ? void 0 : lastParams.zone) === "void") {
4539
+ setDeepest(params);
4540
+ manager.collisionObserver.forceUpdate(true);
4541
+ return;
4542
+ }
4543
+ if (areaChanged) {
4544
+ if (isDragging) {
4545
+ const debouncedParams = debouncedParamsRef.current;
4546
+ const isSameParams = debouncedParams && debouncedParams.area === params.area && debouncedParams.zone === params.zone;
4547
+ if (!isSameParams) {
4548
+ cancelDb();
4549
+ setDeepestDb(params, manager);
4550
+ debouncedParamsRef.current = params;
4551
+ }
5408
4552
  } else {
5409
- setDeepest(params);
4553
+ cancelDb();
4554
+ setDeepestAndCollide(params, manager);
5410
4555
  }
5411
- setNextDeepest(params);
4556
+ return;
5412
4557
  }
5413
- if (params.area !== ((_c3 = deepestRef.current) == null ? void 0 : _c3.area)) {
5414
- setTimeout(() => {
5415
- manager.collisionObserver.forceUpdate(true);
5416
- }, 50);
4558
+ if (zoneChanged) {
4559
+ setDeepestAndCollide(params, manager);
5417
4560
  }
5418
- deepestRef.current = params;
4561
+ cancelDb();
5419
4562
  }
5420
4563
  })
5421
4564
  ]);
@@ -5485,24 +4628,25 @@ var DragDropContextClient = ({ children }) => {
5485
4628
  return;
5486
4629
  }
5487
4630
  const { zone, index } = source.data;
4631
+ const thisPreview = previewRef.current ? __spreadValues({}, previewRef.current) : null;
4632
+ previewRef.current = null;
5488
4633
  setTimeout(() => {
5489
4634
  var _a, _b;
5490
4635
  setDraggedItem(null);
5491
4636
  if (event.canceled || (target == null ? void 0 : target.type) === "void") {
5492
4637
  setPreview(null);
5493
- previewRef.current = null;
5494
4638
  (_a = dragListeners.dragend) == null ? void 0 : _a.forEach((fn) => {
5495
4639
  fn(event, manager);
5496
4640
  });
5497
4641
  return;
5498
4642
  }
5499
- if (previewRef.current) {
4643
+ if (thisPreview) {
5500
4644
  setPreview(null);
5501
- if (previewRef.current.type === "insert") {
4645
+ if (thisPreview.type === "insert") {
5502
4646
  insertComponent(
5503
- previewRef.current.componentType,
5504
- previewRef.current.zone,
5505
- previewRef.current.index,
4647
+ thisPreview.componentType,
4648
+ thisPreview.zone,
4649
+ thisPreview.index,
5506
4650
  { config, dispatch, resolveData, state }
5507
4651
  );
5508
4652
  } else if (initialSelector.current) {
@@ -5510,12 +4654,11 @@ var DragDropContextClient = ({ children }) => {
5510
4654
  type: "move",
5511
4655
  sourceIndex: initialSelector.current.index,
5512
4656
  sourceZone: initialSelector.current.zone,
5513
- destinationIndex: previewRef.current.index,
5514
- destinationZone: previewRef.current.zone,
4657
+ destinationIndex: thisPreview.index,
4658
+ destinationZone: thisPreview.zone,
5515
4659
  recordHistory: false
5516
4660
  });
5517
4661
  }
5518
- previewRef.current = null;
5519
4662
  }
5520
4663
  dispatch({
5521
4664
  type: "setUi",
@@ -5531,9 +4674,10 @@ var DragDropContextClient = ({ children }) => {
5531
4674
  }, 300);
5532
4675
  },
5533
4676
  onDragOver: (event, manager) => {
5534
- var _a, _b, _c3, _d;
4677
+ var _a, _b, _c, _d;
5535
4678
  event.preventDefault();
5536
4679
  if (!draggedItem) return;
4680
+ cancelDb();
5537
4681
  const { source, target } = event.operation;
5538
4682
  if (!target || !source || target.type === "void") return;
5539
4683
  const [sourceId] = source.id.split(":");
@@ -5559,7 +4703,7 @@ var DragDropContextClient = ({ children }) => {
5559
4703
  targetZone = target.id.toString();
5560
4704
  targetIndex = 0;
5561
4705
  }
5562
- if (targetId === sourceId || ((_c3 = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _c3.path.find((path) => {
4706
+ if (targetId === sourceId || ((_c = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _c.path.find((path) => {
5563
4707
  const [pathId] = path.split(":");
5564
4708
  return pathId === sourceId;
5565
4709
  }))) {
@@ -5649,12 +4793,15 @@ var DragDropContextClient = ({ children }) => {
5649
4793
  }
5650
4794
  );
5651
4795
  };
5652
- var DragDropContext2 = ({ children }) => {
4796
+ var DragDropContext2 = ({
4797
+ children,
4798
+ disableAutoScroll
4799
+ }) => {
5653
4800
  const { status } = useAppContext();
5654
4801
  if (status === "LOADING") {
5655
4802
  return children;
5656
4803
  }
5657
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DragDropContextClient, { children });
4804
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DragDropContextClient, { disableAutoScroll, children });
5658
4805
  };
5659
4806
 
5660
4807
  // components/Drawer/index.tsx
@@ -5677,7 +4824,7 @@ var DrawerItemInner = ({
5677
4824
  {
5678
4825
  className: getClassNameItem2({ disabled: isDragDisabled }),
5679
4826
  ref: dragRef,
5680
- onMouseDown: (e2) => e2.preventDefault(),
4827
+ onMouseDown: (e) => e.preventDefault(),
5681
4828
  children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
5682
4829
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
5683
4830
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DragIcon, {}) })
@@ -5865,7 +5012,7 @@ var SidebarSection = ({
5865
5012
  style: { background },
5866
5013
  children: [
5867
5014
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
5868
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i2) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
5015
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
5869
5016
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5870
5017
  "button",
5871
5018
  {
@@ -5876,7 +5023,7 @@ var SidebarSection = ({
5876
5023
  }
5877
5024
  ),
5878
5025
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronRight, { size: 16 })
5879
- ] }, i2)) : null,
5026
+ ] }, i)) : null,
5880
5027
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
5881
5028
  ] }) }),
5882
5029
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("content"), children }),
@@ -6086,8 +5233,8 @@ var Fields = () => {
6086
5233
  "form",
6087
5234
  {
6088
5235
  className: getClassName21(),
6089
- onSubmit: (e2) => {
6090
- e2.preventDefault();
5236
+ onSubmit: (e) => {
5237
+ e.preventDefault();
6091
5238
  },
6092
5239
  children: [
6093
5240
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
@@ -6271,7 +5418,7 @@ var import_jsx_runtime30 = require("react/jsx-runtime");
6271
5418
  var useComponentList = (config, ui) => {
6272
5419
  const [componentList, setComponentList] = (0, import_react25.useState)();
6273
5420
  (0, import_react25.useEffect)(() => {
6274
- var _a, _b, _c3;
5421
+ var _a, _b, _c;
6275
5422
  if (Object.keys(ui.componentList).length > 0) {
6276
5423
  const matchedComponents = [];
6277
5424
  let _componentList;
@@ -6285,7 +5432,7 @@ var useComponentList = (config, ui) => {
6285
5432
  {
6286
5433
  id: categoryKey,
6287
5434
  title: category.title || categoryKey,
6288
- children: category.components.map((componentName, i2) => {
5435
+ children: category.components.map((componentName, i) => {
6289
5436
  var _a2;
6290
5437
  matchedComponents.push(componentName);
6291
5438
  const componentConf = config.components[componentName] || {};
@@ -6294,7 +5441,7 @@ var useComponentList = (config, ui) => {
6294
5441
  {
6295
5442
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
6296
5443
  name: componentName,
6297
- index: i2
5444
+ index: i
6298
5445
  },
6299
5446
  componentName
6300
5447
  );
@@ -6313,8 +5460,8 @@ var useComponentList = (config, ui) => {
6313
5460
  ComponentList,
6314
5461
  {
6315
5462
  id: "other",
6316
- title: ((_c3 = ui.componentList.other) == null ? void 0 : _c3.title) || "Other",
6317
- children: remainingComponents.map((componentName, i2) => {
5463
+ title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
5464
+ children: remainingComponents.map((componentName, i) => {
6318
5465
  var _a2;
6319
5466
  const componentConf = config.components[componentName] || {};
6320
5467
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
@@ -6322,7 +5469,7 @@ var useComponentList = (config, ui) => {
6322
5469
  {
6323
5470
  name: componentName,
6324
5471
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
6325
- index: i2
5472
+ index: i
6326
5473
  },
6327
5474
  componentName
6328
5475
  );
@@ -6376,7 +5523,7 @@ var getStyles = (styleSheet) => {
6376
5523
  if (styleSheet) {
6377
5524
  try {
6378
5525
  return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
6379
- } catch (e2) {
5526
+ } catch (e) {
6380
5527
  console.warn(
6381
5528
  "Access to stylesheet %s is denied. Ignoring\u2026",
6382
5529
  styleSheet.href
@@ -6513,7 +5660,7 @@ var CopyHostStyles = ({
6513
5660
  const parentBody = parentDocument.getElementsByTagName("body")[0];
6514
5661
  syncAttributes(parentBody, doc.body);
6515
5662
  Promise.all(
6516
- collectedStyles.map((styleNode, i2) => __async(void 0, null, function* () {
5663
+ collectedStyles.map((styleNode, i) => __async(void 0, null, function* () {
6517
5664
  if (styleNode.nodeName === "LINK") {
6518
5665
  const linkHref = styleNode.href;
6519
5666
  if (hrefs.indexOf(linkHref) > -1) {
@@ -6671,6 +5818,7 @@ var Preview = ({ id = "puck-preview" }) => {
6671
5818
  {
6672
5819
  className: getClassName23(),
6673
5820
  id,
5821
+ "data-puck-preview": true,
6674
5822
  onClick: () => {
6675
5823
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
6676
5824
  },
@@ -6824,9 +5972,9 @@ var LayerTree = ({
6824
5972
  ] }),
6825
5973
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
6826
5974
  zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
6827
- zoneContent.map((item, i2) => {
5975
+ zoneContent.map((item, i) => {
6828
5976
  var _a;
6829
- const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i2 && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
5977
+ const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
6830
5978
  const zonesForItem = findZonesForArea(data, item.props.id);
6831
5979
  const containsZone = Object.keys(zonesForItem).length > 0;
6832
5980
  const { setHoveringComponent = () => {
@@ -6856,7 +6004,7 @@ var LayerTree = ({
6856
6004
  setItemSelector(null);
6857
6005
  return;
6858
6006
  }
6859
- const id = zoneContent[i2].props.id;
6007
+ const id = zoneContent[i].props.id;
6860
6008
  const frame = getFrame();
6861
6009
  const el = frame == null ? void 0 : frame.querySelector(
6862
6010
  `[data-puck-component="${id}"]`
@@ -6871,17 +6019,17 @@ var LayerTree = ({
6871
6019
  scrollIntoView(el);
6872
6020
  onScrollEnd(frame, () => {
6873
6021
  setItemSelector({
6874
- index: i2,
6022
+ index: i,
6875
6023
  zone
6876
6024
  });
6877
6025
  });
6878
6026
  },
6879
- onMouseOver: (e2) => {
6880
- e2.stopPropagation();
6027
+ onMouseOver: (e) => {
6028
+ e.stopPropagation();
6881
6029
  setHoveringComponent(item.props.id);
6882
6030
  },
6883
- onMouseOut: (e2) => {
6884
- e2.stopPropagation();
6031
+ onMouseOut: (e) => {
6032
+ e.stopPropagation();
6885
6033
  setHoveringComponent(null);
6886
6034
  },
6887
6035
  children: [
@@ -6914,7 +6062,7 @@ var LayerTree = ({
6914
6062
  ) }, idx))
6915
6063
  ]
6916
6064
  },
6917
- `${item.props.id}_${i2}`
6065
+ `${item.props.id}_${i}`
6918
6066
  );
6919
6067
  })
6920
6068
  ] })
@@ -7259,8 +6407,8 @@ var ViewportButton = ({
7259
6407
  {
7260
6408
  title,
7261
6409
  disabled: isActive,
7262
- onClick: (e2) => {
7263
- e2.stopPropagation();
6410
+ onClick: (e) => {
6411
+ e.stopPropagation();
7264
6412
  onClick({ width, height });
7265
6413
  },
7266
6414
  children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
@@ -7296,11 +6444,11 @@ var ViewportControls = ({
7296
6444
  label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
7297
6445
  }
7298
6446
  ]
7299
- ].filter((a2) => a2.value <= autoZoom).sort((a2, b2) => a2.value > b2.value ? 1 : -1),
6447
+ ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
7300
6448
  [autoZoom]
7301
6449
  );
7302
6450
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
7303
- viewports.map((viewport, i2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6451
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7304
6452
  ViewportButton,
7305
6453
  {
7306
6454
  height: viewport.height,
@@ -7309,7 +6457,7 @@ var ViewportControls = ({
7309
6457
  onClick: onViewportChange,
7310
6458
  children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
7311
6459
  },
7312
- i2
6460
+ i
7313
6461
  )),
7314
6462
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
7315
6463
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -7317,8 +6465,8 @@ var ViewportControls = ({
7317
6465
  {
7318
6466
  title: "Zoom viewport out",
7319
6467
  disabled: zoom <= ((_a = zoomOptions[0]) == null ? void 0 : _a.value),
7320
- onClick: (e2) => {
7321
- e2.stopPropagation();
6468
+ onClick: (e) => {
6469
+ e.stopPropagation();
7322
6470
  onZoom(
7323
6471
  zoomOptions[Math.max(
7324
6472
  zoomOptions.findIndex((option) => option.value === zoom) - 1,
@@ -7334,8 +6482,8 @@ var ViewportControls = ({
7334
6482
  {
7335
6483
  title: "Zoom viewport in",
7336
6484
  disabled: zoom >= ((_b = zoomOptions[zoomOptions.length - 1]) == null ? void 0 : _b.value),
7337
- onClick: (e2) => {
7338
- e2.stopPropagation();
6485
+ onClick: (e) => {
6486
+ e.stopPropagation();
7339
6487
  onZoom(
7340
6488
  zoomOptions[Math.min(
7341
6489
  zoomOptions.findIndex((option) => option.value === zoom) + 1,
@@ -7352,8 +6500,8 @@ var ViewportControls = ({
7352
6500
  {
7353
6501
  className: getClassName25("zoomSelect"),
7354
6502
  value: zoom.toString(),
7355
- onChange: (e2) => {
7356
- onZoom(parseFloat(e2.currentTarget.value));
6503
+ onChange: (e) => {
6504
+ onZoom(parseFloat(e.currentTarget.value));
7357
6505
  },
7358
6506
  children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7359
6507
  "option",
@@ -7600,45 +6748,7 @@ var import_dom2 = require("@dnd-kit/dom");
7600
6748
  // lib/use-inject-css.ts
7601
6749
  init_react_import();
7602
6750
  var import_react35 = require("react");
7603
- var styles = `
7604
- /* Prevent user from interacting with underlying component */
7605
- [data-puck-component] * {
7606
- pointer-events: none;
7607
- user-select: none;
7608
- -webkit-user-select: none;
7609
- }
7610
-
7611
- [data-puck-component] {
7612
- cursor: grab;
7613
- pointer-events: auto !important;
7614
- user-select: none;
7615
- -webkit-user-select: none;
7616
- }
7617
-
7618
- [data-puck-disabled] {
7619
- cursor: pointer;
7620
- }
7621
-
7622
- /* Placeholder */
7623
- [data-puck-dragging]:not([data-dnd-dragging]) {
7624
- background: var(--puck-color-azure-06) !important;
7625
- border: none !important;
7626
- color: #00000000 !important;
7627
- opacity: 0.3 !important;
7628
- outline: none !important;
7629
- transition: none !important;
7630
- }
7631
-
7632
- [data-puck-dragging]:not([data-dnd-dragging]) *, [data-puck-dragging]:not([data-dnd-dragging])::after, [data-puck-dragging]:not([data-dnd-dragging])::before {
7633
- opacity: 0 !important;
7634
- }
7635
-
7636
- [data-dnd-dragging] {
7637
- pointer-events: none !important;
7638
- outline: 2px var(--puck-color-azure-09) solid !important;
7639
- outline-offset: -2px !important;
7640
- }
7641
- `;
6751
+ var styles = ``;
7642
6752
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
7643
6753
  const [el, setEl] = (0, import_react35.useState)();
7644
6754
  (0, import_react35.useEffect)(() => {
@@ -7693,7 +6803,7 @@ function Puck({
7693
6803
  }, _iframe);
7694
6804
  useInjectGlobalCss(iframe.enabled);
7695
6805
  const [generatedAppState] = (0, import_react36.useState)(() => {
7696
- var _a2, _b2, _c3, _d, _e, _f, _g, _h, _i;
6806
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
7697
6807
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
7698
6808
  let clientUiState = {};
7699
6809
  if (typeof window !== "undefined") {
@@ -7707,13 +6817,13 @@ function Puck({
7707
6817
  const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
7708
6818
  key,
7709
6819
  diff: Math.abs(viewportWidth - value.width)
7710
- })).sort((a2, b2) => a2.diff > b2.diff ? 1 : -1);
6820
+ })).sort((a, b) => a.diff > b.diff ? 1 : -1);
7711
6821
  const closestViewport = viewportDifferences[0].key;
7712
6822
  if (iframe.enabled) {
7713
6823
  clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
7714
6824
  viewports: __spreadProps(__spreadValues({}, initial.viewports), {
7715
6825
  current: __spreadProps(__spreadValues({}, initial.viewports.current), {
7716
- height: ((_b2 = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b2.height) || ((_c3 = viewports[closestViewport]) == null ? void 0 : _c3.height) || "auto",
6826
+ 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",
7717
6827
  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)
7718
6828
  })
7719
6829
  })
@@ -7899,7 +7009,7 @@ function Puck({
7899
7009
  getPermissions: () => ({}),
7900
7010
  refreshPermissions: () => null
7901
7011
  },
7902
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DragDropContext2, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7012
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DragDropContext2, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7903
7013
  "div",
7904
7014
  {
7905
7015
  className: getLayoutClassName({
@@ -8164,8 +7274,8 @@ function resolveAllData(data, config, onResolveStart, onResolveEnd) {
8164
7274
  const { zones = {} } = data;
8165
7275
  const zoneKeys = Object.keys(zones);
8166
7276
  const resolvedZones = {};
8167
- for (let i2 = 0; i2 < zoneKeys.length; i2++) {
8168
- const zoneKey = zoneKeys[i2];
7277
+ for (let i = 0; i < zoneKeys.length; i++) {
7278
+ const zoneKey = zoneKeys[i];
8169
7279
  resolvedZones[zoneKey] = yield resolveAllComponentData(
8170
7280
  zones[zoneKey],
8171
7281
  config,
@@ -8230,6 +7340,7 @@ var usePuck = () => {
8230
7340
  FieldLabel,
8231
7341
  Group,
8232
7342
  IconButton,
7343
+ Label,
8233
7344
  Puck,
8234
7345
  Render,
8235
7346
  dropZoneContext,
@@ -8304,6 +7415,14 @@ lucide-react/dist/esm/icons/copy.js:
8304
7415
  * See the LICENSE file in the root directory of this source tree.
8305
7416
  *)
8306
7417
 
7418
+ lucide-react/dist/esm/icons/corner-left-up.js:
7419
+ (**
7420
+ * @license lucide-react v0.298.0 - ISC
7421
+ *
7422
+ * This source code is licensed under the ISC license.
7423
+ * See the LICENSE file in the root directory of this source tree.
7424
+ *)
7425
+
8307
7426
  lucide-react/dist/esm/icons/globe.js:
8308
7427
  (**
8309
7428
  * @license lucide-react v0.298.0 - ISC