efficient-easel 0.105.0 → 0.105.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.
- package/dist/{chunk-YN4KND5F.js → chunk-FMGFZNPW.js} +1 -1
- package/dist/chunk-HLEET6NV.js +65 -0
- package/dist/{chunk-TLZG2FCF.js → chunk-NWIW7AWH.js} +1 -1
- package/dist/{chunk-RQHC4TD6.js → chunk-Q4N7C6CT.js} +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.d.ts +14 -12
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4XQUWGIV.js +0 -65
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-NWIW7AWH.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-VSHV6KJQ.js";import{useEasel as p}from"./chunk-P67FP7PG.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=p(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),I?.(t)):i(o=>"part"===o.kind?n:o)},[i,I]);c(()=>{k(l)},[k,l]);const P=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(P)},[P,f]);return{selectNode:d(o=>{i(()=>n);const e=a(o);e&&u.select(e)},[i,a,u]),openPartId:P}}export{m as usePartBridge};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-SQTY6CJD.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-IE4GFYKO.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h}from"./chunk-VSOP4GUM.js";import{SlotChildActionsProvider as m}from"./chunk-KCBEE2MC.js";import{UiIcon as g}from"./chunk-5MZ3RNQQ.js";import{DEFAULT_PANEL_W as y,PANEL_WIDTHS_KEY as k,clampPanelWidth as S}from"./chunk-ZTTWFAAC.js";import{usePartBridge as v}from"./chunk-FMGFZNPW.js";import{useSectionOps as b}from"./chunk-NWIW7AWH.js";import{useNodeClipboard as x,useNodeContextMenu as w}from"./chunk-7FBDZTUD.js";import{PageEditGuardNotices as z}from"./chunk-V4LF7D4F.js";import{useScreenDocument as B}from"./chunk-7V5WZ46F.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as N,styleShortcut as $}from"./chunk-57DJOKXT.js";import{AddChildRow as I}from"./chunk-3QVB4AG2.js";import{AddSidePanel as O}from"./chunk-N7VRF7PR.js";import{SidePanelHead as T,PanelShowStrip as P}from"./chunk-5ZBBXZPV.js";import{MediaSidePanel as A}from"./chunk-NYKIQJT2.js";import{useScreenSaveSwitch as R,useScreenNodeKeys as j,useScreenPinned as M,useScreenDocumentLabel as E,useScreenCanvasFrame as V,useScreenInspectorPanel as D,useScreenDevices as F,useScreenPickFollowsSelection as L,useScreenLeftView as G,useScreenAdd as H,SELECTION_MODE as W,sameInspectorMode as U,useScreenBridges as J,useScreenBlockRules as Y,useScreenBlockLook as Q,useScreenNotify as K,useScreenCanvasHead as Z,isSlotMode as _,useScreenStyleClipboard as X,useScreenDocumentPass as q,useScreenCanvasDrag as ee,ScreenCanvasTargetProvider as ne,isPinnedFirst as te,isPinnedLast as oe,screenSlotsOf as re}from"./chunk-VSHV6KJQ.js";import{ROOT_ZONE as ie,blockNodeActions as le,TREE_MAX_DEPTH as se,childSlotsOf as de,slotFieldsOf as ce,slotChildrenIn as ae,nestsInTree as pe,newNodeId as ue}from"./chunk-PLVEGYK6.js";import{useMediaPanel as fe,usePanelPick as he,useCancelPanelPick as me}from"./chunk-R6WTQWAC.js";import{useEaselHost as ge,useHostEscape as ye}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as ke}from"./chunk-PQXIFBDY.js";import{useEasel as Se,useEaselApi as ve}from"./chunk-P67FP7PG.js";import{TreeRow as be,Subtree as xe,LayersTree as we,TreeGroupLabel as ze,TreeRowAction as Be,TreeSeam as Ce}from"./chunk-ZFDCDJNZ.js";import{toItemSelector as Ne,useNodeOps as $e}from"./chunk-D2BCHTQR.js";import{saveIndicator as Ie}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Oe,TopBarRail as Te,TopBarCluster as Pe,EaselIconButton as Ae,TopBarDivider as Re,DeviceSwitch as je,InspectorIconButton as Me,PanelResizeHandle as Ee,MAX_PANEL_W as Ve,MIN_PANEL_W as De,panelWidthVars as Fe,SaveState as Le,SaveStateToggle as Ge}from"./chunk-YC4TB3CJ.js";import{useWords as He}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as We}from"./chunk-TTJ54QGG.js";import{createDragSession as Ue,useTreeDrag as Je,gapToMoveIndex as Ye}from"./chunk-67GNT6PF.js";import{useCanvasFrame as Qe,BLOCK_SELECTOR as Ke,useCanvasEvent as Ze}from"./chunk-PAELDYYS.js";import{LayersIcon as _e,UndoIcon as Xe,RedoIcon as qe,TrashIcon as en,MediaIcon as nn,DuplicateIcon as tn}from"./chunk-L5KW4HG5.js";import{zoneKey as on,ROOT_ID as rn,ROOT_SLOT as ln,parseZoneKey as sn,DataError as dn}from"./chunk-KRXQM65X.js";import{useRef as cn,useMemo as an,useState as pn,useEffect as un,useCallback as fn,useLayoutEffect as hn,Fragment as mn}from"react";import{jsx as gn,jsxs as yn,Fragment as kn}from"react/jsx-runtime";function Sn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return gn(Le,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
+
return gn(Le,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=Ie(e),d=e.failed&&!e.paused&&/* @__PURE__ */gn("button",{type:"button",className:"es-btn-ghost",onClick:i,children:"Retry now"});/* @__PURE__ */
|
|
3
|
+
return yn(kn,o?{children:[
|
|
4
|
+
/* @__PURE__ */gn(Ge,{pressed:e.paused,onToggle:r,title:e.paused?"Auto-save is off — click to turn it back on (saves your held edits)":"Auto-save is on — click to pause it",children:/* @__PURE__ */gn(Le,{tone:l,label:s})}),d]}:{children:[
|
|
5
|
+
/* @__PURE__ */gn(Le,{tone:l,label:s,role:"status"}),d]})}function vn({expand:e}){/* @__PURE__ */
|
|
6
|
+
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__ */yn(kn,e?{children:[
|
|
7
|
+
/* @__PURE__ */gn("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
+
/* @__PURE__ */gn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
+
/* @__PURE__ */gn("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
+
/* @__PURE__ */gn("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
+
/* @__PURE__ */gn("path",{d:"M5 12h14"})]})})}var bn="__rungs";var xn="screen:band",wn={duplicate:!0,delete:!0};function zn(){const Ie=ge(),{target:Le,docId:Ge,capabilities:zn,currentSlug:Bn,siteId:Cn,onPublish:Nn,saveState:$n,saveConflict:In,retrySave:On,toggleAutoSave:Tn,readOnly:Pn,readOnlyReason:An=null}=B(),Rn=R(),jn=j(),{mediaEditing:Mn,hasEditGuard:En,hasPinnedChrome:Vn}=zn,{appState:Dn,dispatch:Fn,history:Ln,selectedItem:Gn,getSelectorForId:Hn,config:Wn}=Se(e=>e),Un=M(),{first:Jn,firstGroup:Yn,lastGroup:Qn,isSectionGroup:Kn,sectionGroupZone:Zn,panelOf:_n}=Un,Xn=_n(Jn),qn=e=>te(Un,e),et=e=>oe(Un,e),nt="node"===Un.firstRow,tt=Un.band??null,ot=He("screen",ke),rt=E()??`/${Bn}`,it=V(),lt=D(),st=b({readOnly:Pn}),dt=cn(null),ct=ve(),at=an(()=>({...st,select:e=>{dt.current=e,st.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=ct.config;dt.current=Ne(e,t,n)}st.commitDocument(e,n)}}),[st,ct]),pt=Dn.ui,ut=pt.leftSideBarVisible,ft=pt.rightSideBarVisible,{options:ht,widths:mt,initial:gt,fluid:yt,fit:kt}=F(),[St,vt]=pn(gt),bt=fe(),xt=Mn&&null!==bt,wt=he(),zt=me();L(Gn?.props.id);const{read:Bt,write:Ct,forSelection:Nt}=G(),[$t,It]=pn(Bt);un(()=>{Ct($t)},[$t]);const[Ot,Tt]=pn(0),Pt=cn(null),At=cn(null),Rt=Qe(At,{readySelector:Ke}),jt=f(At);h(At);const[Mt,Et]=pn(!1),Vt=cn(!1),Dt=cn(!1),[Ft,Lt]=pn(null),Gt=H(),Ht=e=>Lt(null===e?null:{zone:ie,index:e}),[Wt,Ut]=pn([]),[Jt,Yt]=pn(W),Qt="puck"===Jt.kind,Kt=Mt&&!Ft&&Gt.railTarget?Gt.railTarget(Dn.data,{node:Gn??null,mode:Jt}):null,Zt=Kt?{zone:on(Kt),index:Kt.index}:null,_t=Ft??Zt,Xt=_t&&_t.zone===ie?_t.index:null,qt=t(Jt,Gn?.props.id),[eo,no]=pn(null);un(()=>{eo&&(o(),no(null))},[eo]);const to=cn(Hn);to.current=Hn;const oo=fn((e,{scroll:n})=>{It(n=>Nt(e,n)),n&&no(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=to.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Po(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ro=cn(null);un(()=>{const e=ro.current;ro.current=null;const n=null==Gn?.props.id?null:String(Gn.props.id);Yt(e&&e.id===n?e.mode:_n(Gn?.type)??W);const t=Gn?.props.id,o=dt.current;if(dt.current=null,!t)return;const i=Hn(t);oo(String(t),{scroll:!r(o,i??null,ie)})},[Gn?.props.id,oo]);const io=fn(e=>{Yt(n=>U(n,e)?n:e),Fn({type:"setUi",ui:{rightSideBarVisible:!0}})},[Fn]),lo=cn(()=>{});lo.current=(e,n)=>{const t=e?Cr(e.zone??ie)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Gn?.props.id?null:String(Gn.props.id);Yt(e=>U(e,n)?e:n),o!==r&&(ro.current={id:o,mode:n},at.select(e))};const so=fn((e,n)=>lo.current(e,n),[]),co={kind:Jt.kind,mode:Jt,open:io,show:e=>Yt(e),reveal:()=>{ft||Fn({type:"setUi",ui:{rightSideBarVisible:!0}})},select:so},ao=J(co,{data:Dn.data,selected:Gn??null,zoneOf:e=>Hn(e)?.zone,readOnly:Boolean(Pn),select:e=>{Yt(W),at.select({index:e})},replace:(e,n)=>at.replaceComponent(ie,e,n),scrollTo:e=>_r(e)},{device:St,refreshes:Ot},{setView:It,reveal:()=>{ut||Fn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),po=ao.pinnedSource??!1,uo=ao.resolveLeftView?ao.resolveLeftView($t,xt):"media"===$t&&xt?$t:"sections",fo=Y(),{isLockedBlock:ho,duplicateBlocked:mo,nestDepth:go,newSectionNode:yo,canAddTo:ko,blockIsOffered:So}=fo,vo=Q(),{labelAtLevel:bo,Icon:xo,useProducts:wo}=vo,zo=vo.rowName?(e,n,t)=>vo.rowName(e,n,t):void 0,Bo=fn(e=>{Fn({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),oo(e,{scroll:!0})},[Fn,oo]),{selectNode:Co,openPartId:No}=v({mode:Jt,setMode:Yt,onOpenPart:Bo}),[$o,Io]=pn(null);ye(null!==$o,()=>Io(null));const Oo="sf-editor-collapsed-sections",[To,Po]=pn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Oo);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
+
return new Set}});un(()=>{try{window.localStorage.setItem(Oo,JSON.stringify([...To]))}catch{}},[To]);const[Ao,Ro]=pn(()=>{if("undefined"==typeof window)return{...y};try{const e=window.localStorage.getItem(k);if(!e)return{...y};const n=JSON.parse(e);return{left:S(Number(n.left)||y.left),right:S(Number(n.right)||y.right)}}catch{return{...y}}});un(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(k,JSON.stringify(Ao))}catch{}},300);return()=>clearTimeout(e)},[Ao]);const jo=fn((e,n)=>Ro(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Mo=fn(e=>jo("left",e),[jo]),Eo=fn(e=>jo("right",e),[jo]),Vo=e=>To.has(e),Do=e=>Po(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Fo=cn(!1),Lo=cn(null);un(()=>{if(Fo.current&&!Mt){const e=Lo.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??At.current?.querySelector(`button[aria-label="${CSS.escape(ot.add.title)}"]`))?.focus(),Lo.current=null}Fo.current=Mt},[Mt]),un(()=>{if(!Mt||!jt)return;const e=e=>{"Escape"===e.key&&li()};return jt.addEventListener("keydown",e),()=>jt.removeEventListener("keydown",e)},[Mt,jt]),ye(Mt,()=>li()),un(()=>{!ut&&Mt&&(Et(!1),Lt(null),Vt.current=!1)},[ut]),un(()=>{if(!wt)return Dt.current&&Fn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Dt.current=!1);Mt&&(Et(!1),Lt(null),Dt.current=Vt.current,Vt.current=!1),ut||(Dt.current=!0,Fn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[wt]),un(()=>{!ut&&wt&&(Dt.current=!1,zt())},[ut]),un(()=>{if(!wt||!jt)return;const e=e=>{"Escape"===e.key&&zt()};return jt.addEventListener("keydown",e),()=>jt.removeEventListener("keydown",e)},[wt,jt]),ye(null!==wt,()=>zt());const Go=K(),[Ho,Wo]=pn(null),[Uo,Jo]=pn(0),Yo=cn(null),Qo=(e,n="success")=>{Go?Go(e,"error"===n?"error":"info"):(Wo({msg:e,tone:n}),Jo(e=>e+1),Yo.current&&clearTimeout(Yo.current),Yo.current=setTimeout(()=>Wo(null),"error"===n?3200:1900))};un(()=>()=>{Yo.current&&clearTimeout(Yo.current)},[]);const Ko=cn(null),[Zo,_o]=pn(0),[Xo,qo]=pn(0),er=Z(),nr=cn(null),tr=e=>Math.max(0,e.clientHeight-(nr.current?.offsetHeight??0));un(()=>{const e=Ko.current;if(!e)return;const n=()=>{_o(e.clientWidth),qo(tr(e))};n();const t=new ResizeObserver(n);return t.observe(e),nr.current&&t.observe(nr.current),()=>t.disconnect()},[]),hn(()=>{Ko.current&&(_o(Ko.current.clientWidth),qo(tr(Ko.current)))},[Ao,ut,ft]);const or=St===yt?Zo>0?Zo:mt[yt]:mt[St],rr=Zo>0?Math.min(Zo/or,"shrink"===kt?1:2):1,ir=or*rr,lr=Zo>0&&ir>Zo+1,sr={width:ir,height:Xo||"100%",flex:"none",position:"relative"},dr={width:or,height:Xo?Xo/rr:"100%",maxHeight:"none",transform:1!==rr?`scale(${rr})`:void 0,transformOrigin:"top left"},cr=()=>Fn({type:"setUi",ui:{leftSideBarVisible:!ut}}),ar=()=>Fn({type:"setUi",ui:{rightSideBarVisible:!ft}}),pr=e=>{Mt&&(Et(!1),Lt(null),Vt.current=!1,ut&&$t===e)||wt&&(Dt.current=!1,zt(),ut&&$t===e)||(ut&&$t===e?cr():(It(e),ut||Fn({type:"setUi",ui:{leftSideBarVisible:!0}})))},ur=()=>{C(Ie,{accept:"image/*",title:"Media library"})},fr=()=>{Yt(W),at.select(null),u()},hr=()=>{Yt(Xn??W),ft||Fn({type:"setUi",ui:{rightSideBarVisible:!0}})},mr=Dn.data.content??[],gr=()=>{const e=mr.findIndex(qn),n=mr.findIndex(et);return{floor:e>=0?e+1:0,cap:n>=0?n:mr.length}},yr=Wn,kr=x(),Sr=$e({data:Dn.data,config:yr,readOnly:Boolean(Pn),clipboard:kr,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==rn||e.slot!==ln)return{min:0,max:n-1};const{floor:t,cap:o}=gr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Yt(W);const t=void 0===n||"node"===n?.kind?n:null;at.commitDocument(e,t)}}),vr=e=>Wn.components[e]?.label??e,br=fn(e=>Wn.components[e]?.defaultProps??{},[Wn]),xr=e=>bo(e,"section",vr(e)),wr=e=>l({type:e.type,props:e.props??{}},xr(e.type),zo),{nodeAddresses:zr,zoneItems:Br}=an(()=>{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>=se)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of de(Wn,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(mr,ie,0),{nodeAddresses:e,zoneItems:n}},[mr,Wn]),Cr=fn(e=>Br.get(e)??[],[Br]),Nr=e=>{const n=zr.get(e);return n?Cr(n.zone)[n.index]:void 0},$r=e=>re(fo,Wn,e),Ir=e=>{if(!fo.slotsOf||e===ie)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Nr(e.slice(0,n));if(!t)return null;const o=$r(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}},Or=(()=>{if(!_(Jt))return null;const e=`${Jt.nodeId}:${Jt.slot}`;return Ir(e)?.slot.panel===Jt.kind?e:null})(),Tr=cn(null);un(()=>{const e=Tr.current;if(Tr.current=null,!Or||!_(Jt))return;const n=Jt.nodeId;oo(n,{scroll:e!==Or}),Po(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Jt]);const Pr=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=zr.get(e);n&&(n.zone===ie?Xr(n.index):Ni(n.zone,n.index,e,Nr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Or!==i&&(Tr.current=i),so(null,r),ft||Fn({type:"setUi",ui:{rightSideBarVisible:!0}}),_r(o)},Ar=(e,n,t)=>{const o=`${e}:${n}`;if(Po(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;Or!==o&&(Tr.current=o);so(null,{kind:t,nodeId:e,slot:n})},Rr=(e,n,t)=>{if(Pn||!fo.moveSlot)return;const o=Nr(e),r=o?$r(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:bn,index:n},s=Ye(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=fo.moveSlot(e,n,s);"string"==typeof d&&Ar(e,d,i.panel)},jr=wo(),Mr=an(()=>{const e=/* @__PURE__ */new Map;for(const n of jr??[])e.set(n.slug,n.name);return e},[jr]),Er=e=>s(e,vr,vo.plainText,e=>Mr.get(e),vo.rowName),Vr=(e,n)=>{const t=Wn.components[e.type]?.fields,o=n===ie||Ui(n)?"section":"block",r=n===ie&&(qn(e)||et(e)||Kn(e.type)),i="block"===o?d(t):r?null:c(t);return vo.renamePropOf?vo.renamePropOf(e,o,i):i},Dr=(e,n,t,o)=>{if(!($o?.zone===e&&$o.index===n))return;const r=(t,o)=>{Io(null),o&&((e,n,t)=>{const o=Cr(e)[n];if(!o)return;const r=Vr(o,e);r&&at.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
+
return gn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":"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)},Fr=n(X()),Lr=Fr.scope({target:Le,siteId:Cn,docId:Ge}),Gr=Wn,Hr=(e,n)=>n===ie?xr(e):vr(e),Wr=(e,n,t)=>{const o=Fr.plan(Lr,t,Hr(t.type,e),Gr);o&&(o.changed&&at.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Qo(o.message))},Ur=w({nodesIn:Cr,nodeAt:(e,n)=>Cr(e)[n]??null,labelOf:(e,n)=>n===ie?xr(e):vr(e),renamePropOf:Vr,beginRename:(e,n)=>Io({zone:e,index:n}),history:{hasPast:Ln.hasPast,hasFuture:Ln.hasFuture,back:()=>Ln.back(),forward:()=>Ln.forward()},openAddSection:()=>{at.select(null),ri(null)},openPageSettings:()=>{at.select(null),Yt(W)},collapseAll:()=>Po(new Set(Cr(ie).map(e=>String(e.props.id)))),onPasteRefused:e=>Qo(e?ot.pasteRefused({name:e.label}):"Your browser won’t let us read the clipboard — press ⌘V","error"),canPasteAt:(e,n)=>Yi(e,n),menuRows:ao.menuRows,isLocked:e=>ho(e.type),duplicateBlocked:e=>mo(Dn.data,e),permits:e=>le(Wn,e.type),canAddTo:ko,nodeOps:Sr,isPinned:(e,n)=>n===ie&&(qn(e)||et(e)),sectionBand:gr,openAddInside:(e,n)=>{e===ie?Xr(n):at.select({zone:e,index:n}),ri(null)},locate:e=>zr.get(e)??null,rowNameOf:(e,n)=>n===ie?wr(e):Er(e),selectAt:(e,n,t,o)=>{e===ie?Xr(n):Ni(e,n,t,o??"")},slotRung:e=>{const n=Ir(e);return n?.slot.panel?{label:n.slot.label,select:()=>Pr(n.node,n.slot,!1)}:null},style:{held:()=>N(Lr),canCopy:e=>Fr.rows(Gr,e).some(e=>!1!==e.counted),copy:(e,n)=>Fr.copy(Lr,e,Hr(e.type,n),Gr),paste:(e,n,t)=>Wr(e,n,t)},keys:jn?{target:jt,selected:()=>{const e=Dn.ui.itemSelector;return e?{zone:e.zone??ie,index:e.index}:null},held:()=>kr.get(),readOnly:Boolean(Pn),onDone:({done:e,name:n})=>{"copied"===e&&Qo(ot.copied({name:n}))}}:void 0},Rt),Jr=cn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});un(()=>{Jr.current={copy:(e,n)=>Fr.copy(Lr,e,Hr(e.type,n),Gr),paste:Wr,at:()=>{const e=Dn.ui.itemSelector;if(!e)return null;const n=e.zone??ie,t=Cr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Pn)}});const Yr=fn(e=>{const n=$(e);if(!n)return;const t=Jr.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))},[]);un(()=>{if(!jt)return;const e=e=>Yr(e);return jt.addEventListener("keydown",e),()=>jt.removeEventListener("keydown",e)},[Yr,jt]),Ze(Rt,"keydown",Yr);const Qr=mr.map(e=>e.props.id).join("|");un(()=>{const e=Rt?.document??null,n=Rt?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ut(e=>e.length?[]:e);const n=mr.findIndex(et),t=n>=0?n:mr.length,o=n=>{const t=mr[n]?.props?.id;if(null==t)return null;const o=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);return o?o.getBoundingClientRect():null},r=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1);(n||t)&&r.push({top:Math.round(n?n.top:t.bottom),index:e})}Ut(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)return!1;return!0}(e,r)?e:r)},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()}},[Rt,Qr,St,rr,ut,ft,Gn?.props.id]);const Kr=Rt?.document??null,Zr=Rt?.window??null;un(()=>{const e=Pt.current;if(!e||!Kr||!Zr)return;const n=[],t=()=>{const n=Kr.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Zr.scrollTo({left:Zr.scrollX,top:Zr.scrollY+t,behavior:"instant"}),!0};return Pt.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Kr,Zr]);const _r=e=>{ao.holdCanvasOn?ao.holdCanvasOn(e):a(e)},Xr=e=>{Yt(W),at.select({index:e}),ao.sectionPressed?.(mr[e]);const n=mr[e]?.props?.id;n&&_r(n)},qr=e=>{const{floor:n,cap:t}=gr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Gn&&Jt.kind!==Xn?.kind?mr.findIndex(e=>e.props.id===Gn.props.id):-1;return o(r>=0?r+1:t)},ei=(e,n)=>{const{floor:t,cap:o}=gr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(at.reorderComponent(ie,e,i),at.select({index:i}),{moved:!0,dest:i})},ni=(e,n,t)=>{Yt(W),at.select({index:e}),a(n),Qo(`Added “${t}” section`)},ti=(e,n)=>{const t=qr(n),o=yo(e,{nodeDefaults:br,newNodeId:ue,sectionLabel:xr,blockIsOffered:So}),r=o?at.insertNode(ie,t,o):at.insertSection(e,t);return ni(t,r,xr(e)),t},oi=(e,n,t)=>{const o=qr(t),r=at.insertNode(ie,o,n);return ni(o,r,e),o},ri=e=>ii(ie,e),ii=(e,n)=>{Lo.current=document.activeElement??null,wt&&(Vt.current=Dt.current,Dt.current=!1,zt()),Lt(null===n?null:{zone:e,index:n}),Et(!0),ut||(Vt.current=!0,Fn({type:"setUi",ui:{leftSideBarVisible:!0}}))},li=()=>{Et(!1),Lt(null),Vt.current&&Fn({type:"setUi",ui:{leftSideBarVisible:!1}}),Vt.current=!1},si=(e,n,t)=>{if("section"===e.kind)at.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;at.insertNode(n,t,i(e.template.node))}Yt(W),at.select({index:t,zone:n})},di=e=>n=>{n.target.closest(".es-tree-select")||e()},ci=()=>ao.editPinnedSource?.(),ai=(e,n,t)=>{const o=Cr(e)[n];return o&&!le(Wn,o.type).delete?null:/* @__PURE__ */gn(Be,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=Cr(e)[n]?.props?.id;null!=t&&Sr.remove(String(t))})(e,n),children:/* @__PURE__ */gn(en,{size:15})})},pi=e=>vo.rowPreview?.(e)||void 0,ui=e=>vo.rowMarks?.(e)??void 0,fi=(e,n,t)=>vo.rowActions?.(e,n,t)??null,hi=(e,n,t,o)=>{const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
+
return gn(Be,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>gi(e,n,t),children:/* @__PURE__ */gn(g,r?{name:"eye-off",size:14}:{name:"eye",size:14})})},mi=e=>{const n=xr(mr[e]?.type??""),t=n?ot.addSectionBefore({name:n}):ot.addSectionHere;return fl(ie,e,()=>ri(e),t)},gi=(e,n,t)=>{at.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},yi=e=>ce(Wn,e),ki=e=>de(Wn,e),Si=e=>fo.slotsOf?$r(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:ae(e,n.slot)})):[{slot:null,rung:null,kids:ki(e)}],vi=e=>fo.slotsOf?Si(e).flatMap(e=>e.kids):ki(e),bi=e=>Boolean(fo.slotsOf)&&$r(e).some(e=>e.rung),xi=(e,n,t)=>null===t?void 0===n?ko(e):ko(e,n):ko(e,n,t),wi=(e,n,t)=>{const o=pe(Wn,e.type,n)&&(t||vi(e).length>0||bi(e));return{collapsible:o,folded:o&&Vo(String(e.props.id))}},zi=(e,n,t)=>Si(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>wi(e,r,t(e.type)).collapsible?[String(e.props.id),...zi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Bi=e=>vi(e).length>0||bi(e)||Boolean(ko(e.type)),Ci=e=>Boolean(ko(e)),Ni=(e,n,t,o)=>{if(Yt(W),ko(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),at.select({index:n,zone:e}),a(t)}else at.select({index:n,zone:e}),_r(t)},$i=(e,n,t,o,r)=>{const i=`${e}:${n}`;at.insertComponent(i,t,o),ko(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),at.select({index:o,zone:i})}):at.select({index:o,zone:i})},Ii=(e,n,t)=>{at.insertComponent(e,n,t),Yt(W),at.select({index:t,zone:e})},Oi=cn(/* @__PURE__ */new Set);un(()=>{mr.forEach(e=>{const n=ko(e.type)?.spec;if(!n)return;const t=e.props.id;if(Oi.current.has(t))return;Oi.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(br)).forEach((e,t)=>at.seedChild(o,t,n.childType,e))})},[mr,at,br]);const Ti=cn(/* @__PURE__ */new Set);un(()=>{mr.forEach((n,t)=>{const o=n.props.id;if(Ti.current.has(o))return;const r=e(n,yi(n.type));Ti.current.add(o),r&&at.replaceComponent(ie,t,{...n,props:r})})},[mr,at]),q(at,Wn);const Pi=mr.findIndex(et),Ai=Pi>=0?mr[Pi]:null,Ri=nt?mr.findIndex(qn):-1,ji=Ri>=0?mr[Ri]:null,Mi=mr.find(e=>e.type===Yn)??null,Ei=mr.find(e=>e.type===Qn)??null,Vi=Pi>=0?Pi:mr.length,Di=[];mr.forEach(e=>{et(e)||(Bi(e)&&Di.push(String(e.props.id)),Di.push(...zi(e,1,Ci)))}),Ai&&(Di.push(String(Ai.props.id)),Di.push(...zi(Ai,1,Ci)));const Fi=Di.length>0&&Di.every(e=>To.has(e)),Li=e=>{const n=vo.blockRowName(e,vr);return vo.rowName?vo.rowName(e,"block",n):n},Gi=(e,n,t,o)=>{const r=Cr(e)[t];if(!r)return;const i={...sn(e),index:t},l={...sn(n),index:Math.min(Math.max(o,0),Cr(n).length)},s=Ye(i,l);if(e!==n||s!==t)try{Sr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof dn))throw e}},Hi=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of ki(e))n.add(r),t(o)};for(const t of yi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Wi=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=zr.get(n);if(!e)return null;if(e.zone===ie)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Ui=e=>{const n=e.slice(0,e.indexOf(":")),t=mr.find(e=>Kn(e.type)&&String(e.props.id)===n);return t&&Zn(n)===e?t:null},Ji=(e,n,t)=>{if(e.rung){const t=Nr(e.rung.nodeId),o=t?$r(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===bn&&n.index>=0&&n.index<=o}if(n.slot===bn)return!1;if(e.add)return Ki(e.add,n);const o=on(n);if(Kn(e.type))return!1;const r=Ui(o),i=Ui(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Cr(o).length);if(e.zone===ie||o===ie){if(e.zone!==o)return!1;const{floor:t,cap:r}=gr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Cr(o).length)return!1;if(e.zone===o)return!0;const l=Ai?String(Ai.props.id):null;return(!l||Wi(e.zone)!==l&&Wi(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Cr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=zr.get(i),s=l?Cr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Hi(r).has(n))return!1;const d=ko(s.type,go(Dn?.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?.(Cr(n),r))})(e.zone,o,e.index,t)},Yi=(e,n)=>{const t=on(e.from);if(t===on(n))return!0;const o=e.node;return Ji({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Qi=e=>{const n=e.slice(0,e.indexOf(":")),t=zr.get(n),o=t?Cr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=ko(o.type,go(Dn?.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:vr(r.spec.childType)}]:[]),l=Ir(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:t.zone===ie?xr(o.type):vr(o.type)}},Ki=(e,n)=>{const t=on(n);if("block"!==e.kind){if(Ui(t))return n.index>=0&&n.index<=Cr(t).length;if(t!==ie)return!1;const{floor:e,cap:o}=gr();return n.index>=e&&n.index<=o}if(t===ie)return!1;const o=Qi(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Cr(t))},Zi=(e,n)=>{e.rung?Rr(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&Ui(on(n)))return void si(e,on(n),n.index);if("section"===e.kind)return void ti(e.type,n.index);if("template"===e.kind)return void oi(e.template.name,i(e.template.node),n.index);const t=on(n),o=Qi(t);o&&(o.target.spec?$i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ii(t,e.type,n.index))})(e.add,n):e.zone===ie?ei(e.index,n.index):Gi(e.zone,on(n),e.index,n.index)},[_i]=pn(()=>Ue()),Xi=Je({keyOf:e=>e.id,readOnly:Boolean(Pn),session:_i,canDrop:Ji,onDrop:Zi,onStep:(e,n)=>{e.rung?Rr(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ie?((e,n)=>{const t=xr(mr[e]?.type??""),o=ei(e,n<0?e-1:e+2);if(!o.moved)return void Qo(`“${t}” is already ${n<0?"first":"last"}`);const{floor:r,cap:i}=gr();Qo(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):Gi(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),qi=fn(e=>{const{floor:n,cap:t}=gr(),o=[];for(const r of e.nodes){const e=on(r.place),i=Cr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(qn(i)||et(i)||ho(i.type))continue;if(Kn(i.type))continue;const l=Boolean(Ui(e)),s=e===ie||l;e===ie&&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?xr(i.type):Er(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(Qi(on(e.list))?.choices.length)||Boolean(Ui(on(e.list))))}},[Dn.data]),el=e=>{Yt(W),at.select(e.zone===ie?{index:e.index}:{index:e.index,zone:e.zone})},nl=ee(),tl=()=>({data:Dn.data,device:St,ops:at,inspector:co}),ol=nl?.model,rl=an(()=>ol?e=>ol(e,qi(e),tl()):qi,[ol,qi,St]),il=nl?.measure,ll=il?(e,n)=>il(e,n,tl()):void 0,sl=nl?.canDrop,dl=sl?(e,n)=>sl(e,n,Ji,tl()):Ji,cl=nl?.drop,al=cl?(e,n)=>cl(e,n,Zi,tl()):Zi,pl=nl?.pick,ul=pl?e=>pl(e,el,tl()):el,fl=(e,n,t,o)=>/* @__PURE__ */gn(Ce,{...Pn?{}:Xi.seam({place:{...sn(e),index:n}}),onAdd:Pn?void 0:t,label:o},`seam:${e}:${n}`),hl={rowClick:di,isCollapsed:Vo,toggleCollapse:Do},ml=e=>{const n=String(e.props.id),t=mr.findIndex(e=>String(e.props.id)===n),o=Zn(n),r=Cr(o),i=Vo(n),l=vr(e.type),s=vo.rowName?vo.rowName(e,"section",l):l,d=e=>fl(o,e,()=>ii(o,e),ot.addSectionHere);/* @__PURE__ */
|
|
15
|
+
return yn(kn,{children:[
|
|
16
|
+
/* @__PURE__ */gn(be,{icon:/* @__PURE__ */gn(xo,{type:e.type,size:13}),name:s,preview:pi(e),marks:ui(e),onSelect:()=>Xr(t),nameSlot:Dr(ie,t,n,s),selected:qt===n,actions:fi(e,ie,t)??void 0,rowProps:{"data-node-id":n,onClick:di(()=>Xr(t))},fold:{open:!i,label:"section",onToggle:()=>Do(n)}}),!i&&/* @__PURE__ */yn(xe,{children:[r.map((n,t)=>{const r=String(n.props.id),i=wr(n),l=Bi(n),s=l&&Vo(r),c=()=>Ni(o,t,r,e.type),{rowProps:a,...p}=Xi.row({item:{id:r,zone:o,index:t,type:n.type},place:{...sn(o),index:t}},{"data-node-id":r,onClick:di(c)});/* @__PURE__ */
|
|
17
|
+
return yn(mn,{children:[d(t),
|
|
18
|
+
/* @__PURE__ */gn(be,{icon:/* @__PURE__ */gn(xo,{type:n.type,size:13}),name:i,preview:pi(n),marks:ui(n),onSelect:c,nameSlot:Dr(o,t,r,i),selected:qt===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Do(r)}:void 0,actions:/* @__PURE__ */yn(kn,{children:[ai(o,t,i),fi(n,o,t),hi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */gn(xe,{children:kl(n,2)})]},r)}),d(r.length)]})]})},gl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Xi.dragging,d=!Vo(l)&&s?.rung?.nodeId!==i,c={...sn(l),index:0},a=s&&!s.rung&&Ji(s,c)?c:void 0,p=()=>Pr(e,n,!0),{rowProps:u,...f}=Xi.row({item:{id:`rung:${l}`,zone:`${i}:${bn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:bn,index:t},into:a,canDrag:Boolean(fo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:di(p)}),h=Pn?null:fo.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
19
|
+
return yn(mn,{children:[n.heading,
|
|
20
|
+
/* @__PURE__ */gn(be,{icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Or===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Do(l)},actions:h&&h.length>0?/* @__PURE__ */gn(kn,{children:h.map((t,o)=>/* @__PURE__ */gn(Be,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Pn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ar(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(en,{size:15}):/* @__PURE__ */gn(tn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */gn(xe,{children:r})]},l)},yl=(e,n)=>{const t=Si(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
21
|
+
return gn(kn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=xi(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=null!==c&&Boolean(Qi(c)?.choices.length),p=(e,n)=>a?fl(e,n,()=>ii(e,n),"Add block here"):fl(e,n),u=/* @__PURE__ */yn(kn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=qt===String(n.props.id),{collapsible:i,folded:s}=wi(n,l,Ci(n.type)),d=String(n.props.id),c=Li(n),a=()=>Ni(t,o,d,e.type),{rowProps:u,...f}=Xi.row({item:{id:d,zone:t,index:o,type:n.type},place:{...sn(t),index:o}},{"data-node-id":d,onClick:di(a)});/* @__PURE__ */
|
|
22
|
+
return yn(mn,{children:[0===o&&p(t,0),
|
|
23
|
+
/* @__PURE__ */gn(be,{icon:/* @__PURE__ */gn(xo,{type:n.type,size:13}),name:c,preview:pi(n),marks:ui(n),onSelect:a,nameSlot:Dr(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Do(d)}:void 0,actions:/* @__PURE__ */yn(kn,{children:[ai(t,o,c),fi(n,t,o),hi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */gn(xe,{children:yl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==c?null:p(c,0)]});return t.rung?gl(e,t.rung,r++,o,u):/* @__PURE__ */gn(mn,{children:u},t.slot??"")})})},kl=(e,n)=>{const t=go(Dn?.data,e.type,String(e.props.id)),o=Si(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
24
|
+
return gn(kn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=xi(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>$i(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>ii(n,t):void 0;return fl(n,t,o,n===f&&c?c.addLabel:"Add block here")},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */yn(kn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=qt===String(n.props.id),i=Er(n),l=String(n.props.id),{collapsible:d,folded:c}=wi(n,s,Ci(n.type)),a=yi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...sn(p),index:Cr(p).length}:void 0,f=Xi.dragging,h=u&&f&&Ji(f,u)?u:void 0,g=()=>Ni(t,o,l,e.type),{rowProps:y,...k}=Xi.row({item:{id:l,zone:t,index:o,type:n.type},place:{...sn(t),index:o},into:h,canDrag:!ho(n.type)},{"data-node-id":l,onClick:di(g)});/* @__PURE__ */
|
|
25
|
+
return yn(mn,{children:[0===o&&m(t,0),
|
|
26
|
+
/* @__PURE__ */gn(be,{icon:/* @__PURE__ */gn(xo,{type:n.type,size:13}),name:i,preview:pi(n),marks:ui(n),onSelect:g,nameSlot:Dr(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Do(l)}:void 0,actions:ho(n.type)?fi(n,t,o)??void 0:/* @__PURE__ */yn(kn,{children:[ai(t,o,i),fi(n,t,o),hi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */gn(xe,{children:kl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
27
|
+
/* @__PURE__ */gn(I,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>$i(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?gl(e,o.rung,i++,r,k):/* @__PURE__ */gn(mn,{children:k},o.slot??"")})})},Sl=(()=>{if(!Gn||!Qt)return null;const e=String(Gn.type),n=String(Gn.props.id),t=ko(e,go(Dn?.data,e,n));if(!t||"footer"===t.source)return null;const o=mr.some(e=>String(e.props?.id)===n),r=Array.isArray(Gn.props[t.slot])?Gn.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:vr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:o?xr(e):vr(e),choices:i,onPick:o=>{t.spec?$i(n,t.slot,o,r.length,e):Ii(`${n}:${t.slot}`,o,r.length)}}})(),vl=_t&&_t.zone!==ie&&!Ui(_t.zone)?_t.zone:null,bl=!0===Gt.blocksFirst,xl=vl?Qi(vl):bl&&_t?null:Sl,wl=Boolean(Ft&&vl)||bl&&Boolean(xl&&xl.choices.length>0),zl=Mt||null!==wt,Bl=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:ut&&!zl&&uo===e.id,onSelect:()=>pr(e.id)}:e,Cl=[{id:"add",label:ot.add.title,icon:/* @__PURE__ */gn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:Mt,onSelect:()=>Mt?li():ri(null)},...(ao.railLead??[]).map(Bl),{id:"sections",label:"Layers",icon:/* @__PURE__ */gn(_e,{}),active:ut&&!zl&&"sections"===uo,onSelect:()=>pr("sections")},...(ao.railTrail??[]).map(Bl)];xt?Cl.push({id:"media",label:"Media library",icon:/* @__PURE__ */gn(nn,{}),active:ut&&!Mt&&(null!==wt||"media"===uo),onSelect:()=>pr("media")}):Mn&&Cl.push({id:"media",label:"Media library",icon:/* @__PURE__ */gn(nn,{}),onSelect:ur});const Nl=[...ao.railLead??[],...ao.railTrail??[]].find(e=>"panel"in e&&e.id===uo),$l=Boolean(tt?.foldable)&&!po,Il=tt?.label??(En?ot.pageSections:ot.templateSections),Ol=$l&&Vo(xn),Tl=/* @__PURE__ */yn(kn,{children:[mr.map((e,n)=>{if(qn(e)||et(e)||Kn(e.type))return null;const t=qt===String(e.props.id),o=Boolean(e.props._hidden);ki(e);const r=String(e.props.id),i=ao.hasOwnRows?.(e)??!1,l=Bi(e)||i,s=l&&Vo(r),{rowProps:d,...c}=Xi.row({item:{id:r,zone:ie,index:n,type:e.type},place:{...sn(ie),index:n}},{"data-node-id":r,onClick:di(()=>Xr(n))});/* @__PURE__ */
|
|
28
|
+
return yn(mn,{children:[n>0&&mi(n),
|
|
29
|
+
/* @__PURE__ */gn(be,{icon:/* @__PURE__ */gn(xo,{type:e.type,size:13}),name:wr(e),preview:pi(e),marks:ui(e),onSelect:()=>Xr(n),nameSlot:Dr(ie,n,r,wr(e)),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>Do(r)}:void 0,actions:/* @__PURE__ */yn(kn,{children:[ai(ie,n,wr(e)),fi(e,ie,n),hi(ie,n,e,wr(e))]}),rowProps:d}),Bi(e)&&!s&&/* @__PURE__ */yn(xe,{children:[kl(e,1),ao.partRows?.(e,hl)]}),i&&!s&&/* @__PURE__ */gn(xe,{children:ao.ownRows?.(e,n,hl)})]},String(e.props.id??n))}),!po&&Vi>0&&mi(Vi),tt?.addAtEnd&&!po&&!Pn&&/* @__PURE__ */gn(I,{small:!0,label:ot.addSection,blocked:null,onAdd:()=>ri(Vi)})]}),Pl=(e,n,t)=>{const o=String(e.props.id),r=vi(e).length>0||bi(e)||Boolean(ko(e.type)),i=r&&Vo(o),l="header"===t?ot.header:ot.footer,s=vo.rowName?vo.rowName(e,"section",l):l;/* @__PURE__ */
|
|
30
|
+
return yn(kn,{children:[
|
|
31
|
+
/* @__PURE__ */gn(be,{icon:/* @__PURE__ */gn(xo,{type:t,size:13}),name:s,preview:pi(e),marks:ui(e),onSelect:()=>Xr(n),nameSlot:Dr(ie,n,o,s),selected:qt===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Do(o)}:void 0,actions:fi(e,ie,n)??void 0,rowProps:{onClick:di(()=>Xr(n))}}),r&&!i&&/* @__PURE__ */gn(xe,{children:yl(e,1)})]})};return(ao.wrap??(e=>e))(
|
|
32
|
+
/* @__PURE__ */gn(ne,{target:Rt,children:/* @__PURE__ */yn("div",{ref:At,className:"sf-editor es-editor",style:Fe(Ao),onContextMenu:Ur.onEditorContextMenu,children:[
|
|
33
|
+
/* @__PURE__ */yn(Oe,{children:[
|
|
34
|
+
/* @__PURE__ */gn(Te,{items:Cl,ariaLabel:"Left panel views"}),
|
|
35
|
+
/* @__PURE__ */yn(Pe,{children:[
|
|
36
|
+
/* @__PURE__ */gn(Ae,{label:"Undo",disabled:!Ln.hasPast,onClick:()=>Ln.back(),children:/* @__PURE__ */gn(Xe,{})}),
|
|
37
|
+
/* @__PURE__ */gn(Ae,{label:"Redo",disabled:!Ln.hasFuture,onClick:()=>Ln.forward(),children:/* @__PURE__ */gn(qe,{})}),
|
|
38
|
+
/* @__PURE__ */gn(Re,{}),
|
|
39
|
+
/* @__PURE__ */gn(je,{devices:ht,value:St,onChange:vt})]}),
|
|
40
|
+
/* @__PURE__ */yn(Pe,{kind:"right",style:{minWidth:300},children:[
|
|
41
|
+
/* @__PURE__ */gn(Sn,{saveState:$n,notSaving:Boolean(Pn)||null!=In,readOnlyReason:An,toggle:Rn,onToggle:Tn,onRetry:On}),ao.barLead?.(),
|
|
42
|
+
/* @__PURE__ */gn("button",{type:"button",className:"es-btn-ghost",title:"Refresh the preview (reloads the canvas, keeps your place)",onClick:()=>{Pt.current=(()=>{const e=Rt?.document;if(!e)return null;const n=mr.findIndex(et),t=n>=0?n:mr.length;let o=null;for(let n=0;n<t;n++){const t=mr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Gn?.props?.id??mr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Tt(e=>e+1)},children:"Refresh"}),ao.barTrail?.(),ao.barMain?ao.barMain():/* @__PURE__ */gn("button",{type:"button",className:"es-btn-primary",disabled:null!==An,onClick:()=>{Nn(Dn.data)},children:ot.done})]})]}),
|
|
43
|
+
/* @__PURE__ */gn(z,{}),
|
|
44
|
+
/* @__PURE__ */yn("div",{className:"sf-body",children:[ut?/* @__PURE__ */yn(kn,{children:[
|
|
45
|
+
/* @__PURE__ */gn("div",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:Mt?/* @__PURE__ */gn(O,{blocks:xl,blocksOnly:wl,at:Ft?{label:(e=>{const n=Ui(e.zone);if(n)return ot.add.addingTo({name:vr(n.type)});if(e.zone===ie){const n=mr[e.index];return n&&!et(n)?ot.add.addingBefore({name:xr(n.type)}):ot.add.addingAtEnd}const t=Qi(e.zone);return t?ot.add.addingTo({name:t.parentName}):ot.add.addingHere})(Ft),onClear:()=>Lt(null)}:void 0,onAdd:e=>{const n=_t,t=(e,n)=>{Ft&&Lt({zone:e,index:n})};if(n&&"block"!==e.kind&&Ui(n.zone))return si(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===Xt)return void ti(e);const n=ti(e,Xt);Ft&&Ht(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===Xt)return void oi(e,n);const t=oi(e,n,Xt);Ft&&Ht(t+1)})(e.template.name,i(e.template.node));if(n&&n.zone!==ie){const o=Qi(n.zone);if(!o)return;return o.target.spec?$i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ii(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Sl?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:_i,siteWide:ao.addPanelRow?.(li),onClose:li,onHide:cr,readOnly:Boolean(Pn)}):wt&&bt?
|
|
46
|
+
/* @__PURE__ */gn(A,{panel:bt,pick:wt,onHide:cr}):Nl?Nl.panel({onHide:cr,notify:Qo}):"media"===uo&&bt?/* @__PURE__ */gn(A,{panel:bt,pick:null,onHide:cr}):/* @__PURE__ */yn(kn,{children:[
|
|
47
|
+
/* @__PURE__ */gn(T,{icon:/* @__PURE__ */gn(_e,{}),title:"Layers",context:rt,actions:Di.length>0?/* @__PURE__ */gn(Me,{label:Fi?"Expand all sections":"Collapse all sections",onClick:()=>Po(e=>{const n=new Set(Di);return Fi?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Di])}),children:/* @__PURE__ */gn(vn,{expand:Fi})}):void 0,onHide:cr}),
|
|
48
|
+
/* @__PURE__ */yn(we,{className:"sf-tree sf-scroll",children:[
|
|
49
|
+
/* @__PURE__ */gn(be,{icon:/* @__PURE__ */gn(xo,{type:"page",size:13}),name:ot.pageSettings,onSelect:fr,selected:!Gn&&Qt,rowProps:{onClick:di(fr)}}),Mi&&/* @__PURE__ */yn(kn,{children:[
|
|
50
|
+
/* @__PURE__ */gn(ze,{children:ot.header}),ml(Mi)]}),!po&&Vn&&/* @__PURE__ */yn(kn,{children:[
|
|
51
|
+
/* @__PURE__ */gn(ze,{children:ot.header}),!nt&&/* @__PURE__ */gn(be,{icon:/* @__PURE__ */gn(xo,{type:"header",size:13}),name:ot.header,onSelect:hr,selected:Jt.kind===Xn?.kind,rowProps:{onClick:di(hr)}})]}),!po&&ji&&Pl(ji,Ri,"header"),!po&&!$l&&/* @__PURE__ */gn(ze,{children:Il}),$l?/* @__PURE__ */yn(kn,{children:[
|
|
52
|
+
/* @__PURE__ */gn(be,{icon:null,name:Il,fold:{open:!Ol,label:Il,onToggle:()=>Do(xn)}}),!Ol&&/* @__PURE__ */gn(xe,{children:Tl})]}):Tl,Vn&&/* @__PURE__ */gn(ze,{children:ot.footer}),Ai&&Pl(Ai,Pi,"footer"),!po&&!Ai&&Vn&&/* @__PURE__ */gn(be,{icon:/* @__PURE__ */gn(xo,{type:"footer",size:13}),name:ot.footer,onSelect:ci,rowProps:{onClick:di(ci),title:"Edit the site footer"}}),Ei&&ml(Ei),ao.treeFoot?.()]})]})}),
|
|
53
|
+
/* @__PURE__ */gn(Ee,{side:"left",width:Ao.left,min:De,max:Ve,defaultWidth:y.left,label:"Resize Sections panel",onResize:Mo})]}):/* @__PURE__ */gn(P,{side:"left",onShow:cr}),
|
|
54
|
+
/* @__PURE__ */yn("div",{ref:Ko,className:"sf-center sf-scroll","data-sf-canvas-head":er?"":void 0,style:{overflowX:lr?"auto":"hidden",overflowY:"hidden"},children:[er&&/* @__PURE__ */gn("div",{ref:nr,className:"sf-canvas-head",children:/* @__PURE__ */gn(er,{device:St})}),
|
|
55
|
+
/* @__PURE__ */gn("div",{className:"sf-frame-scaler",style:sr,children:/* @__PURE__ */gn("div",{className:"sf-frame "+(St===yt?"":`sf-frame--${St}`),style:dr,children:/* @__PURE__ */yn("div",{className:"sf-preview-host",children:[
|
|
56
|
+
/* @__PURE__ */gn(it,{},Ot),
|
|
57
|
+
/* @__PURE__ */gn(We,{canvas:Rt,session:_i,model:rl,measure:ll,canDrop:dl,onDrop:al,onPick:ul,onZoneAdd:e=>ii(on(e),0),readOnly:Boolean(Pn),revision:Dn.data}),Wt.length>0&&/* @__PURE__ */gn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:Wt.map(e=>/* @__PURE__ */yn("button",{type:"button",tabIndex:-1,className:"sf-preview-gap",style:{top:e.top},title:"Add section here",onClick:()=>ri(e.index),children:[
|
|
58
|
+
/* @__PURE__ */gn("span",{className:"sf-preview-gap-line"}),
|
|
59
|
+
/* @__PURE__ */yn("span",{className:"sf-preview-gap-pill",children:[
|
|
60
|
+
/* @__PURE__ */gn("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
61
|
+
/* @__PURE__ */gn("span",{className:"sf-preview-gap-label",children:"Add section"})]})]},e.index))})]})})})]}),ft?/* @__PURE__ */yn(kn,{children:[
|
|
62
|
+
/* @__PURE__ */gn(m,{value:{selectChild:Ni,addChild:$i,childRowName:Er,blockRowName:Li},children:/* @__PURE__ */gn(lt,{mode:Jt,onOpenWebsiteSettings:ao.openSettings??(()=>{}),onOpenSiteStyles:ao.openStyles,onSelectNode:Co,onNotify:Qo,onHidePanel:ar,nodeActions:Gn?le(Wn,Gn.type):wn})}),
|
|
63
|
+
/* @__PURE__ */gn(Ee,{side:"right",width:Ao.right,min:De,max:Ve,defaultWidth:y.right,label:"Resize settings panel",onResize:Eo})]}):
|
|
64
|
+
/* @__PURE__ */gn(P,{side:"right",onShow:ar})]}),Ho&&/* @__PURE__ */yn("div",{className:"sf-toast "+("error"===Ho.tone?"sf-toast--error":""),role:"status",children:[
|
|
65
|
+
/* @__PURE__ */gn("span",{className:"sf-toast-check","aria-hidden":"true",children:"error"===Ho.tone?"!":"✓"}),Ho.msg]},Uo),Ur.menu]})}))}export{zn as ScreenChrome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-VSHV6KJQ.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-P67FP7PG.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,m=!0===(i.resolveOnInsert??a);return s(()=>{const e=(e,n,o)=>{const r=t(n);return c||p({type:"insert",componentType:n,destinationZone:e,destinationIndex:o,id:r}),r},o=e=>(m&&!c&&d.resolveNode(e,{trigger:"insert"}),e),r=(e,t,n)=>{c||p({type:"replace",destinationZone:e,destinationIndex:t,data:n})},s=(t,n,r)=>o(e(t,n,r));return{insertComponent:s,insertSection:(e,t)=>s(n,e,t),replaceComponent:r,seedChild:(t,n,s,i)=>{const p=e(t,s,n);r(t,n,{type:s,props:{id:p,...i}}),o(p)},insertNode:(t,n,s)=>{const i=e(t,s.type,n);return r(t,n,{type:s.type,props:{...s.props,id:i}}),o(i)},removeComponent:(e,t)=>{c||p({type:"remove",index:t,zone:e})},reorderComponent:(e,t,n)=>{c||p({type:"reorder",sourceIndex:t,destinationIndex:n,destinationZone:e})},duplicateComponent:(e,t)=>{c||p({type:"duplicate",sourceIndex:t,sourceZone:e})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:e=>{c||p({type:"setData",data:e})},commitDocument:e=>{c||
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-VSHV6KJQ.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-P67FP7PG.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,m=!0===(i.resolveOnInsert??a);return s(()=>{const e=(e,n,o)=>{const r=t(n);return c||p({type:"insert",componentType:n,destinationZone:e,destinationIndex:o,id:r}),r},o=e=>(m&&!c&&d.resolveNode(e,{trigger:"insert"}),e),r=(e,t,n)=>{c||p({type:"replace",destinationZone:e,destinationIndex:t,data:n})},s=(t,n,r)=>o(e(t,n,r));return{insertComponent:s,insertSection:(e,t)=>s(n,e,t),replaceComponent:r,seedChild:(t,n,s,i)=>{const p=e(t,s,n);r(t,n,{type:s,props:{id:p,...i}}),o(p)},insertNode:(t,n,s)=>{const i=e(t,s.type,n);return r(t,n,{type:s.type,props:{...s.props,id:i}}),o(i)},removeComponent:(e,t)=>{c||p({type:"remove",index:t,zone:e})},reorderComponent:(e,t,n)=>{c||p({type:"reorder",sourceIndex:t,destinationIndex:n,destinationZone:e})},duplicateComponent:(e,t)=>{c||p({type:"duplicate",sourceIndex:t,sourceZone:e})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:e=>{c||p({type:"setData",data:e})},commitDocument:(e,t)=>{c||d.run({data:e,select:t})}}},[p,c,m,d])}export{i as useSectionOps};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{clientOnly as e}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-SARZN4M7.js";import{ScreenChrome as r}from"./chunk-
|
|
1
|
+
import{clientOnly as e}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-SARZN4M7.js";import{ScreenChrome as r}from"./chunk-HLEET6NV.js";import{ScreenDocumentProvider as t,useScreenDocument as a}from"./chunk-7V5WZ46F.js";import{DEFAULT_SCREEN_WORDS as i}from"./chunk-PQXIFBDY.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{useMemo as d}from"react";import{jsx as c,jsxs as l,Fragment as m}from"react/jsx-runtime";var g=e(n),h=e(r);function p({saving:e,onCancel:n,onDiscard:r,onSave:t}){/* @__PURE__ */
|
|
2
2
|
return c("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/30 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"sf-leave-title",children:/* @__PURE__ */l("div",{className:"w-full max-w-sm rounded-lg bg-white p-5 shadow-xl",children:[
|
|
3
3
|
/* @__PURE__ */c("h2",{id:"sf-leave-title",className:"text-[15px] font-semibold text-zinc-900",children:"Unsaved changes"}),
|
|
4
4
|
/* @__PURE__ */c("p",{className:"mt-2 text-[13px] leading-relaxed text-zinc-600",children:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them."}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ScreenChrome as default}from"../../chunk-
|
|
1
|
+
export{ScreenChrome as default}from"../../chunk-HLEET6NV.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-SQTY6CJD.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-IE4GFYKO.js";import"../../chunk-PWZOS45R.js";import"../../chunk-7F52SZOI.js";import"../../chunk-R2HLPNQF.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-VSOP4GUM.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-5MZ3RNQQ.js";import"../../chunk-ZTTWFAAC.js";import"../../chunk-FMGFZNPW.js";import"../../chunk-NWIW7AWH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-7FBDZTUD.js";import"../../chunk-V4LF7D4F.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-7V5WZ46F.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-3P6AMTOS.js";import"../../chunk-3WSPDAK2.js";import"../../chunk-57DJOKXT.js";import"../../chunk-3QVB4AG2.js";import"../../chunk-N7VRF7PR.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-5ZBBXZPV.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-NYKIQJT2.js";import"../../chunk-VSHV6KJQ.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-PQXIFBDY.js";import"../../chunk-P67FP7PG.js";import"../../chunk-AELNNAFM.js";import"../../chunk-BXZ6WLHC.js";import"../../chunk-EOJNJCMJ.js";import"../../chunk-ZFDCDJNZ.js";import"../../chunk-ZNS7727Y.js";import"../../chunk-3EDSDPIP.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-RW4XBUUW.js";import"../../chunk-KTVH2ZRL.js";import"../../chunk-2LK54I4E.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-OWBO4WKA.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-YC4TB3CJ.js";import"../../chunk-ZJEBF4NB.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-WZ7TGAAT.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-EWVJSRRY.js";import"../../chunk-P6O363EE.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-BZ5ASXOL.js";import"../../chunk-TTJ54QGG.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-L5KW4HG5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DocumentScreen,ScreenMount as default}from"../../chunk-
|
|
1
|
+
export{DocumentScreen,ScreenMount as default}from"../../chunk-Q4N7C6CT.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-SARZN4M7.js";import"../../chunk-HLEET6NV.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-SQTY6CJD.js";import"../../chunk-FGNR22NY.js";import"../../chunk-ZE7I3PLX.js";import"../../chunk-IE4GFYKO.js";import"../../chunk-PWZOS45R.js";import"../../chunk-7F52SZOI.js";import"../../chunk-R2HLPNQF.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-VSOP4GUM.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-5MZ3RNQQ.js";import"../../chunk-ZTTWFAAC.js";import"../../chunk-FMGFZNPW.js";import"../../chunk-NWIW7AWH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-7FBDZTUD.js";import"../../chunk-V4LF7D4F.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-7V5WZ46F.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-3P6AMTOS.js";import"../../chunk-3WSPDAK2.js";import"../../chunk-57DJOKXT.js";import"../../chunk-3QVB4AG2.js";import"../../chunk-N7VRF7PR.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-5ZBBXZPV.js";import"../../chunk-KQMML6JM.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-NYKIQJT2.js";import"../../chunk-VSHV6KJQ.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-PQXIFBDY.js";import"../../chunk-P67FP7PG.js";import"../../chunk-AELNNAFM.js";import"../../chunk-BXZ6WLHC.js";import"../../chunk-EOJNJCMJ.js";import"../../chunk-ZFDCDJNZ.js";import"../../chunk-ZNS7727Y.js";import"../../chunk-3EDSDPIP.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-RW4XBUUW.js";import"../../chunk-KTVH2ZRL.js";import"../../chunk-2LK54I4E.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-OWBO4WKA.js";import"../../chunk-BDTITTMW.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-YC4TB3CJ.js";import"../../chunk-ZJEBF4NB.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-WZ7TGAAT.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-EWVJSRRY.js";import"../../chunk-P6O363EE.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-BZ5ASXOL.js";import"../../chunk-TTJ54QGG.js";import"../../chunk-O2NLQBFX.js";import"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-L5KW4HG5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{AddBlockRow as e}from"../../chunk-QH6LCNOX.js";import{slotChildRowName as n}from"../../chunk-TBF5CVPA.js";import{scrollPreviewToSection as o,gotoPreviewSlide as r}from"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import{useEaselUndoKeys as t}from"../../chunk-VSOP4GUM.js";import{SlotChildActionsProvider as s}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as i}from"../../chunk-ZTTWFAAC.js";import{usePartBridge as c}from"../../chunk-
|
|
2
|
-
return
|
|
3
|
-
return
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
return
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
/* @__PURE__ */
|
|
8
|
-
/* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
return
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
1
|
+
import{AddBlockRow as e}from"../../chunk-QH6LCNOX.js";import{slotChildRowName as n}from"../../chunk-TBF5CVPA.js";import{scrollPreviewToSection as o,gotoPreviewSlide as r}from"../../chunk-4ES5JGGX.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import{useEaselUndoKeys as t}from"../../chunk-VSOP4GUM.js";import{SlotChildActionsProvider as s}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as i}from"../../chunk-ZTTWFAAC.js";import{usePartBridge as c}from"../../chunk-FMGFZNPW.js";import{useSectionOps as p}from"../../chunk-NWIW7AWH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import{useScreenDocument as l}from"../../chunk-7V5WZ46F.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-ERR437B5.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-3P6AMTOS.js";import"../../chunk-3WSPDAK2.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-HQ4VVRIC.js";import{MediaSidePanel as d}from"../../chunk-NYKIQJT2.js";import{SELECTION_MODE as m,useScreenPinned as a,useScreenCanvasFrame as u,useScreenInspectorPanel as h,useScreenPickFollowsSelection as k,sameInspectorMode as j,useStandaloneScreenBridges as f,useScreenBlockLook as N,useScreenBlockRules as S}from"../../chunk-VSHV6KJQ.js";import{nestsInTree as y,slotFieldsOf as C}from"../../chunk-PLVEGYK6.js";import{useMediaPanel as A,usePanelPick as P,useCancelPanelPick as x}from"../../chunk-R6WTQWAC.js";import{useHostEscape as O}from"../../chunk-U3JP4VGF.js";import"../../chunk-PQXIFBDY.js";import{useEasel as T}from"../../chunk-P67FP7PG.js";import"../../chunk-AELNNAFM.js";import"../../chunk-BXZ6WLHC.js";import"../../chunk-EOJNJCMJ.js";import{LayersTree as W,Subtree as R,TreeRow as g,TreeRowAction as v,TreeSeam as E}from"../../chunk-ZFDCDJNZ.js";import"../../chunk-ZNS7727Y.js";import"../../chunk-3EDSDPIP.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-KTVH2ZRL.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-BDTITTMW.js";import{saveIndicator as B}from"../../chunk-H6DDIBQ4.js";import{SaveState as z,panelWidthVars as J}from"../../chunk-YC4TB3CJ.js";import"../../chunk-ZJEBF4NB.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-WZ7TGAAT.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-EWVJSRRY.js";import"../../chunk-P6O363EE.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-BZ5ASXOL.js";import"../../chunk-TTJ54QGG.js";import"../../chunk-O2NLQBFX.js";import{useTreeDrag as L}from"../../chunk-67GNT6PF.js";import"../../chunk-PAELDYYS.js";import"../../chunk-ZNCEOSXO.js";import{TrashIcon as D}from"../../chunk-L5KW4HG5.js";import{zoneKey as F,parseZoneKey as Z}from"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import{useState as b,useRef as H,useEffect as M,useCallback as w,Fragment as G}from"react";import{jsxs as K,jsx as V,Fragment as Y}from"react/jsx-runtime";var I=e=>n=>{n.target.closest(".es-tree-select, button")||e()},Q={rowClick:I};function $(){const{saveState:$,readOnly:X,readOnlyReason:U=null}=l(),q=p(),{appState:_,selectedItem:ee,config:ne}=T(e=>e),[oe,re]=b(m),[te,se]=b(null),{first:ie,last:ce,panelOf:pe}=a(),le=pe(ie),de=u(),me=h(),ae=_.data.content?.[0]??null,ue=ae?.props.id??null,he=ae?.type===ie,ke=ae?.type===ce,je=H(null),fe=H(null);t(fe);const Ne=A(),Se=P(),ye=x();k(ee?.props.id),M(()=>{const e=fe.current;if(!Se||!e)return;const n=e=>{"Escape"===e.key&&ye()};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[Se]),O(null!==Se,()=>ye()),M(()=>{ue&&je.current!==ue&&(je.current=ue,he?re(le??m):ee||q.select({index:0}))},[ue,ee,q,he]);const Ce=w(e=>re(n=>j(n,e)?n:e),[]),Ae=f({kind:oe.kind,mode:oe,open:Ce,show:e=>re(e),reveal:()=>{},select:(e,n)=>{re(e=>j(e,n)?e:n),q.select(e)}}),{selectNode:Pe}=c({mode:oe,setMode:re,onOpenPart:o}),xe=N(),{labelAtLevel:Oe,Icon:Te}=xe,{canAddTo:We}=S(),Re=e=>ne.components[e]?.label??e,ge=e=>Oe(e,"section",Re(e)),ve=!he&&"puck"===oe.kind&&ee?.props.id===ue,Ee=ae?We(ae.type)?.spec??null:null,Be=ae&&Ee?`${ae.props.id}:${Ee.slot}`:null,ze=ae&&Ee&&Array.isArray(ae.props[Ee.slot])?ae.props[Ee.slot]:[],Je=e=>n(e,Re,xe.plainText),Le=(e,n)=>{ae&&Ee&&Be&&(re(m),Ee.slider?(r(String(ae.props.id),e),q.select({index:e,zone:Be}),o(String(ae.props.id))):(q.select({index:e,zone:Be}),o(n)))},De=()=>{if(!ae||!Ee||!Be)return;const e=ze.length;q.insertComponent(Be,Ee.childType,e),re(m),Ee.slider?requestAnimationFrame(()=>{r(String(ae.props.id),e),q.select({index:e,zone:Be})}):q.select({index:e,zone:Be})},Fe=e=>C(ne,e),Ze=e=>{const{parentId:n,slot:o}=Z(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of Fe(e.type)){const o=Array.isArray(e.props[n])?e.props[n]:[];for(const e of o){const n=r(e);if(n)return n}}return null},t=r(ae)?.props[o];return Array.isArray(t)?t.length:0},be=(e,n,o)=>{const r=Math.min(Math.max(o,0),Ze(e)),t=n<r?r-1:r;t!==n&&(q.reorderComponent(e,n,t),re(m),q.select({index:t,zone:e}))},He=L({keyOf:e=>e.id,readOnly:Boolean(X),canDrop:(e,n)=>F(n)===e.zone&&n.index>=0&&n.index<=Ze(e.zone),onDrop:(e,n)=>be(e.zone,e.index,n.index),onStep:(e,n)=>be(e.zone,e.index,n<0?e.index-1:e.index+2)}),Me=(e,n)=>/* @__PURE__ */V(E,{...X?{}:He.seam({place:{...Z(e),index:n}})},`seam:${e}:${n}`),we=e=>xe.blockRowName(e,Re),Ge=(e,n,r)=>{re(m),q.select({index:n,zone:e}),o(r)},Ke=(e,n,o)=>{q.insertComponent(e,n,o),re(m),q.select({index:o,zone:e}),se(null)},Ve=(n,o,r)=>/* @__PURE__ */V(e,{choices:r,open:te===n,onToggle:()=>se(te===n?null:n),onPick:e=>Ke(n,e,o)}),Ye=(e,n)=>{const o=Fe((r=e).type).flatMap(e=>(Array.isArray(r.props[e])?r.props[e]:[]).map((n,o)=>({child:n,zone:`${r.props.id}:${e}`,index:o})));var r;const t=We(e.type),s=t?.choices??null,i="footer"===t?.source?we:Je;/* @__PURE__ */
|
|
2
|
+
return K(Y,{children:[o.map(({child:e,zone:o,index:r})=>{const t=ee?.props.id===e.props.id,s=y(ne,e.type,n),c=i(e),p=String(e.props.id),l=()=>Ge(o,r,p),{rowProps:d,...a}=He.row({item:{id:p,zone:o,index:r},place:{...Z(o),index:r}},{onClick:I(l)});/* @__PURE__ */
|
|
3
|
+
return K(G,{children:[0===r&&Me(o,0),
|
|
4
|
+
/* @__PURE__ */V(g,{icon:/* @__PURE__ */V(Te,{type:e.type,size:13}),name:c,selected:t,onSelect:l,...a,actions:/* @__PURE__ */V(v,{kind:"delete",label:`Delete ${c}`,onClick:()=>{return e=o,n=r,q.removeComponent(e,n),re(m),void q.select(null);var e,n},children:/* @__PURE__ */V(D,{size:13})}),rowProps:d}),s&&/* @__PURE__ */V(R,{children:Ye(e,n+1)}),Me(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?Ve(`${e.props.id}:${t.slot}`,o.length,s):null]})},Ie="HeroSingle"===ae?.type,Qe=Boolean(ae)&&(Boolean(Ee)||ke||he||Ie);/* @__PURE__ */
|
|
5
|
+
return K("div",{ref:fe,className:"sf-editor es-editor",style:J(i),children:[
|
|
6
|
+
/* @__PURE__ */V("div",{className:"sf-section-bar",children:/* @__PURE__ */V(z,null!==U?{tone:"off",label:U,role:"status"}:{...B($),role:"status"})}),
|
|
7
|
+
/* @__PURE__ */K("div",{className:"sf-body",children:[Se&&Ne?/* @__PURE__ */V("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:/* @__PURE__ */V(d,{panel:Ne,pick:Se})}):Qe&&ae&&/* @__PURE__ */K("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:[
|
|
8
|
+
/* @__PURE__ */V("div",{className:"sf-panel-head",children:/* @__PURE__ */V("button",{type:"button",className:"sf-panel-title sf-panel-title--btn "+(ve?"is-selected":""),"aria-pressed":ve,title:he?"Header settings":`${ge(ae.type)} settings`,onClick:()=>{he?re(le??m):(re(m),q.select({index:0}))},children:ge(ae.type)})}),
|
|
9
|
+
/* @__PURE__ */V(W,{className:"sf-tree sf-scroll",rootProps:He.rootProps(),children:/* @__PURE__ */V(R,{children:he?
|
|
10
|
+
/* @__PURE__ */V(g,{icon:/* @__PURE__ */V(Te,{type:"header",size:13}),name:"Header settings",selected:oe.kind===le?.kind,onSelect:()=>re(le??m),rowProps:{onClick:I(()=>re(le??m))}}):Ee?/* @__PURE__ */K(Y,{children:[ze.map((e,n)=>{const o=ee?.props.id===e.props.id,r=Je(e),t=String(e.props.id),s=()=>Le(n,t),{rowProps:i,...c}=He.row({item:{id:t,zone:Be,index:n},place:{...Z(Be),index:n}},{onClick:I(s)});/* @__PURE__ */
|
|
11
|
+
return K(G,{children:[0===n&&Me(Be,0),
|
|
12
|
+
/* @__PURE__ */V(g,{icon:/* @__PURE__ */V(Te,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */V(v,{kind:"delete",label:`Delete ${r}`,onClick:()=>{return e=n,void(Be&&(q.removeComponent(Be,e),re(m),q.select(null)));var e},children:/* @__PURE__ */V(D,{size:13})}),rowProps:i}),Me(Be,n+1)]},String(e.props.id??n))}),
|
|
13
|
+
/* @__PURE__ */K("button",{type:"button",className:"sf-add-card",onClick:De,children:[
|
|
14
|
+
/* @__PURE__ */V("span",{className:"sf-plus sf-plus--sm",children:"+"}),Ee.addLabel]}),ue?Ae.partRows?.(ae,Q):null]}):Ye(ae,1)})})]}),
|
|
15
|
+
/* @__PURE__ */V("div",{className:"sf-center",children:/* @__PURE__ */V("div",{className:"sf-preview-host",children:/* @__PURE__ */V(de,{})})}),
|
|
16
|
+
/* @__PURE__ */V(s,{value:{selectChild:(e,n,o,r)=>"section"===We(r)?.source?Le(n,o):Ge(e,n,o),addChild:(e,n,o,r,t)=>"section"===We(t)?.source?De():Ke(`${e}:${n}`,o,r),childRowName:Je,blockRowName:we},children:/* @__PURE__ */V(me,{mode:oe,onOpenWebsiteSettings:Ae.openSettings??(()=>{}),onSelectNode:Pe,hideNodeActions:!0})})]})]})}export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{usePartBridge}from"../../chunk-
|
|
1
|
+
export{usePartBridge}from"../../chunk-FMGFZNPW.js";import"../../chunk-NWIW7AWH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-VSHV6KJQ.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-P67FP7PG.js";import"../../chunk-AELNNAFM.js";import"../../chunk-BXZ6WLHC.js";import"../../chunk-EOJNJCMJ.js";import"../../chunk-ZFDCDJNZ.js";import"../../chunk-ZNS7727Y.js";import"../../chunk-3EDSDPIP.js";import"../../chunk-QTLAVDJE.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-KTVH2ZRL.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-EWVJSRRY.js";import"../../chunk-P6O363EE.js";import"../../chunk-FPOKPNO4.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-BZ5ASXOL.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-L5KW4HG5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
package/dist/screen/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-
|
|
1
|
+
import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-Q4N7C6CT.js";import"../chunk-GXQCZJOP.js";export{ScreenStoreProvider}from"../chunk-SARZN4M7.js";import"../chunk-HLEET6NV.js";import"../chunk-26OOWIJJ.js";import"../chunk-SQTY6CJD.js";import"../chunk-FGNR22NY.js";import"../chunk-ZE7I3PLX.js";import"../chunk-IE4GFYKO.js";import"../chunk-PWZOS45R.js";import"../chunk-7F52SZOI.js";import"../chunk-R2HLPNQF.js";import"../chunk-TBF5CVPA.js";import"../chunk-4ES5JGGX.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-VSOP4GUM.js";import"../chunk-KCBEE2MC.js";import"../chunk-5MZ3RNQQ.js";import"../chunk-ZTTWFAAC.js";import"../chunk-FMGFZNPW.js";import"../chunk-NWIW7AWH.js";import"../chunk-IYT6NN2J.js";import"../chunk-7FBDZTUD.js";import"../chunk-V4LF7D4F.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-7V5WZ46F.js";import"../chunk-S4AWJX4Q.js";import"../chunk-ERR437B5.js";import"../chunk-KG7RJWOK.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-3P6AMTOS.js";import"../chunk-3WSPDAK2.js";import"../chunk-57DJOKXT.js";import"../chunk-3QVB4AG2.js";import"../chunk-N7VRF7PR.js";import"../chunk-5ZBY24K7.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-5ZBBXZPV.js";import"../chunk-KQMML6JM.js";import"../chunk-KCOBHPN6.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";import"../chunk-HQ4VVRIC.js";import"../chunk-NYKIQJT2.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-VSHV6KJQ.js";import"../chunk-PLVEGYK6.js";import"../chunk-R6WTQWAC.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-6WY6ZXJG.js";import"../chunk-PQXIFBDY.js";import"../chunk-P67FP7PG.js";import"../chunk-AELNNAFM.js";import"../chunk-BXZ6WLHC.js";import"../chunk-EOJNJCMJ.js";import"../chunk-ZFDCDJNZ.js";import"../chunk-ZNS7727Y.js";import"../chunk-3EDSDPIP.js";import"../chunk-QTLAVDJE.js";import"../chunk-YRLPFZW3.js";import"../chunk-RW4XBUUW.js";import"../chunk-KTVH2ZRL.js";import"../chunk-2LK54I4E.js";import"../chunk-WK3AFPXY.js";import"../chunk-D2BCHTQR.js";import"../chunk-OWBO4WKA.js";import"../chunk-BDTITTMW.js";import"../chunk-H6DDIBQ4.js";import"../chunk-YC4TB3CJ.js";import"../chunk-ZJEBF4NB.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-WZ7TGAAT.js";import"../chunk-2OAZYSWJ.js";import"../chunk-EWVJSRRY.js";import"../chunk-P6O363EE.js";import"../chunk-FPOKPNO4.js";import"../chunk-MFIRYGHW.js";import"../chunk-BZ5ASXOL.js";import"../chunk-TTJ54QGG.js";import"../chunk-O2NLQBFX.js";import"../chunk-67GNT6PF.js";import"../chunk-PAELDYYS.js";import"../chunk-ZNCEOSXO.js";import"../chunk-L5KW4HG5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { N as NodeSelection } from '../../../plan-DChbUXdS.js';
|
|
1
2
|
import { Data } from '../../../blocks/index.js';
|
|
2
3
|
import { TreeItem } from './content-tree.js';
|
|
4
|
+
import '../../../types-41704JE4.js';
|
|
3
5
|
import 'react';
|
|
4
6
|
import '../../../types-E3HrTPg2.js';
|
|
5
7
|
import '../../../data/index.js';
|
|
6
|
-
import '../../../types-41704JE4.js';
|
|
7
8
|
import '../../../resolve-D68pb3Bx.js';
|
|
8
|
-
import '../../../plan-DChbUXdS.js';
|
|
9
9
|
|
|
10
10
|
type NodeSelector = {
|
|
11
11
|
index: number;
|
|
@@ -44,18 +44,20 @@ type SectionOps = {
|
|
|
44
44
|
/** Replace the whole working document (used by Reset). */
|
|
45
45
|
setDocument: (data: Data) => void;
|
|
46
46
|
/**
|
|
47
|
-
* Write the next document as ONE undo step — the
|
|
48
|
-
* operations (`efficient-easel/node-ops`, blueprint
|
|
49
|
-
* Delete, Duplicate, Move, Copy / Cut / Paste and Hide,
|
|
50
|
-
* hover-delete). Each of those is planned whole and lands here
|
|
51
|
-
* of the two or three dispatches it used to be.
|
|
47
|
+
* Write the next document, and what to select in it, as ONE undo step — the
|
|
48
|
+
* commit behind the block operations (`efficient-easel/node-ops`, blueprint
|
|
49
|
+
* step 2.4b: the menu's Delete, Duplicate, Move, Copy / Cut / Paste and Hide,
|
|
50
|
+
* and the rows' hover-delete). Each of those is planned whole and lands here
|
|
51
|
+
* once, instead of the two or three dispatches it used to be.
|
|
52
52
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
53
|
+
* `select` is BY ID, in `data` (`undefined` leaves the selection as it is),
|
|
54
|
+
* and goes in with the document through the store's `run` (0.105.1). Until
|
|
55
|
+
* then the chrome selected first, by position (`setUi { itemSelector }`),
|
|
56
|
+
* which the store reads in the document it still holds: a paste or a
|
|
57
|
+
* Duplicate selected the node after its copy, and a Move the node it passed.
|
|
58
|
+
* Behind the read-only gate like every other mutation here.
|
|
57
59
|
*/
|
|
58
|
-
commitDocument: (data: Data) => void;
|
|
60
|
+
commitDocument: (data: Data, select?: NodeSelection) => void;
|
|
59
61
|
};
|
|
60
62
|
type SectionOpsOptions = {
|
|
61
63
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useSectionOps}from"../../../chunk-
|
|
1
|
+
export{useSectionOps}from"../../../chunk-NWIW7AWH.js";import"../../../chunk-VSHV6KJQ.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-R6WTQWAC.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-P67FP7PG.js";import"../../../chunk-AELNNAFM.js";import"../../../chunk-BXZ6WLHC.js";import"../../../chunk-EOJNJCMJ.js";import"../../../chunk-ZFDCDJNZ.js";import"../../../chunk-ZNS7727Y.js";import"../../../chunk-3EDSDPIP.js";import"../../../chunk-QTLAVDJE.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-KTVH2ZRL.js";import"../../../chunk-D2BCHTQR.js";import"../../../chunk-EWVJSRRY.js";import"../../../chunk-P6O363EE.js";import"../../../chunk-FPOKPNO4.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-BZ5ASXOL.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-ZNCEOSXO.js";import"../../../chunk-L5KW4HG5.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "0.105.
|
|
3
|
+
"version": "0.105.1",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
package/dist/chunk-4XQUWGIV.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-SQTY6CJD.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-IE4GFYKO.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h}from"./chunk-VSOP4GUM.js";import{SlotChildActionsProvider as m}from"./chunk-KCBEE2MC.js";import{UiIcon as g}from"./chunk-5MZ3RNQQ.js";import{DEFAULT_PANEL_W as y,PANEL_WIDTHS_KEY as k,clampPanelWidth as S}from"./chunk-ZTTWFAAC.js";import{usePartBridge as v}from"./chunk-YN4KND5F.js";import{useSectionOps as x}from"./chunk-TLZG2FCF.js";import{useNodeClipboard as b,useNodeContextMenu as w}from"./chunk-7FBDZTUD.js";import{PageEditGuardNotices as z}from"./chunk-V4LF7D4F.js";import{useScreenDocument as B}from"./chunk-7V5WZ46F.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as N,styleShortcut as $}from"./chunk-57DJOKXT.js";import{AddChildRow as T}from"./chunk-3QVB4AG2.js";import{AddSidePanel as O}from"./chunk-N7VRF7PR.js";import{SidePanelHead as I,PanelShowStrip as P}from"./chunk-5ZBBXZPV.js";import{MediaSidePanel as A}from"./chunk-NYKIQJT2.js";import{useScreenSaveSwitch as R,useScreenNodeKeys as j,useScreenPinned as M,useScreenDocumentLabel as E,useScreenCanvasFrame as F,useScreenInspectorPanel as V,useScreenDevices as L,useScreenPickFollowsSelection as D,useScreenLeftView as G,useScreenAdd as H,SELECTION_MODE as U,sameInspectorMode as J,useScreenBridges as W,useScreenBlockRules as Y,useScreenBlockLook as K,useScreenNotify as Q,useScreenCanvasHead as Z,isSlotMode as _,useScreenStyleClipboard as X,useScreenDocumentPass as q,useScreenCanvasDrag as ee,ScreenCanvasTargetProvider as ne,isPinnedFirst as te,isPinnedLast as oe,screenSlotsOf as re}from"./chunk-VSHV6KJQ.js";import{ROOT_ZONE as ie,blockNodeActions as le,TREE_MAX_DEPTH as se,childSlotsOf as de,slotFieldsOf as ce,slotChildrenIn as ae,nestsInTree as pe,newNodeId as ue}from"./chunk-PLVEGYK6.js";import{useMediaPanel as fe,usePanelPick as he,useCancelPanelPick as me}from"./chunk-R6WTQWAC.js";import{useEaselHost as ge,useHostEscape as ye}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as ke}from"./chunk-PQXIFBDY.js";import{useEasel as Se}from"./chunk-P67FP7PG.js";import{TreeRow as ve,Subtree as xe,LayersTree as be,TreeGroupLabel as we,TreeRowAction as ze,TreeSeam as Be}from"./chunk-ZFDCDJNZ.js";import{useNodeOps as Ce,toItemSelector as Ne}from"./chunk-D2BCHTQR.js";import{saveIndicator as $e}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Te,TopBarRail as Oe,TopBarCluster as Ie,EaselIconButton as Pe,TopBarDivider as Ae,DeviceSwitch as Re,InspectorIconButton as je,PanelResizeHandle as Me,MAX_PANEL_W as Ee,MIN_PANEL_W as Fe,panelWidthVars as Ve,SaveState as Le,SaveStateToggle as De}from"./chunk-YC4TB3CJ.js";import{useWords as Ge}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as He}from"./chunk-TTJ54QGG.js";import{createDragSession as Ue,useTreeDrag as Je,gapToMoveIndex as We}from"./chunk-67GNT6PF.js";import{useCanvasFrame as Ye,BLOCK_SELECTOR as Ke,useCanvasEvent as Qe}from"./chunk-PAELDYYS.js";import{LayersIcon as Ze,UndoIcon as _e,RedoIcon as Xe,TrashIcon as qe,MediaIcon as en,DuplicateIcon as nn}from"./chunk-L5KW4HG5.js";import{zoneKey as tn,ROOT_ID as on,ROOT_SLOT as rn,parseZoneKey as ln,DataError as sn}from"./chunk-KRXQM65X.js";import{useRef as dn,useMemo as cn,useState as an,useEffect as pn,useCallback as un,useLayoutEffect as fn,Fragment as hn}from"react";import{jsx as mn,jsxs as gn,Fragment as yn}from"react/jsx-runtime";function kn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return mn(Le,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
-
return mn(Le,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=$e(e),d=e.failed&&!e.paused&&/* @__PURE__ */mn("button",{type:"button",className:"es-btn-ghost",onClick:i,children:"Retry now"});/* @__PURE__ */
|
|
3
|
-
return gn(yn,o?{children:[
|
|
4
|
-
/* @__PURE__ */mn(De,{pressed:e.paused,onToggle:r,title:e.paused?"Auto-save is off — click to turn it back on (saves your held edits)":"Auto-save is on — click to pause it",children:/* @__PURE__ */mn(Le,{tone:l,label:s})}),d]}:{children:[
|
|
5
|
-
/* @__PURE__ */mn(Le,{tone:l,label:s,role:"status"}),d]})}function Sn({expand:e}){/* @__PURE__ */
|
|
6
|
-
return mn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */gn(yn,e?{children:[
|
|
7
|
-
/* @__PURE__ */mn("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
-
/* @__PURE__ */mn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
-
/* @__PURE__ */mn("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
-
/* @__PURE__ */mn("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
-
/* @__PURE__ */mn("path",{d:"M5 12h14"})]})})}var vn="__rungs";var xn="screen:band",bn={duplicate:!0,delete:!0};function wn(){const $e=ge(),{target:Le,docId:De,capabilities:wn,currentSlug:zn,siteId:Bn,onPublish:Cn,saveState:Nn,saveConflict:$n,retrySave:Tn,toggleAutoSave:On,readOnly:In,readOnlyReason:Pn=null}=B(),An=R(),Rn=j(),{mediaEditing:jn,hasEditGuard:Mn,hasPinnedChrome:En}=wn,{appState:Fn,dispatch:Vn,history:Ln,selectedItem:Dn,getSelectorForId:Gn,config:Hn}=Se(e=>e),Un=M(),{first:Jn,firstGroup:Wn,lastGroup:Yn,isSectionGroup:Kn,sectionGroupZone:Qn,panelOf:Zn}=Un,_n=Zn(Jn),Xn=e=>te(Un,e),qn=e=>oe(Un,e),et="node"===Un.firstRow,nt=Un.band??null,tt=Ge("screen",ke),ot=E()??`/${zn}`,rt=F(),it=V(),lt=x({readOnly:In}),st=dn(null),dt=cn(()=>({...lt,select:e=>{st.current=e,lt.select(e)}}),[lt]),ct=Fn.ui,at=ct.leftSideBarVisible,pt=ct.rightSideBarVisible,{options:ut,widths:ft,initial:ht,fluid:mt,fit:gt}=L(),[yt,kt]=an(ht),St=fe(),vt=jn&&null!==St,xt=he(),bt=me();D(Dn?.props.id);const{read:wt,write:zt,forSelection:Bt}=G(),[Ct,Nt]=an(wt);pn(()=>{zt(Ct)},[Ct]);const[$t,Tt]=an(0),Ot=dn(null),It=dn(null),Pt=Ye(It,{readySelector:Ke}),At=f(It);h(It);const[Rt,jt]=an(!1),Mt=dn(!1),Et=dn(!1),[Ft,Vt]=an(null),Lt=H(),Dt=e=>Vt(null===e?null:{zone:ie,index:e}),[Gt,Ht]=an([]),[Ut,Jt]=an(U),Wt="puck"===Ut.kind,Yt=Rt&&!Ft&&Lt.railTarget?Lt.railTarget(Fn.data,{node:Dn??null,mode:Ut}):null,Kt=Yt?{zone:tn(Yt),index:Yt.index}:null,Qt=Ft??Kt,Zt=Qt&&Qt.zone===ie?Qt.index:null,_t=t(Ut,Dn?.props.id),[Xt,qt]=an(null);pn(()=>{Xt&&(o(),qt(null))},[Xt]);const eo=dn(Gn);eo.current=Gn;const no=un((e,{scroll:n})=>{Nt(n=>Bt(e,n)),n&&qt(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=eo.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Oo(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),to=dn(null);pn(()=>{const e=to.current;to.current=null;const n=null==Dn?.props.id?null:String(Dn.props.id);Jt(e&&e.id===n?e.mode:Zn(Dn?.type)??U);const t=Dn?.props.id,o=st.current;if(st.current=null,!t)return;const i=Gn(t);no(String(t),{scroll:!r(o,i??null,ie)})},[Dn?.props.id,no]);const oo=un(e=>{Jt(n=>J(n,e)?n:e),Vn({type:"setUi",ui:{rightSideBarVisible:!0}})},[Vn]),ro=dn(()=>{});ro.current=(e,n)=>{const t=e?zr(e.zone??ie)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Dn?.props.id?null:String(Dn.props.id);Jt(e=>J(e,n)?e:n),o!==r&&(to.current={id:o,mode:n},dt.select(e))};const io=un((e,n)=>ro.current(e,n),[]),lo={kind:Ut.kind,mode:Ut,open:oo,show:e=>Jt(e),reveal:()=>{pt||Vn({type:"setUi",ui:{rightSideBarVisible:!0}})},select:io},so=W(lo,{data:Fn.data,selected:Dn??null,zoneOf:e=>Gn(e)?.zone,readOnly:Boolean(In),select:e=>{Jt(U),dt.select({index:e})},replace:(e,n)=>dt.replaceComponent(ie,e,n),scrollTo:e=>Qr(e)},{device:yt,refreshes:$t},{setView:Nt,reveal:()=>{at||Vn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),co=so.pinnedSource??!1,ao=so.resolveLeftView?so.resolveLeftView(Ct,vt):"media"===Ct&&vt?Ct:"sections",po=Y(),{isLockedBlock:uo,duplicateBlocked:fo,nestDepth:ho,newSectionNode:mo,canAddTo:go,blockIsOffered:yo}=po,ko=K(),{labelAtLevel:So,Icon:vo,useProducts:xo}=ko,bo=ko.rowName?(e,n,t)=>ko.rowName(e,n,t):void 0,wo=un(e=>{Vn({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),no(e,{scroll:!0})},[Vn,no]),{selectNode:zo,openPartId:Bo}=v({mode:Ut,setMode:Jt,onOpenPart:wo}),[Co,No]=an(null);ye(null!==Co,()=>No(null));const $o="sf-editor-collapsed-sections",[To,Oo]=an(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem($o);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
-
return new Set}});pn(()=>{try{window.localStorage.setItem($o,JSON.stringify([...To]))}catch{}},[To]);const[Io,Po]=an(()=>{if("undefined"==typeof window)return{...y};try{const e=window.localStorage.getItem(k);if(!e)return{...y};const n=JSON.parse(e);return{left:S(Number(n.left)||y.left),right:S(Number(n.right)||y.right)}}catch{return{...y}}});pn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(k,JSON.stringify(Io))}catch{}},300);return()=>clearTimeout(e)},[Io]);const Ao=un((e,n)=>Po(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Ro=un(e=>Ao("left",e),[Ao]),jo=un(e=>Ao("right",e),[Ao]),Mo=e=>To.has(e),Eo=e=>Oo(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Fo=dn(!1),Vo=dn(null);pn(()=>{if(Fo.current&&!Rt){const e=Vo.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??It.current?.querySelector(`button[aria-label="${CSS.escape(tt.add.title)}"]`))?.focus(),Vo.current=null}Fo.current=Rt},[Rt]),pn(()=>{if(!Rt||!At)return;const e=e=>{"Escape"===e.key&&ri()};return At.addEventListener("keydown",e),()=>At.removeEventListener("keydown",e)},[Rt,At]),ye(Rt,()=>ri()),pn(()=>{!at&&Rt&&(jt(!1),Vt(null),Mt.current=!1)},[at]),pn(()=>{if(!xt)return Et.current&&Vn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Et.current=!1);Rt&&(jt(!1),Vt(null),Et.current=Mt.current,Mt.current=!1),at||(Et.current=!0,Vn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[xt]),pn(()=>{!at&&xt&&(Et.current=!1,bt())},[at]),pn(()=>{if(!xt||!At)return;const e=e=>{"Escape"===e.key&&bt()};return At.addEventListener("keydown",e),()=>At.removeEventListener("keydown",e)},[xt,At]),ye(null!==xt,()=>bt());const Lo=Q(),[Do,Go]=an(null),[Ho,Uo]=an(0),Jo=dn(null),Wo=(e,n="success")=>{Lo?Lo(e,"error"===n?"error":"info"):(Go({msg:e,tone:n}),Uo(e=>e+1),Jo.current&&clearTimeout(Jo.current),Jo.current=setTimeout(()=>Go(null),"error"===n?3200:1900))};pn(()=>()=>{Jo.current&&clearTimeout(Jo.current)},[]);const Yo=dn(null),[Ko,Qo]=an(0),[Zo,_o]=an(0),Xo=Z(),qo=dn(null),er=e=>Math.max(0,e.clientHeight-(qo.current?.offsetHeight??0));pn(()=>{const e=Yo.current;if(!e)return;const n=()=>{Qo(e.clientWidth),_o(er(e))};n();const t=new ResizeObserver(n);return t.observe(e),qo.current&&t.observe(qo.current),()=>t.disconnect()},[]),fn(()=>{Yo.current&&(Qo(Yo.current.clientWidth),_o(er(Yo.current)))},[Io,at,pt]);const nr=yt===mt?Ko>0?Ko:ft[mt]:ft[yt],tr=Ko>0?Math.min(Ko/nr,"shrink"===gt?1:2):1,or=nr*tr,rr=Ko>0&&or>Ko+1,ir={width:or,height:Zo||"100%",flex:"none",position:"relative"},lr={width:nr,height:Zo?Zo/tr:"100%",maxHeight:"none",transform:1!==tr?`scale(${tr})`:void 0,transformOrigin:"top left"},sr=()=>Vn({type:"setUi",ui:{leftSideBarVisible:!at}}),dr=()=>Vn({type:"setUi",ui:{rightSideBarVisible:!pt}}),cr=e=>{Rt&&(jt(!1),Vt(null),Mt.current=!1,at&&Ct===e)||xt&&(Et.current=!1,bt(),at&&Ct===e)||(at&&Ct===e?sr():(Nt(e),at||Vn({type:"setUi",ui:{leftSideBarVisible:!0}})))},ar=()=>{C($e,{accept:"image/*",title:"Media library"})},pr=()=>{Jt(U),dt.select(null),u()},ur=()=>{Jt(_n??U),pt||Vn({type:"setUi",ui:{rightSideBarVisible:!0}})},fr=Fn.data.content??[],hr=()=>{const e=fr.findIndex(Xn),n=fr.findIndex(qn);return{floor:e>=0?e+1:0,cap:n>=0?n:fr.length}},mr=Hn,gr=b(),yr=Ce({data:Fn.data,config:mr,readOnly:Boolean(In),clipboard:gr,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==on||e.slot!==rn)return{min:0,max:n-1};const{floor:t,cap:o}=hr();return{min:t,max:o-1}},commit:(e,{select:n})=>{if(void 0!==n){Jt(U);const t="node"===n?.kind?Ne(e,mr,n):null;dt.select(t&&t.zone===ie?{index:t.index}:t)}dt.commitDocument(e)}}),kr=e=>Hn.components[e]?.label??e,Sr=un(e=>Hn.components[e]?.defaultProps??{},[Hn]),vr=e=>So(e,"section",kr(e)),xr=e=>l({type:e.type,props:e.props??{}},vr(e.type),bo),{nodeAddresses:br,zoneItems:wr}=cn(()=>{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>=se)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of de(Hn,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(fr,ie,0),{nodeAddresses:e,zoneItems:n}},[fr,Hn]),zr=un(e=>wr.get(e)??[],[wr]),Br=e=>{const n=br.get(e);return n?zr(n.zone)[n.index]:void 0},Cr=e=>re(po,Hn,e),Nr=e=>{if(!po.slotsOf||e===ie)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Br(e.slice(0,n));if(!t)return null;const o=Cr(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},$r=(()=>{if(!_(Ut))return null;const e=`${Ut.nodeId}:${Ut.slot}`;return Nr(e)?.slot.panel===Ut.kind?e:null})(),Tr=dn(null);pn(()=>{const e=Tr.current;if(Tr.current=null,!$r||!_(Ut))return;const n=Ut.nodeId;no(n,{scroll:e!==$r}),Oo(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Ut]);const Or=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=br.get(e);n&&(n.zone===ie?Zr(n.index):Bi(n.zone,n.index,e,Br(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&$r!==i&&(Tr.current=i),io(null,r),pt||Vn({type:"setUi",ui:{rightSideBarVisible:!0}}),Qr(o)},Ir=(e,n,t)=>{const o=`${e}:${n}`;if(Oo(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;$r!==o&&(Tr.current=o);io(null,{kind:t,nodeId:e,slot:n})},Pr=(e,n,t)=>{if(In||!po.moveSlot)return;const o=Br(e),r=o?Cr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:vn,index:n},s=We(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=po.moveSlot(e,n,s);"string"==typeof d&&Ir(e,d,i.panel)},Ar=xo(),Rr=cn(()=>{const e=/* @__PURE__ */new Map;for(const n of Ar??[])e.set(n.slug,n.name);return e},[Ar]),jr=e=>s(e,kr,ko.plainText,e=>Rr.get(e),ko.rowName),Mr=(e,n)=>{const t=Hn.components[e.type]?.fields,o=n===ie||Hi(n)?"section":"block",r=n===ie&&(Xn(e)||qn(e)||Kn(e.type)),i="block"===o?d(t):r?null:c(t);return ko.renamePropOf?ko.renamePropOf(e,o,i):i},Er=(e,n,t,o)=>{if(!(Co?.zone===e&&Co.index===n))return;const r=(t,o)=>{No(null),o&&((e,n,t)=>{const o=zr(e)[n];if(!o)return;const r=Mr(o,e);r&&dt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
-
return mn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":"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)},Fr=n(X()),Vr=Fr.scope({target:Le,siteId:Bn,docId:De}),Lr=Hn,Dr=(e,n)=>n===ie?vr(e):kr(e),Gr=(e,n,t)=>{const o=Fr.plan(Vr,t,Dr(t.type,e),Lr);o&&(o.changed&&dt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Wo(o.message))},Hr=w({nodesIn:zr,nodeAt:(e,n)=>zr(e)[n]??null,labelOf:(e,n)=>n===ie?vr(e):kr(e),renamePropOf:Mr,beginRename:(e,n)=>No({zone:e,index:n}),history:{hasPast:Ln.hasPast,hasFuture:Ln.hasFuture,back:()=>Ln.back(),forward:()=>Ln.forward()},openAddSection:()=>{dt.select(null),ti(null)},openPageSettings:()=>{dt.select(null),Jt(U)},collapseAll:()=>Oo(new Set(zr(ie).map(e=>String(e.props.id)))),onPasteRefused:e=>Wo(e?tt.pasteRefused({name:e.label}):"Your browser won’t let us read the clipboard — press ⌘V","error"),canPasteAt:(e,n)=>Ji(e,n),menuRows:so.menuRows,isLocked:e=>uo(e.type),duplicateBlocked:e=>fo(Fn.data,e),permits:e=>le(Hn,e.type),canAddTo:go,nodeOps:yr,isPinned:(e,n)=>n===ie&&(Xn(e)||qn(e)),sectionBand:hr,openAddInside:(e,n)=>{e===ie?Zr(n):dt.select({zone:e,index:n}),ti(null)},locate:e=>br.get(e)??null,rowNameOf:(e,n)=>n===ie?xr(e):jr(e),selectAt:(e,n,t,o)=>{e===ie?Zr(n):Bi(e,n,t,o??"")},slotRung:e=>{const n=Nr(e);return n?.slot.panel?{label:n.slot.label,select:()=>Or(n.node,n.slot,!1)}:null},style:{held:()=>N(Vr),canCopy:e=>Fr.rows(Lr,e).some(e=>!1!==e.counted),copy:(e,n)=>Fr.copy(Vr,e,Dr(e.type,n),Lr),paste:(e,n,t)=>Gr(e,n,t)},keys:Rn?{target:At,selected:()=>{const e=Fn.ui.itemSelector;return e?{zone:e.zone??ie,index:e.index}:null},held:()=>gr.get(),readOnly:Boolean(In),onDone:({done:e,name:n})=>{"copied"===e&&Wo(tt.copied({name:n}))}}:void 0},Pt),Ur=dn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});pn(()=>{Ur.current={copy:(e,n)=>Fr.copy(Vr,e,Dr(e.type,n),Lr),paste:Gr,at:()=>{const e=Fn.ui.itemSelector;if(!e)return null;const n=e.zone??ie,t=zr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(In)}});const Jr=un(e=>{const n=$(e);if(!n)return;const t=Ur.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))},[]);pn(()=>{if(!At)return;const e=e=>Jr(e);return At.addEventListener("keydown",e),()=>At.removeEventListener("keydown",e)},[Jr,At]),Qe(Pt,"keydown",Jr);const Wr=fr.map(e=>e.props.id).join("|");pn(()=>{const e=Pt?.document??null,n=Pt?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ht(e=>e.length?[]:e);const n=fr.findIndex(qn),t=n>=0?n:fr.length,o=n=>{const t=fr[n]?.props?.id;if(null==t)return null;const o=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);return o?o.getBoundingClientRect():null},r=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1);(n||t)&&r.push({top:Math.round(n?n.top:t.bottom),index:e})}Ht(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)return!1;return!0}(e,r)?e:r)},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()}},[Pt,Wr,yt,tr,at,pt,Dn?.props.id]);const Yr=Pt?.document??null,Kr=Pt?.window??null;pn(()=>{const e=Ot.current;if(!e||!Yr||!Kr)return;const n=[],t=()=>{const n=Yr.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Kr.scrollTo({left:Kr.scrollX,top:Kr.scrollY+t,behavior:"instant"}),!0};return Ot.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Yr,Kr]);const Qr=e=>{so.holdCanvasOn?so.holdCanvasOn(e):a(e)},Zr=e=>{Jt(U),dt.select({index:e}),so.sectionPressed?.(fr[e]);const n=fr[e]?.props?.id;n&&Qr(n)},_r=e=>{const{floor:n,cap:t}=hr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Dn&&Ut.kind!==_n?.kind?fr.findIndex(e=>e.props.id===Dn.props.id):-1;return o(r>=0?r+1:t)},Xr=(e,n)=>{const{floor:t,cap:o}=hr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(dt.reorderComponent(ie,e,i),dt.select({index:i}),{moved:!0,dest:i})},qr=(e,n,t)=>{Jt(U),dt.select({index:e}),a(n),Wo(`Added “${t}” section`)},ei=(e,n)=>{const t=_r(n),o=mo(e,{nodeDefaults:Sr,newNodeId:ue,sectionLabel:vr,blockIsOffered:yo}),r=o?dt.insertNode(ie,t,o):dt.insertSection(e,t);return qr(t,r,vr(e)),t},ni=(e,n,t)=>{const o=_r(t),r=dt.insertNode(ie,o,n);return qr(o,r,e),o},ti=e=>oi(ie,e),oi=(e,n)=>{Vo.current=document.activeElement??null,xt&&(Mt.current=Et.current,Et.current=!1,bt()),Vt(null===n?null:{zone:e,index:n}),jt(!0),at||(Mt.current=!0,Vn({type:"setUi",ui:{leftSideBarVisible:!0}}))},ri=()=>{jt(!1),Vt(null),Mt.current&&Vn({type:"setUi",ui:{leftSideBarVisible:!1}}),Mt.current=!1},ii=(e,n,t)=>{if("section"===e.kind)dt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;dt.insertNode(n,t,i(e.template.node))}Jt(U),dt.select({index:t,zone:n})},li=e=>n=>{n.target.closest(".es-tree-select")||e()},si=()=>so.editPinnedSource?.(),di=(e,n,t)=>{const o=zr(e)[n];return o&&!le(Hn,o.type).delete?null:/* @__PURE__ */mn(ze,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=zr(e)[n]?.props?.id;null!=t&&yr.remove(String(t))})(e,n),children:/* @__PURE__ */mn(qe,{size:15})})},ci=e=>ko.rowPreview?.(e)||void 0,ai=e=>ko.rowMarks?.(e)??void 0,pi=(e,n,t)=>ko.rowActions?.(e,n,t)??null,ui=(e,n,t,o)=>{const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
-
return mn(ze,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>hi(e,n,t),children:/* @__PURE__ */mn(g,r?{name:"eye-off",size:14}:{name:"eye",size:14})})},fi=e=>{const n=vr(fr[e]?.type??""),t=n?tt.addSectionBefore({name:n}):tt.addSectionHere;return pl(ie,e,()=>ti(e),t)},hi=(e,n,t)=>{dt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},mi=e=>ce(Hn,e),gi=e=>de(Hn,e),yi=e=>po.slotsOf?Cr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:ae(e,n.slot)})):[{slot:null,rung:null,kids:gi(e)}],ki=e=>po.slotsOf?yi(e).flatMap(e=>e.kids):gi(e),Si=e=>Boolean(po.slotsOf)&&Cr(e).some(e=>e.rung),vi=(e,n,t)=>null===t?void 0===n?go(e):go(e,n):go(e,n,t),xi=(e,n,t)=>{const o=pe(Hn,e.type,n)&&(t||ki(e).length>0||Si(e));return{collapsible:o,folded:o&&Mo(String(e.props.id))}},bi=(e,n,t)=>yi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>xi(e,r,t(e.type)).collapsible?[String(e.props.id),...bi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),wi=e=>ki(e).length>0||Si(e)||Boolean(go(e.type)),zi=e=>Boolean(go(e)),Bi=(e,n,t,o)=>{if(Jt(U),go(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),dt.select({index:n,zone:e}),a(t)}else dt.select({index:n,zone:e}),Qr(t)},Ci=(e,n,t,o,r)=>{const i=`${e}:${n}`;dt.insertComponent(i,t,o),go(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),dt.select({index:o,zone:i})}):dt.select({index:o,zone:i})},Ni=(e,n,t)=>{dt.insertComponent(e,n,t),Jt(U),dt.select({index:t,zone:e})},$i=dn(/* @__PURE__ */new Set);pn(()=>{fr.forEach(e=>{const n=go(e.type)?.spec;if(!n)return;const t=e.props.id;if($i.current.has(t))return;$i.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(Sr)).forEach((e,t)=>dt.seedChild(o,t,n.childType,e))})},[fr,dt,Sr]);const Ti=dn(/* @__PURE__ */new Set);pn(()=>{fr.forEach((n,t)=>{const o=n.props.id;if(Ti.current.has(o))return;const r=e(n,mi(n.type));Ti.current.add(o),r&&dt.replaceComponent(ie,t,{...n,props:r})})},[fr,dt]),q(dt,Hn);const Oi=fr.findIndex(qn),Ii=Oi>=0?fr[Oi]:null,Pi=et?fr.findIndex(Xn):-1,Ai=Pi>=0?fr[Pi]:null,Ri=fr.find(e=>e.type===Wn)??null,ji=fr.find(e=>e.type===Yn)??null,Mi=Oi>=0?Oi:fr.length,Ei=[];fr.forEach(e=>{qn(e)||(wi(e)&&Ei.push(String(e.props.id)),Ei.push(...bi(e,1,zi)))}),Ii&&(Ei.push(String(Ii.props.id)),Ei.push(...bi(Ii,1,zi)));const Fi=Ei.length>0&&Ei.every(e=>To.has(e)),Vi=e=>{const n=ko.blockRowName(e,kr);return ko.rowName?ko.rowName(e,"block",n):n},Li=(e,n,t,o)=>{const r=zr(e)[t];if(!r)return;const i={...ln(e),index:t},l={...ln(n),index:Math.min(Math.max(o,0),zr(n).length)},s=We(i,l);if(e!==n||s!==t)try{yr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof sn))throw e}},Di=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of gi(e))n.add(r),t(o)};for(const t of mi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Gi=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=br.get(n);if(!e)return null;if(e.zone===ie)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Hi=e=>{const n=e.slice(0,e.indexOf(":")),t=fr.find(e=>Kn(e.type)&&String(e.props.id)===n);return t&&Qn(n)===e?t:null},Ui=(e,n,t)=>{if(e.rung){const t=Br(e.rung.nodeId),o=t?Cr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===vn&&n.index>=0&&n.index<=o}if(n.slot===vn)return!1;if(e.add)return Yi(e.add,n);const o=tn(n);if(Kn(e.type))return!1;const r=Hi(o),i=Hi(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=zr(o).length);if(e.zone===ie||o===ie){if(e.zone!==o)return!1;const{floor:t,cap:r}=hr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>zr(o).length)return!1;if(e.zone===o)return!0;const l=Ii?String(Ii.props.id):null;return(!l||Gi(e.zone)!==l&&Gi(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??zr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=br.get(i),s=l?zr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Di(r).has(n))return!1;const d=go(s.type,ho(Fn?.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?.(zr(n),r))})(e.zone,o,e.index,t)},Ji=(e,n)=>{const t=tn(e.from);if(t===tn(n))return!0;const o=e.node;return Ui({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Wi=e=>{const n=e.slice(0,e.indexOf(":")),t=br.get(n),o=t?zr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=go(o.type,ho(Fn?.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:kr(r.spec.childType)}]:[]),l=Nr(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:t.zone===ie?vr(o.type):kr(o.type)}},Yi=(e,n)=>{const t=tn(n);if("block"!==e.kind){if(Hi(t))return n.index>=0&&n.index<=zr(t).length;if(t!==ie)return!1;const{floor:e,cap:o}=hr();return n.index>=e&&n.index<=o}if(t===ie)return!1;const o=Wi(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(zr(t))},Ki=(e,n)=>{e.rung?Pr(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&Hi(tn(n)))return void ii(e,tn(n),n.index);if("section"===e.kind)return void ei(e.type,n.index);if("template"===e.kind)return void ni(e.template.name,i(e.template.node),n.index);const t=tn(n),o=Wi(t);o&&(o.target.spec?Ci(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ni(t,e.type,n.index))})(e.add,n):e.zone===ie?Xr(e.index,n.index):Li(e.zone,tn(n),e.index,n.index)},[Qi]=an(()=>Ue()),Zi=Je({keyOf:e=>e.id,readOnly:Boolean(In),session:Qi,canDrop:Ui,onDrop:Ki,onStep:(e,n)=>{e.rung?Pr(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ie?((e,n)=>{const t=vr(fr[e]?.type??""),o=Xr(e,n<0?e-1:e+2);if(!o.moved)return void Wo(`“${t}” is already ${n<0?"first":"last"}`);const{floor:r,cap:i}=hr();Wo(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):Li(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),_i=un(e=>{const{floor:n,cap:t}=hr(),o=[];for(const r of e.nodes){const e=tn(r.place),i=zr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Xn(i)||qn(i)||uo(i.type))continue;if(Kn(i.type))continue;const l=Boolean(Hi(e)),s=e===ie||l;e===ie&&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?vr(i.type):jr(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(Wi(tn(e.list))?.choices.length)||Boolean(Hi(tn(e.list))))}},[Fn.data]),Xi=e=>{Jt(U),dt.select(e.zone===ie?{index:e.index}:{index:e.index,zone:e.zone})},qi=ee(),el=()=>({data:Fn.data,device:yt,ops:dt,inspector:lo}),nl=qi?.model,tl=cn(()=>nl?e=>nl(e,_i(e),el()):_i,[nl,_i,yt]),ol=qi?.measure,rl=ol?(e,n)=>ol(e,n,el()):void 0,il=qi?.canDrop,ll=il?(e,n)=>il(e,n,Ui,el()):Ui,sl=qi?.drop,dl=sl?(e,n)=>sl(e,n,Ki,el()):Ki,cl=qi?.pick,al=cl?e=>cl(e,Xi,el()):Xi,pl=(e,n,t,o)=>/* @__PURE__ */mn(Be,{...In?{}:Zi.seam({place:{...ln(e),index:n}}),onAdd:In?void 0:t,label:o},`seam:${e}:${n}`),ul={rowClick:li,isCollapsed:Mo,toggleCollapse:Eo},fl=e=>{const n=String(e.props.id),t=fr.findIndex(e=>String(e.props.id)===n),o=Qn(n),r=zr(o),i=Mo(n),l=kr(e.type),s=ko.rowName?ko.rowName(e,"section",l):l,d=e=>pl(o,e,()=>oi(o,e),tt.addSectionHere);/* @__PURE__ */
|
|
15
|
-
return gn(yn,{children:[
|
|
16
|
-
/* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:e.type,size:13}),name:s,preview:ci(e),marks:ai(e),onSelect:()=>Zr(t),nameSlot:Er(ie,t,n,s),selected:_t===n,actions:pi(e,ie,t)??void 0,rowProps:{"data-node-id":n,onClick:li(()=>Zr(t))},fold:{open:!i,label:"section",onToggle:()=>Eo(n)}}),!i&&/* @__PURE__ */gn(xe,{children:[r.map((n,t)=>{const r=String(n.props.id),i=xr(n),l=wi(n),s=l&&Mo(r),c=()=>Bi(o,t,r,e.type),{rowProps:a,...p}=Zi.row({item:{id:r,zone:o,index:t,type:n.type},place:{...ln(o),index:t}},{"data-node-id":r,onClick:li(c)});/* @__PURE__ */
|
|
17
|
-
return gn(hn,{children:[d(t),
|
|
18
|
-
/* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:n.type,size:13}),name:i,preview:ci(n),marks:ai(n),onSelect:c,nameSlot:Er(o,t,r,i),selected:_t===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Eo(r)}:void 0,actions:/* @__PURE__ */gn(yn,{children:[di(o,t,i),pi(n,o,t),ui(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */mn(xe,{children:gl(n,2)})]},r)}),d(r.length)]})]})},hl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Zi.dragging,d=!Mo(l)&&s?.rung?.nodeId!==i,c={...ln(l),index:0},a=s&&!s.rung&&Ui(s,c)?c:void 0,p=()=>Or(e,n,!0),{rowProps:u,...f}=Zi.row({item:{id:`rung:${l}`,zone:`${i}:${vn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:vn,index:t},into:a,canDrag:Boolean(po.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:li(p)}),h=In?null:po.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
19
|
-
return gn(hn,{children:[n.heading,
|
|
20
|
-
/* @__PURE__ */mn(ve,{icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:$r===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Eo(l)},actions:h&&h.length>0?/* @__PURE__ */mn(yn,{children:h.map((t,o)=>/* @__PURE__ */mn(ze,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(In||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ir(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__ */mn(qe,{size:15}):/* @__PURE__ */mn(nn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */mn(xe,{children:r})]},l)},ml=(e,n)=>{const t=yi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
21
|
-
return mn(yn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=vi(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=null!==c&&Boolean(Wi(c)?.choices.length),p=(e,n)=>a?pl(e,n,()=>oi(e,n),"Add block here"):pl(e,n),u=/* @__PURE__ */gn(yn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=_t===String(n.props.id),{collapsible:i,folded:s}=xi(n,l,zi(n.type)),d=String(n.props.id),c=Vi(n),a=()=>Bi(t,o,d,e.type),{rowProps:u,...f}=Zi.row({item:{id:d,zone:t,index:o,type:n.type},place:{...ln(t),index:o}},{"data-node-id":d,onClick:li(a)});/* @__PURE__ */
|
|
22
|
-
return gn(hn,{children:[0===o&&p(t,0),
|
|
23
|
-
/* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:n.type,size:13}),name:c,preview:ci(n),marks:ai(n),onSelect:a,nameSlot:Er(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Eo(d)}:void 0,actions:/* @__PURE__ */gn(yn,{children:[di(t,o,c),pi(n,t,o),ui(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */mn(xe,{children:ml(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==c?null:p(c,0)]});return t.rung?hl(e,t.rung,r++,o,u):/* @__PURE__ */mn(hn,{children:u},t.slot??"")})})},gl=(e,n)=>{const t=ho(Fn?.data,e.type,String(e.props.id)),o=yi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
24
|
-
return mn(yn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=vi(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>Ci(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>oi(n,t):void 0;return pl(n,t,o,n===f&&c?c.addLabel:"Add block here")},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */gn(yn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=_t===String(n.props.id),i=jr(n),l=String(n.props.id),{collapsible:d,folded:c}=xi(n,s,zi(n.type)),a=mi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...ln(p),index:zr(p).length}:void 0,f=Zi.dragging,h=u&&f&&Ui(f,u)?u:void 0,g=()=>Bi(t,o,l,e.type),{rowProps:y,...k}=Zi.row({item:{id:l,zone:t,index:o,type:n.type},place:{...ln(t),index:o},into:h,canDrag:!uo(n.type)},{"data-node-id":l,onClick:li(g)});/* @__PURE__ */
|
|
25
|
-
return gn(hn,{children:[0===o&&m(t,0),
|
|
26
|
-
/* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:n.type,size:13}),name:i,preview:ci(n),marks:ai(n),onSelect:g,nameSlot:Er(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Eo(l)}:void 0,actions:uo(n.type)?pi(n,t,o)??void 0:/* @__PURE__ */gn(yn,{children:[di(t,o,i),pi(n,t,o),ui(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */mn(xe,{children:gl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
27
|
-
/* @__PURE__ */mn(T,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>Ci(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?hl(e,o.rung,i++,r,k):/* @__PURE__ */mn(hn,{children:k},o.slot??"")})})},yl=(()=>{if(!Dn||!Wt)return null;const e=String(Dn.type),n=String(Dn.props.id),t=go(e,ho(Fn?.data,e,n));if(!t||"footer"===t.source)return null;const o=fr.some(e=>String(e.props?.id)===n),r=Array.isArray(Dn.props[t.slot])?Dn.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:kr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:o?vr(e):kr(e),choices:i,onPick:o=>{t.spec?Ci(n,t.slot,o,r.length,e):Ni(`${n}:${t.slot}`,o,r.length)}}})(),kl=Qt&&Qt.zone!==ie&&!Hi(Qt.zone)?Qt.zone:null,Sl=!0===Lt.blocksFirst,vl=kl?Wi(kl):Sl&&Qt?null:yl,xl=Boolean(Ft&&kl)||Sl&&Boolean(vl&&vl.choices.length>0),bl=Rt||null!==xt,wl=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:at&&!bl&&ao===e.id,onSelect:()=>cr(e.id)}:e,zl=[{id:"add",label:tt.add.title,icon:/* @__PURE__ */mn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:Rt,onSelect:()=>Rt?ri():ti(null)},...(so.railLead??[]).map(wl),{id:"sections",label:"Layers",icon:/* @__PURE__ */mn(Ze,{}),active:at&&!bl&&"sections"===ao,onSelect:()=>cr("sections")},...(so.railTrail??[]).map(wl)];vt?zl.push({id:"media",label:"Media library",icon:/* @__PURE__ */mn(en,{}),active:at&&!Rt&&(null!==xt||"media"===ao),onSelect:()=>cr("media")}):jn&&zl.push({id:"media",label:"Media library",icon:/* @__PURE__ */mn(en,{}),onSelect:ar});const Bl=[...so.railLead??[],...so.railTrail??[]].find(e=>"panel"in e&&e.id===ao),Cl=Boolean(nt?.foldable)&&!co,Nl=nt?.label??(Mn?tt.pageSections:tt.templateSections),$l=Cl&&Mo(xn),Tl=/* @__PURE__ */gn(yn,{children:[fr.map((e,n)=>{if(Xn(e)||qn(e)||Kn(e.type))return null;const t=_t===String(e.props.id),o=Boolean(e.props._hidden);gi(e);const r=String(e.props.id),i=so.hasOwnRows?.(e)??!1,l=wi(e)||i,s=l&&Mo(r),{rowProps:d,...c}=Zi.row({item:{id:r,zone:ie,index:n,type:e.type},place:{...ln(ie),index:n}},{"data-node-id":r,onClick:li(()=>Zr(n))});/* @__PURE__ */
|
|
28
|
-
return gn(hn,{children:[n>0&&fi(n),
|
|
29
|
-
/* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:e.type,size:13}),name:xr(e),preview:ci(e),marks:ai(e),onSelect:()=>Zr(n),nameSlot:Er(ie,n,r,xr(e)),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>Eo(r)}:void 0,actions:/* @__PURE__ */gn(yn,{children:[di(ie,n,xr(e)),pi(e,ie,n),ui(ie,n,e,xr(e))]}),rowProps:d}),wi(e)&&!s&&/* @__PURE__ */gn(xe,{children:[gl(e,1),so.partRows?.(e,ul)]}),i&&!s&&/* @__PURE__ */mn(xe,{children:so.ownRows?.(e,n,ul)})]},String(e.props.id??n))}),!co&&Mi>0&&fi(Mi),nt?.addAtEnd&&!co&&!In&&/* @__PURE__ */mn(T,{small:!0,label:tt.addSection,blocked:null,onAdd:()=>ti(Mi)})]}),Ol=(e,n,t)=>{const o=String(e.props.id),r=ki(e).length>0||Si(e)||Boolean(go(e.type)),i=r&&Mo(o),l="header"===t?tt.header:tt.footer,s=ko.rowName?ko.rowName(e,"section",l):l;/* @__PURE__ */
|
|
30
|
-
return gn(yn,{children:[
|
|
31
|
-
/* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:t,size:13}),name:s,preview:ci(e),marks:ai(e),onSelect:()=>Zr(n),nameSlot:Er(ie,n,o,s),selected:_t===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Eo(o)}:void 0,actions:pi(e,ie,n)??void 0,rowProps:{onClick:li(()=>Zr(n))}}),r&&!i&&/* @__PURE__ */mn(xe,{children:ml(e,1)})]})};return(so.wrap??(e=>e))(
|
|
32
|
-
/* @__PURE__ */mn(ne,{target:Pt,children:/* @__PURE__ */gn("div",{ref:It,className:"sf-editor es-editor",style:Ve(Io),onContextMenu:Hr.onEditorContextMenu,children:[
|
|
33
|
-
/* @__PURE__ */gn(Te,{children:[
|
|
34
|
-
/* @__PURE__ */mn(Oe,{items:zl,ariaLabel:"Left panel views"}),
|
|
35
|
-
/* @__PURE__ */gn(Ie,{children:[
|
|
36
|
-
/* @__PURE__ */mn(Pe,{label:"Undo",disabled:!Ln.hasPast,onClick:()=>Ln.back(),children:/* @__PURE__ */mn(_e,{})}),
|
|
37
|
-
/* @__PURE__ */mn(Pe,{label:"Redo",disabled:!Ln.hasFuture,onClick:()=>Ln.forward(),children:/* @__PURE__ */mn(Xe,{})}),
|
|
38
|
-
/* @__PURE__ */mn(Ae,{}),
|
|
39
|
-
/* @__PURE__ */mn(Re,{devices:ut,value:yt,onChange:kt})]}),
|
|
40
|
-
/* @__PURE__ */gn(Ie,{kind:"right",style:{minWidth:300},children:[
|
|
41
|
-
/* @__PURE__ */mn(kn,{saveState:Nn,notSaving:Boolean(In)||null!=$n,readOnlyReason:Pn,toggle:An,onToggle:On,onRetry:Tn}),so.barLead?.(),
|
|
42
|
-
/* @__PURE__ */mn("button",{type:"button",className:"es-btn-ghost",title:"Refresh the preview (reloads the canvas, keeps your place)",onClick:()=>{Ot.current=(()=>{const e=Pt?.document;if(!e)return null;const n=fr.findIndex(qn),t=n>=0?n:fr.length;let o=null;for(let n=0;n<t;n++){const t=fr[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=Dn?.props?.id??fr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Tt(e=>e+1)},children:"Refresh"}),so.barTrail?.(),so.barMain?so.barMain():/* @__PURE__ */mn("button",{type:"button",className:"es-btn-primary",disabled:null!==Pn,onClick:()=>{Cn(Fn.data)},children:tt.done})]})]}),
|
|
43
|
-
/* @__PURE__ */mn(z,{}),
|
|
44
|
-
/* @__PURE__ */gn("div",{className:"sf-body",children:[at?/* @__PURE__ */gn(yn,{children:[
|
|
45
|
-
/* @__PURE__ */mn("div",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:Rt?/* @__PURE__ */mn(O,{blocks:vl,blocksOnly:xl,at:Ft?{label:(e=>{const n=Hi(e.zone);if(n)return tt.add.addingTo({name:kr(n.type)});if(e.zone===ie){const n=fr[e.index];return n&&!qn(n)?tt.add.addingBefore({name:vr(n.type)}):tt.add.addingAtEnd}const t=Wi(e.zone);return t?tt.add.addingTo({name:t.parentName}):tt.add.addingHere})(Ft),onClear:()=>Vt(null)}:void 0,onAdd:e=>{const n=Qt,t=(e,n)=>{Ft&&Vt({zone:e,index:n})};if(n&&"block"!==e.kind&&Hi(n.zone))return ii(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===Zt)return void ei(e);const n=ei(e,Zt);Ft&&Dt(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===Zt)return void ni(e,n);const t=ni(e,n,Zt);Ft&&Dt(t+1)})(e.template.name,i(e.template.node));if(n&&n.zone!==ie){const o=Wi(n.zone);if(!o)return;return o.target.spec?Ci(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ni(n.zone,e.type,n.index),void t(n.zone,n.index+1)}yl?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Qi,siteWide:so.addPanelRow?.(ri),onClose:ri,onHide:sr,readOnly:Boolean(In)}):xt&&St?
|
|
46
|
-
/* @__PURE__ */mn(A,{panel:St,pick:xt,onHide:sr}):Bl?Bl.panel({onHide:sr,notify:Wo}):"media"===ao&&St?/* @__PURE__ */mn(A,{panel:St,pick:null,onHide:sr}):/* @__PURE__ */gn(yn,{children:[
|
|
47
|
-
/* @__PURE__ */mn(I,{icon:/* @__PURE__ */mn(Ze,{}),title:"Layers",context:ot,actions:Ei.length>0?/* @__PURE__ */mn(je,{label:Fi?"Expand all sections":"Collapse all sections",onClick:()=>Oo(e=>{const n=new Set(Ei);return Fi?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ei])}),children:/* @__PURE__ */mn(Sn,{expand:Fi})}):void 0,onHide:sr}),
|
|
48
|
-
/* @__PURE__ */gn(be,{className:"sf-tree sf-scroll",children:[
|
|
49
|
-
/* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:"page",size:13}),name:tt.pageSettings,onSelect:pr,selected:!Dn&&Wt,rowProps:{onClick:li(pr)}}),Ri&&/* @__PURE__ */gn(yn,{children:[
|
|
50
|
-
/* @__PURE__ */mn(we,{children:tt.header}),fl(Ri)]}),!co&&En&&/* @__PURE__ */gn(yn,{children:[
|
|
51
|
-
/* @__PURE__ */mn(we,{children:tt.header}),!et&&/* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:"header",size:13}),name:tt.header,onSelect:ur,selected:Ut.kind===_n?.kind,rowProps:{onClick:li(ur)}})]}),!co&&Ai&&Ol(Ai,Pi,"header"),!co&&!Cl&&/* @__PURE__ */mn(we,{children:Nl}),Cl?/* @__PURE__ */gn(yn,{children:[
|
|
52
|
-
/* @__PURE__ */mn(ve,{icon:null,name:Nl,fold:{open:!$l,label:Nl,onToggle:()=>Eo(xn)}}),!$l&&/* @__PURE__ */mn(xe,{children:Tl})]}):Tl,En&&/* @__PURE__ */mn(we,{children:tt.footer}),Ii&&Ol(Ii,Oi,"footer"),!co&&!Ii&&En&&/* @__PURE__ */mn(ve,{icon:/* @__PURE__ */mn(vo,{type:"footer",size:13}),name:tt.footer,onSelect:si,rowProps:{onClick:li(si),title:"Edit the site footer"}}),ji&&fl(ji),so.treeFoot?.()]})]})}),
|
|
53
|
-
/* @__PURE__ */mn(Me,{side:"left",width:Io.left,min:Fe,max:Ee,defaultWidth:y.left,label:"Resize Sections panel",onResize:Ro})]}):/* @__PURE__ */mn(P,{side:"left",onShow:sr}),
|
|
54
|
-
/* @__PURE__ */gn("div",{ref:Yo,className:"sf-center sf-scroll","data-sf-canvas-head":Xo?"":void 0,style:{overflowX:rr?"auto":"hidden",overflowY:"hidden"},children:[Xo&&/* @__PURE__ */mn("div",{ref:qo,className:"sf-canvas-head",children:/* @__PURE__ */mn(Xo,{device:yt})}),
|
|
55
|
-
/* @__PURE__ */mn("div",{className:"sf-frame-scaler",style:ir,children:/* @__PURE__ */mn("div",{className:"sf-frame "+(yt===mt?"":`sf-frame--${yt}`),style:lr,children:/* @__PURE__ */gn("div",{className:"sf-preview-host",children:[
|
|
56
|
-
/* @__PURE__ */mn(rt,{},$t),
|
|
57
|
-
/* @__PURE__ */mn(He,{canvas:Pt,session:Qi,model:tl,measure:rl,canDrop:ll,onDrop:dl,onPick:al,onZoneAdd:e=>oi(tn(e),0),readOnly:Boolean(In),revision:Fn.data}),Gt.length>0&&/* @__PURE__ */mn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:Gt.map(e=>/* @__PURE__ */gn("button",{type:"button",tabIndex:-1,className:"sf-preview-gap",style:{top:e.top},title:"Add section here",onClick:()=>ti(e.index),children:[
|
|
58
|
-
/* @__PURE__ */mn("span",{className:"sf-preview-gap-line"}),
|
|
59
|
-
/* @__PURE__ */gn("span",{className:"sf-preview-gap-pill",children:[
|
|
60
|
-
/* @__PURE__ */mn("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
61
|
-
/* @__PURE__ */mn("span",{className:"sf-preview-gap-label",children:"Add section"})]})]},e.index))})]})})})]}),pt?/* @__PURE__ */gn(yn,{children:[
|
|
62
|
-
/* @__PURE__ */mn(m,{value:{selectChild:Bi,addChild:Ci,childRowName:jr,blockRowName:Vi},children:/* @__PURE__ */mn(it,{mode:Ut,onOpenWebsiteSettings:so.openSettings??(()=>{}),onOpenSiteStyles:so.openStyles,onSelectNode:zo,onNotify:Wo,onHidePanel:dr,nodeActions:Dn?le(Hn,Dn.type):bn})}),
|
|
63
|
-
/* @__PURE__ */mn(Me,{side:"right",width:Io.right,min:Fe,max:Ee,defaultWidth:y.right,label:"Resize settings panel",onResize:jo})]}):
|
|
64
|
-
/* @__PURE__ */mn(P,{side:"right",onShow:dr})]}),Do&&/* @__PURE__ */gn("div",{className:"sf-toast "+("error"===Do.tone?"sf-toast--error":""),role:"status",children:[
|
|
65
|
-
/* @__PURE__ */mn("span",{className:"sf-toast-check","aria-hidden":"true",children:"error"===Do.tone?"!":"✓"}),Do.msg]},Ho),Hr.menu]})}))}export{wn as ScreenChrome};
|