efficient-easel 21.0.0 → 21.1.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 (233) hide show
  1. package/README.md +15 -3
  2. package/dist/{CanvasDragLayer-Cd1o0HQf.d.ts → CanvasDragLayer-CFUcBbgc.d.ts} +1 -1
  3. package/dist/{ScreenDocumentContext-CFJeqqKk.d.ts → ScreenDocumentContext-1RgtGKWR.d.ts} +4 -0
  4. package/dist/blocks/index.d.ts +5 -3
  5. package/dist/{buckets-Tj-nkBpg.d.ts → buckets-Sw94ll9I.d.ts} +1 -1
  6. package/dist/canvas/index.d.ts +8 -6
  7. package/dist/canvas/index.js +1 -1
  8. package/dist/chunk-2C7W64S5.js +8 -0
  9. package/dist/chunk-2L6KWUBC.js +1 -0
  10. package/dist/chunk-467WWV4I.js +1 -0
  11. package/dist/chunk-4FD7TAOE.js +1 -0
  12. package/dist/chunk-67HCYOW4.js +1 -0
  13. package/dist/chunk-A2VVB4RH.js +0 -0
  14. package/dist/{chunk-2GVCAIPX.js → chunk-BDSLF5BR.js} +1 -1
  15. package/dist/{chunk-U66YKDAR.js → chunk-BIK3AO2V.js} +1 -1
  16. package/dist/chunk-BTDI7JAA.js +2 -0
  17. package/dist/chunk-DDH2DYQP.js +1 -0
  18. package/dist/{chunk-HGCGIRVA.js → chunk-DNQ7AF6K.js} +1 -1
  19. package/dist/{chunk-66JNVRQM.js → chunk-GWYNMSIP.js} +1 -1
  20. package/dist/{chunk-V2ULLALL.js → chunk-I67UW5UG.js} +3 -3
  21. package/dist/{chunk-MSGZ56QL.js → chunk-KWLHKKZO.js} +1 -1
  22. package/dist/{chunk-FOHHXSOL.js → chunk-MLQKNED6.js} +1 -1
  23. package/dist/{chunk-43AEUUNQ.js → chunk-N3MJOHAG.js} +1 -1
  24. package/dist/{chunk-BVN33R76.js → chunk-N7E6264U.js} +1 -1
  25. package/dist/chunk-OHZHYROJ.js +5 -0
  26. package/dist/{chunk-YHFKWV7H.js → chunk-PFFH7ASD.js} +13 -13
  27. package/dist/chunk-PRHBWA5V.js +0 -0
  28. package/dist/chunk-SNF5764Q.js +1 -0
  29. package/dist/chunk-SSRYU3YG.js +1 -0
  30. package/dist/{chunk-R4QJ6DC5.js → chunk-SWBADIQT.js} +1 -1
  31. package/dist/{chunk-GOTN2KY4.js → chunk-TIAWIOGD.js} +1 -1
  32. package/dist/chunk-TUXLORVR.js +15 -0
  33. package/dist/{chunk-FGNR22NY.js → chunk-U5DNBT63.js} +1 -1
  34. package/dist/{chunk-EZTP6E2M.js → chunk-U7TFWHST.js} +1 -1
  35. package/dist/{chunk-2M4T27BI.js → chunk-WJJ7H42G.js} +7 -7
  36. package/dist/chunk-YIUE4US7.js +0 -0
  37. package/dist/{chunk-O7Q4DDJT.js → chunk-YM4UEGBV.js} +1 -1
  38. package/dist/chunk-YVFYWAYU.js +65 -0
  39. package/dist/{chunk-N2RISV46.js → chunk-ZOSEBPAI.js} +1 -1
  40. package/dist/copy/index.d.ts +2 -2
  41. package/dist/copy/index.js +11 -11
  42. package/dist/drag/index.d.ts +2 -2
  43. package/dist/drag/index.js +1 -1
  44. package/dist/draw/client.d.ts +1 -1
  45. package/dist/draw/client.js +1 -1
  46. package/dist/draw/index.d.ts +8 -8
  47. package/dist/draw/index.js +1 -1
  48. package/dist/easel/easel.css +3 -1
  49. package/dist/easel/index.d.ts +2 -2
  50. package/dist/easel/index.js +1 -1
  51. package/dist/fields/index.d.ts +4 -4
  52. package/dist/fields/index.js +1 -1
  53. package/dist/panel/index.d.ts +2 -2
  54. package/dist/render/index.d.ts +2 -2
  55. package/dist/render/index.js +5 -5
  56. package/dist/{repeat-Czi-6zPX.d.ts → repeat-BNgSq2Nw.d.ts} +1 -1
  57. package/dist/screen/components/AddBlockRow.d.ts +1 -1
  58. package/dist/screen/components/AddBlockRow.js +1 -1
  59. package/dist/screen/components/AddSidePanel.d.ts +2 -2
  60. package/dist/screen/components/AddSidePanel.js +1 -1
  61. package/dist/screen/components/NodeContextMenu.d.ts +13 -13
  62. package/dist/screen/components/NodeContextMenu.js +1 -1
  63. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  64. package/dist/screen/components/PreviewPartsContext.d.ts +2 -2
  65. package/dist/screen/components/PreviewPartsContext.js +1 -1
  66. package/dist/screen/components/SaveControls.d.ts +7 -7
  67. package/dist/screen/components/ScreenChrome.js +1 -1
  68. package/dist/screen/components/ScreenDocumentContext.d.ts +2 -2
  69. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  70. package/dist/screen/components/ScreenMount.d.ts +7 -7
  71. package/dist/screen/components/ScreenMount.js +1 -1
  72. package/dist/screen/components/ScreenStoreProvider.d.ts +7 -7
  73. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  74. package/dist/screen/components/SectionScreenShell.js +17 -17
  75. package/dist/screen/components/SlotChildActionsContext.d.ts +1 -1
  76. package/dist/screen/components/usePartBridge.d.ts +7 -7
  77. package/dist/screen/components/usePartBridge.js +1 -1
  78. package/dist/screen/index.d.ts +8 -8
  79. package/dist/screen/index.js +1 -1
  80. package/dist/screen/lib/admin-bridge.d.ts +1 -1
  81. package/dist/screen/lib/admin-bridge.js +1 -1
  82. package/dist/screen/lib/content/view-tiers.d.ts +1 -1
  83. package/dist/screen/lib/document/add-target-types.d.ts +55 -0
  84. package/dist/screen/lib/document/add-target-types.js +1 -0
  85. package/dist/screen/lib/document/block-choice.d.ts +64 -0
  86. package/dist/screen/lib/document/block-choice.js +1 -0
  87. package/dist/screen/lib/document/block-types-in.d.ts +39 -0
  88. package/dist/screen/lib/document/block-types-in.js +1 -0
  89. package/dist/screen/lib/document/content-tree.d.ts +222 -0
  90. package/dist/screen/lib/document/content-tree.js +1 -0
  91. package/dist/screen/lib/document/device-fields.d.ts +128 -0
  92. package/dist/screen/lib/document/device-fields.js +1 -0
  93. package/dist/screen/lib/document/field-buckets.d.ts +36 -0
  94. package/dist/screen/lib/document/field-buckets.js +1 -0
  95. package/dist/screen/lib/document/field-markers.d.ts +205 -0
  96. package/dist/screen/lib/document/field-markers.js +1 -0
  97. package/dist/screen/lib/document/hidable.d.ts +44 -0
  98. package/dist/screen/lib/document/hidable.js +1 -0
  99. package/dist/screen/lib/document/palette-sections.d.ts +103 -0
  100. package/dist/screen/lib/document/palette-sections.js +1 -0
  101. package/dist/screen/lib/document/panel-fields.d.ts +47 -0
  102. package/dist/screen/lib/document/panel-fields.js +1 -0
  103. package/dist/screen/lib/document/panel-no-control-mark.d.ts +74 -0
  104. package/dist/screen/lib/document/panel-no-control-mark.js +1 -0
  105. package/dist/screen/lib/document/part-id.d.ts +23 -0
  106. package/dist/screen/lib/document/part-id.js +1 -0
  107. package/dist/screen/lib/document/preview-click.d.ts +49 -0
  108. package/dist/screen/lib/document/preview-click.js +1 -0
  109. package/dist/screen/lib/document/preview-dom.d.ts +8 -0
  110. package/dist/screen/lib/document/preview-dom.js +1 -0
  111. package/dist/screen/lib/document/preview-events.d.ts +25 -0
  112. package/dist/screen/lib/document/preview-events.js +1 -0
  113. package/dist/screen/lib/document/preview-selection-context.d.ts +72 -0
  114. package/dist/screen/lib/document/preview-selection-context.js +1 -0
  115. package/dist/screen/lib/document/section-doc.d.ts +24 -0
  116. package/dist/screen/lib/document/section-doc.js +1 -0
  117. package/dist/screen/lib/document/slot-child-name.d.ts +225 -0
  118. package/dist/screen/lib/document/slot-child-name.js +1 -0
  119. package/dist/screen/lib/document/slot-heal.d.ts +5 -0
  120. package/dist/screen/lib/document/slot-heal.js +1 -0
  121. package/dist/screen/lib/document/slot-section-spec.d.ts +96 -0
  122. package/dist/screen/lib/document/slot-section-spec.js +1 -0
  123. package/dist/screen/lib/document/style-clipboard.d.ts +144 -0
  124. package/dist/screen/lib/document/style-clipboard.js +1 -0
  125. package/dist/screen/lib/document/text-control-kinds.d.ts +71 -0
  126. package/dist/screen/lib/document/text-control-kinds.js +1 -0
  127. package/dist/screen/lib/document/tree-reveal.d.ts +62 -0
  128. package/dist/screen/lib/document/tree-reveal.js +1 -0
  129. package/dist/screen/lib/document/use-section-ops.d.ts +110 -0
  130. package/dist/screen/lib/document/use-section-ops.js +1 -0
  131. package/dist/screen/lib/document-addressing.d.ts +2 -2
  132. package/dist/screen/lib/document-switch.d.ts +1 -1
  133. package/dist/screen/lib/host.d.ts +2 -2
  134. package/dist/screen/lib/key-scope.d.ts +1 -1
  135. package/dist/screen/lib/key-scope.js +1 -1
  136. package/dist/screen/lib/media-panel.d.ts +2 -2
  137. package/dist/screen/lib/media-picker.d.ts +2 -2
  138. package/dist/screen/lib/page-lock.d.ts +1 -1
  139. package/dist/screen/lib/puck/add-target-types.d.ts +3 -55
  140. package/dist/screen/lib/puck/add-target-types.js +1 -0
  141. package/dist/screen/lib/puck/block-choice.d.ts +1 -64
  142. package/dist/screen/lib/puck/block-choice.js +1 -1
  143. package/dist/screen/lib/puck/block-types-in.d.ts +1 -39
  144. package/dist/screen/lib/puck/block-types-in.js +1 -1
  145. package/dist/screen/lib/puck/content-tree.d.ts +1 -222
  146. package/dist/screen/lib/puck/content-tree.js +1 -1
  147. package/dist/screen/lib/puck/device-fields.d.ts +3 -127
  148. package/dist/screen/lib/puck/device-fields.js +1 -1
  149. package/dist/screen/lib/puck/field-buckets.d.ts +2 -36
  150. package/dist/screen/lib/puck/field-buckets.js +1 -1
  151. package/dist/screen/lib/puck/field-markers.d.ts +2 -205
  152. package/dist/screen/lib/puck/field-markers.js +1 -1
  153. package/dist/screen/lib/puck/hidable.d.ts +1 -44
  154. package/dist/screen/lib/puck/hidable.js +1 -1
  155. package/dist/screen/lib/puck/palette-sections.d.ts +2 -97
  156. package/dist/screen/lib/puck/palette-sections.js +1 -1
  157. package/dist/screen/lib/puck/panel-fields.d.ts +1 -47
  158. package/dist/screen/lib/puck/panel-fields.js +1 -1
  159. package/dist/screen/lib/puck/panel-no-control-mark.d.ts +2 -74
  160. package/dist/screen/lib/puck/panel-no-control-mark.js +1 -1
  161. package/dist/screen/lib/puck/part-id.d.ts +1 -23
  162. package/dist/screen/lib/puck/part-id.js +1 -1
  163. package/dist/screen/lib/puck/preview-click.d.ts +1 -49
  164. package/dist/screen/lib/puck/preview-click.js +1 -1
  165. package/dist/screen/lib/puck/preview-dom.d.ts +1 -8
  166. package/dist/screen/lib/puck/preview-dom.js +1 -1
  167. package/dist/screen/lib/puck/preview-events.d.ts +1 -25
  168. package/dist/screen/lib/puck/preview-events.js +1 -1
  169. package/dist/screen/lib/puck/preview-selection-context.d.ts +2 -72
  170. package/dist/screen/lib/puck/preview-selection-context.js +1 -1
  171. package/dist/screen/lib/puck/section-doc.d.ts +3 -18
  172. package/dist/screen/lib/puck/section-doc.js +1 -1
  173. package/dist/screen/lib/puck/slot-child-name.d.ts +1 -225
  174. package/dist/screen/lib/puck/slot-child-name.js +1 -1
  175. package/dist/screen/lib/puck/slot-heal.d.ts +2 -5
  176. package/dist/screen/lib/puck/slot-heal.js +1 -1
  177. package/dist/screen/lib/puck/slot-section-spec.d.ts +1 -96
  178. package/dist/screen/lib/puck/slot-section-spec.js +1 -0
  179. package/dist/screen/lib/puck/style-clipboard.d.ts +12 -114
  180. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  181. package/dist/screen/lib/puck/text-control-kinds.d.ts +1 -71
  182. package/dist/screen/lib/puck/text-control-kinds.js +1 -1
  183. package/dist/screen/lib/puck/tree-reveal.d.ts +1 -62
  184. package/dist/screen/lib/puck/tree-reveal.js +1 -1
  185. package/dist/screen/lib/puck/use-section-ops.d.ts +4 -105
  186. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  187. package/dist/screen/lib/screen-parts.d.ts +25 -18
  188. package/dist/screen/lib/screen-parts.js +1 -1
  189. package/dist/screen/lib/section-template-types.d.ts +1 -1
  190. package/dist/screen/lib/section-templates.d.ts +1 -1
  191. package/dist/screen/lib/section-templates.js +1 -1
  192. package/dist/screen/lib/session-context.d.ts +1 -1
  193. package/dist/screen/lib/session-context.js +1 -1
  194. package/dist/screen/lib/session.d.ts +3 -3
  195. package/dist/screen/lib/session.js +1 -1
  196. package/dist/screen/lib/shared-section-types.d.ts +1 -1
  197. package/dist/screen/lib/shared-sections.d.ts +1 -1
  198. package/dist/screen/lib/shared-sections.js +1 -1
  199. package/dist/screen/screen.css +2 -2
  200. package/dist/strings/index.d.ts +2 -2
  201. package/dist/strings/index.js +1 -1
  202. package/dist/text-styles/index.js +21 -21
  203. package/dist/tree/index.d.ts +1 -1
  204. package/dist/{types-CDX6vd6A.d.ts → types-B8NwXKlE.d.ts} +1 -1
  205. package/dist/{watch-BTYOJpQU.d.ts → watch-D8xZow3y.d.ts} +2 -2
  206. package/dist/{words-BeX5eGq7.d.ts → words-CmEnDoOe.d.ts} +1 -1
  207. package/package.json +154 -10
  208. package/dist/chunk-2E2SXDYQ.js +0 -1
  209. package/dist/chunk-4IJVV7DA.js +0 -1
  210. package/dist/chunk-7L3NKHEC.js +0 -15
  211. package/dist/chunk-APVUYICP.js +0 -65
  212. package/dist/chunk-BHRC3ASL.js +0 -1
  213. package/dist/chunk-I54UCYOU.js +0 -1
  214. package/dist/chunk-LXTM2OLQ.js +0 -2
  215. package/dist/chunk-NA3GMA43.js +0 -5
  216. package/dist/chunk-OBWDHKLI.js +0 -8
  217. package/dist/chunk-Q2A7RHG2.js +0 -1
  218. package/dist/chunk-QIDRJH3S.js +0 -1
  219. package/dist/chunk-RSCMJIWS.js +0 -1
  220. /package/dist/{chunk-MQNBD6AB.js → chunk-3QB2ZQXK.js} +0 -0
  221. /package/dist/{chunk-LER7RKTO.js → chunk-5XL2RXFU.js} +0 -0
  222. /package/dist/{chunk-6W7WLPZH.js → chunk-6UAEFOJ4.js} +0 -0
  223. /package/dist/{chunk-26OOWIJJ.js → chunk-7OCEPOEJ.js} +0 -0
  224. /package/dist/{chunk-IQ5TA7AM.js → chunk-AJ2SUSET.js} +0 -0
  225. /package/dist/{chunk-DUVRZ456.js → chunk-ANPOR6EY.js} +0 -0
  226. /package/dist/{chunk-5ZBY24K7.js → chunk-CPL43ZLJ.js} +0 -0
  227. /package/dist/{chunk-PIND6KE7.js → chunk-I6SK6ZDT.js} +0 -0
  228. /package/dist/{chunk-7F52SZOI.js → chunk-INRERJU4.js} +0 -0
  229. /package/dist/{chunk-R5L2E7JX.js → chunk-MGVI67QV.js} +0 -0
  230. /package/dist/{chunk-IYT6NN2J.js → chunk-R4AUZVA3.js} +0 -0
  231. /package/dist/{chunk-M2Z775ZC.js → chunk-RUQOIQWI.js} +0 -0
  232. /package/dist/{chunk-PLVEGYK6.js → chunk-TCAAOYQY.js} +0 -0
  233. /package/dist/{chunk-PA3PNTVV.js → chunk-VKPOH6MK.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "21.0.0",
3
+ "version": "21.1.0",
4
4
  "description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -30,6 +30,9 @@
30
30
  "./screen/components/PreviewDeviceContext",
31
31
  "./screen/components/UiIcon",
32
32
  "./screen/lib/content/view-tiers",
33
+ "./screen/lib/document/content-tree",
34
+ "./screen/lib/document/hidable",
35
+ "./screen/lib/document/slot-child-name",
33
36
  "./screen/lib/puck/content-tree",
34
37
  "./screen/lib/puck/hidable",
35
38
  "./screen/lib/puck/slot-child-name"
@@ -91,6 +94,35 @@
91
94
  "./screen/lib/media-panel",
92
95
  "./screen/lib/media-picker",
93
96
  "./screen/lib/page-lock",
97
+ "./screen/lib/document/add-target-types",
98
+ "./screen/lib/document/block-choice",
99
+ "./screen/lib/document/block-types-in",
100
+ "./screen/lib/document/device-fields",
101
+ "./screen/lib/document/field-buckets",
102
+ "./screen/lib/document/field-markers",
103
+ "./screen/lib/document/palette-sections",
104
+ "./screen/lib/document/panel-fields",
105
+ "./screen/lib/document/panel-no-control-mark",
106
+ "./screen/lib/document/part-id",
107
+ "./screen/lib/document/preview-click",
108
+ "./screen/lib/document/preview-dom",
109
+ "./screen/lib/document/preview-events",
110
+ "./screen/lib/document/preview-selection-context",
111
+ "./screen/lib/document/section-doc",
112
+ "./screen/lib/document/slot-heal",
113
+ "./screen/lib/document/slot-section-spec",
114
+ "./screen/lib/document/style-clipboard",
115
+ "./screen/lib/document/text-control-kinds",
116
+ "./screen/lib/document/tree-reveal",
117
+ "./screen/lib/document/use-section-ops",
118
+ "./screen/lib/save-status",
119
+ "./screen/lib/screen-parts",
120
+ "./screen/lib/section-template-types",
121
+ "./screen/lib/section-templates",
122
+ "./screen/lib/session-context",
123
+ "./screen/lib/shared-section-types",
124
+ "./screen/lib/shared-sections",
125
+ "./screen/words",
94
126
  "./screen/lib/puck/add-target-types",
95
127
  "./screen/lib/puck/block-choice",
96
128
  "./screen/lib/puck/block-types-in",
@@ -111,15 +143,7 @@
111
143
  "./screen/lib/puck/style-clipboard",
112
144
  "./screen/lib/puck/text-control-kinds",
113
145
  "./screen/lib/puck/tree-reveal",
114
- "./screen/lib/puck/use-section-ops",
115
- "./screen/lib/save-status",
116
- "./screen/lib/screen-parts",
117
- "./screen/lib/section-template-types",
118
- "./screen/lib/section-templates",
119
- "./screen/lib/session-context",
120
- "./screen/lib/shared-section-types",
121
- "./screen/lib/shared-sections",
122
- "./screen/words"
146
+ "./screen/lib/puck/use-section-ops"
123
147
  ]
