efficient-easel 11.3.0 → 12.0.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 (109) hide show
  1. package/README.md +20 -41
  2. package/dist/{canvas-typing-DvoqQINU.d.ts → canvas-typing-CZ11Y5tb.d.ts} +16 -105
  3. package/dist/chrome/chrome.css +5 -5
  4. package/dist/chunk-2SOOKBHH.js +21 -0
  5. package/dist/{chunk-66LWADFP.js → chunk-2XMHLXMA.js} +1 -1
  6. package/dist/chunk-33C6ALT5.js +1 -0
  7. package/dist/{chunk-XJCMEEBH.js → chunk-36LVP5WD.js} +7 -7
  8. package/dist/chunk-47JTYRQC.js +2 -0
  9. package/dist/{chunk-EXKKLTXH.js → chunk-5NM5TPAX.js} +1 -1
  10. package/dist/{chunk-ZXGQT75B.js → chunk-5QP7ZE35.js} +1 -1
  11. package/dist/chunk-5R7FE4VT.js +57 -0
  12. package/dist/{chunk-FPAVNX3Y.js → chunk-5XUMLKQF.js} +3 -3
  13. package/dist/{chunk-PPL7GB7D.js → chunk-62VPYC7F.js} +1 -1
  14. package/dist/chunk-643PVCEG.js +1 -0
  15. package/dist/chunk-AYWN5NRH.js +1 -0
  16. package/dist/{chunk-4ACVXF5V.js → chunk-CZYR5V77.js} +1 -1
  17. package/dist/{chunk-PPHUWGLZ.js → chunk-EC2I7SIY.js} +1 -1
  18. package/dist/{chunk-DGAXQTDW.js → chunk-FHLYUIJJ.js} +1 -1
  19. package/dist/{chunk-65Z5FSAW.js → chunk-G3GWAP5R.js} +5 -5
  20. package/dist/{chunk-2FZJWH24.js → chunk-H4UMY7QF.js} +1 -1
  21. package/dist/chunk-KE2CXEIK.js +13 -0
  22. package/dist/chunk-KR4OCYRP.js +1 -0
  23. package/dist/{chunk-IFS5P7CO.js → chunk-LZS7JZK5.js} +1 -1
  24. package/dist/chunk-O3RLI7XE.js +1 -0
  25. package/dist/{chunk-47RGVCPH.js → chunk-QFVRMARS.js} +12 -12
  26. package/dist/chunk-TBF5CVPA.js +1 -0
  27. package/dist/chunk-UMDQ6CLQ.js +2 -0
  28. package/dist/chunk-UX7UJPC5.js +5 -0
  29. package/dist/chunk-VVPZMWJE.js +1 -0
  30. package/dist/chunk-WDQY6JMM.js +7 -0
  31. package/dist/chunk-WP7AZDCV.js +5 -0
  32. package/dist/chunk-WRFD4EXD.js +1 -0
  33. package/dist/{chunk-AFSSKGTD.js → chunk-WUO2GBPO.js} +1 -1
  34. package/dist/{chunk-BPFPM3L4.js → chunk-WY5U4XFO.js} +3 -3
  35. package/dist/{chunk-XWK7WZQS.js → chunk-X4VIDPKV.js} +1 -1
  36. package/dist/{chunk-TWFM6GNK.js → chunk-XY5ZHRMR.js} +1 -1
  37. package/dist/chunk-YHZSBL2N.js +1 -0
  38. package/dist/copy/copy.css +8 -108
  39. package/dist/copy/index.d.ts +39 -9
  40. package/dist/copy/index.js +18 -19
  41. package/dist/drag/drag.css +8 -8
  42. package/dist/drag/index.js +1 -1
  43. package/dist/easel/index.d.ts +3 -3
  44. package/dist/easel/index.js +1 -1
  45. package/dist/fields/fields.css +8 -8
  46. package/dist/fields/index.js +1 -1
  47. package/dist/gold/index.d.ts +3 -3
  48. package/dist/gold/index.js +1 -1
  49. package/dist/icons/index.d.ts +1 -0
  50. package/dist/markup/index.d.ts +1 -629
  51. package/dist/markup/index.js +1 -1
  52. package/dist/menu/menu.css +1 -1
  53. package/dist/panel/index.js +1 -1
  54. package/dist/panel/panel.css +12 -12
  55. package/dist/pick/index.d.ts +30 -8
  56. package/dist/pick/index.js +3 -7
  57. package/dist/pick/pick.css +10 -84
  58. package/dist/screen/components/AddBlockRow.js +1 -1
  59. package/dist/screen/components/AddSidePanel.js +1 -1
  60. package/dist/screen/components/MediaSidePanel.js +1 -1
  61. package/dist/screen/components/NodeContextMenu.js +1 -1
  62. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  63. package/dist/screen/components/PanelToggleIcon.d.ts +6 -5
  64. package/dist/screen/components/PanelToggleIcon.js +1 -1
  65. package/dist/screen/components/ScreenChrome.js +1 -1
  66. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  67. package/dist/screen/components/ScreenMount.js +1 -1
  68. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  69. package/dist/screen/components/SectionScreenShell.js +15 -15
  70. package/dist/screen/components/SidePanelHead.js +1 -1
  71. package/dist/screen/components/usePartBridge.js +1 -1
  72. package/dist/screen/index.js +1 -1
  73. package/dist/screen/lib/key-scope.js +1 -1
  74. package/dist/screen/lib/puck/device-fields.js +1 -1
  75. package/dist/screen/lib/puck/slot-child-name.js +1 -1
  76. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  77. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  78. package/dist/screen/lib/screen-parts.js +1 -1
  79. package/dist/screen/screen.css +16 -16
  80. package/dist/screen/words.js +1 -1
  81. package/dist/shell/shell.css +10 -8
  82. package/dist/strings/catalogue.d.ts +2 -2
  83. package/dist/strings/catalogue.js +1 -1
  84. package/dist/strings/index.d.ts +2 -2
  85. package/dist/strings/index.js +1 -1
  86. package/dist/text-styles/index.d.ts +14 -233
  87. package/dist/text-styles/index.js +36 -35
  88. package/dist/text-styles/model.d.ts +267 -0
  89. package/dist/text-styles/model.js +1 -0
  90. package/dist/text-styles/text-styles.css +6 -6
  91. package/dist/{words-dsex49Jh.d.ts → words-notpwHR2.d.ts} +13 -7
  92. package/package.json +8 -3
  93. package/dist/chunk-26GHWMNN.js +0 -21
  94. package/dist/chunk-546BBOPE.js +0 -1
  95. package/dist/chunk-AZOCY74V.js +0 -57
  96. package/dist/chunk-BHRC3ASL.js +0 -1
  97. package/dist/chunk-DD7A6RRL.js +0 -5
  98. package/dist/chunk-EQFBUNEB.js +0 -1
  99. package/dist/chunk-FAAZZXIS.js +0 -1
  100. package/dist/chunk-FFYXVAAL.js +0 -1
  101. package/dist/chunk-FGJSCWUN.js +0 -7
  102. package/dist/chunk-GCCBEY2W.js +0 -2
  103. package/dist/chunk-GG4FGBFR.js +0 -1
  104. package/dist/chunk-KQMML6JM.js +0 -4
  105. package/dist/chunk-Q6AM43CA.js +0 -1
  106. package/dist/chunk-SJPKSE5G.js +0 -13
  107. package/dist/chunk-U7KFFC7N.js +0 -5
  108. package/dist/chunk-VWXUMVCD.js +0 -1
  109. package/dist/chunk-ZAOM6PFH.js +0 -1
