efficient-easel 13.2.0 → 13.3.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 (48) hide show
  1. package/dist/{chunk-W26HUPPC.js → chunk-3BP4XJVF.js} +1 -1
  2. package/dist/{chunk-4ES5JGGX.js → chunk-3Z2MVLCD.js} +1 -1
  3. package/dist/chunk-44ACS7DZ.js +1 -0
  4. package/dist/{chunk-ET6FNSRA.js → chunk-4EI6UGGH.js} +1 -1
  5. package/dist/{chunk-L7PSXVI3.js → chunk-FVBRWKMP.js} +4 -4
  6. package/dist/{chunk-HV56SLR2.js → chunk-NBDMTIU2.js} +2 -2
  7. package/dist/chunk-O5HIBDDA.js +5 -0
  8. package/dist/{chunk-6LYK3NGW.js → chunk-PVAIOBBE.js} +8 -8
  9. package/dist/chunk-RSKHAHPJ.js +4 -0
  10. package/dist/{chunk-2QX2VB2C.js → chunk-SO5OLDH7.js} +11 -11
  11. package/dist/chunk-TJHS4V2T.js +57 -0
  12. package/dist/{chunk-SMP54RNN.js → chunk-UU2WKWIA.js} +1 -1
  13. package/dist/chunk-VNIXR4UI.js +5 -0
  14. package/dist/{chunk-L25TTU2F.js → chunk-VRMUSWKL.js} +1 -1
  15. package/dist/{chunk-L3GSW4XI.js → chunk-XT6DOSHO.js} +1 -1
  16. package/dist/chunk-YAFVODLX.js +1 -0
  17. package/dist/{chunk-QHSYHB4W.js → chunk-ZTJU4SGV.js} +1 -1
  18. package/dist/easel/index.js +1 -1
  19. package/dist/fields/index.js +1 -1
  20. package/dist/panel/index.js +1 -1
  21. package/dist/screen/components/AddBlockRow.js +1 -1
  22. package/dist/screen/components/AddSidePanel.js +1 -1
  23. package/dist/screen/components/MediaSidePanel.js +1 -1
  24. package/dist/screen/components/SaveControls.d.ts +2 -0
  25. package/dist/screen/components/SaveControls.js +1 -1
  26. package/dist/screen/components/ScreenChrome.js +1 -1
  27. package/dist/screen/components/ScreenMount.js +1 -1
  28. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  29. package/dist/screen/components/SectionScreenShell.js +16 -16
  30. package/dist/screen/components/usePartBridge.js +1 -1
  31. package/dist/screen/index.js +1 -1
  32. package/dist/screen/lib/key-scope.js +1 -1
  33. package/dist/screen/lib/puck/device-fields.js +1 -1
  34. package/dist/screen/lib/puck/preview-dom.js +1 -1
  35. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  36. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  37. package/dist/screen/lib/screen-parts.d.ts +9 -0
  38. package/dist/screen/lib/screen-parts.js +1 -1
  39. package/dist/strings/catalogue.js +1 -1
  40. package/dist/strings/index.js +1 -1
  41. package/dist/text-styles/index.js +20 -20
  42. package/package.json +1 -1
  43. package/dist/chunk-27CDEFBE.js +0 -1
  44. package/dist/chunk-2MGZTBPF.js +0 -5
  45. package/dist/chunk-AKZ4QYHO.js +0 -1
  46. package/dist/chunk-CHXJDSUC.js +0 -57
  47. package/dist/chunk-E7EIYXXM.js +0 -5
  48. package/dist/chunk-W4U4SHKW.js +0 -4
