efficient-easel 23.2.0 → 24.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 (82) hide show
  1. package/README.md +10 -0
  2. package/dist/{ScreenDocumentContext-BDLUYzlM.d.ts → ScreenDocumentContext-DPW_6gOC.d.ts} +16 -1
  3. package/dist/{chunk-UNVKPVZW.js → chunk-3FIS2FRS.js} +1 -1
  4. package/dist/{chunk-VNDPFDO5.js → chunk-4ESG53BH.js} +1 -1
  5. package/dist/chunk-5NHQ452C.js +1 -0
  6. package/dist/{chunk-MYAJ7MGI.js → chunk-75C6WFNF.js} +1 -1
  7. package/dist/chunk-7RSE6KKY.js +1 -0
  8. package/dist/chunk-AAAZ2CQR.js +1 -0
  9. package/dist/{chunk-QWLWSIDH.js → chunk-CE5SGCN2.js} +4 -4
  10. package/dist/chunk-CMPFUJ26.js +8 -0
  11. package/dist/chunk-CZAAGBVL.js +7 -0
  12. package/dist/chunk-FJTCSQWK.js +16 -0
  13. package/dist/{chunk-CMBJHSHY.js → chunk-FRAIEWRC.js} +1 -1
  14. package/dist/{chunk-4RRIYPAV.js → chunk-G67G63O5.js} +1 -1
  15. package/dist/{chunk-6QSFJCJT.js → chunk-H4Z2V56N.js} +16 -16
  16. package/dist/{chunk-77IWWW6X.js → chunk-ISS72IKO.js} +1 -1
  17. package/dist/chunk-K7MMLCTT.js +2 -0
  18. package/dist/chunk-LX23TCTP.js +2 -0
  19. package/dist/{chunk-ZOPYJQFS.js → chunk-MRWVYSU5.js} +43 -43
  20. package/dist/{chunk-FHCKFOCD.js → chunk-NCXYC7WI.js} +2 -2
  21. package/dist/{chunk-BIK3AO2V.js → chunk-NQW6XCAY.js} +1 -1
  22. package/dist/{chunk-RMQDKVGW.js → chunk-OITNWE52.js} +1 -1
  23. package/dist/chunk-QORC32JO.js +5 -0
  24. package/dist/{chunk-2G6MAXPY.js → chunk-T2RINM7R.js} +1 -1
  25. package/dist/chunk-TOHOGVAE.js +15 -0
  26. package/dist/copy/index.js +10 -10
  27. package/dist/draw/index.js +1 -1
  28. package/dist/easel/index.d.ts +20 -1
  29. package/dist/easel/index.js +1 -1
  30. package/dist/fields/index.js +1 -1
  31. package/dist/panel/index.js +1 -15
  32. package/dist/panel/panel.css +8 -0
  33. package/dist/screen/components/AddBlockRow.js +1 -1
  34. package/dist/screen/components/AddSidePanel.js +1 -1
  35. package/dist/screen/components/MediaPopup.js +1 -1
  36. package/dist/screen/components/NodeContextMenu.d.ts +1 -1
  37. package/dist/screen/components/NodeContextMenu.js +1 -1
  38. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  39. package/dist/screen/components/SaveControls.d.ts +1 -1
  40. package/dist/screen/components/ScreenChrome.js +1 -1
  41. package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
  42. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  43. package/dist/screen/components/ScreenMount.d.ts +1 -1
  44. package/dist/screen/components/ScreenMount.js +1 -1
  45. package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
  46. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  47. package/dist/screen/components/SectionScreenShell.js +17 -17
  48. package/dist/screen/components/usePartBridge.d.ts +1 -1
  49. package/dist/screen/components/usePartBridge.js +1 -1
  50. package/dist/screen/index.d.ts +1 -1
  51. package/dist/screen/index.js +1 -1
  52. package/dist/screen/lib/admin-bridge.js +1 -1
  53. package/dist/screen/lib/document/box-fields.d.ts +389 -0
  54. package/dist/screen/lib/document/box-fields.js +9 -0
  55. package/dist/screen/lib/document/slot-child-name.js +1 -1
  56. package/dist/screen/lib/document/style-clipboard.d.ts +1 -1
  57. package/dist/screen/lib/document/style-clipboard.js +1 -1
  58. package/dist/screen/lib/document/use-section-ops.js +1 -1
  59. package/dist/screen/lib/document-addressing.d.ts +1 -1
  60. package/dist/screen/lib/host-inbound.js +1 -1
  61. package/dist/screen/lib/host.d.ts +1 -1
  62. package/dist/screen/lib/host.js +1 -1
  63. package/dist/screen/lib/key-scope.js +1 -1
  64. package/dist/screen/lib/media-panel.d.ts +1 -1
  65. package/dist/screen/lib/media-panel.js +1 -1
  66. package/dist/screen/lib/media-picker.d.ts +1 -1
  67. package/dist/screen/lib/media-picker.js +1 -1
  68. package/dist/screen/lib/screen-parts.d.ts +1 -1
  69. package/dist/screen/lib/screen-parts.js +1 -1
  70. package/dist/screen/screen.css +32 -0
  71. package/dist/strings/index.js +1 -1
  72. package/dist/text-styles/index.js +21 -21
  73. package/package.json +9 -3
  74. package/dist/chunk-33P4J2SF.js +0 -1
  75. package/dist/chunk-A6ZP5II4.js +0 -2
  76. package/dist/chunk-C57RLYDQ.js +0 -8
  77. package/dist/chunk-DCBSRZ6Z.js +0 -5
  78. package/dist/chunk-FEF3OQRT.js +0 -16
  79. package/dist/chunk-J5OSNZPU.js +0 -1
  80. package/dist/chunk-MQA7OFRA.js +0 -2
  81. package/dist/chunk-S3DUFDQ6.js +0 -6
  82. package/dist/chunk-SSRYU3YG.js +0 -1
