efficient-easel 20.1.0 → 20.2.1

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