@measured/puck-plugin-heading-analyzer 0.18.3-canary.9e8e47b → 0.19.0-canary.0a3e56e

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
@@ -61,6 +61,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
61
61
  mod
62
62
  ));
63
63
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
64
+ var __async = (__this, __arguments, generator) => {
65
+ return new Promise((resolve, reject) => {
66
+ var fulfilled = (value) => {
67
+ try {
68
+ step(generator.next(value));
69
+ } catch (e) {
70
+ reject(e);
71
+ }
72
+ };
73
+ var rejected = (value) => {
74
+ try {
75
+ step(generator.throw(value));
76
+ } catch (e) {
77
+ reject(e);
78
+ }
79
+ };
80
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
81
+ step((generator = generator.apply(__this, __arguments)).next());
82
+ });
83
+ };
64
84
 
65
85
  // ../tsup-config/react-import.js
66
86
  var import_react;
@@ -133,6 +153,42 @@ var require_classnames = __commonJS({
133
153
  }
134
154
  });
135
155
 
156
+ // ../../node_modules/fast-deep-equal/index.js
157
+ var require_fast_deep_equal = __commonJS({
158
+ "../../node_modules/fast-deep-equal/index.js"(exports2, module2) {
159
+ "use strict";
160
+ init_react_import();
161
+ module2.exports = function equal(a, b) {
162
+ if (a === b) return true;
163
+ if (a && b && typeof a == "object" && typeof b == "object") {
164
+ if (a.constructor !== b.constructor) return false;
165
+ var length, i, keys;
166
+ if (Array.isArray(a)) {
167
+ length = a.length;
168
+ if (length != b.length) return false;
169
+ for (i = length; i-- !== 0; )
170
+ if (!equal(a[i], b[i])) return false;
171
+ return true;
172
+ }
173
+ if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
174
+ if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
175
+ if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
176
+ keys = Object.keys(a);
177
+ length = keys.length;
178
+ if (length !== Object.keys(b).length) return false;
179
+ for (i = length; i-- !== 0; )
180
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
181
+ for (i = length; i-- !== 0; ) {
182
+ var key = keys[i];
183
+ if (!equal(a[key], b[key])) return false;
184
+ }
185
+ return true;
186
+ }
187
+ return a !== a && b !== b;
188
+ };
189
+ }
190
+ });
191
+
136
192
  // index.ts
137
193
  var plugin_heading_analyzer_exports = {};