@@ -1,57 +0,0 @@
1
- import{styleClipboardOf as e}from"./chunk-L3GSW4XI.js";import{markedTreeNodeId as n,revealSelectedTreeRow as t,sameSelector as o}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as r}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as i}from"./chunk-26OOWIJJ.js";import{ScreenSaveIcon as l,ScreenMainButton as s}from"./chunk-W4U4SHKW.js";import{useBrowserOffline as d}from"./chunk-RKTF5XLP.js";import{scrollPreviewToSection as c,gotoPreviewSlide as a,scrollPreviewToTop as p}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as u,useEaselUndoKeys as f,useEaselSaveKey as h,editorRootFocus as m}from"./chunk-ET6FNSRA.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as S,clampPanelWidth as k}from"./chunk-TZIIRGVY.js";import{usePartBridge as v}from"./chunk-27CDEFBE.js";import{useSectionOps as b}from"./chunk-L25TTU2F.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-2MGZTBPF.js";import{SidePanelHead as z,PanelShowStrip as C}from"./chunk-62VPYC7F.js";import{MediaSidePanel as B}from"./chunk-SMP54RNN.js";import{useScreenSaveSwitch as I,useScreenNodeKeys as N,useScreenPinned as O,useScreenDocumentLabel as P,useScreenCanvasFrame as $,useScreenInspectorPanel as M,useScreenDevices as T,useScreenPickFollowsSelection as j,useScreenLeftView as A,SELECTION_MODE as L,sameInspectorMode as E,useScreenBridges as R,useScreenBlockRules as V,useScreenBlockLook as F,useScreenStorageNamespace as W,useScreenNotify as H,useScreenCanvasHead as D,isSlotMode as G,useScreenStyleClipboard as J,useScreenDocumentPass as U,useScreenCanvasDrag as Y,ScreenCanvasTargetProvider as X,isPinnedFirst as K,isPinnedLast as q,screenSlotsOf as _}from"./chunk-E7EIYXXM.js";import{useNodeClipboard as Z,useNodeContextMenu as Q}from"./chunk-NW4LJ4G4.js";import{PageEditGuardNotices as ee}from"./chunk-IWFVVCRN.js";import{useScreenDocument as ne}from"./chunk-FBS75I6E.js";import{requestMediaPick as te}from"./chunk-KG7RJWOK.js";import{useMediaPanel as oe,usePanelPick as re,useCancelPanelPick as ie}from"./chunk-R6WTQWAC.js";import{useEaselSession as le}from"./chunk-O7Q4DDJT.js";import{useEaselHost as se,useHostEscape as de}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as ce}from"./chunk-VVPZMWJE.js";import{heldStyle as ae,styleShortcut as pe}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ue}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as fe}from"./chunk-WK3AFPXY.js";import{rootRowName as he,slotChildRowName as me,slotChildRenameProp as ge,sectionRenameProp as ye}from"./chunk-TBF5CVPA.js";import{ROOT_ZONE as Se,blockNodeActions as ke,TREE_MAX_DEPTH as ve,childSlotsOf as be,slotFieldsOf as we,slotChildrenIn as xe,nestsInTree as ze,newNodeId as Ce}from"./chunk-PLVEGYK6.js";import{insertSeams as Be,CanvasDragLayer as Ie,CanvasInsert as Ne}from"./chunk-QFVRMARS.js";import{DEFAULT_DRAG_WORDS as Oe}from"./chunk-AYWN5NRH.js";import{useEasel as Pe,useEaselApi as $e,CanvasPassThroughContext as Me}from"./chunk-6LYK3NGW.js";import{toItemSelector as Te,useNodeOps as je,clickPick as Ae}from"./chunk-ECM5F6JJ.js";import{TreeRow as Le,Subtree as Ee,LayersTree as Re,TreeGroupLabel as Ve,TreeRowAction as Fe,TreeSeam as We}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as He}from"./chunk-K56YDHYQ.js";import{createDragSession as De,useTreeDrag as Ge,gapToMoveIndex as Je}from"./chunk-67GNT6PF.js";import{LayersIcon as Ue,MediaIcon as Ye}from"./chunk-4VJATVVR.js";import{useCanvasFrame as Xe,LIST_SELECTOR as Ke,BLOCK_SELECTOR as qe,useCanvasEvent as _e,nodeIdAt as Ze,frameRectToHost as Qe,BLOCK_ATTRIBUTE as en,drawnBox as nn}from"./chunk-ILXP5VX5.js";import{EaselTopBar as tn,TopBarRail as on,TopBarCluster as rn,EaselIconButton as ln,TopBarDivider as sn,DeviceSwitch as dn,InspectorIconButton as cn,PanelResizeHandle as an,MAX_PANEL_W as pn,MIN_PANEL_W as un,panelWidthVars as fn}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as hn,DEFAULT_CHROME_WORDS as mn}from"./chunk-Z6PVRXVY.js";import{holderOf as gn,nameOrSomeone as yn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as Sn}from"./chunk-RE4LP46F.js";import{useWords as kn}from"./chunk-MFIRYGHW.js";import{ROOT_ID as vn,ROOT_SLOT as bn,zoneKey as wn,parseZoneKey as xn,find as zn,DataError as Cn}from"./chunk-KRXQM65X.js";import{useRef as Bn,useMemo as In,useState as Nn,useEffect as On,useCallback as Pn,useLayoutEffect as $n,Fragment as Mn}from"react";import{ColoredBadge as Tn,toast as jn,groupColors as An}from"efficient-shell/ui";import{UndoIcon as Ln,RedoIcon as En,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 Gn,jsxs as Jn,Fragment as Un}from"react/jsx-runtime";var Yn=/* @__PURE__ */new WeakSet;function Xn(e,n,t){const o=zn(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=Bn(null),[r,i]=Nn({}),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=Qe(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${en}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?nn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=Qe(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__ */Gn("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Gn("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__ */Gn(Tn,{colorClass:An("info","solid"),size:"sm",children:e.label})},e.id):null})})}function qn({expand:e}){/* @__PURE__ */
2
- return Gn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Jn(Un,e?{children:[
3
- /* @__PURE__ */Gn("path",{d:"M8 9l4-4 4 4"}),
4
- /* @__PURE__ */Gn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
5
- /* @__PURE__ */Gn("path",{d:"M8 4l4 4 4-4"}),
6
- /* @__PURE__ */Gn("path",{d:"M8 20l4-4 4 4"}),
7
- /* @__PURE__ */Gn("path",{d:"M5 12h14"})]})})}var _n=`${Ke}, ${qe}`;function Zn(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 Ke=se(),{target:Qe,docId:en,capabilities:nn,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}=ne(),ft=I(),ht=N(),{mediaEditing:mt,hasEditGuard:gt,hasPinnedChrome:yt}=nn,{appState:St,dispatch:kt,history:vt,selectedItem:bt,getSelectorForId:wt,config:xt}=Pe(e=>e),zt=O(),{first:Ct,firstGroup:Bt,lastGroup:It,isSectionGroup:Nt,sectionGroupZone:Ot,panelOf:Pt}=zt,$t=Pt(Ct),Mt=e=>K(zt,e),Tt=e=>q(zt,e),jt="node"===zt.firstRow,At=zt.band??null,Lt=kn("screen",ce),Et=kn("tree",He),Rt=kn("drag",Oe),Vt=kn("notice",hn),Ft=kn("lock",Sn),Wt=kn("menu",fe),Ht=kn("styleClipboard",ue),Dt=kn("chrome",mn),Gt=P()??`/${An}`,Jt=$(),Ut=M(),Yt=b({readOnly:pt}),Xt=b({readOnly:pt,foldIntoHistory:!0}),Kt=Bn(null),qt=$e(),_t=In(()=>({...Yt,select:e=>{Kt.current=e,Yt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=qt.config;Kt.current=Te(e,t,n)}Yt.commitDocument(e,n)}}),[Yt,qt]),Zt=St.ui,Qt=Zt.leftSideBarVisible,eo=Zt.rightSideBarVisible,{options:no,widths:to,initial:oo,fluid:ro,fit:io}=T(),[lo,so]=Nn(oo),co=oe(),ao=mt&&null!==co,po=re(),uo=ie();j(bt?.props.id);const{read:fo,write:ho,forSelection:mo}=A(),[go,yo]=Nn(fo);On(()=>{ho(go)},[go]);const[So,ko]=Nn(0),vo=Bn(null),bo=Bn(null),wo=Xe(bo,{readySelector:_n}),xo=u(bo);f(bo,wo);const zo=d(),Co=gn(ct),Bo={state:rt,offline:zo||rt.failed&&at,readOnlyReason:ut,editing:Co?Vt.editing({name:yn(Co.name,Ft),noun:Lt.noun}):null,conflict:null!=it,notSaving:Lt.bar.notSaving},Io=()=>{pt||(rt.failed?lt():dt())};h(bo,wo,Io);const[No,Oo]=Nn(!1),Po=Bn(!1),$o=Bn(!1),[Mo,To]=Nn(null),[jo,Ao]=Nn([]),[Lo,Eo]=Nn(L),Ro="puck"===Lo.kind,Vo=n(Lo,bt?.props.id),[Fo,Wo]=Nn(null);On(()=>{Fo&&(t(),Wo(null))},[Fo]);const Ho=Bn(wt);Ho.current=wt;const Do=Pn((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&&kr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Go=Bn(null);On(()=>{const e=Go.current;Go.current=null;const n=null==bt?.props.id?null:String(bt.props.id);Eo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Pt(bt?.type)??L);const t=bt?.props.id,r=Kt.current;if(Kt.current=null,!t)return;const i=wt(t);Do(String(t),{scroll:!o(r,i??null,Se)})},[bt?.props.id,Do]);const Jo=Pn(e=>{Eo(n=>E(n,e)?n:e),kt({type:"setUi",ui:{rightSideBarVisible:!0}})},[kt]),Uo=Bn(()=>{});Uo.current=(e,n)=>{const t=e?ui(e.zone??Se)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==bt?.props.id?null:String(bt.props.id);Eo(e=>E(e,n)?e:n),o!==r&&(Go.current={id:o,mode:n},_t.select(e))};const Yo=Pn((e,n)=>Uo.current(e,n),[]),Xo={kind:Lo.kind,mode:Lo,open:Jo,show:e=>Eo(e),reveal:()=>{eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Yo},Ko=R(Xo,{data:St.data,selected:bt??null,zoneOf:e=>wt(e)?.zone,readOnly:Boolean(pt),select:e=>{Eo(L),_t.select({index:e})},replace:(e,n)=>_t.replaceComponent(Se,e,n),scrollTo:e=>Ei(e)},{device:lo,refreshes:So},{setView:yo,reveal:()=>{Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),qo=Ko.pinnedSource??!1,_o=Ko.resolveLeftView?Ko.resolveLeftView(go,ao):"media"===go&&ao?go:"sections",Zo=V(),{isLockedBlock:Qo,duplicateBlocked:er,nestDepth:nr,newSectionNode:tr,canAddTo:or,blockIsOffered:rr}=Zo,ir=F(),{labelAtLevel:lr,Icon:sr,useProducts:dr}=ir,cr=ir.rowName?(e,n,t)=>ir.rowName(e,n,t):void 0,ar=Pn(e=>{kt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),Do(e,{scroll:!0})},[kt,Do]),{selectNode:pr,openPartId:ur}=v({mode:Lo,setMode:Eo,onOpenPart:ar}),[fr,hr]=Nn(null);de(null!==fr,()=>hr(null));const mr=y(W()),gr=mr.collapsed,yr=mr.panelWidths,[Sr,kr]=Nn(()=>{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}});On(()=>{try{window.localStorage.setItem(gr,JSON.stringify([...Sr]))}catch{}},[Sr]);const[vr,br]=Nn(()=>{if("undefined"==typeof window)return{...S};try{const e=window.localStorage.getItem(yr);if(!e)return{...S};const n=JSON.parse(e);return{left:k(Number(n.left)||S.left),right:k(Number(n.right)||S.right)}}catch{return{...S}}});On(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(yr,JSON.stringify(vr))}catch{}},300);return()=>clearTimeout(e)},[vr]);const wr=Pn((e,n)=>br(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),xr=Pn(e=>wr("left",e),[wr]),zr=Pn(e=>wr("right",e),[wr]),Cr=e=>Sr.has(e),Br=e=>kr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Ir=Bn(!1),Nr=Bn(null);On(()=>{if(Ir.current&&!No){const e=Nr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??bo.current?.querySelector(`button[aria-label="${CSS.escape(Lt.add.title)}"]`))?.focus(),Nr.current=null}Ir.current=No},[No]),On(()=>{if(!No||!xo)return;const e=e=>{"Escape"===e.key&&Ji()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[No,xo]),de(No,()=>Ji()),On(()=>{!Qt&&No&&(Oo(!1),To(null),Po.current=!1)},[Qt]),On(()=>{if(!po)return $o.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),void($o.current=!1);No&&(Oo(!1),To(null),$o.current=Po.current,Po.current=!1),Qt||($o.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[po]),On(()=>{!Qt&&po&&($o.current=!1,uo())},[Qt]),On(()=>{if(!po||!xo)return;const e=e=>{"Escape"===e.key&&uo()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[po,xo]),de(null!==po,()=>uo());const Or=H(),Pr=(e,n="success",t)=>{if(Or)return void(t?Or(e,"error"===n?"error":"info",t):Or(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?jn.error(e,{...o,duration:t?.duration??3200}):jn.success(e,{...o,duration:t?.duration??1900})},$r=Bn(null),[Mr,Tr]=Nn(0),[jr,Ar]=Nn(0),Lr=D(),Er=Bn(null),Rr=e=>Math.max(0,e.clientHeight-(Er.current?.offsetHeight??0));On(()=>{const e=$r.current;if(!e)return;const n=()=>{Tr(e.clientWidth),Ar(Rr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Er.current&&t.observe(Er.current),()=>t.disconnect()},[]),$n(()=>{$r.current&&(Tr($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:jr||"100%",flex:"none",position:"relative"},Gr={width:Vr,height:jr?jr/Fr:"100%",maxHeight:"none",transform:1!==Fr?`scale(${Fr})`:void 0,transformOrigin:"top left"},Jr=()=>kt({type:"setUi",ui:{leftSideBarVisible:!Qt}}),Ur=()=>kt({type:"setUi",ui:{rightSideBarVisible:!eo}}),Yr=e=>{No&&(Oo(!1),To(null),Po.current=!1,Qt&&go===e)||po&&($o.current=!1,uo(),Qt&&go===e)||(Qt&&go===e?Jr():(yo(e),Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Xr=()=>{te(Ke,{accept:"image/*",title:Dt.mediaLibrary})},Kr=()=>{Eo(L),_t.select(null),p()},qr=()=>{Eo($t??L),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},_r=St.data.content??[],Zr=()=>{const e=_r.findIndex(Mt),n=_r.findIndex(Tt);return{floor:e>=0?e+1:0,cap:n>=0?n:_r.length}},Qr=xt,ei=Zo.stripCopy,ni=e=>r(e,ei),ti=Z(),oi=je({data:St.data,config:Qr,readOnly:Boolean(pt),clipboard:ti,strip:ei?e=>ei(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==vn||e.slot!==bn)return{min:0,max:n-1};const{floor:t,cap:o}=Zr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Eo(L);const t=void 0===n||"node"===n?.kind?n:null;_t.commitDocument(e,t)}}),ri=e=>{const n=zn(St.data,xt,e);if(!n)return!1;const t=wn(n.place),o=n.node,r=t===Se?ci(o):xi(o);return!!oi.remove(e)&&(Pr(Lt.deleted({name:r}),"success",{duration:8e3,action:{label:Lt.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=Pn(e=>xt.components[e]?.defaultProps??{},[xt]),di=e=>lr(e,"section",li(e)),ci=e=>he({type:e.type,props:e.props??{}},di(e.type),cr),{nodeAddresses:ai,zoneItems:pi}=In(()=>{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>=ve)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of be(xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(_r,Se,0),{nodeAddresses:e,zoneItems:n}},[_r,xt]),ui=Pn(e=>pi.get(e)??[],[pi]),fi=e=>{const n=ai.get(e);return n?ui(n.zone)[n.index]:void 0},hi=e=>_(Zo,xt,e),mi=e=>{if(!Zo.slotsOf||e===Se)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(!G(Lo))return null;const e=`${Lo.nodeId}:${Lo.slot}`;return mi(e)?.slot.panel===Lo.kind?e:null})(),yi=Bn(null);On(()=>{const e=yi.current;if(yi.current=null,!gi||!G(Lo))return;const n=Lo.nodeId;Do(n,{scroll:e!==gi}),kr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Lo]);const Si=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ai.get(e);n&&(n.zone===Se?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),Yo(null,r),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}}),Ei(o)},ki=(e,n,t)=>{const o=`${e}:${n}`;if(kr(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);Yo(null,{kind:t,nodeId:e,slot:n})},vi=(e,n,t)=>{if(pt||!Zo.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=Je(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=Zo.moveSlot(e,n,s);"string"==typeof d&&ki(e,d,i.panel)},bi=dr(),wi=In(()=>{const e=/* @__PURE__ */new Map;for(const n of bi??[])e.set(n.slug,n.name);return e},[bi]),xi=e=>me(e,li,ir.plainText,e=>wi.get(e),ir.rowName),zi=(e,n)=>{const t=xt.components[e.type]?.fields,o=n===Se||Tl(n)?"section":"block",r=n===Se&&(Mt(e)||Tt(e)||Nt(e.type)),i="block"===o?ge(t):r?null:ye(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&&_t.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
9
- return Gn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Lt.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)},Bi=e(J(),Ht),Ii=Bi.scope({target:Qe,siteId:tt,docId:en}),Ni=xt,Oi=(e,n)=>n===Se?di(e):li(e),Pi=(e,n,t)=>{const o=Bi.plan(Ii,t,Oi(t.type,e),Ni);o&&(o.changed&&_t.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Pr(o.message))},$i=Q({nodesIn:ui,nodeAt:(e,n)=>ui(e)[n]??null,labelOf:(e,n)=>n===Se?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:()=>{_t.select(null),Eo(L)},pageSettingsLabel:Lt.pageSettings,words:{menu:Wt,styleClipboard:Ht,screen:Lt.menu},readOnly:Boolean(pt),collapseAll:()=>kr(new Set(ui(Se).map(e=>String(e.props.id)))),onPasteRefused:e=>Pr(e?Lt.pasteRefused({name:e.label}):Lt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Ll(e,n),menuRows:Ko.menuRows,isLocked:e=>Qo(e.type),duplicateBlocked:e=>er(St.data,e),permits:e=>ke(xt,e.type),nodeOps:ii,isPinned:(e,n)=>n===Se&&(Mt(e)||Tt(e)),sectionBand:Zr,locate:e=>ai.get(e)??null,rowNameOf:(e,n)=>n===Se?ci(e):xi(e),selectAt:(e,n,t,o)=>{e===Se?Ri(n):ul(e,n,t,o??"")},slotRung:e=>{const n=mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Si(n.node,n.slot,!1)}:null},style:{held:()=>ae(Ii),canCopy:e=>Bi.rows(Ni,e).some(e=>!1!==e.counted),copy:(e,n)=>Bi.copy(Ii,e,Oi(e.type,n),Ni),paste:(e,n,t)=>Pi(e,n,t)},keys:ht?{target:xo,selected:()=>{const e=St.ui.itemSelector;return e?{zone:e.zone??Se,index:e.index}:null},held:()=>ti.get(),readOnly:Boolean(pt),onDone:({done:e,name:n})=>{"copied"===e&&Pr(Lt.copied({name:n}))}}:void 0},wo),Mi=Bn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});On(()=>{Mi.current={copy:(e,n)=>Bi.copy(Ii,e,Oi(e.type,n),Ni),paste:Pi,at:()=>{const e=St.ui.itemSelector;if(!e)return null;const n=e.zone??Se,t=ui(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(pt)}});const Ti=Pn(e=>{const n=pe(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))},[]);On(()=>{if(!xo)return;const e=e=>Ti(e);return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[Ti,xo]),_e(wo,"keydown",Ti);const ji=_r.map(e=>e.props.id).join("|");On(()=>{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=_r.findIndex(Tt),t=n>=0?n:_r.length,o=n=>{const t=_r[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(qe)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=_r.length>0&&!Mt(_r[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=Zn(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,ji,lo,Fr,Qt,eo,bt?.props.id]);const Ai=wo?.document??null,Li=wo?.window??null;On(()=>{const e=vo.current;if(!e||!Ai||!Li)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&&Li.scrollTo({left:Li.scrollX,top:Li.scrollY+t,behavior:"instant"}),!0};return vo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ai,Li]);const Ei=e=>{Ko.holdCanvasOn?Ko.holdCanvasOn(e):c(e)},Ri=e=>{Eo(L),_t.select({index:e}),Ko.sectionPressed?.(_r[e]);const n=_r[e]?.props?.id;n&&Ei(n)},Vi=e=>{const{floor:n,cap:t}=Zr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=bt&&Lo.kind!==$t?.kind?_r.findIndex(e=>e.props.id===bt.props.id):-1;return o(r>=0?r+1:t)},Fi=(e,n)=>{const{floor:t,cap:o}=Zr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(_t.reorderComponent(Se,e,i),_t.select({index:i}),{moved:!0,dest:i})},Wi=(e,n,t,o)=>{Eo(L),_t.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),Pr(Lt.sectionAdded({name:t}))},Hi=(e,n)=>{const t=Vi(n),o=tr(e,{nodeDefaults:si,newNodeId:Ce,sectionLabel:di,blockIsOffered:rr}),r=o?_t.insertNode(Se,t,o):_t.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 be(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=>Gi(Se,e),Gi=(e,n)=>{Nr.current=document.activeElement??null,po&&(Po.current=$o.current,$o.current=!1,uo()),To(null===n?null:{zone:e,index:n}),Oo(!0),Qt||(Po.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ji=()=>{Oo(!1),To(null),Po.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),Po.current=!1},Ui=(e,n)=>ir.rowName?n?Mt(e)?ir.rowName(e,"section",Lt.header):Tt(e)?ir.rowName(e,"section",Lt.footer):Nt(e.type)?ir.rowName(e,"section",li(e.type)):ci(e):xi(e):n?di(e.type):li(e.type),Yi=e=>n=>{e()},Xi=()=>Ko.editPinnedSource?.(),Ki=(e,n,t)=>{if(pt)return null;const o=ui(e)[n];return o&&!ke(xt,o.type).delete?null:/* @__PURE__ */Gn(Fe,{kind:"delete",label:Lt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=ui(e)[n]?.props?.id;null!=t&&ri(String(t))})(e,n),children:/* @__PURE__ */Gn(Fn,{size:15})})},qi=e=>ir.rowPreview?.(e)||void 0,_i=e=>ir.rowMarks?.(e)??void 0,Zi=(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 Gn(Fe,{kind:"eye",label:r?Lt.showNamed({name:o}):Lt.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Gn(r?Wn:Hn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>fs(Se,e),nl=(e,n,t)=>{_t.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>we(xt,e),ol=e=>be(xt,e),rl=e=>Zo.slotsOf?hi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:xe(e,n.slot)})):[{slot:null,rung:null,kids:ol(e)}],il=e=>Zo.slotsOf?rl(e).flatMap(e=>e.kids):ol(e),ll=e=>Boolean(Zo.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=ze(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(Eo(L),or(o)?.spec?.slider){const t=e.split(":")[0];a(t,n),_t.select({index:n,zone:e}),c(t)}else _t.select({index:n,zone:e}),Ei(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;_t.insertComponent(i,t,o),or(r)?.spec?.slider?requestAnimationFrame(()=>{a(e,o),_t.select({index:o,zone:i})}):_t.select({index:o,zone:i})},hl=Bn(/* @__PURE__ */new Set);On(()=>{_r.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)=>Xt.seedChild(o,t,n.childType,e))})},[_r,Xt,si]);const ml=Bn(/* @__PURE__ */new Set);On(()=>{_r.forEach((e,n)=>{const t=e.props.id;if(ml.current.has(t))return;const o=i(e,tl(e.type));ml.current.add(t),o&&Xt.replaceComponent(Se,n,{...e,props:o})})},[_r,Xt]),U(Xt,xt);const gl=_r.findIndex(Tt),yl=gl>=0?_r[gl]:null,Sl=jt?_r.findIndex(Mt):-1,kl=Sl>=0?_r[Sl]:null,vl=zt.groupTab,bl=In(()=>vl?e=>Nt(e.type):void 0,[vl]),wl=Boolean(zt.groupBadge),xl=zt.groupBadge?/* @__PURE__ */Gn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Gn(Tn,{tone:"info",size:"xs",children:zt.groupBadge})}):void 0,zl=_r.find(e=>e.type===Bt)??null,Cl=_r.find(e=>e.type===It)??null,Bl=gl>=0?gl:_r.length,Il=[];_r.forEach(e=>{Tt(e)||(al(e)&&Il.push(String(e.props.id)),Il.push(...cl(e,1,pl)))}),yl&&(Il.push(String(yl.props.id)),Il.push(...cl(yl,1,pl)));const Nl=Il.length>0&&Il.every(e=>Sr.has(e)),Ol=e=>{const n=ir.blockRowName(e,li);return ir.rowName?ir.rowName(e,"block",n):n},Pl=(e,n,t,o)=>{const r=ui(e)[t];if(!r)return;const i={...xn(e),index:t},l={...xn(n),index:Math.min(Math.max(o,0),ui(n).length)},s=Je(i,l);if(e!==n||s!==t)try{oi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Cn))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===Se)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Tl=e=>{const n=e.slice(0,e.indexOf(":")),t=_r.find(e=>Nt(e.type)&&String(e.props.id)===n);return t&&Ot(n)===e?t:null},jl=(e,n)=>{const t=Tl(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=wn(n);if(Nt(e.type))return!1;const r=Tl(o),i=Tl(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!jl(o,e.type))&&(n.index>=0&&n.index<=ui(o).length));if(e.zone===Se||o===Se){if(e.zone!==o)return!1;const{floor:t,cap:r}=Zr();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(St?.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)},Ll=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?jl(t,o.type):Al({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},El=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(St?.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:Ui(o,t.zone===Se)}},Rl=(e,n)=>{if("section"!==e.kind)return e;const t=wn(n);return t===Se||Tl(t)?e:El(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},Vl=(e,n)=>{const t=Rl(e,n),o=wn(n);if("block"!==t.kind){if(Tl(o)){const e="section"===t.kind?t.type:t.template.node.type;return jl(o,e)&&n.index>=0&&n.index<=ui(o).length}if(o!==Se)return!1;const{floor:e,cap:r}=Zr();return n.index>=e&&n.index<=r}if(o===Se)return!1;const r=El(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&&Tl(wn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&jl(n,o)){if("section"===e.kind)_t.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;_t.insertNode(n,t,ni(e.template.node))}Eo(L),_t.select({index:t,zone:n})}})(t,wn(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=_t.insertNode(Se,o,n);Wi(o,r,e)})(t.template.name,ni(t.template.node),n.index);const o=wn(n),r=El(o);r&&(r.target.spec?fl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{_t.insertComponent(e,n,t),Eo(L),_t.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===Se?Fi(e.index,n.index):Pl(e.zone,wn(n),e.index,n.index)},[Hl]=Nn(()=>De()),Dl=Ge({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===Se?((e,n)=>{const t=di(_r[e]?.type??""),o=Fi(e,n<0?e-1:e+2);if(!o.moved)return void Pr(n<0?Lt.sectionFirst({name:t}):Lt.sectionLast({name:t}));const{floor:r,cap:i}=Zr();Pr(Lt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Pl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Gl=Pn(e=>{const{floor:n,cap:t}=Zr(),o=[];for(const r of e.nodes){const e=wn(r.place),i=ui(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Mt(i)||Tt(i)||Qo(i.type))continue;if(Nt(i.type))continue;const l=Boolean(Tl(e)),s=e===Se||l;e===Se&&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=wn(e.list);if(n===Se&&0===e.children.length)return[{...e,addLabel:Lt.addSection,addAlways:!0}];const t=El(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Tl(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=wn(e.list),t=n===Se||Tl(n)?null:El(n);return t?.choices.length?Be(e,t.target.spec?.addLabel??Lt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[St.data]),Jl=null==bt?.props.id?null:String(bt.props.id),Ul=Pn(e=>{const n=xt,t=e=>!e.item.rung&&null!==zn(St.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(Jl);return i||(r(Ae(St.data,n,o.item.id,Jl,bl))??o)},[St.data,xt,Jl,bl]),[Yl,Xl]=Nn(null);_e(wo,"mouseover",e=>{if(!vl)return;const n=Ze(e.target),t=n?Xn(St.data,xt,n):null;t!==Yl&&Xl(t)}),_e(wo,"mouseout",e=>{vl&&!e.relatedTarget&&Xl(null)});const Kl=e=>Mt(e)||Tt(e)||Nt(e.type),ql=[];if(vl){const e=Jl?Xn(St.data,xt,Jl):null;for(const n of/* @__PURE__ */new Set([e,Yl])){const e=n?_r.find(e=>String(e.props.id)===n):void 0;if(!e||!Kl(e))continue;const t=vl(e);t&&ql.push({id:String(e.props.id),label:t,below:Mt(e)||e.type===Bt})}}const _l=le(),Zl=Bn(null);On(()=>{const e=zt.changeNotice;if(!e)return;const n=JSON.stringify(_r.filter(Kl)),t=Zl.current;if(Zl.current={doc:en,bands:n,index:vt.index},!t||t.doc!==en||t.bands===n)return;vt.hasPast&&vt.index>=t.index&&!Yn.has(_l)&&(Yn.add(_l),Pr(e,"success",{action:{label:Lt.bar.undo,onClick:()=>vt.back()},duration:8e3}))},[_r]);const Ql=e=>{Eo(L),_t.select(e.zone===Se?{index:e.index}:{index:e.index,zone:e.zone})},es=Y(),ns=()=>({data:St.data,device:lo,ops:_t,inspector:Xo}),ts=es?.model,os=In(()=>ts?e=>ts(e,Gl(e),ns()):Gl,[ts,Gl,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=wn(e),t=mi(n);t&&Si(t.node,t.slot,!1),Gi(n,e.index)},fs=(e,n)=>/* @__PURE__ */Gn(We,{...pt?{}:Dl.seam({place:{...xn(e),index:n}})},`seam:${e}:${n}`),hs={rowClick:Yi,isCollapsed:Cr,toggleCollapse:Br},ms=e=>{const n=String(e.props.id),t=_r.findIndex(e=>String(e.props.id)===n),o=Ot(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 Jn(Un,{children:[
12
- /* @__PURE__ */Gn(Le,{words:Et,icon:/* @__PURE__ */Gn(sr,{type:e.type,size:13}),name:s,preview:qi(e),marks:_i(e),onSelect:()=>Ri(t),nameSlot:Ci(Se,t,n,s),selected:Vo===n,badge:xl,actions:Zi(e,Se,t)??void 0,rowProps:{"data-node-id":n,onClick:Yi(()=>Ri(t))},fold:{open:!i,label:"section",onToggle:()=>Br(n)}}),!i&&/* @__PURE__ */Jn(Ee,{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:{...xn(o),index:t}},{"data-node-id":r,onClick:Yi(c)});/* @__PURE__ */
13
- return Jn(Mn,{children:[d(t),
14
- /* @__PURE__ */Gn(Le,{words:Et,icon:/* @__PURE__ */Gn(sr,{type:n.type,size:13}),name:i,preview:qi(n),marks:_i(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:()=>Br(r)}:void 0,actions:/* @__PURE__ */Jn(Un,{children:[Ki(o,t,i),Zi(n,o,t),Qi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Gn(Ee,{children:Ss(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={...xn(l),index:0},a=s&&!s.rung&&Al(s,c)?c:void 0,p=()=>Si(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(Zo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Yi(p)}),h=pt?null:Zo.slotActions?.(e,n.slot);/* @__PURE__ */
15
- return Jn(Mn,{children:[n.heading,
16
- /* @__PURE__ */Gn(Le,{words:Et,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:()=>Br(l)},actions:h&&h.length>0?/* @__PURE__ */Gn(Un,{children:h.map((t,o)=>/* @__PURE__ */Gn(Fe,{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&&ki(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__ */Gn(Fn,{size:15}):/* @__PURE__ */Gn(Dn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Gn(Ee,{children:r})]},l)},ys=(e,n)=>{const t=rl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
17
- return Gn(Un,{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__ */Jn(Un,{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=Ol(n),p=()=>ul(t,o,d,e.type),{rowProps:u,...f}=Dl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...xn(t),index:o}},{"data-node-id":d,onClick:Yi(p)});/* @__PURE__ */
18
- return Jn(Mn,{children:[0===o&&a(t,0),
19
- /* @__PURE__ */Gn(Le,{words:Et,icon:/* @__PURE__ */Gn(sr,{type:n.type,size:13}),name:c,preview:qi(n),marks:_i(n),onSelect:p,nameSlot:Ci(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Br(d)}:void 0,actions:/* @__PURE__ */Jn(Un,{children:[Ki(t,o,c),Zi(n,t,o),Qi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Gn(Ee,{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__ */Gn(Mn,{children:p},t.slot??"")})})},Ss=(e,n)=>{const t=nr(St?.data,e.type,String(e.props.id)),o=rl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
20
- return Gn(Un,{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)),S=/* @__PURE__ */Jn(Un,{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?{...xn(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,...S}=Dl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...xn(t),index:o},into:h,canDrag:!Qo(n.type)},{"data-node-id":l,onClick:Yi(g)});/* @__PURE__ */
21
- return Jn(Mn,{children:[0===o&&m(t,0),
22
- /* @__PURE__ */Gn(Le,{words:Et,icon:/* @__PURE__ */Gn(sr,{type:n.type,size:13}),name:i,preview:qi(n),marks:_i(n),onSelect:g,nameSlot:Ci(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Br(l)}:void 0,actions:Qo(n.type)?Zi(n,t,o)??void 0:/* @__PURE__ */Jn(Un,{children:[Ki(t,o,i),Zi(n,t,o),Qi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Gn(Ee,{children:Ss(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
23
- /* @__PURE__ */Gn(w,{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,S):/* @__PURE__ */Gn(Mn,{children:S},o.slot??"")})})},ks=No||null!==po,vs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Qt&&!ks&&_o===e.id,onSelect:()=>Yr(e.id)}:e,bs=[...(Ko.railLead??[]).map(vs),{id:"sections",label:Lt.layers,icon:/* @__PURE__ */Gn(Ue,{}),active:Qt&&!ks&&"sections"===_o,onSelect:()=>Yr("sections")},...(Ko.railTrail??[]).map(vs)];ao?bs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Gn(Ye,{}),active:Qt&&!No&&(null!==po||"media"===_o),onSelect:()=>Yr("media")}):mt&&bs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Gn(Ye,{}),onSelect:Xr});const ws=[...Ko.railLead??[],...Ko.railTrail??[]].find(e=>"panel"in e&&e.id===_o),xs=Boolean(At?.foldable)&&!qo,zs=At?.label??(gt?Lt.pageSections:Lt.templateSections),Cs=xs&&Cr(et),Bs=/* @__PURE__ */Jn(Un,{children:[_r.map((e,n)=>{if(Mt(e)||Tt(e)||Nt(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?{...xn(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:Se,index:n,type:e.type},place:{...xn(Se),index:n},into:u},{"data-node-id":r,onClick:Yi(()=>Ri(n))});/* @__PURE__ */
24
- return Jn(Mn,{children:[n>0&&el(n),
25
- /* @__PURE__ */Gn(Le,{words:Et,icon:/* @__PURE__ */Gn(sr,{type:e.type,size:13}),name:ci(e),preview:qi(e),marks:_i(e),onSelect:()=>Ri(n),nameSlot:Ci(Se,n,r,ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Br(r)}:void 0,actions:/* @__PURE__ */Jn(Un,{children:[Ki(Se,n,ci(e)),Zi(e,Se,n),Qi(Se,n,e,ci(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Jn(Ee,{children:[Ss(e,1),Ko.partRows?.(e,hs)]}),i&&!s&&/* @__PURE__ */Gn(Ee,{children:Ko.ownRows?.(e,n,hs)})]},String(e.props.id??n))}),!qo&&Bl>0&&el(Bl)]}),Is=(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?Lt.header:Lt.footer,s=ir.rowName?ir.rowName(e,"section",l):l;/* @__PURE__ */
26
- return Jn(Un,{children:[
27
- /* @__PURE__ */Gn(Le,{words:Et,icon:/* @__PURE__ */Gn(sr,{type:t,size:13}),name:s,preview:qi(e),marks:_i(e),badge:xl,onSelect:()=>Ri(n),nameSlot:Ci(Se,n,o,s),selected:Vo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Br(o)}:void 0,actions:Zi(e,Se,n)??void 0,rowProps:{"data-node-id":o,onClick:Yi(()=>Ri(n))}}),r&&!i&&/* @__PURE__ */Gn(Ee,{children:ys(e,1)})]})};return(Ko.wrap??(e=>e))(
28
- /* @__PURE__ */Gn(X,{target:wo,children:/* @__PURE__ */Jn("div",{ref:bo,className:"sf-editor es-editor",style:fn(vr),onContextMenu:$i.onEditorContextMenu,...m(Ke),children:[
29
- /* @__PURE__ */Jn(tn,{children:[
30
- /* @__PURE__ */Gn(on,{items:bs,ariaLabel:Lt.bar.views}),
31
- /* @__PURE__ */Jn(rn,{children:[
32
- /* @__PURE__ */Gn(ln,{label:Lt.bar.undo,disabled:Boolean(pt)||!vt.hasPast,onClick:()=>vt.back(),children:/* @__PURE__ */Gn(Ln,{})}),
33
- /* @__PURE__ */Gn(ln,{label:Lt.bar.redo,disabled:Boolean(pt)||!vt.hasFuture,onClick:()=>vt.forward(),children:/* @__PURE__ */Gn(En,{})}),
34
- /* @__PURE__ */Gn(sn,{}),
35
- /* @__PURE__ */Gn(dn,{devices:no,value:lo,onChange:so}),
36
- /* @__PURE__ */Gn(ln,{label:Lt.bar.refresh,tip:Lt.bar.refreshTip,onClick:()=>{vo.current=(()=>{const e=wo?.document;if(!e)return null;const n=_r.findIndex(Tt),t=n>=0?n:_r.length;let o=null;for(let n=0;n<t;n++){const t=_r[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??_r[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),ko(e=>e+1)},children:/* @__PURE__ */Gn(Rn,{})})]}),
37
- /* @__PURE__ */Jn(rn,{kind:"right",style:{minWidth:300},children:[
38
- /* @__PURE__ */Gn(l,{input:Bo,words:Lt.saveStatus}),Ko.barLead?.(),Ko.barTrail?.(),Ko.mainAction||!Ko.barMain?/* @__PURE__ */Gn(s,{input:Bo,action:Ko.mainAction??{label:Lt.done,onPress:()=>{ot(St.data)}},readOnly:Boolean(pt),saveSwitch:ft,onToggleAutoSave:st,onSaveNow:Io,bar:Lt.bar,words:Lt.saveStatus}):Ko.barMain()]})]}),
39
- /* @__PURE__ */Gn(ee,{}),
40
- /* @__PURE__ */Jn("div",{className:"sf-body",children:[Qt?/* @__PURE__ */Jn(Un,{children:[
41
- /* @__PURE__ */Gn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Lt.leftPanel,children:No?/* @__PURE__ */Gn(x,{at:Mo?{label:(e=>{const n=Tl(e.zone);if(n)return Lt.add.addingTo({name:ir.rowName?Ui(n,!0):li(n.type)});if(e.zone===Se){const n=_r[e.index];return n&&!Tt(n)?Lt.add.addingBefore({name:Ui(n,!0)}):Lt.add.addingAtEnd}const t=El(e.zone);return t?Lt.add.addingTo({name:t.parentName}):Lt.add.addingHere})(Mo),onClear:()=>To(null)}:void 0,placeBlocks:Mo&&Mo.zone!==Se?El(Mo.zone)?.choices:void 0,canTake:Mo?e=>{if(!Mo)return null;const n={...xn(Mo.zone),index:Mo.index};if(Vl(e,n))return null;const t=Tl(Mo.zone);if(t)return Lt.add.notInside({name:Ui(t,!0)});if(Mo.zone===Se)return Lt.add.onlySections;const o=El(Mo.zone);return o?Lt.add.notInside({name:o.parentName}):Lt.add.onlySections}:void 0,onPick:Mo?e=>{if(!Mo)return;const n={...xn(Mo.zone),index:Mo.index};Vl(e,n)&&(Fl(e,n),Ji())}: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?.(Ji),onClose:Ji,onHide:Jr,readOnly:Boolean(pt)}):po&&co?
42
- /* @__PURE__ */Gn(B,{panel:co,pick:po,onHide:Jr}):ws?ws.panel({onHide:Jr,notify:Pr}):"media"===_o&&co?/* @__PURE__ */Gn(B,{panel:co,pick:null,onHide:Jr}):/* @__PURE__ */Jn(Un,{children:[
43
- /* @__PURE__ */Gn(z,{icon:/* @__PURE__ */Gn(Ue,{}),title:Lt.layers,context:Gt,actions:/* @__PURE__ */Jn(Un,{children:[!pt&&/* @__PURE__ */Gn(cn,{label:Lt.add.title,onClick:()=>Di(null),children:/* @__PURE__ */Gn(Vn,{size:15})}),
44
- /* @__PURE__ */Gn(cn,{label:Nl?Lt.expandAll:Lt.collapseAll,title:0===Il.length?Lt.nothingToFold:void 0,disabled:0===Il.length,onClick:()=>kr(e=>{const n=new Set(Il);return Nl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Il])}),children:/* @__PURE__ */Gn(qn,{expand:Nl})})]}),onHide:Jr}),
45
- /* @__PURE__ */Jn(Re,{className:"sf-tree sf-scroll",words:Et,children:[
46
- /* @__PURE__ */Gn(Le,{words:Et,icon:/* @__PURE__ */Gn(sr,{type:"page",size:13}),name:Lt.pageSettings,onSelect:Kr,selected:!bt&&Ro,rowProps:{onClick:Yi(Kr)}}),zl&&/* @__PURE__ */Jn(Un,{children:[!wl&&/* @__PURE__ */Gn(Ve,{children:Lt.header}),ms(zl)]}),!qo&&yt&&!(wl&&zl)&&/* @__PURE__ */Jn(Un,{children:[!wl&&/* @__PURE__ */Gn(Ve,{children:Lt.header}),!jt&&/* @__PURE__ */Gn(Le,{words:Et,icon:/* @__PURE__ */Gn(sr,{type:"header",size:13}),name:Lt.header,badge:xl,onSelect:qr,selected:Lo.kind===$t?.kind,rowProps:{onClick:Yi(qr)}})]}),!qo&&kl&&!(wl&&zl)&&Is(kl,Sl,"header"),!qo&&!xs&&/* @__PURE__ */Gn(Ve,{children:zs}),xs?/* @__PURE__ */Jn(Un,{children:[
47
- /* @__PURE__ */Gn(Le,{words:Et,icon:null,name:zs,fold:{open:!Cs,label:zs,onToggle:()=>Br(et)}}),!Cs&&/* @__PURE__ */Gn(Ee,{children:Bs})]}):Bs,yt&&!wl&&/* @__PURE__ */Gn(Ve,{children:Lt.footer}),yl&&!(wl&&Cl)&&Is(yl,gl,"footer"),!qo&&!yl&&yt&&!wl&&/* @__PURE__ */Gn(Le,{words:Et,icon:/* @__PURE__ */Gn(sr,{type:"footer",size:13}),name:Lt.footer,onSelect:Xi,rowProps:{onClick:Yi(Xi),title:Lt.editFooter}}),Cl&&ms(Cl),Ko.treeFoot?.()]})]})}),
48
- /* @__PURE__ */Gn(an,{side:"left",width:vr.left,min:un,max:pn,defaultWidth:S.left,label:Lt.resizeLeftPanel,onResize:xr})]}):/* @__PURE__ */Gn(C,{side:"left",onShow:Jr}),
49
- /* @__PURE__ */Jn("div",{ref:$r,className:"sf-center sf-scroll","data-sf-canvas-head":Lr?"":void 0,style:{overflowX:Hr?"auto":"hidden",overflowY:"hidden"},children:[Lr&&/* @__PURE__ */Gn("div",{ref:Er,className:"sf-canvas-head",children:/* @__PURE__ */Gn(Lr,{device:lo})}),
50
- /* @__PURE__ */Jn("div",{className:"sf-frame-scaler",style:Dr,children:[
51
- /* @__PURE__ */Gn("div",{className:"sf-frame "+(lo===ro?"":`sf-frame--${lo}`),style:Gr,children:/* @__PURE__ */Jn("div",{className:"sf-preview-host",children:[
52
- /* @__PURE__ */Gn(Me.Provider,{value:bl,children:/* @__PURE__ */Gn(Jt,{},So)}),
53
- /* @__PURE__ */Gn(Ie,{canvas:wo,session:Hl,model:os,measure:is,canDrop:ss,onDrop:cs,choose:Ul,onPick:ps,onZoneAdd:us,onSeamAdd:us,zoneAddLabel:Lt.canvasAddBlock,words:Rt.canvas,readOnly:Boolean(pt),revision:St.data}),jo.length>0&&/* @__PURE__ */Gn("div",{className:"sf-preview-gaps",children:jo.map(e=>
54
- /* @__PURE__ */Gn(Ne,{index:e.index,label:Lt.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__ */Gn(Kn,{canvas:wo,tabs:ql,onSelect:e=>{const n=_r.findIndex(n=>String(n.props.id)===e);n>=0&&Ri(n)}}):null]})]}),eo?/* @__PURE__ */Jn(Un,{children:[
55
- /* @__PURE__ */Gn(g,{value:{selectChild:ul,addChild:fl,childRowName:xi,blockRowName:Ol},children:/* @__PURE__ */Gn(Ut,{mode:Lo,onOpenWebsiteSettings:Ko.openSettings??(()=>{}),onOpenSiteStyles:Ko.openStyles,onSelectNode:pr,onNotify:Pr,onHidePanel:Ur,nodeActions:bt?ke(xt,bt.type):nt})}),
56
- /* @__PURE__ */Gn(an,{side:"right",width:vr.right,min:un,max:pn,defaultWidth:S.right,label:Lt.resizeSettingsPanel,onResize:zr})]}):
57
- /* @__PURE__ */Gn(C,{side:"right",onShow:Ur})]}),$i.menu]})}))}export{tt as ScreenChrome};
@@ -1,5 +0,0 @@
1
- import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-6LYK3NGW.js";import{Inspector as i}from"./chunk-2QX2VB2C.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},O={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
2
- return s(t,{height:"fill"})}function S(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
3
- return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var G=o({});function N({parts:n,children:e}){/* @__PURE__ */
4
- return s(G.Provider,{value:n,children:e})}function P(){return u(G)}function B(){return(P().useOwnerName??v)()}function D(){return(P().useDocumentLabel??g)()}function x(n,e,t,r){return(P().useBridges??h)(n,e,t,r)}function I(n){return(P().useStandaloneBridges??h)(n)}function T(n,e){(P().useDocumentPass??y)(n,e)}function A(){return P().blockRules??b}function F(){return P().blockLook??L}function K(){return P().devices??O}function R(){return P().leftView??j}function V(){return P().pinned??w}function W(){return P().saveSwitch??!0}function Q(e){n(!0===P().pickFollowsSelection,e)}function Y(){return P().storageNamespace||void 0}function E(){return P().styleClipboard??null}function H(){return P().nodeKeys??!0}function X(){return P().notify??null}function Z(){return P().Canvas??C}function q(){return P().CanvasHead??null}function z(){return P().canvasDrag??null}var J=o(null);function M({target:n,children:e}){/* @__PURE__ */
5
- return s(J.Provider,{value:n,children:e})}function U(){return u(J)}function $(){return P().Inspector??S}export{c as SELECTION_MODE,M as ScreenCanvasTargetProvider,N as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,F as useScreenBlockLook,A as useScreenBlockRules,x as useScreenBridges,z as useScreenCanvasDrag,Z as useScreenCanvasFrame,q as useScreenCanvasHead,U as useScreenCanvasTarget,K as useScreenDevices,D as useScreenDocumentLabel,T as useScreenDocumentPass,$ as useScreenInspectorPanel,R as useScreenLeftView,H as useScreenNodeKeys,X as useScreenNotify,B as useScreenOwnerName,P as useScreenParts,Q as useScreenPickFollowsSelection,V as useScreenPinned,W as useScreenSaveSwitch,Y as useScreenStorageNamespace,E as useScreenStyleClipboard,I as useStandaloneScreenBridges};
@@ -1,4 +0,0 @@
1
- import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-IE55HNMA.js";import{SplitButton as n,Kbd as s,CMD_S as i}from"efficient-shell/ui";import{CloudIcon as o,CheckIcon as l}from"efficient-shell/icons/efficient";import{jsx as r,jsxs as d}from"react/jsx-runtime";var c=e=>e.state.failed&&null!=e.state.retryAt||null!=e.state.savedAt;function u({input:n,words:s}){const i=e(c(n)),o=t({...n,now:i},s);/* @__PURE__ */
2
- return r(a,{state:o.state,label:o.label})}function m({input:a,action:u,readOnly:m,saveSwitch:p,onToggleAutoSave:b,onSaveNow:v,bar:f,words:y}){const h=e(c(a)),k=t({...a,now:h},y),w=k.retry?f.retry:f.saveNow,S=/* @__PURE__ */d("span",{className:"es-savemenu-row",children:[w,
3
- /* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(s,{keys:i,size:"sm"})})]}),A=[{type:"status",key:"status",label:k.line(u.status)},{type:"divider",key:"divider"},...p?[{type:"checkbox",key:"auto-save",label:f.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:S,icon:/* @__PURE__ */r(o,{}),disabled:m,onSelect:v}],N=u.quiet??null,g=k.blocked??u.disabledReason??N?.reason??null;/* @__PURE__ */
4
- return r(n,{variant:N?"secondary":"primary",leftIcon:N?/* @__PURE__ */r(l,{}):void 0,onClick:()=>u.onPress(),disabled:null!==g,disabledReason:g??void 0,tooltip:u.tooltip,loading:!0===u.busy,menuLabel:f.saveOptions,items:A,menuMinWidth:300,children:N?N.label:u.label})}export{m as ScreenMainButton,u as ScreenSaveIcon};