efficient-easel 5.0.1 → 5.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 (54) hide show
  1. package/README.md +6 -1
  2. package/dist/{CanvasDragLayer-DVJGgA-g.d.ts → CanvasDragLayer-O1gVT1AL.d.ts} +10 -0
  3. package/dist/{chunk-G4OCSMYY.js → chunk-3CS5BQMF.js} +1 -1
  4. package/dist/{chunk-H6NYEMLS.js → chunk-74A4LGYT.js} +3 -3
  5. package/dist/{chunk-ITAQX3HT.js → chunk-7YFUG75W.js} +1 -1
  6. package/dist/{chunk-R5GKLOIP.js → chunk-AL65NE2M.js} +1 -1
  7. package/dist/chunk-ATVN7L2J.js +65 -0
  8. package/dist/{chunk-7EWFXVDJ.js → chunk-CRWFB7MU.js} +4 -4
  9. package/dist/chunk-CVBKSCAY.js +5 -0
  10. package/dist/{chunk-SF4DL63U.js → chunk-LNKCGJYU.js} +1 -1
  11. package/dist/{chunk-KEHLCWTG.js → chunk-MOCX5MQ7.js} +8 -8
  12. package/dist/{chunk-F7BYSWRR.js → chunk-MTRFMGBO.js} +1 -1
  13. package/dist/chunk-RAFTHQVR.js +9 -0
  14. package/dist/{chunk-XHHS6SDM.js → chunk-RSDDVLT7.js} +1 -1
  15. package/dist/{chunk-X2GNFJRC.js → chunk-SQM6APQW.js} +1 -1
  16. package/dist/chunk-SYDZ5YWX.js +5 -0
  17. package/dist/chunk-Y324X4U4.js +1 -0
  18. package/dist/copy/index.js +5 -5
  19. package/dist/drag/drag.css +23 -0
  20. package/dist/drag/index.d.ts +1 -1
  21. package/dist/drag/index.js +1 -1
  22. package/dist/easel/easel.css +8 -0
  23. package/dist/easel/index.d.ts +2 -0
  24. package/dist/easel/index.js +1 -1
  25. package/dist/fields/index.js +1 -1
  26. package/dist/screen/components/AddBlockRow.js +1 -1
  27. package/dist/screen/components/AddSidePanel.js +1 -1
  28. package/dist/screen/components/MediaSidePanel.js +1 -1
  29. package/dist/screen/components/NodeContextMenu.d.ts +1 -1
  30. package/dist/screen/components/NodeContextMenu.js +1 -1
  31. package/dist/screen/components/ScreenChrome.js +1 -1
  32. package/dist/screen/components/ScreenMount.d.ts +1 -1
  33. package/dist/screen/components/ScreenMount.js +1 -1
  34. package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
  35. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  36. package/dist/screen/components/SectionScreenShell.js +15 -15
  37. package/dist/screen/components/usePartBridge.d.ts +1 -1
  38. package/dist/screen/components/usePartBridge.js +1 -1
  39. package/dist/screen/index.d.ts +1 -1
  40. package/dist/screen/index.js +1 -1
  41. package/dist/screen/lib/key-scope.js +1 -1
  42. package/dist/screen/lib/puck/style-clipboard.d.ts +1 -1
  43. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  44. package/dist/screen/lib/screen-parts.d.ts +1 -1
  45. package/dist/screen/lib/screen-parts.js +1 -1
  46. package/dist/strings/catalogue.js +1 -1
  47. package/dist/strings/index.js +1 -1
  48. package/dist/text-styles/index.js +11 -11
  49. package/package.json +1 -1
  50. package/dist/chunk-3FZAGTQE.js +0 -5
  51. package/dist/chunk-5QSFLWAJ.js +0 -65
  52. package/dist/chunk-7YMO6R3V.js +0 -1
  53. package/dist/chunk-FUOZKV7A.js +0 -9
  54. package/dist/chunk-PCMGFPFU.js +0 -5
@@ -1 +1 @@
1
- import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-H6NYEMLS.js";import"../chunk-GXQCZJOP.js";export{ScreenStoreProvider}from"../chunk-ITAQX3HT.js";import"../chunk-5QSFLWAJ.js";import"../chunk-26OOWIJJ.js";import"../chunk-BXQBCW3P.js";import"../chunk-FGNR22NY.js";import"../chunk-ZE7I3PLX.js";import"../chunk-2GVCAIPX.js";import"../chunk-PAM3NLFL.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-TBF5CVPA.js";import"../chunk-4ES5JGGX.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-X2GNFJRC.js";import"../chunk-KCBEE2MC.js";import"../chunk-6TOYXESC.js";import"../chunk-SF4DL63U.js";import"../chunk-XHHS6SDM.js";import"../chunk-IYT6NN2J.js";import"../chunk-F7BYSWRR.js";import"../chunk-HQWQLDCB.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-WZMU646D.js";import"../chunk-S4AWJX4Q.js";import"../chunk-ERR437B5.js";import"../chunk-KG7RJWOK.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-V7U33NF2.js";import"../chunk-5545A3PC.js";import"../chunk-PCMGFPFU.js";import"../chunk-5ZBY24K7.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-PFNIVZPN.js";import"../chunk-KQMML6JM.js";import"../chunk-KCOBHPN6.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";import"../chunk-HQ4VVRIC.js";import"../chunk-G4OCSMYY.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-3FZAGTQE.js";import"../chunk-PLVEGYK6.js";import"../chunk-R6WTQWAC.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-7EWFXVDJ.js";import"../chunk-OZ72A6MY.js";import"../chunk-4JSBIW5H.js";import"../chunk-3ZJSLHHI.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-BXMXTO36.js";import"../chunk-EA2HTX37.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-4VJATVVR.js";import"../chunk-BDTITTMW.js";import"../chunk-H6DDIBQ4.js";import"../chunk-UB4TLWVJ.js";import"../chunk-Y2G7CU6A.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-KEHLCWTG.js";import"../chunk-O2NLQBFX.js";import"../chunk-67GNT6PF.js";import"../chunk-PAELDYYS.js";import"../chunk-P2VEMZH5.js";import"../chunk-FUOZKV7A.js";import"../chunk-AELNNAFM.js";import"../chunk-YRLPFZW3.js";import"../chunk-UK2FQOUT.js";import"../chunk-MFIRYGHW.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";import"../chunk-ZNCEOSXO.js";
1
+ import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-74A4LGYT.js";import"../chunk-GXQCZJOP.js";export{ScreenStoreProvider}from"../chunk-7YFUG75W.js";import"../chunk-ATVN7L2J.js";import"../chunk-26OOWIJJ.js";import"../chunk-BXQBCW3P.js";import"../chunk-FGNR22NY.js";import"../chunk-ZE7I3PLX.js";import"../chunk-2GVCAIPX.js";import"../chunk-PAM3NLFL.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-TBF5CVPA.js";import"../chunk-4ES5JGGX.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-SQM6APQW.js";import"../chunk-KCBEE2MC.js";import"../chunk-6TOYXESC.js";import"../chunk-LNKCGJYU.js";import"../chunk-RSDDVLT7.js";import"../chunk-IYT6NN2J.js";import"../chunk-MTRFMGBO.js";import"../chunk-HQWQLDCB.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-WZMU646D.js";import"../chunk-S4AWJX4Q.js";import"../chunk-ERR437B5.js";import"../chunk-KG7RJWOK.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-V7U33NF2.js";import"../chunk-5545A3PC.js";import"../chunk-SYDZ5YWX.js";import"../chunk-5ZBY24K7.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-PFNIVZPN.js";import"../chunk-KQMML6JM.js";import"../chunk-KCOBHPN6.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";import"../chunk-HQ4VVRIC.js";import"../chunk-3CS5BQMF.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-CVBKSCAY.js";import"../chunk-PLVEGYK6.js";import"../chunk-R6WTQWAC.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-RAFTHQVR.js";import"../chunk-AELNNAFM.js";import"../chunk-CRWFB7MU.js";import"../chunk-OZ72A6MY.js";import"../chunk-4JSBIW5H.js";import"../chunk-3ZJSLHHI.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-YRLPFZW3.js";import"../chunk-BXMXTO36.js";import"../chunk-EA2HTX37.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-UK2FQOUT.js";import"../chunk-4VJATVVR.js";import"../chunk-BDTITTMW.js";import"../chunk-H6DDIBQ4.js";import"../chunk-UB4TLWVJ.js";import"../chunk-Y2G7CU6A.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-MFIRYGHW.js";import"../chunk-MOCX5MQ7.js";import"../chunk-O2NLQBFX.js";import"../chunk-67GNT6PF.js";import"../chunk-PAELDYYS.js";import"../chunk-ZNCEOSXO.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{editorRootFocus,useEaselKeyTarget,useEaselUndoKeys}from"../../chunk-X2GNFJRC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-FUOZKV7A.js";import"../../chunk-AELNNAFM.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import"../../chunk-ZNCEOSXO.js";
1
+ export{editorRootFocus,useEaselKeyTarget,useEaselUndoKeys}from"../../chunk-SQM6APQW.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -16,7 +16,7 @@ import '../../../types-CsgMwHHa.js';
16
16
  import '../../../wordFit-7XpmhcaW.js';
17
17
  import '../../../edit-lock/index.js';
18
18
  import '../../../panelWidths-D9hTLR25.js';
19
- import '../../../CanvasDragLayer-DVJGgA-g.js';
19
+ import '../../../CanvasDragLayer-O1gVT1AL.js';
20
20
  import '../../../session-DSQFmIvx.js';
21
21
  import '../../../words-BDignMl_.js';
22
22
  import '../../../types-BLRK6_JO.js';
@@ -1 +1 @@
1
- export{useSectionOps}from"../../../chunk-XHHS6SDM.js";import"../../../chunk-3FZAGTQE.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-R6WTQWAC.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-7EWFXVDJ.js";import"../../../chunk-OZ72A6MY.js";import"../../../chunk-4JSBIW5H.js";import"../../../chunk-3ZJSLHHI.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-EA2HTX37.js";import"../../../chunk-66LWADFP.js";import"../../../chunk-QLD57GBB.js";import"../../../chunk-FFYXVAAL.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-FUOZKV7A.js";import"../../../chunk-AELNNAFM.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-UK2FQOUT.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";import"../../../chunk-ZNCEOSXO.js";
1
+ export{useSectionOps}from"../../../chunk-RSDDVLT7.js";import"../../../chunk-CVBKSCAY.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-R6WTQWAC.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-RAFTHQVR.js";import"../../../chunk-AELNNAFM.js";import"../../../chunk-CRWFB7MU.js";import"../../../chunk-OZ72A6MY.js";import"../../../chunk-4JSBIW5H.js";import"../../../chunk-3ZJSLHHI.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-EA2HTX37.js";import"../../../chunk-UK2FQOUT.js";import"../../../chunk-66LWADFP.js";import"../../../chunk-QLD57GBB.js";import"../../../chunk-FFYXVAAL.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-ZNCEOSXO.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";
@@ -4,7 +4,7 @@ import { Data } from '../../blocks/index.js';
4
4
  import { C as CanvasTarget } from '../../watch-BTYOJpQU.js';
5
5
  import { D as DeviceOption } from '../../types-Dt1CFR1S.js';
6
6
  import { P as Place } from '../../types-41704JE4.js';
7
- import { M as MeasuredCanvas, C as CanvasDragModel } from '../../CanvasDragLayer-DVJGgA-g.js';
7
+ import { M as MeasuredCanvas, C as CanvasDragModel } from '../../CanvasDragLayer-O1gVT1AL.js';
8
8
  import { E as EaselContextMenuItem } from '../../types-BsyPh6EW.js';
9
9
  import { a as EaselRailItem } from '../../types-CsgMwHHa.js';
10
10
  import { StyleRow } from '../../style-clipboard/index.js';
@@ -1 +1 @@
1
- export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-3FZAGTQE.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-7EWFXVDJ.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-EA2HTX37.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-FUOZKV7A.js";import"../../chunk-AELNNAFM.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import"../../chunk-ZNCEOSXO.js";
1
+ export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-CVBKSCAY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-RAFTHQVR.js";import"../../chunk-AELNNAFM.js";import"../../chunk-CRWFB7MU.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-3ZJSLHHI.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-UK2FQOUT.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-7YMO6R3V.js";import"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-WK3AFPXY.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Y2G7CU6A.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-JZDEIRH4.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import"../chunk-O2NLQBFX.js";import"../chunk-AELNNAFM.js";
1
+ export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-Y324X4U4.js";import"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-AELNNAFM.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-WK3AFPXY.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Y2G7CU6A.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-JZDEIRH4.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import"../chunk-O2NLQBFX.js";
@@ -1,2 +1,2 @@
1
- import{DEFAULT_EASEL_STRINGS as r,mergeEaselStrings as n}from"../chunk-7YMO6R3V.js";export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-7YMO6R3V.js";import"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-WK3AFPXY.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Y2G7CU6A.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-JZDEIRH4.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import"../chunk-O2NLQBFX.js";import"../chunk-AELNNAFM.js";import{stringsContext as o}from"../chunk-MFIRYGHW.js";import{useContext as t,useMemo as c}from"react";import{jsx as i}from"react/jsx-runtime";function s({value:s,locale:u,children:m}){const e=o(),p=t(e),h=p?.strings??r,j=u??p?.locale??"en",k=c(()=>({strings:n(h,s),locale:j}),[h,s,j]);/* @__PURE__ */
1
+ import{DEFAULT_EASEL_STRINGS as r,mergeEaselStrings as n}from"../chunk-Y324X4U4.js";export{DEFAULT_EASEL_STRINGS,mergeEaselStrings}from"../chunk-Y324X4U4.js";import"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import"../chunk-6WY6ZXJG.js";import"../chunk-MCHMF32I.js";import"../chunk-AELNNAFM.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-WK3AFPXY.js";import"../chunk-H6DDIBQ4.js";import"../chunk-Y2G7CU6A.js";import"../chunk-RE4LP46F.js";import"../chunk-2OAZYSWJ.js";import"../chunk-JZDEIRH4.js";import"../chunk-FFYXVAAL.js";import"../chunk-546BBOPE.js";import{stringsContext as o}from"../chunk-MFIRYGHW.js";import"../chunk-O2NLQBFX.js";import{useContext as t,useMemo as c}from"react";import{jsx as i}from"react/jsx-runtime";function s({value:s,locale:u,children:m}){const e=o(),p=t(e),h=p?.strings??r,j=u??p?.locale??"en",k=c(()=>({strings:n(h,s),locale:j}),[h,s,j]);/* @__PURE__ */
2
2
  return i(e.Provider,{value:k,children:m})}function u(){return t(o())?.strings??r}function m(){return t(o())?.locale??"en"}export{s as EaselStringsProvider,m as useEaselLocale,u as useEaselStrings};