138
194
  __export(plugin_heading_analyzer_exports, {
@@ -143,7 +199,7 @@ init_react_import();
143
199
 
144
200
  // src/HeadingAnalyzer.tsx
145
201
  init_react_import();
146
- var import_react9 = require("react");
202
+ var import_react12 = require("react");
147
203
 
148
204
  // css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
149
205
  init_react_import();
@@ -304,131 +360,519 @@ var ChevronRight = createLucideIcon("ChevronRight", [
304
360
 
305
361
  // ../core/lib/use-breadcrumbs.ts
306
362
  init_react_import();
307
- var import_react8 = require("react");
363
+ var import_react11 = require("react");
308
364
 
309
- // ../core/components/DropZone/context.tsx
365
+ // ../core/store/index.ts
310
366
  init_react_import();
311
- var import_react7 = require("react");
312
367
 
313
- // ../core/components/Puck/context.tsx
368
+ // ../core/reducer/index.ts
314
369
  init_react_import();
315
- var import_react6 = require("react");
316
370
 
317
- // ../core/lib/get-item.ts
371
+ // ../core/reducer/data.ts
372
+ init_react_import();
373
+
374
+ // ../core/lib/reorder.ts
318
375
  init_react_import();
376
+ var reorder = (list, startIndex, endIndex) => {
377
+ const result = Array.from(list);
378
+ const [removed] = result.splice(startIndex, 1);
379
+ result.splice(endIndex, 0, removed);
380
+ return result;
381
+ };
319
382
 
320
383
  // ../core/lib/root-droppable-id.ts
321
384
  init_react_import();
322
- var rootDroppableId = "default-zone";
385
+ var rootAreaId = "root";
386
+ var rootZone = "default-zone";
387
+ var rootDroppableId = `${rootAreaId}:${rootZone}`;
388
+
389
+ // ../core/lib/insert.ts
390
+ init_react_import();
391
+ var insert = (list, index, item) => {
392
+ const result = Array.from(list);
393
+ result.splice(index, 0, item);
394
+ return result;
395
+ };
396
+
397
+ // ../core/lib/remove.ts
398
+ init_react_import();
399
+ var remove = (list, index) => {
400
+ const result = Array.from(list);
401
+ result.splice(index, 1);
402
+ return result;
403
+ };
323
404
 
324
405
  // ../core/lib/setup-zone.ts
325
406
  init_react_import();
407
+ var setupZone = (data, zoneKey) => {
408
+ if (zoneKey === rootDroppableId) {
409
+ return data;
410
+ }
411
+ const newData = __spreadProps(__spreadValues({}, data), {
412
+ zones: data.zones ? __spreadValues({}, data.zones) : {}
413
+ });
414
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
415
+ return newData;
416
+ };
326
417
 
327
- // ../core/components/ViewportControls/default-viewports.ts
418
+ // ../core/lib/replace.ts
328
419
  init_react_import();
329
- var defaultViewports = [
330
- { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
331
- { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
332
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
333
- ];
420
+ var replace = (list, index, newItem) => {
421
+ const result = Array.from(list);
422
+ result.splice(index, 1);
423
+ result.splice(index, 0, newItem);
424
+ return result;
425
+ };
334
426
 
335
- // ../core/lib/use-resolved-permissions.ts
427
+ // ../core/lib/get-item.ts
336
428
  init_react_import();
337
- var import_react4 = require("react");
429
+ function getItem(selector, data, dynamicProps = {}) {
430
+ if (!selector.zone || selector.zone === rootDroppableId) {
431
+ const item2 = data.content[selector.index];
432
+ return (item2 == null ? void 0 : item2.props) ? __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props }) : void 0;
433
+ }
434
+ const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
435
+ return (item == null ? void 0 : item.props) ? __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props }) : void 0;
436
+ }
338
437
 
339
- // ../core/lib/flatten-data.ts
438
+ // ../core/lib/reduce-related-zones.ts
340
439
  init_react_import();
341
440
 
342
- // ../core/lib/get-changed.ts
441
+ // ../core/lib/generate-id.ts
343
442
  init_react_import();
344
443
 
345
- // ../core/lib/use-resolved-data.ts
444
+ // ../../node_modules/uuid/dist/esm-node/index.js
346
445
  init_react_import();
347
- var import_react5 = require("react");
348
446
 
349
- // ../core/lib/resolve-component-data.ts
447
+ // ../../node_modules/uuid/dist/esm-node/rng.js
350
448
  init_react_import();
449
+ var import_crypto = __toESM(require("crypto"));
450
+ var rnds8Pool = new Uint8Array(256);
451
+ var poolPtr = rnds8Pool.length;
452
+ function rng() {
453
+ if (poolPtr > rnds8Pool.length - 16) {
454
+ import_crypto.default.randomFillSync(rnds8Pool);
455
+ poolPtr = 0;
456
+ }
457
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
458
+ }
351
459
 
352
- // ../core/lib/apply-dynamic-props.ts
460
+ // ../../node_modules/uuid/dist/esm-node/stringify.js
353
461
  init_react_import();
462
+ var byteToHex = [];
463
+ for (let i = 0; i < 256; ++i) {
464
+ byteToHex.push((i + 256).toString(16).slice(1));
465
+ }
466
+ function unsafeStringify(arr, offset = 0) {
467
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
468
+ }
354
469
 
355
- // ../core/lib/resolve-root-data.ts
470
+ // ../../node_modules/uuid/dist/esm-node/v4.js
356
471
  init_react_import();
357
472
 
358
- // ../core/components/Puck/context.tsx
359
- var import_jsx_runtime2 = require("react/jsx-runtime");
360
- var defaultAppState = {
361
- data: { content: [], root: {} },
362
- ui: {
363
- leftSideBarVisible: true,
364
- rightSideBarVisible: true,
365
- arrayState: {},
366
- itemSelector: null,
367
- componentList: {},
368
- isDragging: false,
369
- previewMode: "edit",
370
- viewports: {
371
- current: {
372
- width: defaultViewports[0].width,
373
- height: defaultViewports[0].height || "auto"
473
+ // ../../node_modules/uuid/dist/esm-node/native.js
474
+ init_react_import();
475
+ var import_crypto2 = __toESM(require("crypto"));
476
+ var native_default = {
477
+ randomUUID: import_crypto2.default.randomUUID
478
+ };
479
+
480
+ // ../../node_modules/uuid/dist/esm-node/v4.js
481
+ function v4(options, buf, offset) {
482
+ if (native_default.randomUUID && !buf && !options) {
483
+ return native_default.randomUUID();
484
+ }
485
+ options = options || {};
486
+ const rnds = options.random || (options.rng || rng)();
487
+ rnds[6] = rnds[6] & 15 | 64;
488
+ rnds[8] = rnds[8] & 63 | 128;
489
+ if (buf) {
490
+ offset = offset || 0;
491
+ for (let i = 0; i < 16; ++i) {
492
+ buf[offset + i] = rnds[i];
493
+ }
494
+ return buf;
495
+ }
496
+ return unsafeStringify(rnds);
497
+ }
498
+ var v4_default = v4;
499
+
500
+ // ../core/lib/generate-id.ts
501
+ var generateId = (type) => type ? `${type}-${v4_default()}` : v4_default();
502
+
503
+ // ../core/lib/get-zone-id.ts
504
+ init_react_import();
505
+ var getZoneId = (zoneCompound) => {
506
+ if (!zoneCompound) {
507
+ return [];
508
+ }
509
+ if (zoneCompound && zoneCompound.indexOf(":") > -1) {
510
+ return zoneCompound.split(":");
511
+ }
512
+ return [rootDroppableId, zoneCompound];
513
+ };
514
+
515
+ // ../core/lib/reduce-related-zones.ts
516
+ function reduceRelatedZones(item, data, fn) {
517
+ return __spreadProps(__spreadValues({}, data), {
518
+ zones: Object.keys(data.zones || {}).reduce(
519
+ (acc, key) => {
520
+ const [parentId] = getZoneId(key);
521
+ if (parentId === item.props.id) {
522
+ const zones = data.zones;
523
+ return fn(acc, key, zones[key]);
524
+ }
525
+ return __spreadProps(__spreadValues({}, acc), { [key]: data.zones[key] });
374
526
  },
375
- options: [],
376
- controlsVisible: true
527
+ {}
528
+ )
529
+ });
530
+ }
531
+ var findRelatedByZoneId = (zoneId, data) => {
532
+ const [zoneParentId] = getZoneId(zoneId);
533
+ return (data.zones[zoneId] || []).reduce(
534
+ (acc, zoneItem) => {
535
+ const related = findRelatedByItem(zoneItem, data);
536
+ if (zoneItem.props.id === zoneParentId) {
537
+ return __spreadProps(__spreadValues(__spreadValues({}, acc), related), { [zoneId]: zoneItem });
538
+ }
539
+ return __spreadValues(__spreadValues({}, acc), related);
377
540
  },
378
- field: { focus: null }
541
+ {}
542
+ );
543
+ };
544
+ var findRelatedByItem = (item, data) => {
545
+ return Object.keys(data.zones || {}).reduce(
546
+ (acc, zoneId) => {
547
+ const [zoneParentId] = getZoneId(zoneId);
548
+ if (item.props.id === zoneParentId) {
549
+ const related = findRelatedByZoneId(zoneId, data);
550
+ return __spreadProps(__spreadValues(__spreadValues({}, acc), related), {
551
+ [zoneId]: data.zones[zoneId]
552
+ });
553
+ }
554
+ return acc;
555
+ },
556
+ {}
557
+ );
558
+ };
559
+ var removeRelatedZones = (item, data) => {
560
+ const newData = __spreadValues({}, data);
561
+ const related = findRelatedByItem(item, data);
562
+ Object.keys(related).forEach((key) => {
563
+ delete newData.zones[key];
564
+ });
565
+ return newData;
566
+ };
567
+ function duplicateRelatedZones(item, data, newId) {
568
+ return reduceRelatedZones(item, data, (acc, key, zone) => {
569
+ const dupedZone = zone.map((zoneItem) => __spreadProps(__spreadValues({}, zoneItem), {
570
+ props: __spreadProps(__spreadValues({}, zoneItem.props), { id: generateId(zoneItem.type) })
571
+ }));
572
+ const dupeOfDupes = dupedZone.reduce(
573
+ (dupeOfDupes2, item2, index) => __spreadValues(__spreadValues({}, dupeOfDupes2), duplicateRelatedZones(zone[index], data, item2.props.id).zones),
574
+ acc
575
+ );
576
+ const [_, zoneId] = getZoneId(key);
577
+ return __spreadProps(__spreadValues({}, dupeOfDupes), {
578
+ [key]: zone,
579
+ [`${newId}:${zoneId}`]: dupedZone
580
+ });
581
+ });
582
+ }
583
+
584
+ // ../core/reducer/data.ts
585
+ var zoneCache = {};
586
+ var replaceAction = (data, action) => {
587
+ if (action.destinationZone === rootDroppableId) {
588
+ return __spreadProps(__spreadValues({}, data), {
589
+ content: replace(data.content, action.destinationIndex, action.data)
590
+ });
379
591
  }
592
+ const newData = setupZone(data, action.destinationZone);
593
+ return __spreadProps(__spreadValues({}, newData), {
594
+ zones: __spreadProps(__spreadValues({}, newData.zones), {
595
+ [action.destinationZone]: replace(
596
+ newData.zones[action.destinationZone],
597
+ action.destinationIndex,
598
+ action.data
599
+ )
600
+ })
601
+ });
380
602
  };
381
- var defaultContext = {
382
- state: defaultAppState,
383
- dispatch: () => null,
384
- config: { components: {} },
385
- componentState: {},
386
- setComponentState: () => {
387
- },
388
- resolveData: () => {
389
- },
390
- plugins: [],
391
- overrides: {},
392
- history: {},
393
- viewports: defaultViewports,
394
- zoomConfig: {
395
- autoZoom: 1,
396
- rootHeight: 0,
397
- zoom: 1
398
- },
399
- setZoomConfig: () => null,
400
- status: "LOADING",
401
- setStatus: () => null,
402
- iframe: {},
403
- globalPermissions: {},
404
- getPermissions: () => ({}),
405
- refreshPermissions: () => null
406
- };
407
- var appContext = (0, import_react6.createContext)(defaultContext);
408
- function useAppContext() {
409
- const mainContext = (0, import_react6.useContext)(appContext);
410
- return __spreadProps(__spreadValues({}, mainContext), {
411
- // Helpers
412
- setUi: (ui, recordHistory) => {
413
- return mainContext.dispatch({
414
- type: "setUi",
415
- ui,
416
- recordHistory
603
+ function insertAction(data, action, config) {
604
+ const emptyComponentData = {
605
+ type: action.componentType,
606
+ props: __spreadProps(__spreadValues({}, config.components[action.componentType].defaultProps || {}), {
607
+ id: action.id || generateId(action.componentType)
608
+ })
609
+ };
610
+ if (action.destinationZone === rootDroppableId) {
611
+ return __spreadProps(__spreadValues({}, data), {
612
+ content: insert(
613
+ data.content,
614
+ action.destinationIndex,
615
+ emptyComponentData
616
+ )
617
+ });
618
+ }
619
+ const newData = setupZone(data, action.destinationZone);
620
+ return __spreadProps(__spreadValues({}, data), {
621
+ zones: __spreadProps(__spreadValues({}, newData.zones), {
622
+ [action.destinationZone]: insert(
623
+ newData.zones[action.destinationZone],
624
+ action.destinationIndex,
625
+ emptyComponentData
626
+ )
627
+ })
628
+ });
629
+ }
630
+ var reorderAction = (data, action) => {
631
+ if (action.destinationZone === rootDroppableId) {
632
+ return __spreadProps(__spreadValues({}, data), {
633
+ content: reorder(
634
+ data.content,
635
+ action.sourceIndex,
636
+ action.destinationIndex
637
+ )
638
+ });
639
+ }
640
+ const newData = setupZone(data, action.destinationZone);
641
+ return __spreadProps(__spreadValues({}, data), {
642
+ zones: __spreadProps(__spreadValues({}, newData.zones), {
643
+ [action.destinationZone]: reorder(
644
+ newData.zones[action.destinationZone],
645
+ action.sourceIndex,
646
+ action.destinationIndex
647
+ )
648
+ })
649
+ });
650
+ };
651
+ function reduceData(data, action, config) {
652
+ if (action.type === "insert") {
653
+ return insertAction(data, action, config);
654
+ }
655
+ if (action.type === "duplicate") {
656
+ const item = getItem(
657
+ { index: action.sourceIndex, zone: action.sourceZone },
658
+ data
659
+ );
660
+ const newItem = __spreadProps(__spreadValues({}, item), {
661
+ props: __spreadProps(__spreadValues({}, item.props), {
662
+ id: generateId(item.type)
663
+ })
664
+ });
665
+ const dataWithRelatedDuplicated = duplicateRelatedZones(
666
+ item,
667
+ data,
668
+ newItem.props.id
669
+ );
670
+ if (action.sourceZone === rootDroppableId) {
671
+ return __spreadProps(__spreadValues({}, dataWithRelatedDuplicated), {
672
+ content: insert(data.content, action.sourceIndex + 1, newItem)
417
673
  });
418
674
  }
419
- });
675
+ return __spreadProps(__spreadValues({}, dataWithRelatedDuplicated), {
676
+ zones: __spreadProps(__spreadValues({}, dataWithRelatedDuplicated.zones), {
677
+ [action.sourceZone]: insert(
678
+ dataWithRelatedDuplicated.zones[action.sourceZone],
679
+ action.sourceIndex + 1,
680
+ newItem
681
+ )
682
+ })
683
+ });
684
+ }
685
+ if (action.type === "reorder") {
686
+ return reorderAction(data, action);
687
+ }
688
+ if (action.type === "move") {
689
+ if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
690
+ return data;
691
+ }
692
+ const newData = setupZone(
693
+ setupZone(data, action.sourceZone),
694
+ action.destinationZone
695
+ );
696
+ const item = getItem(
697
+ { zone: action.sourceZone, index: action.sourceIndex },
698
+ newData
699
+ );
700
+ if (action.sourceZone === action.destinationZone) {
701
+ return reorderAction(data, __spreadProps(__spreadValues({}, action), { type: "reorder" }));
702
+ }
703
+ if (action.sourceZone === rootDroppableId) {
704
+ return __spreadProps(__spreadValues({}, newData), {
705
+ content: remove(newData.content, action.sourceIndex),
706
+ zones: __spreadProps(__spreadValues({}, newData.zones), {
707
+ [action.destinationZone]: insert(
708
+ newData.zones[action.destinationZone],
709
+ action.destinationIndex,
710
+ item
711
+ )
712
+ })
713
+ });
714
+ }
715
+ if (action.destinationZone === rootDroppableId) {
716
+ return __spreadProps(__spreadValues({}, newData), {
717
+ content: insert(newData.content, action.destinationIndex, item),
718
+ zones: __spreadProps(__spreadValues({}, newData.zones), {
719
+ [action.sourceZone]: remove(
720
+ newData.zones[action.sourceZone],
721
+ action.sourceIndex
722
+ )
723
+ })
724
+ });
725
+ }
726
+ return __spreadProps(__spreadValues({}, newData), {
727
+ zones: __spreadProps(__spreadValues({}, newData.zones), {
728
+ [action.sourceZone]: remove(
729
+ newData.zones[action.sourceZone],
730
+ action.sourceIndex
731
+ ),
732
+ [action.destinationZone]: insert(
733
+ newData.zones[action.destinationZone],
734
+ action.destinationIndex,
735
+ item
736
+ )
737
+ })
738
+ });
739
+ }
740
+ if (action.type === "replace") {
741
+ return replaceAction(data, action);
742
+ }
743
+ if (action.type === "remove") {
744
+ const item = getItem({ index: action.index, zone: action.zone }, data);
745
+ const dataWithRelatedRemoved = setupZone(
746
+ removeRelatedZones(item, data),
747
+ action.zone
748
+ );
749
+ if (action.zone === rootDroppableId) {
750
+ return __spreadProps(__spreadValues({}, dataWithRelatedRemoved), {
751
+ content: remove(data.content, action.index)
752
+ });
753
+ }
754
+ return __spreadProps(__spreadValues({}, dataWithRelatedRemoved), {
755
+ zones: __spreadProps(__spreadValues({}, dataWithRelatedRemoved.zones), {
756
+ [action.zone]: remove(
757
+ dataWithRelatedRemoved.zones[action.zone],
758
+ action.index
759
+ )
760
+ })
761
+ });
762
+ }
763
+ if (action.type === "registerZone") {
764
+ if (zoneCache[action.zone]) {
765
+ return __spreadProps(__spreadValues({}, data), {
766
+ zones: __spreadProps(__spreadValues({}, data.zones), {
767
+ [action.zone]: zoneCache[action.zone]
768
+ })
769
+ });
770
+ }
771
+ return setupZone(data, action.zone);
772
+ }
773
+ if (action.type === "unregisterZone") {
774
+ const _zones = __spreadValues({}, data.zones || {});
775
+ if (_zones[action.zone]) {
776
+ zoneCache[action.zone] = _zones[action.zone];
777
+ delete _zones[action.zone];
778
+ }
779
+ return __spreadProps(__spreadValues({}, data), { zones: _zones });
780
+ }
781
+ if (action.type === "setData") {
782
+ if (typeof action.data === "object") {
783
+ return __spreadValues(__spreadValues({}, data), action.data);
784
+ }
785
+ return __spreadValues(__spreadValues({}, data), action.data(data));
786
+ }
787
+ return data;
420
788
  }
421
789
 
790
+ // ../core/reducer/state.ts
791
+ init_react_import();
792
+ var reduceUi = (ui, action) => {
793
+ if (action.type === "setUi") {
794
+ if (typeof action.ui === "object") {
795
+ return __spreadValues(__spreadValues({}, ui), action.ui);
796
+ }
797
+ return __spreadValues(__spreadValues({}, ui), action.ui(ui));
798
+ }
799
+ if (action.type === "duplicate") {
800
+ return __spreadProps(__spreadValues({}, ui), {
801
+ itemSelector: { index: action.sourceIndex + 1, zone: action.sourceZone }
802
+ });
803
+ }
804
+ if (action.type === "remove") {
805
+ return __spreadProps(__spreadValues({}, ui), {
806
+ itemSelector: null
807
+ });
808
+ }
809
+ return ui;
810
+ };
811
+
812
+ // ../core/reducer/actions.tsx
813
+ init_react_import();
814
+
815
+ // ../core/reducer/index.ts
816
+ function storeInterceptor(reducer, record, onAction) {
817
+ return (state, action) => {
818
+ const newAppState = reducer(state, action);
819
+ const isValidType = ![
820
+ "registerZone",
821
+ "unregisterZone",
822
+ "setData",
823
+ "setUi",
824
+ "set"
825
+ ].includes(action.type);
826
+ if (typeof action.recordHistory !== "undefined" ? action.recordHistory : isValidType) {
827
+ if (record) record(newAppState);
828
+ }
829
+ onAction == null ? void 0 : onAction(action, newAppState, state);
830
+ return newAppState;
831
+ };
832
+ }
833
+ var setAction = (state, action) => {
834
+ if (typeof action.state === "object") {
835
+ return __spreadValues(__spreadValues({}, state), action.state);
836
+ }
837
+ return __spreadValues(__spreadValues({}, state), action.state(state));
838
+ };
839
+ function createReducer({
840
+ config,
841
+ record,
842
+ onAction
843
+ }) {
844
+ return storeInterceptor(
845
+ (state, action) => {
846
+ const data = reduceData(state.data, action, config);
847
+ const ui = reduceUi(state.ui, action);
848
+ if (action.type === "set") {
849
+ return setAction(state, action);
850
+ }
851
+ return { data, ui };
852
+ },
853
+ record,
854
+ onAction
855
+ );
856
+ }
857
+
858
+ // ../core/components/ViewportControls/default-viewports.ts
859
+ init_react_import();
860
+ var defaultViewports = [
861
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
862
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
863
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
864
+ ];
865
+
422
866
  // ../../node_modules/zustand/esm/vanilla.mjs
423
867
  init_react_import();
424
868
  var createStoreImpl = (createState) => {
425
869
  let state;
426
870
  const listeners = /* @__PURE__ */ new Set();
427
- const setState = (partial, replace) => {
871
+ const setState = (partial, replace2) => {
428
872
  const nextState = typeof partial === "function" ? partial(state) : partial;
429
873
  if (!Object.is(nextState, state)) {
430
874
  const previousState = state;
431
- state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
875
+ state = (replace2 != null ? replace2 : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
432
876
  listeners.forEach((listener) => listener(state, previousState));
433
877
  }
434
878
  };
@@ -444,94 +888,701 @@ var createStoreImpl = (createState) => {
444
888
  };
445
889
  var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
446
890
 
447
- // ../core/components/DropZone/context.tsx
448
- var import_jsx_runtime3 = require("react/jsx-runtime");
449
- var dropZoneContext = (0, import_react7.createContext)(null);
450
- var ZoneStoreContext = (0, import_react7.createContext)(
451
- createStore(() => ({
452
- zoneDepthIndex: {},
453
- nextZoneDepthIndex: {},
454
- areaDepthIndex: {},
455
- nextAreaDepthIndex: {},
456
- draggedItem: null,
457
- previewIndex: {}
458
- }))
459
- );
460
-
461
- // ../core/lib/get-zone-id.ts
891
+ // ../../node_modules/zustand/esm/react.mjs
462
892
  init_react_import();
463
- var getZoneId = (zoneCompound) => {
464
- if (!zoneCompound) {
465
- return [];
466
- }
467
- if (zoneCompound && zoneCompound.indexOf(":") > -1) {
468
- return zoneCompound.split(":");
469
- }
470
- return [rootDroppableId, zoneCompound];
893
+ var import_react4 = __toESM(require("react"), 1);
894
+ var identity = (arg) => arg;
895
+ function useStore(api, selector = identity) {
896
+ const slice = import_react4.default.useSyncExternalStore(
897
+ api.subscribe,
898
+ () => selector(api.getState()),
899
+ () => selector(api.getInitialState())
900
+ );
901
+ import_react4.default.useDebugValue(slice);
902
+ return slice;
903
+ }
904
+ var createImpl = (createState) => {
905
+ const api = createStore(createState);
906
+ const useBoundStore = (selector) => useStore(api, selector);
907
+ Object.assign(useBoundStore, api);
908
+ return useBoundStore;
471
909
  };
910
+ var create = (createState) => createState ? createImpl(createState) : createImpl;
472
911
 
473
- // ../core/lib/use-breadcrumbs.ts
474
- var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
475
- const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
476
- const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
477
- if (!id) {
478
- return [];
479
- }
480
- return currentPathData == null ? void 0 : currentPathData.path.reduce((acc, zoneCompound) => {
481
- const [area] = getZoneId(zoneCompound);
482
- if (area === rootDroppableId) {
483
- return [
484
- {
485
- label: "Page",
486
- selector: null
912
+ // ../../node_modules/zustand/esm/middleware.mjs
913
+ init_react_import();
914
+ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
915
+ const origSubscribe = api.subscribe;
916
+ api.subscribe = (selector, optListener, options) => {
917
+ let listener = selector;
918
+ if (optListener) {
919
+ const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
920
+ let currentSlice = selector(api.getState());
921
+ listener = (state) => {
922
+ const nextSlice = selector(state);
923
+ if (!equalityFn(currentSlice, nextSlice)) {
924
+ const previousSlice = currentSlice;
925
+ optListener(currentSlice = nextSlice, previousSlice);
487
926
  }
488
- ];
927
+ };
928
+ if (options == null ? void 0 : options.fireImmediately) {
929
+ optListener(currentSlice, currentSlice);
930
+ }
931
+ }
932
+ return origSubscribe(listener);
933
+ };
934
+ const initialState = fn(set, get, api);
935
+ return initialState;
936
+ };
937
+ var subscribeWithSelector = subscribeWithSelectorImpl;
938
+
939
+ // ../core/lib/resolve-data.ts
940
+ init_react_import();
941
+
942
+ // ../core/lib/resolve-component-data.ts
943
+ init_react_import();
944
+
945
+ // ../core/lib/get-changed.ts
946
+ init_react_import();
947
+ var getChanged = (newItem, oldItem) => {
948
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
949
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
950
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
951
+ return __spreadProps(__spreadValues({}, acc), {
952
+ [item]: oldItemProps[item] !== newItemProps[item]
953
+ });
954
+ }, {}) : {};
955
+ };
956
+
957
+ // ../core/lib/resolve-component-data.ts
958
+ var cache = { lastChange: {} };
959
+ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd) {
960
+ const configForItem = config.components[item.type];
961
+ if (configForItem.resolveData) {
962
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[item.props.id] || {};
963
+ if (item && item === oldItem) {
964
+ return resolved;
489
965
  }
490
- const parentZoneCompound = acc.length > 0 ? acc[acc.length - 1].zoneCompound : rootDroppableId;
491
- let parentZone = data.content;
492
- if (parentZoneCompound && parentZoneCompound !== rootDroppableId) {
493
- parentZone = data.zones[parentZoneCompound];
966
+ const changed = getChanged(item, oldItem);
967
+ if (onResolveStart) {
968
+ onResolveStart(item);
494
969
  }
495
- if (!parentZone) {
496
- return acc;
970
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
971
+ changed,
972
+ lastData: oldItem,
973
+ metadata
974
+ });
975
+ const resolvedItem = __spreadProps(__spreadValues({}, item), {
976
+ props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
977
+ });
978
+ if (Object.keys(readOnly).length) {
979
+ resolvedItem.readOnly = readOnly;
980
+ }
981
+ cache.lastChange[item.props.id] = {
982
+ item,
983
+ resolved: resolvedItem
984
+ };
985
+ if (onResolveEnd) {
986
+ onResolveEnd(resolvedItem);
987
+ }
988
+ return resolvedItem;
989
+ }
990
+ return item;
991
+ });
992
+
993
+ // ../core/lib/apply-dynamic-props.ts
994
+ init_react_import();
995
+ var applyDynamicProps = (data, dynamicProps, rootData) => {
996
+ return __spreadProps(__spreadValues({}, data), {
997
+ root: rootData ? __spreadValues(__spreadValues({}, data.root), rootData ? rootData : {}) : data.root,
998
+ content: data.content.map((item) => {
999
+ return dynamicProps[item.props.id] ? __spreadValues(__spreadValues({}, item), dynamicProps[item.props.id]) : item;
1000
+ }),
1001
+ zones: Object.keys(data.zones || {}).reduce((acc, zoneKey) => {
1002
+ return __spreadProps(__spreadValues({}, acc), {
1003
+ [zoneKey]: data.zones[zoneKey].map((item) => {
1004
+ return dynamicProps[item.props.id] ? __spreadValues(__spreadValues({}, item), dynamicProps[item.props.id]) : item;
1005
+ })
1006
+ });
1007
+ }, {})
1008
+ });
1009
+ };
1010
+
1011
+ // ../core/lib/resolve-root-data.ts
1012
+ init_react_import();
1013
+ var cache2 = {};
1014
+ function resolveRootData(data, config, metadata) {
1015
+ return __async(this, null, function* () {
1016
+ var _a, _b, _c, _d, _e;
1017
+ if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
1018
+ if (((_b = cache2.lastChange) == null ? void 0 : _b.original) === data.root) {
1019
+ return cache2.lastChange.resolved;
1020
+ }
1021
+ const changed = getChanged(data.root, (_c = cache2.lastChange) == null ? void 0 : _c.original);
1022
+ const rootWithProps = data.root;
1023
+ const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
1024
+ changed,
1025
+ lastData: ((_d = cache2.lastChange) == null ? void 0 : _d.original) || {},
1026
+ metadata: metadata || {}
1027
+ });
1028
+ cache2.lastChange = {
1029
+ original: data.root,
1030
+ resolved: resolvedRoot
1031
+ };
1032
+ return __spreadProps(__spreadValues(__spreadValues({}, data.root), resolvedRoot), {
1033
+ props: __spreadValues(__spreadValues({}, data.root.props), resolvedRoot.props)
1034
+ });
497
1035
  }
498
- const itemIndex = parentZone.findIndex(
499
- (queryItem) => queryItem.props.id === area
1036
+ return data.root;
1037
+ });
1038
+ }
1039
+
1040
+ // ../core/lib/flatten-data.ts
1041
+ init_react_import();
1042
+ var flattenData = (data) => {
1043
+ return Object.keys(data.zones || {}).reduce(
1044
+ (acc, zone) => [...acc, ...data.zones[zone]],
1045
+ data.content
1046
+ );
1047
+ };
1048
+
1049
+ // ../core/lib/resolve-data.ts
1050
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1051
+ var resolveData = (newAppState, appStoreData) => {
1052
+ const {
1053
+ state: appState,
1054
+ config,
1055
+ dispatch,
1056
+ resolveDataRuns,
1057
+ setComponentLoading,
1058
+ unsetComponentLoading,
1059
+ metadata,
1060
+ permissions
1061
+ } = appStoreData;
1062
+ const deferredSetStates = {};
1063
+ const _setComponentLoading = (id, loading, defer = 0) => {
1064
+ if (deferredSetStates[id]) {
1065
+ clearTimeout(deferredSetStates[id]);
1066
+ delete deferredSetStates[id];
1067
+ }
1068
+ deferredSetStates[id] = setTimeout(() => {
1069
+ if (loading) {
1070
+ setComponentLoading(id);
1071
+ } else {
1072
+ unsetComponentLoading(id);
1073
+ }
1074
+ delete deferredSetStates[id];
1075
+ }, defer);
1076
+ };
1077
+ const runResolvers = () => __async(void 0, null, function* () {
1078
+ const newData = newAppState.data;
1079
+ const flatContent = flattenData(newData).filter(
1080
+ (item) => {
1081
+ var _a;
1082
+ return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
1083
+ }
500
1084
  );
501
- const item = parentZone[itemIndex];
502
- if (!item) {
503
- return acc;
1085
+ const applyIfChange = (dynamicDataMap, dynamicRoot) => {
1086
+ const processed = applyDynamicProps(
1087
+ __spreadValues({}, appState.data),
1088
+ dynamicDataMap,
1089
+ dynamicRoot
1090
+ );
1091
+ const processedAppState = __spreadProps(__spreadValues({}, appState), { data: processed });
1092
+ const containsChanges = !(0, import_fast_deep_equal.default)(appState, processedAppState);
1093
+ if (containsChanges) {
1094
+ dispatch({
1095
+ type: "set",
1096
+ state: (prev) => __spreadProps(__spreadValues({}, prev), {
1097
+ data: applyDynamicProps(prev.data, dynamicDataMap, dynamicRoot),
1098
+ ui: resolveDataRuns > 0 ? __spreadValues(__spreadValues({}, prev.ui), newAppState.ui) : prev.ui
1099
+ }),
1100
+ recordHistory: resolveDataRuns > 0
1101
+ });
1102
+ }
1103
+ };
1104
+ const promises = [];
1105
+ promises.push(
1106
+ (() => __async(void 0, null, function* () {
1107
+ _setComponentLoading("puck-root", true, 50);
1108
+ const dynamicRoot = yield resolveRootData(newData, config, metadata);
1109
+ applyIfChange({}, dynamicRoot);
1110
+ _setComponentLoading("puck-root", false);
1111
+ }))()
1112
+ );
1113
+ flatContent.forEach((item) => {
1114
+ promises.push(
1115
+ (() => __async(void 0, null, function* () {
1116
+ permissions.resolvePermissions({ item }, true);
1117
+ const dynamicData = yield resolveComponentData(
1118
+ item,
1119
+ config,
1120
+ metadata,
1121
+ (item2) => {
1122
+ _setComponentLoading(item2.props.id, true, 50);
1123
+ },
1124
+ (item2) => {
1125
+ deferredSetStates[item2.props.id];
1126
+ _setComponentLoading(item2.props.id, false);
1127
+ }
1128
+ );
1129
+ const dynamicDataMap = { [item.props.id]: dynamicData };
1130
+ applyIfChange(dynamicDataMap);
1131
+ }))()
1132
+ );
1133
+ });
1134
+ yield Promise.all(promises);
1135
+ });
1136
+ return runResolvers();
1137
+ };
1138
+
1139
+ // ../core/store/index.ts
1140
+ var import_react10 = require("react");
1141
+
1142
+ // ../core/store/slices/history.ts
1143
+ init_react_import();
1144
+ var import_react6 = require("react");
1145
+
1146
+ // ../core/lib/use-hotkey.ts
1147
+ init_react_import();
1148
+ var import_react5 = require("react");
1149
+ var useHotkeyStore = create()(
1150
+ subscribeWithSelector((set) => ({
1151
+ held: {},
1152
+ hold: (key) => set((s) => s.held[key] ? s : { held: __spreadProps(__spreadValues({}, s.held), { [key]: true }) }),
1153
+ release: (key) => set((s) => s.held[key] ? { held: __spreadProps(__spreadValues({}, s.held), { [key]: false }) } : s),
1154
+ reset: (held = {}) => set(() => ({ held })),
1155
+ triggers: {}
1156
+ }))
1157
+ );
1158
+
1159
+ // ../core/store/slices/history.ts
1160
+ var EMPTY_HISTORY_INDEX = 0;
1161
+ function debounce(func, timeout = 300) {
1162
+ let timer;
1163
+ return (...args) => {
1164
+ clearTimeout(timer);
1165
+ timer = setTimeout(() => {
1166
+ func(...args);
1167
+ }, timeout);
1168
+ };
1169
+ }
1170
+ var tidyState = (state) => {
1171
+ return __spreadProps(__spreadValues({}, state), {
1172
+ ui: __spreadProps(__spreadValues({}, state.ui), {
1173
+ field: {
1174
+ focus: null
1175
+ }
1176
+ })
1177
+ });
1178
+ };
1179
+ var createHistorySlice = (set, get) => {
1180
+ const record = debounce((state) => {
1181
+ const { histories, index } = get().history;
1182
+ const history = {
1183
+ state,
1184
+ id: generateId("history")
1185
+ };
1186
+ const newHistories = [...histories.slice(0, index + 1), history];
1187
+ set({
1188
+ history: __spreadProps(__spreadValues({}, get().history), {
1189
+ histories: newHistories,
1190
+ index: newHistories.length - 1
1191
+ })
1192
+ });
1193
+ }, 250);
1194
+ return {
1195
+ initialAppState: {},
1196
+ index: EMPTY_HISTORY_INDEX,
1197
+ histories: [],
1198
+ hasPast: () => get().history.index > EMPTY_HISTORY_INDEX,
1199
+ hasFuture: () => get().history.index < get().history.histories.length - 1,
1200
+ prevHistory: () => {
1201
+ const { history } = get();
1202
+ return history.hasPast() ? history.histories[history.index - 1] : null;
1203
+ },
1204
+ nextHistory: () => {
1205
+ const s = get().history;
1206
+ return s.hasFuture() ? s.histories[s.index + 1] : null;
1207
+ },
1208
+ currentHistory: () => get().history.histories[get().history.index],
1209
+ back: () => {
1210
+ var _a;
1211
+ const { history, dispatch } = get();
1212
+ if (history.hasPast()) {
1213
+ const state = tidyState(
1214
+ ((_a = history.prevHistory()) == null ? void 0 : _a.state) || history.initialAppState
1215
+ );
1216
+ dispatch({
1217
+ type: "set",
1218
+ state
1219
+ });
1220
+ set({ history: __spreadProps(__spreadValues({}, history), { index: history.index - 1 }) });
1221
+ }
1222
+ },
1223
+ forward: () => {
1224
+ var _a;
1225
+ const { history, dispatch } = get();
1226
+ if (history.hasFuture()) {
1227
+ const state = (_a = history.nextHistory()) == null ? void 0 : _a.state;
1228
+ dispatch({ type: "set", state: state ? tidyState(state) : {} });
1229
+ set({ history: __spreadProps(__spreadValues({}, history), { index: history.index + 1 }) });
1230
+ }
1231
+ },
1232
+ setHistories: (histories) => {
1233
+ var _a;
1234
+ const { dispatch, history } = get();
1235
+ dispatch({
1236
+ type: "set",
1237
+ state: ((_a = history.histories[history.histories.length - 1]) == null ? void 0 : _a.state) || history.initialAppState
1238
+ });
1239
+ set({ history: __spreadProps(__spreadValues({}, history), { histories, index: histories.length - 1 }) });
1240
+ },
1241
+ setHistoryIndex: (index) => {
1242
+ var _a;
1243
+ const { dispatch, history } = get();
1244
+ dispatch({
1245
+ type: "set",
1246
+ state: ((_a = history.histories[history.index]) == null ? void 0 : _a.state) || history.initialAppState
1247
+ });
1248
+ set({ history: __spreadProps(__spreadValues({}, history), { index }) });
1249
+ },
1250
+ record
1251
+ };
1252
+ };
1253
+
1254
+ // ../core/store/slices/nodes.ts
1255
+ init_react_import();
1256
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1257
+ var import_react7 = require("react");
1258
+ var partialDeepEqual = (newItem, existingItem) => {
1259
+ const filteredExistingItem = Object.keys(newItem).reduce(
1260
+ (acc, key) => __spreadProps(__spreadValues({}, acc), { [key]: existingItem[key] }),
1261
+ {}
1262
+ );
1263
+ return (0, import_fast_deep_equal2.default)(newItem, filteredExistingItem);
1264
+ };
1265
+ var createNodesSlice = (set, get) => ({
1266
+ nodes: {},
1267
+ registerNode: (id, node) => {
1268
+ const s = get().nodes;
1269
+ if (s.nodes[id] && partialDeepEqual(node, s.nodes[id])) {
1270
+ return;
504
1271
  }
505
- return [
506
- ...acc,
507
- {
508
- label: item.type.toString(),
509
- selector: {
510
- index: itemIndex,
511
- zone: parentZoneCompound
1272
+ const emptyNode = {
1273
+ id,
1274
+ methods: { sync: () => null },
1275
+ data: { props: { id }, type: "unknown" },
1276
+ parentId: "",
1277
+ zone: "",
1278
+ path: [],
1279
+ element: null,
1280
+ index: -1
1281
+ };
1282
+ const existingNode = s.nodes[id];
1283
+ set({
1284
+ nodes: __spreadProps(__spreadValues({}, s), {
1285
+ nodes: __spreadProps(__spreadValues({}, s.nodes), {
1286
+ [id]: __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, emptyNode), existingNode), node), {
1287
+ id
1288
+ })
1289
+ })
1290
+ })
1291
+ });
1292
+ },
1293
+ unregisterNode: (id) => {
1294
+ const s = get().nodes;
1295
+ const existingNode = s.nodes[id];
1296
+ if (existingNode) {
1297
+ const newNodes = __spreadValues({}, s.nodes);
1298
+ delete newNodes[id];
1299
+ set({
1300
+ nodes: __spreadProps(__spreadValues({}, s), {
1301
+ nodes: newNodes
1302
+ })
1303
+ });
1304
+ }
1305
+ }
1306
+ });
1307
+
1308
+ // ../core/store/slices/permissions.ts
1309
+ init_react_import();
1310
+ var import_react8 = require("react");
1311
+ var createPermissionsSlice = (set, get) => {
1312
+ const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
1313
+ const { state, permissions } = get();
1314
+ const { cache: cache3, globalPermissions } = permissions;
1315
+ const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
1316
+ var _a, _b, _c;
1317
+ const {
1318
+ config,
1319
+ state: appState,
1320
+ setComponentLoading,
1321
+ unsetComponentLoading
1322
+ } = get();
1323
+ const componentConfig = item2.type === "root" ? config.root : config.components[item2.type];
1324
+ if (!componentConfig) {
1325
+ return;
1326
+ }
1327
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
1328
+ if (componentConfig.resolvePermissions) {
1329
+ const changed = getChanged(item2, (_a = cache3[item2.props.id]) == null ? void 0 : _a.lastData);
1330
+ if (Object.values(changed).some((el) => el === true) || force2) {
1331
+ setComponentLoading(item2.props.id);
1332
+ const resolvedPermissions = yield componentConfig.resolvePermissions(
1333
+ item2,
1334
+ {
1335
+ changed,
1336
+ lastPermissions: ((_b = cache3[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
1337
+ permissions: initialPermissions,
1338
+ appState,
1339
+ lastData: ((_c = cache3[item2.props.id]) == null ? void 0 : _c.lastData) || null
1340
+ }
1341
+ );
1342
+ const latest = get().permissions;
1343
+ set({
1344
+ permissions: __spreadProps(__spreadValues({}, latest), {
1345
+ cache: __spreadProps(__spreadValues({}, latest.cache), {
1346
+ [item2.props.id]: {
1347
+ lastData: item2,
1348
+ lastPermissions: resolvedPermissions
1349
+ }
1350
+ }),
1351
+ resolvedPermissions: __spreadProps(__spreadValues({}, latest.resolvedPermissions), {
1352
+ [item2.props.id]: resolvedPermissions
1353
+ })
1354
+ })
1355
+ });
1356
+ unsetComponentLoading(item2.props.id);
1357
+ }
1358
+ }
1359
+ });
1360
+ const resolveDataForRoot = (force2 = false) => {
1361
+ const { state: appState } = get();
1362
+ resolveDataForItem(
1363
+ // Shim the root data in by conforming to component data shape
1364
+ {
1365
+ type: "root",
1366
+ props: __spreadProps(__spreadValues({}, appState.data.root.props), { id: "puck-root" })
512
1367
  },
513
- zoneCompound
1368
+ force2
1369
+ );
1370
+ };
1371
+ const { item, type, root } = params;
1372
+ if (item) {
1373
+ yield resolveDataForItem(item, force);
1374
+ } else if (type) {
1375
+ flattenData(state.data).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
1376
+ yield resolveDataForItem(item2, force);
1377
+ }));
1378
+ } else if (root) {
1379
+ resolveDataForRoot(force);
1380
+ } else {
1381
+ resolveDataForRoot(force);
1382
+ flattenData(state.data).map((item2) => __async(void 0, null, function* () {
1383
+ yield resolveDataForItem(item2, force);
1384
+ }));
1385
+ }
1386
+ });
1387
+ const refreshPermissions = (params) => resolvePermissions(params, true);
1388
+ return {
1389
+ cache: {},
1390
+ globalPermissions: {
1391
+ drag: true,
1392
+ edit: true,
1393
+ delete: true,
1394
+ duplicate: true,
1395
+ insert: true
1396
+ },
1397
+ resolvedPermissions: {},
1398
+ getPermissions: ({ item, type, root } = {}) => {
1399
+ const { config, permissions } = get();
1400
+ const { globalPermissions, resolvedPermissions } = permissions;
1401
+ if (item) {
1402
+ const componentConfig = config.components[item.type];
1403
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
1404
+ const resolvedForItem = resolvedPermissions[item.props.id];
1405
+ return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
1406
+ } else if (type) {
1407
+ const componentConfig = config.components[type];
1408
+ return __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
1409
+ } else if (root) {
1410
+ const rootConfig = config.root;
1411
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), rootConfig == null ? void 0 : rootConfig.permissions);
1412
+ const resolvedForItem = resolvedPermissions["puck-root"];
1413
+ return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
514
1414
  }
515
- ];
516
- }, []);
1415
+ return globalPermissions;
1416
+ },
1417
+ resolvePermissions,
1418
+ refreshPermissions
1419
+ };
1420
+ };
1421
+
1422
+ // ../core/store/slices/fields.ts
1423
+ init_react_import();
1424
+ var import_react9 = require("react");
1425
+ var createFieldsStore = (_set, _get) => {
1426
+ return {
1427
+ fields: {},
1428
+ loading: false,
1429
+ lastResolvedData: {}
1430
+ };
1431
+ };
1432
+
1433
+ // ../core/store/index.ts
1434
+ var defaultAppState = {
1435
+ data: { content: [], root: {}, zones: {} },
1436
+ ui: {
1437
+ leftSideBarVisible: true,
1438
+ rightSideBarVisible: true,
1439
+ arrayState: {},
1440
+ itemSelector: null,
1441
+ componentList: {},
1442
+ isDragging: false,
1443
+ previewMode: "edit",
1444
+ viewports: {
1445
+ current: {
1446
+ width: defaultViewports[0].width,
1447
+ height: defaultViewports[0].height || "auto"
1448
+ },
1449
+ options: [],
1450
+ controlsVisible: true
1451
+ },
1452
+ field: { focus: null }
1453
+ }
1454
+ };
1455
+ var defaultPageFields = {
1456
+ title: { type: "text" }
517
1457
  };
1458
+ var createAppStore = (initialAppStore) => create()(
1459
+ subscribeWithSelector((set, get) => __spreadProps(__spreadValues({
1460
+ state: defaultAppState,
1461
+ config: { components: {} },
1462
+ componentState: {},
1463
+ plugins: [],
1464
+ overrides: {},
1465
+ viewports: defaultViewports,
1466
+ zoomConfig: {
1467
+ autoZoom: 1,
1468
+ rootHeight: 0,
1469
+ zoom: 1
1470
+ },
1471
+ status: "LOADING",
1472
+ iframe: {},
1473
+ metadata: {}
1474
+ }, initialAppStore), {
1475
+ fields: createFieldsStore(set, get),
1476
+ history: createHistorySlice(set, get),
1477
+ nodes: createNodesSlice(set, get),
1478
+ permissions: createPermissionsSlice(set, get),
1479
+ getComponentConfig: (type) => {
1480
+ var _a;
1481
+ const { config, selectedItem } = get();
1482
+ const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
1483
+ return type && type !== "root" ? config.components[type] : selectedItem ? config.components[selectedItem.type] : __spreadProps(__spreadValues({}, config.root), { fields: rootFields });
1484
+ },
1485
+ dispatch: (action) => set((s) => {
1486
+ var _a, _b;
1487
+ const { record } = get().history;
1488
+ const dispatch = createReducer({ config: s.config, record });
1489
+ const state = dispatch(s.state, action);
1490
+ const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state.data) : null;
1491
+ (_b = (_a = get()).onAction) == null ? void 0 : _b.call(_a, action, state, get().state);
1492
+ return __spreadProps(__spreadValues({}, s), { state, selectedItem });
1493
+ }),
1494
+ setZoomConfig: (zoomConfig) => set({ zoomConfig }),
1495
+ setStatus: (status) => set({ status }),
1496
+ setComponentState: (componentState) => set({ componentState }),
1497
+ setComponentLoading: (id) => {
1498
+ var _a;
1499
+ const { setComponentState, componentState } = get();
1500
+ setComponentState(__spreadProps(__spreadValues({}, componentState), {
1501
+ [id]: __spreadProps(__spreadValues({}, componentState[id]), {
1502
+ loadingCount: (((_a = componentState[id]) == null ? void 0 : _a.loadingCount) || 0) + 1
1503
+ })
1504
+ }));
1505
+ },
1506
+ unsetComponentLoading: (id) => {
1507
+ var _a;
1508
+ const { setComponentState, componentState } = get();
1509
+ setComponentState(__spreadProps(__spreadValues({}, componentState), {
1510
+ [id]: __spreadProps(__spreadValues({}, componentState[id]), {
1511
+ loadingCount: Math.max(
1512
+ (((_a = componentState[id]) == null ? void 0 : _a.loadingCount) || 0) - 1,
1513
+ 0
1514
+ )
1515
+ })
1516
+ }));
1517
+ },
1518
+ // Helper
1519
+ setUi: (ui, recordHistory) => set((s) => {
1520
+ const dispatch = createReducer({
1521
+ config: s.config,
1522
+ record: () => {
1523
+ }
1524
+ });
1525
+ const state = dispatch(s.state, {
1526
+ type: "setUi",
1527
+ ui,
1528
+ recordHistory
1529
+ });
1530
+ const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state.data) : null;
1531
+ return __spreadProps(__spreadValues({}, s), { state, selectedItem });
1532
+ }),
1533
+ resolveDataRuns: 0,
1534
+ resolveData: (newAppState) => set((s) => {
1535
+ resolveData(newAppState, get());
1536
+ return __spreadProps(__spreadValues({}, s), { resolveDataRuns: s.resolveDataRuns + 1 });
1537
+ })
1538
+ }))
1539
+ );
1540
+ var appStoreContext = (0, import_react10.createContext)(createAppStore());
1541
+ function useAppStore(selector) {
1542
+ const context = (0, import_react10.useContext)(appStoreContext);
1543
+ return useStore(context, selector);
1544
+ }
1545
+ function useAppStoreApi() {
1546
+ return (0, import_react10.useContext)(appStoreContext);
1547
+ }
1548
+
1549
+ // ../core/lib/use-breadcrumbs.ts
518
1550
  var useBreadcrumbs = (renderCount) => {
519
- const {
520
- state: { data },
521
- selectedItem
522
- } = useAppContext();
523
- const dzContext = (0, import_react8.useContext)(dropZoneContext);
524
- return (0, import_react8.useMemo)(() => {
525
- const breadcrumbs = convertPathDataToBreadcrumbs(
526
- selectedItem,
527
- dzContext == null ? void 0 : dzContext.pathData,
528
- data
529
- );
1551
+ const selectedId = useAppStore((s) => {
1552
+ var _a;
1553
+ return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
1554
+ });
1555
+ const config = useAppStore((s) => s.config);
1556
+ const path = useAppStore((s) => {
1557
+ var _a;
1558
+ return (_a = s.nodes.nodes[selectedId]) == null ? void 0 : _a.path;
1559
+ });
1560
+ const appStore = useAppStoreApi();
1561
+ return (0, import_react11.useMemo)(() => {
1562
+ const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
1563
+ var _a, _b;
1564
+ const [componentId] = zoneCompound.split(":");
1565
+ if (componentId === "root") {
1566
+ return {
1567
+ label: "Page",
1568
+ selector: null
1569
+ };
1570
+ }
1571
+ const node = appStore.getState().nodes.nodes[componentId];
1572
+ const label = node ? (_b = (_a = config.components[node.data.type]) == null ? void 0 : _a.label) != null ? _b : node.data.type : "Component";
1573
+ return {
1574
+ label,
1575
+ selector: node ? {
1576
+ index: node.index,
1577
+ zone: node.path[node.path.length - 1]
1578
+ } : null
1579
+ };
1580
+ })) || [];
530
1581
  if (renderCount) {
531
1582
  return breadcrumbs.slice(breadcrumbs.length - renderCount);
532
1583
  }
533
1584
  return breadcrumbs;
534
- }, [selectedItem, dzContext == null ? void 0 : dzContext.pathData, renderCount]);
1585
+ }, [path, renderCount]);
535
1586
  };