@@ -1,64 +1,64 @@
1
- import{cloneNodeWithFreshIds as e}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as n}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as t}from"./chunk-DSKNJXB4.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-UMBNBCL4.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-DDH2DYQP.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-MYAJ7MGI.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as f,clampPanelWidth as m}from"./chunk-Y53EKN35.js";import{usePartBridge as g}from"./chunk-33P4J2SF.js";import{useSectionOps as y}from"./chunk-RMQDKVGW.js";import{ScreenSaveIcon as v,ScreenMainButton as b}from"./chunk-55KKGABA.js";import{useBrowserOffline as k}from"./chunk-RKTF5XLP.js";import{AddChildRow as S}from"./chunk-5545A3PC.js";import{AddSidePanel as w}from"./chunk-C57RLYDQ.js";import{keepsSharedSections as x,sharedSectionsOf as z}from"./chunk-N3MJOHAG.js";import{PanelHideButton as C,SidePanelHead as O,PanelShowStrip as N}from"./chunk-5PXVT7JY.js";import{offeredChoices as I}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as P,useScreenPinned as $,useScreenDocumentLabel as M,useScreenCanvasFrame as j,useScreenInspectorPanel as A,useScreenDevices as T,useScreenPickFollowsSelection as L,useScreenLeftView as E,SELECTION_MODE as R,isSelectionMode as F,sameInspectorMode as D,useScreenBridges as H,useScreenBlockRules as Y,useScreenBlockLook as V,useScreenStorageNamespace as W,useScreenNotify as U,useScreenCanvasHead as J,isSlotMode as G,useScreenStyleClipboard as X,useScreenDocumentPass as K,useScreenCanvasDrag as Q,ScreenCanvasTargetProvider as Z,isPinnedFirst as _,isPinnedLast as q,screenSlotsOf as ee,shownChildSlotsOf as ne}from"./chunk-DCBSRZ6Z.js";import{MediaPopup as te}from"./chunk-2G6MAXPY.js";import{useNodeClipboard as oe,useNodeContextMenu as re}from"./chunk-J5OSNZPU.js";import{heldStyle as ie,styleShortcut as le}from"./chunk-V7U33NF2.js";import{PageEditGuardNotices as se}from"./chunk-CMBJHSHY.js";import{useScreenDocument as de}from"./chunk-A6ZP5II4.js";import{requestMediaPick as ae}from"./chunk-UNVKPVZW.js";import{useMediaPanel as ce,usePanelPick as pe,useMediaBrowsing as ue,useOpenMediaBrowse as he,useMediaPlace as fe}from"./chunk-FHCKFOCD.js";import{useEaselSession as me}from"./chunk-YM4UEGBV.js";import{useEaselHost as ge,useHostEscape as ye}from"./chunk-MQA7OFRA.js";import{LayersIcon as ve,MediaIcon as be}from"./chunk-XFYFKITX.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ke}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as Se}from"./chunk-WK3AFPXY.js";import{DEFAULT_SCREEN_WORDS as we}from"./chunk-IYHO4XQX.js";import{rootRowName as xe,slotChildRowName as ze,slotChildRenameProp as Ce,sectionRenameProp as Oe}from"./chunk-SSRYU3YG.js";import{ROOT_ZONE as Ne,blockNodeActions as Ie,TREE_MAX_DEPTH as Be,childSlotsOf as Pe,slotFieldsOf as $e,newNodeId as Me,slotChildrenIn as je,nestsInTree as Ae}from"./chunk-TCAAOYQY.js";import{useEasel as Te,useEaselApi as Le,CanvasPartsContext as Ee,partHasOwnBox as Re,CanvasPassThroughContext as Fe,CanvasSharedContext as De}from"./chunk-FEF3OQRT.js";import{toItemSelector as He,useNodeOps as Ye,clickPick as Ve}from"./chunk-RPMSET77.js";import{TreeRow as We,Subtree as Ue,LayersTree as Je,TreeGroupLabel as Ge,TreeRowAction as Xe,TreeSeam as Ke}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Qe}from"./chunk-K56YDHYQ.js";import{EaselTopBar as Ze,EaselIconButton as _e,TopBarCluster as qe,DeviceSwitch as en,InspectorIconButton as nn,PanelResizeHandle as tn,MAX_PANEL_W as on,MIN_PANEL_W_BY_SIDE as rn,panelWidthVars as ln}from"./chunk-WYTPBF3Q.js";import{DEFAULT_NOTICE_WORDS as sn,DEFAULT_CHROME_WORDS as dn}from"./chunk-AJSDWWJW.js";import{holderOf as an,nameOrSomeone as cn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as pn}from"./chunk-RE4LP46F.js";import{useWords as un}from"./chunk-MFIRYGHW.js";import{insertSeams as hn,CanvasDragLayer as fn,CanvasInsert as mn}from"./chunk-LN43DP2A.js";import{DEFAULT_DRAG_WORDS as gn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as yn,useTreeDrag as vn,gapToMoveIndex as bn}from"./chunk-6NJHYXJM.js";import{useCanvasFrame as kn,LIST_SELECTOR as Sn,BLOCK_SELECTOR as wn,useCanvasTyping as xn,useCanvasEvent as zn,nodeIdAt as Cn,frameRectToHost as On,BLOCK_ATTRIBUTE as Nn,drawnBox as In}from"./chunk-YU3WHLGI.js";import{queryMainCopy as Bn}from"./chunk-LF3FUSCQ.js";import{ROOT_ID as Pn,ROOT_SLOT as $n,zoneKey as Mn,parseZoneKey as jn,find as An,DataError as Tn}from"./chunk-TGZCD6IP.js";import{useRef as Ln,useMemo as En,useState as Rn,useEffect as Fn,useCallback as Dn,useLayoutEffect as Hn,useContext as Yn,Fragment as Vn,useId as Wn}from"react";import{ColoredBadge as Un,Button as Jn,Tabs as Gn,toast as Xn,readMediaFileDrag as Kn,Tooltip as Qn,groupColors as Zn,Dialog as _n,FormField as qn,Input as et,MEDIA_FILE_DRAG_TYPE as nt}from"efficient-shell/ui";import{UndoIcon as tt,RedoIcon as ot,RefreshIcon as rt,AddIcon as it,TrashIcon as lt,EyeOffIcon as st,EyeIcon as dt,SharedIcon as at,DuplicateIcon as ct}from"efficient-shell/icons/efficient";import{jsx as pt,jsxs as ut,Fragment as ht}from"react/jsx-runtime";var ft="media-file";function mt({name:e,onMake:n,onCancel:t}){const o=un("screen",we).shared,[r,i]=Rn(e),[l,s]=Rn(!1),d=Wn(),a=Ln(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
- return pt(_n,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ut(ht,{children:[
1
+ import{cloneNodeWithFreshIds as e}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as n}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as t}from"./chunk-DSKNJXB4.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-UMBNBCL4.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-DDH2DYQP.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-75C6WFNF.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as f,clampPanelWidth as m}from"./chunk-Y53EKN35.js";import{usePartBridge as g}from"./chunk-7RSE6KKY.js";import{useSectionOps as y}from"./chunk-OITNWE52.js";import{ScreenSaveIcon as v,ScreenMainButton as b}from"./chunk-55KKGABA.js";import{useBrowserOffline as k}from"./chunk-RKTF5XLP.js";import{AddChildRow as S}from"./chunk-5545A3PC.js";import{AddSidePanel as w}from"./chunk-CMPFUJ26.js";import{keepsSharedSections as x,sharedSectionsOf as z}from"./chunk-N3MJOHAG.js";import{PanelHideButton as C,SidePanelHead as N,PanelShowStrip as O}from"./chunk-5PXVT7JY.js";import{offeredChoices as I}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as P,useScreenPinned as $,useScreenDocumentLabel as T,useScreenCanvasFrame as M,useScreenInspectorPanel as j,useScreenDevices as A,useScreenPickFollowsSelection as L,useScreenLeftView as E,SELECTION_MODE as R,isSelectionMode as F,sameInspectorMode as D,useScreenBridges as W,useScreenBlockRules as H,useScreenBlockLook as V,useScreenStorageNamespace as Y,useScreenNotify as U,useScreenCanvasHead as J,isSlotMode as X,useScreenStyleClipboard as K,useScreenDocumentPass as Q,useScreenCanvasDrag as G,ScreenCanvasTargetProvider as _,isPinnedFirst as Z,isPinnedLast as q,screenSlotsOf as ee,shownChildSlotsOf as ne}from"./chunk-QORC32JO.js";import{MediaPopup as te}from"./chunk-T2RINM7R.js";import{useNodeClipboard as oe,useNodeContextMenu as re}from"./chunk-AAAZ2CQR.js";import{PageEditGuardNotices as ie}from"./chunk-FRAIEWRC.js";import{useScreenDocument as le}from"./chunk-K7MMLCTT.js";import{requestMediaPick as se}from"./chunk-3FIS2FRS.js";import{useMediaPanel as de,usePanelPick as ae,useMediaBrowsing as ce,useOpenMediaBrowse as pe,useMediaPlace as ue}from"./chunk-NCXYC7WI.js";import{useEaselSession as he}from"./chunk-YM4UEGBV.js";import{useEaselHost as fe,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{heldStyle as ve,styleShortcut as be}from"./chunk-V7U33NF2.js";import{DEFAULT_SCREEN_WORDS as ke}from"./chunk-IYHO4XQX.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{rootRowName as we,slotChildRowName as xe,slotChildRenameProp as ze,sectionRenameProp as Ce}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Ne,blockNodeActions as Oe,TREE_MAX_DEPTH as Ie,childSlotsOf as Be,slotFieldsOf as Pe,newNodeId as $e,slotChildrenIn as Te,nestsInTree as Me}from"./chunk-TCAAOYQY.js";import{useEasel as je,useEaselApi as Ae,CanvasPartsContext as Le,partHasOwnBox as Ee,CanvasPassThroughContext as Re,CanvasSharedContext as Fe}from"./chunk-FJTCSQWK.js";import{TreeRow as De,Subtree as We,LayersTree as He,TreeGroupLabel as Ve,TreeRowAction as Ye,TreeSeam as Ue}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Je}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Xe}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ke,useNodeOps as Qe,clickPick as Ge}from"./chunk-RPMSET77.js";import{EaselTopBar as _e,EaselIconButton as Ze,TopBarCluster as qe,DeviceSwitch as en,InspectorIconButton as nn,PanelResizeHandle as tn,MAX_PANEL_W as on,MIN_PANEL_W_BY_SIDE as rn,panelWidthVars as ln}from"./chunk-WYTPBF3Q.js";import{DEFAULT_NOTICE_WORDS as sn,DEFAULT_CHROME_WORDS as dn}from"./chunk-AJSDWWJW.js";import{holderOf as an,nameOrSomeone as cn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as pn}from"./chunk-RE4LP46F.js";import{useWords as un}from"./chunk-MFIRYGHW.js";import{insertSeams as hn,CanvasDragLayer as fn,CanvasInsert as mn}from"./chunk-LN43DP2A.js";import{DEFAULT_DRAG_WORDS as gn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as yn,useTreeDrag as vn,gapToMoveIndex as bn}from"./chunk-6NJHYXJM.js";import{useCanvasFrame as kn,LIST_SELECTOR as Sn,BLOCK_SELECTOR as wn,useCanvasTyping as xn,useCanvasEvent as zn,nodeIdAt as Cn,frameRectToHost as Nn,BLOCK_ATTRIBUTE as On,drawnBox as In}from"./chunk-YU3WHLGI.js";import{queryMainCopy as Bn}from"./chunk-LF3FUSCQ.js";import{ROOT_ID as Pn,ROOT_SLOT as $n,zoneKey as Tn,parseZoneKey as Mn,find as jn,DataError as An}from"./chunk-TGZCD6IP.js";import{useRef as Ln,useMemo as En,useState as Rn,useEffect as Fn,useCallback as Dn,useLayoutEffect as Wn,useContext as Hn,Fragment as Vn,useId as Yn}from"react";import{ColoredBadge as Un,Button as Jn,Tabs as Xn,toast as Kn,readMediaFileDrag as Qn,Tooltip as Gn,groupColors as _n,Dialog as Zn,FormField as qn,Input as et,MEDIA_FILE_DRAG_TYPE as nt}from"efficient-shell/ui";import{UndoIcon as tt,RedoIcon as ot,RefreshIcon as rt,AddIcon as it,TrashIcon as lt,EyeOffIcon as st,EyeIcon as dt,SharedIcon as at,DuplicateIcon as ct}from"efficient-shell/icons/efficient";import{jsx as pt,jsxs as ut,Fragment as ht}from"react/jsx-runtime";var ft="media-file";function mt({name:e,onMake:n,onCancel:t}){const o=un("screen",ke).shared,[r,i]=Rn(e),[l,s]=Rn(!1),d=Yn(),a=Ln(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
+ return pt(Zn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ut(ht,{children:[
3
3
  /* @__PURE__ */pt(Jn,{variant:"secondary",onClick:t,children:o.cancel}),
4
- /* @__PURE__ */pt(Jn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */pt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */pt(qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */pt(et,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var gt=/* @__PURE__ */new WeakSet;function yt(e,n,t){const o=An(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function vt({canvas:e,tabs:n,onSelect:t}){const o=Ln(null),[r,i]=Rn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Hn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=On(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Bn(t,`[${Nn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?In(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=On(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */pt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */pt("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
- /* @__PURE__ */pt(Qn,{content:e.reach,children:/* @__PURE__ */ut(Un,{colorClass:Zn("success","solid"),size:"sm",children:[
6
- /* @__PURE__ */pt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */pt(at,{size:12})}),e.label]})}):/* @__PURE__ */pt(Un,{colorClass:Zn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function bt({expand:e}){/* @__PURE__ */
4
+ /* @__PURE__ */pt(Jn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */pt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */pt(qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */pt(et,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var gt=/* @__PURE__ */new WeakSet;function yt(e,n,t){const o=jn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function vt({canvas:e,tabs:n,onSelect:t}){const o=Ln(null),[r,i]=Rn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Wn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=Nn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Bn(t,`[${On}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?In(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=Nn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */pt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */pt("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
+ /* @__PURE__ */pt(Gn,{content:e.reach,children:/* @__PURE__ */ut(Un,{colorClass:_n("success","solid"),size:"sm",children:[
6
+ /* @__PURE__ */pt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */pt(at,{size:12})}),e.label]})}):/* @__PURE__ */pt(Un,{colorClass:_n("info","solid"),size:"sm",children:e.label})},e.id):null})})}function bt({expand:e}){/* @__PURE__ */
7
7
  return pt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ut(ht,e?{children:[
8
8
  /* @__PURE__ */pt("path",{d:"M8 9l4-4 4 4"}),
9
9
  /* @__PURE__ */pt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
10
  /* @__PURE__ */pt("path",{d:"M8 4l4 4 4-4"}),
11
11
  /* @__PURE__ */pt("path",{d:"M8 20l4-4 4 4"}),
12
- /* @__PURE__ */pt("path",{d:"M5 12h14"})]})})}var kt=`${Sn}, ${wn}`;function St(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var wt="__rungs";var xt="screen:band",zt={duplicate:!0,delete:!0},Ct=()=>null;function Ot(){const Sn=ge(),On=Sn.panels?.Toolbar,Nn=(Sn.panels?.useRight??Ct)(),{target:In,docId:Wn,capabilities:Qn,currentSlug:Zn,siteId:_n,onPublish:qn,saveState:et,saveConflict:at,retrySave:Ot,toggleAutoSave:Nt,flushSave:It,access:Bt,saveUnreachable:Pt=!1,readOnly:$t,readOnlyReason:Mt=null}=de(),jt=B(),At=P(),{mediaEditing:Tt,hasEditGuard:Lt,hasPinnedChrome:Et}=Qn,{appState:Rt,dispatch:Ft,history:Dt,selectedItem:Ht,getSelectorForId:Yt,config:Vt}=Te(e=>e),Wt=$(),{first:Ut,firstGroup:Jt,lastGroup:Gt,isSectionGroup:Xt,sectionGroupZone:Kt,panelOf:Qt}=Wt,Zt=Qt(Ut),_t=e=>_(Wt,e),qt=e=>q(Wt,e),eo="node"===Wt.firstRow,no=Wt.band??null,to=un("screen",we),oo=un("tree",Qe),ro=un("drag",gn),io=un("notice",sn),lo=un("lock",pn),so=un("menu",Se),ao=un("styleClipboard",ke),co=un("chrome",dn),po=M()??`/${Zn}`,uo=j(),ho=A(),fo=y({readOnly:$t}),mo=y({readOnly:$t,foldIntoHistory:!0}),go=Ln(null),yo=Le(),vo=En(()=>({...fo,select:e=>{go.current=e,fo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=yo.config;go.current=He(e,t,n)}fo.commitDocument(e,n)}}),[fo,yo]),bo=Rt.ui,ko=bo.leftSideBarVisible,So=bo.rightSideBarVisible,{options:wo,widths:xo,initial:zo,fluid:Co,fit:Oo}=T(),[No,Io]=Rn(zo),Bo=ce(),Po=Tt&&null!==Bo;pe(),ue();const $o=he();L(Ht?.props.id);const{read:Mo,write:jo,forSelection:Ao}=E(),[To,Lo]=Rn(Mo);Fn(()=>{jo(To)},[To]);const[Eo,Ro]=Rn(0),Fo=Ln(null),Do=Ln(null),Ho=kn(Do,{readySelector:kt}),Yo=xn(Ho),Vo=d(Do);a(Do,Ho);const Wo=k(),Uo=an(Bt),Jo={state:et,offline:Wo||et.failed&&Pt,readOnlyReason:Mt,editing:Uo?io.editing({name:cn(Uo.name,lo),noun:to.noun}):null,conflict:null!=at,notSaving:to.bar.notSaving},Go=()=>{$t||(et.failed?Ot():It())};c(Do,Ho,Go);const[Xo,Ko]=Rn(!1),Qo=Ln(!1),[Zo,_o]=Rn(null),[qo,er]=Rn([]),[nr,tr]=Rn(R);F(nr);const or=o(nr,Ht?.props.id),[rr,ir]=Rn(null);Fn(()=>{rr&&(r(),ir(null))},[rr]);const lr=Ln(Yt);lr.current=Yt;const sr=Dn((e,{scroll:n})=>{Lo(n=>Ao(e,n)),n&&ir(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=lr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Lr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),dr=Ln(null);Fn(()=>{const e=dr.current;dr.current=null;const n=null==Ht?.props.id?null:String(Ht.props.id);tr(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Qt(Ht?.type)??R);const t=Ht?.props.id,o=go.current;if(go.current=null,!t)return;const r=Yt(t);sr(String(t),{scroll:!i(o,r??null,Ne)})},[Ht?.props.id,sr]);const ar=Dn(e=>{tr(n=>D(n,e)?n:e),Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ft]),cr=Ln(()=>{});cr.current=(e,n)=>{const t=e?$i(e.zone??Ne)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Ht?.props.id?null:String(Ht.props.id);tr(e=>D(e,n)?e:n),o!==r&&(dr.current={id:o,mode:n},vo.select(e))};const pr=Dn((e,n)=>cr.current(e,n),[]),ur={kind:nr.kind,mode:nr,open:ar,show:e=>tr(e),reveal:()=>{So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},select:pr},hr=H(ur,{data:Rt.data,selected:Ht??null,zoneOf:e=>Yt(e)?.zone,readOnly:Boolean($t),select:e=>{tr(R),vo.select({index:e})},replace:(e,n)=>vo.replaceComponent(Ne,e,n),scrollTo:e=>l(e)},{device:No,refreshes:Eo},{setView:Lo,reveal:()=>{ko||Ft({type:"setUi",ui:{leftSideBarVisible:!0}})}}),fr=hr.resolveLeftView?hr.resolveLeftView(To):"sections",mr=Y(),{isLockedBlock:gr,duplicateBlocked:yr,nestDepth:vr,newSectionNode:br,canAddTo:kr,blockIsOffered:Sr}=mr,wr=V(),{labelAtLevel:xr,Icon:zr,useProducts:Cr}=wr,Or=wr.rowName?(e,n,t)=>wr.rowName(e,n,t):void 0,Nr=Dn(e=>{Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),sr(e,{scroll:!0})},[Ft,sr]),{selectNode:Ir,openPartId:Br}=g({mode:nr,setMode:tr,onOpenPart:Nr}),[Pr,$r]=Rn(null);ye(null!==Pr,()=>$r(null));const Mr=h(W()),jr=Mr.collapsed,Ar=Mr.panelWidths,[Tr,Lr]=Rn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(jr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
- return new Set}});Fn(()=>{try{window.localStorage.setItem(jr,JSON.stringify([...Tr]))}catch{}},[Tr]);const[Er,Rr]=Rn(()=>{if("undefined"==typeof window)return{...f};try{const e=window.localStorage.getItem(Ar);if(!e)return{...f};const n=JSON.parse(e);return{left:m(Number(n.left)||f.left,"left"),right:m(Number(n.right)||f.right,"right")}}catch{return{...f}}});Fn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Ar,JSON.stringify(Er))}catch{}},300);return()=>clearTimeout(e)},[Er]);const Fr=Dn((e,n)=>Rr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Dr=Dn(e=>Fr("left",e),[Fr]),Hr=Dn(e=>Fr("right",e),[Fr]),Yr=e=>Tr.has(e),Vr=e=>Lr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Wr=Ln(!1),Ur=Ln(null);Fn(()=>{if(Wr.current&&!Xo){const e=Ur.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Do.current?.querySelector(`button[aria-label="${CSS.escape(to.add.title)}"]`))?.focus(),Ur.current=null}Wr.current=Xo},[Xo]),Fn(()=>{if(!Xo||!Vo)return;const e=e=>{"Escape"===e.key&&al()};return Vo.addEventListener("keydown",e),()=>Vo.removeEventListener("keydown",e)},[Xo,Vo]),ye(Xo,()=>al()),Fn(()=>{!ko&&Xo&&(Ko(!1),_o(null),Qo.current=!1)},[ko]);const Jr=U(),Gr=(e,n="success",t)=>{if(Jr)return void(t?Jr(e,"error"===n?"error":"info",t):Jr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Xn.error(e,{...o,duration:t?.duration??3200}):Xn.success(e,{...o,duration:t?.duration??1900})},Xr=Ln(null),[Kr,Qr]=Rn(0),[Zr,_r]=Rn(0),qr=J(),ei=Ln(null),ni=e=>Math.max(0,e.clientHeight-(ei.current?.offsetHeight??0));Fn(()=>{const e=Xr.current;if(!e)return;const n=()=>{Qr(e.clientWidth),_r(ni(e))};n();const t=new ResizeObserver(n);return t.observe(e),ei.current&&t.observe(ei.current),()=>t.disconnect()},[]),Hn(()=>{Xr.current&&(Qr(Xr.current.clientWidth),_r(ni(Xr.current)))},[Er,ko,So]);const ti=No===Co?Kr>0?Kr:xo[Co]:xo[No],oi=Kr>0?Math.min(Kr/ti,"shrink"===Oo?1:2):1,ri=ti*oi,ii=Kr>0&&ri>Kr+1,li={width:ri,height:Zr||"100%",flex:"none",position:"relative"},si={width:ti,height:Zr?Zr/oi:"100%",maxHeight:"none",transform:1!==oi?`scale(${oi})`:void 0,transformOrigin:"top left"},di=()=>Ft({type:"setUi",ui:{leftSideBarVisible:!ko}}),ai=()=>Ft({type:"setUi",ui:{rightSideBarVisible:!So}}),ci=e=>{Xo&&(Ko(!1),_o(null),Qo.current=!1,ko&&To===e)||(Lo(e),ko||Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},pi=()=>{tr(Zt??R),So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},ui=Rt.data.content??[],hi=()=>{const e=ui.findIndex(_t),n=ui.findIndex(qt);return{floor:e>=0?e+1:0,cap:n>=0?n:ui.length}},fi=Vt,mi=mr.stripCopy,gi=n=>e(n,mi),yi=oe(),vi=Ye({data:Rt.data,config:fi,readOnly:Boolean($t),clipboard:yi,strip:mi?e=>mi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Pn||e.slot!==$n)return{min:0,max:n-1};const{floor:t,cap:o}=hi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&tr(R);const t=void 0===n||"node"===n?.kind?n:null;vo.commitDocument(e,t)}}),bi=me(),[ki,Si]=Rn(null),wi=e=>{const n=ui.find(n=>String(n.props.id)===e),t=Wt.shared;n&&t&&vi.swap(e,t.detach(n))},xi=e=>{const n=An(Rt.data,Vt,e);if(!n)return!1;const t=Mn(n.place),o=n.node,r=t===Ne?Ii(o):Yi(o),i=t===Ne?Wt.shared?.usedOn(o):null;return!!vi.remove(e)&&(Gr(i?to.shared.removed({count:Math.max(0,i.length-1)}):to.deleted({name:r}),"success",{duration:8e3,action:{label:to.bar.undo,onClick:()=>{vi.restore(n.node,n.place)}}}),!0)},zi={...vi,remove:xi},Ci=e=>xr(e,"block",Vt.components[e]?.label??e),Oi=Dn(e=>Vt.components[e]?.defaultProps??{},[Vt]),Ni=e=>xr(e,"section",Ci(e)),Ii=e=>xe({type:e.type,props:e.props??{}},Ni(e.type),Or),{nodeAddresses:Bi,zoneItems:Pi}=En(()=>{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>=Be)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Pe(Vt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ui,Ne,0),{nodeAddresses:e,zoneItems:n}},[ui,Vt]),$i=Dn(e=>Pi.get(e)??[],[Pi]),Mi=e=>{const n=Bi.get(e);return n?$i(n.zone)[n.index]:void 0},ji=e=>ee(mr,Vt,e),Ai=e=>{if(!mr.slotsOf||e===Ne)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Mi(e.slice(0,n));if(!t)return null;const o=ji(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}},Ti=(()=>{if(!G(nr))return null;const e=`${nr.nodeId}:${nr.slot}`;return Ai(e)?.slot.panel===nr.kind?e:null})(),Li=Ln(null);Fn(()=>{const e=Li.current;if(Li.current=null,!Ti||!G(nr))return;const n=nr.nodeId;sr(n,{scroll:e!==Ti}),Lr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[nr]);const Ei=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Bi.get(e);n&&(n.zone===Ne?tl(n.index):Bl(n.zone,n.index,e,Mi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Ti!==i&&(Li.current=i),pr(null,r),So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ri=(e,n,t)=>{const o=`${e}:${n}`;if(Lr(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;Ti!==o&&(Li.current=o);pr(null,{kind:t,nodeId:e,slot:n})},Fi=(e,n,t)=>{if($t||!mr.moveSlot)return;const o=Mi(e),r=o?ji(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:wt,index:n},s=bn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=mr.moveSlot(e,n,s);"string"==typeof d&&Ri(e,d,i.panel)},Di=Cr(),Hi=En(()=>{const e=/* @__PURE__ */new Map;for(const n of Di??[])e.set(n.slug,n.name);return e},[Di]),Yi=e=>ze(e,Ci,wr.plainText,e=>Hi.get(e),wr.rowName),Vi=(e,n)=>{const t=Vt.components[e.type]?.fields,o=n===Ne||ns(n)?"section":"block",r=n===Ne&&(_t(e)||qt(e)||Xt(e.type)),i="block"===o?Ce(t):r?null:Oe(t);return wr.renamePropOf?wr.renamePropOf(e,o,i):i},Wi=(e,n,t,o)=>{if(!(!$t&&Pr?.zone===e&&Pr.index===n))return;const r=(t,o)=>{$r(null),o&&((e,n,t)=>{const o=$i(e)[n];if(!o)return;const r=Vi(o,e);r&&vo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
- return pt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":to.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)},Ui=t(X(),ao),Ji=Ui.scope({target:In,siteId:_n,docId:Wn}),Gi=Vt,Xi=(e,n)=>n===Ne?Ni(e):Ci(e),Ki=(e,n,t)=>{const o=Ui.plan(Ji,t,Xi(t.type,e),Gi);o&&(o.changed&&vo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Gr(o.message))},Qi=re({nodesIn:$i,nodeAt:(e,n)=>$i(e)[n]??null,labelOf:(e,n)=>n===Ne?Ni(e):Ci(e),renamePropOf:Vi,beginRename:(e,n)=>$r({zone:e,index:n}),history:{hasPast:Dt.hasPast,hasFuture:Dt.hasFuture,back:()=>Dt.back(),forward:()=>Dt.forward()},openPageStyles:hr.openPageStyles,pageStylesLabel:to.pageStyles,words:{menu:so,styleClipboard:ao,screen:to.menu},readOnly:Boolean($t),collapseAll:()=>Lr(new Set($i(Ne).map(e=>String(e.props.id)))),onPasteRefused:e=>Gr(e?to.pasteRefused({name:e.label}):to.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>rs(e,n),menuRows:(e,n,t)=>{const o=hr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Wt.shared;if(!t||n!==Ne)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:to.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return $t||gr(e.type,e)?n:{...n,change:[{label:to.shared.detach,onClick:()=>wi(e.props.id)}],remove:[{label:to.shared.removeFromPage,danger:!0,onClick:()=>{xi(e.props.id)}}]}}return $t||_t(e)||qt(e)||Xt(e.type)?null:x(bi)?{change:[{label:to.shared.makeShared,onClick:()=>Si({id:e.props.id,name:Ii(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>gr(e.type,e),duplicateBlocked:e=>yr(Rt.data,e),permits:e=>{const n=Ie(Vt,e.type);return Wt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:zi,isPinned:(e,n)=>n===Ne&&(_t(e)||qt(e)),sectionBand:hi,locate:e=>Bi.get(e)??null,rowNameOf:(e,n)=>n===Ne?Ii(e):Yi(e),selectAt:(e,n,t,o)=>{e===Ne?tl(n):Bl(e,n,t,o??"")},slotRung:e=>{const n=Ai(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ei(n.node,n.slot,!1)}:null},style:{held:()=>ie(Ji),canCopy:e=>Ui.rows(Gi,e).some(e=>!1!==e.counted),copy:(e,n)=>Ui.copy(Ji,e,Xi(e.type,n),Gi),paste:(e,n,t)=>Ki(e,n,t)},keys:At?{target:Vo,selected:()=>{const e=Rt.ui.itemSelector;return e?{zone:e.zone??Ne,index:e.index}:null},held:()=>yi.get(),readOnly:Boolean($t),onDone:({done:e,name:n})=>{"copied"===e&&Gr(to.copied({name:n}))}}:void 0},Ho),Zi=Ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Fn(()=>{Zi.current={copy:(e,n)=>Ui.copy(Ji,e,Xi(e.type,n),Gi),paste:Ki,at:()=>{const e=Rt.ui.itemSelector;if(!e)return null;const n=e.zone??Ne,t=$i(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean($t)}});const _i=Dn(e=>{const n=le(e);if(!n)return;const t=Zi.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))},[]);Fn(()=>{if(!Vo)return;const e=e=>_i(e);return Vo.addEventListener("keydown",e),()=>Vo.removeEventListener("keydown",e)},[_i,Vo]),zn(Ho,"keydown",_i);const qi=ui.map(e=>e.props.id).join("|");Fn(()=>{const e=Ho?.document??null,n=Ho?.window??null;let t=0;const o=[],r=()=>{if(!e)return void er(e=>e.length?[]:e);const n=ui.findIndex(qt),t=n>=0?n:ui.length,o=n=>{const t=ui[n]?.props?.id;return null==t?null:Bn(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(wn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ui.length>0&&!_t(ui[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=St(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}er(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()}},[Ho,qi,No,oi,ko,So,Ht?.props.id]);const el=Ho?.document??null,nl=Ho?.window??null;Fn(()=>{const e=Fo.current;if(!e||!el||!nl)return;const n=[],t=()=>{const n=Bn(el,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&nl.scrollTo({left:nl.scrollX,top:nl.scrollY+t,behavior:"instant"}),!0};return Fo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[el,nl]);const tl=e=>{tr(R),vo.select({index:e}),hr.sectionPressed?.(ui[e]);const n=ui[e]?.props?.id;n&&l(n)},ol=e=>{const{floor:n,cap:t}=hi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Ht&&nr.kind!==Zt?.kind?ui.findIndex(e=>e.props.id===Ht.props.id):-1;return o(r>=0?r+1:t)},rl=(e,n)=>{const{floor:t,cap:o}=hi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(vo.reorderComponent(Ne,e,i),vo.select({index:i}),{moved:!0,dest:i})},il=(e,n,t,o)=>{tr(R),vo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Gr(to.sectionAdded({name:t}))},ll=(e,n)=>{const t=ol(n),o=br(e,{nodeDefaults:Oi,newNodeId:Me,sectionLabel:Ni,blockIsOffered:Sr}),r=o?vo.insertNode(Ne,t,o):vo.insertSection(e,t);return il(t,r,Ni(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Pe(Vt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=kr(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},sl=e=>dl(Ne,e),dl=(e,n)=>{Ur.current=document.activeElement??null,_o(null===n?null:{zone:e,index:n}),Ko(!0),ko||(Qo.current=!0,Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},al=()=>{Ko(!1),_o(null),Qo.current&&Ft({type:"setUi",ui:{leftSideBarVisible:!1}}),Qo.current=!1},cl=(e,n)=>wr.rowName?n?_t(e)?wr.rowName(e,"section",to.header):qt(e)?wr.rowName(e,"section",to.footer):Xt(e.type)?wr.rowName(e,"section",Ci(e.type)):Ii(e):Yi(e):n?Ni(e.type):Ci(e.type),pl=e=>n=>{e()},ul=(e,n,t)=>{if($t)return null;const o=$i(e)[n];return o&&!Ie(Vt,o.type).delete||o&&gr(o.type,o)?null:/* @__PURE__ */pt(Xe,{kind:"delete",label:e===Ne&&o&&Wt.shared?.usedOn(o)?to.shared.removeFromPage:to.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=$i(e)[n]?.props?.id;null!=t&&xi(String(t))})(e,n),children:/* @__PURE__ */pt(lt,{size:15})})},hl=e=>wr.rowPreview?.(e)||void 0,fl=e=>wr.rowMarks?.(e)??void 0,ml=(e,n,t)=>wr.rowActions?.(e,n,t)??null,gl=(e,n,t,o)=>{if($t)return null;if(gr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
- return pt(Xe,{kind:"eye",label:r?to.showNamed({name:o}):to.hideNamed({name:o}),onClick:()=>vl(e,n,t),children:/* @__PURE__ */pt(r?st:dt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},yl=e=>Ks(Ne,e),vl=(e,n,t)=>{vo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},bl=e=>$e(Vt,e),kl=e=>Pe(Vt,e),Sl=e=>mr.slotsOf?ji(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:je(e,n.slot)})):[{slot:null,rung:null,kids:ne(Vt,e)}],wl=e=>mr.slotsOf?Sl(e).flatMap(e=>e.kids):ne(Vt,e),xl=e=>Boolean(mr.slotsOf)&&ji(e).some(e=>e.rung),zl=(e,n,t)=>null===t?void 0===n?kr(e):kr(e,n):kr(e,n,t),Cl=(e,n,t)=>{const o=Ae(Vt,e.type,n)&&(t||wl(e).length>0||xl(e));return{collapsible:o,folded:o&&Yr(String(e.props.id))}},Ol=(e,n,t)=>Sl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Cl(e,r,t(e.type)).collapsible?[String(e.props.id),...Ol(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Nl=e=>wl(e).length>0||xl(e)||Boolean(kr(e.type)),Il=e=>Boolean(kr(e)),Bl=(e,n,t,o)=>{if(tr(R),kr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),vo.select({index:n,zone:e}),l(t)}else vo.select({index:n,zone:e}),l(t)},Pl=(e,n,t,o,r)=>{const i=`${e}:${n}`;vo.insertComponent(i,t,o),kr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),vo.select({index:o,zone:i})}):vo.select({index:o,zone:i})},$l=Ln(/* @__PURE__ */new Set);Fn(()=>{ui.forEach(e=>{const n=kr(e.type)?.spec;if(!n)return;const t=e.props.id;if($l.current.has(t))return;$l.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(Oi)).forEach((e,t)=>mo.seedChild(o,t,n.childType,e))})},[ui,mo,Oi]);const Ml=Ln(/* @__PURE__ */new Set);Fn(()=>{ui.forEach((e,t)=>{const o=e.props.id;if(Ml.current.has(o))return;const r=n(e,bl(e.type));Ml.current.add(o),r&&mo.replaceComponent(Ne,t,{...e,props:r})})},[ui,mo]),K(mo,Vt);const jl=ui.findIndex(qt),Al=jl>=0?ui[jl]:null,Tl=eo?ui.findIndex(_t):-1,Ll=Tl>=0?ui[Tl]:null,El=Wt.groupTab,Rl=En(()=>El?e=>Xt(e.type):void 0,[El]),Fl=Boolean(Wt.groupBadge),Dl=Wt.sharedReach,Hl=e=>Dl?.(e)??void 0,Yl=En(()=>Dl?new Set(ui.filter(e=>Hl(e)).map(e=>String(e.props.id))):null,[ui,Dl]),Vl=En(()=>Yl?e=>Yl.has(e):void 0,[Yl]),Wl=Wt.first?Dl?.({type:Wt.first,props:{id:""}})??void 0:void 0,Ul=Wt.groupBadge?/* @__PURE__ */pt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */pt(Un,{tone:"info",size:"xs",children:Wt.groupBadge})}):void 0,Jl=ui.find(e=>e.type===Jt)??null,Gl=ui.find(e=>e.type===Gt)??null,Xl=jl>=0?jl:ui.length,Kl=[];ui.forEach(e=>{qt(e)||(Nl(e)&&Kl.push(String(e.props.id)),Kl.push(...Ol(e,1,Il)))}),Al&&(Kl.push(String(Al.props.id)),Kl.push(...Ol(Al,1,Il)));const Ql=Kl.length>0&&Kl.every(e=>Tr.has(e)),Zl=e=>{const n=wr.blockRowName(e,Ci);return wr.rowName?wr.rowName(e,"block",n):n},_l=(e,n,t,o)=>{const r=$i(e)[t];if(!r)return;const i={...jn(e),index:t},l={...jn(n),index:Math.min(Math.max(o,0),$i(n).length)},s=bn(i,l);if(e!==n||s!==t)try{vi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Tn))throw e}},ql=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of kl(e))n.add(r),t(o)};for(const t of bl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},es=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Bi.get(n);if(!e)return null;if(e.zone===Ne)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ns=e=>{const n=e.slice(0,e.indexOf(":")),t=ui.find(e=>Xt(e.type)&&String(e.props.id)===n);return t&&Kt(n)===e?t:null},ts=(e,n)=>{const t=ns(e);return!t||(!Wt.groupAccepts||Wt.groupAccepts(t.type,n,$i(e).length))},os=(e,n,t)=>{if(e.rung){const t=Mi(e.rung.nodeId),o=t?ji(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===wt&&n.index>=0&&n.index<=o}if(n.slot===wt)return!1;if(e.add)return ss(e.add,n);const o=Mn(n);if(Xt(e.type))return!1;const r=ns(o),i=ns(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!ts(o,e.type))&&(n.index>=0&&n.index<=$i(o).length));if(e.zone===Ne||o===Ne){if(e.zone!==o)return!1;const{floor:t,cap:r}=hi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>$i(o).length)return!1;if(e.zone===o)return!0;const l=Al&&!Wt.lastIsOpen?String(Al.props.id):null;return(!l||es(e.zone)!==l&&es(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??$i(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Bi.get(i),s=l?$i(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ql(r).has(n))return!1;const d=kr(s.type,vr(Rt?.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?.($i(n),r))})(e.zone,o,e.index,t)},rs=(e,n)=>{const t=Mn(e.from),o=e.node;return t===Mn(n)?ts(t,o.type):os({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},is=e=>{const n=e.slice(0,e.indexOf(":")),t=Bi.get(n),o=t?$i(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=kr(o.type,vr(Rt?.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=I(r.choices??(r.spec?[{type:r.spec.childType,label:Ci(r.spec.childType)}]:[])),l=Ai(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:cl(o,t.zone===Ne)}},ls=(e,n)=>{if("section"!==e.kind)return e;const t=Mn(n);return t===Ne||ns(t)?e:is(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ss=(e,n)=>{const t=ls(e,n),o=Mn(n);if("shared"===t.kind){if(o!==Ne||!Wt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=hi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ns(o)){const e="section"===t.kind?t.type:t.template.node.type;return ts(o,e)&&n.index>=0&&n.index<=$i(o).length}if(o!==Ne)return!1;const{floor:e,cap:r}=hi();return n.index>=e&&n.index<=r}if(o===Ne)return!1;const r=is(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.($i(o))},ds=(e,n)=>{const t=ls(e,n);if("block"!==t.kind&&ns(Mn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&ts(n,o)){if("section"===e.kind)vo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;vo.insertNode(n,t,gi(e.template.node))}tr(R),vo.select({index:t,zone:n})}})(t,Mn(n),n.index);if("section"===t.kind)return void ll(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=ol(t),r=vo.insertNode(Ne,o,n);il(o,r,e)})(t.template.name,gi(t.template.node),n.index);if("shared"===t.kind){const e=Wt.shared?.nodeOf(t.section);if(!e)return;const o=ol(n.index);return void(vi.restore(e,{parentId:Pn,slot:$n,index:o})&&il(o,e.props.id,t.section.title))}const o=Mn(n),r=is(o);r&&(r.target.spec?Pl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{vo.insertComponent(e,n,t),tr(R),vo.select({index:t,zone:e})})(o,t.type,n.index))},as=(e,n)=>{e.media?function(e){const n=Ws();if(!n||!Hs)return;Js(n).then(n=>{n&&function(e,n){if(!Hs)return;const t=Hs.create(e,{nodeDefaults:Oi,newNodeId:Me,sectionLabel:Ni,blockIsOffered:Sr}),o=Mn(n);if(o===Ne){const e=ol(n.index),o=vo.insertNode(Ne,e,t);return void il(e,o,Ni(t.type))}vo.insertNode(o,n.index,t),tr(R),vo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Fi(e.rung.nodeId,e.index,n.index):e.add?ds(e.add,n):e.zone===Ne?rl(e.index,n.index):_l(e.zone,Mn(n),e.index,n.index)},[cs]=Rn(()=>yn()),ps=vn({keyOf:e=>e.id,readOnly:Boolean($t),session:cs,canDrop:os,onDrop:as,onStep:(e,n)=>{e.rung?Fi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Ne?((e,n)=>{const t=Ni(ui[e]?.type??""),o=rl(e,n<0?e-1:e+2);if(!o.moved)return void Gr(n<0?to.sectionFirst({name:t}):to.sectionLast({name:t}));const{floor:r,cap:i}=hi();Gr(to.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):_l(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),us=Dn(e=>{const{floor:n,cap:t}=hi(),o=[];for(const r of e.nodes){const e=Mn(r.place),i=$i(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(_t(i)||qt(i)||gr(i.type,i))continue;if(Xt(i.type))continue;const l=Boolean(ns(e)),s=e===Ne||l;e===Ne&&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?Ni(i.type):Yi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Mn(e.list);if(n===Ne&&0===e.children.length)return[{...e,addLabel:to.addSection,addAlways:!0}];const t=is(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ns(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Mn(e.list),t=n===Ne||ns(n)?null:is(n);return t?.choices.length?hn(e,t.target.spec?.addLabel??to.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Rt.data]),hs=null==Ht?.props.id?null:String(Ht.props.id),fs=Yn(Ee),ms=fs?.selected()&&Ho?.document&&hs?fs.selectedPart?.(Ho.document)??null:null,gs=ms&&hs&&Re(Rt.data,Vt,hs,ms)?ms:null,ys=gs?.label?{element:gs.element,label:gs.label}:null,vs=null!==gs,bs=Dn(e=>{const n=Vt,t=e=>!e.item.rung&&null!==An(Rt.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(hs);return i?vs?null:i:r(Ve(Rt.data,n,o.item.id,hs,Rl))??o},[Rt.data,Vt,hs,Rl,vs]),[ks,Ss]=Rn(null),ws=Boolean(El||Dl);zn(Ho,"mouseover",e=>{if(!ws)return;const n=Cn(e.target),t=n?yt(Rt.data,Vt,n):null;t!==ks&&Ss(t)}),zn(Ho,"mouseout",e=>{ws&&!e.relatedTarget&&Ss(null)});const xs=e=>_t(e)||qt(e)||Xt(e.type),zs=e=>{const n=Xt(e.type)?Ci(e.type):_t(e)?to.header:qt(e)?to.footer:null;return null===n?Ii(e):wr.rowName?wr.rowName(e,"section",n):n},Cs=[];if(ws){const e=hs?yt(Rt.data,Vt,hs):null;for(const n of/* @__PURE__ */new Set([e,ks])){const e=n?ui.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=_t(e)||e.type===Jt,o=Hl(e);if(o){Cs.push({id:String(e.props.id),label:zs(e),below:t,reach:o});continue}if(!El||!xs(e))continue;const r=El(e);r&&Cs.push({id:String(e.props.id),label:r,below:t})}}const Os=me(),Ns=Ln(null);Fn(()=>{const e=Wt.changeNotice;if(!e)return;const n=JSON.stringify(ui.filter(xs)),t=Ns.current;if(Ns.current={doc:Wn,bands:n,index:Dt.index},!t||t.doc!==Wn||t.bands===n)return;Dt.hasPast&&Dt.index>=t.index&&!gt.has(Os)&&(gt.add(Os),Gr(e,"success",{action:{label:to.bar.undo,onClick:()=>Dt.back()},duration:8e3}))},[ui]);const Is=e=>{tr(R),vo.select(e.zone===Ne?{index:e.index}:{index:e.index,zone:e.zone})},Bs=Q(),Ps=()=>({data:Rt.data,device:No,ops:vo,inspector:ur}),$s=Bs?.model,Ms=En(()=>$s?e=>$s(e,us(e),Ps()):us,[$s,us,No]),js=Bs?.measure,As=js?(e,n)=>js(e,n,Ps()):void 0,Ts=Bs?.canDrop,Ls=Ts?(e,n)=>Ts(e,n,os,Ps()):os,Es=Bs?.drop,Rs=Es?(e,n)=>Es(e,n,as,Ps()):as,Fs=Bs?.pick,Ds=Fs?e=>Fs(e,Is,Ps()):Is,Hs=Bs?.media??null,Ys=Ln(null),Vs=En(()=>Hs?{id:ft,zone:"",index:-1,type:Hs.adds.type,add:{kind:Hs.adds.kind,type:Hs.adds.type},media:!0}:null,[Hs]);Fn(()=>{if(!Vs||$t||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(nt))(e)&&(Ys.current=null,cs.start({key:ft,item:Vs}))},n=e=>{cs.get()?.item.media&&(Ys.current=Kn(e.dataTransfer))},t=()=>{cs.get()?.item.media&&cs.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Vs,$t,cs]);const Ws=()=>{const e=Ys.current;return Ys.current=null,e},Us=fe(),Js=async e=>{if(!Us)return e;const n=await Us(e);return n?{...e,id:n.id,url:n.url}:null};const Gs=(e,n)=>{if(!Hs)return;const t=An(yo.getState().appState.data,fi,n);if(!t)return;const o=t.node;vo.replaceComponent(Mn(t.place),t.place.index,{...o,props:{...Hs.replace(o,e),id:o.props.id}})},Xs=e=>{const n=Mn(e),t=Ai(n);t&&Ei(t.node,t.slot,!1),dl(n,e.index)},Ks=(e,n)=>/* @__PURE__ */pt(Ke,{...$t?{}:ps.seam({place:{...jn(e),index:n}})},`seam:${e}:${n}`),Qs={rowClick:pl,isCollapsed:Yr,toggleCollapse:Vr},Zs=e=>{const n=String(e.props.id),t=ui.findIndex(e=>String(e.props.id)===n),o=Kt(n),r=$i(o),i=Yr(n),l=Ci(e.type),s=wr.rowName?wr.rowName(e,"section",l):l,d=e=>Ks(o,e);/* @__PURE__ */
12
+ /* @__PURE__ */pt("path",{d:"M5 12h14"})]})})}var kt=`${Sn}, ${wn}`;function St(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var wt="__rungs";var xt="screen:band",zt={duplicate:!0,delete:!0},Ct=()=>null;function Nt(){const Sn=fe(),Nn=Sn.panels?.Toolbar,On=(Sn.panels?.useRight??Ct)(),{target:In,docId:Yn,capabilities:Gn,currentSlug:_n,siteId:Zn,onPublish:qn,saveState:et,saveConflict:at,retrySave:Nt,toggleAutoSave:Ot,flushSave:It,access:Bt,saveUnreachable:Pt=!1,readOnly:$t,readOnlyReason:Tt=null}=le(),Mt=B(),jt=P(),{mediaEditing:At,hasEditGuard:Lt,hasPinnedChrome:Et}=Gn,{appState:Rt,dispatch:Ft,history:Dt,selectedItem:Wt,getSelectorForId:Ht,config:Vt}=je(e=>e),Yt=$(),{first:Ut,firstGroup:Jt,lastGroup:Xt,isSectionGroup:Kt,sectionGroupZone:Qt,panelOf:Gt}=Yt,_t=Gt(Ut),Zt=e=>Z(Yt,e),qt=e=>q(Yt,e),eo="node"===Yt.firstRow,no=Yt.band??null,to=un("screen",ke),oo=un("tree",Je),ro=un("drag",gn),io=un("notice",sn),lo=un("lock",pn),so=un("menu",Xe),ao=un("styleClipboard",Se),co=un("chrome",dn),po=T()??`/${_n}`,uo=M(),ho=j(),fo=y({readOnly:$t}),mo=y({readOnly:$t,foldIntoHistory:!0}),go=Ln(null),yo=Ae(),vo=En(()=>({...fo,select:e=>{go.current=e,fo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=yo.config;go.current=Ke(e,t,n)}fo.commitDocument(e,n)}}),[fo,yo]),bo=Rt.ui,ko=bo.leftSideBarVisible,So=bo.rightSideBarVisible,{options:wo,widths:xo,initial:zo,fluid:Co,fit:No}=A(),[Oo,Io]=Rn(zo),Bo=de(),Po=At&&null!==Bo;ae(),ce();const $o=pe();L(Wt?.props.id);const{read:To,write:Mo,forSelection:jo}=E(),[Ao,Lo]=Rn(To);Fn(()=>{Mo(Ao)},[Ao]);const[Eo,Ro]=Rn(0),Fo=Ln(null),Do=Ln(null),Wo=kn(Do,{readySelector:kt}),Ho=xn(Wo),Vo=d(Do);a(Do,Wo);const Yo=k(),Uo=an(Bt),Jo={state:et,offline:Yo||et.failed&&Pt,readOnlyReason:Tt,editing:Uo?io.editing({name:cn(Uo.name,lo),noun:to.noun}):null,conflict:null!=at,notSaving:to.bar.notSaving},Xo=()=>{$t||(et.failed?Nt():It())};c(Do,Wo,Xo);const[Ko,Qo]=Rn(!1),Go=Ln(!1),[_o,Zo]=Rn(null),[qo,er]=Rn([]),[nr,tr]=Rn(R);F(nr);const or=o(nr,Wt?.props.id),[rr,ir]=Rn(null);Fn(()=>{rr&&(r(),ir(null))},[rr]);const lr=Ln(Ht);lr.current=Ht;const sr=Dn((e,{scroll:n})=>{Lo(n=>jo(e,n)),n&&ir(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=lr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Lr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),dr=Ln(null);Fn(()=>{const e=dr.current;dr.current=null;const n=null==Wt?.props.id?null:String(Wt.props.id);tr(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Gt(Wt?.type)??R);const t=Wt?.props.id,o=go.current;if(go.current=null,!t)return;const r=Ht(t);sr(String(t),{scroll:!i(o,r??null,Ne)})},[Wt?.props.id,sr]);const ar=Dn(e=>{tr(n=>D(n,e)?n:e),Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ft]),cr=Ln(()=>{});cr.current=(e,n)=>{const t=e?$i(e.zone??Ne)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Wt?.props.id?null:String(Wt.props.id);tr(e=>D(e,n)?e:n),o!==r&&(dr.current={id:o,mode:n},vo.select(e))};const pr=Dn((e,n)=>cr.current(e,n),[]),ur={kind:nr.kind,mode:nr,open:ar,show:e=>tr(e),reveal:()=>{So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},select:pr},hr=W(ur,{data:Rt.data,selected:Wt??null,zoneOf:e=>Ht(e)?.zone,readOnly:Boolean($t),select:e=>{tr(R),vo.select({index:e})},replace:(e,n)=>vo.replaceComponent(Ne,e,n),scrollTo:e=>l(e)},{device:Oo,refreshes:Eo},{setView:Lo,reveal:()=>{ko||Ft({type:"setUi",ui:{leftSideBarVisible:!0}})}}),fr=hr.resolveLeftView?hr.resolveLeftView(Ao):"sections",mr=H(),{isLockedBlock:gr,duplicateBlocked:yr,nestDepth:vr,newSectionNode:br,canAddTo:kr,blockIsOffered:Sr}=mr,wr=V(),{labelAtLevel:xr,Icon:zr,useProducts:Cr}=wr,Nr=wr.rowName?(e,n,t)=>wr.rowName(e,n,t):void 0,Or=Dn(e=>{Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),sr(e,{scroll:!0})},[Ft,sr]),{selectNode:Ir,openPartId:Br}=g({mode:nr,setMode:tr,onOpenPart:Or}),[Pr,$r]=Rn(null);me(null!==Pr,()=>$r(null));const Tr=h(Y()),Mr=Tr.collapsed,jr=Tr.panelWidths,[Ar,Lr]=Rn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Mr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
+ return new Set}});Fn(()=>{try{window.localStorage.setItem(Mr,JSON.stringify([...Ar]))}catch{}},[Ar]);const[Er,Rr]=Rn(()=>{if("undefined"==typeof window)return{...f};try{const e=window.localStorage.getItem(jr);if(!e)return{...f};const n=JSON.parse(e);return{left:m(Number(n.left)||f.left,"left"),right:m(Number(n.right)||f.right,"right")}}catch{return{...f}}});Fn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(jr,JSON.stringify(Er))}catch{}},300);return()=>clearTimeout(e)},[Er]);const Fr=Dn((e,n)=>Rr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Dr=Dn(e=>Fr("left",e),[Fr]),Wr=Dn(e=>Fr("right",e),[Fr]),Hr=e=>Ar.has(e),Vr=e=>Lr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Yr=Ln(!1),Ur=Ln(null);Fn(()=>{if(Yr.current&&!Ko){const e=Ur.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Do.current?.querySelector(`button[aria-label="${CSS.escape(to.add.title)}"]`))?.focus(),Ur.current=null}Yr.current=Ko},[Ko]),Fn(()=>{if(!Ko||!Vo)return;const e=e=>{"Escape"===e.key&&al()};return Vo.addEventListener("keydown",e),()=>Vo.removeEventListener("keydown",e)},[Ko,Vo]),me(Ko,()=>al()),Fn(()=>{!ko&&Ko&&(Qo(!1),Zo(null),Go.current=!1)},[ko]);const Jr=U(),Xr=(e,n="success",t)=>{if(Jr)return void(t?Jr(e,"error"===n?"error":"info",t):Jr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Kn.error(e,{...o,duration:t?.duration??3200}):Kn.success(e,{...o,duration:t?.duration??1900})},Kr=Ln(null),[Qr,Gr]=Rn(0),[_r,Zr]=Rn(0),qr=J(),ei=Ln(null),ni=e=>Math.max(0,e.clientHeight-(ei.current?.offsetHeight??0));Fn(()=>{const e=Kr.current;if(!e)return;const n=()=>{Gr(e.clientWidth),Zr(ni(e))};n();const t=new ResizeObserver(n);return t.observe(e),ei.current&&t.observe(ei.current),()=>t.disconnect()},[]),Wn(()=>{Kr.current&&(Gr(Kr.current.clientWidth),Zr(ni(Kr.current)))},[Er,ko,So]);const ti=Oo===Co?Qr>0?Qr:xo[Co]:xo[Oo],oi=Qr>0?Math.min(Qr/ti,"shrink"===No?1:2):1,ri=ti*oi,ii=Qr>0&&ri>Qr+1,li={width:ri,height:_r||"100%",flex:"none",position:"relative"},si={width:ti,height:_r?_r/oi:"100%",maxHeight:"none",transform:1!==oi?`scale(${oi})`:void 0,transformOrigin:"top left"},di=()=>Ft({type:"setUi",ui:{leftSideBarVisible:!ko}}),ai=()=>Ft({type:"setUi",ui:{rightSideBarVisible:!So}}),ci=e=>{Ko&&(Qo(!1),Zo(null),Go.current=!1,ko&&Ao===e)||(Lo(e),ko||Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},pi=()=>{tr(_t??R),So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},ui=Rt.data.content??[],hi=()=>{const e=ui.findIndex(Zt),n=ui.findIndex(qt);return{floor:e>=0?e+1:0,cap:n>=0?n:ui.length}},fi=Vt,mi=mr.stripCopy,gi=n=>e(n,mi),yi=oe(),vi=Qe({data:Rt.data,config:fi,readOnly:Boolean($t),clipboard:yi,strip:mi?e=>mi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Pn||e.slot!==$n)return{min:0,max:n-1};const{floor:t,cap:o}=hi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&tr(R);const t=void 0===n||"node"===n?.kind?n:null;vo.commitDocument(e,t)}}),bi=he(),[ki,Si]=Rn(null),wi=e=>{const n=ui.find(n=>String(n.props.id)===e),t=Yt.shared;n&&t&&vi.swap(e,t.detach(n))},xi=e=>{const n=jn(Rt.data,Vt,e);if(!n)return!1;const t=Tn(n.place),o=n.node,r=t===Ne?Ii(o):Hi(o),i=t===Ne?Yt.shared?.usedOn(o):null;return!!vi.remove(e)&&(Xr(i?to.shared.removed({count:Math.max(0,i.length-1)}):to.deleted({name:r}),"success",{duration:8e3,action:{label:to.bar.undo,onClick:()=>{vi.restore(n.node,n.place)}}}),!0)},zi={...vi,remove:xi},Ci=e=>xr(e,"block",Vt.components[e]?.label??e),Ni=Dn(e=>Vt.components[e]?.defaultProps??{},[Vt]),Oi=e=>xr(e,"section",Ci(e)),Ii=e=>we({type:e.type,props:e.props??{}},Oi(e.type),Nr),{nodeAddresses:Bi,zoneItems:Pi}=En(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=Ie)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Be(Vt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ui,Ne,0),{nodeAddresses:e,zoneItems:n}},[ui,Vt]),$i=Dn(e=>Pi.get(e)??[],[Pi]),Ti=e=>{const n=Bi.get(e);return n?$i(n.zone)[n.index]:void 0},Mi=e=>ee(mr,Vt,e),ji=e=>{if(!mr.slotsOf||e===Ne)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Ti(e.slice(0,n));if(!t)return null;const o=Mi(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}},Ai=(()=>{if(!X(nr))return null;const e=`${nr.nodeId}:${nr.slot}`;return ji(e)?.slot.panel===nr.kind?e:null})(),Li=Ln(null);Fn(()=>{const e=Li.current;if(Li.current=null,!Ai||!X(nr))return;const n=nr.nodeId;sr(n,{scroll:e!==Ai}),Lr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[nr]);const Ei=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Bi.get(e);n&&(n.zone===Ne?tl(n.index):Bl(n.zone,n.index,e,Ti(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Ai!==i&&(Li.current=i),pr(null,r),So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ri=(e,n,t)=>{const o=`${e}:${n}`;if(Lr(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;Ai!==o&&(Li.current=o);pr(null,{kind:t,nodeId:e,slot:n})},Fi=(e,n,t)=>{if($t||!mr.moveSlot)return;const o=Ti(e),r=o?Mi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:wt,index:n},s=bn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=mr.moveSlot(e,n,s);"string"==typeof d&&Ri(e,d,i.panel)},Di=Cr(),Wi=En(()=>{const e=/* @__PURE__ */new Map;for(const n of Di??[])e.set(n.slug,n.name);return e},[Di]),Hi=e=>xe(e,Ci,wr.plainText,e=>Wi.get(e),wr.rowName),Vi=(e,n)=>{const t=Vt.components[e.type]?.fields,o=n===Ne||ns(n)?"section":"block",r=n===Ne&&(Zt(e)||qt(e)||Kt(e.type)),i="block"===o?ze(t):r?null:Ce(t);return wr.renamePropOf?wr.renamePropOf(e,o,i):i},Yi=(e,n,t,o)=>{if(!(!$t&&Pr?.zone===e&&Pr.index===n))return;const r=(t,o)=>{$r(null),o&&((e,n,t)=>{const o=$i(e)[n];if(!o)return;const r=Vi(o,e);r&&vo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
+ return pt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":to.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)},Ui=t(K(),ao),Ji=Ui.scope({target:In,siteId:Zn,docId:Yn}),Xi=Vt,Ki=(e,n)=>n===Ne?Oi(e):Ci(e),Qi=(e,n,t)=>{const o=Ui.plan(Ji,t,Ki(t.type,e),Xi);o&&(o.changed&&vo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Xr(o.message))},Gi=re({nodesIn:$i,nodeAt:(e,n)=>$i(e)[n]??null,labelOf:(e,n)=>n===Ne?Oi(e):Ci(e),renamePropOf:Vi,beginRename:(e,n)=>$r({zone:e,index:n}),history:{hasPast:Dt.hasPast,hasFuture:Dt.hasFuture,back:()=>Dt.back(),forward:()=>Dt.forward()},openPageStyles:hr.openPageStyles,pageStylesLabel:to.pageStyles,words:{menu:so,styleClipboard:ao,screen:to.menu},readOnly:Boolean($t),collapseAll:()=>Lr(new Set($i(Ne).map(e=>String(e.props.id)))),onPasteRefused:e=>Xr(e?to.pasteRefused({name:e.label}):to.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>rs(e,n),menuRows:(e,n,t)=>{const o=hr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Yt.shared;if(!t||n!==Ne)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:to.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return $t||gr(e.type,e)?n:{...n,change:[{label:to.shared.detach,onClick:()=>wi(e.props.id)}],remove:[{label:to.shared.removeFromPage,danger:!0,onClick:()=>{xi(e.props.id)}}]}}return $t||Zt(e)||qt(e)||Kt(e.type)?null:x(bi)?{change:[{label:to.shared.makeShared,onClick:()=>Si({id:e.props.id,name:Ii(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>gr(e.type,e),duplicateBlocked:e=>yr(Rt.data,e),permits:e=>{const n=Oe(Vt,e.type);return Yt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:zi,isPinned:(e,n)=>n===Ne&&(Zt(e)||qt(e)),sectionBand:hi,locate:e=>Bi.get(e)??null,rowNameOf:(e,n)=>n===Ne?Ii(e):Hi(e),selectAt:(e,n,t,o)=>{e===Ne?tl(n):Bl(e,n,t,o??"")},slotRung:e=>{const n=ji(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ei(n.node,n.slot,!1)}:null},style:{held:()=>ve(Ji),canCopy:e=>Ui.rows(Xi,e).some(e=>!1!==e.counted),copy:(e,n)=>Ui.copy(Ji,e,Ki(e.type,n),Xi),paste:(e,n,t)=>Qi(e,n,t)},keys:jt?{target:Vo,selected:()=>{const e=Rt.ui.itemSelector;return e?{zone:e.zone??Ne,index:e.index}:null},held:()=>yi.get(),readOnly:Boolean($t),onDone:({done:e,name:n})=>{"copied"===e&&Xr(to.copied({name:n}))}}:void 0},Wo),_i=Ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Fn(()=>{_i.current={copy:(e,n)=>Ui.copy(Ji,e,Ki(e.type,n),Xi),paste:Qi,at:()=>{const e=Rt.ui.itemSelector;if(!e)return null;const n=e.zone??Ne,t=$i(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean($t)}});const Zi=Dn(e=>{const n=be(e);if(!n)return;const t=_i.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))},[]);Fn(()=>{if(!Vo)return;const e=e=>Zi(e);return Vo.addEventListener("keydown",e),()=>Vo.removeEventListener("keydown",e)},[Zi,Vo]),zn(Wo,"keydown",Zi);const qi=ui.map(e=>e.props.id).join("|");Fn(()=>{const e=Wo?.document??null,n=Wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void er(e=>e.length?[]:e);const n=ui.findIndex(qt),t=n>=0?n:ui.length,o=n=>{const t=ui[n]?.props?.id;return null==t?null:Bn(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(wn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ui.length>0&&!Zt(ui[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=St(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}er(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()}},[Wo,qi,Oo,oi,ko,So,Wt?.props.id]);const el=Wo?.document??null,nl=Wo?.window??null;Fn(()=>{const e=Fo.current;if(!e||!el||!nl)return;const n=[],t=()=>{const n=Bn(el,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&nl.scrollTo({left:nl.scrollX,top:nl.scrollY+t,behavior:"instant"}),!0};return Fo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[el,nl]);const tl=e=>{tr(R),vo.select({index:e}),hr.sectionPressed?.(ui[e]);const n=ui[e]?.props?.id;n&&l(n)},ol=e=>{const{floor:n,cap:t}=hi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Wt&&nr.kind!==_t?.kind?ui.findIndex(e=>e.props.id===Wt.props.id):-1;return o(r>=0?r+1:t)},rl=(e,n)=>{const{floor:t,cap:o}=hi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(vo.reorderComponent(Ne,e,i),vo.select({index:i}),{moved:!0,dest:i})},il=(e,n,t,o)=>{tr(R),vo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Xr(to.sectionAdded({name:t}))},ll=(e,n)=>{const t=ol(n),o=br(e,{nodeDefaults:Ni,newNodeId:$e,sectionLabel:Oi,blockIsOffered:Sr}),r=o?vo.insertNode(Ne,t,o):vo.insertSection(e,t);return il(t,r,Oi(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Be(Vt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=kr(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},sl=e=>dl(Ne,e),dl=(e,n)=>{Ur.current=document.activeElement??null,Zo(null===n?null:{zone:e,index:n}),Qo(!0),ko||(Go.current=!0,Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},al=()=>{Qo(!1),Zo(null),Go.current&&Ft({type:"setUi",ui:{leftSideBarVisible:!1}}),Go.current=!1},cl=(e,n)=>wr.rowName?n?Zt(e)?wr.rowName(e,"section",to.header):qt(e)?wr.rowName(e,"section",to.footer):Kt(e.type)?wr.rowName(e,"section",Ci(e.type)):Ii(e):Hi(e):n?Oi(e.type):Ci(e.type),pl=e=>n=>{e()},ul=(e,n,t)=>{if($t)return null;const o=$i(e)[n];return o&&!Oe(Vt,o.type).delete||o&&gr(o.type,o)?null:/* @__PURE__ */pt(Ye,{kind:"delete",label:e===Ne&&o&&Yt.shared?.usedOn(o)?to.shared.removeFromPage:to.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=$i(e)[n]?.props?.id;null!=t&&xi(String(t))})(e,n),children:/* @__PURE__ */pt(lt,{size:15})})},hl=e=>wr.rowPreview?.(e)||void 0,fl=e=>wr.rowMarks?.(e)??void 0,ml=(e,n,t)=>wr.rowActions?.(e,n,t)??null,gl=(e,n,t,o)=>{if($t)return null;if(gr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
+ return pt(Ye,{kind:"eye",label:r?to.showNamed({name:o}):to.hideNamed({name:o}),onClick:()=>vl(e,n,t),children:/* @__PURE__ */pt(r?st:dt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},yl=e=>Qs(Ne,e),vl=(e,n,t)=>{vo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},bl=e=>Pe(Vt,e),kl=e=>Be(Vt,e),Sl=e=>mr.slotsOf?Mi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Te(e,n.slot)})):[{slot:null,rung:null,kids:ne(Vt,e)}],wl=e=>mr.slotsOf?Sl(e).flatMap(e=>e.kids):ne(Vt,e),xl=e=>Boolean(mr.slotsOf)&&Mi(e).some(e=>e.rung),zl=(e,n,t)=>null===t?void 0===n?kr(e):kr(e,n):kr(e,n,t),Cl=(e,n,t)=>{const o=Me(Vt,e.type,n)&&(t||wl(e).length>0||xl(e));return{collapsible:o,folded:o&&Hr(String(e.props.id))}},Nl=(e,n,t)=>Sl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Cl(e,r,t(e.type)).collapsible?[String(e.props.id),...Nl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ol=e=>wl(e).length>0||xl(e)||Boolean(kr(e.type)),Il=e=>Boolean(kr(e)),Bl=(e,n,t,o)=>{if(tr(R),kr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),vo.select({index:n,zone:e}),l(t)}else vo.select({index:n,zone:e}),l(t)},Pl=(e,n,t,o,r)=>{const i=`${e}:${n}`;vo.insertComponent(i,t,o),kr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),vo.select({index:o,zone:i})}):vo.select({index:o,zone:i})},$l=Ln(/* @__PURE__ */new Set);Fn(()=>{ui.forEach(e=>{const n=kr(e.type)?.spec;if(!n)return;const t=e.props.id;if($l.current.has(t))return;$l.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(Ni)).forEach((e,t)=>mo.seedChild(o,t,n.childType,e))})},[ui,mo,Ni]);const Tl=Ln(/* @__PURE__ */new Set);Fn(()=>{ui.forEach((e,t)=>{const o=e.props.id;if(Tl.current.has(o))return;const r=n(e,bl(e.type));Tl.current.add(o),r&&mo.replaceComponent(Ne,t,{...e,props:r})})},[ui,mo]),Q(mo,Vt);const Ml=ui.findIndex(qt),jl=Ml>=0?ui[Ml]:null,Al=eo?ui.findIndex(Zt):-1,Ll=Al>=0?ui[Al]:null,El=Yt.groupTab,Rl=En(()=>El?e=>Kt(e.type):void 0,[El]),Fl=Boolean(Yt.groupBadge),Dl=Yt.sharedReach,Wl=e=>Dl?.(e)??void 0,Hl=En(()=>Dl?new Set(ui.filter(e=>Wl(e)).map(e=>String(e.props.id))):null,[ui,Dl]),Vl=En(()=>Hl?e=>Hl.has(e):void 0,[Hl]),Yl=Yt.first?Dl?.({type:Yt.first,props:{id:""}})??void 0:void 0,Ul=Yt.groupBadge?/* @__PURE__ */pt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */pt(Un,{tone:"info",size:"xs",children:Yt.groupBadge})}):void 0,Jl=ui.find(e=>e.type===Jt)??null,Xl=ui.find(e=>e.type===Xt)??null,Kl=Ml>=0?Ml:ui.length,Ql=[];ui.forEach(e=>{qt(e)||(Ol(e)&&Ql.push(String(e.props.id)),Ql.push(...Nl(e,1,Il)))}),jl&&(Ql.push(String(jl.props.id)),Ql.push(...Nl(jl,1,Il)));const Gl=Ql.length>0&&Ql.every(e=>Ar.has(e)),_l=e=>{const n=wr.blockRowName(e,Ci);return wr.rowName?wr.rowName(e,"block",n):n},Zl=(e,n,t,o)=>{const r=$i(e)[t];if(!r)return;const i={...Mn(e),index:t},l={...Mn(n),index:Math.min(Math.max(o,0),$i(n).length)},s=bn(i,l);if(e!==n||s!==t)try{vi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof An))throw e}},ql=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of kl(e))n.add(r),t(o)};for(const t of bl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},es=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Bi.get(n);if(!e)return null;if(e.zone===Ne)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ns=e=>{const n=e.slice(0,e.indexOf(":")),t=ui.find(e=>Kt(e.type)&&String(e.props.id)===n);return t&&Qt(n)===e?t:null},ts=(e,n)=>{const t=ns(e);return!t||(!Yt.groupAccepts||Yt.groupAccepts(t.type,n,$i(e).length))},os=(e,n,t)=>{if(e.rung){const t=Ti(e.rung.nodeId),o=t?Mi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===wt&&n.index>=0&&n.index<=o}if(n.slot===wt)return!1;if(e.add)return ss(e.add,n);const o=Tn(n);if(Kt(e.type))return!1;const r=ns(o),i=ns(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!ts(o,e.type))&&(n.index>=0&&n.index<=$i(o).length));if(e.zone===Ne||o===Ne){if(e.zone!==o)return!1;const{floor:t,cap:r}=hi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>$i(o).length)return!1;if(e.zone===o)return!0;const l=jl&&!Yt.lastIsOpen?String(jl.props.id):null;return(!l||es(e.zone)!==l&&es(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??$i(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Bi.get(i),s=l?$i(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ql(r).has(n))return!1;const d=kr(s.type,vr(Rt?.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?.($i(n),r))})(e.zone,o,e.index,t)},rs=(e,n)=>{const t=Tn(e.from),o=e.node;return t===Tn(n)?ts(t,o.type):os({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},is=e=>{const n=e.slice(0,e.indexOf(":")),t=Bi.get(n),o=t?$i(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=kr(o.type,vr(Rt?.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=I(r.choices??(r.spec?[{type:r.spec.childType,label:Ci(r.spec.childType)}]:[])),l=ji(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:cl(o,t.zone===Ne)}},ls=(e,n)=>{if("section"!==e.kind)return e;const t=Tn(n);return t===Ne||ns(t)?e:is(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ss=(e,n)=>{const t=ls(e,n),o=Tn(n);if("shared"===t.kind){if(o!==Ne||!Yt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=hi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ns(o)){const e="section"===t.kind?t.type:t.template.node.type;return ts(o,e)&&n.index>=0&&n.index<=$i(o).length}if(o!==Ne)return!1;const{floor:e,cap:r}=hi();return n.index>=e&&n.index<=r}if(o===Ne)return!1;const r=is(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.($i(o))},ds=(e,n)=>{const t=ls(e,n);if("block"!==t.kind&&ns(Tn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&ts(n,o)){if("section"===e.kind)vo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;vo.insertNode(n,t,gi(e.template.node))}tr(R),vo.select({index:t,zone:n})}})(t,Tn(n),n.index);if("section"===t.kind)return void ll(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=ol(t),r=vo.insertNode(Ne,o,n);il(o,r,e)})(t.template.name,gi(t.template.node),n.index);if("shared"===t.kind){const e=Yt.shared?.nodeOf(t.section);if(!e)return;const o=ol(n.index);return void(vi.restore(e,{parentId:Pn,slot:$n,index:o})&&il(o,e.props.id,t.section.title))}const o=Tn(n),r=is(o);r&&(r.target.spec?Pl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{vo.insertComponent(e,n,t),tr(R),vo.select({index:t,zone:e})})(o,t.type,n.index))},as=(e,n)=>{e.media?function(e){const n=Ys();if(!n||!Ws)return;Js(n).then(n=>{n&&function(e,n){if(!Ws)return;const t=Ws.create(e,{nodeDefaults:Ni,newNodeId:$e,sectionLabel:Oi,blockIsOffered:Sr}),o=Tn(n);if(o===Ne){const e=ol(n.index),o=vo.insertNode(Ne,e,t);return void il(e,o,Oi(t.type))}vo.insertNode(o,n.index,t),tr(R),vo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Fi(e.rung.nodeId,e.index,n.index):e.add?ds(e.add,n):e.zone===Ne?rl(e.index,n.index):Zl(e.zone,Tn(n),e.index,n.index)},[cs]=Rn(()=>yn()),ps=vn({keyOf:e=>e.id,readOnly:Boolean($t),session:cs,canDrop:os,onDrop:as,onStep:(e,n)=>{e.rung?Fi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Ne?((e,n)=>{const t=Oi(ui[e]?.type??""),o=rl(e,n<0?e-1:e+2);if(!o.moved)return void Xr(n<0?to.sectionFirst({name:t}):to.sectionLast({name:t}));const{floor:r,cap:i}=hi();Xr(to.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Zl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),us=Dn(e=>{const{floor:n,cap:t}=hi(),o=[];for(const r of e.nodes){const e=Tn(r.place),i=$i(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Zt(i)||qt(i)||gr(i.type,i))continue;if(Kt(i.type))continue;const l=Boolean(ns(e)),s=e===Ne||l;e===Ne&&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?Oi(i.type):Hi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Tn(e.list);if(n===Ne&&0===e.children.length)return[{...e,addLabel:to.addSection,addAlways:!0}];const t=is(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ns(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Tn(e.list),t=n===Ne||ns(n)?null:is(n);return t?.choices.length?hn(e,t.target.spec?.addLabel??to.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Rt.data]),hs=null==Wt?.props.id?null:String(Wt.props.id),fs=Hn(Le),ms=fs?.selected()&&Wo?.document&&hs?fs.selectedPart?.(Wo.document)??null:null,gs=ms&&hs&&Ee(Rt.data,Vt,hs,ms)?ms:null,ys=gs?.label?{element:gs.element,label:gs.label}:null,vs=null!==gs,bs=Dn(e=>{const n=Vt,t=e=>!e.item.rung&&null!==jn(Rt.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(hs);return i?vs?null:i:r(Ge(Rt.data,n,o.item.id,hs,Rl))??o},[Rt.data,Vt,hs,Rl,vs]),[ks,Ss]=Rn(null),ws=Boolean(El||Dl);zn(Wo,"mouseover",e=>{if(!ws)return;const n=Cn(e.target),t=n?yt(Rt.data,Vt,n):null;t!==ks&&Ss(t)}),zn(Wo,"mouseout",e=>{ws&&!e.relatedTarget&&Ss(null)});const xs=e=>Zt(e)||qt(e)||Kt(e.type),zs=e=>{const n=Kt(e.type)?Ci(e.type):Zt(e)?to.header:qt(e)?to.footer:null;return null===n?Ii(e):wr.rowName?wr.rowName(e,"section",n):n},Cs=[];if(ws){const e=hs?yt(Rt.data,Vt,hs):null;for(const n of/* @__PURE__ */new Set([e,ks])){const e=n?ui.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Zt(e)||e.type===Jt,o=Wl(e);if(o){Cs.push({id:String(e.props.id),label:zs(e),below:t,reach:o});continue}if(!El||!xs(e))continue;const r=El(e);r&&Cs.push({id:String(e.props.id),label:r,below:t})}}const Ns=he(),Os=Ln(null);Fn(()=>{const e=Yt.changeNotice;if(!e)return;const n=JSON.stringify(ui.filter(xs)),t=Os.current;if(Os.current={doc:Yn,bands:n,index:Dt.index},!t||t.doc!==Yn||t.bands===n)return;Dt.hasPast&&Dt.index>=t.index&&!gt.has(Ns)&&(gt.add(Ns),Xr(e,"success",{action:{label:to.bar.undo,onClick:()=>Dt.back()},duration:8e3}))},[ui]);const Is=e=>{tr(R),vo.select(e.zone===Ne?{index:e.index}:{index:e.index,zone:e.zone})},Bs=G(),Ps=()=>({data:Rt.data,device:Oo,ops:vo,inspector:ur}),$s=Bs?.model,Ts=En(()=>$s?e=>$s(e,us(e),Ps()):us,[$s,us,Oo]),Ms=Bs?.measure,js=Ms?(e,n)=>Ms(e,n,Ps()):void 0,As=Bs?.canDrop,Ls=As?(e,n)=>As(e,n,os,Ps()):os,Es=Bs?.drop,Rs=Es?(e,n)=>Es(e,n,as,Ps()):as,Fs=Bs?.pick,Ds=Fs?e=>Fs(e,Is,Ps()):Is,Ws=Bs?.media??null,Hs=Ln(null),Vs=En(()=>Ws?{id:ft,zone:"",index:-1,type:Ws.adds.type,add:{kind:Ws.adds.kind,type:Ws.adds.type},media:!0}:null,[Ws]);Fn(()=>{if(!Vs||$t||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(nt))(e)&&(Hs.current=null,cs.start({key:ft,item:Vs}))},n=e=>{cs.get()?.item.media&&(Hs.current=Qn(e.dataTransfer))},t=()=>{cs.get()?.item.media&&cs.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Vs,$t,cs]);const Ys=()=>{const e=Hs.current;return Hs.current=null,e},Us=ue(),Js=async e=>{if(!Us)return e;const n=await Us(e);return n?{...e,id:n.id,url:n.url}:null};const Xs=(e,n)=>{if(!Ws)return;const t=jn(yo.getState().appState.data,fi,n);if(!t)return;const o=t.node;vo.replaceComponent(Tn(t.place),t.place.index,{...o,props:{...Ws.replace(o,e),id:o.props.id}})},Ks=e=>{const n=Tn(e),t=ji(n);t&&Ei(t.node,t.slot,!1),dl(n,e.index)},Qs=(e,n)=>/* @__PURE__ */pt(Ue,{...$t?{}:ps.seam({place:{...Mn(e),index:n}})},`seam:${e}:${n}`),Gs={rowClick:pl,isCollapsed:Hr,toggleCollapse:Vr},_s=e=>{const n=String(e.props.id),t=ui.findIndex(e=>String(e.props.id)===n),o=Qt(n),r=$i(o),i=Hr(n),l=Ci(e.type),s=wr.rowName?wr.rowName(e,"section",l):l,d=e=>Qs(o,e);/* @__PURE__ */
16
16
  return ut(ht,{children:[
17
- /* @__PURE__ */pt(We,{words:oo,icon:/* @__PURE__ */pt(zr,{type:e.type,size:13}),name:s,preview:hl(e),marks:fl(e),onSelect:()=>tl(t),nameSlot:Wi(Ne,t,n,s),selected:or===n,badge:Hl(e)?void 0:Ul,shared:Hl(e),actions:ml(e,Ne,t)??void 0,rowProps:{"data-node-id":n,onClick:pl(()=>tl(t))},fold:{open:!i,label:"section",onToggle:()=>Vr(n)}}),!i&&/* @__PURE__ */ut(Ue,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ii(n),l=Nl(n),s=l&&Yr(r),a=()=>Bl(o,t,r,e.type),{rowProps:c,...p}=ps.row({item:{id:r,zone:o,index:t,type:n.type},place:{...jn(o),index:t}},{"data-node-id":r,onClick:pl(a)});/* @__PURE__ */
17
+ /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:e.type,size:13}),name:s,preview:hl(e),marks:fl(e),onSelect:()=>tl(t),nameSlot:Yi(Ne,t,n,s),selected:or===n,badge:Wl(e)?void 0:Ul,shared:Wl(e),actions:ml(e,Ne,t)??void 0,rowProps:{"data-node-id":n,onClick:pl(()=>tl(t))},fold:{open:!i,label:"section",onToggle:()=>Vr(n)}}),!i&&/* @__PURE__ */ut(We,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ii(n),l=Ol(n),s=l&&Hr(r),a=()=>Bl(o,t,r,e.type),{rowProps:c,...p}=ps.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Mn(o),index:t}},{"data-node-id":r,onClick:pl(a)});/* @__PURE__ */
18
18
  return ut(Vn,{children:[d(t),
19
- /* @__PURE__ */pt(We,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:i,preview:hl(n),marks:fl(n),onSelect:a,nameSlot:Wi(o,t,r,i),selected:or===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Vr(r)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[ul(o,t,i),ml(n,o,t),gl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */pt(Ue,{children:ed(n,2)})]},r)}),d(r.length)]})]})},_s=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ps.dragging,d=!Yr(l)&&s?.rung?.nodeId!==i,a={...jn(l),index:0},c=s&&!s.rung&&os(s,a)?a:void 0,p=()=>Ei(e,n,!0),{rowProps:u,...h}=ps.row({item:{id:`rung:${l}`,zone:`${i}:${wt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:wt,index:t},into:c,canDrag:Boolean(mr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:pl(p)}),f=$t?null:mr.slotActions?.(e,n.slot);/* @__PURE__ */
19
+ /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:i,preview:hl(n),marks:fl(n),onSelect:a,nameSlot:Yi(o,t,r,i),selected:or===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Vr(r)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[ul(o,t,i),ml(n,o,t),gl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */pt(We,{children:ed(n,2)})]},r)}),d(r.length)]})]})},Zs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ps.dragging,d=!Hr(l)&&s?.rung?.nodeId!==i,a={...Mn(l),index:0},c=s&&!s.rung&&os(s,a)?a:void 0,p=()=>Ei(e,n,!0),{rowProps:u,...h}=ps.row({item:{id:`rung:${l}`,zone:`${i}:${wt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:wt,index:t},into:c,canDrag:Boolean(mr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:pl(p)}),f=$t?null:mr.slotActions?.(e,n.slot);/* @__PURE__ */
20
20
  return ut(Vn,{children:[n.heading,
21
- /* @__PURE__ */pt(We,{words:oo,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Ti===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Vr(l)},actions:f&&f.length>0?/* @__PURE__ */pt(ht,{children:f.map((t,o)=>/* @__PURE__ */pt(Xe,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if($t||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ri(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__ */pt(lt,{size:15}):/* @__PURE__ */pt(ct,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */pt(Ue,{children:r})]},l)},qs=(e,n)=>{const t=Sl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
- return pt(ht,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=zl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Ks(e,n),p=/* @__PURE__ */ut(ht,{children:[i.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),{collapsible:i,folded:s}=Cl(n,l,Il(n.type)),d=String(n.props.id),a=Zl(n),p=()=>Bl(t,o,d,e.type),{rowProps:u,...h}=ps.row({item:{id:d,zone:t,index:o,type:n.type},place:{...jn(t),index:o}},{"data-node-id":d,onClick:pl(p)});/* @__PURE__ */
21
+ /* @__PURE__ */pt(De,{words:oo,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Ai===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Vr(l)},actions:f&&f.length>0?/* @__PURE__ */pt(ht,{children:f.map((t,o)=>/* @__PURE__ */pt(Ye,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if($t||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ri(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__ */pt(lt,{size:15}):/* @__PURE__ */pt(ct,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */pt(We,{children:r})]},l)},qs=(e,n)=>{const t=Sl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
+ return pt(ht,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=zl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Qs(e,n),p=/* @__PURE__ */ut(ht,{children:[i.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),{collapsible:i,folded:s}=Cl(n,l,Il(n.type)),d=String(n.props.id),a=_l(n),p=()=>Bl(t,o,d,e.type),{rowProps:u,...h}=ps.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Mn(t),index:o}},{"data-node-id":d,onClick:pl(p)});/* @__PURE__ */
23
23
  return ut(Vn,{children:[0===o&&c(t,0),
24
- /* @__PURE__ */pt(We,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:a,preview:hl(n),marks:fl(n),onSelect:p,nameSlot:Wi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Vr(d)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[ul(t,o,a),ml(n,t,o),gl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */pt(Ue,{children:qs(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?_s(e,t.rung,r++,o,p):/* @__PURE__ */pt(Vn,{children:p},t.slot??"")})})},ed=(e,n)=>{const t=vr(Rt?.data,e.type,String(e.props.id)),o=Sl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
- return pt(ht,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=zl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Ks(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */ut(ht,{children:[l.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),i=Yi(n),l=String(n.props.id),{collapsible:d,folded:a}=Cl(n,s,Il(n.type)),c=bl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...jn(p),index:$i(p).length}:void 0,h=ps.dragging,f=u&&h&&os(h,u)?u:void 0,g=()=>Bl(t,o,l,e.type),{rowProps:y,...v}=ps.row({item:{id:l,zone:t,index:o,type:n.type},place:{...jn(t),index:o},into:f,canDrag:!gr(n.type,n)},{"data-node-id":l,onClick:pl(g)});/* @__PURE__ */
24
+ /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:a,preview:hl(n),marks:fl(n),onSelect:p,nameSlot:Yi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Vr(d)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[ul(t,o,a),ml(n,t,o),gl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */pt(We,{children:qs(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Zs(e,t.rung,r++,o,p):/* @__PURE__ */pt(Vn,{children:p},t.slot??"")})})},ed=(e,n)=>{const t=vr(Rt?.data,e.type,String(e.props.id)),o=Sl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
+ return pt(ht,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=zl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Qs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */ut(ht,{children:[l.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),i=Hi(n),l=String(n.props.id),{collapsible:d,folded:a}=Cl(n,s,Il(n.type)),c=bl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Mn(p),index:$i(p).length}:void 0,h=ps.dragging,f=u&&h&&os(h,u)?u:void 0,g=()=>Bl(t,o,l,e.type),{rowProps:y,...v}=ps.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Mn(t),index:o},into:f,canDrag:!gr(n.type,n)},{"data-node-id":l,onClick:pl(g)});/* @__PURE__ */
26
26
  return ut(Vn,{children:[0===o&&m(t,0),
27
- /* @__PURE__ */pt(We,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:i,preview:hl(n),marks:fl(n),onSelect:g,nameSlot:Wi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Vr(l)}:void 0,actions:gr(n.type,n)?ml(n,t,o)??void 0:/* @__PURE__ */ut(ht,{children:[ul(t,o,i),ml(n,t,o),gl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */pt(Ue,{children:ed(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
- /* @__PURE__ */pt(S,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Pl(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?_s(e,o.rung,i++,r,v):/* @__PURE__ */pt(Vn,{children:v},o.slot??"")})})},nd=Xo,td=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:ko&&!nd&&fr===e.id,onSelect:()=>ci(e.id)}:e,od=[...(hr.railLead??[]).map(td),{id:"sections",label:to.layers,icon:/* @__PURE__ */pt(ve,{}),active:ko&&!nd&&"sections"===fr,onSelect:()=>ci("sections")},...(hr.railTrail??[]).map(td)],rd=Po?{onPress:$o}:Tt?{onPress:()=>{ae(Sn,{accept:"image/*",title:co.mediaLibrary})}}:null,id={value:od.find(e=>!0===e.active)?.id??"",press:e=>{const n=od.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:od.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */pt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},ld=[...hr.railLead??[],...hr.railTrail??[]].find(e=>"panel"in e&&e.id===fr),sd=Boolean(no?.foldable),dd=no?.label??(Lt?to.pageSections:to.templateSections),ad=sd&&Yr(xt),cd=/* @__PURE__ */ut(ht,{children:[ui.map((e,n)=>{if(_t(e)||qt(e)||Xt(e.type))return null;const t=or===String(e.props.id),o=Boolean(e.props._hidden);kl(e);const r=String(e.props.id),i=hr.hasOwnRows?.(e)??!1,l=Nl(e)||i,s=l&&Yr(r),d=bl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...jn(a),index:$i(a).length}:void 0,p=ps.dragging,u=c&&p&&os(p,c)?c:void 0,{rowProps:h,...f}=ps.row({item:{id:r,zone:Ne,index:n,type:e.type},place:{...jn(Ne),index:n},into:u,canDrag:!gr(e.type,e)},{"data-node-id":r,onClick:pl(()=>tl(n))});/* @__PURE__ */
27
+ /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:i,preview:hl(n),marks:fl(n),onSelect:g,nameSlot:Yi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Vr(l)}:void 0,actions:gr(n.type,n)?ml(n,t,o)??void 0:/* @__PURE__ */ut(ht,{children:[ul(t,o,i),ml(n,t,o),gl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */pt(We,{children:ed(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
+ /* @__PURE__ */pt(S,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Pl(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?Zs(e,o.rung,i++,r,v):/* @__PURE__ */pt(Vn,{children:v},o.slot??"")})})},nd=Ko,td=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:ko&&!nd&&fr===e.id,onSelect:()=>ci(e.id)}:e,od=[...(hr.railLead??[]).map(td),{id:"sections",label:to.layers,icon:/* @__PURE__ */pt(ge,{}),active:ko&&!nd&&"sections"===fr,onSelect:()=>ci("sections")},...(hr.railTrail??[]).map(td)],rd=Po?{onPress:$o}:At?{onPress:()=>{se(Sn,{accept:"image/*",title:co.mediaLibrary})}}:null,id={value:od.find(e=>!0===e.active)?.id??"",press:e=>{const n=od.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:od.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */pt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},ld=[...hr.railLead??[],...hr.railTrail??[]].find(e=>"panel"in e&&e.id===fr),sd=Boolean(no?.foldable),dd=no?.label??(Lt?to.pageSections:to.templateSections),ad=sd&&Hr(xt),cd=/* @__PURE__ */ut(ht,{children:[ui.map((e,n)=>{if(Zt(e)||qt(e)||Kt(e.type))return null;const t=or===String(e.props.id),o=Boolean(e.props._hidden);kl(e);const r=String(e.props.id),i=hr.hasOwnRows?.(e)??!1,l=Ol(e)||i,s=l&&Hr(r),d=bl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Mn(a),index:$i(a).length}:void 0,p=ps.dragging,u=c&&p&&os(p,c)?c:void 0,{rowProps:h,...f}=ps.row({item:{id:r,zone:Ne,index:n,type:e.type},place:{...Mn(Ne),index:n},into:u,canDrag:!gr(e.type,e)},{"data-node-id":r,onClick:pl(()=>tl(n))});/* @__PURE__ */
29
29
  return ut(Vn,{children:[n>0&&yl(n),
30
- /* @__PURE__ */pt(We,{words:oo,icon:/* @__PURE__ */pt(zr,{type:e.type,size:13}),name:Ii(e),preview:hl(e),marks:fl(e),shared:Hl(e),onSelect:()=>tl(n),nameSlot:Wi(Ne,n,r,Ii(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Vr(r)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[ul(Ne,n,Ii(e)),ml(e,Ne,n),gl(Ne,n,e,Ii(e))]}),rowProps:h}),Nl(e)&&!s&&/* @__PURE__ */ut(Ue,{children:[ed(e,1),hr.partRows?.(e,Qs)]}),i&&!s&&/* @__PURE__ */pt(Ue,{children:hr.ownRows?.(e,n,Qs)})]},String(e.props.id??n))}),Xl>0&&yl(Xl)]}),pd=(e,n,t)=>{const o=String(e.props.id),r=wl(e).length>0||xl(e)||Boolean(kr(e.type)),i=r&&Yr(o),l="header"===t?to.header:to.footer,s=wr.rowName?wr.rowName(e,"section",l):l;/* @__PURE__ */
30
+ /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:e.type,size:13}),name:Ii(e),preview:hl(e),marks:fl(e),shared:Wl(e),onSelect:()=>tl(n),nameSlot:Yi(Ne,n,r,Ii(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Vr(r)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[ul(Ne,n,Ii(e)),ml(e,Ne,n),gl(Ne,n,e,Ii(e))]}),rowProps:h}),Ol(e)&&!s&&/* @__PURE__ */ut(We,{children:[ed(e,1),hr.partRows?.(e,Gs)]}),i&&!s&&/* @__PURE__ */pt(We,{children:hr.ownRows?.(e,n,Gs)})]},String(e.props.id??n))}),Kl>0&&yl(Kl)]}),pd=(e,n,t)=>{const o=String(e.props.id),r=wl(e).length>0||xl(e)||Boolean(kr(e.type)),i=r&&Hr(o),l="header"===t?to.header:to.footer,s=wr.rowName?wr.rowName(e,"section",l):l;/* @__PURE__ */
31
31
  return ut(ht,{children:[
32
- /* @__PURE__ */pt(We,{words:oo,icon:/* @__PURE__ */pt(zr,{type:t,size:13}),name:s,preview:hl(e),marks:fl(e),badge:Hl(e)?void 0:Ul,shared:Hl(e),onSelect:()=>tl(n),nameSlot:Wi(Ne,n,o,s),selected:or===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Vr(o)}:void 0,actions:ml(e,Ne,n)??void 0,rowProps:{"data-node-id":o,onClick:pl(()=>tl(n))}}),r&&!i&&/* @__PURE__ */pt(Ue,{children:qs(e,1)})]})};return(hr.wrap??(e=>e))(
33
- /* @__PURE__ */pt(Z,{target:Ho,children:/* @__PURE__ */ut("div",{ref:Do,className:"sf-editor es-editor",style:ln(Er),onContextMenu:Qi.onEditorContextMenu,...p(Sn),children:[
34
- /* @__PURE__ */ut(Ze,{children:[
35
- /* @__PURE__ */ut("div",{className:"es-cluster es-cluster--left",children:[rd?/* @__PURE__ */pt(Jn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */pt(be,{}),onClick:rd.onPress,children:to.railMedia}):null,
36
- /* @__PURE__ */pt(_e,{label:to.bar.undo,disabled:Boolean($t)||!Dt.hasPast,onClick:()=>Dt.back(),children:/* @__PURE__ */pt(tt,{})}),
37
- /* @__PURE__ */pt(_e,{label:to.bar.redo,disabled:Boolean($t)||!Dt.hasFuture,onClick:()=>Dt.forward(),children:/* @__PURE__ */pt(ot,{})})]}),
32
+ /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:t,size:13}),name:s,preview:hl(e),marks:fl(e),badge:Wl(e)?void 0:Ul,shared:Wl(e),onSelect:()=>tl(n),nameSlot:Yi(Ne,n,o,s),selected:or===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Vr(o)}:void 0,actions:ml(e,Ne,n)??void 0,rowProps:{"data-node-id":o,onClick:pl(()=>tl(n))}}),r&&!i&&/* @__PURE__ */pt(We,{children:qs(e,1)})]})};return(hr.wrap??(e=>e))(
33
+ /* @__PURE__ */pt(_,{target:Wo,children:/* @__PURE__ */ut("div",{ref:Do,className:"sf-editor es-editor",style:ln(Er),onContextMenu:Gi.onEditorContextMenu,...p(Sn),children:[
34
+ /* @__PURE__ */ut(_e,{children:[
35
+ /* @__PURE__ */ut("div",{className:"es-cluster es-cluster--left",children:[rd?/* @__PURE__ */pt(Jn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */pt(ye,{}),onClick:rd.onPress,children:to.railMedia}):null,
36
+ /* @__PURE__ */pt(Ze,{label:to.bar.undo,disabled:Boolean($t)||!Dt.hasPast,onClick:()=>Dt.back(),children:/* @__PURE__ */pt(tt,{})}),
37
+ /* @__PURE__ */pt(Ze,{label:to.bar.redo,disabled:Boolean($t)||!Dt.hasFuture,onClick:()=>Dt.forward(),children:/* @__PURE__ */pt(ot,{})})]}),
38
38
  /* @__PURE__ */ut(qe,{children:[
39
- /* @__PURE__ */pt(en,{devices:wo,value:No,onChange:Io}),
40
- /* @__PURE__ */pt(_e,{label:to.bar.refresh,tip:to.bar.refreshTip,onClick:()=>{Fo.current=(()=>{const e=Ho?.document;if(!e)return null;const n=ui.findIndex(qt),t=n>=0?n:ui.length;let o=null;for(let n=0;n<t;n++){const t=ui[n]?.props?.id;if(null==t)continue;const r=Bn(e,`[data-easel-block="${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=Ht?.props?.id??ui[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Ro(e=>e+1)},children:/* @__PURE__ */pt(rt,{})}),hr.barView?.()]}),
39
+ /* @__PURE__ */pt(en,{devices:wo,value:Oo,onChange:Io}),
40
+ /* @__PURE__ */pt(Ze,{label:to.bar.refresh,tip:to.bar.refreshTip,onClick:()=>{Fo.current=(()=>{const e=Wo?.document;if(!e)return null;const n=ui.findIndex(qt),t=n>=0?n:ui.length;let o=null;for(let n=0;n<t;n++){const t=ui[n]?.props?.id;if(null==t)continue;const r=Bn(e,`[data-easel-block="${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=Wt?.props?.id??ui[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Ro(e=>e+1)},children:/* @__PURE__ */pt(rt,{})}),hr.barView?.()]}),
41
41
  /* @__PURE__ */ut(qe,{kind:"right",style:{minWidth:300},children:[
42
- /* @__PURE__ */pt(v,{input:Jo,words:to.saveStatus}),On?/* @__PURE__ */pt(On,{}):null,hr.barLead?.(),hr.barTrail?.(),hr.mainAction||!hr.barMain?/* @__PURE__ */pt(b,{input:Jo,action:hr.mainAction??{label:to.done,onPress:()=>{qn(Rt.data)}},readOnly:Boolean($t),saveSwitch:jt,onToggleAutoSave:Nt,onSaveNow:Go,bar:to.bar,words:to.saveStatus}):hr.barMain()]})]}),
43
- /* @__PURE__ */pt(se,{}),
42
+ /* @__PURE__ */pt(v,{input:Jo,words:to.saveStatus}),Nn?/* @__PURE__ */pt(Nn,{}):null,hr.barLead?.(),hr.barTrail?.(),hr.mainAction||!hr.barMain?/* @__PURE__ */pt(b,{input:Jo,action:hr.mainAction??{label:to.done,onPress:()=>{qn(Rt.data)}},readOnly:Boolean($t),saveSwitch:Mt,onToggleAutoSave:Ot,onSaveNow:Xo,bar:to.bar,words:to.saveStatus}):hr.barMain()]})]}),
43
+ /* @__PURE__ */pt(ie,{}),
44
44
  /* @__PURE__ */ut("div",{className:"sf-body",children:[ko?/* @__PURE__ */ut(ht,{children:[
45
45
  /* @__PURE__ */ut("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":to.leftPanel,children:[
46
46
  /* @__PURE__ */ut("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
47
47
  /* @__PURE__ */pt(C,{side:"left",onHide:di}),
48
48
  /* @__PURE__ */pt("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
49
- /* @__PURE__ */pt(Gn,{variant:"underline",block:!0,"aria-label":to.bar.views,value:id.value,onChange:id.press,items:id.items})]}),Xo?/* @__PURE__ */pt(w,{at:Zo?{label:(e=>{const n=ns(e.zone);if(n)return to.add.addingTo({name:wr.rowName?cl(n,!0):Ci(n.type)});if(e.zone===Ne){const n=ui[e.index];return n&&!qt(n)?to.add.addingBefore({name:cl(n,!0)}):to.add.addingAtEnd}const t=is(e.zone);return t?to.add.addingTo({name:t.parentName}):to.add.addingHere})(Zo),onClear:()=>_o(null)}:void 0,placeBlocks:Zo&&Zo.zone!==Ne?is(Zo.zone)?.choices:void 0,canTake:Zo?e=>{if(!Zo)return null;const n={...jn(Zo.zone),index:Zo.index};if(ss(e,n))return null;if("shared"===e.kind&&Zo.zone===Ne&&!Wt.shared?.nodeOf(e.section))return to.shared.alreadyHere;const t=ns(Zo.zone);if(t)return to.add.notInside({name:cl(t,!0)});if(Zo.zone===Ne)return to.add.onlySections;const o=is(Zo.zone);return o?to.add.notInside({name:o.parentName}):to.add.onlySections}:void 0,onPick:Zo?e=>{if(!Zo)return;const n={...jn(Zo.zone),index:Zo.index};ss(e,n)&&(ds(e,n),al())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:cs,siteWide:hr.addPanelRow?.(al),onClose:al,readOnly:Boolean($t)}):ld?ld.panel({onHide:di,notify:Gr}):/* @__PURE__ */ut(ht,{children:[
50
- /* @__PURE__ */pt(O,{icon:/* @__PURE__ */pt(ve,{}),title:to.layers,context:po,actions:/* @__PURE__ */ut(ht,{children:[!$t&&/* @__PURE__ */pt(nn,{label:to.add.title,onClick:()=>sl(null),children:/* @__PURE__ */pt(it,{size:15})}),
51
- /* @__PURE__ */pt(nn,{label:Ql?to.expandAll:to.collapseAll,title:0===Kl.length?to.nothingToFold:void 0,disabled:0===Kl.length,onClick:()=>Lr(e=>{const n=new Set(Kl);return Ql?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Kl])}),children:/* @__PURE__ */pt(bt,{expand:Ql})})]})}),
52
- /* @__PURE__ */ut(Je,{className:"sf-tree sf-scroll",words:oo,children:[Jl&&/* @__PURE__ */ut(ht,{children:[!Fl&&/* @__PURE__ */pt(Ge,{children:to.header}),Zs(Jl)]}),Et&&!(Fl&&Jl)&&/* @__PURE__ */ut(ht,{children:[!Fl&&/* @__PURE__ */pt(Ge,{children:to.header}),!eo&&/* @__PURE__ */pt(We,{words:oo,icon:/* @__PURE__ */pt(zr,{type:"header",size:13}),name:to.header,badge:Wl?void 0:Ul,shared:Wl,onSelect:pi,selected:nr.kind===Zt?.kind,rowProps:{onClick:pl(pi)}})]}),Ll&&!(Fl&&Jl)&&pd(Ll,Tl,"header"),!sd&&/* @__PURE__ */pt(Ge,{children:dd}),sd?/* @__PURE__ */ut(ht,{children:[
53
- /* @__PURE__ */pt(We,{words:oo,icon:null,name:dd,fold:{open:!ad,label:dd,onToggle:()=>Vr(xt)}}),!ad&&/* @__PURE__ */pt(Ue,{children:cd})]}):cd,Et&&!Fl&&/* @__PURE__ */pt(Ge,{children:to.footer}),Al&&!(Fl&&Gl)&&pd(Al,jl,"footer"),Gl&&Zs(Gl),hr.treeFoot?.()]})]})]}),
54
- /* @__PURE__ */pt(tn,{side:"left",width:Er.left,min:rn.left,max:on,defaultWidth:f.left,label:to.resizeLeftPanel,onResize:Dr})]}):/* @__PURE__ */pt(N,{side:"left",onShow:di}),
55
- /* @__PURE__ */ut("div",{ref:Xr,className:"sf-center sf-scroll","data-sf-canvas-head":qr?"":void 0,style:{overflowX:ii?"auto":"hidden",overflowY:"hidden"},children:[qr&&/* @__PURE__ */pt("div",{ref:ei,className:"sf-canvas-head",children:/* @__PURE__ */pt(qr,{device:No})}),
49
+ /* @__PURE__ */pt(Xn,{variant:"underline",block:!0,"aria-label":to.bar.views,value:id.value,onChange:id.press,items:id.items})]}),Ko?/* @__PURE__ */pt(w,{at:_o?{label:(e=>{const n=ns(e.zone);if(n)return to.add.addingTo({name:wr.rowName?cl(n,!0):Ci(n.type)});if(e.zone===Ne){const n=ui[e.index];return n&&!qt(n)?to.add.addingBefore({name:cl(n,!0)}):to.add.addingAtEnd}const t=is(e.zone);return t?to.add.addingTo({name:t.parentName}):to.add.addingHere})(_o),onClear:()=>Zo(null)}:void 0,placeBlocks:_o&&_o.zone!==Ne?is(_o.zone)?.choices:void 0,canTake:_o?e=>{if(!_o)return null;const n={...Mn(_o.zone),index:_o.index};if(ss(e,n))return null;if("shared"===e.kind&&_o.zone===Ne&&!Yt.shared?.nodeOf(e.section))return to.shared.alreadyHere;const t=ns(_o.zone);if(t)return to.add.notInside({name:cl(t,!0)});if(_o.zone===Ne)return to.add.onlySections;const o=is(_o.zone);return o?to.add.notInside({name:o.parentName}):to.add.onlySections}:void 0,onPick:_o?e=>{if(!_o)return;const n={...Mn(_o.zone),index:_o.index};ss(e,n)&&(ds(e,n),al())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:cs,siteWide:hr.addPanelRow?.(al),onClose:al,readOnly:Boolean($t)}):ld?ld.panel({onHide:di,notify:Xr}):/* @__PURE__ */ut(ht,{children:[
50
+ /* @__PURE__ */pt(N,{icon:/* @__PURE__ */pt(ge,{}),title:to.layers,context:po,actions:/* @__PURE__ */ut(ht,{children:[!$t&&/* @__PURE__ */pt(nn,{label:to.add.title,onClick:()=>sl(null),children:/* @__PURE__ */pt(it,{size:15})}),
51
+ /* @__PURE__ */pt(nn,{label:Gl?to.expandAll:to.collapseAll,title:0===Ql.length?to.nothingToFold:void 0,disabled:0===Ql.length,onClick:()=>Lr(e=>{const n=new Set(Ql);return Gl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ql])}),children:/* @__PURE__ */pt(bt,{expand:Gl})})]})}),
52
+ /* @__PURE__ */ut(He,{className:"sf-tree sf-scroll",words:oo,children:[Jl&&/* @__PURE__ */ut(ht,{children:[!Fl&&/* @__PURE__ */pt(Ve,{children:to.header}),_s(Jl)]}),Et&&!(Fl&&Jl)&&/* @__PURE__ */ut(ht,{children:[!Fl&&/* @__PURE__ */pt(Ve,{children:to.header}),!eo&&/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:"header",size:13}),name:to.header,badge:Yl?void 0:Ul,shared:Yl,onSelect:pi,selected:nr.kind===_t?.kind,rowProps:{onClick:pl(pi)}})]}),Ll&&!(Fl&&Jl)&&pd(Ll,Al,"header"),!sd&&/* @__PURE__ */pt(Ve,{children:dd}),sd?/* @__PURE__ */ut(ht,{children:[
53
+ /* @__PURE__ */pt(De,{words:oo,icon:null,name:dd,fold:{open:!ad,label:dd,onToggle:()=>Vr(xt)}}),!ad&&/* @__PURE__ */pt(We,{children:cd})]}):cd,Et&&!Fl&&/* @__PURE__ */pt(Ve,{children:to.footer}),jl&&!(Fl&&Xl)&&pd(jl,Ml,"footer"),Xl&&_s(Xl),hr.treeFoot?.()]})]})]}),
54
+ /* @__PURE__ */pt(tn,{side:"left",width:Er.left,min:rn.left,max:on,defaultWidth:f.left,label:to.resizeLeftPanel,onResize:Dr})]}):/* @__PURE__ */pt(O,{side:"left",onShow:di}),
55
+ /* @__PURE__ */ut("div",{ref:Kr,className:"sf-center sf-scroll","data-sf-canvas-head":qr?"":void 0,style:{overflowX:ii?"auto":"hidden",overflowY:"hidden"},children:[qr&&/* @__PURE__ */pt("div",{ref:ei,className:"sf-canvas-head",children:/* @__PURE__ */pt(qr,{device:Oo})}),
56
56
  /* @__PURE__ */ut("div",{className:"sf-frame-scaler",style:li,children:[
57
- /* @__PURE__ */pt("div",{className:"sf-frame "+(No===Co?"":`sf-frame--${No}`),style:si,children:/* @__PURE__ */ut("div",{className:"sf-preview-host",children:[
58
- /* @__PURE__ */pt(Fe.Provider,{value:Rl,children:/* @__PURE__ */pt(De.Provider,{value:Vl,children:/* @__PURE__ */pt(uo,{},Eo)})}),
59
- /* @__PURE__ */pt(fn,{canvas:Ho,session:cs,model:Ms,measure:As,canDrop:Ls,onDrop:Rs,choose:bs,tag:ys,onPick:Ds,dropOn:Hs?{accepts:(e,n)=>{if(!e.media||!Hs||n.item.rung)return!1;const t=An(Rt.data,fi,n.item.id);return null!==t&&Hs.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ws();n&&Hs&&Js(n).then(n=>{n&&Gs(n,e.item.id)})})(n),label:()=>to.canvasReplaceImage}:void 0,onZoneAdd:Xs,onSeamAdd:Xs,zoneAddLabel:to.canvasAddBlock,words:ro.canvas,readOnly:Boolean($t),revision:Rt.data}),qo.length>0&&!Yo&&/* @__PURE__ */pt("div",{className:"sf-preview-gaps",children:qo.map(e=>
60
- /* @__PURE__ */pt(mn,{index:e.index,label:to.addSectionHere,onInsert:()=>sl(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),ws?/* @__PURE__ */pt(vt,{canvas:Ho,tabs:Cs,onSelect:e=>{const n=ui.findIndex(n=>String(n.props.id)===e);n>=0&&tl(n)}}):null]})]}),So?/* @__PURE__ */ut(ht,{children:[Nn?
61
- /* @__PURE__ */pt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Nn}):/* @__PURE__ */pt(ht,{children:/* @__PURE__ */pt(u,{value:{selectChild:Bl,addChild:Pl,childRowName:Yi,blockRowName:Zl},children:/* @__PURE__ */pt(ho,{mode:nr,onOpenWebsiteSettings:hr.openSettings??(()=>{}),onOpenSiteStyles:hr.openStyles,onOpenPageStyles:hr.openPageStyles,onSelectNode:Ir,onNotify:Gr,onHidePanel:ai,nodeActions:Ht?Ie(Vt,Ht.type):zt})})}),
62
- /* @__PURE__ */pt(tn,{side:"right",width:Er.right,min:rn.right,max:on,defaultWidth:f.right,label:to.resizeSettingsPanel,onResize:Hr})]}):
63
- /* @__PURE__ */pt(N,{side:"right",onShow:ai})]}),Qi.menu,
64
- /* @__PURE__ */pt(te,{}),ki?/* @__PURE__ */pt(mt,{name:ki.name,onMake:e=>(async(e,n)=>{const t=ui.find(n=>String(n.props.id)===e),o=Wt.shared;if(!t||!o)return;let r;try{r=await z(bi).create(n,t)}catch{return void Gr(to.shared.makeFailed,"error")}o.adopt(t,r),Si(null)})(ki.id,e),onCancel:()=>Si(null)}):null]})}))}export{Ot as ScreenChrome};
57
+ /* @__PURE__ */pt("div",{className:"sf-frame "+(Oo===Co?"":`sf-frame--${Oo}`),style:si,children:/* @__PURE__ */ut("div",{className:"sf-preview-host",children:[
58
+ /* @__PURE__ */pt(Re.Provider,{value:Rl,children:/* @__PURE__ */pt(Fe.Provider,{value:Vl,children:/* @__PURE__ */pt(uo,{},Eo)})}),
59
+ /* @__PURE__ */pt(fn,{canvas:Wo,session:cs,model:Ts,measure:js,canDrop:Ls,onDrop:Rs,choose:bs,tag:ys,onPick:Ds,dropOn:Ws?{accepts:(e,n)=>{if(!e.media||!Ws||n.item.rung)return!1;const t=jn(Rt.data,fi,n.item.id);return null!==t&&Ws.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ys();n&&Ws&&Js(n).then(n=>{n&&Xs(n,e.item.id)})})(n),label:()=>to.canvasReplaceImage}:void 0,onZoneAdd:Ks,onSeamAdd:Ks,zoneAddLabel:to.canvasAddBlock,words:ro.canvas,readOnly:Boolean($t),revision:Rt.data}),qo.length>0&&!Ho&&/* @__PURE__ */pt("div",{className:"sf-preview-gaps",children:qo.map(e=>
60
+ /* @__PURE__ */pt(mn,{index:e.index,label:to.addSectionHere,onInsert:()=>sl(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),ws?/* @__PURE__ */pt(vt,{canvas:Wo,tabs:Cs,onSelect:e=>{const n=ui.findIndex(n=>String(n.props.id)===e);n>=0&&tl(n)}}):null]})]}),So?/* @__PURE__ */ut(ht,{children:[On?
61
+ /* @__PURE__ */pt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:On}):/* @__PURE__ */pt(ht,{children:/* @__PURE__ */pt(u,{value:{selectChild:Bl,addChild:Pl,childRowName:Hi,blockRowName:_l},children:/* @__PURE__ */pt(ho,{mode:nr,onOpenWebsiteSettings:hr.openSettings??(()=>{}),onOpenSiteStyles:hr.openStyles,onOpenPageStyles:hr.openPageStyles,onSelectNode:Ir,onNotify:Xr,onHidePanel:ai,nodeActions:Wt?Oe(Vt,Wt.type):zt})})}),
62
+ /* @__PURE__ */pt(tn,{side:"right",width:Er.right,min:rn.right,max:on,defaultWidth:f.right,label:to.resizeSettingsPanel,onResize:Wr})]}):
63
+ /* @__PURE__ */pt(O,{side:"right",onShow:ai})]}),Gi.menu,
64
+ /* @__PURE__ */pt(te,{}),ki?/* @__PURE__ */pt(mt,{name:ki.name,onMake:e=>(async(e,n)=>{const t=ui.find(n=>String(n.props.id)===e),o=Yt.shared;if(!t||!o)return;let r;try{r=await z(bi).create(n,t)}catch{return void Xr(to.shared.makeFailed,"error")}o.adopt(t,r),Si(null)})(ki.id,e),onCancel:()=>Si(null)}):null]})}))}export{Nt as ScreenChrome};
@@ -1,2 +1,2 @@
1
- import{useEaselHost as e}from"./chunk-MQA7OFRA.js";import{createContext as n,useState as t,useEffect as r,useMemo as l,useContext as o,useSyncExternalStore as s,useRef as u}from"react";import{jsx as c}from"react/jsx-runtime";var i=/* @__PURE__ */new Set,f=()=>{for(const e of[...i])e()};function a(){let e=null,n=!1;const t=/* @__PURE__ */new Set,r=()=>{for(const e of[...t])e();f()},l=(t,l)=>{if(!e||e.request.requestId!==t)return;const{resolve:o}=e;e=null,n=!1,r(),o(l)};return{current:()=>e?.request??null,request:n=>new Promise(t=>{const l=e;e={request:n,resolve:t},r(),l?.resolve(null)}),settle:l,cancel:()=>{e&&l(e.request.requestId,null)},browsing:()=>n,browse:()=>{n||(n=!0,r())},close:()=>{e&&l(e.request.requestId,null),n&&(n=!1,r())},subscribe:e=>(t.add(e),()=>{t.delete(e)})}}var p=[],b=null,d=a(),h=()=>p[p.length-1]??b,w=()=>h()?.store??d,q=n(null);function v({panel:n,place:o=null,children:s}){const u=e(),[i]=t(()=>({panel:n,place:o,host:u,store:a()}));i.panel=n,i.place=o,i.host=u,p.includes(i)||(b=i),r(()=>{const e=p.indexOf(i);return e>=0&&p.splice(e,1),p.push(i),b?.host===i.host&&(b=null),f(),()=>{const e=p.indexOf(i);e>=0&&p.splice(e,1),b===i&&(b=null),i.store.cancel(),f()}},[i]);const d=l(()=>({panel:n,place:o,store:i.store}),[n,o,i]);/* @__PURE__ */
2
- return c(q.Provider,{value:d,children:s})}function m(){return o(q)?.place??null}function g(){return o(q)?.panel??null}function x(e){let n=null;for(let t=p.length-1;t>=0&&!n;t-=1)p[t].host===e&&(n=p[t]);n||b?.host!==e||(n=b);const t=n??h();return t?.panel?t.store:null}function O(){return null!=h()?.panel}function j(e){return w().request(e)}function I(e,n){for(const{store:t}of[...p])t.settle(e,n);b?.store.settle(e,n),d.settle(e,n)}function A(){w().cancel()}var P={current:()=>w().current(),browsing:()=>w().browsing(),browse:()=>w().browse(),close:()=>w().close(),subscribe:e=>(i.add(e),()=>{i.delete(e)}),cancel:()=>w().cancel()};function S(){return o(q)?.store??P}var k=()=>null,F=()=>!1;function M(){const e=S();return s(e.subscribe,e.current,k)}function Q(){const e=S();return s(e.subscribe,e.browsing,F)}function R(){return S().browse}function y(){return S().close}function z(e,n){const t=S(),l=u(n);r(()=>{Object.is(l.current,n)||(l.current=n,e&&t.cancel())},[e,n,t])}export{v as MediaPanelProvider,A as cancelPanelPick,a as createMediaPickStore,O as hasMediaPanel,x as mediaPickStoreFor,j as requestPanelPick,I as settlePanelPick,y as useCloseMediaPopup,Q as useMediaBrowsing,g as useMediaPanel,m as useMediaPlace,R as useOpenMediaBrowse,M as usePanelPick,z as usePickFollowsSelection};
1
+ import{useEaselHost as e}from"./chunk-LX23TCTP.js";import{createContext as n,useState as t,useEffect as r,useMemo as l,useContext as o,useSyncExternalStore as s,useRef as u}from"react";import{jsx as c}from"react/jsx-runtime";var i=/* @__PURE__ */new Set,f=()=>{for(const e of[...i])e()};function a(){let e=null,n=!1;const t=/* @__PURE__ */new Set,r=()=>{for(const e of[...t])e();f()},l=(t,l)=>{if(!e||e.request.requestId!==t)return;const{resolve:o}=e;e=null,n=!1,r(),o(l)};return{current:()=>e?.request??null,request:n=>new Promise(t=>{const l=e;e={request:n,resolve:t},r(),l?.resolve(null)}),settle:l,cancel:()=>{e&&l(e.request.requestId,null)},browsing:()=>n,browse:()=>{n||(n=!0,r())},close:()=>{e&&l(e.request.requestId,null),n&&(n=!1,r())},subscribe:e=>(t.add(e),()=>{t.delete(e)})}}var p=[],b=null,d=a(),h=()=>p[p.length-1]??b,w=()=>h()?.store??d,q=n(null);function v({panel:n,place:o=null,children:s}){const u=e(),[i]=t(()=>({panel:n,place:o,host:u,store:a()}));i.panel=n,i.place=o,i.host=u,p.includes(i)||(b=i),r(()=>{const e=p.indexOf(i);return e>=0&&p.splice(e,1),p.push(i),b?.host===i.host&&(b=null),f(),()=>{const e=p.indexOf(i);e>=0&&p.splice(e,1),b===i&&(b=null),i.store.cancel(),f()}},[i]);const d=l(()=>({panel:n,place:o,store:i.store}),[n,o,i]);/* @__PURE__ */
2
+ return c(q.Provider,{value:d,children:s})}function m(){return o(q)?.place??null}function g(){return o(q)?.panel??null}function x(e){let n=null;for(let t=p.length-1;t>=0&&!n;t-=1)p[t].host===e&&(n=p[t]);n||b?.host!==e||(n=b);const t=n??h();return t?.panel?t.store:null}function j(){return null!=h()?.panel}function I(e){return w().request(e)}function O(e,n){for(const{store:t}of[...p])t.settle(e,n);b?.store.settle(e,n),d.settle(e,n)}function P(){w().cancel()}var S={current:()=>w().current(),browsing:()=>w().browsing(),browse:()=>w().browse(),close:()=>w().close(),subscribe:e=>(i.add(e),()=>{i.delete(e)}),cancel:()=>w().cancel()};function T(){return o(q)?.store??S}var k=()=>null,C=()=>!1;function L(){const e=T();return s(e.subscribe,e.current,k)}function X(){const e=T();return s(e.subscribe,e.browsing,C)}function y(){return T().browse}function z(){return T().close}function A(e,n){const t=T(),l=u(n);r(()=>{Object.is(l.current,n)||(l.current=n,e&&t.cancel())},[e,n,t])}export{v as MediaPanelProvider,P as cancelPanelPick,a as createMediaPickStore,j as hasMediaPanel,x as mediaPickStoreFor,I as requestPanelPick,O as settlePanelPick,z as useCloseMediaPopup,X as useMediaBrowsing,g as useMediaPanel,m as useMediaPlace,y as useOpenMediaBrowse,L as usePanelPick,A as usePickFollowsSelection};
@@ -1 +1 @@
1
- import{applyEaselChromeTheme as e}from"./chunk-LOMEH6DG.js";import{useEaselSession as t}from"./chunk-YM4UEGBV.js";import{currentEaselSession as n,setSessionBridgedSite as r}from"./chunk-SNF5764Q.js";import{useEaselHost as o}from"./chunk-MQA7OFRA.js";import{useState as s,useRef as a,useEffect as c}from"react";var u={canCreatePlatformTemplate:!1};function i(t,o={}){const s=o.session??n();s.auth.token=t.token,s.auth.brandId=t.brandId??null,r(s,t.siteId),(o.stampChromeTheme??!0)&&e(t.theme)}function m(e){const[n,r]=s(null),m=a(null),[l,f]=s(u),d=a(e?.onAuth),k=a(e?.onMessage);c(()=>{d.current=e?.onAuth,k.current=e?.onMessage});const p=o(),h=t();return c(()=>{const e=p.subscribe(e=>{const t=e;if("storefront-editor:auth"===t.type&&"string"==typeof t.token&&t.token){const e=!!m.current;m.current=t.token,r(t.token),i({...t,token:t.token},{stampChromeTheme:p.ownsDocument,session:h}),f((n=t.can)&&"object"==typeof n?{canCreatePlatformTemplate:!0===n.canCreatePlatformTemplate}:u),d.current?.(e)}else k.current?.(e);var n});if(p.send("storefront-editor:ready"),!h.usesBridgedToken)return e;const t=window.setInterval(()=>{m.current?window.clearInterval(t):p.send("storefront-editor:ready")},500);return()=>{e(),window.clearInterval(t)}},[p,h]),{token:n,tokenRef:m,capabilities:l}}export{u as NO_BRIDGED_CAPABILITIES,i as applyAuthGrant,m as useAdminBridge};
1
+ import{applyEaselChromeTheme as e}from"./chunk-LOMEH6DG.js";import{useEaselSession as t}from"./chunk-YM4UEGBV.js";import{currentEaselSession as n,setSessionBridgedSite as r}from"./chunk-SNF5764Q.js";import{useEaselHost as o}from"./chunk-LX23TCTP.js";import{useState as s,useRef as a,useEffect as c}from"react";var u={canCreatePlatformTemplate:!1};function i(t,o={}){const s=o.session??n();s.auth.token=t.token,s.auth.brandId=t.brandId??null,r(s,t.siteId),(o.stampChromeTheme??!0)&&e(t.theme)}function m(e){const[n,r]=s(null),m=a(null),[l,f]=s(u),d=a(e?.onAuth),k=a(e?.onMessage);c(()=>{d.current=e?.onAuth,k.current=e?.onMessage});const p=o(),h=t();return c(()=>{const e=p.subscribe(e=>{const t=e;if("storefront-editor:auth"===t.type&&"string"==typeof t.token&&t.token){const e=!!m.current;m.current=t.token,r(t.token),i({...t,token:t.token},{stampChromeTheme:p.ownsDocument,session:h}),f((n=t.can)&&"object"==typeof n?{canCreatePlatformTemplate:!0===n.canCreatePlatformTemplate}:u),d.current?.(e)}else k.current?.(e);var n});if(p.send("storefront-editor:ready"),!h.usesBridgedToken)return e;const t=window.setInterval(()=>{m.current?window.clearInterval(t):p.send("storefront-editor:ready")},500);return()=>{e(),window.clearInterval(t)}},[p,h]),{token:n,tokenRef:m,capabilities:l}}export{u as NO_BRIDGED_CAPABILITIES,i as applyAuthGrant,m as useAdminBridge};
@@ -1 +1 @@
1
- import{useScreenBlockRules as e}from"./chunk-DCBSRZ6Z.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-FEF3OQRT.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
1
+ import{useScreenBlockRules as e}from"./chunk-QORC32JO.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-FJTCSQWK.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
@@ -0,0 +1,5 @@
1
+ import{usePickFollowsSelection as n}from"./chunk-NCXYC7WI.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-FJTCSQWK.js";import{Inspector as i}from"./chunk-H4Z2V56N.js";import{fieldIsShown as u}from"./chunk-BPXEFVSQ.js";import{createContext as l,useContext as s}from"react";import{DesktopIcon as c}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";var a={kind:"selection"};function d(n){return"selection"===n.kind}function p(n,e){if(d(n)&&d(e))return!0;const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function m(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function k(n,t){const r=n.components?.[t.type]?.fields??{};return e(n,t.type).filter(n=>u(r[n],{values:t.props}))}function h(n,e){return k(n,e).flatMap(n=>t(e,n))}function v(n,e,t){const r=n.slotsOf?.(t);return r||k(e,t).map(n=>({slot:n,label:n,rung:!1}))}function y(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function g(n,e){return n.isLast?n.isLast(e):e.type===n.last}var b={},O=()=>b,j=()=>"",C=()=>null,S=()=>{},w={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},N={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */f(c,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},P={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},B={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function D(){/* @__PURE__ */
2
+ return f(r,{height:"fill"})}function F(){const{id:n,fields:e,values:t,readOnly:r,onChange:u}=o();/* @__PURE__ */
3
+ return f("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */f(i,{fields:e,values:t,onChange:u,readOnly:r,idPrefix:n})})}var I=l({});function T({parts:n,children:e}){/* @__PURE__ */
4
+ return f(I.Provider,{value:n,children:e})}function x(){return s(I)}function A(){return(x().useOwnerName??j)()}function G(){return(x().useDocumentLabel??C)()}function Q(n,e,t,r){return(x().useBridges??O)(n,e,t,r)}function V(n){return(x().useStandaloneBridges??O)(n)}function Y(n,e){(x().useDocumentPass??S)(n,e)}function H(){return x().blockRules??w}function K(){return x().blockLook??L}function R(){return x().devices??N}function W(){return x().leftView??P}function X(){return x().pinned??B}function Z(){return x().saveSwitch??!0}function E(e){n(!0===x().pickFollowsSelection,e)}function J(){return x().storageNamespace||void 0}function M(){return x().styleClipboard??null}function q(){return x().nodeKeys??!0}function z(){return x().notify??null}function U(){return x().Canvas??D}function $(){return x().CanvasHead??null}function _(){return x().canvasDrag??null}var nn=l(null);function en({target:n,children:e}){/* @__PURE__ */
5
+ return f(nn.Provider,{value:n,children:e})}function tn(){return s(nn)}function rn(){return x().Inspector??F}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,T as ScreenPartsProvider,y as isPinnedFirst,g as isPinnedLast,d as isSelectionMode,m as isSlotMode,p as sameInspectorMode,v as screenSlotsOf,h as shownChildSlotsOf,k as shownSlotFieldsOf,K as useScreenBlockLook,H as useScreenBlockRules,Q as useScreenBridges,_ as useScreenCanvasDrag,U as useScreenCanvasFrame,$ as useScreenCanvasHead,tn as useScreenCanvasTarget,R as useScreenDevices,G as useScreenDocumentLabel,Y as useScreenDocumentPass,rn as useScreenInspectorPanel,W as useScreenLeftView,q as useScreenNodeKeys,z as useScreenNotify,A as useScreenOwnerName,x as useScreenParts,E as useScreenPickFollowsSelection,X as useScreenPinned,Z as useScreenSaveSwitch,J as useScreenStorageNamespace,M as useScreenStyleClipboard,V as useStandaloneScreenBridges};
@@ -1 +1 @@
1
- import{useMediaPanel as o,usePanelPick as r,useMediaBrowsing as n,useCloseMediaPopup as t,settlePanelPick as e}from"./chunk-FHCKFOCD.js";import{jsx as i}from"react/jsx-runtime";function c(){const c=o(),s=r(),u=n(),m=t();return c?/* @__PURE__ */i(c,{pick:s,browsing:u,onPick:o=>{s&&e(s.requestId,o)},onClose:m}):null}export{c as MediaPopup};
1
+ import{useMediaPanel as o,usePanelPick as r,useMediaBrowsing as n,useCloseMediaPopup as t,settlePanelPick as e}from"./chunk-NCXYC7WI.js";import{jsx as i}from"react/jsx-runtime";function c(){const c=o(),s=r(),u=n(),m=t();return c?/* @__PURE__ */i(c,{pick:s,browsing:u,onPick:o=>{s&&e(s.requestId,o)},onClose:m}):null}export{c as MediaPopup};
@@ -0,0 +1,15 @@
1
+ import{DEFAULT_PANEL_WORDS as e}from"./chunk-KFV7N2DJ.js";import{SettingsField as l,SettingsSegmented as n}from"./chunk-CZAAGBVL.js";import{AccordionHeading as a,SettingReset as i,Tooltip as t}from"efficient-shell/ui";export{AlignmentGrid,BorderInput,CornersInput,SidesEachToggle,SidesInput,borderSides,borderStartEach,sidesStartEach}from"efficient-shell/ui";import{jsx as s,jsxs as d,Fragment as o}from"react/jsx-runtime";import{BackgroundIcon as r,WidthIcon as c}from"efficient-shell/icons/efficient";function u({title:e,level:l=3,id:n,className:i}){/* @__PURE__ */
2
+ return s(a,{title:e,level:l,id:n,className:i?`es-panel-band ${i}`:"es-panel-band"})}function b({title:e,level:l=4,id:n,className:i}){/* @__PURE__ */
3
+ return s(a,{tier:"row",title:e,level:l,id:n,className:i})}function h({label:l,changed:n,onReset:a,detail:t,disabled:d,defaultAction:o,words:r,className:c}){const u={...e,...r},b=u.resetName({label:l});/* @__PURE__ */
4
+ return s(i,{label:l,changed:n,onReset:a,detail:t,disabled:d,defaultAction:o,name:b,tip:t?u.resetTitle({label:l,detail:t}):b,className:c})}function m({name:e,preview:l,offPage:n,status:a,onOpen:i,id:r,className:c}){const u=null!=l;/* @__PURE__ */
5
+ return d("button",{type:"button",id:r,className:c?`es-drill ${c}`:"es-drill",onClick:i,children:[
6
+ /* @__PURE__ */d(t,{content:u?/* @__PURE__ */d(o,{children:[e,
7
+ /* @__PURE__ */s("br",{}),l]}):e,describe:!1,className:"es-drill-text",children:[
8
+ /* @__PURE__ */s("span",{className:"es-drill-name",children:e}),u?/* @__PURE__ */s("span",{className:n?"es-drill-preview is-offpage":"es-drill-preview",children:l}):null]}),a?/* @__PURE__ */s("span",{className:"es-drill-status",children:a}):null,
9
+ /* @__PURE__ */s("span",{className:"es-drill-chev","aria-hidden":"true"})]})}function f({label:e,onPress:l,disabled:n,note:a,done:i,doneLabel:t,icon:o,id:r,className:c}){const u=void 0===t?e:t,b=i?u:e,h=null!=a,m=h&&r?`${r}-note`:void 0;/* @__PURE__ */
10
+ return d("div",{className:c?`es-action-wrap ${c}`:"es-action-wrap",children:[
11
+ /* @__PURE__ */d("button",{type:"button",id:r,className:i?"es-action is-done":"es-action",disabled:n,"aria-describedby":m,onClick:l,children:[o?/* @__PURE__ */s("span",{className:"es-action-icon","aria-hidden":"true",children:o}):null,
12
+ /* @__PURE__ */s("span",{className:"es-action-label",children:b})]}),h?/* @__PURE__ */s("p",{id:m,className:"es-action-note",children:a}):null,
13
+ /* @__PURE__ */s("span",{className:"es-action-live",role:"status","aria-live":"polite",children:i?u:null})]})}var p=["full","content"],N={label:"Background",full:"Full width",content:"Content width"};function v({value:e,changed:a,detail:i,onChange:t,onReset:d,disabled:o=!1,hint:c,labelId:u,words:b,resetWords:m}){const f={...N,...b};/* @__PURE__ */
14
+ return s(l,{label:f.label,labelId:u,icon:/* @__PURE__ */s(r,{}),changed:a,hint:c,action:/* @__PURE__ */s(h,{words:m,label:f.label,changed:a,detail:i,onReset:d}),children:/* @__PURE__ */s(n,{options:p.map(e=>({id:e,label:"full"===e?f.full:f.content})),value:e,onChange:t,ariaLabel:f.label,disabled:o})})}var g={label:"Content",full:"Full width",content:"Content width"};function w({mode:e,onMode:a,number:i,changed:t,detail:o,onReset:r,fullClosed:u=!1,disabled:b=!1,hint:m,labelId:f,words:N,resetWords:v}){const w={...g,...N},C=void 0!==e&&a?/* @__PURE__ */s(n,{options:p.map(e=>({id:e,label:"full"===e?w.full:w.content,disabled:"full"===e&&u})),value:e,onChange:a,ariaLabel:w.label,disabled:b}):null;/* @__PURE__ */
15
+ return s(l,{label:w.label,labelId:f,icon:/* @__PURE__ */s(c,{}),changed:t,hint:m,action:/* @__PURE__ */s(h,{words:v,label:w.label,changed:t,detail:o,onReset:r}),children:C&&i?/* @__PURE__ */d("div",{className:"es-width-stack",children:[C,i]}):C??i??null})}export{p as BACKGROUND_WIDTHS,N as DEFAULT_BACKGROUND_WIDTH_WORDS,g as DEFAULT_CONTENT_WIDTH_WORDS,f as SettingsAction,v as SettingsBackgroundWidth,w as SettingsContentWidth,h as SettingsDefaultReset,m as SettingsDrill,u as SettingsGroupHead,b as SettingsGroupSub};