@@ -1,33 +1,33 @@
1
- import{hexReadout as e,ColourWindow as n,typedHex as t}from"../chunk-FPAVNX3Y.js";import{DEFAULT_TEXT_STYLES_WORDS as s}from"../chunk-M6F6LS3H.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import{FieldSelect as i,FieldSlider as a}from"../chunk-OZ72A6MY.js";import"../chunk-FFYXVAAL.js";import{withTip as l}from"../chunk-P2VEMZH5.js";import{useWords as r}from"../chunk-MFIRYGHW.js";import{hsvToHex as o,Tooltip as d,ColorSwatch as c,IconButton as u}from"efficient-shell/ui";import{useState as m,useRef as f,useId as h,useEffect as p,Fragment as v}from"react";import{ChevronIcon as g,TrashIcon as k,BoldIcon as y,ItalicIcon as b,CaseLowerIcon as x,CaseUpperIcon as w,CaseNormalIcon as S}from"efficient-shell/icons/efficient";import{jsxs as N,jsx as C,Fragment as M}from"react/jsx-runtime";var z=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],$=["font","color","size","weight","lineSpacing","letterSpacing","paragraphSpacing","letterCase"],O=["heading","body"],A=7,j={heading:3,body:5},F={min:5,max:void 0,sliderMin:12,sliderMax:72,step:1,shiftStep:10,unit:"px"},L={size:F,weight:{min:100,max:900,sliderMin:300,sliderMax:900,step:100,shiftStep:100,unit:""},lineSpacing:{min:50,max:250,sliderMin:50,sliderMax:250,step:1,shiftStep:10,unit:"%"},letterSpacing:{min:-10,max:void 0,sliderMin:-5,sliderMax:10,step:.1,shiftStep:1,unit:"px"},paragraphSpacing:{min:0,max:void 0,sliderMin:0,sliderMax:48,step:1,shiftStep:10,unit:"px"},largestSize:F},E=(e,n)=>`${"heading"===e?"Heading":"Body"} ${n}`;function W(e=({kind:e,n:n})=>E(e,n)){return O.flatMap(n=>Array.from({length:j[n]},(t,s)=>({id:`${n}-${s+1}`,kind:n,name:e({kind:n,n:s+1}),values:{}})))}function H(e,n,t=A){return e.filter(e=>e.kind===n).length<t}function B(e,n){const t=new RegExp(`^${n}-([1-9]\\d*)$`).exec(e);return t?Number(t[1]):void 0}function D(e){const n=B(e.id,e.kind);return void 0!==n&&n<=j[e.kind]}function I(e,n,t={}){const{max:s=A,name:i=({kind:e,n:n})=>E(e,n),make:a}=t;if(!H(e,n,s))return null;const l=e.filter(e=>e.kind===n);let r=l.length+1;const o=new Set(e.map(e=>e.name));for(;o.has(i({kind:n,n:r}));)r+=1;const d=new Set(e.map(e=>e.id));let c=Math.max(r,...l.map(e=>(B(e.id,n)??0)+1));for(;d.has(`${n}-${c}`);)c+=1;const u=l.at(-1),m=a?a(n,r):{id:`${n}-${c}`,kind:n,name:i({kind:n,n:r}),values:{...u?.values??{}}},f=u?e.indexOf(u)+1:"heading"===n?0:e.length;return{styles:[...e.slice(0,f),m,...e.slice(f)],added:m}}function R(e,n,t={}){const{name:s=({kind:e,n:n})=>E(e,n)}=t,i=e.find(e=>e.id===n);if(!i||D(i))return null;const a=e.filter(e=>e.kind===i.kind),l=a.indexOf(i),r=/* @__PURE__ */new Map;return a.forEach((e,n)=>{n>l&&e.name===s({kind:e.kind,n:n+1})&&r.set(e,s({kind:e.kind,n:n}))}),{styles:e.filter(e=>e!==i).map(e=>r.has(e)?{...e,name:r.get(e)}:e),removed:i}}function T(e,n){const t=e.find(e=>e.id===n);if(t)return t;for(const t of O){const s=B(n,t);if(void 0===s)continue;let i;for(const n of e){const e=n.kind===t?B(n.id,t):void 0;void 0!==e&&e<s&&(!i||e>i.n)&&(i={n:e,style:n})}return i?.style}}function Y(e,n,t){return e.map(e=>{if(e.id!==n)return e;const s={...e.values};for(const[e,n]of Object.entries(t))void 0===n?delete s[e]:s[e]=n;return{...e,values:s}})}function V(e){return Math.min(20,Math.max(12,Math.round(.5*e+6)))}function q(e,n){const t=n.weights;return[t.thin,t.extraLight,t.light,t.regular,t.medium,t.semibold,t.bold,t.extraBold,t.black][Math.min(8,Math.max(0,Math.round(e/100)-1))]}function P(e,n,t,s={}){const i=n.find(n=>n.value===e.font)?.label??e.font??"",a=void 0===e.size?s.autoSize?t.auto:"":t.px({n:e.size});return t.summary({font:i,size:a,weight:q(e.weight??400,t)})}var X=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>o({h:e,s:1,v:1})).join(", ")})`;function Z({value:t,hex:s,colours:i,label:a,followsWord:l,anyWord:r,onChange:o,readOnly:u=!1}){const[v,g]=m(!1),k=f(null),y=f(null),b=h(),x=void 0!==t&&i.some(e=>e.key===t),w=void 0!==t&&!x;return p(()=>{if(!v)return;const e=k.current?.ownerDocument;if(!e)return;const n=e=>{k.current&&!k.current.contains(e.target)&&g(!1)};return e.addEventListener("click",n,!0),()=>e.removeEventListener("click",n,!0)},[v]),/* @__PURE__ */N("div",{ref:k,className:"es-ts-set","data-ts-setting":"color",children:[
1
+ import{hexReadout as e,ColourWindow as n,typedHex as t}from"../chunk-FPAVNX3Y.js";import{DEFAULT_TEXT_STYLES_WORDS as s}from"../chunk-M6F6LS3H.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import{FieldSelect as i,FieldSlider as a}from"../chunk-OZ72A6MY.js";import"../chunk-FFYXVAAL.js";import{useWords as l}from"../chunk-MFIRYGHW.js";import{withTip as r}from"../chunk-P2VEMZH5.js";import{hsvToHex as o,Tooltip as d,ColorSwatch as c,IconButton as u}from"efficient-shell/ui";import{useState as m,useRef as f,useId as h,useEffect as p,Fragment as v}from"react";import{ChevronIcon as g,TrashIcon as k,BoldIcon as y,ItalicIcon as b,CaseLowerIcon as x,CaseUpperIcon as w,CaseNormalIcon as S}from"efficient-shell/icons/efficient";import{jsxs as N,jsx as C,Fragment as M}from"react/jsx-runtime";var z=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],$=["font","color","size","weight","lineSpacing","letterSpacing","paragraphSpacing","letterCase"],O=["heading","body"],A=7,j={heading:3,body:5},F={min:5,max:void 0,sliderMin:12,sliderMax:72,step:1,shiftStep:10,unit:"px"},L={size:F,weight:{min:100,max:900,sliderMin:300,sliderMax:900,step:100,shiftStep:100,unit:""},lineSpacing:{min:50,max:250,sliderMin:50,sliderMax:250,step:1,shiftStep:10,unit:"%"},letterSpacing:{min:-10,max:void 0,sliderMin:-5,sliderMax:10,step:.1,shiftStep:1,unit:"px"},paragraphSpacing:{min:0,max:void 0,sliderMin:0,sliderMax:48,step:1,shiftStep:10,unit:"px"},largestSize:F},E=(e,n)=>`${"heading"===e?"Heading":"Body"} ${n}`;function W(e=({kind:e,n:n})=>E(e,n)){return O.flatMap(n=>Array.from({length:j[n]},(t,s)=>({id:`${n}-${s+1}`,kind:n,name:e({kind:n,n:s+1}),values:{}})))}function H(e,n,t=A){return e.filter(e=>e.kind===n).length<t}function B(e,n){const t=new RegExp(`^${n}-([1-9]\\d*)$`).exec(e);return t?Number(t[1]):void 0}function D(e){const n=B(e.id,e.kind);return void 0!==n&&n<=j[e.kind]}function I(e,n,t={}){const{max:s=A,name:i=({kind:e,n:n})=>E(e,n),make:a}=t;if(!H(e,n,s))return null;const l=e.filter(e=>e.kind===n);let r=l.length+1;const o=new Set(e.map(e=>e.name));for(;o.has(i({kind:n,n:r}));)r+=1;const d=new Set(e.map(e=>e.id));let c=Math.max(r,...l.map(e=>(B(e.id,n)??0)+1));for(;d.has(`${n}-${c}`);)c+=1;const u=l.at(-1),m=a?a(n,r):{id:`${n}-${c}`,kind:n,name:i({kind:n,n:r}),values:{...u?.values??{}}},f=u?e.indexOf(u)+1:"heading"===n?0:e.length;return{styles:[...e.slice(0,f),m,...e.slice(f)],added:m}}function R(e,n,t={}){const{name:s=({kind:e,n:n})=>E(e,n)}=t,i=e.find(e=>e.id===n);if(!i||D(i))return null;const a=e.filter(e=>e.kind===i.kind),l=a.indexOf(i),r=/* @__PURE__ */new Map;return a.forEach((e,n)=>{n>l&&e.name===s({kind:e.kind,n:n+1})&&r.set(e,s({kind:e.kind,n:n}))}),{styles:e.filter(e=>e!==i).map(e=>r.has(e)?{...e,name:r.get(e)}:e),removed:i}}function T(e,n){const t=e.find(e=>e.id===n);if(t)return t;for(const t of O){const s=B(n,t);if(void 0===s)continue;let i;for(const n of e){const e=n.kind===t?B(n.id,t):void 0;void 0!==e&&e<s&&(!i||e>i.n)&&(i={n:e,style:n})}return i?.style}}function Y(e,n,t){return e.map(e=>{if(e.id!==n)return e;const s={...e.values};for(const[e,n]of Object.entries(t))void 0===n?delete s[e]:s[e]=n;return{...e,values:s}})}function V(e){return Math.min(20,Math.max(12,Math.round(.5*e+6)))}function q(e,n){const t=n.weights;return[t.thin,t.extraLight,t.light,t.regular,t.medium,t.semibold,t.bold,t.extraBold,t.black][Math.min(8,Math.max(0,Math.round(e/100)-1))]}function P(e,n,t,s={}){const i=n.find(n=>n.value===e.font)?.label??e.font??"",a=void 0===e.size?s.autoSize?t.auto:"":t.px({n:e.size});return t.summary({font:i,size:a,weight:q(e.weight??400,t)})}var X=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>o({h:e,s:1,v:1})).join(", ")})`;function Z({value:t,hex:s,colours:i,label:a,followsWord:l,anyWord:r,onChange:o,readOnly:u=!1}){const[v,g]=m(!1),k=f(null),y=f(null),b=h(),x=void 0!==t&&i.some(e=>e.key===t),w=void 0!==t&&!x;return p(()=>{if(!v)return;const e=k.current?.ownerDocument;if(!e)return;const n=e=>{k.current&&!k.current.contains(e.target)&&g(!1)};return e.addEventListener("click",n,!0),()=>e.removeEventListener("click",n,!0)},[v]),/* @__PURE__ */N("div",{ref:k,className:"es-ts-set","data-ts-setting":"color",children:[
2
2
  /* @__PURE__ */N("div",{className:"es-ts-top",children:[
3
3
  /* @__PURE__ */C("span",{className:"es-ts-sub",children:a}),
4
4
  /* @__PURE__ */C("span",{className:"es-ts-colour-read",children:s?e(s):l})]}),