536
1587
 
537
1588
  // ../core/components/Loader/index.tsx
@@ -543,18 +1594,12 @@ init_react_import();
543
1594
  // ../core/lib/filter.ts
544
1595
  init_react_import();
545
1596
 
546
- // ../core/lib/reorder.ts
547
- init_react_import();
548
-
549
- // ../core/lib/replace.ts
550
- init_react_import();
551
-
552
1597
  // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
553
1598
  init_react_import();
554
1599
  var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
555
1600
 
556
1601
  // ../core/components/Loader/index.tsx
557
- var import_jsx_runtime4 = require("react/jsx-runtime");
1602
+ var import_jsx_runtime2 = require("react/jsx-runtime");
558
1603
  var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
559
1604
  var Loader = (_a) => {
560
1605
  var _b = _a, {
@@ -564,7 +1609,7 @@ var Loader = (_a) => {
564
1609
  "color",
565
1610
  "size"
566
1611
  ]);
567
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1612
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
568
1613
  "span",
569
1614
  __spreadValues({
570
1615
  className: getClassName2(),
@@ -579,7 +1624,7 @@ var Loader = (_a) => {
579
1624
  };
580
1625
 
581
1626
  // ../core/components/SidebarSection/index.tsx
582
- var import_jsx_runtime5 = require("react/jsx-runtime");
1627
+ var import_jsx_runtime3 = require("react/jsx-runtime");
583
1628
  var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
584
1629
  var SidebarSection = ({
585
1630
  children,
@@ -590,17 +1635,17 @@ var SidebarSection = ({
590
1635
  noPadding,
591
1636
  isLoading
592
1637
  }) => {
593
- const { setUi } = useAppContext();
1638
+ const setUi = useAppStore((s) => s.setUi);
594
1639
  const breadcrumbs = useBreadcrumbs(1);
595
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1640
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
596
1641
  "div",
597
1642
  {
598
1643
  className: getClassName3({ noBorderTop, noPadding }),
599
1644
  style: { background },
600
1645
  children: [
601
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
602
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
603
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1646
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
1647
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
1648
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
604
1649
  "button",
605
1650
  {
606
1651
  type: "button",
@@ -609,12 +1654,12 @@ var SidebarSection = ({
609
1654
  children: breadcrumb.label
610
1655
  }
611
1656
  ),
612
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronRight, { size: 16 })
1657
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
613
1658
  ] }, i)) : null,
614
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
1659
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
615
1660
  ] }) }),
