efficient-easel 0.103.0 → 0.105.0

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.
Files changed (137) hide show
  1. package/README.md +92 -7
  2. package/dist/CanvasDragLayer-zgYT1xwY.d.ts +168 -0
  3. package/dist/chrome/index.js +1 -1
  4. package/dist/chunk-3P6AMTOS.js +1 -0
  5. package/dist/chunk-4XQUWGIV.js +65 -0
  6. package/dist/{chunk-6UJ3Y6FC.js → chunk-53G47SWO.js} +1 -1
  7. package/dist/{chunk-IWAPPEL4.js → chunk-5ZBBXZPV.js} +1 -1
  8. package/dist/chunk-7FBDZTUD.js +2 -0
  9. package/dist/chunk-7V5WZ46F.js +2 -0
  10. package/dist/chunk-BVN33R76.js +1 -0
  11. package/dist/chunk-CLOS6SSX.js +1 -0
  12. package/dist/chunk-ERR437B5.js +1 -0
  13. package/dist/chunk-GMCZXMOV.js +1 -0
  14. package/dist/{chunk-OYX47SL7.js → chunk-HNKB2ZYR.js} +1 -1
  15. package/dist/{chunk-AKFJK65Z.js → chunk-IE4GFYKO.js} +1 -1
  16. package/dist/{chunk-KDYIMJTZ.js → chunk-KCOBHPN6.js} +1 -1
  17. package/dist/chunk-KG7RJWOK.js +1 -0
  18. package/dist/chunk-N7VRF7PR.js +5 -0
  19. package/dist/chunk-NYKIQJT2.js +4 -0
  20. package/dist/{chunk-6TZTKAB5.js → chunk-O7Q4DDJT.js} +1 -1
  21. package/dist/chunk-PA3PNTVV.js +1 -0
  22. package/dist/chunk-PLVEGYK6.js +1 -0
  23. package/dist/chunk-PQXIFBDY.js +1 -0
  24. package/dist/{chunk-66ICOE3I.js → chunk-QH6LCNOX.js} +1 -1
  25. package/dist/chunk-R6WTQWAC.js +2 -0
  26. package/dist/{chunk-Z3KBLIEH.js → chunk-RQHC4TD6.js} +3 -3
  27. package/dist/chunk-RSCMJIWS.js +1 -0
  28. package/dist/{chunk-7MU3RJ6S.js → chunk-S4AWJX4Q.js} +1 -1
  29. package/dist/{chunk-MSBF7IW3.js → chunk-SARZN4M7.js} +2 -2
  30. package/dist/chunk-SQTY6CJD.js +1 -0
  31. package/dist/chunk-TBF5CVPA.js +1 -0
  32. package/dist/chunk-THWO5YVZ.js +1 -0
  33. package/dist/chunk-TLZG2FCF.js +1 -0
  34. package/dist/chunk-U3JP4VGF.js +2 -0
  35. package/dist/{chunk-LG436UTD.js → chunk-V4LF7D4F.js} +1 -1
  36. package/dist/chunk-VSHV6KJQ.js +5 -0
  37. package/dist/{chunk-OM67AJQC.js → chunk-VSOP4GUM.js} +1 -1
  38. package/dist/{chunk-6DJHRLCU.js → chunk-YC4TB3CJ.js} +9 -9
  39. package/dist/{chunk-GXN65JMA.js → chunk-YN4KND5F.js} +1 -1
  40. package/dist/chunk-ZTTWFAAC.js +1 -0
  41. package/dist/drag/index.d.ts +4 -164
  42. package/dist/edit-lock/index.d.ts +55 -1
  43. package/dist/edit-lock/index.js +1 -1
  44. package/dist/{host-DJ8Gzsx7.d.ts → host-BQ_b9Qzk.d.ts} +27 -1
  45. package/dist/screen/components/AddBlockRow.js +1 -1
  46. package/dist/screen/components/AddSidePanel.js +1 -1
  47. package/dist/screen/components/MediaSidePanel.d.ts +3 -2
  48. package/dist/screen/components/MediaSidePanel.js +1 -1
  49. package/dist/screen/components/NodeContextMenu.d.ts +208 -5
  50. package/dist/screen/components/NodeContextMenu.js +1 -1
  51. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  52. package/dist/screen/components/ScreenChrome.js +1 -1
  53. package/dist/screen/components/ScreenDocumentContext.d.ts +2 -1
  54. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  55. package/dist/screen/components/ScreenMount.d.ts +14 -3
  56. package/dist/screen/components/ScreenMount.js +1 -1
  57. package/dist/screen/components/ScreenStoreProvider.d.ts +20 -5
  58. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  59. package/dist/screen/components/SectionScreenShell.js +16 -16
  60. package/dist/screen/components/SidePanelHead.js +1 -1
  61. package/dist/screen/components/panel-widths.js +1 -1
  62. package/dist/screen/components/usePartBridge.d.ts +20 -5
  63. package/dist/screen/components/usePartBridge.js +1 -1
  64. package/dist/screen/index.d.ts +17 -6
  65. package/dist/screen/index.js +1 -1
  66. package/dist/screen/lib/admin-bridge.d.ts +2 -0
  67. package/dist/screen/lib/admin-bridge.js +1 -1
  68. package/dist/screen/lib/backend-error.d.ts +20 -5
  69. package/dist/screen/lib/backend-error.js +1 -1
  70. package/dist/screen/lib/document-addressing.d.ts +2 -1
  71. package/dist/screen/lib/document-switch.js +1 -1
  72. package/dist/screen/lib/failure.d.ts +6 -2
  73. package/dist/screen/lib/failure.js +1 -1
  74. package/dist/screen/lib/host-inbound.js +1 -1
  75. package/dist/screen/lib/host.d.ts +3 -2
  76. package/dist/screen/lib/host.js +1 -1
  77. package/dist/screen/lib/key-scope.js +1 -1
  78. package/dist/screen/lib/load-error.d.ts +9 -3
  79. package/dist/screen/lib/load-error.js +1 -1
  80. package/dist/screen/lib/media-panel.d.ts +81 -17
  81. package/dist/screen/lib/media-panel.js +1 -1
  82. package/dist/screen/lib/media-picker.d.ts +14 -2
  83. package/dist/screen/lib/media-picker.js +1 -1
  84. package/dist/screen/lib/page-lock.d.ts +45 -1
  85. package/dist/screen/lib/page-lock.js +1 -1
  86. package/dist/screen/lib/puck/content-tree.d.ts +27 -1
  87. package/dist/screen/lib/puck/content-tree.js +1 -1
  88. package/dist/screen/lib/puck/palette-sections.d.ts +7 -0
  89. package/dist/screen/lib/puck/palette-sections.js +1 -1
  90. package/dist/screen/lib/puck/section-doc.js +1 -1
  91. package/dist/screen/lib/puck/slot-child-name.d.ts +42 -3
  92. package/dist/screen/lib/puck/slot-child-name.js +1 -1
  93. package/dist/screen/lib/puck/style-clipboard.d.ts +53 -1
  94. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  95. package/dist/screen/lib/puck/use-section-ops.d.ts +6 -0
  96. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  97. package/dist/screen/lib/screen-parts.d.ts +619 -10
  98. package/dist/screen/lib/screen-parts.js +1 -1
  99. package/dist/screen/lib/section-templates.d.ts +25 -1
  100. package/dist/screen/lib/section-templates.js +1 -1
  101. package/dist/screen/lib/session-context.d.ts +5 -1
  102. package/dist/screen/lib/session-context.js +1 -1
  103. package/dist/screen/lib/session.d.ts +58 -5
  104. package/dist/screen/lib/session.js +1 -1
  105. package/dist/screen/screen.css +18 -0
  106. package/dist/screen/words.d.ts +96 -2
  107. package/dist/screen/words.js +1 -1
  108. package/dist/strings/catalogue.d.ts +4 -2
  109. package/dist/strings/catalogue.js +1 -1
  110. package/dist/strings/index.d.ts +1 -1
  111. package/dist/strings/index.js +1 -1
  112. package/dist/tree/index.d.ts +4 -142
  113. package/dist/types-DJDBtdB2.d.ts +143 -0
  114. package/package.json +1 -1
  115. package/dist/chunk-3M3A3DN2.js +0 -4
  116. package/dist/chunk-4MXFKJUY.js +0 -1
  117. package/dist/chunk-6FY3PZS3.js +0 -1
  118. package/dist/chunk-A7ZJII7O.js +0 -1
  119. package/dist/chunk-AJBJ74ME.js +0 -1
  120. package/dist/chunk-AKZWUV5Z.js +0 -1
  121. package/dist/chunk-F6CCTEIX.js +0 -1
  122. package/dist/chunk-FUDHI5I4.js +0 -1
  123. package/dist/chunk-GENAF3P6.js +0 -1
  124. package/dist/chunk-HDKTR5TZ.js +0 -62
  125. package/dist/chunk-HMX55DYT.js +0 -1
  126. package/dist/chunk-HWW4XJOH.js +0 -1
  127. package/dist/chunk-JUQ6YJCG.js +0 -1
  128. package/dist/chunk-NBJ2YY6Y.js +0 -4
  129. package/dist/chunk-OORDMLL4.js +0 -5
  130. package/dist/chunk-Q2HPBMG5.js +0 -1
  131. package/dist/chunk-Q3SQBNJB.js +0 -1
  132. package/dist/chunk-R5ZVNJLJ.js +0 -2
  133. package/dist/chunk-SERF2FAU.js +0 -1
  134. package/dist/chunk-VV5ADNBR.js +0 -1
  135. package/dist/chunk-YJXEHK6I.js +0 -2
  136. package/dist/chunk-ZWK3CBRU.js +0 -1
  137. package/dist/chunk-ZZ7VLIHQ.js +0 -1