5
5
  /* @__PURE__ */N("div",{className:"es-ts-swatches",role:"group","aria-label":a,children:[i.map(n=>/* @__PURE__ */C(d,{content:`${n.name} · ${e(n.value)}`,children:/* @__PURE__ */C(c,{color:n.value,size:"sm",className:"es-ts-swatch","aria-label":n.name,selected:t===n.key,disabled:u,onClick:()=>o(n.key)})},n.key)),
6
- /* @__PURE__ */C(d,{content:r,children:/* @__PURE__ */C(c,{ref:y,color:X,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:w,"aria-expanded":v,"aria-controls":v?b:void 0,disabled:u,onClick:()=>g(e=>!e)})})]}),v?/* @__PURE__ */C(n,{id:b,value:s??"",onChange:e=>o(e),label:a,readOnly:u,onClose:()=>{g(!1),y.current?.focus()}}):null]})}function _({styles:e,onChange:n,fonts:t,colours:i=[],settings:a=$,auto:o=[],fallback:d,sample:c,openId:u,defaultOpenId:y=null,onOpenChange:b,onAdd:x,rowActions:w,onRemove:S,max:M=A,readOnly:j=!1}){const F=r("textStyles",s),L=h(),[E,W]=m(y),B=void 0!==u?u:E,T=e=>{void 0===u&&W(e),b?.(e)},q=new Set(o),X=z.filter(e=>a.includes(e)),Z=f(null),[_,U]=m(null);p(()=>{if(!_||!Z.current)return;const e=[...Z.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===_.id),n=e?e.querySelector(".es-ts-row"):Z.current.querySelector(`.es-ts-add[data-ts-kind="${_.kind}"]`);n?.focus(),U(null)},[_]);/* @__PURE__ */
7
- return C("div",{className:"es-ts",ref:Z,children:O.map(s=>{const a=e.filter(e=>e.kind===s),r=`${L}-${s}`,o=!H(e,s,M),u=!j&&!o;/* @__PURE__ */
8
- return N("section",{className:"es-ts-section","aria-labelledby":r,children:[
9
- /* @__PURE__ */C("div",{className:"es-ts-group",id:r,children:F.groups[s]}),a.map(s=>{const a=B===s.id,r={...d?.(s)??{},...s.values},o=t.find(e=>e.value===r.font),u=`${L}-open-${s.id}`,m=w?.(s),f=null!=m&&!1!==m,h=Boolean(S)&&!j&&!D(s),p={fontFamily:o?.family,fontSize:`${V(r.size??16)}px`,fontWeight:r.weight,fontStyle:r.italic?"italic":void 0};/* @__PURE__ */
6
+ /* @__PURE__ */C(d,{content:r,children:/* @__PURE__ */C(c,{ref:y,color:X,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:w,"aria-expanded":v,"aria-controls":v?b:void 0,disabled:u,onClick:()=>g(e=>!e)})})]}),v?/* @__PURE__ */C(n,{id:b,value:s??"",onChange:e=>o(e),label:a,readOnly:u,onClose:()=>{g(!1),y.current?.focus()}}):null]})}function _({styles:e,onChange:n,fonts:t,colours:i=[],settings:a=$,auto:o=[],fallback:d,sample:c,openId:u,defaultOpenId:y=null,onOpenChange:b,onAdd:x,rowActions:w,onRemove:S,max:M=A,readOnly:j=!1}){const F=l("textStyles",s),L=h(),[E,W]=m(y),B=void 0!==u?u:E,T=e=>{void 0===u&&W(e),b?.(e)},q=new Set(o),X=z.filter(e=>a.includes(e)),Z=f(null),[_,U]=m(null);p(()=>{if(!_||!Z.current)return;const e=[...Z.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===_.id),n=e?e.querySelector(".es-ts-row"):Z.current.querySelector(`.es-ts-add[data-ts-kind="${_.kind}"]`);n?.focus(),U(null)},[_]);/* @__PURE__ */
7
+ return C("div",{className:"es-ts",ref:Z,children:O.map(s=>{const a=e.filter(e=>e.kind===s),l=`${L}-${s}`,o=!H(e,s,M),u=!j&&!o;/* @__PURE__ */
8
+ return N("section",{className:"es-ts-section","aria-labelledby":l,children:[
9
+ /* @__PURE__ */C("div",{className:"es-ts-group",id:l,children:F.groups[s]}),a.map(s=>{const a=B===s.id,l={...d?.(s)??{},...s.values},o=t.find(e=>e.value===l.font),u=`${L}-open-${s.id}`,m=w?.(s),f=null!=m&&!1!==m,h=Boolean(S)&&!j&&!D(s),p={fontFamily:o?.family,fontSize:`${V(l.size??16)}px`,fontWeight:l.weight,fontStyle:l.italic?"italic":void 0};/* @__PURE__ */
10
10
  return N(v,{children:[
11
11
  /* @__PURE__ */N("div",{className:"es-ts-item","data-ts-id":s.id,children:[
12
12
  /* @__PURE__ */N("button",{type:"button",className:"es-ts-row","aria-expanded":a,"aria-controls":a?u:void 0,onClick:()=>T(a?null:s.id),children:[
13
13
  /* @__PURE__ */C("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */C(g,{size:12})}),
14
14
  /* @__PURE__ */C("span",{className:"es-ts-name",style:p,children:s.name}),
15
- /* @__PURE__ */C("span",{className:"es-ts-meta",children:P(r,t,F,{autoSize:q.has("size")&&void 0===s.values.size})})]}),h||f?/* @__PURE__ */N("div",{className:"es-ts-actions",children:[h?l(F.remove,/* @__PURE__ */C("button",{type:"button",className:"es-ts-del","aria-label":F.removeNamed({name:s.name}),onClick:()=>(t=>{if(j||!S)return;const s=R(e,t.id,{name:F.styleName});if(!s)return;const i=e.filter(e=>e.kind===t.kind),a=i[i.indexOf(t)+1];B===t.id&&T(null),n(s.styles),S(s.removed),U({id:a?.id??null,kind:t.kind})})(s),children:/* @__PURE__ */C(k,{size:14,"aria-hidden":"true"})})):null,f?m:null]}):null]}),a?/* @__PURE__ */C("div",{className:"es-ts-open",id:u,children:/* @__PURE__ */C(K,{style:s,values:r,fonts:t,colours:i,settings:X,autoSet:q,sample:c??F.sample,words:F,readOnly:j,set:t=>n(Y(e,s.id,t))})}):null]},s.id)}),l(!j&&o?F.full({kind:s,max:M}):void 0,/* @__PURE__ */N("button",{type:"button",className:"es-ts-add","data-ts-kind":s,disabled:j,"aria-disabled":!(j||!o)||void 0,"aria-describedby":!j&&o?`${L}-full-${s}`:void 0,onClick:()=>{u&&(t=>{if(j)return;const s=I(e,t,{max:M,name:F.styleName,make:x});s&&n(s.styles)})(s)},children:[
15
+ /* @__PURE__ */C("span",{className:"es-ts-meta",children:P(l,t,F,{autoSize:q.has("size")&&void 0===s.values.size})})]}),h||f?/* @__PURE__ */N("div",{className:"es-ts-actions",children:[h?r(F.remove,/* @__PURE__ */C("button",{type:"button",className:"es-ts-del","aria-label":F.removeNamed({name:s.name}),onClick:()=>(t=>{if(j||!S)return;const s=R(e,t.id,{name:F.styleName});if(!s)return;const i=e.filter(e=>e.kind===t.kind),a=i[i.indexOf(t)+1];B===t.id&&T(null),n(s.styles),S(s.removed),U({id:a?.id??null,kind:t.kind})})(s),children:/* @__PURE__ */C(k,{size:14,"aria-hidden":"true"})})):null,f?m:null]}):null]}),a?/* @__PURE__ */C("div",{className:"es-ts-open",id:u,children:/* @__PURE__ */C(K,{style:s,values:l,fonts:t,colours:i,settings:X,autoSet:q,sample:c??F.sample,words:F,readOnly:j,set:t=>n(Y(e,s.id,t))})}):null]},s.id)}),r(!j&&o?F.full({kind:s,max:M}):void 0,/* @__PURE__ */N("button",{type:"button",className:"es-ts-add","data-ts-kind":s,disabled:j,"aria-disabled":!(j||!o)||void 0,"aria-describedby":!j&&o?`${L}-full-${s}`:void 0,onClick:()=>{u&&(t=>{if(j)return;const s=I(e,t,{max:M,name:F.styleName,make:x});s&&n(s.styles)})(s)},children:[
16
16
  /* @__PURE__ */C("span",{className:"es-ts-add-word",children:F.add[s]}),
17
- /* @__PURE__ */C("span",{className:"es-ts-count",children:F.count({n:a.length,max:M})})]})),j||!o?null:/* @__PURE__ */C("span",{id:`${L}-full-${s}`,className:"es-vh",children:F.full({kind:s,max:M})})]},s)})})}var U={none:S,upper:w,lower:x},G={none:"none",upper:"uppercase",lower:"lowercase"};function K({style:e,values:n,fonts:s,colours:i,settings:r,autoSet:o,sample:d,words:c,readOnly:m,set:f}){const h=e.values,p=s.find(e=>e.value===n.font),v=function(e,n){return e?n.find(n=>n.key===e)?.value??t(e)??void 0:void 0}(n.color,i),g=e=>"largestSize"===e||o.has(e),k=e=>g(e)?h[e]:n[e],x=k("size"),w=k("lineSpacing"),S=k("letterSpacing"),z=g("letterCase")?h.letterCase:n.letterCase,$={fontFamily:p?.family,fontSize:void 0===x?void 0:`${x}px`,fontWeight:n.weight,fontStyle:n.italic?"italic":void 0,lineHeight:void 0===w?void 0:String(w/100),letterSpacing:void 0===S?void 0:`${S}px`,color:v,textTransform:z?G[z]:void 0},O=e=>{const t=L[e],s=g(e);/* @__PURE__ */
17
+ /* @__PURE__ */C("span",{className:"es-ts-count",children:F.count({n:a.length,max:M})})]})),j||!o?null:/* @__PURE__ */C("span",{id:`${L}-full-${s}`,className:"es-vh",children:F.full({kind:s,max:M})})]},s)})})}var U={none:S,upper:w,lower:x},G={none:"none",upper:"uppercase",lower:"lowercase"};function K({style:e,values:n,fonts:s,colours:i,settings:l,autoSet:o,sample:d,words:c,readOnly:m,set:f}){const h=e.values,p=s.find(e=>e.value===n.font),v=function(e,n){return e?n.find(n=>n.key===e)?.value??t(e)??void 0:void 0}(n.color,i),g=e=>"largestSize"===e||o.has(e),k=e=>g(e)?h[e]:n[e],x=k("size"),w=k("lineSpacing"),S=k("letterSpacing"),z=g("letterCase")?h.letterCase:n.letterCase,$={fontFamily:p?.family,fontSize:void 0===x?void 0:`${x}px`,fontWeight:n.weight,fontStyle:n.italic?"italic":void 0,lineHeight:void 0===w?void 0:String(w/100),letterSpacing:void 0===S?void 0:`${S}px`,color:v,textTransform:z?G[z]:void 0},O=e=>{const t=L[e],s=g(e);/* @__PURE__ */
18
18
  return C("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */C(a,{label:c.settings[e],value:h[e],onChange:n=>f({[e]:n}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:s?void 0:n[e],auto:s?c.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
19
19
  return N(M,{children:[
20
- /* @__PURE__ */C("div",{className:"es-ts-preview",style:$,"aria-label":c.preview,children:d}),r.map(t=>{switch(t){case"font":/* @__PURE__ */
20
+ /* @__PURE__ */C("div",{className:"es-ts-preview",style:$,"aria-label":c.preview,children:d}),l.map(t=>{switch(t){case"font":/* @__PURE__ */
21
21
  return C(J,{value:h.font,fonts:s,words:c,readOnly:m,set:f},t);case"color":/* @__PURE__ */
22
22
  return C(Q,{value:h.color,hex:v,colours:i,words:c,readOnly:m,set:f},t);case"emphasis":{const e=(n.weight??400)>=600,s=!1!==p?.italic;/* @__PURE__ */
23
23
  return N("div",{className:"es-ts-set","data-ts-setting":t,children:[
24
24
  /* @__PURE__ */C("span",{className:"es-ts-sub",children:c.settings.emphasis}),
25
- /* @__PURE__ */N("div",{className:"es-ts-icons",children:[l(c.bold,/* @__PURE__ */C(u,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>f({weight:e?400:700}),children:/* @__PURE__ */C(y,{size:16})})),m||s?l(c.italic,/* @__PURE__ */C(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),disabled:m,onClick:()=>f({italic:!n.italic||void 0}),children:/* @__PURE__ */C(b,{size:16})})):/* @__PURE__ */C(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */C(b,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
25
+ /* @__PURE__ */N("div",{className:"es-ts-icons",children:[r(c.bold,/* @__PURE__ */C(u,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>f({weight:e?400:700}),children:/* @__PURE__ */C(y,{size:16})})),m||s?r(c.italic,/* @__PURE__ */C(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),disabled:m,onClick:()=>f({italic:!n.italic||void 0}),children:/* @__PURE__ */C(b,{size:16})})):/* @__PURE__ */C(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */C(b,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
26
26
  return C(ee,{value:h.letterCase??n.letterCase,auto:g("letterCase"),words:c,readOnly:m,set:f},t);case"largestSize":return"heading"===e.kind?O(t):null;default:return O(t)}})]})}function J({value:e,fonts:n,words:t,readOnly:s,set:a}){const l=h();/* @__PURE__ */
27
27
  return N("div",{className:"es-ts-set","data-ts-setting":"font",children:[
28
28
  /* @__PURE__ */C("span",{className:"es-ts-sub",id:l,children:t.settings.font}),
29
29
  /* @__PURE__ */C(i,{value:e,options:n.map(e=>({label:e.label,value:e.value})),onChange:e=>a({font:e}),ariaLabelledBy:l,readOnly:s})]})}function Q({value:e,hex:n,colours:t,words:s,readOnly:i,set:a}){/* @__PURE__ */
30
- return C(Z,{value:e,hex:n,colours:t,label:s.settings.color,followsWord:s.colour.follows,anyWord:s.colour.any,readOnly:i,onChange:e=>a({color:e})})}function ee({value:e,auto:n,words:t,readOnly:s,set:i}){const a=n?["auto","none","upper","lower"]:["none","upper","lower"],r=e??(n?"auto":"none"),o=f([]),d=e=>i({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
30
+ return C(Z,{value:e,hex:n,colours:t,label:s.settings.color,followsWord:s.colour.follows,anyWord:s.colour.any,readOnly:i,onChange:e=>a({color:e})})}function ee({value:e,auto:n,words:t,readOnly:s,set:i}){const a=n?["auto","none","upper","lower"]:["none","upper","lower"],l=e??(n?"auto":"none"),o=f([]),d=e=>i({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
31
31
  return N("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
32
32
  /* @__PURE__ */C("span",{className:"es-ts-sub",children:t.settings.letterCase}),
33
- /* @__PURE__ */C("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const n="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!n||s)return;e.preventDefault();const t=(a.indexOf(r)+n+a.length)%a.length;d(a[t]),o.current[t]?.focus()},children:a.map((e,n)=>{const i=e===r;if("auto"===e)return l(t.case.autoTitle,/* @__PURE__ */C(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:i,className:"es-ts-icon es-ts-icon--word","aria-checked":i,"aria-label":t.case.auto,tabIndex:i?0:-1,disabled:s,onClick:()=>d(e),children:t.case.auto},e));const a=U[e];return l(t.case[e],/* @__PURE__ */C(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:i,className:"es-ts-icon","aria-checked":i,"aria-label":t.case[e],tabIndex:i?0:-1,disabled:s,onClick:()=>d(e),children:/* @__PURE__ */C(a,{size:16})},e))})})]})}export{$ as CAMPAIGN_TEXT_STYLE_SETTINGS,Z as ColourSwatchRow,j as TEXT_STYLE_DEFAULT_COUNT,O as TEXT_STYLE_KINDS,A as TEXT_STYLE_MAX,L as TEXT_STYLE_RANGES,z as TEXT_STYLE_SETTINGS,_ as TextStylesList,I as addTextStyle,H as canAddTextStyle,W as defaultTextStyles,P as describeTextStyle,D as isDefaultTextStyle,R as removeTextStyle,T as resolveTextStyle,V as textStyleRowSize,Y as updateTextStyle,q as weightWord};
33
+ /* @__PURE__ */C("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const n="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!n||s)return;e.preventDefault();const t=(a.indexOf(l)+n+a.length)%a.length;d(a[t]),o.current[t]?.focus()},children:a.map((e,n)=>{const i=e===l;if("auto"===e)return r(t.case.autoTitle,/* @__PURE__ */C(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:i,className:"es-ts-icon es-ts-icon--word","aria-checked":i,"aria-label":t.case.auto,tabIndex:i?0:-1,disabled:s,onClick:()=>d(e),children:t.case.auto},e));const a=U[e];return r(t.case[e],/* @__PURE__ */C(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:i,className:"es-ts-icon","aria-checked":i,"aria-label":t.case[e],tabIndex:i?0:-1,disabled:s,onClick:()=>d(e),children:/* @__PURE__ */C(a,{size:16})},e))})})]})}export{$ as CAMPAIGN_TEXT_STYLE_SETTINGS,Z as ColourSwatchRow,j as TEXT_STYLE_DEFAULT_COUNT,O as TEXT_STYLE_KINDS,A as TEXT_STYLE_MAX,L as TEXT_STYLE_RANGES,z as TEXT_STYLE_SETTINGS,_ as TextStylesList,I as addTextStyle,H as canAddTextStyle,W as defaultTextStyles,P as describeTextStyle,D as isDefaultTextStyle,R as removeTextStyle,T as resolveTextStyle,V as textStyleRowSize,Y as updateTextStyle,q as weightWord};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "5.0.1",
3
+ "version": "5.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",
@@ -1,5 +0,0 @@
1
- import{slotFieldsOf as n}from"./chunk-PLVEGYK6.js";import{usePickFollowsSelection as e}from"./chunk-R6WTQWAC.js";import{Inspector as t}from"./chunk-7EWFXVDJ.js";import{EaselCanvas as r,useSelectedFields as i}from"./chunk-FUOZKV7A.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(e,t,r){const i=e.slotsOf?.(r);return i||n(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={},v=()=>k,g=()=>"",y=()=>null,b=()=>{},O={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},j={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},w={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},L={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},S={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
2
- return s(r,{height:"fill"})}function D(){const{id:n,fields:e,values:r,readOnly:o,onChange:u}=i();/* @__PURE__ */
3
- return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(t,{fields:e,values:r,onChange:u,readOnly:o,idPrefix:n})})}var P=o({});function F({parts:n,children:e}){/* @__PURE__ */
4
- return s(P.Provider,{value:n,children:e})}function G(){return u(P)}function N(){return(G().useOwnerName??g)()}function x(){return(G().useDocumentLabel??y)()}function A(n,e,t,r){return(G().useBridges??v)(n,e,t,r)}function B(n){return(G().useStandaloneBridges??v)(n)}function I(n,e){(G().useDocumentPass??b)(n,e)}function T(){return G().blockRules??O}function V(){return G().blockLook??j}function K(){return G().devices??w}function R(){return G().leftView??L}function W(){return G().pinned??S}function E(){return G().saveSwitch??!0}function Z(n){e(!0===G().pickFollowsSelection,n)}function H(){return G().add??h}function J(){return G().storageNamespace||void 0}function Q(){return G().styleClipboard??null}function U(){return G().nodeKeys??!0}function X(){return G().notify??null}function Y(){return G().Canvas??C}function q(){return G().CanvasHead??null}function z(){return G().canvasDrag??null}var M=o(null);function $({target:n,children:e}){/* @__PURE__ */
5
- return s(M.Provider,{value:n,children:e})}function _(){return u(M)}function nn(){return G().Inspector??D}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,F as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,H as useScreenAdd,V as useScreenBlockLook,T as useScreenBlockRules,A as useScreenBridges,z as useScreenCanvasDrag,Y as useScreenCanvasFrame,q as useScreenCanvasHead,_ as useScreenCanvasTarget,K as useScreenDevices,x as useScreenDocumentLabel,I as useScreenDocumentPass,nn as useScreenInspectorPanel,R as useScreenLeftView,U as useScreenNodeKeys,X as useScreenNotify,N as useScreenOwnerName,G as useScreenParts,Z as useScreenPickFollowsSelection,W as useScreenPinned,E as useScreenSaveSwitch,J as useScreenStorageNamespace,Q as useScreenStyleClipboard,B as useStandaloneScreenBridges};
@@ -1,65 +0,0 @@
1
- import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-BXQBCW3P.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-X2GNFJRC.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-6TOYXESC.js";import{usePartBridge as v}from"./chunk-SF4DL63U.js";import{useSectionOps as w}from"./chunk-XHHS6SDM.js";import{useNodeClipboard as x,useNodeContextMenu as b}from"./chunk-F7BYSWRR.js";import{PageEditGuardNotices as z}from"./chunk-HQWQLDCB.js";import{useScreenDocument as B}from"./chunk-WZMU646D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as N}from"./chunk-V7U33NF2.js";import{AddChildRow as I}from"./chunk-5545A3PC.js";import{AddSidePanel as P}from"./chunk-PCMGFPFU.js";import{SidePanelHead as T,PanelShowStrip as $}from"./chunk-PFNIVZPN.js";import{MediaSidePanel as A}from"./chunk-G4OCSMYY.js";import{useScreenSaveSwitch as M,useScreenNodeKeys as j,useScreenPinned as R,useScreenDocumentLabel as L,useScreenCanvasFrame as E,useScreenInspectorPanel as F,useScreenDevices as V,useScreenPickFollowsSelection as H,useScreenLeftView as W,useScreenAdd as D,SELECTION_MODE as U,sameInspectorMode as G,useScreenBridges as Y,useScreenBlockRules as J,useScreenBlockLook as X,useScreenStorageNamespace as K,useScreenNotify as Q,useScreenCanvasHead as _,isSlotMode as q,useScreenStyleClipboard as Z,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-3FZAGTQE.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ce,slotFieldsOf as ae,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-MCHMF32I.js";import{TreeRow as we,Subtree as xe,LayersTree as be,TreeGroupLabel as ze,TreeRowAction as Be,TreeSeam as Ce}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Oe}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ne}from"./chunk-WK3AFPXY.js";import{LayersIcon as Ie,MediaIcon as Pe}from"./chunk-4VJATVVR.js";import{DEFAULT_SAVE_WORDS as Te,saveIndicator as $e}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Ae,TopBarRail as Me,TopBarCluster as je,EaselIconButton as Re,TopBarDivider as Le,DeviceSwitch as Ee,InspectorIconButton as Fe,PanelResizeHandle as Ve,MAX_PANEL_W as He,MIN_PANEL_W as We,panelWidthVars as De,SaveState as Ue,SaveStateToggle as Ge}from"./chunk-UB4TLWVJ.js";import{DEFAULT_CHROME_WORDS as Ye}from"./chunk-Y2G7CU6A.js";import{CanvasDragLayer as Je}from"./chunk-KEHLCWTG.js";import{DEFAULT_DRAG_WORDS as Xe}from"./chunk-O2NLQBFX.js";import{createDragSession as Ke,useTreeDrag as Qe,gapToMoveIndex as _e}from"./chunk-67GNT6PF.js";import{useCanvasFrame as qe,BLOCK_SELECTOR as Ze,useCanvasEvent as en}from"./chunk-PAELDYYS.js";import{useEasel as nn,useEaselApi as tn}from"./chunk-FUOZKV7A.js";import{toItemSelector as on,useNodeOps as rn,clickPick as ln}from"./chunk-UK2FQOUT.js";import{useWords as sn}from"./chunk-MFIRYGHW.js";import{zoneKey as dn,ROOT_ID as cn,ROOT_SLOT as an,parseZoneKey as pn,DataError as un,find as fn}from"./chunk-KRXQM65X.js";import{useRef as hn,useMemo as mn,useState as gn,useEffect as yn,useCallback as kn,useLayoutEffect as Sn,Fragment as vn}from"react";import{Tooltip as wn,Button as xn,toast as bn}from"efficient-shell/ui";import{UndoIcon as zn,RedoIcon as Bn,TrashIcon as Cn,EyeOffIcon as On,EyeIcon as Nn,DuplicateIcon as In}from"efficient-shell/icons/efficient";import{jsx as Pn,jsxs as Tn,Fragment as $n}from"react/jsx-runtime";function An({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i,words:l,saveWords:s}){if(null!==t)/* @__PURE__ */return Pn(Ue,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
2
- return Pn(Ue,{tone:e.pending?"off-unsaved":"off",label:l.notSaving,role:"status"});const{tone:d,label:c}=$e(e,s),a=e.failed&&!e.paused&&/* @__PURE__ */Pn(xn,{variant:"secondary",size:"sm",onClick:i,children:l.retry});/* @__PURE__ */
3
- return Tn($n,o?{children:[
4
- /* @__PURE__ */Pn(Ge,{pressed:e.paused,onToggle:r,title:e.paused?l.autoSaveOff:l.autoSaveOn,children:/* @__PURE__ */Pn(Ue,{tone:d,label:c})}),a]}:{children:[
5
- /* @__PURE__ */Pn(Ue,{tone:d,label:c,role:"status"}),a]})}function Mn({expand:e}){/* @__PURE__ */
6
- return Pn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Tn($n,e?{children:[
7
- /* @__PURE__ */Pn("path",{d:"M8 9l4-4 4 4"}),
8
- /* @__PURE__ */Pn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
9
- /* @__PURE__ */Pn("path",{d:"M8 4l4 4 4-4"}),
10
- /* @__PURE__ */Pn("path",{d:"M8 20l4-4 4 4"}),
11
- /* @__PURE__ */Pn("path",{d:"M5 12h14"})]})})}function jn(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var Rn="__rungs";var Ln="screen:band",En={duplicate:!0,delete:!0};function Fn(){const $e=ye(),{target:Ue,docId:Ge,capabilities:Fn,currentSlug:Vn,siteId:Hn,onPublish:Wn,saveState:Dn,saveConflict:Un,retrySave:Gn,toggleAutoSave:Yn,readOnly:Jn,readOnlyReason:Xn=null}=B(),Kn=M(),Qn=j(),{mediaEditing:_n,hasEditGuard:qn,hasPinnedChrome:Zn}=Fn,{appState:et,dispatch:nt,history:tt,selectedItem:ot,getSelectorForId:rt,config:it}=nn(e=>e),lt=R(),{first:st,firstGroup:dt,lastGroup:ct,isSectionGroup:at,sectionGroupZone:pt,panelOf:ut}=lt,ft=ut(st),ht=e=>oe(lt,e),mt=e=>re(lt,e),gt="node"===lt.firstRow,yt=lt.band??null,kt=sn("screen",ve),St=sn("tree",Oe),vt=sn("drag",Xe),wt=sn("save",Te),xt=sn("menu",Ne),bt=sn("styleClipboard",Se),zt=sn("chrome",Ye),Bt=L()??`/${Vn}`,Ct=E(),Ot=F(),Nt=w({readOnly:Jn}),It=w({readOnly:Jn,foldIntoHistory:!0}),Pt=hn(null),Tt=tn(),$t=mn(()=>({...Nt,select:e=>{Pt.current=e,Nt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Tt.config;Pt.current=on(e,t,n)}Nt.commitDocument(e,n)}}),[Nt,Tt]),At=et.ui,Mt=At.leftSideBarVisible,jt=At.rightSideBarVisible,{options:Rt,widths:Lt,initial:Et,fluid:Ft,fit:Vt}=V(),[Ht,Wt]=gn(Et),Dt=he(),Ut=_n&&null!==Dt,Gt=me(),Yt=ge();H(ot?.props.id);const{read:Jt,write:Xt,forSelection:Kt}=W(),[Qt,_t]=gn(Jt);yn(()=>{Xt(Qt)},[Qt]);const[qt,Zt]=gn(0),eo=hn(null),no=hn(null),to=qe(no,{readySelector:Ze}),oo=f(no);h(no,to);const[ro,io]=gn(!1),lo=hn(!1),so=hn(!1),[co,ao]=gn(null),po=D(),uo=e=>ao(null===e?null:{zone:le,index:e}),[fo,ho]=gn([]),[mo,go]=gn(U),yo="puck"===mo.kind,ko=ro&&!co&&po.railTarget?po.railTarget(et.data,{node:ot??null,mode:mo}):null,So=ko?{zone:dn(ko),index:ko.index}:null,vo=co??So,wo=vo&&vo.zone===le?vo.index:null,xo=t(mo,ot?.props.id),[bo,zo]=gn(null);yn(()=>{bo&&(o(),zo(null))},[bo]);const Bo=hn(rt);Bo.current=rt;const Co=kn((e,{scroll:n})=>{_t(n=>Kt(e,n)),n&&zo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Bo.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&tr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Oo=hn(null);yn(()=>{const e=Oo.current;Oo.current=null;const n=null==ot?.props.id?null:String(ot.props.id);go(e&&e.id===n?e.mode:ut(ot?.type)??U);const t=ot?.props.id,o=Pt.current;if(Pt.current=null,!t)return;const i=rt(t);Co(String(t),{scroll:!r(o,i??null,le)})},[ot?.props.id,Co]);const No=kn(e=>{go(n=>G(n,e)?n:e),nt({type:"setUi",ui:{rightSideBarVisible:!0}})},[nt]),Io=hn(()=>{});Io.current=(e,n)=>{const t=e?Jr(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==ot?.props.id?null:String(ot.props.id);go(e=>G(e,n)?e:n),o!==r&&(Oo.current={id:o,mode:n},$t.select(e))};const Po=kn((e,n)=>Io.current(e,n),[]),To={kind:mo.kind,mode:mo,open:No,show:e=>go(e),reveal:()=>{jt||nt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Po},$o=Y(To,{data:et.data,selected:ot??null,zoneOf:e=>rt(e)?.zone,readOnly:Boolean(Jn),select:e=>{go(U),$t.select({index:e})},replace:(e,n)=>$t.replaceComponent(le,e,n),scrollTo:e=>ki(e)},{device:Ht,refreshes:qt},{setView:_t,reveal:()=>{Mt||nt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Ao=$o.pinnedSource??!1,Mo=$o.resolveLeftView?$o.resolveLeftView(Qt,Ut):"media"===Qt&&Ut?Qt:"sections",jo=J(),{isLockedBlock:Ro,duplicateBlocked:Lo,nestDepth:Eo,newSectionNode:Fo,canAddTo:Vo,blockIsOffered:Ho}=jo,Wo=X(),{labelAtLevel:Do,Icon:Uo,useProducts:Go}=Wo,Yo=Wo.rowName?(e,n,t)=>Wo.rowName(e,n,t):void 0,Jo=kn(e=>{nt({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),Co(e,{scroll:!0})},[nt,Co]),{selectNode:Xo,openPartId:Ko}=v({mode:mo,setMode:go,onOpenPart:Jo}),[Qo,_o]=gn(null);ke(null!==Qo,()=>_o(null));const qo=y(K()),Zo=qo.collapsed,er=qo.panelWidths,[nr,tr]=gn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Zo);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
12
- return new Set}});yn(()=>{try{window.localStorage.setItem(Zo,JSON.stringify([...nr]))}catch{}},[nr]);const[or,rr]=gn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(er);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});yn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(er,JSON.stringify(or))}catch{}},300);return()=>clearTimeout(e)},[or]);const ir=kn((e,n)=>rr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),lr=kn(e=>ir("left",e),[ir]),sr=kn(e=>ir("right",e),[ir]),dr=e=>nr.has(e),cr=e=>tr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),ar=hn(!1),pr=hn(null);yn(()=>{if(ar.current&&!ro){const e=pr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??no.current?.querySelector(`button[aria-label="${CSS.escape(kt.add.title)}"]`))?.focus(),pr.current=null}ar.current=ro},[ro]),yn(()=>{if(!ro||!oo)return;const e=e=>{"Escape"===e.key&&Oi()};return oo.addEventListener("keydown",e),()=>oo.removeEventListener("keydown",e)},[ro,oo]),ke(ro,()=>Oi()),yn(()=>{!Mt&&ro&&(io(!1),ao(null),lo.current=!1)},[Mt]),yn(()=>{if(!Gt)return so.current&&nt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(so.current=!1);ro&&(io(!1),ao(null),so.current=lo.current,lo.current=!1),Mt||(so.current=!0,nt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Gt]),yn(()=>{!Mt&&Gt&&(so.current=!1,Yt())},[Mt]),yn(()=>{if(!Gt||!oo)return;const e=e=>{"Escape"===e.key&&Yt()};return oo.addEventListener("keydown",e),()=>oo.removeEventListener("keydown",e)},[Gt,oo]),ke(null!==Gt,()=>Yt());const ur=Q(),fr=(e,n="success")=>{ur?ur(e,"error"===n?"error":"info"):"error"===n?bn.error(e,{duration:3200,sound:!1}):bn.success(e,{duration:1900,sound:!1})},hr=hn(null),[mr,gr]=gn(0),[yr,kr]=gn(0),Sr=_(),vr=hn(null),wr=e=>Math.max(0,e.clientHeight-(vr.current?.offsetHeight??0));yn(()=>{const e=hr.current;if(!e)return;const n=()=>{gr(e.clientWidth),kr(wr(e))};n();const t=new ResizeObserver(n);return t.observe(e),vr.current&&t.observe(vr.current),()=>t.disconnect()},[]),Sn(()=>{hr.current&&(gr(hr.current.clientWidth),kr(wr(hr.current)))},[or,Mt,jt]);const xr=Ht===Ft?mr>0?mr:Lt[Ft]:Lt[Ht],br=mr>0?Math.min(mr/xr,"shrink"===Vt?1:2):1,zr=xr*br,Br=mr>0&&zr>mr+1,Cr={width:zr,height:yr||"100%",flex:"none",position:"relative"},Or={width:xr,height:yr?yr/br:"100%",maxHeight:"none",transform:1!==br?`scale(${br})`:void 0,transformOrigin:"top left"},Nr=()=>nt({type:"setUi",ui:{leftSideBarVisible:!Mt}}),Ir=()=>nt({type:"setUi",ui:{rightSideBarVisible:!jt}}),Pr=e=>{ro&&(io(!1),ao(null),lo.current=!1,Mt&&Qt===e)||Gt&&(so.current=!1,Yt(),Mt&&Qt===e)||(Mt&&Qt===e?Nr():(_t(e),Mt||nt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Tr=()=>{C($e,{accept:"image/*",title:zt.mediaLibrary})},$r=()=>{go(U),$t.select(null),u()},Ar=()=>{go(ft??U),jt||nt({type:"setUi",ui:{rightSideBarVisible:!0}})},Mr=et.data.content??[],jr=()=>{const e=Mr.findIndex(ht),n=Mr.findIndex(mt);return{floor:e>=0?e+1:0,cap:n>=0?n:Mr.length}},Rr=it,Lr=jo.stripCopy,Er=e=>i(e,Lr),Fr=x(),Vr=rn({data:et.data,config:Rr,readOnly:Boolean(Jn),clipboard:Fr,strip:Lr?e=>Lr(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==cn||e.slot!==an)return{min:0,max:n-1};const{floor:t,cap:o}=jr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&go(U);const t=void 0===n||"node"===n?.kind?n:null;$t.commitDocument(e,t)}}),Hr=e=>Do(e,"block",it.components[e]?.label??e),Wr=kn(e=>it.components[e]?.defaultProps??{},[it]),Dr=e=>Do(e,"section",Hr(e)),Ur=e=>l({type:e.type,props:e.props??{}},Dr(e.type),Yo),{nodeAddresses:Gr,zoneItems:Yr}=mn(()=>{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>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ce(it,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Mr,le,0),{nodeAddresses:e,zoneItems:n}},[Mr,it]),Jr=kn(e=>Yr.get(e)??[],[Yr]),Xr=e=>{const n=Gr.get(e);return n?Jr(n.zone)[n.index]:void 0},Kr=e=>ie(jo,it,e),Qr=e=>{if(!jo.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Xr(e.slice(0,n));if(!t)return null;const o=Kr(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},_r=(()=>{if(!q(mo))return null;const e=`${mo.nodeId}:${mo.slot}`;return Qr(e)?.slot.panel===mo.kind?e:null})(),qr=hn(null);yn(()=>{const e=qr.current;if(qr.current=null,!_r||!q(mo))return;const n=mo.nodeId;Co(n,{scroll:e!==_r}),tr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[mo]);const Zr=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Gr.get(e);n&&(n.zone===le?Si(n.index):Ki(n.zone,n.index,e,Xr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&_r!==i&&(qr.current=i),Po(null,r),jt||nt({type:"setUi",ui:{rightSideBarVisible:!0}}),ki(o)},ei=(e,n,t)=>{const o=`${e}:${n}`;if(tr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;_r!==o&&(qr.current=o);Po(null,{kind:t,nodeId:e,slot:n})},ni=(e,n,t)=>{if(Jn||!jo.moveSlot)return;const o=Xr(e),r=o?Kr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Rn,index:n},s=_e(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=jo.moveSlot(e,n,s);"string"==typeof d&&ei(e,d,i.panel)},ti=Go(),oi=mn(()=>{const e=/* @__PURE__ */new Map;for(const n of ti??[])e.set(n.slug,n.name);return e},[ti]),ri=e=>s(e,Hr,Wo.plainText,e=>oi.get(e),Wo.rowName),ii=(e,n)=>{const t=it.components[e.type]?.fields,o=n===le||fl(n)?"section":"block",r=n===le&&(ht(e)||mt(e)||at(e.type)),i="block"===o?d(t):r?null:c(t);return Wo.renamePropOf?Wo.renamePropOf(e,o,i):i},li=(e,n,t,o)=>{if(!(!Jn&&Qo?.zone===e&&Qo.index===n))return;const r=(t,o)=>{_o(null),o&&((e,n,t)=>{const o=Jr(e)[n];if(!o)return;const r=ii(o,e);r&&$t.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
13
- return Pn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":kt.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)},si=n(Z(),bt),di=si.scope({target:Ue,siteId:Hn,docId:Ge}),ci=it,ai=(e,n)=>n===le?Dr(e):Hr(e),pi=(e,n,t)=>{const o=si.plan(di,t,ai(t.type,e),ci);o&&(o.changed&&$t.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),fr(o.message))},ui=b({nodesIn:Jr,nodeAt:(e,n)=>Jr(e)[n]??null,labelOf:(e,n)=>n===le?Dr(e):Hr(e),renamePropOf:ii,beginRename:(e,n)=>_o({zone:e,index:n}),history:{hasPast:tt.hasPast,hasFuture:tt.hasFuture,back:()=>tt.back(),forward:()=>tt.forward()},openAddSection:()=>{$t.select(null),Bi(null)},openPageSettings:()=>{$t.select(null),go(U)},pageSettingsLabel:kt.pageSettings,words:{menu:xt,styleClipboard:bt,screen:kt.menu},readOnly:Boolean(Jn),collapseAll:()=>tr(new Set(Jr(le).map(e=>String(e.props.id)))),onPasteRefused:e=>fr(e?kt.pasteRefused({name:e.label}):kt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ml(e,n),menuRows:$o.menuRows,isLocked:e=>Ro(e.type),duplicateBlocked:e=>Lo(et.data,e),permits:e=>se(it,e.type),canAddTo:Vo,nodeOps:Vr,isPinned:(e,n)=>n===le&&(ht(e)||mt(e)),sectionBand:jr,openAddInside:(e,n)=>{e===le?Si(n):$t.select({zone:e,index:n}),Bi(null)},locate:e=>Gr.get(e)??null,rowNameOf:(e,n)=>n===le?Ur(e):ri(e),selectAt:(e,n,t,o)=>{e===le?Si(n):Ki(e,n,t,o??"")},slotRung:e=>{const n=Qr(e);return n?.slot.panel?{label:n.slot.label,select:()=>Zr(n.node,n.slot,!1)}:null},style:{held:()=>O(di),canCopy:e=>si.rows(ci,e).some(e=>!1!==e.counted),copy:(e,n)=>si.copy(di,e,ai(e.type,n),ci),paste:(e,n,t)=>pi(e,n,t)},keys:Qn?{target:oo,selected:()=>{const e=et.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>Fr.get(),readOnly:Boolean(Jn),onDone:({done:e,name:n})=>{"copied"===e&&fr(kt.copied({name:n}))}}:void 0},to),fi=hn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});yn(()=>{fi.current={copy:(e,n)=>si.copy(di,e,ai(e.type,n),ci),paste:pi,at:()=>{const e=et.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Jr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Jn)}});const hi=kn(e=>{const n=N(e);if(!n)return;const t=fi.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))},[]);yn(()=>{if(!oo)return;const e=e=>hi(e);return oo.addEventListener("keydown",e),()=>oo.removeEventListener("keydown",e)},[hi,oo]),en(to,"keydown",hi);const mi=Mr.map(e=>e.props.id).join("|");yn(()=>{const e=to?.document??null,n=to?.window??null;let t=0;const o=[],r=()=>{if(!e)return void ho(e=>e.length?[]:e);const n=Mr.findIndex(mt),t=n>=0?n:Mr.length,o=n=>{const t=Mr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Ze)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=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=jn(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}ho(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()}},[to,mi,Ht,br,Mt,jt,ot?.props.id]);const gi=to?.document??null,yi=to?.window??null;yn(()=>{const e=eo.current;if(!e||!gi||!yi)return;const n=[],t=()=>{const n=gi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&yi.scrollTo({left:yi.scrollX,top:yi.scrollY+t,behavior:"instant"}),!0};return eo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[gi,yi]);const ki=e=>{$o.holdCanvasOn?$o.holdCanvasOn(e):a(e)},Si=e=>{go(U),$t.select({index:e}),$o.sectionPressed?.(Mr[e]);const n=Mr[e]?.props?.id;n&&ki(n)},vi=e=>{const{floor:n,cap:t}=jr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=ot&&mo.kind!==ft?.kind?Mr.findIndex(e=>e.props.id===ot.props.id):-1;return o(r>=0?r+1:t)},wi=(e,n)=>{const{floor:t,cap:o}=jr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:($t.reorderComponent(le,e,i),$t.select({index:i}),{moved:!0,dest:i})},xi=(e,n,t,o)=>{go(U),$t.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),fr(kt.sectionAdded({name:t}))},bi=(e,n)=>{const t=vi(n),o=Fo(e,{nodeDefaults:Wr,newNodeId:fe,sectionLabel:Dr,blockIsOffered:Ho}),r=o?$t.insertNode(le,t,o):$t.insertSection(e,t);return xi(t,r,Dr(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:c}of ce(it,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Vo(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:c,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},zi=(e,n,t)=>{const o=vi(t),r=$t.insertNode(le,o,n);return xi(o,r,e),o},Bi=e=>Ci(le,e),Ci=(e,n)=>{pr.current=document.activeElement??null,Gt&&(lo.current=so.current,so.current=!1,Yt()),ao(null===n?null:{zone:e,index:n}),io(!0),Mt||(lo.current=!0,nt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Oi=()=>{io(!1),ao(null),lo.current&&nt({type:"setUi",ui:{leftSideBarVisible:!1}}),lo.current=!1},Ni=(e,n,t)=>{if("section"===e.kind)$t.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;$t.insertNode(n,t,Er(e.template.node))}go(U),$t.select({index:t,zone:n})},Ii=(e,n)=>Wo.rowName?n?ht(e)?Wo.rowName(e,"section",kt.header):mt(e)?Wo.rowName(e,"section",kt.footer):at(e.type)?Wo.rowName(e,"section",Hr(e.type)):Ur(e):ri(e):n?Dr(e.type):Hr(e.type),Pi=e=>n=>{e()},Ti=()=>$o.editPinnedSource?.(),$i=(e,n,t)=>{if(Jn)return null;const o=Jr(e)[n];return o&&!se(it,o.type).delete?null:/* @__PURE__ */Pn(Be,{kind:"delete",label:kt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Jr(e)[n]?.props?.id;null!=t&&Vr.remove(String(t))})(e,n),children:/* @__PURE__ */Pn(Cn,{size:15})})},Ai=e=>Wo.rowPreview?.(e)||void 0,Mi=e=>Wo.rowMarks?.(e)??void 0,ji=(e,n,t)=>Wo.rowActions?.(e,n,t)??null,Ri=(e,n,t,o)=>{if(Jn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
14
- return Pn(Be,{kind:"eye",label:r?kt.showNamed({name:o}):kt.hideNamed({name:o}),onClick:()=>Ei(e,n,t),children:/* @__PURE__ */Pn(r?On:Nn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Li=e=>{const n=Dr(Mr[e]?.type??""),t=n?kt.addSectionBefore({name:n}):kt.addSectionHere;return Ll(le,e,()=>Bi(e),t)},Ei=(e,n,t)=>{$t.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Fi=e=>ae(it,e),Vi=e=>ce(it,e),Hi=e=>jo.slotsOf?Kr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Vi(e)}],Wi=e=>jo.slotsOf?Hi(e).flatMap(e=>e.kids):Vi(e),Di=e=>Boolean(jo.slotsOf)&&Kr(e).some(e=>e.rung),Ui=(e,n,t)=>null===t?void 0===n?Vo(e):Vo(e,n):Vo(e,n,t),Gi=(e,n,t)=>{const o=ue(it,e.type,n)&&(t||Wi(e).length>0||Di(e));return{collapsible:o,folded:o&&dr(String(e.props.id))}},Yi=(e,n,t)=>Hi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Gi(e,r,t(e.type)).collapsible?[String(e.props.id),...Yi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ji=e=>Wi(e).length>0||Di(e)||Boolean(Vo(e.type)),Xi=e=>Boolean(Vo(e)),Ki=(e,n,t,o)=>{if(go(U),Vo(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),$t.select({index:n,zone:e}),a(t)}else $t.select({index:n,zone:e}),ki(t)},Qi=(e,n,t,o,r)=>{const i=`${e}:${n}`;$t.insertComponent(i,t,o),Vo(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),$t.select({index:o,zone:i})}):$t.select({index:o,zone:i})},_i=(e,n,t)=>{$t.insertComponent(e,n,t),go(U),$t.select({index:t,zone:e})},qi=hn(/* @__PURE__ */new Set);yn(()=>{Mr.forEach(e=>{const n=Vo(e.type)?.spec;if(!n)return;const t=e.props.id;if(qi.current.has(t))return;qi.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(Wr)).forEach((e,t)=>It.seedChild(o,t,n.childType,e))})},[Mr,It,Wr]);const Zi=hn(/* @__PURE__ */new Set);yn(()=>{Mr.forEach((n,t)=>{const o=n.props.id;if(Zi.current.has(o))return;const r=e(n,Fi(n.type));Zi.current.add(o),r&&It.replaceComponent(le,t,{...n,props:r})})},[Mr,It]),ee(It,it);const el=Mr.findIndex(mt),nl=el>=0?Mr[el]:null,tl=gt?Mr.findIndex(ht):-1,ol=tl>=0?Mr[tl]:null,rl=Mr.find(e=>e.type===dt)??null,il=Mr.find(e=>e.type===ct)??null,ll=el>=0?el:Mr.length,sl=[];Mr.forEach(e=>{mt(e)||(Ji(e)&&sl.push(String(e.props.id)),sl.push(...Yi(e,1,Xi)))}),nl&&(sl.push(String(nl.props.id)),sl.push(...Yi(nl,1,Xi)));const dl=sl.length>0&&sl.every(e=>nr.has(e)),cl=e=>{const n=Wo.blockRowName(e,Hr);return Wo.rowName?Wo.rowName(e,"block",n):n},al=(e,n,t,o)=>{const r=Jr(e)[t];if(!r)return;const i={...pn(e),index:t},l={...pn(n),index:Math.min(Math.max(o,0),Jr(n).length)},s=_e(i,l);if(e!==n||s!==t)try{Vr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof un))throw e}},pl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Vi(e))n.add(r),t(o)};for(const t of Fi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ul=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Gr.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},fl=e=>{const n=e.slice(0,e.indexOf(":")),t=Mr.find(e=>at(e.type)&&String(e.props.id)===n);return t&&pt(n)===e?t:null},hl=(e,n,t)=>{if(e.rung){const t=Xr(e.rung.nodeId),o=t?Kr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Rn&&n.index>=0&&n.index<=o}if(n.slot===Rn)return!1;if(e.add)return yl(e.add,n);const o=dn(n);if(at(e.type))return!1;const r=fl(o),i=fl(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Jr(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=jr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Jr(o).length)return!1;if(e.zone===o)return!0;const l=nl&&!lt.lastIsOpen?String(nl.props.id):null;return(!l||ul(e.zone)!==l&&ul(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Jr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Gr.get(i),s=l?Jr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&pl(r).has(n))return!1;const d=Vo(s.type,Eo(et?.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?.(Jr(n),r))})(e.zone,o,e.index,t)},ml=(e,n)=>{const t=dn(e.from);if(t===dn(n))return!0;const o=e.node;return hl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},gl=e=>{const n=e.slice(0,e.indexOf(":")),t=Gr.get(n),o=t?Jr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Vo(o.type,Eo(et?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:Hr(r.spec.childType)}]:[]),l=Qr(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Ii(o,t.zone===le)}},yl=(e,n)=>{const t=dn(n);if("block"!==e.kind){if(fl(t))return n.index>=0&&n.index<=Jr(t).length;if(t!==le)return!1;const{floor:e,cap:o}=jr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=gl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Jr(t))},kl=(e,n)=>{e.rung?ni(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&fl(dn(n)))return void Ni(e,dn(n),n.index);if("section"===e.kind)return void bi(e.type,n.index);if("template"===e.kind)return void zi(e.template.name,Er(e.template.node),n.index);const t=dn(n),o=gl(t);o&&(o.target.spec?Qi(o.parentId,o.target.slot,e.type,n.index,o.parent.type):_i(t,e.type,n.index))})(e.add,n):e.zone===le?wi(e.index,n.index):al(e.zone,dn(n),e.index,n.index)},[Sl]=gn(()=>Ke()),vl=Qe({keyOf:e=>e.id,readOnly:Boolean(Jn),session:Sl,canDrop:hl,onDrop:kl,onStep:(e,n)=>{e.rung?ni(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=Dr(Mr[e]?.type??""),o=wi(e,n<0?e-1:e+2);if(!o.moved)return void fr(n<0?kt.sectionFirst({name:t}):kt.sectionLast({name:t}));const{floor:r,cap:i}=jr();fr(kt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):al(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),wl=kn(e=>{const{floor:n,cap:t}=jr(),o=[];for(const r of e.nodes){const e=dn(r.place),i=Jr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(ht(i)||mt(i)||Ro(i.type))continue;if(at(i.type))continue;const l=Boolean(fl(e)),s=e===le||l;e===le&&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?Dr(i.type):ri(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(gl(dn(e.list))?.choices.length)||Boolean(fl(dn(e.list))))}},[et.data]),xl=null==ot?.props.id?null:String(ot.props.id),bl=kn(e=>{const n=it,t=e=>!e.item.rung&&null!==fn(et.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(xl);return i||(r(ln(et.data,n,o.item.id,xl))??o)},[et.data,it,xl]),zl=e=>{go(U),$t.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},Bl=ne(),Cl=()=>({data:et.data,device:Ht,ops:$t,inspector:To}),Ol=Bl?.model,Nl=mn(()=>Ol?e=>Ol(e,wl(e),Cl()):wl,[Ol,wl,Ht]),Il=Bl?.measure,Pl=Il?(e,n)=>Il(e,n,Cl()):void 0,Tl=Bl?.canDrop,$l=Tl?(e,n)=>Tl(e,n,hl,Cl()):hl,Al=Bl?.drop,Ml=Al?(e,n)=>Al(e,n,kl,Cl()):kl,jl=Bl?.pick,Rl=jl?e=>jl(e,zl,Cl()):zl,Ll=(e,n,t,o)=>/* @__PURE__ */Pn(Ce,{...Jn?{}:vl.seam({place:{...pn(e),index:n}}),onAdd:Jn?void 0:t,label:o},`seam:${e}:${n}`),El={rowClick:Pi,isCollapsed:dr,toggleCollapse:cr},Fl=e=>{const n=String(e.props.id),t=Mr.findIndex(e=>String(e.props.id)===n),o=pt(n),r=Jr(o),i=dr(n),l=Hr(e.type),s=Wo.rowName?Wo.rowName(e,"section",l):l,d=e=>Ll(o,e,()=>Ci(o,e),kt.addSectionHere);/* @__PURE__ */
15
- return Tn($n,{children:[
16
- /* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:e.type,size:13}),name:s,preview:Ai(e),marks:Mi(e),onSelect:()=>Si(t),nameSlot:li(le,t,n,s),selected:xo===n,actions:ji(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:Pi(()=>Si(t))},fold:{open:!i,label:"section",onToggle:()=>cr(n)}}),!i&&/* @__PURE__ */Tn(xe,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ur(n),l=Ji(n),s=l&&dr(r),c=()=>Ki(o,t,r,e.type),{rowProps:a,...p}=vl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...pn(o),index:t}},{"data-node-id":r,onClick:Pi(c)});/* @__PURE__ */
17
- return Tn(vn,{children:[d(t),
18
- /* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:n.type,size:13}),name:i,preview:Ai(n),marks:Mi(n),onSelect:c,nameSlot:li(o,t,r,i),selected:xo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn($n,{children:[$i(o,t,i),ji(n,o,t),Ri(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Pn(xe,{children:Wl(n,2)})]},r)}),d(r.length)]})]})},Vl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=vl.dragging,d=!dr(l)&&s?.rung?.nodeId!==i,c={...pn(l),index:0},a=s&&!s.rung&&hl(s,c)?c:void 0,p=()=>Zr(e,n,!0),{rowProps:u,...f}=vl.row({item:{id:`rung:${l}`,zone:`${i}:${Rn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Rn,index:t},into:a,canDrag:Boolean(jo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Pi(p)}),h=Jn?null:jo.slotActions?.(e,n.slot);/* @__PURE__ */
19
- return Tn(vn,{children:[n.heading,
20
- /* @__PURE__ */Pn(we,{words:St,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:_r===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>cr(l)},actions:h&&h.length>0?/* @__PURE__ */Pn($n,{children:h.map((t,o)=>/* @__PURE__ */Pn(Be,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Jn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ei(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__ */Pn(Cn,{size:15}):/* @__PURE__ */Pn(In,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Pn(xe,{children:r})]},l)},Hl=(e,n)=>{const t=Hi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
21
- return Pn($n,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Ui(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=null!==c&&Boolean(gl(c)?.choices.length),p=(e,n)=>a?Ll(e,n,()=>Ci(e,n),kt.addBlockHere):Ll(e,n),u=/* @__PURE__ */Tn($n,{children:[i.map(({child:n,zone:t,index:o})=>{const r=xo===String(n.props.id),{collapsible:i,folded:s}=Gi(n,l,Xi(n.type)),d=String(n.props.id),c=cl(n),a=()=>Ki(t,o,d,e.type),{rowProps:u,...f}=vl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...pn(t),index:o}},{"data-node-id":d,onClick:Pi(a)});/* @__PURE__ */
22
- return Tn(vn,{children:[0===o&&p(t,0),
23
- /* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:n.type,size:13}),name:c,preview:Ai(n),marks:Mi(n),onSelect:a,nameSlot:li(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>cr(d)}:void 0,actions:/* @__PURE__ */Tn($n,{children:[$i(t,o,c),ji(n,t,o),Ri(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Pn(xe,{children:Hl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==c?null:p(c,0)]});return t.rung?Vl(e,t.rung,r++,o,u):/* @__PURE__ */Pn(vn,{children:u},t.slot??"")})})},Wl=(e,n)=>{const t=Eo(et?.data,e.type,String(e.props.id)),o=Hi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
24
- return Pn($n,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Ui(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>Qi(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>Ci(n,t):void 0;return Ll(n,t,o,n===f&&c?c.addLabel:kt.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */Tn($n,{children:[l.map(({child:n,zone:t,index:o})=>{const r=xo===String(n.props.id),i=ri(n),l=String(n.props.id),{collapsible:d,folded:c}=Gi(n,s,Xi(n.type)),a=Fi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...pn(p),index:Jr(p).length}:void 0,f=vl.dragging,h=u&&f&&hl(f,u)?u:void 0,g=()=>Ki(t,o,l,e.type),{rowProps:y,...k}=vl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...pn(t),index:o},into:h,canDrag:!Ro(n.type)},{"data-node-id":l,onClick:Pi(g)});/* @__PURE__ */
25
- return Tn(vn,{children:[0===o&&m(t,0),
26
- /* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:n.type,size:13}),name:i,preview:Ai(n),marks:Mi(n),onSelect:g,nameSlot:li(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>cr(l)}:void 0,actions:Ro(n.type)?ji(n,t,o)??void 0:/* @__PURE__ */Tn($n,{children:[$i(t,o,i),ji(n,t,o),Ri(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Pn(xe,{children:Wl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
27
- /* @__PURE__ */Pn(I,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>Qi(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?Vl(e,o.rung,i++,r,k):/* @__PURE__ */Pn(vn,{children:k},o.slot??"")})})},Dl=(()=>{if(!ot||!yo)return null;const e=String(ot.type),n=String(ot.props.id),t=Vo(e,Eo(et?.data,e,n));if(!t||"footer"===t.source)return null;const o=Mr.some(e=>String(e.props?.id)===n),r=Array.isArray(ot.props[t.slot])?ot.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Hr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:Ii(ot,o),choices:i,onPick:o=>{t.spec?Qi(n,t.slot,o,r.length,e):_i(`${n}:${t.slot}`,o,r.length)}}})(),Ul=vo&&vo.zone!==le&&!fl(vo.zone)?vo.zone:null,Gl=!0===po.blocksFirst,Yl=Ul?gl(Ul):Gl&&vo?null:Dl,Jl=Boolean(co&&Ul)||Gl&&Boolean(Yl&&Yl.choices.length>0),Xl=ro||null!==Gt,Kl=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Mt&&!Xl&&Mo===e.id,onSelect:()=>Pr(e.id)}:e,Ql=[{id:"add",label:kt.add.title,icon:/* @__PURE__ */Pn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:ro,onSelect:()=>ro?Oi():Bi(null)},...($o.railLead??[]).map(Kl),{id:"sections",label:kt.layers,icon:/* @__PURE__ */Pn(Ie,{}),active:Mt&&!Xl&&"sections"===Mo,onSelect:()=>Pr("sections")},...($o.railTrail??[]).map(Kl)];Ut?Ql.push({id:"media",label:kt.railMedia,icon:/* @__PURE__ */Pn(Pe,{}),active:Mt&&!ro&&(null!==Gt||"media"===Mo),onSelect:()=>Pr("media")}):_n&&Ql.push({id:"media",label:kt.railMedia,icon:/* @__PURE__ */Pn(Pe,{}),onSelect:Tr});const _l=[...$o.railLead??[],...$o.railTrail??[]].find(e=>"panel"in e&&e.id===Mo),ql=Boolean(yt?.foldable)&&!Ao,Zl=yt?.label??(qn?kt.pageSections:kt.templateSections),es=ql&&dr(Ln),ns=/* @__PURE__ */Tn($n,{children:[Mr.map((e,n)=>{if(ht(e)||mt(e)||at(e.type))return null;const t=xo===String(e.props.id),o=Boolean(e.props._hidden);Vi(e);const r=String(e.props.id),i=$o.hasOwnRows?.(e)??!1,l=Ji(e)||i,s=l&&dr(r),{rowProps:d,...c}=vl.row({item:{id:r,zone:le,index:n,type:e.type},place:{...pn(le),index:n}},{"data-node-id":r,onClick:Pi(()=>Si(n))});/* @__PURE__ */
28
- return Tn(vn,{children:[n>0&&Li(n),
29
- /* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:e.type,size:13}),name:Ur(e),preview:Ai(e),marks:Mi(e),onSelect:()=>Si(n),nameSlot:li(le,n,r,Ur(e)),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn($n,{children:[$i(le,n,Ur(e)),ji(e,le,n),Ri(le,n,e,Ur(e))]}),rowProps:d}),Ji(e)&&!s&&/* @__PURE__ */Tn(xe,{children:[Wl(e,1),$o.partRows?.(e,El)]}),i&&!s&&/* @__PURE__ */Pn(xe,{children:$o.ownRows?.(e,n,El)})]},String(e.props.id??n))}),!Ao&&ll>0&&Li(ll),yt?.addAtEnd&&!Ao&&!Jn&&/* @__PURE__ */Pn(I,{small:!0,label:kt.addSection,blocked:null,onAdd:()=>Bi(ll)})]}),ts=(e,n,t)=>{const o=String(e.props.id),r=Wi(e).length>0||Di(e)||Boolean(Vo(e.type)),i=r&&dr(o),l="header"===t?kt.header:kt.footer,s=Wo.rowName?Wo.rowName(e,"section",l):l;/* @__PURE__ */
30
- return Tn($n,{children:[
31
- /* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:t,size:13}),name:s,preview:Ai(e),marks:Mi(e),onSelect:()=>Si(n),nameSlot:li(le,n,o,s),selected:xo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>cr(o)}:void 0,actions:ji(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:Pi(()=>Si(n))}}),r&&!i&&/* @__PURE__ */Pn(xe,{children:Hl(e,1)})]})};return($o.wrap??(e=>e))(
32
- /* @__PURE__ */Pn(te,{target:to,children:/* @__PURE__ */Tn("div",{ref:no,className:"sf-editor es-editor",style:De(or),onContextMenu:ui.onEditorContextMenu,...m($e),children:[
33
- /* @__PURE__ */Tn(Ae,{children:[
34
- /* @__PURE__ */Pn(Me,{items:Ql,ariaLabel:kt.bar.views}),
35
- /* @__PURE__ */Tn(je,{children:[
36
- /* @__PURE__ */Pn(Re,{label:kt.bar.undo,disabled:Boolean(Jn)||!tt.hasPast,onClick:()=>tt.back(),children:/* @__PURE__ */Pn(zn,{})}),
37
- /* @__PURE__ */Pn(Re,{label:kt.bar.redo,disabled:Boolean(Jn)||!tt.hasFuture,onClick:()=>tt.forward(),children:/* @__PURE__ */Pn(Bn,{})}),
38
- /* @__PURE__ */Pn(Le,{}),
39
- /* @__PURE__ */Pn(Ee,{devices:Rt,value:Ht,onChange:Wt})]}),
40
- /* @__PURE__ */Tn(je,{kind:"right",style:{minWidth:300},children:[
41
- /* @__PURE__ */Pn(An,{saveState:Dn,notSaving:Boolean(Jn)||null!=Un,readOnlyReason:Xn,toggle:Kn,onToggle:Yn,onRetry:Gn,words:kt.bar,saveWords:wt}),$o.barLead?.(),
42
- /* @__PURE__ */Pn(wn,{content:kt.bar.refreshTip,side:"bottom",children:/* @__PURE__ */Pn(xn,{variant:"secondary",onClick:()=>{eo.current=(()=>{const e=to?.document;if(!e)return null;const n=Mr.findIndex(mt),t=n>=0?n:Mr.length;let o=null;for(let n=0;n<t;n++){const t=Mr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=ot?.props?.id??Mr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Zt(e=>e+1)},children:kt.bar.refresh})}),$o.barTrail?.(),$o.barMain?$o.barMain():/* @__PURE__ */Pn(xn,{variant:"primary",disabled:null!==Xn,onClick:()=>{Wn(et.data)},children:kt.done})]})]}),
43
- /* @__PURE__ */Pn(z,{}),
44
- /* @__PURE__ */Tn("div",{className:"sf-body",children:[Mt?/* @__PURE__ */Tn($n,{children:[
45
- /* @__PURE__ */Pn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":kt.leftPanel,children:ro?/* @__PURE__ */Pn(P,{blocks:Yl,blocksOnly:Jl,at:co?{label:(e=>{const n=fl(e.zone);if(n)return kt.add.addingTo({name:Wo.rowName?Ii(n,!0):Hr(n.type)});if(e.zone===le){const n=Mr[e.index];return n&&!mt(n)?kt.add.addingBefore({name:Ii(n,!0)}):kt.add.addingAtEnd}const t=gl(e.zone);return t?kt.add.addingTo({name:t.parentName}):kt.add.addingHere})(co),onClear:()=>ao(null)}:void 0,onAdd:e=>{const n=vo,t=(e,n)=>{co&&ao({zone:e,index:n})};if(n&&"block"!==e.kind&&fl(n.zone))return Ni(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===wo)return void bi(e);const n=bi(e,wo);co&&uo(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===wo)return void zi(e,n);const t=zi(e,n,wo);co&&uo(t+1)})(e.template.name,Er(e.template.node));if(n&&n.zone!==le){const o=gl(n.zone);if(!o)return;return o.target.spec?Qi(o.parentId,o.target.slot,e.type,n.index,o.parent.type):_i(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Dl?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Sl,siteWide:$o.addPanelRow?.(Oi),onClose:Oi,onHide:Nr,readOnly:Boolean(Jn)}):Gt&&Dt?
46
- /* @__PURE__ */Pn(A,{panel:Dt,pick:Gt,onHide:Nr}):_l?_l.panel({onHide:Nr,notify:fr}):"media"===Mo&&Dt?/* @__PURE__ */Pn(A,{panel:Dt,pick:null,onHide:Nr}):/* @__PURE__ */Tn($n,{children:[
47
- /* @__PURE__ */Pn(T,{icon:/* @__PURE__ */Pn(Ie,{}),title:kt.layers,context:Bt,actions:
48
- /* @__PURE__ */Pn(Fe,{label:dl?kt.expandAll:kt.collapseAll,title:0===sl.length?kt.nothingToFold:void 0,disabled:0===sl.length,onClick:()=>tr(e=>{const n=new Set(sl);return dl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...sl])}),children:/* @__PURE__ */Pn(Mn,{expand:dl})}),onHide:Nr}),
49
- /* @__PURE__ */Tn(be,{className:"sf-tree sf-scroll",words:St,children:[
50
- /* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:"page",size:13}),name:kt.pageSettings,onSelect:$r,selected:!ot&&yo,rowProps:{onClick:Pi($r)}}),rl&&/* @__PURE__ */Tn($n,{children:[
51
- /* @__PURE__ */Pn(ze,{children:kt.header}),Fl(rl)]}),!Ao&&Zn&&/* @__PURE__ */Tn($n,{children:[
52
- /* @__PURE__ */Pn(ze,{children:kt.header}),!gt&&/* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:"header",size:13}),name:kt.header,onSelect:Ar,selected:mo.kind===ft?.kind,rowProps:{onClick:Pi(Ar)}})]}),!Ao&&ol&&ts(ol,tl,"header"),!Ao&&!ql&&/* @__PURE__ */Pn(ze,{children:Zl}),ql?/* @__PURE__ */Tn($n,{children:[
53
- /* @__PURE__ */Pn(we,{words:St,icon:null,name:Zl,fold:{open:!es,label:Zl,onToggle:()=>cr(Ln)}}),!es&&/* @__PURE__ */Pn(xe,{children:ns})]}):ns,Zn&&/* @__PURE__ */Pn(ze,{children:kt.footer}),nl&&ts(nl,el,"footer"),!Ao&&!nl&&Zn&&/* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:"footer",size:13}),name:kt.footer,onSelect:Ti,rowProps:{onClick:Pi(Ti),title:kt.editFooter}}),il&&Fl(il),$o.treeFoot?.()]})]})}),
54
- /* @__PURE__ */Pn(Ve,{side:"left",width:or.left,min:We,max:He,defaultWidth:k.left,label:kt.resizeLeftPanel,onResize:lr})]}):/* @__PURE__ */Pn($,{side:"left",onShow:Nr}),
55
- /* @__PURE__ */Tn("div",{ref:hr,className:"sf-center sf-scroll","data-sf-canvas-head":Sr?"":void 0,style:{overflowX:Br?"auto":"hidden",overflowY:"hidden"},children:[Sr&&/* @__PURE__ */Pn("div",{ref:vr,className:"sf-canvas-head",children:/* @__PURE__ */Pn(Sr,{device:Ht})}),
56
- /* @__PURE__ */Pn("div",{className:"sf-frame-scaler",style:Cr,children:/* @__PURE__ */Pn("div",{className:"sf-frame "+(Ht===Ft?"":`sf-frame--${Ht}`),style:Or,children:/* @__PURE__ */Tn("div",{className:"sf-preview-host",children:[
57
- /* @__PURE__ */Pn(Ct,{},qt),
58
- /* @__PURE__ */Pn(Je,{canvas:to,session:Sl,model:Nl,measure:Pl,canDrop:$l,onDrop:Ml,choose:bl,onPick:Rl,onZoneAdd:e=>{const n=dn(e),t=Qr(n);t&&Zr(t.node,t.slot,!1),Ci(n,0)},zoneAddLabel:kt.canvasAddBlock,words:vt.canvas,readOnly:Boolean(Jn),revision:et.data}),fo.length>0&&/* @__PURE__ */Pn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:fo.map(e=>/* @__PURE__ */Tn("button",{type:"button",tabIndex:-1,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},onClick:()=>Bi(e.index),children:[
59
- /* @__PURE__ */Pn("span",{className:"sf-preview-gap-line"}),
60
- /* @__PURE__ */Tn("span",{className:"sf-preview-gap-pill",children:[
61
- /* @__PURE__ */Pn("span",{className:"sf-preview-gap-plus",children:"+"}),
62
- /* @__PURE__ */Pn("span",{className:"sf-preview-gap-label",children:kt.addSection})]})]},e.index))})]})})})]}),jt?/* @__PURE__ */Tn($n,{children:[
63
- /* @__PURE__ */Pn(g,{value:{selectChild:Ki,addChild:Qi,childRowName:ri,blockRowName:cl},children:/* @__PURE__ */Pn(Ot,{mode:mo,onOpenWebsiteSettings:$o.openSettings??(()=>{}),onOpenSiteStyles:$o.openStyles,onSelectNode:Xo,onNotify:fr,onHidePanel:Ir,nodeActions:ot?se(it,ot.type):En})}),
64
- /* @__PURE__ */Pn(Ve,{side:"right",width:or.right,min:We,max:He,defaultWidth:k.right,label:kt.resizeSettingsPanel,onResize:sr})]}):
65
- /* @__PURE__ */Pn($,{side:"right",onShow:Ir})]}),ui.menu]})}))}export{Fn as ScreenChrome};
@@ -1 +0,0 @@
1
- import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-M6F6LS3H.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-ZAOM6PFH.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-MCHMF32I.js";import{DEFAULT_TREE_WORDS as n}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-KFV7N2DJ.js";import{DEFAULT_NODE_MENU_WORDS as s}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as f}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as e}from"./chunk-Y2G7CU6A.js";import{DEFAULT_LOCK_WORDS as i}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as u}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as k}from"./chunk-JZDEIRH4.js";import{DEFAULT_FIELDS_WORDS as j}from"./chunk-FFYXVAAL.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{DEFAULT_CANVAS_WORDS as l}from"./chunk-AELNNAFM.js";var F={notice:e,lock:i,save:f,chrome:p,rail:u,tree:n,panel:c,fields:j,pick:r,drag:h,menu:s,styleClipboard:t,copy:k,canvas:l,textStyles:o,screen:m},a=o=>"object"==typeof o&&null!==o;function A(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:a(n)?t[m]=a(c)?A(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?A(o,r):o}export{F as DEFAULT_EASEL_STRINGS,y as mergeEaselStrings};
@@ -1,9 +0,0 @@
1
- import{DEFAULT_CANVAS_WORDS as e}from"./chunk-AELNNAFM.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as a,clickPick as i}from"./chunk-UK2FQOUT.js";import{useWords as s}from"./chunk-MFIRYGHW.js";import{find as d,ROOT_ID as l,getList as c,remove as u,parseZoneKey as p,move as f,duplicate as h,replaceNode as m,createNode as v,insert as g,normalizeData as y,createResolveCache as k,resolveNodeData as w,ROOT_SLOT as S}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as b,fieldsFrom as I,defaultsFrom as C}from"./chunk-NKB3KVAB.js";import{setCanvasNonce as E,isTypingTarget as O}from"./chunk-ZNCEOSXO.js";import{createContext as x,useEffect as A,useContext as D,useRef as z,useSyncExternalStore as M,useState as Z,useMemo as N,useCallback as j,useLayoutEffect as P}from"react";import{jsx as $,jsxs as L}from"react/jsx-runtime";import{createPortal as R}from"react-dom";function B(e){return!["setData","setUi","set"].includes(e.type)}var K=(e,t,n,o)=>{const r=c(e,t,p(n));return r?.[o]??null},F=(e,t,n,o,r)=>{const a=K(e,t,n,o);if(!a)throw new Error(`${r}: nothing at ${n}[${o}]`);return a};function V(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 H(e,t,n){return n?"node"===n.kind?d(e,t,n.id)?n:null:n.parentId===l?c(e,t,n)?n:null:d(e,t,n.parentId)&&c(e,t,n)?n:null:null}function T(e,t,n,r=!1){const{itemSelector:a,selectedSlot:i,...s}=n;let d=e.selection;var l;return"itemSelector"in n&&(d=o(e.data,t,a??null)),"selectedSlot"in n&&(i?d=(l=i)?{kind:"slot",parentId:l.parentId,slot:l.slot}:null:"slot"===d?.kind&&(d=null)),{...e,selection:d,ui:r?s:{...e.ui,...s}}}function U(e,t,n){const o=q(e,t,n);if(o===e)return e;const r=H(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function q(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 T(e,n,"function"==typeof t.ui?t.ui(V(e,n)):t.ui);case"set":{const r={data:o,ui:V(e,n)},a="function"==typeof t.state?t.state(r):t.state;let i=a.data?{...e,data:a.data}:e;return a.ui&&(i=T(i,n,a.ui,!0)),i}case"insert":{const r={...p(t.destinationZone),index:t.destinationIndex},a=v(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:g(o,n,r,a)}}case"replace":{const r=F(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:m(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=F(o,n,t.sourceZone,t.sourceIndex,"duplicate"),a=h(o,n,r.props.id),i=K(a,n,t.sourceZone,t.sourceIndex+1);return{...e,data:a,selection:i?{kind:"node",id:i.props.id}:e.selection}}case"reorder":return q(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=K(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const a={...p(t.destinationZone),index:t.destinationIndex};return{...e,data:f(o,n,r.props.id,a)}}case"remove":{const r=F(o,n,t.zone,t.index,"remove");return{...e,data:u(o,n,r.props.id)}}default:return e}}var Y={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},W={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},X=0,Q=()=>`history-${X+=1}`;function G(e){let t=e.config;const r=e.now??(()=>Date.now()),a=e.historyCoalesceMs??250;let i=e.permissions??{};const s=y(e.data,t);let l={data:s,selection:null,ui:{...W}};if(e.ui){const{itemSelector:n,selectedSlot:r,...a}=e.ui;l={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...W,...a}}}let u=[{core:l,at:-1/0,sealed:!0,id:Q()}],p=0;const f=e=>{const t=u[p],n=r();!e&&p===u.length-1&&p>0&&!t.sealed&&n-t.at<a?u=[...u.slice(0,p),{...t,core:l,at:n}]:(u=[...u.slice(0,p+1),{core:l,at:n,sealed:e,id:Q()}],p=u.length-1)},h=/* @__PURE__ */new Set;let v=null,g=null,S=0,b=null,I=!1;const C=()=>{for(const e of[...h])e()},E=()=>{u=[...u.slice(0,p),{...u[p],core:l},...u.slice(p+1)]},O=(t,n)=>{S>0?I=I||n:(n?f(!1):l!==t&&E(),l.data!==t.data&&e.onChange?.(l.data),l!==t&&C())},x=e=>{const n=l;if(l=U(l,e,t),l===n)return;const o=e.recordHistory??B(e);O(n,o&&l.data!==n.data)},A=t=>{0===S&&(b=l,I=!1),S+=1;try{t()}catch(e){throw S-=1,0===S&&b&&(l=b,b=null),e}if(S-=1,S>0||!b)return;const n=b;b=null,I&&l.data!==n.data?f(!0):l!==n&&E(),l.data!==n.data&&e.onChange?.(l.data),l!==n&&C()},D=e=>{const n=l,o=H(l.data,t,e);var r,a;(r=o,a=l.selection,r===a||r&&a&&r.kind===a.kind&&("node"===r.kind&&"node"===a.kind?r.id===a.id:"slot"===r.kind&&"slot"===a.kind&&r.parentId===a.parentId&&r.slot===a.slot))||(l={...l,selection:o},O(n,!1))},z=t=>{const n=l;p=t,l=u[p].core,l.data!==n.data&&e.onChange?.(l.data),l!==n&&C()},M=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...Y,...i,...n}};let Z=M();const N=k(),j={resolveCache:N,async resolveAll({trigger:e="load",metadata:n}={}){const o=l.data,r={type:"root",props:{...o.root.props??{}}},a=[...o.content,...Object.values(o.zones??{}).flat()],[i,...s]=await Promise.all([w(r,t,{cache:N,trigger:e,metadata:n}),...a.map(o=>w(o,t,{cache:N,trigger:e,metadata:n}))]);A(()=>{const e=l;let n=l.data;s.forEach((e,r)=>{if(!e.didChange)return;const i=a[r].props.id,s=d(n,t,i)?.node;s&&s===d(o,t,i)?.node&&(n=m(n,t,i,e.node))}),i.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:i.node.props,readOnly:i.node.readOnly??n.root.readOnly}}),n!==l.data&&(l={...l,data:n,selection:H(n,t,l.selection)},O(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=d(l.data,t,e)?.node;if(!r)return!1;const a=await w(r,t,{cache:N,trigger:n,metadata:o});if(!a.didChange)return!1;let i=!1;return A(()=>{const n=l;if(d(l.data,t,e)?.node!==r)return;const o=m(l.data,t,e,a.node);o!==l.data&&(l={...l,data:o,selection:H(o,t,l.selection)},O(n,!1),i=!0)}),i},get config(){return t},getState(){if(v&&g===l)return v;const e=l,o={data:e.data,ui:V(e,t)},r="node"===e.selection?.kind?d(e.data,t,e.selection.id)?.node??null:null;return v={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:x,history:{back:()=>j.undo(),forward:()=>j.redo(),hasPast:p>0,hasFuture:p<u.length-1,histories:u.map(e=>({id:e.id,state:{data:e.core.data,ui:V(e.core,t)}})),index:p,setHistoryIndex:e=>{e>=0&&e<u.length&&e!==p&&z(e)}},getPermissions:Z,getItemById:n=>d(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return c(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}},g=e,v},subscribe:e=>(h.add(e),()=>{h.delete(e)}),dispatch:x,batch:A,select:e=>D(e?{kind:"node",id:e}:null),selectSlot:e=>D(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){A(()=>{const n=l,o=void 0===e.select?l.selection:e.select;l={...l,data:e.data,selection:H(e.data,t,o)},O(n,e.data!==n.data)})},load(e,n={}){const o=l,r=y(e,t);l={...l,data:r,selection:H(r,t,n.selection??l.selection)},n.keepHistory||(u=[{core:l,at:-1/0,sealed:!0,id:Q()}],p=0),l!==o&&C()},undo(){p>0&&z(p-1)},redo(){p<u.length-1&&z(p+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,i)||(i=e,Z=M(),v=null,C())},setConfig(e){e!==t&&(t=e,Z=M(),v=null,C())}};return j}function J(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&&O(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 _=x(null),ee=x(!0);function te({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return A(()=>{n&&e.resolveAll()},[e,n]),A(()=>{if(t&&"undefined"!=typeof document)return J(document,e)},[e,t]),/* @__PURE__ */$(_.Provider,{value:e,children:/* @__PURE__ */$(ee.Provider,{value:t,children:o})})}function ne(){const e=D(_);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function oe(e){const t=ne(),n=z({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 a=e(o);return r.has&&Object.is(r.value,a)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:a,has:!0},a)};return M(t.subscribe,o,o)}function re(){return function(e){return oe(e)}}var ae="data-puck-component",ie="data-puck-dropzone",se={},de="data-es-mirror",le="undefined"==typeof window?A:P;function ce(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${de}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(de,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function ue({children:t,id:n="preview-frame",title:o,className:r,style:a,mirrorStyles:i=!0,onDocument:d,height:l="auto",nonce:c}){const u=s("canvas",e),p=z(null),[f,h]=Z(null);return le(()=>{const e=p.current,t=f?.ownerDocument.defaultView;if("auto"!==l||!e||!f||!t)return;const n=()=>{e.style.height=`${Math.ceil(f.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(f),()=>r?.disconnect()},[f,l]),le(()=>{let e=p.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=p.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"===l&&t.classList.add("es-frame-fill"),e.body.appendChild(t),E(e,c),h(t),d?.(e);let n=null;const o=p.current?.ownerDocument;if(i&&o){ce(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>ce(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),h(null),d?.(null)}},[]),/* @__PURE__ */$("iframe",{ref:p,id:n,title:o??u.frame,className:["es-canvas-frame","fill"===l?"is-fill":"",r??""].filter(Boolean).join(" "),style:a,children:f?R(t,f):null})}var pe=x(null),fe=x(se),he=[];function me({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128}){const a=ne(),i=oe(n=>c(n.appState.data,a.config,{parentId:e,slot:t})??he),s=oe(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==l),d=oe(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),u=D(pe),p=["es-zone"];return i.length&&p.push("has-children"),e===l&&p.push("is-root"),(s||d)&&p.push("is-area-selected"),null!==u&&u===e&&e!==l&&p.push("is-hovering-area"),n&&p.push(n),/* @__PURE__ */$("div",{className:p.join(" "),[ie]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`},children:i.map(e=>/* @__PURE__ */$(ye,{node:e},e.props.id))})}function ve(e,t,n,o){const r="root"===t?e.root:e.components[t],a={...o};for(const e of b(I(r)))a[e]=function(t={}){/* @__PURE__ */
2
- return $(me,{parentId:n,slot:e,...t})};return a}function ge(e){return function({zone:t,...n}){/* @__PURE__ */
3
- return $(me,{parentId:e,slot:t,...n})}}function ye({node:e}){const t=ne().config,n=t.components[e.type],o=e.props.id,r=function(e){const t=z(null);return N(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ae),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ae,e),n.setAttribute("data-puck-dnd",e),n.style.position="relative")},[e])}(o),a=D(fe);if(!n?.render)return null;const i=n.render,s=ve(t,e.type,o,{...C(n),...e.props}),d={renderDropZone:ge(o),isEditing:!0,dragRef:n.inline?r:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */$(i,{...s,puck:d,editMode:!0}):/* @__PURE__ */$("div",{[ae]:o,"data-puck-dnd":o,style:{position:"relative"},children:/* @__PURE__ */$(i,{...s,puck:d,editMode:!0})})}function ke({metadata:e}){const t=oe(e=>e.config),n=oe(e=>e.appState.data.root).props??{},o=t.root?.render,r=/* @__PURE__ */$(me,{parentId:l,slot:S}),a=o?/* @__PURE__ */$(o,{id:"puck-root",...ve(t,"root",l,n),puck:{renderDropZone:ge(l),isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:r}):r;/* @__PURE__ */
4
- return $(fe.Provider,{value:e??se,children:a})}function we({id:e,kind:t,overlay:n}){const o=z(null),[r,a]=Z(null);le(()=>{const t=o.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!e)return void a(null);let r=0;const i=()=>{r=0;const i=function(e,t){if(!e||!t)return null;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(t.querySelector(`[${ae}="${n.CSS?.escape?n.CSS.escape(e):e}"]`),o.current?.parentElement??null);a(e=>{return(t=e)===(n=i)||t&&n&&t.top===n.top&&t.left===n.left&&t.width===n.width&&t.height===n.height?e:i;var t,n})},s=()=>{r||(r=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(i))};i();const d="MutationObserver"in n?new n.MutationObserver(s):null;d?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const l="ResizeObserver"in n?new n.ResizeObserver(s):null;return l?.observe(t.documentElement),n.addEventListener("resize",s),()=>{d?.disconnect(),l?.disconnect(),n.removeEventListener("resize",s),r&&(n.cancelAnimationFrame??n.clearTimeout)(r)}},[e]);const i=/* @__PURE__ */$("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */$(n,{componentId:e,kind:t,children:i}):i}function Se({frame:e=!0,className:t,style:n,metadata:o,mirrorStyles:r,onDocument:s,height:d,title:l,nonce:c,hotkeys:u,frameWrapper:p,overlay:f,children:h}){const m=ne(),v=D(ee),g=u??v,[y,k]=Z(void 0),w=oe(e=>"node"===e.selection?.kind?e.selection.id:null),[S,b]=Z(null),I=e=>{const t=e.closest?.(`[${ae}]`)?.getAttribute(ae);if(!t)return;const n=m.getState(),o="node"===n.selection?.kind?n.selection.id:null;return i(n.appState.data,m.config,t,o)??t},C=/* @__PURE__ */L("div",{className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;t.closest?.("a[href]")&&e.preventDefault();const n=I(t);void 0===n?t.hasAttribute?.(ie)||m.select(null):m.select(n)},onMouseOver:e=>{const t=I(e.target)??null;t!==S&&b(t)},onMouseLeave:()=>b(null),children:[
5
- /* @__PURE__ */$(pe.Provider,{value:S,children:/* @__PURE__ */$(ke,{metadata:o})}),
6
- /* @__PURE__ */L("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
7
- /* @__PURE__ */$(we,{id:S&&S!==w?S:null,kind:"hover",overlay:f}),
8
- /* @__PURE__ */$(we,{id:w,kind:"selected",overlay:f})]}),h]}),E=p?/* @__PURE__ */$(p,{document:y,children:C}):C;A(()=>{if(y&&g)return J(y,m)},[y,g,m]),A(()=>{if(!y)return;const e=e=>{if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=m.getState();if("node"!==n.selection?.kind)return;const o=a(n.appState.data,m.config,n.selection);"node"===o?.kind&&m.select(o.id)};return y.addEventListener("keydown",e),()=>y.removeEventListener("keydown",e)},[y,m]);/* @__PURE__ */
9
- return $("div",{className:"es-canvas"+(t?` ${t}`:""),style:n,"data-puck-preview":"",children:e?/* @__PURE__ */$(ue,{mirrorStyles:r,onDocument:e=>{k(e??void 0),s?.(e)},height:d,title:l,nonce:c,children:E}):/* @__PURE__ */$("div",{id:"preview-frame","data-puck-entry":"",children:E})})}function be(e={}){const t=ne(),n=oe(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ie(){const e=ne(),n=oe(e=>e.config),o=e.resolveCache,r=oe(e=>e.selectedItem),a=oe(e=>e.appState.data.root),i=r?r.props.id:"root",s=a.props??{},l=N(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,u=e.getState(),p=r?d(u.appState.data,n,i):null,f=p&&"root"!==p.place.parentId?p.place.parentId:null,h=f?u.getItemById(f)??null:null,{fields:m}=t({id:i,node:l,block:c,parent:h,appState:u.appState}),v=oe(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=j((t,r)=>{(async()=>{const a=e.getState();if("root"!==i){const s=a.getItemById(i),d=a.getSelectorForId(i);if(!s||!d)return;const l={...s,props:{...s.props,[t]:r}},{node:c}=await w(l,n,{cache:o,trigger:"replace"}),u=e.getState().getSelectorForId(i);if(!u)return;return void e.dispatch({type:"replace",destinationZone:u.zone??"root:default-zone",destinationIndex:u.index,data:c})}const s=a.appState.data.root.props??{},{node:d}=await w({type:"root",props:{...s,[t]:r}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:d.props,readOnly:d.readOnly},recordHistory:!0})})()},[e,n,o,i]);return{id:i,node:l,fields:m,values:l.props,readOnly:v,onChange:g}}export{ue as CanvasFrame,W as DEFAULT_UI,Se as EaselCanvas,te as EaselProvider,ke as EditDocument,J as bindUndoKeys,G as createEasel,re as createUseEasel,B as recordsByDefault,U as reduce,V as uiView,oe as useEasel,ne as useEaselApi,be as useEaselNodeOps,Ie as useSelectedFields,H as validSelection};
@@ -1,5 +0,0 @@
1
- import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-3FZAGTQE.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{AddPanel as f}from"./chunk-KEHLCWTG.js";import{DEFAULT_DRAG_WORDS as u}from"./chunk-O2NLQBFX.js";import{useEasel as k}from"./chunk-FUOZKV7A.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as O,Fragment as B}from"react/jsx-runtime";var F=e=>`section:${e}`,v=e=>`block:${e}`,I=e=>`template:${e}`;function N({blocks:N,blocksOnly:V,at:x,onAdd:A,itemFor:H,session:L,siteWide:C,onClose:T,onHide:P,readOnly:Q}){const Z=k(e=>e.config),w=p(),{labelAtLevel:D,categoryLabel:E,firstSection:G,Icon:K,Thumbnail:M}=w,{blockIsOffered:R}=m(),W=h("screen",d).add,z=h("drag",u).add,S=l(),[Y,J]=y([]);b(()=>{let t=!1;const o=e=>R(e,S);return s(S).list().then(n=>{if(t)return;const i=Z.components;J(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[Z,S]);const U=j(()=>t(Z,w),[Z]),X=e=>({type:F(e.type),label:e.name,cover:/* @__PURE__ */$(M,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:W.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=j(()=>{const e=[];if(N&&N.choices.length>0&&a(N.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${W.inside({name:N.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */$(K,{type:e.type,size:18}),title:W.tile({name:e.label})}))})}),V)return e;const t=o(U,G);t&&e.push({key:"start",title:W.startBlank,tiles:[X(t)]}),Y.length>0&&e.push({key:"templates",title:W.templates,tiles:Y.map(e=>{return{type:I(e.id),label:e.name,cover:/* @__PURE__ */$(M,{type:e.node.type}),keywords:[(t=e.node.type,D(t,"section",Z.components[t]?.label??t)),e.node.type]};var t})});const s=n(U,G);for(const t of Object.keys(Z.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(Z,t,E),tiles:o.map(X)})}return e},[N,V,Y,U,Z,W]),_=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=Y.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
2
- return O(B,{children:[
3
- /* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:W.title,context:V?W.contextBlocks:W.contextAll,actions:/* @__PURE__ */$(c,{label:W.done,description:W.doneDescription,onClick:T}),onHide:P}),
4
- /* @__PURE__ */O("div",{className:"sf-addside sf-scroll",children:[
5
- /* @__PURE__ */$(f,{groups:q,session:L,itemFor:e=>H(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&A(t)},at:x,hint:V?W.hintBlocks:W.hint,searchLabel:V?W.searchBlocks:W.searchSections,readOnly:Q,words:z}),C&&!V?C:null]})]})}export{N as AddSidePanel,v as blockKey,F as sectionKey,I as templateKey};