@measured/puck 0.21.0-canary.6c44fdb9 → 0.21.0-canary.73b98fb4

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
@@ -190,8 +190,8 @@ var require_fast_deep_equal = __commonJS({
190
190
  });
191
191
 
192
192
  // bundle/index.ts
193
- var bundle_exports = {};
194
- __export(bundle_exports, {
193
+ var index_exports = {};
194
+ __export(index_exports, {
195
195
  Action: () => Action,
196
196
  ActionBar: () => ActionBar,
197
197
  AutoField: () => AutoField,
@@ -216,7 +216,7 @@ __export(bundle_exports, {
216
216
  usePuck: () => usePuck,
217
217
  walkTree: () => walkTree
218
218
  });
219
- module.exports = __toCommonJS(bundle_exports);
219
+ module.exports = __toCommonJS(index_exports);
220
220
  init_react_import();
221
221
 
222
222
  // bundle/core.ts
@@ -1976,29 +1976,37 @@ var getChanged = (newItem, oldItem) => {
1976
1976
 
1977
1977
  // store/slices/permissions.ts
1978
1978
  var createPermissionsSlice = (set, get) => {
1979
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
1979
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
1980
1980
  const { state, permissions, config } = get();
1981
1981
  const { cache: cache2, globalPermissions } = permissions;
1982
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
1983
- var _a, _b, _c;
1982
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
1983
+ var _a, _b;
1984
1984
  const { config: config2, state: appState, setComponentLoading } = get();
1985
+ const itemCache = cache2[item2.props.id];
1986
+ const nodes = appState.indexes.nodes;
1987
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
1988
+ const parentNode = parentId ? nodes[parentId] : null;
1989
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
1985
1990
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
1986
1991
  if (!componentConfig) {
1987
1992
  return;
1988
1993
  }
1989
1994
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
1990
1995
  if (componentConfig.resolvePermissions) {
1991
- const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
1992
- if (Object.values(changed).some((el) => el === true) || force2) {
1996
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
1997
+ const propsChanged = Object.values(changed).some((el) => el === true);
1998
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
1999
+ if (propsChanged || parentChanged || force2) {
1993
2000
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
1994
2001
  const resolvedPermissions = yield componentConfig.resolvePermissions(
1995
2002
  item2,
1996
2003
  {
1997
2004
  changed,
1998
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2005
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
1999
2006
  permissions: initialPermissions,
2000
2007
  appState: makeStatePublic(appState),
2001
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2008
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2009
+ parent: parentData
2002
2010
  }
2003
2011
  );
2004
2012
  const latest = get().permissions;
@@ -2006,6 +2014,7 @@ var createPermissionsSlice = (set, get) => {
2006
2014
  permissions: __spreadProps(__spreadValues({}, latest), {
2007
2015
  cache: __spreadProps(__spreadValues({}, latest.cache), {
2008
2016
  [item2.props.id]: {
2017
+ lastParentId: parentId,
2009
2018
  lastData: item2,
2010
2019
  lastPermissions: resolvedPermissions
2011
2020
  }
@@ -2019,9 +2028,9 @@ var createPermissionsSlice = (set, get) => {
2019
2028
  }
2020
2029
  }
2021
2030
  });
2022
- const resolveDataForRoot = (force2 = false) => {
2031
+ const resolvePermissionsForRoot = (force2 = false) => {
2023
2032
  const { state: appState } = get();
2024
- resolveDataForItem(
2033
+ resolvePermissionsForItem(
2025
2034
  // Shim the root data in by conforming to component data shape
2026
2035
  {
2027
2036
  type: "root",
@@ -2032,16 +2041,16 @@ var createPermissionsSlice = (set, get) => {
2032
2041
  };
2033
2042
  const { item, type, root } = params;
2034
2043
  if (item) {
2035
- yield resolveDataForItem(item, force);
2044
+ yield resolvePermissionsForItem(item, force);
2036
2045
  } else if (type) {
2037
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
2038
- yield resolveDataForItem(item2, force);
2046
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2047
+ yield resolvePermissionsForItem(item2, force);
2039
2048
  }));
2040
2049
  } else if (root) {
2041
- resolveDataForRoot(force);
2050
+ resolvePermissionsForRoot(force);
2042
2051
  } else {
2043
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
2044
- yield resolveDataForItem(item2, force);
2052
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2053
+ yield resolvePermissionsForItem(item2, force);
2045
2054
  }));
2046
2055
  }
2047
2056
  });
@@ -2121,7 +2130,7 @@ var createFieldsSlice = (_set, _get) => {
2121
2130
  };
2122
2131
  var useRegisterFieldsSlice = (appStore, id) => {
2123
2132
  const resolveFields = (0, import_react7.useCallback)(
2124
- (reset) => __async(void 0, null, function* () {
2133
+ (reset) => __async(null, null, function* () {
2125
2134
  var _a, _b;
2126
2135
  const { fields, lastResolvedData } = appStore.getState().fields;
2127
2136
  const metadata = appStore.getState().metadata;
@@ -2192,7 +2201,7 @@ var useRegisterFieldsSlice = (appStore, id) => {
2192
2201
  init_react_import();
2193
2202
  var import_fast_equals2 = require("fast-equals");
2194
2203
  var cache = { lastChange: {} };
2195
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2204
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2196
2205
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
2197
2206
  const resolvedItem = __spreadValues({}, item);
2198
2207
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -2220,11 +2229,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
2220
2229
  let itemWithResolvedChildren = yield mapFields(
2221
2230
  resolvedItem,
2222
2231
  {
2223
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2232
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
2224
2233
  const content = value;
2225
2234
  return yield Promise.all(
2226
2235
  content.map(
2227
- (childItem) => __async(void 0, null, function* () {
2236
+ (childItem) => __async(null, null, function* () {
2228
2237
  return (yield resolveComponentData(
2229
2238
  childItem,
2230
2239
  config,
@@ -2414,7 +2423,7 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
2414
2423
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2415
2424
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2416
2425
  }),
2417
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2426
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2418
2427
  const { config, metadata, setComponentLoading, permissions } = get();
2419
2428
  const timeouts = {};
2420
2429
  return yield resolveComponentData(
@@ -2425,7 +2434,7 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
2425
2434
  const id = "id" in item.props ? item.props.id : "root";
2426
2435
  timeouts[id] = setComponentLoading(id, true, 50);
2427
2436
  },
2428
- (item) => __async(void 0, null, function* () {
2437
+ (item) => __async(null, null, function* () {
2429
2438
  const id = "id" in item.props ? item.props.id : "root";
2430
2439
  if ("type" in item) {
2431
2440
  yield permissions.refreshPermissions({ item });
@@ -2437,7 +2446,7 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
2437
2446
  trigger
2438
2447
  );
2439
2448
  }),
2440
- resolveAndCommitData: () => __async(void 0, null, function* () {
2449
+ resolveAndCommitData: () => __async(null, null, function* () {
2441
2450
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2442
2451
  walkAppState(
2443
2452
  state,
@@ -3009,7 +3018,7 @@ var collisionStore = (0, import_vanilla.createStore)(() => ({
3009
3018
 
3010
3019
  // lib/dnd/collision/dynamic/index.ts
3011
3020
  var flushNext = "";
3012
- var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
3021
+ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((input) => {
3013
3022
  var _a, _b, _c, _d, _e;
3014
3023
  const { dragOperation, droppable } = input;
3015
3024
  const { position } = dragOperation;
@@ -3102,7 +3111,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
3102
3111
  }
3103
3112
  collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "hotpink");
3104
3113
  return null;
3105
- };
3114
+ });
3106
3115
 
3107
3116
  // components/Sortable/index.tsx
3108
3117
  var import_sortable = require("@dnd-kit/react/sortable");
@@ -3825,7 +3834,7 @@ var ExternalInput = ({
3825
3834
  }, [mappedData]);
3826
3835
  const [searchQuery, setSearchQuery] = (0, import_react17.useState)(field.initialQuery || "");
3827
3836
  const search = (0, import_react17.useCallback)(
3828
- (query, filters2) => __async(void 0, null, function* () {
3837
+ (query, filters2) => __async(null, null, function* () {
3829
3838
  setIsLoading(true);
3830
3839
  const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
3831
3840
  let listData;
@@ -4051,7 +4060,7 @@ var ExternalField = ({
4051
4060
  placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
4052
4061
  mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
4053
4062
  mapRow: validField.mapRow,
4054
- fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
4063
+ fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(null, null, function* () {
4055
4064
  return yield deprecatedField.adaptor.fetchList(
4056
4065
  deprecatedField.adaptorParams
4057
4066
  );
@@ -4427,6 +4436,7 @@ function AutoFieldInternal(props) {
4427
4436
  }
4428
4437
  return (_props) => null;
4429
4438
  }, [field.type]);
4439
+ const fieldKey = field.type === "custom" ? field.key : void 0;
4430
4440
  let FieldComponent = (0, import_react20.useMemo)(() => {
4431
4441
  if (field.type === "custom") {
4432
4442
  if (!field.render) {
@@ -4436,7 +4446,7 @@ function AutoFieldInternal(props) {
4436
4446
  } else if (field.type !== "slot") {
4437
4447
  return render[field.type];
4438
4448
  }
4439
- }, [field.type, render]);
4449
+ }, [field.type, fieldKey, render]);
4440
4450
  const { visible = true } = props.field;
4441
4451
  if (!visible) {
4442
4452
  return null;
@@ -5261,7 +5271,7 @@ var import_react27 = require("react");
5261
5271
  function useRenderedCallback(callback, deps) {
5262
5272
  const manager = (0, import_react26.useDragDropManager)();
5263
5273
  return (0, import_react27.useCallback)(
5264
- (...args) => __async(this, null, function* () {
5274
+ (...args) => __async(null, null, function* () {
5265
5275
  yield manager == null ? void 0 : manager.renderer.rendering;
5266
5276
  return callback(...args);
5267
5277
  }),
@@ -5466,8 +5476,9 @@ var Item = ({
5466
5476
  );
5467
5477
  };
5468
5478
  var SlotRender = (0, import_react31.forwardRef)(
5469
- function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
5470
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className, style, ref, children: content.map((item) => {
5479
+ function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
5480
+ const El = as != null ? as : "div";
5481
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(El, { className, style, ref, children: content.map((item) => {
5471
5482
  if (!config.components[item.type]) {
5472
5483
  return null;
5473
5484
  }
@@ -5690,7 +5701,7 @@ var InlineTextFieldInternal = ({
5690
5701
  ref.current.replaceChildren(value);
5691
5702
  }
5692
5703
  const cleanupPortal = registerOverlayPortal(ref.current);
5693
- const handleInput = (e) => __async(void 0, null, function* () {
5704
+ const handleInput = (e) => __async(null, null, function* () {
5694
5705
  var _a2;
5695
5706
  const appStore2 = appStoreApi.getState();
5696
5707
  const node = appStore2.state.indexes.nodes[componentId];
@@ -5982,7 +5993,8 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5982
5993
  style,
5983
5994
  className,
5984
5995
  minEmptyHeight: userMinEmptyHeight = 128,
5985
- collisionAxis
5996
+ collisionAxis,
5997
+ as
5986
5998
  }, userRef) {
5987
5999
  const ctx = (0, import_react34.useContext)(dropZoneContext);
5988
6000
  const appStoreApi = useAppStoreApi();
@@ -6125,8 +6137,9 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
6125
6137
  userMinEmptyHeight,
6126
6138
  ref
6127
6139
  });
6140
+ const El = as != null ? as : "div";
6128
6141
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6129
- "div",
6142
+ El,
6130
6143
  {
6131
6144
  className: `${getClassName18({
6132
6145
  isRootZone,
@@ -6189,7 +6202,7 @@ var DropZoneRenderItem = ({
6189
6202
  };
6190
6203
  var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneRender, __spreadValues({}, props));
6191
6204
  var DropZoneRender = (0, import_react34.forwardRef)(
6192
- function DropZoneRenderInternal({ className, style, zone }, ref) {
6205
+ function DropZoneRenderInternal({ className, style, zone, as }, ref) {
6193
6206
  const ctx = (0, import_react34.useContext)(dropZoneContext);
6194
6207
  const { areaId = "root" } = ctx || {};
6195
6208
  const { config, data, metadata } = (0, import_react34.useContext)(renderContext);
@@ -6202,13 +6215,14 @@ var DropZoneRender = (0, import_react34.forwardRef)(
6202
6215
  }
6203
6216
  }
6204
6217
  }, [content]);
6218
+ const El = as != null ? as : "div";
6205
6219
  if (!data || !config) {
6206
6220
  return null;
6207
6221
  }
6208
6222
  if (zoneCompound !== rootDroppableId) {
6209
6223
  content = setupZone(data, zoneCompound).zones[zoneCompound];
6210
6224
  }
6211
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className, style, ref, children: content.map((item) => {
6225
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(El, { className, style, ref, children: content.map((item) => {
6212
6226
  const Component = config.components[item.type];
6213
6227
  if (Component) {
6214
6228
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
@@ -6514,7 +6528,8 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
6514
6528
 
6515
6529
  // lib/insert-component.ts
6516
6530
  init_react_import();
6517
- var insertComponent = (componentType, zone, index, appStore) => __async(void 0, null, function* () {
6531
+ var insertComponent = (componentType, zone, index, appStore) => __async(null, null, function* () {
6532
+ const { getState } = appStore;
6518
6533
  const id = generateId(componentType);
6519
6534
  const insertActionData = {
6520
6535
  type: "insert",
@@ -6523,8 +6538,9 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
6523
6538
  destinationZone: zone,
6524
6539
  id
6525
6540
  };
6526
- const { state, dispatch, resolveComponentData: resolveComponentData2 } = appStore;
6527
- const insertedState = insertAction(state, insertActionData, appStore);
6541
+ const stateBefore = getState().state;
6542
+ const insertedState = insertAction(stateBefore, insertActionData, getState());
6543
+ const dispatch = getState().dispatch;
6528
6544
  dispatch(__spreadProps(__spreadValues({}, insertActionData), {
6529
6545
  // Dispatch insert rather set, as user's may rely on this via onAction
6530
6546
  // We must always record history here so the insert is added to user history
@@ -6532,23 +6548,21 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
6532
6548
  // entries on insert - one for the initial insert, and one when the data resolves
6533
6549
  recordHistory: true
6534
6550
  }));
6535
- const itemSelector = {
6536
- index,
6537
- zone
6538
- };
6551
+ const itemSelector = { index, zone };
6539
6552
  dispatch({ type: "setUi", ui: { itemSelector } });
6540
6553
  const itemData = getItem(itemSelector, insertedState);
6541
- if (itemData) {
6542
- const resolved = yield resolveComponentData2(itemData, "insert");
6543
- if (resolved.didChange) {
6544
- dispatch({
6545
- type: "replace",
6546
- destinationZone: itemSelector.zone,
6547
- destinationIndex: itemSelector.index,
6548
- data: resolved.node
6549
- });
6550
- }
6551
- }
6554
+ if (!itemData) return;
6555
+ const resolveComponentData2 = getState().resolveComponentData;
6556
+ const resolved = yield resolveComponentData2(itemData, "insert");
6557
+ if (!resolved.didChange) return;
6558
+ const latestItemSelector = getSelectorForId(getState().state, id);
6559
+ if (!latestItemSelector) return;
6560
+ dispatch({
6561
+ type: "replace",
6562
+ destinationZone: latestItemSelector.zone,
6563
+ destinationIndex: latestItemSelector.index,
6564
+ data: resolved.node
6565
+ });
6552
6566
  });
6553
6567
 
6554
6568
  // components/DragDropContext/index.tsx
@@ -6785,7 +6799,7 @@ var DragDropContextClient = ({
6785
6799
  thisPreview.componentType,
6786
6800
  thisPreview.zone,
6787
6801
  thisPreview.index,
6788
- appStore.getState()
6802
+ appStore
6789
6803
  );
6790
6804
  } else if (initialSelector.current) {
6791
6805
  dispatch({
@@ -7222,49 +7236,48 @@ var DefaultFields = ({
7222
7236
  }) => {
7223
7237
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
7224
7238
  };
7225
- var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
7226
- let currentProps;
7239
+ var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
7227
7240
  const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
7228
7241
  const { data, ui } = state;
7229
7242
  const { itemSelector } = ui;
7230
7243
  const rootProps = data.root.props || data.root;
7231
- if (selectedItem) {
7232
- currentProps = selectedItem.props;
7233
- } else {
7234
- currentProps = rootProps;
7235
- }
7236
- const newProps = __spreadProps(__spreadValues({}, currentProps), {
7237
- [fieldName]: value
7238
- });
7244
+ const currentProps = selectedItem ? selectedItem.props : rootProps;
7245
+ const newProps = __spreadProps(__spreadValues({}, currentProps), { [fieldName]: value });
7239
7246
  if (selectedItem && itemSelector) {
7247
+ const resolved = yield resolveComponentData2(
7248
+ __spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
7249
+ "replace"
7250
+ );
7251
+ const latestSelector = getSelectorForId(
7252
+ appStore.getState().state,
7253
+ selectedItem.props.id
7254
+ );
7255
+ if (!latestSelector) return;
7240
7256
  dispatch({
7241
7257
  type: "replace",
7242
- destinationIndex: itemSelector.index,
7243
- destinationZone: itemSelector.zone || rootDroppableId,
7244
- data: (yield resolveComponentData2(
7245
- __spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
7258
+ destinationIndex: latestSelector.index,
7259
+ destinationZone: latestSelector.zone || rootDroppableId,
7260
+ data: resolved.node,
7261
+ ui: updatedUi
7262
+ });
7263
+ return;
7264
+ }
7265
+ if (data.root.props) {
7266
+ dispatch({
7267
+ type: "replaceRoot",
7268
+ root: (yield resolveComponentData2(
7269
+ __spreadProps(__spreadValues({}, data.root), { props: newProps }),
7246
7270
  "replace"
7247
7271
  )).node,
7248
- ui: updatedUi
7272
+ ui: __spreadValues(__spreadValues({}, ui), updatedUi),
7273
+ recordHistory: true
7249
7274
  });
7250
- } else {
7251
- if (data.root.props) {
7252
- dispatch({
7253
- type: "replaceRoot",
7254
- root: (yield resolveComponentData2(
7255
- __spreadProps(__spreadValues({}, data.root), { props: newProps }),
7256
- "replace"
7257
- )).node,
7258
- ui: __spreadValues(__spreadValues({}, ui), updatedUi),
7259
- recordHistory: true
7260
- });
7261
- } else {
7262
- dispatch({
7263
- type: "setData",
7264
- data: { root: newProps }
7265
- });
7266
- }
7275
+ return;
7267
7276
  }
7277
+ dispatch({
7278
+ type: "setData",
7279
+ data: { root: newProps }
7280
+ });
7268
7281
  });
7269
7282
  var FieldsChild = ({ fieldName }) => {
7270
7283
  const field = useAppStore((s) => s.fields.fields[fieldName]);
@@ -7591,7 +7604,7 @@ var CopyHostStyles = ({
7591
7604
  let elements = [];
7592
7605
  const hashes = {};
7593
7606
  const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
7594
- const mirrorEl = (el, inlineStyles = false) => __async(void 0, null, function* () {
7607
+ const mirrorEl = (el, inlineStyles = false) => __async(null, null, function* () {
7595
7608
  let mirror;
7596
7609
  if (el.nodeName === "LINK" && inlineStyles) {
7597
7610
  mirror = document.createElement("style");
@@ -7623,7 +7636,7 @@ var CopyHostStyles = ({
7623
7636
  }
7624
7637
  return mirror;
7625
7638
  });
7626
- const addEl = (el) => __async(void 0, null, function* () {
7639
+ const addEl = (el) => __async(null, null, function* () {
7627
7640
  const index = lookupEl(el);
7628
7641
  if (index > -1) {
7629
7642
  if (debug)
@@ -7696,7 +7709,7 @@ var CopyHostStyles = ({
7696
7709
  const parentBody = parentDocument.getElementsByTagName("body")[0];
7697
7710
  syncAttributes(parentBody, doc.body);
7698
7711
  Promise.all(
7699
- collectedStyles.map((styleNode, i) => __async(void 0, null, function* () {
7712
+ collectedStyles.map((styleNode, i) => __async(null, null, function* () {
7700
7713
  if (styleNode.nodeName === "LINK") {
7701
7714
  const linkHref = styleNode.href;
7702
7715
  if (hrefs.indexOf(linkHref) > -1) {
@@ -8771,7 +8784,7 @@ function createUsePuck() {
8771
8784
  }
8772
8785
  const result = (0, import_zustand6.useStore)(
8773
8786
  usePuckApi,
8774
- selector != null ? selector : (s) => s
8787
+ selector != null ? selector : ((s) => s)
8775
8788
  );
8776
8789
  return result;
8777
8790
  };
@@ -9349,7 +9362,12 @@ function PuckProvider({ children }) {
9349
9362
  });
9350
9363
  })
9351
9364
  );
9352
- const initialHistoryIndex = (_initialHistory == null ? void 0 : _initialHistory.index) || blendedHistories.length - 1;
9365
+ const initialHistoryIndex = (0, import_react60.useMemo)(() => {
9366
+ if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
9367
+ return _initialHistory == null ? void 0 : _initialHistory.index;
9368
+ }
9369
+ return blendedHistories.length - 1;
9370
+ }, []);
9353
9371
  const initialAppState = blendedHistories[initialHistoryIndex].state;
9354
9372
  const loadedOverrides = useLoadedOverrides({
9355
9373
  overrides,
@@ -9735,7 +9753,7 @@ function resolveAllData(_0, _1) {
9735
9753
  return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
9736
9754
  var _a;
9737
9755
  const defaultedData = defaultData(data);
9738
- const resolveNode = (_node) => __async(this, null, function* () {
9756
+ const resolveNode = (_node) => __async(null, null, function* () {
9739
9757
  const node = toComponent(_node);
9740
9758
  onResolveStart == null ? void 0 : onResolveStart(node);
9741
9759
  const resolved = (yield resolveComponentData(
@@ -9756,13 +9774,13 @@ function resolveAllData(_0, _1) {
9756
9774
  onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
9757
9775
  return resolvedDeep;
9758
9776
  });
9759
- const processContent = (content) => __async(this, null, function* () {
9777
+ const processContent = (content) => __async(null, null, function* () {
9760
9778
  return Promise.all(content.map(resolveNode));
9761
9779
  });
9762
- const processZones = () => __async(this, null, function* () {
9780
+ const processZones = () => __async(null, null, function* () {
9763
9781
  var _a2;
9764
9782
  const zones = (_a2 = data.zones) != null ? _a2 : {};
9765
- Object.entries(zones).forEach((_02) => __async(this, [_02], function* ([zoneKey, content]) {
9783
+ Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
9766
9784
  zones[zoneKey] = yield Promise.all(content.map(resolveNode));
9767
9785
  }));
9768
9786
  return zones;
@@ -9772,7 +9790,7 @@ function resolveAllData(_0, _1) {
9772
9790
  content: yield processContent(defaultedData.content),
9773
9791
  zones: yield processZones()
9774
9792
  };
9775
- Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(this, null, function* () {
9793
+ Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
9776
9794
  const content = defaultedData.zones[zoneKey];
9777
9795
  dynamic.zones[zoneKey] = yield processContent(content);
9778
9796
  }), {});
@@ -9815,269 +9833,38 @@ classnames/index.js:
9815
9833
  *)
9816
9834
 
9817
9835
  lucide-react/dist/esm/shared/src/utils.js:
9818
- (**
9819
- * @license lucide-react v0.468.0 - ISC
9820
- *
9821
- * This source code is licensed under the ISC license.
9822
- * See the LICENSE file in the root directory of this source tree.
9823
- *)
9824
-
9825
9836
  lucide-react/dist/esm/defaultAttributes.js:
9826
- (**
9827
- * @license lucide-react v0.468.0 - ISC
9828
- *
9829
- * This source code is licensed under the ISC license.
9830
- * See the LICENSE file in the root directory of this source tree.
9831
- *)
9832
-
9833
9837
  lucide-react/dist/esm/Icon.js:
9834
- (**
9835
- * @license lucide-react v0.468.0 - ISC
9836
- *
9837
- * This source code is licensed under the ISC license.
9838
- * See the LICENSE file in the root directory of this source tree.
9839
- *)
9840
-
9841
9838
  lucide-react/dist/esm/createLucideIcon.js:
9842
- (**
9843
- * @license lucide-react v0.468.0 - ISC
9844
- *
9845
- * This source code is licensed under the ISC license.
9846
- * See the LICENSE file in the root directory of this source tree.
9847
- *)
9848
-
9849
9839
  lucide-react/dist/esm/icons/chevron-down.js:
9850
- (**
9851
- * @license lucide-react v0.468.0 - ISC
9852
- *
9853
- * This source code is licensed under the ISC license.
9854
- * See the LICENSE file in the root directory of this source tree.
9855
- *)
9856
-
9857
9840
  lucide-react/dist/esm/icons/chevron-right.js:
9858
- (**
9859
- * @license lucide-react v0.468.0 - ISC
9860
- *
9861
- * This source code is licensed under the ISC license.
9862
- * See the LICENSE file in the root directory of this source tree.
9863
- *)
9864
-
9865
9841
  lucide-react/dist/esm/icons/chevron-up.js:
9866
- (**
9867
- * @license lucide-react v0.468.0 - ISC
9868
- *
9869
- * This source code is licensed under the ISC license.
9870
- * See the LICENSE file in the root directory of this source tree.
9871
- *)
9872
-
9873
9842
  lucide-react/dist/esm/icons/circle-check-big.js:
9874
- (**
9875
- * @license lucide-react v0.468.0 - ISC
9876
- *
9877
- * This source code is licensed under the ISC license.
9878
- * See the LICENSE file in the root directory of this source tree.
9879
- *)
9880
-
9881
9843
  lucide-react/dist/esm/icons/copy.js:
9882
- (**
9883
- * @license lucide-react v0.468.0 - ISC
9884
- *
9885
- * This source code is licensed under the ISC license.
9886
- * See the LICENSE file in the root directory of this source tree.
9887
- *)
9888
-
9889
9844
  lucide-react/dist/esm/icons/corner-left-up.js:
9890
- (**
9891
- * @license lucide-react v0.468.0 - ISC
9892
- *
9893
- * This source code is licensed under the ISC license.
9894
- * See the LICENSE file in the root directory of this source tree.
9895
- *)
9896
-
9897
9845
  lucide-react/dist/esm/icons/ellipsis-vertical.js:
9898
- (**
9899
- * @license lucide-react v0.468.0 - ISC
9900
- *
9901
- * This source code is licensed under the ISC license.
9902
- * See the LICENSE file in the root directory of this source tree.
9903
- *)
9904
-
9905
9846
  lucide-react/dist/esm/icons/globe.js:
9906
- (**
9907
- * @license lucide-react v0.468.0 - ISC
9908
- *
9909
- * This source code is licensed under the ISC license.
9910
- * See the LICENSE file in the root directory of this source tree.
9911
- *)
9912
-
9913
9847
  lucide-react/dist/esm/icons/hash.js:
9914
- (**
9915
- * @license lucide-react v0.468.0 - ISC
9916
- *
9917
- * This source code is licensed under the ISC license.
9918
- * See the LICENSE file in the root directory of this source tree.
9919
- *)
9920
-
9921
9848
  lucide-react/dist/esm/icons/layers.js:
9922
- (**
9923
- * @license lucide-react v0.468.0 - ISC
9924
- *
9925
- * This source code is licensed under the ISC license.
9926
- * See the LICENSE file in the root directory of this source tree.
9927
- *)
9928
-
9929
9849
  lucide-react/dist/esm/icons/layout-grid.js:
9930
- (**
9931
- * @license lucide-react v0.468.0 - ISC
9932
- *
9933
- * This source code is licensed under the ISC license.
9934
- * See the LICENSE file in the root directory of this source tree.
9935
- *)
9936
-
9937
9850
  lucide-react/dist/esm/icons/link.js:
9938
- (**
9939
- * @license lucide-react v0.468.0 - ISC
9940
- *
9941
- * This source code is licensed under the ISC license.
9942
- * See the LICENSE file in the root directory of this source tree.
9943
- *)
9944
-
9945
9851
  lucide-react/dist/esm/icons/list.js:
9946
- (**
9947
- * @license lucide-react v0.468.0 - ISC
9948
- *
9949
- * This source code is licensed under the ISC license.
9950
- * See the LICENSE file in the root directory of this source tree.
9951
- *)
9952
-
9953
9852
  lucide-react/dist/esm/icons/lock-open.js:
9954
- (**
9955
- * @license lucide-react v0.468.0 - ISC
9956
- *
9957
- * This source code is licensed under the ISC license.
9958
- * See the LICENSE file in the root directory of this source tree.
9959
- *)
9960
-
9961
9853
  lucide-react/dist/esm/icons/lock.js:
9962
- (**
9963
- * @license lucide-react v0.468.0 - ISC
9964
- *
9965
- * This source code is licensed under the ISC license.
9966
- * See the LICENSE file in the root directory of this source tree.
9967
- *)
9968
-
9969
9854
  lucide-react/dist/esm/icons/monitor.js:
9970
- (**
9971
- * @license lucide-react v0.468.0 - ISC
9972
- *
9973
- * This source code is licensed under the ISC license.
9974
- * See the LICENSE file in the root directory of this source tree.
9975
- *)
9976
-
9977
9855
  lucide-react/dist/esm/icons/panel-left.js:
9978
- (**
9979
- * @license lucide-react v0.468.0 - ISC
9980
- *
9981
- * This source code is licensed under the ISC license.
9982
- * See the LICENSE file in the root directory of this source tree.
9983
- *)
9984
-
9985
9856
  lucide-react/dist/esm/icons/panel-right.js:
9986
- (**
9987
- * @license lucide-react v0.468.0 - ISC
9988
- *
9989
- * This source code is licensed under the ISC license.
9990
- * See the LICENSE file in the root directory of this source tree.
9991
- *)
9992
-
9993
9857
  lucide-react/dist/esm/icons/plus.js:
9994
- (**
9995
- * @license lucide-react v0.468.0 - ISC
9996
- *
9997
- * This source code is licensed under the ISC license.
9998
- * See the LICENSE file in the root directory of this source tree.
9999
- *)
10000
-
10001
9858
  lucide-react/dist/esm/icons/redo-2.js:
10002
- (**
10003
- * @license lucide-react v0.468.0 - ISC
10004
- *
10005
- * This source code is licensed under the ISC license.
10006
- * See the LICENSE file in the root directory of this source tree.
10007
- *)
10008
-
10009
9859
  lucide-react/dist/esm/icons/search.js:
10010
- (**
10011
- * @license lucide-react v0.468.0 - ISC
10012
- *
10013
- * This source code is licensed under the ISC license.
10014
- * See the LICENSE file in the root directory of this source tree.
10015
- *)
10016
-
10017
9860
  lucide-react/dist/esm/icons/sliders-horizontal.js:
10018
- (**
10019
- * @license lucide-react v0.468.0 - ISC
10020
- *
10021
- * This source code is licensed under the ISC license.
10022
- * See the LICENSE file in the root directory of this source tree.
10023
- *)
10024
-
10025
9861
  lucide-react/dist/esm/icons/smartphone.js:
10026
- (**
10027
- * @license lucide-react v0.468.0 - ISC
10028
- *
10029
- * This source code is licensed under the ISC license.
10030
- * See the LICENSE file in the root directory of this source tree.
10031
- *)
10032
-
10033
9862
  lucide-react/dist/esm/icons/tablet.js:
10034
- (**
10035
- * @license lucide-react v0.468.0 - ISC
10036
- *
10037
- * This source code is licensed under the ISC license.
10038
- * See the LICENSE file in the root directory of this source tree.
10039
- *)
10040
-
10041
9863
  lucide-react/dist/esm/icons/trash.js:
10042
- (**
10043
- * @license lucide-react v0.468.0 - ISC
10044
- *
10045
- * This source code is licensed under the ISC license.
10046
- * See the LICENSE file in the root directory of this source tree.
10047
- *)
10048
-
10049
9864
  lucide-react/dist/esm/icons/type.js:
10050
- (**
10051
- * @license lucide-react v0.468.0 - ISC
10052
- *
10053
- * This source code is licensed under the ISC license.
10054
- * See the LICENSE file in the root directory of this source tree.
10055
- *)
10056
-
10057
9865
  lucide-react/dist/esm/icons/undo-2.js:
10058
- (**
10059
- * @license lucide-react v0.468.0 - ISC
10060
- *
10061
- * This source code is licensed under the ISC license.
10062
- * See the LICENSE file in the root directory of this source tree.
10063
- *)
10064
-
10065
9866
  lucide-react/dist/esm/icons/zoom-in.js:
10066
- (**
10067
- * @license lucide-react v0.468.0 - ISC
10068
- *
10069
- * This source code is licensed under the ISC license.
10070
- * See the LICENSE file in the root directory of this source tree.
10071
- *)
10072
-
10073
9867
  lucide-react/dist/esm/icons/zoom-out.js:
10074
- (**
10075
- * @license lucide-react v0.468.0 - ISC
10076
- *
10077
- * This source code is licensed under the ISC license.
10078
- * See the LICENSE file in the root directory of this source tree.
10079
- *)
10080
-
10081
9868
  lucide-react/dist/esm/lucide-react.js:
10082
9869
  (**
10083
9870
  * @license lucide-react v0.468.0 - ISC