package/README.md CHANGED
@@ -264,7 +264,11 @@ export const pageEditLock = createEditLock({
264
264
  The plain half needs no binding: `canWriteDocument`, `holderOf`,
265
265
  `readLockHolder`, `accessForNewDocument`, `documentPermissions`, `describeAge`,
266
266
  `nameOrSomeone`, `newEaselClientId`, `shouldReleaseHeldWrite`,
267
- `shouldReloadAfterTakeover`, `documentVersionMoved`, `reloadIfVersionMoved`.
267
+ `shouldReloadAfterTakeover`, `documentVersionMoved`, `reloadIfVersionMoved`,
268
+ and the clock a claim that never answers is given (0.105.0, owner ruling R7):
269
+ `CLAIM_FAIL_OPEN_MS` (8 s), `FAIL_OPEN_RETRY_MS` (30 s) and
270
+ `openUnansweredClaim(deps)`, which opens a document still `checking` and sends
271
+ the write held for it.
268
272
  The bound half —
269
273
  `accessAfterClaimFailure`, `accessAfterTakeoverFailure`,
270
274
  `accessAfterHeartbeatFailure`, `isAuthRejection`, `readSaveConflict`,
@@ -987,8 +991,88 @@ held read-only for good, and the save pill's place says why. The top bar's
987
991
  main button is the layer's when its bridges hand one back (`barMain`), and
988
992
  the save pill is no switch under `saveSwitch: false`. The words the screen
989
993
  says while a document opens, or will not, and the edit notice's word for the
990
- document are the `screen` group of `EaselStrings`. Each is optional: without
991
- it the screen is the website's, as it was.
994
+ document are the `screen` group of `EaselStrings`. A field's media pick may
995
+ carry the field's own terms to the host's panel (`options`) and give way to a
996
+ change of selection (`pickFollowsSelection`), and a block may be resolved as
997
+ it goes in (`blockRules.resolveOnInsert`). Each is optional: without it the
998
+ screen is the website's, as it was.
999
+
1000
+ Two screens may be mounted in one page (0.103.0): the second host's session
1001
+ is made with `claimsPage: false`, so it never becomes the page's current
1002
+ session (the website's loaders and client keep reading the website's), holds
1003
+ a block clipboard of its own registry's, and may bring its own default
1004
+ backend (`defaultBackend`) and its own reading of its client's errors
1005
+ (`hostFailures`). Each `MediaPanelProvider` keeps its own pending pick, found
1006
+ by the host a field asks through; the Add panel lists its own session's saved
1007
+ sections.
1008
+
1009
+ Its Layers tree is the layer's to frame (0.103.0). `pinned.isFirst` and
1010
+ `isLast` say which node is pinned where the type alone does not (the campaign
1011
+ designer's Header and Footer are sections, told apart by `_region`);
1012
+ `pinned.firstRow: "node"` draws the first pinned node with its children, as
1013
+ the Footer is drawn; `pinned.band` names the sections between the pins, folds
1014
+ them under a row of their own and ends them with an "Add section" row; and
1015
+ `useDocumentLabel` is the head's context line. A row's name, its quieter
1016
+ words, its marks and buttons of the layer's own are `blockLook.rowName`,
1017
+ `rowPreview`, `rowMarks` and `rowActions`. A block config's
1018
+ `permissions.delete` / `duplicate` set to `false` takes the action off the
1019
+ block's rows and its menu, and the inspector is handed the answer for its
1020
+ head (`nodeActions`). The frame's words (Page settings, the pinned labels,
1021
+ the band's) are `screen` words too.
1022
+
1023
+ Its canvas can be a mail preview's (0.105.0). `devices.fit: "shrink"` draws a
1024
+ fixed device at its real size or smaller, never enlarged (the campaign
1025
+ designer's phone); `CanvasHead` is a row of the layer's above the frame, in the
1026
+ canvas's well and never scaled (its Subject line and its dark mail app's bar),
1027
+ handed the device; `useScreenCanvasTarget()` is the frame the screen found, for
1028
+ a layer's `Canvas` and head to write their sheets into; and `canvasDrag` is the
1029
+ canvas drag's measure, model, rule, write and pick where they are the layer's,
1030
+ each handed the screen's own (`base`) and the document, the device, the
1031
+ screen's writes and its inspector.
1032
+
1033
+ A node's slots are the layer's to list (0.105.0, `blockRules.slotsOf`): a
1034
+ slot that is a `rung` is a row of its own with its children under it — the
1035
+ campaign designer's "Column 2" — and every other slot's children hang off the
1036
+ node's row, as before. A rung's gaps, Add's "Adding to Column 2" and a drop
1037
+ into it ask `canAddTo` of that slot (its third argument, `slot`); a rung with
1038
+ a `panel` opens that panel of the layer's with nothing selected, and is a
1039
+ level of the Select layer flyout; `blockRules.moveSlot` is its drag and
1040
+ ⌥↑ / ⌥↓, and `blockRules.slotActions` its row's buttons, which the layer runs
1041
+ and confirms. `ScreenInspector.select(selector, mode)` moves the selection and
1042
+ shows a panel in one step, the mode kept through the reset a change of
1043
+ selection makes.
1044
+
1045
+ Add, the clipboard, the menu and the keys are the layer's where it says so
1046
+ (0.105.0). `add.railTarget(data, selection)` aims the rail's "+" at a place
1047
+ of the layer's (the campaign designer's column), and `add.blocksFirst` makes a
1048
+ container's blocks the whole panel and leaves a gap between sections to the
1049
+ catalogue; a category marked `visible: false` is not offered; Add's words are
1050
+ `screen.add`. `styleClipboard` is Copy style / Paste style's scope and a
1051
+ node's look (`scope`, `rows`, `copy`, `plan`); the bridges' `menuRows` are the
1052
+ layer's own rows in a node's menu; ⌘C / ⌘X / ⌘V copy, cut and paste the
1053
+ selected block by the menu's rules (`nodeKeys`, on unless the layer says
1054
+ `false`); and a host whose window closes on Escape hands
1055
+ `createEaselHost({ claimEscape })`, so the menu, Add, a field's pick and a
1056
+ rename box take Escape first.
1057
+
1058
+ Two rulings of the owner's (Victor Mau, 2026-10-09) change what every host
1059
+ gets, the website included: a held block PASTES ACROSS LISTS — into any list
1060
+ on the way up from the node pointed at that a drag of it could land in, by the
1061
+ drag's own rule — and the screen's main button says "Done", still publishing
1062
+ what publishes and saving the rest (`screen.done`; `barMain` still replaces
1063
+ it).
1064
+
1065
+ Three more of them (the same day) change it too. The claim that opens a
1066
+ document fails open on the clock (R7): unanswered after `CLAIM_FAIL_OPEN_MS`
1067
+ (8 s, `efficient-easel/edit-lock`), the document opens and the edit held for
1068
+ the claim goes out; the heartbeat keeps trying (`FAIL_OPEN_RETRY_MS`) until a
1069
+ claim answers, and a late answer naming somebody else takes it over, as a beat
1070
+ would. A top-level section is renamed from its Layers row like a block (R11),
1071
+ writing the `name` its row reads (`sectionRenameProp`), unless its `name`
1072
+ field is copy; the pinned rows are not, and `blockLook.renamePropOf` has the
1073
+ last word (the campaign designer's sections are named by their `label`). And a
1074
+ host may say the screen's toasts itself (R17, `ScreenParts.notify(message,
1075
+ tone)`): every line goes to it and the screen draws none.
992
1076
 
993
1077
  - **Every module is a subpath of its own** (`efficient-easel/screen/lib/session`,
994
1078
  `efficient-easel/screen/components/ScreenChrome`): hosts and their guards
@@ -998,10 +1082,11 @@ it the screen is the website's, as it was.
998
1082
  `exports` map from it and `tests/screen-exports.test.ts` fails one that
999
1083
  drifted.
1000
1084
  - **It still writes out some of the website it came from** (a website
1001
- target's site and template, the pinned Header and Footer rows, the
1002
- `storefront-editor:` host messages). Each is handed in as the campaign
1003
- designer needs it; the list is in the builder's `doc/adr/0004`. A host's
1004
- own document target is the first to have left it (0.103.0).
1085
+ target's site and template, the `storefront-editor:` host messages). Each
1086
+ is handed in as the campaign designer needs it; the list is in the
1087
+ builder's `doc/adr/0004`. A host's own document target is the first to have
1088
+ left it, and the frame of the pinned Header and Footer rows the second
1089
+ (0.103.0).
1005
1090
  - **Its classes keep their `sf-` names** and its strings their words: the
1006
1091
  hosts' sheets, their guards and the website's host address them.
1007
1092
 
@@ -0,0 +1,168 @@
1
+ import * as react from 'react';
2
+ import { C as CanvasTarget$1 } from './watch-BTYOJpQU.js';
3
+ import { S as SlotAddress, P as Place } from './types-41704JE4.js';
4
+ import { D as DragSession } from './session-DSQFmIvx.js';
5
+ import { D as DragWords } from './words-BDignMl_.js';
6
+
7
+ /**
8
+ * Where a drop on the CANVAS lands — pure functions over measured boxes
9
+ * (blueprint step 3.2). The tree's rule (./hit) is about rows in a list; the
10
+ * canvas is boxes inside boxes, laid out down the page or across it, so it
11
+ * needs its own — the campaign designer's overlay, made general:
12
+ *
13
+ * - ONE HANDLE: the smallest box under the pointer wins, so hovering an image
14
+ * offers the image, not the section it sits in (their corners are a few
15
+ * pixels apart); a parent is picked up by hovering its own padding.
16
+ * - THE ZONE: the innermost list under the pointer that will take the drop. A
17
+ * refused inner zone falls through to the next one out — a section dragged
18
+ * over a column lands between sections, not nowhere. (Decided again on
19
+ * 2026-10-07; see `canvasTarget`.)
20
+ * - THE GAP: along the zone's own axis — down a column, ACROSS a row of
21
+ * columns — counted against the children's midpoints; the line is drawn in
22
+ * the middle of that gap, horizontal or vertical to match.
23
+ *
24
+ * All boxes are in ONE coordinate space: the layer drawn over the canvas.
25
+ */
26
+
27
+ type Box = {
28
+ left: number;
29
+ top: number;
30
+ width: number;
31
+ height: number;
32
+ };
33
+ /** Something on the canvas that can be picked up. */
34
+ type CanvasSource<I> = {
35
+ key: string;
36
+ item: I;
37
+ box: Box;
38
+ /** What the handle calls it — "Image", "Section". */
39
+ label: string;
40
+ /** The handle's tooltip. Default "Drag to move this image". */
41
+ title?: string;
42
+ /** Where it sits now — a drop back there is a no-op. */
43
+ from?: Place;
44
+ };
45
+ /** A list on the canvas that takes drops: a slot, laid out one way. */
46
+ type CanvasZone = {
47
+ key: string;
48
+ list: SlotAddress;
49
+ box: Box;
50
+ /** 'y': children stack down; 'x': they sit across (columns). */
51
+ axis: 'x' | 'y';
52
+ /** The children, in order. */
53
+ children: Box[];
54
+ };
55
+ /** The gap between two sections, offered as a place to add one. */
56
+ type CanvasSeam = {
57
+ key: string;
58
+ place: Place;
59
+ box: Box;
60
+ };
61
+ declare const contains: (b: Box, x: number, y: number) => boolean;
62
+ /** The smallest source under the point — the innermost thing. */
63
+ declare function pickSource<I>(sources: readonly CanvasSource<I>[], x: number, y: number): CanvasSource<I> | null;
64
+ /** The gap the point means in a zone: children whose middle it has passed. */
65
+ declare function gapInZone(zone: CanvasZone, x: number, y: number): number;
66
+ /** The drop line for a gap: 2px, in the middle of the space between two children. */
67
+ declare function gapLine(zone: CanvasZone, gap: number): Box;
68
+ type CanvasTarget = {
69
+ zone: CanvasZone;
70
+ to: Place;
71
+ line: Box;
72
+ } | null;
73
+ /**
74
+ * Where a drop at the point lands: the innermost zone under it that takes it.
75
+ * `accept` answers for the place; a refused zone falls through to the one
76
+ * outside it. A drop that would leave the thing where it is lands NOWHERE — it
77
+ * does not fall through to an outer list, which would move it somewhere the
78
+ * pointer is not.
79
+ *
80
+ * ── THE FALL-THROUGH STAYS, AND A HOST MAY END IT (second host, 2026-10-07) ──
81
+ * A host reported it as a surprise: a Columns block dragged onto a column,
82
+ * which refuses columns, landed at the top level instead of being refused; and
83
+ * a block picked up INSIDE a container, held over a part of that container
84
+ * that will not take it, left the container for the page.
85
+ *
86
+ * It stays the rule, for three reasons. A page is covered by its inner lists:
87
+ * without the fall-through a section could be dropped only on the few pixels
88
+ * of the page's own list that show between sections. Both editors this was
89
+ * built for have shipped on it. And it is not silent: the line is drawn where
90
+ * the drop WILL land before the button is let go, across the page for a drop
91
+ * the page takes.
92
+ *
93
+ * But what surprises is the host's to know — the engine never learns what a
94
+ * column is — so the host may answer for each refusal: `fallThrough(refused)`
95
+ * is asked with the place that just refused, and `false` ends it there. The
96
+ * drop lands nowhere, no line is drawn, and the browser shows it refused.
97
+ * Left out, every refusal falls through, as before.
98
+ */
99
+ declare function canvasTarget(zones: readonly CanvasZone[], x: number, y: number, accept: (to: Place) => boolean, isNoOp?: (to: Place) => boolean, fallThrough?: (refused: Place) => boolean): CanvasTarget;
100
+ /** The seams between a zone's children — where "+ Add section" goes. */
101
+ declare function seamsBetween(zone: CanvasZone, keyPrefix?: string): CanvasSeam[];
102
+
103
+ type MeasuredNode = {
104
+ id: string;
105
+ place: Place;
106
+ box: Box;
107
+ };
108
+ type MeasuredCanvas = {
109
+ nodes: MeasuredNode[];
110
+ zones: CanvasZone[];
111
+ };
112
+ declare const EMPTY_MEASURE: MeasuredCanvas;
113
+ declare function measureCanvas(canvas: CanvasTarget$1, layer: Element): MeasuredCanvas;
114
+
115
+ type CanvasDragModel<I> = {
116
+ /** What may be picked up. Leave out what cannot move — a pinned section, a block with nowhere to go. */
117
+ sources: CanvasSource<I>[];
118
+ /** The lists that take drops. */
119
+ zones: CanvasZone[];
120
+ /** The gaps offered as "+ Add section" (see `seamsBetween`). */
121
+ seams?: CanvasSeam[];
122
+ };
123
+ type CanvasDragLayerProps<I> = {
124
+ canvas: CanvasTarget$1 | null;
125
+ session: DragSession<I>;
126
+ /** Turn what was measured into what may be picked up and dropped on. */
127
+ model: (measured: MeasuredCanvas) => CanvasDragModel<I>;
128
+ canDrop: (item: I, to: Place) => boolean;
129
+ onDrop: (item: I, to: Place) => void;
130
+ /**
131
+ * A drop the innermost list under the pointer refuses is offered to the next
132
+ * list out: a section held over a column lands between sections, and the
133
+ * line shows where (./canvasHit). Answer `false` here to END it at the list
134
+ * that refused — nothing is drawn and nothing lands — for a drop where
135
+ * falling through would surprise: a Columns block over a column, or a block
136
+ * leaving the container it was picked up in.
137
+ *
138
+ * Asked only about a place `canDrop` has just refused: `refused` is that
139
+ * place, `from` where the thing was picked up (absent for a new one, from
140
+ * the Add list). Left out, every refusal falls through.
141
+ */
142
+ fallThrough?: (item: I, refused: Place, from?: Place) => boolean;
143
+ /** The handle CLICKED, not dragged: select what it names. Absent: a click does nothing. */
144
+ onPick?: (item: I) => void;
145
+ /** "+ Add section" in a seam: open the Add panel at that place. */
146
+ onSeamAdd?: (place: Place) => void;
147
+ seamLabel?: string;
148
+ /** "+ Add block" in an empty slot: open the Add panel there. */
149
+ onZoneAdd?: (place: Place) => void;
150
+ zoneAddLabel?: string;
151
+ readOnly?: boolean;
152
+ /** Re-measure when this changes — the document's revision. Layout changes re-measure by themselves. */
153
+ revision?: unknown;
154
+ /** How the canvas is measured. Default: Puck's markers (./measure). */
155
+ measure?: (canvas: CanvasTarget$1, layer: Element) => MeasuredCanvas;
156
+ /**
157
+ * The layer's own words in the host's language:
158
+ * `useEaselStrings().drag.canvas` (0.95.0). Left out, English. `seamLabel`
159
+ * and `zoneAddLabel` above still win for their one word. A prop, not the
160
+ * strings provider: drag imports only its own lane.
161
+ */
162
+ words?: DragWords['canvas'];
163
+ };
164
+ /** How long the handle waits for the pointer on its way from the frame. */
165
+ declare const HANDLE_GRACE_MS = 140;
166
+ declare function CanvasDragLayer<I>(props: CanvasDragLayerProps<I>): react.JSX.Element;
167
+
168
+ export { type Box as B, type CanvasDragModel as C, EMPTY_MEASURE as E, HANDLE_GRACE_MS as H, type MeasuredCanvas as M, CanvasDragLayer as a, type CanvasDragLayerProps as b, type CanvasTarget as c, type CanvasSeam as d, type CanvasSource as e, type CanvasZone as f, type MeasuredNode as g, canvasTarget as h, contains as i, gapInZone as j, gapLine as k, measureCanvas as m, pickSource as p, seamsBetween as s };
@@ -1 +1 @@
1
- export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,mediaPickKind,panelWidthVars,setPanelWidthVars}from"../chunk-6DJHRLCU.js";import"../chunk-ZJEBF4NB.js";import"../chunk-JUQ6YJCG.js";import"../chunk-RE4LP46F.js";import"../chunk-WZ7TGAAT.js";import"../chunk-2OAZYSWJ.js";import"../chunk-MFIRYGHW.js";import"../chunk-BZ5ASXOL.js";import"../chunk-L5KW4HG5.js";
1
+ export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,mediaPickKind,panelWidthVars,setPanelWidthVars}from"../chunk-YC4TB3CJ.js";import"../chunk-ZJEBF4NB.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-WZ7TGAAT.js";import"../chunk-2OAZYSWJ.js";import"../chunk-MFIRYGHW.js";import"../chunk-BZ5ASXOL.js";import"../chunk-L5KW4HG5.js";
@@ -0,0 +1 @@
1
+ import{applyEaselChromeTheme as e}from"./chunk-3WSPDAK2.js";import{useEaselSession as t}from"./chunk-O7Q4DDJT.js";import{currentEaselSession as n,setSessionBridgedSite as r}from"./chunk-RSCMJIWS.js";import{useEaselHost as o}from"./chunk-U3JP4VGF.js";import{useState as s,useRef as a,useEffect as c}from"react";var u={canCreatePlatformTemplate:!1};function i(t,o={}){const s=o.session??n();s.auth.token=t.token,s.auth.brandId=t.brandId??null,r(s,t.siteId),(o.stampChromeTheme??!0)&&e(t.theme)}function m(e){const[n,r]=s(null),m=a(null),[l,f]=s(u),d=a(e?.onAuth),k=a(e?.onMessage);c(()=>{d.current=e?.onAuth,k.current=e?.onMessage});const p=o(),h=t();return c(()=>{const e=p.subscribe(e=>{const t=e;if("storefront-editor:auth"===t.type&&"string"==typeof t.token&&t.token){const e=!!m.current;m.current=t.token,r(t.token),i({...t,token:t.token},{stampChromeTheme:p.ownsDocument,session:h}),f((n=t.can)&&"object"==typeof n?{canCreatePlatformTemplate:!0===n.canCreatePlatformTemplate}:u),d.current?.(e)}else k.current?.(e);var n});if(p.send("storefront-editor:ready"),!h.usesBridgedToken)return e;const t=window.setInterval(()=>{m.current?window.clearInterval(t):p.send("storefront-editor:ready")},500);return()=>{e(),window.clearInterval(t)}},[p,h]),{token:n,tokenRef:m,capabilities:l}}export{u as NO_BRIDGED_CAPABILITIES,i as applyAuthGrant,m as useAdminBridge};
@@ -0,0 +1,65 @@
1
+ import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-SQTY6CJD.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-IE4GFYKO.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h}from"./chunk-VSOP4GUM.js";import{SlotChildActionsProvider as m}from"./chunk-KCBEE2MC.js";import{UiIcon as g}from"./chunk-5MZ3RNQQ.js";import{DEFAULT_PANEL_W as y,PANEL_WIDTHS_KEY as k,clampPanelWidth as S}from"./chunk-ZTTWFAAC.js";import{usePartBridge as v}from"./chunk-YN4KND5F.js";import{useSectionOps as x}from"./chunk-TLZG2FCF.js";import{useNodeClipboard as b,useNodeContextMenu as w}from"./chunk-7FBDZTUD.js";import{PageEditGuardNotices as z}from"./chunk-V4LF7D4F.js";import{useScreenDocument as B}from"./chunk-7V5WZ46F.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as N,styleShortcut as $}from"./chunk-57DJOKXT.js";import{AddChildRow as T}from"./chunk-3QVB4AG2.js";import{AddSidePanel as O}from"./chunk-N7VRF7PR.js";import{SidePanelHead as I,PanelShowStrip as P}from"./chunk-5ZBBXZPV.js";import{MediaSidePanel as A}from"./chunk-NYKIQJT2.js";import{useScreenSaveSwitch as R,useScreenNodeKeys as j,useScreenPinned as M,useScreenDocumentLabel as E,useScreenCanvasFrame as F,useScreenInspectorPanel as V,useScreenDevices as L,useScreenPickFollowsSelection as D,useScreenLeftView as G,useScreenAdd as H,SELECTION_MODE as U,sameInspectorMode as J,useScreenBridges as W,useScreenBlockRules as Y,useScreenBlockLook as K,useScreenNotify as Q,useScreenCanvasHead as Z,isSlotMode as _,useScreenStyleClipboard as X,useScreenDocumentPass as q,useScreenCanvasDrag as ee,ScreenCanvasTargetProvider as ne,isPinnedFirst as te,isPinnedLast as oe,screenSlotsOf as re}from"./chunk-VSHV6KJQ.js";import{ROOT_ZONE as ie,blockNodeActions as le,TREE_MAX_DEPTH as se,childSlotsOf as de,slotFieldsOf as ce,slotChildrenIn as ae,nestsInTree as pe,newNodeId as ue}from"./chunk-PLVEGYK6.js";import{useMediaPanel as fe,usePanelPick as he,useCancelPanelPick as me}from"./chunk-R6WTQWAC.js";import{useEaselHost as ge,useHostEscape as ye}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as ke}from"./chunk-PQXIFBDY.js";import{useEasel as Se}from"./chunk-P67FP7PG.js";import{TreeRow as ve,Subtree as xe,LayersTree as be,TreeGroupLabel as we,TreeRowAction as ze,TreeSeam as Be}from"./chunk-ZFDCDJNZ.js";import{useNodeOps as Ce,toItemSelector as Ne}from"./chunk-D2BCHTQR.js";import{saveIndicator as $e}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Te,TopBarRail as Oe,TopBarCluster as Ie,EaselIconButton as Pe,TopBarDivider as Ae,DeviceSwitch as Re,InspectorIconButton as je,PanelResizeHandle as Me,MAX_PANEL_W as Ee,MIN_PANEL_W as Fe,panelWidthVars as Ve,SaveState as Le,SaveStateToggle as De}from"./chunk-YC4TB3CJ.js";import{useWords as Ge}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as He}from"./chunk-TTJ54QGG.js";import{createDragSession as Ue,useTreeDrag as Je,gapToMoveIndex as We}from"./chunk-67GNT6PF.js";import{useCanvasFrame as Ye,BLOCK_SELECTOR as Ke,useCanvasEvent as Qe}from"./chunk-PAELDYYS.js";import{LayersIcon as Ze,UndoIcon as _e,RedoIcon as Xe,TrashIcon as qe,MediaIcon as en,DuplicateIcon as nn}from"./chunk-L5KW4HG5.js";import{zoneKey as tn,ROOT_ID as on,ROOT_SLOT as rn,parseZoneKey as ln,DataError as sn}from"./chunk-KRXQM65X.js";import{useRef as dn,useMemo as cn,useState as an,useEffect as pn,useCallback as un,useLayoutEffect as fn,Fragment as hn}from"react";import{jsx as mn,jsxs as gn,Fragment as yn}from"react/jsx-runtime";function kn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return mn(Le,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
2
+ return mn(Le,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=$e(e),d=e.failed&&!e.paused&&/* @__PURE__ */mn("button",{type:"button",className:"es-btn-ghost",onClick:i,children:"Retry now"});/* @__PURE__ */
3
+ return gn(yn,o?{children:[
4
+ /* @__PURE__ */mn(De,{pressed:e.paused,onToggle:r,title:e.paused?"Auto-save is off — click to turn it back on (saves your held edits)":"Auto-save is on — click to pause it",children:/* @__PURE__ */mn(Le,{tone:l,label:s})}),d]}:{children:[
5
+ /* @__PURE__ */mn(Le,{tone:l,label:s,role:"status"}),d]})}function Sn({expand:e}){/* @__PURE__ */
6
+ return mn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */gn(yn,e?{children:[
7
+ /* @__PURE__ */mn("path",{d:"M8 9l4-4 4 4"}),
8
+ /* @__PURE__ */mn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
9
+ /* @__PURE__ */mn("path",{d:"M8 4l4 4 4-4"}),
10
+ /* @__PURE__ */mn("path",{d:"M8 20l4-4 4 4"}),
11
+ /* @__PURE__ */mn("path",{d:"M5 12h14"})]})})}var vn="__rungs";var xn="screen:band",bn={duplicate:!0,delete:!0};function wn(){const $e=ge(),{target:Le,docId:De,capabilities:wn,currentSlug:zn,siteId:Bn,onPublish:Cn,saveState:Nn,saveConflict:$n,retrySave:Tn,toggleAutoSave:On,readOnly:In,readOnlyReason:Pn=null}=B(),An=R(),Rn=j(),{mediaEditing:jn,hasEditGuard:Mn,hasPinnedChrome:En}=wn,{appState:Fn,dispatch:Vn,history:Ln,selectedItem:Dn,getSelectorForId:Gn,config:Hn}=Se(e=>e),Un=M(),{first:Jn,firstGroup:Wn,lastGroup:Yn,isSectionGroup:Kn,sectionGroupZone:Qn,panelOf:Zn}=Un,_n=Zn(Jn),Xn=e=>te(Un,e),qn=e=>oe(Un,e),et="node"===Un.firstRow,nt=Un.band??null,tt=Ge("screen",ke),ot=E()??`/${zn}`,rt=F(),it=V(),lt=x({readOnly:In}),st=dn(null),dt=cn(()=>({...lt,select:e=>{st.current=e,lt.select(e)}}),[lt]),ct=Fn.ui,at=ct.leftSideBarVisible,pt=ct.rightSideBarVisible,{options:ut,widths:ft,initial:ht,fluid:mt,fit:gt}=L(),[yt,kt]=an(ht),St=fe(),vt=jn&&null!==St,xt=he(),bt=me();D(Dn?.props.id);const{read:wt,write:zt,forSelection:Bt}=G(),[Ct,Nt]=an(wt);pn(()=>{zt(Ct)},[Ct]);const[$t,Tt]=an(0),Ot=dn(null),It=dn(null),Pt=Ye(It,{readySelector:Ke}),At=f(It);h(It);const[Rt,jt]=an(!1),Mt=dn(!1),Et=dn(!1),[Ft,Vt]=an(null),Lt=H(),Dt=e=>Vt(null===e?null:{zone:ie,index:e}),[Gt,Ht]=an([]),[Ut,Jt]=an(U),Wt="puck"===Ut.kind,Yt=Rt&&!Ft&&Lt.railTarget?Lt.railTarget(Fn.data,{node:Dn??null,mode:Ut}):null,Kt=Yt?{zone:tn(Yt),index:Yt.index}:null,Qt=Ft??Kt,Zt=Qt&&Qt.zone===ie?Qt.index:null,_t=t(Ut,Dn?.props.id),[Xt,qt]=an(null);pn(()=>{Xt&&(o(),qt(null))},[Xt]);const eo=dn(Gn);eo.current=Gn;const no=un((e,{scroll:n})=>{Nt(n=>Bt(e,n)),n&&qt(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=eo.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Oo(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),to=dn(null);pn(()=>{const e=to.current;to.current=null;const n=null==Dn?.props.id?null:String(Dn.props.id);Jt(e&&e.id===n?e.mode:Zn(Dn?.type)??U);const t=Dn?.props.id,o=st.current;if(st.current=null,!t)return;const i=Gn(t);no(String(t),{scroll:!r(o,i??null,ie)})},[Dn?.props.id,no]);const oo=un(e=>{Jt(n=>J(n,e)?n:e),Vn({type:"setUi",ui:{rightSideBarVisible:!0}})},[Vn]),ro=dn(()=>{});ro.current=(e,n)=>{const t=e?zr(e.zone??ie)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Dn?.props.id?null:String(Dn.props.id);Jt(e=>J(e,n)?e:n),o!==r&&(to.current={id:o,mode:n},dt.select(e))};const io=un((e,n)=>ro.current(e,n),[]),lo={kind:Ut.kind,mode:Ut,open:oo,show:e=>Jt(e),reveal:()=>{pt||Vn({type:"setUi",ui:{rightSideBarVisible:!0}})},select:io},so=W(lo,{data:Fn.data,selected:Dn??null,zoneOf:e=>Gn(e)?.zone,readOnly:Boolean(In),select:e=>{Jt(U),dt.select({index:e})},replace:(e,n)=>dt.replaceComponent(ie,e,n),scrollTo:e=>Qr(e)},{device:yt,refreshes:$t},{setView:Nt,reveal:()=>{at||Vn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),co=so.pinnedSource??!1,ao=so.resolveLeftView?so.resolveLeftView(Ct,vt):"media"===Ct&&vt?Ct:"sections",po=Y(),{isLockedBlock:uo,duplicateBlocked:fo,nestDepth:ho,newSectionNode:mo,canAddTo:go,blockIsOffered:yo}=po,ko=K(),{labelAtLevel:So,Icon:vo,useProducts:xo}=ko,bo=ko.rowName?(e,n,t)=>ko.rowName(e,n,t):void 0,wo=un(e=>{Vn({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),no(e,{scroll:!0})},[Vn,no]),{selectNode:zo,openPartId:Bo}=v({mode:Ut,setMode:Jt,onOpenPart:wo}),[Co,No]=an(null);ye(null!==Co,()=>No(null));const $o="sf-editor-collapsed-sections",[To,Oo]=an(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem($o);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
12
+ return new Set}});pn(()=>{try{window.localStorage.setItem($o,JSON.stringify([...To]))}catch{}},[To]);const[Io,Po]=an(()=>{if("undefined"==typeof window)return{...y};try{const e=window.localStorage.getItem(k);if(!e)return{...y};const n=JSON.parse(e);return{left:S(Number(n.left)||y.left),right:S(Number(n.right)||y.right)}}catch{return{...y}}});pn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(k,JSON.stringify(Io))}catch{}},300);return()=>clearTimeout(e)},[Io]);const Ao=un((e,n)=>Po(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Ro=un(e=>Ao("left",e),[Ao]),jo=un(e=>Ao("right",e),[Ao]),Mo=e=>To.has(e),Eo=e=>Oo(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Fo=dn(!1),Vo=dn(null);pn(()=>{if(Fo.current&&!Rt){const e=Vo.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??It.current?.querySelector(`button[aria-label="${CSS.escape(tt.add.title)}"]`))?.focus(),Vo.current=null}Fo.current=Rt},[Rt]),pn(()=>{if(!Rt||!At)return;const e=e=>{"Escape"===e.key&&ri()};return At.addEventListener("keydown",e),()=>At.removeEventListener("keydown",e)},[Rt,At]),ye(Rt,()=>ri()),pn(()=>{!at&&Rt&&(jt(!1),Vt(null),Mt.current=!1)},[at]),pn(()=>{if(!xt)return Et.current&&Vn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Et.current=!1);Rt&&(jt(!1),Vt(null),Et.current=Mt.current,Mt.current=!1),at||(Et.current=!0,Vn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[xt]),pn(()=>{!at&&xt&&(Et.current=!1,bt())},[at]),pn(()=>{if(!xt||!At)return;const e=e=>{"Escape"===e.key&&bt()};return At.addEventListener("keydown",e),()=>At.removeEventListener("keydown",e)},[xt,At]),ye(null!==xt,()=>bt());const Lo=Q(),[Do,Go]=an(null),[Ho,Uo]=an(0),Jo=dn(null),Wo=(e,n="success")=>{Lo?Lo(e,"error"===n?"error":"info"):(Go({msg:e,tone:n}),Uo(e=>e+1),Jo.current&&clearTimeout(Jo.current),Jo.current=setTimeout(()=>Go(null),"error"===n?3200:1900))};pn(()=>()=>{Jo.current&&clearTimeout(Jo.current)},[]);const Yo=dn(null),[Ko,Qo]=an(0),[Zo,_o]=an(0),Xo=Z(),qo=dn(null),er=e=>Math.max(0,e.clientHeight-(qo.current?.offsetHeight??0));pn(()=>{const e=Yo.current;if(!e)return;const n=()=>{Qo(e.clientWidth),_o(er(e))};n();const t=new ResizeObserver(n);return t.observe(e),qo.current&&t.observe(qo.current),()=>t.disconnect()},[]),fn(()=>{Yo.current&&(Qo(Yo.current.clientWidth),_o(er(Yo.current)))},[Io,at,pt]);const nr=yt===mt?Ko>0?Ko:ft[mt]:ft[yt],tr=Ko>0?Math.min(Ko/nr,"shrink"===gt?1:2):1,or=nr*tr,rr=Ko>0&&or>Ko+1,ir={width:or,height:Zo||"100%",flex:"none",position:"relative"},lr={width:nr,height:Zo?Zo/tr:"100%",maxHeight:"none",transform:1!==tr?`scale(${tr})`:void 0,transformOrigin:"top left"},sr=()=>Vn({type:"setUi",ui:{leftSideBarVisible:!at}}),dr=()=>Vn({type:"setUi",ui:{rightSideBarVisible:!pt}}),cr=e=>{Rt&&(jt(!1),Vt(null),Mt.current=!1,at&&Ct===e)||xt&&(Et.current=!1,bt(),at&&Ct===e)||(at&&Ct===e?sr():(Nt(e),at||Vn({type:"setUi",ui:{leftSideBarVisible:!0}})))},ar=()=>{C($e,{accept:"image/*",title:"Media library"})},pr=()=>{Jt(U),dt.select(null),u()},ur=()=>{Jt(_n??U),pt||Vn({type:"setUi",ui:{rightSideBarVisible:!0}})},fr=Fn.data.content??[],hr=()=>{const e=fr.findIndex(Xn),n=fr.findIndex(qn);return{floor:e>=0?e+1:0,cap:n>=0?n:fr.length}},mr=Hn,gr=b(),yr=Ce({data:Fn.data,config:mr,readOnly:Boolean(In),clipboard:gr,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==on||e.slot!==rn)return{min:0,max:n-1};const{floor:t,cap:o}=hr();return{min:t,max:o-1}},commit:(e,{select:n})=>{if(void 0!==n){Jt(U);const t="node"===n?.kind?Ne(e,mr,n):null;dt.select(t&&t.zone===ie?{index:t.index}:t)}dt.commitDocument(e)}}),kr=e=>Hn.components[e]?.label??e,Sr=un(e=>Hn.components[e]?.defaultProps??{},[Hn]),vr=e=>So(e,"section",kr(e)),xr=e=>l({type:e.type,props:e.props??{}},vr(e.type),bo),{nodeAddresses:br,zoneItems:wr}=cn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=se)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of de(Hn,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(fr,ie,0),{nodeAddresses:e,zoneItems:n}},[fr,Hn]),zr=un(e=>wr.get(e)??[],[wr]),Br=e=>{const n=br.get(e);return n?zr(n.zone)[n.index]:void 0},Cr=e=>re(po,Hn,e),Nr=e=>{if(!po.slotsOf||e===ie)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Br(e.slice(0,n));if(!t)return null;const o=Cr(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},$r=(()=>{if(!_(Ut))return null;const e=`${Ut.nodeId}:${Ut.slot}`;return Nr(e)?.slot.panel===Ut.kind?e:null})(),Tr=dn(null);pn(()=>{const e=Tr.current;if(Tr.current=null,!$r||!_(Ut))return;const n=Ut.nodeId;no(n,{scroll:e!==$r}),Oo(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Ut]);const Or=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=br.get(e);n&&(n.zone===ie?Zr(n.index):Bi(n.zone,n.index,e,Br(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&$r!==i&&(Tr.current=i),io(null,r),pt||Vn({type:"setUi",ui:{rightSideBarVisible:!0}}),Qr(o)},Ir=(e,n,t)=>{const o=`${e}:${n}`;if(Oo(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;$r!==o&&(Tr.current=o);io(null,{kind:t,nodeId:e,slot:n})},Pr=(e,n,t)=>{if(In||!po.moveSlot)return;const o=Br(e),r=o?Cr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:vn,index:n},s=We(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=po.moveSlot(e,n,s);"string"==typeof d&&Ir(e,d,i.panel)},Ar=xo(),Rr=cn(()=>{const e=/* @__PURE__ */new Map;for(const n of Ar??[])e.set(n.slug,n.name);return e},[Ar]),jr=e=>s(e,kr,ko.plainText,e=>Rr.get(e),ko.rowName),Mr=(e,n)=>{const t=Hn.components[e.type]?.fields,o=n===ie||Hi(n)?"section":"block",r=n===ie&&(Xn(e)||qn(e)||Kn(e.type)),i="block"===o?d(t):r?null:c(t);return ko.renamePropOf?ko.renamePropOf(e,o,i):i},Er=(e,n,t,o)=>{if(!(Co?.zone===e&&Co.index===n))return;const r=(t,o)=>{No(null),o&&((e,n,t)=>{const o=zr(e)[n];if(!o)return;const r=Mr(o,e);r&&dt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
13
+ return mn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":"Rename",onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Fr=n(X()),Vr=Fr.scope({target:Le,siteId:Bn,docId:De}),Lr=Hn,Dr=(e,n)=>n===ie?vr(e):kr(e),Gr=(e,n,t)=>{const o=Fr.plan(Vr,t,Dr(t.type,e),Lr);o&&(o.changed&&dt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Wo(o.message))},Hr=w({nodesIn:zr,nodeAt:(e,n)=>zr(e)[n]??null,labelOf:(e,n)=>n===ie?vr(e):kr(e),renamePropOf:Mr,beginRename:(e,n)=>No({zone:e,index:n}),history:{hasPast:Ln.hasPast,hasFuture:Ln.hasFuture,back:()=>Ln.back(),forward:()=>Ln.forward()},openAddSection:()=>{dt.select(null),ti(null)},openPageSettings:()=>{dt.select(null),Jt(U)},collapseAll:()=>Oo(new Set(zr(ie).map(e=>String(e.props.id)))),onPasteRefused:e=>Wo(e?tt.pasteRefused({name:e.label}):"Your browser won’t let us read the clipboard — press ⌘V","error"),canPasteAt:(e,n)=>Ji(e,n),menuRows:so.menuRows,isLocked:e=>uo(e.type),duplicateBlocked:e=>fo(Fn.data,e),permits:e=>le(Hn,e.type),canAddTo:go,nodeOps:yr,isPinned:(e,n)=>n===ie&&(Xn(e)||qn(e)),sectionBand:hr,openAddInside:(e,n)=>{e===ie?Zr(n):dt.select({zone:e,index:n}),ti(null)},locate:e=>br.get(e)??null,rowNameOf:(e,n)=>n===ie?xr(e):jr(e),selectAt:(e,n,t,o)=>{e===ie?Zr(n):Bi(e,n,t,o??"")},slotRung:e=>{const n=Nr(e);return n?.slot.panel?{label:n.slot.label,select:()=>Or(n.node,n.slot,!1)}:null},style:{held:()=>N(Vr),canCopy:e=>Fr.rows(Lr,e).some(e=>!1!==e.counted),copy:(e,n)=>Fr.copy(Vr,e,Dr(e.type,n),Lr),paste:(e,n,t)=>Gr(e,n,t)},keys:Rn?{target:At,selected:()=>{const e=Fn.ui.itemSelector;return e?{zone:e.zone??ie,index:e.index}:null},held:()=>gr.get(),readOnly:Boolean(In),onDone:({done:e,name:n})=>{"copied"===e&&Wo(tt.copied({name:n}))}}:void 0},Pt),Ur=dn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});pn(()=>{Ur.current={copy:(e,n)=>Fr.copy(Vr,e,Dr(e.type,n),Lr),paste:Gr,at:()=>{const e=Fn.ui.itemSelector;if(!e)return null;const n=e.zone??ie,t=zr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(In)}});const Jr=un(e=>{const n=$(e);if(!n)return;const t=Ur.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);pn(()=>{if(!At)return;const e=e=>Jr(e);return At.addEventListener("keydown",e),()=>At.removeEventListener("keydown",e)},[Jr,At]),Qe(Pt,"keydown",Jr);const Wr=fr.map(e=>e.props.id).join("|");pn(()=>{const e=Pt?.document??null,n=Pt?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ht(e=>e.length?[]:e);const n=fr.findIndex(qn),t=n>=0?n:fr.length,o=n=>{const t=fr[n]?.props?.id;if(null==t)return null;const o=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);return o?o.getBoundingClientRect():null},r=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1);(n||t)&&r.push({top:Math.round(n?n.top:t.bottom),index:e})}Ht(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index)return!1;return!0}(e,r)?e:r)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Pt,Wr,yt,tr,at,pt,Dn?.props.id]);const Yr=Pt?.document??null,Kr=Pt?.window??null;pn(()=>{const e=Ot.current;if(!e||!Yr||!Kr)return;const n=[],t=()=>{const n=Yr.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Kr.scrollTo({left:Kr.scrollX,top:Kr.scrollY+t,behavior:"instant"}),!0};return Ot.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Yr,Kr]);const Qr=e=>{so.holdCanvasOn?so.holdCanvasOn(e):a(e)},Zr=e=>{Jt(U),dt.select({index:e}),so.sectionPressed?.(fr[e]);const n=fr[e]?.props?.id;n&&Qr(n)},_r=e=>{const{floor:n,cap:t}=hr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Dn&&Ut.kind!==_n?.kind?fr.findIndex(e=>e.props.id===Dn.props.id):-1;return o(r>=0?r+1:t)},Xr=(e,n)=>{const{floor:t,cap:o}=hr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(dt.reorderComponent(ie,e,i),dt.select({index:i}),{moved:!0,dest:i})},qr=(e,n,t)=>{Jt(U),dt.select({index:e}),a(n),Wo(`Added “${t}” section`)},ei=(e,n)=>{const t=_r(n),o=mo(e,{nodeDefaults:Sr,newNodeId:ue,sectionLabel:vr,blockIsOffered:yo}),r=o?dt.insertNode(ie,t,o):dt.insertSection(e,t);return qr(t,r,vr(e)),t},ni=(e,n,t)=>{const o=_r(t),r=dt.insertNode(ie,o,n);return qr(o,r,e),o},ti=e=>oi(ie,e),oi=(e,n)=>{Vo.current=document.activeElement??null,xt&&(Mt.current=Et.current,Et.current=!1,bt()),Vt(null===n?null:{zone:e,index:n}),jt(!0),at||(Mt.current=!0,Vn({type:"setUi",ui:{leftSideBarVisible:!0}}))},ri=()=>{jt(!1),Vt(null),Mt.current&&Vn({type:"setUi",ui:{leftSideBarVisible:!1}}),Mt.current=!1},ii=(e,n,t)=>{if("section"===e.kind)dt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;dt.insertNode(n,t,i(e.template.node))}Jt(U),dt.select({index:t,zone:n})},li=e=>n=>{n.target.closest(".es-tree-select")||e()},si=()=>so.editPinnedSource?.(),di=(e,n,t)=>{const o=zr(e)[n];return o&&!le(Hn,o.type).delete?null:/* @__PURE__ */mn(ze,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=zr(e)[n]?.props?.id;null!=t&&yr.remove(String(t))})(e,n),children:/* @__PURE__ */mn(qe,{size:15})})},ci=e=>ko.rowPreview?.(e)||void 0,ai=e=>ko.rowMarks?.(e)??void 0,pi=(e,n,t)=>ko.rowActions?.(e,n,t)??null,ui=(e,n,t,o)=>{const r=Boolean(t.props._hidden);/* @__PURE__ */
14
+ return mn(ze,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>hi(e,n,t),children:/* @__PURE__ */mn(g,r?{name:"eye-off",size:14}:{name:"eye",size:14})})},fi=e=>{const n=vr(fr[e]?.type??""),t=n?tt.addSectionBefore({name:n}):tt.addSectionHere;return pl(ie,e,()=>ti(e),t)},hi=(e,n,t)=>{dt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},mi=e=>ce(Hn,e),gi=e=>de(Hn,e),yi=e=>po.slotsOf?Cr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:ae(e,n.slot)})):[{slot:null,rung:null,kids:gi(e)}],ki=e=>po.slotsOf?yi(e).flatMap(e=>e.kids):gi(e),Si=e=>Boolean(po.slotsOf)&&Cr(e).some(e=>e.rung),vi=(e,n,t)=>null===t?void 0===n?go(e):go(e,n):go(e,n,t),xi=(e,n,t)=>{const o=pe(Hn,e.type,n)&&(t||ki(e).length>0||Si(e));return{collapsible:o,folded:o&&Mo(String(e.props.id))}},bi=(e,n,t)=>yi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>xi(e,r,t(e.type)).collapsible?[String(e.props.id),...bi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),wi=e=>ki(e).length>0||Si(e)||Boolean(go(e.type)),zi=e=>Boolean(go(e)),Bi=(e,n,t,o)=>{if(Jt(U),go(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),dt.select({index:n,zone:e}),a(t)}else dt.select({index:n,zone:e}),Qr(t)},Ci=(e,n,t,o,r)=>{const i=`${e}:${n}`;dt.insertComponent(i,t,o),go(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),dt.select({index:o,zone:i})}):dt.select({index:o,zone:i})},Ni=(e,n,t)=>{dt.insertComponent(e,n,t),Jt(U),dt.select({index:t,zone:e})},$i=dn(/* @__PURE__ */new Set);pn(()=>{fr.forEach(e=>{const n=go(e.type)?.spec;if(!n)return;const t=e.props.id;if($i.current.has(t))return;$i.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(Sr)).forEach((e,t)=>dt.seedChild(o,t,n.childType,e))})},[fr,dt,Sr]);const Ti=dn(/* @__PURE__ */new Set);pn(()=>{fr.forEach((n,t)=>{const o=n.props.id;if(Ti.current.has(o))return;const r=e(n,mi(n.type));Ti.current.add(o),r&&dt.replaceComponent(ie,t,{...n,props:r})})},[fr,dt]),q(dt,Hn);const Oi=fr.findIndex(qn),Ii=Oi>=0?fr[Oi]:null,Pi=et?fr.findIndex(Xn):-1,Ai=Pi>=0?fr[Pi]:null,Ri=fr.find(e=>e.type===Wn)??null,ji=fr.find(e=>e.type===Yn)??null,Mi=Oi>=0?Oi:fr.length,Ei=[];fr.forEach(e=>{qn(e)||(wi(e)&&Ei.push(String(e.props.id)),Ei.push(...bi(e,1,zi)))}),Ii&&(Ei.push(String(Ii.props.id)),Ei.push(...bi(Ii,1,zi)));const Fi=Ei.length>0&&Ei.every(e=>To.has(e)),Vi=e=>{const n=ko.blockRowName(e,kr);return ko.rowName?ko.rowName(e,"block",n):n},Li=(e,n,t,o)=>{const r=zr(e)[t];if(!r)return;const i={...ln(e),index:t},l={...ln(n),index:Math.min(Math.max(o,0),zr(n).length)},s=We(i,l);if(e!==n||s!==t)try{yr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof sn))throw e}},Di=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of gi(e))n.add(r),t(o)};for(const t of mi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Gi=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=br.get(n);if(!e)return null;if(e.zone===ie)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Hi=e=>{const n=e.slice(0,e.indexOf(":")),t=fr.find(e=>Kn(e.type)&&String(e.props.id)===n);return t&&Qn(n)===e?t:null},Ui=(e,n,t)=>{if(e.rung){const t=Br(e.rung.nodeId),o=t?Cr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===vn&&n.index>=0&&n.index<=o}if(n.slot===vn)return!1;if(e.add)return Yi(e.add,n);const o=tn(n);if(Kn(e.type))return!1;const r=Hi(o),i=Hi(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=zr(o).length);if(e.zone===ie||o===ie){if(e.zone!==o)return!1;const{floor:t,cap:r}=hr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>zr(o).length)return!1;if(e.zone===o)return!0;const l=Ii?String(Ii.props.id):null;return(!l||Gi(e.zone)!==l&&Gi(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??zr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=br.get(i),s=l?zr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Di(r).has(n))return!1;const d=go(s.type,ho(Fn?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(zr(n),r))})(e.zone,o,e.index,t)},Ji=(e,n)=>{const t=tn(e.from);if(t===tn(n))return!0;const o=e.node;return Ui({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Wi=e=>{const n=e.slice(0,e.indexOf(":")),t=br.get(n),o=t?zr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=go(o.type,ho(Fn?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:kr(r.spec.childType)}]:[]),l=Nr(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:t.zone===ie?vr(o.type):kr(o.type)}},Yi=(e,n)=>{const t=tn(n);if("block"!==e.kind){if(Hi(t))return n.index>=0&&n.index<=zr(t).length;if(t!==ie)return!1;const{floor:e,cap:o}=hr();return n.index>=e&&n.index<=o}if(t===ie)return!1;const o=Wi(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(zr(t))},Ki=(e,n)=>{e.rung?Pr(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&Hi(tn(n)))return void ii(e,tn(n),n.index);if("section"===e.kind)return void ei(e.type,n.index);if("template"===e.kind)return void ni(e.template.name,i(e.template.node),n.index);const t=tn(n),o=Wi(t);o&&(o.target.spec?Ci(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ni(t,e.type,n.index))})(e.add,n):e.zone===ie?Xr(e.index,n.index):Li(e.zone,tn(n),e.index,n.index)},[Qi]=an(()=>Ue()),Zi=Je({keyOf:e=>e.id,readOnly:Boolean(In),session:Qi,canDrop:Ui,onDrop:Ki,onStep:(e,n)=>{e.rung?Pr(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ie?((e,n)=>{const t=vr(fr[e]?.type??""),o=Xr(e,n<0?e-1:e+2);if(!o.moved)return void Wo(`“${t}” is already ${n<0?"first":"last"}`);const{floor:r,cap:i}=hr();Wo(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):Li(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),_i=un(e=>{const{floor:n,cap:t}=hr(),o=[];for(const r of e.nodes){const e=tn(r.place),i=zr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Xn(i)||qn(i)||uo(i.type))continue;if(Kn(i.type))continue;const l=Boolean(Hi(e)),s=e===ie||l;e===ie&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?vr(i.type):jr(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(Wi(tn(e.list))?.choices.length)||Boolean(Hi(tn(e.list))))}},[Fn.data]),Xi=e=>{Jt(U),dt.select(e.zone===ie?{index:e.index}:{index:e.index,zone:e.zone})},qi=ee(),el=()=>({data:Fn.data,device:yt,ops:dt,inspector:lo}),nl=qi?.model,tl=cn(()=>nl?e=>nl(e,_i(e),el()):_i,[nl,_i,yt]),ol=qi?.measure,rl=ol?(e,n)=>ol(e,n,el()):void 0,il=qi?.canDrop,ll=il?(e,n)=>il(e,n,Ui,el()):Ui,sl=qi?.drop,dl=sl?(e,n)=>sl(e,n,Ki,el()):Ki,cl=qi?.pick,al=cl?e=>cl(e,Xi,el()):Xi,pl=(e,n,t,o)=>/* @__PURE__ */mn(Be,{...In?{}:Zi.seam({place:{...ln(e),index:n}}),onAdd:In?void 0:t,label:o},`seam:${e}:${n}`),ul={rowClick:li,isCollapsed:Mo,toggleCollapse:Eo},fl=e=>{const n=String(e.props.id),t=fr.findIndex(e=>String(e.props.id)===n),o=Qn(n),r=zr(o),i=Mo(n),l=kr(e.type),s=ko.rowName?ko.rowName(e,"section",l):l,d=e=>pl(o,e,()=>oi(o,e),tt.addSectionHere);/* @__PURE__ */
15
+ return gn(yn,{children:[
16
+ /* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:e.type,size:13}),name:s,preview:ci(e),marks:ai(e),onSelect:()=>Zr(t),nameSlot:Er(ie,t,n,s),selected:_t===n,actions:pi(e,ie,t)??void 0,rowProps:{"data-node-id":n,onClick:li(()=>Zr(t))},fold:{open:!i,label:"section",onToggle:()=>Eo(n)}}),!i&&/* @__PURE__ */gn(xe,{children:[r.map((n,t)=>{const r=String(n.props.id),i=xr(n),l=wi(n),s=l&&Mo(r),c=()=>Bi(o,t,r,e.type),{rowProps:a,...p}=Zi.row({item:{id:r,zone:o,index:t,type:n.type},place:{...ln(o),index:t}},{"data-node-id":r,onClick:li(c)});/* @__PURE__ */
17
+ return gn(hn,{children:[d(t),
18
+ /* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:n.type,size:13}),name:i,preview:ci(n),marks:ai(n),onSelect:c,nameSlot:Er(o,t,r,i),selected:_t===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Eo(r)}:void 0,actions:/* @__PURE__ */gn(yn,{children:[di(o,t,i),pi(n,o,t),ui(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */mn(xe,{children:gl(n,2)})]},r)}),d(r.length)]})]})},hl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Zi.dragging,d=!Mo(l)&&s?.rung?.nodeId!==i,c={...ln(l),index:0},a=s&&!s.rung&&Ui(s,c)?c:void 0,p=()=>Or(e,n,!0),{rowProps:u,...f}=Zi.row({item:{id:`rung:${l}`,zone:`${i}:${vn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:vn,index:t},into:a,canDrag:Boolean(po.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:li(p)}),h=In?null:po.slotActions?.(e,n.slot);/* @__PURE__ */
19
+ return gn(hn,{children:[n.heading,
20
+ /* @__PURE__ */mn(ve,{icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:$r===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Eo(l)},actions:h&&h.length>0?/* @__PURE__ */mn(yn,{children:h.map((t,o)=>/* @__PURE__ */mn(ze,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(In||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ir(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */mn(qe,{size:15}):/* @__PURE__ */mn(nn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */mn(xe,{children:r})]},l)},ml=(e,n)=>{const t=yi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
21
+ return mn(yn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=vi(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=null!==c&&Boolean(Wi(c)?.choices.length),p=(e,n)=>a?pl(e,n,()=>oi(e,n),"Add block here"):pl(e,n),u=/* @__PURE__ */gn(yn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=_t===String(n.props.id),{collapsible:i,folded:s}=xi(n,l,zi(n.type)),d=String(n.props.id),c=Vi(n),a=()=>Bi(t,o,d,e.type),{rowProps:u,...f}=Zi.row({item:{id:d,zone:t,index:o,type:n.type},place:{...ln(t),index:o}},{"data-node-id":d,onClick:li(a)});/* @__PURE__ */
22
+ return gn(hn,{children:[0===o&&p(t,0),
23
+ /* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:n.type,size:13}),name:c,preview:ci(n),marks:ai(n),onSelect:a,nameSlot:Er(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Eo(d)}:void 0,actions:/* @__PURE__ */gn(yn,{children:[di(t,o,c),pi(n,t,o),ui(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */mn(xe,{children:ml(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==c?null:p(c,0)]});return t.rung?hl(e,t.rung,r++,o,u):/* @__PURE__ */mn(hn,{children:u},t.slot??"")})})},gl=(e,n)=>{const t=ho(Fn?.data,e.type,String(e.props.id)),o=yi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
24
+ return mn(yn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=vi(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>Ci(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>oi(n,t):void 0;return pl(n,t,o,n===f&&c?c.addLabel:"Add block here")},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */gn(yn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=_t===String(n.props.id),i=jr(n),l=String(n.props.id),{collapsible:d,folded:c}=xi(n,s,zi(n.type)),a=mi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...ln(p),index:zr(p).length}:void 0,f=Zi.dragging,h=u&&f&&Ui(f,u)?u:void 0,g=()=>Bi(t,o,l,e.type),{rowProps:y,...k}=Zi.row({item:{id:l,zone:t,index:o,type:n.type},place:{...ln(t),index:o},into:h,canDrag:!uo(n.type)},{"data-node-id":l,onClick:li(g)});/* @__PURE__ */
25
+ return gn(hn,{children:[0===o&&m(t,0),
26
+ /* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:n.type,size:13}),name:i,preview:ci(n),marks:ai(n),onSelect:g,nameSlot:Er(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Eo(l)}:void 0,actions:uo(n.type)?pi(n,t,o)??void 0:/* @__PURE__ */gn(yn,{children:[di(t,o,i),pi(n,t,o),ui(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */mn(xe,{children:gl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
27
+ /* @__PURE__ */mn(T,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>Ci(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?hl(e,o.rung,i++,r,k):/* @__PURE__ */mn(hn,{children:k},o.slot??"")})})},yl=(()=>{if(!Dn||!Wt)return null;const e=String(Dn.type),n=String(Dn.props.id),t=go(e,ho(Fn?.data,e,n));if(!t||"footer"===t.source)return null;const o=fr.some(e=>String(e.props?.id)===n),r=Array.isArray(Dn.props[t.slot])?Dn.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:kr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:o?vr(e):kr(e),choices:i,onPick:o=>{t.spec?Ci(n,t.slot,o,r.length,e):Ni(`${n}:${t.slot}`,o,r.length)}}})(),kl=Qt&&Qt.zone!==ie&&!Hi(Qt.zone)?Qt.zone:null,Sl=!0===Lt.blocksFirst,vl=kl?Wi(kl):Sl&&Qt?null:yl,xl=Boolean(Ft&&kl)||Sl&&Boolean(vl&&vl.choices.length>0),bl=Rt||null!==xt,wl=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:at&&!bl&&ao===e.id,onSelect:()=>cr(e.id)}:e,zl=[{id:"add",label:tt.add.title,icon:/* @__PURE__ */mn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:Rt,onSelect:()=>Rt?ri():ti(null)},...(so.railLead??[]).map(wl),{id:"sections",label:"Layers",icon:/* @__PURE__ */mn(Ze,{}),active:at&&!bl&&"sections"===ao,onSelect:()=>cr("sections")},...(so.railTrail??[]).map(wl)];vt?zl.push({id:"media",label:"Media library",icon:/* @__PURE__ */mn(en,{}),active:at&&!Rt&&(null!==xt||"media"===ao),onSelect:()=>cr("media")}):jn&&zl.push({id:"media",label:"Media library",icon:/* @__PURE__ */mn(en,{}),onSelect:ar});const Bl=[...so.railLead??[],...so.railTrail??[]].find(e=>"panel"in e&&e.id===ao),Cl=Boolean(nt?.foldable)&&!co,Nl=nt?.label??(Mn?tt.pageSections:tt.templateSections),$l=Cl&&Mo(xn),Tl=/* @__PURE__ */gn(yn,{children:[fr.map((e,n)=>{if(Xn(e)||qn(e)||Kn(e.type))return null;const t=_t===String(e.props.id),o=Boolean(e.props._hidden);gi(e);const r=String(e.props.id),i=so.hasOwnRows?.(e)??!1,l=wi(e)||i,s=l&&Mo(r),{rowProps:d,...c}=Zi.row({item:{id:r,zone:ie,index:n,type:e.type},place:{...ln(ie),index:n}},{"data-node-id":r,onClick:li(()=>Zr(n))});/* @__PURE__ */
28
+ return gn(hn,{children:[n>0&&fi(n),
29
+ /* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:e.type,size:13}),name:xr(e),preview:ci(e),marks:ai(e),onSelect:()=>Zr(n),nameSlot:Er(ie,n,r,xr(e)),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>Eo(r)}:void 0,actions:/* @__PURE__ */gn(yn,{children:[di(ie,n,xr(e)),pi(e,ie,n),ui(ie,n,e,xr(e))]}),rowProps:d}),wi(e)&&!s&&/* @__PURE__ */gn(xe,{children:[gl(e,1),so.partRows?.(e,ul)]}),i&&!s&&/* @__PURE__ */mn(xe,{children:so.ownRows?.(e,n,ul)})]},String(e.props.id??n))}),!co&&Mi>0&&fi(Mi),nt?.addAtEnd&&!co&&!In&&/* @__PURE__ */mn(T,{small:!0,label:tt.addSection,blocked:null,onAdd:()=>ti(Mi)})]}),Ol=(e,n,t)=>{const o=String(e.props.id),r=ki(e).length>0||Si(e)||Boolean(go(e.type)),i=r&&Mo(o),l="header"===t?tt.header:tt.footer,s=ko.rowName?ko.rowName(e,"section",l):l;/* @__PURE__ */
30
+ return gn(yn,{children:[
31
+ /* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:t,size:13}),name:s,preview:ci(e),marks:ai(e),onSelect:()=>Zr(n),nameSlot:Er(ie,n,o,s),selected:_t===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Eo(o)}:void 0,actions:pi(e,ie,n)??void 0,rowProps:{onClick:li(()=>Zr(n))}}),r&&!i&&/* @__PURE__ */mn(xe,{children:ml(e,1)})]})};return(so.wrap??(e=>e))(
32
+ /* @__PURE__ */mn(ne,{target:Pt,children:/* @__PURE__ */gn("div",{ref:It,className:"sf-editor es-editor",style:Ve(Io),onContextMenu:Hr.onEditorContextMenu,children:[
33
+ /* @__PURE__ */gn(Te,{children:[
34
+ /* @__PURE__ */mn(Oe,{items:zl,ariaLabel:"Left panel views"}),
35
+ /* @__PURE__ */gn(Ie,{children:[
36
+ /* @__PURE__ */mn(Pe,{label:"Undo",disabled:!Ln.hasPast,onClick:()=>Ln.back(),children:/* @__PURE__ */mn(_e,{})}),
37
+ /* @__PURE__ */mn(Pe,{label:"Redo",disabled:!Ln.hasFuture,onClick:()=>Ln.forward(),children:/* @__PURE__ */mn(Xe,{})}),
38
+ /* @__PURE__ */mn(Ae,{}),
39
+ /* @__PURE__ */mn(Re,{devices:ut,value:yt,onChange:kt})]}),
40
+ /* @__PURE__ */gn(Ie,{kind:"right",style:{minWidth:300},children:[
41
+ /* @__PURE__ */mn(kn,{saveState:Nn,notSaving:Boolean(In)||null!=$n,readOnlyReason:Pn,toggle:An,onToggle:On,onRetry:Tn}),so.barLead?.(),
42
+ /* @__PURE__ */mn("button",{type:"button",className:"es-btn-ghost",title:"Refresh the preview (reloads the canvas, keeps your place)",onClick:()=>{Ot.current=(()=>{const e=Pt?.document;if(!e)return null;const n=fr.findIndex(qn),t=n>=0?n:fr.length;let o=null;for(let n=0;n<t;n++){const t=fr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Dn?.props?.id??fr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Tt(e=>e+1)},children:"Refresh"}),so.barTrail?.(),so.barMain?so.barMain():/* @__PURE__ */mn("button",{type:"button",className:"es-btn-primary",disabled:null!==Pn,onClick:()=>{Cn(Fn.data)},children:tt.done})]})]}),
43
+ /* @__PURE__ */mn(z,{}),
44
+ /* @__PURE__ */gn("div",{className:"sf-body",children:[at?/* @__PURE__ */gn(yn,{children:[
45
+ /* @__PURE__ */mn("div",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:Rt?/* @__PURE__ */mn(O,{blocks:vl,blocksOnly:xl,at:Ft?{label:(e=>{const n=Hi(e.zone);if(n)return tt.add.addingTo({name:kr(n.type)});if(e.zone===ie){const n=fr[e.index];return n&&!qn(n)?tt.add.addingBefore({name:vr(n.type)}):tt.add.addingAtEnd}const t=Wi(e.zone);return t?tt.add.addingTo({name:t.parentName}):tt.add.addingHere})(Ft),onClear:()=>Vt(null)}:void 0,onAdd:e=>{const n=Qt,t=(e,n)=>{Ft&&Vt({zone:e,index:n})};if(n&&"block"!==e.kind&&Hi(n.zone))return ii(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===Zt)return void ei(e);const n=ei(e,Zt);Ft&&Dt(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===Zt)return void ni(e,n);const t=ni(e,n,Zt);Ft&&Dt(t+1)})(e.template.name,i(e.template.node));if(n&&n.zone!==ie){const o=Wi(n.zone);if(!o)return;return o.target.spec?Ci(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ni(n.zone,e.type,n.index),void t(n.zone,n.index+1)}yl?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Qi,siteWide:so.addPanelRow?.(ri),onClose:ri,onHide:sr,readOnly:Boolean(In)}):xt&&St?
46
+ /* @__PURE__ */mn(A,{panel:St,pick:xt,onHide:sr}):Bl?Bl.panel({onHide:sr,notify:Wo}):"media"===ao&&St?/* @__PURE__ */mn(A,{panel:St,pick:null,onHide:sr}):/* @__PURE__ */gn(yn,{children:[
47
+ /* @__PURE__ */mn(I,{icon:/* @__PURE__ */mn(Ze,{}),title:"Layers",context:ot,actions:Ei.length>0?/* @__PURE__ */mn(je,{label:Fi?"Expand all sections":"Collapse all sections",onClick:()=>Oo(e=>{const n=new Set(Ei);return Fi?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ei])}),children:/* @__PURE__ */mn(Sn,{expand:Fi})}):void 0,onHide:sr}),
48
+ /* @__PURE__ */gn(be,{className:"sf-tree sf-scroll",children:[
49
+ /* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:"page",size:13}),name:tt.pageSettings,onSelect:pr,selected:!Dn&&Wt,rowProps:{onClick:li(pr)}}),Ri&&/* @__PURE__ */gn(yn,{children:[
50
+ /* @__PURE__ */mn(we,{children:tt.header}),fl(Ri)]}),!co&&En&&/* @__PURE__ */gn(yn,{children:[
51
+ /* @__PURE__ */mn(we,{children:tt.header}),!et&&/* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:"header",size:13}),name:tt.header,onSelect:ur,selected:Ut.kind===_n?.kind,rowProps:{onClick:li(ur)}})]}),!co&&Ai&&Ol(Ai,Pi,"header"),!co&&!Cl&&/* @__PURE__ */mn(we,{children:Nl}),Cl?/* @__PURE__ */gn(yn,{children:[
52
+ /* @__PURE__ */mn(ve,{icon:null,name:Nl,fold:{open:!$l,label:Nl,onToggle:()=>Eo(xn)}}),!$l&&/* @__PURE__ */mn(xe,{children:Tl})]}):Tl,En&&/* @__PURE__ */mn(we,{children:tt.footer}),Ii&&Ol(Ii,Oi,"footer"),!co&&!Ii&&En&&/* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:"footer",size:13}),name:tt.footer,onSelect:si,rowProps:{onClick:li(si),title:"Edit the site footer"}}),ji&&fl(ji),so.treeFoot?.()]})]})}),
53
+ /* @__PURE__ */mn(Me,{side:"left",width:Io.left,min:Fe,max:Ee,defaultWidth:y.left,label:"Resize Sections panel",onResize:Ro})]}):/* @__PURE__ */mn(P,{side:"left",onShow:sr}),
54
+ /* @__PURE__ */gn("div",{ref:Yo,className:"sf-center sf-scroll","data-sf-canvas-head":Xo?"":void 0,style:{overflowX:rr?"auto":"hidden",overflowY:"hidden"},children:[Xo&&/* @__PURE__ */mn("div",{ref:qo,className:"sf-canvas-head",children:/* @__PURE__ */mn(Xo,{device:yt})}),
55
+ /* @__PURE__ */mn("div",{className:"sf-frame-scaler",style:ir,children:/* @__PURE__ */mn("div",{className:"sf-frame "+(yt===mt?"":`sf-frame--${yt}`),style:lr,children:/* @__PURE__ */gn("div",{className:"sf-preview-host",children:[
56
+ /* @__PURE__ */mn(rt,{},$t),
57
+ /* @__PURE__ */mn(He,{canvas:Pt,session:Qi,model:tl,measure:rl,canDrop:ll,onDrop:dl,onPick:al,onZoneAdd:e=>oi(tn(e),0),readOnly:Boolean(In),revision:Fn.data}),Gt.length>0&&/* @__PURE__ */mn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:Gt.map(e=>/* @__PURE__ */gn("button",{type:"button",tabIndex:-1,className:"sf-preview-gap",style:{top:e.top},title:"Add section here",onClick:()=>ti(e.index),children:[
58
+ /* @__PURE__ */mn("span",{className:"sf-preview-gap-line"}),
59
+ /* @__PURE__ */gn("span",{className:"sf-preview-gap-pill",children:[
60
+ /* @__PURE__ */mn("span",{className:"sf-preview-gap-plus",children:"+"}),
61
+ /* @__PURE__ */mn("span",{className:"sf-preview-gap-label",children:"Add section"})]})]},e.index))})]})})})]}),pt?/* @__PURE__ */gn(yn,{children:[
62
+ /* @__PURE__ */mn(m,{value:{selectChild:Bi,addChild:Ci,childRowName:jr,blockRowName:Vi},children:/* @__PURE__ */mn(it,{mode:Ut,onOpenWebsiteSettings:so.openSettings??(()=>{}),onOpenSiteStyles:so.openStyles,onSelectNode:zo,onNotify:Wo,onHidePanel:dr,nodeActions:Dn?le(Hn,Dn.type):bn})}),
63
+ /* @__PURE__ */mn(Me,{side:"right",width:Io.right,min:Fe,max:Ee,defaultWidth:y.right,label:"Resize settings panel",onResize:jo})]}):
64
+ /* @__PURE__ */mn(P,{side:"right",onShow:dr})]}),Do&&/* @__PURE__ */gn("div",{className:"sf-toast "+("error"===Do.tone?"sf-toast--error":""),role:"status",children:[
65
+ /* @__PURE__ */mn("span",{className:"sf-toast-check","aria-hidden":"true",children:"error"===Do.tone?"!":"✓"}),Do.msg]},Ho),Hr.menu]})}))}export{wn as ScreenChrome};
@@ -1 +1 @@
1
- import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-M6F6LS3H.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as r}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-ZWK3CBRU.js";import{DEFAULT_CANVAS_WORDS as m}from"./chunk-AELNNAFM.js";import{DEFAULT_TREE_WORDS as n}from"./chunk-3EDSDPIP.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-QTLAVDJE.js";import{DEFAULT_NODE_MENU_WORDS as s}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as f}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as e}from"./chunk-ZJEBF4NB.js";import{DEFAULT_LOCK_WORDS as i}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as u}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as k}from"./chunk-UH7IGZKF.js";import{DEFAULT_PICK_WORDS as j}from"./chunk-ZAOM6PFH.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-FPOKPNO4.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-O2NLQBFX.js";var F={notice:e,lock:i,save:f,chrome:p,rail:u,tree:n,panel:c,fields:h,pick:j,drag:l,menu:s,styleClipboard:r,copy:k,canvas:m,textStyles:o,screen:t},a=o=>"object"==typeof o&&null!==o;function y(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:a(n)?t[m]=a(c)?y(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function P(o,r){return r?y(o,r):o}export{F as DEFAULT_EASEL_STRINGS,P as mergeEaselStrings};
1
+ import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-M6F6LS3H.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as r}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-PQXIFBDY.js";import{DEFAULT_CANVAS_WORDS as m}from"./chunk-AELNNAFM.js";import{DEFAULT_TREE_WORDS as n}from"./chunk-3EDSDPIP.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-QTLAVDJE.js";import{DEFAULT_NODE_MENU_WORDS as s}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as f}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as e}from"./chunk-ZJEBF4NB.js";import{DEFAULT_LOCK_WORDS as i}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as u}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as k}from"./chunk-UH7IGZKF.js";import{DEFAULT_PICK_WORDS as j}from"./chunk-ZAOM6PFH.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-FPOKPNO4.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-O2NLQBFX.js";var F={notice:e,lock:i,save:f,chrome:p,rail:u,tree:n,panel:c,fields:h,pick:j,drag:l,menu:s,styleClipboard:r,copy:k,canvas:m,textStyles:o,screen:t},a=o=>"object"==typeof o&&null!==o;function P(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:a(n)?t[m]=a(c)?P(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?P(o,r):o}export{F as DEFAULT_EASEL_STRINGS,y as mergeEaselStrings};
@@ -1,4 +1,4 @@
1
- import{PanelToggleIcon as e}from"./chunk-KQMML6JM.js";import{InspectorHead as i,InspectorIconButton as n}from"./chunk-6DJHRLCU.js";import{jsx as t,jsxs as l,Fragment as o}from"react/jsx-runtime";function d({icon:e,title:n,context:d,actions:s,side:a="left",onHide:c}){/* @__PURE__ */
1
+ import{PanelToggleIcon as e}from"./chunk-KQMML6JM.js";import{InspectorHead as i,InspectorIconButton as n}from"./chunk-YC4TB3CJ.js";import{jsx as t,jsxs as l,Fragment as o}from"react/jsx-runtime";function d({icon:e,title:n,context:d,actions:s,side:a="left",onHide:c}){/* @__PURE__ */
2
2
  return t(i,{icon:e,name:n,kind:d,actions:s||c?/* @__PURE__ */l(o,{children:[s,c?/* @__PURE__ */t(r,{side:a,onHide:c,divider:Boolean(s)}):null]}):void 0})}function r({side:i,onHide:d,divider:r=!1}){/* @__PURE__ */
3
3
  return l(o,{children:[r?/* @__PURE__ */t("span",{className:"sf-head-divider","aria-hidden":"true"}):null,
4
4
  /* @__PURE__ */t(n,{label:`Hide the ${i} panel`,title:"Hide panel",onClick:d,children:/* @__PURE__ */t(e,{side:i})})]})}function s({side:i,onShow:l}){/* @__PURE__ */
@@ -0,0 +1,2 @@
1
+ import{styleMenuItems as e}from"./chunk-57DJOKXT.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{EaselContextMenu as l}from"./chunk-KTVH2ZRL.js";import{createNodeClipboard as i,nodeMenuItems as r}from"./chunk-2LK54I4E.js";import{useCanvasEvent as c}from"./chunk-PAELDYYS.js";import{isTypingTarget as s,framePointToHost as a}from"./chunk-ZNCEOSXO.js";import{UndoIcon as u,RedoIcon as d,AddIcon as p,PasteIcon as f,SettingsIcon as m,LayersIcon as y,CopyIcon as h}from"./chunk-L5KW4HG5.js";import{zoneKey as k,ROOT_SLOT as b,ROOT_ID as v}from"./chunk-KRXQM65X.js";import{useState as x,useCallback as g,useRef as C,useEffect as P}from"react";import{jsx as z}from"react/jsx-runtime";function O(e,n){const o=[],l=/* @__PURE__ */new Set;let i={zone:n.zone,index:n.index};for(;i;){const n=e.nodeAt(i.zone,i.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:i.zone,index:i.index,node:n,parentType:null}),i.zone===t)break;const r=i.zone.lastIndexOf(":");if(r<=0)break;i=e.locate(i.zone.slice(0,r))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var w=i(),A=/* @__PURE__ */new WeakMap;function K(e){if(e.claimsPage)return w;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",i);let t=A.get(n);return t||(t=i(),A.set(n,t)),t}function D(){return K(n())}function T(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:v,slot:b,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function j(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),i=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&i.duplicate,cut:l&&i.duplicate&&i.delete}}function E(e,n,t){const o=e.canPasteAt;if(!o)return k(n.from)===t.zone?T(e,t.zone,t.index+1):null;for(const l of O(e,t)){const t=T(e,l.zone,l.index+1);if(o(n,t))return t}return null}function L(e){if(e.defaultPrevented||e.altKey||e.shiftKey||!e.metaKey&&!e.ctrlKey)return null;if(s(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function M(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const i=l.props.id,r=e.labelOf(l.type,t.zone),c=j(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(i,r),{done:"copied",name:r}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(i,r),{done:"cut",name:r}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:E(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function S(n,o){const{zone:l,index:i}=o,c=n.nodeAt(l,i);if(!c)return[];const s=c.props.id,a=n.labelOf(c.type,l),u=Boolean(c.props._hidden),d=n.nodeOps,p=n.isPinned(c,l),f=n.isLocked(c),m=!p&&!f&&!n.duplicateBlocked(c),y=n.permits?.(c)??{duplicate:!0,delete:!0},h=j(n,c,l),k=O(n,o),b=d.held,v=b&&!p?E(n,b,o):null,x=n.style?e({held:n.style.held(),canCopy:n.style.canCopy(c,l),onCopy:()=>n.style?.copy(c,l),onPaste:()=>n.style?.paste(l,i,c)}):[];return r({title:a,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},i=e.zone===t?null:n.slotRung?.(e.zone)??null;return i?[l,{label:i.label,checked:!1,onClick:i.select}]:[l]})},actions:{addInside:n.canAddTo(c.type)?()=>n.openAddInside(l,i):void 0,duplicate:m&&y.duplicate?()=>d.duplicate(s):void 0,moveUp:d.canStep(s,-1)?()=>d.step(s,-1):void 0,moveDown:d.canStep(s,1)?()=>d.step(s,1):void 0,copy:h.copy?()=>d.copy(s,a):void 0,cut:h.cut?()=>d.cut(s,a):void 0,paste:b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:n.renamePropOf(c,l)?()=>n.beginRename(l,i):void 0,hide:f||p?void 0:{hidden:u,run:()=>d.setProps(s,{_hidden:!u})},delete:m&&y.delete?()=>d.remove(s):void 0},style:x,extras:n.menuRows?.(c,l,i)??void 0,pinnedLine:p?"Pinned — can’t be moved or deleted":void 0})}function X(e){const n=[];e.history.hasPast&&n.push({label:"Undo",icon:/* @__PURE__ */z(u,{}),shortcut:"⌘Z",onClick:e.history.back}),e.history.hasFuture&&n.push({label:"Redo",icon:/* @__PURE__ */z(d,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const o=[{label:"Add section",icon:/* @__PURE__ */z(p,{}),onClick:e.openAddSection}],l=e.nodeOps.held,i=T(e,t,e.sectionBand().cap);if(l&&(e.canPasteAt?e.canPasteAt(l,i):k(l.from)===t)){const n=i;o.push({label:`Paste ${l.label}`,icon:/* @__PURE__ */z(f,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const r=[n,o,[{label:"Page settings",icon:/* @__PURE__ */z(m,{}),onClick:e.openPageSettings},{label:"Collapse all layers",icon:/* @__PURE__ */z(y,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),c={label:"—",onClick:()=>{}};return r.flatMap((e,n)=>n?[c,...e]:e)}function I(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),i=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},r=[];l&&(r.push({label:"Copy",icon:/* @__PURE__ */z(h,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),r.push({label:"Cut",icon:/* @__PURE__ */z(h,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),i("")}})),r.push({label:"Paste",icon:/* @__PURE__ */z(f,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&i(e)}).catch(()=>e.onPasteRefused())}});const c=[r,n.value?[{label:"Select all",shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),s={label:"—",onClick:()=>{}};return c.flatMap((e,n)=>n?[s,...e]:e)}function R(e){return e.shiftKey}function Y(e,n){const[t,l]=x(null),i=g(()=>l(null),[]);o(null!==t,i);const r=C(e);r.current=e;const s=g(e=>{const n=r.current,t=n.keys;if(!t)return;const o=L(e);if(!o)return;const l=t.selected();if(!l)return;const i=M(n,o,l,{readOnly:t.readOnly,held:t.held()});i&&(e.preventDefault(),t.onDone?.(i))},[]),u=e.keys?.target??null;P(()=>{if(!u)return;const e=e=>s(e);return u.addEventListener("keydown",e),()=>u.removeEventListener("keydown",e)},[u,s]),c(n,"keydown",s);const d=g(n=>{if(R(n))return;const t=n.target,o=function(e){const n=e?.closest?.("input, textarea");return n?n instanceof HTMLInputElement&&!["text","search","url","email","tel","number",""].includes(n.type)?null:n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o});const i=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),r=i?e.locate(i):null;n.preventDefault(),l(r?{kind:"node",x:n.clientX,y:n.clientY,...r}:{kind:"empty",x:n.clientX,y:n.clientY})},[e]);c(n,"contextmenu",t=>{if(R(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,i=o?.getAttribute("data-puck-component"),r=i?e.locate(i):null;t.preventDefault();const c=a(n.frame,t.clientX,t.clientY);l(r?{kind:"node",...c,...r}:{kind:"empty",...c})}),c(n,"mousedown",i),c(n,"scroll",i,{on:"window"});return{onEditorContextMenu:d,menu:t?/* @__PURE__ */z(V,{host:e,target:t,onClose:i}):null,closeMenu:i}}function V({host:e,target:n,onClose:t}){/* @__PURE__ */
2
+ return z(l,{x:n.x,y:n.y,items:"node"===n.kind?S(e,n):"input"===n.kind?I(e,n.el):X(e),onClose:t})}export{w as EASEL_NODE_CLIPBOARD,O as ancestorChain,K as nodeClipboardOf,j as nodeClipboardRules,S as nodeMenuItems,L as nodeShortcut,X as pageMenuItems,E as pastePlace,M as runNodeShortcut,I as textMenuItems,D as useNodeClipboard,Y as useNodeContextMenu};
@@ -0,0 +1,2 @@
1
+ import{routeSharedHostMessage as e}from"./chunk-S4AWJX4Q.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s}from"./chunk-CLOS6SSX.js";import{useAdminBridge as i}from"./chunk-3P6AMTOS.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{backendOf as c,setSessionDocumentSite as d}from"./chunk-RSCMJIWS.js";import{useEaselHost as f}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-PQXIFBDY.js";import{useAutosave as g}from"./chunk-BDTITTMW.js";import{canWriteDocument as k,newEaselClientId as v,reloadIfVersionMoved as p,openUnansweredClaim as h,FAIL_OPEN_RETRY_MS as y,CLAIM_FAIL_OPEN_MS as S,holderOf as w}from"./chunk-THWO5YVZ.js";import{useWords as b}from"./chunk-MFIRYGHW.js";import{createContext as I,useContext as P,useState as j,useMemo as T,useCallback as B,useEffect as O,useRef as R}from"react";import{jsx as C}from"react/jsx-runtime";var E={content:[],root:{},zones:{}};var H=I(null);function M(){const e=P(H);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function A({target:I,addressing:P=o,onHostMessage:M,children:A}){const D=P,{homeSlug:F,entryMayBounce:L,entryBounce:V,onSwitch:W,tellsHost:N,adapterFor:X,migrateRenamedProps:Y,describeMissing:J,onLoadFailed:x}=D,[G,Q]=j(I),U=f(),Z=l(),K=T(()=>c(Z),[Z]),z=T(()=>t(Z),[Z]),_="template"===G.kind,q="template"===G.kind?G.id:null,$="template"===G.kind?G.pageSlug??F??"":"document"===G.kind?G.slug??"":G.slug,ee="page"===G.kind?G.siteId??null:null,re=Z.blocks,ne=T(()=>X(G,K,re),[X,K,re,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),te=ne.capabilities,oe=B(e=>Z.documentHooks?.stored?.(e)??e,[Z]),ue="page"===G.kind?G.originSlug??null:null;O(()=>{d(Z,ee)},[Z,ee]);const ae=R(G);O(()=>{ae.current=G},[G]);const{token:se,tokenRef:ie,capabilities:le}=i({onMessage:r=>{if(M?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Pr(e.target)}}}),ce=!Z.usesBridgedToken||null!==se,de=ne.lock,fe=Boolean(K.lock),[me,ge]=j(null),[ke,ve]=j(null),[pe,he]=j(null),[ye,Se]=j(null),we=b("screen",m),be=ye?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(ye,we):null,[Ie,Pe]=j(null),je=R(null),Te=R(null),[Be,Oe]=j(!1),Re=R(null),[Ce,Ee]=j(null),He=R(null),[Me,Ae]=j(null),De=R(null);O(()=>{De.current=Me},[Me]);const[Fe,Le]=j(te.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ve=R(Fe);O(()=>{Ve.current=Fe},[Fe]);const We=R(()=>Promise.resolve(!1)),Ne=B(e=>{Te.current=e,Oe(!0)},[]),Xe=g({save:async({id:e,data:r})=>{if(k(Ve.current)){if(!await We.current(e,r)){if(!k(Ve.current))return void Ne({id:e,data:r});throw new Error("page save did not land")}}else Ne({id:e,data:r})},onFailure:(e,r)=>{0===r&&U.send("storefront-editor:save-failed")}}),{state:Ye,push:Je,flush:xe,pause:Ge,resume:Qe,stop:Ue,reset:Ze,retryNow:Ke,hasPending:ze}=Xe,_e=R(Ye);O(()=>{_e.current=Ye},[Ye]);const qe=u(Ye),$e=B(()=>{const e=Te.current;e&&(Te.current=null,Oe(!1),Je(e))},[Je]),er=R("");er.current||(er.current=v());const[rr,nr]=j(0),tr=R(!1),[or,ur]=j(L(I)),ar=R(!1);O(()=>{if(ar.current)return;ar.current=!0;const e=U.address.search(),r=V(I,e);r?U.address.load(r):L(I)&&ur(!1)},[I,U]);const sr=U.send;O(()=>{if(!ce)return;let e=!1;const t=ae.current,o=ne.resolve($),u=Z.documentHooks?.opening?.({slug:$,isTemplate:_,capabilities:te});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==F&&$!==F?void U.address.load({kind:"page",slug:F,siteId:ee??void 0}):(Se({target:t,slug:$,missing:!0,sentence:J?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;je.current=n,Pe(n),ge(r.id),ve(r.kind??null),He.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:E,s=Y(a),i=u?await u(s):s;e||he(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),Se({target:t,slug:$,missing:!1,sentence:n(o,{slug:$},Z),cause:r(o,Z)}),x?.(t,o))}),()=>{e=!0}},[ce,se,_,ne,$]);const ir=B(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=ie.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),lr=B(async e=>{const r=ie.current;if(!r&&Z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,Z)){sr("storefront-editor:auth-expired");const n=r?await ir(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[sr,ir,Z]),cr=B(async e=>{const r=ie.current?await lr(e):{ok:!1};return r.ok||sr("storefront-editor:save-failed"),r.ok},[sr,lr]),dr=B(async(e,r,n=!1)=>{if(null!==je.current)return!1;if(!k(Ve.current))return!1;if(De.current)return!1;const t=await lr(()=>ne.saveLayout(e,r,He.current,er.current));if(t.ok)return He.current=t.value.version??He.current,!0;const o=z.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ve.current=e,Le(e),!1}const u=z.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&ne.rereadVersion){const n=await lr(()=>ne.rereadVersion(e));if(n.ok&&n.value)return He.current=n.value,We.current(e,r,!0)}Ue(),De.current=u,Ae(u)}return!1},[ne,lr,Ue]);O(()=>{We.current=dr},[dr]);const fr=B(e=>{if(null!==je.current)return;if(sr("storefront-editor:dirty"),!me)return;const r=oe(e);Re.current=r,k(Ve.current)?Je({id:me,data:r}):Ne({id:me,data:r})},[me,sr,Ne,Je,oe]),mr=B(async()=>{k(Ve.current)&&$e();return await xe()&&null==Te.current},[$e,xe]),gr=R(mr);O(()=>{gr.current=mr},[mr]);const kr=R(lr);O(()=>{kr.current=lr},[lr]);const vr=B(()=>{U.address.reload()},[U]),pr=R(()=>Promise.resolve(!1));O(()=>{pr.current=()=>{const e=ne.rereadVersion;return me&&e?p({ours:He.current,stored:async()=>{const r=await kr.current(()=>e(me));return r.ok?r.value:null},hasPending:()=>null!=Te.current||ze(),reload:vr}):Promise.resolve(!1)}},[ne,me,ze,vr]);const hr=null!==Ie;O(()=>{if(!de||!me||!ce||hr)return;let e=!1,r=null,n=null;const t=er.current,o={claim:async e=>{const r=await kr.current(()=>de.claim(me,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ve.current,heldWrite:()=>({pending:null!=Te.current||ze(),autoSaveEnabled:!_e.current.paused,saveConflict:null!=De.current}),setAccess:e=>{Ve.current=e,Le(e)},releaseHeldWrite:()=>{gr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{pr.current()}},u=z.makeClaimBeat(o),a=tr.current;return tr.current=!1,a||(Le({kind:"checking"}),n=setTimeout(()=>{n=null,h(o)&&o.startHeartbeat(y)},S)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),de.release(me,t).catch(()=>{})}},[me,de,ce,se,rr,hr]);const yr=B(()=>{de&&me&&(tr.current=!0,nr(e=>e+1))},[me,de]),Sr=B(()=>{Le(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),wr=B(()=>{_e.current.paused?(k(Ve.current)&&$e(),Qe()):Ge()},[$e,Ge,Qe]),br=B(()=>{Ke()},[Ke]),Ir=B(e=>{Re.current=null,a("template"!==e.kind&&fe,{resetAutosave:()=>{Ze(),Te.current=null,Oe(!1)},setVersion:e=>{He.current=e},setSaveConflict:Ae,setAccess:Le}),W(e),Q(e),je.current=null,Pe(null),ge(null),ve(null),he(null),Se(null),U.address.show(e),"document"!==e.kind&&N(e)&&U.send("storefront-editor:navigated",{target:e})},[Ze,U,fe,W,N]),Pr=B(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,ae.current,F))return;const r=null!=Te.current;if(!r&&!ze())return void Ir(e);const n=_e.current;r||n.paused||n.failed||n.stopped?Ee(e):xe().then(r=>{r?Ir(e):Ee(e)})},[Ir,ze,xe,F]),jr=B(()=>Ee(null),[]),Tr=B(()=>{Ee(e=>(e&&Ir(e),null))},[Ir]),Br=B(async()=>{const e=Ce;if(!e)return;await mr()&&(Ee(null),Ir(e))},[Ce,mr,Ir]),Or=B(async e=>{if(null!==je.current)return;if(!me)return;if(!k(Ve.current)||De.current)return;const r=oe(e);if(!await dr(me,r))return void(De.current||sr("storefront-editor:save-failed"));const n=ne.publish;if(!te.canPublish||!n)return void sr("storefront-editor:saved");const t=await lr(()=>n(me,He.current??void 0));t.ok?(He.current=t.value.version??He.current,sr("storefront-editor:published")):sr("storefront-editor:save-failed")},[me,ne,te.canPublish,sr,dr,lr,oe]);/* @__PURE__ */
2
+ return C(H.Provider,{value:{target:G,adapter:ne,capabilities:te,templateId:q,currentSlug:$,currentKind:ke,siteId:ee,ready:ce,token:se,tokenRef:ie,notifyParent:sr,bridgeCapabilities:le,runAuthed:cr,docId:me,data:pe,getLiveData:()=>Re.current??pe,footerOriginSlug:ue,error:be,redirecting:or,saveStatus:qe,saveState:Ye,autoSaveEnabled:!Ye.paused,autoSaveStoppedByConflict:Ye.stopped,hasUnsavedEdits:Ye.pending||Be,toggleAutoSave:wr,retrySave:br,onChange:fr,flushSave:mr,onPublish:Or,access:Fe,readOnly:null!==w(Fe)||null!==Ie,readOnlyReason:Ie,takeOverEditing:yr,viewReadOnly:Sr,saveConflict:Me,reloadFromServer:vr,navigate:Pr,pendingNav:Ce,cancelPendingNav:jr,discardAndNavigate:Tr,saveAndNavigate:Br},children:A})}export{H as ScreenDocumentContext,A as ScreenDocumentProvider,M as useScreenDocument};
@@ -0,0 +1 @@
1
+ import{WebsiteBackendError as e}from"./chunk-KCOBHPN6.js";import{backendOf as s}from"./chunk-RSCMJIWS.js";var r=()=>Promise.reject(new e("unavailable","This editor's backend keeps no section templates.")),t={list:()=>Promise.resolve([]),get:()=>Promise.resolve(null),ensure:r,save:r,update:r,rename:r,remove:r},a=e=>s(e).sectionTemplates??t,n=e=>({list:()=>a(e).list(),get:s=>a(e).get(s),ensure:(s,r,t)=>a(e).ensure(s,r,t),save:(s,r)=>a(e).save(s,r),update:(s,r)=>a(e).update(s,r),rename:(s,r)=>a(e).rename(s,r),remove:s=>a(e).remove(s)}),o=n();function m(e){return e.cache("easel:section-templates",()=>n(e))}export{o as sectionTemplates,m as sectionTemplatesOf};
@@ -0,0 +1 @@
1
+ import{readHostFailure as e,isBackendError as n,STATUS_UNREACHABLE as s}from"./chunk-KCOBHPN6.js";import{EDIT_LOCK_TAKEN as t}from"./chunk-THWO5YVZ.js";var a="page_changed_elsewhere",d={unauthorized:401,"changed-elsewhere":409,"lock-taken":409,"not-found":404,invalid:400,unavailable:s};function o(s,o){const c=e(s,o);if(c)return{status:c.status,data:c.data};if(!n(s))return null;const u=e(s.cause,o);if(u)return{status:u.status,data:u.data};const r=d[s.kind];return"changed-elsewhere"===s.kind?{status:r,data:{code:a,saved_by:s.conflict?.savedBy??"",saved_by_you:!0===s.conflict?.savedByYou,seconds_ago:s.conflict?.secondsAgo??0}}:"lock-taken"===s.kind?{status:r,data:{code:t,holder_name:s.holder?.name??"",seconds_since_seen:s.holder?.secondsSinceSeen??0,seconds_since_held:s.holder?.secondsSinceHeld??0}}:{status:r,data:null}}function c(e,n){return 401===o(e,n)?.status}export{a as PAGE_CONFLICT_CODE,c as isExpiredSession,o as readEaselFailure};
@@ -0,0 +1 @@
1
+ import{isBackendError as e,readHostFailure as s,STATUS_UNREACHABLE as t,hostUnreachableMessage as n,hostLoadRefusalOf as a}from"./chunk-KCOBHPN6.js";var i={unauthorized:"the editor's sign-in was refused (unauthorized).","changed-elsewhere":"the page changed while it was being opened (changed-elsewhere).","lock-taken":"somebody else holds this page (lock-taken).","not-found":"this page no longer exists (not-found).",invalid:"the backend refused the request (invalid).",unavailable:"the backend could not be reached (unavailable)."};function o(a,r){if(e(a))return s(a.cause,r)?o(a.cause,r):`${i[a.kind]} ${a.message}`.trim();const u=s(a,r);return u?u.status===t?`${n(r)} (no response)`:401===u.status||403===u.status?`the editor's sign-in was refused (${u.status}). Reload the console and open the editor again; if it keeps happening the bridged token is not valid for this site.`:404===u.status?"this page no longer exists (404).":u.status>=500?`the server failed (${u.status}). ${u.message}`:`the server refused the request (${u.status}). ${u.message}`:a instanceof Error?`${a.name}: ${a.message}`:String(a)}function r(e,s,t){return a(e,s,t)}export{o as describeLoadFailure,r as hostLoadRefusal};
@@ -0,0 +1 @@
1
+ import{PAGE_CONFLICT_CODE as e,readEaselFailure as r}from"./chunk-CLOS6SSX.js";import{createEditLock as o}from"./chunk-THWO5YVZ.js";var c=o({readFailure:r,conflictCode:e});function i(i){return i.hostFailures?i.cache("easel:edit-lock",()=>o({readFailure:e=>r(e,i),conflictCode:e})):c}export{i as editLockOf,c as pageEditLock};
@@ -1 +1 @@
1
- import{accessForNewDocument as e}from"./chunk-JUQ6YJCG.js";function n(e){return e.failed?"error":e.pending?"saving":e.saved?"saved":"idle"}function t(e){return"idle"}function r(n,t){t.resetAutosave(),t.setVersion(null),t.setSaveConflict(null),t.setAccess(e(n))}export{r as resetForDocumentSwitch,t as saveStatusForNewDocument,n as saveStatusOf};
1
+ import{accessForNewDocument as e}from"./chunk-THWO5YVZ.js";function n(e){return e.failed?"error":e.pending?"saving":e.saved?"saved":"idle"}function t(e){return"idle"}function r(n,t){t.resetAutosave(),t.setVersion(null),t.setSaveConflict(null),t.setAccess(e(n))}export{r as resetForDocumentSwitch,t as saveStatusForNewDocument,n as saveStatusOf};
@@ -1 +1 @@
1
- import{newNodeId as t}from"./chunk-FUDHI5I4.js";function o(t){return{root:{props:{}},content:[t],zones:{}}}function n(t){return(t.content??[])[0]??null}function r(t){return Array.isArray(t)&&t.length>0&&t.every(t=>!!t&&"object"==typeof t&&"string"==typeof t.type&&"object"==typeof t.props)}function e(o){const n={...o.props,id:t(o.type)};for(const[t,o]of Object.entries(n))r(o)&&(n[t]=o.map(e));return{type:o.type,props:n}}export{e as cloneNodeWithFreshIds,n as docToNode,o as nodeToDoc};
1
+ import{newNodeId as t}from"./chunk-PLVEGYK6.js";function o(t){return{root:{props:{}},content:[t],zones:{}}}function n(t){return(t.content??[])[0]??null}function r(t){return Array.isArray(t)&&t.length>0&&t.every(t=>!!t&&"object"==typeof t&&"string"==typeof t.type&&"object"==typeof t.props)}function e(o){const n={...o.props,id:t(o.type)};for(const[t,o]of Object.entries(n))r(o)&&(n[t]=o.map(e));return{type:o.type,props:n}}export{e as cloneNodeWithFreshIds,n as docToNode,o as nodeToDoc};
@@ -1 +1 @@
1
- var e=class extends Error{kind;conflict;holder;fields;constructor(e,r,s={}){super(r??n[e],void 0===s.cause?void 0:{cause:s.cause}),this.name="WebsiteBackendError",this.kind=e,this.conflict=s.conflict,this.holder=s.holder,this.fields=s.fields}},n={unauthorized:"The editor's sign-in was refused.","changed-elsewhere":"This page was changed somewhere else.","lock-taken":"Somebody else is editing this page.","not-found":"This no longer exists.",invalid:"The request was refused.",unavailable:"The server could not be reached."};function r(e,n){if(!e||"object"!=typeof e)return!1;const r=e;return"WebsiteBackendError"===r.name&&"string"==typeof r.kind&&(void 0===n||r.kind===n)}var s=0,i=null;function o(e){i=e}function t(e){return i?.read(e)??null}function d(e,n){return i?.loadRefusal?.(e,n)??null}function a(){return i?.unreachableMessage??"The server could not be reached."}export{s as STATUS_UNREACHABLE,e as WebsiteBackendError,d as hostLoadRefusalOf,a as hostUnreachableMessage,r as isBackendError,o as provideHostFailures,t as readHostFailure};
1
+ var e=class extends Error{kind;conflict;holder;fields;constructor(e,r,s={}){super(r??n[e],void 0===s.cause?void 0:{cause:s.cause}),this.name="WebsiteBackendError",this.kind=e,this.conflict=s.conflict,this.holder=s.holder,this.fields=s.fields}},n={unauthorized:"The editor's sign-in was refused.","changed-elsewhere":"This page was changed somewhere else.","lock-taken":"Somebody else is editing this page.","not-found":"This no longer exists.",invalid:"The request was refused.",unavailable:"The server could not be reached."};function r(e,n){if(!e||"object"!=typeof e)return!1;const r=e;return"WebsiteBackendError"===r.name&&"string"==typeof r.kind&&(void 0===n||r.kind===n)}var s=0,i=null,o=e=>e?.hostFailures??i;function t(e){i=e}function a(e,n){return o(n)?.read(e)??null}function d(e,n,r){return o(r)?.loadRefusal?.(e,n)??null}function l(e){return o(e)?.unreachableMessage??"The server could not be reached."}export{s as STATUS_UNREACHABLE,e as WebsiteBackendError,d as hostLoadRefusalOf,l as hostUnreachableMessage,r as isBackendError,t as provideHostFailures,a as readHostFailure};
@@ -0,0 +1 @@
1
+ import{mediaPickStoreFor as e}from"./chunk-R6WTQWAC.js";var t=/* @__PURE__ */new Map,n=0;function o(o,i){if(!o.connected)return Promise.resolve(null);const r=(n+=1,`mp-${"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():String(n)}`),c=e(o);return c?c.request({requestId:r,accept:i.accept,title:i.title,file:i.file??null,...i.options?{options:i.options}:{}}):new Promise(e=>{t.set(r,e),o.send("storefront-editor:open-media-picker",{requestId:r,accept:i.accept,title:i.title,...i.file?{file:i.file}:{}})})}function i(e,n){const o=t.get(e);o&&(t.delete(e),o(n))}export{o as requestMediaPick,i as resolveMediaPick};
@@ -0,0 +1,5 @@
1
+ import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as n,paletteWithoutPinned as o,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-5ZBBXZPV.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-VSHV6KJQ.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-PQXIFBDY.js";import{useEasel as u}from"./chunk-P67FP7PG.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as h}from"./chunk-TTJ54QGG.js";import{AddIcon as k}from"./chunk-L5KW4HG5.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{jsx as g,jsxs as B,Fragment as V}from"react/jsx-runtime";var $=e=>`section:${e}`,v=e=>`block:${e}`,O=e=>`template:${e}`;function P({blocks:P,blocksOnly:x,at:H,onAdd:I,itemFor:F,session:G,siteWide:L,onClose:Q,onHide:T,readOnly:A}){const D=u(e=>e.config),N=p(),{labelAtLevel:C,categoryLabel:J,firstSection:K,Icon:R,Thumbnail:S}=N,{blockIsOffered:W}=m(),Y=f("screen",d).add,Z=l(),[w,z]=y([]);b(()=>{let t=!1;const n=e=>W(e,Z);return s(Z).list().then(o=>{if(t)return;const i=D.components;z(o.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(n)))}).catch(()=>{}),()=>{t=!0}},[D,Z]);const X=j(()=>t(D,N),[D]),E=e=>({type:$(e.type),label:e.name,cover:/* @__PURE__ */g(S,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Y.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),M=j(()=>{const e=[];if(P&&P.choices.length>0&&a(P.choices).forEach((t,n)=>{e.push({title:0===n?`${Y.inside({name:P.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */g(R,{type:e.type,size:18}),title:Y.tile({name:e.label})}))})}),x)return e;const t=n(X,K);t&&e.push({title:Y.startBlank,tiles:[E(t)]}),w.length>0&&e.push({title:Y.templates,tiles:w.map(e=>{return{type:O(e.id),label:e.name,cover:/* @__PURE__ */g(S,{type:e.node.type}),keywords:[(t=e.node.type,C(t,"section",D.components[t]?.label??t)),e.node.type]};var t})});const s=o(X,K);for(const t of Object.keys(D.categories??{})){const n=s.filter(e=>e.cat===t);0!==n.length&&e.push({title:i(D,t,J),tiles:n.map(E)})}return e},[P,x,w,X,D,Y]),q=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=w.find(e=>e.id===o);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
2
+ return B(V,{children:[
3
+ /* @__PURE__ */g(r,{icon:/* @__PURE__ */g(k,{size:15}),title:Y.title,context:x?Y.contextBlocks:Y.contextAll,actions:/* @__PURE__ */g(c,{label:Y.done,description:Y.doneDescription,onClick:Q}),onHide:T}),
4
+ /* @__PURE__ */B("div",{className:"sf-addside sf-scroll",children:[
5
+ /* @__PURE__ */g(h,{groups:M,session:G,itemFor:e=>F(q(e)??{kind:"section",type:e}),onInsert:e=>{const t=q(e);t&&I(t)},at:H,hint:x?Y.hintBlocks:Y.hint,searchLabel:x?Y.searchBlocks:Y.searchSections,readOnly:A}),L&&!x?L:null]})]})}export{P as AddSidePanel,v as blockKey,$ as sectionKey,O as templateKey};
@@ -0,0 +1,4 @@
1
+ import{useScreenOwnerName as e}from"./chunk-VSHV6KJQ.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-YC4TB3CJ.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
2
+ return o(r,{children:[
3
+ /* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
4
+ /* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
@@ -1 +1 @@
1
- import{activateEaselSession as r,deactivateEaselSession as n,currentEaselSession as e}from"./chunk-AJBJ74ME.js";import{createContext as o,useEffect as t,useContext as i}from"react";import{jsx as u}from"react/jsx-runtime";var c=o(null);function m({session:e,children:o}){return r(e),t(()=>(r(e),()=>n(e)),[e]),/* @__PURE__ */u(c.Provider,{value:e,children:o})}function f(){return i(c)??e()}export{m as EaselSessionProvider,f as useEaselSession};
1
+ import{activateEaselSession as r,deactivateEaselSession as n,currentEaselSession as e}from"./chunk-RSCMJIWS.js";import{createContext as o,useEffect as t,useContext as i}from"react";import{jsx as u}from"react/jsx-runtime";var c=o(null);function m({session:e,children:o}){return r(e),t(()=>(r(e),()=>n(e)),[e]),/* @__PURE__ */u(c.Provider,{value:e,children:o})}function f(){return i(c)??e()}export{m as EaselSessionProvider,f as useEaselSession};