124
148
  },
125
149
  "exports": {
@@ -407,6 +431,126 @@
407
431
  "import": "./dist/screen/lib/document-switch.js",
408
432
  "default": "./dist/screen/lib/document-switch.js"
409
433
  },
434
+ "./screen/lib/document/add-target-types": {
435
+ "types": "./dist/screen/lib/document/add-target-types.d.ts",
436
+ "import": "./dist/screen/lib/document/add-target-types.js",
437
+ "default": "./dist/screen/lib/document/add-target-types.js"
438
+ },
439
+ "./screen/lib/document/block-choice": {
440
+ "types": "./dist/screen/lib/document/block-choice.d.ts",
441
+ "import": "./dist/screen/lib/document/block-choice.js",
442
+ "default": "./dist/screen/lib/document/block-choice.js"
443
+ },
444
+ "./screen/lib/document/block-types-in": {
445
+ "types": "./dist/screen/lib/document/block-types-in.d.ts",
446
+ "import": "./dist/screen/lib/document/block-types-in.js",
447
+ "default": "./dist/screen/lib/document/block-types-in.js"
448
+ },
449
+ "./screen/lib/document/content-tree": {
450
+ "types": "./dist/screen/lib/document/content-tree.d.ts",
451
+ "import": "./dist/screen/lib/document/content-tree.js",
452
+ "default": "./dist/screen/lib/document/content-tree.js"
453
+ },
454
+ "./screen/lib/document/device-fields": {
455
+ "types": "./dist/screen/lib/document/device-fields.d.ts",
456
+ "import": "./dist/screen/lib/document/device-fields.js",
457
+ "default": "./dist/screen/lib/document/device-fields.js"
458
+ },
459
+ "./screen/lib/document/field-buckets": {
460
+ "types": "./dist/screen/lib/document/field-buckets.d.ts",
461
+ "import": "./dist/screen/lib/document/field-buckets.js",
462
+ "default": "./dist/screen/lib/document/field-buckets.js"
463
+ },
464
+ "./screen/lib/document/field-markers": {
465
+ "types": "./dist/screen/lib/document/field-markers.d.ts",
466
+ "import": "./dist/screen/lib/document/field-markers.js",
467
+ "default": "./dist/screen/lib/document/field-markers.js"
468
+ },
469
+ "./screen/lib/document/hidable": {
470
+ "types": "./dist/screen/lib/document/hidable.d.ts",
471
+ "import": "./dist/screen/lib/document/hidable.js",
472
+ "default": "./dist/screen/lib/document/hidable.js"
473
+ },
474
+ "./screen/lib/document/palette-sections": {
475
+ "types": "./dist/screen/lib/document/palette-sections.d.ts",
476
+ "import": "./dist/screen/lib/document/palette-sections.js",
477
+ "default": "./dist/screen/lib/document/palette-sections.js"
478
+ },
479
+ "./screen/lib/document/panel-fields": {
480
+ "types": "./dist/screen/lib/document/panel-fields.d.ts",
481
+ "import": "./dist/screen/lib/document/panel-fields.js",
482
+ "default": "./dist/screen/lib/document/panel-fields.js"
483
+ },
484
+ "./screen/lib/document/panel-no-control-mark": {
485
+ "types": "./dist/screen/lib/document/panel-no-control-mark.d.ts",
486
+ "import": "./dist/screen/lib/document/panel-no-control-mark.js",
487
+ "default": "./dist/screen/lib/document/panel-no-control-mark.js"
488
+ },
489
+ "./screen/lib/document/part-id": {
490
+ "types": "./dist/screen/lib/document/part-id.d.ts",
491
+ "import": "./dist/screen/lib/document/part-id.js",
492
+ "default": "./dist/screen/lib/document/part-id.js"
493
+ },
494
+ "./screen/lib/document/preview-click": {
495
+ "types": "./dist/screen/lib/document/preview-click.d.ts",
496
+ "import": "./dist/screen/lib/document/preview-click.js",
497
+ "default": "./dist/screen/lib/document/preview-click.js"
498
+ },
499
+ "./screen/lib/document/preview-dom": {
500
+ "types": "./dist/screen/lib/document/preview-dom.d.ts",
501
+ "import": "./dist/screen/lib/document/preview-dom.js",
502
+ "default": "./dist/screen/lib/document/preview-dom.js"
503
+ },
504
+ "./screen/lib/document/preview-events": {
505
+ "types": "./dist/screen/lib/document/preview-events.d.ts",
506
+ "import": "./dist/screen/lib/document/preview-events.js",
507
+ "default": "./dist/screen/lib/document/preview-events.js"
508
+ },
509
+ "./screen/lib/document/preview-selection-context": {
510
+ "types": "./dist/screen/lib/document/preview-selection-context.d.ts",
511
+ "import": "./dist/screen/lib/document/preview-selection-context.js",
512
+ "default": "./dist/screen/lib/document/preview-selection-context.js"
513
+ },
514
+ "./screen/lib/document/section-doc": {
515
+ "types": "./dist/screen/lib/document/section-doc.d.ts",
516
+ "import": "./dist/screen/lib/document/section-doc.js",
517
+ "default": "./dist/screen/lib/document/section-doc.js"
518
+ },
519
+ "./screen/lib/document/slot-child-name": {
520
+ "types": "./dist/screen/lib/document/slot-child-name.d.ts",
521
+ "import": "./dist/screen/lib/document/slot-child-name.js",
522
+ "default": "./dist/screen/lib/document/slot-child-name.js"
523
+ },
524
+ "./screen/lib/document/slot-heal": {
525
+ "types": "./dist/screen/lib/document/slot-heal.d.ts",
526
+ "import": "./dist/screen/lib/document/slot-heal.js",
527
+ "default": "./dist/screen/lib/document/slot-heal.js"
528
+ },
529
+ "./screen/lib/document/slot-section-spec": {
530
+ "types": "./dist/screen/lib/document/slot-section-spec.d.ts",
531
+ "import": "./dist/screen/lib/document/slot-section-spec.js",
532
+ "default": "./dist/screen/lib/document/slot-section-spec.js"
533
+ },
534
+ "./screen/lib/document/style-clipboard": {
535
+ "types": "./dist/screen/lib/document/style-clipboard.d.ts",
536
+ "import": "./dist/screen/lib/document/style-clipboard.js",
537
+ "default": "./dist/screen/lib/document/style-clipboard.js"
538
+ },
539
+ "./screen/lib/document/text-control-kinds": {
540
+ "types": "./dist/screen/lib/document/text-control-kinds.d.ts",
541
+ "import": "./dist/screen/lib/document/text-control-kinds.js",
542
+ "default": "./dist/screen/lib/document/text-control-kinds.js"
543
+ },
544
+ "./screen/lib/document/tree-reveal": {
545
+ "types": "./dist/screen/lib/document/tree-reveal.d.ts",
546
+ "import": "./dist/screen/lib/document/tree-reveal.js",
547
+ "default": "./dist/screen/lib/document/tree-reveal.js"
548
+ },
549
+ "./screen/lib/document/use-section-ops": {
550
+ "types": "./dist/screen/lib/document/use-section-ops.d.ts",
551
+ "import": "./dist/screen/lib/document/use-section-ops.js",
552
+ "default": "./dist/screen/lib/document/use-section-ops.js"
553
+ },
410
554
  "./screen/lib/failure": {
411
555
  "types": "./dist/screen/lib/failure.d.ts",
412
556
  "import": "./dist/screen/lib/failure.js",
@@ -1 +0,0 @@
1
- import{HERO_SLIDER_GOTO_EVENT as t}from"./chunk-IQ5TA7AM.js";import{queryMainCopy as n}from"./chunk-LF3FUSCQ.js";import{isPreviewClick as o}from"./chunk-R5L2E7JX.js";var e=()=>document.querySelector(".sf-editor #preview-frame");function r(t){o()||requestAnimationFrame(()=>{const o=e()?.contentDocument;o&&n(o,`[data-puck-component="${CSS.escape(t)}"]`)?.scrollIntoView({behavior:"smooth",block:"start"})})}function c(n,o){const r=e()?.contentWindow;if(!r)return;const c={id:n,index:o};r.dispatchEvent(new CustomEvent(t,{detail:c}))}function i(){requestAnimationFrame(()=>{e()?.contentWindow?.scrollTo({top:0,behavior:"smooth"})})}function u(t,{passes:n=[150,400],onPinned:o}={}){let r=0,c=!1;const i=[],u=()=>{const r=e(),s=r?.contentWindow,l=r?.contentDocument;if(!s||!l)return!1;const m=t(s,l);if(null==m)return!1;if(s.scrollTo({left:s.scrollX,top:m,behavior:"instant"}),!c){c=!0,o?.();for(const t of n)i.push(setTimeout(u,t))}return!0},s=()=>{!u()&&r++<150&&i.push(setTimeout(s,32))};return s(),()=>i.forEach(clearTimeout)}function s(t){return u((o,e)=>{const r=n(e,`[data-puck-component="${CSS.escape(t)}"]`);return r?o.scrollY+r.getBoundingClientRect().top:null})}function l(t){return u((t,n)=>{if(!n.querySelector("[data-puck-component]"))return null;const o=Math.max(n.documentElement.scrollHeight,n.body?.scrollHeight??0);return o<=n.documentElement.clientHeight?null:o},{passes:[150,400,800,1300,2e3],onPinned:t})}export{c as gotoPreviewSlide,l as pinPreviewToBottom,s as pinPreviewToSection,e as previewFrame,r as scrollPreviewToSection,i as scrollPreviewToTop};
@@ -1 +0,0 @@
1
- import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{useHostEscape as n}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-EB6NI2VK.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{ROOT_ZONE as l}from"./chunk-PLVEGYK6.js";import{easelMenuEntries as r,menuLabel as i}from"./chunk-FIVU2COQ.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-P5VYGWYO.js";import{DEFAULT_NODE_MENU_WORDS as u}from"./chunk-WK3AFPXY.js";import{zoneKey as a,ROOT_SLOT as d,ROOT_ID as p}from"./chunk-K7BTCBWD.js";import{isTypingTarget as f,useCanvasEvent as m,framePointToHost as h}from"./chunk-QIDRJH3S.js";import{useState as y,useCallback as k,useRef as b,useEffect as g}from"react";import{ContextMenu as v}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as O,LayersIcon as z,CopyIcon as P}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const t=[],o=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===l)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=c(),j=/* @__PURE__ */new WeakMap;function M(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=j.get(n);return t||(t=c(),j.set(n,t)),t}function T(){return M(e())}function I(e,n,t){if(n===l){const{floor:n,cap:o}=e.sectionBand();return{parentId:p,slot:d,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function S(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function B(e,n,t){const o=e.canPasteAt;if(!o)return a(n.from)===t.zone?I(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=I(e,l.zone,l.index+1);if(o(n,t))return t}return null}function E(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(f(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;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":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 R(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=S(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const u=e.isPinned(l,t.zone)?null:B(e,s,t);return u?(e.nodeOps.paste(u),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function V(e,n){const{zone:t,index:r}=n,i=e.nodeAt(t,r);if(!i)return[];const c=i.props.id,u=e.labelOf(i.type,t),a=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,t),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),h=e.permits?.(i)??{duplicate:!0,delete:!0},y=S(e,i,t),k=D(e,n),b=d.held,g=b&&!p?B(e,b,n):null,v=!e.readOnly,w=e.style?o({held:v?e.style.held():null,canCopy:e.style.canCopy(i,t),onCopy:()=>e.style?.copy(i,t),onPaste:()=>e.style?.paste(t,r,i),words:e.words?.styleClipboard}):[];return s({title:u,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},r=n.zone===l?null:e.slotRung?.(n.zone)??null;return r?[o,{label:r.label,checked:!1,onClick:r.select}]:[o]})},actions:{duplicate:v&&m&&h.duplicate?()=>d.duplicate(c):void 0,...Y(v&&!p,e=>d.canStep(c,e),e=>d.step(c,e)),copy:y.copy?()=>d.copy(c,u):void 0,cut:v&&y.cut?()=>d.cut(c,u):void 0,paste:v&&b&&g?{label:b.label,run:()=>d.paste(g)}:void 0,rename:v&&e.renamePropOf(i,t)?()=>e.beginRename(t,r):void 0,hide:!v||f||p?void 0:{hidden:a,run:()=>d.setProps(c,{_hidden:!a})},delete:v&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:e.menuRows?.(i,t,r)??void 0,pinnedLine:p?L(e).pinned:void 0})}function Y(e,n,t){return e?{moveUp:n(-1)?()=>t(-1):null,moveDown:n(1)?()=>t(1):null}:{}}var L=e=>e.words?.screen??t.menu;function X(e){const n=L(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=I(e,l,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):a(c.from)===l)){const n=s,t=e.words?.menu??u;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const d=[r,i,[{label:e.pageSettingsLabel??t.pageSettings,icon:/* @__PURE__ */A(O,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(z,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),p={label:"—",onClick:()=>{}};return d.flatMap((e,n)=>n?[p,...e]:e)}function N(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??u,c=L(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const a=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return a.flatMap((e,n)=>n?[d,...e]:e)}function F(e){return e.shiftKey}function U(e,t){const[o,l]=y(null),r=k(()=>l(null),[]);n(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=E(e);if(!o)return;const l=t.selected();if(!l)return;const r=R(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;g(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),m(t,"keydown",c);const u=k(n=>{if(F(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);m(t,"contextmenu",n=>{if(F(n)||!t)return;const o=n.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;n.preventDefault();const c=h(t.frame,n.clientX,n.clientY),s=t.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),m(t,"mousedown",r),m(t,"scroll",r,{on:"window"});return{onEditorContextMenu:u,menu:o?/* @__PURE__ */A(Q,{host:e,target:o,onClose:r}):null,closeMenu:r}}function Q({host:e,target:n,onClose:t}){const o="node"===n.kind?V(e,n):"input"===n.kind?N(e,n.el):X(e);return 0===o.length?null:/* @__PURE__ */A(v,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),items:r(o)})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,M as nodeClipboardOf,S as nodeClipboardRules,V as nodeMenuItems,E as nodeShortcut,X as pageMenuItems,B as pastePlace,R as runNodeShortcut,N as textMenuItems,T as useNodeClipboard,U as useNodeContextMenu};
@@ -1,15 +0,0 @@
1
- import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-IWCKVZHS.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPickPart as l,clickPick as s}from"./chunk-BSHIQIZC.js";import{selectionBox as a,placeWindow as c,offsetOrigin as d,colorRunOf as u,ColorWindow as p,startCanvasTyping as f,textMap as h}from"./chunk-MZ5GSSZ3.js";import{DEFAULT_COPY_WORDS as m}from"./chunk-KRL3IUV3.js";import{useWords as g}from"./chunk-MFIRYGHW.js";import{find as v,ROOT_ID as y,getList as w,remove as b,parseZoneKey as k,move as S,duplicate as C,replaceNode as I,createNode as D,insert as E,normalizeData as x,createResolveCache as O,resolveNodeData as A,ROOT_SLOT as M}from"./chunk-K7BTCBWD.js";import{topLevelSlotKeys as z,fieldsFrom as R,drawnBlockCount as B,defaultsFrom as L}from"./chunk-L55YIXDC.js";import{setCanvasNonce as V,CANVAS_TYPABLE_EVENT as $,isTypingTarget as j,frameRectToHost as N,CANVAS_TYPING_EVENT as P,drawnBox as Z}from"./chunk-QIDRJH3S.js";import{queryAllCopies as K}from"./chunk-LF3FUSCQ.js";import{createContext as F,useEffect as H,useContext as T,useRef as W,useSyncExternalStore as Y,useState as q,useMemo as U,useCallback as Q,useLayoutEffect as G}from"react";import{jsx as X,jsxs as J,Fragment as _}from"react/jsx-runtime";import{createPortal as ee}from"react-dom";import{registerModalEscapeInterceptor as te,FloatingBar as ne,TextToolbar as oe,LinkPicker as re}from"efficient-shell/ui";function ie(e){return!["setData","setUi","set"].includes(e.type)}var le=(e,t,n,o)=>{const r=w(e,t,k(n));return r?.[o]??null},se=(e,t,n,o,r)=>{const i=le(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function ae(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function ce(e,t,n){return n?"node"===n.kind?v(e,t,n.id)?n:null:n.parentId===y?w(e,t,n)?n:null:v(e,t,n.parentId)&&w(e,t,n)?n:null:null}function de(e,t,n,r=!1){const{itemSelector:i,selectedSlot:l,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,i??null)),"selectedSlot"in n&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function ue(e,t,n){const o=pe(e,t,n);if(o===e)return e;const r=ce(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function pe(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return de(e,n,"function"==typeof t.ui?t.ui(ae(e,n)):t.ui);case"set":{const r={data:o,ui:ae(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=de(l,n,i.ui,!0)),l}case"insert":{const r={...k(t.destinationZone),index:t.destinationIndex},i=D(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:E(o,n,r,i)}}case"replace":{const r=se(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:I(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=se(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=C(o,n,r.props.id),l=le(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return pe(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=le(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...k(t.destinationZone),index:t.destinationIndex};return{...e,data:S(o,n,r.props.id,i)}}case"remove":{const r=se(o,n,t.zone,t.index,"remove");return{...e,data:b(o,n,r.props.id)}}default:return e}}var fe={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},he={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},me=0,ge=()=>`history-${me+=1}`;function ve(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=x(e.data,t);let a=s,c={data:s,selection:null,ui:{...he}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;c={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...he,...i}}}let d=[{core:c,at:-1/0,sealed:!0,id:ge()}],u=0;const p=e=>{const t=d[u],n=r();!e&&u===d.length-1&&u>0&&!t.sealed&&n-t.at<i?d=[...d.slice(0,u),{...t,core:c,at:n}]:(d=[...d.slice(0,u+1),{core:c,at:n,sealed:e,id:ge()}],u=d.length-1)},f=/* @__PURE__ */new Set;let h=null,m=null,g=0,y=null,b=!1;const k=()=>{for(const e of[...f])e()},S=()=>{d=[...d.slice(0,u),{...d[u],core:c},...d.slice(u+1)]},C=(t,n)=>{g>0?b=b||n:(n?p(!1):c!==t&&S(),c.data!==t.data&&e.onChange?.(c.data),c!==t&&k())},D=e=>{const n=c;if(c=ue(c,e,t),c===n)return;const o=e.recordHistory??ie(e);C(n,o&&c.data!==n.data)},E=t=>{0===g&&(y=c,b=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&y&&(c=y,y=null),e}if(g-=1,g>0||!y)return;const n=y;y=null,b&&c.data!==n.data?p(!0):c!==n&&S(),c.data!==n.data&&e.onChange?.(c.data),c!==n&&k()},M=e=>{const n=c,o=ce(c.data,t,e);var r,i;(r=o,i=c.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(c={...c,selection:o},C(n,!1))},z=t=>{const n=c;u=t,c=d[u].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&k()},R=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...fe,...l,...n}};let B=R();const L=O(),V={resolveCache:L,async resolveAll({trigger:e="load",metadata:n}={}){const o=c.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[l,...s]=await Promise.all([A(r,t,{cache:L,trigger:e,metadata:n}),...i.map(o=>A(o,t,{cache:L,trigger:e,metadata:n}))]);E(()=>{const n=c;let r=c.data;s.forEach((e,n)=>{if(!e.didChange)return;const l=i[n].props.id,s=v(r,t,l)?.node;s&&s===v(o,t,l)?.node&&(r=I(r,t,l,e.node))}),l.didChange&&r.root===o.root&&(r={...r,root:{...r.root,props:l.node.props,readOnly:l.node.readOnly??r.root.readOnly}}),r!==c.data&&("load"===e&&c.data===a&&(a=r),c={...c,data:r,selection:ce(r,t,c.selection)},C(n,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=v(c.data,t,e)?.node;if(!r)return!1;const i=await A(r,t,{cache:L,trigger:n,metadata:o});if(!i.didChange)return!1;let l=!1;return E(()=>{const n=c;if(v(c.data,t,e)?.node!==r)return;const o=I(c.data,t,e,i.node);o!==c.data&&(c={...c,data:o,selection:ce(o,t,c.selection)},C(n,!1),l=!0)}),l},get config(){return t},get loaded(){return a},getState(){if(h&&m===c)return h;const e=c,o={data:e.data,ui:ae(e,t)},r="node"===e.selection?.kind?v(e.data,t,e.selection.id)?.node??null:null;return h={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:D,history:{back:()=>V.undo(),forward:()=>V.redo(),hasPast:u>0,hasFuture:u<d.length-1,histories:d.map(e=>({id:e.id,state:{data:e.core.data,ui:ae(e.core,t)}})),index:u,setHistoryIndex:e=>{e>=0&&e<d.length&&e!==u&&z(e)}},getPermissions:B,getItemById:n=>v(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return w(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},m=e,h},subscribe:e=>(f.add(e),()=>{f.delete(e)}),dispatch:D,batch:E,group:()=>{const e=u,t=d[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,d[e]?.id!==t)return;if(u<=e+1)return void(u===e+1&&(d=[...d.slice(0,u),{...d[u],sealed:!0},...d.slice(u+1)]));const o=d[u];d=[...d.slice(0,e+1),{...o,sealed:!0},...d.slice(u+1)],u=e+1}}},select:e=>M(e?{kind:"node",id:e}:null),selectSlot:e=>M(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){E(()=>{const n=c,o=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:ce(e.data,t,o)},C(n,e.data!==n.data)})},load(e,n={}){const o=c,r=x(e,t);c={...c,data:r,selection:ce(r,t,n.selection??c.selection)},a=r,n.keepHistory||(d=[{core:c,at:-1/0,sealed:!0,id:ge()}],u=0),c!==o&&k()},undo(){u>0&&z(u-1)},redo(){u<d.length-1&&z(u+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,B=R(),h=null,k())},setConfig(e){e!==t&&(t=e,B=R(),h=null,k())}};return V}function ye(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&j(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var we=F(null),be=F(!0);function ke({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return H(()=>{n&&e.resolveAll()},[e,n]),H(()=>{if(t&&"undefined"!=typeof document)return ye(document,e)},[e,t]),/* @__PURE__ */X(we.Provider,{value:e,children:/* @__PURE__ */X(be.Provider,{value:t,children:o})})}function Se(){const e=T(we);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function Ce(e){const t=Se(),n=W({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return Y(t.subscribe,o,o)}function Ie(){return function(e){return Ce(e)}}var De="data-puck-component",Ee="data-puck-dropzone",xe={},Oe="data-es-mirror",Ae="undefined"==typeof window?H:G;function Me(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Oe}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Oe,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function ze({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=g("canvas",e),u=W(null),[p,f]=q(null);return Ae(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),Ae(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),V(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){Me(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>Me(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */X("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?ee(t,p):null})}var Re=F(null),Be=F(xe),Le=[];function Ve({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=Se(),s=Ce(n=>w(n.appState.data,l.config,{parentId:e,slot:t})??Le),a=Ce(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==y),c=Ce(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=T(Re),u=["es-zone"];return s.length&&u.push("has-children"),e===y&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==y&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */X("div",{className:u.join(" "),[Ee]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */X(He,{node:e},e.props.id))})}function $e(e,t,n,o){const r=U(()=>{const n={};for(const o of z(R(e)))n[o]=Object.assign(function(e={}){/* @__PURE__ */
2
- return X(Ve,{parentId:t,slot:o,...e})},{blockCount:0});return n},[e,t]);for(const e of Object.keys(r))r[e].blockCount=B(n[e],o);return r}function je(e){return U(()=>function({zone:t,...n}){/* @__PURE__ */
3
- return X(Ve,{parentId:e,slot:t,...n})},[e])}var Ne=["top","bottom","zIndex"];function Pe(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Ze(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Pe(e,"position",t?"sticky":"relative");for(const n of Ne)Pe(e,n,t?.[n]??"");return!!t}var Ke="data-es-canvas-relative";function Fe(e){e.hasAttribute(Ke)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Ke));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Ke,"")),!1)}function He({node:e}){const t=Se().config,n=t.components[e.type],o=e.props.id,r=W(null),i=function(e,t){return U(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(De),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(De,e),n.setAttribute("data-puck-dnd",e),Fe(n))},[e,t])}(o,r),l=W(null),s=!!n?.inline;!function(e,t){const n=W(!1),o=W(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=W(()=>{});Ae(()=>o.current()),Ae(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>s?r.current:l.current,e=>s?Fe(e):Ze(e));const a=T(Be),c=$e(n,o,e.props,t.components),d=je(o);if(!n?.render)return null;const u=n.render,p={...L(n),...e.props,...c},f={renderDropZone:d,isEditing:!0,dragRef:n.inline?i:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */X(u,{...p,puck:f,editMode:!0}):
4
- /* @__PURE__ */X("div",{ref:l,[De]:o,"data-puck-dnd":o,style:{position:"relative"},children:/* @__PURE__ */X(u,{...p,puck:f,editMode:!0})})}function Te({metadata:e}){const t=Ce(e=>e.config),n=Ce(e=>e.appState.data.root).props??{},o=t.root?.render,r=$e(t.root,y,n,t.components),i=je(y),l=/* @__PURE__ */X(Ve,{parentId:y,slot:M}),s=o?/* @__PURE__ */X(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
5
- return X(Be.Provider,{value:e??xe,children:s})}var We=F(void 0),Ye=F(void 0),qe=F(void 0);function Ue({element:e}){const t=W(null),n=Qe(t,e?()=>e:null,e);/* @__PURE__ */
6
- return X("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-hover is-hover-part",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function Qe(e,t,n){return Xe(e,t?e=>{const n=t(e);return n?[n]:[]}:null,n)[0]??null}var Ge=[];function Xe(e,t,n){const[o,r]=q(Ge),i=W(t);return i.current=t,Ae(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(Ge);let o=0;const l=()=>{o=0;const n=e.current?.parentElement??null,l=(i.current?i.current(t):[]).map(e=>function(e,t){if(!e||!t)return null;const n=Z(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(e,n)).filter(e=>null!==e);r(e=>{return(t=e)===(n=l)||t.length===n.length&&t.every((e,t)=>function(e,t){return e===t||!!e&&!!t&&e.top===t.top&&e.left===t.left&&e.width===t.width&&e.height===t.height}(e,n[t]))?e:l.length?l:Ge;var t,n})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function Je({id:e,kind:t,overlay:n}){const o=W(null),r=T(Ye),i=null!==e&&!0===r?.(e),l=Xe(o,e?t=>K(t,`[${De}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),[s,...a]=l,c=`es-canvas-outline is-${t}${i?" is-shared":""}`,d=e=>({position:"absolute",top:e.top,left:e.left,width:e.width,height:e.height}),u=/* @__PURE__ */J(_,{children:[
7
- /* @__PURE__ */X("div",{ref:o,"aria-hidden":"true",className:c,style:s?d(s):{display:"none"}}),a.map((e,t)=>/* @__PURE__ */X("div",{"aria-hidden":"true",className:c,style:d(e)},t))]});return n&&e?/* @__PURE__ */X(n,{componentId:e,kind:t,children:u}):u}function _e(e,t,n){const o=h(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function et({s:e,element:t,toolbar:n,label:o,keys:r}){const i=g("copy",m),l=e.pressed(),s=new Set(n.offered),f=n.colors&&n.colors.length>0?n.colors:null,h=W(null),[v,y]=q(!1),[w,b]=q(null),k=v||null!==w,S=()=>{e.hold(),y(!1),b({href:e.pressed().href})},C=()=>{y(!1),b(null),e.resume()};G(()=>{r.current={escape:()=>!!k&&(C(),!0),link:()=>!!s.has("link")&&(S(),!0)}}),G(()=>()=>{r.current=null},[r]);const I=W(C);I.current=C,H(()=>{if(v)return te(e=>{const t=h.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(I.current(),!0)},()=>h.current?.querySelector(".es-copy-colors"))},[v]),H(()=>{const n=h.current;if(!k||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;y(!1),b(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[k,e,t]),G(()=>{const e=h.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(k&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?a(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,u=s?N(s,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},p=o.getBoundingClientRect(),f=s?N(s,{left:p.left,top:p.top,width:p.width,height:p.height}):{left:p.left,top:p.top,width:p.width,height:p.height},m=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),g={left:u.left,right:u.left+u.width,top:Math.min(u.top,f.top-6,m.top),bottom:Math.max(u.top+u.height,f.top+f.height+6,m.bottom)},v=e.ownerDocument.documentElement,y=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),w={left:Math.max(0,y.left),top:Math.max(0,y.top),right:Math.min(v.clientWidth||y.right,y.right),bottom:Math.min(v.clientHeight||y.bottom,y.bottom)};if(w.right<=w.left||w.bottom<=w.top||0===n.offsetWidth)return;const b=c({anchor:g,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:y.left,top:y.top,right:y.right,bottom:y.bottom},clip:w,parent:d(n)});n.style.top=`${b.top}px`,n.style.left=`${b.left}px`,n.style.setProperty("--es-pop-point",`${b.point}px`),n.dataset.side=b.above?"above":"below"});const D=f?{run:u(l.color,f),open:v,onToggle:()=>{b(null),v?C():(e.hold(),y(!0))}}:void 0;/* @__PURE__ */
8
- return X(ne,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?N(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */X("div",{ref:h,children:/* @__PURE__ */X(oe,{layout:"row",offered:s,pressed:l.marks,onMark:t=>{"link"===t?S():e.press(t)},color:D,linkOpen:null!==w,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */J(_,{children:[v&&f?/* @__PURE__ */X(p,{colors:f,current:l.color,words:i.colors??m.colors,onPick:t=>e.color(t)}):null,w?
9
- /* @__PURE__ */X(re,{className:"es-copy-link es-copy-pop",value:w.href??"",onApply:t=>{b(null),e.link(t)},onRemove:null!==w.href?()=>{b(null),e.link(null)}:void 0,onCancel:C}):null]})})})})}function tt({element:e}){const t=W(null),n=Qe(t,()=>e(),e);/* @__PURE__ */
10
- return X("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function nt({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:a,onDocument:c,height:d,title:u,nonce:p,hotkeys:h,frameWrapper:m,overlay:v,children:y,typing:w,passThrough:b}){const k=Se(),S=T(We),C=b??S,I=T(be),D=g("canvas",e),E=h??I,[x,O]=q(void 0),A=Ce(e=>"node"===e.selection?.kind?e.selection.id:null),[M,z]=q(null),[R,B]=q(null),L=T(qe),[V,j]=q(null),N=W(null),[,Z]=q(0),K=W(w);K.current=w;const F=W(null),Y=W(null),U=Ce(e=>e.appState.data);H(()=>{const e=Y.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=A&&!V&&K.current?.atSelection?.()?A:null;e.dispatchEvent(new t($,{detail:{id:n}}))},[A,V,U]);const Q=e=>{const t=Y.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(P,{detail:{typing:e}}))},G=(e,t)=>{N.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=k.group(),r=e.element,i=f({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:_e(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>Z(e=>e+1),onEscape:()=>F.current?.escape()??!1,onLinkKey:()=>F.current?.link()??!1,end:e=>{o.close(),N.current?.element===r&&(N.current=null),j(null),Q(!1),K.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${De}]`)?.getAttribute(De);return l&&k.select(l),N.current={s:i,element:r,target:e},j(()=>r),z(null),Q(!0),K.current?.onChange?.({typing:!0,element:n}),!0};H(()=>()=>N.current?.s.stop("stop"),[]);const _=e=>{const t=N.current?.element();return Boolean(t&&t.contains(e))},ee=e=>{const t=e.closest?.(`[${De}]`)?.getAttribute(De);if(!t)return;const n=k.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=L?.partAt(e,t)??null;if(r){const e=l(n.appState.data,k.config,t,r.id,o,L?.selected()??null,C);if(e)return{node:e.node,part:e.part?r:null}}return{node:s(n.appState.data,k.config,t,o,C)??t,part:null}},te=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(N.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=K.current?.atSelection?.();n&&G(n,null)&&e.preventDefault()},ne=/* @__PURE__ */J("div",{ref:Y,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),N.current){if(_(t))return;N.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=ee(t);if(void 0!==o)return k.select(o.node),void(L&&(o.part?.id??null)!==L.selected()&&L.select(o.part?.id??null));t.hasAttribute?.(Ee)||(k.select(null),L?.selected()&&L.select(null))},onDoubleClick:e=>{const t=K.current;if(!t||_(e.target))return;const n=t.at(e.target);n&&G(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>te(e),onMouseOver:e=>{if(N.current)return;const t=ee(e.target),n=t?.part&&t.part.id!==L?.selected()?t.part.element:null,o=t&&!t.part?t.node:null;o!==M&&z(o),n!==R&&B(n)},onMouseLeave:()=>{z(null),B(null)},children:[
11
- /* @__PURE__ */X(Re.Provider,{value:M,children:/* @__PURE__ */X(Te,{metadata:r})}),
12
- /* @__PURE__ */J("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
13
- /* @__PURE__ */X(Je,{id:!V&&M&&M!==A?M:null,kind:"hover",overlay:v}),L?/* @__PURE__ */X(Ue,{element:V?null:R}):null,
14
- /* @__PURE__ */X(Je,{id:V?null:A,kind:"selected",overlay:v}),V?/* @__PURE__ */X(tt,{element:V}):null]}),y]}),oe=m?/* @__PURE__ */X(m,{document:x,children:ne}):ne;H(()=>{if(x&&E)return ye(x,k)},[x,E,k]),H(()=>{if(!x)return;const e=e=>{if("Enter"===e.key)return void te(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=k.getState();if("node"!==n.selection?.kind)return;if(L?.selected())return void L.select(null);const o=i(n.appState.data,k.config,n.selection);"node"===o?.kind&&k.select(o.id)};return x.addEventListener("keydown",e),()=>x.removeEventListener("keydown",e)},[x,k,L]);/* @__PURE__ */
15
- return J("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":V?"":void 0,children:[V&&N.current?.target.toolbar?/* @__PURE__ */X(et,{s:N.current.s,element:N.current.element,toolbar:N.current.target.toolbar,label:D.textTools,keys:F}):null,t?/* @__PURE__ */X(ze,{mirrorStyles:a,onDocument:e=>{O(e??void 0),c?.(e)},height:d,title:u,nonce:p,children:oe}):/* @__PURE__ */X("div",{id:"preview-frame","data-puck-entry":"",children:oe})]})}function ot(e={}){const t=Se(),n=Ce(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function rt(){const e=Se(),n=Ce(e=>e.config),o=e.resolveCache,r=Ce(e=>e.selectedItem),i=Ce(e=>e.appState.data.root),l=r?r.props.id:"root",s=i.props??{},a=U(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?v(d.appState.data,n,l):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=t({id:l,node:a,block:c,parent:f,appState:d.appState}),m=Ce(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=Q(t=>{(async()=>{const r=e.getState();if("root"!==l){const i=r.getItemById(l),s=r.getSelectorForId(l);if(!i||!s)return;const a={...i,props:{...i.props,...t}},{node:c}=await A(a,n,{cache:o,trigger:"replace"}),d=e.getState().getSelectorForId(l);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const i=r.appState.data.root.props??{},{node:s}=await A({type:"root",props:{...i,...t}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,n,o,l]),y=Q((e,t)=>g({[e]:t}),[g]);return{id:l,node:a,fields:h,values:a.props,readOnly:m,onChange:y,onChangeMany:g}}export{ze as CanvasFrame,qe as CanvasPartsContext,We as CanvasPassThroughContext,Ye as CanvasSharedContext,he as DEFAULT_UI,nt as EaselCanvas,ke as EaselProvider,Te as EditDocument,ye as bindUndoKeys,ve as createEasel,Ie as createUseEasel,ie as recordsByDefault,ue as reduce,ae as uiView,Ce as useEasel,Se as useEaselApi,ot as useEaselNodeOps,rt as useSelectedFields,ce as validSelection};
@@ -1,65 +0,0 @@
1
- import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-R4QJ6DC5.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-2E2SXDYQ.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-HGCGIRVA.js";import{SlotChildActionsProvider as h}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-C56MPJBH.js";import{usePartBridge as y}from"./chunk-Q2A7RHG2.js";import{useSectionOps as v}from"./chunk-FOHHXSOL.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-OBWDHKLI.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{PanelHideButton as N,SidePanelHead as I,PanelShowStrip as O}from"./chunk-SINAM2IT.js";import{offeredChoices as B}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as P,useScreenNodeKeys as $,useScreenPinned as M,useScreenDocumentLabel as j,useScreenCanvasFrame as A,useScreenInspectorPanel as L,useScreenDevices as T,useScreenPickFollowsSelection as E,useScreenLeftView as R,SELECTION_MODE as F,sameInspectorMode as D,useScreenBridges as H,useScreenBlockRules as V,useScreenBlockLook as W,useScreenStorageNamespace as U,useScreenNotify as G,useScreenCanvasHead as J,isSlotMode as Y,useScreenStyleClipboard as K,useScreenDocumentPass as Q,useScreenCanvasDrag as X,ScreenCanvasTargetProvider as Z,isPinnedFirst as _,isPinnedLast as q,screenSlotsOf as ee}from"./chunk-NA3GMA43.js";import{MediaPopup as ne}from"./chunk-2G6MAXPY.js";import{useNodeClipboard as te,useNodeContextMenu as oe}from"./chunk-4IJVV7DA.js";import{PageEditGuardNotices as re}from"./chunk-N2RISV46.js";import{useScreenDocument as ie}from"./chunk-LXTM2OLQ.js";import{requestMediaPick as le}from"./chunk-UNVKPVZW.js";import{useMediaPanel as se,usePanelPick as de,useMediaBrowsing as ae,useOpenMediaBrowse as ce,useMediaPlace as pe}from"./chunk-FHCKFOCD.js";import{useEaselSession as ue}from"./chunk-O7Q4DDJT.js";import{useEaselHost as he,useHostEscape as fe}from"./chunk-MQA7OFRA.js";import{LayersIcon as me,MediaIcon as ge}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ye}from"./chunk-EB6NI2VK.js";import{heldStyle as ve,styleShortcut as ke}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as be}from"./chunk-6WY6ZXJG.js";import{rootRowName as Se,slotChildRowName as we,slotChildRenameProp as xe,sectionRenameProp as ze}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as Ce,blockNodeActions as Ne,TREE_MAX_DEPTH as Ie,childSlotsOf as Oe,slotFieldsOf as Be,newNodeId as Pe,slotChildrenIn as $e,nestsInTree as Me}from"./chunk-PLVEGYK6.js";import{useEasel as je,useEaselApi as Ae,CanvasPassThroughContext as Le,CanvasSharedContext as Te}from"./chunk-7L3NKHEC.js";import{TreeRow as Ee,Subtree as Re,LayersTree as Fe,TreeGroupLabel as De,TreeRowAction as He,TreeSeam as Ve}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as We}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ue}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ge,useNodeOps as Je,clickPick as Ye}from"./chunk-BSHIQIZC.js";import{EaselTopBar as Ke,EaselIconButton as Qe,TopBarCluster as Xe,DeviceSwitch as Ze,InspectorIconButton as _e,PanelResizeHandle as qe,MAX_PANEL_W as en,MIN_PANEL_W_BY_SIDE as nn,panelWidthVars as tn}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as on,DEFAULT_CHROME_WORDS as rn}from"./chunk-AJSDWWJW.js";import{holderOf as ln,nameOrSomeone as sn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as dn}from"./chunk-RE4LP46F.js";import{useWords as an}from"./chunk-MFIRYGHW.js";import{insertSeams as cn,CanvasDragLayer as pn,CanvasInsert as un}from"./chunk-2M4T27BI.js";import{DEFAULT_DRAG_WORDS as hn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as fn,useTreeDrag as mn,gapToMoveIndex as gn}from"./chunk-3S5N4HLJ.js";import{ROOT_ID as yn,ROOT_SLOT as vn,zoneKey as kn,parseZoneKey as bn,find as Sn,DataError as wn}from"./chunk-K7BTCBWD.js";import{useCanvasFrame as xn,LIST_SELECTOR as zn,BLOCK_SELECTOR as Cn,useCanvasTyping as Nn,useCanvasEvent as In,nodeIdAt as On,frameRectToHost as Bn,BLOCK_ATTRIBUTE as Pn,drawnBox as $n}from"./chunk-QIDRJH3S.js";import{queryMainCopy as Mn}from"./chunk-LF3FUSCQ.js";import{useRef as jn,useMemo as An,useState as Ln,useEffect as Tn,useCallback as En,useLayoutEffect as Rn,Fragment as Fn,useId as Dn}from"react";import{ColoredBadge as Hn,Button as Vn,Tabs as Wn,toast as Un,readMediaFileDrag as Gn,Tooltip as Jn,groupColors as Yn,Dialog as Kn,FormField as Qn,Input as Xn,MEDIA_FILE_DRAG_TYPE as Zn}from"efficient-shell/ui";import{UndoIcon as _n,RedoIcon as qn,RefreshIcon as et,AddIcon as nt,TrashIcon as tt,EyeOffIcon as ot,EyeIcon as rt,SharedIcon as it,DuplicateIcon as lt}from"efficient-shell/icons/efficient";import{jsx as st,jsxs as dt,Fragment as at}from"react/jsx-runtime";var ct="media-file";function pt({name:e,onMake:n,onCancel:t}){const o=an("screen",ye).shared,[r,i]=Ln(e),[l,s]=Ln(!1),d=Dn(),a=jn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
- return st(Kn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */dt(at,{children:[
3
- /* @__PURE__ */st(Vn,{variant:"secondary",onClick:t,children:o.cancel}),
4
- /* @__PURE__ */st(Vn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */st("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */st(Qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */st(Xn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var ut=/* @__PURE__ */new WeakSet;function ht(e,n,t){const o=Sn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function ft({canvas:e,tabs:n,onSelect:t}){const o=jn(null),[r,i]=Ln({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Rn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=Bn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Mn(t,`[${Pn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?$n(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=Bn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */st("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */st("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
- /* @__PURE__ */st(Jn,{content:e.reach,children:/* @__PURE__ */dt(Hn,{colorClass:Yn("success","solid"),size:"sm",children:[
6
- /* @__PURE__ */st("span",{className:"es-band-tab-mark",children:/* @__PURE__ */st(it,{size:12})}),e.label]})}):/* @__PURE__ */st(Hn,{colorClass:Yn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function mt({expand:e}){/* @__PURE__ */
7
- return st("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */dt(at,e?{children:[
8
- /* @__PURE__ */st("path",{d:"M8 9l4-4 4 4"}),
9
- /* @__PURE__ */st("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
- /* @__PURE__ */st("path",{d:"M8 4l4 4 4-4"}),
11
- /* @__PURE__ */st("path",{d:"M8 20l4-4 4 4"}),
12
- /* @__PURE__ */st("path",{d:"M5 12h14"})]})})}var gt=`${zn}, ${Cn}`;function yt(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var vt="__rungs";var kt="screen:band",bt={duplicate:!0,delete:!0},St=()=>null;function wt(){const zn=he(),Bn=zn.panels?.Toolbar,Pn=(zn.panels?.useRight??St)(),{target:$n,docId:Dn,capabilities:Jn,currentSlug:Yn,siteId:Kn,onPublish:Qn,saveState:Xn,saveConflict:it,retrySave:wt,toggleAutoSave:xt,flushSave:zt,access:Ct,saveUnreachable:Nt=!1,readOnly:It,readOnlyReason:Ot=null}=ie(),Bt=P(),Pt=$(),{mediaEditing:$t,hasEditGuard:Mt,hasPinnedChrome:jt}=Jn,{appState:At,dispatch:Lt,history:Tt,selectedItem:Et,getSelectorForId:Rt,config:Ft}=je(e=>e),Dt=M(),{first:Ht,firstGroup:Vt,lastGroup:Wt,isSectionGroup:Ut,sectionGroupZone:Gt,panelOf:Jt}=Dt,Yt=Jt(Ht),Kt=e=>_(Dt,e),Qt=e=>q(Dt,e),Xt="node"===Dt.firstRow,Zt=Dt.band??null,_t=an("screen",ye),qt=an("tree",We),eo=an("drag",hn),no=an("notice",on),to=an("lock",dn),oo=an("menu",Ue),ro=an("styleClipboard",be),io=an("chrome",rn),lo=j()??`/${Yn}`,so=A(),ao=L(),co=v({readOnly:It}),po=v({readOnly:It,foldIntoHistory:!0}),uo=jn(null),ho=Ae(),fo=An(()=>({...co,select:e=>{uo.current=e,co.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=ho.config;uo.current=Ge(e,t,n)}co.commitDocument(e,n)}}),[co,ho]),mo=At.ui,go=mo.leftSideBarVisible,yo=mo.rightSideBarVisible,{options:vo,widths:ko,initial:bo,fluid:So,fit:wo}=T(),[xo,zo]=Ln(bo),Co=se(),No=$t&&null!==Co;de(),ae();const Io=ce();E(Et?.props.id);const{read:Oo,write:Bo,forSelection:Po}=R(),[$o,Mo]=Ln(Oo);Tn(()=>{Bo($o)},[$o]);const[jo,Ao]=Ln(0),Lo=jn(null),To=jn(null),Eo=xn(To,{readySelector:gt}),Ro=Nn(Eo),Fo=a(To);c(To,Eo);const Do=S(),Ho=ln(Ct),Vo={state:Xn,offline:Do||Xn.failed&&Nt,readOnlyReason:Ot,editing:Ho?no.editing({name:sn(Ho.name,to),noun:_t.noun}):null,conflict:null!=it,notSaving:_t.bar.notSaving},Wo=()=>{It||(Xn.failed?wt():zt())};p(To,Eo,Wo);const[Uo,Go]=Ln(!1),Jo=jn(!1),[Yo,Ko]=Ln(null),[Qo,Xo]=Ln([]),[Zo,_o]=Ln(F),qo="puck"===Zo.kind,er=o(Zo,Et?.props.id),[nr,tr]=Ln(null);Tn(()=>{nr&&(r(),tr(null))},[nr]);const or=jn(Rt);or.current=Rt;const rr=En((e,{scroll:n})=>{Mo(n=>Po(e,n)),n&&tr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=or.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&jr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ir=jn(null);Tn(()=>{const e=ir.current;ir.current=null;const n=null==Et?.props.id?null:String(Et.props.id);_o(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Jt(Et?.type)??F);const t=Et?.props.id,o=uo.current;if(uo.current=null,!t)return;const r=Rt(t);rr(String(t),{scroll:!i(o,r??null,Ce)})},[Et?.props.id,rr]);const lr=En(e=>{_o(n=>D(n,e)?n:e),Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Lt]),sr=jn(()=>{});sr.current=(e,n)=>{const t=e?Bi(e.zone??Ce)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Et?.props.id?null:String(Et.props.id);_o(e=>D(e,n)?e:n),o!==r&&(ir.current={id:o,mode:n},fo.select(e))};const dr=En((e,n)=>sr.current(e,n),[]),ar={kind:Zo.kind,mode:Zo,open:lr,show:e=>_o(e),reveal:()=>{yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:dr},cr=H(ar,{data:At.data,selected:Et??null,zoneOf:e=>Rt(e)?.zone,readOnly:Boolean(It),select:e=>{_o(F),fo.select({index:e})},replace:(e,n)=>fo.replaceComponent(Ce,e,n),scrollTo:e=>l(e)},{device:xo,refreshes:jo},{setView:Mo,reveal:()=>{go||Lt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),pr=cr.resolveLeftView?cr.resolveLeftView($o):"sections",ur=V(),{isLockedBlock:hr,duplicateBlocked:fr,nestDepth:mr,newSectionNode:gr,canAddTo:yr,blockIsOffered:vr}=ur,kr=W(),{labelAtLevel:br,Icon:Sr,useProducts:wr}=kr,xr=kr.rowName?(e,n,t)=>kr.rowName(e,n,t):void 0,zr=En(e=>{Lt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),rr(e,{scroll:!0})},[Lt,rr]),{selectNode:Cr,openPartId:Nr}=y({mode:Zo,setMode:_o,onOpenPart:zr}),[Ir,Or]=Ln(null);fe(null!==Ir,()=>Or(null));const Br=f(U()),Pr=Br.collapsed,$r=Br.panelWidths,[Mr,jr]=Ln(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Pr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
- return new Set}});Tn(()=>{try{window.localStorage.setItem(Pr,JSON.stringify([...Mr]))}catch{}},[Mr]);const[Ar,Lr]=Ln(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem($r);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});Tn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem($r,JSON.stringify(Ar))}catch{}},300);return()=>clearTimeout(e)},[Ar]);const Tr=En((e,n)=>Lr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Er=En(e=>Tr("left",e),[Tr]),Rr=En(e=>Tr("right",e),[Tr]),Fr=e=>Mr.has(e),Dr=e=>jr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Hr=jn(!1),Vr=jn(null);Tn(()=>{if(Hr.current&&!Uo){const e=Vr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??To.current?.querySelector(`button[aria-label="${CSS.escape(_t.add.title)}"]`))?.focus(),Vr.current=null}Hr.current=Uo},[Uo]),Tn(()=>{if(!Uo||!Fo)return;const e=e=>{"Escape"===e.key&&sl()};return Fo.addEventListener("keydown",e),()=>Fo.removeEventListener("keydown",e)},[Uo,Fo]),fe(Uo,()=>sl()),Tn(()=>{!go&&Uo&&(Go(!1),Ko(null),Jo.current=!1)},[go]);const Wr=G(),Ur=(e,n="success",t)=>{if(Wr)return void(t?Wr(e,"error"===n?"error":"info",t):Wr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Un.error(e,{...o,duration:t?.duration??3200}):Un.success(e,{...o,duration:t?.duration??1900})},Gr=jn(null),[Jr,Yr]=Ln(0),[Kr,Qr]=Ln(0),Xr=J(),Zr=jn(null),_r=e=>Math.max(0,e.clientHeight-(Zr.current?.offsetHeight??0));Tn(()=>{const e=Gr.current;if(!e)return;const n=()=>{Yr(e.clientWidth),Qr(_r(e))};n();const t=new ResizeObserver(n);return t.observe(e),Zr.current&&t.observe(Zr.current),()=>t.disconnect()},[]),Rn(()=>{Gr.current&&(Yr(Gr.current.clientWidth),Qr(_r(Gr.current)))},[Ar,go,yo]);const qr=xo===So?Jr>0?Jr:ko[So]:ko[xo],ei=Jr>0?Math.min(Jr/qr,"shrink"===wo?1:2):1,ni=qr*ei,ti=Jr>0&&ni>Jr+1,oi={width:ni,height:Kr||"100%",flex:"none",position:"relative"},ri={width:qr,height:Kr?Kr/ei:"100%",maxHeight:"none",transform:1!==ei?`scale(${ei})`:void 0,transformOrigin:"top left"},ii=()=>Lt({type:"setUi",ui:{leftSideBarVisible:!go}}),li=()=>Lt({type:"setUi",ui:{rightSideBarVisible:!yo}}),si=e=>{Uo&&(Go(!1),Ko(null),Jo.current=!1,go&&$o===e)||(Mo(e),go||Lt({type:"setUi",ui:{leftSideBarVisible:!0}}))},di=()=>{_o(F),fo.select(null),d()},ai=()=>{_o(Yt??F),yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},ci=At.data.content??[],pi=()=>{const e=ci.findIndex(Kt),n=ci.findIndex(Qt);return{floor:e>=0?e+1:0,cap:n>=0?n:ci.length}},ui=Ft,hi=ur.stripCopy,fi=n=>e(n,hi),mi=te(),gi=Je({data:At.data,config:ui,readOnly:Boolean(It),clipboard:mi,strip:hi?e=>hi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==yn||e.slot!==vn)return{min:0,max:n-1};const{floor:t,cap:o}=pi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&_o(F);const t=void 0===n||"node"===n?.kind?n:null;fo.commitDocument(e,t)}}),yi=ue(),[vi,ki]=Ln(null),bi=e=>{const n=ci.find(n=>String(n.props.id)===e),t=Dt.shared;n&&t&&gi.swap(e,t.detach(n))},Si=e=>{const n=Sn(At.data,Ft,e);if(!n)return!1;const t=kn(n.place),o=n.node,r=t===Ce?Ni(o):Di(o),i=t===Ce?Dt.shared?.usedOn(o):null;return!!gi.remove(e)&&(Ur(i?_t.shared.removed({count:Math.max(0,i.length-1)}):_t.deleted({name:r}),"success",{duration:8e3,action:{label:_t.bar.undo,onClick:()=>{gi.restore(n.node,n.place)}}}),!0)},wi={...gi,remove:Si},xi=e=>br(e,"block",Ft.components[e]?.label??e),zi=En(e=>Ft.components[e]?.defaultProps??{},[Ft]),Ci=e=>br(e,"section",xi(e)),Ni=e=>Se({type:e.type,props:e.props??{}},Ci(e.type),xr),{nodeAddresses:Ii,zoneItems:Oi}=An(()=>{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>=Ie)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Oe(Ft,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ci,Ce,0),{nodeAddresses:e,zoneItems:n}},[ci,Ft]),Bi=En(e=>Oi.get(e)??[],[Oi]),Pi=e=>{const n=Ii.get(e);return n?Bi(n.zone)[n.index]:void 0},$i=e=>ee(ur,Ft,e),Mi=e=>{if(!ur.slotsOf||e===Ce)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Pi(e.slice(0,n));if(!t)return null;const o=$i(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}},ji=(()=>{if(!Y(Zo))return null;const e=`${Zo.nodeId}:${Zo.slot}`;return Mi(e)?.slot.panel===Zo.kind?e:null})(),Ai=jn(null);Tn(()=>{const e=Ai.current;if(Ai.current=null,!ji||!Y(Zo))return;const n=Zo.nodeId;rr(n,{scroll:e!==ji}),jr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Zo]);const Li=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Ii.get(e);n&&(n.zone===Ce?el(n.index):Il(n.zone,n.index,e,Pi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&ji!==i&&(Ai.current=i),dr(null,r),yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ti=(e,n,t)=>{const o=`${e}:${n}`;if(jr(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;ji!==o&&(Ai.current=o);dr(null,{kind:t,nodeId:e,slot:n})},Ei=(e,n,t)=>{if(It||!ur.moveSlot)return;const o=Pi(e),r=o?$i(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:vt,index:n},s=gn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=ur.moveSlot(e,n,s);"string"==typeof d&&Ti(e,d,i.panel)},Ri=wr(),Fi=An(()=>{const e=/* @__PURE__ */new Map;for(const n of Ri??[])e.set(n.slug,n.name);return e},[Ri]),Di=e=>we(e,xi,kr.plainText,e=>Fi.get(e),kr.rowName),Hi=(e,n)=>{const t=Ft.components[e.type]?.fields,o=n===Ce||ql(n)?"section":"block",r=n===Ce&&(Kt(e)||Qt(e)||Ut(e.type)),i="block"===o?xe(t):r?null:ze(t);return kr.renamePropOf?kr.renamePropOf(e,o,i):i},Vi=(e,n,t,o)=>{if(!(!It&&Ir?.zone===e&&Ir.index===n))return;const r=(t,o)=>{Or(null),o&&((e,n,t)=>{const o=Bi(e)[n];if(!o)return;const r=Hi(o,e);r&&fo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
- return st("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":_t.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)},Wi=t(K(),ro),Ui=Wi.scope({target:$n,siteId:Kn,docId:Dn}),Gi=Ft,Ji=(e,n)=>n===Ce?Ci(e):xi(e),Yi=(e,n,t)=>{const o=Wi.plan(Ui,t,Ji(t.type,e),Gi);o&&(o.changed&&fo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Ur(o.message))},Ki=oe({nodesIn:Bi,nodeAt:(e,n)=>Bi(e)[n]??null,labelOf:(e,n)=>n===Ce?Ci(e):xi(e),renamePropOf:Hi,beginRename:(e,n)=>Or({zone:e,index:n}),history:{hasPast:Tt.hasPast,hasFuture:Tt.hasFuture,back:()=>Tt.back(),forward:()=>Tt.forward()},openPageSettings:()=>{fo.select(null),_o(F)},pageSettingsLabel:_t.pageSettings,words:{menu:oo,styleClipboard:ro,screen:_t.menu},readOnly:Boolean(It),collapseAll:()=>jr(new Set(Bi(Ce).map(e=>String(e.props.id)))),onPasteRefused:e=>Ur(e?_t.pasteRefused({name:e.label}):_t.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ts(e,n),menuRows:(e,n,t)=>{const o=cr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Dt.shared;if(!t||n!==Ce)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:_t.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return It||hr(e.type,e)?n:{...n,change:[{label:_t.shared.detach,onClick:()=>bi(e.props.id)}],remove:[{label:_t.shared.removeFromPage,danger:!0,onClick:()=>{Si(e.props.id)}}]}}return It||Kt(e)||Qt(e)||Ut(e.type)?null:z(yi)?{change:[{label:_t.shared.makeShared,onClick:()=>ki({id:e.props.id,name:Ni(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>hr(e.type,e),duplicateBlocked:e=>fr(At.data,e),permits:e=>{const n=Ne(Ft,e.type);return Dt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:wi,isPinned:(e,n)=>n===Ce&&(Kt(e)||Qt(e)),sectionBand:pi,locate:e=>Ii.get(e)??null,rowNameOf:(e,n)=>n===Ce?Ni(e):Di(e),selectAt:(e,n,t,o)=>{e===Ce?el(n):Il(e,n,t,o??"")},slotRung:e=>{const n=Mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Li(n.node,n.slot,!1)}:null},style:{held:()=>ve(Ui),canCopy:e=>Wi.rows(Gi,e).some(e=>!1!==e.counted),copy:(e,n)=>Wi.copy(Ui,e,Ji(e.type,n),Gi),paste:(e,n,t)=>Yi(e,n,t)},keys:Pt?{target:Fo,selected:()=>{const e=At.ui.itemSelector;return e?{zone:e.zone??Ce,index:e.index}:null},held:()=>mi.get(),readOnly:Boolean(It),onDone:({done:e,name:n})=>{"copied"===e&&Ur(_t.copied({name:n}))}}:void 0},Eo),Qi=jn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Tn(()=>{Qi.current={copy:(e,n)=>Wi.copy(Ui,e,Ji(e.type,n),Gi),paste:Yi,at:()=>{const e=At.ui.itemSelector;if(!e)return null;const n=e.zone??Ce,t=Bi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(It)}});const Xi=En(e=>{const n=ke(e);if(!n)return;const t=Qi.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))},[]);Tn(()=>{if(!Fo)return;const e=e=>Xi(e);return Fo.addEventListener("keydown",e),()=>Fo.removeEventListener("keydown",e)},[Xi,Fo]),In(Eo,"keydown",Xi);const Zi=ci.map(e=>e.props.id).join("|");Tn(()=>{const e=Eo?.document??null,n=Eo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Xo(e=>e.length?[]:e);const n=ci.findIndex(Qt),t=n>=0?n:ci.length,o=n=>{const t=ci[n]?.props?.id;return null==t?null:Mn(e,`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Cn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ci.length>0&&!Kt(ci[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=yt(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Xo(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||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},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()}},[Eo,Zi,xo,ei,go,yo,Et?.props.id]);const _i=Eo?.document??null,qi=Eo?.window??null;Tn(()=>{const e=Lo.current;if(!e||!_i||!qi)return;const n=[],t=()=>{const n=Mn(_i,`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&qi.scrollTo({left:qi.scrollX,top:qi.scrollY+t,behavior:"instant"}),!0};return Lo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[_i,qi]);const el=e=>{_o(F),fo.select({index:e}),cr.sectionPressed?.(ci[e]);const n=ci[e]?.props?.id;n&&l(n)},nl=e=>{const{floor:n,cap:t}=pi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Et&&Zo.kind!==Yt?.kind?ci.findIndex(e=>e.props.id===Et.props.id):-1;return o(r>=0?r+1:t)},tl=(e,n)=>{const{floor:t,cap:o}=pi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(fo.reorderComponent(Ce,e,i),fo.select({index:i}),{moved:!0,dest:i})},ol=(e,n,t,o)=>{_o(F),fo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Ur(_t.sectionAdded({name:t}))},rl=(e,n)=>{const t=nl(n),o=gr(e,{nodeDefaults:zi,newNodeId:Pe,sectionLabel:Ci,blockIsOffered:vr}),r=o?fo.insertNode(Ce,t,o):fo.insertSection(e,t);return ol(t,r,Ci(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Oe(Ft,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=yr(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},il=e=>ll(Ce,e),ll=(e,n)=>{Vr.current=document.activeElement??null,Ko(null===n?null:{zone:e,index:n}),Go(!0),go||(Jo.current=!0,Lt({type:"setUi",ui:{leftSideBarVisible:!0}}))},sl=()=>{Go(!1),Ko(null),Jo.current&&Lt({type:"setUi",ui:{leftSideBarVisible:!1}}),Jo.current=!1},dl=(e,n)=>kr.rowName?n?Kt(e)?kr.rowName(e,"section",_t.header):Qt(e)?kr.rowName(e,"section",_t.footer):Ut(e.type)?kr.rowName(e,"section",xi(e.type)):Ni(e):Di(e):n?Ci(e.type):xi(e.type),al=e=>n=>{e()},cl=(e,n,t)=>{if(It)return null;const o=Bi(e)[n];return o&&!Ne(Ft,o.type).delete||o&&hr(o.type,o)?null:/* @__PURE__ */st(He,{kind:"delete",label:e===Ce&&o&&Dt.shared?.usedOn(o)?_t.shared.removeFromPage:_t.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Bi(e)[n]?.props?.id;null!=t&&Si(String(t))})(e,n),children:/* @__PURE__ */st(tt,{size:15})})},pl=e=>kr.rowPreview?.(e)||void 0,ul=e=>kr.rowMarks?.(e)??void 0,hl=(e,n,t)=>kr.rowActions?.(e,n,t)??null,fl=(e,n,t,o)=>{if(It)return null;if(hr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
- return st(He,{kind:"eye",label:r?_t.showNamed({name:o}):_t.hideNamed({name:o}),onClick:()=>gl(e,n,t),children:/* @__PURE__ */st(r?ot:rt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},ml=e=>Vs(Ce,e),gl=(e,n,t)=>{fo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},yl=e=>Be(Ft,e),vl=e=>Oe(Ft,e),kl=e=>ur.slotsOf?$i(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:$e(e,n.slot)})):[{slot:null,rung:null,kids:vl(e)}],bl=e=>ur.slotsOf?kl(e).flatMap(e=>e.kids):vl(e),Sl=e=>Boolean(ur.slotsOf)&&$i(e).some(e=>e.rung),wl=(e,n,t)=>null===t?void 0===n?yr(e):yr(e,n):yr(e,n,t),xl=(e,n,t)=>{const o=Me(Ft,e.type,n)&&(t||bl(e).length>0||Sl(e));return{collapsible:o,folded:o&&Fr(String(e.props.id))}},zl=(e,n,t)=>kl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>xl(e,r,t(e.type)).collapsible?[String(e.props.id),...zl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Cl=e=>bl(e).length>0||Sl(e)||Boolean(yr(e.type)),Nl=e=>Boolean(yr(e)),Il=(e,n,t,o)=>{if(_o(F),yr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),fo.select({index:n,zone:e}),l(t)}else fo.select({index:n,zone:e}),l(t)},Ol=(e,n,t,o,r)=>{const i=`${e}:${n}`;fo.insertComponent(i,t,o),yr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),fo.select({index:o,zone:i})}):fo.select({index:o,zone:i})},Bl=jn(/* @__PURE__ */new Set);Tn(()=>{ci.forEach(e=>{const n=yr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Bl.current.has(t))return;Bl.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(zi)).forEach((e,t)=>po.seedChild(o,t,n.childType,e))})},[ci,po,zi]);const Pl=jn(/* @__PURE__ */new Set);Tn(()=>{ci.forEach((e,t)=>{const o=e.props.id;if(Pl.current.has(o))return;const r=n(e,yl(e.type));Pl.current.add(o),r&&po.replaceComponent(Ce,t,{...e,props:r})})},[ci,po]),Q(po,Ft);const $l=ci.findIndex(Qt),Ml=$l>=0?ci[$l]:null,jl=Xt?ci.findIndex(Kt):-1,Al=jl>=0?ci[jl]:null,Ll=Dt.groupTab,Tl=An(()=>Ll?e=>Ut(e.type):void 0,[Ll]),El=Boolean(Dt.groupBadge),Rl=Dt.sharedReach,Fl=e=>Rl?.(e)??void 0,Dl=An(()=>Rl?new Set(ci.filter(e=>Fl(e)).map(e=>String(e.props.id))):null,[ci,Rl]),Hl=An(()=>Dl?e=>Dl.has(e):void 0,[Dl]),Vl=Dt.first?Rl?.({type:Dt.first,props:{id:""}})??void 0:void 0,Wl=Dt.groupBadge?/* @__PURE__ */st("span",{className:"es-tree-group-badge",children:/* @__PURE__ */st(Hn,{tone:"info",size:"xs",children:Dt.groupBadge})}):void 0,Ul=ci.find(e=>e.type===Vt)??null,Gl=ci.find(e=>e.type===Wt)??null,Jl=$l>=0?$l:ci.length,Yl=[];ci.forEach(e=>{Qt(e)||(Cl(e)&&Yl.push(String(e.props.id)),Yl.push(...zl(e,1,Nl)))}),Ml&&(Yl.push(String(Ml.props.id)),Yl.push(...zl(Ml,1,Nl)));const Kl=Yl.length>0&&Yl.every(e=>Mr.has(e)),Ql=e=>{const n=kr.blockRowName(e,xi);return kr.rowName?kr.rowName(e,"block",n):n},Xl=(e,n,t,o)=>{const r=Bi(e)[t];if(!r)return;const i={...bn(e),index:t},l={...bn(n),index:Math.min(Math.max(o,0),Bi(n).length)},s=gn(i,l);if(e!==n||s!==t)try{gi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof wn))throw e}},Zl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of vl(e))n.add(r),t(o)};for(const t of yl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},_l=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ii.get(n);if(!e)return null;if(e.zone===Ce)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ql=e=>{const n=e.slice(0,e.indexOf(":")),t=ci.find(e=>Ut(e.type)&&String(e.props.id)===n);return t&&Gt(n)===e?t:null},es=(e,n)=>{const t=ql(e);return!t||(!Dt.groupAccepts||Dt.groupAccepts(t.type,n,Bi(e).length))},ns=(e,n,t)=>{if(e.rung){const t=Pi(e.rung.nodeId),o=t?$i(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===vt&&n.index>=0&&n.index<=o}if(n.slot===vt)return!1;if(e.add)return is(e.add,n);const o=kn(n);if(Ut(e.type))return!1;const r=ql(o),i=ql(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!es(o,e.type))&&(n.index>=0&&n.index<=Bi(o).length));if(e.zone===Ce||o===Ce){if(e.zone!==o)return!1;const{floor:t,cap:r}=pi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Bi(o).length)return!1;if(e.zone===o)return!0;const l=Ml&&!Dt.lastIsOpen?String(Ml.props.id):null;return(!l||_l(e.zone)!==l&&_l(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Bi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ii.get(i),s=l?Bi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Zl(r).has(n))return!1;const d=yr(s.type,mr(At?.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?.(Bi(n),r))})(e.zone,o,e.index,t)},ts=(e,n)=>{const t=kn(e.from),o=e.node;return t===kn(n)?es(t,o.type):ns({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},os=e=>{const n=e.slice(0,e.indexOf(":")),t=Ii.get(n),o=t?Bi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=yr(o.type,mr(At?.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=B(r.choices??(r.spec?[{type:r.spec.childType,label:xi(r.spec.childType)}]:[])),l=Mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:dl(o,t.zone===Ce)}},rs=(e,n)=>{if("section"!==e.kind)return e;const t=kn(n);return t===Ce||ql(t)?e:os(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},is=(e,n)=>{const t=rs(e,n),o=kn(n);if("shared"===t.kind){if(o!==Ce||!Dt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ql(o)){const e="section"===t.kind?t.type:t.template.node.type;return es(o,e)&&n.index>=0&&n.index<=Bi(o).length}if(o!==Ce)return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if(o===Ce)return!1;const r=os(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Bi(o))},ls=(e,n)=>{const t=rs(e,n);if("block"!==t.kind&&ql(kn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&es(n,o)){if("section"===e.kind)fo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;fo.insertNode(n,t,fi(e.template.node))}_o(F),fo.select({index:t,zone:n})}})(t,kn(n),n.index);if("section"===t.kind)return void rl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=nl(t),r=fo.insertNode(Ce,o,n);ol(o,r,e)})(t.template.name,fi(t.template.node),n.index);if("shared"===t.kind){const e=Dt.shared?.nodeOf(t.section);if(!e)return;const o=nl(n.index);return void(gi.restore(e,{parentId:yn,slot:vn,index:o})&&ol(o,e.props.id,t.section.title))}const o=kn(n),r=os(o);r&&(r.target.spec?Ol(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{fo.insertComponent(e,n,t),_o(F),fo.select({index:t,zone:e})})(o,t.type,n.index))},ss=(e,n)=>{e.media?function(e){const n=Es();if(!n||!As)return;Fs(n).then(n=>{n&&function(e,n){if(!As)return;const t=As.create(e,{nodeDefaults:zi,newNodeId:Pe,sectionLabel:Ci,blockIsOffered:vr}),o=kn(n);if(o===Ce){const e=nl(n.index),o=fo.insertNode(Ce,e,t);return void ol(e,o,Ci(t.type))}fo.insertNode(o,n.index,t),_o(F),fo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Ei(e.rung.nodeId,e.index,n.index):e.add?ls(e.add,n):e.zone===Ce?tl(e.index,n.index):Xl(e.zone,kn(n),e.index,n.index)},[ds]=Ln(()=>fn()),as=mn({keyOf:e=>e.id,readOnly:Boolean(It),session:ds,canDrop:ns,onDrop:ss,onStep:(e,n)=>{e.rung?Ei(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Ce?((e,n)=>{const t=Ci(ci[e]?.type??""),o=tl(e,n<0?e-1:e+2);if(!o.moved)return void Ur(n<0?_t.sectionFirst({name:t}):_t.sectionLast({name:t}));const{floor:r,cap:i}=pi();Ur(_t.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Xl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),cs=En(e=>{const{floor:n,cap:t}=pi(),o=[];for(const r of e.nodes){const e=kn(r.place),i=Bi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Kt(i)||Qt(i)||hr(i.type,i))continue;if(Ut(i.type))continue;const l=Boolean(ql(e)),s=e===Ce||l;e===Ce&&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?Ci(i.type):Di(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=kn(e.list);if(n===Ce&&0===e.children.length)return[{...e,addLabel:_t.addSection,addAlways:!0}];const t=os(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ql(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=kn(e.list),t=n===Ce||ql(n)?null:os(n);return t?.choices.length?cn(e,t.target.spec?.addLabel??_t.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[At.data]),ps=null==Et?.props.id?null:String(Et.props.id),us=En(e=>{const n=Ft,t=e=>!e.item.rung&&null!==Sn(At.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(ps);return i||(r(Ye(At.data,n,o.item.id,ps,Tl))??o)},[At.data,Ft,ps,Tl]),[hs,fs]=Ln(null),ms=Boolean(Ll||Rl);In(Eo,"mouseover",e=>{if(!ms)return;const n=On(e.target),t=n?ht(At.data,Ft,n):null;t!==hs&&fs(t)}),In(Eo,"mouseout",e=>{ms&&!e.relatedTarget&&fs(null)});const gs=e=>Kt(e)||Qt(e)||Ut(e.type),ys=e=>{const n=Ut(e.type)?xi(e.type):Kt(e)?_t.header:Qt(e)?_t.footer:null;return null===n?Ni(e):kr.rowName?kr.rowName(e,"section",n):n},vs=[];if(ms){const e=ps?ht(At.data,Ft,ps):null;for(const n of/* @__PURE__ */new Set([e,hs])){const e=n?ci.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Kt(e)||e.type===Vt,o=Fl(e);if(o){vs.push({id:String(e.props.id),label:ys(e),below:t,reach:o});continue}if(!Ll||!gs(e))continue;const r=Ll(e);r&&vs.push({id:String(e.props.id),label:r,below:t})}}const ks=ue(),bs=jn(null);Tn(()=>{const e=Dt.changeNotice;if(!e)return;const n=JSON.stringify(ci.filter(gs)),t=bs.current;if(bs.current={doc:Dn,bands:n,index:Tt.index},!t||t.doc!==Dn||t.bands===n)return;Tt.hasPast&&Tt.index>=t.index&&!ut.has(ks)&&(ut.add(ks),Ur(e,"success",{action:{label:_t.bar.undo,onClick:()=>Tt.back()},duration:8e3}))},[ci]);const Ss=e=>{_o(F),fo.select(e.zone===Ce?{index:e.index}:{index:e.index,zone:e.zone})},ws=X(),xs=()=>({data:At.data,device:xo,ops:fo,inspector:ar}),zs=ws?.model,Cs=An(()=>zs?e=>zs(e,cs(e),xs()):cs,[zs,cs,xo]),Ns=ws?.measure,Is=Ns?(e,n)=>Ns(e,n,xs()):void 0,Os=ws?.canDrop,Bs=Os?(e,n)=>Os(e,n,ns,xs()):ns,Ps=ws?.drop,$s=Ps?(e,n)=>Ps(e,n,ss,xs()):ss,Ms=ws?.pick,js=Ms?e=>Ms(e,Ss,xs()):Ss,As=ws?.media??null,Ls=jn(null),Ts=An(()=>As?{id:ct,zone:"",index:-1,type:As.adds.type,add:{kind:As.adds.kind,type:As.adds.type},media:!0}:null,[As]);Tn(()=>{if(!Ts||It||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Zn))(e)&&(Ls.current=null,ds.start({key:ct,item:Ts}))},n=e=>{ds.get()?.item.media&&(Ls.current=Gn(e.dataTransfer))},t=()=>{ds.get()?.item.media&&ds.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Ts,It,ds]);const Es=()=>{const e=Ls.current;return Ls.current=null,e},Rs=pe(),Fs=async e=>{if(!Rs)return e;const n=await Rs(e);return n?{...e,id:n.id,url:n.url}:null};const Ds=(e,n)=>{if(!As)return;const t=Sn(ho.getState().appState.data,ui,n);if(!t)return;const o=t.node;fo.replaceComponent(kn(t.place),t.place.index,{...o,props:{...As.replace(o,e),id:o.props.id}})},Hs=e=>{const n=kn(e),t=Mi(n);t&&Li(t.node,t.slot,!1),ll(n,e.index)},Vs=(e,n)=>/* @__PURE__ */st(Ve,{...It?{}:as.seam({place:{...bn(e),index:n}})},`seam:${e}:${n}`),Ws={rowClick:al,isCollapsed:Fr,toggleCollapse:Dr},Us=e=>{const n=String(e.props.id),t=ci.findIndex(e=>String(e.props.id)===n),o=Gt(n),r=Bi(o),i=Fr(n),l=xi(e.type),s=kr.rowName?kr.rowName(e,"section",l):l,d=e=>Vs(o,e);/* @__PURE__ */
16
- return dt(at,{children:[
17
- /* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:e.type,size:13}),name:s,preview:pl(e),marks:ul(e),onSelect:()=>el(t),nameSlot:Vi(Ce,t,n,s),selected:er===n,badge:Fl(e)?void 0:Wl,shared:Fl(e),actions:hl(e,Ce,t)??void 0,rowProps:{"data-node-id":n,onClick:al(()=>el(t))},fold:{open:!i,label:"section",onToggle:()=>Dr(n)}}),!i&&/* @__PURE__ */dt(Re,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ni(n),l=Cl(n),s=l&&Fr(r),a=()=>Il(o,t,r,e.type),{rowProps:c,...p}=as.row({item:{id:r,zone:o,index:t,type:n.type},place:{...bn(o),index:t}},{"data-node-id":r,onClick:al(a)});/* @__PURE__ */
18
- return dt(Fn,{children:[d(t),
19
- /* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:a,nameSlot:Vi(o,t,r,i),selected:er===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(o,t,i),hl(n,o,t),fl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */st(Re,{children:Ys(n,2)})]},r)}),d(r.length)]})]})},Gs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=as.dragging,d=!Fr(l)&&s?.rung?.nodeId!==i,a={...bn(l),index:0},c=s&&!s.rung&&ns(s,a)?a:void 0,p=()=>Li(e,n,!0),{rowProps:u,...h}=as.row({item:{id:`rung:${l}`,zone:`${i}:${vt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:vt,index:t},into:c,canDrag:Boolean(ur.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:al(p)}),f=It?null:ur.slotActions?.(e,n.slot);/* @__PURE__ */
20
- return dt(Fn,{children:[n.heading,
21
- /* @__PURE__ */st(Ee,{words:qt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:ji===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Dr(l)},actions:f&&f.length>0?/* @__PURE__ */st(at,{children:f.map((t,o)=>/* @__PURE__ */st(He,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(It||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ti(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__ */st(tt,{size:15}):/* @__PURE__ */st(lt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */st(Re,{children:r})]},l)},Js=(e,n)=>{const t=kl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
- return st(at,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=wl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Vs(e,n),p=/* @__PURE__ */dt(at,{children:[i.map(({child:n,zone:t,index:o})=>{const r=er===String(n.props.id),{collapsible:i,folded:s}=xl(n,l,Nl(n.type)),d=String(n.props.id),a=Ql(n),p=()=>Il(t,o,d,e.type),{rowProps:u,...h}=as.row({item:{id:d,zone:t,index:o,type:n.type},place:{...bn(t),index:o}},{"data-node-id":d,onClick:al(p)});/* @__PURE__ */
23
- return dt(Fn,{children:[0===o&&c(t,0),
24
- /* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:n.type,size:13}),name:a,preview:pl(n),marks:ul(n),onSelect:p,nameSlot:Vi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Dr(d)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(t,o,a),hl(n,t,o),fl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */st(Re,{children:Js(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Gs(e,t.rung,r++,o,p):/* @__PURE__ */st(Fn,{children:p},t.slot??"")})})},Ys=(e,n)=>{const t=mr(At?.data,e.type,String(e.props.id)),o=kl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
- return st(at,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=wl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Vs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */dt(at,{children:[l.map(({child:n,zone:t,index:o})=>{const r=er===String(n.props.id),i=Di(n),l=String(n.props.id),{collapsible:d,folded:a}=xl(n,s,Nl(n.type)),c=yl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...bn(p),index:Bi(p).length}:void 0,h=as.dragging,f=u&&h&&ns(h,u)?u:void 0,g=()=>Il(t,o,l,e.type),{rowProps:y,...v}=as.row({item:{id:l,zone:t,index:o,type:n.type},place:{...bn(t),index:o},into:f,canDrag:!hr(n.type,n)},{"data-node-id":l,onClick:al(g)});/* @__PURE__ */
26
- return dt(Fn,{children:[0===o&&m(t,0),
27
- /* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:g,nameSlot:Vi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Dr(l)}:void 0,actions:hr(n.type,n)?hl(n,t,o)??void 0:/* @__PURE__ */dt(at,{children:[cl(t,o,i),hl(n,t,o),fl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */st(Re,{children:Ys(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
- /* @__PURE__ */st(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Ol(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?Gs(e,o.rung,i++,r,v):/* @__PURE__ */st(Fn,{children:v},o.slot??"")})})},Ks=Uo,Qs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:go&&!Ks&&pr===e.id,onSelect:()=>si(e.id)}:e,Xs=[...(cr.railLead??[]).map(Qs),{id:"sections",label:_t.layers,icon:/* @__PURE__ */st(me,{}),active:go&&!Ks&&"sections"===pr,onSelect:()=>si("sections")},...(cr.railTrail??[]).map(Qs)],Zs=No?{onPress:Io}:$t?{onPress:()=>{le(zn,{accept:"image/*",title:io.mediaLibrary})}}:null,_s={value:Xs.find(e=>!0===e.active)?.id??"",press:e=>{const n=Xs.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:Xs.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */st("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},qs=[...cr.railLead??[],...cr.railTrail??[]].find(e=>"panel"in e&&e.id===pr),ed=Boolean(Zt?.foldable),nd=Zt?.label??(Mt?_t.pageSections:_t.templateSections),td=ed&&Fr(kt),od=/* @__PURE__ */dt(at,{children:[ci.map((e,n)=>{if(Kt(e)||Qt(e)||Ut(e.type))return null;const t=er===String(e.props.id),o=Boolean(e.props._hidden);vl(e);const r=String(e.props.id),i=cr.hasOwnRows?.(e)??!1,l=Cl(e)||i,s=l&&Fr(r),d=yl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...bn(a),index:Bi(a).length}:void 0,p=as.dragging,u=c&&p&&ns(p,c)?c:void 0,{rowProps:h,...f}=as.row({item:{id:r,zone:Ce,index:n,type:e.type},place:{...bn(Ce),index:n},into:u,canDrag:!hr(e.type,e)},{"data-node-id":r,onClick:al(()=>el(n))});/* @__PURE__ */
29
- return dt(Fn,{children:[n>0&&ml(n),
30
- /* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:e.type,size:13}),name:Ni(e),preview:pl(e),marks:ul(e),shared:Fl(e),onSelect:()=>el(n),nameSlot:Vi(Ce,n,r,Ni(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(Ce,n,Ni(e)),hl(e,Ce,n),fl(Ce,n,e,Ni(e))]}),rowProps:h}),Cl(e)&&!s&&/* @__PURE__ */dt(Re,{children:[Ys(e,1),cr.partRows?.(e,Ws)]}),i&&!s&&/* @__PURE__ */st(Re,{children:cr.ownRows?.(e,n,Ws)})]},String(e.props.id??n))}),Jl>0&&ml(Jl)]}),rd=(e,n,t)=>{const o=String(e.props.id),r=bl(e).length>0||Sl(e)||Boolean(yr(e.type)),i=r&&Fr(o),l="header"===t?_t.header:_t.footer,s=kr.rowName?kr.rowName(e,"section",l):l;/* @__PURE__ */
31
- return dt(at,{children:[
32
- /* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:t,size:13}),name:s,preview:pl(e),marks:ul(e),badge:Fl(e)?void 0:Wl,shared:Fl(e),onSelect:()=>el(n),nameSlot:Vi(Ce,n,o,s),selected:er===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Dr(o)}:void 0,actions:hl(e,Ce,n)??void 0,rowProps:{"data-node-id":o,onClick:al(()=>el(n))}}),r&&!i&&/* @__PURE__ */st(Re,{children:Js(e,1)})]})};return(cr.wrap??(e=>e))(
33
- /* @__PURE__ */st(Z,{target:Eo,children:/* @__PURE__ */dt("div",{ref:To,className:"sf-editor es-editor",style:tn(Ar),onContextMenu:Ki.onEditorContextMenu,...u(zn),children:[
34
- /* @__PURE__ */dt(Ke,{children:[
35
- /* @__PURE__ */dt("div",{className:"es-cluster es-cluster--left",children:[Zs?/* @__PURE__ */st(Vn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */st(ge,{}),onClick:Zs.onPress,children:_t.railMedia}):null,
36
- /* @__PURE__ */st(Qe,{label:_t.bar.undo,disabled:Boolean(It)||!Tt.hasPast,onClick:()=>Tt.back(),children:/* @__PURE__ */st(_n,{})}),
37
- /* @__PURE__ */st(Qe,{label:_t.bar.redo,disabled:Boolean(It)||!Tt.hasFuture,onClick:()=>Tt.forward(),children:/* @__PURE__ */st(qn,{})})]}),
38
- /* @__PURE__ */dt(Xe,{children:[
39
- /* @__PURE__ */st(Ze,{devices:vo,value:xo,onChange:zo}),
40
- /* @__PURE__ */st(Qe,{label:_t.bar.refresh,tip:_t.bar.refreshTip,onClick:()=>{Lo.current=(()=>{const e=Eo?.document;if(!e)return null;const n=ci.findIndex(Qt),t=n>=0?n:ci.length;let o=null;for(let n=0;n<t;n++){const t=ci[n]?.props?.id;if(null==t)continue;const r=Mn(e,`[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=Et?.props?.id??ci[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Ao(e=>e+1)},children:/* @__PURE__ */st(et,{})}),cr.barView?.()]}),
41
- /* @__PURE__ */dt(Xe,{kind:"right",style:{minWidth:300},children:[
42
- /* @__PURE__ */st(k,{input:Vo,words:_t.saveStatus}),Bn?/* @__PURE__ */st(Bn,{}):null,cr.barLead?.(),cr.barTrail?.(),cr.mainAction||!cr.barMain?/* @__PURE__ */st(b,{input:Vo,action:cr.mainAction??{label:_t.done,onPress:()=>{Qn(At.data)}},readOnly:Boolean(It),saveSwitch:Bt,onToggleAutoSave:xt,onSaveNow:Wo,bar:_t.bar,words:_t.saveStatus}):cr.barMain()]})]}),
43
- /* @__PURE__ */st(re,{}),
44
- /* @__PURE__ */dt("div",{className:"sf-body",children:[go?/* @__PURE__ */dt(at,{children:[
45
- /* @__PURE__ */dt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":_t.leftPanel,children:[
46
- /* @__PURE__ */dt("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
47
- /* @__PURE__ */st(N,{side:"left",onHide:ii}),
48
- /* @__PURE__ */st("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
49
- /* @__PURE__ */st(Wn,{variant:"underline",block:!0,"aria-label":_t.bar.views,value:_s.value,onChange:_s.press,items:_s.items})]}),Uo?/* @__PURE__ */st(x,{at:Yo?{label:(e=>{const n=ql(e.zone);if(n)return _t.add.addingTo({name:kr.rowName?dl(n,!0):xi(n.type)});if(e.zone===Ce){const n=ci[e.index];return n&&!Qt(n)?_t.add.addingBefore({name:dl(n,!0)}):_t.add.addingAtEnd}const t=os(e.zone);return t?_t.add.addingTo({name:t.parentName}):_t.add.addingHere})(Yo),onClear:()=>Ko(null)}:void 0,placeBlocks:Yo&&Yo.zone!==Ce?os(Yo.zone)?.choices:void 0,canTake:Yo?e=>{if(!Yo)return null;const n={...bn(Yo.zone),index:Yo.index};if(is(e,n))return null;if("shared"===e.kind&&Yo.zone===Ce&&!Dt.shared?.nodeOf(e.section))return _t.shared.alreadyHere;const t=ql(Yo.zone);if(t)return _t.add.notInside({name:dl(t,!0)});if(Yo.zone===Ce)return _t.add.onlySections;const o=os(Yo.zone);return o?_t.add.notInside({name:o.parentName}):_t.add.onlySections}:void 0,onPick:Yo?e=>{if(!Yo)return;const n={...bn(Yo.zone),index:Yo.index};is(e,n)&&(ls(e,n),sl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ds,siteWide:cr.addPanelRow?.(sl),onClose:sl,readOnly:Boolean(It)}):qs?qs.panel({onHide:ii,notify:Ur}):/* @__PURE__ */dt(at,{children:[
50
- /* @__PURE__ */st(I,{icon:/* @__PURE__ */st(me,{}),title:_t.layers,context:lo,actions:/* @__PURE__ */dt(at,{children:[!It&&/* @__PURE__ */st(_e,{label:_t.add.title,onClick:()=>il(null),children:/* @__PURE__ */st(nt,{size:15})}),
51
- /* @__PURE__ */st(_e,{label:Kl?_t.expandAll:_t.collapseAll,title:0===Yl.length?_t.nothingToFold:void 0,disabled:0===Yl.length,onClick:()=>jr(e=>{const n=new Set(Yl);return Kl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Yl])}),children:/* @__PURE__ */st(mt,{expand:Kl})})]})}),
52
- /* @__PURE__ */dt(Fe,{className:"sf-tree sf-scroll",words:qt,children:[
53
- /* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:"page",size:13}),name:_t.pageSettings,onSelect:di,selected:!Et&&qo,rowProps:{onClick:al(di)}}),Ul&&/* @__PURE__ */dt(at,{children:[!El&&/* @__PURE__ */st(De,{children:_t.header}),Us(Ul)]}),jt&&!(El&&Ul)&&/* @__PURE__ */dt(at,{children:[!El&&/* @__PURE__ */st(De,{children:_t.header}),!Xt&&/* @__PURE__ */st(Ee,{words:qt,icon:/* @__PURE__ */st(Sr,{type:"header",size:13}),name:_t.header,badge:Vl?void 0:Wl,shared:Vl,onSelect:ai,selected:Zo.kind===Yt?.kind,rowProps:{onClick:al(ai)}})]}),Al&&!(El&&Ul)&&rd(Al,jl,"header"),!ed&&/* @__PURE__ */st(De,{children:nd}),ed?/* @__PURE__ */dt(at,{children:[
54
- /* @__PURE__ */st(Ee,{words:qt,icon:null,name:nd,fold:{open:!td,label:nd,onToggle:()=>Dr(kt)}}),!td&&/* @__PURE__ */st(Re,{children:od})]}):od,jt&&!El&&/* @__PURE__ */st(De,{children:_t.footer}),Ml&&!(El&&Gl)&&rd(Ml,$l,"footer"),Gl&&Us(Gl),cr.treeFoot?.()]})]})]}),
55
- /* @__PURE__ */st(qe,{side:"left",width:Ar.left,min:nn.left,max:en,defaultWidth:m.left,label:_t.resizeLeftPanel,onResize:Er})]}):/* @__PURE__ */st(O,{side:"left",onShow:ii}),
56
- /* @__PURE__ */dt("div",{ref:Gr,className:"sf-center sf-scroll","data-sf-canvas-head":Xr?"":void 0,style:{overflowX:ti?"auto":"hidden",overflowY:"hidden"},children:[Xr&&/* @__PURE__ */st("div",{ref:Zr,className:"sf-canvas-head",children:/* @__PURE__ */st(Xr,{device:xo})}),
57
- /* @__PURE__ */dt("div",{className:"sf-frame-scaler",style:oi,children:[
58
- /* @__PURE__ */st("div",{className:"sf-frame "+(xo===So?"":`sf-frame--${xo}`),style:ri,children:/* @__PURE__ */dt("div",{className:"sf-preview-host",children:[
59
- /* @__PURE__ */st(Le.Provider,{value:Tl,children:/* @__PURE__ */st(Te.Provider,{value:Hl,children:/* @__PURE__ */st(so,{},jo)})}),
60
- /* @__PURE__ */st(pn,{canvas:Eo,session:ds,model:Cs,measure:Is,canDrop:Bs,onDrop:$s,choose:us,onPick:js,dropOn:As?{accepts:(e,n)=>{if(!e.media||!As||n.item.rung)return!1;const t=Sn(At.data,ui,n.item.id);return null!==t&&As.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Es();n&&As&&Fs(n).then(n=>{n&&Ds(n,e.item.id)})})(n),label:()=>_t.canvasReplaceImage}:void 0,onZoneAdd:Hs,onSeamAdd:Hs,zoneAddLabel:_t.canvasAddBlock,words:eo.canvas,readOnly:Boolean(It),revision:At.data}),Qo.length>0&&!Ro&&/* @__PURE__ */st("div",{className:"sf-preview-gaps",children:Qo.map(e=>
61
- /* @__PURE__ */st(un,{index:e.index,label:_t.addSectionHere,onInsert:()=>il(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),ms?/* @__PURE__ */st(ft,{canvas:Eo,tabs:vs,onSelect:e=>{const n=ci.findIndex(n=>String(n.props.id)===e);n>=0&&el(n)}}):null]})]}),yo?/* @__PURE__ */dt(at,{children:[Pn?
62
- /* @__PURE__ */st("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Pn}):/* @__PURE__ */st(at,{children:/* @__PURE__ */st(h,{value:{selectChild:Il,addChild:Ol,childRowName:Di,blockRowName:Ql},children:/* @__PURE__ */st(ao,{mode:Zo,onOpenWebsiteSettings:cr.openSettings??(()=>{}),onOpenSiteStyles:cr.openStyles,onSelectNode:Cr,onNotify:Ur,onHidePanel:li,nodeActions:Et?Ne(Ft,Et.type):bt})})}),
63
- /* @__PURE__ */st(qe,{side:"right",width:Ar.right,min:nn.right,max:en,defaultWidth:m.right,label:_t.resizeSettingsPanel,onResize:Rr})]}):
64
- /* @__PURE__ */st(O,{side:"right",onShow:li})]}),Ki.menu,
65
- /* @__PURE__ */st(ne,{}),vi?/* @__PURE__ */st(pt,{name:vi.name,onMake:e=>(async(e,n)=>{const t=ci.find(n=>String(n.props.id)===e),o=Dt.shared;if(!t||!o)return;let r;try{r=await C(yi).create(n,t)}catch{return void Ur(_t.shared.makeFailed,"error")}o.adopt(t,r),ki(null)})(vi.id,e),onCancel:()=>ki(null)}):null]})}))}export{wt as ScreenChrome};
@@ -1 +0,0 @@
1
- import{hidableText as n}from"./chunk-6W7WLPZH.js";import{textFieldIdentifier as r}from"./chunk-DUVRZ456.js";function t(r,t){const o=n(r.props.name);if(o)return o;const e=n(r.props.altName);if(e)return e;const c=r.props.collection?.name;if(c)return c;const u=r.props.source?.title;if(u)return u;const s=r.props.code;return s?t?.(s)??s:""}function o(n,r,o,e,c){const u=o(t(n,e))||r(n.type);return c?c(n,"block",u):u}function e(n){if(!n)return null;for(const t of["name","altName"])if(r(n[t]))return t;return null}function c(n){const t=n?.name;return void 0===t||r(t)?"name":null}function u(r,t,o){const e=n(r.props?.name).trim()||t;return o?o(r,"section",e):e}export{u as rootRowName,c as sectionRenameProp,t as slotChildName,e as slotChildRenameProp,o as slotChildRowName};
@@ -1 +0,0 @@
1
- import{createPreviewSelectionContext as e}from"./chunk-GOTN2KY4.js";var{Provider:r,useSelection:o}=e("selectedPartId");export{r as PreviewPartsProvider,o as usePreviewParts};
@@ -1,2 +0,0 @@
1
- import{routeSharedHostMessage as e}from"./chunk-77IWWW6X.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,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-U66YKDAR.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-O7Q4DDJT.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-RSCMJIWS.js";import{useEaselHost as k}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-EB6NI2VK.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as S,CLAIM_FAIL_OPEN_MS as b,holderOf as I}from"./chunk-THWO5YVZ.js";import{useWords as P}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as E,useCallback as O,useEffect as C,useRef as H}from"react";import{jsx as A}from"react/jsx-runtime";var D={content:[],root:{},zones:{}};var M=j(null);function T(){const e=R(M);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function N({target:j,addressing:R=o,onHostMessage:T,children:N}){const W=R,{homeSlug:F,entryMayBounce:L,entryBounce:V,onSwitch:Y,tellsHost:K,adapterFor:U,migrateRenamedProps:X,describeMissing:Z,onLoadFailed:x}=W,[G,J]=B(j),Q=k(),z=d(),_=E(()=>f(z),[z]),q=E(()=>t(z),[z]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??F??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=z.blocks,oe=E(()=>U(G,_,te),[U,_,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=O(e=>z.documentHooks?.stored?.(e)??e,[z]);C(()=>{m(z,ne)},[z,ne]);const se=H(G);C(()=>{se.current=G},[G]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(T?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Br(e.target)}}}),de=!z.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(_.lock),[ke,ve]=B(null),[ge,pe]=B(null),[he,ye]=B(null),[we,Se]=B(null),be=P("screen",v),Ie=we?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})}}(we,be):null,[Pe,je]=B(null),Re=H(null),Be=H(null),[Ee,Oe]=B(!1),Ce=H(null),[He,Ae]=B(null),De=H(null),[Me,Te]=B(null),[Ne,We]=B(!1),Fe=H(null);C(()=>{Fe.current=Me},[Me]);const[Le,Ve]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ye=H(Le);C(()=>{Ye.current=Le},[Le]);const Ke=H(()=>Promise.resolve(!1)),Ue=O(e=>{Be.current=e,Oe(!0)},[]),Xe=g({save:async({id:e,data:r})=>{if(p(Ye.current)){if(!await Ke.current(e,r)){if(!p(Ye.current))return void Ue({id:e,data:r});throw new Error("page save did not land")}}else Ue({id:e,data:r})},onFailure:(e,r)=>{0===r&&Q.send("storefront-editor:save-failed")}}),{state:Ze,push:xe,flush:Ge,pause:Je,resume:Qe,stop:ze,reset:_e,retryNow:qe,hasPending:$e}=Xe,er=H(Ze);C(()=>{er.current=Ze},[Ze]);const rr=u(Ze),nr=O(()=>{const e=Be.current;e&&(Be.current=null,Oe(!1),xe(e))},[xe]),tr=H("");tr.current||(tr.current=h());const[or,ur]=B(0),ar=H(!1),[sr,ir]=B(L(j)),lr=H(!1);C(()=>{if(lr.current)return;lr.current=!0;const e=Q.address.search(),r=V(j,e);r?Q.address.load(r):L(j)&&ir(!1)},[j,Q]);const cr=Q.send;C(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=z.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==F&&re!==F?void Q.address.load({kind:"page",slug:F,siteId:ne??void 0}):(Se({target:t,slug:re,missing:!0,sentence:Z?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),De.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:D,s=X(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),Se({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},z),cause:r(o,z)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=O(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=O(async e=>{const r=le.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)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,z]),mr=O(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=O(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Ye.current))return!1;if(Fe.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,De.current,tr.current));if(t.ok)return De.current=t.value.version??De.current,We(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ye.current=e,Ve(e),!1}const u=q.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return De.current=n.value,Ke.current(e,r,!0)}ze(),Fe.current=u,Te(u)}return We(i(t.error,z)?.status===c),!1},[oe,fr,ze,z]);C(()=>{Ke.current=kr},[kr]);const vr=O(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);Ce.current=r,p(Ye.current)?xe({id:ke,data:r}):Ue({id:ke,data:r})},[ke,cr,Ue,xe,ae]),gr=O(async()=>{p(Ye.current)&&nr();return await Ge()&&null==Be.current},[nr,Ge]),pr=H(gr);C(()=>{pr.current=gr},[gr]);const hr=H(fr);C(()=>{hr.current=fr},[fr]);const yr=O(()=>{Q.address.reload()},[Q]),wr=H(()=>Promise.resolve(!1));C(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:De.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Be.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const Sr=null!==Pe;C(()=>{if(!fe||!ke||!de||Sr)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ye.current,heldWrite:()=>({pending:null!=Be.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=Fe.current}),setAccess:e=>{Ye.current=e,Ve(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=q.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(Ve({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(S)},b)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,Sr]);const br=O(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Ir=O(()=>{Ve(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Pr=O(()=>{er.current.paused?(p(Ye.current)&&nr(),Qe()):Je()},[nr,Je,Qe]),jr=O(()=>{qe()},[qe]),Rr=O(e=>{Ce.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{_e(),Be.current=null,Oe(!1)},setVersion:e=>{De.current=e},setSaveConflict:Te,setAccess:Ve}),Y(e),J(e),Re.current=null,je(null),ve(null),pe(null),ye(null),Se(null),Q.address.show(e),"document"!==e.kind&&K(e)&&Q.send("storefront-editor:navigated",{target:e})},[_e,Q,me,Y,K]),Br=O(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,se.current,F))return;const r=null!=Be.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?Ae(e):Ge().then(r=>{r?Rr(e):Ae(e)})},[Rr,$e,Ge,F]),Er=O(()=>Ae(null),[]),Or=O(()=>{Ae(e=>(e&&Rr(e),null))},[Rr]),Cr=O(async()=>{const e=He;if(!e)return;await gr()&&(Ae(null),Rr(e))},[He,gr,Rr]),Hr=O(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Ye.current)||Fe.current)return;const r=ae(e);if(!await kr(ke,r))return void(Fe.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,De.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}De.current=t.value.version??De.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
2
- return A(M.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>Ce.current??he,error:Ie,redirecting:sr,saveStatus:rr,saveState:Ze,autoSaveEnabled:!Ze.paused,autoSaveStoppedByConflict:Ze.stopped,hasUnsavedEdits:Ze.pending||Ee,toggleAutoSave:Pr,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Hr,access:Le,readOnly:null!==I(Le)||null!==Pe||null!==Me,readOnlyReason:Pe,takeOverEditing:br,viewReadOnly:Ir,saveConflict:Me,saveUnreachable:Ne,reloadFromServer:yr,navigate:Br,pendingNav:He,cancelPendingNav:Er,discardAndNavigate:Or,saveAndNavigate:Cr},children:N})}export{M as ScreenDocumentContext,N as ScreenDocumentProvider,T as useScreenDocument};
@@ -1,5 +0,0 @@
1
- import{usePickFollowsSelection as n}from"./chunk-FHCKFOCD.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-7L3NKHEC.js";import{Inspector as i}from"./chunk-YHFKWV7H.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},L={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
2
- return s(t,{height:"fill"})}function S(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
3
- return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var D=o({});function F({parts:n,children:e}){/* @__PURE__ */
4
- return s(D.Provider,{value:n,children:e})}function N(){return u(D)}function P(){return(N().useOwnerName??v)()}function G(){return(N().useDocumentLabel??g)()}function H(n,e,t,r){return(N().useBridges??h)(n,e,t,r)}function K(n){return(N().useStandaloneBridges??h)(n)}function x(n,e){(N().useDocumentPass??y)(n,e)}function B(){return N().blockRules??b}function I(){return N().blockLook??O}function T(){return N().devices??L}function V(){return N().leftView??j}function A(){return N().pinned??w}function E(){return N().saveSwitch??!0}function R(e){n(!0===N().pickFollowsSelection,e)}function Y(){return N().storageNamespace||void 0}function W(){return N().styleClipboard??null}function Z(){return N().nodeKeys??!0}function q(){return N().notify??null}function z(){return N().Canvas??C}function J(){return N().CanvasHead??null}function M(){return N().canvasDrag??null}var Q=o(null);function U({target:n,children:e}){/* @__PURE__ */
5
- return s(Q.Provider,{value:n,children:e})}function X(){return u(Q)}function $(){return N().Inspector??S}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,F as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,I as useScreenBlockLook,B as useScreenBlockRules,H as useScreenBridges,M as useScreenCanvasDrag,z as useScreenCanvasFrame,J as useScreenCanvasHead,X as useScreenCanvasTarget,T as useScreenDevices,G as useScreenDocumentLabel,x as useScreenDocumentPass,$ as useScreenInspectorPanel,V as useScreenLeftView,Z as useScreenNodeKeys,q as useScreenNotify,P as useScreenOwnerName,N as useScreenParts,R as useScreenPickFollowsSelection,A as useScreenPinned,E as useScreenSaveSwitch,Y as useScreenStorageNamespace,W as useScreenStyleClipboard,K as useStandaloneScreenBridges};
@@ -1,8 +0,0 @@
1
- import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as o}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as l}from"./chunk-BVN33R76.js";import{sharedSectionsOf as r}from"./chunk-43AEUUNQ.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SINAM2IT.js";import{blockRuns as c}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-NA3GMA43.js";import{useEaselSession as m}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-EB6NI2VK.js";import{useEasel as u}from"./chunk-7L3NKHEC.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-2M4T27BI.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as C}from"react";import{SharedIcon as w,AddIcon as T}from"efficient-shell/icons/efficient";import{ContextMenu as I,toast as N,Dialog as A,Button as E}from"efficient-shell/ui";import{jsx as M,jsxs as $,Fragment as x}from"react/jsx-runtime";function B({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=C(null);/* @__PURE__ */
2
- return M(A,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */$(x,{children:[
3
- /* @__PURE__ */M(E,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
4
- /* @__PURE__ */M(E,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var O=e=>`section:${e}`,F=e=>`block:${e}`,S=e=>`template:${e}`,D=e=>`shared:${e}`;function L({at:C,placeBlocks:A,canTake:E,onPick:L,itemFor:V,session:z,siteWide:H,onClose:P,onHide:Q,readOnly:K}){const R=u(e=>e.config),U=a(),{labelAtLevel:W,categoryLabel:Y,firstSection:Z,Icon:G,Thumbnail:_}=U,{blockIsOffered:J,canAddTo:X}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>J(e,te);return l(te).list().then(n=>{if(e)return;const l=R.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>J(e,te);return r(te).list().then(n=>{if(e)return;const l=R.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(R,U),[R]),ye=e=>W(e,"section",R.components[e]?.label??e),he=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */M(_,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:q.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=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=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */M("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */M(G,{type:e,size:26})}),be=j(()=>{const e=t(ue,Z),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!J(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=X(t.type)?.choices??[];e.forEach(l),e.forEach(e=>X(e.type,1)?.choices?.forEach(l))}A?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:F(e.type),label:e.label,cover:ge(e.type),title:q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:D(e.id),label:e.title,cover:/* @__PURE__ */M(_,{type:e.node.type}),mark:/* @__PURE__ */M(w,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:q.templates,tiles:ne.map(e=>({type:S(e.id),label:e.name,cover:/* @__PURE__ */M(_,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(R.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(R,t,Y),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!E)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?E(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,R,q,E,A,te]);/* @__PURE__ */
5
- return $(x,{children:[
6
- /* @__PURE__ */M(i,{icon:/* @__PURE__ */M(T,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */M(s,{label:q.done,description:q.doneDescription,onClick:P}),onHide:Q}),
7
- /* @__PURE__ */$("div",{className:"sf-addside sf-scroll",children:[
8
- /* @__PURE__ */M(k,{groups:be,session:z,itemFor:e=>V(ke(e)??{kind:"section",type:e}),onInsert:L?e=>{const t=ke(e);t&&L(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!K&&(pe({section:n.section,...t}),!0)},at:C,hint:q.hint,searchLabel:q.search,readOnly:K,words:ee}),H??null]}),de?/* @__PURE__ */M(I,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */M(B,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void N.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{L as AddSidePanel,F as blockKey,O as sectionKey,D as sharedKey,S as templateKey};
@@ -1 +0,0 @@
1
- import{useSectionOps as o}from"./chunk-FOHHXSOL.js";import{SELECTION_MODE as e}from"./chunk-NA3GMA43.js";import{decodePartId as r,encodePartId as t}from"./chunk-IYT6NN2J.js";import{useEasel as n}from"./chunk-7L3NKHEC.js";import{usePreviewParts as p}from"./chunk-I54UCYOU.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=n(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{k(l)},[k,l]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&I.select(r)},[i,u,I]),openPartId:h}}export{m as usePartBridge};