@@ -0,0 +1,57 @@
1
+ import{markedTreeNodeId as e,revealSelectedTreeRow as n,sameSelector as t}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as o}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as r}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as i}from"./chunk-LZS7JZK5.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,useEaselSaveKey as m,editorRootFocus as g}from"./chunk-5NM5TPAX.js";import{usePartBridge as y}from"./chunk-O3RLI7XE.js";import{useSectionOps as k}from"./chunk-X4VIDPKV.js";import{SlotChildActionsProvider as S}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as v,DEFAULT_PANEL_W as b,clampPanelWidth as w}from"./chunk-TZIIRGVY.js";import{MediaSidePanel as x}from"./chunk-5QP7ZE35.js";import{useNodeClipboard as z,useNodeContextMenu as C}from"./chunk-EC2I7SIY.js";import{PageEditGuardNotices as I}from"./chunk-WUO2GBPO.js";import{useScreenDocument as B}from"./chunk-47JTYRQC.js";import{requestMediaPick as P}from"./chunk-KG7RJWOK.js";import{ScreenSaveIcon as N,ScreenMainButton as O}from"./chunk-W4U4SHKW.js";import{useBrowserOffline as $}from"./chunk-RKTF5XLP.js";import{heldStyle as M,styleShortcut as j}from"./chunk-V7U33NF2.js";import{AddChildRow as T}from"./chunk-5545A3PC.js";import{AddSidePanel as A}from"./chunk-UX7UJPC5.js";import{SidePanelHead as E,PanelShowStrip as L}from"./chunk-62VPYC7F.js";import{useEaselSession as R}from"./chunk-O7Q4DDJT.js";import{useScreenSaveSwitch as V,useScreenNodeKeys as F,useScreenPinned as W,useScreenDocumentLabel as H,useScreenCanvasFrame as D,useScreenInspectorPanel as J,useScreenDevices as U,useScreenPickFollowsSelection as G,useScreenLeftView as X,SELECTION_MODE as Y,sameInspectorMode as K,useScreenBridges as Z,useScreenBlockRules as q,useScreenBlockLook as _,useScreenStorageNamespace as Q,useScreenNotify as ee,useScreenCanvasHead as ne,isSlotMode as te,useScreenStyleClipboard as oe,useScreenDocumentPass as re,useScreenCanvasDrag as ie,ScreenCanvasTargetProvider as le,isPinnedFirst as se,isPinnedLast as de,screenSlotsOf as ce}from"./chunk-WP7AZDCV.js";import{ROOT_ZONE as ae,blockNodeActions as pe,TREE_MAX_DEPTH as ue,childSlotsOf as fe,slotFieldsOf as he,slotChildrenIn as me,nestsInTree as ge,newNodeId as ye}from"./chunk-PLVEGYK6.js";import{useMediaPanel as ke,usePanelPick as Se,useCancelPanelPick as ve}from"./chunk-R6WTQWAC.js";import{useEaselHost as be,useHostEscape as we}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as xe}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ze}from"./chunk-VVPZMWJE.js";import{EaselTopBar as Ce,TopBarRail as Ie,TopBarCluster as Be,EaselIconButton as Pe,TopBarDivider as Ne,DeviceSwitch as Oe,InspectorIconButton as $e,PanelResizeHandle as Me,MAX_PANEL_W as je,MIN_PANEL_W as Te,panelWidthVars as Ae}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as Ee,DEFAULT_CHROME_WORDS as Le}from"./chunk-Z6PVRXVY.js";import{holderOf as Re,nameOrSomeone as Ve}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as Fe}from"./chunk-RE4LP46F.js";import{TreeRow as We,Subtree as He,LayersTree as De,TreeGroupLabel as Je,TreeRowAction as Ue,TreeSeam as Ge}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Xe}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ye}from"./chunk-WK3AFPXY.js";import{LayersIcon as Ke,MediaIcon as Ze}from"./chunk-4VJATVVR.js";import{insertSeams as qe,CanvasDragLayer as _e,CanvasInsert as Qe}from"./chunk-QFVRMARS.js";import{DEFAULT_DRAG_WORDS as en}from"./chunk-AYWN5NRH.js";import{createDragSession as nn,useTreeDrag as tn,gapToMoveIndex as on}from"./chunk-67GNT6PF.js";import{useEasel as rn,useEaselApi as ln,CanvasPassThroughContext as sn}from"./chunk-KE2CXEIK.js";import{toItemSelector as dn,useNodeOps as cn,clickPick as an}from"./chunk-ECM5F6JJ.js";import{useCanvasFrame as pn,LIST_SELECTOR as un,BLOCK_SELECTOR as fn,useCanvasEvent as hn,nodeIdAt as mn,frameRectToHost as gn,BLOCK_ATTRIBUTE as yn,drawnBox as kn}from"./chunk-ILXP5VX5.js";import{ROOT_ID as Sn,ROOT_SLOT as vn,zoneKey as bn,parseZoneKey as wn,find as xn,DataError as zn}from"./chunk-KRXQM65X.js";import{useWords as Cn}from"./chunk-MFIRYGHW.js";import{useRef as In,useMemo as Bn,useState as Pn,useEffect as Nn,useCallback as On,useLayoutEffect as $n,Fragment as Mn}from"react";import{ColoredBadge as jn,toast as Tn,groupColors as An}from"efficient-shell/ui";import{UndoIcon as En,RedoIcon as Ln,RefreshIcon as Rn,AddIcon as Vn,TrashIcon as Fn,EyeOffIcon as Wn,EyeIcon as Hn,DuplicateIcon as Dn}from"efficient-shell/icons/efficient";import{jsx as Jn,jsxs as Un,Fragment as Gn}from"react/jsx-runtime";var Xn=/* @__PURE__ */new WeakSet;function Yn(e,n,t){const o=xn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function Kn({canvas:e,tabs:n,onSelect:t}){const o=In(null),[r,i]=Pn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return $n(()=>{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=gn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${yn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?kn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=gn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Jn("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Jn("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:/* @__PURE__ */Jn(jn,{colorClass:An("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Zn({expand:e}){/* @__PURE__ */
2
+ return Jn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Un(Gn,e?{children:[
3
+ /* @__PURE__ */Jn("path",{d:"M8 9l4-4 4 4"}),
4
+ /* @__PURE__ */Jn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
5
+ /* @__PURE__ */Jn("path",{d:"M8 4l4 4 4-4"}),
6
+ /* @__PURE__ */Jn("path",{d:"M8 20l4-4 4 4"}),
7
+ /* @__PURE__ */Jn("path",{d:"M5 12h14"})]})})}var qn=`${un}, ${fn}`;function _n(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 Qn="__rungs";var et="screen:band",nt={duplicate:!0,delete:!0};function tt(){const un=be(),{target:gn,docId:yn,capabilities:kn,currentSlug:An,siteId:tt,onPublish:ot,saveState:rt,saveConflict:it,retrySave:lt,toggleAutoSave:st,flushSave:dt,access:ct,saveUnreachable:at=!1,readOnly:pt,readOnlyReason:ut=null}=B(),ft=V(),ht=F(),{mediaEditing:mt,hasEditGuard:gt,hasPinnedChrome:yt}=kn,{appState:kt,dispatch:St,history:vt,selectedItem:bt,getSelectorForId:wt,config:xt}=rn(e=>e),zt=W(),{first:Ct,firstGroup:It,lastGroup:Bt,isSectionGroup:Pt,sectionGroupZone:Nt,panelOf:Ot}=zt,$t=Ot(Ct),Mt=e=>se(zt,e),jt=e=>de(zt,e),Tt="node"===zt.firstRow,At=zt.band??null,Et=Cn("screen",ze),Lt=Cn("tree",Xe),Rt=Cn("drag",en),Vt=Cn("notice",Ee),Ft=Cn("lock",Fe),Wt=Cn("menu",Ye),Ht=Cn("styleClipboard",xe),Dt=Cn("chrome",Le),Jt=H()??`/${An}`,Ut=D(),Gt=J(),Xt=k({readOnly:pt}),Yt=k({readOnly:pt,foldIntoHistory:!0}),Kt=In(null),Zt=ln(),qt=Bn(()=>({...Xt,select:e=>{Kt.current=e,Xt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Zt.config;Kt.current=dn(e,t,n)}Xt.commitDocument(e,n)}}),[Xt,Zt]),_t=kt.ui,Qt=_t.leftSideBarVisible,eo=_t.rightSideBarVisible,{options:no,widths:to,initial:oo,fluid:ro,fit:io}=U(),[lo,so]=Pn(oo),co=ke(),ao=mt&&null!==co,po=Se(),uo=ve();G(bt?.props.id);const{read:fo,write:ho,forSelection:mo}=X(),[go,yo]=Pn(fo);Nn(()=>{ho(go)},[go]);const[ko,So]=Pn(0),vo=In(null),bo=In(null),wo=pn(bo,{readySelector:qn}),xo=f(bo);h(bo,wo);const zo=$(),Co=Re(ct),Io={state:rt,offline:zo||rt.failed&&at,readOnlyReason:ut,editing:Co?Vt.editing({name:Ve(Co.name,Ft),noun:Et.noun}):null,conflict:null!=it,notSaving:Et.bar.notSaving},Bo=()=>{pt||(rt.failed?lt():dt())};m(bo,wo,Bo);const[Po,No]=Pn(!1),Oo=In(!1),$o=In(!1),[Mo,jo]=Pn(null),[To,Ao]=Pn([]),[Eo,Lo]=Pn(Y),Ro="puck"===Eo.kind,Vo=e(Eo,bt?.props.id),[Fo,Wo]=Pn(null);Nn(()=>{Fo&&(n(),Wo(null))},[Fo]);const Ho=In(wt);Ho.current=wt;const Do=On((e,{scroll:n})=>{yo(n=>mo(e,n)),n&&Wo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Ho.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Sr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Jo=In(null);Nn(()=>{const e=Jo.current;Jo.current=null;const n=null==bt?.props.id?null:String(bt.props.id);Lo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Ot(bt?.type)??Y);const o=bt?.props.id,r=Kt.current;if(Kt.current=null,!o)return;const i=wt(o);Do(String(o),{scroll:!t(r,i??null,ae)})},[bt?.props.id,Do]);const Uo=On(e=>{Lo(n=>K(n,e)?n:e),St({type:"setUi",ui:{rightSideBarVisible:!0}})},[St]),Go=In(()=>{});Go.current=(e,n)=>{const t=e?ui(e.zone??ae)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==bt?.props.id?null:String(bt.props.id);Lo(e=>K(e,n)?e:n),o!==r&&(Jo.current={id:o,mode:n},qt.select(e))};const Xo=On((e,n)=>Go.current(e,n),[]),Yo={kind:Eo.kind,mode:Eo,open:Uo,show:e=>Lo(e),reveal:()=>{eo||St({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Xo},Ko=Z(Yo,{data:kt.data,selected:bt??null,zoneOf:e=>wt(e)?.zone,readOnly:Boolean(pt),select:e=>{Lo(Y),qt.select({index:e})},replace:(e,n)=>qt.replaceComponent(ae,e,n),scrollTo:e=>Li(e)},{device:lo,refreshes:ko},{setView:yo,reveal:()=>{Qt||St({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Zo=Ko.pinnedSource??!1,qo=Ko.resolveLeftView?Ko.resolveLeftView(go,ao):"media"===go&&ao?go:"sections",_o=q(),{isLockedBlock:Qo,duplicateBlocked:er,nestDepth:nr,newSectionNode:tr,canAddTo:or,blockIsOffered:rr}=_o,ir=_(),{labelAtLevel:lr,Icon:sr,useProducts:dr}=ir,cr=ir.rowName?(e,n,t)=>ir.rowName(e,n,t):void 0,ar=On(e=>{St({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),Do(e,{scroll:!0})},[St,Do]),{selectNode:pr,openPartId:ur}=y({mode:Eo,setMode:Lo,onOpenPart:ar}),[fr,hr]=Pn(null);we(null!==fr,()=>hr(null));const mr=v(Q()),gr=mr.collapsed,yr=mr.panelWidths,[kr,Sr]=Pn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(gr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
8
+ return new Set}});Nn(()=>{try{window.localStorage.setItem(gr,JSON.stringify([...kr]))}catch{}},[kr]);const[vr,br]=Pn(()=>{if("undefined"==typeof window)return{...b};try{const e=window.localStorage.getItem(yr);if(!e)return{...b};const n=JSON.parse(e);return{left:w(Number(n.left)||b.left),right:w(Number(n.right)||b.right)}}catch{return{...b}}});Nn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(yr,JSON.stringify(vr))}catch{}},300);return()=>clearTimeout(e)},[vr]);const wr=On((e,n)=>br(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),xr=On(e=>wr("left",e),[wr]),zr=On(e=>wr("right",e),[wr]),Cr=e=>kr.has(e),Ir=e=>Sr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Br=In(!1),Pr=In(null);Nn(()=>{if(Br.current&&!Po){const e=Pr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??bo.current?.querySelector(`button[aria-label="${CSS.escape(Et.add.title)}"]`))?.focus(),Pr.current=null}Br.current=Po},[Po]),Nn(()=>{if(!Po||!xo)return;const e=e=>{"Escape"===e.key&&Ui()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[Po,xo]),we(Po,()=>Ui()),Nn(()=>{!Qt&&Po&&(No(!1),jo(null),Oo.current=!1)},[Qt]),Nn(()=>{if(!po)return $o.current&&St({type:"setUi",ui:{leftSideBarVisible:!1}}),void($o.current=!1);Po&&(No(!1),jo(null),$o.current=Oo.current,Oo.current=!1),Qt||($o.current=!0,St({type:"setUi",ui:{leftSideBarVisible:!0}}))},[po]),Nn(()=>{!Qt&&po&&($o.current=!1,uo())},[Qt]),Nn(()=>{if(!po||!xo)return;const e=e=>{"Escape"===e.key&&uo()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[po,xo]),we(null!==po,()=>uo());const Nr=ee(),Or=(e,n="success",t)=>{if(Nr)return void(t?Nr(e,"error"===n?"error":"info",t):Nr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Tn.error(e,{...o,duration:t?.duration??3200}):Tn.success(e,{...o,duration:t?.duration??1900})},$r=In(null),[Mr,jr]=Pn(0),[Tr,Ar]=Pn(0),Er=ne(),Lr=In(null),Rr=e=>Math.max(0,e.clientHeight-(Lr.current?.offsetHeight??0));Nn(()=>{const e=$r.current;if(!e)return;const n=()=>{jr(e.clientWidth),Ar(Rr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Lr.current&&t.observe(Lr.current),()=>t.disconnect()},[]),$n(()=>{$r.current&&(jr($r.current.clientWidth),Ar(Rr($r.current)))},[vr,Qt,eo]);const Vr=lo===ro?Mr>0?Mr:to[ro]:to[lo],Fr=Mr>0?Math.min(Mr/Vr,"shrink"===io?1:2):1,Wr=Vr*Fr,Hr=Mr>0&&Wr>Mr+1,Dr={width:Wr,height:Tr||"100%",flex:"none",position:"relative"},Jr={width:Vr,height:Tr?Tr/Fr:"100%",maxHeight:"none",transform:1!==Fr?`scale(${Fr})`:void 0,transformOrigin:"top left"},Ur=()=>St({type:"setUi",ui:{leftSideBarVisible:!Qt}}),Gr=()=>St({type:"setUi",ui:{rightSideBarVisible:!eo}}),Xr=e=>{Po&&(No(!1),jo(null),Oo.current=!1,Qt&&go===e)||po&&($o.current=!1,uo(),Qt&&go===e)||(Qt&&go===e?Ur():(yo(e),Qt||St({type:"setUi",ui:{leftSideBarVisible:!0}})))},Yr=()=>{P(un,{accept:"image/*",title:Dt.mediaLibrary})},Kr=()=>{Lo(Y),qt.select(null),u()},Zr=()=>{Lo($t??Y),eo||St({type:"setUi",ui:{rightSideBarVisible:!0}})},qr=kt.data.content??[],_r=()=>{const e=qr.findIndex(Mt),n=qr.findIndex(jt);return{floor:e>=0?e+1:0,cap:n>=0?n:qr.length}},Qr=xt,ei=_o.stripCopy,ni=e=>o(e,ei),ti=z(),oi=cn({data:kt.data,config:Qr,readOnly:Boolean(pt),clipboard:ti,strip:ei?e=>ei(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Sn||e.slot!==vn)return{min:0,max:n-1};const{floor:t,cap:o}=_r();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Lo(Y);const t=void 0===n||"node"===n?.kind?n:null;qt.commitDocument(e,t)}}),ri=e=>{const n=xn(kt.data,xt,e);if(!n)return!1;const t=bn(n.place),o=n.node,r=t===ae?ci(o):xi(o);return!!oi.remove(e)&&(Or(Et.deleted({name:r}),"success",{duration:8e3,action:{label:Et.bar.undo,onClick:()=>{oi.restore(n.node,n.place)}}}),!0)},ii={...oi,remove:ri},li=e=>lr(e,"block",xt.components[e]?.label??e),si=On(e=>xt.components[e]?.defaultProps??{},[xt]),di=e=>lr(e,"section",li(e)),ci=e=>l({type:e.type,props:e.props??{}},di(e.type),cr),{nodeAddresses:ai,zoneItems:pi}=Bn(()=>{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>=ue)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of fe(xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(qr,ae,0),{nodeAddresses:e,zoneItems:n}},[qr,xt]),ui=On(e=>pi.get(e)??[],[pi]),fi=e=>{const n=ai.get(e);return n?ui(n.zone)[n.index]:void 0},hi=e=>ce(_o,xt,e),mi=e=>{if(!_o.slotsOf||e===ae)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=fi(e.slice(0,n));if(!t)return null;const o=hi(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}},gi=(()=>{if(!te(Eo))return null;const e=`${Eo.nodeId}:${Eo.slot}`;return mi(e)?.slot.panel===Eo.kind?e:null})(),yi=In(null);Nn(()=>{const e=yi.current;if(yi.current=null,!gi||!te(Eo))return;const n=Eo.nodeId;Do(n,{scroll:e!==gi}),Sr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Eo]);const ki=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ai.get(e);n&&(n.zone===ae?Ri(n.index):ul(n.zone,n.index,e,fi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&gi!==i&&(yi.current=i),Xo(null,r),eo||St({type:"setUi",ui:{rightSideBarVisible:!0}}),Li(o)},Si=(e,n,t)=>{const o=`${e}:${n}`;if(Sr(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;gi!==o&&(yi.current=o);Xo(null,{kind:t,nodeId:e,slot:n})},vi=(e,n,t)=>{if(pt||!_o.moveSlot)return;const o=fi(e),r=o?hi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Qn,index:n},s=on(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=_o.moveSlot(e,n,s);"string"==typeof d&&Si(e,d,i.panel)},bi=dr(),wi=Bn(()=>{const e=/* @__PURE__ */new Map;for(const n of bi??[])e.set(n.slug,n.name);return e},[bi]),xi=e=>s(e,li,ir.plainText,e=>wi.get(e),ir.rowName),zi=(e,n)=>{const t=xt.components[e.type]?.fields,o=n===ae||jl(n)?"section":"block",r=n===ae&&(Mt(e)||jt(e)||Pt(e.type)),i="block"===o?d(t):r?null:c(t);return ir.renamePropOf?ir.renamePropOf(e,o,i):i},Ci=(e,n,t,o)=>{if(!(!pt&&fr?.zone===e&&fr.index===n))return;const r=(t,o)=>{hr(null),o&&((e,n,t)=>{const o=ui(e)[n];if(!o)return;const r=zi(o,e);r&&qt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
9
+ return Jn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Et.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)},Ii=i(oe(),Ht),Bi=Ii.scope({target:gn,siteId:tt,docId:yn}),Pi=xt,Ni=(e,n)=>n===ae?di(e):li(e),Oi=(e,n,t)=>{const o=Ii.plan(Bi,t,Ni(t.type,e),Pi);o&&(o.changed&&qt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Or(o.message))},$i=C({nodesIn:ui,nodeAt:(e,n)=>ui(e)[n]??null,labelOf:(e,n)=>n===ae?di(e):li(e),renamePropOf:zi,beginRename:(e,n)=>hr({zone:e,index:n}),history:{hasPast:vt.hasPast,hasFuture:vt.hasFuture,back:()=>vt.back(),forward:()=>vt.forward()},openPageSettings:()=>{qt.select(null),Lo(Y)},pageSettingsLabel:Et.pageSettings,words:{menu:Wt,styleClipboard:Ht,screen:Et.menu},readOnly:Boolean(pt),collapseAll:()=>Sr(new Set(ui(ae).map(e=>String(e.props.id)))),onPasteRefused:e=>Or(e?Et.pasteRefused({name:e.label}):Et.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>El(e,n),menuRows:Ko.menuRows,isLocked:e=>Qo(e.type),duplicateBlocked:e=>er(kt.data,e),permits:e=>pe(xt,e.type),nodeOps:ii,isPinned:(e,n)=>n===ae&&(Mt(e)||jt(e)),sectionBand:_r,locate:e=>ai.get(e)??null,rowNameOf:(e,n)=>n===ae?ci(e):xi(e),selectAt:(e,n,t,o)=>{e===ae?Ri(n):ul(e,n,t,o??"")},slotRung:e=>{const n=mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>ki(n.node,n.slot,!1)}:null},style:{held:()=>M(Bi),canCopy:e=>Ii.rows(Pi,e).some(e=>!1!==e.counted),copy:(e,n)=>Ii.copy(Bi,e,Ni(e.type,n),Pi),paste:(e,n,t)=>Oi(e,n,t)},keys:ht?{target:xo,selected:()=>{const e=kt.ui.itemSelector;return e?{zone:e.zone??ae,index:e.index}:null},held:()=>ti.get(),readOnly:Boolean(pt),onDone:({done:e,name:n})=>{"copied"===e&&Or(Et.copied({name:n}))}}:void 0},wo),Mi=In({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Nn(()=>{Mi.current={copy:(e,n)=>Ii.copy(Bi,e,Ni(e.type,n),Pi),paste:Oi,at:()=>{const e=kt.ui.itemSelector;if(!e)return null;const n=e.zone??ae,t=ui(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(pt)}});const ji=On(e=>{const n=j(e);if(!n)return;const t=Mi.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))},[]);Nn(()=>{if(!xo)return;const e=e=>ji(e);return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[ji,xo]),hn(wo,"keydown",ji);const Ti=qr.map(e=>e.props.id).join("|");Nn(()=>{const e=wo?.document??null,n=wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ao(e=>e.length?[]:e);const n=qr.findIndex(jt),t=n>=0?n:qr.length,o=n=>{const t=qr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(fn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=qr.length>0&&!Mt(qr[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=_n(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})}Ao(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,Ti,lo,Fr,Qt,eo,bt?.props.id]);const Ai=wo?.document??null,Ei=wo?.window??null;Nn(()=>{const e=vo.current;if(!e||!Ai||!Ei)return;const n=[],t=()=>{const n=Ai.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Ei.scrollTo({left:Ei.scrollX,top:Ei.scrollY+t,behavior:"instant"}),!0};return vo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ai,Ei]);const Li=e=>{Ko.holdCanvasOn?Ko.holdCanvasOn(e):a(e)},Ri=e=>{Lo(Y),qt.select({index:e}),Ko.sectionPressed?.(qr[e]);const n=qr[e]?.props?.id;n&&Li(n)},Vi=e=>{const{floor:n,cap:t}=_r(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=bt&&Eo.kind!==$t?.kind?qr.findIndex(e=>e.props.id===bt.props.id):-1;return o(r>=0?r+1:t)},Fi=(e,n)=>{const{floor:t,cap:o}=_r(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(qt.reorderComponent(ae,e,i),qt.select({index:i}),{moved:!0,dest:i})},Wi=(e,n,t,o)=>{Lo(Y),qt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Or(Et.sectionAdded({name:t}))},Hi=(e,n)=>{const t=Vi(n),o=tr(e,{nodeDefaults:si,newNodeId:ye,sectionLabel:di,blockIsOffered:rr}),r=o?qt.insertNode(ae,t,o):qt.insertSection(e,t);return Wi(t,r,di(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of fe(xt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=or(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Di=e=>Ji(ae,e),Ji=(e,n)=>{Pr.current=document.activeElement??null,po&&(Oo.current=$o.current,$o.current=!1,uo()),jo(null===n?null:{zone:e,index:n}),No(!0),Qt||(Oo.current=!0,St({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ui=()=>{No(!1),jo(null),Oo.current&&St({type:"setUi",ui:{leftSideBarVisible:!1}}),Oo.current=!1},Gi=(e,n)=>ir.rowName?n?Mt(e)?ir.rowName(e,"section",Et.header):jt(e)?ir.rowName(e,"section",Et.footer):Pt(e.type)?ir.rowName(e,"section",li(e.type)):ci(e):xi(e):n?di(e.type):li(e.type),Xi=e=>n=>{e()},Yi=()=>Ko.editPinnedSource?.(),Ki=(e,n,t)=>{if(pt)return null;const o=ui(e)[n];return o&&!pe(xt,o.type).delete?null:/* @__PURE__ */Jn(Ue,{kind:"delete",label:Et.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=ui(e)[n]?.props?.id;null!=t&&ri(String(t))})(e,n),children:/* @__PURE__ */Jn(Fn,{size:15})})},Zi=e=>ir.rowPreview?.(e)||void 0,qi=e=>ir.rowMarks?.(e)??void 0,_i=(e,n,t)=>ir.rowActions?.(e,n,t)??null,Qi=(e,n,t,o)=>{if(pt)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
10
+ return Jn(Ue,{kind:"eye",label:r?Et.showNamed({name:o}):Et.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Jn(r?Wn:Hn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>fs(ae,e),nl=(e,n,t)=>{qt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>he(xt,e),ol=e=>fe(xt,e),rl=e=>_o.slotsOf?hi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:me(e,n.slot)})):[{slot:null,rung:null,kids:ol(e)}],il=e=>_o.slotsOf?rl(e).flatMap(e=>e.kids):ol(e),ll=e=>Boolean(_o.slotsOf)&&hi(e).some(e=>e.rung),sl=(e,n,t)=>null===t?void 0===n?or(e):or(e,n):or(e,n,t),dl=(e,n,t)=>{const o=ge(xt,e.type,n)&&(t||il(e).length>0||ll(e));return{collapsible:o,folded:o&&Cr(String(e.props.id))}},cl=(e,n,t)=>rl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>dl(e,r,t(e.type)).collapsible?[String(e.props.id),...cl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),al=e=>il(e).length>0||ll(e)||Boolean(or(e.type)),pl=e=>Boolean(or(e)),ul=(e,n,t,o)=>{if(Lo(Y),or(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),qt.select({index:n,zone:e}),a(t)}else qt.select({index:n,zone:e}),Li(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;qt.insertComponent(i,t,o),or(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),qt.select({index:o,zone:i})}):qt.select({index:o,zone:i})},hl=In(/* @__PURE__ */new Set);Nn(()=>{qr.forEach(e=>{const n=or(e.type)?.spec;if(!n)return;const t=e.props.id;if(hl.current.has(t))return;hl.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(si)).forEach((e,t)=>Yt.seedChild(o,t,n.childType,e))})},[qr,Yt,si]);const ml=In(/* @__PURE__ */new Set);Nn(()=>{qr.forEach((e,n)=>{const t=e.props.id;if(ml.current.has(t))return;const o=r(e,tl(e.type));ml.current.add(t),o&&Yt.replaceComponent(ae,n,{...e,props:o})})},[qr,Yt]),re(Yt,xt);const gl=qr.findIndex(jt),yl=gl>=0?qr[gl]:null,kl=Tt?qr.findIndex(Mt):-1,Sl=kl>=0?qr[kl]:null,vl=zt.groupTab,bl=Bn(()=>vl?e=>Pt(e.type):void 0,[vl]),wl=Boolean(zt.groupBadge),xl=zt.groupBadge?/* @__PURE__ */Jn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Jn(jn,{tone:"info",size:"xs",children:zt.groupBadge})}):void 0,zl=qr.find(e=>e.type===It)??null,Cl=qr.find(e=>e.type===Bt)??null,Il=gl>=0?gl:qr.length,Bl=[];qr.forEach(e=>{jt(e)||(al(e)&&Bl.push(String(e.props.id)),Bl.push(...cl(e,1,pl)))}),yl&&(Bl.push(String(yl.props.id)),Bl.push(...cl(yl,1,pl)));const Pl=Bl.length>0&&Bl.every(e=>kr.has(e)),Nl=e=>{const n=ir.blockRowName(e,li);return ir.rowName?ir.rowName(e,"block",n):n},Ol=(e,n,t,o)=>{const r=ui(e)[t];if(!r)return;const i={...wn(e),index:t},l={...wn(n),index:Math.min(Math.max(o,0),ui(n).length)},s=on(i,l);if(e!==n||s!==t)try{oi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof zn))throw e}},$l=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of ol(e))n.add(r),t(o)};for(const t of tl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Ml=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ai.get(n);if(!e)return null;if(e.zone===ae)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},jl=e=>{const n=e.slice(0,e.indexOf(":")),t=qr.find(e=>Pt(e.type)&&String(e.props.id)===n);return t&&Nt(n)===e?t:null},Tl=(e,n)=>{const t=jl(e);return!t||(!zt.groupAccepts||zt.groupAccepts(t.type,n,ui(e).length))},Al=(e,n,t)=>{if(e.rung){const t=fi(e.rung.nodeId),o=t?hi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Qn&&n.index>=0&&n.index<=o}if(n.slot===Qn)return!1;if(e.add)return Vl(e.add,n);const o=bn(n);if(Pt(e.type))return!1;const r=jl(o),i=jl(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Tl(o,e.type))&&(n.index>=0&&n.index<=ui(o).length));if(e.zone===ae||o===ae){if(e.zone!==o)return!1;const{floor:t,cap:r}=_r();return n.index>=t&&n.index<=r}if(n.index<0||n.index>ui(o).length)return!1;if(e.zone===o)return!0;const l=yl&&!zt.lastIsOpen?String(yl.props.id):null;return(!l||Ml(e.zone)!==l&&Ml(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??ui(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ai.get(i),s=l?ui(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&$l(r).has(n))return!1;const d=or(s.type,nr(kt?.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?.(ui(n),r))})(e.zone,o,e.index,t)},El=(e,n)=>{const t=bn(e.from),o=e.node;return t===bn(n)?Tl(t,o.type):Al({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Ll=e=>{const n=e.slice(0,e.indexOf(":")),t=ai.get(n),o=t?ui(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=or(o.type,nr(kt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:li(r.spec.childType)}]:[]),l=mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Gi(o,t.zone===ae)}},Rl=(e,n)=>{if("section"!==e.kind)return e;const t=bn(n);return t===ae||jl(t)?e:Ll(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},Vl=(e,n)=>{const t=Rl(e,n),o=bn(n);if("block"!==t.kind){if(jl(o)){const e="section"===t.kind?t.type:t.template.node.type;return Tl(o,e)&&n.index>=0&&n.index<=ui(o).length}if(o!==ae)return!1;const{floor:e,cap:r}=_r();return n.index>=e&&n.index<=r}if(o===ae)return!1;const r=Ll(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(ui(o))},Fl=(e,n)=>{const t=Rl(e,n);if("block"!==t.kind&&jl(bn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Tl(n,o)){if("section"===e.kind)qt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;qt.insertNode(n,t,ni(e.template.node))}Lo(Y),qt.select({index:t,zone:n})}})(t,bn(n),n.index);if("section"===t.kind)return void Hi(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Vi(t),r=qt.insertNode(ae,o,n);Wi(o,r,e)})(t.template.name,ni(t.template.node),n.index);const o=bn(n),r=Ll(o);r&&(r.target.spec?fl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{qt.insertComponent(e,n,t),Lo(Y),qt.select({index:t,zone:e})})(o,t.type,n.index))},Wl=(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n.index):e.add?Fl(e.add,n):e.zone===ae?Fi(e.index,n.index):Ol(e.zone,bn(n),e.index,n.index)},[Hl]=Pn(()=>nn()),Dl=tn({keyOf:e=>e.id,readOnly:Boolean(pt),session:Hl,canDrop:Al,onDrop:Wl,onStep:(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ae?((e,n)=>{const t=di(qr[e]?.type??""),o=Fi(e,n<0?e-1:e+2);if(!o.moved)return void Or(n<0?Et.sectionFirst({name:t}):Et.sectionLast({name:t}));const{floor:r,cap:i}=_r();Or(Et.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Ol(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Jl=On(e=>{const{floor:n,cap:t}=_r(),o=[];for(const r of e.nodes){const e=bn(r.place),i=ui(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Mt(i)||jt(i)||Qo(i.type))continue;if(Pt(i.type))continue;const l=Boolean(jl(e)),s=e===ae||l;e===ae&&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?di(i.type):xi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=bn(e.list);if(n===ae&&0===e.children.length)return[{...e,addLabel:Et.addSection,addAlways:!0}];const t=Ll(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(jl(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=bn(e.list),t=n===ae||jl(n)?null:Ll(n);return t?.choices.length?qe(e,t.target.spec?.addLabel??Et.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[kt.data]),Ul=null==bt?.props.id?null:String(bt.props.id),Gl=On(e=>{const n=xt,t=e=>!e.item.rung&&null!==xn(kt.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(Ul);return i||(r(an(kt.data,n,o.item.id,Ul,bl))??o)},[kt.data,xt,Ul,bl]),[Xl,Yl]=Pn(null);hn(wo,"mouseover",e=>{if(!vl)return;const n=mn(e.target),t=n?Yn(kt.data,xt,n):null;t!==Xl&&Yl(t)}),hn(wo,"mouseout",e=>{vl&&!e.relatedTarget&&Yl(null)});const Kl=e=>Mt(e)||jt(e)||Pt(e.type),Zl=[];if(vl){const e=Ul?Yn(kt.data,xt,Ul):null;for(const n of/* @__PURE__ */new Set([e,Xl])){const e=n?qr.find(e=>String(e.props.id)===n):void 0;if(!e||!Kl(e))continue;const t=vl(e);t&&Zl.push({id:String(e.props.id),label:t,below:Mt(e)||e.type===It})}}const ql=R(),_l=In(null);Nn(()=>{const e=zt.changeNotice;if(!e)return;const n=JSON.stringify(qr.filter(Kl)),t=_l.current;if(_l.current={doc:yn,bands:n,index:vt.index},!t||t.doc!==yn||t.bands===n)return;vt.hasPast&&vt.index>=t.index&&!Xn.has(ql)&&(Xn.add(ql),Or(e,"success",{action:{label:Et.bar.undo,onClick:()=>vt.back()},duration:8e3}))},[qr]);const Ql=e=>{Lo(Y),qt.select(e.zone===ae?{index:e.index}:{index:e.index,zone:e.zone})},es=ie(),ns=()=>({data:kt.data,device:lo,ops:qt,inspector:Yo}),ts=es?.model,os=Bn(()=>ts?e=>ts(e,Jl(e),ns()):Jl,[ts,Jl,lo]),rs=es?.measure,is=rs?(e,n)=>rs(e,n,ns()):void 0,ls=es?.canDrop,ss=ls?(e,n)=>ls(e,n,Al,ns()):Al,ds=es?.drop,cs=ds?(e,n)=>ds(e,n,Wl,ns()):Wl,as=es?.pick,ps=as?e=>as(e,Ql,ns()):Ql,us=e=>{const n=bn(e),t=mi(n);t&&ki(t.node,t.slot,!1),Ji(n,e.index)},fs=(e,n)=>/* @__PURE__ */Jn(Ge,{...pt?{}:Dl.seam({place:{...wn(e),index:n}})},`seam:${e}:${n}`),hs={rowClick:Xi,isCollapsed:Cr,toggleCollapse:Ir},ms=e=>{const n=String(e.props.id),t=qr.findIndex(e=>String(e.props.id)===n),o=Nt(n),r=ui(o),i=Cr(n),l=li(e.type),s=ir.rowName?ir.rowName(e,"section",l):l,d=e=>fs(o,e);/* @__PURE__ */
11
+ return Un(Gn,{children:[
12
+ /* @__PURE__ */Jn(We,{words:Lt,icon:/* @__PURE__ */Jn(sr,{type:e.type,size:13}),name:s,preview:Zi(e),marks:qi(e),onSelect:()=>Ri(t),nameSlot:Ci(ae,t,n,s),selected:Vo===n,badge:xl,actions:_i(e,ae,t)??void 0,rowProps:{"data-node-id":n,onClick:Xi(()=>Ri(t))},fold:{open:!i,label:"section",onToggle:()=>Ir(n)}}),!i&&/* @__PURE__ */Un(He,{children:[r.map((n,t)=>{const r=String(n.props.id),i=ci(n),l=al(n),s=l&&Cr(r),c=()=>ul(o,t,r,e.type),{rowProps:a,...p}=Dl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...wn(o),index:t}},{"data-node-id":r,onClick:Xi(c)});/* @__PURE__ */
13
+ return Un(Mn,{children:[d(t),
14
+ /* @__PURE__ */Jn(We,{words:Lt,icon:/* @__PURE__ */Jn(sr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:qi(n),onSelect:c,nameSlot:Ci(o,t,r,i),selected:Vo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Ir(r)}:void 0,actions:/* @__PURE__ */Un(Gn,{children:[Ki(o,t,i),_i(n,o,t),Qi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Jn(He,{children:ks(n,2)})]},r)}),d(r.length)]})]})},gs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Dl.dragging,d=!Cr(l)&&s?.rung?.nodeId!==i,c={...wn(l),index:0},a=s&&!s.rung&&Al(s,c)?c:void 0,p=()=>ki(e,n,!0),{rowProps:u,...f}=Dl.row({item:{id:`rung:${l}`,zone:`${i}:${Qn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Qn,index:t},into:a,canDrag:Boolean(_o.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Xi(p)}),h=pt?null:_o.slotActions?.(e,n.slot);/* @__PURE__ */
15
+ return Un(Mn,{children:[n.heading,
16
+ /* @__PURE__ */Jn(We,{words:Lt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:gi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Ir(l)},actions:h&&h.length>0?/* @__PURE__ */Jn(Gn,{children:h.map((t,o)=>/* @__PURE__ */Jn(Ue,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(pt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Si(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__ */Jn(Fn,{size:15}):/* @__PURE__ */Jn(Dn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Jn(He,{children:r})]},l)},ys=(e,n)=>{const t=rl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
17
+ return Jn(Gn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=sl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>fs(e,n),p=/* @__PURE__ */Un(Gn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Vo===String(n.props.id),{collapsible:i,folded:s}=dl(n,l,pl(n.type)),d=String(n.props.id),c=Nl(n),p=()=>ul(t,o,d,e.type),{rowProps:u,...f}=Dl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...wn(t),index:o}},{"data-node-id":d,onClick:Xi(p)});/* @__PURE__ */
18
+ return Un(Mn,{children:[0===o&&a(t,0),
19
+ /* @__PURE__ */Jn(We,{words:Lt,icon:/* @__PURE__ */Jn(sr,{type:n.type,size:13}),name:c,preview:Zi(n),marks:qi(n),onSelect:p,nameSlot:Ci(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Ir(d)}:void 0,actions:/* @__PURE__ */Un(Gn,{children:[Ki(t,o,c),_i(n,t,o),Qi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Jn(He,{children:ys(n,l+1)}),a(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?a(d,0):null:0!==i.length||!t.rung&&d!==c?null:a(c,0)]});return t.rung?gs(e,t.rung,r++,o,p):/* @__PURE__ */Jn(Mn,{children:p},t.slot??"")})})},ks=(e,n)=>{const t=nr(kt?.data,e.type,String(e.props.id)),o=rl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
20
+ return Jn(Gn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=sl(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>fs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */Un(Gn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Vo===String(n.props.id),i=xi(n),l=String(n.props.id),{collapsible:d,folded:c}=dl(n,s,pl(n.type)),a=tl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...wn(p),index:ui(p).length}:void 0,f=Dl.dragging,h=u&&f&&Al(f,u)?u:void 0,g=()=>ul(t,o,l,e.type),{rowProps:y,...k}=Dl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...wn(t),index:o},into:h,canDrag:!Qo(n.type)},{"data-node-id":l,onClick:Xi(g)});/* @__PURE__ */
21
+ return Un(Mn,{children:[0===o&&m(t,0),
22
+ /* @__PURE__ */Jn(We,{words:Lt,icon:/* @__PURE__ */Jn(sr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:qi(n),onSelect:g,nameSlot:Ci(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Ir(l)}:void 0,actions:Qo(n.type)?_i(n,t,o)??void 0:/* @__PURE__ */Un(Gn,{children:[Ki(t,o,i),_i(n,t,o),Qi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Jn(He,{children:ks(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
23
+ /* @__PURE__ */Jn(T,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>fl(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?gs(e,o.rung,i++,r,k):/* @__PURE__ */Jn(Mn,{children:k},o.slot??"")})})},Ss=Po||null!==po,vs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Qt&&!Ss&&qo===e.id,onSelect:()=>Xr(e.id)}:e,bs=[...(Ko.railLead??[]).map(vs),{id:"sections",label:Et.layers,icon:/* @__PURE__ */Jn(Ke,{}),active:Qt&&!Ss&&"sections"===qo,onSelect:()=>Xr("sections")},...(Ko.railTrail??[]).map(vs)];ao?bs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Jn(Ze,{}),active:Qt&&!Po&&(null!==po||"media"===qo),onSelect:()=>Xr("media")}):mt&&bs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Jn(Ze,{}),onSelect:Yr});const ws=[...Ko.railLead??[],...Ko.railTrail??[]].find(e=>"panel"in e&&e.id===qo),xs=Boolean(At?.foldable)&&!Zo,zs=At?.label??(gt?Et.pageSections:Et.templateSections),Cs=xs&&Cr(et),Is=/* @__PURE__ */Un(Gn,{children:[qr.map((e,n)=>{if(Mt(e)||jt(e)||Pt(e.type))return null;const t=Vo===String(e.props.id),o=Boolean(e.props._hidden);ol(e);const r=String(e.props.id),i=Ko.hasOwnRows?.(e)??!1,l=al(e)||i,s=l&&Cr(r),d=tl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...wn(c),index:ui(c).length}:void 0,p=Dl.dragging,u=a&&p&&Al(p,a)?a:void 0,{rowProps:f,...h}=Dl.row({item:{id:r,zone:ae,index:n,type:e.type},place:{...wn(ae),index:n},into:u},{"data-node-id":r,onClick:Xi(()=>Ri(n))});/* @__PURE__ */
24
+ return Un(Mn,{children:[n>0&&el(n),
25
+ /* @__PURE__ */Jn(We,{words:Lt,icon:/* @__PURE__ */Jn(sr,{type:e.type,size:13}),name:ci(e),preview:Zi(e),marks:qi(e),onSelect:()=>Ri(n),nameSlot:Ci(ae,n,r,ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Ir(r)}:void 0,actions:/* @__PURE__ */Un(Gn,{children:[Ki(ae,n,ci(e)),_i(e,ae,n),Qi(ae,n,e,ci(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Un(He,{children:[ks(e,1),Ko.partRows?.(e,hs)]}),i&&!s&&/* @__PURE__ */Jn(He,{children:Ko.ownRows?.(e,n,hs)})]},String(e.props.id??n))}),!Zo&&Il>0&&el(Il)]}),Bs=(e,n,t)=>{const o=String(e.props.id),r=il(e).length>0||ll(e)||Boolean(or(e.type)),i=r&&Cr(o),l="header"===t?Et.header:Et.footer,s=ir.rowName?ir.rowName(e,"section",l):l;/* @__PURE__ */
26
+ return Un(Gn,{children:[
27
+ /* @__PURE__ */Jn(We,{words:Lt,icon:/* @__PURE__ */Jn(sr,{type:t,size:13}),name:s,preview:Zi(e),marks:qi(e),badge:xl,onSelect:()=>Ri(n),nameSlot:Ci(ae,n,o,s),selected:Vo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Ir(o)}:void 0,actions:_i(e,ae,n)??void 0,rowProps:{"data-node-id":o,onClick:Xi(()=>Ri(n))}}),r&&!i&&/* @__PURE__ */Jn(He,{children:ys(e,1)})]})};return(Ko.wrap??(e=>e))(
28
+ /* @__PURE__ */Jn(le,{target:wo,children:/* @__PURE__ */Un("div",{ref:bo,className:"sf-editor es-editor",style:Ae(vr),onContextMenu:$i.onEditorContextMenu,...g(un),children:[
29
+ /* @__PURE__ */Un(Ce,{children:[
30
+ /* @__PURE__ */Jn(Ie,{items:bs,ariaLabel:Et.bar.views}),
31
+ /* @__PURE__ */Un(Be,{children:[
32
+ /* @__PURE__ */Jn(Pe,{label:Et.bar.undo,disabled:Boolean(pt)||!vt.hasPast,onClick:()=>vt.back(),children:/* @__PURE__ */Jn(En,{})}),
33
+ /* @__PURE__ */Jn(Pe,{label:Et.bar.redo,disabled:Boolean(pt)||!vt.hasFuture,onClick:()=>vt.forward(),children:/* @__PURE__ */Jn(Ln,{})}),
34
+ /* @__PURE__ */Jn(Ne,{}),
35
+ /* @__PURE__ */Jn(Oe,{devices:no,value:lo,onChange:so}),
36
+ /* @__PURE__ */Jn(Pe,{label:Et.bar.refresh,tip:Et.bar.refreshTip,onClick:()=>{vo.current=(()=>{const e=wo?.document;if(!e)return null;const n=qr.findIndex(jt),t=n>=0?n:qr.length;let o=null;for(let n=0;n<t;n++){const t=qr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=bt?.props?.id??qr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),So(e=>e+1)},children:/* @__PURE__ */Jn(Rn,{})})]}),
37
+ /* @__PURE__ */Un(Be,{kind:"right",style:{minWidth:300},children:[
38
+ /* @__PURE__ */Jn(N,{input:Io,words:Et.saveStatus}),Ko.barLead?.(),Ko.barTrail?.(),Ko.mainAction||!Ko.barMain?/* @__PURE__ */Jn(O,{input:Io,action:Ko.mainAction??{label:Et.done,onPress:()=>{ot(kt.data)}},readOnly:Boolean(pt),saveSwitch:ft,onToggleAutoSave:st,onSaveNow:Bo,bar:Et.bar,words:Et.saveStatus}):Ko.barMain()]})]}),
39
+ /* @__PURE__ */Jn(I,{}),
40
+ /* @__PURE__ */Un("div",{className:"sf-body",children:[Qt?/* @__PURE__ */Un(Gn,{children:[
41
+ /* @__PURE__ */Jn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Et.leftPanel,children:Po?/* @__PURE__ */Jn(A,{at:Mo?{label:(e=>{const n=jl(e.zone);if(n)return Et.add.addingTo({name:ir.rowName?Gi(n,!0):li(n.type)});if(e.zone===ae){const n=qr[e.index];return n&&!jt(n)?Et.add.addingBefore({name:Gi(n,!0)}):Et.add.addingAtEnd}const t=Ll(e.zone);return t?Et.add.addingTo({name:t.parentName}):Et.add.addingHere})(Mo),onClear:()=>jo(null)}:void 0,placeBlocks:Mo&&Mo.zone!==ae?Ll(Mo.zone)?.choices:void 0,canTake:Mo?e=>{if(!Mo)return null;const n={...wn(Mo.zone),index:Mo.index};if(Vl(e,n))return null;const t=jl(Mo.zone);if(t)return Et.add.notInside({name:Gi(t,!0)});if(Mo.zone===ae)return Et.add.onlySections;const o=Ll(Mo.zone);return o?Et.add.notInside({name:o.parentName}):Et.add.onlySections}:void 0,onPick:Mo?e=>{if(!Mo)return;const n={...wn(Mo.zone),index:Mo.index};Vl(e,n)&&(Fl(e,n),Ui())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Hl,siteWide:Ko.addPanelRow?.(Ui),onClose:Ui,onHide:Ur,readOnly:Boolean(pt)}):po&&co?
42
+ /* @__PURE__ */Jn(x,{panel:co,pick:po,onHide:Ur}):ws?ws.panel({onHide:Ur,notify:Or}):"media"===qo&&co?/* @__PURE__ */Jn(x,{panel:co,pick:null,onHide:Ur}):/* @__PURE__ */Un(Gn,{children:[
43
+ /* @__PURE__ */Jn(E,{icon:/* @__PURE__ */Jn(Ke,{}),title:Et.layers,context:Jt,actions:/* @__PURE__ */Un(Gn,{children:[!pt&&/* @__PURE__ */Jn($e,{label:Et.add.title,onClick:()=>Di(null),children:/* @__PURE__ */Jn(Vn,{size:15})}),
44
+ /* @__PURE__ */Jn($e,{label:Pl?Et.expandAll:Et.collapseAll,title:0===Bl.length?Et.nothingToFold:void 0,disabled:0===Bl.length,onClick:()=>Sr(e=>{const n=new Set(Bl);return Pl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Bl])}),children:/* @__PURE__ */Jn(Zn,{expand:Pl})})]}),onHide:Ur}),
45
+ /* @__PURE__ */Un(De,{className:"sf-tree sf-scroll",words:Lt,children:[
46
+ /* @__PURE__ */Jn(We,{words:Lt,icon:/* @__PURE__ */Jn(sr,{type:"page",size:13}),name:Et.pageSettings,onSelect:Kr,selected:!bt&&Ro,rowProps:{onClick:Xi(Kr)}}),zl&&/* @__PURE__ */Un(Gn,{children:[!wl&&/* @__PURE__ */Jn(Je,{children:Et.header}),ms(zl)]}),!Zo&&yt&&!(wl&&zl)&&/* @__PURE__ */Un(Gn,{children:[!wl&&/* @__PURE__ */Jn(Je,{children:Et.header}),!Tt&&/* @__PURE__ */Jn(We,{words:Lt,icon:/* @__PURE__ */Jn(sr,{type:"header",size:13}),name:Et.header,badge:xl,onSelect:Zr,selected:Eo.kind===$t?.kind,rowProps:{onClick:Xi(Zr)}})]}),!Zo&&Sl&&!(wl&&zl)&&Bs(Sl,kl,"header"),!Zo&&!xs&&/* @__PURE__ */Jn(Je,{children:zs}),xs?/* @__PURE__ */Un(Gn,{children:[
47
+ /* @__PURE__ */Jn(We,{words:Lt,icon:null,name:zs,fold:{open:!Cs,label:zs,onToggle:()=>Ir(et)}}),!Cs&&/* @__PURE__ */Jn(He,{children:Is})]}):Is,yt&&!wl&&/* @__PURE__ */Jn(Je,{children:Et.footer}),yl&&!(wl&&Cl)&&Bs(yl,gl,"footer"),!Zo&&!yl&&yt&&!wl&&/* @__PURE__ */Jn(We,{words:Lt,icon:/* @__PURE__ */Jn(sr,{type:"footer",size:13}),name:Et.footer,onSelect:Yi,rowProps:{onClick:Xi(Yi),title:Et.editFooter}}),Cl&&ms(Cl),Ko.treeFoot?.()]})]})}),
48
+ /* @__PURE__ */Jn(Me,{side:"left",width:vr.left,min:Te,max:je,defaultWidth:b.left,label:Et.resizeLeftPanel,onResize:xr})]}):/* @__PURE__ */Jn(L,{side:"left",onShow:Ur}),
49
+ /* @__PURE__ */Un("div",{ref:$r,className:"sf-center sf-scroll","data-sf-canvas-head":Er?"":void 0,style:{overflowX:Hr?"auto":"hidden",overflowY:"hidden"},children:[Er&&/* @__PURE__ */Jn("div",{ref:Lr,className:"sf-canvas-head",children:/* @__PURE__ */Jn(Er,{device:lo})}),
50
+ /* @__PURE__ */Un("div",{className:"sf-frame-scaler",style:Dr,children:[
51
+ /* @__PURE__ */Jn("div",{className:"sf-frame "+(lo===ro?"":`sf-frame--${lo}`),style:Jr,children:/* @__PURE__ */Un("div",{className:"sf-preview-host",children:[
52
+ /* @__PURE__ */Jn(sn.Provider,{value:bl,children:/* @__PURE__ */Jn(Ut,{},ko)}),
53
+ /* @__PURE__ */Jn(_e,{canvas:wo,session:Hl,model:os,measure:is,canDrop:ss,onDrop:cs,choose:Gl,onPick:ps,onZoneAdd:us,onSeamAdd:us,zoneAddLabel:Et.canvasAddBlock,words:Rt.canvas,readOnly:Boolean(pt),revision:kt.data}),To.length>0&&/* @__PURE__ */Jn("div",{className:"sf-preview-gaps",children:To.map(e=>
54
+ /* @__PURE__ */Jn(Qe,{index:e.index,label:Et.addSectionHere,onInsert:()=>Di(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))})]})}),vl?/* @__PURE__ */Jn(Kn,{canvas:wo,tabs:Zl,onSelect:e=>{const n=qr.findIndex(n=>String(n.props.id)===e);n>=0&&Ri(n)}}):null]})]}),eo?/* @__PURE__ */Un(Gn,{children:[
55
+ /* @__PURE__ */Jn(S,{value:{selectChild:ul,addChild:fl,childRowName:xi,blockRowName:Nl},children:/* @__PURE__ */Jn(Gt,{mode:Eo,onOpenWebsiteSettings:Ko.openSettings??(()=>{}),onOpenSiteStyles:Ko.openStyles,onSelectNode:pr,onNotify:Or,onHidePanel:Gr,nodeActions:bt?pe(xt,bt.type):nt})}),
56
+ /* @__PURE__ */Jn(Me,{side:"right",width:vr.right,min:Te,max:je,defaultWidth:b.right,label:Et.resizeSettingsPanel,onResize:zr})]}):
57
+ /* @__PURE__ */Jn(L,{side:"right",onShow:Gr})]}),$i.menu]})}))}export{tt as ScreenChrome};
@@ -1,6 +1,6 @@
1
- import{DEFAULT_PICK_WORDS as e}from"./chunk-ZAOM6PFH.js";import{parseHexColor as t,Popover as n,colorSwatchClasses as r,colorFill as l,ColorPickerPanel as i}from"efficient-shell/ui";export{hexToHsv,hsvToHex}from"efficient-shell/ui";import{useRef as a,useState as s,useLayoutEffect as o,useEffect as c}from"react";import{jsx as u,jsxs as p}from"react/jsx-runtime";var d=t,h=7,m=e=>e.toUpperCase(),g=(e,t,n)=>Math.min(n,Math.max(t,e));function f(e,t,n){return{s:n.width>0?g((e-n.left)/n.width,0,1):0,v:n.height>0?1-g((t-n.top)/n.height,0,1):0}}function v(e,t){return t.width>0?360*g((e-t.left)/t.width,0,1):0}function w(e){if(/^(data|blob):/i.test(e))return"";const t=(e.split(/[?#]/)[0]??"").split("/").filter(Boolean).pop()??"";try{return decodeURIComponent(t)}catch{return t}}function k({value:t,onChange:i,label:h,theme:g,caption:f,inherited:v,after:w,id:k,readOnly:x,words:y=e.colour}){const E=a(null),L=a(null),N=()=>{const e=E.current?.parentElement;return e?.classList.contains("es-field-head")?e.querySelector(":scope > .es-field-name .es-field-label"):e?.classList.contains("es-pick-line")?e.querySelector(":scope > .es-pick-line-label"):null},B=()=>L.current?.querySelector(".es-pick-hexwrap > *")??null,O=e=>e.scrollWidth>e.clientWidth+1,R=e=>{e&&(O(e)?e.dataset.clipped="true":delete e.dataset.clipped)},D=a(()=>{});D.current=()=>{R(N()),P||R(B())};const[T,M]=s(null),[P,S]=s(null);o(()=>D.current()),c(()=>{const e=E.current?.parentElement,t=e?.ownerDocument.defaultView;if(!e||!t?.ResizeObserver)return;const n=new t.ResizeObserver(()=>D.current());return n.observe(e),()=>n.disconnect()},[]),c(()=>{const e=E.current?.parentElement;if(!e)return;const t=e=>{const t=e;if(!t)return null;const n=N(),r=B();return n&&(t===n||n.contains(t))?n:r&&t===r?r:null},n=e=>{const n=t(e.target),r=U();if(!n||!r||n.ownerDocument.activeElement===n||!O(n))return;const l=n.getBoundingClientRect(),i=r.getBoundingClientRect(),a="INPUT"===n.tagName?n.value:n.textContent??"";M({text:a,left:l.left-i.left,top:l.top-i.top})},r=e=>{t(e.target)&&M(null)};return e.addEventListener("pointerover",n),e.addEventListener("pointerout",r),()=>{e.removeEventListener("pointerover",n),e.removeEventListener("pointerout",r)}},[]);const U=()=>{const e=E.current?.parentElement;return e&&(e.classList.contains("es-field-head")||e.classList.contains("es-pick-line"))?e:L.current},W=t?null:d(v??""),q=void 0===f||t&&d(f)===d(t)?null:f,F=q??(t?m(t):W?m(W):y.notSet);/* @__PURE__ */
2
- return u("div",{ref:E,className:"es-pick-colour",children:/* @__PURE__ */p("div",{ref:L,className:"es-pick-colour-row","data-editing":P??void 0,onFocus:e=>{const t=e.target,n=U();if(!n||!t.classList.contains("es-pick-hex"))return;M(null),t.style.setProperty("--es-pick-edit-room",n.getBoundingClientRect().right-t.getBoundingClientRect().left+"px");const r=t.parentElement?.nextElementSibling,l=!!r&&t.getBoundingClientRect().right>r.getBoundingClientRect().left-2;S(l?"over":"room")},onBlur:e=>{const t=e.target;t.classList.contains("es-pick-hex")&&(t.style.removeProperty("--es-pick-edit-room"),S(null))},children:[
3
- /* @__PURE__ */u(n,{id:k,className:"es-pick-swatch-wrap",trigger:/* @__PURE__ */u("span",{"aria-hidden":"true",style:{position:"absolute",inset:0,...l(t||W)}}),triggerLabel:y.swatch({label:h,shown:F}),triggerClassName:r({className:t?"es-pick-swatch":W?"es-pick-swatch is-inherited":"es-pick-swatch is-unset"}),"aria-label":y.dialog({label:h}),disabled:x,children:/* @__PURE__ */u(b,{value:t,onChange:i,label:h,theme:g,inherited:v,readOnly:x})}),
1
+ import{DEFAULT_PICK_WORDS as e}from"./chunk-643PVCEG.js";import{parseHexColor as t,Popover as n,colorSwatchClasses as r,colorFill as l,ColorPickerPanel as i}from"efficient-shell/ui";export{hexToHsv,hsvToHex}from"efficient-shell/ui";import{useRef as a,useState as s,useLayoutEffect as o,useEffect as c}from"react";import{jsx as u,jsxs as p}from"react/jsx-runtime";var d=t,h=7,m=e=>e.toUpperCase(),g=(e,t,n)=>Math.min(n,Math.max(t,e));function f(e,t,n){return{s:n.width>0?g((e-n.left)/n.width,0,1):0,v:n.height>0?1-g((t-n.top)/n.height,0,1):0}}function v(e,t){return t.width>0?360*g((e-t.left)/t.width,0,1):0}function w(e){if(/^(data|blob):/i.test(e))return"";const t=(e.split(/[?#]/)[0]??"").split("/").filter(Boolean).pop()??"";try{return decodeURIComponent(t)}catch{return t}}function k({value:t,onChange:i,label:h,theme:g,caption:f,inherited:v,after:w,id:k,readOnly:x,words:y=e.colour}){const E=a(null),L=a(null),N=()=>{const e=E.current?.parentElement;return e?.classList.contains("es-field-head")?e.querySelector(":scope > .es-field-name .es-field-label"):e?.classList.contains("es-pick-line")?e.querySelector(":scope > .es-pick-line-label"):null},B=()=>L.current?.querySelector(".es-pick-hexwrap > *")??null,R=e=>e.scrollWidth>e.clientWidth+1,O=e=>{e&&(R(e)?e.dataset.clipped="true":delete e.dataset.clipped)},D=a(()=>{});D.current=()=>{O(N()),S||O(B())};const[T,P]=s(null),[S,M]=s(null);o(()=>D.current()),c(()=>{const e=E.current?.parentElement,t=e?.ownerDocument.defaultView;if(!e||!t?.ResizeObserver)return;const n=new t.ResizeObserver(()=>D.current());return n.observe(e),()=>n.disconnect()},[]),c(()=>{const e=E.current?.parentElement;if(!e)return;const t=e=>{const t=e;if(!t)return null;const n=N(),r=B();return n&&(t===n||n.contains(t))?n:r&&t===r?r:null},n=e=>{const n=t(e.target),r=U();if(!n||!r||n.ownerDocument.activeElement===n||!R(n))return;const l=n.getBoundingClientRect(),i=r.getBoundingClientRect(),a="INPUT"===n.tagName?n.value:n.textContent??"";P({text:a,left:l.left-i.left,top:l.top-i.top})},r=e=>{t(e.target)&&P(null)};return e.addEventListener("pointerover",n),e.addEventListener("pointerout",r),()=>{e.removeEventListener("pointerover",n),e.removeEventListener("pointerout",r)}},[]);const U=()=>{const e=E.current?.parentElement;return e&&(e.classList.contains("es-field-head")||e.classList.contains("es-pick-line"))?e:L.current},W=t?null:d(v??""),q=void 0===f||t&&d(f)===d(t)?null:f,j=q??(t?m(t):W?m(W):y.notSet);/* @__PURE__ */
2
+ return u("div",{ref:E,className:"es-pick-colour",children:/* @__PURE__ */p("div",{ref:L,className:"es-pick-colour-row","data-editing":S??void 0,onFocus:e=>{const t=e.target,n=U();if(!n||!t.classList.contains("es-pick-hex"))return;P(null),t.style.setProperty("--es-pick-edit-room",n.getBoundingClientRect().right-t.getBoundingClientRect().left+"px");const r=t.parentElement?.nextElementSibling,l=!!r&&t.getBoundingClientRect().right>r.getBoundingClientRect().left-2;M(l?"over":"room")},onBlur:e=>{const t=e.target;t.classList.contains("es-pick-hex")&&(t.style.removeProperty("--es-pick-edit-room"),M(null))},children:[
3
+ /* @__PURE__ */u(n,{id:k,className:"es-pick-swatch-wrap",trigger:/* @__PURE__ */u("span",{"aria-hidden":"true",style:{position:"absolute",inset:0,...l(t||W)}}),triggerLabel:y.swatch({label:h,shown:j}),triggerClassName:r({className:t?"es-pick-swatch":W?"es-pick-swatch is-inherited":"es-pick-swatch is-unset"}),"aria-label":y.dialog({label:h}),disabled:x,children:/* @__PURE__ */u(b,{value:t,onChange:i,label:h,theme:g,inherited:v,readOnly:x})}),
4
4
  /* @__PURE__ */u("span",{className:"es-pick-hexwrap",children:null===q?/* @__PURE__ */u(C,{value:t,follows:W?m(W):void 0,onChange:e=>{x||e===t||i(e)},name:y.hex({label:h}),readOnly:x}):/* @__PURE__ */u("span",{className:"es-pick-caption",children:q})}),w,T?/* @__PURE__ */u("span",{className:"es-pick-tag","aria-hidden":"true",style:{left:T.left,top:T.top},children:T.text}):null]})})}function b({value:e,onChange:t,label:n,theme:r,onClose:l,id:a,inherited:s,readOnly:o,words:c,swatch:p,dragWrites:d="live"}){/* @__PURE__ */
5
5
  return u(i,{id:a,className:"es-pick-window",value:e,onChange:t,label:n,presets:r?.map(e=>({value:e.value,label:e.name})),fallback:s,dragWrites:d,disabled:o,onClose:l})}function C({value:e,follows:t,onChange:n,name:r,readOnly:l}){const[i,o]=s(null),c=a(!1);/* @__PURE__ */
6
6
  return u("input",{type:"text",className:!e&&t?"es-pick-hex is-inherited":"es-pick-hex",value:i??(e?m(e):t??""),"aria-label":r,maxLength:7,spellCheck:!1,autoComplete:"off",readOnly:l,onChange:t=>{o(t.target.value);const r=d(t.target.value);null!==r&&r!==e&&n(r)},onFocus:e=>e.currentTarget.select(),onMouseDown:e=>{c.current=e.currentTarget.ownerDocument.activeElement!==e.currentTarget},onMouseUp:e=>{c.current&&e.preventDefault(),c.current=!1},onKeyDown:e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),e.stopPropagation(),o(null),e.currentTarget.blur())},onBlur:()=>o(null)})}export{k as ColourPicker,b as ColourWindow,h as HEX_MAX_LENGTH,m as hexReadout,v as hueFromPoint,w as mediaName,f as svFromPoint,d as typedHex};
@@ -1,4 +1,4 @@
1
- import{PanelToggleIcon as e}from"./chunk-KQMML6JM.js";import{InspectorHead as n}from"./chunk-IE55HNMA.js";import{DEFAULT_CHROME_WORDS as i}from"./chunk-Z6PVRXVY.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{Tooltip as s,IconButton as t,Button as c}from"efficient-shell/ui";import{jsx as r,jsxs as l,Fragment as d}from"react/jsx-runtime";function a({icon:e,title:i,context:o,actions:s,side:t="left",onHide:c}){/* @__PURE__ */
1
+ import{PanelToggleIcon as e}from"./chunk-UMDQ6CLQ.js";import{InspectorHead as n}from"./chunk-IE55HNMA.js";import{DEFAULT_CHROME_WORDS as i}from"./chunk-Z6PVRXVY.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{Tooltip as s,IconButton as t,Button as c}from"efficient-shell/ui";import{jsx as r,jsxs as l,Fragment as d}from"react/jsx-runtime";function a({icon:e,title:i,context:o,actions:s,side:t="left",onHide:c}){/* @__PURE__ */
2
2
  return r(n,{icon:e,name:i,kind:o,actions:s||c?/* @__PURE__ */l(d,{children:[s,c?/* @__PURE__ */r(m,{side:t,onHide:c,divider:Boolean(s)}):null]}):void 0})}function m({side:n,onHide:c,divider:a=!1}){const m=o("chrome",i);/* @__PURE__ */
3
3
  return l(d,{children:[a?/* @__PURE__ */r("span",{className:"sf-head-divider","aria-hidden":"true"}):null,
4
4
  /* @__PURE__ */r(s,{content:m.hidePanel,side:"bottom",children:/* @__PURE__ */r(t,{className:"es-insp-iconbtn","aria-label":m.hidePanelLabel({side:n}),onClick:c,children:/* @__PURE__ */r(e,{side:n})})})]})}function h({side:n,onShow:c}){const l=o("chrome",i);/* @__PURE__ */
@@ -0,0 +1 @@
1
+ var e={colour:{notSet:"Not set",swatch:({label:e,shown:a})=>`${e}: ${a}`,dialog:({label:e})=>`${e} colour`,theme:"Theme colours",themeSwatchTitle:({name:e,hex:a})=>`${e} · ${a}`,themeSwatch:({name:e,hex:a})=>`${e} ${a}`,square:"Saturation and brightness",squareValue:({saturation:e,brightness:a})=>`Saturation ${e}, brightness ${a}`,hue:"Hue",hex:({label:e})=>`${e} hex code`},image:{choosing:"Choosing",failed:"The library could not be opened. Try again.",chooseImage:"Choose an image",chooseVideo:"Choose a video",empty:({label:e,kind:a,placeholder:o})=>`${e}: ${o??"choose "+("video"===a?"a video":"an image")}`,hint:"From the library, or upload one",named:({label:e,name:a})=>`${e}: ${a}`,replace:"Replace",replaceNamed:({label:e})=>`Replace ${e.toLowerCase()}`,remove:"Remove",removeNamed:({label:e})=>`Remove ${e.toLowerCase()}`}};export{e as DEFAULT_PICK_WORDS};
@@ -0,0 +1 @@
1
+ var e={add:{stop:"Stop adding here",hint:"Drag onto the page.",search:"Search blocks",searchPlaceholder:({label:e})=>e,clearSearch:"Clear search",nothing:({query:e})=>`Nothing matches “${e}”`,tryAnother:"Try another word.",tile:({label:e})=>`Add ${e}`},canvas:{addSection:"Add section",addBlock:"Add block",addButton:({label:e})=>`+ ${e}`,handle:({label:e})=>`Drag to move this ${e.toLowerCase()}`}};export{e as DEFAULT_DRAG_WORDS};
@@ -1,2 +1,2 @@
1
- import{ScreenPartsProvider as t}from"./chunk-U7KFFC7N.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-SJPKSE5G.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
1
+ import{ScreenPartsProvider as t}from"./chunk-WP7AZDCV.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-KE2CXEIK.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
2
2
  return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
@@ -1 +1 @@
1
- import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-VWXUMVCD.js";import{EaselMenuItems as r,menuLabel as i}from"./chunk-EA2HTX37.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-ILXP5VX5.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as z,LayersIcon as P,CopyIcon as O}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const o=[],l=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===t)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var X=c(),K=/* @__PURE__ */new WeakMap;function j(e){if(e.claimsPage)return X;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=K.get(n);return t||(t=c(),K.set(n,t)),t}function M(){return j(n())}function S(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function T(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function V(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?S(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=S(e,l.zone,l.index+1);if(o(n,t))return t}return null}function E(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key||"Backspace"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function L(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=T(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:V(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(n,o){const{zone:l,index:r}=o,i=n.nodeAt(l,r);if(!i)return[];const c=i.props.id,a=n.labelOf(i.type,l),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,l),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),h=n.permits?.(i)??{duplicate:!0,delete:!0},y=T(n,i,l),k=D(n,o),b=d.held,v=b&&!p?V(n,b,o):null,g=!n.readOnly,w=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,l),onCopy:()=>n.style?.copy(i,l),onPaste:()=>n.style?.paste(l,r,i),words:n.words?.styleClipboard}):[];return s({title:a,words:n.words?.menu,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},r=e.zone===t?null:n.slotRung?.(e.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,l)?()=>n.beginRename(l,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:n.menuRows?.(i,l,r)??void 0,pinnedLine:p?R(n).pinned:void 0})}var R=e=>e.words?.screen??l.menu;function U(e){const n=R(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=S(e,t,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===t)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??l.pageSettings,icon:/* @__PURE__ */A(z,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(P,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function B(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=R(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function Y(e){return e.shiftKey}function N(e,n){const[t,l]=y(null),r=k(()=>l(null),[]);o(null!==t,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=E(e);if(!o)return;const l=t.selected();if(!l)return;const r=L(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(n,"keydown",c);const a=k(n=>{if(Y(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(n,"contextmenu",t=>{if(Y(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=p(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(n,"mousedown",r),d(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:t?/* @__PURE__ */A(F,{host:e,target:t,onClose:r}):null,closeMenu:r}}function F({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?B(e,n.el):U(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),children:/* @__PURE__ */A(r,{items:o,onClose:t})})}export{X as EASEL_NODE_CLIPBOARD,D as ancestorChain,j as nodeClipboardOf,T as nodeClipboardRules,I as nodeMenuItems,E as nodeShortcut,U as pageMenuItems,V as pastePlace,L as runNodeShortcut,B as textMenuItems,M as useNodeClipboard,N as useNodeContextMenu};
1
+ import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-VVPZMWJE.js";import{EaselMenuItems as r,menuLabel as i}from"./chunk-EA2HTX37.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-ILXP5VX5.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as P,LayersIcon as z,CopyIcon as O}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const o=[],l=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===t)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var K=c(),X=/* @__PURE__ */new WeakMap;function j(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=X.get(n);return t||(t=c(),X.set(n,t)),t}function M(){return j(n())}function S(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function T(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function E(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?S(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=S(e,l.zone,l.index+1);if(o(n,t))return t}return null}function V(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key||"Backspace"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function L(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=T(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:E(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(n,o){const{zone:l,index:r}=o,i=n.nodeAt(l,r);if(!i)return[];const c=i.props.id,a=n.labelOf(i.type,l),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,l),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),h=n.permits?.(i)??{duplicate:!0,delete:!0},y=T(n,i,l),k=D(n,o),b=d.held,v=b&&!p?E(n,b,o):null,g=!n.readOnly,w=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,l),onCopy:()=>n.style?.copy(i,l),onPaste:()=>n.style?.paste(l,r,i),words:n.words?.styleClipboard}):[];return s({title:a,words:n.words?.menu,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},r=e.zone===t?null:n.slotRung?.(e.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,l)?()=>n.beginRename(l,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:n.menuRows?.(i,l,r)??void 0,pinnedLine:p?R(n).pinned:void 0})}var R=e=>e.words?.screen??l.menu;function B(e){const n=R(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=S(e,t,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===t)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??l.pageSettings,icon:/* @__PURE__ */A(P,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(z,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function U(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=R(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function Y(e){return e.shiftKey}function N(e,n){const[t,l]=y(null),r=k(()=>l(null),[]);o(null!==t,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=V(e);if(!o)return;const l=t.selected();if(!l)return;const r=L(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(n,"keydown",c);const a=k(n=>{if(Y(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(n,"contextmenu",t=>{if(Y(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=p(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(n,"mousedown",r),d(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:t?/* @__PURE__ */A(F,{host:e,target:t,onClose:r}):null,closeMenu:r}}function F({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?U(e,n.el):B(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),children:/* @__PURE__ */A(r,{items:o,onClose:t})})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,j as nodeClipboardOf,T as nodeClipboardRules,I as nodeMenuItems,V as nodeShortcut,B as pageMenuItems,E as pastePlace,L as runNodeShortcut,U as textMenuItems,M as useNodeClipboard,N as useNodeContextMenu};
@@ -1,2 +1,2 @@
1
- import{noControlField as e}from"./chunk-7F52SZOI.js";import{usePreviewDevice as n}from"./chunk-BSPCSC45.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-VWXUMVCD.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{jsx as o}from"react/jsx-runtime";function i(e){return"mobile"===e?"mobile":"desktop"}var c={desktop:null,tablet:r.deviceNote.tablet,mobile:r.deviceNote.mobile},u="data-sf-device-hidden";function d(){/* @__PURE__ */
1
+ import{noControlField as e}from"./chunk-7F52SZOI.js";import{usePreviewDevice as n}from"./chunk-BSPCSC45.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-VVPZMWJE.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{jsx as o}from"react/jsx-runtime";function i(e){return"mobile"===e?"mobile":"desktop"}var c={desktop:null,tablet:r.deviceNote.tablet,mobile:r.deviceNote.mobile},u="data-sf-device-hidden";function d(){/* @__PURE__ */
2
2
  return o("span",{hidden:!0,[u]:""})}function s({tier:e,render:r,...t}){return i(n())===e?/* @__PURE__ */o(r,{...t}):/* @__PURE__ */o(d,{})}var m="__device";function f(e){const n=e?.[m];return n??null}function l(e){return f(e)?.inner??e}function a(e,n){const r=n.render;return{...n,[m]:{tier:e,inner:n},render:n=>/* @__PURE__ */o(s,{tier:e,render:r,...n})}}function p(){const e=t("screen",r).deviceNote,i=n(),c="desktop"===i?null:e[i];return c?/* @__PURE__ */o("div",{className:"sf-device-scope",children:c}):/* @__PURE__ */o(d,{})}function v(){return e({type:"custom",render:()=>/* @__PURE__ */o(p,{})},"always")}export{m as DEVICE_FIELD_MARKER,u as DEVICE_HIDDEN_ATTR,c as DEVICE_NOTE,a as deviceField,f as deviceMetaOf,v as deviceNote,i as shownTier,l as withoutDeviceGate};
@@ -1,6 +1,6 @@
1
- import{DEFAULT_FIELDS_WORDS as e}from"./chunk-FFYXVAAL.js";import{useWords as l}from"./chunk-MFIRYGHW.js";import{SearchableSelect as a,Select as n}from"efficient-shell/ui";import{jsx as s,jsxs as i}from"react/jsx-runtime";function r(e,l){return e.find(e=>Object.is(e.value,l))}var o=e=>String(e);function t(r){const{id:t,options:u,placeholder:d,readOnly:c=!1,ariaLabel:v,ariaLabelledBy:h,searchable:m=!1,searchPlaceholder:p,groupCount:f=!1,renderOption:b}=r,g=l("fields",e),O=h?{"aria-labelledby":h}:v?{"aria-label":v}:{},j=u.some(e=>void 0!==e.thumb),x=j||void 0!==b||u.some(e=>void 0!==e.meta),N=e=>""===e?void 0:u[Number(e)],y=(e,l)=>{const a=N(e.value);return a?/* @__PURE__ */i("span",{className:"es-fsel-row",children:[j?/* @__PURE__ */s("span",{className:"es-fsel-thumb","aria-hidden":"true",children:a.thumb?/* @__PURE__ */s("img",{src:a.thumb,alt:"",loading:"lazy"}):null}):null,
2
- /* @__PURE__ */s("span",{className:"es-fsel-label",children:b?b(a,{active:l.active??!1,chosen:l.selected}):a.label}),void 0===a.meta||m?null:/* @__PURE__ */s("span",{className:"es-fsel-meta","aria-hidden":"true",children:a.meta})]}):e.label},C=[];let V=null;if(u.forEach((e,l)=>{const a={value:o(l),label:e.label,...e.disabled?{disabled:!0}:{},...m&&e.meta?{sublabel:e.meta}:{},...!m&&e.description?{description:e.description}:{}};void 0===e.group?(V=null,C.push(a)):V&&V.label===e.group?V.options.push(a):(V={label:e.group,options:[a]},C.push(V))}),f)for(const e of C)"options"in e&&(e.label=`${e.label} ${e.options.length}`);const A=e=>e.flatMap(e=>{const l=N(e.value);return l?[l]:[]});if(m){const l={id:t,options:C,placeholder:p??d??g.search??e.search,disabled:c,renderOption:x?y:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],n=r.onChange;/* @__PURE__ */
1
+ import{DEFAULT_FIELDS_WORDS as e}from"./chunk-WRFD4EXD.js";import{useWords as l}from"./chunk-MFIRYGHW.js";import{SearchableSelect as a,Select as n}from"efficient-shell/ui";import{jsx as s,jsxs as i}from"react/jsx-runtime";function r(e,l){return e.find(e=>Object.is(e.value,l))}var o=e=>String(e);function t(r){const{id:t,options:u,placeholder:d,readOnly:c=!1,ariaLabel:v,ariaLabelledBy:h,searchable:m=!1,searchPlaceholder:p,groupCount:f=!1,renderOption:b}=r,g=l("fields",e),O=h?{"aria-labelledby":h}:v?{"aria-label":v}:{},j=u.some(e=>void 0!==e.thumb),x=j||void 0!==b||u.some(e=>void 0!==e.meta),N=e=>""===e?void 0:u[Number(e)],y=(e,l)=>{const a=N(e.value);return a?/* @__PURE__ */i("span",{className:"es-fsel-row",children:[j?/* @__PURE__ */s("span",{className:"es-fsel-thumb","aria-hidden":"true",children:a.thumb?/* @__PURE__ */s("img",{src:a.thumb,alt:"",loading:"lazy"}):null}):null,
2
+ /* @__PURE__ */s("span",{className:"es-fsel-label",children:b?b(a,{active:l.active??!1,chosen:l.selected}):a.label}),void 0===a.meta||m?null:/* @__PURE__ */s("span",{className:"es-fsel-meta","aria-hidden":"true",children:a.meta})]}):e.label},C=[];let T=null;if(u.forEach((e,l)=>{const a={value:o(l),label:e.label,...e.disabled?{disabled:!0}:{},...m&&e.meta?{sublabel:e.meta}:{},...!m&&e.description?{description:e.description}:{}};void 0===e.group?(T=null,C.push(a)):T&&T.label===e.group?T.options.push(a):(T={label:e.group,options:[a]},C.push(T))}),f)for(const e of C)"options"in e&&(e.label=`${e.label} ${e.options.length}`);const V=e=>e.flatMap(e=>{const l=N(e.value);return l?[l]:[]});if(m){const l={id:t,options:C,placeholder:p??d??g.search??e.search,disabled:c,renderOption:x?y:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],n=r.onChange;/* @__PURE__ */
3
3
  return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,multiple:!0,value:u.flatMap((l,a)=>e.some(e=>Object.is(e,l.value))?[o(a)]:[]),onChange:e=>n(u.filter((l,a)=>e.includes(o(a))).map(e=>e.value))})})}const n=u.findIndex(e=>Object.is(e.value,r.value)),i=r.onChange;/* @__PURE__ */
4
- return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,value:n>=0?o(n):"",clearable:!1,onChange:e=>{const l=N(e);l&&!Object.is(l.value,r.value)&&i(l.value)}})})}const T={id:t,size:"sm",className:"es-fsel-button",options:C,placeholder:d??g.choose,readOnly:c,renderOption:x?y:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],l=l=>e.some(e=>Object.is(e,l.value)),a=u.flatMap((e,a)=>l(e)?[o(a)]:[]),i=r.onChange;/* @__PURE__ */
5
- return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...T,multiple:!0,value:a,renderValue:r.renderValue?e=>r.renderValue(A(e)):void 0,valueText:r.valueText?e=>r.valueText(A(e)):void 0,onChange:e=>i(u.filter((l,a)=>e.includes(o(a))).map(e=>e.value))})})}const M=u.findIndex(e=>Object.is(e.value,r.value)),F=r.onChange;/* @__PURE__ */
6
- return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...T,value:M>=0?o(M):"",renderValue:r.renderValue?e=>r.renderValue(A(e)[0]):void 0,valueText:r.valueText?e=>r.valueText(A(e)[0]):void 0,footer:r.footer?.length?[...r.footer]:void 0,changed:r.changed,onChange:e=>{const l=N(e);l&&!Object.is(l.value,r.value)&&F(l.value)}})})}export{t as FieldSelect,r as optionFor};
4
+ return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,value:n>=0?o(n):"",clearable:!1,onChange:e=>{const l=N(e);l&&!Object.is(l.value,r.value)&&i(l.value)}})})}const A={id:t,size:"sm",className:"es-fsel-button",options:C,placeholder:d??g.choose,readOnly:c,renderOption:x?y:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],l=l=>e.some(e=>Object.is(e,l.value)),a=u.flatMap((e,a)=>l(e)?[o(a)]:[]),i=r.onChange;/* @__PURE__ */
5
+ return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,multiple:!0,value:a,renderValue:r.renderValue?e=>r.renderValue(V(e)):void 0,valueText:r.valueText?e=>r.valueText(V(e)):void 0,onChange:e=>i(u.filter((l,a)=>e.includes(o(a))).map(e=>e.value))})})}const M=u.findIndex(e=>Object.is(e.value,r.value)),I=r.onChange;/* @__PURE__ */
6
+ return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,value:M>=0?o(M):"",renderValue:r.renderValue?e=>r.renderValue(V(e)[0]):void 0,valueText:r.valueText?e=>r.valueText(V(e)[0]):void 0,footer:r.footer?.length?[...r.footer]:void 0,changed:r.changed,onChange:e=>{const l=N(e);l&&!Object.is(l.value,r.value)&&I(l.value)}})})}export{t as FieldSelect,r as optionFor};
@@ -1,4 +1,4 @@
1
- import{tokenizeInline as e,STANDARD_MARKUP as t}from"./chunk-546BBOPE.js";import{jsx as n,jsxs as l}from"react/jsx-runtime";import{useRef as r}from"react";function s(t,n){const l=[];let r=0;for(const s of e(t,n)){if("text"===s.kind){s.text.length>0&&(l.push({kind:"text",text:t.slice(r,r+s.text.length)}),r+=s.text.length);continue}const e=i(t,r,s.kind,s.text,n);if(!e)return[{kind:"text",text:t}];const o=r+e.open.length,c=o+s.text.length,a=c+e.close.length;l.push({kind:"delimiter",text:t.slice(r,o)}),l.push({kind:s.kind,text:t.slice(o,c)}),l.push({kind:"delimiter",text:t.slice(c,a)}),r=a}return l.map(e=>e.text).join("")!==t?[{kind:"text",text:t}]:l}function i(e,t,n,l,r){for(const s of r){if(s.kind!==n)continue;if(!e.startsWith(s.open,t))continue;const r=t+s.open.length;if(e.startsWith(l,r)&&e.startsWith(s.close,r+l.length))return s}return null}function o({value:e,rules:l=t,className:r,layerRef:i}){const o=s(e,l);/* @__PURE__ */
1
+ import{tokenizeInline as e,STANDARD_MARKUP as t}from"efficient-shell/markup";import{jsx as n,jsxs as l}from"react/jsx-runtime";import{useRef as r}from"react";function s(t,n){const l=[];let r=0;for(const s of e(t,n)){if("text"===s.kind){s.text.length>0&&(l.push({kind:"text",text:t.slice(r,r+s.text.length)}),r+=s.text.length);continue}const e=i(t,r,s.kind,s.text,n);if(!e)return[{kind:"text",text:t}];const o=r+e.open.length,c=o+s.text.length,a=c+e.close.length;l.push({kind:"delimiter",text:t.slice(r,o)}),l.push({kind:s.kind,text:t.slice(o,c)}),l.push({kind:"delimiter",text:t.slice(c,a)}),r=a}return l.map(e=>e.text).join("")!==t?[{kind:"text",text:t}]:l}function i(e,t,n,l,r){for(const s of r){if(s.kind!==n)continue;if(!e.startsWith(s.open,t))continue;const r=t+s.open.length;if(e.startsWith(l,r)&&e.startsWith(s.close,r+l.length))return s}return null}function o({value:e,rules:l=t,className:r,layerRef:i}){const o=s(e,l);/* @__PURE__ */
2
2
  return n("div",{ref:i,className:["es-gold-layer",r??""].filter(Boolean).join(" "),"aria-hidden":"true",children:o.map((e,t)=>function(e,t){const{kind:l,text:r}=e;switch(l){case"delimiter":/* @__PURE__ */
3
3
  return n("span",{className:"es-gold-delim",children:r},t);case"accent":case"highlight":/* @__PURE__ */
4
4
  return n("em",{className:"es-gold-mark es-gold-accent",children:r},t);case"bold":/* @__PURE__ */
@@ -0,0 +1,13 @@
1
+ import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPick as l}from"./chunk-ECM5F6JJ.js";import{setCanvasNonce as s,isTypingTarget as a,frameRectToHost as c,CANVAS_TYPING_EVENT as d,drawnBox as u}from"./chunk-ILXP5VX5.js";import{find as p,ROOT_ID as f,getList as h,remove as m,parseZoneKey as g,move as v,duplicate as y,replaceNode as w,createNode as b,insert as k,normalizeData as S,createResolveCache as C,resolveNodeData as I,ROOT_SLOT as E}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as x,fieldsFrom as D,defaultsFrom as M}from"./chunk-NKB3KVAB.js";import{selectionBox as A,placeWindow as O,offsetOrigin as z,colorRunOf as R,ColorWindow as P,startCanvasTyping as L,textMap as B}from"./chunk-WDQY6JMM.js";import{DEFAULT_COPY_WORDS as V}from"./chunk-33C6ALT5.js";import{useWords as $}from"./chunk-MFIRYGHW.js";import{createContext as N,useEffect as K,useContext as j,useRef as Z,useSyncExternalStore as F,useState as T,useMemo as H,useCallback as W,useLayoutEffect as Y}from"react";import{jsx as q,jsxs as X,Fragment as J}from"react/jsx-runtime";import{createPortal as U}from"react-dom";import{registerModalEscapeInterceptor as Q,FloatingBar as G,TextToolbar as _,LinkPicker as ee}from"efficient-shell/ui";function te(e){return!["setData","setUi","set"].includes(e.type)}var ne=(e,t,n,o)=>{const r=h(e,t,g(n));return r?.[o]??null},oe=(e,t,n,o,r)=>{const i=ne(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function re(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function ie(e,t,n){return n?"node"===n.kind?p(e,t,n.id)?n:null:n.parentId===f?h(e,t,n)?n:null:p(e,t,n.parentId)&&h(e,t,n)?n:null:null}function le(e,t,n,r=!1){const{itemSelector:i,selectedSlot:l,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,i??null)),"selectedSlot"in n&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function se(e,t,n){const o=ae(e,t,n);if(o===e)return e;const r=ie(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ae(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return le(e,n,"function"==typeof t.ui?t.ui(re(e,n)):t.ui);case"set":{const r={data:o,ui:re(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=le(l,n,i.ui,!0)),l}case"insert":{const r={...g(t.destinationZone),index:t.destinationIndex},i=b(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:k(o,n,r,i)}}case"replace":{const r=oe(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:w(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=oe(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=y(o,n,r.props.id),l=ne(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return ae(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=ne(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...g(t.destinationZone),index:t.destinationIndex};return{...e,data:v(o,n,r.props.id,i)}}case"remove":{const r=oe(o,n,t.zone,t.index,"remove");return{...e,data:m(o,n,r.props.id)}}default:return e}}var ce={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},de={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},ue=0,pe=()=>`history-${ue+=1}`;function fe(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=S(e.data,t);let a={data:s,selection:null,ui:{...de}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;a={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...de,...i}}}let c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:a,at:n}]:(c=[...c.slice(0,d+1),{core:a,at:n,sealed:e,id:pe()}],d=c.length-1)},f=/* @__PURE__ */new Set;let m=null,g=null,v=0,y=null,b=!1;const k=()=>{for(const e of[...f])e()},E=()=>{c=[...c.slice(0,d),{...c[d],core:a},...c.slice(d+1)]},x=(t,n)=>{v>0?b=b||n:(n?u(!1):a!==t&&E(),a.data!==t.data&&e.onChange?.(a.data),a!==t&&k())},D=e=>{const n=a;if(a=se(a,e,t),a===n)return;const o=e.recordHistory??te(e);x(n,o&&a.data!==n.data)},M=t=>{0===v&&(y=a,b=!1),v+=1;try{t()}catch(e){throw v-=1,0===v&&y&&(a=y,y=null),e}if(v-=1,v>0||!y)return;const n=y;y=null,b&&a.data!==n.data?u(!0):a!==n&&E(),a.data!==n.data&&e.onChange?.(a.data),a!==n&&k()},A=e=>{const n=a,o=ie(a.data,t,e);var r,i;(r=o,i=a.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(a={...a,selection:o},x(n,!1))},O=t=>{const n=a;d=t,a=c[d].core,a.data!==n.data&&e.onChange?.(a.data),a!==n&&k()},z=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...ce,...l,...n}};let R=z();const P=C(),L={resolveCache:P,async resolveAll({trigger:e="load",metadata:n}={}){const o=a.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[l,...s]=await Promise.all([I(r,t,{cache:P,trigger:e,metadata:n}),...i.map(o=>I(o,t,{cache:P,trigger:e,metadata:n}))]);M(()=>{const e=a;let n=a.data;s.forEach((e,r)=>{if(!e.didChange)return;const l=i[r].props.id,s=p(n,t,l)?.node;s&&s===p(o,t,l)?.node&&(n=w(n,t,l,e.node))}),l.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:l.node.props,readOnly:l.node.readOnly??n.root.readOnly}}),n!==a.data&&(a={...a,data:n,selection:ie(n,t,a.selection)},x(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=p(a.data,t,e)?.node;if(!r)return!1;const i=await I(r,t,{cache:P,trigger:n,metadata:o});if(!i.didChange)return!1;let l=!1;return M(()=>{const n=a;if(p(a.data,t,e)?.node!==r)return;const o=w(a.data,t,e,i.node);o!==a.data&&(a={...a,data:o,selection:ie(o,t,a.selection)},x(n,!1),l=!0)}),l},get config(){return t},getState(){if(m&&g===a)return m;const e=a,o={data:e.data,ui:re(e,t)},r="node"===e.selection?.kind?p(e.data,t,e.selection.id)?.node??null:null;return m={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:D,history:{back:()=>L.undo(),forward:()=>L.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:re(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&O(e)}},getPermissions:R,getItemById:n=>p(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return h(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},g=e,m},subscribe:e=>(f.add(e),()=>{f.delete(e)}),dispatch:D,batch:M,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>A(e?{kind:"node",id:e}:null),selectSlot:e=>A(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){M(()=>{const n=a,o=void 0===e.select?a.selection:e.select;a={...a,data:e.data,selection:ie(e.data,t,o)},x(n,e.data!==n.data)})},load(e,n={}){const o=a,r=S(e,t);a={...a,data:r,selection:ie(r,t,n.selection??a.selection)},n.keepHistory||(c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0),a!==o&&k()},undo(){d>0&&O(d-1)},redo(){d<c.length-1&&O(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,R=z(),m=null,k())},setConfig(e){e!==t&&(t=e,R=z(),m=null,k())}};return L}function he(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&a(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var me=N(null),ge=N(!0);function ve({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return K(()=>{n&&e.resolveAll()},[e,n]),K(()=>{if(t&&"undefined"!=typeof document)return he(document,e)},[e,t]),/* @__PURE__ */q(me.Provider,{value:e,children:/* @__PURE__ */q(ge.Provider,{value:t,children:o})})}function ye(){const e=j(me);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function we(e){const t=ye(),n=Z({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return F(t.subscribe,o,o)}function be(){return function(e){return we(e)}}var ke="data-puck-component",Se="data-puck-dropzone",Ce={},Ie="data-es-mirror",Ee="undefined"==typeof window?K:Y;function xe(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Ie}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Ie,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function De({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:a,height:c="auto",nonce:d}){const u=$("canvas",e),p=Z(null),[f,h]=T(null);return Ee(()=>{const e=p.current,t=f?.ownerDocument.defaultView;if("auto"!==c||!e||!f||!t)return;const n=()=>{e.style.height=`${Math.ceil(f.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(f),()=>r?.disconnect()},[f,c]),Ee(()=>{let e=p.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=p.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===c&&t.classList.add("es-frame-fill"),e.body.appendChild(t),s(e,d),h(t),a?.(e);let n=null;const o=p.current?.ownerDocument;if(l&&o){xe(o,e,d);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>xe(o,e,d)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),h(null),a?.(null)}},[]),/* @__PURE__ */q("iframe",{ref:p,id:n,title:o??u.frame,className:["es-canvas-frame","fill"===c?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:f?U(t,f):null})}var Me=N(null),Ae=N(Ce),Oe=[];function ze({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=ye(),s=we(n=>h(n.appState.data,l.config,{parentId:e,slot:t})??Oe),a=we(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==f),c=we(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=j(Me),u=["es-zone"];return s.length&&u.push("has-children"),e===f&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==f&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */q("div",{className:u.join(" "),[Se]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */q(Ke,{node:e},e.props.id))})}function Re(e,t){return H(()=>{const n={};for(const o of x(D(e)))n[o]=function(e={}){/* @__PURE__ */
2
+ return q(ze,{parentId:t,slot:o,...e})};return n},[e,t])}function Pe(e){return H(()=>function({zone:t,...n}){/* @__PURE__ */
3
+ return q(ze,{parentId:e,slot:t,...n})},[e])}var Le=["top","bottom","zIndex"];function Be(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Ve(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Be(e,"position",t?"sticky":"relative");for(const n of Le)Be(e,n,t?.[n]??"");return!!t}var $e="data-es-canvas-relative";function Ne(e){e.hasAttribute($e)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute($e));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute($e,"")),!1)}function Ke({node:e}){const t=ye().config.components[e.type],n=e.props.id,o=Z(null),r=function(e,t){return H(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ke),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ke,e),n.setAttribute("data-puck-dnd",e),Ne(n))},[e,t])}(n,o),i=Z(null),l=!!t?.inline;!function(e,t){const n=Z(!1),o=Z(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=Z(()=>{});Ee(()=>o.current()),Ee(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>l?o.current:i.current,e=>l?Ne(e):Ve(e));const s=j(Ae),a=Re(t,n),c=Pe(n);if(!t?.render)return null;const d=t.render,u={...M(t),...e.props,...a},p={renderDropZone:c,isEditing:!0,dragRef:t.inline?r:null,metadata:{...s,...t.metadata}};return t.inline?/* @__PURE__ */q(d,{...u,puck:p,editMode:!0}):
4
+ /* @__PURE__ */q("div",{ref:i,[ke]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */q(d,{...u,puck:p,editMode:!0})})}function je({metadata:e}){const t=we(e=>e.config),n=we(e=>e.appState.data.root).props??{},o=t.root?.render,r=Re(t.root,f),i=Pe(f),l=/* @__PURE__ */q(ze,{parentId:f,slot:E}),s=o?/* @__PURE__ */q(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
5
+ return q(Ae.Provider,{value:e??Ce,children:s})}var Ze=N(void 0);function Fe(e,t,n){const[o,r]=T(null),i=Z(t);return i.current=t,Ee(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const l=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=u(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function Te({id:e,kind:t,overlay:n}){const o=Z(null),r=Fe(o,e?t=>t.querySelector(`[${ke}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),i=/* @__PURE__ */q("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */q(n,{componentId:e,kind:t,children:i}):i}function He(e,t,n){const o=B(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function We({s:e,element:t,toolbar:n,label:o,keys:r}){const i=$("copy",V),l=e.pressed(),s=new Set(n.offered),a=n.colors&&n.colors.length>0?n.colors:null,d=Z(null),[u,p]=T(!1),[f,h]=T(null),m=u||null!==f,g=()=>{e.hold(),p(!1),h({href:e.pressed().href})},v=()=>{p(!1),h(null),e.resume()};Y(()=>{r.current={escape:()=>!!m&&(v(),!0),link:()=>!!s.has("link")&&(g(),!0)}}),Y(()=>()=>{r.current=null},[r]);const y=Z(v);y.current=v,K(()=>{if(u)return Q(e=>{const t=d.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(y.current(),!0)},()=>d.current?.querySelector(".es-copy-colors"))},[u]),K(()=>{const n=d.current;if(!m||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;p(!1),h(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[m,e,t]),Y(()=>{const e=d.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(m&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?A(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,a=s?c(s,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},u=o.getBoundingClientRect(),p=s?c(s,{left:u.left,top:u.top,width:u.width,height:u.height}):{left:u.left,top:u.top,width:u.width,height:u.height},f=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),h={left:a.left,right:a.left+a.width,top:Math.min(a.top,p.top-6,f.top),bottom:Math.max(a.top+a.height,p.top+p.height+6,f.bottom)},g=e.ownerDocument.documentElement,v=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),y={left:Math.max(0,v.left),top:Math.max(0,v.top),right:Math.min(g.clientWidth||v.right,v.right),bottom:Math.min(g.clientHeight||v.bottom,v.bottom)};if(y.right<=y.left||y.bottom<=y.top||0===n.offsetWidth)return;const w=O({anchor:h,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:v.left,top:v.top,right:v.right,bottom:v.bottom},clip:y,parent:z(n)});n.style.top=`${w.top}px`,n.style.left=`${w.left}px`,n.style.setProperty("--es-pop-point",`${w.point}px`),n.dataset.side=w.above?"above":"below"});const w=a?{run:R(l.color,a),open:u,onToggle:()=>{h(null),u?v():(e.hold(),p(!0))}}:void 0;/* @__PURE__ */
6
+ return q(G,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?c(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */q("div",{ref:d,style:{width:"18rem"},children:/* @__PURE__ */q(_,{offered:s,pressed:l.marks,onMark:t=>{"link"===t?g():e.press(t)},color:w,linkOpen:null!==f,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */X(J,{children:[u&&a?/* @__PURE__ */q(P,{colors:a,current:l.color,words:i.colors??V.colors,onPick:t=>e.color(t)}):null,f?
7
+ /* @__PURE__ */q(ee,{className:"es-copy-link es-copy-pop",value:f.href??"",onApply:t=>{h(null),e.link(t)},onRemove:null!==f.href?()=>{h(null),e.link(null)}:void 0,onCancel:v}):null]})})})})}function Ye({element:e}){const t=Z(null),n=Fe(t,()=>e(),e);/* @__PURE__ */
8
+ return q("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function qe({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:s,onDocument:a,height:c,title:u,nonce:p,hotkeys:f,frameWrapper:h,overlay:m,children:g,typing:v,passThrough:y}){const w=ye(),b=j(Ze),k=y??b,S=j(ge),C=$("canvas",e),I=f??S,[E,x]=T(void 0),D=we(e=>"node"===e.selection?.kind?e.selection.id:null),[M,A]=T(null),[O,z]=T(null),R=Z(null),[,P]=T(0),B=Z(v);B.current=v;const V=Z(null),N=Z(null),F=e=>{const t=N.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(d,{detail:{typing:e}}))},H=(e,t)=>{R.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=w.group(),r=e.element,i=L({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:He(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>P(e=>e+1),onEscape:()=>V.current?.escape()??!1,onLinkKey:()=>V.current?.link()??!1,end:e=>{o.close(),R.current?.element===r&&(R.current=null),z(null),F(!1),B.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${ke}]`)?.getAttribute(ke);return l&&w.select(l),R.current={s:i,element:r,target:e},z(()=>r),A(null),F(!0),B.current?.onChange?.({typing:!0,element:n}),!0};K(()=>()=>R.current?.s.stop("stop"),[]);const W=e=>{const t=R.current?.element();return Boolean(t&&t.contains(e))},Y=e=>{const t=e.closest?.(`[${ke}]`)?.getAttribute(ke);if(!t)return;const n=w.getState(),o="node"===n.selection?.kind?n.selection.id:null;return l(n.appState.data,w.config,t,o,k)??t},J=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(R.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=B.current?.atSelection?.();n&&H(n,null)&&e.preventDefault()},U=/* @__PURE__ */X("div",{ref:N,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),R.current){if(W(t))return;R.current.s.stop("outside")}const n=Y(t);void 0===n?t.hasAttribute?.(Se)||w.select(null):w.select(n)},onDoubleClick:e=>{const t=B.current;if(!t||W(e.target))return;const n=t.at(e.target);n&&H(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>J(e),onMouseOver:e=>{if(R.current)return;const t=Y(e.target)??null;t!==M&&A(t)},onMouseLeave:()=>A(null),children:[
9
+ /* @__PURE__ */q(Me.Provider,{value:M,children:/* @__PURE__ */q(je,{metadata:r})}),
10
+ /* @__PURE__ */X("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
11
+ /* @__PURE__ */q(Te,{id:!O&&M&&M!==D?M:null,kind:"hover",overlay:m}),
12
+ /* @__PURE__ */q(Te,{id:O?null:D,kind:"selected",overlay:m}),O?/* @__PURE__ */q(Ye,{element:O}):null]}),g]}),Q=h?/* @__PURE__ */q(h,{document:E,children:U}):U;K(()=>{if(E&&I)return he(E,w)},[E,I,w]),K(()=>{if(!E)return;const e=e=>{if("Enter"===e.key)return void J(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=w.getState();if("node"!==n.selection?.kind)return;const o=i(n.appState.data,w.config,n.selection);"node"===o?.kind&&w.select(o.id)};return E.addEventListener("keydown",e),()=>E.removeEventListener("keydown",e)},[E,w]);/* @__PURE__ */
13
+ return X("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":O?"":void 0,children:[O&&R.current?.target.toolbar?/* @__PURE__ */q(We,{s:R.current.s,element:R.current.element,toolbar:R.current.target.toolbar,label:C.textTools,keys:V}):null,t?/* @__PURE__ */q(De,{mirrorStyles:s,onDocument:e=>{x(e??void 0),a?.(e)},height:c,title:u,nonce:p,children:Q}):/* @__PURE__ */q("div",{id:"preview-frame","data-puck-entry":"",children:Q})]})}function Xe(e={}){const t=ye(),n=we(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Je(){const e=ye(),n=we(e=>e.config),o=e.resolveCache,r=we(e=>e.selectedItem),i=we(e=>e.appState.data.root),l=r?r.props.id:"root",s=i.props??{},a=H(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?p(d.appState.data,n,l):null,f=u&&"root"!==u.place.parentId?u.place.parentId:null,h=f?d.getItemById(f)??null:null,{fields:m}=t({id:l,node:a,block:c,parent:h,appState:d.appState}),g=we(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),v=W(t=>{(async()=>{const r=e.getState();if("root"!==l){const i=r.getItemById(l),s=r.getSelectorForId(l);if(!i||!s)return;const a={...i,props:{...i.props,...t}},{node:c}=await I(a,n,{cache:o,trigger:"replace"}),d=e.getState().getSelectorForId(l);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const i=r.appState.data.root.props??{},{node:s}=await I({type:"root",props:{...i,...t}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,n,o,l]),y=W((e,t)=>v({[e]:t}),[v]);return{id:l,node:a,fields:m,values:a.props,readOnly:g,onChange:y,onChangeMany:v}}export{De as CanvasFrame,Ze as CanvasPassThroughContext,de as DEFAULT_UI,qe as EaselCanvas,ve as EaselProvider,je as EditDocument,he as bindUndoKeys,fe as createEasel,be as createUseEasel,te as recordsByDefault,se as reduce,re as uiView,we as useEasel,ye as useEaselApi,Xe as useEaselNodeOps,Je as useSelectedFields,ie as validSelection};
@@ -0,0 +1 @@
1
+ import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-643PVCEG.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VVPZMWJE.js";import{DEFAULT_CHROME_WORDS as n,DEFAULT_NOTICE_WORDS as c}from"./chunk-Z6PVRXVY.js";import{DEFAULT_LOCK_WORDS as s}from"./chunk-RE4LP46F.js";import{DEFAULT_TREE_WORDS as f}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as p}from"./chunk-KFV7N2DJ.js";import{DEFAULT_NODE_MENU_WORDS as e}from"./chunk-WK3AFPXY.js";import{DEFAULT_RAIL_WORDS as i}from"./chunk-2OAZYSWJ.js";import{DEFAULT_SAVE_WORDS as u}from"./chunk-H6DDIBQ4.js";import{DEFAULT_DRAG_WORDS as k}from"./chunk-AYWN5NRH.js";import{DEFAULT_CANVAS_WORDS as j}from"./chunk-TBY3DFKS.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-WRFD4EXD.js";import{DEFAULT_COPY_WORDS as l}from"./chunk-33C6ALT5.js";var a={notice:c,lock:s,save:u,chrome:n,rail:i,tree:f,panel:p,fields:h,pick:r,drag:k,menu:e,styleClipboard:t,copy:l,canvas:j,textStyles:o,screen:m},Y=o=>"object"==typeof o&&null!==o;function y(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:Y(n)?t[m]=Y(c)?y(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function D(o,r){return r?y(o,r):o}export{a as DEFAULT_EASEL_STRINGS,D as mergeEaselStrings};
@@ -1 +1 @@
1
- import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-DGAXQTDW.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-MQNBD6AB.js";import{ANCHOR_FIELD_KEYS as s,foldMetaOf as c,MEDIA_FIELD_MARKER as i,TEXT_FIELD_MARKER as p,LINK_FIELD_MARKER as u}from"./chunk-DUVRZ456.js";import{STYLE_KIND as a,fieldKind as f,copyStyle as l,heldStyle as m,planPaste as h,pasteMessage as y}from"./chunk-V7U33NF2.js";var j=/* @__PURE__ */new Set([e.Size,e.Design,e.Layout,e.Position]),w=new Set(Object.values(e)),b=new Set(Object.values(r)),S=new Set(s),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[i,p,u];function D(t){return`site:${t??""}`}function v(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,r=n[a]??e[a];if("string"==typeof r)return r;const s=n.options??e.options;if(Array.isArray(s)){return`choice:${s.map(t=>String(t?.value)).sort().join("|")}`}return f(e)}function A(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function d(o,e){const s=t(o,e)??{},i=[];let p=!0,u=!1;for(const[t,o]of Object.entries(s))b.has(t)?(p=t===r.Design,u=!1):w.has(t)?p&&(u=j.has(t)):u&&o&&"object"==typeof o&&!t.startsWith("_")&&(c(o)||S.has(t)||g.has(t)||A(o)||"slot"!==o.type&&i.push({path:[t],kind:v(o),counted:"mobile"!==n(o)?.tier}));return i}function L(t,o,n,e,r){l({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function O(t,o,n,e,r,s){const c=m(n);if(!c)return null;const i=h(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:y(i,c.sourceLabel,r,s)}}function B(t,o,n,e){L(d,t,o,n,e)}function F(t,o,n,e,r){return O(d,t,o,n,e,r)}var I={scope:t=>D(t.siteId),rows:(t,o)=>d(t,o),copy:(t,o,n,e)=>B(e,t,o,n),plan:(t,o,n,e)=>F(e,t,o,n)};function N(t,o){if(!t&&!o)return I;const n=t?.rows,e=n?(t,o)=>n(t,o):d;return{scope:t?.scope??I.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>L(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>O(e,s,t,n,r,o))}}export{B as copyNodeStyle,d as nodeStyleRows,F as planNodePaste,v as shopFieldKind,D as siteStyleScope,N as styleClipboardOf};
1
+ import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-FHLYUIJJ.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-MQNBD6AB.js";import{ANCHOR_FIELD_KEYS as s,foldMetaOf as c,MEDIA_FIELD_MARKER as i,TEXT_FIELD_MARKER as p,LINK_FIELD_MARKER as u}from"./chunk-DUVRZ456.js";import{STYLE_KIND as a,fieldKind as f,copyStyle as l,heldStyle as m,planPaste as h,pasteMessage as y}from"./chunk-V7U33NF2.js";var j=/* @__PURE__ */new Set([e.Size,e.Design,e.Layout,e.Position]),w=new Set(Object.values(e)),b=new Set(Object.values(r)),S=new Set(s),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[i,p,u];function v(t){return`site:${t??""}`}function D(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,r=n[a]??e[a];if("string"==typeof r)return r;const s=n.options??e.options;if(Array.isArray(s)){return`choice:${s.map(t=>String(t?.value)).sort().join("|")}`}return f(e)}function L(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function d(o,e){const s=t(o,e)??{},i=[];let p=!0,u=!1;for(const[t,o]of Object.entries(s))b.has(t)?(p=t===r.Design,u=!1):w.has(t)?p&&(u=j.has(t)):u&&o&&"object"==typeof o&&!t.startsWith("_")&&(c(o)||S.has(t)||g.has(t)||L(o)||"slot"!==o.type&&i.push({path:[t],kind:D(o),counted:"mobile"!==n(o)?.tier}));return i}function A(t,o,n,e,r){l({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function F(t,o,n,e,r,s){const c=m(n);if(!c)return null;const i=h(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:y(i,c.sourceLabel,r,s)}}function I(t,o,n,e){A(d,t,o,n,e)}function O(t,o,n,e,r){return F(d,t,o,n,e,r)}var U={scope:t=>v(t.siteId),rows:(t,o)=>d(t,o),copy:(t,o,n,e)=>I(e,t,o,n),plan:(t,o,n,e)=>O(e,t,o,n)};function B(t,o){if(!t&&!o)return U;const n=t?.rows,e=n?(t,o)=>n(t,o):d;return{scope:t?.scope??U.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>A(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>F(e,s,t,n,r,o))}}export{I as copyNodeStyle,d as nodeStyleRows,O as planNodePaste,D as shopFieldKind,v as siteStyleScope,B as styleClipboardOf};
@@ -0,0 +1 @@
1
+ import{useSectionOps as o}from"./chunk-X4VIDPKV.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-WP7AZDCV.js";import{useEasel as p}from"./chunk-KE2CXEIK.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=p(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),I?.(t)):i(o=>"part"===o.kind?n:o)},[i,I]);c(()=>{k(l)},[k,l]);const K=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(K)},[K,f]);return{selectNode:d(o=>{i(()=>n);const e=a(o);e&&u.select(e)},[i,a,u]),openPartId:K}}export{m as usePartBridge};
@@ -1,18 +1,18 @@
1
- import{DEFAULT_DRAG_WORDS as e}from"./chunk-GG4FGBFR.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-67GNT6PF.js";import{useCanvasLayout as o,useCanvasEvent as s,CANVAS_TYPING_EVENT as i,framePointToHost as c,elementScale as d,frameRectToLayer as u,clientPointToLayer as h}from"./chunk-ILXP5VX5.js";import{withTip as f}from"./chunk-P2VEMZH5.js";import{parseZoneKey as p}from"./chunk-KRXQM65X.js";import{useRef as m,useEffect as g,useState as b,useCallback as x,useMemo as y,useSyncExternalStore as v,useId as w,useLayoutEffect as k}from"react";import{Tooltip as N,IconButton as z,Input as A}from"efficient-shell/ui";import{AddIcon as D,CloseIcon as T,SearchIcon as $}from"efficient-shell/icons/efficient";import{jsxs as C,jsx as M}from"react/jsx-runtime";function S({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const o=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
1
+ import{DEFAULT_DRAG_WORDS as e}from"./chunk-AYWN5NRH.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-67GNT6PF.js";import{withTip as o}from"./chunk-P2VEMZH5.js";import{useCanvasLayout as s,useCanvasEvent as i,CANVAS_TYPING_EVENT as c,framePointToHost as d,elementScale as u,frameRectToLayer as h,clientPointToLayer as f}from"./chunk-ILXP5VX5.js";import{parseZoneKey as p}from"./chunk-KRXQM65X.js";import{useRef as m,useEffect as g,useState as b,useCallback as x,useMemo as y,useSyncExternalStore as v,useId as w,useLayoutEffect as k}from"react";import{Tooltip as N,IconButton as A,Input as z}from"efficient-shell/ui";import{AddIcon as D,CloseIcon as T,SearchIcon as $}from"efficient-shell/icons/efficient";import{jsxs as C,jsx as M}from"react/jsx-runtime";function S({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const o=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
2
2
  return C("div",{className:o,style:n,"data-index":r,children:[
3
3
  /* @__PURE__ */M("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
4
- /* @__PURE__ */M("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */M(N,{content:e,children:/* @__PURE__ */M(z,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */M(D,{})})})})]})}var E=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,j=e=>e.width*e.height;function L(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>E(e.box,t,n)).sort((e,t)=>j(t.s.box)-j(e.s.box)||e.at-t.at).map(({s:e})=>e)}function B(e,t,n){return L(e,t,n).at(-1)??null}function K(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function X(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,o=a??l??e.box;return{left:r-1,top:o.top,width:2,height:o.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function q(e,t,n,l,a=()=>!1,r=()=>!0){const o=e.filter(e=>E(e.box,t,n)).sort((e,t)=>j(e.box)-j(t.box));for(const e of o){const o=K(e,t,n),s={...e.list,index:o};if(a(s))return null;if(l(s))return{zone:e,to:s,line:X(e,o)};if(!r(s))return null}return null}function I(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,o=r?a.left:a.top,s=o+(r?a.width:a.height),i=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let u=0;u<=l.length;u++){const h=l[u-1],f=l[u];let p,m;if(h&&f)p=c(h),m=Math.max(i(f)-p,0);else{const e=h?(c(h)+s)/2:(o+i(f))/2;p=Math.min(Math.max(e,o+n),s-n),m=0}const g=r?{left:p,top:a.top,width:m,height:a.height}:{left:a.left,top:p,width:a.width,height:m};d.push({key:`${e.key}:+${u}`,place:{...e.list,index:u},box:g,axis:e.axis,label:t})}return d}function P(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],o=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(r.top-o,0)}})}return n}var F={nodes:[],zones:[]},G="data-puck-dropzone",O="data-puck-component";function R(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function V(e,t){const{frame:n,document:l}=e,a=e=>u(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],o=[];for(const e of l.querySelectorAll(`[${G}]`)){const t=e.getAttribute(G)??"";let n;try{n=p(t)}catch{continue}const l=[...e.querySelectorAll(`[${O}]`)].filter(t=>t.parentElement?.closest(`[${G}]`)===e),s=l.map(a);o.push({key:t,list:n,box:a(e),axis:R(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(O);l&&r.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:r,zones:o}}var Z="data-es-empty-cell",Y="data-puck-dropzone",H=140;var Q=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function W(u){const{canvas:f,session:p,readOnly:w,words:z=e.canvas}=u,A=m(u);g(()=>{A.current=u});const D=m(null),T=o(f),[$,E]=b(0),j=x(()=>E(e=>e+1),[]),[B,K]=b(F);g(()=>{const e=D.current;f&&e&&K((A.current.measure??V)(f,e))},[f,T,u.revision,$]);const X=u.model,I=y(()=>X(B),[X,B]),P=v(p.subscribe,p.shown,p.shown),G=u.choose,O=(e,t)=>{const n=L(I.sources,e,t);return 0===n.length?null:G?G(n):n[n.length-1]},[R,H]=b(null),[W,J]=b(null),U=m(null),_=()=>{U.current&&clearTimeout(U.current),U.current=null},ee=()=>{_(),U.current=setTimeout(()=>{p.get()||H(null)},140)};g(()=>_,[]);const te=m(null),ne=m(!1);s(f,i,e=>{ne.current=Boolean(e.detail?.typing),ne.current&&(_(),H(null))}),s(f,"mousemove",e=>{const t=D.current;if(!f||!t)return;const n=c(f.frame,e.clientX,e.clientY,t),l=d(t),a={x:n.x/l,y:n.y/l};if(te.current=a,A.current.readOnly||p.get()||ne.current)return;_();const r=O(a.x,a.y);H(e=>e?.key===r?.key&&e?.box===r?.box?e:r)}),s(f,"mouseout",e=>{e.relatedTarget||(te.current=null,ee())}),s(f,"mouseover",e=>{e.relatedTarget||j()});const le=m(null),ae=x(()=>{le.current?.(),le.current=null,J(null)},[]);g(()=>p.subscribe(()=>{p.get()?j():ae()}),[p,ae,j]),g(()=>ae,[ae]),("undefined"==typeof document?g:k)(()=>{if(p.get())return;const e=te.current;H(t=>w||ne.current?null:e?O(e.x,e.y):t?I.sources.find(e=>e.key===t.key)??null:null)},[I,P,p,w,G]);const re=e=>{const t=p.get(),n=D.current;if(!t||!n)return null;const l=h(n,e.clientX,e.clientY);te.current=l;const a=q(I.zones,l.x,l.y,e=>A.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>A.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},oe={onDragEnter:e=>{if(le.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=f?l(f.document):null,o=[];t&&o.push(a(t)),r&&f&&o.push(a(r,f.frame)),le.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=re(e);if(!n)return void J(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};J(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(te.current=null,J(null))},onDrop:e=>{const t=re(e);t&&(e.preventDefault(),p.end(),ae(),A.current.onDrop(t.h.item,t.t.to))}},se={draggable:!w&&!!R,onMouseEnter:_,onMouseLeave:()=>!p.get()&&ee(),onDragStart:e=>{if(R&&!w){p.start({key:R.key,item:R.item,from:R.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",R.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{p.end(),ae()},onClick:()=>{R&&!w&&A.current.onPick?.(R.item)}},{seams:ie=[]}=I,ce=I.zones.filter(e=>0===e.children.length),de=u.onZoneAdd&&!w?ce:[],ue=de.map(e=>e.key).join("\n");return g(()=>{const e=f?.document;if(!e)return;const t=new Set(ue?ue.split("\n"):[]);for(const n of e.querySelectorAll(`[${Y}]`))n.toggleAttribute(Z,t.has(n.getAttribute(Y)??""));return()=>{for(const t of e.querySelectorAll(`[${Z}]`))t.removeAttribute(Z)}},[f,ue,B,T,$]),/* @__PURE__ */C("div",{ref:D,className:"es-canvas-layer",children:[P||!u.onSeamAdd||w?null:ie.map(e=>
5
- /* @__PURE__ */M(S,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??u.seamLabel??z.addSection,onInsert:()=>u.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),de.length?de.map(e=>/* @__PURE__ */M("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",W?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:Q(e.box),onClick:()=>u.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */M("span",{className:"es-canvas-empty-add",children:z.addButton({label:e.addLabel??u.zoneAddLabel??z.addBlock})})},e.key)):null,P?/* @__PURE__ */M("div",{className:"es-canvas-catch",...oe}):null,W&&!ce.some(e=>e.key===W.zoneKey)?/* @__PURE__ */M("div",{className:`es-canvas-line is-${W.axis}`,style:Q(W.line)}):null,
6
- /* @__PURE__ */M("div",{className:"es-canvas-handle-spot",style:R?{"--es-handle-x":`${R.box.left+2}px`,"--es-handle-y":`${Math.max(R.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */M(N,{className:"es-canvas-handle-tip",side:"top",content:!R||w||P?null:R.title??z.handle({label:R.label}),children:/* @__PURE__ */C("div",{className:["es-canvas-handle",R&&!w?"is-shown":"",P?"is-dragging":""].filter(Boolean).join(" "),...se,children:[
7
- /* @__PURE__ */M("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),R?.label]})})})]})}var J=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function U({groups:t,session:n,itemFor:l,onInsert:a,at:r,hint:o,searchLabel:s,readOnly:i,words:c=e.add}){const d=o??c.hint,u=s??c.search,[h,p]=b(""),m=w(),g=h.trim().toLowerCase(),x=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),y=t.map((e,t)=>({...e,key:x[t],tiles:g?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,g)):e.tiles})).filter(e=>e.tiles.length>0),v=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
4
+ /* @__PURE__ */M("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */M(N,{content:e,children:/* @__PURE__ */M(A,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */M(D,{})})})})]})}var E=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,j=e=>e.width*e.height;function L(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>E(e.box,t,n)).sort((e,t)=>j(t.s.box)-j(e.s.box)||e.at-t.at).map(({s:e})=>e)}function B(e,t,n){return L(e,t,n).at(-1)??null}function K(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function X(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,o=a??l??e.box;return{left:r-1,top:o.top,width:2,height:o.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function q(e,t,n,l,a=()=>!1,r=()=>!0){const o=e.filter(e=>E(e.box,t,n)).sort((e,t)=>j(e.box)-j(t.box));for(const e of o){const o=K(e,t,n),s={...e.list,index:o};if(a(s))return null;if(l(s))return{zone:e,to:s,line:X(e,o)};if(!r(s))return null}return null}function I(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,o=r?a.left:a.top,s=o+(r?a.width:a.height),i=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let u=0;u<=l.length;u++){const h=l[u-1],f=l[u];let p,m;if(h&&f)p=c(h),m=Math.max(i(f)-p,0);else{const e=h?(c(h)+s)/2:(o+i(f))/2;p=Math.min(Math.max(e,o+n),s-n),m=0}const g=r?{left:p,top:a.top,width:m,height:a.height}:{left:a.left,top:p,width:a.width,height:m};d.push({key:`${e.key}:+${u}`,place:{...e.list,index:u},box:g,axis:e.axis,label:t})}return d}function P(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],o=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(r.top-o,0)}})}return n}var O={nodes:[],zones:[]},R="data-puck-dropzone",V="data-puck-component";function Y(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function Z(e,t){const{frame:n,document:l}=e,a=e=>h(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],o=[];for(const e of l.querySelectorAll(`[${R}]`)){const t=e.getAttribute(R)??"";let n;try{n=p(t)}catch{continue}const l=[...e.querySelectorAll(`[${V}]`)].filter(t=>t.parentElement?.closest(`[${R}]`)===e),s=l.map(a);o.push({key:t,list:n,box:a(e),axis:Y(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(V);l&&r.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:r,zones:o}}var F="data-es-empty-cell",H="data-puck-dropzone",W=140;var G=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function Q(o){const{canvas:h,session:p,readOnly:w,words:A=e.canvas}=o,z=m(o);g(()=>{z.current=o});const D=m(null),T=s(h),[$,E]=b(0),j=x(()=>E(e=>e+1),[]),[B,K]=b(O);g(()=>{const e=D.current;h&&e&&K((z.current.measure??Z)(h,e))},[h,T,o.revision,$]);const X=o.model,I=y(()=>X(B),[X,B]),P=v(p.subscribe,p.shown,p.shown),R=o.choose,V=(e,t)=>{const n=L(I.sources,e,t);return 0===n.length?null:R?R(n):n[n.length-1]},[Y,W]=b(null),[Q,J]=b(null),U=m(null),_=()=>{U.current&&clearTimeout(U.current),U.current=null},ee=()=>{_(),U.current=setTimeout(()=>{p.get()||W(null)},140)};g(()=>_,[]);const te=m(null),ne=m(!1);i(h,c,e=>{ne.current=Boolean(e.detail?.typing),ne.current&&(_(),W(null))}),i(h,"mousemove",e=>{const t=D.current;if(!h||!t)return;const n=d(h.frame,e.clientX,e.clientY,t),l=u(t),a={x:n.x/l,y:n.y/l};if(te.current=a,z.current.readOnly||p.get()||ne.current)return;_();const r=V(a.x,a.y);W(e=>e?.key===r?.key&&e?.box===r?.box?e:r)}),i(h,"mouseout",e=>{e.relatedTarget||(te.current=null,ee())}),i(h,"mouseover",e=>{e.relatedTarget||j()});const le=m(null),ae=x(()=>{le.current?.(),le.current=null,J(null)},[]);g(()=>p.subscribe(()=>{p.get()?j():ae()}),[p,ae,j]),g(()=>ae,[ae]),("undefined"==typeof document?g:k)(()=>{if(p.get())return;const e=te.current;W(t=>w||ne.current?null:e?V(e.x,e.y):t?I.sources.find(e=>e.key===t.key)??null:null)},[I,P,p,w,R]);const re=e=>{const t=p.get(),n=D.current;if(!t||!n)return null;const l=f(n,e.clientX,e.clientY);te.current=l;const a=q(I.zones,l.x,l.y,e=>z.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>z.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},oe={onDragEnter:e=>{if(le.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=h?l(h.document):null,o=[];t&&o.push(a(t)),r&&h&&o.push(a(r,h.frame)),le.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=re(e);if(!n)return void J(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};J(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(te.current=null,J(null))},onDrop:e=>{const t=re(e);t&&(e.preventDefault(),p.end(),ae(),z.current.onDrop(t.h.item,t.t.to))}},se={draggable:!w&&!!Y,onMouseEnter:_,onMouseLeave:()=>!p.get()&&ee(),onDragStart:e=>{if(Y&&!w){p.start({key:Y.key,item:Y.item,from:Y.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",Y.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{p.end(),ae()},onClick:()=>{Y&&!w&&z.current.onPick?.(Y.item)}},{seams:ie=[]}=I,ce=I.zones.filter(e=>0===e.children.length),de=o.onZoneAdd&&!w?ce:[],ue=de.map(e=>e.key).join("\n");return g(()=>{const e=h?.document;if(!e)return;const t=new Set(ue?ue.split("\n"):[]);for(const n of e.querySelectorAll(`[${H}]`))n.toggleAttribute(F,t.has(n.getAttribute(H)??""));return()=>{for(const t of e.querySelectorAll(`[${F}]`))t.removeAttribute(F)}},[h,ue,B,T,$]),/* @__PURE__ */C("div",{ref:D,className:"es-canvas-layer",children:[P||!o.onSeamAdd||w?null:ie.map(e=>
5
+ /* @__PURE__ */M(S,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??o.seamLabel??A.addSection,onInsert:()=>o.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),de.length?de.map(e=>/* @__PURE__ */M("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",Q?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:G(e.box),onClick:()=>o.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */M("span",{className:"es-canvas-empty-add",children:A.addButton({label:e.addLabel??o.zoneAddLabel??A.addBlock})})},e.key)):null,P?/* @__PURE__ */M("div",{className:"es-canvas-catch",...oe}):null,Q&&!ce.some(e=>e.key===Q.zoneKey)?/* @__PURE__ */M("div",{className:`es-canvas-line is-${Q.axis}`,style:G(Q.line)}):null,
6
+ /* @__PURE__ */M("div",{className:"es-canvas-handle-spot",style:Y?{"--es-handle-x":`${Y.box.left+2}px`,"--es-handle-y":`${Math.max(Y.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */M(N,{className:"es-canvas-handle-tip",side:"top",content:!Y||w||P?null:Y.title??A.handle({label:Y.label}),children:/* @__PURE__ */C("div",{className:["es-canvas-handle",Y&&!w?"is-shown":"",P?"is-dragging":""].filter(Boolean).join(" "),...se,children:[
7
+ /* @__PURE__ */M("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Y?.label]})})})]})}var J=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function U({groups:t,session:n,itemFor:l,onInsert:a,at:r,hint:s,searchLabel:i,readOnly:c,words:d=e.add}){const u=s??d.hint,h=i??d.search,[f,p]=b(""),m=w(),g=f.trim().toLowerCase(),x=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),y=t.map((e,t)=>({...e,key:x[t],tiles:g?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,g)):e.tiles})).filter(e=>e.tiles.length>0),v=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
8
8
  return C("div",{className:"es-add",children:[r?/* @__PURE__ */C("div",{className:"es-add-at",role:"status",children:[
9
- /* @__PURE__ */M("span",{children:r.label}),f(c.stop,/* @__PURE__ */M("button",{type:"button",className:"es-add-at-clear","aria-label":c.stop,onClick:r.onClear,children:/* @__PURE__ */M(T,{size:12,"aria-hidden":"true"})}))]}):null,
10
- /* @__PURE__ */M("p",{className:"es-add-hint",children:d}),
11
- /* @__PURE__ */M("div",{className:"es-add-find",children:/* @__PURE__ */M(A,{id:m,type:"search","aria-label":u,placeholder:c.searchPlaceholder({label:u}),value:h,onChange:e=>p(e.target.value),leftIcon:/* @__PURE__ */M($,{size:16,"aria-hidden":"true"}),rightAdornment:h?/* @__PURE__ */M(z,{size:"sm","aria-label":c.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */M(T,{size:12,"aria-hidden":"true"})}):void 0})}),0===y.length?/* @__PURE__ */C("div",{className:"es-add-empty",role:"status",children:[
12
- /* @__PURE__ */M("div",{className:"es-add-empty-title",children:c.nothing({query:h.trim()})}),
13
- /* @__PURE__ */M("div",{className:"es-add-empty-sub",children:c.tryAnother})]}):y.map(e=>/* @__PURE__ */C("section",{className:"es-add-group","aria-label":e.title,children:[
9
+ /* @__PURE__ */M("span",{children:r.label}),o(d.stop,/* @__PURE__ */M("button",{type:"button",className:"es-add-at-clear","aria-label":d.stop,onClick:r.onClear,children:/* @__PURE__ */M(T,{size:12,"aria-hidden":"true"})}))]}):null,
10
+ /* @__PURE__ */M("p",{className:"es-add-hint",children:u}),
11
+ /* @__PURE__ */M("div",{className:"es-add-find",children:/* @__PURE__ */M(z,{id:m,type:"search","aria-label":h,placeholder:d.searchPlaceholder({label:h}),value:f,onChange:e=>p(e.target.value),leftIcon:/* @__PURE__ */M($,{size:16,"aria-hidden":"true"}),rightAdornment:f?/* @__PURE__ */M(A,{size:"sm","aria-label":d.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */M(T,{size:12,"aria-hidden":"true"})}):void 0})}),0===y.length?/* @__PURE__ */C("div",{className:"es-add-empty",role:"status",children:[
12
+ /* @__PURE__ */M("div",{className:"es-add-empty-title",children:d.nothing({query:f.trim()})}),
13
+ /* @__PURE__ */M("div",{className:"es-add-empty-sub",children:d.tryAnother})]}):y.map(e=>/* @__PURE__ */C("section",{className:"es-add-group","aria-label":e.title,children:[
14
14
  /* @__PURE__ */C("div",{className:"es-add-group-head",children:[
15
15
  /* @__PURE__ */M("span",{className:"es-add-group-title",children:e.title}),
16
16
  /* @__PURE__ */M("span",{className:"es-add-group-count",children:e.tiles.length})]}),
17
- /* @__PURE__ */M("div",{className:J(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(i||e.disabled),l=i?void 0:e.disabled?e.disabledReason:e.title??c.tile({label:e.label});return f(l,/* @__PURE__ */C("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":c.tile({label:e.label}),onDragStart:v(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a?.(e.type),children:[null!=e.cover?/* @__PURE__ */M("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */M("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
18
- /* @__PURE__ */M("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{U as AddPanel,W as CanvasDragLayer,S as CanvasInsert,F as EMPTY_MEASURE,H as HANDLE_GRACE_MS,q as canvasTarget,E as contains,K as gapInZone,X as gapLine,I as insertSeams,V as measureCanvas,B as pickSource,P as seamsBetween,L as sourcesAt};
17
+ /* @__PURE__ */M("div",{className:J(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(c||e.disabled),l=c?void 0:e.disabled?e.disabledReason:e.title??d.tile({label:e.label});return o(l,/* @__PURE__ */C("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":d.tile({label:e.label}),onDragStart:v(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a?.(e.type),children:[null!=e.cover?/* @__PURE__ */M("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */M("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
18
+ /* @__PURE__ */M("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{U as AddPanel,Q as CanvasDragLayer,S as CanvasInsert,O as EMPTY_MEASURE,W as HANDLE_GRACE_MS,q as canvasTarget,E as contains,K as gapInZone,X as gapLine,I as insertSeams,Z as measureCanvas,B as pickSource,P as seamsBetween,L as sourcesAt};
@@ -0,0 +1 @@
1
+ import{textFieldIdentifier as n}from"./chunk-DUVRZ456.js";import{hidableText as r}from"./chunk-6W7WLPZH.js";function t(n,t){const o=r(n.props.name);if(o)return o;const e=r(n.props.altName);if(e)return e;const c=n.props.collection?.name;if(c)return c;const u=n.props.source?.title;if(u)return u;const s=n.props.code;return s?t?.(s)??s:""}function o(n,r,o,e,c){const u=o(t(n,e))||r(n.type);return c?c(n,"block",u):u}function e(r){if(!r)return null;for(const t of["name","altName"])if(n(r[t]))return t;return null}function c(r){const t=r?.name;return void 0===t||n(t)?"name":null}function u(n,t,o){const e=r(n.props?.name).trim()||t;return o?o(n,"section",e):e}export{u as rootRowName,c as sectionRenameProp,t as slotChildName,e as slotChildRenameProp,o as slotChildRowName};
@@ -0,0 +1,2 @@
1
+ import{PanelLeftIcon as e,PanelRightIcon as i}from"efficient-shell/icons/efficient";import{jsx as t}from"react/jsx-runtime";function r({side:r}){/* @__PURE__ */
2
+ return t("left"===r?e:i,{size:16})}export{r as PanelToggleIcon};
@@ -0,0 +1,5 @@
1
+ import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{blockTypesIn as n}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-62VPYC7F.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as c}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as a,useScreenBlockRules as p}from"./chunk-WP7AZDCV.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VVPZMWJE.js";import{AddPanel as d}from"./chunk-QFVRMARS.js";import{DEFAULT_DRAG_WORDS as f}from"./chunk-AYWN5NRH.js";import{useEasel as y}from"./chunk-KE2CXEIK.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as V}from"react/jsx-runtime";var E=e=>`section:${e}`,A=e=>`block:${e}`,R=e=>`template:${e}`;function $({at:$,placeBlocks:w,canTake:C,onPick:I,itemFor:N,session:O,siteWide:P,onClose:W,onHide:x,readOnly:B}){const F=y(e=>e.config),H=a(),{labelAtLevel:T,categoryLabel:D,firstSection:L,Icon:M,Thumbnail:Y}=H,{blockIsOffered:K,canAddTo:Q}=p(),S=h("screen",m).add,Z=h("drag",f).add,z=l(),[J,G]=u([]);k(()=>{let e=!1;const t=e=>K(e,z);return s(z).list().then(o=>{if(e)return;const s=F.components;G(o.filter(e=>e.node?.type&&s[e.node.type]&&n(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[F,z]);const X=b(()=>e(F,H),[F]),q=e=>({type:E(e.type),label:e.name,cover:/* @__PURE__ */j(Y,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:S.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),U=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=J.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(M,{type:e,size:26})}),ee=b(()=>{const e=t(X,L),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&K(e.type,z)&&n.set(e.type,e)};for(const t of e?[e]:X){const e=Q(t.type)?.choices??[];e.forEach(s),e.forEach(e=>Q(e.type,1)?.choices?.forEach(s))}w?.forEach(s);const i=new Set(X.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),l=e=>({type:A(e.type),label:e.label,cover:_(e.type),title:S.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...q(e),cover:_(e.type)}:q(e),p=[];J.length>0&&p.push({key:"templates",title:S.templates,tiles:J.map(e=>{return{type:R(e.id),label:e.name,cover:/* @__PURE__ */j(Y,{type:e.node.type}),keywords:[(t=e.node.type,T(t,"section",F.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(F.categories??{})){const n=X.filter(e=>e.cat===t);if(0===n.length)continue;const s=e&&n.some(t=>t.type===e.type)?e:null,i=(s?[s,...n.filter(e=>e.type!==s.type)]:n).map(a);s&&!d&&(i.splice(1,0,...m.map(l)),d=!0),p.push({key:`category:${t}`,title:o(F,t,D),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(l)],d=!0),c(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(l)})}),!C)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=U(e.type),o=t?C(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[J,X,F,S,C,w,z]);/* @__PURE__ */
2
+ return v(V,{children:[
3
+ /* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:S.title,context:S.contextAll,actions:/* @__PURE__ */j(r,{label:S.done,description:S.doneDescription,onClick:W}),onHide:x}),
4
+ /* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
5
+ /* @__PURE__ */j(d,{groups:ee,session:O,itemFor:e=>N(U(e)??{kind:"section",type:e}),onInsert:I?e=>{const t=U(e);t&&I(t)}:void 0,at:$,hint:S.hint,searchLabel:S.search,readOnly:B,words:Z}),P??null]})]})}export{$ as AddSidePanel,A as blockKey,E as sectionKey,R as templateKey};
@@ -0,0 +1 @@
1
+ var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"};var a={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const o=Math.floor(a/60);if(o<60)return`Saved ${o} minute${1===o?"":"s"} ago`;const n=Math.floor(o/60);return`Saved ${n} hour${1===n?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},o={loading:"Loading",waitingForAuthorization:"Waiting for editor authorization",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,canvasAddBlock:"Add block",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:a,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",editFooter:"Edit the site footer",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:o})=>`Moved “${e}” to position ${a} of ${o}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,a as DEFAULT_SCREEN_SAVE_STATUS_WORDS,o as DEFAULT_SCREEN_WORDS};