616
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("content"), children }),
617
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Loader, { size: 32 }) })
1661
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
1662
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
618
1663
  ]
619
1664
  }
620
1665
  );
@@ -628,18 +1673,18 @@ init_react_import();
628
1673
  var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
629
1674
 
630
1675
  // ../core/components/OutlineList/index.tsx
631
- var import_jsx_runtime6 = require("react/jsx-runtime");
1676
+ var import_jsx_runtime4 = require("react/jsx-runtime");
632
1677
  var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
633
1678
  var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
634
1679
  var OutlineList = ({ children }) => {
635
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: getClassName4(), children });
1680
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
636
1681
  };
637
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
1682
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
638
1683
  OutlineList.Item = ({
639
1684
  children,
640
1685
  onClick
641
1686
  }) => {
642
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1687
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
643
1688
  "li",
644
1689
  {
645
1690
  className: getClassNameItem({ clickable: !!onClick }),
@@ -673,7 +1718,7 @@ var getFrame = () => {
673
1718
 
674
1719
  // src/HeadingAnalyzer.tsx
675
1720
  var import_react_from_json = __toESM(require("react-from-json"));
676
- var import_jsx_runtime7 = require("react/jsx-runtime");
1721
+ var import_jsx_runtime5 = require("react/jsx-runtime");
677
1722
  var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
678
1723
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
679
1724
  var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
@@ -681,6 +1726,9 @@ var getOutline = ({ frame } = {}) => {
681
1726
  const headings = (frame == null ? void 0 : frame.querySelectorAll("h1,h2,h3,h4,h5,h6")) || [];
682
1727
  const _outline = [];
683
1728
  headings.forEach((item, i) => {
1729
+ if (item.closest("[data-dnd-dragging]")) {
1730
+ return;
1731
+ }
684
1732
  _outline.push({
685
1733
  rank: parseInt(item.tagName.split("H")[1]),
686
1734
  text: item.textContent,
@@ -723,10 +1771,11 @@ function buildHierarchy(frame) {
723
1771
  }
724
1772
  return root.children;
725
1773
  }
1774
+ var usePuck = (0, import_puck.createUsePuck)();
726
1775
  var HeadingAnalyzer = () => {
727
- const { appState } = (0, import_puck.usePuck)();
728
- const [hierarchy, setHierarchy] = (0, import_react9.useState)([]);
729
- (0, import_react9.useEffect)(() => {
1776
+ const data = usePuck((s) => s.appState.data);
1777
+ const [hierarchy, setHierarchy] = (0, import_react12.useState)([]);
1778
+ (0, import_react12.useEffect)(() => {
730
1779
  const frame = getFrame();
731
1780
  const entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
732
1781
  if (!entry) return;
@@ -738,9 +1787,9 @@ var HeadingAnalyzer = () => {
738
1787
  return () => {
739
1788
  observer.disconnect();
740
1789
  };
741
- }, [appState.data]);
742
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassName5(), children: [
743
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1790
+ }, [data]);
1791
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
1792
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
744
1793
  "small",
745
1794
  {
746
1795
  className: getClassName5("cssWarning"),
@@ -752,19 +1801,19 @@ var HeadingAnalyzer = () => {
752
1801
  children: [
753
1802
  "Heading analyzer styles not loaded. Please review the",
754
1803
  " ",
755
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
1804
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
756
1805
  "."
757
1806
  ]
758
1807
  }
759
1808
  ),
760
- hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "No headings." }),
761
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1809
+ hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
1810
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
762
1811
  ReactFromJSON,
763
1812
  {
764
1813
  mapping: {
765
- Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: props.children }),
766
- OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(OutlineList.Item, { children: [
767
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1814
+ Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
1815
+ OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
1816
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
768
1817
  "small",
769
1818
  {
770
1819
  className: getClassNameItem2({ missing: props.missing }),
@@ -782,14 +1831,14 @@ var HeadingAnalyzer = () => {
782
1831
  }, 2e3);
783
1832
  }
784
1833
  },
785
- children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
786
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("b", { children: [
1834
+ children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1835
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
787
1836
  "H",
788
1837
  props.rank
789
1838
  ] }),
790
1839
  ": Missing"
791
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
792
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("b", { children: [
1840
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1841
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
793
1842
  "H",
794
1843
  props.rank
795
1844
  ] }),
@@ -798,7 +1847,7 @@ var HeadingAnalyzer = () => {
798
1847
  ] })
799
1848
  }
800
1849
  ) }),
801
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OutlineList, { children: props.children })
1850
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
802
1851
  ] })
803
1852
  },
804
1853
  entry: {
@@ -820,9 +1869,9 @@ var HeadingAnalyzer = () => {
820
1869
  };
821
1870
  var headingAnalyzer = {
822
1871
  overrides: {
823
- fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1872
+ fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
824
1873
  children,
825
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeadingAnalyzer, {}) }) })
1874
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeadingAnalyzer, {}) }) })
826
1875
  ] })
827
1876
  }
828
1877
  };